diff --git a/.gitignore b/.gitignore index 26ab3c8d09..80f7631497 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ +/*.ys /Cache/ /Meta/ /rosettacode.log +/entry +/pick +/random-clojure-task +/.clj-kondo/ +/.lsp/ diff --git a/Conf/lang.yaml b/Conf/lang.yaml index 3e0d8b7106..72c972e3d8 100644 --- a/Conf/lang.yaml +++ b/Conf/lang.yaml @@ -4,6 +4,7 @@ 360 Assembly: '.360' 4D: .4d 4DOS Batch: .4dos +4ME: .4me 6502 Assembly: '.6502' 68000 Assembly: '.68000' 6800 Assembly: '.6800' @@ -16,22 +17,25 @@ A+: .a+ AArch64 Assembly: .aarch64 ABAP: .abap +ABC: .abc ACL2: .acl2 Acornsoft Lisp: .lisp Action!: .action ActionScript: .as Acurity Architect: .acurity -Ada: .ada -Agda: .agda +Ada: .adb +Adina: .adina Agda2: .agda2 +Agda: .agda Agena: .agena AHDL: .ahdl +AIDED NATURAL LANGUAGE: .aided Aikido: .aikido Aime: .aime Algae: .algae -ALGOL: .alg ALGOL 60: .alg ALGOL 68: .alg +ALGOL: .alg ALGOL-M: .alg ALGOL W: .alg Alice ML: .alice @@ -49,6 +53,7 @@ Anyways: .anyways Apex: .apex APL: .apl App Inventor: .app +Apple: .apple AppleScript: .applescript Applesoft BASIC: .basic Application Master: .app @@ -58,6 +63,8 @@ Arbre: .arbre Arc: .arc Arendelle: .arendelle Argile: .argile +Aria: .aria +ArkScript: .ark ARM Assembly: .arm ArnoldC: .arnoldc Arturo: .arturo @@ -67,35 +74,38 @@ ASP: .asp AspectC++: .acpp AspectJ: .aspectj ASP.Net: .asp -Assembly: .as +Assembly: .asm AssemblyScript: .asmscript Astro: .astro Asymptote: .asymptote Atari BASIC: .basic ATS: .ats AutoHotkey: .ahk -AutoIt: .autoit -AutoLISP: .l +Autohotkey V2: .ahk +AutoHotKey V2: .ahk +AutoIt: .au3 +AutoLISP: .lsp Avail: .avail AWK: .awk Axe: .axe Axiom: .axiom Axum: .axum Ayrch: .ayrch -B: .b B4J: .b4j B4X: .b4x Babel: .pb +BabyCobol: .cobol BaCon: .bacon Bait: .bait Ballerina: .ballerina Bas: .bas -BASIC: .basic Basic09: .basic BASIC256: .basic +BASIC: .basic Batari Basic: .basic Batch File: .bat Battlestar: .battlestar +B: .b BBC BASIC: .basic Bc: .bc BCPL: .bcpl @@ -103,6 +113,7 @@ Beads: .beads Beef: .beef Beeswax: .beeswax Befunge: .bf +Berkeley Logo: .logo Beta: .beta Biferno: .biferno Binary Lambda Calculus: .blc @@ -124,24 +135,28 @@ Bracmat: .bracmat Brainf***: .bf Brat: .brat Brlcad: .brlcad +Bruijn: .bruijn Burlesque: .blq -C++: .cpp -C: .c C0H: .c0h C1R: .c1r C2: .c2 C3: .c3 CafeOBJ: .cafeobj +Calc: .calc +Calcscript: .calc Caml: .caml Casio BASIC: .basic Cat: .cat CB80: .cb80 +CBASIC: .basic +C: .c C++/CLI: .cpp +C++: .cpp Cduce: .cduce Cecil: .cecil Ceylon: .ceylon CFEngine: .cfengine -Chapel: .chapel +Chapel: .chpl Chef: .chef Cherrycake: .cherrycake Chipmunk Basic: .basic @@ -150,6 +165,7 @@ ChucK: .chuck Cilk++: .cilk++ Cilk: .cilk Cind: .cind +CJam: .cjam Clarion: .clarion Clay: .clay Clean: .clean @@ -160,7 +176,7 @@ CLIPS: .clips Clojure: .clj CLU: .clu CMake: .cmake -COBOL: .cobol +COBOL: .cob Cobra: .cobra Coco: .coco Coconut: .coconut @@ -173,18 +189,19 @@ Common Lisp: .lisp Component Pascal: .pas Computer/zero Assembly: .0asm ContextFree: .cf +Convex: .convex Coq: .coq Corescript: .core Cowgol: .cowgol Crack: .crack Craft Basic: .basic Creative Basic: .basic -Crystal: .crystal +Crystal: .cr C sharp: .cs C Shell: .csh Cubescript: .cube Curry: .curry -D: .d +Curto: .curto Dafny: .dafny Dao: .dao Dart: .dart @@ -193,8 +210,9 @@ DataWeave: .dw DBL: .dbl Dc: .dc DCL: .dcl +D: .d DDNC: .ddnc -Delphi: .delphi +Delphi: .pas Deluge: .deluge DeviousYarn: .dy DIBOL-11: .dibol-11 @@ -206,19 +224,23 @@ DMS: .dms Dodo0: .dodo0 Draco: .draco Dragon: .dragon +Dragonstone: .dragonstone +DreamBerd: .dreamberd Dt: .dt +DuckDB: .duckdb DUP: .dup DWScript: .dw Dyalect: .dyalect Dylan: .dylan Dylan.NET: .dylan -E: .e EasyLang: .easy EC: .ec EchoLisp: .l ECL: .ecl Ecstasy: .ecstasy +Ed: .ed EDSAC order code: .edsac +E: .e Eero: .eero Efene: .efene Egel: .egel @@ -231,10 +253,10 @@ Elan: .elan ElastiC: .elastic Elena: .elena Elisa: .elisa -Elixir: .elixir +Elixir: .ex ELLA: .ella Elm: .elm -Emacs Lisp: .l +Emacs Lisp: .el EMal: .emal Emojicode: .emojicode Enguage: .enguage @@ -245,28 +267,29 @@ ERRE: .erre Es: .es ESQL: .esql Euler: .euler -Euphoria: .euphoria +Euphoria: .eu Evaldraw: .evaldraw Excel: .excel Explore: .explore Extended BrainF***: .ebf +Extended Color BASIC: .basic Ezhil: .ezhil -F: .f Factor: .factor Falcon: .falcon 'FALSE': .false -Fan: .fan Fancy: .fancy +Fan: .fan Fantom: .fantom FAUST: .faust FBSL: .fbsl -Fe: .fe FeatureC++: .cpp +Fe: .fe Felix: .felix Fennel: .fennel Ferite: .ferite Fermat: .fermat Fexl: .fexl +F: .f Fhidwfe: .fhidwfe Fish: .fish FLORA-2: .flora2 @@ -287,8 +310,10 @@ Frink: .frink FRISC Assembly: .frisc F Sharp: .fs FTCBASIC: .basic +FuncSug: .funcsug FunL: .funl Furor: .furor +FurryScript: .furryscript Futhark: .futhark FutureBasic: .basic FUZE BASIC: .basic @@ -308,15 +333,17 @@ GFA Basic: .basic G-fu: .gfu Glagol: .glagol GLBasic: .basic +Gleam: .gleam Glee: .glee Global Script: .global GlovePIE: .glovepie GLSL: .glsl GML: .gml Gnuplot: .gnuplot +Goaldi: .goaldi +Goboscript: .gobo Go!: .go Go: .go -Goaldi: .goaldi Golfscript: .golf Golo: .golo Goo: .goo @@ -333,7 +360,7 @@ Halon: .halon Harbour: .harbour Hare: .hare Haskell: .hs -Haxe: .haxe +Haxe: .hx Heron: .heron Hexiscript: .hexi HicEst: .hicest @@ -341,15 +368,17 @@ HLA: .hla HolyC: .holyc Hoon: .hoon Hope: .hope +Hopper: .hopper HPPPL: .hpppl HQ9+: .hq9+ Huginn: .huginn Hy: .hy HyperTalk: .ht -I: .i Icon: .icon IDL: .idl Idris: .idris +I: .i +Imp77: .imp77 Inform 6: '.inf' Inform 7: '.inf' Informix 4GL: .4gl @@ -364,18 +393,19 @@ Iptscrae: .iptscrae Isabelle: .isabelle IS-BASIC: .basic IWBASIC: .basic -J: .j Jabaco: .jabaco Jack: .jack Jacquard Loom: .jacquard +Jactl: .jactl Jakt: .jakt JAMES II/Rule-based Cellular Automata: .james Janet: .janet -Java: .java JavaFX Script: .javafx +Java: .java JavaScript: .js JCL: .jcl Jinja: .jinja +J: .j JoCaml: .jocaml JOVIAL: .jovial Joy: .joy @@ -384,31 +414,34 @@ JScript.NET: .jscript JSE: .jse Jsish: .jsish JudoScript: .judo -Julia: .julia -K: .k +Julia: .jl Kabap: .kabap Kamailio Script: .kamailio +Kantalo: .kantalo KAP: .kap Kaya: .kaya Keg: .keg KeyList Databasing: .keylist Kite: .kite Kitten: .kitten +K: .k KL1: .kl1 Klingphix: .klingphix Klong: .klong Koka: .koka +Komodo: .komodo KonsolScript: .konsol -Kotlin: .kotlin +Kotlin: .kts KQL: .kql Ksh: .ksh -L++: .l++ LabVIEW: .labview +Labyrinth: .labyrinth Lambda Prolog: .pro Lambdatalk: .lambdatalk -Lang: .lang Lang5: .lang5 +Lang: .lang Langur: .langur +Lapyst: .lapyst Lasso: .lasso LAST: .last LaTeX: .tex @@ -434,6 +467,7 @@ Little: .little Little Man Computer: .lmc LiveCode: .livecode LiveScript: .live +L++: .l++ LLP: .llp LLVM: .llvm Lobster: .lobster @@ -446,8 +480,8 @@ Lolli: .lolli Lotus 123 Macro Scripting: .lotus123 LotusScript: .lotus Lout: .lout -LSE: .lse LSE64: .lse64 +LSE: .lse LSL: .lsl LSTS: .lsts Lua: .lua @@ -461,12 +495,15 @@ M2000 Interpreter: .m2000 M4: .m4 M680x0: .m680x0 MACRO-11: .macro11 +Macsyma: .macsyma MAD: .mad Make: .make Malbolge: .malbolge MANOOL: .manool Maple: .maple MAPPER: .mapper +MariaDB: .sql +Mastermind: .mastermind Mathcad: .mathcad MathCortex: .mathcortex Mathematica: .math @@ -484,21 +521,23 @@ Mercury: .mercury Metafont: .metafont Metapost: .metapost MGS: .mgs +Mia: .mia Microsoft Small Basic: .basic -Min: .min MINIL: .minil Minimal BASIC: .basic MiniScript: .mini MiniZinc: .minizinc +Min: .min MIPS Assembly: .mips Mirah: .mirah Miranda: .miranda MIRC Scripting Language: .mirc Mirelle: .mirelle -ML: .ml ML/I: .mli MLite: .mlite +ML: .ml MMIX: .mmix +Mn: .mn Modula-2: .mod2 Modula-3: .mod3 Mojo: .mojo @@ -508,6 +547,8 @@ Monkey: .monkey Monte: .monte MontiLang: .monti MOO: .moo +MoonBit: .moonbit +MoonRock: .moonrock MoonScript: .moon Morfa: .morfa Mosaic: .mosaic @@ -546,30 +587,36 @@ Nit: .nit Niue: .niue Nix: .nix NLP++: .nlp++ +Nom: .num NOWUT: .nowut NQP: .nqp NS-HUBASIC: .basic NSIS: .nsis N/t/roff: .ntroff +Nu: .nu Nutt: .nutt Nyquist: .nyquist -OASYS: .oasys OASYS Assembler: .oasys +OASYS: .oasys +Oberon-07: .oberon Oberon: .oberon Objeck: .objeck ObjectIcon: .oi Objective-C: .m +Object Pascal Implementations: .pas Object Pascal: .pas -OCaml: .ocaml +OCaml: .ml Occam: .occam Octave: .octave Odin: .odin Oforth: .fth Ol: .ol Omega: .omega +OmniMark: .xom Onyx: .onyx -OOC: .ooc +Onyx (wasm): .onyx OOCalc: .oocalc +OOC: .ooc OoRexx: .rexx Opa: .opa OpenC++: .openc++ @@ -585,10 +632,12 @@ Oz: .oz Palo Alto Tiny BASIC: .basic Panda: .panda Panoramic: .panoramic +ParaCL: .paracl Pare: .pare PARI/GP: .parigp -Pascal: .pas PascalABC.NET: .pas +Pascal: .pas +Pascal-P: .pas PASM: .pasm PDP-11 Assembly: .pdp11 Pebble: .pebble @@ -597,15 +646,16 @@ Pentium Assembly: .pentium PeopleCode: .peoplecode PepsiScript: .pepsi Peri: .peri -Perl: .pl Perl5i: .p5i Perl 6: .pl6 +Perl: .pl Peylang: .peylang -Phix: .phix Phixmonti: .phixmonti +Phix: .phix PHL: .phl PHP: .php Picat: .picat +Pico-8: .pico8 PicoLisp: .l Pict: .pict Piet: .piet @@ -618,12 +668,13 @@ Plain English: .plain PlainTeX: .tex Plan: .plan PL/B: .plb -PL/I: .pli PL/I-80: .pli +PL/I: .pli PL/M: .plm PL/pgSQL: .sql PL/SQL: .sql PLUS: .plus +Pluto: .pluto PLZ/SYS: .plz Pointless: .pointless Polyglot: .polyglot @@ -636,55 +687,58 @@ POV-Ray: .povray PowerBASIC: .basic Powerbuilder: .powerbuilder PowerPC Assembly: .ppc -PowerShell: .psh +PowerShell: .ps1 PPL: .ppl Processing: .processing Processing Python mode: .processing-py Processing.R: .processing-r ProDOS: .dos +Prog8: .prog8 +ProgressBASIC: .basic Prolog: .pro PROMAL: .promal PSQL: .psql -Pure: .pure PureBasic: .basic Pure Data: .puredata +Pure: .pure Purity: .purity -Pyret: .pyret +Pyret: .arr Python: .py -Q: .q QB64: .qb64 QBasic: .basic Qi: .qi .QL: .ql QL SuperBASIC: .basic Qore: .qore +Q: .q Quackery: .quackery QuakeC: .c QuickBASIC: .basic Quill: .quill Quite BASIC: .basic Quorum: .quorum -R: .r -Ra: .ra Racket: .rkt Raku: .raku RapidQ: .rapidq Rapira: .rapira +Ra: .ra Rascal: .rascal RASEL: .rasel RATFOR: .ratfor Raven: .raven REALbasic: .basic -Reason: .reason +Reason: .re +Rebol: .rebol REBOL: .rebol Red: .red Reduce: .reduce Refal: .refal Relation: .relation -ReScript: .re +ReScript: .res Retro: .retro Revolution: .rev REXX: .rexx +Rhombus: .rhombus Rhope: .rhope Rhovas: .rhovas Ring: .ring @@ -693,26 +747,30 @@ RLaB: .rlab RLSL: .rlsl Robotic: .robotic Rockstar: .rockstar -RPG: .rpg +Rocq: .rocq +Roc: .roc RPGIV: .rpgiv -RPL: .rpl +RPG: .rpg RPL/2: .rpl2 +RPL: .rpl +R: .r RTL/2: .rtl2 RTSL: .rtsl Rubylog: .rubylog Ruby: .rb Run BASIC: .basic -Rust: .rust -S++: .s++ +Rust: .rs +Rye: .rye Sage: .sage Salmon: .salmon -SAS: .sas +SapbotVM: .sapbot SASL: .sasl +SAS: .sas Sass/SCSS: .sass Sather: .sa S-BASIC: .basic Scala: .scala -Scheme: .ss +Scheme: .scm Scilab: .scilab Scratch: .scratch ScratchScript: .scratch @@ -724,14 +782,15 @@ Seed7: .seed7 Self: .self SenseTalk: .sensetalk SequenceL: .sequencel -SETL: .setl Setl4: .setl4 Set lang: .set +SETL: .setl Shale: .shale SheerPower 4GL: .4gl Shen: .shen Shiny: .shiny Sidef: .sidef +SIL: .sil SimpleCode: .simplecode SimpleLang: .simple SIMPOL: .simpol @@ -748,8 +807,8 @@ Smalltalk: .st Smart BASIC: .basic SMEQL: .smeql SmileBASIC: .basic -Snobol: .sno SNOBOL4: .sno +Snobol: .sno SNUSP: .snusp Soar: .soar Soda: .soda @@ -757,20 +816,22 @@ SoneKing Assembly: .soneking SPAD: .spad SPARC Assembly: .sparc SparForte: .sparforte -SPARK: .spark Sparkling: .sparkling +SPARK: .spark Spin: .spin SPL: .spl SPSS: .spss -SQL: .sql SQL PL: .sql +SQL: .sql Squirrel: .nut +S++: .s++ SSEM: .ssem Standard ML: .ml Star: .star Stata: .stata Stax: .stax StreamIt: .streamit +Stringle: .stringle Suneido: .suneido Superbase BASIC: .basic SuperCollider: .sc @@ -784,14 +845,15 @@ SystemVerilog: .v TailDot: .taildot Tailspin: .tailspin TAL: .tal +TAV: .tav Tbas: .tbas Tcl: .tcl TechBASIC: .basic Teco: .teco TeLa: .tela Tern: .tern -Terra: .terra Terraform: .terraform +Terra: .terra TestML: .tml Thistle: .thistle Thyrd: .thyrd @@ -799,6 +861,7 @@ TI-57: .ti57 TI-83 BASIC: .basic TI-83 Hex Assembly: .asm TI-89 BASIC: .basic +TI BASIC: .basic Tiny BASIC: .basic Tiny Craft Basic: .basic TIS-100: .tis100 @@ -827,32 +890,34 @@ TXR: .txr Typed Racket: .rkt TypeScript: .ts UC++: .uc++ +Uiua: .uiua Ultimate++: .ultimate++ Unicon: .unicon Uniface: .uniface -Unison: .unison +Unison: .u UnixPipes: .up UNIX Shell: .sh Unlambda: .unlambda -Ursa: .ursa +Ursalang: .ursa Ursala: .ursala +Ursa: .ursa UScript: .u UserRPL: .rpl UTFool: .utfool -V: .v +Uxntal: .uxnatl Vala: .vala Vale: .vale VAX Assembly: .vax VB6: .vb6 VBA: .vba -VBScript: .vb +VBScript: .vbs Vedit macro language: .vedit Verbexx: .verbexx Verilog: .v -VHDL: .vhdl +VHDL: .vhd Vim Script: .vim -Visual Basic: .vb Visual Basic .NET: .vb +Visual Basic: .vb Visual FoxPro: .fvp Visual Objects: .vobj Visual Prolog: .pro @@ -861,7 +926,10 @@ Vorpal: .vorpal Vox: .vox VRML: .vrml VTL-2: .vtl-2 +V: .v V (Vlang): .v +Vyxal: .vyxal +Waduzitdo: .waduzitdo Wart: .wart WDTE: .wdte WebAssembly: .wasm @@ -883,31 +951,32 @@ XBase: .xbase XBasic: .basic XBS: .xbs XEec: .xeec -XL: .xl XLISP: .l +XL: .xl Xojo: .xojo XPath 2.0: .xpath XPL0: .xpl0 XProc: .xproc XProfan: .xprofan XQuery: .xquery -XS: .xs -XSLT: .xslt +X-script: .x XSLT 1.0: .xslt XSLT 2.0: .xslt +XSLT: .xslt +XS: .xs XTalk: .xtalk XUL: .xul -Ya: .ya Yabasic: .basic Yacas: .yacas YAMLScript: .ys +Ya: .ya Yorick: .yorick Z80 Assembly: .z80 ZED: .zed Zig: .zig Zkl: .zkl -Zoea: .zoea Zoea Visual: .zoea +Zoea: .zoea Zonnon: .zonnon Zoomscript: .zoom ZPL: .zpl diff --git a/Lang/11l/Bioinformatics-base-count b/Lang/11l/Bioinformatics-base-count deleted file mode 120000 index d8c9e2572d..0000000000 --- a/Lang/11l/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/11l \ No newline at end of file diff --git a/Lang/11l/Comments b/Lang/11l/Comments deleted file mode 120000 index 3585963399..0000000000 --- a/Lang/11l/Comments +++ /dev/null @@ -1 +0,0 @@ -../../Task/Comments/11l \ No newline at end of file diff --git a/Lang/11l/List-comprehensions b/Lang/11l/List-comprehensions deleted file mode 120000 index f4de0b78ad..0000000000 --- a/Lang/11l/List-comprehensions +++ /dev/null @@ -1 +0,0 @@ -../../Task/List-comprehensions/11l \ No newline at end of file diff --git a/Lang/11l/Meissel-Mertens-constant b/Lang/11l/Meissel-Mertens-constant deleted file mode 120000 index 908ef16ca2..0000000000 --- a/Lang/11l/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/11l \ No newline at end of file diff --git a/Lang/11l/Miller-Rabin-primality-test b/Lang/11l/Miller-Rabin-primality-test deleted file mode 120000 index cec9772a16..0000000000 --- a/Lang/11l/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/11l \ No newline at end of file diff --git a/Lang/11l/Sorting-Algorithms-Circle-Sort b/Lang/11l/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 38059f4dea..0000000000 --- a/Lang/11l/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/11l \ No newline at end of file diff --git a/Lang/4D/00-LANG.txt b/Lang/4D/00-LANG.txt index d591e6be7f..8c8b507919 100644 --- a/Lang/4D/00-LANG.txt +++ b/Lang/4D/00-LANG.txt @@ -1,3 +1,6 @@ -{{stub}}{{language|4D}}{{IDE}}'''4D''' (or '''4th Dimension''') is a database management system and [[:Category:Integrated Development Environments|integrated development environment]] authored by Laurent Ribardière in 1984. +{{stub}} +{{language|4D +|site=https://us.4d.com/ +}}{{IDE}}'''4D''' (or '''4th Dimension''') is a database management system and [[:Category:Integrated Development Environments|integrated development environment]] authored by Laurent Ribardière in 1984. ==Citations== *[[wp:4th_Dimension_%28Software%29|Wikipedia:4th Dimension (Software)]] \ No newline at end of file diff --git a/Lang/4ME/00-LANG.txt b/Lang/4ME/00-LANG.txt new file mode 100644 index 0000000000..d297ba9483 --- /dev/null +++ b/Lang/4ME/00-LANG.txt @@ -0,0 +1,7 @@ +{{language|4ME +|site=https://thevitebsk.github.io/4ME.by/}} +4ME is a programing language created by [[User:Gaham]] implemented in 04.07.2024 MSK +==See Also== +* [https://esolangs.org/wiki/4ME 4ME in Esolangs.org] +* [https://github.com/Thevitebsk/4me/ Github repo] +[[Category:Programming paradigm/Concatenative]] \ No newline at end of file diff --git a/Lang/4ME/00-META.yaml b/Lang/4ME/00-META.yaml new file mode 100644 index 0000000000..f0031de2c3 --- /dev/null +++ b/Lang/4ME/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:4ME diff --git a/Lang/6502-Assembly/00-LANG.txt b/Lang/6502-Assembly/00-LANG.txt index a7fa28ad34..1273acfa02 100644 --- a/Lang/6502-Assembly/00-LANG.txt +++ b/Lang/6502-Assembly/00-LANG.txt @@ -131,6 +131,29 @@ This flag is set if the BRK command was executed. The BRK basically * Set with: BRK * Cleared with: RTI * There are no branches associated with this command. + +This flag is used only for differentiating a BRK from an hardware IRQ +IRQ: + STA saveAccumulator ; save accumulator + PLA ; get flags + STA saveFlags ; save flags + AND #$10 ; check "break" flag + BNE IRQ_fromBreak ; if(break flag set){ goto IRQ_fromBreak; } + JMP IRQ_fromHardware ; else{ goto IRQ_fromInterrupt; } +IRQ_fromBreak: + LDA saveFlags ; load flags from temp address + PHA ; restore flags to stack + LDA saveAccumulator ; restore accumulator + ;... + RTI ; return from interrupt + +IRQ_fromInterrupt: + LDA saveFlags ; load flags from temp address + PHA ; restore flags to stack + LDA saveAccumulator ; restore accumulator + ;... + RTI ; return from interrupt +

===Decimal=== diff --git a/Lang/6502-Assembly/N-queens-problem b/Lang/6502-Assembly/N-queens-problem new file mode 120000 index 0000000000..6cb6d9c259 --- /dev/null +++ b/Lang/6502-Assembly/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/6502-Assembly \ No newline at end of file diff --git a/Lang/68000-Assembly/00-LANG.txt b/Lang/68000-Assembly/00-LANG.txt index cfd37d0eae..245cbaaea5 100644 --- a/Lang/68000-Assembly/00-LANG.txt +++ b/Lang/68000-Assembly/00-LANG.txt @@ -3,31 +3,36 @@ {{language}} 68000 assembly is the assembly language used for the Motorola 68000, or commonly known as the 68K. It should not be confused with the 6800 (which predates it). The Motorola 68000 is a big-endian processor with full 32-bit capabilities (despite most systems that use it being considered 16-bit.) It was used in many computers such as the Amiga or the Canon Cat, as well as game consoles such as the Sega Genesis and Neo Geo. - ==Architecture Overview== ===Big-Endian=== The 68000, unlike most processors of its era, is big-endian. This means that bytes are stored from left to right. The example below illustrates this concept: -MOVE.L #$12345678,$100000 ;store the hexadecimal numeral #$12345678 at memory address $100000 + +MOVE.L #$12345678,$100000 ;store the hexadecimal numeral #$12345678 at memory address $100000 + +
 ;hexdump of $100000:
 ;$100000 = $12
 ;$100001 = $34
 ;$100002 = $56
-;$100003 = $78
+;$100003 = $78
+
On a little-endian processor such as in [[x86 Assembly]], the order of the bytes would be reversed, i.e.: -;hexdump of $100000 +
+;hexdump of $100000
 ;$100000 = $78
 ;$100001 = $56
 ;$100002 = $34
-;$100003 = $12
+;$100003 = $12
+
-This difference isn't usually relevant in the majority of situations, so don't concern yourself too much. It's much more important when doing [[6502 Assembly]] where registers are smaller than the address space. +The main difference is that if you wanted to access this value as a byte or word it would be at a different address, whereas with a little endian architecture it is at the same address. ===Notation Conventions=== How you write the source code depends on your assembler and the syntax it uses. This page is written using Motorola syntax but there is also Milo syntax which has different conventions. -How you go about defining numbers or text in your code varies wildly between assemblers. I'm using VASM and these are the rules I have to follow, but your assembler may be different. +How you go about defining numbers or text in your code varies wildly between assemblers. * A number with a # in front represents a constant, literal value. For example, the 3 in MOVE.B #3,D0 represents the number 3. @@ -45,72 +50,88 @@ How you go about defining numbers or text in your code varies wildly between ass * The operand before the comma is the "source", and the operand after is the "destination." For example, MOVE.L D3,D2 takes the value in D3 and stores it into D2, not the other way around. This is the opposite of x86 and ARM, which have the source on the right and the destination on the left. - -Data blocks, on the other hand, begin with DC.B, DC.W, or DC.L and each represents a constant numeric value. Strangely, you do NOT prefix these with # to signify them as constants (doing so will cause an error on most assemblers). However, you can use the $ or % modifiers to denote hexadecimal or binary. +Data blocks, on the other hand, begin with DC.B, DC.W, or DC.L and each represents a constant numeric value. You do NOT prefix these with # to signify them as constants (doing so will cause an error on most assemblers). However, you can use the $ or % modifiers to denote hexadecimal or binary. Keep in mind that there is no requirement to use hexadecimal, decimal, or binary in your source code. It all gets converted to binary anyway. However, it is recommended to use the notation that is appropriate for how your data is meant to be interpreted, for readability purposes. ===Data Registers=== There are eight 32-bit data registers on the 68000, numbered D0-D7. As the name implies, these are designed to hold data. Much like in [[ARM Assembly]], each one is identical in terms of which commands it can use. A command that can be used for D0 can be used for any other D-register. -MOVE.B #$FF,D0 ;move the hexadecimal value 0xFF into the bottom byte of D0. -ADD.W #$8000,D4 ;add hexadecimal 0x8000 to the value stored in D4. + +MOVE.B #$FF,D0 ;move the hexadecimal value 0xFF into the bottom byte of D0. +ADD.W #$8000,D4 ;add hexadecimal 0x8000 to the value stored in D4. + ===Address Registers=== There are eight of these as well, numbered A0-A7. A7 is reserved as the stack pointer, and is commonly referenced as SP in assemblers. The others are free to use for any purpose. Although these registers are 32-bit, the 68000's address space is 24-bit (ranges from 0x000000 to 0xFFFFFF), so the leftmost byte is ignored. You can do simple math involving these registers but more complicated commands like multiply or divide can only be used with data registers. Address registers are used to contain addresses and extract the values stored within. ====Loading From Memory==== -MOVEA.L #$200000,A2 ;usually these are loaded from a label. + +MOVEA.L #$200000,A2 ;usually these are loaded from a label. ;The hex dump of address $200000: 44 55 66 77 MOVE.L #$00000000,D0 MOVE.B (A2),D0 ;load the byte stored at $200000 into D0. D0 = #$00000044 MOVE.W (A2),D0 ;load the word stored at $200000 into D0. D0 = #$00004455 MOVE.L (A2),D0 ;load the long stored at $200000 into D0. D0 = #$44556677 -MOVE.L D2,(A5) ;store the contents of D2 into the memory address pointed to by A5. - +MOVE.L D2,(A5) ;store the contents of D2 into the memory address pointed to by A5. + Note that it's also possible to transfer values to/from memory directly, without involving address registers at all. For constant memory locations, this is fine. However, the real strength of the address registers is in their pre-decrement and post-increment modes, which constant memory locations cannot use. -MOVE.L ($00FF0000),D0 + +MOVE.L ($00FF0000),D0 MOVE.W D1,($00FFFFFE) -MOVE.W ($00FF0000),($00FF1000) +MOVE.W ($00FF0000),($00FF1000) + The use of parentheses is not required on most assemblers, but can be used as a reminder to someone reading your code that these represent the values stored at the specified memory locations rather than literal numbers. ====Post-Increment==== The post-increment mode is specified by adding a + to the end of parentheses. This means that after the command is done, the address stored in the address register (not the value stored at that address) is increased by the byte length of the command (1 for .B, 2 for .W, 4 for .L). -MOVEA.L #$00240000,A4 ;load the address $240000 into A4 + +MOVEA.L #$00240000,A4 ;load the address $240000 into A4 MOVE.W (A4)+,D0 ;move the word stored at $240000 into D0, then increment to #$240002 MOVE.L (A4)+,D1 ;move the long stored at $240000 into D1, then increment to #$240006 -MOVE.L (SP)+,D3 ;pop the top value of the stack into D3 +MOVE.L (SP)+,D3 ;pop the top value of the stack into D3 + ====Pre-Decrement==== The pre-decrement mode is specified by typing a - before the parentheses. This means that before the command is done, the address stored in the address register is decreased by the byte length of the command. -MOVEA.L #$0024000A,A4 ;load the address $24000A into A4 +MOVEA.L #$0024000A,A4 ;load the address $24000A into A4 MOVE.W -(A4),D0 ;move the word stored at $240008 into D0 MOVE.L -(A4),D1 ;move the long stored at $240004 into D1 -MOVE.L D2,-(SP) ;push the contents of D2 onto the stack +MOVE.L D2,-(SP) ;push the contents of D2 onto the stack ====Address Offsets==== A memory address can be offset by a data register, an immediate value, or both. If a data register is used, only the bottom 2 bytes are considered. In either case, the contents of the data register and/or the immediate value are added to the value stored in the address register, and the value is read from that address at the specified length. The offsets are applied during the calculation only; the actual contents in the address register after the move are unchanged. Using a post-increment or pre-decrement with this addressing mode will only update the address by the specified length, not by the offsets. -MOVE.B (4,A0,D0),D1 ;The byte at A0+D0+4 is loaded into D1. + +MOVE.B (4,A0,D0),D1 ;The byte at A0+D0+4 is loaded into D1. + + It's possible to use the same data register as the offset and the destination. This does not cause any problems whatsoever, as the data register offset is "locked in" before the move, and is only updated after the command fully executes. Using the same command again immediately afterwards will offset based on the new value of that register. -MOVE.W (6,A0,D0),D0 ;The word at A0+D0+6 is read, then loaded into D0. + +MOVE.W (6,A0,D0),D0 ;The word at A0+D0+6 is read, then loaded into D0. + + A very important note is that when using this method with words and longs, the resulting address must be even! Otherwise the CPU will crash. For MOVE.B it doesn't matter. ====Effective Address==== A calculated offset can be saved to an address register with the LEA command, which stands for "Load Effective Address." [[x86 Assembly]] also has this command, and it serves the same purpose. The syntax for it can be a bit misleading depending on your assembler. -LEA myData,A0 ;load the effective address of myData into A0 + +LEA myData,A0 ;load the effective address of myData into A0 LEA (4,A0),A1 ;load into A1 the effective address A0+4. This looks like a dereference operation but it is not! -MOVE.W (A1),D1 ;dereference A1, loading the value it points to into D1. +MOVE.W (A1),D1 ;dereference A1, loading the value it points to into D1. + This can get confusing, especially if you have tables of pointers. Just remember that LEA cannot dereference an address. If you don't want to store the effective address in an address register, you can use PEA (push effective address) to put it onto the stack instead. -LEA myData,A0 ;load the effective address of myData into A0 -PEA (4,A0) ;store the effective address of A0+4 onto the stack. + +LEA myData,A0 ;load the effective address of myData into A0 +PEA (4,A0) ;store the effective address of A0+4 onto the stack. + ====The Stack==== The 68000's stack is commonly referred to as SP but it is also address register A7. This register is handled differently than the other address registers when pushing bytes onto the stack. A byte value pushed onto the stack will be padded to the right. The stack needs to pad byte-length data so that it can stay word-aligned at all times. Otherwise the CPU would crash as soon as you tried to use the stack for anything other than a byte! @@ -124,48 +145,48 @@ The 68000 can work with 8-bit, 16-bit, or 32-bit values. Some commands only work If you don't specify a length with your command, it usually defaults to word length, but ultimately it depends on the command you are using. (Some commands cannot be used at word length.) Bytes and words moved into a register are always stored on the right-hand side. For example: -MOVE.L #$FFFFFFFF,D7 + +MOVE.L #$FFFFFFFF,D7 MOVE.B #$00,D7 ;D7 contains #$FFFFFF00 -MOVE.W #$2222,D7 ;D7 contains #$FFFF2222 +MOVE.W #$2222,D7 ;D7 contains #$FFFF2222 + As you can see, the rest of the register is unchanged. (On the ARM, it would turn to zeroes.) This is very important to remember. If your code is doing something unexpected it might be due to the "old" value of the register corrupting another function. If the given constant is smaller than the length provided, the value is padded to the left with zeroes. -MOVE.W #$FF,D3 ;D3 = #$xxxx00FF, where x is the previous value of D3. -MOVE.L #0,D3 ;D3 = #$00000000 + +MOVE.W #$FF,D3 ;D3 = #$xxxx00FF, where x is the previous value of D3. +MOVE.L #0,D3 ;D3 = #$00000000 + Loading immediate values into address registers is different. You can only move words or longer into address registers, and if you move a word, the value is sign-extended. This means that if the top nibble of the word is 8 or greater, the value gets padded to the left with Fs, and is padded with zeroes if the top nibble is 7 or less. If you're adding a constant value less than 7FFF to an address, it's usually safe to use the word length operation, which takes less bytes to encode than the long length version. -MOVEA.W #$8000,A4 ;A4 = #$FFFF8000. Remember the top byte is ignored so this is the same as #$00FF8000. -MOVEA.W #$7FFF,A3 ;A3 = #$00007FFF + +MOVEA.W #$8000,A4 ;A4 = #$FFFF8000. Remember the top byte is ignored so this is the same as #$00FF8000. +MOVEA.W #$7FFF,A3 ;A3 = #$00007FFF + ==The Flags== The flags are stored in the Condition Code Register, also known as the CCR. The 68000 has no built-in commands like CLC for clearing/setting individual flags. Rather, you can alter them directly with MOVE,AND,OR, and EOR. Unfortunately, this means you'll have to remember which bits represent which flags. Or, if your assembler supports macros, you can define a macro that handles this for you. The flags update automatically after most operations, and take into consideration the operand sizes when doing so. Check out this example: - + MOVE.L #$12FF,D0 ADD.B #1,D0 - + Since we used ADD.B, D0 now contains $1200, and the extend, carry, and zero flags are all set. Had we done ADD.W, we would get $1300 in D0 with none of those flags set. The flags are based on what the actual instruction "sees", not the entire register at all times. * X: The eXtend flag is bit 4 of the CCR, and is similar to the carry flag. It gets set and cleared often for the same reasons and is used with the ADDX, SUBX, NEGX, ROXL, and ROXR commands. Why the 68000 has both this and the carry flag, I still don't know. - * N: The negative flag is bit 3 of the CCR, and is set when the last operation resulted in a "negative" value. What constitutes a negative value depends on the size of the last operation - for .B instructions, $80-$FF. For .W instructions, $8000-$FFFF, and for .L instructions, $80000000-$FFFFFFFF. - * Z: The zero flag is bit 2 of the CCR and works like you would expect - it's set whenever an operation results in zero. Unlike x86 Assembly, this also includes moving 0 directly into a register, clearing a register or memory with CLR, etc. - * V: The overflow flag is bit 1 of the CCR. It is set whenever a math operation results in a value crossing the $7F-$80 boundary. (Wraparound from 00 to FF doesn't count as overflow, but it does set the carry flag.) - * C: The carry flag is bit 0 of the CCR. It is set when a math operation results in a carry or borrow. Rolling over from FF to 00, or a 1 getting "pushed out" via a bit shift or rotate, set the carry flag. When using CMP, the carry flag determines the unsigned magnitude comparison. Carry set is less than, carry clear is greater than or equal. - - In truth, the flags are a 16-bit register, of which the CCR is just the "low half". The SR (status register) is the full 16-bit register. There are a few additional flags in the upper half, which are used by the operating system. You can read these but for the most part you won't need to write to them. @@ -189,13 +210,15 @@ The 68000 supports 7 different interrupts, often called IRQs or Interrupt Reques ==Alignment== The 68000 can only read or write words and longs at even addresses. Doing so at an odd address will result in the CPU crashing. (Note that reading byte data will not cause a crash regardless of whether it's located at an odd or even address.) This isn't usually a problem, but it can be if the programmer is not careful with the way their data is organized. Consider the following example: -TestData: + +TestData: DC.B $02 DC.W $0345 LEA TestData,A0 ;load effective address of TestData into A0. MOVE.B (A0)+,D0 ;load $02 into D0, increment A0 by 1 -MOVE.W (A0)+,D1 ;this crashes the CPU since A0 is now odd +MOVE.W (A0)+,D1 ;this crashes the CPU since A0 is now odd + How was it known that the address was odd at the second instruction? Simple. All instructions take an even number of bytes to encode. So there are only a few ways improper alignment can occur: * An odd value is loaded into an address register. @@ -205,18 +228,23 @@ How was it known that the address was odd at the second instruction? Simple. All If the programmer is smart with the way they encode byte-length data they can avoid this problem entirely with little effort. One way is to separate byte-length data into its own table. -ByteData: + +ByteData: DC.B $20,$40,$60,$80 WordData: -DC.W $1000,$2000,$3000,$4000 +DC.W $1000,$2000,$3000,$4000 + Another way is to pad the data with an extra byte, so that there is an even number of entries in the table. This becomes impractical with large data tables, so the EVEN directive can be placed after a series of bytes. If the byte count is odd, EVEN will pad the data with an extra byte. If it's already even, the EVEN command is ignored. This saves you the trouble of having to count a long series of bytes without worrying about wasting space. -MyString: DC.B "HELLO WORLD 12345678900000",0 -EVEN ;some assemblers require this to be on its own line + +MyString: DC.B "HELLO WORLD 12345678900000",0 +EVEN ;some assemblers require this to be on its own line + A third way is to perform a "dummy read." This is when a value is read from an address using pre-decrement or post-increment, with the sole purpose of moving the pointer, and the value being read is of zero interest. This method lets you work with mixed data types in the same table, but it requires the programmer to know in advance where the byte-length data begins and ends. -TestData: + +TestData: DC.B $02,$03,$04 DC.W $0345 @@ -227,7 +255,8 @@ MOVE.B (A0)+,(A1)+ ;copy $04 to a new memory location ;if we did MOVE.W (A0)+,(A1)+ now we'd crash. First we need to adjust the pointers. MOVE.B (A0)+,D7 ;dummy read to D7. Now A0 is word aligned. MOVE.B (A1)+,D7 ;dummy read to D7. Now A1 is word aligned. -MOVE.W (A0)+,(A1)+ ;copy $0345 to a new memory location +MOVE.W (A0)+,(A1)+ ;copy $0345 to a new memory location + Using ADDA.L #1,A0 and ADDA.L #1,A1 would have worked also, instead of the dummy read. The 68000 gives the programmer a lot of different ways to do a task. diff --git a/Lang/68000-Assembly/Musical-scale b/Lang/68000-Assembly/Musical-scale new file mode 120000 index 0000000000..0a23b13b4e --- /dev/null +++ b/Lang/68000-Assembly/Musical-scale @@ -0,0 +1 @@ +../../Task/Musical-scale/68000-Assembly \ No newline at end of file diff --git a/Lang/8080-Assembly/Align-columns b/Lang/8080-Assembly/Align-columns new file mode 120000 index 0000000000..d9134cb487 --- /dev/null +++ b/Lang/8080-Assembly/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/8080-Assembly \ No newline at end of file diff --git a/Lang/8080-Assembly/Display-a-linear-combination b/Lang/8080-Assembly/Display-a-linear-combination new file mode 120000 index 0000000000..5e499be357 --- /dev/null +++ b/Lang/8080-Assembly/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/8080-Assembly \ No newline at end of file diff --git a/Lang/8080-Assembly/Integer-comparison b/Lang/8080-Assembly/Integer-comparison new file mode 120000 index 0000000000..e48c1e8ea4 --- /dev/null +++ b/Lang/8080-Assembly/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/8080-Assembly \ No newline at end of file diff --git a/Lang/8080-Assembly/Loops-Infinite b/Lang/8080-Assembly/Loops-Infinite new file mode 120000 index 0000000000..f6336ebca0 --- /dev/null +++ b/Lang/8080-Assembly/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/8080-Assembly \ No newline at end of file diff --git a/Lang/8080-Assembly/McNuggets-problem b/Lang/8080-Assembly/McNuggets-problem new file mode 120000 index 0000000000..69d7be7c03 --- /dev/null +++ b/Lang/8080-Assembly/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/8080-Assembly \ No newline at end of file diff --git a/Lang/8080-Assembly/Ordered-words b/Lang/8080-Assembly/Ordered-words new file mode 120000 index 0000000000..eee238f68d --- /dev/null +++ b/Lang/8080-Assembly/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/8080-Assembly \ No newline at end of file diff --git a/Lang/8080-Assembly/Repeat-a-string b/Lang/8080-Assembly/Repeat-a-string new file mode 120000 index 0000000000..8f626bb358 --- /dev/null +++ b/Lang/8080-Assembly/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/8080-Assembly \ No newline at end of file diff --git a/Lang/8080-Assembly/Run-length-encoding b/Lang/8080-Assembly/Run-length-encoding new file mode 120000 index 0000000000..bc3ed9076c --- /dev/null +++ b/Lang/8080-Assembly/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/8080-Assembly \ No newline at end of file diff --git a/Lang/8080-Assembly/Sieve-of-Eratosthenes b/Lang/8080-Assembly/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..ddc8441b98 --- /dev/null +++ b/Lang/8080-Assembly/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/8080-Assembly \ No newline at end of file diff --git a/Lang/8080-Assembly/Square-but-not-cube b/Lang/8080-Assembly/Square-but-not-cube new file mode 120000 index 0000000000..e8de867485 --- /dev/null +++ b/Lang/8080-Assembly/Square-but-not-cube @@ -0,0 +1 @@ +../../Task/Square-but-not-cube/8080-Assembly \ No newline at end of file diff --git a/Lang/8080-Assembly/Twos-complement b/Lang/8080-Assembly/Twos-complement new file mode 120000 index 0000000000..86928fcdc9 --- /dev/null +++ b/Lang/8080-Assembly/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/8080-Assembly \ No newline at end of file diff --git a/Lang/8080-Assembly/Zeckendorf-number-representation b/Lang/8080-Assembly/Zeckendorf-number-representation new file mode 120000 index 0000000000..b0569b898c --- /dev/null +++ b/Lang/8080-Assembly/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/8080-Assembly \ No newline at end of file diff --git a/Lang/8086-Assembly/00-LANG.txt b/Lang/8086-Assembly/00-LANG.txt index 7cf10761fa..9120d12d87 100644 --- a/Lang/8086-Assembly/00-LANG.txt +++ b/Lang/8086-Assembly/00-LANG.txt @@ -4,13 +4,13 @@ ===Segmented Memory=== The 8086 uses a segmented memory model, similar to the Super Nintendo Entertainment System. Unlike banked memory models used in the Commodore 64 and late NES games, segment addresses are held in segment registers. These segment registers are 16 bit and get left-shifted by 4 and added to the pointer register of interest to determine the memory address to look up. The 8086 has four in total, but only the DS and ES registers can be used by the programmer. (The other two work with the stack pointer and instruction pointer, and are loaded for you.) On the 8086, you can only load segment registers with the value in a data register, or with the POP command. So first you must load a segment into a data register, THEN into a segment register. -;This is NOT valid code! +;This is NOT valid code! mov ds, @data ;you're trying to move the data segment location directly into DS. You can't! ;This is the proper way: mov ax, @data ;I chose AX but I could have used BX, CX, or DX. -mov ds, ax ;load DS with the data segment. +mov ds, ax ;load DS with the data segment. It's important to remember the subtle distinction between a ''segment'' and a ''segment register.'' Your program might have labeled ''segments'' such as .data and .code, but in order to properly read from/write to these sections you'll need to load their memory locations into ''segment registers.'' @@ -18,17 +18,17 @@ It's important to remember the subtle distinction between a ''segment'' and a '' There are four data registers: AX, BX, CX, and DX. While most commands can use any of them, some only work with particular data registers. System calls in particular are very specific about which registers can be used for what. On [[MS-DOS]], the AX register is used for selecting the desired interrupt to use with the INT command. Each data register is 16-bit, but has two eight bit halves ending in H or L, e.g. AH, AL. Instructions can be executed using the whole register or just half of it. -mov ax, 1000h ;move 1000h into AX, or equivalently, move 10h into AH and 00h into AL. +mov ax, 1000h ;move 1000h into AX, or equivalently, move 10h into AH and 00h into AL. Moving a value smaller than 16 bits into ?X is the same as moving it into ?L, and moving 0 into ?H. (? represents the data register of your choice. They are all the same in this regard.) -mov ax,0030h +mov ax,0030h ;is the same as: mov al, 30h -mov ah, 0h +mov ah, 0h Commands that alter the contents of a single register will not affect the other half. -mov ax,00FFh -inc al +mov ax,00FFh +inc al If we had executed INC AX, then AX would have been incremented to 0x100. Since we only incremented AL, only AL was incremented in this case, and AH '''still equals 0x00!''' Generally speaking, the 8086's registers serve the following purposes: @@ -42,24 +42,24 @@ When writing to or reading from consecutive sections of memory, it is helpful to The syntax for offsetting an index register will vary depending on your assembler. Many assemblers will often accept multiple different ways of writing it, and it comes down to personal preference. -mov si, offset MyArray +mov si, offset MyArray mov bx,2 mov al,[bx+si] ;loads decimal 30 into AL MyArray: -byte 10,20,30,40,50 +byte 10,20,30,40,50 ===The Stack=== As with [[Z80 Assembly]], you can't push 8-bit registers onto the stack. For data registers, you have to push/pop both halves. -;This is valid code. +;This is valid code. push ax push bx pop bx pop ax -;This is NOT valid code. +;This is NOT valid code. push ah push al push bh @@ -69,14 +69,14 @@ push bl pop bl pop bh pop al -pop ah +pop ah As with all processors that use a stack, if you push one or more registers and want to restore the backed-up values correctly, you must pop them in the reverse order. You can pop them out of order on purpose to swap registers around. In fact, this is a quick way to move the segment from DS into ES, or vice-versa: -push DS -pop ES ;you can't do "mov es, ds" but you can do this! +push DS +pop ES ;you can't do "mov es, ds" but you can do this! The proper way to use the stack to preserve registers: - + call foo mov ax,4C00h @@ -91,7 +91,7 @@ push cx pop cx pop bx pop ax -ret +ret If one of the push/pop commands in the routine above were missing, the RET instruction would not properly return to where it came from. As long as you pop at the end the same number of registers you pushed at the start, the stack is "balanced" and your return instruction will return correctly. This is because RET is actually POP IP (IP being the instruction pointer, which you can think of as what "line" of code the CPU is on.) The CPU assumes the top of the stack is the correct place to return to, but has no way of actually verifying it. If the function you just wrote causes the CPU to crash or jump to a completely different part of the code, there's a good chance you might have forgotten to balance the stack properly. @@ -107,40 +107,40 @@ One other caveat to mention: On early IBM PCs and compatibles, the 8087 was not ===Looping Constructs=== The 8086 has a lot more of these than most CPUs. The most obvious one is LOOP, which will subtract 1 from CX, then jump back to a specified label if CX is nonzero after the subtraction. If CX becomes zero after subtracting 1, then no jump will occur and the instruction pointer simply moves to the next instruction. -mov cx,0100h ;set the loop counter's starting value. This must be outside the loop, otherwise you'll loop forever! +mov cx,0100h ;set the loop counter's starting value. This must be outside the loop, otherwise you'll loop forever! foo: ;; your code that you want to loop goes here -loop foo +loop foo It's important not to alter CX inside the loop. It's easy to make a mistake like this if you're in a hurry: -foobar: +foobar: mov cx,1000h ;your code goes here -loop foobar +loop foobar It may not be obvious at first but the above loop will never end. CX decrements to 0x0FFF with the LOOP instruction but the mov cx,1000h was mistakenly placed ''inside'' the loop, resetting the loop counter back to 0x1000, which means no progress is really being made. The correct way to do this is to set the starting loop counter '''outside''' the loop, like so: -mov cx,1000h +mov cx,1000h foobar: ;your code goes here -loop foobar +loop foobar Sometimes you'll have to change CX during a loop, like if you want to do bit shifts with a shift amount other than 1, for example. There's a simple fix - use the stack to stash and retrieve the loop counter. -mov cx,0100h +mov cx,0100h foo: push cx mov cl,2 ror ax,cl ;starting with the 80186 you don't need CL for bit shifting. pop cx -loop foo +loop foo By using PUSH CX and POP CX, you can temporarily use CX for something else, as long as you restore it before the LOOP instruction. You can use other registers as loop counters as well, but not with the LOOP instruction - it's hardcoded to only work with CX. But you can do this: -mov dx,0100h +mov dx,0100h baz: ;your code goes here dec dx @@ -148,7 +148,7 @@ jnz baz ; A minor note for advanced programmers: ; If you're expecting the flags to be in a particular state based on the loop body, tough luck! ; They'll only reflect the decrement of DX from 1 to 0 at this point in the code. -; LOOP doesn't change the flags, which makes it more useful for loops meant to compare things. +; LOOP doesn't change the flags, which makes it more useful for loops meant to compare things. Another frequently used looping construct is REP. REP can be combined with certain instructions to repeat that instruction until CX equals zero. However, unlike LOOP, which can be used to repeat a block of instructions, REP can only repeat one. It doesn't work on all instructions, only the "string" instructions which operate on a block of memory. Typically these include MOVSB, LODSB, STOSB, CMPSB, and SCASB (each has a variant that ends in W instead of B, for 16-bit data.) There are also REPZ and REPNZ, which stand for "Repeat if Zero" and "Repeat if Nonzero" respectively. These two only work properly with CMPSB and SCASB, as MOVSB, LODSB, STOSB do not affect the flags. (The CPU doesn't detect whether CX equals zero using the flags, as the flags never reflect this equality to zero like you would expect.) diff --git a/Lang/8th/Angle-difference-between-two-bearings b/Lang/8th/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..9cc882831f --- /dev/null +++ b/Lang/8th/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/8th \ No newline at end of file diff --git a/Lang/8th/Environment-variables b/Lang/8th/Environment-variables new file mode 120000 index 0000000000..f15e7e1793 --- /dev/null +++ b/Lang/8th/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/8th \ No newline at end of file diff --git a/Lang/8th/Factorial b/Lang/8th/Factorial new file mode 120000 index 0000000000..dde7e52e98 --- /dev/null +++ b/Lang/8th/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/8th \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Bifid-cipher b/Lang/AArch64-Assembly/Bifid-cipher new file mode 120000 index 0000000000..57b7c95a81 --- /dev/null +++ b/Lang/AArch64-Assembly/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Binary-strings b/Lang/AArch64-Assembly/Binary-strings new file mode 120000 index 0000000000..09d5581057 --- /dev/null +++ b/Lang/AArch64-Assembly/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Bioinformatics-base-count b/Lang/AArch64-Assembly/Bioinformatics-base-count deleted file mode 120000 index 77532b44f2..0000000000 --- a/Lang/AArch64-Assembly/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Calculating-the-value-of-e b/Lang/AArch64-Assembly/Calculating-the-value-of-e new file mode 120000 index 0000000000..6be0e9e4dd --- /dev/null +++ b/Lang/AArch64-Assembly/Calculating-the-value-of-e @@ -0,0 +1 @@ +../../Task/Calculating-the-value-of-e/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Comma-quibbling b/Lang/AArch64-Assembly/Comma-quibbling new file mode 120000 index 0000000000..09eae1e29d --- /dev/null +++ b/Lang/AArch64-Assembly/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Compound-data-type b/Lang/AArch64-Assembly/Compound-data-type new file mode 120000 index 0000000000..5e69c433e8 --- /dev/null +++ b/Lang/AArch64-Assembly/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Conways-Game-of-Life b/Lang/AArch64-Assembly/Conways-Game-of-Life new file mode 120000 index 0000000000..048d5e56cd --- /dev/null +++ b/Lang/AArch64-Assembly/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Create-an-HTML-table b/Lang/AArch64-Assembly/Create-an-HTML-table new file mode 120000 index 0000000000..53d9451773 --- /dev/null +++ b/Lang/AArch64-Assembly/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Determine-sentence-type b/Lang/AArch64-Assembly/Determine-sentence-type new file mode 120000 index 0000000000..9e5de0c792 --- /dev/null +++ b/Lang/AArch64-Assembly/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Environment-variables b/Lang/AArch64-Assembly/Environment-variables new file mode 120000 index 0000000000..bf37f1b011 --- /dev/null +++ b/Lang/AArch64-Assembly/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Fibonacci-n-step-number-sequences b/Lang/AArch64-Assembly/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..27c6d5155d --- /dev/null +++ b/Lang/AArch64-Assembly/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Fibonacci-sequence b/Lang/AArch64-Assembly/Fibonacci-sequence new file mode 120000 index 0000000000..1b2a811917 --- /dev/null +++ b/Lang/AArch64-Assembly/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Halt-and-catch-fire b/Lang/AArch64-Assembly/Halt-and-catch-fire new file mode 120000 index 0000000000..fcd91d9797 --- /dev/null +++ b/Lang/AArch64-Assembly/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Hash-from-two-arrays b/Lang/AArch64-Assembly/Hash-from-two-arrays new file mode 120000 index 0000000000..8f4af92c06 --- /dev/null +++ b/Lang/AArch64-Assembly/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Hofstadter-Q-sequence b/Lang/AArch64-Assembly/Hofstadter-Q-sequence new file mode 120000 index 0000000000..249eb0836e --- /dev/null +++ b/Lang/AArch64-Assembly/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/AArch64-Assembly/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..ea8bafc85e --- /dev/null +++ b/Lang/AArch64-Assembly/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Leonardo-numbers b/Lang/AArch64-Assembly/Leonardo-numbers new file mode 120000 index 0000000000..c954cc6b34 --- /dev/null +++ b/Lang/AArch64-Assembly/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Logical-operations b/Lang/AArch64-Assembly/Logical-operations new file mode 120000 index 0000000000..c765c862aa --- /dev/null +++ b/Lang/AArch64-Assembly/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Machine-code b/Lang/AArch64-Assembly/Machine-code new file mode 120000 index 0000000000..0510df24d2 --- /dev/null +++ b/Lang/AArch64-Assembly/Machine-code @@ -0,0 +1 @@ +../../Task/Machine-code/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Magic-8-ball b/Lang/AArch64-Assembly/Magic-8-ball new file mode 120000 index 0000000000..1c232e0832 --- /dev/null +++ b/Lang/AArch64-Assembly/Magic-8-ball @@ -0,0 +1 @@ +../../Task/Magic-8-ball/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Mandelbrot-set b/Lang/AArch64-Assembly/Mandelbrot-set new file mode 120000 index 0000000000..8e4411d4d0 --- /dev/null +++ b/Lang/AArch64-Assembly/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Menu b/Lang/AArch64-Assembly/Menu new file mode 120000 index 0000000000..5b0688a2c5 --- /dev/null +++ b/Lang/AArch64-Assembly/Menu @@ -0,0 +1 @@ +../../Task/Menu/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Miller-Rabin-primality-test b/Lang/AArch64-Assembly/Miller-Rabin-primality-test deleted file mode 120000 index f452839a71..0000000000 --- a/Lang/AArch64-Assembly/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Phrase-reversals b/Lang/AArch64-Assembly/Phrase-reversals new file mode 120000 index 0000000000..65751e913c --- /dev/null +++ b/Lang/AArch64-Assembly/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Pi b/Lang/AArch64-Assembly/Pi new file mode 120000 index 0000000000..34be149f2d --- /dev/null +++ b/Lang/AArch64-Assembly/Pi @@ -0,0 +1 @@ +../../Task/Pi/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Read-a-configuration-file b/Lang/AArch64-Assembly/Read-a-configuration-file new file mode 120000 index 0000000000..869fc1989f --- /dev/null +++ b/Lang/AArch64-Assembly/Read-a-configuration-file @@ -0,0 +1 @@ +../../Task/Read-a-configuration-file/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Repeat-a-string b/Lang/AArch64-Assembly/Repeat-a-string new file mode 120000 index 0000000000..c83eefd8df --- /dev/null +++ b/Lang/AArch64-Assembly/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Reverse-words-in-a-string b/Lang/AArch64-Assembly/Reverse-words-in-a-string new file mode 120000 index 0000000000..2f40f86595 --- /dev/null +++ b/Lang/AArch64-Assembly/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Sorting-Algorithms-Circle-Sort b/Lang/AArch64-Assembly/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 6922a69550..0000000000 --- a/Lang/AArch64-Assembly/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Strip-block-comments b/Lang/AArch64-Assembly/Strip-block-comments new file mode 120000 index 0000000000..4a2741cf35 --- /dev/null +++ b/Lang/AArch64-Assembly/Strip-block-comments @@ -0,0 +1 @@ +../../Task/Strip-block-comments/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Strip-comments-from-a-string b/Lang/AArch64-Assembly/Strip-comments-from-a-string new file mode 120000 index 0000000000..1e7fb59c48 --- /dev/null +++ b/Lang/AArch64-Assembly/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Strip-whitespace-from-a-string-Top-and-tail b/Lang/AArch64-Assembly/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..115198d3ea --- /dev/null +++ b/Lang/AArch64-Assembly/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Twos-complement b/Lang/AArch64-Assembly/Twos-complement new file mode 120000 index 0000000000..92454eff57 --- /dev/null +++ b/Lang/AArch64-Assembly/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Update-a-configuration-file b/Lang/AArch64-Assembly/Update-a-configuration-file new file mode 120000 index 0000000000..c28afd01b6 --- /dev/null +++ b/Lang/AArch64-Assembly/Update-a-configuration-file @@ -0,0 +1 @@ +../../Task/Update-a-configuration-file/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Vigen-re-cipher b/Lang/AArch64-Assembly/Vigen-re-cipher new file mode 120000 index 0000000000..02254d1d9a --- /dev/null +++ b/Lang/AArch64-Assembly/Vigen-re-cipher @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Vigen-re-cipher-Cryptanalysis b/Lang/AArch64-Assembly/Vigen-re-cipher-Cryptanalysis new file mode 120000 index 0000000000..cc7f7e2227 --- /dev/null +++ b/Lang/AArch64-Assembly/Vigen-re-cipher-Cryptanalysis @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher-Cryptanalysis/AArch64-Assembly \ No newline at end of file diff --git a/Lang/AArch64-Assembly/Visualize-a-tree b/Lang/AArch64-Assembly/Visualize-a-tree new file mode 120000 index 0000000000..a3e4c5223f --- /dev/null +++ b/Lang/AArch64-Assembly/Visualize-a-tree @@ -0,0 +1 @@ +../../Task/Visualize-a-tree/AArch64-Assembly \ No newline at end of file diff --git a/Lang/ABAP/00-LANG.txt b/Lang/ABAP/00-LANG.txt index 446b44c265..819bd4cbc5 100644 --- a/Lang/ABAP/00-LANG.txt +++ b/Lang/ABAP/00-LANG.txt @@ -1,2 +1,14 @@ -{{stub}}{{language|site=http://www.sdn.sap.com/irj/sdn/abap}} -ABAP (Advanced Business Application Programming) is a programming language developed by the german software vendor SAP. It is mainly used to build high performance business applications. \ No newline at end of file +{{stub}}{{language +|site=http://www.sdn.sap.com/irj/sdn/abap +|safety=safe +|strength=strong +|compat=nominative +|checking=static +|tags=abap}} +ABAP (Advanced Business Application Programming) is a programming language developed by the german software vendor SAP. It is mainly used to build high performance business applications. + +==Citation== +*[https://en.wikipedia.org/wiki/ABAP] + +[[Category:Programming paradigm/Object-oriented]] +[[Category:Programming paradigm/Imperative]] \ No newline at end of file diff --git a/Lang/ABC/00-LANG.txt b/Lang/ABC/00-LANG.txt new file mode 100644 index 0000000000..115426b099 --- /dev/null +++ b/Lang/ABC/00-LANG.txt @@ -0,0 +1,18 @@ +{{language +|exec=interpreted +|site=https://homepages.cwi.nl/~steven/abc/ +|strength=strong +|safety=safe +|express=implicit +|checking=dynamic +|parampass=value, reference +|gc=yes}}{{language programming paradigm|Dynamic}}{{language programming paradigm|Imperative}} + +'''ABC''' is a programming language and development environment developed for teaching purposes at the National Research Institute for Mathematics and Computer Science in the Netherlands in the late 80s. It was meant to be a replacement for BASIC in teaching programming to students. The language was meant to be used interactively. Instead of traditional source files, the environment uses workspaces, though the UNIX version does have (rather minimal) script support. Function definitions and global variables persist from session to session without the user having to explicitly save or load them. The environment furthermore includes autocompletion and a syntax-aware editor. There is no supported way to access the underlying OS or file system directly. The tight integration between the language implementation and the IDE turned out to be a barrier to expansion, and the language was largely abandoned in the early 90s. + +There is an unfortunate bug in the official interpreter: it switches to the alternate terminal screen even when running a non-interactive script, resulting in the output being invisible. A workaround is to specify a terminal type that does not support it, e.g. TERM=vt100 abc script.abc. + +==References== + +* [https://homepages.cwi.nl/~steven/abc/ Official homepage] +* [[wp:ABC_(programming_language)|ABC on Wikipedia]] \ No newline at end of file diff --git a/Lang/ABC/00-META.yaml b/Lang/ABC/00-META.yaml new file mode 100644 index 0000000000..967764ae5a --- /dev/null +++ b/Lang/ABC/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:ABC diff --git a/Lang/ABC/100-doors b/Lang/ABC/100-doors new file mode 120000 index 0000000000..aa28ef076f --- /dev/null +++ b/Lang/ABC/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/ABC \ No newline at end of file diff --git a/Lang/ABC/100-prisoners b/Lang/ABC/100-prisoners new file mode 120000 index 0000000000..8788c6225a --- /dev/null +++ b/Lang/ABC/100-prisoners @@ -0,0 +1 @@ +../../Task/100-prisoners/ABC \ No newline at end of file diff --git a/Lang/ABC/99-bottles-of-beer b/Lang/ABC/99-bottles-of-beer new file mode 120000 index 0000000000..a68c0a17d5 --- /dev/null +++ b/Lang/ABC/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/ABC \ No newline at end of file diff --git a/Lang/ABC/ABC-problem b/Lang/ABC/ABC-problem new file mode 120000 index 0000000000..925929a8aa --- /dev/null +++ b/Lang/ABC/ABC-problem @@ -0,0 +1 @@ +../../Task/ABC-problem/ABC \ No newline at end of file diff --git a/Lang/ABC/Abundant-deficient-and-perfect-number-classifications b/Lang/ABC/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..7990ee28e5 --- /dev/null +++ b/Lang/ABC/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/ABC \ No newline at end of file diff --git a/Lang/ABC/Ackermann-function b/Lang/ABC/Ackermann-function new file mode 120000 index 0000000000..6fc443bd8e --- /dev/null +++ b/Lang/ABC/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/ABC \ No newline at end of file diff --git a/Lang/ABC/Additive-primes b/Lang/ABC/Additive-primes new file mode 120000 index 0000000000..d085a6bcbd --- /dev/null +++ b/Lang/ABC/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/ABC \ No newline at end of file diff --git a/Lang/ABC/Amicable-pairs b/Lang/ABC/Amicable-pairs new file mode 120000 index 0000000000..144f4590ee --- /dev/null +++ b/Lang/ABC/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/ABC \ No newline at end of file diff --git a/Lang/ABC/Arithmetic-derivative b/Lang/ABC/Arithmetic-derivative new file mode 120000 index 0000000000..4225078056 --- /dev/null +++ b/Lang/ABC/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/ABC \ No newline at end of file diff --git a/Lang/ABC/Attractive-numbers b/Lang/ABC/Attractive-numbers new file mode 120000 index 0000000000..c59a0c88ac --- /dev/null +++ b/Lang/ABC/Attractive-numbers @@ -0,0 +1 @@ +../../Task/Attractive-numbers/ABC \ No newline at end of file diff --git a/Lang/ABC/Benfords-law b/Lang/ABC/Benfords-law new file mode 120000 index 0000000000..f24a94d25a --- /dev/null +++ b/Lang/ABC/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/ABC \ No newline at end of file diff --git a/Lang/ABC/Bulls-and-cows b/Lang/ABC/Bulls-and-cows new file mode 120000 index 0000000000..fdc423bf64 --- /dev/null +++ b/Lang/ABC/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/ABC \ No newline at end of file diff --git a/Lang/ABC/Casting-out-nines b/Lang/ABC/Casting-out-nines new file mode 120000 index 0000000000..9c27786e27 --- /dev/null +++ b/Lang/ABC/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/ABC \ No newline at end of file diff --git a/Lang/ABC/Comma-quibbling b/Lang/ABC/Comma-quibbling new file mode 120000 index 0000000000..f67b3a793a --- /dev/null +++ b/Lang/ABC/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/ABC \ No newline at end of file diff --git a/Lang/ABC/Department-numbers b/Lang/ABC/Department-numbers new file mode 120000 index 0000000000..e903532bc7 --- /dev/null +++ b/Lang/ABC/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/ABC \ No newline at end of file diff --git a/Lang/ABC/Evolutionary-algorithm b/Lang/ABC/Evolutionary-algorithm new file mode 120000 index 0000000000..d5319b5c74 --- /dev/null +++ b/Lang/ABC/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/ABC \ No newline at end of file diff --git a/Lang/ABC/FizzBuzz b/Lang/ABC/FizzBuzz new file mode 120000 index 0000000000..e507dc5bb8 --- /dev/null +++ b/Lang/ABC/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/ABC \ No newline at end of file diff --git a/Lang/ABC/Floyds-triangle b/Lang/ABC/Floyds-triangle new file mode 120000 index 0000000000..b0745131ab --- /dev/null +++ b/Lang/ABC/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/ABC \ No newline at end of file diff --git a/Lang/ABC/Giuga-numbers b/Lang/ABC/Giuga-numbers new file mode 120000 index 0000000000..4e8c5ed3a1 --- /dev/null +++ b/Lang/ABC/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/ABC \ No newline at end of file diff --git a/Lang/ABC/Hailstone-sequence b/Lang/ABC/Hailstone-sequence new file mode 120000 index 0000000000..22e4b3a8d2 --- /dev/null +++ b/Lang/ABC/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/ABC \ No newline at end of file diff --git a/Lang/ABC/Happy-numbers b/Lang/ABC/Happy-numbers new file mode 120000 index 0000000000..ffdb78b473 --- /dev/null +++ b/Lang/ABC/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/ABC \ No newline at end of file diff --git a/Lang/ABC/Harshad-or-Niven-series b/Lang/ABC/Harshad-or-Niven-series new file mode 120000 index 0000000000..c460a71d92 --- /dev/null +++ b/Lang/ABC/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/ABC \ No newline at end of file diff --git a/Lang/ABC/Hofstadter-Figure-Figure-sequences b/Lang/ABC/Hofstadter-Figure-Figure-sequences new file mode 120000 index 0000000000..e400cd4b2d --- /dev/null +++ b/Lang/ABC/Hofstadter-Figure-Figure-sequences @@ -0,0 +1 @@ +../../Task/Hofstadter-Figure-Figure-sequences/ABC \ No newline at end of file diff --git a/Lang/ABC/ISBN13-check-digit b/Lang/ABC/ISBN13-check-digit new file mode 120000 index 0000000000..466684d948 --- /dev/null +++ b/Lang/ABC/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/ABC \ No newline at end of file diff --git a/Lang/ABC/Jewels-and-stones b/Lang/ABC/Jewels-and-stones new file mode 120000 index 0000000000..2a5e2026f3 --- /dev/null +++ b/Lang/ABC/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/ABC \ No newline at end of file diff --git a/Lang/ABC/Lah-numbers b/Lang/ABC/Lah-numbers new file mode 120000 index 0000000000..264201bfe1 --- /dev/null +++ b/Lang/ABC/Lah-numbers @@ -0,0 +1 @@ +../../Task/Lah-numbers/ABC \ No newline at end of file diff --git a/Lang/ABC/Look-and-say-sequence b/Lang/ABC/Look-and-say-sequence new file mode 120000 index 0000000000..68b9661932 --- /dev/null +++ b/Lang/ABC/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/ABC \ No newline at end of file diff --git a/Lang/ABC/McNuggets-problem b/Lang/ABC/McNuggets-problem new file mode 120000 index 0000000000..95e79a5323 --- /dev/null +++ b/Lang/ABC/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/ABC \ No newline at end of file diff --git a/Lang/ABC/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/ABC/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..6ff647f8c0 --- /dev/null +++ b/Lang/ABC/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/ABC \ No newline at end of file diff --git a/Lang/ABC/Munchausen-numbers b/Lang/ABC/Munchausen-numbers new file mode 120000 index 0000000000..e52466affe --- /dev/null +++ b/Lang/ABC/Munchausen-numbers @@ -0,0 +1 @@ +../../Task/Munchausen-numbers/ABC \ No newline at end of file diff --git a/Lang/ABC/Mutual-recursion b/Lang/ABC/Mutual-recursion new file mode 120000 index 0000000000..7c52c1cb81 --- /dev/null +++ b/Lang/ABC/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/ABC \ No newline at end of file diff --git a/Lang/ABC/Population-count b/Lang/ABC/Population-count new file mode 120000 index 0000000000..6bd44c7e1e --- /dev/null +++ b/Lang/ABC/Population-count @@ -0,0 +1 @@ +../../Task/Population-count/ABC \ No newline at end of file diff --git a/Lang/ABC/Primality-by-trial-division b/Lang/ABC/Primality-by-trial-division new file mode 120000 index 0000000000..811bc718a5 --- /dev/null +++ b/Lang/ABC/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/ABC \ No newline at end of file diff --git a/Lang/ABC/Rep-string b/Lang/ABC/Rep-string new file mode 120000 index 0000000000..23f495d764 --- /dev/null +++ b/Lang/ABC/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/ABC \ No newline at end of file diff --git a/Lang/ABC/Sequence-of-non-squares b/Lang/ABC/Sequence-of-non-squares new file mode 120000 index 0000000000..0a7560127a --- /dev/null +++ b/Lang/ABC/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/ABC \ No newline at end of file diff --git a/Lang/ABC/Sieve-of-Eratosthenes b/Lang/ABC/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..83a8ebdf80 --- /dev/null +++ b/Lang/ABC/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/ABC \ No newline at end of file diff --git a/Lang/ABC/Smith-numbers b/Lang/ABC/Smith-numbers new file mode 120000 index 0000000000..ce68a2f99a --- /dev/null +++ b/Lang/ABC/Smith-numbers @@ -0,0 +1 @@ +../../Task/Smith-numbers/ABC \ No newline at end of file diff --git a/Lang/ABC/Square-but-not-cube b/Lang/ABC/Square-but-not-cube new file mode 120000 index 0000000000..23a046e711 --- /dev/null +++ b/Lang/ABC/Square-but-not-cube @@ -0,0 +1 @@ +../../Task/Square-but-not-cube/ABC \ No newline at end of file diff --git a/Lang/ABC/Strip-a-set-of-characters-from-a-string b/Lang/ABC/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..c29767f86b --- /dev/null +++ b/Lang/ABC/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/ABC \ No newline at end of file diff --git a/Lang/ABC/Towers-of-Hanoi b/Lang/ABC/Towers-of-Hanoi new file mode 120000 index 0000000000..37fe93f842 --- /dev/null +++ b/Lang/ABC/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/ABC \ No newline at end of file diff --git a/Lang/ABC/Van-Eck-sequence b/Lang/ABC/Van-Eck-sequence new file mode 120000 index 0000000000..6661779e7c --- /dev/null +++ b/Lang/ABC/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/ABC \ No newline at end of file diff --git a/Lang/ABC/Zeckendorf-number-representation b/Lang/ABC/Zeckendorf-number-representation new file mode 120000 index 0000000000..8384d29a12 --- /dev/null +++ b/Lang/ABC/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/ABC \ No newline at end of file diff --git a/Lang/AIDED-NATURAL-LANGUAGE/00-LANG.txt b/Lang/AIDED-NATURAL-LANGUAGE/00-LANG.txt new file mode 100644 index 0000000000..c25a056976 --- /dev/null +++ b/Lang/AIDED-NATURAL-LANGUAGE/00-LANG.txt @@ -0,0 +1 @@ +{{stub}}{{language|Ayrch}} \ No newline at end of file diff --git a/Lang/AIDED-NATURAL-LANGUAGE/00-META.yaml b/Lang/AIDED-NATURAL-LANGUAGE/00-META.yaml new file mode 100644 index 0000000000..8395003e03 --- /dev/null +++ b/Lang/AIDED-NATURAL-LANGUAGE/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:AIDED_NATURAL_LANGUAGE diff --git a/Lang/ALGOL-60/00-LANG.txt b/Lang/ALGOL-60/00-LANG.txt index 725689b57a..2f04de0a7d 100644 --- a/Lang/ALGOL-60/00-LANG.txt +++ b/Lang/ALGOL-60/00-LANG.txt @@ -16,4 +16,9 @@ gcc hello.c -lalgol -lm -o hello *[[wp:ALGOL 60|ALGOL 60 on Wikipedia]] *[[ALGOL 68]] *[[ALGOL W]] -*[[Simula]] \ No newline at end of file +*[[Simula]] + +==External links== +* [http://algol60.org algol60.org] +* [https://softwarepreservation.computerhistory.org/ALGOL/ History of ALGOL] Includes links to documentation (e.g. reports) +* [https://www.masswerk.at/algol60/report.htm Revised Report on the Algorithmic Language Algol 60] (HTML) \ No newline at end of file diff --git a/Lang/ALGOL-60/100-doors b/Lang/ALGOL-60/100-doors deleted file mode 120000 index 9bbf6f9b11..0000000000 --- a/Lang/ALGOL-60/100-doors +++ /dev/null @@ -1 +0,0 @@ -../../Task/100-doors/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Additive-primes b/Lang/ALGOL-60/Additive-primes new file mode 120000 index 0000000000..360a570784 --- /dev/null +++ b/Lang/ALGOL-60/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Anti-primes b/Lang/ALGOL-60/Anti-primes new file mode 120000 index 0000000000..6d19745d0e --- /dev/null +++ b/Lang/ALGOL-60/Anti-primes @@ -0,0 +1 @@ +../../Task/Anti-primes/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Even-or-odd b/Lang/ALGOL-60/Even-or-odd new file mode 120000 index 0000000000..13baeccf6c --- /dev/null +++ b/Lang/ALGOL-60/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Factorial b/Lang/ALGOL-60/Factorial deleted file mode 120000 index 67b243e1d0..0000000000 --- a/Lang/ALGOL-60/Factorial +++ /dev/null @@ -1 +0,0 @@ -../../Task/Factorial/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Harmonic-series b/Lang/ALGOL-60/Harmonic-series new file mode 120000 index 0000000000..a1eefb4086 --- /dev/null +++ b/Lang/ALGOL-60/Harmonic-series @@ -0,0 +1 @@ +../../Task/Harmonic-series/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Horners-rule-for-polynomial-evaluation b/Lang/ALGOL-60/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..2a520e0e7c --- /dev/null +++ b/Lang/ALGOL-60/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Integer-comparison b/Lang/ALGOL-60/Integer-comparison new file mode 120000 index 0000000000..54a6736fa3 --- /dev/null +++ b/Lang/ALGOL-60/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Largest-proper-divisor-of-n b/Lang/ALGOL-60/Largest-proper-divisor-of-n new file mode 120000 index 0000000000..bd5f1adbca --- /dev/null +++ b/Lang/ALGOL-60/Largest-proper-divisor-of-n @@ -0,0 +1 @@ +../../Task/Largest-proper-divisor-of-n/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Loops-Increment-loop-index-within-loop-body b/Lang/ALGOL-60/Loops-Increment-loop-index-within-loop-body new file mode 120000 index 0000000000..b6ef8c8c0c --- /dev/null +++ b/Lang/ALGOL-60/Loops-Increment-loop-index-within-loop-body @@ -0,0 +1 @@ +../../Task/Loops-Increment-loop-index-within-loop-body/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Nth-root b/Lang/ALGOL-60/Nth-root new file mode 120000 index 0000000000..3032f52453 --- /dev/null +++ b/Lang/ALGOL-60/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Prime-decomposition b/Lang/ALGOL-60/Prime-decomposition new file mode 120000 index 0000000000..cd5f625ac0 --- /dev/null +++ b/Lang/ALGOL-60/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Proper-divisors b/Lang/ALGOL-60/Proper-divisors new file mode 120000 index 0000000000..7bb12e66dd --- /dev/null +++ b/Lang/ALGOL-60/Proper-divisors @@ -0,0 +1 @@ +../../Task/Proper-divisors/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Semiprime b/Lang/ALGOL-60/Semiprime new file mode 120000 index 0000000000..0981557b93 --- /dev/null +++ b/Lang/ALGOL-60/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Sequence-of-primes-by-trial-division b/Lang/ALGOL-60/Sequence-of-primes-by-trial-division new file mode 120000 index 0000000000..b95a2ebdcc --- /dev/null +++ b/Lang/ALGOL-60/Sequence-of-primes-by-trial-division @@ -0,0 +1 @@ +../../Task/Sequence-of-primes-by-trial-division/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Square-free-integers b/Lang/ALGOL-60/Square-free-integers new file mode 120000 index 0000000000..caff91a536 --- /dev/null +++ b/Lang/ALGOL-60/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Sum-multiples-of-3-and-5 b/Lang/ALGOL-60/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..f733e89a1f --- /dev/null +++ b/Lang/ALGOL-60/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Sum-of-a-series b/Lang/ALGOL-60/Sum-of-a-series new file mode 120000 index 0000000000..48b6d3380c --- /dev/null +++ b/Lang/ALGOL-60/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Tau-function b/Lang/ALGOL-60/Tau-function new file mode 120000 index 0000000000..5e48edf00f --- /dev/null +++ b/Lang/ALGOL-60/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-60/Tau-number b/Lang/ALGOL-60/Tau-number new file mode 120000 index 0000000000..a054d3d6bb --- /dev/null +++ b/Lang/ALGOL-60/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/ALGOL-60 \ No newline at end of file diff --git a/Lang/ALGOL-68/00-LANG.txt b/Lang/ALGOL-68/00-LANG.txt index f23a20030d..0415892136 100644 --- a/Lang/ALGOL-68/00-LANG.txt +++ b/Lang/ALGOL-68/00-LANG.txt @@ -41,7 +41,7 @@ A syntax chart is available [http://www.softwarepreservation.org/projects/ALGOL/ * [http://www.linkedin.com/groups/Algol68-2333923 Algol68 group at linkedin] - includes various famous compiler composers.
'''Books available online''': -* [http://jmvdveer.home.xs4all.nl/en.algol-68-genie.html Algol 68G Manual - By Marcel van der Veer] Includes the Revised Report +* [https://algol68genie.nl/ Algol 68G Manual - By Marcel van der Veer] Includes the Revised Report * [http://www.softwarepreservation.org/projects/ALGOL/book/pame.2008.a4.pdf/view Programming Algol 68 Made Easy - by Sian Mountbatten (on softwarepreservation.org)] * [http://www.softwarepreservation.org/projects/ALGOL/book/Lindsey_van_der_Meulen-IItA68-Revised.pdf/view Informal Introduction to Algol 68 - by C. H. Lindsey & S. V. Van der Meulen (on softwarepreservation.org)] - if you prefer (and find) a hardcopy, be sure to get the 1977 edition. Highly recomended! @@ -59,7 +59,7 @@ A syntax chart is available [http://www.softwarepreservation.org/projects/ALGOL/ ** AND 50th Birthday '''ALGOL 58'''. * 23rd August 2009 - [http://sourceforge.net/projects/algol68/files/ algol68g-1.18.0-9h] released * 20th December 2009 - Happy 51st/41st Birthdays with [[Hamming_numbers#ALGOL_68|Hamming numbers]] - the 200th '''ALGOL 68''' code contribution on rosettacode.org! -** This time code was by [[User:Algol68g|Marcel van der Veer]], author of [http://www.xs4all.nl/~jmvdveer/algol.html Algol 68 Genie] +** This time code was by [[User:Algol68g|Marcel van der Veer]], author of [https://algol68genie.nl Algol 68 Genie] * 25th October 2011 - [[User:Jejones3141|Jejones3141]] added [[Soundex#ALGOL_68|Soundex]] - the 300th '''ALGOL 68''' code specimen. == Revisions == @@ -67,203 +67,12 @@ A syntax chart is available [http://www.softwarepreservation.org/projects/ALGOL/ *Oct. 1968: Penultimate Draft Report on the Algorithmic Language ALGOL 68 - Chapters 1-9 - Edited by: A. van Wijngaarden, B.J. Mailloux, J.E.L. Peck and C.H.A. Koster. *Dec. 1968: Report on the Algorithmic Language ALGOL 68 - Offprint from Numerische Mathematik, 14, 79-218 (1969); Springer-Verlag. - Edited by: A. van Wijngaarden, B.J. Mailloux, J.E.L. Peck and C.H.A. Koster. *Sep 1973: Revised Report on the Algorithmic Language Algol 68 - Springer-Verlag 1976 - Edited by: A. van Wijngaarden, B.J. Mailloux, J.E.L. Peck, C.H.A. Koster, M. Sintzoff, C.H. Lindsey, L.G.L.T. Meertens and R.G. Fisker. -==Coding style of samples== -Click "Expand" for more details. -
-
- -Many of the code samples provided here have a leading main:( and a matching ) at the end. These are not actually required in the language, but are included so as to highlight the main routine. - -On some compilers, it may be necessary to include appropriate "job cards" -or preludes in order for the programs to compile successfully. Hopefully -not too much else is required. Examples: -{|border="1" style="border-collapse: collapse; border: 5px double grey;" align="center" -|| Brief Algol68 -|| Algol68 as in rosettacode -|| Actual ELLA Algol 68RS code -|- -|| - print(("Hello, world!",new line)) -|| - main:( - print(("Hello, world!",new line)) - ) -|| - PROGRAM helloworld CONTEXT VOID - USE standard - BEGIN - print(("Hello, world!", new line)) - END - FINISH -|} -

'''Examples of different program representations''' -

-At the time when ALGOL 68 was defined some predominant computers had -24 or 36 bit words, with 6 bit character sets. Hence it was desirable that -ALGOL 68 should be able to run on machines with only uppercase. -The official spec provided for different representations of the same -program. Quote stropping (enclosing the bold words in single quotes) -and Point stropping (preceeding the bold words with a dot) -were used. A variant of Point stropping called RES stropping was also defined. -In RES stropping some language-defined bold words are not preceded by a dot. -A pragmatic comment may have been required to indicate which -stropping convention was to be used, as in some of the examples below. -Upper stropping (representing the bold words by upper case and -non-bold words in lower case) was introduced by Algol 68R. Upper stropping -is used by Algol 68RS and is one of the options for Algol 68G. -Rutgers ALGOL 68 uses quote stropping. Most of the samples -on Rosetta Code use Upper stropping. -Examples (pragmatic comments to set the stropping regime not shown): -{|border="1" style="border-collapse: collapse; border: 2px double grey;" align="left" -|| Algol68 as typically published - '''mode''' '''xint''' = '''int'''; - '''xint''' sum sq:=0; - '''for''' i '''while''' - sum sq≠70×70 - '''do''' - sum sq+:=i↑2 - '''od''' -|| QUOTE stropping (similar to wiki) - 'mode' 'xint' = 'int'; - 'xint' sum sq:=0; - 'for' i 'while' - sum sq≠70×70 - 'do' - sum sq+:=i↑2 - 'od' -|| POINT stropping - .MODE .XINT = .INT; - .XINT SUM SQ:=0; - .FOR I .WHILE - SUM SQ .NE 70*70 - .DO - SUM SQ .PLUSAB I .UP 2 - .OD -|| RES stropping - mode .xint = int; - .xint sum sq:=0; - for i while - sum sq≠70×70 - do - sum sq+:=i↑2 - od -|| Upper stropping - MODE XINT = INT; - XINT sum sq:=0; - FOR i WHILE - sum sq /= 70*70 - DO - sum sq PLUSAB i UP 2 - OD -|} - -
+==Coding style of samples, alphabets and stropping== +See [[ALGOL 68 Representation]]. == Coercion (casting) == -ALGOL 68 has a hierarchy of contexts which determine which kind of coercions are available at a particular point in the program. -
-Click "Expand" for more details. -
-
- -These contexts are: -{|class="wikitable" -!rowspan=2| N
-a
-m
-e -!rowspan=2| Context location -!colspan=5| Coercions available in this context -!rowspan=2| Coercion examples -|- -|bgcolor=aaaaff|Soft -|bgcolor=aaeeaa|Weak -|bgcolor=ffee99|Meek -|bgcolor=ffcc99|Firm -|bgcolor=ffcccc|Strong -|- -!S
-t
-r
-o
-n
-g -||Right hand side of: -* Identity-declarations, as "~" in: REAL x = ~ -* Initialisations, as "~" in: REAL x := ~ -Also: -* Actual-parameters of calls, as "~" in:PROC: sin(~) -* Enclosed clauses of casts, as "~" in: REAL(~) -* Units of routine-texts -* Statements yielding VOID -* All parts (but one) of a balanced clause -* One side of an identity relation, as "~" in: ~ IS ~ -|bgcolor=aaaaff rowspan=4 width="50px"| deproc- eduring -|bgcolor=aaeeaa rowspan=3 width="50px"| all '''soft''' then weak deref- erencing -|bgcolor=ffee99 rowspan=2 width="50px"| all '''weak''' then deref- erencing -|bgcolor=ffcc99 rowspan=1 width="50px"| all '''meek''' then uniting -|bgcolor=ffcccc width="50px"| all '''firm''' then widening, rowing and voiding -|colspan=1 bgcolor=ffcccc| -Widening occurs if there is no loss of precision. For example: An INT will be coerced to a REAL, and a REAL will be coerced to a LONG REAL. But not vice-versa. Examples: -INT to LONG INT -INT to REAL -REAL to COMPL -BITS to []BOOL -BYTES to STRING -A variable can also be coerced (rowed) to an array of length 1. - -For example: -INT to [1]INT -REAL to [1]REAL etc -|- -!F
-i
-r
-m -|| -*Operands of formulas as "~" in:OP: ~ * ~ -*Parameters of transput calls -|colspan=3 bgcolor=ffcc99| Example: -UNION(INT,REAL) var := 1 -|- -!M
-e
-e
-k -|| -* Trimscripts (yielding INT) -* Enquiries: e.g. as "~" in the following -IF ~ THEN ... FI and -FROM ~ BY ~ TO ~ WHILE ~ DO ... OD etc -* Primaries of calls (e.g. sin in sin(x)) -|colspan=4 bgcolor=ffee99|Examples: -REF REF BOOL to BOOL -REF REF REF INT to INT -|- -!W
-e
-a
-k -|| -* Primaries of slices, as in "~" in: ~[1:99] -* Secondaries of selections, as "~" in: value OF ~ -|colspan=5 bgcolor=aaeeaa|Examples: -REF BOOL to REF BOOL -REF REF INT to REF INT -REF REF REF REAL to REF REAL -REF REF REF REF STRUCT to REF STRUCT -|- -!S
-o
-f
-t -|| The LHS of assignments, as "~" in: ~ := ... -|colspan=6 bgcolor=aaaaff| Example: -* deproceduring of: PROC REAL random: e.g. random -|} -For more details about Primaries and Secondaries refer to [[Operator_precedence#ALGOL_68|Operator precedence]]. - -
+ALGOL 68 has a hierarchy of contexts which determine which kind of coercions are available at a particular point in the program.
+See [[:Category:ALGOL_68_Coercions|ALGOL 68 Coercions]] for more details. ==See also== *[[Web 68]] @@ -273,12 +82,22 @@ For more details about Primaries and Secondaries refer to [[Operator_precedence# * [[Action!]] * [[Agena]] * [[Draco]] +* [[RTL/2]] * [https://en.wikipedia.org/wiki/S3_(programming_language) S3 for ICL 2900] == Library code used in Rosetta Code samples == -[https://rosettacode.org/wiki/Category:ALGOL_68-primes Prime related] -
-[https://rosettacode.org/wiki/Category:ALGOL_68-rows Row (array) related] +* [[ALGOL_68/prelude|Various (including the standard prelude)]] +* +* [[:Category:ALGOL_68-bits|bit-manipulation related]] +* [[:Category:ALGOL_68-files|File related]] +* [[:Category:ALGOL_68-l-system|L-System related]] +* [[:Category:ALGOL_68-primes|Prime related]] +* [[:Category:ALGOL_68-rows|Row (array) related]] +* [[:Category:ALGOL_68-sort|Sorting related]] + +== Tools == +[[Syntax_highlighting_using_Mediawiki_formatting#ALGOL 68|Format an upper-stropped Algol 68 source with Mediawiki markup]]
+[[Compiler/Simple_file_inclusion_pre_processor#ALGOL 68|Implement ''read'' and ''include'' pragmatic-comments for compilers that don't support file inclusion]] {{language programming paradigm|Concurrent}} {{language programming paradigm|Imperative}} \ No newline at end of file diff --git a/Lang/ALGOL-68/100-doors b/Lang/ALGOL-68/100-doors deleted file mode 120000 index a57790f750..0000000000 --- a/Lang/ALGOL-68/100-doors +++ /dev/null @@ -1 +0,0 @@ -../../Task/100-doors/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/100-prisoners b/Lang/ALGOL-68/100-prisoners new file mode 120000 index 0000000000..f6c4da597a --- /dev/null +++ b/Lang/ALGOL-68/100-prisoners @@ -0,0 +1 @@ +../../Task/100-prisoners/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/21-game b/Lang/ALGOL-68/21-game new file mode 120000 index 0000000000..76ba9066d7 --- /dev/null +++ b/Lang/ALGOL-68/21-game @@ -0,0 +1 @@ +../../Task/21-game/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/24-game b/Lang/ALGOL-68/24-game new file mode 120000 index 0000000000..509307eab2 --- /dev/null +++ b/Lang/ALGOL-68/24-game @@ -0,0 +1 @@ +../../Task/24-game/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/9-billion-names-of-God-the-integer b/Lang/ALGOL-68/9-billion-names-of-God-the-integer new file mode 120000 index 0000000000..01c632e0dd --- /dev/null +++ b/Lang/ALGOL-68/9-billion-names-of-God-the-integer @@ -0,0 +1 @@ +../../Task/9-billion-names-of-God-the-integer/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Angle-difference-between-two-bearings b/Lang/ALGOL-68/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..78582e775d --- /dev/null +++ b/Lang/ALGOL-68/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Angles-geometric-normalization-and-conversion b/Lang/ALGOL-68/Angles-geometric-normalization-and-conversion new file mode 120000 index 0000000000..e25f8337e6 --- /dev/null +++ b/Lang/ALGOL-68/Angles-geometric-normalization-and-conversion @@ -0,0 +1 @@ +../../Task/Angles-geometric-normalization-and-conversion/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Archimedean-spiral b/Lang/ALGOL-68/Archimedean-spiral new file mode 120000 index 0000000000..64c4988ade --- /dev/null +++ b/Lang/ALGOL-68/Archimedean-spiral @@ -0,0 +1 @@ +../../Task/Archimedean-spiral/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Arithmetic-geometric-mean-Calculate-Pi b/Lang/ALGOL-68/Arithmetic-geometric-mean-Calculate-Pi new file mode 120000 index 0000000000..1c8bcda555 --- /dev/null +++ b/Lang/ALGOL-68/Arithmetic-geometric-mean-Calculate-Pi @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean-Calculate-Pi/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Averages-Mean-time-of-day b/Lang/ALGOL-68/Averages-Mean-time-of-day new file mode 120000 index 0000000000..e97106ed2d --- /dev/null +++ b/Lang/ALGOL-68/Averages-Mean-time-of-day @@ -0,0 +1 @@ +../../Task/Averages-Mean-time-of-day/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Bifid-cipher b/Lang/ALGOL-68/Bifid-cipher new file mode 120000 index 0000000000..5e9da259ac --- /dev/null +++ b/Lang/ALGOL-68/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Bioinformatics-base-count b/Lang/ALGOL-68/Bioinformatics-base-count deleted file mode 120000 index cb9d66b55c..0000000000 --- a/Lang/ALGOL-68/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Biorhythms b/Lang/ALGOL-68/Biorhythms new file mode 120000 index 0000000000..b15056dfc9 --- /dev/null +++ b/Lang/ALGOL-68/Biorhythms @@ -0,0 +1 @@ +../../Task/Biorhythms/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Bitmap-B-zier-curves-Quadratic b/Lang/ALGOL-68/Bitmap-B-zier-curves-Quadratic new file mode 120000 index 0000000000..30ab56c310 --- /dev/null +++ b/Lang/ALGOL-68/Bitmap-B-zier-curves-Quadratic @@ -0,0 +1 @@ +../../Task/Bitmap-B-zier-curves-Quadratic/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Burrows-Wheeler-transform b/Lang/ALGOL-68/Burrows-Wheeler-transform new file mode 120000 index 0000000000..203e0e501f --- /dev/null +++ b/Lang/ALGOL-68/Burrows-Wheeler-transform @@ -0,0 +1 @@ +../../Task/Burrows-Wheeler-transform/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Chaocipher b/Lang/ALGOL-68/Chaocipher new file mode 120000 index 0000000000..1d4c0173db --- /dev/null +++ b/Lang/ALGOL-68/Chaocipher @@ -0,0 +1 @@ +../../Task/Chaocipher/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Chernicks-Carmichael-numbers b/Lang/ALGOL-68/Chernicks-Carmichael-numbers new file mode 120000 index 0000000000..ebdbb0354b --- /dev/null +++ b/Lang/ALGOL-68/Chernicks-Carmichael-numbers @@ -0,0 +1 @@ +../../Task/Chernicks-Carmichael-numbers/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Cheryls-birthday b/Lang/ALGOL-68/Cheryls-birthday new file mode 120000 index 0000000000..4a39e22573 --- /dev/null +++ b/Lang/ALGOL-68/Cheryls-birthday @@ -0,0 +1 @@ +../../Task/Cheryls-birthday/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Chinese-remainder-theorem b/Lang/ALGOL-68/Chinese-remainder-theorem new file mode 120000 index 0000000000..5c42550649 --- /dev/null +++ b/Lang/ALGOL-68/Chinese-remainder-theorem @@ -0,0 +1 @@ +../../Task/Chinese-remainder-theorem/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Cistercian-numerals b/Lang/ALGOL-68/Cistercian-numerals new file mode 120000 index 0000000000..1a20b26b09 --- /dev/null +++ b/Lang/ALGOL-68/Cistercian-numerals @@ -0,0 +1 @@ +../../Task/Cistercian-numerals/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Convex-hull b/Lang/ALGOL-68/Convex-hull new file mode 120000 index 0000000000..6ded12cc5d --- /dev/null +++ b/Lang/ALGOL-68/Convex-hull @@ -0,0 +1 @@ +../../Task/Convex-hull/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Date-manipulation b/Lang/ALGOL-68/Date-manipulation new file mode 120000 index 0000000000..700d602cf1 --- /dev/null +++ b/Lang/ALGOL-68/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/De-Bruijn-sequences b/Lang/ALGOL-68/De-Bruijn-sequences new file mode 120000 index 0000000000..1c1a7f459e --- /dev/null +++ b/Lang/ALGOL-68/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Death-Star b/Lang/ALGOL-68/Death-Star new file mode 120000 index 0000000000..71a96e0b37 --- /dev/null +++ b/Lang/ALGOL-68/Death-Star @@ -0,0 +1 @@ +../../Task/Death-Star/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Demings-funnel b/Lang/ALGOL-68/Demings-funnel new file mode 120000 index 0000000000..c30e5a173e --- /dev/null +++ b/Lang/ALGOL-68/Demings-funnel @@ -0,0 +1 @@ +../../Task/Demings-funnel/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Determinant-and-permanent b/Lang/ALGOL-68/Determinant-and-permanent new file mode 120000 index 0000000000..e8a753594d --- /dev/null +++ b/Lang/ALGOL-68/Determinant-and-permanent @@ -0,0 +1 @@ +../../Task/Determinant-and-permanent/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Dice-game-probabilities b/Lang/ALGOL-68/Dice-game-probabilities new file mode 120000 index 0000000000..9b1e59ee7b --- /dev/null +++ b/Lang/ALGOL-68/Dice-game-probabilities @@ -0,0 +1 @@ +../../Task/Dice-game-probabilities/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Display-an-outline-as-a-nested-table b/Lang/ALGOL-68/Display-an-outline-as-a-nested-table new file mode 120000 index 0000000000..41ea472cc8 --- /dev/null +++ b/Lang/ALGOL-68/Display-an-outline-as-a-nested-table @@ -0,0 +1 @@ +../../Task/Display-an-outline-as-a-nested-table/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Distribution-of-0-digits-in-factorial-series b/Lang/ALGOL-68/Distribution-of-0-digits-in-factorial-series new file mode 120000 index 0000000000..242e3aeb60 --- /dev/null +++ b/Lang/ALGOL-68/Distribution-of-0-digits-in-factorial-series @@ -0,0 +1 @@ +../../Task/Distribution-of-0-digits-in-factorial-series/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Draw-a-cuboid b/Lang/ALGOL-68/Draw-a-cuboid new file mode 120000 index 0000000000..3102af7fc7 --- /dev/null +++ b/Lang/ALGOL-68/Draw-a-cuboid @@ -0,0 +1 @@ +../../Task/Draw-a-cuboid/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Dynamic-variable-names b/Lang/ALGOL-68/Dynamic-variable-names new file mode 120000 index 0000000000..eae667a38d --- /dev/null +++ b/Lang/ALGOL-68/Dynamic-variable-names @@ -0,0 +1 @@ +../../Task/Dynamic-variable-names/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Eban-numbers b/Lang/ALGOL-68/Eban-numbers new file mode 120000 index 0000000000..fa85ff0e58 --- /dev/null +++ b/Lang/ALGOL-68/Eban-numbers @@ -0,0 +1 @@ +../../Task/Eban-numbers/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Elementary-cellular-automaton-Random-number-generator b/Lang/ALGOL-68/Elementary-cellular-automaton-Random-number-generator new file mode 120000 index 0000000000..a4aed0fa0e --- /dev/null +++ b/Lang/ALGOL-68/Elementary-cellular-automaton-Random-number-generator @@ -0,0 +1 @@ +../../Task/Elementary-cellular-automaton-Random-number-generator/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Elliptic-curve-arithmetic b/Lang/ALGOL-68/Elliptic-curve-arithmetic new file mode 120000 index 0000000000..88681d69e9 --- /dev/null +++ b/Lang/ALGOL-68/Elliptic-curve-arithmetic @@ -0,0 +1 @@ +../../Task/Elliptic-curve-arithmetic/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Equal-prime-and-composite-sums b/Lang/ALGOL-68/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..7f8271d85e --- /dev/null +++ b/Lang/ALGOL-68/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Factorial b/Lang/ALGOL-68/Factorial deleted file mode 120000 index b406800839..0000000000 --- a/Lang/ALGOL-68/Factorial +++ /dev/null @@ -1 +0,0 @@ -../../Task/Factorial/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Factorial-base-numbers-indexing-permutations-of-a-collection b/Lang/ALGOL-68/Factorial-base-numbers-indexing-permutations-of-a-collection new file mode 120000 index 0000000000..ab36c72f12 --- /dev/null +++ b/Lang/ALGOL-68/Factorial-base-numbers-indexing-permutations-of-a-collection @@ -0,0 +1 @@ +../../Task/Factorial-base-numbers-indexing-permutations-of-a-collection/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Fermat-numbers b/Lang/ALGOL-68/Fermat-numbers new file mode 120000 index 0000000000..a0269ca31a --- /dev/null +++ b/Lang/ALGOL-68/Fermat-numbers @@ -0,0 +1 @@ +../../Task/Fermat-numbers/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Floyd-Warshall-algorithm b/Lang/ALGOL-68/Floyd-Warshall-algorithm new file mode 120000 index 0000000000..704f4ca44e --- /dev/null +++ b/Lang/ALGOL-68/Floyd-Warshall-algorithm @@ -0,0 +1 @@ +../../Task/Floyd-Warshall-algorithm/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Fortunate-numbers b/Lang/ALGOL-68/Fortunate-numbers new file mode 120000 index 0000000000..c6ecf1ee17 --- /dev/null +++ b/Lang/ALGOL-68/Fortunate-numbers @@ -0,0 +1 @@ +../../Task/Fortunate-numbers/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Four-is-magic b/Lang/ALGOL-68/Four-is-magic new file mode 120000 index 0000000000..007db868ed --- /dev/null +++ b/Lang/ALGOL-68/Four-is-magic @@ -0,0 +1 @@ +../../Task/Four-is-magic/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/IBAN b/Lang/ALGOL-68/IBAN new file mode 120000 index 0000000000..08ea01a928 --- /dev/null +++ b/Lang/ALGOL-68/IBAN @@ -0,0 +1 @@ +../../Task/IBAN/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Jacobi-symbol b/Lang/ALGOL-68/Jacobi-symbol new file mode 120000 index 0000000000..6ad192d3e6 --- /dev/null +++ b/Lang/ALGOL-68/Jacobi-symbol @@ -0,0 +1 @@ +../../Task/Jacobi-symbol/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Jaro-similarity b/Lang/ALGOL-68/Jaro-similarity new file mode 120000 index 0000000000..0255b5f0fa --- /dev/null +++ b/Lang/ALGOL-68/Jaro-similarity @@ -0,0 +1 @@ +../../Task/Jaro-similarity/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Jordan-P-lya-numbers b/Lang/ALGOL-68/Jordan-P-lya-numbers new file mode 120000 index 0000000000..6750737d48 --- /dev/null +++ b/Lang/ALGOL-68/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Juggler-sequence b/Lang/ALGOL-68/Juggler-sequence new file mode 120000 index 0000000000..2c24c77bfb --- /dev/null +++ b/Lang/ALGOL-68/Juggler-sequence @@ -0,0 +1 @@ +../../Task/Juggler-sequence/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Knapsack-problem-0-1 b/Lang/ALGOL-68/Knapsack-problem-0-1 new file mode 120000 index 0000000000..38cd6f2ecb --- /dev/null +++ b/Lang/ALGOL-68/Knapsack-problem-0-1 @@ -0,0 +1 @@ +../../Task/Knapsack-problem-0-1/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Knapsack-problem-Continuous b/Lang/ALGOL-68/Knapsack-problem-Continuous new file mode 120000 index 0000000000..f49865cc46 --- /dev/null +++ b/Lang/ALGOL-68/Knapsack-problem-Continuous @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Continuous/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Koch-curve b/Lang/ALGOL-68/Koch-curve new file mode 120000 index 0000000000..1a27265644 --- /dev/null +++ b/Lang/ALGOL-68/Koch-curve @@ -0,0 +1 @@ +../../Task/Koch-curve/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/LU-decomposition b/Lang/ALGOL-68/LU-decomposition new file mode 120000 index 0000000000..3453e9548a --- /dev/null +++ b/Lang/ALGOL-68/LU-decomposition @@ -0,0 +1 @@ +../../Task/LU-decomposition/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Legendre-prime-counting-function b/Lang/ALGOL-68/Legendre-prime-counting-function new file mode 120000 index 0000000000..f71f764e65 --- /dev/null +++ b/Lang/ALGOL-68/Legendre-prime-counting-function @@ -0,0 +1 @@ +../../Task/Legendre-prime-counting-function/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Logistic-curve-fitting-in-epidemiology b/Lang/ALGOL-68/Logistic-curve-fitting-in-epidemiology new file mode 120000 index 0000000000..508ef46a64 --- /dev/null +++ b/Lang/ALGOL-68/Logistic-curve-fitting-in-epidemiology @@ -0,0 +1 @@ +../../Task/Logistic-curve-fitting-in-epidemiology/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Long-primes b/Lang/ALGOL-68/Long-primes new file mode 120000 index 0000000000..5932549f9d --- /dev/null +++ b/Lang/ALGOL-68/Long-primes @@ -0,0 +1 @@ +../../Task/Long-primes/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Longest-increasing-subsequence b/Lang/ALGOL-68/Longest-increasing-subsequence new file mode 120000 index 0000000000..a09c83eed3 --- /dev/null +++ b/Lang/ALGOL-68/Longest-increasing-subsequence @@ -0,0 +1 @@ +../../Task/Longest-increasing-subsequence/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Magic-squares-of-singly-even-order b/Lang/ALGOL-68/Magic-squares-of-singly-even-order new file mode 120000 index 0000000000..25b7aec11a --- /dev/null +++ b/Lang/ALGOL-68/Magic-squares-of-singly-even-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-singly-even-order/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Mayan-numerals b/Lang/ALGOL-68/Mayan-numerals new file mode 120000 index 0000000000..901b0eac41 --- /dev/null +++ b/Lang/ALGOL-68/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Meissel-Mertens-constant b/Lang/ALGOL-68/Meissel-Mertens-constant deleted file mode 120000 index e7b400c689..0000000000 --- a/Lang/ALGOL-68/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Miller-Rabin-primality-test b/Lang/ALGOL-68/Miller-Rabin-primality-test deleted file mode 120000 index c0a1c115c4..0000000000 --- a/Lang/ALGOL-68/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Modified-random-distribution b/Lang/ALGOL-68/Modified-random-distribution new file mode 120000 index 0000000000..1858012a62 --- /dev/null +++ b/Lang/ALGOL-68/Modified-random-distribution @@ -0,0 +1 @@ +../../Task/Modified-random-distribution/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Number-reversal-game b/Lang/ALGOL-68/Number-reversal-game new file mode 120000 index 0000000000..243202f9d2 --- /dev/null +++ b/Lang/ALGOL-68/Number-reversal-game @@ -0,0 +1 @@ +../../Task/Number-reversal-game/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Numbers-which-are-not-the-sum-of-distinct-squares b/Lang/ALGOL-68/Numbers-which-are-not-the-sum-of-distinct-squares new file mode 120000 index 0000000000..b879b4a5c6 --- /dev/null +++ b/Lang/ALGOL-68/Numbers-which-are-not-the-sum-of-distinct-squares @@ -0,0 +1 @@ +../../Task/Numbers-which-are-not-the-sum-of-distinct-squares/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Partition-an-integer-x-into-n-primes b/Lang/ALGOL-68/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..a393060101 --- /dev/null +++ b/Lang/ALGOL-68/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Partition-function-P b/Lang/ALGOL-68/Partition-function-P new file mode 120000 index 0000000000..98f6538801 --- /dev/null +++ b/Lang/ALGOL-68/Partition-function-P @@ -0,0 +1 @@ +../../Task/Partition-function-P/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Peano-curve b/Lang/ALGOL-68/Peano-curve new file mode 120000 index 0000000000..7ad831ac36 --- /dev/null +++ b/Lang/ALGOL-68/Peano-curve @@ -0,0 +1 @@ +../../Task/Peano-curve/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Pentagram b/Lang/ALGOL-68/Pentagram new file mode 120000 index 0000000000..7ab101a89e --- /dev/null +++ b/Lang/ALGOL-68/Pentagram @@ -0,0 +1 @@ +../../Task/Pentagram/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Perlin-noise b/Lang/ALGOL-68/Perlin-noise new file mode 120000 index 0000000000..8bd6981103 --- /dev/null +++ b/Lang/ALGOL-68/Perlin-noise @@ -0,0 +1 @@ +../../Task/Perlin-noise/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Permutation-test b/Lang/ALGOL-68/Permutation-test new file mode 120000 index 0000000000..1a8b7f20df --- /dev/null +++ b/Lang/ALGOL-68/Permutation-test @@ -0,0 +1 @@ +../../Task/Permutation-test/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Pisano-period b/Lang/ALGOL-68/Pisano-period new file mode 120000 index 0000000000..b012a168d9 --- /dev/null +++ b/Lang/ALGOL-68/Pisano-period @@ -0,0 +1 @@ +../../Task/Pisano-period/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Polynomial-long-division b/Lang/ALGOL-68/Polynomial-long-division new file mode 120000 index 0000000000..792b97252e --- /dev/null +++ b/Lang/ALGOL-68/Polynomial-long-division @@ -0,0 +1 @@ +../../Task/Polynomial-long-division/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Primes---allocate-descendants-to-their-ancestors b/Lang/ALGOL-68/Primes---allocate-descendants-to-their-ancestors new file mode 120000 index 0000000000..9bf6ed3e36 --- /dev/null +++ b/Lang/ALGOL-68/Primes---allocate-descendants-to-their-ancestors @@ -0,0 +1 @@ +../../Task/Primes---allocate-descendants-to-their-ancestors/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Problem-of-Apollonius b/Lang/ALGOL-68/Problem-of-Apollonius new file mode 120000 index 0000000000..51b4085ef1 --- /dev/null +++ b/Lang/ALGOL-68/Problem-of-Apollonius @@ -0,0 +1 @@ +../../Task/Problem-of-Apollonius/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Pythagoras-tree b/Lang/ALGOL-68/Pythagoras-tree new file mode 120000 index 0000000000..8c304d8b68 --- /dev/null +++ b/Lang/ALGOL-68/Pythagoras-tree @@ -0,0 +1 @@ +../../Task/Pythagoras-tree/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Pythagorean-triples b/Lang/ALGOL-68/Pythagorean-triples new file mode 120000 index 0000000000..8c48c48b1b --- /dev/null +++ b/Lang/ALGOL-68/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Quaternion-type b/Lang/ALGOL-68/Quaternion-type deleted file mode 120000 index 9934ee409f..0000000000 --- a/Lang/ALGOL-68/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Quoting-constructs b/Lang/ALGOL-68/Quoting-constructs new file mode 120000 index 0000000000..7f6defd772 --- /dev/null +++ b/Lang/ALGOL-68/Quoting-constructs @@ -0,0 +1 @@ +../../Task/Quoting-constructs/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Radical-of-an-integer b/Lang/ALGOL-68/Radical-of-an-integer new file mode 120000 index 0000000000..18632fce6e --- /dev/null +++ b/Lang/ALGOL-68/Radical-of-an-integer @@ -0,0 +1 @@ +../../Task/Radical-of-an-integer/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Ramanujans-constant b/Lang/ALGOL-68/Ramanujans-constant new file mode 120000 index 0000000000..7fce932657 --- /dev/null +++ b/Lang/ALGOL-68/Ramanujans-constant @@ -0,0 +1 @@ +../../Task/Ramanujans-constant/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Ramer-Douglas-Peucker-line-simplification b/Lang/ALGOL-68/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..b719791f41 --- /dev/null +++ b/Lang/ALGOL-68/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Range-consolidation b/Lang/ALGOL-68/Range-consolidation new file mode 120000 index 0000000000..51b0e5d75e --- /dev/null +++ b/Lang/ALGOL-68/Range-consolidation @@ -0,0 +1 @@ +../../Task/Range-consolidation/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Ray-casting-algorithm b/Lang/ALGOL-68/Ray-casting-algorithm new file mode 120000 index 0000000000..2c4b411219 --- /dev/null +++ b/Lang/ALGOL-68/Ray-casting-algorithm @@ -0,0 +1 @@ +../../Task/Ray-casting-algorithm/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Sailors-coconuts-and-a-monkey-problem b/Lang/ALGOL-68/Sailors-coconuts-and-a-monkey-problem new file mode 120000 index 0000000000..c84573878e --- /dev/null +++ b/Lang/ALGOL-68/Sailors-coconuts-and-a-monkey-problem @@ -0,0 +1 @@ +../../Task/Sailors-coconuts-and-a-monkey-problem/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Sequence:-nth-number-with-exactly-n-divisors b/Lang/ALGOL-68/Sequence:-nth-number-with-exactly-n-divisors new file mode 120000 index 0000000000..02fc9fe7df --- /dev/null +++ b/Lang/ALGOL-68/Sequence:-nth-number-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-nth-number-with-exactly-n-divisors/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Sierpinski-arrowhead-curve b/Lang/ALGOL-68/Sierpinski-arrowhead-curve new file mode 120000 index 0000000000..3f487dc4fa --- /dev/null +++ b/Lang/ALGOL-68/Sierpinski-arrowhead-curve @@ -0,0 +1 @@ +../../Task/Sierpinski-arrowhead-curve/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Sierpinski-square-curve b/Lang/ALGOL-68/Sierpinski-square-curve new file mode 120000 index 0000000000..7aaf7e1567 --- /dev/null +++ b/Lang/ALGOL-68/Sierpinski-square-curve @@ -0,0 +1 @@ +../../Task/Sierpinski-square-curve/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Sierpinski-triangle-Graphical b/Lang/ALGOL-68/Sierpinski-triangle-Graphical new file mode 120000 index 0000000000..c561698ad4 --- /dev/null +++ b/Lang/ALGOL-68/Sierpinski-triangle-Graphical @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle-Graphical/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Sleeping-Beauty-problem b/Lang/ALGOL-68/Sleeping-Beauty-problem new file mode 120000 index 0000000000..b5873d4f8d --- /dev/null +++ b/Lang/ALGOL-68/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k b/Lang/ALGOL-68/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k new file mode 120000 index 0000000000..a96279cee7 --- /dev/null +++ b/Lang/ALGOL-68/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k @@ -0,0 +1 @@ +../../Task/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Solve-a-Hidato-puzzle b/Lang/ALGOL-68/Solve-a-Hidato-puzzle new file mode 120000 index 0000000000..228ccf6bb3 --- /dev/null +++ b/Lang/ALGOL-68/Solve-a-Hidato-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hidato-puzzle/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Solve-a-Numbrix-puzzle b/Lang/ALGOL-68/Solve-a-Numbrix-puzzle new file mode 120000 index 0000000000..14e9e80e97 --- /dev/null +++ b/Lang/ALGOL-68/Solve-a-Numbrix-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Numbrix-puzzle/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Solve-the-no-connection-puzzle b/Lang/ALGOL-68/Solve-the-no-connection-puzzle new file mode 120000 index 0000000000..0ffda5f1f9 --- /dev/null +++ b/Lang/ALGOL-68/Solve-the-no-connection-puzzle @@ -0,0 +1 @@ +../../Task/Solve-the-no-connection-puzzle/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Sort-disjoint-sublist b/Lang/ALGOL-68/Sort-disjoint-sublist new file mode 120000 index 0000000000..be15a7cde3 --- /dev/null +++ b/Lang/ALGOL-68/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Sort-numbers-lexicographically b/Lang/ALGOL-68/Sort-numbers-lexicographically new file mode 120000 index 0000000000..7da8e72755 --- /dev/null +++ b/Lang/ALGOL-68/Sort-numbers-lexicographically @@ -0,0 +1 @@ +../../Task/Sort-numbers-lexicographically/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Substitution-cipher b/Lang/ALGOL-68/Substitution-cipher new file mode 120000 index 0000000000..b8b9dd702a --- /dev/null +++ b/Lang/ALGOL-68/Substitution-cipher @@ -0,0 +1 @@ +../../Task/Substitution-cipher/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Subtractive-generator b/Lang/ALGOL-68/Subtractive-generator new file mode 120000 index 0000000000..f90071e31a --- /dev/null +++ b/Lang/ALGOL-68/Subtractive-generator @@ -0,0 +1 @@ +../../Task/Subtractive-generator/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Sum-and-product-puzzle b/Lang/ALGOL-68/Sum-and-product-puzzle new file mode 120000 index 0000000000..18865c2c45 --- /dev/null +++ b/Lang/ALGOL-68/Sum-and-product-puzzle @@ -0,0 +1 @@ +../../Task/Sum-and-product-puzzle/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Super-d-numbers b/Lang/ALGOL-68/Super-d-numbers new file mode 120000 index 0000000000..f050b2afa7 --- /dev/null +++ b/Lang/ALGOL-68/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Take-notes-on-the-command-line b/Lang/ALGOL-68/Take-notes-on-the-command-line new file mode 120000 index 0000000000..f0f896e58b --- /dev/null +++ b/Lang/ALGOL-68/Take-notes-on-the-command-line @@ -0,0 +1 @@ +../../Task/Take-notes-on-the-command-line/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Text-processing-2 b/Lang/ALGOL-68/Text-processing-2 new file mode 120000 index 0000000000..124fe3bf6c --- /dev/null +++ b/Lang/ALGOL-68/Text-processing-2 @@ -0,0 +1 @@ +../../Task/Text-processing-2/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Total-circles-area b/Lang/ALGOL-68/Total-circles-area new file mode 120000 index 0000000000..b2c70ca7c7 --- /dev/null +++ b/Lang/ALGOL-68/Total-circles-area @@ -0,0 +1 @@ +../../Task/Total-circles-area/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Verhoeff-algorithm b/Lang/ALGOL-68/Verhoeff-algorithm new file mode 120000 index 0000000000..7cabb86204 --- /dev/null +++ b/Lang/ALGOL-68/Verhoeff-algorithm @@ -0,0 +1 @@ +../../Task/Verhoeff-algorithm/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Vogels-approximation-method b/Lang/ALGOL-68/Vogels-approximation-method new file mode 120000 index 0000000000..9c09f3c2a5 --- /dev/null +++ b/Lang/ALGOL-68/Vogels-approximation-method @@ -0,0 +1 @@ +../../Task/Vogels-approximation-method/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Wasteful-equidigital-and-frugal-numbers b/Lang/ALGOL-68/Wasteful-equidigital-and-frugal-numbers new file mode 120000 index 0000000000..6de9ddaea1 --- /dev/null +++ b/Lang/ALGOL-68/Wasteful-equidigital-and-frugal-numbers @@ -0,0 +1 @@ +../../Task/Wasteful-equidigital-and-frugal-numbers/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Word-wheel b/Lang/ALGOL-68/Word-wheel new file mode 120000 index 0000000000..ab6aaa99f7 --- /dev/null +++ b/Lang/ALGOL-68/Word-wheel @@ -0,0 +1 @@ +../../Task/Word-wheel/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-M/Additive-primes b/Lang/ALGOL-M/Additive-primes new file mode 120000 index 0000000000..974f9484e7 --- /dev/null +++ b/Lang/ALGOL-M/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/ALGOL-M \ No newline at end of file diff --git a/Lang/ALGOL-M/Case-sensitivity-of-identifiers b/Lang/ALGOL-M/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..3e61bd6e7f --- /dev/null +++ b/Lang/ALGOL-M/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/ALGOL-M \ No newline at end of file diff --git a/Lang/ALGOL-M/Exponentiation-order b/Lang/ALGOL-M/Exponentiation-order new file mode 120000 index 0000000000..b37e574b53 --- /dev/null +++ b/Lang/ALGOL-M/Exponentiation-order @@ -0,0 +1 @@ +../../Task/Exponentiation-order/ALGOL-M \ No newline at end of file diff --git a/Lang/ALGOL-M/Integer-comparison b/Lang/ALGOL-M/Integer-comparison new file mode 120000 index 0000000000..1066ff383c --- /dev/null +++ b/Lang/ALGOL-M/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/ALGOL-M \ No newline at end of file diff --git a/Lang/ALGOL-M/Integer-overflow b/Lang/ALGOL-M/Integer-overflow new file mode 120000 index 0000000000..a7f3c63fee --- /dev/null +++ b/Lang/ALGOL-M/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/ALGOL-M \ No newline at end of file diff --git a/Lang/ALGOL-M/Semiprime b/Lang/ALGOL-M/Semiprime new file mode 120000 index 0000000000..9bc2a5e1b8 --- /dev/null +++ b/Lang/ALGOL-M/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/ALGOL-M \ No newline at end of file diff --git a/Lang/ALGOL-W/00-LANG.txt b/Lang/ALGOL-W/00-LANG.txt index eed21ba5cf..f0f11b51d0 100644 --- a/Lang/ALGOL-W/00-LANG.txt +++ b/Lang/ALGOL-W/00-LANG.txt @@ -7,27 +7,15 @@ |checking=both |tags=algolw |LCT=yes}} -Algol W is a successor to [[wp:Algol 60|Algol 60]] closely based on A +Algol W was designed as a successor to [[wp:Algol 60|Algol 60]], closely based on A Contribution to the Development of ALGOL by [[wp:Niklaus Wirth|Niklaus Wirth]] and [[wp:C.A.R. Hoare|C. A. R. Hoare]]. It includes dynamically allocated records, string handling, complex numbers and a standard I/O -system. A copy of the Algol W Language Description can be found on Karl -Kleine's [http://www.fh-jena.de/~kleine/history/history.html Historic Documents in Computer Science] +system. A description of the Algol W Language as at 1972 can be found at [https://bitsavers.org/pdf/stanford/cs_techReports/STAN-CS-71-230_Algol_W_Reference_Manual_Feb72.pdf Algol W Reference Manual 1972 on bitsavers.org] page. [http://everything2.com/title/Algol%2520W Dabcanboulet's Algol W @ Everything2] page contains an excellent history and tutorial. -[http://tiddly-pom.com/~glyn/ Awe] is a new compiler for the Algol W -language. It is a complete implementation of the language described in -the [https://tiddly-pom.com/~glyn/algolw.pdf Algol W Language Description, June 1972]. Awe should be able to -compile code intended for the [[wp:OS/360|OS/360]] Algol W compilers -with little or no modification. See the Awe manual for more details. - -Awe correctly compiles Tony Marsland's computer [[wp:chess|chess]] player -[http://webdocs.cs.ualberta.ca/~tony/Public/Awit-Wita-ComputerChess/ Awit] -and Hendrik Boom's [http://mtn-host.prjek.net/projects/a68h/ A68H] -[[Algol 68]] compiler. - ==To do== [[Tasks not implemented in ALGOL W]] diff --git a/Lang/ALGOL-W/100-doors b/Lang/ALGOL-W/100-doors deleted file mode 120000 index 954c02976a..0000000000 --- a/Lang/ALGOL-W/100-doors +++ /dev/null @@ -1 +0,0 @@ -../../Task/100-doors/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Angles-geometric-normalization-and-conversion b/Lang/ALGOL-W/Angles-geometric-normalization-and-conversion new file mode 120000 index 0000000000..84598a2a10 --- /dev/null +++ b/Lang/ALGOL-W/Angles-geometric-normalization-and-conversion @@ -0,0 +1 @@ +../../Task/Angles-geometric-normalization-and-conversion/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Arithmetic-Integer b/Lang/ALGOL-W/Arithmetic-Integer deleted file mode 120000 index de259d015a..0000000000 --- a/Lang/ALGOL-W/Arithmetic-Integer +++ /dev/null @@ -1 +0,0 @@ -../../Task/Arithmetic-Integer/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Arithmetic-geometric-mean-Calculate-Pi b/Lang/ALGOL-W/Arithmetic-geometric-mean-Calculate-Pi new file mode 120000 index 0000000000..0fd6c8a97f --- /dev/null +++ b/Lang/ALGOL-W/Arithmetic-geometric-mean-Calculate-Pi @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean-Calculate-Pi/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Bell-numbers b/Lang/ALGOL-W/Bell-numbers new file mode 120000 index 0000000000..07e4520258 --- /dev/null +++ b/Lang/ALGOL-W/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Calculating-the-value-of-e b/Lang/ALGOL-W/Calculating-the-value-of-e new file mode 120000 index 0000000000..0bccb15458 --- /dev/null +++ b/Lang/ALGOL-W/Calculating-the-value-of-e @@ -0,0 +1 @@ +../../Task/Calculating-the-value-of-e/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Copy-a-string b/Lang/ALGOL-W/Copy-a-string deleted file mode 120000 index 4a449ab936..0000000000 --- a/Lang/ALGOL-W/Copy-a-string +++ /dev/null @@ -1 +0,0 @@ -../../Task/Copy-a-string/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Equal-prime-and-composite-sums b/Lang/ALGOL-W/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..54c76175f4 --- /dev/null +++ b/Lang/ALGOL-W/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Eulers-constant-0.5772... b/Lang/ALGOL-W/Eulers-constant-0.5772... new file mode 120000 index 0000000000..809de9e1fd --- /dev/null +++ b/Lang/ALGOL-W/Eulers-constant-0.5772... @@ -0,0 +1 @@ +../../Task/Eulers-constant-0.5772.../ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Eulers-identity b/Lang/ALGOL-W/Eulers-identity new file mode 120000 index 0000000000..cda4a96c63 --- /dev/null +++ b/Lang/ALGOL-W/Eulers-identity @@ -0,0 +1 @@ +../../Task/Eulers-identity/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Factorial b/Lang/ALGOL-W/Factorial deleted file mode 120000 index 01c77fb141..0000000000 --- a/Lang/ALGOL-W/Factorial +++ /dev/null @@ -1 +0,0 @@ -../../Task/Factorial/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Factorial-primes b/Lang/ALGOL-W/Factorial-primes new file mode 120000 index 0000000000..d855b375f0 --- /dev/null +++ b/Lang/ALGOL-W/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Find-the-intersection-of-two-lines b/Lang/ALGOL-W/Find-the-intersection-of-two-lines new file mode 120000 index 0000000000..0514984ef6 --- /dev/null +++ b/Lang/ALGOL-W/Find-the-intersection-of-two-lines @@ -0,0 +1 @@ +../../Task/Find-the-intersection-of-two-lines/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Integer-comparison b/Lang/ALGOL-W/Integer-comparison deleted file mode 120000 index b056aab0f7..0000000000 --- a/Lang/ALGOL-W/Integer-comparison +++ /dev/null @@ -1 +0,0 @@ -../../Task/Integer-comparison/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Jacobi-symbol b/Lang/ALGOL-W/Jacobi-symbol new file mode 120000 index 0000000000..9d2230fbff --- /dev/null +++ b/Lang/ALGOL-W/Jacobi-symbol @@ -0,0 +1 @@ +../../Task/Jacobi-symbol/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Jordan-P-lya-numbers b/Lang/ALGOL-W/Jordan-P-lya-numbers new file mode 120000 index 0000000000..6e24b686d2 --- /dev/null +++ b/Lang/ALGOL-W/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Knapsack-problem-Continuous b/Lang/ALGOL-W/Knapsack-problem-Continuous new file mode 120000 index 0000000000..fba28c1695 --- /dev/null +++ b/Lang/ALGOL-W/Knapsack-problem-Continuous @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Continuous/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/McNuggets-problem b/Lang/ALGOL-W/McNuggets-problem new file mode 120000 index 0000000000..74213b63b7 --- /dev/null +++ b/Lang/ALGOL-W/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Mian-Chowla-sequence b/Lang/ALGOL-W/Mian-Chowla-sequence new file mode 120000 index 0000000000..ef2068107d --- /dev/null +++ b/Lang/ALGOL-W/Mian-Chowla-sequence @@ -0,0 +1 @@ +../../Task/Mian-Chowla-sequence/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Numbers-which-are-not-the-sum-of-distinct-squares b/Lang/ALGOL-W/Numbers-which-are-not-the-sum-of-distinct-squares new file mode 120000 index 0000000000..d2256bcafe --- /dev/null +++ b/Lang/ALGOL-W/Numbers-which-are-not-the-sum-of-distinct-squares @@ -0,0 +1 @@ +../../Task/Numbers-which-are-not-the-sum-of-distinct-squares/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Numbers-with-equal-rises-and-falls b/Lang/ALGOL-W/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..da06043b47 --- /dev/null +++ b/Lang/ALGOL-W/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Pseudo-random-numbers-Middle-square-method b/Lang/ALGOL-W/Pseudo-random-numbers-Middle-square-method new file mode 120000 index 0000000000..e6f0e36a5b --- /dev/null +++ b/Lang/ALGOL-W/Pseudo-random-numbers-Middle-square-method @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Middle-square-method/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Quaternion-type b/Lang/ALGOL-W/Quaternion-type deleted file mode 120000 index 9f1593930d..0000000000 --- a/Lang/ALGOL-W/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Sierpinski-square-curve b/Lang/ALGOL-W/Sierpinski-square-curve new file mode 120000 index 0000000000..c787c64cbf --- /dev/null +++ b/Lang/ALGOL-W/Sierpinski-square-curve @@ -0,0 +1 @@ +../../Task/Sierpinski-square-curve/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Sleeping-Beauty-problem b/Lang/ALGOL-W/Sleeping-Beauty-problem new file mode 120000 index 0000000000..2a0e8b6707 --- /dev/null +++ b/Lang/ALGOL-W/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Square-but-not-cube b/Lang/ALGOL-W/Square-but-not-cube new file mode 120000 index 0000000000..4f2dc4fb68 --- /dev/null +++ b/Lang/ALGOL-W/Square-but-not-cube @@ -0,0 +1 @@ +../../Task/Square-but-not-cube/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Square-free-integers b/Lang/ALGOL-W/Square-free-integers new file mode 120000 index 0000000000..c98b8e474a --- /dev/null +++ b/Lang/ALGOL-W/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Tau-number b/Lang/ALGOL-W/Tau-number new file mode 120000 index 0000000000..8bde57a739 --- /dev/null +++ b/Lang/ALGOL-W/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/Temperature-conversion b/Lang/ALGOL-W/Temperature-conversion new file mode 120000 index 0000000000..fa3a68b9d1 --- /dev/null +++ b/Lang/ALGOL-W/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/ALGOL-W \ No newline at end of file diff --git a/Lang/ALGOL-W/The-sieve-of-Sundaram b/Lang/ALGOL-W/The-sieve-of-Sundaram new file mode 120000 index 0000000000..f0d3b0894c --- /dev/null +++ b/Lang/ALGOL-W/The-sieve-of-Sundaram @@ -0,0 +1 @@ +../../Task/The-sieve-of-Sundaram/ALGOL-W \ No newline at end of file diff --git a/Lang/ANSI-BASIC/100-doors b/Lang/ANSI-BASIC/100-doors new file mode 120000 index 0000000000..bd1164e9d1 --- /dev/null +++ b/Lang/ANSI-BASIC/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/AKS-test-for-primes b/Lang/ANSI-BASIC/AKS-test-for-primes new file mode 120000 index 0000000000..4668d2783c --- /dev/null +++ b/Lang/ANSI-BASIC/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Abundant-deficient-and-perfect-number-classifications b/Lang/ANSI-BASIC/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..c6e6a91dca --- /dev/null +++ b/Lang/ANSI-BASIC/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Abundant-odd-numbers b/Lang/ANSI-BASIC/Abundant-odd-numbers new file mode 120000 index 0000000000..655c1f21d6 --- /dev/null +++ b/Lang/ANSI-BASIC/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Angle-difference-between-two-bearings b/Lang/ANSI-BASIC/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..de48f860b4 --- /dev/null +++ b/Lang/ANSI-BASIC/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Arithmetic-numbers b/Lang/ANSI-BASIC/Arithmetic-numbers new file mode 120000 index 0000000000..db92ceb262 --- /dev/null +++ b/Lang/ANSI-BASIC/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Babbage-problem b/Lang/ANSI-BASIC/Babbage-problem new file mode 120000 index 0000000000..8ef3bfe458 --- /dev/null +++ b/Lang/ANSI-BASIC/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/CUSIP b/Lang/ANSI-BASIC/CUSIP new file mode 120000 index 0000000000..fc24eb8330 --- /dev/null +++ b/Lang/ANSI-BASIC/CUSIP @@ -0,0 +1 @@ +../../Task/CUSIP/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Catalan-numbers b/Lang/ANSI-BASIC/Catalan-numbers new file mode 120000 index 0000000000..9c5cfe1b71 --- /dev/null +++ b/Lang/ANSI-BASIC/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Cumulative-standard-deviation b/Lang/ANSI-BASIC/Cumulative-standard-deviation new file mode 120000 index 0000000000..1d8fe68648 --- /dev/null +++ b/Lang/ANSI-BASIC/Cumulative-standard-deviation @@ -0,0 +1 @@ +../../Task/Cumulative-standard-deviation/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Damm-algorithm b/Lang/ANSI-BASIC/Damm-algorithm new file mode 120000 index 0000000000..e4b39fdaa1 --- /dev/null +++ b/Lang/ANSI-BASIC/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Day-of-the-week b/Lang/ANSI-BASIC/Day-of-the-week new file mode 120000 index 0000000000..8ccffe667c --- /dev/null +++ b/Lang/ANSI-BASIC/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Department-numbers b/Lang/ANSI-BASIC/Department-numbers new file mode 120000 index 0000000000..44a9633eba --- /dev/null +++ b/Lang/ANSI-BASIC/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Determine-if-a-string-is-collapsible b/Lang/ANSI-BASIC/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..47a87c627a --- /dev/null +++ b/Lang/ANSI-BASIC/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Dot-product b/Lang/ANSI-BASIC/Dot-product new file mode 120000 index 0000000000..22c1437095 --- /dev/null +++ b/Lang/ANSI-BASIC/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Dutch-national-flag-problem b/Lang/ANSI-BASIC/Dutch-national-flag-problem new file mode 120000 index 0000000000..96adf147fe --- /dev/null +++ b/Lang/ANSI-BASIC/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Egyptian-division b/Lang/ANSI-BASIC/Egyptian-division new file mode 120000 index 0000000000..6f37fbca47 --- /dev/null +++ b/Lang/ANSI-BASIC/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Equilibrium-index b/Lang/ANSI-BASIC/Equilibrium-index new file mode 120000 index 0000000000..4273670f14 --- /dev/null +++ b/Lang/ANSI-BASIC/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Ethiopian-multiplication b/Lang/ANSI-BASIC/Ethiopian-multiplication new file mode 120000 index 0000000000..0687e83f8a --- /dev/null +++ b/Lang/ANSI-BASIC/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Factors-of-an-integer b/Lang/ANSI-BASIC/Factors-of-an-integer new file mode 120000 index 0000000000..187d81b94b --- /dev/null +++ b/Lang/ANSI-BASIC/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Fibonacci-sequence b/Lang/ANSI-BASIC/Fibonacci-sequence new file mode 120000 index 0000000000..7c7a1193ff --- /dev/null +++ b/Lang/ANSI-BASIC/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Formatted-numeric-output b/Lang/ANSI-BASIC/Formatted-numeric-output new file mode 120000 index 0000000000..e876b7e939 --- /dev/null +++ b/Lang/ANSI-BASIC/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Function-definition b/Lang/ANSI-BASIC/Function-definition new file mode 120000 index 0000000000..c45352eba7 --- /dev/null +++ b/Lang/ANSI-BASIC/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Generate-lower-case-ASCII-alphabet b/Lang/ANSI-BASIC/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..26bc617302 --- /dev/null +++ b/Lang/ANSI-BASIC/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Horners-rule-for-polynomial-evaluation b/Lang/ANSI-BASIC/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..4c6423e8e1 --- /dev/null +++ b/Lang/ANSI-BASIC/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Langtons-ant b/Lang/ANSI-BASIC/Langtons-ant new file mode 120000 index 0000000000..c0944407d4 --- /dev/null +++ b/Lang/ANSI-BASIC/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Leap-year b/Lang/ANSI-BASIC/Leap-year new file mode 120000 index 0000000000..d8f2cec2bd --- /dev/null +++ b/Lang/ANSI-BASIC/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Leonardo-numbers b/Lang/ANSI-BASIC/Leonardo-numbers new file mode 120000 index 0000000000..eeb51e71aa --- /dev/null +++ b/Lang/ANSI-BASIC/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Levenshtein-distance b/Lang/ANSI-BASIC/Levenshtein-distance new file mode 120000 index 0000000000..92b553d536 --- /dev/null +++ b/Lang/ANSI-BASIC/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Long-year b/Lang/ANSI-BASIC/Long-year new file mode 120000 index 0000000000..ca5898e1c7 --- /dev/null +++ b/Lang/ANSI-BASIC/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Loops-Do-while b/Lang/ANSI-BASIC/Loops-Do-while new file mode 120000 index 0000000000..998c0b9f8a --- /dev/null +++ b/Lang/ANSI-BASIC/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Luhn-test-of-credit-card-numbers b/Lang/ANSI-BASIC/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..5e8c5fe6dd --- /dev/null +++ b/Lang/ANSI-BASIC/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/M-bius-function b/Lang/ANSI-BASIC/M-bius-function new file mode 120000 index 0000000000..f786d2b99e --- /dev/null +++ b/Lang/ANSI-BASIC/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Magic-constant b/Lang/ANSI-BASIC/Magic-constant new file mode 120000 index 0000000000..7d2184182c --- /dev/null +++ b/Lang/ANSI-BASIC/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Map-range b/Lang/ANSI-BASIC/Map-range new file mode 120000 index 0000000000..829dfc3a26 --- /dev/null +++ b/Lang/ANSI-BASIC/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Mayan-numerals b/Lang/ANSI-BASIC/Mayan-numerals new file mode 120000 index 0000000000..daef520f79 --- /dev/null +++ b/Lang/ANSI-BASIC/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Monty-Hall-problem b/Lang/ANSI-BASIC/Monty-Hall-problem new file mode 120000 index 0000000000..8f9a29cbcc --- /dev/null +++ b/Lang/ANSI-BASIC/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Nth-root b/Lang/ANSI-BASIC/Nth-root new file mode 120000 index 0000000000..089f4d872e --- /dev/null +++ b/Lang/ANSI-BASIC/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Old-Russian-measure-of-length b/Lang/ANSI-BASIC/Old-Russian-measure-of-length new file mode 120000 index 0000000000..81f64cd54c --- /dev/null +++ b/Lang/ANSI-BASIC/Old-Russian-measure-of-length @@ -0,0 +1 @@ +../../Task/Old-Russian-measure-of-length/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Periodic-table b/Lang/ANSI-BASIC/Periodic-table new file mode 120000 index 0000000000..b9e95e6595 --- /dev/null +++ b/Lang/ANSI-BASIC/Periodic-table @@ -0,0 +1 @@ +../../Task/Periodic-table/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Random-numbers b/Lang/ANSI-BASIC/Random-numbers new file mode 120000 index 0000000000..1de5221db0 --- /dev/null +++ b/Lang/ANSI-BASIC/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Real-constants-and-functions b/Lang/ANSI-BASIC/Real-constants-and-functions new file mode 120000 index 0000000000..02cced5726 --- /dev/null +++ b/Lang/ANSI-BASIC/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Repeat-a-string b/Lang/ANSI-BASIC/Repeat-a-string new file mode 120000 index 0000000000..018a40d1b5 --- /dev/null +++ b/Lang/ANSI-BASIC/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Rot-13 b/Lang/ANSI-BASIC/Rot-13 new file mode 120000 index 0000000000..6dadbcd391 --- /dev/null +++ b/Lang/ANSI-BASIC/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Semiprime b/Lang/ANSI-BASIC/Semiprime new file mode 120000 index 0000000000..e0427579b2 --- /dev/null +++ b/Lang/ANSI-BASIC/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Shoelace-formula-for-polygonal-area b/Lang/ANSI-BASIC/Shoelace-formula-for-polygonal-area new file mode 120000 index 0000000000..63de3b564e --- /dev/null +++ b/Lang/ANSI-BASIC/Shoelace-formula-for-polygonal-area @@ -0,0 +1 @@ +../../Task/Shoelace-formula-for-polygonal-area/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Sorting-algorithms-Quicksort b/Lang/ANSI-BASIC/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..acf4c89afe --- /dev/null +++ b/Lang/ANSI-BASIC/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Square-free-integers b/Lang/ANSI-BASIC/Square-free-integers new file mode 120000 index 0000000000..90f8c4cba3 --- /dev/null +++ b/Lang/ANSI-BASIC/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Statistics-Basic b/Lang/ANSI-BASIC/Statistics-Basic new file mode 120000 index 0000000000..11c8fbb1d2 --- /dev/null +++ b/Lang/ANSI-BASIC/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Statistics-Normal-distribution b/Lang/ANSI-BASIC/Statistics-Normal-distribution new file mode 120000 index 0000000000..674b0ba86f --- /dev/null +++ b/Lang/ANSI-BASIC/Statistics-Normal-distribution @@ -0,0 +1 @@ +../../Task/Statistics-Normal-distribution/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/String-length b/Lang/ANSI-BASIC/String-length new file mode 120000 index 0000000000..7ad71b1ccb --- /dev/null +++ b/Lang/ANSI-BASIC/String-length @@ -0,0 +1 @@ +../../Task/String-length/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Tau-number b/Lang/ANSI-BASIC/Tau-number new file mode 120000 index 0000000000..bfebf263eb --- /dev/null +++ b/Lang/ANSI-BASIC/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/ANSI-BASIC \ No newline at end of file diff --git a/Lang/ANSI-BASIC/Temperature-conversion b/Lang/ANSI-BASIC/Temperature-conversion new file mode 120000 index 0000000000..af167d778a --- /dev/null +++ b/Lang/ANSI-BASIC/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/ANSI-BASIC \ No newline at end of file diff --git a/Lang/APL/ADFGVX-cipher b/Lang/APL/ADFGVX-cipher new file mode 120000 index 0000000000..ab764adced --- /dev/null +++ b/Lang/APL/ADFGVX-cipher @@ -0,0 +1 @@ +../../Task/ADFGVX-cipher/APL \ No newline at end of file diff --git a/Lang/APL/Abelian-sandpile-model b/Lang/APL/Abelian-sandpile-model new file mode 120000 index 0000000000..346a055fbc --- /dev/null +++ b/Lang/APL/Abelian-sandpile-model @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model/APL \ No newline at end of file diff --git a/Lang/APL/Align-columns b/Lang/APL/Align-columns new file mode 120000 index 0000000000..b966dedf04 --- /dev/null +++ b/Lang/APL/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/APL \ No newline at end of file diff --git a/Lang/APL/Arithmetic-derivative b/Lang/APL/Arithmetic-derivative new file mode 120000 index 0000000000..c5dd2fd89b --- /dev/null +++ b/Lang/APL/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/APL \ No newline at end of file diff --git a/Lang/APL/Benfords-law b/Lang/APL/Benfords-law new file mode 120000 index 0000000000..e194573832 --- /dev/null +++ b/Lang/APL/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/APL \ No newline at end of file diff --git a/Lang/APL/Bioinformatics-base-count b/Lang/APL/Bioinformatics-base-count deleted file mode 120000 index f9e2de8949..0000000000 --- a/Lang/APL/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/APL \ No newline at end of file diff --git a/Lang/APL/Chinese-zodiac b/Lang/APL/Chinese-zodiac new file mode 120000 index 0000000000..34bffed454 --- /dev/null +++ b/Lang/APL/Chinese-zodiac @@ -0,0 +1 @@ +../../Task/Chinese-zodiac/APL \ No newline at end of file diff --git a/Lang/APL/Combinations b/Lang/APL/Combinations new file mode 120000 index 0000000000..b1574b8996 --- /dev/null +++ b/Lang/APL/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/APL \ No newline at end of file diff --git a/Lang/APL/Display-a-linear-combination b/Lang/APL/Display-a-linear-combination new file mode 120000 index 0000000000..0e1867473a --- /dev/null +++ b/Lang/APL/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/APL \ No newline at end of file diff --git a/Lang/APL/Floyds-triangle b/Lang/APL/Floyds-triangle new file mode 120000 index 0000000000..ba13d02d17 --- /dev/null +++ b/Lang/APL/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/APL \ No newline at end of file diff --git a/Lang/APL/Longest-common-substring b/Lang/APL/Longest-common-substring new file mode 120000 index 0000000000..dd75194fe4 --- /dev/null +++ b/Lang/APL/Longest-common-substring @@ -0,0 +1 @@ +../../Task/Longest-common-substring/APL \ No newline at end of file diff --git a/Lang/APL/Loops-Infinite b/Lang/APL/Loops-Infinite new file mode 120000 index 0000000000..0f3ec957d2 --- /dev/null +++ b/Lang/APL/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/APL \ No newline at end of file diff --git a/Lang/APL/Monte-Carlo-methods b/Lang/APL/Monte-Carlo-methods new file mode 120000 index 0000000000..2cf831a11c --- /dev/null +++ b/Lang/APL/Monte-Carlo-methods @@ -0,0 +1 @@ +../../Task/Monte-Carlo-methods/APL \ No newline at end of file diff --git a/Lang/APL/Move-to-front-algorithm b/Lang/APL/Move-to-front-algorithm new file mode 120000 index 0000000000..bce8e1d67b --- /dev/null +++ b/Lang/APL/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/APL \ No newline at end of file diff --git a/Lang/APL/Partition-an-integer-x-into-n-primes b/Lang/APL/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..6a32dc9f66 --- /dev/null +++ b/Lang/APL/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/APL \ No newline at end of file diff --git a/Lang/APL/Pisano-period b/Lang/APL/Pisano-period new file mode 120000 index 0000000000..d81ff37307 --- /dev/null +++ b/Lang/APL/Pisano-period @@ -0,0 +1 @@ +../../Task/Pisano-period/APL \ No newline at end of file diff --git a/Lang/APL/Set-consolidation b/Lang/APL/Set-consolidation new file mode 120000 index 0000000000..56b2446a2d --- /dev/null +++ b/Lang/APL/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/APL \ No newline at end of file diff --git a/Lang/APL/Sort-a-list-of-object-identifiers b/Lang/APL/Sort-a-list-of-object-identifiers new file mode 120000 index 0000000000..400cb9fc60 --- /dev/null +++ b/Lang/APL/Sort-a-list-of-object-identifiers @@ -0,0 +1 @@ +../../Task/Sort-a-list-of-object-identifiers/APL \ No newline at end of file diff --git a/Lang/APL/Strip-comments-from-a-string b/Lang/APL/Strip-comments-from-a-string new file mode 120000 index 0000000000..ff78e120aa --- /dev/null +++ b/Lang/APL/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/APL \ No newline at end of file diff --git a/Lang/APL/The-Twelve-Days-of-Christmas b/Lang/APL/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..2bb4434d11 --- /dev/null +++ b/Lang/APL/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/APL \ No newline at end of file diff --git a/Lang/APL/Tic-tac-toe b/Lang/APL/Tic-tac-toe new file mode 120000 index 0000000000..58bb681d1c --- /dev/null +++ b/Lang/APL/Tic-tac-toe @@ -0,0 +1 @@ +../../Task/Tic-tac-toe/APL \ No newline at end of file diff --git a/Lang/APL/Word-ladder b/Lang/APL/Word-ladder new file mode 120000 index 0000000000..6de9f38d51 --- /dev/null +++ b/Lang/APL/Word-ladder @@ -0,0 +1 @@ +../../Task/Word-ladder/APL \ No newline at end of file diff --git a/Lang/APL/Zeckendorf-number-representation b/Lang/APL/Zeckendorf-number-representation new file mode 120000 index 0000000000..e25cdfa21a --- /dev/null +++ b/Lang/APL/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/APL \ No newline at end of file diff --git a/Lang/ARM-Assembly/00-LANG.txt b/Lang/ARM-Assembly/00-LANG.txt index 4c41d124d7..273ed5e757 100644 --- a/Lang/ARM-Assembly/00-LANG.txt +++ b/Lang/ARM-Assembly/00-LANG.txt @@ -4,9 +4,9 @@ The ARM architecture is widely used on mobile phones and tablets. It falls under ===Instruction Size=== Every instruction that the ARM can execute is 32 bits. While other processors can have variable length instructions, the ARM does not. This means that the ARM doesn't need to parse where an instruction begins and ends, which makes it run very fast. What you might not expect is that this 32-bit instruction size includes both the actual instruction and the operands! Let's take a look at a [[Z80 Assembly]] instruction and compare it to an ARM instruction. -LD HL,&8040 ;bytecode is 0x21 0x40 0x80 +LD HL,&8040 ;bytecode is 0x21 0x40 0x80 -mov r4,#0x04000000 ;bytecode is 0xE3A04301 +mov r4,#0x04000000 ;bytecode is 0xE3A04301 So where did the 0x04000000 go? It's actually been compressed and fit within those 4 bytes you saw earlier. The ARM is very good at decompressing it, since it's been shrunk to an 8-bit number that can be rotated by an even number of bits. Unfortunately, this compression method is a double-edged sword - some 32-bit numbers can't be compressed this way, and thus many instructions can't work with them! @@ -18,72 +18,73 @@ Registers are much more flexible than immediate operands. Unlike immediate opera Getting an address in a register can be achieved with the MOV command, but there are limitations to that which will be explained in detail later. It's more reliable to use ADR which loads a nearby address into a register. This address has to be within a certain distance from the current program counter or it can't be loaded, so it's not a reliable way to load from the heap on many machines. It's mostly intended for loading from nearby read-only data, such as text strings or stored immediates (more on that later). When you type ADR R0,LABEL, the assembler will convert this to MOV R0,PC,#N, where N is the difference between the current program counter value and the label you specified. LDR can be used in a similar fashion to ADR but there is a subtle distinction between the two. Assume that the section below is assembled starting at memory address 0x04000000: -DataBlock: +DataBlock: .long 0xDEADBEEF ;VASM uses .long for 32-bit data and .word for 16-bit data. Your assembler will probably use .word for 32 bit and .long 0xFFFFFFFF ; .hword for 16-bit. MyCode: adr r0, DataBlock ;loads the value 0x04000000 into R0 - ldr r1, DataBlock ;loads the value 0xDEADBEEF into R1 - adr r2, DataBlock+4 ;loads the value 0x04000004 into R2 - -ldr r3, DataBlock+4 ;loads the value 0xFFFFFFFF into R3 +ldr r3, DataBlock+4 ;loads the value 0xFFFFFFFF into R3 + As you can see, ADR only gives you the memory location of a value in memory, where LDR loads ''from'' that memory location. - ===Data Addressing using LDR and STR=== Unlike its "cousin," the Motorola 68000 (which isn't really related but has a somewhat similar design), the ARM cannot directly write immediate values to memory. Those values must be contained in registers first. Unlike the 68000, the ARM has no "address registers." Rather, enclosing a register name in square brackets turns its value into a reference to a memory location. You'll need to load that memory location's numeric "value" as a constant first. Then you can read from it with LDR and write to it with STR. Not only can you read from a given address, you can also adjust how you read from it, and what you do before or after the read. -RAM_ADDRESS: +RAM_ADDRESS: .long 0 ;for simplicity we'll assume that this can actually be written to. Represents a placeholder for 32-bit data. ;Your assembler's syntax may be different. - .long 0 ;another placeholder for 32-bit data MyCode: adr R2,RAM_Address ;get the address of a nearby place to store values. MOV R0,#0x12345678 ;the value to store. -STR R0,[R2] ;store 0x12345678 into the first 32-bit slot. +STR R0,[R2] ;store 0x12345678 into the first 32-bit slot. + This is the basic way to store into memory, but there are other options, such as offsetting and post-increment. -RAM_ADDRESS: +RAM_ADDRESS: .long 0 .long 0 ;we'll store here this time. MyCode: adr R2,RAM_Address ;point R2 to the first storage slot MOV R0,#0x12345678 -STR R0,[R2,#4] ;store into the SECOND slot. R2 still points to the first slot - the #4 is added to R2 only temporarily. +STR R0,[R2,#4] ;store into the SECOND slot. R2 still points to the first slot - the #4 is added to R2 only temporarily. + There's a limit on the size of an immediate value used to offset when loading/storing. You can also use a register as an offset, whose value will be added to the address. -RAM_AREA: +RAM_AREA: .space 64,0 ;64 bytes of ram ;assume that R2 contains the address of "RAM_AREA" MyCode: MOV R0,#0x12345678 MOV R1,#20 -STR R0,[R2,R1] ;equivalent of "STR R0,[R2,#20]" +STR R0,[R2,R1] ;equivalent of "STR R0,[R2,#20]" + Now let's say you wanted to actually alter the pointer to R2, so that it remains pointing to where you offset it to after the store or load. That's an option you have - all you have to do is type "!" after the brackets. This is called "pre-increment" or "pre-indexing." -RAM_ADDRESS: +RAM_ADDRESS: .long 0 .long 0 ;we'll store here this time, and we want R2 to still be pointing here after we write to it. MyCode: adr R2,RAM_Address ;point R2 to the first storage slot MOV R0,#0x12345678 -STR R0,[R2,#4]! ;store into the SECOND slot. R2 also points to the second slot now, even after this instruction has concluded. +STR R0,[R2,#4]! ;store into the SECOND slot. R2 also points to the second slot now, even after this instruction has concluded. + Here, the offset is performed ''before'' the storage operation. What if you want to offset afterwards? That would be useful for reading in a data stream. Good news - you can do that simply by having the offset value or register '''outside''' the brackets. This is called "post-increment" or "post-indexing." Unlike pre-indexing, these changes to the pointer are not temporary. -LDR R0,[R1],#4 ;load the 32-bit value stored at memory location R1 into R0, THEN add 4 to R1. This offset remains even after this - ; instruction is finished. +LDR R0,[R1],#4 ;load the 32-bit value stored at memory location R1 into R0, THEN add 4 to R1. This offset remains even after this + ; instruction is finished. + ===Barrel Shifter=== The ARM can add a bit shift or rotate to one of its operands at no additional cost to execution time or bytecode. If the operand being shifted is a register, the value of that register is not actually changed. The shift or rotate only applies during that instruction. diff --git a/Lang/ARM-Assembly/Bifid-cipher b/Lang/ARM-Assembly/Bifid-cipher new file mode 120000 index 0000000000..456e328d85 --- /dev/null +++ b/Lang/ARM-Assembly/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Binary-strings b/Lang/ARM-Assembly/Binary-strings new file mode 120000 index 0000000000..a7b6ed7647 --- /dev/null +++ b/Lang/ARM-Assembly/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Bioinformatics-base-count b/Lang/ARM-Assembly/Bioinformatics-base-count deleted file mode 120000 index baff8c16a9..0000000000 --- a/Lang/ARM-Assembly/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Comma-quibbling b/Lang/ARM-Assembly/Comma-quibbling new file mode 120000 index 0000000000..3d3d7812f0 --- /dev/null +++ b/Lang/ARM-Assembly/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Create-an-HTML-table b/Lang/ARM-Assembly/Create-an-HTML-table new file mode 120000 index 0000000000..72c300d67a --- /dev/null +++ b/Lang/ARM-Assembly/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Determine-sentence-type b/Lang/ARM-Assembly/Determine-sentence-type new file mode 120000 index 0000000000..5e77711ab2 --- /dev/null +++ b/Lang/ARM-Assembly/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Environment-variables b/Lang/ARM-Assembly/Environment-variables new file mode 120000 index 0000000000..11f3baa342 --- /dev/null +++ b/Lang/ARM-Assembly/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Fibonacci-n-step-number-sequences b/Lang/ARM-Assembly/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..6e51a1f11e --- /dev/null +++ b/Lang/ARM-Assembly/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Guess-the-number b/Lang/ARM-Assembly/Guess-the-number new file mode 120000 index 0000000000..f4c41a9cec --- /dev/null +++ b/Lang/ARM-Assembly/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Halt-and-catch-fire b/Lang/ARM-Assembly/Halt-and-catch-fire new file mode 120000 index 0000000000..56faf31b66 --- /dev/null +++ b/Lang/ARM-Assembly/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Hash-from-two-arrays b/Lang/ARM-Assembly/Hash-from-two-arrays new file mode 120000 index 0000000000..2a1c9147a6 --- /dev/null +++ b/Lang/ARM-Assembly/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/ARM-Assembly/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..dc21bae989 --- /dev/null +++ b/Lang/ARM-Assembly/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Leonardo-numbers b/Lang/ARM-Assembly/Leonardo-numbers new file mode 120000 index 0000000000..6639dbc2f4 --- /dev/null +++ b/Lang/ARM-Assembly/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Machine-code b/Lang/ARM-Assembly/Machine-code new file mode 120000 index 0000000000..e48d9e81b2 --- /dev/null +++ b/Lang/ARM-Assembly/Machine-code @@ -0,0 +1 @@ +../../Task/Machine-code/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Menu b/Lang/ARM-Assembly/Menu new file mode 120000 index 0000000000..73a332d6f3 --- /dev/null +++ b/Lang/ARM-Assembly/Menu @@ -0,0 +1 @@ +../../Task/Menu/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Miller-Rabin-primality-test b/Lang/ARM-Assembly/Miller-Rabin-primality-test deleted file mode 120000 index 195623d60d..0000000000 --- a/Lang/ARM-Assembly/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Pancake-numbers b/Lang/ARM-Assembly/Pancake-numbers new file mode 120000 index 0000000000..7bcfc9ff51 --- /dev/null +++ b/Lang/ARM-Assembly/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Phrase-reversals b/Lang/ARM-Assembly/Phrase-reversals new file mode 120000 index 0000000000..011ca34c42 --- /dev/null +++ b/Lang/ARM-Assembly/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Pi b/Lang/ARM-Assembly/Pi new file mode 120000 index 0000000000..97b44cbcc1 --- /dev/null +++ b/Lang/ARM-Assembly/Pi @@ -0,0 +1 @@ +../../Task/Pi/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Read-a-configuration-file b/Lang/ARM-Assembly/Read-a-configuration-file new file mode 120000 index 0000000000..76094b38c7 --- /dev/null +++ b/Lang/ARM-Assembly/Read-a-configuration-file @@ -0,0 +1 @@ +../../Task/Read-a-configuration-file/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Repeat-a-string b/Lang/ARM-Assembly/Repeat-a-string new file mode 120000 index 0000000000..69591f65b7 --- /dev/null +++ b/Lang/ARM-Assembly/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Reverse-words-in-a-string b/Lang/ARM-Assembly/Reverse-words-in-a-string new file mode 120000 index 0000000000..10d177c9f9 --- /dev/null +++ b/Lang/ARM-Assembly/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Sorting-Algorithms-Circle-Sort b/Lang/ARM-Assembly/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 21eb603d7e..0000000000 --- a/Lang/ARM-Assembly/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/String-prepend b/Lang/ARM-Assembly/String-prepend new file mode 120000 index 0000000000..ab543c682f --- /dev/null +++ b/Lang/ARM-Assembly/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Strip-block-comments b/Lang/ARM-Assembly/Strip-block-comments new file mode 120000 index 0000000000..6a5702298a --- /dev/null +++ b/Lang/ARM-Assembly/Strip-block-comments @@ -0,0 +1 @@ +../../Task/Strip-block-comments/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Strip-comments-from-a-string b/Lang/ARM-Assembly/Strip-comments-from-a-string new file mode 120000 index 0000000000..b01acc2585 --- /dev/null +++ b/Lang/ARM-Assembly/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Strip-whitespace-from-a-string-Top-and-tail b/Lang/ARM-Assembly/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..ba0f5a585c --- /dev/null +++ b/Lang/ARM-Assembly/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Update-a-configuration-file b/Lang/ARM-Assembly/Update-a-configuration-file new file mode 120000 index 0000000000..9dd67115c0 --- /dev/null +++ b/Lang/ARM-Assembly/Update-a-configuration-file @@ -0,0 +1 @@ +../../Task/Update-a-configuration-file/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Vigen-re-cipher b/Lang/ARM-Assembly/Vigen-re-cipher new file mode 120000 index 0000000000..caeb031a4b --- /dev/null +++ b/Lang/ARM-Assembly/Vigen-re-cipher @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Vigen-re-cipher-Cryptanalysis b/Lang/ARM-Assembly/Vigen-re-cipher-Cryptanalysis new file mode 120000 index 0000000000..ecfd7ae59c --- /dev/null +++ b/Lang/ARM-Assembly/Vigen-re-cipher-Cryptanalysis @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher-Cryptanalysis/ARM-Assembly \ No newline at end of file diff --git a/Lang/ARM-Assembly/Visualize-a-tree b/Lang/ARM-Assembly/Visualize-a-tree new file mode 120000 index 0000000000..58626c23da --- /dev/null +++ b/Lang/ARM-Assembly/Visualize-a-tree @@ -0,0 +1 @@ +../../Task/Visualize-a-tree/ARM-Assembly \ No newline at end of file diff --git a/Lang/ASIC/Dragon-curve b/Lang/ASIC/Dragon-curve new file mode 120000 index 0000000000..7538c55bbc --- /dev/null +++ b/Lang/ASIC/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/ASIC \ No newline at end of file diff --git a/Lang/ASIC/Generate-lower-case-ASCII-alphabet b/Lang/ASIC/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..af19876ed5 --- /dev/null +++ b/Lang/ASIC/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/ASIC \ No newline at end of file diff --git a/Lang/ASIC/Luhn-test-of-credit-card-numbers b/Lang/ASIC/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..30c2c72edb --- /dev/null +++ b/Lang/ASIC/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/ASIC \ No newline at end of file diff --git a/Lang/ASIC/M-bius-function b/Lang/ASIC/M-bius-function new file mode 120000 index 0000000000..7848f34d54 --- /dev/null +++ b/Lang/ASIC/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/ASIC \ No newline at end of file diff --git a/Lang/ASIC/Old-Russian-measure-of-length b/Lang/ASIC/Old-Russian-measure-of-length new file mode 120000 index 0000000000..e5e809a47d --- /dev/null +++ b/Lang/ASIC/Old-Russian-measure-of-length @@ -0,0 +1 @@ +../../Task/Old-Russian-measure-of-length/ASIC \ No newline at end of file diff --git a/Lang/ASIC/Temperature-conversion b/Lang/ASIC/Temperature-conversion new file mode 120000 index 0000000000..312278bfcd --- /dev/null +++ b/Lang/ASIC/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/ASIC \ No newline at end of file diff --git a/Lang/ATS/Quaternion-type b/Lang/ATS/Quaternion-type deleted file mode 120000 index 95bd8641ec..0000000000 --- a/Lang/ATS/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/ATS \ No newline at end of file diff --git a/Lang/AWK/00-LANG.txt b/Lang/AWK/00-LANG.txt index 8c5a32efdd..4d384747d7 100644 --- a/Lang/AWK/00-LANG.txt +++ b/Lang/AWK/00-LANG.txt @@ -8,13 +8,13 @@ Each AWK program consists of pattern-action statements. The program reads each input line, checks lines against patterns, and runs matching actions. For programs that never read input lines, the entire program can be one BEGIN { ... } block. -* ''List users who have /bin/ksh as a shell.''$ awk -F: '$7 == "/bin/ksh" { print $1 }' /etc/passwd +* ''List users who have /bin/ksh as a shell.''$ awk -F: '$7 == "/bin/ksh" { print $1 }' /etc/passwd AWK has only three types of variables: they are strings, floating-point numbers, and associative arrays (where every array index is a string). Conversion between strings and numbers is automatic. AWK also has regular expressions, which appear in many AWK programs. There are a few built-in functions, like cos() and sprintf(). -* ''Find average line length.''$ awk '{ cnt += length($0) } END { print cnt / NR }' /etc/rc +* ''Find average line length.''$ awk '{ cnt += length($0) } END { print cnt / NR }' /etc/rc The name "AWK" comes from the initials of Alfred Aho, Peter Weinberger and Brian Kernighan: they invented AWK during the 1970s. A few decades later, Kernighan continues to maintain the [[nawk|reference implementation]] of AWK. diff --git a/Lang/AWK/100-doors b/Lang/AWK/100-doors deleted file mode 120000 index 99c9a19f16..0000000000 --- a/Lang/AWK/100-doors +++ /dev/null @@ -1 +0,0 @@ -../../Task/100-doors/AWK \ No newline at end of file diff --git a/Lang/AWK/Arithmetic-derivative b/Lang/AWK/Arithmetic-derivative new file mode 120000 index 0000000000..5f269aa501 --- /dev/null +++ b/Lang/AWK/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/AWK \ No newline at end of file diff --git a/Lang/AWK/Bell-numbers b/Lang/AWK/Bell-numbers new file mode 120000 index 0000000000..ba62e9e87d --- /dev/null +++ b/Lang/AWK/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/AWK \ No newline at end of file diff --git a/Lang/AWK/Bioinformatics-base-count b/Lang/AWK/Bioinformatics-base-count deleted file mode 120000 index 0d26eb27e1..0000000000 --- a/Lang/AWK/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/AWK \ No newline at end of file diff --git a/Lang/AWK/Blum-integer b/Lang/AWK/Blum-integer new file mode 120000 index 0000000000..3a37b18d0c --- /dev/null +++ b/Lang/AWK/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/AWK \ No newline at end of file diff --git a/Lang/AWK/Brilliant-numbers b/Lang/AWK/Brilliant-numbers new file mode 120000 index 0000000000..75aada11ac --- /dev/null +++ b/Lang/AWK/Brilliant-numbers @@ -0,0 +1 @@ +../../Task/Brilliant-numbers/AWK \ No newline at end of file diff --git a/Lang/AWK/Cuban-primes b/Lang/AWK/Cuban-primes new file mode 120000 index 0000000000..e24a72c78b --- /dev/null +++ b/Lang/AWK/Cuban-primes @@ -0,0 +1 @@ +../../Task/Cuban-primes/AWK \ No newline at end of file diff --git a/Lang/AWK/Deceptive-numbers b/Lang/AWK/Deceptive-numbers new file mode 120000 index 0000000000..8f879c57e0 --- /dev/null +++ b/Lang/AWK/Deceptive-numbers @@ -0,0 +1 @@ +../../Task/Deceptive-numbers/AWK \ No newline at end of file diff --git a/Lang/AWK/Documentation b/Lang/AWK/Documentation new file mode 120000 index 0000000000..203588c43d --- /dev/null +++ b/Lang/AWK/Documentation @@ -0,0 +1 @@ +../../Task/Documentation/AWK \ No newline at end of file diff --git a/Lang/AWK/Egyptian-division b/Lang/AWK/Egyptian-division new file mode 120000 index 0000000000..b3edb7cd3b --- /dev/null +++ b/Lang/AWK/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/AWK \ No newline at end of file diff --git a/Lang/AWK/Equal-prime-and-composite-sums b/Lang/AWK/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..ff748db68b --- /dev/null +++ b/Lang/AWK/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/AWK \ No newline at end of file diff --git a/Lang/AWK/Eulers-constant-0.5772... b/Lang/AWK/Eulers-constant-0.5772... new file mode 120000 index 0000000000..f2365557d6 --- /dev/null +++ b/Lang/AWK/Eulers-constant-0.5772... @@ -0,0 +1 @@ +../../Task/Eulers-constant-0.5772.../AWK \ No newline at end of file diff --git a/Lang/AWK/Factorial-primes b/Lang/AWK/Factorial-primes new file mode 120000 index 0000000000..7344ad75fd --- /dev/null +++ b/Lang/AWK/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/AWK \ No newline at end of file diff --git a/Lang/AWK/Interactive-programming-repl- b/Lang/AWK/Interactive-programming-repl- new file mode 120000 index 0000000000..958761b6b1 --- /dev/null +++ b/Lang/AWK/Interactive-programming-repl- @@ -0,0 +1 @@ +../../Task/Interactive-programming-repl-/AWK \ No newline at end of file diff --git a/Lang/AWK/Isqrt-integer-square-root-of-X b/Lang/AWK/Isqrt-integer-square-root-of-X new file mode 120000 index 0000000000..04e9a1d13c --- /dev/null +++ b/Lang/AWK/Isqrt-integer-square-root-of-X @@ -0,0 +1 @@ +../../Task/Isqrt-integer-square-root-of-X/AWK \ No newline at end of file diff --git a/Lang/AWK/MAC-vendor-lookup b/Lang/AWK/MAC-vendor-lookup new file mode 120000 index 0000000000..3bffc2dd1c --- /dev/null +++ b/Lang/AWK/MAC-vendor-lookup @@ -0,0 +1 @@ +../../Task/MAC-vendor-lookup/AWK \ No newline at end of file diff --git a/Lang/AWK/Own-digits-power-sum b/Lang/AWK/Own-digits-power-sum new file mode 120000 index 0000000000..f78f510ce9 --- /dev/null +++ b/Lang/AWK/Own-digits-power-sum @@ -0,0 +1 @@ +../../Task/Own-digits-power-sum/AWK \ No newline at end of file diff --git a/Lang/AWK/Padovan-n-step-number-sequences b/Lang/AWK/Padovan-n-step-number-sequences new file mode 120000 index 0000000000..6bc3dbde1f --- /dev/null +++ b/Lang/AWK/Padovan-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Padovan-n-step-number-sequences/AWK \ No newline at end of file diff --git a/Lang/AWK/Pierpont-primes b/Lang/AWK/Pierpont-primes new file mode 120000 index 0000000000..f41d86837f --- /dev/null +++ b/Lang/AWK/Pierpont-primes @@ -0,0 +1 @@ +../../Task/Pierpont-primes/AWK \ No newline at end of file diff --git a/Lang/AWK/Scope-modifiers b/Lang/AWK/Scope-modifiers new file mode 120000 index 0000000000..635bec03ae --- /dev/null +++ b/Lang/AWK/Scope-modifiers @@ -0,0 +1 @@ +../../Task/Scope-modifiers/AWK \ No newline at end of file diff --git a/Lang/AWK/Search-a-list-of-records b/Lang/AWK/Search-a-list-of-records new file mode 120000 index 0000000000..6172b78f81 --- /dev/null +++ b/Lang/AWK/Search-a-list-of-records @@ -0,0 +1 @@ +../../Task/Search-a-list-of-records/AWK \ No newline at end of file diff --git a/Lang/AWK/Selectively-replace-multiple-instances-of-a-character-within-a-string b/Lang/AWK/Selectively-replace-multiple-instances-of-a-character-within-a-string new file mode 120000 index 0000000000..248fe6e3f2 --- /dev/null +++ b/Lang/AWK/Selectively-replace-multiple-instances-of-a-character-within-a-string @@ -0,0 +1 @@ +../../Task/Selectively-replace-multiple-instances-of-a-character-within-a-string/AWK \ No newline at end of file diff --git a/Lang/AWK/Sequence-of-primorial-primes b/Lang/AWK/Sequence-of-primorial-primes new file mode 120000 index 0000000000..0448804b7b --- /dev/null +++ b/Lang/AWK/Sequence-of-primorial-primes @@ -0,0 +1 @@ +../../Task/Sequence-of-primorial-primes/AWK \ No newline at end of file diff --git a/Lang/AWK/Soloways-recurring-rainfall b/Lang/AWK/Soloways-recurring-rainfall new file mode 120000 index 0000000000..1f850c19b0 --- /dev/null +++ b/Lang/AWK/Soloways-recurring-rainfall @@ -0,0 +1 @@ +../../Task/Soloways-recurring-rainfall/AWK \ No newline at end of file diff --git a/Lang/AWK/Textonyms b/Lang/AWK/Textonyms new file mode 120000 index 0000000000..0d5f8babd1 --- /dev/null +++ b/Lang/AWK/Textonyms @@ -0,0 +1 @@ +../../Task/Textonyms/AWK \ No newline at end of file diff --git a/Lang/AWK/Time-a-function b/Lang/AWK/Time-a-function new file mode 120000 index 0000000000..d78f55d9f9 --- /dev/null +++ b/Lang/AWK/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/AWK \ No newline at end of file diff --git a/Lang/AWK/Vampire-number b/Lang/AWK/Vampire-number new file mode 120000 index 0000000000..3b7709e53a --- /dev/null +++ b/Lang/AWK/Vampire-number @@ -0,0 +1 @@ +../../Task/Vampire-number/AWK \ No newline at end of file diff --git a/Lang/AWK/Wagstaff-primes b/Lang/AWK/Wagstaff-primes new file mode 120000 index 0000000000..955871e83e --- /dev/null +++ b/Lang/AWK/Wagstaff-primes @@ -0,0 +1 @@ +../../Task/Wagstaff-primes/AWK \ No newline at end of file diff --git a/Lang/AWK/Wilson-primes-of-order-n b/Lang/AWK/Wilson-primes-of-order-n new file mode 120000 index 0000000000..840b045a17 --- /dev/null +++ b/Lang/AWK/Wilson-primes-of-order-n @@ -0,0 +1 @@ +../../Task/Wilson-primes-of-order-n/AWK \ No newline at end of file diff --git a/Lang/Acornsoft-Lisp/Search-a-list b/Lang/Acornsoft-Lisp/Search-a-list new file mode 120000 index 0000000000..80011d9a5b --- /dev/null +++ b/Lang/Acornsoft-Lisp/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Acornsoft-Lisp \ No newline at end of file diff --git a/Lang/Action-/00-LANG.txt b/Lang/Action-/00-LANG.txt index b37eb47c8f..3811c3c636 100644 --- a/Lang/Action-/00-LANG.txt +++ b/Lang/Action-/00-LANG.txt @@ -4,7 +4,7 @@ }} Action! is a language written by Clinton Parker and published by Optimized Sytems Software (OSS) for the Atari 8-bit line of home computers. It is related to ALGOL and optimized for single-pass compilation to 6502 code. - +A manual for the language is available at https://seriouscomputerist.atariverse.com/media/pdf/manual/OSS%20OS-A+%20-%20Manual%20(1983).pdf ==See Also== * [[wp:Action!_(programming_language)|Action! on Wikipedia]] * [[ALGOL 68]] diff --git a/Lang/Action-/Arithmetic-derivative b/Lang/Action-/Arithmetic-derivative new file mode 120000 index 0000000000..8206b6a192 --- /dev/null +++ b/Lang/Action-/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Action- \ No newline at end of file diff --git a/Lang/Action-/Bioinformatics-base-count b/Lang/Action-/Bioinformatics-base-count deleted file mode 120000 index 2a7e093367..0000000000 --- a/Lang/Action-/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Action- \ No newline at end of file diff --git a/Lang/Action-/Quaternion-type b/Lang/Action-/Quaternion-type deleted file mode 120000 index 0cfb07db30..0000000000 --- a/Lang/Action-/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Action- \ No newline at end of file diff --git a/Lang/Action-/Sorting-Algorithms-Circle-Sort b/Lang/Action-/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index a9db72f0ce..0000000000 --- a/Lang/Action-/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Action- \ No newline at end of file diff --git a/Lang/ActionScript/00-LANG.txt b/Lang/ActionScript/00-LANG.txt index 14a7dc41bf..4fe99ed760 100644 --- a/Lang/ActionScript/00-LANG.txt +++ b/Lang/ActionScript/00-LANG.txt @@ -4,7 +4,8 @@ |strength=strong |safety=safe |checking=static -|LCT=yes}} +|LCT=yes +|tags=actionscript, as}} {{Language programming paradigm|Distributed}} {{Language programming paradigm|Imperative}} diff --git a/Lang/Ada/00-LANG.txt b/Lang/Ada/00-LANG.txt index 85a16e96c0..e9eb8d687d 100644 --- a/Lang/Ada/00-LANG.txt +++ b/Lang/Ada/00-LANG.txt @@ -8,7 +8,7 @@ |strength=strong |safety=safe |LCT=yes -|bnf=http://www.adaic.org/standards/1zrm/html/RM-P.html}}'''Ada''' is a structured, statically typed [[imperative programming|imperative]] computer programming language. Ada was initially standardized by [[ANSI]] in 1983 and by [[ISO]] in 1987. This version of the language is commonly known as [[Ada 83]]. The next version was standardized by ISO in 1995 (ISO/IEC 8652:1995) and is commonly known as [[Ada 95]]. Following that ISO published ISO/IEC 8652:1995/Amd 1:2007 in 2007, which is commonly known as [[Ada 2005]]. Most recently ISO published [http://www.ada-auth.org/standards/12rm/html/RM-TTL.html ISO/IEC 8652:2012(E)], commonly known as [[Ada 2012]]. Formally only the most recent version of the language is known as '''Ada'''. +|bnf=http://www.ada-auth.org/standards/22rm/html/RM-P-1.html}}'''Ada''' is a structured, statically typed [[imperative programming|imperative]] computer programming language. Ada was initially standardized by [[ANSI]] in 1983 and by [[ISO]] in 1987. This version of the language is commonly known as [[Ada 83]]. The next version was standardized by ISO in 1995 (ISO/IEC 8652:1995) and is commonly known as [[Ada 95]]. Following that ISO published ISO/IEC 8652:1995/Amd 1:2007 in 2007, which is commonly known as [[Ada 2005]]. Afterwards they published ISO/IEC 8652:2012(E), also known as [[Ada 2012]]. Most recently ISO published [http://www.ada-auth.org/standards/22rm/html/RM-TTL.html ISO/IEC 8652:2023], commonly known as [[Ada 2022]]. Formally only the most recent version of the language is known as '''Ada'''. The language is named after [[wp:Ada_Lovelace|Augusta Ada King, Countess of Lovelace]] thought to be the first ever programmer. Initially it was designed for [http://www.defense.gov U.S. Department of Defense]. The language is used for large and mission-critical systems. See [[wp:Ada_(programming_language)|also]]. ==Grammar== @@ -17,4 +17,6 @@ The language is named after [[wp:Ada_Lovelace|Augusta Ada King, Countess of Love {{Language programming paradigm|Distributed}} {{Language programming paradigm|Generic}} {{Language programming paradigm|Imperative}} -{{Language programming paradigm|Object-oriented}} \ No newline at end of file +{{Language programming paradigm|Object-oriented}} +==Todo== +* [[Tasks not implemented in Ada]] \ No newline at end of file diff --git a/Lang/Ada/24-game-Solve b/Lang/Ada/24-game-Solve new file mode 120000 index 0000000000..245a9225c6 --- /dev/null +++ b/Lang/Ada/24-game-Solve @@ -0,0 +1 @@ +../../Task/24-game-Solve/Ada \ No newline at end of file diff --git a/Lang/Ada/Abelian-sandpile-model b/Lang/Ada/Abelian-sandpile-model new file mode 120000 index 0000000000..adfb5aa625 --- /dev/null +++ b/Lang/Ada/Abelian-sandpile-model @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model/Ada \ No newline at end of file diff --git a/Lang/Ada/Achilles-numbers b/Lang/Ada/Achilles-numbers new file mode 120000 index 0000000000..8a02102d36 --- /dev/null +++ b/Lang/Ada/Achilles-numbers @@ -0,0 +1 @@ +../../Task/Achilles-numbers/Ada \ No newline at end of file diff --git a/Lang/Ada/Almkvist-Giullera-formula-for-pi b/Lang/Ada/Almkvist-Giullera-formula-for-pi new file mode 120000 index 0000000000..66015473cd --- /dev/null +++ b/Lang/Ada/Almkvist-Giullera-formula-for-pi @@ -0,0 +1 @@ +../../Task/Almkvist-Giullera-formula-for-pi/Ada \ No newline at end of file diff --git a/Lang/Ada/Angles-geometric-normalization-and-conversion b/Lang/Ada/Angles-geometric-normalization-and-conversion new file mode 120000 index 0000000000..d4d2487c81 --- /dev/null +++ b/Lang/Ada/Angles-geometric-normalization-and-conversion @@ -0,0 +1 @@ +../../Task/Angles-geometric-normalization-and-conversion/Ada \ No newline at end of file diff --git a/Lang/Ada/Arithmetic-derivative b/Lang/Ada/Arithmetic-derivative new file mode 120000 index 0000000000..87dd4d6940 --- /dev/null +++ b/Lang/Ada/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Ada \ No newline at end of file diff --git a/Lang/Ada/Arithmetic-geometric-mean-Calculate-Pi b/Lang/Ada/Arithmetic-geometric-mean-Calculate-Pi new file mode 120000 index 0000000000..14bdbe4c3d --- /dev/null +++ b/Lang/Ada/Arithmetic-geometric-mean-Calculate-Pi @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean-Calculate-Pi/Ada \ No newline at end of file diff --git a/Lang/Ada/Ascending-primes b/Lang/Ada/Ascending-primes new file mode 120000 index 0000000000..cee2b86585 --- /dev/null +++ b/Lang/Ada/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/Ada \ No newline at end of file diff --git a/Lang/Ada/Babylonian-spiral b/Lang/Ada/Babylonian-spiral new file mode 120000 index 0000000000..fd4ac4c6ad --- /dev/null +++ b/Lang/Ada/Babylonian-spiral @@ -0,0 +1 @@ +../../Task/Babylonian-spiral/Ada \ No newline at end of file diff --git a/Lang/Ada/Bioinformatics-base-count b/Lang/Ada/Bioinformatics-base-count deleted file mode 120000 index 59c9c9dde5..0000000000 --- a/Lang/Ada/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Ada \ No newline at end of file diff --git a/Lang/Ada/Biorhythms b/Lang/Ada/Biorhythms new file mode 120000 index 0000000000..0d82777906 --- /dev/null +++ b/Lang/Ada/Biorhythms @@ -0,0 +1 @@ +../../Task/Biorhythms/Ada \ No newline at end of file diff --git a/Lang/Ada/Blum-integer b/Lang/Ada/Blum-integer new file mode 120000 index 0000000000..48b2715109 --- /dev/null +++ b/Lang/Ada/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/Ada \ No newline at end of file diff --git a/Lang/Ada/Boyer-Moore-string-search b/Lang/Ada/Boyer-Moore-string-search new file mode 120000 index 0000000000..114c2a5fea --- /dev/null +++ b/Lang/Ada/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/Ada \ No newline at end of file diff --git a/Lang/Ada/Brace-expansion b/Lang/Ada/Brace-expansion new file mode 120000 index 0000000000..b881365fa7 --- /dev/null +++ b/Lang/Ada/Brace-expansion @@ -0,0 +1 @@ +../../Task/Brace-expansion/Ada \ No newline at end of file diff --git a/Lang/Ada/Brilliant-numbers b/Lang/Ada/Brilliant-numbers new file mode 120000 index 0000000000..80af4238ae --- /dev/null +++ b/Lang/Ada/Brilliant-numbers @@ -0,0 +1 @@ +../../Task/Brilliant-numbers/Ada \ No newline at end of file diff --git a/Lang/Ada/Calkin-Wilf-sequence b/Lang/Ada/Calkin-Wilf-sequence new file mode 120000 index 0000000000..9e4b8cd779 --- /dev/null +++ b/Lang/Ada/Calkin-Wilf-sequence @@ -0,0 +1 @@ +../../Task/Calkin-Wilf-sequence/Ada \ No newline at end of file diff --git a/Lang/Ada/Camel-case-and-snake-case b/Lang/Ada/Camel-case-and-snake-case new file mode 120000 index 0000000000..1d95b38233 --- /dev/null +++ b/Lang/Ada/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/Ada \ No newline at end of file diff --git a/Lang/Ada/Canonicalize-CIDR b/Lang/Ada/Canonicalize-CIDR new file mode 120000 index 0000000000..c0c0b338b8 --- /dev/null +++ b/Lang/Ada/Canonicalize-CIDR @@ -0,0 +1 @@ +../../Task/Canonicalize-CIDR/Ada \ No newline at end of file diff --git a/Lang/Ada/Chaos-game b/Lang/Ada/Chaos-game new file mode 120000 index 0000000000..456fd72f97 --- /dev/null +++ b/Lang/Ada/Chaos-game @@ -0,0 +1 @@ +../../Task/Chaos-game/Ada \ No newline at end of file diff --git a/Lang/Ada/Cistercian-numerals b/Lang/Ada/Cistercian-numerals new file mode 120000 index 0000000000..a03109c188 --- /dev/null +++ b/Lang/Ada/Cistercian-numerals @@ -0,0 +1 @@ +../../Task/Cistercian-numerals/Ada \ No newline at end of file diff --git a/Lang/Ada/Color-wheel b/Lang/Ada/Color-wheel new file mode 120000 index 0000000000..3d78384078 --- /dev/null +++ b/Lang/Ada/Color-wheel @@ -0,0 +1 @@ +../../Task/Color-wheel/Ada \ No newline at end of file diff --git a/Lang/Ada/Combinations-and-permutations b/Lang/Ada/Combinations-and-permutations new file mode 120000 index 0000000000..3f163f203e --- /dev/null +++ b/Lang/Ada/Combinations-and-permutations @@ -0,0 +1 @@ +../../Task/Combinations-and-permutations/Ada \ No newline at end of file diff --git a/Lang/Ada/Cuban-primes b/Lang/Ada/Cuban-primes new file mode 120000 index 0000000000..a7270c8ac4 --- /dev/null +++ b/Lang/Ada/Cuban-primes @@ -0,0 +1 @@ +../../Task/Cuban-primes/Ada \ No newline at end of file diff --git a/Lang/Ada/Curzon-numbers b/Lang/Ada/Curzon-numbers new file mode 120000 index 0000000000..4a77e1da8a --- /dev/null +++ b/Lang/Ada/Curzon-numbers @@ -0,0 +1 @@ +../../Task/Curzon-numbers/Ada \ No newline at end of file diff --git a/Lang/Ada/Deepcopy b/Lang/Ada/Deepcopy new file mode 120000 index 0000000000..4b1e30735d --- /dev/null +++ b/Lang/Ada/Deepcopy @@ -0,0 +1 @@ +../../Task/Deepcopy/Ada \ No newline at end of file diff --git a/Lang/Ada/Descending-primes b/Lang/Ada/Descending-primes new file mode 120000 index 0000000000..3c6c36447c --- /dev/null +++ b/Lang/Ada/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/Ada \ No newline at end of file diff --git a/Lang/Ada/Determine-sentence-type b/Lang/Ada/Determine-sentence-type new file mode 120000 index 0000000000..df39412f47 --- /dev/null +++ b/Lang/Ada/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Ada \ No newline at end of file diff --git a/Lang/Ada/Eban-numbers b/Lang/Ada/Eban-numbers new file mode 120000 index 0000000000..8c7c83bfc9 --- /dev/null +++ b/Lang/Ada/Eban-numbers @@ -0,0 +1 @@ +../../Task/Eban-numbers/Ada \ No newline at end of file diff --git a/Lang/Ada/Equal-prime-and-composite-sums b/Lang/Ada/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..b1a2555466 --- /dev/null +++ b/Lang/Ada/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/Ada \ No newline at end of file diff --git a/Lang/Ada/Eulers-constant-0.5772... b/Lang/Ada/Eulers-constant-0.5772... new file mode 120000 index 0000000000..b0e75cb33e --- /dev/null +++ b/Lang/Ada/Eulers-constant-0.5772... @@ -0,0 +1 @@ +../../Task/Eulers-constant-0.5772.../Ada \ No newline at end of file diff --git a/Lang/Ada/FTP b/Lang/Ada/FTP new file mode 120000 index 0000000000..1d406ce7cd --- /dev/null +++ b/Lang/Ada/FTP @@ -0,0 +1 @@ +../../Task/FTP/Ada \ No newline at end of file diff --git a/Lang/Ada/Factorial-primes b/Lang/Ada/Factorial-primes new file mode 120000 index 0000000000..fdff310065 --- /dev/null +++ b/Lang/Ada/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/Ada \ No newline at end of file diff --git a/Lang/Ada/Factorions b/Lang/Ada/Factorions new file mode 120000 index 0000000000..d9b74415a9 --- /dev/null +++ b/Lang/Ada/Factorions @@ -0,0 +1 @@ +../../Task/Factorions/Ada \ No newline at end of file diff --git a/Lang/Ada/Fermat-numbers b/Lang/Ada/Fermat-numbers new file mode 120000 index 0000000000..c9d81fb3a1 --- /dev/null +++ b/Lang/Ada/Fermat-numbers @@ -0,0 +1 @@ +../../Task/Fermat-numbers/Ada \ No newline at end of file diff --git a/Lang/Ada/Find-duplicate-files b/Lang/Ada/Find-duplicate-files new file mode 120000 index 0000000000..f7ad1ff6fd --- /dev/null +++ b/Lang/Ada/Find-duplicate-files @@ -0,0 +1 @@ +../../Task/Find-duplicate-files/Ada \ No newline at end of file diff --git a/Lang/Ada/Fivenum b/Lang/Ada/Fivenum new file mode 120000 index 0000000000..7328eec9c8 --- /dev/null +++ b/Lang/Ada/Fivenum @@ -0,0 +1 @@ +../../Task/Fivenum/Ada \ No newline at end of file diff --git a/Lang/Ada/Giuga-numbers b/Lang/Ada/Giuga-numbers new file mode 120000 index 0000000000..24ab180f54 --- /dev/null +++ b/Lang/Ada/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/Ada \ No newline at end of file diff --git a/Lang/Ada/Harmonic-series b/Lang/Ada/Harmonic-series new file mode 120000 index 0000000000..97492bcb66 --- /dev/null +++ b/Lang/Ada/Harmonic-series @@ -0,0 +1 @@ +../../Task/Harmonic-series/Ada \ No newline at end of file diff --git a/Lang/Ada/Hex-words b/Lang/Ada/Hex-words new file mode 120000 index 0000000000..da49cf2b4d --- /dev/null +++ b/Lang/Ada/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/Ada \ No newline at end of file diff --git a/Lang/Ada/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols b/Lang/Ada/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols new file mode 120000 index 0000000000..29e378f3f1 --- /dev/null +++ b/Lang/Ada/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols @@ -0,0 +1 @@ +../../Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Ada \ No newline at end of file diff --git a/Lang/Ada/Jacobi-symbol b/Lang/Ada/Jacobi-symbol new file mode 120000 index 0000000000..1c52eec7ce --- /dev/null +++ b/Lang/Ada/Jacobi-symbol @@ -0,0 +1 @@ +../../Task/Jacobi-symbol/Ada \ No newline at end of file diff --git a/Lang/Ada/Jacobsthal-numbers b/Lang/Ada/Jacobsthal-numbers new file mode 120000 index 0000000000..630504cad4 --- /dev/null +++ b/Lang/Ada/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/Ada \ No newline at end of file diff --git a/Lang/Ada/Knapsack-problem-Bounded b/Lang/Ada/Knapsack-problem-Bounded new file mode 120000 index 0000000000..1cfbda0d29 --- /dev/null +++ b/Lang/Ada/Knapsack-problem-Bounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Bounded/Ada \ No newline at end of file diff --git a/Lang/Ada/Kosaraju b/Lang/Ada/Kosaraju new file mode 120000 index 0000000000..0b7b72cfb6 --- /dev/null +++ b/Lang/Ada/Kosaraju @@ -0,0 +1 @@ +../../Task/Kosaraju/Ada \ No newline at end of file diff --git a/Lang/Ada/Lah-numbers b/Lang/Ada/Lah-numbers new file mode 120000 index 0000000000..e4f08d947d --- /dev/null +++ b/Lang/Ada/Lah-numbers @@ -0,0 +1 @@ +../../Task/Lah-numbers/Ada \ No newline at end of file diff --git a/Lang/Ada/Largest-number-divisible-by-its-digits b/Lang/Ada/Largest-number-divisible-by-its-digits new file mode 120000 index 0000000000..d61b3cb8be --- /dev/null +++ b/Lang/Ada/Largest-number-divisible-by-its-digits @@ -0,0 +1 @@ +../../Task/Largest-number-divisible-by-its-digits/Ada \ No newline at end of file diff --git a/Lang/Ada/Left-factorials b/Lang/Ada/Left-factorials new file mode 120000 index 0000000000..8c62b38a57 --- /dev/null +++ b/Lang/Ada/Left-factorials @@ -0,0 +1 @@ +../../Task/Left-factorials/Ada \ No newline at end of file diff --git a/Lang/Ada/Levenshtein-distance-Alignment b/Lang/Ada/Levenshtein-distance-Alignment new file mode 120000 index 0000000000..1c6a7ca906 --- /dev/null +++ b/Lang/Ada/Levenshtein-distance-Alignment @@ -0,0 +1 @@ +../../Task/Levenshtein-distance-Alignment/Ada \ No newline at end of file diff --git a/Lang/Ada/Long-literals-with-continuations b/Lang/Ada/Long-literals-with-continuations new file mode 120000 index 0000000000..9d6be6cfc8 --- /dev/null +++ b/Lang/Ada/Long-literals-with-continuations @@ -0,0 +1 @@ +../../Task/Long-literals-with-continuations/Ada \ No newline at end of file diff --git a/Lang/Ada/Longest-increasing-subsequence b/Lang/Ada/Longest-increasing-subsequence new file mode 120000 index 0000000000..dd360a694d --- /dev/null +++ b/Lang/Ada/Longest-increasing-subsequence @@ -0,0 +1 @@ +../../Task/Longest-increasing-subsequence/Ada \ No newline at end of file diff --git a/Lang/Ada/M-bius-function b/Lang/Ada/M-bius-function new file mode 120000 index 0000000000..cb59f2e52a --- /dev/null +++ b/Lang/Ada/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/Ada \ No newline at end of file diff --git a/Lang/Ada/Machine-code b/Lang/Ada/Machine-code new file mode 120000 index 0000000000..52ae4edc91 --- /dev/null +++ b/Lang/Ada/Machine-code @@ -0,0 +1 @@ +../../Task/Machine-code/Ada \ No newline at end of file diff --git a/Lang/Ada/Magic-constant b/Lang/Ada/Magic-constant new file mode 120000 index 0000000000..bd59423b8e --- /dev/null +++ b/Lang/Ada/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/Ada \ No newline at end of file diff --git a/Lang/Ada/Metallic-ratios b/Lang/Ada/Metallic-ratios new file mode 120000 index 0000000000..f41030172b --- /dev/null +++ b/Lang/Ada/Metallic-ratios @@ -0,0 +1 @@ +../../Task/Metallic-ratios/Ada \ No newline at end of file diff --git a/Lang/Ada/Miller-Rabin-primality-test b/Lang/Ada/Miller-Rabin-primality-test deleted file mode 120000 index 79bf6fd437..0000000000 --- a/Lang/Ada/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Ada \ No newline at end of file diff --git a/Lang/Ada/Mind-boggling-card-trick b/Lang/Ada/Mind-boggling-card-trick new file mode 120000 index 0000000000..11ae4366fc --- /dev/null +++ b/Lang/Ada/Mind-boggling-card-trick @@ -0,0 +1 @@ +../../Task/Mind-boggling-card-trick/Ada \ No newline at end of file diff --git a/Lang/Ada/Minimal-steps-down-to-1 b/Lang/Ada/Minimal-steps-down-to-1 new file mode 120000 index 0000000000..44f17e189f --- /dev/null +++ b/Lang/Ada/Minimal-steps-down-to-1 @@ -0,0 +1 @@ +../../Task/Minimal-steps-down-to-1/Ada \ No newline at end of file diff --git a/Lang/Ada/Musical-scale b/Lang/Ada/Musical-scale new file mode 120000 index 0000000000..a792f4144a --- /dev/null +++ b/Lang/Ada/Musical-scale @@ -0,0 +1 @@ +../../Task/Musical-scale/Ada \ No newline at end of file diff --git a/Lang/Ada/Naming-conventions b/Lang/Ada/Naming-conventions new file mode 120000 index 0000000000..44f00f1ff1 --- /dev/null +++ b/Lang/Ada/Naming-conventions @@ -0,0 +1 @@ +../../Task/Naming-conventions/Ada \ No newline at end of file diff --git a/Lang/Ada/Nautical-bell b/Lang/Ada/Nautical-bell new file mode 120000 index 0000000000..61069c35a0 --- /dev/null +++ b/Lang/Ada/Nautical-bell @@ -0,0 +1 @@ +../../Task/Nautical-bell/Ada \ No newline at end of file diff --git a/Lang/Ada/Next-highest-int-from-digits b/Lang/Ada/Next-highest-int-from-digits new file mode 120000 index 0000000000..e996a777e6 --- /dev/null +++ b/Lang/Ada/Next-highest-int-from-digits @@ -0,0 +1 @@ +../../Task/Next-highest-int-from-digits/Ada \ No newline at end of file diff --git a/Lang/Ada/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors b/Lang/Ada/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors new file mode 120000 index 0000000000..58dcaaaaee --- /dev/null +++ b/Lang/Ada/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors @@ -0,0 +1 @@ +../../Task/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors/Ada \ No newline at end of file diff --git a/Lang/Ada/Old-Russian-measure-of-length b/Lang/Ada/Old-Russian-measure-of-length new file mode 120000 index 0000000000..1d4422be24 --- /dev/null +++ b/Lang/Ada/Old-Russian-measure-of-length @@ -0,0 +1 @@ +../../Task/Old-Russian-measure-of-length/Ada \ No newline at end of file diff --git a/Lang/Ada/Penneys-game b/Lang/Ada/Penneys-game new file mode 120000 index 0000000000..00a5e1d496 --- /dev/null +++ b/Lang/Ada/Penneys-game @@ -0,0 +1 @@ +../../Task/Penneys-game/Ada \ No newline at end of file diff --git a/Lang/Ada/Permutations-by-swapping b/Lang/Ada/Permutations-by-swapping new file mode 120000 index 0000000000..9140cf7f43 --- /dev/null +++ b/Lang/Ada/Permutations-by-swapping @@ -0,0 +1 @@ +../../Task/Permutations-by-swapping/Ada \ No newline at end of file diff --git a/Lang/Ada/Play-recorded-sounds b/Lang/Ada/Play-recorded-sounds new file mode 120000 index 0000000000..2365ca211b --- /dev/null +++ b/Lang/Ada/Play-recorded-sounds @@ -0,0 +1 @@ +../../Task/Play-recorded-sounds/Ada \ No newline at end of file diff --git a/Lang/Ada/Poker-hand-analyser b/Lang/Ada/Poker-hand-analyser new file mode 120000 index 0000000000..fc5a66b995 --- /dev/null +++ b/Lang/Ada/Poker-hand-analyser @@ -0,0 +1 @@ +../../Task/Poker-hand-analyser/Ada \ No newline at end of file diff --git a/Lang/Ada/Prime-conspiracy b/Lang/Ada/Prime-conspiracy new file mode 120000 index 0000000000..49f0dd3152 --- /dev/null +++ b/Lang/Ada/Prime-conspiracy @@ -0,0 +1 @@ +../../Task/Prime-conspiracy/Ada \ No newline at end of file diff --git a/Lang/Ada/Quaternion-type b/Lang/Ada/Quaternion-type deleted file mode 120000 index 9dc0eab94d..0000000000 --- a/Lang/Ada/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Ada \ No newline at end of file diff --git a/Lang/Ada/Random-sentence-from-book b/Lang/Ada/Random-sentence-from-book new file mode 120000 index 0000000000..f08e942e14 --- /dev/null +++ b/Lang/Ada/Random-sentence-from-book @@ -0,0 +1 @@ +../../Task/Random-sentence-from-book/Ada \ No newline at end of file diff --git a/Lang/Ada/Read-a-file-character-by-character-UTF8 b/Lang/Ada/Read-a-file-character-by-character-UTF8 new file mode 120000 index 0000000000..71f788273b --- /dev/null +++ b/Lang/Ada/Read-a-file-character-by-character-UTF8 @@ -0,0 +1 @@ +../../Task/Read-a-file-character-by-character-UTF8/Ada \ No newline at end of file diff --git a/Lang/Ada/Record-sound b/Lang/Ada/Record-sound new file mode 120000 index 0000000000..af45b7783f --- /dev/null +++ b/Lang/Ada/Record-sound @@ -0,0 +1 @@ +../../Task/Record-sound/Ada \ No newline at end of file diff --git a/Lang/Ada/Safe-primes-and-unsafe-primes b/Lang/Ada/Safe-primes-and-unsafe-primes new file mode 120000 index 0000000000..97b204f4de --- /dev/null +++ b/Lang/Ada/Safe-primes-and-unsafe-primes @@ -0,0 +1 @@ +../../Task/Safe-primes-and-unsafe-primes/Ada \ No newline at end of file diff --git a/Lang/Ada/Selectively-replace-multiple-instances-of-a-character-within-a-string b/Lang/Ada/Selectively-replace-multiple-instances-of-a-character-within-a-string new file mode 120000 index 0000000000..5077dd9033 --- /dev/null +++ b/Lang/Ada/Selectively-replace-multiple-instances-of-a-character-within-a-string @@ -0,0 +1 @@ +../../Task/Selectively-replace-multiple-instances-of-a-character-within-a-string/Ada \ No newline at end of file diff --git a/Lang/Ada/Sexy-primes b/Lang/Ada/Sexy-primes new file mode 120000 index 0000000000..ec070f062f --- /dev/null +++ b/Lang/Ada/Sexy-primes @@ -0,0 +1 @@ +../../Task/Sexy-primes/Ada \ No newline at end of file diff --git a/Lang/Ada/Sierpinski-pentagon b/Lang/Ada/Sierpinski-pentagon new file mode 120000 index 0000000000..d3c2f495a7 --- /dev/null +++ b/Lang/Ada/Sierpinski-pentagon @@ -0,0 +1 @@ +../../Task/Sierpinski-pentagon/Ada \ No newline at end of file diff --git a/Lang/Ada/Sierpinski-square-curve b/Lang/Ada/Sierpinski-square-curve new file mode 120000 index 0000000000..32cee5f712 --- /dev/null +++ b/Lang/Ada/Sierpinski-square-curve @@ -0,0 +1 @@ +../../Task/Sierpinski-square-curve/Ada \ No newline at end of file diff --git a/Lang/Ada/Sierpinski-triangle-Graphical b/Lang/Ada/Sierpinski-triangle-Graphical new file mode 120000 index 0000000000..c5fb35984b --- /dev/null +++ b/Lang/Ada/Sierpinski-triangle-Graphical @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle-Graphical/Ada \ No newline at end of file diff --git a/Lang/Ada/Sleeping-Beauty-problem b/Lang/Ada/Sleeping-Beauty-problem new file mode 120000 index 0000000000..1c2ef27d37 --- /dev/null +++ b/Lang/Ada/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/Ada \ No newline at end of file diff --git a/Lang/Ada/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k b/Lang/Ada/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k new file mode 120000 index 0000000000..acb5a83713 --- /dev/null +++ b/Lang/Ada/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k @@ -0,0 +1 @@ +../../Task/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k/Ada \ No newline at end of file diff --git a/Lang/Ada/Sorting-algorithms-Cocktail-sort-with-shifting-bounds b/Lang/Ada/Sorting-algorithms-Cocktail-sort-with-shifting-bounds new file mode 120000 index 0000000000..484d3d768d --- /dev/null +++ b/Lang/Ada/Sorting-algorithms-Cocktail-sort-with-shifting-bounds @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Cocktail-sort-with-shifting-bounds/Ada \ No newline at end of file diff --git a/Lang/Ada/Sorting-algorithms-Permutation-sort b/Lang/Ada/Sorting-algorithms-Permutation-sort new file mode 120000 index 0000000000..0f333c5ec8 --- /dev/null +++ b/Lang/Ada/Sorting-algorithms-Permutation-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Permutation-sort/Ada \ No newline at end of file diff --git a/Lang/Ada/Test-integerness b/Lang/Ada/Test-integerness new file mode 120000 index 0000000000..8a5462dcb5 --- /dev/null +++ b/Lang/Ada/Test-integerness @@ -0,0 +1 @@ +../../Task/Test-integerness/Ada \ No newline at end of file diff --git a/Lang/Ada/Total-circles-area b/Lang/Ada/Total-circles-area new file mode 120000 index 0000000000..781e585826 --- /dev/null +++ b/Lang/Ada/Total-circles-area @@ -0,0 +1 @@ +../../Task/Total-circles-area/Ada \ No newline at end of file diff --git a/Lang/Ada/Twin-primes b/Lang/Ada/Twin-primes new file mode 120000 index 0000000000..f368573f47 --- /dev/null +++ b/Lang/Ada/Twin-primes @@ -0,0 +1 @@ +../../Task/Twin-primes/Ada \ No newline at end of file diff --git a/Lang/Ada/Twos-complement b/Lang/Ada/Twos-complement new file mode 120000 index 0000000000..396d1a76f2 --- /dev/null +++ b/Lang/Ada/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Ada \ No newline at end of file diff --git a/Lang/Ada/UPC b/Lang/Ada/UPC new file mode 120000 index 0000000000..374da7b0aa --- /dev/null +++ b/Lang/Ada/UPC @@ -0,0 +1 @@ +../../Task/UPC/Ada \ No newline at end of file diff --git a/Lang/Ada/Ultra-useful-primes b/Lang/Ada/Ultra-useful-primes new file mode 120000 index 0000000000..c89f1426c4 --- /dev/null +++ b/Lang/Ada/Ultra-useful-primes @@ -0,0 +1 @@ +../../Task/Ultra-useful-primes/Ada \ No newline at end of file diff --git a/Lang/Ada/Vector b/Lang/Ada/Vector new file mode 120000 index 0000000000..4cc7975e2f --- /dev/null +++ b/Lang/Ada/Vector @@ -0,0 +1 @@ +../../Task/Vector/Ada \ No newline at end of file diff --git a/Lang/Ada/Wagstaff-primes b/Lang/Ada/Wagstaff-primes new file mode 120000 index 0000000000..3b705137b1 --- /dev/null +++ b/Lang/Ada/Wagstaff-primes @@ -0,0 +1 @@ +../../Task/Wagstaff-primes/Ada \ No newline at end of file diff --git a/Lang/Ada/War-card-game b/Lang/Ada/War-card-game new file mode 120000 index 0000000000..dd4f92afee --- /dev/null +++ b/Lang/Ada/War-card-game @@ -0,0 +1 @@ +../../Task/War-card-game/Ada \ No newline at end of file diff --git a/Lang/Ada/Weird-numbers b/Lang/Ada/Weird-numbers new file mode 120000 index 0000000000..98491ade1a --- /dev/null +++ b/Lang/Ada/Weird-numbers @@ -0,0 +1 @@ +../../Task/Weird-numbers/Ada \ No newline at end of file diff --git a/Lang/Ada/Wilson-primes-of-order-n b/Lang/Ada/Wilson-primes-of-order-n new file mode 120000 index 0000000000..95a6ebc6d1 --- /dev/null +++ b/Lang/Ada/Wilson-primes-of-order-n @@ -0,0 +1 @@ +../../Task/Wilson-primes-of-order-n/Ada \ No newline at end of file diff --git a/Lang/Ada/Word-ladder b/Lang/Ada/Word-ladder new file mode 120000 index 0000000000..495c24dbcd --- /dev/null +++ b/Lang/Ada/Word-ladder @@ -0,0 +1 @@ +../../Task/Word-ladder/Ada \ No newline at end of file diff --git a/Lang/Ada/Word-search b/Lang/Ada/Word-search new file mode 120000 index 0000000000..32f00f4762 --- /dev/null +++ b/Lang/Ada/Word-search @@ -0,0 +1 @@ +../../Task/Word-search/Ada \ No newline at end of file diff --git a/Lang/Ada/Word-wheel b/Lang/Ada/Word-wheel new file mode 120000 index 0000000000..47f67698e0 --- /dev/null +++ b/Lang/Ada/Word-wheel @@ -0,0 +1 @@ +../../Task/Word-wheel/Ada \ No newline at end of file diff --git a/Lang/Adina/00-LANG.txt b/Lang/Adina/00-LANG.txt new file mode 100644 index 0000000000..e796807867 --- /dev/null +++ b/Lang/Adina/00-LANG.txt @@ -0,0 +1,13 @@ +{{language|Adina}} +Adina is a programming language, based on Racket and russian language. Unlike Racket it uses indent and operators precedence to describe program syntax. It may be used in english, because all Racket libraries are accessible. One should add "english()" in first string to use standard racket libraries. + +Адина, это язык программирования, основанный на Racket и русском языке. В отличие от Racket вместо скобок для синтаксической +структуры используются отступы и бинарные операторы. Также сделан доступ через квадратные скобки к элементам коллекции и через фигурные к методам объектов. + +Документация по адресу: https://docs.racket-lang.org/russian-lang/ + +==See Also== +* [[Racket]] + +==TODO== +[[Tasks not implemented in Adina]] \ No newline at end of file diff --git a/Lang/Adina/00-META.yaml b/Lang/Adina/00-META.yaml new file mode 100644 index 0000000000..e1ca8650ca --- /dev/null +++ b/Lang/Adina/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Adina diff --git a/Lang/Adina/100-doors b/Lang/Adina/100-doors new file mode 120000 index 0000000000..c96d2d65fc --- /dev/null +++ b/Lang/Adina/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Adina \ No newline at end of file diff --git a/Lang/Adina/Even-or-odd b/Lang/Adina/Even-or-odd new file mode 120000 index 0000000000..1718b42d76 --- /dev/null +++ b/Lang/Adina/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Adina \ No newline at end of file diff --git a/Lang/Adina/Hello-world-Text b/Lang/Adina/Hello-world-Text new file mode 120000 index 0000000000..f886a7cc4f --- /dev/null +++ b/Lang/Adina/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Adina \ No newline at end of file diff --git a/Lang/Adina/Loops-For b/Lang/Adina/Loops-For new file mode 120000 index 0000000000..c4d6bee093 --- /dev/null +++ b/Lang/Adina/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Adina \ No newline at end of file diff --git a/Lang/Adina/Tree-traversal b/Lang/Adina/Tree-traversal new file mode 120000 index 0000000000..fd3896d623 --- /dev/null +++ b/Lang/Adina/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/Adina \ No newline at end of file diff --git a/Lang/Agena/00-LANG.txt b/Lang/Agena/00-LANG.txt index c2930ac7a2..5398f01156 100644 --- a/Lang/Agena/00-LANG.txt +++ b/Lang/Agena/00-LANG.txt @@ -20,5 +20,10 @@ The syntax looks like very simplified [[ALGOL 68]] with elements taken from [[Lu == How has it been implemented ? == Agena is based on the [[ANSI]] [[C]] source code of [[Lua]], a popular and widely used Open Source programming language. +== Todo == +[[Tasks not implemented in Agena]] + == See Also == -[[ALGOL 68]] \ No newline at end of file +[[ALGOL 68]]
+[[Lua]]
+[[SQL]] \ No newline at end of file diff --git a/Lang/Agena/100-doors b/Lang/Agena/100-doors deleted file mode 120000 index 3a9139bb1c..0000000000 --- a/Lang/Agena/100-doors +++ /dev/null @@ -1 +0,0 @@ -../../Task/100-doors/Agena \ No newline at end of file diff --git a/Lang/Agena/AKS-test-for-primes b/Lang/Agena/AKS-test-for-primes new file mode 120000 index 0000000000..ab27a842c8 --- /dev/null +++ b/Lang/Agena/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/Agena \ No newline at end of file diff --git a/Lang/Agena/Abundant-deficient-and-perfect-number-classifications b/Lang/Agena/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..89450cb83c --- /dev/null +++ b/Lang/Agena/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/Agena \ No newline at end of file diff --git a/Lang/Agena/Abundant-odd-numbers b/Lang/Agena/Abundant-odd-numbers new file mode 120000 index 0000000000..a18ccbb662 --- /dev/null +++ b/Lang/Agena/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Ackermann-function b/Lang/Agena/Ackermann-function new file mode 120000 index 0000000000..fb262b01a7 --- /dev/null +++ b/Lang/Agena/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Agena \ No newline at end of file diff --git a/Lang/Agena/Almost-prime b/Lang/Agena/Almost-prime new file mode 120000 index 0000000000..62b34f9616 --- /dev/null +++ b/Lang/Agena/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Agena \ No newline at end of file diff --git a/Lang/Agena/Angle-difference-between-two-bearings b/Lang/Agena/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..62a719bb70 --- /dev/null +++ b/Lang/Agena/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/Agena \ No newline at end of file diff --git a/Lang/Agena/Anti-primes b/Lang/Agena/Anti-primes new file mode 120000 index 0000000000..f98d65a6cf --- /dev/null +++ b/Lang/Agena/Anti-primes @@ -0,0 +1 @@ +../../Task/Anti-primes/Agena \ No newline at end of file diff --git a/Lang/Agena/Arbitrary-precision-integers-included- b/Lang/Agena/Arbitrary-precision-integers-included- new file mode 120000 index 0000000000..347104998a --- /dev/null +++ b/Lang/Agena/Arbitrary-precision-integers-included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers-included-/Agena \ No newline at end of file diff --git a/Lang/Agena/Ascending-primes b/Lang/Agena/Ascending-primes new file mode 120000 index 0000000000..9c8c50d2ae --- /dev/null +++ b/Lang/Agena/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/Agena \ No newline at end of file diff --git a/Lang/Agena/Associative-array-Iteration b/Lang/Agena/Associative-array-Iteration new file mode 120000 index 0000000000..55b1a0c7a6 --- /dev/null +++ b/Lang/Agena/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Agena \ No newline at end of file diff --git a/Lang/Agena/Attractive-numbers b/Lang/Agena/Attractive-numbers new file mode 120000 index 0000000000..bc968b5d21 --- /dev/null +++ b/Lang/Agena/Attractive-numbers @@ -0,0 +1 @@ +../../Task/Attractive-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Brazilian-numbers b/Lang/Agena/Brazilian-numbers new file mode 120000 index 0000000000..7312d4ef84 --- /dev/null +++ b/Lang/Agena/Brazilian-numbers @@ -0,0 +1 @@ +../../Task/Brazilian-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Calkin-Wilf-sequence b/Lang/Agena/Calkin-Wilf-sequence new file mode 120000 index 0000000000..eaff2085aa --- /dev/null +++ b/Lang/Agena/Calkin-Wilf-sequence @@ -0,0 +1 @@ +../../Task/Calkin-Wilf-sequence/Agena \ No newline at end of file diff --git a/Lang/Agena/Catalan-numbers b/Lang/Agena/Catalan-numbers new file mode 120000 index 0000000000..926ef43918 --- /dev/null +++ b/Lang/Agena/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Character-codes b/Lang/Agena/Character-codes new file mode 120000 index 0000000000..39121b3568 --- /dev/null +++ b/Lang/Agena/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Agena \ No newline at end of file diff --git a/Lang/Agena/Chowla-numbers b/Lang/Agena/Chowla-numbers new file mode 120000 index 0000000000..d4c2806c20 --- /dev/null +++ b/Lang/Agena/Chowla-numbers @@ -0,0 +1 @@ +../../Task/Chowla-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Damm-algorithm b/Lang/Agena/Damm-algorithm new file mode 120000 index 0000000000..d753c9e99f --- /dev/null +++ b/Lang/Agena/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/Agena \ No newline at end of file diff --git a/Lang/Agena/Day-of-the-week b/Lang/Agena/Day-of-the-week new file mode 120000 index 0000000000..e4733798aa --- /dev/null +++ b/Lang/Agena/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Agena \ No newline at end of file diff --git a/Lang/Agena/Department-numbers b/Lang/Agena/Department-numbers new file mode 120000 index 0000000000..fdeaca8fd3 --- /dev/null +++ b/Lang/Agena/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Descending-primes b/Lang/Agena/Descending-primes new file mode 120000 index 0000000000..483dfe03f7 --- /dev/null +++ b/Lang/Agena/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/Agena \ No newline at end of file diff --git a/Lang/Agena/Disarium-numbers b/Lang/Agena/Disarium-numbers new file mode 120000 index 0000000000..2bace62b71 --- /dev/null +++ b/Lang/Agena/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Entropy b/Lang/Agena/Entropy new file mode 120000 index 0000000000..f0f66caa04 --- /dev/null +++ b/Lang/Agena/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/Agena \ No newline at end of file diff --git a/Lang/Agena/Equal-prime-and-composite-sums b/Lang/Agena/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..376401ddea --- /dev/null +++ b/Lang/Agena/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/Agena \ No newline at end of file diff --git a/Lang/Agena/Factorial b/Lang/Agena/Factorial new file mode 120000 index 0000000000..21cbc1e46b --- /dev/null +++ b/Lang/Agena/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Agena \ No newline at end of file diff --git a/Lang/Agena/Factorial-primes b/Lang/Agena/Factorial-primes new file mode 120000 index 0000000000..68796e7224 --- /dev/null +++ b/Lang/Agena/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/Agena \ No newline at end of file diff --git a/Lang/Agena/Gamma-function b/Lang/Agena/Gamma-function new file mode 120000 index 0000000000..c0b0340467 --- /dev/null +++ b/Lang/Agena/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/Agena \ No newline at end of file diff --git a/Lang/Agena/Gauss-Jordan-matrix-inversion b/Lang/Agena/Gauss-Jordan-matrix-inversion new file mode 120000 index 0000000000..a1bc51eaa3 --- /dev/null +++ b/Lang/Agena/Gauss-Jordan-matrix-inversion @@ -0,0 +1 @@ +../../Task/Gauss-Jordan-matrix-inversion/Agena \ No newline at end of file diff --git a/Lang/Agena/Generate-lower-case-ASCII-alphabet b/Lang/Agena/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..ace5f93bb5 --- /dev/null +++ b/Lang/Agena/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Agena \ No newline at end of file diff --git a/Lang/Agena/Giuga-numbers b/Lang/Agena/Giuga-numbers new file mode 120000 index 0000000000..273fdf8c7c --- /dev/null +++ b/Lang/Agena/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Goldbachs-comet b/Lang/Agena/Goldbachs-comet new file mode 120000 index 0000000000..26b052a294 --- /dev/null +++ b/Lang/Agena/Goldbachs-comet @@ -0,0 +1 @@ +../../Task/Goldbachs-comet/Agena \ No newline at end of file diff --git a/Lang/Agena/Haversine-formula b/Lang/Agena/Haversine-formula new file mode 120000 index 0000000000..45e20df974 --- /dev/null +++ b/Lang/Agena/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/Agena \ No newline at end of file diff --git a/Lang/Agena/Horners-rule-for-polynomial-evaluation b/Lang/Agena/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..cffe37e87c --- /dev/null +++ b/Lang/Agena/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Agena \ No newline at end of file diff --git a/Lang/Agena/Humble-numbers b/Lang/Agena/Humble-numbers new file mode 120000 index 0000000000..bdce77fd35 --- /dev/null +++ b/Lang/Agena/Humble-numbers @@ -0,0 +1 @@ +../../Task/Humble-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/JSON b/Lang/Agena/JSON new file mode 120000 index 0000000000..9c20f7b68f --- /dev/null +++ b/Lang/Agena/JSON @@ -0,0 +1 @@ +../../Task/JSON/Agena \ No newline at end of file diff --git a/Lang/Agena/Jacobsthal-numbers b/Lang/Agena/Jacobsthal-numbers new file mode 120000 index 0000000000..740d21ef1a --- /dev/null +++ b/Lang/Agena/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Jewels-and-stones b/Lang/Agena/Jewels-and-stones new file mode 120000 index 0000000000..7c03f8ec8f --- /dev/null +++ b/Lang/Agena/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/Agena \ No newline at end of file diff --git a/Lang/Agena/Jordan-P-lya-numbers b/Lang/Agena/Jordan-P-lya-numbers new file mode 120000 index 0000000000..4e2d64a6e1 --- /dev/null +++ b/Lang/Agena/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Juggler-sequence b/Lang/Agena/Juggler-sequence new file mode 120000 index 0000000000..e5817b72b7 --- /dev/null +++ b/Lang/Agena/Juggler-sequence @@ -0,0 +1 @@ +../../Task/Juggler-sequence/Agena \ No newline at end of file diff --git a/Lang/Agena/Kaprekar-numbers b/Lang/Agena/Kaprekar-numbers new file mode 120000 index 0000000000..d665f2f5f5 --- /dev/null +++ b/Lang/Agena/Kaprekar-numbers @@ -0,0 +1 @@ +../../Task/Kaprekar-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Legendre-prime-counting-function b/Lang/Agena/Legendre-prime-counting-function new file mode 120000 index 0000000000..07d7bc7083 --- /dev/null +++ b/Lang/Agena/Legendre-prime-counting-function @@ -0,0 +1 @@ +../../Task/Legendre-prime-counting-function/Agena \ No newline at end of file diff --git a/Lang/Agena/Leonardo-numbers b/Lang/Agena/Leonardo-numbers new file mode 120000 index 0000000000..d6d819f05a --- /dev/null +++ b/Lang/Agena/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Levenshtein-distance b/Lang/Agena/Levenshtein-distance new file mode 120000 index 0000000000..ec3426b464 --- /dev/null +++ b/Lang/Agena/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Agena \ No newline at end of file diff --git a/Lang/Agena/Mayan-numerals b/Lang/Agena/Mayan-numerals new file mode 120000 index 0000000000..671a85a6c0 --- /dev/null +++ b/Lang/Agena/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/Agena \ No newline at end of file diff --git a/Lang/Agena/McNuggets-problem b/Lang/Agena/McNuggets-problem new file mode 120000 index 0000000000..b2417f0142 --- /dev/null +++ b/Lang/Agena/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/Agena \ No newline at end of file diff --git a/Lang/Agena/Mian-Chowla-sequence b/Lang/Agena/Mian-Chowla-sequence new file mode 120000 index 0000000000..a6489175a6 --- /dev/null +++ b/Lang/Agena/Mian-Chowla-sequence @@ -0,0 +1 @@ +../../Task/Mian-Chowla-sequence/Agena \ No newline at end of file diff --git a/Lang/Agena/Monty-Hall-problem b/Lang/Agena/Monty-Hall-problem new file mode 120000 index 0000000000..d1c4ae980e --- /dev/null +++ b/Lang/Agena/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/Agena \ No newline at end of file diff --git a/Lang/Agena/Numbers-with-equal-rises-and-falls b/Lang/Agena/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..08787d85d6 --- /dev/null +++ b/Lang/Agena/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/Agena \ No newline at end of file diff --git a/Lang/Agena/Ordered-words b/Lang/Agena/Ordered-words new file mode 120000 index 0000000000..3503a492c8 --- /dev/null +++ b/Lang/Agena/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Agena \ No newline at end of file diff --git a/Lang/Agena/Periodic-table b/Lang/Agena/Periodic-table new file mode 120000 index 0000000000..cb70080867 --- /dev/null +++ b/Lang/Agena/Periodic-table @@ -0,0 +1 @@ +../../Task/Periodic-table/Agena \ No newline at end of file diff --git a/Lang/Agena/Pernicious-numbers b/Lang/Agena/Pernicious-numbers new file mode 120000 index 0000000000..454ce5b94d --- /dev/null +++ b/Lang/Agena/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Pisano-period b/Lang/Agena/Pisano-period new file mode 120000 index 0000000000..afaae8dce9 --- /dev/null +++ b/Lang/Agena/Pisano-period @@ -0,0 +1 @@ +../../Task/Pisano-period/Agena \ No newline at end of file diff --git a/Lang/Agena/Primality-by-trial-division b/Lang/Agena/Primality-by-trial-division new file mode 120000 index 0000000000..621c0609eb --- /dev/null +++ b/Lang/Agena/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Agena \ No newline at end of file diff --git a/Lang/Agena/Program-name b/Lang/Agena/Program-name new file mode 120000 index 0000000000..bf43276155 --- /dev/null +++ b/Lang/Agena/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/Agena \ No newline at end of file diff --git a/Lang/Agena/Quoting-constructs b/Lang/Agena/Quoting-constructs new file mode 120000 index 0000000000..f6fed80313 --- /dev/null +++ b/Lang/Agena/Quoting-constructs @@ -0,0 +1 @@ +../../Task/Quoting-constructs/Agena \ No newline at end of file diff --git a/Lang/Agena/Read-a-file-line-by-line b/Lang/Agena/Read-a-file-line-by-line new file mode 120000 index 0000000000..a4d8ef354b --- /dev/null +++ b/Lang/Agena/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Agena \ No newline at end of file diff --git a/Lang/Agena/Reverse-a-string b/Lang/Agena/Reverse-a-string new file mode 120000 index 0000000000..db79d68725 --- /dev/null +++ b/Lang/Agena/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Agena \ No newline at end of file diff --git a/Lang/Agena/Sequence-of-primes-by-trial-division b/Lang/Agena/Sequence-of-primes-by-trial-division new file mode 120000 index 0000000000..d7958a31a1 --- /dev/null +++ b/Lang/Agena/Sequence-of-primes-by-trial-division @@ -0,0 +1 @@ +../../Task/Sequence-of-primes-by-trial-division/Agena \ No newline at end of file diff --git a/Lang/Agena/Sleeping-Beauty-problem b/Lang/Agena/Sleeping-Beauty-problem new file mode 120000 index 0000000000..2cf02e5792 --- /dev/null +++ b/Lang/Agena/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/Agena \ No newline at end of file diff --git a/Lang/Agena/Smarandache-prime-digital-sequence b/Lang/Agena/Smarandache-prime-digital-sequence new file mode 120000 index 0000000000..3a1f0e0805 --- /dev/null +++ b/Lang/Agena/Smarandache-prime-digital-sequence @@ -0,0 +1 @@ +../../Task/Smarandache-prime-digital-sequence/Agena \ No newline at end of file diff --git a/Lang/Agena/Soloways-recurring-rainfall b/Lang/Agena/Soloways-recurring-rainfall new file mode 120000 index 0000000000..b391a79582 --- /dev/null +++ b/Lang/Agena/Soloways-recurring-rainfall @@ -0,0 +1 @@ +../../Task/Soloways-recurring-rainfall/Agena \ No newline at end of file diff --git a/Lang/Agena/Square-but-not-cube b/Lang/Agena/Square-but-not-cube new file mode 120000 index 0000000000..951bd25edd --- /dev/null +++ b/Lang/Agena/Square-but-not-cube @@ -0,0 +1 @@ +../../Task/Square-but-not-cube/Agena \ No newline at end of file diff --git a/Lang/Agena/Sum-of-elements-below-main-diagonal-of-matrix b/Lang/Agena/Sum-of-elements-below-main-diagonal-of-matrix new file mode 120000 index 0000000000..6bd7256f3a --- /dev/null +++ b/Lang/Agena/Sum-of-elements-below-main-diagonal-of-matrix @@ -0,0 +1 @@ +../../Task/Sum-of-elements-below-main-diagonal-of-matrix/Agena \ No newline at end of file diff --git a/Lang/Agena/Super-d-numbers b/Lang/Agena/Super-d-numbers new file mode 120000 index 0000000000..1da0548626 --- /dev/null +++ b/Lang/Agena/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Sylvesters-sequence b/Lang/Agena/Sylvesters-sequence new file mode 120000 index 0000000000..9a5d51563f --- /dev/null +++ b/Lang/Agena/Sylvesters-sequence @@ -0,0 +1 @@ +../../Task/Sylvesters-sequence/Agena \ No newline at end of file diff --git a/Lang/Agena/Tau-function b/Lang/Agena/Tau-function new file mode 120000 index 0000000000..579307a681 --- /dev/null +++ b/Lang/Agena/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/Agena \ No newline at end of file diff --git a/Lang/Agena/Tau-number b/Lang/Agena/Tau-number new file mode 120000 index 0000000000..543c34a5b4 --- /dev/null +++ b/Lang/Agena/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Agena \ No newline at end of file diff --git a/Lang/Agena/The-sieve-of-Sundaram b/Lang/Agena/The-sieve-of-Sundaram new file mode 120000 index 0000000000..5ab3c6c849 --- /dev/null +++ b/Lang/Agena/The-sieve-of-Sundaram @@ -0,0 +1 @@ +../../Task/The-sieve-of-Sundaram/Agena \ No newline at end of file diff --git a/Lang/Agena/Thue-Morse b/Lang/Agena/Thue-Morse new file mode 120000 index 0000000000..f3225165e3 --- /dev/null +++ b/Lang/Agena/Thue-Morse @@ -0,0 +1 @@ +../../Task/Thue-Morse/Agena \ No newline at end of file diff --git a/Lang/Agena/Time-a-function b/Lang/Agena/Time-a-function new file mode 120000 index 0000000000..e5746c4dff --- /dev/null +++ b/Lang/Agena/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/Agena \ No newline at end of file diff --git a/Lang/Agena/Totient-function b/Lang/Agena/Totient-function new file mode 120000 index 0000000000..d74f15771c --- /dev/null +++ b/Lang/Agena/Totient-function @@ -0,0 +1 @@ +../../Task/Totient-function/Agena \ No newline at end of file diff --git a/Lang/Agena/Unprimeable-numbers b/Lang/Agena/Unprimeable-numbers new file mode 120000 index 0000000000..fc3b30fec4 --- /dev/null +++ b/Lang/Agena/Unprimeable-numbers @@ -0,0 +1 @@ +../../Task/Unprimeable-numbers/Agena \ No newline at end of file diff --git a/Lang/Agena/Van-Eck-sequence b/Lang/Agena/Van-Eck-sequence new file mode 120000 index 0000000000..1714aa1507 --- /dev/null +++ b/Lang/Agena/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/Agena \ No newline at end of file diff --git a/Lang/Agena/Van-der-Corput-sequence b/Lang/Agena/Van-der-Corput-sequence new file mode 120000 index 0000000000..92bec950df --- /dev/null +++ b/Lang/Agena/Van-der-Corput-sequence @@ -0,0 +1 @@ +../../Task/Van-der-Corput-sequence/Agena \ No newline at end of file diff --git a/Lang/Agena/Wagstaff-primes b/Lang/Agena/Wagstaff-primes new file mode 120000 index 0000000000..b63d3369fa --- /dev/null +++ b/Lang/Agena/Wagstaff-primes @@ -0,0 +1 @@ +../../Task/Wagstaff-primes/Agena \ No newline at end of file diff --git a/Lang/Agena/Wieferich-primes b/Lang/Agena/Wieferich-primes new file mode 120000 index 0000000000..34597fbb1d --- /dev/null +++ b/Lang/Agena/Wieferich-primes @@ -0,0 +1 @@ +../../Task/Wieferich-primes/Agena \ No newline at end of file diff --git a/Lang/Agena/Wilson-primes-of-order-n b/Lang/Agena/Wilson-primes-of-order-n new file mode 120000 index 0000000000..6b8ae43468 --- /dev/null +++ b/Lang/Agena/Wilson-primes-of-order-n @@ -0,0 +1 @@ +../../Task/Wilson-primes-of-order-n/Agena \ No newline at end of file diff --git a/Lang/Agena/Yellowstone-sequence b/Lang/Agena/Yellowstone-sequence new file mode 120000 index 0000000000..4464a6e815 --- /dev/null +++ b/Lang/Agena/Yellowstone-sequence @@ -0,0 +1 @@ +../../Task/Yellowstone-sequence/Agena \ No newline at end of file diff --git a/Lang/Aikido/00-LANG.txt b/Lang/Aikido/00-LANG.txt index 4126891ffb..19bd4a47ab 100644 --- a/Lang/Aikido/00-LANG.txt +++ b/Lang/Aikido/00-LANG.txt @@ -12,4 +12,4 @@ It was developed at [[Sun Microsystems|Sun Microsystems Laboratories]] by David In some respects it is similar in functionality to [[Python]], [[Perl]], [[JavaScript]] and [[Java]]. Syntactically it is very similar to [[C++]] and Java. -Aikido is available for Linux, Mac OS X and Solaris. The interpreter can be obtained from http://sourceforge.net/projects/aikido. Documentation (in PDF) is at http://downloads.sourceforge.net/aikido/aikido_prm.pdf \ No newline at end of file +Aikido is available for Linux, Mac OS X and Solaris. The interpreter can be obtained from http://sourceforge.net/projects/aikido. Documentation (in PDF) is at https://sourceforge.net/projects/aikido/files/aikido/1.40/aikidoref140.pdf/download \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Anagrams b/Lang/Amazing-Hopper/Anagrams new file mode 120000 index 0000000000..0666803cc3 --- /dev/null +++ b/Lang/Amazing-Hopper/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Arithmetic-evaluation b/Lang/Amazing-Hopper/Arithmetic-evaluation new file mode 120000 index 0000000000..090fde0f4b --- /dev/null +++ b/Lang/Amazing-Hopper/Arithmetic-evaluation @@ -0,0 +1 @@ +../../Task/Arithmetic-evaluation/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Averages-Median b/Lang/Amazing-Hopper/Averages-Median new file mode 120000 index 0000000000..85188aa532 --- /dev/null +++ b/Lang/Amazing-Hopper/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Babbage-problem b/Lang/Amazing-Hopper/Babbage-problem new file mode 120000 index 0000000000..fbd53ae54a --- /dev/null +++ b/Lang/Amazing-Hopper/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Balanced-brackets b/Lang/Amazing-Hopper/Balanced-brackets new file mode 120000 index 0000000000..22c365c13b --- /dev/null +++ b/Lang/Amazing-Hopper/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Cantor-set b/Lang/Amazing-Hopper/Cantor-set new file mode 120000 index 0000000000..b7d83aa2d8 --- /dev/null +++ b/Lang/Amazing-Hopper/Cantor-set @@ -0,0 +1 @@ +../../Task/Cantor-set/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Count-in-octal b/Lang/Amazing-Hopper/Count-in-octal new file mode 120000 index 0000000000..db01d0d594 --- /dev/null +++ b/Lang/Amazing-Hopper/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Digital-root b/Lang/Amazing-Hopper/Digital-root new file mode 120000 index 0000000000..22bf453215 --- /dev/null +++ b/Lang/Amazing-Hopper/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Disarium-numbers b/Lang/Amazing-Hopper/Disarium-numbers new file mode 120000 index 0000000000..ce173c6822 --- /dev/null +++ b/Lang/Amazing-Hopper/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Dot-product b/Lang/Amazing-Hopper/Dot-product new file mode 120000 index 0000000000..6bc7d5ea07 --- /dev/null +++ b/Lang/Amazing-Hopper/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Formatted-numeric-output b/Lang/Amazing-Hopper/Formatted-numeric-output new file mode 120000 index 0000000000..36d6f264bf --- /dev/null +++ b/Lang/Amazing-Hopper/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Function-composition b/Lang/Amazing-Hopper/Function-composition new file mode 120000 index 0000000000..257a080151 --- /dev/null +++ b/Lang/Amazing-Hopper/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Hailstone-sequence b/Lang/Amazing-Hopper/Hailstone-sequence new file mode 120000 index 0000000000..c1e9f894b1 --- /dev/null +++ b/Lang/Amazing-Hopper/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Haversine-formula b/Lang/Amazing-Hopper/Haversine-formula new file mode 120000 index 0000000000..01efd99770 --- /dev/null +++ b/Lang/Amazing-Hopper/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Knuth-shuffle b/Lang/Amazing-Hopper/Knuth-shuffle new file mode 120000 index 0000000000..b4397143ef --- /dev/null +++ b/Lang/Amazing-Hopper/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Long-year b/Lang/Amazing-Hopper/Long-year new file mode 120000 index 0000000000..67734f8564 --- /dev/null +++ b/Lang/Amazing-Hopper/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/M-bius-function b/Lang/Amazing-Hopper/M-bius-function new file mode 120000 index 0000000000..3fa2be430d --- /dev/null +++ b/Lang/Amazing-Hopper/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Magic-squares-of-doubly-even-order b/Lang/Amazing-Hopper/Magic-squares-of-doubly-even-order new file mode 120000 index 0000000000..3304664c75 --- /dev/null +++ b/Lang/Amazing-Hopper/Magic-squares-of-doubly-even-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-doubly-even-order/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Magnanimous-numbers b/Lang/Amazing-Hopper/Magnanimous-numbers new file mode 120000 index 0000000000..d82f2324d0 --- /dev/null +++ b/Lang/Amazing-Hopper/Magnanimous-numbers @@ -0,0 +1 @@ +../../Task/Magnanimous-numbers/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Matrix-digital-rain b/Lang/Amazing-Hopper/Matrix-digital-rain new file mode 120000 index 0000000000..c42a700f67 --- /dev/null +++ b/Lang/Amazing-Hopper/Matrix-digital-rain @@ -0,0 +1 @@ +../../Task/Matrix-digital-rain/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Mayan-numerals b/Lang/Amazing-Hopper/Mayan-numerals new file mode 120000 index 0000000000..74c0c29a62 --- /dev/null +++ b/Lang/Amazing-Hopper/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Middle-three-digits b/Lang/Amazing-Hopper/Middle-three-digits new file mode 120000 index 0000000000..c7c41225de --- /dev/null +++ b/Lang/Amazing-Hopper/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/One-dimensional-cellular-automata b/Lang/Amazing-Hopper/One-dimensional-cellular-automata new file mode 120000 index 0000000000..47a2f89f22 --- /dev/null +++ b/Lang/Amazing-Hopper/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Ordered-words b/Lang/Amazing-Hopper/Ordered-words new file mode 120000 index 0000000000..79f4afa7b3 --- /dev/null +++ b/Lang/Amazing-Hopper/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Pseudo-random-numbers-Middle-square-method b/Lang/Amazing-Hopper/Pseudo-random-numbers-Middle-square-method new file mode 120000 index 0000000000..fde29893bc --- /dev/null +++ b/Lang/Amazing-Hopper/Pseudo-random-numbers-Middle-square-method @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Middle-square-method/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Return-multiple-values b/Lang/Amazing-Hopper/Return-multiple-values new file mode 120000 index 0000000000..989a978413 --- /dev/null +++ b/Lang/Amazing-Hopper/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Run-length-encoding b/Lang/Amazing-Hopper/Run-length-encoding new file mode 120000 index 0000000000..c9540874b6 --- /dev/null +++ b/Lang/Amazing-Hopper/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Smith-numbers b/Lang/Amazing-Hopper/Smith-numbers new file mode 120000 index 0000000000..9f7a72e850 --- /dev/null +++ b/Lang/Amazing-Hopper/Smith-numbers @@ -0,0 +1 @@ +../../Task/Smith-numbers/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Sort-three-variables b/Lang/Amazing-Hopper/Sort-three-variables new file mode 120000 index 0000000000..3adad4c634 --- /dev/null +++ b/Lang/Amazing-Hopper/Sort-three-variables @@ -0,0 +1 @@ +../../Task/Sort-three-variables/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Split-a-character-string-based-on-change-of-character b/Lang/Amazing-Hopper/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..ac99345357 --- /dev/null +++ b/Lang/Amazing-Hopper/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Statistics-Basic b/Lang/Amazing-Hopper/Statistics-Basic new file mode 120000 index 0000000000..bfa2d08b49 --- /dev/null +++ b/Lang/Amazing-Hopper/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Successive-prime-differences b/Lang/Amazing-Hopper/Successive-prime-differences new file mode 120000 index 0000000000..efd8572186 --- /dev/null +++ b/Lang/Amazing-Hopper/Successive-prime-differences @@ -0,0 +1 @@ +../../Task/Successive-prime-differences/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Sum-of-a-series b/Lang/Amazing-Hopper/Sum-of-a-series new file mode 120000 index 0000000000..03635804ee --- /dev/null +++ b/Lang/Amazing-Hopper/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Super-d-numbers b/Lang/Amazing-Hopper/Super-d-numbers new file mode 120000 index 0000000000..1770d7a856 --- /dev/null +++ b/Lang/Amazing-Hopper/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Symmetric-difference b/Lang/Amazing-Hopper/Symmetric-difference new file mode 120000 index 0000000000..1af0b3c084 --- /dev/null +++ b/Lang/Amazing-Hopper/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Take-notes-on-the-command-line b/Lang/Amazing-Hopper/Take-notes-on-the-command-line new file mode 120000 index 0000000000..2fd4c913c8 --- /dev/null +++ b/Lang/Amazing-Hopper/Take-notes-on-the-command-line @@ -0,0 +1 @@ +../../Task/Take-notes-on-the-command-line/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Text-processing-2 b/Lang/Amazing-Hopper/Text-processing-2 new file mode 120000 index 0000000000..f3d3800aca --- /dev/null +++ b/Lang/Amazing-Hopper/Text-processing-2 @@ -0,0 +1 @@ +../../Task/Text-processing-2/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Truth-table b/Lang/Amazing-Hopper/Truth-table new file mode 120000 index 0000000000..14882232f9 --- /dev/null +++ b/Lang/Amazing-Hopper/Truth-table @@ -0,0 +1 @@ +../../Task/Truth-table/Amazing-Hopper \ No newline at end of file diff --git a/Lang/Amazing-Hopper/Van-Eck-sequence b/Lang/Amazing-Hopper/Van-Eck-sequence new file mode 120000 index 0000000000..0c660f0481 --- /dev/null +++ b/Lang/Amazing-Hopper/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/Amazing-Hopper \ No newline at end of file diff --git a/Lang/AmigaBASIC/00-LANG.txt b/Lang/AmigaBASIC/00-LANG.txt index 94b3e71ee7..c2e6f48854 100644 --- a/Lang/AmigaBASIC/00-LANG.txt +++ b/Lang/AmigaBASIC/00-LANG.txt @@ -11,5 +11,7 @@ Execution speed however was not a particular strength of AmigaBASIC. Some 8-bit AmigaBASIC was superseded by [[wp:ARexx|ARexx]], a REXX-style scripting language, from AmigaOS version 2.0 onwards. The 1.x AmigaBASIC binary also works on AmigaOS 2, but not on AmigaOS 3. +Microsoft [[QuickBASIC]] (1985) and QBasic (1991) look very similar to AmigaBASIC, so their syntax highlighting rules mostly also work for AmigaBASIC code. + ==See Also== *[https://archive.org/search.php?query=amiga%20basic Scanned AmigaBASIC books at archive.org] \ No newline at end of file diff --git a/Lang/AmigaBASIC/Animate-a-pendulum b/Lang/AmigaBASIC/Animate-a-pendulum new file mode 120000 index 0000000000..010529e570 --- /dev/null +++ b/Lang/AmigaBASIC/Animate-a-pendulum @@ -0,0 +1 @@ +../../Task/Animate-a-pendulum/AmigaBASIC \ No newline at end of file diff --git a/Lang/AmigaBASIC/Chaos-game b/Lang/AmigaBASIC/Chaos-game new file mode 120000 index 0000000000..06fb31b581 --- /dev/null +++ b/Lang/AmigaBASIC/Chaos-game @@ -0,0 +1 @@ +../../Task/Chaos-game/AmigaBASIC \ No newline at end of file diff --git a/Lang/Apple/00-LANG.txt b/Lang/Apple/00-LANG.txt new file mode 100644 index 0000000000..e4e452b143 --- /dev/null +++ b/Lang/Apple/00-LANG.txt @@ -0,0 +1,12 @@ +{{language|Apple +|exec=Compiled +|safety=safe +|checking=static +|strength=strong +|site=https://github.com/vmchale/apple}} + +{{language programming paradigm|functional}} + +The Apple Array System is a JIT-compiler for a statically typed functional language specialized on arrays. + +It is expression-oriented (it has no imports); it is meant to be called from other languages. \ No newline at end of file diff --git a/Lang/Apple/00-META.yaml b/Lang/Apple/00-META.yaml new file mode 100644 index 0000000000..fcdeec5d5c --- /dev/null +++ b/Lang/Apple/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Apple diff --git a/Lang/Apple/Averages-Arithmetic-mean b/Lang/Apple/Averages-Arithmetic-mean new file mode 120000 index 0000000000..b4236a6909 --- /dev/null +++ b/Lang/Apple/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Apple \ No newline at end of file diff --git a/Lang/Apple/Averages-Pythagorean-means b/Lang/Apple/Averages-Pythagorean-means new file mode 120000 index 0000000000..50c70e6c0b --- /dev/null +++ b/Lang/Apple/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/Apple \ No newline at end of file diff --git a/Lang/Apple/Catamorphism b/Lang/Apple/Catamorphism new file mode 120000 index 0000000000..5d06cbf18d --- /dev/null +++ b/Lang/Apple/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Apple \ No newline at end of file diff --git a/Lang/Apple/Dot-product b/Lang/Apple/Dot-product new file mode 120000 index 0000000000..084fc21920 --- /dev/null +++ b/Lang/Apple/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Apple \ No newline at end of file diff --git a/Lang/Apple/Factorial b/Lang/Apple/Factorial new file mode 120000 index 0000000000..8d659daa6f --- /dev/null +++ b/Lang/Apple/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Apple \ No newline at end of file diff --git a/Lang/Apple/Factors-of-an-integer b/Lang/Apple/Factors-of-an-integer new file mode 120000 index 0000000000..a965a5d4bd --- /dev/null +++ b/Lang/Apple/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Apple \ No newline at end of file diff --git a/Lang/Apple/Filter b/Lang/Apple/Filter new file mode 120000 index 0000000000..5dfbcaf92d --- /dev/null +++ b/Lang/Apple/Filter @@ -0,0 +1 @@ +../../Task/Filter/Apple \ No newline at end of file diff --git a/Lang/Apple/ISBN13-check-digit b/Lang/Apple/ISBN13-check-digit new file mode 120000 index 0000000000..b9d843e9fc --- /dev/null +++ b/Lang/Apple/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/Apple \ No newline at end of file diff --git a/Lang/AppleScript/21-game b/Lang/AppleScript/21-game new file mode 120000 index 0000000000..8108f8c3fc --- /dev/null +++ b/Lang/AppleScript/21-game @@ -0,0 +1 @@ +../../Task/21-game/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Angle-difference-between-two-bearings b/Lang/AppleScript/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..cb1c37c369 --- /dev/null +++ b/Lang/AppleScript/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Arithmetic-numbers b/Lang/AppleScript/Arithmetic-numbers new file mode 120000 index 0000000000..3cefb4a617 --- /dev/null +++ b/Lang/AppleScript/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Associative-array-Creation b/Lang/AppleScript/Associative-array-Creation new file mode 120000 index 0000000000..8dba66b7c2 --- /dev/null +++ b/Lang/AppleScript/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Bin-given-limits b/Lang/AppleScript/Bin-given-limits new file mode 120000 index 0000000000..955dc82ffb --- /dev/null +++ b/Lang/AppleScript/Bin-given-limits @@ -0,0 +1 @@ +../../Task/Bin-given-limits/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Call-a-foreign-language-function b/Lang/AppleScript/Call-a-foreign-language-function new file mode 120000 index 0000000000..29365d0ac9 --- /dev/null +++ b/Lang/AppleScript/Call-a-foreign-language-function @@ -0,0 +1 @@ +../../Task/Call-a-foreign-language-function/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Catalan-numbers b/Lang/AppleScript/Catalan-numbers new file mode 120000 index 0000000000..0299ff88b4 --- /dev/null +++ b/Lang/AppleScript/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Create-an-HTML-table b/Lang/AppleScript/Create-an-HTML-table new file mode 120000 index 0000000000..c5386274dd --- /dev/null +++ b/Lang/AppleScript/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Formatted-numeric-output b/Lang/AppleScript/Formatted-numeric-output new file mode 120000 index 0000000000..de125c08d5 --- /dev/null +++ b/Lang/AppleScript/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Hello-world-Newbie b/Lang/AppleScript/Hello-world-Newbie new file mode 120000 index 0000000000..251b56564d --- /dev/null +++ b/Lang/AppleScript/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Horners-rule-for-polynomial-evaluation b/Lang/AppleScript/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..b014f0231a --- /dev/null +++ b/Lang/AppleScript/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Logical-operations b/Lang/AppleScript/Logical-operations new file mode 120000 index 0000000000..f381ea6d80 --- /dev/null +++ b/Lang/AppleScript/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Loops-N-plus-one-half b/Lang/AppleScript/Loops-N-plus-one-half new file mode 120000 index 0000000000..c9ebbc6d6f --- /dev/null +++ b/Lang/AppleScript/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Loops-Wrong-ranges b/Lang/AppleScript/Loops-Wrong-ranges new file mode 120000 index 0000000000..30ead650a7 --- /dev/null +++ b/Lang/AppleScript/Loops-Wrong-ranges @@ -0,0 +1 @@ +../../Task/Loops-Wrong-ranges/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Magic-constant b/Lang/AppleScript/Magic-constant new file mode 120000 index 0000000000..103e56a841 --- /dev/null +++ b/Lang/AppleScript/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Monte-Carlo-methods b/Lang/AppleScript/Monte-Carlo-methods new file mode 120000 index 0000000000..a3fd9d8a00 --- /dev/null +++ b/Lang/AppleScript/Monte-Carlo-methods @@ -0,0 +1 @@ +../../Task/Monte-Carlo-methods/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Multifactorial b/Lang/AppleScript/Multifactorial new file mode 120000 index 0000000000..9d3c79cdc6 --- /dev/null +++ b/Lang/AppleScript/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Naming-conventions b/Lang/AppleScript/Naming-conventions new file mode 120000 index 0000000000..bd6fd7dc7b --- /dev/null +++ b/Lang/AppleScript/Naming-conventions @@ -0,0 +1 @@ +../../Task/Naming-conventions/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Nim-game b/Lang/AppleScript/Nim-game new file mode 120000 index 0000000000..f67182813f --- /dev/null +++ b/Lang/AppleScript/Nim-game @@ -0,0 +1 @@ +../../Task/Nim-game/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Nth-root b/Lang/AppleScript/Nth-root new file mode 120000 index 0000000000..24be4fbbed --- /dev/null +++ b/Lang/AppleScript/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Numerical-integration b/Lang/AppleScript/Numerical-integration new file mode 120000 index 0000000000..2cd0b2ae37 --- /dev/null +++ b/Lang/AppleScript/Numerical-integration @@ -0,0 +1 @@ +../../Task/Numerical-integration/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Penneys-game b/Lang/AppleScript/Penneys-game new file mode 120000 index 0000000000..8e49dba4f9 --- /dev/null +++ b/Lang/AppleScript/Penneys-game @@ -0,0 +1 @@ +../../Task/Penneys-game/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Pig-the-dice-game b/Lang/AppleScript/Pig-the-dice-game new file mode 120000 index 0000000000..db35af118f --- /dev/null +++ b/Lang/AppleScript/Pig-the-dice-game @@ -0,0 +1 @@ +../../Task/Pig-the-dice-game/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Program-name b/Lang/AppleScript/Program-name new file mode 120000 index 0000000000..08ec2ad4f8 --- /dev/null +++ b/Lang/AppleScript/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Real-constants-and-functions b/Lang/AppleScript/Real-constants-and-functions new file mode 120000 index 0000000000..4a6c0f5db0 --- /dev/null +++ b/Lang/AppleScript/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Return-multiple-values b/Lang/AppleScript/Return-multiple-values new file mode 120000 index 0000000000..f507a094fb --- /dev/null +++ b/Lang/AppleScript/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Send-email b/Lang/AppleScript/Send-email new file mode 120000 index 0000000000..4ba0780be8 --- /dev/null +++ b/Lang/AppleScript/Send-email @@ -0,0 +1 @@ +../../Task/Send-email/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Sorting-algorithms-Stooge-sort b/Lang/AppleScript/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..56b9196ffc --- /dev/null +++ b/Lang/AppleScript/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Textonyms b/Lang/AppleScript/Textonyms new file mode 120000 index 0000000000..e51af23b62 --- /dev/null +++ b/Lang/AppleScript/Textonyms @@ -0,0 +1 @@ +../../Task/Textonyms/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Variable-declaration-reset b/Lang/AppleScript/Variable-declaration-reset new file mode 120000 index 0000000000..3059dd090c --- /dev/null +++ b/Lang/AppleScript/Variable-declaration-reset @@ -0,0 +1 @@ +../../Task/Variable-declaration-reset/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Write-entire-file b/Lang/AppleScript/Write-entire-file new file mode 120000 index 0000000000..5be6a2da0d --- /dev/null +++ b/Lang/AppleScript/Write-entire-file @@ -0,0 +1 @@ +../../Task/Write-entire-file/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Write-float-arrays-to-a-text-file b/Lang/AppleScript/Write-float-arrays-to-a-text-file new file mode 120000 index 0000000000..d7524dd990 --- /dev/null +++ b/Lang/AppleScript/Write-float-arrays-to-a-text-file @@ -0,0 +1 @@ +../../Task/Write-float-arrays-to-a-text-file/AppleScript \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/00-LANG.txt b/Lang/Applesoft-BASIC/00-LANG.txt index b47ab777d1..854387033b 100644 --- a/Lang/Applesoft-BASIC/00-LANG.txt +++ b/Lang/Applesoft-BASIC/00-LANG.txt @@ -7,4 +7,5 @@ * [[wp:Applesoft BASIC|Wikipedia: Applesoft BASIC]] * [http://www.landsnail.com/a2ref.htm Apple II Programmer's Reference] from ][ In a Mac, via [http://www.landsnail.com/ Landsnail.com] * [http://www.hoist-point.com/applesoft_basic_tutorial.htm AppleSoft BASIC tutorial for absolute beginners] +* [https://www.calormen.com/jsbasic/ Applesoft BASIC in Javascript] On-line interpreter * ''[[Tasks not implemented in Applesoft BASIC|Tasks not implemented in Applesoft BASIC]]'' \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Catalan-numbers-Pascals-triangle b/Lang/Applesoft-BASIC/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..7b0441411f --- /dev/null +++ b/Lang/Applesoft-BASIC/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Check-output-device-is-a-terminal b/Lang/Applesoft-BASIC/Check-output-device-is-a-terminal new file mode 120000 index 0000000000..e21d34eceb --- /dev/null +++ b/Lang/Applesoft-BASIC/Check-output-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-output-device-is-a-terminal/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Church-numerals b/Lang/Applesoft-BASIC/Church-numerals new file mode 120000 index 0000000000..a114e6a3f9 --- /dev/null +++ b/Lang/Applesoft-BASIC/Church-numerals @@ -0,0 +1 @@ +../../Task/Church-numerals/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Cistercian-numerals b/Lang/Applesoft-BASIC/Cistercian-numerals new file mode 120000 index 0000000000..2c5e6c52c1 --- /dev/null +++ b/Lang/Applesoft-BASIC/Cistercian-numerals @@ -0,0 +1 @@ +../../Task/Cistercian-numerals/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Compare-a-list-of-strings b/Lang/Applesoft-BASIC/Compare-a-list-of-strings new file mode 120000 index 0000000000..7eafe8f723 --- /dev/null +++ b/Lang/Applesoft-BASIC/Compare-a-list-of-strings @@ -0,0 +1 @@ +../../Task/Compare-a-list-of-strings/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Determine-if-a-string-is-collapsible b/Lang/Applesoft-BASIC/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..02f9d8d440 --- /dev/null +++ b/Lang/Applesoft-BASIC/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Determine-if-a-string-is-squeezable b/Lang/Applesoft-BASIC/Determine-if-a-string-is-squeezable new file mode 120000 index 0000000000..b18de01c9a --- /dev/null +++ b/Lang/Applesoft-BASIC/Determine-if-a-string-is-squeezable @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-squeezable/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Display-a-linear-combination b/Lang/Applesoft-BASIC/Display-a-linear-combination new file mode 120000 index 0000000000..d72f6d3a78 --- /dev/null +++ b/Lang/Applesoft-BASIC/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Dragon-curve b/Lang/Applesoft-BASIC/Dragon-curve new file mode 120000 index 0000000000..89a81bf5e7 --- /dev/null +++ b/Lang/Applesoft-BASIC/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Draw-a-pixel b/Lang/Applesoft-BASIC/Draw-a-pixel new file mode 120000 index 0000000000..7ca9518328 --- /dev/null +++ b/Lang/Applesoft-BASIC/Draw-a-pixel @@ -0,0 +1 @@ +../../Task/Draw-a-pixel/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Enumerations b/Lang/Applesoft-BASIC/Enumerations new file mode 120000 index 0000000000..aa327448dc --- /dev/null +++ b/Lang/Applesoft-BASIC/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Euler-method b/Lang/Applesoft-BASIC/Euler-method new file mode 120000 index 0000000000..4ae359e855 --- /dev/null +++ b/Lang/Applesoft-BASIC/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Eulers-sum-of-powers-conjecture b/Lang/Applesoft-BASIC/Eulers-sum-of-powers-conjecture new file mode 120000 index 0000000000..814a94e748 --- /dev/null +++ b/Lang/Applesoft-BASIC/Eulers-sum-of-powers-conjecture @@ -0,0 +1 @@ +../../Task/Eulers-sum-of-powers-conjecture/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Fibonacci-sequence b/Lang/Applesoft-BASIC/Fibonacci-sequence new file mode 120000 index 0000000000..f95390f3d5 --- /dev/null +++ b/Lang/Applesoft-BASIC/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Formatted-numeric-output b/Lang/Applesoft-BASIC/Formatted-numeric-output new file mode 120000 index 0000000000..52c4ceb520 --- /dev/null +++ b/Lang/Applesoft-BASIC/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/LZW-compression b/Lang/Applesoft-BASIC/LZW-compression new file mode 120000 index 0000000000..b2b0a00f3d --- /dev/null +++ b/Lang/Applesoft-BASIC/LZW-compression @@ -0,0 +1 @@ +../../Task/LZW-compression/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Levenshtein-distance b/Lang/Applesoft-BASIC/Levenshtein-distance new file mode 120000 index 0000000000..890eb3e044 --- /dev/null +++ b/Lang/Applesoft-BASIC/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Modular-inverse b/Lang/Applesoft-BASIC/Modular-inverse new file mode 120000 index 0000000000..d8b60109c6 --- /dev/null +++ b/Lang/Applesoft-BASIC/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Monty-Hall-problem b/Lang/Applesoft-BASIC/Monty-Hall-problem new file mode 120000 index 0000000000..6e0ff7bcb9 --- /dev/null +++ b/Lang/Applesoft-BASIC/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Multi-dimensional-array b/Lang/Applesoft-BASIC/Multi-dimensional-array new file mode 120000 index 0000000000..c47a96b8ff --- /dev/null +++ b/Lang/Applesoft-BASIC/Multi-dimensional-array @@ -0,0 +1 @@ +../../Task/Multi-dimensional-array/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/N-queens-problem b/Lang/Applesoft-BASIC/N-queens-problem new file mode 120000 index 0000000000..be2c30d0bc --- /dev/null +++ b/Lang/Applesoft-BASIC/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Phrase-reversals b/Lang/Applesoft-BASIC/Phrase-reversals new file mode 120000 index 0000000000..2fbcdc7099 --- /dev/null +++ b/Lang/Applesoft-BASIC/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Pig-the-dice-game b/Lang/Applesoft-BASIC/Pig-the-dice-game new file mode 120000 index 0000000000..47c16eca5c --- /dev/null +++ b/Lang/Applesoft-BASIC/Pig-the-dice-game @@ -0,0 +1 @@ +../../Task/Pig-the-dice-game/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Recamans-sequence b/Lang/Applesoft-BASIC/Recamans-sequence new file mode 120000 index 0000000000..1d370af4f0 --- /dev/null +++ b/Lang/Applesoft-BASIC/Recamans-sequence @@ -0,0 +1 @@ +../../Task/Recamans-sequence/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Rep-string b/Lang/Applesoft-BASIC/Rep-string new file mode 120000 index 0000000000..ba7d92f8da --- /dev/null +++ b/Lang/Applesoft-BASIC/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Repeat b/Lang/Applesoft-BASIC/Repeat new file mode 120000 index 0000000000..eb0c08d923 --- /dev/null +++ b/Lang/Applesoft-BASIC/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Run-length-encoding b/Lang/Applesoft-BASIC/Run-length-encoding new file mode 120000 index 0000000000..a4ba69544f --- /dev/null +++ b/Lang/Applesoft-BASIC/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Simple-database b/Lang/Applesoft-BASIC/Simple-database new file mode 120000 index 0000000000..fdb38917dd --- /dev/null +++ b/Lang/Applesoft-BASIC/Simple-database @@ -0,0 +1 @@ +../../Task/Simple-database/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Sorting-algorithms-Gnome-sort b/Lang/Applesoft-BASIC/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..4b7c42e62c --- /dev/null +++ b/Lang/Applesoft-BASIC/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/String-interpolation-included- b/Lang/Applesoft-BASIC/String-interpolation-included- new file mode 120000 index 0000000000..c235a3fcea --- /dev/null +++ b/Lang/Applesoft-BASIC/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Tau-number b/Lang/Applesoft-BASIC/Tau-number new file mode 120000 index 0000000000..de08050f6a --- /dev/null +++ b/Lang/Applesoft-BASIC/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Towers-of-Hanoi b/Lang/Applesoft-BASIC/Towers-of-Hanoi new file mode 120000 index 0000000000..7e7bc24b30 --- /dev/null +++ b/Lang/Applesoft-BASIC/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Aquarius-BASIC/00-LANG.txt b/Lang/Aquarius-BASIC/00-LANG.txt index 787837afb3..1314ae0882 100644 --- a/Lang/Aquarius-BASIC/00-LANG.txt +++ b/Lang/Aquarius-BASIC/00-LANG.txt @@ -2,4 +2,37 @@ |exec=interpreted |tags=basic,aquariusbasic }} -{{Implementation|BASIC}}'''Aquarius BASIC''' refers to the more or less stripped-down releases of Microsoft BASIC for the Mattel/Radofin Aquarius. The built-in ROM BASIC was seriously restricted since the system only included 4K of RAM and 8K of ROM by default. Minus the RAM used for video and system management, only about 1.7K or RAM were usable by default; the optionally available Extended Microsoft BASIC that came on ROM cartridge was somewhat more generous, and RAM expansion cartridges were available. \ No newline at end of file +{{Implementation|BASIC}}'''Aquarius BASIC''' refers to the more or less stripped-down releases of Microsoft BASIC for the Mattel/Radofin Aquarius, a home computer released in 1983. + +The built-in ROM BASIC was seriously restricted since the system only included 4K of RAM and 8K of ROM by default. Minus the RAM used for video and system management, only about 1.7K of RAM were usable by default; the optionally available Extended Microsoft BASIC that came on ROM cartridge was somewhat more generous, and RAM expansion cartridges were available. + +BASIC lines can be a maximum of 72 characters long. Only the first two characters of a variable name are significant, so e.g. ABC and ABBA will contain the same value: + +10 ABC=3 +20 ABBA=5 +30 PRINT ABC;ABBA +RUN + 5 5 + +The Aquarius features a text-mode screen of 40x25 characters with 16 colors. BASIC only uses 38x24 characters, i.e. the row at the top and the two outermost columns on each side are not accessible when editing, PRINTing, or LISTing. However, all 40x25 characters can be modified via POKEs from BASIC to screen memory. + +Screen character memory starts at 0x3000 (12288); color RAM (with high nibble = foreground color; low nibble = background color) starts at 0x3400 (12288 + 1024 = 13312). Border color can be set by POKEing to the top left character, e.g. POKE 13312,7 will turn the border color to white. BASIC programs start at 0x3901.[https://www.vdsteenoven.com/aquarius/malloc.html] + +BASIC can set and unset 80x72-resolution pixels on the Aquarius with the PSET and PRESET commands (each text character consists of 2x3 pixels). This program for instance draws an ellipsis: +10 PRINT CHR$(11); +20 PI=3.141593 : R=30 +30 FOR I=0 TO 360 +40 X=R*SIN(I*PI/180) +50 Y=R*COS(I*PI/180) +60 PSET(39+X,35+Y) +70 NEXT + +The Aquarius character set cannot be redefined. + +By default, the total space for string variables is only 50 bytes! This can be increased with CLEAR, e.g. CLEAR 200 will reserve 200 bytes for strings. You can check with PRINT FRE("a") how much unused string space is still available. + +Emulators of the Mattel Aquarius include MAME and [https://aquarius.je/aqualite/ AquaLite]. + +==See Also== +* [[wp:Mattel Aquarius|Mattel Aquarius]] at Wikipedia +* [https://archive.org/search?query=mattel+aquarius Aquarius manuals at the Internet Archive] \ No newline at end of file diff --git a/Lang/Aquarius-BASIC/Archimedean-spiral b/Lang/Aquarius-BASIC/Archimedean-spiral new file mode 120000 index 0000000000..a52a300e36 --- /dev/null +++ b/Lang/Aquarius-BASIC/Archimedean-spiral @@ -0,0 +1 @@ +../../Task/Archimedean-spiral/Aquarius-BASIC \ No newline at end of file diff --git a/Lang/Aquarius-BASIC/Colour-bars-Display b/Lang/Aquarius-BASIC/Colour-bars-Display new file mode 120000 index 0000000000..5113e0e205 --- /dev/null +++ b/Lang/Aquarius-BASIC/Colour-bars-Display @@ -0,0 +1 @@ +../../Task/Colour-bars-Display/Aquarius-BASIC \ No newline at end of file diff --git a/Lang/Aquarius-BASIC/Mandelbrot-set b/Lang/Aquarius-BASIC/Mandelbrot-set new file mode 120000 index 0000000000..e078ca10a9 --- /dev/null +++ b/Lang/Aquarius-BASIC/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/Aquarius-BASIC \ No newline at end of file diff --git a/Lang/Aquarius-BASIC/Matrix-digital-rain b/Lang/Aquarius-BASIC/Matrix-digital-rain new file mode 120000 index 0000000000..227ab761a1 --- /dev/null +++ b/Lang/Aquarius-BASIC/Matrix-digital-rain @@ -0,0 +1 @@ +../../Task/Matrix-digital-rain/Aquarius-BASIC \ No newline at end of file diff --git a/Lang/Aquarius-BASIC/Musical-scale b/Lang/Aquarius-BASIC/Musical-scale new file mode 120000 index 0000000000..16fb0326f5 --- /dev/null +++ b/Lang/Aquarius-BASIC/Musical-scale @@ -0,0 +1 @@ +../../Task/Musical-scale/Aquarius-BASIC \ No newline at end of file diff --git a/Lang/Aquarius-BASIC/Terminal-control-Display-an-extended-character b/Lang/Aquarius-BASIC/Terminal-control-Display-an-extended-character new file mode 120000 index 0000000000..908e3614b8 --- /dev/null +++ b/Lang/Aquarius-BASIC/Terminal-control-Display-an-extended-character @@ -0,0 +1 @@ +../../Task/Terminal-control-Display-an-extended-character/Aquarius-BASIC \ No newline at end of file diff --git a/Lang/Aria/00-LANG.txt b/Lang/Aria/00-LANG.txt new file mode 100644 index 0000000000..f3d1668eba --- /dev/null +++ b/Lang/Aria/00-LANG.txt @@ -0,0 +1,15 @@ +{{language +|exec=interpreted +|site=https://egranata.github.io/aria/ +}} + +Aria is a modern, dynamic scripting language. It is meant to be a “sweet spot” language, easy to pick-up and enjoyable to use. + +It provides a familiar C-style syntax, with a feature set inspired by well-beloved languages such as Python and Rust. It comes with little ceremony and a focus on getting stuff done. + +Aria programs are written as .aria files and passed to the Aria virtual machine, which compiles them down to bytecode and executes them. + +The Aria interpreter is written in Rust, 2024 edition. + +==Todo== +[[Tasks_not_implemented_in_Aria]] \ No newline at end of file diff --git a/Lang/Aria/00-META.yaml b/Lang/Aria/00-META.yaml new file mode 100644 index 0000000000..35ebadd91a --- /dev/null +++ b/Lang/Aria/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Aria diff --git a/Lang/Aria/99-bottles-of-beer b/Lang/Aria/99-bottles-of-beer new file mode 120000 index 0000000000..c2f486227d --- /dev/null +++ b/Lang/Aria/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/Aria \ No newline at end of file diff --git a/Lang/Aria/Hello-world-Text b/Lang/Aria/Hello-world-Text new file mode 120000 index 0000000000..bb8e1db7a7 --- /dev/null +++ b/Lang/Aria/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Aria \ No newline at end of file diff --git a/Lang/ArkScript/00-LANG.txt b/Lang/ArkScript/00-LANG.txt new file mode 100644 index 0000000000..11fc16bd5b --- /dev/null +++ b/Lang/ArkScript/00-LANG.txt @@ -0,0 +1,43 @@ +{{language|ArkScript +|exec=bytecode +|site=https://arkscript-lang.dev +|gc=no +|parampass=value +|strength=strong +|checking=dynamic +|tags=arkscript}} +ArkScript is a small, fast, functional and scripting language for C++ projects, inspired by [[Lua]], [[Lisp]], and [[Python]]. + +The language has been designed to be concise, with only 9 keywords, and two rules to parse it: +# the first node after an opening paren ( is a "function", the following nodes are arguments +# the only exception to the previous rule is when defining the argument list of a function + + +(let foo 5) +(let bar "hello world!") + +(let egg (fun (a b c) + (+ a (* b c)))) + +(print (egg 1 foo bar)) + + +The language is also +* small: the core fit under 8000 lines of code ; also small in terms of keywords (only 9) +* a scripting language: very easy to embed it in your projects. Registering your own functions in the language is made easy +* portable: a unique bytecode which can be run everywhere the virtual machine is +* a functional language: every parameter is passed by value, everything is immutable unless specified +* powerful: provides closures and explicit capture +* promoting functionalities before performances: expressiveness often brings more productivity, though performances aren't left behind +* a Lisp inspired language, with fewer parentheses: [...] is expanded to (list ...) and {} to (begin ...) +* extensible: supports C++ module to use it in the language, adding functionalities + + +===Implementation=== +The compiler and VM are implemented in [[C++]] 20. For more details, see [https://github.com/ArkScript-lang/Ark ArkScript GitHub]. + +===License=== +ArkScript is released under the Mozilla Public License 2.0. + +===Todo=== +[[Tasks not implemented in ArkScript]] \ No newline at end of file diff --git a/Lang/ArkScript/00-META.yaml b/Lang/ArkScript/00-META.yaml new file mode 100644 index 0000000000..0a989734f8 --- /dev/null +++ b/Lang/ArkScript/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:ArkScript diff --git a/Lang/ArkScript/100-doors b/Lang/ArkScript/100-doors new file mode 120000 index 0000000000..733c5ecdec --- /dev/null +++ b/Lang/ArkScript/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/99-bottles-of-beer b/Lang/ArkScript/99-bottles-of-beer new file mode 120000 index 0000000000..44d94215f1 --- /dev/null +++ b/Lang/ArkScript/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/A+B b/Lang/ArkScript/A+B new file mode 120000 index 0000000000..482decfa5a --- /dev/null +++ b/Lang/ArkScript/A+B @@ -0,0 +1 @@ +../../Task/A+B/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Abbreviations-easy b/Lang/ArkScript/Abbreviations-easy new file mode 120000 index 0000000000..03457b23d1 --- /dev/null +++ b/Lang/ArkScript/Abbreviations-easy @@ -0,0 +1 @@ +../../Task/Abbreviations-easy/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Ackermann-function b/Lang/ArkScript/Ackermann-function new file mode 120000 index 0000000000..f1f525fde6 --- /dev/null +++ b/Lang/ArkScript/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Anonymous-recursion b/Lang/ArkScript/Anonymous-recursion new file mode 120000 index 0000000000..c2db291cc2 --- /dev/null +++ b/Lang/ArkScript/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Apply-a-callback-to-an-array b/Lang/ArkScript/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..da474aa4d7 --- /dev/null +++ b/Lang/ArkScript/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Arithmetic-Complex b/Lang/ArkScript/Arithmetic-Complex new file mode 120000 index 0000000000..c21a1d5bf8 --- /dev/null +++ b/Lang/ArkScript/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Arithmetic-Integer b/Lang/ArkScript/Arithmetic-Integer new file mode 120000 index 0000000000..0023796f90 --- /dev/null +++ b/Lang/ArkScript/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Array-concatenation b/Lang/ArkScript/Array-concatenation new file mode 120000 index 0000000000..250e35894f --- /dev/null +++ b/Lang/ArkScript/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Array-length b/Lang/ArkScript/Array-length new file mode 120000 index 0000000000..f70d67437b --- /dev/null +++ b/Lang/ArkScript/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Ascending-primes b/Lang/ArkScript/Ascending-primes new file mode 120000 index 0000000000..9fc34de6f6 --- /dev/null +++ b/Lang/ArkScript/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Associative-array-Creation b/Lang/ArkScript/Associative-array-Creation new file mode 120000 index 0000000000..2a5f3a1e53 --- /dev/null +++ b/Lang/ArkScript/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Associative-array-Iteration b/Lang/ArkScript/Associative-array-Iteration new file mode 120000 index 0000000000..f11b39f9bb --- /dev/null +++ b/Lang/ArkScript/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Associative-array-Merging b/Lang/ArkScript/Associative-array-Merging new file mode 120000 index 0000000000..03affb97ec --- /dev/null +++ b/Lang/ArkScript/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Balanced-brackets b/Lang/ArkScript/Balanced-brackets new file mode 120000 index 0000000000..7380d4a234 --- /dev/null +++ b/Lang/ArkScript/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Boolean-values b/Lang/ArkScript/Boolean-values new file mode 120000 index 0000000000..5efbe13431 --- /dev/null +++ b/Lang/ArkScript/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Calculating-the-value-of-e b/Lang/ArkScript/Calculating-the-value-of-e new file mode 120000 index 0000000000..0a0116531f --- /dev/null +++ b/Lang/ArkScript/Calculating-the-value-of-e @@ -0,0 +1 @@ +../../Task/Calculating-the-value-of-e/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Call-a-function b/Lang/ArkScript/Call-a-function new file mode 120000 index 0000000000..4d2870d9cb --- /dev/null +++ b/Lang/ArkScript/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Call-an-object-method b/Lang/ArkScript/Call-an-object-method new file mode 120000 index 0000000000..9b53aa0595 --- /dev/null +++ b/Lang/ArkScript/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Catamorphism b/Lang/ArkScript/Catamorphism new file mode 120000 index 0000000000..f6210b0ec4 --- /dev/null +++ b/Lang/ArkScript/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Character-codes b/Lang/ArkScript/Character-codes new file mode 120000 index 0000000000..fcf79b3e9a --- /dev/null +++ b/Lang/ArkScript/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Check-that-file-exists b/Lang/ArkScript/Check-that-file-exists new file mode 120000 index 0000000000..7e3651c090 --- /dev/null +++ b/Lang/ArkScript/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Closures-Value-capture b/Lang/ArkScript/Closures-Value-capture new file mode 120000 index 0000000000..6b30a8d976 --- /dev/null +++ b/Lang/ArkScript/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Command-line-arguments b/Lang/ArkScript/Command-line-arguments new file mode 120000 index 0000000000..216020915c --- /dev/null +++ b/Lang/ArkScript/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Comments b/Lang/ArkScript/Comments new file mode 120000 index 0000000000..360a2acb05 --- /dev/null +++ b/Lang/ArkScript/Comments @@ -0,0 +1 @@ +../../Task/Comments/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Compound-data-type b/Lang/ArkScript/Compound-data-type new file mode 120000 index 0000000000..a901531424 --- /dev/null +++ b/Lang/ArkScript/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Concurrent-computing b/Lang/ArkScript/Concurrent-computing new file mode 120000 index 0000000000..13a2e9c874 --- /dev/null +++ b/Lang/ArkScript/Concurrent-computing @@ -0,0 +1 @@ +../../Task/Concurrent-computing/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Conditional-structures b/Lang/ArkScript/Conditional-structures new file mode 120000 index 0000000000..10a922af53 --- /dev/null +++ b/Lang/ArkScript/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Conways-Game-of-Life b/Lang/ArkScript/Conways-Game-of-Life new file mode 120000 index 0000000000..2d495d7699 --- /dev/null +++ b/Lang/ArkScript/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Copy-a-string b/Lang/ArkScript/Copy-a-string new file mode 120000 index 0000000000..88194e46fb --- /dev/null +++ b/Lang/ArkScript/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Count-occurrences-of-a-substring b/Lang/ArkScript/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..da5c9db0d2 --- /dev/null +++ b/Lang/ArkScript/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Currying b/Lang/ArkScript/Currying new file mode 120000 index 0000000000..68a7b93b42 --- /dev/null +++ b/Lang/ArkScript/Currying @@ -0,0 +1 @@ +../../Task/Currying/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Delete-a-file b/Lang/ArkScript/Delete-a-file new file mode 120000 index 0000000000..d6dbc3ecd5 --- /dev/null +++ b/Lang/ArkScript/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Dot-product b/Lang/ArkScript/Dot-product new file mode 120000 index 0000000000..0ee74f8b5a --- /dev/null +++ b/Lang/ArkScript/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Empty-directory b/Lang/ArkScript/Empty-directory new file mode 120000 index 0000000000..5ade8a3b8b --- /dev/null +++ b/Lang/ArkScript/Empty-directory @@ -0,0 +1 @@ +../../Task/Empty-directory/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Empty-program b/Lang/ArkScript/Empty-program new file mode 120000 index 0000000000..d33db3e33c --- /dev/null +++ b/Lang/ArkScript/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Empty-string b/Lang/ArkScript/Empty-string new file mode 120000 index 0000000000..aa29f38546 --- /dev/null +++ b/Lang/ArkScript/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Enforced-immutability b/Lang/ArkScript/Enforced-immutability new file mode 120000 index 0000000000..c12069d86c --- /dev/null +++ b/Lang/ArkScript/Enforced-immutability @@ -0,0 +1 @@ +../../Task/Enforced-immutability/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Even-or-odd b/Lang/ArkScript/Even-or-odd new file mode 120000 index 0000000000..7aee966d84 --- /dev/null +++ b/Lang/ArkScript/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Execute-a-system-command b/Lang/ArkScript/Execute-a-system-command new file mode 120000 index 0000000000..ab936f59d4 --- /dev/null +++ b/Lang/ArkScript/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Extend-your-language b/Lang/ArkScript/Extend-your-language new file mode 120000 index 0000000000..08fabf671d --- /dev/null +++ b/Lang/ArkScript/Extend-your-language @@ -0,0 +1 @@ +../../Task/Extend-your-language/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Factorial b/Lang/ArkScript/Factorial new file mode 120000 index 0000000000..270de2c6be --- /dev/null +++ b/Lang/ArkScript/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Fibonacci-sequence b/Lang/ArkScript/Fibonacci-sequence new file mode 120000 index 0000000000..46f2bbba10 --- /dev/null +++ b/Lang/ArkScript/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/File-input-output b/Lang/ArkScript/File-input-output new file mode 120000 index 0000000000..f2e1e6b1be --- /dev/null +++ b/Lang/ArkScript/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Filter b/Lang/ArkScript/Filter new file mode 120000 index 0000000000..51c30a5235 --- /dev/null +++ b/Lang/ArkScript/Filter @@ -0,0 +1 @@ +../../Task/Filter/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/FizzBuzz b/Lang/ArkScript/FizzBuzz new file mode 120000 index 0000000000..2464c5dcce --- /dev/null +++ b/Lang/ArkScript/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Flatten-a-list b/Lang/ArkScript/Flatten-a-list new file mode 120000 index 0000000000..8540eceb42 --- /dev/null +++ b/Lang/ArkScript/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Function-definition b/Lang/ArkScript/Function-definition new file mode 120000 index 0000000000..e750f72eaf --- /dev/null +++ b/Lang/ArkScript/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Generate-lower-case-ASCII-alphabet b/Lang/ArkScript/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..9cae72db7e --- /dev/null +++ b/Lang/ArkScript/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Greatest-element-of-a-list b/Lang/ArkScript/Greatest-element-of-a-list new file mode 120000 index 0000000000..d8bc7be88e --- /dev/null +++ b/Lang/ArkScript/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Hello-world-Line-printer b/Lang/ArkScript/Hello-world-Line-printer new file mode 120000 index 0000000000..205cc44ef5 --- /dev/null +++ b/Lang/ArkScript/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Hello-world-Newline-omission b/Lang/ArkScript/Hello-world-Newline-omission new file mode 120000 index 0000000000..e70990b485 --- /dev/null +++ b/Lang/ArkScript/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Hello-world-Text b/Lang/ArkScript/Hello-world-Text new file mode 120000 index 0000000000..efe7845aa7 --- /dev/null +++ b/Lang/ArkScript/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Include-a-file b/Lang/ArkScript/Include-a-file new file mode 120000 index 0000000000..ebb4a807d7 --- /dev/null +++ b/Lang/ArkScript/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Infinity b/Lang/ArkScript/Infinity new file mode 120000 index 0000000000..e2ef2bf985 --- /dev/null +++ b/Lang/ArkScript/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Integer-comparison b/Lang/ArkScript/Integer-comparison new file mode 120000 index 0000000000..6396856212 --- /dev/null +++ b/Lang/ArkScript/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Integer-sequence b/Lang/ArkScript/Integer-sequence new file mode 120000 index 0000000000..386017d017 --- /dev/null +++ b/Lang/ArkScript/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Letter-frequency b/Lang/ArkScript/Letter-frequency new file mode 120000 index 0000000000..5c5906f290 --- /dev/null +++ b/Lang/ArkScript/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Literals-Floating-point b/Lang/ArkScript/Literals-Floating-point new file mode 120000 index 0000000000..5bc172fabe --- /dev/null +++ b/Lang/ArkScript/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Literals-Integer b/Lang/ArkScript/Literals-Integer new file mode 120000 index 0000000000..b313b7f803 --- /dev/null +++ b/Lang/ArkScript/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Literals-String b/Lang/ArkScript/Literals-String new file mode 120000 index 0000000000..ec507deee1 --- /dev/null +++ b/Lang/ArkScript/Literals-String @@ -0,0 +1 @@ +../../Task/Literals-String/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Logical-operations b/Lang/ArkScript/Logical-operations new file mode 120000 index 0000000000..aaefe48457 --- /dev/null +++ b/Lang/ArkScript/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Loops-While b/Lang/ArkScript/Loops-While new file mode 120000 index 0000000000..5f0c886bc8 --- /dev/null +++ b/Lang/ArkScript/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Middle-three-digits b/Lang/ArkScript/Middle-three-digits new file mode 120000 index 0000000000..71c7fc7a98 --- /dev/null +++ b/Lang/ArkScript/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Munchausen-numbers b/Lang/ArkScript/Munchausen-numbers new file mode 120000 index 0000000000..c351968c20 --- /dev/null +++ b/Lang/ArkScript/Munchausen-numbers @@ -0,0 +1 @@ +../../Task/Munchausen-numbers/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/N-queens-problem b/Lang/ArkScript/N-queens-problem new file mode 120000 index 0000000000..e917f9e593 --- /dev/null +++ b/Lang/ArkScript/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Nested-function b/Lang/ArkScript/Nested-function new file mode 120000 index 0000000000..85ce060fae --- /dev/null +++ b/Lang/ArkScript/Nested-function @@ -0,0 +1 @@ +../../Task/Nested-function/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Null-object b/Lang/ArkScript/Null-object new file mode 120000 index 0000000000..a698a2ff71 --- /dev/null +++ b/Lang/ArkScript/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Pangram-checker b/Lang/ArkScript/Pangram-checker new file mode 120000 index 0000000000..db321bb4cb --- /dev/null +++ b/Lang/ArkScript/Pangram-checker @@ -0,0 +1 @@ +../../Task/Pangram-checker/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Pick-random-element b/Lang/ArkScript/Pick-random-element new file mode 120000 index 0000000000..be2e5037b3 --- /dev/null +++ b/Lang/ArkScript/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Program-name b/Lang/ArkScript/Program-name new file mode 120000 index 0000000000..c48917f3b8 --- /dev/null +++ b/Lang/ArkScript/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Program-termination b/Lang/ArkScript/Program-termination new file mode 120000 index 0000000000..19d9d120f6 --- /dev/null +++ b/Lang/ArkScript/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Read-entire-file b/Lang/ArkScript/Read-entire-file new file mode 120000 index 0000000000..e3a1c22530 --- /dev/null +++ b/Lang/ArkScript/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Repeat-a-string b/Lang/ArkScript/Repeat-a-string new file mode 120000 index 0000000000..ed7c4e98d3 --- /dev/null +++ b/Lang/ArkScript/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Reverse-a-string b/Lang/ArkScript/Reverse-a-string new file mode 120000 index 0000000000..a3a2ea0c27 --- /dev/null +++ b/Lang/ArkScript/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Semordnilap b/Lang/ArkScript/Semordnilap new file mode 120000 index 0000000000..25df93d2d3 --- /dev/null +++ b/Lang/ArkScript/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Shell-one-liner b/Lang/ArkScript/Shell-one-liner new file mode 120000 index 0000000000..889b436427 --- /dev/null +++ b/Lang/ArkScript/Shell-one-liner @@ -0,0 +1 @@ +../../Task/Shell-one-liner/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Short-circuit-evaluation b/Lang/ArkScript/Short-circuit-evaluation new file mode 120000 index 0000000000..dcd4ac26ee --- /dev/null +++ b/Lang/ArkScript/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Show-ASCII-table b/Lang/ArkScript/Show-ASCII-table new file mode 120000 index 0000000000..65d6365487 --- /dev/null +++ b/Lang/ArkScript/Show-ASCII-table @@ -0,0 +1 @@ +../../Task/Show-ASCII-table/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Sleep b/Lang/ArkScript/Sleep new file mode 120000 index 0000000000..cd07cddf41 --- /dev/null +++ b/Lang/ArkScript/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Sorting-algorithms-Quicksort b/Lang/ArkScript/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..003f3fb633 --- /dev/null +++ b/Lang/ArkScript/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Stack b/Lang/ArkScript/Stack new file mode 120000 index 0000000000..f0aa9a05ea --- /dev/null +++ b/Lang/ArkScript/Stack @@ -0,0 +1 @@ +../../Task/Stack/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/String-append b/Lang/ArkScript/String-append new file mode 120000 index 0000000000..ade5a20d23 --- /dev/null +++ b/Lang/ArkScript/String-append @@ -0,0 +1 @@ +../../Task/String-append/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/String-case b/Lang/ArkScript/String-case new file mode 120000 index 0000000000..25e27a4618 --- /dev/null +++ b/Lang/ArkScript/String-case @@ -0,0 +1 @@ +../../Task/String-case/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/String-concatenation b/Lang/ArkScript/String-concatenation new file mode 120000 index 0000000000..999b5605f7 --- /dev/null +++ b/Lang/ArkScript/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/String-interpolation-included- b/Lang/ArkScript/String-interpolation-included- new file mode 120000 index 0000000000..33fa86b906 --- /dev/null +++ b/Lang/ArkScript/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/String-length b/Lang/ArkScript/String-length new file mode 120000 index 0000000000..df129dcc11 --- /dev/null +++ b/Lang/ArkScript/String-length @@ -0,0 +1 @@ +../../Task/String-length/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/String-matching b/Lang/ArkScript/String-matching new file mode 120000 index 0000000000..7558bd042a --- /dev/null +++ b/Lang/ArkScript/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/String-prepend b/Lang/ArkScript/String-prepend new file mode 120000 index 0000000000..083b99bbf0 --- /dev/null +++ b/Lang/ArkScript/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Sum-and-product-of-an-array b/Lang/ArkScript/Sum-and-product-of-an-array new file mode 120000 index 0000000000..4c22ecff5f --- /dev/null +++ b/Lang/ArkScript/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Sum-digits-of-an-integer b/Lang/ArkScript/Sum-digits-of-an-integer new file mode 120000 index 0000000000..29e7afd56c --- /dev/null +++ b/Lang/ArkScript/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Sum-of-a-series b/Lang/ArkScript/Sum-of-a-series new file mode 120000 index 0000000000..f009df3580 --- /dev/null +++ b/Lang/ArkScript/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Sum-of-squares b/Lang/ArkScript/Sum-of-squares new file mode 120000 index 0000000000..85176ac4bb --- /dev/null +++ b/Lang/ArkScript/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Time-a-function b/Lang/ArkScript/Time-a-function new file mode 120000 index 0000000000..e2c1f55e22 --- /dev/null +++ b/Lang/ArkScript/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/User-input-Text b/Lang/ArkScript/User-input-Text new file mode 120000 index 0000000000..f0daf24108 --- /dev/null +++ b/Lang/ArkScript/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Variables b/Lang/ArkScript/Variables new file mode 120000 index 0000000000..f47b9d33ee --- /dev/null +++ b/Lang/ArkScript/Variables @@ -0,0 +1 @@ +../../Task/Variables/ArkScript \ No newline at end of file diff --git a/Lang/ArkScript/Write-entire-file b/Lang/ArkScript/Write-entire-file new file mode 120000 index 0000000000..978c98fba7 --- /dev/null +++ b/Lang/ArkScript/Write-entire-file @@ -0,0 +1 @@ +../../Task/Write-entire-file/ArkScript \ No newline at end of file diff --git a/Lang/Arturo/00-LANG.txt b/Lang/Arturo/00-LANG.txt index e01d1ab72c..7424af10da 100644 --- a/Lang/Arturo/00-LANG.txt +++ b/Lang/Arturo/00-LANG.txt @@ -16,8 +16,8 @@ The language has been designed following some very simple and straightforward pr factorial: function [n][ - if? n > 0 -> n * factorial n-1 - else -> 1 + switch n > 0 -> n * factorial n-1 + -> 1 ] loop 1..19 [x]-> diff --git a/Lang/Arturo/Abstract-type b/Lang/Arturo/Abstract-type new file mode 120000 index 0000000000..d0cab7a251 --- /dev/null +++ b/Lang/Arturo/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Achilles-numbers b/Lang/Arturo/Achilles-numbers new file mode 120000 index 0000000000..14eecef378 --- /dev/null +++ b/Lang/Arturo/Achilles-numbers @@ -0,0 +1 @@ +../../Task/Achilles-numbers/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Arithmetic-derivative b/Lang/Arturo/Arithmetic-derivative new file mode 120000 index 0000000000..d1b6630a6c --- /dev/null +++ b/Lang/Arturo/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Bioinformatics-base-count b/Lang/Arturo/Bioinformatics-base-count deleted file mode 120000 index 6562f48c25..0000000000 --- a/Lang/Arturo/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Bitmap-Bresenhams-line-algorithm b/Lang/Arturo/Bitmap-Bresenhams-line-algorithm new file mode 120000 index 0000000000..903f7d1b02 --- /dev/null +++ b/Lang/Arturo/Bitmap-Bresenhams-line-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Bresenhams-line-algorithm/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Blum-integer b/Lang/Arturo/Blum-integer new file mode 120000 index 0000000000..025a5231e2 --- /dev/null +++ b/Lang/Arturo/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Dice-game-probabilities b/Lang/Arturo/Dice-game-probabilities new file mode 120000 index 0000000000..963933dbf3 --- /dev/null +++ b/Lang/Arturo/Dice-game-probabilities @@ -0,0 +1 @@ +../../Task/Dice-game-probabilities/Arturo \ No newline at end of file diff --git a/Lang/Arturo/EKG-sequence-convergence b/Lang/Arturo/EKG-sequence-convergence new file mode 120000 index 0000000000..0753ff65e6 --- /dev/null +++ b/Lang/Arturo/EKG-sequence-convergence @@ -0,0 +1 @@ +../../Task/EKG-sequence-convergence/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Element-wise-operations b/Lang/Arturo/Element-wise-operations new file mode 120000 index 0000000000..da54867937 --- /dev/null +++ b/Lang/Arturo/Element-wise-operations @@ -0,0 +1 @@ +../../Task/Element-wise-operations/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Entropy-Narcissist b/Lang/Arturo/Entropy-Narcissist new file mode 120000 index 0000000000..a5a91d666a --- /dev/null +++ b/Lang/Arturo/Entropy-Narcissist @@ -0,0 +1 @@ +../../Task/Entropy-Narcissist/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Inheritance-Single b/Lang/Arturo/Inheritance-Single new file mode 120000 index 0000000000..9ea196311d --- /dev/null +++ b/Lang/Arturo/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Magnanimous-numbers b/Lang/Arturo/Magnanimous-numbers new file mode 120000 index 0000000000..c058d4081f --- /dev/null +++ b/Lang/Arturo/Magnanimous-numbers @@ -0,0 +1 @@ +../../Task/Magnanimous-numbers/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Meissel-Mertens-constant b/Lang/Arturo/Meissel-Mertens-constant deleted file mode 120000 index a360b321e1..0000000000 --- a/Lang/Arturo/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Munching-squares b/Lang/Arturo/Munching-squares new file mode 120000 index 0000000000..3d1757b680 --- /dev/null +++ b/Lang/Arturo/Munching-squares @@ -0,0 +1 @@ +../../Task/Munching-squares/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Number-names b/Lang/Arturo/Number-names new file mode 120000 index 0000000000..0265b7a150 --- /dev/null +++ b/Lang/Arturo/Number-names @@ -0,0 +1 @@ +../../Task/Number-names/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Palindromic-gapful-numbers b/Lang/Arturo/Palindromic-gapful-numbers new file mode 120000 index 0000000000..bb7c640247 --- /dev/null +++ b/Lang/Arturo/Palindromic-gapful-numbers @@ -0,0 +1 @@ +../../Task/Palindromic-gapful-numbers/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Quaternion-type b/Lang/Arturo/Quaternion-type deleted file mode 120000 index b96cba3183..0000000000 --- a/Lang/Arturo/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Radical-of-an-integer b/Lang/Arturo/Radical-of-an-integer new file mode 120000 index 0000000000..0b80f4a924 --- /dev/null +++ b/Lang/Arturo/Radical-of-an-integer @@ -0,0 +1 @@ +../../Task/Radical-of-an-integer/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Reflection-List-methods b/Lang/Arturo/Reflection-List-methods new file mode 120000 index 0000000000..b2c29c2e7a --- /dev/null +++ b/Lang/Arturo/Reflection-List-methods @@ -0,0 +1 @@ +../../Task/Reflection-List-methods/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Rosetta-Code-Find-unimplemented-tasks b/Lang/Arturo/Rosetta-Code-Find-unimplemented-tasks new file mode 120000 index 0000000000..6c58da52bd --- /dev/null +++ b/Lang/Arturo/Rosetta-Code-Find-unimplemented-tasks @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Find-unimplemented-tasks/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Sorting-Algorithms-Circle-Sort b/Lang/Arturo/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index fc98e0e878..0000000000 --- a/Lang/Arturo/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Spelling-of-ordinal-numbers b/Lang/Arturo/Spelling-of-ordinal-numbers new file mode 120000 index 0000000000..0d47ac2434 --- /dev/null +++ b/Lang/Arturo/Spelling-of-ordinal-numbers @@ -0,0 +1 @@ +../../Task/Spelling-of-ordinal-numbers/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Super-d-numbers b/Lang/Arturo/Super-d-numbers new file mode 120000 index 0000000000..9c8b511c5d --- /dev/null +++ b/Lang/Arturo/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Taxicab-numbers b/Lang/Arturo/Taxicab-numbers new file mode 120000 index 0000000000..9c84413e59 --- /dev/null +++ b/Lang/Arturo/Taxicab-numbers @@ -0,0 +1 @@ +../../Task/Taxicab-numbers/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Weird-numbers b/Lang/Arturo/Weird-numbers new file mode 120000 index 0000000000..2f062bea69 --- /dev/null +++ b/Lang/Arturo/Weird-numbers @@ -0,0 +1 @@ +../../Task/Weird-numbers/Arturo \ No newline at end of file diff --git a/Lang/Arturo/Zumkeller-numbers b/Lang/Arturo/Zumkeller-numbers new file mode 120000 index 0000000000..b956d7f399 --- /dev/null +++ b/Lang/Arturo/Zumkeller-numbers @@ -0,0 +1 @@ +../../Task/Zumkeller-numbers/Arturo \ No newline at end of file diff --git a/Lang/AsciiDots/Quine b/Lang/AsciiDots/Quine new file mode 120000 index 0000000000..c2090631eb --- /dev/null +++ b/Lang/AsciiDots/Quine @@ -0,0 +1 @@ +../../Task/Quine/AsciiDots \ No newline at end of file diff --git a/Lang/AsciiDots/Write-language-name-in-3D-ASCII b/Lang/AsciiDots/Write-language-name-in-3D-ASCII new file mode 120000 index 0000000000..81b3e17bd1 --- /dev/null +++ b/Lang/AsciiDots/Write-language-name-in-3D-ASCII @@ -0,0 +1 @@ +../../Task/Write-language-name-in-3D-ASCII/AsciiDots \ No newline at end of file diff --git a/Lang/Asymptote/Array-length b/Lang/Asymptote/Array-length new file mode 120000 index 0000000000..017bab2099 --- /dev/null +++ b/Lang/Asymptote/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Day-of-the-week b/Lang/Asymptote/Day-of-the-week new file mode 120000 index 0000000000..f31fd61474 --- /dev/null +++ b/Lang/Asymptote/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Determine-sentence-type b/Lang/Asymptote/Determine-sentence-type new file mode 120000 index 0000000000..250fb5d120 --- /dev/null +++ b/Lang/Asymptote/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Diversity-prediction-theorem b/Lang/Asymptote/Diversity-prediction-theorem new file mode 120000 index 0000000000..4b9f736bd3 --- /dev/null +++ b/Lang/Asymptote/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Empty-program b/Lang/Asymptote/Empty-program deleted file mode 120000 index 5636b8fc49..0000000000 --- a/Lang/Asymptote/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Evaluate-binomial-coefficients b/Lang/Asymptote/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..8408c303d7 --- /dev/null +++ b/Lang/Asymptote/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Factorial b/Lang/Asymptote/Factorial new file mode 120000 index 0000000000..f41eae64eb --- /dev/null +++ b/Lang/Asymptote/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Hello-world-Newline-omission b/Lang/Asymptote/Hello-world-Newline-omission new file mode 120000 index 0000000000..1f04f08bd4 --- /dev/null +++ b/Lang/Asymptote/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Jensens-Device b/Lang/Asymptote/Jensens-Device new file mode 120000 index 0000000000..621c474cd7 --- /dev/null +++ b/Lang/Asymptote/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Leonardo-numbers b/Lang/Asymptote/Leonardo-numbers new file mode 120000 index 0000000000..53f9861f22 --- /dev/null +++ b/Lang/Asymptote/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Loops-Infinite b/Lang/Asymptote/Loops-Infinite new file mode 120000 index 0000000000..0aa1840fd7 --- /dev/null +++ b/Lang/Asymptote/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Map-range b/Lang/Asymptote/Map-range new file mode 120000 index 0000000000..249d69a043 --- /dev/null +++ b/Lang/Asymptote/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Pancake-numbers b/Lang/Asymptote/Pancake-numbers new file mode 120000 index 0000000000..de9f5cf18c --- /dev/null +++ b/Lang/Asymptote/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Primality-by-trial-division b/Lang/Asymptote/Primality-by-trial-division new file mode 120000 index 0000000000..0cfaa74cf3 --- /dev/null +++ b/Lang/Asymptote/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Repeat b/Lang/Asymptote/Repeat new file mode 120000 index 0000000000..03b0740c45 --- /dev/null +++ b/Lang/Asymptote/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Sudan-function b/Lang/Asymptote/Sudan-function new file mode 120000 index 0000000000..97eca50473 --- /dev/null +++ b/Lang/Asymptote/Sudan-function @@ -0,0 +1 @@ +../../Task/Sudan-function/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Tau-function b/Lang/Asymptote/Tau-function new file mode 120000 index 0000000000..f822d893d8 --- /dev/null +++ b/Lang/Asymptote/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Tau-number b/Lang/Asymptote/Tau-number new file mode 120000 index 0000000000..e9ae14e606 --- /dev/null +++ b/Lang/Asymptote/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Temperature-conversion b/Lang/Asymptote/Temperature-conversion new file mode 120000 index 0000000000..f7d5a1158d --- /dev/null +++ b/Lang/Asymptote/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Towers-of-Hanoi b/Lang/Asymptote/Towers-of-Hanoi new file mode 120000 index 0000000000..62a6e4d923 --- /dev/null +++ b/Lang/Asymptote/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Asymptote \ No newline at end of file diff --git a/Lang/Asymptote/Twos-complement b/Lang/Asymptote/Twos-complement new file mode 120000 index 0000000000..a487252d4a --- /dev/null +++ b/Lang/Asymptote/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Asymptote \ No newline at end of file diff --git a/Lang/Atari-BASIC/00-LANG.txt b/Lang/Atari-BASIC/00-LANG.txt index 233d214413..f0ee8029ec 100644 --- a/Lang/Atari-BASIC/00-LANG.txt +++ b/Lang/Atari-BASIC/00-LANG.txt @@ -3,6 +3,23 @@ |tags=basic,ataribasic }} {{Implementation|BASIC}} -'''Atari BASIC''' refers to the BASIC that shipped with Atari 8-bit micros. +'''Atari BASIC''' refers to the BASIC that shipped with Atari 8-bit micros. Revision A was released on cartridge for early models like the Atari 400 and 800 (1979), while revision B was included in ROM on later models such as the 800XL (1983). (Revision A is considered superior because revision B has more bugs!) Revision C was released on cartridge to address the bugs introduced in revision B. It was also in ROM on later 800XL computers and the XE range. -See Wikipedia: https://en.wikipedia.org/wiki/Atari_BASIC \ No newline at end of file +Emulators for Atari 8-bit computers include: +*[https://atari800.github.io/ Atari800] (Windows, Mac, Linux, etc.) +*[https://www.virtualdub.org/altirra.html Altirra] (Windows) + +Downloading the original Atari ROMs is not necessary for Atari800 or Altirra because they include the open source Altirra ROMs, which also feature Altirra BASIC, a fully compatible replacement for Atari BASIC. Altirra BASIC and OS are also better optimized than the original Atari ROMs; especially FOR loops and floating point functions are much quicker. + +To start Atari800 in BASIC mode, run it as atari800 -basic. Some important keys in Atari800 are F1=Settings, F5=Reset, F7=Break, F9=Quit, F10=Screenshot; see [https://github.com/atari800/atari800/blob/master/DOC/USAGE DOC/USAGE] for more. Lowercase characters in strings can be entered by first pressing Caps Lock in Atari800. + +In Atari800, folders on the host computer can be mounted in ''Emulator Configuration ⇨ Host Device Settings'', so then you can e.g. use LOAD "H1:MYPROG.BAS" to load a program from local disk. By default, folders are mounted read-only. + +BASIC programs in tokenized form are loaded and saved with LOAD and SAVE; in ASCII/ATASCII format you load them with ENTER and save them with LIST, e.g. LIST “H1:PROGRAM.LST”. + +After 9 minutes of inactivity, a screen saver (called attract mode by Atari) will activate and cycle colors. This can be stopped by an occasional POKE 77,0 to reset the timer. + +Like in Palo Alto Tiny BASIC, commands can be abbreviated by their first (unique) letters and a period, e.g. L. for LIST or GR. for GRAPHICS. + +==See Also== +*[https://en.wikipedia.org/wiki/Atari_BASIC Atari BASIC] in Wikipedia \ No newline at end of file diff --git a/Lang/Atari-BASIC/Archimedean-spiral b/Lang/Atari-BASIC/Archimedean-spiral new file mode 120000 index 0000000000..3e75563330 --- /dev/null +++ b/Lang/Atari-BASIC/Archimedean-spiral @@ -0,0 +1 @@ +../../Task/Archimedean-spiral/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/Chaos-game b/Lang/Atari-BASIC/Chaos-game new file mode 120000 index 0000000000..f88e0f8ada --- /dev/null +++ b/Lang/Atari-BASIC/Chaos-game @@ -0,0 +1 @@ +../../Task/Chaos-game/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/Color-of-a-screen-pixel b/Lang/Atari-BASIC/Color-of-a-screen-pixel new file mode 120000 index 0000000000..b097621245 --- /dev/null +++ b/Lang/Atari-BASIC/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/Colour-bars-Display b/Lang/Atari-BASIC/Colour-bars-Display new file mode 120000 index 0000000000..03db8dce96 --- /dev/null +++ b/Lang/Atari-BASIC/Colour-bars-Display @@ -0,0 +1 @@ +../../Task/Colour-bars-Display/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/Draw-a-clock b/Lang/Atari-BASIC/Draw-a-clock new file mode 120000 index 0000000000..f8dd467da4 --- /dev/null +++ b/Lang/Atari-BASIC/Draw-a-clock @@ -0,0 +1 @@ +../../Task/Draw-a-clock/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/Mandelbrot-set b/Lang/Atari-BASIC/Mandelbrot-set new file mode 120000 index 0000000000..45e66ccff0 --- /dev/null +++ b/Lang/Atari-BASIC/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/Musical-scale b/Lang/Atari-BASIC/Musical-scale new file mode 120000 index 0000000000..b870e25059 --- /dev/null +++ b/Lang/Atari-BASIC/Musical-scale @@ -0,0 +1 @@ +../../Task/Musical-scale/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/Pi b/Lang/Atari-BASIC/Pi new file mode 120000 index 0000000000..b081cc7024 --- /dev/null +++ b/Lang/Atari-BASIC/Pi @@ -0,0 +1 @@ +../../Task/Pi/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/Random-number-generator-device- b/Lang/Atari-BASIC/Random-number-generator-device- new file mode 120000 index 0000000000..bc35b665ee --- /dev/null +++ b/Lang/Atari-BASIC/Random-number-generator-device- @@ -0,0 +1 @@ +../../Task/Random-number-generator-device-/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/Reverse-a-string b/Lang/Atari-BASIC/Reverse-a-string new file mode 120000 index 0000000000..c2ff7e214b --- /dev/null +++ b/Lang/Atari-BASIC/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/System-time b/Lang/Atari-BASIC/System-time new file mode 120000 index 0000000000..c4df1e6a39 --- /dev/null +++ b/Lang/Atari-BASIC/System-time @@ -0,0 +1 @@ +../../Task/System-time/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/Terminal-control-Hiding-the-cursor b/Lang/Atari-BASIC/Terminal-control-Hiding-the-cursor new file mode 120000 index 0000000000..78972a34b6 --- /dev/null +++ b/Lang/Atari-BASIC/Terminal-control-Hiding-the-cursor @@ -0,0 +1 @@ +../../Task/Terminal-control-Hiding-the-cursor/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/Terminal-control-Inverse-video b/Lang/Atari-BASIC/Terminal-control-Inverse-video new file mode 120000 index 0000000000..8c57f75946 --- /dev/null +++ b/Lang/Atari-BASIC/Terminal-control-Inverse-video @@ -0,0 +1 @@ +../../Task/Terminal-control-Inverse-video/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/Terminal-control-Positional-read b/Lang/Atari-BASIC/Terminal-control-Positional-read new file mode 120000 index 0000000000..a0575b2278 --- /dev/null +++ b/Lang/Atari-BASIC/Terminal-control-Positional-read @@ -0,0 +1 @@ +../../Task/Terminal-control-Positional-read/Atari-BASIC \ No newline at end of file diff --git a/Lang/Atari-BASIC/Terminal-control-Ringing-the-terminal-bell b/Lang/Atari-BASIC/Terminal-control-Ringing-the-terminal-bell new file mode 120000 index 0000000000..3666cabb9e --- /dev/null +++ b/Lang/Atari-BASIC/Terminal-control-Ringing-the-terminal-bell @@ -0,0 +1 @@ +../../Task/Terminal-control-Ringing-the-terminal-bell/Atari-BASIC \ No newline at end of file diff --git a/Lang/AutoHotKey-V2/00-LANG.txt b/Lang/AutoHotKey-V2/00-LANG.txt new file mode 100644 index 0000000000..a333f928af --- /dev/null +++ b/Lang/AutoHotKey-V2/00-LANG.txt @@ -0,0 +1 @@ +{{stub}}{{language|AutoHotKey V2}} \ No newline at end of file diff --git a/Lang/AutoHotKey-V2/00-META.yaml b/Lang/AutoHotKey-V2/00-META.yaml new file mode 100644 index 0000000000..316ebe0ccb --- /dev/null +++ b/Lang/AutoHotKey-V2/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:AutoHotKey_V2 diff --git a/Lang/AutoHotKey-V2/Hello-world-Graphical b/Lang/AutoHotKey-V2/Hello-world-Graphical new file mode 120000 index 0000000000..89783bc714 --- /dev/null +++ b/Lang/AutoHotKey-V2/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/AutoHotKey-V2 \ No newline at end of file diff --git a/Lang/AutoHotkey/Miller-Rabin-primality-test b/Lang/AutoHotkey/Miller-Rabin-primality-test deleted file mode 120000 index 518dd6b131..0000000000 --- a/Lang/AutoHotkey/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Quaternion-type b/Lang/AutoHotkey/Quaternion-type deleted file mode 120000 index 00a1a5a068..0000000000 --- a/Lang/AutoHotkey/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Sorting-Algorithms-Circle-Sort b/Lang/AutoHotkey/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 975740b1fa..0000000000 --- a/Lang/AutoHotkey/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoLISP/100-doors b/Lang/AutoLISP/100-doors new file mode 120000 index 0000000000..4d97a8a5d6 --- /dev/null +++ b/Lang/AutoLISP/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/AutoLISP \ No newline at end of file diff --git a/Lang/AutoLISP/Babbage-problem b/Lang/AutoLISP/Babbage-problem new file mode 120000 index 0000000000..0ae3941c82 --- /dev/null +++ b/Lang/AutoLISP/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/AutoLISP \ No newline at end of file diff --git a/Lang/AutoLISP/Balanced-brackets b/Lang/AutoLISP/Balanced-brackets new file mode 120000 index 0000000000..b752cfc1d6 --- /dev/null +++ b/Lang/AutoLISP/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/AutoLISP \ No newline at end of file diff --git a/Lang/AutoLISP/Entropy b/Lang/AutoLISP/Entropy new file mode 120000 index 0000000000..bc1dec235f --- /dev/null +++ b/Lang/AutoLISP/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/AutoLISP \ No newline at end of file diff --git a/Lang/AutoLISP/Entropy-Narcissist b/Lang/AutoLISP/Entropy-Narcissist new file mode 120000 index 0000000000..0a143c87ce --- /dev/null +++ b/Lang/AutoLISP/Entropy-Narcissist @@ -0,0 +1 @@ +../../Task/Entropy-Narcissist/AutoLISP \ No newline at end of file diff --git a/Lang/AutoLISP/Environment-variables b/Lang/AutoLISP/Environment-variables new file mode 120000 index 0000000000..cc9ceec1ff --- /dev/null +++ b/Lang/AutoLISP/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/AutoLISP \ No newline at end of file diff --git a/Lang/AutoLISP/Largest-proper-divisor-of-n b/Lang/AutoLISP/Largest-proper-divisor-of-n new file mode 120000 index 0000000000..48c08fae1a --- /dev/null +++ b/Lang/AutoLISP/Largest-proper-divisor-of-n @@ -0,0 +1 @@ +../../Task/Largest-proper-divisor-of-n/AutoLISP \ No newline at end of file diff --git a/Lang/AutoLISP/The-Twelve-Days-of-Christmas b/Lang/AutoLISP/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..3dd7563b0d --- /dev/null +++ b/Lang/AutoLISP/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/AutoLISP \ No newline at end of file diff --git a/Lang/Axiom/Quaternion-type b/Lang/Axiom/Quaternion-type deleted file mode 120000 index 483576377a..0000000000 --- a/Lang/Axiom/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Axiom \ No newline at end of file diff --git a/Lang/BASIC/00-LANG.txt b/Lang/BASIC/00-LANG.txt index 7299250982..ddee550d0d 100644 --- a/Lang/BASIC/00-LANG.txt +++ b/Lang/BASIC/00-LANG.txt @@ -12,18 +12,56 @@ BASIC became popular, with many different implementations for various computers. ==Links== *[[wp:BASIC|Wikipedia:BASIC]] +**[[wp:ASIC]] +**[[wp:Atari BASIC]] +**[[wp:BASIC-PLUS]] +**[[wp:Basic-256]] +**[[wp:Batari BASIC]] +**[[wp:BBC BASIC]] +**[[wp:Benton Harbor BASIC]] +**[[wp:Beta BASIC]] +**[[wp:CBASIC]] **[[wp:Chipmunk Basic]] +**[[wp:DarkBASIC]] +**[[wp:Dartmouth BASIC]] +**[[wp:FreeBASIC]] +**[[wp:FutureBASIC]] +**[[wp:GFA BASIC]] +**[[wp:GLBasic]] +**[[wp:Integer BASIC]] +**[[wp:Liberty BASIC]] +**[[wp:Locomotive BASIC]] **[[wp:Microsoft BASIC]] ***[[wp:Altair BASIC]] ***[[wp:Amiga BASIC]] ***[[wp:Applesoft BASIC]] ***[[wp:Atari Microsoft BASIC]] ***[[wp:Commodore BASIC]] +***[[wp:Extended Color BASIC]] ***[[wp:IBM BASIC]] -***[[wp:TRS-80 Level II BASIC ]] +***[[wp:MS BASIC for Macintosh]] +***[[wp:MSX BASIC]] +***[[wp:Small Basic]] +***[[wp:QBasic]] +***[[wp:QuickBASIC]]‎ +***[[wp:TRS-80 Level II BASIC]] +***[[wp:Visual Basic‎]] **[[wp:PowerBASIC]] **[[wp:PureBasic]] +**[[wp:QB64‎]] +**[[wp:Quite BASIC]]‎ +**[[wp:RapidQ]] +**[[wp:Realbasic]] **[[wp:Rocky Mountain BASIC]] +**[[wp:Run BASIC]] +**[[wp:S-BASIC]] +**[[wp:ScriptBasic]] +**[[wp:Sinclair BASIC]] +**[[wp:SmileBASIC‎]] **[[wp:SuperBASIC]] +**[[wp:TI BASIC (TI 99/4A)]] +**[[wp:Tiny BASIC‎]] **[[wp:True BASIC]] +**[[wp:UBASIC]] +**[[wp:Yabasic]] {{language programming paradigm|Procedural}} \ No newline at end of file diff --git a/Lang/BASIC/Abundant-deficient-and-perfect-number-classifications b/Lang/BASIC/Abundant-deficient-and-perfect-number-classifications deleted file mode 120000 index 732a066bdf..0000000000 --- a/Lang/BASIC/Abundant-deficient-and-perfect-number-classifications +++ /dev/null @@ -1 +0,0 @@ -../../Task/Abundant-deficient-and-perfect-number-classifications/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Arithmetic-derivative b/Lang/BASIC/Arithmetic-derivative new file mode 120000 index 0000000000..25cf9a8b6a --- /dev/null +++ b/Lang/BASIC/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Damm-algorithm b/Lang/BASIC/Damm-algorithm deleted file mode 120000 index 41ee6d1c36..0000000000 --- a/Lang/BASIC/Damm-algorithm +++ /dev/null @@ -1 +0,0 @@ -../../Task/Damm-algorithm/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Determine-if-a-string-is-collapsible b/Lang/BASIC/Determine-if-a-string-is-collapsible deleted file mode 120000 index 87084a2029..0000000000 --- a/Lang/BASIC/Determine-if-a-string-is-collapsible +++ /dev/null @@ -1 +0,0 @@ -../../Task/Determine-if-a-string-is-collapsible/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Ethiopian-multiplication b/Lang/BASIC/Ethiopian-multiplication deleted file mode 120000 index 94be458bb2..0000000000 --- a/Lang/BASIC/Ethiopian-multiplication +++ /dev/null @@ -1 +0,0 @@ -../../Task/Ethiopian-multiplication/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Function-definition b/Lang/BASIC/Function-definition deleted file mode 120000 index a052c63292..0000000000 --- a/Lang/BASIC/Function-definition +++ /dev/null @@ -1 +0,0 @@ -../../Task/Function-definition/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Gray-code b/Lang/BASIC/Gray-code deleted file mode 120000 index f0bc6f352f..0000000000 --- a/Lang/BASIC/Gray-code +++ /dev/null @@ -1 +0,0 @@ -../../Task/Gray-code/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Longest-string-challenge b/Lang/BASIC/Longest-string-challenge deleted file mode 120000 index 739abebd3a..0000000000 --- a/Lang/BASIC/Longest-string-challenge +++ /dev/null @@ -1 +0,0 @@ -../../Task/Longest-string-challenge/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Mayan-numerals b/Lang/BASIC/Mayan-numerals deleted file mode 120000 index ae24d05061..0000000000 --- a/Lang/BASIC/Mayan-numerals +++ /dev/null @@ -1 +0,0 @@ -../../Task/Mayan-numerals/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Monty-Hall-problem b/Lang/BASIC/Monty-Hall-problem deleted file mode 120000 index ba5a5a279d..0000000000 --- a/Lang/BASIC/Monty-Hall-problem +++ /dev/null @@ -1 +0,0 @@ -../../Task/Monty-Hall-problem/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Move-to-front-algorithm b/Lang/BASIC/Move-to-front-algorithm new file mode 120000 index 0000000000..a9f8d4df7e --- /dev/null +++ b/Lang/BASIC/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/BASIC \ No newline at end of file diff --git a/Lang/BASIC/One-dimensional-cellular-automata b/Lang/BASIC/One-dimensional-cellular-automata deleted file mode 120000 index 91d5b5ff5e..0000000000 --- a/Lang/BASIC/One-dimensional-cellular-automata +++ /dev/null @@ -1 +0,0 @@ -../../Task/One-dimensional-cellular-automata/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Ordered-words b/Lang/BASIC/Ordered-words new file mode 120000 index 0000000000..dd2f98d4e6 --- /dev/null +++ b/Lang/BASIC/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Partition-an-integer-x-into-n-primes b/Lang/BASIC/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..8db316776d --- /dev/null +++ b/Lang/BASIC/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Reverse-a-string b/Lang/BASIC/Reverse-a-string deleted file mode 120000 index db5bd211b7..0000000000 --- a/Lang/BASIC/Reverse-a-string +++ /dev/null @@ -1 +0,0 @@ -../../Task/Reverse-a-string/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Rot-13 b/Lang/BASIC/Rot-13 deleted file mode 120000 index 37a240fe69..0000000000 --- a/Lang/BASIC/Rot-13 +++ /dev/null @@ -1 +0,0 @@ -../../Task/Rot-13/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Sorting-algorithms-Gnome-sort b/Lang/BASIC/Sorting-algorithms-Gnome-sort deleted file mode 120000 index ce27855f21..0000000000 --- a/Lang/BASIC/Sorting-algorithms-Gnome-sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-algorithms-Gnome-sort/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Sorting-algorithms-Quicksort b/Lang/BASIC/Sorting-algorithms-Quicksort deleted file mode 120000 index f7976ecb9f..0000000000 --- a/Lang/BASIC/Sorting-algorithms-Quicksort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-algorithms-Quicksort/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Temperature-conversion b/Lang/BASIC/Temperature-conversion deleted file mode 120000 index 21182b0539..0000000000 --- a/Lang/BASIC/Temperature-conversion +++ /dev/null @@ -1 +0,0 @@ -../../Task/Temperature-conversion/BASIC \ No newline at end of file diff --git a/Lang/BASIC256/21-game b/Lang/BASIC256/21-game new file mode 120000 index 0000000000..6c7c8089e2 --- /dev/null +++ b/Lang/BASIC256/21-game @@ -0,0 +1 @@ +../../Task/21-game/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Achilles-numbers b/Lang/BASIC256/Achilles-numbers new file mode 120000 index 0000000000..13d43c8909 --- /dev/null +++ b/Lang/BASIC256/Achilles-numbers @@ -0,0 +1 @@ +../../Task/Achilles-numbers/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Associative-array-Merging b/Lang/BASIC256/Associative-array-Merging new file mode 120000 index 0000000000..20bef5368f --- /dev/null +++ b/Lang/BASIC256/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Benfords-law b/Lang/BASIC256/Benfords-law new file mode 120000 index 0000000000..adf7036425 --- /dev/null +++ b/Lang/BASIC256/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Blum-integer b/Lang/BASIC256/Blum-integer new file mode 120000 index 0000000000..6114c8c1bc --- /dev/null +++ b/Lang/BASIC256/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Casting-out-nines b/Lang/BASIC256/Casting-out-nines new file mode 120000 index 0000000000..670ea3d048 --- /dev/null +++ b/Lang/BASIC256/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Determine-if-a-string-has-all-the-same-characters b/Lang/BASIC256/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..0fc88a3804 --- /dev/null +++ b/Lang/BASIC256/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Determine-if-a-string-has-all-unique-characters b/Lang/BASIC256/Determine-if-a-string-has-all-unique-characters new file mode 120000 index 0000000000..134627daea --- /dev/null +++ b/Lang/BASIC256/Determine-if-a-string-has-all-unique-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-unique-characters/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Determine-sentence-type b/Lang/BASIC256/Determine-sentence-type new file mode 120000 index 0000000000..6be21d3753 --- /dev/null +++ b/Lang/BASIC256/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Eban-numbers b/Lang/BASIC256/Eban-numbers new file mode 120000 index 0000000000..cc54b44b18 --- /dev/null +++ b/Lang/BASIC256/Eban-numbers @@ -0,0 +1 @@ +../../Task/Eban-numbers/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Empty-program b/Lang/BASIC256/Empty-program deleted file mode 120000 index 163b273495..0000000000 --- a/Lang/BASIC256/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Equal-prime-and-composite-sums b/Lang/BASIC256/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..187242266b --- /dev/null +++ b/Lang/BASIC256/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Euler-method b/Lang/BASIC256/Euler-method new file mode 120000 index 0000000000..a14c38eb6c --- /dev/null +++ b/Lang/BASIC256/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Evaluate-binomial-coefficients b/Lang/BASIC256/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..415fd5e54e --- /dev/null +++ b/Lang/BASIC256/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Kronecker-product b/Lang/BASIC256/Kronecker-product new file mode 120000 index 0000000000..dd258524fe --- /dev/null +++ b/Lang/BASIC256/Kronecker-product @@ -0,0 +1 @@ +../../Task/Kronecker-product/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Longest-string-challenge b/Lang/BASIC256/Longest-string-challenge new file mode 120000 index 0000000000..46b7ee20d4 --- /dev/null +++ b/Lang/BASIC256/Longest-string-challenge @@ -0,0 +1 @@ +../../Task/Longest-string-challenge/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Meissel-Mertens-constant b/Lang/BASIC256/Meissel-Mertens-constant deleted file mode 120000 index 6ff8d02267..0000000000 --- a/Lang/BASIC256/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Multiple-regression b/Lang/BASIC256/Multiple-regression new file mode 120000 index 0000000000..4d8b79e98b --- /dev/null +++ b/Lang/BASIC256/Multiple-regression @@ -0,0 +1 @@ +../../Task/Multiple-regression/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Nested-templated-data b/Lang/BASIC256/Nested-templated-data new file mode 120000 index 0000000000..f5ddb43f39 --- /dev/null +++ b/Lang/BASIC256/Nested-templated-data @@ -0,0 +1 @@ +../../Task/Nested-templated-data/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Padovan-n-step-number-sequences b/Lang/BASIC256/Padovan-n-step-number-sequences new file mode 120000 index 0000000000..96835908bd --- /dev/null +++ b/Lang/BASIC256/Padovan-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Padovan-n-step-number-sequences/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Phrase-reversals b/Lang/BASIC256/Phrase-reversals new file mode 120000 index 0000000000..7bce29f023 --- /dev/null +++ b/Lang/BASIC256/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Pythagorean-triples b/Lang/BASIC256/Pythagorean-triples new file mode 120000 index 0000000000..0ded5bc54d --- /dev/null +++ b/Lang/BASIC256/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Quaternion-type b/Lang/BASIC256/Quaternion-type deleted file mode 120000 index ecfff3f315..0000000000 --- a/Lang/BASIC256/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Ramer-Douglas-Peucker-line-simplification b/Lang/BASIC256/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..9a890661d4 --- /dev/null +++ b/Lang/BASIC256/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Sailors-coconuts-and-a-monkey-problem b/Lang/BASIC256/Sailors-coconuts-and-a-monkey-problem new file mode 120000 index 0000000000..3cfdfb5740 --- /dev/null +++ b/Lang/BASIC256/Sailors-coconuts-and-a-monkey-problem @@ -0,0 +1 @@ +../../Task/Sailors-coconuts-and-a-monkey-problem/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors b/Lang/BASIC256/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors new file mode 120000 index 0000000000..1cfd728c9c --- /dev/null +++ b/Lang/BASIC256/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Sequence:-smallest-number-with-exactly-n-divisors b/Lang/BASIC256/Sequence:-smallest-number-with-exactly-n-divisors new file mode 120000 index 0000000000..f838adf5dc --- /dev/null +++ b/Lang/BASIC256/Sequence:-smallest-number-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-with-exactly-n-divisors/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Set-consolidation b/Lang/BASIC256/Set-consolidation new file mode 120000 index 0000000000..720cdf3ec0 --- /dev/null +++ b/Lang/BASIC256/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Sexy-primes b/Lang/BASIC256/Sexy-primes new file mode 120000 index 0000000000..86fc0a12b9 --- /dev/null +++ b/Lang/BASIC256/Sexy-primes @@ -0,0 +1 @@ +../../Task/Sexy-primes/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Sort-disjoint-sublist b/Lang/BASIC256/Sort-disjoint-sublist new file mode 120000 index 0000000000..4422d7b840 --- /dev/null +++ b/Lang/BASIC256/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Sorting-algorithms-Bogosort b/Lang/BASIC256/Sorting-algorithms-Bogosort new file mode 120000 index 0000000000..30a3f4e141 --- /dev/null +++ b/Lang/BASIC256/Sorting-algorithms-Bogosort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bogosort/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Sorting-algorithms-Gnome-sort b/Lang/BASIC256/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..c4bf6071a8 --- /dev/null +++ b/Lang/BASIC256/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Subleq b/Lang/BASIC256/Subleq new file mode 120000 index 0000000000..1129f78a82 --- /dev/null +++ b/Lang/BASIC256/Subleq @@ -0,0 +1 @@ +../../Task/Subleq/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Sum-and-product-puzzle b/Lang/BASIC256/Sum-and-product-puzzle new file mode 120000 index 0000000000..2b964ccfbc --- /dev/null +++ b/Lang/BASIC256/Sum-and-product-puzzle @@ -0,0 +1 @@ +../../Task/Sum-and-product-puzzle/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Table-creation-Postal-addresses b/Lang/BASIC256/Table-creation-Postal-addresses new file mode 120000 index 0000000000..d1609e7548 --- /dev/null +++ b/Lang/BASIC256/Table-creation-Postal-addresses @@ -0,0 +1 @@ +../../Task/Table-creation-Postal-addresses/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Twos-complement b/Lang/BASIC256/Twos-complement new file mode 120000 index 0000000000..8b3d33db0a --- /dev/null +++ b/Lang/BASIC256/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Validate-International-Securities-Identification-Number b/Lang/BASIC256/Validate-International-Securities-Identification-Number new file mode 120000 index 0000000000..e6606941e4 --- /dev/null +++ b/Lang/BASIC256/Validate-International-Securities-Identification-Number @@ -0,0 +1 @@ +../../Task/Validate-International-Securities-Identification-Number/BASIC256 \ No newline at end of file diff --git a/Lang/BASIC256/Van-Eck-sequence b/Lang/BASIC256/Van-Eck-sequence new file mode 120000 index 0000000000..9c3b8e66bb --- /dev/null +++ b/Lang/BASIC256/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/BASIC256 \ No newline at end of file diff --git a/Lang/BBC-BASIC/Angles-geometric-normalization-and-conversion b/Lang/BBC-BASIC/Angles-geometric-normalization-and-conversion new file mode 120000 index 0000000000..92a059e0e7 --- /dev/null +++ b/Lang/BBC-BASIC/Angles-geometric-normalization-and-conversion @@ -0,0 +1 @@ +../../Task/Angles-geometric-normalization-and-conversion/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Arbitrary-precision-integers-included- b/Lang/BBC-BASIC/Arbitrary-precision-integers-included- new file mode 120000 index 0000000000..ca18adffdc --- /dev/null +++ b/Lang/BBC-BASIC/Arbitrary-precision-integers-included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers-included-/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Archimedean-spiral b/Lang/BBC-BASIC/Archimedean-spiral new file mode 120000 index 0000000000..f1badc9c0e --- /dev/null +++ b/Lang/BBC-BASIC/Archimedean-spiral @@ -0,0 +1 @@ +../../Task/Archimedean-spiral/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Bioinformatics-Sequence-mutation b/Lang/BBC-BASIC/Bioinformatics-Sequence-mutation new file mode 120000 index 0000000000..0c458bc910 --- /dev/null +++ b/Lang/BBC-BASIC/Bioinformatics-Sequence-mutation @@ -0,0 +1 @@ +../../Task/Bioinformatics-Sequence-mutation/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Calculating-the-value-of-e b/Lang/BBC-BASIC/Calculating-the-value-of-e new file mode 120000 index 0000000000..5059f4885f --- /dev/null +++ b/Lang/BBC-BASIC/Calculating-the-value-of-e @@ -0,0 +1 @@ +../../Task/Calculating-the-value-of-e/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Currency b/Lang/BBC-BASIC/Currency new file mode 120000 index 0000000000..93e2e05dfe --- /dev/null +++ b/Lang/BBC-BASIC/Currency @@ -0,0 +1 @@ +../../Task/Currency/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Cyclops-numbers b/Lang/BBC-BASIC/Cyclops-numbers new file mode 120000 index 0000000000..5bad59ea26 --- /dev/null +++ b/Lang/BBC-BASIC/Cyclops-numbers @@ -0,0 +1 @@ +../../Task/Cyclops-numbers/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Emirp-primes b/Lang/BBC-BASIC/Emirp-primes new file mode 120000 index 0000000000..83e10a9c96 --- /dev/null +++ b/Lang/BBC-BASIC/Emirp-primes @@ -0,0 +1 @@ +../../Task/Emirp-primes/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Entropy-Narcissist b/Lang/BBC-BASIC/Entropy-Narcissist new file mode 120000 index 0000000000..8b3e51a12a --- /dev/null +++ b/Lang/BBC-BASIC/Entropy-Narcissist @@ -0,0 +1 @@ +../../Task/Entropy-Narcissist/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Fusc-sequence b/Lang/BBC-BASIC/Fusc-sequence new file mode 120000 index 0000000000..4dbe128472 --- /dev/null +++ b/Lang/BBC-BASIC/Fusc-sequence @@ -0,0 +1 @@ +../../Task/Fusc-sequence/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Generate-Chess960-starting-position b/Lang/BBC-BASIC/Generate-Chess960-starting-position new file mode 120000 index 0000000000..ab2f96f714 --- /dev/null +++ b/Lang/BBC-BASIC/Generate-Chess960-starting-position @@ -0,0 +1 @@ +../../Task/Generate-Chess960-starting-position/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Hex-words b/Lang/BBC-BASIC/Hex-words new file mode 120000 index 0000000000..3149fa1db8 --- /dev/null +++ b/Lang/BBC-BASIC/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Hickerson-series-of-almost-integers b/Lang/BBC-BASIC/Hickerson-series-of-almost-integers new file mode 120000 index 0000000000..db668e472e --- /dev/null +++ b/Lang/BBC-BASIC/Hickerson-series-of-almost-integers @@ -0,0 +1 @@ +../../Task/Hickerson-series-of-almost-integers/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Humble-numbers b/Lang/BBC-BASIC/Humble-numbers new file mode 120000 index 0000000000..73b4b7f4ea --- /dev/null +++ b/Lang/BBC-BASIC/Humble-numbers @@ -0,0 +1 @@ +../../Task/Humble-numbers/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/I-before-E-except-after-C b/Lang/BBC-BASIC/I-before-E-except-after-C new file mode 120000 index 0000000000..5cfe84a822 --- /dev/null +++ b/Lang/BBC-BASIC/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Jaro-similarity b/Lang/BBC-BASIC/Jaro-similarity new file mode 120000 index 0000000000..fe6ec92687 --- /dev/null +++ b/Lang/BBC-BASIC/Jaro-similarity @@ -0,0 +1 @@ +../../Task/Jaro-similarity/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Julia-set b/Lang/BBC-BASIC/Julia-set new file mode 120000 index 0000000000..658dd765c9 --- /dev/null +++ b/Lang/BBC-BASIC/Julia-set @@ -0,0 +1 @@ +../../Task/Julia-set/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Last-Friday-of-each-month b/Lang/BBC-BASIC/Last-Friday-of-each-month new file mode 120000 index 0000000000..d35bf9dc8f --- /dev/null +++ b/Lang/BBC-BASIC/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/MAC-vendor-lookup b/Lang/BBC-BASIC/MAC-vendor-lookup new file mode 120000 index 0000000000..7d73c473a7 --- /dev/null +++ b/Lang/BBC-BASIC/MAC-vendor-lookup @@ -0,0 +1 @@ +../../Task/MAC-vendor-lookup/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Magnanimous-numbers b/Lang/BBC-BASIC/Magnanimous-numbers new file mode 120000 index 0000000000..cdd9658301 --- /dev/null +++ b/Lang/BBC-BASIC/Magnanimous-numbers @@ -0,0 +1 @@ +../../Task/Magnanimous-numbers/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/BBC-BASIC/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..c061ef014a --- /dev/null +++ b/Lang/BBC-BASIC/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Multi-dimensional-array b/Lang/BBC-BASIC/Multi-dimensional-array new file mode 120000 index 0000000000..4bc7c4a17c --- /dev/null +++ b/Lang/BBC-BASIC/Multi-dimensional-array @@ -0,0 +1 @@ +../../Task/Multi-dimensional-array/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Narcissistic-decimal-number b/Lang/BBC-BASIC/Narcissistic-decimal-number new file mode 120000 index 0000000000..1a2b003e3a --- /dev/null +++ b/Lang/BBC-BASIC/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Quaternion-type b/Lang/BBC-BASIC/Quaternion-type deleted file mode 120000 index 018816057d..0000000000 --- a/Lang/BBC-BASIC/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/BBC-BASIC \ No newline at end of file diff --git a/Lang/BBC-BASIC/Rosetta-Code-Find-unimplemented-tasks b/Lang/BBC-BASIC/Rosetta-Code-Find-unimplemented-tasks new file mode 120000 index 0000000000..c601198500 --- /dev/null +++ b/Lang/BBC-BASIC/Rosetta-Code-Find-unimplemented-tasks @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Find-unimplemented-tasks/BBC-BASIC \ No newline at end of file diff --git a/Lang/BCPL/Move-to-front-algorithm b/Lang/BCPL/Move-to-front-algorithm new file mode 120000 index 0000000000..27c5309df1 --- /dev/null +++ b/Lang/BCPL/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/BCPL \ No newline at end of file diff --git a/Lang/BCPL/Narcissistic-decimal-number b/Lang/BCPL/Narcissistic-decimal-number new file mode 120000 index 0000000000..e0ff77fa71 --- /dev/null +++ b/Lang/BCPL/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/BCPL \ No newline at end of file diff --git a/Lang/BCPL/Partition-an-integer-x-into-n-primes b/Lang/BCPL/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..ab1811d492 --- /dev/null +++ b/Lang/BCPL/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/BCPL \ No newline at end of file diff --git a/Lang/BCPL/Zeckendorf-number-representation b/Lang/BCPL/Zeckendorf-number-representation new file mode 120000 index 0000000000..6723808a9f --- /dev/null +++ b/Lang/BCPL/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/BCPL \ No newline at end of file diff --git a/Lang/BQN/00-LANG.txt b/Lang/BQN/00-LANG.txt index e77f39a3a0..9fc40a5cde 100644 --- a/Lang/BQN/00-LANG.txt +++ b/Lang/BQN/00-LANG.txt @@ -2,11 +2,14 @@ |checking=dynamic |exec=bytecode |gc=yes - |site=https://mlochbaum.github.io/BQN + |site=https://mlochbaum.github.io/BQN/ |parampass=value |safety=safe |bnf=https://mlochbaum.github.io/BQN/spec/grammar.html}}{{language programming paradigm|functional}}[[Category:Programming paradigm/Tacit]] BQN is a new (initially released 2020) [[wp:Array programming|array oriented]], [[functional_programming|functional]] programming language in the [[APL]] lineage, which aims to remove irregular and burdensome aspects of the APL tradition and put the great ideas on a firmer footing. While its use demands a solid understanding of functions and multidimensional arrays, BQN's focus on providing simple, consistent, and powerful array operations (and documentation!) makes it a good language for learning array programming and building stronger array intuition. -Documentation can be found at https://mlochbaum.github.io/BQN. \ No newline at end of file +Documentation can be found at https://mlochbaum.github.io/BQN/doc/. + +==Todo== +[[Tasks_not_implemented_in_BQN]] \ No newline at end of file diff --git a/Lang/BQN/Abundant-odd-numbers b/Lang/BQN/Abundant-odd-numbers new file mode 120000 index 0000000000..fdb56e6ed6 --- /dev/null +++ b/Lang/BQN/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/BQN \ No newline at end of file diff --git a/Lang/BQN/Angle-difference-between-two-bearings b/Lang/BQN/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..7a2d5afdfe --- /dev/null +++ b/Lang/BQN/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/BQN \ No newline at end of file diff --git a/Lang/BQN/Apply-a-callback-to-an-array b/Lang/BQN/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..0d1581adfa --- /dev/null +++ b/Lang/BQN/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/BQN \ No newline at end of file diff --git a/Lang/BQN/Averages-Pythagorean-means b/Lang/BQN/Averages-Pythagorean-means new file mode 120000 index 0000000000..667a8f930b --- /dev/null +++ b/Lang/BQN/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/BQN \ No newline at end of file diff --git a/Lang/BQN/Base64-decode-data b/Lang/BQN/Base64-decode-data new file mode 120000 index 0000000000..2272b7f2a1 --- /dev/null +++ b/Lang/BQN/Base64-decode-data @@ -0,0 +1 @@ +../../Task/Base64-decode-data/BQN \ No newline at end of file diff --git a/Lang/BQN/Bell-numbers b/Lang/BQN/Bell-numbers new file mode 120000 index 0000000000..2c520a34e3 --- /dev/null +++ b/Lang/BQN/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/BQN \ No newline at end of file diff --git a/Lang/BQN/CUSIP b/Lang/BQN/CUSIP new file mode 120000 index 0000000000..b7ca66ab5f --- /dev/null +++ b/Lang/BQN/CUSIP @@ -0,0 +1 @@ +../../Task/CUSIP/BQN \ No newline at end of file diff --git a/Lang/BQN/Call-an-object-method b/Lang/BQN/Call-an-object-method new file mode 120000 index 0000000000..eb9e8d9920 --- /dev/null +++ b/Lang/BQN/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/BQN \ No newline at end of file diff --git a/Lang/BQN/Cartesian-product-of-two-or-more-lists b/Lang/BQN/Cartesian-product-of-two-or-more-lists new file mode 120000 index 0000000000..9eca0c70e0 --- /dev/null +++ b/Lang/BQN/Cartesian-product-of-two-or-more-lists @@ -0,0 +1 @@ +../../Task/Cartesian-product-of-two-or-more-lists/BQN \ No newline at end of file diff --git a/Lang/BQN/Determine-if-a-string-is-numeric b/Lang/BQN/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..7756637024 --- /dev/null +++ b/Lang/BQN/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/BQN \ No newline at end of file diff --git a/Lang/BQN/Determine-if-a-string-is-squeezable b/Lang/BQN/Determine-if-a-string-is-squeezable new file mode 120000 index 0000000000..604c0583b1 --- /dev/null +++ b/Lang/BQN/Determine-if-a-string-is-squeezable @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-squeezable/BQN \ No newline at end of file diff --git a/Lang/BQN/Dutch-national-flag-problem b/Lang/BQN/Dutch-national-flag-problem new file mode 120000 index 0000000000..c24e10da06 --- /dev/null +++ b/Lang/BQN/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/BQN \ No newline at end of file diff --git a/Lang/BQN/Find-common-directory-path b/Lang/BQN/Find-common-directory-path new file mode 120000 index 0000000000..d4456eaa79 --- /dev/null +++ b/Lang/BQN/Find-common-directory-path @@ -0,0 +1 @@ +../../Task/Find-common-directory-path/BQN \ No newline at end of file diff --git a/Lang/BQN/Globally-replace-text-in-several-files b/Lang/BQN/Globally-replace-text-in-several-files new file mode 120000 index 0000000000..b13db5355b --- /dev/null +++ b/Lang/BQN/Globally-replace-text-in-several-files @@ -0,0 +1 @@ +../../Task/Globally-replace-text-in-several-files/BQN \ No newline at end of file diff --git a/Lang/BQN/Harmonic-series b/Lang/BQN/Harmonic-series new file mode 120000 index 0000000000..6efb347667 --- /dev/null +++ b/Lang/BQN/Harmonic-series @@ -0,0 +1 @@ +../../Task/Harmonic-series/BQN \ No newline at end of file diff --git a/Lang/BQN/I-before-E-except-after-C b/Lang/BQN/I-before-E-except-after-C new file mode 120000 index 0000000000..5fd82fbd92 --- /dev/null +++ b/Lang/BQN/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/BQN \ No newline at end of file diff --git a/Lang/BQN/IBAN b/Lang/BQN/IBAN new file mode 120000 index 0000000000..501e54d38b --- /dev/null +++ b/Lang/BQN/IBAN @@ -0,0 +1 @@ +../../Task/IBAN/BQN \ No newline at end of file diff --git a/Lang/BQN/ISBN13-check-digit b/Lang/BQN/ISBN13-check-digit new file mode 120000 index 0000000000..70feb3a0c6 --- /dev/null +++ b/Lang/BQN/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/BQN \ No newline at end of file diff --git a/Lang/BQN/Leap-year b/Lang/BQN/Leap-year new file mode 120000 index 0000000000..b3a2268f78 --- /dev/null +++ b/Lang/BQN/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/BQN \ No newline at end of file diff --git a/Lang/BQN/Longest-string-challenge b/Lang/BQN/Longest-string-challenge new file mode 120000 index 0000000000..bca36863c6 --- /dev/null +++ b/Lang/BQN/Longest-string-challenge @@ -0,0 +1 @@ +../../Task/Longest-string-challenge/BQN \ No newline at end of file diff --git a/Lang/BQN/Miller-Rabin-primality-test b/Lang/BQN/Miller-Rabin-primality-test deleted file mode 120000 index 88fd3a622d..0000000000 --- a/Lang/BQN/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/BQN \ No newline at end of file diff --git a/Lang/BQN/Multifactorial b/Lang/BQN/Multifactorial new file mode 120000 index 0000000000..a2fe7ba313 --- /dev/null +++ b/Lang/BQN/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/BQN \ No newline at end of file diff --git a/Lang/BQN/Phrase-reversals b/Lang/BQN/Phrase-reversals new file mode 120000 index 0000000000..a35381900f --- /dev/null +++ b/Lang/BQN/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/BQN \ No newline at end of file diff --git a/Lang/BQN/Program-name b/Lang/BQN/Program-name new file mode 120000 index 0000000000..e55b53a24c --- /dev/null +++ b/Lang/BQN/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/BQN \ No newline at end of file diff --git a/Lang/BQN/Pseudo-random-numbers-Middle-square-method b/Lang/BQN/Pseudo-random-numbers-Middle-square-method new file mode 120000 index 0000000000..15e8169128 --- /dev/null +++ b/Lang/BQN/Pseudo-random-numbers-Middle-square-method @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Middle-square-method/BQN \ No newline at end of file diff --git a/Lang/BQN/Remove-duplicate-elements b/Lang/BQN/Remove-duplicate-elements new file mode 120000 index 0000000000..fc50c4ea75 --- /dev/null +++ b/Lang/BQN/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/BQN \ No newline at end of file diff --git a/Lang/BQN/Reverse-words-in-a-string b/Lang/BQN/Reverse-words-in-a-string new file mode 120000 index 0000000000..b4a561c28a --- /dev/null +++ b/Lang/BQN/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/BQN \ No newline at end of file diff --git a/Lang/BQN/Rot-13 b/Lang/BQN/Rot-13 new file mode 120000 index 0000000000..40de4f31ae --- /dev/null +++ b/Lang/BQN/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/BQN \ No newline at end of file diff --git a/Lang/BQN/Self-describing-numbers b/Lang/BQN/Self-describing-numbers new file mode 120000 index 0000000000..394307e5cb --- /dev/null +++ b/Lang/BQN/Self-describing-numbers @@ -0,0 +1 @@ +../../Task/Self-describing-numbers/BQN \ No newline at end of file diff --git a/Lang/BQN/Sequence-of-non-squares b/Lang/BQN/Sequence-of-non-squares new file mode 120000 index 0000000000..34c4c67548 --- /dev/null +++ b/Lang/BQN/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/BQN \ No newline at end of file diff --git a/Lang/BQN/Sort-an-integer-array b/Lang/BQN/Sort-an-integer-array new file mode 120000 index 0000000000..0abf6c28d8 --- /dev/null +++ b/Lang/BQN/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/BQN \ No newline at end of file diff --git a/Lang/BQN/Sort-disjoint-sublist b/Lang/BQN/Sort-disjoint-sublist new file mode 120000 index 0000000000..b6e62b246c --- /dev/null +++ b/Lang/BQN/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/BQN \ No newline at end of file diff --git a/Lang/BQN/Sort-numbers-lexicographically b/Lang/BQN/Sort-numbers-lexicographically new file mode 120000 index 0000000000..c09eafb48d --- /dev/null +++ b/Lang/BQN/Sort-numbers-lexicographically @@ -0,0 +1 @@ +../../Task/Sort-numbers-lexicographically/BQN \ No newline at end of file diff --git a/Lang/BQN/Split-a-character-string-based-on-change-of-character b/Lang/BQN/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..d35a0c943b --- /dev/null +++ b/Lang/BQN/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/BQN \ No newline at end of file diff --git a/Lang/BQN/String-append b/Lang/BQN/String-append new file mode 120000 index 0000000000..e4188e5b03 --- /dev/null +++ b/Lang/BQN/String-append @@ -0,0 +1 @@ +../../Task/String-append/BQN \ No newline at end of file diff --git a/Lang/BQN/Tau-number b/Lang/BQN/Tau-number new file mode 120000 index 0000000000..0d0f120696 --- /dev/null +++ b/Lang/BQN/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/BQN \ No newline at end of file diff --git a/Lang/BQN/Test-integerness b/Lang/BQN/Test-integerness new file mode 120000 index 0000000000..da47d74420 --- /dev/null +++ b/Lang/BQN/Test-integerness @@ -0,0 +1 @@ +../../Task/Test-integerness/BQN \ No newline at end of file diff --git a/Lang/BQN/Water-collected-between-towers b/Lang/BQN/Water-collected-between-towers new file mode 120000 index 0000000000..905f66c364 --- /dev/null +++ b/Lang/BQN/Water-collected-between-towers @@ -0,0 +1 @@ +../../Task/Water-collected-between-towers/BQN \ No newline at end of file diff --git a/Lang/BaCon/Copy-a-string b/Lang/BaCon/Copy-a-string deleted file mode 120000 index a2df7bcd98..0000000000 --- a/Lang/BaCon/Copy-a-string +++ /dev/null @@ -1 +0,0 @@ -../../Task/Copy-a-string/BaCon \ No newline at end of file diff --git a/Lang/BabyCobol/00-LANG.txt b/Lang/BabyCobol/00-LANG.txt new file mode 100644 index 0000000000..b106508e3b --- /dev/null +++ b/Lang/BabyCobol/00-LANG.txt @@ -0,0 +1,7 @@ +{{language|BabyCobol + | site = https://slebok.github.io/baby/ + | gc = no + | parampass = both + | hopl = no +}} +'''BabyCobol''' is an experiment in language design: it is small enough to be quickly implementable (fully or partially) within any framework that can support its features, but complex enough to cover typical problems of legacy language processing. If you learn how to compile [[MiniJava]], you stand a good chance of implementing a reasonably good compiler for any contemporary programming language. If you show how your language extension works on [[Featherweight Java]], it has a good chance of being applicable to any reasonable modern object-oriented programming language. If you can handle BabyCobol with your tool and with your skills, you are ready to face the challenges of software modernisation, codebase migration and legacy language processing in general. \ No newline at end of file diff --git a/Lang/BabyCobol/00-META.yaml b/Lang/BabyCobol/00-META.yaml new file mode 100644 index 0000000000..59c8f2fb7e --- /dev/null +++ b/Lang/BabyCobol/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:BabyCobol diff --git a/Lang/BabyCobol/100-doors b/Lang/BabyCobol/100-doors new file mode 120000 index 0000000000..28c01ba1d4 --- /dev/null +++ b/Lang/BabyCobol/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/BabyCobol \ No newline at end of file diff --git a/Lang/BabyCobol/99-bottles-of-beer b/Lang/BabyCobol/99-bottles-of-beer new file mode 120000 index 0000000000..f2b7e0195f --- /dev/null +++ b/Lang/BabyCobol/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/BabyCobol \ No newline at end of file diff --git a/Lang/BabyCobol/A+B b/Lang/BabyCobol/A+B new file mode 120000 index 0000000000..12cf42c07d --- /dev/null +++ b/Lang/BabyCobol/A+B @@ -0,0 +1 @@ +../../Task/A+B/BabyCobol \ No newline at end of file diff --git a/Lang/BabyCobol/FizzBuzz b/Lang/BabyCobol/FizzBuzz new file mode 120000 index 0000000000..f3080a2a06 --- /dev/null +++ b/Lang/BabyCobol/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/BabyCobol \ No newline at end of file diff --git a/Lang/BabyCobol/Hello-world-Text b/Lang/BabyCobol/Hello-world-Text new file mode 120000 index 0000000000..c4b041271b --- /dev/null +++ b/Lang/BabyCobol/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/BabyCobol \ No newline at end of file diff --git a/Lang/BabyCobol/User-input-Text b/Lang/BabyCobol/User-input-Text new file mode 120000 index 0000000000..f1d99aff15 --- /dev/null +++ b/Lang/BabyCobol/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/BabyCobol \ No newline at end of file diff --git a/Lang/Bait/00-LANG.txt b/Lang/Bait/00-LANG.txt index 0900661567..18a243057f 100644 --- a/Lang/Bait/00-LANG.txt +++ b/Lang/Bait/00-LANG.txt @@ -1,11 +1,11 @@ {{ language|Bait -|site=https://github.com/tiabeast/bait +|site=https://github.com/bait-lang/bait |strength=strong |safety=safe |checking=static }} -Bait is a work-in-progress simple, compiled, general purpose programming language for building reliable software. +Bait is a simple programming language for building reliable software. -Solutions to RosettaCode are maintained at https://github.com/tiabeast/rosetta-bait. Please propose solutions there. \ No newline at end of file +Solutions are maintained at https://github.com/bait-lang/rosetta-bait. Please propose changes there. \ No newline at end of file diff --git a/Lang/Bait/Array-length b/Lang/Bait/Array-length new file mode 120000 index 0000000000..986225a090 --- /dev/null +++ b/Lang/Bait/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/Bait \ No newline at end of file diff --git a/Lang/Bait/CRC-32 b/Lang/Bait/CRC-32 new file mode 120000 index 0000000000..f40324a53c --- /dev/null +++ b/Lang/Bait/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/Bait \ No newline at end of file diff --git a/Lang/Bait/Empty-string b/Lang/Bait/Empty-string new file mode 120000 index 0000000000..b1bbee2da3 --- /dev/null +++ b/Lang/Bait/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Bait \ No newline at end of file diff --git a/Lang/Bait/Loops-Continue b/Lang/Bait/Loops-Continue new file mode 120000 index 0000000000..6e3768fbb1 --- /dev/null +++ b/Lang/Bait/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Bait \ No newline at end of file diff --git a/Lang/Bait/Loops-Downward-for b/Lang/Bait/Loops-Downward-for new file mode 120000 index 0000000000..128e8218f3 --- /dev/null +++ b/Lang/Bait/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Bait \ No newline at end of file diff --git a/Lang/Bait/Loops-For b/Lang/Bait/Loops-For new file mode 120000 index 0000000000..79b044fb61 --- /dev/null +++ b/Lang/Bait/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Bait \ No newline at end of file diff --git a/Lang/Bait/Loops-For-with-a-specified-step b/Lang/Bait/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..941f926d61 --- /dev/null +++ b/Lang/Bait/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Bait \ No newline at end of file diff --git a/Lang/Bait/Loops-Foreach b/Lang/Bait/Loops-Foreach new file mode 120000 index 0000000000..80ae525d6d --- /dev/null +++ b/Lang/Bait/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Bait \ No newline at end of file diff --git a/Lang/Bait/Pascals-triangle b/Lang/Bait/Pascals-triangle new file mode 120000 index 0000000000..564eec1e1a --- /dev/null +++ b/Lang/Bait/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/Bait \ No newline at end of file diff --git a/Lang/Ballerina/00-LANG.txt b/Lang/Ballerina/00-LANG.txt index af215acfd5..211ba0fe40 100644 --- a/Lang/Ballerina/00-LANG.txt +++ b/Lang/Ballerina/00-LANG.txt @@ -1 +1,20 @@ -{{stub}}{{language|Ballerina}} \ No newline at end of file +{{language|Ballerina +|exec=bytecode +|strength=strong +|safety=safe +|express=explicit +|checking=static +|gc=yes +|hopl=no +|site=https://ballerina.io +}} +'''[https://en.wikipedia.org/wiki/Ballerina_(programming_language) Ballerina]''' is an open source general-purpose programming language designed and supported by [https://wso2.com/ WSO2] for cloud-era application programmers. + +It is under development on [https://github.com/ballerina-platform/ballerina-lang GitHub] and is fully documented [https://ballerina.io here]. + +Ballerina was first publicly announced in 2017 and version 1.0 was released on September 10, 2019. However, a major overhaul took place in 2022 when [https://blog.ballerina.io/posts/2022-02-01-announcing-ballerina-2201.0.0-swan-lake/ Ballerina 2201.0.0 (Swan Lake)] was released. + +The current version (2201.12.3) has distributions available for Windows, Linux and macOS and can be downloaded [https://ballerina.io/downloads/ here]. + +== See Also == +* [https://ballerina.io/learn/by-example/ Ballerina by Example] \ No newline at end of file diff --git a/Lang/Ballerina/100-doors b/Lang/Ballerina/100-doors new file mode 120000 index 0000000000..833a0fc189 --- /dev/null +++ b/Lang/Ballerina/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/99-bottles-of-beer b/Lang/Ballerina/99-bottles-of-beer new file mode 120000 index 0000000000..b3bd8e29e3 --- /dev/null +++ b/Lang/Ballerina/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/A+B b/Lang/Ballerina/A+B new file mode 120000 index 0000000000..e9aab74a73 --- /dev/null +++ b/Lang/Ballerina/A+B @@ -0,0 +1 @@ +../../Task/A+B/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/ABC-problem b/Lang/Ballerina/ABC-problem new file mode 120000 index 0000000000..49ca7ac9ad --- /dev/null +++ b/Lang/Ballerina/ABC-problem @@ -0,0 +1 @@ +../../Task/ABC-problem/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/AKS-test-for-primes b/Lang/Ballerina/AKS-test-for-primes new file mode 120000 index 0000000000..9b19f08d80 --- /dev/null +++ b/Lang/Ballerina/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Abundant-deficient-and-perfect-number-classifications b/Lang/Ballerina/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..b5353658a4 --- /dev/null +++ b/Lang/Ballerina/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Abundant-odd-numbers b/Lang/Ballerina/Abundant-odd-numbers new file mode 120000 index 0000000000..0b3a97c4a1 --- /dev/null +++ b/Lang/Ballerina/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Accumulator-factory b/Lang/Ballerina/Accumulator-factory new file mode 120000 index 0000000000..837dbbe6a0 --- /dev/null +++ b/Lang/Ballerina/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Achilles-numbers b/Lang/Ballerina/Achilles-numbers new file mode 120000 index 0000000000..3336ab1c37 --- /dev/null +++ b/Lang/Ballerina/Achilles-numbers @@ -0,0 +1 @@ +../../Task/Achilles-numbers/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Ackermann-function b/Lang/Ballerina/Ackermann-function new file mode 120000 index 0000000000..b9748d884d --- /dev/null +++ b/Lang/Ballerina/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Add-a-variable-to-a-class-instance-at-runtime b/Lang/Ballerina/Add-a-variable-to-a-class-instance-at-runtime new file mode 120000 index 0000000000..12efd91bd6 --- /dev/null +++ b/Lang/Ballerina/Add-a-variable-to-a-class-instance-at-runtime @@ -0,0 +1 @@ +../../Task/Add-a-variable-to-a-class-instance-at-runtime/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Additive-primes b/Lang/Ballerina/Additive-primes new file mode 120000 index 0000000000..a504210ea7 --- /dev/null +++ b/Lang/Ballerina/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Address-of-a-variable b/Lang/Ballerina/Address-of-a-variable new file mode 120000 index 0000000000..6428e75ce3 --- /dev/null +++ b/Lang/Ballerina/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Almost-prime b/Lang/Ballerina/Almost-prime new file mode 120000 index 0000000000..33d501af1e --- /dev/null +++ b/Lang/Ballerina/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Amb b/Lang/Ballerina/Amb new file mode 120000 index 0000000000..7acc58d7c4 --- /dev/null +++ b/Lang/Ballerina/Amb @@ -0,0 +1 @@ +../../Task/Amb/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Angle-difference-between-two-bearings b/Lang/Ballerina/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..04ff00d986 --- /dev/null +++ b/Lang/Ballerina/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Anti-primes b/Lang/Ballerina/Anti-primes new file mode 120000 index 0000000000..9911fc0bcb --- /dev/null +++ b/Lang/Ballerina/Anti-primes @@ -0,0 +1 @@ +../../Task/Anti-primes/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Apply-a-callback-to-an-array b/Lang/Ballerina/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..9911480671 --- /dev/null +++ b/Lang/Ballerina/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Approximate-equality b/Lang/Ballerina/Approximate-equality new file mode 120000 index 0000000000..0ea6692d0d --- /dev/null +++ b/Lang/Ballerina/Approximate-equality @@ -0,0 +1 @@ +../../Task/Approximate-equality/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Arithmetic-Complex b/Lang/Ballerina/Arithmetic-Complex new file mode 120000 index 0000000000..f87fd15204 --- /dev/null +++ b/Lang/Ballerina/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Arithmetic-Integer b/Lang/Ballerina/Arithmetic-Integer new file mode 120000 index 0000000000..a4c8cf5206 --- /dev/null +++ b/Lang/Ballerina/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Arithmetic-Rational b/Lang/Ballerina/Arithmetic-Rational new file mode 120000 index 0000000000..422af5f88b --- /dev/null +++ b/Lang/Ballerina/Arithmetic-Rational @@ -0,0 +1 @@ +../../Task/Arithmetic-Rational/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Arithmetic-numbers b/Lang/Ballerina/Arithmetic-numbers new file mode 120000 index 0000000000..38541780a0 --- /dev/null +++ b/Lang/Ballerina/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Array-concatenation b/Lang/Ballerina/Array-concatenation new file mode 120000 index 0000000000..41c2603b74 --- /dev/null +++ b/Lang/Ballerina/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Array-length b/Lang/Ballerina/Array-length new file mode 120000 index 0000000000..25020148f9 --- /dev/null +++ b/Lang/Ballerina/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Arrays b/Lang/Ballerina/Arrays new file mode 120000 index 0000000000..ec5c5a266e --- /dev/null +++ b/Lang/Ballerina/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Ascending-primes b/Lang/Ballerina/Ascending-primes new file mode 120000 index 0000000000..51444ceb96 --- /dev/null +++ b/Lang/Ballerina/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Associative-array-Creation b/Lang/Ballerina/Associative-array-Creation new file mode 120000 index 0000000000..2639b285f3 --- /dev/null +++ b/Lang/Ballerina/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Associative-array-Iteration b/Lang/Ballerina/Associative-array-Iteration new file mode 120000 index 0000000000..d3e31d2374 --- /dev/null +++ b/Lang/Ballerina/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Associative-array-Merging b/Lang/Ballerina/Associative-array-Merging new file mode 120000 index 0000000000..cd38137d75 --- /dev/null +++ b/Lang/Ballerina/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Averages-Arithmetic-mean b/Lang/Ballerina/Averages-Arithmetic-mean new file mode 120000 index 0000000000..039d1f0de8 --- /dev/null +++ b/Lang/Ballerina/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Averages-Mean-angle b/Lang/Ballerina/Averages-Mean-angle new file mode 120000 index 0000000000..adf77693ce --- /dev/null +++ b/Lang/Ballerina/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Averages-Mean-time-of-day b/Lang/Ballerina/Averages-Mean-time-of-day new file mode 120000 index 0000000000..c969ed84e4 --- /dev/null +++ b/Lang/Ballerina/Averages-Mean-time-of-day @@ -0,0 +1 @@ +../../Task/Averages-Mean-time-of-day/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Averages-Median b/Lang/Ballerina/Averages-Median new file mode 120000 index 0000000000..5bbd39cecb --- /dev/null +++ b/Lang/Ballerina/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Averages-Mode b/Lang/Ballerina/Averages-Mode new file mode 120000 index 0000000000..72d0e02dae --- /dev/null +++ b/Lang/Ballerina/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Averages-Pythagorean-means b/Lang/Ballerina/Averages-Pythagorean-means new file mode 120000 index 0000000000..fd607a9ee8 --- /dev/null +++ b/Lang/Ballerina/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Averages-Root-mean-square b/Lang/Ballerina/Averages-Root-mean-square new file mode 120000 index 0000000000..48056410d9 --- /dev/null +++ b/Lang/Ballerina/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Averages-Simple-moving-average b/Lang/Ballerina/Averages-Simple-moving-average new file mode 120000 index 0000000000..7e2849cced --- /dev/null +++ b/Lang/Ballerina/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Balanced-brackets b/Lang/Ballerina/Balanced-brackets new file mode 120000 index 0000000000..3d78b77dd3 --- /dev/null +++ b/Lang/Ballerina/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Binary-digits b/Lang/Ballerina/Binary-digits new file mode 120000 index 0000000000..47999ed558 --- /dev/null +++ b/Lang/Ballerina/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Boolean-values b/Lang/Ballerina/Boolean-values new file mode 120000 index 0000000000..c01657f16a --- /dev/null +++ b/Lang/Ballerina/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Caesar-cipher b/Lang/Ballerina/Caesar-cipher new file mode 120000 index 0000000000..8e1a6603e9 --- /dev/null +++ b/Lang/Ballerina/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Calculating-the-value-of-e b/Lang/Ballerina/Calculating-the-value-of-e new file mode 120000 index 0000000000..af3085b824 --- /dev/null +++ b/Lang/Ballerina/Calculating-the-value-of-e @@ -0,0 +1 @@ +../../Task/Calculating-the-value-of-e/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Case-sensitivity-of-identifiers b/Lang/Ballerina/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..42725d41da --- /dev/null +++ b/Lang/Ballerina/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Character-codes b/Lang/Ballerina/Character-codes new file mode 120000 index 0000000000..6abede048f --- /dev/null +++ b/Lang/Ballerina/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Classes b/Lang/Ballerina/Classes new file mode 120000 index 0000000000..0c8bd2434d --- /dev/null +++ b/Lang/Ballerina/Classes @@ -0,0 +1 @@ +../../Task/Classes/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Commatizing-numbers b/Lang/Ballerina/Commatizing-numbers new file mode 120000 index 0000000000..a644eda1b6 --- /dev/null +++ b/Lang/Ballerina/Commatizing-numbers @@ -0,0 +1 @@ +../../Task/Commatizing-numbers/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Comments b/Lang/Ballerina/Comments new file mode 120000 index 0000000000..6b5d53ddee --- /dev/null +++ b/Lang/Ballerina/Comments @@ -0,0 +1 @@ +../../Task/Comments/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Copy-a-string b/Lang/Ballerina/Copy-a-string new file mode 120000 index 0000000000..ce5773b181 --- /dev/null +++ b/Lang/Ballerina/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Count-in-octal b/Lang/Ballerina/Count-in-octal new file mode 120000 index 0000000000..7e70a67830 --- /dev/null +++ b/Lang/Ballerina/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Currency b/Lang/Ballerina/Currency new file mode 120000 index 0000000000..2b278dfa20 --- /dev/null +++ b/Lang/Ballerina/Currency @@ -0,0 +1 @@ +../../Task/Currency/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Currying b/Lang/Ballerina/Currying new file mode 120000 index 0000000000..7e465c7834 --- /dev/null +++ b/Lang/Ballerina/Currying @@ -0,0 +1 @@ +../../Task/Currying/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Dot-product b/Lang/Ballerina/Dot-product new file mode 120000 index 0000000000..327f9d0969 --- /dev/null +++ b/Lang/Ballerina/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Dynamic-variable-names b/Lang/Ballerina/Dynamic-variable-names new file mode 120000 index 0000000000..5c549728ae --- /dev/null +++ b/Lang/Ballerina/Dynamic-variable-names @@ -0,0 +1 @@ +../../Task/Dynamic-variable-names/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Empty-string b/Lang/Ballerina/Empty-string new file mode 120000 index 0000000000..a86a0ffc9d --- /dev/null +++ b/Lang/Ballerina/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Even-or-odd b/Lang/Ballerina/Even-or-odd new file mode 120000 index 0000000000..2d8b1b90ab --- /dev/null +++ b/Lang/Ballerina/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Extreme-floating-point-values b/Lang/Ballerina/Extreme-floating-point-values new file mode 120000 index 0000000000..7f91d37268 --- /dev/null +++ b/Lang/Ballerina/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Factors-of-an-integer b/Lang/Ballerina/Factors-of-an-integer new file mode 120000 index 0000000000..ac634eef84 --- /dev/null +++ b/Lang/Ballerina/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Farey-sequence b/Lang/Ballerina/Farey-sequence new file mode 120000 index 0000000000..d542459c5f --- /dev/null +++ b/Lang/Ballerina/Farey-sequence @@ -0,0 +1 @@ +../../Task/Farey-sequence/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Fibonacci-sequence b/Lang/Ballerina/Fibonacci-sequence new file mode 120000 index 0000000000..96031e7d01 --- /dev/null +++ b/Lang/Ballerina/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Filter b/Lang/Ballerina/Filter new file mode 120000 index 0000000000..b57b5e74be --- /dev/null +++ b/Lang/Ballerina/Filter @@ -0,0 +1 @@ +../../Task/Filter/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Find-limit-of-recursion b/Lang/Ballerina/Find-limit-of-recursion new file mode 120000 index 0000000000..0c9c45aca0 --- /dev/null +++ b/Lang/Ballerina/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Fivenum b/Lang/Ballerina/Fivenum new file mode 120000 index 0000000000..0df90aeb78 --- /dev/null +++ b/Lang/Ballerina/Fivenum @@ -0,0 +1 @@ +../../Task/Fivenum/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/FizzBuzz b/Lang/Ballerina/FizzBuzz new file mode 120000 index 0000000000..e7f3aa8019 --- /dev/null +++ b/Lang/Ballerina/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Floyds-triangle b/Lang/Ballerina/Floyds-triangle new file mode 120000 index 0000000000..524ef8d9d5 --- /dev/null +++ b/Lang/Ballerina/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Four-bit-adder b/Lang/Ballerina/Four-bit-adder new file mode 120000 index 0000000000..da1ccb0292 --- /dev/null +++ b/Lang/Ballerina/Four-bit-adder @@ -0,0 +1 @@ +../../Task/Four-bit-adder/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Function-definition b/Lang/Ballerina/Function-definition new file mode 120000 index 0000000000..aad5e07c0c --- /dev/null +++ b/Lang/Ballerina/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Gapful-numbers b/Lang/Ballerina/Gapful-numbers new file mode 120000 index 0000000000..16bb3670f6 --- /dev/null +++ b/Lang/Ballerina/Gapful-numbers @@ -0,0 +1 @@ +../../Task/Gapful-numbers/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Greatest-common-divisor b/Lang/Ballerina/Greatest-common-divisor new file mode 120000 index 0000000000..0f657f13a6 --- /dev/null +++ b/Lang/Ballerina/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Greatest-element-of-a-list b/Lang/Ballerina/Greatest-element-of-a-list new file mode 120000 index 0000000000..579d0c3022 --- /dev/null +++ b/Lang/Ballerina/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Greatest-subsequential-sum b/Lang/Ballerina/Greatest-subsequential-sum new file mode 120000 index 0000000000..edc1a686d7 --- /dev/null +++ b/Lang/Ballerina/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Hailstone-sequence b/Lang/Ballerina/Hailstone-sequence new file mode 120000 index 0000000000..41dfb14066 --- /dev/null +++ b/Lang/Ballerina/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Hello-world-Graphical b/Lang/Ballerina/Hello-world-Graphical new file mode 120000 index 0000000000..4e2e7e9224 --- /dev/null +++ b/Lang/Ballerina/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Hello-world-Newbie b/Lang/Ballerina/Hello-world-Newbie new file mode 120000 index 0000000000..b59c1b36e9 --- /dev/null +++ b/Lang/Ballerina/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Hello-world-Newline-omission b/Lang/Ballerina/Hello-world-Newline-omission new file mode 120000 index 0000000000..1016c5553e --- /dev/null +++ b/Lang/Ballerina/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Hello-world-Standard-error b/Lang/Ballerina/Hello-world-Standard-error new file mode 120000 index 0000000000..c4921dce1f --- /dev/null +++ b/Lang/Ballerina/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Increment-a-numerical-string b/Lang/Ballerina/Increment-a-numerical-string new file mode 120000 index 0000000000..712faa77bf --- /dev/null +++ b/Lang/Ballerina/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Integer-comparison b/Lang/Ballerina/Integer-comparison new file mode 120000 index 0000000000..8563637dab --- /dev/null +++ b/Lang/Ballerina/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Integer-sequence b/Lang/Ballerina/Integer-sequence new file mode 120000 index 0000000000..06b95f33f5 --- /dev/null +++ b/Lang/Ballerina/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Levenshtein-distance b/Lang/Ballerina/Levenshtein-distance new file mode 120000 index 0000000000..4824e03354 --- /dev/null +++ b/Lang/Ballerina/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Logical-operations b/Lang/Ballerina/Logical-operations new file mode 120000 index 0000000000..06b4043fcb --- /dev/null +++ b/Lang/Ballerina/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loop-over-multiple-arrays-simultaneously b/Lang/Ballerina/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..9b68d094d5 --- /dev/null +++ b/Lang/Ballerina/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loops-Break b/Lang/Ballerina/Loops-Break new file mode 120000 index 0000000000..6ab612b087 --- /dev/null +++ b/Lang/Ballerina/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loops-Continue b/Lang/Ballerina/Loops-Continue new file mode 120000 index 0000000000..175be123b9 --- /dev/null +++ b/Lang/Ballerina/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loops-Do-while b/Lang/Ballerina/Loops-Do-while new file mode 120000 index 0000000000..b90c6b3171 --- /dev/null +++ b/Lang/Ballerina/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loops-Downward-for b/Lang/Ballerina/Loops-Downward-for new file mode 120000 index 0000000000..e977389f54 --- /dev/null +++ b/Lang/Ballerina/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loops-For b/Lang/Ballerina/Loops-For new file mode 120000 index 0000000000..8ad2b8fd0c --- /dev/null +++ b/Lang/Ballerina/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loops-For-with-a-specified-step b/Lang/Ballerina/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..cc892dc7f2 --- /dev/null +++ b/Lang/Ballerina/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loops-Foreach b/Lang/Ballerina/Loops-Foreach new file mode 120000 index 0000000000..f819fadabe --- /dev/null +++ b/Lang/Ballerina/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loops-Increment-loop-index-within-loop-body b/Lang/Ballerina/Loops-Increment-loop-index-within-loop-body new file mode 120000 index 0000000000..1c9b81a58a --- /dev/null +++ b/Lang/Ballerina/Loops-Increment-loop-index-within-loop-body @@ -0,0 +1 @@ +../../Task/Loops-Increment-loop-index-within-loop-body/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loops-Infinite b/Lang/Ballerina/Loops-Infinite new file mode 120000 index 0000000000..312369ce48 --- /dev/null +++ b/Lang/Ballerina/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loops-N-plus-one-half b/Lang/Ballerina/Loops-N-plus-one-half new file mode 120000 index 0000000000..220ecbad7f --- /dev/null +++ b/Lang/Ballerina/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loops-Nested b/Lang/Ballerina/Loops-Nested new file mode 120000 index 0000000000..f32c9a3c17 --- /dev/null +++ b/Lang/Ballerina/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loops-With-multiple-ranges b/Lang/Ballerina/Loops-With-multiple-ranges new file mode 120000 index 0000000000..2fad29a9f9 --- /dev/null +++ b/Lang/Ballerina/Loops-With-multiple-ranges @@ -0,0 +1 @@ +../../Task/Loops-With-multiple-ranges/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Loops-Wrong-ranges b/Lang/Ballerina/Loops-Wrong-ranges new file mode 120000 index 0000000000..6c8ada2aa7 --- /dev/null +++ b/Lang/Ballerina/Loops-Wrong-ranges @@ -0,0 +1 @@ +../../Task/Loops-Wrong-ranges/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Palindrome-detection b/Lang/Ballerina/Palindrome-detection new file mode 120000 index 0000000000..981d11f5cd --- /dev/null +++ b/Lang/Ballerina/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Repeat-a-string b/Lang/Ballerina/Repeat-a-string new file mode 120000 index 0000000000..83134ceac0 --- /dev/null +++ b/Lang/Ballerina/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Reverse-a-string b/Lang/Ballerina/Reverse-a-string new file mode 120000 index 0000000000..f4e8e73220 --- /dev/null +++ b/Lang/Ballerina/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Rot-13 b/Lang/Ballerina/Rot-13 new file mode 120000 index 0000000000..d33ecacc03 --- /dev/null +++ b/Lang/Ballerina/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Sieve-of-Eratosthenes b/Lang/Ballerina/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..4cae2a9d5e --- /dev/null +++ b/Lang/Ballerina/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Stack b/Lang/Ballerina/Stack new file mode 120000 index 0000000000..e073045735 --- /dev/null +++ b/Lang/Ballerina/Stack @@ -0,0 +1 @@ +../../Task/Stack/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Statistics-Basic b/Lang/Ballerina/Statistics-Basic new file mode 120000 index 0000000000..7ef892b782 --- /dev/null +++ b/Lang/Ballerina/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/String-case b/Lang/Ballerina/String-case new file mode 120000 index 0000000000..091d633ac8 --- /dev/null +++ b/Lang/Ballerina/String-case @@ -0,0 +1 @@ +../../Task/String-case/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/String-concatenation b/Lang/Ballerina/String-concatenation new file mode 120000 index 0000000000..a5a366085e --- /dev/null +++ b/Lang/Ballerina/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/String-length b/Lang/Ballerina/String-length new file mode 120000 index 0000000000..0cdb126aa0 --- /dev/null +++ b/Lang/Ballerina/String-length @@ -0,0 +1 @@ +../../Task/String-length/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Sum-and-product-of-an-array b/Lang/Ballerina/Sum-and-product-of-an-array new file mode 120000 index 0000000000..a5ba732cde --- /dev/null +++ b/Lang/Ballerina/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Sum-of-a-series b/Lang/Ballerina/Sum-of-a-series new file mode 120000 index 0000000000..27da1c4b06 --- /dev/null +++ b/Lang/Ballerina/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Sum-of-squares b/Lang/Ballerina/Sum-of-squares new file mode 120000 index 0000000000..9f1e366796 --- /dev/null +++ b/Lang/Ballerina/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Tokenize-a-string b/Lang/Ballerina/Tokenize-a-string new file mode 120000 index 0000000000..d9a64c3a3e --- /dev/null +++ b/Lang/Ballerina/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Towers-of-Hanoi b/Lang/Ballerina/Towers-of-Hanoi new file mode 120000 index 0000000000..81bf7985bd --- /dev/null +++ b/Lang/Ballerina/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Truncatable-primes b/Lang/Ballerina/Truncatable-primes new file mode 120000 index 0000000000..044dcb5d58 --- /dev/null +++ b/Lang/Ballerina/Truncatable-primes @@ -0,0 +1 @@ +../../Task/Truncatable-primes/Ballerina \ No newline at end of file diff --git a/Lang/Ballerina/Unicode-variable-names b/Lang/Ballerina/Unicode-variable-names new file mode 120000 index 0000000000..7f61255815 --- /dev/null +++ b/Lang/Ballerina/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Ballerina \ No newline at end of file diff --git a/Lang/Basic09/00-LANG.txt b/Lang/Basic09/00-LANG.txt index 16853881ce..fa600ca16b 100644 --- a/Lang/Basic09/00-LANG.txt +++ b/Lang/Basic09/00-LANG.txt @@ -1 +1,3 @@ -{{language|Basic09}}Basic09 is a dialect of BASIC created by Microware Systems Corporation in 1978 for use on the OS-9 operating system designed for the Motorola 6809 microporcessor. There is a version for OS-9/68000, "Microware BASIC", identical save that the INTEGER type is a four-byte signed integer instead of two-byte and REAL is IEEE 754 double precision rather than the five-byte format in the original version. \ No newline at end of file +{{language|Basic09}} +{{implementation|BASIC}} +Basic09 is a dialect of BASIC created by Microware Systems Corporation in 1978 for use on the OS-9 operating system designed for the Motorola 6809 microporcessor. There is a version for OS-9/68000, "Microware BASIC", identical save that the INTEGER type is a four-byte signed integer instead of two-byte and REAL is IEEE 754 double precision rather than the five-byte format in the original version. \ No newline at end of file diff --git a/Lang/Batch-File/00-LANG.txt b/Lang/Batch-File/00-LANG.txt index 1bcc82760d..06b0c85598 100644 --- a/Lang/Batch-File/00-LANG.txt +++ b/Lang/Batch-File/00-LANG.txt @@ -1,3 +1,3 @@ -{{language|Batch File}}'''Batch files''' are the scripting languages for [[Microsoft]] command line shells, such as [[MS-DOS]], COMMAND.EXE, and CMD.EXE. They typically have either the .BAT or .CMD extension. +{{language|Batch File}}'''Batch file''', sometimes just called Batch, is the common name for the scripting language for [[Microsoft]] command line shells, such as COMMAND.COM (in [[MS-DOS]]), and CMD.EXE (in Windows). They typically have either the .BAT or .CMD extension. Due to the association of batch files with MS-DOS in the public consciousness, sometimes this language is called the MS-DOS programming language even when used on modern versions of Windows, though this usage of the term is not technically correct. The "batch files" written in the Batch File language are not to be confused with the "bash scripts" written in the [[bash | bash programming language]] for the [[UNIX Shell]]. \ No newline at end of file diff --git a/Lang/Batch-File/Base64-decode-data b/Lang/Batch-File/Base64-decode-data new file mode 120000 index 0000000000..ec2f53b5db --- /dev/null +++ b/Lang/Batch-File/Base64-decode-data @@ -0,0 +1 @@ +../../Task/Base64-decode-data/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Call-a-foreign-language-function b/Lang/Batch-File/Call-a-foreign-language-function new file mode 120000 index 0000000000..82bd97e4ca --- /dev/null +++ b/Lang/Batch-File/Call-a-foreign-language-function @@ -0,0 +1 @@ +../../Task/Call-a-foreign-language-function/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Check-input-device-is-a-terminal b/Lang/Batch-File/Check-input-device-is-a-terminal new file mode 120000 index 0000000000..e3cbbd272b --- /dev/null +++ b/Lang/Batch-File/Check-input-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-input-device-is-a-terminal/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Check-output-device-is-a-terminal b/Lang/Batch-File/Check-output-device-is-a-terminal new file mode 120000 index 0000000000..3d54ec8254 --- /dev/null +++ b/Lang/Batch-File/Check-output-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-output-device-is-a-terminal/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Chinese-zodiac b/Lang/Batch-File/Chinese-zodiac new file mode 120000 index 0000000000..c2c7ae27f9 --- /dev/null +++ b/Lang/Batch-File/Chinese-zodiac @@ -0,0 +1 @@ +../../Task/Chinese-zodiac/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Copy-stdin-to-stdout b/Lang/Batch-File/Copy-stdin-to-stdout new file mode 120000 index 0000000000..ec25d70662 --- /dev/null +++ b/Lang/Batch-File/Copy-stdin-to-stdout @@ -0,0 +1 @@ +../../Task/Copy-stdin-to-stdout/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Exponentiation-operator b/Lang/Batch-File/Exponentiation-operator new file mode 120000 index 0000000000..93dda3ab18 --- /dev/null +++ b/Lang/Batch-File/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Flatten-a-list b/Lang/Batch-File/Flatten-a-list new file mode 120000 index 0000000000..bdac6d0d38 --- /dev/null +++ b/Lang/Batch-File/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Handle-a-signal b/Lang/Batch-File/Handle-a-signal new file mode 120000 index 0000000000..5dfc7c6a7d --- /dev/null +++ b/Lang/Batch-File/Handle-a-signal @@ -0,0 +1 @@ +../../Task/Handle-a-signal/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Hello-world-Web-server b/Lang/Batch-File/Hello-world-Web-server new file mode 120000 index 0000000000..ef5c7e0f66 --- /dev/null +++ b/Lang/Batch-File/Hello-world-Web-server @@ -0,0 +1 @@ +../../Task/Hello-world-Web-server/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Input-loop b/Lang/Batch-File/Input-loop deleted file mode 120000 index a2a4a9b473..0000000000 --- a/Lang/Batch-File/Input-loop +++ /dev/null @@ -1 +0,0 @@ -../../Task/Input-loop/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Keyboard-input-Keypress-check b/Lang/Batch-File/Keyboard-input-Keypress-check new file mode 120000 index 0000000000..5711a16a1c --- /dev/null +++ b/Lang/Batch-File/Keyboard-input-Keypress-check @@ -0,0 +1 @@ +../../Task/Keyboard-input-Keypress-check/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Long-year b/Lang/Batch-File/Long-year new file mode 120000 index 0000000000..2a90ddff12 --- /dev/null +++ b/Lang/Batch-File/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Make-directory-path b/Lang/Batch-File/Make-directory-path new file mode 120000 index 0000000000..057c573752 --- /dev/null +++ b/Lang/Batch-File/Make-directory-path @@ -0,0 +1 @@ +../../Task/Make-directory-path/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Primality-by-trial-division b/Lang/Batch-File/Primality-by-trial-division new file mode 120000 index 0000000000..5a253da7c4 --- /dev/null +++ b/Lang/Batch-File/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Read-a-configuration-file b/Lang/Batch-File/Read-a-configuration-file new file mode 120000 index 0000000000..163a19758c --- /dev/null +++ b/Lang/Batch-File/Read-a-configuration-file @@ -0,0 +1 @@ +../../Task/Read-a-configuration-file/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Read-entire-file b/Lang/Batch-File/Read-entire-file new file mode 120000 index 0000000000..a4d22dbb49 --- /dev/null +++ b/Lang/Batch-File/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/SHA-1 b/Lang/Batch-File/SHA-1 new file mode 120000 index 0000000000..7b80d0565c --- /dev/null +++ b/Lang/Batch-File/SHA-1 @@ -0,0 +1 @@ +../../Task/SHA-1/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/SHA-256 b/Lang/Batch-File/SHA-256 new file mode 120000 index 0000000000..88132ba441 --- /dev/null +++ b/Lang/Batch-File/SHA-256 @@ -0,0 +1 @@ +../../Task/SHA-256/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Simple-windowed-application b/Lang/Batch-File/Simple-windowed-application new file mode 120000 index 0000000000..98ffbccd11 --- /dev/null +++ b/Lang/Batch-File/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Sort-an-integer-array b/Lang/Batch-File/Sort-an-integer-array new file mode 120000 index 0000000000..9e7fd40b38 --- /dev/null +++ b/Lang/Batch-File/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Strip-a-set-of-characters-from-a-string b/Lang/Batch-File/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..bb3a4f27fc --- /dev/null +++ b/Lang/Batch-File/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Temperature-conversion b/Lang/Batch-File/Temperature-conversion new file mode 120000 index 0000000000..a928fb35a8 --- /dev/null +++ b/Lang/Batch-File/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Terminal-control-Hiding-the-cursor b/Lang/Batch-File/Terminal-control-Hiding-the-cursor new file mode 120000 index 0000000000..55e8dcde29 --- /dev/null +++ b/Lang/Batch-File/Terminal-control-Hiding-the-cursor @@ -0,0 +1 @@ +../../Task/Terminal-control-Hiding-the-cursor/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Terminal-control-Preserve-screen b/Lang/Batch-File/Terminal-control-Preserve-screen new file mode 120000 index 0000000000..8bc69bb473 --- /dev/null +++ b/Lang/Batch-File/Terminal-control-Preserve-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Preserve-screen/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Terminal-control-Unicode-output b/Lang/Batch-File/Terminal-control-Unicode-output new file mode 120000 index 0000000000..d9cf45a55e --- /dev/null +++ b/Lang/Batch-File/Terminal-control-Unicode-output @@ -0,0 +1 @@ +../../Task/Terminal-control-Unicode-output/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Truncate-a-file b/Lang/Batch-File/Truncate-a-file new file mode 120000 index 0000000000..18bcf16da0 --- /dev/null +++ b/Lang/Batch-File/Truncate-a-file @@ -0,0 +1 @@ +../../Task/Truncate-a-file/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/URL-decoding b/Lang/Batch-File/URL-decoding new file mode 120000 index 0000000000..4081a1f375 --- /dev/null +++ b/Lang/Batch-File/URL-decoding @@ -0,0 +1 @@ +../../Task/URL-decoding/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/URL-encoding b/Lang/Batch-File/URL-encoding new file mode 120000 index 0000000000..5609bac01d --- /dev/null +++ b/Lang/Batch-File/URL-encoding @@ -0,0 +1 @@ +../../Task/URL-encoding/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Unicode-variable-names b/Lang/Batch-File/Unicode-variable-names new file mode 120000 index 0000000000..04bbb2a08c --- /dev/null +++ b/Lang/Batch-File/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Unix-ls b/Lang/Batch-File/Unix-ls new file mode 120000 index 0000000000..d789240aba --- /dev/null +++ b/Lang/Batch-File/Unix-ls @@ -0,0 +1 @@ +../../Task/Unix-ls/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Window-creation b/Lang/Batch-File/Window-creation new file mode 120000 index 0000000000..733ac1868e --- /dev/null +++ b/Lang/Batch-File/Window-creation @@ -0,0 +1 @@ +../../Task/Window-creation/Batch-File \ No newline at end of file diff --git a/Lang/Batch-File/Write-entire-file b/Lang/Batch-File/Write-entire-file new file mode 120000 index 0000000000..ace14aef52 --- /dev/null +++ b/Lang/Batch-File/Write-entire-file @@ -0,0 +1 @@ +../../Task/Write-entire-file/Batch-File \ No newline at end of file diff --git a/Lang/Bc/Anti-primes b/Lang/Bc/Anti-primes new file mode 120000 index 0000000000..3d900bc4e9 --- /dev/null +++ b/Lang/Bc/Anti-primes @@ -0,0 +1 @@ +../../Task/Anti-primes/Bc \ No newline at end of file diff --git a/Lang/Bc/Arithmetic-derivative b/Lang/Bc/Arithmetic-derivative new file mode 120000 index 0000000000..3ff888839e --- /dev/null +++ b/Lang/Bc/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Bc \ No newline at end of file diff --git a/Lang/Bc/Department-numbers b/Lang/Bc/Department-numbers new file mode 120000 index 0000000000..0e2c9bd91f --- /dev/null +++ b/Lang/Bc/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/Bc \ No newline at end of file diff --git a/Lang/Bc/Fairshare-between-two-and-more b/Lang/Bc/Fairshare-between-two-and-more new file mode 120000 index 0000000000..f5c1a3523e --- /dev/null +++ b/Lang/Bc/Fairshare-between-two-and-more @@ -0,0 +1 @@ +../../Task/Fairshare-between-two-and-more/Bc \ No newline at end of file diff --git a/Lang/Bc/Miller-Rabin-primality-test b/Lang/Bc/Miller-Rabin-primality-test deleted file mode 120000 index 1ae2fd8406..0000000000 --- a/Lang/Bc/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Bc \ No newline at end of file diff --git a/Lang/Bc/Sieve-of-Eratosthenes b/Lang/Bc/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..de34a684a4 --- /dev/null +++ b/Lang/Bc/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/Bc \ No newline at end of file diff --git a/Lang/Bc/Variables b/Lang/Bc/Variables new file mode 120000 index 0000000000..03f47bea63 --- /dev/null +++ b/Lang/Bc/Variables @@ -0,0 +1 @@ +../../Task/Variables/Bc \ No newline at end of file diff --git a/Lang/Beeswax/00-LANG.txt b/Lang/Beeswax/00-LANG.txt index bea56d7b6b..c131bf7731 100644 --- a/Lang/Beeswax/00-LANG.txt +++ b/Lang/Beeswax/00-LANG.txt @@ -25,7 +25,7 @@ All data in the local and global stacks are unsigned 64-bit integers, output as == More information == -* [[eso:Beeswax|Esoteric languages wiki entry]] +* [http://esolangs.org/wiki/beeswax Esoteric languages wiki entry] == Reference implementation, example programs and complete language specification == diff --git a/Lang/Befunge/Sorting-algorithms-Bubble-sort b/Lang/Befunge/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..8c2d1f0a86 --- /dev/null +++ b/Lang/Befunge/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/Befunge \ No newline at end of file diff --git a/Lang/Berkeley-Logo/00-LANG.txt b/Lang/Berkeley-Logo/00-LANG.txt new file mode 100644 index 0000000000..06b91b5045 --- /dev/null +++ b/Lang/Berkeley-Logo/00-LANG.txt @@ -0,0 +1,8 @@ +{{language|Berkeley Logo}} +{{language programming paradigm|Procedural}} +{{implementation|Logo}} +'''Berkeley Logo''' (or '''UCBLogo''') is a portable implementation of the Logo language, maintained by Brian Harvey. He has also written a series of university textbooks using this language, ''Computer Science Logo Style''. + +==External links== +* [http://www.cs.berkeley.edu/~bh/logo.html Home page] +* [https://github.com/jrincayc/ucblogo-code further UCBLogo development] \ No newline at end of file diff --git a/Lang/Berkeley-Logo/00-META.yaml b/Lang/Berkeley-Logo/00-META.yaml new file mode 100644 index 0000000000..9eabccce73 --- /dev/null +++ b/Lang/Berkeley-Logo/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Berkeley_Logo diff --git a/Lang/Berkeley-Logo/Abundant-deficient-and-perfect-number-classifications b/Lang/Berkeley-Logo/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..04fb2b777b --- /dev/null +++ b/Lang/Berkeley-Logo/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/Berkeley-Logo \ No newline at end of file diff --git a/Lang/Berkeley-Logo/Associative-array-Creation b/Lang/Berkeley-Logo/Associative-array-Creation new file mode 120000 index 0000000000..4d2050642e --- /dev/null +++ b/Lang/Berkeley-Logo/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Berkeley-Logo \ No newline at end of file diff --git a/Lang/Berkeley-Logo/Babbage-problem b/Lang/Berkeley-Logo/Babbage-problem new file mode 120000 index 0000000000..aa1e4e41aa --- /dev/null +++ b/Lang/Berkeley-Logo/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/Berkeley-Logo \ No newline at end of file diff --git a/Lang/Berkeley-Logo/Bell-numbers b/Lang/Berkeley-Logo/Bell-numbers new file mode 120000 index 0000000000..77a9bcb26c --- /dev/null +++ b/Lang/Berkeley-Logo/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/Berkeley-Logo \ No newline at end of file diff --git a/Lang/Berkeley-Logo/Formatted-numeric-output b/Lang/Berkeley-Logo/Formatted-numeric-output new file mode 120000 index 0000000000..85a340c7e0 --- /dev/null +++ b/Lang/Berkeley-Logo/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/Berkeley-Logo \ No newline at end of file diff --git a/Lang/Binary-Lambda-Calculus/00-LANG.txt b/Lang/Binary-Lambda-Calculus/00-LANG.txt index b1d24e9edd..694f9a9437 100644 --- a/Lang/Binary-Lambda-Calculus/00-LANG.txt +++ b/Lang/Binary-Lambda-Calculus/00-LANG.txt @@ -5,6 +5,16 @@ }} {{language programming paradigm|functional}} '''Binary Lambda Calculus''' is a minimal, pure, functional, esoteric language based on lambda calculus. [[provides::Capability:First class functions| ]] + ==External links== -* [[eso:Binary_lambda_calculus|Esoteric languages wiki page]] -[[Category:Esoteric Languages]] \ No newline at end of file +* https://tromp.github.io/cl/cl.html +* https://www.ioccc.org/2012/tromp/hint.html +* https://gist.github.com/tromp/86b3184f852f65bfb814e3ab0987d861 + +Some implementations of BLC: +* [https://www.ioccc.org/2012/tromp/hint.html original tromp's implementation] for IOCCC, in pure ANSI C +* [https://github.com/tromp/AIT tromp's AIT], a project utilizing BLC for Information Theory research. Also includes a Haskell->BLC compiler and several other implementations +* [https://codeberg.org/aartaka/cl-blc aartaka's cl-blc], implementing BLC in Lisp + +==To do== +[[Tasks not implemented in Binary Lambda Calculus]] \ No newline at end of file diff --git a/Lang/Binary-Lambda-Calculus/A+B b/Lang/Binary-Lambda-Calculus/A+B new file mode 120000 index 0000000000..1a7c10c298 --- /dev/null +++ b/Lang/Binary-Lambda-Calculus/A+B @@ -0,0 +1 @@ +../../Task/A+B/Binary-Lambda-Calculus \ No newline at end of file diff --git a/Lang/Binary-Lambda-Calculus/Binary-digits b/Lang/Binary-Lambda-Calculus/Binary-digits new file mode 120000 index 0000000000..f74ad898bd --- /dev/null +++ b/Lang/Binary-Lambda-Calculus/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Binary-Lambda-Calculus \ No newline at end of file diff --git a/Lang/Binary-Lambda-Calculus/Church-numerals b/Lang/Binary-Lambda-Calculus/Church-numerals new file mode 120000 index 0000000000..45f7ab14bd --- /dev/null +++ b/Lang/Binary-Lambda-Calculus/Church-numerals @@ -0,0 +1 @@ +../../Task/Church-numerals/Binary-Lambda-Calculus \ No newline at end of file diff --git a/Lang/Binary-Lambda-Calculus/Ethiopian-multiplication b/Lang/Binary-Lambda-Calculus/Ethiopian-multiplication new file mode 120000 index 0000000000..45465fad0c --- /dev/null +++ b/Lang/Binary-Lambda-Calculus/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Binary-Lambda-Calculus \ No newline at end of file diff --git a/Lang/Binary-Lambda-Calculus/Hailstone-sequence b/Lang/Binary-Lambda-Calculus/Hailstone-sequence new file mode 120000 index 0000000000..8bb334bdb3 --- /dev/null +++ b/Lang/Binary-Lambda-Calculus/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Binary-Lambda-Calculus \ No newline at end of file diff --git a/Lang/Binary-Lambda-Calculus/Hello-world-Newbie b/Lang/Binary-Lambda-Calculus/Hello-world-Newbie new file mode 120000 index 0000000000..290aaa1bd5 --- /dev/null +++ b/Lang/Binary-Lambda-Calculus/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/Binary-Lambda-Calculus \ No newline at end of file diff --git a/Lang/Binary-Lambda-Calculus/Hello-world-Text b/Lang/Binary-Lambda-Calculus/Hello-world-Text deleted file mode 120000 index b4dcf8b8a8..0000000000 --- a/Lang/Binary-Lambda-Calculus/Hello-world-Text +++ /dev/null @@ -1 +0,0 @@ -../../Task/Hello-world-Text/Binary-Lambda-Calculus \ No newline at end of file diff --git a/Lang/Binary-Lambda-Calculus/Quine b/Lang/Binary-Lambda-Calculus/Quine deleted file mode 120000 index 2c1595a394..0000000000 --- a/Lang/Binary-Lambda-Calculus/Quine +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quine/Binary-Lambda-Calculus \ No newline at end of file diff --git a/Lang/Binary-Lambda-Calculus/Shell-one-liner b/Lang/Binary-Lambda-Calculus/Shell-one-liner new file mode 120000 index 0000000000..c3cce2be43 --- /dev/null +++ b/Lang/Binary-Lambda-Calculus/Shell-one-liner @@ -0,0 +1 @@ +../../Task/Shell-one-liner/Binary-Lambda-Calculus \ No newline at end of file diff --git a/Lang/Binary-Lambda-Calculus/Sorting-algorithms-Merge-sort b/Lang/Binary-Lambda-Calculus/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..6a9a8bf4e0 --- /dev/null +++ b/Lang/Binary-Lambda-Calculus/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/Binary-Lambda-Calculus \ No newline at end of file diff --git a/Lang/Blade/00-LANG.txt b/Lang/Blade/00-LANG.txt index f18c210bc3..71d6c9cdba 100644 --- a/Lang/Blade/00-LANG.txt +++ b/Lang/Blade/00-LANG.txt @@ -6,25 +6,13 @@ |parampass=value |LCT=yes}}{{language programming paradigm|Object-oriented}}{{language programming paradigm|functional}} -'''Blade''' is a simple, fast, clean and dynamic language that allows you to develop complex applications quickly. Blade emphasises algorithm over syntax and for this reason, it has a very small but powerful syntax set with a very natural feel. +'''Blade''' is a modern general-purpose programming language focused on enterprise Web, IoT, and secure application development. '''Blade''' offers a comprehensive set of tools and libraries out of the box leading to reduced reliance on third-party packages. -If you’ve ever had experience with a compiled language (e.g. [[C]]/[[C++]], [[Java]], etc), then one thing you’ll quickly notice (at least I did) was how much the whole process of write-compile-run-debug can be tedious and get in the way of creative programming and sometimes you even forget that mind-blowing algorithm you were going to write and take over the world in the whole process of compiling. +'''Blade''' comes equipped with an integrated package management system, simplifying the management of both internal and external dependencies and a self-hostable repository server making it ideal for private organisational and personal use. Its intuitive syntax and gentle learning curve ensure an accessible experience for developers of all skill levels. Leveraging the best features from JavaScript, Python, Ruby, and Dart, '''Blade''' provides a familiar and robust ecosystem that enables developers to harness the strengths of these languages effortlessly. -Sometimes, you just want to automate a few tasks, for example, I have a simple program to always remind me to get away from my laptop and eat something (you know how it is) and yet another one to suggest food for me. Do you find yourself needing this often? Do you know why you haven’t written it? Get out of your head, you are writing a compiled language! Compiling takes longer than the time it will take you to convince yourself that you need to eat. - -At other times, you have written this amazing program and you want users to be able to control it using a simple scripting language. I know… I know… there are many interpreted languages out there that will do the job just fine. Well… you still have one problem. Your users aren’t going to remember all the crazy going on in many of them (Yes [[Lua]]! I’m staring at you. What you gonna do about it?) - -Other times, we kind of find a very good solution to our problem in languages like [[Python]] (I must confess, even '''Blade''' did learn a lot of things from it), but the structure of such languages usually creates a new overhead in writing complex programs. It’s really difficult keeping a tab of indentations in such languages especially when you are not in a GUI IDE environment. I tried to work [[Python]] in nano, but man… it wasn’t easy. - -If you are feeling me, then Blade is just right for you. - -Blade is a simple language that has tried very much to learn from the mistake and successes of its predecessors. - -Blade is interpreted and simple like [[Python]] but with a more generic [[C]]-like syntax and a ridiculously simple Object-orientation similar to [[Dart]] and the granularity of [[JavaScript]] while still maintaining a very minimal syntax and keywords when compared to all of them. - -'''Blade is designed to be a memorizable language and the entire “language” can be learned in one sitting. However, Blade is as complete and powerful as any language can be and can be applied in the field of web, mobile, desktop, scientific, academic and research engineering to mention a few.''' +While '''Blade''' focuses on Web and IoT, it is also great for general software development. ==Links== -* [https://bladelang.com https://bladelang.com] +* [https://bladelang.org https://bladelang.org] * [https://github.com/blade-lang/blade https://github.com/blade-lang/blade] -* [https://bladelang.com/quick-learn.html Quick Language Introduction] \ No newline at end of file +* [https://bladelang.org/quick-learn.html Quick Language Introduction] \ No newline at end of file diff --git a/Lang/BlooP/00-LANG.txt b/Lang/BlooP/00-LANG.txt index 61490d18ec..d0fc3b449f 100644 --- a/Lang/BlooP/00-LANG.txt +++ b/Lang/BlooP/00-LANG.txt @@ -20,7 +20,7 @@ The best way to explain BlooP is really just to look at some examples, so here a Find the factorial of N: - + DEFINE PROCEDURE FACTORIAL [N]: BLOCK 0: BEGIN OUTPUT <= 1; @@ -31,11 +31,11 @@ BLOCK 0: BEGIN CELL(0) <= CELL(0) + 1; BLOCK 1: END; BLOCK 0: END. - - + + subtraction (this is the only way to do it, since it must be defined in terms of addition): - + DEFINE PROCEDURE MINUS [M,N]: BLOCK 0: BEGIN OUTPUT <= 0; @@ -48,12 +48,12 @@ BLOCK 0: BEGIN OUTPUT <= OUTPUT + 1; BLOCK 1: END; BLOCK 0: END. - + Nim game in BlooP. Since user input is not possible in most implementations, this version uses a procedure which takes 3 numbers. - + DEFINE PROCEDURE ''DIVIDE'' [A,B]: BLOCK 0: BEGIN IF A < B, THEN: @@ -145,7 +145,7 @@ BLOCK 0: BEGIN BLOCK 0: END. PLAY_GAME [2,1,1]; - + {{out}}
diff --git a/Lang/BootBASIC/00-LANG.txt b/Lang/BootBASIC/00-LANG.txt
index a8f62b2d80..42d742f5c8 100644
--- a/Lang/BootBASIC/00-LANG.txt
+++ b/Lang/BootBASIC/00-LANG.txt
@@ -3,4 +3,8 @@
           |tags=basic,bootbasic
           }}
 {{Implementation|BASIC}}
-bootBASIC is an Integer BASIC interpreter created by Óscar Toledo Gutierrez that runs entirely within a boot sector on an x86-compatible machine, which is 512 bytes.
\ No newline at end of file
+bootBASIC is an Integer BASIC interpreter created by Óscar Toledo Gutierrez that runs entirely within a boot sector on an x86-compatible machine, which is 512 bytes.
+
+==See Also==
+*[https://github.com/nanochess/bootBASIC bootBASIC on GitHub]
+*[https://parkertomatoes.github.io/v86/?type=mbr&content=Dg4OHwcX%2FL8AgMYFDUd1%2BrwA%2F7gQfFCwPuhPAegRAQnAdA7olgGX86TD6GwACcB0WOjiAIA8DXRQv8V9igVHmEh0E5FW86Z1BljoyQD%2FJQHPR0de6%2BbotABQrDw9dDS%2BZ3zoJgHrqUAjIQ0xwFDoSwGWgDwNdAtYUOigAKzoKQF1%2BlhAPegDdeTD6IAAULA%2F6NgA6AMAX6vD6BwAgDwtdA6APCt141DoDQBZAcjr7VDoBAD32OvzRugfAIA8L3QOgDwqdcRQ6BAAWffp6%2B1Q6AcAWZGZ9%2Fnr4kboOQCsPCh1C%2Bi0%2F4A8KXQr6XL%2FPEBzBk7oOwDrHzxydQuAPG51Bq3kQLQAw%2BgFAJOLB8OsJB8AwLR%2BTkaAPCB0%2BsMx0rkKAPfxCcBSdAPo8f9YBDDreTHbrCwwPAqYk3MJuQoA9%2BEBw%2BvuTsPNIOhO%2F7kxwOhrAIH8%2Fv50BKP8%2FsNQXgUUAFDozf5YPSDOdfHD6DsAvoB%2BVl%2FoLwCqPAh1Ak9PPA118sOsPA10JjwidQ2sPCJ0D%2BgWADwNdfTDTuj9%2Fuh9%2F6w8O3UJw7QAzRY8DXUHsAroAgCwDbQOuwcAzRDDuRQA9%2BEFAIDDBG5ldwB8BWxpc3RrfARydW5MfQZwcmludIJ9BmlucHV0inwDaWYqfAVnb3RvSH0Hc3lzdGVtRn0BVao%3D Try bootBASIC in v86 in your browser]
\ No newline at end of file
diff --git a/Lang/BootBASIC/Empty-program b/Lang/BootBASIC/Empty-program
deleted file mode 120000
index 5aaffbd057..0000000000
--- a/Lang/BootBASIC/Empty-program
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Empty-program/BootBASIC
\ No newline at end of file
diff --git a/Lang/BootBASIC/Fibonacci-sequence b/Lang/BootBASIC/Fibonacci-sequence
new file mode 120000
index 0000000000..e7275cf6a0
--- /dev/null
+++ b/Lang/BootBASIC/Fibonacci-sequence
@@ -0,0 +1 @@
+../../Task/Fibonacci-sequence/BootBASIC
\ No newline at end of file
diff --git a/Lang/BootBASIC/Loops-Break b/Lang/BootBASIC/Loops-Break
new file mode 120000
index 0000000000..6efa12814e
--- /dev/null
+++ b/Lang/BootBASIC/Loops-Break
@@ -0,0 +1 @@
+../../Task/Loops-Break/BootBASIC
\ No newline at end of file
diff --git a/Lang/BootBASIC/Loops-N-plus-one-half b/Lang/BootBASIC/Loops-N-plus-one-half
new file mode 120000
index 0000000000..6d9ca0cae0
--- /dev/null
+++ b/Lang/BootBASIC/Loops-N-plus-one-half
@@ -0,0 +1 @@
+../../Task/Loops-N-plus-one-half/BootBASIC
\ No newline at end of file
diff --git a/Lang/Bracmat/Miller-Rabin-primality-test b/Lang/Bracmat/Miller-Rabin-primality-test
deleted file mode 120000
index 7c953943cd..0000000000
--- a/Lang/Bracmat/Miller-Rabin-primality-test
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Miller-Rabin-primality-test/Bracmat
\ No newline at end of file
diff --git a/Lang/Brainf---/00-LANG.txt b/Lang/Brainf---/00-LANG.txt
index 7b702b4d45..d9ca931bf4 100644
--- a/Lang/Brainf---/00-LANG.txt
+++ b/Lang/Brainf---/00-LANG.txt
@@ -63,10 +63,10 @@ BUT due to vehement opposition to the name [http://esolangs.org/wiki/Cupid vario
 ==See also==
 * [[Rosetta Code:Brainf***]]  ( why some people call it BF :)
 * [[RCBF]] - BF interpreters as a Rosetta Code task
-
+* [https://esolangs.org/wiki/brainfuck_algorithms brainf*** algorithms]
 ==Citations==
 
-* [[eso:Brainfuck|Esoteric languages wiki entry]]
+* [https://esolangs.org/wiki/Brainfuck Esoteric languages wiki entry]
 *[[wp:Brainfuck|Wikipedia entry on Brainf***]]
 * [http://dmoz.org/Computers/Programming/Languages/Brainfuck/ DMOZ Brainf*** category]
 * [http://www.iwriteiam.nl/Ha_BF.html Brainf*** tutorial]
diff --git a/Lang/Brainf---/Loops-While b/Lang/Brainf---/Loops-While
new file mode 120000
index 0000000000..057717ea5a
--- /dev/null
+++ b/Lang/Brainf---/Loops-While
@@ -0,0 +1 @@
+../../Task/Loops-While/Brainf---
\ No newline at end of file
diff --git a/Lang/Bruijn/00-LANG.txt b/Lang/Bruijn/00-LANG.txt
new file mode 100644
index 0000000000..c0c565d6e8
--- /dev/null
+++ b/Lang/Bruijn/00-LANG.txt
@@ -0,0 +1,10 @@
+{{language|bruijn
+  |exec=interpreted
+  |LCT=no
+  |site=https://bruijn.marvinborner.de}}{{language programming paradigm|functional}}
+
+Bruijn is a [[functional_programming|functional]] programming language based on pure [[wp:lambda_calculus|lambda calculus]]. It uses De Bruijn indices instead of named variables and square brackets for abstractions. Like pure lambda calculus, bruijn can be compiled to [https://tromp.github.io/cl/Binary_lambda_calculus.html Binary Lambda Calculus]. Unlike pure lambda calculus, you can define named substitution rules. Bruijn has a large standard library of such definitions.
+
+Bruijn does not have primitive functions or data types. Every function (including add, map, mul, etc.) is implemented in bruijn itself. Numbers, strings, or chars are syntactic sugar for data encoded as closed terms/abstractions.
+
+Documentation can be found at https://bruijn.marvinborner.de/wiki/.
\ No newline at end of file
diff --git a/Lang/Bruijn/00-META.yaml b/Lang/Bruijn/00-META.yaml
new file mode 100644
index 0000000000..1ddd70ba76
--- /dev/null
+++ b/Lang/Bruijn/00-META.yaml
@@ -0,0 +1,2 @@
+---
+from: http://rosettacode.org/wiki/Category:Bruijn
diff --git a/Lang/Bruijn/99-bottles-of-beer b/Lang/Bruijn/99-bottles-of-beer
new file mode 120000
index 0000000000..12eb60082e
--- /dev/null
+++ b/Lang/Bruijn/99-bottles-of-beer
@@ -0,0 +1 @@
+../../Task/99-bottles-of-beer/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/A+B b/Lang/Bruijn/A+B
new file mode 120000
index 0000000000..f6bd8616cf
--- /dev/null
+++ b/Lang/Bruijn/A+B
@@ -0,0 +1 @@
+../../Task/A+B/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Ackermann-function b/Lang/Bruijn/Ackermann-function
new file mode 120000
index 0000000000..e9f8313783
--- /dev/null
+++ b/Lang/Bruijn/Ackermann-function
@@ -0,0 +1 @@
+../../Task/Ackermann-function/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Balanced-ternary b/Lang/Bruijn/Balanced-ternary
new file mode 120000
index 0000000000..1c4c028d9c
--- /dev/null
+++ b/Lang/Bruijn/Balanced-ternary
@@ -0,0 +1 @@
+../../Task/Balanced-ternary/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Binary-search b/Lang/Bruijn/Binary-search
new file mode 120000
index 0000000000..9cd581be5b
--- /dev/null
+++ b/Lang/Bruijn/Binary-search
@@ -0,0 +1 @@
+../../Task/Binary-search/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Comments b/Lang/Bruijn/Comments
new file mode 120000
index 0000000000..e8f4b26296
--- /dev/null
+++ b/Lang/Bruijn/Comments
@@ -0,0 +1 @@
+../../Task/Comments/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Compare-a-list-of-strings b/Lang/Bruijn/Compare-a-list-of-strings
new file mode 120000
index 0000000000..3f35113df1
--- /dev/null
+++ b/Lang/Bruijn/Compare-a-list-of-strings
@@ -0,0 +1 @@
+../../Task/Compare-a-list-of-strings/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Determine-sentence-type b/Lang/Bruijn/Determine-sentence-type
new file mode 120000
index 0000000000..9232c5b2ff
--- /dev/null
+++ b/Lang/Bruijn/Determine-sentence-type
@@ -0,0 +1 @@
+../../Task/Determine-sentence-type/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Empty-program b/Lang/Bruijn/Empty-program
new file mode 120000
index 0000000000..2f8df23d95
--- /dev/null
+++ b/Lang/Bruijn/Empty-program
@@ -0,0 +1 @@
+../../Task/Empty-program/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Factorial b/Lang/Bruijn/Factorial
new file mode 120000
index 0000000000..52a5a29667
--- /dev/null
+++ b/Lang/Bruijn/Factorial
@@ -0,0 +1 @@
+../../Task/Factorial/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Fibonacci-sequence b/Lang/Bruijn/Fibonacci-sequence
new file mode 120000
index 0000000000..0eac3a48a3
--- /dev/null
+++ b/Lang/Bruijn/Fibonacci-sequence
@@ -0,0 +1 @@
+../../Task/Fibonacci-sequence/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/FizzBuzz b/Lang/Bruijn/FizzBuzz
new file mode 120000
index 0000000000..c2194b65ee
--- /dev/null
+++ b/Lang/Bruijn/FizzBuzz
@@ -0,0 +1 @@
+../../Task/FizzBuzz/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Function-composition b/Lang/Bruijn/Function-composition
new file mode 120000
index 0000000000..9f9efd944a
--- /dev/null
+++ b/Lang/Bruijn/Function-composition
@@ -0,0 +1 @@
+../../Task/Function-composition/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Greatest-common-divisor b/Lang/Bruijn/Greatest-common-divisor
new file mode 120000
index 0000000000..3967007f1d
--- /dev/null
+++ b/Lang/Bruijn/Greatest-common-divisor
@@ -0,0 +1 @@
+../../Task/Greatest-common-divisor/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Hailstone-sequence b/Lang/Bruijn/Hailstone-sequence
new file mode 120000
index 0000000000..6f6aabadc5
--- /dev/null
+++ b/Lang/Bruijn/Hailstone-sequence
@@ -0,0 +1 @@
+../../Task/Hailstone-sequence/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Halt-and-catch-fire b/Lang/Bruijn/Halt-and-catch-fire
new file mode 120000
index 0000000000..ee57eeb8b4
--- /dev/null
+++ b/Lang/Bruijn/Halt-and-catch-fire
@@ -0,0 +1 @@
+../../Task/Halt-and-catch-fire/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Hamming-numbers b/Lang/Bruijn/Hamming-numbers
new file mode 120000
index 0000000000..d835227d4a
--- /dev/null
+++ b/Lang/Bruijn/Hamming-numbers
@@ -0,0 +1 @@
+../../Task/Hamming-numbers/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Harmonic-series b/Lang/Bruijn/Harmonic-series
new file mode 120000
index 0000000000..b39ae4ae88
--- /dev/null
+++ b/Lang/Bruijn/Harmonic-series
@@ -0,0 +1 @@
+../../Task/Harmonic-series/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Hello-world-Text b/Lang/Bruijn/Hello-world-Text
new file mode 120000
index 0000000000..f5faaa0772
--- /dev/null
+++ b/Lang/Bruijn/Hello-world-Text
@@ -0,0 +1 @@
+../../Task/Hello-world-Text/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Higher-order-functions b/Lang/Bruijn/Higher-order-functions
new file mode 120000
index 0000000000..490f30652f
--- /dev/null
+++ b/Lang/Bruijn/Higher-order-functions
@@ -0,0 +1 @@
+../../Task/Higher-order-functions/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Least-common-multiple b/Lang/Bruijn/Least-common-multiple
new file mode 120000
index 0000000000..6042ac6fee
--- /dev/null
+++ b/Lang/Bruijn/Least-common-multiple
@@ -0,0 +1 @@
+../../Task/Least-common-multiple/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Levenshtein-distance b/Lang/Bruijn/Levenshtein-distance
new file mode 120000
index 0000000000..e4887437b4
--- /dev/null
+++ b/Lang/Bruijn/Levenshtein-distance
@@ -0,0 +1 @@
+../../Task/Levenshtein-distance/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Loops-Infinite b/Lang/Bruijn/Loops-Infinite
new file mode 120000
index 0000000000..038234feba
--- /dev/null
+++ b/Lang/Bruijn/Loops-Infinite
@@ -0,0 +1 @@
+../../Task/Loops-Infinite/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Luhn-test-of-credit-card-numbers b/Lang/Bruijn/Luhn-test-of-credit-card-numbers
new file mode 120000
index 0000000000..b0e2d09631
--- /dev/null
+++ b/Lang/Bruijn/Luhn-test-of-credit-card-numbers
@@ -0,0 +1 @@
+../../Task/Luhn-test-of-credit-card-numbers/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Mutual-recursion b/Lang/Bruijn/Mutual-recursion
new file mode 120000
index 0000000000..daa75b7694
--- /dev/null
+++ b/Lang/Bruijn/Mutual-recursion
@@ -0,0 +1 @@
+../../Task/Mutual-recursion/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Palindrome-detection b/Lang/Bruijn/Palindrome-detection
new file mode 120000
index 0000000000..928ca8c645
--- /dev/null
+++ b/Lang/Bruijn/Palindrome-detection
@@ -0,0 +1 @@
+../../Task/Palindrome-detection/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Prime-decomposition b/Lang/Bruijn/Prime-decomposition
new file mode 120000
index 0000000000..2989bd88b7
--- /dev/null
+++ b/Lang/Bruijn/Prime-decomposition
@@ -0,0 +1 @@
+../../Task/Prime-decomposition/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Sierpinski-triangle-Graphical b/Lang/Bruijn/Sierpinski-triangle-Graphical
new file mode 120000
index 0000000000..5b896de867
--- /dev/null
+++ b/Lang/Bruijn/Sierpinski-triangle-Graphical
@@ -0,0 +1 @@
+../../Task/Sierpinski-triangle-Graphical/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Sorting-algorithms-Quicksort b/Lang/Bruijn/Sorting-algorithms-Quicksort
new file mode 120000
index 0000000000..88bc24e9de
--- /dev/null
+++ b/Lang/Bruijn/Sorting-algorithms-Quicksort
@@ -0,0 +1 @@
+../../Task/Sorting-algorithms-Quicksort/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Sum-and-product-of-an-array b/Lang/Bruijn/Sum-and-product-of-an-array
new file mode 120000
index 0000000000..c56dea86f1
--- /dev/null
+++ b/Lang/Bruijn/Sum-and-product-of-an-array
@@ -0,0 +1 @@
+../../Task/Sum-and-product-of-an-array/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Ternary-logic b/Lang/Bruijn/Ternary-logic
new file mode 120000
index 0000000000..a4a336036c
--- /dev/null
+++ b/Lang/Bruijn/Ternary-logic
@@ -0,0 +1 @@
+../../Task/Ternary-logic/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Test-a-function b/Lang/Bruijn/Test-a-function
new file mode 120000
index 0000000000..de62e05f97
--- /dev/null
+++ b/Lang/Bruijn/Test-a-function
@@ -0,0 +1 @@
+../../Task/Test-a-function/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Towers-of-Hanoi b/Lang/Bruijn/Towers-of-Hanoi
new file mode 120000
index 0000000000..96dafe6af8
--- /dev/null
+++ b/Lang/Bruijn/Towers-of-Hanoi
@@ -0,0 +1 @@
+../../Task/Towers-of-Hanoi/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Validate-International-Securities-Identification-Number b/Lang/Bruijn/Validate-International-Securities-Identification-Number
new file mode 120000
index 0000000000..b96ffce45d
--- /dev/null
+++ b/Lang/Bruijn/Validate-International-Securities-Identification-Number
@@ -0,0 +1 @@
+../../Task/Validate-International-Securities-Identification-Number/Bruijn
\ No newline at end of file
diff --git a/Lang/Bruijn/Y-combinator b/Lang/Bruijn/Y-combinator
new file mode 120000
index 0000000000..3614ec75d6
--- /dev/null
+++ b/Lang/Bruijn/Y-combinator
@@ -0,0 +1 @@
+../../Task/Y-combinator/Bruijn
\ No newline at end of file
diff --git a/Lang/Burlesque/00-LANG.txt b/Lang/Burlesque/00-LANG.txt
index f4c2e90e61..ed9fb4f3d9 100644
--- a/Lang/Burlesque/00-LANG.txt
+++ b/Lang/Burlesque/00-LANG.txt
@@ -13,12 +13,12 @@ allows to hide elements at the bottom of the stack and load it from there. Burle
 (There is only a while loop, but functions like map/reduce/filter obviously loop over lists implicit. Therefore, while loops are rarely used). Burlesque
 is turing-complete. A brainfuck interpreter:
 
-
+
 ".""X"r~"-""\/^^{vvvv}c!!!-.256.%{vvvv}c!sa\/"r~"+""\/^^{vvvv}c!!!+.
 256.%{vvvv}c!sa\/"r~"[""{"r~"]""}{\/^^{vvvv}c!!!}w!"r~">""+."r~"<""
 -."r~"X""\/^^{vvvv}c!!!L[+]\/+]\/+]^^3\/.+1RAp^\/+]\/[-1RA^^-]\/[-\/
 "r~"\'\'1 128r@{vv0}m[0"\/.+pse!vvvv<-sh
-
+
 
 
 You might also want to read the article on [[eso:Burlesque|esowiki]].
diff --git a/Lang/C++/ADFGVX-cipher b/Lang/C++/ADFGVX-cipher
new file mode 120000
index 0000000000..98aa7139a3
--- /dev/null
+++ b/Lang/C++/ADFGVX-cipher
@@ -0,0 +1 @@
+../../Task/ADFGVX-cipher/C++
\ No newline at end of file
diff --git a/Lang/C++/Add-a-variable-to-a-class-instance-at-runtime b/Lang/C++/Add-a-variable-to-a-class-instance-at-runtime
new file mode 120000
index 0000000000..61888079c6
--- /dev/null
+++ b/Lang/C++/Add-a-variable-to-a-class-instance-at-runtime
@@ -0,0 +1 @@
+../../Task/Add-a-variable-to-a-class-instance-at-runtime/C++
\ No newline at end of file
diff --git a/Lang/C++/Bioinformatics-base-count b/Lang/C++/Bioinformatics-base-count
deleted file mode 120000
index e0584bb6b7..0000000000
--- a/Lang/C++/Bioinformatics-base-count
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Bioinformatics-base-count/C++
\ No newline at end of file
diff --git a/Lang/C++/Bitcoin-address-validation b/Lang/C++/Bitcoin-address-validation
new file mode 120000
index 0000000000..fdb6fa9bf8
--- /dev/null
+++ b/Lang/C++/Bitcoin-address-validation
@@ -0,0 +1 @@
+../../Task/Bitcoin-address-validation/C++
\ No newline at end of file
diff --git a/Lang/C++/Bitcoin-public-point-to-address b/Lang/C++/Bitcoin-public-point-to-address
new file mode 120000
index 0000000000..1229c8b30f
--- /dev/null
+++ b/Lang/C++/Bitcoin-public-point-to-address
@@ -0,0 +1 @@
+../../Task/Bitcoin-public-point-to-address/C++
\ No newline at end of file
diff --git a/Lang/C++/Bitwise-IO b/Lang/C++/Bitwise-IO
new file mode 120000
index 0000000000..0612736bad
--- /dev/null
+++ b/Lang/C++/Bitwise-IO
@@ -0,0 +1 @@
+../../Task/Bitwise-IO/C++
\ No newline at end of file
diff --git a/Lang/C++/Catmull-Clark-subdivision-surface b/Lang/C++/Catmull-Clark-subdivision-surface
new file mode 120000
index 0000000000..dbaa0ac83b
--- /dev/null
+++ b/Lang/C++/Catmull-Clark-subdivision-surface
@@ -0,0 +1 @@
+../../Task/Catmull-Clark-subdivision-surface/C++
\ No newline at end of file
diff --git a/Lang/C++/Commatizing-numbers b/Lang/C++/Commatizing-numbers
new file mode 120000
index 0000000000..96b27f445d
--- /dev/null
+++ b/Lang/C++/Commatizing-numbers
@@ -0,0 +1 @@
+../../Task/Commatizing-numbers/C++
\ No newline at end of file
diff --git a/Lang/C++/Compare-sorting-algorithms-performance b/Lang/C++/Compare-sorting-algorithms-performance
new file mode 120000
index 0000000000..8616fdb726
--- /dev/null
+++ b/Lang/C++/Compare-sorting-algorithms-performance
@@ -0,0 +1 @@
+../../Task/Compare-sorting-algorithms-performance/C++
\ No newline at end of file
diff --git a/Lang/C++/Compiler-virtual-machine-interpreter b/Lang/C++/Compiler-virtual-machine-interpreter
new file mode 120000
index 0000000000..94f3cd637b
--- /dev/null
+++ b/Lang/C++/Compiler-virtual-machine-interpreter
@@ -0,0 +1 @@
+../../Task/Compiler-virtual-machine-interpreter/C++
\ No newline at end of file
diff --git a/Lang/C++/Convert-decimal-number-to-rational b/Lang/C++/Convert-decimal-number-to-rational
new file mode 120000
index 0000000000..b38261fbb7
--- /dev/null
+++ b/Lang/C++/Convert-decimal-number-to-rational
@@ -0,0 +1 @@
+../../Task/Convert-decimal-number-to-rational/C++
\ No newline at end of file
diff --git a/Lang/C++/Currency b/Lang/C++/Currency
new file mode 120000
index 0000000000..ae0e8d6190
--- /dev/null
+++ b/Lang/C++/Currency
@@ -0,0 +1 @@
+../../Task/Currency/C++
\ No newline at end of file
diff --git a/Lang/C++/Deconvolution-2D+ b/Lang/C++/Deconvolution-2D+
new file mode 120000
index 0000000000..dba078e8e0
--- /dev/null
+++ b/Lang/C++/Deconvolution-2D+
@@ -0,0 +1 @@
+../../Task/Deconvolution-2D+/C++
\ No newline at end of file
diff --git a/Lang/C++/Documentation b/Lang/C++/Documentation
new file mode 120000
index 0000000000..dd69dde201
--- /dev/null
+++ b/Lang/C++/Documentation
@@ -0,0 +1 @@
+../../Task/Documentation/C++
\ No newline at end of file
diff --git a/Lang/C++/Dominoes b/Lang/C++/Dominoes
new file mode 120000
index 0000000000..5c79b6947b
--- /dev/null
+++ b/Lang/C++/Dominoes
@@ -0,0 +1 @@
+../../Task/Dominoes/C++
\ No newline at end of file
diff --git a/Lang/C++/Dynamic-variable-names b/Lang/C++/Dynamic-variable-names
new file mode 120000
index 0000000000..315556ef17
--- /dev/null
+++ b/Lang/C++/Dynamic-variable-names
@@ -0,0 +1 @@
+../../Task/Dynamic-variable-names/C++
\ No newline at end of file
diff --git a/Lang/C++/Euclid-Mullin-sequence b/Lang/C++/Euclid-Mullin-sequence
new file mode 120000
index 0000000000..f743f51e54
--- /dev/null
+++ b/Lang/C++/Euclid-Mullin-sequence
@@ -0,0 +1 @@
+../../Task/Euclid-Mullin-sequence/C++
\ No newline at end of file
diff --git a/Lang/C++/Extend-your-language b/Lang/C++/Extend-your-language
new file mode 120000
index 0000000000..da1eb035c9
--- /dev/null
+++ b/Lang/C++/Extend-your-language
@@ -0,0 +1 @@
+../../Task/Extend-your-language/C++
\ No newline at end of file
diff --git a/Lang/C++/Extreme-floating-point-values b/Lang/C++/Extreme-floating-point-values
new file mode 120000
index 0000000000..36dd74b460
--- /dev/null
+++ b/Lang/C++/Extreme-floating-point-values
@@ -0,0 +1 @@
+../../Task/Extreme-floating-point-values/C++
\ No newline at end of file
diff --git a/Lang/C++/Factorial-base-numbers-indexing-permutations-of-a-collection b/Lang/C++/Factorial-base-numbers-indexing-permutations-of-a-collection
new file mode 120000
index 0000000000..9b984d5ea4
--- /dev/null
+++ b/Lang/C++/Factorial-base-numbers-indexing-permutations-of-a-collection
@@ -0,0 +1 @@
+../../Task/Factorial-base-numbers-indexing-permutations-of-a-collection/C++
\ No newline at end of file
diff --git a/Lang/C++/First-class-environments b/Lang/C++/First-class-environments
new file mode 120000
index 0000000000..652816150b
--- /dev/null
+++ b/Lang/C++/First-class-environments
@@ -0,0 +1 @@
+../../Task/First-class-environments/C++
\ No newline at end of file
diff --git a/Lang/C++/French-Republican-calendar b/Lang/C++/French-Republican-calendar
new file mode 120000
index 0000000000..b361af00f6
--- /dev/null
+++ b/Lang/C++/French-Republican-calendar
@@ -0,0 +1 @@
+../../Task/French-Republican-calendar/C++
\ No newline at end of file
diff --git a/Lang/C++/Functional-coverage-tree b/Lang/C++/Functional-coverage-tree
new file mode 120000
index 0000000000..06e1a4bfaf
--- /dev/null
+++ b/Lang/C++/Functional-coverage-tree
@@ -0,0 +1 @@
+../../Task/Functional-coverage-tree/C++
\ No newline at end of file
diff --git a/Lang/C++/Im-a-software-engineer-get-me-out-of-here b/Lang/C++/Im-a-software-engineer-get-me-out-of-here
new file mode 120000
index 0000000000..7c9de1375f
--- /dev/null
+++ b/Lang/C++/Im-a-software-engineer-get-me-out-of-here
@@ -0,0 +1 @@
+../../Task/Im-a-software-engineer-get-me-out-of-here/C++
\ No newline at end of file
diff --git a/Lang/C++/MD5-Implementation b/Lang/C++/MD5-Implementation
new file mode 120000
index 0000000000..b31aca0e67
--- /dev/null
+++ b/Lang/C++/MD5-Implementation
@@ -0,0 +1 @@
+../../Task/MD5-Implementation/C++
\ No newline at end of file
diff --git a/Lang/C++/Meissel-Mertens-constant b/Lang/C++/Meissel-Mertens-constant
deleted file mode 120000
index 3242c970c7..0000000000
--- a/Lang/C++/Meissel-Mertens-constant
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Meissel-Mertens-constant/C++
\ No newline at end of file
diff --git a/Lang/C++/Miller-Rabin-primality-test b/Lang/C++/Miller-Rabin-primality-test
deleted file mode 120000
index 615ee001e8..0000000000
--- a/Lang/C++/Miller-Rabin-primality-test
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Miller-Rabin-primality-test/C++
\ No newline at end of file
diff --git a/Lang/C++/Natural-sorting b/Lang/C++/Natural-sorting
new file mode 120000
index 0000000000..221a15ac6d
--- /dev/null
+++ b/Lang/C++/Natural-sorting
@@ -0,0 +1 @@
+../../Task/Natural-sorting/C++
\ No newline at end of file
diff --git a/Lang/C++/Non-transitive-dice b/Lang/C++/Non-transitive-dice
new file mode 120000
index 0000000000..2c6300fda7
--- /dev/null
+++ b/Lang/C++/Non-transitive-dice
@@ -0,0 +1 @@
+../../Task/Non-transitive-dice/C++
\ No newline at end of file
diff --git a/Lang/C++/Own-digits-power-sum b/Lang/C++/Own-digits-power-sum
new file mode 120000
index 0000000000..766e68b021
--- /dev/null
+++ b/Lang/C++/Own-digits-power-sum
@@ -0,0 +1 @@
+../../Task/Own-digits-power-sum/C++
\ No newline at end of file
diff --git a/Lang/C++/P-Adic-numbers-basic b/Lang/C++/P-Adic-numbers-basic
new file mode 120000
index 0000000000..a3301f743f
--- /dev/null
+++ b/Lang/C++/P-Adic-numbers-basic
@@ -0,0 +1 @@
+../../Task/P-Adic-numbers-basic/C++
\ No newline at end of file
diff --git a/Lang/C++/P-Adic-square-roots b/Lang/C++/P-Adic-square-roots
new file mode 120000
index 0000000000..a25d0f7d5c
--- /dev/null
+++ b/Lang/C++/P-Adic-square-roots
@@ -0,0 +1 @@
+../../Task/P-Adic-square-roots/C++
\ No newline at end of file
diff --git a/Lang/C++/Quaternion-type b/Lang/C++/Quaternion-type
deleted file mode 120000
index 053fd1142a..0000000000
--- a/Lang/C++/Quaternion-type
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Quaternion-type/C++
\ No newline at end of file
diff --git a/Lang/C++/Quoting-constructs b/Lang/C++/Quoting-constructs
new file mode 120000
index 0000000000..85f4da28e3
--- /dev/null
+++ b/Lang/C++/Quoting-constructs
@@ -0,0 +1 @@
+../../Task/Quoting-constructs/C++
\ No newline at end of file
diff --git a/Lang/C++/Rendezvous b/Lang/C++/Rendezvous
new file mode 120000
index 0000000000..b1c8af4bea
--- /dev/null
+++ b/Lang/C++/Rendezvous
@@ -0,0 +1 @@
+../../Task/Rendezvous/C++
\ No newline at end of file
diff --git a/Lang/C++/Simple-database b/Lang/C++/Simple-database
new file mode 120000
index 0000000000..60394bf013
--- /dev/null
+++ b/Lang/C++/Simple-database
@@ -0,0 +1 @@
+../../Task/Simple-database/C++
\ No newline at end of file
diff --git a/Lang/C++/Sort-an-outline-at-every-level b/Lang/C++/Sort-an-outline-at-every-level
new file mode 120000
index 0000000000..5467a50bff
--- /dev/null
+++ b/Lang/C++/Sort-an-outline-at-every-level
@@ -0,0 +1 @@
+../../Task/Sort-an-outline-at-every-level/C++
\ No newline at end of file
diff --git a/Lang/C++/Sorting-Algorithms-Circle-Sort b/Lang/C++/Sorting-Algorithms-Circle-Sort
deleted file mode 120000
index 91c7b06653..0000000000
--- a/Lang/C++/Sorting-Algorithms-Circle-Sort
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Sorting-Algorithms-Circle-Sort/C++
\ No newline at end of file
diff --git a/Lang/C++/Strassens-algorithm b/Lang/C++/Strassens-algorithm
new file mode 120000
index 0000000000..1423f44a39
--- /dev/null
+++ b/Lang/C++/Strassens-algorithm
@@ -0,0 +1 @@
+../../Task/Strassens-algorithm/C++
\ No newline at end of file
diff --git a/Lang/C++/Table-creation-Postal-addresses b/Lang/C++/Table-creation-Postal-addresses
new file mode 120000
index 0000000000..e821bbe93f
--- /dev/null
+++ b/Lang/C++/Table-creation-Postal-addresses
@@ -0,0 +1 @@
+../../Task/Table-creation-Postal-addresses/C++
\ No newline at end of file
diff --git a/Lang/C++/Total-circles-area b/Lang/C++/Total-circles-area
new file mode 120000
index 0000000000..d9453103bd
--- /dev/null
+++ b/Lang/C++/Total-circles-area
@@ -0,0 +1 @@
+../../Task/Total-circles-area/C++
\ No newline at end of file
diff --git a/Lang/C++/URL-parser b/Lang/C++/URL-parser
new file mode 120000
index 0000000000..c94d78f772
--- /dev/null
+++ b/Lang/C++/URL-parser
@@ -0,0 +1 @@
+../../Task/URL-parser/C++
\ No newline at end of file
diff --git a/Lang/C++/UTF-8-encode-and-decode b/Lang/C++/UTF-8-encode-and-decode
new file mode 120000
index 0000000000..a3942ee81c
--- /dev/null
+++ b/Lang/C++/UTF-8-encode-and-decode
@@ -0,0 +1 @@
+../../Task/UTF-8-encode-and-decode/C++
\ No newline at end of file
diff --git a/Lang/C++/Ukkonen-s-suffix-tree-construction b/Lang/C++/Ukkonen-s-suffix-tree-construction
new file mode 120000
index 0000000000..3dffa49793
--- /dev/null
+++ b/Lang/C++/Ukkonen-s-suffix-tree-construction
@@ -0,0 +1 @@
+../../Task/Ukkonen-s-suffix-tree-construction/C++
\ No newline at end of file
diff --git a/Lang/C++/Unicode-variable-names b/Lang/C++/Unicode-variable-names
new file mode 120000
index 0000000000..229d06451e
--- /dev/null
+++ b/Lang/C++/Unicode-variable-names
@@ -0,0 +1 @@
+../../Task/Unicode-variable-names/C++
\ No newline at end of file
diff --git a/Lang/C++/Update-a-configuration-file b/Lang/C++/Update-a-configuration-file
new file mode 120000
index 0000000000..dd78746576
--- /dev/null
+++ b/Lang/C++/Update-a-configuration-file
@@ -0,0 +1 @@
+../../Task/Update-a-configuration-file/C++
\ No newline at end of file
diff --git a/Lang/C++/Wasteful-equidigital-and-frugal-numbers b/Lang/C++/Wasteful-equidigital-and-frugal-numbers
new file mode 120000
index 0000000000..ab51274f10
--- /dev/null
+++ b/Lang/C++/Wasteful-equidigital-and-frugal-numbers
@@ -0,0 +1 @@
+../../Task/Wasteful-equidigital-and-frugal-numbers/C++
\ No newline at end of file
diff --git a/Lang/C++/Wordiff b/Lang/C++/Wordiff
new file mode 120000
index 0000000000..13c6f44a9e
--- /dev/null
+++ b/Lang/C++/Wordiff
@@ -0,0 +1 @@
+../../Task/Wordiff/C++
\ No newline at end of file
diff --git a/Lang/C-sharp/00-LANG.txt b/Lang/C-sharp/00-LANG.txt
index 17083312b1..2ffb00e180 100644
--- a/Lang/C-sharp/00-LANG.txt
+++ b/Lang/C-sharp/00-LANG.txt
@@ -17,6 +17,10 @@
 ==Citations==
 *[[wp:C_Sharp_(programming_language)|Wikipedia:C#]]
 
+== External links ==
+=== Online editors and compilers ===
+*[https://www.onlinegdb.com/ GDB Online Compiler] (Select C#)
+
 {{language programming paradigm|Imperative}}
 {{language programming paradigm|Object-oriented}}
 {{language programming paradigm|Generic}}
diff --git a/Lang/C-sharp/ADFGVX-cipher b/Lang/C-sharp/ADFGVX-cipher
new file mode 120000
index 0000000000..1bd5856497
--- /dev/null
+++ b/Lang/C-sharp/ADFGVX-cipher
@@ -0,0 +1 @@
+../../Task/ADFGVX-cipher/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/ASCII-art-diagram-converter b/Lang/C-sharp/ASCII-art-diagram-converter
new file mode 120000
index 0000000000..a3c0a49ccd
--- /dev/null
+++ b/Lang/C-sharp/ASCII-art-diagram-converter
@@ -0,0 +1 @@
+../../Task/ASCII-art-diagram-converter/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Additive-primes b/Lang/C-sharp/Additive-primes
new file mode 120000
index 0000000000..d958846baf
--- /dev/null
+++ b/Lang/C-sharp/Additive-primes
@@ -0,0 +1 @@
+../../Task/Additive-primes/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Aliquot-sequence-classifications b/Lang/C-sharp/Aliquot-sequence-classifications
new file mode 120000
index 0000000000..2c0be649f4
--- /dev/null
+++ b/Lang/C-sharp/Aliquot-sequence-classifications
@@ -0,0 +1 @@
+../../Task/Aliquot-sequence-classifications/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Arithmetic-derivative b/Lang/C-sharp/Arithmetic-derivative
new file mode 120000
index 0000000000..99fc50446f
--- /dev/null
+++ b/Lang/C-sharp/Arithmetic-derivative
@@ -0,0 +1 @@
+../../Task/Arithmetic-derivative/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Arithmetic-numbers b/Lang/C-sharp/Arithmetic-numbers
new file mode 120000
index 0000000000..7b33f4b583
--- /dev/null
+++ b/Lang/C-sharp/Arithmetic-numbers
@@ -0,0 +1 @@
+../../Task/Arithmetic-numbers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/B-zier-curves-Intersections b/Lang/C-sharp/B-zier-curves-Intersections
new file mode 120000
index 0000000000..9583a4224f
--- /dev/null
+++ b/Lang/C-sharp/B-zier-curves-Intersections
@@ -0,0 +1 @@
+../../Task/B-zier-curves-Intersections/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Bifid-cipher b/Lang/C-sharp/Bifid-cipher
new file mode 120000
index 0000000000..53987e0c76
--- /dev/null
+++ b/Lang/C-sharp/Bifid-cipher
@@ -0,0 +1 @@
+../../Task/Bifid-cipher/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Blum-integer b/Lang/C-sharp/Blum-integer
new file mode 120000
index 0000000000..6e857dea48
--- /dev/null
+++ b/Lang/C-sharp/Blum-integer
@@ -0,0 +1 @@
+../../Task/Blum-integer/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Boyer-Moore-string-search b/Lang/C-sharp/Boyer-Moore-string-search
new file mode 120000
index 0000000000..6d8ebe0502
--- /dev/null
+++ b/Lang/C-sharp/Boyer-Moore-string-search
@@ -0,0 +1 @@
+../../Task/Boyer-Moore-string-search/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Calkin-Wilf-sequence b/Lang/C-sharp/Calkin-Wilf-sequence
new file mode 120000
index 0000000000..75d6e98750
--- /dev/null
+++ b/Lang/C-sharp/Calkin-Wilf-sequence
@@ -0,0 +1 @@
+../../Task/Calkin-Wilf-sequence/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Camel-case-and-snake-case b/Lang/C-sharp/Camel-case-and-snake-case
new file mode 120000
index 0000000000..0b673ec8ed
--- /dev/null
+++ b/Lang/C-sharp/Camel-case-and-snake-case
@@ -0,0 +1 @@
+../../Task/Camel-case-and-snake-case/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Cistercian-numerals b/Lang/C-sharp/Cistercian-numerals
new file mode 120000
index 0000000000..d482ff0533
--- /dev/null
+++ b/Lang/C-sharp/Cistercian-numerals
@@ -0,0 +1 @@
+../../Task/Cistercian-numerals/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Colorful-numbers b/Lang/C-sharp/Colorful-numbers
new file mode 120000
index 0000000000..b35a72c815
--- /dev/null
+++ b/Lang/C-sharp/Colorful-numbers
@@ -0,0 +1 @@
+../../Task/Colorful-numbers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Combinations-and-permutations b/Lang/C-sharp/Combinations-and-permutations
new file mode 120000
index 0000000000..c322432e6c
--- /dev/null
+++ b/Lang/C-sharp/Combinations-and-permutations
@@ -0,0 +1 @@
+../../Task/Combinations-and-permutations/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- b/Lang/C-sharp/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n-
new file mode 120000
index 0000000000..2adfbd6635
--- /dev/null
+++ b/Lang/C-sharp/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n-
@@ -0,0 +1 @@
+../../Task/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n-/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Cut-a-rectangle b/Lang/C-sharp/Cut-a-rectangle
new file mode 120000
index 0000000000..4cec3edeaa
--- /dev/null
+++ b/Lang/C-sharp/Cut-a-rectangle
@@ -0,0 +1 @@
+../../Task/Cut-a-rectangle/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Cyclops-numbers b/Lang/C-sharp/Cyclops-numbers
new file mode 120000
index 0000000000..c4380e8ccd
--- /dev/null
+++ b/Lang/C-sharp/Cyclops-numbers
@@ -0,0 +1 @@
+../../Task/Cyclops-numbers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Demings-funnel b/Lang/C-sharp/Demings-funnel
new file mode 120000
index 0000000000..283a7555df
--- /dev/null
+++ b/Lang/C-sharp/Demings-funnel
@@ -0,0 +1 @@
+../../Task/Demings-funnel/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Determinant-and-permanent b/Lang/C-sharp/Determinant-and-permanent
new file mode 120000
index 0000000000..fa8d657eeb
--- /dev/null
+++ b/Lang/C-sharp/Determinant-and-permanent
@@ -0,0 +1 @@
+../../Task/Determinant-and-permanent/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Dice-game-probabilities b/Lang/C-sharp/Dice-game-probabilities
new file mode 120000
index 0000000000..8f72eba47d
--- /dev/null
+++ b/Lang/C-sharp/Dice-game-probabilities
@@ -0,0 +1 @@
+../../Task/Dice-game-probabilities/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Disarium-numbers b/Lang/C-sharp/Disarium-numbers
new file mode 120000
index 0000000000..47381ac73c
--- /dev/null
+++ b/Lang/C-sharp/Disarium-numbers
@@ -0,0 +1 @@
+../../Task/Disarium-numbers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Distribution-of-0-digits-in-factorial-series b/Lang/C-sharp/Distribution-of-0-digits-in-factorial-series
new file mode 120000
index 0000000000..a7d175e94a
--- /dev/null
+++ b/Lang/C-sharp/Distribution-of-0-digits-in-factorial-series
@@ -0,0 +1 @@
+../../Task/Distribution-of-0-digits-in-factorial-series/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Doomsday-rule b/Lang/C-sharp/Doomsday-rule
new file mode 120000
index 0000000000..f572c2a651
--- /dev/null
+++ b/Lang/C-sharp/Doomsday-rule
@@ -0,0 +1 @@
+../../Task/Doomsday-rule/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Elliptic-Curve-Digital-Signature-Algorithm b/Lang/C-sharp/Elliptic-Curve-Digital-Signature-Algorithm
new file mode 120000
index 0000000000..82412a8f32
--- /dev/null
+++ b/Lang/C-sharp/Elliptic-Curve-Digital-Signature-Algorithm
@@ -0,0 +1 @@
+../../Task/Elliptic-Curve-Digital-Signature-Algorithm/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Erd-s-Nicolas-numbers b/Lang/C-sharp/Erd-s-Nicolas-numbers
new file mode 120000
index 0000000000..2a21b589d2
--- /dev/null
+++ b/Lang/C-sharp/Erd-s-Nicolas-numbers
@@ -0,0 +1 @@
+../../Task/Erd-s-Nicolas-numbers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Execute-a-Markov-algorithm b/Lang/C-sharp/Execute-a-Markov-algorithm
new file mode 120000
index 0000000000..fac2e3f425
--- /dev/null
+++ b/Lang/C-sharp/Execute-a-Markov-algorithm
@@ -0,0 +1 @@
+../../Task/Execute-a-Markov-algorithm/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Extensible-prime-generator b/Lang/C-sharp/Extensible-prime-generator
new file mode 120000
index 0000000000..1e4636d3bb
--- /dev/null
+++ b/Lang/C-sharp/Extensible-prime-generator
@@ -0,0 +1 @@
+../../Task/Extensible-prime-generator/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Fairshare-between-two-and-more b/Lang/C-sharp/Fairshare-between-two-and-more
new file mode 120000
index 0000000000..444efb1248
--- /dev/null
+++ b/Lang/C-sharp/Fairshare-between-two-and-more
@@ -0,0 +1 @@
+../../Task/Fairshare-between-two-and-more/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/File-extension-is-in-extensions-list b/Lang/C-sharp/File-extension-is-in-extensions-list
new file mode 120000
index 0000000000..caec470709
--- /dev/null
+++ b/Lang/C-sharp/File-extension-is-in-extensions-list
@@ -0,0 +1 @@
+../../Task/File-extension-is-in-extensions-list/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Find-if-a-point-is-within-a-triangle b/Lang/C-sharp/Find-if-a-point-is-within-a-triangle
new file mode 120000
index 0000000000..0c9dec87d9
--- /dev/null
+++ b/Lang/C-sharp/Find-if-a-point-is-within-a-triangle
@@ -0,0 +1 @@
+../../Task/Find-if-a-point-is-within-a-triangle/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Fortunate-numbers b/Lang/C-sharp/Fortunate-numbers
new file mode 120000
index 0000000000..5f6e57871d
--- /dev/null
+++ b/Lang/C-sharp/Fortunate-numbers
@@ -0,0 +1 @@
+../../Task/Fortunate-numbers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Fractran b/Lang/C-sharp/Fractran
new file mode 120000
index 0000000000..e1ba558448
--- /dev/null
+++ b/Lang/C-sharp/Fractran
@@ -0,0 +1 @@
+../../Task/Fractran/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Generate-Chess960-starting-position b/Lang/C-sharp/Generate-Chess960-starting-position
new file mode 120000
index 0000000000..a44601322a
--- /dev/null
+++ b/Lang/C-sharp/Generate-Chess960-starting-position
@@ -0,0 +1 @@
+../../Task/Generate-Chess960-starting-position/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Golden-ratio-Convergence b/Lang/C-sharp/Golden-ratio-Convergence
new file mode 120000
index 0000000000..ea91aeb897
--- /dev/null
+++ b/Lang/C-sharp/Golden-ratio-Convergence
@@ -0,0 +1 @@
+../../Task/Golden-ratio-Convergence/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Gotchas b/Lang/C-sharp/Gotchas
new file mode 120000
index 0000000000..c20938cf21
--- /dev/null
+++ b/Lang/C-sharp/Gotchas
@@ -0,0 +1 @@
+../../Task/Gotchas/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Graph-colouring b/Lang/C-sharp/Graph-colouring
new file mode 120000
index 0000000000..9124611f31
--- /dev/null
+++ b/Lang/C-sharp/Graph-colouring
@@ -0,0 +1 @@
+../../Task/Graph-colouring/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Harmonic-series b/Lang/C-sharp/Harmonic-series
new file mode 120000
index 0000000000..621fdcd007
--- /dev/null
+++ b/Lang/C-sharp/Harmonic-series
@@ -0,0 +1 @@
+../../Task/Harmonic-series/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Hickerson-series-of-almost-integers b/Lang/C-sharp/Hickerson-series-of-almost-integers
new file mode 120000
index 0000000000..1409bf65fa
--- /dev/null
+++ b/Lang/C-sharp/Hickerson-series-of-almost-integers
@@ -0,0 +1 @@
+../../Task/Hickerson-series-of-almost-integers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Index-finite-lists-of-positive-integers b/Lang/C-sharp/Index-finite-lists-of-positive-integers
new file mode 120000
index 0000000000..692e611ddc
--- /dev/null
+++ b/Lang/C-sharp/Index-finite-lists-of-positive-integers
@@ -0,0 +1 @@
+../../Task/Index-finite-lists-of-positive-integers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Jacobsthal-numbers b/Lang/C-sharp/Jacobsthal-numbers
new file mode 120000
index 0000000000..8d875d3e3c
--- /dev/null
+++ b/Lang/C-sharp/Jacobsthal-numbers
@@ -0,0 +1 @@
+../../Task/Jacobsthal-numbers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Jaro-similarity b/Lang/C-sharp/Jaro-similarity
new file mode 120000
index 0000000000..76ee880028
--- /dev/null
+++ b/Lang/C-sharp/Jaro-similarity
@@ -0,0 +1 @@
+../../Task/Jaro-similarity/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Jordan-P-lya-numbers b/Lang/C-sharp/Jordan-P-lya-numbers
new file mode 120000
index 0000000000..bdd5391b84
--- /dev/null
+++ b/Lang/C-sharp/Jordan-P-lya-numbers
@@ -0,0 +1 @@
+../../Task/Jordan-P-lya-numbers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Juggler-sequence b/Lang/C-sharp/Juggler-sequence
new file mode 120000
index 0000000000..7c2e1e5df3
--- /dev/null
+++ b/Lang/C-sharp/Juggler-sequence
@@ -0,0 +1 @@
+../../Task/Juggler-sequence/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/K-d-tree b/Lang/C-sharp/K-d-tree
new file mode 120000
index 0000000000..9ea6355b83
--- /dev/null
+++ b/Lang/C-sharp/K-d-tree
@@ -0,0 +1 @@
+../../Task/K-d-tree/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Levenshtein-distance-Alignment b/Lang/C-sharp/Levenshtein-distance-Alignment
new file mode 120000
index 0000000000..4a86af53da
--- /dev/null
+++ b/Lang/C-sharp/Levenshtein-distance-Alignment
@@ -0,0 +1 @@
+../../Task/Levenshtein-distance-Alignment/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Longest-string-challenge b/Lang/C-sharp/Longest-string-challenge
new file mode 120000
index 0000000000..bd57b65702
--- /dev/null
+++ b/Lang/C-sharp/Longest-string-challenge
@@ -0,0 +1 @@
+../../Task/Longest-string-challenge/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/M-bius-function b/Lang/C-sharp/M-bius-function
new file mode 120000
index 0000000000..56f84fb14c
--- /dev/null
+++ b/Lang/C-sharp/M-bius-function
@@ -0,0 +1 @@
+../../Task/M-bius-function/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Magic-constant b/Lang/C-sharp/Magic-constant
new file mode 120000
index 0000000000..b74721e026
--- /dev/null
+++ b/Lang/C-sharp/Magic-constant
@@ -0,0 +1 @@
+../../Task/Magic-constant/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Magic-squares-of-singly-even-order b/Lang/C-sharp/Magic-squares-of-singly-even-order
new file mode 120000
index 0000000000..7c09d264d6
--- /dev/null
+++ b/Lang/C-sharp/Magic-squares-of-singly-even-order
@@ -0,0 +1 @@
+../../Task/Magic-squares-of-singly-even-order/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Main-step-of-GOST-28147-89 b/Lang/C-sharp/Main-step-of-GOST-28147-89
new file mode 120000
index 0000000000..0d0396ff34
--- /dev/null
+++ b/Lang/C-sharp/Main-step-of-GOST-28147-89
@@ -0,0 +1 @@
+../../Task/Main-step-of-GOST-28147-89/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Maze-solving b/Lang/C-sharp/Maze-solving
new file mode 120000
index 0000000000..9a643105b4
--- /dev/null
+++ b/Lang/C-sharp/Maze-solving
@@ -0,0 +1 @@
+../../Task/Maze-solving/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Metronome b/Lang/C-sharp/Metronome
new file mode 120000
index 0000000000..d943840c54
--- /dev/null
+++ b/Lang/C-sharp/Metronome
@@ -0,0 +1 @@
+../../Task/Metronome/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Miller-Rabin-primality-test b/Lang/C-sharp/Miller-Rabin-primality-test
deleted file mode 120000
index 4d27fefcbd..0000000000
--- a/Lang/C-sharp/Miller-Rabin-primality-test
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Miller-Rabin-primality-test/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Mind-boggling-card-trick b/Lang/C-sharp/Mind-boggling-card-trick
new file mode 120000
index 0000000000..65b695076e
--- /dev/null
+++ b/Lang/C-sharp/Mind-boggling-card-trick
@@ -0,0 +1 @@
+../../Task/Mind-boggling-card-trick/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Minkowski-question-mark-function b/Lang/C-sharp/Minkowski-question-mark-function
new file mode 120000
index 0000000000..b16d1e756c
--- /dev/null
+++ b/Lang/C-sharp/Minkowski-question-mark-function
@@ -0,0 +1 @@
+../../Task/Minkowski-question-mark-function/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Next-highest-int-from-digits b/Lang/C-sharp/Next-highest-int-from-digits
new file mode 120000
index 0000000000..2462971188
--- /dev/null
+++ b/Lang/C-sharp/Next-highest-int-from-digits
@@ -0,0 +1 @@
+../../Task/Next-highest-int-from-digits/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/P-Adic-numbers-basic b/Lang/C-sharp/P-Adic-numbers-basic
new file mode 120000
index 0000000000..564565afb6
--- /dev/null
+++ b/Lang/C-sharp/P-Adic-numbers-basic
@@ -0,0 +1 @@
+../../Task/P-Adic-numbers-basic/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Padovan-sequence b/Lang/C-sharp/Padovan-sequence
new file mode 120000
index 0000000000..a90cb74ae7
--- /dev/null
+++ b/Lang/C-sharp/Padovan-sequence
@@ -0,0 +1 @@
+../../Task/Padovan-sequence/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Pancake-numbers b/Lang/C-sharp/Pancake-numbers
new file mode 120000
index 0000000000..5088584c71
--- /dev/null
+++ b/Lang/C-sharp/Pancake-numbers
@@ -0,0 +1 @@
+../../Task/Pancake-numbers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Parse-an-IP-Address b/Lang/C-sharp/Parse-an-IP-Address
new file mode 120000
index 0000000000..fe231a87e2
--- /dev/null
+++ b/Lang/C-sharp/Parse-an-IP-Address
@@ -0,0 +1 @@
+../../Task/Parse-an-IP-Address/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Periodic-table b/Lang/C-sharp/Periodic-table
new file mode 120000
index 0000000000..97d676b17d
--- /dev/null
+++ b/Lang/C-sharp/Periodic-table
@@ -0,0 +1 @@
+../../Task/Periodic-table/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Prime-numbers-whose-neighboring-pairs-are-tetraprimes b/Lang/C-sharp/Prime-numbers-whose-neighboring-pairs-are-tetraprimes
new file mode 120000
index 0000000000..6222df483b
--- /dev/null
+++ b/Lang/C-sharp/Prime-numbers-whose-neighboring-pairs-are-tetraprimes
@@ -0,0 +1 @@
+../../Task/Prime-numbers-whose-neighboring-pairs-are-tetraprimes/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Pseudo-random-numbers-PCG32 b/Lang/C-sharp/Pseudo-random-numbers-PCG32
new file mode 120000
index 0000000000..c32a0bbbd9
--- /dev/null
+++ b/Lang/C-sharp/Pseudo-random-numbers-PCG32
@@ -0,0 +1 @@
+../../Task/Pseudo-random-numbers-PCG32/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Quaternion-type b/Lang/C-sharp/Quaternion-type
deleted file mode 120000
index 53c4bd6185..0000000000
--- a/Lang/C-sharp/Quaternion-type
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Quaternion-type/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Ray-casting-algorithm b/Lang/C-sharp/Ray-casting-algorithm
new file mode 120000
index 0000000000..67165907f8
--- /dev/null
+++ b/Lang/C-sharp/Ray-casting-algorithm
@@ -0,0 +1 @@
+../../Task/Ray-casting-algorithm/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Reflection-Get-source b/Lang/C-sharp/Reflection-Get-source
new file mode 120000
index 0000000000..a8b2f45e4c
--- /dev/null
+++ b/Lang/C-sharp/Reflection-Get-source
@@ -0,0 +1 @@
+../../Task/Reflection-Get-source/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Rep-string b/Lang/C-sharp/Rep-string
new file mode 120000
index 0000000000..0c89d0f939
--- /dev/null
+++ b/Lang/C-sharp/Rep-string
@@ -0,0 +1 @@
+../../Task/Rep-string/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Sequence:-smallest-number-with-exactly-n-divisors b/Lang/C-sharp/Sequence:-smallest-number-with-exactly-n-divisors
new file mode 120000
index 0000000000..71508d1c44
--- /dev/null
+++ b/Lang/C-sharp/Sequence:-smallest-number-with-exactly-n-divisors
@@ -0,0 +1 @@
+../../Task/Sequence:-smallest-number-with-exactly-n-divisors/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Solve-the-no-connection-puzzle b/Lang/C-sharp/Solve-the-no-connection-puzzle
new file mode 120000
index 0000000000..f2a7bf3a0e
--- /dev/null
+++ b/Lang/C-sharp/Solve-the-no-connection-puzzle
@@ -0,0 +1 @@
+../../Task/Solve-the-no-connection-puzzle/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Sorting-Algorithms-Circle-Sort b/Lang/C-sharp/Sorting-Algorithms-Circle-Sort
deleted file mode 120000
index 6f1414c420..0000000000
--- a/Lang/C-sharp/Sorting-Algorithms-Circle-Sort
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Sorting-Algorithms-Circle-Sort/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Spelling-of-ordinal-numbers b/Lang/C-sharp/Spelling-of-ordinal-numbers
new file mode 120000
index 0000000000..f9129a4b80
--- /dev/null
+++ b/Lang/C-sharp/Spelling-of-ordinal-numbers
@@ -0,0 +1 @@
+../../Task/Spelling-of-ordinal-numbers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Sphenic-numbers b/Lang/C-sharp/Sphenic-numbers
new file mode 120000
index 0000000000..e745ee5efe
--- /dev/null
+++ b/Lang/C-sharp/Sphenic-numbers
@@ -0,0 +1 @@
+../../Task/Sphenic-numbers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Square-free-integers b/Lang/C-sharp/Square-free-integers
new file mode 120000
index 0000000000..6cabcf20b3
--- /dev/null
+++ b/Lang/C-sharp/Square-free-integers
@@ -0,0 +1 @@
+../../Task/Square-free-integers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Strassens-algorithm b/Lang/C-sharp/Strassens-algorithm
new file mode 120000
index 0000000000..45fd91dfa9
--- /dev/null
+++ b/Lang/C-sharp/Strassens-algorithm
@@ -0,0 +1 @@
+../../Task/Strassens-algorithm/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Suffixation-of-decimal-numbers b/Lang/C-sharp/Suffixation-of-decimal-numbers
new file mode 120000
index 0000000000..2db739988c
--- /dev/null
+++ b/Lang/C-sharp/Suffixation-of-decimal-numbers
@@ -0,0 +1 @@
+../../Task/Suffixation-of-decimal-numbers/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Summarize-primes b/Lang/C-sharp/Summarize-primes
new file mode 120000
index 0000000000..de1b22714d
--- /dev/null
+++ b/Lang/C-sharp/Summarize-primes
@@ -0,0 +1 @@
+../../Task/Summarize-primes/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Sylvesters-sequence b/Lang/C-sharp/Sylvesters-sequence
new file mode 120000
index 0000000000..3899fa057e
--- /dev/null
+++ b/Lang/C-sharp/Sylvesters-sequence
@@ -0,0 +1 @@
+../../Task/Sylvesters-sequence/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Tau-function b/Lang/C-sharp/Tau-function
new file mode 120000
index 0000000000..aa9069413d
--- /dev/null
+++ b/Lang/C-sharp/Tau-function
@@ -0,0 +1 @@
+../../Task/Tau-function/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Tau-number b/Lang/C-sharp/Tau-number
new file mode 120000
index 0000000000..0980d5ce28
--- /dev/null
+++ b/Lang/C-sharp/Tau-number
@@ -0,0 +1 @@
+../../Task/Tau-number/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Topswops b/Lang/C-sharp/Topswops
new file mode 120000
index 0000000000..3f10a6cb93
--- /dev/null
+++ b/Lang/C-sharp/Topswops
@@ -0,0 +1 @@
+../../Task/Topswops/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Total-circles-area b/Lang/C-sharp/Total-circles-area
new file mode 120000
index 0000000000..d1b9a6ffb2
--- /dev/null
+++ b/Lang/C-sharp/Total-circles-area
@@ -0,0 +1 @@
+../../Task/Total-circles-area/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Tree-from-nesting-levels b/Lang/C-sharp/Tree-from-nesting-levels
new file mode 120000
index 0000000000..e46b1553ea
--- /dev/null
+++ b/Lang/C-sharp/Tree-from-nesting-levels
@@ -0,0 +1 @@
+../../Task/Tree-from-nesting-levels/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Tropical-algebra-overloading b/Lang/C-sharp/Tropical-algebra-overloading
new file mode 120000
index 0000000000..1b61aaaf8d
--- /dev/null
+++ b/Lang/C-sharp/Tropical-algebra-overloading
@@ -0,0 +1 @@
+../../Task/Tropical-algebra-overloading/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Ultra-useful-primes b/Lang/C-sharp/Ultra-useful-primes
new file mode 120000
index 0000000000..2258e0373a
--- /dev/null
+++ b/Lang/C-sharp/Ultra-useful-primes
@@ -0,0 +1 @@
+../../Task/Ultra-useful-primes/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Variable-declaration-reset b/Lang/C-sharp/Variable-declaration-reset
new file mode 120000
index 0000000000..ec0809da88
--- /dev/null
+++ b/Lang/C-sharp/Variable-declaration-reset
@@ -0,0 +1 @@
+../../Task/Variable-declaration-reset/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Verify-distribution-uniformity-Chi-squared-test b/Lang/C-sharp/Verify-distribution-uniformity-Chi-squared-test
new file mode 120000
index 0000000000..5101b70787
--- /dev/null
+++ b/Lang/C-sharp/Verify-distribution-uniformity-Chi-squared-test
@@ -0,0 +1 @@
+../../Task/Verify-distribution-uniformity-Chi-squared-test/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Verify-distribution-uniformity-Naive b/Lang/C-sharp/Verify-distribution-uniformity-Naive
new file mode 120000
index 0000000000..c41f1e05f6
--- /dev/null
+++ b/Lang/C-sharp/Verify-distribution-uniformity-Naive
@@ -0,0 +1 @@
+../../Task/Verify-distribution-uniformity-Naive/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Vogels-approximation-method b/Lang/C-sharp/Vogels-approximation-method
new file mode 120000
index 0000000000..bb638d067a
--- /dev/null
+++ b/Lang/C-sharp/Vogels-approximation-method
@@ -0,0 +1 @@
+../../Task/Vogels-approximation-method/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Yellowstone-sequence b/Lang/C-sharp/Yellowstone-sequence
new file mode 120000
index 0000000000..793ce587ba
--- /dev/null
+++ b/Lang/C-sharp/Yellowstone-sequence
@@ -0,0 +1 @@
+../../Task/Yellowstone-sequence/C-sharp
\ No newline at end of file
diff --git a/Lang/C/Achilles-numbers b/Lang/C/Achilles-numbers
new file mode 120000
index 0000000000..5c3326676b
--- /dev/null
+++ b/Lang/C/Achilles-numbers
@@ -0,0 +1 @@
+../../Task/Achilles-numbers/C
\ No newline at end of file
diff --git a/Lang/C/Bioinformatics-base-count b/Lang/C/Bioinformatics-base-count
deleted file mode 120000
index 4819495149..0000000000
--- a/Lang/C/Bioinformatics-base-count
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Bioinformatics-base-count/C
\ No newline at end of file
diff --git a/Lang/C/Color-wheel b/Lang/C/Color-wheel
new file mode 120000
index 0000000000..9d6561adcd
--- /dev/null
+++ b/Lang/C/Color-wheel
@@ -0,0 +1 @@
+../../Task/Color-wheel/C
\ No newline at end of file
diff --git a/Lang/C/Distance-and-Bearing b/Lang/C/Distance-and-Bearing
new file mode 120000
index 0000000000..4496c69ac6
--- /dev/null
+++ b/Lang/C/Distance-and-Bearing
@@ -0,0 +1 @@
+../../Task/Distance-and-Bearing/C
\ No newline at end of file
diff --git a/Lang/C/Dynamic-variable-names b/Lang/C/Dynamic-variable-names
new file mode 120000
index 0000000000..278fe3b232
--- /dev/null
+++ b/Lang/C/Dynamic-variable-names
@@ -0,0 +1 @@
+../../Task/Dynamic-variable-names/C
\ No newline at end of file
diff --git a/Lang/C/Execute-Computer-Zero b/Lang/C/Execute-Computer-Zero
new file mode 120000
index 0000000000..c10597c078
--- /dev/null
+++ b/Lang/C/Execute-Computer-Zero
@@ -0,0 +1 @@
+../../Task/Execute-Computer-Zero/C
\ No newline at end of file
diff --git a/Lang/C/Harmonic-series b/Lang/C/Harmonic-series
new file mode 120000
index 0000000000..dfebedc2c8
--- /dev/null
+++ b/Lang/C/Harmonic-series
@@ -0,0 +1 @@
+../../Task/Harmonic-series/C
\ No newline at end of file
diff --git a/Lang/C/History-variables b/Lang/C/History-variables
new file mode 120000
index 0000000000..3a73616359
--- /dev/null
+++ b/Lang/C/History-variables
@@ -0,0 +1 @@
+../../Task/History-variables/C
\ No newline at end of file
diff --git a/Lang/C/Hunt-the-Wumpus b/Lang/C/Hunt-the-Wumpus
new file mode 120000
index 0000000000..e7186ced48
--- /dev/null
+++ b/Lang/C/Hunt-the-Wumpus
@@ -0,0 +1 @@
+../../Task/Hunt-the-Wumpus/C
\ No newline at end of file
diff --git a/Lang/C/Magic-constant b/Lang/C/Magic-constant
new file mode 120000
index 0000000000..3d29fd6624
--- /dev/null
+++ b/Lang/C/Magic-constant
@@ -0,0 +1 @@
+../../Task/Magic-constant/C
\ No newline at end of file
diff --git a/Lang/C/Miller-Rabin-primality-test b/Lang/C/Miller-Rabin-primality-test
deleted file mode 120000
index b9ab762a9c..0000000000
--- a/Lang/C/Miller-Rabin-primality-test
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Miller-Rabin-primality-test/C
\ No newline at end of file
diff --git a/Lang/C/Nested-templated-data b/Lang/C/Nested-templated-data
new file mode 120000
index 0000000000..ef78f3cb0c
--- /dev/null
+++ b/Lang/C/Nested-templated-data
@@ -0,0 +1 @@
+../../Task/Nested-templated-data/C
\ No newline at end of file
diff --git a/Lang/C/One-time-pad b/Lang/C/One-time-pad
new file mode 120000
index 0000000000..e0845d9058
--- /dev/null
+++ b/Lang/C/One-time-pad
@@ -0,0 +1 @@
+../../Task/One-time-pad/C
\ No newline at end of file
diff --git a/Lang/C/Pig-the-dice-game-Player b/Lang/C/Pig-the-dice-game-Player
new file mode 120000
index 0000000000..28ecb509a8
--- /dev/null
+++ b/Lang/C/Pig-the-dice-game-Player
@@ -0,0 +1 @@
+../../Task/Pig-the-dice-game-Player/C
\ No newline at end of file
diff --git a/Lang/C/Quaternion-type b/Lang/C/Quaternion-type
deleted file mode 120000
index 25d9910755..0000000000
--- a/Lang/C/Quaternion-type
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Quaternion-type/C
\ No newline at end of file
diff --git a/Lang/C/Search-in-paragraphs-text b/Lang/C/Search-in-paragraphs-text
new file mode 120000
index 0000000000..11cd3d2def
--- /dev/null
+++ b/Lang/C/Search-in-paragraphs-text
@@ -0,0 +1 @@
+../../Task/Search-in-paragraphs-text/C
\ No newline at end of file
diff --git a/Lang/C/Sleeping-Beauty-problem b/Lang/C/Sleeping-Beauty-problem
new file mode 120000
index 0000000000..193e808670
--- /dev/null
+++ b/Lang/C/Sleeping-Beauty-problem
@@ -0,0 +1 @@
+../../Task/Sleeping-Beauty-problem/C
\ No newline at end of file
diff --git a/Lang/C/Sorting-Algorithms-Circle-Sort b/Lang/C/Sorting-Algorithms-Circle-Sort
deleted file mode 120000
index 335574f406..0000000000
--- a/Lang/C/Sorting-Algorithms-Circle-Sort
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Sorting-Algorithms-Circle-Sort/C
\ No newline at end of file
diff --git a/Lang/C3/Binary-digits b/Lang/C3/Binary-digits
new file mode 120000
index 0000000000..34a04afae2
--- /dev/null
+++ b/Lang/C3/Binary-digits
@@ -0,0 +1 @@
+../../Task/Binary-digits/C3
\ No newline at end of file
diff --git a/Lang/C3/Bulls-and-cows b/Lang/C3/Bulls-and-cows
new file mode 120000
index 0000000000..b5099b13d9
--- /dev/null
+++ b/Lang/C3/Bulls-and-cows
@@ -0,0 +1 @@
+../../Task/Bulls-and-cows/C3
\ No newline at end of file
diff --git a/Lang/CB80/00-LANG.txt b/Lang/CB80/00-LANG.txt
index 96b8bf005c..86de52ef42 100644
--- a/Lang/CB80/00-LANG.txt
+++ b/Lang/CB80/00-LANG.txt
@@ -1 +1,2 @@
-{{language}}{{Stub}}
\ No newline at end of file
+{{language}}{{Stub}}
+CB80 is not a separate language or dialect but rather a companion compiler for the [[CBASIC]] dialect of BASIC for 8-bit CP/M systems. The CBASIC compiler compiles source code into an intermediate form, which is stored on disk with the file extension INT. The compiled code is executed by invoking a run-time interpreter (CRUN.COM) from the command line. CB80, by contrast, compiles the source into a relocatable machine code file having an REL extension, which is then linked with necessary run-time library routines using the supplied linker (either LINK.COM or LK80.COM), to create a stand-alone executable file with the extension COM, which can be run simply by typing its name on the CP/M command-line. All of the posted CBASIC examples on Rosetta Code as of 9/14/2024 will compile and run without change under CB80. One subtle difference which could affect some programs lies in the behavior of the FOR .. NEXT statement. When run under CBASIC the body of the statement will always be executed at least once even if the index variable exceeds the value of the stop expression. If compiled using CB80, however, the loop will not be executed under those circumstances.
\ No newline at end of file
diff --git a/Lang/CBASIC/00-LANG.txt b/Lang/CBASIC/00-LANG.txt
new file mode 100644
index 0000000000..f0ff8ea32b
--- /dev/null
+++ b/Lang/CBASIC/00-LANG.txt
@@ -0,0 +1,21 @@
+{{stub}} {{language|CBASIC}}
+CBASIC was the commercial outgrowth of the BASIC-E compiler
+written by Gordon Eubanks as his Master's thesis while a 
+student at the Naval Postgraduate School. CBASIC -- which
+was marketed for both 8 and 16 bit CP/M systems -- differed from
+many of the BASIC dialects of the day in two major respects:
+(1) line numbers were not required unless the statement was
+the target of a GOTO or GOSUB statement (and were in any event
+treated simply as labels) and (2) real (floating point) variables
+were implemented as 14-digit binary coded decimal (BCD), which,
+particularly in business and accounting applications, avoided round-off 
+errors which purely binary floating point computations were prone
+to. Integer and string variables (which required % and $ suffixes,
+respectively) were also provided, as well as multi-dimensional arrays.
+Identifiers could be of any length, although only the first 31
+characters were significant. CBASIC supported multiline user-defined 
+functions with parameters passed by value but did not support recursion.
+CBASIC was implemented as a compiler-interpreter: the source code was
+compiled into an intermediate form, which could then be executed by
+invoking a run-time interpreter. A companion compiler, [[CB80]], was
+offered that compiled to machine code.
\ No newline at end of file
diff --git a/Lang/CBASIC/00-META.yaml b/Lang/CBASIC/00-META.yaml
new file mode 100644
index 0000000000..ad24e74664
--- /dev/null
+++ b/Lang/CBASIC/00-META.yaml
@@ -0,0 +1,2 @@
+---
+from: http://rosettacode.org/wiki/Category:CBASIC
diff --git a/Lang/CBASIC/100-doors b/Lang/CBASIC/100-doors
new file mode 120000
index 0000000000..e01a233041
--- /dev/null
+++ b/Lang/CBASIC/100-doors
@@ -0,0 +1 @@
+../../Task/100-doors/CBASIC
\ No newline at end of file
diff --git a/Lang/CBASIC/Amicable-pairs b/Lang/CBASIC/Amicable-pairs
new file mode 120000
index 0000000000..6386efc2a5
--- /dev/null
+++ b/Lang/CBASIC/Amicable-pairs
@@ -0,0 +1 @@
+../../Task/Amicable-pairs/CBASIC
\ No newline at end of file
diff --git a/Lang/CBASIC/Binary-digits b/Lang/CBASIC/Binary-digits
new file mode 120000
index 0000000000..d0de913861
--- /dev/null
+++ b/Lang/CBASIC/Binary-digits
@@ -0,0 +1 @@
+../../Task/Binary-digits/CBASIC
\ No newline at end of file
diff --git a/Lang/CBASIC/Factorial b/Lang/CBASIC/Factorial
new file mode 120000
index 0000000000..97dfd0b137
--- /dev/null
+++ b/Lang/CBASIC/Factorial
@@ -0,0 +1 @@
+../../Task/Factorial/CBASIC
\ No newline at end of file
diff --git a/Lang/CBASIC/Fibonacci-sequence b/Lang/CBASIC/Fibonacci-sequence
new file mode 120000
index 0000000000..eb9f8cf7a1
--- /dev/null
+++ b/Lang/CBASIC/Fibonacci-sequence
@@ -0,0 +1 @@
+../../Task/Fibonacci-sequence/CBASIC
\ No newline at end of file
diff --git a/Lang/CBASIC/Harmonic-series b/Lang/CBASIC/Harmonic-series
new file mode 120000
index 0000000000..aa1eac83fa
--- /dev/null
+++ b/Lang/CBASIC/Harmonic-series
@@ -0,0 +1 @@
+../../Task/Harmonic-series/CBASIC
\ No newline at end of file
diff --git a/Lang/CBASIC/Perfect-numbers b/Lang/CBASIC/Perfect-numbers
new file mode 120000
index 0000000000..3f847760d8
--- /dev/null
+++ b/Lang/CBASIC/Perfect-numbers
@@ -0,0 +1 @@
+../../Task/Perfect-numbers/CBASIC
\ No newline at end of file
diff --git a/Lang/CBASIC/Rot-13 b/Lang/CBASIC/Rot-13
new file mode 120000
index 0000000000..bbda100cd2
--- /dev/null
+++ b/Lang/CBASIC/Rot-13
@@ -0,0 +1 @@
+../../Task/Rot-13/CBASIC
\ No newline at end of file
diff --git a/Lang/CBASIC/Sieve-of-Eratosthenes b/Lang/CBASIC/Sieve-of-Eratosthenes
new file mode 120000
index 0000000000..ecdf66656a
--- /dev/null
+++ b/Lang/CBASIC/Sieve-of-Eratosthenes
@@ -0,0 +1 @@
+../../Task/Sieve-of-Eratosthenes/CBASIC
\ No newline at end of file
diff --git a/Lang/CJam/00-LANG.txt b/Lang/CJam/00-LANG.txt
new file mode 100644
index 0000000000..9d6f8331dc
--- /dev/null
+++ b/Lang/CJam/00-LANG.txt
@@ -0,0 +1,8 @@
+{{language|site=https://sourceforge.net/p/cjam/wiki/Home/}}
+
+[https://sourceforge.net/projects/cjam/ sf repo]
+
+From the [https://sourceforge.net/p/cjam/wiki/Home/ wiki]:
+
+:In order to run a CJam program, [https://sourceforge.net/projects/cjam/files/ download] the latest jar file, e.g. cjam-0.6.5.jar, and run this command:
+:
java -jar cjam-0.6.5.jar file.cjam
\ No newline at end of file diff --git a/Lang/CJam/00-META.yaml b/Lang/CJam/00-META.yaml new file mode 100644 index 0000000000..49b8d01361 --- /dev/null +++ b/Lang/CJam/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:CJam diff --git a/Lang/CLU/Arithmetic-derivative b/Lang/CLU/Arithmetic-derivative new file mode 120000 index 0000000000..f0f81c6bc1 --- /dev/null +++ b/Lang/CLU/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/CLU \ No newline at end of file diff --git a/Lang/CLU/Move-to-front-algorithm b/Lang/CLU/Move-to-front-algorithm new file mode 120000 index 0000000000..bbdfe9bcdb --- /dev/null +++ b/Lang/CLU/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/CLU \ No newline at end of file diff --git a/Lang/CLU/Partition-an-integer-x-into-n-primes b/Lang/CLU/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..9ff1739382 --- /dev/null +++ b/Lang/CLU/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/CLU \ No newline at end of file diff --git a/Lang/CLU/Quaternion-type b/Lang/CLU/Quaternion-type deleted file mode 120000 index abdefd8765..0000000000 --- a/Lang/CLU/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/CLU \ No newline at end of file diff --git a/Lang/CLU/Super-d-numbers b/Lang/CLU/Super-d-numbers new file mode 120000 index 0000000000..a271a5f6dc --- /dev/null +++ b/Lang/CLU/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/CLU \ No newline at end of file diff --git a/Lang/CMake/Comments b/Lang/CMake/Comments new file mode 120000 index 0000000000..bc55fb468f --- /dev/null +++ b/Lang/CMake/Comments @@ -0,0 +1 @@ +../../Task/Comments/CMake \ No newline at end of file diff --git a/Lang/COBOL/ABC-problem b/Lang/COBOL/ABC-problem new file mode 120000 index 0000000000..ca521ee81d --- /dev/null +++ b/Lang/COBOL/ABC-problem @@ -0,0 +1 @@ +../../Task/ABC-problem/COBOL \ No newline at end of file diff --git a/Lang/COBOL/AVL-tree b/Lang/COBOL/AVL-tree new file mode 120000 index 0000000000..d8a20640c6 --- /dev/null +++ b/Lang/COBOL/AVL-tree @@ -0,0 +1 @@ +../../Task/AVL-tree/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Abundant-odd-numbers b/Lang/COBOL/Abundant-odd-numbers new file mode 120000 index 0000000000..7268a8a6ca --- /dev/null +++ b/Lang/COBOL/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Achilles-numbers b/Lang/COBOL/Achilles-numbers new file mode 120000 index 0000000000..4a3a715de1 --- /dev/null +++ b/Lang/COBOL/Achilles-numbers @@ -0,0 +1 @@ +../../Task/Achilles-numbers/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Arithmetic-numbers b/Lang/COBOL/Arithmetic-numbers new file mode 120000 index 0000000000..cf8f3a0323 --- /dev/null +++ b/Lang/COBOL/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Calkin-Wilf-sequence b/Lang/COBOL/Calkin-Wilf-sequence new file mode 120000 index 0000000000..f3e314890f --- /dev/null +++ b/Lang/COBOL/Calkin-Wilf-sequence @@ -0,0 +1 @@ +../../Task/Calkin-Wilf-sequence/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Colorful-numbers b/Lang/COBOL/Colorful-numbers new file mode 120000 index 0000000000..6d5c4f9dff --- /dev/null +++ b/Lang/COBOL/Colorful-numbers @@ -0,0 +1 @@ +../../Task/Colorful-numbers/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Cullen-and-Woodall-numbers b/Lang/COBOL/Cullen-and-Woodall-numbers new file mode 120000 index 0000000000..b212ad96a5 --- /dev/null +++ b/Lang/COBOL/Cullen-and-Woodall-numbers @@ -0,0 +1 @@ +../../Task/Cullen-and-Woodall-numbers/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Damm-algorithm b/Lang/COBOL/Damm-algorithm new file mode 120000 index 0000000000..e4f3bf1f71 --- /dev/null +++ b/Lang/COBOL/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/COBOL \ No newline at end of file diff --git a/Lang/COBOL/De-Bruijn-sequences b/Lang/COBOL/De-Bruijn-sequences new file mode 120000 index 0000000000..67e8dee974 --- /dev/null +++ b/Lang/COBOL/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Dijkstras-algorithm b/Lang/COBOL/Dijkstras-algorithm new file mode 120000 index 0000000000..19c743357a --- /dev/null +++ b/Lang/COBOL/Dijkstras-algorithm @@ -0,0 +1 @@ +../../Task/Dijkstras-algorithm/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Farey-sequence b/Lang/COBOL/Farey-sequence new file mode 120000 index 0000000000..b402aede64 --- /dev/null +++ b/Lang/COBOL/Farey-sequence @@ -0,0 +1 @@ +../../Task/Farey-sequence/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Floyd-Warshall-algorithm b/Lang/COBOL/Floyd-Warshall-algorithm new file mode 120000 index 0000000000..de49182ec8 --- /dev/null +++ b/Lang/COBOL/Floyd-Warshall-algorithm @@ -0,0 +1 @@ +../../Task/Floyd-Warshall-algorithm/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Fusc-sequence b/Lang/COBOL/Fusc-sequence new file mode 120000 index 0000000000..e8b4b1330c --- /dev/null +++ b/Lang/COBOL/Fusc-sequence @@ -0,0 +1 @@ +../../Task/Fusc-sequence/COBOL \ No newline at end of file diff --git a/Lang/COBOL/K-d-tree b/Lang/COBOL/K-d-tree new file mode 120000 index 0000000000..af9595a130 --- /dev/null +++ b/Lang/COBOL/K-d-tree @@ -0,0 +1 @@ +../../Task/K-d-tree/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Knuths-algorithm-S b/Lang/COBOL/Knuths-algorithm-S new file mode 120000 index 0000000000..119841f920 --- /dev/null +++ b/Lang/COBOL/Knuths-algorithm-S @@ -0,0 +1 @@ +../../Task/Knuths-algorithm-S/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Leonardo-numbers b/Lang/COBOL/Leonardo-numbers new file mode 120000 index 0000000000..65bc7509a4 --- /dev/null +++ b/Lang/COBOL/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Magic-8-ball b/Lang/COBOL/Magic-8-ball new file mode 120000 index 0000000000..4aa919846c --- /dev/null +++ b/Lang/COBOL/Magic-8-ball @@ -0,0 +1 @@ +../../Task/Magic-8-ball/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Move-to-front-algorithm b/Lang/COBOL/Move-to-front-algorithm new file mode 120000 index 0000000000..f9458888cc --- /dev/null +++ b/Lang/COBOL/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Nim-game b/Lang/COBOL/Nim-game new file mode 120000 index 0000000000..9a7c582b48 --- /dev/null +++ b/Lang/COBOL/Nim-game @@ -0,0 +1 @@ +../../Task/Nim-game/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Pancake-numbers b/Lang/COBOL/Pancake-numbers new file mode 120000 index 0000000000..22e5574a28 --- /dev/null +++ b/Lang/COBOL/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Parametric-polymorphism b/Lang/COBOL/Parametric-polymorphism new file mode 120000 index 0000000000..44f214df50 --- /dev/null +++ b/Lang/COBOL/Parametric-polymorphism @@ -0,0 +1 @@ +../../Task/Parametric-polymorphism/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Priority-queue b/Lang/COBOL/Priority-queue new file mode 120000 index 0000000000..23c7bff2c3 --- /dev/null +++ b/Lang/COBOL/Priority-queue @@ -0,0 +1 @@ +../../Task/Priority-queue/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Soloways-recurring-rainfall b/Lang/COBOL/Soloways-recurring-rainfall new file mode 120000 index 0000000000..883bf3b2e0 --- /dev/null +++ b/Lang/COBOL/Soloways-recurring-rainfall @@ -0,0 +1 @@ +../../Task/Soloways-recurring-rainfall/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Strassens-algorithm b/Lang/COBOL/Strassens-algorithm new file mode 120000 index 0000000000..488f64d9e2 --- /dev/null +++ b/Lang/COBOL/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/COBOL \ No newline at end of file diff --git a/Lang/COBOL/The-Name-Game b/Lang/COBOL/The-Name-Game new file mode 120000 index 0000000000..35866ecb72 --- /dev/null +++ b/Lang/COBOL/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Twos-complement b/Lang/COBOL/Twos-complement new file mode 120000 index 0000000000..776801b9e2 --- /dev/null +++ b/Lang/COBOL/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Vigen-re-cipher b/Lang/COBOL/Vigen-re-cipher new file mode 120000 index 0000000000..93e3f53bcb --- /dev/null +++ b/Lang/COBOL/Vigen-re-cipher @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher/COBOL \ No newline at end of file diff --git a/Lang/COBOL/Zeckendorf-number-representation b/Lang/COBOL/Zeckendorf-number-representation new file mode 120000 index 0000000000..d3c11d47da --- /dev/null +++ b/Lang/COBOL/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/COBOL \ No newline at end of file diff --git a/Lang/Calc/00-LANG.txt b/Lang/Calc/00-LANG.txt new file mode 100644 index 0000000000..9066fe1741 --- /dev/null +++ b/Lang/Calc/00-LANG.txt @@ -0,0 +1,10 @@ +{{language|Calc +|untyped=yes}} +{{language programming paradigm|stack-based}} +{{language programming paradigm|imperative}} + +Calc is a stack-based RPN calculator inside [[Emacs]]. Calc is part of GNU Emacs 22, or a package for XEmacs. + +Calc presents itself as an interactive calculator. Instructions can also be stored as macros, including control flow instructions (if-then-else, for loop, etc.), which makes Calc fully programmable. Calc also provides a library available in Emacs Lisp programs. + +Calc has more numeric types than plain Emacs Lisp. Calc has big integers, big floating-point numbers, rational numbers, complex numbers, and more. (For contrast, plain Emacs Lisp can only handle integers and floating-point numbers of limited precision.) Emacs Lisp with Calc can solve tasks requiring these types of numbers. \ No newline at end of file diff --git a/Lang/Calc/00-META.yaml b/Lang/Calc/00-META.yaml new file mode 100644 index 0000000000..85b0e2ef53 --- /dev/null +++ b/Lang/Calc/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Calc diff --git a/Lang/Calc/Averages-Arithmetic-mean b/Lang/Calc/Averages-Arithmetic-mean new file mode 120000 index 0000000000..8ad84c8dbd --- /dev/null +++ b/Lang/Calc/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Calc \ No newline at end of file diff --git a/Lang/Calc/Modular-exponentiation b/Lang/Calc/Modular-exponentiation new file mode 120000 index 0000000000..b72a4448d5 --- /dev/null +++ b/Lang/Calc/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/Calc \ No newline at end of file diff --git a/Lang/Calcscript/00-LANG.txt b/Lang/Calcscript/00-LANG.txt new file mode 100644 index 0000000000..d2db819bbe --- /dev/null +++ b/Lang/Calcscript/00-LANG.txt @@ -0,0 +1,10 @@ +{{language +|site=https://gitee.com/jfiewo/calc/ +}} +Calcscript is a small lisp-like language. +* It has 3 datatypes: Int, Same, and Invalid. +* The usual 4 arithmetic operations are supported. + +See [https://gitee.com/jfiewo/calc/ the respository] for details. +{{language programming paradigm|Logic Programming}} +{{language programming paradigm|Functional}} \ No newline at end of file diff --git a/Lang/Calcscript/00-META.yaml b/Lang/Calcscript/00-META.yaml new file mode 100644 index 0000000000..cee9fc468f --- /dev/null +++ b/Lang/Calcscript/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Calcscript diff --git a/Lang/Chapel/Function-definition b/Lang/Chapel/Function-definition new file mode 120000 index 0000000000..589b4afa2c --- /dev/null +++ b/Lang/Chapel/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Chapel \ No newline at end of file diff --git a/Lang/Chapel/Maze-generation b/Lang/Chapel/Maze-generation new file mode 120000 index 0000000000..b4c55cfddb --- /dev/null +++ b/Lang/Chapel/Maze-generation @@ -0,0 +1 @@ +../../Task/Maze-generation/Chapel \ No newline at end of file diff --git a/Lang/Chapel/Repeat b/Lang/Chapel/Repeat new file mode 120000 index 0000000000..3c555a4885 --- /dev/null +++ b/Lang/Chapel/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/Chapel \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/21-game b/Lang/Chipmunk-Basic/21-game new file mode 120000 index 0000000000..4144c99f1e --- /dev/null +++ b/Lang/Chipmunk-Basic/21-game @@ -0,0 +1 @@ +../../Task/21-game/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/ASCII-art-diagram-converter b/Lang/Chipmunk-Basic/ASCII-art-diagram-converter new file mode 120000 index 0000000000..a034d74b58 --- /dev/null +++ b/Lang/Chipmunk-Basic/ASCII-art-diagram-converter @@ -0,0 +1 @@ +../../Task/ASCII-art-diagram-converter/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Angle-difference-between-two-bearings b/Lang/Chipmunk-Basic/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..a85e9ed412 --- /dev/null +++ b/Lang/Chipmunk-Basic/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Anonymous-recursion b/Lang/Chipmunk-Basic/Anonymous-recursion new file mode 120000 index 0000000000..fae9f410e3 --- /dev/null +++ b/Lang/Chipmunk-Basic/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Arithmetic-Integer b/Lang/Chipmunk-Basic/Arithmetic-Integer new file mode 120000 index 0000000000..b9b0d2d61f --- /dev/null +++ b/Lang/Chipmunk-Basic/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Array-length b/Lang/Chipmunk-Basic/Array-length new file mode 120000 index 0000000000..3b47a54405 --- /dev/null +++ b/Lang/Chipmunk-Basic/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Associative-array-Merging b/Lang/Chipmunk-Basic/Associative-array-Merging new file mode 120000 index 0000000000..dd87e8e06c --- /dev/null +++ b/Lang/Chipmunk-Basic/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Benfords-law b/Lang/Chipmunk-Basic/Benfords-law new file mode 120000 index 0000000000..7340fa502c --- /dev/null +++ b/Lang/Chipmunk-Basic/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Binary-digits b/Lang/Chipmunk-Basic/Binary-digits new file mode 120000 index 0000000000..f633724e32 --- /dev/null +++ b/Lang/Chipmunk-Basic/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Box-the-compass b/Lang/Chipmunk-Basic/Box-the-compass new file mode 120000 index 0000000000..a1cd1027f8 --- /dev/null +++ b/Lang/Chipmunk-Basic/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Cantor-set b/Lang/Chipmunk-Basic/Cantor-set new file mode 120000 index 0000000000..dff232c5bf --- /dev/null +++ b/Lang/Chipmunk-Basic/Cantor-set @@ -0,0 +1 @@ +../../Task/Cantor-set/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Carmichael-3-strong-pseudoprimes b/Lang/Chipmunk-Basic/Carmichael-3-strong-pseudoprimes new file mode 120000 index 0000000000..64c40104c4 --- /dev/null +++ b/Lang/Chipmunk-Basic/Carmichael-3-strong-pseudoprimes @@ -0,0 +1 @@ +../../Task/Carmichael-3-strong-pseudoprimes/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Casting-out-nines b/Lang/Chipmunk-Basic/Casting-out-nines new file mode 120000 index 0000000000..5a7c2dcac0 --- /dev/null +++ b/Lang/Chipmunk-Basic/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Catalan-numbers-Pascals-triangle b/Lang/Chipmunk-Basic/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..8fc59cdf4f --- /dev/null +++ b/Lang/Chipmunk-Basic/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Catamorphism b/Lang/Chipmunk-Basic/Catamorphism new file mode 120000 index 0000000000..db776ce5dd --- /dev/null +++ b/Lang/Chipmunk-Basic/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Character-codes b/Lang/Chipmunk-Basic/Character-codes new file mode 120000 index 0000000000..529877dba7 --- /dev/null +++ b/Lang/Chipmunk-Basic/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Create-a-two-dimensional-array-at-runtime b/Lang/Chipmunk-Basic/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..0eef501718 --- /dev/null +++ b/Lang/Chipmunk-Basic/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Determine-if-a-string-has-all-unique-characters b/Lang/Chipmunk-Basic/Determine-if-a-string-has-all-unique-characters new file mode 120000 index 0000000000..88c8574cc2 --- /dev/null +++ b/Lang/Chipmunk-Basic/Determine-if-a-string-has-all-unique-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-unique-characters/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Determine-sentence-type b/Lang/Chipmunk-Basic/Determine-sentence-type new file mode 120000 index 0000000000..6851894430 --- /dev/null +++ b/Lang/Chipmunk-Basic/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Dinesmans-multiple-dwelling-problem b/Lang/Chipmunk-Basic/Dinesmans-multiple-dwelling-problem new file mode 120000 index 0000000000..aa615c1450 --- /dev/null +++ b/Lang/Chipmunk-Basic/Dinesmans-multiple-dwelling-problem @@ -0,0 +1 @@ +../../Task/Dinesmans-multiple-dwelling-problem/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Disarium-numbers b/Lang/Chipmunk-Basic/Disarium-numbers new file mode 120000 index 0000000000..f8085142a1 --- /dev/null +++ b/Lang/Chipmunk-Basic/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Display-a-linear-combination b/Lang/Chipmunk-Basic/Display-a-linear-combination new file mode 120000 index 0000000000..76f3965566 --- /dev/null +++ b/Lang/Chipmunk-Basic/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Diversity-prediction-theorem b/Lang/Chipmunk-Basic/Diversity-prediction-theorem new file mode 120000 index 0000000000..094da6a44e --- /dev/null +++ b/Lang/Chipmunk-Basic/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Eban-numbers b/Lang/Chipmunk-Basic/Eban-numbers new file mode 120000 index 0000000000..109253525e --- /dev/null +++ b/Lang/Chipmunk-Basic/Eban-numbers @@ -0,0 +1 @@ +../../Task/Eban-numbers/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Egyptian-division b/Lang/Chipmunk-Basic/Egyptian-division new file mode 120000 index 0000000000..234893fac4 --- /dev/null +++ b/Lang/Chipmunk-Basic/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Ethiopian-multiplication b/Lang/Chipmunk-Basic/Ethiopian-multiplication new file mode 120000 index 0000000000..bba9addcb7 --- /dev/null +++ b/Lang/Chipmunk-Basic/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Evaluate-binomial-coefficients b/Lang/Chipmunk-Basic/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..b45aed06e2 --- /dev/null +++ b/Lang/Chipmunk-Basic/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Fibonacci-n-step-number-sequences b/Lang/Chipmunk-Basic/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..24e6f1fb75 --- /dev/null +++ b/Lang/Chipmunk-Basic/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Find-limit-of-recursion b/Lang/Chipmunk-Basic/Find-limit-of-recursion new file mode 120000 index 0000000000..45d2935cfe --- /dev/null +++ b/Lang/Chipmunk-Basic/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Generate-Chess960-starting-position b/Lang/Chipmunk-Basic/Generate-Chess960-starting-position new file mode 120000 index 0000000000..daceb0cf8f --- /dev/null +++ b/Lang/Chipmunk-Basic/Generate-Chess960-starting-position @@ -0,0 +1 @@ +../../Task/Generate-Chess960-starting-position/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Generate-lower-case-ASCII-alphabet b/Lang/Chipmunk-Basic/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..22e12f5ab0 --- /dev/null +++ b/Lang/Chipmunk-Basic/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Greatest-common-divisor b/Lang/Chipmunk-Basic/Greatest-common-divisor new file mode 120000 index 0000000000..688f826236 --- /dev/null +++ b/Lang/Chipmunk-Basic/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Guess-the-number-With-feedback b/Lang/Chipmunk-Basic/Guess-the-number-With-feedback new file mode 120000 index 0000000000..02ea8c88d7 --- /dev/null +++ b/Lang/Chipmunk-Basic/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Jensens-Device b/Lang/Chipmunk-Basic/Jensens-Device new file mode 120000 index 0000000000..927dca2f6f --- /dev/null +++ b/Lang/Chipmunk-Basic/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Leonardo-numbers b/Lang/Chipmunk-Basic/Leonardo-numbers new file mode 120000 index 0000000000..65f7e68a9b --- /dev/null +++ b/Lang/Chipmunk-Basic/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Logical-operations b/Lang/Chipmunk-Basic/Logical-operations new file mode 120000 index 0000000000..1eae3370d2 --- /dev/null +++ b/Lang/Chipmunk-Basic/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Longest-string-challenge b/Lang/Chipmunk-Basic/Longest-string-challenge new file mode 120000 index 0000000000..16c197c355 --- /dev/null +++ b/Lang/Chipmunk-Basic/Longest-string-challenge @@ -0,0 +1 @@ +../../Task/Longest-string-challenge/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Magic-squares-of-odd-order b/Lang/Chipmunk-Basic/Magic-squares-of-odd-order new file mode 120000 index 0000000000..a9239c9a6f --- /dev/null +++ b/Lang/Chipmunk-Basic/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Map-range b/Lang/Chipmunk-Basic/Map-range new file mode 120000 index 0000000000..3aa5f00ecb --- /dev/null +++ b/Lang/Chipmunk-Basic/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/Chipmunk-Basic/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..c3bc5a092d --- /dev/null +++ b/Lang/Chipmunk-Basic/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Morse-code b/Lang/Chipmunk-Basic/Morse-code new file mode 120000 index 0000000000..069e4c61b6 --- /dev/null +++ b/Lang/Chipmunk-Basic/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Multiple-regression b/Lang/Chipmunk-Basic/Multiple-regression new file mode 120000 index 0000000000..82844a944e --- /dev/null +++ b/Lang/Chipmunk-Basic/Multiple-regression @@ -0,0 +1 @@ +../../Task/Multiple-regression/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Nested-templated-data b/Lang/Chipmunk-Basic/Nested-templated-data new file mode 120000 index 0000000000..a7e95ed6f1 --- /dev/null +++ b/Lang/Chipmunk-Basic/Nested-templated-data @@ -0,0 +1 @@ +../../Task/Nested-templated-data/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Nim-game b/Lang/Chipmunk-Basic/Nim-game new file mode 120000 index 0000000000..a5f5c4be4c --- /dev/null +++ b/Lang/Chipmunk-Basic/Nim-game @@ -0,0 +1 @@ +../../Task/Nim-game/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Padovan-n-step-number-sequences b/Lang/Chipmunk-Basic/Padovan-n-step-number-sequences new file mode 120000 index 0000000000..fbce2420d3 --- /dev/null +++ b/Lang/Chipmunk-Basic/Padovan-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Padovan-n-step-number-sequences/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Pascals-triangle b/Lang/Chipmunk-Basic/Pascals-triangle new file mode 120000 index 0000000000..aa62c07130 --- /dev/null +++ b/Lang/Chipmunk-Basic/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Perfect-numbers b/Lang/Chipmunk-Basic/Perfect-numbers new file mode 120000 index 0000000000..4bd1876580 --- /dev/null +++ b/Lang/Chipmunk-Basic/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Phrase-reversals b/Lang/Chipmunk-Basic/Phrase-reversals new file mode 120000 index 0000000000..3d4b70a430 --- /dev/null +++ b/Lang/Chipmunk-Basic/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Pig-the-dice-game b/Lang/Chipmunk-Basic/Pig-the-dice-game new file mode 120000 index 0000000000..6dbe194257 --- /dev/null +++ b/Lang/Chipmunk-Basic/Pig-the-dice-game @@ -0,0 +1 @@ +../../Task/Pig-the-dice-game/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Price-fraction b/Lang/Chipmunk-Basic/Price-fraction new file mode 120000 index 0000000000..895d56d4cf --- /dev/null +++ b/Lang/Chipmunk-Basic/Price-fraction @@ -0,0 +1 @@ +../../Task/Price-fraction/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Proper-divisors b/Lang/Chipmunk-Basic/Proper-divisors new file mode 120000 index 0000000000..e83b2b6ef0 --- /dev/null +++ b/Lang/Chipmunk-Basic/Proper-divisors @@ -0,0 +1 @@ +../../Task/Proper-divisors/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Rate-counter b/Lang/Chipmunk-Basic/Rate-counter new file mode 120000 index 0000000000..214d671194 --- /dev/null +++ b/Lang/Chipmunk-Basic/Rate-counter @@ -0,0 +1 @@ +../../Task/Rate-counter/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Repeat-a-string b/Lang/Chipmunk-Basic/Repeat-a-string new file mode 120000 index 0000000000..dc67dccc15 --- /dev/null +++ b/Lang/Chipmunk-Basic/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Sequence-of-non-squares b/Lang/Chipmunk-Basic/Sequence-of-non-squares new file mode 120000 index 0000000000..70b50faaad --- /dev/null +++ b/Lang/Chipmunk-Basic/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Sequence:-smallest-number-with-exactly-n-divisors b/Lang/Chipmunk-Basic/Sequence:-smallest-number-with-exactly-n-divisors new file mode 120000 index 0000000000..5df75dca56 --- /dev/null +++ b/Lang/Chipmunk-Basic/Sequence:-smallest-number-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-with-exactly-n-divisors/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Shell-one-liner b/Lang/Chipmunk-Basic/Shell-one-liner new file mode 120000 index 0000000000..a90b838683 --- /dev/null +++ b/Lang/Chipmunk-Basic/Shell-one-liner @@ -0,0 +1 @@ +../../Task/Shell-one-liner/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Sorting-algorithms-Gnome-sort b/Lang/Chipmunk-Basic/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..0b812d3eff --- /dev/null +++ b/Lang/Chipmunk-Basic/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Sorting-algorithms-Quicksort b/Lang/Chipmunk-Basic/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..49de096b59 --- /dev/null +++ b/Lang/Chipmunk-Basic/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Split-a-character-string-based-on-change-of-character b/Lang/Chipmunk-Basic/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..ae1d1da2a7 --- /dev/null +++ b/Lang/Chipmunk-Basic/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/String-append b/Lang/Chipmunk-Basic/String-append new file mode 120000 index 0000000000..39fda96e4e --- /dev/null +++ b/Lang/Chipmunk-Basic/String-append @@ -0,0 +1 @@ +../../Task/String-append/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/String-case b/Lang/Chipmunk-Basic/String-case new file mode 120000 index 0000000000..0564614620 --- /dev/null +++ b/Lang/Chipmunk-Basic/String-case @@ -0,0 +1 @@ +../../Task/String-case/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/String-interpolation-included- b/Lang/Chipmunk-Basic/String-interpolation-included- new file mode 120000 index 0000000000..0fcd929e46 --- /dev/null +++ b/Lang/Chipmunk-Basic/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/String-prepend b/Lang/Chipmunk-Basic/String-prepend new file mode 120000 index 0000000000..9efa1b444d --- /dev/null +++ b/Lang/Chipmunk-Basic/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Sudan-function b/Lang/Chipmunk-Basic/Sudan-function new file mode 120000 index 0000000000..8b26708ee8 --- /dev/null +++ b/Lang/Chipmunk-Basic/Sudan-function @@ -0,0 +1 @@ +../../Task/Sudan-function/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Sum-of-a-series b/Lang/Chipmunk-Basic/Sum-of-a-series new file mode 120000 index 0000000000..f9bdcf9a6b --- /dev/null +++ b/Lang/Chipmunk-Basic/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/The-Name-Game b/Lang/Chipmunk-Basic/The-Name-Game new file mode 120000 index 0000000000..5655525e11 --- /dev/null +++ b/Lang/Chipmunk-Basic/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Twos-complement b/Lang/Chipmunk-Basic/Twos-complement new file mode 120000 index 0000000000..4eb5b36880 --- /dev/null +++ b/Lang/Chipmunk-Basic/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Van-Eck-sequence b/Lang/Chipmunk-Basic/Van-Eck-sequence new file mode 120000 index 0000000000..ec557b87cc --- /dev/null +++ b/Lang/Chipmunk-Basic/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Chipmunk-Basic/Vector b/Lang/Chipmunk-Basic/Vector new file mode 120000 index 0000000000..68aa51b11b --- /dev/null +++ b/Lang/Chipmunk-Basic/Vector @@ -0,0 +1 @@ +../../Task/Vector/Chipmunk-Basic \ No newline at end of file diff --git a/Lang/Clojure/Miller-Rabin-primality-test b/Lang/Clojure/Miller-Rabin-primality-test deleted file mode 120000 index 67b048eb10..0000000000 --- a/Lang/Clojure/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Clojure \ No newline at end of file diff --git a/Lang/CoffeeScript/00-LANG.txt b/Lang/CoffeeScript/00-LANG.txt index 08d9c62010..c50ed52dc7 100644 --- a/Lang/CoffeeScript/00-LANG.txt +++ b/Lang/CoffeeScript/00-LANG.txt @@ -14,30 +14,30 @@ On December 24, 2010, Ashkenas announced the release of stable 1.0.0. A common JavaScript snippet using the jQuery library is - + $(document).ready(function() { // Initialization code goes here }); - + or even shorter, - + $(function() { // Initialization code goes here }); - + In CoffeeScript, the function keyword is replaced by the -> symbol, and indentation is used instead of curly braces (except when defining an [[associative array]]), as in Python. Also, parentheses can usually be omitted. Thus, the CoffeeScript equivalent of the snippet above is - + $(document).ready -> # Initialization code goes here - + or - + $ -> # Initialization code goes here - + == Compiling == diff --git a/Lang/CoffeeScript/Empty-program b/Lang/CoffeeScript/Empty-program deleted file mode 120000 index c325b31ffa..0000000000 --- a/Lang/CoffeeScript/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Sorting-Algorithms-Circle-Sort b/Lang/CoffeeScript/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index e4d7481d88..0000000000 --- a/Lang/CoffeeScript/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/CoffeeScript \ No newline at end of file diff --git a/Lang/Comal/Fairshare-between-two-and-more b/Lang/Comal/Fairshare-between-two-and-more new file mode 120000 index 0000000000..4497e4f55d --- /dev/null +++ b/Lang/Comal/Fairshare-between-two-and-more @@ -0,0 +1 @@ +../../Task/Fairshare-between-two-and-more/Comal \ No newline at end of file diff --git a/Lang/Comal/Zeckendorf-number-representation b/Lang/Comal/Zeckendorf-number-representation new file mode 120000 index 0000000000..55d16429d3 --- /dev/null +++ b/Lang/Comal/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/Comal \ No newline at end of file diff --git a/Lang/Commodore-BASIC/Comma-quibbling b/Lang/Commodore-BASIC/Comma-quibbling new file mode 120000 index 0000000000..5ff3afcd59 --- /dev/null +++ b/Lang/Commodore-BASIC/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Commodore-BASIC \ No newline at end of file diff --git a/Lang/Commodore-BASIC/Forest-fire b/Lang/Commodore-BASIC/Forest-fire new file mode 120000 index 0000000000..c384f7d98f --- /dev/null +++ b/Lang/Commodore-BASIC/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Commodore-BASIC \ No newline at end of file diff --git a/Lang/Commodore-BASIC/Miller-Rabin-primality-test b/Lang/Commodore-BASIC/Miller-Rabin-primality-test deleted file mode 120000 index 7354bc510f..0000000000 --- a/Lang/Commodore-BASIC/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Commodore-BASIC \ No newline at end of file diff --git a/Lang/Commodore-BASIC/N-queens-problem b/Lang/Commodore-BASIC/N-queens-problem new file mode 120000 index 0000000000..d5a4ff5b7a --- /dev/null +++ b/Lang/Commodore-BASIC/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/Commodore-BASIC \ No newline at end of file diff --git a/Lang/Commodore-BASIC/Random-number-generator-device- b/Lang/Commodore-BASIC/Random-number-generator-device- new file mode 120000 index 0000000000..f23b1d0d42 --- /dev/null +++ b/Lang/Commodore-BASIC/Random-number-generator-device- @@ -0,0 +1 @@ +../../Task/Random-number-generator-device-/Commodore-BASIC \ No newline at end of file diff --git a/Lang/Commodore-BASIC/Reverse-a-string b/Lang/Commodore-BASIC/Reverse-a-string new file mode 120000 index 0000000000..db83958808 --- /dev/null +++ b/Lang/Commodore-BASIC/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Commodore-BASIC \ No newline at end of file diff --git a/Lang/Commodore-BASIC/The-Twelve-Days-of-Christmas b/Lang/Commodore-BASIC/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..cd67a05c16 --- /dev/null +++ b/Lang/Commodore-BASIC/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/Commodore-BASIC \ No newline at end of file diff --git a/Lang/Common-Lisp/Blum-integer b/Lang/Common-Lisp/Blum-integer new file mode 120000 index 0000000000..854dbaeee7 --- /dev/null +++ b/Lang/Common-Lisp/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/Common-Lisp \ No newline at end of file diff --git a/Lang/Common-Lisp/Factorial-primes b/Lang/Common-Lisp/Factorial-primes new file mode 120000 index 0000000000..cc0d935af1 --- /dev/null +++ b/Lang/Common-Lisp/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/Common-Lisp \ No newline at end of file diff --git a/Lang/Common-Lisp/Miller-Rabin-primality-test b/Lang/Common-Lisp/Miller-Rabin-primality-test deleted file mode 120000 index 4f8dbe695d..0000000000 --- a/Lang/Common-Lisp/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Common-Lisp \ No newline at end of file diff --git a/Lang/Common-Lisp/Multi-dimensional-array b/Lang/Common-Lisp/Multi-dimensional-array new file mode 120000 index 0000000000..37f7ef0979 --- /dev/null +++ b/Lang/Common-Lisp/Multi-dimensional-array @@ -0,0 +1 @@ +../../Task/Multi-dimensional-array/Common-Lisp \ No newline at end of file diff --git a/Lang/Common-Lisp/Quaternion-type b/Lang/Common-Lisp/Quaternion-type deleted file mode 120000 index dd7bafa7e8..0000000000 --- a/Lang/Common-Lisp/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Common-Lisp \ No newline at end of file diff --git a/Lang/Common-Lisp/Substitution-cipher b/Lang/Common-Lisp/Substitution-cipher new file mode 120000 index 0000000000..332d90e9f0 --- /dev/null +++ b/Lang/Common-Lisp/Substitution-cipher @@ -0,0 +1 @@ +../../Task/Substitution-cipher/Common-Lisp \ No newline at end of file diff --git a/Lang/Common-Lisp/Wieferich-primes b/Lang/Common-Lisp/Wieferich-primes new file mode 120000 index 0000000000..91ad6e3ba2 --- /dev/null +++ b/Lang/Common-Lisp/Wieferich-primes @@ -0,0 +1 @@ +../../Task/Wieferich-primes/Common-Lisp \ No newline at end of file diff --git a/Lang/Component-Pascal/00-LANG.txt b/Lang/Component-Pascal/00-LANG.txt index a83cc2b2e7..7056dd922c 100644 --- a/Lang/Component-Pascal/00-LANG.txt +++ b/Lang/Component-Pascal/00-LANG.txt @@ -1,4 +1,11 @@ {{language|Component Pascal}}'''Component Pascal''' is a programming language in the tradition of Oberon and [[Oberon-2]], the last language Niklaus Wirth designed before he retired in 1999. It bears the name of the [[Pascal]] programming language but is incompatible with it. Instead, it is a minor variant and refinement of Oberon-2, designed and supported by a small ETH Zürich spin-off company called Oberon microsystems. Their [[IDE]] is called BlackBox Component Builder. At the time the first version was released (1994) it presented a novel approach to graphical user interface ([[GUI]]) construction based on editable forms, where fields and command buttons are linked to exported variables and executable procedures. This approach bears some similarity to the code-behind way used in [[Microsoft]]'s [[.NET]] 3.0 to access code in XAML. ==Citations== -* [http://en.wikipedia.org/wiki/Component_Pascal Wikipedia:Component Pascal] \ No newline at end of file +* [http://en.wikipedia.org/wiki/Component_Pascal Wikipedia:Component Pascal] + +===See also=== +* [[Oberon-07]] +* [[Oberon-2]] +* [[Zonnon]] +* [[Modula-2]] +* [[Modula-3]] \ No newline at end of file diff --git a/Lang/Component-Pascal/100-doors b/Lang/Component-Pascal/100-doors deleted file mode 120000 index 76b023254e..0000000000 --- a/Lang/Component-Pascal/100-doors +++ /dev/null @@ -1 +0,0 @@ -../../Task/100-doors/Component-Pascal \ No newline at end of file diff --git a/Lang/Component-Pascal/Sorting-algorithms-Merge-sort b/Lang/Component-Pascal/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..9050341ad6 --- /dev/null +++ b/Lang/Component-Pascal/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/Component-Pascal \ No newline at end of file diff --git a/Lang/Computer-zero-Assembly/00-LANG.txt b/Lang/Computer-zero-Assembly/00-LANG.txt index e6ea975211..779b92356f 100644 --- a/Lang/Computer-zero-Assembly/00-LANG.txt +++ b/Lang/Computer-zero-Assembly/00-LANG.txt @@ -19,10 +19,10 @@ There are only 32 bytes of memory, and this includes your program code, leaving ==Self-Modifying Code== With such little RAM available, the biggest tool we have at our disposal for programming is self-modifying code. The CPU makes no distinction between data and instructions, and as such we can store values into memory before that memory is executed, in order to change what the computer will do. Here's an example: -LDA 4 +LDA 4 STA 2 ADD 3 STP -SUB 3 +SUB 3 The above snippet of code never actually ADDs anything, since that instruction gets overwritten by SUB 3. And what is SUB 3 subtracting? It's subtracting the value of STP, which can be encoded as any number between 0xE0 and 0xFF. Specifically, the encoding of SUB 3 (i.e. 0b10000011) is decreased by some value between 0xE0 and 0xFF, and since all arithmetic on this CPU is modulo 256 (as is standard for nearly all 8-bit CPUs), there will be roll-over across the FF-00 boundary. Without a hardware carry flag, however, it's difficult to track this overflow. \ No newline at end of file diff --git a/Lang/Convex/00-LANG.txt b/Lang/Convex/00-LANG.txt new file mode 100644 index 0000000000..6676f23dde --- /dev/null +++ b/Lang/Convex/00-LANG.txt @@ -0,0 +1,6 @@ +Convex is a stack-based golfing esolang based on Golfscript and CJam. + +{{language|site=https://github.com/ZekNikZ/Convex}} + +{{try|Convex|[https://tio.run/#convex Try Convex on tio.run].}} +{{language_programming_paradigm|Concatenative}} \ No newline at end of file diff --git a/Lang/Convex/00-META.yaml b/Lang/Convex/00-META.yaml new file mode 100644 index 0000000000..b10fffa83e --- /dev/null +++ b/Lang/Convex/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Convex diff --git a/Lang/Coq/00-LANG.txt b/Lang/Coq/00-LANG.txt index 3a03214cba..dac9774672 100644 --- a/Lang/Coq/00-LANG.txt +++ b/Lang/Coq/00-LANG.txt @@ -1,9 +1 @@ -{{language|Coq -|site=http://coq.inria.fr -}} -In computer science, Coq is a proof assistant application. It allows the expression of mathematical assertions, mechanically checks proofs of these assertions, helps to find formal proofs, and extracts a certified program from the constructive proof of its formal specification. Coq works within the theory of the calculus of inductive constructions, a derivative of the calculus of constructions. Coq is not an automated [[wp:Theorem_prover|theorem prover]] but includes automatic theorem proving tactics and various decision procedures. - -==Citations== -* [[wp:Coq|Coq]] - -[[Category:Mathematical programming languages]] \ No newline at end of file +#REDIRECT [[:Category:Rocq]] \ No newline at end of file diff --git a/Lang/Coq/100-doors b/Lang/Coq/100-doors deleted file mode 120000 index fd39f903ef..0000000000 --- a/Lang/Coq/100-doors +++ /dev/null @@ -1 +0,0 @@ -../../Task/100-doors/Coq \ No newline at end of file diff --git a/Lang/Coq/Ackermann-function b/Lang/Coq/Ackermann-function deleted file mode 120000 index 03a0752c76..0000000000 --- a/Lang/Coq/Ackermann-function +++ /dev/null @@ -1 +0,0 @@ -../../Task/Ackermann-function/Coq \ No newline at end of file diff --git a/Lang/Coq/Extend-your-language b/Lang/Coq/Extend-your-language deleted file mode 120000 index 2e717c1027..0000000000 --- a/Lang/Coq/Extend-your-language +++ /dev/null @@ -1 +0,0 @@ -../../Task/Extend-your-language/Coq \ No newline at end of file diff --git a/Lang/Coq/Factorial b/Lang/Coq/Factorial deleted file mode 120000 index 3d35ebeb5f..0000000000 --- a/Lang/Coq/Factorial +++ /dev/null @@ -1 +0,0 @@ -../../Task/Factorial/Coq \ No newline at end of file diff --git a/Lang/Coq/Fibonacci-sequence b/Lang/Coq/Fibonacci-sequence deleted file mode 120000 index fc6d7d958a..0000000000 --- a/Lang/Coq/Fibonacci-sequence +++ /dev/null @@ -1 +0,0 @@ -../../Task/Fibonacci-sequence/Coq \ No newline at end of file diff --git a/Lang/Coq/FizzBuzz b/Lang/Coq/FizzBuzz deleted file mode 120000 index 966d79dca5..0000000000 --- a/Lang/Coq/FizzBuzz +++ /dev/null @@ -1 +0,0 @@ -../../Task/FizzBuzz/Coq \ No newline at end of file diff --git a/Lang/Coq/Hello-world-Newbie b/Lang/Coq/Hello-world-Newbie deleted file mode 120000 index 53590d7473..0000000000 --- a/Lang/Coq/Hello-world-Newbie +++ /dev/null @@ -1 +0,0 @@ -../../Task/Hello-world-Newbie/Coq \ No newline at end of file diff --git a/Lang/Coq/Hello-world-Text b/Lang/Coq/Hello-world-Text deleted file mode 120000 index 194b2d17df..0000000000 --- a/Lang/Coq/Hello-world-Text +++ /dev/null @@ -1 +0,0 @@ -../../Task/Hello-world-Text/Coq \ No newline at end of file diff --git a/Lang/Coq/Loops-For b/Lang/Coq/Loops-For deleted file mode 120000 index b1341b994c..0000000000 --- a/Lang/Coq/Loops-For +++ /dev/null @@ -1 +0,0 @@ -../../Task/Loops-For/Coq \ No newline at end of file diff --git a/Lang/Coq/Tree-traversal b/Lang/Coq/Tree-traversal deleted file mode 120000 index e38e9a0bdd..0000000000 --- a/Lang/Coq/Tree-traversal +++ /dev/null @@ -1 +0,0 @@ -../../Task/Tree-traversal/Coq \ No newline at end of file diff --git a/Lang/Coq/Variadic-function b/Lang/Coq/Variadic-function deleted file mode 120000 index 391626fb92..0000000000 --- a/Lang/Coq/Variadic-function +++ /dev/null @@ -1 +0,0 @@ -../../Task/Variadic-function/Coq \ No newline at end of file diff --git a/Lang/Cowgol/Align-columns b/Lang/Cowgol/Align-columns new file mode 120000 index 0000000000..2931644d20 --- /dev/null +++ b/Lang/Cowgol/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Cowgol \ No newline at end of file diff --git a/Lang/Cowgol/Arithmetic-derivative b/Lang/Cowgol/Arithmetic-derivative new file mode 120000 index 0000000000..5d9cc4afd2 --- /dev/null +++ b/Lang/Cowgol/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Cowgol \ No newline at end of file diff --git a/Lang/Cowgol/Arithmetic-numbers b/Lang/Cowgol/Arithmetic-numbers new file mode 120000 index 0000000000..ad116dfe9f --- /dev/null +++ b/Lang/Cowgol/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/Cowgol \ No newline at end of file diff --git a/Lang/Cowgol/Compound-data-type b/Lang/Cowgol/Compound-data-type new file mode 120000 index 0000000000..f242ef8856 --- /dev/null +++ b/Lang/Cowgol/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Cowgol \ No newline at end of file diff --git a/Lang/Cowgol/Display-a-linear-combination b/Lang/Cowgol/Display-a-linear-combination new file mode 120000 index 0000000000..7e169cd6fe --- /dev/null +++ b/Lang/Cowgol/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/Cowgol \ No newline at end of file diff --git a/Lang/Cowgol/Longest-common-substring b/Lang/Cowgol/Longest-common-substring new file mode 120000 index 0000000000..219b75f317 --- /dev/null +++ b/Lang/Cowgol/Longest-common-substring @@ -0,0 +1 @@ +../../Task/Longest-common-substring/Cowgol \ No newline at end of file diff --git a/Lang/Cowgol/Move-to-front-algorithm b/Lang/Cowgol/Move-to-front-algorithm new file mode 120000 index 0000000000..137327f2ab --- /dev/null +++ b/Lang/Cowgol/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/Cowgol \ No newline at end of file diff --git a/Lang/Cowgol/Multifactorial b/Lang/Cowgol/Multifactorial new file mode 120000 index 0000000000..c8a5e64301 --- /dev/null +++ b/Lang/Cowgol/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/Cowgol \ No newline at end of file diff --git a/Lang/Cowgol/Narcissistic-decimal-number b/Lang/Cowgol/Narcissistic-decimal-number new file mode 120000 index 0000000000..3ff09189b6 --- /dev/null +++ b/Lang/Cowgol/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/Cowgol \ No newline at end of file diff --git a/Lang/Cowgol/Partition-an-integer-x-into-n-primes b/Lang/Cowgol/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..77d202dd2c --- /dev/null +++ b/Lang/Cowgol/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/Cowgol \ No newline at end of file diff --git a/Lang/Cowgol/UTF-8-encode-and-decode b/Lang/Cowgol/UTF-8-encode-and-decode new file mode 120000 index 0000000000..93ae70053a --- /dev/null +++ b/Lang/Cowgol/UTF-8-encode-and-decode @@ -0,0 +1 @@ +../../Task/UTF-8-encode-and-decode/Cowgol \ No newline at end of file diff --git a/Lang/Crystal/00-LANG.txt b/Lang/Crystal/00-LANG.txt index b671a267bf..2d48345f43 100644 --- a/Lang/Crystal/00-LANG.txt +++ b/Lang/Crystal/00-LANG.txt @@ -6,7 +6,8 @@ |strength=strong |checking=static |compat=duck -|site=http://crystal-lang.org}} +|site=http://crystal-lang.org +|hopl=no, HOPL only has an older "Crystal" language from 1986}} Crystal is a programming language with the following goals: * Have the same syntax as Ruby, or at least as similar as possible. * Never have to specify the type of a variable or method argument. @@ -14,4 +15,7 @@ Crystal is a programming language with the following goals: * Have compile-time evaluation and generation of code, to avoid boilerplate code. * Compile to efficient native code. -You can ask for help on Freenode in the #crystal-lang channel. \ No newline at end of file +You can ask for help on LiberaChat in the [ircs://irc.libera.chat:6697#crystal-lang #crystal-lang] channel ([https://web.libera.chat/#crystal-lang web]). + +==Tasks not implemented in Crystal== +[[Tasks not implemented in Crystal]] \ No newline at end of file diff --git a/Lang/Crystal/ABC-problem b/Lang/Crystal/ABC-problem new file mode 120000 index 0000000000..4ebb385d2c --- /dev/null +++ b/Lang/Crystal/ABC-problem @@ -0,0 +1 @@ +../../Task/ABC-problem/Crystal \ No newline at end of file diff --git a/Lang/Crystal/ADFGVX-cipher b/Lang/Crystal/ADFGVX-cipher new file mode 120000 index 0000000000..20d511e75f --- /dev/null +++ b/Lang/Crystal/ADFGVX-cipher @@ -0,0 +1 @@ +../../Task/ADFGVX-cipher/Crystal \ No newline at end of file diff --git a/Lang/Crystal/ASCII-art-diagram-converter b/Lang/Crystal/ASCII-art-diagram-converter new file mode 120000 index 0000000000..0f1238b276 --- /dev/null +++ b/Lang/Crystal/ASCII-art-diagram-converter @@ -0,0 +1 @@ +../../Task/ASCII-art-diagram-converter/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Abbreviations-automatic b/Lang/Crystal/Abbreviations-automatic new file mode 120000 index 0000000000..356658ce4c --- /dev/null +++ b/Lang/Crystal/Abbreviations-automatic @@ -0,0 +1 @@ +../../Task/Abbreviations-automatic/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Abbreviations-easy b/Lang/Crystal/Abbreviations-easy new file mode 120000 index 0000000000..b3a87e7119 --- /dev/null +++ b/Lang/Crystal/Abbreviations-easy @@ -0,0 +1 @@ +../../Task/Abbreviations-easy/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Abelian-sandpile-model b/Lang/Crystal/Abelian-sandpile-model new file mode 120000 index 0000000000..8c440adf10 --- /dev/null +++ b/Lang/Crystal/Abelian-sandpile-model @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Abelian-sandpile-model-Identity b/Lang/Crystal/Abelian-sandpile-model-Identity new file mode 120000 index 0000000000..ad1df3a714 --- /dev/null +++ b/Lang/Crystal/Abelian-sandpile-model-Identity @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model-Identity/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Abundant-deficient-and-perfect-number-classifications b/Lang/Crystal/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..7cba469c21 --- /dev/null +++ b/Lang/Crystal/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Abundant-odd-numbers b/Lang/Crystal/Abundant-odd-numbers new file mode 120000 index 0000000000..3676d5a336 --- /dev/null +++ b/Lang/Crystal/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Achilles-numbers b/Lang/Crystal/Achilles-numbers new file mode 120000 index 0000000000..baac6a0487 --- /dev/null +++ b/Lang/Crystal/Achilles-numbers @@ -0,0 +1 @@ +../../Task/Achilles-numbers/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Add-a-variable-to-a-class-instance-at-runtime b/Lang/Crystal/Add-a-variable-to-a-class-instance-at-runtime new file mode 120000 index 0000000000..7c0d033962 --- /dev/null +++ b/Lang/Crystal/Add-a-variable-to-a-class-instance-at-runtime @@ -0,0 +1 @@ +../../Task/Add-a-variable-to-a-class-instance-at-runtime/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Address-of-a-variable b/Lang/Crystal/Address-of-a-variable new file mode 120000 index 0000000000..55aa429a76 --- /dev/null +++ b/Lang/Crystal/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Align-columns b/Lang/Crystal/Align-columns new file mode 120000 index 0000000000..2ab766781e --- /dev/null +++ b/Lang/Crystal/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Aliquot-sequence-classifications b/Lang/Crystal/Aliquot-sequence-classifications new file mode 120000 index 0000000000..7453e5fb67 --- /dev/null +++ b/Lang/Crystal/Aliquot-sequence-classifications @@ -0,0 +1 @@ +../../Task/Aliquot-sequence-classifications/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Almost-prime b/Lang/Crystal/Almost-prime new file mode 120000 index 0000000000..782486465b --- /dev/null +++ b/Lang/Crystal/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Amb b/Lang/Crystal/Amb new file mode 120000 index 0000000000..31a9ff96ef --- /dev/null +++ b/Lang/Crystal/Amb @@ -0,0 +1 @@ +../../Task/Amb/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Anagrams-Deranged-anagrams b/Lang/Crystal/Anagrams-Deranged-anagrams new file mode 120000 index 0000000000..01826ee4a9 --- /dev/null +++ b/Lang/Crystal/Anagrams-Deranged-anagrams @@ -0,0 +1 @@ +../../Task/Anagrams-Deranged-anagrams/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Angle-difference-between-two-bearings b/Lang/Crystal/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..80eb3d6093 --- /dev/null +++ b/Lang/Crystal/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Angles-geometric-normalization-and-conversion b/Lang/Crystal/Angles-geometric-normalization-and-conversion new file mode 120000 index 0000000000..a07d6f6045 --- /dev/null +++ b/Lang/Crystal/Angles-geometric-normalization-and-conversion @@ -0,0 +1 @@ +../../Task/Angles-geometric-normalization-and-conversion/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Anonymous-recursion b/Lang/Crystal/Anonymous-recursion new file mode 120000 index 0000000000..8266f214bc --- /dev/null +++ b/Lang/Crystal/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Append-a-record-to-the-end-of-a-text-file b/Lang/Crystal/Append-a-record-to-the-end-of-a-text-file new file mode 120000 index 0000000000..2a2afc8f9c --- /dev/null +++ b/Lang/Crystal/Append-a-record-to-the-end-of-a-text-file @@ -0,0 +1 @@ +../../Task/Append-a-record-to-the-end-of-a-text-file/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Apply-a-digital-filter-direct-form-II-transposed- b/Lang/Crystal/Apply-a-digital-filter-direct-form-II-transposed- new file mode 120000 index 0000000000..4772cfa6a5 --- /dev/null +++ b/Lang/Crystal/Apply-a-digital-filter-direct-form-II-transposed- @@ -0,0 +1 @@ +../../Task/Apply-a-digital-filter-direct-form-II-transposed-/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Approximate-equality b/Lang/Crystal/Approximate-equality new file mode 120000 index 0000000000..f45d53cb9c --- /dev/null +++ b/Lang/Crystal/Approximate-equality @@ -0,0 +1 @@ +../../Task/Approximate-equality/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Archimedean-spiral b/Lang/Crystal/Archimedean-spiral new file mode 120000 index 0000000000..38cdafc563 --- /dev/null +++ b/Lang/Crystal/Archimedean-spiral @@ -0,0 +1 @@ +../../Task/Archimedean-spiral/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Arithmetic-Complex b/Lang/Crystal/Arithmetic-Complex new file mode 120000 index 0000000000..db70676449 --- /dev/null +++ b/Lang/Crystal/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Arithmetic-Rational b/Lang/Crystal/Arithmetic-Rational new file mode 120000 index 0000000000..9934cb69b5 --- /dev/null +++ b/Lang/Crystal/Arithmetic-Rational @@ -0,0 +1 @@ +../../Task/Arithmetic-Rational/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Arithmetic-derivative b/Lang/Crystal/Arithmetic-derivative new file mode 120000 index 0000000000..afe551091f --- /dev/null +++ b/Lang/Crystal/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Arithmetic-evaluation b/Lang/Crystal/Arithmetic-evaluation new file mode 120000 index 0000000000..cefbf4e2d9 --- /dev/null +++ b/Lang/Crystal/Arithmetic-evaluation @@ -0,0 +1 @@ +../../Task/Arithmetic-evaluation/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Arithmetic-geometric-mean b/Lang/Crystal/Arithmetic-geometric-mean new file mode 120000 index 0000000000..c8754aa805 --- /dev/null +++ b/Lang/Crystal/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Arithmetic-geometric-mean-Calculate-Pi b/Lang/Crystal/Arithmetic-geometric-mean-Calculate-Pi new file mode 120000 index 0000000000..b641674514 --- /dev/null +++ b/Lang/Crystal/Arithmetic-geometric-mean-Calculate-Pi @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean-Calculate-Pi/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Arithmetic-numbers b/Lang/Crystal/Arithmetic-numbers new file mode 120000 index 0000000000..a07126fc36 --- /dev/null +++ b/Lang/Crystal/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Ascending-primes b/Lang/Crystal/Ascending-primes new file mode 120000 index 0000000000..159e1b5bed --- /dev/null +++ b/Lang/Crystal/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Atomic-updates b/Lang/Crystal/Atomic-updates new file mode 120000 index 0000000000..332b197fee --- /dev/null +++ b/Lang/Crystal/Atomic-updates @@ -0,0 +1 @@ +../../Task/Atomic-updates/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Attractive-numbers b/Lang/Crystal/Attractive-numbers new file mode 120000 index 0000000000..04e80138ee --- /dev/null +++ b/Lang/Crystal/Attractive-numbers @@ -0,0 +1 @@ +../../Task/Attractive-numbers/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Average-loop-length b/Lang/Crystal/Average-loop-length new file mode 120000 index 0000000000..06beee4e14 --- /dev/null +++ b/Lang/Crystal/Average-loop-length @@ -0,0 +1 @@ +../../Task/Average-loop-length/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Averages-Mean-angle b/Lang/Crystal/Averages-Mean-angle new file mode 120000 index 0000000000..8e548785b0 --- /dev/null +++ b/Lang/Crystal/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Averages-Mean-time-of-day b/Lang/Crystal/Averages-Mean-time-of-day new file mode 120000 index 0000000000..4952b673eb --- /dev/null +++ b/Lang/Crystal/Averages-Mean-time-of-day @@ -0,0 +1 @@ +../../Task/Averages-Mean-time-of-day/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Averages-Mode b/Lang/Crystal/Averages-Mode new file mode 120000 index 0000000000..bb15fa305b --- /dev/null +++ b/Lang/Crystal/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Averages-Pythagorean-means b/Lang/Crystal/Averages-Pythagorean-means new file mode 120000 index 0000000000..a97d5df819 --- /dev/null +++ b/Lang/Crystal/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Babbage-problem b/Lang/Crystal/Babbage-problem new file mode 120000 index 0000000000..7e1cc42ea8 --- /dev/null +++ b/Lang/Crystal/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Babylonian-spiral b/Lang/Crystal/Babylonian-spiral new file mode 120000 index 0000000000..7478d85b07 --- /dev/null +++ b/Lang/Crystal/Babylonian-spiral @@ -0,0 +1 @@ +../../Task/Babylonian-spiral/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Bell-numbers b/Lang/Crystal/Bell-numbers new file mode 120000 index 0000000000..3f05e224a6 --- /dev/null +++ b/Lang/Crystal/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Bifid-cipher b/Lang/Crystal/Bifid-cipher new file mode 120000 index 0000000000..6b07c1520e --- /dev/null +++ b/Lang/Crystal/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Bin-given-limits b/Lang/Crystal/Bin-given-limits new file mode 120000 index 0000000000..40a049c833 --- /dev/null +++ b/Lang/Crystal/Bin-given-limits @@ -0,0 +1 @@ +../../Task/Bin-given-limits/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Bioinformatics-Global-alignment b/Lang/Crystal/Bioinformatics-Global-alignment new file mode 120000 index 0000000000..b8310a94b2 --- /dev/null +++ b/Lang/Crystal/Bioinformatics-Global-alignment @@ -0,0 +1 @@ +../../Task/Bioinformatics-Global-alignment/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Biorhythms b/Lang/Crystal/Biorhythms new file mode 120000 index 0000000000..adde97b4c1 --- /dev/null +++ b/Lang/Crystal/Biorhythms @@ -0,0 +1 @@ +../../Task/Biorhythms/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Bitmap-Bresenhams-line-algorithm b/Lang/Crystal/Bitmap-Bresenhams-line-algorithm new file mode 120000 index 0000000000..680f0b15d0 --- /dev/null +++ b/Lang/Crystal/Bitmap-Bresenhams-line-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Bresenhams-line-algorithm/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Bitmap-Flood-fill b/Lang/Crystal/Bitmap-Flood-fill new file mode 120000 index 0000000000..82f2b7e4ae --- /dev/null +++ b/Lang/Crystal/Bitmap-Flood-fill @@ -0,0 +1 @@ +../../Task/Bitmap-Flood-fill/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Bitmap-Midpoint-circle-algorithm b/Lang/Crystal/Bitmap-Midpoint-circle-algorithm new file mode 120000 index 0000000000..fd45ea7903 --- /dev/null +++ b/Lang/Crystal/Bitmap-Midpoint-circle-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Midpoint-circle-algorithm/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Bitmap-Read-a-PPM-file b/Lang/Crystal/Bitmap-Read-a-PPM-file new file mode 120000 index 0000000000..72567511a0 --- /dev/null +++ b/Lang/Crystal/Bitmap-Read-a-PPM-file @@ -0,0 +1 @@ +../../Task/Bitmap-Read-a-PPM-file/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Bitmap-Write-a-PPM-file b/Lang/Crystal/Bitmap-Write-a-PPM-file new file mode 120000 index 0000000000..86ca9711aa --- /dev/null +++ b/Lang/Crystal/Bitmap-Write-a-PPM-file @@ -0,0 +1 @@ +../../Task/Bitmap-Write-a-PPM-file/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Bitwise-operations b/Lang/Crystal/Bitwise-operations new file mode 120000 index 0000000000..1a5350f2cc --- /dev/null +++ b/Lang/Crystal/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Crystal \ No newline at end of file diff --git a/Lang/Crystal/CUSIP b/Lang/Crystal/CUSIP new file mode 120000 index 0000000000..b88441138f --- /dev/null +++ b/Lang/Crystal/CUSIP @@ -0,0 +1 @@ +../../Task/CUSIP/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Camel-case-and-snake-case b/Lang/Crystal/Camel-case-and-snake-case new file mode 120000 index 0000000000..04ca76eb1a --- /dev/null +++ b/Lang/Crystal/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Catamorphism b/Lang/Crystal/Catamorphism new file mode 120000 index 0000000000..59ec253ef2 --- /dev/null +++ b/Lang/Crystal/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Chaocipher b/Lang/Crystal/Chaocipher new file mode 120000 index 0000000000..b200ad768f --- /dev/null +++ b/Lang/Crystal/Chaocipher @@ -0,0 +1 @@ +../../Task/Chaocipher/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Character-codes b/Lang/Crystal/Character-codes new file mode 120000 index 0000000000..bd4879b77c --- /dev/null +++ b/Lang/Crystal/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Cistercian-numerals b/Lang/Crystal/Cistercian-numerals new file mode 120000 index 0000000000..b439a8a963 --- /dev/null +++ b/Lang/Crystal/Cistercian-numerals @@ -0,0 +1 @@ +../../Task/Cistercian-numerals/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Closures-Value-capture b/Lang/Crystal/Closures-Value-capture new file mode 120000 index 0000000000..f3038be393 --- /dev/null +++ b/Lang/Crystal/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Color-wheel b/Lang/Crystal/Color-wheel new file mode 120000 index 0000000000..b0d2a4f84a --- /dev/null +++ b/Lang/Crystal/Color-wheel @@ -0,0 +1 @@ +../../Task/Color-wheel/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Colour-bars-Display b/Lang/Crystal/Colour-bars-Display new file mode 120000 index 0000000000..0ec7f62738 --- /dev/null +++ b/Lang/Crystal/Colour-bars-Display @@ -0,0 +1 @@ +../../Task/Colour-bars-Display/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Comma-quibbling b/Lang/Crystal/Comma-quibbling new file mode 120000 index 0000000000..3151a9c58f --- /dev/null +++ b/Lang/Crystal/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Compare-a-list-of-strings b/Lang/Crystal/Compare-a-list-of-strings new file mode 120000 index 0000000000..f978784371 --- /dev/null +++ b/Lang/Crystal/Compare-a-list-of-strings @@ -0,0 +1 @@ +../../Task/Compare-a-list-of-strings/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Compile-time-calculation b/Lang/Crystal/Compile-time-calculation new file mode 120000 index 0000000000..306dfbb009 --- /dev/null +++ b/Lang/Crystal/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Consecutive-primes-with-ascending-or-descending-differences b/Lang/Crystal/Consecutive-primes-with-ascending-or-descending-differences new file mode 120000 index 0000000000..697e7e52cd --- /dev/null +++ b/Lang/Crystal/Consecutive-primes-with-ascending-or-descending-differences @@ -0,0 +1 @@ +../../Task/Consecutive-primes-with-ascending-or-descending-differences/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Convert-seconds-to-compound-duration b/Lang/Crystal/Convert-seconds-to-compound-duration new file mode 120000 index 0000000000..313254bee3 --- /dev/null +++ b/Lang/Crystal/Convert-seconds-to-compound-duration @@ -0,0 +1 @@ +../../Task/Convert-seconds-to-compound-duration/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Count-occurrences-of-a-substring b/Lang/Crystal/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..f235e95129 --- /dev/null +++ b/Lang/Crystal/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Cullen-and-Woodall-numbers b/Lang/Crystal/Cullen-and-Woodall-numbers new file mode 120000 index 0000000000..62ef13cd07 --- /dev/null +++ b/Lang/Crystal/Cullen-and-Woodall-numbers @@ -0,0 +1 @@ +../../Task/Cullen-and-Woodall-numbers/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Currency b/Lang/Crystal/Currency new file mode 120000 index 0000000000..275fd9dcb2 --- /dev/null +++ b/Lang/Crystal/Currency @@ -0,0 +1 @@ +../../Task/Currency/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Day-of-the-week b/Lang/Crystal/Day-of-the-week new file mode 120000 index 0000000000..0f98ad94ee --- /dev/null +++ b/Lang/Crystal/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Department-numbers b/Lang/Crystal/Department-numbers new file mode 120000 index 0000000000..1e36b398e9 --- /dev/null +++ b/Lang/Crystal/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Detect-division-by-zero b/Lang/Crystal/Detect-division-by-zero new file mode 120000 index 0000000000..d23bedf4f0 --- /dev/null +++ b/Lang/Crystal/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Determine-if-a-string-has-all-the-same-characters b/Lang/Crystal/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..a0bef4d19a --- /dev/null +++ b/Lang/Crystal/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Determine-if-a-string-is-collapsible b/Lang/Crystal/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..7e2d57c2cb --- /dev/null +++ b/Lang/Crystal/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Determine-if-a-string-is-numeric b/Lang/Crystal/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..907fa1cc6f --- /dev/null +++ b/Lang/Crystal/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Determine-sentence-type b/Lang/Crystal/Determine-sentence-type new file mode 120000 index 0000000000..95914c2896 --- /dev/null +++ b/Lang/Crystal/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Digital-root-Multiplicative-digital-root b/Lang/Crystal/Digital-root-Multiplicative-digital-root new file mode 120000 index 0000000000..92366c8b32 --- /dev/null +++ b/Lang/Crystal/Digital-root-Multiplicative-digital-root @@ -0,0 +1 @@ +../../Task/Digital-root-Multiplicative-digital-root/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Dijkstras-algorithm b/Lang/Crystal/Dijkstras-algorithm new file mode 120000 index 0000000000..829bbaa132 --- /dev/null +++ b/Lang/Crystal/Dijkstras-algorithm @@ -0,0 +1 @@ +../../Task/Dijkstras-algorithm/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Diversity-prediction-theorem b/Lang/Crystal/Diversity-prediction-theorem new file mode 120000 index 0000000000..bfb6463f86 --- /dev/null +++ b/Lang/Crystal/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Dutch-national-flag-problem b/Lang/Crystal/Dutch-national-flag-problem new file mode 120000 index 0000000000..a920e0b89a --- /dev/null +++ b/Lang/Crystal/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Egyptian-division b/Lang/Crystal/Egyptian-division new file mode 120000 index 0000000000..6766caec22 --- /dev/null +++ b/Lang/Crystal/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Elementary-cellular-automaton b/Lang/Crystal/Elementary-cellular-automaton new file mode 120000 index 0000000000..a397b94a1b --- /dev/null +++ b/Lang/Crystal/Elementary-cellular-automaton @@ -0,0 +1 @@ +../../Task/Elementary-cellular-automaton/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Elementary-cellular-automaton-Random-number-generator b/Lang/Crystal/Elementary-cellular-automaton-Random-number-generator new file mode 120000 index 0000000000..6d743a5fc8 --- /dev/null +++ b/Lang/Crystal/Elementary-cellular-automaton-Random-number-generator @@ -0,0 +1 @@ +../../Task/Elementary-cellular-automaton-Random-number-generator/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Emirp-primes b/Lang/Crystal/Emirp-primes new file mode 120000 index 0000000000..6a762271db --- /dev/null +++ b/Lang/Crystal/Emirp-primes @@ -0,0 +1 @@ +../../Task/Emirp-primes/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Empty-program b/Lang/Crystal/Empty-program deleted file mode 120000 index 78e7f559d2..0000000000 --- a/Lang/Crystal/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Enumerations b/Lang/Crystal/Enumerations new file mode 120000 index 0000000000..81276f7ab4 --- /dev/null +++ b/Lang/Crystal/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Environment-variables b/Lang/Crystal/Environment-variables new file mode 120000 index 0000000000..17cbcdefee --- /dev/null +++ b/Lang/Crystal/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Equilibrium-index b/Lang/Crystal/Equilibrium-index new file mode 120000 index 0000000000..1125331aa6 --- /dev/null +++ b/Lang/Crystal/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Ethiopian-multiplication b/Lang/Crystal/Ethiopian-multiplication new file mode 120000 index 0000000000..e534df962f --- /dev/null +++ b/Lang/Crystal/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Evolutionary-algorithm b/Lang/Crystal/Evolutionary-algorithm new file mode 120000 index 0000000000..a0bcba6242 --- /dev/null +++ b/Lang/Crystal/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Execute-Brain- b/Lang/Crystal/Execute-Brain- new file mode 120000 index 0000000000..4ffee47edd --- /dev/null +++ b/Lang/Crystal/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Exponentiation-order b/Lang/Crystal/Exponentiation-order new file mode 120000 index 0000000000..e7f6547257 --- /dev/null +++ b/Lang/Crystal/Exponentiation-order @@ -0,0 +1 @@ +../../Task/Exponentiation-order/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Exponentiation-with-infix-operators-in-or-operating-on-the-base b/Lang/Crystal/Exponentiation-with-infix-operators-in-or-operating-on-the-base new file mode 120000 index 0000000000..bea2082efb --- /dev/null +++ b/Lang/Crystal/Exponentiation-with-infix-operators-in-or-operating-on-the-base @@ -0,0 +1 @@ +../../Task/Exponentiation-with-infix-operators-in-or-operating-on-the-base/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Extensible-prime-generator b/Lang/Crystal/Extensible-prime-generator new file mode 120000 index 0000000000..f7e46afa3d --- /dev/null +++ b/Lang/Crystal/Extensible-prime-generator @@ -0,0 +1 @@ +../../Task/Extensible-prime-generator/Crystal \ No newline at end of file diff --git a/Lang/Crystal/File-extension-is-in-extensions-list b/Lang/Crystal/File-extension-is-in-extensions-list new file mode 120000 index 0000000000..d3f5d5ad97 --- /dev/null +++ b/Lang/Crystal/File-extension-is-in-extensions-list @@ -0,0 +1 @@ +../../Task/File-extension-is-in-extensions-list/Crystal \ No newline at end of file diff --git a/Lang/Crystal/File-modification-time b/Lang/Crystal/File-modification-time new file mode 120000 index 0000000000..b3a7e1065d --- /dev/null +++ b/Lang/Crystal/File-modification-time @@ -0,0 +1 @@ +../../Task/File-modification-time/Crystal \ No newline at end of file diff --git a/Lang/Crystal/File-size b/Lang/Crystal/File-size new file mode 120000 index 0000000000..f7ccd8930e --- /dev/null +++ b/Lang/Crystal/File-size @@ -0,0 +1 @@ +../../Task/File-size/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Filter b/Lang/Crystal/Filter new file mode 120000 index 0000000000..13d5962733 --- /dev/null +++ b/Lang/Crystal/Filter @@ -0,0 +1 @@ +../../Task/Filter/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Find-if-a-point-is-within-a-triangle b/Lang/Crystal/Find-if-a-point-is-within-a-triangle new file mode 120000 index 0000000000..a3ff575d32 --- /dev/null +++ b/Lang/Crystal/Find-if-a-point-is-within-a-triangle @@ -0,0 +1 @@ +../../Task/Find-if-a-point-is-within-a-triangle/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Find-the-last-Sunday-of-each-month b/Lang/Crystal/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..b7448c15e3 --- /dev/null +++ b/Lang/Crystal/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/Crystal \ No newline at end of file diff --git a/Lang/Crystal/First-class-functions b/Lang/Crystal/First-class-functions new file mode 120000 index 0000000000..41628a5683 --- /dev/null +++ b/Lang/Crystal/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Five-weekends b/Lang/Crystal/Five-weekends new file mode 120000 index 0000000000..aee26e19f7 --- /dev/null +++ b/Lang/Crystal/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Four-is-magic b/Lang/Crystal/Four-is-magic new file mode 120000 index 0000000000..e56a866dc3 --- /dev/null +++ b/Lang/Crystal/Four-is-magic @@ -0,0 +1 @@ +../../Task/Four-is-magic/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Function-definition b/Lang/Crystal/Function-definition new file mode 120000 index 0000000000..1fac36efe3 --- /dev/null +++ b/Lang/Crystal/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Generate-lower-case-ASCII-alphabet b/Lang/Crystal/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..8b481efdf1 --- /dev/null +++ b/Lang/Crystal/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Generator-Exponential b/Lang/Crystal/Generator-Exponential new file mode 120000 index 0000000000..d9c996b99e --- /dev/null +++ b/Lang/Crystal/Generator-Exponential @@ -0,0 +1 @@ +../../Task/Generator-Exponential/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Get-system-command-output b/Lang/Crystal/Get-system-command-output new file mode 120000 index 0000000000..75fcf73ed6 --- /dev/null +++ b/Lang/Crystal/Get-system-command-output @@ -0,0 +1 @@ +../../Task/Get-system-command-output/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Greatest-common-divisor b/Lang/Crystal/Greatest-common-divisor new file mode 120000 index 0000000000..cac765e22c --- /dev/null +++ b/Lang/Crystal/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Hello-world-Graphical b/Lang/Crystal/Hello-world-Graphical new file mode 120000 index 0000000000..aa3ccec00c --- /dev/null +++ b/Lang/Crystal/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Hello-world-Newline-omission b/Lang/Crystal/Hello-world-Newline-omission new file mode 120000 index 0000000000..cf00f3e8a9 --- /dev/null +++ b/Lang/Crystal/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Hello-world-Standard-error b/Lang/Crystal/Hello-world-Standard-error new file mode 120000 index 0000000000..560e23c97c --- /dev/null +++ b/Lang/Crystal/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Hex-words b/Lang/Crystal/Hex-words new file mode 120000 index 0000000000..1390f8d3e3 --- /dev/null +++ b/Lang/Crystal/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Hofstadter-Q-sequence b/Lang/Crystal/Hofstadter-Q-sequence new file mode 120000 index 0000000000..a856d63c6d --- /dev/null +++ b/Lang/Crystal/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/Crystal \ No newline at end of file diff --git a/Lang/Crystal/ISBN13-check-digit b/Lang/Crystal/ISBN13-check-digit new file mode 120000 index 0000000000..eedbc71ec1 --- /dev/null +++ b/Lang/Crystal/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Idiomatically-determine-all-the-lowercase-and-uppercase-letters b/Lang/Crystal/Idiomatically-determine-all-the-lowercase-and-uppercase-letters new file mode 120000 index 0000000000..9e0f4e23b4 --- /dev/null +++ b/Lang/Crystal/Idiomatically-determine-all-the-lowercase-and-uppercase-letters @@ -0,0 +1 @@ +../../Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Increment-a-numerical-string b/Lang/Crystal/Increment-a-numerical-string new file mode 120000 index 0000000000..aeae95c765 --- /dev/null +++ b/Lang/Crystal/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Input-loop b/Lang/Crystal/Input-loop new file mode 120000 index 0000000000..27bc4f9208 --- /dev/null +++ b/Lang/Crystal/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Integer-comparison b/Lang/Crystal/Integer-comparison new file mode 120000 index 0000000000..1d8d9443a7 --- /dev/null +++ b/Lang/Crystal/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Integer-overflow b/Lang/Crystal/Integer-overflow new file mode 120000 index 0000000000..868816b94b --- /dev/null +++ b/Lang/Crystal/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Interactive-programming-repl- b/Lang/Crystal/Interactive-programming-repl- new file mode 120000 index 0000000000..348f845b57 --- /dev/null +++ b/Lang/Crystal/Interactive-programming-repl- @@ -0,0 +1 @@ +../../Task/Interactive-programming-repl-/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Inverted-syntax b/Lang/Crystal/Inverted-syntax new file mode 120000 index 0000000000..33eb9c0c4b --- /dev/null +++ b/Lang/Crystal/Inverted-syntax @@ -0,0 +1 @@ +../../Task/Inverted-syntax/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Isograms-and-heterograms b/Lang/Crystal/Isograms-and-heterograms new file mode 120000 index 0000000000..46dc26699c --- /dev/null +++ b/Lang/Crystal/Isograms-and-heterograms @@ -0,0 +1 @@ +../../Task/Isograms-and-heterograms/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Isqrt-integer-square-root-of-X b/Lang/Crystal/Isqrt-integer-square-root-of-X new file mode 120000 index 0000000000..d671dd4e29 --- /dev/null +++ b/Lang/Crystal/Isqrt-integer-square-root-of-X @@ -0,0 +1 @@ +../../Task/Isqrt-integer-square-root-of-X/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Jacobsthal-numbers b/Lang/Crystal/Jacobsthal-numbers new file mode 120000 index 0000000000..da4fc1eede --- /dev/null +++ b/Lang/Crystal/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Kernighans-large-earthquake-problem b/Lang/Crystal/Kernighans-large-earthquake-problem new file mode 120000 index 0000000000..d6f60d2a2c --- /dev/null +++ b/Lang/Crystal/Kernighans-large-earthquake-problem @@ -0,0 +1 @@ +../../Task/Kernighans-large-earthquake-problem/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Knuths-algorithm-S b/Lang/Crystal/Knuths-algorithm-S new file mode 120000 index 0000000000..fbde0f33c9 --- /dev/null +++ b/Lang/Crystal/Knuths-algorithm-S @@ -0,0 +1 @@ +../../Task/Knuths-algorithm-S/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Langtons-ant b/Lang/Crystal/Langtons-ant new file mode 120000 index 0000000000..accd634e59 --- /dev/null +++ b/Lang/Crystal/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Last-Friday-of-each-month b/Lang/Crystal/Last-Friday-of-each-month new file mode 120000 index 0000000000..5dd6eb4e30 --- /dev/null +++ b/Lang/Crystal/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Least-common-multiple b/Lang/Crystal/Least-common-multiple new file mode 120000 index 0000000000..ab85fbea40 --- /dev/null +++ b/Lang/Crystal/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Letter-frequency b/Lang/Crystal/Letter-frequency new file mode 120000 index 0000000000..9aed428d1c --- /dev/null +++ b/Lang/Crystal/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Logical-operations b/Lang/Crystal/Logical-operations new file mode 120000 index 0000000000..efa5e278dd --- /dev/null +++ b/Lang/Crystal/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Logistic-curve-fitting-in-epidemiology b/Lang/Crystal/Logistic-curve-fitting-in-epidemiology new file mode 120000 index 0000000000..c8d098d82a --- /dev/null +++ b/Lang/Crystal/Logistic-curve-fitting-in-epidemiology @@ -0,0 +1 @@ +../../Task/Logistic-curve-fitting-in-epidemiology/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Long-year b/Lang/Crystal/Long-year new file mode 120000 index 0000000000..2a978e84d7 --- /dev/null +++ b/Lang/Crystal/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Longest-string-challenge b/Lang/Crystal/Longest-string-challenge new file mode 120000 index 0000000000..8a9ac3dfd0 --- /dev/null +++ b/Lang/Crystal/Longest-string-challenge @@ -0,0 +1 @@ +../../Task/Longest-string-challenge/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Loops-Do-while b/Lang/Crystal/Loops-Do-while new file mode 120000 index 0000000000..16d73545fb --- /dev/null +++ b/Lang/Crystal/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Loops-Foreach b/Lang/Crystal/Loops-Foreach new file mode 120000 index 0000000000..c20a1c8c2c --- /dev/null +++ b/Lang/Crystal/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Loops-N-plus-one-half b/Lang/Crystal/Loops-N-plus-one-half new file mode 120000 index 0000000000..baee612204 --- /dev/null +++ b/Lang/Crystal/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Loops-With-multiple-ranges b/Lang/Crystal/Loops-With-multiple-ranges new file mode 120000 index 0000000000..a0c34f1c73 --- /dev/null +++ b/Lang/Crystal/Loops-With-multiple-ranges @@ -0,0 +1 @@ +../../Task/Loops-With-multiple-ranges/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Loops-Wrong-ranges b/Lang/Crystal/Loops-Wrong-ranges new file mode 120000 index 0000000000..402c2c3d6b --- /dev/null +++ b/Lang/Crystal/Loops-Wrong-ranges @@ -0,0 +1 @@ +../../Task/Loops-Wrong-ranges/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Magic-8-ball b/Lang/Crystal/Magic-8-ball new file mode 120000 index 0000000000..7694de9dbd --- /dev/null +++ b/Lang/Crystal/Magic-8-ball @@ -0,0 +1 @@ +../../Task/Magic-8-ball/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Magnanimous-numbers b/Lang/Crystal/Magnanimous-numbers new file mode 120000 index 0000000000..f025f31b2f --- /dev/null +++ b/Lang/Crystal/Magnanimous-numbers @@ -0,0 +1 @@ +../../Task/Magnanimous-numbers/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Map-range b/Lang/Crystal/Map-range new file mode 120000 index 0000000000..2ce80c8e32 --- /dev/null +++ b/Lang/Crystal/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Middle-three-digits b/Lang/Crystal/Middle-three-digits new file mode 120000 index 0000000000..c195484a68 --- /dev/null +++ b/Lang/Crystal/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Miller-Rabin-primality-test b/Lang/Crystal/Miller-Rabin-primality-test deleted file mode 120000 index 3714050251..0000000000 --- a/Lang/Crystal/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Move-to-front-algorithm b/Lang/Crystal/Move-to-front-algorithm new file mode 120000 index 0000000000..1fc15ab4a7 --- /dev/null +++ b/Lang/Crystal/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Narcissistic-decimal-number b/Lang/Crystal/Narcissistic-decimal-number new file mode 120000 index 0000000000..7713050610 --- /dev/null +++ b/Lang/Crystal/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Nested-function b/Lang/Crystal/Nested-function new file mode 120000 index 0000000000..4453485348 --- /dev/null +++ b/Lang/Crystal/Nested-function @@ -0,0 +1 @@ +../../Task/Nested-function/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Non-decimal-radices-Convert b/Lang/Crystal/Non-decimal-radices-Convert new file mode 120000 index 0000000000..342df0f845 --- /dev/null +++ b/Lang/Crystal/Non-decimal-radices-Convert @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Convert/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Number-names b/Lang/Crystal/Number-names new file mode 120000 index 0000000000..65ddc62215 --- /dev/null +++ b/Lang/Crystal/Number-names @@ -0,0 +1 @@ +../../Task/Number-names/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Numbers-with-equal-rises-and-falls b/Lang/Crystal/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..6aa2426e57 --- /dev/null +++ b/Lang/Crystal/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/Crystal \ No newline at end of file diff --git a/Lang/Crystal/One-dimensional-cellular-automata b/Lang/Crystal/One-dimensional-cellular-automata new file mode 120000 index 0000000000..e519134b4d --- /dev/null +++ b/Lang/Crystal/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Order-by-pair-comparisons b/Lang/Crystal/Order-by-pair-comparisons new file mode 120000 index 0000000000..7f819e26a0 --- /dev/null +++ b/Lang/Crystal/Order-by-pair-comparisons @@ -0,0 +1 @@ +../../Task/Order-by-pair-comparisons/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Order-two-numerical-lists b/Lang/Crystal/Order-two-numerical-lists new file mode 120000 index 0000000000..44bdc040e5 --- /dev/null +++ b/Lang/Crystal/Order-two-numerical-lists @@ -0,0 +1 @@ +../../Task/Order-two-numerical-lists/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Ordered-words b/Lang/Crystal/Ordered-words new file mode 120000 index 0000000000..52c1bed5c6 --- /dev/null +++ b/Lang/Crystal/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Palindrome-dates b/Lang/Crystal/Palindrome-dates new file mode 120000 index 0000000000..e9d9714cac --- /dev/null +++ b/Lang/Crystal/Palindrome-dates @@ -0,0 +1 @@ +../../Task/Palindrome-dates/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Parallel-brute-force b/Lang/Crystal/Parallel-brute-force new file mode 120000 index 0000000000..496ce76b45 --- /dev/null +++ b/Lang/Crystal/Parallel-brute-force @@ -0,0 +1 @@ +../../Task/Parallel-brute-force/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Parse-an-IP-Address b/Lang/Crystal/Parse-an-IP-Address new file mode 120000 index 0000000000..940d156ab2 --- /dev/null +++ b/Lang/Crystal/Parse-an-IP-Address @@ -0,0 +1 @@ +../../Task/Parse-an-IP-Address/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Parsing-RPN-calculator-algorithm b/Lang/Crystal/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..79e0e2ae7e --- /dev/null +++ b/Lang/Crystal/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Parsing-RPN-to-infix-conversion b/Lang/Crystal/Parsing-RPN-to-infix-conversion new file mode 120000 index 0000000000..e19adc6368 --- /dev/null +++ b/Lang/Crystal/Parsing-RPN-to-infix-conversion @@ -0,0 +1 @@ +../../Task/Parsing-RPN-to-infix-conversion/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Parsing-Shunting-yard-algorithm b/Lang/Crystal/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..a18ff957d5 --- /dev/null +++ b/Lang/Crystal/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Partial-function-application b/Lang/Crystal/Partial-function-application new file mode 120000 index 0000000000..06b96bb5bb --- /dev/null +++ b/Lang/Crystal/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Perfect-numbers b/Lang/Crystal/Perfect-numbers new file mode 120000 index 0000000000..708a2045e2 --- /dev/null +++ b/Lang/Crystal/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Phrase-reversals b/Lang/Crystal/Phrase-reversals new file mode 120000 index 0000000000..7a12cc6718 --- /dev/null +++ b/Lang/Crystal/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Power-set b/Lang/Crystal/Power-set new file mode 120000 index 0000000000..0fd70fd5b9 --- /dev/null +++ b/Lang/Crystal/Power-set @@ -0,0 +1 @@ +../../Task/Power-set/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Priority-queue b/Lang/Crystal/Priority-queue new file mode 120000 index 0000000000..4f7dddb139 --- /dev/null +++ b/Lang/Crystal/Priority-queue @@ -0,0 +1 @@ +../../Task/Priority-queue/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Program-name b/Lang/Crystal/Program-name new file mode 120000 index 0000000000..0398fe1a1e --- /dev/null +++ b/Lang/Crystal/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Quaternion-type b/Lang/Crystal/Quaternion-type deleted file mode 120000 index 5a28c33333..0000000000 --- a/Lang/Crystal/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Random-sentence-from-book b/Lang/Crystal/Random-sentence-from-book new file mode 120000 index 0000000000..916a4913b6 --- /dev/null +++ b/Lang/Crystal/Random-sentence-from-book @@ -0,0 +1 @@ +../../Task/Random-sentence-from-book/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Range-extraction b/Lang/Crystal/Range-extraction new file mode 120000 index 0000000000..984878874c --- /dev/null +++ b/Lang/Crystal/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Regular-expressions b/Lang/Crystal/Regular-expressions new file mode 120000 index 0000000000..1e1b324d69 --- /dev/null +++ b/Lang/Crystal/Regular-expressions @@ -0,0 +1 @@ +../../Task/Regular-expressions/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Repeat b/Lang/Crystal/Repeat new file mode 120000 index 0000000000..cbbc5973da --- /dev/null +++ b/Lang/Crystal/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Return-multiple-values b/Lang/Crystal/Return-multiple-values new file mode 120000 index 0000000000..df0883e4b0 --- /dev/null +++ b/Lang/Crystal/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Reverse-words-in-a-string b/Lang/Crystal/Reverse-words-in-a-string new file mode 120000 index 0000000000..44576bae9a --- /dev/null +++ b/Lang/Crystal/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Rosetta-Code-Rank-languages-by-popularity b/Lang/Crystal/Rosetta-Code-Rank-languages-by-popularity new file mode 120000 index 0000000000..69fe9e65d5 --- /dev/null +++ b/Lang/Crystal/Rosetta-Code-Rank-languages-by-popularity @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Rank-languages-by-popularity/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Rot-13 b/Lang/Crystal/Rot-13 new file mode 120000 index 0000000000..430011bd06 --- /dev/null +++ b/Lang/Crystal/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Run-length-encoding b/Lang/Crystal/Run-length-encoding new file mode 120000 index 0000000000..1a2b6b241a --- /dev/null +++ b/Lang/Crystal/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Search-a-list b/Lang/Crystal/Search-a-list new file mode 120000 index 0000000000..975cbb3120 --- /dev/null +++ b/Lang/Crystal/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sequence-of-non-squares b/Lang/Crystal/Sequence-of-non-squares new file mode 120000 index 0000000000..4854c5c8ce --- /dev/null +++ b/Lang/Crystal/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Set b/Lang/Crystal/Set new file mode 120000 index 0000000000..09e0457880 --- /dev/null +++ b/Lang/Crystal/Set @@ -0,0 +1 @@ +../../Task/Set/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Short-circuit-evaluation b/Lang/Crystal/Short-circuit-evaluation new file mode 120000 index 0000000000..42f8d1e06a --- /dev/null +++ b/Lang/Crystal/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Simple-database b/Lang/Crystal/Simple-database new file mode 120000 index 0000000000..91a24ce202 --- /dev/null +++ b/Lang/Crystal/Simple-database @@ -0,0 +1 @@ +../../Task/Simple-database/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Singly-linked-list-Element-definition b/Lang/Crystal/Singly-linked-list-Element-definition new file mode 120000 index 0000000000..1c9a4e215c --- /dev/null +++ b/Lang/Crystal/Singly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-definition/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Singly-linked-list-Element-insertion b/Lang/Crystal/Singly-linked-list-Element-insertion new file mode 120000 index 0000000000..e0de17b549 --- /dev/null +++ b/Lang/Crystal/Singly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-insertion/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Singly-linked-list-Traversal b/Lang/Crystal/Singly-linked-list-Traversal new file mode 120000 index 0000000000..e89e5d42db --- /dev/null +++ b/Lang/Crystal/Singly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Traversal/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sleep b/Lang/Crystal/Sleep new file mode 120000 index 0000000000..1648e77b82 --- /dev/null +++ b/Lang/Crystal/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sleeping-Beauty-problem b/Lang/Crystal/Sleeping-Beauty-problem new file mode 120000 index 0000000000..50b43e53b7 --- /dev/null +++ b/Lang/Crystal/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Soloways-recurring-rainfall b/Lang/Crystal/Soloways-recurring-rainfall new file mode 120000 index 0000000000..017187c230 --- /dev/null +++ b/Lang/Crystal/Soloways-recurring-rainfall @@ -0,0 +1 @@ +../../Task/Soloways-recurring-rainfall/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sort-a-list-of-object-identifiers b/Lang/Crystal/Sort-a-list-of-object-identifiers new file mode 120000 index 0000000000..2b599d3df1 --- /dev/null +++ b/Lang/Crystal/Sort-a-list-of-object-identifiers @@ -0,0 +1 @@ +../../Task/Sort-a-list-of-object-identifiers/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sort-an-array-of-composite-structures b/Lang/Crystal/Sort-an-array-of-composite-structures new file mode 120000 index 0000000000..5ea781aef9 --- /dev/null +++ b/Lang/Crystal/Sort-an-array-of-composite-structures @@ -0,0 +1 @@ +../../Task/Sort-an-array-of-composite-structures/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sort-disjoint-sublist b/Lang/Crystal/Sort-disjoint-sublist new file mode 120000 index 0000000000..a252445ff4 --- /dev/null +++ b/Lang/Crystal/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sort-numbers-lexicographically b/Lang/Crystal/Sort-numbers-lexicographically new file mode 120000 index 0000000000..884dc88521 --- /dev/null +++ b/Lang/Crystal/Sort-numbers-lexicographically @@ -0,0 +1 @@ +../../Task/Sort-numbers-lexicographically/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sort-three-variables b/Lang/Crystal/Sort-three-variables new file mode 120000 index 0000000000..e206daaf02 --- /dev/null +++ b/Lang/Crystal/Sort-three-variables @@ -0,0 +1 @@ +../../Task/Sort-three-variables/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sort-using-a-custom-comparator b/Lang/Crystal/Sort-using-a-custom-comparator new file mode 120000 index 0000000000..0614ceb188 --- /dev/null +++ b/Lang/Crystal/Sort-using-a-custom-comparator @@ -0,0 +1 @@ +../../Task/Sort-using-a-custom-comparator/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sorting-algorithms-Bubble-sort b/Lang/Crystal/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..88a150acfe --- /dev/null +++ b/Lang/Crystal/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sorting-algorithms-Stooge-sort b/Lang/Crystal/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..9882d0a5e5 --- /dev/null +++ b/Lang/Crystal/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sparkline-in-unicode b/Lang/Crystal/Sparkline-in-unicode new file mode 120000 index 0000000000..986b27240a --- /dev/null +++ b/Lang/Crystal/Sparkline-in-unicode @@ -0,0 +1 @@ +../../Task/Sparkline-in-unicode/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Spelling-of-ordinal-numbers b/Lang/Crystal/Spelling-of-ordinal-numbers new file mode 120000 index 0000000000..68e66511d0 --- /dev/null +++ b/Lang/Crystal/Spelling-of-ordinal-numbers @@ -0,0 +1 @@ +../../Task/Spelling-of-ordinal-numbers/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Split-a-character-string-based-on-change-of-character b/Lang/Crystal/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..874feaced9 --- /dev/null +++ b/Lang/Crystal/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Stack-traces b/Lang/Crystal/Stack-traces new file mode 120000 index 0000000000..9cc8cddb52 --- /dev/null +++ b/Lang/Crystal/Stack-traces @@ -0,0 +1 @@ +../../Task/Stack-traces/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Stem-and-leaf-plot b/Lang/Crystal/Stem-and-leaf-plot new file mode 120000 index 0000000000..4fac378f12 --- /dev/null +++ b/Lang/Crystal/Stem-and-leaf-plot @@ -0,0 +1 @@ +../../Task/Stem-and-leaf-plot/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Stirling-numbers-of-the-first-kind b/Lang/Crystal/Stirling-numbers-of-the-first-kind new file mode 120000 index 0000000000..8a52252a36 --- /dev/null +++ b/Lang/Crystal/Stirling-numbers-of-the-first-kind @@ -0,0 +1 @@ +../../Task/Stirling-numbers-of-the-first-kind/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Straddling-checkerboard b/Lang/Crystal/Straddling-checkerboard new file mode 120000 index 0000000000..1550d42cee --- /dev/null +++ b/Lang/Crystal/Straddling-checkerboard @@ -0,0 +1 @@ +../../Task/Straddling-checkerboard/Crystal \ No newline at end of file diff --git a/Lang/Crystal/String-append b/Lang/Crystal/String-append new file mode 120000 index 0000000000..4f16bddd70 --- /dev/null +++ b/Lang/Crystal/String-append @@ -0,0 +1 @@ +../../Task/String-append/Crystal \ No newline at end of file diff --git a/Lang/Crystal/String-concatenation b/Lang/Crystal/String-concatenation new file mode 120000 index 0000000000..1237b70607 --- /dev/null +++ b/Lang/Crystal/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Crystal \ No newline at end of file diff --git a/Lang/Crystal/String-interpolation-included- b/Lang/Crystal/String-interpolation-included- new file mode 120000 index 0000000000..05bff0aabd --- /dev/null +++ b/Lang/Crystal/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/Crystal \ No newline at end of file diff --git a/Lang/Crystal/String-matching b/Lang/Crystal/String-matching new file mode 120000 index 0000000000..439dd1fa36 --- /dev/null +++ b/Lang/Crystal/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/Crystal \ No newline at end of file diff --git a/Lang/Crystal/String-prepend b/Lang/Crystal/String-prepend new file mode 120000 index 0000000000..2c5c171e4c --- /dev/null +++ b/Lang/Crystal/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Strip-a-set-of-characters-from-a-string b/Lang/Crystal/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..7c09aa4ce1 --- /dev/null +++ b/Lang/Crystal/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Strip-block-comments b/Lang/Crystal/Strip-block-comments new file mode 120000 index 0000000000..2a4303ed27 --- /dev/null +++ b/Lang/Crystal/Strip-block-comments @@ -0,0 +1 @@ +../../Task/Strip-block-comments/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Strip-comments-from-a-string b/Lang/Crystal/Strip-comments-from-a-string new file mode 120000 index 0000000000..bf4a72832d --- /dev/null +++ b/Lang/Crystal/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Strip-control-codes-and-extended-characters-from-a-string b/Lang/Crystal/Strip-control-codes-and-extended-characters-from-a-string new file mode 120000 index 0000000000..2831009e2a --- /dev/null +++ b/Lang/Crystal/Strip-control-codes-and-extended-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-control-codes-and-extended-characters-from-a-string/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Substring-Top-and-tail b/Lang/Crystal/Substring-Top-and-tail new file mode 120000 index 0000000000..d3af8a2b7f --- /dev/null +++ b/Lang/Crystal/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sudan-function b/Lang/Crystal/Sudan-function new file mode 120000 index 0000000000..a75bf5defc --- /dev/null +++ b/Lang/Crystal/Sudan-function @@ -0,0 +1 @@ +../../Task/Sudan-function/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sum-to-100 b/Lang/Crystal/Sum-to-100 new file mode 120000 index 0000000000..02859f9ab7 --- /dev/null +++ b/Lang/Crystal/Sum-to-100 @@ -0,0 +1 @@ +../../Task/Sum-to-100/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Summarize-and-say-sequence b/Lang/Crystal/Summarize-and-say-sequence new file mode 120000 index 0000000000..ac69b16598 --- /dev/null +++ b/Lang/Crystal/Summarize-and-say-sequence @@ -0,0 +1 @@ +../../Task/Summarize-and-say-sequence/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Sylvesters-sequence b/Lang/Crystal/Sylvesters-sequence new file mode 120000 index 0000000000..cd026cc33a --- /dev/null +++ b/Lang/Crystal/Sylvesters-sequence @@ -0,0 +1 @@ +../../Task/Sylvesters-sequence/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Symmetric-difference b/Lang/Crystal/Symmetric-difference new file mode 120000 index 0000000000..566657d82c --- /dev/null +++ b/Lang/Crystal/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Take-notes-on-the-command-line b/Lang/Crystal/Take-notes-on-the-command-line new file mode 120000 index 0000000000..e978486e4d --- /dev/null +++ b/Lang/Crystal/Take-notes-on-the-command-line @@ -0,0 +1 @@ +../../Task/Take-notes-on-the-command-line/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Temperature-conversion b/Lang/Crystal/Temperature-conversion new file mode 120000 index 0000000000..d97258c24c --- /dev/null +++ b/Lang/Crystal/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Ternary-logic b/Lang/Crystal/Ternary-logic new file mode 120000 index 0000000000..adfcdc28dd --- /dev/null +++ b/Lang/Crystal/Ternary-logic @@ -0,0 +1 @@ +../../Task/Ternary-logic/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Textonyms b/Lang/Crystal/Textonyms new file mode 120000 index 0000000000..e9c8a3c5ec --- /dev/null +++ b/Lang/Crystal/Textonyms @@ -0,0 +1 @@ +../../Task/Textonyms/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Towers-of-Hanoi b/Lang/Crystal/Towers-of-Hanoi new file mode 120000 index 0000000000..49ee652bdd --- /dev/null +++ b/Lang/Crystal/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Transliterate-English-text-using-the-Greek-alphabet b/Lang/Crystal/Transliterate-English-text-using-the-Greek-alphabet new file mode 120000 index 0000000000..cb70d2aa14 --- /dev/null +++ b/Lang/Crystal/Transliterate-English-text-using-the-Greek-alphabet @@ -0,0 +1 @@ +../../Task/Transliterate-English-text-using-the-Greek-alphabet/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Truncate-a-file b/Lang/Crystal/Truncate-a-file new file mode 120000 index 0000000000..a75ef5468d --- /dev/null +++ b/Lang/Crystal/Truncate-a-file @@ -0,0 +1 @@ +../../Task/Truncate-a-file/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Truth-table b/Lang/Crystal/Truth-table new file mode 120000 index 0000000000..7f3aa2a526 --- /dev/null +++ b/Lang/Crystal/Truth-table @@ -0,0 +1 @@ +../../Task/Truth-table/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Twos-complement b/Lang/Crystal/Twos-complement new file mode 120000 index 0000000000..2272e1c36b --- /dev/null +++ b/Lang/Crystal/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Crystal \ No newline at end of file diff --git a/Lang/Crystal/UPC b/Lang/Crystal/UPC new file mode 120000 index 0000000000..b4d8d405f7 --- /dev/null +++ b/Lang/Crystal/UPC @@ -0,0 +1 @@ +../../Task/UPC/Crystal \ No newline at end of file diff --git a/Lang/Crystal/UTF-8-encode-and-decode b/Lang/Crystal/UTF-8-encode-and-decode new file mode 120000 index 0000000000..acebf418fa --- /dev/null +++ b/Lang/Crystal/UTF-8-encode-and-decode @@ -0,0 +1 @@ +../../Task/UTF-8-encode-and-decode/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Van-der-Corput-sequence b/Lang/Crystal/Van-der-Corput-sequence new file mode 120000 index 0000000000..c9bba5d9e9 --- /dev/null +++ b/Lang/Crystal/Van-der-Corput-sequence @@ -0,0 +1 @@ +../../Task/Van-der-Corput-sequence/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Variable-length-quantity b/Lang/Crystal/Variable-length-quantity new file mode 120000 index 0000000000..4664ff0cf8 --- /dev/null +++ b/Lang/Crystal/Variable-length-quantity @@ -0,0 +1 @@ +../../Task/Variable-length-quantity/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Vector b/Lang/Crystal/Vector new file mode 120000 index 0000000000..eff97fd6f9 --- /dev/null +++ b/Lang/Crystal/Vector @@ -0,0 +1 @@ +../../Task/Vector/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Wagstaff-primes b/Lang/Crystal/Wagstaff-primes new file mode 120000 index 0000000000..ce243d1192 --- /dev/null +++ b/Lang/Crystal/Wagstaff-primes @@ -0,0 +1 @@ +../../Task/Wagstaff-primes/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Wordiff b/Lang/Crystal/Wordiff new file mode 120000 index 0000000000..fcf6f8935c --- /dev/null +++ b/Lang/Crystal/Wordiff @@ -0,0 +1 @@ +../../Task/Wordiff/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Write-entire-file b/Lang/Crystal/Write-entire-file new file mode 120000 index 0000000000..f56680457a --- /dev/null +++ b/Lang/Crystal/Write-entire-file @@ -0,0 +1 @@ +../../Task/Write-entire-file/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Write-language-name-in-3D-ASCII b/Lang/Crystal/Write-language-name-in-3D-ASCII new file mode 120000 index 0000000000..668585ccef --- /dev/null +++ b/Lang/Crystal/Write-language-name-in-3D-ASCII @@ -0,0 +1 @@ +../../Task/Write-language-name-in-3D-ASCII/Crystal \ No newline at end of file diff --git a/Lang/Crystal/XML-Input b/Lang/Crystal/XML-Input new file mode 120000 index 0000000000..186294c638 --- /dev/null +++ b/Lang/Crystal/XML-Input @@ -0,0 +1 @@ +../../Task/XML-Input/Crystal \ No newline at end of file diff --git a/Lang/Crystal/XML-XPath b/Lang/Crystal/XML-XPath new file mode 120000 index 0000000000..cc58f19135 --- /dev/null +++ b/Lang/Crystal/XML-XPath @@ -0,0 +1 @@ +../../Task/XML-XPath/Crystal \ No newline at end of file diff --git a/Lang/Crystal/Yellowstone-sequence b/Lang/Crystal/Yellowstone-sequence new file mode 120000 index 0000000000..e0ffb2052b --- /dev/null +++ b/Lang/Crystal/Yellowstone-sequence @@ -0,0 +1 @@ +../../Task/Yellowstone-sequence/Crystal \ No newline at end of file diff --git a/Lang/Curto/00-LANG.txt b/Lang/Curto/00-LANG.txt new file mode 100644 index 0000000000..c2a3c801b1 --- /dev/null +++ b/Lang/Curto/00-LANG.txt @@ -0,0 +1,23 @@ +{{language|Curto +|exec=machine +|site=https://maleza.srht.site/curto.html +|gc=no +|parampass=reference +|untyped=yes +|tags=forth +}} + +Curto es una traducción completa de UF Forth al español. + +==Links== +*[https://maleza.srht.site/curto.html Sitio] + +{{Language programming paradigm|Concatenative}} +==Curto== + +Curto es una traducción completa de UF Forth al español. Actualmente el trabajo de tracucción está en progreso por lo que el código fuente aún no contiene caracteres especiales del idioma y la traducción de los comentarios aún no se ha completado. + +Este es un sistema Forth tradicional para la computadora virtual "uxn/varvara". "Curto" está escrito en Tal y Curto y provee una interface de texto interactiva y un editor de pantalla. El sistema no es enebrado, compila a código UXN nativo, pero actualmente solo un mínimo de optimizaciones son realizadas. El mapeo entre código fuente Curto e instrucciones de la VM es relativamente directo por lo que la pérformance debería ser mas que suficiente para todas salvo las más críticas de las situaciones. Las celdas son de 16 bits, el sistema completo ocupa alrededor de 25k de memoria, siendo necesarios otros 4k para memoria de pantalla y buffers. + +==Todo== +* [[Tasks not implemented in Curto]] \ No newline at end of file diff --git a/Lang/Curto/00-META.yaml b/Lang/Curto/00-META.yaml new file mode 100644 index 0000000000..ebc3825015 --- /dev/null +++ b/Lang/Curto/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Curto diff --git a/Lang/Curto/Conditional-structures b/Lang/Curto/Conditional-structures new file mode 120000 index 0000000000..0ddebd80bc --- /dev/null +++ b/Lang/Curto/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Curto \ No newline at end of file diff --git a/Lang/Curto/Hello-world-Text b/Lang/Curto/Hello-world-Text new file mode 120000 index 0000000000..7e7d781c66 --- /dev/null +++ b/Lang/Curto/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Curto \ No newline at end of file diff --git a/Lang/D/Find-Chess960-starting-position-identifier b/Lang/D/Find-Chess960-starting-position-identifier new file mode 120000 index 0000000000..79e07139b9 --- /dev/null +++ b/Lang/D/Find-Chess960-starting-position-identifier @@ -0,0 +1 @@ +../../Task/Find-Chess960-starting-position-identifier/D \ No newline at end of file diff --git a/Lang/D/Largest-proper-divisor-of-n b/Lang/D/Largest-proper-divisor-of-n new file mode 120000 index 0000000000..62b7fe70aa --- /dev/null +++ b/Lang/D/Largest-proper-divisor-of-n @@ -0,0 +1 @@ +../../Task/Largest-proper-divisor-of-n/D \ No newline at end of file diff --git a/Lang/D/Miller-Rabin-primality-test b/Lang/D/Miller-Rabin-primality-test deleted file mode 120000 index 407bdbfce4..0000000000 --- a/Lang/D/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/D \ No newline at end of file diff --git a/Lang/D/Quaternion-type b/Lang/D/Quaternion-type deleted file mode 120000 index 4703070a3f..0000000000 --- a/Lang/D/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/D \ No newline at end of file diff --git a/Lang/D/Sorting-Algorithms-Circle-Sort b/Lang/D/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 950d2a1c8c..0000000000 --- a/Lang/D/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/D \ No newline at end of file diff --git a/Lang/DIBOL-11/Loops-Infinite b/Lang/DIBOL-11/Loops-Infinite new file mode 120000 index 0000000000..81547d688b --- /dev/null +++ b/Lang/DIBOL-11/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/DIBOL-11 \ No newline at end of file diff --git a/Lang/Dart/100-prisoners b/Lang/Dart/100-prisoners new file mode 120000 index 0000000000..6b68c72b8e --- /dev/null +++ b/Lang/Dart/100-prisoners @@ -0,0 +1 @@ +../../Task/100-prisoners/Dart \ No newline at end of file diff --git a/Lang/Dart/15-puzzle-solver b/Lang/Dart/15-puzzle-solver new file mode 120000 index 0000000000..9e8e216a39 --- /dev/null +++ b/Lang/Dart/15-puzzle-solver @@ -0,0 +1 @@ +../../Task/15-puzzle-solver/Dart \ No newline at end of file diff --git a/Lang/Dart/24-game-Solve b/Lang/Dart/24-game-Solve new file mode 120000 index 0000000000..ae64875d6c --- /dev/null +++ b/Lang/Dart/24-game-Solve @@ -0,0 +1 @@ +../../Task/24-game-Solve/Dart \ No newline at end of file diff --git a/Lang/Dart/AVL-tree b/Lang/Dart/AVL-tree new file mode 120000 index 0000000000..00bc5f9c2f --- /dev/null +++ b/Lang/Dart/AVL-tree @@ -0,0 +1 @@ +../../Task/AVL-tree/Dart \ No newline at end of file diff --git a/Lang/Dart/Arithmetic-Integer b/Lang/Dart/Arithmetic-Integer new file mode 120000 index 0000000000..b0138d9c48 --- /dev/null +++ b/Lang/Dart/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Dart \ No newline at end of file diff --git a/Lang/Dart/Benfords-law b/Lang/Dart/Benfords-law new file mode 120000 index 0000000000..bccac375ec --- /dev/null +++ b/Lang/Dart/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/Dart \ No newline at end of file diff --git a/Lang/Dart/Boyer-Moore-string-search b/Lang/Dart/Boyer-Moore-string-search new file mode 120000 index 0000000000..8b8a6a6060 --- /dev/null +++ b/Lang/Dart/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/Dart \ No newline at end of file diff --git a/Lang/Dart/Break-OO-privacy b/Lang/Dart/Break-OO-privacy new file mode 120000 index 0000000000..e07e79a6ca --- /dev/null +++ b/Lang/Dart/Break-OO-privacy @@ -0,0 +1 @@ +../../Task/Break-OO-privacy/Dart \ No newline at end of file diff --git a/Lang/Dart/Burrows-Wheeler-transform b/Lang/Dart/Burrows-Wheeler-transform new file mode 120000 index 0000000000..d3c9f31111 --- /dev/null +++ b/Lang/Dart/Burrows-Wheeler-transform @@ -0,0 +1 @@ +../../Task/Burrows-Wheeler-transform/Dart \ No newline at end of file diff --git a/Lang/Dart/Character-codes b/Lang/Dart/Character-codes new file mode 120000 index 0000000000..eee070c4f5 --- /dev/null +++ b/Lang/Dart/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Dart \ No newline at end of file diff --git a/Lang/Dart/Continued-fraction b/Lang/Dart/Continued-fraction new file mode 120000 index 0000000000..ea5b665958 --- /dev/null +++ b/Lang/Dart/Continued-fraction @@ -0,0 +1 @@ +../../Task/Continued-fraction/Dart \ No newline at end of file diff --git a/Lang/Dart/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- b/Lang/Dart/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- new file mode 120000 index 0000000000..eb55960eb5 --- /dev/null +++ b/Lang/Dart/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n-/Dart \ No newline at end of file diff --git a/Lang/Dart/Cullen-and-Woodall-numbers b/Lang/Dart/Cullen-and-Woodall-numbers new file mode 120000 index 0000000000..573f34cd4f --- /dev/null +++ b/Lang/Dart/Cullen-and-Woodall-numbers @@ -0,0 +1 @@ +../../Task/Cullen-and-Woodall-numbers/Dart \ No newline at end of file diff --git a/Lang/Dart/Day-of-the-week b/Lang/Dart/Day-of-the-week new file mode 120000 index 0000000000..15dd0e18f6 --- /dev/null +++ b/Lang/Dart/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Dart \ No newline at end of file diff --git a/Lang/Dart/De-Bruijn-sequences b/Lang/Dart/De-Bruijn-sequences new file mode 120000 index 0000000000..f7a9a5e2e1 --- /dev/null +++ b/Lang/Dart/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/Dart \ No newline at end of file diff --git a/Lang/Dart/Determine-sentence-type b/Lang/Dart/Determine-sentence-type new file mode 120000 index 0000000000..cbfbfb1793 --- /dev/null +++ b/Lang/Dart/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Dart \ No newline at end of file diff --git a/Lang/Dart/Dijkstras-algorithm b/Lang/Dart/Dijkstras-algorithm new file mode 120000 index 0000000000..fc7b73a06b --- /dev/null +++ b/Lang/Dart/Dijkstras-algorithm @@ -0,0 +1 @@ +../../Task/Dijkstras-algorithm/Dart \ No newline at end of file diff --git a/Lang/Dart/Diversity-prediction-theorem b/Lang/Dart/Diversity-prediction-theorem new file mode 120000 index 0000000000..525bb8c4cf --- /dev/null +++ b/Lang/Dart/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/Dart \ No newline at end of file diff --git a/Lang/Dart/Euler-method b/Lang/Dart/Euler-method new file mode 120000 index 0000000000..6501c260ce --- /dev/null +++ b/Lang/Dart/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Dart \ No newline at end of file diff --git a/Lang/Dart/Evolutionary-algorithm b/Lang/Dart/Evolutionary-algorithm new file mode 120000 index 0000000000..37e72623f8 --- /dev/null +++ b/Lang/Dart/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/Dart \ No newline at end of file diff --git a/Lang/Dart/Fibonacci-word b/Lang/Dart/Fibonacci-word new file mode 120000 index 0000000000..5feb3092ca --- /dev/null +++ b/Lang/Dart/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/Dart \ No newline at end of file diff --git a/Lang/Dart/Floyd-Warshall-algorithm b/Lang/Dart/Floyd-Warshall-algorithm new file mode 120000 index 0000000000..34dc98809b --- /dev/null +++ b/Lang/Dart/Floyd-Warshall-algorithm @@ -0,0 +1 @@ +../../Task/Floyd-Warshall-algorithm/Dart \ No newline at end of file diff --git a/Lang/Dart/Generate-lower-case-ASCII-alphabet b/Lang/Dart/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..947014123e --- /dev/null +++ b/Lang/Dart/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Dart \ No newline at end of file diff --git a/Lang/Dart/Iterated-digits-squaring b/Lang/Dart/Iterated-digits-squaring new file mode 120000 index 0000000000..87955b71c0 --- /dev/null +++ b/Lang/Dart/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/Dart \ No newline at end of file diff --git a/Lang/Dart/Jensens-Device b/Lang/Dart/Jensens-Device new file mode 120000 index 0000000000..973fbf791f --- /dev/null +++ b/Lang/Dart/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/Dart \ No newline at end of file diff --git a/Lang/Dart/Jewels-and-stones b/Lang/Dart/Jewels-and-stones new file mode 120000 index 0000000000..8673bcd41d --- /dev/null +++ b/Lang/Dart/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/Dart \ No newline at end of file diff --git a/Lang/Dart/Jordan-P-lya-numbers b/Lang/Dart/Jordan-P-lya-numbers new file mode 120000 index 0000000000..84c71f877c --- /dev/null +++ b/Lang/Dart/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Dart \ No newline at end of file diff --git a/Lang/Dart/K-d-tree b/Lang/Dart/K-d-tree new file mode 120000 index 0000000000..4b4a8013e5 --- /dev/null +++ b/Lang/Dart/K-d-tree @@ -0,0 +1 @@ +../../Task/K-d-tree/Dart \ No newline at end of file diff --git a/Lang/Dart/Leonardo-numbers b/Lang/Dart/Leonardo-numbers new file mode 120000 index 0000000000..93d2f002c1 --- /dev/null +++ b/Lang/Dart/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/Dart \ No newline at end of file diff --git a/Lang/Dart/Map-range b/Lang/Dart/Map-range new file mode 120000 index 0000000000..5ed6b07ca1 --- /dev/null +++ b/Lang/Dart/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Dart \ No newline at end of file diff --git a/Lang/Dart/Meissel-Mertens-constant b/Lang/Dart/Meissel-Mertens-constant deleted file mode 120000 index bac3ec4c99..0000000000 --- a/Lang/Dart/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Dart \ No newline at end of file diff --git a/Lang/Dart/Modular-exponentiation b/Lang/Dart/Modular-exponentiation new file mode 120000 index 0000000000..afe2138c27 --- /dev/null +++ b/Lang/Dart/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/Dart \ No newline at end of file diff --git a/Lang/Dart/Nth-root b/Lang/Dart/Nth-root new file mode 120000 index 0000000000..ff1dc1b2ec --- /dev/null +++ b/Lang/Dart/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/Dart \ No newline at end of file diff --git a/Lang/Dart/Ormiston-triples b/Lang/Dart/Ormiston-triples new file mode 120000 index 0000000000..ddb933956b --- /dev/null +++ b/Lang/Dart/Ormiston-triples @@ -0,0 +1 @@ +../../Task/Ormiston-triples/Dart \ No newline at end of file diff --git a/Lang/Dart/Pancake-numbers b/Lang/Dart/Pancake-numbers new file mode 120000 index 0000000000..78b8078b97 --- /dev/null +++ b/Lang/Dart/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/Dart \ No newline at end of file diff --git a/Lang/Dart/Parse-an-IP-Address b/Lang/Dart/Parse-an-IP-Address new file mode 120000 index 0000000000..bbe41020cb --- /dev/null +++ b/Lang/Dart/Parse-an-IP-Address @@ -0,0 +1 @@ +../../Task/Parse-an-IP-Address/Dart \ No newline at end of file diff --git a/Lang/Dart/Parsing-Shunting-yard-algorithm b/Lang/Dart/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..764230d0e5 --- /dev/null +++ b/Lang/Dart/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/Dart \ No newline at end of file diff --git a/Lang/Dart/Partition-an-integer-x-into-n-primes b/Lang/Dart/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..4b67e26b1a --- /dev/null +++ b/Lang/Dart/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/Dart \ No newline at end of file diff --git a/Lang/Dart/Partition-function-P b/Lang/Dart/Partition-function-P new file mode 120000 index 0000000000..9146b4b231 --- /dev/null +++ b/Lang/Dart/Partition-function-P @@ -0,0 +1 @@ +../../Task/Partition-function-P/Dart \ No newline at end of file diff --git a/Lang/Dart/Penneys-game b/Lang/Dart/Penneys-game new file mode 120000 index 0000000000..f054d83b87 --- /dev/null +++ b/Lang/Dart/Penneys-game @@ -0,0 +1 @@ +../../Task/Penneys-game/Dart \ No newline at end of file diff --git a/Lang/Dart/Permutations-by-swapping b/Lang/Dart/Permutations-by-swapping new file mode 120000 index 0000000000..9009ddfa84 --- /dev/null +++ b/Lang/Dart/Permutations-by-swapping @@ -0,0 +1 @@ +../../Task/Permutations-by-swapping/Dart \ No newline at end of file diff --git a/Lang/Dart/Price-fraction b/Lang/Dart/Price-fraction new file mode 120000 index 0000000000..b65d52f099 --- /dev/null +++ b/Lang/Dart/Price-fraction @@ -0,0 +1 @@ +../../Task/Price-fraction/Dart \ No newline at end of file diff --git a/Lang/Dart/Primality-by-Wilsons-theorem b/Lang/Dart/Primality-by-Wilsons-theorem new file mode 120000 index 0000000000..6834b7d634 --- /dev/null +++ b/Lang/Dart/Primality-by-Wilsons-theorem @@ -0,0 +1 @@ +../../Task/Primality-by-Wilsons-theorem/Dart \ No newline at end of file diff --git a/Lang/Dart/Pseudo-random-numbers-PCG32 b/Lang/Dart/Pseudo-random-numbers-PCG32 new file mode 120000 index 0000000000..40ec498984 --- /dev/null +++ b/Lang/Dart/Pseudo-random-numbers-PCG32 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-PCG32/Dart \ No newline at end of file diff --git a/Lang/Dart/Pythagoras-tree b/Lang/Dart/Pythagoras-tree new file mode 120000 index 0000000000..af9f37b604 --- /dev/null +++ b/Lang/Dart/Pythagoras-tree @@ -0,0 +1 @@ +../../Task/Pythagoras-tree/Dart \ No newline at end of file diff --git a/Lang/Dart/Random-Latin-squares b/Lang/Dart/Random-Latin-squares new file mode 120000 index 0000000000..226cba5197 --- /dev/null +++ b/Lang/Dart/Random-Latin-squares @@ -0,0 +1 @@ +../../Task/Random-Latin-squares/Dart \ No newline at end of file diff --git a/Lang/Dart/Random-sentence-from-book b/Lang/Dart/Random-sentence-from-book new file mode 120000 index 0000000000..2b4a3a67d4 --- /dev/null +++ b/Lang/Dart/Random-sentence-from-book @@ -0,0 +1 @@ +../../Task/Random-sentence-from-book/Dart \ No newline at end of file diff --git a/Lang/Dart/Repeat b/Lang/Dart/Repeat new file mode 120000 index 0000000000..f9635c7eb9 --- /dev/null +++ b/Lang/Dart/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/Dart \ No newline at end of file diff --git a/Lang/Dart/Rot-13 b/Lang/Dart/Rot-13 new file mode 120000 index 0000000000..6136f05da5 --- /dev/null +++ b/Lang/Dart/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Dart \ No newline at end of file diff --git a/Lang/Dart/Solve-a-Numbrix-puzzle b/Lang/Dart/Solve-a-Numbrix-puzzle new file mode 120000 index 0000000000..38339de00c --- /dev/null +++ b/Lang/Dart/Solve-a-Numbrix-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Numbrix-puzzle/Dart \ No newline at end of file diff --git a/Lang/Dart/Sorting-algorithms-Gnome-sort b/Lang/Dart/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..0f0280ed89 --- /dev/null +++ b/Lang/Dart/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/Dart \ No newline at end of file diff --git a/Lang/Dart/Split-a-character-string-based-on-change-of-character b/Lang/Dart/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..06c92b1b7c --- /dev/null +++ b/Lang/Dart/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/Dart \ No newline at end of file diff --git a/Lang/Dart/Strassens-algorithm b/Lang/Dart/Strassens-algorithm new file mode 120000 index 0000000000..db4cbbbc5d --- /dev/null +++ b/Lang/Dart/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Dart \ No newline at end of file diff --git a/Lang/Dart/String-append b/Lang/Dart/String-append new file mode 120000 index 0000000000..c2bbf5b38e --- /dev/null +++ b/Lang/Dart/String-append @@ -0,0 +1 @@ +../../Task/String-append/Dart \ No newline at end of file diff --git a/Lang/Dart/Tau-function b/Lang/Dart/Tau-function new file mode 120000 index 0000000000..b1181f3147 --- /dev/null +++ b/Lang/Dart/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/Dart \ No newline at end of file diff --git a/Lang/Dart/Tau-number b/Lang/Dart/Tau-number new file mode 120000 index 0000000000..16f7c51341 --- /dev/null +++ b/Lang/Dart/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Dart \ No newline at end of file diff --git a/Lang/Dart/Temperature-conversion b/Lang/Dart/Temperature-conversion new file mode 120000 index 0000000000..52e8aaa5fb --- /dev/null +++ b/Lang/Dart/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Dart \ No newline at end of file diff --git a/Lang/Dart/The-Name-Game b/Lang/Dart/The-Name-Game new file mode 120000 index 0000000000..41a16ad1a3 --- /dev/null +++ b/Lang/Dart/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/Dart \ No newline at end of file diff --git a/Lang/Dart/Tonelli-Shanks-algorithm b/Lang/Dart/Tonelli-Shanks-algorithm new file mode 120000 index 0000000000..72acd046bd --- /dev/null +++ b/Lang/Dart/Tonelli-Shanks-algorithm @@ -0,0 +1 @@ +../../Task/Tonelli-Shanks-algorithm/Dart \ No newline at end of file diff --git a/Lang/Dart/Topological-sort b/Lang/Dart/Topological-sort new file mode 120000 index 0000000000..7361beca1d --- /dev/null +++ b/Lang/Dart/Topological-sort @@ -0,0 +1 @@ +../../Task/Topological-sort/Dart \ No newline at end of file diff --git a/Lang/Dart/Validate-International-Securities-Identification-Number b/Lang/Dart/Validate-International-Securities-Identification-Number new file mode 120000 index 0000000000..72bbf1cc0f --- /dev/null +++ b/Lang/Dart/Validate-International-Securities-Identification-Number @@ -0,0 +1 @@ +../../Task/Validate-International-Securities-Identification-Number/Dart \ No newline at end of file diff --git a/Lang/Dart/Word-search b/Lang/Dart/Word-search new file mode 120000 index 0000000000..c9693c2a8f --- /dev/null +++ b/Lang/Dart/Word-search @@ -0,0 +1 @@ +../../Task/Word-search/Dart \ No newline at end of file diff --git a/Lang/Dart/Zeckendorf-arithmetic b/Lang/Dart/Zeckendorf-arithmetic new file mode 120000 index 0000000000..bfaf3b6837 --- /dev/null +++ b/Lang/Dart/Zeckendorf-arithmetic @@ -0,0 +1 @@ +../../Task/Zeckendorf-arithmetic/Dart \ No newline at end of file diff --git a/Lang/Dart/Zeckendorf-number-representation b/Lang/Dart/Zeckendorf-number-representation new file mode 120000 index 0000000000..eb4adc0005 --- /dev/null +++ b/Lang/Dart/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/Dart \ No newline at end of file diff --git a/Lang/Dc/Comma-quibbling b/Lang/Dc/Comma-quibbling new file mode 120000 index 0000000000..179958b910 --- /dev/null +++ b/Lang/Dc/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Dc \ No newline at end of file diff --git a/Lang/Dc/Man-or-boy-test b/Lang/Dc/Man-or-boy-test new file mode 120000 index 0000000000..3b3beb62b4 --- /dev/null +++ b/Lang/Dc/Man-or-boy-test @@ -0,0 +1 @@ +../../Task/Man-or-boy-test/Dc \ No newline at end of file diff --git a/Lang/Delphi/Bioinformatics-base-count b/Lang/Delphi/Bioinformatics-base-count deleted file mode 120000 index 8964650820..0000000000 --- a/Lang/Delphi/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Delphi \ No newline at end of file diff --git a/Lang/Delphi/Generate-Chess960-starting-position b/Lang/Delphi/Generate-Chess960-starting-position new file mode 120000 index 0000000000..2c3a66190d --- /dev/null +++ b/Lang/Delphi/Generate-Chess960-starting-position @@ -0,0 +1 @@ +../../Task/Generate-Chess960-starting-position/Delphi \ No newline at end of file diff --git a/Lang/Delphi/Meissel-Mertens-constant b/Lang/Delphi/Meissel-Mertens-constant deleted file mode 120000 index 2b1c7d3804..0000000000 --- a/Lang/Delphi/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Delphi \ No newline at end of file diff --git a/Lang/Delphi/Quaternion-type b/Lang/Delphi/Quaternion-type deleted file mode 120000 index fe804d3654..0000000000 --- a/Lang/Delphi/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Delphi \ No newline at end of file diff --git a/Lang/Delphi/Sorting-Algorithms-Circle-Sort b/Lang/Delphi/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index d4a4f938c0..0000000000 --- a/Lang/Delphi/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Delphi \ No newline at end of file diff --git a/Lang/Draco/Align-columns b/Lang/Draco/Align-columns new file mode 120000 index 0000000000..00c426b153 --- /dev/null +++ b/Lang/Draco/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Draco \ No newline at end of file diff --git a/Lang/Draco/Anti-primes b/Lang/Draco/Anti-primes new file mode 120000 index 0000000000..e9ba464537 --- /dev/null +++ b/Lang/Draco/Anti-primes @@ -0,0 +1 @@ +../../Task/Anti-primes/Draco \ No newline at end of file diff --git a/Lang/Draco/Arithmetic-derivative b/Lang/Draco/Arithmetic-derivative new file mode 120000 index 0000000000..b83ffadf85 --- /dev/null +++ b/Lang/Draco/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Draco \ No newline at end of file diff --git a/Lang/Draco/Binary-digits b/Lang/Draco/Binary-digits new file mode 120000 index 0000000000..a5389aa8f6 --- /dev/null +++ b/Lang/Draco/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Draco \ No newline at end of file diff --git a/Lang/Draco/Compound-data-type b/Lang/Draco/Compound-data-type new file mode 120000 index 0000000000..4fcd536f99 --- /dev/null +++ b/Lang/Draco/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Draco \ No newline at end of file diff --git a/Lang/Draco/Count-the-coins b/Lang/Draco/Count-the-coins new file mode 120000 index 0000000000..f1018ebb94 --- /dev/null +++ b/Lang/Draco/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/Draco \ No newline at end of file diff --git a/Lang/Draco/Cullen-and-Woodall-numbers b/Lang/Draco/Cullen-and-Woodall-numbers new file mode 120000 index 0000000000..4559430dd4 --- /dev/null +++ b/Lang/Draco/Cullen-and-Woodall-numbers @@ -0,0 +1 @@ +../../Task/Cullen-and-Woodall-numbers/Draco \ No newline at end of file diff --git a/Lang/Draco/Display-a-linear-combination b/Lang/Draco/Display-a-linear-combination new file mode 120000 index 0000000000..bbaeb41c31 --- /dev/null +++ b/Lang/Draco/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/Draco \ No newline at end of file diff --git a/Lang/Draco/Doomsday-rule b/Lang/Draco/Doomsday-rule new file mode 120000 index 0000000000..50f248643e --- /dev/null +++ b/Lang/Draco/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/Draco \ No newline at end of file diff --git a/Lang/Draco/Floyds-triangle b/Lang/Draco/Floyds-triangle new file mode 120000 index 0000000000..c58a68cb7d --- /dev/null +++ b/Lang/Draco/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/Draco \ No newline at end of file diff --git a/Lang/Draco/Horners-rule-for-polynomial-evaluation b/Lang/Draco/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..3be037b7e6 --- /dev/null +++ b/Lang/Draco/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Draco \ No newline at end of file diff --git a/Lang/Draco/Munchausen-numbers b/Lang/Draco/Munchausen-numbers new file mode 120000 index 0000000000..52967d68c1 --- /dev/null +++ b/Lang/Draco/Munchausen-numbers @@ -0,0 +1 @@ +../../Task/Munchausen-numbers/Draco \ No newline at end of file diff --git a/Lang/Draco/Narcissistic-decimal-number b/Lang/Draco/Narcissistic-decimal-number new file mode 120000 index 0000000000..e893d928d6 --- /dev/null +++ b/Lang/Draco/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/Draco \ No newline at end of file diff --git a/Lang/Draco/Roman-numerals-Encode b/Lang/Draco/Roman-numerals-Encode new file mode 120000 index 0000000000..11eed87fb8 --- /dev/null +++ b/Lang/Draco/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Draco \ No newline at end of file diff --git a/Lang/Draco/Set-consolidation b/Lang/Draco/Set-consolidation new file mode 120000 index 0000000000..152dd9a3bb --- /dev/null +++ b/Lang/Draco/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/Draco \ No newline at end of file diff --git a/Lang/Draco/Tokenize-a-string b/Lang/Draco/Tokenize-a-string new file mode 120000 index 0000000000..b60ddd21df --- /dev/null +++ b/Lang/Draco/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Draco \ No newline at end of file diff --git a/Lang/Draco/Zeckendorf-number-representation b/Lang/Draco/Zeckendorf-number-representation new file mode 120000 index 0000000000..5142294607 --- /dev/null +++ b/Lang/Draco/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/Draco \ No newline at end of file diff --git a/Lang/Dragonstone/00-LANG.txt b/Lang/Dragonstone/00-LANG.txt new file mode 100644 index 0000000000..910f7b9a21 --- /dev/null +++ b/Lang/Dragonstone/00-LANG.txt @@ -0,0 +1,9 @@ +{{language +|exec=both +|gc=optional +|parampass=both +|express=both +|strength=strong +|checking=both +|site=http://dragonstone-lang.org}} +'''Dragonstone''' is a general purpose, high-level, object-oriented programming language. It is both an interpreted and compiled language, it's inspired by Ruby and Crystal but designed for programmer happiness, productivity, and choice. \ No newline at end of file diff --git a/Lang/Dragonstone/00-META.yaml b/Lang/Dragonstone/00-META.yaml new file mode 100644 index 0000000000..33832d2528 --- /dev/null +++ b/Lang/Dragonstone/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Dragonstone diff --git a/Lang/Dragonstone/Comments b/Lang/Dragonstone/Comments new file mode 120000 index 0000000000..49a5841988 --- /dev/null +++ b/Lang/Dragonstone/Comments @@ -0,0 +1 @@ +../../Task/Comments/Dragonstone \ No newline at end of file diff --git a/Lang/Dragonstone/Hello-world-Newline-omission b/Lang/Dragonstone/Hello-world-Newline-omission new file mode 120000 index 0000000000..a67c99cc88 --- /dev/null +++ b/Lang/Dragonstone/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Dragonstone \ No newline at end of file diff --git a/Lang/Dragonstone/Hello-world-Text b/Lang/Dragonstone/Hello-world-Text new file mode 120000 index 0000000000..7f601f87ad --- /dev/null +++ b/Lang/Dragonstone/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Dragonstone \ No newline at end of file diff --git a/Lang/Dragonstone/Loops-While b/Lang/Dragonstone/Loops-While new file mode 120000 index 0000000000..c8a2239e27 --- /dev/null +++ b/Lang/Dragonstone/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Dragonstone \ No newline at end of file diff --git a/Lang/DreamBerd/00-LANG.txt b/Lang/DreamBerd/00-LANG.txt new file mode 100644 index 0000000000..55321be995 --- /dev/null +++ b/Lang/DreamBerd/00-LANG.txt @@ -0,0 +1,10 @@ +DreamBerd is a perfect esoteric programming language. Some of its features include: +*Array indexes starting at -1 +*No loops +*"Maybe" boolean value +*Many kinds of equality checks +*Type annotations +*"previous/next/current" keywords (for seeing the past/future/present of a variable) +*Signals + +{{language|DreamBerd|exec=interpreted|site=https://github.com/TodePond/DreamBerd|gc=yes}} \ No newline at end of file diff --git a/Lang/DreamBerd/00-META.yaml b/Lang/DreamBerd/00-META.yaml new file mode 100644 index 0000000000..0e5cef5b8d --- /dev/null +++ b/Lang/DreamBerd/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:DreamBerd diff --git a/Lang/DreamBerd/Hello-world-Text b/Lang/DreamBerd/Hello-world-Text new file mode 120000 index 0000000000..d474da8442 --- /dev/null +++ b/Lang/DreamBerd/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/DreamBerd \ No newline at end of file diff --git a/Lang/DuckDB/00-LANG.txt b/Lang/DuckDB/00-LANG.txt new file mode 100644 index 0000000000..2609130966 --- /dev/null +++ b/Lang/DuckDB/00-LANG.txt @@ -0,0 +1,4 @@ +[[DuckDB]] is an open-source, fast in-process analytical database management system based on a feature-rich SQL dialect complemented with deep integrations into client APIs. + +[[Category:Programming Languages]] +[[Category:SQL]] \ No newline at end of file diff --git a/Lang/DuckDB/00-META.yaml b/Lang/DuckDB/00-META.yaml new file mode 100644 index 0000000000..c9eafe7cf5 --- /dev/null +++ b/Lang/DuckDB/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:DuckDB diff --git a/Lang/DuckDB/100-doors b/Lang/DuckDB/100-doors new file mode 120000 index 0000000000..a0ee1f337e --- /dev/null +++ b/Lang/DuckDB/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/99-bottles-of-beer b/Lang/DuckDB/99-bottles-of-beer new file mode 120000 index 0000000000..c5f15cd273 --- /dev/null +++ b/Lang/DuckDB/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/A+B b/Lang/DuckDB/A+B new file mode 120000 index 0000000000..ae6220876f --- /dev/null +++ b/Lang/DuckDB/A+B @@ -0,0 +1 @@ +../../Task/A+B/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/ABC-problem b/Lang/DuckDB/ABC-problem new file mode 120000 index 0000000000..36e60dd0cd --- /dev/null +++ b/Lang/DuckDB/ABC-problem @@ -0,0 +1 @@ +../../Task/ABC-problem/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Anagrams b/Lang/DuckDB/Anagrams new file mode 120000 index 0000000000..e80c01b2e3 --- /dev/null +++ b/Lang/DuckDB/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Anonymous-recursion b/Lang/DuckDB/Anonymous-recursion new file mode 120000 index 0000000000..e4448d2542 --- /dev/null +++ b/Lang/DuckDB/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Arithmetic-Complex b/Lang/DuckDB/Arithmetic-Complex new file mode 120000 index 0000000000..7e149e59dc --- /dev/null +++ b/Lang/DuckDB/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Arithmetic-Integer b/Lang/DuckDB/Arithmetic-Integer new file mode 120000 index 0000000000..5bc3696b71 --- /dev/null +++ b/Lang/DuckDB/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Arithmetic-geometric-mean b/Lang/DuckDB/Arithmetic-geometric-mean new file mode 120000 index 0000000000..2519d0a8f8 --- /dev/null +++ b/Lang/DuckDB/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Arithmetic-numbers b/Lang/DuckDB/Arithmetic-numbers new file mode 120000 index 0000000000..a5e7e075b9 --- /dev/null +++ b/Lang/DuckDB/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Array-concatenation b/Lang/DuckDB/Array-concatenation new file mode 120000 index 0000000000..7ef5be0b5a --- /dev/null +++ b/Lang/DuckDB/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Array-length b/Lang/DuckDB/Array-length new file mode 120000 index 0000000000..ebd59786ea --- /dev/null +++ b/Lang/DuckDB/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Arrays b/Lang/DuckDB/Arrays new file mode 120000 index 0000000000..85190ece0f --- /dev/null +++ b/Lang/DuckDB/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Associative-array-Creation b/Lang/DuckDB/Associative-array-Creation new file mode 120000 index 0000000000..ea2505f34f --- /dev/null +++ b/Lang/DuckDB/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Associative-array-Iteration b/Lang/DuckDB/Associative-array-Iteration new file mode 120000 index 0000000000..c8269906e9 --- /dev/null +++ b/Lang/DuckDB/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Associative-array-Merging b/Lang/DuckDB/Associative-array-Merging new file mode 120000 index 0000000000..4e70d9ab01 --- /dev/null +++ b/Lang/DuckDB/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Averages-Arithmetic-mean b/Lang/DuckDB/Averages-Arithmetic-mean new file mode 120000 index 0000000000..7ef12ec4b6 --- /dev/null +++ b/Lang/DuckDB/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Averages-Mean-angle b/Lang/DuckDB/Averages-Mean-angle new file mode 120000 index 0000000000..5b1aa18e5e --- /dev/null +++ b/Lang/DuckDB/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Averages-Mean-time-of-day b/Lang/DuckDB/Averages-Mean-time-of-day new file mode 120000 index 0000000000..7971faf640 --- /dev/null +++ b/Lang/DuckDB/Averages-Mean-time-of-day @@ -0,0 +1 @@ +../../Task/Averages-Mean-time-of-day/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Averages-Mode b/Lang/DuckDB/Averages-Mode new file mode 120000 index 0000000000..0ba388e74d --- /dev/null +++ b/Lang/DuckDB/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Averages-Pythagorean-means b/Lang/DuckDB/Averages-Pythagorean-means new file mode 120000 index 0000000000..1a5cb3068d --- /dev/null +++ b/Lang/DuckDB/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Babbage-problem b/Lang/DuckDB/Babbage-problem new file mode 120000 index 0000000000..7cee7b9a76 --- /dev/null +++ b/Lang/DuckDB/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Benfords-law b/Lang/DuckDB/Benfords-law new file mode 120000 index 0000000000..9302673cc0 --- /dev/null +++ b/Lang/DuckDB/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Bin-given-limits b/Lang/DuckDB/Bin-given-limits new file mode 120000 index 0000000000..ba754d6a93 --- /dev/null +++ b/Lang/DuckDB/Bin-given-limits @@ -0,0 +1 @@ +../../Task/Bin-given-limits/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Binary-digits b/Lang/DuckDB/Binary-digits new file mode 120000 index 0000000000..c4e4b4a580 --- /dev/null +++ b/Lang/DuckDB/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Bitwise-IO b/Lang/DuckDB/Bitwise-IO new file mode 120000 index 0000000000..d00e607776 --- /dev/null +++ b/Lang/DuckDB/Bitwise-IO @@ -0,0 +1 @@ +../../Task/Bitwise-IO/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Bitwise-operations b/Lang/DuckDB/Bitwise-operations new file mode 120000 index 0000000000..a0841908e6 --- /dev/null +++ b/Lang/DuckDB/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/CSV-data-manipulation b/Lang/DuckDB/CSV-data-manipulation new file mode 120000 index 0000000000..799ed97795 --- /dev/null +++ b/Lang/DuckDB/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Call-a-function b/Lang/DuckDB/Call-a-function new file mode 120000 index 0000000000..bf87fb6ba8 --- /dev/null +++ b/Lang/DuckDB/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Cartesian-product-of-two-or-more-lists b/Lang/DuckDB/Cartesian-product-of-two-or-more-lists new file mode 120000 index 0000000000..f0873100b0 --- /dev/null +++ b/Lang/DuckDB/Cartesian-product-of-two-or-more-lists @@ -0,0 +1 @@ +../../Task/Cartesian-product-of-two-or-more-lists/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Case-sensitivity-of-identifiers b/Lang/DuckDB/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..2a0900e2e4 --- /dev/null +++ b/Lang/DuckDB/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Catalan-numbers b/Lang/DuckDB/Catalan-numbers new file mode 120000 index 0000000000..5591f12e62 --- /dev/null +++ b/Lang/DuckDB/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Catalan-numbers-Pascals-triangle b/Lang/DuckDB/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..690dec4614 --- /dev/null +++ b/Lang/DuckDB/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Check-that-file-exists b/Lang/DuckDB/Check-that-file-exists new file mode 120000 index 0000000000..7a35121080 --- /dev/null +++ b/Lang/DuckDB/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Collections b/Lang/DuckDB/Collections new file mode 120000 index 0000000000..4bd2b4f60a --- /dev/null +++ b/Lang/DuckDB/Collections @@ -0,0 +1 @@ +../../Task/Collections/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Combinations b/Lang/DuckDB/Combinations new file mode 120000 index 0000000000..61cb39c1bb --- /dev/null +++ b/Lang/DuckDB/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Combinations-with-repetitions b/Lang/DuckDB/Combinations-with-repetitions new file mode 120000 index 0000000000..3781b1dd53 --- /dev/null +++ b/Lang/DuckDB/Combinations-with-repetitions @@ -0,0 +1 @@ +../../Task/Combinations-with-repetitions/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Compare-a-list-of-strings b/Lang/DuckDB/Compare-a-list-of-strings new file mode 120000 index 0000000000..dcf4a9dc8d --- /dev/null +++ b/Lang/DuckDB/Compare-a-list-of-strings @@ -0,0 +1 @@ +../../Task/Compare-a-list-of-strings/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Compare-length-of-two-strings b/Lang/DuckDB/Compare-length-of-two-strings new file mode 120000 index 0000000000..b29bfdb369 --- /dev/null +++ b/Lang/DuckDB/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Compound-data-type b/Lang/DuckDB/Compound-data-type new file mode 120000 index 0000000000..dc469b307b --- /dev/null +++ b/Lang/DuckDB/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Conditional-structures b/Lang/DuckDB/Conditional-structures new file mode 120000 index 0000000000..19bf4a5caa --- /dev/null +++ b/Lang/DuckDB/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Convert-seconds-to-compound-duration b/Lang/DuckDB/Convert-seconds-to-compound-duration new file mode 120000 index 0000000000..44055a0c42 --- /dev/null +++ b/Lang/DuckDB/Convert-seconds-to-compound-duration @@ -0,0 +1 @@ +../../Task/Convert-seconds-to-compound-duration/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Copy-a-string b/Lang/DuckDB/Copy-a-string new file mode 120000 index 0000000000..d5f908f98d --- /dev/null +++ b/Lang/DuckDB/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Count-occurrences-of-a-substring b/Lang/DuckDB/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..82775de6e5 --- /dev/null +++ b/Lang/DuckDB/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Create-a-two-dimensional-array-at-runtime b/Lang/DuckDB/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..14657f9c21 --- /dev/null +++ b/Lang/DuckDB/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Cumulative-standard-deviation b/Lang/DuckDB/Cumulative-standard-deviation new file mode 120000 index 0000000000..f323d6c56e --- /dev/null +++ b/Lang/DuckDB/Cumulative-standard-deviation @@ -0,0 +1 @@ +../../Task/Cumulative-standard-deviation/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Currency b/Lang/DuckDB/Currency new file mode 120000 index 0000000000..092e5fcb13 --- /dev/null +++ b/Lang/DuckDB/Currency @@ -0,0 +1 @@ +../../Task/Currency/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Day-of-the-week b/Lang/DuckDB/Day-of-the-week new file mode 120000 index 0000000000..467c28db17 --- /dev/null +++ b/Lang/DuckDB/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Define-a-primitive-data-type b/Lang/DuckDB/Define-a-primitive-data-type new file mode 120000 index 0000000000..f086397ed2 --- /dev/null +++ b/Lang/DuckDB/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Detect-division-by-zero b/Lang/DuckDB/Detect-division-by-zero new file mode 120000 index 0000000000..92508ad1dd --- /dev/null +++ b/Lang/DuckDB/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Determinant-and-permanent b/Lang/DuckDB/Determinant-and-permanent new file mode 120000 index 0000000000..6bccec7e87 --- /dev/null +++ b/Lang/DuckDB/Determinant-and-permanent @@ -0,0 +1 @@ +../../Task/Determinant-and-permanent/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Determine-if-a-string-has-all-the-same-characters b/Lang/DuckDB/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..3a9bd20a7a --- /dev/null +++ b/Lang/DuckDB/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Determine-if-a-string-has-all-unique-characters b/Lang/DuckDB/Determine-if-a-string-has-all-unique-characters new file mode 120000 index 0000000000..64885aacf1 --- /dev/null +++ b/Lang/DuckDB/Determine-if-a-string-has-all-unique-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-unique-characters/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Determine-if-a-string-is-collapsible b/Lang/DuckDB/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..0bb2727b9c --- /dev/null +++ b/Lang/DuckDB/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Determine-if-a-string-is-numeric b/Lang/DuckDB/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..ead16cd478 --- /dev/null +++ b/Lang/DuckDB/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Determine-if-a-string-is-squeezable b/Lang/DuckDB/Determine-if-a-string-is-squeezable new file mode 120000 index 0000000000..57414557b7 --- /dev/null +++ b/Lang/DuckDB/Determine-if-a-string-is-squeezable @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-squeezable/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Determine-sentence-type b/Lang/DuckDB/Determine-sentence-type new file mode 120000 index 0000000000..50fb0aaf1b --- /dev/null +++ b/Lang/DuckDB/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Digital-root b/Lang/DuckDB/Digital-root new file mode 120000 index 0000000000..736b8ccc4f --- /dev/null +++ b/Lang/DuckDB/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Diversity-prediction-theorem b/Lang/DuckDB/Diversity-prediction-theorem new file mode 120000 index 0000000000..2c04d6784a --- /dev/null +++ b/Lang/DuckDB/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Documentation b/Lang/DuckDB/Documentation new file mode 120000 index 0000000000..f9f6aaf2ce --- /dev/null +++ b/Lang/DuckDB/Documentation @@ -0,0 +1 @@ +../../Task/Documentation/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Dot-product b/Lang/DuckDB/Dot-product new file mode 120000 index 0000000000..b17f0214ea --- /dev/null +++ b/Lang/DuckDB/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Dynamic-variable-names b/Lang/DuckDB/Dynamic-variable-names new file mode 120000 index 0000000000..c534bbc61d --- /dev/null +++ b/Lang/DuckDB/Dynamic-variable-names @@ -0,0 +1 @@ +../../Task/Dynamic-variable-names/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Element-wise-operations b/Lang/DuckDB/Element-wise-operations new file mode 120000 index 0000000000..7d7754f7f7 --- /dev/null +++ b/Lang/DuckDB/Element-wise-operations @@ -0,0 +1 @@ +../../Task/Element-wise-operations/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Empty-string b/Lang/DuckDB/Empty-string new file mode 120000 index 0000000000..67b471da95 --- /dev/null +++ b/Lang/DuckDB/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Entropy b/Lang/DuckDB/Entropy new file mode 120000 index 0000000000..9c2bc0a9a7 --- /dev/null +++ b/Lang/DuckDB/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Enumerations b/Lang/DuckDB/Enumerations new file mode 120000 index 0000000000..0605dce25b --- /dev/null +++ b/Lang/DuckDB/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Equilibrium-index b/Lang/DuckDB/Equilibrium-index new file mode 120000 index 0000000000..40fbbe81bb --- /dev/null +++ b/Lang/DuckDB/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Euler-method b/Lang/DuckDB/Euler-method new file mode 120000 index 0000000000..61aa9557d0 --- /dev/null +++ b/Lang/DuckDB/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Eulers-constant-0.5772... b/Lang/DuckDB/Eulers-constant-0.5772... new file mode 120000 index 0000000000..c954937ec2 --- /dev/null +++ b/Lang/DuckDB/Eulers-constant-0.5772... @@ -0,0 +1 @@ +../../Task/Eulers-constant-0.5772.../DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Eulers-identity b/Lang/DuckDB/Eulers-identity new file mode 120000 index 0000000000..58919d8390 --- /dev/null +++ b/Lang/DuckDB/Eulers-identity @@ -0,0 +1 @@ +../../Task/Eulers-identity/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Evaluate-binomial-coefficients b/Lang/DuckDB/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..69d838bb98 --- /dev/null +++ b/Lang/DuckDB/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Even-or-odd b/Lang/DuckDB/Even-or-odd new file mode 120000 index 0000000000..e428a57303 --- /dev/null +++ b/Lang/DuckDB/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Exponentiation-order b/Lang/DuckDB/Exponentiation-order new file mode 120000 index 0000000000..56438a22ee --- /dev/null +++ b/Lang/DuckDB/Exponentiation-order @@ -0,0 +1 @@ +../../Task/Exponentiation-order/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Extreme-floating-point-values b/Lang/DuckDB/Extreme-floating-point-values new file mode 120000 index 0000000000..617a7e99de --- /dev/null +++ b/Lang/DuckDB/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Factorial b/Lang/DuckDB/Factorial new file mode 120000 index 0000000000..24543aba0b --- /dev/null +++ b/Lang/DuckDB/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Factors-of-an-integer b/Lang/DuckDB/Factors-of-an-integer new file mode 120000 index 0000000000..70e5ed8d56 --- /dev/null +++ b/Lang/DuckDB/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Fairshare-between-two-and-more b/Lang/DuckDB/Fairshare-between-two-and-more new file mode 120000 index 0000000000..0c62807925 --- /dev/null +++ b/Lang/DuckDB/Fairshare-between-two-and-more @@ -0,0 +1 @@ +../../Task/Fairshare-between-two-and-more/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Feigenbaum-constant-calculation b/Lang/DuckDB/Feigenbaum-constant-calculation new file mode 120000 index 0000000000..6f57f3044b --- /dev/null +++ b/Lang/DuckDB/Feigenbaum-constant-calculation @@ -0,0 +1 @@ +../../Task/Feigenbaum-constant-calculation/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Fibonacci-sequence b/Lang/DuckDB/Fibonacci-sequence new file mode 120000 index 0000000000..0411dbf9f3 --- /dev/null +++ b/Lang/DuckDB/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/File-input-output b/Lang/DuckDB/File-input-output new file mode 120000 index 0000000000..0bb640b9cd --- /dev/null +++ b/Lang/DuckDB/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Filter b/Lang/DuckDB/Filter new file mode 120000 index 0000000000..bec860336f --- /dev/null +++ b/Lang/DuckDB/Filter @@ -0,0 +1 @@ +../../Task/Filter/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Find-limit-of-recursion b/Lang/DuckDB/Find-limit-of-recursion new file mode 120000 index 0000000000..e7eff55309 --- /dev/null +++ b/Lang/DuckDB/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Find-the-last-Sunday-of-each-month b/Lang/DuckDB/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..39172062a9 --- /dev/null +++ b/Lang/DuckDB/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Five-weekends b/Lang/DuckDB/Five-weekends new file mode 120000 index 0000000000..4d8ed3ebe3 --- /dev/null +++ b/Lang/DuckDB/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Fixed-length-records b/Lang/DuckDB/Fixed-length-records new file mode 120000 index 0000000000..0b8d72de87 --- /dev/null +++ b/Lang/DuckDB/Fixed-length-records @@ -0,0 +1 @@ +../../Task/Fixed-length-records/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Flatten-a-list b/Lang/DuckDB/Flatten-a-list new file mode 120000 index 0000000000..5bd1c5b0d8 --- /dev/null +++ b/Lang/DuckDB/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Formatted-numeric-output b/Lang/DuckDB/Formatted-numeric-output new file mode 120000 index 0000000000..789e647161 --- /dev/null +++ b/Lang/DuckDB/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Forward-difference b/Lang/DuckDB/Forward-difference new file mode 120000 index 0000000000..6a0d935f36 --- /dev/null +++ b/Lang/DuckDB/Forward-difference @@ -0,0 +1 @@ +../../Task/Forward-difference/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Function-definition b/Lang/DuckDB/Function-definition new file mode 120000 index 0000000000..b39d093883 --- /dev/null +++ b/Lang/DuckDB/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Gamma-function b/Lang/DuckDB/Gamma-function new file mode 120000 index 0000000000..6fcec68436 --- /dev/null +++ b/Lang/DuckDB/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Gapful-numbers b/Lang/DuckDB/Gapful-numbers new file mode 120000 index 0000000000..875c3e4310 --- /dev/null +++ b/Lang/DuckDB/Gapful-numbers @@ -0,0 +1 @@ +../../Task/Gapful-numbers/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Generate-lower-case-ASCII-alphabet b/Lang/DuckDB/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..51094f97da --- /dev/null +++ b/Lang/DuckDB/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Generic-swap b/Lang/DuckDB/Generic-swap new file mode 120000 index 0000000000..b384241f1f --- /dev/null +++ b/Lang/DuckDB/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Golden-ratio-Convergence b/Lang/DuckDB/Golden-ratio-Convergence new file mode 120000 index 0000000000..0ca8f2458f --- /dev/null +++ b/Lang/DuckDB/Golden-ratio-Convergence @@ -0,0 +1 @@ +../../Task/Golden-ratio-Convergence/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Gotchas b/Lang/DuckDB/Gotchas new file mode 120000 index 0000000000..16cceb3ff0 --- /dev/null +++ b/Lang/DuckDB/Gotchas @@ -0,0 +1 @@ +../../Task/Gotchas/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Greatest-common-divisor b/Lang/DuckDB/Greatest-common-divisor new file mode 120000 index 0000000000..6fb062c771 --- /dev/null +++ b/Lang/DuckDB/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Greatest-element-of-a-list b/Lang/DuckDB/Greatest-element-of-a-list new file mode 120000 index 0000000000..5a2c7a66c9 --- /dev/null +++ b/Lang/DuckDB/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Greatest-subsequential-sum b/Lang/DuckDB/Greatest-subsequential-sum new file mode 120000 index 0000000000..dd3661e978 --- /dev/null +++ b/Lang/DuckDB/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/HTTP b/Lang/DuckDB/HTTP new file mode 120000 index 0000000000..f77a3116ff --- /dev/null +++ b/Lang/DuckDB/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/HTTPS b/Lang/DuckDB/HTTPS new file mode 120000 index 0000000000..694faecb0f --- /dev/null +++ b/Lang/DuckDB/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/HTTPS-Authenticated b/Lang/DuckDB/HTTPS-Authenticated new file mode 120000 index 0000000000..c1b123b3b8 --- /dev/null +++ b/Lang/DuckDB/HTTPS-Authenticated @@ -0,0 +1 @@ +../../Task/HTTPS-Authenticated/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Hailstone-sequence b/Lang/DuckDB/Hailstone-sequence new file mode 120000 index 0000000000..8cb9cd3c4d --- /dev/null +++ b/Lang/DuckDB/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Harmonic-series b/Lang/DuckDB/Harmonic-series new file mode 120000 index 0000000000..d5b23dfe32 --- /dev/null +++ b/Lang/DuckDB/Harmonic-series @@ -0,0 +1 @@ +../../Task/Harmonic-series/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Hash-from-two-arrays b/Lang/DuckDB/Hash-from-two-arrays new file mode 120000 index 0000000000..4fd3efc241 --- /dev/null +++ b/Lang/DuckDB/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Hash-join b/Lang/DuckDB/Hash-join new file mode 120000 index 0000000000..d89e18cc75 --- /dev/null +++ b/Lang/DuckDB/Hash-join @@ -0,0 +1 @@ +../../Task/Hash-join/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Haversine-formula b/Lang/DuckDB/Haversine-formula new file mode 120000 index 0000000000..102a047e33 --- /dev/null +++ b/Lang/DuckDB/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Hello-world-Text b/Lang/DuckDB/Hello-world-Text new file mode 120000 index 0000000000..1af484f405 --- /dev/null +++ b/Lang/DuckDB/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Here-document b/Lang/DuckDB/Here-document new file mode 120000 index 0000000000..f233028f5b --- /dev/null +++ b/Lang/DuckDB/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/ISBN13-check-digit b/Lang/DuckDB/ISBN13-check-digit new file mode 120000 index 0000000000..ad247e79cf --- /dev/null +++ b/Lang/DuckDB/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Identity-matrix b/Lang/DuckDB/Identity-matrix new file mode 120000 index 0000000000..d8402f7ae8 --- /dev/null +++ b/Lang/DuckDB/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols b/Lang/DuckDB/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols new file mode 120000 index 0000000000..90e880a4b1 --- /dev/null +++ b/Lang/DuckDB/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols @@ -0,0 +1 @@ +../../Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Idiomatically-determine-all-the-lowercase-and-uppercase-letters b/Lang/DuckDB/Idiomatically-determine-all-the-lowercase-and-uppercase-letters new file mode 120000 index 0000000000..3722271469 --- /dev/null +++ b/Lang/DuckDB/Idiomatically-determine-all-the-lowercase-and-uppercase-letters @@ -0,0 +1 @@ +../../Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Increment-a-numerical-string b/Lang/DuckDB/Increment-a-numerical-string new file mode 120000 index 0000000000..a9f84c0e8c --- /dev/null +++ b/Lang/DuckDB/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Infinity b/Lang/DuckDB/Infinity new file mode 120000 index 0000000000..ed12f74690 --- /dev/null +++ b/Lang/DuckDB/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Integer-comparison b/Lang/DuckDB/Integer-comparison new file mode 120000 index 0000000000..c6cacfcd06 --- /dev/null +++ b/Lang/DuckDB/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Introspection b/Lang/DuckDB/Introspection new file mode 120000 index 0000000000..c3bb6d896d --- /dev/null +++ b/Lang/DuckDB/Introspection @@ -0,0 +1 @@ +../../Task/Introspection/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Inverted-index b/Lang/DuckDB/Inverted-index new file mode 120000 index 0000000000..81053e0c15 --- /dev/null +++ b/Lang/DuckDB/Inverted-index @@ -0,0 +1 @@ +../../Task/Inverted-index/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Inverted-syntax b/Lang/DuckDB/Inverted-syntax new file mode 120000 index 0000000000..cadc81e3b6 --- /dev/null +++ b/Lang/DuckDB/Inverted-syntax @@ -0,0 +1 @@ +../../Task/Inverted-syntax/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/JSON b/Lang/DuckDB/JSON new file mode 120000 index 0000000000..e4757a4b09 --- /dev/null +++ b/Lang/DuckDB/JSON @@ -0,0 +1 @@ +../../Task/JSON/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Jaro-similarity b/Lang/DuckDB/Jaro-similarity new file mode 120000 index 0000000000..39c64b8488 --- /dev/null +++ b/Lang/DuckDB/Jaro-similarity @@ -0,0 +1 @@ +../../Task/Jaro-similarity/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Knuth-shuffle b/Lang/DuckDB/Knuth-shuffle new file mode 120000 index 0000000000..7d43c57cbe --- /dev/null +++ b/Lang/DuckDB/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Largest-int-from-concatenated-ints b/Lang/DuckDB/Largest-int-from-concatenated-ints new file mode 120000 index 0000000000..8e73a50292 --- /dev/null +++ b/Lang/DuckDB/Largest-int-from-concatenated-ints @@ -0,0 +1 @@ +../../Task/Largest-int-from-concatenated-ints/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Last-Friday-of-each-month b/Lang/DuckDB/Last-Friday-of-each-month new file mode 120000 index 0000000000..1236ebdc14 --- /dev/null +++ b/Lang/DuckDB/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Leap-year b/Lang/DuckDB/Leap-year new file mode 120000 index 0000000000..5816394f02 --- /dev/null +++ b/Lang/DuckDB/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Left-factorials b/Lang/DuckDB/Left-factorials new file mode 120000 index 0000000000..6877bf1f73 --- /dev/null +++ b/Lang/DuckDB/Left-factorials @@ -0,0 +1 @@ +../../Task/Left-factorials/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Leonardo-numbers b/Lang/DuckDB/Leonardo-numbers new file mode 120000 index 0000000000..206ddcfce9 --- /dev/null +++ b/Lang/DuckDB/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Letter-frequency b/Lang/DuckDB/Letter-frequency new file mode 120000 index 0000000000..29228c3e0b --- /dev/null +++ b/Lang/DuckDB/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Levenshtein-distance b/Lang/DuckDB/Levenshtein-distance new file mode 120000 index 0000000000..d0954b60f2 --- /dev/null +++ b/Lang/DuckDB/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/List-comprehensions b/Lang/DuckDB/List-comprehensions new file mode 120000 index 0000000000..72558c43a1 --- /dev/null +++ b/Lang/DuckDB/List-comprehensions @@ -0,0 +1 @@ +../../Task/List-comprehensions/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Literals-Integer b/Lang/DuckDB/Literals-Integer new file mode 120000 index 0000000000..39629959b4 --- /dev/null +++ b/Lang/DuckDB/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Logical-operations b/Lang/DuckDB/Logical-operations new file mode 120000 index 0000000000..14d59b0f70 --- /dev/null +++ b/Lang/DuckDB/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Longest-increasing-subsequence b/Lang/DuckDB/Longest-increasing-subsequence new file mode 120000 index 0000000000..35a8443499 --- /dev/null +++ b/Lang/DuckDB/Longest-increasing-subsequence @@ -0,0 +1 @@ +../../Task/Longest-increasing-subsequence/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Loops-Break b/Lang/DuckDB/Loops-Break new file mode 120000 index 0000000000..40b7904e3f --- /dev/null +++ b/Lang/DuckDB/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Loops-Do-while b/Lang/DuckDB/Loops-Do-while new file mode 120000 index 0000000000..257f84d6ba --- /dev/null +++ b/Lang/DuckDB/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Loops-Downward-for b/Lang/DuckDB/Loops-Downward-for new file mode 120000 index 0000000000..5516907335 --- /dev/null +++ b/Lang/DuckDB/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Loops-For b/Lang/DuckDB/Loops-For new file mode 120000 index 0000000000..56dde9a604 --- /dev/null +++ b/Lang/DuckDB/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Loops-For-with-a-specified-step b/Lang/DuckDB/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..f7e2b536d7 --- /dev/null +++ b/Lang/DuckDB/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Loops-Increment-loop-index-within-loop-body b/Lang/DuckDB/Loops-Increment-loop-index-within-loop-body new file mode 120000 index 0000000000..d530992462 --- /dev/null +++ b/Lang/DuckDB/Loops-Increment-loop-index-within-loop-body @@ -0,0 +1 @@ +../../Task/Loops-Increment-loop-index-within-loop-body/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Loops-N-plus-one-half b/Lang/DuckDB/Loops-N-plus-one-half new file mode 120000 index 0000000000..f9812bda7e --- /dev/null +++ b/Lang/DuckDB/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Loops-Nested b/Lang/DuckDB/Loops-Nested new file mode 120000 index 0000000000..8b4afa46b5 --- /dev/null +++ b/Lang/DuckDB/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Loops-While b/Lang/DuckDB/Loops-While new file mode 120000 index 0000000000..60343480f3 --- /dev/null +++ b/Lang/DuckDB/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Loops-With-multiple-ranges b/Lang/DuckDB/Loops-With-multiple-ranges new file mode 120000 index 0000000000..540b734a24 --- /dev/null +++ b/Lang/DuckDB/Loops-With-multiple-ranges @@ -0,0 +1 @@ +../../Task/Loops-With-multiple-ranges/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Luhn-test-of-credit-card-numbers b/Lang/DuckDB/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..397557411e --- /dev/null +++ b/Lang/DuckDB/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/MD5 b/Lang/DuckDB/MD5 new file mode 120000 index 0000000000..ab453e87da --- /dev/null +++ b/Lang/DuckDB/MD5 @@ -0,0 +1 @@ +../../Task/MD5/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Map-range b/Lang/DuckDB/Map-range new file mode 120000 index 0000000000..6cd697a04b --- /dev/null +++ b/Lang/DuckDB/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Matrix-multiplication b/Lang/DuckDB/Matrix-multiplication new file mode 120000 index 0000000000..2110896869 --- /dev/null +++ b/Lang/DuckDB/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Matrix-transposition b/Lang/DuckDB/Matrix-transposition new file mode 120000 index 0000000000..7e416217b2 --- /dev/null +++ b/Lang/DuckDB/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Merge-and-aggregate-datasets b/Lang/DuckDB/Merge-and-aggregate-datasets new file mode 120000 index 0000000000..e9d467735b --- /dev/null +++ b/Lang/DuckDB/Merge-and-aggregate-datasets @@ -0,0 +1 @@ +../../Task/Merge-and-aggregate-datasets/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Metallic-ratios b/Lang/DuckDB/Metallic-ratios new file mode 120000 index 0000000000..56fa981641 --- /dev/null +++ b/Lang/DuckDB/Metallic-ratios @@ -0,0 +1 @@ +../../Task/Metallic-ratios/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Middle-three-digits b/Lang/DuckDB/Middle-three-digits new file mode 120000 index 0000000000..9c32c60a1c --- /dev/null +++ b/Lang/DuckDB/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Monte-Carlo-methods b/Lang/DuckDB/Monte-Carlo-methods new file mode 120000 index 0000000000..f27be4f0e8 --- /dev/null +++ b/Lang/DuckDB/Monte-Carlo-methods @@ -0,0 +1 @@ +../../Task/Monte-Carlo-methods/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Nested-function b/Lang/DuckDB/Nested-function new file mode 120000 index 0000000000..6ccb0c0029 --- /dev/null +++ b/Lang/DuckDB/Nested-function @@ -0,0 +1 @@ +../../Task/Nested-function/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Nth b/Lang/DuckDB/Nth new file mode 120000 index 0000000000..6d1fd0295b --- /dev/null +++ b/Lang/DuckDB/Nth @@ -0,0 +1 @@ +../../Task/Nth/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Nth-root b/Lang/DuckDB/Nth-root new file mode 120000 index 0000000000..bdfee4887c --- /dev/null +++ b/Lang/DuckDB/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/One-of-n-lines-in-a-file b/Lang/DuckDB/One-of-n-lines-in-a-file new file mode 120000 index 0000000000..84adf8bb46 --- /dev/null +++ b/Lang/DuckDB/One-of-n-lines-in-a-file @@ -0,0 +1 @@ +../../Task/One-of-n-lines-in-a-file/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Order-two-numerical-lists b/Lang/DuckDB/Order-two-numerical-lists new file mode 120000 index 0000000000..fcd259b6c0 --- /dev/null +++ b/Lang/DuckDB/Order-two-numerical-lists @@ -0,0 +1 @@ +../../Task/Order-two-numerical-lists/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Ordered-words b/Lang/DuckDB/Ordered-words new file mode 120000 index 0000000000..57d12d9c27 --- /dev/null +++ b/Lang/DuckDB/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Palindrome-detection b/Lang/DuckDB/Palindrome-detection new file mode 120000 index 0000000000..a318cb02ae --- /dev/null +++ b/Lang/DuckDB/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Parameterized-SQL-statement b/Lang/DuckDB/Parameterized-SQL-statement new file mode 120000 index 0000000000..dded36b01b --- /dev/null +++ b/Lang/DuckDB/Parameterized-SQL-statement @@ -0,0 +1 @@ +../../Task/Parameterized-SQL-statement/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Pascals-triangle b/Lang/DuckDB/Pascals-triangle new file mode 120000 index 0000000000..e38a99fc2d --- /dev/null +++ b/Lang/DuckDB/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Permutations b/Lang/DuckDB/Permutations new file mode 120000 index 0000000000..fa1198c6a6 --- /dev/null +++ b/Lang/DuckDB/Permutations @@ -0,0 +1 @@ +../../Task/Permutations/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Permutations-Derangements b/Lang/DuckDB/Permutations-Derangements new file mode 120000 index 0000000000..b4140ee27e --- /dev/null +++ b/Lang/DuckDB/Permutations-Derangements @@ -0,0 +1 @@ +../../Task/Permutations-Derangements/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Pick-random-element b/Lang/DuckDB/Pick-random-element new file mode 120000 index 0000000000..4eec54c36e --- /dev/null +++ b/Lang/DuckDB/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Primality-by-trial-division b/Lang/DuckDB/Primality-by-trial-division new file mode 120000 index 0000000000..8e9e10eb1a --- /dev/null +++ b/Lang/DuckDB/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Prime-decomposition b/Lang/DuckDB/Prime-decomposition new file mode 120000 index 0000000000..dbb3b57727 --- /dev/null +++ b/Lang/DuckDB/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Probabilistic-choice b/Lang/DuckDB/Probabilistic-choice new file mode 120000 index 0000000000..caa9cf57ce --- /dev/null +++ b/Lang/DuckDB/Probabilistic-choice @@ -0,0 +1 @@ +../../Task/Probabilistic-choice/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Proper-divisors b/Lang/DuckDB/Proper-divisors new file mode 120000 index 0000000000..a8b8cf32ca --- /dev/null +++ b/Lang/DuckDB/Proper-divisors @@ -0,0 +1 @@ +../../Task/Proper-divisors/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Pseudo-random-numbers-Middle-square-method b/Lang/DuckDB/Pseudo-random-numbers-Middle-square-method new file mode 120000 index 0000000000..3424580b60 --- /dev/null +++ b/Lang/DuckDB/Pseudo-random-numbers-Middle-square-method @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Middle-square-method/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Random-numbers b/Lang/DuckDB/Random-numbers new file mode 120000 index 0000000000..4e7ae21251 --- /dev/null +++ b/Lang/DuckDB/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Range-expansion b/Lang/DuckDB/Range-expansion new file mode 120000 index 0000000000..73f7852f3e --- /dev/null +++ b/Lang/DuckDB/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Range-extraction b/Lang/DuckDB/Range-extraction new file mode 120000 index 0000000000..70b9fee7f2 --- /dev/null +++ b/Lang/DuckDB/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Read-a-file-line-by-line b/Lang/DuckDB/Read-a-file-line-by-line new file mode 120000 index 0000000000..5698cabe3f --- /dev/null +++ b/Lang/DuckDB/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Reflection-List-methods b/Lang/DuckDB/Reflection-List-methods new file mode 120000 index 0000000000..e87f71ad29 --- /dev/null +++ b/Lang/DuckDB/Reflection-List-methods @@ -0,0 +1 @@ +../../Task/Reflection-List-methods/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Reflection-List-properties b/Lang/DuckDB/Reflection-List-properties new file mode 120000 index 0000000000..61160f5035 --- /dev/null +++ b/Lang/DuckDB/Reflection-List-properties @@ -0,0 +1 @@ +../../Task/Reflection-List-properties/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Remove-duplicate-elements b/Lang/DuckDB/Remove-duplicate-elements new file mode 120000 index 0000000000..e38927d88b --- /dev/null +++ b/Lang/DuckDB/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Rep-string b/Lang/DuckDB/Rep-string new file mode 120000 index 0000000000..ce2543465d --- /dev/null +++ b/Lang/DuckDB/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Repeat-a-string b/Lang/DuckDB/Repeat-a-string new file mode 120000 index 0000000000..126fb8a5a7 --- /dev/null +++ b/Lang/DuckDB/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Return-multiple-values b/Lang/DuckDB/Return-multiple-values new file mode 120000 index 0000000000..44885d997f --- /dev/null +++ b/Lang/DuckDB/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Reverse-a-string b/Lang/DuckDB/Reverse-a-string new file mode 120000 index 0000000000..9c2fcefbbf --- /dev/null +++ b/Lang/DuckDB/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Roots-of-unity b/Lang/DuckDB/Roots-of-unity new file mode 120000 index 0000000000..fbae972a1d --- /dev/null +++ b/Lang/DuckDB/Roots-of-unity @@ -0,0 +1 @@ +../../Task/Roots-of-unity/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Run-length-encoding b/Lang/DuckDB/Run-length-encoding new file mode 120000 index 0000000000..798b72b50c --- /dev/null +++ b/Lang/DuckDB/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Search-a-list-of-records b/Lang/DuckDB/Search-a-list-of-records new file mode 120000 index 0000000000..8875d845bf --- /dev/null +++ b/Lang/DuckDB/Search-a-list-of-records @@ -0,0 +1 @@ +../../Task/Search-a-list-of-records/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Set b/Lang/DuckDB/Set new file mode 120000 index 0000000000..7e25aac634 --- /dev/null +++ b/Lang/DuckDB/Set @@ -0,0 +1 @@ +../../Task/Set/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Set-consolidation b/Lang/DuckDB/Set-consolidation new file mode 120000 index 0000000000..46e9513ebb --- /dev/null +++ b/Lang/DuckDB/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Show-the-epoch b/Lang/DuckDB/Show-the-epoch new file mode 120000 index 0000000000..6cd68764f9 --- /dev/null +++ b/Lang/DuckDB/Show-the-epoch @@ -0,0 +1 @@ +../../Task/Show-the-epoch/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Sieve-of-Eratosthenes b/Lang/DuckDB/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..ee6aa1fbd3 --- /dev/null +++ b/Lang/DuckDB/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Sort-an-array-of-composite-structures b/Lang/DuckDB/Sort-an-array-of-composite-structures new file mode 120000 index 0000000000..35612aed66 --- /dev/null +++ b/Lang/DuckDB/Sort-an-array-of-composite-structures @@ -0,0 +1 @@ +../../Task/Sort-an-array-of-composite-structures/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Sort-numbers-lexicographically b/Lang/DuckDB/Sort-numbers-lexicographically new file mode 120000 index 0000000000..390860d685 --- /dev/null +++ b/Lang/DuckDB/Sort-numbers-lexicographically @@ -0,0 +1 @@ +../../Task/Sort-numbers-lexicographically/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Statistics-Basic b/Lang/DuckDB/Statistics-Basic new file mode 120000 index 0000000000..c3caa99be7 --- /dev/null +++ b/Lang/DuckDB/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/String-append b/Lang/DuckDB/String-append new file mode 120000 index 0000000000..cc8ce5011e --- /dev/null +++ b/Lang/DuckDB/String-append @@ -0,0 +1 @@ +../../Task/String-append/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/String-case b/Lang/DuckDB/String-case new file mode 120000 index 0000000000..ab3478758f --- /dev/null +++ b/Lang/DuckDB/String-case @@ -0,0 +1 @@ +../../Task/String-case/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/String-comparison b/Lang/DuckDB/String-comparison new file mode 120000 index 0000000000..b7a7339e14 --- /dev/null +++ b/Lang/DuckDB/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/String-interpolation-included- b/Lang/DuckDB/String-interpolation-included- new file mode 120000 index 0000000000..807f8abec4 --- /dev/null +++ b/Lang/DuckDB/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/String-length b/Lang/DuckDB/String-length new file mode 120000 index 0000000000..f49078b058 --- /dev/null +++ b/Lang/DuckDB/String-length @@ -0,0 +1 @@ +../../Task/String-length/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/String-matching b/Lang/DuckDB/String-matching new file mode 120000 index 0000000000..e3f7fa5300 --- /dev/null +++ b/Lang/DuckDB/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/String-prepend b/Lang/DuckDB/String-prepend new file mode 120000 index 0000000000..ea6f95610c --- /dev/null +++ b/Lang/DuckDB/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Strip-a-set-of-characters-from-a-string b/Lang/DuckDB/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..77ce9f900d --- /dev/null +++ b/Lang/DuckDB/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Strip-comments-from-a-string b/Lang/DuckDB/Strip-comments-from-a-string new file mode 120000 index 0000000000..f58b2c006d --- /dev/null +++ b/Lang/DuckDB/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Strip-control-codes-and-extended-characters-from-a-string b/Lang/DuckDB/Strip-control-codes-and-extended-characters-from-a-string new file mode 120000 index 0000000000..e3de3aa487 --- /dev/null +++ b/Lang/DuckDB/Strip-control-codes-and-extended-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-control-codes-and-extended-characters-from-a-string/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Strip-whitespace-from-a-string-Top-and-tail b/Lang/DuckDB/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..93405e661f --- /dev/null +++ b/Lang/DuckDB/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Substring b/Lang/DuckDB/Substring new file mode 120000 index 0000000000..fe9daf5b9c --- /dev/null +++ b/Lang/DuckDB/Substring @@ -0,0 +1 @@ +../../Task/Substring/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Sudoku b/Lang/DuckDB/Sudoku new file mode 120000 index 0000000000..efc19532bb --- /dev/null +++ b/Lang/DuckDB/Sudoku @@ -0,0 +1 @@ +../../Task/Sudoku/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Sum-and-product-of-an-array b/Lang/DuckDB/Sum-and-product-of-an-array new file mode 120000 index 0000000000..9db07cfe55 --- /dev/null +++ b/Lang/DuckDB/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Sum-digits-of-an-integer b/Lang/DuckDB/Sum-digits-of-an-integer new file mode 120000 index 0000000000..2b4e9e5805 --- /dev/null +++ b/Lang/DuckDB/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Sum-multiples-of-3-and-5 b/Lang/DuckDB/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..06a19cefb7 --- /dev/null +++ b/Lang/DuckDB/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Sum-of-a-series b/Lang/DuckDB/Sum-of-a-series new file mode 120000 index 0000000000..db0f6f79c5 --- /dev/null +++ b/Lang/DuckDB/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Sum-of-squares b/Lang/DuckDB/Sum-of-squares new file mode 120000 index 0000000000..fe3d9a8a52 --- /dev/null +++ b/Lang/DuckDB/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Symmetric-difference b/Lang/DuckDB/Symmetric-difference new file mode 120000 index 0000000000..f254423d5f --- /dev/null +++ b/Lang/DuckDB/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Table-creation-Postal-addresses b/Lang/DuckDB/Table-creation-Postal-addresses new file mode 120000 index 0000000000..174f03f886 --- /dev/null +++ b/Lang/DuckDB/Table-creation-Postal-addresses @@ -0,0 +1 @@ +../../Task/Table-creation-Postal-addresses/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Test-integerness b/Lang/DuckDB/Test-integerness new file mode 120000 index 0000000000..0e9573c924 --- /dev/null +++ b/Lang/DuckDB/Test-integerness @@ -0,0 +1 @@ +../../Task/Test-integerness/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Text-processing-2 b/Lang/DuckDB/Text-processing-2 new file mode 120000 index 0000000000..b3c883d2ec --- /dev/null +++ b/Lang/DuckDB/Text-processing-2 @@ -0,0 +1 @@ +../../Task/Text-processing-2/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Thue-Morse b/Lang/DuckDB/Thue-Morse new file mode 120000 index 0000000000..e14a41e488 --- /dev/null +++ b/Lang/DuckDB/Thue-Morse @@ -0,0 +1 @@ +../../Task/Thue-Morse/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Time-a-function b/Lang/DuckDB/Time-a-function new file mode 120000 index 0000000000..d82a288f55 --- /dev/null +++ b/Lang/DuckDB/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Tokenize-a-string b/Lang/DuckDB/Tokenize-a-string new file mode 120000 index 0000000000..ee6d07a4b5 --- /dev/null +++ b/Lang/DuckDB/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Top-rank-per-group b/Lang/DuckDB/Top-rank-per-group new file mode 120000 index 0000000000..ada50a852c --- /dev/null +++ b/Lang/DuckDB/Top-rank-per-group @@ -0,0 +1 @@ +../../Task/Top-rank-per-group/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Trigonometric-functions b/Lang/DuckDB/Trigonometric-functions new file mode 120000 index 0000000000..58530b66ee --- /dev/null +++ b/Lang/DuckDB/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/URL-decoding b/Lang/DuckDB/URL-decoding new file mode 120000 index 0000000000..c717460642 --- /dev/null +++ b/Lang/DuckDB/URL-decoding @@ -0,0 +1 @@ +../../Task/URL-decoding/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/UTF-8-encode-and-decode b/Lang/DuckDB/UTF-8-encode-and-decode new file mode 120000 index 0000000000..792323a78c --- /dev/null +++ b/Lang/DuckDB/UTF-8-encode-and-decode @@ -0,0 +1 @@ +../../Task/UTF-8-encode-and-decode/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Unix-ls b/Lang/DuckDB/Unix-ls new file mode 120000 index 0000000000..85287a21f6 --- /dev/null +++ b/Lang/DuckDB/Unix-ls @@ -0,0 +1 @@ +../../Task/Unix-ls/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Variable-size-Get b/Lang/DuckDB/Variable-size-Get new file mode 120000 index 0000000000..3cff7c631a --- /dev/null +++ b/Lang/DuckDB/Variable-size-Get @@ -0,0 +1 @@ +../../Task/Variable-size-Get/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Variable-size-Set b/Lang/DuckDB/Variable-size-Set new file mode 120000 index 0000000000..ee4a003cfa --- /dev/null +++ b/Lang/DuckDB/Variable-size-Set @@ -0,0 +1 @@ +../../Task/Variable-size-Set/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Vector-products b/Lang/DuckDB/Vector-products new file mode 120000 index 0000000000..3347aa5bba --- /dev/null +++ b/Lang/DuckDB/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Zero-to-the-zero-power b/Lang/DuckDB/Zero-to-the-zero-power new file mode 120000 index 0000000000..7c7bac0f0b --- /dev/null +++ b/Lang/DuckDB/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/DuckDB \ No newline at end of file diff --git a/Lang/DuckDB/Zig-zag-matrix b/Lang/DuckDB/Zig-zag-matrix new file mode 120000 index 0000000000..dee409f57f --- /dev/null +++ b/Lang/DuckDB/Zig-zag-matrix @@ -0,0 +1 @@ +../../Task/Zig-zag-matrix/DuckDB \ No newline at end of file diff --git a/Lang/E/Miller-Rabin-primality-test b/Lang/E/Miller-Rabin-primality-test deleted file mode 120000 index f586feb18b..0000000000 --- a/Lang/E/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/E \ No newline at end of file diff --git a/Lang/E/Quaternion-type b/Lang/E/Quaternion-type deleted file mode 120000 index ecc55ca8a4..0000000000 --- a/Lang/E/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/E \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Haversine-formula b/Lang/EDSAC-order-code/Haversine-formula new file mode 120000 index 0000000000..0cab079f84 --- /dev/null +++ b/Lang/EDSAC-order-code/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Josephus-problem b/Lang/EDSAC-order-code/Josephus-problem new file mode 120000 index 0000000000..bce73441c6 --- /dev/null +++ b/Lang/EDSAC-order-code/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Magic-squares-of-doubly-even-order b/Lang/EDSAC-order-code/Magic-squares-of-doubly-even-order new file mode 120000 index 0000000000..1753b89dcd --- /dev/null +++ b/Lang/EDSAC-order-code/Magic-squares-of-doubly-even-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-doubly-even-order/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Magic-squares-of-odd-order b/Lang/EDSAC-order-code/Magic-squares-of-odd-order new file mode 120000 index 0000000000..1a44dde0cd --- /dev/null +++ b/Lang/EDSAC-order-code/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Magic-squares-of-singly-even-order b/Lang/EDSAC-order-code/Magic-squares-of-singly-even-order new file mode 120000 index 0000000000..68c523816d --- /dev/null +++ b/Lang/EDSAC-order-code/Magic-squares-of-singly-even-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-singly-even-order/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Maze-generation b/Lang/EDSAC-order-code/Maze-generation new file mode 120000 index 0000000000..93d824a0ca --- /dev/null +++ b/Lang/EDSAC-order-code/Maze-generation @@ -0,0 +1 @@ +../../Task/Maze-generation/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Numerical-integration-Gauss-Legendre-Quadrature b/Lang/EDSAC-order-code/Numerical-integration-Gauss-Legendre-Quadrature new file mode 120000 index 0000000000..f518a6e1fc --- /dev/null +++ b/Lang/EDSAC-order-code/Numerical-integration-Gauss-Legendre-Quadrature @@ -0,0 +1 @@ +../../Task/Numerical-integration-Gauss-Legendre-Quadrature/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Pseudo-random-numbers-Middle-square-method b/Lang/EDSAC-order-code/Pseudo-random-numbers-Middle-square-method new file mode 120000 index 0000000000..9e378bb2f4 --- /dev/null +++ b/Lang/EDSAC-order-code/Pseudo-random-numbers-Middle-square-method @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Middle-square-method/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Pythagorean-quadruples b/Lang/EDSAC-order-code/Pythagorean-quadruples new file mode 120000 index 0000000000..43dfaa296f --- /dev/null +++ b/Lang/EDSAC-order-code/Pythagorean-quadruples @@ -0,0 +1 @@ +../../Task/Pythagorean-quadruples/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Shoelace-formula-for-polygonal-area b/Lang/EDSAC-order-code/Shoelace-formula-for-polygonal-area new file mode 120000 index 0000000000..fb3446e1bf --- /dev/null +++ b/Lang/EDSAC-order-code/Shoelace-formula-for-polygonal-area @@ -0,0 +1 @@ +../../Task/Shoelace-formula-for-polygonal-area/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Sorting-algorithms-Gnome-sort b/Lang/EDSAC-order-code/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..3be03b0294 --- /dev/null +++ b/Lang/EDSAC-order-code/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Statistics-Normal-distribution b/Lang/EDSAC-order-code/Statistics-Normal-distribution new file mode 120000 index 0000000000..8051b92f59 --- /dev/null +++ b/Lang/EDSAC-order-code/Statistics-Normal-distribution @@ -0,0 +1 @@ +../../Task/Statistics-Normal-distribution/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Sum-digits-of-an-integer b/Lang/EDSAC-order-code/Sum-digits-of-an-integer new file mode 120000 index 0000000000..23c793fd07 --- /dev/null +++ b/Lang/EDSAC-order-code/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EDSAC-order-code/Water-collected-between-towers b/Lang/EDSAC-order-code/Water-collected-between-towers new file mode 120000 index 0000000000..7c9456760f --- /dev/null +++ b/Lang/EDSAC-order-code/Water-collected-between-towers @@ -0,0 +1 @@ +../../Task/Water-collected-between-towers/EDSAC-order-code \ No newline at end of file diff --git a/Lang/EMal/00-LANG.txt b/Lang/EMal/00-LANG.txt index 9ecf11d932..3af52fab5c 100644 --- a/Lang/EMal/00-LANG.txt +++ b/Lang/EMal/00-LANG.txt @@ -6,21 +6,23 @@ |site=https://emal-lang.sourceforge.io |tags=emal |gc=yes}} -EMal is a prototyping programming language that supports english and italian syntax. +EMal is a prototyping programming language that supports English and Italian syntax. -EMal wants to be expressive and easy to read. +EMal wants to be expressive and readable. It supports closures, classes, records; it's influenced by Java, Perl, Javascript. -This is an example that, inside the same script, calculates F10 = 55 in english and in italian: +The programming environment consists of an interpreter that directly navigates the AST produced by the parser. + +This is an example that, inside the same script, calculates F10 = 55 in English and in Italian: type FibonacciInEnglish -fun fibonacci = int by int n +fun fibonacci ← int by int n if n < 2 do return n else do return fibonacci(n - 1) + fibonacci(n - 2) end end writeLine(fibonacci(10)) tipo FibonacciInItaliano -funzione fibonacci = intero da intero n +funzione fibonacci ← intero da intero n se n < 2 ritorna n altrimenti diff --git a/Lang/EMal/ABC-problem b/Lang/EMal/ABC-problem new file mode 120000 index 0000000000..4b49dc2baf --- /dev/null +++ b/Lang/EMal/ABC-problem @@ -0,0 +1 @@ +../../Task/ABC-problem/EMal \ No newline at end of file diff --git a/Lang/EMal/Babbage-problem b/Lang/EMal/Babbage-problem new file mode 120000 index 0000000000..8a7db13311 --- /dev/null +++ b/Lang/EMal/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/EMal \ No newline at end of file diff --git a/Lang/EMal/Bifid-cipher b/Lang/EMal/Bifid-cipher new file mode 120000 index 0000000000..1dbee9fec8 --- /dev/null +++ b/Lang/EMal/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/EMal \ No newline at end of file diff --git a/Lang/EMal/Delegates b/Lang/EMal/Delegates new file mode 120000 index 0000000000..5293d68109 --- /dev/null +++ b/Lang/EMal/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/EMal \ No newline at end of file diff --git a/Lang/EMal/Determine-if-a-string-is-squeezable b/Lang/EMal/Determine-if-a-string-is-squeezable new file mode 120000 index 0000000000..27c56fc092 --- /dev/null +++ b/Lang/EMal/Determine-if-a-string-is-squeezable @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-squeezable/EMal \ No newline at end of file diff --git a/Lang/EMal/Dynamic-variable-names b/Lang/EMal/Dynamic-variable-names new file mode 120000 index 0000000000..28a70b20a1 --- /dev/null +++ b/Lang/EMal/Dynamic-variable-names @@ -0,0 +1 @@ +../../Task/Dynamic-variable-names/EMal \ No newline at end of file diff --git a/Lang/EMal/Empty-string b/Lang/EMal/Empty-string new file mode 120000 index 0000000000..a051653333 --- /dev/null +++ b/Lang/EMal/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/EMal \ No newline at end of file diff --git a/Lang/EMal/Environment-variables b/Lang/EMal/Environment-variables new file mode 120000 index 0000000000..04065bea17 --- /dev/null +++ b/Lang/EMal/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/EMal \ No newline at end of file diff --git a/Lang/EMal/FizzBuzz b/Lang/EMal/FizzBuzz new file mode 120000 index 0000000000..7a42e8cf25 --- /dev/null +++ b/Lang/EMal/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/EMal \ No newline at end of file diff --git a/Lang/EMal/Gamma-function b/Lang/EMal/Gamma-function new file mode 120000 index 0000000000..f928139952 --- /dev/null +++ b/Lang/EMal/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/EMal \ No newline at end of file diff --git a/Lang/EMal/Greatest-common-divisor b/Lang/EMal/Greatest-common-divisor new file mode 120000 index 0000000000..5a6de213e1 --- /dev/null +++ b/Lang/EMal/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/EMal \ No newline at end of file diff --git a/Lang/EMal/Guess-the-number b/Lang/EMal/Guess-the-number new file mode 120000 index 0000000000..fc6e3366e6 --- /dev/null +++ b/Lang/EMal/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/EMal \ No newline at end of file diff --git a/Lang/EMal/Halt-and-catch-fire b/Lang/EMal/Halt-and-catch-fire new file mode 120000 index 0000000000..63015fddfa --- /dev/null +++ b/Lang/EMal/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/EMal \ No newline at end of file diff --git a/Lang/EMal/Loops-For b/Lang/EMal/Loops-For new file mode 120000 index 0000000000..ac145e5175 --- /dev/null +++ b/Lang/EMal/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/EMal \ No newline at end of file diff --git a/Lang/EMal/Loops-For-with-a-specified-step b/Lang/EMal/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..420591b041 --- /dev/null +++ b/Lang/EMal/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/EMal \ No newline at end of file diff --git a/Lang/EMal/Loops-Increment-loop-index-within-loop-body b/Lang/EMal/Loops-Increment-loop-index-within-loop-body new file mode 120000 index 0000000000..d82571b9b9 --- /dev/null +++ b/Lang/EMal/Loops-Increment-loop-index-within-loop-body @@ -0,0 +1 @@ +../../Task/Loops-Increment-loop-index-within-loop-body/EMal \ No newline at end of file diff --git a/Lang/EMal/Loops-N-plus-one-half b/Lang/EMal/Loops-N-plus-one-half new file mode 120000 index 0000000000..45adbe30ec --- /dev/null +++ b/Lang/EMal/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/EMal \ No newline at end of file diff --git a/Lang/EMal/Loops-While b/Lang/EMal/Loops-While new file mode 120000 index 0000000000..016c2ea1d7 --- /dev/null +++ b/Lang/EMal/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/EMal \ No newline at end of file diff --git a/Lang/EMal/Mutual-recursion b/Lang/EMal/Mutual-recursion new file mode 120000 index 0000000000..cb3ebc8ca5 --- /dev/null +++ b/Lang/EMal/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/EMal \ No newline at end of file diff --git a/Lang/EMal/Nth-root b/Lang/EMal/Nth-root new file mode 120000 index 0000000000..58e1f9e30f --- /dev/null +++ b/Lang/EMal/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/EMal \ No newline at end of file diff --git a/Lang/EMal/Sorting-algorithms-Bogosort b/Lang/EMal/Sorting-algorithms-Bogosort new file mode 120000 index 0000000000..8dc8cc02d3 --- /dev/null +++ b/Lang/EMal/Sorting-algorithms-Bogosort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bogosort/EMal \ No newline at end of file diff --git a/Lang/EMal/Sorting-algorithms-Bubble-sort b/Lang/EMal/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..53f744e6e9 --- /dev/null +++ b/Lang/EMal/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/EMal \ No newline at end of file diff --git a/Lang/EMal/Sorting-algorithms-Stooge-sort b/Lang/EMal/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..05296c2a09 --- /dev/null +++ b/Lang/EMal/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/EMal \ No newline at end of file diff --git a/Lang/EMal/String-case b/Lang/EMal/String-case new file mode 120000 index 0000000000..8193cfe690 --- /dev/null +++ b/Lang/EMal/String-case @@ -0,0 +1 @@ +../../Task/String-case/EMal \ No newline at end of file diff --git a/Lang/EMal/String-comparison b/Lang/EMal/String-comparison new file mode 120000 index 0000000000..02b430a538 --- /dev/null +++ b/Lang/EMal/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/EMal \ No newline at end of file diff --git a/Lang/EMal/Sudan-function b/Lang/EMal/Sudan-function new file mode 120000 index 0000000000..ea87f1432e --- /dev/null +++ b/Lang/EMal/Sudan-function @@ -0,0 +1 @@ +../../Task/Sudan-function/EMal \ No newline at end of file diff --git a/Lang/EMal/Ternary-logic b/Lang/EMal/Ternary-logic new file mode 120000 index 0000000000..837bedfab5 --- /dev/null +++ b/Lang/EMal/Ternary-logic @@ -0,0 +1 @@ +../../Task/Ternary-logic/EMal \ No newline at end of file diff --git a/Lang/EMal/Towers-of-Hanoi b/Lang/EMal/Towers-of-Hanoi new file mode 120000 index 0000000000..5771f28b4c --- /dev/null +++ b/Lang/EMal/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/EMal \ No newline at end of file diff --git a/Lang/EMal/Tree-traversal b/Lang/EMal/Tree-traversal new file mode 120000 index 0000000000..b693d069a6 --- /dev/null +++ b/Lang/EMal/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/EMal \ No newline at end of file diff --git a/Lang/EMal/User-input-Text b/Lang/EMal/User-input-Text new file mode 120000 index 0000000000..3c00cf11ba --- /dev/null +++ b/Lang/EMal/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/EMal \ No newline at end of file diff --git a/Lang/EMal/Van-Eck-sequence b/Lang/EMal/Van-Eck-sequence new file mode 120000 index 0000000000..45280862ec --- /dev/null +++ b/Lang/EMal/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/EMal \ No newline at end of file diff --git a/Lang/ERRE/Leonardo-numbers b/Lang/ERRE/Leonardo-numbers new file mode 120000 index 0000000000..3e0d0050d1 --- /dev/null +++ b/Lang/ERRE/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/ERRE \ No newline at end of file diff --git a/Lang/ERRE/Quaternion-type b/Lang/ERRE/Quaternion-type deleted file mode 120000 index fcc1edb64e..0000000000 --- a/Lang/ERRE/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/ERRE \ No newline at end of file diff --git a/Lang/EasyLang/00-LANG.txt b/Lang/EasyLang/00-LANG.txt index aa156f93c8..e09a925b83 100644 --- a/Lang/EasyLang/00-LANG.txt +++ b/Lang/EasyLang/00-LANG.txt @@ -1,19 +1,19 @@ {{language |exec=interpreted -|site=https://easylang.dev/ +|site=https://easylang.online/ |parampass=value, reference |safety=safe |express=explicit |checking=static |tags=learning, web canvas}} -[https://easylang.dev/ide/ '''Browser IDE'''] +[https://easylang.online/ide/ '''Browser IDE'''] ''Easylang'' is a (beginners) programming language with built-in commands for graphics output. The statically typed language has a reduced syntax and semantics. Variables do not have to be declared, the data type is encoded in the variable name - as was usual in the earlier home computer BASIC. The data types are strings and numbers (floating point), arrays of strings and numbers, and arrays of arrays. Arrays are 1-based and can grow. Programs compiled into an AST tree run in the browser or in the browser IDE. -[https://easylang.dev/ide/ A browser IDE] with different tutorials, one for beginners, makes programming and learning to program as easy as possible. +[https://easylang.online/ide/ A browser IDE] with different tutorials, one for beginners, makes programming and learning to program as easy as possible. -The finished programs can be easily integrated into a [https://easylang.dev/apps/ website]. +The finished programs can be easily integrated into a [https://easylang.online/apps/ website]. ==Todo== [[Tasks not implemented in EasyLang]] \ No newline at end of file diff --git a/Lang/EasyLang/2048 b/Lang/EasyLang/2048 new file mode 120000 index 0000000000..4a69b16207 --- /dev/null +++ b/Lang/EasyLang/2048 @@ -0,0 +1 @@ +../../Task/2048/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/24-game b/Lang/EasyLang/24-game new file mode 120000 index 0000000000..85da2301e7 --- /dev/null +++ b/Lang/EasyLang/24-game @@ -0,0 +1 @@ +../../Task/24-game/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/9-billion-names-of-God-the-integer b/Lang/EasyLang/9-billion-names-of-God-the-integer new file mode 120000 index 0000000000..eab904ccaa --- /dev/null +++ b/Lang/EasyLang/9-billion-names-of-God-the-integer @@ -0,0 +1 @@ +../../Task/9-billion-names-of-God-the-integer/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/AKS-test-for-primes b/Lang/EasyLang/AKS-test-for-primes new file mode 120000 index 0000000000..fb3fd809a4 --- /dev/null +++ b/Lang/EasyLang/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Abbreviations-automatic b/Lang/EasyLang/Abbreviations-automatic new file mode 120000 index 0000000000..10b2251691 --- /dev/null +++ b/Lang/EasyLang/Abbreviations-automatic @@ -0,0 +1 @@ +../../Task/Abbreviations-automatic/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Abbreviations-easy b/Lang/EasyLang/Abbreviations-easy new file mode 120000 index 0000000000..9f43877f2b --- /dev/null +++ b/Lang/EasyLang/Abbreviations-easy @@ -0,0 +1 @@ +../../Task/Abbreviations-easy/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Abbreviations-simple b/Lang/EasyLang/Abbreviations-simple new file mode 120000 index 0000000000..53295111be --- /dev/null +++ b/Lang/EasyLang/Abbreviations-simple @@ -0,0 +1 @@ +../../Task/Abbreviations-simple/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Abelian-sandpile-model b/Lang/EasyLang/Abelian-sandpile-model new file mode 120000 index 0000000000..c97f3c3aa6 --- /dev/null +++ b/Lang/EasyLang/Abelian-sandpile-model @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Abelian-sandpile-model-Identity b/Lang/EasyLang/Abelian-sandpile-model-Identity new file mode 120000 index 0000000000..c44f8cb53d --- /dev/null +++ b/Lang/EasyLang/Abelian-sandpile-model-Identity @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model-Identity/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Achilles-numbers b/Lang/EasyLang/Achilles-numbers new file mode 120000 index 0000000000..90c0643d0e --- /dev/null +++ b/Lang/EasyLang/Achilles-numbers @@ -0,0 +1 @@ +../../Task/Achilles-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Amb b/Lang/EasyLang/Amb new file mode 120000 index 0000000000..cee73196db --- /dev/null +++ b/Lang/EasyLang/Amb @@ -0,0 +1 @@ +../../Task/Amb/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Anagrams b/Lang/EasyLang/Anagrams new file mode 120000 index 0000000000..1a48ded8aa --- /dev/null +++ b/Lang/EasyLang/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Anagrams-Deranged-anagrams b/Lang/EasyLang/Anagrams-Deranged-anagrams new file mode 120000 index 0000000000..b7af47405b --- /dev/null +++ b/Lang/EasyLang/Anagrams-Deranged-anagrams @@ -0,0 +1 @@ +../../Task/Anagrams-Deranged-anagrams/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Animation b/Lang/EasyLang/Animation new file mode 120000 index 0000000000..a11bf8da48 --- /dev/null +++ b/Lang/EasyLang/Animation @@ -0,0 +1 @@ +../../Task/Animation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Approximate-equality b/Lang/EasyLang/Approximate-equality new file mode 120000 index 0000000000..916cbf0873 --- /dev/null +++ b/Lang/EasyLang/Approximate-equality @@ -0,0 +1 @@ +../../Task/Approximate-equality/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Arithmetic-Complex b/Lang/EasyLang/Arithmetic-Complex new file mode 120000 index 0000000000..547a37cd78 --- /dev/null +++ b/Lang/EasyLang/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Arithmetic-derivative b/Lang/EasyLang/Arithmetic-derivative new file mode 120000 index 0000000000..13a223ff6a --- /dev/null +++ b/Lang/EasyLang/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Associative-array-Merging b/Lang/EasyLang/Associative-array-Merging new file mode 120000 index 0000000000..efe48db36d --- /dev/null +++ b/Lang/EasyLang/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Average-loop-length b/Lang/EasyLang/Average-loop-length new file mode 120000 index 0000000000..adb975f11d --- /dev/null +++ b/Lang/EasyLang/Average-loop-length @@ -0,0 +1 @@ +../../Task/Average-loop-length/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Averages-Mode b/Lang/EasyLang/Averages-Mode new file mode 120000 index 0000000000..3d5aef1b7e --- /dev/null +++ b/Lang/EasyLang/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Averages-Pythagorean-means b/Lang/EasyLang/Averages-Pythagorean-means new file mode 120000 index 0000000000..54e04474ad --- /dev/null +++ b/Lang/EasyLang/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Averages-Simple-moving-average b/Lang/EasyLang/Averages-Simple-moving-average new file mode 120000 index 0000000000..526250f81a --- /dev/null +++ b/Lang/EasyLang/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Babylonian-spiral b/Lang/EasyLang/Babylonian-spiral new file mode 120000 index 0000000000..a141d2cd6b --- /dev/null +++ b/Lang/EasyLang/Babylonian-spiral @@ -0,0 +1 @@ +../../Task/Babylonian-spiral/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Balanced-brackets b/Lang/EasyLang/Balanced-brackets new file mode 120000 index 0000000000..5f2b730d5e --- /dev/null +++ b/Lang/EasyLang/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Benfords-law b/Lang/EasyLang/Benfords-law new file mode 120000 index 0000000000..a907859e75 --- /dev/null +++ b/Lang/EasyLang/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Best-shuffle b/Lang/EasyLang/Best-shuffle new file mode 120000 index 0000000000..56cfd176ba --- /dev/null +++ b/Lang/EasyLang/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Bifid-cipher b/Lang/EasyLang/Bifid-cipher new file mode 120000 index 0000000000..00c9d65ab1 --- /dev/null +++ b/Lang/EasyLang/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Bin-given-limits b/Lang/EasyLang/Bin-given-limits new file mode 120000 index 0000000000..cc28e3775f --- /dev/null +++ b/Lang/EasyLang/Bin-given-limits @@ -0,0 +1 @@ +../../Task/Bin-given-limits/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Bioinformatics-Sequence-mutation b/Lang/EasyLang/Bioinformatics-Sequence-mutation new file mode 120000 index 0000000000..6d30bfa11e --- /dev/null +++ b/Lang/EasyLang/Bioinformatics-Sequence-mutation @@ -0,0 +1 @@ +../../Task/Bioinformatics-Sequence-mutation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Bioinformatics-base-count b/Lang/EasyLang/Bioinformatics-base-count deleted file mode 120000 index 3bc65db849..0000000000 --- a/Lang/EasyLang/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Biorhythms b/Lang/EasyLang/Biorhythms new file mode 120000 index 0000000000..3e8c2b07fa --- /dev/null +++ b/Lang/EasyLang/Biorhythms @@ -0,0 +1 @@ +../../Task/Biorhythms/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Bitmap-B-zier-curves-Quadratic b/Lang/EasyLang/Bitmap-B-zier-curves-Quadratic new file mode 120000 index 0000000000..569a661356 --- /dev/null +++ b/Lang/EasyLang/Bitmap-B-zier-curves-Quadratic @@ -0,0 +1 @@ +../../Task/Bitmap-B-zier-curves-Quadratic/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Bitmap-Bresenhams-line-algorithm b/Lang/EasyLang/Bitmap-Bresenhams-line-algorithm new file mode 120000 index 0000000000..5b05ee202b --- /dev/null +++ b/Lang/EasyLang/Bitmap-Bresenhams-line-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Bresenhams-line-algorithm/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Bitmap-Midpoint-circle-algorithm b/Lang/EasyLang/Bitmap-Midpoint-circle-algorithm new file mode 120000 index 0000000000..9b995802ee --- /dev/null +++ b/Lang/EasyLang/Bitmap-Midpoint-circle-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Midpoint-circle-algorithm/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Box-the-compass b/Lang/EasyLang/Box-the-compass new file mode 120000 index 0000000000..4fd6c85d9d --- /dev/null +++ b/Lang/EasyLang/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Boyer-Moore-string-search b/Lang/EasyLang/Boyer-Moore-string-search new file mode 120000 index 0000000000..189112146a --- /dev/null +++ b/Lang/EasyLang/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Brace-expansion b/Lang/EasyLang/Brace-expansion new file mode 120000 index 0000000000..fadaa7c96a --- /dev/null +++ b/Lang/EasyLang/Brace-expansion @@ -0,0 +1 @@ +../../Task/Brace-expansion/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Brilliant-numbers b/Lang/EasyLang/Brilliant-numbers new file mode 120000 index 0000000000..280a1c45cc --- /dev/null +++ b/Lang/EasyLang/Brilliant-numbers @@ -0,0 +1 @@ +../../Task/Brilliant-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Bulls-and-cows-Player b/Lang/EasyLang/Bulls-and-cows-Player new file mode 120000 index 0000000000..9e4aef5378 --- /dev/null +++ b/Lang/EasyLang/Bulls-and-cows-Player @@ -0,0 +1 @@ +../../Task/Bulls-and-cows-Player/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Burrows-Wheeler-transform b/Lang/EasyLang/Burrows-Wheeler-transform new file mode 120000 index 0000000000..d3dcf6a651 --- /dev/null +++ b/Lang/EasyLang/Burrows-Wheeler-transform @@ -0,0 +1 @@ +../../Task/Burrows-Wheeler-transform/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/CRC-32 b/Lang/EasyLang/CRC-32 new file mode 120000 index 0000000000..75d250a063 --- /dev/null +++ b/Lang/EasyLang/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/CSV-data-manipulation b/Lang/EasyLang/CSV-data-manipulation new file mode 120000 index 0000000000..18ae83328e --- /dev/null +++ b/Lang/EasyLang/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/CSV-to-HTML-translation b/Lang/EasyLang/CSV-to-HTML-translation new file mode 120000 index 0000000000..7a4f03c98e --- /dev/null +++ b/Lang/EasyLang/CSV-to-HTML-translation @@ -0,0 +1 @@ +../../Task/CSV-to-HTML-translation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/CUSIP b/Lang/EasyLang/CUSIP new file mode 120000 index 0000000000..18e1a39668 --- /dev/null +++ b/Lang/EasyLang/CUSIP @@ -0,0 +1 @@ +../../Task/CUSIP/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Caesar-cipher b/Lang/EasyLang/Caesar-cipher new file mode 120000 index 0000000000..1d121f0b00 --- /dev/null +++ b/Lang/EasyLang/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Calendar b/Lang/EasyLang/Calendar new file mode 120000 index 0000000000..a7149967d9 --- /dev/null +++ b/Lang/EasyLang/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Calkin-Wilf-sequence b/Lang/EasyLang/Calkin-Wilf-sequence new file mode 120000 index 0000000000..4e52e0d6e6 --- /dev/null +++ b/Lang/EasyLang/Calkin-Wilf-sequence @@ -0,0 +1 @@ +../../Task/Calkin-Wilf-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Camel-case-and-snake-case b/Lang/EasyLang/Camel-case-and-snake-case new file mode 120000 index 0000000000..0a9d3d035c --- /dev/null +++ b/Lang/EasyLang/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Canonicalize-CIDR b/Lang/EasyLang/Canonicalize-CIDR new file mode 120000 index 0000000000..ef98b51c97 --- /dev/null +++ b/Lang/EasyLang/Canonicalize-CIDR @@ -0,0 +1 @@ +../../Task/Canonicalize-CIDR/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Cantor-set b/Lang/EasyLang/Cantor-set new file mode 120000 index 0000000000..3166a68c95 --- /dev/null +++ b/Lang/EasyLang/Cantor-set @@ -0,0 +1 @@ +../../Task/Cantor-set/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Carmichael-3-strong-pseudoprimes b/Lang/EasyLang/Carmichael-3-strong-pseudoprimes new file mode 120000 index 0000000000..87390cac39 --- /dev/null +++ b/Lang/EasyLang/Carmichael-3-strong-pseudoprimes @@ -0,0 +1 @@ +../../Task/Carmichael-3-strong-pseudoprimes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Cartesian-product-of-two-or-more-lists b/Lang/EasyLang/Cartesian-product-of-two-or-more-lists new file mode 120000 index 0000000000..012d512db6 --- /dev/null +++ b/Lang/EasyLang/Cartesian-product-of-two-or-more-lists @@ -0,0 +1 @@ +../../Task/Cartesian-product-of-two-or-more-lists/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Casting-out-nines b/Lang/EasyLang/Casting-out-nines new file mode 120000 index 0000000000..c70d0861aa --- /dev/null +++ b/Lang/EasyLang/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Chaocipher b/Lang/EasyLang/Chaocipher new file mode 120000 index 0000000000..46e0f46135 --- /dev/null +++ b/Lang/EasyLang/Chaocipher @@ -0,0 +1 @@ +../../Task/Chaocipher/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Cheryls-birthday b/Lang/EasyLang/Cheryls-birthday new file mode 120000 index 0000000000..da4092e3ea --- /dev/null +++ b/Lang/EasyLang/Cheryls-birthday @@ -0,0 +1 @@ +../../Task/Cheryls-birthday/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Chinese-zodiac b/Lang/EasyLang/Chinese-zodiac new file mode 120000 index 0000000000..0eac7aa885 --- /dev/null +++ b/Lang/EasyLang/Chinese-zodiac @@ -0,0 +1 @@ +../../Task/Chinese-zodiac/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Cholesky-decomposition b/Lang/EasyLang/Cholesky-decomposition new file mode 120000 index 0000000000..3d9b8e35d4 --- /dev/null +++ b/Lang/EasyLang/Cholesky-decomposition @@ -0,0 +1 @@ +../../Task/Cholesky-decomposition/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Circles-of-given-radius-through-two-points b/Lang/EasyLang/Circles-of-given-radius-through-two-points new file mode 120000 index 0000000000..86863b1617 --- /dev/null +++ b/Lang/EasyLang/Circles-of-given-radius-through-two-points @@ -0,0 +1 @@ +../../Task/Circles-of-given-radius-through-two-points/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Cistercian-numerals b/Lang/EasyLang/Cistercian-numerals new file mode 120000 index 0000000000..63eb472b3f --- /dev/null +++ b/Lang/EasyLang/Cistercian-numerals @@ -0,0 +1 @@ +../../Task/Cistercian-numerals/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Closest-pair-problem b/Lang/EasyLang/Closest-pair-problem new file mode 120000 index 0000000000..3aef86373f --- /dev/null +++ b/Lang/EasyLang/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Color-wheel b/Lang/EasyLang/Color-wheel new file mode 120000 index 0000000000..c18069acb1 --- /dev/null +++ b/Lang/EasyLang/Color-wheel @@ -0,0 +1 @@ +../../Task/Color-wheel/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Colorful-numbers b/Lang/EasyLang/Colorful-numbers new file mode 120000 index 0000000000..ebe27902b2 --- /dev/null +++ b/Lang/EasyLang/Colorful-numbers @@ -0,0 +1 @@ +../../Task/Colorful-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Colour-pinstripe-Display b/Lang/EasyLang/Colour-pinstripe-Display new file mode 120000 index 0000000000..2e66fb03ab --- /dev/null +++ b/Lang/EasyLang/Colour-pinstripe-Display @@ -0,0 +1 @@ +../../Task/Colour-pinstripe-Display/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Combinations-and-permutations b/Lang/EasyLang/Combinations-and-permutations new file mode 120000 index 0000000000..8cabf1d02c --- /dev/null +++ b/Lang/EasyLang/Combinations-and-permutations @@ -0,0 +1 @@ +../../Task/Combinations-and-permutations/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Comma-quibbling b/Lang/EasyLang/Comma-quibbling new file mode 120000 index 0000000000..2a8720ee6a --- /dev/null +++ b/Lang/EasyLang/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k b/Lang/EasyLang/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k new file mode 120000 index 0000000000..d18afd0e66 --- /dev/null +++ b/Lang/EasyLang/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k @@ -0,0 +1 @@ +../../Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Consecutive-primes-with-ascending-or-descending-differences b/Lang/EasyLang/Consecutive-primes-with-ascending-or-descending-differences new file mode 120000 index 0000000000..4752a5c8c3 --- /dev/null +++ b/Lang/EasyLang/Consecutive-primes-with-ascending-or-descending-differences @@ -0,0 +1 @@ +../../Task/Consecutive-primes-with-ascending-or-descending-differences/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Constrained-random-points-on-a-circle b/Lang/EasyLang/Constrained-random-points-on-a-circle new file mode 120000 index 0000000000..63f4482942 --- /dev/null +++ b/Lang/EasyLang/Constrained-random-points-on-a-circle @@ -0,0 +1 @@ +../../Task/Constrained-random-points-on-a-circle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Convert-decimal-number-to-rational b/Lang/EasyLang/Convert-decimal-number-to-rational new file mode 120000 index 0000000000..d8af3c05f9 --- /dev/null +++ b/Lang/EasyLang/Convert-decimal-number-to-rational @@ -0,0 +1 @@ +../../Task/Convert-decimal-number-to-rational/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Convex-hull b/Lang/EasyLang/Convex-hull new file mode 120000 index 0000000000..9e70f24915 --- /dev/null +++ b/Lang/EasyLang/Convex-hull @@ -0,0 +1 @@ +../../Task/Convex-hull/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Cramers-rule b/Lang/EasyLang/Cramers-rule new file mode 120000 index 0000000000..15d86e7ebe --- /dev/null +++ b/Lang/EasyLang/Cramers-rule @@ -0,0 +1 @@ +../../Task/Cramers-rule/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Create-a-two-dimensional-array-at-runtime b/Lang/EasyLang/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..9ab5d02120 --- /dev/null +++ b/Lang/EasyLang/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Create-an-HTML-table b/Lang/EasyLang/Create-an-HTML-table new file mode 120000 index 0000000000..977757451c --- /dev/null +++ b/Lang/EasyLang/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Cuban-primes b/Lang/EasyLang/Cuban-primes new file mode 120000 index 0000000000..602fb8a030 --- /dev/null +++ b/Lang/EasyLang/Cuban-primes @@ -0,0 +1 @@ +../../Task/Cuban-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Currency b/Lang/EasyLang/Currency new file mode 120000 index 0000000000..a42c848ea8 --- /dev/null +++ b/Lang/EasyLang/Currency @@ -0,0 +1 @@ +../../Task/Currency/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Cut-a-rectangle b/Lang/EasyLang/Cut-a-rectangle new file mode 120000 index 0000000000..879a5ce073 --- /dev/null +++ b/Lang/EasyLang/Cut-a-rectangle @@ -0,0 +1 @@ +../../Task/Cut-a-rectangle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Cyclops-numbers b/Lang/EasyLang/Cyclops-numbers new file mode 120000 index 0000000000..6df72e0544 --- /dev/null +++ b/Lang/EasyLang/Cyclops-numbers @@ -0,0 +1 @@ +../../Task/Cyclops-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Damm-algorithm b/Lang/EasyLang/Damm-algorithm new file mode 120000 index 0000000000..d7f6db29b1 --- /dev/null +++ b/Lang/EasyLang/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Date-format b/Lang/EasyLang/Date-format new file mode 120000 index 0000000000..443f76ed6a --- /dev/null +++ b/Lang/EasyLang/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/De-Bruijn-sequences b/Lang/EasyLang/De-Bruijn-sequences new file mode 120000 index 0000000000..faba25f06a --- /dev/null +++ b/Lang/EasyLang/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Deal-cards-for-FreeCell b/Lang/EasyLang/Deal-cards-for-FreeCell new file mode 120000 index 0000000000..9d47d59041 --- /dev/null +++ b/Lang/EasyLang/Deal-cards-for-FreeCell @@ -0,0 +1 @@ +../../Task/Deal-cards-for-FreeCell/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Death-Star b/Lang/EasyLang/Death-Star new file mode 120000 index 0000000000..71ec2dde3d --- /dev/null +++ b/Lang/EasyLang/Death-Star @@ -0,0 +1 @@ +../../Task/Death-Star/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Deceptive-numbers b/Lang/EasyLang/Deceptive-numbers new file mode 120000 index 0000000000..eae8f8459d --- /dev/null +++ b/Lang/EasyLang/Deceptive-numbers @@ -0,0 +1 @@ +../../Task/Deceptive-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Deconvolution-1D b/Lang/EasyLang/Deconvolution-1D new file mode 120000 index 0000000000..7dba9ab208 --- /dev/null +++ b/Lang/EasyLang/Deconvolution-1D @@ -0,0 +1 @@ +../../Task/Deconvolution-1D/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Deepcopy b/Lang/EasyLang/Deepcopy new file mode 120000 index 0000000000..4137c6d590 --- /dev/null +++ b/Lang/EasyLang/Deepcopy @@ -0,0 +1 @@ +../../Task/Deepcopy/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Demings-funnel b/Lang/EasyLang/Demings-funnel new file mode 120000 index 0000000000..d19d38286f --- /dev/null +++ b/Lang/EasyLang/Demings-funnel @@ -0,0 +1 @@ +../../Task/Demings-funnel/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Descending-primes b/Lang/EasyLang/Descending-primes new file mode 120000 index 0000000000..2cdfe30a0e --- /dev/null +++ b/Lang/EasyLang/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Determinant-and-permanent b/Lang/EasyLang/Determinant-and-permanent new file mode 120000 index 0000000000..09ae422506 --- /dev/null +++ b/Lang/EasyLang/Determinant-and-permanent @@ -0,0 +1 @@ +../../Task/Determinant-and-permanent/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Determine-if-a-string-is-collapsible b/Lang/EasyLang/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..05c87ac5e5 --- /dev/null +++ b/Lang/EasyLang/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Determine-if-a-string-is-squeezable b/Lang/EasyLang/Determine-if-a-string-is-squeezable new file mode 120000 index 0000000000..3684f2848c --- /dev/null +++ b/Lang/EasyLang/Determine-if-a-string-is-squeezable @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-squeezable/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Determine-if-two-triangles-overlap b/Lang/EasyLang/Determine-if-two-triangles-overlap new file mode 120000 index 0000000000..94cb794e8e --- /dev/null +++ b/Lang/EasyLang/Determine-if-two-triangles-overlap @@ -0,0 +1 @@ +../../Task/Determine-if-two-triangles-overlap/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Determine-sentence-type b/Lang/EasyLang/Determine-sentence-type new file mode 120000 index 0000000000..191e85776f --- /dev/null +++ b/Lang/EasyLang/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Dice-game-probabilities b/Lang/EasyLang/Dice-game-probabilities new file mode 120000 index 0000000000..5267c4bcfb --- /dev/null +++ b/Lang/EasyLang/Dice-game-probabilities @@ -0,0 +1 @@ +../../Task/Dice-game-probabilities/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Digital-root-Multiplicative-digital-root b/Lang/EasyLang/Digital-root-Multiplicative-digital-root new file mode 120000 index 0000000000..c1e68a7fcb --- /dev/null +++ b/Lang/EasyLang/Digital-root-Multiplicative-digital-root @@ -0,0 +1 @@ +../../Task/Digital-root-Multiplicative-digital-root/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Dijkstras-algorithm b/Lang/EasyLang/Dijkstras-algorithm new file mode 120000 index 0000000000..de47a7cc8f --- /dev/null +++ b/Lang/EasyLang/Dijkstras-algorithm @@ -0,0 +1 @@ +../../Task/Dijkstras-algorithm/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Dinesmans-multiple-dwelling-problem b/Lang/EasyLang/Dinesmans-multiple-dwelling-problem new file mode 120000 index 0000000000..09fc1d4edc --- /dev/null +++ b/Lang/EasyLang/Dinesmans-multiple-dwelling-problem @@ -0,0 +1 @@ +../../Task/Dinesmans-multiple-dwelling-problem/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Disarium-numbers b/Lang/EasyLang/Disarium-numbers new file mode 120000 index 0000000000..f7a091cb49 --- /dev/null +++ b/Lang/EasyLang/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Discordian-date b/Lang/EasyLang/Discordian-date new file mode 120000 index 0000000000..637d22e417 --- /dev/null +++ b/Lang/EasyLang/Discordian-date @@ -0,0 +1 @@ +../../Task/Discordian-date/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Display-a-linear-combination b/Lang/EasyLang/Display-a-linear-combination new file mode 120000 index 0000000000..e045995ad6 --- /dev/null +++ b/Lang/EasyLang/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Distribution-of-0-digits-in-factorial-series b/Lang/EasyLang/Distribution-of-0-digits-in-factorial-series new file mode 120000 index 0000000000..10532131de --- /dev/null +++ b/Lang/EasyLang/Distribution-of-0-digits-in-factorial-series @@ -0,0 +1 @@ +../../Task/Distribution-of-0-digits-in-factorial-series/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Diversity-prediction-theorem b/Lang/EasyLang/Diversity-prediction-theorem new file mode 120000 index 0000000000..794b1e0805 --- /dev/null +++ b/Lang/EasyLang/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Doomsday-rule b/Lang/EasyLang/Doomsday-rule new file mode 120000 index 0000000000..f576833747 --- /dev/null +++ b/Lang/EasyLang/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Draw-a-cuboid b/Lang/EasyLang/Draw-a-cuboid new file mode 120000 index 0000000000..bc7664226a --- /dev/null +++ b/Lang/EasyLang/Draw-a-cuboid @@ -0,0 +1 @@ +../../Task/Draw-a-cuboid/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Draw-a-sphere b/Lang/EasyLang/Draw-a-sphere new file mode 120000 index 0000000000..4a92493ec5 --- /dev/null +++ b/Lang/EasyLang/Draw-a-sphere @@ -0,0 +1 @@ +../../Task/Draw-a-sphere/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Duffinian-numbers b/Lang/EasyLang/Duffinian-numbers new file mode 120000 index 0000000000..75befe0bb1 --- /dev/null +++ b/Lang/EasyLang/Duffinian-numbers @@ -0,0 +1 @@ +../../Task/Duffinian-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Dutch-national-flag-problem b/Lang/EasyLang/Dutch-national-flag-problem new file mode 120000 index 0000000000..09cb24ca60 --- /dev/null +++ b/Lang/EasyLang/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/EKG-sequence-convergence b/Lang/EasyLang/EKG-sequence-convergence new file mode 120000 index 0000000000..a5d661cade --- /dev/null +++ b/Lang/EasyLang/EKG-sequence-convergence @@ -0,0 +1 @@ +../../Task/EKG-sequence-convergence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Earliest-difference-between-prime-gaps b/Lang/EasyLang/Earliest-difference-between-prime-gaps new file mode 120000 index 0000000000..e8abb13bc1 --- /dev/null +++ b/Lang/EasyLang/Earliest-difference-between-prime-gaps @@ -0,0 +1 @@ +../../Task/Earliest-difference-between-prime-gaps/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Egyptian-division b/Lang/EasyLang/Egyptian-division new file mode 120000 index 0000000000..8d011b8470 --- /dev/null +++ b/Lang/EasyLang/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Element-wise-operations b/Lang/EasyLang/Element-wise-operations new file mode 120000 index 0000000000..79d10fbb82 --- /dev/null +++ b/Lang/EasyLang/Element-wise-operations @@ -0,0 +1 @@ +../../Task/Element-wise-operations/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Elementary-cellular-automaton b/Lang/EasyLang/Elementary-cellular-automaton new file mode 120000 index 0000000000..14cf04ae05 --- /dev/null +++ b/Lang/EasyLang/Elementary-cellular-automaton @@ -0,0 +1 @@ +../../Task/Elementary-cellular-automaton/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Elementary-cellular-automaton-Infinite-length b/Lang/EasyLang/Elementary-cellular-automaton-Infinite-length new file mode 120000 index 0000000000..440a0e3168 --- /dev/null +++ b/Lang/EasyLang/Elementary-cellular-automaton-Infinite-length @@ -0,0 +1 @@ +../../Task/Elementary-cellular-automaton-Infinite-length/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Emirp-primes b/Lang/EasyLang/Emirp-primes new file mode 120000 index 0000000000..59db016c15 --- /dev/null +++ b/Lang/EasyLang/Emirp-primes @@ -0,0 +1 @@ +../../Task/Emirp-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Empty-program b/Lang/EasyLang/Empty-program new file mode 120000 index 0000000000..833f921ffb --- /dev/null +++ b/Lang/EasyLang/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Equal-prime-and-composite-sums b/Lang/EasyLang/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..d416ab6d61 --- /dev/null +++ b/Lang/EasyLang/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Equilibrium-index b/Lang/EasyLang/Equilibrium-index new file mode 120000 index 0000000000..165c2ae56a --- /dev/null +++ b/Lang/EasyLang/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Erd-s-Nicolas-numbers b/Lang/EasyLang/Erd-s-Nicolas-numbers new file mode 120000 index 0000000000..83838eb37b --- /dev/null +++ b/Lang/EasyLang/Erd-s-Nicolas-numbers @@ -0,0 +1 @@ +../../Task/Erd-s-Nicolas-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Erd-s-Selfridge-categorization-of-primes b/Lang/EasyLang/Erd-s-Selfridge-categorization-of-primes new file mode 120000 index 0000000000..a64dc7d4f0 --- /dev/null +++ b/Lang/EasyLang/Erd-s-Selfridge-categorization-of-primes @@ -0,0 +1 @@ +../../Task/Erd-s-Selfridge-categorization-of-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Esthetic-numbers b/Lang/EasyLang/Esthetic-numbers new file mode 120000 index 0000000000..17ae4253cc --- /dev/null +++ b/Lang/EasyLang/Esthetic-numbers @@ -0,0 +1 @@ +../../Task/Esthetic-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Euclid-Mullin-sequence b/Lang/EasyLang/Euclid-Mullin-sequence new file mode 120000 index 0000000000..465875e6ff --- /dev/null +++ b/Lang/EasyLang/Euclid-Mullin-sequence @@ -0,0 +1 @@ +../../Task/Euclid-Mullin-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Euler-method b/Lang/EasyLang/Euler-method new file mode 120000 index 0000000000..6d314b22d5 --- /dev/null +++ b/Lang/EasyLang/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Eulers-constant-0.5772... b/Lang/EasyLang/Eulers-constant-0.5772... new file mode 120000 index 0000000000..481b218714 --- /dev/null +++ b/Lang/EasyLang/Eulers-constant-0.5772... @@ -0,0 +1 @@ +../../Task/Eulers-constant-0.5772.../EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Eulers-identity b/Lang/EasyLang/Eulers-identity new file mode 120000 index 0000000000..6753a604ea --- /dev/null +++ b/Lang/EasyLang/Eulers-identity @@ -0,0 +1 @@ +../../Task/Eulers-identity/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Evaluate-binomial-coefficients b/Lang/EasyLang/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..ca9734f276 --- /dev/null +++ b/Lang/EasyLang/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Events b/Lang/EasyLang/Events new file mode 120000 index 0000000000..84019d59c2 --- /dev/null +++ b/Lang/EasyLang/Events @@ -0,0 +1 @@ +../../Task/Events/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Evolutionary-algorithm b/Lang/EasyLang/Evolutionary-algorithm new file mode 120000 index 0000000000..1e38bedd7f --- /dev/null +++ b/Lang/EasyLang/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Execute-Brain- b/Lang/EasyLang/Execute-Brain- new file mode 120000 index 0000000000..f895a53826 --- /dev/null +++ b/Lang/EasyLang/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Execute-Computer-Zero b/Lang/EasyLang/Execute-Computer-Zero new file mode 120000 index 0000000000..49e608b246 --- /dev/null +++ b/Lang/EasyLang/Execute-Computer-Zero @@ -0,0 +1 @@ +../../Task/Execute-Computer-Zero/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Execute-HQ9+ b/Lang/EasyLang/Execute-HQ9+ new file mode 120000 index 0000000000..aa3358e92d --- /dev/null +++ b/Lang/EasyLang/Execute-HQ9+ @@ -0,0 +1 @@ +../../Task/Execute-HQ9+/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Execute-SNUSP b/Lang/EasyLang/Execute-SNUSP new file mode 120000 index 0000000000..d27fd2f524 --- /dev/null +++ b/Lang/EasyLang/Execute-SNUSP @@ -0,0 +1 @@ +../../Task/Execute-SNUSP/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Exponentiation-order b/Lang/EasyLang/Exponentiation-order new file mode 120000 index 0000000000..de7c440428 --- /dev/null +++ b/Lang/EasyLang/Exponentiation-order @@ -0,0 +1 @@ +../../Task/Exponentiation-order/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Exponentiation-with-infix-operators-in-or-operating-on-the-base b/Lang/EasyLang/Exponentiation-with-infix-operators-in-or-operating-on-the-base new file mode 120000 index 0000000000..131a7d1381 --- /dev/null +++ b/Lang/EasyLang/Exponentiation-with-infix-operators-in-or-operating-on-the-base @@ -0,0 +1 @@ +../../Task/Exponentiation-with-infix-operators-in-or-operating-on-the-base/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Extensible-prime-generator b/Lang/EasyLang/Extensible-prime-generator new file mode 120000 index 0000000000..6415b07f48 --- /dev/null +++ b/Lang/EasyLang/Extensible-prime-generator @@ -0,0 +1 @@ +../../Task/Extensible-prime-generator/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Extreme-floating-point-values b/Lang/EasyLang/Extreme-floating-point-values new file mode 120000 index 0000000000..8c4ae21587 --- /dev/null +++ b/Lang/EasyLang/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/FASTA-format b/Lang/EasyLang/FASTA-format new file mode 120000 index 0000000000..ca29d4ff3f --- /dev/null +++ b/Lang/EasyLang/FASTA-format @@ -0,0 +1 @@ +../../Task/FASTA-format/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Factorial-primes b/Lang/EasyLang/Factorial-primes new file mode 120000 index 0000000000..6eb3f0a8b6 --- /dev/null +++ b/Lang/EasyLang/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Factorions b/Lang/EasyLang/Factorions new file mode 120000 index 0000000000..52bf4a578c --- /dev/null +++ b/Lang/EasyLang/Factorions @@ -0,0 +1 @@ +../../Task/Factorions/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Factors-of-a-Mersenne-number b/Lang/EasyLang/Factors-of-a-Mersenne-number new file mode 120000 index 0000000000..3539cc5a50 --- /dev/null +++ b/Lang/EasyLang/Factors-of-a-Mersenne-number @@ -0,0 +1 @@ +../../Task/Factors-of-a-Mersenne-number/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Fast-Fourier-transform b/Lang/EasyLang/Fast-Fourier-transform new file mode 120000 index 0000000000..6486d41d10 --- /dev/null +++ b/Lang/EasyLang/Fast-Fourier-transform @@ -0,0 +1 @@ +../../Task/Fast-Fourier-transform/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Faulhabers-formula b/Lang/EasyLang/Faulhabers-formula new file mode 120000 index 0000000000..a0587d4c22 --- /dev/null +++ b/Lang/EasyLang/Faulhabers-formula @@ -0,0 +1 @@ +../../Task/Faulhabers-formula/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Faulhabers-triangle b/Lang/EasyLang/Faulhabers-triangle new file mode 120000 index 0000000000..0ced82832c --- /dev/null +++ b/Lang/EasyLang/Faulhabers-triangle @@ -0,0 +1 @@ +../../Task/Faulhabers-triangle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Feigenbaum-constant-calculation b/Lang/EasyLang/Feigenbaum-constant-calculation new file mode 120000 index 0000000000..0bc8f6925c --- /dev/null +++ b/Lang/EasyLang/Feigenbaum-constant-calculation @@ -0,0 +1 @@ +../../Task/Feigenbaum-constant-calculation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Fermat-numbers b/Lang/EasyLang/Fermat-numbers new file mode 120000 index 0000000000..0bf9bf359c --- /dev/null +++ b/Lang/EasyLang/Fermat-numbers @@ -0,0 +1 @@ +../../Task/Fermat-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Fibonacci-n-step-number-sequences b/Lang/EasyLang/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..164fc80462 --- /dev/null +++ b/Lang/EasyLang/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Fibonacci-word b/Lang/EasyLang/Fibonacci-word new file mode 120000 index 0000000000..a05179a237 --- /dev/null +++ b/Lang/EasyLang/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Fibonacci-word-fractal b/Lang/EasyLang/Fibonacci-word-fractal new file mode 120000 index 0000000000..d075c27d88 --- /dev/null +++ b/Lang/EasyLang/Fibonacci-word-fractal @@ -0,0 +1 @@ +../../Task/Fibonacci-word-fractal/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/File-extension-is-in-extensions-list b/Lang/EasyLang/File-extension-is-in-extensions-list new file mode 120000 index 0000000000..6f2ec30cd2 --- /dev/null +++ b/Lang/EasyLang/File-extension-is-in-extensions-list @@ -0,0 +1 @@ +../../Task/File-extension-is-in-extensions-list/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Find-Chess960-starting-position-identifier b/Lang/EasyLang/Find-Chess960-starting-position-identifier new file mode 120000 index 0000000000..74db5136c0 --- /dev/null +++ b/Lang/EasyLang/Find-Chess960-starting-position-identifier @@ -0,0 +1 @@ +../../Task/Find-Chess960-starting-position-identifier/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Find-if-a-point-is-within-a-triangle b/Lang/EasyLang/Find-if-a-point-is-within-a-triangle new file mode 120000 index 0000000000..cd1bb80075 --- /dev/null +++ b/Lang/EasyLang/Find-if-a-point-is-within-a-triangle @@ -0,0 +1 @@ +../../Task/Find-if-a-point-is-within-a-triangle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Find-palindromic-numbers-in-both-binary-and-ternary-bases b/Lang/EasyLang/Find-palindromic-numbers-in-both-binary-and-ternary-bases new file mode 120000 index 0000000000..3aca354001 --- /dev/null +++ b/Lang/EasyLang/Find-palindromic-numbers-in-both-binary-and-ternary-bases @@ -0,0 +1 @@ +../../Task/Find-palindromic-numbers-in-both-binary-and-ternary-bases/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Find-the-intersection-of-two-lines b/Lang/EasyLang/Find-the-intersection-of-two-lines new file mode 120000 index 0000000000..cffadf31bc --- /dev/null +++ b/Lang/EasyLang/Find-the-intersection-of-two-lines @@ -0,0 +1 @@ +../../Task/Find-the-intersection-of-two-lines/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Find-the-last-Sunday-of-each-month b/Lang/EasyLang/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..967f81859a --- /dev/null +++ b/Lang/EasyLang/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Find-the-missing-permutation b/Lang/EasyLang/Find-the-missing-permutation new file mode 120000 index 0000000000..062fcb8e1c --- /dev/null +++ b/Lang/EasyLang/Find-the-missing-permutation @@ -0,0 +1 @@ +../../Task/Find-the-missing-permutation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/First-perfect-square-in-base-n-with-n-unique-digits b/Lang/EasyLang/First-perfect-square-in-base-n-with-n-unique-digits new file mode 120000 index 0000000000..cef6960be2 --- /dev/null +++ b/Lang/EasyLang/First-perfect-square-in-base-n-with-n-unique-digits @@ -0,0 +1 @@ +../../Task/First-perfect-square-in-base-n-with-n-unique-digits/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/First-power-of-2-that-has-leading-decimal-digits-of-12 b/Lang/EasyLang/First-power-of-2-that-has-leading-decimal-digits-of-12 new file mode 120000 index 0000000000..0246bc2ab7 --- /dev/null +++ b/Lang/EasyLang/First-power-of-2-that-has-leading-decimal-digits-of-12 @@ -0,0 +1 @@ +../../Task/First-power-of-2-that-has-leading-decimal-digits-of-12/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Five-weekends b/Lang/EasyLang/Five-weekends new file mode 120000 index 0000000000..1465857f84 --- /dev/null +++ b/Lang/EasyLang/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Fivenum b/Lang/EasyLang/Fivenum new file mode 120000 index 0000000000..48a3ffd336 --- /dev/null +++ b/Lang/EasyLang/Fivenum @@ -0,0 +1 @@ +../../Task/Fivenum/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Flow-control-structures b/Lang/EasyLang/Flow-control-structures new file mode 120000 index 0000000000..c22991f348 --- /dev/null +++ b/Lang/EasyLang/Flow-control-structures @@ -0,0 +1 @@ +../../Task/Flow-control-structures/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Floyd-Warshall-algorithm b/Lang/EasyLang/Floyd-Warshall-algorithm new file mode 120000 index 0000000000..3210a33bb1 --- /dev/null +++ b/Lang/EasyLang/Floyd-Warshall-algorithm @@ -0,0 +1 @@ +../../Task/Floyd-Warshall-algorithm/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Floyds-triangle b/Lang/EasyLang/Floyds-triangle new file mode 120000 index 0000000000..59c29e05b0 --- /dev/null +++ b/Lang/EasyLang/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Fortunate-numbers b/Lang/EasyLang/Fortunate-numbers new file mode 120000 index 0000000000..2c6e02874b --- /dev/null +++ b/Lang/EasyLang/Fortunate-numbers @@ -0,0 +1 @@ +../../Task/Fortunate-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Forward-difference b/Lang/EasyLang/Forward-difference new file mode 120000 index 0000000000..12de7eedb0 --- /dev/null +++ b/Lang/EasyLang/Forward-difference @@ -0,0 +1 @@ +../../Task/Forward-difference/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Four-bit-adder b/Lang/EasyLang/Four-bit-adder new file mode 120000 index 0000000000..aa95757586 --- /dev/null +++ b/Lang/EasyLang/Four-bit-adder @@ -0,0 +1 @@ +../../Task/Four-bit-adder/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Four-is-magic b/Lang/EasyLang/Four-is-magic new file mode 120000 index 0000000000..12775a7d16 --- /dev/null +++ b/Lang/EasyLang/Four-is-magic @@ -0,0 +1 @@ +../../Task/Four-is-magic/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Fraction-reduction b/Lang/EasyLang/Fraction-reduction new file mode 120000 index 0000000000..61af524020 --- /dev/null +++ b/Lang/EasyLang/Fraction-reduction @@ -0,0 +1 @@ +../../Task/Fraction-reduction/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Fractran b/Lang/EasyLang/Fractran new file mode 120000 index 0000000000..431453ab79 --- /dev/null +++ b/Lang/EasyLang/Fractran @@ -0,0 +1 @@ +../../Task/Fractran/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/French-Republican-calendar b/Lang/EasyLang/French-Republican-calendar new file mode 120000 index 0000000000..63cacd897e --- /dev/null +++ b/Lang/EasyLang/French-Republican-calendar @@ -0,0 +1 @@ +../../Task/French-Republican-calendar/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Function-prototype b/Lang/EasyLang/Function-prototype new file mode 120000 index 0000000000..d56b3a5da3 --- /dev/null +++ b/Lang/EasyLang/Function-prototype @@ -0,0 +1 @@ +../../Task/Function-prototype/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Fusc-sequence b/Lang/EasyLang/Fusc-sequence new file mode 120000 index 0000000000..d1a5af47df --- /dev/null +++ b/Lang/EasyLang/Fusc-sequence @@ -0,0 +1 @@ +../../Task/Fusc-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Galton-box-animation b/Lang/EasyLang/Galton-box-animation new file mode 120000 index 0000000000..afd1fd5e74 --- /dev/null +++ b/Lang/EasyLang/Galton-box-animation @@ -0,0 +1 @@ +../../Task/Galton-box-animation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Gamma-function b/Lang/EasyLang/Gamma-function new file mode 120000 index 0000000000..16283d7c69 --- /dev/null +++ b/Lang/EasyLang/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Gapful-numbers b/Lang/EasyLang/Gapful-numbers new file mode 120000 index 0000000000..2017e0e11f --- /dev/null +++ b/Lang/EasyLang/Gapful-numbers @@ -0,0 +1 @@ +../../Task/Gapful-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Gauss-Jordan-matrix-inversion b/Lang/EasyLang/Gauss-Jordan-matrix-inversion new file mode 120000 index 0000000000..4edf8b08eb --- /dev/null +++ b/Lang/EasyLang/Gauss-Jordan-matrix-inversion @@ -0,0 +1 @@ +../../Task/Gauss-Jordan-matrix-inversion/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Gaussian-elimination b/Lang/EasyLang/Gaussian-elimination new file mode 120000 index 0000000000..3600b047b6 --- /dev/null +++ b/Lang/EasyLang/Gaussian-elimination @@ -0,0 +1 @@ +../../Task/Gaussian-elimination/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/General-FizzBuzz b/Lang/EasyLang/General-FizzBuzz new file mode 120000 index 0000000000..c74a1c59eb --- /dev/null +++ b/Lang/EasyLang/General-FizzBuzz @@ -0,0 +1 @@ +../../Task/General-FizzBuzz/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Generate-Chess960-starting-position b/Lang/EasyLang/Generate-Chess960-starting-position new file mode 120000 index 0000000000..7aebe5f336 --- /dev/null +++ b/Lang/EasyLang/Generate-Chess960-starting-position @@ -0,0 +1 @@ +../../Task/Generate-Chess960-starting-position/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Gray-code b/Lang/EasyLang/Gray-code new file mode 120000 index 0000000000..0807a99d28 --- /dev/null +++ b/Lang/EasyLang/Gray-code @@ -0,0 +1 @@ +../../Task/Gray-code/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Greatest-subsequential-sum b/Lang/EasyLang/Greatest-subsequential-sum new file mode 120000 index 0000000000..679d3c6deb --- /dev/null +++ b/Lang/EasyLang/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Guess-the-number-With-feedback-player- b/Lang/EasyLang/Guess-the-number-With-feedback-player- new file mode 120000 index 0000000000..56ad8fd02a --- /dev/null +++ b/Lang/EasyLang/Guess-the-number-With-feedback-player- @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback-player-/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Hailstone-sequence b/Lang/EasyLang/Hailstone-sequence new file mode 120000 index 0000000000..164d38791c --- /dev/null +++ b/Lang/EasyLang/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Halt-and-catch-fire b/Lang/EasyLang/Halt-and-catch-fire new file mode 120000 index 0000000000..fe61f64c40 --- /dev/null +++ b/Lang/EasyLang/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Hamming-numbers b/Lang/EasyLang/Hamming-numbers new file mode 120000 index 0000000000..6f52ef2c78 --- /dev/null +++ b/Lang/EasyLang/Hamming-numbers @@ -0,0 +1 @@ +../../Task/Hamming-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Happy-numbers b/Lang/EasyLang/Happy-numbers new file mode 120000 index 0000000000..c4ab4d4ef3 --- /dev/null +++ b/Lang/EasyLang/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Harmonic-series b/Lang/EasyLang/Harmonic-series new file mode 120000 index 0000000000..06ca0ca4a5 --- /dev/null +++ b/Lang/EasyLang/Harmonic-series @@ -0,0 +1 @@ +../../Task/Harmonic-series/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Harshad-or-Niven-series b/Lang/EasyLang/Harshad-or-Niven-series new file mode 120000 index 0000000000..3452b1b733 --- /dev/null +++ b/Lang/EasyLang/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Hash-from-two-arrays b/Lang/EasyLang/Hash-from-two-arrays new file mode 120000 index 0000000000..0d148a2df3 --- /dev/null +++ b/Lang/EasyLang/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Haversine-formula b/Lang/EasyLang/Haversine-formula new file mode 120000 index 0000000000..add760760e --- /dev/null +++ b/Lang/EasyLang/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Here-document b/Lang/EasyLang/Here-document new file mode 120000 index 0000000000..55d2509af0 --- /dev/null +++ b/Lang/EasyLang/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Heronian-triangles b/Lang/EasyLang/Heronian-triangles new file mode 120000 index 0000000000..8656dc59f0 --- /dev/null +++ b/Lang/EasyLang/Heronian-triangles @@ -0,0 +1 @@ +../../Task/Heronian-triangles/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Hex-words b/Lang/EasyLang/Hex-words new file mode 120000 index 0000000000..0d39e2eee9 --- /dev/null +++ b/Lang/EasyLang/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Hofstadter-Conway-$10-000-sequence b/Lang/EasyLang/Hofstadter-Conway-$10-000-sequence new file mode 120000 index 0000000000..13e3a43372 --- /dev/null +++ b/Lang/EasyLang/Hofstadter-Conway-$10-000-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Conway-$10-000-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Hofstadter-Figure-Figure-sequences b/Lang/EasyLang/Hofstadter-Figure-Figure-sequences new file mode 120000 index 0000000000..d5a34b275d --- /dev/null +++ b/Lang/EasyLang/Hofstadter-Figure-Figure-sequences @@ -0,0 +1 @@ +../../Task/Hofstadter-Figure-Figure-sequences/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Hofstadter-Q-sequence b/Lang/EasyLang/Hofstadter-Q-sequence new file mode 120000 index 0000000000..f26e722f60 --- /dev/null +++ b/Lang/EasyLang/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Honeycombs b/Lang/EasyLang/Honeycombs new file mode 120000 index 0000000000..5885102888 --- /dev/null +++ b/Lang/EasyLang/Honeycombs @@ -0,0 +1 @@ +../../Task/Honeycombs/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Horners-rule-for-polynomial-evaluation b/Lang/EasyLang/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..c1ae14c36b --- /dev/null +++ b/Lang/EasyLang/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Humble-numbers b/Lang/EasyLang/Humble-numbers new file mode 120000 index 0000000000..8f9c0f4eae --- /dev/null +++ b/Lang/EasyLang/Humble-numbers @@ -0,0 +1 @@ +../../Task/Humble-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Hunt-the-Wumpus b/Lang/EasyLang/Hunt-the-Wumpus new file mode 120000 index 0000000000..8a2489577d --- /dev/null +++ b/Lang/EasyLang/Hunt-the-Wumpus @@ -0,0 +1 @@ +../../Task/Hunt-the-Wumpus/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/IBAN b/Lang/EasyLang/IBAN new file mode 120000 index 0000000000..961014b963 --- /dev/null +++ b/Lang/EasyLang/IBAN @@ -0,0 +1 @@ +../../Task/IBAN/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols b/Lang/EasyLang/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols new file mode 120000 index 0000000000..ff1573925b --- /dev/null +++ b/Lang/EasyLang/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols @@ -0,0 +1 @@ +../../Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Im-a-software-engineer-get-me-out-of-here b/Lang/EasyLang/Im-a-software-engineer-get-me-out-of-here new file mode 120000 index 0000000000..70ace224d9 --- /dev/null +++ b/Lang/EasyLang/Im-a-software-engineer-get-me-out-of-here @@ -0,0 +1 @@ +../../Task/Im-a-software-engineer-get-me-out-of-here/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Image-noise b/Lang/EasyLang/Image-noise new file mode 120000 index 0000000000..da8d100ac1 --- /dev/null +++ b/Lang/EasyLang/Image-noise @@ -0,0 +1 @@ +../../Task/Image-noise/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Increasing-gaps-between-consecutive-Niven-numbers b/Lang/EasyLang/Increasing-gaps-between-consecutive-Niven-numbers new file mode 120000 index 0000000000..2b4a5b83cc --- /dev/null +++ b/Lang/EasyLang/Increasing-gaps-between-consecutive-Niven-numbers @@ -0,0 +1 @@ +../../Task/Increasing-gaps-between-consecutive-Niven-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Infinity b/Lang/EasyLang/Infinity new file mode 120000 index 0000000000..56d94eeddb --- /dev/null +++ b/Lang/EasyLang/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Isograms-and-heterograms b/Lang/EasyLang/Isograms-and-heterograms new file mode 120000 index 0000000000..44f53b57ff --- /dev/null +++ b/Lang/EasyLang/Isograms-and-heterograms @@ -0,0 +1 @@ +../../Task/Isograms-and-heterograms/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Isqrt-integer-square-root-of-X b/Lang/EasyLang/Isqrt-integer-square-root-of-X new file mode 120000 index 0000000000..79ccfaeb51 --- /dev/null +++ b/Lang/EasyLang/Isqrt-integer-square-root-of-X @@ -0,0 +1 @@ +../../Task/Isqrt-integer-square-root-of-X/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Iterated-digits-squaring b/Lang/EasyLang/Iterated-digits-squaring new file mode 120000 index 0000000000..193be9fcba --- /dev/null +++ b/Lang/EasyLang/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Jacobi-symbol b/Lang/EasyLang/Jacobi-symbol new file mode 120000 index 0000000000..fec464ee0d --- /dev/null +++ b/Lang/EasyLang/Jacobi-symbol @@ -0,0 +1 @@ +../../Task/Jacobi-symbol/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Jacobsthal-numbers b/Lang/EasyLang/Jacobsthal-numbers new file mode 120000 index 0000000000..9469db92c2 --- /dev/null +++ b/Lang/EasyLang/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Jaro-Winkler-distance b/Lang/EasyLang/Jaro-Winkler-distance new file mode 120000 index 0000000000..727f74b880 --- /dev/null +++ b/Lang/EasyLang/Jaro-Winkler-distance @@ -0,0 +1 @@ +../../Task/Jaro-Winkler-distance/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Jaro-similarity b/Lang/EasyLang/Jaro-similarity new file mode 120000 index 0000000000..d630573e8e --- /dev/null +++ b/Lang/EasyLang/Jaro-similarity @@ -0,0 +1 @@ +../../Task/Jaro-similarity/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/JortSort b/Lang/EasyLang/JortSort new file mode 120000 index 0000000000..69c9d425de --- /dev/null +++ b/Lang/EasyLang/JortSort @@ -0,0 +1 @@ +../../Task/JortSort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Juggler-sequence b/Lang/EasyLang/Juggler-sequence new file mode 120000 index 0000000000..a501986168 --- /dev/null +++ b/Lang/EasyLang/Juggler-sequence @@ -0,0 +1 @@ +../../Task/Juggler-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/K-means++-clustering b/Lang/EasyLang/K-means++-clustering new file mode 120000 index 0000000000..9c59e662f6 --- /dev/null +++ b/Lang/EasyLang/K-means++-clustering @@ -0,0 +1 @@ +../../Task/K-means++-clustering/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Kaprekar-numbers b/Lang/EasyLang/Kaprekar-numbers new file mode 120000 index 0000000000..8b04bae44a --- /dev/null +++ b/Lang/EasyLang/Kaprekar-numbers @@ -0,0 +1 @@ +../../Task/Kaprekar-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Kernighans-large-earthquake-problem b/Lang/EasyLang/Kernighans-large-earthquake-problem new file mode 120000 index 0000000000..3ab1e4458e --- /dev/null +++ b/Lang/EasyLang/Kernighans-large-earthquake-problem @@ -0,0 +1 @@ +../../Task/Kernighans-large-earthquake-problem/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Keyboard-input-Keypress-check b/Lang/EasyLang/Keyboard-input-Keypress-check new file mode 120000 index 0000000000..749a963892 --- /dev/null +++ b/Lang/EasyLang/Keyboard-input-Keypress-check @@ -0,0 +1 @@ +../../Task/Keyboard-input-Keypress-check/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/EasyLang/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..afc72ecd9d --- /dev/null +++ b/Lang/EasyLang/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Knapsack-problem-Bounded b/Lang/EasyLang/Knapsack-problem-Bounded new file mode 120000 index 0000000000..d0f7a40df2 --- /dev/null +++ b/Lang/EasyLang/Knapsack-problem-Bounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Bounded/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Knapsack-problem-Continuous b/Lang/EasyLang/Knapsack-problem-Continuous new file mode 120000 index 0000000000..a54e4a1363 --- /dev/null +++ b/Lang/EasyLang/Knapsack-problem-Continuous @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Continuous/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Knapsack-problem-Unbounded b/Lang/EasyLang/Knapsack-problem-Unbounded new file mode 120000 index 0000000000..feaf22d24e --- /dev/null +++ b/Lang/EasyLang/Knapsack-problem-Unbounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Unbounded/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Knights-tour b/Lang/EasyLang/Knights-tour new file mode 120000 index 0000000000..c3c72273c2 --- /dev/null +++ b/Lang/EasyLang/Knights-tour @@ -0,0 +1 @@ +../../Task/Knights-tour/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Kolakoski-sequence b/Lang/EasyLang/Kolakoski-sequence new file mode 120000 index 0000000000..0d808caea4 --- /dev/null +++ b/Lang/EasyLang/Kolakoski-sequence @@ -0,0 +1 @@ +../../Task/Kolakoski-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Kosaraju b/Lang/EasyLang/Kosaraju new file mode 120000 index 0000000000..84b9e66a67 --- /dev/null +++ b/Lang/EasyLang/Kosaraju @@ -0,0 +1 @@ +../../Task/Kosaraju/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Kronecker-product b/Lang/EasyLang/Kronecker-product new file mode 120000 index 0000000000..1246c0ce28 --- /dev/null +++ b/Lang/EasyLang/Kronecker-product @@ -0,0 +1 @@ +../../Task/Kronecker-product/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Kronecker-product-based-fractals b/Lang/EasyLang/Kronecker-product-based-fractals new file mode 120000 index 0000000000..563af0ba71 --- /dev/null +++ b/Lang/EasyLang/Kronecker-product-based-fractals @@ -0,0 +1 @@ +../../Task/Kronecker-product-based-fractals/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/LU-decomposition b/Lang/EasyLang/LU-decomposition new file mode 120000 index 0000000000..b8f8a0d85a --- /dev/null +++ b/Lang/EasyLang/LU-decomposition @@ -0,0 +1 @@ +../../Task/LU-decomposition/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Largest-int-from-concatenated-ints b/Lang/EasyLang/Largest-int-from-concatenated-ints new file mode 120000 index 0000000000..10e1335e8a --- /dev/null +++ b/Lang/EasyLang/Largest-int-from-concatenated-ints @@ -0,0 +1 @@ +../../Task/Largest-int-from-concatenated-ints/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Last-Friday-of-each-month b/Lang/EasyLang/Last-Friday-of-each-month new file mode 120000 index 0000000000..35882f9070 --- /dev/null +++ b/Lang/EasyLang/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Last-letter-first-letter b/Lang/EasyLang/Last-letter-first-letter new file mode 120000 index 0000000000..0b195a1260 --- /dev/null +++ b/Lang/EasyLang/Last-letter-first-letter @@ -0,0 +1 @@ +../../Task/Last-letter-first-letter/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Law-of-cosines---triples b/Lang/EasyLang/Law-of-cosines---triples new file mode 120000 index 0000000000..c863a3f9c0 --- /dev/null +++ b/Lang/EasyLang/Law-of-cosines---triples @@ -0,0 +1 @@ +../../Task/Law-of-cosines---triples/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Leap-year b/Lang/EasyLang/Leap-year new file mode 120000 index 0000000000..786a015a2b --- /dev/null +++ b/Lang/EasyLang/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Least-common-multiple b/Lang/EasyLang/Least-common-multiple new file mode 120000 index 0000000000..4e6553c21f --- /dev/null +++ b/Lang/EasyLang/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Left-factorials b/Lang/EasyLang/Left-factorials new file mode 120000 index 0000000000..99571138e4 --- /dev/null +++ b/Lang/EasyLang/Left-factorials @@ -0,0 +1 @@ +../../Task/Left-factorials/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Legendre-prime-counting-function b/Lang/EasyLang/Legendre-prime-counting-function new file mode 120000 index 0000000000..4b5478a288 --- /dev/null +++ b/Lang/EasyLang/Legendre-prime-counting-function @@ -0,0 +1 @@ +../../Task/Legendre-prime-counting-function/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Levenshtein-distance-Alignment b/Lang/EasyLang/Levenshtein-distance-Alignment new file mode 120000 index 0000000000..dc79306a8c --- /dev/null +++ b/Lang/EasyLang/Levenshtein-distance-Alignment @@ -0,0 +1 @@ +../../Task/Levenshtein-distance-Alignment/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Linear-congruential-generator b/Lang/EasyLang/Linear-congruential-generator new file mode 120000 index 0000000000..08ba24e5b7 --- /dev/null +++ b/Lang/EasyLang/Linear-congruential-generator @@ -0,0 +1 @@ +../../Task/Linear-congruential-generator/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/List-rooted-trees b/Lang/EasyLang/List-rooted-trees new file mode 120000 index 0000000000..14cdfaa5a6 --- /dev/null +++ b/Lang/EasyLang/List-rooted-trees @@ -0,0 +1 @@ +../../Task/List-rooted-trees/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Logistic-curve-fitting-in-epidemiology b/Lang/EasyLang/Logistic-curve-fitting-in-epidemiology new file mode 120000 index 0000000000..265f7cdf24 --- /dev/null +++ b/Lang/EasyLang/Logistic-curve-fitting-in-epidemiology @@ -0,0 +1 @@ +../../Task/Logistic-curve-fitting-in-epidemiology/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Long-literals-with-continuations b/Lang/EasyLang/Long-literals-with-continuations new file mode 120000 index 0000000000..ffe5aa4238 --- /dev/null +++ b/Lang/EasyLang/Long-literals-with-continuations @@ -0,0 +1 @@ +../../Task/Long-literals-with-continuations/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Long-primes b/Lang/EasyLang/Long-primes new file mode 120000 index 0000000000..7bcfe1337a --- /dev/null +++ b/Lang/EasyLang/Long-primes @@ -0,0 +1 @@ +../../Task/Long-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Long-year b/Lang/EasyLang/Long-year new file mode 120000 index 0000000000..c98469be44 --- /dev/null +++ b/Lang/EasyLang/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Longest-common-subsequence b/Lang/EasyLang/Longest-common-subsequence new file mode 120000 index 0000000000..6cc703826c --- /dev/null +++ b/Lang/EasyLang/Longest-common-subsequence @@ -0,0 +1 @@ +../../Task/Longest-common-subsequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Longest-increasing-subsequence b/Lang/EasyLang/Longest-increasing-subsequence new file mode 120000 index 0000000000..eabf95f750 --- /dev/null +++ b/Lang/EasyLang/Longest-increasing-subsequence @@ -0,0 +1 @@ +../../Task/Longest-increasing-subsequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Look-and-say-sequence b/Lang/EasyLang/Look-and-say-sequence new file mode 120000 index 0000000000..acea496bc5 --- /dev/null +++ b/Lang/EasyLang/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Loop-over-multiple-arrays-simultaneously b/Lang/EasyLang/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..cc8922c8e4 --- /dev/null +++ b/Lang/EasyLang/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Loops-Wrong-ranges b/Lang/EasyLang/Loops-Wrong-ranges new file mode 120000 index 0000000000..d803a36357 --- /dev/null +++ b/Lang/EasyLang/Loops-Wrong-ranges @@ -0,0 +1 @@ +../../Task/Loops-Wrong-ranges/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Lucas-Lehmer-test b/Lang/EasyLang/Lucas-Lehmer-test new file mode 120000 index 0000000000..37ce43bc05 --- /dev/null +++ b/Lang/EasyLang/Lucas-Lehmer-test @@ -0,0 +1 @@ +../../Task/Lucas-Lehmer-test/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Ludic-numbers b/Lang/EasyLang/Ludic-numbers new file mode 120000 index 0000000000..1d6fc2e015 --- /dev/null +++ b/Lang/EasyLang/Ludic-numbers @@ -0,0 +1 @@ +../../Task/Ludic-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Luhn-test-of-credit-card-numbers b/Lang/EasyLang/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..6cdbead8c8 --- /dev/null +++ b/Lang/EasyLang/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Lychrel-numbers b/Lang/EasyLang/Lychrel-numbers new file mode 120000 index 0000000000..a66932caaa --- /dev/null +++ b/Lang/EasyLang/Lychrel-numbers @@ -0,0 +1 @@ +../../Task/Lychrel-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/M-bius-function b/Lang/EasyLang/M-bius-function new file mode 120000 index 0000000000..8ddd81962a --- /dev/null +++ b/Lang/EasyLang/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/MD4 b/Lang/EasyLang/MD4 new file mode 120000 index 0000000000..607e4d2f65 --- /dev/null +++ b/Lang/EasyLang/MD4 @@ -0,0 +1 @@ +../../Task/MD4/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/MD5 b/Lang/EasyLang/MD5 new file mode 120000 index 0000000000..1974a8639d --- /dev/null +++ b/Lang/EasyLang/MD5 @@ -0,0 +1 @@ +../../Task/MD5/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Mad-Libs b/Lang/EasyLang/Mad-Libs new file mode 120000 index 0000000000..80e4f5b2e7 --- /dev/null +++ b/Lang/EasyLang/Mad-Libs @@ -0,0 +1 @@ +../../Task/Mad-Libs/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Magic-8-ball b/Lang/EasyLang/Magic-8-ball new file mode 120000 index 0000000000..27f204a23e --- /dev/null +++ b/Lang/EasyLang/Magic-8-ball @@ -0,0 +1 @@ +../../Task/Magic-8-ball/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Magic-constant b/Lang/EasyLang/Magic-constant new file mode 120000 index 0000000000..e7bddcf034 --- /dev/null +++ b/Lang/EasyLang/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Magic-squares-of-doubly-even-order b/Lang/EasyLang/Magic-squares-of-doubly-even-order new file mode 120000 index 0000000000..b5f41f3cca --- /dev/null +++ b/Lang/EasyLang/Magic-squares-of-doubly-even-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-doubly-even-order/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Magic-squares-of-odd-order b/Lang/EasyLang/Magic-squares-of-odd-order new file mode 120000 index 0000000000..c1250ae803 --- /dev/null +++ b/Lang/EasyLang/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Magic-squares-of-singly-even-order b/Lang/EasyLang/Magic-squares-of-singly-even-order new file mode 120000 index 0000000000..bffad4e9d9 --- /dev/null +++ b/Lang/EasyLang/Magic-squares-of-singly-even-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-singly-even-order/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Magnanimous-numbers b/Lang/EasyLang/Magnanimous-numbers new file mode 120000 index 0000000000..b244e9bef4 --- /dev/null +++ b/Lang/EasyLang/Magnanimous-numbers @@ -0,0 +1 @@ +../../Task/Magnanimous-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Map-range b/Lang/EasyLang/Map-range new file mode 120000 index 0000000000..7f2fe886c3 --- /dev/null +++ b/Lang/EasyLang/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Matrix-chain-multiplication b/Lang/EasyLang/Matrix-chain-multiplication new file mode 120000 index 0000000000..49b2582836 --- /dev/null +++ b/Lang/EasyLang/Matrix-chain-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-chain-multiplication/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Matrix-exponentiation-operator b/Lang/EasyLang/Matrix-exponentiation-operator new file mode 120000 index 0000000000..ffeb77ddad --- /dev/null +++ b/Lang/EasyLang/Matrix-exponentiation-operator @@ -0,0 +1 @@ +../../Task/Matrix-exponentiation-operator/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Matrix-multiplication b/Lang/EasyLang/Matrix-multiplication new file mode 120000 index 0000000000..210bca9988 --- /dev/null +++ b/Lang/EasyLang/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Maximum-triangle-path-sum b/Lang/EasyLang/Maximum-triangle-path-sum new file mode 120000 index 0000000000..eed040fd4d --- /dev/null +++ b/Lang/EasyLang/Maximum-triangle-path-sum @@ -0,0 +1 @@ +../../Task/Maximum-triangle-path-sum/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Mayan-numerals b/Lang/EasyLang/Mayan-numerals new file mode 120000 index 0000000000..101692428a --- /dev/null +++ b/Lang/EasyLang/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/McNuggets-problem b/Lang/EasyLang/McNuggets-problem new file mode 120000 index 0000000000..4eb97330c9 --- /dev/null +++ b/Lang/EasyLang/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Merge-and-aggregate-datasets b/Lang/EasyLang/Merge-and-aggregate-datasets new file mode 120000 index 0000000000..4240a68719 --- /dev/null +++ b/Lang/EasyLang/Merge-and-aggregate-datasets @@ -0,0 +1 @@ +../../Task/Merge-and-aggregate-datasets/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Mertens-function b/Lang/EasyLang/Mertens-function new file mode 120000 index 0000000000..9535db88d7 --- /dev/null +++ b/Lang/EasyLang/Mertens-function @@ -0,0 +1 @@ +../../Task/Mertens-function/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Mian-Chowla-sequence b/Lang/EasyLang/Mian-Chowla-sequence new file mode 120000 index 0000000000..314aaad4b1 --- /dev/null +++ b/Lang/EasyLang/Mian-Chowla-sequence @@ -0,0 +1 @@ +../../Task/Mian-Chowla-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Mind-boggling-card-trick b/Lang/EasyLang/Mind-boggling-card-trick new file mode 120000 index 0000000000..ae422a355d --- /dev/null +++ b/Lang/EasyLang/Mind-boggling-card-trick @@ -0,0 +1 @@ +../../Task/Mind-boggling-card-trick/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/EasyLang/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..8adaf5f3b6 --- /dev/null +++ b/Lang/EasyLang/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Minkowski-question-mark-function b/Lang/EasyLang/Minkowski-question-mark-function new file mode 120000 index 0000000000..e4df814cca --- /dev/null +++ b/Lang/EasyLang/Minkowski-question-mark-function @@ -0,0 +1 @@ +../../Task/Minkowski-question-mark-function/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Modified-random-distribution b/Lang/EasyLang/Modified-random-distribution new file mode 120000 index 0000000000..127bc0bcb6 --- /dev/null +++ b/Lang/EasyLang/Modified-random-distribution @@ -0,0 +1 @@ +../../Task/Modified-random-distribution/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Modular-exponentiation b/Lang/EasyLang/Modular-exponentiation new file mode 120000 index 0000000000..7257cc430f --- /dev/null +++ b/Lang/EasyLang/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Motzkin-numbers b/Lang/EasyLang/Motzkin-numbers new file mode 120000 index 0000000000..f45ac71ffe --- /dev/null +++ b/Lang/EasyLang/Motzkin-numbers @@ -0,0 +1 @@ +../../Task/Motzkin-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Move-to-front-algorithm b/Lang/EasyLang/Move-to-front-algorithm new file mode 120000 index 0000000000..8c3f8fe7f9 --- /dev/null +++ b/Lang/EasyLang/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Multi-base-primes b/Lang/EasyLang/Multi-base-primes new file mode 120000 index 0000000000..0b06b01c9e --- /dev/null +++ b/Lang/EasyLang/Multi-base-primes @@ -0,0 +1 @@ +../../Task/Multi-base-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Multifactorial b/Lang/EasyLang/Multifactorial new file mode 120000 index 0000000000..f917509ca1 --- /dev/null +++ b/Lang/EasyLang/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Multisplit b/Lang/EasyLang/Multisplit new file mode 120000 index 0000000000..3f480eaeea --- /dev/null +++ b/Lang/EasyLang/Multisplit @@ -0,0 +1 @@ +../../Task/Multisplit/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Munchausen-numbers b/Lang/EasyLang/Munchausen-numbers new file mode 120000 index 0000000000..82315ebcc3 --- /dev/null +++ b/Lang/EasyLang/Munchausen-numbers @@ -0,0 +1 @@ +../../Task/Munchausen-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Mutual-recursion b/Lang/EasyLang/Mutual-recursion new file mode 120000 index 0000000000..9dbd653e23 --- /dev/null +++ b/Lang/EasyLang/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Negative-base-numbers b/Lang/EasyLang/Negative-base-numbers new file mode 120000 index 0000000000..750b2fa4de --- /dev/null +++ b/Lang/EasyLang/Negative-base-numbers @@ -0,0 +1 @@ +../../Task/Negative-base-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Nested-function b/Lang/EasyLang/Nested-function new file mode 120000 index 0000000000..3d6f80739f --- /dev/null +++ b/Lang/EasyLang/Nested-function @@ -0,0 +1 @@ +../../Task/Nested-function/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Next-highest-int-from-digits b/Lang/EasyLang/Next-highest-int-from-digits new file mode 120000 index 0000000000..b3f44119a8 --- /dev/null +++ b/Lang/EasyLang/Next-highest-int-from-digits @@ -0,0 +1 @@ +../../Task/Next-highest-int-from-digits/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Non-continuous-subsequences b/Lang/EasyLang/Non-continuous-subsequences new file mode 120000 index 0000000000..1ddebfbef7 --- /dev/null +++ b/Lang/EasyLang/Non-continuous-subsequences @@ -0,0 +1 @@ +../../Task/Non-continuous-subsequences/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Non-decimal-radices-Convert b/Lang/EasyLang/Non-decimal-radices-Convert new file mode 120000 index 0000000000..e286a4396d --- /dev/null +++ b/Lang/EasyLang/Non-decimal-radices-Convert @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Convert/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Non-decimal-radices-Input b/Lang/EasyLang/Non-decimal-radices-Input new file mode 120000 index 0000000000..15845b7041 --- /dev/null +++ b/Lang/EasyLang/Non-decimal-radices-Input @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Input/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Nonoblock b/Lang/EasyLang/Nonoblock new file mode 120000 index 0000000000..e2c27bd166 --- /dev/null +++ b/Lang/EasyLang/Nonoblock @@ -0,0 +1 @@ +../../Task/Nonoblock/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Number-names b/Lang/EasyLang/Number-names new file mode 120000 index 0000000000..abedf4dd40 --- /dev/null +++ b/Lang/EasyLang/Number-names @@ -0,0 +1 @@ +../../Task/Number-names/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Number-reversal-game b/Lang/EasyLang/Number-reversal-game new file mode 120000 index 0000000000..a55399f2e0 --- /dev/null +++ b/Lang/EasyLang/Number-reversal-game @@ -0,0 +1 @@ +../../Task/Number-reversal-game/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Numbers-which-are-not-the-sum-of-distinct-squares b/Lang/EasyLang/Numbers-which-are-not-the-sum-of-distinct-squares new file mode 120000 index 0000000000..b728c3fcbc --- /dev/null +++ b/Lang/EasyLang/Numbers-which-are-not-the-sum-of-distinct-squares @@ -0,0 +1 @@ +../../Task/Numbers-which-are-not-the-sum-of-distinct-squares/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Odd-word-problem b/Lang/EasyLang/Odd-word-problem new file mode 120000 index 0000000000..0886623884 --- /dev/null +++ b/Lang/EasyLang/Odd-word-problem @@ -0,0 +1 @@ +../../Task/Odd-word-problem/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Old-Russian-measure-of-length b/Lang/EasyLang/Old-Russian-measure-of-length new file mode 120000 index 0000000000..f293c18a0a --- /dev/null +++ b/Lang/EasyLang/Old-Russian-measure-of-length @@ -0,0 +1 @@ +../../Task/Old-Russian-measure-of-length/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Old-lady-swallowed-a-fly b/Lang/EasyLang/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..f3a3472099 --- /dev/null +++ b/Lang/EasyLang/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/One-dimensional-cellular-automata b/Lang/EasyLang/One-dimensional-cellular-automata new file mode 120000 index 0000000000..6cef842f96 --- /dev/null +++ b/Lang/EasyLang/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/One-of-n-lines-in-a-file b/Lang/EasyLang/One-of-n-lines-in-a-file new file mode 120000 index 0000000000..683c0899da --- /dev/null +++ b/Lang/EasyLang/One-of-n-lines-in-a-file @@ -0,0 +1 @@ +../../Task/One-of-n-lines-in-a-file/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/OpenWebNet-password b/Lang/EasyLang/OpenWebNet-password new file mode 120000 index 0000000000..1cfc17e776 --- /dev/null +++ b/Lang/EasyLang/OpenWebNet-password @@ -0,0 +1 @@ +../../Task/OpenWebNet-password/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Order-by-pair-comparisons b/Lang/EasyLang/Order-by-pair-comparisons new file mode 120000 index 0000000000..78fc8f28e3 --- /dev/null +++ b/Lang/EasyLang/Order-by-pair-comparisons @@ -0,0 +1 @@ +../../Task/Order-by-pair-comparisons/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Order-disjoint-list-items b/Lang/EasyLang/Order-disjoint-list-items new file mode 120000 index 0000000000..bd0f2b89f9 --- /dev/null +++ b/Lang/EasyLang/Order-disjoint-list-items @@ -0,0 +1 @@ +../../Task/Order-disjoint-list-items/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Order-two-numerical-lists b/Lang/EasyLang/Order-two-numerical-lists new file mode 120000 index 0000000000..0574c3c6db --- /dev/null +++ b/Lang/EasyLang/Order-two-numerical-lists @@ -0,0 +1 @@ +../../Task/Order-two-numerical-lists/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Ordered-words b/Lang/EasyLang/Ordered-words new file mode 120000 index 0000000000..284c4e7df2 --- /dev/null +++ b/Lang/EasyLang/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Ormiston-triples b/Lang/EasyLang/Ormiston-triples new file mode 120000 index 0000000000..de3ff3dcf1 --- /dev/null +++ b/Lang/EasyLang/Ormiston-triples @@ -0,0 +1 @@ +../../Task/Ormiston-triples/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Padovan-n-step-number-sequences b/Lang/EasyLang/Padovan-n-step-number-sequences new file mode 120000 index 0000000000..3c37f1b5a3 --- /dev/null +++ b/Lang/EasyLang/Padovan-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Padovan-n-step-number-sequences/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Padovan-sequence b/Lang/EasyLang/Padovan-sequence new file mode 120000 index 0000000000..d568888890 --- /dev/null +++ b/Lang/EasyLang/Padovan-sequence @@ -0,0 +1 @@ +../../Task/Padovan-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Palindrome-dates b/Lang/EasyLang/Palindrome-dates new file mode 120000 index 0000000000..a27c75b0d5 --- /dev/null +++ b/Lang/EasyLang/Palindrome-dates @@ -0,0 +1 @@ +../../Task/Palindrome-dates/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Paraffins b/Lang/EasyLang/Paraffins new file mode 120000 index 0000000000..954e9b549e --- /dev/null +++ b/Lang/EasyLang/Paraffins @@ -0,0 +1 @@ +../../Task/Paraffins/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Parsing-RPN-calculator-algorithm b/Lang/EasyLang/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..4c308dc876 --- /dev/null +++ b/Lang/EasyLang/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Particle-fountain b/Lang/EasyLang/Particle-fountain new file mode 120000 index 0000000000..df8fc026b9 --- /dev/null +++ b/Lang/EasyLang/Particle-fountain @@ -0,0 +1 @@ +../../Task/Particle-fountain/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Partition-an-integer-x-into-n-primes b/Lang/EasyLang/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..21cc93eeed --- /dev/null +++ b/Lang/EasyLang/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Partition-function-P b/Lang/EasyLang/Partition-function-P new file mode 120000 index 0000000000..07b0e608d7 --- /dev/null +++ b/Lang/EasyLang/Partition-function-P @@ -0,0 +1 @@ +../../Task/Partition-function-P/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Pascal-matrix-generation b/Lang/EasyLang/Pascal-matrix-generation new file mode 120000 index 0000000000..2a45a12baf --- /dev/null +++ b/Lang/EasyLang/Pascal-matrix-generation @@ -0,0 +1 @@ +../../Task/Pascal-matrix-generation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Pascals-triangle b/Lang/EasyLang/Pascals-triangle new file mode 120000 index 0000000000..1c14b19dad --- /dev/null +++ b/Lang/EasyLang/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Pascals-triangle-Puzzle b/Lang/EasyLang/Pascals-triangle-Puzzle new file mode 120000 index 0000000000..bb3b35817e --- /dev/null +++ b/Lang/EasyLang/Pascals-triangle-Puzzle @@ -0,0 +1 @@ +../../Task/Pascals-triangle-Puzzle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Password-generator b/Lang/EasyLang/Password-generator new file mode 120000 index 0000000000..004d74f550 --- /dev/null +++ b/Lang/EasyLang/Password-generator @@ -0,0 +1 @@ +../../Task/Password-generator/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Pathological-floating-point-problems b/Lang/EasyLang/Pathological-floating-point-problems new file mode 120000 index 0000000000..feb17cf372 --- /dev/null +++ b/Lang/EasyLang/Pathological-floating-point-problems @@ -0,0 +1 @@ +../../Task/Pathological-floating-point-problems/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Peano-curve b/Lang/EasyLang/Peano-curve new file mode 120000 index 0000000000..5f0f6138e3 --- /dev/null +++ b/Lang/EasyLang/Peano-curve @@ -0,0 +1 @@ +../../Task/Peano-curve/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Penneys-game b/Lang/EasyLang/Penneys-game new file mode 120000 index 0000000000..8a534b3c6f --- /dev/null +++ b/Lang/EasyLang/Penneys-game @@ -0,0 +1 @@ +../../Task/Penneys-game/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Percolation-Mean-cluster-density b/Lang/EasyLang/Percolation-Mean-cluster-density new file mode 120000 index 0000000000..5231594fc4 --- /dev/null +++ b/Lang/EasyLang/Percolation-Mean-cluster-density @@ -0,0 +1 @@ +../../Task/Percolation-Mean-cluster-density/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Percolation-Site-percolation b/Lang/EasyLang/Percolation-Site-percolation new file mode 120000 index 0000000000..50ffe015c4 --- /dev/null +++ b/Lang/EasyLang/Percolation-Site-percolation @@ -0,0 +1 @@ +../../Task/Percolation-Site-percolation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Perfect-shuffle b/Lang/EasyLang/Perfect-shuffle new file mode 120000 index 0000000000..728edc88c9 --- /dev/null +++ b/Lang/EasyLang/Perfect-shuffle @@ -0,0 +1 @@ +../../Task/Perfect-shuffle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Perfect-totient-numbers b/Lang/EasyLang/Perfect-totient-numbers new file mode 120000 index 0000000000..73baaf8d08 --- /dev/null +++ b/Lang/EasyLang/Perfect-totient-numbers @@ -0,0 +1 @@ +../../Task/Perfect-totient-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Periodic-table b/Lang/EasyLang/Periodic-table new file mode 120000 index 0000000000..43eef9d72c --- /dev/null +++ b/Lang/EasyLang/Periodic-table @@ -0,0 +1 @@ +../../Task/Periodic-table/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Peripheral-drift-illusion b/Lang/EasyLang/Peripheral-drift-illusion new file mode 120000 index 0000000000..6922becd71 --- /dev/null +++ b/Lang/EasyLang/Peripheral-drift-illusion @@ -0,0 +1 @@ +../../Task/Peripheral-drift-illusion/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Perlin-noise b/Lang/EasyLang/Perlin-noise new file mode 120000 index 0000000000..2f94e8bd94 --- /dev/null +++ b/Lang/EasyLang/Perlin-noise @@ -0,0 +1 @@ +../../Task/Perlin-noise/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Permutation-test b/Lang/EasyLang/Permutation-test new file mode 120000 index 0000000000..d3b1950f7a --- /dev/null +++ b/Lang/EasyLang/Permutation-test @@ -0,0 +1 @@ +../../Task/Permutation-test/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Permutations-Rank-of-a-permutation b/Lang/EasyLang/Permutations-Rank-of-a-permutation new file mode 120000 index 0000000000..0512aed3af --- /dev/null +++ b/Lang/EasyLang/Permutations-Rank-of-a-permutation @@ -0,0 +1 @@ +../../Task/Permutations-Rank-of-a-permutation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Permutations-by-swapping b/Lang/EasyLang/Permutations-by-swapping new file mode 120000 index 0000000000..6fca752258 --- /dev/null +++ b/Lang/EasyLang/Permutations-by-swapping @@ -0,0 +1 @@ +../../Task/Permutations-by-swapping/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Pernicious-numbers b/Lang/EasyLang/Pernicious-numbers new file mode 120000 index 0000000000..2adf8c61c2 --- /dev/null +++ b/Lang/EasyLang/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Phrase-reversals b/Lang/EasyLang/Phrase-reversals new file mode 120000 index 0000000000..3631697399 --- /dev/null +++ b/Lang/EasyLang/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Pierpont-primes b/Lang/EasyLang/Pierpont-primes new file mode 120000 index 0000000000..6e3e44c04c --- /dev/null +++ b/Lang/EasyLang/Pierpont-primes @@ -0,0 +1 @@ +../../Task/Pierpont-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Pig-the-dice-game b/Lang/EasyLang/Pig-the-dice-game new file mode 120000 index 0000000000..50b35f7797 --- /dev/null +++ b/Lang/EasyLang/Pig-the-dice-game @@ -0,0 +1 @@ +../../Task/Pig-the-dice-game/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Pinstripe-Display b/Lang/EasyLang/Pinstripe-Display new file mode 120000 index 0000000000..db25917458 --- /dev/null +++ b/Lang/EasyLang/Pinstripe-Display @@ -0,0 +1 @@ +../../Task/Pinstripe-Display/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Pisano-period b/Lang/EasyLang/Pisano-period new file mode 120000 index 0000000000..03e71e0e0c --- /dev/null +++ b/Lang/EasyLang/Pisano-period @@ -0,0 +1 @@ +../../Task/Pisano-period/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Plasma-effect b/Lang/EasyLang/Plasma-effect new file mode 120000 index 0000000000..5f845f7e61 --- /dev/null +++ b/Lang/EasyLang/Plasma-effect @@ -0,0 +1 @@ +../../Task/Plasma-effect/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Playfair-cipher b/Lang/EasyLang/Playfair-cipher new file mode 120000 index 0000000000..3d1568669f --- /dev/null +++ b/Lang/EasyLang/Playfair-cipher @@ -0,0 +1 @@ +../../Task/Playfair-cipher/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Playing-cards b/Lang/EasyLang/Playing-cards new file mode 120000 index 0000000000..65c563fef4 --- /dev/null +++ b/Lang/EasyLang/Playing-cards @@ -0,0 +1 @@ +../../Task/Playing-cards/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Poker-hand-analyser b/Lang/EasyLang/Poker-hand-analyser new file mode 120000 index 0000000000..0d36d9a0f9 --- /dev/null +++ b/Lang/EasyLang/Poker-hand-analyser @@ -0,0 +1 @@ +../../Task/Poker-hand-analyser/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Polynomial-long-division b/Lang/EasyLang/Polynomial-long-division new file mode 120000 index 0000000000..b22845819d --- /dev/null +++ b/Lang/EasyLang/Polynomial-long-division @@ -0,0 +1 @@ +../../Task/Polynomial-long-division/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Polynomial-regression b/Lang/EasyLang/Polynomial-regression new file mode 120000 index 0000000000..8dbd1d3e30 --- /dev/null +++ b/Lang/EasyLang/Polynomial-regression @@ -0,0 +1 @@ +../../Task/Polynomial-regression/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Population-count b/Lang/EasyLang/Population-count new file mode 120000 index 0000000000..8b6ff189cf --- /dev/null +++ b/Lang/EasyLang/Population-count @@ -0,0 +1 @@ +../../Task/Population-count/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Primality-by-Wilsons-theorem b/Lang/EasyLang/Primality-by-Wilsons-theorem new file mode 120000 index 0000000000..f47bc08707 --- /dev/null +++ b/Lang/EasyLang/Primality-by-Wilsons-theorem @@ -0,0 +1 @@ +../../Task/Primality-by-Wilsons-theorem/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Prime-conspiracy b/Lang/EasyLang/Prime-conspiracy new file mode 120000 index 0000000000..5276eb838d --- /dev/null +++ b/Lang/EasyLang/Prime-conspiracy @@ -0,0 +1 @@ +../../Task/Prime-conspiracy/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Prime-numbers-whose-neighboring-pairs-are-tetraprimes b/Lang/EasyLang/Prime-numbers-whose-neighboring-pairs-are-tetraprimes new file mode 120000 index 0000000000..deadbe682f --- /dev/null +++ b/Lang/EasyLang/Prime-numbers-whose-neighboring-pairs-are-tetraprimes @@ -0,0 +1 @@ +../../Task/Prime-numbers-whose-neighboring-pairs-are-tetraprimes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Prime-triangle b/Lang/EasyLang/Prime-triangle new file mode 120000 index 0000000000..1d703d33b5 --- /dev/null +++ b/Lang/EasyLang/Prime-triangle @@ -0,0 +1 @@ +../../Task/Prime-triangle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Primes---allocate-descendants-to-their-ancestors b/Lang/EasyLang/Primes---allocate-descendants-to-their-ancestors new file mode 120000 index 0000000000..c5cfa0147b --- /dev/null +++ b/Lang/EasyLang/Primes---allocate-descendants-to-their-ancestors @@ -0,0 +1 @@ +../../Task/Primes---allocate-descendants-to-their-ancestors/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Primorial-numbers b/Lang/EasyLang/Primorial-numbers new file mode 120000 index 0000000000..d0a4900284 --- /dev/null +++ b/Lang/EasyLang/Primorial-numbers @@ -0,0 +1 @@ +../../Task/Primorial-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Probabilistic-choice b/Lang/EasyLang/Probabilistic-choice new file mode 120000 index 0000000000..f4c8e2ec2b --- /dev/null +++ b/Lang/EasyLang/Probabilistic-choice @@ -0,0 +1 @@ +../../Task/Probabilistic-choice/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Problem-of-Apollonius b/Lang/EasyLang/Problem-of-Apollonius new file mode 120000 index 0000000000..34ccacd36b --- /dev/null +++ b/Lang/EasyLang/Problem-of-Apollonius @@ -0,0 +1 @@ +../../Task/Problem-of-Apollonius/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Proper-divisors b/Lang/EasyLang/Proper-divisors new file mode 120000 index 0000000000..a6f15193a6 --- /dev/null +++ b/Lang/EasyLang/Proper-divisors @@ -0,0 +1 @@ +../../Task/Proper-divisors/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a b/Lang/EasyLang/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a new file mode 120000 index 0000000000..4f4d220e94 --- /dev/null +++ b/Lang/EasyLang/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Pythagorean-quadruples b/Lang/EasyLang/Pythagorean-quadruples new file mode 120000 index 0000000000..63bc250851 --- /dev/null +++ b/Lang/EasyLang/Pythagorean-quadruples @@ -0,0 +1 @@ +../../Task/Pythagorean-quadruples/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Pythagorean-triples b/Lang/EasyLang/Pythagorean-triples new file mode 120000 index 0000000000..ae5979164c --- /dev/null +++ b/Lang/EasyLang/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Queue-Definition b/Lang/EasyLang/Queue-Definition new file mode 120000 index 0000000000..60d84f451e --- /dev/null +++ b/Lang/EasyLang/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Queue-Usage b/Lang/EasyLang/Queue-Usage new file mode 120000 index 0000000000..0a07f759a8 --- /dev/null +++ b/Lang/EasyLang/Queue-Usage @@ -0,0 +1 @@ +../../Task/Queue-Usage/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Quoting-constructs b/Lang/EasyLang/Quoting-constructs new file mode 120000 index 0000000000..4d929963d4 --- /dev/null +++ b/Lang/EasyLang/Quoting-constructs @@ -0,0 +1 @@ +../../Task/Quoting-constructs/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/RIPEMD-160 b/Lang/EasyLang/RIPEMD-160 new file mode 120000 index 0000000000..c7b5193d17 --- /dev/null +++ b/Lang/EasyLang/RIPEMD-160 @@ -0,0 +1 @@ +../../Task/RIPEMD-160/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/RPG-attributes-generator b/Lang/EasyLang/RPG-attributes-generator new file mode 120000 index 0000000000..1bb6325d13 --- /dev/null +++ b/Lang/EasyLang/RPG-attributes-generator @@ -0,0 +1 @@ +../../Task/RPG-attributes-generator/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/RSA-code b/Lang/EasyLang/RSA-code new file mode 120000 index 0000000000..ab0c3fd0ae --- /dev/null +++ b/Lang/EasyLang/RSA-code @@ -0,0 +1 @@ +../../Task/RSA-code/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Radical-of-an-integer b/Lang/EasyLang/Radical-of-an-integer new file mode 120000 index 0000000000..9e440b9a9f --- /dev/null +++ b/Lang/EasyLang/Radical-of-an-integer @@ -0,0 +1 @@ +../../Task/Radical-of-an-integer/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Ramanujan-primes-twins b/Lang/EasyLang/Ramanujan-primes-twins new file mode 120000 index 0000000000..5e0a528dbb --- /dev/null +++ b/Lang/EasyLang/Ramanujan-primes-twins @@ -0,0 +1 @@ +../../Task/Ramanujan-primes-twins/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Ramer-Douglas-Peucker-line-simplification b/Lang/EasyLang/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..e4799ac235 --- /dev/null +++ b/Lang/EasyLang/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Random-Latin-squares b/Lang/EasyLang/Random-Latin-squares new file mode 120000 index 0000000000..377972d9e1 --- /dev/null +++ b/Lang/EasyLang/Random-Latin-squares @@ -0,0 +1 @@ +../../Task/Random-Latin-squares/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Range-consolidation b/Lang/EasyLang/Range-consolidation new file mode 120000 index 0000000000..2af9d87ce4 --- /dev/null +++ b/Lang/EasyLang/Range-consolidation @@ -0,0 +1 @@ +../../Task/Range-consolidation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Range-expansion b/Lang/EasyLang/Range-expansion new file mode 120000 index 0000000000..b1e04fdc47 --- /dev/null +++ b/Lang/EasyLang/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Range-extraction b/Lang/EasyLang/Range-extraction new file mode 120000 index 0000000000..b10a21cd95 --- /dev/null +++ b/Lang/EasyLang/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Ranking-methods b/Lang/EasyLang/Ranking-methods new file mode 120000 index 0000000000..7f1b7f2c09 --- /dev/null +++ b/Lang/EasyLang/Ranking-methods @@ -0,0 +1 @@ +../../Task/Ranking-methods/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Rate-counter b/Lang/EasyLang/Rate-counter new file mode 120000 index 0000000000..d4dfd5cedd --- /dev/null +++ b/Lang/EasyLang/Rate-counter @@ -0,0 +1 @@ +../../Task/Rate-counter/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Read-a-specific-line-from-a-file b/Lang/EasyLang/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..d7d3ddb462 --- /dev/null +++ b/Lang/EasyLang/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Reduced-row-echelon-form b/Lang/EasyLang/Reduced-row-echelon-form new file mode 120000 index 0000000000..7ab5f9f24b --- /dev/null +++ b/Lang/EasyLang/Reduced-row-echelon-form @@ -0,0 +1 @@ +../../Task/Reduced-row-echelon-form/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Rep-string b/Lang/EasyLang/Rep-string new file mode 120000 index 0000000000..c011f2f49a --- /dev/null +++ b/Lang/EasyLang/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Repeat-a-string b/Lang/EasyLang/Repeat-a-string new file mode 120000 index 0000000000..ecd0e89fe6 --- /dev/null +++ b/Lang/EasyLang/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Resistor-mesh b/Lang/EasyLang/Resistor-mesh new file mode 120000 index 0000000000..7e1b48a0ca --- /dev/null +++ b/Lang/EasyLang/Resistor-mesh @@ -0,0 +1 @@ +../../Task/Resistor-mesh/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Reverse-words-in-a-string b/Lang/EasyLang/Reverse-words-in-a-string new file mode 120000 index 0000000000..ab8b42f790 --- /dev/null +++ b/Lang/EasyLang/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Rhonda-numbers b/Lang/EasyLang/Rhonda-numbers new file mode 120000 index 0000000000..5ec2f03aee --- /dev/null +++ b/Lang/EasyLang/Rhonda-numbers @@ -0,0 +1 @@ +../../Task/Rhonda-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Rock-paper-scissors b/Lang/EasyLang/Rock-paper-scissors new file mode 120000 index 0000000000..f5bc56ac98 --- /dev/null +++ b/Lang/EasyLang/Rock-paper-scissors @@ -0,0 +1 @@ +../../Task/Rock-paper-scissors/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Roots-of-a-function b/Lang/EasyLang/Roots-of-a-function new file mode 120000 index 0000000000..184fd0b60d --- /dev/null +++ b/Lang/EasyLang/Roots-of-a-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-function/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Roots-of-unity b/Lang/EasyLang/Roots-of-unity new file mode 120000 index 0000000000..828ac953fa --- /dev/null +++ b/Lang/EasyLang/Roots-of-unity @@ -0,0 +1 @@ +../../Task/Roots-of-unity/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Runge-Kutta-method b/Lang/EasyLang/Runge-Kutta-method new file mode 120000 index 0000000000..404f8f7a22 --- /dev/null +++ b/Lang/EasyLang/Runge-Kutta-method @@ -0,0 +1 @@ +../../Task/Runge-Kutta-method/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Ruth-Aaron-numbers b/Lang/EasyLang/Ruth-Aaron-numbers new file mode 120000 index 0000000000..8c50b35963 --- /dev/null +++ b/Lang/EasyLang/Ruth-Aaron-numbers @@ -0,0 +1 @@ +../../Task/Ruth-Aaron-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/SEDOLs b/Lang/EasyLang/SEDOLs new file mode 120000 index 0000000000..51d6fbebdf --- /dev/null +++ b/Lang/EasyLang/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/SHA-1 b/Lang/EasyLang/SHA-1 new file mode 120000 index 0000000000..85ee6bdeff --- /dev/null +++ b/Lang/EasyLang/SHA-1 @@ -0,0 +1 @@ +../../Task/SHA-1/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/SHA-256 b/Lang/EasyLang/SHA-256 new file mode 120000 index 0000000000..90c60df38f --- /dev/null +++ b/Lang/EasyLang/SHA-256 @@ -0,0 +1 @@ +../../Task/SHA-256/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Safe-primes-and-unsafe-primes b/Lang/EasyLang/Safe-primes-and-unsafe-primes new file mode 120000 index 0000000000..1a2584a87e --- /dev/null +++ b/Lang/EasyLang/Safe-primes-and-unsafe-primes @@ -0,0 +1 @@ +../../Task/Safe-primes-and-unsafe-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sailors-coconuts-and-a-monkey-problem b/Lang/EasyLang/Sailors-coconuts-and-a-monkey-problem new file mode 120000 index 0000000000..13c2416787 --- /dev/null +++ b/Lang/EasyLang/Sailors-coconuts-and-a-monkey-problem @@ -0,0 +1 @@ +../../Task/Sailors-coconuts-and-a-monkey-problem/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Scope-Function-names-and-labels b/Lang/EasyLang/Scope-Function-names-and-labels new file mode 120000 index 0000000000..159b6679bd --- /dev/null +++ b/Lang/EasyLang/Scope-Function-names-and-labels @@ -0,0 +1 @@ +../../Task/Scope-Function-names-and-labels/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Search-a-list b/Lang/EasyLang/Search-a-list new file mode 120000 index 0000000000..ccb29f0b91 --- /dev/null +++ b/Lang/EasyLang/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Selectively-replace-multiple-instances-of-a-character-within-a-string b/Lang/EasyLang/Selectively-replace-multiple-instances-of-a-character-within-a-string new file mode 120000 index 0000000000..c9738f521a --- /dev/null +++ b/Lang/EasyLang/Selectively-replace-multiple-instances-of-a-character-within-a-string @@ -0,0 +1 @@ +../../Task/Selectively-replace-multiple-instances-of-a-character-within-a-string/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Self-numbers b/Lang/EasyLang/Self-numbers new file mode 120000 index 0000000000..219b2abf44 --- /dev/null +++ b/Lang/EasyLang/Self-numbers @@ -0,0 +1 @@ +../../Task/Self-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Semordnilap b/Lang/EasyLang/Semordnilap new file mode 120000 index 0000000000..54e7d67bd7 --- /dev/null +++ b/Lang/EasyLang/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors b/Lang/EasyLang/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors new file mode 120000 index 0000000000..b4f1a1113a --- /dev/null +++ b/Lang/EasyLang/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Set-puzzle b/Lang/EasyLang/Set-puzzle new file mode 120000 index 0000000000..feae2ec924 --- /dev/null +++ b/Lang/EasyLang/Set-puzzle @@ -0,0 +1 @@ +../../Task/Set-puzzle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Set-right-adjacent-bits b/Lang/EasyLang/Set-right-adjacent-bits new file mode 120000 index 0000000000..ec9bf3c5a8 --- /dev/null +++ b/Lang/EasyLang/Set-right-adjacent-bits @@ -0,0 +1 @@ +../../Task/Set-right-adjacent-bits/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sexy-primes b/Lang/EasyLang/Sexy-primes new file mode 120000 index 0000000000..5323f1eac1 --- /dev/null +++ b/Lang/EasyLang/Sexy-primes @@ -0,0 +1 @@ +../../Task/Sexy-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Shortest-common-supersequence b/Lang/EasyLang/Shortest-common-supersequence new file mode 120000 index 0000000000..607dae8dd4 --- /dev/null +++ b/Lang/EasyLang/Shortest-common-supersequence @@ -0,0 +1 @@ +../../Task/Shortest-common-supersequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Show-the-epoch b/Lang/EasyLang/Show-the-epoch new file mode 120000 index 0000000000..67a6b1a9c5 --- /dev/null +++ b/Lang/EasyLang/Show-the-epoch @@ -0,0 +1 @@ +../../Task/Show-the-epoch/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sierpinski-square-curve b/Lang/EasyLang/Sierpinski-square-curve new file mode 120000 index 0000000000..5a67658618 --- /dev/null +++ b/Lang/EasyLang/Sierpinski-square-curve @@ -0,0 +1 @@ +../../Task/Sierpinski-square-curve/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sierpinski-triangle b/Lang/EasyLang/Sierpinski-triangle new file mode 120000 index 0000000000..36520550cb --- /dev/null +++ b/Lang/EasyLang/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sieve-of-Pritchard b/Lang/EasyLang/Sieve-of-Pritchard new file mode 120000 index 0000000000..26c5587430 --- /dev/null +++ b/Lang/EasyLang/Sieve-of-Pritchard @@ -0,0 +1 @@ +../../Task/Sieve-of-Pritchard/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sleeping-Beauty-problem b/Lang/EasyLang/Sleeping-Beauty-problem new file mode 120000 index 0000000000..3221388f3b --- /dev/null +++ b/Lang/EasyLang/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Smarandache-Wellin-primes b/Lang/EasyLang/Smarandache-Wellin-primes new file mode 120000 index 0000000000..bedd3c4b04 --- /dev/null +++ b/Lang/EasyLang/Smarandache-Wellin-primes @@ -0,0 +1 @@ +../../Task/Smarandache-Wellin-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Smarandache-prime-digital-sequence b/Lang/EasyLang/Smarandache-prime-digital-sequence new file mode 120000 index 0000000000..5a92cc0ae9 --- /dev/null +++ b/Lang/EasyLang/Smarandache-prime-digital-sequence @@ -0,0 +1 @@ +../../Task/Smarandache-prime-digital-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Smith-numbers b/Lang/EasyLang/Smith-numbers new file mode 120000 index 0000000000..101193f3b1 --- /dev/null +++ b/Lang/EasyLang/Smith-numbers @@ -0,0 +1 @@ +../../Task/Smith-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Soloways-recurring-rainfall b/Lang/EasyLang/Soloways-recurring-rainfall new file mode 120000 index 0000000000..9662259f25 --- /dev/null +++ b/Lang/EasyLang/Soloways-recurring-rainfall @@ -0,0 +1 @@ +../../Task/Soloways-recurring-rainfall/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Solve-a-Hidato-puzzle b/Lang/EasyLang/Solve-a-Hidato-puzzle new file mode 120000 index 0000000000..91cd1509fe --- /dev/null +++ b/Lang/EasyLang/Solve-a-Hidato-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hidato-puzzle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Solve-a-Holy-Knights-tour b/Lang/EasyLang/Solve-a-Holy-Knights-tour new file mode 120000 index 0000000000..0807789002 --- /dev/null +++ b/Lang/EasyLang/Solve-a-Holy-Knights-tour @@ -0,0 +1 @@ +../../Task/Solve-a-Holy-Knights-tour/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Solve-a-Hopido-puzzle b/Lang/EasyLang/Solve-a-Hopido-puzzle new file mode 120000 index 0000000000..f1ae260677 --- /dev/null +++ b/Lang/EasyLang/Solve-a-Hopido-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hopido-puzzle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Solve-a-Numbrix-puzzle b/Lang/EasyLang/Solve-a-Numbrix-puzzle new file mode 120000 index 0000000000..9dc56df255 --- /dev/null +++ b/Lang/EasyLang/Solve-a-Numbrix-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Numbrix-puzzle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Solve-the-no-connection-puzzle b/Lang/EasyLang/Solve-the-no-connection-puzzle new file mode 120000 index 0000000000..759be373e6 --- /dev/null +++ b/Lang/EasyLang/Solve-the-no-connection-puzzle @@ -0,0 +1 @@ +../../Task/Solve-the-no-connection-puzzle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sort-a-list-of-object-identifiers b/Lang/EasyLang/Sort-a-list-of-object-identifiers new file mode 120000 index 0000000000..6767e4212b --- /dev/null +++ b/Lang/EasyLang/Sort-a-list-of-object-identifiers @@ -0,0 +1 @@ +../../Task/Sort-a-list-of-object-identifiers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sort-an-integer-array b/Lang/EasyLang/Sort-an-integer-array new file mode 120000 index 0000000000..b6e22e35fd --- /dev/null +++ b/Lang/EasyLang/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sort-an-outline-at-every-level b/Lang/EasyLang/Sort-an-outline-at-every-level new file mode 120000 index 0000000000..aa549fd59a --- /dev/null +++ b/Lang/EasyLang/Sort-an-outline-at-every-level @@ -0,0 +1 @@ +../../Task/Sort-an-outline-at-every-level/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sort-disjoint-sublist b/Lang/EasyLang/Sort-disjoint-sublist new file mode 120000 index 0000000000..eb35c6be68 --- /dev/null +++ b/Lang/EasyLang/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sort-numbers-lexicographically b/Lang/EasyLang/Sort-numbers-lexicographically new file mode 120000 index 0000000000..096e63b030 --- /dev/null +++ b/Lang/EasyLang/Sort-numbers-lexicographically @@ -0,0 +1 @@ +../../Task/Sort-numbers-lexicographically/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sort-three-variables b/Lang/EasyLang/Sort-three-variables new file mode 120000 index 0000000000..ffc5d5785b --- /dev/null +++ b/Lang/EasyLang/Sort-three-variables @@ -0,0 +1 @@ +../../Task/Sort-three-variables/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sorting-algorithms-Bead-sort b/Lang/EasyLang/Sorting-algorithms-Bead-sort new file mode 120000 index 0000000000..a450a04067 --- /dev/null +++ b/Lang/EasyLang/Sorting-algorithms-Bead-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bead-sort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sorting-algorithms-Bogosort b/Lang/EasyLang/Sorting-algorithms-Bogosort new file mode 120000 index 0000000000..b0d8dd10f8 --- /dev/null +++ b/Lang/EasyLang/Sorting-algorithms-Bogosort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bogosort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sorting-algorithms-Cocktail-sort b/Lang/EasyLang/Sorting-algorithms-Cocktail-sort new file mode 120000 index 0000000000..6ea90a8bea --- /dev/null +++ b/Lang/EasyLang/Sorting-algorithms-Cocktail-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Cocktail-sort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sorting-algorithms-Cocktail-sort-with-shifting-bounds b/Lang/EasyLang/Sorting-algorithms-Cocktail-sort-with-shifting-bounds new file mode 120000 index 0000000000..885e9fc6f4 --- /dev/null +++ b/Lang/EasyLang/Sorting-algorithms-Cocktail-sort-with-shifting-bounds @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Cocktail-sort-with-shifting-bounds/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sorting-algorithms-Comb-sort b/Lang/EasyLang/Sorting-algorithms-Comb-sort new file mode 120000 index 0000000000..105d051508 --- /dev/null +++ b/Lang/EasyLang/Sorting-algorithms-Comb-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Comb-sort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sorting-algorithms-Counting-sort b/Lang/EasyLang/Sorting-algorithms-Counting-sort new file mode 120000 index 0000000000..55b1fd89b9 --- /dev/null +++ b/Lang/EasyLang/Sorting-algorithms-Counting-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Counting-sort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sorting-algorithms-Gnome-sort b/Lang/EasyLang/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..4325128d9d --- /dev/null +++ b/Lang/EasyLang/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sorting-algorithms-Pancake-sort b/Lang/EasyLang/Sorting-algorithms-Pancake-sort new file mode 120000 index 0000000000..7f8da5bd54 --- /dev/null +++ b/Lang/EasyLang/Sorting-algorithms-Pancake-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Pancake-sort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sorting-algorithms-Patience-sort b/Lang/EasyLang/Sorting-algorithms-Patience-sort new file mode 120000 index 0000000000..6123828d8e --- /dev/null +++ b/Lang/EasyLang/Sorting-algorithms-Patience-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Patience-sort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sorting-algorithms-Permutation-sort b/Lang/EasyLang/Sorting-algorithms-Permutation-sort new file mode 120000 index 0000000000..858ffd0315 --- /dev/null +++ b/Lang/EasyLang/Sorting-algorithms-Permutation-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Permutation-sort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sorting-algorithms-Shell-sort b/Lang/EasyLang/Sorting-algorithms-Shell-sort new file mode 120000 index 0000000000..f5b30c5803 --- /dev/null +++ b/Lang/EasyLang/Sorting-algorithms-Shell-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Shell-sort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sorting-algorithms-Stooge-sort b/Lang/EasyLang/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..8f8f251e34 --- /dev/null +++ b/Lang/EasyLang/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sorting-algorithms-Strand-sort b/Lang/EasyLang/Sorting-algorithms-Strand-sort new file mode 120000 index 0000000000..005353ca66 --- /dev/null +++ b/Lang/EasyLang/Sorting-algorithms-Strand-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Strand-sort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Soundex b/Lang/EasyLang/Soundex new file mode 120000 index 0000000000..1f0885f64a --- /dev/null +++ b/Lang/EasyLang/Soundex @@ -0,0 +1 @@ +../../Task/Soundex/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sparkline-in-unicode b/Lang/EasyLang/Sparkline-in-unicode new file mode 120000 index 0000000000..7ec2356a98 --- /dev/null +++ b/Lang/EasyLang/Sparkline-in-unicode @@ -0,0 +1 @@ +../../Task/Sparkline-in-unicode/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Spelling-of-ordinal-numbers b/Lang/EasyLang/Spelling-of-ordinal-numbers new file mode 120000 index 0000000000..657348f1ae --- /dev/null +++ b/Lang/EasyLang/Spelling-of-ordinal-numbers @@ -0,0 +1 @@ +../../Task/Spelling-of-ordinal-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sphenic-numbers b/Lang/EasyLang/Sphenic-numbers new file mode 120000 index 0000000000..376288b88d --- /dev/null +++ b/Lang/EasyLang/Sphenic-numbers @@ -0,0 +1 @@ +../../Task/Sphenic-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Spinning-rod-animation-Text b/Lang/EasyLang/Spinning-rod-animation-Text new file mode 120000 index 0000000000..8d7a484a76 --- /dev/null +++ b/Lang/EasyLang/Spinning-rod-animation-Text @@ -0,0 +1 @@ +../../Task/Spinning-rod-animation-Text/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Spiral-matrix b/Lang/EasyLang/Spiral-matrix new file mode 120000 index 0000000000..6a306658a2 --- /dev/null +++ b/Lang/EasyLang/Spiral-matrix @@ -0,0 +1 @@ +../../Task/Spiral-matrix/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Square-but-not-cube b/Lang/EasyLang/Square-but-not-cube new file mode 120000 index 0000000000..573451d99d --- /dev/null +++ b/Lang/EasyLang/Square-but-not-cube @@ -0,0 +1 @@ +../../Task/Square-but-not-cube/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Square-free-integers b/Lang/EasyLang/Square-free-integers new file mode 120000 index 0000000000..07046cee4c --- /dev/null +++ b/Lang/EasyLang/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Stable-marriage-problem b/Lang/EasyLang/Stable-marriage-problem new file mode 120000 index 0000000000..5a03ad65b0 --- /dev/null +++ b/Lang/EasyLang/Stable-marriage-problem @@ -0,0 +1 @@ +../../Task/Stable-marriage-problem/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Stack b/Lang/EasyLang/Stack new file mode 120000 index 0000000000..0038ea59db --- /dev/null +++ b/Lang/EasyLang/Stack @@ -0,0 +1 @@ +../../Task/Stack/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Stair-climbing-puzzle b/Lang/EasyLang/Stair-climbing-puzzle new file mode 120000 index 0000000000..e0c07f706d --- /dev/null +++ b/Lang/EasyLang/Stair-climbing-puzzle @@ -0,0 +1 @@ +../../Task/Stair-climbing-puzzle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Start-from-a-main-routine b/Lang/EasyLang/Start-from-a-main-routine new file mode 120000 index 0000000000..6b5dd8c795 --- /dev/null +++ b/Lang/EasyLang/Start-from-a-main-routine @@ -0,0 +1 @@ +../../Task/Start-from-a-main-routine/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Statistics-Basic b/Lang/EasyLang/Statistics-Basic new file mode 120000 index 0000000000..5d69a2f87b --- /dev/null +++ b/Lang/EasyLang/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Statistics-Normal-distribution b/Lang/EasyLang/Statistics-Normal-distribution new file mode 120000 index 0000000000..cfeed445c6 --- /dev/null +++ b/Lang/EasyLang/Statistics-Normal-distribution @@ -0,0 +1 @@ +../../Task/Statistics-Normal-distribution/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Stem-and-leaf-plot b/Lang/EasyLang/Stem-and-leaf-plot new file mode 120000 index 0000000000..cf4dace06c --- /dev/null +++ b/Lang/EasyLang/Stem-and-leaf-plot @@ -0,0 +1 @@ +../../Task/Stem-and-leaf-plot/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Stern-Brocot-sequence b/Lang/EasyLang/Stern-Brocot-sequence new file mode 120000 index 0000000000..0fd407fbf1 --- /dev/null +++ b/Lang/EasyLang/Stern-Brocot-sequence @@ -0,0 +1 @@ +../../Task/Stern-Brocot-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Straddling-checkerboard b/Lang/EasyLang/Straddling-checkerboard new file mode 120000 index 0000000000..df23fad6e0 --- /dev/null +++ b/Lang/EasyLang/Straddling-checkerboard @@ -0,0 +1 @@ +../../Task/Straddling-checkerboard/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Strong-and-weak-primes b/Lang/EasyLang/Strong-and-weak-primes new file mode 120000 index 0000000000..7a0f4adcd7 --- /dev/null +++ b/Lang/EasyLang/Strong-and-weak-primes @@ -0,0 +1 @@ +../../Task/Strong-and-weak-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Subleq b/Lang/EasyLang/Subleq new file mode 120000 index 0000000000..1401c9e3d6 --- /dev/null +++ b/Lang/EasyLang/Subleq @@ -0,0 +1 @@ +../../Task/Subleq/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Substitution-cipher b/Lang/EasyLang/Substitution-cipher new file mode 120000 index 0000000000..08b863c199 --- /dev/null +++ b/Lang/EasyLang/Substitution-cipher @@ -0,0 +1 @@ +../../Task/Substitution-cipher/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Subtractive-generator b/Lang/EasyLang/Subtractive-generator new file mode 120000 index 0000000000..67b19013ad --- /dev/null +++ b/Lang/EasyLang/Subtractive-generator @@ -0,0 +1 @@ +../../Task/Subtractive-generator/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Successive-prime-differences b/Lang/EasyLang/Successive-prime-differences new file mode 120000 index 0000000000..904f218dfa --- /dev/null +++ b/Lang/EasyLang/Successive-prime-differences @@ -0,0 +1 @@ +../../Task/Successive-prime-differences/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sudan-function b/Lang/EasyLang/Sudan-function new file mode 120000 index 0000000000..00925b61cc --- /dev/null +++ b/Lang/EasyLang/Sudan-function @@ -0,0 +1 @@ +../../Task/Sudan-function/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Suffixation-of-decimal-numbers b/Lang/EasyLang/Suffixation-of-decimal-numbers new file mode 120000 index 0000000000..2c99b570e5 --- /dev/null +++ b/Lang/EasyLang/Suffixation-of-decimal-numbers @@ -0,0 +1 @@ +../../Task/Suffixation-of-decimal-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sum-and-product-puzzle b/Lang/EasyLang/Sum-and-product-puzzle new file mode 120000 index 0000000000..8dd4cbcafb --- /dev/null +++ b/Lang/EasyLang/Sum-and-product-puzzle @@ -0,0 +1 @@ +../../Task/Sum-and-product-puzzle/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sum-multiples-of-3-and-5 b/Lang/EasyLang/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..6323853305 --- /dev/null +++ b/Lang/EasyLang/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sum-of-elements-below-main-diagonal-of-matrix b/Lang/EasyLang/Sum-of-elements-below-main-diagonal-of-matrix new file mode 120000 index 0000000000..9d1f3d5072 --- /dev/null +++ b/Lang/EasyLang/Sum-of-elements-below-main-diagonal-of-matrix @@ -0,0 +1 @@ +../../Task/Sum-of-elements-below-main-diagonal-of-matrix/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sum-to-100 b/Lang/EasyLang/Sum-to-100 new file mode 120000 index 0000000000..8a6d9e6af8 --- /dev/null +++ b/Lang/EasyLang/Sum-to-100 @@ -0,0 +1 @@ +../../Task/Sum-to-100/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Super-d-numbers b/Lang/EasyLang/Super-d-numbers new file mode 120000 index 0000000000..c760610b85 --- /dev/null +++ b/Lang/EasyLang/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Superellipse b/Lang/EasyLang/Superellipse new file mode 120000 index 0000000000..cf8cdb08f6 --- /dev/null +++ b/Lang/EasyLang/Superellipse @@ -0,0 +1 @@ +../../Task/Superellipse/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Superpermutation-minimisation b/Lang/EasyLang/Superpermutation-minimisation new file mode 120000 index 0000000000..6607fe41d8 --- /dev/null +++ b/Lang/EasyLang/Superpermutation-minimisation @@ -0,0 +1 @@ +../../Task/Superpermutation-minimisation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Sutherland-Hodgman-polygon-clipping b/Lang/EasyLang/Sutherland-Hodgman-polygon-clipping new file mode 120000 index 0000000000..948deb6c32 --- /dev/null +++ b/Lang/EasyLang/Sutherland-Hodgman-polygon-clipping @@ -0,0 +1 @@ +../../Task/Sutherland-Hodgman-polygon-clipping/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Tau-function b/Lang/EasyLang/Tau-function new file mode 120000 index 0000000000..a037a03797 --- /dev/null +++ b/Lang/EasyLang/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Tau-number b/Lang/EasyLang/Tau-number new file mode 120000 index 0000000000..2164c80d5f --- /dev/null +++ b/Lang/EasyLang/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Taxicab-numbers b/Lang/EasyLang/Taxicab-numbers new file mode 120000 index 0000000000..7035ad16c4 --- /dev/null +++ b/Lang/EasyLang/Taxicab-numbers @@ -0,0 +1 @@ +../../Task/Taxicab-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Teacup-rim-text b/Lang/EasyLang/Teacup-rim-text new file mode 120000 index 0000000000..6602971306 --- /dev/null +++ b/Lang/EasyLang/Teacup-rim-text @@ -0,0 +1 @@ +../../Task/Teacup-rim-text/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Ternary-logic b/Lang/EasyLang/Ternary-logic new file mode 120000 index 0000000000..fbbe98ec9f --- /dev/null +++ b/Lang/EasyLang/Ternary-logic @@ -0,0 +1 @@ +../../Task/Ternary-logic/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Test-integerness b/Lang/EasyLang/Test-integerness new file mode 120000 index 0000000000..e308fb8af8 --- /dev/null +++ b/Lang/EasyLang/Test-integerness @@ -0,0 +1 @@ +../../Task/Test-integerness/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/The-sieve-of-Sundaram b/Lang/EasyLang/The-sieve-of-Sundaram new file mode 120000 index 0000000000..873d444bf6 --- /dev/null +++ b/Lang/EasyLang/The-sieve-of-Sundaram @@ -0,0 +1 @@ +../../Task/The-sieve-of-Sundaram/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Thue-Morse b/Lang/EasyLang/Thue-Morse new file mode 120000 index 0000000000..9e3ae46e6c --- /dev/null +++ b/Lang/EasyLang/Thue-Morse @@ -0,0 +1 @@ +../../Task/Thue-Morse/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Tokenize-a-string-with-escaping b/Lang/EasyLang/Tokenize-a-string-with-escaping new file mode 120000 index 0000000000..1059b903ad --- /dev/null +++ b/Lang/EasyLang/Tokenize-a-string-with-escaping @@ -0,0 +1 @@ +../../Task/Tokenize-a-string-with-escaping/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Top-rank-per-group b/Lang/EasyLang/Top-rank-per-group new file mode 120000 index 0000000000..861db59645 --- /dev/null +++ b/Lang/EasyLang/Top-rank-per-group @@ -0,0 +1 @@ +../../Task/Top-rank-per-group/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Topological-sort b/Lang/EasyLang/Topological-sort new file mode 120000 index 0000000000..8100dde197 --- /dev/null +++ b/Lang/EasyLang/Topological-sort @@ -0,0 +1 @@ +../../Task/Topological-sort/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Topswops b/Lang/EasyLang/Topswops new file mode 120000 index 0000000000..2080f48b84 --- /dev/null +++ b/Lang/EasyLang/Topswops @@ -0,0 +1 @@ +../../Task/Topswops/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Total-circles-area b/Lang/EasyLang/Total-circles-area new file mode 120000 index 0000000000..17bfc868ba --- /dev/null +++ b/Lang/EasyLang/Total-circles-area @@ -0,0 +1 @@ +../../Task/Total-circles-area/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Trabb-Pardo-Knuth-algorithm b/Lang/EasyLang/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..ca1b958ae3 --- /dev/null +++ b/Lang/EasyLang/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Tree-traversal b/Lang/EasyLang/Tree-traversal new file mode 120000 index 0000000000..a81a5f8eea --- /dev/null +++ b/Lang/EasyLang/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Trigonometric-functions b/Lang/EasyLang/Trigonometric-functions new file mode 120000 index 0000000000..387caf6602 --- /dev/null +++ b/Lang/EasyLang/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Truncatable-primes b/Lang/EasyLang/Truncatable-primes new file mode 120000 index 0000000000..4dcfac21ce --- /dev/null +++ b/Lang/EasyLang/Truncatable-primes @@ -0,0 +1 @@ +../../Task/Truncatable-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Truth-table b/Lang/EasyLang/Truth-table new file mode 120000 index 0000000000..73d0946392 --- /dev/null +++ b/Lang/EasyLang/Truth-table @@ -0,0 +1 @@ +../../Task/Truth-table/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Twelve-statements b/Lang/EasyLang/Twelve-statements new file mode 120000 index 0000000000..eb9094a7a2 --- /dev/null +++ b/Lang/EasyLang/Twelve-statements @@ -0,0 +1 @@ +../../Task/Twelve-statements/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Twin-primes b/Lang/EasyLang/Twin-primes new file mode 120000 index 0000000000..7fe7d30975 --- /dev/null +++ b/Lang/EasyLang/Twin-primes @@ -0,0 +1 @@ +../../Task/Twin-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/UPC b/Lang/EasyLang/UPC new file mode 120000 index 0000000000..2bb2969064 --- /dev/null +++ b/Lang/EasyLang/UPC @@ -0,0 +1 @@ +../../Task/UPC/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/URL-decoding b/Lang/EasyLang/URL-decoding new file mode 120000 index 0000000000..a070edc78b --- /dev/null +++ b/Lang/EasyLang/URL-decoding @@ -0,0 +1 @@ +../../Task/URL-decoding/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/URL-encoding b/Lang/EasyLang/URL-encoding new file mode 120000 index 0000000000..c0b065b1e5 --- /dev/null +++ b/Lang/EasyLang/URL-encoding @@ -0,0 +1 @@ +../../Task/URL-encoding/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/UTF-8-encode-and-decode b/Lang/EasyLang/UTF-8-encode-and-decode new file mode 120000 index 0000000000..c4de9115dc --- /dev/null +++ b/Lang/EasyLang/UTF-8-encode-and-decode @@ -0,0 +1 @@ +../../Task/UTF-8-encode-and-decode/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Ulam-spiral-for-primes- b/Lang/EasyLang/Ulam-spiral-for-primes- new file mode 120000 index 0000000000..0cc2a340bc --- /dev/null +++ b/Lang/EasyLang/Ulam-spiral-for-primes- @@ -0,0 +1 @@ +../../Task/Ulam-spiral-for-primes-/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Unbias-a-random-generator b/Lang/EasyLang/Unbias-a-random-generator new file mode 120000 index 0000000000..964b26809c --- /dev/null +++ b/Lang/EasyLang/Unbias-a-random-generator @@ -0,0 +1 @@ +../../Task/Unbias-a-random-generator/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Unicode-strings b/Lang/EasyLang/Unicode-strings new file mode 120000 index 0000000000..c52bd4da5c --- /dev/null +++ b/Lang/EasyLang/Unicode-strings @@ -0,0 +1 @@ +../../Task/Unicode-strings/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Universal-Turing-machine b/Lang/EasyLang/Universal-Turing-machine new file mode 120000 index 0000000000..c6c36c7e83 --- /dev/null +++ b/Lang/EasyLang/Universal-Turing-machine @@ -0,0 +1 @@ +../../Task/Universal-Turing-machine/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Unprimeable-numbers b/Lang/EasyLang/Unprimeable-numbers new file mode 120000 index 0000000000..ae808307c7 --- /dev/null +++ b/Lang/EasyLang/Unprimeable-numbers @@ -0,0 +1 @@ +../../Task/Unprimeable-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Validate-International-Securities-Identification-Number b/Lang/EasyLang/Validate-International-Securities-Identification-Number new file mode 120000 index 0000000000..125038f3d2 --- /dev/null +++ b/Lang/EasyLang/Validate-International-Securities-Identification-Number @@ -0,0 +1 @@ +../../Task/Validate-International-Securities-Identification-Number/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Vampire-number b/Lang/EasyLang/Vampire-number new file mode 120000 index 0000000000..b4339746b7 --- /dev/null +++ b/Lang/EasyLang/Vampire-number @@ -0,0 +1 @@ +../../Task/Vampire-number/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Vector b/Lang/EasyLang/Vector new file mode 120000 index 0000000000..3185c7d539 --- /dev/null +++ b/Lang/EasyLang/Vector @@ -0,0 +1 @@ +../../Task/Vector/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Vector-products b/Lang/EasyLang/Vector-products new file mode 120000 index 0000000000..dd2b30f534 --- /dev/null +++ b/Lang/EasyLang/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Verhoeff-algorithm b/Lang/EasyLang/Verhoeff-algorithm new file mode 120000 index 0000000000..31c375b7e9 --- /dev/null +++ b/Lang/EasyLang/Verhoeff-algorithm @@ -0,0 +1 @@ +../../Task/Verhoeff-algorithm/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Verify-distribution-uniformity-Naive b/Lang/EasyLang/Verify-distribution-uniformity-Naive new file mode 120000 index 0000000000..bc6d548e1b --- /dev/null +++ b/Lang/EasyLang/Verify-distribution-uniformity-Naive @@ -0,0 +1 @@ +../../Task/Verify-distribution-uniformity-Naive/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Vigen-re-cipher-Cryptanalysis b/Lang/EasyLang/Vigen-re-cipher-Cryptanalysis new file mode 120000 index 0000000000..019adf3986 --- /dev/null +++ b/Lang/EasyLang/Vigen-re-cipher-Cryptanalysis @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher-Cryptanalysis/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Vogels-approximation-method b/Lang/EasyLang/Vogels-approximation-method new file mode 120000 index 0000000000..576b7c1373 --- /dev/null +++ b/Lang/EasyLang/Vogels-approximation-method @@ -0,0 +1 @@ +../../Task/Vogels-approximation-method/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Voronoi-diagram b/Lang/EasyLang/Voronoi-diagram new file mode 120000 index 0000000000..d875657141 --- /dev/null +++ b/Lang/EasyLang/Voronoi-diagram @@ -0,0 +1 @@ +../../Task/Voronoi-diagram/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/War-card-game b/Lang/EasyLang/War-card-game new file mode 120000 index 0000000000..4889819208 --- /dev/null +++ b/Lang/EasyLang/War-card-game @@ -0,0 +1 @@ +../../Task/War-card-game/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Wasteful-equidigital-and-frugal-numbers b/Lang/EasyLang/Wasteful-equidigital-and-frugal-numbers new file mode 120000 index 0000000000..2c61d301f5 --- /dev/null +++ b/Lang/EasyLang/Wasteful-equidigital-and-frugal-numbers @@ -0,0 +1 @@ +../../Task/Wasteful-equidigital-and-frugal-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Weird-numbers b/Lang/EasyLang/Weird-numbers new file mode 120000 index 0000000000..503b16eabc --- /dev/null +++ b/Lang/EasyLang/Weird-numbers @@ -0,0 +1 @@ +../../Task/Weird-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Wieferich-primes b/Lang/EasyLang/Wieferich-primes new file mode 120000 index 0000000000..51f8158742 --- /dev/null +++ b/Lang/EasyLang/Wieferich-primes @@ -0,0 +1 @@ +../../Task/Wieferich-primes/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Wilson-primes-of-order-n b/Lang/EasyLang/Wilson-primes-of-order-n new file mode 120000 index 0000000000..a776d56b33 --- /dev/null +++ b/Lang/EasyLang/Wilson-primes-of-order-n @@ -0,0 +1 @@ +../../Task/Wilson-primes-of-order-n/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Wireworld b/Lang/EasyLang/Wireworld new file mode 120000 index 0000000000..873d48f6a7 --- /dev/null +++ b/Lang/EasyLang/Wireworld @@ -0,0 +1 @@ +../../Task/Wireworld/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Word-ladder b/Lang/EasyLang/Word-ladder new file mode 120000 index 0000000000..c40a883a5f --- /dev/null +++ b/Lang/EasyLang/Word-ladder @@ -0,0 +1 @@ +../../Task/Word-ladder/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Word-wheel b/Lang/EasyLang/Word-wheel new file mode 120000 index 0000000000..cc8df0aac8 --- /dev/null +++ b/Lang/EasyLang/Word-wheel @@ -0,0 +1 @@ +../../Task/Word-wheel/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/World-Cup-group-stage b/Lang/EasyLang/World-Cup-group-stage new file mode 120000 index 0000000000..903f2de54b --- /dev/null +++ b/Lang/EasyLang/World-Cup-group-stage @@ -0,0 +1 @@ +../../Task/World-Cup-group-stage/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Xiaolin-Wus-line-algorithm b/Lang/EasyLang/Xiaolin-Wus-line-algorithm new file mode 120000 index 0000000000..ece28f1e59 --- /dev/null +++ b/Lang/EasyLang/Xiaolin-Wus-line-algorithm @@ -0,0 +1 @@ +../../Task/Xiaolin-Wus-line-algorithm/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Yellowstone-sequence b/Lang/EasyLang/Yellowstone-sequence new file mode 120000 index 0000000000..76abf29ac7 --- /dev/null +++ b/Lang/EasyLang/Yellowstone-sequence @@ -0,0 +1 @@ +../../Task/Yellowstone-sequence/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Yin-and-yang b/Lang/EasyLang/Yin-and-yang new file mode 120000 index 0000000000..5eb9553382 --- /dev/null +++ b/Lang/EasyLang/Yin-and-yang @@ -0,0 +1 @@ +../../Task/Yin-and-yang/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Zeckendorf-number-representation b/Lang/EasyLang/Zeckendorf-number-representation new file mode 120000 index 0000000000..8198319b91 --- /dev/null +++ b/Lang/EasyLang/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Zhang-Suen-thinning-algorithm b/Lang/EasyLang/Zhang-Suen-thinning-algorithm new file mode 120000 index 0000000000..06bef59d73 --- /dev/null +++ b/Lang/EasyLang/Zhang-Suen-thinning-algorithm @@ -0,0 +1 @@ +../../Task/Zhang-Suen-thinning-algorithm/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Zig-zag-matrix b/Lang/EasyLang/Zig-zag-matrix new file mode 120000 index 0000000000..59c91477d5 --- /dev/null +++ b/Lang/EasyLang/Zig-zag-matrix @@ -0,0 +1 @@ +../../Task/Zig-zag-matrix/EasyLang \ No newline at end of file diff --git a/Lang/EasyLang/Zumkeller-numbers b/Lang/EasyLang/Zumkeller-numbers new file mode 120000 index 0000000000..194eacc320 --- /dev/null +++ b/Lang/EasyLang/Zumkeller-numbers @@ -0,0 +1 @@ +../../Task/Zumkeller-numbers/EasyLang \ No newline at end of file diff --git a/Lang/EchoLisp/Miller-Rabin-primality-test b/Lang/EchoLisp/Miller-Rabin-primality-test deleted file mode 120000 index a1456f561f..0000000000 --- a/Lang/EchoLisp/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/EchoLisp \ No newline at end of file diff --git a/Lang/Ecstasy/00-LANG.txt b/Lang/Ecstasy/00-LANG.txt index 7358e7f1ea..9c977a310d 100644 --- a/Lang/Ecstasy/00-LANG.txt +++ b/Lang/Ecstasy/00-LANG.txt @@ -25,4 +25,7 @@ The primary benefits of Ecstasy are: * A security model designed for the serverless cloud, using lightweight software containers and dependency injection (IOC/DI) * A reified generic type system with support for unions, intersection, and difference types, first-class tuples and functions, type inference, and type-safe mixins * Built-in concurrency support, with first-class support for object immutability, and the elimination of shared-mutable data -* All of the modern capabilities that developers have grown to depend on, such as: [[garbage collection|Automatic memory management]], an integrated module system, first-class lambdas and functions, partial binding and currying, cross-platform portability, and an open source development model \ No newline at end of file +* All of the modern capabilities that developers have grown to depend on, such as: [[garbage collection|Automatic memory management]], an integrated module system, first-class lambdas and functions, partial binding and currying, cross-platform portability, and an open source development model + +==TODO== +* [[Tasks not implemented in Ecstasy]] \ No newline at end of file diff --git a/Lang/Ecstasy/100-prisoners b/Lang/Ecstasy/100-prisoners new file mode 120000 index 0000000000..e9fb2d2f70 --- /dev/null +++ b/Lang/Ecstasy/100-prisoners @@ -0,0 +1 @@ +../../Task/100-prisoners/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/Assertions b/Lang/Ecstasy/Assertions new file mode 120000 index 0000000000..0802d10c0c --- /dev/null +++ b/Lang/Ecstasy/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/N-queens-problem b/Lang/Ecstasy/N-queens-problem new file mode 120000 index 0000000000..695c0416ee --- /dev/null +++ b/Lang/Ecstasy/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/Pointers-and-references b/Lang/Ecstasy/Pointers-and-references new file mode 120000 index 0000000000..9b85919b2d --- /dev/null +++ b/Lang/Ecstasy/Pointers-and-references @@ -0,0 +1 @@ +../../Task/Pointers-and-references/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/Program-name b/Lang/Ecstasy/Program-name new file mode 120000 index 0000000000..6411623f47 --- /dev/null +++ b/Lang/Ecstasy/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/Reflection-List-methods b/Lang/Ecstasy/Reflection-List-methods new file mode 120000 index 0000000000..f4010fce77 --- /dev/null +++ b/Lang/Ecstasy/Reflection-List-methods @@ -0,0 +1 @@ +../../Task/Reflection-List-methods/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/Reflection-List-properties b/Lang/Ecstasy/Reflection-List-properties new file mode 120000 index 0000000000..40ec86fd95 --- /dev/null +++ b/Lang/Ecstasy/Reflection-List-properties @@ -0,0 +1 @@ +../../Task/Reflection-List-properties/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/Search-a-list b/Lang/Ecstasy/Search-a-list new file mode 120000 index 0000000000..f6044e825c --- /dev/null +++ b/Lang/Ecstasy/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/Send-an-unknown-method-call b/Lang/Ecstasy/Send-an-unknown-method-call new file mode 120000 index 0000000000..5d1a4cbed5 --- /dev/null +++ b/Lang/Ecstasy/Send-an-unknown-method-call @@ -0,0 +1 @@ +../../Task/Send-an-unknown-method-call/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/Singleton b/Lang/Ecstasy/Singleton new file mode 120000 index 0000000000..8c9a0eb1b2 --- /dev/null +++ b/Lang/Ecstasy/Singleton @@ -0,0 +1 @@ +../../Task/Singleton/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/String-case b/Lang/Ecstasy/String-case new file mode 120000 index 0000000000..75c8cc65c2 --- /dev/null +++ b/Lang/Ecstasy/String-case @@ -0,0 +1 @@ +../../Task/String-case/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/String-comparison b/Lang/Ecstasy/String-comparison new file mode 120000 index 0000000000..2a690e7c01 --- /dev/null +++ b/Lang/Ecstasy/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/String-concatenation b/Lang/Ecstasy/String-concatenation new file mode 120000 index 0000000000..a8fc37bb41 --- /dev/null +++ b/Lang/Ecstasy/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/String-length b/Lang/Ecstasy/String-length new file mode 120000 index 0000000000..e3f6d6a12a --- /dev/null +++ b/Lang/Ecstasy/String-length @@ -0,0 +1 @@ +../../Task/String-length/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/Substring b/Lang/Ecstasy/Substring new file mode 120000 index 0000000000..59160f9d22 --- /dev/null +++ b/Lang/Ecstasy/Substring @@ -0,0 +1 @@ +../../Task/Substring/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/Substring-Top-and-tail b/Lang/Ecstasy/Substring-Top-and-tail new file mode 120000 index 0000000000..cf035aa347 --- /dev/null +++ b/Lang/Ecstasy/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Ecstasy \ No newline at end of file diff --git a/Lang/Ecstasy/System-time b/Lang/Ecstasy/System-time new file mode 120000 index 0000000000..4b0a593cce --- /dev/null +++ b/Lang/Ecstasy/System-time @@ -0,0 +1 @@ +../../Task/System-time/Ecstasy \ No newline at end of file diff --git a/Lang/Ed/00-LANG.txt b/Lang/Ed/00-LANG.txt new file mode 100644 index 0000000000..0ffa56bf3c --- /dev/null +++ b/Lang/Ed/00-LANG.txt @@ -0,0 +1,27 @@ +{{stub}} +{{language|Ed}} +This is the command language used by [[wp:ed_(software)]], +the line oriented text editor, not to be confused with [[Sed]], the stream editor. + +Implementations are [[GNU Ed]], [[Plan 9 Ed]], BSD ed, and original UNIX ed. +Ed is also a precursor to a whole family of other text editors and command languages. +Including [[Sed]], ex, vi, vim, sam, and others. + +Ed scripts are usually ran as (on the example of [[GNU Ed]]) + +cat script.ed | ed -lEGs file.in + + +Or, more portably, with Basic Regular Expressions on BSD, Mac, and [[GNU Ed]]. + +cat script.ed | ed -s file.in + + +There's a convention of starting every ed script with capital H on a line of its own, to toggle more verbose error messages on. And optionally end the script with capital Q to force-quit without saving the changes to file. + +A good reference for Ed is it's info page, which can be found online [https://linux.die.net/man/1/ed here]. + +Also see [[Tasks not implemented in Ed]] + +[[Category:Editor]] +[[Category:Utility]] \ No newline at end of file diff --git a/Lang/Ed/00-META.yaml b/Lang/Ed/00-META.yaml new file mode 100644 index 0000000000..8c668497f3 --- /dev/null +++ b/Lang/Ed/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Ed diff --git a/Lang/Ed/A+B b/Lang/Ed/A+B new file mode 120000 index 0000000000..00ee271a45 --- /dev/null +++ b/Lang/Ed/A+B @@ -0,0 +1 @@ +../../Task/A+B/Ed \ No newline at end of file diff --git a/Lang/Ed/Address-of-a-variable b/Lang/Ed/Address-of-a-variable new file mode 120000 index 0000000000..b7216d9c2d --- /dev/null +++ b/Lang/Ed/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/Ed \ No newline at end of file diff --git a/Lang/Ed/Append-a-record-to-the-end-of-a-text-file b/Lang/Ed/Append-a-record-to-the-end-of-a-text-file new file mode 120000 index 0000000000..c20f4ffb66 --- /dev/null +++ b/Lang/Ed/Append-a-record-to-the-end-of-a-text-file @@ -0,0 +1 @@ +../../Task/Append-a-record-to-the-end-of-a-text-file/Ed \ No newline at end of file diff --git a/Lang/Ed/Balanced-brackets b/Lang/Ed/Balanced-brackets new file mode 120000 index 0000000000..12f98da078 --- /dev/null +++ b/Lang/Ed/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Ed \ No newline at end of file diff --git a/Lang/Ed/Base64-decode-data b/Lang/Ed/Base64-decode-data new file mode 120000 index 0000000000..d08c0a29a4 --- /dev/null +++ b/Lang/Ed/Base64-decode-data @@ -0,0 +1 @@ +../../Task/Base64-decode-data/Ed \ No newline at end of file diff --git a/Lang/Ed/Binary-digits b/Lang/Ed/Binary-digits new file mode 120000 index 0000000000..3593438a83 --- /dev/null +++ b/Lang/Ed/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Ed \ No newline at end of file diff --git a/Lang/Ed/Brace-expansion b/Lang/Ed/Brace-expansion new file mode 120000 index 0000000000..57b88b6984 --- /dev/null +++ b/Lang/Ed/Brace-expansion @@ -0,0 +1 @@ +../../Task/Brace-expansion/Ed \ No newline at end of file diff --git a/Lang/Ed/CSV-to-HTML-translation b/Lang/Ed/CSV-to-HTML-translation new file mode 120000 index 0000000000..982d76328a --- /dev/null +++ b/Lang/Ed/CSV-to-HTML-translation @@ -0,0 +1 @@ +../../Task/CSV-to-HTML-translation/Ed \ No newline at end of file diff --git a/Lang/Ed/Camel-case-and-snake-case b/Lang/Ed/Camel-case-and-snake-case new file mode 120000 index 0000000000..34e48e10ce --- /dev/null +++ b/Lang/Ed/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/Ed \ No newline at end of file diff --git a/Lang/Ed/Check-input-device-is-a-terminal b/Lang/Ed/Check-input-device-is-a-terminal new file mode 120000 index 0000000000..aaa70cb2b9 --- /dev/null +++ b/Lang/Ed/Check-input-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-input-device-is-a-terminal/Ed \ No newline at end of file diff --git a/Lang/Ed/Check-output-device-is-a-terminal b/Lang/Ed/Check-output-device-is-a-terminal new file mode 120000 index 0000000000..7304043875 --- /dev/null +++ b/Lang/Ed/Check-output-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-output-device-is-a-terminal/Ed \ No newline at end of file diff --git a/Lang/Ed/Chinese-zodiac b/Lang/Ed/Chinese-zodiac new file mode 120000 index 0000000000..3a56ea0052 --- /dev/null +++ b/Lang/Ed/Chinese-zodiac @@ -0,0 +1 @@ +../../Task/Chinese-zodiac/Ed \ No newline at end of file diff --git a/Lang/Ed/Cistercian-numerals b/Lang/Ed/Cistercian-numerals new file mode 120000 index 0000000000..f8c9ddde28 --- /dev/null +++ b/Lang/Ed/Cistercian-numerals @@ -0,0 +1 @@ +../../Task/Cistercian-numerals/Ed \ No newline at end of file diff --git a/Lang/Ed/Comma-quibbling b/Lang/Ed/Comma-quibbling new file mode 120000 index 0000000000..d9dc3b3989 --- /dev/null +++ b/Lang/Ed/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Ed \ No newline at end of file diff --git a/Lang/Ed/Comments b/Lang/Ed/Comments new file mode 120000 index 0000000000..08d536496b --- /dev/null +++ b/Lang/Ed/Comments @@ -0,0 +1 @@ +../../Task/Comments/Ed \ No newline at end of file diff --git a/Lang/Ed/Conditional-structures b/Lang/Ed/Conditional-structures new file mode 120000 index 0000000000..46db5ede62 --- /dev/null +++ b/Lang/Ed/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Ed \ No newline at end of file diff --git a/Lang/Ed/Copy-a-string b/Lang/Ed/Copy-a-string new file mode 120000 index 0000000000..55ec74ae6a --- /dev/null +++ b/Lang/Ed/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Ed \ No newline at end of file diff --git a/Lang/Ed/Count-occurrences-of-a-substring b/Lang/Ed/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..1c698d3069 --- /dev/null +++ b/Lang/Ed/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Ed \ No newline at end of file diff --git a/Lang/Ed/Create-a-file b/Lang/Ed/Create-a-file new file mode 120000 index 0000000000..11ca37c1ec --- /dev/null +++ b/Lang/Ed/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/Ed \ No newline at end of file diff --git a/Lang/Ed/Date-format b/Lang/Ed/Date-format new file mode 120000 index 0000000000..972dcea98a --- /dev/null +++ b/Lang/Ed/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Ed \ No newline at end of file diff --git a/Lang/Ed/Delete-a-file b/Lang/Ed/Delete-a-file new file mode 120000 index 0000000000..f208022c59 --- /dev/null +++ b/Lang/Ed/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Ed \ No newline at end of file diff --git a/Lang/Ed/Determine-if-a-string-has-all-the-same-characters b/Lang/Ed/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..448ed7ccc8 --- /dev/null +++ b/Lang/Ed/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/Ed \ No newline at end of file diff --git a/Lang/Ed/Determine-if-a-string-has-all-unique-characters b/Lang/Ed/Determine-if-a-string-has-all-unique-characters new file mode 120000 index 0000000000..3ce9aedae3 --- /dev/null +++ b/Lang/Ed/Determine-if-a-string-has-all-unique-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-unique-characters/Ed \ No newline at end of file diff --git a/Lang/Ed/Determine-if-a-string-is-collapsible b/Lang/Ed/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..8b2921d3eb --- /dev/null +++ b/Lang/Ed/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/Ed \ No newline at end of file diff --git a/Lang/Ed/Determine-if-a-string-is-numeric b/Lang/Ed/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..05c951f131 --- /dev/null +++ b/Lang/Ed/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Ed \ No newline at end of file diff --git a/Lang/Ed/Empty-string b/Lang/Ed/Empty-string new file mode 120000 index 0000000000..d609b5a73a --- /dev/null +++ b/Lang/Ed/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Ed \ No newline at end of file diff --git a/Lang/Ed/Ethiopian-multiplication b/Lang/Ed/Ethiopian-multiplication new file mode 120000 index 0000000000..a218310c2e --- /dev/null +++ b/Lang/Ed/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Ed \ No newline at end of file diff --git a/Lang/Ed/Even-or-odd b/Lang/Ed/Even-or-odd new file mode 120000 index 0000000000..216cea134c --- /dev/null +++ b/Lang/Ed/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Ed \ No newline at end of file diff --git a/Lang/Ed/File-input-output b/Lang/Ed/File-input-output new file mode 120000 index 0000000000..ab2356c090 --- /dev/null +++ b/Lang/Ed/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/Ed \ No newline at end of file diff --git a/Lang/Ed/Filter b/Lang/Ed/Filter new file mode 120000 index 0000000000..0e10013135 --- /dev/null +++ b/Lang/Ed/Filter @@ -0,0 +1 @@ +../../Task/Filter/Ed \ No newline at end of file diff --git a/Lang/Ed/Find-common-directory-path b/Lang/Ed/Find-common-directory-path new file mode 120000 index 0000000000..31b50e9c25 --- /dev/null +++ b/Lang/Ed/Find-common-directory-path @@ -0,0 +1 @@ +../../Task/Find-common-directory-path/Ed \ No newline at end of file diff --git a/Lang/Ed/FizzBuzz b/Lang/Ed/FizzBuzz new file mode 120000 index 0000000000..5f01963d2b --- /dev/null +++ b/Lang/Ed/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Ed \ No newline at end of file diff --git a/Lang/Ed/Hello-world-Text b/Lang/Ed/Hello-world-Text new file mode 120000 index 0000000000..09329e9578 --- /dev/null +++ b/Lang/Ed/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Ed \ No newline at end of file diff --git a/Lang/Ed/Here-document b/Lang/Ed/Here-document new file mode 120000 index 0000000000..1aca222a29 --- /dev/null +++ b/Lang/Ed/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/Ed \ No newline at end of file diff --git a/Lang/Ed/I-before-E-except-after-C b/Lang/Ed/I-before-E-except-after-C new file mode 120000 index 0000000000..017b410bd0 --- /dev/null +++ b/Lang/Ed/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/Ed \ No newline at end of file diff --git a/Lang/Ed/Increment-a-numerical-string b/Lang/Ed/Increment-a-numerical-string new file mode 120000 index 0000000000..e55a87b09f --- /dev/null +++ b/Lang/Ed/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Ed \ No newline at end of file diff --git a/Lang/Ed/Jewels-and-stones b/Lang/Ed/Jewels-and-stones new file mode 120000 index 0000000000..aa6e0865ea --- /dev/null +++ b/Lang/Ed/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/Ed \ No newline at end of file diff --git a/Lang/Ed/Longest-common-subsequence b/Lang/Ed/Longest-common-subsequence new file mode 120000 index 0000000000..d0e8efbf1e --- /dev/null +++ b/Lang/Ed/Longest-common-subsequence @@ -0,0 +1 @@ +../../Task/Longest-common-subsequence/Ed \ No newline at end of file diff --git a/Lang/Ed/Loops-For b/Lang/Ed/Loops-For new file mode 120000 index 0000000000..3de59c57c2 --- /dev/null +++ b/Lang/Ed/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Ed \ No newline at end of file diff --git a/Lang/Ed/Loops-Foreach b/Lang/Ed/Loops-Foreach new file mode 120000 index 0000000000..c06f3655df --- /dev/null +++ b/Lang/Ed/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Ed \ No newline at end of file diff --git a/Lang/Ed/Morse-code b/Lang/Ed/Morse-code new file mode 120000 index 0000000000..e5384e5776 --- /dev/null +++ b/Lang/Ed/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/Ed \ No newline at end of file diff --git a/Lang/Ed/Nth b/Lang/Ed/Nth new file mode 120000 index 0000000000..d2f15b3c88 --- /dev/null +++ b/Lang/Ed/Nth @@ -0,0 +1 @@ +../../Task/Nth/Ed \ No newline at end of file diff --git a/Lang/Ed/Palindrome-detection b/Lang/Ed/Palindrome-detection new file mode 120000 index 0000000000..1bec256a92 --- /dev/null +++ b/Lang/Ed/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Ed \ No newline at end of file diff --git a/Lang/Ed/Phrase-reversals b/Lang/Ed/Phrase-reversals new file mode 120000 index 0000000000..0ee3f41dfa --- /dev/null +++ b/Lang/Ed/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Ed \ No newline at end of file diff --git a/Lang/Ed/Quine b/Lang/Ed/Quine new file mode 120000 index 0000000000..3690e73126 --- /dev/null +++ b/Lang/Ed/Quine @@ -0,0 +1 @@ +../../Task/Quine/Ed \ No newline at end of file diff --git a/Lang/Ed/Random-number-generator-device- b/Lang/Ed/Random-number-generator-device- new file mode 120000 index 0000000000..ebfa530984 --- /dev/null +++ b/Lang/Ed/Random-number-generator-device- @@ -0,0 +1 @@ +../../Task/Random-number-generator-device-/Ed \ No newline at end of file diff --git a/Lang/Ed/Read-a-specific-line-from-a-file b/Lang/Ed/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..68b3526a94 --- /dev/null +++ b/Lang/Ed/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/Ed \ No newline at end of file diff --git a/Lang/Ed/Regular-expressions b/Lang/Ed/Regular-expressions new file mode 120000 index 0000000000..03fa790d32 --- /dev/null +++ b/Lang/Ed/Regular-expressions @@ -0,0 +1 @@ +../../Task/Regular-expressions/Ed \ No newline at end of file diff --git a/Lang/Ed/Rep-string b/Lang/Ed/Rep-string new file mode 120000 index 0000000000..1cabc7547c --- /dev/null +++ b/Lang/Ed/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/Ed \ No newline at end of file diff --git a/Lang/Ed/Repeat-a-string b/Lang/Ed/Repeat-a-string new file mode 120000 index 0000000000..88553bc853 --- /dev/null +++ b/Lang/Ed/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Ed \ No newline at end of file diff --git a/Lang/Ed/Reverse-a-string b/Lang/Ed/Reverse-a-string new file mode 120000 index 0000000000..6104b59dd9 --- /dev/null +++ b/Lang/Ed/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Ed \ No newline at end of file diff --git a/Lang/Ed/Reverse-words-in-a-string b/Lang/Ed/Reverse-words-in-a-string new file mode 120000 index 0000000000..d59e80e1fb --- /dev/null +++ b/Lang/Ed/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/Ed \ No newline at end of file diff --git a/Lang/Ed/Roman-numerals-Decode b/Lang/Ed/Roman-numerals-Decode new file mode 120000 index 0000000000..81a8608ea4 --- /dev/null +++ b/Lang/Ed/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/Ed \ No newline at end of file diff --git a/Lang/Ed/Roman-numerals-Encode b/Lang/Ed/Roman-numerals-Encode new file mode 120000 index 0000000000..686206e904 --- /dev/null +++ b/Lang/Ed/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Ed \ No newline at end of file diff --git a/Lang/Ed/Rot-13 b/Lang/Ed/Rot-13 new file mode 120000 index 0000000000..731a496ae9 --- /dev/null +++ b/Lang/Ed/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Ed \ No newline at end of file diff --git a/Lang/Ed/Run-length-encoding b/Lang/Ed/Run-length-encoding new file mode 120000 index 0000000000..69e6b1b531 --- /dev/null +++ b/Lang/Ed/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/Ed \ No newline at end of file diff --git a/Lang/Ed/Selectively-replace-multiple-instances-of-a-character-within-a-string b/Lang/Ed/Selectively-replace-multiple-instances-of-a-character-within-a-string new file mode 120000 index 0000000000..e414614b56 --- /dev/null +++ b/Lang/Ed/Selectively-replace-multiple-instances-of-a-character-within-a-string @@ -0,0 +1 @@ +../../Task/Selectively-replace-multiple-instances-of-a-character-within-a-string/Ed \ No newline at end of file diff --git a/Lang/Ed/Semordnilap b/Lang/Ed/Semordnilap new file mode 120000 index 0000000000..daf7a5ecb1 --- /dev/null +++ b/Lang/Ed/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/Ed \ No newline at end of file diff --git a/Lang/Ed/Sort-an-integer-array b/Lang/Ed/Sort-an-integer-array new file mode 120000 index 0000000000..b1a2a66ffa --- /dev/null +++ b/Lang/Ed/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Ed \ No newline at end of file diff --git a/Lang/Ed/Split-a-character-string-based-on-change-of-character b/Lang/Ed/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..0033ba43dd --- /dev/null +++ b/Lang/Ed/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/Ed \ No newline at end of file diff --git a/Lang/Ed/String-case b/Lang/Ed/String-case new file mode 120000 index 0000000000..daab926f48 --- /dev/null +++ b/Lang/Ed/String-case @@ -0,0 +1 @@ +../../Task/String-case/Ed \ No newline at end of file diff --git a/Lang/Ed/String-comparison b/Lang/Ed/String-comparison new file mode 120000 index 0000000000..d24860c04c --- /dev/null +++ b/Lang/Ed/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/Ed \ No newline at end of file diff --git a/Lang/Ed/String-concatenation b/Lang/Ed/String-concatenation new file mode 120000 index 0000000000..f24bfde76e --- /dev/null +++ b/Lang/Ed/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Ed \ No newline at end of file diff --git a/Lang/Ed/String-interpolation-included- b/Lang/Ed/String-interpolation-included- new file mode 120000 index 0000000000..6b90881c7e --- /dev/null +++ b/Lang/Ed/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/Ed \ No newline at end of file diff --git a/Lang/Ed/String-length b/Lang/Ed/String-length new file mode 120000 index 0000000000..de41c29ef2 --- /dev/null +++ b/Lang/Ed/String-length @@ -0,0 +1 @@ +../../Task/String-length/Ed \ No newline at end of file diff --git a/Lang/Ed/String-matching b/Lang/Ed/String-matching new file mode 120000 index 0000000000..2895138190 --- /dev/null +++ b/Lang/Ed/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/Ed \ No newline at end of file diff --git a/Lang/Ed/String-prepend b/Lang/Ed/String-prepend new file mode 120000 index 0000000000..ce1d9a46f5 --- /dev/null +++ b/Lang/Ed/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Ed \ No newline at end of file diff --git a/Lang/Ed/Strip-a-set-of-characters-from-a-string b/Lang/Ed/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..6a57ca5210 --- /dev/null +++ b/Lang/Ed/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Ed \ No newline at end of file diff --git a/Lang/Ed/Strip-block-comments b/Lang/Ed/Strip-block-comments new file mode 120000 index 0000000000..913cdfb609 --- /dev/null +++ b/Lang/Ed/Strip-block-comments @@ -0,0 +1 @@ +../../Task/Strip-block-comments/Ed \ No newline at end of file diff --git a/Lang/Ed/Strip-comments-from-a-string b/Lang/Ed/Strip-comments-from-a-string new file mode 120000 index 0000000000..f7c3c178f3 --- /dev/null +++ b/Lang/Ed/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/Ed \ No newline at end of file diff --git a/Lang/Ed/Strip-control-codes-and-extended-characters-from-a-string b/Lang/Ed/Strip-control-codes-and-extended-characters-from-a-string new file mode 120000 index 0000000000..8cffb60723 --- /dev/null +++ b/Lang/Ed/Strip-control-codes-and-extended-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-control-codes-and-extended-characters-from-a-string/Ed \ No newline at end of file diff --git a/Lang/Ed/Strip-whitespace-from-a-string-Top-and-tail b/Lang/Ed/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..87421d1e38 --- /dev/null +++ b/Lang/Ed/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/Ed \ No newline at end of file diff --git a/Lang/Ed/Substring b/Lang/Ed/Substring new file mode 120000 index 0000000000..373a20b8f4 --- /dev/null +++ b/Lang/Ed/Substring @@ -0,0 +1 @@ +../../Task/Substring/Ed \ No newline at end of file diff --git a/Lang/Ed/Substring-Top-and-tail b/Lang/Ed/Substring-Top-and-tail new file mode 120000 index 0000000000..bff998aeb0 --- /dev/null +++ b/Lang/Ed/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Ed \ No newline at end of file diff --git a/Lang/Ed/Tokenize-a-string b/Lang/Ed/Tokenize-a-string new file mode 120000 index 0000000000..d8f4499b3c --- /dev/null +++ b/Lang/Ed/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Ed \ No newline at end of file diff --git a/Lang/Ed/Word-wrap b/Lang/Ed/Word-wrap new file mode 120000 index 0000000000..b86e0349c6 --- /dev/null +++ b/Lang/Ed/Word-wrap @@ -0,0 +1 @@ +../../Task/Word-wrap/Ed \ No newline at end of file diff --git a/Lang/Eero/Quaternion-type b/Lang/Eero/Quaternion-type deleted file mode 120000 index 91a82e433f..0000000000 --- a/Lang/Eero/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Eero \ No newline at end of file diff --git a/Lang/Eiffel/Loops-For b/Lang/Eiffel/Loops-For new file mode 120000 index 0000000000..30f93ee824 --- /dev/null +++ b/Lang/Eiffel/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Eiffel \ No newline at end of file diff --git a/Lang/Eiffel/Loops-Infinite b/Lang/Eiffel/Loops-Infinite new file mode 120000 index 0000000000..1016f5af23 --- /dev/null +++ b/Lang/Eiffel/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Eiffel \ No newline at end of file diff --git a/Lang/Elena/00-LANG.txt b/Lang/Elena/00-LANG.txt index 671257e3ee..c3a21bf2d4 100644 --- a/Lang/Elena/00-LANG.txt +++ b/Lang/Elena/00-LANG.txt @@ -1,5 +1,5 @@ {{language|Elena -|site=http://elenalang.sourceforge.net +|site=https://elena-lang.github.io/ |exec=bytecode |strength=strong |safety=safe diff --git a/Lang/Elena/Comma-quibbling b/Lang/Elena/Comma-quibbling new file mode 120000 index 0000000000..f92aff5654 --- /dev/null +++ b/Lang/Elena/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Elena \ No newline at end of file diff --git a/Lang/Elena/Concurrent-computing b/Lang/Elena/Concurrent-computing new file mode 120000 index 0000000000..d22278e519 --- /dev/null +++ b/Lang/Elena/Concurrent-computing @@ -0,0 +1 @@ +../../Task/Concurrent-computing/Elena \ No newline at end of file diff --git a/Lang/Elena/HTTP b/Lang/Elena/HTTP new file mode 120000 index 0000000000..c94b6f99cd --- /dev/null +++ b/Lang/Elena/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/Elena \ No newline at end of file diff --git a/Lang/Elena/HTTPS b/Lang/Elena/HTTPS new file mode 120000 index 0000000000..879dfcb045 --- /dev/null +++ b/Lang/Elena/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/Elena \ No newline at end of file diff --git a/Lang/Elena/Quaternion-type b/Lang/Elena/Quaternion-type deleted file mode 120000 index 1637f784c6..0000000000 --- a/Lang/Elena/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Elena \ No newline at end of file diff --git a/Lang/Elixir/Cyclops-numbers b/Lang/Elixir/Cyclops-numbers new file mode 120000 index 0000000000..0e8897c007 --- /dev/null +++ b/Lang/Elixir/Cyclops-numbers @@ -0,0 +1 @@ +../../Task/Cyclops-numbers/Elixir \ No newline at end of file diff --git a/Lang/Elixir/Determinant-and-permanent b/Lang/Elixir/Determinant-and-permanent new file mode 120000 index 0000000000..91e99770a2 --- /dev/null +++ b/Lang/Elixir/Determinant-and-permanent @@ -0,0 +1 @@ +../../Task/Determinant-and-permanent/Elixir \ No newline at end of file diff --git a/Lang/Elixir/Empty-program b/Lang/Elixir/Empty-program deleted file mode 120000 index e1c7956a55..0000000000 --- a/Lang/Elixir/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Elixir \ No newline at end of file diff --git a/Lang/Elixir/Gapful-numbers b/Lang/Elixir/Gapful-numbers new file mode 120000 index 0000000000..c482e40173 --- /dev/null +++ b/Lang/Elixir/Gapful-numbers @@ -0,0 +1 @@ +../../Task/Gapful-numbers/Elixir \ No newline at end of file diff --git a/Lang/Elixir/K-d-tree b/Lang/Elixir/K-d-tree new file mode 120000 index 0000000000..4a7008abc8 --- /dev/null +++ b/Lang/Elixir/K-d-tree @@ -0,0 +1 @@ +../../Task/K-d-tree/Elixir \ No newline at end of file diff --git a/Lang/Elixir/Miller-Rabin-primality-test b/Lang/Elixir/Miller-Rabin-primality-test deleted file mode 120000 index 911bb7e6dd..0000000000 --- a/Lang/Elixir/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Elixir \ No newline at end of file diff --git a/Lang/Elixir/Padovan-sequence b/Lang/Elixir/Padovan-sequence new file mode 120000 index 0000000000..1b11fdfcb3 --- /dev/null +++ b/Lang/Elixir/Padovan-sequence @@ -0,0 +1 @@ +../../Task/Padovan-sequence/Elixir \ No newline at end of file diff --git a/Lang/Elixir/Parallel-brute-force b/Lang/Elixir/Parallel-brute-force new file mode 120000 index 0000000000..154ccc9bb9 --- /dev/null +++ b/Lang/Elixir/Parallel-brute-force @@ -0,0 +1 @@ +../../Task/Parallel-brute-force/Elixir \ No newline at end of file diff --git a/Lang/Elixir/Parse-an-IP-Address b/Lang/Elixir/Parse-an-IP-Address new file mode 120000 index 0000000000..bad8e9a86e --- /dev/null +++ b/Lang/Elixir/Parse-an-IP-Address @@ -0,0 +1 @@ +../../Task/Parse-an-IP-Address/Elixir \ No newline at end of file diff --git a/Lang/Elixir/Shoelace-formula-for-polygonal-area b/Lang/Elixir/Shoelace-formula-for-polygonal-area new file mode 120000 index 0000000000..f28f8d7f49 --- /dev/null +++ b/Lang/Elixir/Shoelace-formula-for-polygonal-area @@ -0,0 +1 @@ +../../Task/Shoelace-formula-for-polygonal-area/Elixir \ No newline at end of file diff --git a/Lang/Elixir/Sorting-Algorithms-Circle-Sort b/Lang/Elixir/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 97335bafb5..0000000000 --- a/Lang/Elixir/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Elixir \ No newline at end of file diff --git a/Lang/Elixir/Strassens-algorithm b/Lang/Elixir/Strassens-algorithm new file mode 120000 index 0000000000..b73f87ff60 --- /dev/null +++ b/Lang/Elixir/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Elixir \ No newline at end of file diff --git a/Lang/Elm/Caesar-cipher b/Lang/Elm/Caesar-cipher new file mode 120000 index 0000000000..e2f4604523 --- /dev/null +++ b/Lang/Elm/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Elm \ No newline at end of file diff --git a/Lang/Elm/Greatest-common-divisor b/Lang/Elm/Greatest-common-divisor new file mode 120000 index 0000000000..b61057b86e --- /dev/null +++ b/Lang/Elm/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Elm \ No newline at end of file diff --git a/Lang/Elm/Prime-decomposition b/Lang/Elm/Prime-decomposition new file mode 120000 index 0000000000..a3a9b92e08 --- /dev/null +++ b/Lang/Elm/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/Elm \ No newline at end of file diff --git a/Lang/Elm/Sum-of-a-series b/Lang/Elm/Sum-of-a-series new file mode 120000 index 0000000000..b1ba524bb3 --- /dev/null +++ b/Lang/Elm/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Elm \ No newline at end of file diff --git a/Lang/Emacs-Lisp/AVL-tree b/Lang/Emacs-Lisp/AVL-tree new file mode 120000 index 0000000000..b9212102d2 --- /dev/null +++ b/Lang/Emacs-Lisp/AVL-tree @@ -0,0 +1 @@ +../../Task/AVL-tree/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Abbreviations-automatic b/Lang/Emacs-Lisp/Abbreviations-automatic new file mode 120000 index 0000000000..917fbde092 --- /dev/null +++ b/Lang/Emacs-Lisp/Abbreviations-automatic @@ -0,0 +1 @@ +../../Task/Abbreviations-automatic/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Align-columns b/Lang/Emacs-Lisp/Align-columns new file mode 120000 index 0000000000..9be61160c6 --- /dev/null +++ b/Lang/Emacs-Lisp/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Anagrams b/Lang/Emacs-Lisp/Anagrams new file mode 120000 index 0000000000..0bf987f884 --- /dev/null +++ b/Lang/Emacs-Lisp/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Bulls-and-cows b/Lang/Emacs-Lisp/Bulls-and-cows new file mode 120000 index 0000000000..b0602ecaf2 --- /dev/null +++ b/Lang/Emacs-Lisp/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Color-wheel b/Lang/Emacs-Lisp/Color-wheel new file mode 120000 index 0000000000..90b9cec116 --- /dev/null +++ b/Lang/Emacs-Lisp/Color-wheel @@ -0,0 +1 @@ +../../Task/Color-wheel/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Compare-length-of-two-strings b/Lang/Emacs-Lisp/Compare-length-of-two-strings new file mode 120000 index 0000000000..2aa87a97f8 --- /dev/null +++ b/Lang/Emacs-Lisp/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Count-occurrences-of-a-substring b/Lang/Emacs-Lisp/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..461c47a81c --- /dev/null +++ b/Lang/Emacs-Lisp/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Date-manipulation b/Lang/Emacs-Lisp/Date-manipulation new file mode 120000 index 0000000000..d88e6a9576 --- /dev/null +++ b/Lang/Emacs-Lisp/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Determine-if-a-string-is-numeric b/Lang/Emacs-Lisp/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..2314291eaa --- /dev/null +++ b/Lang/Emacs-Lisp/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Determine-sentence-type b/Lang/Emacs-Lisp/Determine-sentence-type new file mode 120000 index 0000000000..633b068253 --- /dev/null +++ b/Lang/Emacs-Lisp/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Find-palindromic-numbers-in-both-binary-and-ternary-bases b/Lang/Emacs-Lisp/Find-palindromic-numbers-in-both-binary-and-ternary-bases new file mode 120000 index 0000000000..d1e4e53b61 --- /dev/null +++ b/Lang/Emacs-Lisp/Find-palindromic-numbers-in-both-binary-and-ternary-bases @@ -0,0 +1 @@ +../../Task/Find-palindromic-numbers-in-both-binary-and-ternary-bases/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Generate-random-chess-position b/Lang/Emacs-Lisp/Generate-random-chess-position new file mode 120000 index 0000000000..7ef4f0bf90 --- /dev/null +++ b/Lang/Emacs-Lisp/Generate-random-chess-position @@ -0,0 +1 @@ +../../Task/Generate-random-chess-position/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Keyboard-input-Flush-the-keyboard-buffer b/Lang/Emacs-Lisp/Keyboard-input-Flush-the-keyboard-buffer new file mode 120000 index 0000000000..db888b4ffd --- /dev/null +++ b/Lang/Emacs-Lisp/Keyboard-input-Flush-the-keyboard-buffer @@ -0,0 +1 @@ +../../Task/Keyboard-input-Flush-the-keyboard-buffer/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Keyboard-input-Keypress-check b/Lang/Emacs-Lisp/Keyboard-input-Keypress-check new file mode 120000 index 0000000000..1bf55a234e --- /dev/null +++ b/Lang/Emacs-Lisp/Keyboard-input-Keypress-check @@ -0,0 +1 @@ +../../Task/Keyboard-input-Keypress-check/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/Emacs-Lisp/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..d6205cc54b --- /dev/null +++ b/Lang/Emacs-Lisp/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Letter-frequency b/Lang/Emacs-Lisp/Letter-frequency new file mode 120000 index 0000000000..fd0ce57ae8 --- /dev/null +++ b/Lang/Emacs-Lisp/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Ordered-words b/Lang/Emacs-Lisp/Ordered-words new file mode 120000 index 0000000000..444b596fcd --- /dev/null +++ b/Lang/Emacs-Lisp/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Search-a-list b/Lang/Emacs-Lisp/Search-a-list new file mode 120000 index 0000000000..6aef3bcdb0 --- /dev/null +++ b/Lang/Emacs-Lisp/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Snake b/Lang/Emacs-Lisp/Snake new file mode 120000 index 0000000000..b334d7a373 --- /dev/null +++ b/Lang/Emacs-Lisp/Snake @@ -0,0 +1 @@ +../../Task/Snake/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Soundex b/Lang/Emacs-Lisp/Soundex new file mode 120000 index 0000000000..d8aeb9b48e --- /dev/null +++ b/Lang/Emacs-Lisp/Soundex @@ -0,0 +1 @@ +../../Task/Soundex/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Split-a-character-string-based-on-change-of-character b/Lang/Emacs-Lisp/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..7bff70bc55 --- /dev/null +++ b/Lang/Emacs-Lisp/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Strip-a-set-of-characters-from-a-string b/Lang/Emacs-Lisp/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..901b18a4e0 --- /dev/null +++ b/Lang/Emacs-Lisp/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Strip-comments-from-a-string b/Lang/Emacs-Lisp/Strip-comments-from-a-string new file mode 120000 index 0000000000..e8fcd5a3c3 --- /dev/null +++ b/Lang/Emacs-Lisp/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Substitution-cipher b/Lang/Emacs-Lisp/Substitution-cipher new file mode 120000 index 0000000000..93f7ee4d63 --- /dev/null +++ b/Lang/Emacs-Lisp/Substitution-cipher @@ -0,0 +1 @@ +../../Task/Substitution-cipher/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Emacs-Lisp/Word-frequency b/Lang/Emacs-Lisp/Word-frequency new file mode 120000 index 0000000000..74fd09e7f4 --- /dev/null +++ b/Lang/Emacs-Lisp/Word-frequency @@ -0,0 +1 @@ +../../Task/Word-frequency/Emacs-Lisp \ No newline at end of file diff --git a/Lang/Erlang/Cheryls-birthday b/Lang/Erlang/Cheryls-birthday new file mode 120000 index 0000000000..2e3c0e28bc --- /dev/null +++ b/Lang/Erlang/Cheryls-birthday @@ -0,0 +1 @@ +../../Task/Cheryls-birthday/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Determinant-and-permanent b/Lang/Erlang/Determinant-and-permanent new file mode 120000 index 0000000000..1dcba08234 --- /dev/null +++ b/Lang/Erlang/Determinant-and-permanent @@ -0,0 +1 @@ +../../Task/Determinant-and-permanent/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Floyd-Warshall-algorithm b/Lang/Erlang/Floyd-Warshall-algorithm new file mode 120000 index 0000000000..ac856e6ffa --- /dev/null +++ b/Lang/Erlang/Floyd-Warshall-algorithm @@ -0,0 +1 @@ +../../Task/Floyd-Warshall-algorithm/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Long-multiplication b/Lang/Erlang/Long-multiplication new file mode 120000 index 0000000000..12ca47c665 --- /dev/null +++ b/Lang/Erlang/Long-multiplication @@ -0,0 +1 @@ +../../Task/Long-multiplication/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Miller-Rabin-primality-test b/Lang/Erlang/Miller-Rabin-primality-test deleted file mode 120000 index 5bdd377694..0000000000 --- a/Lang/Erlang/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Parse-an-IP-Address b/Lang/Erlang/Parse-an-IP-Address new file mode 120000 index 0000000000..3e48d0f0b1 --- /dev/null +++ b/Lang/Erlang/Parse-an-IP-Address @@ -0,0 +1 @@ +../../Task/Parse-an-IP-Address/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Stem-and-leaf-plot b/Lang/Erlang/Stem-and-leaf-plot new file mode 120000 index 0000000000..1763f740f3 --- /dev/null +++ b/Lang/Erlang/Stem-and-leaf-plot @@ -0,0 +1 @@ +../../Task/Stem-and-leaf-plot/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Strassens-algorithm b/Lang/Erlang/Strassens-algorithm new file mode 120000 index 0000000000..62150c659e --- /dev/null +++ b/Lang/Erlang/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Super-d-numbers b/Lang/Erlang/Super-d-numbers new file mode 120000 index 0000000000..de46d8ba65 --- /dev/null +++ b/Lang/Erlang/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Tonelli-Shanks-algorithm b/Lang/Erlang/Tonelli-Shanks-algorithm new file mode 120000 index 0000000000..5c601a781e --- /dev/null +++ b/Lang/Erlang/Tonelli-Shanks-algorithm @@ -0,0 +1 @@ +../../Task/Tonelli-Shanks-algorithm/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Zeckendorf-number-representation b/Lang/Erlang/Zeckendorf-number-representation new file mode 120000 index 0000000000..6a77e53f6b --- /dev/null +++ b/Lang/Erlang/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/Erlang \ No newline at end of file diff --git a/Lang/Euler/FizzBuzz b/Lang/Euler/FizzBuzz deleted file mode 120000 index 407a608e21..0000000000 --- a/Lang/Euler/FizzBuzz +++ /dev/null @@ -1 +0,0 @@ -../../Task/FizzBuzz/Euler \ No newline at end of file diff --git a/Lang/Euler/Giuga-numbers b/Lang/Euler/Giuga-numbers deleted file mode 120000 index d2ecdddc43..0000000000 --- a/Lang/Euler/Giuga-numbers +++ /dev/null @@ -1 +0,0 @@ -../../Task/Giuga-numbers/Euler \ No newline at end of file diff --git a/Lang/Euler/Jensens-Device b/Lang/Euler/Jensens-Device deleted file mode 120000 index f153ab6bd3..0000000000 --- a/Lang/Euler/Jensens-Device +++ /dev/null @@ -1 +0,0 @@ -../../Task/Jensens-Device/Euler \ No newline at end of file diff --git a/Lang/Euler/Return-multiple-values b/Lang/Euler/Return-multiple-values deleted file mode 120000 index 661e0398e8..0000000000 --- a/Lang/Euler/Return-multiple-values +++ /dev/null @@ -1 +0,0 @@ -../../Task/Return-multiple-values/Euler \ No newline at end of file diff --git a/Lang/Euler/Sum-and-product-of-an-array b/Lang/Euler/Sum-and-product-of-an-array deleted file mode 120000 index da7cbd08c8..0000000000 --- a/Lang/Euler/Sum-and-product-of-an-array +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sum-and-product-of-an-array/Euler \ No newline at end of file diff --git a/Lang/Euler/Sum-of-squares b/Lang/Euler/Sum-of-squares deleted file mode 120000 index 1bc1bddf09..0000000000 --- a/Lang/Euler/Sum-of-squares +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sum-of-squares/Euler \ No newline at end of file diff --git a/Lang/Euphoria/00-LANG.txt b/Lang/Euphoria/00-LANG.txt index 702dca9e88..9dc38ade08 100644 --- a/Lang/Euphoria/00-LANG.txt +++ b/Lang/Euphoria/00-LANG.txt @@ -18,4 +18,7 @@ Euphoria is a powerful yet simple programming language, developed by Robert Crai ==See also== * [[wp:Euphoria (programming language)|Euphoria on Wikipedia]] * [http://rapideuphoria.com/ RapidEuphoria site] -* [http://openeuphoria.org/ openEuphoria site] \ No newline at end of file +* [http://openeuphoria.org/ openEuphoria site] + +==Todo== +[https://rosettacode.org/wiki/Tasks_not_implemented_in_Euphoria Tasks not implemented in Euphoria] \ No newline at end of file diff --git a/Lang/Euphoria/Calculating-the-value-of-e b/Lang/Euphoria/Calculating-the-value-of-e new file mode 120000 index 0000000000..ae2255b209 --- /dev/null +++ b/Lang/Euphoria/Calculating-the-value-of-e @@ -0,0 +1 @@ +../../Task/Calculating-the-value-of-e/Euphoria \ No newline at end of file diff --git a/Lang/Euphoria/Combinations b/Lang/Euphoria/Combinations new file mode 120000 index 0000000000..10b7f0283e --- /dev/null +++ b/Lang/Euphoria/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Euphoria \ No newline at end of file diff --git a/Lang/Euphoria/Convert-seconds-to-compound-duration b/Lang/Euphoria/Convert-seconds-to-compound-duration new file mode 120000 index 0000000000..91ba9055cf --- /dev/null +++ b/Lang/Euphoria/Convert-seconds-to-compound-duration @@ -0,0 +1 @@ +../../Task/Convert-seconds-to-compound-duration/Euphoria \ No newline at end of file diff --git a/Lang/Euphoria/Empty-program b/Lang/Euphoria/Empty-program deleted file mode 120000 index 241cd5711b..0000000000 --- a/Lang/Euphoria/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Euphoria \ No newline at end of file diff --git a/Lang/Euphoria/File-size-distribution b/Lang/Euphoria/File-size-distribution new file mode 120000 index 0000000000..a10a0eb48b --- /dev/null +++ b/Lang/Euphoria/File-size-distribution @@ -0,0 +1 @@ +../../Task/File-size-distribution/Euphoria \ No newline at end of file diff --git a/Lang/Euphoria/Nth b/Lang/Euphoria/Nth new file mode 120000 index 0000000000..6f87edee5c --- /dev/null +++ b/Lang/Euphoria/Nth @@ -0,0 +1 @@ +../../Task/Nth/Euphoria \ No newline at end of file diff --git a/Lang/Euphoria/Quaternion-type b/Lang/Euphoria/Quaternion-type deleted file mode 120000 index aedb6b51e1..0000000000 --- a/Lang/Euphoria/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Euphoria \ No newline at end of file diff --git a/Lang/Euphoria/Repeat b/Lang/Euphoria/Repeat new file mode 120000 index 0000000000..750ad0f53c --- /dev/null +++ b/Lang/Euphoria/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/Euphoria \ No newline at end of file diff --git a/Lang/Evaldraw/Draw-a-clock b/Lang/Evaldraw/Draw-a-clock new file mode 120000 index 0000000000..7b8f5d2c12 --- /dev/null +++ b/Lang/Evaldraw/Draw-a-clock @@ -0,0 +1 @@ +../../Task/Draw-a-clock/Evaldraw \ No newline at end of file diff --git a/Lang/Excel/Arrays b/Lang/Excel/Arrays new file mode 120000 index 0000000000..bad8c856a9 --- /dev/null +++ b/Lang/Excel/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Excel \ No newline at end of file diff --git a/Lang/Excel/Cholesky-decomposition b/Lang/Excel/Cholesky-decomposition new file mode 120000 index 0000000000..2db67f4a20 --- /dev/null +++ b/Lang/Excel/Cholesky-decomposition @@ -0,0 +1 @@ +../../Task/Cholesky-decomposition/Excel \ No newline at end of file diff --git a/Lang/Excel/Conditional-structures b/Lang/Excel/Conditional-structures new file mode 120000 index 0000000000..f4ffdbd4b9 --- /dev/null +++ b/Lang/Excel/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Excel \ No newline at end of file diff --git a/Lang/Excel/Damm-algorithm b/Lang/Excel/Damm-algorithm new file mode 120000 index 0000000000..f736e88724 --- /dev/null +++ b/Lang/Excel/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/Excel \ No newline at end of file diff --git a/Lang/Excel/Entropy b/Lang/Excel/Entropy new file mode 120000 index 0000000000..8d4e6441d6 --- /dev/null +++ b/Lang/Excel/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/Excel \ No newline at end of file diff --git a/Lang/Excel/FizzBuzz b/Lang/Excel/FizzBuzz new file mode 120000 index 0000000000..15df08a856 --- /dev/null +++ b/Lang/Excel/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Excel \ No newline at end of file diff --git a/Lang/Excel/Function-definition b/Lang/Excel/Function-definition new file mode 120000 index 0000000000..e6ecf64bef --- /dev/null +++ b/Lang/Excel/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Excel \ No newline at end of file diff --git a/Lang/Excel/Jacobi-symbol b/Lang/Excel/Jacobi-symbol new file mode 120000 index 0000000000..85f7061c07 --- /dev/null +++ b/Lang/Excel/Jacobi-symbol @@ -0,0 +1 @@ +../../Task/Jacobi-symbol/Excel \ No newline at end of file diff --git a/Lang/Excel/Loops-For b/Lang/Excel/Loops-For new file mode 120000 index 0000000000..876b47b179 --- /dev/null +++ b/Lang/Excel/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Excel \ No newline at end of file diff --git a/Lang/Excel/Repeat-a-string b/Lang/Excel/Repeat-a-string new file mode 120000 index 0000000000..2c684073cb --- /dev/null +++ b/Lang/Excel/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Excel \ No newline at end of file diff --git a/Lang/Excel/Reverse-a-string b/Lang/Excel/Reverse-a-string new file mode 120000 index 0000000000..2a3cf97cfe --- /dev/null +++ b/Lang/Excel/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Excel \ No newline at end of file diff --git a/Lang/Excel/Tokenize-a-string b/Lang/Excel/Tokenize-a-string new file mode 120000 index 0000000000..9d5af3b4b4 --- /dev/null +++ b/Lang/Excel/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Excel \ No newline at end of file diff --git a/Lang/Extended-Color-BASIC/00-LANG.txt b/Lang/Extended-Color-BASIC/00-LANG.txt new file mode 100644 index 0000000000..17efd36e93 --- /dev/null +++ b/Lang/Extended-Color-BASIC/00-LANG.txt @@ -0,0 +1,7 @@ +{{language|Extended Color BASIC}} + +Microsoft Extended Color BASIC the BASIC interpreter for the Tandy Color Computer and the Dragon Data Motorola 6809 processor based machines. + +==See Also== +* [[wp:Extended Color BASIC|Wikipedia: Extended Color BASIC]] +* [[Tasks not Implemented in Extended Color BASIC]] \ No newline at end of file diff --git a/Lang/Extended-Color-BASIC/00-META.yaml b/Lang/Extended-Color-BASIC/00-META.yaml new file mode 100644 index 0000000000..57e9e4028d --- /dev/null +++ b/Lang/Extended-Color-BASIC/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Extended_Color_BASIC diff --git a/Lang/Extended-Color-BASIC/Arrays b/Lang/Extended-Color-BASIC/Arrays new file mode 120000 index 0000000000..2ca9fdf8eb --- /dev/null +++ b/Lang/Extended-Color-BASIC/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Extended-Color-BASIC \ No newline at end of file diff --git a/Lang/Extended-Color-BASIC/Copy-a-string b/Lang/Extended-Color-BASIC/Copy-a-string new file mode 120000 index 0000000000..7a931a182a --- /dev/null +++ b/Lang/Extended-Color-BASIC/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Extended-Color-BASIC \ No newline at end of file diff --git a/Lang/Extended-Color-BASIC/Hello-world-Text b/Lang/Extended-Color-BASIC/Hello-world-Text new file mode 120000 index 0000000000..b5cfbf6b90 --- /dev/null +++ b/Lang/Extended-Color-BASIC/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Extended-Color-BASIC \ No newline at end of file diff --git a/Lang/Extended-Color-BASIC/Loops-For b/Lang/Extended-Color-BASIC/Loops-For new file mode 120000 index 0000000000..8719420a7c --- /dev/null +++ b/Lang/Extended-Color-BASIC/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Extended-Color-BASIC \ No newline at end of file diff --git a/Lang/Extended-Color-BASIC/Quine b/Lang/Extended-Color-BASIC/Quine new file mode 120000 index 0000000000..fb6135d264 --- /dev/null +++ b/Lang/Extended-Color-BASIC/Quine @@ -0,0 +1 @@ +../../Task/Quine/Extended-Color-BASIC \ No newline at end of file diff --git a/Lang/Extended-Color-BASIC/User-input-Text b/Lang/Extended-Color-BASIC/User-input-Text new file mode 120000 index 0000000000..545233f9b1 --- /dev/null +++ b/Lang/Extended-Color-BASIC/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Extended-Color-BASIC \ No newline at end of file diff --git a/Lang/F-Sharp/00-LANG.txt b/Lang/F-Sharp/00-LANG.txt index ba98a5db01..db0c37eee0 100644 --- a/Lang/F-Sharp/00-LANG.txt +++ b/Lang/F-Sharp/00-LANG.txt @@ -9,8 +9,9 @@ It is based on the [[Caml]] language, and resembles it in syntax. F# is included as an 'official' .NET language in [[Visual Studio]] 2010 and later. -==External Links== +==Links== * [http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/default.aspx F# Website at Microsoft] * [http://blogs.msdn.com/dsyme/ Don Syme's F# Weblog] +* [[Tasks_not_implemented_in_F_Sharp]] [[Category:Caml Implementations]] \ No newline at end of file diff --git a/Lang/F-Sharp/AKS-test-for-primes b/Lang/F-Sharp/AKS-test-for-primes new file mode 120000 index 0000000000..8cadb5934e --- /dev/null +++ b/Lang/F-Sharp/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Bifid-cipher b/Lang/F-Sharp/Bifid-cipher new file mode 120000 index 0000000000..4ac927ed58 --- /dev/null +++ b/Lang/F-Sharp/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Call-an-object-method b/Lang/F-Sharp/Call-an-object-method new file mode 120000 index 0000000000..69c90b1041 --- /dev/null +++ b/Lang/F-Sharp/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Define-a-primitive-data-type b/Lang/F-Sharp/Define-a-primitive-data-type new file mode 120000 index 0000000000..ef08834748 --- /dev/null +++ b/Lang/F-Sharp/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Dice-game-probabilities b/Lang/F-Sharp/Dice-game-probabilities new file mode 120000 index 0000000000..70c873d7d5 --- /dev/null +++ b/Lang/F-Sharp/Dice-game-probabilities @@ -0,0 +1 @@ +../../Task/Dice-game-probabilities/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Golden-ratio-Convergence b/Lang/F-Sharp/Golden-ratio-Convergence new file mode 120000 index 0000000000..beb42e1ac6 --- /dev/null +++ b/Lang/F-Sharp/Golden-ratio-Convergence @@ -0,0 +1 @@ +../../Task/Golden-ratio-Convergence/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/I-before-E-except-after-C b/Lang/F-Sharp/I-before-E-except-after-C new file mode 120000 index 0000000000..67d12030f9 --- /dev/null +++ b/Lang/F-Sharp/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Long-literals-with-continuations b/Lang/F-Sharp/Long-literals-with-continuations new file mode 120000 index 0000000000..25a8149ce8 --- /dev/null +++ b/Lang/F-Sharp/Long-literals-with-continuations @@ -0,0 +1 @@ +../../Task/Long-literals-with-continuations/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Long-multiplication b/Lang/F-Sharp/Long-multiplication deleted file mode 120000 index a8ece45d37..0000000000 --- a/Lang/F-Sharp/Long-multiplication +++ /dev/null @@ -1 +0,0 @@ -../../Task/Long-multiplication/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Long-year b/Lang/F-Sharp/Long-year new file mode 120000 index 0000000000..94b40682e9 --- /dev/null +++ b/Lang/F-Sharp/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Mad-Libs b/Lang/F-Sharp/Mad-Libs new file mode 120000 index 0000000000..69a30ced53 --- /dev/null +++ b/Lang/F-Sharp/Mad-Libs @@ -0,0 +1 @@ +../../Task/Mad-Libs/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Maximum-triangle-path-sum b/Lang/F-Sharp/Maximum-triangle-path-sum new file mode 120000 index 0000000000..2a3b549ec5 --- /dev/null +++ b/Lang/F-Sharp/Maximum-triangle-path-sum @@ -0,0 +1 @@ +../../Task/Maximum-triangle-path-sum/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Miller-Rabin-primality-test b/Lang/F-Sharp/Miller-Rabin-primality-test deleted file mode 120000 index 4b1a1d67d8..0000000000 --- a/Lang/F-Sharp/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Multi-dimensional-array b/Lang/F-Sharp/Multi-dimensional-array new file mode 120000 index 0000000000..0d6b1aaed5 --- /dev/null +++ b/Lang/F-Sharp/Multi-dimensional-array @@ -0,0 +1 @@ +../../Task/Multi-dimensional-array/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Multiplicative-order b/Lang/F-Sharp/Multiplicative-order new file mode 120000 index 0000000000..b2064cc3e0 --- /dev/null +++ b/Lang/F-Sharp/Multiplicative-order @@ -0,0 +1 @@ +../../Task/Multiplicative-order/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Old-lady-swallowed-a-fly b/Lang/F-Sharp/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..066ed3c32b --- /dev/null +++ b/Lang/F-Sharp/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Probabilistic-choice b/Lang/F-Sharp/Probabilistic-choice new file mode 120000 index 0000000000..b7d2692fe4 --- /dev/null +++ b/Lang/F-Sharp/Probabilistic-choice @@ -0,0 +1 @@ +../../Task/Probabilistic-choice/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Quaternion-type b/Lang/F-Sharp/Quaternion-type deleted file mode 120000 index 2de1d9f870..0000000000 --- a/Lang/F-Sharp/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Same-fringe b/Lang/F-Sharp/Same-fringe new file mode 120000 index 0000000000..04d84b3c5a --- /dev/null +++ b/Lang/F-Sharp/Same-fringe @@ -0,0 +1 @@ +../../Task/Same-fringe/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Sockets b/Lang/F-Sharp/Sockets new file mode 120000 index 0000000000..13e34e4285 --- /dev/null +++ b/Lang/F-Sharp/Sockets @@ -0,0 +1 @@ +../../Task/Sockets/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Sort-a-list-of-object-identifiers b/Lang/F-Sharp/Sort-a-list-of-object-identifiers new file mode 120000 index 0000000000..396fa34539 --- /dev/null +++ b/Lang/F-Sharp/Sort-a-list-of-object-identifiers @@ -0,0 +1 @@ +../../Task/Sort-a-list-of-object-identifiers/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Sort-numbers-lexicographically b/Lang/F-Sharp/Sort-numbers-lexicographically new file mode 120000 index 0000000000..bcc33d5bb2 --- /dev/null +++ b/Lang/F-Sharp/Sort-numbers-lexicographically @@ -0,0 +1 @@ +../../Task/Sort-numbers-lexicographically/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Stair-climbing-puzzle b/Lang/F-Sharp/Stair-climbing-puzzle new file mode 120000 index 0000000000..e1348f8b99 --- /dev/null +++ b/Lang/F-Sharp/Stair-climbing-puzzle @@ -0,0 +1 @@ +../../Task/Stair-climbing-puzzle/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Thue-Morse b/Lang/F-Sharp/Thue-Morse new file mode 120000 index 0000000000..32428af765 --- /dev/null +++ b/Lang/F-Sharp/Thue-Morse @@ -0,0 +1 @@ +../../Task/Thue-Morse/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Variable-length-quantity b/Lang/F-Sharp/Variable-length-quantity new file mode 120000 index 0000000000..2c43b02869 --- /dev/null +++ b/Lang/F-Sharp/Variable-length-quantity @@ -0,0 +1 @@ +../../Task/Variable-length-quantity/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Variadic-function b/Lang/F-Sharp/Variadic-function new file mode 120000 index 0000000000..d32ee2a40f --- /dev/null +++ b/Lang/F-Sharp/Variadic-function @@ -0,0 +1 @@ +../../Task/Variadic-function/F-Sharp \ No newline at end of file diff --git a/Lang/F-Sharp/Wireworld b/Lang/F-Sharp/Wireworld new file mode 120000 index 0000000000..32d571d649 --- /dev/null +++ b/Lang/F-Sharp/Wireworld @@ -0,0 +1 @@ +../../Task/Wireworld/F-Sharp \ No newline at end of file diff --git a/Lang/FALSE/Empty-program b/Lang/FALSE/Empty-program deleted file mode 120000 index 35445789cd..0000000000 --- a/Lang/FALSE/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/FALSE \ No newline at end of file diff --git a/Lang/FALSE/Zeckendorf-number-representation b/Lang/FALSE/Zeckendorf-number-representation new file mode 120000 index 0000000000..fdef231a56 --- /dev/null +++ b/Lang/FALSE/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/FALSE \ No newline at end of file diff --git a/Lang/FOCAL/Combinations b/Lang/FOCAL/Combinations new file mode 120000 index 0000000000..882a5e580d --- /dev/null +++ b/Lang/FOCAL/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/FOCAL \ No newline at end of file diff --git a/Lang/FOCAL/Count-the-coins b/Lang/FOCAL/Count-the-coins new file mode 120000 index 0000000000..6334bdc3d9 --- /dev/null +++ b/Lang/FOCAL/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/FOCAL \ No newline at end of file diff --git a/Lang/FOCAL/Hunt-the-Wumpus b/Lang/FOCAL/Hunt-the-Wumpus new file mode 120000 index 0000000000..098e817517 --- /dev/null +++ b/Lang/FOCAL/Hunt-the-Wumpus @@ -0,0 +1 @@ +../../Task/Hunt-the-Wumpus/FOCAL \ No newline at end of file diff --git a/Lang/FOCAL/Sierpinski-carpet b/Lang/FOCAL/Sierpinski-carpet new file mode 120000 index 0000000000..986467c5d7 --- /dev/null +++ b/Lang/FOCAL/Sierpinski-carpet @@ -0,0 +1 @@ +../../Task/Sierpinski-carpet/FOCAL \ No newline at end of file diff --git a/Lang/FOCAL/Smith-numbers b/Lang/FOCAL/Smith-numbers new file mode 120000 index 0000000000..3ffdfd37fd --- /dev/null +++ b/Lang/FOCAL/Smith-numbers @@ -0,0 +1 @@ +../../Task/Smith-numbers/FOCAL \ No newline at end of file diff --git a/Lang/FOCAL/Zeckendorf-number-representation b/Lang/FOCAL/Zeckendorf-number-representation new file mode 120000 index 0000000000..d0cbc5b4d2 --- /dev/null +++ b/Lang/FOCAL/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/FOCAL \ No newline at end of file diff --git a/Lang/Factor/Best-shuffle b/Lang/Factor/Best-shuffle new file mode 120000 index 0000000000..a10c8f5d14 --- /dev/null +++ b/Lang/Factor/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Factor \ No newline at end of file diff --git a/Lang/Factor/Bioinformatics-base-count b/Lang/Factor/Bioinformatics-base-count deleted file mode 120000 index cf4a54a26f..0000000000 --- a/Lang/Factor/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Factor \ No newline at end of file diff --git a/Lang/Factor/Brownian-tree b/Lang/Factor/Brownian-tree new file mode 120000 index 0000000000..a93650256d --- /dev/null +++ b/Lang/Factor/Brownian-tree @@ -0,0 +1 @@ +../../Task/Brownian-tree/Factor \ No newline at end of file diff --git a/Lang/Factor/Quaternion-type b/Lang/Factor/Quaternion-type deleted file mode 120000 index 47f0548ea8..0000000000 --- a/Lang/Factor/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Factor \ No newline at end of file diff --git a/Lang/Factor/Tic-tac-toe b/Lang/Factor/Tic-tac-toe new file mode 120000 index 0000000000..183c5fb3e0 --- /dev/null +++ b/Lang/Factor/Tic-tac-toe @@ -0,0 +1 @@ +../../Task/Tic-tac-toe/Factor \ No newline at end of file diff --git a/Lang/Fe/00-LANG.txt b/Lang/Fe/00-LANG.txt index e459a4ddde..526acc2adb 100644 --- a/Lang/Fe/00-LANG.txt +++ b/Lang/Fe/00-LANG.txt @@ -1,6 +1,5 @@ {{language|exec=interpreted|checking=dynamic|gc=yes|site=https://github.com/rxi/fe}} -== '''fe''' == -A '''tiny''', embeddable language implemented in ANSI C +fe is a '''tiny''', embeddable language implemented in ANSI C. (= reverse (fn (lst) (let res nil) diff --git a/Lang/Fennel/00-LANG.txt b/Lang/Fennel/00-LANG.txt index 548a2dac3c..a3b3fb9075 100644 --- a/Lang/Fennel/00-LANG.txt +++ b/Lang/Fennel/00-LANG.txt @@ -1,4 +1,4 @@ -{{language|Fennel}} +{{language|Fennel|hopl=no|site=https://fennel-lang.org/}} According to Fennel website: Fennel is a programming language that brings together the speed, simplicity, and reach of Lua with the flexibility of a lisp syntax and macro system.
    @@ -10,4 +10,9 @@ According to Fennel website: Fennel is a programming language that brings togeth Anywhere you can run Lua code, you can run Fennel code. -See more examples at: [https://fennel-lang.org/ Fennel Website] \ No newline at end of file +See more examples at: [https://fennel-lang.org/ Fennel Website] + +A useful learning tool is antifennel at [https://git.sr.ht/~technomancy/antifennel https://git.sr.ht/~technomancy/antifennel] that can convert Lua programs to Fennel. +NB, some Lua features are not supported, particularly , and goto and any new features in Lua 5.5. + +As well as [[Lua]] 5.x VMs, Fennel programs can also be run with [[Pluto]], though warnings will probably be generated when Pluto parses the generated Lua. \ No newline at end of file diff --git a/Lang/Fennel/100-doors b/Lang/Fennel/100-doors new file mode 120000 index 0000000000..445ef6d734 --- /dev/null +++ b/Lang/Fennel/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Fennel \ No newline at end of file diff --git a/Lang/Fennel/A+B b/Lang/Fennel/A+B new file mode 120000 index 0000000000..258342d140 --- /dev/null +++ b/Lang/Fennel/A+B @@ -0,0 +1 @@ +../../Task/A+B/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Abundant-deficient-and-perfect-number-classifications b/Lang/Fennel/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..fbb88cf56d --- /dev/null +++ b/Lang/Fennel/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Almost-prime b/Lang/Fennel/Almost-prime new file mode 120000 index 0000000000..ff96ace4e0 --- /dev/null +++ b/Lang/Fennel/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Array-length b/Lang/Fennel/Array-length new file mode 120000 index 0000000000..889bb47ca4 --- /dev/null +++ b/Lang/Fennel/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Ascending-primes b/Lang/Fennel/Ascending-primes new file mode 120000 index 0000000000..809d348a6f --- /dev/null +++ b/Lang/Fennel/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Associative-array-Iteration b/Lang/Fennel/Associative-array-Iteration new file mode 120000 index 0000000000..35dee61a57 --- /dev/null +++ b/Lang/Fennel/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Character-codes b/Lang/Fennel/Character-codes new file mode 120000 index 0000000000..0a9efc06a2 --- /dev/null +++ b/Lang/Fennel/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Chowla-numbers b/Lang/Fennel/Chowla-numbers new file mode 120000 index 0000000000..ceac262e93 --- /dev/null +++ b/Lang/Fennel/Chowla-numbers @@ -0,0 +1 @@ +../../Task/Chowla-numbers/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Comments b/Lang/Fennel/Comments new file mode 120000 index 0000000000..58bb448611 --- /dev/null +++ b/Lang/Fennel/Comments @@ -0,0 +1 @@ +../../Task/Comments/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Descending-primes b/Lang/Fennel/Descending-primes new file mode 120000 index 0000000000..0de026f662 --- /dev/null +++ b/Lang/Fennel/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Dot-product b/Lang/Fennel/Dot-product new file mode 120000 index 0000000000..ef8e13865c --- /dev/null +++ b/Lang/Fennel/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Equal-prime-and-composite-sums b/Lang/Fennel/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..fd46523293 --- /dev/null +++ b/Lang/Fennel/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Euclid-Mullin-sequence b/Lang/Fennel/Euclid-Mullin-sequence new file mode 120000 index 0000000000..3b36037b43 --- /dev/null +++ b/Lang/Fennel/Euclid-Mullin-sequence @@ -0,0 +1 @@ +../../Task/Euclid-Mullin-sequence/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Execute-Brain- b/Lang/Fennel/Execute-Brain- new file mode 120000 index 0000000000..c651f55913 --- /dev/null +++ b/Lang/Fennel/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Factorial b/Lang/Fennel/Factorial new file mode 120000 index 0000000000..ad3ab162af --- /dev/null +++ b/Lang/Fennel/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Factorial-primes b/Lang/Fennel/Factorial-primes new file mode 120000 index 0000000000..f7ae7a4fab --- /dev/null +++ b/Lang/Fennel/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Goldbachs-comet b/Lang/Fennel/Goldbachs-comet new file mode 120000 index 0000000000..38a9767c12 --- /dev/null +++ b/Lang/Fennel/Goldbachs-comet @@ -0,0 +1 @@ +../../Task/Goldbachs-comet/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Haversine-formula b/Lang/Fennel/Haversine-formula new file mode 120000 index 0000000000..855dbd8be0 --- /dev/null +++ b/Lang/Fennel/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Horners-rule-for-polynomial-evaluation b/Lang/Fennel/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..74fe37f151 --- /dev/null +++ b/Lang/Fennel/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Jacobsthal-numbers b/Lang/Fennel/Jacobsthal-numbers new file mode 120000 index 0000000000..fcf69f6156 --- /dev/null +++ b/Lang/Fennel/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Jordan-P-lya-numbers b/Lang/Fennel/Jordan-P-lya-numbers new file mode 120000 index 0000000000..b4c757f403 --- /dev/null +++ b/Lang/Fennel/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Juggler-sequence b/Lang/Fennel/Juggler-sequence new file mode 120000 index 0000000000..09d9faa2d8 --- /dev/null +++ b/Lang/Fennel/Juggler-sequence @@ -0,0 +1 @@ +../../Task/Juggler-sequence/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Legendre-prime-counting-function b/Lang/Fennel/Legendre-prime-counting-function new file mode 120000 index 0000000000..da570fb296 --- /dev/null +++ b/Lang/Fennel/Legendre-prime-counting-function @@ -0,0 +1 @@ +../../Task/Legendre-prime-counting-function/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Magic-8-ball b/Lang/Fennel/Magic-8-ball new file mode 120000 index 0000000000..aa85a0a813 --- /dev/null +++ b/Lang/Fennel/Magic-8-ball @@ -0,0 +1 @@ +../../Task/Magic-8-ball/Fennel \ No newline at end of file diff --git a/Lang/Fennel/McNuggets-problem b/Lang/Fennel/McNuggets-problem new file mode 120000 index 0000000000..6947e9ca17 --- /dev/null +++ b/Lang/Fennel/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Nth b/Lang/Fennel/Nth new file mode 120000 index 0000000000..16a3104a61 --- /dev/null +++ b/Lang/Fennel/Nth @@ -0,0 +1 @@ +../../Task/Nth/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Numbers-with-equal-rises-and-falls b/Lang/Fennel/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..5b24fbe9c6 --- /dev/null +++ b/Lang/Fennel/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Ordered-words b/Lang/Fennel/Ordered-words new file mode 120000 index 0000000000..e6920afb80 --- /dev/null +++ b/Lang/Fennel/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Program-name b/Lang/Fennel/Program-name new file mode 120000 index 0000000000..c12837ea94 --- /dev/null +++ b/Lang/Fennel/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Quoting-constructs b/Lang/Fennel/Quoting-constructs new file mode 120000 index 0000000000..69544d5ca6 --- /dev/null +++ b/Lang/Fennel/Quoting-constructs @@ -0,0 +1 @@ +../../Task/Quoting-constructs/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Reverse-a-string b/Lang/Fennel/Reverse-a-string new file mode 120000 index 0000000000..e7cfc4d866 --- /dev/null +++ b/Lang/Fennel/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Rot-13 b/Lang/Fennel/Rot-13 new file mode 120000 index 0000000000..0be65cf911 --- /dev/null +++ b/Lang/Fennel/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Sleeping-Beauty-problem b/Lang/Fennel/Sleeping-Beauty-problem new file mode 120000 index 0000000000..35404c74a3 --- /dev/null +++ b/Lang/Fennel/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Square-but-not-cube b/Lang/Fennel/Square-but-not-cube new file mode 120000 index 0000000000..55c96cb4bd --- /dev/null +++ b/Lang/Fennel/Square-but-not-cube @@ -0,0 +1 @@ +../../Task/Square-but-not-cube/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Sum-of-elements-below-main-diagonal-of-matrix b/Lang/Fennel/Sum-of-elements-below-main-diagonal-of-matrix new file mode 120000 index 0000000000..e6054255ef --- /dev/null +++ b/Lang/Fennel/Sum-of-elements-below-main-diagonal-of-matrix @@ -0,0 +1 @@ +../../Task/Sum-of-elements-below-main-diagonal-of-matrix/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Tau-function b/Lang/Fennel/Tau-function new file mode 120000 index 0000000000..97342018ad --- /dev/null +++ b/Lang/Fennel/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Tau-number b/Lang/Fennel/Tau-number new file mode 120000 index 0000000000..b25562b44c --- /dev/null +++ b/Lang/Fennel/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Thue-Morse b/Lang/Fennel/Thue-Morse new file mode 120000 index 0000000000..03b98b380a --- /dev/null +++ b/Lang/Fennel/Thue-Morse @@ -0,0 +1 @@ +../../Task/Thue-Morse/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Time-a-function b/Lang/Fennel/Time-a-function new file mode 120000 index 0000000000..e57c2d9bfb --- /dev/null +++ b/Lang/Fennel/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Wilson-primes-of-order-n b/Lang/Fennel/Wilson-primes-of-order-n new file mode 120000 index 0000000000..3a829de574 --- /dev/null +++ b/Lang/Fennel/Wilson-primes-of-order-n @@ -0,0 +1 @@ +../../Task/Wilson-primes-of-order-n/Fennel \ No newline at end of file diff --git a/Lang/Fennel/Yellowstone-sequence b/Lang/Fennel/Yellowstone-sequence new file mode 120000 index 0000000000..e160b50754 --- /dev/null +++ b/Lang/Fennel/Yellowstone-sequence @@ -0,0 +1 @@ +../../Task/Yellowstone-sequence/Fennel \ No newline at end of file diff --git a/Lang/Fish/00-LANG.txt b/Lang/Fish/00-LANG.txt index ae84e9d381..3479165e5a 100644 --- a/Lang/Fish/00-LANG.txt +++ b/Lang/Fish/00-LANG.txt @@ -1,4 +1,3 @@ -{{language}}Fish is an Funge-like esoteric language, consisting of the traditional Funge one-character commands. -A complete specification with a list of implementations can be found at [[eso:Fish|esolangs]]. +{{language}}Fish (properly spelled "><>") is a Funge-like esoteric language, consisting of the traditional Funge one-character commands arranged in a two-dimensional code space. A complete specification with a list of implementations can be found at [[eso:Fish|esolangs]]. [[Category:Esoteric_Languages]] \ No newline at end of file diff --git a/Lang/Fish/The-Twelve-Days-of-Christmas b/Lang/Fish/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..b2ce6d5872 --- /dev/null +++ b/Lang/Fish/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/Fish \ No newline at end of file diff --git a/Lang/Forth/21-game b/Lang/Forth/21-game new file mode 120000 index 0000000000..1f62421370 --- /dev/null +++ b/Lang/Forth/21-game @@ -0,0 +1 @@ +../../Task/21-game/Forth \ No newline at end of file diff --git a/Lang/Forth/Almost-prime b/Lang/Forth/Almost-prime new file mode 120000 index 0000000000..bbe907fa90 --- /dev/null +++ b/Lang/Forth/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Forth \ No newline at end of file diff --git a/Lang/Forth/Bell-numbers b/Lang/Forth/Bell-numbers new file mode 120000 index 0000000000..d0f973798a --- /dev/null +++ b/Lang/Forth/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/Forth \ No newline at end of file diff --git a/Lang/Forth/Bioinformatics-base-count b/Lang/Forth/Bioinformatics-base-count deleted file mode 120000 index b72b7872d9..0000000000 --- a/Lang/Forth/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Forth \ No newline at end of file diff --git a/Lang/Forth/Calendar b/Lang/Forth/Calendar new file mode 120000 index 0000000000..1dc0827699 --- /dev/null +++ b/Lang/Forth/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/Forth \ No newline at end of file diff --git a/Lang/Forth/Calendar---for-REAL-programmers b/Lang/Forth/Calendar---for-REAL-programmers new file mode 120000 index 0000000000..499105cf3a --- /dev/null +++ b/Lang/Forth/Calendar---for-REAL-programmers @@ -0,0 +1 @@ +../../Task/Calendar---for-REAL-programmers/Forth \ No newline at end of file diff --git a/Lang/Forth/Chaocipher b/Lang/Forth/Chaocipher new file mode 120000 index 0000000000..4e26356ed4 --- /dev/null +++ b/Lang/Forth/Chaocipher @@ -0,0 +1 @@ +../../Task/Chaocipher/Forth \ No newline at end of file diff --git a/Lang/Forth/Check-input-device-is-a-terminal b/Lang/Forth/Check-input-device-is-a-terminal new file mode 120000 index 0000000000..adf620c022 --- /dev/null +++ b/Lang/Forth/Check-input-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-input-device-is-a-terminal/Forth \ No newline at end of file diff --git a/Lang/Forth/Deceptive-numbers b/Lang/Forth/Deceptive-numbers new file mode 120000 index 0000000000..68978661e4 --- /dev/null +++ b/Lang/Forth/Deceptive-numbers @@ -0,0 +1 @@ +../../Task/Deceptive-numbers/Forth \ No newline at end of file diff --git a/Lang/Forth/Determine-if-a-string-has-all-the-same-characters b/Lang/Forth/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..79fb92f191 --- /dev/null +++ b/Lang/Forth/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/Forth \ No newline at end of file diff --git a/Lang/Forth/Dijkstras-algorithm b/Lang/Forth/Dijkstras-algorithm new file mode 120000 index 0000000000..a69ebc3263 --- /dev/null +++ b/Lang/Forth/Dijkstras-algorithm @@ -0,0 +1 @@ +../../Task/Dijkstras-algorithm/Forth \ No newline at end of file diff --git a/Lang/Forth/Duffinian-numbers b/Lang/Forth/Duffinian-numbers new file mode 120000 index 0000000000..9a7e28500f --- /dev/null +++ b/Lang/Forth/Duffinian-numbers @@ -0,0 +1 @@ +../../Task/Duffinian-numbers/Forth \ No newline at end of file diff --git a/Lang/Forth/Fibonacci-word b/Lang/Forth/Fibonacci-word new file mode 120000 index 0000000000..b5b4488597 --- /dev/null +++ b/Lang/Forth/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/Forth \ No newline at end of file diff --git a/Lang/Forth/Flipping-bits-game b/Lang/Forth/Flipping-bits-game new file mode 120000 index 0000000000..2a3f084d3e --- /dev/null +++ b/Lang/Forth/Flipping-bits-game @@ -0,0 +1 @@ +../../Task/Flipping-bits-game/Forth \ No newline at end of file diff --git a/Lang/Forth/GUI-component-interaction b/Lang/Forth/GUI-component-interaction new file mode 120000 index 0000000000..6ac944b586 --- /dev/null +++ b/Lang/Forth/GUI-component-interaction @@ -0,0 +1 @@ +../../Task/GUI-component-interaction/Forth \ No newline at end of file diff --git a/Lang/Forth/Hunt-the-Wumpus b/Lang/Forth/Hunt-the-Wumpus new file mode 120000 index 0000000000..3a835dfd4d --- /dev/null +++ b/Lang/Forth/Hunt-the-Wumpus @@ -0,0 +1 @@ +../../Task/Hunt-the-Wumpus/Forth \ No newline at end of file diff --git a/Lang/Forth/Keyboard-input-Flush-the-keyboard-buffer b/Lang/Forth/Keyboard-input-Flush-the-keyboard-buffer new file mode 120000 index 0000000000..d41fcd8680 --- /dev/null +++ b/Lang/Forth/Keyboard-input-Flush-the-keyboard-buffer @@ -0,0 +1 @@ +../../Task/Keyboard-input-Flush-the-keyboard-buffer/Forth \ No newline at end of file diff --git a/Lang/Forth/Lah-numbers b/Lang/Forth/Lah-numbers new file mode 120000 index 0000000000..63faba81d9 --- /dev/null +++ b/Lang/Forth/Lah-numbers @@ -0,0 +1 @@ +../../Task/Lah-numbers/Forth \ No newline at end of file diff --git a/Lang/Forth/Leonardo-numbers b/Lang/Forth/Leonardo-numbers new file mode 120000 index 0000000000..5742a06693 --- /dev/null +++ b/Lang/Forth/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/Forth \ No newline at end of file diff --git a/Lang/Forth/M-bius-function b/Lang/Forth/M-bius-function new file mode 120000 index 0000000000..02d70b9302 --- /dev/null +++ b/Lang/Forth/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/Forth \ No newline at end of file diff --git a/Lang/Forth/Miller-Rabin-primality-test b/Lang/Forth/Miller-Rabin-primality-test deleted file mode 120000 index 6d752b6553..0000000000 --- a/Lang/Forth/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Forth \ No newline at end of file diff --git a/Lang/Forth/Particle-fountain b/Lang/Forth/Particle-fountain new file mode 120000 index 0000000000..3ac0d2e0d6 --- /dev/null +++ b/Lang/Forth/Particle-fountain @@ -0,0 +1 @@ +../../Task/Particle-fountain/Forth \ No newline at end of file diff --git a/Lang/Forth/Pseudo-random-numbers-PCG32 b/Lang/Forth/Pseudo-random-numbers-PCG32 new file mode 120000 index 0000000000..df0bc45550 --- /dev/null +++ b/Lang/Forth/Pseudo-random-numbers-PCG32 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-PCG32/Forth \ No newline at end of file diff --git a/Lang/Forth/Quaternion-type b/Lang/Forth/Quaternion-type deleted file mode 120000 index bed4c03ac8..0000000000 --- a/Lang/Forth/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Forth \ No newline at end of file diff --git a/Lang/Forth/Sorting-Algorithms-Circle-Sort b/Lang/Forth/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 0f0dc80920..0000000000 --- a/Lang/Forth/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Forth \ No newline at end of file diff --git a/Lang/Forth/Sorting-algorithms-Pancake-sort b/Lang/Forth/Sorting-algorithms-Pancake-sort new file mode 120000 index 0000000000..84e38b0321 --- /dev/null +++ b/Lang/Forth/Sorting-algorithms-Pancake-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Pancake-sort/Forth \ No newline at end of file diff --git a/Lang/Forth/Stirling-numbers-of-the-first-kind b/Lang/Forth/Stirling-numbers-of-the-first-kind new file mode 120000 index 0000000000..f35ec2aaf5 --- /dev/null +++ b/Lang/Forth/Stirling-numbers-of-the-first-kind @@ -0,0 +1 @@ +../../Task/Stirling-numbers-of-the-first-kind/Forth \ No newline at end of file diff --git a/Lang/Forth/Stirling-numbers-of-the-second-kind b/Lang/Forth/Stirling-numbers-of-the-second-kind new file mode 120000 index 0000000000..a86eb5dfc1 --- /dev/null +++ b/Lang/Forth/Stirling-numbers-of-the-second-kind @@ -0,0 +1 @@ +../../Task/Stirling-numbers-of-the-second-kind/Forth \ No newline at end of file diff --git a/Lang/Forth/Truncate-a-file b/Lang/Forth/Truncate-a-file new file mode 120000 index 0000000000..c819b2127f --- /dev/null +++ b/Lang/Forth/Truncate-a-file @@ -0,0 +1 @@ +../../Task/Truncate-a-file/Forth \ No newline at end of file diff --git a/Lang/Forth/Twin-primes b/Lang/Forth/Twin-primes new file mode 120000 index 0000000000..7812aac04a --- /dev/null +++ b/Lang/Forth/Twin-primes @@ -0,0 +1 @@ +../../Task/Twin-primes/Forth \ No newline at end of file diff --git a/Lang/Forth/Undefined-values b/Lang/Forth/Undefined-values new file mode 120000 index 0000000000..ddddc28113 --- /dev/null +++ b/Lang/Forth/Undefined-values @@ -0,0 +1 @@ +../../Task/Undefined-values/Forth \ No newline at end of file diff --git a/Lang/Forth/Vampire-number b/Lang/Forth/Vampire-number new file mode 120000 index 0000000000..f6cacda517 --- /dev/null +++ b/Lang/Forth/Vampire-number @@ -0,0 +1 @@ +../../Task/Vampire-number/Forth \ No newline at end of file diff --git a/Lang/Forth/Variable-size-Set b/Lang/Forth/Variable-size-Set new file mode 120000 index 0000000000..b63c53f866 --- /dev/null +++ b/Lang/Forth/Variable-size-Set @@ -0,0 +1 @@ +../../Task/Variable-size-Set/Forth \ No newline at end of file diff --git a/Lang/Forth/Write-entire-file b/Lang/Forth/Write-entire-file new file mode 120000 index 0000000000..742c99d4f6 --- /dev/null +++ b/Lang/Forth/Write-entire-file @@ -0,0 +1 @@ +../../Task/Write-entire-file/Forth \ No newline at end of file diff --git a/Lang/Fortran/ADFGVX-cipher b/Lang/Fortran/ADFGVX-cipher new file mode 120000 index 0000000000..dc1d16bc9a --- /dev/null +++ b/Lang/Fortran/ADFGVX-cipher @@ -0,0 +1 @@ +../../Task/ADFGVX-cipher/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Abbreviations-automatic b/Lang/Fortran/Abbreviations-automatic new file mode 120000 index 0000000000..b006a0de84 --- /dev/null +++ b/Lang/Fortran/Abbreviations-automatic @@ -0,0 +1 @@ +../../Task/Abbreviations-automatic/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Abbreviations-easy b/Lang/Fortran/Abbreviations-easy new file mode 120000 index 0000000000..ad33bd3687 --- /dev/null +++ b/Lang/Fortran/Abbreviations-easy @@ -0,0 +1 @@ +../../Task/Abbreviations-easy/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Abbreviations-simple b/Lang/Fortran/Abbreviations-simple new file mode 120000 index 0000000000..9ddfe0b240 --- /dev/null +++ b/Lang/Fortran/Abbreviations-simple @@ -0,0 +1 @@ +../../Task/Abbreviations-simple/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Abelian-sandpile-model-Identity b/Lang/Fortran/Abelian-sandpile-model-Identity new file mode 120000 index 0000000000..f022469180 --- /dev/null +++ b/Lang/Fortran/Abelian-sandpile-model-Identity @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model-Identity/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Additive-primes b/Lang/Fortran/Additive-primes new file mode 120000 index 0000000000..ea531b1d68 --- /dev/null +++ b/Lang/Fortran/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Apply-a-digital-filter-direct-form-II-transposed- b/Lang/Fortran/Apply-a-digital-filter-direct-form-II-transposed- new file mode 120000 index 0000000000..dd0e66389d --- /dev/null +++ b/Lang/Fortran/Apply-a-digital-filter-direct-form-II-transposed- @@ -0,0 +1 @@ +../../Task/Apply-a-digital-filter-direct-form-II-transposed-/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Arithmetic-derivative b/Lang/Fortran/Arithmetic-derivative new file mode 120000 index 0000000000..afa7044404 --- /dev/null +++ b/Lang/Fortran/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Arithmetic-numbers b/Lang/Fortran/Arithmetic-numbers new file mode 120000 index 0000000000..19ae0a75dc --- /dev/null +++ b/Lang/Fortran/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Associative-array-Merging b/Lang/Fortran/Associative-array-Merging new file mode 120000 index 0000000000..862cee9b2b --- /dev/null +++ b/Lang/Fortran/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/Fortran \ No newline at end of file diff --git a/Lang/Fortran/B-zier-curves-Intersections b/Lang/Fortran/B-zier-curves-Intersections new file mode 120000 index 0000000000..59ae9a9e9a --- /dev/null +++ b/Lang/Fortran/B-zier-curves-Intersections @@ -0,0 +1 @@ +../../Task/B-zier-curves-Intersections/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Best-shuffle b/Lang/Fortran/Best-shuffle new file mode 120000 index 0000000000..735756bb7c --- /dev/null +++ b/Lang/Fortran/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Bifid-cipher b/Lang/Fortran/Bifid-cipher new file mode 120000 index 0000000000..65b6def5fd --- /dev/null +++ b/Lang/Fortran/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Bin-given-limits b/Lang/Fortran/Bin-given-limits new file mode 120000 index 0000000000..d5ad60904d --- /dev/null +++ b/Lang/Fortran/Bin-given-limits @@ -0,0 +1 @@ +../../Task/Bin-given-limits/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Bioinformatics-Sequence-mutation b/Lang/Fortran/Bioinformatics-Sequence-mutation new file mode 120000 index 0000000000..9bcd7a681c --- /dev/null +++ b/Lang/Fortran/Bioinformatics-Sequence-mutation @@ -0,0 +1 @@ +../../Task/Bioinformatics-Sequence-mutation/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Blum-integer b/Lang/Fortran/Blum-integer new file mode 120000 index 0000000000..814d829eed --- /dev/null +++ b/Lang/Fortran/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Brilliant-numbers b/Lang/Fortran/Brilliant-numbers new file mode 120000 index 0000000000..6c927981ae --- /dev/null +++ b/Lang/Fortran/Brilliant-numbers @@ -0,0 +1 @@ +../../Task/Brilliant-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Burrows-Wheeler-transform b/Lang/Fortran/Burrows-Wheeler-transform new file mode 120000 index 0000000000..e312b27f94 --- /dev/null +++ b/Lang/Fortran/Burrows-Wheeler-transform @@ -0,0 +1 @@ +../../Task/Burrows-Wheeler-transform/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Calkin-Wilf-sequence b/Lang/Fortran/Calkin-Wilf-sequence new file mode 120000 index 0000000000..daedbbc7bc --- /dev/null +++ b/Lang/Fortran/Calkin-Wilf-sequence @@ -0,0 +1 @@ +../../Task/Calkin-Wilf-sequence/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Camel-case-and-snake-case b/Lang/Fortran/Camel-case-and-snake-case new file mode 120000 index 0000000000..8c737ed655 --- /dev/null +++ b/Lang/Fortran/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Casting-out-nines b/Lang/Fortran/Casting-out-nines new file mode 120000 index 0000000000..7062811203 --- /dev/null +++ b/Lang/Fortran/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Catalan-numbers-Pascals-triangle b/Lang/Fortran/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..e33b331d86 --- /dev/null +++ b/Lang/Fortran/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Chaocipher b/Lang/Fortran/Chaocipher new file mode 120000 index 0000000000..1db3092120 --- /dev/null +++ b/Lang/Fortran/Chaocipher @@ -0,0 +1 @@ +../../Task/Chaocipher/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Check-input-device-is-a-terminal b/Lang/Fortran/Check-input-device-is-a-terminal new file mode 120000 index 0000000000..a97eabf9a0 --- /dev/null +++ b/Lang/Fortran/Check-input-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-input-device-is-a-terminal/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Check-output-device-is-a-terminal b/Lang/Fortran/Check-output-device-is-a-terminal new file mode 120000 index 0000000000..47a93202b8 --- /dev/null +++ b/Lang/Fortran/Check-output-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-output-device-is-a-terminal/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Cheryls-birthday b/Lang/Fortran/Cheryls-birthday new file mode 120000 index 0000000000..5e5ed5ef71 --- /dev/null +++ b/Lang/Fortran/Cheryls-birthday @@ -0,0 +1 @@ +../../Task/Cheryls-birthday/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Chinese-zodiac b/Lang/Fortran/Chinese-zodiac new file mode 120000 index 0000000000..87ed14e5e7 --- /dev/null +++ b/Lang/Fortran/Chinese-zodiac @@ -0,0 +1 @@ +../../Task/Chinese-zodiac/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Chowla-numbers b/Lang/Fortran/Chowla-numbers new file mode 120000 index 0000000000..7f0b9e01f2 --- /dev/null +++ b/Lang/Fortran/Chowla-numbers @@ -0,0 +1 @@ +../../Task/Chowla-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Commatizing-numbers b/Lang/Fortran/Commatizing-numbers new file mode 120000 index 0000000000..b30a0bb3a4 --- /dev/null +++ b/Lang/Fortran/Commatizing-numbers @@ -0,0 +1 @@ +../../Task/Commatizing-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Consecutive-primes-with-ascending-or-descending-differences b/Lang/Fortran/Consecutive-primes-with-ascending-or-descending-differences new file mode 120000 index 0000000000..1347a887b7 --- /dev/null +++ b/Lang/Fortran/Consecutive-primes-with-ascending-or-descending-differences @@ -0,0 +1 @@ +../../Task/Consecutive-primes-with-ascending-or-descending-differences/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Copy-stdin-to-stdout b/Lang/Fortran/Copy-stdin-to-stdout new file mode 120000 index 0000000000..47cac281c7 --- /dev/null +++ b/Lang/Fortran/Copy-stdin-to-stdout @@ -0,0 +1 @@ +../../Task/Copy-stdin-to-stdout/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Count-the-coins b/Lang/Fortran/Count-the-coins new file mode 120000 index 0000000000..974abe5d75 --- /dev/null +++ b/Lang/Fortran/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Cuban-primes b/Lang/Fortran/Cuban-primes new file mode 120000 index 0000000000..87850fcead --- /dev/null +++ b/Lang/Fortran/Cuban-primes @@ -0,0 +1 @@ +../../Task/Cuban-primes/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Cullen-and-Woodall-numbers b/Lang/Fortran/Cullen-and-Woodall-numbers new file mode 120000 index 0000000000..ca6a11cd97 --- /dev/null +++ b/Lang/Fortran/Cullen-and-Woodall-numbers @@ -0,0 +1 @@ +../../Task/Cullen-and-Woodall-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Currency b/Lang/Fortran/Currency new file mode 120000 index 0000000000..2f7b0a58da --- /dev/null +++ b/Lang/Fortran/Currency @@ -0,0 +1 @@ +../../Task/Currency/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Curzon-numbers b/Lang/Fortran/Curzon-numbers new file mode 120000 index 0000000000..b7d16c2b28 --- /dev/null +++ b/Lang/Fortran/Curzon-numbers @@ -0,0 +1 @@ +../../Task/Curzon-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Cyclops-numbers b/Lang/Fortran/Cyclops-numbers new file mode 120000 index 0000000000..8c606709ad --- /dev/null +++ b/Lang/Fortran/Cyclops-numbers @@ -0,0 +1 @@ +../../Task/Cyclops-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Cyclotomic-polynomial b/Lang/Fortran/Cyclotomic-polynomial new file mode 120000 index 0000000000..0c2fd63e5e --- /dev/null +++ b/Lang/Fortran/Cyclotomic-polynomial @@ -0,0 +1 @@ +../../Task/Cyclotomic-polynomial/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Demings-funnel b/Lang/Fortran/Demings-funnel new file mode 120000 index 0000000000..0a1ca7ab40 --- /dev/null +++ b/Lang/Fortran/Demings-funnel @@ -0,0 +1 @@ +../../Task/Demings-funnel/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Determine-if-a-string-is-collapsible b/Lang/Fortran/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..f496b06786 --- /dev/null +++ b/Lang/Fortran/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Determine-if-two-triangles-overlap b/Lang/Fortran/Determine-if-two-triangles-overlap new file mode 120000 index 0000000000..902cd39054 --- /dev/null +++ b/Lang/Fortran/Determine-if-two-triangles-overlap @@ -0,0 +1 @@ +../../Task/Determine-if-two-triangles-overlap/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Dice-game-probabilities b/Lang/Fortran/Dice-game-probabilities new file mode 120000 index 0000000000..1215daca7a --- /dev/null +++ b/Lang/Fortran/Dice-game-probabilities @@ -0,0 +1 @@ +../../Task/Dice-game-probabilities/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Dijkstras-algorithm b/Lang/Fortran/Dijkstras-algorithm new file mode 120000 index 0000000000..3c5355acc3 --- /dev/null +++ b/Lang/Fortran/Dijkstras-algorithm @@ -0,0 +1 @@ +../../Task/Dijkstras-algorithm/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Dinesmans-multiple-dwelling-problem b/Lang/Fortran/Dinesmans-multiple-dwelling-problem new file mode 120000 index 0000000000..4ab5caf233 --- /dev/null +++ b/Lang/Fortran/Dinesmans-multiple-dwelling-problem @@ -0,0 +1 @@ +../../Task/Dinesmans-multiple-dwelling-problem/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Dining-philosophers b/Lang/Fortran/Dining-philosophers new file mode 120000 index 0000000000..8822e00fdf --- /dev/null +++ b/Lang/Fortran/Dining-philosophers @@ -0,0 +1 @@ +../../Task/Dining-philosophers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Disarium-numbers b/Lang/Fortran/Disarium-numbers new file mode 120000 index 0000000000..4713bf931d --- /dev/null +++ b/Lang/Fortran/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Display-a-linear-combination b/Lang/Fortran/Display-a-linear-combination new file mode 120000 index 0000000000..4a9784f58d --- /dev/null +++ b/Lang/Fortran/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Distance-and-Bearing b/Lang/Fortran/Distance-and-Bearing new file mode 120000 index 0000000000..7bc778a069 --- /dev/null +++ b/Lang/Fortran/Distance-and-Bearing @@ -0,0 +1 @@ +../../Task/Distance-and-Bearing/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Diversity-prediction-theorem b/Lang/Fortran/Diversity-prediction-theorem new file mode 120000 index 0000000000..c6eafa5019 --- /dev/null +++ b/Lang/Fortran/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Doomsday-rule b/Lang/Fortran/Doomsday-rule new file mode 120000 index 0000000000..da3d111050 --- /dev/null +++ b/Lang/Fortran/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/Fortran \ No newline at end of file diff --git a/Lang/Fortran/EKG-sequence-convergence b/Lang/Fortran/EKG-sequence-convergence new file mode 120000 index 0000000000..3ba5c0a162 --- /dev/null +++ b/Lang/Fortran/EKG-sequence-convergence @@ -0,0 +1 @@ +../../Task/EKG-sequence-convergence/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Eban-numbers b/Lang/Fortran/Eban-numbers new file mode 120000 index 0000000000..0d435c16c7 --- /dev/null +++ b/Lang/Fortran/Eban-numbers @@ -0,0 +1 @@ +../../Task/Eban-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Egyptian-division b/Lang/Fortran/Egyptian-division new file mode 120000 index 0000000000..bb7a134139 --- /dev/null +++ b/Lang/Fortran/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Entropy-Narcissist b/Lang/Fortran/Entropy-Narcissist new file mode 120000 index 0000000000..9050980c1c --- /dev/null +++ b/Lang/Fortran/Entropy-Narcissist @@ -0,0 +1 @@ +../../Task/Entropy-Narcissist/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Eulers-constant-0.5772... b/Lang/Fortran/Eulers-constant-0.5772... new file mode 120000 index 0000000000..e2642e24fb --- /dev/null +++ b/Lang/Fortran/Eulers-constant-0.5772... @@ -0,0 +1 @@ +../../Task/Eulers-constant-0.5772.../Fortran \ No newline at end of file diff --git a/Lang/Fortran/Exponentiation-with-infix-operators-in-or-operating-on-the-base b/Lang/Fortran/Exponentiation-with-infix-operators-in-or-operating-on-the-base new file mode 120000 index 0000000000..813fe58706 --- /dev/null +++ b/Lang/Fortran/Exponentiation-with-infix-operators-in-or-operating-on-the-base @@ -0,0 +1 @@ +../../Task/Exponentiation-with-infix-operators-in-or-operating-on-the-base/Fortran \ No newline at end of file diff --git a/Lang/Fortran/FASTA-format b/Lang/Fortran/FASTA-format new file mode 120000 index 0000000000..b5442ba0f5 --- /dev/null +++ b/Lang/Fortran/FASTA-format @@ -0,0 +1 @@ +../../Task/FASTA-format/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Factorions b/Lang/Fortran/Factorions new file mode 120000 index 0000000000..2a48b53fa3 --- /dev/null +++ b/Lang/Fortran/Factorions @@ -0,0 +1 @@ +../../Task/Factorions/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Farey-sequence b/Lang/Fortran/Farey-sequence new file mode 120000 index 0000000000..d7c19f96de --- /dev/null +++ b/Lang/Fortran/Farey-sequence @@ -0,0 +1 @@ +../../Task/Farey-sequence/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Fibonacci-word b/Lang/Fortran/Fibonacci-word new file mode 120000 index 0000000000..e92e6e10a6 --- /dev/null +++ b/Lang/Fortran/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Find-Chess960-starting-position-identifier b/Lang/Fortran/Find-Chess960-starting-position-identifier new file mode 120000 index 0000000000..9300b24a96 --- /dev/null +++ b/Lang/Fortran/Find-Chess960-starting-position-identifier @@ -0,0 +1 @@ +../../Task/Find-Chess960-starting-position-identifier/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Find-common-directory-path b/Lang/Fortran/Find-common-directory-path new file mode 120000 index 0000000000..87683f2dbe --- /dev/null +++ b/Lang/Fortran/Find-common-directory-path @@ -0,0 +1 @@ +../../Task/Find-common-directory-path/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Find-the-intersection-of-a-line-with-a-plane b/Lang/Fortran/Find-the-intersection-of-a-line-with-a-plane new file mode 120000 index 0000000000..b07ee0b0a7 --- /dev/null +++ b/Lang/Fortran/Find-the-intersection-of-a-line-with-a-plane @@ -0,0 +1 @@ +../../Task/Find-the-intersection-of-a-line-with-a-plane/Fortran \ No newline at end of file diff --git a/Lang/Fortran/First-perfect-square-in-base-n-with-n-unique-digits b/Lang/Fortran/First-perfect-square-in-base-n-with-n-unique-digits new file mode 120000 index 0000000000..6f8a8ab270 --- /dev/null +++ b/Lang/Fortran/First-perfect-square-in-base-n-with-n-unique-digits @@ -0,0 +1 @@ +../../Task/First-perfect-square-in-base-n-with-n-unique-digits/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Fivenum b/Lang/Fortran/Fivenum new file mode 120000 index 0000000000..a8fe9953dc --- /dev/null +++ b/Lang/Fortran/Fivenum @@ -0,0 +1 @@ +../../Task/Fivenum/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Fixed-length-records b/Lang/Fortran/Fixed-length-records new file mode 120000 index 0000000000..aa68735e7e --- /dev/null +++ b/Lang/Fortran/Fixed-length-records @@ -0,0 +1 @@ +../../Task/Fixed-length-records/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Fraction-reduction b/Lang/Fortran/Fraction-reduction new file mode 120000 index 0000000000..f7daa9279c --- /dev/null +++ b/Lang/Fortran/Fraction-reduction @@ -0,0 +1 @@ +../../Task/Fraction-reduction/Fortran \ No newline at end of file diff --git a/Lang/Fortran/French-Republican-calendar b/Lang/Fortran/French-Republican-calendar new file mode 120000 index 0000000000..765942db3d --- /dev/null +++ b/Lang/Fortran/French-Republican-calendar @@ -0,0 +1 @@ +../../Task/French-Republican-calendar/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Fusc-sequence b/Lang/Fortran/Fusc-sequence new file mode 120000 index 0000000000..c5e3005573 --- /dev/null +++ b/Lang/Fortran/Fusc-sequence @@ -0,0 +1 @@ +../../Task/Fusc-sequence/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Gapful-numbers b/Lang/Fortran/Gapful-numbers new file mode 120000 index 0000000000..7500b01654 --- /dev/null +++ b/Lang/Fortran/Gapful-numbers @@ -0,0 +1 @@ +../../Task/Gapful-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Giuga-numbers b/Lang/Fortran/Giuga-numbers new file mode 120000 index 0000000000..9f15a4c7e2 --- /dev/null +++ b/Lang/Fortran/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Greedy-algorithm-for-Egyptian-fractions b/Lang/Fortran/Greedy-algorithm-for-Egyptian-fractions new file mode 120000 index 0000000000..053e501120 --- /dev/null +++ b/Lang/Fortran/Greedy-algorithm-for-Egyptian-fractions @@ -0,0 +1 @@ +../../Task/Greedy-algorithm-for-Egyptian-fractions/Fortran \ No newline at end of file diff --git a/Lang/Fortran/HTTP b/Lang/Fortran/HTTP new file mode 120000 index 0000000000..24f0692116 --- /dev/null +++ b/Lang/Fortran/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Harmonic-series b/Lang/Fortran/Harmonic-series new file mode 120000 index 0000000000..6a6cd246a2 --- /dev/null +++ b/Lang/Fortran/Harmonic-series @@ -0,0 +1 @@ +../../Task/Harmonic-series/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Hex-words b/Lang/Fortran/Hex-words new file mode 120000 index 0000000000..2b9a4573e8 --- /dev/null +++ b/Lang/Fortran/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Hofstadter-Figure-Figure-sequences b/Lang/Fortran/Hofstadter-Figure-Figure-sequences new file mode 120000 index 0000000000..46497cf751 --- /dev/null +++ b/Lang/Fortran/Hofstadter-Figure-Figure-sequences @@ -0,0 +1 @@ +../../Task/Hofstadter-Figure-Figure-sequences/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Humble-numbers b/Lang/Fortran/Humble-numbers new file mode 120000 index 0000000000..5aff41aed9 --- /dev/null +++ b/Lang/Fortran/Humble-numbers @@ -0,0 +1 @@ +../../Task/Humble-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Intersecting-number-wheels b/Lang/Fortran/Intersecting-number-wheels new file mode 120000 index 0000000000..f87ba36725 --- /dev/null +++ b/Lang/Fortran/Intersecting-number-wheels @@ -0,0 +1 @@ +../../Task/Intersecting-number-wheels/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Isograms-and-heterograms b/Lang/Fortran/Isograms-and-heterograms new file mode 120000 index 0000000000..cc9bb4e50b --- /dev/null +++ b/Lang/Fortran/Isograms-and-heterograms @@ -0,0 +1 @@ +../../Task/Isograms-and-heterograms/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Iterated-digits-squaring b/Lang/Fortran/Iterated-digits-squaring new file mode 120000 index 0000000000..b72dc14257 --- /dev/null +++ b/Lang/Fortran/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Jewels-and-stones b/Lang/Fortran/Jewels-and-stones new file mode 120000 index 0000000000..5375572de2 --- /dev/null +++ b/Lang/Fortran/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/Fortran \ No newline at end of file diff --git a/Lang/Fortran/K-d-tree b/Lang/Fortran/K-d-tree new file mode 120000 index 0000000000..3b7491c540 --- /dev/null +++ b/Lang/Fortran/K-d-tree @@ -0,0 +1 @@ +../../Task/K-d-tree/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Kernighans-large-earthquake-problem b/Lang/Fortran/Kernighans-large-earthquake-problem new file mode 120000 index 0000000000..ae20f8ddbd --- /dev/null +++ b/Lang/Fortran/Kernighans-large-earthquake-problem @@ -0,0 +1 @@ +../../Task/Kernighans-large-earthquake-problem/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Knapsack-problem-0-1 b/Lang/Fortran/Knapsack-problem-0-1 new file mode 120000 index 0000000000..e042c7b894 --- /dev/null +++ b/Lang/Fortran/Knapsack-problem-0-1 @@ -0,0 +1 @@ +../../Task/Knapsack-problem-0-1/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Knapsack-problem-Bounded b/Lang/Fortran/Knapsack-problem-Bounded new file mode 120000 index 0000000000..9f9870702b --- /dev/null +++ b/Lang/Fortran/Knapsack-problem-Bounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Bounded/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Knuths-algorithm-S b/Lang/Fortran/Knuths-algorithm-S new file mode 120000 index 0000000000..fe5b21ade9 --- /dev/null +++ b/Lang/Fortran/Knuths-algorithm-S @@ -0,0 +1 @@ +../../Task/Knuths-algorithm-S/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Knuths-power-tree b/Lang/Fortran/Knuths-power-tree new file mode 120000 index 0000000000..163172c51f --- /dev/null +++ b/Lang/Fortran/Knuths-power-tree @@ -0,0 +1 @@ +../../Task/Knuths-power-tree/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Largest-number-divisible-by-its-digits b/Lang/Fortran/Largest-number-divisible-by-its-digits new file mode 120000 index 0000000000..cd7d8d0694 --- /dev/null +++ b/Lang/Fortran/Largest-number-divisible-by-its-digits @@ -0,0 +1 @@ +../../Task/Largest-number-divisible-by-its-digits/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Logistic-curve-fitting-in-epidemiology b/Lang/Fortran/Logistic-curve-fitting-in-epidemiology new file mode 120000 index 0000000000..c968939bbf --- /dev/null +++ b/Lang/Fortran/Logistic-curve-fitting-in-epidemiology @@ -0,0 +1 @@ +../../Task/Logistic-curve-fitting-in-epidemiology/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Long-literals-with-continuations b/Lang/Fortran/Long-literals-with-continuations new file mode 120000 index 0000000000..7af1186694 --- /dev/null +++ b/Lang/Fortran/Long-literals-with-continuations @@ -0,0 +1 @@ +../../Task/Long-literals-with-continuations/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Longest-increasing-subsequence b/Lang/Fortran/Longest-increasing-subsequence new file mode 120000 index 0000000000..4d7a715c23 --- /dev/null +++ b/Lang/Fortran/Longest-increasing-subsequence @@ -0,0 +1 @@ +../../Task/Longest-increasing-subsequence/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Loops-Wrong-ranges b/Lang/Fortran/Loops-Wrong-ranges new file mode 120000 index 0000000000..ecb218786f --- /dev/null +++ b/Lang/Fortran/Loops-Wrong-ranges @@ -0,0 +1 @@ +../../Task/Loops-Wrong-ranges/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Lucky-and-even-lucky-numbers b/Lang/Fortran/Lucky-and-even-lucky-numbers new file mode 120000 index 0000000000..5ac4d084fd --- /dev/null +++ b/Lang/Fortran/Lucky-and-even-lucky-numbers @@ -0,0 +1 @@ +../../Task/Lucky-and-even-lucky-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Magic-constant b/Lang/Fortran/Magic-constant new file mode 120000 index 0000000000..011d77bc86 --- /dev/null +++ b/Lang/Fortran/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/Fortran \ No newline at end of file diff --git a/Lang/Fortran/McNuggets-problem b/Lang/Fortran/McNuggets-problem new file mode 120000 index 0000000000..6e4b8bc9dd --- /dev/null +++ b/Lang/Fortran/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Metallic-ratios b/Lang/Fortran/Metallic-ratios new file mode 120000 index 0000000000..21133a8990 --- /dev/null +++ b/Lang/Fortran/Metallic-ratios @@ -0,0 +1 @@ +../../Task/Metallic-ratios/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Miller-Rabin-primality-test b/Lang/Fortran/Miller-Rabin-primality-test deleted file mode 120000 index 6d501f45e9..0000000000 --- a/Lang/Fortran/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Mind-boggling-card-trick b/Lang/Fortran/Mind-boggling-card-trick new file mode 120000 index 0000000000..bda2aaf5f0 --- /dev/null +++ b/Lang/Fortran/Mind-boggling-card-trick @@ -0,0 +1 @@ +../../Task/Mind-boggling-card-trick/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/Fortran/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..0e425fef14 --- /dev/null +++ b/Lang/Fortran/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Minimum-positive-multiple-in-base-10-using-only-0-and-1 b/Lang/Fortran/Minimum-positive-multiple-in-base-10-using-only-0-and-1 new file mode 120000 index 0000000000..2524fb63f9 --- /dev/null +++ b/Lang/Fortran/Minimum-positive-multiple-in-base-10-using-only-0-and-1 @@ -0,0 +1 @@ +../../Task/Minimum-positive-multiple-in-base-10-using-only-0-and-1/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Modified-random-distribution b/Lang/Fortran/Modified-random-distribution new file mode 120000 index 0000000000..b886daca51 --- /dev/null +++ b/Lang/Fortran/Modified-random-distribution @@ -0,0 +1 @@ +../../Task/Modified-random-distribution/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Move-to-front-algorithm b/Lang/Fortran/Move-to-front-algorithm new file mode 120000 index 0000000000..aaea4a888b --- /dev/null +++ b/Lang/Fortran/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Multisplit b/Lang/Fortran/Multisplit new file mode 120000 index 0000000000..f032908bb4 --- /dev/null +++ b/Lang/Fortran/Multisplit @@ -0,0 +1 @@ +../../Task/Multisplit/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors b/Lang/Fortran/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors new file mode 120000 index 0000000000..2f7237b820 --- /dev/null +++ b/Lang/Fortran/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors @@ -0,0 +1 @@ +../../Task/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Ormiston-triples b/Lang/Fortran/Ormiston-triples new file mode 120000 index 0000000000..a2f8794905 --- /dev/null +++ b/Lang/Fortran/Ormiston-triples @@ -0,0 +1 @@ +../../Task/Ormiston-triples/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Palindrome-dates b/Lang/Fortran/Palindrome-dates new file mode 120000 index 0000000000..0f7da68189 --- /dev/null +++ b/Lang/Fortran/Palindrome-dates @@ -0,0 +1 @@ +../../Task/Palindrome-dates/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Parallel-brute-force b/Lang/Fortran/Parallel-brute-force new file mode 120000 index 0000000000..85bd9c5ced --- /dev/null +++ b/Lang/Fortran/Parallel-brute-force @@ -0,0 +1 @@ +../../Task/Parallel-brute-force/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Parse-an-IP-Address b/Lang/Fortran/Parse-an-IP-Address new file mode 120000 index 0000000000..33994c1cc1 --- /dev/null +++ b/Lang/Fortran/Parse-an-IP-Address @@ -0,0 +1 @@ +../../Task/Parse-an-IP-Address/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Partition-an-integer-x-into-n-primes b/Lang/Fortran/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..0df6e16951 --- /dev/null +++ b/Lang/Fortran/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Pascals-triangle-Puzzle b/Lang/Fortran/Pascals-triangle-Puzzle new file mode 120000 index 0000000000..5cea267339 --- /dev/null +++ b/Lang/Fortran/Pascals-triangle-Puzzle @@ -0,0 +1 @@ +../../Task/Pascals-triangle-Puzzle/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Password-generator b/Lang/Fortran/Password-generator new file mode 120000 index 0000000000..5ff2015452 --- /dev/null +++ b/Lang/Fortran/Password-generator @@ -0,0 +1 @@ +../../Task/Password-generator/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Pells-equation b/Lang/Fortran/Pells-equation new file mode 120000 index 0000000000..5929e39745 --- /dev/null +++ b/Lang/Fortran/Pells-equation @@ -0,0 +1 @@ +../../Task/Pells-equation/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Playfair-cipher b/Lang/Fortran/Playfair-cipher new file mode 120000 index 0000000000..7f02f8e934 --- /dev/null +++ b/Lang/Fortran/Playfair-cipher @@ -0,0 +1 @@ +../../Task/Playfair-cipher/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Primality-by-Wilsons-theorem b/Lang/Fortran/Primality-by-Wilsons-theorem new file mode 120000 index 0000000000..228dd95d2d --- /dev/null +++ b/Lang/Fortran/Primality-by-Wilsons-theorem @@ -0,0 +1 @@ +../../Task/Primality-by-Wilsons-theorem/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Pseudo-random-numbers-Splitmix64 b/Lang/Fortran/Pseudo-random-numbers-Splitmix64 new file mode 120000 index 0000000000..39aac5cdd2 --- /dev/null +++ b/Lang/Fortran/Pseudo-random-numbers-Splitmix64 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Splitmix64/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Quaternion-type b/Lang/Fortran/Quaternion-type deleted file mode 120000 index a1829748df..0000000000 --- a/Lang/Fortran/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Ramanujan-primes-twins b/Lang/Fortran/Ramanujan-primes-twins new file mode 120000 index 0000000000..bdb1a22484 --- /dev/null +++ b/Lang/Fortran/Ramanujan-primes-twins @@ -0,0 +1 @@ +../../Task/Ramanujan-primes-twins/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Ramanujans-constant b/Lang/Fortran/Ramanujans-constant new file mode 120000 index 0000000000..8de4420011 --- /dev/null +++ b/Lang/Fortran/Ramanujans-constant @@ -0,0 +1 @@ +../../Task/Ramanujans-constant/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Ramer-Douglas-Peucker-line-simplification b/Lang/Fortran/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..a601cbd90f --- /dev/null +++ b/Lang/Fortran/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Ranking-methods b/Lang/Fortran/Ranking-methods new file mode 120000 index 0000000000..a369cc6fab --- /dev/null +++ b/Lang/Fortran/Ranking-methods @@ -0,0 +1 @@ +../../Task/Ranking-methods/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Read-a-file-character-by-character-UTF8 b/Lang/Fortran/Read-a-file-character-by-character-UTF8 new file mode 120000 index 0000000000..4e9ecfa6e0 --- /dev/null +++ b/Lang/Fortran/Read-a-file-character-by-character-UTF8 @@ -0,0 +1 @@ +../../Task/Read-a-file-character-by-character-UTF8/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Resistor-mesh b/Lang/Fortran/Resistor-mesh new file mode 120000 index 0000000000..4c45bf818f --- /dev/null +++ b/Lang/Fortran/Resistor-mesh @@ -0,0 +1 @@ +../../Task/Resistor-mesh/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Sailors-coconuts-and-a-monkey-problem b/Lang/Fortran/Sailors-coconuts-and-a-monkey-problem new file mode 120000 index 0000000000..e105172665 --- /dev/null +++ b/Lang/Fortran/Sailors-coconuts-and-a-monkey-problem @@ -0,0 +1 @@ +../../Task/Sailors-coconuts-and-a-monkey-problem/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Sieve-of-Pritchard b/Lang/Fortran/Sieve-of-Pritchard new file mode 120000 index 0000000000..a74974dd66 --- /dev/null +++ b/Lang/Fortran/Sieve-of-Pritchard @@ -0,0 +1 @@ +../../Task/Sieve-of-Pritchard/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Sleeping-Beauty-problem b/Lang/Fortran/Sleeping-Beauty-problem new file mode 120000 index 0000000000..35b7547112 --- /dev/null +++ b/Lang/Fortran/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Solve-a-Hopido-puzzle b/Lang/Fortran/Solve-a-Hopido-puzzle new file mode 120000 index 0000000000..4726977710 --- /dev/null +++ b/Lang/Fortran/Solve-a-Hopido-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hopido-puzzle/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Sorting-Algorithms-Circle-Sort b/Lang/Fortran/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 62558aaa6e..0000000000 --- a/Lang/Fortran/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Sorting-algorithms-Cocktail-sort-with-shifting-bounds b/Lang/Fortran/Sorting-algorithms-Cocktail-sort-with-shifting-bounds new file mode 120000 index 0000000000..cbe69052c4 --- /dev/null +++ b/Lang/Fortran/Sorting-algorithms-Cocktail-sort-with-shifting-bounds @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Cocktail-sort-with-shifting-bounds/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Square-but-not-cube b/Lang/Fortran/Square-but-not-cube new file mode 120000 index 0000000000..13809f6e51 --- /dev/null +++ b/Lang/Fortran/Square-but-not-cube @@ -0,0 +1 @@ +../../Task/Square-but-not-cube/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Stable-marriage-problem b/Lang/Fortran/Stable-marriage-problem new file mode 120000 index 0000000000..b61f49608c --- /dev/null +++ b/Lang/Fortran/Stable-marriage-problem @@ -0,0 +1 @@ +../../Task/Stable-marriage-problem/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Strassens-algorithm b/Lang/Fortran/Strassens-algorithm new file mode 120000 index 0000000000..f73f6498f4 --- /dev/null +++ b/Lang/Fortran/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Strip-whitespace-from-a-string-Top-and-tail b/Lang/Fortran/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..e6e0c4696a --- /dev/null +++ b/Lang/Fortran/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Sum-of-elements-below-main-diagonal-of-matrix b/Lang/Fortran/Sum-of-elements-below-main-diagonal-of-matrix new file mode 120000 index 0000000000..a739c37e8e --- /dev/null +++ b/Lang/Fortran/Sum-of-elements-below-main-diagonal-of-matrix @@ -0,0 +1 @@ +../../Task/Sum-of-elements-below-main-diagonal-of-matrix/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Synchronous-concurrency b/Lang/Fortran/Synchronous-concurrency new file mode 120000 index 0000000000..f0f128cdfd --- /dev/null +++ b/Lang/Fortran/Synchronous-concurrency @@ -0,0 +1 @@ +../../Task/Synchronous-concurrency/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Tarjan b/Lang/Fortran/Tarjan new file mode 120000 index 0000000000..22149d08b7 --- /dev/null +++ b/Lang/Fortran/Tarjan @@ -0,0 +1 @@ +../../Task/Tarjan/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Thieles-interpolation-formula b/Lang/Fortran/Thieles-interpolation-formula new file mode 120000 index 0000000000..f8f82960bc --- /dev/null +++ b/Lang/Fortran/Thieles-interpolation-formula @@ -0,0 +1 @@ +../../Task/Thieles-interpolation-formula/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Total-circles-area b/Lang/Fortran/Total-circles-area new file mode 120000 index 0000000000..7ea452c217 --- /dev/null +++ b/Lang/Fortran/Total-circles-area @@ -0,0 +1 @@ +../../Task/Total-circles-area/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Totient-function b/Lang/Fortran/Totient-function new file mode 120000 index 0000000000..2559e22f69 --- /dev/null +++ b/Lang/Fortran/Totient-function @@ -0,0 +1 @@ +../../Task/Totient-function/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Tree-datastructures b/Lang/Fortran/Tree-datastructures new file mode 120000 index 0000000000..0155519b78 --- /dev/null +++ b/Lang/Fortran/Tree-datastructures @@ -0,0 +1 @@ +../../Task/Tree-datastructures/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Twelve-statements b/Lang/Fortran/Twelve-statements new file mode 120000 index 0000000000..dfaa2166b8 --- /dev/null +++ b/Lang/Fortran/Twelve-statements @@ -0,0 +1 @@ +../../Task/Twelve-statements/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Two-bullet-roulette b/Lang/Fortran/Two-bullet-roulette new file mode 120000 index 0000000000..67f7fb2512 --- /dev/null +++ b/Lang/Fortran/Two-bullet-roulette @@ -0,0 +1 @@ +../../Task/Two-bullet-roulette/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Twos-complement b/Lang/Fortran/Twos-complement new file mode 120000 index 0000000000..b8e6672d37 --- /dev/null +++ b/Lang/Fortran/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Ukkonen-s-suffix-tree-construction b/Lang/Fortran/Ukkonen-s-suffix-tree-construction new file mode 120000 index 0000000000..183d59f5c8 --- /dev/null +++ b/Lang/Fortran/Ukkonen-s-suffix-tree-construction @@ -0,0 +1 @@ +../../Task/Ukkonen-s-suffix-tree-construction/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Unprimeable-numbers b/Lang/Fortran/Unprimeable-numbers new file mode 120000 index 0000000000..9835babcf5 --- /dev/null +++ b/Lang/Fortran/Unprimeable-numbers @@ -0,0 +1 @@ +../../Task/Unprimeable-numbers/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Vampire-number b/Lang/Fortran/Vampire-number new file mode 120000 index 0000000000..fda3c25555 --- /dev/null +++ b/Lang/Fortran/Vampire-number @@ -0,0 +1 @@ +../../Task/Vampire-number/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Verhoeff-algorithm b/Lang/Fortran/Verhoeff-algorithm new file mode 120000 index 0000000000..da50f29648 --- /dev/null +++ b/Lang/Fortran/Verhoeff-algorithm @@ -0,0 +1 @@ +../../Task/Verhoeff-algorithm/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Vigen-re-cipher-Cryptanalysis b/Lang/Fortran/Vigen-re-cipher-Cryptanalysis new file mode 120000 index 0000000000..1fbd3a2ec4 --- /dev/null +++ b/Lang/Fortran/Vigen-re-cipher-Cryptanalysis @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher-Cryptanalysis/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Vogels-approximation-method b/Lang/Fortran/Vogels-approximation-method new file mode 120000 index 0000000000..3098233175 --- /dev/null +++ b/Lang/Fortran/Vogels-approximation-method @@ -0,0 +1 @@ +../../Task/Vogels-approximation-method/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Word-search b/Lang/Fortran/Word-search new file mode 120000 index 0000000000..1675b7de44 --- /dev/null +++ b/Lang/Fortran/Word-search @@ -0,0 +1 @@ +../../Task/Word-search/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Yellowstone-sequence b/Lang/Fortran/Yellowstone-sequence new file mode 120000 index 0000000000..ba08bc09f7 --- /dev/null +++ b/Lang/Fortran/Yellowstone-sequence @@ -0,0 +1 @@ +../../Task/Yellowstone-sequence/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Zebra-puzzle b/Lang/Fortran/Zebra-puzzle new file mode 120000 index 0000000000..93816a6fc6 --- /dev/null +++ b/Lang/Fortran/Zebra-puzzle @@ -0,0 +1 @@ +../../Task/Zebra-puzzle/Fortran \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/ADFGVX-cipher b/Lang/Free-Pascal-Lazarus/ADFGVX-cipher new file mode 120000 index 0000000000..b14ee34ace --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/ADFGVX-cipher @@ -0,0 +1 @@ +../../Task/ADFGVX-cipher/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Abstract-type b/Lang/Free-Pascal-Lazarus/Abstract-type new file mode 120000 index 0000000000..89db3c6334 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Abundant-odd-numbers b/Lang/Free-Pascal-Lazarus/Abundant-odd-numbers new file mode 120000 index 0000000000..04dfaa00e1 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Bell-numbers b/Lang/Free-Pascal-Lazarus/Bell-numbers new file mode 120000 index 0000000000..889cd61708 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Bin-given-limits b/Lang/Free-Pascal-Lazarus/Bin-given-limits new file mode 120000 index 0000000000..090d25165e --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Bin-given-limits @@ -0,0 +1 @@ +../../Task/Bin-given-limits/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Binary-strings b/Lang/Free-Pascal-Lazarus/Binary-strings new file mode 120000 index 0000000000..f6ed90f24b --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Boyer-Moore-string-search b/Lang/Free-Pascal-Lazarus/Boyer-Moore-string-search new file mode 120000 index 0000000000..9902c3a3ea --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Brazilian-numbers b/Lang/Free-Pascal-Lazarus/Brazilian-numbers new file mode 120000 index 0000000000..2f21964a49 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Brazilian-numbers @@ -0,0 +1 @@ +../../Task/Brazilian-numbers/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Brilliant-numbers b/Lang/Free-Pascal-Lazarus/Brilliant-numbers new file mode 120000 index 0000000000..07a95dbd77 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Brilliant-numbers @@ -0,0 +1 @@ +../../Task/Brilliant-numbers/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Cistercian-numerals b/Lang/Free-Pascal-Lazarus/Cistercian-numerals new file mode 120000 index 0000000000..e09b44b1be --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Cistercian-numerals @@ -0,0 +1 @@ +../../Task/Cistercian-numerals/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Closures-Value-capture b/Lang/Free-Pascal-Lazarus/Closures-Value-capture new file mode 120000 index 0000000000..4b2493493f --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/DNS-query b/Lang/Free-Pascal-Lazarus/DNS-query new file mode 120000 index 0000000000..f7c79b4afe --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/DNS-query @@ -0,0 +1 @@ +../../Task/DNS-query/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Duffinian-numbers b/Lang/Free-Pascal-Lazarus/Duffinian-numbers new file mode 120000 index 0000000000..d54184ff4d --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Duffinian-numbers @@ -0,0 +1 @@ +../../Task/Duffinian-numbers/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Dutch-national-flag-problem b/Lang/Free-Pascal-Lazarus/Dutch-national-flag-problem new file mode 120000 index 0000000000..da47f4535f --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Ethiopian-multiplication b/Lang/Free-Pascal-Lazarus/Ethiopian-multiplication new file mode 120000 index 0000000000..845adfef13 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Find-common-directory-path b/Lang/Free-Pascal-Lazarus/Find-common-directory-path new file mode 120000 index 0000000000..c057f7c7e2 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Find-common-directory-path @@ -0,0 +1 @@ +../../Task/Find-common-directory-path/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Fractal-tree b/Lang/Free-Pascal-Lazarus/Fractal-tree new file mode 120000 index 0000000000..c2081a0860 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Fractal-tree @@ -0,0 +1 @@ +../../Task/Fractal-tree/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Gamma-function b/Lang/Free-Pascal-Lazarus/Gamma-function new file mode 120000 index 0000000000..9c45231564 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Gauss-Jordan-matrix-inversion b/Lang/Free-Pascal-Lazarus/Gauss-Jordan-matrix-inversion new file mode 120000 index 0000000000..274f90a571 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Gauss-Jordan-matrix-inversion @@ -0,0 +1 @@ +../../Task/Gauss-Jordan-matrix-inversion/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Hex-words b/Lang/Free-Pascal-Lazarus/Hex-words new file mode 120000 index 0000000000..f8d9d0ada4 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Hickerson-series-of-almost-integers b/Lang/Free-Pascal-Lazarus/Hickerson-series-of-almost-integers new file mode 120000 index 0000000000..e8c446d1f2 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Hickerson-series-of-almost-integers @@ -0,0 +1 @@ +../../Task/Hickerson-series-of-almost-integers/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Kaprekar-numbers b/Lang/Free-Pascal-Lazarus/Kaprekar-numbers new file mode 120000 index 0000000000..7aca236c6b --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Kaprekar-numbers @@ -0,0 +1 @@ +../../Task/Kaprekar-numbers/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Largest-number-divisible-by-its-digits b/Lang/Free-Pascal-Lazarus/Largest-number-divisible-by-its-digits new file mode 120000 index 0000000000..702d65adc8 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Largest-number-divisible-by-its-digits @@ -0,0 +1 @@ +../../Task/Largest-number-divisible-by-its-digits/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Leap-year b/Lang/Free-Pascal-Lazarus/Leap-year new file mode 120000 index 0000000000..1dc9648945 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Leonardo-numbers b/Lang/Free-Pascal-Lazarus/Leonardo-numbers new file mode 120000 index 0000000000..5fc9b6dc54 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Levenshtein-distance b/Lang/Free-Pascal-Lazarus/Levenshtein-distance new file mode 120000 index 0000000000..eebdca8158 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Map-range b/Lang/Free-Pascal-Lazarus/Map-range new file mode 120000 index 0000000000..65b07f3cc6 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Numbers-with-equal-rises-and-falls b/Lang/Free-Pascal-Lazarus/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..d3988596ad --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Ordered-words b/Lang/Free-Pascal-Lazarus/Ordered-words new file mode 120000 index 0000000000..ec364f330e --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Pancake-numbers b/Lang/Free-Pascal-Lazarus/Pancake-numbers new file mode 120000 index 0000000000..e82c81624b --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Parallel-brute-force b/Lang/Free-Pascal-Lazarus/Parallel-brute-force new file mode 120000 index 0000000000..cdb4d87e7a --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Parallel-brute-force @@ -0,0 +1 @@ +../../Task/Parallel-brute-force/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Parallel-calculations b/Lang/Free-Pascal-Lazarus/Parallel-calculations new file mode 120000 index 0000000000..191ed1dae7 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Parallel-calculations @@ -0,0 +1 @@ +../../Task/Parallel-calculations/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Prime-decomposition b/Lang/Free-Pascal-Lazarus/Prime-decomposition new file mode 120000 index 0000000000..358a72f6ea --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Probabilistic-choice b/Lang/Free-Pascal-Lazarus/Probabilistic-choice new file mode 120000 index 0000000000..0f85f5937f --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Probabilistic-choice @@ -0,0 +1 @@ +../../Task/Probabilistic-choice/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Proper-divisors b/Lang/Free-Pascal-Lazarus/Proper-divisors deleted file mode 120000 index 03149f68c6..0000000000 --- a/Lang/Free-Pascal-Lazarus/Proper-divisors +++ /dev/null @@ -1 +0,0 @@ -../../Task/Proper-divisors/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Search-a-list-of-records b/Lang/Free-Pascal-Lazarus/Search-a-list-of-records new file mode 120000 index 0000000000..f0c61d03db --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Search-a-list-of-records @@ -0,0 +1 @@ +../../Task/Search-a-list-of-records/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Sorting-algorithms-Shell-sort b/Lang/Free-Pascal-Lazarus/Sorting-algorithms-Shell-sort new file mode 120000 index 0000000000..e5c8120991 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Sorting-algorithms-Shell-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Shell-sort/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/Free-Pascal-Lazarus/Square-free-integers b/Lang/Free-Pascal-Lazarus/Square-free-integers new file mode 120000 index 0000000000..88fe83b6b1 --- /dev/null +++ b/Lang/Free-Pascal-Lazarus/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/Free-Pascal-Lazarus \ No newline at end of file diff --git a/Lang/FreeBASIC/15-puzzle-solver b/Lang/FreeBASIC/15-puzzle-solver new file mode 120000 index 0000000000..aac40387ff --- /dev/null +++ b/Lang/FreeBASIC/15-puzzle-solver @@ -0,0 +1 @@ +../../Task/15-puzzle-solver/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/24-game-Solve b/Lang/FreeBASIC/24-game-Solve new file mode 120000 index 0000000000..68ad0335d9 --- /dev/null +++ b/Lang/FreeBASIC/24-game-Solve @@ -0,0 +1 @@ +../../Task/24-game-Solve/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/ADFGVX-cipher b/Lang/FreeBASIC/ADFGVX-cipher new file mode 120000 index 0000000000..43433b4959 --- /dev/null +++ b/Lang/FreeBASIC/ADFGVX-cipher @@ -0,0 +1 @@ +../../Task/ADFGVX-cipher/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/ASCII-art-diagram-converter b/Lang/FreeBASIC/ASCII-art-diagram-converter new file mode 120000 index 0000000000..f349074235 --- /dev/null +++ b/Lang/FreeBASIC/ASCII-art-diagram-converter @@ -0,0 +1 @@ +../../Task/ASCII-art-diagram-converter/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/AVL-tree b/Lang/FreeBASIC/AVL-tree new file mode 120000 index 0000000000..7500f1c637 --- /dev/null +++ b/Lang/FreeBASIC/AVL-tree @@ -0,0 +1 @@ +../../Task/AVL-tree/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Abbreviations-automatic b/Lang/FreeBASIC/Abbreviations-automatic new file mode 120000 index 0000000000..028d9e03ef --- /dev/null +++ b/Lang/FreeBASIC/Abbreviations-automatic @@ -0,0 +1 @@ +../../Task/Abbreviations-automatic/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Abbreviations-easy b/Lang/FreeBASIC/Abbreviations-easy new file mode 120000 index 0000000000..048f8f2ab7 --- /dev/null +++ b/Lang/FreeBASIC/Abbreviations-easy @@ -0,0 +1 @@ +../../Task/Abbreviations-easy/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Abbreviations-simple b/Lang/FreeBASIC/Abbreviations-simple new file mode 120000 index 0000000000..de9c8f171b --- /dev/null +++ b/Lang/FreeBASIC/Abbreviations-simple @@ -0,0 +1 @@ +../../Task/Abbreviations-simple/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Abelian-sandpile-model-Identity b/Lang/FreeBASIC/Abelian-sandpile-model-Identity new file mode 120000 index 0000000000..e9077c65f8 --- /dev/null +++ b/Lang/FreeBASIC/Abelian-sandpile-model-Identity @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model-Identity/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Active-Directory-Connect b/Lang/FreeBASIC/Active-Directory-Connect new file mode 120000 index 0000000000..6d467e47d0 --- /dev/null +++ b/Lang/FreeBASIC/Active-Directory-Connect @@ -0,0 +1 @@ +../../Task/Active-Directory-Connect/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Algebraic-data-types b/Lang/FreeBASIC/Algebraic-data-types new file mode 120000 index 0000000000..f2fce8f3dc --- /dev/null +++ b/Lang/FreeBASIC/Algebraic-data-types @@ -0,0 +1 @@ +../../Task/Algebraic-data-types/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Almkvist-Giullera-formula-for-pi b/Lang/FreeBASIC/Almkvist-Giullera-formula-for-pi new file mode 120000 index 0000000000..37082cc7bb --- /dev/null +++ b/Lang/FreeBASIC/Almkvist-Giullera-formula-for-pi @@ -0,0 +1 @@ +../../Task/Almkvist-Giullera-formula-for-pi/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Arithmetic-Rational b/Lang/FreeBASIC/Arithmetic-Rational new file mode 120000 index 0000000000..3182d3a125 --- /dev/null +++ b/Lang/FreeBASIC/Arithmetic-Rational @@ -0,0 +1 @@ +../../Task/Arithmetic-Rational/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Arithmetic-derivative b/Lang/FreeBASIC/Arithmetic-derivative new file mode 120000 index 0000000000..2a22a10780 --- /dev/null +++ b/Lang/FreeBASIC/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Associative-array-Merging b/Lang/FreeBASIC/Associative-array-Merging new file mode 120000 index 0000000000..77edeb4249 --- /dev/null +++ b/Lang/FreeBASIC/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/B-zier-curves-Intersections b/Lang/FreeBASIC/B-zier-curves-Intersections new file mode 120000 index 0000000000..e1718d7dc9 --- /dev/null +++ b/Lang/FreeBASIC/B-zier-curves-Intersections @@ -0,0 +1 @@ +../../Task/B-zier-curves-Intersections/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Babylonian-spiral b/Lang/FreeBASIC/Babylonian-spiral new file mode 120000 index 0000000000..e141e5d456 --- /dev/null +++ b/Lang/FreeBASIC/Babylonian-spiral @@ -0,0 +1 @@ +../../Task/Babylonian-spiral/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bifid-cipher b/Lang/FreeBASIC/Bifid-cipher new file mode 120000 index 0000000000..6fc87c7ae7 --- /dev/null +++ b/Lang/FreeBASIC/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bioinformatics-Global-alignment b/Lang/FreeBASIC/Bioinformatics-Global-alignment new file mode 120000 index 0000000000..93fb335c5b --- /dev/null +++ b/Lang/FreeBASIC/Bioinformatics-Global-alignment @@ -0,0 +1 @@ +../../Task/Bioinformatics-Global-alignment/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bioinformatics-base-count b/Lang/FreeBASIC/Bioinformatics-base-count deleted file mode 120000 index 89403f2018..0000000000 --- a/Lang/FreeBASIC/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bitcoin-public-point-to-address b/Lang/FreeBASIC/Bitcoin-public-point-to-address new file mode 120000 index 0000000000..6ff9b61a5b --- /dev/null +++ b/Lang/FreeBASIC/Bitcoin-public-point-to-address @@ -0,0 +1 @@ +../../Task/Bitcoin-public-point-to-address/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bitmap-Histogram b/Lang/FreeBASIC/Bitmap-Histogram new file mode 120000 index 0000000000..dc9da15219 --- /dev/null +++ b/Lang/FreeBASIC/Bitmap-Histogram @@ -0,0 +1 @@ +../../Task/Bitmap-Histogram/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bitmap-PPM-conversion-through-a-pipe b/Lang/FreeBASIC/Bitmap-PPM-conversion-through-a-pipe new file mode 120000 index 0000000000..9082778f9e --- /dev/null +++ b/Lang/FreeBASIC/Bitmap-PPM-conversion-through-a-pipe @@ -0,0 +1 @@ +../../Task/Bitmap-PPM-conversion-through-a-pipe/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bitmap-Read-a-PPM-file b/Lang/FreeBASIC/Bitmap-Read-a-PPM-file new file mode 120000 index 0000000000..c8c701a33a --- /dev/null +++ b/Lang/FreeBASIC/Bitmap-Read-a-PPM-file @@ -0,0 +1 @@ +../../Task/Bitmap-Read-a-PPM-file/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bitmap-Read-an-image-through-a-pipe b/Lang/FreeBASIC/Bitmap-Read-an-image-through-a-pipe new file mode 120000 index 0000000000..17dd1b6040 --- /dev/null +++ b/Lang/FreeBASIC/Bitmap-Read-an-image-through-a-pipe @@ -0,0 +1 @@ +../../Task/Bitmap-Read-an-image-through-a-pipe/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bitmap-Write-a-PPM-file b/Lang/FreeBASIC/Bitmap-Write-a-PPM-file new file mode 120000 index 0000000000..91057d85e5 --- /dev/null +++ b/Lang/FreeBASIC/Bitmap-Write-a-PPM-file @@ -0,0 +1 @@ +../../Task/Bitmap-Write-a-PPM-file/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bitwise-IO b/Lang/FreeBASIC/Bitwise-IO new file mode 120000 index 0000000000..ce5df5ec6c --- /dev/null +++ b/Lang/FreeBASIC/Bitwise-IO @@ -0,0 +1 @@ +../../Task/Bitwise-IO/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Brace-expansion b/Lang/FreeBASIC/Brace-expansion new file mode 120000 index 0000000000..b08a413ab2 --- /dev/null +++ b/Lang/FreeBASIC/Brace-expansion @@ -0,0 +1 @@ +../../Task/Brace-expansion/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Bulls-and-cows-Player b/Lang/FreeBASIC/Bulls-and-cows-Player new file mode 120000 index 0000000000..3f30549ded --- /dev/null +++ b/Lang/FreeBASIC/Bulls-and-cows-Player @@ -0,0 +1 @@ +../../Task/Bulls-and-cows-Player/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Burrows-Wheeler-transform b/Lang/FreeBASIC/Burrows-Wheeler-transform new file mode 120000 index 0000000000..1d1126ea89 --- /dev/null +++ b/Lang/FreeBASIC/Burrows-Wheeler-transform @@ -0,0 +1 @@ +../../Task/Burrows-Wheeler-transform/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Calkin-Wilf-sequence b/Lang/FreeBASIC/Calkin-Wilf-sequence deleted file mode 120000 index 0cfeafa7e2..0000000000 --- a/Lang/FreeBASIC/Calkin-Wilf-sequence +++ /dev/null @@ -1 +0,0 @@ -../../Task/Calkin-Wilf-sequence/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Canny-edge-detector b/Lang/FreeBASIC/Canny-edge-detector new file mode 120000 index 0000000000..17dd124847 --- /dev/null +++ b/Lang/FreeBASIC/Canny-edge-detector @@ -0,0 +1 @@ +../../Task/Canny-edge-detector/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Catmull-Clark-subdivision-surface b/Lang/FreeBASIC/Catmull-Clark-subdivision-surface new file mode 120000 index 0000000000..aa2f6e5ed9 --- /dev/null +++ b/Lang/FreeBASIC/Catmull-Clark-subdivision-surface @@ -0,0 +1 @@ +../../Task/Catmull-Clark-subdivision-surface/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Chat-server b/Lang/FreeBASIC/Chat-server new file mode 120000 index 0000000000..59f06de348 --- /dev/null +++ b/Lang/FreeBASIC/Chat-server @@ -0,0 +1 @@ +../../Task/Chat-server/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Cheryls-birthday b/Lang/FreeBASIC/Cheryls-birthday new file mode 120000 index 0000000000..c637b5ee77 --- /dev/null +++ b/Lang/FreeBASIC/Cheryls-birthday @@ -0,0 +1 @@ +../../Task/Cheryls-birthday/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Church-numerals b/Lang/FreeBASIC/Church-numerals new file mode 120000 index 0000000000..36b5d4ddfd --- /dev/null +++ b/Lang/FreeBASIC/Church-numerals @@ -0,0 +1 @@ +../../Task/Church-numerals/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Cistercian-numerals b/Lang/FreeBASIC/Cistercian-numerals new file mode 120000 index 0000000000..ceb56b6604 --- /dev/null +++ b/Lang/FreeBASIC/Cistercian-numerals @@ -0,0 +1 @@ +../../Task/Cistercian-numerals/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Color-quantization b/Lang/FreeBASIC/Color-quantization new file mode 120000 index 0000000000..ddc5eaabb7 --- /dev/null +++ b/Lang/FreeBASIC/Color-quantization @@ -0,0 +1 @@ +../../Task/Color-quantization/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Colorful-numbers b/Lang/FreeBASIC/Colorful-numbers new file mode 120000 index 0000000000..dcf0a876c1 --- /dev/null +++ b/Lang/FreeBASIC/Colorful-numbers @@ -0,0 +1 @@ +../../Task/Colorful-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Compiler-AST-interpreter b/Lang/FreeBASIC/Compiler-AST-interpreter new file mode 120000 index 0000000000..ea89d91369 --- /dev/null +++ b/Lang/FreeBASIC/Compiler-AST-interpreter @@ -0,0 +1 @@ +../../Task/Compiler-AST-interpreter/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Compiler-code-generator b/Lang/FreeBASIC/Compiler-code-generator new file mode 120000 index 0000000000..836b1482c2 --- /dev/null +++ b/Lang/FreeBASIC/Compiler-code-generator @@ -0,0 +1 @@ +../../Task/Compiler-code-generator/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Compiler-syntax-analyzer b/Lang/FreeBASIC/Compiler-syntax-analyzer new file mode 120000 index 0000000000..a7d7204b01 --- /dev/null +++ b/Lang/FreeBASIC/Compiler-syntax-analyzer @@ -0,0 +1 @@ +../../Task/Compiler-syntax-analyzer/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Compiler-virtual-machine-interpreter b/Lang/FreeBASIC/Compiler-virtual-machine-interpreter new file mode 120000 index 0000000000..18e70488f2 --- /dev/null +++ b/Lang/FreeBASIC/Compiler-virtual-machine-interpreter @@ -0,0 +1 @@ +../../Task/Compiler-virtual-machine-interpreter/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k b/Lang/FreeBASIC/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k new file mode 120000 index 0000000000..ed1aa87962 --- /dev/null +++ b/Lang/FreeBASIC/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k @@ -0,0 +1 @@ +../../Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Constrained-genericity b/Lang/FreeBASIC/Constrained-genericity new file mode 120000 index 0000000000..1fc68e6907 --- /dev/null +++ b/Lang/FreeBASIC/Constrained-genericity @@ -0,0 +1 @@ +../../Task/Constrained-genericity/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- b/Lang/FreeBASIC/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- new file mode 120000 index 0000000000..e2defb3109 --- /dev/null +++ b/Lang/FreeBASIC/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n-/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Cut-a-rectangle b/Lang/FreeBASIC/Cut-a-rectangle new file mode 120000 index 0000000000..16e664db93 --- /dev/null +++ b/Lang/FreeBASIC/Cut-a-rectangle @@ -0,0 +1 @@ +../../Task/Cut-a-rectangle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Cyclops-numbers b/Lang/FreeBASIC/Cyclops-numbers new file mode 120000 index 0000000000..b977c5acd5 --- /dev/null +++ b/Lang/FreeBASIC/Cyclops-numbers @@ -0,0 +1 @@ +../../Task/Cyclops-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Cyclotomic-polynomial b/Lang/FreeBASIC/Cyclotomic-polynomial new file mode 120000 index 0000000000..82e1fdeb03 --- /dev/null +++ b/Lang/FreeBASIC/Cyclotomic-polynomial @@ -0,0 +1 @@ +../../Task/Cyclotomic-polynomial/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/De-Bruijn-sequences b/Lang/FreeBASIC/De-Bruijn-sequences new file mode 120000 index 0000000000..2f6e2651ca --- /dev/null +++ b/Lang/FreeBASIC/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Death-Star b/Lang/FreeBASIC/Death-Star new file mode 120000 index 0000000000..b45f2416c8 --- /dev/null +++ b/Lang/FreeBASIC/Death-Star @@ -0,0 +1 @@ +../../Task/Death-Star/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Deceptive-numbers b/Lang/FreeBASIC/Deceptive-numbers new file mode 120000 index 0000000000..9ff51e1521 --- /dev/null +++ b/Lang/FreeBASIC/Deceptive-numbers @@ -0,0 +1 @@ +../../Task/Deceptive-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Deconvolution-1D b/Lang/FreeBASIC/Deconvolution-1D new file mode 120000 index 0000000000..27eae2284d --- /dev/null +++ b/Lang/FreeBASIC/Deconvolution-1D @@ -0,0 +1 @@ +../../Task/Deconvolution-1D/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Deconvolution-2D+ b/Lang/FreeBASIC/Deconvolution-2D+ new file mode 120000 index 0000000000..2a10e72230 --- /dev/null +++ b/Lang/FreeBASIC/Deconvolution-2D+ @@ -0,0 +1 @@ +../../Task/Deconvolution-2D+/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Delegates b/Lang/FreeBASIC/Delegates new file mode 120000 index 0000000000..499acc7b27 --- /dev/null +++ b/Lang/FreeBASIC/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Demings-funnel b/Lang/FreeBASIC/Demings-funnel new file mode 120000 index 0000000000..bbb96171d3 --- /dev/null +++ b/Lang/FreeBASIC/Demings-funnel @@ -0,0 +1 @@ +../../Task/Demings-funnel/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Dijkstras-algorithm b/Lang/FreeBASIC/Dijkstras-algorithm new file mode 120000 index 0000000000..4465c347e7 --- /dev/null +++ b/Lang/FreeBASIC/Dijkstras-algorithm @@ -0,0 +1 @@ +../../Task/Dijkstras-algorithm/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Dining-philosophers b/Lang/FreeBASIC/Dining-philosophers new file mode 120000 index 0000000000..5d616c69b5 --- /dev/null +++ b/Lang/FreeBASIC/Dining-philosophers @@ -0,0 +1 @@ +../../Task/Dining-philosophers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Display-an-outline-as-a-nested-table b/Lang/FreeBASIC/Display-an-outline-as-a-nested-table new file mode 120000 index 0000000000..e1fe23aa03 --- /dev/null +++ b/Lang/FreeBASIC/Display-an-outline-as-a-nested-table @@ -0,0 +1 @@ +../../Task/Display-an-outline-as-a-nested-table/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Distance-and-Bearing b/Lang/FreeBASIC/Distance-and-Bearing new file mode 120000 index 0000000000..14b1500a35 --- /dev/null +++ b/Lang/FreeBASIC/Distance-and-Bearing @@ -0,0 +1 @@ +../../Task/Distance-and-Bearing/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Distributed-programming b/Lang/FreeBASIC/Distributed-programming new file mode 120000 index 0000000000..3c9ea14752 --- /dev/null +++ b/Lang/FreeBASIC/Distributed-programming @@ -0,0 +1 @@ +../../Task/Distributed-programming/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Distribution-of-0-digits-in-factorial-series b/Lang/FreeBASIC/Distribution-of-0-digits-in-factorial-series new file mode 120000 index 0000000000..caef600e25 --- /dev/null +++ b/Lang/FreeBASIC/Distribution-of-0-digits-in-factorial-series @@ -0,0 +1 @@ +../../Task/Distribution-of-0-digits-in-factorial-series/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Dominoes b/Lang/FreeBASIC/Dominoes new file mode 120000 index 0000000000..46d9dcf5f4 --- /dev/null +++ b/Lang/FreeBASIC/Dominoes @@ -0,0 +1 @@ +../../Task/Dominoes/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/EKG-sequence-convergence b/Lang/FreeBASIC/EKG-sequence-convergence new file mode 120000 index 0000000000..dbcdf7a4b7 --- /dev/null +++ b/Lang/FreeBASIC/EKG-sequence-convergence @@ -0,0 +1 @@ +../../Task/EKG-sequence-convergence/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Earliest-difference-between-prime-gaps b/Lang/FreeBASIC/Earliest-difference-between-prime-gaps new file mode 120000 index 0000000000..2facf16701 --- /dev/null +++ b/Lang/FreeBASIC/Earliest-difference-between-prime-gaps @@ -0,0 +1 @@ +../../Task/Earliest-difference-between-prime-gaps/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Echo-server b/Lang/FreeBASIC/Echo-server new file mode 120000 index 0000000000..af11371400 --- /dev/null +++ b/Lang/FreeBASIC/Echo-server @@ -0,0 +1 @@ +../../Task/Echo-server/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Eertree b/Lang/FreeBASIC/Eertree new file mode 120000 index 0000000000..e752693cbe --- /dev/null +++ b/Lang/FreeBASIC/Eertree @@ -0,0 +1 @@ +../../Task/Eertree/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Elementary-cellular-automaton-Infinite-length b/Lang/FreeBASIC/Elementary-cellular-automaton-Infinite-length new file mode 120000 index 0000000000..ab22fce8e1 --- /dev/null +++ b/Lang/FreeBASIC/Elementary-cellular-automaton-Infinite-length @@ -0,0 +1 @@ +../../Task/Elementary-cellular-automaton-Infinite-length/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Elementary-cellular-automaton-Random-number-generator b/Lang/FreeBASIC/Elementary-cellular-automaton-Random-number-generator new file mode 120000 index 0000000000..45ef911e4c --- /dev/null +++ b/Lang/FreeBASIC/Elementary-cellular-automaton-Random-number-generator @@ -0,0 +1 @@ +../../Task/Elementary-cellular-automaton-Random-number-generator/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Elliptic-curve-arithmetic b/Lang/FreeBASIC/Elliptic-curve-arithmetic new file mode 120000 index 0000000000..ab0b3f0aed --- /dev/null +++ b/Lang/FreeBASIC/Elliptic-curve-arithmetic @@ -0,0 +1 @@ +../../Task/Elliptic-curve-arithmetic/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Executable-library b/Lang/FreeBASIC/Executable-library new file mode 120000 index 0000000000..ece6e47b6f --- /dev/null +++ b/Lang/FreeBASIC/Executable-library @@ -0,0 +1 @@ +../../Task/Executable-library/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Execute-Computer-Zero b/Lang/FreeBASIC/Execute-Computer-Zero new file mode 120000 index 0000000000..018dffe9b4 --- /dev/null +++ b/Lang/FreeBASIC/Execute-Computer-Zero @@ -0,0 +1 @@ +../../Task/Execute-Computer-Zero/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Execute-SNUSP b/Lang/FreeBASIC/Execute-SNUSP new file mode 120000 index 0000000000..7b179aedb8 --- /dev/null +++ b/Lang/FreeBASIC/Execute-SNUSP @@ -0,0 +1 @@ +../../Task/Execute-SNUSP/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Execute-a-Markov-algorithm b/Lang/FreeBASIC/Execute-a-Markov-algorithm new file mode 120000 index 0000000000..7f61263c19 --- /dev/null +++ b/Lang/FreeBASIC/Execute-a-Markov-algorithm @@ -0,0 +1 @@ +../../Task/Execute-a-Markov-algorithm/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Faces-from-a-mesh b/Lang/FreeBASIC/Faces-from-a-mesh new file mode 120000 index 0000000000..33d860451f --- /dev/null +++ b/Lang/FreeBASIC/Faces-from-a-mesh @@ -0,0 +1 @@ +../../Task/Faces-from-a-mesh/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Factorial-base-numbers-indexing-permutations-of-a-collection b/Lang/FreeBASIC/Factorial-base-numbers-indexing-permutations-of-a-collection new file mode 120000 index 0000000000..1f2b24105a --- /dev/null +++ b/Lang/FreeBASIC/Factorial-base-numbers-indexing-permutations-of-a-collection @@ -0,0 +1 @@ +../../Task/Factorial-base-numbers-indexing-permutations-of-a-collection/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Faulhabers-formula b/Lang/FreeBASIC/Faulhabers-formula new file mode 120000 index 0000000000..134508b711 --- /dev/null +++ b/Lang/FreeBASIC/Faulhabers-formula @@ -0,0 +1 @@ +../../Task/Faulhabers-formula/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Fermat-numbers b/Lang/FreeBASIC/Fermat-numbers new file mode 120000 index 0000000000..b6ff867057 --- /dev/null +++ b/Lang/FreeBASIC/Fermat-numbers @@ -0,0 +1 @@ +../../Task/Fermat-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/File-size-distribution b/Lang/FreeBASIC/File-size-distribution new file mode 120000 index 0000000000..fa04d214bc --- /dev/null +++ b/Lang/FreeBASIC/File-size-distribution @@ -0,0 +1 @@ +../../Task/File-size-distribution/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Find-duplicate-files b/Lang/FreeBASIC/Find-duplicate-files new file mode 120000 index 0000000000..f2becdf037 --- /dev/null +++ b/Lang/FreeBASIC/Find-duplicate-files @@ -0,0 +1 @@ +../../Task/Find-duplicate-files/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Find-largest-left-truncatable-prime-in-a-given-base b/Lang/FreeBASIC/Find-largest-left-truncatable-prime-in-a-given-base new file mode 120000 index 0000000000..90493830d8 --- /dev/null +++ b/Lang/FreeBASIC/Find-largest-left-truncatable-prime-in-a-given-base @@ -0,0 +1 @@ +../../Task/Find-largest-left-truncatable-prime-in-a-given-base/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/First-class-environments b/Lang/FreeBASIC/First-class-environments new file mode 120000 index 0000000000..4e48c3b03b --- /dev/null +++ b/Lang/FreeBASIC/First-class-environments @@ -0,0 +1 @@ +../../Task/First-class-environments/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/First-class-functions-Use-numbers-analogously b/Lang/FreeBASIC/First-class-functions-Use-numbers-analogously new file mode 120000 index 0000000000..7a5134ceca --- /dev/null +++ b/Lang/FreeBASIC/First-class-functions-Use-numbers-analogously @@ -0,0 +1 @@ +../../Task/First-class-functions-Use-numbers-analogously/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/First-perfect-square-in-base-n-with-n-unique-digits b/Lang/FreeBASIC/First-perfect-square-in-base-n-with-n-unique-digits new file mode 120000 index 0000000000..c5ae025a12 --- /dev/null +++ b/Lang/FreeBASIC/First-perfect-square-in-base-n-with-n-unique-digits @@ -0,0 +1 @@ +../../Task/First-perfect-square-in-base-n-with-n-unique-digits/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Formal-power-series b/Lang/FreeBASIC/Formal-power-series new file mode 120000 index 0000000000..da6e73ef9f --- /dev/null +++ b/Lang/FreeBASIC/Formal-power-series @@ -0,0 +1 @@ +../../Task/Formal-power-series/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Four-is-the-number-of-letters-in-the-... b/Lang/FreeBASIC/Four-is-the-number-of-letters-in-the-... new file mode 120000 index 0000000000..7c1f37136c --- /dev/null +++ b/Lang/FreeBASIC/Four-is-the-number-of-letters-in-the-... @@ -0,0 +1 @@ +../../Task/Four-is-the-number-of-letters-in-the-.../FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Fraction-reduction b/Lang/FreeBASIC/Fraction-reduction new file mode 120000 index 0000000000..fe901cf96d --- /dev/null +++ b/Lang/FreeBASIC/Fraction-reduction @@ -0,0 +1 @@ +../../Task/Fraction-reduction/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Function-frequency b/Lang/FreeBASIC/Function-frequency new file mode 120000 index 0000000000..c12c5882ff --- /dev/null +++ b/Lang/FreeBASIC/Function-frequency @@ -0,0 +1 @@ +../../Task/Function-frequency/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Functional-coverage-tree b/Lang/FreeBASIC/Functional-coverage-tree new file mode 120000 index 0000000000..03b730b6d0 --- /dev/null +++ b/Lang/FreeBASIC/Functional-coverage-tree @@ -0,0 +1 @@ +../../Task/Functional-coverage-tree/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Galton-box-animation b/Lang/FreeBASIC/Galton-box-animation new file mode 120000 index 0000000000..d8550e96b6 --- /dev/null +++ b/Lang/FreeBASIC/Galton-box-animation @@ -0,0 +1 @@ +../../Task/Galton-box-animation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Gotchas b/Lang/FreeBASIC/Gotchas new file mode 120000 index 0000000000..152b1da45f --- /dev/null +++ b/Lang/FreeBASIC/Gotchas @@ -0,0 +1 @@ +../../Task/Gotchas/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Graph-colouring b/Lang/FreeBASIC/Graph-colouring new file mode 120000 index 0000000000..2b6f6e444d --- /dev/null +++ b/Lang/FreeBASIC/Graph-colouring @@ -0,0 +1 @@ +../../Task/Graph-colouring/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/HTTPS b/Lang/FreeBASIC/HTTPS new file mode 120000 index 0000000000..ffa1e6ee82 --- /dev/null +++ b/Lang/FreeBASIC/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/HTTPS-Authenticated b/Lang/FreeBASIC/HTTPS-Authenticated new file mode 120000 index 0000000000..3da86c1cef --- /dev/null +++ b/Lang/FreeBASIC/HTTPS-Authenticated @@ -0,0 +1 @@ +../../Task/HTTPS-Authenticated/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/HTTPS-Client-authenticated b/Lang/FreeBASIC/HTTPS-Client-authenticated new file mode 120000 index 0000000000..8c2cbfcd86 --- /dev/null +++ b/Lang/FreeBASIC/HTTPS-Client-authenticated @@ -0,0 +1 @@ +../../Task/HTTPS-Client-authenticated/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Hash-join b/Lang/FreeBASIC/Hash-join new file mode 120000 index 0000000000..aaf807e749 --- /dev/null +++ b/Lang/FreeBASIC/Hash-join @@ -0,0 +1 @@ +../../Task/Hash-join/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Hello-world-Web-server b/Lang/FreeBASIC/Hello-world-Web-server new file mode 120000 index 0000000000..25d52ccee6 --- /dev/null +++ b/Lang/FreeBASIC/Hello-world-Web-server @@ -0,0 +1 @@ +../../Task/Hello-world-Web-server/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Hex-words b/Lang/FreeBASIC/Hex-words new file mode 120000 index 0000000000..fa25607a2e --- /dev/null +++ b/Lang/FreeBASIC/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/History-variables b/Lang/FreeBASIC/History-variables new file mode 120000 index 0000000000..68f4bcd858 --- /dev/null +++ b/Lang/FreeBASIC/History-variables @@ -0,0 +1 @@ +../../Task/History-variables/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Honeycombs b/Lang/FreeBASIC/Honeycombs new file mode 120000 index 0000000000..12b1cd0046 --- /dev/null +++ b/Lang/FreeBASIC/Honeycombs @@ -0,0 +1 @@ +../../Task/Honeycombs/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Hough-transform b/Lang/FreeBASIC/Hough-transform new file mode 120000 index 0000000000..b825046529 --- /dev/null +++ b/Lang/FreeBASIC/Hough-transform @@ -0,0 +1 @@ +../../Task/Hough-transform/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Im-a-software-engineer-get-me-out-of-here b/Lang/FreeBASIC/Im-a-software-engineer-get-me-out-of-here new file mode 120000 index 0000000000..2169aad43b --- /dev/null +++ b/Lang/FreeBASIC/Im-a-software-engineer-get-me-out-of-here @@ -0,0 +1 @@ +../../Task/Im-a-software-engineer-get-me-out-of-here/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Image-convolution b/Lang/FreeBASIC/Image-convolution new file mode 120000 index 0000000000..5f1451fadd --- /dev/null +++ b/Lang/FreeBASIC/Image-convolution @@ -0,0 +1 @@ +../../Task/Image-convolution/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Imaginary-base-numbers b/Lang/FreeBASIC/Imaginary-base-numbers new file mode 120000 index 0000000000..00ee9d8fe6 --- /dev/null +++ b/Lang/FreeBASIC/Imaginary-base-numbers @@ -0,0 +1 @@ +../../Task/Imaginary-base-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Intersecting-number-wheels b/Lang/FreeBASIC/Intersecting-number-wheels new file mode 120000 index 0000000000..42313ae624 --- /dev/null +++ b/Lang/FreeBASIC/Intersecting-number-wheels @@ -0,0 +1 @@ +../../Task/Intersecting-number-wheels/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Inverted-index b/Lang/FreeBASIC/Inverted-index new file mode 120000 index 0000000000..affc1bf23c --- /dev/null +++ b/Lang/FreeBASIC/Inverted-index @@ -0,0 +1 @@ +../../Task/Inverted-index/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Isograms-and-heterograms b/Lang/FreeBASIC/Isograms-and-heterograms new file mode 120000 index 0000000000..c142330285 --- /dev/null +++ b/Lang/FreeBASIC/Isograms-and-heterograms @@ -0,0 +1 @@ +../../Task/Isograms-and-heterograms/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Jaro-Winkler-distance b/Lang/FreeBASIC/Jaro-Winkler-distance new file mode 120000 index 0000000000..567e61dfba --- /dev/null +++ b/Lang/FreeBASIC/Jaro-Winkler-distance @@ -0,0 +1 @@ +../../Task/Jaro-Winkler-distance/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Juggler-sequence b/Lang/FreeBASIC/Juggler-sequence new file mode 120000 index 0000000000..5aaf9a794f --- /dev/null +++ b/Lang/FreeBASIC/Juggler-sequence @@ -0,0 +1 @@ +../../Task/Juggler-sequence/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/K-d-tree b/Lang/FreeBASIC/K-d-tree new file mode 120000 index 0000000000..f6319abaa1 --- /dev/null +++ b/Lang/FreeBASIC/K-d-tree @@ -0,0 +1 @@ +../../Task/K-d-tree/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Knuths-algorithm-S b/Lang/FreeBASIC/Knuths-algorithm-S new file mode 120000 index 0000000000..720a4a3a7e --- /dev/null +++ b/Lang/FreeBASIC/Knuths-algorithm-S @@ -0,0 +1 @@ +../../Task/Knuths-algorithm-S/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Knuths-power-tree b/Lang/FreeBASIC/Knuths-power-tree new file mode 120000 index 0000000000..b6075609dd --- /dev/null +++ b/Lang/FreeBASIC/Knuths-power-tree @@ -0,0 +1 @@ +../../Task/Knuths-power-tree/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Kolakoski-sequence b/Lang/FreeBASIC/Kolakoski-sequence new file mode 120000 index 0000000000..fce085b91c --- /dev/null +++ b/Lang/FreeBASIC/Kolakoski-sequence @@ -0,0 +1 @@ +../../Task/Kolakoski-sequence/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Kosaraju b/Lang/FreeBASIC/Kosaraju new file mode 120000 index 0000000000..b8d8396338 --- /dev/null +++ b/Lang/FreeBASIC/Kosaraju @@ -0,0 +1 @@ +../../Task/Kosaraju/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Kronecker-product-based-fractals b/Lang/FreeBASIC/Kronecker-product-based-fractals new file mode 120000 index 0000000000..438302512f --- /dev/null +++ b/Lang/FreeBASIC/Kronecker-product-based-fractals @@ -0,0 +1 @@ +../../Task/Kronecker-product-based-fractals/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/LU-decomposition b/Lang/FreeBASIC/LU-decomposition new file mode 120000 index 0000000000..a239ac6c87 --- /dev/null +++ b/Lang/FreeBASIC/LU-decomposition @@ -0,0 +1 @@ +../../Task/LU-decomposition/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Last-letter-first-letter b/Lang/FreeBASIC/Last-letter-first-letter new file mode 120000 index 0000000000..436ebfb8b9 --- /dev/null +++ b/Lang/FreeBASIC/Last-letter-first-letter @@ -0,0 +1 @@ +../../Task/Last-letter-first-letter/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Latin-Squares-in-reduced-form b/Lang/FreeBASIC/Latin-Squares-in-reduced-form new file mode 120000 index 0000000000..db9e5d8a88 --- /dev/null +++ b/Lang/FreeBASIC/Latin-Squares-in-reduced-form @@ -0,0 +1 @@ +../../Task/Latin-Squares-in-reduced-form/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Legendre-prime-counting-function b/Lang/FreeBASIC/Legendre-prime-counting-function new file mode 120000 index 0000000000..e68c3452dc --- /dev/null +++ b/Lang/FreeBASIC/Legendre-prime-counting-function @@ -0,0 +1 @@ +../../Task/Legendre-prime-counting-function/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Levenshtein-distance-Alignment b/Lang/FreeBASIC/Levenshtein-distance-Alignment new file mode 120000 index 0000000000..2f78a00d19 --- /dev/null +++ b/Lang/FreeBASIC/Levenshtein-distance-Alignment @@ -0,0 +1 @@ +../../Task/Levenshtein-distance-Alignment/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/List-rooted-trees b/Lang/FreeBASIC/List-rooted-trees new file mode 120000 index 0000000000..d641d1dcf0 --- /dev/null +++ b/Lang/FreeBASIC/List-rooted-trees @@ -0,0 +1 @@ +../../Task/List-rooted-trees/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Lucky-and-even-lucky-numbers b/Lang/FreeBASIC/Lucky-and-even-lucky-numbers new file mode 120000 index 0000000000..ab68b27195 --- /dev/null +++ b/Lang/FreeBASIC/Lucky-and-even-lucky-numbers @@ -0,0 +1 @@ +../../Task/Lucky-and-even-lucky-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Matrix-chain-multiplication b/Lang/FreeBASIC/Matrix-chain-multiplication new file mode 120000 index 0000000000..6dbf5d2c4b --- /dev/null +++ b/Lang/FreeBASIC/Matrix-chain-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-chain-multiplication/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Mayan-calendar b/Lang/FreeBASIC/Mayan-calendar new file mode 120000 index 0000000000..4de11e93f6 --- /dev/null +++ b/Lang/FreeBASIC/Mayan-calendar @@ -0,0 +1 @@ +../../Task/Mayan-calendar/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Mayan-numerals b/Lang/FreeBASIC/Mayan-numerals new file mode 120000 index 0000000000..a931ce4cd8 --- /dev/null +++ b/Lang/FreeBASIC/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Maze-solving b/Lang/FreeBASIC/Maze-solving new file mode 120000 index 0000000000..2140d087ef --- /dev/null +++ b/Lang/FreeBASIC/Maze-solving @@ -0,0 +1 @@ +../../Task/Maze-solving/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Median-filter b/Lang/FreeBASIC/Median-filter new file mode 120000 index 0000000000..a0d5eec8a2 --- /dev/null +++ b/Lang/FreeBASIC/Median-filter @@ -0,0 +1 @@ +../../Task/Median-filter/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Meissel-Mertens-constant b/Lang/FreeBASIC/Meissel-Mertens-constant deleted file mode 120000 index f9f037c2ea..0000000000 --- a/Lang/FreeBASIC/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Merge-and-aggregate-datasets b/Lang/FreeBASIC/Merge-and-aggregate-datasets new file mode 120000 index 0000000000..03b80c6d4c --- /dev/null +++ b/Lang/FreeBASIC/Merge-and-aggregate-datasets @@ -0,0 +1 @@ +../../Task/Merge-and-aggregate-datasets/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Metallic-ratios b/Lang/FreeBASIC/Metallic-ratios new file mode 120000 index 0000000000..46551c0b17 --- /dev/null +++ b/Lang/FreeBASIC/Metallic-ratios @@ -0,0 +1 @@ +../../Task/Metallic-ratios/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Miller-Rabin-primality-test b/Lang/FreeBASIC/Miller-Rabin-primality-test deleted file mode 120000 index 31ca057e36..0000000000 --- a/Lang/FreeBASIC/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Mind-boggling-card-trick b/Lang/FreeBASIC/Mind-boggling-card-trick new file mode 120000 index 0000000000..53a4464dec --- /dev/null +++ b/Lang/FreeBASIC/Mind-boggling-card-trick @@ -0,0 +1 @@ +../../Task/Mind-boggling-card-trick/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Modular-arithmetic b/Lang/FreeBASIC/Modular-arithmetic new file mode 120000 index 0000000000..deab2b4adc --- /dev/null +++ b/Lang/FreeBASIC/Modular-arithmetic @@ -0,0 +1 @@ +../../Task/Modular-arithmetic/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Monads-Maybe-monad b/Lang/FreeBASIC/Monads-Maybe-monad new file mode 120000 index 0000000000..e115294d6c --- /dev/null +++ b/Lang/FreeBASIC/Monads-Maybe-monad @@ -0,0 +1 @@ +../../Task/Monads-Maybe-monad/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Monads-Writer-monad b/Lang/FreeBASIC/Monads-Writer-monad new file mode 120000 index 0000000000..852e4b010e --- /dev/null +++ b/Lang/FreeBASIC/Monads-Writer-monad @@ -0,0 +1 @@ +../../Task/Monads-Writer-monad/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Multi-base-primes b/Lang/FreeBASIC/Multi-base-primes new file mode 120000 index 0000000000..a5bd10f299 --- /dev/null +++ b/Lang/FreeBASIC/Multi-base-primes @@ -0,0 +1 @@ +../../Task/Multi-base-primes/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Multiplicative-order b/Lang/FreeBASIC/Multiplicative-order new file mode 120000 index 0000000000..1ba98d9611 --- /dev/null +++ b/Lang/FreeBASIC/Multiplicative-order @@ -0,0 +1 @@ +../../Task/Multiplicative-order/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/N-smooth-numbers b/Lang/FreeBASIC/N-smooth-numbers new file mode 120000 index 0000000000..7dad0a8519 --- /dev/null +++ b/Lang/FreeBASIC/N-smooth-numbers @@ -0,0 +1 @@ +../../Task/N-smooth-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Natural-sorting b/Lang/FreeBASIC/Natural-sorting new file mode 120000 index 0000000000..00267c2e93 --- /dev/null +++ b/Lang/FreeBASIC/Natural-sorting @@ -0,0 +1 @@ +../../Task/Natural-sorting/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Nested-templated-data b/Lang/FreeBASIC/Nested-templated-data new file mode 120000 index 0000000000..064256a2d8 --- /dev/null +++ b/Lang/FreeBASIC/Nested-templated-data @@ -0,0 +1 @@ +../../Task/Nested-templated-data/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Next-highest-int-from-digits b/Lang/FreeBASIC/Next-highest-int-from-digits new file mode 120000 index 0000000000..48425d98ba --- /dev/null +++ b/Lang/FreeBASIC/Next-highest-int-from-digits @@ -0,0 +1 @@ +../../Task/Next-highest-int-from-digits/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Non-transitive-dice b/Lang/FreeBASIC/Non-transitive-dice new file mode 120000 index 0000000000..a320f65fd4 --- /dev/null +++ b/Lang/FreeBASIC/Non-transitive-dice @@ -0,0 +1 @@ +../../Task/Non-transitive-dice/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Nonoblock b/Lang/FreeBASIC/Nonoblock new file mode 120000 index 0000000000..18e71abc62 --- /dev/null +++ b/Lang/FreeBASIC/Nonoblock @@ -0,0 +1 @@ +../../Task/Nonoblock/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Numerical-and-alphabetical-suffixes b/Lang/FreeBASIC/Numerical-and-alphabetical-suffixes new file mode 120000 index 0000000000..f6a2f778c0 --- /dev/null +++ b/Lang/FreeBASIC/Numerical-and-alphabetical-suffixes @@ -0,0 +1 @@ +../../Task/Numerical-and-alphabetical-suffixes/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Numerical-integration-Gauss-Legendre-Quadrature b/Lang/FreeBASIC/Numerical-integration-Gauss-Legendre-Quadrature new file mode 120000 index 0000000000..a9e10b3566 --- /dev/null +++ b/Lang/FreeBASIC/Numerical-integration-Gauss-Legendre-Quadrature @@ -0,0 +1 @@ +../../Task/Numerical-integration-Gauss-Legendre-Quadrature/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/OLE-automation b/Lang/FreeBASIC/OLE-automation new file mode 120000 index 0000000000..eb6c2ccae6 --- /dev/null +++ b/Lang/FreeBASIC/OLE-automation @@ -0,0 +1 @@ +../../Task/OLE-automation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Object-serialization b/Lang/FreeBASIC/Object-serialization new file mode 120000 index 0000000000..089a320d88 --- /dev/null +++ b/Lang/FreeBASIC/Object-serialization @@ -0,0 +1 @@ +../../Task/Object-serialization/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Order-disjoint-list-items b/Lang/FreeBASIC/Order-disjoint-list-items new file mode 120000 index 0000000000..d5dc6c71fd --- /dev/null +++ b/Lang/FreeBASIC/Order-disjoint-list-items @@ -0,0 +1 @@ +../../Task/Order-disjoint-list-items/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Ormiston-triples b/Lang/FreeBASIC/Ormiston-triples new file mode 120000 index 0000000000..d11a7380e3 --- /dev/null +++ b/Lang/FreeBASIC/Ormiston-triples @@ -0,0 +1 @@ +../../Task/Ormiston-triples/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/P-value-correction b/Lang/FreeBASIC/P-value-correction new file mode 120000 index 0000000000..a2f7c2e1e2 --- /dev/null +++ b/Lang/FreeBASIC/P-value-correction @@ -0,0 +1 @@ +../../Task/P-value-correction/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Padovan-sequence b/Lang/FreeBASIC/Padovan-sequence new file mode 120000 index 0000000000..efb5ea56df --- /dev/null +++ b/Lang/FreeBASIC/Padovan-sequence @@ -0,0 +1 @@ +../../Task/Padovan-sequence/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Parallel-calculations b/Lang/FreeBASIC/Parallel-calculations new file mode 120000 index 0000000000..84d9dd900f --- /dev/null +++ b/Lang/FreeBASIC/Parallel-calculations @@ -0,0 +1 @@ +../../Task/Parallel-calculations/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Parameterized-SQL-statement b/Lang/FreeBASIC/Parameterized-SQL-statement new file mode 120000 index 0000000000..e247a4ff1b --- /dev/null +++ b/Lang/FreeBASIC/Parameterized-SQL-statement @@ -0,0 +1 @@ +../../Task/Parameterized-SQL-statement/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Parametric-polymorphism b/Lang/FreeBASIC/Parametric-polymorphism new file mode 120000 index 0000000000..db6b315ac2 --- /dev/null +++ b/Lang/FreeBASIC/Parametric-polymorphism @@ -0,0 +1 @@ +../../Task/Parametric-polymorphism/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Parse-an-IP-Address b/Lang/FreeBASIC/Parse-an-IP-Address new file mode 120000 index 0000000000..4b51728d74 --- /dev/null +++ b/Lang/FreeBASIC/Parse-an-IP-Address @@ -0,0 +1 @@ +../../Task/Parse-an-IP-Address/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Parsing-RPN-to-infix-conversion b/Lang/FreeBASIC/Parsing-RPN-to-infix-conversion new file mode 120000 index 0000000000..d524880dde --- /dev/null +++ b/Lang/FreeBASIC/Parsing-RPN-to-infix-conversion @@ -0,0 +1 @@ +../../Task/Parsing-RPN-to-infix-conversion/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Parsing-Shunting-yard-algorithm b/Lang/FreeBASIC/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..c598b75c18 --- /dev/null +++ b/Lang/FreeBASIC/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Partial-function-application b/Lang/FreeBASIC/Partial-function-application new file mode 120000 index 0000000000..518300923c --- /dev/null +++ b/Lang/FreeBASIC/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Particle-fountain b/Lang/FreeBASIC/Particle-fountain new file mode 120000 index 0000000000..e93e8b964f --- /dev/null +++ b/Lang/FreeBASIC/Particle-fountain @@ -0,0 +1 @@ +../../Task/Particle-fountain/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Partition-an-integer-x-into-n-primes b/Lang/FreeBASIC/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..1e3ac14a3f --- /dev/null +++ b/Lang/FreeBASIC/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Peaceful-chess-queen-armies b/Lang/FreeBASIC/Peaceful-chess-queen-armies new file mode 120000 index 0000000000..07243b1664 --- /dev/null +++ b/Lang/FreeBASIC/Peaceful-chess-queen-armies @@ -0,0 +1 @@ +../../Task/Peaceful-chess-queen-armies/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pentagram b/Lang/FreeBASIC/Pentagram new file mode 120000 index 0000000000..60996db876 --- /dev/null +++ b/Lang/FreeBASIC/Pentagram @@ -0,0 +1 @@ +../../Task/Pentagram/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pentomino-tiling b/Lang/FreeBASIC/Pentomino-tiling new file mode 120000 index 0000000000..684a3829b3 --- /dev/null +++ b/Lang/FreeBASIC/Pentomino-tiling @@ -0,0 +1 @@ +../../Task/Pentomino-tiling/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Percentage-difference-between-images b/Lang/FreeBASIC/Percentage-difference-between-images new file mode 120000 index 0000000000..4b5a28d9b2 --- /dev/null +++ b/Lang/FreeBASIC/Percentage-difference-between-images @@ -0,0 +1 @@ +../../Task/Percentage-difference-between-images/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Percolation-Bond-percolation b/Lang/FreeBASIC/Percolation-Bond-percolation new file mode 120000 index 0000000000..15d6381502 --- /dev/null +++ b/Lang/FreeBASIC/Percolation-Bond-percolation @@ -0,0 +1 @@ +../../Task/Percolation-Bond-percolation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Percolation-Mean-cluster-density b/Lang/FreeBASIC/Percolation-Mean-cluster-density new file mode 120000 index 0000000000..6d9dff89ca --- /dev/null +++ b/Lang/FreeBASIC/Percolation-Mean-cluster-density @@ -0,0 +1 @@ +../../Task/Percolation-Mean-cluster-density/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Peripheral-drift-illusion b/Lang/FreeBASIC/Peripheral-drift-illusion new file mode 120000 index 0000000000..8fbf1d3fb4 --- /dev/null +++ b/Lang/FreeBASIC/Peripheral-drift-illusion @@ -0,0 +1 @@ +../../Task/Peripheral-drift-illusion/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pig-the-dice-game-Player b/Lang/FreeBASIC/Pig-the-dice-game-Player new file mode 120000 index 0000000000..5766e4e5d7 --- /dev/null +++ b/Lang/FreeBASIC/Pig-the-dice-game-Player @@ -0,0 +1 @@ +../../Task/Pig-the-dice-game-Player/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pinstripe-Printer b/Lang/FreeBASIC/Pinstripe-Printer new file mode 120000 index 0000000000..be78fdd396 --- /dev/null +++ b/Lang/FreeBASIC/Pinstripe-Printer @@ -0,0 +1 @@ +../../Task/Pinstripe-Printer/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pisano-period b/Lang/FreeBASIC/Pisano-period new file mode 120000 index 0000000000..33961710c0 --- /dev/null +++ b/Lang/FreeBASIC/Pisano-period @@ -0,0 +1 @@ +../../Task/Pisano-period/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Play-recorded-sounds b/Lang/FreeBASIC/Play-recorded-sounds new file mode 120000 index 0000000000..a80641ee64 --- /dev/null +++ b/Lang/FreeBASIC/Play-recorded-sounds @@ -0,0 +1 @@ +../../Task/Play-recorded-sounds/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Poker-hand-analyser b/Lang/FreeBASIC/Poker-hand-analyser new file mode 120000 index 0000000000..4d5d666f4c --- /dev/null +++ b/Lang/FreeBASIC/Poker-hand-analyser @@ -0,0 +1 @@ +../../Task/Poker-hand-analyser/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Polymorphic-copy b/Lang/FreeBASIC/Polymorphic-copy new file mode 120000 index 0000000000..ceb69fb25f --- /dev/null +++ b/Lang/FreeBASIC/Polymorphic-copy @@ -0,0 +1 @@ +../../Task/Polymorphic-copy/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Polymorphism b/Lang/FreeBASIC/Polymorphism new file mode 120000 index 0000000000..2a6698d949 --- /dev/null +++ b/Lang/FreeBASIC/Polymorphism @@ -0,0 +1 @@ +../../Task/Polymorphism/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pragmatic-directives b/Lang/FreeBASIC/Pragmatic-directives new file mode 120000 index 0000000000..14e40e3a77 --- /dev/null +++ b/Lang/FreeBASIC/Pragmatic-directives @@ -0,0 +1 @@ +../../Task/Pragmatic-directives/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Prime-triangle b/Lang/FreeBASIC/Prime-triangle new file mode 120000 index 0000000000..3cbf1f6908 --- /dev/null +++ b/Lang/FreeBASIC/Prime-triangle @@ -0,0 +1 @@ +../../Task/Prime-triangle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Primes---allocate-descendants-to-their-ancestors b/Lang/FreeBASIC/Primes---allocate-descendants-to-their-ancestors new file mode 120000 index 0000000000..49848d0592 --- /dev/null +++ b/Lang/FreeBASIC/Primes---allocate-descendants-to-their-ancestors @@ -0,0 +1 @@ +../../Task/Primes---allocate-descendants-to-their-ancestors/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a b/Lang/FreeBASIC/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a new file mode 120000 index 0000000000..a870f104af --- /dev/null +++ b/Lang/FreeBASIC/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pseudo-random-numbers-PCG32 b/Lang/FreeBASIC/Pseudo-random-numbers-PCG32 new file mode 120000 index 0000000000..8a007fed91 --- /dev/null +++ b/Lang/FreeBASIC/Pseudo-random-numbers-PCG32 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-PCG32/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pseudo-random-numbers-Splitmix64 b/Lang/FreeBASIC/Pseudo-random-numbers-Splitmix64 new file mode 120000 index 0000000000..233c73713f --- /dev/null +++ b/Lang/FreeBASIC/Pseudo-random-numbers-Splitmix64 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Splitmix64/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Pseudo-random-numbers-Xorshift-star b/Lang/FreeBASIC/Pseudo-random-numbers-Xorshift-star new file mode 120000 index 0000000000..a40446f6c8 --- /dev/null +++ b/Lang/FreeBASIC/Pseudo-random-numbers-Xorshift-star @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Xorshift-star/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/QR-decomposition b/Lang/FreeBASIC/QR-decomposition new file mode 120000 index 0000000000..b4e25e341a --- /dev/null +++ b/Lang/FreeBASIC/QR-decomposition @@ -0,0 +1 @@ +../../Task/QR-decomposition/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Quaternion-type b/Lang/FreeBASIC/Quaternion-type deleted file mode 120000 index f82c3a440e..0000000000 --- a/Lang/FreeBASIC/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Ramanujan-primes-twins b/Lang/FreeBASIC/Ramanujan-primes-twins new file mode 120000 index 0000000000..1ffd055b66 --- /dev/null +++ b/Lang/FreeBASIC/Ramanujan-primes-twins @@ -0,0 +1 @@ +../../Task/Ramanujan-primes-twins/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Random-Latin-squares b/Lang/FreeBASIC/Random-Latin-squares new file mode 120000 index 0000000000..75cab3858f --- /dev/null +++ b/Lang/FreeBASIC/Random-Latin-squares @@ -0,0 +1 @@ +../../Task/Random-Latin-squares/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Random-sentence-from-book b/Lang/FreeBASIC/Random-sentence-from-book new file mode 120000 index 0000000000..9834480618 --- /dev/null +++ b/Lang/FreeBASIC/Random-sentence-from-book @@ -0,0 +1 @@ +../../Task/Random-sentence-from-book/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Record-sound b/Lang/FreeBASIC/Record-sound new file mode 120000 index 0000000000..23e084bbda --- /dev/null +++ b/Lang/FreeBASIC/Record-sound @@ -0,0 +1 @@ +../../Task/Record-sound/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Reflection-List-methods b/Lang/FreeBASIC/Reflection-List-methods new file mode 120000 index 0000000000..c065c312ec --- /dev/null +++ b/Lang/FreeBASIC/Reflection-List-methods @@ -0,0 +1 @@ +../../Task/Reflection-List-methods/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Reflection-List-properties b/Lang/FreeBASIC/Reflection-List-properties new file mode 120000 index 0000000000..0fd1a0e61e --- /dev/null +++ b/Lang/FreeBASIC/Reflection-List-properties @@ -0,0 +1 @@ +../../Task/Reflection-List-properties/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Rendezvous b/Lang/FreeBASIC/Rendezvous new file mode 120000 index 0000000000..1f852cdb53 --- /dev/null +++ b/Lang/FreeBASIC/Rendezvous @@ -0,0 +1 @@ +../../Task/Rendezvous/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Repunit-primes b/Lang/FreeBASIC/Repunit-primes new file mode 120000 index 0000000000..f9270140df --- /dev/null +++ b/Lang/FreeBASIC/Repunit-primes @@ -0,0 +1 @@ +../../Task/Repunit-primes/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Respond-to-an-unknown-method-call b/Lang/FreeBASIC/Respond-to-an-unknown-method-call new file mode 120000 index 0000000000..055d473ed8 --- /dev/null +++ b/Lang/FreeBASIC/Respond-to-an-unknown-method-call @@ -0,0 +1 @@ +../../Task/Respond-to-an-unknown-method-call/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Retrieve-and-search-chat-history b/Lang/FreeBASIC/Retrieve-and-search-chat-history new file mode 120000 index 0000000000..b860609527 --- /dev/null +++ b/Lang/FreeBASIC/Retrieve-and-search-chat-history @@ -0,0 +1 @@ +../../Task/Retrieve-and-search-chat-history/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Rhonda-numbers b/Lang/FreeBASIC/Rhonda-numbers new file mode 120000 index 0000000000..cd2acf4828 --- /dev/null +++ b/Lang/FreeBASIC/Rhonda-numbers @@ -0,0 +1 @@ +../../Task/Rhonda-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Rosetta-Code-Count-examples b/Lang/FreeBASIC/Rosetta-Code-Count-examples new file mode 120000 index 0000000000..c38f53ad75 --- /dev/null +++ b/Lang/FreeBASIC/Rosetta-Code-Count-examples @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Count-examples/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Rosetta-Code-Find-bare-lang-tags b/Lang/FreeBASIC/Rosetta-Code-Find-bare-lang-tags new file mode 120000 index 0000000000..c9a2ddc646 --- /dev/null +++ b/Lang/FreeBASIC/Rosetta-Code-Find-bare-lang-tags @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Find-bare-lang-tags/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Rosetta-Code-Find-unimplemented-tasks b/Lang/FreeBASIC/Rosetta-Code-Find-unimplemented-tasks new file mode 120000 index 0000000000..3f89d2cb42 --- /dev/null +++ b/Lang/FreeBASIC/Rosetta-Code-Find-unimplemented-tasks @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Find-unimplemented-tasks/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Rosetta-Code-Fix-code-tags b/Lang/FreeBASIC/Rosetta-Code-Fix-code-tags new file mode 120000 index 0000000000..53b438e29f --- /dev/null +++ b/Lang/FreeBASIC/Rosetta-Code-Fix-code-tags @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Fix-code-tags/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Rosetta-Code-Rank-languages-by-popularity b/Lang/FreeBASIC/Rosetta-Code-Rank-languages-by-popularity new file mode 120000 index 0000000000..71d538269e --- /dev/null +++ b/Lang/FreeBASIC/Rosetta-Code-Rank-languages-by-popularity @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Rank-languages-by-popularity/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Runtime-evaluation-In-an-environment b/Lang/FreeBASIC/Runtime-evaluation-In-an-environment new file mode 120000 index 0000000000..80c5a69b35 --- /dev/null +++ b/Lang/FreeBASIC/Runtime-evaluation-In-an-environment @@ -0,0 +1 @@ +../../Task/Runtime-evaluation-In-an-environment/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/S-expressions b/Lang/FreeBASIC/S-expressions new file mode 120000 index 0000000000..9a014b780a --- /dev/null +++ b/Lang/FreeBASIC/S-expressions @@ -0,0 +1 @@ +../../Task/S-expressions/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/SOAP b/Lang/FreeBASIC/SOAP new file mode 120000 index 0000000000..927bc2295a --- /dev/null +++ b/Lang/FreeBASIC/SOAP @@ -0,0 +1 @@ +../../Task/SOAP/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/SQL-based-authentication b/Lang/FreeBASIC/SQL-based-authentication new file mode 120000 index 0000000000..19b09b4fc4 --- /dev/null +++ b/Lang/FreeBASIC/SQL-based-authentication @@ -0,0 +1 @@ +../../Task/SQL-based-authentication/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Safe-addition b/Lang/FreeBASIC/Safe-addition new file mode 120000 index 0000000000..06b1afc7fe --- /dev/null +++ b/Lang/FreeBASIC/Safe-addition @@ -0,0 +1 @@ +../../Task/Safe-addition/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Same-fringe b/Lang/FreeBASIC/Same-fringe new file mode 120000 index 0000000000..756cf55a7d --- /dev/null +++ b/Lang/FreeBASIC/Same-fringe @@ -0,0 +1 @@ +../../Task/Same-fringe/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Search-in-paragraphs-text b/Lang/FreeBASIC/Search-in-paragraphs-text new file mode 120000 index 0000000000..bb0ecc2e40 --- /dev/null +++ b/Lang/FreeBASIC/Search-in-paragraphs-text @@ -0,0 +1 @@ +../../Task/Search-in-paragraphs-text/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Send-email b/Lang/FreeBASIC/Send-email new file mode 120000 index 0000000000..c2dd0c55e3 --- /dev/null +++ b/Lang/FreeBASIC/Send-email @@ -0,0 +1 @@ +../../Task/Send-email/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Set-consolidation b/Lang/FreeBASIC/Set-consolidation new file mode 120000 index 0000000000..b77b1fb39a --- /dev/null +++ b/Lang/FreeBASIC/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Set-of-real-numbers b/Lang/FreeBASIC/Set-of-real-numbers new file mode 120000 index 0000000000..e99ebea6ec --- /dev/null +++ b/Lang/FreeBASIC/Set-of-real-numbers @@ -0,0 +1 @@ +../../Task/Set-of-real-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Set-puzzle b/Lang/FreeBASIC/Set-puzzle new file mode 120000 index 0000000000..bdebb4443c --- /dev/null +++ b/Lang/FreeBASIC/Set-puzzle @@ -0,0 +1 @@ +../../Task/Set-puzzle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Set-right-adjacent-bits b/Lang/FreeBASIC/Set-right-adjacent-bits new file mode 120000 index 0000000000..587392b67a --- /dev/null +++ b/Lang/FreeBASIC/Set-right-adjacent-bits @@ -0,0 +1 @@ +../../Task/Set-right-adjacent-bits/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Shortest-common-supersequence b/Lang/FreeBASIC/Shortest-common-supersequence new file mode 120000 index 0000000000..fec5965970 --- /dev/null +++ b/Lang/FreeBASIC/Shortest-common-supersequence @@ -0,0 +1 @@ +../../Task/Shortest-common-supersequence/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sierpinski-square-curve b/Lang/FreeBASIC/Sierpinski-square-curve new file mode 120000 index 0000000000..a33771c304 --- /dev/null +++ b/Lang/FreeBASIC/Sierpinski-square-curve @@ -0,0 +1 @@ +../../Task/Sierpinski-square-curve/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Simple-database b/Lang/FreeBASIC/Simple-database new file mode 120000 index 0000000000..8d38b56c2d --- /dev/null +++ b/Lang/FreeBASIC/Simple-database @@ -0,0 +1 @@ +../../Task/Simple-database/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Simulate-input-Keyboard b/Lang/FreeBASIC/Simulate-input-Keyboard new file mode 120000 index 0000000000..504f3b18d3 --- /dev/null +++ b/Lang/FreeBASIC/Simulate-input-Keyboard @@ -0,0 +1 @@ +../../Task/Simulate-input-Keyboard/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Singular-value-decomposition b/Lang/FreeBASIC/Singular-value-decomposition new file mode 120000 index 0000000000..efbf29e97a --- /dev/null +++ b/Lang/FreeBASIC/Singular-value-decomposition @@ -0,0 +1 @@ +../../Task/Singular-value-decomposition/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sisyphus-sequence b/Lang/FreeBASIC/Sisyphus-sequence new file mode 120000 index 0000000000..10074b9571 --- /dev/null +++ b/Lang/FreeBASIC/Sisyphus-sequence @@ -0,0 +1 @@ +../../Task/Sisyphus-sequence/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k b/Lang/FreeBASIC/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k new file mode 120000 index 0000000000..eec380a1c3 --- /dev/null +++ b/Lang/FreeBASIC/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k @@ -0,0 +1 @@ +../../Task/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sockets b/Lang/FreeBASIC/Sockets new file mode 120000 index 0000000000..21fddf883f --- /dev/null +++ b/Lang/FreeBASIC/Sockets @@ -0,0 +1 @@ +../../Task/Sockets/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sokoban b/Lang/FreeBASIC/Sokoban new file mode 120000 index 0000000000..4305dae36d --- /dev/null +++ b/Lang/FreeBASIC/Sokoban @@ -0,0 +1 @@ +../../Task/Sokoban/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Solve-a-Hidato-puzzle b/Lang/FreeBASIC/Solve-a-Hidato-puzzle new file mode 120000 index 0000000000..ad49dd7d72 --- /dev/null +++ b/Lang/FreeBASIC/Solve-a-Hidato-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hidato-puzzle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Solve-a-Holy-Knights-tour b/Lang/FreeBASIC/Solve-a-Holy-Knights-tour new file mode 120000 index 0000000000..f7260b5f2d --- /dev/null +++ b/Lang/FreeBASIC/Solve-a-Holy-Knights-tour @@ -0,0 +1 @@ +../../Task/Solve-a-Holy-Knights-tour/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Solve-a-Hopido-puzzle b/Lang/FreeBASIC/Solve-a-Hopido-puzzle new file mode 120000 index 0000000000..3af9403ab8 --- /dev/null +++ b/Lang/FreeBASIC/Solve-a-Hopido-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hopido-puzzle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Solve-a-Numbrix-puzzle b/Lang/FreeBASIC/Solve-a-Numbrix-puzzle new file mode 120000 index 0000000000..9212eac2bb --- /dev/null +++ b/Lang/FreeBASIC/Solve-a-Numbrix-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Numbrix-puzzle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Solve-the-no-connection-puzzle b/Lang/FreeBASIC/Solve-the-no-connection-puzzle new file mode 120000 index 0000000000..b14a0d6097 --- /dev/null +++ b/Lang/FreeBASIC/Solve-the-no-connection-puzzle @@ -0,0 +1 @@ +../../Task/Solve-the-no-connection-puzzle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sort-a-list-of-object-identifiers b/Lang/FreeBASIC/Sort-a-list-of-object-identifiers new file mode 120000 index 0000000000..2c5a5fbb3b --- /dev/null +++ b/Lang/FreeBASIC/Sort-a-list-of-object-identifiers @@ -0,0 +1 @@ +../../Task/Sort-a-list-of-object-identifiers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sort-an-outline-at-every-level b/Lang/FreeBASIC/Sort-an-outline-at-every-level new file mode 120000 index 0000000000..ae4c555049 --- /dev/null +++ b/Lang/FreeBASIC/Sort-an-outline-at-every-level @@ -0,0 +1 @@ +../../Task/Sort-an-outline-at-every-level/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-Algorithms-Circle-Sort b/Lang/FreeBASIC/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index ea5bf17e30..0000000000 --- a/Lang/FreeBASIC/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Patience-sort b/Lang/FreeBASIC/Sorting-algorithms-Patience-sort new file mode 120000 index 0000000000..1fc80c416d --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Patience-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Patience-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Radix-sort b/Lang/FreeBASIC/Sorting-algorithms-Radix-sort new file mode 120000 index 0000000000..bddec7031b --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Radix-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Radix-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sorting-algorithms-Strand-sort b/Lang/FreeBASIC/Sorting-algorithms-Strand-sort new file mode 120000 index 0000000000..5305f3c6f7 --- /dev/null +++ b/Lang/FreeBASIC/Sorting-algorithms-Strand-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Strand-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Spelling-of-ordinal-numbers b/Lang/FreeBASIC/Spelling-of-ordinal-numbers new file mode 120000 index 0000000000..5134b6ba31 --- /dev/null +++ b/Lang/FreeBASIC/Spelling-of-ordinal-numbers @@ -0,0 +1 @@ +../../Task/Spelling-of-ordinal-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sphenic-numbers b/Lang/FreeBASIC/Sphenic-numbers new file mode 120000 index 0000000000..ab7e3a8e2d --- /dev/null +++ b/Lang/FreeBASIC/Sphenic-numbers @@ -0,0 +1 @@ +../../Task/Sphenic-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Stable-marriage-problem b/Lang/FreeBASIC/Stable-marriage-problem new file mode 120000 index 0000000000..e54d2883a7 --- /dev/null +++ b/Lang/FreeBASIC/Stable-marriage-problem @@ -0,0 +1 @@ +../../Task/Stable-marriage-problem/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/State-name-puzzle b/Lang/FreeBASIC/State-name-puzzle new file mode 120000 index 0000000000..31d5af215a --- /dev/null +++ b/Lang/FreeBASIC/State-name-puzzle @@ -0,0 +1 @@ +../../Task/State-name-puzzle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Straddling-checkerboard b/Lang/FreeBASIC/Straddling-checkerboard new file mode 120000 index 0000000000..f58749c61f --- /dev/null +++ b/Lang/FreeBASIC/Straddling-checkerboard @@ -0,0 +1 @@ +../../Task/Straddling-checkerboard/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Strassens-algorithm b/Lang/FreeBASIC/Strassens-algorithm new file mode 120000 index 0000000000..a5c6e9ef78 --- /dev/null +++ b/Lang/FreeBASIC/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Stream-merge b/Lang/FreeBASIC/Stream-merge new file mode 120000 index 0000000000..6ec834582d --- /dev/null +++ b/Lang/FreeBASIC/Stream-merge @@ -0,0 +1 @@ +../../Task/Stream-merge/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Suffixation-of-decimal-numbers b/Lang/FreeBASIC/Suffixation-of-decimal-numbers new file mode 120000 index 0000000000..50be340a02 --- /dev/null +++ b/Lang/FreeBASIC/Suffixation-of-decimal-numbers @@ -0,0 +1 @@ +../../Task/Suffixation-of-decimal-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Sum-and-product-puzzle b/Lang/FreeBASIC/Sum-and-product-puzzle new file mode 120000 index 0000000000..51d37d0fd1 --- /dev/null +++ b/Lang/FreeBASIC/Sum-and-product-puzzle @@ -0,0 +1 @@ +../../Task/Sum-and-product-puzzle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Summarize-and-say-sequence b/Lang/FreeBASIC/Summarize-and-say-sequence new file mode 120000 index 0000000000..c59e649aca --- /dev/null +++ b/Lang/FreeBASIC/Summarize-and-say-sequence @@ -0,0 +1 @@ +../../Task/Summarize-and-say-sequence/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Super-d-numbers b/Lang/FreeBASIC/Super-d-numbers new file mode 120000 index 0000000000..194e6c4f2e --- /dev/null +++ b/Lang/FreeBASIC/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Synchronous-concurrency b/Lang/FreeBASIC/Synchronous-concurrency new file mode 120000 index 0000000000..787a5aebfc --- /dev/null +++ b/Lang/FreeBASIC/Synchronous-concurrency @@ -0,0 +1 @@ +../../Task/Synchronous-concurrency/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Table-creation-Postal-addresses b/Lang/FreeBASIC/Table-creation-Postal-addresses new file mode 120000 index 0000000000..e836fb68b6 --- /dev/null +++ b/Lang/FreeBASIC/Table-creation-Postal-addresses @@ -0,0 +1 @@ +../../Task/Table-creation-Postal-addresses/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Tarjan b/Lang/FreeBASIC/Tarjan new file mode 120000 index 0000000000..2088963b57 --- /dev/null +++ b/Lang/FreeBASIC/Tarjan @@ -0,0 +1 @@ +../../Task/Tarjan/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Teacup-rim-text b/Lang/FreeBASIC/Teacup-rim-text new file mode 120000 index 0000000000..e0ebee7a7f --- /dev/null +++ b/Lang/FreeBASIC/Teacup-rim-text @@ -0,0 +1 @@ +../../Task/Teacup-rim-text/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Text-processing-1 b/Lang/FreeBASIC/Text-processing-1 new file mode 120000 index 0000000000..1e52cc9a2a --- /dev/null +++ b/Lang/FreeBASIC/Text-processing-1 @@ -0,0 +1 @@ +../../Task/Text-processing-1/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Text-processing-2 b/Lang/FreeBASIC/Text-processing-2 new file mode 120000 index 0000000000..03a524d892 --- /dev/null +++ b/Lang/FreeBASIC/Text-processing-2 @@ -0,0 +1 @@ +../../Task/Text-processing-2/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Textonyms b/Lang/FreeBASIC/Textonyms new file mode 120000 index 0000000000..1d60439533 --- /dev/null +++ b/Lang/FreeBASIC/Textonyms @@ -0,0 +1 @@ +../../Task/Textonyms/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/The-sieve-of-Sundaram b/Lang/FreeBASIC/The-sieve-of-Sundaram new file mode 120000 index 0000000000..04d6593f09 --- /dev/null +++ b/Lang/FreeBASIC/The-sieve-of-Sundaram @@ -0,0 +1 @@ +../../Task/The-sieve-of-Sundaram/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Thieles-interpolation-formula b/Lang/FreeBASIC/Thieles-interpolation-formula new file mode 120000 index 0000000000..b1e44c6d70 --- /dev/null +++ b/Lang/FreeBASIC/Thieles-interpolation-formula @@ -0,0 +1 @@ +../../Task/Thieles-interpolation-formula/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Topological-sort b/Lang/FreeBASIC/Topological-sort new file mode 120000 index 0000000000..c6cd407c9f --- /dev/null +++ b/Lang/FreeBASIC/Topological-sort @@ -0,0 +1 @@ +../../Task/Topological-sort/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Transliterate-English-text-using-the-Greek-alphabet b/Lang/FreeBASIC/Transliterate-English-text-using-the-Greek-alphabet new file mode 120000 index 0000000000..a3142e6912 --- /dev/null +++ b/Lang/FreeBASIC/Transliterate-English-text-using-the-Greek-alphabet @@ -0,0 +1 @@ +../../Task/Transliterate-English-text-using-the-Greek-alphabet/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Tree-datastructures b/Lang/FreeBASIC/Tree-datastructures new file mode 120000 index 0000000000..9ca72e7eb6 --- /dev/null +++ b/Lang/FreeBASIC/Tree-datastructures @@ -0,0 +1 @@ +../../Task/Tree-datastructures/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Truth-table b/Lang/FreeBASIC/Truth-table new file mode 120000 index 0000000000..228be906c6 --- /dev/null +++ b/Lang/FreeBASIC/Truth-table @@ -0,0 +1 @@ +../../Task/Truth-table/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Two-bullet-roulette b/Lang/FreeBASIC/Two-bullet-roulette new file mode 120000 index 0000000000..cb9fa727f7 --- /dev/null +++ b/Lang/FreeBASIC/Two-bullet-roulette @@ -0,0 +1 @@ +../../Task/Two-bullet-roulette/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/UPC b/Lang/FreeBASIC/UPC new file mode 120000 index 0000000000..ddcf027e49 --- /dev/null +++ b/Lang/FreeBASIC/UPC @@ -0,0 +1 @@ +../../Task/UPC/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/URL-parser b/Lang/FreeBASIC/URL-parser new file mode 120000 index 0000000000..870d1a309b --- /dev/null +++ b/Lang/FreeBASIC/URL-parser @@ -0,0 +1 @@ +../../Task/URL-parser/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/UTF-8-encode-and-decode b/Lang/FreeBASIC/UTF-8-encode-and-decode new file mode 120000 index 0000000000..a02719eb26 --- /dev/null +++ b/Lang/FreeBASIC/UTF-8-encode-and-decode @@ -0,0 +1 @@ +../../Task/UTF-8-encode-and-decode/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Ukkonen-s-suffix-tree-construction b/Lang/FreeBASIC/Ukkonen-s-suffix-tree-construction new file mode 120000 index 0000000000..6686d05c91 --- /dev/null +++ b/Lang/FreeBASIC/Ukkonen-s-suffix-tree-construction @@ -0,0 +1 @@ +../../Task/Ukkonen-s-suffix-tree-construction/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Unicode-strings b/Lang/FreeBASIC/Unicode-strings new file mode 120000 index 0000000000..801048529a --- /dev/null +++ b/Lang/FreeBASIC/Unicode-strings @@ -0,0 +1 @@ +../../Task/Unicode-strings/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Universal-Turing-machine b/Lang/FreeBASIC/Universal-Turing-machine new file mode 120000 index 0000000000..a29b2e6201 --- /dev/null +++ b/Lang/FreeBASIC/Universal-Turing-machine @@ -0,0 +1 @@ +../../Task/Universal-Turing-machine/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Untouchable-numbers b/Lang/FreeBASIC/Untouchable-numbers new file mode 120000 index 0000000000..5200830048 --- /dev/null +++ b/Lang/FreeBASIC/Untouchable-numbers @@ -0,0 +1 @@ +../../Task/Untouchable-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Use-another-language-to-call-a-function b/Lang/FreeBASIC/Use-another-language-to-call-a-function new file mode 120000 index 0000000000..5d195ad8f5 --- /dev/null +++ b/Lang/FreeBASIC/Use-another-language-to-call-a-function @@ -0,0 +1 @@ +../../Task/Use-another-language-to-call-a-function/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/User-input-Graphical b/Lang/FreeBASIC/User-input-Graphical new file mode 120000 index 0000000000..8c4f2f8158 --- /dev/null +++ b/Lang/FreeBASIC/User-input-Graphical @@ -0,0 +1 @@ +../../Task/User-input-Graphical/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Variable-length-quantity b/Lang/FreeBASIC/Variable-length-quantity new file mode 120000 index 0000000000..3f81633428 --- /dev/null +++ b/Lang/FreeBASIC/Variable-length-quantity @@ -0,0 +1 @@ +../../Task/Variable-length-quantity/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Verhoeff-algorithm b/Lang/FreeBASIC/Verhoeff-algorithm new file mode 120000 index 0000000000..ee2315c27b --- /dev/null +++ b/Lang/FreeBASIC/Verhoeff-algorithm @@ -0,0 +1 @@ +../../Task/Verhoeff-algorithm/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Verify-distribution-uniformity-Chi-squared-test b/Lang/FreeBASIC/Verify-distribution-uniformity-Chi-squared-test new file mode 120000 index 0000000000..8088ed160e --- /dev/null +++ b/Lang/FreeBASIC/Verify-distribution-uniformity-Chi-squared-test @@ -0,0 +1 @@ +../../Task/Verify-distribution-uniformity-Chi-squared-test/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Vigen-re-cipher-Cryptanalysis b/Lang/FreeBASIC/Vigen-re-cipher-Cryptanalysis new file mode 120000 index 0000000000..a802341d36 --- /dev/null +++ b/Lang/FreeBASIC/Vigen-re-cipher-Cryptanalysis @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher-Cryptanalysis/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Vogels-approximation-method b/Lang/FreeBASIC/Vogels-approximation-method new file mode 120000 index 0000000000..e685ba3d8d --- /dev/null +++ b/Lang/FreeBASIC/Vogels-approximation-method @@ -0,0 +1 @@ +../../Task/Vogels-approximation-method/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/War-card-game b/Lang/FreeBASIC/War-card-game new file mode 120000 index 0000000000..8c49d839ef --- /dev/null +++ b/Lang/FreeBASIC/War-card-game @@ -0,0 +1 @@ +../../Task/War-card-game/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Wasteful-equidigital-and-frugal-numbers b/Lang/FreeBASIC/Wasteful-equidigital-and-frugal-numbers new file mode 120000 index 0000000000..7889ec2570 --- /dev/null +++ b/Lang/FreeBASIC/Wasteful-equidigital-and-frugal-numbers @@ -0,0 +1 @@ +../../Task/Wasteful-equidigital-and-frugal-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Web-scraping b/Lang/FreeBASIC/Web-scraping new file mode 120000 index 0000000000..ef3ee370f4 --- /dev/null +++ b/Lang/FreeBASIC/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Window-creation-X11 b/Lang/FreeBASIC/Window-creation-X11 new file mode 120000 index 0000000000..e7cb057ef1 --- /dev/null +++ b/Lang/FreeBASIC/Window-creation-X11 @@ -0,0 +1 @@ +../../Task/Window-creation-X11/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Window-management b/Lang/FreeBASIC/Window-management new file mode 120000 index 0000000000..f998cbb6ef --- /dev/null +++ b/Lang/FreeBASIC/Window-management @@ -0,0 +1 @@ +../../Task/Window-management/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Word-ladder b/Lang/FreeBASIC/Word-ladder new file mode 120000 index 0000000000..1390108efe --- /dev/null +++ b/Lang/FreeBASIC/Word-ladder @@ -0,0 +1 @@ +../../Task/Word-ladder/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Wordiff b/Lang/FreeBASIC/Wordiff new file mode 120000 index 0000000000..c6658843a3 --- /dev/null +++ b/Lang/FreeBASIC/Wordiff @@ -0,0 +1 @@ +../../Task/Wordiff/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/World-Cup-group-stage b/Lang/FreeBASIC/World-Cup-group-stage new file mode 120000 index 0000000000..10c687e006 --- /dev/null +++ b/Lang/FreeBASIC/World-Cup-group-stage @@ -0,0 +1 @@ +../../Task/World-Cup-group-stage/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Write-to-Windows-event-log b/Lang/FreeBASIC/Write-to-Windows-event-log new file mode 120000 index 0000000000..8993ae4828 --- /dev/null +++ b/Lang/FreeBASIC/Write-to-Windows-event-log @@ -0,0 +1 @@ +../../Task/Write-to-Windows-event-log/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/XML-DOM-serialization b/Lang/FreeBASIC/XML-DOM-serialization new file mode 120000 index 0000000000..7d8b5f5c89 --- /dev/null +++ b/Lang/FreeBASIC/XML-DOM-serialization @@ -0,0 +1 @@ +../../Task/XML-DOM-serialization/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/XML-XPath b/Lang/FreeBASIC/XML-XPath new file mode 120000 index 0000000000..dc3992636f --- /dev/null +++ b/Lang/FreeBASIC/XML-XPath @@ -0,0 +1 @@ +../../Task/XML-XPath/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Yahoo-search-interface b/Lang/FreeBASIC/Yahoo-search-interface new file mode 120000 index 0000000000..f92d06f36d --- /dev/null +++ b/Lang/FreeBASIC/Yahoo-search-interface @@ -0,0 +1 @@ +../../Task/Yahoo-search-interface/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Zebra-puzzle b/Lang/FreeBASIC/Zebra-puzzle new file mode 120000 index 0000000000..aa6204ae2d --- /dev/null +++ b/Lang/FreeBASIC/Zebra-puzzle @@ -0,0 +1 @@ +../../Task/Zebra-puzzle/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Zeckendorf-arithmetic b/Lang/FreeBASIC/Zeckendorf-arithmetic new file mode 120000 index 0000000000..5830437272 --- /dev/null +++ b/Lang/FreeBASIC/Zeckendorf-arithmetic @@ -0,0 +1 @@ +../../Task/Zeckendorf-arithmetic/FreeBASIC \ No newline at end of file diff --git a/Lang/FreeBASIC/Zumkeller-numbers b/Lang/FreeBASIC/Zumkeller-numbers new file mode 120000 index 0000000000..6994043985 --- /dev/null +++ b/Lang/FreeBASIC/Zumkeller-numbers @@ -0,0 +1 @@ +../../Task/Zumkeller-numbers/FreeBASIC \ No newline at end of file diff --git a/Lang/Frink/24-game b/Lang/Frink/24-game new file mode 120000 index 0000000000..843d6f51e2 --- /dev/null +++ b/Lang/Frink/24-game @@ -0,0 +1 @@ +../../Task/24-game/Frink \ No newline at end of file diff --git a/Lang/Frink/Averages-Root-mean-square b/Lang/Frink/Averages-Root-mean-square new file mode 120000 index 0000000000..5ccaff432e --- /dev/null +++ b/Lang/Frink/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Frink \ No newline at end of file diff --git a/Lang/Frink/Blum-integer b/Lang/Frink/Blum-integer new file mode 120000 index 0000000000..51dea63ee5 --- /dev/null +++ b/Lang/Frink/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/Frink \ No newline at end of file diff --git a/Lang/Frink/Combinations b/Lang/Frink/Combinations new file mode 120000 index 0000000000..ca07ce8ac3 --- /dev/null +++ b/Lang/Frink/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Frink \ No newline at end of file diff --git a/Lang/Frink/Convert-decimal-number-to-rational b/Lang/Frink/Convert-decimal-number-to-rational new file mode 120000 index 0000000000..a763219220 --- /dev/null +++ b/Lang/Frink/Convert-decimal-number-to-rational @@ -0,0 +1 @@ +../../Task/Convert-decimal-number-to-rational/Frink \ No newline at end of file diff --git a/Lang/Frink/Disarium-numbers b/Lang/Frink/Disarium-numbers new file mode 120000 index 0000000000..30da6e89d2 --- /dev/null +++ b/Lang/Frink/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/Frink \ No newline at end of file diff --git a/Lang/Frink/Draw-a-pixel b/Lang/Frink/Draw-a-pixel new file mode 120000 index 0000000000..5386126125 --- /dev/null +++ b/Lang/Frink/Draw-a-pixel @@ -0,0 +1 @@ +../../Task/Draw-a-pixel/Frink \ No newline at end of file diff --git a/Lang/Frink/Entropy b/Lang/Frink/Entropy new file mode 120000 index 0000000000..686a6c7be3 --- /dev/null +++ b/Lang/Frink/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/Frink \ No newline at end of file diff --git a/Lang/Frink/Factorial-primes b/Lang/Frink/Factorial-primes new file mode 120000 index 0000000000..704a6876ac --- /dev/null +++ b/Lang/Frink/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/Frink \ No newline at end of file diff --git a/Lang/Frink/Find-palindromic-numbers-in-both-binary-and-ternary-bases b/Lang/Frink/Find-palindromic-numbers-in-both-binary-and-ternary-bases new file mode 120000 index 0000000000..8a6a61669b --- /dev/null +++ b/Lang/Frink/Find-palindromic-numbers-in-both-binary-and-ternary-bases @@ -0,0 +1 @@ +../../Task/Find-palindromic-numbers-in-both-binary-and-ternary-bases/Frink \ No newline at end of file diff --git a/Lang/Frink/Floyds-triangle b/Lang/Frink/Floyds-triangle new file mode 120000 index 0000000000..993ee6e3c2 --- /dev/null +++ b/Lang/Frink/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/Frink \ No newline at end of file diff --git a/Lang/Frink/Happy-numbers b/Lang/Frink/Happy-numbers new file mode 120000 index 0000000000..e83b081fcc --- /dev/null +++ b/Lang/Frink/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/Frink \ No newline at end of file diff --git a/Lang/Frink/Introspection b/Lang/Frink/Introspection new file mode 120000 index 0000000000..fa790d4120 --- /dev/null +++ b/Lang/Frink/Introspection @@ -0,0 +1 @@ +../../Task/Introspection/Frink \ No newline at end of file diff --git a/Lang/Frink/Knapsack-problem-0-1 b/Lang/Frink/Knapsack-problem-0-1 new file mode 120000 index 0000000000..ae292bd7e7 --- /dev/null +++ b/Lang/Frink/Knapsack-problem-0-1 @@ -0,0 +1 @@ +../../Task/Knapsack-problem-0-1/Frink \ No newline at end of file diff --git a/Lang/Frink/Knapsack-problem-Bounded b/Lang/Frink/Knapsack-problem-Bounded new file mode 120000 index 0000000000..52649c831e --- /dev/null +++ b/Lang/Frink/Knapsack-problem-Bounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Bounded/Frink \ No newline at end of file diff --git a/Lang/Frink/Order-two-numerical-lists b/Lang/Frink/Order-two-numerical-lists new file mode 120000 index 0000000000..7daa415aeb --- /dev/null +++ b/Lang/Frink/Order-two-numerical-lists @@ -0,0 +1 @@ +../../Task/Order-two-numerical-lists/Frink \ No newline at end of file diff --git a/Lang/Frink/Palindrome-dates b/Lang/Frink/Palindrome-dates new file mode 120000 index 0000000000..9b0bf86617 --- /dev/null +++ b/Lang/Frink/Palindrome-dates @@ -0,0 +1 @@ +../../Task/Palindrome-dates/Frink \ No newline at end of file diff --git a/Lang/Frink/Search-a-list b/Lang/Frink/Search-a-list new file mode 120000 index 0000000000..71db52cc8c --- /dev/null +++ b/Lang/Frink/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Frink \ No newline at end of file diff --git a/Lang/Frink/Smith-numbers b/Lang/Frink/Smith-numbers new file mode 120000 index 0000000000..368b2f0d50 --- /dev/null +++ b/Lang/Frink/Smith-numbers @@ -0,0 +1 @@ +../../Task/Smith-numbers/Frink \ No newline at end of file diff --git a/Lang/Frink/Sort-three-variables b/Lang/Frink/Sort-three-variables new file mode 120000 index 0000000000..1b8dea8212 --- /dev/null +++ b/Lang/Frink/Sort-three-variables @@ -0,0 +1 @@ +../../Task/Sort-three-variables/Frink \ No newline at end of file diff --git a/Lang/Frink/Square-free-integers b/Lang/Frink/Square-free-integers new file mode 120000 index 0000000000..23755894dd --- /dev/null +++ b/Lang/Frink/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/Frink \ No newline at end of file diff --git a/Lang/Frink/String-matching b/Lang/Frink/String-matching new file mode 120000 index 0000000000..f56424a6a3 --- /dev/null +++ b/Lang/Frink/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/Frink \ No newline at end of file diff --git a/Lang/FunL/Miller-Rabin-primality-test b/Lang/FunL/Miller-Rabin-primality-test deleted file mode 120000 index 592d9059fa..0000000000 --- a/Lang/FunL/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/FunL \ No newline at end of file diff --git a/Lang/FuncSug/00-LANG.txt b/Lang/FuncSug/00-LANG.txt new file mode 100644 index 0000000000..9239e3a1ef --- /dev/null +++ b/Lang/FuncSug/00-LANG.txt @@ -0,0 +1 @@ +{{stub}}{{language|FuncSug}} \ No newline at end of file diff --git a/Lang/FuncSug/00-META.yaml b/Lang/FuncSug/00-META.yaml new file mode 100644 index 0000000000..0613d9bea7 --- /dev/null +++ b/Lang/FuncSug/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:FuncSug diff --git a/Lang/FuncSug/15-puzzle-game b/Lang/FuncSug/15-puzzle-game new file mode 120000 index 0000000000..76eb121586 --- /dev/null +++ b/Lang/FuncSug/15-puzzle-game @@ -0,0 +1 @@ +../../Task/15-puzzle-game/FuncSug \ No newline at end of file diff --git a/Lang/FuncSug/GUI-component-interaction b/Lang/FuncSug/GUI-component-interaction new file mode 120000 index 0000000000..744e9aac1b --- /dev/null +++ b/Lang/FuncSug/GUI-component-interaction @@ -0,0 +1 @@ +../../Task/GUI-component-interaction/FuncSug \ No newline at end of file diff --git a/Lang/FuncSug/GUI-enabling-disabling-of-controls b/Lang/FuncSug/GUI-enabling-disabling-of-controls new file mode 120000 index 0000000000..049595483a --- /dev/null +++ b/Lang/FuncSug/GUI-enabling-disabling-of-controls @@ -0,0 +1 @@ +../../Task/GUI-enabling-disabling-of-controls/FuncSug \ No newline at end of file diff --git a/Lang/FuncSug/Hello-world-Text b/Lang/FuncSug/Hello-world-Text new file mode 120000 index 0000000000..f188530df7 --- /dev/null +++ b/Lang/FuncSug/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/FuncSug \ No newline at end of file diff --git a/Lang/FuncSug/Play-recorded-sounds b/Lang/FuncSug/Play-recorded-sounds new file mode 120000 index 0000000000..9418947577 --- /dev/null +++ b/Lang/FuncSug/Play-recorded-sounds @@ -0,0 +1 @@ +../../Task/Play-recorded-sounds/FuncSug \ No newline at end of file diff --git a/Lang/FuncSug/Simple-windowed-application b/Lang/FuncSug/Simple-windowed-application new file mode 120000 index 0000000000..8eec686bff --- /dev/null +++ b/Lang/FuncSug/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/FuncSug \ No newline at end of file diff --git a/Lang/FuncSug/Simulate-input-Mouse b/Lang/FuncSug/Simulate-input-Mouse new file mode 120000 index 0000000000..186d49bf08 --- /dev/null +++ b/Lang/FuncSug/Simulate-input-Mouse @@ -0,0 +1 @@ +../../Task/Simulate-input-Mouse/FuncSug \ No newline at end of file diff --git a/Lang/FuncSug/User-input-Graphical b/Lang/FuncSug/User-input-Graphical new file mode 120000 index 0000000000..b685a2412e --- /dev/null +++ b/Lang/FuncSug/User-input-Graphical @@ -0,0 +1 @@ +../../Task/User-input-Graphical/FuncSug \ No newline at end of file diff --git a/Lang/FurryScript/00-LANG.txt b/Lang/FurryScript/00-LANG.txt new file mode 100644 index 0000000000..7daf60d1ef --- /dev/null +++ b/Lang/FurryScript/00-LANG.txt @@ -0,0 +1,12 @@ +{{stub}}{{language|FurryScript|hopl=no}} +From the [https://esolangs.org/wiki/User:Zzo38/FurryScript esolangs.org article]: + +FurryScript is a domain specific programming language (mostly for random text generation), also usable (but not very well) for other programming (as esolangs often are), with some strange features compared with ordinary programming languages: +* The only arithmetic operation is subtraction. +* Negative numbers cannot be entered directly and can only be achieved by subtraction or type casting. +* Strings may contain subroutine calls, but these calls are probabilistic and delayed. +* There are no scalar variables (actually there is one (the input), but it only stores text strings). +* There are only some kinds of loops, and not most of the common kinds found in other programming languages (although it does have some of them). +* List variables and subroutine variables can be anonymous, even though they are not first-class objects. +* There are no conditional blocks. +* Subroutines may exit "OK", "bad", or "very bad", with different effects depending on circumstances. \ No newline at end of file diff --git a/Lang/FurryScript/00-META.yaml b/Lang/FurryScript/00-META.yaml new file mode 100644 index 0000000000..55abe2220c --- /dev/null +++ b/Lang/FurryScript/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:FurryScript diff --git a/Lang/FurryScript/Array-length b/Lang/FurryScript/Array-length new file mode 120000 index 0000000000..8ad02a1d07 --- /dev/null +++ b/Lang/FurryScript/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/FurryScript \ No newline at end of file diff --git a/Lang/FutureBasic/00-LANG.txt b/Lang/FutureBasic/00-LANG.txt index d3dbdba2ec..36f5f0b065 100644 --- a/Lang/FutureBasic/00-LANG.txt +++ b/Lang/FutureBasic/00-LANG.txt @@ -12,7 +12,11 @@ [[File:FutureBasicIcon.png|64px|top]] -FutureBasic began life as Zbasic, a commercial variant of [[BASIC]] for the early Macintoshes, but has grown far beyond that into a mature freeware IDE that, through its FBtoC translator, can be used to compile C and Objective-C [[object-oriented]] code using the clang compiler included with an Xcode installation. It is excellent as a educational tool and for fast prototyping -- especially in Objective-C (Cocoa) by those who prefer programmatic code without the overhead of Xcode. Among its enthusiasts are commercial developers, engineers, professors, doctors, musicians, writers and a host of amateurs who program with FB for the sheer joy of it. +FutureBasic — commonly called FB by its users — is a robust freeware Macintosh IDE. + +It began life as Zbasic, a commercial variant of [[BASIC]] for the early Macintoshes, but has grown far beyond that into a mature IDE compatible with the latest macOSes. Through its FBtoC translator, it can be used to compile C and Objective-C [[object-oriented]] code. It uses the industry-standard clang compiler included with an Xcode installation. + +FB is excellent as a educational tool, for fast prototyping and for commercial application development. In addition to its native language, it can incorporate C and Objective-C (Cocoa) for those who prefer programmatic code without the overhead of Xcode. It is compatible with Xcode nib and xib files used for building GUIs. Among its enthusiasts are commercial developers, engineers, professors, doctors, musicians, writers and a host of amateurs who program with FB for the sheer joy of it. == FutureBasic Home Page & Download == @@ -64,11 +68,11 @@ In 1995 Staz Software, led by Chris Stasny based in Diamondhead, Miss., acquired When Apple transitioned the Mac from 68k to PowerPC, the FB editor was rewritten by Stasny and was coupled with an adaptation of the compiler by Andy Gariepy. The result of their efforts, a dramatically enhanced IDE called FB^3 (FB-cubed) was released in September 1999. -Major update releases introduced a full-featured Appearance Compliant runtime written by the late New Zealander Robert Purves renown for his brilliant programming. Once completely carbonized to run natively on the Mac OS X, the FutureBASIC Integrated Development Environment (FB IDE) was called FB4 and released in July 2004. +Major update releases introduced a full-featured Appearance Compliant runtime written by the late New Zealander Robert Purves renowned for his brilliant programming. Once completely carbonized to run natively on the Mac OS X, the FutureBASIC Integrated Development Environment (FB IDE) was called FB4 and released in July 2004. In August 2005, Staz Software was devastated by Hurricane Katrina just at the time Apple was transitioning from Motorola PPC microprocessors to Intel chips. FB development slowed almost to a standstill. On January 1, 2008, Staz Software announced that FB would henceforth be freeware and FB4 with FBtoC 1.0 was made available. -Since that time, an independent team of volunteer developers initially lead by Purves continued to improve FBtoC, which took code produced by the FB Editor and translated it to C for processing by gcc which was eventually transitioned to the more robust clang. +Since that time, an independent team of volunteer developers initially led by Purves continued to improve FBtoC, which took code produced by the FB Editor and translated it to C for processing by gcc which was eventually transitioned to the more robust clang. On Sunday, June 3, 2012, members of the FB List Serve were notified that Robert Purves had died after a long bout with cancer. The news came as a surprise to many FB developers who were unaware of Purves' illness. While coping with cancer, he continued as an active member of the FB community, improving FB, answering questions, solving problems, and posting exquisitely terse code often salted with pithy remarks from his wonderfully dry humor. He never mentioned his health problems and never complained. A tribute to Purves can be found at the bottom of the FB Home Page diff --git a/Lang/FutureBasic/15-puzzle-game b/Lang/FutureBasic/15-puzzle-game new file mode 120000 index 0000000000..1625f252f5 --- /dev/null +++ b/Lang/FutureBasic/15-puzzle-game @@ -0,0 +1 @@ +../../Task/15-puzzle-game/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/15-puzzle-solver b/Lang/FutureBasic/15-puzzle-solver new file mode 120000 index 0000000000..db2f936a7e --- /dev/null +++ b/Lang/FutureBasic/15-puzzle-solver @@ -0,0 +1 @@ +../../Task/15-puzzle-solver/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/2048 b/Lang/FutureBasic/2048 new file mode 120000 index 0000000000..439bdc83e8 --- /dev/null +++ b/Lang/FutureBasic/2048 @@ -0,0 +1 @@ +../../Task/2048/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/24-game b/Lang/FutureBasic/24-game new file mode 120000 index 0000000000..f1ea3d0684 --- /dev/null +++ b/Lang/FutureBasic/24-game @@ -0,0 +1 @@ +../../Task/24-game/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/9-billion-names-of-God-the-integer b/Lang/FutureBasic/9-billion-names-of-God-the-integer new file mode 120000 index 0000000000..2c2322b6ea --- /dev/null +++ b/Lang/FutureBasic/9-billion-names-of-God-the-integer @@ -0,0 +1 @@ +../../Task/9-billion-names-of-God-the-integer/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/ADFGVX-cipher b/Lang/FutureBasic/ADFGVX-cipher new file mode 120000 index 0000000000..e5f0c8a31e --- /dev/null +++ b/Lang/FutureBasic/ADFGVX-cipher @@ -0,0 +1 @@ +../../Task/ADFGVX-cipher/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/AKS-test-for-primes b/Lang/FutureBasic/AKS-test-for-primes new file mode 120000 index 0000000000..d7fcaa6502 --- /dev/null +++ b/Lang/FutureBasic/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/ASCII-art-diagram-converter b/Lang/FutureBasic/ASCII-art-diagram-converter new file mode 120000 index 0000000000..cb5711ff54 --- /dev/null +++ b/Lang/FutureBasic/ASCII-art-diagram-converter @@ -0,0 +1 @@ +../../Task/ASCII-art-diagram-converter/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Achilles-numbers b/Lang/FutureBasic/Achilles-numbers new file mode 120000 index 0000000000..a912859c01 --- /dev/null +++ b/Lang/FutureBasic/Achilles-numbers @@ -0,0 +1 @@ +../../Task/Achilles-numbers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Aliquot-sequence-classifications b/Lang/FutureBasic/Aliquot-sequence-classifications new file mode 120000 index 0000000000..d24c82afdc --- /dev/null +++ b/Lang/FutureBasic/Aliquot-sequence-classifications @@ -0,0 +1 @@ +../../Task/Aliquot-sequence-classifications/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Almkvist-Giullera-formula-for-pi b/Lang/FutureBasic/Almkvist-Giullera-formula-for-pi new file mode 120000 index 0000000000..0079b2eae5 --- /dev/null +++ b/Lang/FutureBasic/Almkvist-Giullera-formula-for-pi @@ -0,0 +1 @@ +../../Task/Almkvist-Giullera-formula-for-pi/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Amb b/Lang/FutureBasic/Amb new file mode 120000 index 0000000000..399b8a70d5 --- /dev/null +++ b/Lang/FutureBasic/Amb @@ -0,0 +1 @@ +../../Task/Amb/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Angles-geometric-normalization-and-conversion b/Lang/FutureBasic/Angles-geometric-normalization-and-conversion new file mode 120000 index 0000000000..63c4e835a4 --- /dev/null +++ b/Lang/FutureBasic/Angles-geometric-normalization-and-conversion @@ -0,0 +1 @@ +../../Task/Angles-geometric-normalization-and-conversion/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Anonymous-recursion b/Lang/FutureBasic/Anonymous-recursion new file mode 120000 index 0000000000..d52f4bbda0 --- /dev/null +++ b/Lang/FutureBasic/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Arbitrary-precision-integers-included- b/Lang/FutureBasic/Arbitrary-precision-integers-included- new file mode 120000 index 0000000000..ca9deb04e2 --- /dev/null +++ b/Lang/FutureBasic/Arbitrary-precision-integers-included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers-included-/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Arithmetic-Complex b/Lang/FutureBasic/Arithmetic-Complex new file mode 120000 index 0000000000..eab72eafe1 --- /dev/null +++ b/Lang/FutureBasic/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Arithmetic-Rational b/Lang/FutureBasic/Arithmetic-Rational new file mode 120000 index 0000000000..4ba3750b0f --- /dev/null +++ b/Lang/FutureBasic/Arithmetic-Rational @@ -0,0 +1 @@ +../../Task/Arithmetic-Rational/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Arithmetic-derivative b/Lang/FutureBasic/Arithmetic-derivative new file mode 120000 index 0000000000..4b54c16b3d --- /dev/null +++ b/Lang/FutureBasic/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Arithmetic-geometric-mean b/Lang/FutureBasic/Arithmetic-geometric-mean new file mode 120000 index 0000000000..2894f4733f --- /dev/null +++ b/Lang/FutureBasic/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Assertions b/Lang/FutureBasic/Assertions new file mode 120000 index 0000000000..6270ababb4 --- /dev/null +++ b/Lang/FutureBasic/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Averages-Mean-angle b/Lang/FutureBasic/Averages-Mean-angle new file mode 120000 index 0000000000..45c7d861f6 --- /dev/null +++ b/Lang/FutureBasic/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Averages-Mean-time-of-day b/Lang/FutureBasic/Averages-Mean-time-of-day new file mode 120000 index 0000000000..0caef5a9a0 --- /dev/null +++ b/Lang/FutureBasic/Averages-Mean-time-of-day @@ -0,0 +1 @@ +../../Task/Averages-Mean-time-of-day/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Averages-Pythagorean-means b/Lang/FutureBasic/Averages-Pythagorean-means new file mode 120000 index 0000000000..76e7204f24 --- /dev/null +++ b/Lang/FutureBasic/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Averages-Root-mean-square b/Lang/FutureBasic/Averages-Root-mean-square new file mode 120000 index 0000000000..f04b81a3b0 --- /dev/null +++ b/Lang/FutureBasic/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Barnsley-fern b/Lang/FutureBasic/Barnsley-fern new file mode 120000 index 0000000000..a6da4c722a --- /dev/null +++ b/Lang/FutureBasic/Barnsley-fern @@ -0,0 +1 @@ +../../Task/Barnsley-fern/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Benfords-law b/Lang/FutureBasic/Benfords-law new file mode 120000 index 0000000000..0045818b61 --- /dev/null +++ b/Lang/FutureBasic/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Bernoulli-numbers b/Lang/FutureBasic/Bernoulli-numbers new file mode 120000 index 0000000000..3ed522958e --- /dev/null +++ b/Lang/FutureBasic/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Bifid-cipher b/Lang/FutureBasic/Bifid-cipher new file mode 120000 index 0000000000..e40a4d935a --- /dev/null +++ b/Lang/FutureBasic/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Bin-given-limits b/Lang/FutureBasic/Bin-given-limits new file mode 120000 index 0000000000..6397588001 --- /dev/null +++ b/Lang/FutureBasic/Bin-given-limits @@ -0,0 +1 @@ +../../Task/Bin-given-limits/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Binary-search b/Lang/FutureBasic/Binary-search new file mode 120000 index 0000000000..55e96bcbd8 --- /dev/null +++ b/Lang/FutureBasic/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Bioinformatics-base-count b/Lang/FutureBasic/Bioinformatics-base-count deleted file mode 120000 index 8f826b0063..0000000000 --- a/Lang/FutureBasic/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Biorhythms b/Lang/FutureBasic/Biorhythms new file mode 120000 index 0000000000..db55b5c43b --- /dev/null +++ b/Lang/FutureBasic/Biorhythms @@ -0,0 +1 @@ +../../Task/Biorhythms/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Bitmap b/Lang/FutureBasic/Bitmap new file mode 120000 index 0000000000..5e3f607822 --- /dev/null +++ b/Lang/FutureBasic/Bitmap @@ -0,0 +1 @@ +../../Task/Bitmap/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Bitmap-B-zier-curves-Cubic b/Lang/FutureBasic/Bitmap-B-zier-curves-Cubic new file mode 120000 index 0000000000..743bf83068 --- /dev/null +++ b/Lang/FutureBasic/Bitmap-B-zier-curves-Cubic @@ -0,0 +1 @@ +../../Task/Bitmap-B-zier-curves-Cubic/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Blum-integer b/Lang/FutureBasic/Blum-integer new file mode 120000 index 0000000000..0ccbf69775 --- /dev/null +++ b/Lang/FutureBasic/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Box-the-compass b/Lang/FutureBasic/Box-the-compass new file mode 120000 index 0000000000..7b89a8413c --- /dev/null +++ b/Lang/FutureBasic/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Boyer-Moore-string-search b/Lang/FutureBasic/Boyer-Moore-string-search new file mode 120000 index 0000000000..574c899ddd --- /dev/null +++ b/Lang/FutureBasic/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Brazilian-numbers b/Lang/FutureBasic/Brazilian-numbers new file mode 120000 index 0000000000..ea4e519da9 --- /dev/null +++ b/Lang/FutureBasic/Brazilian-numbers @@ -0,0 +1 @@ +../../Task/Brazilian-numbers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Brilliant-numbers b/Lang/FutureBasic/Brilliant-numbers new file mode 120000 index 0000000000..0ee49e027a --- /dev/null +++ b/Lang/FutureBasic/Brilliant-numbers @@ -0,0 +1 @@ +../../Task/Brilliant-numbers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Brownian-tree b/Lang/FutureBasic/Brownian-tree new file mode 120000 index 0000000000..26e06861c7 --- /dev/null +++ b/Lang/FutureBasic/Brownian-tree @@ -0,0 +1 @@ +../../Task/Brownian-tree/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Bulls-and-cows-Player b/Lang/FutureBasic/Bulls-and-cows-Player new file mode 120000 index 0000000000..294234e3d7 --- /dev/null +++ b/Lang/FutureBasic/Bulls-and-cows-Player @@ -0,0 +1 @@ +../../Task/Bulls-and-cows-Player/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/CRC-32 b/Lang/FutureBasic/CRC-32 new file mode 120000 index 0000000000..8330772d04 --- /dev/null +++ b/Lang/FutureBasic/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Caesar-cipher b/Lang/FutureBasic/Caesar-cipher new file mode 120000 index 0000000000..c0196256fa --- /dev/null +++ b/Lang/FutureBasic/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Call-an-object-method b/Lang/FutureBasic/Call-an-object-method new file mode 120000 index 0000000000..b9d3280ab9 --- /dev/null +++ b/Lang/FutureBasic/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Camel-case-and-snake-case b/Lang/FutureBasic/Camel-case-and-snake-case new file mode 120000 index 0000000000..46ad34e50a --- /dev/null +++ b/Lang/FutureBasic/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Canonicalize-CIDR b/Lang/FutureBasic/Canonicalize-CIDR new file mode 120000 index 0000000000..77fabb43fd --- /dev/null +++ b/Lang/FutureBasic/Canonicalize-CIDR @@ -0,0 +1 @@ +../../Task/Canonicalize-CIDR/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Carmichael-3-strong-pseudoprimes b/Lang/FutureBasic/Carmichael-3-strong-pseudoprimes new file mode 120000 index 0000000000..17664f9781 --- /dev/null +++ b/Lang/FutureBasic/Carmichael-3-strong-pseudoprimes @@ -0,0 +1 @@ +../../Task/Carmichael-3-strong-pseudoprimes/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Catalan-numbers-Pascals-triangle b/Lang/FutureBasic/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..48a5bd3f8b --- /dev/null +++ b/Lang/FutureBasic/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Catamorphism b/Lang/FutureBasic/Catamorphism new file mode 120000 index 0000000000..25e6699616 --- /dev/null +++ b/Lang/FutureBasic/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Check-output-device-is-a-terminal b/Lang/FutureBasic/Check-output-device-is-a-terminal new file mode 120000 index 0000000000..e2e8c9c4eb --- /dev/null +++ b/Lang/FutureBasic/Check-output-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-output-device-is-a-terminal/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Chinese-remainder-theorem b/Lang/FutureBasic/Chinese-remainder-theorem new file mode 120000 index 0000000000..2cdd3a4f64 --- /dev/null +++ b/Lang/FutureBasic/Chinese-remainder-theorem @@ -0,0 +1 @@ +../../Task/Chinese-remainder-theorem/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Chinese-zodiac b/Lang/FutureBasic/Chinese-zodiac new file mode 120000 index 0000000000..df6e098031 --- /dev/null +++ b/Lang/FutureBasic/Chinese-zodiac @@ -0,0 +1 @@ +../../Task/Chinese-zodiac/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Colorful-numbers b/Lang/FutureBasic/Colorful-numbers new file mode 120000 index 0000000000..f9f2dd43bc --- /dev/null +++ b/Lang/FutureBasic/Colorful-numbers @@ -0,0 +1 @@ +../../Task/Colorful-numbers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Combinations b/Lang/FutureBasic/Combinations new file mode 120000 index 0000000000..d7395ea4d1 --- /dev/null +++ b/Lang/FutureBasic/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Command-line-arguments b/Lang/FutureBasic/Command-line-arguments new file mode 120000 index 0000000000..2926af8716 --- /dev/null +++ b/Lang/FutureBasic/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Compile-time-calculation b/Lang/FutureBasic/Compile-time-calculation new file mode 120000 index 0000000000..ef10ff644e --- /dev/null +++ b/Lang/FutureBasic/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k b/Lang/FutureBasic/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k new file mode 120000 index 0000000000..2fbac26654 --- /dev/null +++ b/Lang/FutureBasic/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k @@ -0,0 +1 @@ +../../Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Consecutive-primes-with-ascending-or-descending-differences b/Lang/FutureBasic/Consecutive-primes-with-ascending-or-descending-differences new file mode 120000 index 0000000000..ca47092ad1 --- /dev/null +++ b/Lang/FutureBasic/Consecutive-primes-with-ascending-or-descending-differences @@ -0,0 +1 @@ +../../Task/Consecutive-primes-with-ascending-or-descending-differences/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Constrained-random-points-on-a-circle b/Lang/FutureBasic/Constrained-random-points-on-a-circle new file mode 120000 index 0000000000..db1c784250 --- /dev/null +++ b/Lang/FutureBasic/Constrained-random-points-on-a-circle @@ -0,0 +1 @@ +../../Task/Constrained-random-points-on-a-circle/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Continued-fraction-Arithmetic-Construct-from-rational-number b/Lang/FutureBasic/Continued-fraction-Arithmetic-Construct-from-rational-number new file mode 120000 index 0000000000..fa25a1c542 --- /dev/null +++ b/Lang/FutureBasic/Continued-fraction-Arithmetic-Construct-from-rational-number @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-Construct-from-rational-number/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Conways-Game-of-Life b/Lang/FutureBasic/Conways-Game-of-Life new file mode 120000 index 0000000000..cc723d5af1 --- /dev/null +++ b/Lang/FutureBasic/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Copy-stdin-to-stdout b/Lang/FutureBasic/Copy-stdin-to-stdout new file mode 120000 index 0000000000..9a5df43082 --- /dev/null +++ b/Lang/FutureBasic/Copy-stdin-to-stdout @@ -0,0 +1 @@ +../../Task/Copy-stdin-to-stdout/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Create-an-object-at-a-given-address b/Lang/FutureBasic/Create-an-object-at-a-given-address new file mode 120000 index 0000000000..026e0dd2a5 --- /dev/null +++ b/Lang/FutureBasic/Create-an-object-at-a-given-address @@ -0,0 +1 @@ +../../Task/Create-an-object-at-a-given-address/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Cuban-primes b/Lang/FutureBasic/Cuban-primes new file mode 120000 index 0000000000..3b2980081c --- /dev/null +++ b/Lang/FutureBasic/Cuban-primes @@ -0,0 +1 @@ +../../Task/Cuban-primes/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Cumulative-standard-deviation b/Lang/FutureBasic/Cumulative-standard-deviation new file mode 120000 index 0000000000..e51653c2b1 --- /dev/null +++ b/Lang/FutureBasic/Cumulative-standard-deviation @@ -0,0 +1 @@ +../../Task/Cumulative-standard-deviation/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Curzon-numbers b/Lang/FutureBasic/Curzon-numbers new file mode 120000 index 0000000000..bcd7e577f6 --- /dev/null +++ b/Lang/FutureBasic/Curzon-numbers @@ -0,0 +1 @@ +../../Task/Curzon-numbers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Damm-algorithm b/Lang/FutureBasic/Damm-algorithm new file mode 120000 index 0000000000..1a53ae4466 --- /dev/null +++ b/Lang/FutureBasic/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Deal-cards-for-FreeCell b/Lang/FutureBasic/Deal-cards-for-FreeCell new file mode 120000 index 0000000000..b84bfb771c --- /dev/null +++ b/Lang/FutureBasic/Deal-cards-for-FreeCell @@ -0,0 +1 @@ +../../Task/Deal-cards-for-FreeCell/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Death-Star b/Lang/FutureBasic/Death-Star new file mode 120000 index 0000000000..6a87d38224 --- /dev/null +++ b/Lang/FutureBasic/Death-Star @@ -0,0 +1 @@ +../../Task/Death-Star/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Deceptive-numbers b/Lang/FutureBasic/Deceptive-numbers new file mode 120000 index 0000000000..82f50bcc9e --- /dev/null +++ b/Lang/FutureBasic/Deceptive-numbers @@ -0,0 +1 @@ +../../Task/Deceptive-numbers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Deepcopy b/Lang/FutureBasic/Deepcopy new file mode 120000 index 0000000000..32db2c2b0a --- /dev/null +++ b/Lang/FutureBasic/Deepcopy @@ -0,0 +1 @@ +../../Task/Deepcopy/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Demings-funnel b/Lang/FutureBasic/Demings-funnel new file mode 120000 index 0000000000..a0b916f84d --- /dev/null +++ b/Lang/FutureBasic/Demings-funnel @@ -0,0 +1 @@ +../../Task/Demings-funnel/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Determine-if-a-string-has-all-the-same-characters b/Lang/FutureBasic/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..94f004e3ea --- /dev/null +++ b/Lang/FutureBasic/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Determine-if-a-string-is-squeezable b/Lang/FutureBasic/Determine-if-a-string-is-squeezable new file mode 120000 index 0000000000..3b259327b7 --- /dev/null +++ b/Lang/FutureBasic/Determine-if-a-string-is-squeezable @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-squeezable/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Determine-if-only-one-instance-is-running b/Lang/FutureBasic/Determine-if-only-one-instance-is-running new file mode 120000 index 0000000000..e3fa96a5b5 --- /dev/null +++ b/Lang/FutureBasic/Determine-if-only-one-instance-is-running @@ -0,0 +1 @@ +../../Task/Determine-if-only-one-instance-is-running/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Determine-if-two-triangles-overlap b/Lang/FutureBasic/Determine-if-two-triangles-overlap new file mode 120000 index 0000000000..40f32b74b7 --- /dev/null +++ b/Lang/FutureBasic/Determine-if-two-triangles-overlap @@ -0,0 +1 @@ +../../Task/Determine-if-two-triangles-overlap/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Determine-sentence-type b/Lang/FutureBasic/Determine-sentence-type new file mode 120000 index 0000000000..fce2322962 --- /dev/null +++ b/Lang/FutureBasic/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Digital-root b/Lang/FutureBasic/Digital-root new file mode 120000 index 0000000000..63da54faf1 --- /dev/null +++ b/Lang/FutureBasic/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Dinesmans-multiple-dwelling-problem b/Lang/FutureBasic/Dinesmans-multiple-dwelling-problem new file mode 120000 index 0000000000..cdb0294902 --- /dev/null +++ b/Lang/FutureBasic/Dinesmans-multiple-dwelling-problem @@ -0,0 +1 @@ +../../Task/Dinesmans-multiple-dwelling-problem/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Distribution-of-0-digits-in-factorial-series b/Lang/FutureBasic/Distribution-of-0-digits-in-factorial-series new file mode 120000 index 0000000000..2e525770b5 --- /dev/null +++ b/Lang/FutureBasic/Distribution-of-0-digits-in-factorial-series @@ -0,0 +1 @@ +../../Task/Distribution-of-0-digits-in-factorial-series/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Diversity-prediction-theorem b/Lang/FutureBasic/Diversity-prediction-theorem new file mode 120000 index 0000000000..75ad65e089 --- /dev/null +++ b/Lang/FutureBasic/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Doubly-linked-list-Definition b/Lang/FutureBasic/Doubly-linked-list-Definition new file mode 120000 index 0000000000..dbb3fa0478 --- /dev/null +++ b/Lang/FutureBasic/Doubly-linked-list-Definition @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Definition/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Dutch-national-flag-problem b/Lang/FutureBasic/Dutch-national-flag-problem new file mode 120000 index 0000000000..a769d7e0d9 --- /dev/null +++ b/Lang/FutureBasic/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Eban-numbers b/Lang/FutureBasic/Eban-numbers new file mode 120000 index 0000000000..2ae3f59434 --- /dev/null +++ b/Lang/FutureBasic/Eban-numbers @@ -0,0 +1 @@ +../../Task/Eban-numbers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Echo-server b/Lang/FutureBasic/Echo-server new file mode 120000 index 0000000000..25d59262e7 --- /dev/null +++ b/Lang/FutureBasic/Echo-server @@ -0,0 +1 @@ +../../Task/Echo-server/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Eertree b/Lang/FutureBasic/Eertree new file mode 120000 index 0000000000..f3374493cf --- /dev/null +++ b/Lang/FutureBasic/Eertree @@ -0,0 +1 @@ +../../Task/Eertree/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Egyptian-division b/Lang/FutureBasic/Egyptian-division new file mode 120000 index 0000000000..5961af2842 --- /dev/null +++ b/Lang/FutureBasic/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Entropy b/Lang/FutureBasic/Entropy new file mode 120000 index 0000000000..6336540906 --- /dev/null +++ b/Lang/FutureBasic/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Equilibrium-index b/Lang/FutureBasic/Equilibrium-index new file mode 120000 index 0000000000..92d577887f --- /dev/null +++ b/Lang/FutureBasic/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Euclid-Mullin-sequence b/Lang/FutureBasic/Euclid-Mullin-sequence new file mode 120000 index 0000000000..20745da07c --- /dev/null +++ b/Lang/FutureBasic/Euclid-Mullin-sequence @@ -0,0 +1 @@ +../../Task/Euclid-Mullin-sequence/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Euler-method b/Lang/FutureBasic/Euler-method new file mode 120000 index 0000000000..89a7e85a03 --- /dev/null +++ b/Lang/FutureBasic/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Evaluate-binomial-coefficients b/Lang/FutureBasic/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..59e49028f9 --- /dev/null +++ b/Lang/FutureBasic/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Evolutionary-algorithm b/Lang/FutureBasic/Evolutionary-algorithm new file mode 120000 index 0000000000..6ad9576429 --- /dev/null +++ b/Lang/FutureBasic/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Exceptions b/Lang/FutureBasic/Exceptions new file mode 120000 index 0000000000..0e25a15f85 --- /dev/null +++ b/Lang/FutureBasic/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Exceptions-Catch-an-exception-thrown-in-a-nested-call b/Lang/FutureBasic/Exceptions-Catch-an-exception-thrown-in-a-nested-call new file mode 120000 index 0000000000..fd7f3bd9e7 --- /dev/null +++ b/Lang/FutureBasic/Exceptions-Catch-an-exception-thrown-in-a-nested-call @@ -0,0 +1 @@ +../../Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/FASTA-format b/Lang/FutureBasic/FASTA-format new file mode 120000 index 0000000000..739187f0ef --- /dev/null +++ b/Lang/FutureBasic/FASTA-format @@ -0,0 +1 @@ +../../Task/FASTA-format/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Factors-of-a-Mersenne-number b/Lang/FutureBasic/Factors-of-a-Mersenne-number new file mode 120000 index 0000000000..c65e3bfb3a --- /dev/null +++ b/Lang/FutureBasic/Factors-of-a-Mersenne-number @@ -0,0 +1 @@ +../../Task/Factors-of-a-Mersenne-number/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Fermat-numbers b/Lang/FutureBasic/Fermat-numbers new file mode 120000 index 0000000000..2c5c3120a2 --- /dev/null +++ b/Lang/FutureBasic/Fermat-numbers @@ -0,0 +1 @@ +../../Task/Fermat-numbers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Fibonacci-n-step-number-sequences b/Lang/FutureBasic/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..4131a2e05b --- /dev/null +++ b/Lang/FutureBasic/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Fibonacci-word b/Lang/FutureBasic/Fibonacci-word new file mode 120000 index 0000000000..c773eeed44 --- /dev/null +++ b/Lang/FutureBasic/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Find-limit-of-recursion b/Lang/FutureBasic/Find-limit-of-recursion new file mode 120000 index 0000000000..cbc1e3a568 --- /dev/null +++ b/Lang/FutureBasic/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Find-the-last-Sunday-of-each-month b/Lang/FutureBasic/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..b6d5b12bd1 --- /dev/null +++ b/Lang/FutureBasic/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Find-the-missing-permutation b/Lang/FutureBasic/Find-the-missing-permutation new file mode 120000 index 0000000000..83f97c5dbb --- /dev/null +++ b/Lang/FutureBasic/Find-the-missing-permutation @@ -0,0 +1 @@ +../../Task/Find-the-missing-permutation/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Five-weekends b/Lang/FutureBasic/Five-weekends new file mode 120000 index 0000000000..d11a92b953 --- /dev/null +++ b/Lang/FutureBasic/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Flipping-bits-game b/Lang/FutureBasic/Flipping-bits-game new file mode 120000 index 0000000000..439479c614 --- /dev/null +++ b/Lang/FutureBasic/Flipping-bits-game @@ -0,0 +1 @@ +../../Task/Flipping-bits-game/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Flow-control-structures b/Lang/FutureBasic/Flow-control-structures new file mode 120000 index 0000000000..47305c16bf --- /dev/null +++ b/Lang/FutureBasic/Flow-control-structures @@ -0,0 +1 @@ +../../Task/Flow-control-structures/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Floyds-triangle b/Lang/FutureBasic/Floyds-triangle new file mode 120000 index 0000000000..134b2be232 --- /dev/null +++ b/Lang/FutureBasic/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Forest-fire b/Lang/FutureBasic/Forest-fire new file mode 120000 index 0000000000..5ed21f66e0 --- /dev/null +++ b/Lang/FutureBasic/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Forward-difference b/Lang/FutureBasic/Forward-difference new file mode 120000 index 0000000000..8669b1c1f5 --- /dev/null +++ b/Lang/FutureBasic/Forward-difference @@ -0,0 +1 @@ +../../Task/Forward-difference/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Four-is-magic b/Lang/FutureBasic/Four-is-magic new file mode 120000 index 0000000000..a0162c2baa --- /dev/null +++ b/Lang/FutureBasic/Four-is-magic @@ -0,0 +1 @@ +../../Task/Four-is-magic/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Function-composition b/Lang/FutureBasic/Function-composition new file mode 120000 index 0000000000..363444c694 --- /dev/null +++ b/Lang/FutureBasic/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Function-prototype b/Lang/FutureBasic/Function-prototype new file mode 120000 index 0000000000..00a31e111b --- /dev/null +++ b/Lang/FutureBasic/Function-prototype @@ -0,0 +1 @@ +../../Task/Function-prototype/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Fusc-sequence b/Lang/FutureBasic/Fusc-sequence new file mode 120000 index 0000000000..603bccf327 --- /dev/null +++ b/Lang/FutureBasic/Fusc-sequence @@ -0,0 +1 @@ +../../Task/Fusc-sequence/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Gamma-function b/Lang/FutureBasic/Gamma-function new file mode 120000 index 0000000000..fbf1cf8878 --- /dev/null +++ b/Lang/FutureBasic/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Gaussian-elimination b/Lang/FutureBasic/Gaussian-elimination new file mode 120000 index 0000000000..f8adccdee8 --- /dev/null +++ b/Lang/FutureBasic/Gaussian-elimination @@ -0,0 +1 @@ +../../Task/Gaussian-elimination/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Go-Fish b/Lang/FutureBasic/Go-Fish new file mode 120000 index 0000000000..cc2210d25a --- /dev/null +++ b/Lang/FutureBasic/Go-Fish @@ -0,0 +1 @@ +../../Task/Go-Fish/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Golden-ratio-Convergence b/Lang/FutureBasic/Golden-ratio-Convergence new file mode 120000 index 0000000000..2807889e38 --- /dev/null +++ b/Lang/FutureBasic/Golden-ratio-Convergence @@ -0,0 +1 @@ +../../Task/Golden-ratio-Convergence/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Gray-code b/Lang/FutureBasic/Gray-code new file mode 120000 index 0000000000..5eafcaba04 --- /dev/null +++ b/Lang/FutureBasic/Gray-code @@ -0,0 +1 @@ +../../Task/Gray-code/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Greatest-subsequential-sum b/Lang/FutureBasic/Greatest-subsequential-sum new file mode 120000 index 0000000000..cf9f89b8cf --- /dev/null +++ b/Lang/FutureBasic/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Greedy-algorithm-for-Egyptian-fractions b/Lang/FutureBasic/Greedy-algorithm-for-Egyptian-fractions new file mode 120000 index 0000000000..65dad8fc47 --- /dev/null +++ b/Lang/FutureBasic/Greedy-algorithm-for-Egyptian-fractions @@ -0,0 +1 @@ +../../Task/Greedy-algorithm-for-Egyptian-fractions/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Guess-the-number-With-feedback b/Lang/FutureBasic/Guess-the-number-With-feedback new file mode 120000 index 0000000000..3f619de1b9 --- /dev/null +++ b/Lang/FutureBasic/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Guess-the-number-With-feedback-player- b/Lang/FutureBasic/Guess-the-number-With-feedback-player- new file mode 120000 index 0000000000..0ee5d26b61 --- /dev/null +++ b/Lang/FutureBasic/Guess-the-number-With-feedback-player- @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback-player-/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/HTTPS-Authenticated b/Lang/FutureBasic/HTTPS-Authenticated new file mode 120000 index 0000000000..9edb1d8326 --- /dev/null +++ b/Lang/FutureBasic/HTTPS-Authenticated @@ -0,0 +1 @@ +../../Task/HTTPS-Authenticated/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Halt-and-catch-fire b/Lang/FutureBasic/Halt-and-catch-fire new file mode 120000 index 0000000000..d78c73210e --- /dev/null +++ b/Lang/FutureBasic/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Hamming-numbers b/Lang/FutureBasic/Hamming-numbers new file mode 120000 index 0000000000..69b0f1ea7d --- /dev/null +++ b/Lang/FutureBasic/Hamming-numbers @@ -0,0 +1 @@ +../../Task/Hamming-numbers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Hello-world-Standard-error b/Lang/FutureBasic/Hello-world-Standard-error new file mode 120000 index 0000000000..326ae936a9 --- /dev/null +++ b/Lang/FutureBasic/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Here-document b/Lang/FutureBasic/Here-document new file mode 120000 index 0000000000..44b4edadd8 --- /dev/null +++ b/Lang/FutureBasic/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Hickerson-series-of-almost-integers b/Lang/FutureBasic/Hickerson-series-of-almost-integers new file mode 120000 index 0000000000..22531fa967 --- /dev/null +++ b/Lang/FutureBasic/Hickerson-series-of-almost-integers @@ -0,0 +1 @@ +../../Task/Hickerson-series-of-almost-integers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Hofstadter-Q-sequence b/Lang/FutureBasic/Hofstadter-Q-sequence new file mode 120000 index 0000000000..bb38370ecf --- /dev/null +++ b/Lang/FutureBasic/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Home-primes b/Lang/FutureBasic/Home-primes new file mode 120000 index 0000000000..4744c5ec64 --- /dev/null +++ b/Lang/FutureBasic/Home-primes @@ -0,0 +1 @@ +../../Task/Home-primes/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Honeycombs b/Lang/FutureBasic/Honeycombs new file mode 120000 index 0000000000..306c30d982 --- /dev/null +++ b/Lang/FutureBasic/Honeycombs @@ -0,0 +1 @@ +../../Task/Honeycombs/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Host-introspection b/Lang/FutureBasic/Host-introspection new file mode 120000 index 0000000000..c342a7333a --- /dev/null +++ b/Lang/FutureBasic/Host-introspection @@ -0,0 +1 @@ +../../Task/Host-introspection/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Hunt-the-Wumpus b/Lang/FutureBasic/Hunt-the-Wumpus new file mode 120000 index 0000000000..6ac2d19ea6 --- /dev/null +++ b/Lang/FutureBasic/Hunt-the-Wumpus @@ -0,0 +1 @@ +../../Task/Hunt-the-Wumpus/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/ISBN13-check-digit b/Lang/FutureBasic/ISBN13-check-digit new file mode 120000 index 0000000000..ad5e4cffb4 --- /dev/null +++ b/Lang/FutureBasic/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Integer-overflow b/Lang/FutureBasic/Integer-overflow new file mode 120000 index 0000000000..37f3cd9e93 --- /dev/null +++ b/Lang/FutureBasic/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/JortSort b/Lang/FutureBasic/JortSort new file mode 120000 index 0000000000..a21b94121b --- /dev/null +++ b/Lang/FutureBasic/JortSort @@ -0,0 +1 @@ +../../Task/JortSort/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Josephus-problem b/Lang/FutureBasic/Josephus-problem new file mode 120000 index 0000000000..d84fa33d5d --- /dev/null +++ b/Lang/FutureBasic/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Juggler-sequence b/Lang/FutureBasic/Juggler-sequence new file mode 120000 index 0000000000..f39646025c --- /dev/null +++ b/Lang/FutureBasic/Juggler-sequence @@ -0,0 +1 @@ +../../Task/Juggler-sequence/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Keyboard-input-Flush-the-keyboard-buffer b/Lang/FutureBasic/Keyboard-input-Flush-the-keyboard-buffer new file mode 120000 index 0000000000..958993035a --- /dev/null +++ b/Lang/FutureBasic/Keyboard-input-Flush-the-keyboard-buffer @@ -0,0 +1 @@ +../../Task/Keyboard-input-Flush-the-keyboard-buffer/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Largest-number-divisible-by-its-digits b/Lang/FutureBasic/Largest-number-divisible-by-its-digits new file mode 120000 index 0000000000..3dcba1705b --- /dev/null +++ b/Lang/FutureBasic/Largest-number-divisible-by-its-digits @@ -0,0 +1 @@ +../../Task/Largest-number-divisible-by-its-digits/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Last-Friday-of-each-month b/Lang/FutureBasic/Last-Friday-of-each-month new file mode 120000 index 0000000000..a3476e0672 --- /dev/null +++ b/Lang/FutureBasic/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Last-letter-first-letter b/Lang/FutureBasic/Last-letter-first-letter new file mode 120000 index 0000000000..82ed39c3f0 --- /dev/null +++ b/Lang/FutureBasic/Last-letter-first-letter @@ -0,0 +1 @@ +../../Task/Last-letter-first-letter/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Least-common-multiple b/Lang/FutureBasic/Least-common-multiple new file mode 120000 index 0000000000..23b8dbfe57 --- /dev/null +++ b/Lang/FutureBasic/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Left-factorials b/Lang/FutureBasic/Left-factorials new file mode 120000 index 0000000000..b771fa0031 --- /dev/null +++ b/Lang/FutureBasic/Left-factorials @@ -0,0 +1 @@ +../../Task/Left-factorials/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Long-literals-with-continuations b/Lang/FutureBasic/Long-literals-with-continuations new file mode 120000 index 0000000000..09dff817df --- /dev/null +++ b/Lang/FutureBasic/Long-literals-with-continuations @@ -0,0 +1 @@ +../../Task/Long-literals-with-continuations/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Long-multiplication b/Lang/FutureBasic/Long-multiplication new file mode 120000 index 0000000000..cc3dd93634 --- /dev/null +++ b/Lang/FutureBasic/Long-multiplication @@ -0,0 +1 @@ +../../Task/Long-multiplication/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Long-year b/Lang/FutureBasic/Long-year new file mode 120000 index 0000000000..ae89f1d742 --- /dev/null +++ b/Lang/FutureBasic/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Loops-Increment-loop-index-within-loop-body b/Lang/FutureBasic/Loops-Increment-loop-index-within-loop-body new file mode 120000 index 0000000000..ff81b810cd --- /dev/null +++ b/Lang/FutureBasic/Loops-Increment-loop-index-within-loop-body @@ -0,0 +1 @@ +../../Task/Loops-Increment-loop-index-within-loop-body/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Lucas-Lehmer-test b/Lang/FutureBasic/Lucas-Lehmer-test new file mode 120000 index 0000000000..0d48052ee1 --- /dev/null +++ b/Lang/FutureBasic/Lucas-Lehmer-test @@ -0,0 +1 @@ +../../Task/Lucas-Lehmer-test/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/MAC-vendor-lookup b/Lang/FutureBasic/MAC-vendor-lookup new file mode 120000 index 0000000000..63a0a7c0b7 --- /dev/null +++ b/Lang/FutureBasic/MAC-vendor-lookup @@ -0,0 +1 @@ +../../Task/MAC-vendor-lookup/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Magic-constant b/Lang/FutureBasic/Magic-constant new file mode 120000 index 0000000000..1b88b55f67 --- /dev/null +++ b/Lang/FutureBasic/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Man-or-boy-test b/Lang/FutureBasic/Man-or-boy-test new file mode 120000 index 0000000000..ffaf61719d --- /dev/null +++ b/Lang/FutureBasic/Man-or-boy-test @@ -0,0 +1 @@ +../../Task/Man-or-boy-test/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Mastermind b/Lang/FutureBasic/Mastermind new file mode 120000 index 0000000000..e02911b738 --- /dev/null +++ b/Lang/FutureBasic/Mastermind @@ -0,0 +1 @@ +../../Task/Mastermind/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Matrix-digital-rain b/Lang/FutureBasic/Matrix-digital-rain new file mode 120000 index 0000000000..26c9356719 --- /dev/null +++ b/Lang/FutureBasic/Matrix-digital-rain @@ -0,0 +1 @@ +../../Task/Matrix-digital-rain/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Mayan-calendar b/Lang/FutureBasic/Mayan-calendar new file mode 120000 index 0000000000..7b5f78ca25 --- /dev/null +++ b/Lang/FutureBasic/Mayan-calendar @@ -0,0 +1 @@ +../../Task/Mayan-calendar/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Mayan-numerals b/Lang/FutureBasic/Mayan-numerals new file mode 120000 index 0000000000..cbc6204e00 --- /dev/null +++ b/Lang/FutureBasic/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Minesweeper-game b/Lang/FutureBasic/Minesweeper-game new file mode 120000 index 0000000000..fdc515bbc6 --- /dev/null +++ b/Lang/FutureBasic/Minesweeper-game @@ -0,0 +1 @@ +../../Task/Minesweeper-game/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/FutureBasic/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..088e4f56af --- /dev/null +++ b/Lang/FutureBasic/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Modular-inverse b/Lang/FutureBasic/Modular-inverse new file mode 120000 index 0000000000..89556b3bbe --- /dev/null +++ b/Lang/FutureBasic/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Monte-Carlo-methods b/Lang/FutureBasic/Monte-Carlo-methods new file mode 120000 index 0000000000..729102269f --- /dev/null +++ b/Lang/FutureBasic/Monte-Carlo-methods @@ -0,0 +1 @@ +../../Task/Monte-Carlo-methods/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Monty-Hall-problem b/Lang/FutureBasic/Monty-Hall-problem new file mode 120000 index 0000000000..0d9da7e7cc --- /dev/null +++ b/Lang/FutureBasic/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Multi-dimensional-array b/Lang/FutureBasic/Multi-dimensional-array new file mode 120000 index 0000000000..89411e3bf7 --- /dev/null +++ b/Lang/FutureBasic/Multi-dimensional-array @@ -0,0 +1 @@ +../../Task/Multi-dimensional-array/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Munching-squares b/Lang/FutureBasic/Munching-squares new file mode 120000 index 0000000000..3fb288f688 --- /dev/null +++ b/Lang/FutureBasic/Munching-squares @@ -0,0 +1 @@ +../../Task/Munching-squares/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Mutex b/Lang/FutureBasic/Mutex new file mode 120000 index 0000000000..027130dc63 --- /dev/null +++ b/Lang/FutureBasic/Mutex @@ -0,0 +1 @@ +../../Task/Mutex/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/N-queens-problem b/Lang/FutureBasic/N-queens-problem new file mode 120000 index 0000000000..68d9aebc8f --- /dev/null +++ b/Lang/FutureBasic/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Named-parameters b/Lang/FutureBasic/Named-parameters new file mode 120000 index 0000000000..77a79a818c --- /dev/null +++ b/Lang/FutureBasic/Named-parameters @@ -0,0 +1 @@ +../../Task/Named-parameters/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Nim-game b/Lang/FutureBasic/Nim-game new file mode 120000 index 0000000000..edc10ed0c5 --- /dev/null +++ b/Lang/FutureBasic/Nim-game @@ -0,0 +1 @@ +../../Task/Nim-game/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Nth b/Lang/FutureBasic/Nth new file mode 120000 index 0000000000..10c058fbd2 --- /dev/null +++ b/Lang/FutureBasic/Nth @@ -0,0 +1 @@ +../../Task/Nth/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Own-digits-power-sum b/Lang/FutureBasic/Own-digits-power-sum new file mode 120000 index 0000000000..5cd998b558 --- /dev/null +++ b/Lang/FutureBasic/Own-digits-power-sum @@ -0,0 +1 @@ +../../Task/Own-digits-power-sum/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Palindrome-dates b/Lang/FutureBasic/Palindrome-dates new file mode 120000 index 0000000000..2b72c0230b --- /dev/null +++ b/Lang/FutureBasic/Palindrome-dates @@ -0,0 +1 @@ +../../Task/Palindrome-dates/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Pascals-triangle b/Lang/FutureBasic/Pascals-triangle new file mode 120000 index 0000000000..31e8218285 --- /dev/null +++ b/Lang/FutureBasic/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Pascals-triangle-Puzzle b/Lang/FutureBasic/Pascals-triangle-Puzzle new file mode 120000 index 0000000000..142f796d16 --- /dev/null +++ b/Lang/FutureBasic/Pascals-triangle-Puzzle @@ -0,0 +1 @@ +../../Task/Pascals-triangle-Puzzle/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Pentagram b/Lang/FutureBasic/Pentagram new file mode 120000 index 0000000000..036f2d484a --- /dev/null +++ b/Lang/FutureBasic/Pentagram @@ -0,0 +1 @@ +../../Task/Pentagram/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Perfect-shuffle b/Lang/FutureBasic/Perfect-shuffle new file mode 120000 index 0000000000..6d2e5e3668 --- /dev/null +++ b/Lang/FutureBasic/Perfect-shuffle @@ -0,0 +1 @@ +../../Task/Perfect-shuffle/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Pinstripe-Display b/Lang/FutureBasic/Pinstripe-Display new file mode 120000 index 0000000000..da5d8bc2b0 --- /dev/null +++ b/Lang/FutureBasic/Pinstripe-Display @@ -0,0 +1 @@ +../../Task/Pinstripe-Display/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Playing-cards b/Lang/FutureBasic/Playing-cards new file mode 120000 index 0000000000..965405f346 --- /dev/null +++ b/Lang/FutureBasic/Playing-cards @@ -0,0 +1 @@ +../../Task/Playing-cards/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Poker-hand-analyser b/Lang/FutureBasic/Poker-hand-analyser new file mode 120000 index 0000000000..35dd2acb93 --- /dev/null +++ b/Lang/FutureBasic/Poker-hand-analyser @@ -0,0 +1 @@ +../../Task/Poker-hand-analyser/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Prime-conspiracy b/Lang/FutureBasic/Prime-conspiracy new file mode 120000 index 0000000000..73d0f046b0 --- /dev/null +++ b/Lang/FutureBasic/Prime-conspiracy @@ -0,0 +1 @@ +../../Task/Prime-conspiracy/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Prime-decomposition b/Lang/FutureBasic/Prime-decomposition new file mode 120000 index 0000000000..16553faec7 --- /dev/null +++ b/Lang/FutureBasic/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Pythagorean-triples b/Lang/FutureBasic/Pythagorean-triples new file mode 120000 index 0000000000..f0267047e8 --- /dev/null +++ b/Lang/FutureBasic/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Radical-of-an-integer b/Lang/FutureBasic/Radical-of-an-integer new file mode 120000 index 0000000000..6713bbf881 --- /dev/null +++ b/Lang/FutureBasic/Radical-of-an-integer @@ -0,0 +1 @@ +../../Task/Radical-of-an-integer/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Range-expansion b/Lang/FutureBasic/Range-expansion new file mode 120000 index 0000000000..9b92918178 --- /dev/null +++ b/Lang/FutureBasic/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Range-extraction b/Lang/FutureBasic/Range-extraction new file mode 120000 index 0000000000..9a5f1d0533 --- /dev/null +++ b/Lang/FutureBasic/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Read-a-file-character-by-character-UTF8 b/Lang/FutureBasic/Read-a-file-character-by-character-UTF8 new file mode 120000 index 0000000000..beadc18b56 --- /dev/null +++ b/Lang/FutureBasic/Read-a-file-character-by-character-UTF8 @@ -0,0 +1 @@ +../../Task/Read-a-file-character-by-character-UTF8/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Read-a-file-line-by-line b/Lang/FutureBasic/Read-a-file-line-by-line new file mode 120000 index 0000000000..43ff8334a4 --- /dev/null +++ b/Lang/FutureBasic/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Record-sound b/Lang/FutureBasic/Record-sound new file mode 120000 index 0000000000..7ce89c688d --- /dev/null +++ b/Lang/FutureBasic/Record-sound @@ -0,0 +1 @@ +../../Task/Record-sound/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Regular-expressions b/Lang/FutureBasic/Regular-expressions new file mode 120000 index 0000000000..cd49461444 --- /dev/null +++ b/Lang/FutureBasic/Regular-expressions @@ -0,0 +1 @@ +../../Task/Regular-expressions/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Rep-string b/Lang/FutureBasic/Rep-string new file mode 120000 index 0000000000..99b81bb2f4 --- /dev/null +++ b/Lang/FutureBasic/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Repunit-primes b/Lang/FutureBasic/Repunit-primes new file mode 120000 index 0000000000..366d1fc05e --- /dev/null +++ b/Lang/FutureBasic/Repunit-primes @@ -0,0 +1 @@ +../../Task/Repunit-primes/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Resistor-mesh b/Lang/FutureBasic/Resistor-mesh new file mode 120000 index 0000000000..318a1a0f13 --- /dev/null +++ b/Lang/FutureBasic/Resistor-mesh @@ -0,0 +1 @@ +../../Task/Resistor-mesh/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Run-length-encoding b/Lang/FutureBasic/Run-length-encoding new file mode 120000 index 0000000000..e5f272bd61 --- /dev/null +++ b/Lang/FutureBasic/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/SEDOLs b/Lang/FutureBasic/SEDOLs new file mode 120000 index 0000000000..87a0048d3a --- /dev/null +++ b/Lang/FutureBasic/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/SHA-256 b/Lang/FutureBasic/SHA-256 new file mode 120000 index 0000000000..0d14776e97 --- /dev/null +++ b/Lang/FutureBasic/SHA-256 @@ -0,0 +1 @@ +../../Task/SHA-256/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Search-a-list-of-records b/Lang/FutureBasic/Search-a-list-of-records new file mode 120000 index 0000000000..3fefc25b7b --- /dev/null +++ b/Lang/FutureBasic/Search-a-list-of-records @@ -0,0 +1 @@ +../../Task/Search-a-list-of-records/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Semiprime b/Lang/FutureBasic/Semiprime new file mode 120000 index 0000000000..71cf62e6e6 --- /dev/null +++ b/Lang/FutureBasic/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Semordnilap b/Lang/FutureBasic/Semordnilap new file mode 120000 index 0000000000..23f6715ad0 --- /dev/null +++ b/Lang/FutureBasic/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sequence-of-primorial-primes b/Lang/FutureBasic/Sequence-of-primorial-primes new file mode 120000 index 0000000000..9447c777cb --- /dev/null +++ b/Lang/FutureBasic/Sequence-of-primorial-primes @@ -0,0 +1 @@ +../../Task/Sequence-of-primorial-primes/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sierpinski-arrowhead-curve b/Lang/FutureBasic/Sierpinski-arrowhead-curve new file mode 120000 index 0000000000..d52f730a0b --- /dev/null +++ b/Lang/FutureBasic/Sierpinski-arrowhead-curve @@ -0,0 +1 @@ +../../Task/Sierpinski-arrowhead-curve/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sierpinski-carpet b/Lang/FutureBasic/Sierpinski-carpet new file mode 120000 index 0000000000..c79bb878a8 --- /dev/null +++ b/Lang/FutureBasic/Sierpinski-carpet @@ -0,0 +1 @@ +../../Task/Sierpinski-carpet/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sierpinski-pentagon b/Lang/FutureBasic/Sierpinski-pentagon new file mode 120000 index 0000000000..1e105b6fb4 --- /dev/null +++ b/Lang/FutureBasic/Sierpinski-pentagon @@ -0,0 +1 @@ +../../Task/Sierpinski-pentagon/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sierpinski-square-curve b/Lang/FutureBasic/Sierpinski-square-curve new file mode 120000 index 0000000000..2938f1fa47 --- /dev/null +++ b/Lang/FutureBasic/Sierpinski-square-curve @@ -0,0 +1 @@ +../../Task/Sierpinski-square-curve/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sierpinski-triangle b/Lang/FutureBasic/Sierpinski-triangle new file mode 120000 index 0000000000..300049c10c --- /dev/null +++ b/Lang/FutureBasic/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sleep b/Lang/FutureBasic/Sleep new file mode 120000 index 0000000000..8ce099ff7d --- /dev/null +++ b/Lang/FutureBasic/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k b/Lang/FutureBasic/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k new file mode 120000 index 0000000000..8cc89de701 --- /dev/null +++ b/Lang/FutureBasic/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k @@ -0,0 +1 @@ +../../Task/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Smarandache-Wellin-primes b/Lang/FutureBasic/Smarandache-Wellin-primes new file mode 120000 index 0000000000..7564a9b0b8 --- /dev/null +++ b/Lang/FutureBasic/Smarandache-Wellin-primes @@ -0,0 +1 @@ +../../Task/Smarandache-Wellin-primes/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Smarandache-prime-digital-sequence b/Lang/FutureBasic/Smarandache-prime-digital-sequence new file mode 120000 index 0000000000..879ea05348 --- /dev/null +++ b/Lang/FutureBasic/Smarandache-prime-digital-sequence @@ -0,0 +1 @@ +../../Task/Smarandache-prime-digital-sequence/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sort-an-array-of-composite-structures b/Lang/FutureBasic/Sort-an-array-of-composite-structures new file mode 120000 index 0000000000..ffd97b8a5e --- /dev/null +++ b/Lang/FutureBasic/Sort-an-array-of-composite-structures @@ -0,0 +1 @@ +../../Task/Sort-an-array-of-composite-structures/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sort-disjoint-sublist b/Lang/FutureBasic/Sort-disjoint-sublist new file mode 120000 index 0000000000..030bf0bfd7 --- /dev/null +++ b/Lang/FutureBasic/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sort-numbers-lexicographically b/Lang/FutureBasic/Sort-numbers-lexicographically new file mode 120000 index 0000000000..b8d6f91892 --- /dev/null +++ b/Lang/FutureBasic/Sort-numbers-lexicographically @@ -0,0 +1 @@ +../../Task/Sort-numbers-lexicographically/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sort-three-variables b/Lang/FutureBasic/Sort-three-variables new file mode 120000 index 0000000000..48424426c7 --- /dev/null +++ b/Lang/FutureBasic/Sort-three-variables @@ -0,0 +1 @@ +../../Task/Sort-three-variables/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sorting-algorithms-Insertion-sort b/Lang/FutureBasic/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..d1f91f0286 --- /dev/null +++ b/Lang/FutureBasic/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sorting-algorithms-Sleep-sort b/Lang/FutureBasic/Sorting-algorithms-Sleep-sort new file mode 120000 index 0000000000..b94b39a51d --- /dev/null +++ b/Lang/FutureBasic/Sorting-algorithms-Sleep-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Sleep-sort/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Spinning-rod-animation-Text b/Lang/FutureBasic/Spinning-rod-animation-Text new file mode 120000 index 0000000000..a0c68e7478 --- /dev/null +++ b/Lang/FutureBasic/Spinning-rod-animation-Text @@ -0,0 +1 @@ +../../Task/Spinning-rod-animation-Text/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Spiral-matrix b/Lang/FutureBasic/Spiral-matrix new file mode 120000 index 0000000000..4d24174200 --- /dev/null +++ b/Lang/FutureBasic/Spiral-matrix @@ -0,0 +1 @@ +../../Task/Spiral-matrix/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Square-but-not-cube b/Lang/FutureBasic/Square-but-not-cube new file mode 120000 index 0000000000..a8c6d02eba --- /dev/null +++ b/Lang/FutureBasic/Square-but-not-cube @@ -0,0 +1 @@ +../../Task/Square-but-not-cube/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Square-free-integers b/Lang/FutureBasic/Square-free-integers new file mode 120000 index 0000000000..d3a0459f3e --- /dev/null +++ b/Lang/FutureBasic/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Stack b/Lang/FutureBasic/Stack new file mode 120000 index 0000000000..638a183bbc --- /dev/null +++ b/Lang/FutureBasic/Stack @@ -0,0 +1 @@ +../../Task/Stack/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Stack-traces b/Lang/FutureBasic/Stack-traces new file mode 120000 index 0000000000..589e50b2fa --- /dev/null +++ b/Lang/FutureBasic/Stack-traces @@ -0,0 +1 @@ +../../Task/Stack-traces/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Start-from-a-main-routine b/Lang/FutureBasic/Start-from-a-main-routine new file mode 120000 index 0000000000..c3215fed19 --- /dev/null +++ b/Lang/FutureBasic/Start-from-a-main-routine @@ -0,0 +1 @@ +../../Task/Start-from-a-main-routine/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/String-length b/Lang/FutureBasic/String-length new file mode 120000 index 0000000000..6df040b0bc --- /dev/null +++ b/Lang/FutureBasic/String-length @@ -0,0 +1 @@ +../../Task/String-length/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Strip-block-comments b/Lang/FutureBasic/Strip-block-comments new file mode 120000 index 0000000000..1f0c4fb53d --- /dev/null +++ b/Lang/FutureBasic/Strip-block-comments @@ -0,0 +1 @@ +../../Task/Strip-block-comments/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Strip-control-codes-and-extended-characters-from-a-string b/Lang/FutureBasic/Strip-control-codes-and-extended-characters-from-a-string new file mode 120000 index 0000000000..ae3840dae2 --- /dev/null +++ b/Lang/FutureBasic/Strip-control-codes-and-extended-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-control-codes-and-extended-characters-from-a-string/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sudan-function b/Lang/FutureBasic/Sudan-function new file mode 120000 index 0000000000..1f582a9d0d --- /dev/null +++ b/Lang/FutureBasic/Sudan-function @@ -0,0 +1 @@ +../../Task/Sudan-function/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sum-digits-of-an-integer b/Lang/FutureBasic/Sum-digits-of-an-integer new file mode 120000 index 0000000000..cf8ab32c2c --- /dev/null +++ b/Lang/FutureBasic/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sum-of-a-series b/Lang/FutureBasic/Sum-of-a-series new file mode 120000 index 0000000000..44687bc461 --- /dev/null +++ b/Lang/FutureBasic/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sum-of-squares b/Lang/FutureBasic/Sum-of-squares new file mode 120000 index 0000000000..3bded3f286 --- /dev/null +++ b/Lang/FutureBasic/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sum-to-100 b/Lang/FutureBasic/Sum-to-100 new file mode 120000 index 0000000000..5cdb7cf4a8 --- /dev/null +++ b/Lang/FutureBasic/Sum-to-100 @@ -0,0 +1 @@ +../../Task/Sum-to-100/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Super-d-numbers b/Lang/FutureBasic/Super-d-numbers new file mode 120000 index 0000000000..77af2a994a --- /dev/null +++ b/Lang/FutureBasic/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Sylvesters-sequence b/Lang/FutureBasic/Sylvesters-sequence new file mode 120000 index 0000000000..1e1ae008f1 --- /dev/null +++ b/Lang/FutureBasic/Sylvesters-sequence @@ -0,0 +1 @@ +../../Task/Sylvesters-sequence/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Tau-function b/Lang/FutureBasic/Tau-function new file mode 120000 index 0000000000..4d9cc08c3d --- /dev/null +++ b/Lang/FutureBasic/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Tau-number b/Lang/FutureBasic/Tau-number new file mode 120000 index 0000000000..363cfbc636 --- /dev/null +++ b/Lang/FutureBasic/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Temperature-conversion b/Lang/FutureBasic/Temperature-conversion new file mode 120000 index 0000000000..b60c2baf77 --- /dev/null +++ b/Lang/FutureBasic/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Terminal-control-Clear-the-screen b/Lang/FutureBasic/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..878687a038 --- /dev/null +++ b/Lang/FutureBasic/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Terminal-control-Coloured-text b/Lang/FutureBasic/Terminal-control-Coloured-text new file mode 120000 index 0000000000..6858a62734 --- /dev/null +++ b/Lang/FutureBasic/Terminal-control-Coloured-text @@ -0,0 +1 @@ +../../Task/Terminal-control-Coloured-text/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Terminal-control-Cursor-movement b/Lang/FutureBasic/Terminal-control-Cursor-movement new file mode 120000 index 0000000000..050e1439d6 --- /dev/null +++ b/Lang/FutureBasic/Terminal-control-Cursor-movement @@ -0,0 +1 @@ +../../Task/Terminal-control-Cursor-movement/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Terminal-control-Cursor-positioning b/Lang/FutureBasic/Terminal-control-Cursor-positioning new file mode 120000 index 0000000000..22f710aaf6 --- /dev/null +++ b/Lang/FutureBasic/Terminal-control-Cursor-positioning @@ -0,0 +1 @@ +../../Task/Terminal-control-Cursor-positioning/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Terminal-control-Hiding-the-cursor b/Lang/FutureBasic/Terminal-control-Hiding-the-cursor new file mode 120000 index 0000000000..22bc1dda83 --- /dev/null +++ b/Lang/FutureBasic/Terminal-control-Hiding-the-cursor @@ -0,0 +1 @@ +../../Task/Terminal-control-Hiding-the-cursor/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Terminal-control-Ringing-the-terminal-bell b/Lang/FutureBasic/Terminal-control-Ringing-the-terminal-bell new file mode 120000 index 0000000000..6f8d6c609a --- /dev/null +++ b/Lang/FutureBasic/Terminal-control-Ringing-the-terminal-bell @@ -0,0 +1 @@ +../../Task/Terminal-control-Ringing-the-terminal-bell/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Terminal-control-Unicode-output b/Lang/FutureBasic/Terminal-control-Unicode-output new file mode 120000 index 0000000000..712dfa9fa9 --- /dev/null +++ b/Lang/FutureBasic/Terminal-control-Unicode-output @@ -0,0 +1 @@ +../../Task/Terminal-control-Unicode-output/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/The-Name-Game b/Lang/FutureBasic/The-Name-Game new file mode 120000 index 0000000000..2e6c9ef1a6 --- /dev/null +++ b/Lang/FutureBasic/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/The-sieve-of-Sundaram b/Lang/FutureBasic/The-sieve-of-Sundaram new file mode 120000 index 0000000000..439633bf42 --- /dev/null +++ b/Lang/FutureBasic/The-sieve-of-Sundaram @@ -0,0 +1 @@ +../../Task/The-sieve-of-Sundaram/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Tic-tac-toe b/Lang/FutureBasic/Tic-tac-toe new file mode 120000 index 0000000000..e0c70b24fe --- /dev/null +++ b/Lang/FutureBasic/Tic-tac-toe @@ -0,0 +1 @@ +../../Task/Tic-tac-toe/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Time-a-function b/Lang/FutureBasic/Time-a-function new file mode 120000 index 0000000000..819601365f --- /dev/null +++ b/Lang/FutureBasic/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Transliterate-English-text-using-the-Greek-alphabet b/Lang/FutureBasic/Transliterate-English-text-using-the-Greek-alphabet new file mode 120000 index 0000000000..f300e3db8a --- /dev/null +++ b/Lang/FutureBasic/Transliterate-English-text-using-the-Greek-alphabet @@ -0,0 +1 @@ +../../Task/Transliterate-English-text-using-the-Greek-alphabet/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Truncate-a-file b/Lang/FutureBasic/Truncate-a-file new file mode 120000 index 0000000000..29710d148d --- /dev/null +++ b/Lang/FutureBasic/Truncate-a-file @@ -0,0 +1 @@ +../../Task/Truncate-a-file/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Twin-primes b/Lang/FutureBasic/Twin-primes new file mode 120000 index 0000000000..172e832801 --- /dev/null +++ b/Lang/FutureBasic/Twin-primes @@ -0,0 +1 @@ +../../Task/Twin-primes/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/URL-decoding b/Lang/FutureBasic/URL-decoding new file mode 120000 index 0000000000..001e7a5dfa --- /dev/null +++ b/Lang/FutureBasic/URL-decoding @@ -0,0 +1 @@ +../../Task/URL-decoding/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/URL-parser b/Lang/FutureBasic/URL-parser new file mode 120000 index 0000000000..46cddba12b --- /dev/null +++ b/Lang/FutureBasic/URL-parser @@ -0,0 +1 @@ +../../Task/URL-parser/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Ultra-useful-primes b/Lang/FutureBasic/Ultra-useful-primes new file mode 120000 index 0000000000..eff79aec0f --- /dev/null +++ b/Lang/FutureBasic/Ultra-useful-primes @@ -0,0 +1 @@ +../../Task/Ultra-useful-primes/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Unicode-strings b/Lang/FutureBasic/Unicode-strings new file mode 120000 index 0000000000..dd71b73f3c --- /dev/null +++ b/Lang/FutureBasic/Unicode-strings @@ -0,0 +1 @@ +../../Task/Unicode-strings/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Use-another-language-to-call-a-function b/Lang/FutureBasic/Use-another-language-to-call-a-function new file mode 120000 index 0000000000..704ff5c0c8 --- /dev/null +++ b/Lang/FutureBasic/Use-another-language-to-call-a-function @@ -0,0 +1 @@ +../../Task/Use-another-language-to-call-a-function/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/User-input-Text b/Lang/FutureBasic/User-input-Text new file mode 120000 index 0000000000..3d0e3bd7f1 --- /dev/null +++ b/Lang/FutureBasic/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Validate-International-Securities-Identification-Number b/Lang/FutureBasic/Validate-International-Securities-Identification-Number new file mode 120000 index 0000000000..81f74f067a --- /dev/null +++ b/Lang/FutureBasic/Validate-International-Securities-Identification-Number @@ -0,0 +1 @@ +../../Task/Validate-International-Securities-Identification-Number/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Wagstaff-primes b/Lang/FutureBasic/Wagstaff-primes new file mode 120000 index 0000000000..455c60b96b --- /dev/null +++ b/Lang/FutureBasic/Wagstaff-primes @@ -0,0 +1 @@ +../../Task/Wagstaff-primes/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Wieferich-primes b/Lang/FutureBasic/Wieferich-primes new file mode 120000 index 0000000000..1c38642d13 --- /dev/null +++ b/Lang/FutureBasic/Wieferich-primes @@ -0,0 +1 @@ +../../Task/Wieferich-primes/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Wilson-primes-of-order-n b/Lang/FutureBasic/Wilson-primes-of-order-n new file mode 120000 index 0000000000..027bdd5d80 --- /dev/null +++ b/Lang/FutureBasic/Wilson-primes-of-order-n @@ -0,0 +1 @@ +../../Task/Wilson-primes-of-order-n/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Word-wrap b/Lang/FutureBasic/Word-wrap new file mode 120000 index 0000000000..d1cd565464 --- /dev/null +++ b/Lang/FutureBasic/Word-wrap @@ -0,0 +1 @@ +../../Task/Word-wrap/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/XML-Output b/Lang/FutureBasic/XML-Output new file mode 120000 index 0000000000..7889975674 --- /dev/null +++ b/Lang/FutureBasic/XML-Output @@ -0,0 +1 @@ +../../Task/XML-Output/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Yahoo-search-interface b/Lang/FutureBasic/Yahoo-search-interface new file mode 120000 index 0000000000..9f29c6ac04 --- /dev/null +++ b/Lang/FutureBasic/Yahoo-search-interface @@ -0,0 +1 @@ +../../Task/Yahoo-search-interface/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Yellowstone-sequence b/Lang/FutureBasic/Yellowstone-sequence new file mode 120000 index 0000000000..8a816499f6 --- /dev/null +++ b/Lang/FutureBasic/Yellowstone-sequence @@ -0,0 +1 @@ +../../Task/Yellowstone-sequence/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Zebra-puzzle b/Lang/FutureBasic/Zebra-puzzle new file mode 120000 index 0000000000..68d36dbfcd --- /dev/null +++ b/Lang/FutureBasic/Zebra-puzzle @@ -0,0 +1 @@ +../../Task/Zebra-puzzle/FutureBasic \ No newline at end of file diff --git a/Lang/FutureBasic/Zeckendorf-number-representation b/Lang/FutureBasic/Zeckendorf-number-representation new file mode 120000 index 0000000000..c805683421 --- /dev/null +++ b/Lang/FutureBasic/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/FutureBasic \ No newline at end of file diff --git a/Lang/GAP/Character-codes b/Lang/GAP/Character-codes new file mode 120000 index 0000000000..ff4a3d2754 --- /dev/null +++ b/Lang/GAP/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/GAP \ No newline at end of file diff --git a/Lang/GAP/Quaternion-type b/Lang/GAP/Quaternion-type deleted file mode 120000 index 67ec7fa115..0000000000 --- a/Lang/GAP/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/GAP \ No newline at end of file diff --git a/Lang/GDScript/Null-object b/Lang/GDScript/Null-object new file mode 120000 index 0000000000..e2b2de9b21 --- /dev/null +++ b/Lang/GDScript/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/GDScript \ No newline at end of file diff --git a/Lang/GDScript/Playing-cards b/Lang/GDScript/Playing-cards new file mode 120000 index 0000000000..11180c642f --- /dev/null +++ b/Lang/GDScript/Playing-cards @@ -0,0 +1 @@ +../../Task/Playing-cards/GDScript \ No newline at end of file diff --git a/Lang/GDScript/Sorting-algorithms-Bubble-sort b/Lang/GDScript/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..0c8ecc5b3e --- /dev/null +++ b/Lang/GDScript/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/GDScript \ No newline at end of file diff --git a/Lang/GDScript/Stack b/Lang/GDScript/Stack new file mode 120000 index 0000000000..8e1def2ef0 --- /dev/null +++ b/Lang/GDScript/Stack @@ -0,0 +1 @@ +../../Task/Stack/GDScript \ No newline at end of file diff --git a/Lang/GW-BASIC/Abundant-deficient-and-perfect-number-classifications b/Lang/GW-BASIC/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..4709185f8a --- /dev/null +++ b/Lang/GW-BASIC/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Arithmetic-Integer b/Lang/GW-BASIC/Arithmetic-Integer new file mode 120000 index 0000000000..216b349b7b --- /dev/null +++ b/Lang/GW-BASIC/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Array-concatenation b/Lang/GW-BASIC/Array-concatenation new file mode 120000 index 0000000000..1c42f42efb --- /dev/null +++ b/Lang/GW-BASIC/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Associative-array-Merging b/Lang/GW-BASIC/Associative-array-Merging new file mode 120000 index 0000000000..bd171c9e89 --- /dev/null +++ b/Lang/GW-BASIC/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Box-the-compass b/Lang/GW-BASIC/Box-the-compass new file mode 120000 index 0000000000..29c287bb26 --- /dev/null +++ b/Lang/GW-BASIC/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Case-sensitivity-of-identifiers b/Lang/GW-BASIC/Case-sensitivity-of-identifiers deleted file mode 120000 index 605ddebd53..0000000000 --- a/Lang/GW-BASIC/Case-sensitivity-of-identifiers +++ /dev/null @@ -1 +0,0 @@ -../../Task/Case-sensitivity-of-identifiers/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Chaos-game b/Lang/GW-BASIC/Chaos-game new file mode 120000 index 0000000000..cdf457ef86 --- /dev/null +++ b/Lang/GW-BASIC/Chaos-game @@ -0,0 +1 @@ +../../Task/Chaos-game/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Character-codes b/Lang/GW-BASIC/Character-codes new file mode 120000 index 0000000000..74eb8c93c7 --- /dev/null +++ b/Lang/GW-BASIC/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Colour-pinstripe-Display b/Lang/GW-BASIC/Colour-pinstripe-Display new file mode 120000 index 0000000000..383619acfb --- /dev/null +++ b/Lang/GW-BASIC/Colour-pinstripe-Display @@ -0,0 +1 @@ +../../Task/Colour-pinstripe-Display/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Compare-length-of-two-strings b/Lang/GW-BASIC/Compare-length-of-two-strings new file mode 120000 index 0000000000..4c75ca9227 --- /dev/null +++ b/Lang/GW-BASIC/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Create-a-two-dimensional-array-at-runtime b/Lang/GW-BASIC/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..4d3d98c5af --- /dev/null +++ b/Lang/GW-BASIC/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Damm-algorithm b/Lang/GW-BASIC/Damm-algorithm new file mode 120000 index 0000000000..b0cc19e6df --- /dev/null +++ b/Lang/GW-BASIC/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Determine-if-a-string-is-collapsible b/Lang/GW-BASIC/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..2b997d0c38 --- /dev/null +++ b/Lang/GW-BASIC/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Determine-sentence-type b/Lang/GW-BASIC/Determine-sentence-type new file mode 120000 index 0000000000..0a4310dab2 --- /dev/null +++ b/Lang/GW-BASIC/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Display-a-linear-combination b/Lang/GW-BASIC/Display-a-linear-combination new file mode 120000 index 0000000000..8162367d7b --- /dev/null +++ b/Lang/GW-BASIC/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Dutch-national-flag-problem b/Lang/GW-BASIC/Dutch-national-flag-problem new file mode 120000 index 0000000000..96431612bd --- /dev/null +++ b/Lang/GW-BASIC/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Egyptian-division b/Lang/GW-BASIC/Egyptian-division new file mode 120000 index 0000000000..b65e30d805 --- /dev/null +++ b/Lang/GW-BASIC/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Euler-method b/Lang/GW-BASIC/Euler-method new file mode 120000 index 0000000000..25fe1ab9b5 --- /dev/null +++ b/Lang/GW-BASIC/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Gray-code b/Lang/GW-BASIC/Gray-code new file mode 120000 index 0000000000..a45f2031ed --- /dev/null +++ b/Lang/GW-BASIC/Gray-code @@ -0,0 +1 @@ +../../Task/Gray-code/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Guess-the-number-With-feedback b/Lang/GW-BASIC/Guess-the-number-With-feedback new file mode 120000 index 0000000000..aeb3d5363c --- /dev/null +++ b/Lang/GW-BASIC/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Jensens-Device b/Lang/GW-BASIC/Jensens-Device new file mode 120000 index 0000000000..0236b00319 --- /dev/null +++ b/Lang/GW-BASIC/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Knuth-shuffle b/Lang/GW-BASIC/Knuth-shuffle new file mode 120000 index 0000000000..25475ed80d --- /dev/null +++ b/Lang/GW-BASIC/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Langtons-ant b/Lang/GW-BASIC/Langtons-ant new file mode 120000 index 0000000000..4d565760ef --- /dev/null +++ b/Lang/GW-BASIC/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Leonardo-numbers b/Lang/GW-BASIC/Leonardo-numbers new file mode 120000 index 0000000000..f7945f7063 --- /dev/null +++ b/Lang/GW-BASIC/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Levenshtein-distance b/Lang/GW-BASIC/Levenshtein-distance new file mode 120000 index 0000000000..4605e15436 --- /dev/null +++ b/Lang/GW-BASIC/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Logical-operations b/Lang/GW-BASIC/Logical-operations new file mode 120000 index 0000000000..85f84839dc --- /dev/null +++ b/Lang/GW-BASIC/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Longest-string-challenge b/Lang/GW-BASIC/Longest-string-challenge new file mode 120000 index 0000000000..4b804410d2 --- /dev/null +++ b/Lang/GW-BASIC/Longest-string-challenge @@ -0,0 +1 @@ +../../Task/Longest-string-challenge/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Luhn-test-of-credit-card-numbers b/Lang/GW-BASIC/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..3e46368b55 --- /dev/null +++ b/Lang/GW-BASIC/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Magic-constant b/Lang/GW-BASIC/Magic-constant new file mode 120000 index 0000000000..4dbe3ee401 --- /dev/null +++ b/Lang/GW-BASIC/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Magic-squares-of-odd-order b/Lang/GW-BASIC/Magic-squares-of-odd-order new file mode 120000 index 0000000000..7fa7f84f6e --- /dev/null +++ b/Lang/GW-BASIC/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Magnanimous-numbers b/Lang/GW-BASIC/Magnanimous-numbers new file mode 120000 index 0000000000..ab077acdfb --- /dev/null +++ b/Lang/GW-BASIC/Magnanimous-numbers @@ -0,0 +1 @@ +../../Task/Magnanimous-numbers/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Map-range b/Lang/GW-BASIC/Map-range new file mode 120000 index 0000000000..487538bdd0 --- /dev/null +++ b/Lang/GW-BASIC/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Mayan-numerals b/Lang/GW-BASIC/Mayan-numerals new file mode 120000 index 0000000000..5c6a4bdb6a --- /dev/null +++ b/Lang/GW-BASIC/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Nested-templated-data b/Lang/GW-BASIC/Nested-templated-data new file mode 120000 index 0000000000..bb39849801 --- /dev/null +++ b/Lang/GW-BASIC/Nested-templated-data @@ -0,0 +1 @@ +../../Task/Nested-templated-data/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Nth-root b/Lang/GW-BASIC/Nth-root new file mode 120000 index 0000000000..44da5f255f --- /dev/null +++ b/Lang/GW-BASIC/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Old-Russian-measure-of-length b/Lang/GW-BASIC/Old-Russian-measure-of-length new file mode 120000 index 0000000000..6121a6a7b1 --- /dev/null +++ b/Lang/GW-BASIC/Old-Russian-measure-of-length @@ -0,0 +1 @@ +../../Task/Old-Russian-measure-of-length/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Phrase-reversals b/Lang/GW-BASIC/Phrase-reversals new file mode 120000 index 0000000000..f735fa85b8 --- /dev/null +++ b/Lang/GW-BASIC/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Pinstripe-Display b/Lang/GW-BASIC/Pinstripe-Display new file mode 120000 index 0000000000..282b987dfa --- /dev/null +++ b/Lang/GW-BASIC/Pinstripe-Display @@ -0,0 +1 @@ +../../Task/Pinstripe-Display/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Primality-by-trial-division b/Lang/GW-BASIC/Primality-by-trial-division new file mode 120000 index 0000000000..2b782a101b --- /dev/null +++ b/Lang/GW-BASIC/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Repeat-a-string b/Lang/GW-BASIC/Repeat-a-string new file mode 120000 index 0000000000..c880372bbb --- /dev/null +++ b/Lang/GW-BASIC/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Set-consolidation b/Lang/GW-BASIC/Set-consolidation new file mode 120000 index 0000000000..d4f74ef76c --- /dev/null +++ b/Lang/GW-BASIC/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Sort-an-integer-array b/Lang/GW-BASIC/Sort-an-integer-array new file mode 120000 index 0000000000..47749b90fd --- /dev/null +++ b/Lang/GW-BASIC/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Sorting-algorithms-Gnome-sort b/Lang/GW-BASIC/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..c59f570055 --- /dev/null +++ b/Lang/GW-BASIC/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Sorting-algorithms-Insertion-sort b/Lang/GW-BASIC/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..c063728557 --- /dev/null +++ b/Lang/GW-BASIC/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Split-a-character-string-based-on-change-of-character b/Lang/GW-BASIC/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..55c414402a --- /dev/null +++ b/Lang/GW-BASIC/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/String-append b/Lang/GW-BASIC/String-append new file mode 120000 index 0000000000..80a9e1cba9 --- /dev/null +++ b/Lang/GW-BASIC/String-append @@ -0,0 +1 @@ +../../Task/String-append/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/String-interpolation-included- b/Lang/GW-BASIC/String-interpolation-included- new file mode 120000 index 0000000000..64d55769d0 --- /dev/null +++ b/Lang/GW-BASIC/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/String-prepend b/Lang/GW-BASIC/String-prepend new file mode 120000 index 0000000000..cdce250f27 --- /dev/null +++ b/Lang/GW-BASIC/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Sum-of-a-series b/Lang/GW-BASIC/Sum-of-a-series new file mode 120000 index 0000000000..0eb15c49ab --- /dev/null +++ b/Lang/GW-BASIC/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/The-Twelve-Days-of-Christmas b/Lang/GW-BASIC/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..4988c40de6 --- /dev/null +++ b/Lang/GW-BASIC/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Twos-complement b/Lang/GW-BASIC/Twos-complement new file mode 120000 index 0000000000..6a1e61b45b --- /dev/null +++ b/Lang/GW-BASIC/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Van-Eck-sequence b/Lang/GW-BASIC/Van-Eck-sequence new file mode 120000 index 0000000000..5c697872ea --- /dev/null +++ b/Lang/GW-BASIC/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/GW-BASIC \ No newline at end of file diff --git a/Lang/GW-BASIC/Vector b/Lang/GW-BASIC/Vector new file mode 120000 index 0000000000..6d1d7a6796 --- /dev/null +++ b/Lang/GW-BASIC/Vector @@ -0,0 +1 @@ +../../Task/Vector/GW-BASIC \ No newline at end of file diff --git a/Lang/Gambas/Arithmetic-geometric-mean b/Lang/Gambas/Arithmetic-geometric-mean new file mode 120000 index 0000000000..b22e396101 --- /dev/null +++ b/Lang/Gambas/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Blum-integer b/Lang/Gambas/Blum-integer new file mode 120000 index 0000000000..4f2af239ed --- /dev/null +++ b/Lang/Gambas/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Carmichael-3-strong-pseudoprimes b/Lang/Gambas/Carmichael-3-strong-pseudoprimes new file mode 120000 index 0000000000..566cca6a25 --- /dev/null +++ b/Lang/Gambas/Carmichael-3-strong-pseudoprimes @@ -0,0 +1 @@ +../../Task/Carmichael-3-strong-pseudoprimes/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Casting-out-nines b/Lang/Gambas/Casting-out-nines new file mode 120000 index 0000000000..8fce20d84f --- /dev/null +++ b/Lang/Gambas/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Compare-length-of-two-strings b/Lang/Gambas/Compare-length-of-two-strings new file mode 120000 index 0000000000..dbcccedaa3 --- /dev/null +++ b/Lang/Gambas/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Determine-if-a-string-has-all-the-same-characters b/Lang/Gambas/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..448e7d07b5 --- /dev/null +++ b/Lang/Gambas/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Determine-sentence-type b/Lang/Gambas/Determine-sentence-type new file mode 120000 index 0000000000..2d6d98f0ec --- /dev/null +++ b/Lang/Gambas/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Diversity-prediction-theorem b/Lang/Gambas/Diversity-prediction-theorem new file mode 120000 index 0000000000..f0154a9ba0 --- /dev/null +++ b/Lang/Gambas/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Eban-numbers b/Lang/Gambas/Eban-numbers new file mode 120000 index 0000000000..238b6dbb7b --- /dev/null +++ b/Lang/Gambas/Eban-numbers @@ -0,0 +1 @@ +../../Task/Eban-numbers/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Equal-prime-and-composite-sums b/Lang/Gambas/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..1ab822204b --- /dev/null +++ b/Lang/Gambas/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Euler-method b/Lang/Gambas/Euler-method new file mode 120000 index 0000000000..3f0959e332 --- /dev/null +++ b/Lang/Gambas/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Evaluate-binomial-coefficients b/Lang/Gambas/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..d84c9e286a --- /dev/null +++ b/Lang/Gambas/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Factors-of-an-integer b/Lang/Gambas/Factors-of-an-integer new file mode 120000 index 0000000000..80924d8cbd --- /dev/null +++ b/Lang/Gambas/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Find-limit-of-recursion b/Lang/Gambas/Find-limit-of-recursion new file mode 120000 index 0000000000..7e83540246 --- /dev/null +++ b/Lang/Gambas/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Generate-Chess960-starting-position b/Lang/Gambas/Generate-Chess960-starting-position new file mode 120000 index 0000000000..3ee17430bf --- /dev/null +++ b/Lang/Gambas/Generate-Chess960-starting-position @@ -0,0 +1 @@ +../../Task/Generate-Chess960-starting-position/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Goldbachs-comet b/Lang/Gambas/Goldbachs-comet new file mode 120000 index 0000000000..ffa4d8fa44 --- /dev/null +++ b/Lang/Gambas/Goldbachs-comet @@ -0,0 +1 @@ +../../Task/Goldbachs-comet/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Haversine-formula b/Lang/Gambas/Haversine-formula new file mode 120000 index 0000000000..7321b74c0f --- /dev/null +++ b/Lang/Gambas/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Hofstadter-Q-sequence b/Lang/Gambas/Hofstadter-Q-sequence new file mode 120000 index 0000000000..6288d88da4 --- /dev/null +++ b/Lang/Gambas/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Jensens-Device b/Lang/Gambas/Jensens-Device new file mode 120000 index 0000000000..cf682dd548 --- /dev/null +++ b/Lang/Gambas/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Jewels-and-stones b/Lang/Gambas/Jewels-and-stones new file mode 120000 index 0000000000..b13ca1d825 --- /dev/null +++ b/Lang/Gambas/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Leonardo-numbers b/Lang/Gambas/Leonardo-numbers new file mode 120000 index 0000000000..92f225b368 --- /dev/null +++ b/Lang/Gambas/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/Gambas \ No newline at end of file diff --git a/Lang/Gambas/M-bius-function b/Lang/Gambas/M-bius-function new file mode 120000 index 0000000000..4846367944 --- /dev/null +++ b/Lang/Gambas/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Magic-constant b/Lang/Gambas/Magic-constant new file mode 120000 index 0000000000..3e63290c94 --- /dev/null +++ b/Lang/Gambas/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Map-range b/Lang/Gambas/Map-range new file mode 120000 index 0000000000..47ffb049ec --- /dev/null +++ b/Lang/Gambas/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Gambas \ No newline at end of file diff --git a/Lang/Gambas/McNuggets-problem b/Lang/Gambas/McNuggets-problem new file mode 120000 index 0000000000..4bd6b7bc10 --- /dev/null +++ b/Lang/Gambas/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/Gambas/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..b93d787a92 --- /dev/null +++ b/Lang/Gambas/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Proper-divisors b/Lang/Gambas/Proper-divisors new file mode 120000 index 0000000000..c95a4aae71 --- /dev/null +++ b/Lang/Gambas/Proper-divisors @@ -0,0 +1 @@ +../../Task/Proper-divisors/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors b/Lang/Gambas/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors new file mode 120000 index 0000000000..c38ad7fd24 --- /dev/null +++ b/Lang/Gambas/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Set-consolidation b/Lang/Gambas/Set-consolidation new file mode 120000 index 0000000000..fa59192a47 --- /dev/null +++ b/Lang/Gambas/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Sort-disjoint-sublist b/Lang/Gambas/Sort-disjoint-sublist new file mode 120000 index 0000000000..d77e8ada49 --- /dev/null +++ b/Lang/Gambas/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Subleq b/Lang/Gambas/Subleq new file mode 120000 index 0000000000..cf8593b33b --- /dev/null +++ b/Lang/Gambas/Subleq @@ -0,0 +1 @@ +../../Task/Subleq/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Sum-and-product-puzzle b/Lang/Gambas/Sum-and-product-puzzle new file mode 120000 index 0000000000..70ae337f46 --- /dev/null +++ b/Lang/Gambas/Sum-and-product-puzzle @@ -0,0 +1 @@ +../../Task/Sum-and-product-puzzle/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Tau-number b/Lang/Gambas/Tau-number new file mode 120000 index 0000000000..d7a5e52f2e --- /dev/null +++ b/Lang/Gambas/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Gambas \ No newline at end of file diff --git a/Lang/Gambas/The-Name-Game b/Lang/Gambas/The-Name-Game new file mode 120000 index 0000000000..03cc006601 --- /dev/null +++ b/Lang/Gambas/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/Gambas \ No newline at end of file diff --git a/Lang/Gambas/Twos-complement b/Lang/Gambas/Twos-complement new file mode 120000 index 0000000000..4ed9e66d7c --- /dev/null +++ b/Lang/Gambas/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Gambas \ No newline at end of file diff --git a/Lang/Gleam/00-LANG.txt b/Lang/Gleam/00-LANG.txt new file mode 100644 index 0000000000..6a2642caa9 --- /dev/null +++ b/Lang/Gleam/00-LANG.txt @@ -0,0 +1,5 @@ +{{stub}}{{language|Gleam|hopl=no|site=https://gleam.run/}} +Gleam is a type-safe functional programming language that runs on the [[Erlang]] virtual machine. + +== Todo == +[https://rosettacode.org/wiki/Tasks_not_implemented_in_Gleam Tasks not implemented in Gleam] \ No newline at end of file diff --git a/Lang/Gleam/00-META.yaml b/Lang/Gleam/00-META.yaml new file mode 100644 index 0000000000..dd74632ff4 --- /dev/null +++ b/Lang/Gleam/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Gleam diff --git a/Lang/Gleam/Abstract-type b/Lang/Gleam/Abstract-type new file mode 120000 index 0000000000..e0dafb7309 --- /dev/null +++ b/Lang/Gleam/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Ackermann-function b/Lang/Gleam/Ackermann-function new file mode 120000 index 0000000000..6d193a9b28 --- /dev/null +++ b/Lang/Gleam/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Apply-a-callback-to-an-array b/Lang/Gleam/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..45d13702b0 --- /dev/null +++ b/Lang/Gleam/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Arithmetic-Integer b/Lang/Gleam/Arithmetic-Integer new file mode 120000 index 0000000000..cf77808968 --- /dev/null +++ b/Lang/Gleam/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Array-concatenation b/Lang/Gleam/Array-concatenation new file mode 120000 index 0000000000..a1a9260979 --- /dev/null +++ b/Lang/Gleam/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Array-length b/Lang/Gleam/Array-length new file mode 120000 index 0000000000..ab180dc3f2 --- /dev/null +++ b/Lang/Gleam/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Assertions b/Lang/Gleam/Assertions new file mode 120000 index 0000000000..aca06893a5 --- /dev/null +++ b/Lang/Gleam/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Associative-array-Creation b/Lang/Gleam/Associative-array-Creation new file mode 120000 index 0000000000..954ca71884 --- /dev/null +++ b/Lang/Gleam/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Binary-digits b/Lang/Gleam/Binary-digits new file mode 120000 index 0000000000..a13df512cd --- /dev/null +++ b/Lang/Gleam/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Catamorphism b/Lang/Gleam/Catamorphism new file mode 120000 index 0000000000..a390f8e444 --- /dev/null +++ b/Lang/Gleam/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Comments b/Lang/Gleam/Comments new file mode 120000 index 0000000000..e7d9705951 --- /dev/null +++ b/Lang/Gleam/Comments @@ -0,0 +1 @@ +../../Task/Comments/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Compare-a-list-of-strings b/Lang/Gleam/Compare-a-list-of-strings new file mode 120000 index 0000000000..1669281682 --- /dev/null +++ b/Lang/Gleam/Compare-a-list-of-strings @@ -0,0 +1 @@ +../../Task/Compare-a-list-of-strings/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Compound-data-type b/Lang/Gleam/Compound-data-type new file mode 120000 index 0000000000..7cff564dfe --- /dev/null +++ b/Lang/Gleam/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Conditional-structures b/Lang/Gleam/Conditional-structures new file mode 120000 index 0000000000..c889229abf --- /dev/null +++ b/Lang/Gleam/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Copy-a-string b/Lang/Gleam/Copy-a-string new file mode 120000 index 0000000000..8cf2c44a17 --- /dev/null +++ b/Lang/Gleam/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Count-in-octal b/Lang/Gleam/Count-in-octal new file mode 120000 index 0000000000..15c2c2e9c2 --- /dev/null +++ b/Lang/Gleam/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Date-format b/Lang/Gleam/Date-format new file mode 120000 index 0000000000..328512d62f --- /dev/null +++ b/Lang/Gleam/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Delete-a-file b/Lang/Gleam/Delete-a-file new file mode 120000 index 0000000000..85116e4edd --- /dev/null +++ b/Lang/Gleam/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Detect-division-by-zero b/Lang/Gleam/Detect-division-by-zero new file mode 120000 index 0000000000..9eea7618bf --- /dev/null +++ b/Lang/Gleam/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Determine-if-a-string-is-numeric b/Lang/Gleam/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..a9d9a1d6a1 --- /dev/null +++ b/Lang/Gleam/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Dice-game-probabilities b/Lang/Gleam/Dice-game-probabilities new file mode 120000 index 0000000000..1cf64df0ec --- /dev/null +++ b/Lang/Gleam/Dice-game-probabilities @@ -0,0 +1 @@ +../../Task/Dice-game-probabilities/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Digital-root b/Lang/Gleam/Digital-root new file mode 120000 index 0000000000..f4b00d8cfb --- /dev/null +++ b/Lang/Gleam/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Dot-product b/Lang/Gleam/Dot-product new file mode 120000 index 0000000000..cf4ac49af6 --- /dev/null +++ b/Lang/Gleam/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Empty-directory b/Lang/Gleam/Empty-directory new file mode 120000 index 0000000000..1ce790d8fd --- /dev/null +++ b/Lang/Gleam/Empty-directory @@ -0,0 +1 @@ +../../Task/Empty-directory/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Empty-string b/Lang/Gleam/Empty-string new file mode 120000 index 0000000000..5b7f7b9014 --- /dev/null +++ b/Lang/Gleam/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Ethiopian-multiplication b/Lang/Gleam/Ethiopian-multiplication new file mode 120000 index 0000000000..f93edec2ee --- /dev/null +++ b/Lang/Gleam/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Even-or-odd b/Lang/Gleam/Even-or-odd new file mode 120000 index 0000000000..e725b0e8c1 --- /dev/null +++ b/Lang/Gleam/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Factorial b/Lang/Gleam/Factorial new file mode 120000 index 0000000000..a5b5b846f8 --- /dev/null +++ b/Lang/Gleam/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Fibonacci-sequence b/Lang/Gleam/Fibonacci-sequence new file mode 120000 index 0000000000..1d18c4a46d --- /dev/null +++ b/Lang/Gleam/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Filter b/Lang/Gleam/Filter new file mode 120000 index 0000000000..556438c396 --- /dev/null +++ b/Lang/Gleam/Filter @@ -0,0 +1 @@ +../../Task/Filter/Gleam \ No newline at end of file diff --git a/Lang/Gleam/FizzBuzz b/Lang/Gleam/FizzBuzz new file mode 120000 index 0000000000..7ce345ddee --- /dev/null +++ b/Lang/Gleam/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Function-definition b/Lang/Gleam/Function-definition new file mode 120000 index 0000000000..ba4dddd180 --- /dev/null +++ b/Lang/Gleam/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Generic-swap b/Lang/Gleam/Generic-swap new file mode 120000 index 0000000000..21212ee1ef --- /dev/null +++ b/Lang/Gleam/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Greatest-common-divisor b/Lang/Gleam/Greatest-common-divisor new file mode 120000 index 0000000000..9040d6ace0 --- /dev/null +++ b/Lang/Gleam/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Greatest-element-of-a-list b/Lang/Gleam/Greatest-element-of-a-list new file mode 120000 index 0000000000..0479d1d5ea --- /dev/null +++ b/Lang/Gleam/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Hello-world-Text b/Lang/Gleam/Hello-world-Text new file mode 120000 index 0000000000..c444be33a9 --- /dev/null +++ b/Lang/Gleam/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Increment-a-numerical-string b/Lang/Gleam/Increment-a-numerical-string new file mode 120000 index 0000000000..7bddbff85b --- /dev/null +++ b/Lang/Gleam/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Integer-sequence b/Lang/Gleam/Integer-sequence new file mode 120000 index 0000000000..d2b7a0c5c2 --- /dev/null +++ b/Lang/Gleam/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Jewels-and-stones b/Lang/Gleam/Jewels-and-stones new file mode 120000 index 0000000000..2eb704c9d0 --- /dev/null +++ b/Lang/Gleam/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Kernighans-large-earthquake-problem b/Lang/Gleam/Kernighans-large-earthquake-problem new file mode 120000 index 0000000000..06b9c08a6c --- /dev/null +++ b/Lang/Gleam/Kernighans-large-earthquake-problem @@ -0,0 +1 @@ +../../Task/Kernighans-large-earthquake-problem/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Look-and-say-sequence b/Lang/Gleam/Look-and-say-sequence new file mode 120000 index 0000000000..dafdaa21e3 --- /dev/null +++ b/Lang/Gleam/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Luhn-test-of-credit-card-numbers b/Lang/Gleam/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..784acc9d8d --- /dev/null +++ b/Lang/Gleam/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Multiplication-tables b/Lang/Gleam/Multiplication-tables new file mode 120000 index 0000000000..4745c27425 --- /dev/null +++ b/Lang/Gleam/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Nth b/Lang/Gleam/Nth new file mode 120000 index 0000000000..9607d54630 --- /dev/null +++ b/Lang/Gleam/Nth @@ -0,0 +1 @@ +../../Task/Nth/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Order-by-pair-comparisons b/Lang/Gleam/Order-by-pair-comparisons new file mode 120000 index 0000000000..fc683495ba --- /dev/null +++ b/Lang/Gleam/Order-by-pair-comparisons @@ -0,0 +1 @@ +../../Task/Order-by-pair-comparisons/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Primality-by-Wilsons-theorem b/Lang/Gleam/Primality-by-Wilsons-theorem new file mode 120000 index 0000000000..96d456e3fb --- /dev/null +++ b/Lang/Gleam/Primality-by-Wilsons-theorem @@ -0,0 +1 @@ +../../Task/Primality-by-Wilsons-theorem/Gleam \ No newline at end of file diff --git a/Lang/Gleam/RPG-attributes-generator b/Lang/Gleam/RPG-attributes-generator new file mode 120000 index 0000000000..800e60ff4c --- /dev/null +++ b/Lang/Gleam/RPG-attributes-generator @@ -0,0 +1 @@ +../../Task/RPG-attributes-generator/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Repeat b/Lang/Gleam/Repeat new file mode 120000 index 0000000000..fab6759fe5 --- /dev/null +++ b/Lang/Gleam/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Repeat-a-string b/Lang/Gleam/Repeat-a-string new file mode 120000 index 0000000000..587cd9830b --- /dev/null +++ b/Lang/Gleam/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Set b/Lang/Gleam/Set new file mode 120000 index 0000000000..c138abd777 --- /dev/null +++ b/Lang/Gleam/Set @@ -0,0 +1 @@ +../../Task/Set/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Sort-an-integer-array b/Lang/Gleam/Sort-an-integer-array new file mode 120000 index 0000000000..39c8723c40 --- /dev/null +++ b/Lang/Gleam/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Sorting-algorithms-Quicksort b/Lang/Gleam/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..f1e07b6052 --- /dev/null +++ b/Lang/Gleam/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Stack b/Lang/Gleam/Stack new file mode 120000 index 0000000000..174c4b56e2 --- /dev/null +++ b/Lang/Gleam/Stack @@ -0,0 +1 @@ +../../Task/Stack/Gleam \ No newline at end of file diff --git a/Lang/Gleam/String-append b/Lang/Gleam/String-append new file mode 120000 index 0000000000..8450c82d83 --- /dev/null +++ b/Lang/Gleam/String-append @@ -0,0 +1 @@ +../../Task/String-append/Gleam \ No newline at end of file diff --git a/Lang/Gleam/String-length b/Lang/Gleam/String-length new file mode 120000 index 0000000000..f57922e1a7 --- /dev/null +++ b/Lang/Gleam/String-length @@ -0,0 +1 @@ +../../Task/String-length/Gleam \ No newline at end of file diff --git a/Lang/Gleam/String-prepend b/Lang/Gleam/String-prepend new file mode 120000 index 0000000000..a7f4b33fae --- /dev/null +++ b/Lang/Gleam/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Sum-and-product-of-an-array b/Lang/Gleam/Sum-and-product-of-an-array new file mode 120000 index 0000000000..15ce85c799 --- /dev/null +++ b/Lang/Gleam/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Sum-digits-of-an-integer b/Lang/Gleam/Sum-digits-of-an-integer new file mode 120000 index 0000000000..cfe6f1a5d3 --- /dev/null +++ b/Lang/Gleam/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Sum-multiples-of-3-and-5 b/Lang/Gleam/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..3e5a3657a3 --- /dev/null +++ b/Lang/Gleam/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Sum-of-squares b/Lang/Gleam/Sum-of-squares new file mode 120000 index 0000000000..34f0e02665 --- /dev/null +++ b/Lang/Gleam/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Symmetric-difference b/Lang/Gleam/Symmetric-difference new file mode 120000 index 0000000000..51ff7c4a32 --- /dev/null +++ b/Lang/Gleam/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Temperature-conversion b/Lang/Gleam/Temperature-conversion new file mode 120000 index 0000000000..2d1d9f16a7 --- /dev/null +++ b/Lang/Gleam/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Tree-traversal b/Lang/Gleam/Tree-traversal new file mode 120000 index 0000000000..b8d43d9b74 --- /dev/null +++ b/Lang/Gleam/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Variables b/Lang/Gleam/Variables new file mode 120000 index 0000000000..b43723c7ff --- /dev/null +++ b/Lang/Gleam/Variables @@ -0,0 +1 @@ +../../Task/Variables/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Vector-products b/Lang/Gleam/Vector-products new file mode 120000 index 0000000000..e08e49670f --- /dev/null +++ b/Lang/Gleam/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/Gleam \ No newline at end of file diff --git a/Lang/Gleam/Water-collected-between-towers b/Lang/Gleam/Water-collected-between-towers new file mode 120000 index 0000000000..787299f258 --- /dev/null +++ b/Lang/Gleam/Water-collected-between-towers @@ -0,0 +1 @@ +../../Task/Water-collected-between-towers/Gleam \ No newline at end of file diff --git a/Lang/Go/Bifid-cipher b/Lang/Go/Bifid-cipher new file mode 120000 index 0000000000..329ffb397d --- /dev/null +++ b/Lang/Go/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/Go \ No newline at end of file diff --git a/Lang/Go/Bioinformatics-base-count b/Lang/Go/Bioinformatics-base-count deleted file mode 120000 index 485b68c3c6..0000000000 --- a/Lang/Go/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Go \ No newline at end of file diff --git a/Lang/Go/Boyer-Moore-string-search b/Lang/Go/Boyer-Moore-string-search new file mode 120000 index 0000000000..0b971fdf3b --- /dev/null +++ b/Lang/Go/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/Go \ No newline at end of file diff --git a/Lang/Go/Camel-case-and-snake-case b/Lang/Go/Camel-case-and-snake-case new file mode 120000 index 0000000000..580007cb79 --- /dev/null +++ b/Lang/Go/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/Go \ No newline at end of file diff --git a/Lang/Go/Distance-and-Bearing b/Lang/Go/Distance-and-Bearing new file mode 120000 index 0000000000..566b8d5b53 --- /dev/null +++ b/Lang/Go/Distance-and-Bearing @@ -0,0 +1 @@ +../../Task/Distance-and-Bearing/Go \ No newline at end of file diff --git a/Lang/Go/Factorial-primes b/Lang/Go/Factorial-primes new file mode 120000 index 0000000000..5b25426fd0 --- /dev/null +++ b/Lang/Go/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/Go \ No newline at end of file diff --git a/Lang/Go/Goldbachs-comet b/Lang/Go/Goldbachs-comet new file mode 120000 index 0000000000..e80a90c082 --- /dev/null +++ b/Lang/Go/Goldbachs-comet @@ -0,0 +1 @@ +../../Task/Goldbachs-comet/Go \ No newline at end of file diff --git a/Lang/Go/Meissel-Mertens-constant b/Lang/Go/Meissel-Mertens-constant deleted file mode 120000 index 8c13ff2d6b..0000000000 --- a/Lang/Go/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Go \ No newline at end of file diff --git a/Lang/Go/Miller-Rabin-primality-test b/Lang/Go/Miller-Rabin-primality-test deleted file mode 120000 index c9da74462b..0000000000 --- a/Lang/Go/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Go \ No newline at end of file diff --git a/Lang/Go/P-Adic-square-roots b/Lang/Go/P-Adic-square-roots new file mode 120000 index 0000000000..064157bec0 --- /dev/null +++ b/Lang/Go/P-Adic-square-roots @@ -0,0 +1 @@ +../../Task/P-Adic-square-roots/Go \ No newline at end of file diff --git a/Lang/Go/Quaternion-type b/Lang/Go/Quaternion-type deleted file mode 120000 index e62c595975..0000000000 --- a/Lang/Go/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Go \ No newline at end of file diff --git a/Lang/Go/Simple-turtle-graphics b/Lang/Go/Simple-turtle-graphics new file mode 120000 index 0000000000..81f4233716 --- /dev/null +++ b/Lang/Go/Simple-turtle-graphics @@ -0,0 +1 @@ +../../Task/Simple-turtle-graphics/Go \ No newline at end of file diff --git a/Lang/Go/Sorting-Algorithms-Circle-Sort b/Lang/Go/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 1288f4ddcf..0000000000 --- a/Lang/Go/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Go \ No newline at end of file diff --git a/Lang/Go/Terminal-control-Unicode-output b/Lang/Go/Terminal-control-Unicode-output deleted file mode 120000 index 7532989408..0000000000 --- a/Lang/Go/Terminal-control-Unicode-output +++ /dev/null @@ -1 +0,0 @@ -../../Task/Terminal-control-Unicode-output/Go \ No newline at end of file diff --git a/Lang/Goboscript/00-LANG.txt b/Lang/Goboscript/00-LANG.txt new file mode 100644 index 0000000000..fbf55e819e --- /dev/null +++ b/Lang/Goboscript/00-LANG.txt @@ -0,0 +1,15 @@ +{{stub}}{{language +|tags=compiled, transpiled, Scratch +| site=https://aspizu.github.io/goboscript/ +|parampass=value +|goboscript}} + +From [https://github.com/aspizu/goboscript/ the goboscript repo]:
    + +goboscript is a text-based programming language that compiles to Scratch. Write Scratch projects in text, and compile it into a .sb3 file -- which can be opened in the Scratch editor, TurboWarp or be uploaded to the Scratch website. + +===Package managers=== +Despite being a relatively new programming language, goboscript has multiple package managers. + +* [https://github.com/aspizu/backpack backpack] - The official goboscript package manager +* [https://github.com/inflated-goboscript/inflator inflator] - A more powerful package manager inspired by Python's pip \ No newline at end of file diff --git a/Lang/Goboscript/00-META.yaml b/Lang/Goboscript/00-META.yaml new file mode 100644 index 0000000000..48464a36ad --- /dev/null +++ b/Lang/Goboscript/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Goboscript diff --git a/Lang/Goboscript/100-doors b/Lang/Goboscript/100-doors new file mode 120000 index 0000000000..293aa8a0f0 --- /dev/null +++ b/Lang/Goboscript/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Goboscript \ No newline at end of file diff --git a/Lang/Goboscript/99-bottles-of-beer b/Lang/Goboscript/99-bottles-of-beer new file mode 120000 index 0000000000..5a60ef7f8c --- /dev/null +++ b/Lang/Goboscript/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/Goboscript \ No newline at end of file diff --git a/Lang/Goboscript/Arithmetic-Complex b/Lang/Goboscript/Arithmetic-Complex new file mode 120000 index 0000000000..ed35177c3c --- /dev/null +++ b/Lang/Goboscript/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Goboscript \ No newline at end of file diff --git a/Lang/Golfscript/00-LANG.txt b/Lang/Golfscript/00-LANG.txt index 67be1df4fd..ce1ed4276d 100644 --- a/Lang/Golfscript/00-LANG.txt +++ b/Lang/Golfscript/00-LANG.txt @@ -1,5 +1,10 @@ {{language|GolfScript |site=http://www.golfscript.com/golfscript/index.html }} +{{try|Golfscript|[https://tio.run/#golfscript Try Golfscript on tio.run].}} {{language programming paradigm|Concatenative}} -GolfScript is a stack oriented esoteric programming language aimed at solving problems (holes) in as few keystrokes as possible. It also aims to be simple and easy to write. \ No newline at end of file +GolfScript is a stack oriented esoteric programming language aimed at solving problems (holes) in as few keystrokes as possible. It also aims to be simple and easy to write. + +== External links == +* [https://golfscript.com/golfscript/ Official website] +* [https://codegolf.stackexchange.com/questions/5264/tips-for-golfing-in-golfscript Tips for golfing in Golfscript] \ No newline at end of file diff --git a/Lang/Golfscript/Palindrome-detection b/Lang/Golfscript/Palindrome-detection new file mode 120000 index 0000000000..e10b974442 --- /dev/null +++ b/Lang/Golfscript/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Golfscript \ No newline at end of file diff --git a/Lang/Golfscript/Primality-by-trial-division b/Lang/Golfscript/Primality-by-trial-division new file mode 120000 index 0000000000..42e31431cb --- /dev/null +++ b/Lang/Golfscript/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Golfscript \ No newline at end of file diff --git a/Lang/Golfscript/Sum-digits-of-an-integer b/Lang/Golfscript/Sum-digits-of-an-integer new file mode 120000 index 0000000000..831993091c --- /dev/null +++ b/Lang/Golfscript/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Golfscript \ No newline at end of file diff --git a/Lang/Groovy/Empty-program b/Lang/Groovy/Empty-program deleted file mode 120000 index 8d1c7a42ae..0000000000 --- a/Lang/Groovy/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Groovy \ No newline at end of file diff --git a/Lang/Guile/2048 b/Lang/Guile/2048 new file mode 120000 index 0000000000..69532585e1 --- /dev/null +++ b/Lang/Guile/2048 @@ -0,0 +1 @@ +../../Task/2048/Guile \ No newline at end of file diff --git a/Lang/Guile/A+B b/Lang/Guile/A+B new file mode 120000 index 0000000000..ea7ff34909 --- /dev/null +++ b/Lang/Guile/A+B @@ -0,0 +1 @@ +../../Task/A+B/Guile \ No newline at end of file diff --git a/Lang/Guile/MD5-Implementation b/Lang/Guile/MD5-Implementation new file mode 120000 index 0000000000..c467572ebf --- /dev/null +++ b/Lang/Guile/MD5-Implementation @@ -0,0 +1 @@ +../../Task/MD5-Implementation/Guile \ No newline at end of file diff --git a/Lang/Guish/00-LANG.txt b/Lang/Guish/00-LANG.txt index 593da31c91..e15298f7c3 100644 --- a/Lang/Guish/00-LANG.txt +++ b/Lang/Guish/00-LANG.txt @@ -1016,7 +1016,7 @@ Any element that's not a page has a particular text alignment that can be change -Francesco Palumbo <phranz@subfc.net> +Francesco Palumbo = THANKS = diff --git a/Lang/HPPPL/A+B b/Lang/HPPPL/A+B new file mode 120000 index 0000000000..dd8d8fff42 --- /dev/null +++ b/Lang/HPPPL/A+B @@ -0,0 +1 @@ +../../Task/A+B/HPPPL \ No newline at end of file diff --git a/Lang/HPPPL/Ackermann-function b/Lang/HPPPL/Ackermann-function new file mode 120000 index 0000000000..ff1ef99b52 --- /dev/null +++ b/Lang/HPPPL/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/HPPPL \ No newline at end of file diff --git a/Lang/HPPPL/Babbage-problem b/Lang/HPPPL/Babbage-problem new file mode 120000 index 0000000000..441aa0d4f6 --- /dev/null +++ b/Lang/HPPPL/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/HPPPL \ No newline at end of file diff --git a/Lang/HPPPL/Jacobsthal-numbers b/Lang/HPPPL/Jacobsthal-numbers new file mode 120000 index 0000000000..5f5706ea3b --- /dev/null +++ b/Lang/HPPPL/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/HPPPL \ No newline at end of file diff --git a/Lang/HPPPL/Jaro-similarity b/Lang/HPPPL/Jaro-similarity new file mode 120000 index 0000000000..022c80a0a8 --- /dev/null +++ b/Lang/HPPPL/Jaro-similarity @@ -0,0 +1 @@ +../../Task/Jaro-similarity/HPPPL \ No newline at end of file diff --git a/Lang/HPPPL/Numbers-with-equal-rises-and-falls b/Lang/HPPPL/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..7d6ca5c6b5 --- /dev/null +++ b/Lang/HPPPL/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/HPPPL \ No newline at end of file diff --git a/Lang/HPPPL/Primality-by-trial-division b/Lang/HPPPL/Primality-by-trial-division new file mode 120000 index 0000000000..2127fa3655 --- /dev/null +++ b/Lang/HPPPL/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/HPPPL \ No newline at end of file diff --git a/Lang/HPPPL/Tau-number b/Lang/HPPPL/Tau-number new file mode 120000 index 0000000000..1180967c35 --- /dev/null +++ b/Lang/HPPPL/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/HPPPL \ No newline at end of file diff --git a/Lang/Hare/Execute-Brain- b/Lang/Hare/Execute-Brain- new file mode 120000 index 0000000000..dc8caabad0 --- /dev/null +++ b/Lang/Hare/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/Hare \ No newline at end of file diff --git a/Lang/Haskell/00-LANG.txt b/Lang/Haskell/00-LANG.txt index fe49ebce44..9b79cdd879 100644 --- a/Lang/Haskell/00-LANG.txt +++ b/Lang/Haskell/00-LANG.txt @@ -20,5 +20,5 @@ Linspire GNU/[[Linux]] chose Haskell for system tools development. ==Citations== * [[wp:Haskell_%28programming_language%29|Wikipedia:Haskell (programming language)]] -==Todo== -[[Reports:Tasks_not_implemented_in_Haskell]] \ No newline at end of file +==Unimplemented Tasks== +* [[Tasks_not_implemented_in_Haskell|Haskell Unimplemented]] \ No newline at end of file diff --git a/Lang/Haskell/Arithmetic-numbers b/Lang/Haskell/Arithmetic-numbers new file mode 120000 index 0000000000..ca4dc61dcb --- /dev/null +++ b/Lang/Haskell/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Ascending-primes b/Lang/Haskell/Ascending-primes new file mode 120000 index 0000000000..443d61be19 --- /dev/null +++ b/Lang/Haskell/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Bifid-cipher b/Lang/Haskell/Bifid-cipher new file mode 120000 index 0000000000..e9402d0afc --- /dev/null +++ b/Lang/Haskell/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Bioinformatics-Global-alignment b/Lang/Haskell/Bioinformatics-Global-alignment new file mode 120000 index 0000000000..adcd5f4ce2 --- /dev/null +++ b/Lang/Haskell/Bioinformatics-Global-alignment @@ -0,0 +1 @@ +../../Task/Bioinformatics-Global-alignment/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Bioinformatics-base-count b/Lang/Haskell/Bioinformatics-base-count deleted file mode 120000 index cf913dcdcd..0000000000 --- a/Lang/Haskell/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Blum-integer b/Lang/Haskell/Blum-integer new file mode 120000 index 0000000000..5e2fb151af --- /dev/null +++ b/Lang/Haskell/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Cistercian-numerals b/Lang/Haskell/Cistercian-numerals new file mode 120000 index 0000000000..2a13541c88 --- /dev/null +++ b/Lang/Haskell/Cistercian-numerals @@ -0,0 +1 @@ +../../Task/Cistercian-numerals/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Deceptive-numbers b/Lang/Haskell/Deceptive-numbers new file mode 120000 index 0000000000..6fa6eb6011 --- /dev/null +++ b/Lang/Haskell/Deceptive-numbers @@ -0,0 +1 @@ +../../Task/Deceptive-numbers/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Descending-primes b/Lang/Haskell/Descending-primes new file mode 120000 index 0000000000..58817d1239 --- /dev/null +++ b/Lang/Haskell/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Duffinian-numbers b/Lang/Haskell/Duffinian-numbers new file mode 120000 index 0000000000..282d30bb6b --- /dev/null +++ b/Lang/Haskell/Duffinian-numbers @@ -0,0 +1 @@ +../../Task/Duffinian-numbers/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Factorial-primes b/Lang/Haskell/Factorial-primes new file mode 120000 index 0000000000..004f7e5f7d --- /dev/null +++ b/Lang/Haskell/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Jordan-P-lya-numbers b/Lang/Haskell/Jordan-P-lya-numbers new file mode 120000 index 0000000000..0e7225789a --- /dev/null +++ b/Lang/Haskell/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Miller-Rabin-primality-test b/Lang/Haskell/Miller-Rabin-primality-test deleted file mode 120000 index c41f1ba06c..0000000000 --- a/Lang/Haskell/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Mouse-position b/Lang/Haskell/Mouse-position new file mode 120000 index 0000000000..842d59376f --- /dev/null +++ b/Lang/Haskell/Mouse-position @@ -0,0 +1 @@ +../../Task/Mouse-position/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Pathological-floating-point-problems b/Lang/Haskell/Pathological-floating-point-problems new file mode 120000 index 0000000000..f17bacf62a --- /dev/null +++ b/Lang/Haskell/Pathological-floating-point-problems @@ -0,0 +1 @@ +../../Task/Pathological-floating-point-problems/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Quaternion-type b/Lang/Haskell/Quaternion-type deleted file mode 120000 index 14aca84bfa..0000000000 --- a/Lang/Haskell/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Sorting-Algorithms-Circle-Sort b/Lang/Haskell/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 7f6f1559db..0000000000 --- a/Lang/Haskell/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Strassens-algorithm b/Lang/Haskell/Strassens-algorithm new file mode 120000 index 0000000000..f39dbbfd50 --- /dev/null +++ b/Lang/Haskell/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Haskell \ No newline at end of file diff --git a/Lang/Haxe/Abstract-type b/Lang/Haxe/Abstract-type new file mode 120000 index 0000000000..6ff9aba1f6 --- /dev/null +++ b/Lang/Haxe/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Haxe \ No newline at end of file diff --git a/Lang/Haxe/Apply-a-callback-to-an-array b/Lang/Haxe/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..6fdb21da75 --- /dev/null +++ b/Lang/Haxe/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Haxe \ No newline at end of file diff --git a/Lang/Haxe/Arrays b/Lang/Haxe/Arrays new file mode 120000 index 0000000000..bd303e4884 --- /dev/null +++ b/Lang/Haxe/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Haxe \ No newline at end of file diff --git a/Lang/Haxe/Associative-array-Creation b/Lang/Haxe/Associative-array-Creation new file mode 120000 index 0000000000..38347f6de6 --- /dev/null +++ b/Lang/Haxe/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Haxe \ No newline at end of file diff --git a/Lang/Haxe/Associative-array-Iteration b/Lang/Haxe/Associative-array-Iteration new file mode 120000 index 0000000000..aa7c7951b8 --- /dev/null +++ b/Lang/Haxe/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Haxe \ No newline at end of file diff --git a/Lang/Haxe/Binary-digits b/Lang/Haxe/Binary-digits new file mode 120000 index 0000000000..9bf8952c0d --- /dev/null +++ b/Lang/Haxe/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Haxe \ No newline at end of file diff --git a/Lang/Haxe/Boolean-values b/Lang/Haxe/Boolean-values new file mode 120000 index 0000000000..b5ef0e7d8b --- /dev/null +++ b/Lang/Haxe/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Haxe \ No newline at end of file diff --git a/Lang/Haxe/Call-an-object-method b/Lang/Haxe/Call-an-object-method new file mode 120000 index 0000000000..953d02b76c --- /dev/null +++ b/Lang/Haxe/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/Haxe \ No newline at end of file diff --git a/Lang/Haxe/Character-codes b/Lang/Haxe/Character-codes new file mode 120000 index 0000000000..92ab060a1a --- /dev/null +++ b/Lang/Haxe/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Haxe \ No newline at end of file diff --git a/Lang/Haxe/Classes b/Lang/Haxe/Classes new file mode 120000 index 0000000000..5c922938d4 --- /dev/null +++ b/Lang/Haxe/Classes @@ -0,0 +1 @@ +../../Task/Classes/Haxe \ No newline at end of file diff --git a/Lang/Haxe/Rot-13 b/Lang/Haxe/Rot-13 new file mode 120000 index 0000000000..fc9a0671f3 --- /dev/null +++ b/Lang/Haxe/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Haxe \ No newline at end of file diff --git a/Lang/Haxe/Steffensens-method b/Lang/Haxe/Steffensens-method new file mode 120000 index 0000000000..2dc380372d --- /dev/null +++ b/Lang/Haxe/Steffensens-method @@ -0,0 +1 @@ +../../Task/Steffensens-method/Haxe \ No newline at end of file diff --git a/Lang/Hopper/00-LANG.txt b/Lang/Hopper/00-LANG.txt new file mode 100644 index 0000000000..60fcfd7a6c --- /dev/null +++ b/Lang/Hopper/00-LANG.txt @@ -0,0 +1,58 @@ +{{language|Hopper +|gc=yes +|parampass=both +|express=explicit +|checking=static +|safety=safe +|strength=strong +|hopl=no +|site=https://www.hackster.io/michael-cartwright/projects +}} + +'''Hopper''' is a Java-like programming language and development environment designed for microcontrollers. A curly-brace semi-colon syntax, with a bytecode compiler, and development toolchain for Hopper bytecode virtual machine runtime implementations. + +The runtimes are usually flashed onto the development board for power up start. The IDE can upload a boot up program, (along with a little file system). Development machine and device interactions is accomplished by USB serial connections. Hopper blurs the line between IDE programmer and target device. The serial monitor and client/server communications is written in Hopper, which can be executed in the IDE and/or the target device. + +The Hopper Interactive Development Environment (IDE) runs on Windows, with outputs targeting Hopper Runtimes for +* 6502, an older 8bit microcontroller unit, (MCU). +* RP2040, a newer 32bit dual core Cortex M0+ MCU with General Purpose Input Output (GPIO) pins and modern internal peripherals, designed by the Raspberry Pi Foundation, (RPi). +** Pico +** Pico W +** Challenger RP2040 Wifi +* more to come + +Github repository: https://github.com/sillycowvalley/Hopper + +All Hopper Runtimes support a Hopper Monitor shell that implements feedback IO and a command language, the elements of which are Hopper programs. The Hopper Runtime virtual machine can also be used directly from the Hopper IDE on desktop PC, with the bootstrap Windows VM written in C# and the rest is self-hosted in Hopper. For the RP2040 at least. + +The 6502 Runtime is bootstrapped from assembly language sources, for both first run hopper and firmware, then hosted in Hopper VM bytecode and the development toolchain. + +Hopper is written in Hopper, with '''.hexe''' bytecode files in the '''Bin/''' directory of the IDE setup. +* Preprocess, Compile, Optimize, Codegen, DASM (Disassembler) +* Translate (Hopper to C) + +In support of the system shell and '''.cmd''' scripting, there is also: (non exhaustive list) + +* show, shell, debug (more on this below), cd, cls, dir, del +* see '''help''' for more + +=== Documentation === +The author has put early documentation efforts into a large set of YouTube videos, with the main page (and search) at: + +https://www.youtube.com/@biggertigger + +=== Development as of 2024 === + +In development by Michael Cartwright, with working samples for MOS Technology 6502 and Raspberry Pi RP2040. +There are various RunTime UF2's pre-built for quick starts. (UF2 is a hex file format for microcontroller firmware uploads): + +* Pico, Pico W (with Wifi networking implemented), Challenger RP2040 Wifi +* as is, the Pico firmware will at least minimally work on a fair number of RPi RP2040 development boards +* along with drivers (written in Hopper) for many MCU related display devices and module peripherals. + +=== Hopper Debugger === +The debugger is an important part of Hopper development. +'''TODO''' + +=== Links: === +* [[Reports:Tasks_not_implemented_in_Hopper|Tasks not yet implemented]] \ No newline at end of file diff --git a/Lang/Hopper/00-META.yaml b/Lang/Hopper/00-META.yaml new file mode 100644 index 0000000000..4850aa5735 --- /dev/null +++ b/Lang/Hopper/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Hopper diff --git a/Lang/Hopper/Hello-world-Text b/Lang/Hopper/Hello-world-Text new file mode 120000 index 0000000000..2f126e55ad --- /dev/null +++ b/Lang/Hopper/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Hopper \ No newline at end of file diff --git a/Lang/IDL/00-LANG.txt b/Lang/IDL/00-LANG.txt index ef4aad38d6..fed6398ad2 100644 --- a/Lang/IDL/00-LANG.txt +++ b/Lang/IDL/00-LANG.txt @@ -1,4 +1,4 @@ {{stub}}{{language|IDL}} IDL (Interactive Data Language) is an [[array]] programming language designed by David Stern. [[wp:IDL_%28programming_language%29|Wikipedia article]] -(free implementation: GDL - GNU Data Language http://gnudatalanguage.sourceforge.net) \ No newline at end of file +(free implementation: GDL - GNU Data Language https://github.com/gnudatalanguage/gdl) \ No newline at end of file diff --git a/Lang/IS-BASIC/Arithmetic-geometric-mean-Calculate-Pi b/Lang/IS-BASIC/Arithmetic-geometric-mean-Calculate-Pi new file mode 120000 index 0000000000..1f2f5f0db7 --- /dev/null +++ b/Lang/IS-BASIC/Arithmetic-geometric-mean-Calculate-Pi @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean-Calculate-Pi/IS-BASIC \ No newline at end of file diff --git a/Lang/IS-BASIC/Chaos-game b/Lang/IS-BASIC/Chaos-game new file mode 120000 index 0000000000..d88cbbdffd --- /dev/null +++ b/Lang/IS-BASIC/Chaos-game @@ -0,0 +1 @@ +../../Task/Chaos-game/IS-BASIC \ No newline at end of file diff --git a/Lang/IS-BASIC/Determine-if-a-string-has-all-the-same-characters b/Lang/IS-BASIC/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..3a0ac72c5c --- /dev/null +++ b/Lang/IS-BASIC/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/IS-BASIC \ No newline at end of file diff --git a/Lang/IS-BASIC/Levenshtein-distance b/Lang/IS-BASIC/Levenshtein-distance new file mode 120000 index 0000000000..5e8a9b92bc --- /dev/null +++ b/Lang/IS-BASIC/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/IS-BASIC \ No newline at end of file diff --git a/Lang/IS-BASIC/Pi b/Lang/IS-BASIC/Pi new file mode 120000 index 0000000000..80838bc8eb --- /dev/null +++ b/Lang/IS-BASIC/Pi @@ -0,0 +1 @@ +../../Task/Pi/IS-BASIC \ No newline at end of file diff --git a/Lang/IS-BASIC/Sierpinski-carpet b/Lang/IS-BASIC/Sierpinski-carpet new file mode 120000 index 0000000000..432bc406d8 --- /dev/null +++ b/Lang/IS-BASIC/Sierpinski-carpet @@ -0,0 +1 @@ +../../Task/Sierpinski-carpet/IS-BASIC \ No newline at end of file diff --git a/Lang/IS-BASIC/Tau-number b/Lang/IS-BASIC/Tau-number new file mode 120000 index 0000000000..62fba6c429 --- /dev/null +++ b/Lang/IS-BASIC/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/IS-BASIC \ No newline at end of file diff --git a/Lang/Icon/00-LANG.txt b/Lang/Icon/00-LANG.txt index 6d6b15bfc2..16054a3927 100644 --- a/Lang/Icon/00-LANG.txt +++ b/Lang/Icon/00-LANG.txt @@ -39,5 +39,7 @@ Several extensions of Icon were developed to improve functionality. Many of the * [[Icon%2BUnicon/Intro|An introduction to Icon and Unicon for Rosetta Code]] * [[:Category:Icon/Omit|Unimplementable tasks]] * [[:Category:Icon_examples_needing_attention|Tasks requiring attention]] -* [[Reports:Tasks_not_implemented_in_Icon|Tasks not yet implemented]] -* [[:Category:Icon_Programming_Library|The Icon Programming Library]] \ No newline at end of file +* [[:Category:Icon_Programming_Library|The Icon Programming Library]] + +==Todo== +* [[Tasks not implemented in Icon]] \ No newline at end of file diff --git a/Lang/Icon/100-prisoners b/Lang/Icon/100-prisoners new file mode 120000 index 0000000000..9bc15827ac --- /dev/null +++ b/Lang/Icon/100-prisoners @@ -0,0 +1 @@ +../../Task/100-prisoners/Icon \ No newline at end of file diff --git a/Lang/Icon/Additive-primes b/Lang/Icon/Additive-primes new file mode 120000 index 0000000000..f7253ea73d --- /dev/null +++ b/Lang/Icon/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/Icon \ No newline at end of file diff --git a/Lang/Icon/Amicable-pairs b/Lang/Icon/Amicable-pairs new file mode 120000 index 0000000000..13242a82ae --- /dev/null +++ b/Lang/Icon/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/Icon \ No newline at end of file diff --git a/Lang/Icon/Anti-primes b/Lang/Icon/Anti-primes new file mode 120000 index 0000000000..63243658da --- /dev/null +++ b/Lang/Icon/Anti-primes @@ -0,0 +1 @@ +../../Task/Anti-primes/Icon \ No newline at end of file diff --git a/Lang/Icon/Ascending-primes b/Lang/Icon/Ascending-primes new file mode 120000 index 0000000000..e30e0fc896 --- /dev/null +++ b/Lang/Icon/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/Icon \ No newline at end of file diff --git a/Lang/Icon/Attractive-numbers b/Lang/Icon/Attractive-numbers new file mode 120000 index 0000000000..743b113011 --- /dev/null +++ b/Lang/Icon/Attractive-numbers @@ -0,0 +1 @@ +../../Task/Attractive-numbers/Icon \ No newline at end of file diff --git a/Lang/Icon/Babbage-problem b/Lang/Icon/Babbage-problem new file mode 120000 index 0000000000..735fcc5c8a --- /dev/null +++ b/Lang/Icon/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/Icon \ No newline at end of file diff --git a/Lang/Icon/Bin-given-limits b/Lang/Icon/Bin-given-limits new file mode 120000 index 0000000000..39a04e7b2e --- /dev/null +++ b/Lang/Icon/Bin-given-limits @@ -0,0 +1 @@ +../../Task/Bin-given-limits/Icon \ No newline at end of file diff --git a/Lang/Icon/Brilliant-numbers b/Lang/Icon/Brilliant-numbers new file mode 120000 index 0000000000..1a8f34ef87 --- /dev/null +++ b/Lang/Icon/Brilliant-numbers @@ -0,0 +1 @@ +../../Task/Brilliant-numbers/Icon \ No newline at end of file diff --git a/Lang/Icon/Colorful-numbers b/Lang/Icon/Colorful-numbers new file mode 120000 index 0000000000..d1f1a0b56b --- /dev/null +++ b/Lang/Icon/Colorful-numbers @@ -0,0 +1 @@ +../../Task/Colorful-numbers/Icon \ No newline at end of file diff --git a/Lang/Icon/Compare-length-of-two-strings b/Lang/Icon/Compare-length-of-two-strings new file mode 120000 index 0000000000..beabf2e98e --- /dev/null +++ b/Lang/Icon/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/Icon \ No newline at end of file diff --git a/Lang/Icon/Copy-stdin-to-stdout b/Lang/Icon/Copy-stdin-to-stdout new file mode 120000 index 0000000000..7a52714a89 --- /dev/null +++ b/Lang/Icon/Copy-stdin-to-stdout @@ -0,0 +1 @@ +../../Task/Copy-stdin-to-stdout/Icon \ No newline at end of file diff --git a/Lang/Icon/Curzon-numbers b/Lang/Icon/Curzon-numbers new file mode 120000 index 0000000000..4ee931a90d --- /dev/null +++ b/Lang/Icon/Curzon-numbers @@ -0,0 +1 @@ +../../Task/Curzon-numbers/Icon \ No newline at end of file diff --git a/Lang/Icon/Damm-algorithm b/Lang/Icon/Damm-algorithm new file mode 120000 index 0000000000..67c033a005 --- /dev/null +++ b/Lang/Icon/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/Icon \ No newline at end of file diff --git a/Lang/Icon/Department-numbers b/Lang/Icon/Department-numbers new file mode 120000 index 0000000000..ce0a0885c3 --- /dev/null +++ b/Lang/Icon/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/Icon \ No newline at end of file diff --git a/Lang/Icon/Descending-primes b/Lang/Icon/Descending-primes new file mode 120000 index 0000000000..c0f125d9e3 --- /dev/null +++ b/Lang/Icon/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/Icon \ No newline at end of file diff --git a/Lang/Icon/Determine-if-a-string-is-collapsible b/Lang/Icon/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..d589db9f61 --- /dev/null +++ b/Lang/Icon/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/Icon \ No newline at end of file diff --git a/Lang/Icon/Determine-if-a-string-is-squeezable b/Lang/Icon/Determine-if-a-string-is-squeezable new file mode 120000 index 0000000000..46209569af --- /dev/null +++ b/Lang/Icon/Determine-if-a-string-is-squeezable @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-squeezable/Icon \ No newline at end of file diff --git a/Lang/Icon/Disarium-numbers b/Lang/Icon/Disarium-numbers new file mode 120000 index 0000000000..12c9e05e7d --- /dev/null +++ b/Lang/Icon/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/Icon \ No newline at end of file diff --git a/Lang/Icon/Duffinian-numbers b/Lang/Icon/Duffinian-numbers new file mode 120000 index 0000000000..5897c057e3 --- /dev/null +++ b/Lang/Icon/Duffinian-numbers @@ -0,0 +1 @@ +../../Task/Duffinian-numbers/Icon \ No newline at end of file diff --git a/Lang/Icon/Exponentiation-order b/Lang/Icon/Exponentiation-order new file mode 120000 index 0000000000..c87e5174b5 --- /dev/null +++ b/Lang/Icon/Exponentiation-order @@ -0,0 +1 @@ +../../Task/Exponentiation-order/Icon \ No newline at end of file diff --git a/Lang/Icon/Exponentiation-with-infix-operators-in-or-operating-on-the-base b/Lang/Icon/Exponentiation-with-infix-operators-in-or-operating-on-the-base new file mode 120000 index 0000000000..08ed217100 --- /dev/null +++ b/Lang/Icon/Exponentiation-with-infix-operators-in-or-operating-on-the-base @@ -0,0 +1 @@ +../../Task/Exponentiation-with-infix-operators-in-or-operating-on-the-base/Icon \ No newline at end of file diff --git a/Lang/Icon/Gapful-numbers b/Lang/Icon/Gapful-numbers new file mode 120000 index 0000000000..fc3d78f9a2 --- /dev/null +++ b/Lang/Icon/Gapful-numbers @@ -0,0 +1 @@ +../../Task/Gapful-numbers/Icon \ No newline at end of file diff --git a/Lang/Icon/General-FizzBuzz b/Lang/Icon/General-FizzBuzz new file mode 120000 index 0000000000..ea33dc312a --- /dev/null +++ b/Lang/Icon/General-FizzBuzz @@ -0,0 +1 @@ +../../Task/General-FizzBuzz/Icon \ No newline at end of file diff --git a/Lang/Icon/Halt-and-catch-fire b/Lang/Icon/Halt-and-catch-fire new file mode 120000 index 0000000000..cc36db873b --- /dev/null +++ b/Lang/Icon/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/Icon \ No newline at end of file diff --git a/Lang/Icon/History-variables b/Lang/Icon/History-variables new file mode 120000 index 0000000000..3757ea49f2 --- /dev/null +++ b/Lang/Icon/History-variables @@ -0,0 +1 @@ +../../Task/History-variables/Icon \ No newline at end of file diff --git a/Lang/Icon/Humble-numbers b/Lang/Icon/Humble-numbers new file mode 120000 index 0000000000..4ff6385336 --- /dev/null +++ b/Lang/Icon/Humble-numbers @@ -0,0 +1 @@ +../../Task/Humble-numbers/Icon \ No newline at end of file diff --git a/Lang/Icon/JSON b/Lang/Icon/JSON new file mode 120000 index 0000000000..cac5544cb8 --- /dev/null +++ b/Lang/Icon/JSON @@ -0,0 +1 @@ +../../Task/JSON/Icon \ No newline at end of file diff --git a/Lang/Icon/Jewels-and-stones b/Lang/Icon/Jewels-and-stones new file mode 120000 index 0000000000..5dee8d7cee --- /dev/null +++ b/Lang/Icon/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/Icon \ No newline at end of file diff --git a/Lang/Icon/JortSort b/Lang/Icon/JortSort new file mode 120000 index 0000000000..f9d0bbf2dd --- /dev/null +++ b/Lang/Icon/JortSort @@ -0,0 +1 @@ +../../Task/JortSort/Icon \ No newline at end of file diff --git a/Lang/Icon/Kernighans-large-earthquake-problem b/Lang/Icon/Kernighans-large-earthquake-problem new file mode 120000 index 0000000000..c766366430 --- /dev/null +++ b/Lang/Icon/Kernighans-large-earthquake-problem @@ -0,0 +1 @@ +../../Task/Kernighans-large-earthquake-problem/Icon \ No newline at end of file diff --git a/Lang/Icon/Largest-number-divisible-by-its-digits b/Lang/Icon/Largest-number-divisible-by-its-digits new file mode 120000 index 0000000000..13b83b49d7 --- /dev/null +++ b/Lang/Icon/Largest-number-divisible-by-its-digits @@ -0,0 +1 @@ +../../Task/Largest-number-divisible-by-its-digits/Icon \ No newline at end of file diff --git a/Lang/Icon/Largest-proper-divisor-of-n b/Lang/Icon/Largest-proper-divisor-of-n new file mode 120000 index 0000000000..31002a6508 --- /dev/null +++ b/Lang/Icon/Largest-proper-divisor-of-n @@ -0,0 +1 @@ +../../Task/Largest-proper-divisor-of-n/Icon \ No newline at end of file diff --git a/Lang/Icon/Longest-common-substring b/Lang/Icon/Longest-common-substring new file mode 120000 index 0000000000..911a5f7a03 --- /dev/null +++ b/Lang/Icon/Longest-common-substring @@ -0,0 +1 @@ +../../Task/Longest-common-substring/Icon \ No newline at end of file diff --git a/Lang/Icon/Loops-Increment-loop-index-within-loop-body b/Lang/Icon/Loops-Increment-loop-index-within-loop-body new file mode 120000 index 0000000000..19c94ce3da --- /dev/null +++ b/Lang/Icon/Loops-Increment-loop-index-within-loop-body @@ -0,0 +1 @@ +../../Task/Loops-Increment-loop-index-within-loop-body/Icon \ No newline at end of file diff --git a/Lang/Icon/Loops-Wrong-ranges b/Lang/Icon/Loops-Wrong-ranges new file mode 120000 index 0000000000..0317af2079 --- /dev/null +++ b/Lang/Icon/Loops-Wrong-ranges @@ -0,0 +1 @@ +../../Task/Loops-Wrong-ranges/Icon \ No newline at end of file diff --git a/Lang/Icon/Lychrel-numbers b/Lang/Icon/Lychrel-numbers new file mode 120000 index 0000000000..17b9194dd0 --- /dev/null +++ b/Lang/Icon/Lychrel-numbers @@ -0,0 +1 @@ +../../Task/Lychrel-numbers/Icon \ No newline at end of file diff --git a/Lang/Icon/Matrix-exponentiation-operator b/Lang/Icon/Matrix-exponentiation-operator new file mode 120000 index 0000000000..7d0b44e7a5 --- /dev/null +++ b/Lang/Icon/Matrix-exponentiation-operator @@ -0,0 +1 @@ +../../Task/Matrix-exponentiation-operator/Icon \ No newline at end of file diff --git a/Lang/Icon/Mian-Chowla-sequence b/Lang/Icon/Mian-Chowla-sequence new file mode 120000 index 0000000000..c2755bd935 --- /dev/null +++ b/Lang/Icon/Mian-Chowla-sequence @@ -0,0 +1 @@ +../../Task/Mian-Chowla-sequence/Icon \ No newline at end of file diff --git a/Lang/Icon/Miller-Rabin-primality-test b/Lang/Icon/Miller-Rabin-primality-test deleted file mode 120000 index 0a9d526a8b..0000000000 --- a/Lang/Icon/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Icon \ No newline at end of file diff --git a/Lang/Icon/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/Icon/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..e9ef6d5260 --- /dev/null +++ b/Lang/Icon/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/Icon \ No newline at end of file diff --git a/Lang/Icon/Palindromic-gapful-numbers b/Lang/Icon/Palindromic-gapful-numbers new file mode 120000 index 0000000000..0baaac39e3 --- /dev/null +++ b/Lang/Icon/Palindromic-gapful-numbers @@ -0,0 +1 @@ +../../Task/Palindromic-gapful-numbers/Icon \ No newline at end of file diff --git a/Lang/Icon/Perfect-shuffle b/Lang/Icon/Perfect-shuffle new file mode 120000 index 0000000000..6f3471d6c3 --- /dev/null +++ b/Lang/Icon/Perfect-shuffle @@ -0,0 +1 @@ +../../Task/Perfect-shuffle/Icon \ No newline at end of file diff --git a/Lang/Icon/Repeat b/Lang/Icon/Repeat new file mode 120000 index 0000000000..c83ed88406 --- /dev/null +++ b/Lang/Icon/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/Icon \ No newline at end of file diff --git a/Lang/Icon/Search-a-list-of-records b/Lang/Icon/Search-a-list-of-records new file mode 120000 index 0000000000..b796eca599 --- /dev/null +++ b/Lang/Icon/Search-a-list-of-records @@ -0,0 +1 @@ +../../Task/Search-a-list-of-records/Icon \ No newline at end of file diff --git a/Lang/Icon/Sort-numbers-lexicographically b/Lang/Icon/Sort-numbers-lexicographically new file mode 120000 index 0000000000..7c99f7d928 --- /dev/null +++ b/Lang/Icon/Sort-numbers-lexicographically @@ -0,0 +1 @@ +../../Task/Sort-numbers-lexicographically/Icon \ No newline at end of file diff --git a/Lang/Icon/Tau-function b/Lang/Icon/Tau-function new file mode 120000 index 0000000000..a9852ae0fc --- /dev/null +++ b/Lang/Icon/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/Icon \ No newline at end of file diff --git a/Lang/Icon/Tau-number b/Lang/Icon/Tau-number new file mode 120000 index 0000000000..16be5aedc6 --- /dev/null +++ b/Lang/Icon/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Icon \ No newline at end of file diff --git a/Lang/Icon/Thue-Morse b/Lang/Icon/Thue-Morse new file mode 120000 index 0000000000..bfa031f039 --- /dev/null +++ b/Lang/Icon/Thue-Morse @@ -0,0 +1 @@ +../../Task/Thue-Morse/Icon \ No newline at end of file diff --git a/Lang/Icon/Tokenize-a-string-with-escaping b/Lang/Icon/Tokenize-a-string-with-escaping new file mode 120000 index 0000000000..6a5856de9c --- /dev/null +++ b/Lang/Icon/Tokenize-a-string-with-escaping @@ -0,0 +1 @@ +../../Task/Tokenize-a-string-with-escaping/Icon \ No newline at end of file diff --git a/Lang/Icon/Tree-from-nesting-levels b/Lang/Icon/Tree-from-nesting-levels new file mode 120000 index 0000000000..670d6ecf62 --- /dev/null +++ b/Lang/Icon/Tree-from-nesting-levels @@ -0,0 +1 @@ +../../Task/Tree-from-nesting-levels/Icon \ No newline at end of file diff --git a/Lang/Icon/UTF-8-encode-and-decode b/Lang/Icon/UTF-8-encode-and-decode new file mode 120000 index 0000000000..354f23e4f3 --- /dev/null +++ b/Lang/Icon/UTF-8-encode-and-decode @@ -0,0 +1 @@ +../../Task/UTF-8-encode-and-decode/Icon \ No newline at end of file diff --git a/Lang/Icon/Unix-ls b/Lang/Icon/Unix-ls new file mode 120000 index 0000000000..a60d089d88 --- /dev/null +++ b/Lang/Icon/Unix-ls @@ -0,0 +1 @@ +../../Task/Unix-ls/Icon \ No newline at end of file diff --git a/Lang/Icon/Word-frequency b/Lang/Icon/Word-frequency new file mode 120000 index 0000000000..24fef71b7b --- /dev/null +++ b/Lang/Icon/Word-frequency @@ -0,0 +1 @@ +../../Task/Word-frequency/Icon \ No newline at end of file diff --git a/Lang/Icon/Write-entire-file b/Lang/Icon/Write-entire-file new file mode 120000 index 0000000000..a982401a37 --- /dev/null +++ b/Lang/Icon/Write-entire-file @@ -0,0 +1 @@ +../../Task/Write-entire-file/Icon \ No newline at end of file diff --git a/Lang/Idris/Comments b/Lang/Idris/Comments new file mode 120000 index 0000000000..ffaead275c --- /dev/null +++ b/Lang/Idris/Comments @@ -0,0 +1 @@ +../../Task/Comments/Idris \ No newline at end of file diff --git a/Lang/Idris/Palindrome-detection b/Lang/Idris/Palindrome-detection new file mode 120000 index 0000000000..58af724843 --- /dev/null +++ b/Lang/Idris/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Idris \ No newline at end of file diff --git a/Lang/Idris/Quaternion-type b/Lang/Idris/Quaternion-type deleted file mode 120000 index 6489466168..0000000000 --- a/Lang/Idris/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Idris \ No newline at end of file diff --git a/Lang/Imp77/00-LANG.txt b/Lang/Imp77/00-LANG.txt new file mode 100644 index 0000000000..85ea555671 --- /dev/null +++ b/Lang/Imp77/00-LANG.txt @@ -0,0 +1,37 @@ +{{language +|exec=machine +|gc=no +|parampass=value or by address +|checking=static +|tags=imp77 +}}{{language programming paradigm|Imperative}} +'''Imp77''' is a general-purpose, [[procedural programming|procedural]], [[imperative programming|imperative]] computer programming language developed around 1977 by the Computer Science Department at Edinburgh University. The original Imp was an incremental development of its predecessor, [[derived from::AtlasAutocode]], via Imp9 . + +==Versions== +* '''Atlas Autocode''' was originally created by Tony Brooker as his response to the 1958 IAL proposal which was the prototype for Algol60. It was very similar to Algol 60 but without some of the problematic areas such as 'call-by-name'. +* '''Imp(AA)''' was the first Imp compiler (running on the KDF9) to use the name Imp, but it was almost identical to Atlas Autocode apart from having removed a few unused language features such as %complex variables and minor syntax that was dependent on the use of the Flexowriter and the KDF9 character set, which happened when the compiler was modified to use the 7-bit ISO character set. +* '''Imp9''' was the final release of Imp on the ICL System 4/75. By this point Imp had acquired records and strings. +* '''Impi''' was an interactive version of the Imp language based on the Imp9 specification, which compiled a statement at a time or a procedure at a time to executable code in memory. Although the Impi name meant "Imp Interpreter" it was not an interpreter in the sense of interpreting an intermediate code, but was rather a true dynamic and interactive compiler. +* '''Iopt''' was the Imp9 compiler modernised and ported to the ICL 29XX range. This was the most fully-featured version of Imp until Imp77 was created. +* '''Skimp''' was a cut-down version of the language, at about the same level of complexity as Atlas Autocode, used for teaching compiler-writing to third-year computer science students at Edinburgh University. It was also used as a bootstrapping compiler when porting imp to new systems. +* '''Imp15''' was an implementation of Imp for the PDP9 and PDP15 systems, which ran in 8K words (words being 18 bits). +* '''Imp11''' was a version of Imp, bootstrapped through Skimp but implementing most of the language, written to support the PDP11 processors used at Edinburgh for the communications network. +* '''Imp77''' was a full implementation of Imp supporting all language features, written by Peter Robertson of the Department of Computer Science in support of his PhD thesis on the subject of portable intermediate codes. Imp77 was adopted as the primary compiler of the Department of Computer Science at Edinburgh and made available on many architectures. Most Imp submissions to Rosetta Code will be in Imp77 because it is the only version of Imp remaining with a native compiler available (x86) although there are a few other architectures still usable under emulation. The current Imp77 compiler is a hobbyist revival and is to some extent still under development, lacking the extensive library support and runtime diagnostics that were present in Edinburgh University implementations. +* '''Imp80''' was an attempt to merge Iopt and Imp77 into a common subset language, as the versions of Imp used by the Edinburgh Regional Computing Center and the Department of Computer Science had diverged sufficiently by 1980, that much code was not compatible between the two versions. The standardisation process that Imp80 started was never completed as Edinburgh abandoned the use of Imp in the 1980's, under political pressure to switch to using languages with a broader code base. + +==Overview== + +Imp is structurally very similar to Algol 60 except that instead of Algol's "name" parameters which implement a somewhat broken call-by-substitution mechanism, Imp uses call-by-reference, passing the address of a variable instead, and implicitly de-referencing such variables within a procedure, without requiring explicit syntax to access them as would be done in C for example. + +==Stropping== + +Imp uses keywords rather than reserved words, and in principle keywords in an Imp program are written with underlining. However this was seldom done in practise (in fact the last implementation to support underlining was back when the language was still called Atlas Autocode) and the convention used was that alphabetic sequences introduced by a '%' character were to be considered as being underlined, with the underlining terminating on the first non-alphabetic character. Imp compilers applied a 'line reconstruction' phase to their input, converting underlined letters into an internal representation distinct from regular letters, whilst removing all spaces (but not line endings) from the input other than within quoted strings and characters. + +It is however quite acceptable to show listings of Imp programs with underlined (or bold) keywords in place of %-stropped keywords. +==Citation== + +==Todo== +* [[Tasks not implemented in Imp77]] + + +{{language programming paradigm|Imperative}} \ No newline at end of file diff --git a/Lang/Imp77/00-META.yaml b/Lang/Imp77/00-META.yaml new file mode 100644 index 0000000000..382e836f84 --- /dev/null +++ b/Lang/Imp77/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Imp77 diff --git a/Lang/Imp77/Towers-of-Hanoi b/Lang/Imp77/Towers-of-Hanoi new file mode 120000 index 0000000000..9cf1e23a14 --- /dev/null +++ b/Lang/Imp77/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Imp77 \ No newline at end of file diff --git a/Lang/Imp77/Trabb-Pardo-Knuth-algorithm b/Lang/Imp77/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..974a19fbc9 --- /dev/null +++ b/Lang/Imp77/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/Imp77 \ No newline at end of file diff --git a/Lang/Insitux/00-LANG.txt b/Lang/Insitux/00-LANG.txt index 4ebf558e15..b852a0706e 100644 --- a/Lang/Insitux/00-LANG.txt +++ b/Lang/Insitux/00-LANG.txt @@ -1,7 +1,10 @@ -{{stub}} {{language|Insitux |site=https://insitux.github.io |hopl=no |tags=insitux}} +Insitux (pronounced /ɪnˈsɪtjuːɪks/) is a dynamically-typed functional scripting language inspired by Clojure, originally commissioned in July 2021 for safe and extensible in-game scripting in a popular Roblox game. It now targets Node.js/Bun and client-side web. + +Despite its origins it is a capable language, with development focusing on the language itself, its Node.js ecosystem, and to a lesser extent its web ecosystem. This primarily involves adding to the already 200+ built-in operations, which tend to cause existing Insitux programs to shrink in size over time; and improving language performance since dropping Roblox compatibility in 2024. + {{language programming paradigm|functional}} \ No newline at end of file diff --git a/Lang/Insitux/Roman-numerals-Decode b/Lang/Insitux/Roman-numerals-Decode new file mode 120000 index 0000000000..3ae13130bb --- /dev/null +++ b/Lang/Insitux/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/Insitux \ No newline at end of file diff --git a/Lang/Isabelle/Bernoulli-numbers b/Lang/Isabelle/Bernoulli-numbers new file mode 120000 index 0000000000..73728f3564 --- /dev/null +++ b/Lang/Isabelle/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/Isabelle \ No newline at end of file diff --git a/Lang/Isabelle/Catalan-numbers b/Lang/Isabelle/Catalan-numbers new file mode 120000 index 0000000000..b2ce7b3a40 --- /dev/null +++ b/Lang/Isabelle/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Isabelle \ No newline at end of file diff --git a/Lang/J/00-LANG.txt b/Lang/J/00-LANG.txt index f665b8789e..5ca185b4f1 100644 --- a/Lang/J/00-LANG.txt +++ b/Lang/J/00-LANG.txt @@ -22,6 +22,8 @@ A frequent reaction when one first encounters a J program is often something alo The flip side of this issue is that J is a dialect of APL — a language whose development started in the 1950s and which was implemented in the early 1960s. And, originally, APL was designed as a language to describe computer architecture. The implementation as a programming language was motivated by its original successes in documenting computer hardware and instructions, and the relative simplicity of its concepts. +See also https://github.com/cratelyn/j for some reflection on some of the linguistic character of J. + == Introduction == J is a notational programming language designed for interactive use. @@ -115,6 +117,7 @@ Discussion of the goals of the J community on RC and general guidelines for pres *[[User:Lambertdw|David Lambert]]:[[Special:Contributions/Lambertdw|contributions]] *[[User:JimTheriot|JimTheriot]]: [[Special:Contributions/JimTheriot|contributions]] *[[User:DevonMcC|Devon McCormick]]: [[Special:Contributions/DevonMcC|contributions]] +*[[User:Cchando|Cameron Chandoke]]: [[Special:Contributions/Cchando|contributions]], [[j:User:Cameron_Chandoke|J wiki]] == Try me == diff --git a/Lang/J/Bioinformatics-base-count b/Lang/J/Bioinformatics-base-count deleted file mode 120000 index 78c6127b60..0000000000 --- a/Lang/J/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/J \ No newline at end of file diff --git a/Lang/J/Meissel-Mertens-constant b/Lang/J/Meissel-Mertens-constant deleted file mode 120000 index 04eb0042a3..0000000000 --- a/Lang/J/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/J \ No newline at end of file diff --git a/Lang/J/Quaternion-type b/Lang/J/Quaternion-type deleted file mode 120000 index 0868577467..0000000000 --- a/Lang/J/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/J \ No newline at end of file diff --git a/Lang/J/Ramanujan-primes-twins b/Lang/J/Ramanujan-primes-twins new file mode 120000 index 0000000000..beb021482d --- /dev/null +++ b/Lang/J/Ramanujan-primes-twins @@ -0,0 +1 @@ +../../Task/Ramanujan-primes-twins/J \ No newline at end of file diff --git a/Lang/J/Repunit-primes b/Lang/J/Repunit-primes new file mode 120000 index 0000000000..c742186f0c --- /dev/null +++ b/Lang/J/Repunit-primes @@ -0,0 +1 @@ +../../Task/Repunit-primes/J \ No newline at end of file diff --git a/Lang/J/Smarandache-Wellin-primes b/Lang/J/Smarandache-Wellin-primes new file mode 120000 index 0000000000..e1e398e815 --- /dev/null +++ b/Lang/J/Smarandache-Wellin-primes @@ -0,0 +1 @@ +../../Task/Smarandache-Wellin-primes/J \ No newline at end of file diff --git a/Lang/J/Sorting-Algorithms-Circle-Sort b/Lang/J/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index c9563959dd..0000000000 --- a/Lang/J/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/J \ No newline at end of file diff --git a/Lang/J/Wilson-primes-of-order-n b/Lang/J/Wilson-primes-of-order-n new file mode 120000 index 0000000000..7d0e5a9315 --- /dev/null +++ b/Lang/J/Wilson-primes-of-order-n @@ -0,0 +1 @@ +../../Task/Wilson-primes-of-order-n/J \ No newline at end of file diff --git a/Lang/Jactl/00-LANG.txt b/Lang/Jactl/00-LANG.txt new file mode 100644 index 0000000000..108b3303c1 --- /dev/null +++ b/Lang/Jactl/00-LANG.txt @@ -0,0 +1,8 @@ +{{stub}}{{language|Jactl}} + +Jactl is an open source scripting language that compiles to JVM byte-code. +It can be run stand-alone or embedded in Java applications. + +Documentation site: https://jactl.io + +Github repository: https://github.com/jaccomoc/jactl \ No newline at end of file diff --git a/Lang/Jactl/00-META.yaml b/Lang/Jactl/00-META.yaml new file mode 100644 index 0000000000..c4f2a6e6a8 --- /dev/null +++ b/Lang/Jactl/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Jactl diff --git a/Lang/Jactl/Apply-a-callback-to-an-array b/Lang/Jactl/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..0b25c16ea6 --- /dev/null +++ b/Lang/Jactl/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Associative-array-Creation b/Lang/Jactl/Associative-array-Creation new file mode 120000 index 0000000000..df471994d0 --- /dev/null +++ b/Lang/Jactl/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Associative-array-Iteration b/Lang/Jactl/Associative-array-Iteration new file mode 120000 index 0000000000..c89bf33985 --- /dev/null +++ b/Lang/Jactl/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Closures-Value-capture b/Lang/Jactl/Closures-Value-capture new file mode 120000 index 0000000000..838f9ae309 --- /dev/null +++ b/Lang/Jactl/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Colorful-numbers b/Lang/Jactl/Colorful-numbers new file mode 120000 index 0000000000..a03bdecce3 --- /dev/null +++ b/Lang/Jactl/Colorful-numbers @@ -0,0 +1 @@ +../../Task/Colorful-numbers/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Fibonacci-sequence b/Lang/Jactl/Fibonacci-sequence new file mode 120000 index 0000000000..6763bcee23 --- /dev/null +++ b/Lang/Jactl/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Jactl \ No newline at end of file diff --git a/Lang/Jactl/FizzBuzz b/Lang/Jactl/FizzBuzz new file mode 120000 index 0000000000..fd8d004ee0 --- /dev/null +++ b/Lang/Jactl/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Hello-world-Newline-omission b/Lang/Jactl/Hello-world-Newline-omission new file mode 120000 index 0000000000..d612b43ea9 --- /dev/null +++ b/Lang/Jactl/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Hello-world-Text b/Lang/Jactl/Hello-world-Text new file mode 120000 index 0000000000..fba754494d --- /dev/null +++ b/Lang/Jactl/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Loop-over-multiple-arrays-simultaneously b/Lang/Jactl/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..208e0c484c --- /dev/null +++ b/Lang/Jactl/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Loops-Break b/Lang/Jactl/Loops-Break new file mode 120000 index 0000000000..e1f4382462 --- /dev/null +++ b/Lang/Jactl/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Loops-Continue b/Lang/Jactl/Loops-Continue new file mode 120000 index 0000000000..d7062f586e --- /dev/null +++ b/Lang/Jactl/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Loops-Do-while b/Lang/Jactl/Loops-Do-while new file mode 120000 index 0000000000..70f4e6642c --- /dev/null +++ b/Lang/Jactl/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Loops-Downward-for b/Lang/Jactl/Loops-Downward-for new file mode 120000 index 0000000000..e955b7c7cb --- /dev/null +++ b/Lang/Jactl/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Loops-For b/Lang/Jactl/Loops-For new file mode 120000 index 0000000000..69ac8efd8b --- /dev/null +++ b/Lang/Jactl/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Loops-For-with-a-specified-step b/Lang/Jactl/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..cc4794f4cd --- /dev/null +++ b/Lang/Jactl/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Loops-Foreach b/Lang/Jactl/Loops-Foreach new file mode 120000 index 0000000000..5acefa1624 --- /dev/null +++ b/Lang/Jactl/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Loops-Increment-loop-index-within-loop-body b/Lang/Jactl/Loops-Increment-loop-index-within-loop-body new file mode 120000 index 0000000000..db9efe2bf3 --- /dev/null +++ b/Lang/Jactl/Loops-Increment-loop-index-within-loop-body @@ -0,0 +1 @@ +../../Task/Loops-Increment-loop-index-within-loop-body/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Loops-Infinite b/Lang/Jactl/Loops-Infinite new file mode 120000 index 0000000000..7f2c46419c --- /dev/null +++ b/Lang/Jactl/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Loops-N-plus-one-half b/Lang/Jactl/Loops-N-plus-one-half new file mode 120000 index 0000000000..03de5e2ce5 --- /dev/null +++ b/Lang/Jactl/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Loops-Nested b/Lang/Jactl/Loops-Nested new file mode 120000 index 0000000000..4ee2958398 --- /dev/null +++ b/Lang/Jactl/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Loops-While b/Lang/Jactl/Loops-While new file mode 120000 index 0000000000..306a1e9dea --- /dev/null +++ b/Lang/Jactl/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Selectively-replace-multiple-instances-of-a-character-within-a-string b/Lang/Jactl/Selectively-replace-multiple-instances-of-a-character-within-a-string new file mode 120000 index 0000000000..5c89cea762 --- /dev/null +++ b/Lang/Jactl/Selectively-replace-multiple-instances-of-a-character-within-a-string @@ -0,0 +1 @@ +../../Task/Selectively-replace-multiple-instances-of-a-character-within-a-string/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Sorting-algorithms-Merge-sort b/Lang/Jactl/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..f5d29cd0bd --- /dev/null +++ b/Lang/Jactl/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/Jactl \ No newline at end of file diff --git a/Lang/Jactl/Sorting-algorithms-Quicksort b/Lang/Jactl/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..6ebc4a30df --- /dev/null +++ b/Lang/Jactl/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Jactl \ No newline at end of file diff --git a/Lang/Jactl/String-interpolation-included- b/Lang/Jactl/String-interpolation-included- new file mode 120000 index 0000000000..4aeb71ddbe --- /dev/null +++ b/Lang/Jactl/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/Jactl \ No newline at end of file diff --git a/Lang/Janet/00-LANG.txt b/Lang/Janet/00-LANG.txt index 7a05c0cca0..785caf1b2c 100644 --- a/Lang/Janet/00-LANG.txt +++ b/Lang/Janet/00-LANG.txt @@ -1,7 +1,28 @@ -{{stub}}{{language|Janet}} +{{language|Janet}} -Janet is a C based, Clojure-like lisp for scripting and prototyping. +Janet is a lisp dialect meant for small systems and embedded usage. +There is no regexp built into the language, instead there is PEG, Parsing expression grammar. From the website [https://janet-lang.org https://janet-lang.org] -Janet is a functional and imperative programming language. It runs on Windows, Linux, macOS, and should run on other systems with some porting. The entire language (core library, interpreter, compiler, assembler, PEG) is about 300-500 kB and should run on many constrained systems. \ No newline at end of file +Janet is a functional and imperative programming language. It runs on Windows, Linux, macOS, BSDs, and should run on other systems with some porting. The entire language (core library, interpreter, compiler, assembler, PEG) is less than 1MB. You can also add Janet scripting to an application by embedding a single C source file and a single header. + +===Features=== + Minimal setup - one binary and you are good to go! + Builtin support for threads, networking, and an event loop + First class closures + Garbage collection + First class green threads (continuations) + Mutable and immutable arrays (array/tuple) + Mutable and immutable hashtables (table/struct) + Mutable and immutable strings (buffer/string) + Macros + Tail call optimization + Direct interop with C via abstract types and C functions + Dynamically load C libraries + Lexical scoping + REPL and interactive debugger + Parsing Expression Grammars built in to the core library + 500+ functions and macros in the core library + Export your projects to standalone executables with a companion build tool, jpm + Add to a project with just janet.c and janet.h \ No newline at end of file diff --git a/Lang/Janet/Check-input-device-is-a-terminal b/Lang/Janet/Check-input-device-is-a-terminal new file mode 120000 index 0000000000..2a4f62bb71 --- /dev/null +++ b/Lang/Janet/Check-input-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-input-device-is-a-terminal/Janet \ No newline at end of file diff --git a/Lang/Janet/Check-output-device-is-a-terminal b/Lang/Janet/Check-output-device-is-a-terminal new file mode 120000 index 0000000000..8405e395e2 --- /dev/null +++ b/Lang/Janet/Check-output-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-output-device-is-a-terminal/Janet \ No newline at end of file diff --git a/Lang/Janet/Comments b/Lang/Janet/Comments new file mode 120000 index 0000000000..b5297d4f4d --- /dev/null +++ b/Lang/Janet/Comments @@ -0,0 +1 @@ +../../Task/Comments/Janet \ No newline at end of file diff --git a/Lang/Janet/Determine-if-a-string-has-all-the-same-characters b/Lang/Janet/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..361efcff47 --- /dev/null +++ b/Lang/Janet/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/Janet \ No newline at end of file diff --git a/Lang/Janet/Digital-root b/Lang/Janet/Digital-root new file mode 120000 index 0000000000..0234a87797 --- /dev/null +++ b/Lang/Janet/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/Janet \ No newline at end of file diff --git a/Lang/Janet/Environment-variables b/Lang/Janet/Environment-variables new file mode 120000 index 0000000000..7f09b690ca --- /dev/null +++ b/Lang/Janet/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Janet \ No newline at end of file diff --git a/Lang/Janet/Loops-Infinite b/Lang/Janet/Loops-Infinite new file mode 120000 index 0000000000..6c4ed476ed --- /dev/null +++ b/Lang/Janet/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Janet \ No newline at end of file diff --git a/Lang/Janet/Nested-function b/Lang/Janet/Nested-function new file mode 120000 index 0000000000..cc57c8a9fa --- /dev/null +++ b/Lang/Janet/Nested-function @@ -0,0 +1 @@ +../../Task/Nested-function/Janet \ No newline at end of file diff --git a/Lang/Janet/Partial-function-application b/Lang/Janet/Partial-function-application new file mode 120000 index 0000000000..2936ce5923 --- /dev/null +++ b/Lang/Janet/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/Janet \ No newline at end of file diff --git a/Lang/Janet/Short-circuit-evaluation b/Lang/Janet/Short-circuit-evaluation new file mode 120000 index 0000000000..c41f99f9ac --- /dev/null +++ b/Lang/Janet/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/Janet \ No newline at end of file diff --git a/Lang/Janet/Sum-and-product-of-an-array b/Lang/Janet/Sum-and-product-of-an-array new file mode 120000 index 0000000000..798628772b --- /dev/null +++ b/Lang/Janet/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Janet \ No newline at end of file diff --git a/Lang/Java/00-LANG.txt b/Lang/Java/00-LANG.txt index 72a980a538..9df12a7429 100644 --- a/Lang/Java/00-LANG.txt +++ b/Lang/Java/00-LANG.txt @@ -41,4 +41,4 @@ Useful Java links: * [http://openjdk.java.net OpenJDK] ==Todo== -[[Reports:Tasks_not_implemented_in_Java]] \ No newline at end of file +[https://rosettacode.org/wiki/Tasks_not_implemented_in_Java Tasks not implemented in Java] \ No newline at end of file diff --git a/Lang/Java/ADFGVX-cipher b/Lang/Java/ADFGVX-cipher new file mode 120000 index 0000000000..be3b3fd305 --- /dev/null +++ b/Lang/Java/ADFGVX-cipher @@ -0,0 +1 @@ +../../Task/ADFGVX-cipher/Java \ No newline at end of file diff --git a/Lang/Java/Add-a-variable-to-a-class-instance-at-runtime b/Lang/Java/Add-a-variable-to-a-class-instance-at-runtime new file mode 120000 index 0000000000..f7446f3101 --- /dev/null +++ b/Lang/Java/Add-a-variable-to-a-class-instance-at-runtime @@ -0,0 +1 @@ +../../Task/Add-a-variable-to-a-class-instance-at-runtime/Java \ No newline at end of file diff --git a/Lang/Java/Algebraic-data-types b/Lang/Java/Algebraic-data-types new file mode 120000 index 0000000000..263f871f37 --- /dev/null +++ b/Lang/Java/Algebraic-data-types @@ -0,0 +1 @@ +../../Task/Algebraic-data-types/Java \ No newline at end of file diff --git a/Lang/Java/Arena-storage-pool b/Lang/Java/Arena-storage-pool new file mode 120000 index 0000000000..11592b83c1 --- /dev/null +++ b/Lang/Java/Arena-storage-pool @@ -0,0 +1 @@ +../../Task/Arena-storage-pool/Java \ No newline at end of file diff --git a/Lang/Java/Bioinformatics-base-count b/Lang/Java/Bioinformatics-base-count deleted file mode 120000 index a3d5761560..0000000000 --- a/Lang/Java/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Java \ No newline at end of file diff --git a/Lang/Java/Bitcoin-public-point-to-address b/Lang/Java/Bitcoin-public-point-to-address new file mode 120000 index 0000000000..cbdcab404f --- /dev/null +++ b/Lang/Java/Bitcoin-public-point-to-address @@ -0,0 +1 @@ +../../Task/Bitcoin-public-point-to-address/Java \ No newline at end of file diff --git a/Lang/Java/Bitwise-IO b/Lang/Java/Bitwise-IO new file mode 120000 index 0000000000..91887eddd0 --- /dev/null +++ b/Lang/Java/Bitwise-IO @@ -0,0 +1 @@ +../../Task/Bitwise-IO/Java \ No newline at end of file diff --git a/Lang/Java/Catmull-Clark-subdivision-surface b/Lang/Java/Catmull-Clark-subdivision-surface new file mode 120000 index 0000000000..cc0173bf86 --- /dev/null +++ b/Lang/Java/Catmull-Clark-subdivision-surface @@ -0,0 +1 @@ +../../Task/Catmull-Clark-subdivision-surface/Java \ No newline at end of file diff --git a/Lang/Java/Check-output-device-is-a-terminal b/Lang/Java/Check-output-device-is-a-terminal new file mode 120000 index 0000000000..f5afcf5e18 --- /dev/null +++ b/Lang/Java/Check-output-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-output-device-is-a-terminal/Java \ No newline at end of file diff --git a/Lang/Java/Compare-sorting-algorithms-performance b/Lang/Java/Compare-sorting-algorithms-performance new file mode 120000 index 0000000000..1c312e8af3 --- /dev/null +++ b/Lang/Java/Compare-sorting-algorithms-performance @@ -0,0 +1 @@ +../../Task/Compare-sorting-algorithms-performance/Java \ No newline at end of file diff --git a/Lang/Java/Compiler-virtual-machine-interpreter b/Lang/Java/Compiler-virtual-machine-interpreter new file mode 120000 index 0000000000..8a6c333099 --- /dev/null +++ b/Lang/Java/Compiler-virtual-machine-interpreter @@ -0,0 +1 @@ +../../Task/Compiler-virtual-machine-interpreter/Java \ No newline at end of file diff --git a/Lang/Java/Cyclops-numbers b/Lang/Java/Cyclops-numbers new file mode 120000 index 0000000000..2d9674ea30 --- /dev/null +++ b/Lang/Java/Cyclops-numbers @@ -0,0 +1 @@ +../../Task/Cyclops-numbers/Java \ No newline at end of file diff --git a/Lang/Java/Deconvolution-2D+ b/Lang/Java/Deconvolution-2D+ new file mode 120000 index 0000000000..a4641fed07 --- /dev/null +++ b/Lang/Java/Deconvolution-2D+ @@ -0,0 +1 @@ +../../Task/Deconvolution-2D+/Java \ No newline at end of file diff --git a/Lang/Java/Display-an-outline-as-a-nested-table b/Lang/Java/Display-an-outline-as-a-nested-table new file mode 120000 index 0000000000..d5f96f7b33 --- /dev/null +++ b/Lang/Java/Display-an-outline-as-a-nested-table @@ -0,0 +1 @@ +../../Task/Display-an-outline-as-a-nested-table/Java \ No newline at end of file diff --git a/Lang/Java/Dominoes b/Lang/Java/Dominoes new file mode 120000 index 0000000000..f00d194617 --- /dev/null +++ b/Lang/Java/Dominoes @@ -0,0 +1 @@ +../../Task/Dominoes/Java \ No newline at end of file diff --git a/Lang/Java/Events b/Lang/Java/Events new file mode 120000 index 0000000000..c4d1c5d403 --- /dev/null +++ b/Lang/Java/Events @@ -0,0 +1 @@ +../../Task/Events/Java \ No newline at end of file diff --git a/Lang/Java/Factorial-base-numbers-indexing-permutations-of-a-collection b/Lang/Java/Factorial-base-numbers-indexing-permutations-of-a-collection new file mode 120000 index 0000000000..e74c091aba --- /dev/null +++ b/Lang/Java/Factorial-base-numbers-indexing-permutations-of-a-collection @@ -0,0 +1 @@ +../../Task/Factorial-base-numbers-indexing-permutations-of-a-collection/Java \ No newline at end of file diff --git a/Lang/Java/Fixed-length-records b/Lang/Java/Fixed-length-records new file mode 120000 index 0000000000..8506be253e --- /dev/null +++ b/Lang/Java/Fixed-length-records @@ -0,0 +1 @@ +../../Task/Fixed-length-records/Java \ No newline at end of file diff --git a/Lang/Java/French-Republican-calendar b/Lang/Java/French-Republican-calendar new file mode 120000 index 0000000000..2451cb085a --- /dev/null +++ b/Lang/Java/French-Republican-calendar @@ -0,0 +1 @@ +../../Task/French-Republican-calendar/Java \ No newline at end of file diff --git a/Lang/Java/Im-a-software-engineer-get-me-out-of-here b/Lang/Java/Im-a-software-engineer-get-me-out-of-here new file mode 120000 index 0000000000..5e4c7fd308 --- /dev/null +++ b/Lang/Java/Im-a-software-engineer-get-me-out-of-here @@ -0,0 +1 @@ +../../Task/Im-a-software-engineer-get-me-out-of-here/Java \ No newline at end of file diff --git a/Lang/Java/Main-step-of-GOST-28147-89 b/Lang/Java/Main-step-of-GOST-28147-89 new file mode 120000 index 0000000000..1604930826 --- /dev/null +++ b/Lang/Java/Main-step-of-GOST-28147-89 @@ -0,0 +1 @@ +../../Task/Main-step-of-GOST-28147-89/Java \ No newline at end of file diff --git a/Lang/Java/Matrix-digital-rain b/Lang/Java/Matrix-digital-rain new file mode 120000 index 0000000000..e6f9c36fff --- /dev/null +++ b/Lang/Java/Matrix-digital-rain @@ -0,0 +1 @@ +../../Task/Matrix-digital-rain/Java \ No newline at end of file diff --git a/Lang/Java/Matrix-exponentiation-operator b/Lang/Java/Matrix-exponentiation-operator new file mode 120000 index 0000000000..e07ce3d287 --- /dev/null +++ b/Lang/Java/Matrix-exponentiation-operator @@ -0,0 +1 @@ +../../Task/Matrix-exponentiation-operator/Java \ No newline at end of file diff --git a/Lang/Java/Meissel-Mertens-constant b/Lang/Java/Meissel-Mertens-constant deleted file mode 120000 index f7dce3ca3d..0000000000 --- a/Lang/Java/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Java \ No newline at end of file diff --git a/Lang/Java/Miller-Rabin-primality-test b/Lang/Java/Miller-Rabin-primality-test deleted file mode 120000 index 5708188da1..0000000000 --- a/Lang/Java/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Java \ No newline at end of file diff --git a/Lang/Java/Natural-sorting b/Lang/Java/Natural-sorting new file mode 120000 index 0000000000..9f37ed8709 --- /dev/null +++ b/Lang/Java/Natural-sorting @@ -0,0 +1 @@ +../../Task/Natural-sorting/Java \ No newline at end of file diff --git a/Lang/Java/Nested-templated-data b/Lang/Java/Nested-templated-data new file mode 120000 index 0000000000..ffed37deff --- /dev/null +++ b/Lang/Java/Nested-templated-data @@ -0,0 +1 @@ +../../Task/Nested-templated-data/Java \ No newline at end of file diff --git a/Lang/Java/Numerical-and-alphabetical-suffixes b/Lang/Java/Numerical-and-alphabetical-suffixes new file mode 120000 index 0000000000..b77e52fdf7 --- /dev/null +++ b/Lang/Java/Numerical-and-alphabetical-suffixes @@ -0,0 +1 @@ +../../Task/Numerical-and-alphabetical-suffixes/Java \ No newline at end of file diff --git a/Lang/Java/Own-digits-power-sum b/Lang/Java/Own-digits-power-sum new file mode 120000 index 0000000000..52d7afdc8a --- /dev/null +++ b/Lang/Java/Own-digits-power-sum @@ -0,0 +1 @@ +../../Task/Own-digits-power-sum/Java \ No newline at end of file diff --git a/Lang/Java/P-Adic-numbers-basic b/Lang/Java/P-Adic-numbers-basic new file mode 120000 index 0000000000..eea0b73fcd --- /dev/null +++ b/Lang/Java/P-Adic-numbers-basic @@ -0,0 +1 @@ +../../Task/P-Adic-numbers-basic/Java \ No newline at end of file diff --git a/Lang/Java/P-Adic-square-roots b/Lang/Java/P-Adic-square-roots new file mode 120000 index 0000000000..768922bdbb --- /dev/null +++ b/Lang/Java/P-Adic-square-roots @@ -0,0 +1 @@ +../../Task/P-Adic-square-roots/Java \ No newline at end of file diff --git a/Lang/Java/Particle-fountain b/Lang/Java/Particle-fountain new file mode 120000 index 0000000000..4d4e5c0484 --- /dev/null +++ b/Lang/Java/Particle-fountain @@ -0,0 +1 @@ +../../Task/Particle-fountain/Java \ No newline at end of file diff --git a/Lang/Java/Quaternion-type b/Lang/Java/Quaternion-type deleted file mode 120000 index 3cf154640d..0000000000 --- a/Lang/Java/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Java \ No newline at end of file diff --git a/Lang/Java/Rendezvous b/Lang/Java/Rendezvous new file mode 120000 index 0000000000..b182a3392e --- /dev/null +++ b/Lang/Java/Rendezvous @@ -0,0 +1 @@ +../../Task/Rendezvous/Java \ No newline at end of file diff --git a/Lang/Java/Simple-turtle-graphics b/Lang/Java/Simple-turtle-graphics new file mode 120000 index 0000000000..3bc3f93a70 --- /dev/null +++ b/Lang/Java/Simple-turtle-graphics @@ -0,0 +1 @@ +../../Task/Simple-turtle-graphics/Java \ No newline at end of file diff --git a/Lang/Java/Sort-an-outline-at-every-level b/Lang/Java/Sort-an-outline-at-every-level new file mode 120000 index 0000000000..3b6d77f5c4 --- /dev/null +++ b/Lang/Java/Sort-an-outline-at-every-level @@ -0,0 +1 @@ +../../Task/Sort-an-outline-at-every-level/Java \ No newline at end of file diff --git a/Lang/Java/Sorting-Algorithms-Circle-Sort b/Lang/Java/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 2c7141e7c3..0000000000 --- a/Lang/Java/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Java \ No newline at end of file diff --git a/Lang/Java/Strassens-algorithm b/Lang/Java/Strassens-algorithm new file mode 120000 index 0000000000..1c8b3f279b --- /dev/null +++ b/Lang/Java/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Java \ No newline at end of file diff --git a/Lang/Java/Suffixation-of-decimal-numbers b/Lang/Java/Suffixation-of-decimal-numbers new file mode 120000 index 0000000000..a2b82d2da9 --- /dev/null +++ b/Lang/Java/Suffixation-of-decimal-numbers @@ -0,0 +1 @@ +../../Task/Suffixation-of-decimal-numbers/Java \ No newline at end of file diff --git a/Lang/Java/Summarize-primes b/Lang/Java/Summarize-primes new file mode 120000 index 0000000000..baf8f07205 --- /dev/null +++ b/Lang/Java/Summarize-primes @@ -0,0 +1 @@ +../../Task/Summarize-primes/Java \ No newline at end of file diff --git a/Lang/Java/Sylvesters-sequence b/Lang/Java/Sylvesters-sequence new file mode 120000 index 0000000000..6dfb05d095 --- /dev/null +++ b/Lang/Java/Sylvesters-sequence @@ -0,0 +1 @@ +../../Task/Sylvesters-sequence/Java \ No newline at end of file diff --git a/Lang/Java/Table-creation-Postal-addresses b/Lang/Java/Table-creation-Postal-addresses new file mode 120000 index 0000000000..7dc553f160 --- /dev/null +++ b/Lang/Java/Table-creation-Postal-addresses @@ -0,0 +1 @@ +../../Task/Table-creation-Postal-addresses/Java \ No newline at end of file diff --git a/Lang/Java/Topic-variable b/Lang/Java/Topic-variable new file mode 120000 index 0000000000..25c03be6d5 --- /dev/null +++ b/Lang/Java/Topic-variable @@ -0,0 +1 @@ +../../Task/Topic-variable/Java \ No newline at end of file diff --git a/Lang/Java/Transliterate-English-text-using-the-Greek-alphabet b/Lang/Java/Transliterate-English-text-using-the-Greek-alphabet new file mode 120000 index 0000000000..bf7b1fc92f --- /dev/null +++ b/Lang/Java/Transliterate-English-text-using-the-Greek-alphabet @@ -0,0 +1 @@ +../../Task/Transliterate-English-text-using-the-Greek-alphabet/Java \ No newline at end of file diff --git a/Lang/Java/Tree-datastructures b/Lang/Java/Tree-datastructures new file mode 120000 index 0000000000..3d759a4708 --- /dev/null +++ b/Lang/Java/Tree-datastructures @@ -0,0 +1 @@ +../../Task/Tree-datastructures/Java \ No newline at end of file diff --git a/Lang/Java/Ukkonen-s-suffix-tree-construction b/Lang/Java/Ukkonen-s-suffix-tree-construction new file mode 120000 index 0000000000..8d58725601 --- /dev/null +++ b/Lang/Java/Ukkonen-s-suffix-tree-construction @@ -0,0 +1 @@ +../../Task/Ukkonen-s-suffix-tree-construction/Java \ No newline at end of file diff --git a/Lang/Java/Untouchable-numbers b/Lang/Java/Untouchable-numbers new file mode 120000 index 0000000000..4fdd94665a --- /dev/null +++ b/Lang/Java/Untouchable-numbers @@ -0,0 +1 @@ +../../Task/Untouchable-numbers/Java \ No newline at end of file diff --git a/Lang/Java/Variable-size-Set b/Lang/Java/Variable-size-Set new file mode 120000 index 0000000000..7321e05f76 --- /dev/null +++ b/Lang/Java/Variable-size-Set @@ -0,0 +1 @@ +../../Task/Variable-size-Set/Java \ No newline at end of file diff --git a/Lang/Java/Wasteful-equidigital-and-frugal-numbers b/Lang/Java/Wasteful-equidigital-and-frugal-numbers new file mode 120000 index 0000000000..cbd9f1bf78 --- /dev/null +++ b/Lang/Java/Wasteful-equidigital-and-frugal-numbers @@ -0,0 +1 @@ +../../Task/Wasteful-equidigital-and-frugal-numbers/Java \ No newline at end of file diff --git a/Lang/Java/Wordiff b/Lang/Java/Wordiff new file mode 120000 index 0000000000..1acc7da1bd --- /dev/null +++ b/Lang/Java/Wordiff @@ -0,0 +1 @@ +../../Task/Wordiff/Java \ No newline at end of file diff --git a/Lang/JavaScript/00-LANG.txt b/Lang/JavaScript/00-LANG.txt index 3906eaab39..a610363714 100644 --- a/Lang/JavaScript/00-LANG.txt +++ b/Lang/JavaScript/00-LANG.txt @@ -28,4 +28,7 @@ The inclusion of '''tail-call optimisation''' in the ES6 standard reflects incre * [https://developer.apple.com/library/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/Articles/Introduction.html OS X JavaScript for Applications] JavaScript as an OS X scripting language – supported by the Safari debugger * [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Shells Other JavaScript shells] List maintained by Mozilla * [https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js List of languages that compile to JS] maintained on Github by Jeremy Ashenas – author of CoffeeScript, Underscore and Backbone -* [http://shop.oreilly.com/product/0636920028857.do Functional JavaScript] – Michael Fogus, O'Reilly 2013 \ No newline at end of file +* [http://shop.oreilly.com/product/0636920028857.do Functional JavaScript] – Michael Fogus, O'Reilly 2013 + +==To do== +[[Tasks not implemented in JavaScript]] \ No newline at end of file diff --git a/Lang/JavaScript/15-puzzle-solver b/Lang/JavaScript/15-puzzle-solver new file mode 120000 index 0000000000..34b980cd29 --- /dev/null +++ b/Lang/JavaScript/15-puzzle-solver @@ -0,0 +1 @@ +../../Task/15-puzzle-solver/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/ADFGVX-cipher b/Lang/JavaScript/ADFGVX-cipher new file mode 120000 index 0000000000..eeef4038b2 --- /dev/null +++ b/Lang/JavaScript/ADFGVX-cipher @@ -0,0 +1 @@ +../../Task/ADFGVX-cipher/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Achilles-numbers b/Lang/JavaScript/Achilles-numbers new file mode 120000 index 0000000000..0c343baad5 --- /dev/null +++ b/Lang/JavaScript/Achilles-numbers @@ -0,0 +1 @@ +../../Task/Achilles-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Aliquot-sequence-classifications b/Lang/JavaScript/Aliquot-sequence-classifications new file mode 120000 index 0000000000..5043f9bf29 --- /dev/null +++ b/Lang/JavaScript/Aliquot-sequence-classifications @@ -0,0 +1 @@ +../../Task/Aliquot-sequence-classifications/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Arithmetic-geometric-mean-Calculate-Pi b/Lang/JavaScript/Arithmetic-geometric-mean-Calculate-Pi new file mode 120000 index 0000000000..28dcd16b9c --- /dev/null +++ b/Lang/JavaScript/Arithmetic-geometric-mean-Calculate-Pi @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean-Calculate-Pi/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Arithmetic-numbers b/Lang/JavaScript/Arithmetic-numbers new file mode 120000 index 0000000000..ca8b16d782 --- /dev/null +++ b/Lang/JavaScript/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Average-loop-length b/Lang/JavaScript/Average-loop-length new file mode 120000 index 0000000000..c1bd894dc5 --- /dev/null +++ b/Lang/JavaScript/Average-loop-length @@ -0,0 +1 @@ +../../Task/Average-loop-length/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/B-zier-curves-Intersections b/Lang/JavaScript/B-zier-curves-Intersections new file mode 120000 index 0000000000..e14b622f07 --- /dev/null +++ b/Lang/JavaScript/B-zier-curves-Intersections @@ -0,0 +1 @@ +../../Task/B-zier-curves-Intersections/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Babylonian-spiral b/Lang/JavaScript/Babylonian-spiral new file mode 120000 index 0000000000..c1ab7a098f --- /dev/null +++ b/Lang/JavaScript/Babylonian-spiral @@ -0,0 +1 @@ +../../Task/Babylonian-spiral/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Balanced-ternary b/Lang/JavaScript/Balanced-ternary new file mode 120000 index 0000000000..c71298b653 --- /dev/null +++ b/Lang/JavaScript/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Bell-numbers b/Lang/JavaScript/Bell-numbers new file mode 120000 index 0000000000..d4be94731e --- /dev/null +++ b/Lang/JavaScript/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Bernoulli-numbers b/Lang/JavaScript/Bernoulli-numbers new file mode 120000 index 0000000000..96368f729e --- /dev/null +++ b/Lang/JavaScript/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Bifid-cipher b/Lang/JavaScript/Bifid-cipher new file mode 120000 index 0000000000..837e122e66 --- /dev/null +++ b/Lang/JavaScript/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Bioinformatics-base-count b/Lang/JavaScript/Bioinformatics-base-count deleted file mode 120000 index 033fba4ffa..0000000000 --- a/Lang/JavaScript/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Bitcoin-address-validation b/Lang/JavaScript/Bitcoin-address-validation new file mode 120000 index 0000000000..d09d433cd8 --- /dev/null +++ b/Lang/JavaScript/Bitcoin-address-validation @@ -0,0 +1 @@ +../../Task/Bitcoin-address-validation/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Bitcoin-public-point-to-address b/Lang/JavaScript/Bitcoin-public-point-to-address new file mode 120000 index 0000000000..c3f037151b --- /dev/null +++ b/Lang/JavaScript/Bitcoin-public-point-to-address @@ -0,0 +1 @@ +../../Task/Bitcoin-public-point-to-address/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Boyer-Moore-string-search b/Lang/JavaScript/Boyer-Moore-string-search new file mode 120000 index 0000000000..b25016942d --- /dev/null +++ b/Lang/JavaScript/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Brazilian-numbers b/Lang/JavaScript/Brazilian-numbers new file mode 120000 index 0000000000..a5d5cf431a --- /dev/null +++ b/Lang/JavaScript/Brazilian-numbers @@ -0,0 +1 @@ +../../Task/Brazilian-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Break-OO-privacy b/Lang/JavaScript/Break-OO-privacy new file mode 120000 index 0000000000..085d7969ff --- /dev/null +++ b/Lang/JavaScript/Break-OO-privacy @@ -0,0 +1 @@ +../../Task/Break-OO-privacy/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Brilliant-numbers b/Lang/JavaScript/Brilliant-numbers new file mode 120000 index 0000000000..447591badd --- /dev/null +++ b/Lang/JavaScript/Brilliant-numbers @@ -0,0 +1 @@ +../../Task/Brilliant-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Burrows-Wheeler-transform b/Lang/JavaScript/Burrows-Wheeler-transform new file mode 120000 index 0000000000..79a79f877d --- /dev/null +++ b/Lang/JavaScript/Burrows-Wheeler-transform @@ -0,0 +1 @@ +../../Task/Burrows-Wheeler-transform/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Calkin-Wilf-sequence b/Lang/JavaScript/Calkin-Wilf-sequence new file mode 120000 index 0000000000..3eaf3f5375 --- /dev/null +++ b/Lang/JavaScript/Calkin-Wilf-sequence @@ -0,0 +1 @@ +../../Task/Calkin-Wilf-sequence/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Camel-case-and-snake-case b/Lang/JavaScript/Camel-case-and-snake-case new file mode 120000 index 0000000000..0e52d396b8 --- /dev/null +++ b/Lang/JavaScript/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Carmichael-3-strong-pseudoprimes b/Lang/JavaScript/Carmichael-3-strong-pseudoprimes new file mode 120000 index 0000000000..a3d0ffd992 --- /dev/null +++ b/Lang/JavaScript/Carmichael-3-strong-pseudoprimes @@ -0,0 +1 @@ +../../Task/Carmichael-3-strong-pseudoprimes/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Catmull-Clark-subdivision-surface b/Lang/JavaScript/Catmull-Clark-subdivision-surface new file mode 120000 index 0000000000..40bf4ef0fc --- /dev/null +++ b/Lang/JavaScript/Catmull-Clark-subdivision-surface @@ -0,0 +1 @@ +../../Task/Catmull-Clark-subdivision-surface/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Check-output-device-is-a-terminal b/Lang/JavaScript/Check-output-device-is-a-terminal new file mode 120000 index 0000000000..0efca1a6ff --- /dev/null +++ b/Lang/JavaScript/Check-output-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-output-device-is-a-terminal/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Checkpoint-synchronization b/Lang/JavaScript/Checkpoint-synchronization new file mode 120000 index 0000000000..cf18aef6aa --- /dev/null +++ b/Lang/JavaScript/Checkpoint-synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint-synchronization/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Chernicks-Carmichael-numbers b/Lang/JavaScript/Chernicks-Carmichael-numbers new file mode 120000 index 0000000000..45e47ff0f0 --- /dev/null +++ b/Lang/JavaScript/Chernicks-Carmichael-numbers @@ -0,0 +1 @@ +../../Task/Chernicks-Carmichael-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Chowla-numbers b/Lang/JavaScript/Chowla-numbers new file mode 120000 index 0000000000..44b573de9f --- /dev/null +++ b/Lang/JavaScript/Chowla-numbers @@ -0,0 +1 @@ +../../Task/Chowla-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Circular-primes b/Lang/JavaScript/Circular-primes new file mode 120000 index 0000000000..ce0d83b0b4 --- /dev/null +++ b/Lang/JavaScript/Circular-primes @@ -0,0 +1 @@ +../../Task/Circular-primes/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Colorful-numbers b/Lang/JavaScript/Colorful-numbers new file mode 120000 index 0000000000..861658de92 --- /dev/null +++ b/Lang/JavaScript/Colorful-numbers @@ -0,0 +1 @@ +../../Task/Colorful-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Commatizing-numbers b/Lang/JavaScript/Commatizing-numbers new file mode 120000 index 0000000000..dac4a7f279 --- /dev/null +++ b/Lang/JavaScript/Commatizing-numbers @@ -0,0 +1 @@ +../../Task/Commatizing-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Compiler-code-generator b/Lang/JavaScript/Compiler-code-generator new file mode 120000 index 0000000000..7b6f8e25b0 --- /dev/null +++ b/Lang/JavaScript/Compiler-code-generator @@ -0,0 +1 @@ +../../Task/Compiler-code-generator/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k b/Lang/JavaScript/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k new file mode 120000 index 0000000000..2b7b501bb6 --- /dev/null +++ b/Lang/JavaScript/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k @@ -0,0 +1 @@ +../../Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Continued-fraction b/Lang/JavaScript/Continued-fraction new file mode 120000 index 0000000000..73bc586c57 --- /dev/null +++ b/Lang/JavaScript/Continued-fraction @@ -0,0 +1 @@ +../../Task/Continued-fraction/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Continued-fraction-Arithmetic-Construct-from-rational-number b/Lang/JavaScript/Continued-fraction-Arithmetic-Construct-from-rational-number new file mode 120000 index 0000000000..b87cd7b6a5 --- /dev/null +++ b/Lang/JavaScript/Continued-fraction-Arithmetic-Construct-from-rational-number @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-Construct-from-rational-number/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- b/Lang/JavaScript/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- new file mode 120000 index 0000000000..95862446c9 --- /dev/null +++ b/Lang/JavaScript/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n-/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Create-a-file-on-magnetic-tape b/Lang/JavaScript/Create-a-file-on-magnetic-tape new file mode 120000 index 0000000000..0f15206dcf --- /dev/null +++ b/Lang/JavaScript/Create-a-file-on-magnetic-tape @@ -0,0 +1 @@ +../../Task/Create-a-file-on-magnetic-tape/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Cuban-primes b/Lang/JavaScript/Cuban-primes new file mode 120000 index 0000000000..4659a4500f --- /dev/null +++ b/Lang/JavaScript/Cuban-primes @@ -0,0 +1 @@ +../../Task/Cuban-primes/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Cullen-and-Woodall-numbers b/Lang/JavaScript/Cullen-and-Woodall-numbers new file mode 120000 index 0000000000..7d700fedb9 --- /dev/null +++ b/Lang/JavaScript/Cullen-and-Woodall-numbers @@ -0,0 +1 @@ +../../Task/Cullen-and-Woodall-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Curzon-numbers b/Lang/JavaScript/Curzon-numbers new file mode 120000 index 0000000000..5d5da06bda --- /dev/null +++ b/Lang/JavaScript/Curzon-numbers @@ -0,0 +1 @@ +../../Task/Curzon-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Cyclops-numbers b/Lang/JavaScript/Cyclops-numbers new file mode 120000 index 0000000000..6c3c7fc0d0 --- /dev/null +++ b/Lang/JavaScript/Cyclops-numbers @@ -0,0 +1 @@ +../../Task/Cyclops-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Cyclotomic-polynomial b/Lang/JavaScript/Cyclotomic-polynomial new file mode 120000 index 0000000000..1407b6559c --- /dev/null +++ b/Lang/JavaScript/Cyclotomic-polynomial @@ -0,0 +1 @@ +../../Task/Cyclotomic-polynomial/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/De-Bruijn-sequences b/Lang/JavaScript/De-Bruijn-sequences new file mode 120000 index 0000000000..d753d9f9d0 --- /dev/null +++ b/Lang/JavaScript/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Deconvolution-1D b/Lang/JavaScript/Deconvolution-1D new file mode 120000 index 0000000000..719c208ec2 --- /dev/null +++ b/Lang/JavaScript/Deconvolution-1D @@ -0,0 +1 @@ +../../Task/Deconvolution-1D/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Deconvolution-2D+ b/Lang/JavaScript/Deconvolution-2D+ new file mode 120000 index 0000000000..61f93d9cd6 --- /dev/null +++ b/Lang/JavaScript/Deconvolution-2D+ @@ -0,0 +1 @@ +../../Task/Deconvolution-2D+/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Demings-funnel b/Lang/JavaScript/Demings-funnel new file mode 120000 index 0000000000..6225280d4a --- /dev/null +++ b/Lang/JavaScript/Demings-funnel @@ -0,0 +1 @@ +../../Task/Demings-funnel/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Digital-root-Multiplicative-digital-root b/Lang/JavaScript/Digital-root-Multiplicative-digital-root new file mode 120000 index 0000000000..6bac52bd37 --- /dev/null +++ b/Lang/JavaScript/Digital-root-Multiplicative-digital-root @@ -0,0 +1 @@ +../../Task/Digital-root-Multiplicative-digital-root/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Display-a-linear-combination b/Lang/JavaScript/Display-a-linear-combination new file mode 120000 index 0000000000..4b7084cb84 --- /dev/null +++ b/Lang/JavaScript/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Distribution-of-0-digits-in-factorial-series b/Lang/JavaScript/Distribution-of-0-digits-in-factorial-series new file mode 120000 index 0000000000..3fd7f0feb5 --- /dev/null +++ b/Lang/JavaScript/Distribution-of-0-digits-in-factorial-series @@ -0,0 +1 @@ +../../Task/Distribution-of-0-digits-in-factorial-series/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Dominoes b/Lang/JavaScript/Dominoes new file mode 120000 index 0000000000..240a06d327 --- /dev/null +++ b/Lang/JavaScript/Dominoes @@ -0,0 +1 @@ +../../Task/Dominoes/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Doomsday-rule b/Lang/JavaScript/Doomsday-rule new file mode 120000 index 0000000000..53e067c157 --- /dev/null +++ b/Lang/JavaScript/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Duffinian-numbers b/Lang/JavaScript/Duffinian-numbers new file mode 120000 index 0000000000..852d875370 --- /dev/null +++ b/Lang/JavaScript/Duffinian-numbers @@ -0,0 +1 @@ +../../Task/Duffinian-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/EKG-sequence-convergence b/Lang/JavaScript/EKG-sequence-convergence new file mode 120000 index 0000000000..2eef93ef6c --- /dev/null +++ b/Lang/JavaScript/EKG-sequence-convergence @@ -0,0 +1 @@ +../../Task/EKG-sequence-convergence/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Eban-numbers b/Lang/JavaScript/Eban-numbers new file mode 120000 index 0000000000..584fb39bde --- /dev/null +++ b/Lang/JavaScript/Eban-numbers @@ -0,0 +1 @@ +../../Task/Eban-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Eertree b/Lang/JavaScript/Eertree new file mode 120000 index 0000000000..60ff5de55f --- /dev/null +++ b/Lang/JavaScript/Eertree @@ -0,0 +1 @@ +../../Task/Eertree/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Element-wise-operations b/Lang/JavaScript/Element-wise-operations new file mode 120000 index 0000000000..179f9154f4 --- /dev/null +++ b/Lang/JavaScript/Element-wise-operations @@ -0,0 +1 @@ +../../Task/Element-wise-operations/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Elliptic-Curve-Digital-Signature-Algorithm b/Lang/JavaScript/Elliptic-Curve-Digital-Signature-Algorithm new file mode 120000 index 0000000000..b9a9906259 --- /dev/null +++ b/Lang/JavaScript/Elliptic-Curve-Digital-Signature-Algorithm @@ -0,0 +1 @@ +../../Task/Elliptic-Curve-Digital-Signature-Algorithm/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Elliptic-curve-arithmetic b/Lang/JavaScript/Elliptic-curve-arithmetic new file mode 120000 index 0000000000..41de6c075f --- /dev/null +++ b/Lang/JavaScript/Elliptic-curve-arithmetic @@ -0,0 +1 @@ +../../Task/Elliptic-curve-arithmetic/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Erd-s-Nicolas-numbers b/Lang/JavaScript/Erd-s-Nicolas-numbers new file mode 120000 index 0000000000..2d8924574b --- /dev/null +++ b/Lang/JavaScript/Erd-s-Nicolas-numbers @@ -0,0 +1 @@ +../../Task/Erd-s-Nicolas-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Erd-s-Selfridge-categorization-of-primes b/Lang/JavaScript/Erd-s-Selfridge-categorization-of-primes new file mode 120000 index 0000000000..376367be26 --- /dev/null +++ b/Lang/JavaScript/Erd-s-Selfridge-categorization-of-primes @@ -0,0 +1 @@ +../../Task/Erd-s-Selfridge-categorization-of-primes/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Euclid-Mullin-sequence b/Lang/JavaScript/Euclid-Mullin-sequence new file mode 120000 index 0000000000..f2430affeb --- /dev/null +++ b/Lang/JavaScript/Euclid-Mullin-sequence @@ -0,0 +1 @@ +../../Task/Euclid-Mullin-sequence/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Eulers-constant-0.5772... b/Lang/JavaScript/Eulers-constant-0.5772... new file mode 120000 index 0000000000..3aac1cafba --- /dev/null +++ b/Lang/JavaScript/Eulers-constant-0.5772... @@ -0,0 +1 @@ +../../Task/Eulers-constant-0.5772.../JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Exponentiation-order b/Lang/JavaScript/Exponentiation-order new file mode 120000 index 0000000000..a3de1259b9 --- /dev/null +++ b/Lang/JavaScript/Exponentiation-order @@ -0,0 +1 @@ +../../Task/Exponentiation-order/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Exponentiation-with-infix-operators-in-or-operating-on-the-base b/Lang/JavaScript/Exponentiation-with-infix-operators-in-or-operating-on-the-base new file mode 120000 index 0000000000..d16e5defb5 --- /dev/null +++ b/Lang/JavaScript/Exponentiation-with-infix-operators-in-or-operating-on-the-base @@ -0,0 +1 @@ +../../Task/Exponentiation-with-infix-operators-in-or-operating-on-the-base/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Factorial-base-numbers-indexing-permutations-of-a-collection b/Lang/JavaScript/Factorial-base-numbers-indexing-permutations-of-a-collection new file mode 120000 index 0000000000..7b4e06b0ab --- /dev/null +++ b/Lang/JavaScript/Factorial-base-numbers-indexing-permutations-of-a-collection @@ -0,0 +1 @@ +../../Task/Factorial-base-numbers-indexing-permutations-of-a-collection/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Factorions b/Lang/JavaScript/Factorions new file mode 120000 index 0000000000..d7c8ae41c4 --- /dev/null +++ b/Lang/JavaScript/Factorions @@ -0,0 +1 @@ +../../Task/Factorions/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Farey-sequence b/Lang/JavaScript/Farey-sequence new file mode 120000 index 0000000000..e324d68d34 --- /dev/null +++ b/Lang/JavaScript/Farey-sequence @@ -0,0 +1 @@ +../../Task/Farey-sequence/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Faulhabers-formula b/Lang/JavaScript/Faulhabers-formula new file mode 120000 index 0000000000..547452171f --- /dev/null +++ b/Lang/JavaScript/Faulhabers-formula @@ -0,0 +1 @@ +../../Task/Faulhabers-formula/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Fermat-numbers b/Lang/JavaScript/Fermat-numbers new file mode 120000 index 0000000000..14c8b8d697 --- /dev/null +++ b/Lang/JavaScript/Fermat-numbers @@ -0,0 +1 @@ +../../Task/Fermat-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Find-if-a-point-is-within-a-triangle b/Lang/JavaScript/Find-if-a-point-is-within-a-triangle new file mode 120000 index 0000000000..1aa2b1052e --- /dev/null +++ b/Lang/JavaScript/Find-if-a-point-is-within-a-triangle @@ -0,0 +1 @@ +../../Task/Find-if-a-point-is-within-a-triangle/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Fraction-reduction b/Lang/JavaScript/Fraction-reduction new file mode 120000 index 0000000000..f3f2ab2629 --- /dev/null +++ b/Lang/JavaScript/Fraction-reduction @@ -0,0 +1 @@ +../../Task/Fraction-reduction/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/French-Republican-calendar b/Lang/JavaScript/French-Republican-calendar new file mode 120000 index 0000000000..b3233aa527 --- /dev/null +++ b/Lang/JavaScript/French-Republican-calendar @@ -0,0 +1 @@ +../../Task/French-Republican-calendar/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Gauss-Jordan-matrix-inversion b/Lang/JavaScript/Gauss-Jordan-matrix-inversion new file mode 120000 index 0000000000..77acac5de4 --- /dev/null +++ b/Lang/JavaScript/Gauss-Jordan-matrix-inversion @@ -0,0 +1 @@ +../../Task/Gauss-Jordan-matrix-inversion/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Giuga-numbers b/Lang/JavaScript/Giuga-numbers new file mode 120000 index 0000000000..757d93b792 --- /dev/null +++ b/Lang/JavaScript/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Graph-colouring b/Lang/JavaScript/Graph-colouring new file mode 120000 index 0000000000..8c22e6e014 --- /dev/null +++ b/Lang/JavaScript/Graph-colouring @@ -0,0 +1 @@ +../../Task/Graph-colouring/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Greedy-algorithm-for-Egyptian-fractions b/Lang/JavaScript/Greedy-algorithm-for-Egyptian-fractions new file mode 120000 index 0000000000..4b7a0299ee --- /dev/null +++ b/Lang/JavaScript/Greedy-algorithm-for-Egyptian-fractions @@ -0,0 +1 @@ +../../Task/Greedy-algorithm-for-Egyptian-fractions/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Halt-and-catch-fire b/Lang/JavaScript/Halt-and-catch-fire new file mode 120000 index 0000000000..34a6fcf7d2 --- /dev/null +++ b/Lang/JavaScript/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Home-primes b/Lang/JavaScript/Home-primes new file mode 120000 index 0000000000..903d43b23e --- /dev/null +++ b/Lang/JavaScript/Home-primes @@ -0,0 +1 @@ +../../Task/Home-primes/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Horizontal-sundial-calculations b/Lang/JavaScript/Horizontal-sundial-calculations new file mode 120000 index 0000000000..854f95761b --- /dev/null +++ b/Lang/JavaScript/Horizontal-sundial-calculations @@ -0,0 +1 @@ +../../Task/Horizontal-sundial-calculations/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/ISBN13-check-digit b/Lang/JavaScript/ISBN13-check-digit new file mode 120000 index 0000000000..a76c26065c --- /dev/null +++ b/Lang/JavaScript/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Isqrt-integer-square-root-of-X b/Lang/JavaScript/Isqrt-integer-square-root-of-X new file mode 120000 index 0000000000..7c262657f5 --- /dev/null +++ b/Lang/JavaScript/Isqrt-integer-square-root-of-X @@ -0,0 +1 @@ +../../Task/Isqrt-integer-square-root-of-X/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Jacobi-symbol b/Lang/JavaScript/Jacobi-symbol new file mode 120000 index 0000000000..7ca750b7ca --- /dev/null +++ b/Lang/JavaScript/Jacobi-symbol @@ -0,0 +1 @@ +../../Task/Jacobi-symbol/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Jaro-Winkler-distance b/Lang/JavaScript/Jaro-Winkler-distance new file mode 120000 index 0000000000..48d79ffb3b --- /dev/null +++ b/Lang/JavaScript/Jaro-Winkler-distance @@ -0,0 +1 @@ +../../Task/Jaro-Winkler-distance/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Jaro-similarity b/Lang/JavaScript/Jaro-similarity new file mode 120000 index 0000000000..72e11e0e2b --- /dev/null +++ b/Lang/JavaScript/Jaro-similarity @@ -0,0 +1 @@ +../../Task/Jaro-similarity/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Jordan-P-lya-numbers b/Lang/JavaScript/Jordan-P-lya-numbers new file mode 120000 index 0000000000..1c850674c3 --- /dev/null +++ b/Lang/JavaScript/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/K-d-tree b/Lang/JavaScript/K-d-tree new file mode 120000 index 0000000000..f551f8aa55 --- /dev/null +++ b/Lang/JavaScript/K-d-tree @@ -0,0 +1 @@ +../../Task/K-d-tree/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Knuths-algorithm-S b/Lang/JavaScript/Knuths-algorithm-S new file mode 120000 index 0000000000..78ce9e9420 --- /dev/null +++ b/Lang/JavaScript/Knuths-algorithm-S @@ -0,0 +1 @@ +../../Task/Knuths-algorithm-S/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Knuths-power-tree b/Lang/JavaScript/Knuths-power-tree new file mode 120000 index 0000000000..65f212b8ef --- /dev/null +++ b/Lang/JavaScript/Knuths-power-tree @@ -0,0 +1 @@ +../../Task/Knuths-power-tree/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Kolakoski-sequence b/Lang/JavaScript/Kolakoski-sequence new file mode 120000 index 0000000000..eac78035ff --- /dev/null +++ b/Lang/JavaScript/Kolakoski-sequence @@ -0,0 +1 @@ +../../Task/Kolakoski-sequence/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Kosaraju b/Lang/JavaScript/Kosaraju new file mode 120000 index 0000000000..679452fdc1 --- /dev/null +++ b/Lang/JavaScript/Kosaraju @@ -0,0 +1 @@ +../../Task/Kosaraju/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Largest-number-divisible-by-its-digits b/Lang/JavaScript/Largest-number-divisible-by-its-digits new file mode 120000 index 0000000000..04fdf583a0 --- /dev/null +++ b/Lang/JavaScript/Largest-number-divisible-by-its-digits @@ -0,0 +1 @@ +../../Task/Largest-number-divisible-by-its-digits/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Largest-proper-divisor-of-n b/Lang/JavaScript/Largest-proper-divisor-of-n new file mode 120000 index 0000000000..3f1ca809f7 --- /dev/null +++ b/Lang/JavaScript/Largest-proper-divisor-of-n @@ -0,0 +1 @@ +../../Task/Largest-proper-divisor-of-n/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Levenshtein-distance-Alignment b/Lang/JavaScript/Levenshtein-distance-Alignment new file mode 120000 index 0000000000..fabac4db0b --- /dev/null +++ b/Lang/JavaScript/Levenshtein-distance-Alignment @@ -0,0 +1 @@ +../../Task/Levenshtein-distance-Alignment/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Linear-congruential-generator b/Lang/JavaScript/Linear-congruential-generator new file mode 120000 index 0000000000..9664d4ce1d --- /dev/null +++ b/Lang/JavaScript/Linear-congruential-generator @@ -0,0 +1 @@ +../../Task/Linear-congruential-generator/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Literals-Floating-point b/Lang/JavaScript/Literals-Floating-point new file mode 120000 index 0000000000..d4ebfbadf6 --- /dev/null +++ b/Lang/JavaScript/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Long-literals-with-continuations b/Lang/JavaScript/Long-literals-with-continuations new file mode 120000 index 0000000000..51b7c2433b --- /dev/null +++ b/Lang/JavaScript/Long-literals-with-continuations @@ -0,0 +1 @@ +../../Task/Long-literals-with-continuations/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Loops-With-multiple-ranges b/Lang/JavaScript/Loops-With-multiple-ranges new file mode 120000 index 0000000000..0fe86f1b4e --- /dev/null +++ b/Lang/JavaScript/Loops-With-multiple-ranges @@ -0,0 +1 @@ +../../Task/Loops-With-multiple-ranges/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Loops-Wrong-ranges b/Lang/JavaScript/Loops-Wrong-ranges new file mode 120000 index 0000000000..285ca2bf4f --- /dev/null +++ b/Lang/JavaScript/Loops-Wrong-ranges @@ -0,0 +1 @@ +../../Task/Loops-Wrong-ranges/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Lychrel-numbers b/Lang/JavaScript/Lychrel-numbers new file mode 120000 index 0000000000..ddc0a3b2ae --- /dev/null +++ b/Lang/JavaScript/Lychrel-numbers @@ -0,0 +1 @@ +../../Task/Lychrel-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/M-bius-function b/Lang/JavaScript/M-bius-function new file mode 120000 index 0000000000..8b88e437b9 --- /dev/null +++ b/Lang/JavaScript/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/MD5 b/Lang/JavaScript/MD5 new file mode 120000 index 0000000000..764b1e5dd2 --- /dev/null +++ b/Lang/JavaScript/MD5 @@ -0,0 +1 @@ +../../Task/MD5/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/MD5-Implementation b/Lang/JavaScript/MD5-Implementation new file mode 120000 index 0000000000..96da37623c --- /dev/null +++ b/Lang/JavaScript/MD5-Implementation @@ -0,0 +1 @@ +../../Task/MD5-Implementation/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Magic-constant b/Lang/JavaScript/Magic-constant new file mode 120000 index 0000000000..93ac503011 --- /dev/null +++ b/Lang/JavaScript/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Memory-layout-of-a-data-structure b/Lang/JavaScript/Memory-layout-of-a-data-structure new file mode 120000 index 0000000000..40a22a351b --- /dev/null +++ b/Lang/JavaScript/Memory-layout-of-a-data-structure @@ -0,0 +1 @@ +../../Task/Memory-layout-of-a-data-structure/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Merge-and-aggregate-datasets b/Lang/JavaScript/Merge-and-aggregate-datasets new file mode 120000 index 0000000000..d1ec3fd3c7 --- /dev/null +++ b/Lang/JavaScript/Merge-and-aggregate-datasets @@ -0,0 +1 @@ +../../Task/Merge-and-aggregate-datasets/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Miller-Rabin-primality-test b/Lang/JavaScript/Miller-Rabin-primality-test deleted file mode 120000 index 41f625032e..0000000000 --- a/Lang/JavaScript/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Modified-random-distribution b/Lang/JavaScript/Modified-random-distribution new file mode 120000 index 0000000000..e8810a8ff3 --- /dev/null +++ b/Lang/JavaScript/Modified-random-distribution @@ -0,0 +1 @@ +../../Task/Modified-random-distribution/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Motzkin-numbers b/Lang/JavaScript/Motzkin-numbers new file mode 120000 index 0000000000..f887ca66ad --- /dev/null +++ b/Lang/JavaScript/Motzkin-numbers @@ -0,0 +1 @@ +../../Task/Motzkin-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Numeric-error-propagation b/Lang/JavaScript/Numeric-error-propagation new file mode 120000 index 0000000000..4c3115218f --- /dev/null +++ b/Lang/JavaScript/Numeric-error-propagation @@ -0,0 +1 @@ +../../Task/Numeric-error-propagation/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Numerical-integration b/Lang/JavaScript/Numerical-integration new file mode 120000 index 0000000000..b80325338d --- /dev/null +++ b/Lang/JavaScript/Numerical-integration @@ -0,0 +1 @@ +../../Task/Numerical-integration/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Old-lady-swallowed-a-fly b/Lang/JavaScript/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..a49e302025 --- /dev/null +++ b/Lang/JavaScript/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Own-digits-power-sum b/Lang/JavaScript/Own-digits-power-sum new file mode 120000 index 0000000000..af2067363a --- /dev/null +++ b/Lang/JavaScript/Own-digits-power-sum @@ -0,0 +1 @@ +../../Task/Own-digits-power-sum/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/P-Adic-numbers-basic b/Lang/JavaScript/P-Adic-numbers-basic new file mode 120000 index 0000000000..8430626fe6 --- /dev/null +++ b/Lang/JavaScript/P-Adic-numbers-basic @@ -0,0 +1 @@ +../../Task/P-Adic-numbers-basic/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/P-Adic-square-roots b/Lang/JavaScript/P-Adic-square-roots new file mode 120000 index 0000000000..dc1614d80a --- /dev/null +++ b/Lang/JavaScript/P-Adic-square-roots @@ -0,0 +1 @@ +../../Task/P-Adic-square-roots/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/P-value-correction b/Lang/JavaScript/P-value-correction new file mode 120000 index 0000000000..0bb6d9d877 --- /dev/null +++ b/Lang/JavaScript/P-value-correction @@ -0,0 +1 @@ +../../Task/P-value-correction/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Palindromic-gapful-numbers b/Lang/JavaScript/Palindromic-gapful-numbers new file mode 120000 index 0000000000..3ea405216b --- /dev/null +++ b/Lang/JavaScript/Palindromic-gapful-numbers @@ -0,0 +1 @@ +../../Task/Palindromic-gapful-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Pancake-numbers b/Lang/JavaScript/Pancake-numbers new file mode 120000 index 0000000000..6f2eb315df --- /dev/null +++ b/Lang/JavaScript/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Paraffins b/Lang/JavaScript/Paraffins new file mode 120000 index 0000000000..583d8a86f5 --- /dev/null +++ b/Lang/JavaScript/Paraffins @@ -0,0 +1 @@ +../../Task/Paraffins/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Parse-an-IP-Address b/Lang/JavaScript/Parse-an-IP-Address new file mode 120000 index 0000000000..5981d2ba9f --- /dev/null +++ b/Lang/JavaScript/Parse-an-IP-Address @@ -0,0 +1 @@ +../../Task/Parse-an-IP-Address/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Pascals-triangle-Puzzle b/Lang/JavaScript/Pascals-triangle-Puzzle new file mode 120000 index 0000000000..2acf8cdb4d --- /dev/null +++ b/Lang/JavaScript/Pascals-triangle-Puzzle @@ -0,0 +1 @@ +../../Task/Pascals-triangle-Puzzle/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Percolation-Bond-percolation b/Lang/JavaScript/Percolation-Bond-percolation new file mode 120000 index 0000000000..b784faa7b0 --- /dev/null +++ b/Lang/JavaScript/Percolation-Bond-percolation @@ -0,0 +1 @@ +../../Task/Percolation-Bond-percolation/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Percolation-Mean-cluster-density b/Lang/JavaScript/Percolation-Mean-cluster-density new file mode 120000 index 0000000000..8cad881ab4 --- /dev/null +++ b/Lang/JavaScript/Percolation-Mean-cluster-density @@ -0,0 +1 @@ +../../Task/Percolation-Mean-cluster-density/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Percolation-Mean-run-density b/Lang/JavaScript/Percolation-Mean-run-density new file mode 120000 index 0000000000..6c804e3579 --- /dev/null +++ b/Lang/JavaScript/Percolation-Mean-run-density @@ -0,0 +1 @@ +../../Task/Percolation-Mean-run-density/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Percolation-Site-percolation b/Lang/JavaScript/Percolation-Site-percolation new file mode 120000 index 0000000000..3d8672383d --- /dev/null +++ b/Lang/JavaScript/Percolation-Site-percolation @@ -0,0 +1 @@ +../../Task/Percolation-Site-percolation/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Periodic-table b/Lang/JavaScript/Periodic-table new file mode 120000 index 0000000000..3252400859 --- /dev/null +++ b/Lang/JavaScript/Periodic-table @@ -0,0 +1 @@ +../../Task/Periodic-table/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Perlin-noise b/Lang/JavaScript/Perlin-noise new file mode 120000 index 0000000000..d4cfceb70d --- /dev/null +++ b/Lang/JavaScript/Perlin-noise @@ -0,0 +1 @@ +../../Task/Perlin-noise/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Pisano-period b/Lang/JavaScript/Pisano-period new file mode 120000 index 0000000000..1e168befa1 --- /dev/null +++ b/Lang/JavaScript/Pisano-period @@ -0,0 +1 @@ +../../Task/Pisano-period/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Playfair-cipher b/Lang/JavaScript/Playfair-cipher new file mode 120000 index 0000000000..e94d50f327 --- /dev/null +++ b/Lang/JavaScript/Playfair-cipher @@ -0,0 +1 @@ +../../Task/Playfair-cipher/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Primorial-numbers b/Lang/JavaScript/Primorial-numbers new file mode 120000 index 0000000000..82a58b78e9 --- /dev/null +++ b/Lang/JavaScript/Primorial-numbers @@ -0,0 +1 @@ +../../Task/Primorial-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Priority-queue b/Lang/JavaScript/Priority-queue new file mode 120000 index 0000000000..01d2cd2765 --- /dev/null +++ b/Lang/JavaScript/Priority-queue @@ -0,0 +1 @@ +../../Task/Priority-queue/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Pseudo-random-numbers-Middle-square-method b/Lang/JavaScript/Pseudo-random-numbers-Middle-square-method new file mode 120000 index 0000000000..670dfa6542 --- /dev/null +++ b/Lang/JavaScript/Pseudo-random-numbers-Middle-square-method @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Middle-square-method/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Pseudo-random-numbers-PCG32 b/Lang/JavaScript/Pseudo-random-numbers-PCG32 new file mode 120000 index 0000000000..689b737182 --- /dev/null +++ b/Lang/JavaScript/Pseudo-random-numbers-PCG32 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-PCG32/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Pseudo-random-numbers-Splitmix64 b/Lang/JavaScript/Pseudo-random-numbers-Splitmix64 new file mode 120000 index 0000000000..e21d263f6d --- /dev/null +++ b/Lang/JavaScript/Pseudo-random-numbers-Splitmix64 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Splitmix64/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Pseudo-random-numbers-Xorshift-star b/Lang/JavaScript/Pseudo-random-numbers-Xorshift-star new file mode 120000 index 0000000000..40211cc2a7 --- /dev/null +++ b/Lang/JavaScript/Pseudo-random-numbers-Xorshift-star @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Xorshift-star/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/QR-decomposition b/Lang/JavaScript/QR-decomposition new file mode 120000 index 0000000000..0913aa7d30 --- /dev/null +++ b/Lang/JavaScript/QR-decomposition @@ -0,0 +1 @@ +../../Task/QR-decomposition/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Quaternion-type b/Lang/JavaScript/Quaternion-type deleted file mode 120000 index e2a6535526..0000000000 --- a/Lang/JavaScript/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/RIPEMD-160 b/Lang/JavaScript/RIPEMD-160 new file mode 120000 index 0000000000..aa85f54790 --- /dev/null +++ b/Lang/JavaScript/RIPEMD-160 @@ -0,0 +1 @@ +../../Task/RIPEMD-160/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Repeat b/Lang/JavaScript/Repeat new file mode 120000 index 0000000000..e8bb71f4ce --- /dev/null +++ b/Lang/JavaScript/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/SHA-1 b/Lang/JavaScript/SHA-1 new file mode 120000 index 0000000000..2773e9c63c --- /dev/null +++ b/Lang/JavaScript/SHA-1 @@ -0,0 +1 @@ +../../Task/SHA-1/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/SHA-256-Merkle-tree b/Lang/JavaScript/SHA-256-Merkle-tree new file mode 120000 index 0000000000..0c2b665899 --- /dev/null +++ b/Lang/JavaScript/SHA-256-Merkle-tree @@ -0,0 +1 @@ +../../Task/SHA-256-Merkle-tree/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Set-puzzle b/Lang/JavaScript/Set-puzzle new file mode 120000 index 0000000000..22b0bad552 --- /dev/null +++ b/Lang/JavaScript/Set-puzzle @@ -0,0 +1 @@ +../../Task/Set-puzzle/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Shortest-common-supersequence b/Lang/JavaScript/Shortest-common-supersequence new file mode 120000 index 0000000000..4e107e522e --- /dev/null +++ b/Lang/JavaScript/Shortest-common-supersequence @@ -0,0 +1 @@ +../../Task/Shortest-common-supersequence/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Sisyphus-sequence b/Lang/JavaScript/Sisyphus-sequence new file mode 120000 index 0000000000..67b00353f0 --- /dev/null +++ b/Lang/JavaScript/Sisyphus-sequence @@ -0,0 +1 @@ +../../Task/Sisyphus-sequence/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Smarandache-prime-digital-sequence b/Lang/JavaScript/Smarandache-prime-digital-sequence new file mode 120000 index 0000000000..14cb702228 --- /dev/null +++ b/Lang/JavaScript/Smarandache-prime-digital-sequence @@ -0,0 +1 @@ +../../Task/Smarandache-prime-digital-sequence/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Sokoban b/Lang/JavaScript/Sokoban new file mode 120000 index 0000000000..3ab86467bd --- /dev/null +++ b/Lang/JavaScript/Sokoban @@ -0,0 +1 @@ +../../Task/Sokoban/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Solve-a-Hidato-puzzle b/Lang/JavaScript/Solve-a-Hidato-puzzle new file mode 120000 index 0000000000..3e3c25cd7c --- /dev/null +++ b/Lang/JavaScript/Solve-a-Hidato-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hidato-puzzle/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Solve-a-Hopido-puzzle b/Lang/JavaScript/Solve-a-Hopido-puzzle new file mode 120000 index 0000000000..aea3983b76 --- /dev/null +++ b/Lang/JavaScript/Solve-a-Hopido-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hopido-puzzle/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Solve-a-Numbrix-puzzle b/Lang/JavaScript/Solve-a-Numbrix-puzzle new file mode 120000 index 0000000000..43202401f9 --- /dev/null +++ b/Lang/JavaScript/Solve-a-Numbrix-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Numbrix-puzzle/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Sort-numbers-lexicographically b/Lang/JavaScript/Sort-numbers-lexicographically new file mode 120000 index 0000000000..0350e5ac3a --- /dev/null +++ b/Lang/JavaScript/Sort-numbers-lexicographically @@ -0,0 +1 @@ +../../Task/Sort-numbers-lexicographically/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Sorting-algorithms-Radix-sort b/Lang/JavaScript/Sorting-algorithms-Radix-sort new file mode 120000 index 0000000000..0d4b9cb23d --- /dev/null +++ b/Lang/JavaScript/Sorting-algorithms-Radix-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Radix-sort/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Spelling-of-ordinal-numbers b/Lang/JavaScript/Spelling-of-ordinal-numbers new file mode 120000 index 0000000000..5ed638cc81 --- /dev/null +++ b/Lang/JavaScript/Spelling-of-ordinal-numbers @@ -0,0 +1 @@ +../../Task/Spelling-of-ordinal-numbers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Square-free-integers b/Lang/JavaScript/Square-free-integers new file mode 120000 index 0000000000..5f495f4fd4 --- /dev/null +++ b/Lang/JavaScript/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/State-name-puzzle b/Lang/JavaScript/State-name-puzzle new file mode 120000 index 0000000000..12f667dc4c --- /dev/null +++ b/Lang/JavaScript/State-name-puzzle @@ -0,0 +1 @@ +../../Task/State-name-puzzle/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Steffensens-method b/Lang/JavaScript/Steffensens-method new file mode 120000 index 0000000000..12c21e29e2 --- /dev/null +++ b/Lang/JavaScript/Steffensens-method @@ -0,0 +1 @@ +../../Task/Steffensens-method/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Strassens-algorithm b/Lang/JavaScript/Strassens-algorithm new file mode 120000 index 0000000000..f4d0497694 --- /dev/null +++ b/Lang/JavaScript/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Stream-merge b/Lang/JavaScript/Stream-merge new file mode 120000 index 0000000000..cf7057043d --- /dev/null +++ b/Lang/JavaScript/Stream-merge @@ -0,0 +1 @@ +../../Task/Stream-merge/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Subleq b/Lang/JavaScript/Subleq new file mode 120000 index 0000000000..19f1606c88 --- /dev/null +++ b/Lang/JavaScript/Subleq @@ -0,0 +1 @@ +../../Task/Subleq/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Substitution-cipher b/Lang/JavaScript/Substitution-cipher new file mode 120000 index 0000000000..e8fd969b4a --- /dev/null +++ b/Lang/JavaScript/Substitution-cipher @@ -0,0 +1 @@ +../../Task/Substitution-cipher/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Superpermutation-minimisation b/Lang/JavaScript/Superpermutation-minimisation new file mode 120000 index 0000000000..a257c8e7e7 --- /dev/null +++ b/Lang/JavaScript/Superpermutation-minimisation @@ -0,0 +1 @@ +../../Task/Superpermutation-minimisation/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Sylvesters-sequence b/Lang/JavaScript/Sylvesters-sequence new file mode 120000 index 0000000000..472599a8bf --- /dev/null +++ b/Lang/JavaScript/Sylvesters-sequence @@ -0,0 +1 @@ +../../Task/Sylvesters-sequence/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Tarjan b/Lang/JavaScript/Tarjan new file mode 120000 index 0000000000..c299c7aebb --- /dev/null +++ b/Lang/JavaScript/Tarjan @@ -0,0 +1 @@ +../../Task/Tarjan/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Tau-number b/Lang/JavaScript/Tau-number new file mode 120000 index 0000000000..ff78310d47 --- /dev/null +++ b/Lang/JavaScript/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Thieles-interpolation-formula b/Lang/JavaScript/Thieles-interpolation-formula new file mode 120000 index 0000000000..4aa6c84146 --- /dev/null +++ b/Lang/JavaScript/Thieles-interpolation-formula @@ -0,0 +1 @@ +../../Task/Thieles-interpolation-formula/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Tonelli-Shanks-algorithm b/Lang/JavaScript/Tonelli-Shanks-algorithm new file mode 120000 index 0000000000..f646a271d1 --- /dev/null +++ b/Lang/JavaScript/Tonelli-Shanks-algorithm @@ -0,0 +1 @@ +../../Task/Tonelli-Shanks-algorithm/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Topswops b/Lang/JavaScript/Topswops new file mode 120000 index 0000000000..cffdbd99df --- /dev/null +++ b/Lang/JavaScript/Topswops @@ -0,0 +1 @@ +../../Task/Topswops/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Transliterate-English-text-using-the-Greek-alphabet b/Lang/JavaScript/Transliterate-English-text-using-the-Greek-alphabet new file mode 120000 index 0000000000..90b7eb9492 --- /dev/null +++ b/Lang/JavaScript/Transliterate-English-text-using-the-Greek-alphabet @@ -0,0 +1 @@ +../../Task/Transliterate-English-text-using-the-Greek-alphabet/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Twos-complement b/Lang/JavaScript/Twos-complement new file mode 120000 index 0000000000..d0b1730478 --- /dev/null +++ b/Lang/JavaScript/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Ukkonen-s-suffix-tree-construction b/Lang/JavaScript/Ukkonen-s-suffix-tree-construction new file mode 120000 index 0000000000..7a4d0832f5 --- /dev/null +++ b/Lang/JavaScript/Ukkonen-s-suffix-tree-construction @@ -0,0 +1 @@ +../../Task/Ukkonen-s-suffix-tree-construction/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Unbias-a-random-generator b/Lang/JavaScript/Unbias-a-random-generator new file mode 120000 index 0000000000..1e801c1fa5 --- /dev/null +++ b/Lang/JavaScript/Unbias-a-random-generator @@ -0,0 +1 @@ +../../Task/Unbias-a-random-generator/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Unicode-strings b/Lang/JavaScript/Unicode-strings new file mode 120000 index 0000000000..ad6c128bef --- /dev/null +++ b/Lang/JavaScript/Unicode-strings @@ -0,0 +1 @@ +../../Task/Unicode-strings/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Van-der-Corput-sequence b/Lang/JavaScript/Van-der-Corput-sequence new file mode 120000 index 0000000000..41397b68df --- /dev/null +++ b/Lang/JavaScript/Van-der-Corput-sequence @@ -0,0 +1 @@ +../../Task/Van-der-Corput-sequence/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Vector b/Lang/JavaScript/Vector new file mode 120000 index 0000000000..fec6065641 --- /dev/null +++ b/Lang/JavaScript/Vector @@ -0,0 +1 @@ +../../Task/Vector/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Verhoeff-algorithm b/Lang/JavaScript/Verhoeff-algorithm new file mode 120000 index 0000000000..cd27def09b --- /dev/null +++ b/Lang/JavaScript/Verhoeff-algorithm @@ -0,0 +1 @@ +../../Task/Verhoeff-algorithm/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Vigen-re-cipher-Cryptanalysis b/Lang/JavaScript/Vigen-re-cipher-Cryptanalysis new file mode 120000 index 0000000000..53c004e91c --- /dev/null +++ b/Lang/JavaScript/Vigen-re-cipher-Cryptanalysis @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher-Cryptanalysis/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Vogels-approximation-method b/Lang/JavaScript/Vogels-approximation-method new file mode 120000 index 0000000000..72693f1daa --- /dev/null +++ b/Lang/JavaScript/Vogels-approximation-method @@ -0,0 +1 @@ +../../Task/Vogels-approximation-method/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Word-ladder b/Lang/JavaScript/Word-ladder new file mode 120000 index 0000000000..f78d94e145 --- /dev/null +++ b/Lang/JavaScript/Word-ladder @@ -0,0 +1 @@ +../../Task/Word-ladder/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Wordiff b/Lang/JavaScript/Wordiff new file mode 120000 index 0000000000..18ec352da6 --- /dev/null +++ b/Lang/JavaScript/Wordiff @@ -0,0 +1 @@ +../../Task/Wordiff/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Zebra-puzzle b/Lang/JavaScript/Zebra-puzzle new file mode 120000 index 0000000000..5c531004b3 --- /dev/null +++ b/Lang/JavaScript/Zebra-puzzle @@ -0,0 +1 @@ +../../Task/Zebra-puzzle/JavaScript \ No newline at end of file diff --git a/Lang/Joy/Case-sensitivity-of-identifiers b/Lang/Joy/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..e8f5c2c1db --- /dev/null +++ b/Lang/Joy/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Joy \ No newline at end of file diff --git a/Lang/Joy/Read-a-file-line-by-line b/Lang/Joy/Read-a-file-line-by-line new file mode 120000 index 0000000000..9985d0bc9c --- /dev/null +++ b/Lang/Joy/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Joy \ No newline at end of file diff --git a/Lang/Joy/Sort-an-integer-array b/Lang/Joy/Sort-an-integer-array new file mode 120000 index 0000000000..91921cd08e --- /dev/null +++ b/Lang/Joy/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Joy \ No newline at end of file diff --git a/Lang/Joy/Sum-multiples-of-3-and-5 b/Lang/Joy/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..1a0f4580de --- /dev/null +++ b/Lang/Joy/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/Joy \ No newline at end of file diff --git a/Lang/Joy/Unicode-variable-names b/Lang/Joy/Unicode-variable-names new file mode 120000 index 0000000000..b7f93a76ef --- /dev/null +++ b/Lang/Joy/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Joy \ No newline at end of file diff --git a/Lang/Jq/00-LANG.txt b/Lang/Jq/00-LANG.txt index 70c9eddfba..a2d6626be7 100644 --- a/Lang/Jq/00-LANG.txt +++ b/Lang/Jq/00-LANG.txt @@ -1,13 +1,21 @@ {{language |site=http://stedolan.github.io/jq}} {{language programming paradigm|Functional}} -[https://en.wikipedia.org/wiki/Jq_(programming_language) jq] is a [[functional programming]] language that is oriented towards processing text files or [[JSON]]. jq is also the name of [https://stedolan.github.io/jq a portable executable] that compiles and runs jq programs. A [[Go]] implementation, [https://github.com/itchyny/gojq gojq], is also available. +[https://en.wikipedia.org/wiki/Jq_(programming_language) jq] is a [[functional programming]] language that is oriented towards processing text files or [[JSON]]. jq is also the name of [https://stedolan.github.io/jq a portable executable] that compiles and runs jq programs. A [[Go]] implementation, [https://github.com/itchyny/gojq gojq], is also available; and [https://github.com/01mf02/jaq jaq] implements a large subset of jq in [[Rust]]. jq was originally designed and developed by Stephen Dolan. ==jq Modules at rosettacode.org== * [[:Category:Jq/assert.jq|assert.jq]] - module to support assertions +* [[:Category:Jq/bitwise.jq|bitwise.jq]] - bit streams, bit arrays, and integers +* [[:Category:Jq/fibonacci.jq|fibonacci.jq]] - Fibonacci sequence and Fibonacci coding * [[:Category:Jq/peg.jq|peg.jq]] - Parsing Expression Grammar foundations +* [[:Category:Jq/polynomials.jq|polynomials.jq]] - polynomials as JSON arrays +* [[:Category:Jq/rational.jq|rational.jq]] - rational numbers + +* [[:Category:Jq/Date.jq|Date.jq]] - Gregorian calendar from the year 1 +* [[:Category:Jq/MRG32k3a.jq|MRG32k3a.jq]] - MRG32k3a Combined Recursive Pseudo-Random Number Generator +* [[:Category:Jq/RealSet.jq|RealSet.jq]] - Union of finite real intervals ==Todo== [[Tasks_not_implemented_in_jq]] diff --git a/Lang/Jq/15-puzzle-game b/Lang/Jq/15-puzzle-game new file mode 120000 index 0000000000..9c065d8ccc --- /dev/null +++ b/Lang/Jq/15-puzzle-game @@ -0,0 +1 @@ +../../Task/15-puzzle-game/Jq \ No newline at end of file diff --git a/Lang/Jq/15-puzzle-solver b/Lang/Jq/15-puzzle-solver new file mode 120000 index 0000000000..e822e3d4e7 --- /dev/null +++ b/Lang/Jq/15-puzzle-solver @@ -0,0 +1 @@ +../../Task/15-puzzle-solver/Jq \ No newline at end of file diff --git a/Lang/Jq/2048 b/Lang/Jq/2048 new file mode 120000 index 0000000000..e78d154a28 --- /dev/null +++ b/Lang/Jq/2048 @@ -0,0 +1 @@ +../../Task/2048/Jq \ No newline at end of file diff --git a/Lang/Jq/24-game b/Lang/Jq/24-game new file mode 120000 index 0000000000..1db8a29eb4 --- /dev/null +++ b/Lang/Jq/24-game @@ -0,0 +1 @@ +../../Task/24-game/Jq \ No newline at end of file diff --git a/Lang/Jq/Achilles-numbers b/Lang/Jq/Achilles-numbers new file mode 120000 index 0000000000..b4cc0a3b14 --- /dev/null +++ b/Lang/Jq/Achilles-numbers @@ -0,0 +1 @@ +../../Task/Achilles-numbers/Jq \ No newline at end of file diff --git a/Lang/Jq/Averages-Simple-moving-average b/Lang/Jq/Averages-Simple-moving-average new file mode 120000 index 0000000000..7c27d5bee2 --- /dev/null +++ b/Lang/Jq/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/Jq \ No newline at end of file diff --git a/Lang/Jq/Balanced-ternary b/Lang/Jq/Balanced-ternary new file mode 120000 index 0000000000..edd90ef89f --- /dev/null +++ b/Lang/Jq/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/Jq \ No newline at end of file diff --git a/Lang/Jq/Bioinformatics-Sequence-mutation b/Lang/Jq/Bioinformatics-Sequence-mutation new file mode 120000 index 0000000000..b278350921 --- /dev/null +++ b/Lang/Jq/Bioinformatics-Sequence-mutation @@ -0,0 +1 @@ +../../Task/Bioinformatics-Sequence-mutation/Jq \ No newline at end of file diff --git a/Lang/Jq/Bioinformatics-base-count b/Lang/Jq/Bioinformatics-base-count deleted file mode 120000 index 87df406d18..0000000000 --- a/Lang/Jq/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Jq \ No newline at end of file diff --git a/Lang/Jq/Bitwise-operations b/Lang/Jq/Bitwise-operations new file mode 120000 index 0000000000..eff5a2f904 --- /dev/null +++ b/Lang/Jq/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Jq \ No newline at end of file diff --git a/Lang/Jq/CRC-32 b/Lang/Jq/CRC-32 new file mode 120000 index 0000000000..800ab8f0ad --- /dev/null +++ b/Lang/Jq/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/Jq \ No newline at end of file diff --git a/Lang/Jq/Chaocipher b/Lang/Jq/Chaocipher new file mode 120000 index 0000000000..3383992151 --- /dev/null +++ b/Lang/Jq/Chaocipher @@ -0,0 +1 @@ +../../Task/Chaocipher/Jq \ No newline at end of file diff --git a/Lang/Jq/Cistercian-numerals b/Lang/Jq/Cistercian-numerals new file mode 120000 index 0000000000..67d12881b4 --- /dev/null +++ b/Lang/Jq/Cistercian-numerals @@ -0,0 +1 @@ +../../Task/Cistercian-numerals/Jq \ No newline at end of file diff --git a/Lang/Jq/Continued-fraction-Arithmetic-Construct-from-rational-number b/Lang/Jq/Continued-fraction-Arithmetic-Construct-from-rational-number new file mode 120000 index 0000000000..90c56c3b3a --- /dev/null +++ b/Lang/Jq/Continued-fraction-Arithmetic-Construct-from-rational-number @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-Construct-from-rational-number/Jq \ No newline at end of file diff --git a/Lang/Jq/Cyclotomic-polynomial b/Lang/Jq/Cyclotomic-polynomial new file mode 120000 index 0000000000..a7efa9c9e3 --- /dev/null +++ b/Lang/Jq/Cyclotomic-polynomial @@ -0,0 +1 @@ +../../Task/Cyclotomic-polynomial/Jq \ No newline at end of file diff --git a/Lang/Jq/De-Bruijn-sequences b/Lang/Jq/De-Bruijn-sequences new file mode 120000 index 0000000000..69d27245d0 --- /dev/null +++ b/Lang/Jq/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/Jq \ No newline at end of file diff --git a/Lang/Jq/Deconvolution-1D b/Lang/Jq/Deconvolution-1D new file mode 120000 index 0000000000..4f872c1005 --- /dev/null +++ b/Lang/Jq/Deconvolution-1D @@ -0,0 +1 @@ +../../Task/Deconvolution-1D/Jq \ No newline at end of file diff --git a/Lang/Jq/Display-an-outline-as-a-nested-table b/Lang/Jq/Display-an-outline-as-a-nested-table new file mode 120000 index 0000000000..37137659b6 --- /dev/null +++ b/Lang/Jq/Display-an-outline-as-a-nested-table @@ -0,0 +1 @@ +../../Task/Display-an-outline-as-a-nested-table/Jq \ No newline at end of file diff --git a/Lang/Jq/Draw-a-cuboid b/Lang/Jq/Draw-a-cuboid new file mode 120000 index 0000000000..2af657c230 --- /dev/null +++ b/Lang/Jq/Draw-a-cuboid @@ -0,0 +1 @@ +../../Task/Draw-a-cuboid/Jq \ No newline at end of file diff --git a/Lang/Jq/Earliest-difference-between-prime-gaps b/Lang/Jq/Earliest-difference-between-prime-gaps new file mode 120000 index 0000000000..c961454d41 --- /dev/null +++ b/Lang/Jq/Earliest-difference-between-prime-gaps @@ -0,0 +1 @@ +../../Task/Earliest-difference-between-prime-gaps/Jq \ No newline at end of file diff --git a/Lang/Jq/Entropy-Narcissist b/Lang/Jq/Entropy-Narcissist new file mode 120000 index 0000000000..f142d7e681 --- /dev/null +++ b/Lang/Jq/Entropy-Narcissist @@ -0,0 +1 @@ +../../Task/Entropy-Narcissist/Jq \ No newline at end of file diff --git a/Lang/Jq/Evolutionary-algorithm b/Lang/Jq/Evolutionary-algorithm new file mode 120000 index 0000000000..3e237d59aa --- /dev/null +++ b/Lang/Jq/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/Jq \ No newline at end of file diff --git a/Lang/Jq/Factors-of-a-Mersenne-number b/Lang/Jq/Factors-of-a-Mersenne-number new file mode 120000 index 0000000000..e34af6567d --- /dev/null +++ b/Lang/Jq/Factors-of-a-Mersenne-number @@ -0,0 +1 @@ +../../Task/Factors-of-a-Mersenne-number/Jq \ No newline at end of file diff --git a/Lang/Jq/File-size-distribution b/Lang/Jq/File-size-distribution new file mode 120000 index 0000000000..d42e94402e --- /dev/null +++ b/Lang/Jq/File-size-distribution @@ -0,0 +1 @@ +../../Task/File-size-distribution/Jq \ No newline at end of file diff --git a/Lang/Jq/Find-Chess960-starting-position-identifier b/Lang/Jq/Find-Chess960-starting-position-identifier new file mode 120000 index 0000000000..ea292cff65 --- /dev/null +++ b/Lang/Jq/Find-Chess960-starting-position-identifier @@ -0,0 +1 @@ +../../Task/Find-Chess960-starting-position-identifier/Jq \ No newline at end of file diff --git a/Lang/Jq/Find-duplicate-files b/Lang/Jq/Find-duplicate-files new file mode 120000 index 0000000000..289f08d02f --- /dev/null +++ b/Lang/Jq/Find-duplicate-files @@ -0,0 +1 @@ +../../Task/Find-duplicate-files/Jq \ No newline at end of file diff --git a/Lang/Jq/French-Republican-calendar b/Lang/Jq/French-Republican-calendar new file mode 120000 index 0000000000..d495d14d71 --- /dev/null +++ b/Lang/Jq/French-Republican-calendar @@ -0,0 +1 @@ +../../Task/French-Republican-calendar/Jq \ No newline at end of file diff --git a/Lang/Jq/Generate-random-chess-position b/Lang/Jq/Generate-random-chess-position new file mode 120000 index 0000000000..a6ff2b1df0 --- /dev/null +++ b/Lang/Jq/Generate-random-chess-position @@ -0,0 +1 @@ +../../Task/Generate-random-chess-position/Jq \ No newline at end of file diff --git a/Lang/Jq/Giuga-numbers b/Lang/Jq/Giuga-numbers new file mode 120000 index 0000000000..b5850902a3 --- /dev/null +++ b/Lang/Jq/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/Jq \ No newline at end of file diff --git a/Lang/Jq/Graph-colouring b/Lang/Jq/Graph-colouring new file mode 120000 index 0000000000..07b418f3a3 --- /dev/null +++ b/Lang/Jq/Graph-colouring @@ -0,0 +1 @@ +../../Task/Graph-colouring/Jq \ No newline at end of file diff --git a/Lang/Jq/Gray-code b/Lang/Jq/Gray-code new file mode 120000 index 0000000000..3dca8836bd --- /dev/null +++ b/Lang/Jq/Gray-code @@ -0,0 +1 @@ +../../Task/Gray-code/Jq \ No newline at end of file diff --git a/Lang/Jq/Index-finite-lists-of-positive-integers b/Lang/Jq/Index-finite-lists-of-positive-integers new file mode 120000 index 0000000000..da5139ae0d --- /dev/null +++ b/Lang/Jq/Index-finite-lists-of-positive-integers @@ -0,0 +1 @@ +../../Task/Index-finite-lists-of-positive-integers/Jq \ No newline at end of file diff --git a/Lang/Jq/Intersecting-number-wheels b/Lang/Jq/Intersecting-number-wheels new file mode 120000 index 0000000000..4bb7092aa3 --- /dev/null +++ b/Lang/Jq/Intersecting-number-wheels @@ -0,0 +1 @@ +../../Task/Intersecting-number-wheels/Jq \ No newline at end of file diff --git a/Lang/Jq/Introspection b/Lang/Jq/Introspection new file mode 120000 index 0000000000..cdb6f22cc1 --- /dev/null +++ b/Lang/Jq/Introspection @@ -0,0 +1 @@ +../../Task/Introspection/Jq \ No newline at end of file diff --git a/Lang/Jq/K-d-tree b/Lang/Jq/K-d-tree new file mode 120000 index 0000000000..e16273501e --- /dev/null +++ b/Lang/Jq/K-d-tree @@ -0,0 +1 @@ +../../Task/K-d-tree/Jq \ No newline at end of file diff --git a/Lang/Jq/Knights-tour b/Lang/Jq/Knights-tour new file mode 120000 index 0000000000..ca47275558 --- /dev/null +++ b/Lang/Jq/Knights-tour @@ -0,0 +1 @@ +../../Task/Knights-tour/Jq \ No newline at end of file diff --git a/Lang/Jq/Levenshtein-distance-Alignment b/Lang/Jq/Levenshtein-distance-Alignment new file mode 120000 index 0000000000..b331da38ff --- /dev/null +++ b/Lang/Jq/Levenshtein-distance-Alignment @@ -0,0 +1 @@ +../../Task/Levenshtein-distance-Alignment/Jq \ No newline at end of file diff --git a/Lang/Jq/Mayan-calendar b/Lang/Jq/Mayan-calendar new file mode 120000 index 0000000000..aa0964c1d8 --- /dev/null +++ b/Lang/Jq/Mayan-calendar @@ -0,0 +1 @@ +../../Task/Mayan-calendar/Jq \ No newline at end of file diff --git a/Lang/Jq/Maze-generation b/Lang/Jq/Maze-generation new file mode 120000 index 0000000000..7ba34d359b --- /dev/null +++ b/Lang/Jq/Maze-generation @@ -0,0 +1 @@ +../../Task/Maze-generation/Jq \ No newline at end of file diff --git a/Lang/Jq/Mind-boggling-card-trick b/Lang/Jq/Mind-boggling-card-trick new file mode 120000 index 0000000000..11a1e6dd3d --- /dev/null +++ b/Lang/Jq/Mind-boggling-card-trick @@ -0,0 +1 @@ +../../Task/Mind-boggling-card-trick/Jq \ No newline at end of file diff --git a/Lang/Jq/Minimal-steps-down-to-1 b/Lang/Jq/Minimal-steps-down-to-1 new file mode 120000 index 0000000000..d05488db25 --- /dev/null +++ b/Lang/Jq/Minimal-steps-down-to-1 @@ -0,0 +1 @@ +../../Task/Minimal-steps-down-to-1/Jq \ No newline at end of file diff --git a/Lang/Jq/Modified-random-distribution b/Lang/Jq/Modified-random-distribution new file mode 120000 index 0000000000..5585f4b8dd --- /dev/null +++ b/Lang/Jq/Modified-random-distribution @@ -0,0 +1 @@ +../../Task/Modified-random-distribution/Jq \ No newline at end of file diff --git a/Lang/Jq/Multiplicative-order b/Lang/Jq/Multiplicative-order new file mode 120000 index 0000000000..72c4d667a9 --- /dev/null +++ b/Lang/Jq/Multiplicative-order @@ -0,0 +1 @@ +../../Task/Multiplicative-order/Jq \ No newline at end of file diff --git a/Lang/Jq/Nonoblock b/Lang/Jq/Nonoblock new file mode 120000 index 0000000000..f2323057e5 --- /dev/null +++ b/Lang/Jq/Nonoblock @@ -0,0 +1 @@ +../../Task/Nonoblock/Jq \ No newline at end of file diff --git a/Lang/Jq/Nonogram-solver b/Lang/Jq/Nonogram-solver new file mode 120000 index 0000000000..2ae5949d16 --- /dev/null +++ b/Lang/Jq/Nonogram-solver @@ -0,0 +1 @@ +../../Task/Nonogram-solver/Jq \ No newline at end of file diff --git a/Lang/Jq/P-value-correction b/Lang/Jq/P-value-correction new file mode 120000 index 0000000000..4685fd057d --- /dev/null +++ b/Lang/Jq/P-value-correction @@ -0,0 +1 @@ +../../Task/P-value-correction/Jq \ No newline at end of file diff --git a/Lang/Jq/Palindromic-gapful-numbers b/Lang/Jq/Palindromic-gapful-numbers new file mode 120000 index 0000000000..3f1d4b0a65 --- /dev/null +++ b/Lang/Jq/Palindromic-gapful-numbers @@ -0,0 +1 @@ +../../Task/Palindromic-gapful-numbers/Jq \ No newline at end of file diff --git a/Lang/Jq/Pancake-numbers b/Lang/Jq/Pancake-numbers new file mode 120000 index 0000000000..7c0b6487cc --- /dev/null +++ b/Lang/Jq/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/Jq \ No newline at end of file diff --git a/Lang/Jq/Parse-an-IP-Address b/Lang/Jq/Parse-an-IP-Address new file mode 120000 index 0000000000..141e962822 --- /dev/null +++ b/Lang/Jq/Parse-an-IP-Address @@ -0,0 +1 @@ +../../Task/Parse-an-IP-Address/Jq \ No newline at end of file diff --git a/Lang/Jq/Password-generator b/Lang/Jq/Password-generator new file mode 120000 index 0000000000..ef3ce417dc --- /dev/null +++ b/Lang/Jq/Password-generator @@ -0,0 +1 @@ +../../Task/Password-generator/Jq \ No newline at end of file diff --git a/Lang/Jq/Peaceful-chess-queen-armies b/Lang/Jq/Peaceful-chess-queen-armies new file mode 120000 index 0000000000..7c675a3306 --- /dev/null +++ b/Lang/Jq/Peaceful-chess-queen-armies @@ -0,0 +1 @@ +../../Task/Peaceful-chess-queen-armies/Jq \ No newline at end of file diff --git a/Lang/Jq/Pentomino-tiling b/Lang/Jq/Pentomino-tiling new file mode 120000 index 0000000000..cce133df04 --- /dev/null +++ b/Lang/Jq/Pentomino-tiling @@ -0,0 +1 @@ +../../Task/Pentomino-tiling/Jq \ No newline at end of file diff --git a/Lang/Jq/Perlin-noise b/Lang/Jq/Perlin-noise new file mode 120000 index 0000000000..eb52c317a2 --- /dev/null +++ b/Lang/Jq/Perlin-noise @@ -0,0 +1 @@ +../../Task/Perlin-noise/Jq \ No newline at end of file diff --git a/Lang/Jq/Pisano-period b/Lang/Jq/Pisano-period new file mode 120000 index 0000000000..223468a26a --- /dev/null +++ b/Lang/Jq/Pisano-period @@ -0,0 +1 @@ +../../Task/Pisano-period/Jq \ No newline at end of file diff --git a/Lang/Jq/Poker-hand-analyser b/Lang/Jq/Poker-hand-analyser new file mode 120000 index 0000000000..fd9738ce61 --- /dev/null +++ b/Lang/Jq/Poker-hand-analyser @@ -0,0 +1 @@ +../../Task/Poker-hand-analyser/Jq \ No newline at end of file diff --git a/Lang/Jq/Polynomial-regression b/Lang/Jq/Polynomial-regression new file mode 120000 index 0000000000..56985e2ba4 --- /dev/null +++ b/Lang/Jq/Polynomial-regression @@ -0,0 +1 @@ +../../Task/Polynomial-regression/Jq \ No newline at end of file diff --git a/Lang/Jq/Prime-numbers-whose-neighboring-pairs-are-tetraprimes b/Lang/Jq/Prime-numbers-whose-neighboring-pairs-are-tetraprimes new file mode 120000 index 0000000000..e1fd0d226c --- /dev/null +++ b/Lang/Jq/Prime-numbers-whose-neighboring-pairs-are-tetraprimes @@ -0,0 +1 @@ +../../Task/Prime-numbers-whose-neighboring-pairs-are-tetraprimes/Jq \ No newline at end of file diff --git a/Lang/Jq/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a b/Lang/Jq/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a new file mode 120000 index 0000000000..8a1fa69d52 --- /dev/null +++ b/Lang/Jq/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a/Jq \ No newline at end of file diff --git a/Lang/Jq/Pseudo-random-numbers-PCG32 b/Lang/Jq/Pseudo-random-numbers-PCG32 new file mode 120000 index 0000000000..c80dea5d5d --- /dev/null +++ b/Lang/Jq/Pseudo-random-numbers-PCG32 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-PCG32/Jq \ No newline at end of file diff --git a/Lang/Jq/Pseudo-random-numbers-Splitmix64 b/Lang/Jq/Pseudo-random-numbers-Splitmix64 new file mode 120000 index 0000000000..99474567aa --- /dev/null +++ b/Lang/Jq/Pseudo-random-numbers-Splitmix64 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Splitmix64/Jq \ No newline at end of file diff --git a/Lang/Jq/Pseudo-random-numbers-Xorshift-star b/Lang/Jq/Pseudo-random-numbers-Xorshift-star new file mode 120000 index 0000000000..54ff010417 --- /dev/null +++ b/Lang/Jq/Pseudo-random-numbers-Xorshift-star @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Xorshift-star/Jq \ No newline at end of file diff --git a/Lang/Jq/Quaternion-type b/Lang/Jq/Quaternion-type deleted file mode 120000 index 36df977f17..0000000000 --- a/Lang/Jq/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Jq \ No newline at end of file diff --git a/Lang/Jq/Ramer-Douglas-Peucker-line-simplification b/Lang/Jq/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..2692c011c6 --- /dev/null +++ b/Lang/Jq/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/Jq \ No newline at end of file diff --git a/Lang/Jq/Random-sentence-from-book b/Lang/Jq/Random-sentence-from-book new file mode 120000 index 0000000000..677f7ffdcc --- /dev/null +++ b/Lang/Jq/Random-sentence-from-book @@ -0,0 +1 @@ +../../Task/Random-sentence-from-book/Jq \ No newline at end of file diff --git a/Lang/Jq/Rosetta-Code-Rank-languages-by-number-of-users b/Lang/Jq/Rosetta-Code-Rank-languages-by-number-of-users new file mode 120000 index 0000000000..41c301e751 --- /dev/null +++ b/Lang/Jq/Rosetta-Code-Rank-languages-by-number-of-users @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Rank-languages-by-number-of-users/Jq \ No newline at end of file diff --git a/Lang/Jq/Set-of-real-numbers b/Lang/Jq/Set-of-real-numbers new file mode 120000 index 0000000000..4930cbfaeb --- /dev/null +++ b/Lang/Jq/Set-of-real-numbers @@ -0,0 +1 @@ +../../Task/Set-of-real-numbers/Jq \ No newline at end of file diff --git a/Lang/Jq/Set-puzzle b/Lang/Jq/Set-puzzle new file mode 120000 index 0000000000..4d4860ff33 --- /dev/null +++ b/Lang/Jq/Set-puzzle @@ -0,0 +1 @@ +../../Task/Set-puzzle/Jq \ No newline at end of file diff --git a/Lang/Jq/Set-right-adjacent-bits b/Lang/Jq/Set-right-adjacent-bits new file mode 120000 index 0000000000..74d85af7c9 --- /dev/null +++ b/Lang/Jq/Set-right-adjacent-bits @@ -0,0 +1 @@ +../../Task/Set-right-adjacent-bits/Jq \ No newline at end of file diff --git a/Lang/Jq/Sierpinski-pentagon b/Lang/Jq/Sierpinski-pentagon new file mode 120000 index 0000000000..25b52521df --- /dev/null +++ b/Lang/Jq/Sierpinski-pentagon @@ -0,0 +1 @@ +../../Task/Sierpinski-pentagon/Jq \ No newline at end of file diff --git a/Lang/Jq/Sleeping-Beauty-problem b/Lang/Jq/Sleeping-Beauty-problem new file mode 120000 index 0000000000..56204d6c76 --- /dev/null +++ b/Lang/Jq/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/Jq \ No newline at end of file diff --git a/Lang/Jq/Solve-a-Hidato-puzzle b/Lang/Jq/Solve-a-Hidato-puzzle new file mode 120000 index 0000000000..e3f6b38721 --- /dev/null +++ b/Lang/Jq/Solve-a-Hidato-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hidato-puzzle/Jq \ No newline at end of file diff --git a/Lang/Jq/Solve-a-Holy-Knights-tour b/Lang/Jq/Solve-a-Holy-Knights-tour new file mode 120000 index 0000000000..d69331eff1 --- /dev/null +++ b/Lang/Jq/Solve-a-Holy-Knights-tour @@ -0,0 +1 @@ +../../Task/Solve-a-Holy-Knights-tour/Jq \ No newline at end of file diff --git a/Lang/Jq/Solve-a-Numbrix-puzzle b/Lang/Jq/Solve-a-Numbrix-puzzle new file mode 120000 index 0000000000..29721632e1 --- /dev/null +++ b/Lang/Jq/Solve-a-Numbrix-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Numbrix-puzzle/Jq \ No newline at end of file diff --git a/Lang/Jq/Sort-an-outline-at-every-level b/Lang/Jq/Sort-an-outline-at-every-level new file mode 120000 index 0000000000..bce371340d --- /dev/null +++ b/Lang/Jq/Sort-an-outline-at-every-level @@ -0,0 +1 @@ +../../Task/Sort-an-outline-at-every-level/Jq \ No newline at end of file diff --git a/Lang/Jq/Sorting-Algorithms-Circle-Sort b/Lang/Jq/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index acb625912d..0000000000 --- a/Lang/Jq/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Jq \ No newline at end of file diff --git a/Lang/Jq/Start-from-a-main-routine b/Lang/Jq/Start-from-a-main-routine new file mode 120000 index 0000000000..04bfaaf631 --- /dev/null +++ b/Lang/Jq/Start-from-a-main-routine @@ -0,0 +1 @@ +../../Task/Start-from-a-main-routine/Jq \ No newline at end of file diff --git a/Lang/Jq/Strassens-algorithm b/Lang/Jq/Strassens-algorithm new file mode 120000 index 0000000000..d6ccda4254 --- /dev/null +++ b/Lang/Jq/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Jq \ No newline at end of file diff --git a/Lang/Jq/Thieles-interpolation-formula b/Lang/Jq/Thieles-interpolation-formula new file mode 120000 index 0000000000..25d4327e8c --- /dev/null +++ b/Lang/Jq/Thieles-interpolation-formula @@ -0,0 +1 @@ +../../Task/Thieles-interpolation-formula/Jq \ No newline at end of file diff --git a/Lang/Jq/Tic-tac-toe b/Lang/Jq/Tic-tac-toe new file mode 120000 index 0000000000..29e18a13ef --- /dev/null +++ b/Lang/Jq/Tic-tac-toe @@ -0,0 +1 @@ +../../Task/Tic-tac-toe/Jq \ No newline at end of file diff --git a/Lang/Jq/Twos-complement b/Lang/Jq/Twos-complement new file mode 120000 index 0000000000..79d28d31d7 --- /dev/null +++ b/Lang/Jq/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Jq \ No newline at end of file diff --git a/Lang/Jq/Vogels-approximation-method b/Lang/Jq/Vogels-approximation-method new file mode 120000 index 0000000000..fb9aff7884 --- /dev/null +++ b/Lang/Jq/Vogels-approximation-method @@ -0,0 +1 @@ +../../Task/Vogels-approximation-method/Jq \ No newline at end of file diff --git a/Lang/Jq/War-card-game b/Lang/Jq/War-card-game new file mode 120000 index 0000000000..428c4a1307 --- /dev/null +++ b/Lang/Jq/War-card-game @@ -0,0 +1 @@ +../../Task/War-card-game/Jq \ No newline at end of file diff --git a/Lang/Jq/Wordiff b/Lang/Jq/Wordiff new file mode 120000 index 0000000000..61aa15852c --- /dev/null +++ b/Lang/Jq/Wordiff @@ -0,0 +1 @@ +../../Task/Wordiff/Jq \ No newline at end of file diff --git a/Lang/Julia/B-zier-curves-Intersections b/Lang/Julia/B-zier-curves-Intersections new file mode 120000 index 0000000000..02cdc8ea33 --- /dev/null +++ b/Lang/Julia/B-zier-curves-Intersections @@ -0,0 +1 @@ +../../Task/B-zier-curves-Intersections/Julia \ No newline at end of file diff --git a/Lang/Julia/Bioinformatics-base-count b/Lang/Julia/Bioinformatics-base-count deleted file mode 120000 index 37835d6558..0000000000 --- a/Lang/Julia/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Julia \ No newline at end of file diff --git a/Lang/Julia/Meissel-Mertens-constant b/Lang/Julia/Meissel-Mertens-constant deleted file mode 120000 index 24fa8f526c..0000000000 --- a/Lang/Julia/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Julia \ No newline at end of file diff --git a/Lang/Julia/Miller-Rabin-primality-test b/Lang/Julia/Miller-Rabin-primality-test deleted file mode 120000 index 1a7339a0d3..0000000000 --- a/Lang/Julia/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Julia \ No newline at end of file diff --git a/Lang/Julia/OLE-automation b/Lang/Julia/OLE-automation new file mode 120000 index 0000000000..58b1722653 --- /dev/null +++ b/Lang/Julia/OLE-automation @@ -0,0 +1 @@ +../../Task/OLE-automation/Julia \ No newline at end of file diff --git a/Lang/Julia/Quaternion-type b/Lang/Julia/Quaternion-type deleted file mode 120000 index 8a462d73ba..0000000000 --- a/Lang/Julia/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Julia \ No newline at end of file diff --git a/Lang/Julia/Simulate-input-Keyboard b/Lang/Julia/Simulate-input-Keyboard new file mode 120000 index 0000000000..79cc3689e4 --- /dev/null +++ b/Lang/Julia/Simulate-input-Keyboard @@ -0,0 +1 @@ +../../Task/Simulate-input-Keyboard/Julia \ No newline at end of file diff --git a/Lang/Julia/Sorting-Algorithms-Circle-Sort b/Lang/Julia/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index a8c5c2c2be..0000000000 --- a/Lang/Julia/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Julia \ No newline at end of file diff --git a/Lang/Julia/Use-another-language-to-call-a-function b/Lang/Julia/Use-another-language-to-call-a-function new file mode 120000 index 0000000000..c21a8c88ad --- /dev/null +++ b/Lang/Julia/Use-another-language-to-call-a-function @@ -0,0 +1 @@ +../../Task/Use-another-language-to-call-a-function/Julia \ No newline at end of file diff --git a/Lang/K/Abundant-odd-numbers b/Lang/K/Abundant-odd-numbers new file mode 120000 index 0000000000..e7fe0d3fc3 --- /dev/null +++ b/Lang/K/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/K \ No newline at end of file diff --git a/Lang/K/Array-length b/Lang/K/Array-length new file mode 120000 index 0000000000..713b43ae60 --- /dev/null +++ b/Lang/K/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/K \ No newline at end of file diff --git a/Lang/K/Ascending-primes b/Lang/K/Ascending-primes new file mode 120000 index 0000000000..d9555980d2 --- /dev/null +++ b/Lang/K/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/K \ No newline at end of file diff --git a/Lang/K/Benfords-law b/Lang/K/Benfords-law new file mode 120000 index 0000000000..75ff9d97ad --- /dev/null +++ b/Lang/K/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/K \ No newline at end of file diff --git a/Lang/K/Bulls-and-cows b/Lang/K/Bulls-and-cows new file mode 120000 index 0000000000..97544c963d --- /dev/null +++ b/Lang/K/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/K \ No newline at end of file diff --git a/Lang/K/Circular-primes b/Lang/K/Circular-primes new file mode 120000 index 0000000000..5e07afa7a8 --- /dev/null +++ b/Lang/K/Circular-primes @@ -0,0 +1 @@ +../../Task/Circular-primes/K \ No newline at end of file diff --git a/Lang/K/Compare-a-list-of-strings b/Lang/K/Compare-a-list-of-strings new file mode 120000 index 0000000000..e673df5891 --- /dev/null +++ b/Lang/K/Compare-a-list-of-strings @@ -0,0 +1 @@ +../../Task/Compare-a-list-of-strings/K \ No newline at end of file diff --git a/Lang/K/Compare-length-of-two-strings b/Lang/K/Compare-length-of-two-strings new file mode 120000 index 0000000000..9854a6e09b --- /dev/null +++ b/Lang/K/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/K \ No newline at end of file diff --git a/Lang/K/Descending-primes b/Lang/K/Descending-primes new file mode 120000 index 0000000000..1478a33e22 --- /dev/null +++ b/Lang/K/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/K \ No newline at end of file diff --git a/Lang/K/Distribution-of-0-digits-in-factorial-series b/Lang/K/Distribution-of-0-digits-in-factorial-series new file mode 120000 index 0000000000..c4d66f6a7e --- /dev/null +++ b/Lang/K/Distribution-of-0-digits-in-factorial-series @@ -0,0 +1 @@ +../../Task/Distribution-of-0-digits-in-factorial-series/K \ No newline at end of file diff --git a/Lang/K/Empty-program b/Lang/K/Empty-program deleted file mode 120000 index f255a9c6f6..0000000000 --- a/Lang/K/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/K \ No newline at end of file diff --git a/Lang/K/Entropy b/Lang/K/Entropy new file mode 120000 index 0000000000..ed297bc904 --- /dev/null +++ b/Lang/K/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/K \ No newline at end of file diff --git a/Lang/K/Euler-method b/Lang/K/Euler-method new file mode 120000 index 0000000000..c1f821dc7c --- /dev/null +++ b/Lang/K/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/K \ No newline at end of file diff --git a/Lang/K/Find-common-directory-path b/Lang/K/Find-common-directory-path new file mode 120000 index 0000000000..21e1ffcdd3 --- /dev/null +++ b/Lang/K/Find-common-directory-path @@ -0,0 +1 @@ +../../Task/Find-common-directory-path/K \ No newline at end of file diff --git a/Lang/K/Jewels-and-stones b/Lang/K/Jewels-and-stones new file mode 120000 index 0000000000..e6b3ba2ffd --- /dev/null +++ b/Lang/K/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/K \ No newline at end of file diff --git a/Lang/K/M-bius-function b/Lang/K/M-bius-function new file mode 120000 index 0000000000..e4dca86d37 --- /dev/null +++ b/Lang/K/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/K \ No newline at end of file diff --git a/Lang/K/Monads-Maybe-monad b/Lang/K/Monads-Maybe-monad new file mode 120000 index 0000000000..c39136ba4b --- /dev/null +++ b/Lang/K/Monads-Maybe-monad @@ -0,0 +1 @@ +../../Task/Monads-Maybe-monad/K \ No newline at end of file diff --git a/Lang/K/Monty-Hall-problem b/Lang/K/Monty-Hall-problem new file mode 120000 index 0000000000..8fb0f9e98b --- /dev/null +++ b/Lang/K/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/K \ No newline at end of file diff --git a/Lang/K/Reverse-words-in-a-string b/Lang/K/Reverse-words-in-a-string new file mode 120000 index 0000000000..d83b97640c --- /dev/null +++ b/Lang/K/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/K \ No newline at end of file diff --git a/Lang/K/Sieve-of-Eratosthenes b/Lang/K/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..c66b9a1b22 --- /dev/null +++ b/Lang/K/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/K \ No newline at end of file diff --git a/Lang/K/Sort-numbers-lexicographically b/Lang/K/Sort-numbers-lexicographically new file mode 120000 index 0000000000..11b8c47a3f --- /dev/null +++ b/Lang/K/Sort-numbers-lexicographically @@ -0,0 +1 @@ +../../Task/Sort-numbers-lexicographically/K \ No newline at end of file diff --git a/Lang/K/Split-a-character-string-based-on-change-of-character b/Lang/K/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..719471c77a --- /dev/null +++ b/Lang/K/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/K \ No newline at end of file diff --git a/Lang/K/Square-free-integers b/Lang/K/Square-free-integers new file mode 120000 index 0000000000..a0f2a0affe --- /dev/null +++ b/Lang/K/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/K \ No newline at end of file diff --git a/Lang/K/Strip-a-set-of-characters-from-a-string b/Lang/K/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..2c6359b506 --- /dev/null +++ b/Lang/K/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/K \ No newline at end of file diff --git a/Lang/K/Substring b/Lang/K/Substring new file mode 120000 index 0000000000..002d50df4f --- /dev/null +++ b/Lang/K/Substring @@ -0,0 +1 @@ +../../Task/Substring/K \ No newline at end of file diff --git a/Lang/K/Sum-multiples-of-3-and-5 b/Lang/K/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..625ba55b5f --- /dev/null +++ b/Lang/K/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/K \ No newline at end of file diff --git a/Lang/K/Tic-tac-toe b/Lang/K/Tic-tac-toe new file mode 120000 index 0000000000..bdd7e9ba5b --- /dev/null +++ b/Lang/K/Tic-tac-toe @@ -0,0 +1 @@ +../../Task/Tic-tac-toe/K \ No newline at end of file diff --git a/Lang/K/UTF-8-encode-and-decode b/Lang/K/UTF-8-encode-and-decode new file mode 120000 index 0000000000..f38c9e1894 --- /dev/null +++ b/Lang/K/UTF-8-encode-and-decode @@ -0,0 +1 @@ +../../Task/UTF-8-encode-and-decode/K \ No newline at end of file diff --git a/Lang/K/Write-float-arrays-to-a-text-file b/Lang/K/Write-float-arrays-to-a-text-file new file mode 120000 index 0000000000..2af99671ba --- /dev/null +++ b/Lang/K/Write-float-arrays-to-a-text-file @@ -0,0 +1 @@ +../../Task/Write-float-arrays-to-a-text-file/K \ No newline at end of file diff --git a/Lang/KL1/Hello-world-Text b/Lang/KL1/Hello-world-Text new file mode 120000 index 0000000000..a83e887280 --- /dev/null +++ b/Lang/KL1/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/KL1 \ No newline at end of file diff --git a/Lang/Kantalo/00-LANG.txt b/Lang/Kantalo/00-LANG.txt new file mode 100644 index 0000000000..453580c58d --- /dev/null +++ b/Lang/Kantalo/00-LANG.txt @@ -0,0 +1,40 @@ +{{language|Kantalo +|version=0.0.2 +|exec=interpreted +|strength=weak +|express=explicit +|checking=dynamic +|gc=yes +|tags=Kantalo,Language +|LCT=yes +|hopl=no +|safety=unsafe +|site=http://kantalo.kesug.com/}} + +=={{header|Kantalo}}== + +Kantalo is a non-object-oriented programming language, with the aim of making it easier to use. + +==Main commands== + +Here are some kantalo commands: + +
  • var.save - It is used to define variable.
  • +
  • var.import - Import variable outside functions.
  • +
  • var.edit - Edit an Existing Variable.
  • +
  • terminal.text - Returns a message passed within the argument.
  • +
  • terminal.input - Creates a text input.
  • +
  • if- Used to create conditions .
  • +
  • func - It is used to create functions.
  • +
  • execute - Performs functions.
  • + +
    +Simple Hello world with kantalo: +
    + +var.save nome = "Alice", +func saudacao > ( + terminal.text("Seja bem-vindo(a), -*nome*-!") +) +execute saudacao + \ No newline at end of file diff --git a/Lang/Kantalo/00-META.yaml b/Lang/Kantalo/00-META.yaml new file mode 100644 index 0000000000..c7d465ac08 --- /dev/null +++ b/Lang/Kantalo/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Kantalo diff --git a/Lang/Koka/00-LANG.txt b/Lang/Koka/00-LANG.txt index 96ea39de13..540a8fe180 100644 --- a/Lang/Koka/00-LANG.txt +++ b/Lang/Koka/00-LANG.txt @@ -3,7 +3,7 @@ Releases: - https://github.com/koka-lang/koka/releases -Latest: v2.4.2 +Latest: v3.1.3 '''Language Reference''' diff --git a/Lang/Koka/A+B b/Lang/Koka/A+B new file mode 120000 index 0000000000..5fcfbb2462 --- /dev/null +++ b/Lang/Koka/A+B @@ -0,0 +1 @@ +../../Task/A+B/Koka \ No newline at end of file diff --git a/Lang/Koka/Extend-your-language b/Lang/Koka/Extend-your-language new file mode 120000 index 0000000000..fa9d061610 --- /dev/null +++ b/Lang/Koka/Extend-your-language @@ -0,0 +1 @@ +../../Task/Extend-your-language/Koka \ No newline at end of file diff --git a/Lang/Koka/Jump-anywhere b/Lang/Koka/Jump-anywhere new file mode 120000 index 0000000000..39d5f8124d --- /dev/null +++ b/Lang/Koka/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/Koka \ No newline at end of file diff --git a/Lang/Koka/Leap-year b/Lang/Koka/Leap-year new file mode 120000 index 0000000000..9589417f53 --- /dev/null +++ b/Lang/Koka/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Koka \ No newline at end of file diff --git a/Lang/Koka/Letter-frequency b/Lang/Koka/Letter-frequency new file mode 120000 index 0000000000..35e2486b2e --- /dev/null +++ b/Lang/Koka/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/Koka \ No newline at end of file diff --git a/Lang/Koka/Loops-Break b/Lang/Koka/Loops-Break new file mode 120000 index 0000000000..21d8774db0 --- /dev/null +++ b/Lang/Koka/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Koka \ No newline at end of file diff --git a/Lang/Koka/Man-or-boy-test b/Lang/Koka/Man-or-boy-test new file mode 120000 index 0000000000..d04c480201 --- /dev/null +++ b/Lang/Koka/Man-or-boy-test @@ -0,0 +1 @@ +../../Task/Man-or-boy-test/Koka \ No newline at end of file diff --git a/Lang/Koka/Monads-Writer-monad b/Lang/Koka/Monads-Writer-monad new file mode 120000 index 0000000000..21e3e4c596 --- /dev/null +++ b/Lang/Koka/Monads-Writer-monad @@ -0,0 +1 @@ +../../Task/Monads-Writer-monad/Koka \ No newline at end of file diff --git a/Lang/Koka/Nim-game b/Lang/Koka/Nim-game new file mode 120000 index 0000000000..f3fed42c95 --- /dev/null +++ b/Lang/Koka/Nim-game @@ -0,0 +1 @@ +../../Task/Nim-game/Koka \ No newline at end of file diff --git a/Lang/Koka/Order-by-pair-comparisons b/Lang/Koka/Order-by-pair-comparisons new file mode 120000 index 0000000000..f453142a5f --- /dev/null +++ b/Lang/Koka/Order-by-pair-comparisons @@ -0,0 +1 @@ +../../Task/Order-by-pair-comparisons/Koka \ No newline at end of file diff --git a/Lang/Koka/Tic-tac-toe b/Lang/Koka/Tic-tac-toe new file mode 120000 index 0000000000..0ac61d9c06 --- /dev/null +++ b/Lang/Koka/Tic-tac-toe @@ -0,0 +1 @@ +../../Task/Tic-tac-toe/Koka \ No newline at end of file diff --git a/Lang/Komodo/00-LANG.txt b/Lang/Komodo/00-LANG.txt new file mode 100644 index 0000000000..90f6e00b5c --- /dev/null +++ b/Lang/Komodo/00-LANG.txt @@ -0,0 +1,4 @@ +{{language +|exec=interpreted +|site=https://komodo-lang.org}}{{language programming paradigm|Declarative}}{{language programming paradigm|Procedural}} +Komodo is a programming language to test ideas in a fast and easy way. It is ideal for problems with basic discrete structures, like numbers and words. Komodo tries to make operating with these entities as easy as possible while minimizing the amount of code needed to achieve a successful implementation. Komodo is a scripting language regarding its flexibility, but it is a pretty specific language with a lot of assumptions about how things should be. Komodo is an experimental language, and some of its features are there because I had a personal preference for them. \ No newline at end of file diff --git a/Lang/Komodo/00-META.yaml b/Lang/Komodo/00-META.yaml new file mode 100644 index 0000000000..c626a5f324 --- /dev/null +++ b/Lang/Komodo/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Komodo diff --git a/Lang/Komodo/Arithmetic-Integer b/Lang/Komodo/Arithmetic-Integer new file mode 120000 index 0000000000..bfaefbd88d --- /dev/null +++ b/Lang/Komodo/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Komodo \ No newline at end of file diff --git a/Lang/Komodo/Array-concatenation b/Lang/Komodo/Array-concatenation new file mode 120000 index 0000000000..bc329941d2 --- /dev/null +++ b/Lang/Komodo/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Komodo \ No newline at end of file diff --git a/Lang/Komodo/Empty-string b/Lang/Komodo/Empty-string new file mode 120000 index 0000000000..9210767339 --- /dev/null +++ b/Lang/Komodo/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Komodo \ No newline at end of file diff --git a/Lang/Komodo/FizzBuzz b/Lang/Komodo/FizzBuzz new file mode 120000 index 0000000000..49b35c998a --- /dev/null +++ b/Lang/Komodo/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Komodo \ No newline at end of file diff --git a/Lang/Komodo/Function-definition b/Lang/Komodo/Function-definition new file mode 120000 index 0000000000..375c03b7e3 --- /dev/null +++ b/Lang/Komodo/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Komodo \ No newline at end of file diff --git a/Lang/Komodo/Greatest-element-of-a-list b/Lang/Komodo/Greatest-element-of-a-list new file mode 120000 index 0000000000..61a341a27e --- /dev/null +++ b/Lang/Komodo/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Komodo \ No newline at end of file diff --git a/Lang/Komodo/Hello-world-Text b/Lang/Komodo/Hello-world-Text new file mode 120000 index 0000000000..cf4d6242bb --- /dev/null +++ b/Lang/Komodo/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Komodo \ No newline at end of file diff --git a/Lang/Komodo/Literals-Integer b/Lang/Komodo/Literals-Integer new file mode 120000 index 0000000000..e770e3710e --- /dev/null +++ b/Lang/Komodo/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/Komodo \ No newline at end of file diff --git a/Lang/Komodo/Logical-operations b/Lang/Komodo/Logical-operations new file mode 120000 index 0000000000..f15b7485a0 --- /dev/null +++ b/Lang/Komodo/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Komodo \ No newline at end of file diff --git a/Lang/Komodo/Null-object b/Lang/Komodo/Null-object new file mode 120000 index 0000000000..a6a020a8ca --- /dev/null +++ b/Lang/Komodo/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Komodo \ No newline at end of file diff --git a/Lang/Komodo/Set b/Lang/Komodo/Set new file mode 120000 index 0000000000..a5c8370f07 --- /dev/null +++ b/Lang/Komodo/Set @@ -0,0 +1 @@ +../../Task/Set/Komodo \ No newline at end of file diff --git a/Lang/Komodo/String-concatenation b/Lang/Komodo/String-concatenation new file mode 120000 index 0000000000..72385e6195 --- /dev/null +++ b/Lang/Komodo/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Komodo \ No newline at end of file diff --git a/Lang/Kotlin/00-LANG.txt b/Lang/Kotlin/00-LANG.txt index 5f33d4bd2a..95d9b59867 100644 --- a/Lang/Kotlin/00-LANG.txt +++ b/Lang/Kotlin/00-LANG.txt @@ -4,7 +4,7 @@ |site=http://kotlinlang.org |hopl=no }} -Kotlin is a statically-typed programming language that runs on the [[JVM]] and can also be compiled to JavaScript. It is being developed by JetBrains with assistance from open source contributors and is intended for industrial use. +Kotlin is a statically-typed programming language that runs on the [[runs on vm::Java Virtual Machine]] (JVM) and can also be compiled to JavaScript. It is being developed by JetBrains with assistance from open source contributors and is intended for industrial use. In addition, a separate team at JetBrains is developing a version of Kotlin which compiles (via LLVM) directly to machine code for various platforms. The first Technology Preview for this version was rolled out in April 2017. diff --git a/Lang/Kotlin/Almkvist-Giullera-formula-for-pi b/Lang/Kotlin/Almkvist-Giullera-formula-for-pi new file mode 120000 index 0000000000..e147780c53 --- /dev/null +++ b/Lang/Kotlin/Almkvist-Giullera-formula-for-pi @@ -0,0 +1 @@ +../../Task/Almkvist-Giullera-formula-for-pi/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Bioinformatics-base-count b/Lang/Kotlin/Bioinformatics-base-count deleted file mode 120000 index 998809c6ab..0000000000 --- a/Lang/Kotlin/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Biorhythms b/Lang/Kotlin/Biorhythms new file mode 120000 index 0000000000..d93c9e81d0 --- /dev/null +++ b/Lang/Kotlin/Biorhythms @@ -0,0 +1 @@ +../../Task/Biorhythms/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Boyer-Moore-string-search b/Lang/Kotlin/Boyer-Moore-string-search new file mode 120000 index 0000000000..985c6560bd --- /dev/null +++ b/Lang/Kotlin/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Camel-case-and-snake-case b/Lang/Kotlin/Camel-case-and-snake-case new file mode 120000 index 0000000000..67b25b8962 --- /dev/null +++ b/Lang/Kotlin/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Compare-length-of-two-strings b/Lang/Kotlin/Compare-length-of-two-strings new file mode 120000 index 0000000000..a8c0b8d6cf --- /dev/null +++ b/Lang/Kotlin/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Compiler-AST-interpreter b/Lang/Kotlin/Compiler-AST-interpreter new file mode 120000 index 0000000000..5990b7f53e --- /dev/null +++ b/Lang/Kotlin/Compiler-AST-interpreter @@ -0,0 +1 @@ +../../Task/Compiler-AST-interpreter/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Factorial-primes b/Lang/Kotlin/Factorial-primes new file mode 120000 index 0000000000..36b19250f9 --- /dev/null +++ b/Lang/Kotlin/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Jordan-P-lya-numbers b/Lang/Kotlin/Jordan-P-lya-numbers new file mode 120000 index 0000000000..89b37f7823 --- /dev/null +++ b/Lang/Kotlin/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Miller-Rabin-primality-test b/Lang/Kotlin/Miller-Rabin-primality-test deleted file mode 120000 index 4a724f8c08..0000000000 --- a/Lang/Kotlin/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Minimal-steps-down-to-1 b/Lang/Kotlin/Minimal-steps-down-to-1 new file mode 120000 index 0000000000..65ab282625 --- /dev/null +++ b/Lang/Kotlin/Minimal-steps-down-to-1 @@ -0,0 +1 @@ +../../Task/Minimal-steps-down-to-1/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Padovan-sequence b/Lang/Kotlin/Padovan-sequence new file mode 120000 index 0000000000..18631de1be --- /dev/null +++ b/Lang/Kotlin/Padovan-sequence @@ -0,0 +1 @@ +../../Task/Padovan-sequence/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Quaternion-type b/Lang/Kotlin/Quaternion-type deleted file mode 120000 index a85b316d4c..0000000000 --- a/Lang/Kotlin/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Radical-of-an-integer b/Lang/Kotlin/Radical-of-an-integer new file mode 120000 index 0000000000..e9d51e3e8d --- /dev/null +++ b/Lang/Kotlin/Radical-of-an-integer @@ -0,0 +1 @@ +../../Task/Radical-of-an-integer/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Sorting-Algorithms-Circle-Sort b/Lang/Kotlin/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 74cde5ab2a..0000000000 --- a/Lang/Kotlin/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Strassens-algorithm b/Lang/Kotlin/Strassens-algorithm new file mode 120000 index 0000000000..f68cd59b88 --- /dev/null +++ b/Lang/Kotlin/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Kotlin \ No newline at end of file diff --git a/Lang/LDPL/Command-line-arguments b/Lang/LDPL/Command-line-arguments new file mode 120000 index 0000000000..7b4b88a226 --- /dev/null +++ b/Lang/LDPL/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/LDPL \ No newline at end of file diff --git a/Lang/LOLCODE/00-LANG.txt b/Lang/LOLCODE/00-LANG.txt index 57c4165430..2195760c79 100644 --- a/Lang/LOLCODE/00-LANG.txt +++ b/Lang/LOLCODE/00-LANG.txt @@ -3,4 +3,21 @@ |site=http://lolcode.org/ |hopl=no }} + +LOLCODE is an esoteric language created by Adam Lindsay in 2007. It was inspired by the [https://en.wikipedia.org/wiki/Lolcat lolcat] phenomenon which began a year earlier. LOLCODE uses intentionally grammatically incorrect text known as lolspeak, a humorous imagining of what a cat might say if it could speak something resembling English. + +Here is an example program that prints the numbers 0 through 9 to standard output: + +HAI 1.3 + +IM IN YR loop UPPIN YR var TIL BOTH SAEM var AN 10 + VISIBLE var +IM OUTTA YR loop + +KTHXBYE + + +==Todo== +[https://rosettacode.org/wiki/Tasks_not_implemented_in_LOLCODE Tasks not implemented in LOLCODE] + [[Category:Esoteric Languages]] \ No newline at end of file diff --git a/Lang/LOLCODE/A+B b/Lang/LOLCODE/A+B new file mode 120000 index 0000000000..d5ea45853c --- /dev/null +++ b/Lang/LOLCODE/A+B @@ -0,0 +1 @@ +../../Task/A+B/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Arithmetic-Integer b/Lang/LOLCODE/Arithmetic-Integer new file mode 120000 index 0000000000..bba2907420 --- /dev/null +++ b/Lang/LOLCODE/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Boolean-values b/Lang/LOLCODE/Boolean-values new file mode 120000 index 0000000000..b3ad6a0e0d --- /dev/null +++ b/Lang/LOLCODE/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Case-sensitivity-of-identifiers b/Lang/LOLCODE/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..32c69366ea --- /dev/null +++ b/Lang/LOLCODE/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Catalan-numbers b/Lang/LOLCODE/Catalan-numbers new file mode 120000 index 0000000000..3fdf885cda --- /dev/null +++ b/Lang/LOLCODE/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Chinese-zodiac b/Lang/LOLCODE/Chinese-zodiac new file mode 120000 index 0000000000..0169fc21dd --- /dev/null +++ b/Lang/LOLCODE/Chinese-zodiac @@ -0,0 +1 @@ +../../Task/Chinese-zodiac/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Compound-data-type b/Lang/LOLCODE/Compound-data-type new file mode 120000 index 0000000000..a58d5bfd2a --- /dev/null +++ b/Lang/LOLCODE/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Conditional-structures b/Lang/LOLCODE/Conditional-structures new file mode 120000 index 0000000000..15617a63e0 --- /dev/null +++ b/Lang/LOLCODE/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Copy-a-string b/Lang/LOLCODE/Copy-a-string new file mode 120000 index 0000000000..deb186939a --- /dev/null +++ b/Lang/LOLCODE/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Determine-if-a-string-has-all-the-same-characters b/Lang/LOLCODE/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..492082be7e --- /dev/null +++ b/Lang/LOLCODE/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Dot-product b/Lang/LOLCODE/Dot-product new file mode 120000 index 0000000000..0667fd8bc3 --- /dev/null +++ b/Lang/LOLCODE/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Empty-program b/Lang/LOLCODE/Empty-program new file mode 120000 index 0000000000..31b87c5a4b --- /dev/null +++ b/Lang/LOLCODE/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Evaluate-binomial-coefficients b/Lang/LOLCODE/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..f6f761fd40 --- /dev/null +++ b/Lang/LOLCODE/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Function-definition b/Lang/LOLCODE/Function-definition new file mode 120000 index 0000000000..c9fc3fa7a5 --- /dev/null +++ b/Lang/LOLCODE/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Gotchas b/Lang/LOLCODE/Gotchas new file mode 120000 index 0000000000..753dc0a0c3 --- /dev/null +++ b/Lang/LOLCODE/Gotchas @@ -0,0 +1 @@ +../../Task/Gotchas/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Hello-world-Newline-omission b/Lang/LOLCODE/Hello-world-Newline-omission new file mode 120000 index 0000000000..29d6dd8c2e --- /dev/null +++ b/Lang/LOLCODE/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Integer-comparison b/Lang/LOLCODE/Integer-comparison new file mode 120000 index 0000000000..565277c685 --- /dev/null +++ b/Lang/LOLCODE/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Isqrt-integer-square-root-of-X b/Lang/LOLCODE/Isqrt-integer-square-root-of-X new file mode 120000 index 0000000000..4aa1c0772e --- /dev/null +++ b/Lang/LOLCODE/Isqrt-integer-square-root-of-X @@ -0,0 +1 @@ +../../Task/Isqrt-integer-square-root-of-X/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Jewels-and-stones b/Lang/LOLCODE/Jewels-and-stones new file mode 120000 index 0000000000..5c30a50d3b --- /dev/null +++ b/Lang/LOLCODE/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Jordan-P-lya-numbers b/Lang/LOLCODE/Jordan-P-lya-numbers new file mode 120000 index 0000000000..d942ad0dab --- /dev/null +++ b/Lang/LOLCODE/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Loops-Do-while b/Lang/LOLCODE/Loops-Do-while new file mode 120000 index 0000000000..55da8969f1 --- /dev/null +++ b/Lang/LOLCODE/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Loops-Downward-for b/Lang/LOLCODE/Loops-Downward-for new file mode 120000 index 0000000000..098dda4410 --- /dev/null +++ b/Lang/LOLCODE/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Loops-For b/Lang/LOLCODE/Loops-For new file mode 120000 index 0000000000..131d677c68 --- /dev/null +++ b/Lang/LOLCODE/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Loops-For-with-a-specified-step b/Lang/LOLCODE/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..5debcbe8c4 --- /dev/null +++ b/Lang/LOLCODE/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Loops-N-plus-one-half b/Lang/LOLCODE/Loops-N-plus-one-half new file mode 120000 index 0000000000..f67d63ceea --- /dev/null +++ b/Lang/LOLCODE/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Menu b/Lang/LOLCODE/Menu new file mode 120000 index 0000000000..8ec9ba2bbb --- /dev/null +++ b/Lang/LOLCODE/Menu @@ -0,0 +1 @@ +../../Task/Menu/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Nested-function b/Lang/LOLCODE/Nested-function new file mode 120000 index 0000000000..28b8eedc4f --- /dev/null +++ b/Lang/LOLCODE/Nested-function @@ -0,0 +1 @@ +../../Task/Nested-function/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Nim-game b/Lang/LOLCODE/Nim-game new file mode 120000 index 0000000000..8694962a96 --- /dev/null +++ b/Lang/LOLCODE/Nim-game @@ -0,0 +1 @@ +../../Task/Nim-game/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Nth b/Lang/LOLCODE/Nth new file mode 120000 index 0000000000..ca0f39b290 --- /dev/null +++ b/Lang/LOLCODE/Nth @@ -0,0 +1 @@ +../../Task/Nth/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Primality-by-trial-division b/Lang/LOLCODE/Primality-by-trial-division new file mode 120000 index 0000000000..243da2a0b6 --- /dev/null +++ b/Lang/LOLCODE/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Real-constants-and-functions b/Lang/LOLCODE/Real-constants-and-functions new file mode 120000 index 0000000000..9cae154fda --- /dev/null +++ b/Lang/LOLCODE/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Repeat b/Lang/LOLCODE/Repeat new file mode 120000 index 0000000000..bfb28ef859 --- /dev/null +++ b/Lang/LOLCODE/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Repeat-a-string b/Lang/LOLCODE/Repeat-a-string new file mode 120000 index 0000000000..b733bdc3e9 --- /dev/null +++ b/Lang/LOLCODE/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Return-multiple-values b/Lang/LOLCODE/Return-multiple-values new file mode 120000 index 0000000000..326bda4561 --- /dev/null +++ b/Lang/LOLCODE/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Reverse-a-string b/Lang/LOLCODE/Reverse-a-string new file mode 120000 index 0000000000..c092ce2e24 --- /dev/null +++ b/Lang/LOLCODE/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Short-circuit-evaluation b/Lang/LOLCODE/Short-circuit-evaluation new file mode 120000 index 0000000000..747e2d63b6 --- /dev/null +++ b/Lang/LOLCODE/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Split-a-character-string-based-on-change-of-character b/Lang/LOLCODE/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..3d417eb3b9 --- /dev/null +++ b/Lang/LOLCODE/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/String-concatenation b/Lang/LOLCODE/String-concatenation new file mode 120000 index 0000000000..8f1d425354 --- /dev/null +++ b/Lang/LOLCODE/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/String-interpolation-included- b/Lang/LOLCODE/String-interpolation-included- new file mode 120000 index 0000000000..2477427706 --- /dev/null +++ b/Lang/LOLCODE/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Sum-of-a-series b/Lang/LOLCODE/Sum-of-a-series new file mode 120000 index 0000000000..3071bb174e --- /dev/null +++ b/Lang/LOLCODE/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Terminal-control-Display-an-extended-character b/Lang/LOLCODE/Terminal-control-Display-an-extended-character new file mode 120000 index 0000000000..506d7e357c --- /dev/null +++ b/Lang/LOLCODE/Terminal-control-Display-an-extended-character @@ -0,0 +1 @@ +../../Task/Terminal-control-Display-an-extended-character/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Terminal-control-Ringing-the-terminal-bell b/Lang/LOLCODE/Terminal-control-Ringing-the-terminal-bell new file mode 120000 index 0000000000..a3dce93aeb --- /dev/null +++ b/Lang/LOLCODE/Terminal-control-Ringing-the-terminal-bell @@ -0,0 +1 @@ +../../Task/Terminal-control-Ringing-the-terminal-bell/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Tokenize-a-string b/Lang/LOLCODE/Tokenize-a-string new file mode 120000 index 0000000000..61653af306 --- /dev/null +++ b/Lang/LOLCODE/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Topic-variable b/Lang/LOLCODE/Topic-variable new file mode 120000 index 0000000000..8a1f58e75e --- /dev/null +++ b/Lang/LOLCODE/Topic-variable @@ -0,0 +1 @@ +../../Task/Topic-variable/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Variable-declaration-reset b/Lang/LOLCODE/Variable-declaration-reset new file mode 120000 index 0000000000..126975a58e --- /dev/null +++ b/Lang/LOLCODE/Variable-declaration-reset @@ -0,0 +1 @@ +../../Task/Variable-declaration-reset/LOLCODE \ No newline at end of file diff --git a/Lang/LOLCODE/Zeckendorf-number-representation b/Lang/LOLCODE/Zeckendorf-number-representation new file mode 120000 index 0000000000..093dc5325c --- /dev/null +++ b/Lang/LOLCODE/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/LOLCODE \ No newline at end of file diff --git a/Lang/LSE/Empty-program b/Lang/LSE/Empty-program deleted file mode 120000 index 16856f6969..0000000000 --- a/Lang/LSE/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/LSE \ No newline at end of file diff --git a/Lang/LSL/00-LANG.txt b/Lang/LSL/00-LANG.txt index bdb68f1bc2..3025477b27 100644 --- a/Lang/LSL/00-LANG.txt +++ b/Lang/LSL/00-LANG.txt @@ -1,25 +1,42 @@ {{language |hopl=no }} -The [[wp:Linden_Scripting_Language|'''Linden Scripting Language''']], usually just called '''LSL''' for short, is a language developed by [http://en.wikipedia.org/wiki/Linden_Lab Linden Labs] for their [[wp:Second_Life|Second Life]] virtual world. LSL allows Second Life objects to sense, respond to events, and interact with the (virtual) world around them, and the Avatars in that world. +'''LSL''' ([[wp:Linden_Scripting_Language|'''Linden Scripting Language''']]) is the scripting language developed by [http://en.wikipedia.org/wiki/Linden_Lab Linden Labs] for their virtual sandbox world [[wp:Second_Life|Second Life]]. Also [[wp:OpenSimulator|OpenSimulator]] along with other [https://omrg.org Open Metaverse] proprietors run a largely compatible superset version of LSL. LSL scripts allow objects rezzed in-world(in-game) to interact with and manipulate the virtual world around them, but also the internet in limited fashion. LSL has many built-in functions, and the ability for inter script messaging, http POST and GET requests, gui dialog boxes, chat channel messaging, java & C like semantics, is turning complete, etc. + +==In Depth: Syntax Structure== +LSL is C-like with scoping of local varaibles and global; strict typing with type-recasting possible; use of {} to encapsulate function blocks, and ; to denote an execution block, and () to encapsulate parameters, and equivalency from right to left and for assignment myint=1-2, variables can be formed as procedures that return a value. Oprands are the same, but there are no pointers nor triple oprands such as +++. +LSL is not like C in many ways, there are only 3 basic types, and 4 special types of data structures: integer (unsigned 32bit), float (unsigned 32bit), string (max string length varies), key ( a 32bit base16 UUID often treated as a string),vectors (set of three floats, aka a tuple <0.0,0.0,0.0> ); quaternions or rot ( set of four floats <0.0,0.0,0.0,0.0> ); lists (1D array that can contain any of or a mix of types of data), There is no void as a type! Nor is there any keyword for functions. Simply outside of a script's default loop function called a state, one forms a function with it's name(type prams){;} and can be called anywhere else. Over-loading is not valid, nor is under-loading when calling a function or variable-function that returns a value. + +==In Depth: Where & when LSL scripts can run== +Rezzing is dragging and dropping from the user's inventory into to the virtual world space, or being worn as attachments to one's avatar (including HUDs). These aforementioned objects take the form of built-in 3d models of basic shapes commonly known as primitives or just prims, sculpted prims, and user uploaded 3D models. Each object has in-turn it's own inventory where the scripts run. In truth one can link many objects into a meta-object known as a link-set, each linked object retains it's own inventory instance, and running scripts. When an object is derezzed, that is brought back into the user's inventory, or an attached object derezzes when the user logs off the scripts' current status is paused and saved. + +==In Depth: LSL basic script structure== +Each script must contain a default script state, this is very similar to the default loop found with in Arduino Clike programming. It is possible to switch the currently running state of a script to a knew one, and back again, thus ignoring/clearing any callback functions called "events". (However the timer does not get cleared upon state changes). +Each state in LSL scripts can have built in call-back functions known as "event types" which are triggered with interrupt like behavior from a cue that is filled by the current simulator or sim (a sim is world instance, generally a 256x256meter block, although some communication with adjacent sims maybe possible) the script is residing in. Most events are repeatable, but there are logically single fire events such as state_entry, on_rez, on_attach, on_deattach. Aforementioned user functions, variables, + +==Back-ends of LSL with in Second-Life== +In Second-life, one can save & run scripts optionally for the two current back-ends that actually run the code over a server, each with their own pros and cons. +[https://wiki.secondlife.com/wiki/LSO LSO] exists for backward compatibility. LSO saved scripts are interpreted at runtime by the server. LSO scripts take less initial script memory, they are limited to less available memory as well. In rare circumstances LSO may run faster than MONO. However LSO suffers from memory fragmentation slow downs with list connotation (there are some work around). LSO handles the jump to @location in unexpected ways. +Mono saved scripts are compiled under [[wp:Mono_(software)|Mono]] (the most recent) to byte-code ran by the server. + Most scripts will benefit from being set to MONO compilation for greater speed and more available memory, at the cost of higher initial memory used. ==Flavors of LSL== -There are currently three flavors of the LSL language -# LSL compiled under [[wp:Mono_(software)|Mono]] (the most recent) -# The original interpreted version (no longer being developed and only exists for backward compatibility) -# A largely compatible version of LSL that can run in the [[wp:OpenSimulator|OpenSimulator]] virtual world. +# A largely compatible version of LSL that can run in the [[http://opensimulator.org/wiki/OSSL_Script_Library|OpenSimulator]] virtual world. ==Documentation== There are two popular web sites documenting LSL # Second Life's own [http://wiki.secondlife.com/wiki/LSL_Portal LSL Portal] # a user supported [http://lslwiki.net/lslwiki/wakka.php LSL Wiki] -==Libraries== +==Libraries of Scripts== There exists several open source libraries where users share code +* [https://outworldz.com/cgi/freescripts.plx Free LSL Scripts] * [http://community.secondlife.com/t5/LSL-Scripting-Library/bd-p/LSLScriptingLibrary LSL Scripting Library] * [http://wiki.secondlife.com/wiki/Category:LSL_Examples LSL Examples] -* [http://www.free-lsl-scripts.com/cgi/freescripts.plx Free LSL Scripts] * [http://community.secondlife.com/t5/LSL-Scripting/bd-p/LSLScripting LSL Scripting] ==External Editors== -There are also many [http://wiki.secondlife.com/wiki/LSL_Alternate_Editors external editors] for LSL allowing you to write, syntax check, and (to a limited extent) execute LSL outside of the Second Life environment. You will need to sign up at [http://secondlife.com Second Life] and have a Second Life account to execute LSL in the virtual world. Your scripts can exist by themselves in a folder of your inventory, or in an Object in your inventory, but need to be in an Object that is in-world to execute (if an Object containing scripts is taken in to your inventory, the scripts will be suspended and will resume when brought out in to the world again.) \ No newline at end of file +There are also many [http://wiki.secondlife.com/wiki/LSL_Alternate_Editors external editors] for LSL allowing you to write with highlighting, [https://github.com/Feay/LSL-for-Scite api tool-tips], [https://github.com/Makopo/lslint syntax check], and (to a limited extent) +[https://github.com/Sei-Lisa/LSL-compiler compile and execute LSL] outside of the Second Life environment. + +You will need to sign up at [http://secondlife.com Second Life] and have a Second Life account to execute LSL in the virtual world. Your scripts can exist by themselves in a folder of your inventory, or in an Object in your inventory, but need to be in an Object that is in-world to execute (if an Object containing scripts is taken in to your inventory, the scripts will be suspended and will resume when brought out in to the world again.) \ No newline at end of file diff --git a/Lang/LSL/Binary-digits b/Lang/LSL/Binary-digits new file mode 120000 index 0000000000..54627407f6 --- /dev/null +++ b/Lang/LSL/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/LSL \ No newline at end of file diff --git a/Lang/Labyrinth/00-LANG.txt b/Lang/Labyrinth/00-LANG.txt new file mode 100644 index 0000000000..6b7624f3ac --- /dev/null +++ b/Lang/Labyrinth/00-LANG.txt @@ -0,0 +1 @@ +{{stub}}{{language|site=https://github.com/m-ender/labyrinth}} \ No newline at end of file diff --git a/Lang/Labyrinth/00-META.yaml b/Lang/Labyrinth/00-META.yaml new file mode 100644 index 0000000000..2e09fd26db --- /dev/null +++ b/Lang/Labyrinth/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Labyrinth diff --git a/Lang/Lambdatalk/Bioinformatics-base-count b/Lang/Lambdatalk/Bioinformatics-base-count deleted file mode 120000 index 03508c2431..0000000000 --- a/Lang/Lambdatalk/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Lambdatalk \ No newline at end of file diff --git a/Lang/Langur/00-LANG.txt b/Lang/Langur/00-LANG.txt index c2da20439a..612e66c8de 100644 --- a/Lang/Langur/00-LANG.txt +++ b/Lang/Langur/00-LANG.txt @@ -3,12 +3,22 @@ |hopl=no }} -Langur is an open-source imperative/functional programming language. The name langur begins with a lowercase letter when it does not start a sentence. +Langur is an open-source programming language that natively uses arbitrary-precision decimal floating point, and deals with extremely large and small numbers. It also has native complex numbers that are arbitrary-precision decimal. Its principles of design are accuracy in calculation and a concise, expressive syntax. -Langur code can be run with script files or with its REPL. The recommended file name extension is .langur. +Langur has a high number of mathematical operators (rem, mod, etc.) and logical operators (including nand, nor, nxor). -Langur uses a hash mark for single line comments. Therefore, script files may begin with a shebang to tell a Linux shell where to find the interpreter. +Langur has date/time literals (using ISO 8601 syntax) and duration literals. -Source code is in UTF-8, with no BOM, using Linux line returns (line feed) only. +Langur has flexible parameter options, with both positional parameters and parameters by name, and with parameter expansion (on last positional parameter). Parameters by name may be optional or required. + +Langur uses exceptions instead of error codes. + +Langur code can be run from executable files, or you can use interactive mode or the REPL. The file name extension is .langur. + +Langur uses a hash mark for single line comments. Therefore, script files can begin with a shebang to tell a Linux shell where to find the interpreter. + +Source code is always UTF-8, with no BOM, using Linux line returns (line feed) only. + +The name langur begins with a lowercase letter when it does not start a sentence. website: https://langurlang.org/ \ No newline at end of file diff --git a/Lang/Langur/99-bottles-of-beer b/Lang/Langur/99-bottles-of-beer new file mode 120000 index 0000000000..043a4c56e9 --- /dev/null +++ b/Lang/Langur/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/Langur \ No newline at end of file diff --git a/Lang/Langur/Angle-difference-between-two-bearings b/Lang/Langur/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..7b4ef17804 --- /dev/null +++ b/Lang/Langur/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/Langur \ No newline at end of file diff --git a/Lang/Langur/Arithmetic-Complex b/Lang/Langur/Arithmetic-Complex new file mode 120000 index 0000000000..5341d853ac --- /dev/null +++ b/Lang/Langur/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Langur \ No newline at end of file diff --git a/Lang/Langur/Babbage-problem b/Lang/Langur/Babbage-problem new file mode 120000 index 0000000000..662297217a --- /dev/null +++ b/Lang/Langur/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/Langur \ No newline at end of file diff --git a/Lang/Langur/Check-that-file-exists b/Lang/Langur/Check-that-file-exists new file mode 120000 index 0000000000..d23d4fb2de --- /dev/null +++ b/Lang/Langur/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Langur \ No newline at end of file diff --git a/Lang/Langur/Convert-seconds-to-compound-duration b/Lang/Langur/Convert-seconds-to-compound-duration new file mode 120000 index 0000000000..542c4c4b83 --- /dev/null +++ b/Lang/Langur/Convert-seconds-to-compound-duration @@ -0,0 +1 @@ +../../Task/Convert-seconds-to-compound-duration/Langur \ No newline at end of file diff --git a/Lang/Langur/Currency b/Lang/Langur/Currency new file mode 120000 index 0000000000..5a712c5b9d --- /dev/null +++ b/Lang/Langur/Currency @@ -0,0 +1 @@ +../../Task/Currency/Langur \ No newline at end of file diff --git a/Lang/Langur/Empty-string b/Lang/Langur/Empty-string deleted file mode 120000 index f046a55466..0000000000 --- a/Lang/Langur/Empty-string +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-string/Langur \ No newline at end of file diff --git a/Lang/Langur/Enforced-immutability b/Lang/Langur/Enforced-immutability new file mode 120000 index 0000000000..a6a872e8c6 --- /dev/null +++ b/Lang/Langur/Enforced-immutability @@ -0,0 +1 @@ +../../Task/Enforced-immutability/Langur \ No newline at end of file diff --git a/Lang/Langur/I-before-E-except-after-C b/Lang/Langur/I-before-E-except-after-C new file mode 120000 index 0000000000..a4c67c55c7 --- /dev/null +++ b/Lang/Langur/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/Langur \ No newline at end of file diff --git a/Lang/Langur/Monty-Hall-problem b/Lang/Langur/Monty-Hall-problem new file mode 120000 index 0000000000..b5a048c861 --- /dev/null +++ b/Lang/Langur/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/Langur \ No newline at end of file diff --git a/Lang/Langur/Morse-code b/Lang/Langur/Morse-code new file mode 120000 index 0000000000..ee4498f8de --- /dev/null +++ b/Lang/Langur/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/Langur \ No newline at end of file diff --git a/Lang/Langur/Old-Russian-measure-of-length b/Lang/Langur/Old-Russian-measure-of-length new file mode 120000 index 0000000000..45d7b04413 --- /dev/null +++ b/Lang/Langur/Old-Russian-measure-of-length @@ -0,0 +1 @@ +../../Task/Old-Russian-measure-of-length/Langur \ No newline at end of file diff --git a/Lang/Langur/Program-name b/Lang/Langur/Program-name deleted file mode 120000 index 04198cf0de..0000000000 --- a/Lang/Langur/Program-name +++ /dev/null @@ -1 +0,0 @@ -../../Task/Program-name/Langur \ No newline at end of file diff --git a/Lang/Langur/Safe-addition b/Lang/Langur/Safe-addition new file mode 120000 index 0000000000..9cd478ca7f --- /dev/null +++ b/Lang/Langur/Safe-addition @@ -0,0 +1 @@ +../../Task/Safe-addition/Langur \ No newline at end of file diff --git a/Lang/Langur/String-interpolation-included- b/Lang/Langur/String-interpolation-included- new file mode 120000 index 0000000000..e0b5bfaf9c --- /dev/null +++ b/Lang/Langur/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/Langur \ No newline at end of file diff --git a/Lang/Langur/Sum-of-a-series b/Lang/Langur/Sum-of-a-series new file mode 120000 index 0000000000..4e4882b880 --- /dev/null +++ b/Lang/Langur/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Langur \ No newline at end of file diff --git a/Lang/Langur/Unicode-strings b/Lang/Langur/Unicode-strings deleted file mode 120000 index 4d170c5fd7..0000000000 --- a/Lang/Langur/Unicode-strings +++ /dev/null @@ -1 +0,0 @@ -../../Task/Unicode-strings/Langur \ No newline at end of file diff --git a/Lang/Lapyst/00-LANG.txt b/Lang/Lapyst/00-LANG.txt new file mode 100644 index 0000000000..4b906ad0c0 --- /dev/null +++ b/Lang/Lapyst/00-LANG.txt @@ -0,0 +1,14 @@ +{{stub}} +{{language|Lapyst +|site=https://lang.lapyst.dev +|exec=both +|parampass=both +|strength=strong +|express=both +|checking=static +|tags=lapyst +|gc=yes (optional)}} + +Lapyst is an general-purpose language designed by [[User:Mai Lapyst]]. It features multiple backend strategies (machinecode, bytecode and interpretation), while combining many usefull features of other languages for the user to choose from. The philosophy in the language is generally to empower the user and give it as much choice as possible. + +The current default implementation is [[Lapystc]]. \ No newline at end of file diff --git a/Lang/Lapyst/00-META.yaml b/Lang/Lapyst/00-META.yaml new file mode 100644 index 0000000000..3187527652 --- /dev/null +++ b/Lang/Lapyst/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Lapyst diff --git a/Lang/Lapyst/Conditional-structures b/Lang/Lapyst/Conditional-structures new file mode 120000 index 0000000000..d244d152bd --- /dev/null +++ b/Lang/Lapyst/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Lapyst \ No newline at end of file diff --git a/Lang/Lean/00-LANG.txt b/Lang/Lean/00-LANG.txt index 174b82817c..ae97385d36 100644 --- a/Lang/Lean/00-LANG.txt +++ b/Lang/Lean/00-LANG.txt @@ -1,17 +1,22 @@ -{{language +{{language|Lean |exec=machine |strength=strong |safety=safe |checking=both |gc=yes -|LCT=yes}} -{{implementation|Lean}} +|LCT=yes +|site=https://lean-lang.org/}} {{language programming paradigm|functional}} {{language programming paradigm|dependent-types}} +'''Lean''' is a dependently typed programming language and proof assistant, similar to [[Rocq]] and [[Agda]]. It aims to bridge the gap between interactive and automated theorem proving by situating automated tools and methods in a framework that supports user interaction and the construction of fully specified axiomatic proofs. -'''Lean'''   is an open source theorem prover and programming language being developed at Microsoft Research. +As a proof assistant / theorem prover, Lean primarily benefits from Mathlib, a mechanized implementation of swaths of mathematics at the undergraduate and graduate level. -Lean aims to bridge the gap between interactive and automated theorem proving, by situating automated tools and methods in a framework that supports user interaction and the construction of fully specified axiomatic proofs. +As a general-purpose programming language, Lean benefits from its use as a theorem prover, as several features developed for the purpose of theorem proving, such as its dependent types system and its syntax-rewriting macros, also find much utility outside their original theorem proving contexts. -https://leanprover.github.io/about/ \ No newline at end of file +Lean 4 is the current major version of the language, being a bootstrapped rewrite of the older (and different) Lean 3 system. + +=== Citations === + +Frequently asked questions: https://lean-lang.org/faq/ \ No newline at end of file diff --git a/Lang/Lean/Hello-world-Standard-error b/Lang/Lean/Hello-world-Standard-error new file mode 120000 index 0000000000..cad633adb0 --- /dev/null +++ b/Lang/Lean/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Lean \ No newline at end of file diff --git a/Lang/Liberty-BASIC/Calculating-the-value-of-e b/Lang/Liberty-BASIC/Calculating-the-value-of-e new file mode 120000 index 0000000000..95f95733b8 --- /dev/null +++ b/Lang/Liberty-BASIC/Calculating-the-value-of-e @@ -0,0 +1 @@ +../../Task/Calculating-the-value-of-e/Liberty-BASIC \ No newline at end of file diff --git a/Lang/Liberty-BASIC/Egyptian-division b/Lang/Liberty-BASIC/Egyptian-division new file mode 120000 index 0000000000..91346c7989 --- /dev/null +++ b/Lang/Liberty-BASIC/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/Liberty-BASIC \ No newline at end of file diff --git a/Lang/Liberty-BASIC/Hunt-the-Wumpus b/Lang/Liberty-BASIC/Hunt-the-Wumpus new file mode 120000 index 0000000000..4e2d0e150d --- /dev/null +++ b/Lang/Liberty-BASIC/Hunt-the-Wumpus @@ -0,0 +1 @@ +../../Task/Hunt-the-Wumpus/Liberty-BASIC \ No newline at end of file diff --git a/Lang/Liberty-BASIC/Jacobsthal-numbers b/Lang/Liberty-BASIC/Jacobsthal-numbers new file mode 120000 index 0000000000..c1008ff58b --- /dev/null +++ b/Lang/Liberty-BASIC/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/Liberty-BASIC \ No newline at end of file diff --git a/Lang/Liberty-BASIC/Jaro-similarity b/Lang/Liberty-BASIC/Jaro-similarity new file mode 120000 index 0000000000..0f3ee067c6 --- /dev/null +++ b/Lang/Liberty-BASIC/Jaro-similarity @@ -0,0 +1 @@ +../../Task/Jaro-similarity/Liberty-BASIC \ No newline at end of file diff --git a/Lang/Liberty-BASIC/Miller-Rabin-primality-test b/Lang/Liberty-BASIC/Miller-Rabin-primality-test deleted file mode 120000 index 01eccc1a73..0000000000 --- a/Lang/Liberty-BASIC/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Liberty-BASIC \ No newline at end of file diff --git a/Lang/Liberty-BASIC/Minesweeper-game b/Lang/Liberty-BASIC/Minesweeper-game new file mode 120000 index 0000000000..19abfc9a07 --- /dev/null +++ b/Lang/Liberty-BASIC/Minesweeper-game @@ -0,0 +1 @@ +../../Task/Minesweeper-game/Liberty-BASIC \ No newline at end of file diff --git a/Lang/Liberty-BASIC/Numbers-which-are-not-the-sum-of-distinct-squares b/Lang/Liberty-BASIC/Numbers-which-are-not-the-sum-of-distinct-squares new file mode 120000 index 0000000000..18d07e8ad3 --- /dev/null +++ b/Lang/Liberty-BASIC/Numbers-which-are-not-the-sum-of-distinct-squares @@ -0,0 +1 @@ +../../Task/Numbers-which-are-not-the-sum-of-distinct-squares/Liberty-BASIC \ No newline at end of file diff --git a/Lang/Liberty-BASIC/Numbers-with-equal-rises-and-falls b/Lang/Liberty-BASIC/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..019f830246 --- /dev/null +++ b/Lang/Liberty-BASIC/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/Liberty-BASIC \ No newline at end of file diff --git a/Lang/Liberty-BASIC/Poker-hand-analyser b/Lang/Liberty-BASIC/Poker-hand-analyser new file mode 120000 index 0000000000..3ed8c3b507 --- /dev/null +++ b/Lang/Liberty-BASIC/Poker-hand-analyser @@ -0,0 +1 @@ +../../Task/Poker-hand-analyser/Liberty-BASIC \ No newline at end of file diff --git a/Lang/Liberty-BASIC/Primality-by-Wilsons-theorem b/Lang/Liberty-BASIC/Primality-by-Wilsons-theorem new file mode 120000 index 0000000000..d68ab9bb3f --- /dev/null +++ b/Lang/Liberty-BASIC/Primality-by-Wilsons-theorem @@ -0,0 +1 @@ +../../Task/Primality-by-Wilsons-theorem/Liberty-BASIC \ No newline at end of file diff --git a/Lang/Liberty-BASIC/Quaternion-type b/Lang/Liberty-BASIC/Quaternion-type deleted file mode 120000 index 33da9602b0..0000000000 --- a/Lang/Liberty-BASIC/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Liberty-BASIC \ No newline at end of file diff --git a/Lang/Liberty-BASIC/Snake b/Lang/Liberty-BASIC/Snake new file mode 120000 index 0000000000..20a60d8427 --- /dev/null +++ b/Lang/Liberty-BASIC/Snake @@ -0,0 +1 @@ +../../Task/Snake/Liberty-BASIC \ No newline at end of file diff --git a/Lang/Lilypond/00-LANG.txt b/Lang/Lilypond/00-LANG.txt index 5c24c70c93..9afe2b1bd9 100644 --- a/Lang/Lilypond/00-LANG.txt +++ b/Lang/Lilypond/00-LANG.txt @@ -1,9 +1 @@ -{{stub}} -{{language|lilypond -|site=http://www.lilypond.org/ -|hopl=no -}} - -The lilypond language is used by the lilypond score production software for describing the layout of musical score sheets. - -[[Category:Musical Notation]] \ No newline at end of file +#REDIRECT [[:Category:LilyPond]] \ No newline at end of file diff --git a/Lang/Locomotive-Basic/00-LANG.txt b/Lang/Locomotive-Basic/00-LANG.txt index 04db5b5ea8..5045a1b047 100644 --- a/Lang/Locomotive-Basic/00-LANG.txt +++ b/Lang/Locomotive-Basic/00-LANG.txt @@ -7,9 +7,9 @@ '''Locomotive BASIC''' is a variant of BASIC that is built into the ROM of the [[wp:Amstrad CPC|Amstrad CPC]] series of home computers introduced in 1984. In the 1980s, the CPC was a popular, slightly more expensive alternative to the Commodore C64/C128. It was not just suited for games but also office work because of its high resolution display and [[wp:CP/M|CP/M]] support. -The easiest way to use Locomotive BASIC today is [https://benchmarko.github.io/CPCBasic/cpcbasic.html CPCBasic], a very fast implementation in JavaScript which also allows easy pasting of code from Rosetta Code. Note that programs will run much faster in CPCBasic than on a real CPC. To slow down a program, add an extra delay loop to the main loop, e.g.:for delay=1 to 5:frame:nextwhich will pause for five frames or 0.1 seconds. +The easiest way to use Locomotive BASIC today is [https://benchmarko.github.io/CPCBasic/cpcbasic.html CPCBasic], a very fast implementation in JavaScript which also allows easy pasting of code from Rosetta Code. Note that programs will run much faster in CPCBasic than on a real CPC. To slow down a program, add an extra delay loop to the main loop, e.g. for delay=1 to 5:frame:nextwhich will pause for five frames or 0.1 seconds. -[https://www.retrovm.com/ CPCBox] is another option for the web browser, a whole-machine JavaScript CPC emulator mainly for games which has good compatibility but which lacks copy and paste support. +[https://retroshowcase.gr/cpcbox-master/ CPCBox] is another option for the web browser, a whole-machine JavaScript CPC emulator mainly for games which has good compatibility but which lacks copy and paste support. Locomotive BASIC can also be used via native CPC emulators such as [http://www.winape.net/ WinAPE] (Windows) or [http://sourceforge.net/projects/javacpc/ JavaCPC] (Windows/macOS/Linux). All these CPC emulators are also perfectly legal because Amstrad has given their permission for distributing CPC ROM images with emulators. @@ -19,14 +19,14 @@ Either use the CPCBasic browser-based Locomotive Basic emulator (https://benchma In CPCBasic, enter your program, e.g. -10 print "Hello World!" +10 print "Hello World!" into the "CPC Basic" text box at the top and then press the Run button below it. Output goes to the blue CPC screen below. You can also interact with the CPC screen directly if you first click on it with the mouse. The Reset button stops a running program and returns you to the Ready prompt. In a native emulator, just type -10 print "Hello World!" -run +10 print "Hello World!" +run to run your first Locomotive BASIC program. @@ -56,7 +56,7 @@ As on many other 8-bit machines of the era, BASIC programs are often extended wi Memory on the CPC 464 and 664 is subdivided into four 16 kB blocks (0 to 3), with block 3 at &c000 normally reserved for the screen. The CPC 6128 features a second 64 kB bank (blocks 4 to 7) which can be accessed from BASIC with [[wp:Bank switching|bank switching]] in block 1 (&4000 and &7fff), e.g. -out &7fff,&x11000100 +out &7fff,&x11000100 would make block 4 accessible in the address space of block 1.http://k1.dyndns.org/Vintage/Schneider%20CPC/Das%20Schneider%20CPC%20Systembuch/z87.htm This way, the entire 128 kB of memory can be used by BASIC. Alternatively, RSX commands for bank switching and copying between banks are included on the system discs and discussed in chapter 8 of the CPC user manual.http://www.cpcwiki.eu/index.php/User_Manual Even on the 64 kB models, it is possible to do [[wp:Multiple buffering|double buffering]] in BASIC by reserving another RAM block for the screen, drawing into the hidden screen, and then setting the CRTC screen address to the currently hidden screen with the BASIC [[wp:I/o port|port I/O]] command OUT. diff --git a/Lang/Locomotive-Basic/Abelian-sandpile-model b/Lang/Locomotive-Basic/Abelian-sandpile-model new file mode 120000 index 0000000000..e00a530896 --- /dev/null +++ b/Lang/Locomotive-Basic/Abelian-sandpile-model @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model/Locomotive-Basic \ No newline at end of file diff --git a/Lang/Locomotive-Basic/Animate-a-pendulum b/Lang/Locomotive-Basic/Animate-a-pendulum new file mode 120000 index 0000000000..32a0ee5149 --- /dev/null +++ b/Lang/Locomotive-Basic/Animate-a-pendulum @@ -0,0 +1 @@ +../../Task/Animate-a-pendulum/Locomotive-Basic \ No newline at end of file diff --git a/Lang/Locomotive-Basic/Dragon-curve b/Lang/Locomotive-Basic/Dragon-curve new file mode 120000 index 0000000000..2088f12a68 --- /dev/null +++ b/Lang/Locomotive-Basic/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/Locomotive-Basic \ No newline at end of file diff --git a/Lang/Locomotive-Basic/Draw-a-cuboid b/Lang/Locomotive-Basic/Draw-a-cuboid new file mode 120000 index 0000000000..cbfb396b7f --- /dev/null +++ b/Lang/Locomotive-Basic/Draw-a-cuboid @@ -0,0 +1 @@ +../../Task/Draw-a-cuboid/Locomotive-Basic \ No newline at end of file diff --git a/Lang/Locomotive-Basic/Forest-fire b/Lang/Locomotive-Basic/Forest-fire new file mode 120000 index 0000000000..44a3c54d6a --- /dev/null +++ b/Lang/Locomotive-Basic/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Locomotive-Basic \ No newline at end of file diff --git a/Lang/Locomotive-Basic/Hilbert-curve b/Lang/Locomotive-Basic/Hilbert-curve new file mode 120000 index 0000000000..8355f1c6bf --- /dev/null +++ b/Lang/Locomotive-Basic/Hilbert-curve @@ -0,0 +1 @@ +../../Task/Hilbert-curve/Locomotive-Basic \ No newline at end of file diff --git a/Lang/Locomotive-Basic/Koch-curve b/Lang/Locomotive-Basic/Koch-curve new file mode 120000 index 0000000000..87294988f6 --- /dev/null +++ b/Lang/Locomotive-Basic/Koch-curve @@ -0,0 +1 @@ +../../Task/Koch-curve/Locomotive-Basic \ No newline at end of file diff --git a/Lang/Loglan82/AKS-test-for-primes b/Lang/Loglan82/AKS-test-for-primes new file mode 120000 index 0000000000..335d9d190f --- /dev/null +++ b/Lang/Loglan82/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Abundant-deficient-and-perfect-number-classifications b/Lang/Loglan82/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..c3fb63599e --- /dev/null +++ b/Lang/Loglan82/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Abundant-odd-numbers b/Lang/Loglan82/Abundant-odd-numbers new file mode 120000 index 0000000000..282ee6e007 --- /dev/null +++ b/Lang/Loglan82/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Bell-numbers b/Lang/Loglan82/Bell-numbers new file mode 120000 index 0000000000..7761831a2e --- /dev/null +++ b/Lang/Loglan82/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/CUSIP b/Lang/Loglan82/CUSIP new file mode 120000 index 0000000000..8aaccb215d --- /dev/null +++ b/Lang/Loglan82/CUSIP @@ -0,0 +1 @@ +../../Task/CUSIP/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Catalan-numbers b/Lang/Loglan82/Catalan-numbers new file mode 120000 index 0000000000..309128cccf --- /dev/null +++ b/Lang/Loglan82/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Cumulative-standard-deviation b/Lang/Loglan82/Cumulative-standard-deviation new file mode 120000 index 0000000000..e030ba56eb --- /dev/null +++ b/Lang/Loglan82/Cumulative-standard-deviation @@ -0,0 +1 @@ +../../Task/Cumulative-standard-deviation/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Day-of-the-week b/Lang/Loglan82/Day-of-the-week new file mode 120000 index 0000000000..65e7a590f5 --- /dev/null +++ b/Lang/Loglan82/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Diversity-prediction-theorem b/Lang/Loglan82/Diversity-prediction-theorem new file mode 120000 index 0000000000..99f7aed5fc --- /dev/null +++ b/Lang/Loglan82/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Dot-product b/Lang/Loglan82/Dot-product new file mode 120000 index 0000000000..e65fed671f --- /dev/null +++ b/Lang/Loglan82/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Dutch-national-flag-problem b/Lang/Loglan82/Dutch-national-flag-problem new file mode 120000 index 0000000000..80274c2f7b --- /dev/null +++ b/Lang/Loglan82/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Equilibrium-index b/Lang/Loglan82/Equilibrium-index new file mode 120000 index 0000000000..99b2d35b94 --- /dev/null +++ b/Lang/Loglan82/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Ethiopian-multiplication b/Lang/Loglan82/Ethiopian-multiplication new file mode 120000 index 0000000000..13a8b5d45c --- /dev/null +++ b/Lang/Loglan82/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Factors-of-an-integer b/Lang/Loglan82/Factors-of-an-integer new file mode 120000 index 0000000000..106a23d5a7 --- /dev/null +++ b/Lang/Loglan82/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Gamma-function b/Lang/Loglan82/Gamma-function new file mode 120000 index 0000000000..e6dce092fb --- /dev/null +++ b/Lang/Loglan82/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Hello-world-Text b/Lang/Loglan82/Hello-world-Text new file mode 120000 index 0000000000..02b527238f --- /dev/null +++ b/Lang/Loglan82/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Horners-rule-for-polynomial-evaluation b/Lang/Loglan82/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..5eca5139bd --- /dev/null +++ b/Lang/Loglan82/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Josephus-problem b/Lang/Loglan82/Josephus-problem new file mode 120000 index 0000000000..74e740313f --- /dev/null +++ b/Lang/Loglan82/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Levenshtein-distance b/Lang/Loglan82/Levenshtein-distance new file mode 120000 index 0000000000..64975523f2 --- /dev/null +++ b/Lang/Loglan82/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Long-year b/Lang/Loglan82/Long-year new file mode 120000 index 0000000000..b249596823 --- /dev/null +++ b/Lang/Loglan82/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Loops-Do-while b/Lang/Loglan82/Loops-Do-while new file mode 120000 index 0000000000..e038a12c06 --- /dev/null +++ b/Lang/Loglan82/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Loops-For-with-a-specified-step b/Lang/Loglan82/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..bace3aec2b --- /dev/null +++ b/Lang/Loglan82/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/M-bius-function b/Lang/Loglan82/M-bius-function new file mode 120000 index 0000000000..82e1041f7d --- /dev/null +++ b/Lang/Loglan82/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Monty-Hall-problem b/Lang/Loglan82/Monty-Hall-problem new file mode 120000 index 0000000000..3c5ec1bb89 --- /dev/null +++ b/Lang/Loglan82/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Shoelace-formula-for-polygonal-area b/Lang/Loglan82/Shoelace-formula-for-polygonal-area new file mode 120000 index 0000000000..7a3facc57c --- /dev/null +++ b/Lang/Loglan82/Shoelace-formula-for-polygonal-area @@ -0,0 +1 @@ +../../Task/Shoelace-formula-for-polygonal-area/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Statistics-Basic b/Lang/Loglan82/Statistics-Basic new file mode 120000 index 0000000000..06f2b88d7e --- /dev/null +++ b/Lang/Loglan82/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Statistics-Normal-distribution b/Lang/Loglan82/Statistics-Normal-distribution new file mode 120000 index 0000000000..c0cf6b079d --- /dev/null +++ b/Lang/Loglan82/Statistics-Normal-distribution @@ -0,0 +1 @@ +../../Task/Statistics-Normal-distribution/Loglan82 \ No newline at end of file diff --git a/Lang/Loglan82/Tau-number b/Lang/Loglan82/Tau-number new file mode 120000 index 0000000000..0f86291ac1 --- /dev/null +++ b/Lang/Loglan82/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Loglan82 \ No newline at end of file diff --git a/Lang/Logo/00-LANG.txt b/Lang/Logo/00-LANG.txt index 6deea15712..6f97fd46ee 100644 --- a/Lang/Logo/00-LANG.txt +++ b/Lang/Logo/00-LANG.txt @@ -8,6 +8,6 @@ |LCT=yes}}'''Logo''' is a language invented by Seymour Papert in the 1960's designed expressly for teaching programming to children. It is well known for its built-in [[wp:turtle graphics|turtle graphics]]. Unlike other languages which attempt to fill the educational niche, like [[BASIC]], Logo has [[Lisp]]-like underpinnings, and can be used to teach structured, recursive, and functional programming. ==See Also== -*[http://logo.twentygototen.org/ papert - a Logo interpreter written in JavaScript] +*[http://rmmh.github.io/papert/static/ papert - a Logo interpreter written in JavaScript] *[http://www.calormen.com/Logo/ Another Logo interpreter written in JavaScript by Joshua Bell] *[http://lhogho.sourceforge.net/ Lhogho - a Logo compiler written in C by Pavel Boytchev] \ No newline at end of file diff --git a/Lang/Logo/Associative-array-Creation b/Lang/Logo/Associative-array-Creation deleted file mode 120000 index 3776b1b4e9..0000000000 --- a/Lang/Logo/Associative-array-Creation +++ /dev/null @@ -1 +0,0 @@ -../../Task/Associative-array-Creation/Logo \ No newline at end of file diff --git a/Lang/Logo/CSV-data-manipulation b/Lang/Logo/CSV-data-manipulation new file mode 120000 index 0000000000..a7cf9e2a5c --- /dev/null +++ b/Lang/Logo/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/Logo \ No newline at end of file diff --git a/Lang/Logo/Merge-and-aggregate-datasets b/Lang/Logo/Merge-and-aggregate-datasets new file mode 120000 index 0000000000..f9a42bcf33 --- /dev/null +++ b/Lang/Logo/Merge-and-aggregate-datasets @@ -0,0 +1 @@ +../../Task/Merge-and-aggregate-datasets/Logo \ No newline at end of file diff --git a/Lang/Logo/Sort-three-variables b/Lang/Logo/Sort-three-variables new file mode 120000 index 0000000000..98d62a0bb1 --- /dev/null +++ b/Lang/Logo/Sort-three-variables @@ -0,0 +1 @@ +../../Task/Sort-three-variables/Logo \ No newline at end of file diff --git a/Lang/Logo/Sparkline-in-unicode b/Lang/Logo/Sparkline-in-unicode new file mode 120000 index 0000000000..d2b466f59a --- /dev/null +++ b/Lang/Logo/Sparkline-in-unicode @@ -0,0 +1 @@ +../../Task/Sparkline-in-unicode/Logo \ No newline at end of file diff --git a/Lang/Lua/100-doors b/Lang/Lua/100-doors deleted file mode 120000 index ce373fa8af..0000000000 --- a/Lang/Lua/100-doors +++ /dev/null @@ -1 +0,0 @@ -../../Task/100-doors/Lua \ No newline at end of file diff --git a/Lang/Lua/Bioinformatics-base-count b/Lang/Lua/Bioinformatics-base-count deleted file mode 120000 index cb9548dcc8..0000000000 --- a/Lang/Lua/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Lua \ No newline at end of file diff --git a/Lang/Lua/Calkin-Wilf-sequence b/Lang/Lua/Calkin-Wilf-sequence new file mode 120000 index 0000000000..1f9b22fde7 --- /dev/null +++ b/Lang/Lua/Calkin-Wilf-sequence @@ -0,0 +1 @@ +../../Task/Calkin-Wilf-sequence/Lua \ No newline at end of file diff --git a/Lang/Lua/Check-input-device-is-a-terminal b/Lang/Lua/Check-input-device-is-a-terminal new file mode 120000 index 0000000000..fdc01bb562 --- /dev/null +++ b/Lang/Lua/Check-input-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-input-device-is-a-terminal/Lua \ No newline at end of file diff --git a/Lang/Lua/Combinations-and-permutations b/Lang/Lua/Combinations-and-permutations new file mode 120000 index 0000000000..c0a533db08 --- /dev/null +++ b/Lang/Lua/Combinations-and-permutations @@ -0,0 +1 @@ +../../Task/Combinations-and-permutations/Lua \ No newline at end of file diff --git a/Lang/Lua/Demings-funnel b/Lang/Lua/Demings-funnel new file mode 120000 index 0000000000..bfeba4e463 --- /dev/null +++ b/Lang/Lua/Demings-funnel @@ -0,0 +1 @@ +../../Task/Demings-funnel/Lua \ No newline at end of file diff --git a/Lang/Lua/Duffinian-numbers b/Lang/Lua/Duffinian-numbers new file mode 120000 index 0000000000..3d384f7bda --- /dev/null +++ b/Lang/Lua/Duffinian-numbers @@ -0,0 +1 @@ +../../Task/Duffinian-numbers/Lua \ No newline at end of file diff --git a/Lang/Lua/Empty-program b/Lang/Lua/Empty-program deleted file mode 120000 index 451d4b192d..0000000000 --- a/Lang/Lua/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Lua \ No newline at end of file diff --git a/Lang/Lua/Equal-prime-and-composite-sums b/Lang/Lua/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..063c8635e5 --- /dev/null +++ b/Lang/Lua/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/Lua \ No newline at end of file diff --git a/Lang/Lua/GUI-component-interaction b/Lang/Lua/GUI-component-interaction new file mode 120000 index 0000000000..da7428ad7e --- /dev/null +++ b/Lang/Lua/GUI-component-interaction @@ -0,0 +1 @@ +../../Task/GUI-component-interaction/Lua \ No newline at end of file diff --git a/Lang/Lua/Gauss-Jordan-matrix-inversion b/Lang/Lua/Gauss-Jordan-matrix-inversion new file mode 120000 index 0000000000..4e412c8561 --- /dev/null +++ b/Lang/Lua/Gauss-Jordan-matrix-inversion @@ -0,0 +1 @@ +../../Task/Gauss-Jordan-matrix-inversion/Lua \ No newline at end of file diff --git a/Lang/Lua/Generate-random-chess-position b/Lang/Lua/Generate-random-chess-position new file mode 120000 index 0000000000..7d17633430 --- /dev/null +++ b/Lang/Lua/Generate-random-chess-position @@ -0,0 +1 @@ +../../Task/Generate-random-chess-position/Lua \ No newline at end of file diff --git a/Lang/Lua/Giuga-numbers b/Lang/Lua/Giuga-numbers new file mode 120000 index 0000000000..a65d758127 --- /dev/null +++ b/Lang/Lua/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/Lua \ No newline at end of file diff --git a/Lang/Lua/Handle-a-signal b/Lang/Lua/Handle-a-signal new file mode 120000 index 0000000000..f16f994877 --- /dev/null +++ b/Lang/Lua/Handle-a-signal @@ -0,0 +1 @@ +../../Task/Handle-a-signal/Lua \ No newline at end of file diff --git a/Lang/Lua/Hello-world-Line-printer b/Lang/Lua/Hello-world-Line-printer new file mode 120000 index 0000000000..1ade14f20f --- /dev/null +++ b/Lang/Lua/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/Lua \ No newline at end of file diff --git a/Lang/Lua/Jacobi-symbol b/Lang/Lua/Jacobi-symbol new file mode 120000 index 0000000000..bdc4c4fe10 --- /dev/null +++ b/Lang/Lua/Jacobi-symbol @@ -0,0 +1 @@ +../../Task/Jacobi-symbol/Lua \ No newline at end of file diff --git a/Lang/Lua/Jacobsthal-numbers b/Lang/Lua/Jacobsthal-numbers new file mode 120000 index 0000000000..ff787752c3 --- /dev/null +++ b/Lang/Lua/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/Lua \ No newline at end of file diff --git a/Lang/Lua/Jordan-P-lya-numbers b/Lang/Lua/Jordan-P-lya-numbers new file mode 120000 index 0000000000..860eeeaaa4 --- /dev/null +++ b/Lang/Lua/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Lua \ No newline at end of file diff --git a/Lang/Lua/Juggler-sequence b/Lang/Lua/Juggler-sequence new file mode 120000 index 0000000000..94ab059422 --- /dev/null +++ b/Lang/Lua/Juggler-sequence @@ -0,0 +1 @@ +../../Task/Juggler-sequence/Lua \ No newline at end of file diff --git a/Lang/Lua/Knapsack-problem-Bounded b/Lang/Lua/Knapsack-problem-Bounded new file mode 120000 index 0000000000..edddb60b00 --- /dev/null +++ b/Lang/Lua/Knapsack-problem-Bounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Bounded/Lua \ No newline at end of file diff --git a/Lang/Lua/Largest-proper-divisor-of-n b/Lang/Lua/Largest-proper-divisor-of-n new file mode 120000 index 0000000000..7f2df1345a --- /dev/null +++ b/Lang/Lua/Largest-proper-divisor-of-n @@ -0,0 +1 @@ +../../Task/Largest-proper-divisor-of-n/Lua \ No newline at end of file diff --git a/Lang/Lua/Legendre-prime-counting-function b/Lang/Lua/Legendre-prime-counting-function new file mode 120000 index 0000000000..cf72af7d74 --- /dev/null +++ b/Lang/Lua/Legendre-prime-counting-function @@ -0,0 +1 @@ +../../Task/Legendre-prime-counting-function/Lua \ No newline at end of file diff --git a/Lang/Lua/Miller-Rabin-primality-test b/Lang/Lua/Miller-Rabin-primality-test deleted file mode 120000 index 45a2ff22f4..0000000000 --- a/Lang/Lua/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Lua \ No newline at end of file diff --git a/Lang/Lua/Numbers-which-are-not-the-sum-of-distinct-squares b/Lang/Lua/Numbers-which-are-not-the-sum-of-distinct-squares new file mode 120000 index 0000000000..1fd326f10e --- /dev/null +++ b/Lang/Lua/Numbers-which-are-not-the-sum-of-distinct-squares @@ -0,0 +1 @@ +../../Task/Numbers-which-are-not-the-sum-of-distinct-squares/Lua \ No newline at end of file diff --git a/Lang/Lua/Numbers-with-equal-rises-and-falls b/Lang/Lua/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..5900c5ba75 --- /dev/null +++ b/Lang/Lua/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/Lua \ No newline at end of file diff --git a/Lang/Lua/Padovan-sequence b/Lang/Lua/Padovan-sequence new file mode 120000 index 0000000000..242b563fd5 --- /dev/null +++ b/Lang/Lua/Padovan-sequence @@ -0,0 +1 @@ +../../Task/Padovan-sequence/Lua \ No newline at end of file diff --git a/Lang/Lua/Palindrome-dates b/Lang/Lua/Palindrome-dates new file mode 120000 index 0000000000..c839a0552f --- /dev/null +++ b/Lang/Lua/Palindrome-dates @@ -0,0 +1 @@ +../../Task/Palindrome-dates/Lua \ No newline at end of file diff --git a/Lang/Lua/Parse-an-IP-Address b/Lang/Lua/Parse-an-IP-Address new file mode 120000 index 0000000000..aa0f24a93c --- /dev/null +++ b/Lang/Lua/Parse-an-IP-Address @@ -0,0 +1 @@ +../../Task/Parse-an-IP-Address/Lua \ No newline at end of file diff --git a/Lang/Lua/Parsing-RPN-calculator-algorithm b/Lang/Lua/Parsing-RPN-calculator-algorithm deleted file mode 120000 index 397c1ccfd1..0000000000 --- a/Lang/Lua/Parsing-RPN-calculator-algorithm +++ /dev/null @@ -1 +0,0 @@ -../../Task/Parsing-RPN-calculator-algorithm/Lua \ No newline at end of file diff --git a/Lang/Lua/Pisano-period b/Lang/Lua/Pisano-period new file mode 120000 index 0000000000..4b34e1a22a --- /dev/null +++ b/Lang/Lua/Pisano-period @@ -0,0 +1 @@ +../../Task/Pisano-period/Lua \ No newline at end of file diff --git a/Lang/Lua/Problem-of-Apollonius b/Lang/Lua/Problem-of-Apollonius new file mode 120000 index 0000000000..a10ef11fad --- /dev/null +++ b/Lang/Lua/Problem-of-Apollonius @@ -0,0 +1 @@ +../../Task/Problem-of-Apollonius/Lua \ No newline at end of file diff --git a/Lang/Lua/Quaternion-type b/Lang/Lua/Quaternion-type deleted file mode 120000 index 09499b7f9c..0000000000 --- a/Lang/Lua/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Lua \ No newline at end of file diff --git a/Lang/Lua/Radical-of-an-integer b/Lang/Lua/Radical-of-an-integer new file mode 120000 index 0000000000..dd64e956a2 --- /dev/null +++ b/Lang/Lua/Radical-of-an-integer @@ -0,0 +1 @@ +../../Task/Radical-of-an-integer/Lua \ No newline at end of file diff --git a/Lang/Lua/Ramer-Douglas-Peucker-line-simplification b/Lang/Lua/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..516d951928 --- /dev/null +++ b/Lang/Lua/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/Lua \ No newline at end of file diff --git a/Lang/Lua/Sleeping-Beauty-problem b/Lang/Lua/Sleeping-Beauty-problem new file mode 120000 index 0000000000..75e2ee6eb2 --- /dev/null +++ b/Lang/Lua/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/Lua \ No newline at end of file diff --git a/Lang/Lua/Sorting-Algorithms-Circle-Sort b/Lang/Lua/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index e6dc299d24..0000000000 --- a/Lang/Lua/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Lua \ No newline at end of file diff --git a/Lang/Lua/Stirling-numbers-of-the-first-kind b/Lang/Lua/Stirling-numbers-of-the-first-kind new file mode 120000 index 0000000000..e0e8e14af9 --- /dev/null +++ b/Lang/Lua/Stirling-numbers-of-the-first-kind @@ -0,0 +1 @@ +../../Task/Stirling-numbers-of-the-first-kind/Lua \ No newline at end of file diff --git a/Lang/Lua/Stirling-numbers-of-the-second-kind b/Lang/Lua/Stirling-numbers-of-the-second-kind new file mode 120000 index 0000000000..c491b98381 --- /dev/null +++ b/Lang/Lua/Stirling-numbers-of-the-second-kind @@ -0,0 +1 @@ +../../Task/Stirling-numbers-of-the-second-kind/Lua \ No newline at end of file diff --git a/Lang/Lua/Strassens-algorithm b/Lang/Lua/Strassens-algorithm new file mode 120000 index 0000000000..9da800cb02 --- /dev/null +++ b/Lang/Lua/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Lua \ No newline at end of file diff --git a/Lang/Lua/Sum-of-elements-below-main-diagonal-of-matrix b/Lang/Lua/Sum-of-elements-below-main-diagonal-of-matrix new file mode 120000 index 0000000000..63a3cd2cf9 --- /dev/null +++ b/Lang/Lua/Sum-of-elements-below-main-diagonal-of-matrix @@ -0,0 +1 @@ +../../Task/Sum-of-elements-below-main-diagonal-of-matrix/Lua \ No newline at end of file diff --git a/Lang/Lua/Summarize-primes b/Lang/Lua/Summarize-primes new file mode 120000 index 0000000000..601bc61d3c --- /dev/null +++ b/Lang/Lua/Summarize-primes @@ -0,0 +1 @@ +../../Task/Summarize-primes/Lua \ No newline at end of file diff --git a/Lang/Lua/Super-d-numbers b/Lang/Lua/Super-d-numbers new file mode 120000 index 0000000000..64e775e306 --- /dev/null +++ b/Lang/Lua/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/Lua \ No newline at end of file diff --git a/Lang/Lua/Terminal-control-Hiding-the-cursor b/Lang/Lua/Terminal-control-Hiding-the-cursor new file mode 120000 index 0000000000..68700a27b1 --- /dev/null +++ b/Lang/Lua/Terminal-control-Hiding-the-cursor @@ -0,0 +1 @@ +../../Task/Terminal-control-Hiding-the-cursor/Lua \ No newline at end of file diff --git a/Lang/Lua/Terminal-control-Unicode-output b/Lang/Lua/Terminal-control-Unicode-output new file mode 120000 index 0000000000..b9be1e6352 --- /dev/null +++ b/Lang/Lua/Terminal-control-Unicode-output @@ -0,0 +1 @@ +../../Task/Terminal-control-Unicode-output/Lua \ No newline at end of file diff --git a/Lang/Lua/Total-circles-area b/Lang/Lua/Total-circles-area new file mode 120000 index 0000000000..368862d6f6 --- /dev/null +++ b/Lang/Lua/Total-circles-area @@ -0,0 +1 @@ +../../Task/Total-circles-area/Lua \ No newline at end of file diff --git a/Lang/Lua/Update-a-configuration-file b/Lang/Lua/Update-a-configuration-file new file mode 120000 index 0000000000..75ad1d2a09 --- /dev/null +++ b/Lang/Lua/Update-a-configuration-file @@ -0,0 +1 @@ +../../Task/Update-a-configuration-file/Lua \ No newline at end of file diff --git a/Lang/Lua/Use-another-language-to-call-a-function b/Lang/Lua/Use-another-language-to-call-a-function new file mode 120000 index 0000000000..05e8f054e4 --- /dev/null +++ b/Lang/Lua/Use-another-language-to-call-a-function @@ -0,0 +1 @@ +../../Task/Use-another-language-to-call-a-function/Lua \ No newline at end of file diff --git a/Lang/Lua/Wagstaff-primes b/Lang/Lua/Wagstaff-primes new file mode 120000 index 0000000000..c8cec659a4 --- /dev/null +++ b/Lang/Lua/Wagstaff-primes @@ -0,0 +1 @@ +../../Task/Wagstaff-primes/Lua \ No newline at end of file diff --git a/Lang/Lua/Wieferich-primes b/Lang/Lua/Wieferich-primes new file mode 120000 index 0000000000..ac68d34377 --- /dev/null +++ b/Lang/Lua/Wieferich-primes @@ -0,0 +1 @@ +../../Task/Wieferich-primes/Lua \ No newline at end of file diff --git a/Lang/Lua/Wilson-primes-of-order-n b/Lang/Lua/Wilson-primes-of-order-n new file mode 120000 index 0000000000..338cbe60ca --- /dev/null +++ b/Lang/Lua/Wilson-primes-of-order-n @@ -0,0 +1 @@ +../../Task/Wilson-primes-of-order-n/Lua \ No newline at end of file diff --git a/Lang/M2000-Interpreter/00-LANG.txt b/Lang/M2000-Interpreter/00-LANG.txt index ed77df4b81..ab29824f45 100644 --- a/Lang/M2000-Interpreter/00-LANG.txt +++ b/Lang/M2000-Interpreter/00-LANG.txt @@ -9,7 +9,7 @@ |gc=allowed |hopl=no }} -M2000 is an interpreter running on its own Environment written in Visual Basic 6, as an open source project and can be found in GitHub[https://github.com/M2000Interpreter/Version9]. Current version is 12, revision 13. See [[M2000 Interpreter Implementation]] +M2000 is an interpreter running on its own Environment written in Visual Basic 6, as an open source project and can be found in GitHub[https://github.com/M2000Interpreter/Environment]. Current version is 14, revision 8. See [[M2000 Interpreter Implementation]] {{language programming paradigm|Imperative}} {{language programming paradigm|Object-oriented}} {{Language programming paradigm|Event-driven}} @@ -21,12 +21,68 @@ M2000 has two set of vocabularies, one with English identifiers and one with Gre M2000 start as an experimental interpreted language, using a Module in Module idea (like a Procedure in Procedure) where each inner Module is closed for modification, but open for expansion, by replacing code at run time. Source code executed as is, without second interpretation of a simple form, although block of code arranged for execution in a manner of consuming code (code which executed deleted, code in a loop kept as a copy for next iteration). +We can use BASIC type statement's. Although there are some differences. Like the FOR NEXT: + +SET SWITCHES "+FOR" +// WHY ? BECAUSE WHEN STEP IS POSITIVE (+1 HERE) +// WE GET ITERATION IF START VALUE IS LESS OR EQUAL THE LAST VALUE +FOR I=10 TO 0 + PRINT "NEVER PRINT - IS LIKE BASIC" +NEXT +SET SWITCHES "+DIM" +// WHY ? BECAUSE DIM MAKE AN ARRAY FROM 0 TO TOP VALUE (10) +DIM A(10)=1 +PRINT LEN(A())=11, A(0), A(10), "BASIC" + +SET SWITCHES "-FOR" ' THE DEFAULT +// WHY ? BECAUSE EVERY TIME ITERATE FROM START VALUE TO END VALUE +FOR I=10 TO 0 + PRINT "ALWAYS PRINT - IS NOT LIKE BASIC" +NEXT + +SET SWITCHES "-DIM" +// WHY ? BECAUSE DIM MAKE AN ARRAY N (10) ITEMS +DIM A(10)=1 +PRINT LEN(A())=10, A(0), A(9), "M2000" +DIM B(0 TO 10)=1 ' WE CAN DEFINE MIN AND MAX INDEX (CAN BE NEGATIVE) +PRINT LEN(B())=11, B(0), B(10), "M2000" + + Module's may be Global, or local to other modules. We can define global modules in a module, and all these definitions deleted at the end of module execution. Because we have to execute the definition of a module, we can select definition, or load definition before we call the module. Also modules can be part of object's of type Group. A module can't call itself unless we use Call module_name. The standard call is by using only the name of module. So from a module we can call local modules or global, but we can't call parent module (if isn't global). In a group we can call anything like a module plus the modules of the groups. +We can use labels and line numbers (each number is just a label). After a line number we can place statement. Static subs/functions have same scope as the module scope. Here SomethingElse() is like Module as a program, with own scope. + + +MODULE alfa { + FUNCTION SomethingElse(A, ZZ) { + =A/ZZ ' WE CAN'T READ Z HERE + } + 000 READ X + 001 Z=10 + 005 GOSUB alfa + 010 COMPUTE(&X) + 020 PRINT @MUL10(X), SomethingElse(@MUL10(X), Z) + 030 IF X<20 THEN 10 + 040 GOSUB alfa + 050 END + 060 SUB COMPUTE(&A) + 070 A++ + 080 Z++ // SIDE EFFECT + 090 END SUB + 100 FUNCTION MUL10(A) + 110 =A*Z + 120 END FUNCTION +alfa: + 130 PRINT "-------------------------" + 140 RETURN +} +alfa 14 + + We can change a inner module at the calling of a module, see the example: We call inner Beta in two stages. At the second stage we change inner Theta with Theta2. This is the decoration of Beta with Theta as Theta2. This is a temporary decoration because Beta after execution erase any new identifier including Theta. So each time we call Beta, statement Module Theta make this module unless a decoration stop it. ====English Vocabulary==== -Module Beta { +Module Beta { Module Theta (x){ Print "This is Theta, we get x=";x } @@ -38,8 +94,141 @@ Module Theta2 (x) { } Beta ; Theta as Theta2 + +This is a rare case. Most cases use alternative definitions: + +Module Beta { + Module Theta (x){ + Print "This is Theta, we get x=";x + } + For i=1 to 3 : Theta i : Next i +} +Beta +Module Beta { + Module Theta (x) { + Print "This is Theta2, we get x=";x + } + For i=1 to 3 : Theta i : Next i +} +Beta + + +Another variation is the use of function pass by reference: + +Module Beta { + Read &theta() + For i=1 to 3 :Call Theta(i) : Next i +} +Function Theta(x){ + Print "This is Theta, we get x=";x +} +Function Theta2(x) { + Print "This is Theta2, we get x=";x +} +Beta &Theta() +Beta &Theta2() + + +Or a more compact way to use a Group: + +Module Beta { + Read That + For i=1 to 3 :Call That.Theta(i) : Next i +} +Group A { + Function Theta(x){ + Print "This is Theta, we get x=";x + } +} +Group B { + Function Theta(x) { + Print "This is Theta2, we get x=";x + } +} +Beta A +Beta B + + +Or a more compact way to use a Class: + +Module Beta { + Read That + For i=1 to 3 :Call That.Theta(i) : Next i +} +Class Something { +Private: + string message=letter$ ' letter$ read from stack of values a string +Public: + Function Theta(x){ + Print .message;x + } +} +A=Something("This is Theta, we get x=") +B=Something("This is Theta2, we get x=") +Beta A +Beta B + + + +Or a variant of class which made an object which return value + +Module Beta { + Read &That + For i=1 to 3 :Print That(i) : Next i +} +Class Something { +Private: + string message=letter$ ' letter$ read from stack of values a string +Public: + Set { + Read This + } + Value (x){ ' (x) change to: Read x + = .message + x ' .message is string (x can be string or number) + } +} +A=Something("This is Theta, we get x=") +Beta &A +A=Something("This is Theta2, we get x=") +Beta &A + + +Or by using lambda functions (functions which we hold in variables, with closures) + + +Module Beta { + Read &That + For i=1 to 3 :Print That(i) : Next i +} +m="This is Theta, we get x=" +A=lambda m (x)->m + x ' one line lambda function +Beta &A +' we can use multiline lambda functions +A=lambda m="This is Theta2, we get x=" (x)->{ + =m + x +} +Beta &A + + +The same but now we bass by value (we remove & from the caller and the callee too: + + +Module Beta { + Read That + For i=1 to 3 :Print That(i) : Next i +} +m="This is Theta, we get x=" +A=lambda m (x)->m + x ' one line lambda function +Beta A +' we can use multiline lambda functions +A=lambda m="This is Theta2, we get x=" (x)->{ + =m + x +} +Beta A + + ====Greek Vocabulary==== -Τμήμα Βήτα { +Τμήμα Βήτα { Τμήμα Θήτα (χ){ Τύπωσε "Αυτό είναι το Θήτα, θα πάρουμε το χ=";χ } @@ -52,9 +241,9 @@ Beta ; Theta as Theta2 Βήτα ; Θήτα ως Θήτα2 -As we can see from code, some statements are like BASIC, except the use of curly brackets {}. Check the code below. We have a Module (as a Procedure), where we define some functions and some variables, as entities. These entities defined in every call to CheckIt, and erased when execution return from CheckIt. By default every parameter in M2000 pass by value. We define two functions, Alfa() where we set type for parameter x and ExpType$() where we not set type for x, and we wish to return the name of type when we make a call. +As we can see from code, some statements are like BASIC, except the use of curly brackets {}. Check the code below. We have a Module (as a Procedure), where we define some functions and some variables, as entities. These entities defined in every call to CheckIt, and erased when execution return from CheckIt. By default every parameter in M2000 pass by value. We define a function, Alfa() where we set type for parameter. -Module CheckIt { +Module CheckIt { \\ We can't call something out of this module Function Alfa(X as double) { =X**2 @@ -70,14 +259,13 @@ As we can see from code, some statements are like BASIC, except the use of curly Print Type$(Z) Currency Z1=212.12, Z2=323233.12, Z3=223212323323.12 Print Z1, Z2, Z3 - Def ExpType$(x)=Type$(x) - Print ExpType$(Z1+Z2) ' Currency - Print ExpType$(Z1*Z2) ' Currency - Print ExpType$(Z2*Z3) ' Double (Currency can't hold this number) + Print Type$(Z1+Z2) ' Currency + Print Type$(Z1*Z2) ' Currency + Print Type$(Z2*Z3) ' Double (Currency can't hold this number) \\ Integer, Long, Single, Currency, Decimal - Print ExpType$(10%), ExpType$(10&), ExpType$(10~), ExpType$(10#), ExpType$(10@) + Print Type$(10%), Type$(10&), Type$(10~), Type$(10#), Type$(10@) \\ Without symbol is a Double - Print ExpType$(10) + Print Type$(10) } \\ We call it CheckIt @@ -92,7 +280,7 @@ A statement Input Alfa$ can input characters for a string or for object typed gr Types are strong for values with a name (variables, constants), but weak for items in containers. In a container (Array, Inventory and Stack) we can place anything including other containers. We can bypass the "strong" capability but this isn't a practice for good programming. Internal or variables are of type of Variant, so we can make a reference of A to A$ and we can save a string "1212" and read from A the number 1212. - + Module AKindOfMess { a=10@ Print Type$(a)="Decimal" @@ -131,7 +319,7 @@ Print Error$="" So check this for proper use of types. -Module CheckInt { +Module CheckInt { A%=1212212.12@ Print A% ' 1212212 A%=1212212.52@ @@ -149,18 +337,19 @@ So check this for proper use of types. } CheckInt -So we say about Integer Variables, and no Integer Numeric Type. Like in Basic, M2000 is not case sensitive (except for labels), so A% and a% is the same. We may have A, A$ and A% as three variables, or A(), A%(), A$() as arrays or and functions. We can use name(@ ) to call function and not array if we have each with same name. +So we say about Integer Variables, and no Integer Numeric Type. Like in Basic, M2000 is not case sensitive (except for labels), so A% and a% is the same. We may have A, A$ and A% as three variables, or A(), A%(), A$() as arrays or and functions. We can use name(* ) to call function and not array if we have each with same name. -Dim A(10)=1 +Dim A(10)=1 Def A(x)=x**2 -Print A(3), A(@ 4) +Print A(3), A(* 4) ' change @ to * from later versions + By default all variables are local. M2000 uses heap to store local variables, not stack. We can use global variables, but a local definition hide a global one. We can make global variables for temporary use (at return from module which we define a global, this global erased). A global definition in an already defined global variable with same name, hide for temporary use the old global variable. It is easy to make modules, with modules, functions, variables, arrays. We can use subroutines when we want code in a module or a function to used more than once. We can use local variables inside subroutines. In subroutines we can use module's variables, functions, subroutines. Until here we see something like BASIC, except that variables are local to modules and functions, but can be used by subroutines. Also we have see that we can replace a module in a module when we call it. With this replacement we can use a predefined logic with some "terminals", modules that get parameters and do final things. We can make global modules and functions in local modules and functions, but these exist until creator module or function exit. -M2000 can be used for more advanced programming. Modules and functions can be members of Groups. Groups are values. So a function can return a Group. +M2000 can be used for more advanced programming. Modules and functions can be members of Groups. Groups are values. So a function can return a Group. ===Stack of Values=== Modules and functions get parameters in a stack. Modules get the parent stack with parameters, and functions get a new stack with parameters. Modules return from call and are responsible to clear as needed the stack. Functions drop the stack after the call from an expression. A module can return entities in stack, if we want to do that. We can call a module and pass parameters, and that module can call other module leaving parameters in stack to be read in last module. @@ -170,7 +359,7 @@ In the example below (y) is a Read y for module definition. Early versions of la As we see alfa has no read statement, because before get the first number need to make two modules, and then pop one number and call a module passing current stack, so if choose beta, then the second value feed y from a read y statement. - + module alfa { module beta (y) { print y**3 @@ -195,15 +384,13 @@ function sumall { print sumall(1,2,3,4,5,6,7)=28 - - ===OOP=== Groups are objects for M2000. We can use them as values, and if we want we can use pointers for groups (but we can make a lot of programs without using pointers to groups). Without using pointer, a Group may be local with a name in a Module or can be in a container like array, inventory (a type of map) and stack objects, without name. Groups may have private and public members, may have properties as read only, may get value and return value, and may have operators. Members of Groups can be anything, including other groups. Groups may have events too. We can make groups by using CLASS statement or by using own function which return a Group or a pointer to Group. A special object is the lambda object, which may have a number of closures, and have to faces, a variable and a function: -Module Delta { +Module Delta { \\ Make a group like a lambda \\ A Class make a Global Function \\ (in a group a Class definition make a group member, not a global function) @@ -244,7 +431,7 @@ We can place a lambda function as closure in a lambda function, and we can build a class define a type too. We can make a class from other classes too. We can make inner classes too. - + Form 80,50 \\ counters supposed we provide them from a file global LastCustomerId=100, ReportId=80 @@ -342,7 +529,7 @@ While M { Until now we see modules/functions/subs for procedural programming, Groups for OOP, Groups as lambda functions and lambda functions for functional programming. We can use events for groups and for COM objects, including GUI objects. -Module Beta { +Module Beta { Group WithEvents Alpha { Event "One" Module DoIt (x) { @@ -380,7 +567,7 @@ Until now we see that programming with events can be used in M2000. There is an Modules may have Threads, part of modules that can be executed in intervals, can be halted, or can be released, and can be erased. Each thread has own stack and may have own static variables (Modules and Functions also may have static variables), but can use modules variables and functions/modules/subs. Threads can run concurrent (thread return to task manager after execution of a statement or a block of statements) or sequential (a thread has to exit from interval to start other thread) -Module Zeta { +Module Zeta { k=10 Thread { k++ @@ -399,7 +586,7 @@ Zeta M2000 Interpreter can work with Structures and Buffers. Buffer is a memory block and Structure can define types of memory, and a buffer can hold arrays of structures. Each structure can be made from other structures or arrays of structures, and may have unions. We can use buffers for code execution (writing machine code), using standard buffers (not executable), for data holder. Also we can use Buffers calling external dll and passing by address. -Module Kappa { +Module Kappa { Function Theta(x) { Structure Points_single { x as single @@ -415,4 +602,26 @@ M2000 Interpreter can work with Structures and Buffers. Buffer is a memory block \\ Print Eval(P, 0!x)=1212.12~, Eval(P, 0!y)=21.1212~ } -Kappa \ No newline at end of file +Kappa +Module Kappa { + Function Theta(x) { + Structure Points_single { + x as single + y as single + } + Buffer Clear Points as Points_single*x + =Points + } + P=Theta(100) + Print Len(P)=800 ' 2x4x100 bytes + ' new way to use fields of structure + P[0]|x=1212.12 + P[0]|y=21.1212 + Print Eval(P, 0!x)=1212.12~, Eval(P, 0!y)=21.1212~ + Print P[0]|x=1212.12~, P[0]|y=21.1212~ + P[4]=P[0] ' copy of structure at offser 4*len of structrure Points_single + ' p(0) is address of first struct, p(4) is address of 5th struct + Print P[4]|x=1212.12~, P[4]|y=21.1212~, p(4)-p(0)=32 +} +Kappa + \ No newline at end of file diff --git a/Lang/M2000-Interpreter/ADFGVX-cipher b/Lang/M2000-Interpreter/ADFGVX-cipher new file mode 120000 index 0000000000..58053e0f2d --- /dev/null +++ b/Lang/M2000-Interpreter/ADFGVX-cipher @@ -0,0 +1 @@ +../../Task/ADFGVX-cipher/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Apply-a-digital-filter-direct-form-II-transposed- b/Lang/M2000-Interpreter/Apply-a-digital-filter-direct-form-II-transposed- new file mode 120000 index 0000000000..0994290aa3 --- /dev/null +++ b/Lang/M2000-Interpreter/Apply-a-digital-filter-direct-form-II-transposed- @@ -0,0 +1 @@ +../../Task/Apply-a-digital-filter-direct-form-II-transposed-/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Arbitrary-precision-integers-included- b/Lang/M2000-Interpreter/Arbitrary-precision-integers-included- new file mode 120000 index 0000000000..4f4595771b --- /dev/null +++ b/Lang/M2000-Interpreter/Arbitrary-precision-integers-included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers-included-/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Arithmetic-Complex b/Lang/M2000-Interpreter/Arithmetic-Complex new file mode 120000 index 0000000000..d7240f321f --- /dev/null +++ b/Lang/M2000-Interpreter/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Associative-array-Merging b/Lang/M2000-Interpreter/Associative-array-Merging new file mode 120000 index 0000000000..e54ba7cbfd --- /dev/null +++ b/Lang/M2000-Interpreter/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Averages-Mean-angle b/Lang/M2000-Interpreter/Averages-Mean-angle new file mode 120000 index 0000000000..5bcc89482d --- /dev/null +++ b/Lang/M2000-Interpreter/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Averages-Root-mean-square b/Lang/M2000-Interpreter/Averages-Root-mean-square new file mode 120000 index 0000000000..226fa9019d --- /dev/null +++ b/Lang/M2000-Interpreter/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Averages-Simple-moving-average b/Lang/M2000-Interpreter/Averages-Simple-moving-average new file mode 120000 index 0000000000..4d812f1b4c --- /dev/null +++ b/Lang/M2000-Interpreter/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Babylonian-spiral b/Lang/M2000-Interpreter/Babylonian-spiral new file mode 120000 index 0000000000..70eeaaf834 --- /dev/null +++ b/Lang/M2000-Interpreter/Babylonian-spiral @@ -0,0 +1 @@ +../../Task/Babylonian-spiral/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Bernoulli-numbers b/Lang/M2000-Interpreter/Bernoulli-numbers new file mode 120000 index 0000000000..91c31cbe94 --- /dev/null +++ b/Lang/M2000-Interpreter/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Bifid-cipher b/Lang/M2000-Interpreter/Bifid-cipher new file mode 120000 index 0000000000..c97cd39b1f --- /dev/null +++ b/Lang/M2000-Interpreter/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Binary-strings b/Lang/M2000-Interpreter/Binary-strings new file mode 120000 index 0000000000..7890dd1bf5 --- /dev/null +++ b/Lang/M2000-Interpreter/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Bitmap-B-zier-curves-Quadratic b/Lang/M2000-Interpreter/Bitmap-B-zier-curves-Quadratic new file mode 120000 index 0000000000..2471b47323 --- /dev/null +++ b/Lang/M2000-Interpreter/Bitmap-B-zier-curves-Quadratic @@ -0,0 +1 @@ +../../Task/Bitmap-B-zier-curves-Quadratic/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Bitmap-Bresenhams-line-algorithm b/Lang/M2000-Interpreter/Bitmap-Bresenhams-line-algorithm new file mode 120000 index 0000000000..37e0c9a050 --- /dev/null +++ b/Lang/M2000-Interpreter/Bitmap-Bresenhams-line-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Bresenhams-line-algorithm/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Bitwise-operations b/Lang/M2000-Interpreter/Bitwise-operations new file mode 120000 index 0000000000..7b5956a12b --- /dev/null +++ b/Lang/M2000-Interpreter/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Cartesian-product-of-two-or-more-lists b/Lang/M2000-Interpreter/Cartesian-product-of-two-or-more-lists new file mode 120000 index 0000000000..afa95add18 --- /dev/null +++ b/Lang/M2000-Interpreter/Cartesian-product-of-two-or-more-lists @@ -0,0 +1 @@ +../../Task/Cartesian-product-of-two-or-more-lists/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Chinese-zodiac b/Lang/M2000-Interpreter/Chinese-zodiac new file mode 120000 index 0000000000..ba20540cb2 --- /dev/null +++ b/Lang/M2000-Interpreter/Chinese-zodiac @@ -0,0 +1 @@ +../../Task/Chinese-zodiac/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Compare-length-of-two-strings b/Lang/M2000-Interpreter/Compare-length-of-two-strings new file mode 120000 index 0000000000..1726357b73 --- /dev/null +++ b/Lang/M2000-Interpreter/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Compound-data-type b/Lang/M2000-Interpreter/Compound-data-type new file mode 120000 index 0000000000..661e74ca81 --- /dev/null +++ b/Lang/M2000-Interpreter/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Count-occurrences-of-a-substring b/Lang/M2000-Interpreter/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..96e93abdc4 --- /dev/null +++ b/Lang/M2000-Interpreter/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Deal-cards-for-FreeCell b/Lang/M2000-Interpreter/Deal-cards-for-FreeCell new file mode 120000 index 0000000000..59b0374429 --- /dev/null +++ b/Lang/M2000-Interpreter/Deal-cards-for-FreeCell @@ -0,0 +1 @@ +../../Task/Deal-cards-for-FreeCell/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Doomsday-rule b/Lang/M2000-Interpreter/Doomsday-rule new file mode 120000 index 0000000000..64bda385da --- /dev/null +++ b/Lang/M2000-Interpreter/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Egyptian-division b/Lang/M2000-Interpreter/Egyptian-division new file mode 120000 index 0000000000..ed8318ad3d --- /dev/null +++ b/Lang/M2000-Interpreter/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Equilibrium-index b/Lang/M2000-Interpreter/Equilibrium-index new file mode 120000 index 0000000000..52fd43669a --- /dev/null +++ b/Lang/M2000-Interpreter/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Eulers-identity b/Lang/M2000-Interpreter/Eulers-identity new file mode 120000 index 0000000000..af0f40c33c --- /dev/null +++ b/Lang/M2000-Interpreter/Eulers-identity @@ -0,0 +1 @@ +../../Task/Eulers-identity/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Execute-Computer-Zero b/Lang/M2000-Interpreter/Execute-Computer-Zero new file mode 120000 index 0000000000..fecab5c3ec --- /dev/null +++ b/Lang/M2000-Interpreter/Execute-Computer-Zero @@ -0,0 +1 @@ +../../Task/Execute-Computer-Zero/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Factors-of-a-Mersenne-number b/Lang/M2000-Interpreter/Factors-of-a-Mersenne-number new file mode 120000 index 0000000000..dcb49d5579 --- /dev/null +++ b/Lang/M2000-Interpreter/Factors-of-a-Mersenne-number @@ -0,0 +1 @@ +../../Task/Factors-of-a-Mersenne-number/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Fast-Fourier-transform b/Lang/M2000-Interpreter/Fast-Fourier-transform new file mode 120000 index 0000000000..e70d70854c --- /dev/null +++ b/Lang/M2000-Interpreter/Fast-Fourier-transform @@ -0,0 +1 @@ +../../Task/Fast-Fourier-transform/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/File-extension-is-in-extensions-list b/Lang/M2000-Interpreter/File-extension-is-in-extensions-list new file mode 120000 index 0000000000..6d12e57411 --- /dev/null +++ b/Lang/M2000-Interpreter/File-extension-is-in-extensions-list @@ -0,0 +1 @@ +../../Task/File-extension-is-in-extensions-list/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Find-the-last-Sunday-of-each-month b/Lang/M2000-Interpreter/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..14e77f2ff4 --- /dev/null +++ b/Lang/M2000-Interpreter/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Four-is-magic b/Lang/M2000-Interpreter/Four-is-magic new file mode 120000 index 0000000000..3bd19ce379 --- /dev/null +++ b/Lang/M2000-Interpreter/Four-is-magic @@ -0,0 +1 @@ +../../Task/Four-is-magic/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Globally-replace-text-in-several-files b/Lang/M2000-Interpreter/Globally-replace-text-in-several-files new file mode 120000 index 0000000000..6371957a66 --- /dev/null +++ b/Lang/M2000-Interpreter/Globally-replace-text-in-several-files @@ -0,0 +1 @@ +../../Task/Globally-replace-text-in-several-files/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Greatest-subsequential-sum b/Lang/M2000-Interpreter/Greatest-subsequential-sum new file mode 120000 index 0000000000..5470dd7511 --- /dev/null +++ b/Lang/M2000-Interpreter/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/HTTPS b/Lang/M2000-Interpreter/HTTPS new file mode 120000 index 0000000000..07f4e45833 --- /dev/null +++ b/Lang/M2000-Interpreter/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/ISBN13-check-digit b/Lang/M2000-Interpreter/ISBN13-check-digit new file mode 120000 index 0000000000..b320adf2bf --- /dev/null +++ b/Lang/M2000-Interpreter/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols b/Lang/M2000-Interpreter/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols new file mode 120000 index 0000000000..85569db69f --- /dev/null +++ b/Lang/M2000-Interpreter/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols @@ -0,0 +1 @@ +../../Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/K-d-tree b/Lang/M2000-Interpreter/K-d-tree new file mode 120000 index 0000000000..5f1e9bff31 --- /dev/null +++ b/Lang/M2000-Interpreter/K-d-tree @@ -0,0 +1 @@ +../../Task/K-d-tree/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Leonardo-numbers b/Lang/M2000-Interpreter/Leonardo-numbers new file mode 120000 index 0000000000..4f37c1babb --- /dev/null +++ b/Lang/M2000-Interpreter/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Logistic-curve-fitting-in-epidemiology b/Lang/M2000-Interpreter/Logistic-curve-fitting-in-epidemiology new file mode 120000 index 0000000000..d60f5aa239 --- /dev/null +++ b/Lang/M2000-Interpreter/Logistic-curve-fitting-in-epidemiology @@ -0,0 +1 @@ +../../Task/Logistic-curve-fitting-in-epidemiology/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Long-multiplication b/Lang/M2000-Interpreter/Long-multiplication new file mode 120000 index 0000000000..ba1dc9bc62 --- /dev/null +++ b/Lang/M2000-Interpreter/Long-multiplication @@ -0,0 +1 @@ +../../Task/Long-multiplication/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Long-year b/Lang/M2000-Interpreter/Long-year new file mode 120000 index 0000000000..7119be8d2b --- /dev/null +++ b/Lang/M2000-Interpreter/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Mastermind b/Lang/M2000-Interpreter/Mastermind new file mode 120000 index 0000000000..3cfbb80935 --- /dev/null +++ b/Lang/M2000-Interpreter/Mastermind @@ -0,0 +1 @@ +../../Task/Mastermind/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Matrix-digital-rain b/Lang/M2000-Interpreter/Matrix-digital-rain new file mode 120000 index 0000000000..c3f5d509a7 --- /dev/null +++ b/Lang/M2000-Interpreter/Matrix-digital-rain @@ -0,0 +1 @@ +../../Task/Matrix-digital-rain/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Matrix-transposition b/Lang/M2000-Interpreter/Matrix-transposition new file mode 120000 index 0000000000..5ea61d7980 --- /dev/null +++ b/Lang/M2000-Interpreter/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Modified-random-distribution b/Lang/M2000-Interpreter/Modified-random-distribution new file mode 120000 index 0000000000..bbbb129f02 --- /dev/null +++ b/Lang/M2000-Interpreter/Modified-random-distribution @@ -0,0 +1 @@ +../../Task/Modified-random-distribution/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Modular-exponentiation b/Lang/M2000-Interpreter/Modular-exponentiation new file mode 120000 index 0000000000..99e9549d1a --- /dev/null +++ b/Lang/M2000-Interpreter/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Morse-code b/Lang/M2000-Interpreter/Morse-code new file mode 120000 index 0000000000..77ce05e92e --- /dev/null +++ b/Lang/M2000-Interpreter/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Multi-dimensional-array b/Lang/M2000-Interpreter/Multi-dimensional-array new file mode 120000 index 0000000000..24c2948fdf --- /dev/null +++ b/Lang/M2000-Interpreter/Multi-dimensional-array @@ -0,0 +1 @@ +../../Task/Multi-dimensional-array/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Multiple-regression b/Lang/M2000-Interpreter/Multiple-regression new file mode 120000 index 0000000000..f645ea689c --- /dev/null +++ b/Lang/M2000-Interpreter/Multiple-regression @@ -0,0 +1 @@ +../../Task/Multiple-regression/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Number-names b/Lang/M2000-Interpreter/Number-names new file mode 120000 index 0000000000..acf20af45b --- /dev/null +++ b/Lang/M2000-Interpreter/Number-names @@ -0,0 +1 @@ +../../Task/Number-names/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Old-lady-swallowed-a-fly b/Lang/M2000-Interpreter/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..f9fe169db2 --- /dev/null +++ b/Lang/M2000-Interpreter/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Ordered-words b/Lang/M2000-Interpreter/Ordered-words new file mode 120000 index 0000000000..ccf0ec6f16 --- /dev/null +++ b/Lang/M2000-Interpreter/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Password-generator b/Lang/M2000-Interpreter/Password-generator new file mode 120000 index 0000000000..0b48ccbf39 --- /dev/null +++ b/Lang/M2000-Interpreter/Password-generator @@ -0,0 +1 @@ +../../Task/Password-generator/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Periodic-table b/Lang/M2000-Interpreter/Periodic-table new file mode 120000 index 0000000000..0e286fad08 --- /dev/null +++ b/Lang/M2000-Interpreter/Periodic-table @@ -0,0 +1 @@ +../../Task/Periodic-table/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Polyspiral b/Lang/M2000-Interpreter/Polyspiral new file mode 120000 index 0000000000..f2eb619d45 --- /dev/null +++ b/Lang/M2000-Interpreter/Polyspiral @@ -0,0 +1 @@ +../../Task/Polyspiral/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Power-set b/Lang/M2000-Interpreter/Power-set new file mode 120000 index 0000000000..c99b047826 --- /dev/null +++ b/Lang/M2000-Interpreter/Power-set @@ -0,0 +1 @@ +../../Task/Power-set/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Problem-of-Apollonius b/Lang/M2000-Interpreter/Problem-of-Apollonius new file mode 120000 index 0000000000..3c1d7459c0 --- /dev/null +++ b/Lang/M2000-Interpreter/Problem-of-Apollonius @@ -0,0 +1 @@ +../../Task/Problem-of-Apollonius/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Pseudo-random-numbers-Middle-square-method b/Lang/M2000-Interpreter/Pseudo-random-numbers-Middle-square-method new file mode 120000 index 0000000000..71371c48fd --- /dev/null +++ b/Lang/M2000-Interpreter/Pseudo-random-numbers-Middle-square-method @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Middle-square-method/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Pseudo-random-numbers-Xorshift-star b/Lang/M2000-Interpreter/Pseudo-random-numbers-Xorshift-star new file mode 120000 index 0000000000..a60ebed0a5 --- /dev/null +++ b/Lang/M2000-Interpreter/Pseudo-random-numbers-Xorshift-star @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Xorshift-star/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Quaternion-type b/Lang/M2000-Interpreter/Quaternion-type deleted file mode 120000 index 7027a86930..0000000000 --- a/Lang/M2000-Interpreter/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Read-a-specific-line-from-a-file b/Lang/M2000-Interpreter/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..12c1b22a47 --- /dev/null +++ b/Lang/M2000-Interpreter/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Roots-of-a-quadratic-function b/Lang/M2000-Interpreter/Roots-of-a-quadratic-function new file mode 120000 index 0000000000..0f141b08fb --- /dev/null +++ b/Lang/M2000-Interpreter/Roots-of-a-quadratic-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-quadratic-function/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Simple-turtle-graphics b/Lang/M2000-Interpreter/Simple-turtle-graphics new file mode 120000 index 0000000000..8bb4a18e49 --- /dev/null +++ b/Lang/M2000-Interpreter/Simple-turtle-graphics @@ -0,0 +1 @@ +../../Task/Simple-turtle-graphics/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Sleeping-Beauty-problem b/Lang/M2000-Interpreter/Sleeping-Beauty-problem new file mode 120000 index 0000000000..aee1fdd4f8 --- /dev/null +++ b/Lang/M2000-Interpreter/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Sort-an-integer-array b/Lang/M2000-Interpreter/Sort-an-integer-array new file mode 120000 index 0000000000..f409389d27 --- /dev/null +++ b/Lang/M2000-Interpreter/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Sort-an-outline-at-every-level b/Lang/M2000-Interpreter/Sort-an-outline-at-every-level new file mode 120000 index 0000000000..b5c1e68e5d --- /dev/null +++ b/Lang/M2000-Interpreter/Sort-an-outline-at-every-level @@ -0,0 +1 @@ +../../Task/Sort-an-outline-at-every-level/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Sorting-algorithms-Strand-sort b/Lang/M2000-Interpreter/Sorting-algorithms-Strand-sort new file mode 120000 index 0000000000..94b7b8369f --- /dev/null +++ b/Lang/M2000-Interpreter/Sorting-algorithms-Strand-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Strand-sort/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Stable-marriage-problem b/Lang/M2000-Interpreter/Stable-marriage-problem new file mode 120000 index 0000000000..1148451e3c --- /dev/null +++ b/Lang/M2000-Interpreter/Stable-marriage-problem @@ -0,0 +1 @@ +../../Task/Stable-marriage-problem/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Statistics-Basic b/Lang/M2000-Interpreter/Statistics-Basic new file mode 120000 index 0000000000..9d5dab6ba7 --- /dev/null +++ b/Lang/M2000-Interpreter/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Statistics-Normal-distribution b/Lang/M2000-Interpreter/Statistics-Normal-distribution new file mode 120000 index 0000000000..6018d24b87 --- /dev/null +++ b/Lang/M2000-Interpreter/Statistics-Normal-distribution @@ -0,0 +1 @@ +../../Task/Statistics-Normal-distribution/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Strip-a-set-of-characters-from-a-string b/Lang/M2000-Interpreter/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..ca8f98d606 --- /dev/null +++ b/Lang/M2000-Interpreter/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Taxicab-numbers b/Lang/M2000-Interpreter/Taxicab-numbers new file mode 120000 index 0000000000..6c7f58f7d6 --- /dev/null +++ b/Lang/M2000-Interpreter/Taxicab-numbers @@ -0,0 +1 @@ +../../Task/Taxicab-numbers/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Temperature-conversion b/Lang/M2000-Interpreter/Temperature-conversion new file mode 120000 index 0000000000..75d9db05ed --- /dev/null +++ b/Lang/M2000-Interpreter/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Terminal-control-Hiding-the-cursor b/Lang/M2000-Interpreter/Terminal-control-Hiding-the-cursor new file mode 120000 index 0000000000..7d9e8bacf5 --- /dev/null +++ b/Lang/M2000-Interpreter/Terminal-control-Hiding-the-cursor @@ -0,0 +1 @@ +../../Task/Terminal-control-Hiding-the-cursor/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Tree-datastructures b/Lang/M2000-Interpreter/Tree-datastructures new file mode 120000 index 0000000000..1fa6a47d52 --- /dev/null +++ b/Lang/M2000-Interpreter/Tree-datastructures @@ -0,0 +1 @@ +../../Task/Tree-datastructures/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Truth-table b/Lang/M2000-Interpreter/Truth-table new file mode 120000 index 0000000000..b77fe8354b --- /dev/null +++ b/Lang/M2000-Interpreter/Truth-table @@ -0,0 +1 @@ +../../Task/Truth-table/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Ultra-useful-primes b/Lang/M2000-Interpreter/Ultra-useful-primes new file mode 120000 index 0000000000..5330980a0e --- /dev/null +++ b/Lang/M2000-Interpreter/Ultra-useful-primes @@ -0,0 +1 @@ +../../Task/Ultra-useful-primes/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Video-display-modes b/Lang/M2000-Interpreter/Video-display-modes new file mode 120000 index 0000000000..39ee17dc2d --- /dev/null +++ b/Lang/M2000-Interpreter/Video-display-modes @@ -0,0 +1 @@ +../../Task/Video-display-modes/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Window-management b/Lang/M2000-Interpreter/Window-management new file mode 120000 index 0000000000..bb8ac9e26a --- /dev/null +++ b/Lang/M2000-Interpreter/Window-management @@ -0,0 +1 @@ +../../Task/Window-management/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M2000-Interpreter/Write-language-name-in-3D-ASCII b/Lang/M2000-Interpreter/Write-language-name-in-3D-ASCII new file mode 120000 index 0000000000..3ec6cbeb80 --- /dev/null +++ b/Lang/M2000-Interpreter/Write-language-name-in-3D-ASCII @@ -0,0 +1 @@ +../../Task/Write-language-name-in-3D-ASCII/M2000-Interpreter \ No newline at end of file diff --git a/Lang/M4/Cantor-set b/Lang/M4/Cantor-set new file mode 120000 index 0000000000..cb3913e176 --- /dev/null +++ b/Lang/M4/Cantor-set @@ -0,0 +1 @@ +../../Task/Cantor-set/M4 \ No newline at end of file diff --git a/Lang/M4/Empty-program b/Lang/M4/Empty-program deleted file mode 120000 index 3ce502532c..0000000000 --- a/Lang/M4/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/M4 \ No newline at end of file diff --git a/Lang/MACRO-11/Binary-digits b/Lang/MACRO-11/Binary-digits new file mode 120000 index 0000000000..a2876ce191 --- /dev/null +++ b/Lang/MACRO-11/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/MACRO-11 \ No newline at end of file diff --git a/Lang/MACRO-11/McNuggets-problem b/Lang/MACRO-11/McNuggets-problem new file mode 120000 index 0000000000..2067890dbc --- /dev/null +++ b/Lang/MACRO-11/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/MACRO-11 \ No newline at end of file diff --git a/Lang/MACRO-11/Run-length-encoding b/Lang/MACRO-11/Run-length-encoding new file mode 120000 index 0000000000..3f700314e0 --- /dev/null +++ b/Lang/MACRO-11/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/MACRO-11 \ No newline at end of file diff --git a/Lang/MACRO-11/Square-but-not-cube b/Lang/MACRO-11/Square-but-not-cube new file mode 120000 index 0000000000..7130b2c620 --- /dev/null +++ b/Lang/MACRO-11/Square-but-not-cube @@ -0,0 +1 @@ +../../Task/Square-but-not-cube/MACRO-11 \ No newline at end of file diff --git a/Lang/MAD/Arithmetic-derivative b/Lang/MAD/Arithmetic-derivative new file mode 120000 index 0000000000..e7c006ae6c --- /dev/null +++ b/Lang/MAD/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/MAD \ No newline at end of file diff --git a/Lang/MAD/Count-the-coins b/Lang/MAD/Count-the-coins new file mode 120000 index 0000000000..fc27a9f988 --- /dev/null +++ b/Lang/MAD/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/MAD \ No newline at end of file diff --git a/Lang/MAD/Look-and-say-sequence b/Lang/MAD/Look-and-say-sequence new file mode 120000 index 0000000000..dbca6a6456 --- /dev/null +++ b/Lang/MAD/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/MAD \ No newline at end of file diff --git a/Lang/MAD/Narcissistic-decimal-number b/Lang/MAD/Narcissistic-decimal-number new file mode 120000 index 0000000000..e10c6cbbcd --- /dev/null +++ b/Lang/MAD/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/MAD \ No newline at end of file diff --git a/Lang/MAD/Primality-by-Wilsons-theorem b/Lang/MAD/Primality-by-Wilsons-theorem new file mode 120000 index 0000000000..2fd2beea20 --- /dev/null +++ b/Lang/MAD/Primality-by-Wilsons-theorem @@ -0,0 +1 @@ +../../Task/Primality-by-Wilsons-theorem/MAD \ No newline at end of file diff --git a/Lang/MAD/Zeckendorf-number-representation b/Lang/MAD/Zeckendorf-number-representation new file mode 120000 index 0000000000..3be8d0f3cc --- /dev/null +++ b/Lang/MAD/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/MAD \ No newline at end of file diff --git a/Lang/MATLAB/Arithmetic-geometric-mean-Calculate-Pi b/Lang/MATLAB/Arithmetic-geometric-mean-Calculate-Pi new file mode 120000 index 0000000000..455d4f72bb --- /dev/null +++ b/Lang/MATLAB/Arithmetic-geometric-mean-Calculate-Pi @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean-Calculate-Pi/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Babbage-problem b/Lang/MATLAB/Babbage-problem new file mode 120000 index 0000000000..995ca19944 --- /dev/null +++ b/Lang/MATLAB/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Babylonian-spiral b/Lang/MATLAB/Babylonian-spiral new file mode 120000 index 0000000000..ecf91872cf --- /dev/null +++ b/Lang/MATLAB/Babylonian-spiral @@ -0,0 +1 @@ +../../Task/Babylonian-spiral/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Benfords-law b/Lang/MATLAB/Benfords-law new file mode 120000 index 0000000000..24ad64ca80 --- /dev/null +++ b/Lang/MATLAB/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Bioinformatics-base-count b/Lang/MATLAB/Bioinformatics-base-count deleted file mode 120000 index 2622a73422..0000000000 --- a/Lang/MATLAB/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Brazilian-numbers b/Lang/MATLAB/Brazilian-numbers new file mode 120000 index 0000000000..31d88350b2 --- /dev/null +++ b/Lang/MATLAB/Brazilian-numbers @@ -0,0 +1 @@ +../../Task/Brazilian-numbers/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Canonicalize-CIDR b/Lang/MATLAB/Canonicalize-CIDR new file mode 120000 index 0000000000..eb15cedc52 --- /dev/null +++ b/Lang/MATLAB/Canonicalize-CIDR @@ -0,0 +1 @@ +../../Task/Canonicalize-CIDR/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Damm-algorithm b/Lang/MATLAB/Damm-algorithm new file mode 120000 index 0000000000..8c3c3b12e0 --- /dev/null +++ b/Lang/MATLAB/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Department-numbers b/Lang/MATLAB/Department-numbers new file mode 120000 index 0000000000..a4bfc52d36 --- /dev/null +++ b/Lang/MATLAB/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/EKG-sequence-convergence b/Lang/MATLAB/EKG-sequence-convergence new file mode 120000 index 0000000000..d84b387d6c --- /dev/null +++ b/Lang/MATLAB/EKG-sequence-convergence @@ -0,0 +1 @@ +../../Task/EKG-sequence-convergence/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Euler-method b/Lang/MATLAB/Euler-method new file mode 120000 index 0000000000..210be62097 --- /dev/null +++ b/Lang/MATLAB/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Farey-sequence b/Lang/MATLAB/Farey-sequence new file mode 120000 index 0000000000..8248da8507 --- /dev/null +++ b/Lang/MATLAB/Farey-sequence @@ -0,0 +1 @@ +../../Task/Farey-sequence/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Find-the-last-Sunday-of-each-month b/Lang/MATLAB/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..989cc5e7f4 --- /dev/null +++ b/Lang/MATLAB/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Padovan-sequence b/Lang/MATLAB/Padovan-sequence new file mode 120000 index 0000000000..3df1773261 --- /dev/null +++ b/Lang/MATLAB/Padovan-sequence @@ -0,0 +1 @@ +../../Task/Padovan-sequence/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Pascal-matrix-generation b/Lang/MATLAB/Pascal-matrix-generation new file mode 120000 index 0000000000..52b2a75e65 --- /dev/null +++ b/Lang/MATLAB/Pascal-matrix-generation @@ -0,0 +1 @@ +../../Task/Pascal-matrix-generation/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Steffensens-method b/Lang/MATLAB/Steffensens-method new file mode 120000 index 0000000000..ee8fd5a1aa --- /dev/null +++ b/Lang/MATLAB/Steffensens-method @@ -0,0 +1 @@ +../../Task/Steffensens-method/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Strassens-algorithm b/Lang/MATLAB/Strassens-algorithm new file mode 120000 index 0000000000..74ee0ab355 --- /dev/null +++ b/Lang/MATLAB/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Sum-of-elements-below-main-diagonal-of-matrix b/Lang/MATLAB/Sum-of-elements-below-main-diagonal-of-matrix new file mode 120000 index 0000000000..7c6a28e865 --- /dev/null +++ b/Lang/MATLAB/Sum-of-elements-below-main-diagonal-of-matrix @@ -0,0 +1 @@ +../../Task/Sum-of-elements-below-main-diagonal-of-matrix/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Thue-Morse b/Lang/MATLAB/Thue-Morse new file mode 120000 index 0000000000..c795b03216 --- /dev/null +++ b/Lang/MATLAB/Thue-Morse @@ -0,0 +1 @@ +../../Task/Thue-Morse/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Trabb-Pardo-Knuth-algorithm b/Lang/MATLAB/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..2c35ef2ed2 --- /dev/null +++ b/Lang/MATLAB/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Xiaolin-Wus-line-algorithm b/Lang/MATLAB/Xiaolin-Wus-line-algorithm new file mode 120000 index 0000000000..455a774f2c --- /dev/null +++ b/Lang/MATLAB/Xiaolin-Wus-line-algorithm @@ -0,0 +1 @@ +../../Task/Xiaolin-Wus-line-algorithm/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Zeckendorf-number-representation b/Lang/MATLAB/Zeckendorf-number-representation new file mode 120000 index 0000000000..29c82374e5 --- /dev/null +++ b/Lang/MATLAB/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/MATLAB \ No newline at end of file diff --git a/Lang/ML-I/Empty-program b/Lang/ML-I/Empty-program deleted file mode 120000 index 48b06f2449..0000000000 --- a/Lang/ML-I/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/ML-I \ No newline at end of file diff --git a/Lang/MSX-Basic/00-LANG.txt b/Lang/MSX-Basic/00-LANG.txt index 39fed5b3f2..df6b69a6bd 100644 --- a/Lang/MSX-Basic/00-LANG.txt +++ b/Lang/MSX-Basic/00-LANG.txt @@ -13,10 +13,8 @@ MSX Basic is the BASIC built into the ROM of the MSX compatible computers. -MSX BASIC is a dialect of the BASIC programming language. It is an extended version of Microsoft Standard BASIC Version 4.5, and includes support for graphic, music, and various peripherals attached to MSX Personal Computers. Generally, MSX-BASIC is designed to follow GW-BASIC +MSX BASIC is a dialect of the BASIC programming language. It is an extended version of Microsoft Standard BASIC Version 4.5, and includes support for graphic, music, and various peripherals attached to MSX Personal Computers. Generally, MSX-BASIC is designed to follow GW-BASIC. - -=={{header|MSX Basic}}== 10 Rem Count 1 to 10 and print! 20 for a=1 to 10 30 Print a diff --git a/Lang/MSX-Basic/Arithmetic-Integer b/Lang/MSX-Basic/Arithmetic-Integer new file mode 120000 index 0000000000..aaa58ac04e --- /dev/null +++ b/Lang/MSX-Basic/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Balanced-brackets b/Lang/MSX-Basic/Balanced-brackets new file mode 120000 index 0000000000..6606d4c62a --- /dev/null +++ b/Lang/MSX-Basic/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Casting-out-nines b/Lang/MSX-Basic/Casting-out-nines new file mode 120000 index 0000000000..496486e0bb --- /dev/null +++ b/Lang/MSX-Basic/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Catalan-numbers-Pascals-triangle b/Lang/MSX-Basic/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..0915489acf --- /dev/null +++ b/Lang/MSX-Basic/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Chaos-game b/Lang/MSX-Basic/Chaos-game new file mode 120000 index 0000000000..84ce60ae68 --- /dev/null +++ b/Lang/MSX-Basic/Chaos-game @@ -0,0 +1 @@ +../../Task/Chaos-game/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Character-codes b/Lang/MSX-Basic/Character-codes new file mode 120000 index 0000000000..864fa47ef3 --- /dev/null +++ b/Lang/MSX-Basic/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Colour-pinstripe-Display b/Lang/MSX-Basic/Colour-pinstripe-Display new file mode 120000 index 0000000000..f0497934ea --- /dev/null +++ b/Lang/MSX-Basic/Colour-pinstripe-Display @@ -0,0 +1 @@ +../../Task/Colour-pinstripe-Display/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Compare-length-of-two-strings b/Lang/MSX-Basic/Compare-length-of-two-strings new file mode 120000 index 0000000000..2d9711b8a5 --- /dev/null +++ b/Lang/MSX-Basic/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Diversity-prediction-theorem b/Lang/MSX-Basic/Diversity-prediction-theorem new file mode 120000 index 0000000000..e57f4cb084 --- /dev/null +++ b/Lang/MSX-Basic/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Egyptian-division b/Lang/MSX-Basic/Egyptian-division new file mode 120000 index 0000000000..f728e3679e --- /dev/null +++ b/Lang/MSX-Basic/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Evaluate-binomial-coefficients b/Lang/MSX-Basic/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..806e2bfad2 --- /dev/null +++ b/Lang/MSX-Basic/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Generate-lower-case-ASCII-alphabet b/Lang/MSX-Basic/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..8cceece87f --- /dev/null +++ b/Lang/MSX-Basic/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Guess-the-number-With-feedback b/Lang/MSX-Basic/Guess-the-number-With-feedback new file mode 120000 index 0000000000..fb980893ed --- /dev/null +++ b/Lang/MSX-Basic/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Leonardo-numbers b/Lang/MSX-Basic/Leonardo-numbers new file mode 120000 index 0000000000..070fbe9186 --- /dev/null +++ b/Lang/MSX-Basic/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Logical-operations b/Lang/MSX-Basic/Logical-operations new file mode 120000 index 0000000000..ff8c74475d --- /dev/null +++ b/Lang/MSX-Basic/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Longest-string-challenge b/Lang/MSX-Basic/Longest-string-challenge new file mode 120000 index 0000000000..84c8411c40 --- /dev/null +++ b/Lang/MSX-Basic/Longest-string-challenge @@ -0,0 +1 @@ +../../Task/Longest-string-challenge/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Magic-squares-of-odd-order b/Lang/MSX-Basic/Magic-squares-of-odd-order new file mode 120000 index 0000000000..f22c14f72c --- /dev/null +++ b/Lang/MSX-Basic/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Map-range b/Lang/MSX-Basic/Map-range new file mode 120000 index 0000000000..749213e0f6 --- /dev/null +++ b/Lang/MSX-Basic/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Nim-game b/Lang/MSX-Basic/Nim-game new file mode 120000 index 0000000000..f39e2ba67b --- /dev/null +++ b/Lang/MSX-Basic/Nim-game @@ -0,0 +1 @@ +../../Task/Nim-game/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Pascals-triangle b/Lang/MSX-Basic/Pascals-triangle new file mode 120000 index 0000000000..bfaa04f0db --- /dev/null +++ b/Lang/MSX-Basic/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Pig-the-dice-game b/Lang/MSX-Basic/Pig-the-dice-game new file mode 120000 index 0000000000..f87ec9a67c --- /dev/null +++ b/Lang/MSX-Basic/Pig-the-dice-game @@ -0,0 +1 @@ +../../Task/Pig-the-dice-game/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Pinstripe-Display b/Lang/MSX-Basic/Pinstripe-Display new file mode 120000 index 0000000000..b37582657e --- /dev/null +++ b/Lang/MSX-Basic/Pinstripe-Display @@ -0,0 +1 @@ +../../Task/Pinstripe-Display/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/Sorting-algorithms-Gnome-sort b/Lang/MSX-Basic/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..7f3aa97349 --- /dev/null +++ b/Lang/MSX-Basic/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/MSX-Basic \ No newline at end of file diff --git a/Lang/MSX-Basic/String-prepend b/Lang/MSX-Basic/String-prepend new file mode 120000 index 0000000000..f6826b2b2a --- /dev/null +++ b/Lang/MSX-Basic/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/MSX-Basic \ No newline at end of file diff --git a/Lang/MUMPS/00-LANG.txt b/Lang/MUMPS/00-LANG.txt index cfb6ac9800..491ec139a6 100644 --- a/Lang/MUMPS/00-LANG.txt +++ b/Lang/MUMPS/00-LANG.txt @@ -1,14 +1,21 @@ {{language -|untyped=yes}} +|untyped=yes +|gc +|parampass| +}} + {{language programming paradigm|procedural}} -

    Visit the Google group comp.lang.mumps for discussions about this language.

    +

    Visit the Google group/ Usenet newsgroupcomp.lang.mumps for discussions about this language.

    Visit [[wp:MUMPS|Wikipedia]] for a general description.

    See http://71.174.62.16/Demo/AnnoStd for details about the language.

    -

    Standard MUMPS has one data types (strings) and some dialects (Cache, MSM) add a second data type (objects). A variable can be unsubscripted or not, and the subscripted variables form a -sparse n-tree. MUMPS doesn't have traditional arrays, but has an array syntax that manipulates trees as if they were arrays, using indexing to access nodes of the tree. You can create a tree that can have unlimited levels of branching, with keys and values associated with each node in the tree. Similarly, while the language doesn't have lists, you can mimic lists by creating strings with a consistent character (or string) as a delimiter separating the entries. -The Cache dialect also supports explicit List operations and data structures. +

    Standard MUMPS has one data type (strings) and some dialects (Cache, MSM, IRIS) add a second data type (objects). A variable can be unsubscripted or not, and the subscripted variables form a +sparse n-tree, or associative arrays or sparse multidimensional hierarchical key-value pair with keys as strings and values as strings. + +MUMPS doesn't have traditional arrays, but has an array syntax that manipulates trees as if they were arrays, using indexing to access nodes of the tree. You can create a tree that can have unlimited levels of branching, with keys and values associated with each node in the tree. Similarly, while the language doesn't have lists, you can mimic lists by creating strings with a consistent character (or string) as a delimiter separating the entries. + +The Cache and IRIS dialects also support explicit List operations and data structures as values.

    \ No newline at end of file diff --git a/Lang/MUMPS/Menu b/Lang/MUMPS/Menu deleted file mode 120000 index e9b86505e7..0000000000 --- a/Lang/MUMPS/Menu +++ /dev/null @@ -1 +0,0 @@ -../../Task/Menu/MUMPS \ No newline at end of file diff --git a/Lang/Macsyma/00-LANG.txt b/Lang/Macsyma/00-LANG.txt new file mode 100644 index 0000000000..e5e1fd4a0a --- /dev/null +++ b/Lang/Macsyma/00-LANG.txt @@ -0,0 +1,4 @@ +{{language|Macsyma}} +"Project MAC's SYmbolic MAnipulator" + +Is one of the oldest general-purpose computer algebra systems. \ No newline at end of file diff --git a/Lang/Macsyma/00-META.yaml b/Lang/Macsyma/00-META.yaml new file mode 100644 index 0000000000..e65a9178cf --- /dev/null +++ b/Lang/Macsyma/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Macsyma diff --git a/Lang/Maple/Empty-program b/Lang/Maple/Empty-program deleted file mode 120000 index f9fceb04a1..0000000000 --- a/Lang/Maple/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Maple \ No newline at end of file diff --git a/Lang/Maple/Pythagoras-tree b/Lang/Maple/Pythagoras-tree new file mode 120000 index 0000000000..0342fe2180 --- /dev/null +++ b/Lang/Maple/Pythagoras-tree @@ -0,0 +1 @@ +../../Task/Pythagoras-tree/Maple \ No newline at end of file diff --git a/Lang/Maple/Quaternion-type b/Lang/Maple/Quaternion-type deleted file mode 120000 index dc174952ef..0000000000 --- a/Lang/Maple/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Maple \ No newline at end of file diff --git a/Lang/MariaDB/00-LANG.txt b/Lang/MariaDB/00-LANG.txt new file mode 100644 index 0000000000..fc505f9a24 --- /dev/null +++ b/Lang/MariaDB/00-LANG.txt @@ -0,0 +1,15 @@ +{{language|MariaDB}} +{{implementation|SQL}} + +'''MariaDB''' is a relational database management system (RDBMS) with non-relational extensions, like JSON and dynamic columns. It was originally forked from MySQL. After Oracle acquired MySQL in 2009, its creator Michael "Monty" Widenius and other developers from the team created MariaDB. MariaDB was named after Monty's second daughter, Maria. + +MariaDB is backed by two organisations: the MariaDB Foundation, a not-for-profit organisation that makes sure that MariaDB will remain free forever; and MariaDB plc, a company that provides MariaDB support and sells the MariaDB Enterprise edition. MariaDB code is distributed under the GNU GPL 2. Part of the code belongs to Oracle, because it derives from MySQL. MariaDB KnowledgeBase, its documentation, is available under that GNU FDL and the CC-BY-SA 3.0. + +MariaDB SQL has procedural extensions, which can be used to develop stored procedures, stored functions, triggers and events, as well as anonymous code blocks. It also supports a PL/SQL parser, available when MariaDB is used in Oracle compatibility mode. User-Defined Functions can also be written in a compiled language and be used in SQL statements. MariaDB also supports storage engines and other types of plugins. + +== External Links == +* [https://en.wikipedia.org/wiki/MariaDB Wikipedia:MariaDB] +* [https://mariadb.com/kb MariaDB KnowledgeBase] +* [https://mariadb.com/ MariaDB website] + +[[Category:SQL Derivatives]] \ No newline at end of file diff --git a/Lang/MariaDB/00-META.yaml b/Lang/MariaDB/00-META.yaml new file mode 100644 index 0000000000..4ad202983e --- /dev/null +++ b/Lang/MariaDB/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:MariaDB diff --git a/Lang/MariaDB/Conditional-structures b/Lang/MariaDB/Conditional-structures new file mode 120000 index 0000000000..1ed7f68fbf --- /dev/null +++ b/Lang/MariaDB/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/MariaDB \ No newline at end of file diff --git a/Lang/MariaDB/Hello-world-Text b/Lang/MariaDB/Hello-world-Text new file mode 120000 index 0000000000..bc1357e35b --- /dev/null +++ b/Lang/MariaDB/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/MariaDB \ No newline at end of file diff --git a/Lang/MariaDB/Parameterized-SQL-statement b/Lang/MariaDB/Parameterized-SQL-statement new file mode 120000 index 0000000000..28a4df441a --- /dev/null +++ b/Lang/MariaDB/Parameterized-SQL-statement @@ -0,0 +1 @@ +../../Task/Parameterized-SQL-statement/MariaDB \ No newline at end of file diff --git a/Lang/MariaDB/Table-creation-Postal-addresses b/Lang/MariaDB/Table-creation-Postal-addresses new file mode 120000 index 0000000000..5f671a41e1 --- /dev/null +++ b/Lang/MariaDB/Table-creation-Postal-addresses @@ -0,0 +1 @@ +../../Task/Table-creation-Postal-addresses/MariaDB \ No newline at end of file diff --git a/Lang/Mastermind/00-LANG.txt b/Lang/Mastermind/00-LANG.txt new file mode 100644 index 0000000000..faed2e3417 --- /dev/null +++ b/Lang/Mastermind/00-LANG.txt @@ -0,0 +1,292 @@ +{{stub}}{{language|Mastermind}} +Mastermind is a programming language designed specifically to create [[Brainf***]] code. The [https://mastermind.lostpixels.org Mastermind IDE] includes a [[Rust]]-based compiler, which converts (compiles) Mastermind source programs into Brainf***. +The current Mastermind compiler generates Brainf*** code assuming an infinite bi-directional tape, as well as 8-bit wrapping cells https://github.com/Heathcorp/Mastermind. + +== Usage == + +=== Variables & Values === + +Variables can be defined as single cells, or as contiguous sets of cells: +// single-cell: +let var = 56; +let c = 'g'; +let bool = true; // true/false equivalent to 1/0 +// multi-cell: +let array[4] = [1, 2, 3, 4]; +let string[5] = "hello"; +If left uninitialised, a cell is assumed to have a value of 0. + +Expressions consist of simple adds and subtractions, arrays and strings cannot be used in expressions: + +// supported: +var += 4 + (5 - 4 + (3 - 2)); +var = 'g' - 23 + true; +var = var + 5; // inefficient but supported +var += array[0] + 5; +let arr[3] = [4 + 3 - ('5' - 46), 1, 3]; + +// NOT supported: +var += [4, 5, 7][1] + 3; +Array indices must be compile-time constant integers + +=== Input & Output === + +Single bytes can be output using the ''output'' operator: + +output 'h'; +output var; +output var + 6; +output array[0]; +// the following are equivalent: +output '\n'; +output 10; +Likewise for ''input'': + +input var; +input arr[2]; +There is also ''*'' spread syntax and support for strings and arrays for ease of use: + +output "hello"; +output ['1', '2', '3']; +output *array; + +input *array; + +=== Loops === + +The simplest is the ''while'' loop, which only supports cell references, not expressions: + +while var { + // do stuff + // var -= 1; + // etc +} + +==== Draining loops ==== +The "drain" loop is equivalent to the common Brainf*** construction of repeating an action ''N'' times, where ''N'' is the value of a tape cell. Hence, "draining" the cell while doing the actions in the loop body. + +drain var { + +} +// shorthand for following: +while var { + // do stuff + var -= 1; +} +This destructively loops as many times as the value in the cell being referenced, this can be used with expressions: + +drain 10 {} +drain var - 6 {} +There is also shorthand "into" syntax for adding to other cells: + +drain var into other_var other_var_2 *spread_array etc; + +// example of typical "for loop": +let i; +drain 10 into i { + output '0' + i; // inefficient for the example +} +// "0123456789" +// equivalent to the following: +let i; +let N = 10; +while N { + output '0' + i; +} + +==== Copying loops ==== +The "copy" loop is equivalent to the drain loop, except it is not destructive. This means the variable can be accessed safely from inside the loop body. + +copy var into other_var *spread_var etc; + +// examples: +copy var { + // this will output the original var value, var times + output var; +} + +let rows = 3; +let columns = 6; +let total; +drain rows { + copy columns into total { + output '.'; + } +} +// ...... +// ...... +// ...... + +=== If/Else === +The "if" and "else" keywords operate similar to [[C]], except "else if" is not supported. The code in the "if" body will be executed if the provided expression is positive, otherwise the "else" body is executed. If the "not" keyword is used, the behavior is reversed. +Examples: + +if 13 { + output "13"; +} + +if var { + output "true"; +} else { + output "false"; +} + +// typical equivalence use-case: +if not var - 10 { + // == +} else { + // != +} + +=== Functions === +Functions work like templates/macros, as they do not perform any passing by value. All functions are in-lined at compile time. This means multiple calls to a large function will significantly increase your compiled [[Brainf***]] size. + +For this reason, function arguments are given using ''<'' angled bracket ''>'' syntax, much like generic functions in other languages: + +def quote { + output 39; // ASCII single quote + output arg; + output 39; +} + +let N = 'g'; +quote; +N += 3; +quote; +// gj + +=== Imports === + +Imports work much like the [[C]] preprocessor: + +#include "other_file" +This copies the contents of "other_file" into the current file at compile-time. + +=== In-line Brainf*** features === + +In-line Brainf*** allows the programmer to define custom behavior as if writing raw [[Brainf***]], this is analogous to [[C]]'s in-line [[Assembly]]. + + +// This is its most basic form: +// find the next cell that equals -1 +bf { + +[->+]- +} + +// This is its more advanced form: +// input a line of lowercase letters and output the uppercase version +// this is an intentionally inefficient example +bf @3 clobbers var *spread_var etc { + ,----------[++++++++++>,----------] + <[<]> + [ + { + let g @0; + assert g unknown; + output g + ('A' - 'a'); + // embedded Mastermind! + } + > + ] + // now clear and return + <[[-]<]> +} +It is the programmer's responsibility to clear used cells and return back to the cell in which the in-line Brainf*** context began. If the programmer does not do this, any Mastermind code after the in-line Brainf*** command will likely break. + +==== Memory location specifiers ==== +For hand-tuning optimizations and in-line Brainf*** that reads from Mastermind variables, you can specify the location on the Brainf*** tape: +Variables can be fixed to a specified location on the eventual Brainf*** tape. This can also be done with in-line Brainf*** code sections. This can be used to share values between Mastermind and Brainf*** contexts. + +let var @3 = 4; +// compiled: >>>++++ + +bf @4 { + <><><> +} +// compiled: >>>><><><> + +==== Clobbering and Assertions ==== +The Mastermind compiler will try to predict the value of cells at compile-time, so it can prevent unnecessary cell clean-ups and unreachable code (with optimizations turned on). If your in-line Brainf*** affects existing Mastermind variables, you should tell the compiler using the "clobbers" keyword, the syntax is similar to the ''drain into'' variable list: + +bf clobbers var *spread_var other_var etc {} +The compiler will now assume nothing about the values of those variables afterwards. + +If instead you want to tell the compiler specifically that a value has become certain, you can use ''assert'': + +assert var equals 3; +// most common use cases: +assert var equals 0; +assert var unknown; +Asserting a variable as ''unknown'' is equivalent to clobbering. + +==== Embedded Mastermind ==== +Embedding Mastermind into your in-line [[Brainf***]] allows you to use Mastermind syntax features for programs within your Brainf***, this is useful for ''N''-length string based programs, or anything not possible in pure Mastermind: + + +let sum @0; + +bf @0 { + >> + // read input (until eof) to the tape, nullifying any spaces or newlines + // (this is probably not a good practical example, ideas are appreciated) + ,[ + { + let c @0; + assert c unknown; // needed otherwise the compiler assumes c = 0 + + if not (c - '\n') { + c = 0; + } + if not (c - ' ') { + c = 0; + } + } + >, + ] +} +Memory location specifiers are relative to the current Mastermind context. Also, top-level variables are not cleared by default in Mastermind contexts, this allows you to "leave" variables in cells for your Brainf*** to use. If you want your embedded Mastermind to clean itself up, you can simply open a scope at the top level: + +bf { + ++----++[][][<><><>] // the program doesn't matter for this example + { + // variables here will not be cleared + let g @2; + assert g unknown; + { + // variables here will be cleared + let b = 32; + } + } + {{ + // self-cleaning Mastermind code here + }} +} + +==== Advanced ==== +All Mastermind features are available within the embedded Mastermind contexts, including in-line [[Brainf***]] code. + +bf { + ++++[ + { + let i @0; + assert i unknown; + let j @1 = i + 1; + + bf @1 { + [.+] + { + // even more layers are possible + bf { + { + output "h" + } + } + } + } + } + -] +} + + +== References == +{{reflist}} \ No newline at end of file diff --git a/Lang/Mastermind/00-META.yaml b/Lang/Mastermind/00-META.yaml new file mode 100644 index 0000000000..52ba5ad7eb --- /dev/null +++ b/Lang/Mastermind/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Mastermind diff --git a/Lang/Mastermind/Hello-world-Text b/Lang/Mastermind/Hello-world-Text new file mode 120000 index 0000000000..a0461bd60e --- /dev/null +++ b/Lang/Mastermind/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Mastermind \ No newline at end of file diff --git a/Lang/Mastermind/Repeat b/Lang/Mastermind/Repeat new file mode 120000 index 0000000000..25794ace84 --- /dev/null +++ b/Lang/Mastermind/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/Mastermind \ No newline at end of file diff --git a/Lang/Mathematica/00-LANG.txt b/Lang/Mathematica/00-LANG.txt index 5daf1eef81..15e81dd703 100644 --- a/Lang/Mathematica/00-LANG.txt +++ b/Lang/Mathematica/00-LANG.txt @@ -11,4 +11,4 @@ It is used in many scientific, engineering, mathematical and computing fields, a [[Category:Mathematical programming languages]] ==Todo== -[[Reports:Tasks_not_implemented_in_Mathematica]] \ No newline at end of file +[[Tasks not implemented in Mathematica]] \ No newline at end of file diff --git a/Lang/Mathematica/15-puzzle-solver b/Lang/Mathematica/15-puzzle-solver new file mode 120000 index 0000000000..c802cd3973 --- /dev/null +++ b/Lang/Mathematica/15-puzzle-solver @@ -0,0 +1 @@ +../../Task/15-puzzle-solver/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/ADFGVX-cipher b/Lang/Mathematica/ADFGVX-cipher new file mode 120000 index 0000000000..0a44fcd7ef --- /dev/null +++ b/Lang/Mathematica/ADFGVX-cipher @@ -0,0 +1 @@ +../../Task/ADFGVX-cipher/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/ASCII-art-diagram-converter b/Lang/Mathematica/ASCII-art-diagram-converter new file mode 120000 index 0000000000..1006da4cf6 --- /dev/null +++ b/Lang/Mathematica/ASCII-art-diagram-converter @@ -0,0 +1 @@ +../../Task/ASCII-art-diagram-converter/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Arithmetic-derivative b/Lang/Mathematica/Arithmetic-derivative new file mode 120000 index 0000000000..a9033ded41 --- /dev/null +++ b/Lang/Mathematica/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/B-zier-curves-Intersections b/Lang/Mathematica/B-zier-curves-Intersections new file mode 120000 index 0000000000..85dc8fb4ae --- /dev/null +++ b/Lang/Mathematica/B-zier-curves-Intersections @@ -0,0 +1 @@ +../../Task/B-zier-curves-Intersections/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Bioinformatics-base-count b/Lang/Mathematica/Bioinformatics-base-count deleted file mode 120000 index 986950c20f..0000000000 --- a/Lang/Mathematica/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Blum-integer b/Lang/Mathematica/Blum-integer new file mode 120000 index 0000000000..e5ff63a8a5 --- /dev/null +++ b/Lang/Mathematica/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Camel-case-and-snake-case b/Lang/Mathematica/Camel-case-and-snake-case new file mode 120000 index 0000000000..6d73876132 --- /dev/null +++ b/Lang/Mathematica/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Doomsday-rule b/Lang/Mathematica/Doomsday-rule new file mode 120000 index 0000000000..92b8fc707b --- /dev/null +++ b/Lang/Mathematica/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Empty-program b/Lang/Mathematica/Empty-program deleted file mode 120000 index 7445caa973..0000000000 --- a/Lang/Mathematica/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Erd-s-Nicolas-numbers b/Lang/Mathematica/Erd-s-Nicolas-numbers new file mode 120000 index 0000000000..d74b7bd3b7 --- /dev/null +++ b/Lang/Mathematica/Erd-s-Nicolas-numbers @@ -0,0 +1 @@ +../../Task/Erd-s-Nicolas-numbers/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Factorial-primes b/Lang/Mathematica/Factorial-primes new file mode 120000 index 0000000000..1c87586f1f --- /dev/null +++ b/Lang/Mathematica/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Giuga-numbers b/Lang/Mathematica/Giuga-numbers new file mode 120000 index 0000000000..66ff38fc64 --- /dev/null +++ b/Lang/Mathematica/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Jordan-P-lya-numbers b/Lang/Mathematica/Jordan-P-lya-numbers new file mode 120000 index 0000000000..4fd2ab0262 --- /dev/null +++ b/Lang/Mathematica/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Meissel-Mertens-constant b/Lang/Mathematica/Meissel-Mertens-constant deleted file mode 120000 index 8d1d0df59d..0000000000 --- a/Lang/Mathematica/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Miller-Rabin-primality-test b/Lang/Mathematica/Miller-Rabin-primality-test deleted file mode 120000 index 400d0fb0e3..0000000000 --- a/Lang/Mathematica/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Parse-an-IP-Address b/Lang/Mathematica/Parse-an-IP-Address new file mode 120000 index 0000000000..32b7086e88 --- /dev/null +++ b/Lang/Mathematica/Parse-an-IP-Address @@ -0,0 +1 @@ +../../Task/Parse-an-IP-Address/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Perlin-noise b/Lang/Mathematica/Perlin-noise new file mode 120000 index 0000000000..9de4d18cd6 --- /dev/null +++ b/Lang/Mathematica/Perlin-noise @@ -0,0 +1 @@ +../../Task/Perlin-noise/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Pisano-period b/Lang/Mathematica/Pisano-period new file mode 120000 index 0000000000..e114173423 --- /dev/null +++ b/Lang/Mathematica/Pisano-period @@ -0,0 +1 @@ +../../Task/Pisano-period/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Prime-numbers-whose-neighboring-pairs-are-tetraprimes b/Lang/Mathematica/Prime-numbers-whose-neighboring-pairs-are-tetraprimes new file mode 120000 index 0000000000..e8da31b0d4 --- /dev/null +++ b/Lang/Mathematica/Prime-numbers-whose-neighboring-pairs-are-tetraprimes @@ -0,0 +1 @@ +../../Task/Prime-numbers-whose-neighboring-pairs-are-tetraprimes/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Pseudo-random-numbers-PCG32 b/Lang/Mathematica/Pseudo-random-numbers-PCG32 new file mode 120000 index 0000000000..9d682a5443 --- /dev/null +++ b/Lang/Mathematica/Pseudo-random-numbers-PCG32 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-PCG32/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Quaternion-type b/Lang/Mathematica/Quaternion-type deleted file mode 120000 index 700c56b146..0000000000 --- a/Lang/Mathematica/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Radical-of-an-integer b/Lang/Mathematica/Radical-of-an-integer new file mode 120000 index 0000000000..e6b1268eae --- /dev/null +++ b/Lang/Mathematica/Radical-of-an-integer @@ -0,0 +1 @@ +../../Task/Radical-of-an-integer/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Ramer-Douglas-Peucker-line-simplification b/Lang/Mathematica/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..40a31497c6 --- /dev/null +++ b/Lang/Mathematica/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Ruth-Aaron-numbers b/Lang/Mathematica/Ruth-Aaron-numbers new file mode 120000 index 0000000000..9753b08d5c --- /dev/null +++ b/Lang/Mathematica/Ruth-Aaron-numbers @@ -0,0 +1 @@ +../../Task/Ruth-Aaron-numbers/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Same-fringe b/Lang/Mathematica/Same-fringe new file mode 120000 index 0000000000..9a80cee1d8 --- /dev/null +++ b/Lang/Mathematica/Same-fringe @@ -0,0 +1 @@ +../../Task/Same-fringe/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Singular-value-decomposition b/Lang/Mathematica/Singular-value-decomposition new file mode 120000 index 0000000000..1a576b3373 --- /dev/null +++ b/Lang/Mathematica/Singular-value-decomposition @@ -0,0 +1 @@ +../../Task/Singular-value-decomposition/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Sisyphus-sequence b/Lang/Mathematica/Sisyphus-sequence new file mode 120000 index 0000000000..82e0aee9dd --- /dev/null +++ b/Lang/Mathematica/Sisyphus-sequence @@ -0,0 +1 @@ +../../Task/Sisyphus-sequence/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Sorting-Algorithms-Circle-Sort b/Lang/Mathematica/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 9ff1fc78ae..0000000000 --- a/Lang/Mathematica/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Sphenic-numbers b/Lang/Mathematica/Sphenic-numbers new file mode 120000 index 0000000000..c276d09072 --- /dev/null +++ b/Lang/Mathematica/Sphenic-numbers @@ -0,0 +1 @@ +../../Task/Sphenic-numbers/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Strassens-algorithm b/Lang/Mathematica/Strassens-algorithm new file mode 120000 index 0000000000..c75340ee0d --- /dev/null +++ b/Lang/Mathematica/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Sudan-function b/Lang/Mathematica/Sudan-function new file mode 120000 index 0000000000..915d15ee53 --- /dev/null +++ b/Lang/Mathematica/Sudan-function @@ -0,0 +1 @@ +../../Task/Sudan-function/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Suffixation-of-decimal-numbers b/Lang/Mathematica/Suffixation-of-decimal-numbers new file mode 120000 index 0000000000..dd6272f891 --- /dev/null +++ b/Lang/Mathematica/Suffixation-of-decimal-numbers @@ -0,0 +1 @@ +../../Task/Suffixation-of-decimal-numbers/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Tonelli-Shanks-algorithm b/Lang/Mathematica/Tonelli-Shanks-algorithm new file mode 120000 index 0000000000..747956daa4 --- /dev/null +++ b/Lang/Mathematica/Tonelli-Shanks-algorithm @@ -0,0 +1 @@ +../../Task/Tonelli-Shanks-algorithm/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Transliterate-English-text-using-the-Greek-alphabet b/Lang/Mathematica/Transliterate-English-text-using-the-Greek-alphabet new file mode 120000 index 0000000000..d987c7e779 --- /dev/null +++ b/Lang/Mathematica/Transliterate-English-text-using-the-Greek-alphabet @@ -0,0 +1 @@ +../../Task/Transliterate-English-text-using-the-Greek-alphabet/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Tropical-algebra-overloading b/Lang/Mathematica/Tropical-algebra-overloading new file mode 120000 index 0000000000..6a45231ead --- /dev/null +++ b/Lang/Mathematica/Tropical-algebra-overloading @@ -0,0 +1 @@ +../../Task/Tropical-algebra-overloading/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Vogels-approximation-method b/Lang/Mathematica/Vogels-approximation-method new file mode 120000 index 0000000000..2d01457a6e --- /dev/null +++ b/Lang/Mathematica/Vogels-approximation-method @@ -0,0 +1 @@ +../../Task/Vogels-approximation-method/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/Wagstaff-primes b/Lang/Mathematica/Wagstaff-primes new file mode 120000 index 0000000000..7e781a92a6 --- /dev/null +++ b/Lang/Mathematica/Wagstaff-primes @@ -0,0 +1 @@ +../../Task/Wagstaff-primes/Mathematica \ No newline at end of file diff --git a/Lang/Mathematica/World-Cup-group-stage b/Lang/Mathematica/World-Cup-group-stage new file mode 120000 index 0000000000..c3a327e4ad --- /dev/null +++ b/Lang/Mathematica/World-Cup-group-stage @@ -0,0 +1 @@ +../../Task/World-Cup-group-stage/Mathematica \ No newline at end of file diff --git a/Lang/Maxima/00-LANG.txt b/Lang/Maxima/00-LANG.txt index d90dc35da7..3ca362e632 100644 --- a/Lang/Maxima/00-LANG.txt +++ b/Lang/Maxima/00-LANG.txt @@ -3,4 +3,7 @@ Maxima is the language used in the computer algebra system of the same name. [[Category:Mathematical programming languages]] -[[Category:Lisp related]] \ No newline at end of file +[[Category:Lisp related]] + +==Todo== +[[Tasks_not_implemented_in_Maxima]] \ No newline at end of file diff --git a/Lang/Maxima/Angle-difference-between-two-bearings b/Lang/Maxima/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..b086194fa4 --- /dev/null +++ b/Lang/Maxima/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Arithmetic-derivative b/Lang/Maxima/Arithmetic-derivative new file mode 120000 index 0000000000..b682390e8a --- /dev/null +++ b/Lang/Maxima/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Array-length b/Lang/Maxima/Array-length new file mode 120000 index 0000000000..da5c3a4dcd --- /dev/null +++ b/Lang/Maxima/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Babbage-problem b/Lang/Maxima/Babbage-problem new file mode 120000 index 0000000000..8f35ad629d --- /dev/null +++ b/Lang/Maxima/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Calculating-the-value-of-e b/Lang/Maxima/Calculating-the-value-of-e new file mode 120000 index 0000000000..99ef3e7777 --- /dev/null +++ b/Lang/Maxima/Calculating-the-value-of-e @@ -0,0 +1 @@ +../../Task/Calculating-the-value-of-e/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Carmichael-3-strong-pseudoprimes b/Lang/Maxima/Carmichael-3-strong-pseudoprimes new file mode 120000 index 0000000000..cca27bae48 --- /dev/null +++ b/Lang/Maxima/Carmichael-3-strong-pseudoprimes @@ -0,0 +1 @@ +../../Task/Carmichael-3-strong-pseudoprimes/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Catalan-numbers-Pascals-triangle b/Lang/Maxima/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..9cf7344fa4 --- /dev/null +++ b/Lang/Maxima/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Chinese-zodiac b/Lang/Maxima/Chinese-zodiac new file mode 120000 index 0000000000..5fc6134cf1 --- /dev/null +++ b/Lang/Maxima/Chinese-zodiac @@ -0,0 +1 @@ +../../Task/Chinese-zodiac/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Chowla-numbers b/Lang/Maxima/Chowla-numbers new file mode 120000 index 0000000000..4a1835dd7a --- /dev/null +++ b/Lang/Maxima/Chowla-numbers @@ -0,0 +1 @@ +../../Task/Chowla-numbers/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Conjugate-transpose b/Lang/Maxima/Conjugate-transpose new file mode 120000 index 0000000000..f1ca6a05e7 --- /dev/null +++ b/Lang/Maxima/Conjugate-transpose @@ -0,0 +1 @@ +../../Task/Conjugate-transpose/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Continued-fraction-Arithmetic-Construct-from-rational-number b/Lang/Maxima/Continued-fraction-Arithmetic-Construct-from-rational-number new file mode 120000 index 0000000000..29d02a5a5d --- /dev/null +++ b/Lang/Maxima/Continued-fraction-Arithmetic-Construct-from-rational-number @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-Construct-from-rational-number/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Delete-a-file b/Lang/Maxima/Delete-a-file new file mode 120000 index 0000000000..9515074358 --- /dev/null +++ b/Lang/Maxima/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Diversity-prediction-theorem b/Lang/Maxima/Diversity-prediction-theorem new file mode 120000 index 0000000000..5f6277f150 --- /dev/null +++ b/Lang/Maxima/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Doomsday-rule b/Lang/Maxima/Doomsday-rule new file mode 120000 index 0000000000..e92ce2f9d2 --- /dev/null +++ b/Lang/Maxima/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Exponentiation-order b/Lang/Maxima/Exponentiation-order new file mode 120000 index 0000000000..3914b83865 --- /dev/null +++ b/Lang/Maxima/Exponentiation-order @@ -0,0 +1 @@ +../../Task/Exponentiation-order/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Exponentiation-with-infix-operators-in-or-operating-on-the-base b/Lang/Maxima/Exponentiation-with-infix-operators-in-or-operating-on-the-base new file mode 120000 index 0000000000..571c836707 --- /dev/null +++ b/Lang/Maxima/Exponentiation-with-infix-operators-in-or-operating-on-the-base @@ -0,0 +1 @@ +../../Task/Exponentiation-with-infix-operators-in-or-operating-on-the-base/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Fermat-numbers b/Lang/Maxima/Fermat-numbers new file mode 120000 index 0000000000..705c8192a4 --- /dev/null +++ b/Lang/Maxima/Fermat-numbers @@ -0,0 +1 @@ +../../Task/Fermat-numbers/Maxima \ No newline at end of file diff --git a/Lang/Maxima/General-FizzBuzz b/Lang/Maxima/General-FizzBuzz new file mode 120000 index 0000000000..e422ed53f2 --- /dev/null +++ b/Lang/Maxima/General-FizzBuzz @@ -0,0 +1 @@ +../../Task/General-FizzBuzz/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Guess-the-number b/Lang/Maxima/Guess-the-number new file mode 120000 index 0000000000..386c9c38ac --- /dev/null +++ b/Lang/Maxima/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Guess-the-number-With-feedback b/Lang/Maxima/Guess-the-number-With-feedback new file mode 120000 index 0000000000..8b04db909f --- /dev/null +++ b/Lang/Maxima/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Hash-from-two-arrays b/Lang/Maxima/Hash-from-two-arrays new file mode 120000 index 0000000000..b59b47ec09 --- /dev/null +++ b/Lang/Maxima/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Humble-numbers b/Lang/Maxima/Humble-numbers new file mode 120000 index 0000000000..d093fa7dd0 --- /dev/null +++ b/Lang/Maxima/Humble-numbers @@ -0,0 +1 @@ +../../Task/Humble-numbers/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Jacobi-symbol b/Lang/Maxima/Jacobi-symbol new file mode 120000 index 0000000000..73e8a14256 --- /dev/null +++ b/Lang/Maxima/Jacobi-symbol @@ -0,0 +1 @@ +../../Task/Jacobi-symbol/Maxima \ No newline at end of file diff --git a/Lang/Maxima/List-comprehensions b/Lang/Maxima/List-comprehensions new file mode 120000 index 0000000000..de6043c392 --- /dev/null +++ b/Lang/Maxima/List-comprehensions @@ -0,0 +1 @@ +../../Task/List-comprehensions/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Loops-N-plus-one-half b/Lang/Maxima/Loops-N-plus-one-half new file mode 120000 index 0000000000..8fb12a3bb8 --- /dev/null +++ b/Lang/Maxima/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Loops-With-multiple-ranges b/Lang/Maxima/Loops-With-multiple-ranges new file mode 120000 index 0000000000..0d4ccad640 --- /dev/null +++ b/Lang/Maxima/Loops-With-multiple-ranges @@ -0,0 +1 @@ +../../Task/Loops-With-multiple-ranges/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Magic-constant b/Lang/Maxima/Magic-constant new file mode 120000 index 0000000000..406aae118d --- /dev/null +++ b/Lang/Maxima/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Meissel-Mertens-constant b/Lang/Maxima/Meissel-Mertens-constant deleted file mode 120000 index ea7cea2fda..0000000000 --- a/Lang/Maxima/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Miller-Rabin-primality-test b/Lang/Maxima/Miller-Rabin-primality-test deleted file mode 120000 index 331b953779..0000000000 --- a/Lang/Maxima/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Motzkin-numbers b/Lang/Maxima/Motzkin-numbers new file mode 120000 index 0000000000..5663c207ac --- /dev/null +++ b/Lang/Maxima/Motzkin-numbers @@ -0,0 +1 @@ +../../Task/Motzkin-numbers/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Multifactorial b/Lang/Maxima/Multifactorial new file mode 120000 index 0000000000..46f2b49532 --- /dev/null +++ b/Lang/Maxima/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Nested-function b/Lang/Maxima/Nested-function new file mode 120000 index 0000000000..14e0a5c6e4 --- /dev/null +++ b/Lang/Maxima/Nested-function @@ -0,0 +1 @@ +../../Task/Nested-function/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Nth b/Lang/Maxima/Nth new file mode 120000 index 0000000000..76e7cadf39 --- /dev/null +++ b/Lang/Maxima/Nth @@ -0,0 +1 @@ +../../Task/Nth/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Old-lady-swallowed-a-fly b/Lang/Maxima/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..7f7aab63d3 --- /dev/null +++ b/Lang/Maxima/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Pernicious-numbers b/Lang/Maxima/Pernicious-numbers new file mode 120000 index 0000000000..1062304d91 --- /dev/null +++ b/Lang/Maxima/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Phrase-reversals b/Lang/Maxima/Phrase-reversals new file mode 120000 index 0000000000..e9f3fbc16e --- /dev/null +++ b/Lang/Maxima/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Population-count b/Lang/Maxima/Population-count new file mode 120000 index 0000000000..ae8e574cce --- /dev/null +++ b/Lang/Maxima/Population-count @@ -0,0 +1 @@ +../../Task/Population-count/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Proper-divisors b/Lang/Maxima/Proper-divisors new file mode 120000 index 0000000000..d541bf6c4d --- /dev/null +++ b/Lang/Maxima/Proper-divisors @@ -0,0 +1 @@ +../../Task/Proper-divisors/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Pseudo-random-numbers-PCG32 b/Lang/Maxima/Pseudo-random-numbers-PCG32 new file mode 120000 index 0000000000..6feec056ab --- /dev/null +++ b/Lang/Maxima/Pseudo-random-numbers-PCG32 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-PCG32/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Pseudo-random-numbers-Splitmix64 b/Lang/Maxima/Pseudo-random-numbers-Splitmix64 new file mode 120000 index 0000000000..c67133774e --- /dev/null +++ b/Lang/Maxima/Pseudo-random-numbers-Splitmix64 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Splitmix64/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Pseudo-random-numbers-Xorshift-star b/Lang/Maxima/Pseudo-random-numbers-Xorshift-star new file mode 120000 index 0000000000..601269aa2d --- /dev/null +++ b/Lang/Maxima/Pseudo-random-numbers-Xorshift-star @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Xorshift-star/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Real-constants-and-functions b/Lang/Maxima/Real-constants-and-functions new file mode 120000 index 0000000000..5465f4ddf0 --- /dev/null +++ b/Lang/Maxima/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Regular-expressions b/Lang/Maxima/Regular-expressions new file mode 120000 index 0000000000..ad80bc2114 --- /dev/null +++ b/Lang/Maxima/Regular-expressions @@ -0,0 +1 @@ +../../Task/Regular-expressions/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Rename-a-file b/Lang/Maxima/Rename-a-file new file mode 120000 index 0000000000..875c72e05d --- /dev/null +++ b/Lang/Maxima/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Repeat b/Lang/Maxima/Repeat new file mode 120000 index 0000000000..69cf6bc4f0 --- /dev/null +++ b/Lang/Maxima/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Repunit-primes b/Lang/Maxima/Repunit-primes new file mode 120000 index 0000000000..fb23d38994 --- /dev/null +++ b/Lang/Maxima/Repunit-primes @@ -0,0 +1 @@ +../../Task/Repunit-primes/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Safe-primes-and-unsafe-primes b/Lang/Maxima/Safe-primes-and-unsafe-primes new file mode 120000 index 0000000000..3ba21ce950 --- /dev/null +++ b/Lang/Maxima/Safe-primes-and-unsafe-primes @@ -0,0 +1 @@ +../../Task/Safe-primes-and-unsafe-primes/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Sequence-of-primorial-primes b/Lang/Maxima/Sequence-of-primorial-primes new file mode 120000 index 0000000000..987ddfd5b4 --- /dev/null +++ b/Lang/Maxima/Sequence-of-primorial-primes @@ -0,0 +1 @@ +../../Task/Sequence-of-primorial-primes/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Sequence:-smallest-number-with-exactly-n-divisors b/Lang/Maxima/Sequence:-smallest-number-with-exactly-n-divisors new file mode 120000 index 0000000000..2edcd184a6 --- /dev/null +++ b/Lang/Maxima/Sequence:-smallest-number-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-with-exactly-n-divisors/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Shoelace-formula-for-polygonal-area b/Lang/Maxima/Shoelace-formula-for-polygonal-area new file mode 120000 index 0000000000..4b2db308ce --- /dev/null +++ b/Lang/Maxima/Shoelace-formula-for-polygonal-area @@ -0,0 +1 @@ +../../Task/Shoelace-formula-for-polygonal-area/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Sorting-algorithms-Counting-sort b/Lang/Maxima/Sorting-algorithms-Counting-sort new file mode 120000 index 0000000000..3b3f2f0c39 --- /dev/null +++ b/Lang/Maxima/Sorting-algorithms-Counting-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Counting-sort/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Sorting-algorithms-Stooge-sort b/Lang/Maxima/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..df60525c6e --- /dev/null +++ b/Lang/Maxima/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Statistics-Basic b/Lang/Maxima/Statistics-Basic new file mode 120000 index 0000000000..3aa4fcf62d --- /dev/null +++ b/Lang/Maxima/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Stirling-numbers-of-the-first-kind b/Lang/Maxima/Stirling-numbers-of-the-first-kind new file mode 120000 index 0000000000..00938d2052 --- /dev/null +++ b/Lang/Maxima/Stirling-numbers-of-the-first-kind @@ -0,0 +1 @@ +../../Task/Stirling-numbers-of-the-first-kind/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Stirling-numbers-of-the-second-kind b/Lang/Maxima/Stirling-numbers-of-the-second-kind new file mode 120000 index 0000000000..3b2dde9483 --- /dev/null +++ b/Lang/Maxima/Stirling-numbers-of-the-second-kind @@ -0,0 +1 @@ +../../Task/Stirling-numbers-of-the-second-kind/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Substring-Top-and-tail b/Lang/Maxima/Substring-Top-and-tail new file mode 120000 index 0000000000..6897859615 --- /dev/null +++ b/Lang/Maxima/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Summarize-primes b/Lang/Maxima/Summarize-primes new file mode 120000 index 0000000000..d202f40be0 --- /dev/null +++ b/Lang/Maxima/Summarize-primes @@ -0,0 +1 @@ +../../Task/Summarize-primes/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Superellipse b/Lang/Maxima/Superellipse new file mode 120000 index 0000000000..4ecd2801c8 --- /dev/null +++ b/Lang/Maxima/Superellipse @@ -0,0 +1 @@ +../../Task/Superellipse/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Tau-function b/Lang/Maxima/Tau-function new file mode 120000 index 0000000000..40243f7b1e --- /dev/null +++ b/Lang/Maxima/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Tau-number b/Lang/Maxima/Tau-number new file mode 120000 index 0000000000..053b7e480c --- /dev/null +++ b/Lang/Maxima/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Maxima \ No newline at end of file diff --git a/Lang/Maxima/The-Twelve-Days-of-Christmas b/Lang/Maxima/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..dd36e626f6 --- /dev/null +++ b/Lang/Maxima/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Topic-variable b/Lang/Maxima/Topic-variable new file mode 120000 index 0000000000..e2a8f808d7 --- /dev/null +++ b/Lang/Maxima/Topic-variable @@ -0,0 +1 @@ +../../Task/Topic-variable/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Towers-of-Hanoi b/Lang/Maxima/Towers-of-Hanoi new file mode 120000 index 0000000000..40963f2edb --- /dev/null +++ b/Lang/Maxima/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Unicode-variable-names b/Lang/Maxima/Unicode-variable-names new file mode 120000 index 0000000000..34b765c308 --- /dev/null +++ b/Lang/Maxima/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Variable-declaration-reset b/Lang/Maxima/Variable-declaration-reset new file mode 120000 index 0000000000..127cccc10e --- /dev/null +++ b/Lang/Maxima/Variable-declaration-reset @@ -0,0 +1 @@ +../../Task/Variable-declaration-reset/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Vector b/Lang/Maxima/Vector new file mode 120000 index 0000000000..8d6cbd46ca --- /dev/null +++ b/Lang/Maxima/Vector @@ -0,0 +1 @@ +../../Task/Vector/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Wagstaff-primes b/Lang/Maxima/Wagstaff-primes new file mode 120000 index 0000000000..f74c4ee3f2 --- /dev/null +++ b/Lang/Maxima/Wagstaff-primes @@ -0,0 +1 @@ +../../Task/Wagstaff-primes/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Wieferich-primes b/Lang/Maxima/Wieferich-primes new file mode 120000 index 0000000000..8ad2bd1a72 --- /dev/null +++ b/Lang/Maxima/Wieferich-primes @@ -0,0 +1 @@ +../../Task/Wieferich-primes/Maxima \ No newline at end of file diff --git a/Lang/Maxima/Wilson-primes-of-order-n b/Lang/Maxima/Wilson-primes-of-order-n new file mode 120000 index 0000000000..83b27ec734 --- /dev/null +++ b/Lang/Maxima/Wilson-primes-of-order-n @@ -0,0 +1 @@ +../../Task/Wilson-primes-of-order-n/Maxima \ No newline at end of file diff --git a/Lang/MelonBasic/Empty-program b/Lang/MelonBasic/Empty-program deleted file mode 120000 index 8fb3b62c73..0000000000 --- a/Lang/MelonBasic/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/MelonBasic \ No newline at end of file diff --git a/Lang/Mercury/Miller-Rabin-primality-test b/Lang/Mercury/Miller-Rabin-primality-test deleted file mode 120000 index 6022def69b..0000000000 --- a/Lang/Mercury/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Mercury \ No newline at end of file diff --git a/Lang/Mercury/Quaternion-type b/Lang/Mercury/Quaternion-type deleted file mode 120000 index 34fd045795..0000000000 --- a/Lang/Mercury/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Mercury \ No newline at end of file diff --git a/Lang/Mia/00-LANG.txt b/Lang/Mia/00-LANG.txt new file mode 100644 index 0000000000..c25a056976 --- /dev/null +++ b/Lang/Mia/00-LANG.txt @@ -0,0 +1 @@ +{{stub}}{{language|Ayrch}} \ No newline at end of file diff --git a/Lang/Mia/00-META.yaml b/Lang/Mia/00-META.yaml new file mode 100644 index 0000000000..5e501a39c7 --- /dev/null +++ b/Lang/Mia/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Mia diff --git a/Lang/Mia/Loops-While b/Lang/Mia/Loops-While new file mode 120000 index 0000000000..acad4e8591 --- /dev/null +++ b/Lang/Mia/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Mia \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/A+B b/Lang/Microsoft-Small-Basic/A+B new file mode 120000 index 0000000000..f3a4fe9f2e --- /dev/null +++ b/Lang/Microsoft-Small-Basic/A+B @@ -0,0 +1 @@ +../../Task/A+B/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/Array-length b/Lang/Microsoft-Small-Basic/Array-length new file mode 120000 index 0000000000..5cb5fd80e3 --- /dev/null +++ b/Lang/Microsoft-Small-Basic/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/Halt-and-catch-fire b/Lang/Microsoft-Small-Basic/Halt-and-catch-fire new file mode 120000 index 0000000000..85dd00fc29 --- /dev/null +++ b/Lang/Microsoft-Small-Basic/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/Hello-world-Graphical b/Lang/Microsoft-Small-Basic/Hello-world-Graphical new file mode 120000 index 0000000000..e9bfd8a7e0 --- /dev/null +++ b/Lang/Microsoft-Small-Basic/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/I-before-E-except-after-C b/Lang/Microsoft-Small-Basic/I-before-E-except-after-C new file mode 120000 index 0000000000..e009793925 --- /dev/null +++ b/Lang/Microsoft-Small-Basic/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/Jump-anywhere b/Lang/Microsoft-Small-Basic/Jump-anywhere new file mode 120000 index 0000000000..ef9c52343e --- /dev/null +++ b/Lang/Microsoft-Small-Basic/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/Program-termination b/Lang/Microsoft-Small-Basic/Program-termination new file mode 120000 index 0000000000..ecf78f2fdc --- /dev/null +++ b/Lang/Microsoft-Small-Basic/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/RPG-attributes-generator b/Lang/Microsoft-Small-Basic/RPG-attributes-generator new file mode 120000 index 0000000000..b4096f1ae1 --- /dev/null +++ b/Lang/Microsoft-Small-Basic/RPG-attributes-generator @@ -0,0 +1 @@ +../../Task/RPG-attributes-generator/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/Simple-windowed-application b/Lang/Microsoft-Small-Basic/Simple-windowed-application new file mode 120000 index 0000000000..372561cd34 --- /dev/null +++ b/Lang/Microsoft-Small-Basic/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/Substring b/Lang/Microsoft-Small-Basic/Substring new file mode 120000 index 0000000000..187fdf47c4 --- /dev/null +++ b/Lang/Microsoft-Small-Basic/Substring @@ -0,0 +1 @@ +../../Task/Substring/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/The-Name-Game b/Lang/Microsoft-Small-Basic/The-Name-Game new file mode 120000 index 0000000000..904bd0e9c8 --- /dev/null +++ b/Lang/Microsoft-Small-Basic/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/Transliterate-English-text-using-the-Greek-alphabet b/Lang/Microsoft-Small-Basic/Transliterate-English-text-using-the-Greek-alphabet new file mode 120000 index 0000000000..5d28e3f2bb --- /dev/null +++ b/Lang/Microsoft-Small-Basic/Transliterate-English-text-using-the-Greek-alphabet @@ -0,0 +1 @@ +../../Task/Transliterate-English-text-using-the-Greek-alphabet/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/Variables b/Lang/Microsoft-Small-Basic/Variables new file mode 120000 index 0000000000..3ad596872d --- /dev/null +++ b/Lang/Microsoft-Small-Basic/Variables @@ -0,0 +1 @@ +../../Task/Variables/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/Microsoft-Small-Basic/Window-creation b/Lang/Microsoft-Small-Basic/Window-creation new file mode 120000 index 0000000000..31935ba19c --- /dev/null +++ b/Lang/Microsoft-Small-Basic/Window-creation @@ -0,0 +1 @@ +../../Task/Window-creation/Microsoft-Small-Basic \ No newline at end of file diff --git a/Lang/MiniScript/00-LANG.txt b/Lang/MiniScript/00-LANG.txt index f8f2143953..5ef9c2bb3f 100644 --- a/Lang/MiniScript/00-LANG.txt +++ b/Lang/MiniScript/00-LANG.txt @@ -2,4 +2,7 @@ MiniScript is a high-level scripting language designed originally for embedding in other software (especially games). The first implementation was in C#. In 2019, a C++ implementation was added, and both versions were open-sourced on [https://github.com/JoeStrout/miniscript GitHub]. -More information can be found at [https://miniscript.org/ miniscript.org]. \ No newline at end of file +More information can be found at [https://miniscript.org/ miniscript.org]. + +==Todo== +* [[Tasks not implemented in MiniScript]] \ No newline at end of file diff --git a/Lang/MiniScript/15-puzzle-game b/Lang/MiniScript/15-puzzle-game new file mode 120000 index 0000000000..7e5c7af4af --- /dev/null +++ b/Lang/MiniScript/15-puzzle-game @@ -0,0 +1 @@ +../../Task/15-puzzle-game/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/4-rings-or-4-squares-puzzle b/Lang/MiniScript/4-rings-or-4-squares-puzzle new file mode 120000 index 0000000000..ced2ec47b4 --- /dev/null +++ b/Lang/MiniScript/4-rings-or-4-squares-puzzle @@ -0,0 +1 @@ +../../Task/4-rings-or-4-squares-puzzle/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Abelian-sandpile-model b/Lang/MiniScript/Abelian-sandpile-model new file mode 120000 index 0000000000..204b227af1 --- /dev/null +++ b/Lang/MiniScript/Abelian-sandpile-model @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Abundant-odd-numbers b/Lang/MiniScript/Abundant-odd-numbers new file mode 120000 index 0000000000..91bcaad5c3 --- /dev/null +++ b/Lang/MiniScript/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Accumulator-factory b/Lang/MiniScript/Accumulator-factory new file mode 120000 index 0000000000..1405ff6446 --- /dev/null +++ b/Lang/MiniScript/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Additive-primes b/Lang/MiniScript/Additive-primes new file mode 120000 index 0000000000..9b3b9e3623 --- /dev/null +++ b/Lang/MiniScript/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Align-columns b/Lang/MiniScript/Align-columns new file mode 120000 index 0000000000..bf15d9e815 --- /dev/null +++ b/Lang/MiniScript/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Almost-prime b/Lang/MiniScript/Almost-prime new file mode 120000 index 0000000000..b20040bcf6 --- /dev/null +++ b/Lang/MiniScript/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Anagrams b/Lang/MiniScript/Anagrams new file mode 120000 index 0000000000..fa29a4485e --- /dev/null +++ b/Lang/MiniScript/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Apply-a-callback-to-an-array b/Lang/MiniScript/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..9f2b7eb3c8 --- /dev/null +++ b/Lang/MiniScript/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Archimedean-spiral b/Lang/MiniScript/Archimedean-spiral new file mode 120000 index 0000000000..4f733ba176 --- /dev/null +++ b/Lang/MiniScript/Archimedean-spiral @@ -0,0 +1 @@ +../../Task/Archimedean-spiral/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Attractive-numbers b/Lang/MiniScript/Attractive-numbers new file mode 120000 index 0000000000..b4e1856e0e --- /dev/null +++ b/Lang/MiniScript/Attractive-numbers @@ -0,0 +1 @@ +../../Task/Attractive-numbers/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Averages-Mean-angle b/Lang/MiniScript/Averages-Mean-angle new file mode 120000 index 0000000000..d2713dd5a3 --- /dev/null +++ b/Lang/MiniScript/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Bitmap b/Lang/MiniScript/Bitmap new file mode 120000 index 0000000000..365ee5eb36 --- /dev/null +++ b/Lang/MiniScript/Bitmap @@ -0,0 +1 @@ +../../Task/Bitmap/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Bitmap-B-zier-curves-Cubic b/Lang/MiniScript/Bitmap-B-zier-curves-Cubic new file mode 120000 index 0000000000..f0e0eca06d --- /dev/null +++ b/Lang/MiniScript/Bitmap-B-zier-curves-Cubic @@ -0,0 +1 @@ +../../Task/Bitmap-B-zier-curves-Cubic/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Bitmap-B-zier-curves-Quadratic b/Lang/MiniScript/Bitmap-B-zier-curves-Quadratic new file mode 120000 index 0000000000..15d71b6d75 --- /dev/null +++ b/Lang/MiniScript/Bitmap-B-zier-curves-Quadratic @@ -0,0 +1 @@ +../../Task/Bitmap-B-zier-curves-Quadratic/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Bitmap-Bresenhams-line-algorithm b/Lang/MiniScript/Bitmap-Bresenhams-line-algorithm new file mode 120000 index 0000000000..f0f56f0d6e --- /dev/null +++ b/Lang/MiniScript/Bitmap-Bresenhams-line-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Bresenhams-line-algorithm/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Bitmap-Flood-fill b/Lang/MiniScript/Bitmap-Flood-fill new file mode 120000 index 0000000000..34c70cc53f --- /dev/null +++ b/Lang/MiniScript/Bitmap-Flood-fill @@ -0,0 +1 @@ +../../Task/Bitmap-Flood-fill/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/CUSIP b/Lang/MiniScript/CUSIP new file mode 120000 index 0000000000..23ab881a7b --- /dev/null +++ b/Lang/MiniScript/CUSIP @@ -0,0 +1 @@ +../../Task/CUSIP/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Cantor-set b/Lang/MiniScript/Cantor-set new file mode 120000 index 0000000000..de0a42ce52 --- /dev/null +++ b/Lang/MiniScript/Cantor-set @@ -0,0 +1 @@ +../../Task/Cantor-set/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Character-codes b/Lang/MiniScript/Character-codes new file mode 120000 index 0000000000..02f30676f2 --- /dev/null +++ b/Lang/MiniScript/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Comments b/Lang/MiniScript/Comments new file mode 120000 index 0000000000..6c2e69e82f --- /dev/null +++ b/Lang/MiniScript/Comments @@ -0,0 +1 @@ +../../Task/Comments/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Compare-length-of-two-strings b/Lang/MiniScript/Compare-length-of-two-strings new file mode 120000 index 0000000000..c99239d3fe --- /dev/null +++ b/Lang/MiniScript/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Count-in-factors b/Lang/MiniScript/Count-in-factors new file mode 120000 index 0000000000..7a0ecccaf4 --- /dev/null +++ b/Lang/MiniScript/Count-in-factors @@ -0,0 +1 @@ +../../Task/Count-in-factors/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Count-in-octal b/Lang/MiniScript/Count-in-octal new file mode 120000 index 0000000000..c68fe650dd --- /dev/null +++ b/Lang/MiniScript/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Currying b/Lang/MiniScript/Currying new file mode 120000 index 0000000000..5bfc81e5a2 --- /dev/null +++ b/Lang/MiniScript/Currying @@ -0,0 +1 @@ +../../Task/Currying/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Date-format b/Lang/MiniScript/Date-format new file mode 120000 index 0000000000..691dbe1508 --- /dev/null +++ b/Lang/MiniScript/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Date-manipulation b/Lang/MiniScript/Date-manipulation new file mode 120000 index 0000000000..53293214b7 --- /dev/null +++ b/Lang/MiniScript/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Day-of-the-week b/Lang/MiniScript/Day-of-the-week new file mode 120000 index 0000000000..1b556db413 --- /dev/null +++ b/Lang/MiniScript/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Department-numbers b/Lang/MiniScript/Department-numbers new file mode 120000 index 0000000000..6daa070f52 --- /dev/null +++ b/Lang/MiniScript/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Detect-division-by-zero b/Lang/MiniScript/Detect-division-by-zero new file mode 120000 index 0000000000..29baa515c8 --- /dev/null +++ b/Lang/MiniScript/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Digital-root b/Lang/MiniScript/Digital-root new file mode 120000 index 0000000000..05c86864b6 --- /dev/null +++ b/Lang/MiniScript/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Disarium-numbers b/Lang/MiniScript/Disarium-numbers new file mode 120000 index 0000000000..6059b2cae0 --- /dev/null +++ b/Lang/MiniScript/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Elementary-cellular-automaton b/Lang/MiniScript/Elementary-cellular-automaton new file mode 120000 index 0000000000..7a23621bbe --- /dev/null +++ b/Lang/MiniScript/Elementary-cellular-automaton @@ -0,0 +1 @@ +../../Task/Elementary-cellular-automaton/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Empty-program b/Lang/MiniScript/Empty-program deleted file mode 120000 index 60da45f9ae..0000000000 --- a/Lang/MiniScript/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Empty-string b/Lang/MiniScript/Empty-string new file mode 120000 index 0000000000..bbda7e56b2 --- /dev/null +++ b/Lang/MiniScript/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Exponentiation-operator b/Lang/MiniScript/Exponentiation-operator new file mode 120000 index 0000000000..25dcaee73f --- /dev/null +++ b/Lang/MiniScript/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Extreme-floating-point-values b/Lang/MiniScript/Extreme-floating-point-values new file mode 120000 index 0000000000..108b4683db --- /dev/null +++ b/Lang/MiniScript/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Fractal-tree b/Lang/MiniScript/Fractal-tree new file mode 120000 index 0000000000..55a8a26736 --- /dev/null +++ b/Lang/MiniScript/Fractal-tree @@ -0,0 +1 @@ +../../Task/Fractal-tree/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Grayscale-image b/Lang/MiniScript/Grayscale-image new file mode 120000 index 0000000000..5b0c8a08a0 --- /dev/null +++ b/Lang/MiniScript/Grayscale-image @@ -0,0 +1 @@ +../../Task/Grayscale-image/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Hailstone-sequence b/Lang/MiniScript/Hailstone-sequence new file mode 120000 index 0000000000..68089b892e --- /dev/null +++ b/Lang/MiniScript/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Haversine-formula b/Lang/MiniScript/Haversine-formula new file mode 120000 index 0000000000..0bba2877d8 --- /dev/null +++ b/Lang/MiniScript/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Hello-world-Graphical b/Lang/MiniScript/Hello-world-Graphical new file mode 120000 index 0000000000..1cbf28b019 --- /dev/null +++ b/Lang/MiniScript/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Hex-words b/Lang/MiniScript/Hex-words new file mode 120000 index 0000000000..5dbe9fd7cc --- /dev/null +++ b/Lang/MiniScript/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/ISBN13-check-digit b/Lang/MiniScript/ISBN13-check-digit new file mode 120000 index 0000000000..717a3cde6f --- /dev/null +++ b/Lang/MiniScript/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Image-noise b/Lang/MiniScript/Image-noise new file mode 120000 index 0000000000..1b1884e3d1 --- /dev/null +++ b/Lang/MiniScript/Image-noise @@ -0,0 +1 @@ +../../Task/Image-noise/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Longest-string-challenge b/Lang/MiniScript/Longest-string-challenge new file mode 120000 index 0000000000..04c596eef3 --- /dev/null +++ b/Lang/MiniScript/Longest-string-challenge @@ -0,0 +1 @@ +../../Task/Longest-string-challenge/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/MAC-vendor-lookup b/Lang/MiniScript/MAC-vendor-lookup new file mode 120000 index 0000000000..8111f80017 --- /dev/null +++ b/Lang/MiniScript/MAC-vendor-lookup @@ -0,0 +1 @@ +../../Task/MAC-vendor-lookup/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/McNuggets-problem b/Lang/MiniScript/McNuggets-problem new file mode 120000 index 0000000000..8d97a35c79 --- /dev/null +++ b/Lang/MiniScript/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/N-queens-problem b/Lang/MiniScript/N-queens-problem new file mode 120000 index 0000000000..56fe34197f --- /dev/null +++ b/Lang/MiniScript/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Order-by-pair-comparisons b/Lang/MiniScript/Order-by-pair-comparisons new file mode 120000 index 0000000000..0647767d0b --- /dev/null +++ b/Lang/MiniScript/Order-by-pair-comparisons @@ -0,0 +1 @@ +../../Task/Order-by-pair-comparisons/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Pi b/Lang/MiniScript/Pi new file mode 120000 index 0000000000..053fc0881f --- /dev/null +++ b/Lang/MiniScript/Pi @@ -0,0 +1 @@ +../../Task/Pi/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Read-a-file-line-by-line b/Lang/MiniScript/Read-a-file-line-by-line new file mode 120000 index 0000000000..7064fcf098 --- /dev/null +++ b/Lang/MiniScript/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors b/Lang/MiniScript/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors new file mode 120000 index 0000000000..e32d286342 --- /dev/null +++ b/Lang/MiniScript/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Sequence:-smallest-number-with-exactly-n-divisors b/Lang/MiniScript/Sequence:-smallest-number-with-exactly-n-divisors new file mode 120000 index 0000000000..d22e2a69ce --- /dev/null +++ b/Lang/MiniScript/Sequence:-smallest-number-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-with-exactly-n-divisors/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Singly-linked-list-Element-definition b/Lang/MiniScript/Singly-linked-list-Element-definition new file mode 120000 index 0000000000..2a87d3badd --- /dev/null +++ b/Lang/MiniScript/Singly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-definition/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Singly-linked-list-Element-insertion b/Lang/MiniScript/Singly-linked-list-Element-insertion new file mode 120000 index 0000000000..93fef166d0 --- /dev/null +++ b/Lang/MiniScript/Singly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-insertion/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Sleeping-Beauty-problem b/Lang/MiniScript/Sleeping-Beauty-problem new file mode 120000 index 0000000000..feb4e597cb --- /dev/null +++ b/Lang/MiniScript/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Solve-a-Hidato-puzzle b/Lang/MiniScript/Solve-a-Hidato-puzzle new file mode 120000 index 0000000000..88a97d21c2 --- /dev/null +++ b/Lang/MiniScript/Solve-a-Hidato-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hidato-puzzle/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Sort-disjoint-sublist b/Lang/MiniScript/Sort-disjoint-sublist new file mode 120000 index 0000000000..73ee8d9c24 --- /dev/null +++ b/Lang/MiniScript/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Sorting-algorithms-Gnome-sort b/Lang/MiniScript/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..1859916a86 --- /dev/null +++ b/Lang/MiniScript/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/String-append b/Lang/MiniScript/String-append new file mode 120000 index 0000000000..91d9564e08 --- /dev/null +++ b/Lang/MiniScript/String-append @@ -0,0 +1 @@ +../../Task/String-append/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Symmetric-difference b/Lang/MiniScript/Symmetric-difference new file mode 120000 index 0000000000..99a920ff15 --- /dev/null +++ b/Lang/MiniScript/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Tau-function b/Lang/MiniScript/Tau-function new file mode 120000 index 0000000000..afdfda353c --- /dev/null +++ b/Lang/MiniScript/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Tau-number b/Lang/MiniScript/Tau-number new file mode 120000 index 0000000000..989367f598 --- /dev/null +++ b/Lang/MiniScript/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Wireworld b/Lang/MiniScript/Wireworld new file mode 120000 index 0000000000..05734b25f6 --- /dev/null +++ b/Lang/MiniScript/Wireworld @@ -0,0 +1 @@ +../../Task/Wireworld/MiniScript \ No newline at end of file diff --git a/Lang/MiniScript/Zeckendorf-number-representation b/Lang/MiniScript/Zeckendorf-number-representation new file mode 120000 index 0000000000..35edc5020d --- /dev/null +++ b/Lang/MiniScript/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/MiniScript \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Abundant-deficient-and-perfect-number-classifications b/Lang/Minimal-BASIC/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..ca944f9e1d --- /dev/null +++ b/Lang/Minimal-BASIC/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Arithmetic-Integer b/Lang/Minimal-BASIC/Arithmetic-Integer new file mode 120000 index 0000000000..933ad3bc56 --- /dev/null +++ b/Lang/Minimal-BASIC/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Arithmetic-geometric-mean b/Lang/Minimal-BASIC/Arithmetic-geometric-mean new file mode 120000 index 0000000000..3a1459c995 --- /dev/null +++ b/Lang/Minimal-BASIC/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Array-concatenation b/Lang/Minimal-BASIC/Array-concatenation new file mode 120000 index 0000000000..b0d0134d77 --- /dev/null +++ b/Lang/Minimal-BASIC/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Create-a-two-dimensional-array-at-runtime b/Lang/Minimal-BASIC/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..39f2b4b6d1 --- /dev/null +++ b/Lang/Minimal-BASIC/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Egyptian-division b/Lang/Minimal-BASIC/Egyptian-division new file mode 120000 index 0000000000..f311f0e6bd --- /dev/null +++ b/Lang/Minimal-BASIC/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Evaluate-binomial-coefficients b/Lang/Minimal-BASIC/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..6ad0769264 --- /dev/null +++ b/Lang/Minimal-BASIC/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Find-limit-of-recursion b/Lang/Minimal-BASIC/Find-limit-of-recursion new file mode 120000 index 0000000000..9f4b00a477 --- /dev/null +++ b/Lang/Minimal-BASIC/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Jensens-Device b/Lang/Minimal-BASIC/Jensens-Device new file mode 120000 index 0000000000..f729ff931e --- /dev/null +++ b/Lang/Minimal-BASIC/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Knuth-shuffle b/Lang/Minimal-BASIC/Knuth-shuffle new file mode 120000 index 0000000000..3e28bb591e --- /dev/null +++ b/Lang/Minimal-BASIC/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Leonardo-numbers b/Lang/Minimal-BASIC/Leonardo-numbers new file mode 120000 index 0000000000..c45ebe1ebc --- /dev/null +++ b/Lang/Minimal-BASIC/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Loops-Infinite b/Lang/Minimal-BASIC/Loops-Infinite new file mode 120000 index 0000000000..a936b362aa --- /dev/null +++ b/Lang/Minimal-BASIC/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Monty-Hall-problem b/Lang/Minimal-BASIC/Monty-Hall-problem new file mode 120000 index 0000000000..e997b4d558 --- /dev/null +++ b/Lang/Minimal-BASIC/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Nim-game b/Lang/Minimal-BASIC/Nim-game new file mode 120000 index 0000000000..13af910758 --- /dev/null +++ b/Lang/Minimal-BASIC/Nim-game @@ -0,0 +1 @@ +../../Task/Nim-game/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Pancake-numbers b/Lang/Minimal-BASIC/Pancake-numbers new file mode 120000 index 0000000000..5141be0a11 --- /dev/null +++ b/Lang/Minimal-BASIC/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Recamans-sequence b/Lang/Minimal-BASIC/Recamans-sequence new file mode 120000 index 0000000000..51e560288e --- /dev/null +++ b/Lang/Minimal-BASIC/Recamans-sequence @@ -0,0 +1 @@ +../../Task/Recamans-sequence/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Repeat-a-string b/Lang/Minimal-BASIC/Repeat-a-string new file mode 120000 index 0000000000..cb9d6c7be2 --- /dev/null +++ b/Lang/Minimal-BASIC/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Sorting-algorithms-Gnome-sort b/Lang/Minimal-BASIC/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..7e0ae10f86 --- /dev/null +++ b/Lang/Minimal-BASIC/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/String-interpolation-included- b/Lang/Minimal-BASIC/String-interpolation-included- new file mode 120000 index 0000000000..7def120cfb --- /dev/null +++ b/Lang/Minimal-BASIC/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Sum-of-a-series b/Lang/Minimal-BASIC/Sum-of-a-series new file mode 120000 index 0000000000..b515c8004d --- /dev/null +++ b/Lang/Minimal-BASIC/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Minimal-BASIC/Tau-number b/Lang/Minimal-BASIC/Tau-number new file mode 120000 index 0000000000..53ace6bddb --- /dev/null +++ b/Lang/Minimal-BASIC/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Minimal-BASIC \ No newline at end of file diff --git a/Lang/Miranda/Additive-primes b/Lang/Miranda/Additive-primes new file mode 120000 index 0000000000..10e6d71efa --- /dev/null +++ b/Lang/Miranda/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Align-columns b/Lang/Miranda/Align-columns new file mode 120000 index 0000000000..ca88577a8d --- /dev/null +++ b/Lang/Miranda/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Arithmetic-derivative b/Lang/Miranda/Arithmetic-derivative new file mode 120000 index 0000000000..91683ddf96 --- /dev/null +++ b/Lang/Miranda/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Bell-numbers b/Lang/Miranda/Bell-numbers new file mode 120000 index 0000000000..6635e596b0 --- /dev/null +++ b/Lang/Miranda/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Combinations b/Lang/Miranda/Combinations new file mode 120000 index 0000000000..b252f73176 --- /dev/null +++ b/Lang/Miranda/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Display-a-linear-combination b/Lang/Miranda/Display-a-linear-combination new file mode 120000 index 0000000000..38a961bb6a --- /dev/null +++ b/Lang/Miranda/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Doomsday-rule b/Lang/Miranda/Doomsday-rule new file mode 120000 index 0000000000..91e25767d0 --- /dev/null +++ b/Lang/Miranda/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Execute-Brain- b/Lang/Miranda/Execute-Brain- new file mode 120000 index 0000000000..e3f7d58819 --- /dev/null +++ b/Lang/Miranda/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Floyds-triangle b/Lang/Miranda/Floyds-triangle new file mode 120000 index 0000000000..785a87da3e --- /dev/null +++ b/Lang/Miranda/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Fractran b/Lang/Miranda/Fractran new file mode 120000 index 0000000000..528ab3ee2e --- /dev/null +++ b/Lang/Miranda/Fractran @@ -0,0 +1 @@ +../../Task/Fractran/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Hailstone-sequence b/Lang/Miranda/Hailstone-sequence new file mode 120000 index 0000000000..1f03fbb737 --- /dev/null +++ b/Lang/Miranda/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Miranda \ No newline at end of file diff --git a/Lang/Miranda/ISBN13-check-digit b/Lang/Miranda/ISBN13-check-digit new file mode 120000 index 0000000000..faa39470eb --- /dev/null +++ b/Lang/Miranda/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Isqrt-integer-square-root-of-X b/Lang/Miranda/Isqrt-integer-square-root-of-X new file mode 120000 index 0000000000..4b479d99e5 --- /dev/null +++ b/Lang/Miranda/Isqrt-integer-square-root-of-X @@ -0,0 +1 @@ +../../Task/Isqrt-integer-square-root-of-X/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Leonardo-numbers b/Lang/Miranda/Leonardo-numbers new file mode 120000 index 0000000000..6f062a014a --- /dev/null +++ b/Lang/Miranda/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Loops-Infinite b/Lang/Miranda/Loops-Infinite new file mode 120000 index 0000000000..8845df4b78 --- /dev/null +++ b/Lang/Miranda/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Modular-exponentiation b/Lang/Miranda/Modular-exponentiation new file mode 120000 index 0000000000..876dc45d07 --- /dev/null +++ b/Lang/Miranda/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Move-to-front-algorithm b/Lang/Miranda/Move-to-front-algorithm new file mode 120000 index 0000000000..ed5becbabe --- /dev/null +++ b/Lang/Miranda/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Mutual-recursion b/Lang/Miranda/Mutual-recursion new file mode 120000 index 0000000000..42af709518 --- /dev/null +++ b/Lang/Miranda/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Old-lady-swallowed-a-fly b/Lang/Miranda/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..91f1f84abb --- /dev/null +++ b/Lang/Miranda/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Partition-an-integer-x-into-n-primes b/Lang/Miranda/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..0d73af13aa --- /dev/null +++ b/Lang/Miranda/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Run-length-encoding b/Lang/Miranda/Run-length-encoding new file mode 120000 index 0000000000..e0fd07015b --- /dev/null +++ b/Lang/Miranda/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Sudan-function b/Lang/Miranda/Sudan-function new file mode 120000 index 0000000000..30973d5427 --- /dev/null +++ b/Lang/Miranda/Sudan-function @@ -0,0 +1 @@ +../../Task/Sudan-function/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Super-d-numbers b/Lang/Miranda/Super-d-numbers new file mode 120000 index 0000000000..d99b0c174b --- /dev/null +++ b/Lang/Miranda/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/Miranda \ No newline at end of file diff --git a/Lang/Miranda/Zeckendorf-number-representation b/Lang/Miranda/Zeckendorf-number-representation new file mode 120000 index 0000000000..8a316c3af1 --- /dev/null +++ b/Lang/Miranda/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/Miranda \ No newline at end of file diff --git a/Lang/Mn/00-LANG.txt b/Lang/Mn/00-LANG.txt new file mode 100644 index 0000000000..0fd90d2c3a --- /dev/null +++ b/Lang/Mn/00-LANG.txt @@ -0,0 +1,7 @@ +{{stub}}{{language|mn}} +mn is a minimalistic, concatenative, functional stack language. It is a very simple subset of [[min]]. + +==Links== +*[https://h3rald.com/mn/Mn_DeveloperGuide.htm Learn mn] + +{{Language programming paradigm|Concatenative}} \ No newline at end of file diff --git a/Lang/Mn/00-META.yaml b/Lang/Mn/00-META.yaml new file mode 100644 index 0000000000..f79f1602c3 --- /dev/null +++ b/Lang/Mn/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Mn diff --git a/Lang/Mn/Factorial b/Lang/Mn/Factorial new file mode 120000 index 0000000000..4c7a3c3b43 --- /dev/null +++ b/Lang/Mn/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Mn \ No newline at end of file diff --git a/Lang/Mn/Loops-While b/Lang/Mn/Loops-While new file mode 120000 index 0000000000..9e10aebd40 --- /dev/null +++ b/Lang/Mn/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Mn \ No newline at end of file diff --git a/Lang/Modula-2/00-LANG.txt b/Lang/Modula-2/00-LANG.txt index 854aa29a1a..62faf6e14c 100644 --- a/Lang/Modula-2/00-LANG.txt +++ b/Lang/Modula-2/00-LANG.txt @@ -26,4 +26,11 @@ Modula-2 was designed by Niklaus Wirth at ETH Zurich as a systems implementation * [http://sourceforge.net/projects/schwarzerkaffee Schwarzer Kaffee] ==Modula-2 on IRC== -* [irc://irc.freenode.net/#modula-2 irc://irc.freenode.net/#modula-2] \ No newline at end of file +* [irc://irc.freenode.net/#modula-2 irc://irc.freenode.net/#modula-2] + +===See also=== +* [[Modula-3]] +* [[Oberon-07]] +* [[Oberon-2]] +* [[Component Pascal]] +* [[Zonnon]] \ No newline at end of file diff --git a/Lang/Modula-2/AKS-test-for-primes b/Lang/Modula-2/AKS-test-for-primes new file mode 120000 index 0000000000..f86ed2a172 --- /dev/null +++ b/Lang/Modula-2/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Abundant-odd-numbers b/Lang/Modula-2/Abundant-odd-numbers new file mode 120000 index 0000000000..acae176170 --- /dev/null +++ b/Lang/Modula-2/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Arithmetic-numbers b/Lang/Modula-2/Arithmetic-numbers new file mode 120000 index 0000000000..6485d976dc --- /dev/null +++ b/Lang/Modula-2/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Cistercian-numerals b/Lang/Modula-2/Cistercian-numerals new file mode 120000 index 0000000000..5da4e51fc7 --- /dev/null +++ b/Lang/Modula-2/Cistercian-numerals @@ -0,0 +1 @@ +../../Task/Cistercian-numerals/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Cumulative-standard-deviation b/Lang/Modula-2/Cumulative-standard-deviation new file mode 120000 index 0000000000..49f430ac8e --- /dev/null +++ b/Lang/Modula-2/Cumulative-standard-deviation @@ -0,0 +1 @@ +../../Task/Cumulative-standard-deviation/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Day-of-the-week b/Lang/Modula-2/Day-of-the-week new file mode 120000 index 0000000000..626da93e5e --- /dev/null +++ b/Lang/Modula-2/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Diversity-prediction-theorem b/Lang/Modula-2/Diversity-prediction-theorem new file mode 120000 index 0000000000..c351696cc1 --- /dev/null +++ b/Lang/Modula-2/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Dutch-national-flag-problem b/Lang/Modula-2/Dutch-national-flag-problem new file mode 120000 index 0000000000..b6400fd8d9 --- /dev/null +++ b/Lang/Modula-2/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Equilibrium-index b/Lang/Modula-2/Equilibrium-index new file mode 120000 index 0000000000..434b864e3f --- /dev/null +++ b/Lang/Modula-2/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Factors-of-an-integer b/Lang/Modula-2/Factors-of-an-integer new file mode 120000 index 0000000000..19271a7965 --- /dev/null +++ b/Lang/Modula-2/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Gamma-function b/Lang/Modula-2/Gamma-function new file mode 120000 index 0000000000..f14cc894e2 --- /dev/null +++ b/Lang/Modula-2/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Generate-lower-case-ASCII-alphabet b/Lang/Modula-2/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..94aba1f8a9 --- /dev/null +++ b/Lang/Modula-2/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Gray-code b/Lang/Modula-2/Gray-code new file mode 120000 index 0000000000..8cb45ff695 --- /dev/null +++ b/Lang/Modula-2/Gray-code @@ -0,0 +1 @@ +../../Task/Gray-code/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Luhn-test-of-credit-card-numbers b/Lang/Modula-2/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..7ff802d85c --- /dev/null +++ b/Lang/Modula-2/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/M-bius-function b/Lang/Modula-2/M-bius-function new file mode 120000 index 0000000000..e2d4a4a9b1 --- /dev/null +++ b/Lang/Modula-2/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Magic-constant b/Lang/Modula-2/Magic-constant new file mode 120000 index 0000000000..d6cf44baf4 --- /dev/null +++ b/Lang/Modula-2/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Map-range b/Lang/Modula-2/Map-range new file mode 120000 index 0000000000..d2da488e09 --- /dev/null +++ b/Lang/Modula-2/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Mayan-numerals b/Lang/Modula-2/Mayan-numerals new file mode 120000 index 0000000000..68f34cbb07 --- /dev/null +++ b/Lang/Modula-2/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Monty-Hall-problem b/Lang/Modula-2/Monty-Hall-problem new file mode 120000 index 0000000000..9ad6c8767a --- /dev/null +++ b/Lang/Modula-2/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Multifactorial b/Lang/Modula-2/Multifactorial new file mode 120000 index 0000000000..ba5a38f5d3 --- /dev/null +++ b/Lang/Modula-2/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Nth-root b/Lang/Modula-2/Nth-root new file mode 120000 index 0000000000..0efaa69472 --- /dev/null +++ b/Lang/Modula-2/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Periodic-table b/Lang/Modula-2/Periodic-table new file mode 120000 index 0000000000..20953bda9a --- /dev/null +++ b/Lang/Modula-2/Periodic-table @@ -0,0 +1 @@ +../../Task/Periodic-table/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Primality-by-Wilsons-theorem b/Lang/Modula-2/Primality-by-Wilsons-theorem new file mode 120000 index 0000000000..4d1359d549 --- /dev/null +++ b/Lang/Modula-2/Primality-by-Wilsons-theorem @@ -0,0 +1 @@ +../../Task/Primality-by-Wilsons-theorem/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Ramer-Douglas-Peucker-line-simplification b/Lang/Modula-2/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..ff583aca48 --- /dev/null +++ b/Lang/Modula-2/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Semiprime b/Lang/Modula-2/Semiprime new file mode 120000 index 0000000000..108e390f08 --- /dev/null +++ b/Lang/Modula-2/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Temperature-conversion b/Lang/Modula-2/Temperature-conversion new file mode 120000 index 0000000000..fa236503d3 --- /dev/null +++ b/Lang/Modula-2/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Tic-tac-toe b/Lang/Modula-2/Tic-tac-toe new file mode 120000 index 0000000000..21b0370c7a --- /dev/null +++ b/Lang/Modula-2/Tic-tac-toe @@ -0,0 +1 @@ +../../Task/Tic-tac-toe/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-2/Zeckendorf-number-representation b/Lang/Modula-2/Zeckendorf-number-representation new file mode 120000 index 0000000000..bbadf943ec --- /dev/null +++ b/Lang/Modula-2/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/Modula-2 \ No newline at end of file diff --git a/Lang/Modula-3/00-LANG.txt b/Lang/Modula-3/00-LANG.txt index 582f870540..aaa0f4b8bf 100644 --- a/Lang/Modula-3/00-LANG.txt +++ b/Lang/Modula-3/00-LANG.txt @@ -21,4 +21,11 @@ Its main implementation is [[Critical Mass Modula-3]]. Modula-3 influenced a few languages such as [[C Sharp|C#]], [[Java]], [[Ocaml]] and [[Python]]. ==Links== -* [http://en.wikipedia.org/wiki/Modula-3 Modula-3 at Wikipedia] \ No newline at end of file +* [http://en.wikipedia.org/wiki/Modula-3 Modula-3 at Wikipedia] + +===See also=== +* [[Modula-2]] +* [[Oberon-07]] +* [[Oberon-2]] +* [[Component Pascal]] +* [[Zonnon]] \ No newline at end of file diff --git a/Lang/Modula-3/Additive-primes b/Lang/Modula-3/Additive-primes new file mode 120000 index 0000000000..b81b571c35 --- /dev/null +++ b/Lang/Modula-3/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/Modula-3 \ No newline at end of file diff --git a/Lang/Modula-3/Comments b/Lang/Modula-3/Comments deleted file mode 120000 index 8c3489c305..0000000000 --- a/Lang/Modula-3/Comments +++ /dev/null @@ -1 +0,0 @@ -../../Task/Comments/Modula-3 \ No newline at end of file diff --git a/Lang/Modula-3/Pascals-triangle b/Lang/Modula-3/Pascals-triangle new file mode 120000 index 0000000000..093a7901c2 --- /dev/null +++ b/Lang/Modula-3/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/Modula-3 \ No newline at end of file diff --git a/Lang/Mojo/Hamming-numbers b/Lang/Mojo/Hamming-numbers new file mode 120000 index 0000000000..a401baa2d8 --- /dev/null +++ b/Lang/Mojo/Hamming-numbers @@ -0,0 +1 @@ +../../Task/Hamming-numbers/Mojo \ No newline at end of file diff --git a/Lang/Mojo/Hunt-the-Wumpus b/Lang/Mojo/Hunt-the-Wumpus new file mode 120000 index 0000000000..a79c86df71 --- /dev/null +++ b/Lang/Mojo/Hunt-the-Wumpus @@ -0,0 +1 @@ +../../Task/Hunt-the-Wumpus/Mojo \ No newline at end of file diff --git a/Lang/Mojo/Legendre-prime-counting-function b/Lang/Mojo/Legendre-prime-counting-function new file mode 120000 index 0000000000..c7d7f4e32f --- /dev/null +++ b/Lang/Mojo/Legendre-prime-counting-function @@ -0,0 +1 @@ +../../Task/Legendre-prime-counting-function/Mojo \ No newline at end of file diff --git a/Lang/Mojo/Sieve-of-Eratosthenes b/Lang/Mojo/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..c8eb3cd500 --- /dev/null +++ b/Lang/Mojo/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/Mojo \ No newline at end of file diff --git a/Lang/MoonBit/00-LANG.txt b/Lang/MoonBit/00-LANG.txt new file mode 100644 index 0000000000..cf5345dc27 --- /dev/null +++ b/Lang/MoonBit/00-LANG.txt @@ -0,0 +1,13 @@ +{{language|MoonBit +|exec=bytecode +|safety=safe +|strength=strong +|gc=yes +|site=https://www.moonbitlang.com/} +}} +'''MoonBit''' is a general-purpose programming language and toolchain designed for high performance and resource efficiency, optimized for WebAssembly (Wasm). It is developed by a young and passionate team led by Zhang Hongbo. One of the motivations behind MoonBit’s creation was Zhang’s belief that existing languages like Java, Go, and Rust do not fully leverage the security and speed advantages of the WebAssembly instruction set, particularly in cloud computing and edge computing. After its initial release with native WebAssembly support, MoonBit later added support for JavaScript, Native, and the LLVM backend. + +MoonBit was publicly released in August 2023 and is currently in its beta stage. + +==Todo== +* [[Tasks not implemented in MoonBit]] \ No newline at end of file diff --git a/Lang/MoonBit/00-META.yaml b/Lang/MoonBit/00-META.yaml new file mode 100644 index 0000000000..97e1356190 --- /dev/null +++ b/Lang/MoonBit/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:MoonBit diff --git a/Lang/MoonBit/Array-length b/Lang/MoonBit/Array-length new file mode 120000 index 0000000000..4a5666710a --- /dev/null +++ b/Lang/MoonBit/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/MoonBit \ No newline at end of file diff --git a/Lang/MoonBit/Hello-world-Text b/Lang/MoonBit/Hello-world-Text new file mode 120000 index 0000000000..f3db6f7a6c --- /dev/null +++ b/Lang/MoonBit/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/MoonBit \ No newline at end of file diff --git a/Lang/MoonRock/00-LANG.txt b/Lang/MoonRock/00-LANG.txt new file mode 100644 index 0000000000..dcba29adb9 --- /dev/null +++ b/Lang/MoonRock/00-LANG.txt @@ -0,0 +1,68 @@ +{{language|MoonRock +|exec=machine +|site=http://www.rowan.sensation.net.au/moonrock.html}} +{{language programming paradigm|Imperative}} +{{implementation|BASIC}} +'''MoonRock''' is a compiler for a [[BASIC]]-like programming language, developed by Rowan Crowe. Released for [[MS-DOS]] and compatible systems, MoonRock enables compilation to assembly language and linking to COM executable files. The compiler is known for producing exceptionally concise executables; for example, a "[[Hello world|Hello, World!]]" program can be compiled into a COM file as small as 276 bytes. + +MoonRock is a programming language specifically designed to facilitate the creation of programs that can be easily translated into assembly language. This design choice emphasizes simplicity and direct mapping to low-level operations, making it particularly suitable for environments where performance and control over hardware are critical. The language's syntax and features are structured to align closely with assembly language constructs while benefiting from some higher-level abstractions provided by BASIC. + +== MoonRock Version 0.50 == +=== Program Structure === +The definitions of arrays must be included within the BEGIN DEF section of the program. + +=== Control Structures === +The ''[[Loops/For|for]]'' loop requires that both the start and end values be variables, constants, or literals; expressions are not permitted. The language does not implement a ''[[Loops/Do-while|repeat-until]]'' loop. + +=== Arithmetic Operations === +MoonRock 0.50 does not support [[Floating point|floating-point numbers]] and operations. Division using the / operator produces rounded [[Arithmetic/Integer|integer]] results. For integer division, the \ operator must be used. For example: + +A% = 1 / 3 +PRINT A% + "\n" +A% = 2 / 3 +PRINT A% + "\n" +A% = 3 / 3 +PRINT A% + "\n" + +produces the output: +
    +0
    +1
    +1
    +
    +The MOD function is not implemented for 32-bit integers (doublewords). + +=== Comparison Operations === +Both operands in comparison operations must be literals, constants, or variables; expressions are not allowed. Only variables of the same type can be compared. Attempting to compare variables of different types, such as A& > B%, may produce incorrect results. + +=== Output === +To output the value of a named constant, it must be passed as an argument to the STR function: + +PRINT "Up to " + STR(%MaxNumber) + "\n" + +Formatted output is not supported. Users may create custom subroutines as a workaround, such as: + +SUB PrintStr(S$, Width%) + IF LEN(S$) > Width% THEN + PRINT S$ + ELSE + S$ = SPACE(Width%) + S$ + PRINT RIGHT(S$, Width%) + ENDIF +END SUB + + +=== Abnormal Behaviors === +The manual states: ''Keywords are shown in all upper case to aid readability. They may be of any case in the source code''. However, some statements function solely when written in lowercase. For example, the statement: + +if A@ = 0 then print B% + " " + +operates correctly only when if and then are in lowercase. Conversely, the following formulation works regardless of case: + +IF A@ = 0 THEN + PRINT B% + " " +ENDIF + + +== External links == +* [https://github.com/DosWorld/moonrock MoonRock on GitHub] \ No newline at end of file diff --git a/Lang/MoonRock/00-META.yaml b/Lang/MoonRock/00-META.yaml new file mode 100644 index 0000000000..8869a57523 --- /dev/null +++ b/Lang/MoonRock/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:MoonRock diff --git a/Lang/MoonRock/100-doors b/Lang/MoonRock/100-doors new file mode 120000 index 0000000000..35643d2a2f --- /dev/null +++ b/Lang/MoonRock/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/MoonRock \ No newline at end of file diff --git a/Lang/MoonRock/Abundant-deficient-and-perfect-number-classifications b/Lang/MoonRock/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..5a720f6808 --- /dev/null +++ b/Lang/MoonRock/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/MoonRock \ No newline at end of file diff --git a/Lang/MoonRock/Bell-numbers b/Lang/MoonRock/Bell-numbers new file mode 120000 index 0000000000..1519c89b24 --- /dev/null +++ b/Lang/MoonRock/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/MoonRock \ No newline at end of file diff --git a/Lang/MoonRock/Day-of-the-week b/Lang/MoonRock/Day-of-the-week new file mode 120000 index 0000000000..3423abb3da --- /dev/null +++ b/Lang/MoonRock/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/MoonRock \ No newline at end of file diff --git a/Lang/MoonRock/Ethiopian-multiplication b/Lang/MoonRock/Ethiopian-multiplication new file mode 120000 index 0000000000..99b728ad22 --- /dev/null +++ b/Lang/MoonRock/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/MoonRock \ No newline at end of file diff --git a/Lang/MoonRock/Factors-of-an-integer b/Lang/MoonRock/Factors-of-an-integer new file mode 120000 index 0000000000..9cb6716a51 --- /dev/null +++ b/Lang/MoonRock/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/MoonRock \ No newline at end of file diff --git a/Lang/MoonRock/Fibonacci-sequence b/Lang/MoonRock/Fibonacci-sequence new file mode 120000 index 0000000000..633e95692a --- /dev/null +++ b/Lang/MoonRock/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/MoonRock \ No newline at end of file diff --git a/Lang/MoonRock/Josephus-problem b/Lang/MoonRock/Josephus-problem new file mode 120000 index 0000000000..1084916ce4 --- /dev/null +++ b/Lang/MoonRock/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/MoonRock \ No newline at end of file diff --git a/Lang/MoonRock/Leap-year b/Lang/MoonRock/Leap-year new file mode 120000 index 0000000000..5ab049d315 --- /dev/null +++ b/Lang/MoonRock/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/MoonRock \ No newline at end of file diff --git a/Lang/MoonRock/Long-year b/Lang/MoonRock/Long-year new file mode 120000 index 0000000000..cc090c489a --- /dev/null +++ b/Lang/MoonRock/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/MoonRock \ No newline at end of file diff --git a/Lang/MoonRock/Semiprime b/Lang/MoonRock/Semiprime new file mode 120000 index 0000000000..9c66936bd7 --- /dev/null +++ b/Lang/MoonRock/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/MoonRock \ No newline at end of file diff --git a/Lang/MySQL/00-LANG.txt b/Lang/MySQL/00-LANG.txt index 9f2e3a69fb..bf94001666 100644 --- a/Lang/MySQL/00-LANG.txt +++ b/Lang/MySQL/00-LANG.txt @@ -1,9 +1,9 @@ {{language}} '''MySQL''' is a multithreaded, multi-user, SQL Database Management System (DBMS) with more than six million installations. -'''MySQL''' is owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, which holds the copyright to most of the codebase. This is similar to the JBoss model and how the Free Software Foundation handles copyright in its projects, and dissimilar to how the Apache project does it, where the software is developed by a public community, and the copyright to the codebase is owned by its individual authors. +'''MySQL''' is owned and sponsored by a single for-profit firm, Oracle, which holds the copyright to most of the codebase. This is similar to the JBoss model and how the Free Software Foundation handles copyright in its projects, and dissimilar to how the Apache project does it, where the software is developed by a public community, and the copyright to the codebase is owned by its individual authors. -The company develops and maintains the system, selling support and service contracts, as well as proprietary-licensed copies of MySQL, and employing people all over the world who collaborate via the Internet. MySQL AB was founded by David Axmark, Allan Larsson, and Michael "Monty" Widenius. +The company develops and maintains the system, selling support and service contracts, as well as a cloud variant called HeatWave (part of Oracle Cloud), proprietary-licensed copies of MySQL, and employing people all over the world who collaborate via the Internet. MySQL AB was founded by David Axmark, Allan Larsson, and Michael "Monty" Widenius. ==Citations== * [http://en.wikipedia.org/wiki/Mysql Wikipedia:MySQL] diff --git a/Lang/NS-HUBASIC/Empty-program b/Lang/NS-HUBASIC/Empty-program deleted file mode 120000 index 8edcb8591a..0000000000 --- a/Lang/NS-HUBASIC/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/NS-HUBASIC \ No newline at end of file diff --git a/Lang/Nascom-BASIC/Damm-algorithm b/Lang/Nascom-BASIC/Damm-algorithm new file mode 120000 index 0000000000..5a6439a18c --- /dev/null +++ b/Lang/Nascom-BASIC/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/Nascom-BASIC \ No newline at end of file diff --git a/Lang/Nascom-BASIC/Dragon-curve b/Lang/Nascom-BASIC/Dragon-curve new file mode 120000 index 0000000000..36b4172957 --- /dev/null +++ b/Lang/Nascom-BASIC/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/Nascom-BASIC \ No newline at end of file diff --git a/Lang/Nascom-BASIC/Langtons-ant b/Lang/Nascom-BASIC/Langtons-ant new file mode 120000 index 0000000000..d0fdcffe2f --- /dev/null +++ b/Lang/Nascom-BASIC/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/Nascom-BASIC \ No newline at end of file diff --git a/Lang/Nascom-BASIC/Levenshtein-distance b/Lang/Nascom-BASIC/Levenshtein-distance new file mode 120000 index 0000000000..c821e59923 --- /dev/null +++ b/Lang/Nascom-BASIC/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Nascom-BASIC \ No newline at end of file diff --git a/Lang/Nascom-BASIC/Luhn-test-of-credit-card-numbers b/Lang/Nascom-BASIC/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..1d7e8b0698 --- /dev/null +++ b/Lang/Nascom-BASIC/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Nascom-BASIC \ No newline at end of file diff --git a/Lang/Nascom-BASIC/Mayan-numerals b/Lang/Nascom-BASIC/Mayan-numerals new file mode 120000 index 0000000000..d2108ce9fa --- /dev/null +++ b/Lang/Nascom-BASIC/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/Nascom-BASIC \ No newline at end of file diff --git a/Lang/Nascom-BASIC/Old-Russian-measure-of-length b/Lang/Nascom-BASIC/Old-Russian-measure-of-length new file mode 120000 index 0000000000..73ef2957e7 --- /dev/null +++ b/Lang/Nascom-BASIC/Old-Russian-measure-of-length @@ -0,0 +1 @@ +../../Task/Old-Russian-measure-of-length/Nascom-BASIC \ No newline at end of file diff --git a/Lang/NetRexx/00-LANG.txt b/Lang/NetRexx/00-LANG.txt index f110c9bdb8..3f624ad431 100644 --- a/Lang/NetRexx/00-LANG.txt +++ b/Lang/NetRexx/00-LANG.txt @@ -29,7 +29,7 @@ as languages such as Java, while preserving the low threshold to learning and th On the 8th of June 2011, IBM transferred ownership of the reference implementation of NetRexx to The Rexx Language Association (RexxLA) for administration under the [http://site.icu-project.org ICU - International Components for Unicode] open source license. -On September 12th 2022, NetRexx 4.04 was released +On March 3rd, 2024, NetRexx 4.06-GA was released. ==== Useful Links ==== * [http://www.netrexx.org The NetRexx Programming Language - www.netrexx.org] diff --git a/Lang/NetRexx/Haversine-formula b/Lang/NetRexx/Haversine-formula new file mode 120000 index 0000000000..bbcbbd8775 --- /dev/null +++ b/Lang/NetRexx/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/NetRexx \ No newline at end of file diff --git a/Lang/NewLISP/Abbreviations-simple b/Lang/NewLISP/Abbreviations-simple new file mode 120000 index 0000000000..ec4184c6a2 --- /dev/null +++ b/Lang/NewLISP/Abbreviations-simple @@ -0,0 +1 @@ +../../Task/Abbreviations-simple/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Ascending-primes b/Lang/NewLISP/Ascending-primes new file mode 120000 index 0000000000..68daf13118 --- /dev/null +++ b/Lang/NewLISP/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Associative-array-Merging b/Lang/NewLISP/Associative-array-Merging new file mode 120000 index 0000000000..8ebd2e6646 --- /dev/null +++ b/Lang/NewLISP/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Cartesian-product-of-two-or-more-lists b/Lang/NewLISP/Cartesian-product-of-two-or-more-lists new file mode 120000 index 0000000000..4a3b5275b2 --- /dev/null +++ b/Lang/NewLISP/Cartesian-product-of-two-or-more-lists @@ -0,0 +1 @@ +../../Task/Cartesian-product-of-two-or-more-lists/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Compare-a-list-of-strings b/Lang/NewLISP/Compare-a-list-of-strings new file mode 120000 index 0000000000..9b0eddc19c --- /dev/null +++ b/Lang/NewLISP/Compare-a-list-of-strings @@ -0,0 +1 @@ +../../Task/Compare-a-list-of-strings/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Department-numbers b/Lang/NewLISP/Department-numbers new file mode 120000 index 0000000000..17043dfb0a --- /dev/null +++ b/Lang/NewLISP/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Dinesmans-multiple-dwelling-problem b/Lang/NewLISP/Dinesmans-multiple-dwelling-problem new file mode 120000 index 0000000000..0b5efae41b --- /dev/null +++ b/Lang/NewLISP/Dinesmans-multiple-dwelling-problem @@ -0,0 +1 @@ +../../Task/Dinesmans-multiple-dwelling-problem/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Find-Chess960-starting-position-identifier b/Lang/NewLISP/Find-Chess960-starting-position-identifier new file mode 120000 index 0000000000..772e0d75d4 --- /dev/null +++ b/Lang/NewLISP/Find-Chess960-starting-position-identifier @@ -0,0 +1 @@ +../../Task/Find-Chess960-starting-position-identifier/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Loops-With-multiple-ranges b/Lang/NewLISP/Loops-With-multiple-ranges new file mode 120000 index 0000000000..ef48847607 --- /dev/null +++ b/Lang/NewLISP/Loops-With-multiple-ranges @@ -0,0 +1 @@ +../../Task/Loops-With-multiple-ranges/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Matrix-multiplication b/Lang/NewLISP/Matrix-multiplication new file mode 120000 index 0000000000..0badc9299f --- /dev/null +++ b/Lang/NewLISP/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Multisplit b/Lang/NewLISP/Multisplit new file mode 120000 index 0000000000..1bb5fea36e --- /dev/null +++ b/Lang/NewLISP/Multisplit @@ -0,0 +1 @@ +../../Task/Multisplit/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Range-consolidation b/Lang/NewLISP/Range-consolidation new file mode 120000 index 0000000000..15f7beee34 --- /dev/null +++ b/Lang/NewLISP/Range-consolidation @@ -0,0 +1 @@ +../../Task/Range-consolidation/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Range-expansion b/Lang/NewLISP/Range-expansion new file mode 120000 index 0000000000..8f2d253805 --- /dev/null +++ b/Lang/NewLISP/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Run-length-encoding b/Lang/NewLISP/Run-length-encoding new file mode 120000 index 0000000000..91cae97224 --- /dev/null +++ b/Lang/NewLISP/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Set-consolidation b/Lang/NewLISP/Set-consolidation new file mode 120000 index 0000000000..9d4d20d448 --- /dev/null +++ b/Lang/NewLISP/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Sorting-algorithms-Permutation-sort b/Lang/NewLISP/Sorting-algorithms-Permutation-sort new file mode 120000 index 0000000000..a14257af91 --- /dev/null +++ b/Lang/NewLISP/Sorting-algorithms-Permutation-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Permutation-sort/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Split-a-character-string-based-on-change-of-character b/Lang/NewLISP/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..5af27e593c --- /dev/null +++ b/Lang/NewLISP/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Text-processing-1 b/Lang/NewLISP/Text-processing-1 new file mode 120000 index 0000000000..39b0cd8b87 --- /dev/null +++ b/Lang/NewLISP/Text-processing-1 @@ -0,0 +1 @@ +../../Task/Text-processing-1/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Text-processing-Max-licenses-in-use b/Lang/NewLISP/Text-processing-Max-licenses-in-use new file mode 120000 index 0000000000..fca40fd641 --- /dev/null +++ b/Lang/NewLISP/Text-processing-Max-licenses-in-use @@ -0,0 +1 @@ +../../Task/Text-processing-Max-licenses-in-use/NewLISP \ No newline at end of file diff --git a/Lang/NewLISP/Truncatable-primes b/Lang/NewLISP/Truncatable-primes new file mode 120000 index 0000000000..52cd8db47d --- /dev/null +++ b/Lang/NewLISP/Truncatable-primes @@ -0,0 +1 @@ +../../Task/Truncatable-primes/NewLISP \ No newline at end of file diff --git a/Lang/Nial/00-LANG.txt b/Lang/Nial/00-LANG.txt index 9cd63d0ab0..74f94af84f 100644 --- a/Lang/Nial/00-LANG.txt +++ b/Lang/Nial/00-LANG.txt @@ -1,8 +1,8 @@ {{language|Nial |strength=strong |checking=dynamic -|site=http://www.nial.com/ +|site=https://www.nial-array-language.org/ |LCT=yes}}'''Nial''' (Nested interactive programming language) is an array programming language similar to [[APL]] and its successor [[J]]. ==References== -* [[wp:Nial|Wikipedia:Nial]] \ No newline at end of file +* [[Wikipedia:Nial]] \ No newline at end of file diff --git a/Lang/Nickle/00-LANG.txt b/Lang/Nickle/00-LANG.txt index 53bb3afeae..e2643c2540 100644 --- a/Lang/Nickle/00-LANG.txt +++ b/Lang/Nickle/00-LANG.txt @@ -19,7 +19,7 @@ Other datatypes include multi-dimensional arrays, strings, structures, tagged un The reference implementation includes an interactive top level with byte code compilation before evaluation. Example: -/* Arrays to JSON */ +/* Arrays to JSON */ autoimport JSON; int [*] d = {1,2,3}; poly [*] p = {1, "abc", 42}; @@ -39,7 +39,8 @@ print f; for (int i = 0; i < dim(p); i++) { printf("%v ", p[i]); } -printf("\n"); +printf("\n"); +
    {{out}}
    prompt$ nickle sampler.5c
    diff --git a/Lang/Night/00-LANG.txt b/Lang/Night/00-LANG.txt
    index 354df37388..00f4c7cc7f 100644
    --- a/Lang/Night/00-LANG.txt
    +++ b/Lang/Night/00-LANG.txt
    @@ -1,4 +1,4 @@
    -{{language|Night}}
    +{{language|Night|checking=dynamic}}
     
     '''Night''' is an interpreted language that focuses on simplicity and usability. The main goal of Night is to design an intuitive and safe language. It's dynamically typed and semi-weak.
     
    diff --git a/Lang/Nim/Bioinformatics-base-count b/Lang/Nim/Bioinformatics-base-count
    deleted file mode 120000
    index 14fcd687ff..0000000000
    --- a/Lang/Nim/Bioinformatics-base-count
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Bioinformatics-base-count/Nim
    \ No newline at end of file
    diff --git a/Lang/Nim/Meissel-Mertens-constant b/Lang/Nim/Meissel-Mertens-constant
    deleted file mode 120000
    index 760c7d7443..0000000000
    --- a/Lang/Nim/Meissel-Mertens-constant
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Meissel-Mertens-constant/Nim
    \ No newline at end of file
    diff --git a/Lang/Nim/Miller-Rabin-primality-test b/Lang/Nim/Miller-Rabin-primality-test
    deleted file mode 120000
    index 1ce4ac13f6..0000000000
    --- a/Lang/Nim/Miller-Rabin-primality-test
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Miller-Rabin-primality-test/Nim
    \ No newline at end of file
    diff --git a/Lang/Nim/Quaternion-type b/Lang/Nim/Quaternion-type
    deleted file mode 120000
    index 384e273bfc..0000000000
    --- a/Lang/Nim/Quaternion-type
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Quaternion-type/Nim
    \ No newline at end of file
    diff --git a/Lang/Nim/Sorting-Algorithms-Circle-Sort b/Lang/Nim/Sorting-Algorithms-Circle-Sort
    deleted file mode 120000
    index 80141c2866..0000000000
    --- a/Lang/Nim/Sorting-Algorithms-Circle-Sort
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Sorting-Algorithms-Circle-Sort/Nim
    \ No newline at end of file
    diff --git a/Lang/Nom/00-LANG.txt b/Lang/Nom/00-LANG.txt
    new file mode 100644
    index 0000000000..596e8bc965
    --- /dev/null
    +++ b/Lang/Nom/00-LANG.txt
    @@ -0,0 +1,18 @@
    +{{language|Nom}}
    +
    +Nom is an interpreted and also compiling (via the translation scripts)
    +language. Documentation for ''Nom'' can be found at [www.nomlang.org] along
    +with the downloadable [http://nomlang.org/download implementation]. 
    +All the source code is also hosted in [https://sourceforge.net sourceforge] 
    +at https://bumble.sf.net/books/pars/
    +
    +Nom is based on the PEP (''Parsing Engine for Patterns'') virtual machine, 
    +which is a text-based virtual machine. The PEP virtual machine is 
    +documented at [http://nomlang.org/doc/machine/]. Nom was first ''conceived'' 
    +around about 2005 but a good working implementation (the 
    +[https://bumble.sf.net/books/pars/object/pep.c pep] interpreter) was not 
    +achieved until approximately 2019. 
    +
    +Nom is, I believe a new approach to recognising/parsing/transforming/transpiling/compiling context-free languages
    +since it uses the same standard Unix-style approach of a ''text-stream-filter''
    +as with tools like ''sed'' or ''awk''.
    \ No newline at end of file
    diff --git a/Lang/Nom/00-META.yaml b/Lang/Nom/00-META.yaml
    new file mode 100644
    index 0000000000..347649abaa
    --- /dev/null
    +++ b/Lang/Nom/00-META.yaml
    @@ -0,0 +1,2 @@
    +---
    +from: http://rosettacode.org/wiki/Category:Nom
    diff --git a/Lang/Nom/Balanced-brackets b/Lang/Nom/Balanced-brackets
    new file mode 120000
    index 0000000000..53c6847c48
    --- /dev/null
    +++ b/Lang/Nom/Balanced-brackets
    @@ -0,0 +1 @@
    +../../Task/Balanced-brackets/Nom
    \ No newline at end of file
    diff --git a/Lang/Nom/CSV-to-HTML-translation b/Lang/Nom/CSV-to-HTML-translation
    new file mode 120000
    index 0000000000..efc535b187
    --- /dev/null
    +++ b/Lang/Nom/CSV-to-HTML-translation
    @@ -0,0 +1 @@
    +../../Task/CSV-to-HTML-translation/Nom
    \ No newline at end of file
    diff --git a/Lang/Nom/Determine-if-a-string-is-numeric b/Lang/Nom/Determine-if-a-string-is-numeric
    new file mode 120000
    index 0000000000..dc0b5a67ea
    --- /dev/null
    +++ b/Lang/Nom/Determine-if-a-string-is-numeric
    @@ -0,0 +1 @@
    +../../Task/Determine-if-a-string-is-numeric/Nom
    \ No newline at end of file
    diff --git a/Lang/Nom/Empty-string b/Lang/Nom/Empty-string
    new file mode 120000
    index 0000000000..e51cf14c29
    --- /dev/null
    +++ b/Lang/Nom/Empty-string
    @@ -0,0 +1 @@
    +../../Task/Empty-string/Nom
    \ No newline at end of file
    diff --git a/Lang/Nom/Even-or-odd b/Lang/Nom/Even-or-odd
    new file mode 120000
    index 0000000000..a93a39c338
    --- /dev/null
    +++ b/Lang/Nom/Even-or-odd
    @@ -0,0 +1 @@
    +../../Task/Even-or-odd/Nom
    \ No newline at end of file
    diff --git a/Lang/Nom/Hello-world-Text b/Lang/Nom/Hello-world-Text
    new file mode 120000
    index 0000000000..6575bd7149
    --- /dev/null
    +++ b/Lang/Nom/Hello-world-Text
    @@ -0,0 +1 @@
    +../../Task/Hello-world-Text/Nom
    \ No newline at end of file
    diff --git a/Lang/Nom/Input-loop b/Lang/Nom/Input-loop
    new file mode 120000
    index 0000000000..c687c9a3a9
    --- /dev/null
    +++ b/Lang/Nom/Input-loop
    @@ -0,0 +1 @@
    +../../Task/Input-loop/Nom
    \ No newline at end of file
    diff --git a/Lang/Nom/Odd-word-problem b/Lang/Nom/Odd-word-problem
    new file mode 120000
    index 0000000000..43979a4bb7
    --- /dev/null
    +++ b/Lang/Nom/Odd-word-problem
    @@ -0,0 +1 @@
    +../../Task/Odd-word-problem/Nom
    \ No newline at end of file
    diff --git a/Lang/Nom/Reverse-a-string b/Lang/Nom/Reverse-a-string
    new file mode 120000
    index 0000000000..38692d6625
    --- /dev/null
    +++ b/Lang/Nom/Reverse-a-string
    @@ -0,0 +1 @@
    +../../Task/Reverse-a-string/Nom
    \ No newline at end of file
    diff --git a/Lang/Nu/00-LANG.txt b/Lang/Nu/00-LANG.txt
    new file mode 100644
    index 0000000000..4a1eea655e
    --- /dev/null
    +++ b/Lang/Nu/00-LANG.txt
    @@ -0,0 +1,5 @@
    +{{stub}}
    +{{language|Nu|site=https://www.nushell.sh|tags=nu}}
    +{{Language programming paradigm|Functional}}
    +
    +Nu is the programming language used by Nushell.
    \ No newline at end of file
    diff --git a/Lang/Nu/00-META.yaml b/Lang/Nu/00-META.yaml
    new file mode 100644
    index 0000000000..99859066fe
    --- /dev/null
    +++ b/Lang/Nu/00-META.yaml
    @@ -0,0 +1,2 @@
    +---
    +from: http://rosettacode.org/wiki/Category:Nu
    diff --git a/Lang/Nu/A+B b/Lang/Nu/A+B
    new file mode 120000
    index 0000000000..2da442f92b
    --- /dev/null
    +++ b/Lang/Nu/A+B
    @@ -0,0 +1 @@
    +../../Task/A+B/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Arithmetic-Integer b/Lang/Nu/Arithmetic-Integer
    new file mode 120000
    index 0000000000..204092ead0
    --- /dev/null
    +++ b/Lang/Nu/Arithmetic-Integer
    @@ -0,0 +1 @@
    +../../Task/Arithmetic-Integer/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Array-concatenation b/Lang/Nu/Array-concatenation
    new file mode 120000
    index 0000000000..d98932d8bd
    --- /dev/null
    +++ b/Lang/Nu/Array-concatenation
    @@ -0,0 +1 @@
    +../../Task/Array-concatenation/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Array-length b/Lang/Nu/Array-length
    new file mode 120000
    index 0000000000..5ea0b71e21
    --- /dev/null
    +++ b/Lang/Nu/Array-length
    @@ -0,0 +1 @@
    +../../Task/Array-length/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Arrays b/Lang/Nu/Arrays
    new file mode 120000
    index 0000000000..b71f014ca8
    --- /dev/null
    +++ b/Lang/Nu/Arrays
    @@ -0,0 +1 @@
    +../../Task/Arrays/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Associative-array-Merging b/Lang/Nu/Associative-array-Merging
    new file mode 120000
    index 0000000000..7f423eb251
    --- /dev/null
    +++ b/Lang/Nu/Associative-array-Merging
    @@ -0,0 +1 @@
    +../../Task/Associative-array-Merging/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Averages-Arithmetic-mean b/Lang/Nu/Averages-Arithmetic-mean
    new file mode 120000
    index 0000000000..21a1e77aec
    --- /dev/null
    +++ b/Lang/Nu/Averages-Arithmetic-mean
    @@ -0,0 +1 @@
    +../../Task/Averages-Arithmetic-mean/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Averages-Median b/Lang/Nu/Averages-Median
    new file mode 120000
    index 0000000000..8b1a3ddc2c
    --- /dev/null
    +++ b/Lang/Nu/Averages-Median
    @@ -0,0 +1 @@
    +../../Task/Averages-Median/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Averages-Mode b/Lang/Nu/Averages-Mode
    new file mode 120000
    index 0000000000..bb3150600b
    --- /dev/null
    +++ b/Lang/Nu/Averages-Mode
    @@ -0,0 +1 @@
    +../../Task/Averages-Mode/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Averages-Pythagorean-means b/Lang/Nu/Averages-Pythagorean-means
    new file mode 120000
    index 0000000000..02b10a7b5e
    --- /dev/null
    +++ b/Lang/Nu/Averages-Pythagorean-means
    @@ -0,0 +1 @@
    +../../Task/Averages-Pythagorean-means/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Averages-Root-mean-square b/Lang/Nu/Averages-Root-mean-square
    new file mode 120000
    index 0000000000..ed92d8f206
    --- /dev/null
    +++ b/Lang/Nu/Averages-Root-mean-square
    @@ -0,0 +1 @@
    +../../Task/Averages-Root-mean-square/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Balanced-brackets b/Lang/Nu/Balanced-brackets
    new file mode 120000
    index 0000000000..020bbe6f49
    --- /dev/null
    +++ b/Lang/Nu/Balanced-brackets
    @@ -0,0 +1 @@
    +../../Task/Balanced-brackets/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Base64-decode-data b/Lang/Nu/Base64-decode-data
    new file mode 120000
    index 0000000000..3620ff6de5
    --- /dev/null
    +++ b/Lang/Nu/Base64-decode-data
    @@ -0,0 +1 @@
    +../../Task/Base64-decode-data/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Binary-digits b/Lang/Nu/Binary-digits
    new file mode 120000
    index 0000000000..cbbd7fb698
    --- /dev/null
    +++ b/Lang/Nu/Binary-digits
    @@ -0,0 +1 @@
    +../../Task/Binary-digits/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/CSV-data-manipulation b/Lang/Nu/CSV-data-manipulation
    new file mode 120000
    index 0000000000..212f9d037c
    --- /dev/null
    +++ b/Lang/Nu/CSV-data-manipulation
    @@ -0,0 +1 @@
    +../../Task/CSV-data-manipulation/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Calculating-the-value-of-e b/Lang/Nu/Calculating-the-value-of-e
    new file mode 120000
    index 0000000000..60dd80e1f7
    --- /dev/null
    +++ b/Lang/Nu/Calculating-the-value-of-e
    @@ -0,0 +1 @@
    +../../Task/Calculating-the-value-of-e/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Check-input-device-is-a-terminal b/Lang/Nu/Check-input-device-is-a-terminal
    new file mode 120000
    index 0000000000..2c12886796
    --- /dev/null
    +++ b/Lang/Nu/Check-input-device-is-a-terminal
    @@ -0,0 +1 @@
    +../../Task/Check-input-device-is-a-terminal/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Check-output-device-is-a-terminal b/Lang/Nu/Check-output-device-is-a-terminal
    new file mode 120000
    index 0000000000..8ac81dc9fd
    --- /dev/null
    +++ b/Lang/Nu/Check-output-device-is-a-terminal
    @@ -0,0 +1 @@
    +../../Task/Check-output-device-is-a-terminal/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Check-that-file-exists b/Lang/Nu/Check-that-file-exists
    new file mode 120000
    index 0000000000..aa750c153c
    --- /dev/null
    +++ b/Lang/Nu/Check-that-file-exists
    @@ -0,0 +1 @@
    +../../Task/Check-that-file-exists/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Comma-quibbling b/Lang/Nu/Comma-quibbling
    new file mode 120000
    index 0000000000..6196295075
    --- /dev/null
    +++ b/Lang/Nu/Comma-quibbling
    @@ -0,0 +1 @@
    +../../Task/Comma-quibbling/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Command-line-arguments b/Lang/Nu/Command-line-arguments
    new file mode 120000
    index 0000000000..a50eb1100a
    --- /dev/null
    +++ b/Lang/Nu/Command-line-arguments
    @@ -0,0 +1 @@
    +../../Task/Command-line-arguments/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Count-in-octal b/Lang/Nu/Count-in-octal
    new file mode 120000
    index 0000000000..b2bc3a9f84
    --- /dev/null
    +++ b/Lang/Nu/Count-in-octal
    @@ -0,0 +1 @@
    +../../Task/Count-in-octal/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Count-occurrences-of-a-substring b/Lang/Nu/Count-occurrences-of-a-substring
    new file mode 120000
    index 0000000000..1a4f958e67
    --- /dev/null
    +++ b/Lang/Nu/Count-occurrences-of-a-substring
    @@ -0,0 +1 @@
    +../../Task/Count-occurrences-of-a-substring/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Date-format b/Lang/Nu/Date-format
    new file mode 120000
    index 0000000000..b99fcd9487
    --- /dev/null
    +++ b/Lang/Nu/Date-format
    @@ -0,0 +1 @@
    +../../Task/Date-format/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Day-of-the-week b/Lang/Nu/Day-of-the-week
    new file mode 120000
    index 0000000000..628ae77cde
    --- /dev/null
    +++ b/Lang/Nu/Day-of-the-week
    @@ -0,0 +1 @@
    +../../Task/Day-of-the-week/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Department-numbers b/Lang/Nu/Department-numbers
    new file mode 120000
    index 0000000000..bb0cfc31a5
    --- /dev/null
    +++ b/Lang/Nu/Department-numbers
    @@ -0,0 +1 @@
    +../../Task/Department-numbers/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Determine-if-a-string-has-all-the-same-characters b/Lang/Nu/Determine-if-a-string-has-all-the-same-characters
    new file mode 120000
    index 0000000000..1b0a4160eb
    --- /dev/null
    +++ b/Lang/Nu/Determine-if-a-string-has-all-the-same-characters
    @@ -0,0 +1 @@
    +../../Task/Determine-if-a-string-has-all-the-same-characters/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Determine-if-a-string-is-numeric b/Lang/Nu/Determine-if-a-string-is-numeric
    new file mode 120000
    index 0000000000..aad071997f
    --- /dev/null
    +++ b/Lang/Nu/Determine-if-a-string-is-numeric
    @@ -0,0 +1 @@
    +../../Task/Determine-if-a-string-is-numeric/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Dot-product b/Lang/Nu/Dot-product
    new file mode 120000
    index 0000000000..98aeabb740
    --- /dev/null
    +++ b/Lang/Nu/Dot-product
    @@ -0,0 +1 @@
    +../../Task/Dot-product/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Entropy b/Lang/Nu/Entropy
    new file mode 120000
    index 0000000000..5bed68a8b8
    --- /dev/null
    +++ b/Lang/Nu/Entropy
    @@ -0,0 +1 @@
    +../../Task/Entropy/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Environment-variables b/Lang/Nu/Environment-variables
    new file mode 120000
    index 0000000000..8271af8fa1
    --- /dev/null
    +++ b/Lang/Nu/Environment-variables
    @@ -0,0 +1 @@
    +../../Task/Environment-variables/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Even-or-odd b/Lang/Nu/Even-or-odd
    new file mode 120000
    index 0000000000..7bc71663d2
    --- /dev/null
    +++ b/Lang/Nu/Even-or-odd
    @@ -0,0 +1 @@
    +../../Task/Even-or-odd/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Factorial b/Lang/Nu/Factorial
    new file mode 120000
    index 0000000000..9cddb3254b
    --- /dev/null
    +++ b/Lang/Nu/Factorial
    @@ -0,0 +1 @@
    +../../Task/Factorial/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Factors-of-an-integer b/Lang/Nu/Factors-of-an-integer
    new file mode 120000
    index 0000000000..5aa37c904e
    --- /dev/null
    +++ b/Lang/Nu/Factors-of-an-integer
    @@ -0,0 +1 @@
    +../../Task/Factors-of-an-integer/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Fibonacci-sequence b/Lang/Nu/Fibonacci-sequence
    new file mode 120000
    index 0000000000..c835014e2a
    --- /dev/null
    +++ b/Lang/Nu/Fibonacci-sequence
    @@ -0,0 +1 @@
    +../../Task/Fibonacci-sequence/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/File-extension-is-in-extensions-list b/Lang/Nu/File-extension-is-in-extensions-list
    new file mode 120000
    index 0000000000..ee608b6863
    --- /dev/null
    +++ b/Lang/Nu/File-extension-is-in-extensions-list
    @@ -0,0 +1 @@
    +../../Task/File-extension-is-in-extensions-list/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/File-input-output b/Lang/Nu/File-input-output
    new file mode 120000
    index 0000000000..9cf58198ab
    --- /dev/null
    +++ b/Lang/Nu/File-input-output
    @@ -0,0 +1 @@
    +../../Task/File-input-output/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/File-size b/Lang/Nu/File-size
    new file mode 120000
    index 0000000000..14db7aa8d0
    --- /dev/null
    +++ b/Lang/Nu/File-size
    @@ -0,0 +1 @@
    +../../Task/File-size/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/File-size-distribution b/Lang/Nu/File-size-distribution
    new file mode 120000
    index 0000000000..2ee98ba338
    --- /dev/null
    +++ b/Lang/Nu/File-size-distribution
    @@ -0,0 +1 @@
    +../../Task/File-size-distribution/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Find-limit-of-recursion b/Lang/Nu/Find-limit-of-recursion
    new file mode 120000
    index 0000000000..c6b78c9274
    --- /dev/null
    +++ b/Lang/Nu/Find-limit-of-recursion
    @@ -0,0 +1 @@
    +../../Task/Find-limit-of-recursion/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Find-the-last-Sunday-of-each-month b/Lang/Nu/Find-the-last-Sunday-of-each-month
    new file mode 120000
    index 0000000000..7d0aedf546
    --- /dev/null
    +++ b/Lang/Nu/Find-the-last-Sunday-of-each-month
    @@ -0,0 +1 @@
    +../../Task/Find-the-last-Sunday-of-each-month/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/FizzBuzz b/Lang/Nu/FizzBuzz
    new file mode 120000
    index 0000000000..2aded0e368
    --- /dev/null
    +++ b/Lang/Nu/FizzBuzz
    @@ -0,0 +1 @@
    +../../Task/FizzBuzz/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Generate-lower-case-ASCII-alphabet b/Lang/Nu/Generate-lower-case-ASCII-alphabet
    new file mode 120000
    index 0000000000..2680ace5a7
    --- /dev/null
    +++ b/Lang/Nu/Generate-lower-case-ASCII-alphabet
    @@ -0,0 +1 @@
    +../../Task/Generate-lower-case-ASCII-alphabet/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Greatest-common-divisor b/Lang/Nu/Greatest-common-divisor
    new file mode 120000
    index 0000000000..d844f147ad
    --- /dev/null
    +++ b/Lang/Nu/Greatest-common-divisor
    @@ -0,0 +1 @@
    +../../Task/Greatest-common-divisor/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Greatest-element-of-a-list b/Lang/Nu/Greatest-element-of-a-list
    new file mode 120000
    index 0000000000..3b8838db94
    --- /dev/null
    +++ b/Lang/Nu/Greatest-element-of-a-list
    @@ -0,0 +1 @@
    +../../Task/Greatest-element-of-a-list/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Harshad-or-Niven-series b/Lang/Nu/Harshad-or-Niven-series
    new file mode 120000
    index 0000000000..87dd3a6ea5
    --- /dev/null
    +++ b/Lang/Nu/Harshad-or-Niven-series
    @@ -0,0 +1 @@
    +../../Task/Harshad-or-Niven-series/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Hello-world-Newline-omission b/Lang/Nu/Hello-world-Newline-omission
    new file mode 120000
    index 0000000000..f00be9e5a7
    --- /dev/null
    +++ b/Lang/Nu/Hello-world-Newline-omission
    @@ -0,0 +1 @@
    +../../Task/Hello-world-Newline-omission/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Hello-world-Standard-error b/Lang/Nu/Hello-world-Standard-error
    new file mode 120000
    index 0000000000..717c79f030
    --- /dev/null
    +++ b/Lang/Nu/Hello-world-Standard-error
    @@ -0,0 +1 @@
    +../../Task/Hello-world-Standard-error/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Hello-world-Text b/Lang/Nu/Hello-world-Text
    new file mode 120000
    index 0000000000..10d5ca7e00
    --- /dev/null
    +++ b/Lang/Nu/Hello-world-Text
    @@ -0,0 +1 @@
    +../../Task/Hello-world-Text/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Hex-words b/Lang/Nu/Hex-words
    new file mode 120000
    index 0000000000..14f92faeab
    --- /dev/null
    +++ b/Lang/Nu/Hex-words
    @@ -0,0 +1 @@
    +../../Task/Hex-words/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/I-before-E-except-after-C b/Lang/Nu/I-before-E-except-after-C
    new file mode 120000
    index 0000000000..3f6ace8c86
    --- /dev/null
    +++ b/Lang/Nu/I-before-E-except-after-C
    @@ -0,0 +1 @@
    +../../Task/I-before-E-except-after-C/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Identity-matrix b/Lang/Nu/Identity-matrix
    new file mode 120000
    index 0000000000..31adec2ac4
    --- /dev/null
    +++ b/Lang/Nu/Identity-matrix
    @@ -0,0 +1 @@
    +../../Task/Identity-matrix/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Integer-comparison b/Lang/Nu/Integer-comparison
    new file mode 120000
    index 0000000000..c2dbb46482
    --- /dev/null
    +++ b/Lang/Nu/Integer-comparison
    @@ -0,0 +1 @@
    +../../Task/Integer-comparison/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Integer-sequence b/Lang/Nu/Integer-sequence
    new file mode 120000
    index 0000000000..32270a6fb8
    --- /dev/null
    +++ b/Lang/Nu/Integer-sequence
    @@ -0,0 +1 @@
    +../../Task/Integer-sequence/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Jewels-and-stones b/Lang/Nu/Jewels-and-stones
    new file mode 120000
    index 0000000000..31ec593a67
    --- /dev/null
    +++ b/Lang/Nu/Jewels-and-stones
    @@ -0,0 +1 @@
    +../../Task/Jewels-and-stones/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Last-Friday-of-each-month b/Lang/Nu/Last-Friday-of-each-month
    new file mode 120000
    index 0000000000..6075ef1dcc
    --- /dev/null
    +++ b/Lang/Nu/Last-Friday-of-each-month
    @@ -0,0 +1 @@
    +../../Task/Last-Friday-of-each-month/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Letter-frequency b/Lang/Nu/Letter-frequency
    new file mode 120000
    index 0000000000..0b7cf31f44
    --- /dev/null
    +++ b/Lang/Nu/Letter-frequency
    @@ -0,0 +1 @@
    +../../Task/Letter-frequency/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Levenshtein-distance b/Lang/Nu/Levenshtein-distance
    new file mode 120000
    index 0000000000..f8c80b6b68
    --- /dev/null
    +++ b/Lang/Nu/Levenshtein-distance
    @@ -0,0 +1 @@
    +../../Task/Levenshtein-distance/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Logical-operations b/Lang/Nu/Logical-operations
    new file mode 120000
    index 0000000000..5b1ef33928
    --- /dev/null
    +++ b/Lang/Nu/Logical-operations
    @@ -0,0 +1 @@
    +../../Task/Logical-operations/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Loops-Break b/Lang/Nu/Loops-Break
    new file mode 120000
    index 0000000000..77e2ff157e
    --- /dev/null
    +++ b/Lang/Nu/Loops-Break
    @@ -0,0 +1 @@
    +../../Task/Loops-Break/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Loops-Continue b/Lang/Nu/Loops-Continue
    new file mode 120000
    index 0000000000..1fffd67d1b
    --- /dev/null
    +++ b/Lang/Nu/Loops-Continue
    @@ -0,0 +1 @@
    +../../Task/Loops-Continue/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Loops-Do-while b/Lang/Nu/Loops-Do-while
    new file mode 120000
    index 0000000000..c59b6e9c00
    --- /dev/null
    +++ b/Lang/Nu/Loops-Do-while
    @@ -0,0 +1 @@
    +../../Task/Loops-Do-while/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Loops-Downward-for b/Lang/Nu/Loops-Downward-for
    new file mode 120000
    index 0000000000..6e96da6bb0
    --- /dev/null
    +++ b/Lang/Nu/Loops-Downward-for
    @@ -0,0 +1 @@
    +../../Task/Loops-Downward-for/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Loops-For b/Lang/Nu/Loops-For
    new file mode 120000
    index 0000000000..2429f461c7
    --- /dev/null
    +++ b/Lang/Nu/Loops-For
    @@ -0,0 +1 @@
    +../../Task/Loops-For/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Loops-For-with-a-specified-step b/Lang/Nu/Loops-For-with-a-specified-step
    new file mode 120000
    index 0000000000..7ec15c7851
    --- /dev/null
    +++ b/Lang/Nu/Loops-For-with-a-specified-step
    @@ -0,0 +1 @@
    +../../Task/Loops-For-with-a-specified-step/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Loops-Foreach b/Lang/Nu/Loops-Foreach
    new file mode 120000
    index 0000000000..05555142ae
    --- /dev/null
    +++ b/Lang/Nu/Loops-Foreach
    @@ -0,0 +1 @@
    +../../Task/Loops-Foreach/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Loops-Infinite b/Lang/Nu/Loops-Infinite
    new file mode 120000
    index 0000000000..4557475615
    --- /dev/null
    +++ b/Lang/Nu/Loops-Infinite
    @@ -0,0 +1 @@
    +../../Task/Loops-Infinite/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Loops-N-plus-one-half b/Lang/Nu/Loops-N-plus-one-half
    new file mode 120000
    index 0000000000..cce81b7894
    --- /dev/null
    +++ b/Lang/Nu/Loops-N-plus-one-half
    @@ -0,0 +1 @@
    +../../Task/Loops-N-plus-one-half/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/MAC-vendor-lookup b/Lang/Nu/MAC-vendor-lookup
    new file mode 120000
    index 0000000000..93a1e321d8
    --- /dev/null
    +++ b/Lang/Nu/MAC-vendor-lookup
    @@ -0,0 +1 @@
    +../../Task/MAC-vendor-lookup/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/MD5 b/Lang/Nu/MD5
    new file mode 120000
    index 0000000000..feac42125d
    --- /dev/null
    +++ b/Lang/Nu/MD5
    @@ -0,0 +1 @@
    +../../Task/MD5/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Matrix-transposition b/Lang/Nu/Matrix-transposition
    new file mode 120000
    index 0000000000..adc758bbe0
    --- /dev/null
    +++ b/Lang/Nu/Matrix-transposition
    @@ -0,0 +1 @@
    +../../Task/Matrix-transposition/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Multiplication-tables b/Lang/Nu/Multiplication-tables
    new file mode 120000
    index 0000000000..ac72d93e8f
    --- /dev/null
    +++ b/Lang/Nu/Multiplication-tables
    @@ -0,0 +1 @@
    +../../Task/Multiplication-tables/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Non-decimal-radices-Convert b/Lang/Nu/Non-decimal-radices-Convert
    new file mode 120000
    index 0000000000..1dbd245069
    --- /dev/null
    +++ b/Lang/Nu/Non-decimal-radices-Convert
    @@ -0,0 +1 @@
    +../../Task/Non-decimal-radices-Convert/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Nth-root b/Lang/Nu/Nth-root
    new file mode 120000
    index 0000000000..818bbdff36
    --- /dev/null
    +++ b/Lang/Nu/Nth-root
    @@ -0,0 +1 @@
    +../../Task/Nth-root/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Null-object b/Lang/Nu/Null-object
    new file mode 120000
    index 0000000000..74589e5538
    --- /dev/null
    +++ b/Lang/Nu/Null-object
    @@ -0,0 +1 @@
    +../../Task/Null-object/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Order-two-numerical-lists b/Lang/Nu/Order-two-numerical-lists
    new file mode 120000
    index 0000000000..a09725d44a
    --- /dev/null
    +++ b/Lang/Nu/Order-two-numerical-lists
    @@ -0,0 +1 @@
    +../../Task/Order-two-numerical-lists/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Ordered-words b/Lang/Nu/Ordered-words
    new file mode 120000
    index 0000000000..fb4962c2af
    --- /dev/null
    +++ b/Lang/Nu/Ordered-words
    @@ -0,0 +1 @@
    +../../Task/Ordered-words/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Phrase-reversals b/Lang/Nu/Phrase-reversals
    new file mode 120000
    index 0000000000..df54742816
    --- /dev/null
    +++ b/Lang/Nu/Phrase-reversals
    @@ -0,0 +1 @@
    +../../Task/Phrase-reversals/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Pick-random-element b/Lang/Nu/Pick-random-element
    new file mode 120000
    index 0000000000..184348b826
    --- /dev/null
    +++ b/Lang/Nu/Pick-random-element
    @@ -0,0 +1 @@
    +../../Task/Pick-random-element/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Random-numbers b/Lang/Nu/Random-numbers
    new file mode 120000
    index 0000000000..ba277327c8
    --- /dev/null
    +++ b/Lang/Nu/Random-numbers
    @@ -0,0 +1 @@
    +../../Task/Random-numbers/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Remove-duplicate-elements b/Lang/Nu/Remove-duplicate-elements
    new file mode 120000
    index 0000000000..d498c34eae
    --- /dev/null
    +++ b/Lang/Nu/Remove-duplicate-elements
    @@ -0,0 +1 @@
    +../../Task/Remove-duplicate-elements/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Repeat-a-string b/Lang/Nu/Repeat-a-string
    new file mode 120000
    index 0000000000..962454e331
    --- /dev/null
    +++ b/Lang/Nu/Repeat-a-string
    @@ -0,0 +1 @@
    +../../Task/Repeat-a-string/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Reverse-a-string b/Lang/Nu/Reverse-a-string
    new file mode 120000
    index 0000000000..34f43d53f3
    --- /dev/null
    +++ b/Lang/Nu/Reverse-a-string
    @@ -0,0 +1 @@
    +../../Task/Reverse-a-string/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Rot-13 b/Lang/Nu/Rot-13
    new file mode 120000
    index 0000000000..d2902fe7ad
    --- /dev/null
    +++ b/Lang/Nu/Rot-13
    @@ -0,0 +1 @@
    +../../Task/Rot-13/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/SHA-256 b/Lang/Nu/SHA-256
    new file mode 120000
    index 0000000000..b58398940b
    --- /dev/null
    +++ b/Lang/Nu/SHA-256
    @@ -0,0 +1 @@
    +../../Task/SHA-256/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Show-the-epoch b/Lang/Nu/Show-the-epoch
    new file mode 120000
    index 0000000000..9547f199df
    --- /dev/null
    +++ b/Lang/Nu/Show-the-epoch
    @@ -0,0 +1 @@
    +../../Task/Show-the-epoch/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Sort-a-list-of-object-identifiers b/Lang/Nu/Sort-a-list-of-object-identifiers
    new file mode 120000
    index 0000000000..9efe53a3b5
    --- /dev/null
    +++ b/Lang/Nu/Sort-a-list-of-object-identifiers
    @@ -0,0 +1 @@
    +../../Task/Sort-a-list-of-object-identifiers/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Sort-an-integer-array b/Lang/Nu/Sort-an-integer-array
    new file mode 120000
    index 0000000000..cff6ab8400
    --- /dev/null
    +++ b/Lang/Nu/Sort-an-integer-array
    @@ -0,0 +1 @@
    +../../Task/Sort-an-integer-array/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Split-a-character-string-based-on-change-of-character b/Lang/Nu/Split-a-character-string-based-on-change-of-character
    new file mode 120000
    index 0000000000..c6103b5715
    --- /dev/null
    +++ b/Lang/Nu/Split-a-character-string-based-on-change-of-character
    @@ -0,0 +1 @@
    +../../Task/Split-a-character-string-based-on-change-of-character/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Strip-whitespace-from-a-string-Top-and-tail b/Lang/Nu/Strip-whitespace-from-a-string-Top-and-tail
    new file mode 120000
    index 0000000000..c8922d283e
    --- /dev/null
    +++ b/Lang/Nu/Strip-whitespace-from-a-string-Top-and-tail
    @@ -0,0 +1 @@
    +../../Task/Strip-whitespace-from-a-string-Top-and-tail/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Substring-Top-and-tail b/Lang/Nu/Substring-Top-and-tail
    new file mode 120000
    index 0000000000..8e1ec9809c
    --- /dev/null
    +++ b/Lang/Nu/Substring-Top-and-tail
    @@ -0,0 +1 @@
    +../../Task/Substring-Top-and-tail/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Sum-and-product-of-an-array b/Lang/Nu/Sum-and-product-of-an-array
    new file mode 120000
    index 0000000000..c3f15d2743
    --- /dev/null
    +++ b/Lang/Nu/Sum-and-product-of-an-array
    @@ -0,0 +1 @@
    +../../Task/Sum-and-product-of-an-array/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Sum-digits-of-an-integer b/Lang/Nu/Sum-digits-of-an-integer
    new file mode 120000
    index 0000000000..41b99ca024
    --- /dev/null
    +++ b/Lang/Nu/Sum-digits-of-an-integer
    @@ -0,0 +1 @@
    +../../Task/Sum-digits-of-an-integer/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Sum-of-a-series b/Lang/Nu/Sum-of-a-series
    new file mode 120000
    index 0000000000..8172f12fc3
    --- /dev/null
    +++ b/Lang/Nu/Sum-of-a-series
    @@ -0,0 +1 @@
    +../../Task/Sum-of-a-series/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Sum-of-squares b/Lang/Nu/Sum-of-squares
    new file mode 120000
    index 0000000000..d7b0eacde8
    --- /dev/null
    +++ b/Lang/Nu/Sum-of-squares
    @@ -0,0 +1 @@
    +../../Task/Sum-of-squares/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Terminal-control-Clear-the-screen b/Lang/Nu/Terminal-control-Clear-the-screen
    new file mode 120000
    index 0000000000..929018a6f7
    --- /dev/null
    +++ b/Lang/Nu/Terminal-control-Clear-the-screen
    @@ -0,0 +1 @@
    +../../Task/Terminal-control-Clear-the-screen/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Terminal-control-Dimensions b/Lang/Nu/Terminal-control-Dimensions
    new file mode 120000
    index 0000000000..6f437c04e4
    --- /dev/null
    +++ b/Lang/Nu/Terminal-control-Dimensions
    @@ -0,0 +1 @@
    +../../Task/Terminal-control-Dimensions/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Terminal-control-Display-an-extended-character b/Lang/Nu/Terminal-control-Display-an-extended-character
    new file mode 120000
    index 0000000000..e54390beea
    --- /dev/null
    +++ b/Lang/Nu/Terminal-control-Display-an-extended-character
    @@ -0,0 +1 @@
    +../../Task/Terminal-control-Display-an-extended-character/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Terminal-control-Hiding-the-cursor b/Lang/Nu/Terminal-control-Hiding-the-cursor
    new file mode 120000
    index 0000000000..e19aad16bb
    --- /dev/null
    +++ b/Lang/Nu/Terminal-control-Hiding-the-cursor
    @@ -0,0 +1 @@
    +../../Task/Terminal-control-Hiding-the-cursor/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Terminal-control-Inverse-video b/Lang/Nu/Terminal-control-Inverse-video
    new file mode 120000
    index 0000000000..dbb97c54ab
    --- /dev/null
    +++ b/Lang/Nu/Terminal-control-Inverse-video
    @@ -0,0 +1 @@
    +../../Task/Terminal-control-Inverse-video/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Terminal-control-Ringing-the-terminal-bell b/Lang/Nu/Terminal-control-Ringing-the-terminal-bell
    new file mode 120000
    index 0000000000..f67008c1f1
    --- /dev/null
    +++ b/Lang/Nu/Terminal-control-Ringing-the-terminal-bell
    @@ -0,0 +1 @@
    +../../Task/Terminal-control-Ringing-the-terminal-bell/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Time-a-function b/Lang/Nu/Time-a-function
    new file mode 120000
    index 0000000000..d32498490a
    --- /dev/null
    +++ b/Lang/Nu/Time-a-function
    @@ -0,0 +1 @@
    +../../Task/Time-a-function/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Tokenize-a-string b/Lang/Nu/Tokenize-a-string
    new file mode 120000
    index 0000000000..e254094f94
    --- /dev/null
    +++ b/Lang/Nu/Tokenize-a-string
    @@ -0,0 +1 @@
    +../../Task/Tokenize-a-string/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/User-input-Text b/Lang/Nu/User-input-Text
    new file mode 120000
    index 0000000000..732f6a88d1
    --- /dev/null
    +++ b/Lang/Nu/User-input-Text
    @@ -0,0 +1 @@
    +../../Task/User-input-Text/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Word-frequency b/Lang/Nu/Word-frequency
    new file mode 120000
    index 0000000000..b6ff2592c2
    --- /dev/null
    +++ b/Lang/Nu/Word-frequency
    @@ -0,0 +1 @@
    +../../Task/Word-frequency/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Y-combinator b/Lang/Nu/Y-combinator
    new file mode 120000
    index 0000000000..77e8ec4916
    --- /dev/null
    +++ b/Lang/Nu/Y-combinator
    @@ -0,0 +1 @@
    +../../Task/Y-combinator/Nu
    \ No newline at end of file
    diff --git a/Lang/Nu/Zero-to-the-zero-power b/Lang/Nu/Zero-to-the-zero-power
    new file mode 120000
    index 0000000000..950e81f484
    --- /dev/null
    +++ b/Lang/Nu/Zero-to-the-zero-power
    @@ -0,0 +1 @@
    +../../Task/Zero-to-the-zero-power/Nu
    \ No newline at end of file
    diff --git a/Lang/OCaml/Anti-primes b/Lang/OCaml/Anti-primes
    new file mode 120000
    index 0000000000..5c78fd8505
    --- /dev/null
    +++ b/Lang/OCaml/Anti-primes
    @@ -0,0 +1 @@
    +../../Task/Anti-primes/OCaml
    \ No newline at end of file
    diff --git a/Lang/OCaml/Attractive-numbers b/Lang/OCaml/Attractive-numbers
    new file mode 120000
    index 0000000000..7813955dbc
    --- /dev/null
    +++ b/Lang/OCaml/Attractive-numbers
    @@ -0,0 +1 @@
    +../../Task/Attractive-numbers/OCaml
    \ No newline at end of file
    diff --git a/Lang/OCaml/Cuban-primes b/Lang/OCaml/Cuban-primes
    new file mode 120000
    index 0000000000..d69918cc8d
    --- /dev/null
    +++ b/Lang/OCaml/Cuban-primes
    @@ -0,0 +1 @@
    +../../Task/Cuban-primes/OCaml
    \ No newline at end of file
    diff --git a/Lang/OCaml/Harmonic-series b/Lang/OCaml/Harmonic-series
    new file mode 120000
    index 0000000000..7ea0abbec3
    --- /dev/null
    +++ b/Lang/OCaml/Harmonic-series
    @@ -0,0 +1 @@
    +../../Task/Harmonic-series/OCaml
    \ No newline at end of file
    diff --git a/Lang/OCaml/Kosaraju b/Lang/OCaml/Kosaraju
    new file mode 120000
    index 0000000000..7243692ec3
    --- /dev/null
    +++ b/Lang/OCaml/Kosaraju
    @@ -0,0 +1 @@
    +../../Task/Kosaraju/OCaml
    \ No newline at end of file
    diff --git a/Lang/OCaml/Parse-an-IP-Address b/Lang/OCaml/Parse-an-IP-Address
    new file mode 120000
    index 0000000000..f01fc56f01
    --- /dev/null
    +++ b/Lang/OCaml/Parse-an-IP-Address
    @@ -0,0 +1 @@
    +../../Task/Parse-an-IP-Address/OCaml
    \ No newline at end of file
    diff --git a/Lang/OCaml/Pseudo-random-numbers-Xorshift-star b/Lang/OCaml/Pseudo-random-numbers-Xorshift-star
    new file mode 120000
    index 0000000000..3fd6f20cda
    --- /dev/null
    +++ b/Lang/OCaml/Pseudo-random-numbers-Xorshift-star
    @@ -0,0 +1 @@
    +../../Task/Pseudo-random-numbers-Xorshift-star/OCaml
    \ No newline at end of file
    diff --git a/Lang/OCaml/Quaternion-type b/Lang/OCaml/Quaternion-type
    deleted file mode 120000
    index cc65de3875..0000000000
    --- a/Lang/OCaml/Quaternion-type
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Quaternion-type/OCaml
    \ No newline at end of file
    diff --git a/Lang/OCaml/Sorting-algorithms-Sleep-sort b/Lang/OCaml/Sorting-algorithms-Sleep-sort
    new file mode 120000
    index 0000000000..1cc75210f7
    --- /dev/null
    +++ b/Lang/OCaml/Sorting-algorithms-Sleep-sort
    @@ -0,0 +1 @@
    +../../Task/Sorting-algorithms-Sleep-sort/OCaml
    \ No newline at end of file
    diff --git a/Lang/OCaml/Strassens-algorithm b/Lang/OCaml/Strassens-algorithm
    new file mode 120000
    index 0000000000..f94e8ddb52
    --- /dev/null
    +++ b/Lang/OCaml/Strassens-algorithm
    @@ -0,0 +1 @@
    +../../Task/Strassens-algorithm/OCaml
    \ No newline at end of file
    diff --git a/Lang/OOC/00-LANG.txt b/Lang/OOC/00-LANG.txt
    index 6ab39964dc..65c190709f 100644
    --- a/Lang/OOC/00-LANG.txt
    +++ b/Lang/OOC/00-LANG.txt
    @@ -1,2 +1,2 @@
     {{stub}}{{language
    -|site=http://ooc-lang.org}}
    \ No newline at end of file
    +|site=https://ooc-lang.github.io/}}
    \ No newline at end of file
    diff --git a/Lang/OPL/00-LANG.txt b/Lang/OPL/00-LANG.txt
    index 8357c2d27a..5d7f1fba8f 100644
    --- a/Lang/OPL/00-LANG.txt
    +++ b/Lang/OPL/00-LANG.txt
    @@ -1,3 +1,11 @@
     {{stub}}
     {{language
    -|site=http://opl-dev.sourceforge.net/}}
    \ No newline at end of file
    +|site=http://opl-dev.sourceforge.net/}}
    +
    +'''OPL (Open Programming Language'''; formerly '''Organiser Programming Language)''' is a high-level programming language designed primarily for use on mobile devices, particularly those running the Psion Series 3 and Series 5 operating systems. Developed in the early 1990s, '''OPL''' was created to provide a simple yet powerful environment for application development on handheld devices, allowing users to create software that could leverage the unique features of these portable platforms.
    +
    +OPL is known for its ease of use, making it accessible to both novice and experienced programmers. The language features a syntax that is similar to [[BASIC]], which helps in rapid application development. It supports structured programming concepts, including variables, control structures, and functions, enabling developers to write clear and maintainable code.
    +
    +One of the key strengths of OPL is its ability to interact seamlessly with the underlying operating system, allowing developers to access device-specific features such as file management, user interface elements, and hardware capabilities. This makes OPL particularly suitable for creating productivity applications, games, and utilities tailored for mobile users.
    +
    +Despite its niche status, OPL has garnered a dedicated community of enthusiasts and developers who continue to explore its capabilities and create innovative applications. As mobile computing continues to evolve, OPL remains a notable example of early efforts to bring programming to handheld devices, showcasing the potential of portable technology in software development.
    \ No newline at end of file
    diff --git a/Lang/OPL/100-doors b/Lang/OPL/100-doors
    new file mode 120000
    index 0000000000..a3b7e045e6
    --- /dev/null
    +++ b/Lang/OPL/100-doors
    @@ -0,0 +1 @@
    +../../Task/100-doors/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Arithmetic-Integer b/Lang/OPL/Arithmetic-Integer
    new file mode 120000
    index 0000000000..dfcb743d43
    --- /dev/null
    +++ b/Lang/OPL/Arithmetic-Integer
    @@ -0,0 +1 @@
    +../../Task/Arithmetic-Integer/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Array-length b/Lang/OPL/Array-length
    new file mode 120000
    index 0000000000..691e5be366
    --- /dev/null
    +++ b/Lang/OPL/Array-length
    @@ -0,0 +1 @@
    +../../Task/Array-length/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Arrays b/Lang/OPL/Arrays
    new file mode 120000
    index 0000000000..f57347887c
    --- /dev/null
    +++ b/Lang/OPL/Arrays
    @@ -0,0 +1 @@
    +../../Task/Arrays/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Character-codes b/Lang/OPL/Character-codes
    new file mode 120000
    index 0000000000..2dac3156b8
    --- /dev/null
    +++ b/Lang/OPL/Character-codes
    @@ -0,0 +1 @@
    +../../Task/Character-codes/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Comments b/Lang/OPL/Comments
    new file mode 120000
    index 0000000000..8aec78d8aa
    --- /dev/null
    +++ b/Lang/OPL/Comments
    @@ -0,0 +1 @@
    +../../Task/Comments/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Compare-length-of-two-strings b/Lang/OPL/Compare-length-of-two-strings
    new file mode 120000
    index 0000000000..c36f1e31fc
    --- /dev/null
    +++ b/Lang/OPL/Compare-length-of-two-strings
    @@ -0,0 +1 @@
    +../../Task/Compare-length-of-two-strings/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Copy-a-string b/Lang/OPL/Copy-a-string
    new file mode 120000
    index 0000000000..76609905e5
    --- /dev/null
    +++ b/Lang/OPL/Copy-a-string
    @@ -0,0 +1 @@
    +../../Task/Copy-a-string/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Draw-a-clock b/Lang/OPL/Draw-a-clock
    new file mode 120000
    index 0000000000..438c8aadf3
    --- /dev/null
    +++ b/Lang/OPL/Draw-a-clock
    @@ -0,0 +1 @@
    +../../Task/Draw-a-clock/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Draw-a-pixel b/Lang/OPL/Draw-a-pixel
    new file mode 120000
    index 0000000000..d5c6ecea21
    --- /dev/null
    +++ b/Lang/OPL/Draw-a-pixel
    @@ -0,0 +1 @@
    +../../Task/Draw-a-pixel/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Empty-string b/Lang/OPL/Empty-string
    new file mode 120000
    index 0000000000..9f6569303b
    --- /dev/null
    +++ b/Lang/OPL/Empty-string
    @@ -0,0 +1 @@
    +../../Task/Empty-string/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Factors-of-an-integer b/Lang/OPL/Factors-of-an-integer
    new file mode 120000
    index 0000000000..2dc5a0a29e
    --- /dev/null
    +++ b/Lang/OPL/Factors-of-an-integer
    @@ -0,0 +1 @@
    +../../Task/Factors-of-an-integer/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Filter b/Lang/OPL/Filter
    new file mode 120000
    index 0000000000..89ea7a2c54
    --- /dev/null
    +++ b/Lang/OPL/Filter
    @@ -0,0 +1 @@
    +../../Task/Filter/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Hello-world-Text b/Lang/OPL/Hello-world-Text
    new file mode 120000
    index 0000000000..a870057a16
    --- /dev/null
    +++ b/Lang/OPL/Hello-world-Text
    @@ -0,0 +1 @@
    +../../Task/Hello-world-Text/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Program-termination b/Lang/OPL/Program-termination
    new file mode 120000
    index 0000000000..8287761646
    --- /dev/null
    +++ b/Lang/OPL/Program-termination
    @@ -0,0 +1 @@
    +../../Task/Program-termination/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Reverse-a-string b/Lang/OPL/Reverse-a-string
    new file mode 120000
    index 0000000000..8dba18d4c9
    --- /dev/null
    +++ b/Lang/OPL/Reverse-a-string
    @@ -0,0 +1 @@
    +../../Task/Reverse-a-string/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Show-ASCII-table b/Lang/OPL/Show-ASCII-table
    new file mode 120000
    index 0000000000..72f35c10c7
    --- /dev/null
    +++ b/Lang/OPL/Show-ASCII-table
    @@ -0,0 +1 @@
    +../../Task/Show-ASCII-table/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/String-length b/Lang/OPL/String-length
    new file mode 120000
    index 0000000000..ebd9f5ed88
    --- /dev/null
    +++ b/Lang/OPL/String-length
    @@ -0,0 +1 @@
    +../../Task/String-length/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/String-prepend b/Lang/OPL/String-prepend
    new file mode 120000
    index 0000000000..78cb69646e
    --- /dev/null
    +++ b/Lang/OPL/String-prepend
    @@ -0,0 +1 @@
    +../../Task/String-prepend/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/Substring b/Lang/OPL/Substring
    new file mode 120000
    index 0000000000..046b764f06
    --- /dev/null
    +++ b/Lang/OPL/Substring
    @@ -0,0 +1 @@
    +../../Task/Substring/OPL
    \ No newline at end of file
    diff --git a/Lang/OPL/User-input-Text b/Lang/OPL/User-input-Text
    new file mode 120000
    index 0000000000..ad39694040
    --- /dev/null
    +++ b/Lang/OPL/User-input-Text
    @@ -0,0 +1 @@
    +../../Task/User-input-Text/OPL
    \ No newline at end of file
    diff --git a/Lang/Oberon-07/00-LANG.txt b/Lang/Oberon-07/00-LANG.txt
    new file mode 100644
    index 0000000000..fecc62a2b8
    --- /dev/null
    +++ b/Lang/Oberon-07/00-LANG.txt
    @@ -0,0 +1,30 @@
    +{{stub}}
    +{{language|Oberon-07
    +|strength=strong
    +|safety=safe
    +|express=explicit
    +|compat=structural
    +|checking=static
    +|parampass=both
    +|gc=yes
    +}}
    +
    +'''Oberon-07''' is a revision of the Oberon language by Niklaus Wirth. Oberon-07 is based on Wirth's original Oberon language (not [[Oberon-2]]), Wirth lists the changes [https://people.inf.ethz.ch/wirth/Oberon/Oberon07.pdf here], which are largely aimed at  simplification - in [https://people.inf.ethz.ch/wirth/Oberon/Oberon07.Report.pdf his defining document], Wirth quotes Einstein: "Make it as simple as possible, but not simpler".

    + +Oberon-07 contains a WHILE loop that allows multiple conditions and statements - similar to the loop in [[wp:Guarded_Command_Language|Edsgar Dijkstra's Guarded Command Language]], though with different syntax and without non-determinism. See [[Loops/N_plus_one_half#Oberon-07]] for an example. +

    +In addition to the samples below, many of the [[Oberon-2]] samples should work with Oberon-07, particularly if the Oberon-07 compiler you are using allows LONGINT as a synonym for INTEGER (LONGINT, SHORTINT, LONGREAL and SHORTREAL were dropped from Oberon-07). + +==Tasks not implemented in Oberon-07== +[[Tasks not implemented in Oberon-07]] + +== Library modules used in Rosetta Code samples == +* [[:Category:Oberon-07-primes|Prime related]] +* [[:Category:Oberon-07-words|Word related]] + +== See also == +* [[Oberon-2]] +* [[Modula-2]] +* [[Modula-3]] +* [[Component Pascal]] +* [[Zonnon]] \ No newline at end of file diff --git a/Lang/Oberon-07/00-META.yaml b/Lang/Oberon-07/00-META.yaml new file mode 100644 index 0000000000..df5ec38ad0 --- /dev/null +++ b/Lang/Oberon-07/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Oberon-07 diff --git a/Lang/Oberon-07/Abundant-odd-numbers b/Lang/Oberon-07/Abundant-odd-numbers new file mode 120000 index 0000000000..93003f8da4 --- /dev/null +++ b/Lang/Oberon-07/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Additive-primes b/Lang/Oberon-07/Additive-primes new file mode 120000 index 0000000000..29e374f522 --- /dev/null +++ b/Lang/Oberon-07/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Almost-prime b/Lang/Oberon-07/Almost-prime new file mode 120000 index 0000000000..a487d08ae3 --- /dev/null +++ b/Lang/Oberon-07/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Arithmetic-derivative b/Lang/Oberon-07/Arithmetic-derivative new file mode 120000 index 0000000000..8a23f5aca7 --- /dev/null +++ b/Lang/Oberon-07/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Arithmetic-numbers b/Lang/Oberon-07/Arithmetic-numbers new file mode 120000 index 0000000000..12d1ac60ce --- /dev/null +++ b/Lang/Oberon-07/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Bell-numbers b/Lang/Oberon-07/Bell-numbers new file mode 120000 index 0000000000..e9a3518583 --- /dev/null +++ b/Lang/Oberon-07/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Brilliant-numbers b/Lang/Oberon-07/Brilliant-numbers new file mode 120000 index 0000000000..9a2690e4fa --- /dev/null +++ b/Lang/Oberon-07/Brilliant-numbers @@ -0,0 +1 @@ +../../Task/Brilliant-numbers/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/CUSIP b/Lang/Oberon-07/CUSIP new file mode 120000 index 0000000000..fca08cc3e6 --- /dev/null +++ b/Lang/Oberon-07/CUSIP @@ -0,0 +1 @@ +../../Task/CUSIP/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Calculating-the-value-of-e b/Lang/Oberon-07/Calculating-the-value-of-e new file mode 120000 index 0000000000..3693146162 --- /dev/null +++ b/Lang/Oberon-07/Calculating-the-value-of-e @@ -0,0 +1 @@ +../../Task/Calculating-the-value-of-e/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Carmichael-3-strong-pseudoprimes b/Lang/Oberon-07/Carmichael-3-strong-pseudoprimes new file mode 120000 index 0000000000..1732f66395 --- /dev/null +++ b/Lang/Oberon-07/Carmichael-3-strong-pseudoprimes @@ -0,0 +1 @@ +../../Task/Carmichael-3-strong-pseudoprimes/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Catalan-numbers b/Lang/Oberon-07/Catalan-numbers new file mode 120000 index 0000000000..97d7a62fcd --- /dev/null +++ b/Lang/Oberon-07/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Copy-stdin-to-stdout b/Lang/Oberon-07/Copy-stdin-to-stdout new file mode 120000 index 0000000000..15b9092fd0 --- /dev/null +++ b/Lang/Oberon-07/Copy-stdin-to-stdout @@ -0,0 +1 @@ +../../Task/Copy-stdin-to-stdout/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Count-in-factors b/Lang/Oberon-07/Count-in-factors new file mode 120000 index 0000000000..213e18b9fd --- /dev/null +++ b/Lang/Oberon-07/Count-in-factors @@ -0,0 +1 @@ +../../Task/Count-in-factors/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Cumulative-standard-deviation b/Lang/Oberon-07/Cumulative-standard-deviation new file mode 120000 index 0000000000..998c4d523e --- /dev/null +++ b/Lang/Oberon-07/Cumulative-standard-deviation @@ -0,0 +1 @@ +../../Task/Cumulative-standard-deviation/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Day-of-the-week b/Lang/Oberon-07/Day-of-the-week new file mode 120000 index 0000000000..f4a166cd18 --- /dev/null +++ b/Lang/Oberon-07/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Department-numbers b/Lang/Oberon-07/Department-numbers new file mode 120000 index 0000000000..ee00d69bb6 --- /dev/null +++ b/Lang/Oberon-07/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Determine-if-a-string-has-all-the-same-characters b/Lang/Oberon-07/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..f2c11ea5d4 --- /dev/null +++ b/Lang/Oberon-07/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Dice-game-probabilities b/Lang/Oberon-07/Dice-game-probabilities new file mode 120000 index 0000000000..527f78ea60 --- /dev/null +++ b/Lang/Oberon-07/Dice-game-probabilities @@ -0,0 +1 @@ +../../Task/Dice-game-probabilities/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Empty-program b/Lang/Oberon-07/Empty-program new file mode 120000 index 0000000000..ba46e2aae6 --- /dev/null +++ b/Lang/Oberon-07/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Equal-prime-and-composite-sums b/Lang/Oberon-07/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..91c57a6baf --- /dev/null +++ b/Lang/Oberon-07/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Ethiopian-multiplication b/Lang/Oberon-07/Ethiopian-multiplication new file mode 120000 index 0000000000..13a766a6c8 --- /dev/null +++ b/Lang/Oberon-07/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Euclid-Mullin-sequence b/Lang/Oberon-07/Euclid-Mullin-sequence new file mode 120000 index 0000000000..81b23466eb --- /dev/null +++ b/Lang/Oberon-07/Euclid-Mullin-sequence @@ -0,0 +1 @@ +../../Task/Euclid-Mullin-sequence/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Factorial b/Lang/Oberon-07/Factorial new file mode 120000 index 0000000000..42b8c4919c --- /dev/null +++ b/Lang/Oberon-07/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Find-the-last-Sunday-of-each-month b/Lang/Oberon-07/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..1d918212c0 --- /dev/null +++ b/Lang/Oberon-07/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Giuga-numbers b/Lang/Oberon-07/Giuga-numbers new file mode 120000 index 0000000000..cce0bf5fc2 --- /dev/null +++ b/Lang/Oberon-07/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Harmonic-series b/Lang/Oberon-07/Harmonic-series new file mode 120000 index 0000000000..8e08686cfc --- /dev/null +++ b/Lang/Oberon-07/Harmonic-series @@ -0,0 +1 @@ +../../Task/Harmonic-series/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Isqrt-integer-square-root-of-X b/Lang/Oberon-07/Isqrt-integer-square-root-of-X new file mode 120000 index 0000000000..a51f2f67a5 --- /dev/null +++ b/Lang/Oberon-07/Isqrt-integer-square-root-of-X @@ -0,0 +1 @@ +../../Task/Isqrt-integer-square-root-of-X/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Iterated-digits-squaring b/Lang/Oberon-07/Iterated-digits-squaring new file mode 120000 index 0000000000..7a2da6ed31 --- /dev/null +++ b/Lang/Oberon-07/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Jordan-P-lya-numbers b/Lang/Oberon-07/Jordan-P-lya-numbers new file mode 120000 index 0000000000..9a4df048e8 --- /dev/null +++ b/Lang/Oberon-07/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Julia-set b/Lang/Oberon-07/Julia-set new file mode 120000 index 0000000000..e864d34442 --- /dev/null +++ b/Lang/Oberon-07/Julia-set @@ -0,0 +1 @@ +../../Task/Julia-set/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Knapsack-problem-Continuous b/Lang/Oberon-07/Knapsack-problem-Continuous new file mode 120000 index 0000000000..43a5919216 --- /dev/null +++ b/Lang/Oberon-07/Knapsack-problem-Continuous @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Continuous/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Last-Friday-of-each-month b/Lang/Oberon-07/Last-Friday-of-each-month new file mode 120000 index 0000000000..e8c07d9c19 --- /dev/null +++ b/Lang/Oberon-07/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Leap-year b/Lang/Oberon-07/Leap-year new file mode 120000 index 0000000000..8797ca0922 --- /dev/null +++ b/Lang/Oberon-07/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Legendre-prime-counting-function b/Lang/Oberon-07/Legendre-prime-counting-function new file mode 120000 index 0000000000..7d4d3489c5 --- /dev/null +++ b/Lang/Oberon-07/Legendre-prime-counting-function @@ -0,0 +1 @@ +../../Task/Legendre-prime-counting-function/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Long-year b/Lang/Oberon-07/Long-year new file mode 120000 index 0000000000..a0709fd34e --- /dev/null +++ b/Lang/Oberon-07/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Loops-Break b/Lang/Oberon-07/Loops-Break new file mode 120000 index 0000000000..bcd210938e --- /dev/null +++ b/Lang/Oberon-07/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Loops-N-plus-one-half b/Lang/Oberon-07/Loops-N-plus-one-half new file mode 120000 index 0000000000..f9ed03d1cc --- /dev/null +++ b/Lang/Oberon-07/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Magic-8-ball b/Lang/Oberon-07/Magic-8-ball new file mode 120000 index 0000000000..060c6dd973 --- /dev/null +++ b/Lang/Oberon-07/Magic-8-ball @@ -0,0 +1 @@ +../../Task/Magic-8-ball/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/McNuggets-problem b/Lang/Oberon-07/McNuggets-problem new file mode 120000 index 0000000000..f69d28cb85 --- /dev/null +++ b/Lang/Oberon-07/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Motzkin-numbers b/Lang/Oberon-07/Motzkin-numbers new file mode 120000 index 0000000000..b3b2948803 --- /dev/null +++ b/Lang/Oberon-07/Motzkin-numbers @@ -0,0 +1 @@ +../../Task/Motzkin-numbers/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Numbers-with-equal-rises-and-falls b/Lang/Oberon-07/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..5077c6cc5f --- /dev/null +++ b/Lang/Oberon-07/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/One-dimensional-cellular-automata b/Lang/Oberon-07/One-dimensional-cellular-automata new file mode 120000 index 0000000000..95f88799f3 --- /dev/null +++ b/Lang/Oberon-07/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Ordered-words b/Lang/Oberon-07/Ordered-words new file mode 120000 index 0000000000..6b04795e94 --- /dev/null +++ b/Lang/Oberon-07/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Pell-numbers b/Lang/Oberon-07/Pell-numbers new file mode 120000 index 0000000000..7b4ee7e909 --- /dev/null +++ b/Lang/Oberon-07/Pell-numbers @@ -0,0 +1 @@ +../../Task/Pell-numbers/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Primality-by-trial-division b/Lang/Oberon-07/Primality-by-trial-division new file mode 120000 index 0000000000..bbe4339271 --- /dev/null +++ b/Lang/Oberon-07/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Rare-numbers b/Lang/Oberon-07/Rare-numbers new file mode 120000 index 0000000000..ee9d392e3c --- /dev/null +++ b/Lang/Oberon-07/Rare-numbers @@ -0,0 +1 @@ +../../Task/Rare-numbers/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Scope-modifiers b/Lang/Oberon-07/Scope-modifiers new file mode 120000 index 0000000000..5c7c859780 --- /dev/null +++ b/Lang/Oberon-07/Scope-modifiers @@ -0,0 +1 @@ +../../Task/Scope-modifiers/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Semiprime b/Lang/Oberon-07/Semiprime new file mode 120000 index 0000000000..46f4d8859c --- /dev/null +++ b/Lang/Oberon-07/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Sequence-of-non-squares b/Lang/Oberon-07/Sequence-of-non-squares new file mode 120000 index 0000000000..45e81c48c5 --- /dev/null +++ b/Lang/Oberon-07/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Sequence-of-primorial-primes b/Lang/Oberon-07/Sequence-of-primorial-primes new file mode 120000 index 0000000000..7f1050cb25 --- /dev/null +++ b/Lang/Oberon-07/Sequence-of-primorial-primes @@ -0,0 +1 @@ +../../Task/Sequence-of-primorial-primes/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Shoelace-formula-for-polygonal-area b/Lang/Oberon-07/Shoelace-formula-for-polygonal-area new file mode 120000 index 0000000000..b71cae6abb --- /dev/null +++ b/Lang/Oberon-07/Shoelace-formula-for-polygonal-area @@ -0,0 +1 @@ +../../Task/Shoelace-formula-for-polygonal-area/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Sierpinski-triangle b/Lang/Oberon-07/Sierpinski-triangle new file mode 120000 index 0000000000..bdad2ec3ac --- /dev/null +++ b/Lang/Oberon-07/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Sleeping-Beauty-problem b/Lang/Oberon-07/Sleeping-Beauty-problem new file mode 120000 index 0000000000..94be576322 --- /dev/null +++ b/Lang/Oberon-07/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Square-but-not-cube b/Lang/Oberon-07/Square-but-not-cube new file mode 120000 index 0000000000..917704f475 --- /dev/null +++ b/Lang/Oberon-07/Square-but-not-cube @@ -0,0 +1 @@ +../../Task/Square-but-not-cube/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Stack b/Lang/Oberon-07/Stack new file mode 120000 index 0000000000..abb833bb1a --- /dev/null +++ b/Lang/Oberon-07/Stack @@ -0,0 +1 @@ +../../Task/Stack/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Stirling-numbers-of-the-first-kind b/Lang/Oberon-07/Stirling-numbers-of-the-first-kind new file mode 120000 index 0000000000..fc333d5e86 --- /dev/null +++ b/Lang/Oberon-07/Stirling-numbers-of-the-first-kind @@ -0,0 +1 @@ +../../Task/Stirling-numbers-of-the-first-kind/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Tau-number b/Lang/Oberon-07/Tau-number new file mode 120000 index 0000000000..c494dc7ed9 --- /dev/null +++ b/Lang/Oberon-07/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Thue-Morse b/Lang/Oberon-07/Thue-Morse new file mode 120000 index 0000000000..9ae7bad9e1 --- /dev/null +++ b/Lang/Oberon-07/Thue-Morse @@ -0,0 +1 @@ +../../Task/Thue-Morse/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Van-Eck-sequence b/Lang/Oberon-07/Van-Eck-sequence new file mode 120000 index 0000000000..1d825043d7 --- /dev/null +++ b/Lang/Oberon-07/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Van-der-Corput-sequence b/Lang/Oberon-07/Van-der-Corput-sequence new file mode 120000 index 0000000000..9bcb9702bb --- /dev/null +++ b/Lang/Oberon-07/Van-der-Corput-sequence @@ -0,0 +1 @@ +../../Task/Van-der-Corput-sequence/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Verhoeff-algorithm b/Lang/Oberon-07/Verhoeff-algorithm new file mode 120000 index 0000000000..5e73a5c36f --- /dev/null +++ b/Lang/Oberon-07/Verhoeff-algorithm @@ -0,0 +1 @@ +../../Task/Verhoeff-algorithm/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Yellowstone-sequence b/Lang/Oberon-07/Yellowstone-sequence new file mode 120000 index 0000000000..cf4e2d20b9 --- /dev/null +++ b/Lang/Oberon-07/Yellowstone-sequence @@ -0,0 +1 @@ +../../Task/Yellowstone-sequence/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon-07/Zeckendorf-number-representation b/Lang/Oberon-07/Zeckendorf-number-representation new file mode 120000 index 0000000000..3ada43b974 --- /dev/null +++ b/Lang/Oberon-07/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/Oberon-07 \ No newline at end of file diff --git a/Lang/Oberon/100-doors b/Lang/Oberon/100-doors deleted file mode 120000 index 9d190b3c16..0000000000 --- a/Lang/Oberon/100-doors +++ /dev/null @@ -1 +0,0 @@ -../../Task/100-doors/Oberon \ No newline at end of file diff --git a/Lang/Oberon/Abundant-deficient-and-perfect-number-classifications b/Lang/Oberon/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..e8005ff3ac --- /dev/null +++ b/Lang/Oberon/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/Oberon \ No newline at end of file diff --git a/Lang/Oberon/Arithmetic-Integer b/Lang/Oberon/Arithmetic-Integer deleted file mode 120000 index e9f7a593d7..0000000000 --- a/Lang/Oberon/Arithmetic-Integer +++ /dev/null @@ -1 +0,0 @@ -../../Task/Arithmetic-Integer/Oberon \ No newline at end of file diff --git a/Lang/Oberon/Calkin-Wilf-sequence b/Lang/Oberon/Calkin-Wilf-sequence new file mode 120000 index 0000000000..15bedf6a9d --- /dev/null +++ b/Lang/Oberon/Calkin-Wilf-sequence @@ -0,0 +1 @@ +../../Task/Calkin-Wilf-sequence/Oberon \ No newline at end of file diff --git a/Lang/Oberon/Cumulative-standard-deviation b/Lang/Oberon/Cumulative-standard-deviation new file mode 120000 index 0000000000..efd10bee3a --- /dev/null +++ b/Lang/Oberon/Cumulative-standard-deviation @@ -0,0 +1 @@ +../../Task/Cumulative-standard-deviation/Oberon \ No newline at end of file diff --git a/Lang/Oberon/Euclid-Mullin-sequence b/Lang/Oberon/Euclid-Mullin-sequence new file mode 120000 index 0000000000..7808b89779 --- /dev/null +++ b/Lang/Oberon/Euclid-Mullin-sequence @@ -0,0 +1 @@ +../../Task/Euclid-Mullin-sequence/Oberon \ No newline at end of file diff --git a/Lang/Oberon/Even-or-odd b/Lang/Oberon/Even-or-odd deleted file mode 120000 index 02920c353c..0000000000 --- a/Lang/Oberon/Even-or-odd +++ /dev/null @@ -1 +0,0 @@ -../../Task/Even-or-odd/Oberon \ No newline at end of file diff --git a/Lang/Oberon/FASTA-format b/Lang/Oberon/FASTA-format new file mode 120000 index 0000000000..cf4d667f1b --- /dev/null +++ b/Lang/Oberon/FASTA-format @@ -0,0 +1 @@ +../../Task/FASTA-format/Oberon \ No newline at end of file diff --git a/Lang/Oberon/Golden-ratio-Convergence b/Lang/Oberon/Golden-ratio-Convergence new file mode 120000 index 0000000000..dd21277799 --- /dev/null +++ b/Lang/Oberon/Golden-ratio-Convergence @@ -0,0 +1 @@ +../../Task/Golden-ratio-Convergence/Oberon \ No newline at end of file diff --git a/Lang/Oberon/Greatest-common-divisor b/Lang/Oberon/Greatest-common-divisor deleted file mode 120000 index 23dd5fc156..0000000000 --- a/Lang/Oberon/Greatest-common-divisor +++ /dev/null @@ -1 +0,0 @@ -../../Task/Greatest-common-divisor/Oberon \ No newline at end of file diff --git a/Lang/Oberon/Loops-Continue b/Lang/Oberon/Loops-Continue new file mode 120000 index 0000000000..2ebf84aa8e --- /dev/null +++ b/Lang/Oberon/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Oberon \ No newline at end of file diff --git a/Lang/Oberon/Loops-For-with-a-specified-step b/Lang/Oberon/Loops-For-with-a-specified-step deleted file mode 120000 index e73c849d2b..0000000000 --- a/Lang/Oberon/Loops-For-with-a-specified-step +++ /dev/null @@ -1 +0,0 @@ -../../Task/Loops-For-with-a-specified-step/Oberon \ No newline at end of file diff --git a/Lang/Oberon/Rare-numbers b/Lang/Oberon/Rare-numbers new file mode 120000 index 0000000000..9dc08ea100 --- /dev/null +++ b/Lang/Oberon/Rare-numbers @@ -0,0 +1 @@ +../../Task/Rare-numbers/Oberon \ No newline at end of file diff --git a/Lang/Objeck/Catalan-numbers-Pascals-triangle b/Lang/Objeck/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..bc3c684d61 --- /dev/null +++ b/Lang/Objeck/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Copy-stdin-to-stdout b/Lang/Objeck/Copy-stdin-to-stdout new file mode 120000 index 0000000000..b358bbac43 --- /dev/null +++ b/Lang/Objeck/Copy-stdin-to-stdout @@ -0,0 +1 @@ +../../Task/Copy-stdin-to-stdout/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Disarium-numbers b/Lang/Objeck/Disarium-numbers new file mode 120000 index 0000000000..bc58c40d5c --- /dev/null +++ b/Lang/Objeck/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Distributed-programming b/Lang/Objeck/Distributed-programming new file mode 120000 index 0000000000..728f38ee28 --- /dev/null +++ b/Lang/Objeck/Distributed-programming @@ -0,0 +1 @@ +../../Task/Distributed-programming/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Floyds-triangle b/Lang/Objeck/Floyds-triangle new file mode 120000 index 0000000000..743553b677 --- /dev/null +++ b/Lang/Objeck/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Generate-lower-case-ASCII-alphabet b/Lang/Objeck/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..92f0212a12 --- /dev/null +++ b/Lang/Objeck/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Objeck \ No newline at end of file diff --git a/Lang/Objeck/HTTPS-Client-authenticated b/Lang/Objeck/HTTPS-Client-authenticated new file mode 120000 index 0000000000..6f56878ef9 --- /dev/null +++ b/Lang/Objeck/HTTPS-Client-authenticated @@ -0,0 +1 @@ +../../Task/HTTPS-Client-authenticated/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Hello-world-Standard-error b/Lang/Objeck/Hello-world-Standard-error new file mode 120000 index 0000000000..49d3f16aa6 --- /dev/null +++ b/Lang/Objeck/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Knuth-shuffle b/Lang/Objeck/Knuth-shuffle new file mode 120000 index 0000000000..a7bb43880d --- /dev/null +++ b/Lang/Objeck/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Mad-Libs b/Lang/Objeck/Mad-Libs new file mode 120000 index 0000000000..39f19ea059 --- /dev/null +++ b/Lang/Objeck/Mad-Libs @@ -0,0 +1 @@ +../../Task/Mad-Libs/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Magic-squares-of-doubly-even-order b/Lang/Objeck/Magic-squares-of-doubly-even-order new file mode 120000 index 0000000000..526cd66745 --- /dev/null +++ b/Lang/Objeck/Magic-squares-of-doubly-even-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-doubly-even-order/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Matrix-multiplication b/Lang/Objeck/Matrix-multiplication new file mode 120000 index 0000000000..e2801343eb --- /dev/null +++ b/Lang/Objeck/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Multiplication-tables b/Lang/Objeck/Multiplication-tables new file mode 120000 index 0000000000..3bad27bce2 --- /dev/null +++ b/Lang/Objeck/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Queue-Definition b/Lang/Objeck/Queue-Definition new file mode 120000 index 0000000000..392e43e236 --- /dev/null +++ b/Lang/Objeck/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Roman-numerals-Decode b/Lang/Objeck/Roman-numerals-Decode new file mode 120000 index 0000000000..bd8b56a721 --- /dev/null +++ b/Lang/Objeck/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Rosetta-Code-Find-unimplemented-tasks b/Lang/Objeck/Rosetta-Code-Find-unimplemented-tasks new file mode 120000 index 0000000000..7e77326aa1 --- /dev/null +++ b/Lang/Objeck/Rosetta-Code-Find-unimplemented-tasks @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Find-unimplemented-tasks/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Sorting-Algorithms-Circle-Sort b/Lang/Objeck/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 4475fe5763..0000000000 --- a/Lang/Objeck/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Strip-a-set-of-characters-from-a-string b/Lang/Objeck/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..f651f9d55d --- /dev/null +++ b/Lang/Objeck/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Objeck \ No newline at end of file diff --git a/Lang/Objeck/Take-notes-on-the-command-line b/Lang/Objeck/Take-notes-on-the-command-line new file mode 120000 index 0000000000..5d55699b35 --- /dev/null +++ b/Lang/Objeck/Take-notes-on-the-command-line @@ -0,0 +1 @@ +../../Task/Take-notes-on-the-command-line/Objeck \ No newline at end of file diff --git a/Lang/Object-Pascal-Implementations/00-LANG.txt b/Lang/Object-Pascal-Implementations/00-LANG.txt new file mode 100644 index 0000000000..74167ef7a7 --- /dev/null +++ b/Lang/Object-Pascal-Implementations/00-LANG.txt @@ -0,0 +1,3 @@ +{{language|Object Pascal}} +{{implementation cat|Object Pascal}} +{{implementation|Pascal}} \ No newline at end of file diff --git a/Lang/Object-Pascal-Implementations/00-META.yaml b/Lang/Object-Pascal-Implementations/00-META.yaml new file mode 100644 index 0000000000..34f0628a46 --- /dev/null +++ b/Lang/Object-Pascal-Implementations/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Object_Pascal_Implementations diff --git a/Lang/Object-Pascal/Sorting-algorithms-Shell-sort b/Lang/Object-Pascal/Sorting-algorithms-Shell-sort new file mode 120000 index 0000000000..6ae9067d88 --- /dev/null +++ b/Lang/Object-Pascal/Sorting-algorithms-Shell-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Shell-sort/Object-Pascal \ No newline at end of file diff --git a/Lang/Octave/Peripheral-drift-illusion b/Lang/Octave/Peripheral-drift-illusion new file mode 120000 index 0000000000..9bda77fd28 --- /dev/null +++ b/Lang/Octave/Peripheral-drift-illusion @@ -0,0 +1 @@ +../../Task/Peripheral-drift-illusion/Octave \ No newline at end of file diff --git a/Lang/Octave/Quaternion-type b/Lang/Octave/Quaternion-type deleted file mode 120000 index 6dec972e26..0000000000 --- a/Lang/Octave/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Octave \ No newline at end of file diff --git a/Lang/Odin/00-LANG.txt b/Lang/Odin/00-LANG.txt index 2c96551228..1a08002d21 100644 --- a/Lang/Odin/00-LANG.txt +++ b/Lang/Odin/00-LANG.txt @@ -1 +1,24 @@ -{{stub}}{{language|Odin}} \ No newline at end of file +{{language +|exec=machine +|gc=no +|safety=unsafe +|parampass=reference +|checking=static +|compat=nominative +|strength=strong +|site=https://odin-lang.org/ +|tag=odin +}}{{language programming paradigm|Imperative}}{{Codepad}} + +'''Odin''' is a general-purpose, [[procedural programming|procedural]], [[imperative programming|imperative]] programming language developed by [https://www.gingerbill.org/ gingerBill] as a "C alternative for the joy of programming". + +Odin is distributed under [https://github.com/odin-lang/Odin/blob/master/LICENSE zlib license]. + +==Links== +* [https://odin-lang.org/docs/install/ Compiler installation instructions] +* [https://github.com/odin-lang/Odin Repository] +* [https://odin-lang.org/docs/overview/ Language overview] +* [https://pkg.odin-lang.org/ Standard library documentation] + +==Todo== +[[Tasks_not_implemented_in_Odin]] \ No newline at end of file diff --git a/Lang/Odin/100-doors b/Lang/Odin/100-doors new file mode 120000 index 0000000000..67c11787e6 --- /dev/null +++ b/Lang/Odin/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Odin \ No newline at end of file diff --git a/Lang/Odin/Call-a-function-in-a-shared-library b/Lang/Odin/Call-a-function-in-a-shared-library new file mode 120000 index 0000000000..cf4ca70486 --- /dev/null +++ b/Lang/Odin/Call-a-function-in-a-shared-library @@ -0,0 +1 @@ +../../Task/Call-a-function-in-a-shared-library/Odin \ No newline at end of file diff --git a/Lang/Odin/Character-codes b/Lang/Odin/Character-codes new file mode 120000 index 0000000000..409b8a73d1 --- /dev/null +++ b/Lang/Odin/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Odin \ No newline at end of file diff --git a/Lang/Odin/Color-wheel b/Lang/Odin/Color-wheel new file mode 120000 index 0000000000..5b87562427 --- /dev/null +++ b/Lang/Odin/Color-wheel @@ -0,0 +1 @@ +../../Task/Color-wheel/Odin \ No newline at end of file diff --git a/Lang/Odin/Comments b/Lang/Odin/Comments new file mode 120000 index 0000000000..69505856e6 --- /dev/null +++ b/Lang/Odin/Comments @@ -0,0 +1 @@ +../../Task/Comments/Odin \ No newline at end of file diff --git a/Lang/Odin/Date-format b/Lang/Odin/Date-format new file mode 120000 index 0000000000..63e481d689 --- /dev/null +++ b/Lang/Odin/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Odin \ No newline at end of file diff --git a/Lang/Odin/Disarium-numbers b/Lang/Odin/Disarium-numbers new file mode 120000 index 0000000000..994b840f85 --- /dev/null +++ b/Lang/Odin/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/Odin \ No newline at end of file diff --git a/Lang/Odin/Draw-a-clock b/Lang/Odin/Draw-a-clock new file mode 120000 index 0000000000..b014eb3c8e --- /dev/null +++ b/Lang/Odin/Draw-a-clock @@ -0,0 +1 @@ +../../Task/Draw-a-clock/Odin \ No newline at end of file diff --git a/Lang/Odin/Draw-a-cuboid b/Lang/Odin/Draw-a-cuboid new file mode 120000 index 0000000000..124ff7cfe9 --- /dev/null +++ b/Lang/Odin/Draw-a-cuboid @@ -0,0 +1 @@ +../../Task/Draw-a-cuboid/Odin \ No newline at end of file diff --git a/Lang/Odin/Draw-a-sphere b/Lang/Odin/Draw-a-sphere new file mode 120000 index 0000000000..b20b72cdc0 --- /dev/null +++ b/Lang/Odin/Draw-a-sphere @@ -0,0 +1 @@ +../../Task/Draw-a-sphere/Odin \ No newline at end of file diff --git a/Lang/Odin/Euler-method b/Lang/Odin/Euler-method new file mode 120000 index 0000000000..2085f38551 --- /dev/null +++ b/Lang/Odin/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Odin \ No newline at end of file diff --git a/Lang/Odin/Execute-Brain- b/Lang/Odin/Execute-Brain- new file mode 120000 index 0000000000..748dbb9c99 --- /dev/null +++ b/Lang/Odin/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/Odin \ No newline at end of file diff --git a/Lang/Odin/Fractran b/Lang/Odin/Fractran new file mode 120000 index 0000000000..5bd1840a6a --- /dev/null +++ b/Lang/Odin/Fractran @@ -0,0 +1 @@ +../../Task/Fractran/Odin \ No newline at end of file diff --git a/Lang/Odin/Function-composition b/Lang/Odin/Function-composition new file mode 120000 index 0000000000..27b230f571 --- /dev/null +++ b/Lang/Odin/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/Odin \ No newline at end of file diff --git a/Lang/Odin/Hailstone-sequence b/Lang/Odin/Hailstone-sequence new file mode 120000 index 0000000000..678ea867f0 --- /dev/null +++ b/Lang/Odin/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Odin \ No newline at end of file diff --git a/Lang/Odin/Hello-world-Graphical b/Lang/Odin/Hello-world-Graphical new file mode 120000 index 0000000000..00108512b1 --- /dev/null +++ b/Lang/Odin/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Odin \ No newline at end of file diff --git a/Lang/Odin/Image-noise b/Lang/Odin/Image-noise new file mode 120000 index 0000000000..9b2e03c5b6 --- /dev/null +++ b/Lang/Odin/Image-noise @@ -0,0 +1 @@ +../../Task/Image-noise/Odin \ No newline at end of file diff --git a/Lang/Odin/Musical-scale b/Lang/Odin/Musical-scale new file mode 120000 index 0000000000..cd45a36de9 --- /dev/null +++ b/Lang/Odin/Musical-scale @@ -0,0 +1 @@ +../../Task/Musical-scale/Odin \ No newline at end of file diff --git a/Lang/Odin/One-dimensional-cellular-automata b/Lang/Odin/One-dimensional-cellular-automata new file mode 120000 index 0000000000..5cf45742c4 --- /dev/null +++ b/Lang/Odin/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Odin \ No newline at end of file diff --git a/Lang/Odin/Primality-by-trial-division b/Lang/Odin/Primality-by-trial-division new file mode 120000 index 0000000000..8e356363dd --- /dev/null +++ b/Lang/Odin/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Odin \ No newline at end of file diff --git a/Lang/Odin/Quine b/Lang/Odin/Quine new file mode 120000 index 0000000000..53e4cf3687 --- /dev/null +++ b/Lang/Odin/Quine @@ -0,0 +1 @@ +../../Task/Quine/Odin \ No newline at end of file diff --git a/Lang/Odin/Read-a-configuration-file b/Lang/Odin/Read-a-configuration-file new file mode 120000 index 0000000000..fa189332d6 --- /dev/null +++ b/Lang/Odin/Read-a-configuration-file @@ -0,0 +1 @@ +../../Task/Read-a-configuration-file/Odin \ No newline at end of file diff --git a/Lang/Odin/Reverse-words-in-a-string b/Lang/Odin/Reverse-words-in-a-string new file mode 120000 index 0000000000..9648c360e7 --- /dev/null +++ b/Lang/Odin/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/Odin \ No newline at end of file diff --git a/Lang/Odin/Runge-Kutta-method b/Lang/Odin/Runge-Kutta-method new file mode 120000 index 0000000000..1b9162c995 --- /dev/null +++ b/Lang/Odin/Runge-Kutta-method @@ -0,0 +1 @@ +../../Task/Runge-Kutta-method/Odin \ No newline at end of file diff --git a/Lang/Odin/Sieve-of-Eratosthenes b/Lang/Odin/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..265789a7db --- /dev/null +++ b/Lang/Odin/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/Odin \ No newline at end of file diff --git a/Lang/Odin/Sockets b/Lang/Odin/Sockets new file mode 120000 index 0000000000..ccedc5dd5d --- /dev/null +++ b/Lang/Odin/Sockets @@ -0,0 +1 @@ +../../Task/Sockets/Odin \ No newline at end of file diff --git a/Lang/Odin/Strip-a-set-of-characters-from-a-string b/Lang/Odin/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..b76ef81d13 --- /dev/null +++ b/Lang/Odin/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Odin \ No newline at end of file diff --git a/Lang/Odin/Unicode-variable-names b/Lang/Odin/Unicode-variable-names new file mode 120000 index 0000000000..f070da9637 --- /dev/null +++ b/Lang/Odin/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Odin \ No newline at end of file diff --git a/Lang/Odin/Write-entire-file b/Lang/Odin/Write-entire-file new file mode 120000 index 0000000000..53b4243bae --- /dev/null +++ b/Lang/Odin/Write-entire-file @@ -0,0 +1 @@ +../../Task/Write-entire-file/Odin \ No newline at end of file diff --git a/Lang/Oforth/Quaternion-type b/Lang/Oforth/Quaternion-type deleted file mode 120000 index 51caedda0e..0000000000 --- a/Lang/Oforth/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Oforth \ No newline at end of file diff --git a/Lang/Ol/Convert-decimal-number-to-rational b/Lang/Ol/Convert-decimal-number-to-rational new file mode 120000 index 0000000000..f7e6486ce6 --- /dev/null +++ b/Lang/Ol/Convert-decimal-number-to-rational @@ -0,0 +1 @@ +../../Task/Convert-decimal-number-to-rational/Ol \ No newline at end of file diff --git a/Lang/Ol/Multifactorial b/Lang/Ol/Multifactorial new file mode 120000 index 0000000000..c0b142a608 --- /dev/null +++ b/Lang/Ol/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/Ol \ No newline at end of file diff --git a/Lang/Ol/Population-count b/Lang/Ol/Population-count new file mode 120000 index 0000000000..b38f7ab1ff --- /dev/null +++ b/Lang/Ol/Population-count @@ -0,0 +1 @@ +../../Task/Population-count/Ol \ No newline at end of file diff --git a/Lang/Ol/Quaternion-type b/Lang/Ol/Quaternion-type deleted file mode 120000 index a3e712c033..0000000000 --- a/Lang/Ol/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Ol \ No newline at end of file diff --git a/Lang/Ol/Runge-Kutta-method b/Lang/Ol/Runge-Kutta-method new file mode 120000 index 0000000000..55f8d1bf18 --- /dev/null +++ b/Lang/Ol/Runge-Kutta-method @@ -0,0 +1 @@ +../../Task/Runge-Kutta-method/Ol \ No newline at end of file diff --git a/Lang/OmniMark/00-LANG.txt b/Lang/OmniMark/00-LANG.txt new file mode 100644 index 0000000000..43585c3f19 --- /dev/null +++ b/Lang/OmniMark/00-LANG.txt @@ -0,0 +1,15 @@ +{{language|OmniMark +|tags=omnimark +|site=https://www.stilo.com/omnimark/}} +'''OmniMark''' is a fourth-generation programming language used mostly in the publishing industry. It is currently a proprietary software product of Stilo International. The most recent release of OmniMark is 12.0 (as at 2024-06-25). + +For a brief period, in 1999-2000, OmniMark was available free of charge (versions 4 and 5, including a 'Lite edition' of version 4, which was limited to 200 actions). + +==Links== +* [[wp:OmniMark|Omnimark in Wikipedia]] +* [https://developers.stilo.com/docs/html/index.html Version 12.0 documentation] +* [https://developers.stilo.com/documentation/docs/html/index.htm Version 6.5 documentation] +* [https://developers.stilo.com/documentation/v4r0/index.htm Version 4.0 documentation] + +==Todo== +* [[Tasks not implemented in OmniMark]] \ No newline at end of file diff --git a/Lang/OmniMark/00-META.yaml b/Lang/OmniMark/00-META.yaml new file mode 100644 index 0000000000..4f47c1011a --- /dev/null +++ b/Lang/OmniMark/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:OmniMark diff --git a/Lang/OmniMark/100-doors b/Lang/OmniMark/100-doors new file mode 120000 index 0000000000..97ec6d7965 --- /dev/null +++ b/Lang/OmniMark/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Array-concatenation b/Lang/OmniMark/Array-concatenation new file mode 120000 index 0000000000..826b17e39e --- /dev/null +++ b/Lang/OmniMark/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Array-length b/Lang/OmniMark/Array-length new file mode 120000 index 0000000000..47ea995113 --- /dev/null +++ b/Lang/OmniMark/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/CSV-to-HTML-translation b/Lang/OmniMark/CSV-to-HTML-translation new file mode 120000 index 0000000000..78c14aa62b --- /dev/null +++ b/Lang/OmniMark/CSV-to-HTML-translation @@ -0,0 +1 @@ +../../Task/CSV-to-HTML-translation/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Caesar-cipher b/Lang/OmniMark/Caesar-cipher new file mode 120000 index 0000000000..abca569385 --- /dev/null +++ b/Lang/OmniMark/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Camel-case-and-snake-case b/Lang/OmniMark/Camel-case-and-snake-case new file mode 120000 index 0000000000..977f7a6fec --- /dev/null +++ b/Lang/OmniMark/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Determine-if-a-string-has-all-the-same-characters b/Lang/OmniMark/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..c1672ea012 --- /dev/null +++ b/Lang/OmniMark/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Hello-world-Standard-error b/Lang/OmniMark/Hello-world-Standard-error new file mode 120000 index 0000000000..8ef2028e3a --- /dev/null +++ b/Lang/OmniMark/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Hex-words b/Lang/OmniMark/Hex-words new file mode 120000 index 0000000000..b43e37ad28 --- /dev/null +++ b/Lang/OmniMark/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/ISBN13-check-digit b/Lang/OmniMark/ISBN13-check-digit new file mode 120000 index 0000000000..5629e040c9 --- /dev/null +++ b/Lang/OmniMark/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Input-loop b/Lang/OmniMark/Input-loop new file mode 120000 index 0000000000..c2f5884755 --- /dev/null +++ b/Lang/OmniMark/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Repeat-a-string b/Lang/OmniMark/Repeat-a-string new file mode 120000 index 0000000000..a5c79bdf8d --- /dev/null +++ b/Lang/OmniMark/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Reverse-a-string b/Lang/OmniMark/Reverse-a-string new file mode 120000 index 0000000000..ac30e9d9f0 --- /dev/null +++ b/Lang/OmniMark/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Rot-13 b/Lang/OmniMark/Rot-13 new file mode 120000 index 0000000000..34ecde427b --- /dev/null +++ b/Lang/OmniMark/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Strip-control-codes-and-extended-characters-from-a-string b/Lang/OmniMark/Strip-control-codes-and-extended-characters-from-a-string new file mode 120000 index 0000000000..e108d513e0 --- /dev/null +++ b/Lang/OmniMark/Strip-control-codes-and-extended-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-control-codes-and-extended-characters-from-a-string/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Substring b/Lang/OmniMark/Substring new file mode 120000 index 0000000000..3eb9323ac2 --- /dev/null +++ b/Lang/OmniMark/Substring @@ -0,0 +1 @@ +../../Task/Substring/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/Substring-Top-and-tail b/Lang/OmniMark/Substring-Top-and-tail new file mode 120000 index 0000000000..b88887f219 --- /dev/null +++ b/Lang/OmniMark/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/OmniMark \ No newline at end of file diff --git a/Lang/OmniMark/XML-Input b/Lang/OmniMark/XML-Input new file mode 120000 index 0000000000..56ac42b963 --- /dev/null +++ b/Lang/OmniMark/XML-Input @@ -0,0 +1 @@ +../../Task/XML-Input/OmniMark \ No newline at end of file diff --git a/Lang/Onyx-(wasm)/00-LANG.txt b/Lang/Onyx-(wasm)/00-LANG.txt new file mode 100644 index 0000000000..6a2ea0147f --- /dev/null +++ b/Lang/Onyx-(wasm)/00-LANG.txt @@ -0,0 +1,22 @@ +{{stub}}{{language|site=https://onyxlang.io/}} +Onyx is a WebAssembly-first language (`app.wasm`). WebAssembly can be used inside of a browser but is also growing in popularity outside of the browser, in part due to projects like Wasmer, Wasmtime, and WasmEdge. These "controlled environments" could be game engines, where WASM is used as a "script" system; cloud functions, where WASM is used to respond to requests; plug-in systems for editors or tools. + +Onyx uses a modernized C-like syntax, similar to Jai or Odin. Onyx is an imperative and procedural language in which statements are evaluated in the order they are written in, but does allow for functional-inspired syntax using the pipe operator. + +For example: + + +use core { printf, iter } + +main :: () { + for i in 1 .. 10 { + fact := factorial(i); + printf("{}! = {}\n", i, fact); + } +} + +factorial :: (n: i32) -> i32 { + return iter.as_iter(1 .. n) + |> iter.fold(1, (x, y) => x * y); +} + \ No newline at end of file diff --git a/Lang/Onyx-(wasm)/00-META.yaml b/Lang/Onyx-(wasm)/00-META.yaml new file mode 100644 index 0000000000..cbf74e8a1e --- /dev/null +++ b/Lang/Onyx-(wasm)/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Onyx_(wasm) diff --git a/Lang/Onyx-(wasm)/Almost-prime b/Lang/Onyx-(wasm)/Almost-prime new file mode 120000 index 0000000000..3d86cd989b --- /dev/null +++ b/Lang/Onyx-(wasm)/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Onyx-(wasm) \ No newline at end of file diff --git a/Lang/Onyx-(wasm)/Fibonacci-sequence b/Lang/Onyx-(wasm)/Fibonacci-sequence new file mode 120000 index 0000000000..301a591a51 --- /dev/null +++ b/Lang/Onyx-(wasm)/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Onyx-(wasm) \ No newline at end of file diff --git a/Lang/Onyx-(wasm)/FizzBuzz b/Lang/Onyx-(wasm)/FizzBuzz new file mode 120000 index 0000000000..83ae85030d --- /dev/null +++ b/Lang/Onyx-(wasm)/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Onyx-(wasm) \ No newline at end of file diff --git a/Lang/Onyx-(wasm)/Golden-ratio-Convergence b/Lang/Onyx-(wasm)/Golden-ratio-Convergence new file mode 120000 index 0000000000..9188efefa7 --- /dev/null +++ b/Lang/Onyx-(wasm)/Golden-ratio-Convergence @@ -0,0 +1 @@ +../../Task/Golden-ratio-Convergence/Onyx-(wasm) \ No newline at end of file diff --git a/Lang/Onyx-(wasm)/Hailstone-sequence b/Lang/Onyx-(wasm)/Hailstone-sequence new file mode 120000 index 0000000000..6121175067 --- /dev/null +++ b/Lang/Onyx-(wasm)/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Onyx-(wasm) \ No newline at end of file diff --git a/Lang/Onyx-(wasm)/Hello-world-Text b/Lang/Onyx-(wasm)/Hello-world-Text new file mode 120000 index 0000000000..016c47abd8 --- /dev/null +++ b/Lang/Onyx-(wasm)/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Onyx-(wasm) \ No newline at end of file diff --git a/Lang/OoRexx/00-LANG.txt b/Lang/OoRexx/00-LANG.txt index 8031f8ae00..84a3f74109 100644 --- a/Lang/OoRexx/00-LANG.txt +++ b/Lang/OoRexx/00-LANG.txt @@ -10,4 +10,7 @@ open sourced, maintained by the [http://www.rexxla.org/ Rexx Language Associatio ooRexx can be used to run many programs shown here in the [[REXX]] category. See http://rosettacode.org/wiki/Rosetta_Code:Village_Pump/Dialects#REXX.2C_ooRexx.2C_and_others -for differences. \ No newline at end of file +for differences. + +== Rosetta Code tasks not implemented in OoRexx == +[[Tasks not implemented in OoRexx]] \ No newline at end of file diff --git a/Lang/OoRexx/Giuga-numbers b/Lang/OoRexx/Giuga-numbers new file mode 120000 index 0000000000..86fe47decb --- /dev/null +++ b/Lang/OoRexx/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/OoRexx \ No newline at end of file diff --git a/Lang/OoRexx/Nth-root b/Lang/OoRexx/Nth-root new file mode 120000 index 0000000000..05543d43a8 --- /dev/null +++ b/Lang/OoRexx/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/OoRexx \ No newline at end of file diff --git a/Lang/OoRexx/Prime-decomposition b/Lang/OoRexx/Prime-decomposition new file mode 120000 index 0000000000..f16b4825fb --- /dev/null +++ b/Lang/OoRexx/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/OoRexx \ No newline at end of file diff --git a/Lang/OoRexx/Quaternion-type b/Lang/OoRexx/Quaternion-type deleted file mode 120000 index be3652b55d..0000000000 --- a/Lang/OoRexx/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/OoRexx \ No newline at end of file diff --git a/Lang/OoRexx/Ramer-Douglas-Peucker-line-simplification b/Lang/OoRexx/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..b97748aa44 --- /dev/null +++ b/Lang/OoRexx/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/OoRexx \ No newline at end of file diff --git a/Lang/OoRexx/Sorting-algorithms-Merge-sort b/Lang/OoRexx/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..ae6f4594d4 --- /dev/null +++ b/Lang/OoRexx/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/OoRexx \ No newline at end of file diff --git a/Lang/OoRexx/Temperature-conversion b/Lang/OoRexx/Temperature-conversion new file mode 120000 index 0000000000..dc621ac534 --- /dev/null +++ b/Lang/OoRexx/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/OoRexx \ No newline at end of file diff --git a/Lang/Openscad/Empty-program b/Lang/Openscad/Empty-program deleted file mode 120000 index 89182791e6..0000000000 --- a/Lang/Openscad/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Openscad \ No newline at end of file diff --git a/Lang/OxygenBasic/Array-length b/Lang/OxygenBasic/Array-length new file mode 120000 index 0000000000..00db990da9 --- /dev/null +++ b/Lang/OxygenBasic/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Blum-integer b/Lang/OxygenBasic/Blum-integer new file mode 120000 index 0000000000..343ecf7af1 --- /dev/null +++ b/Lang/OxygenBasic/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Cullen-and-Woodall-numbers b/Lang/OxygenBasic/Cullen-and-Woodall-numbers new file mode 120000 index 0000000000..75020e6fa5 --- /dev/null +++ b/Lang/OxygenBasic/Cullen-and-Woodall-numbers @@ -0,0 +1 @@ +../../Task/Cullen-and-Woodall-numbers/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Determine-if-a-string-has-all-the-same-characters b/Lang/OxygenBasic/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..5577d0b0ab --- /dev/null +++ b/Lang/OxygenBasic/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Diversity-prediction-theorem b/Lang/OxygenBasic/Diversity-prediction-theorem new file mode 120000 index 0000000000..e07716f11a --- /dev/null +++ b/Lang/OxygenBasic/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Eban-numbers b/Lang/OxygenBasic/Eban-numbers new file mode 120000 index 0000000000..4b362db2df --- /dev/null +++ b/Lang/OxygenBasic/Eban-numbers @@ -0,0 +1 @@ +../../Task/Eban-numbers/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Evaluate-binomial-coefficients b/Lang/OxygenBasic/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..2fc6117dc9 --- /dev/null +++ b/Lang/OxygenBasic/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/FizzBuzz b/Lang/OxygenBasic/FizzBuzz new file mode 120000 index 0000000000..7f3e716c79 --- /dev/null +++ b/Lang/OxygenBasic/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Generate-lower-case-ASCII-alphabet b/Lang/OxygenBasic/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..dc06638a04 --- /dev/null +++ b/Lang/OxygenBasic/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Hello-world-Newline-omission b/Lang/OxygenBasic/Hello-world-Newline-omission new file mode 120000 index 0000000000..b315730342 --- /dev/null +++ b/Lang/OxygenBasic/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Hello-world-Text b/Lang/OxygenBasic/Hello-world-Text new file mode 120000 index 0000000000..0286beeff0 --- /dev/null +++ b/Lang/OxygenBasic/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Hofstadter-Q-sequence b/Lang/OxygenBasic/Hofstadter-Q-sequence new file mode 120000 index 0000000000..99d7dde29e --- /dev/null +++ b/Lang/OxygenBasic/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Jewels-and-stones b/Lang/OxygenBasic/Jewels-and-stones new file mode 120000 index 0000000000..af9c0e197d --- /dev/null +++ b/Lang/OxygenBasic/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Josephus-problem b/Lang/OxygenBasic/Josephus-problem new file mode 120000 index 0000000000..26c79416e6 --- /dev/null +++ b/Lang/OxygenBasic/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Leonardo-numbers b/Lang/OxygenBasic/Leonardo-numbers new file mode 120000 index 0000000000..9d8949a99b --- /dev/null +++ b/Lang/OxygenBasic/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Loops-Continue b/Lang/OxygenBasic/Loops-Continue new file mode 120000 index 0000000000..df4c4e529e --- /dev/null +++ b/Lang/OxygenBasic/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Numbers-with-equal-rises-and-falls b/Lang/OxygenBasic/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..0060a020b0 --- /dev/null +++ b/Lang/OxygenBasic/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Primality-by-trial-division b/Lang/OxygenBasic/Primality-by-trial-division new file mode 120000 index 0000000000..90df6937ed --- /dev/null +++ b/Lang/OxygenBasic/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Repeat b/Lang/OxygenBasic/Repeat new file mode 120000 index 0000000000..56b4dec43d --- /dev/null +++ b/Lang/OxygenBasic/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Sudan-function b/Lang/OxygenBasic/Sudan-function new file mode 120000 index 0000000000..05a812bb81 --- /dev/null +++ b/Lang/OxygenBasic/Sudan-function @@ -0,0 +1 @@ +../../Task/Sudan-function/OxygenBasic \ No newline at end of file diff --git a/Lang/OxygenBasic/Tau-number b/Lang/OxygenBasic/Tau-number new file mode 120000 index 0000000000..4f73054594 --- /dev/null +++ b/Lang/OxygenBasic/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/OxygenBasic \ No newline at end of file diff --git a/Lang/Oz/FizzBuzz b/Lang/Oz/FizzBuzz deleted file mode 120000 index 287980acd6..0000000000 --- a/Lang/Oz/FizzBuzz +++ /dev/null @@ -1 +0,0 @@ -../../Task/FizzBuzz/Oz \ No newline at end of file diff --git a/Lang/Oz/Miller-Rabin-primality-test b/Lang/Oz/Miller-Rabin-primality-test deleted file mode 120000 index e6999d8858..0000000000 --- a/Lang/Oz/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Oz \ No newline at end of file diff --git a/Lang/PARI-GP/00-LANG.txt b/Lang/PARI-GP/00-LANG.txt index bacfec6d7d..81b37f3de6 100644 --- a/Lang/PARI-GP/00-LANG.txt +++ b/Lang/PARI-GP/00-LANG.txt @@ -17,7 +17,7 @@ PARI/GP is a widely used computer algebra system designed for fast computations PARI/GP is composed of two parts: a [[C]] library called PARI and an interface, gp, to this library. GP scripts are concise, easy to write, and resemble mathematical language. (Terminology: the scripting language of gp is called GP.) -PARI was written by Henri Cohen and others at Université de Bordeaux and is now maintained by Karim Belabas. gp was originally written by Dominique Bernardi, then maintained and enhanced by Karim Belabas and Ilya Zakharevich, and finally rewritten by Bill Allombert. +PARI was written by Henri Cohen and others at Université de Bordeaux; Aurel Page is the current project leader. gp was originally written by Dominique Bernardi, then maintained and enhanced by Karim Belabas and Ilya Zakharevich, and finally rewritten by Bill Allombert. == Getting PARI/GP == PARI/GP can be used in many different operating systems. This is a reasonably comprehensive list of currently-supported systems; for other systems, please use the [https://pari.math.u-bordeaux.fr/lists-index.html mailing lists]. @@ -219,12 +219,16 @@ If you want to program with PARI, many languages are supported: ** [https://pari.math.u-bordeaux.fr/Events/PARI2017c/talks/TAN2.pdf Théorie algébrique des nombres avancée] (22 pp.) ** [https://pari.math.u-bordeaux.fr/Events/PARI2017c/talks/ecc.pdf Courbes elliptiques sur les corps finis] (4 pp.) *[http://w3.countnumber.de/fischer/res-ZT2007/PariByExample.pdf Erste Schritte mit PARI/GP] by Lars Fischer (13 pp., 2007; German) -*[https://www.youtube.com/watch?v=I_GfMUGAlns Pari Gp مع NotPad++] by NoorDeen Rahmani (2020; 2:46; Arabic) -- setting up Notepad++ for syntax highlighting for PARI/GP. +* [https://www.youtube.com/watch?v=I_GfMUGAlns Pari Gp مع NotPad++] by NoorDeen Rahmani (2020; 2:46; Arabic) -- setting up Notepad++ for syntax highlighting for PARI/GP. ==== Video tutorials ==== * [https://www.youtube.com/watch?v=RQLqQHu7i0Y Pari/GP Tutorial: Basics] by Leandro Junes (2020, 19:04) -*[https://www.youtube.com/watch?v=FeG0BYRrDOE&t=12m Video demo of RSA in PARI/GP] by Maren1955 (2014, 17:39) -*Video tutorials, parts [http://www.youtube.com/watch?v=0G-9JzlrzBM 1] [http://www.youtube.com/watch?v=d7i0rv59hns 2] [http://www.youtube.com/watch?v=wCyU2n-G-pk 3] [http://www.youtube.com/watch?v=WOCuBvK8O6Q 4] (2011, appx. 20 minutes) +* [https://www.youtube.com/watch?v=FeG0BYRrDOE&t=12m Video demo of RSA in PARI/GP] by Maren1955 (2014, 17:39) +* Video tutorials, parts [http://www.youtube.com/watch?v=0G-9JzlrzBM 1] [http://www.youtube.com/watch?v=d7i0rv59hns 2] [http://www.youtube.com/watch?v=wCyU2n-G-pk 3] [http://www.youtube.com/watch?v=WOCuBvK8O6Q 4] (2011, appx. 20 minutes) + +== Syntax highlighting == +* [https://github.com/notepad-plus-plus/userDefinedLanguages/blob/master/UDLs/PARI-GP_by-third_maths.xml Notepad++] +* [https://www.youtube.com/watch?v=I_GfMUGAlns Pari Gp مع NotPad++] (Arabic tutorial) === Papers on PARI/GP === * Karim Belabas and Henri Cohen, [https://arxiv.org/abs/1810.00547 Modular Forms in Pari/GP], ''Research in the Mathematical Sciences'' '''5''':37 (2018) diff --git a/Lang/PARI-GP/4-rings-or-4-squares-puzzle b/Lang/PARI-GP/4-rings-or-4-squares-puzzle new file mode 120000 index 0000000000..b8cfa5a07c --- /dev/null +++ b/Lang/PARI-GP/4-rings-or-4-squares-puzzle @@ -0,0 +1 @@ +../../Task/4-rings-or-4-squares-puzzle/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Achilles-numbers b/Lang/PARI-GP/Achilles-numbers new file mode 120000 index 0000000000..73f3f645b5 --- /dev/null +++ b/Lang/PARI-GP/Achilles-numbers @@ -0,0 +1 @@ +../../Task/Achilles-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Almkvist-Giullera-formula-for-pi b/Lang/PARI-GP/Almkvist-Giullera-formula-for-pi new file mode 120000 index 0000000000..53d950c5f0 --- /dev/null +++ b/Lang/PARI-GP/Almkvist-Giullera-formula-for-pi @@ -0,0 +1 @@ +../../Task/Almkvist-Giullera-formula-for-pi/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Attractive-numbers b/Lang/PARI-GP/Attractive-numbers new file mode 120000 index 0000000000..9c5ab01706 --- /dev/null +++ b/Lang/PARI-GP/Attractive-numbers @@ -0,0 +1 @@ +../../Task/Attractive-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Bell-numbers b/Lang/PARI-GP/Bell-numbers new file mode 120000 index 0000000000..c0de777713 --- /dev/null +++ b/Lang/PARI-GP/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Calkin-Wilf-sequence b/Lang/PARI-GP/Calkin-Wilf-sequence new file mode 120000 index 0000000000..5260a08bc6 --- /dev/null +++ b/Lang/PARI-GP/Calkin-Wilf-sequence @@ -0,0 +1 @@ +../../Task/Calkin-Wilf-sequence/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Chowla-numbers b/Lang/PARI-GP/Chowla-numbers new file mode 120000 index 0000000000..2787fa8eac --- /dev/null +++ b/Lang/PARI-GP/Chowla-numbers @@ -0,0 +1 @@ +../../Task/Chowla-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k b/Lang/PARI-GP/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k new file mode 120000 index 0000000000..ce686eae22 --- /dev/null +++ b/Lang/PARI-GP/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k @@ -0,0 +1 @@ +../../Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Cuban-primes b/Lang/PARI-GP/Cuban-primes new file mode 120000 index 0000000000..9fcb6d862c --- /dev/null +++ b/Lang/PARI-GP/Cuban-primes @@ -0,0 +1 @@ +../../Task/Cuban-primes/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Cullen-and-Woodall-numbers b/Lang/PARI-GP/Cullen-and-Woodall-numbers new file mode 120000 index 0000000000..b88f4c7aa7 --- /dev/null +++ b/Lang/PARI-GP/Cullen-and-Woodall-numbers @@ -0,0 +1 @@ +../../Task/Cullen-and-Woodall-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Curzon-numbers b/Lang/PARI-GP/Curzon-numbers new file mode 120000 index 0000000000..f077d65bb8 --- /dev/null +++ b/Lang/PARI-GP/Curzon-numbers @@ -0,0 +1 @@ +../../Task/Curzon-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Disarium-numbers b/Lang/PARI-GP/Disarium-numbers new file mode 120000 index 0000000000..e21e95674b --- /dev/null +++ b/Lang/PARI-GP/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Duffinian-numbers b/Lang/PARI-GP/Duffinian-numbers new file mode 120000 index 0000000000..2058b3fcc8 --- /dev/null +++ b/Lang/PARI-GP/Duffinian-numbers @@ -0,0 +1 @@ +../../Task/Duffinian-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Egyptian-division b/Lang/PARI-GP/Egyptian-division new file mode 120000 index 0000000000..a72d5a169a --- /dev/null +++ b/Lang/PARI-GP/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Empty-program b/Lang/PARI-GP/Empty-program deleted file mode 120000 index e5621857fc..0000000000 --- a/Lang/PARI-GP/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Fermat-numbers b/Lang/PARI-GP/Fermat-numbers new file mode 120000 index 0000000000..79fb20086b --- /dev/null +++ b/Lang/PARI-GP/Fermat-numbers @@ -0,0 +1 @@ +../../Task/Fermat-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Gapful-numbers b/Lang/PARI-GP/Gapful-numbers new file mode 120000 index 0000000000..a3ce3c2de1 --- /dev/null +++ b/Lang/PARI-GP/Gapful-numbers @@ -0,0 +1 @@ +../../Task/Gapful-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Giuga-numbers b/Lang/PARI-GP/Giuga-numbers new file mode 120000 index 0000000000..0de2f922cb --- /dev/null +++ b/Lang/PARI-GP/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Home-primes b/Lang/PARI-GP/Home-primes new file mode 120000 index 0000000000..e40e4d05cb --- /dev/null +++ b/Lang/PARI-GP/Home-primes @@ -0,0 +1 @@ +../../Task/Home-primes/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Jacobsthal-numbers b/Lang/PARI-GP/Jacobsthal-numbers new file mode 120000 index 0000000000..f9a4f5ef3a --- /dev/null +++ b/Lang/PARI-GP/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/M-bius-function b/Lang/PARI-GP/M-bius-function new file mode 120000 index 0000000000..00d7d87a25 --- /dev/null +++ b/Lang/PARI-GP/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Meissel-Mertens-constant b/Lang/PARI-GP/Meissel-Mertens-constant deleted file mode 120000 index b03a10e2fd..0000000000 --- a/Lang/PARI-GP/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Miller-Rabin-primality-test b/Lang/PARI-GP/Miller-Rabin-primality-test deleted file mode 120000 index 6c17b6de21..0000000000 --- a/Lang/PARI-GP/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Pell-numbers b/Lang/PARI-GP/Pell-numbers new file mode 120000 index 0000000000..6dc31a644a --- /dev/null +++ b/Lang/PARI-GP/Pell-numbers @@ -0,0 +1 @@ +../../Task/Pell-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Pisano-period b/Lang/PARI-GP/Pisano-period new file mode 120000 index 0000000000..983f75fe6c --- /dev/null +++ b/Lang/PARI-GP/Pisano-period @@ -0,0 +1 @@ +../../Task/Pisano-period/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Prime-numbers-whose-neighboring-pairs-are-tetraprimes b/Lang/PARI-GP/Prime-numbers-whose-neighboring-pairs-are-tetraprimes new file mode 120000 index 0000000000..497a956889 --- /dev/null +++ b/Lang/PARI-GP/Prime-numbers-whose-neighboring-pairs-are-tetraprimes @@ -0,0 +1 @@ +../../Task/Prime-numbers-whose-neighboring-pairs-are-tetraprimes/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Quaternion-type b/Lang/PARI-GP/Quaternion-type deleted file mode 120000 index 87636fd8d1..0000000000 --- a/Lang/PARI-GP/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Repunit-primes b/Lang/PARI-GP/Repunit-primes new file mode 120000 index 0000000000..a51827e876 --- /dev/null +++ b/Lang/PARI-GP/Repunit-primes @@ -0,0 +1 @@ +../../Task/Repunit-primes/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Rhonda-numbers b/Lang/PARI-GP/Rhonda-numbers new file mode 120000 index 0000000000..d7d56fca21 --- /dev/null +++ b/Lang/PARI-GP/Rhonda-numbers @@ -0,0 +1 @@ +../../Task/Rhonda-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Sorting-Algorithms-Circle-Sort b/Lang/PARI-GP/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 2e42235ea5..0000000000 --- a/Lang/PARI-GP/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Tau-number b/Lang/PARI-GP/Tau-number new file mode 120000 index 0000000000..5b5ff3f6d3 --- /dev/null +++ b/Lang/PARI-GP/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Tonelli-Shanks-algorithm b/Lang/PARI-GP/Tonelli-Shanks-algorithm new file mode 120000 index 0000000000..de551c5a5b --- /dev/null +++ b/Lang/PARI-GP/Tonelli-Shanks-algorithm @@ -0,0 +1 @@ +../../Task/Tonelli-Shanks-algorithm/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Wilson-primes-of-order-n b/Lang/PARI-GP/Wilson-primes-of-order-n new file mode 120000 index 0000000000..000578cd52 --- /dev/null +++ b/Lang/PARI-GP/Wilson-primes-of-order-n @@ -0,0 +1 @@ +../../Task/Wilson-primes-of-order-n/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Yellowstone-sequence b/Lang/PARI-GP/Yellowstone-sequence new file mode 120000 index 0000000000..a7645262be --- /dev/null +++ b/Lang/PARI-GP/Yellowstone-sequence @@ -0,0 +1 @@ +../../Task/Yellowstone-sequence/PARI-GP \ No newline at end of file diff --git a/Lang/PARI-GP/Zumkeller-numbers b/Lang/PARI-GP/Zumkeller-numbers new file mode 120000 index 0000000000..8e9fc8c2bd --- /dev/null +++ b/Lang/PARI-GP/Zumkeller-numbers @@ -0,0 +1 @@ +../../Task/Zumkeller-numbers/PARI-GP \ No newline at end of file diff --git a/Lang/PHP/00-LANG.txt b/Lang/PHP/00-LANG.txt index ad1d2b043d..894fa89337 100644 --- a/Lang/PHP/00-LANG.txt +++ b/Lang/PHP/00-LANG.txt @@ -13,4 +13,13 @@ '''PHP''' (PHP: Hypertext Preprocessor) is a [[reflective programming]] language originally designed for producing dynamic Web pages. PHP is used mainly in server-side application software, but can be used from a command line interface or in standalone graphical applications. ==Citations== -* [[wp:PHP|Wikipedia:PHP]] \ No newline at end of file +* [[wp:PHP|Wikipedia:PHP]] + +==External links== +=== Online compilers === +* [https://onlinephp.io/ PHP Sandbox - Execute PHP code online through your browser] (online compiler) +* [https://www.mycompiler.io/new/php Create a new PHP program - myCompiler - myCompiler] (online compiler) + +=== Tutorials and manuals === +* [https://www.w3schools.com/php/default.asp PHP Tutorial] on [https://www.w3schools.com www.w3schools.com] +* [https://www.geeksforgeeks.org/php/php-tutorial/ PHP Tutorial - GeeksforGeeks] \ No newline at end of file diff --git a/Lang/PHP/AKS-test-for-primes b/Lang/PHP/AKS-test-for-primes new file mode 120000 index 0000000000..e35d324f89 --- /dev/null +++ b/Lang/PHP/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/PHP \ No newline at end of file diff --git a/Lang/PHP/Abbreviations-automatic b/Lang/PHP/Abbreviations-automatic new file mode 120000 index 0000000000..30112aa9b6 --- /dev/null +++ b/Lang/PHP/Abbreviations-automatic @@ -0,0 +1 @@ +../../Task/Abbreviations-automatic/PHP \ No newline at end of file diff --git a/Lang/PHP/Abundant-deficient-and-perfect-number-classifications b/Lang/PHP/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..c5476da28d --- /dev/null +++ b/Lang/PHP/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/PHP \ No newline at end of file diff --git a/Lang/PHP/Abundant-odd-numbers b/Lang/PHP/Abundant-odd-numbers new file mode 120000 index 0000000000..c610a0d9cd --- /dev/null +++ b/Lang/PHP/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/PHP \ No newline at end of file diff --git a/Lang/PHP/Angle-difference-between-two-bearings b/Lang/PHP/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..357602b50f --- /dev/null +++ b/Lang/PHP/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/PHP \ No newline at end of file diff --git a/Lang/PHP/Arithmetic-numbers b/Lang/PHP/Arithmetic-numbers new file mode 120000 index 0000000000..21fbcc7304 --- /dev/null +++ b/Lang/PHP/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/PHP \ No newline at end of file diff --git a/Lang/PHP/Bell-numbers b/Lang/PHP/Bell-numbers new file mode 120000 index 0000000000..879d53dae5 --- /dev/null +++ b/Lang/PHP/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/PHP \ No newline at end of file diff --git a/Lang/PHP/Brazilian-numbers b/Lang/PHP/Brazilian-numbers new file mode 120000 index 0000000000..5bd899327e --- /dev/null +++ b/Lang/PHP/Brazilian-numbers @@ -0,0 +1 @@ +../../Task/Brazilian-numbers/PHP \ No newline at end of file diff --git a/Lang/PHP/Diversity-prediction-theorem b/Lang/PHP/Diversity-prediction-theorem new file mode 120000 index 0000000000..a50f50e661 --- /dev/null +++ b/Lang/PHP/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/PHP \ No newline at end of file diff --git a/Lang/PHP/Gamma-function b/Lang/PHP/Gamma-function new file mode 120000 index 0000000000..4d00e2f50d --- /dev/null +++ b/Lang/PHP/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/PHP \ No newline at end of file diff --git a/Lang/PHP/Horizontal-sundial-calculations b/Lang/PHP/Horizontal-sundial-calculations new file mode 120000 index 0000000000..a385f37a68 --- /dev/null +++ b/Lang/PHP/Horizontal-sundial-calculations @@ -0,0 +1 @@ +../../Task/Horizontal-sundial-calculations/PHP \ No newline at end of file diff --git a/Lang/PHP/Leonardo-numbers b/Lang/PHP/Leonardo-numbers new file mode 120000 index 0000000000..4b3cefd6f0 --- /dev/null +++ b/Lang/PHP/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/PHP \ No newline at end of file diff --git a/Lang/PHP/M-bius-function b/Lang/PHP/M-bius-function new file mode 120000 index 0000000000..6f4e3a47bb --- /dev/null +++ b/Lang/PHP/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/PHP \ No newline at end of file diff --git a/Lang/PHP/Magic-constant b/Lang/PHP/Magic-constant new file mode 120000 index 0000000000..b67d20fb19 --- /dev/null +++ b/Lang/PHP/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/PHP \ No newline at end of file diff --git a/Lang/PHP/Map-range b/Lang/PHP/Map-range new file mode 120000 index 0000000000..07d5696e85 --- /dev/null +++ b/Lang/PHP/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/PHP \ No newline at end of file diff --git a/Lang/PHP/Miller-Rabin-primality-test b/Lang/PHP/Miller-Rabin-primality-test deleted file mode 120000 index bff04d1a83..0000000000 --- a/Lang/PHP/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/PHP \ No newline at end of file diff --git a/Lang/PHP/Multifactorial b/Lang/PHP/Multifactorial new file mode 120000 index 0000000000..a4051140a1 --- /dev/null +++ b/Lang/PHP/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/PHP \ No newline at end of file diff --git a/Lang/PHP/Partial-function-application b/Lang/PHP/Partial-function-application new file mode 120000 index 0000000000..8596466c3e --- /dev/null +++ b/Lang/PHP/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/PHP \ No newline at end of file diff --git a/Lang/PHP/Prime-decomposition b/Lang/PHP/Prime-decomposition new file mode 120000 index 0000000000..6265ac9618 --- /dev/null +++ b/Lang/PHP/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/PHP \ No newline at end of file diff --git a/Lang/PHP/Square-free-integers b/Lang/PHP/Square-free-integers new file mode 120000 index 0000000000..49d9fb45c0 --- /dev/null +++ b/Lang/PHP/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/PHP \ No newline at end of file diff --git a/Lang/PHP/Statistics-Basic b/Lang/PHP/Statistics-Basic new file mode 120000 index 0000000000..199b45c315 --- /dev/null +++ b/Lang/PHP/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/PHP \ No newline at end of file diff --git a/Lang/PHP/Statistics-Normal-distribution b/Lang/PHP/Statistics-Normal-distribution new file mode 120000 index 0000000000..e8fce08a80 --- /dev/null +++ b/Lang/PHP/Statistics-Normal-distribution @@ -0,0 +1 @@ +../../Task/Statistics-Normal-distribution/PHP \ No newline at end of file diff --git a/Lang/PHP/Tau-number b/Lang/PHP/Tau-number new file mode 120000 index 0000000000..67a4445d30 --- /dev/null +++ b/Lang/PHP/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/PHP \ No newline at end of file diff --git a/Lang/PHP/Water-collected-between-towers b/Lang/PHP/Water-collected-between-towers new file mode 120000 index 0000000000..524c5ae99b --- /dev/null +++ b/Lang/PHP/Water-collected-between-towers @@ -0,0 +1 @@ +../../Task/Water-collected-between-towers/PHP \ No newline at end of file diff --git a/Lang/PILOT/00-LANG.txt b/Lang/PILOT/00-LANG.txt index 742582e7c0..5e238de7ae 100644 --- a/Lang/PILOT/00-LANG.txt +++ b/Lang/PILOT/00-LANG.txt @@ -9,4 +9,6 @@ NO:Sorry, it was Napoleon Bonaparte. PILOT was also marketed in the 1980s as a first programming language for children and beginners, including in extended versions supporting turtle graphics; and it even found use as a scripting language under CP/M. -Keywords—written in block capitals in the example above—are case-insensitive and can usually be abbreviated to one or two letters (T for TYPE, JM for JUMPMATCH). The only data types supported are strings and integers. \ No newline at end of file +Keywords—written in block capitals in the example above—are case-insensitive and can usually be abbreviated to one or two letters (T for TYPE, JM for JUMPMATCH). The only data types supported are strings and integers. +=== External Links === +[https://handwiki.org/wiki/PILOT HandWiki PILOT], where you can find a list of PILOT implementations. \ No newline at end of file diff --git a/Lang/PL-0/00-LANG.txt b/Lang/PL-0/00-LANG.txt index 22766fddb9..b9e87d1426 100644 --- a/Lang/PL-0/00-LANG.txt +++ b/Lang/PL-0/00-LANG.txt @@ -1,13 +1,13 @@ {{language|PL/0 |tags=pl0}} -'''PL/0''' is an educational programming language. It was originally introduced in the book, ''Algorithms + Data Structures = Programs'', by [[Niklaus Wirth]] in 1976. Wirth uses PL/0 as an example of how to construct a compiler. This language has little constructs. Writing real applications in PL/0 is not practical, but the compiler can remain compact and simple. +'''PL/0''' is an educational programming language. It was originally introduced in the book, ''Algorithms + Data Structures = Programs'', by [[Niklaus Wirth]] in 1976. Wirth uses PL/0 as an example of how to construct a compiler. This language has simple constructs. Writing real applications in PL/0 is not practical, but the compiler can remain compact and simple. == Features == One must explicitly declare all used constants and variables. -The only data type are integer numbers. The only operators are arithmetical and comparison ones. There is a function odd which examines if the integer argument is odd. +The only data type is integer. The only operators are arithmetical and comparisons. There is a function odd that examines if its integer argument is odd. -In the original implementation presented by Wirth, there are no input and output routines. The interpreter prints the new value of each variable when it becomes changed. So, the program: +In the original implementation presented by Wirth, there are no input and output routines. The interpreter prints the new value of each variable when it changes. So, the program: var a, b; begin @@ -19,7 +19,7 @@ begin end end. -gives the output: +gives this output:
              0
             10
    @@ -36,7 +36,7 @@ gives the output:
     
    However, most implementations have single input and single output routines. -The flow control structures are ''if-then'' and ''while-do'' constructs, and procedures defined by the user. Procedures cannot accept any parameters. +The flow control structures are ''if-then'' and ''while-do'' constructs, and procedures are defined by the user. Procedures cannot accept any parameters. == Syntax == The syntax rules of PL/0 can be specified in [[extended Backus–Naur form|EBNF]] as follows: @@ -66,9 +66,9 @@ factor = ident | number | "(" expression ")"; Wirth in his book presents the implementation without ? ("receive an integer value and assign it to the variable") and ! ("display a value of the expression") routines. Some implementations use other routines for receiving and displaying data, usually read and write. -Due to typograhic conventions, Wirth uses non-ASCII symbols , , and . Some implementations use # for "not equal", [ for "less or equal", and ] for "greater or equal". +Due to typographic conventions, Wirth uses non-ASCII symbols , , and . Some implementations use # for "not equal", [ for "less or equal", and ] for "greater or equal". -Some implementations accept only upper-case letters or only lower-case letters in keywords and identifiers. +Some implementations accept only uppercase letters or only lowercase letters in keywords and identifiers. == External links== * Wikipedia has [[wp:PL/0|an article about PL/0]]. diff --git a/Lang/PL-I-80/Additive-primes b/Lang/PL-I-80/Additive-primes new file mode 120000 index 0000000000..a065cd3d8e --- /dev/null +++ b/Lang/PL-I-80/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/PL-I-80 \ No newline at end of file diff --git a/Lang/PL-I-80/Character-codes b/Lang/PL-I-80/Character-codes new file mode 120000 index 0000000000..c19a7eafa1 --- /dev/null +++ b/Lang/PL-I-80/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/PL-I-80 \ No newline at end of file diff --git a/Lang/PL-I-80/Integer-overflow b/Lang/PL-I-80/Integer-overflow new file mode 120000 index 0000000000..f1947b64b4 --- /dev/null +++ b/Lang/PL-I-80/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/PL-I-80 \ No newline at end of file diff --git a/Lang/PL-I-80/Square-free-integers b/Lang/PL-I-80/Square-free-integers new file mode 120000 index 0000000000..6f8a00edb8 --- /dev/null +++ b/Lang/PL-I-80/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/PL-I-80 \ No newline at end of file diff --git a/Lang/PL-I-80/Strip-whitespace-from-a-string-Top-and-tail b/Lang/PL-I-80/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..ac54cb4639 --- /dev/null +++ b/Lang/PL-I-80/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/PL-I-80 \ No newline at end of file diff --git a/Lang/PL-I-80/Sum-multiples-of-3-and-5 b/Lang/PL-I-80/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..dfe78f4be2 --- /dev/null +++ b/Lang/PL-I-80/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/PL-I-80 \ No newline at end of file diff --git a/Lang/PL-I/00-LANG.txt b/Lang/PL-I/00-LANG.txt index e9ccbaa140..3b9ba57193 100644 --- a/Lang/PL-I/00-LANG.txt +++ b/Lang/PL-I/00-LANG.txt @@ -84,4 +84,8 @@ The pre-processor keywords are prefixed with a   %   (perce ==See Also== * [[wp:PL/I|PL/I on Wikipedia]] * [[PL/M]] -* [[Polyglot:PL/I and PL/M]] \ No newline at end of file +* [[Polyglot:PL/I and PL/M]] + +==External links== +* [http://teampli.net/index.html Team PL/I] +** [http://teampli.net/candt.html PL/I Compilers and Tools] \ No newline at end of file diff --git a/Lang/PL-I/Abundant-odd-numbers b/Lang/PL-I/Abundant-odd-numbers new file mode 120000 index 0000000000..666cd2c37f --- /dev/null +++ b/Lang/PL-I/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/PL-I \ No newline at end of file diff --git a/Lang/PL-I/Arithmetic-derivative b/Lang/PL-I/Arithmetic-derivative new file mode 120000 index 0000000000..37f109623d --- /dev/null +++ b/Lang/PL-I/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/PL-I \ No newline at end of file diff --git a/Lang/PL-I/Arithmetic-numbers b/Lang/PL-I/Arithmetic-numbers new file mode 120000 index 0000000000..6912369ef9 --- /dev/null +++ b/Lang/PL-I/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/PL-I \ No newline at end of file diff --git a/Lang/PL-I/Bell-numbers b/Lang/PL-I/Bell-numbers new file mode 120000 index 0000000000..4afaf5b11f --- /dev/null +++ b/Lang/PL-I/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/PL-I \ No newline at end of file diff --git a/Lang/PL-I/Diversity-prediction-theorem b/Lang/PL-I/Diversity-prediction-theorem new file mode 120000 index 0000000000..a449ec2ac9 --- /dev/null +++ b/Lang/PL-I/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/PL-I \ No newline at end of file diff --git a/Lang/PL-I/Fairshare-between-two-and-more b/Lang/PL-I/Fairshare-between-two-and-more new file mode 120000 index 0000000000..38f481a639 --- /dev/null +++ b/Lang/PL-I/Fairshare-between-two-and-more @@ -0,0 +1 @@ +../../Task/Fairshare-between-two-and-more/PL-I \ No newline at end of file diff --git a/Lang/PL-I/Quaternion-type b/Lang/PL-I/Quaternion-type deleted file mode 120000 index b86d406fec..0000000000 --- a/Lang/PL-I/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/PL-I \ No newline at end of file diff --git a/Lang/PL-I/Tau-number b/Lang/PL-I/Tau-number new file mode 120000 index 0000000000..3dade8db80 --- /dev/null +++ b/Lang/PL-I/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/PL-I \ No newline at end of file diff --git a/Lang/PL-I/Zeckendorf-number-representation b/Lang/PL-I/Zeckendorf-number-representation new file mode 120000 index 0000000000..eabc5808d1 --- /dev/null +++ b/Lang/PL-I/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/PL-I \ No newline at end of file diff --git a/Lang/PL-M/00-LANG.txt b/Lang/PL-M/00-LANG.txt index 266637edeb..deaa4f220a 100644 --- a/Lang/PL-M/00-LANG.txt +++ b/Lang/PL-M/00-LANG.txt @@ -11,7 +11,7 @@ The following statements from PL/1 (with some changes) were available: * assignment * CALL * DECLARE -* DO-END +* DO-END (4 forms: statement grouping, counted loops, while loops and case statements) * IF-THEN-ELSE * GOTO * PROCEDURE-END diff --git a/Lang/PL-M/100-doors b/Lang/PL-M/100-doors deleted file mode 120000 index fb7e956c0e..0000000000 --- a/Lang/PL-M/100-doors +++ /dev/null @@ -1 +0,0 @@ -../../Task/100-doors/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Arithmetic-derivative b/Lang/PL-M/Arithmetic-derivative new file mode 120000 index 0000000000..13f3e396fe --- /dev/null +++ b/Lang/PL-M/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Draw-a-cuboid b/Lang/PL-M/Draw-a-cuboid new file mode 120000 index 0000000000..c6084a0c66 --- /dev/null +++ b/Lang/PL-M/Draw-a-cuboid @@ -0,0 +1 @@ +../../Task/Draw-a-cuboid/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Empty-program b/Lang/PL-M/Empty-program new file mode 120000 index 0000000000..80a556ac57 --- /dev/null +++ b/Lang/PL-M/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Find-limit-of-recursion b/Lang/PL-M/Find-limit-of-recursion new file mode 120000 index 0000000000..9915137871 --- /dev/null +++ b/Lang/PL-M/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Floyds-triangle b/Lang/PL-M/Floyds-triangle new file mode 120000 index 0000000000..c3a8d0df25 --- /dev/null +++ b/Lang/PL-M/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Jacobi-symbol b/Lang/PL-M/Jacobi-symbol new file mode 120000 index 0000000000..9053e83f5f --- /dev/null +++ b/Lang/PL-M/Jacobi-symbol @@ -0,0 +1 @@ +../../Task/Jacobi-symbol/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Loops-Infinite b/Lang/PL-M/Loops-Infinite new file mode 120000 index 0000000000..d5b0e926b7 --- /dev/null +++ b/Lang/PL-M/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Magic-8-ball b/Lang/PL-M/Magic-8-ball new file mode 120000 index 0000000000..feee7353a9 --- /dev/null +++ b/Lang/PL-M/Magic-8-ball @@ -0,0 +1 @@ +../../Task/Magic-8-ball/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/PL-M/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..ef707e8c5a --- /dev/null +++ b/Lang/PL-M/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Move-to-front-algorithm b/Lang/PL-M/Move-to-front-algorithm new file mode 120000 index 0000000000..23bec2ef3f --- /dev/null +++ b/Lang/PL-M/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Narcissistic-decimal-number b/Lang/PL-M/Narcissistic-decimal-number new file mode 120000 index 0000000000..5a762f85d9 --- /dev/null +++ b/Lang/PL-M/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Nested-function b/Lang/PL-M/Nested-function new file mode 120000 index 0000000000..2fbc4399dd --- /dev/null +++ b/Lang/PL-M/Nested-function @@ -0,0 +1 @@ +../../Task/Nested-function/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Set-consolidation b/Lang/PL-M/Set-consolidation new file mode 120000 index 0000000000..e60d98995b --- /dev/null +++ b/Lang/PL-M/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Sorting-algorithms-Gnome-sort b/Lang/PL-M/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..5fb68055e1 --- /dev/null +++ b/Lang/PL-M/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Super-d-numbers b/Lang/PL-M/Super-d-numbers new file mode 120000 index 0000000000..bb5c98f089 --- /dev/null +++ b/Lang/PL-M/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/PL-M \ No newline at end of file diff --git a/Lang/PL-M/The-Twelve-Days-of-Christmas b/Lang/PL-M/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..a94c814e99 --- /dev/null +++ b/Lang/PL-M/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/PL-M \ No newline at end of file diff --git a/Lang/PL-M/Zeckendorf-number-representation b/Lang/PL-M/Zeckendorf-number-representation new file mode 120000 index 0000000000..3d48575a07 --- /dev/null +++ b/Lang/PL-M/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/PL-M \ No newline at end of file diff --git a/Lang/POV-Ray/Bitmap b/Lang/POV-Ray/Bitmap new file mode 120000 index 0000000000..90fece7e75 --- /dev/null +++ b/Lang/POV-Ray/Bitmap @@ -0,0 +1 @@ +../../Task/Bitmap/POV-Ray \ No newline at end of file diff --git a/Lang/POV-Ray/Maze-generation b/Lang/POV-Ray/Maze-generation new file mode 120000 index 0000000000..724f710098 --- /dev/null +++ b/Lang/POV-Ray/Maze-generation @@ -0,0 +1 @@ +../../Task/Maze-generation/POV-Ray \ No newline at end of file diff --git a/Lang/ParaCL/00-LANG.txt b/Lang/ParaCL/00-LANG.txt new file mode 100644 index 0000000000..0711f454ed --- /dev/null +++ b/Lang/ParaCL/00-LANG.txt @@ -0,0 +1 @@ +{{stub}}{{language|ParaCL}} \ No newline at end of file diff --git a/Lang/ParaCL/00-META.yaml b/Lang/ParaCL/00-META.yaml new file mode 100644 index 0000000000..ff70e57502 --- /dev/null +++ b/Lang/ParaCL/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:ParaCL diff --git a/Lang/ParaCL/Fibonacci-sequence b/Lang/ParaCL/Fibonacci-sequence new file mode 120000 index 0000000000..89eadc9ef4 --- /dev/null +++ b/Lang/ParaCL/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/ParaCL \ No newline at end of file diff --git a/Lang/Pascal-P/00-LANG.txt b/Lang/Pascal-P/00-LANG.txt new file mode 100644 index 0000000000..ce87f461ab --- /dev/null +++ b/Lang/Pascal-P/00-LANG.txt @@ -0,0 +1,23 @@ +{{language|Pascal-P +|exec=bytecode +|strength=strong +|safety=safe +|express=explicit +|checking=static +|parampass=both +|gc=no +|LCT=yes +}}{{language programming paradigm|Procedural}} + +{{implementation|Pascal}}{{Compiler}} + +'''Pascal-P''' is a renowned [[:Category:Pascal|Pascal]] compiler designed to generate [[bytecode]], known as ''p-code'', and interpret the resulting code. The compilers and interpreters of Pascal-P are developed using the Pascal programming language. + +Originally developed in Zurich in 1973, the earliest iteration of Pascal-P, known as Pascal-P1, laid the foundation for subsequent versions, including P2, P3, and P4. While versions P1 and P3 are no longer accessible, P2 is still readily available and has notably served as the base for the UCSD system. Furthermore, there exist derivative versions, such as P5 and P6, which have evolved from the core Pascal-P compiler. + +Notably, Pascal-P is heralded for its portability, as it is capable of generating code suitable for a hypothetical stack computer system. This feature enhances its versatility and applicability across various platforms and environments. Additionally, Pascal-P has made significant contributions to the realm of education, often being utilized as an educational tool to impart knowledge and foster learning in the field of computer programming. + +== External links == +* [http://pascal.hansotten.com/niklaus-wirth/px-compilers Px compilers] on [http://pascal.hansotten.com/ Pascal for small machines] +* [https://sourceforge.net/projects/pascalp4/ Scott Moore's version of P4] The package includes crucial components essential for program execution on the MS-DOS platform - the compiler and the p-code interpreter executables. +* [https://www.moorecad.com/standardpascal/p4.html The P4 compiler] on [https://www.moorecad.com/ Scott Moore's page] \ No newline at end of file diff --git a/Lang/Pascal-P/00-META.yaml b/Lang/Pascal-P/00-META.yaml new file mode 100644 index 0000000000..5af4159a1f --- /dev/null +++ b/Lang/Pascal-P/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Pascal-P diff --git a/Lang/Pascal-P/Abundant-deficient-and-perfect-number-classifications b/Lang/Pascal-P/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..248c55dcbd --- /dev/null +++ b/Lang/Pascal-P/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Abundant-odd-numbers b/Lang/Pascal-P/Abundant-odd-numbers new file mode 120000 index 0000000000..745698036f --- /dev/null +++ b/Lang/Pascal-P/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Angle-difference-between-two-bearings b/Lang/Pascal-P/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..506fbb7a95 --- /dev/null +++ b/Lang/Pascal-P/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Anti-primes b/Lang/Pascal-P/Anti-primes new file mode 120000 index 0000000000..fe2e4f4a10 --- /dev/null +++ b/Lang/Pascal-P/Anti-primes @@ -0,0 +1 @@ +../../Task/Anti-primes/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Arithmetic-numbers b/Lang/Pascal-P/Arithmetic-numbers new file mode 120000 index 0000000000..3ad1b31145 --- /dev/null +++ b/Lang/Pascal-P/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Bell-numbers b/Lang/Pascal-P/Bell-numbers new file mode 120000 index 0000000000..fccbe75006 --- /dev/null +++ b/Lang/Pascal-P/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Brazilian-numbers b/Lang/Pascal-P/Brazilian-numbers new file mode 120000 index 0000000000..f79a88ea27 --- /dev/null +++ b/Lang/Pascal-P/Brazilian-numbers @@ -0,0 +1 @@ +../../Task/Brazilian-numbers/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/CUSIP b/Lang/Pascal-P/CUSIP new file mode 120000 index 0000000000..3a5ce6c0b7 --- /dev/null +++ b/Lang/Pascal-P/CUSIP @@ -0,0 +1 @@ +../../Task/CUSIP/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Catalan-numbers b/Lang/Pascal-P/Catalan-numbers new file mode 120000 index 0000000000..9dee46f2ca --- /dev/null +++ b/Lang/Pascal-P/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Cistercian-numerals b/Lang/Pascal-P/Cistercian-numerals new file mode 120000 index 0000000000..3169bb4737 --- /dev/null +++ b/Lang/Pascal-P/Cistercian-numerals @@ -0,0 +1 @@ +../../Task/Cistercian-numerals/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Day-of-the-week b/Lang/Pascal-P/Day-of-the-week new file mode 120000 index 0000000000..04c1bf395c --- /dev/null +++ b/Lang/Pascal-P/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Diversity-prediction-theorem b/Lang/Pascal-P/Diversity-prediction-theorem new file mode 120000 index 0000000000..1c77b9f4a8 --- /dev/null +++ b/Lang/Pascal-P/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Dot-product b/Lang/Pascal-P/Dot-product new file mode 120000 index 0000000000..1354e110a2 --- /dev/null +++ b/Lang/Pascal-P/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Ethiopian-multiplication b/Lang/Pascal-P/Ethiopian-multiplication new file mode 120000 index 0000000000..cf25f4fb51 --- /dev/null +++ b/Lang/Pascal-P/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Factors-of-an-integer b/Lang/Pascal-P/Factors-of-an-integer new file mode 120000 index 0000000000..db1f886bee --- /dev/null +++ b/Lang/Pascal-P/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/FizzBuzz b/Lang/Pascal-P/FizzBuzz new file mode 120000 index 0000000000..8d0c857c1d --- /dev/null +++ b/Lang/Pascal-P/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Gamma-function b/Lang/Pascal-P/Gamma-function new file mode 120000 index 0000000000..b35d39ded3 --- /dev/null +++ b/Lang/Pascal-P/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Generate-lower-case-ASCII-alphabet b/Lang/Pascal-P/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..54db5eb4c2 --- /dev/null +++ b/Lang/Pascal-P/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Horners-rule-for-polynomial-evaluation b/Lang/Pascal-P/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..1bf2158b09 --- /dev/null +++ b/Lang/Pascal-P/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Josephus-problem b/Lang/Pascal-P/Josephus-problem new file mode 120000 index 0000000000..ee86f2f03c --- /dev/null +++ b/Lang/Pascal-P/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Leap-year b/Lang/Pascal-P/Leap-year new file mode 120000 index 0000000000..e7c0275cd7 --- /dev/null +++ b/Lang/Pascal-P/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Leonardo-numbers b/Lang/Pascal-P/Leonardo-numbers new file mode 120000 index 0000000000..33730eb927 --- /dev/null +++ b/Lang/Pascal-P/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Levenshtein-distance b/Lang/Pascal-P/Levenshtein-distance new file mode 120000 index 0000000000..369c4fda51 --- /dev/null +++ b/Lang/Pascal-P/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Long-year b/Lang/Pascal-P/Long-year new file mode 120000 index 0000000000..4a8c200f91 --- /dev/null +++ b/Lang/Pascal-P/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/M-bius-function b/Lang/Pascal-P/M-bius-function new file mode 120000 index 0000000000..5ac8d7d007 --- /dev/null +++ b/Lang/Pascal-P/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Magic-constant b/Lang/Pascal-P/Magic-constant new file mode 120000 index 0000000000..d71a46b136 --- /dev/null +++ b/Lang/Pascal-P/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Map-range b/Lang/Pascal-P/Map-range new file mode 120000 index 0000000000..ecc77d75f6 --- /dev/null +++ b/Lang/Pascal-P/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Multifactorial b/Lang/Pascal-P/Multifactorial new file mode 120000 index 0000000000..3a5245db30 --- /dev/null +++ b/Lang/Pascal-P/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Periodic-table b/Lang/Pascal-P/Periodic-table new file mode 120000 index 0000000000..d1e817f294 --- /dev/null +++ b/Lang/Pascal-P/Periodic-table @@ -0,0 +1 @@ +../../Task/Periodic-table/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Prime-decomposition b/Lang/Pascal-P/Prime-decomposition new file mode 120000 index 0000000000..b9ce930a04 --- /dev/null +++ b/Lang/Pascal-P/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Ramer-Douglas-Peucker-line-simplification b/Lang/Pascal-P/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..41e4d1e47d --- /dev/null +++ b/Lang/Pascal-P/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Square-free-integers b/Lang/Pascal-P/Square-free-integers new file mode 120000 index 0000000000..011a7d78bb --- /dev/null +++ b/Lang/Pascal-P/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal-P/Tau-number b/Lang/Pascal-P/Tau-number new file mode 120000 index 0000000000..23629ebb6c --- /dev/null +++ b/Lang/Pascal-P/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Pascal-P \ No newline at end of file diff --git a/Lang/Pascal/Abundant-odd-numbers b/Lang/Pascal/Abundant-odd-numbers deleted file mode 120000 index b58a9a885b..0000000000 --- a/Lang/Pascal/Abundant-odd-numbers +++ /dev/null @@ -1 +0,0 @@ -../../Task/Abundant-odd-numbers/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Bell-numbers b/Lang/Pascal/Bell-numbers deleted file mode 120000 index c4ab57da43..0000000000 --- a/Lang/Pascal/Bell-numbers +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bell-numbers/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Bioinformatics-base-count b/Lang/Pascal/Bioinformatics-base-count deleted file mode 120000 index 97aaee2dbb..0000000000 --- a/Lang/Pascal/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Brazilian-numbers b/Lang/Pascal/Brazilian-numbers deleted file mode 120000 index 152f3a22d2..0000000000 --- a/Lang/Pascal/Brazilian-numbers +++ /dev/null @@ -1 +0,0 @@ -../../Task/Brazilian-numbers/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Count-the-coins b/Lang/Pascal/Count-the-coins new file mode 120000 index 0000000000..8d7999b667 --- /dev/null +++ b/Lang/Pascal/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Date-manipulation b/Lang/Pascal/Date-manipulation new file mode 120000 index 0000000000..9edece533b --- /dev/null +++ b/Lang/Pascal/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Ethiopian-multiplication b/Lang/Pascal/Ethiopian-multiplication deleted file mode 120000 index 53e5b905d2..0000000000 --- a/Lang/Pascal/Ethiopian-multiplication +++ /dev/null @@ -1 +0,0 @@ -../../Task/Ethiopian-multiplication/Pascal \ No newline at end of file diff --git a/Lang/Pascal/FizzBuzz b/Lang/Pascal/FizzBuzz deleted file mode 120000 index 786dae3647..0000000000 --- a/Lang/Pascal/FizzBuzz +++ /dev/null @@ -1 +0,0 @@ -../../Task/FizzBuzz/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Gamma-function b/Lang/Pascal/Gamma-function deleted file mode 120000 index f83dad18cb..0000000000 --- a/Lang/Pascal/Gamma-function +++ /dev/null @@ -1 +0,0 @@ -../../Task/Gamma-function/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Leap-year b/Lang/Pascal/Leap-year deleted file mode 120000 index 5eb674ed97..0000000000 --- a/Lang/Pascal/Leap-year +++ /dev/null @@ -1 +0,0 @@ -../../Task/Leap-year/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Levenshtein-distance b/Lang/Pascal/Levenshtein-distance deleted file mode 120000 index aa9f13dc0f..0000000000 --- a/Lang/Pascal/Levenshtein-distance +++ /dev/null @@ -1 +0,0 @@ -../../Task/Levenshtein-distance/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Map-range b/Lang/Pascal/Map-range deleted file mode 120000 index 71c05c40ec..0000000000 --- a/Lang/Pascal/Map-range +++ /dev/null @@ -1 +0,0 @@ -../../Task/Map-range/Pascal \ No newline at end of file diff --git a/Lang/Pascal/McNuggets-problem b/Lang/Pascal/McNuggets-problem new file mode 120000 index 0000000000..5ae885f695 --- /dev/null +++ b/Lang/Pascal/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Prime-decomposition b/Lang/Pascal/Prime-decomposition deleted file mode 120000 index 7b392e005f..0000000000 --- a/Lang/Pascal/Prime-decomposition +++ /dev/null @@ -1 +0,0 @@ -../../Task/Prime-decomposition/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Sorting-Algorithms-Circle-Sort b/Lang/Pascal/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 3100a6716d..0000000000 --- a/Lang/Pascal/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Square-form-factorization b/Lang/Pascal/Square-form-factorization new file mode 120000 index 0000000000..83d284e7d7 --- /dev/null +++ b/Lang/Pascal/Square-form-factorization @@ -0,0 +1 @@ +../../Task/Square-form-factorization/Pascal \ No newline at end of file diff --git a/Lang/Pascal/Square-free-integers b/Lang/Pascal/Square-free-integers deleted file mode 120000 index 874a24625c..0000000000 --- a/Lang/Pascal/Square-free-integers +++ /dev/null @@ -1 +0,0 @@ -../../Task/Square-free-integers/Pascal \ No newline at end of file diff --git a/Lang/PascalABC.NET/00-LANG.txt b/Lang/PascalABC.NET/00-LANG.txt index d9efe4d43e..7f652b8be9 100644 --- a/Lang/PascalABC.NET/00-LANG.txt +++ b/Lang/PascalABC.NET/00-LANG.txt @@ -1,4 +1,4 @@ -{{language|PascalABC.NET}} +{{language|site=https://pascalabc.net/en/}} {{implementation|Pascal}} PascalABC.NET is the new generation Pascal programming language that combines simplicity of classic Pascal, a great number of modern extensions and broad capabilities of Microsoft .NET Framework. @@ -16,4 +16,5 @@ begin end. -{{unimpl_Page|PacalABC.NET}} \ No newline at end of file +==Tasks not implemented in PascalABC.NET== +[[Tasks not implemented in PascalABC.NET]] \ No newline at end of file diff --git a/Lang/PascalABC.NET/100-doors b/Lang/PascalABC.NET/100-doors deleted file mode 120000 index ba816799a0..0000000000 --- a/Lang/PascalABC.NET/100-doors +++ /dev/null @@ -1 +0,0 @@ -../../Task/100-doors/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/15-puzzle-game b/Lang/PascalABC.NET/15-puzzle-game new file mode 120000 index 0000000000..caf890e56b --- /dev/null +++ b/Lang/PascalABC.NET/15-puzzle-game @@ -0,0 +1 @@ +../../Task/15-puzzle-game/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/15-puzzle-solver b/Lang/PascalABC.NET/15-puzzle-solver new file mode 120000 index 0000000000..73063f2237 --- /dev/null +++ b/Lang/PascalABC.NET/15-puzzle-solver @@ -0,0 +1 @@ +../../Task/15-puzzle-solver/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/99-bottles-of-beer b/Lang/PascalABC.NET/99-bottles-of-beer new file mode 120000 index 0000000000..bc29442ab5 --- /dev/null +++ b/Lang/PascalABC.NET/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/A+B b/Lang/PascalABC.NET/A+B new file mode 120000 index 0000000000..7a5a9db498 --- /dev/null +++ b/Lang/PascalABC.NET/A+B @@ -0,0 +1 @@ +../../Task/A+B/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Abbreviations-easy b/Lang/PascalABC.NET/Abbreviations-easy new file mode 120000 index 0000000000..ea782fa0b0 --- /dev/null +++ b/Lang/PascalABC.NET/Abbreviations-easy @@ -0,0 +1 @@ +../../Task/Abbreviations-easy/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Abbreviations-simple b/Lang/PascalABC.NET/Abbreviations-simple new file mode 120000 index 0000000000..abc650feac --- /dev/null +++ b/Lang/PascalABC.NET/Abbreviations-simple @@ -0,0 +1 @@ +../../Task/Abbreviations-simple/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Abstract-type b/Lang/PascalABC.NET/Abstract-type new file mode 120000 index 0000000000..305270825e --- /dev/null +++ b/Lang/PascalABC.NET/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Accumulator-factory b/Lang/PascalABC.NET/Accumulator-factory new file mode 120000 index 0000000000..dd94a031d6 --- /dev/null +++ b/Lang/PascalABC.NET/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Ackermann-function b/Lang/PascalABC.NET/Ackermann-function new file mode 120000 index 0000000000..c2fa2dd278 --- /dev/null +++ b/Lang/PascalABC.NET/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Add-a-variable-to-a-class-instance-at-runtime b/Lang/PascalABC.NET/Add-a-variable-to-a-class-instance-at-runtime new file mode 120000 index 0000000000..ec0970f459 --- /dev/null +++ b/Lang/PascalABC.NET/Add-a-variable-to-a-class-instance-at-runtime @@ -0,0 +1 @@ +../../Task/Add-a-variable-to-a-class-instance-at-runtime/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Additive-primes b/Lang/PascalABC.NET/Additive-primes new file mode 120000 index 0000000000..0022732e2e --- /dev/null +++ b/Lang/PascalABC.NET/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Address-of-a-variable b/Lang/PascalABC.NET/Address-of-a-variable new file mode 120000 index 0000000000..8477592c7b --- /dev/null +++ b/Lang/PascalABC.NET/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Amicable-pairs b/Lang/PascalABC.NET/Amicable-pairs new file mode 120000 index 0000000000..e8f5a09925 --- /dev/null +++ b/Lang/PascalABC.NET/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Anagrams b/Lang/PascalABC.NET/Anagrams new file mode 120000 index 0000000000..2bec53abb4 --- /dev/null +++ b/Lang/PascalABC.NET/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Angle-difference-between-two-bearings b/Lang/PascalABC.NET/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..a9e8619c23 --- /dev/null +++ b/Lang/PascalABC.NET/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Angles-geometric-normalization-and-conversion b/Lang/PascalABC.NET/Angles-geometric-normalization-and-conversion new file mode 120000 index 0000000000..27c57b8ea0 --- /dev/null +++ b/Lang/PascalABC.NET/Angles-geometric-normalization-and-conversion @@ -0,0 +1 @@ +../../Task/Angles-geometric-normalization-and-conversion/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Anonymous-recursion b/Lang/PascalABC.NET/Anonymous-recursion new file mode 120000 index 0000000000..7a2a34d4d5 --- /dev/null +++ b/Lang/PascalABC.NET/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Anti-primes b/Lang/PascalABC.NET/Anti-primes new file mode 120000 index 0000000000..0107c4a2bb --- /dev/null +++ b/Lang/PascalABC.NET/Anti-primes @@ -0,0 +1 @@ +../../Task/Anti-primes/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Apply-a-callback-to-an-array b/Lang/PascalABC.NET/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..88f34b5a9e --- /dev/null +++ b/Lang/PascalABC.NET/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Approximate-equality b/Lang/PascalABC.NET/Approximate-equality new file mode 120000 index 0000000000..9d80191945 --- /dev/null +++ b/Lang/PascalABC.NET/Approximate-equality @@ -0,0 +1 @@ +../../Task/Approximate-equality/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Arbitrary-precision-integers-included- b/Lang/PascalABC.NET/Arbitrary-precision-integers-included- new file mode 120000 index 0000000000..8e9998f39e --- /dev/null +++ b/Lang/PascalABC.NET/Arbitrary-precision-integers-included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers-included-/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Archimedean-spiral b/Lang/PascalABC.NET/Archimedean-spiral new file mode 120000 index 0000000000..8c791b5144 --- /dev/null +++ b/Lang/PascalABC.NET/Archimedean-spiral @@ -0,0 +1 @@ +../../Task/Archimedean-spiral/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Arithmetic-Complex b/Lang/PascalABC.NET/Arithmetic-Complex new file mode 120000 index 0000000000..bccd03a873 --- /dev/null +++ b/Lang/PascalABC.NET/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Arithmetic-Integer b/Lang/PascalABC.NET/Arithmetic-Integer new file mode 120000 index 0000000000..30d5138cbd --- /dev/null +++ b/Lang/PascalABC.NET/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Arithmetic-Rational b/Lang/PascalABC.NET/Arithmetic-Rational new file mode 120000 index 0000000000..e1c3c085b7 --- /dev/null +++ b/Lang/PascalABC.NET/Arithmetic-Rational @@ -0,0 +1 @@ +../../Task/Arithmetic-Rational/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Arithmetic-evaluation b/Lang/PascalABC.NET/Arithmetic-evaluation new file mode 120000 index 0000000000..816270d1cc --- /dev/null +++ b/Lang/PascalABC.NET/Arithmetic-evaluation @@ -0,0 +1 @@ +../../Task/Arithmetic-evaluation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Arithmetic-geometric-mean b/Lang/PascalABC.NET/Arithmetic-geometric-mean new file mode 120000 index 0000000000..de68d8badc --- /dev/null +++ b/Lang/PascalABC.NET/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Arithmetic-numbers b/Lang/PascalABC.NET/Arithmetic-numbers new file mode 120000 index 0000000000..91fbd5c07a --- /dev/null +++ b/Lang/PascalABC.NET/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Array-concatenation b/Lang/PascalABC.NET/Array-concatenation new file mode 120000 index 0000000000..bfe26798bc --- /dev/null +++ b/Lang/PascalABC.NET/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Arrays b/Lang/PascalABC.NET/Arrays new file mode 120000 index 0000000000..62dfb07030 --- /dev/null +++ b/Lang/PascalABC.NET/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Ascending-primes b/Lang/PascalABC.NET/Ascending-primes new file mode 120000 index 0000000000..764168a0be --- /dev/null +++ b/Lang/PascalABC.NET/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Assertions b/Lang/PascalABC.NET/Assertions new file mode 120000 index 0000000000..bdc3ed57c2 --- /dev/null +++ b/Lang/PascalABC.NET/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Associative-array-Creation b/Lang/PascalABC.NET/Associative-array-Creation new file mode 120000 index 0000000000..fc1bef5cdb --- /dev/null +++ b/Lang/PascalABC.NET/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Associative-array-Iteration b/Lang/PascalABC.NET/Associative-array-Iteration new file mode 120000 index 0000000000..2f1ab21d84 --- /dev/null +++ b/Lang/PascalABC.NET/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Associative-array-Merging b/Lang/PascalABC.NET/Associative-array-Merging new file mode 120000 index 0000000000..debbdc2521 --- /dev/null +++ b/Lang/PascalABC.NET/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Attractive-numbers b/Lang/PascalABC.NET/Attractive-numbers new file mode 120000 index 0000000000..974a121495 --- /dev/null +++ b/Lang/PascalABC.NET/Attractive-numbers @@ -0,0 +1 @@ +../../Task/Attractive-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Averages-Arithmetic-mean b/Lang/PascalABC.NET/Averages-Arithmetic-mean new file mode 120000 index 0000000000..c13a81b3d2 --- /dev/null +++ b/Lang/PascalABC.NET/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Averages-Mean-angle b/Lang/PascalABC.NET/Averages-Mean-angle new file mode 120000 index 0000000000..1138410560 --- /dev/null +++ b/Lang/PascalABC.NET/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Averages-Median b/Lang/PascalABC.NET/Averages-Median new file mode 120000 index 0000000000..3e861f57c5 --- /dev/null +++ b/Lang/PascalABC.NET/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Averages-Mode b/Lang/PascalABC.NET/Averages-Mode new file mode 120000 index 0000000000..73a256bfd8 --- /dev/null +++ b/Lang/PascalABC.NET/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Averages-Pythagorean-means b/Lang/PascalABC.NET/Averages-Pythagorean-means new file mode 120000 index 0000000000..d41041c28e --- /dev/null +++ b/Lang/PascalABC.NET/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Averages-Root-mean-square b/Lang/PascalABC.NET/Averages-Root-mean-square new file mode 120000 index 0000000000..fcd93926c8 --- /dev/null +++ b/Lang/PascalABC.NET/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Babbage-problem b/Lang/PascalABC.NET/Babbage-problem new file mode 120000 index 0000000000..0c9b0d20ea --- /dev/null +++ b/Lang/PascalABC.NET/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Balanced-brackets b/Lang/PascalABC.NET/Balanced-brackets new file mode 120000 index 0000000000..4b5678c4d8 --- /dev/null +++ b/Lang/PascalABC.NET/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Bifid-cipher b/Lang/PascalABC.NET/Bifid-cipher new file mode 120000 index 0000000000..b627ea6e1a --- /dev/null +++ b/Lang/PascalABC.NET/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Binary-digits b/Lang/PascalABC.NET/Binary-digits new file mode 120000 index 0000000000..e0597a5dc1 --- /dev/null +++ b/Lang/PascalABC.NET/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Binary-search b/Lang/PascalABC.NET/Binary-search new file mode 120000 index 0000000000..aa5ba91c87 --- /dev/null +++ b/Lang/PascalABC.NET/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Bitwise-operations b/Lang/PascalABC.NET/Bitwise-operations new file mode 120000 index 0000000000..acc6123f1c --- /dev/null +++ b/Lang/PascalABC.NET/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Break-OO-privacy b/Lang/PascalABC.NET/Break-OO-privacy new file mode 120000 index 0000000000..29ee336925 --- /dev/null +++ b/Lang/PascalABC.NET/Break-OO-privacy @@ -0,0 +1 @@ +../../Task/Break-OO-privacy/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/CRC-32 b/Lang/PascalABC.NET/CRC-32 new file mode 120000 index 0000000000..dfed202f62 --- /dev/null +++ b/Lang/PascalABC.NET/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/CSV-data-manipulation b/Lang/PascalABC.NET/CSV-data-manipulation new file mode 120000 index 0000000000..ab9f191d41 --- /dev/null +++ b/Lang/PascalABC.NET/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/CUSIP b/Lang/PascalABC.NET/CUSIP new file mode 120000 index 0000000000..1b4c6de901 --- /dev/null +++ b/Lang/PascalABC.NET/CUSIP @@ -0,0 +1 @@ +../../Task/CUSIP/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Caesar-cipher b/Lang/PascalABC.NET/Caesar-cipher new file mode 120000 index 0000000000..7b80169afb --- /dev/null +++ b/Lang/PascalABC.NET/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Calculating-the-value-of-e b/Lang/PascalABC.NET/Calculating-the-value-of-e new file mode 120000 index 0000000000..c544f3c00f --- /dev/null +++ b/Lang/PascalABC.NET/Calculating-the-value-of-e @@ -0,0 +1 @@ +../../Task/Calculating-the-value-of-e/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Calendar---for-REAL-programmers b/Lang/PascalABC.NET/Calendar---for-REAL-programmers new file mode 120000 index 0000000000..aa32b573de --- /dev/null +++ b/Lang/PascalABC.NET/Calendar---for-REAL-programmers @@ -0,0 +1 @@ +../../Task/Calendar---for-REAL-programmers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Call-an-object-method b/Lang/PascalABC.NET/Call-an-object-method new file mode 120000 index 0000000000..0c1cf230d7 --- /dev/null +++ b/Lang/PascalABC.NET/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Cartesian-product-of-two-or-more-lists b/Lang/PascalABC.NET/Cartesian-product-of-two-or-more-lists new file mode 120000 index 0000000000..e9abacde8d --- /dev/null +++ b/Lang/PascalABC.NET/Cartesian-product-of-two-or-more-lists @@ -0,0 +1 @@ +../../Task/Cartesian-product-of-two-or-more-lists/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Case-sensitivity-of-identifiers b/Lang/PascalABC.NET/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..b0fc4ead7c --- /dev/null +++ b/Lang/PascalABC.NET/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Casting-out-nines b/Lang/PascalABC.NET/Casting-out-nines new file mode 120000 index 0000000000..2635cd3c59 --- /dev/null +++ b/Lang/PascalABC.NET/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Catalan-numbers b/Lang/PascalABC.NET/Catalan-numbers new file mode 120000 index 0000000000..a970e535cd --- /dev/null +++ b/Lang/PascalABC.NET/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Catalan-numbers-Pascals-triangle b/Lang/PascalABC.NET/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..47a30d7f38 --- /dev/null +++ b/Lang/PascalABC.NET/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Catamorphism b/Lang/PascalABC.NET/Catamorphism new file mode 120000 index 0000000000..4cd74052dd --- /dev/null +++ b/Lang/PascalABC.NET/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Character-codes b/Lang/PascalABC.NET/Character-codes new file mode 120000 index 0000000000..1888f78c06 --- /dev/null +++ b/Lang/PascalABC.NET/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Check-input-device-is-a-terminal b/Lang/PascalABC.NET/Check-input-device-is-a-terminal new file mode 120000 index 0000000000..942e91ecc8 --- /dev/null +++ b/Lang/PascalABC.NET/Check-input-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-input-device-is-a-terminal/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Check-output-device-is-a-terminal b/Lang/PascalABC.NET/Check-output-device-is-a-terminal new file mode 120000 index 0000000000..ddcd688824 --- /dev/null +++ b/Lang/PascalABC.NET/Check-output-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-output-device-is-a-terminal/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Check-that-file-exists b/Lang/PascalABC.NET/Check-that-file-exists new file mode 120000 index 0000000000..8a6772fd4b --- /dev/null +++ b/Lang/PascalABC.NET/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Cheryls-birthday b/Lang/PascalABC.NET/Cheryls-birthday new file mode 120000 index 0000000000..a54346abfd --- /dev/null +++ b/Lang/PascalABC.NET/Cheryls-birthday @@ -0,0 +1 @@ +../../Task/Cheryls-birthday/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Chinese-remainder-theorem b/Lang/PascalABC.NET/Chinese-remainder-theorem new file mode 120000 index 0000000000..72e58e3a4a --- /dev/null +++ b/Lang/PascalABC.NET/Chinese-remainder-theorem @@ -0,0 +1 @@ +../../Task/Chinese-remainder-theorem/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Chinese-zodiac b/Lang/PascalABC.NET/Chinese-zodiac new file mode 120000 index 0000000000..f7393d9042 --- /dev/null +++ b/Lang/PascalABC.NET/Chinese-zodiac @@ -0,0 +1 @@ +../../Task/Chinese-zodiac/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Cholesky-decomposition b/Lang/PascalABC.NET/Cholesky-decomposition new file mode 120000 index 0000000000..35182d3cfc --- /dev/null +++ b/Lang/PascalABC.NET/Cholesky-decomposition @@ -0,0 +1 @@ +../../Task/Cholesky-decomposition/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Chowla-numbers b/Lang/PascalABC.NET/Chowla-numbers new file mode 120000 index 0000000000..556f1a6dfd --- /dev/null +++ b/Lang/PascalABC.NET/Chowla-numbers @@ -0,0 +1 @@ +../../Task/Chowla-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Circular-primes b/Lang/PascalABC.NET/Circular-primes new file mode 120000 index 0000000000..5224e07ad0 --- /dev/null +++ b/Lang/PascalABC.NET/Circular-primes @@ -0,0 +1 @@ +../../Task/Circular-primes/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Classes b/Lang/PascalABC.NET/Classes new file mode 120000 index 0000000000..08756ef03a --- /dev/null +++ b/Lang/PascalABC.NET/Classes @@ -0,0 +1 @@ +../../Task/Classes/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Closest-pair-problem b/Lang/PascalABC.NET/Closest-pair-problem new file mode 120000 index 0000000000..4b7bc32806 --- /dev/null +++ b/Lang/PascalABC.NET/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Closures-Value-capture b/Lang/PascalABC.NET/Closures-Value-capture new file mode 120000 index 0000000000..428138cdfe --- /dev/null +++ b/Lang/PascalABC.NET/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Collections b/Lang/PascalABC.NET/Collections new file mode 120000 index 0000000000..c3fa3dc417 --- /dev/null +++ b/Lang/PascalABC.NET/Collections @@ -0,0 +1 @@ +../../Task/Collections/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Color-of-a-screen-pixel b/Lang/PascalABC.NET/Color-of-a-screen-pixel new file mode 120000 index 0000000000..45582746a3 --- /dev/null +++ b/Lang/PascalABC.NET/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Color-wheel b/Lang/PascalABC.NET/Color-wheel new file mode 120000 index 0000000000..ea27bb369f --- /dev/null +++ b/Lang/PascalABC.NET/Color-wheel @@ -0,0 +1 @@ +../../Task/Color-wheel/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Colour-bars-Display b/Lang/PascalABC.NET/Colour-bars-Display new file mode 120000 index 0000000000..e504c543a7 --- /dev/null +++ b/Lang/PascalABC.NET/Colour-bars-Display @@ -0,0 +1 @@ +../../Task/Colour-bars-Display/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Colour-pinstripe-Display b/Lang/PascalABC.NET/Colour-pinstripe-Display new file mode 120000 index 0000000000..c9febd7d37 --- /dev/null +++ b/Lang/PascalABC.NET/Colour-pinstripe-Display @@ -0,0 +1 @@ +../../Task/Colour-pinstripe-Display/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Combinations b/Lang/PascalABC.NET/Combinations new file mode 120000 index 0000000000..fad981495d --- /dev/null +++ b/Lang/PascalABC.NET/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Combinations-with-repetitions b/Lang/PascalABC.NET/Combinations-with-repetitions new file mode 120000 index 0000000000..f75050c914 --- /dev/null +++ b/Lang/PascalABC.NET/Combinations-with-repetitions @@ -0,0 +1 @@ +../../Task/Combinations-with-repetitions/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Command-line-arguments b/Lang/PascalABC.NET/Command-line-arguments new file mode 120000 index 0000000000..f229191025 --- /dev/null +++ b/Lang/PascalABC.NET/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Comments b/Lang/PascalABC.NET/Comments new file mode 120000 index 0000000000..5e528e6991 --- /dev/null +++ b/Lang/PascalABC.NET/Comments @@ -0,0 +1 @@ +../../Task/Comments/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Compare-a-list-of-strings b/Lang/PascalABC.NET/Compare-a-list-of-strings new file mode 120000 index 0000000000..b8b040023f --- /dev/null +++ b/Lang/PascalABC.NET/Compare-a-list-of-strings @@ -0,0 +1 @@ +../../Task/Compare-a-list-of-strings/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Compare-length-of-two-strings b/Lang/PascalABC.NET/Compare-length-of-two-strings new file mode 120000 index 0000000000..92be62a3df --- /dev/null +++ b/Lang/PascalABC.NET/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Compile-time-calculation b/Lang/PascalABC.NET/Compile-time-calculation new file mode 120000 index 0000000000..aa6140bdc4 --- /dev/null +++ b/Lang/PascalABC.NET/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k b/Lang/PascalABC.NET/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k new file mode 120000 index 0000000000..54d237d7ab --- /dev/null +++ b/Lang/PascalABC.NET/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k @@ -0,0 +1 @@ +../../Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Compound-data-type b/Lang/PascalABC.NET/Compound-data-type new file mode 120000 index 0000000000..89ad664595 --- /dev/null +++ b/Lang/PascalABC.NET/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Concurrent-computing b/Lang/PascalABC.NET/Concurrent-computing new file mode 120000 index 0000000000..ced9fcccc5 --- /dev/null +++ b/Lang/PascalABC.NET/Concurrent-computing @@ -0,0 +1 @@ +../../Task/Concurrent-computing/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Conditional-structures b/Lang/PascalABC.NET/Conditional-structures new file mode 120000 index 0000000000..6186fdd1f8 --- /dev/null +++ b/Lang/PascalABC.NET/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Constrained-genericity b/Lang/PascalABC.NET/Constrained-genericity new file mode 120000 index 0000000000..4d89cf348d --- /dev/null +++ b/Lang/PascalABC.NET/Constrained-genericity @@ -0,0 +1 @@ +../../Task/Constrained-genericity/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Constrained-random-points-on-a-circle b/Lang/PascalABC.NET/Constrained-random-points-on-a-circle new file mode 120000 index 0000000000..5d3f518fc9 --- /dev/null +++ b/Lang/PascalABC.NET/Constrained-random-points-on-a-circle @@ -0,0 +1 @@ +../../Task/Constrained-random-points-on-a-circle/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Continued-fraction b/Lang/PascalABC.NET/Continued-fraction new file mode 120000 index 0000000000..f6f45a7af5 --- /dev/null +++ b/Lang/PascalABC.NET/Continued-fraction @@ -0,0 +1 @@ +../../Task/Continued-fraction/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Continued-fraction-Arithmetic-Construct-from-rational-number b/Lang/PascalABC.NET/Continued-fraction-Arithmetic-Construct-from-rational-number new file mode 120000 index 0000000000..2bab87463d --- /dev/null +++ b/Lang/PascalABC.NET/Continued-fraction-Arithmetic-Construct-from-rational-number @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-Construct-from-rational-number/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Convert-decimal-number-to-rational b/Lang/PascalABC.NET/Convert-decimal-number-to-rational new file mode 120000 index 0000000000..7827892fb4 --- /dev/null +++ b/Lang/PascalABC.NET/Convert-decimal-number-to-rational @@ -0,0 +1 @@ +../../Task/Convert-decimal-number-to-rational/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Copy-a-string b/Lang/PascalABC.NET/Copy-a-string new file mode 120000 index 0000000000..d102da9b43 --- /dev/null +++ b/Lang/PascalABC.NET/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Copy-stdin-to-stdout b/Lang/PascalABC.NET/Copy-stdin-to-stdout new file mode 120000 index 0000000000..08f7b00296 --- /dev/null +++ b/Lang/PascalABC.NET/Copy-stdin-to-stdout @@ -0,0 +1 @@ +../../Task/Copy-stdin-to-stdout/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Count-in-factors b/Lang/PascalABC.NET/Count-in-factors new file mode 120000 index 0000000000..42811aa9aa --- /dev/null +++ b/Lang/PascalABC.NET/Count-in-factors @@ -0,0 +1 @@ +../../Task/Count-in-factors/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Count-in-octal b/Lang/PascalABC.NET/Count-in-octal new file mode 120000 index 0000000000..8965e8c25f --- /dev/null +++ b/Lang/PascalABC.NET/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Count-occurrences-of-a-substring b/Lang/PascalABC.NET/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..d67adab506 --- /dev/null +++ b/Lang/PascalABC.NET/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Count-the-coins b/Lang/PascalABC.NET/Count-the-coins new file mode 120000 index 0000000000..43a4fdb837 --- /dev/null +++ b/Lang/PascalABC.NET/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Create-a-file b/Lang/PascalABC.NET/Create-a-file new file mode 120000 index 0000000000..5f3fa97f14 --- /dev/null +++ b/Lang/PascalABC.NET/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Create-a-two-dimensional-array-at-runtime b/Lang/PascalABC.NET/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..2c7befc65f --- /dev/null +++ b/Lang/PascalABC.NET/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Create-an-object-at-a-given-address b/Lang/PascalABC.NET/Create-an-object-at-a-given-address new file mode 120000 index 0000000000..aa2e5f2ab2 --- /dev/null +++ b/Lang/PascalABC.NET/Create-an-object-at-a-given-address @@ -0,0 +1 @@ +../../Task/Create-an-object-at-a-given-address/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Cuban-primes b/Lang/PascalABC.NET/Cuban-primes new file mode 120000 index 0000000000..844ac15cb4 --- /dev/null +++ b/Lang/PascalABC.NET/Cuban-primes @@ -0,0 +1 @@ +../../Task/Cuban-primes/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Cullen-and-Woodall-numbers b/Lang/PascalABC.NET/Cullen-and-Woodall-numbers new file mode 120000 index 0000000000..714083d23b --- /dev/null +++ b/Lang/PascalABC.NET/Cullen-and-Woodall-numbers @@ -0,0 +1 @@ +../../Task/Cullen-and-Woodall-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Cumulative-standard-deviation b/Lang/PascalABC.NET/Cumulative-standard-deviation new file mode 120000 index 0000000000..b6ef0ab016 --- /dev/null +++ b/Lang/PascalABC.NET/Cumulative-standard-deviation @@ -0,0 +1 @@ +../../Task/Cumulative-standard-deviation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Currency b/Lang/PascalABC.NET/Currency new file mode 120000 index 0000000000..2017d69d57 --- /dev/null +++ b/Lang/PascalABC.NET/Currency @@ -0,0 +1 @@ +../../Task/Currency/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Curzon-numbers b/Lang/PascalABC.NET/Curzon-numbers new file mode 120000 index 0000000000..13437cd157 --- /dev/null +++ b/Lang/PascalABC.NET/Curzon-numbers @@ -0,0 +1 @@ +../../Task/Curzon-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/DNS-query b/Lang/PascalABC.NET/DNS-query new file mode 120000 index 0000000000..52bda8e0aa --- /dev/null +++ b/Lang/PascalABC.NET/DNS-query @@ -0,0 +1 @@ +../../Task/DNS-query/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Damm-algorithm b/Lang/PascalABC.NET/Damm-algorithm new file mode 120000 index 0000000000..6fee5b0ddc --- /dev/null +++ b/Lang/PascalABC.NET/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Date-format b/Lang/PascalABC.NET/Date-format new file mode 120000 index 0000000000..176b256586 --- /dev/null +++ b/Lang/PascalABC.NET/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Day-of-the-week b/Lang/PascalABC.NET/Day-of-the-week new file mode 120000 index 0000000000..3300b037b4 --- /dev/null +++ b/Lang/PascalABC.NET/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Deceptive-numbers b/Lang/PascalABC.NET/Deceptive-numbers new file mode 120000 index 0000000000..007d2d649c --- /dev/null +++ b/Lang/PascalABC.NET/Deceptive-numbers @@ -0,0 +1 @@ +../../Task/Deceptive-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Deconvolution-1D b/Lang/PascalABC.NET/Deconvolution-1D new file mode 120000 index 0000000000..9604235c77 --- /dev/null +++ b/Lang/PascalABC.NET/Deconvolution-1D @@ -0,0 +1 @@ +../../Task/Deconvolution-1D/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Define-a-primitive-data-type b/Lang/PascalABC.NET/Define-a-primitive-data-type new file mode 120000 index 0000000000..684571f697 --- /dev/null +++ b/Lang/PascalABC.NET/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Demings-funnel b/Lang/PascalABC.NET/Demings-funnel new file mode 120000 index 0000000000..0255de8e51 --- /dev/null +++ b/Lang/PascalABC.NET/Demings-funnel @@ -0,0 +1 @@ +../../Task/Demings-funnel/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Department-numbers b/Lang/PascalABC.NET/Department-numbers new file mode 120000 index 0000000000..1b068d9b34 --- /dev/null +++ b/Lang/PascalABC.NET/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Descending-primes b/Lang/PascalABC.NET/Descending-primes new file mode 120000 index 0000000000..5641c47c94 --- /dev/null +++ b/Lang/PascalABC.NET/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Detect-division-by-zero b/Lang/PascalABC.NET/Detect-division-by-zero new file mode 120000 index 0000000000..a843cd631e --- /dev/null +++ b/Lang/PascalABC.NET/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Determine-if-a-string-has-all-the-same-characters b/Lang/PascalABC.NET/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..bb838a1f25 --- /dev/null +++ b/Lang/PascalABC.NET/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Determine-if-a-string-has-all-unique-characters b/Lang/PascalABC.NET/Determine-if-a-string-has-all-unique-characters new file mode 120000 index 0000000000..7c66082879 --- /dev/null +++ b/Lang/PascalABC.NET/Determine-if-a-string-has-all-unique-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-unique-characters/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Determine-if-a-string-is-collapsible b/Lang/PascalABC.NET/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..d22cc466fc --- /dev/null +++ b/Lang/PascalABC.NET/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Determine-if-a-string-is-numeric b/Lang/PascalABC.NET/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..3ddeb93c61 --- /dev/null +++ b/Lang/PascalABC.NET/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Determine-sentence-type b/Lang/PascalABC.NET/Determine-sentence-type new file mode 120000 index 0000000000..dc0284a0e0 --- /dev/null +++ b/Lang/PascalABC.NET/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Dice-game-probabilities b/Lang/PascalABC.NET/Dice-game-probabilities new file mode 120000 index 0000000000..e5f12572e0 --- /dev/null +++ b/Lang/PascalABC.NET/Dice-game-probabilities @@ -0,0 +1 @@ +../../Task/Dice-game-probabilities/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Digital-root b/Lang/PascalABC.NET/Digital-root new file mode 120000 index 0000000000..2ade97cd7d --- /dev/null +++ b/Lang/PascalABC.NET/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Digital-root-Multiplicative-digital-root b/Lang/PascalABC.NET/Digital-root-Multiplicative-digital-root new file mode 120000 index 0000000000..3dcbce4c26 --- /dev/null +++ b/Lang/PascalABC.NET/Digital-root-Multiplicative-digital-root @@ -0,0 +1 @@ +../../Task/Digital-root-Multiplicative-digital-root/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Dijkstras-algorithm b/Lang/PascalABC.NET/Dijkstras-algorithm new file mode 120000 index 0000000000..d9c1782412 --- /dev/null +++ b/Lang/PascalABC.NET/Dijkstras-algorithm @@ -0,0 +1 @@ +../../Task/Dijkstras-algorithm/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Dinesmans-multiple-dwelling-problem b/Lang/PascalABC.NET/Dinesmans-multiple-dwelling-problem new file mode 120000 index 0000000000..b9659a07e6 --- /dev/null +++ b/Lang/PascalABC.NET/Dinesmans-multiple-dwelling-problem @@ -0,0 +1 @@ +../../Task/Dinesmans-multiple-dwelling-problem/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Disarium-numbers b/Lang/PascalABC.NET/Disarium-numbers new file mode 120000 index 0000000000..25866ae831 --- /dev/null +++ b/Lang/PascalABC.NET/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Distribution-of-0-digits-in-factorial-series b/Lang/PascalABC.NET/Distribution-of-0-digits-in-factorial-series new file mode 120000 index 0000000000..f8efbe37d1 --- /dev/null +++ b/Lang/PascalABC.NET/Distribution-of-0-digits-in-factorial-series @@ -0,0 +1 @@ +../../Task/Distribution-of-0-digits-in-factorial-series/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Diversity-prediction-theorem b/Lang/PascalABC.NET/Diversity-prediction-theorem new file mode 120000 index 0000000000..a1a0483997 --- /dev/null +++ b/Lang/PascalABC.NET/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Doomsday-rule b/Lang/PascalABC.NET/Doomsday-rule new file mode 120000 index 0000000000..4aed9db54a --- /dev/null +++ b/Lang/PascalABC.NET/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Dot-product b/Lang/PascalABC.NET/Dot-product new file mode 120000 index 0000000000..75977e9d01 --- /dev/null +++ b/Lang/PascalABC.NET/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Doubly-linked-list-Definition b/Lang/PascalABC.NET/Doubly-linked-list-Definition new file mode 120000 index 0000000000..f2561705cf --- /dev/null +++ b/Lang/PascalABC.NET/Doubly-linked-list-Definition @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Definition/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Doubly-linked-list-Element-definition b/Lang/PascalABC.NET/Doubly-linked-list-Element-definition new file mode 120000 index 0000000000..50c9d03e8c --- /dev/null +++ b/Lang/PascalABC.NET/Doubly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Element-definition/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Doubly-linked-list-Element-insertion b/Lang/PascalABC.NET/Doubly-linked-list-Element-insertion new file mode 120000 index 0000000000..28af162224 --- /dev/null +++ b/Lang/PascalABC.NET/Doubly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Element-insertion/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Doubly-linked-list-Traversal b/Lang/PascalABC.NET/Doubly-linked-list-Traversal new file mode 120000 index 0000000000..9cc3d51b16 --- /dev/null +++ b/Lang/PascalABC.NET/Doubly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Traversal/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Dragon-curve b/Lang/PascalABC.NET/Dragon-curve new file mode 120000 index 0000000000..1a8a6239bd --- /dev/null +++ b/Lang/PascalABC.NET/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Draw-a-pixel b/Lang/PascalABC.NET/Draw-a-pixel new file mode 120000 index 0000000000..cdcb7e2918 --- /dev/null +++ b/Lang/PascalABC.NET/Draw-a-pixel @@ -0,0 +1 @@ +../../Task/Draw-a-pixel/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Draw-a-rotating-cube b/Lang/PascalABC.NET/Draw-a-rotating-cube new file mode 120000 index 0000000000..9092790488 --- /dev/null +++ b/Lang/PascalABC.NET/Draw-a-rotating-cube @@ -0,0 +1 @@ +../../Task/Draw-a-rotating-cube/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Duffinian-numbers b/Lang/PascalABC.NET/Duffinian-numbers new file mode 120000 index 0000000000..ed0f087334 --- /dev/null +++ b/Lang/PascalABC.NET/Duffinian-numbers @@ -0,0 +1 @@ +../../Task/Duffinian-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Dutch-national-flag-problem b/Lang/PascalABC.NET/Dutch-national-flag-problem new file mode 120000 index 0000000000..20b563dbd5 --- /dev/null +++ b/Lang/PascalABC.NET/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Egyptian-division b/Lang/PascalABC.NET/Egyptian-division new file mode 120000 index 0000000000..d931ff8696 --- /dev/null +++ b/Lang/PascalABC.NET/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Emirp-primes b/Lang/PascalABC.NET/Emirp-primes new file mode 120000 index 0000000000..69e5f4d7f7 --- /dev/null +++ b/Lang/PascalABC.NET/Emirp-primes @@ -0,0 +1 @@ +../../Task/Emirp-primes/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Empty-program b/Lang/PascalABC.NET/Empty-program new file mode 120000 index 0000000000..9a2aa557cd --- /dev/null +++ b/Lang/PascalABC.NET/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Empty-string b/Lang/PascalABC.NET/Empty-string new file mode 120000 index 0000000000..39d89b0e6b --- /dev/null +++ b/Lang/PascalABC.NET/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Entropy b/Lang/PascalABC.NET/Entropy new file mode 120000 index 0000000000..792ccf7d2a --- /dev/null +++ b/Lang/PascalABC.NET/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Enumerations b/Lang/PascalABC.NET/Enumerations new file mode 120000 index 0000000000..3fbeab7aac --- /dev/null +++ b/Lang/PascalABC.NET/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Environment-variables b/Lang/PascalABC.NET/Environment-variables new file mode 120000 index 0000000000..a87e0f0eca --- /dev/null +++ b/Lang/PascalABC.NET/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Equal-prime-and-composite-sums b/Lang/PascalABC.NET/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..e0ef8faaeb --- /dev/null +++ b/Lang/PascalABC.NET/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Equilibrium-index b/Lang/PascalABC.NET/Equilibrium-index new file mode 120000 index 0000000000..1ebc161d1d --- /dev/null +++ b/Lang/PascalABC.NET/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Erd-s-Nicolas-numbers b/Lang/PascalABC.NET/Erd-s-Nicolas-numbers new file mode 120000 index 0000000000..8d04b147b5 --- /dev/null +++ b/Lang/PascalABC.NET/Erd-s-Nicolas-numbers @@ -0,0 +1 @@ +../../Task/Erd-s-Nicolas-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Ethiopian-multiplication b/Lang/PascalABC.NET/Ethiopian-multiplication new file mode 120000 index 0000000000..225d8834fa --- /dev/null +++ b/Lang/PascalABC.NET/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Euclid-Mullin-sequence b/Lang/PascalABC.NET/Euclid-Mullin-sequence new file mode 120000 index 0000000000..c1a4f722c5 --- /dev/null +++ b/Lang/PascalABC.NET/Euclid-Mullin-sequence @@ -0,0 +1 @@ +../../Task/Euclid-Mullin-sequence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Euler-method b/Lang/PascalABC.NET/Euler-method new file mode 120000 index 0000000000..d3b60b57ad --- /dev/null +++ b/Lang/PascalABC.NET/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Eulers-constant-0.5772... b/Lang/PascalABC.NET/Eulers-constant-0.5772... new file mode 120000 index 0000000000..093c235349 --- /dev/null +++ b/Lang/PascalABC.NET/Eulers-constant-0.5772... @@ -0,0 +1 @@ +../../Task/Eulers-constant-0.5772.../PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Eulers-identity b/Lang/PascalABC.NET/Eulers-identity new file mode 120000 index 0000000000..05f2a3a1ec --- /dev/null +++ b/Lang/PascalABC.NET/Eulers-identity @@ -0,0 +1 @@ +../../Task/Eulers-identity/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Eulers-sum-of-powers-conjecture b/Lang/PascalABC.NET/Eulers-sum-of-powers-conjecture new file mode 120000 index 0000000000..a568356eba --- /dev/null +++ b/Lang/PascalABC.NET/Eulers-sum-of-powers-conjecture @@ -0,0 +1 @@ +../../Task/Eulers-sum-of-powers-conjecture/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Evaluate-binomial-coefficients b/Lang/PascalABC.NET/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..6ad68ae41d --- /dev/null +++ b/Lang/PascalABC.NET/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Even-or-odd b/Lang/PascalABC.NET/Even-or-odd new file mode 120000 index 0000000000..4191597943 --- /dev/null +++ b/Lang/PascalABC.NET/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Events b/Lang/PascalABC.NET/Events new file mode 120000 index 0000000000..75843719a2 --- /dev/null +++ b/Lang/PascalABC.NET/Events @@ -0,0 +1 @@ +../../Task/Events/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Evolutionary-algorithm b/Lang/PascalABC.NET/Evolutionary-algorithm new file mode 120000 index 0000000000..bc9856dbc0 --- /dev/null +++ b/Lang/PascalABC.NET/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Exceptions b/Lang/PascalABC.NET/Exceptions new file mode 120000 index 0000000000..b4b7999bea --- /dev/null +++ b/Lang/PascalABC.NET/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Exceptions-Catch-an-exception-thrown-in-a-nested-call b/Lang/PascalABC.NET/Exceptions-Catch-an-exception-thrown-in-a-nested-call new file mode 120000 index 0000000000..7cf9286a5e --- /dev/null +++ b/Lang/PascalABC.NET/Exceptions-Catch-an-exception-thrown-in-a-nested-call @@ -0,0 +1 @@ +../../Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Execute-a-system-command b/Lang/PascalABC.NET/Execute-a-system-command new file mode 120000 index 0000000000..7b3f5b40fe --- /dev/null +++ b/Lang/PascalABC.NET/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Exponentiation-order b/Lang/PascalABC.NET/Exponentiation-order new file mode 120000 index 0000000000..7066d9dd6b --- /dev/null +++ b/Lang/PascalABC.NET/Exponentiation-order @@ -0,0 +1 @@ +../../Task/Exponentiation-order/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Exponentiation-with-infix-operators-in-or-operating-on-the-base b/Lang/PascalABC.NET/Exponentiation-with-infix-operators-in-or-operating-on-the-base new file mode 120000 index 0000000000..cc33366128 --- /dev/null +++ b/Lang/PascalABC.NET/Exponentiation-with-infix-operators-in-or-operating-on-the-base @@ -0,0 +1 @@ +../../Task/Exponentiation-with-infix-operators-in-or-operating-on-the-base/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Extend-your-language b/Lang/PascalABC.NET/Extend-your-language new file mode 120000 index 0000000000..ee51376fd1 --- /dev/null +++ b/Lang/PascalABC.NET/Extend-your-language @@ -0,0 +1 @@ +../../Task/Extend-your-language/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Extensible-prime-generator b/Lang/PascalABC.NET/Extensible-prime-generator new file mode 120000 index 0000000000..c255987252 --- /dev/null +++ b/Lang/PascalABC.NET/Extensible-prime-generator @@ -0,0 +1 @@ +../../Task/Extensible-prime-generator/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Extreme-floating-point-values b/Lang/PascalABC.NET/Extreme-floating-point-values new file mode 120000 index 0000000000..438be3c964 --- /dev/null +++ b/Lang/PascalABC.NET/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Factorial b/Lang/PascalABC.NET/Factorial new file mode 120000 index 0000000000..64716300fa --- /dev/null +++ b/Lang/PascalABC.NET/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Factorial-primes b/Lang/PascalABC.NET/Factorial-primes new file mode 120000 index 0000000000..5b7eb12507 --- /dev/null +++ b/Lang/PascalABC.NET/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Factorions b/Lang/PascalABC.NET/Factorions new file mode 120000 index 0000000000..8d771f5a56 --- /dev/null +++ b/Lang/PascalABC.NET/Factorions @@ -0,0 +1 @@ +../../Task/Factorions/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Factors-of-a-Mersenne-number b/Lang/PascalABC.NET/Factors-of-a-Mersenne-number new file mode 120000 index 0000000000..3160230a03 --- /dev/null +++ b/Lang/PascalABC.NET/Factors-of-a-Mersenne-number @@ -0,0 +1 @@ +../../Task/Factors-of-a-Mersenne-number/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Factors-of-an-integer b/Lang/PascalABC.NET/Factors-of-an-integer new file mode 120000 index 0000000000..b2f675ad56 --- /dev/null +++ b/Lang/PascalABC.NET/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Fairshare-between-two-and-more b/Lang/PascalABC.NET/Fairshare-between-two-and-more new file mode 120000 index 0000000000..c21d1ab427 --- /dev/null +++ b/Lang/PascalABC.NET/Fairshare-between-two-and-more @@ -0,0 +1 @@ +../../Task/Fairshare-between-two-and-more/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Farey-sequence b/Lang/PascalABC.NET/Farey-sequence new file mode 120000 index 0000000000..cd060f6fa5 --- /dev/null +++ b/Lang/PascalABC.NET/Farey-sequence @@ -0,0 +1 @@ +../../Task/Farey-sequence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Fast-Fourier-transform b/Lang/PascalABC.NET/Fast-Fourier-transform new file mode 120000 index 0000000000..2ebeb31f36 --- /dev/null +++ b/Lang/PascalABC.NET/Fast-Fourier-transform @@ -0,0 +1 @@ +../../Task/Fast-Fourier-transform/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Feigenbaum-constant-calculation b/Lang/PascalABC.NET/Feigenbaum-constant-calculation new file mode 120000 index 0000000000..df0fd85992 --- /dev/null +++ b/Lang/PascalABC.NET/Feigenbaum-constant-calculation @@ -0,0 +1 @@ +../../Task/Feigenbaum-constant-calculation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Fermat-numbers b/Lang/PascalABC.NET/Fermat-numbers new file mode 120000 index 0000000000..87303a8419 --- /dev/null +++ b/Lang/PascalABC.NET/Fermat-numbers @@ -0,0 +1 @@ +../../Task/Fermat-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Fibonacci-word b/Lang/PascalABC.NET/Fibonacci-word new file mode 120000 index 0000000000..6accc7df5c --- /dev/null +++ b/Lang/PascalABC.NET/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Fibonacci-word-fractal b/Lang/PascalABC.NET/Fibonacci-word-fractal new file mode 120000 index 0000000000..32647433c7 --- /dev/null +++ b/Lang/PascalABC.NET/Fibonacci-word-fractal @@ -0,0 +1 @@ +../../Task/Fibonacci-word-fractal/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/File-input-output b/Lang/PascalABC.NET/File-input-output new file mode 120000 index 0000000000..aa29aa165d --- /dev/null +++ b/Lang/PascalABC.NET/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/File-modification-time b/Lang/PascalABC.NET/File-modification-time new file mode 120000 index 0000000000..f54091dc36 --- /dev/null +++ b/Lang/PascalABC.NET/File-modification-time @@ -0,0 +1 @@ +../../Task/File-modification-time/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/File-size b/Lang/PascalABC.NET/File-size new file mode 120000 index 0000000000..cb4f56c334 --- /dev/null +++ b/Lang/PascalABC.NET/File-size @@ -0,0 +1 @@ +../../Task/File-size/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Filter b/Lang/PascalABC.NET/Filter new file mode 120000 index 0000000000..b6b1f56f68 --- /dev/null +++ b/Lang/PascalABC.NET/Filter @@ -0,0 +1 @@ +../../Task/Filter/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Find-common-directory-path b/Lang/PascalABC.NET/Find-common-directory-path new file mode 120000 index 0000000000..48495d80e3 --- /dev/null +++ b/Lang/PascalABC.NET/Find-common-directory-path @@ -0,0 +1 @@ +../../Task/Find-common-directory-path/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Find-if-a-point-is-within-a-triangle b/Lang/PascalABC.NET/Find-if-a-point-is-within-a-triangle new file mode 120000 index 0000000000..995f2a0af8 --- /dev/null +++ b/Lang/PascalABC.NET/Find-if-a-point-is-within-a-triangle @@ -0,0 +1 @@ +../../Task/Find-if-a-point-is-within-a-triangle/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Find-limit-of-recursion b/Lang/PascalABC.NET/Find-limit-of-recursion new file mode 120000 index 0000000000..8e738ede74 --- /dev/null +++ b/Lang/PascalABC.NET/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Find-palindromic-numbers-in-both-binary-and-ternary-bases b/Lang/PascalABC.NET/Find-palindromic-numbers-in-both-binary-and-ternary-bases new file mode 120000 index 0000000000..d897fb9951 --- /dev/null +++ b/Lang/PascalABC.NET/Find-palindromic-numbers-in-both-binary-and-ternary-bases @@ -0,0 +1 @@ +../../Task/Find-palindromic-numbers-in-both-binary-and-ternary-bases/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Find-the-intersection-of-a-line-with-a-plane b/Lang/PascalABC.NET/Find-the-intersection-of-a-line-with-a-plane new file mode 120000 index 0000000000..db54cce940 --- /dev/null +++ b/Lang/PascalABC.NET/Find-the-intersection-of-a-line-with-a-plane @@ -0,0 +1 @@ +../../Task/Find-the-intersection-of-a-line-with-a-plane/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Find-the-intersection-of-two-lines b/Lang/PascalABC.NET/Find-the-intersection-of-two-lines new file mode 120000 index 0000000000..654d760b69 --- /dev/null +++ b/Lang/PascalABC.NET/Find-the-intersection-of-two-lines @@ -0,0 +1 @@ +../../Task/Find-the-intersection-of-two-lines/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Find-the-last-Sunday-of-each-month b/Lang/PascalABC.NET/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..14b7c01559 --- /dev/null +++ b/Lang/PascalABC.NET/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Find-the-missing-permutation b/Lang/PascalABC.NET/Find-the-missing-permutation new file mode 120000 index 0000000000..74bb4ee6f0 --- /dev/null +++ b/Lang/PascalABC.NET/Find-the-missing-permutation @@ -0,0 +1 @@ +../../Task/Find-the-missing-permutation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/First-class-functions b/Lang/PascalABC.NET/First-class-functions new file mode 120000 index 0000000000..d4c191f6d3 --- /dev/null +++ b/Lang/PascalABC.NET/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/First-class-functions-Use-numbers-analogously b/Lang/PascalABC.NET/First-class-functions-Use-numbers-analogously new file mode 120000 index 0000000000..60d3a6b1c4 --- /dev/null +++ b/Lang/PascalABC.NET/First-class-functions-Use-numbers-analogously @@ -0,0 +1 @@ +../../Task/First-class-functions-Use-numbers-analogously/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/First-perfect-square-in-base-n-with-n-unique-digits b/Lang/PascalABC.NET/First-perfect-square-in-base-n-with-n-unique-digits new file mode 120000 index 0000000000..dd9c2365f8 --- /dev/null +++ b/Lang/PascalABC.NET/First-perfect-square-in-base-n-with-n-unique-digits @@ -0,0 +1 @@ +../../Task/First-perfect-square-in-base-n-with-n-unique-digits/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/First-power-of-2-that-has-leading-decimal-digits-of-12 b/Lang/PascalABC.NET/First-power-of-2-that-has-leading-decimal-digits-of-12 new file mode 120000 index 0000000000..31a48a0c89 --- /dev/null +++ b/Lang/PascalABC.NET/First-power-of-2-that-has-leading-decimal-digits-of-12 @@ -0,0 +1 @@ +../../Task/First-power-of-2-that-has-leading-decimal-digits-of-12/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Five-weekends b/Lang/PascalABC.NET/Five-weekends new file mode 120000 index 0000000000..868fa3eedb --- /dev/null +++ b/Lang/PascalABC.NET/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Fivenum b/Lang/PascalABC.NET/Fivenum new file mode 120000 index 0000000000..ef9246e91a --- /dev/null +++ b/Lang/PascalABC.NET/Fivenum @@ -0,0 +1 @@ +../../Task/Fivenum/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/FizzBuzz b/Lang/PascalABC.NET/FizzBuzz new file mode 120000 index 0000000000..9af47ffeb0 --- /dev/null +++ b/Lang/PascalABC.NET/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Flatten-a-list b/Lang/PascalABC.NET/Flatten-a-list new file mode 120000 index 0000000000..951e9e626d --- /dev/null +++ b/Lang/PascalABC.NET/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Floyds-triangle b/Lang/PascalABC.NET/Floyds-triangle new file mode 120000 index 0000000000..741db9a754 --- /dev/null +++ b/Lang/PascalABC.NET/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Fork b/Lang/PascalABC.NET/Fork new file mode 120000 index 0000000000..21f23b18c9 --- /dev/null +++ b/Lang/PascalABC.NET/Fork @@ -0,0 +1 @@ +../../Task/Fork/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Formatted-numeric-output b/Lang/PascalABC.NET/Formatted-numeric-output new file mode 120000 index 0000000000..d5385037bc --- /dev/null +++ b/Lang/PascalABC.NET/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Forward-difference b/Lang/PascalABC.NET/Forward-difference new file mode 120000 index 0000000000..6ba594a872 --- /dev/null +++ b/Lang/PascalABC.NET/Forward-difference @@ -0,0 +1 @@ +../../Task/Forward-difference/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Fractal-tree b/Lang/PascalABC.NET/Fractal-tree new file mode 120000 index 0000000000..1018455008 --- /dev/null +++ b/Lang/PascalABC.NET/Fractal-tree @@ -0,0 +1 @@ +../../Task/Fractal-tree/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Function-composition b/Lang/PascalABC.NET/Function-composition new file mode 120000 index 0000000000..10938e885c --- /dev/null +++ b/Lang/PascalABC.NET/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Function-definition b/Lang/PascalABC.NET/Function-definition new file mode 120000 index 0000000000..cc1ff414b4 --- /dev/null +++ b/Lang/PascalABC.NET/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Fusc-sequence b/Lang/PascalABC.NET/Fusc-sequence new file mode 120000 index 0000000000..30b9581633 --- /dev/null +++ b/Lang/PascalABC.NET/Fusc-sequence @@ -0,0 +1 @@ +../../Task/Fusc-sequence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Gamma-function b/Lang/PascalABC.NET/Gamma-function new file mode 120000 index 0000000000..d0d1bc1bed --- /dev/null +++ b/Lang/PascalABC.NET/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Gapful-numbers b/Lang/PascalABC.NET/Gapful-numbers new file mode 120000 index 0000000000..c53e98533f --- /dev/null +++ b/Lang/PascalABC.NET/Gapful-numbers @@ -0,0 +1 @@ +../../Task/Gapful-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Gauss-Jordan-matrix-inversion b/Lang/PascalABC.NET/Gauss-Jordan-matrix-inversion new file mode 120000 index 0000000000..af61f036c2 --- /dev/null +++ b/Lang/PascalABC.NET/Gauss-Jordan-matrix-inversion @@ -0,0 +1 @@ +../../Task/Gauss-Jordan-matrix-inversion/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Gaussian-elimination b/Lang/PascalABC.NET/Gaussian-elimination new file mode 120000 index 0000000000..263ffc6099 --- /dev/null +++ b/Lang/PascalABC.NET/Gaussian-elimination @@ -0,0 +1 @@ +../../Task/Gaussian-elimination/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/General-FizzBuzz b/Lang/PascalABC.NET/General-FizzBuzz new file mode 120000 index 0000000000..655ae97e52 --- /dev/null +++ b/Lang/PascalABC.NET/General-FizzBuzz @@ -0,0 +1 @@ +../../Task/General-FizzBuzz/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Generate-Chess960-starting-position b/Lang/PascalABC.NET/Generate-Chess960-starting-position new file mode 120000 index 0000000000..0f95aaeb00 --- /dev/null +++ b/Lang/PascalABC.NET/Generate-Chess960-starting-position @@ -0,0 +1 @@ +../../Task/Generate-Chess960-starting-position/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Generate-lower-case-ASCII-alphabet b/Lang/PascalABC.NET/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..8ef0c3c6f0 --- /dev/null +++ b/Lang/PascalABC.NET/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Generator-Exponential b/Lang/PascalABC.NET/Generator-Exponential new file mode 120000 index 0000000000..ca6d0b1093 --- /dev/null +++ b/Lang/PascalABC.NET/Generator-Exponential @@ -0,0 +1 @@ +../../Task/Generator-Exponential/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Generic-swap b/Lang/PascalABC.NET/Generic-swap new file mode 120000 index 0000000000..35fd1c3542 --- /dev/null +++ b/Lang/PascalABC.NET/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Get-system-command-output b/Lang/PascalABC.NET/Get-system-command-output new file mode 120000 index 0000000000..41cb609755 --- /dev/null +++ b/Lang/PascalABC.NET/Get-system-command-output @@ -0,0 +1 @@ +../../Task/Get-system-command-output/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Giuga-numbers b/Lang/PascalABC.NET/Giuga-numbers new file mode 120000 index 0000000000..e5f281e7e3 --- /dev/null +++ b/Lang/PascalABC.NET/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Globally-replace-text-in-several-files b/Lang/PascalABC.NET/Globally-replace-text-in-several-files new file mode 120000 index 0000000000..d8545a73f2 --- /dev/null +++ b/Lang/PascalABC.NET/Globally-replace-text-in-several-files @@ -0,0 +1 @@ +../../Task/Globally-replace-text-in-several-files/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Goldbachs-comet b/Lang/PascalABC.NET/Goldbachs-comet new file mode 120000 index 0000000000..01fcc2a336 --- /dev/null +++ b/Lang/PascalABC.NET/Goldbachs-comet @@ -0,0 +1 @@ +../../Task/Goldbachs-comet/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Golden-ratio-Convergence b/Lang/PascalABC.NET/Golden-ratio-Convergence new file mode 120000 index 0000000000..375683d4e0 --- /dev/null +++ b/Lang/PascalABC.NET/Golden-ratio-Convergence @@ -0,0 +1 @@ +../../Task/Golden-ratio-Convergence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Gray-code b/Lang/PascalABC.NET/Gray-code new file mode 120000 index 0000000000..078fdc2c8b --- /dev/null +++ b/Lang/PascalABC.NET/Gray-code @@ -0,0 +1 @@ +../../Task/Gray-code/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Greatest-common-divisor b/Lang/PascalABC.NET/Greatest-common-divisor new file mode 120000 index 0000000000..27dc1c21f9 --- /dev/null +++ b/Lang/PascalABC.NET/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Greatest-element-of-a-list b/Lang/PascalABC.NET/Greatest-element-of-a-list new file mode 120000 index 0000000000..b5185eb27d --- /dev/null +++ b/Lang/PascalABC.NET/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Greatest-subsequential-sum b/Lang/PascalABC.NET/Greatest-subsequential-sum new file mode 120000 index 0000000000..10aeb8b0f0 --- /dev/null +++ b/Lang/PascalABC.NET/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Guess-the-number b/Lang/PascalABC.NET/Guess-the-number new file mode 120000 index 0000000000..7fff26f7e2 --- /dev/null +++ b/Lang/PascalABC.NET/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/HTTP b/Lang/PascalABC.NET/HTTP new file mode 120000 index 0000000000..28d630c27b --- /dev/null +++ b/Lang/PascalABC.NET/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/HTTPS b/Lang/PascalABC.NET/HTTPS new file mode 120000 index 0000000000..88259c85d4 --- /dev/null +++ b/Lang/PascalABC.NET/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/HTTPS-Authenticated b/Lang/PascalABC.NET/HTTPS-Authenticated new file mode 120000 index 0000000000..5f39b0a90c --- /dev/null +++ b/Lang/PascalABC.NET/HTTPS-Authenticated @@ -0,0 +1 @@ +../../Task/HTTPS-Authenticated/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Hailstone-sequence b/Lang/PascalABC.NET/Hailstone-sequence new file mode 120000 index 0000000000..f83360c3ea --- /dev/null +++ b/Lang/PascalABC.NET/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Halt-and-catch-fire b/Lang/PascalABC.NET/Halt-and-catch-fire new file mode 120000 index 0000000000..531d664087 --- /dev/null +++ b/Lang/PascalABC.NET/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Hamming-numbers b/Lang/PascalABC.NET/Hamming-numbers new file mode 120000 index 0000000000..bd37bceed8 --- /dev/null +++ b/Lang/PascalABC.NET/Hamming-numbers @@ -0,0 +1 @@ +../../Task/Hamming-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Handle-a-signal b/Lang/PascalABC.NET/Handle-a-signal new file mode 120000 index 0000000000..e3f3390134 --- /dev/null +++ b/Lang/PascalABC.NET/Handle-a-signal @@ -0,0 +1 @@ +../../Task/Handle-a-signal/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Happy-numbers b/Lang/PascalABC.NET/Happy-numbers new file mode 120000 index 0000000000..2b0f0e30d5 --- /dev/null +++ b/Lang/PascalABC.NET/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Harmonic-series b/Lang/PascalABC.NET/Harmonic-series new file mode 120000 index 0000000000..c5dec236a3 --- /dev/null +++ b/Lang/PascalABC.NET/Harmonic-series @@ -0,0 +1 @@ +../../Task/Harmonic-series/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Harshad-or-Niven-series b/Lang/PascalABC.NET/Harshad-or-Niven-series new file mode 120000 index 0000000000..4a30ac9f34 --- /dev/null +++ b/Lang/PascalABC.NET/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Hash-from-two-arrays b/Lang/PascalABC.NET/Hash-from-two-arrays new file mode 120000 index 0000000000..06b09f8bf9 --- /dev/null +++ b/Lang/PascalABC.NET/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Haversine-formula b/Lang/PascalABC.NET/Haversine-formula new file mode 120000 index 0000000000..505d4c95b1 --- /dev/null +++ b/Lang/PascalABC.NET/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Hello-world-Line-printer b/Lang/PascalABC.NET/Hello-world-Line-printer new file mode 120000 index 0000000000..87d7f6b37c --- /dev/null +++ b/Lang/PascalABC.NET/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Hello-world-Newline-omission b/Lang/PascalABC.NET/Hello-world-Newline-omission new file mode 120000 index 0000000000..2c094828d8 --- /dev/null +++ b/Lang/PascalABC.NET/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Hello-world-Standard-error b/Lang/PascalABC.NET/Hello-world-Standard-error new file mode 120000 index 0000000000..4b2452f23e --- /dev/null +++ b/Lang/PascalABC.NET/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Here-document b/Lang/PascalABC.NET/Here-document new file mode 120000 index 0000000000..073a394aa5 --- /dev/null +++ b/Lang/PascalABC.NET/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Heronian-triangles b/Lang/PascalABC.NET/Heronian-triangles new file mode 120000 index 0000000000..38597384c9 --- /dev/null +++ b/Lang/PascalABC.NET/Heronian-triangles @@ -0,0 +1 @@ +../../Task/Heronian-triangles/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Hex-words b/Lang/PascalABC.NET/Hex-words new file mode 120000 index 0000000000..487faee543 --- /dev/null +++ b/Lang/PascalABC.NET/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Hickerson-series-of-almost-integers b/Lang/PascalABC.NET/Hickerson-series-of-almost-integers new file mode 120000 index 0000000000..8789a0cbe0 --- /dev/null +++ b/Lang/PascalABC.NET/Hickerson-series-of-almost-integers @@ -0,0 +1 @@ +../../Task/Hickerson-series-of-almost-integers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Higher-order-functions b/Lang/PascalABC.NET/Higher-order-functions new file mode 120000 index 0000000000..c3ac017464 --- /dev/null +++ b/Lang/PascalABC.NET/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Hilbert-curve b/Lang/PascalABC.NET/Hilbert-curve new file mode 120000 index 0000000000..319eba89d6 --- /dev/null +++ b/Lang/PascalABC.NET/Hilbert-curve @@ -0,0 +1 @@ +../../Task/Hilbert-curve/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Hofstadter-Conway-$10-000-sequence b/Lang/PascalABC.NET/Hofstadter-Conway-$10-000-sequence new file mode 120000 index 0000000000..6f07522b20 --- /dev/null +++ b/Lang/PascalABC.NET/Hofstadter-Conway-$10-000-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Conway-$10-000-sequence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Hofstadter-Figure-Figure-sequences b/Lang/PascalABC.NET/Hofstadter-Figure-Figure-sequences new file mode 120000 index 0000000000..658c56f7ad --- /dev/null +++ b/Lang/PascalABC.NET/Hofstadter-Figure-Figure-sequences @@ -0,0 +1 @@ +../../Task/Hofstadter-Figure-Figure-sequences/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Hofstadter-Q-sequence b/Lang/PascalABC.NET/Hofstadter-Q-sequence new file mode 120000 index 0000000000..454e935a80 --- /dev/null +++ b/Lang/PascalABC.NET/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Horizontal-sundial-calculations b/Lang/PascalABC.NET/Horizontal-sundial-calculations new file mode 120000 index 0000000000..6ab4227b2a --- /dev/null +++ b/Lang/PascalABC.NET/Horizontal-sundial-calculations @@ -0,0 +1 @@ +../../Task/Horizontal-sundial-calculations/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Horners-rule-for-polynomial-evaluation b/Lang/PascalABC.NET/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..43a8514719 --- /dev/null +++ b/Lang/PascalABC.NET/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Host-introspection b/Lang/PascalABC.NET/Host-introspection new file mode 120000 index 0000000000..786a9617c6 --- /dev/null +++ b/Lang/PascalABC.NET/Host-introspection @@ -0,0 +1 @@ +../../Task/Host-introspection/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Hostname b/Lang/PascalABC.NET/Hostname new file mode 120000 index 0000000000..89e14c01f4 --- /dev/null +++ b/Lang/PascalABC.NET/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Humble-numbers b/Lang/PascalABC.NET/Humble-numbers new file mode 120000 index 0000000000..ee2cb9aa95 --- /dev/null +++ b/Lang/PascalABC.NET/Humble-numbers @@ -0,0 +1 @@ +../../Task/Humble-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/I-before-E-except-after-C b/Lang/PascalABC.NET/I-before-E-except-after-C new file mode 120000 index 0000000000..db9c4689f9 --- /dev/null +++ b/Lang/PascalABC.NET/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/IBAN b/Lang/PascalABC.NET/IBAN new file mode 120000 index 0000000000..2a1610e29a --- /dev/null +++ b/Lang/PascalABC.NET/IBAN @@ -0,0 +1 @@ +../../Task/IBAN/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/ISBN13-check-digit b/Lang/PascalABC.NET/ISBN13-check-digit new file mode 120000 index 0000000000..1cc5a9193a --- /dev/null +++ b/Lang/PascalABC.NET/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Identity-matrix b/Lang/PascalABC.NET/Identity-matrix new file mode 120000 index 0000000000..e498197ea6 --- /dev/null +++ b/Lang/PascalABC.NET/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Include-a-file b/Lang/PascalABC.NET/Include-a-file new file mode 120000 index 0000000000..5762928418 --- /dev/null +++ b/Lang/PascalABC.NET/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Increasing-gaps-between-consecutive-Niven-numbers b/Lang/PascalABC.NET/Increasing-gaps-between-consecutive-Niven-numbers new file mode 120000 index 0000000000..cff91f6819 --- /dev/null +++ b/Lang/PascalABC.NET/Increasing-gaps-between-consecutive-Niven-numbers @@ -0,0 +1 @@ +../../Task/Increasing-gaps-between-consecutive-Niven-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Increment-a-numerical-string b/Lang/PascalABC.NET/Increment-a-numerical-string new file mode 120000 index 0000000000..5570e6302a --- /dev/null +++ b/Lang/PascalABC.NET/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Infinity b/Lang/PascalABC.NET/Infinity new file mode 120000 index 0000000000..e5b6807ad7 --- /dev/null +++ b/Lang/PascalABC.NET/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Inheritance-Multiple b/Lang/PascalABC.NET/Inheritance-Multiple new file mode 120000 index 0000000000..f3f065b097 --- /dev/null +++ b/Lang/PascalABC.NET/Inheritance-Multiple @@ -0,0 +1 @@ +../../Task/Inheritance-Multiple/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Inheritance-Single b/Lang/PascalABC.NET/Inheritance-Single new file mode 120000 index 0000000000..2843b9d512 --- /dev/null +++ b/Lang/PascalABC.NET/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Input-loop b/Lang/PascalABC.NET/Input-loop new file mode 120000 index 0000000000..8086164ab5 --- /dev/null +++ b/Lang/PascalABC.NET/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Integer-comparison b/Lang/PascalABC.NET/Integer-comparison new file mode 120000 index 0000000000..b60ac826c4 --- /dev/null +++ b/Lang/PascalABC.NET/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Intersecting-number-wheels b/Lang/PascalABC.NET/Intersecting-number-wheels new file mode 120000 index 0000000000..5d79870677 --- /dev/null +++ b/Lang/PascalABC.NET/Intersecting-number-wheels @@ -0,0 +1 @@ +../../Task/Intersecting-number-wheels/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Isograms-and-heterograms b/Lang/PascalABC.NET/Isograms-and-heterograms new file mode 120000 index 0000000000..bf330eefcd --- /dev/null +++ b/Lang/PascalABC.NET/Isograms-and-heterograms @@ -0,0 +1 @@ +../../Task/Isograms-and-heterograms/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Isqrt-integer-square-root-of-X b/Lang/PascalABC.NET/Isqrt-integer-square-root-of-X new file mode 120000 index 0000000000..5e922bc6f6 --- /dev/null +++ b/Lang/PascalABC.NET/Isqrt-integer-square-root-of-X @@ -0,0 +1 @@ +../../Task/Isqrt-integer-square-root-of-X/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Iterated-digits-squaring b/Lang/PascalABC.NET/Iterated-digits-squaring new file mode 120000 index 0000000000..d26b072d9f --- /dev/null +++ b/Lang/PascalABC.NET/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/JSON b/Lang/PascalABC.NET/JSON new file mode 120000 index 0000000000..e24e87ebee --- /dev/null +++ b/Lang/PascalABC.NET/JSON @@ -0,0 +1 @@ +../../Task/JSON/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Jacobi-symbol b/Lang/PascalABC.NET/Jacobi-symbol new file mode 120000 index 0000000000..beae5f110d --- /dev/null +++ b/Lang/PascalABC.NET/Jacobi-symbol @@ -0,0 +1 @@ +../../Task/Jacobi-symbol/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Jacobsthal-numbers b/Lang/PascalABC.NET/Jacobsthal-numbers new file mode 120000 index 0000000000..876df13cd2 --- /dev/null +++ b/Lang/PascalABC.NET/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Jensens-Device b/Lang/PascalABC.NET/Jensens-Device new file mode 120000 index 0000000000..b995733017 --- /dev/null +++ b/Lang/PascalABC.NET/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Jewels-and-stones b/Lang/PascalABC.NET/Jewels-and-stones new file mode 120000 index 0000000000..3c21e35293 --- /dev/null +++ b/Lang/PascalABC.NET/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/JortSort b/Lang/PascalABC.NET/JortSort new file mode 120000 index 0000000000..7235c60479 --- /dev/null +++ b/Lang/PascalABC.NET/JortSort @@ -0,0 +1 @@ +../../Task/JortSort/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Josephus-problem b/Lang/PascalABC.NET/Josephus-problem new file mode 120000 index 0000000000..b62f88327b --- /dev/null +++ b/Lang/PascalABC.NET/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Juggler-sequence b/Lang/PascalABC.NET/Juggler-sequence new file mode 120000 index 0000000000..11d7432b3c --- /dev/null +++ b/Lang/PascalABC.NET/Juggler-sequence @@ -0,0 +1 @@ +../../Task/Juggler-sequence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Julia-set b/Lang/PascalABC.NET/Julia-set new file mode 120000 index 0000000000..905a140bc7 --- /dev/null +++ b/Lang/PascalABC.NET/Julia-set @@ -0,0 +1 @@ +../../Task/Julia-set/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Jump-anywhere b/Lang/PascalABC.NET/Jump-anywhere new file mode 120000 index 0000000000..cb395144b9 --- /dev/null +++ b/Lang/PascalABC.NET/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Kaprekar-numbers b/Lang/PascalABC.NET/Kaprekar-numbers new file mode 120000 index 0000000000..f1765dac14 --- /dev/null +++ b/Lang/PascalABC.NET/Kaprekar-numbers @@ -0,0 +1 @@ +../../Task/Kaprekar-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Kernighans-large-earthquake-problem b/Lang/PascalABC.NET/Kernighans-large-earthquake-problem new file mode 120000 index 0000000000..bfd99d6f53 --- /dev/null +++ b/Lang/PascalABC.NET/Kernighans-large-earthquake-problem @@ -0,0 +1 @@ +../../Task/Kernighans-large-earthquake-problem/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/PascalABC.NET/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..d70dc96806 --- /dev/null +++ b/Lang/PascalABC.NET/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Knapsack-problem-0-1 b/Lang/PascalABC.NET/Knapsack-problem-0-1 new file mode 120000 index 0000000000..2fbfd42a60 --- /dev/null +++ b/Lang/PascalABC.NET/Knapsack-problem-0-1 @@ -0,0 +1 @@ +../../Task/Knapsack-problem-0-1/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Knuth-shuffle b/Lang/PascalABC.NET/Knuth-shuffle new file mode 120000 index 0000000000..a80c329b34 --- /dev/null +++ b/Lang/PascalABC.NET/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Knuths-algorithm-S b/Lang/PascalABC.NET/Knuths-algorithm-S new file mode 120000 index 0000000000..5898ddfb2a --- /dev/null +++ b/Lang/PascalABC.NET/Knuths-algorithm-S @@ -0,0 +1 @@ +../../Task/Knuths-algorithm-S/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Knuths-power-tree b/Lang/PascalABC.NET/Knuths-power-tree new file mode 120000 index 0000000000..985187fb94 --- /dev/null +++ b/Lang/PascalABC.NET/Knuths-power-tree @@ -0,0 +1 @@ +../../Task/Knuths-power-tree/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Kolakoski-sequence b/Lang/PascalABC.NET/Kolakoski-sequence new file mode 120000 index 0000000000..141e5ac2f1 --- /dev/null +++ b/Lang/PascalABC.NET/Kolakoski-sequence @@ -0,0 +1 @@ +../../Task/Kolakoski-sequence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Kosaraju b/Lang/PascalABC.NET/Kosaraju new file mode 120000 index 0000000000..b461c7f092 --- /dev/null +++ b/Lang/PascalABC.NET/Kosaraju @@ -0,0 +1 @@ +../../Task/Kosaraju/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Kronecker-product b/Lang/PascalABC.NET/Kronecker-product new file mode 120000 index 0000000000..d78d832294 --- /dev/null +++ b/Lang/PascalABC.NET/Kronecker-product @@ -0,0 +1 @@ +../../Task/Kronecker-product/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Kronecker-product-based-fractals b/Lang/PascalABC.NET/Kronecker-product-based-fractals new file mode 120000 index 0000000000..47d2054ae1 --- /dev/null +++ b/Lang/PascalABC.NET/Kronecker-product-based-fractals @@ -0,0 +1 @@ +../../Task/Kronecker-product-based-fractals/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/LZW-compression b/Lang/PascalABC.NET/LZW-compression new file mode 120000 index 0000000000..caca350ee1 --- /dev/null +++ b/Lang/PascalABC.NET/LZW-compression @@ -0,0 +1 @@ +../../Task/LZW-compression/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Lah-numbers b/Lang/PascalABC.NET/Lah-numbers new file mode 120000 index 0000000000..6d00cf7c92 --- /dev/null +++ b/Lang/PascalABC.NET/Lah-numbers @@ -0,0 +1 @@ +../../Task/Lah-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Langtons-ant b/Lang/PascalABC.NET/Langtons-ant new file mode 120000 index 0000000000..7c98b40d3c --- /dev/null +++ b/Lang/PascalABC.NET/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Largest-int-from-concatenated-ints b/Lang/PascalABC.NET/Largest-int-from-concatenated-ints new file mode 120000 index 0000000000..97fdfc9525 --- /dev/null +++ b/Lang/PascalABC.NET/Largest-int-from-concatenated-ints @@ -0,0 +1 @@ +../../Task/Largest-int-from-concatenated-ints/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Largest-number-divisible-by-its-digits b/Lang/PascalABC.NET/Largest-number-divisible-by-its-digits new file mode 120000 index 0000000000..40a547007f --- /dev/null +++ b/Lang/PascalABC.NET/Largest-number-divisible-by-its-digits @@ -0,0 +1 @@ +../../Task/Largest-number-divisible-by-its-digits/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Largest-proper-divisor-of-n b/Lang/PascalABC.NET/Largest-proper-divisor-of-n new file mode 120000 index 0000000000..2988b13d98 --- /dev/null +++ b/Lang/PascalABC.NET/Largest-proper-divisor-of-n @@ -0,0 +1 @@ +../../Task/Largest-proper-divisor-of-n/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Last-Friday-of-each-month b/Lang/PascalABC.NET/Last-Friday-of-each-month new file mode 120000 index 0000000000..bcb04c8152 --- /dev/null +++ b/Lang/PascalABC.NET/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Last-letter-first-letter b/Lang/PascalABC.NET/Last-letter-first-letter new file mode 120000 index 0000000000..19b2a978ef --- /dev/null +++ b/Lang/PascalABC.NET/Last-letter-first-letter @@ -0,0 +1 @@ +../../Task/Last-letter-first-letter/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Law-of-cosines---triples b/Lang/PascalABC.NET/Law-of-cosines---triples new file mode 120000 index 0000000000..c3f4700866 --- /dev/null +++ b/Lang/PascalABC.NET/Law-of-cosines---triples @@ -0,0 +1 @@ +../../Task/Law-of-cosines---triples/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Leap-year b/Lang/PascalABC.NET/Leap-year new file mode 120000 index 0000000000..250d71014a --- /dev/null +++ b/Lang/PascalABC.NET/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Least-common-multiple b/Lang/PascalABC.NET/Least-common-multiple new file mode 120000 index 0000000000..446b96ac48 --- /dev/null +++ b/Lang/PascalABC.NET/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Left-factorials b/Lang/PascalABC.NET/Left-factorials new file mode 120000 index 0000000000..8ed1d03134 --- /dev/null +++ b/Lang/PascalABC.NET/Left-factorials @@ -0,0 +1 @@ +../../Task/Left-factorials/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Leonardo-numbers b/Lang/PascalABC.NET/Leonardo-numbers new file mode 120000 index 0000000000..0895bc3d59 --- /dev/null +++ b/Lang/PascalABC.NET/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Levenshtein-distance b/Lang/PascalABC.NET/Levenshtein-distance new file mode 120000 index 0000000000..e32fc71042 --- /dev/null +++ b/Lang/PascalABC.NET/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Linear-congruential-generator b/Lang/PascalABC.NET/Linear-congruential-generator new file mode 120000 index 0000000000..901b6b4116 --- /dev/null +++ b/Lang/PascalABC.NET/Linear-congruential-generator @@ -0,0 +1 @@ +../../Task/Linear-congruential-generator/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/List-comprehensions b/Lang/PascalABC.NET/List-comprehensions new file mode 120000 index 0000000000..e9fa93e9e6 --- /dev/null +++ b/Lang/PascalABC.NET/List-comprehensions @@ -0,0 +1 @@ +../../Task/List-comprehensions/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Literals-Floating-point b/Lang/PascalABC.NET/Literals-Floating-point new file mode 120000 index 0000000000..e11300a194 --- /dev/null +++ b/Lang/PascalABC.NET/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Literals-Integer b/Lang/PascalABC.NET/Literals-Integer new file mode 120000 index 0000000000..a9aac3cffe --- /dev/null +++ b/Lang/PascalABC.NET/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Literals-String b/Lang/PascalABC.NET/Literals-String new file mode 120000 index 0000000000..2f02c8af92 --- /dev/null +++ b/Lang/PascalABC.NET/Literals-String @@ -0,0 +1 @@ +../../Task/Literals-String/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Logistic-curve-fitting-in-epidemiology b/Lang/PascalABC.NET/Logistic-curve-fitting-in-epidemiology new file mode 120000 index 0000000000..9ae308e46e --- /dev/null +++ b/Lang/PascalABC.NET/Logistic-curve-fitting-in-epidemiology @@ -0,0 +1 @@ +../../Task/Logistic-curve-fitting-in-epidemiology/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Long-literals-with-continuations b/Lang/PascalABC.NET/Long-literals-with-continuations new file mode 120000 index 0000000000..cef817d9b6 --- /dev/null +++ b/Lang/PascalABC.NET/Long-literals-with-continuations @@ -0,0 +1 @@ +../../Task/Long-literals-with-continuations/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Long-multiplication b/Lang/PascalABC.NET/Long-multiplication new file mode 120000 index 0000000000..3da90eb79b --- /dev/null +++ b/Lang/PascalABC.NET/Long-multiplication @@ -0,0 +1 @@ +../../Task/Long-multiplication/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Long-primes b/Lang/PascalABC.NET/Long-primes new file mode 120000 index 0000000000..f90c1c5b51 --- /dev/null +++ b/Lang/PascalABC.NET/Long-primes @@ -0,0 +1 @@ +../../Task/Long-primes/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Long-year b/Lang/PascalABC.NET/Long-year new file mode 120000 index 0000000000..cfbd0a990c --- /dev/null +++ b/Lang/PascalABC.NET/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Longest-common-subsequence b/Lang/PascalABC.NET/Longest-common-subsequence new file mode 120000 index 0000000000..1dfbd5ef9d --- /dev/null +++ b/Lang/PascalABC.NET/Longest-common-subsequence @@ -0,0 +1 @@ +../../Task/Longest-common-subsequence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Longest-common-substring b/Lang/PascalABC.NET/Longest-common-substring new file mode 120000 index 0000000000..c8e27105a8 --- /dev/null +++ b/Lang/PascalABC.NET/Longest-common-substring @@ -0,0 +1 @@ +../../Task/Longest-common-substring/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Longest-increasing-subsequence b/Lang/PascalABC.NET/Longest-increasing-subsequence new file mode 120000 index 0000000000..256a8afb28 --- /dev/null +++ b/Lang/PascalABC.NET/Longest-increasing-subsequence @@ -0,0 +1 @@ +../../Task/Longest-increasing-subsequence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Look-and-say-sequence b/Lang/PascalABC.NET/Look-and-say-sequence new file mode 120000 index 0000000000..a23016f201 --- /dev/null +++ b/Lang/PascalABC.NET/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loop-over-multiple-arrays-simultaneously b/Lang/PascalABC.NET/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..52655fded4 --- /dev/null +++ b/Lang/PascalABC.NET/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loops-Break b/Lang/PascalABC.NET/Loops-Break new file mode 120000 index 0000000000..75f285786e --- /dev/null +++ b/Lang/PascalABC.NET/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loops-Continue b/Lang/PascalABC.NET/Loops-Continue new file mode 120000 index 0000000000..75da2856ce --- /dev/null +++ b/Lang/PascalABC.NET/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loops-Do-while b/Lang/PascalABC.NET/Loops-Do-while new file mode 120000 index 0000000000..a15c938618 --- /dev/null +++ b/Lang/PascalABC.NET/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loops-Downward-for b/Lang/PascalABC.NET/Loops-Downward-for new file mode 120000 index 0000000000..c2c6306f3a --- /dev/null +++ b/Lang/PascalABC.NET/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loops-For b/Lang/PascalABC.NET/Loops-For new file mode 120000 index 0000000000..bf236f094e --- /dev/null +++ b/Lang/PascalABC.NET/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loops-For-with-a-specified-step b/Lang/PascalABC.NET/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..5244453d5c --- /dev/null +++ b/Lang/PascalABC.NET/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loops-Foreach b/Lang/PascalABC.NET/Loops-Foreach new file mode 120000 index 0000000000..68b06931af --- /dev/null +++ b/Lang/PascalABC.NET/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loops-Increment-loop-index-within-loop-body b/Lang/PascalABC.NET/Loops-Increment-loop-index-within-loop-body new file mode 120000 index 0000000000..f5d20bce59 --- /dev/null +++ b/Lang/PascalABC.NET/Loops-Increment-loop-index-within-loop-body @@ -0,0 +1 @@ +../../Task/Loops-Increment-loop-index-within-loop-body/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loops-N-plus-one-half b/Lang/PascalABC.NET/Loops-N-plus-one-half new file mode 120000 index 0000000000..95fe8496ec --- /dev/null +++ b/Lang/PascalABC.NET/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loops-Nested b/Lang/PascalABC.NET/Loops-Nested new file mode 120000 index 0000000000..d1a88ee15f --- /dev/null +++ b/Lang/PascalABC.NET/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loops-While b/Lang/PascalABC.NET/Loops-While new file mode 120000 index 0000000000..19d817b9f2 --- /dev/null +++ b/Lang/PascalABC.NET/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loops-With-multiple-ranges b/Lang/PascalABC.NET/Loops-With-multiple-ranges new file mode 120000 index 0000000000..1b3c0e8a85 --- /dev/null +++ b/Lang/PascalABC.NET/Loops-With-multiple-ranges @@ -0,0 +1 @@ +../../Task/Loops-With-multiple-ranges/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Loops-Wrong-ranges b/Lang/PascalABC.NET/Loops-Wrong-ranges new file mode 120000 index 0000000000..cd717ae408 --- /dev/null +++ b/Lang/PascalABC.NET/Loops-Wrong-ranges @@ -0,0 +1 @@ +../../Task/Loops-Wrong-ranges/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Lucas-Lehmer-test b/Lang/PascalABC.NET/Lucas-Lehmer-test new file mode 120000 index 0000000000..bec917b045 --- /dev/null +++ b/Lang/PascalABC.NET/Lucas-Lehmer-test @@ -0,0 +1 @@ +../../Task/Lucas-Lehmer-test/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Ludic-numbers b/Lang/PascalABC.NET/Ludic-numbers new file mode 120000 index 0000000000..84c5abb4fd --- /dev/null +++ b/Lang/PascalABC.NET/Ludic-numbers @@ -0,0 +1 @@ +../../Task/Ludic-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Luhn-test-of-credit-card-numbers b/Lang/PascalABC.NET/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..00804b09b8 --- /dev/null +++ b/Lang/PascalABC.NET/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Lychrel-numbers b/Lang/PascalABC.NET/Lychrel-numbers new file mode 120000 index 0000000000..c6935e364e --- /dev/null +++ b/Lang/PascalABC.NET/Lychrel-numbers @@ -0,0 +1 @@ +../../Task/Lychrel-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/M-bius-function b/Lang/PascalABC.NET/M-bius-function new file mode 120000 index 0000000000..e6445ec3ed --- /dev/null +++ b/Lang/PascalABC.NET/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/MAC-vendor-lookup b/Lang/PascalABC.NET/MAC-vendor-lookup new file mode 120000 index 0000000000..d35cdd8c9b --- /dev/null +++ b/Lang/PascalABC.NET/MAC-vendor-lookup @@ -0,0 +1 @@ +../../Task/MAC-vendor-lookup/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/MD5 b/Lang/PascalABC.NET/MD5 new file mode 120000 index 0000000000..375523a297 --- /dev/null +++ b/Lang/PascalABC.NET/MD5 @@ -0,0 +1 @@ +../../Task/MD5/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Magic-constant b/Lang/PascalABC.NET/Magic-constant new file mode 120000 index 0000000000..822ebb4fb2 --- /dev/null +++ b/Lang/PascalABC.NET/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Magic-squares-of-doubly-even-order b/Lang/PascalABC.NET/Magic-squares-of-doubly-even-order new file mode 120000 index 0000000000..b8c93bc64a --- /dev/null +++ b/Lang/PascalABC.NET/Magic-squares-of-doubly-even-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-doubly-even-order/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Magnanimous-numbers b/Lang/PascalABC.NET/Magnanimous-numbers new file mode 120000 index 0000000000..0a895d4414 --- /dev/null +++ b/Lang/PascalABC.NET/Magnanimous-numbers @@ -0,0 +1 @@ +../../Task/Magnanimous-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Man-or-boy-test b/Lang/PascalABC.NET/Man-or-boy-test new file mode 120000 index 0000000000..f9b9ccb7a0 --- /dev/null +++ b/Lang/PascalABC.NET/Man-or-boy-test @@ -0,0 +1 @@ +../../Task/Man-or-boy-test/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Map-range b/Lang/PascalABC.NET/Map-range new file mode 120000 index 0000000000..2c5d9ac526 --- /dev/null +++ b/Lang/PascalABC.NET/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Matrix-exponentiation-operator b/Lang/PascalABC.NET/Matrix-exponentiation-operator new file mode 120000 index 0000000000..31137ceb77 --- /dev/null +++ b/Lang/PascalABC.NET/Matrix-exponentiation-operator @@ -0,0 +1 @@ +../../Task/Matrix-exponentiation-operator/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Matrix-multiplication b/Lang/PascalABC.NET/Matrix-multiplication new file mode 120000 index 0000000000..ab9b502408 --- /dev/null +++ b/Lang/PascalABC.NET/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Matrix-transposition b/Lang/PascalABC.NET/Matrix-transposition new file mode 120000 index 0000000000..2ba6e5da4b --- /dev/null +++ b/Lang/PascalABC.NET/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Maximum-triangle-path-sum b/Lang/PascalABC.NET/Maximum-triangle-path-sum new file mode 120000 index 0000000000..d476233920 --- /dev/null +++ b/Lang/PascalABC.NET/Maximum-triangle-path-sum @@ -0,0 +1 @@ +../../Task/Maximum-triangle-path-sum/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Maze-generation b/Lang/PascalABC.NET/Maze-generation new file mode 120000 index 0000000000..147e928cb8 --- /dev/null +++ b/Lang/PascalABC.NET/Maze-generation @@ -0,0 +1 @@ +../../Task/Maze-generation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/McNuggets-problem b/Lang/PascalABC.NET/McNuggets-problem new file mode 120000 index 0000000000..ceb4630090 --- /dev/null +++ b/Lang/PascalABC.NET/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Memory-allocation b/Lang/PascalABC.NET/Memory-allocation new file mode 120000 index 0000000000..b7e94af0dd --- /dev/null +++ b/Lang/PascalABC.NET/Memory-allocation @@ -0,0 +1 @@ +../../Task/Memory-allocation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Mertens-function b/Lang/PascalABC.NET/Mertens-function new file mode 120000 index 0000000000..f3e21033e6 --- /dev/null +++ b/Lang/PascalABC.NET/Mertens-function @@ -0,0 +1 @@ +../../Task/Mertens-function/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Metallic-ratios b/Lang/PascalABC.NET/Metallic-ratios new file mode 120000 index 0000000000..1f47416b87 --- /dev/null +++ b/Lang/PascalABC.NET/Metallic-ratios @@ -0,0 +1 @@ +../../Task/Metallic-ratios/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Metered-concurrency b/Lang/PascalABC.NET/Metered-concurrency new file mode 120000 index 0000000000..925b288d53 --- /dev/null +++ b/Lang/PascalABC.NET/Metered-concurrency @@ -0,0 +1 @@ +../../Task/Metered-concurrency/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Mian-Chowla-sequence b/Lang/PascalABC.NET/Mian-Chowla-sequence new file mode 120000 index 0000000000..8a0250e208 --- /dev/null +++ b/Lang/PascalABC.NET/Mian-Chowla-sequence @@ -0,0 +1 @@ +../../Task/Mian-Chowla-sequence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Middle-three-digits b/Lang/PascalABC.NET/Middle-three-digits new file mode 120000 index 0000000000..5e135c1794 --- /dev/null +++ b/Lang/PascalABC.NET/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/PascalABC.NET/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..97c186fb9d --- /dev/null +++ b/Lang/PascalABC.NET/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Modified-random-distribution b/Lang/PascalABC.NET/Modified-random-distribution new file mode 120000 index 0000000000..0b45ed8c91 --- /dev/null +++ b/Lang/PascalABC.NET/Modified-random-distribution @@ -0,0 +1 @@ +../../Task/Modified-random-distribution/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Modular-exponentiation b/Lang/PascalABC.NET/Modular-exponentiation new file mode 120000 index 0000000000..06db8e7a38 --- /dev/null +++ b/Lang/PascalABC.NET/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Modular-inverse b/Lang/PascalABC.NET/Modular-inverse new file mode 120000 index 0000000000..cf592b925c --- /dev/null +++ b/Lang/PascalABC.NET/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Monte-Carlo-methods b/Lang/PascalABC.NET/Monte-Carlo-methods new file mode 120000 index 0000000000..097d7017f6 --- /dev/null +++ b/Lang/PascalABC.NET/Monte-Carlo-methods @@ -0,0 +1 @@ +../../Task/Monte-Carlo-methods/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Monty-Hall-problem b/Lang/PascalABC.NET/Monty-Hall-problem new file mode 120000 index 0000000000..194ee5c033 --- /dev/null +++ b/Lang/PascalABC.NET/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Morse-code b/Lang/PascalABC.NET/Morse-code new file mode 120000 index 0000000000..957358167f --- /dev/null +++ b/Lang/PascalABC.NET/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Motzkin-numbers b/Lang/PascalABC.NET/Motzkin-numbers new file mode 120000 index 0000000000..119a6ee6b9 --- /dev/null +++ b/Lang/PascalABC.NET/Motzkin-numbers @@ -0,0 +1 @@ +../../Task/Motzkin-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Mouse-position b/Lang/PascalABC.NET/Mouse-position new file mode 120000 index 0000000000..207ee7b935 --- /dev/null +++ b/Lang/PascalABC.NET/Mouse-position @@ -0,0 +1 @@ +../../Task/Mouse-position/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Move-to-front-algorithm b/Lang/PascalABC.NET/Move-to-front-algorithm new file mode 120000 index 0000000000..e365638bb3 --- /dev/null +++ b/Lang/PascalABC.NET/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Multifactorial b/Lang/PascalABC.NET/Multifactorial new file mode 120000 index 0000000000..1a4d72f284 --- /dev/null +++ b/Lang/PascalABC.NET/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Multiple-regression b/Lang/PascalABC.NET/Multiple-regression new file mode 120000 index 0000000000..c2b1f827d2 --- /dev/null +++ b/Lang/PascalABC.NET/Multiple-regression @@ -0,0 +1 @@ +../../Task/Multiple-regression/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Multiplication-tables b/Lang/PascalABC.NET/Multiplication-tables new file mode 120000 index 0000000000..bbe1dc2627 --- /dev/null +++ b/Lang/PascalABC.NET/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Multisplit b/Lang/PascalABC.NET/Multisplit new file mode 120000 index 0000000000..cacc0acc3b --- /dev/null +++ b/Lang/PascalABC.NET/Multisplit @@ -0,0 +1 @@ +../../Task/Multisplit/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Munchausen-numbers b/Lang/PascalABC.NET/Munchausen-numbers new file mode 120000 index 0000000000..e5388bf0cf --- /dev/null +++ b/Lang/PascalABC.NET/Munchausen-numbers @@ -0,0 +1 @@ +../../Task/Munchausen-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Musical-scale b/Lang/PascalABC.NET/Musical-scale new file mode 120000 index 0000000000..33d370124c --- /dev/null +++ b/Lang/PascalABC.NET/Musical-scale @@ -0,0 +1 @@ +../../Task/Musical-scale/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Mutual-recursion b/Lang/PascalABC.NET/Mutual-recursion new file mode 120000 index 0000000000..ccdccec66f --- /dev/null +++ b/Lang/PascalABC.NET/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/N-queens-problem b/Lang/PascalABC.NET/N-queens-problem new file mode 120000 index 0000000000..d0df5430cc --- /dev/null +++ b/Lang/PascalABC.NET/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Named-parameters b/Lang/PascalABC.NET/Named-parameters new file mode 120000 index 0000000000..f91e295fc0 --- /dev/null +++ b/Lang/PascalABC.NET/Named-parameters @@ -0,0 +1 @@ +../../Task/Named-parameters/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Naming-conventions b/Lang/PascalABC.NET/Naming-conventions new file mode 120000 index 0000000000..5fc365228c --- /dev/null +++ b/Lang/PascalABC.NET/Naming-conventions @@ -0,0 +1 @@ +../../Task/Naming-conventions/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Narcissistic-decimal-number b/Lang/PascalABC.NET/Narcissistic-decimal-number new file mode 120000 index 0000000000..6e25078669 --- /dev/null +++ b/Lang/PascalABC.NET/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Nested-function b/Lang/PascalABC.NET/Nested-function new file mode 120000 index 0000000000..406d1380f0 --- /dev/null +++ b/Lang/PascalABC.NET/Nested-function @@ -0,0 +1 @@ +../../Task/Nested-function/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Next-highest-int-from-digits b/Lang/PascalABC.NET/Next-highest-int-from-digits new file mode 120000 index 0000000000..f57c5311ba --- /dev/null +++ b/Lang/PascalABC.NET/Next-highest-int-from-digits @@ -0,0 +1 @@ +../../Task/Next-highest-int-from-digits/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Nim-game b/Lang/PascalABC.NET/Nim-game new file mode 120000 index 0000000000..11fed8b04f --- /dev/null +++ b/Lang/PascalABC.NET/Nim-game @@ -0,0 +1 @@ +../../Task/Nim-game/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Non-continuous-subsequences b/Lang/PascalABC.NET/Non-continuous-subsequences new file mode 120000 index 0000000000..fb90313f8e --- /dev/null +++ b/Lang/PascalABC.NET/Non-continuous-subsequences @@ -0,0 +1 @@ +../../Task/Non-continuous-subsequences/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Nonoblock b/Lang/PascalABC.NET/Nonoblock new file mode 120000 index 0000000000..27ec8aac45 --- /dev/null +++ b/Lang/PascalABC.NET/Nonoblock @@ -0,0 +1 @@ +../../Task/Nonoblock/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Nth b/Lang/PascalABC.NET/Nth new file mode 120000 index 0000000000..2151e00c8d --- /dev/null +++ b/Lang/PascalABC.NET/Nth @@ -0,0 +1 @@ +../../Task/Nth/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Null-object b/Lang/PascalABC.NET/Null-object new file mode 120000 index 0000000000..39b6da0acb --- /dev/null +++ b/Lang/PascalABC.NET/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Numbers-which-are-not-the-sum-of-distinct-squares b/Lang/PascalABC.NET/Numbers-which-are-not-the-sum-of-distinct-squares new file mode 120000 index 0000000000..11f633b289 --- /dev/null +++ b/Lang/PascalABC.NET/Numbers-which-are-not-the-sum-of-distinct-squares @@ -0,0 +1 @@ +../../Task/Numbers-which-are-not-the-sum-of-distinct-squares/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors b/Lang/PascalABC.NET/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors new file mode 120000 index 0000000000..3b98dabeae --- /dev/null +++ b/Lang/PascalABC.NET/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors @@ -0,0 +1 @@ +../../Task/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Numbers-with-equal-rises-and-falls b/Lang/PascalABC.NET/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..265a6e57f2 --- /dev/null +++ b/Lang/PascalABC.NET/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Numeric-error-propagation b/Lang/PascalABC.NET/Numeric-error-propagation new file mode 120000 index 0000000000..b8b2e6d9b5 --- /dev/null +++ b/Lang/PascalABC.NET/Numeric-error-propagation @@ -0,0 +1 @@ +../../Task/Numeric-error-propagation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Numerical-integration b/Lang/PascalABC.NET/Numerical-integration new file mode 120000 index 0000000000..dc5bfcc884 --- /dev/null +++ b/Lang/PascalABC.NET/Numerical-integration @@ -0,0 +1 @@ +../../Task/Numerical-integration/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Object-serialization b/Lang/PascalABC.NET/Object-serialization new file mode 120000 index 0000000000..07426b45b7 --- /dev/null +++ b/Lang/PascalABC.NET/Object-serialization @@ -0,0 +1 @@ +../../Task/Object-serialization/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Odd-word-problem b/Lang/PascalABC.NET/Odd-word-problem new file mode 120000 index 0000000000..b0936fb34b --- /dev/null +++ b/Lang/PascalABC.NET/Odd-word-problem @@ -0,0 +1 @@ +../../Task/Odd-word-problem/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/One-dimensional-cellular-automata b/Lang/PascalABC.NET/One-dimensional-cellular-automata new file mode 120000 index 0000000000..19b52c40ec --- /dev/null +++ b/Lang/PascalABC.NET/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/One-of-n-lines-in-a-file b/Lang/PascalABC.NET/One-of-n-lines-in-a-file new file mode 120000 index 0000000000..6a1426ac8c --- /dev/null +++ b/Lang/PascalABC.NET/One-of-n-lines-in-a-file @@ -0,0 +1 @@ +../../Task/One-of-n-lines-in-a-file/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/OpenWebNet-password b/Lang/PascalABC.NET/OpenWebNet-password new file mode 120000 index 0000000000..41ce8aa36a --- /dev/null +++ b/Lang/PascalABC.NET/OpenWebNet-password @@ -0,0 +1 @@ +../../Task/OpenWebNet-password/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Operator-precedence b/Lang/PascalABC.NET/Operator-precedence new file mode 120000 index 0000000000..08a1b040c3 --- /dev/null +++ b/Lang/PascalABC.NET/Operator-precedence @@ -0,0 +1 @@ +../../Task/Operator-precedence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Order-two-numerical-lists b/Lang/PascalABC.NET/Order-two-numerical-lists new file mode 120000 index 0000000000..8f392c8ff3 --- /dev/null +++ b/Lang/PascalABC.NET/Order-two-numerical-lists @@ -0,0 +1 @@ +../../Task/Order-two-numerical-lists/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Ordered-words b/Lang/PascalABC.NET/Ordered-words new file mode 120000 index 0000000000..d3217a2d03 --- /dev/null +++ b/Lang/PascalABC.NET/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Padovan-n-step-number-sequences b/Lang/PascalABC.NET/Padovan-n-step-number-sequences new file mode 120000 index 0000000000..2e49ed2259 --- /dev/null +++ b/Lang/PascalABC.NET/Padovan-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Padovan-n-step-number-sequences/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Padovan-sequence b/Lang/PascalABC.NET/Padovan-sequence new file mode 120000 index 0000000000..c2c68fb6dd --- /dev/null +++ b/Lang/PascalABC.NET/Padovan-sequence @@ -0,0 +1 @@ +../../Task/Padovan-sequence/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Palindrome-dates b/Lang/PascalABC.NET/Palindrome-dates new file mode 120000 index 0000000000..09644b6a7c --- /dev/null +++ b/Lang/PascalABC.NET/Palindrome-dates @@ -0,0 +1 @@ +../../Task/Palindrome-dates/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Palindrome-detection b/Lang/PascalABC.NET/Palindrome-detection new file mode 120000 index 0000000000..cc92721e9f --- /dev/null +++ b/Lang/PascalABC.NET/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Palindromic-gapful-numbers b/Lang/PascalABC.NET/Palindromic-gapful-numbers new file mode 120000 index 0000000000..532e5bda78 --- /dev/null +++ b/Lang/PascalABC.NET/Palindromic-gapful-numbers @@ -0,0 +1 @@ +../../Task/Palindromic-gapful-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Pancake-numbers b/Lang/PascalABC.NET/Pancake-numbers new file mode 120000 index 0000000000..b4faf1b68d --- /dev/null +++ b/Lang/PascalABC.NET/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Pangram-checker b/Lang/PascalABC.NET/Pangram-checker new file mode 120000 index 0000000000..114e870600 --- /dev/null +++ b/Lang/PascalABC.NET/Pangram-checker @@ -0,0 +1 @@ +../../Task/Pangram-checker/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Paraffins b/Lang/PascalABC.NET/Paraffins new file mode 120000 index 0000000000..bafd6e0939 --- /dev/null +++ b/Lang/PascalABC.NET/Paraffins @@ -0,0 +1 @@ +../../Task/Paraffins/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Parallel-calculations b/Lang/PascalABC.NET/Parallel-calculations new file mode 120000 index 0000000000..e88e92c1df --- /dev/null +++ b/Lang/PascalABC.NET/Parallel-calculations @@ -0,0 +1 @@ +../../Task/Parallel-calculations/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Parametric-polymorphism b/Lang/PascalABC.NET/Parametric-polymorphism new file mode 120000 index 0000000000..7c242be133 --- /dev/null +++ b/Lang/PascalABC.NET/Parametric-polymorphism @@ -0,0 +1 @@ +../../Task/Parametric-polymorphism/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Parsing-RPN-calculator-algorithm b/Lang/PascalABC.NET/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..c4ae7949cd --- /dev/null +++ b/Lang/PascalABC.NET/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Partition-an-integer-x-into-n-primes b/Lang/PascalABC.NET/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..eb7a5e97f7 --- /dev/null +++ b/Lang/PascalABC.NET/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Partition-function-P b/Lang/PascalABC.NET/Partition-function-P new file mode 120000 index 0000000000..e780cc5e40 --- /dev/null +++ b/Lang/PascalABC.NET/Partition-function-P @@ -0,0 +1 @@ +../../Task/Partition-function-P/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Pascal-matrix-generation b/Lang/PascalABC.NET/Pascal-matrix-generation new file mode 120000 index 0000000000..c8097eca88 --- /dev/null +++ b/Lang/PascalABC.NET/Pascal-matrix-generation @@ -0,0 +1 @@ +../../Task/Pascal-matrix-generation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Pascals-triangle b/Lang/PascalABC.NET/Pascals-triangle new file mode 120000 index 0000000000..1089718a97 --- /dev/null +++ b/Lang/PascalABC.NET/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Pascals-triangle-Puzzle b/Lang/PascalABC.NET/Pascals-triangle-Puzzle new file mode 120000 index 0000000000..8106a5db3a --- /dev/null +++ b/Lang/PascalABC.NET/Pascals-triangle-Puzzle @@ -0,0 +1 @@ +../../Task/Pascals-triangle-Puzzle/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Pathological-floating-point-problems b/Lang/PascalABC.NET/Pathological-floating-point-problems new file mode 120000 index 0000000000..7eaa34e4a8 --- /dev/null +++ b/Lang/PascalABC.NET/Pathological-floating-point-problems @@ -0,0 +1 @@ +../../Task/Pathological-floating-point-problems/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Pells-equation b/Lang/PascalABC.NET/Pells-equation new file mode 120000 index 0000000000..1729f4ebb8 --- /dev/null +++ b/Lang/PascalABC.NET/Pells-equation @@ -0,0 +1 @@ +../../Task/Pells-equation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Perfect-shuffle b/Lang/PascalABC.NET/Perfect-shuffle new file mode 120000 index 0000000000..5ea5d5cf28 --- /dev/null +++ b/Lang/PascalABC.NET/Perfect-shuffle @@ -0,0 +1 @@ +../../Task/Perfect-shuffle/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Perfect-totient-numbers b/Lang/PascalABC.NET/Perfect-totient-numbers new file mode 120000 index 0000000000..8aae312612 --- /dev/null +++ b/Lang/PascalABC.NET/Perfect-totient-numbers @@ -0,0 +1 @@ +../../Task/Perfect-totient-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Permutation-test b/Lang/PascalABC.NET/Permutation-test new file mode 120000 index 0000000000..38efc59733 --- /dev/null +++ b/Lang/PascalABC.NET/Permutation-test @@ -0,0 +1 @@ +../../Task/Permutation-test/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Permutations b/Lang/PascalABC.NET/Permutations new file mode 120000 index 0000000000..e1329591d7 --- /dev/null +++ b/Lang/PascalABC.NET/Permutations @@ -0,0 +1 @@ +../../Task/Permutations/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Permutations-Derangements b/Lang/PascalABC.NET/Permutations-Derangements new file mode 120000 index 0000000000..4c7dd2b64b --- /dev/null +++ b/Lang/PascalABC.NET/Permutations-Derangements @@ -0,0 +1 @@ +../../Task/Permutations-Derangements/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Pick-random-element b/Lang/PascalABC.NET/Pick-random-element new file mode 120000 index 0000000000..9dd6351bad --- /dev/null +++ b/Lang/PascalABC.NET/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Plot-coordinate-pairs b/Lang/PascalABC.NET/Plot-coordinate-pairs new file mode 120000 index 0000000000..4d0282311b --- /dev/null +++ b/Lang/PascalABC.NET/Plot-coordinate-pairs @@ -0,0 +1 @@ +../../Task/Plot-coordinate-pairs/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Pointers-and-references b/Lang/PascalABC.NET/Pointers-and-references new file mode 120000 index 0000000000..6985ca1666 --- /dev/null +++ b/Lang/PascalABC.NET/Pointers-and-references @@ -0,0 +1 @@ +../../Task/Pointers-and-references/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Polymorphic-copy b/Lang/PascalABC.NET/Polymorphic-copy new file mode 120000 index 0000000000..7ed8b814ad --- /dev/null +++ b/Lang/PascalABC.NET/Polymorphic-copy @@ -0,0 +1 @@ +../../Task/Polymorphic-copy/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Polymorphism b/Lang/PascalABC.NET/Polymorphism new file mode 120000 index 0000000000..4996bdacfd --- /dev/null +++ b/Lang/PascalABC.NET/Polymorphism @@ -0,0 +1 @@ +../../Task/Polymorphism/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Population-count b/Lang/PascalABC.NET/Population-count new file mode 120000 index 0000000000..742c56a591 --- /dev/null +++ b/Lang/PascalABC.NET/Population-count @@ -0,0 +1 @@ +../../Task/Population-count/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Power-set b/Lang/PascalABC.NET/Power-set new file mode 120000 index 0000000000..042d839f30 --- /dev/null +++ b/Lang/PascalABC.NET/Power-set @@ -0,0 +1 @@ +../../Task/Power-set/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Primality-by-trial-division b/Lang/PascalABC.NET/Primality-by-trial-division new file mode 120000 index 0000000000..62ca027b6e --- /dev/null +++ b/Lang/PascalABC.NET/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Prime-decomposition b/Lang/PascalABC.NET/Prime-decomposition new file mode 120000 index 0000000000..ea96188341 --- /dev/null +++ b/Lang/PascalABC.NET/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Program-name b/Lang/PascalABC.NET/Program-name new file mode 120000 index 0000000000..6bdce5a90a --- /dev/null +++ b/Lang/PascalABC.NET/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Program-termination b/Lang/PascalABC.NET/Program-termination new file mode 120000 index 0000000000..63645717ea --- /dev/null +++ b/Lang/PascalABC.NET/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Queue-Definition b/Lang/PascalABC.NET/Queue-Definition new file mode 120000 index 0000000000..efb10e6df2 --- /dev/null +++ b/Lang/PascalABC.NET/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Queue-Usage b/Lang/PascalABC.NET/Queue-Usage new file mode 120000 index 0000000000..eab42cf449 --- /dev/null +++ b/Lang/PascalABC.NET/Queue-Usage @@ -0,0 +1 @@ +../../Task/Queue-Usage/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Quine b/Lang/PascalABC.NET/Quine new file mode 120000 index 0000000000..98ce8f9f2f --- /dev/null +++ b/Lang/PascalABC.NET/Quine @@ -0,0 +1 @@ +../../Task/Quine/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Quoting-constructs b/Lang/PascalABC.NET/Quoting-constructs new file mode 120000 index 0000000000..971db935d4 --- /dev/null +++ b/Lang/PascalABC.NET/Quoting-constructs @@ -0,0 +1 @@ +../../Task/Quoting-constructs/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/RPG-attributes-generator b/Lang/PascalABC.NET/RPG-attributes-generator new file mode 120000 index 0000000000..ddbe45c835 --- /dev/null +++ b/Lang/PascalABC.NET/RPG-attributes-generator @@ -0,0 +1 @@ +../../Task/RPG-attributes-generator/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Radical-of-an-integer b/Lang/PascalABC.NET/Radical-of-an-integer new file mode 120000 index 0000000000..430a252ecf --- /dev/null +++ b/Lang/PascalABC.NET/Radical-of-an-integer @@ -0,0 +1 @@ +../../Task/Radical-of-an-integer/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Ramer-Douglas-Peucker-line-simplification b/Lang/PascalABC.NET/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..31e2b26ec5 --- /dev/null +++ b/Lang/PascalABC.NET/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Random-numbers b/Lang/PascalABC.NET/Random-numbers new file mode 120000 index 0000000000..da187d2cc0 --- /dev/null +++ b/Lang/PascalABC.NET/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Read-a-file-character-by-character-UTF8 b/Lang/PascalABC.NET/Read-a-file-character-by-character-UTF8 new file mode 120000 index 0000000000..a425a12499 --- /dev/null +++ b/Lang/PascalABC.NET/Read-a-file-character-by-character-UTF8 @@ -0,0 +1 @@ +../../Task/Read-a-file-character-by-character-UTF8/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Read-a-file-line-by-line b/Lang/PascalABC.NET/Read-a-file-line-by-line new file mode 120000 index 0000000000..bd96f90ae1 --- /dev/null +++ b/Lang/PascalABC.NET/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Read-a-specific-line-from-a-file b/Lang/PascalABC.NET/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..28703147aa --- /dev/null +++ b/Lang/PascalABC.NET/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Read-entire-file b/Lang/PascalABC.NET/Read-entire-file new file mode 120000 index 0000000000..20a95b9d77 --- /dev/null +++ b/Lang/PascalABC.NET/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Real-constants-and-functions b/Lang/PascalABC.NET/Real-constants-and-functions new file mode 120000 index 0000000000..a6e7dce16d --- /dev/null +++ b/Lang/PascalABC.NET/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Reflection-List-methods b/Lang/PascalABC.NET/Reflection-List-methods new file mode 120000 index 0000000000..7e40bca2fa --- /dev/null +++ b/Lang/PascalABC.NET/Reflection-List-methods @@ -0,0 +1 @@ +../../Task/Reflection-List-methods/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Reflection-List-properties b/Lang/PascalABC.NET/Reflection-List-properties new file mode 120000 index 0000000000..ed60f425f0 --- /dev/null +++ b/Lang/PascalABC.NET/Reflection-List-properties @@ -0,0 +1 @@ +../../Task/Reflection-List-properties/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Regular-expressions b/Lang/PascalABC.NET/Regular-expressions new file mode 120000 index 0000000000..a3ccbe1574 --- /dev/null +++ b/Lang/PascalABC.NET/Regular-expressions @@ -0,0 +1 @@ +../../Task/Regular-expressions/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Remove-duplicate-elements b/Lang/PascalABC.NET/Remove-duplicate-elements new file mode 120000 index 0000000000..6f37a5852e --- /dev/null +++ b/Lang/PascalABC.NET/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Remove-lines-from-a-file b/Lang/PascalABC.NET/Remove-lines-from-a-file new file mode 120000 index 0000000000..6e76bee372 --- /dev/null +++ b/Lang/PascalABC.NET/Remove-lines-from-a-file @@ -0,0 +1 @@ +../../Task/Remove-lines-from-a-file/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Rename-a-file b/Lang/PascalABC.NET/Rename-a-file new file mode 120000 index 0000000000..e7599165d6 --- /dev/null +++ b/Lang/PascalABC.NET/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Repeat b/Lang/PascalABC.NET/Repeat new file mode 120000 index 0000000000..e16283f972 --- /dev/null +++ b/Lang/PascalABC.NET/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Repeat-a-string b/Lang/PascalABC.NET/Repeat-a-string new file mode 120000 index 0000000000..c21e0bfde3 --- /dev/null +++ b/Lang/PascalABC.NET/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Return-multiple-values b/Lang/PascalABC.NET/Return-multiple-values new file mode 120000 index 0000000000..5178c8dd1d --- /dev/null +++ b/Lang/PascalABC.NET/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Reverse-a-string b/Lang/PascalABC.NET/Reverse-a-string new file mode 120000 index 0000000000..8e67838296 --- /dev/null +++ b/Lang/PascalABC.NET/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Reverse-words-in-a-string b/Lang/PascalABC.NET/Reverse-words-in-a-string new file mode 120000 index 0000000000..aa82b64f3b --- /dev/null +++ b/Lang/PascalABC.NET/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Roman-numerals-Decode b/Lang/PascalABC.NET/Roman-numerals-Decode new file mode 120000 index 0000000000..990d667ad0 --- /dev/null +++ b/Lang/PascalABC.NET/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Roman-numerals-Encode b/Lang/PascalABC.NET/Roman-numerals-Encode new file mode 120000 index 0000000000..c8f15e15fa --- /dev/null +++ b/Lang/PascalABC.NET/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Roots-of-unity b/Lang/PascalABC.NET/Roots-of-unity new file mode 120000 index 0000000000..31b7a73b39 --- /dev/null +++ b/Lang/PascalABC.NET/Roots-of-unity @@ -0,0 +1 @@ +../../Task/Roots-of-unity/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Rosetta-Code-Rank-languages-by-popularity b/Lang/PascalABC.NET/Rosetta-Code-Rank-languages-by-popularity new file mode 120000 index 0000000000..55aa7d4f0c --- /dev/null +++ b/Lang/PascalABC.NET/Rosetta-Code-Rank-languages-by-popularity @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Rank-languages-by-popularity/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Rot-13 b/Lang/PascalABC.NET/Rot-13 new file mode 120000 index 0000000000..f7c9e778c9 --- /dev/null +++ b/Lang/PascalABC.NET/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Scope-modifiers b/Lang/PascalABC.NET/Scope-modifiers new file mode 120000 index 0000000000..eb11f44070 --- /dev/null +++ b/Lang/PascalABC.NET/Scope-modifiers @@ -0,0 +1 @@ +../../Task/Scope-modifiers/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Search-a-list-of-records b/Lang/PascalABC.NET/Search-a-list-of-records new file mode 120000 index 0000000000..7e72a33d4d --- /dev/null +++ b/Lang/PascalABC.NET/Search-a-list-of-records @@ -0,0 +1 @@ +../../Task/Search-a-list-of-records/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Send-an-unknown-method-call b/Lang/PascalABC.NET/Send-an-unknown-method-call new file mode 120000 index 0000000000..2e049c05b3 --- /dev/null +++ b/Lang/PascalABC.NET/Send-an-unknown-method-call @@ -0,0 +1 @@ +../../Task/Send-an-unknown-method-call/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sequence-of-primes-by-trial-division b/Lang/PascalABC.NET/Sequence-of-primes-by-trial-division new file mode 120000 index 0000000000..4182c218d4 --- /dev/null +++ b/Lang/PascalABC.NET/Sequence-of-primes-by-trial-division @@ -0,0 +1 @@ +../../Task/Sequence-of-primes-by-trial-division/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Short-circuit-evaluation b/Lang/PascalABC.NET/Short-circuit-evaluation new file mode 120000 index 0000000000..582c107471 --- /dev/null +++ b/Lang/PascalABC.NET/Short-circuit-evaluation @@ -0,0 +1 @@ +../../Task/Short-circuit-evaluation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sierpinski-triangle b/Lang/PascalABC.NET/Sierpinski-triangle new file mode 120000 index 0000000000..7eb8f22264 --- /dev/null +++ b/Lang/PascalABC.NET/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sieve-of-Eratosthenes b/Lang/PascalABC.NET/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..c9a2623742 --- /dev/null +++ b/Lang/PascalABC.NET/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Simple-windowed-application b/Lang/PascalABC.NET/Simple-windowed-application new file mode 120000 index 0000000000..a619cd32f7 --- /dev/null +++ b/Lang/PascalABC.NET/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Singly-linked-list-Element-definition b/Lang/PascalABC.NET/Singly-linked-list-Element-definition new file mode 120000 index 0000000000..71d3f5d628 --- /dev/null +++ b/Lang/PascalABC.NET/Singly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-definition/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Singly-linked-list-Element-insertion b/Lang/PascalABC.NET/Singly-linked-list-Element-insertion new file mode 120000 index 0000000000..f60548d528 --- /dev/null +++ b/Lang/PascalABC.NET/Singly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-insertion/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sleep b/Lang/PascalABC.NET/Sleep new file mode 120000 index 0000000000..d8f830cd4f --- /dev/null +++ b/Lang/PascalABC.NET/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sort-an-array-of-composite-structures b/Lang/PascalABC.NET/Sort-an-array-of-composite-structures new file mode 120000 index 0000000000..e0459e8577 --- /dev/null +++ b/Lang/PascalABC.NET/Sort-an-array-of-composite-structures @@ -0,0 +1 @@ +../../Task/Sort-an-array-of-composite-structures/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sort-an-integer-array b/Lang/PascalABC.NET/Sort-an-integer-array new file mode 120000 index 0000000000..e2137f1191 --- /dev/null +++ b/Lang/PascalABC.NET/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sort-three-variables b/Lang/PascalABC.NET/Sort-three-variables new file mode 120000 index 0000000000..2143247222 --- /dev/null +++ b/Lang/PascalABC.NET/Sort-three-variables @@ -0,0 +1 @@ +../../Task/Sort-three-variables/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sort-using-a-custom-comparator b/Lang/PascalABC.NET/Sort-using-a-custom-comparator new file mode 120000 index 0000000000..a2ade4323b --- /dev/null +++ b/Lang/PascalABC.NET/Sort-using-a-custom-comparator @@ -0,0 +1 @@ +../../Task/Sort-using-a-custom-comparator/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sorting-algorithms-Bubble-sort b/Lang/PascalABC.NET/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..75fb7e1472 --- /dev/null +++ b/Lang/PascalABC.NET/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sorting-algorithms-Quicksort b/Lang/PascalABC.NET/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..d84582d974 --- /dev/null +++ b/Lang/PascalABC.NET/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Special-variables b/Lang/PascalABC.NET/Special-variables new file mode 120000 index 0000000000..00db4953ba --- /dev/null +++ b/Lang/PascalABC.NET/Special-variables @@ -0,0 +1 @@ +../../Task/Special-variables/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Split-a-character-string-based-on-change-of-character b/Lang/PascalABC.NET/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..b7c7bef74b --- /dev/null +++ b/Lang/PascalABC.NET/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Stack b/Lang/PascalABC.NET/Stack new file mode 120000 index 0000000000..71f695fe1b --- /dev/null +++ b/Lang/PascalABC.NET/Stack @@ -0,0 +1 @@ +../../Task/Stack/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Stack-traces b/Lang/PascalABC.NET/Stack-traces new file mode 120000 index 0000000000..b6976dc3e0 --- /dev/null +++ b/Lang/PascalABC.NET/Stack-traces @@ -0,0 +1 @@ +../../Task/Stack-traces/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Statistics-Basic b/Lang/PascalABC.NET/Statistics-Basic new file mode 120000 index 0000000000..5ef44d7d18 --- /dev/null +++ b/Lang/PascalABC.NET/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/String-append b/Lang/PascalABC.NET/String-append new file mode 120000 index 0000000000..78fd361243 --- /dev/null +++ b/Lang/PascalABC.NET/String-append @@ -0,0 +1 @@ +../../Task/String-append/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/String-case b/Lang/PascalABC.NET/String-case new file mode 120000 index 0000000000..980e55192e --- /dev/null +++ b/Lang/PascalABC.NET/String-case @@ -0,0 +1 @@ +../../Task/String-case/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/String-concatenation b/Lang/PascalABC.NET/String-concatenation new file mode 120000 index 0000000000..d7b52bf492 --- /dev/null +++ b/Lang/PascalABC.NET/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/String-interpolation-included- b/Lang/PascalABC.NET/String-interpolation-included- new file mode 120000 index 0000000000..6a1179d384 --- /dev/null +++ b/Lang/PascalABC.NET/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/String-length b/Lang/PascalABC.NET/String-length new file mode 120000 index 0000000000..1bc629e3ec --- /dev/null +++ b/Lang/PascalABC.NET/String-length @@ -0,0 +1 @@ +../../Task/String-length/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/String-matching b/Lang/PascalABC.NET/String-matching new file mode 120000 index 0000000000..f031375ab5 --- /dev/null +++ b/Lang/PascalABC.NET/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/String-prepend b/Lang/PascalABC.NET/String-prepend new file mode 120000 index 0000000000..205b3e4638 --- /dev/null +++ b/Lang/PascalABC.NET/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Strip-a-set-of-characters-from-a-string b/Lang/PascalABC.NET/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..5548033cde --- /dev/null +++ b/Lang/PascalABC.NET/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Strip-block-comments b/Lang/PascalABC.NET/Strip-block-comments new file mode 120000 index 0000000000..7a95085577 --- /dev/null +++ b/Lang/PascalABC.NET/Strip-block-comments @@ -0,0 +1 @@ +../../Task/Strip-block-comments/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Strip-comments-from-a-string b/Lang/PascalABC.NET/Strip-comments-from-a-string new file mode 120000 index 0000000000..c415553cce --- /dev/null +++ b/Lang/PascalABC.NET/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Strip-control-codes-and-extended-characters-from-a-string b/Lang/PascalABC.NET/Strip-control-codes-and-extended-characters-from-a-string new file mode 120000 index 0000000000..3175c3c416 --- /dev/null +++ b/Lang/PascalABC.NET/Strip-control-codes-and-extended-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-control-codes-and-extended-characters-from-a-string/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Strip-whitespace-from-a-string-Top-and-tail b/Lang/PascalABC.NET/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..075fc6a71b --- /dev/null +++ b/Lang/PascalABC.NET/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Substitution-cipher b/Lang/PascalABC.NET/Substitution-cipher new file mode 120000 index 0000000000..5c9f1bb54c --- /dev/null +++ b/Lang/PascalABC.NET/Substitution-cipher @@ -0,0 +1 @@ +../../Task/Substitution-cipher/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Substring b/Lang/PascalABC.NET/Substring new file mode 120000 index 0000000000..f2a607112d --- /dev/null +++ b/Lang/PascalABC.NET/Substring @@ -0,0 +1 @@ +../../Task/Substring/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Substring-Top-and-tail b/Lang/PascalABC.NET/Substring-Top-and-tail new file mode 120000 index 0000000000..b64b9c4948 --- /dev/null +++ b/Lang/PascalABC.NET/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sudan-function b/Lang/PascalABC.NET/Sudan-function new file mode 120000 index 0000000000..2a6cccd8a5 --- /dev/null +++ b/Lang/PascalABC.NET/Sudan-function @@ -0,0 +1 @@ +../../Task/Sudan-function/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sum-and-product-of-an-array b/Lang/PascalABC.NET/Sum-and-product-of-an-array new file mode 120000 index 0000000000..5bf49387d6 --- /dev/null +++ b/Lang/PascalABC.NET/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sum-digits-of-an-integer b/Lang/PascalABC.NET/Sum-digits-of-an-integer new file mode 120000 index 0000000000..84d553224a --- /dev/null +++ b/Lang/PascalABC.NET/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sum-multiples-of-3-and-5 b/Lang/PascalABC.NET/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..3792b87fe0 --- /dev/null +++ b/Lang/PascalABC.NET/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sum-of-a-series b/Lang/PascalABC.NET/Sum-of-a-series new file mode 120000 index 0000000000..1c91b8532b --- /dev/null +++ b/Lang/PascalABC.NET/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sum-of-elements-below-main-diagonal-of-matrix b/Lang/PascalABC.NET/Sum-of-elements-below-main-diagonal-of-matrix new file mode 120000 index 0000000000..055fd11a3e --- /dev/null +++ b/Lang/PascalABC.NET/Sum-of-elements-below-main-diagonal-of-matrix @@ -0,0 +1 @@ +../../Task/Sum-of-elements-below-main-diagonal-of-matrix/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Sum-of-squares b/Lang/PascalABC.NET/Sum-of-squares new file mode 120000 index 0000000000..0d6573d1ec --- /dev/null +++ b/Lang/PascalABC.NET/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Symmetric-difference b/Lang/PascalABC.NET/Symmetric-difference new file mode 120000 index 0000000000..6a0af3805f --- /dev/null +++ b/Lang/PascalABC.NET/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/System-time b/Lang/PascalABC.NET/System-time new file mode 120000 index 0000000000..b4cf3d92cb --- /dev/null +++ b/Lang/PascalABC.NET/System-time @@ -0,0 +1 @@ +../../Task/System-time/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Take-notes-on-the-command-line b/Lang/PascalABC.NET/Take-notes-on-the-command-line new file mode 120000 index 0000000000..ce2c9c51c4 --- /dev/null +++ b/Lang/PascalABC.NET/Take-notes-on-the-command-line @@ -0,0 +1 @@ +../../Task/Take-notes-on-the-command-line/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Tau-function b/Lang/PascalABC.NET/Tau-function new file mode 120000 index 0000000000..fcb633b959 --- /dev/null +++ b/Lang/PascalABC.NET/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Tau-number b/Lang/PascalABC.NET/Tau-number new file mode 120000 index 0000000000..4be8374dc0 --- /dev/null +++ b/Lang/PascalABC.NET/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Teacup-rim-text b/Lang/PascalABC.NET/Teacup-rim-text new file mode 120000 index 0000000000..408b28d813 --- /dev/null +++ b/Lang/PascalABC.NET/Teacup-rim-text @@ -0,0 +1 @@ +../../Task/Teacup-rim-text/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Temperature-conversion b/Lang/PascalABC.NET/Temperature-conversion new file mode 120000 index 0000000000..607c5a8aa1 --- /dev/null +++ b/Lang/PascalABC.NET/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Terminal-control-Clear-the-screen b/Lang/PascalABC.NET/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..ba3f668e83 --- /dev/null +++ b/Lang/PascalABC.NET/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Terminal-control-Coloured-text b/Lang/PascalABC.NET/Terminal-control-Coloured-text new file mode 120000 index 0000000000..26edde266f --- /dev/null +++ b/Lang/PascalABC.NET/Terminal-control-Coloured-text @@ -0,0 +1 @@ +../../Task/Terminal-control-Coloured-text/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Terminal-control-Cursor-movement b/Lang/PascalABC.NET/Terminal-control-Cursor-movement new file mode 120000 index 0000000000..75b038bfd2 --- /dev/null +++ b/Lang/PascalABC.NET/Terminal-control-Cursor-movement @@ -0,0 +1 @@ +../../Task/Terminal-control-Cursor-movement/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Terminal-control-Cursor-positioning b/Lang/PascalABC.NET/Terminal-control-Cursor-positioning new file mode 120000 index 0000000000..440e989070 --- /dev/null +++ b/Lang/PascalABC.NET/Terminal-control-Cursor-positioning @@ -0,0 +1 @@ +../../Task/Terminal-control-Cursor-positioning/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Terminal-control-Dimensions b/Lang/PascalABC.NET/Terminal-control-Dimensions new file mode 120000 index 0000000000..294b1506e4 --- /dev/null +++ b/Lang/PascalABC.NET/Terminal-control-Dimensions @@ -0,0 +1 @@ +../../Task/Terminal-control-Dimensions/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Terminal-control-Display-an-extended-character b/Lang/PascalABC.NET/Terminal-control-Display-an-extended-character new file mode 120000 index 0000000000..51ff55a04f --- /dev/null +++ b/Lang/PascalABC.NET/Terminal-control-Display-an-extended-character @@ -0,0 +1 @@ +../../Task/Terminal-control-Display-an-extended-character/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Terminal-control-Hiding-the-cursor b/Lang/PascalABC.NET/Terminal-control-Hiding-the-cursor new file mode 120000 index 0000000000..0f79ee5b6d --- /dev/null +++ b/Lang/PascalABC.NET/Terminal-control-Hiding-the-cursor @@ -0,0 +1 @@ +../../Task/Terminal-control-Hiding-the-cursor/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Terminal-control-Ringing-the-terminal-bell b/Lang/PascalABC.NET/Terminal-control-Ringing-the-terminal-bell new file mode 120000 index 0000000000..dbea7c8c1b --- /dev/null +++ b/Lang/PascalABC.NET/Terminal-control-Ringing-the-terminal-bell @@ -0,0 +1 @@ +../../Task/Terminal-control-Ringing-the-terminal-bell/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Test-a-function b/Lang/PascalABC.NET/Test-a-function new file mode 120000 index 0000000000..561aaeccdd --- /dev/null +++ b/Lang/PascalABC.NET/Test-a-function @@ -0,0 +1 @@ +../../Task/Test-a-function/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Time-a-function b/Lang/PascalABC.NET/Time-a-function new file mode 120000 index 0000000000..2c161d3642 --- /dev/null +++ b/Lang/PascalABC.NET/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Tokenize-a-string b/Lang/PascalABC.NET/Tokenize-a-string new file mode 120000 index 0000000000..790ef58cc8 --- /dev/null +++ b/Lang/PascalABC.NET/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Top-rank-per-group b/Lang/PascalABC.NET/Top-rank-per-group new file mode 120000 index 0000000000..09da721479 --- /dev/null +++ b/Lang/PascalABC.NET/Top-rank-per-group @@ -0,0 +1 @@ +../../Task/Top-rank-per-group/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Totient-function b/Lang/PascalABC.NET/Totient-function new file mode 120000 index 0000000000..cbbd5dcdf5 --- /dev/null +++ b/Lang/PascalABC.NET/Totient-function @@ -0,0 +1 @@ +../../Task/Totient-function/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Towers-of-Hanoi b/Lang/PascalABC.NET/Towers-of-Hanoi new file mode 120000 index 0000000000..2c8ecfee74 --- /dev/null +++ b/Lang/PascalABC.NET/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Trabb-Pardo-Knuth-algorithm b/Lang/PascalABC.NET/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..c211c9d9e3 --- /dev/null +++ b/Lang/PascalABC.NET/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Transliterate-English-text-using-the-Greek-alphabet b/Lang/PascalABC.NET/Transliterate-English-text-using-the-Greek-alphabet new file mode 120000 index 0000000000..d24a02b5a0 --- /dev/null +++ b/Lang/PascalABC.NET/Transliterate-English-text-using-the-Greek-alphabet @@ -0,0 +1 @@ +../../Task/Transliterate-English-text-using-the-Greek-alphabet/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Tree-datastructures b/Lang/PascalABC.NET/Tree-datastructures new file mode 120000 index 0000000000..2b711cc827 --- /dev/null +++ b/Lang/PascalABC.NET/Tree-datastructures @@ -0,0 +1 @@ +../../Task/Tree-datastructures/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Tree-traversal b/Lang/PascalABC.NET/Tree-traversal new file mode 120000 index 0000000000..7b8540d436 --- /dev/null +++ b/Lang/PascalABC.NET/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Trigonometric-functions b/Lang/PascalABC.NET/Trigonometric-functions new file mode 120000 index 0000000000..90b97e3cc1 --- /dev/null +++ b/Lang/PascalABC.NET/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Truncate-a-file b/Lang/PascalABC.NET/Truncate-a-file new file mode 120000 index 0000000000..e41951adf8 --- /dev/null +++ b/Lang/PascalABC.NET/Truncate-a-file @@ -0,0 +1 @@ +../../Task/Truncate-a-file/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Twos-complement b/Lang/PascalABC.NET/Twos-complement new file mode 120000 index 0000000000..b0daea87d5 --- /dev/null +++ b/Lang/PascalABC.NET/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/URL-decoding b/Lang/PascalABC.NET/URL-decoding new file mode 120000 index 0000000000..bb79d3d611 --- /dev/null +++ b/Lang/PascalABC.NET/URL-decoding @@ -0,0 +1 @@ +../../Task/URL-decoding/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/URL-encoding b/Lang/PascalABC.NET/URL-encoding new file mode 120000 index 0000000000..4e193b1e1d --- /dev/null +++ b/Lang/PascalABC.NET/URL-encoding @@ -0,0 +1 @@ +../../Task/URL-encoding/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Undefined-values b/Lang/PascalABC.NET/Undefined-values new file mode 120000 index 0000000000..799f03aa4e --- /dev/null +++ b/Lang/PascalABC.NET/Undefined-values @@ -0,0 +1 @@ +../../Task/Undefined-values/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Unicode-strings b/Lang/PascalABC.NET/Unicode-strings new file mode 120000 index 0000000000..1596fd402d --- /dev/null +++ b/Lang/PascalABC.NET/Unicode-strings @@ -0,0 +1 @@ +../../Task/Unicode-strings/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Unicode-variable-names b/Lang/PascalABC.NET/Unicode-variable-names new file mode 120000 index 0000000000..356bcbe63e --- /dev/null +++ b/Lang/PascalABC.NET/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/User-input-Text b/Lang/PascalABC.NET/User-input-Text new file mode 120000 index 0000000000..c49d403c30 --- /dev/null +++ b/Lang/PascalABC.NET/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Variables b/Lang/PascalABC.NET/Variables new file mode 120000 index 0000000000..fb0f3cb656 --- /dev/null +++ b/Lang/PascalABC.NET/Variables @@ -0,0 +1 @@ +../../Task/Variables/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Variadic-function b/Lang/PascalABC.NET/Variadic-function new file mode 120000 index 0000000000..c1bc454958 --- /dev/null +++ b/Lang/PascalABC.NET/Variadic-function @@ -0,0 +1 @@ +../../Task/Variadic-function/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Vector b/Lang/PascalABC.NET/Vector new file mode 120000 index 0000000000..d45a06a593 --- /dev/null +++ b/Lang/PascalABC.NET/Vector @@ -0,0 +1 @@ +../../Task/Vector/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Vector-products b/Lang/PascalABC.NET/Vector-products new file mode 120000 index 0000000000..8bc6e1a1f1 --- /dev/null +++ b/Lang/PascalABC.NET/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Walk-a-directory-Non-recursively b/Lang/PascalABC.NET/Walk-a-directory-Non-recursively new file mode 120000 index 0000000000..117d045320 --- /dev/null +++ b/Lang/PascalABC.NET/Walk-a-directory-Non-recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Non-recursively/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Walk-a-directory-Recursively b/Lang/PascalABC.NET/Walk-a-directory-Recursively new file mode 120000 index 0000000000..6fba185f99 --- /dev/null +++ b/Lang/PascalABC.NET/Walk-a-directory-Recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Recursively/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Window-creation b/Lang/PascalABC.NET/Window-creation new file mode 120000 index 0000000000..c656ea2a7f --- /dev/null +++ b/Lang/PascalABC.NET/Window-creation @@ -0,0 +1 @@ +../../Task/Window-creation/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Word-frequency b/Lang/PascalABC.NET/Word-frequency new file mode 120000 index 0000000000..eed444f9fc --- /dev/null +++ b/Lang/PascalABC.NET/Word-frequency @@ -0,0 +1 @@ +../../Task/Word-frequency/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Word-wrap b/Lang/PascalABC.NET/Word-wrap new file mode 120000 index 0000000000..b2cbb831f8 --- /dev/null +++ b/Lang/PascalABC.NET/Word-wrap @@ -0,0 +1 @@ +../../Task/Word-wrap/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Write-entire-file b/Lang/PascalABC.NET/Write-entire-file new file mode 120000 index 0000000000..fb24fa3029 --- /dev/null +++ b/Lang/PascalABC.NET/Write-entire-file @@ -0,0 +1 @@ +../../Task/Write-entire-file/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Write-to-Windows-event-log b/Lang/PascalABC.NET/Write-to-Windows-event-log new file mode 120000 index 0000000000..556c794eaf --- /dev/null +++ b/Lang/PascalABC.NET/Write-to-Windows-event-log @@ -0,0 +1 @@ +../../Task/Write-to-Windows-event-log/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/XML-DOM-serialization b/Lang/PascalABC.NET/XML-DOM-serialization new file mode 120000 index 0000000000..ac8822f809 --- /dev/null +++ b/Lang/PascalABC.NET/XML-DOM-serialization @@ -0,0 +1 @@ +../../Task/XML-DOM-serialization/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/XML-Input b/Lang/PascalABC.NET/XML-Input new file mode 120000 index 0000000000..6c693b433f --- /dev/null +++ b/Lang/PascalABC.NET/XML-Input @@ -0,0 +1 @@ +../../Task/XML-Input/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/XML-Output b/Lang/PascalABC.NET/XML-Output new file mode 120000 index 0000000000..c33649037e --- /dev/null +++ b/Lang/PascalABC.NET/XML-Output @@ -0,0 +1 @@ +../../Task/XML-Output/PascalABC.NET \ No newline at end of file diff --git a/Lang/PascalABC.NET/Zero-to-the-zero-power b/Lang/PascalABC.NET/Zero-to-the-zero-power new file mode 120000 index 0000000000..315543b2a3 --- /dev/null +++ b/Lang/PascalABC.NET/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/PascalABC.NET \ No newline at end of file diff --git a/Lang/Perl/Bioinformatics-base-count b/Lang/Perl/Bioinformatics-base-count deleted file mode 120000 index 38044107bd..0000000000 --- a/Lang/Perl/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Perl \ No newline at end of file diff --git a/Lang/Perl/Compare-sorting-algorithms-performance b/Lang/Perl/Compare-sorting-algorithms-performance new file mode 120000 index 0000000000..a54a5351fe --- /dev/null +++ b/Lang/Perl/Compare-sorting-algorithms-performance @@ -0,0 +1 @@ +../../Task/Compare-sorting-algorithms-performance/Perl \ No newline at end of file diff --git a/Lang/Perl/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- b/Lang/Perl/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- new file mode 120000 index 0000000000..bc2932bdb0 --- /dev/null +++ b/Lang/Perl/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n-/Perl \ No newline at end of file diff --git a/Lang/Perl/Execute-Computer-Zero b/Lang/Perl/Execute-Computer-Zero new file mode 120000 index 0000000000..f5f02da865 --- /dev/null +++ b/Lang/Perl/Execute-Computer-Zero @@ -0,0 +1 @@ +../../Task/Execute-Computer-Zero/Perl \ No newline at end of file diff --git a/Lang/Perl/K-d-tree b/Lang/Perl/K-d-tree new file mode 120000 index 0000000000..1cd4d50962 --- /dev/null +++ b/Lang/Perl/K-d-tree @@ -0,0 +1 @@ +../../Task/K-d-tree/Perl \ No newline at end of file diff --git a/Lang/Perl/Machine-code b/Lang/Perl/Machine-code new file mode 120000 index 0000000000..4729cd6042 --- /dev/null +++ b/Lang/Perl/Machine-code @@ -0,0 +1 @@ +../../Task/Machine-code/Perl \ No newline at end of file diff --git a/Lang/Perl/Meissel-Mertens-constant b/Lang/Perl/Meissel-Mertens-constant deleted file mode 120000 index d5ec169595..0000000000 --- a/Lang/Perl/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Perl \ No newline at end of file diff --git a/Lang/Perl/Miller-Rabin-primality-test b/Lang/Perl/Miller-Rabin-primality-test deleted file mode 120000 index f2d8f376aa..0000000000 --- a/Lang/Perl/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Perl \ No newline at end of file diff --git a/Lang/Perl/Prime-numbers-whose-neighboring-pairs-are-tetraprimes b/Lang/Perl/Prime-numbers-whose-neighboring-pairs-are-tetraprimes new file mode 120000 index 0000000000..fc79cb9bd2 --- /dev/null +++ b/Lang/Perl/Prime-numbers-whose-neighboring-pairs-are-tetraprimes @@ -0,0 +1 @@ +../../Task/Prime-numbers-whose-neighboring-pairs-are-tetraprimes/Perl \ No newline at end of file diff --git a/Lang/Perl/Quaternion-type b/Lang/Perl/Quaternion-type deleted file mode 120000 index 6c26830ce6..0000000000 --- a/Lang/Perl/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Perl \ No newline at end of file diff --git a/Lang/Perl/Search-in-paragraphs-text b/Lang/Perl/Search-in-paragraphs-text new file mode 120000 index 0000000000..3327049060 --- /dev/null +++ b/Lang/Perl/Search-in-paragraphs-text @@ -0,0 +1 @@ +../../Task/Search-in-paragraphs-text/Perl \ No newline at end of file diff --git a/Lang/Perl/Singular-value-decomposition b/Lang/Perl/Singular-value-decomposition new file mode 120000 index 0000000000..0fe6468df6 --- /dev/null +++ b/Lang/Perl/Singular-value-decomposition @@ -0,0 +1 @@ +../../Task/Singular-value-decomposition/Perl \ No newline at end of file diff --git a/Lang/Perl/Sorting-Algorithms-Circle-Sort b/Lang/Perl/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index dec6111fc4..0000000000 --- a/Lang/Perl/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Perl \ No newline at end of file diff --git a/Lang/Perl/Steffensens-method b/Lang/Perl/Steffensens-method new file mode 120000 index 0000000000..3b3d8146aa --- /dev/null +++ b/Lang/Perl/Steffensens-method @@ -0,0 +1 @@ +../../Task/Steffensens-method/Perl \ No newline at end of file diff --git a/Lang/Perl/Strassens-algorithm b/Lang/Perl/Strassens-algorithm new file mode 120000 index 0000000000..013c3f70b0 --- /dev/null +++ b/Lang/Perl/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Perl \ No newline at end of file diff --git a/Lang/Perl/Tropical-algebra-overloading b/Lang/Perl/Tropical-algebra-overloading new file mode 120000 index 0000000000..380da329d3 --- /dev/null +++ b/Lang/Perl/Tropical-algebra-overloading @@ -0,0 +1 @@ +../../Task/Tropical-algebra-overloading/Perl \ No newline at end of file diff --git a/Lang/Phix/00-LANG.txt b/Lang/Phix/00-LANG.txt index f89816a59f..7a127fa93c 100644 --- a/Lang/Phix/00-LANG.txt +++ b/Lang/Phix/00-LANG.txt @@ -11,15 +11,15 @@ |LCT=yes |bnf=http://phix.x10.mx/bnf.php }} -Phix is a self-hosted hybrid interpreter/compiler, developed by Pete Lomax. It is very easy to use, and similar to -[https://rosettacode.org/wiki/Category:Euphoria Euphoria]. +Phix is a self-hosted hybrid interpreter/compiler, developed by Pete Lomax.
    + -On [https://rosettacode.org/w/index.php?title=Rosetta_Code%2FRank_languages_by_popularity%2FFull_list&type=revision&diff=282496&oldid=282495 26th December 2021, Phix became the first programming language on this site to have submissions for 100% of all tasks].
    -(On 20th June 2022 [[Wren]] became the second, albeit with [https://www.rosettacode.org/wiki/Category:WrenGo 13]+[https://www.rosettacode.org/mw/index.php?title=Special%3ASearch&search=wren.h&go=Go 63] of those embedded that I, for one, have been unable to run.) +On 26th December 2021, Phix became the first language on this site to have [https://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity/Full_list?oldid=294533 submissions for 100%] of all tasks.
    +(On 20th June 2022 [[Wren]] became the second, albeit there are [https://www.rosettacode.org/wiki/Category:WrenGo 13]+[https://rosettacode.org/wiki/Special:Search?search=wren.h&wprov=acrw1_-1 66] of those I have never been able to run.) -[http://phix.x10.mx/download.php A simple 30MB download] contains a pre-compiled executable, all the sources, and'' '''everything''' ''needed to recompile them, in under 20 seconds. The download also contains a full-featured programmer's editor and about 1000 demo programs. +[http://phix.x10.mx/download.php A simple 30MB download] contains a pre-compiled executable, all the sources, and'' '''everything''' ''needed to recompile them, in under 20 seconds. The download also contains a full-featured programmer's editor and about 1000 demos. -You can also [https://replit.com/@PeteLomax1/PhixInterpreter#main.sh run Phix on replit here], and several manually transpiled and uploaded entries [https://rosettacode.org/wiki/Category:Phix/online here] +You can also [https://replit.com/@PeteLomax1/PhixInterpreter#main.sh run Phix on replit here] (1.0.3 Lnx 64 bit), and several manually transpiled and uploaded entries [https://rosettacode.org/wiki/Category:Phix/online here] Perhaps the most striking feature of Phix is that it has just five builtin data types:
    diff --git a/Lang/Phix/Bioinformatics-base-count b/Lang/Phix/Bioinformatics-base-count
    deleted file mode 120000
    index 88d72c5b75..0000000000
    --- a/Lang/Phix/Bioinformatics-base-count
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Bioinformatics-base-count/Phix
    \ No newline at end of file
    diff --git a/Lang/Phix/Meissel-Mertens-constant b/Lang/Phix/Meissel-Mertens-constant
    deleted file mode 120000
    index a9b8084fb5..0000000000
    --- a/Lang/Phix/Meissel-Mertens-constant
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Meissel-Mertens-constant/Phix
    \ No newline at end of file
    diff --git a/Lang/Phix/Miller-Rabin-primality-test b/Lang/Phix/Miller-Rabin-primality-test
    deleted file mode 120000
    index 440728dd57..0000000000
    --- a/Lang/Phix/Miller-Rabin-primality-test
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Miller-Rabin-primality-test/Phix
    \ No newline at end of file
    diff --git a/Lang/Phix/Quaternion-type b/Lang/Phix/Quaternion-type
    deleted file mode 120000
    index bae473b66e..0000000000
    --- a/Lang/Phix/Quaternion-type
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Quaternion-type/Phix
    \ No newline at end of file
    diff --git a/Lang/Phix/Sorting-Algorithms-Circle-Sort b/Lang/Phix/Sorting-Algorithms-Circle-Sort
    deleted file mode 120000
    index 2aea38718d..0000000000
    --- a/Lang/Phix/Sorting-Algorithms-Circle-Sort
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Sorting-Algorithms-Circle-Sort/Phix
    \ No newline at end of file
    diff --git a/Lang/Picat/Bioinformatics-base-count b/Lang/Picat/Bioinformatics-base-count
    deleted file mode 120000
    index c724eb719d..0000000000
    --- a/Lang/Picat/Bioinformatics-base-count
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Bioinformatics-base-count/Picat
    \ No newline at end of file
    diff --git a/Lang/Picat/Quaternion-type b/Lang/Picat/Quaternion-type
    deleted file mode 120000
    index e15dda2aeb..0000000000
    --- a/Lang/Picat/Quaternion-type
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Quaternion-type/Picat
    \ No newline at end of file
    diff --git a/Lang/Picat/Solve-a-Numbrix-puzzle b/Lang/Picat/Solve-a-Numbrix-puzzle
    new file mode 120000
    index 0000000000..0c0fc43547
    --- /dev/null
    +++ b/Lang/Picat/Solve-a-Numbrix-puzzle
    @@ -0,0 +1 @@
    +../../Task/Solve-a-Numbrix-puzzle/Picat
    \ No newline at end of file
    diff --git a/Lang/Pico-8/00-LANG.txt b/Lang/Pico-8/00-LANG.txt
    new file mode 100644
    index 0000000000..017ddd4004
    --- /dev/null
    +++ b/Lang/Pico-8/00-LANG.txt
    @@ -0,0 +1 @@
    +{{stub}}{{language|Pico-8}}
    \ No newline at end of file
    diff --git a/Lang/Pico-8/00-META.yaml b/Lang/Pico-8/00-META.yaml
    new file mode 100644
    index 0000000000..5d0c380905
    --- /dev/null
    +++ b/Lang/Pico-8/00-META.yaml
    @@ -0,0 +1,2 @@
    +---
    +from: http://rosettacode.org/wiki/Category:Pico-8
    diff --git a/Lang/Pico-8/Hello-world-Text b/Lang/Pico-8/Hello-world-Text
    new file mode 120000
    index 0000000000..8a6a254eaa
    --- /dev/null
    +++ b/Lang/Pico-8/Hello-world-Text
    @@ -0,0 +1 @@
    +../../Task/Hello-world-Text/Pico-8
    \ No newline at end of file
    diff --git a/Lang/PicoLisp/Bioinformatics-base-count b/Lang/PicoLisp/Bioinformatics-base-count
    deleted file mode 120000
    index a4931ebf04..0000000000
    --- a/Lang/PicoLisp/Bioinformatics-base-count
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Bioinformatics-base-count/PicoLisp
    \ No newline at end of file
    diff --git a/Lang/PicoLisp/Miller-Rabin-primality-test b/Lang/PicoLisp/Miller-Rabin-primality-test
    deleted file mode 120000
    index eae524ec57..0000000000
    --- a/Lang/PicoLisp/Miller-Rabin-primality-test
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Miller-Rabin-primality-test/PicoLisp
    \ No newline at end of file
    diff --git a/Lang/PicoLisp/Quaternion-type b/Lang/PicoLisp/Quaternion-type
    deleted file mode 120000
    index 2120681801..0000000000
    --- a/Lang/PicoLisp/Quaternion-type
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Quaternion-type/PicoLisp
    \ No newline at end of file
    diff --git a/Lang/Pike/Execute-Brain- b/Lang/Pike/Execute-Brain-
    new file mode 120000
    index 0000000000..dd7ee4c73b
    --- /dev/null
    +++ b/Lang/Pike/Execute-Brain-
    @@ -0,0 +1 @@
    +../../Task/Execute-Brain-/Pike
    \ No newline at end of file
    diff --git a/Lang/Pike/Miller-Rabin-primality-test b/Lang/Pike/Miller-Rabin-primality-test
    deleted file mode 120000
    index 2cc78451b0..0000000000
    --- a/Lang/Pike/Miller-Rabin-primality-test
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Miller-Rabin-primality-test/Pike
    \ No newline at end of file
    diff --git a/Lang/Plain-English/00-LANG.txt b/Lang/Plain-English/00-LANG.txt
    index b92c6008a7..087f59b9fa 100644
    --- a/Lang/Plain-English/00-LANG.txt
    +++ b/Lang/Plain-English/00-LANG.txt
    @@ -3,9 +3,9 @@
     |site=https://OsmosianPlainEnglishProgramming.blog/
     |gc=no
     |parampass=reference
    -|strength=weak
    -|express=implicit
    -|checking=both
    +|strength=strong
    +|express=explicit
    +|checking=static
     |tags=plainenglish
     |hopl=no
     |LCT=yes
    @@ -25,13 +25,19 @@ or compiled to a self-contained Microsoft Windows .exe file.
     Here is a list of what you must understand from the start:
     
     '''Fully Implemented in Itself:''' It is a single executable, with one or more human readable libraries (also written in Plain English Programming Language) which produces a new stand alone .exe with your new program in it. 
    -It is NOT a compiler only that takes in source and produces compiled code. 
    -It is NOT an IDE only, that shells out to a compiler. 
    -It is both. 
    +The project originally started as an IDE with a built-in compiler.
    +Over time, this evolved into a separate effort, resulting in a standalone compiler developed as an independent project.
    +Today, the ecosystem consists of two distinct components:
    +an IDE that includes its own integrated compiler, and a separate command-line compiler, each maintained independently.
     There is NO complete source code in another language; the system was bootstrapped in a Pascal-like language (which is no longer available) and was later re-written entirely in Plain English.
     It is "Machine Code" Low Level: The bootstrap is very basic, only able to copy itself and add raw machine code in Intel hex format, make calls to the operating system, e.g.
      
    -Call "kernel32.dll" "SetFilePointer" with the file and 0 and 0 and 2 [file_end] returning a result number.
    +Call "kernel32.dll" "SetFilePointer" with 
    +  the file [hFile]
    +  and 0 [lDistanceToMove]
    +  and 0 [lpDistanceToMoveHigh]
    +  and 2 [file_end / dwMoveMethod] 
    +  returning a result number.
     
     and call other DLLs e.g.
      
    @@ -43,21 +49,25 @@ and it can do a few other things.
     
      
     To run:
    -Start up.
    -Clear the screen.
    -Use medium letters. Use the fat pen.
    -Pick a really dark color.
    -Loop.
    -Start in the center of the screen.
    -Turn left 1/32 of the way.
    -Turn right. Move 2 inches. Turn left.
    -Write "HELLO WORLD".
    -Refresh the screen.
    -Lighten the current color about 20 percent.
    -Add 1 to a count. If the count is 32, break.
    -Repeat.
    -Wait for the escape key.
    -Shut down.
    +  Start up.
    +  Clear the screen.
    +  Use medium letters. 
    +  Use the fat pen.
    +  Pick a really dark color.
    +  Loop.
    +    Start in the center of the screen.
    +    Turn left 1/32 of the way.
    +    Turn right. 
    +    Move 2 inches. 
    +    Turn left.
    +    Write "HELLO WORLD".
    +    Refresh the screen.
    +    Lighten the current color about 20 percent.
    +    Add 1 to a count. 
    +    If the count is 32, break.
    +  Repeat.
    +  Wait for the escape key.
    +  Shut down.
     
     
     Note that standard English punctuation, word types, and sentence structure are all used. 
    @@ -79,10 +89,10 @@ Intel $8B85080000008B008B9D0C0000000103.
     And yes, that is 80x86 machine code in Intel hex format. It decompiles to
     
     
    -mov eax, [ebp+8]	; $8B8508000000 -> load the current stack address + 8 into the accumulator
    -mov eax, [eax]  	; $8B00 -> load memory pointed to by accumulator into accumulator
    -mov ebx, [ebp+12]	; $8B9D0C000000-> load the current stack address + 12 into working register
    -add [ebx],eax     	; $0103 -> add accumulator to memory pointed to by working register
    +mov eax, [ebp+8]	; $8B8508000000 -> Load the value at (EBP + 8) into EAX (1st function argument)
    +mov eax, [eax]  	; $8B00 -> Dereference EAX (load the value from the address stored in EAX)
    +mov ebx, [ebp+12]	; $8B9D0C000000-> Load the value at (EBP + 12) into EBX (2nd function argument)
    +add [ebx],eax     	; $0103 -> Add EAX to the value stored at the address in EBX
     
     
     So the language has stacked pointers (all parameters are passed by reference) to the two numbers via a number to another number and then it calls this code which gets the first number, and adds it to the second. Hopefully this example shows how high level and low level Plain English is at the same time.
    @@ -118,7 +128,7 @@ The great foo is a number.
     then values may be assigned, inside a routine
     
      
    -Put 0 into the great foo
    +Put 0 into the great foo.
     
     
     or be passed by address...
    @@ -172,8 +182,8 @@ Type reductions proceed, recursively, from left to right, until a match is found
     
      
     To decide if a number is greater than another number:
    -If the first number is greater than the second number, say yes.
    -Say no.
    +  If the first number is greater than the second number, say yes.
    +  Say no.
     
     
     '''Function:''' A routine that extracts, calculates, or otherwise derives a value from a passed parameter. Function headers take this form:
    @@ -187,14 +197,14 @@ Unlike procedures (which are called via imperative sentences) and deciders (whic
     '''Statements'''
     From the instruction manual (see link below):
     
    -(1) I really only understand five kinds of sentences:
    -(a) type definitions, which always start with A, AN, or SOME;
    -(b) global variable definitions, which always start with THE;
    -(c) routine headers, which always start with TO, which can contain:
    -(d)   conditional statements, which always start with IF; and
    -(e)   imperative statements, which start with anything else.
    +(1)  The compiler really only understand five kinds of sentences:
    +(a)   Type definitions, which always start with A, AN, or SOME;
    +(b)   Global variable definitions, which always start with THE;
    +(c)   Routine headers, which always start with TO, which can contain:
    +(d)     Conditional statements, which always start with IF; and
    +(e)     Imperative statements, which start with anything else.
     
    -(2) I treat as a name anything after A, AN, ANOTHER, SOME, or THE, up to:
    +(2) I treat as a name (that is, a variable, argument, parameter or a type) anything after A, AN, ANOTHER, SOME, or THE, up to:
     
     (a) any simple verb, like IS, ARE, CAN, or DO, or
     (b) any conjunction, like AND or OR, or
    @@ -211,7 +221,9 @@ From the instruction manual (see link below):
     The noodle built into Plain English is simply not useful enough by itself, and therefore libraries were created to assist in writing Rosetta Code tasks in Plain English.
     
     See also:
    -https://github.com/Folds/english A work in progress to normalize Plain English into a more standard compiler. For documentation on the language in general, see the instructions.pdf file in the documentation folder. The author objects (see the issues)
    +https://github.com/Folds/english A work in progress to normalize Plain English into a more standard compiler.
    +For documentation on the language in general, see the instructions.pdf file in the documentation folder. 
    +The author objects (see the issues)
     https://forums.parallax.com/discussion/163792/plain-english-programming a long rambling and unproductive (but educational, so productive in that sense) discussion of Plain English with it's author and proponents of a bare metal processor.
     
     {| class="wikitable"
    @@ -233,9 +245,219 @@ https://forums.parallax.com/discussion/163792/plain-english-programming a long r
     * Complete IDE Download
     ** [http://www.Osmosian.com/cal-4700.zip cal-4700.zip]
     *** requires Microsoft Windows
    +* Plain English Compiler (CMD / Command Line)
    +** [https://github.com/elisson-zlq3x/Plain-English-Compiler GitHub repo]
     
     ==Discussion==
     * [https://forums.parallax.com/discussion/163792/plain-english-programming Plain English Programming]
     
     ==Todo==
    -[[Reports:Tasks_not_implemented_in_PlainEnglish]]
    \ No newline at end of file
    +[[Reports:Tasks_not_implemented_in_PlainEnglish]]
    +
    +=Plain English Sources=
    +[http://osmosian.com/cal-4700.zip IDE]
    +and [https://github.com/elisson-zlq3x/Plain-English-Compiler Compiler].
    +==Creators==
    +* Gerry Rzeppa (Father)  
    +[https://www.quora.com/profile/Gerry-Rzeppa Quora Profile]  
    +[https://www.linkedin.com/in/gerry-rzeppa-17b8051b/ LinkedIn Profile]  
    +[https://twitter.com/gerryrzeppa Twitter Profile]  
    +[https://github.com/GerryRzeppa GitHub Profile]  
    +* Dan Rzeppa (Son)
    +[https://github.com/danrzeppa GitHub Profile]  
    +
    +==Contributors==
    +* Elender Góis Gallas (Plain Portuguese Creator)  
    +[https://www.quora.com/profile/Elender-G%C3%B3is-Gallas-%E3%82%A8%E3%83%AC%E3%83%B3%E3%83%87-%E3%82%AC%E3%83%A9%E3%82%B9 Quora Profile]  
    +[https://www.linkedin.com/in/elender/ LinkedIn Profile]  
    +[https://twitter.com/elenderg Twitter Profile]  
    +[https://github.com/elenderg GitHub Profile]  
    +* Pablo Cayuela (Plain Spanish Creator)
    +[https://www.linkedin.com/in/pablo-cayuela-a42b019/ LinkedIn Profile]
    +
    +==Copyright Owner==
    +* The Osmosian Order
    +** [http://www.Osmosian.com/ The Osmosian Order of Plain English Programmers] Brochure
    +*** [http://www.osmosian.com/manifesto.pdf The Osmosian Manifesto]
    +** [https://OsmosianPlainEnglishProgramming.blog/ Wordpress Blog] 
    In chronological order: +*** 2018 +**** 05 +***** 01 [https://OsmosianPlainEnglishProgramming.blog/2018/05/01/a-solution-to-the-fatal-flaw-in-relational-database-systems/ A Solution to the Fatal Flaw in Relational Database Systems] +***** 02 [https://OsmosianPlainEnglishProgramming.blog/2018/05/02/plain-english-programming-fractal-forests/ Fractal Forests] +***** 02 [https://OsmosianPlainEnglishProgramming.blog/2018/05/02/plain-english-programming-is-a-picture-worth-1000-words/ Plain English Programming — Is a Picture Worth 1000 Words?] +***** 03 [https://OsmosianPlainEnglishProgramming.blog/2018/05/03/plain-english-programming-robotics/ Robotics] +***** 03 [https://OsmosianPlainEnglishProgramming.blog/2018/05/03/plain-english-programming-a-wysiwyg-document-editor/ A WYSIWYG Document Editor] +***** 04 [https://OsmosianPlainEnglishProgramming.blog/2018/05/04/plain-english-programming-musings-on-the-a-in-ai/ Musings on the “A” in “AI”] +***** 04 [https://OsmosianPlainEnglishProgramming.blog/2018/05/04/plain-english-programming-a-simple-merge-sort/ Robotics] +***** 05 [https://OsmosianPlainEnglishProgramming.blog/2018/05/05/plain-english-programming-smoothing-polygons/ Plain English Programming — Smoothing Polygons] +***** 05 [https://OsmosianPlainEnglishProgramming.blog/2018/05/05/plain-english-programming-kobayashi-maru-primes/ Kobayashi Maru Primes] +***** 06 [https://OsmosianPlainEnglishProgramming.blog/2018/05/06/plain-english-programming-nested-ifs/ Plain English Programming — Nested IFs] +***** 06 [https://OsmosianPlainEnglishProgramming.blog/2018/05/06/plain-english-programming-the-malevolent-mathemagician/ Plain English Programming — The Malevolent Mathemagician] +***** 07 [https://OsmosianPlainEnglishProgramming.blog/2018/05/07/plain-english-programming-parsing-with-riders/ Parsing with Riders] +***** 07 [https://OsmosianPlainEnglishProgramming.blog/2018/05/07/plain-english-programming-jackson-pollocks-alphabet-soup/ Plain English Programming — Jackson Pollock’s Alphabet Soup] +***** 08 [https://OsmosianPlainEnglishProgramming.blog/2018/05/08/plain-english-programming-random-numbers/ Random Numbers] +***** 08 [https://OsmosianPlainEnglishProgramming.blog/2018/05/08/plain-english-programming-sierpinski-koch/ Sierpinski & Koch] +***** 09 [https://OsmosianPlainEnglishProgramming.blog/2018/05/09/plain-english-programming-the-travelling-salesman/ The Travelling Salesman] +***** 09 [https://OsmosianPlainEnglishProgramming.blog/2018/05/09/plain-english-programming-a-jigsaw-puzzle/ A Jigsaw Puzzle] +***** 10 [https://OsmosianPlainEnglishProgramming.blog/2018/05/10/plain-english-programming-anagrams/ Anagrams] +***** 11 [https://OsmosianPlainEnglishProgramming.blog/2018/05/11/plain-english-programming-the-amazing-multimaze/ The Amazing MultiMaze] +***** 12 [https://OsmosianPlainEnglishProgramming.blog/2018/05/12/plain-english-programming-painting-like-monet/ Painting Like Monet] +***** 13 [https://OsmosianPlainEnglishProgramming.blog/2018/05/13/plain-english-programming-bresenhams-circle-drawing-algorithm/ Bresenham’s Circle Drawing Algorithm] +***** 14 [https://OsmosianPlainEnglishProgramming.blog/2018/05/14/plain-english-programming-hiding-in-plain-sight/ Hiding in Plain Sight] +***** 14 [https://OsmosianPlainEnglishProgramming.blog/2018/05/14/plain-english-programming-sudoku-solver/ Sudoku Solver] +***** 15 [https://OsmosianPlainEnglishProgramming.blog/2018/05/15/plain-english-programming-teaching-kids/ Teaching Kids to Program] +***** 16 [https://OsmosianPlainEnglishProgramming.blog/2018/05/16/the-journey-begins/ Plain English Programming] +==IDE including Compiler== +===Creator supplied=== +*[http://www.osmosian.com/cal-3040.zip cal-3040] 2006/08/14 +**[http://www.osmosian.com/ebnf EBNF] +**[http://www.osmosian.com/instructions.pdf instructions] +*[http://www.osmosian.com/cal-4700.zip cal-4700] 2017/01/27 + +===GitHub=== +*[https://GitHub.com/GerryRzeppa/osmosian /GerryRzeppa/osmosian] cal-3040 +*[https://GitHub.com/Folds/osmosian /Folds/osmosian] cal-3040 (Unauthorized) +*[https://GitHub.com/elenderg/Portugues-Puro /elenderg/Portugues-Puro] cal-4700 Translated to Portuguese + +==Forums== +===[https://www.AnandTech.com/ AnandTech]=== +*[https://forums.anandtech.com/threads/natural-language-programming.2358744/ Natural Language Programming: Good Idea? Yes Maybe No] +*[https://forums.anandtech.com/threads/conversational-storytelling-with-javascript.2410448/ Conversational Storytelling with JavaScript] +*[https://forums.anandtech.com/threads/natural-language-programming-english-and-or-español.2559516/ Natural Language Programming -- English and/or Español] +*[https://forums.anandtech.com/threads/learning-programming.2406202/#post-36858285 Learning programming] +*[https://forums.anandtech.com/threads/official-free-tools-thread.199156/page-4#post-36861957 Official Free Tools Thread | Plain English contribution] +*[https://news.yCombinator.com/item?id=8719957 Plain English Programming (2013)] +*[https://news.yCombinator.com/item?id=19355965 Do You Approve the Plain English?] +===[https://Forum.Arduino.cc/ Arduino]=== +*[https://forum.arduino.cc/t/plain-english-programming/371096/15 Plain English Programming] +===[https://groups.google.com/g/comp.compilers/ comp.compilers]=== +*[https://groups.google.com/g/comp.compilers/c/p30I_zVRlps/m/9UshbYjqZzwJ Writing A Plain English Compiler] +*[https://groups.google.com/g/comp.compilers/c/4t3_Dq6foFA/m/CYfdnKMBkAsJ Re: A Plain English Compiler] +===[https://www.GeeksForGeeks.org/ GeeksForGeeks]=== +*[https://www.geeksforgeeks.org/the-malevolent-mathemagician-natural-language-programming/ The Malevolent Mathemagician | Natural Language Programming] +*[https://www.geeksforgeeks.org/creating-wysiwyg-document-editor/ Creating WYSIWYG Document Editor | Natural Language Programming] +*[https://www.geeksforgeeks.org/a-kobayashi-maru-approach-to-finding-primes/ A Kobayashi Maru Approach to Finding Primes] +*[https://www.geeksforgeeks.org/natural-language-programming-sorting/ Sorting | Natural Language Programming] +*[https://www.geeksforgeeks.org/natural-language-programming-teaching-kids/ Natural Language Programming — Teaching Kids] +*[https://www.geeksforgeeks.org/natural-language-programming/ Natural Language Programming] +===[https://IntFiction.org/ Interactive Fiction Community Forum]=== +*[https://intfiction.org/t/writer-wanted-for-a-conversational-storytelling-project/6169 Writer wanted for a “Conversational Storytelling” project] +*[https://intfiction.org/t/inform-system-developers-do-you-approve-the-plain-english-programming/42213 Inform system developers, do you approve the Plain English Programming?] +===[https://Forums.Parallax.com/ Parallax Forums]=== +*[https://forums.parallax.com/discussion/163792/plain-english-programming Plain English Programming] +===[https://www.PC-Control.co.uk/ PC Control Limited]=== +*[https://www.pc-control.co.uk/control/articles/article10.php Automated Maze solver using a servo hawk] +**[https://www.pc-control.co.uk/control/articles/images/photo%2009%20-%20definitions.png photo 09 - definitions] +**[https://www.pc-control.co.uk/control/articles/images/photo%2010%20-%20low-level%20helper%20routines.png photo 10 - low-level helper routines] +**[https://www.pc-control.co.uk/control/articles/images/photo%2011%20-%20mid-level%20helper%20routines.png photo 11 - mid-level helper routines] +**[https://www.pc-control.co.uk/control/articles/images/photo%2012%20-%20high-level%20helper%20routines.png photo 12 - high-level helper routines] +**[https://www.pc-control.co.uk/control/articles/images/photo%2013%20-%20main%20routine.png photo 13 - main routine] +**[https://www.pc-control.co.uk/control/articles/images/photo%2014%20-%20terminal%20output.png photo 14 - terminal output] +===[https://www.Quora.com/ Quora]=== +*Jul 06, 2021 - [https://www.quora.com/What-can-a-beginner-programmer-use-as-a-programming-IDE-I-tried-using-Visual-Studio-Express-but-it-was-too-hard-to-use-and-understand-Is-there-anything-else-I-can-use/answer/Gerry-Rzeppa What can a beginner programmer use as a programming IDE? I tried using Visual Studio Express but it was too hard to use and understand. Is there anything else I can use?] +**"To get started with Plain English, see here (it’s fast, friendly, and free):" +**Reference to another Gerry Rzeppa Quora article: Jun 27, 2021 - [https://www.quora.com/Is-there-a-right-way-to-learn-to-code-1/answer/Gerry-Rzeppa Is there a right way to learn to code?] +*Jul 06, 2021 - [https://www.quora.com/How-often-when-puzzling-out-a-solution-to-a-problem-do-you-think-or-say-aloud-Are-we-asking-the-right-question-questions/answer/Gerry-Rzeppa How often when puzzling out a solution to a problem, do you think or say aloud, “Are we asking the right question/questions?”] +**"Almost every time." +**Reference to another Gerry Rzeppa Quora article: May 11, 2021 [https://www.quora.com/What-IDE-has-impressed-you-with-its-ease-of-use-and-how-productive-were-you-with-it/answer/Gerry-Rzeppa What IDE has impressed you with its ease of use, and how productive were you with it?] +*Jul 06, 2021 - [https://www.quora.com/What-are-the-best-examples-of-poetry-written-in-programming-languages/answer/Gerry-Rzeppa What are the best examples of poetry written in programming languages?] +**A poem written in Plain English that, when run, makes the picture the poem describes. +*Jul 05, 2021 - [https://www.quora.com/What-is-the-character-limit-for-one-line-of-code-you-go-by/answer/Gerry-Rzeppa What is the character limit for one line of code you go by?] +**"... if handwritten code fits on the screen, it’s okay by me." +*Jul 05, 2021 - [https://www.quora.com/How-is-a-one-dimensional-character-array-and-a-string-similar/answer/Gerry-Rzeppa How is a one-dimensional character array and a string similar?] + +**Strings +**Substrings +**String Riders +*Jun 27, 2021 - [https://www.quora.com/Is-there-a-right-way-to-learn-to-code-1/answer/Gerry-Rzeppa Is there a right way to learn to code?] +**A offering of the Plain English IDE and personal tutoring. +*Jun 10, 2021 - [https://www.quora.com/Is-there-any-way-to-write-genuine-self-modifying-code-in-Windows/answer/Gerry-Rzeppa Is there any way to write genuine self-modifying code in Windows?] + +**Memory Map +**Memory Pointers +*Jun 10, 2021 - [https://www.quora.com/How-can-I-write-a-Python-program-where-a-bunch-of-students-will-be-assigned-thesis-themes-using-the-FIFO-method/answer/Gerry-Rzeppa How can I write a Python program where a bunch of students will be assigned thesis themes using the FIFO method?] +** Use of path variable. +** Iterative development. +** Relation of item in a list and the name of the list. +** Screen space management. +** Use of "backwards". +*Jun 09, 2021 - [https://www.quora.com/How-do-computers-execute-if-statements-to-the-core-machine-code-and-opcodes/answer/Gerry-Rzeppa How do computers execute if statements to the core machine code and opcodes?] + +** List command and explanation of display produced +** Memory Map +** Uses [https://defuse.ca/online-x86-assembler.htm Online x86 and x64 Intel Instruction Assembler] to disassemble code in the List output. +** Offers free “How to Write a Plain English Compiler in Plain English” course via email. +*Jun 08, 2021 - [https://www.quora.com/How-can-I-draw-the-flag-of-a-country-in-C-beginner/answer/Gerry-Rzeppa How can I draw the flag of a country in C#? (beginner)] +** Make a box +** Center the box +** Draw and fill the box +** Stroke +*Jun 07, 2021 - [https://www.quora.com/Is-it-wise-to-ask-query-like-why-curly-braces-are-preferred-in-C-instead-of-opening-and-closing-bracket-when-writing-functions-or-we-just-need-to-memorize-that-as-a-random-rule-Is-there-any-book-which-deals-with/answer/Gerry-Rzeppa Is it wise to ask query like why curly braces are preferred in C instead of opening and closing bracket when writing functions, or we just need to memorize that as a random rule? Is there any book which deals with such miscellaneous things about C?] +** “Arbitrary and unnecessary rule” +*Jun 06, 2021 - [https://www.quora.com/How-would-I-go-about-creating-dots-and-boxes-in-Java/answer/Gerry-Rzeppa How would I go about creating dots and boxes in Java?] +*Jun 06, 2021 - [https://www.quora.com/How-can-I-write-a-menu-driven-program-to-perform-following-operations-on-the-stack-using-array-a-i-Push-ii-Pop-iii-Peek/answer/Gerry-Rzeppa How can I write a menu-driven program to perform the following operations on the stack using array- a (i) Push (ii) Pop (iii) Peek?] +*Jun 06, 2021 - [https://www.quora.com/How-do-I-make-a-countdown-and-when-it-finishes-it-shows-a-text-in-coding-I-want-to-add-a-picture-as-a-border-or-what-else-to-countdown/answer/Gerry-Rzeppa How do I make a countdown and when it finishes, it shows a text in coding? I want to add a picture as a border or what else to countdown.] +*Jun 06, 2021 - [https://www.quora.com/What-is-recursion-Can-you-explain-the-main-principles-of-recursions-Can-you-do-the-code-algorithm-of-the-Fibonacci-series-using-recursion/answer/Gerry-Rzeppa What is recursion? Can you explain the main principles of recursions? Can you do the code/algorithm of the Fibonacci series using recursion?] +*Jun 06, 2021 - [https://www.quora.com/How-do-you-find-the-intersection-point-between-a-line-and-a-rectangle-algorithm-geometry-line-intersection-development/answer/Gerry-Rzeppa What is recursion? How do you find the intersection point between a line and a rectangle (algorithm, geometry, line, intersection, development)?] +*Jun 06, 2021 - [https://www.quora.com/How-do-you-handle-algorithms-to-create-polygons-no-Thiesen-Voronoi-Python-Shapely-Voronoi-development/answer/Gerry-Rzeppa How do you handle algorithms to create polygons (no Thiesen/Voronoi) (Python, Shapely, Voronoi, development)?] +*Jun 04, 2021 - [https://www.quora.com/I-want-to-get-into-programming-What-languages-should-I-learn-first/answer/Gerry-Rzeppa I want to get into programming. What languages should I learn first?] +*Jun 04, 2021 - [https://www.quora.com/How-do-I-make-a-programme-using-codes/answer/Gerry-Rzeppa How do I make a programme using codes?] +*Jun 04, 2021 - [https://www.quora.com/Why-is-Hello-World-the-default-line-in-programming-languages/answer/Gerry-Rzeppa Why is "Hello World" the default line in programming languages?] +*Jun 04, 2021 - [https://www.quora.com/Why-cant-I-find-any-real-photo-of-a-compiler-Is-it-too-small/answer/Gerry-Rzeppa Why can't I find any real photo of a compiler? Is it too small?] +*Jun 03, 2021 - [https://www.quora.com/Why-must-the-starting-value-of-a-control-variable-be-less-than-the-ending-value-in-a-for-loop-expression/answer/Gerry-Rzeppa Why must the starting value of a control variable be less than the ending value in a for loop expression?] +*Jun 03, 2021 - [https://www.quora.com/What-is-the-purpose-of-initialization-of-counter-variable-in-a-loop/answer/Gerry-Rzeppa What is the purpose of "initialization of counter variable" in a loop?] +*Jun 03, 2021 - [https://www.quora.com/What-is-the-nature-of-a-variable-with-real-life-examples/answer/Gerry-Rzeppa What is the nature of a variable with real life examples?] +*Jun 03, 2021 - [https://www.quora.com/Why-is-UML-a-significant-area-of-study/answer/Gerry-Rzeppa Why is UML a significant area of study?] +*May 29, 2021 [https://www.quora.com/Is-it-easier-to-write-an-interpreter-than-a-compiler-Why/answer/Gerry-Rzeppa Is it easier to write an interpreter than a compiler? Why?] +**"Yes. An interpreter can be written with less knowledge of the hardware and operating system." +**Reference to another Gerry Rzeppa Quora article: May 18, 2021 [https://www.quora.com/How-do-I-make-programming-language/answer/Gerry-Rzeppa How do I make programming language?] +*May 18, 2021 [https://www.quora.com/How-do-I-make-programming-language/answer/Gerry-Rzeppa How do I make programming language?] +**Reference to another Gerry Rzeppa Quora article: Dec 22, 2020 [https://www.quora.com/How-do-you-start-writing-your-interpreter-from-scratch/answer/Gerry-Rzeppa How do you start writing your interpreter from scratch?] +**Reference to another Gerry Rzeppa Quora article: Aug 30, 2020 [https://www.quora.com/What-is-a-compiler-and-the-stages-of-a-compiler/answer/Gerry-Rzeppa What is a compiler and the stages of a compiler?] +*May 11, 2021 [https://www.quora.com/What-IDE-has-impressed-you-with-its-ease-of-use-and-how-productive-were-you-with-it/answer/Gerry-Rzeppa What IDE has impressed you with its ease of use, and how productive were you with it?] +*Apr 28, 2021 - [https://www.quora.com/I-need-some-good-project-related-to-data-structure-I-am-a-2rd-year-computer-science-student-What-is-your-suggestion/answer/Gerry-Rzeppa I need some good project related to data structure. I am a 2rd year computer science student. What is your suggestion?] + +**Data types +***Fundamental +****byte +****record +***Pointers +****Generic +****Typed +***Strings +***Things +****Stacks +****Queues +****Hashed Indices +**Memory Map +**WYSIWYG document editor +*Apr 12, 2021 - [https://www.quora.com/What-is-the-relationship-between-a-compiler-algorithm-and-data-structure/answer/Gerry-Rzeppa What is the relationship between a compiler, algorithm, and data structure?] +** "A compiler uses data structures and algorithms to translate high-level source code into low-level executable machine code." +** Discussion of the Plain English compiler +*Mar 29, 2021 - [https://www.quora.com/What-is-the-most-interesting-Python-algorithm-in-less-than-ten-lines-of-code/answer/Gerry-Rzeppa What is the most interesting Python algorithm in less than ten lines of code?] +**Lindenmayer interpreter +*Mar 27, 2021 - [https://www.quora.com/What-is-the-best-way-to-present-an-algorithm/answer/Gerry-Rzeppa What is the best way to present an algorithm?] +**Three-step process +*Mar 24, 2021 - [https://www.quora.com/Why-is-it-hard-to-understand-linked-lists-in-programming/answer/Gerry-Rzeppa Why is it hard to understand linked lists in programming?] +**Discuss Plain English linked list. +*Dec 22, 2020 [https://www.quora.com/How-do-you-start-writing-your-interpreter-from-scratch/answer/Gerry-Rzeppa How do you start writing your interpreter from scratch?] +** “primitive” BASIC editor/interpreter +*Oct 03, 2020 - [https://www.quora.com/In-procedural-programming-how-do-you-plan-your-code-without-UML/answer/Gerry-Rzeppa In procedural programming, how do you plan your code without UML?] +**Osmosian maxim: “If it’s hard, it’s wrong.” +**Pair Programming +**"During the winter of 2005-2006, we wrote (and documented) 25,000 lines of Plain English code in just six months ..." +**'“Just tell us what you need, sonny, and we’ll show you how to live without it.”' +*Aug 30, 2020 [https://www.quora.com/What-is-a-compiler-and-the-stages-of-a-compiler/answer/Gerry-Rzeppa What is a compiler and the stages of a compiler?] +**Structure of the Plain English compiler. +*Jul 09, 2020 - [https://www.quora.com/Who-can-print-this-string-Hello-world-more-smartly-and-clearly/answer/Gerry-Rzeppa Who can print this string "Hello world" more smartly and clearly?] +**Plain English program to print in a circle. +**Español Llano (Plain Spanish) program to print in a circle. +*Jun 08, 2020 - [https://www.quora.com/Why-do-some-programmers-write-their-own-compilers/answer/Gerry-Rzeppa Why do some programmers write their own compilers?] +**'My elder son and I wrote our own Plain English compiler and IDE, in Plain English, originally, for three reasons. We wanted to know:' +***'1. Is it easier to program when you don’t have to translate your natural-language thoughts into an alternate syntax?' +***'2. Can natural languages be parsed in a relatively “sloppy” manner (as humans apparently parse them) and still provide a stable enough environment for productive programming?' +***'3. Can low-level programs (like compilers) be conveniently and efficiently written in high level languages (like English)? +**'Turns out the answers to all of three questions is, “Yes!”' + +==Successor Project (Trial)== +*[https://www.indiegogo.com/projects/the-hybrid-programming-language#/ The Hybrid Programming Language] - Plain English with snippets of formulas and graphics where needed \ No newline at end of file diff --git a/Lang/Plain-English/Character-codes b/Lang/Plain-English/Character-codes new file mode 120000 index 0000000000..fa6fa40582 --- /dev/null +++ b/Lang/Plain-English/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Plain-English \ No newline at end of file diff --git a/Lang/Pluto/00-LANG.txt b/Lang/Pluto/00-LANG.txt new file mode 100644 index 0000000000..80e65c9293 --- /dev/null +++ b/Lang/Pluto/00-LANG.txt @@ -0,0 +1,47 @@ +{{language|Pluto +|exec=interpreted +|strength=strong +|safety=safe +|express=implicit +|checking=dynamic +|gc=yes +|hopl=no +|site=https://pluto-lang.org/}} +Pluto is a superset of Lua 5.4 with a focus on general-purpose programming. While being remarkably compatible with Lua 5.4 source-code & bytecode, it enhances the standard library & adds more than a dozen highly-desired syntaxes such as switch statements, compound operators, classes, class inheritance, string interpolation, type hinting, enums, and so on. + +Pluto aspires to be a version of Lua with a larger feature-set, that is all. Pluto is not a Lua-killer, an attempted successor, or any of that. Many people (rightly so) love Lua precisely because of the design philosophy. And fundamentally, Pluto is a major deviation from Lua's design philosophy. Some may prefer this, some may not. + +The language is being developed on [https://github.com/PlutoLang/Pluto github] and pre-built binaries for 64-bit Linux, MacOS and Windows can be downloaded [https://github.com/PlutoLang/Pluto/releases here]. + +Here is a list of custom libraries used on Rosetta Code: +{|class="wikitable" +! No. !! Module name !! No. !! Module name +|- +| 1 || [[:Category:Pluto-fmt|fmt]] || 2 || [[:Category:Pluto-math2|math2]] +|- +| 3 || [[:Category:Pluto-int|int]] || 4 || [[:Category:Pluto-table2|table2]] +|- +| 5 || [[:Category:Pluto-complex|complex]] || 6 || [[:Category:Pluto-rat|rat]] +|- +| 7 || [[:Category:Pluto-queue|queue]] || 8 || [[:Category:Pluto-map|map]] +|- +| 9 || [[:Category:Pluto-list|list]] || 10 || [[:Category:Pluto-perm|perm]] +|- +|11 || [[:Category:Pluto-ansi|ansi]] || 12 || [[:Category:Pluto-io2|io2]] +|- +|13 || [[:Category:Pluto-uchar|uchar]] || 14 || [[:Category:Pluto-gchar|gchar]] +|- +|15 || [[:Category:Pluto-matrix|matrix]] || 16 || [[:Category:Pluto-poly|poly]] +|- +|17 || [[:Category:Pluto-audio|audio]] || 18 || [[:Category:Pluto-bitmap|bitmap]] +|- +|19 || [[:Category:Pluto-lsystem|lsystem]] || 20 || [[:Category:Pluto-bignum|bignum]] +|- +|} + +== To do == +[[Tasks not implemented in Pluto]] + +== See also == + +[[Lua]] \ No newline at end of file diff --git a/Lang/Pluto/00-META.yaml b/Lang/Pluto/00-META.yaml new file mode 100644 index 0000000000..4169e06d3e --- /dev/null +++ b/Lang/Pluto/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Pluto diff --git a/Lang/Pluto/100-prisoners b/Lang/Pluto/100-prisoners new file mode 120000 index 0000000000..2439d4fa2a --- /dev/null +++ b/Lang/Pluto/100-prisoners @@ -0,0 +1 @@ +../../Task/100-prisoners/Pluto \ No newline at end of file diff --git a/Lang/Pluto/9-billion-names-of-God-the-integer b/Lang/Pluto/9-billion-names-of-God-the-integer new file mode 120000 index 0000000000..03c26b8d5f --- /dev/null +++ b/Lang/Pluto/9-billion-names-of-God-the-integer @@ -0,0 +1 @@ +../../Task/9-billion-names-of-God-the-integer/Pluto \ No newline at end of file diff --git a/Lang/Pluto/99-bottles-of-beer b/Lang/Pluto/99-bottles-of-beer new file mode 120000 index 0000000000..cc21927564 --- /dev/null +++ b/Lang/Pluto/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/Pluto \ No newline at end of file diff --git a/Lang/Pluto/A+B b/Lang/Pluto/A+B new file mode 120000 index 0000000000..c26f431720 --- /dev/null +++ b/Lang/Pluto/A+B @@ -0,0 +1 @@ +../../Task/A+B/Pluto \ No newline at end of file diff --git a/Lang/Pluto/ABC-problem b/Lang/Pluto/ABC-problem new file mode 120000 index 0000000000..13affeffe2 --- /dev/null +++ b/Lang/Pluto/ABC-problem @@ -0,0 +1 @@ +../../Task/ABC-problem/Pluto \ No newline at end of file diff --git a/Lang/Pluto/AKS-test-for-primes b/Lang/Pluto/AKS-test-for-primes new file mode 120000 index 0000000000..55e9fce3e0 --- /dev/null +++ b/Lang/Pluto/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/ASCII-art-diagram-converter b/Lang/Pluto/ASCII-art-diagram-converter new file mode 120000 index 0000000000..395927ab4a --- /dev/null +++ b/Lang/Pluto/ASCII-art-diagram-converter @@ -0,0 +1 @@ +../../Task/ASCII-art-diagram-converter/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Abbreviations-automatic b/Lang/Pluto/Abbreviations-automatic new file mode 120000 index 0000000000..1d471effa2 --- /dev/null +++ b/Lang/Pluto/Abbreviations-automatic @@ -0,0 +1 @@ +../../Task/Abbreviations-automatic/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Abbreviations-easy b/Lang/Pluto/Abbreviations-easy new file mode 120000 index 0000000000..4e4f49cf5b --- /dev/null +++ b/Lang/Pluto/Abbreviations-easy @@ -0,0 +1 @@ +../../Task/Abbreviations-easy/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Abbreviations-simple b/Lang/Pluto/Abbreviations-simple new file mode 120000 index 0000000000..d62c58f891 --- /dev/null +++ b/Lang/Pluto/Abbreviations-simple @@ -0,0 +1 @@ +../../Task/Abbreviations-simple/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Abelian-sandpile-model b/Lang/Pluto/Abelian-sandpile-model new file mode 120000 index 0000000000..84e194b9d0 --- /dev/null +++ b/Lang/Pluto/Abelian-sandpile-model @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Abelian-sandpile-model-Identity b/Lang/Pluto/Abelian-sandpile-model-Identity new file mode 120000 index 0000000000..5258fd0a4e --- /dev/null +++ b/Lang/Pluto/Abelian-sandpile-model-Identity @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model-Identity/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Abstract-type b/Lang/Pluto/Abstract-type new file mode 120000 index 0000000000..f418e6a876 --- /dev/null +++ b/Lang/Pluto/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Abundant-deficient-and-perfect-number-classifications b/Lang/Pluto/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..f5843a0883 --- /dev/null +++ b/Lang/Pluto/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Abundant-odd-numbers b/Lang/Pluto/Abundant-odd-numbers new file mode 120000 index 0000000000..18495df602 --- /dev/null +++ b/Lang/Pluto/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Accumulator-factory b/Lang/Pluto/Accumulator-factory new file mode 120000 index 0000000000..09dad4bd16 --- /dev/null +++ b/Lang/Pluto/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Achilles-numbers b/Lang/Pluto/Achilles-numbers new file mode 120000 index 0000000000..0121ec15f3 --- /dev/null +++ b/Lang/Pluto/Achilles-numbers @@ -0,0 +1 @@ +../../Task/Achilles-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Ackermann-function b/Lang/Pluto/Ackermann-function new file mode 120000 index 0000000000..b2e9e8bcf4 --- /dev/null +++ b/Lang/Pluto/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Add-a-variable-to-a-class-instance-at-runtime b/Lang/Pluto/Add-a-variable-to-a-class-instance-at-runtime new file mode 120000 index 0000000000..9c086b6c80 --- /dev/null +++ b/Lang/Pluto/Add-a-variable-to-a-class-instance-at-runtime @@ -0,0 +1 @@ +../../Task/Add-a-variable-to-a-class-instance-at-runtime/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Additive-primes b/Lang/Pluto/Additive-primes new file mode 120000 index 0000000000..5fa0027662 --- /dev/null +++ b/Lang/Pluto/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Address-of-a-variable b/Lang/Pluto/Address-of-a-variable new file mode 120000 index 0000000000..db8c9fa74c --- /dev/null +++ b/Lang/Pluto/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Algebraic-data-types b/Lang/Pluto/Algebraic-data-types new file mode 120000 index 0000000000..a63223b643 --- /dev/null +++ b/Lang/Pluto/Algebraic-data-types @@ -0,0 +1 @@ +../../Task/Algebraic-data-types/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Aliquot-sequence-classifications b/Lang/Pluto/Aliquot-sequence-classifications new file mode 120000 index 0000000000..3d08da68d2 --- /dev/null +++ b/Lang/Pluto/Aliquot-sequence-classifications @@ -0,0 +1 @@ +../../Task/Aliquot-sequence-classifications/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Almkvist-Giullera-formula-for-pi b/Lang/Pluto/Almkvist-Giullera-formula-for-pi new file mode 120000 index 0000000000..a4dbb156c2 --- /dev/null +++ b/Lang/Pluto/Almkvist-Giullera-formula-for-pi @@ -0,0 +1 @@ +../../Task/Almkvist-Giullera-formula-for-pi/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Almost-prime b/Lang/Pluto/Almost-prime new file mode 120000 index 0000000000..8dfdefc597 --- /dev/null +++ b/Lang/Pluto/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Amb b/Lang/Pluto/Amb new file mode 120000 index 0000000000..5d885d9898 --- /dev/null +++ b/Lang/Pluto/Amb @@ -0,0 +1 @@ +../../Task/Amb/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Amicable-pairs b/Lang/Pluto/Amicable-pairs new file mode 120000 index 0000000000..8f6d71ca71 --- /dev/null +++ b/Lang/Pluto/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Anagrams b/Lang/Pluto/Anagrams new file mode 120000 index 0000000000..ed05036541 --- /dev/null +++ b/Lang/Pluto/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Anagrams-Deranged-anagrams b/Lang/Pluto/Anagrams-Deranged-anagrams new file mode 120000 index 0000000000..15515547a0 --- /dev/null +++ b/Lang/Pluto/Anagrams-Deranged-anagrams @@ -0,0 +1 @@ +../../Task/Anagrams-Deranged-anagrams/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Angle-difference-between-two-bearings b/Lang/Pluto/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..e89e19b294 --- /dev/null +++ b/Lang/Pluto/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Angles-geometric-normalization-and-conversion b/Lang/Pluto/Angles-geometric-normalization-and-conversion new file mode 120000 index 0000000000..bf11da216a --- /dev/null +++ b/Lang/Pluto/Angles-geometric-normalization-and-conversion @@ -0,0 +1 @@ +../../Task/Angles-geometric-normalization-and-conversion/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Anonymous-recursion b/Lang/Pluto/Anonymous-recursion new file mode 120000 index 0000000000..e9e2ff5cdd --- /dev/null +++ b/Lang/Pluto/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Anti-primes b/Lang/Pluto/Anti-primes new file mode 120000 index 0000000000..62e9118e82 --- /dev/null +++ b/Lang/Pluto/Anti-primes @@ -0,0 +1 @@ +../../Task/Anti-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Approximate-equality b/Lang/Pluto/Approximate-equality new file mode 120000 index 0000000000..65832f9c4c --- /dev/null +++ b/Lang/Pluto/Approximate-equality @@ -0,0 +1 @@ +../../Task/Approximate-equality/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Arbitrary-precision-integers-included- b/Lang/Pluto/Arbitrary-precision-integers-included- new file mode 120000 index 0000000000..63cf45fedf --- /dev/null +++ b/Lang/Pluto/Arbitrary-precision-integers-included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers-included-/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Archimedean-spiral b/Lang/Pluto/Archimedean-spiral new file mode 120000 index 0000000000..bf76191b73 --- /dev/null +++ b/Lang/Pluto/Archimedean-spiral @@ -0,0 +1 @@ +../../Task/Archimedean-spiral/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Arena-storage-pool b/Lang/Pluto/Arena-storage-pool new file mode 120000 index 0000000000..2287439dec --- /dev/null +++ b/Lang/Pluto/Arena-storage-pool @@ -0,0 +1 @@ +../../Task/Arena-storage-pool/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Arithmetic-Complex b/Lang/Pluto/Arithmetic-Complex new file mode 120000 index 0000000000..e8437b9a01 --- /dev/null +++ b/Lang/Pluto/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Arithmetic-Integer b/Lang/Pluto/Arithmetic-Integer new file mode 120000 index 0000000000..3b77091442 --- /dev/null +++ b/Lang/Pluto/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Arithmetic-Rational b/Lang/Pluto/Arithmetic-Rational new file mode 120000 index 0000000000..497dafd0e0 --- /dev/null +++ b/Lang/Pluto/Arithmetic-Rational @@ -0,0 +1 @@ +../../Task/Arithmetic-Rational/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Arithmetic-derivative b/Lang/Pluto/Arithmetic-derivative new file mode 120000 index 0000000000..9254d1c7e4 --- /dev/null +++ b/Lang/Pluto/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Arithmetic-evaluation b/Lang/Pluto/Arithmetic-evaluation new file mode 120000 index 0000000000..4f46626913 --- /dev/null +++ b/Lang/Pluto/Arithmetic-evaluation @@ -0,0 +1 @@ +../../Task/Arithmetic-evaluation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Arithmetic-geometric-mean b/Lang/Pluto/Arithmetic-geometric-mean new file mode 120000 index 0000000000..7f7bd49c54 --- /dev/null +++ b/Lang/Pluto/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Arithmetic-geometric-mean-Calculate-Pi b/Lang/Pluto/Arithmetic-geometric-mean-Calculate-Pi new file mode 120000 index 0000000000..f64109ba32 --- /dev/null +++ b/Lang/Pluto/Arithmetic-geometric-mean-Calculate-Pi @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean-Calculate-Pi/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Arithmetic-numbers b/Lang/Pluto/Arithmetic-numbers new file mode 120000 index 0000000000..9d3c7548ad --- /dev/null +++ b/Lang/Pluto/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Array-concatenation b/Lang/Pluto/Array-concatenation new file mode 120000 index 0000000000..b151e60e5d --- /dev/null +++ b/Lang/Pluto/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Arrays b/Lang/Pluto/Arrays new file mode 120000 index 0000000000..36aa2a73e2 --- /dev/null +++ b/Lang/Pluto/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Ascending-primes b/Lang/Pluto/Ascending-primes new file mode 120000 index 0000000000..b086dde9de --- /dev/null +++ b/Lang/Pluto/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Assertions b/Lang/Pluto/Assertions new file mode 120000 index 0000000000..8561bd9006 --- /dev/null +++ b/Lang/Pluto/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Associative-array-Creation b/Lang/Pluto/Associative-array-Creation new file mode 120000 index 0000000000..dab36a66d3 --- /dev/null +++ b/Lang/Pluto/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Associative-array-Iteration b/Lang/Pluto/Associative-array-Iteration new file mode 120000 index 0000000000..5ced29976c --- /dev/null +++ b/Lang/Pluto/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Associative-array-Merging b/Lang/Pluto/Associative-array-Merging new file mode 120000 index 0000000000..e8bdf6f6ca --- /dev/null +++ b/Lang/Pluto/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Attractive-numbers b/Lang/Pluto/Attractive-numbers new file mode 120000 index 0000000000..cc6d5fdf22 --- /dev/null +++ b/Lang/Pluto/Attractive-numbers @@ -0,0 +1 @@ +../../Task/Attractive-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Average-loop-length b/Lang/Pluto/Average-loop-length new file mode 120000 index 0000000000..da02c11d74 --- /dev/null +++ b/Lang/Pluto/Average-loop-length @@ -0,0 +1 @@ +../../Task/Average-loop-length/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Averages-Arithmetic-mean b/Lang/Pluto/Averages-Arithmetic-mean new file mode 120000 index 0000000000..a80eb1d9ce --- /dev/null +++ b/Lang/Pluto/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Averages-Mean-angle b/Lang/Pluto/Averages-Mean-angle new file mode 120000 index 0000000000..b2c7bb37d8 --- /dev/null +++ b/Lang/Pluto/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Averages-Mean-time-of-day b/Lang/Pluto/Averages-Mean-time-of-day new file mode 120000 index 0000000000..11b930dc65 --- /dev/null +++ b/Lang/Pluto/Averages-Mean-time-of-day @@ -0,0 +1 @@ +../../Task/Averages-Mean-time-of-day/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Averages-Median b/Lang/Pluto/Averages-Median new file mode 120000 index 0000000000..4877cdaa55 --- /dev/null +++ b/Lang/Pluto/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Averages-Mode b/Lang/Pluto/Averages-Mode new file mode 120000 index 0000000000..9ba2618c12 --- /dev/null +++ b/Lang/Pluto/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Averages-Pythagorean-means b/Lang/Pluto/Averages-Pythagorean-means new file mode 120000 index 0000000000..f4cb6461df --- /dev/null +++ b/Lang/Pluto/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Averages-Root-mean-square b/Lang/Pluto/Averages-Root-mean-square new file mode 120000 index 0000000000..744197c17a --- /dev/null +++ b/Lang/Pluto/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Averages-Simple-moving-average b/Lang/Pluto/Averages-Simple-moving-average new file mode 120000 index 0000000000..79f88ee858 --- /dev/null +++ b/Lang/Pluto/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Babbage-problem b/Lang/Pluto/Babbage-problem new file mode 120000 index 0000000000..7dd4f1e4c1 --- /dev/null +++ b/Lang/Pluto/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Balanced-brackets b/Lang/Pluto/Balanced-brackets new file mode 120000 index 0000000000..e55ebe8e48 --- /dev/null +++ b/Lang/Pluto/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Barnsley-fern b/Lang/Pluto/Barnsley-fern new file mode 120000 index 0000000000..a90021bfee --- /dev/null +++ b/Lang/Pluto/Barnsley-fern @@ -0,0 +1 @@ +../../Task/Barnsley-fern/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Base64-decode-data b/Lang/Pluto/Base64-decode-data new file mode 120000 index 0000000000..9e79a215f0 --- /dev/null +++ b/Lang/Pluto/Base64-decode-data @@ -0,0 +1 @@ +../../Task/Base64-decode-data/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Bell-numbers b/Lang/Pluto/Bell-numbers new file mode 120000 index 0000000000..12ebb36a37 --- /dev/null +++ b/Lang/Pluto/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Benfords-law b/Lang/Pluto/Benfords-law new file mode 120000 index 0000000000..b781bccffa --- /dev/null +++ b/Lang/Pluto/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Bernoulli-numbers b/Lang/Pluto/Bernoulli-numbers new file mode 120000 index 0000000000..def2b8378f --- /dev/null +++ b/Lang/Pluto/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Best-shuffle b/Lang/Pluto/Best-shuffle new file mode 120000 index 0000000000..eb98710b09 --- /dev/null +++ b/Lang/Pluto/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Bifid-cipher b/Lang/Pluto/Bifid-cipher new file mode 120000 index 0000000000..7fb890e12d --- /dev/null +++ b/Lang/Pluto/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Bin-given-limits b/Lang/Pluto/Bin-given-limits new file mode 120000 index 0000000000..89b9600240 --- /dev/null +++ b/Lang/Pluto/Bin-given-limits @@ -0,0 +1 @@ +../../Task/Bin-given-limits/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Binary-search b/Lang/Pluto/Binary-search new file mode 120000 index 0000000000..a0b45e9e17 --- /dev/null +++ b/Lang/Pluto/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Binary-strings b/Lang/Pluto/Binary-strings new file mode 120000 index 0000000000..fbf99b0505 --- /dev/null +++ b/Lang/Pluto/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Biorhythms b/Lang/Pluto/Biorhythms new file mode 120000 index 0000000000..22eb307022 --- /dev/null +++ b/Lang/Pluto/Biorhythms @@ -0,0 +1 @@ +../../Task/Biorhythms/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Bitcoin-address-validation b/Lang/Pluto/Bitcoin-address-validation new file mode 120000 index 0000000000..44983f1ea0 --- /dev/null +++ b/Lang/Pluto/Bitcoin-address-validation @@ -0,0 +1 @@ +../../Task/Bitcoin-address-validation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Bitmap b/Lang/Pluto/Bitmap new file mode 120000 index 0000000000..2eae4de5c9 --- /dev/null +++ b/Lang/Pluto/Bitmap @@ -0,0 +1 @@ +../../Task/Bitmap/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Bitmap-Bresenhams-line-algorithm b/Lang/Pluto/Bitmap-Bresenhams-line-algorithm new file mode 120000 index 0000000000..648ca4156e --- /dev/null +++ b/Lang/Pluto/Bitmap-Bresenhams-line-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Bresenhams-line-algorithm/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Bitmap-Midpoint-circle-algorithm b/Lang/Pluto/Bitmap-Midpoint-circle-algorithm new file mode 120000 index 0000000000..30e98198c1 --- /dev/null +++ b/Lang/Pluto/Bitmap-Midpoint-circle-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Midpoint-circle-algorithm/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Bitwise-operations b/Lang/Pluto/Bitwise-operations new file mode 120000 index 0000000000..7aa2755b89 --- /dev/null +++ b/Lang/Pluto/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Blum-integer b/Lang/Pluto/Blum-integer new file mode 120000 index 0000000000..29fd128c56 --- /dev/null +++ b/Lang/Pluto/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Box-the-compass b/Lang/Pluto/Box-the-compass new file mode 120000 index 0000000000..06e763904d --- /dev/null +++ b/Lang/Pluto/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Brazilian-numbers b/Lang/Pluto/Brazilian-numbers new file mode 120000 index 0000000000..2847bc95cf --- /dev/null +++ b/Lang/Pluto/Brazilian-numbers @@ -0,0 +1 @@ +../../Task/Brazilian-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Break-OO-privacy b/Lang/Pluto/Break-OO-privacy new file mode 120000 index 0000000000..00a12e0cb3 --- /dev/null +++ b/Lang/Pluto/Break-OO-privacy @@ -0,0 +1 @@ +../../Task/Break-OO-privacy/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Brilliant-numbers b/Lang/Pluto/Brilliant-numbers new file mode 120000 index 0000000000..3c956fa37f --- /dev/null +++ b/Lang/Pluto/Brilliant-numbers @@ -0,0 +1 @@ +../../Task/Brilliant-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Burrows-Wheeler-transform b/Lang/Pluto/Burrows-Wheeler-transform new file mode 120000 index 0000000000..d346f62601 --- /dev/null +++ b/Lang/Pluto/Burrows-Wheeler-transform @@ -0,0 +1 @@ +../../Task/Burrows-Wheeler-transform/Pluto \ No newline at end of file diff --git a/Lang/Pluto/CRC-32 b/Lang/Pluto/CRC-32 new file mode 120000 index 0000000000..a2f9755cc8 --- /dev/null +++ b/Lang/Pluto/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/Pluto \ No newline at end of file diff --git a/Lang/Pluto/CUSIP b/Lang/Pluto/CUSIP new file mode 120000 index 0000000000..ffc1be79c9 --- /dev/null +++ b/Lang/Pluto/CUSIP @@ -0,0 +1 @@ +../../Task/CUSIP/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Caesar-cipher b/Lang/Pluto/Caesar-cipher new file mode 120000 index 0000000000..92165c560f --- /dev/null +++ b/Lang/Pluto/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Calculating-the-value-of-e b/Lang/Pluto/Calculating-the-value-of-e new file mode 120000 index 0000000000..c85ceb9feb --- /dev/null +++ b/Lang/Pluto/Calculating-the-value-of-e @@ -0,0 +1 @@ +../../Task/Calculating-the-value-of-e/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Calkin-Wilf-sequence b/Lang/Pluto/Calkin-Wilf-sequence new file mode 120000 index 0000000000..e7c08bf16e --- /dev/null +++ b/Lang/Pluto/Calkin-Wilf-sequence @@ -0,0 +1 @@ +../../Task/Calkin-Wilf-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Call-a-foreign-language-function b/Lang/Pluto/Call-a-foreign-language-function new file mode 120000 index 0000000000..f071bb1596 --- /dev/null +++ b/Lang/Pluto/Call-a-foreign-language-function @@ -0,0 +1 @@ +../../Task/Call-a-foreign-language-function/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Call-a-function-in-a-shared-library b/Lang/Pluto/Call-a-function-in-a-shared-library new file mode 120000 index 0000000000..fb03a37240 --- /dev/null +++ b/Lang/Pluto/Call-a-function-in-a-shared-library @@ -0,0 +1 @@ +../../Task/Call-a-function-in-a-shared-library/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Call-an-object-method b/Lang/Pluto/Call-an-object-method new file mode 120000 index 0000000000..9b34265855 --- /dev/null +++ b/Lang/Pluto/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Camel-case-and-snake-case b/Lang/Pluto/Camel-case-and-snake-case new file mode 120000 index 0000000000..63e934e944 --- /dev/null +++ b/Lang/Pluto/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Canonicalize-CIDR b/Lang/Pluto/Canonicalize-CIDR new file mode 120000 index 0000000000..47427dcbdb --- /dev/null +++ b/Lang/Pluto/Canonicalize-CIDR @@ -0,0 +1 @@ +../../Task/Canonicalize-CIDR/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Cantor-set b/Lang/Pluto/Cantor-set new file mode 120000 index 0000000000..e41e42a9fe --- /dev/null +++ b/Lang/Pluto/Cantor-set @@ -0,0 +1 @@ +../../Task/Cantor-set/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Carmichael-3-strong-pseudoprimes b/Lang/Pluto/Carmichael-3-strong-pseudoprimes new file mode 120000 index 0000000000..15460b52f8 --- /dev/null +++ b/Lang/Pluto/Carmichael-3-strong-pseudoprimes @@ -0,0 +1 @@ +../../Task/Carmichael-3-strong-pseudoprimes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Case-sensitivity-of-identifiers b/Lang/Pluto/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..e37b951419 --- /dev/null +++ b/Lang/Pluto/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Casting-out-nines b/Lang/Pluto/Casting-out-nines new file mode 120000 index 0000000000..f9d2b5090f --- /dev/null +++ b/Lang/Pluto/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Catalan-numbers b/Lang/Pluto/Catalan-numbers new file mode 120000 index 0000000000..13ef84ea7e --- /dev/null +++ b/Lang/Pluto/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Catalan-numbers-Pascals-triangle b/Lang/Pluto/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..ba6ed52865 --- /dev/null +++ b/Lang/Pluto/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Catamorphism b/Lang/Pluto/Catamorphism new file mode 120000 index 0000000000..5d492b9b1c --- /dev/null +++ b/Lang/Pluto/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Chaocipher b/Lang/Pluto/Chaocipher new file mode 120000 index 0000000000..a4b28d7a7d --- /dev/null +++ b/Lang/Pluto/Chaocipher @@ -0,0 +1 @@ +../../Task/Chaocipher/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Check-input-device-is-a-terminal b/Lang/Pluto/Check-input-device-is-a-terminal new file mode 120000 index 0000000000..3b90efa3c8 --- /dev/null +++ b/Lang/Pluto/Check-input-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-input-device-is-a-terminal/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Check-output-device-is-a-terminal b/Lang/Pluto/Check-output-device-is-a-terminal new file mode 120000 index 0000000000..fc1799c10c --- /dev/null +++ b/Lang/Pluto/Check-output-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-output-device-is-a-terminal/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Check-that-file-exists b/Lang/Pluto/Check-that-file-exists new file mode 120000 index 0000000000..4438ce2610 --- /dev/null +++ b/Lang/Pluto/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Chernicks-Carmichael-numbers b/Lang/Pluto/Chernicks-Carmichael-numbers new file mode 120000 index 0000000000..027fba1c47 --- /dev/null +++ b/Lang/Pluto/Chernicks-Carmichael-numbers @@ -0,0 +1 @@ +../../Task/Chernicks-Carmichael-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Cheryls-birthday b/Lang/Pluto/Cheryls-birthday new file mode 120000 index 0000000000..30af57e589 --- /dev/null +++ b/Lang/Pluto/Cheryls-birthday @@ -0,0 +1 @@ +../../Task/Cheryls-birthday/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Chinese-remainder-theorem b/Lang/Pluto/Chinese-remainder-theorem new file mode 120000 index 0000000000..9b0d96ce42 --- /dev/null +++ b/Lang/Pluto/Chinese-remainder-theorem @@ -0,0 +1 @@ +../../Task/Chinese-remainder-theorem/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Chinese-zodiac b/Lang/Pluto/Chinese-zodiac new file mode 120000 index 0000000000..9268137a2b --- /dev/null +++ b/Lang/Pluto/Chinese-zodiac @@ -0,0 +1 @@ +../../Task/Chinese-zodiac/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Cholesky-decomposition b/Lang/Pluto/Cholesky-decomposition new file mode 120000 index 0000000000..87b60466d9 --- /dev/null +++ b/Lang/Pluto/Cholesky-decomposition @@ -0,0 +1 @@ +../../Task/Cholesky-decomposition/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Chowla-numbers b/Lang/Pluto/Chowla-numbers new file mode 120000 index 0000000000..b10ca6f6d9 --- /dev/null +++ b/Lang/Pluto/Chowla-numbers @@ -0,0 +1 @@ +../../Task/Chowla-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Church-numerals b/Lang/Pluto/Church-numerals new file mode 120000 index 0000000000..1d195312b9 --- /dev/null +++ b/Lang/Pluto/Church-numerals @@ -0,0 +1 @@ +../../Task/Church-numerals/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Circles-of-given-radius-through-two-points b/Lang/Pluto/Circles-of-given-radius-through-two-points new file mode 120000 index 0000000000..95277c7cbf --- /dev/null +++ b/Lang/Pluto/Circles-of-given-radius-through-two-points @@ -0,0 +1 @@ +../../Task/Circles-of-given-radius-through-two-points/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Circular-primes b/Lang/Pluto/Circular-primes new file mode 120000 index 0000000000..03acc9542a --- /dev/null +++ b/Lang/Pluto/Circular-primes @@ -0,0 +1 @@ +../../Task/Circular-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Classes b/Lang/Pluto/Classes new file mode 120000 index 0000000000..26462a13cb --- /dev/null +++ b/Lang/Pluto/Classes @@ -0,0 +1 @@ +../../Task/Classes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Closest-pair-problem b/Lang/Pluto/Closest-pair-problem new file mode 120000 index 0000000000..37a54ff46b --- /dev/null +++ b/Lang/Pluto/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Closures-Value-capture b/Lang/Pluto/Closures-Value-capture new file mode 120000 index 0000000000..86d660ee42 --- /dev/null +++ b/Lang/Pluto/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Collections b/Lang/Pluto/Collections new file mode 120000 index 0000000000..82a2dd2b4f --- /dev/null +++ b/Lang/Pluto/Collections @@ -0,0 +1 @@ +../../Task/Collections/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Color-wheel b/Lang/Pluto/Color-wheel new file mode 120000 index 0000000000..1f743faae0 --- /dev/null +++ b/Lang/Pluto/Color-wheel @@ -0,0 +1 @@ +../../Task/Color-wheel/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Colorful-numbers b/Lang/Pluto/Colorful-numbers new file mode 120000 index 0000000000..6fd26697f2 --- /dev/null +++ b/Lang/Pluto/Colorful-numbers @@ -0,0 +1 @@ +../../Task/Colorful-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Combinations b/Lang/Pluto/Combinations new file mode 120000 index 0000000000..1554032a2c --- /dev/null +++ b/Lang/Pluto/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Combinations-with-repetitions b/Lang/Pluto/Combinations-with-repetitions new file mode 120000 index 0000000000..27271a521e --- /dev/null +++ b/Lang/Pluto/Combinations-with-repetitions @@ -0,0 +1 @@ +../../Task/Combinations-with-repetitions/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Comma-quibbling b/Lang/Pluto/Comma-quibbling new file mode 120000 index 0000000000..d45769fa57 --- /dev/null +++ b/Lang/Pluto/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Command-line-arguments b/Lang/Pluto/Command-line-arguments new file mode 120000 index 0000000000..0f5f02829e --- /dev/null +++ b/Lang/Pluto/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Commatizing-numbers b/Lang/Pluto/Commatizing-numbers new file mode 120000 index 0000000000..703f59f582 --- /dev/null +++ b/Lang/Pluto/Commatizing-numbers @@ -0,0 +1 @@ +../../Task/Commatizing-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Comments b/Lang/Pluto/Comments new file mode 120000 index 0000000000..8d1e636123 --- /dev/null +++ b/Lang/Pluto/Comments @@ -0,0 +1 @@ +../../Task/Comments/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Compare-a-list-of-strings b/Lang/Pluto/Compare-a-list-of-strings new file mode 120000 index 0000000000..6f0ca59023 --- /dev/null +++ b/Lang/Pluto/Compare-a-list-of-strings @@ -0,0 +1 @@ +../../Task/Compare-a-list-of-strings/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Compare-length-of-two-strings b/Lang/Pluto/Compare-length-of-two-strings new file mode 120000 index 0000000000..a17ca1cb1f --- /dev/null +++ b/Lang/Pluto/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Compile-time-calculation b/Lang/Pluto/Compile-time-calculation new file mode 120000 index 0000000000..f08af0ba8e --- /dev/null +++ b/Lang/Pluto/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Compiler-lexical-analyzer b/Lang/Pluto/Compiler-lexical-analyzer new file mode 120000 index 0000000000..0e5b3d7d41 --- /dev/null +++ b/Lang/Pluto/Compiler-lexical-analyzer @@ -0,0 +1 @@ +../../Task/Compiler-lexical-analyzer/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Compound-data-type b/Lang/Pluto/Compound-data-type new file mode 120000 index 0000000000..d8d7d92b91 --- /dev/null +++ b/Lang/Pluto/Compound-data-type @@ -0,0 +1 @@ +../../Task/Compound-data-type/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Concurrent-computing b/Lang/Pluto/Concurrent-computing new file mode 120000 index 0000000000..edc4e372c5 --- /dev/null +++ b/Lang/Pluto/Concurrent-computing @@ -0,0 +1 @@ +../../Task/Concurrent-computing/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Conditional-structures b/Lang/Pluto/Conditional-structures new file mode 120000 index 0000000000..480797a688 --- /dev/null +++ b/Lang/Pluto/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Conjugate-transpose b/Lang/Pluto/Conjugate-transpose new file mode 120000 index 0000000000..dfb7444c0e --- /dev/null +++ b/Lang/Pluto/Conjugate-transpose @@ -0,0 +1 @@ +../../Task/Conjugate-transpose/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Consecutive-primes-with-ascending-or-descending-differences b/Lang/Pluto/Consecutive-primes-with-ascending-or-descending-differences new file mode 120000 index 0000000000..855ac67f9b --- /dev/null +++ b/Lang/Pluto/Consecutive-primes-with-ascending-or-descending-differences @@ -0,0 +1 @@ +../../Task/Consecutive-primes-with-ascending-or-descending-differences/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Constrained-genericity b/Lang/Pluto/Constrained-genericity new file mode 120000 index 0000000000..27aef58dac --- /dev/null +++ b/Lang/Pluto/Constrained-genericity @@ -0,0 +1 @@ +../../Task/Constrained-genericity/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Continued-fraction b/Lang/Pluto/Continued-fraction new file mode 120000 index 0000000000..413f477143 --- /dev/null +++ b/Lang/Pluto/Continued-fraction @@ -0,0 +1 @@ +../../Task/Continued-fraction/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Continued-fraction-Arithmetic-Construct-from-rational-number b/Lang/Pluto/Continued-fraction-Arithmetic-Construct-from-rational-number new file mode 120000 index 0000000000..4207df96c4 --- /dev/null +++ b/Lang/Pluto/Continued-fraction-Arithmetic-Construct-from-rational-number @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-Construct-from-rational-number/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Convert-decimal-number-to-rational b/Lang/Pluto/Convert-decimal-number-to-rational new file mode 120000 index 0000000000..67bc18205b --- /dev/null +++ b/Lang/Pluto/Convert-decimal-number-to-rational @@ -0,0 +1 @@ +../../Task/Convert-decimal-number-to-rational/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Convert-seconds-to-compound-duration b/Lang/Pluto/Convert-seconds-to-compound-duration new file mode 120000 index 0000000000..694dec3e9d --- /dev/null +++ b/Lang/Pluto/Convert-seconds-to-compound-duration @@ -0,0 +1 @@ +../../Task/Convert-seconds-to-compound-duration/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Count-in-factors b/Lang/Pluto/Count-in-factors new file mode 120000 index 0000000000..875d6814c3 --- /dev/null +++ b/Lang/Pluto/Count-in-factors @@ -0,0 +1 @@ +../../Task/Count-in-factors/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Count-in-octal b/Lang/Pluto/Count-in-octal new file mode 120000 index 0000000000..c5624def8e --- /dev/null +++ b/Lang/Pluto/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Count-occurrences-of-a-substring b/Lang/Pluto/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..282d7ede4a --- /dev/null +++ b/Lang/Pluto/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Count-the-coins b/Lang/Pluto/Count-the-coins new file mode 120000 index 0000000000..7996299523 --- /dev/null +++ b/Lang/Pluto/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Cramers-rule b/Lang/Pluto/Cramers-rule new file mode 120000 index 0000000000..371e1d9db7 --- /dev/null +++ b/Lang/Pluto/Cramers-rule @@ -0,0 +1 @@ +../../Task/Cramers-rule/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Create-a-file b/Lang/Pluto/Create-a-file new file mode 120000 index 0000000000..1e22b0b1e3 --- /dev/null +++ b/Lang/Pluto/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Create-a-two-dimensional-array-at-runtime b/Lang/Pluto/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..4da351e86e --- /dev/null +++ b/Lang/Pluto/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Cuban-primes b/Lang/Pluto/Cuban-primes new file mode 120000 index 0000000000..6b91d15127 --- /dev/null +++ b/Lang/Pluto/Cuban-primes @@ -0,0 +1 @@ +../../Task/Cuban-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Cullen-and-Woodall-numbers b/Lang/Pluto/Cullen-and-Woodall-numbers new file mode 120000 index 0000000000..663a789226 --- /dev/null +++ b/Lang/Pluto/Cullen-and-Woodall-numbers @@ -0,0 +1 @@ +../../Task/Cullen-and-Woodall-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Cumulative-standard-deviation b/Lang/Pluto/Cumulative-standard-deviation new file mode 120000 index 0000000000..bfd250d57c --- /dev/null +++ b/Lang/Pluto/Cumulative-standard-deviation @@ -0,0 +1 @@ +../../Task/Cumulative-standard-deviation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Currency b/Lang/Pluto/Currency new file mode 120000 index 0000000000..022bd123d4 --- /dev/null +++ b/Lang/Pluto/Currency @@ -0,0 +1 @@ +../../Task/Currency/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Currying b/Lang/Pluto/Currying new file mode 120000 index 0000000000..98e5282551 --- /dev/null +++ b/Lang/Pluto/Currying @@ -0,0 +1 @@ +../../Task/Currying/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Curzon-numbers b/Lang/Pluto/Curzon-numbers new file mode 120000 index 0000000000..19e831cce8 --- /dev/null +++ b/Lang/Pluto/Curzon-numbers @@ -0,0 +1 @@ +../../Task/Curzon-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Cut-a-rectangle b/Lang/Pluto/Cut-a-rectangle new file mode 120000 index 0000000000..503ba83f0f --- /dev/null +++ b/Lang/Pluto/Cut-a-rectangle @@ -0,0 +1 @@ +../../Task/Cut-a-rectangle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Cyclops-numbers b/Lang/Pluto/Cyclops-numbers new file mode 120000 index 0000000000..c731e7f9d2 --- /dev/null +++ b/Lang/Pluto/Cyclops-numbers @@ -0,0 +1 @@ +../../Task/Cyclops-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/DNS-query b/Lang/Pluto/DNS-query new file mode 120000 index 0000000000..abafcfbe46 --- /dev/null +++ b/Lang/Pluto/DNS-query @@ -0,0 +1 @@ +../../Task/DNS-query/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Damm-algorithm b/Lang/Pluto/Damm-algorithm new file mode 120000 index 0000000000..4db0c540c5 --- /dev/null +++ b/Lang/Pluto/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Date-format b/Lang/Pluto/Date-format new file mode 120000 index 0000000000..e6307f8af0 --- /dev/null +++ b/Lang/Pluto/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Date-manipulation b/Lang/Pluto/Date-manipulation new file mode 120000 index 0000000000..541e3b8538 --- /dev/null +++ b/Lang/Pluto/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Day-of-the-week b/Lang/Pluto/Day-of-the-week new file mode 120000 index 0000000000..c857bee861 --- /dev/null +++ b/Lang/Pluto/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Pluto \ No newline at end of file diff --git a/Lang/Pluto/De-Bruijn-sequences b/Lang/Pluto/De-Bruijn-sequences new file mode 120000 index 0000000000..7208c6eb97 --- /dev/null +++ b/Lang/Pluto/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Deceptive-numbers b/Lang/Pluto/Deceptive-numbers new file mode 120000 index 0000000000..f13a36d2f4 --- /dev/null +++ b/Lang/Pluto/Deceptive-numbers @@ -0,0 +1 @@ +../../Task/Deceptive-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Deepcopy b/Lang/Pluto/Deepcopy new file mode 120000 index 0000000000..066df45f7c --- /dev/null +++ b/Lang/Pluto/Deepcopy @@ -0,0 +1 @@ +../../Task/Deepcopy/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Delegates b/Lang/Pluto/Delegates new file mode 120000 index 0000000000..52103da749 --- /dev/null +++ b/Lang/Pluto/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Delete-a-file b/Lang/Pluto/Delete-a-file new file mode 120000 index 0000000000..b17ce9999b --- /dev/null +++ b/Lang/Pluto/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Demings-funnel b/Lang/Pluto/Demings-funnel new file mode 120000 index 0000000000..56a8ba2ece --- /dev/null +++ b/Lang/Pluto/Demings-funnel @@ -0,0 +1 @@ +../../Task/Demings-funnel/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Department-numbers b/Lang/Pluto/Department-numbers new file mode 120000 index 0000000000..1666a30ed8 --- /dev/null +++ b/Lang/Pluto/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Descending-primes b/Lang/Pluto/Descending-primes new file mode 120000 index 0000000000..c35e1667b5 --- /dev/null +++ b/Lang/Pluto/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Detect-division-by-zero b/Lang/Pluto/Detect-division-by-zero new file mode 120000 index 0000000000..36d9e93987 --- /dev/null +++ b/Lang/Pluto/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Determinant-and-permanent b/Lang/Pluto/Determinant-and-permanent new file mode 120000 index 0000000000..e1b29bc12a --- /dev/null +++ b/Lang/Pluto/Determinant-and-permanent @@ -0,0 +1 @@ +../../Task/Determinant-and-permanent/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Determine-if-a-string-has-all-the-same-characters b/Lang/Pluto/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..030ea85992 --- /dev/null +++ b/Lang/Pluto/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Determine-if-a-string-has-all-unique-characters b/Lang/Pluto/Determine-if-a-string-has-all-unique-characters new file mode 120000 index 0000000000..79e7e032c2 --- /dev/null +++ b/Lang/Pluto/Determine-if-a-string-has-all-unique-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-unique-characters/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Determine-if-a-string-is-collapsible b/Lang/Pluto/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..dac3838017 --- /dev/null +++ b/Lang/Pluto/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Determine-if-a-string-is-numeric b/Lang/Pluto/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..f3177e5d6e --- /dev/null +++ b/Lang/Pluto/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Determine-if-a-string-is-squeezable b/Lang/Pluto/Determine-if-a-string-is-squeezable new file mode 120000 index 0000000000..17dbb0267a --- /dev/null +++ b/Lang/Pluto/Determine-if-a-string-is-squeezable @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-squeezable/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Determine-if-two-triangles-overlap b/Lang/Pluto/Determine-if-two-triangles-overlap new file mode 120000 index 0000000000..d35e94d3a0 --- /dev/null +++ b/Lang/Pluto/Determine-if-two-triangles-overlap @@ -0,0 +1 @@ +../../Task/Determine-if-two-triangles-overlap/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Determine-sentence-type b/Lang/Pluto/Determine-sentence-type new file mode 120000 index 0000000000..d97a791028 --- /dev/null +++ b/Lang/Pluto/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Dice-game-probabilities b/Lang/Pluto/Dice-game-probabilities new file mode 120000 index 0000000000..b6d7ab05ea --- /dev/null +++ b/Lang/Pluto/Dice-game-probabilities @@ -0,0 +1 @@ +../../Task/Dice-game-probabilities/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Digital-root b/Lang/Pluto/Digital-root new file mode 120000 index 0000000000..fb194db4fd --- /dev/null +++ b/Lang/Pluto/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Digital-root-Multiplicative-digital-root b/Lang/Pluto/Digital-root-Multiplicative-digital-root new file mode 120000 index 0000000000..27b8582991 --- /dev/null +++ b/Lang/Pluto/Digital-root-Multiplicative-digital-root @@ -0,0 +1 @@ +../../Task/Digital-root-Multiplicative-digital-root/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Disarium-numbers b/Lang/Pluto/Disarium-numbers new file mode 120000 index 0000000000..fd659f8581 --- /dev/null +++ b/Lang/Pluto/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Discordian-date b/Lang/Pluto/Discordian-date new file mode 120000 index 0000000000..eef2a0d868 --- /dev/null +++ b/Lang/Pluto/Discordian-date @@ -0,0 +1 @@ +../../Task/Discordian-date/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Display-a-linear-combination b/Lang/Pluto/Display-a-linear-combination new file mode 120000 index 0000000000..b9e618e087 --- /dev/null +++ b/Lang/Pluto/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Distribution-of-0-digits-in-factorial-series b/Lang/Pluto/Distribution-of-0-digits-in-factorial-series new file mode 120000 index 0000000000..a06ffa876b --- /dev/null +++ b/Lang/Pluto/Distribution-of-0-digits-in-factorial-series @@ -0,0 +1 @@ +../../Task/Distribution-of-0-digits-in-factorial-series/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Diversity-prediction-theorem b/Lang/Pluto/Diversity-prediction-theorem new file mode 120000 index 0000000000..1855763e0b --- /dev/null +++ b/Lang/Pluto/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Doomsday-rule b/Lang/Pluto/Doomsday-rule new file mode 120000 index 0000000000..0bae1c428f --- /dev/null +++ b/Lang/Pluto/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Doubly-linked-list-Definition b/Lang/Pluto/Doubly-linked-list-Definition new file mode 120000 index 0000000000..2c673acc7c --- /dev/null +++ b/Lang/Pluto/Doubly-linked-list-Definition @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Definition/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Doubly-linked-list-Element-definition b/Lang/Pluto/Doubly-linked-list-Element-definition new file mode 120000 index 0000000000..7b2f1839e3 --- /dev/null +++ b/Lang/Pluto/Doubly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Element-definition/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Doubly-linked-list-Element-insertion b/Lang/Pluto/Doubly-linked-list-Element-insertion new file mode 120000 index 0000000000..566d3ce443 --- /dev/null +++ b/Lang/Pluto/Doubly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Element-insertion/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Doubly-linked-list-Traversal b/Lang/Pluto/Doubly-linked-list-Traversal new file mode 120000 index 0000000000..9a9262d67b --- /dev/null +++ b/Lang/Pluto/Doubly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Traversal/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Dragon-curve b/Lang/Pluto/Dragon-curve new file mode 120000 index 0000000000..f1e72e5ef1 --- /dev/null +++ b/Lang/Pluto/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Draw-a-sphere b/Lang/Pluto/Draw-a-sphere new file mode 120000 index 0000000000..639e598bda --- /dev/null +++ b/Lang/Pluto/Draw-a-sphere @@ -0,0 +1 @@ +../../Task/Draw-a-sphere/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Dutch-national-flag-problem b/Lang/Pluto/Dutch-national-flag-problem new file mode 120000 index 0000000000..4ca6eb0344 --- /dev/null +++ b/Lang/Pluto/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Dynamic-variable-names b/Lang/Pluto/Dynamic-variable-names new file mode 120000 index 0000000000..9f84b3a575 --- /dev/null +++ b/Lang/Pluto/Dynamic-variable-names @@ -0,0 +1 @@ +../../Task/Dynamic-variable-names/Pluto \ No newline at end of file diff --git a/Lang/Pluto/EKG-sequence-convergence b/Lang/Pluto/EKG-sequence-convergence new file mode 120000 index 0000000000..5e7a87aa27 --- /dev/null +++ b/Lang/Pluto/EKG-sequence-convergence @@ -0,0 +1 @@ +../../Task/EKG-sequence-convergence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Earliest-difference-between-prime-gaps b/Lang/Pluto/Earliest-difference-between-prime-gaps new file mode 120000 index 0000000000..7c35dd843e --- /dev/null +++ b/Lang/Pluto/Earliest-difference-between-prime-gaps @@ -0,0 +1 @@ +../../Task/Earliest-difference-between-prime-gaps/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Eban-numbers b/Lang/Pluto/Eban-numbers new file mode 120000 index 0000000000..3c27b7fc5e --- /dev/null +++ b/Lang/Pluto/Eban-numbers @@ -0,0 +1 @@ +../../Task/Eban-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Egyptian-division b/Lang/Pluto/Egyptian-division new file mode 120000 index 0000000000..1935b9a4b4 --- /dev/null +++ b/Lang/Pluto/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Element-wise-operations b/Lang/Pluto/Element-wise-operations new file mode 120000 index 0000000000..a809ac3319 --- /dev/null +++ b/Lang/Pluto/Element-wise-operations @@ -0,0 +1 @@ +../../Task/Element-wise-operations/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Elementary-cellular-automaton-Random-number-generator b/Lang/Pluto/Elementary-cellular-automaton-Random-number-generator new file mode 120000 index 0000000000..c9e4dd2c5e --- /dev/null +++ b/Lang/Pluto/Elementary-cellular-automaton-Random-number-generator @@ -0,0 +1 @@ +../../Task/Elementary-cellular-automaton-Random-number-generator/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Elliptic-curve-arithmetic b/Lang/Pluto/Elliptic-curve-arithmetic new file mode 120000 index 0000000000..01ab3acc14 --- /dev/null +++ b/Lang/Pluto/Elliptic-curve-arithmetic @@ -0,0 +1 @@ +../../Task/Elliptic-curve-arithmetic/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Emirp-primes b/Lang/Pluto/Emirp-primes new file mode 120000 index 0000000000..70bc487ce4 --- /dev/null +++ b/Lang/Pluto/Emirp-primes @@ -0,0 +1 @@ +../../Task/Emirp-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Entropy b/Lang/Pluto/Entropy new file mode 120000 index 0000000000..ad4816da25 --- /dev/null +++ b/Lang/Pluto/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Entropy-Narcissist b/Lang/Pluto/Entropy-Narcissist new file mode 120000 index 0000000000..b44bd0dceb --- /dev/null +++ b/Lang/Pluto/Entropy-Narcissist @@ -0,0 +1 @@ +../../Task/Entropy-Narcissist/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Enumerations b/Lang/Pluto/Enumerations new file mode 120000 index 0000000000..f1e25dcea7 --- /dev/null +++ b/Lang/Pluto/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Environment-variables b/Lang/Pluto/Environment-variables new file mode 120000 index 0000000000..544499e35f --- /dev/null +++ b/Lang/Pluto/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Equal-prime-and-composite-sums b/Lang/Pluto/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..5924d0c24d --- /dev/null +++ b/Lang/Pluto/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Equilibrium-index b/Lang/Pluto/Equilibrium-index new file mode 120000 index 0000000000..d670c800de --- /dev/null +++ b/Lang/Pluto/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Erd-s-Selfridge-categorization-of-primes b/Lang/Pluto/Erd-s-Selfridge-categorization-of-primes new file mode 120000 index 0000000000..ee9715de69 --- /dev/null +++ b/Lang/Pluto/Erd-s-Selfridge-categorization-of-primes @@ -0,0 +1 @@ +../../Task/Erd-s-Selfridge-categorization-of-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Esthetic-numbers b/Lang/Pluto/Esthetic-numbers new file mode 120000 index 0000000000..5b009a94ca --- /dev/null +++ b/Lang/Pluto/Esthetic-numbers @@ -0,0 +1 @@ +../../Task/Esthetic-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Ethiopian-multiplication b/Lang/Pluto/Ethiopian-multiplication new file mode 120000 index 0000000000..b71d5e1260 --- /dev/null +++ b/Lang/Pluto/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Euclid-Mullin-sequence b/Lang/Pluto/Euclid-Mullin-sequence new file mode 120000 index 0000000000..4b920b7289 --- /dev/null +++ b/Lang/Pluto/Euclid-Mullin-sequence @@ -0,0 +1 @@ +../../Task/Euclid-Mullin-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Euler-method b/Lang/Pluto/Euler-method new file mode 120000 index 0000000000..b7dbfe93a0 --- /dev/null +++ b/Lang/Pluto/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Eulers-constant-0.5772... b/Lang/Pluto/Eulers-constant-0.5772... new file mode 120000 index 0000000000..43d30a3576 --- /dev/null +++ b/Lang/Pluto/Eulers-constant-0.5772... @@ -0,0 +1 @@ +../../Task/Eulers-constant-0.5772.../Pluto \ No newline at end of file diff --git a/Lang/Pluto/Eulers-identity b/Lang/Pluto/Eulers-identity new file mode 120000 index 0000000000..97a4ba8ed8 --- /dev/null +++ b/Lang/Pluto/Eulers-identity @@ -0,0 +1 @@ +../../Task/Eulers-identity/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Eulers-sum-of-powers-conjecture b/Lang/Pluto/Eulers-sum-of-powers-conjecture new file mode 120000 index 0000000000..d14dd7e926 --- /dev/null +++ b/Lang/Pluto/Eulers-sum-of-powers-conjecture @@ -0,0 +1 @@ +../../Task/Eulers-sum-of-powers-conjecture/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Evaluate-binomial-coefficients b/Lang/Pluto/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..00328c39e4 --- /dev/null +++ b/Lang/Pluto/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Even-or-odd b/Lang/Pluto/Even-or-odd new file mode 120000 index 0000000000..fc5cc6a785 --- /dev/null +++ b/Lang/Pluto/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Exceptions b/Lang/Pluto/Exceptions new file mode 120000 index 0000000000..d201ead5a3 --- /dev/null +++ b/Lang/Pluto/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Exceptions-Catch-an-exception-thrown-in-a-nested-call b/Lang/Pluto/Exceptions-Catch-an-exception-thrown-in-a-nested-call new file mode 120000 index 0000000000..eeff87c8ee --- /dev/null +++ b/Lang/Pluto/Exceptions-Catch-an-exception-thrown-in-a-nested-call @@ -0,0 +1 @@ +../../Task/Exceptions-Catch-an-exception-thrown-in-a-nested-call/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Execute-Brain- b/Lang/Pluto/Execute-Brain- new file mode 120000 index 0000000000..19151dc329 --- /dev/null +++ b/Lang/Pluto/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Execute-Computer-Zero b/Lang/Pluto/Execute-Computer-Zero new file mode 120000 index 0000000000..23a9487cf2 --- /dev/null +++ b/Lang/Pluto/Execute-Computer-Zero @@ -0,0 +1 @@ +../../Task/Execute-Computer-Zero/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Execute-a-system-command b/Lang/Pluto/Execute-a-system-command new file mode 120000 index 0000000000..005fc83a4b --- /dev/null +++ b/Lang/Pluto/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Exponentiation-operator b/Lang/Pluto/Exponentiation-operator new file mode 120000 index 0000000000..ebdd988197 --- /dev/null +++ b/Lang/Pluto/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Exponentiation-order b/Lang/Pluto/Exponentiation-order new file mode 120000 index 0000000000..9327e0a3aa --- /dev/null +++ b/Lang/Pluto/Exponentiation-order @@ -0,0 +1 @@ +../../Task/Exponentiation-order/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Exponentiation-with-infix-operators-in-or-operating-on-the-base b/Lang/Pluto/Exponentiation-with-infix-operators-in-or-operating-on-the-base new file mode 120000 index 0000000000..3b14bba6bd --- /dev/null +++ b/Lang/Pluto/Exponentiation-with-infix-operators-in-or-operating-on-the-base @@ -0,0 +1 @@ +../../Task/Exponentiation-with-infix-operators-in-or-operating-on-the-base/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Extensible-prime-generator b/Lang/Pluto/Extensible-prime-generator new file mode 120000 index 0000000000..e39589d864 --- /dev/null +++ b/Lang/Pluto/Extensible-prime-generator @@ -0,0 +1 @@ +../../Task/Extensible-prime-generator/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Extreme-floating-point-values b/Lang/Pluto/Extreme-floating-point-values new file mode 120000 index 0000000000..f7dff2ba0b --- /dev/null +++ b/Lang/Pluto/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Factorial b/Lang/Pluto/Factorial new file mode 120000 index 0000000000..26b76cb13d --- /dev/null +++ b/Lang/Pluto/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Factorial-primes b/Lang/Pluto/Factorial-primes new file mode 120000 index 0000000000..b57eac84ac --- /dev/null +++ b/Lang/Pluto/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Factorions b/Lang/Pluto/Factorions new file mode 120000 index 0000000000..0d6fdce25f --- /dev/null +++ b/Lang/Pluto/Factorions @@ -0,0 +1 @@ +../../Task/Factorions/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Factors-of-a-Mersenne-number b/Lang/Pluto/Factors-of-a-Mersenne-number new file mode 120000 index 0000000000..d60ce6e99f --- /dev/null +++ b/Lang/Pluto/Factors-of-a-Mersenne-number @@ -0,0 +1 @@ +../../Task/Factors-of-a-Mersenne-number/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Factors-of-an-integer b/Lang/Pluto/Factors-of-an-integer new file mode 120000 index 0000000000..cc13f27676 --- /dev/null +++ b/Lang/Pluto/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Fairshare-between-two-and-more b/Lang/Pluto/Fairshare-between-two-and-more new file mode 120000 index 0000000000..bfe6b9462c --- /dev/null +++ b/Lang/Pluto/Fairshare-between-two-and-more @@ -0,0 +1 @@ +../../Task/Fairshare-between-two-and-more/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Farey-sequence b/Lang/Pluto/Farey-sequence new file mode 120000 index 0000000000..d29c19b41e --- /dev/null +++ b/Lang/Pluto/Farey-sequence @@ -0,0 +1 @@ +../../Task/Farey-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Fast-Fourier-transform b/Lang/Pluto/Fast-Fourier-transform new file mode 120000 index 0000000000..d83789d068 --- /dev/null +++ b/Lang/Pluto/Fast-Fourier-transform @@ -0,0 +1 @@ +../../Task/Fast-Fourier-transform/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Feigenbaum-constant-calculation b/Lang/Pluto/Feigenbaum-constant-calculation new file mode 120000 index 0000000000..256bf8cb19 --- /dev/null +++ b/Lang/Pluto/Feigenbaum-constant-calculation @@ -0,0 +1 @@ +../../Task/Feigenbaum-constant-calculation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Fermat-numbers b/Lang/Pluto/Fermat-numbers new file mode 120000 index 0000000000..45d4d630d7 --- /dev/null +++ b/Lang/Pluto/Fermat-numbers @@ -0,0 +1 @@ +../../Task/Fermat-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Fibonacci-n-step-number-sequences b/Lang/Pluto/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..82a6f3ddc3 --- /dev/null +++ b/Lang/Pluto/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Fibonacci-sequence b/Lang/Pluto/Fibonacci-sequence new file mode 120000 index 0000000000..efff8e1eb6 --- /dev/null +++ b/Lang/Pluto/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Fibonacci-word b/Lang/Pluto/Fibonacci-word new file mode 120000 index 0000000000..cbcb68d78f --- /dev/null +++ b/Lang/Pluto/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/Pluto \ No newline at end of file diff --git a/Lang/Pluto/File-extension-is-in-extensions-list b/Lang/Pluto/File-extension-is-in-extensions-list new file mode 120000 index 0000000000..7414b8a00c --- /dev/null +++ b/Lang/Pluto/File-extension-is-in-extensions-list @@ -0,0 +1 @@ +../../Task/File-extension-is-in-extensions-list/Pluto \ No newline at end of file diff --git a/Lang/Pluto/File-modification-time b/Lang/Pluto/File-modification-time new file mode 120000 index 0000000000..b0430abc54 --- /dev/null +++ b/Lang/Pluto/File-modification-time @@ -0,0 +1 @@ +../../Task/File-modification-time/Pluto \ No newline at end of file diff --git a/Lang/Pluto/File-size b/Lang/Pluto/File-size new file mode 120000 index 0000000000..998a7a784d --- /dev/null +++ b/Lang/Pluto/File-size @@ -0,0 +1 @@ +../../Task/File-size/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Filter b/Lang/Pluto/Filter new file mode 120000 index 0000000000..98b0321ee6 --- /dev/null +++ b/Lang/Pluto/Filter @@ -0,0 +1 @@ +../../Task/Filter/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Find-if-a-point-is-within-a-triangle b/Lang/Pluto/Find-if-a-point-is-within-a-triangle new file mode 120000 index 0000000000..2f4b95698d --- /dev/null +++ b/Lang/Pluto/Find-if-a-point-is-within-a-triangle @@ -0,0 +1 @@ +../../Task/Find-if-a-point-is-within-a-triangle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Find-the-last-Sunday-of-each-month b/Lang/Pluto/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..dbefdf7ab1 --- /dev/null +++ b/Lang/Pluto/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/Pluto \ No newline at end of file diff --git a/Lang/Pluto/First-class-functions b/Lang/Pluto/First-class-functions new file mode 120000 index 0000000000..0fe40c3eac --- /dev/null +++ b/Lang/Pluto/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/Pluto \ No newline at end of file diff --git a/Lang/Pluto/First-class-functions-Use-numbers-analogously b/Lang/Pluto/First-class-functions-Use-numbers-analogously new file mode 120000 index 0000000000..8d26dcc696 --- /dev/null +++ b/Lang/Pluto/First-class-functions-Use-numbers-analogously @@ -0,0 +1 @@ +../../Task/First-class-functions-Use-numbers-analogously/Pluto \ No newline at end of file diff --git a/Lang/Pluto/First-perfect-square-in-base-n-with-n-unique-digits b/Lang/Pluto/First-perfect-square-in-base-n-with-n-unique-digits new file mode 120000 index 0000000000..5163776997 --- /dev/null +++ b/Lang/Pluto/First-perfect-square-in-base-n-with-n-unique-digits @@ -0,0 +1 @@ +../../Task/First-perfect-square-in-base-n-with-n-unique-digits/Pluto \ No newline at end of file diff --git a/Lang/Pluto/First-power-of-2-that-has-leading-decimal-digits-of-12 b/Lang/Pluto/First-power-of-2-that-has-leading-decimal-digits-of-12 new file mode 120000 index 0000000000..e709baba03 --- /dev/null +++ b/Lang/Pluto/First-power-of-2-that-has-leading-decimal-digits-of-12 @@ -0,0 +1 @@ +../../Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Five-weekends b/Lang/Pluto/Five-weekends new file mode 120000 index 0000000000..00a410b463 --- /dev/null +++ b/Lang/Pluto/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Fivenum b/Lang/Pluto/Fivenum new file mode 120000 index 0000000000..a69f6ae762 --- /dev/null +++ b/Lang/Pluto/Fivenum @@ -0,0 +1 @@ +../../Task/Fivenum/Pluto \ No newline at end of file diff --git a/Lang/Pluto/FizzBuzz b/Lang/Pluto/FizzBuzz new file mode 120000 index 0000000000..bd54d0d8bb --- /dev/null +++ b/Lang/Pluto/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Flatten-a-list b/Lang/Pluto/Flatten-a-list new file mode 120000 index 0000000000..821ee95cae --- /dev/null +++ b/Lang/Pluto/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Floyd-Warshall-algorithm b/Lang/Pluto/Floyd-Warshall-algorithm new file mode 120000 index 0000000000..7df2d45291 --- /dev/null +++ b/Lang/Pluto/Floyd-Warshall-algorithm @@ -0,0 +1 @@ +../../Task/Floyd-Warshall-algorithm/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Floyds-triangle b/Lang/Pluto/Floyds-triangle new file mode 120000 index 0000000000..7d85d7bf3e --- /dev/null +++ b/Lang/Pluto/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Formatted-numeric-output b/Lang/Pluto/Formatted-numeric-output new file mode 120000 index 0000000000..ca4bc2e2c0 --- /dev/null +++ b/Lang/Pluto/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Fortunate-numbers b/Lang/Pluto/Fortunate-numbers new file mode 120000 index 0000000000..78cf9f5f36 --- /dev/null +++ b/Lang/Pluto/Fortunate-numbers @@ -0,0 +1 @@ +../../Task/Fortunate-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Forward-difference b/Lang/Pluto/Forward-difference new file mode 120000 index 0000000000..f75e0263fe --- /dev/null +++ b/Lang/Pluto/Forward-difference @@ -0,0 +1 @@ +../../Task/Forward-difference/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Four-is-magic b/Lang/Pluto/Four-is-magic new file mode 120000 index 0000000000..8f0564da6b --- /dev/null +++ b/Lang/Pluto/Four-is-magic @@ -0,0 +1 @@ +../../Task/Four-is-magic/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Function-composition b/Lang/Pluto/Function-composition new file mode 120000 index 0000000000..89443d02fb --- /dev/null +++ b/Lang/Pluto/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Function-definition b/Lang/Pluto/Function-definition new file mode 120000 index 0000000000..8c3e064f65 --- /dev/null +++ b/Lang/Pluto/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Fusc-sequence b/Lang/Pluto/Fusc-sequence new file mode 120000 index 0000000000..af89d11bec --- /dev/null +++ b/Lang/Pluto/Fusc-sequence @@ -0,0 +1 @@ +../../Task/Fusc-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Gamma-function b/Lang/Pluto/Gamma-function new file mode 120000 index 0000000000..8b7dee23dc --- /dev/null +++ b/Lang/Pluto/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Gapful-numbers b/Lang/Pluto/Gapful-numbers new file mode 120000 index 0000000000..0b3bce275e --- /dev/null +++ b/Lang/Pluto/Gapful-numbers @@ -0,0 +1 @@ +../../Task/Gapful-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Gauss-Jordan-matrix-inversion b/Lang/Pluto/Gauss-Jordan-matrix-inversion new file mode 120000 index 0000000000..75ed24ffd1 --- /dev/null +++ b/Lang/Pluto/Gauss-Jordan-matrix-inversion @@ -0,0 +1 @@ +../../Task/Gauss-Jordan-matrix-inversion/Pluto \ No newline at end of file diff --git a/Lang/Pluto/General-FizzBuzz b/Lang/Pluto/General-FizzBuzz new file mode 120000 index 0000000000..a7cf491b38 --- /dev/null +++ b/Lang/Pluto/General-FizzBuzz @@ -0,0 +1 @@ +../../Task/General-FizzBuzz/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Generate-lower-case-ASCII-alphabet b/Lang/Pluto/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..64f2576fe0 --- /dev/null +++ b/Lang/Pluto/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Generator-Exponential b/Lang/Pluto/Generator-Exponential new file mode 120000 index 0000000000..26eb55a2a0 --- /dev/null +++ b/Lang/Pluto/Generator-Exponential @@ -0,0 +1 @@ +../../Task/Generator-Exponential/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Giuga-numbers b/Lang/Pluto/Giuga-numbers new file mode 120000 index 0000000000..221b7a2689 --- /dev/null +++ b/Lang/Pluto/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Goldbachs-comet b/Lang/Pluto/Goldbachs-comet new file mode 120000 index 0000000000..ff1cca329d --- /dev/null +++ b/Lang/Pluto/Goldbachs-comet @@ -0,0 +1 @@ +../../Task/Goldbachs-comet/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Golden-ratio-Convergence b/Lang/Pluto/Golden-ratio-Convergence new file mode 120000 index 0000000000..15a2256122 --- /dev/null +++ b/Lang/Pluto/Golden-ratio-Convergence @@ -0,0 +1 @@ +../../Task/Golden-ratio-Convergence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Gray-code b/Lang/Pluto/Gray-code new file mode 120000 index 0000000000..afd6df8f4b --- /dev/null +++ b/Lang/Pluto/Gray-code @@ -0,0 +1 @@ +../../Task/Gray-code/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Greatest-common-divisor b/Lang/Pluto/Greatest-common-divisor new file mode 120000 index 0000000000..a4feeee2fd --- /dev/null +++ b/Lang/Pluto/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Greatest-element-of-a-list b/Lang/Pluto/Greatest-element-of-a-list new file mode 120000 index 0000000000..85148f8e2b --- /dev/null +++ b/Lang/Pluto/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Greatest-subsequential-sum b/Lang/Pluto/Greatest-subsequential-sum new file mode 120000 index 0000000000..308ac33a20 --- /dev/null +++ b/Lang/Pluto/Greatest-subsequential-sum @@ -0,0 +1 @@ +../../Task/Greatest-subsequential-sum/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Greedy-algorithm-for-Egyptian-fractions b/Lang/Pluto/Greedy-algorithm-for-Egyptian-fractions new file mode 120000 index 0000000000..97dc6bbde7 --- /dev/null +++ b/Lang/Pluto/Greedy-algorithm-for-Egyptian-fractions @@ -0,0 +1 @@ +../../Task/Greedy-algorithm-for-Egyptian-fractions/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Guess-the-number b/Lang/Pluto/Guess-the-number new file mode 120000 index 0000000000..f68fa3fc41 --- /dev/null +++ b/Lang/Pluto/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Hailstone-sequence b/Lang/Pluto/Hailstone-sequence new file mode 120000 index 0000000000..0c70c36e8a --- /dev/null +++ b/Lang/Pluto/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Halt-and-catch-fire b/Lang/Pluto/Halt-and-catch-fire new file mode 120000 index 0000000000..f8e69baccf --- /dev/null +++ b/Lang/Pluto/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Happy-numbers b/Lang/Pluto/Happy-numbers new file mode 120000 index 0000000000..8184fae2dd --- /dev/null +++ b/Lang/Pluto/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Harmonic-series b/Lang/Pluto/Harmonic-series new file mode 120000 index 0000000000..9e5681ab0c --- /dev/null +++ b/Lang/Pluto/Harmonic-series @@ -0,0 +1 @@ +../../Task/Harmonic-series/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Harshad-or-Niven-series b/Lang/Pluto/Harshad-or-Niven-series new file mode 120000 index 0000000000..8a3855605b --- /dev/null +++ b/Lang/Pluto/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Hash-from-two-arrays b/Lang/Pluto/Hash-from-two-arrays new file mode 120000 index 0000000000..5612dbf1a3 --- /dev/null +++ b/Lang/Pluto/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Hash-join b/Lang/Pluto/Hash-join new file mode 120000 index 0000000000..857fcc5b68 --- /dev/null +++ b/Lang/Pluto/Hash-join @@ -0,0 +1 @@ +../../Task/Hash-join/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Haversine-formula b/Lang/Pluto/Haversine-formula new file mode 120000 index 0000000000..b9fcee8ac0 --- /dev/null +++ b/Lang/Pluto/Haversine-formula @@ -0,0 +1 @@ +../../Task/Haversine-formula/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Hello-world-Graphical b/Lang/Pluto/Hello-world-Graphical new file mode 120000 index 0000000000..b0cbed710e --- /dev/null +++ b/Lang/Pluto/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Hello-world-Newbie b/Lang/Pluto/Hello-world-Newbie new file mode 120000 index 0000000000..d7c1d093e2 --- /dev/null +++ b/Lang/Pluto/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Hello-world-Newline-omission b/Lang/Pluto/Hello-world-Newline-omission new file mode 120000 index 0000000000..5020503885 --- /dev/null +++ b/Lang/Pluto/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Hello-world-Standard-error b/Lang/Pluto/Hello-world-Standard-error new file mode 120000 index 0000000000..2b41d962cc --- /dev/null +++ b/Lang/Pluto/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Hello-world-Text b/Lang/Pluto/Hello-world-Text new file mode 120000 index 0000000000..6d5bb1406f --- /dev/null +++ b/Lang/Pluto/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Hex-words b/Lang/Pluto/Hex-words new file mode 120000 index 0000000000..62ff8632b8 --- /dev/null +++ b/Lang/Pluto/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Hickerson-series-of-almost-integers b/Lang/Pluto/Hickerson-series-of-almost-integers new file mode 120000 index 0000000000..1706eca746 --- /dev/null +++ b/Lang/Pluto/Hickerson-series-of-almost-integers @@ -0,0 +1 @@ +../../Task/Hickerson-series-of-almost-integers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Higher-order-functions b/Lang/Pluto/Higher-order-functions new file mode 120000 index 0000000000..532e183ee0 --- /dev/null +++ b/Lang/Pluto/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Hofstadter-Q-sequence b/Lang/Pluto/Hofstadter-Q-sequence new file mode 120000 index 0000000000..55c19c4e5e --- /dev/null +++ b/Lang/Pluto/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Home-primes b/Lang/Pluto/Home-primes new file mode 120000 index 0000000000..66e3e487a6 --- /dev/null +++ b/Lang/Pluto/Home-primes @@ -0,0 +1 @@ +../../Task/Home-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Horners-rule-for-polynomial-evaluation b/Lang/Pluto/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..02512d6f7e --- /dev/null +++ b/Lang/Pluto/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Hostname b/Lang/Pluto/Hostname new file mode 120000 index 0000000000..c1fe0db0ef --- /dev/null +++ b/Lang/Pluto/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Humble-numbers b/Lang/Pluto/Humble-numbers new file mode 120000 index 0000000000..f616a12fe9 --- /dev/null +++ b/Lang/Pluto/Humble-numbers @@ -0,0 +1 @@ +../../Task/Humble-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/IBAN b/Lang/Pluto/IBAN new file mode 120000 index 0000000000..3c48349f04 --- /dev/null +++ b/Lang/Pluto/IBAN @@ -0,0 +1 @@ +../../Task/IBAN/Pluto \ No newline at end of file diff --git a/Lang/Pluto/ISBN13-check-digit b/Lang/Pluto/ISBN13-check-digit new file mode 120000 index 0000000000..18cc8cf2ba --- /dev/null +++ b/Lang/Pluto/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Identity-matrix b/Lang/Pluto/Identity-matrix new file mode 120000 index 0000000000..755ad3b6ef --- /dev/null +++ b/Lang/Pluto/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Idiomatically-determine-all-the-lowercase-and-uppercase-letters b/Lang/Pluto/Idiomatically-determine-all-the-lowercase-and-uppercase-letters new file mode 120000 index 0000000000..1ce83f951b --- /dev/null +++ b/Lang/Pluto/Idiomatically-determine-all-the-lowercase-and-uppercase-letters @@ -0,0 +1 @@ +../../Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Increment-a-numerical-string b/Lang/Pluto/Increment-a-numerical-string new file mode 120000 index 0000000000..5413743d7c --- /dev/null +++ b/Lang/Pluto/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Index-finite-lists-of-positive-integers b/Lang/Pluto/Index-finite-lists-of-positive-integers new file mode 120000 index 0000000000..44f395ae80 --- /dev/null +++ b/Lang/Pluto/Index-finite-lists-of-positive-integers @@ -0,0 +1 @@ +../../Task/Index-finite-lists-of-positive-integers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Infinity b/Lang/Pluto/Infinity new file mode 120000 index 0000000000..cb81bde8e2 --- /dev/null +++ b/Lang/Pluto/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Inheritance-Multiple b/Lang/Pluto/Inheritance-Multiple new file mode 120000 index 0000000000..8172d1b878 --- /dev/null +++ b/Lang/Pluto/Inheritance-Multiple @@ -0,0 +1 @@ +../../Task/Inheritance-Multiple/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Inheritance-Single b/Lang/Pluto/Inheritance-Single new file mode 120000 index 0000000000..978ce6e7cf --- /dev/null +++ b/Lang/Pluto/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Integer-overflow b/Lang/Pluto/Integer-overflow new file mode 120000 index 0000000000..21ae81881b --- /dev/null +++ b/Lang/Pluto/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Inverted-syntax b/Lang/Pluto/Inverted-syntax new file mode 120000 index 0000000000..689ac95819 --- /dev/null +++ b/Lang/Pluto/Inverted-syntax @@ -0,0 +1 @@ +../../Task/Inverted-syntax/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Isqrt-integer-square-root-of-X b/Lang/Pluto/Isqrt-integer-square-root-of-X new file mode 120000 index 0000000000..e61bc6f394 --- /dev/null +++ b/Lang/Pluto/Isqrt-integer-square-root-of-X @@ -0,0 +1 @@ +../../Task/Isqrt-integer-square-root-of-X/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Iterated-digits-squaring b/Lang/Pluto/Iterated-digits-squaring new file mode 120000 index 0000000000..1e0c30dec8 --- /dev/null +++ b/Lang/Pluto/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/Pluto \ No newline at end of file diff --git a/Lang/Pluto/JSON b/Lang/Pluto/JSON new file mode 120000 index 0000000000..bc77142a3f --- /dev/null +++ b/Lang/Pluto/JSON @@ -0,0 +1 @@ +../../Task/JSON/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Jacobi-symbol b/Lang/Pluto/Jacobi-symbol new file mode 120000 index 0000000000..004a1623cc --- /dev/null +++ b/Lang/Pluto/Jacobi-symbol @@ -0,0 +1 @@ +../../Task/Jacobi-symbol/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Jacobsthal-numbers b/Lang/Pluto/Jacobsthal-numbers new file mode 120000 index 0000000000..310c137dfd --- /dev/null +++ b/Lang/Pluto/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Jaro-Winkler-distance b/Lang/Pluto/Jaro-Winkler-distance new file mode 120000 index 0000000000..c18faa1587 --- /dev/null +++ b/Lang/Pluto/Jaro-Winkler-distance @@ -0,0 +1 @@ +../../Task/Jaro-Winkler-distance/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Jaro-similarity b/Lang/Pluto/Jaro-similarity new file mode 120000 index 0000000000..7fbb18452a --- /dev/null +++ b/Lang/Pluto/Jaro-similarity @@ -0,0 +1 @@ +../../Task/Jaro-similarity/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Jensens-Device b/Lang/Pluto/Jensens-Device new file mode 120000 index 0000000000..1f301e92cb --- /dev/null +++ b/Lang/Pluto/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Jewels-and-stones b/Lang/Pluto/Jewels-and-stones new file mode 120000 index 0000000000..0d8632e132 --- /dev/null +++ b/Lang/Pluto/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Jordan-P-lya-numbers b/Lang/Pluto/Jordan-P-lya-numbers new file mode 120000 index 0000000000..69c05770d3 --- /dev/null +++ b/Lang/Pluto/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/JortSort b/Lang/Pluto/JortSort new file mode 120000 index 0000000000..2f3a60be62 --- /dev/null +++ b/Lang/Pluto/JortSort @@ -0,0 +1 @@ +../../Task/JortSort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Josephus-problem b/Lang/Pluto/Josephus-problem new file mode 120000 index 0000000000..c17c5c052c --- /dev/null +++ b/Lang/Pluto/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Juggler-sequence b/Lang/Pluto/Juggler-sequence new file mode 120000 index 0000000000..55e904505f --- /dev/null +++ b/Lang/Pluto/Juggler-sequence @@ -0,0 +1 @@ +../../Task/Juggler-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Julia-set b/Lang/Pluto/Julia-set new file mode 120000 index 0000000000..47c2b492f2 --- /dev/null +++ b/Lang/Pluto/Julia-set @@ -0,0 +1 @@ +../../Task/Julia-set/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Jump-anywhere b/Lang/Pluto/Jump-anywhere new file mode 120000 index 0000000000..0cc6c03c6c --- /dev/null +++ b/Lang/Pluto/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Kaprekar-numbers b/Lang/Pluto/Kaprekar-numbers new file mode 120000 index 0000000000..1c32b1316d --- /dev/null +++ b/Lang/Pluto/Kaprekar-numbers @@ -0,0 +1 @@ +../../Task/Kaprekar-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Knapsack-problem-0-1 b/Lang/Pluto/Knapsack-problem-0-1 new file mode 120000 index 0000000000..154c3bec73 --- /dev/null +++ b/Lang/Pluto/Knapsack-problem-0-1 @@ -0,0 +1 @@ +../../Task/Knapsack-problem-0-1/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Knapsack-problem-Bounded b/Lang/Pluto/Knapsack-problem-Bounded new file mode 120000 index 0000000000..fdfd53d307 --- /dev/null +++ b/Lang/Pluto/Knapsack-problem-Bounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Bounded/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Knapsack-problem-Continuous b/Lang/Pluto/Knapsack-problem-Continuous new file mode 120000 index 0000000000..afd8aad5a0 --- /dev/null +++ b/Lang/Pluto/Knapsack-problem-Continuous @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Continuous/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Knapsack-problem-Unbounded b/Lang/Pluto/Knapsack-problem-Unbounded new file mode 120000 index 0000000000..a47d914c76 --- /dev/null +++ b/Lang/Pluto/Knapsack-problem-Unbounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Unbounded/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Knuth-shuffle b/Lang/Pluto/Knuth-shuffle new file mode 120000 index 0000000000..e7dddcd355 --- /dev/null +++ b/Lang/Pluto/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Knuths-algorithm-S b/Lang/Pluto/Knuths-algorithm-S new file mode 120000 index 0000000000..541d484707 --- /dev/null +++ b/Lang/Pluto/Knuths-algorithm-S @@ -0,0 +1 @@ +../../Task/Knuths-algorithm-S/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Kronecker-product b/Lang/Pluto/Kronecker-product new file mode 120000 index 0000000000..3e6a6e5b94 --- /dev/null +++ b/Lang/Pluto/Kronecker-product @@ -0,0 +1 @@ +../../Task/Kronecker-product/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Kronecker-product-based-fractals b/Lang/Pluto/Kronecker-product-based-fractals new file mode 120000 index 0000000000..3cfc235117 --- /dev/null +++ b/Lang/Pluto/Kronecker-product-based-fractals @@ -0,0 +1 @@ +../../Task/Kronecker-product-based-fractals/Pluto \ No newline at end of file diff --git a/Lang/Pluto/LU-decomposition b/Lang/Pluto/LU-decomposition new file mode 120000 index 0000000000..6a8af92062 --- /dev/null +++ b/Lang/Pluto/LU-decomposition @@ -0,0 +1 @@ +../../Task/LU-decomposition/Pluto \ No newline at end of file diff --git a/Lang/Pluto/LZW-compression b/Lang/Pluto/LZW-compression new file mode 120000 index 0000000000..50427fda5c --- /dev/null +++ b/Lang/Pluto/LZW-compression @@ -0,0 +1 @@ +../../Task/LZW-compression/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Lah-numbers b/Lang/Pluto/Lah-numbers new file mode 120000 index 0000000000..f5d9d24027 --- /dev/null +++ b/Lang/Pluto/Lah-numbers @@ -0,0 +1 @@ +../../Task/Lah-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Langtons-ant b/Lang/Pluto/Langtons-ant new file mode 120000 index 0000000000..fbf8c4cec8 --- /dev/null +++ b/Lang/Pluto/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Largest-number-divisible-by-its-digits b/Lang/Pluto/Largest-number-divisible-by-its-digits new file mode 120000 index 0000000000..0399c7d845 --- /dev/null +++ b/Lang/Pluto/Largest-number-divisible-by-its-digits @@ -0,0 +1 @@ +../../Task/Largest-number-divisible-by-its-digits/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Largest-proper-divisor-of-n b/Lang/Pluto/Largest-proper-divisor-of-n new file mode 120000 index 0000000000..d21ea35abe --- /dev/null +++ b/Lang/Pluto/Largest-proper-divisor-of-n @@ -0,0 +1 @@ +../../Task/Largest-proper-divisor-of-n/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Last-Friday-of-each-month b/Lang/Pluto/Last-Friday-of-each-month new file mode 120000 index 0000000000..34cb3bb01f --- /dev/null +++ b/Lang/Pluto/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Leap-year b/Lang/Pluto/Leap-year new file mode 120000 index 0000000000..9574544885 --- /dev/null +++ b/Lang/Pluto/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Least-common-multiple b/Lang/Pluto/Least-common-multiple new file mode 120000 index 0000000000..315d9ee3c1 --- /dev/null +++ b/Lang/Pluto/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Legendre-prime-counting-function b/Lang/Pluto/Legendre-prime-counting-function new file mode 120000 index 0000000000..f91e3cb00d --- /dev/null +++ b/Lang/Pluto/Legendre-prime-counting-function @@ -0,0 +1 @@ +../../Task/Legendre-prime-counting-function/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Leonardo-numbers b/Lang/Pluto/Leonardo-numbers new file mode 120000 index 0000000000..6a0846d95e --- /dev/null +++ b/Lang/Pluto/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/List-comprehensions b/Lang/Pluto/List-comprehensions new file mode 120000 index 0000000000..e183959a9e --- /dev/null +++ b/Lang/Pluto/List-comprehensions @@ -0,0 +1 @@ +../../Task/List-comprehensions/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Literals-Floating-point b/Lang/Pluto/Literals-Floating-point new file mode 120000 index 0000000000..f40aa2eb22 --- /dev/null +++ b/Lang/Pluto/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Literals-Integer b/Lang/Pluto/Literals-Integer new file mode 120000 index 0000000000..2ca0134201 --- /dev/null +++ b/Lang/Pluto/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Logistic-curve-fitting-in-epidemiology b/Lang/Pluto/Logistic-curve-fitting-in-epidemiology new file mode 120000 index 0000000000..5620c74aa1 --- /dev/null +++ b/Lang/Pluto/Logistic-curve-fitting-in-epidemiology @@ -0,0 +1 @@ +../../Task/Logistic-curve-fitting-in-epidemiology/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Long-year b/Lang/Pluto/Long-year new file mode 120000 index 0000000000..e81c486cc5 --- /dev/null +++ b/Lang/Pluto/Long-year @@ -0,0 +1 @@ +../../Task/Long-year/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Longest-increasing-subsequence b/Lang/Pluto/Longest-increasing-subsequence new file mode 120000 index 0000000000..24fdc53a13 --- /dev/null +++ b/Lang/Pluto/Longest-increasing-subsequence @@ -0,0 +1 @@ +../../Task/Longest-increasing-subsequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Longest-string-challenge b/Lang/Pluto/Longest-string-challenge new file mode 120000 index 0000000000..8e8deb88da --- /dev/null +++ b/Lang/Pluto/Longest-string-challenge @@ -0,0 +1 @@ +../../Task/Longest-string-challenge/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loop-over-multiple-arrays-simultaneously b/Lang/Pluto/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..cebc902b5b --- /dev/null +++ b/Lang/Pluto/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-Break b/Lang/Pluto/Loops-Break new file mode 120000 index 0000000000..2b3657d2de --- /dev/null +++ b/Lang/Pluto/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-Continue b/Lang/Pluto/Loops-Continue new file mode 120000 index 0000000000..5f41db6125 --- /dev/null +++ b/Lang/Pluto/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-Do-while b/Lang/Pluto/Loops-Do-while new file mode 120000 index 0000000000..a265d4decf --- /dev/null +++ b/Lang/Pluto/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-Downward-for b/Lang/Pluto/Loops-Downward-for new file mode 120000 index 0000000000..6302a5cc0d --- /dev/null +++ b/Lang/Pluto/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-For b/Lang/Pluto/Loops-For new file mode 120000 index 0000000000..9f83ae12bd --- /dev/null +++ b/Lang/Pluto/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-For-with-a-specified-step b/Lang/Pluto/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..508122a2e3 --- /dev/null +++ b/Lang/Pluto/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-Foreach b/Lang/Pluto/Loops-Foreach new file mode 120000 index 0000000000..9dbfba413e --- /dev/null +++ b/Lang/Pluto/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-Increment-loop-index-within-loop-body b/Lang/Pluto/Loops-Increment-loop-index-within-loop-body new file mode 120000 index 0000000000..f1ce9d6778 --- /dev/null +++ b/Lang/Pluto/Loops-Increment-loop-index-within-loop-body @@ -0,0 +1 @@ +../../Task/Loops-Increment-loop-index-within-loop-body/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-Infinite b/Lang/Pluto/Loops-Infinite new file mode 120000 index 0000000000..50986dd414 --- /dev/null +++ b/Lang/Pluto/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-N-plus-one-half b/Lang/Pluto/Loops-N-plus-one-half new file mode 120000 index 0000000000..433e3f6336 --- /dev/null +++ b/Lang/Pluto/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-Nested b/Lang/Pluto/Loops-Nested new file mode 120000 index 0000000000..96f4c43c62 --- /dev/null +++ b/Lang/Pluto/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-While b/Lang/Pluto/Loops-While new file mode 120000 index 0000000000..3aa5f84aba --- /dev/null +++ b/Lang/Pluto/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-With-multiple-ranges b/Lang/Pluto/Loops-With-multiple-ranges new file mode 120000 index 0000000000..b1ef3af096 --- /dev/null +++ b/Lang/Pluto/Loops-With-multiple-ranges @@ -0,0 +1 @@ +../../Task/Loops-With-multiple-ranges/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Loops-Wrong-ranges b/Lang/Pluto/Loops-Wrong-ranges new file mode 120000 index 0000000000..7b8bd4ecb0 --- /dev/null +++ b/Lang/Pluto/Loops-Wrong-ranges @@ -0,0 +1 @@ +../../Task/Loops-Wrong-ranges/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Lucas-Lehmer-test b/Lang/Pluto/Lucas-Lehmer-test new file mode 120000 index 0000000000..247c0bbafb --- /dev/null +++ b/Lang/Pluto/Lucas-Lehmer-test @@ -0,0 +1 @@ +../../Task/Lucas-Lehmer-test/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Luhn-test-of-credit-card-numbers b/Lang/Pluto/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..c06ed72be3 --- /dev/null +++ b/Lang/Pluto/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/M-bius-function b/Lang/Pluto/M-bius-function new file mode 120000 index 0000000000..99da13a437 --- /dev/null +++ b/Lang/Pluto/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/Pluto \ No newline at end of file diff --git a/Lang/Pluto/MD4 b/Lang/Pluto/MD4 new file mode 120000 index 0000000000..b6660e39bc --- /dev/null +++ b/Lang/Pluto/MD4 @@ -0,0 +1 @@ +../../Task/MD4/Pluto \ No newline at end of file diff --git a/Lang/Pluto/MD5 b/Lang/Pluto/MD5 new file mode 120000 index 0000000000..c54a09dd7b --- /dev/null +++ b/Lang/Pluto/MD5 @@ -0,0 +1 @@ +../../Task/MD5/Pluto \ No newline at end of file diff --git a/Lang/Pluto/MD5-Implementation b/Lang/Pluto/MD5-Implementation new file mode 120000 index 0000000000..6cfead7533 --- /dev/null +++ b/Lang/Pluto/MD5-Implementation @@ -0,0 +1 @@ +../../Task/MD5-Implementation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Machine-code b/Lang/Pluto/Machine-code new file mode 120000 index 0000000000..82c80d52fd --- /dev/null +++ b/Lang/Pluto/Machine-code @@ -0,0 +1 @@ +../../Task/Machine-code/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Magic-8-ball b/Lang/Pluto/Magic-8-ball new file mode 120000 index 0000000000..e4c5118cb4 --- /dev/null +++ b/Lang/Pluto/Magic-8-ball @@ -0,0 +1 @@ +../../Task/Magic-8-ball/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Magic-constant b/Lang/Pluto/Magic-constant new file mode 120000 index 0000000000..640896b2e7 --- /dev/null +++ b/Lang/Pluto/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Magic-squares-of-doubly-even-order b/Lang/Pluto/Magic-squares-of-doubly-even-order new file mode 120000 index 0000000000..357d3e5480 --- /dev/null +++ b/Lang/Pluto/Magic-squares-of-doubly-even-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-doubly-even-order/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Magic-squares-of-odd-order b/Lang/Pluto/Magic-squares-of-odd-order new file mode 120000 index 0000000000..5df4846612 --- /dev/null +++ b/Lang/Pluto/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Magic-squares-of-singly-even-order b/Lang/Pluto/Magic-squares-of-singly-even-order new file mode 120000 index 0000000000..2430b82023 --- /dev/null +++ b/Lang/Pluto/Magic-squares-of-singly-even-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-singly-even-order/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Man-or-boy-test b/Lang/Pluto/Man-or-boy-test new file mode 120000 index 0000000000..a1f41c4398 --- /dev/null +++ b/Lang/Pluto/Man-or-boy-test @@ -0,0 +1 @@ +../../Task/Man-or-boy-test/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Mandelbrot-set b/Lang/Pluto/Mandelbrot-set new file mode 120000 index 0000000000..3e79f825ad --- /dev/null +++ b/Lang/Pluto/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Map-range b/Lang/Pluto/Map-range new file mode 120000 index 0000000000..a57c07d536 --- /dev/null +++ b/Lang/Pluto/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Matrix-exponentiation-operator b/Lang/Pluto/Matrix-exponentiation-operator new file mode 120000 index 0000000000..1f6eb5cbaa --- /dev/null +++ b/Lang/Pluto/Matrix-exponentiation-operator @@ -0,0 +1 @@ +../../Task/Matrix-exponentiation-operator/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Matrix-multiplication b/Lang/Pluto/Matrix-multiplication new file mode 120000 index 0000000000..61008dcc0b --- /dev/null +++ b/Lang/Pluto/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Matrix-transposition b/Lang/Pluto/Matrix-transposition new file mode 120000 index 0000000000..aaa00341d6 --- /dev/null +++ b/Lang/Pluto/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Maximum-triangle-path-sum b/Lang/Pluto/Maximum-triangle-path-sum new file mode 120000 index 0000000000..916e59e364 --- /dev/null +++ b/Lang/Pluto/Maximum-triangle-path-sum @@ -0,0 +1 @@ +../../Task/Maximum-triangle-path-sum/Pluto \ No newline at end of file diff --git a/Lang/Pluto/McNuggets-problem b/Lang/Pluto/McNuggets-problem new file mode 120000 index 0000000000..2540339e72 --- /dev/null +++ b/Lang/Pluto/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Menu b/Lang/Pluto/Menu new file mode 120000 index 0000000000..058fd3fb23 --- /dev/null +++ b/Lang/Pluto/Menu @@ -0,0 +1 @@ +../../Task/Menu/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Mian-Chowla-sequence b/Lang/Pluto/Mian-Chowla-sequence new file mode 120000 index 0000000000..f966e85ca5 --- /dev/null +++ b/Lang/Pluto/Mian-Chowla-sequence @@ -0,0 +1 @@ +../../Task/Mian-Chowla-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Middle-three-digits b/Lang/Pluto/Middle-three-digits new file mode 120000 index 0000000000..8d3393e673 --- /dev/null +++ b/Lang/Pluto/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Mind-boggling-card-trick b/Lang/Pluto/Mind-boggling-card-trick new file mode 120000 index 0000000000..230afb38bb --- /dev/null +++ b/Lang/Pluto/Mind-boggling-card-trick @@ -0,0 +1 @@ +../../Task/Mind-boggling-card-trick/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Modified-random-distribution b/Lang/Pluto/Modified-random-distribution new file mode 120000 index 0000000000..a50baa585f --- /dev/null +++ b/Lang/Pluto/Modified-random-distribution @@ -0,0 +1 @@ +../../Task/Modified-random-distribution/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Modular-exponentiation b/Lang/Pluto/Modular-exponentiation new file mode 120000 index 0000000000..5694ee1899 --- /dev/null +++ b/Lang/Pluto/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Modular-inverse b/Lang/Pluto/Modular-inverse new file mode 120000 index 0000000000..339ad0f426 --- /dev/null +++ b/Lang/Pluto/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Monads-Maybe-monad b/Lang/Pluto/Monads-Maybe-monad new file mode 120000 index 0000000000..38ba5a7df2 --- /dev/null +++ b/Lang/Pluto/Monads-Maybe-monad @@ -0,0 +1 @@ +../../Task/Monads-Maybe-monad/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Monte-Carlo-methods b/Lang/Pluto/Monte-Carlo-methods new file mode 120000 index 0000000000..8639690631 --- /dev/null +++ b/Lang/Pluto/Monte-Carlo-methods @@ -0,0 +1 @@ +../../Task/Monte-Carlo-methods/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Monty-Hall-problem b/Lang/Pluto/Monty-Hall-problem new file mode 120000 index 0000000000..dac7cd8df3 --- /dev/null +++ b/Lang/Pluto/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Morse-code b/Lang/Pluto/Morse-code new file mode 120000 index 0000000000..cf03e5492b --- /dev/null +++ b/Lang/Pluto/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Motzkin-numbers b/Lang/Pluto/Motzkin-numbers new file mode 120000 index 0000000000..32bef98749 --- /dev/null +++ b/Lang/Pluto/Motzkin-numbers @@ -0,0 +1 @@ +../../Task/Motzkin-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Move-to-front-algorithm b/Lang/Pluto/Move-to-front-algorithm new file mode 120000 index 0000000000..2cc1837031 --- /dev/null +++ b/Lang/Pluto/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Multi-dimensional-array b/Lang/Pluto/Multi-dimensional-array new file mode 120000 index 0000000000..53ab69b153 --- /dev/null +++ b/Lang/Pluto/Multi-dimensional-array @@ -0,0 +1 @@ +../../Task/Multi-dimensional-array/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Multifactorial b/Lang/Pluto/Multifactorial new file mode 120000 index 0000000000..db75308a5f --- /dev/null +++ b/Lang/Pluto/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Multiple-distinct-objects b/Lang/Pluto/Multiple-distinct-objects new file mode 120000 index 0000000000..3449d4226d --- /dev/null +++ b/Lang/Pluto/Multiple-distinct-objects @@ -0,0 +1 @@ +../../Task/Multiple-distinct-objects/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Multiple-regression b/Lang/Pluto/Multiple-regression new file mode 120000 index 0000000000..41b57d2c96 --- /dev/null +++ b/Lang/Pluto/Multiple-regression @@ -0,0 +1 @@ +../../Task/Multiple-regression/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Multiplication-tables b/Lang/Pluto/Multiplication-tables new file mode 120000 index 0000000000..98a4d7bd3c --- /dev/null +++ b/Lang/Pluto/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Munchausen-numbers b/Lang/Pluto/Munchausen-numbers new file mode 120000 index 0000000000..9b090f8c02 --- /dev/null +++ b/Lang/Pluto/Munchausen-numbers @@ -0,0 +1 @@ +../../Task/Munchausen-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Munching-squares b/Lang/Pluto/Munching-squares new file mode 120000 index 0000000000..71dcd71a08 --- /dev/null +++ b/Lang/Pluto/Munching-squares @@ -0,0 +1 @@ +../../Task/Munching-squares/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Musical-scale b/Lang/Pluto/Musical-scale new file mode 120000 index 0000000000..9692211175 --- /dev/null +++ b/Lang/Pluto/Musical-scale @@ -0,0 +1 @@ +../../Task/Musical-scale/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Mutual-recursion b/Lang/Pluto/Mutual-recursion new file mode 120000 index 0000000000..3866a9925a --- /dev/null +++ b/Lang/Pluto/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/Pluto \ No newline at end of file diff --git a/Lang/Pluto/N-queens-problem b/Lang/Pluto/N-queens-problem new file mode 120000 index 0000000000..a29c7467b2 --- /dev/null +++ b/Lang/Pluto/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Named-parameters b/Lang/Pluto/Named-parameters new file mode 120000 index 0000000000..8f0b72ba9b --- /dev/null +++ b/Lang/Pluto/Named-parameters @@ -0,0 +1 @@ +../../Task/Named-parameters/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Narcissistic-decimal-number b/Lang/Pluto/Narcissistic-decimal-number new file mode 120000 index 0000000000..feead3c3a0 --- /dev/null +++ b/Lang/Pluto/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Nested-function b/Lang/Pluto/Nested-function new file mode 120000 index 0000000000..ea9816ec32 --- /dev/null +++ b/Lang/Pluto/Nested-function @@ -0,0 +1 @@ +../../Task/Nested-function/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Nested-templated-data b/Lang/Pluto/Nested-templated-data new file mode 120000 index 0000000000..d56f50a5d8 --- /dev/null +++ b/Lang/Pluto/Nested-templated-data @@ -0,0 +1 @@ +../../Task/Nested-templated-data/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Non-continuous-subsequences b/Lang/Pluto/Non-continuous-subsequences new file mode 120000 index 0000000000..f226b8c60b --- /dev/null +++ b/Lang/Pluto/Non-continuous-subsequences @@ -0,0 +1 @@ +../../Task/Non-continuous-subsequences/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Non-decimal-radices-Convert b/Lang/Pluto/Non-decimal-radices-Convert new file mode 120000 index 0000000000..e1fddc5a20 --- /dev/null +++ b/Lang/Pluto/Non-decimal-radices-Convert @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Convert/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Non-decimal-radices-Input b/Lang/Pluto/Non-decimal-radices-Input new file mode 120000 index 0000000000..e530fe6bb6 --- /dev/null +++ b/Lang/Pluto/Non-decimal-radices-Input @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Input/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Non-decimal-radices-Output b/Lang/Pluto/Non-decimal-radices-Output new file mode 120000 index 0000000000..8cfb1c729a --- /dev/null +++ b/Lang/Pluto/Non-decimal-radices-Output @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Output/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Nonoblock b/Lang/Pluto/Nonoblock new file mode 120000 index 0000000000..733d16326f --- /dev/null +++ b/Lang/Pluto/Nonoblock @@ -0,0 +1 @@ +../../Task/Nonoblock/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Nth b/Lang/Pluto/Nth new file mode 120000 index 0000000000..54dfb50037 --- /dev/null +++ b/Lang/Pluto/Nth @@ -0,0 +1 @@ +../../Task/Nth/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Number-names b/Lang/Pluto/Number-names new file mode 120000 index 0000000000..1ede3bfc36 --- /dev/null +++ b/Lang/Pluto/Number-names @@ -0,0 +1 @@ +../../Task/Number-names/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Numbers-with-equal-rises-and-falls b/Lang/Pluto/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..b08f5ff647 --- /dev/null +++ b/Lang/Pluto/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Numeric-error-propagation b/Lang/Pluto/Numeric-error-propagation new file mode 120000 index 0000000000..2f5e41e871 --- /dev/null +++ b/Lang/Pluto/Numeric-error-propagation @@ -0,0 +1 @@ +../../Task/Numeric-error-propagation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Numerical-integration b/Lang/Pluto/Numerical-integration new file mode 120000 index 0000000000..e89c1b753a --- /dev/null +++ b/Lang/Pluto/Numerical-integration @@ -0,0 +1 @@ +../../Task/Numerical-integration/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Old-Russian-measure-of-length b/Lang/Pluto/Old-Russian-measure-of-length new file mode 120000 index 0000000000..9f7493d0af --- /dev/null +++ b/Lang/Pluto/Old-Russian-measure-of-length @@ -0,0 +1 @@ +../../Task/Old-Russian-measure-of-length/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Old-lady-swallowed-a-fly b/Lang/Pluto/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..e29df6472a --- /dev/null +++ b/Lang/Pluto/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/Pluto \ No newline at end of file diff --git a/Lang/Pluto/One-dimensional-cellular-automata b/Lang/Pluto/One-dimensional-cellular-automata new file mode 120000 index 0000000000..b90efd8831 --- /dev/null +++ b/Lang/Pluto/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Order-by-pair-comparisons b/Lang/Pluto/Order-by-pair-comparisons new file mode 120000 index 0000000000..1c7665f6b2 --- /dev/null +++ b/Lang/Pluto/Order-by-pair-comparisons @@ -0,0 +1 @@ +../../Task/Order-by-pair-comparisons/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Ordered-words b/Lang/Pluto/Ordered-words new file mode 120000 index 0000000000..018c8529a3 --- /dev/null +++ b/Lang/Pluto/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Ormiston-triples b/Lang/Pluto/Ormiston-triples new file mode 120000 index 0000000000..e6fe78c60e --- /dev/null +++ b/Lang/Pluto/Ormiston-triples @@ -0,0 +1 @@ +../../Task/Ormiston-triples/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Palindrome-detection b/Lang/Pluto/Palindrome-detection new file mode 120000 index 0000000000..755083778a --- /dev/null +++ b/Lang/Pluto/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pancake-numbers b/Lang/Pluto/Pancake-numbers new file mode 120000 index 0000000000..129dac7c77 --- /dev/null +++ b/Lang/Pluto/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Paraffins b/Lang/Pluto/Paraffins new file mode 120000 index 0000000000..4b8b6e0ba9 --- /dev/null +++ b/Lang/Pluto/Paraffins @@ -0,0 +1 @@ +../../Task/Paraffins/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Parametric-polymorphism b/Lang/Pluto/Parametric-polymorphism new file mode 120000 index 0000000000..bdc68d3723 --- /dev/null +++ b/Lang/Pluto/Parametric-polymorphism @@ -0,0 +1 @@ +../../Task/Parametric-polymorphism/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Parsing-RPN-calculator-algorithm b/Lang/Pluto/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..f120a8c76e --- /dev/null +++ b/Lang/Pluto/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Parsing-Shunting-yard-algorithm b/Lang/Pluto/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..6a968b87bd --- /dev/null +++ b/Lang/Pluto/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Partial-function-application b/Lang/Pluto/Partial-function-application new file mode 120000 index 0000000000..bc39fe1347 --- /dev/null +++ b/Lang/Pluto/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Partition-an-integer-x-into-n-primes b/Lang/Pluto/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..b3156a2b19 --- /dev/null +++ b/Lang/Pluto/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Partition-function-P b/Lang/Pluto/Partition-function-P new file mode 120000 index 0000000000..74dceccc52 --- /dev/null +++ b/Lang/Pluto/Partition-function-P @@ -0,0 +1 @@ +../../Task/Partition-function-P/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pascal-matrix-generation b/Lang/Pluto/Pascal-matrix-generation new file mode 120000 index 0000000000..08137286fd --- /dev/null +++ b/Lang/Pluto/Pascal-matrix-generation @@ -0,0 +1 @@ +../../Task/Pascal-matrix-generation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pascals-triangle b/Lang/Pluto/Pascals-triangle new file mode 120000 index 0000000000..b148762a81 --- /dev/null +++ b/Lang/Pluto/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pascals-triangle-Puzzle b/Lang/Pluto/Pascals-triangle-Puzzle new file mode 120000 index 0000000000..312b0f9b1b --- /dev/null +++ b/Lang/Pluto/Pascals-triangle-Puzzle @@ -0,0 +1 @@ +../../Task/Pascals-triangle-Puzzle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pells-equation b/Lang/Pluto/Pells-equation new file mode 120000 index 0000000000..330936d009 --- /dev/null +++ b/Lang/Pluto/Pells-equation @@ -0,0 +1 @@ +../../Task/Pells-equation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Perfect-numbers b/Lang/Pluto/Perfect-numbers new file mode 120000 index 0000000000..c44c743521 --- /dev/null +++ b/Lang/Pluto/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Perfect-shuffle b/Lang/Pluto/Perfect-shuffle new file mode 120000 index 0000000000..1dd4b8c882 --- /dev/null +++ b/Lang/Pluto/Perfect-shuffle @@ -0,0 +1 @@ +../../Task/Perfect-shuffle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Perfect-totient-numbers b/Lang/Pluto/Perfect-totient-numbers new file mode 120000 index 0000000000..ff9d8e3ace --- /dev/null +++ b/Lang/Pluto/Perfect-totient-numbers @@ -0,0 +1 @@ +../../Task/Perfect-totient-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Periodic-table b/Lang/Pluto/Periodic-table new file mode 120000 index 0000000000..9aa6afb48f --- /dev/null +++ b/Lang/Pluto/Periodic-table @@ -0,0 +1 @@ +../../Task/Periodic-table/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Peripheral-drift-illusion b/Lang/Pluto/Peripheral-drift-illusion new file mode 120000 index 0000000000..28e04374ac --- /dev/null +++ b/Lang/Pluto/Peripheral-drift-illusion @@ -0,0 +1 @@ +../../Task/Peripheral-drift-illusion/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Perlin-noise b/Lang/Pluto/Perlin-noise new file mode 120000 index 0000000000..9a99043b16 --- /dev/null +++ b/Lang/Pluto/Perlin-noise @@ -0,0 +1 @@ +../../Task/Perlin-noise/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Permutations b/Lang/Pluto/Permutations new file mode 120000 index 0000000000..750604fad2 --- /dev/null +++ b/Lang/Pluto/Permutations @@ -0,0 +1 @@ +../../Task/Permutations/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pernicious-numbers b/Lang/Pluto/Pernicious-numbers new file mode 120000 index 0000000000..29e4a1f27e --- /dev/null +++ b/Lang/Pluto/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Phrase-reversals b/Lang/Pluto/Phrase-reversals new file mode 120000 index 0000000000..8398529c2c --- /dev/null +++ b/Lang/Pluto/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pick-random-element b/Lang/Pluto/Pick-random-element new file mode 120000 index 0000000000..f181e160e5 --- /dev/null +++ b/Lang/Pluto/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pisano-period b/Lang/Pluto/Pisano-period new file mode 120000 index 0000000000..377c8913e0 --- /dev/null +++ b/Lang/Pluto/Pisano-period @@ -0,0 +1 @@ +../../Task/Pisano-period/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pointers-and-references b/Lang/Pluto/Pointers-and-references new file mode 120000 index 0000000000..e2ffa489f1 --- /dev/null +++ b/Lang/Pluto/Pointers-and-references @@ -0,0 +1 @@ +../../Task/Pointers-and-references/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Polynomial-long-division b/Lang/Pluto/Polynomial-long-division new file mode 120000 index 0000000000..feb0f9bb3e --- /dev/null +++ b/Lang/Pluto/Polynomial-long-division @@ -0,0 +1 @@ +../../Task/Polynomial-long-division/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Polynomial-regression b/Lang/Pluto/Polynomial-regression new file mode 120000 index 0000000000..11b7492061 --- /dev/null +++ b/Lang/Pluto/Polynomial-regression @@ -0,0 +1 @@ +../../Task/Polynomial-regression/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Population-count b/Lang/Pluto/Population-count new file mode 120000 index 0000000000..c275fa8665 --- /dev/null +++ b/Lang/Pluto/Population-count @@ -0,0 +1 @@ +../../Task/Population-count/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Power-set b/Lang/Pluto/Power-set new file mode 120000 index 0000000000..72362c1ec0 --- /dev/null +++ b/Lang/Pluto/Power-set @@ -0,0 +1 @@ +../../Task/Power-set/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Price-fraction b/Lang/Pluto/Price-fraction new file mode 120000 index 0000000000..1ac1f34fe5 --- /dev/null +++ b/Lang/Pluto/Price-fraction @@ -0,0 +1 @@ +../../Task/Price-fraction/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Primality-by-Wilsons-theorem b/Lang/Pluto/Primality-by-Wilsons-theorem new file mode 120000 index 0000000000..9b5599f64b --- /dev/null +++ b/Lang/Pluto/Primality-by-Wilsons-theorem @@ -0,0 +1 @@ +../../Task/Primality-by-Wilsons-theorem/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Primality-by-trial-division b/Lang/Pluto/Primality-by-trial-division new file mode 120000 index 0000000000..01622c5c43 --- /dev/null +++ b/Lang/Pluto/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Prime-conspiracy b/Lang/Pluto/Prime-conspiracy new file mode 120000 index 0000000000..fb52d53fda --- /dev/null +++ b/Lang/Pluto/Prime-conspiracy @@ -0,0 +1 @@ +../../Task/Prime-conspiracy/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Prime-decomposition b/Lang/Pluto/Prime-decomposition new file mode 120000 index 0000000000..3af54a0bb5 --- /dev/null +++ b/Lang/Pluto/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Prime-triangle b/Lang/Pluto/Prime-triangle new file mode 120000 index 0000000000..9d4d789f0f --- /dev/null +++ b/Lang/Pluto/Prime-triangle @@ -0,0 +1 @@ +../../Task/Prime-triangle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Primes---allocate-descendants-to-their-ancestors b/Lang/Pluto/Primes---allocate-descendants-to-their-ancestors new file mode 120000 index 0000000000..f8c226f8bd --- /dev/null +++ b/Lang/Pluto/Primes---allocate-descendants-to-their-ancestors @@ -0,0 +1 @@ +../../Task/Primes---allocate-descendants-to-their-ancestors/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Primorial-numbers b/Lang/Pluto/Primorial-numbers new file mode 120000 index 0000000000..c8bd364676 --- /dev/null +++ b/Lang/Pluto/Primorial-numbers @@ -0,0 +1 @@ +../../Task/Primorial-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Priority-queue b/Lang/Pluto/Priority-queue new file mode 120000 index 0000000000..ad7bed4159 --- /dev/null +++ b/Lang/Pluto/Priority-queue @@ -0,0 +1 @@ +../../Task/Priority-queue/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Program-name b/Lang/Pluto/Program-name new file mode 120000 index 0000000000..6b084789ed --- /dev/null +++ b/Lang/Pluto/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Program-termination b/Lang/Pluto/Program-termination new file mode 120000 index 0000000000..50e8764745 --- /dev/null +++ b/Lang/Pluto/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Proper-divisors b/Lang/Pluto/Proper-divisors new file mode 120000 index 0000000000..8bb1a6945e --- /dev/null +++ b/Lang/Pluto/Proper-divisors @@ -0,0 +1 @@ +../../Task/Proper-divisors/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pseudo-random-numbers-Middle-square-method b/Lang/Pluto/Pseudo-random-numbers-Middle-square-method new file mode 120000 index 0000000000..13c5850baa --- /dev/null +++ b/Lang/Pluto/Pseudo-random-numbers-Middle-square-method @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Middle-square-method/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pseudo-random-numbers-PCG32 b/Lang/Pluto/Pseudo-random-numbers-PCG32 new file mode 120000 index 0000000000..a7591cbf7d --- /dev/null +++ b/Lang/Pluto/Pseudo-random-numbers-PCG32 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-PCG32/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pseudo-random-numbers-Splitmix64 b/Lang/Pluto/Pseudo-random-numbers-Splitmix64 new file mode 120000 index 0000000000..5899b47f2e --- /dev/null +++ b/Lang/Pluto/Pseudo-random-numbers-Splitmix64 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Splitmix64/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pythagoras-tree b/Lang/Pluto/Pythagoras-tree new file mode 120000 index 0000000000..08b1af9c83 --- /dev/null +++ b/Lang/Pluto/Pythagoras-tree @@ -0,0 +1 @@ +../../Task/Pythagoras-tree/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Pythagorean-triples b/Lang/Pluto/Pythagorean-triples new file mode 120000 index 0000000000..8be426ea15 --- /dev/null +++ b/Lang/Pluto/Pythagorean-triples @@ -0,0 +1 @@ +../../Task/Pythagorean-triples/Pluto \ No newline at end of file diff --git a/Lang/Pluto/QR-decomposition b/Lang/Pluto/QR-decomposition new file mode 120000 index 0000000000..6d72ede0a4 --- /dev/null +++ b/Lang/Pluto/QR-decomposition @@ -0,0 +1 @@ +../../Task/QR-decomposition/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Queue-Definition b/Lang/Pluto/Queue-Definition new file mode 120000 index 0000000000..8cf42a0b6a --- /dev/null +++ b/Lang/Pluto/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Queue-Usage b/Lang/Pluto/Queue-Usage new file mode 120000 index 0000000000..6d7d7a3b25 --- /dev/null +++ b/Lang/Pluto/Queue-Usage @@ -0,0 +1 @@ +../../Task/Queue-Usage/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Quoting-constructs b/Lang/Pluto/Quoting-constructs new file mode 120000 index 0000000000..21c1cfccbd --- /dev/null +++ b/Lang/Pluto/Quoting-constructs @@ -0,0 +1 @@ +../../Task/Quoting-constructs/Pluto \ No newline at end of file diff --git a/Lang/Pluto/RIPEMD-160 b/Lang/Pluto/RIPEMD-160 new file mode 120000 index 0000000000..18207c76aa --- /dev/null +++ b/Lang/Pluto/RIPEMD-160 @@ -0,0 +1 @@ +../../Task/RIPEMD-160/Pluto \ No newline at end of file diff --git a/Lang/Pluto/RPG-attributes-generator b/Lang/Pluto/RPG-attributes-generator new file mode 120000 index 0000000000..94703dd51c --- /dev/null +++ b/Lang/Pluto/RPG-attributes-generator @@ -0,0 +1 @@ +../../Task/RPG-attributes-generator/Pluto \ No newline at end of file diff --git a/Lang/Pluto/RSA-code b/Lang/Pluto/RSA-code new file mode 120000 index 0000000000..fa27ed3ec1 --- /dev/null +++ b/Lang/Pluto/RSA-code @@ -0,0 +1 @@ +../../Task/RSA-code/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Ramanujans-constant b/Lang/Pluto/Ramanujans-constant new file mode 120000 index 0000000000..c98dc7a621 --- /dev/null +++ b/Lang/Pluto/Ramanujans-constant @@ -0,0 +1 @@ +../../Task/Ramanujans-constant/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Ramer-Douglas-Peucker-line-simplification b/Lang/Pluto/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..f3927eff81 --- /dev/null +++ b/Lang/Pluto/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Random-number-generator-device- b/Lang/Pluto/Random-number-generator-device- new file mode 120000 index 0000000000..6f23d7dfa7 --- /dev/null +++ b/Lang/Pluto/Random-number-generator-device- @@ -0,0 +1 @@ +../../Task/Random-number-generator-device-/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Random-numbers b/Lang/Pluto/Random-numbers new file mode 120000 index 0000000000..7bda811b12 --- /dev/null +++ b/Lang/Pluto/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Range-expansion b/Lang/Pluto/Range-expansion new file mode 120000 index 0000000000..c486f1e65b --- /dev/null +++ b/Lang/Pluto/Range-expansion @@ -0,0 +1 @@ +../../Task/Range-expansion/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Range-extraction b/Lang/Pluto/Range-extraction new file mode 120000 index 0000000000..c2738db56f --- /dev/null +++ b/Lang/Pluto/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Rare-numbers b/Lang/Pluto/Rare-numbers new file mode 120000 index 0000000000..f80bc44b48 --- /dev/null +++ b/Lang/Pluto/Rare-numbers @@ -0,0 +1 @@ +../../Task/Rare-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Read-a-configuration-file b/Lang/Pluto/Read-a-configuration-file new file mode 120000 index 0000000000..90fb599972 --- /dev/null +++ b/Lang/Pluto/Read-a-configuration-file @@ -0,0 +1 @@ +../../Task/Read-a-configuration-file/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Read-a-file-line-by-line b/Lang/Pluto/Read-a-file-line-by-line new file mode 120000 index 0000000000..d35b8cfbc4 --- /dev/null +++ b/Lang/Pluto/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Read-entire-file b/Lang/Pluto/Read-entire-file new file mode 120000 index 0000000000..f49bee994d --- /dev/null +++ b/Lang/Pluto/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Real-constants-and-functions b/Lang/Pluto/Real-constants-and-functions new file mode 120000 index 0000000000..0f3f45eaa6 --- /dev/null +++ b/Lang/Pluto/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Recamans-sequence b/Lang/Pluto/Recamans-sequence new file mode 120000 index 0000000000..b47a985a96 --- /dev/null +++ b/Lang/Pluto/Recamans-sequence @@ -0,0 +1 @@ +../../Task/Recamans-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Reduced-row-echelon-form b/Lang/Pluto/Reduced-row-echelon-form new file mode 120000 index 0000000000..8086c26ac8 --- /dev/null +++ b/Lang/Pluto/Reduced-row-echelon-form @@ -0,0 +1 @@ +../../Task/Reduced-row-echelon-form/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Rename-a-file b/Lang/Pluto/Rename-a-file new file mode 120000 index 0000000000..dd234bb854 --- /dev/null +++ b/Lang/Pluto/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Repeat b/Lang/Pluto/Repeat new file mode 120000 index 0000000000..a6a3c03575 --- /dev/null +++ b/Lang/Pluto/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Repeat-a-string b/Lang/Pluto/Repeat-a-string new file mode 120000 index 0000000000..7cea8b7235 --- /dev/null +++ b/Lang/Pluto/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Repunit-primes b/Lang/Pluto/Repunit-primes new file mode 120000 index 0000000000..7e185e6e79 --- /dev/null +++ b/Lang/Pluto/Repunit-primes @@ -0,0 +1 @@ +../../Task/Repunit-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Resistor-mesh b/Lang/Pluto/Resistor-mesh new file mode 120000 index 0000000000..e4f455a984 --- /dev/null +++ b/Lang/Pluto/Resistor-mesh @@ -0,0 +1 @@ +../../Task/Resistor-mesh/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Return-multiple-values b/Lang/Pluto/Return-multiple-values new file mode 120000 index 0000000000..18f6c32d09 --- /dev/null +++ b/Lang/Pluto/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Reverse-a-string b/Lang/Pluto/Reverse-a-string new file mode 120000 index 0000000000..dc5b2e2493 --- /dev/null +++ b/Lang/Pluto/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Reverse-words-in-a-string b/Lang/Pluto/Reverse-words-in-a-string new file mode 120000 index 0000000000..378e6ea4b7 --- /dev/null +++ b/Lang/Pluto/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Roman-numerals-Encode b/Lang/Pluto/Roman-numerals-Encode new file mode 120000 index 0000000000..d12a85d68f --- /dev/null +++ b/Lang/Pluto/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Roots-of-a-function b/Lang/Pluto/Roots-of-a-function new file mode 120000 index 0000000000..a5bb6f8f20 --- /dev/null +++ b/Lang/Pluto/Roots-of-a-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-function/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Roots-of-a-quadratic-function b/Lang/Pluto/Roots-of-a-quadratic-function new file mode 120000 index 0000000000..8e5bf4c688 --- /dev/null +++ b/Lang/Pluto/Roots-of-a-quadratic-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-quadratic-function/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Roots-of-unity b/Lang/Pluto/Roots-of-unity new file mode 120000 index 0000000000..e0f1ada438 --- /dev/null +++ b/Lang/Pluto/Roots-of-unity @@ -0,0 +1 @@ +../../Task/Roots-of-unity/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Rot-13 b/Lang/Pluto/Rot-13 new file mode 120000 index 0000000000..ca2ef70221 --- /dev/null +++ b/Lang/Pluto/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Runge-Kutta-method b/Lang/Pluto/Runge-Kutta-method new file mode 120000 index 0000000000..1f412f01e7 --- /dev/null +++ b/Lang/Pluto/Runge-Kutta-method @@ -0,0 +1 @@ +../../Task/Runge-Kutta-method/Pluto \ No newline at end of file diff --git a/Lang/Pluto/SEDOLs b/Lang/Pluto/SEDOLs new file mode 120000 index 0000000000..4a14938cfb --- /dev/null +++ b/Lang/Pluto/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/Pluto \ No newline at end of file diff --git a/Lang/Pluto/SHA-1 b/Lang/Pluto/SHA-1 new file mode 120000 index 0000000000..b2417e97b6 --- /dev/null +++ b/Lang/Pluto/SHA-1 @@ -0,0 +1 @@ +../../Task/SHA-1/Pluto \ No newline at end of file diff --git a/Lang/Pluto/SHA-256 b/Lang/Pluto/SHA-256 new file mode 120000 index 0000000000..69f9d4a47c --- /dev/null +++ b/Lang/Pluto/SHA-256 @@ -0,0 +1 @@ +../../Task/SHA-256/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Safe-primes-and-unsafe-primes b/Lang/Pluto/Safe-primes-and-unsafe-primes new file mode 120000 index 0000000000..0dd190920e --- /dev/null +++ b/Lang/Pluto/Safe-primes-and-unsafe-primes @@ -0,0 +1 @@ +../../Task/Safe-primes-and-unsafe-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sailors-coconuts-and-a-monkey-problem b/Lang/Pluto/Sailors-coconuts-and-a-monkey-problem new file mode 120000 index 0000000000..29da882738 --- /dev/null +++ b/Lang/Pluto/Sailors-coconuts-and-a-monkey-problem @@ -0,0 +1 @@ +../../Task/Sailors-coconuts-and-a-monkey-problem/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Search-a-list b/Lang/Pluto/Search-a-list new file mode 120000 index 0000000000..7284791eca --- /dev/null +++ b/Lang/Pluto/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Search-a-list-of-records b/Lang/Pluto/Search-a-list-of-records new file mode 120000 index 0000000000..53af5de4bf --- /dev/null +++ b/Lang/Pluto/Search-a-list-of-records @@ -0,0 +1 @@ +../../Task/Search-a-list-of-records/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Selectively-replace-multiple-instances-of-a-character-within-a-string b/Lang/Pluto/Selectively-replace-multiple-instances-of-a-character-within-a-string new file mode 120000 index 0000000000..b494f69bf0 --- /dev/null +++ b/Lang/Pluto/Selectively-replace-multiple-instances-of-a-character-within-a-string @@ -0,0 +1 @@ +../../Task/Selectively-replace-multiple-instances-of-a-character-within-a-string/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Self-numbers b/Lang/Pluto/Self-numbers new file mode 120000 index 0000000000..6ddaee76e3 --- /dev/null +++ b/Lang/Pluto/Self-numbers @@ -0,0 +1 @@ +../../Task/Self-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Semiprime b/Lang/Pluto/Semiprime new file mode 120000 index 0000000000..8587fb750c --- /dev/null +++ b/Lang/Pluto/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Semordnilap b/Lang/Pluto/Semordnilap new file mode 120000 index 0000000000..92f96e5b0c --- /dev/null +++ b/Lang/Pluto/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sequence-of-non-squares b/Lang/Pluto/Sequence-of-non-squares new file mode 120000 index 0000000000..ffd6b85122 --- /dev/null +++ b/Lang/Pluto/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sequence-of-primes-by-trial-division b/Lang/Pluto/Sequence-of-primes-by-trial-division new file mode 120000 index 0000000000..0a541cb28c --- /dev/null +++ b/Lang/Pluto/Sequence-of-primes-by-trial-division @@ -0,0 +1 @@ +../../Task/Sequence-of-primes-by-trial-division/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sequence-of-primorial-primes b/Lang/Pluto/Sequence-of-primorial-primes new file mode 120000 index 0000000000..cc2120f894 --- /dev/null +++ b/Lang/Pluto/Sequence-of-primorial-primes @@ -0,0 +1 @@ +../../Task/Sequence-of-primorial-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sequence:-smallest-number-with-exactly-n-divisors b/Lang/Pluto/Sequence:-smallest-number-with-exactly-n-divisors new file mode 120000 index 0000000000..ac5bc99ced --- /dev/null +++ b/Lang/Pluto/Sequence:-smallest-number-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-with-exactly-n-divisors/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Set b/Lang/Pluto/Set new file mode 120000 index 0000000000..9bbe04e32f --- /dev/null +++ b/Lang/Pluto/Set @@ -0,0 +1 @@ +../../Task/Set/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Set-consolidation b/Lang/Pluto/Set-consolidation new file mode 120000 index 0000000000..af203f8560 --- /dev/null +++ b/Lang/Pluto/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Set-of-real-numbers b/Lang/Pluto/Set-of-real-numbers new file mode 120000 index 0000000000..80d4d8a2d1 --- /dev/null +++ b/Lang/Pluto/Set-of-real-numbers @@ -0,0 +1 @@ +../../Task/Set-of-real-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Set-right-adjacent-bits b/Lang/Pluto/Set-right-adjacent-bits new file mode 120000 index 0000000000..7f599e0236 --- /dev/null +++ b/Lang/Pluto/Set-right-adjacent-bits @@ -0,0 +1 @@ +../../Task/Set-right-adjacent-bits/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sexy-primes b/Lang/Pluto/Sexy-primes new file mode 120000 index 0000000000..2ab94558b6 --- /dev/null +++ b/Lang/Pluto/Sexy-primes @@ -0,0 +1 @@ +../../Task/Sexy-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Shoelace-formula-for-polygonal-area b/Lang/Pluto/Shoelace-formula-for-polygonal-area new file mode 120000 index 0000000000..beae637d82 --- /dev/null +++ b/Lang/Pluto/Shoelace-formula-for-polygonal-area @@ -0,0 +1 @@ +../../Task/Shoelace-formula-for-polygonal-area/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Show-ASCII-table b/Lang/Pluto/Show-ASCII-table new file mode 120000 index 0000000000..cac0997662 --- /dev/null +++ b/Lang/Pluto/Show-ASCII-table @@ -0,0 +1 @@ +../../Task/Show-ASCII-table/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sierpinski-arrowhead-curve b/Lang/Pluto/Sierpinski-arrowhead-curve new file mode 120000 index 0000000000..18f606e730 --- /dev/null +++ b/Lang/Pluto/Sierpinski-arrowhead-curve @@ -0,0 +1 @@ +../../Task/Sierpinski-arrowhead-curve/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sierpinski-square-curve b/Lang/Pluto/Sierpinski-square-curve new file mode 120000 index 0000000000..35f7d5150e --- /dev/null +++ b/Lang/Pluto/Sierpinski-square-curve @@ -0,0 +1 @@ +../../Task/Sierpinski-square-curve/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sierpinski-triangle-Graphical b/Lang/Pluto/Sierpinski-triangle-Graphical new file mode 120000 index 0000000000..008a1742b1 --- /dev/null +++ b/Lang/Pluto/Sierpinski-triangle-Graphical @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle-Graphical/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Simple-turtle-graphics b/Lang/Pluto/Simple-turtle-graphics new file mode 120000 index 0000000000..0cf7b3ba67 --- /dev/null +++ b/Lang/Pluto/Simple-turtle-graphics @@ -0,0 +1 @@ +../../Task/Simple-turtle-graphics/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Singleton b/Lang/Pluto/Singleton new file mode 120000 index 0000000000..b0a6a2c730 --- /dev/null +++ b/Lang/Pluto/Singleton @@ -0,0 +1 @@ +../../Task/Singleton/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Singly-linked-list-Element-definition b/Lang/Pluto/Singly-linked-list-Element-definition new file mode 120000 index 0000000000..1f46e7b961 --- /dev/null +++ b/Lang/Pluto/Singly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-definition/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Singly-linked-list-Element-insertion b/Lang/Pluto/Singly-linked-list-Element-insertion new file mode 120000 index 0000000000..27b69c63f5 --- /dev/null +++ b/Lang/Pluto/Singly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-insertion/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Singly-linked-list-Traversal b/Lang/Pluto/Singly-linked-list-Traversal new file mode 120000 index 0000000000..a9f1239636 --- /dev/null +++ b/Lang/Pluto/Singly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Traversal/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sleep b/Lang/Pluto/Sleep new file mode 120000 index 0000000000..fe338781ff --- /dev/null +++ b/Lang/Pluto/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sleeping-Beauty-problem b/Lang/Pluto/Sleeping-Beauty-problem new file mode 120000 index 0000000000..34cc3d8c3d --- /dev/null +++ b/Lang/Pluto/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k b/Lang/Pluto/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k new file mode 120000 index 0000000000..b69fb666de --- /dev/null +++ b/Lang/Pluto/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k @@ -0,0 +1 @@ +../../Task/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Smarandache-Wellin-primes b/Lang/Pluto/Smarandache-Wellin-primes new file mode 120000 index 0000000000..44308127bf --- /dev/null +++ b/Lang/Pluto/Smarandache-Wellin-primes @@ -0,0 +1 @@ +../../Task/Smarandache-Wellin-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Smarandache-prime-digital-sequence b/Lang/Pluto/Smarandache-prime-digital-sequence new file mode 120000 index 0000000000..c1bae0f65e --- /dev/null +++ b/Lang/Pluto/Smarandache-prime-digital-sequence @@ -0,0 +1 @@ +../../Task/Smarandache-prime-digital-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sockets b/Lang/Pluto/Sockets new file mode 120000 index 0000000000..50dbde578c --- /dev/null +++ b/Lang/Pluto/Sockets @@ -0,0 +1 @@ +../../Task/Sockets/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sokoban b/Lang/Pluto/Sokoban new file mode 120000 index 0000000000..542f29a2fd --- /dev/null +++ b/Lang/Pluto/Sokoban @@ -0,0 +1 @@ +../../Task/Sokoban/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Soloways-recurring-rainfall b/Lang/Pluto/Soloways-recurring-rainfall new file mode 120000 index 0000000000..3292890eaf --- /dev/null +++ b/Lang/Pluto/Soloways-recurring-rainfall @@ -0,0 +1 @@ +../../Task/Soloways-recurring-rainfall/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Solve-a-Numbrix-puzzle b/Lang/Pluto/Solve-a-Numbrix-puzzle new file mode 120000 index 0000000000..a0c76a1703 --- /dev/null +++ b/Lang/Pluto/Solve-a-Numbrix-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Numbrix-puzzle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sort-a-list-of-object-identifiers b/Lang/Pluto/Sort-a-list-of-object-identifiers new file mode 120000 index 0000000000..243d019eeb --- /dev/null +++ b/Lang/Pluto/Sort-a-list-of-object-identifiers @@ -0,0 +1 @@ +../../Task/Sort-a-list-of-object-identifiers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sort-an-array-of-composite-structures b/Lang/Pluto/Sort-an-array-of-composite-structures new file mode 120000 index 0000000000..11ca6daaca --- /dev/null +++ b/Lang/Pluto/Sort-an-array-of-composite-structures @@ -0,0 +1 @@ +../../Task/Sort-an-array-of-composite-structures/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sort-an-integer-array b/Lang/Pluto/Sort-an-integer-array new file mode 120000 index 0000000000..43fcfc8222 --- /dev/null +++ b/Lang/Pluto/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sort-disjoint-sublist b/Lang/Pluto/Sort-disjoint-sublist new file mode 120000 index 0000000000..43eaf99d0d --- /dev/null +++ b/Lang/Pluto/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sort-numbers-lexicographically b/Lang/Pluto/Sort-numbers-lexicographically new file mode 120000 index 0000000000..e54ac23b46 --- /dev/null +++ b/Lang/Pluto/Sort-numbers-lexicographically @@ -0,0 +1 @@ +../../Task/Sort-numbers-lexicographically/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sort-using-a-custom-comparator b/Lang/Pluto/Sort-using-a-custom-comparator new file mode 120000 index 0000000000..017bd9f879 --- /dev/null +++ b/Lang/Pluto/Sort-using-a-custom-comparator @@ -0,0 +1 @@ +../../Task/Sort-using-a-custom-comparator/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Bead-sort b/Lang/Pluto/Sorting-algorithms-Bead-sort new file mode 120000 index 0000000000..732611b770 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Bead-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bead-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Bogosort b/Lang/Pluto/Sorting-algorithms-Bogosort new file mode 120000 index 0000000000..2902c3ee3a --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Bogosort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bogosort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Bubble-sort b/Lang/Pluto/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..c4cdca7c13 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Cocktail-sort b/Lang/Pluto/Sorting-algorithms-Cocktail-sort new file mode 120000 index 0000000000..468360189f --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Cocktail-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Cocktail-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Cocktail-sort-with-shifting-bounds b/Lang/Pluto/Sorting-algorithms-Cocktail-sort-with-shifting-bounds new file mode 120000 index 0000000000..c01e910e78 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Cocktail-sort-with-shifting-bounds @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Cocktail-sort-with-shifting-bounds/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Comb-sort b/Lang/Pluto/Sorting-algorithms-Comb-sort new file mode 120000 index 0000000000..b6f9e143fc --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Comb-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Comb-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Counting-sort b/Lang/Pluto/Sorting-algorithms-Counting-sort new file mode 120000 index 0000000000..d4c1acd3d5 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Counting-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Counting-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Gnome-sort b/Lang/Pluto/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..77a2f09b42 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Heapsort b/Lang/Pluto/Sorting-algorithms-Heapsort new file mode 120000 index 0000000000..4be9369490 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Heapsort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Heapsort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Insertion-sort b/Lang/Pluto/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..2f3123eb14 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Merge-sort b/Lang/Pluto/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..e46aac85a3 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Pancake-sort b/Lang/Pluto/Sorting-algorithms-Pancake-sort new file mode 120000 index 0000000000..857f218dec --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Pancake-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Pancake-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Patience-sort b/Lang/Pluto/Sorting-algorithms-Patience-sort new file mode 120000 index 0000000000..bf8f7e3856 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Patience-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Patience-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Permutation-sort b/Lang/Pluto/Sorting-algorithms-Permutation-sort new file mode 120000 index 0000000000..a892e63103 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Permutation-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Permutation-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Quicksort b/Lang/Pluto/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..dcb1016c3c --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Radix-sort b/Lang/Pluto/Sorting-algorithms-Radix-sort new file mode 120000 index 0000000000..2aa1cd2582 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Radix-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Radix-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Selection-sort b/Lang/Pluto/Sorting-algorithms-Selection-sort new file mode 120000 index 0000000000..7993c7d392 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Selection-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Selection-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Shell-sort b/Lang/Pluto/Sorting-algorithms-Shell-sort new file mode 120000 index 0000000000..aa83ab75ed --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Shell-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Shell-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Sleep-sort b/Lang/Pluto/Sorting-algorithms-Sleep-sort new file mode 120000 index 0000000000..2b4156ef57 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Sleep-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Sleep-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Stooge-sort b/Lang/Pluto/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..adcd800531 --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sorting-algorithms-Strand-sort b/Lang/Pluto/Sorting-algorithms-Strand-sort new file mode 120000 index 0000000000..a3576da55b --- /dev/null +++ b/Lang/Pluto/Sorting-algorithms-Strand-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Strand-sort/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sparkline-in-unicode b/Lang/Pluto/Sparkline-in-unicode new file mode 120000 index 0000000000..d4375bf194 --- /dev/null +++ b/Lang/Pluto/Sparkline-in-unicode @@ -0,0 +1 @@ +../../Task/Sparkline-in-unicode/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Spelling-of-ordinal-numbers b/Lang/Pluto/Spelling-of-ordinal-numbers new file mode 120000 index 0000000000..707c9a5de7 --- /dev/null +++ b/Lang/Pluto/Spelling-of-ordinal-numbers @@ -0,0 +1 @@ +../../Task/Spelling-of-ordinal-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Spiral-matrix b/Lang/Pluto/Spiral-matrix new file mode 120000 index 0000000000..ab63b333d6 --- /dev/null +++ b/Lang/Pluto/Spiral-matrix @@ -0,0 +1 @@ +../../Task/Spiral-matrix/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Square-but-not-cube b/Lang/Pluto/Square-but-not-cube new file mode 120000 index 0000000000..93ef364cf3 --- /dev/null +++ b/Lang/Pluto/Square-but-not-cube @@ -0,0 +1 @@ +../../Task/Square-but-not-cube/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Square-free-integers b/Lang/Pluto/Square-free-integers new file mode 120000 index 0000000000..bd620174b2 --- /dev/null +++ b/Lang/Pluto/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Stack b/Lang/Pluto/Stack new file mode 120000 index 0000000000..b73a91dd58 --- /dev/null +++ b/Lang/Pluto/Stack @@ -0,0 +1 @@ +../../Task/Stack/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Start-from-a-main-routine b/Lang/Pluto/Start-from-a-main-routine new file mode 120000 index 0000000000..cbf12fbc14 --- /dev/null +++ b/Lang/Pluto/Start-from-a-main-routine @@ -0,0 +1 @@ +../../Task/Start-from-a-main-routine/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Statistics-Basic b/Lang/Pluto/Statistics-Basic new file mode 120000 index 0000000000..4f94a6e6d7 --- /dev/null +++ b/Lang/Pluto/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Statistics-Normal-distribution b/Lang/Pluto/Statistics-Normal-distribution new file mode 120000 index 0000000000..bc2d3ac3d4 --- /dev/null +++ b/Lang/Pluto/Statistics-Normal-distribution @@ -0,0 +1 @@ +../../Task/Statistics-Normal-distribution/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Stem-and-leaf-plot b/Lang/Pluto/Stem-and-leaf-plot new file mode 120000 index 0000000000..cc3ba5ca9e --- /dev/null +++ b/Lang/Pluto/Stem-and-leaf-plot @@ -0,0 +1 @@ +../../Task/Stem-and-leaf-plot/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Stirling-numbers-of-the-first-kind b/Lang/Pluto/Stirling-numbers-of-the-first-kind new file mode 120000 index 0000000000..0c81546d18 --- /dev/null +++ b/Lang/Pluto/Stirling-numbers-of-the-first-kind @@ -0,0 +1 @@ +../../Task/Stirling-numbers-of-the-first-kind/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Stirling-numbers-of-the-second-kind b/Lang/Pluto/Stirling-numbers-of-the-second-kind new file mode 120000 index 0000000000..05d2a235b3 --- /dev/null +++ b/Lang/Pluto/Stirling-numbers-of-the-second-kind @@ -0,0 +1 @@ +../../Task/Stirling-numbers-of-the-second-kind/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Straddling-checkerboard b/Lang/Pluto/Straddling-checkerboard new file mode 120000 index 0000000000..d74538b05d --- /dev/null +++ b/Lang/Pluto/Straddling-checkerboard @@ -0,0 +1 @@ +../../Task/Straddling-checkerboard/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Strassens-algorithm b/Lang/Pluto/Strassens-algorithm new file mode 120000 index 0000000000..79ee4e726f --- /dev/null +++ b/Lang/Pluto/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Pluto \ No newline at end of file diff --git a/Lang/Pluto/String-append b/Lang/Pluto/String-append new file mode 120000 index 0000000000..e24995b130 --- /dev/null +++ b/Lang/Pluto/String-append @@ -0,0 +1 @@ +../../Task/String-append/Pluto \ No newline at end of file diff --git a/Lang/Pluto/String-interpolation-included- b/Lang/Pluto/String-interpolation-included- new file mode 120000 index 0000000000..7953b3790b --- /dev/null +++ b/Lang/Pluto/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/Pluto \ No newline at end of file diff --git a/Lang/Pluto/String-length b/Lang/Pluto/String-length new file mode 120000 index 0000000000..9313ae7886 --- /dev/null +++ b/Lang/Pluto/String-length @@ -0,0 +1 @@ +../../Task/String-length/Pluto \ No newline at end of file diff --git a/Lang/Pluto/String-matching b/Lang/Pluto/String-matching new file mode 120000 index 0000000000..422a3c7f0c --- /dev/null +++ b/Lang/Pluto/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/Pluto \ No newline at end of file diff --git a/Lang/Pluto/String-prepend b/Lang/Pluto/String-prepend new file mode 120000 index 0000000000..84229275c1 --- /dev/null +++ b/Lang/Pluto/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Strip-a-set-of-characters-from-a-string b/Lang/Pluto/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..805462a850 --- /dev/null +++ b/Lang/Pluto/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Strip-whitespace-from-a-string-Top-and-tail b/Lang/Pluto/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..f8b3fd3947 --- /dev/null +++ b/Lang/Pluto/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Subleq b/Lang/Pluto/Subleq new file mode 120000 index 0000000000..100b00d22e --- /dev/null +++ b/Lang/Pluto/Subleq @@ -0,0 +1 @@ +../../Task/Subleq/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Substring b/Lang/Pluto/Substring new file mode 120000 index 0000000000..830ca3e467 --- /dev/null +++ b/Lang/Pluto/Substring @@ -0,0 +1 @@ +../../Task/Substring/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Substring-Top-and-tail b/Lang/Pluto/Substring-Top-and-tail new file mode 120000 index 0000000000..ac12380468 --- /dev/null +++ b/Lang/Pluto/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Successive-prime-differences b/Lang/Pluto/Successive-prime-differences new file mode 120000 index 0000000000..17a80e33ef --- /dev/null +++ b/Lang/Pluto/Successive-prime-differences @@ -0,0 +1 @@ +../../Task/Successive-prime-differences/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sudan-function b/Lang/Pluto/Sudan-function new file mode 120000 index 0000000000..18faadc2cc --- /dev/null +++ b/Lang/Pluto/Sudan-function @@ -0,0 +1 @@ +../../Task/Sudan-function/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sudoku b/Lang/Pluto/Sudoku new file mode 120000 index 0000000000..0219f968ec --- /dev/null +++ b/Lang/Pluto/Sudoku @@ -0,0 +1 @@ +../../Task/Sudoku/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Suffixation-of-decimal-numbers b/Lang/Pluto/Suffixation-of-decimal-numbers new file mode 120000 index 0000000000..c7008ba8db --- /dev/null +++ b/Lang/Pluto/Suffixation-of-decimal-numbers @@ -0,0 +1 @@ +../../Task/Suffixation-of-decimal-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sum-and-product-of-an-array b/Lang/Pluto/Sum-and-product-of-an-array new file mode 120000 index 0000000000..de37da7c3f --- /dev/null +++ b/Lang/Pluto/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sum-and-product-puzzle b/Lang/Pluto/Sum-and-product-puzzle new file mode 120000 index 0000000000..b5887c9a13 --- /dev/null +++ b/Lang/Pluto/Sum-and-product-puzzle @@ -0,0 +1 @@ +../../Task/Sum-and-product-puzzle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sum-digits-of-an-integer b/Lang/Pluto/Sum-digits-of-an-integer new file mode 120000 index 0000000000..0c6a6782ed --- /dev/null +++ b/Lang/Pluto/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sum-multiples-of-3-and-5 b/Lang/Pluto/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..7476a45c41 --- /dev/null +++ b/Lang/Pluto/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sum-of-elements-below-main-diagonal-of-matrix b/Lang/Pluto/Sum-of-elements-below-main-diagonal-of-matrix new file mode 120000 index 0000000000..45a9f51475 --- /dev/null +++ b/Lang/Pluto/Sum-of-elements-below-main-diagonal-of-matrix @@ -0,0 +1 @@ +../../Task/Sum-of-elements-below-main-diagonal-of-matrix/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Summarize-and-say-sequence b/Lang/Pluto/Summarize-and-say-sequence new file mode 120000 index 0000000000..fc93ce6bcc --- /dev/null +++ b/Lang/Pluto/Summarize-and-say-sequence @@ -0,0 +1 @@ +../../Task/Summarize-and-say-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Summarize-primes b/Lang/Pluto/Summarize-primes new file mode 120000 index 0000000000..ecbdeed375 --- /dev/null +++ b/Lang/Pluto/Summarize-primes @@ -0,0 +1 @@ +../../Task/Summarize-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Super-d-numbers b/Lang/Pluto/Super-d-numbers new file mode 120000 index 0000000000..f56d2824e5 --- /dev/null +++ b/Lang/Pluto/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Superellipse b/Lang/Pluto/Superellipse new file mode 120000 index 0000000000..71cba61449 --- /dev/null +++ b/Lang/Pluto/Superellipse @@ -0,0 +1 @@ +../../Task/Superellipse/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Sylvesters-sequence b/Lang/Pluto/Sylvesters-sequence new file mode 120000 index 0000000000..27749333cd --- /dev/null +++ b/Lang/Pluto/Sylvesters-sequence @@ -0,0 +1 @@ +../../Task/Sylvesters-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Symmetric-difference b/Lang/Pluto/Symmetric-difference new file mode 120000 index 0000000000..09ce1d13b8 --- /dev/null +++ b/Lang/Pluto/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Synchronous-concurrency b/Lang/Pluto/Synchronous-concurrency new file mode 120000 index 0000000000..4eb3a63418 --- /dev/null +++ b/Lang/Pluto/Synchronous-concurrency @@ -0,0 +1 @@ +../../Task/Synchronous-concurrency/Pluto \ No newline at end of file diff --git a/Lang/Pluto/System-time b/Lang/Pluto/System-time new file mode 120000 index 0000000000..8575dc8b3a --- /dev/null +++ b/Lang/Pluto/System-time @@ -0,0 +1 @@ +../../Task/System-time/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Tau-function b/Lang/Pluto/Tau-function new file mode 120000 index 0000000000..03b50006f6 --- /dev/null +++ b/Lang/Pluto/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Tau-number b/Lang/Pluto/Tau-number new file mode 120000 index 0000000000..532021c510 --- /dev/null +++ b/Lang/Pluto/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Temperature-conversion b/Lang/Pluto/Temperature-conversion new file mode 120000 index 0000000000..dfda68998c --- /dev/null +++ b/Lang/Pluto/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Terminal-control-Clear-the-screen b/Lang/Pluto/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..edabc9ce73 --- /dev/null +++ b/Lang/Pluto/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Terminal-control-Coloured-text b/Lang/Pluto/Terminal-control-Coloured-text new file mode 120000 index 0000000000..378909157d --- /dev/null +++ b/Lang/Pluto/Terminal-control-Coloured-text @@ -0,0 +1 @@ +../../Task/Terminal-control-Coloured-text/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Terminal-control-Cursor-movement b/Lang/Pluto/Terminal-control-Cursor-movement new file mode 120000 index 0000000000..bf8c8572a2 --- /dev/null +++ b/Lang/Pluto/Terminal-control-Cursor-movement @@ -0,0 +1 @@ +../../Task/Terminal-control-Cursor-movement/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Terminal-control-Cursor-positioning b/Lang/Pluto/Terminal-control-Cursor-positioning new file mode 120000 index 0000000000..feeca5cd4b --- /dev/null +++ b/Lang/Pluto/Terminal-control-Cursor-positioning @@ -0,0 +1 @@ +../../Task/Terminal-control-Cursor-positioning/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Terminal-control-Dimensions b/Lang/Pluto/Terminal-control-Dimensions new file mode 120000 index 0000000000..79b01b1a8a --- /dev/null +++ b/Lang/Pluto/Terminal-control-Dimensions @@ -0,0 +1 @@ +../../Task/Terminal-control-Dimensions/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Terminal-control-Display-an-extended-character b/Lang/Pluto/Terminal-control-Display-an-extended-character new file mode 120000 index 0000000000..d9f4ec60f5 --- /dev/null +++ b/Lang/Pluto/Terminal-control-Display-an-extended-character @@ -0,0 +1 @@ +../../Task/Terminal-control-Display-an-extended-character/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Terminal-control-Hiding-the-cursor b/Lang/Pluto/Terminal-control-Hiding-the-cursor new file mode 120000 index 0000000000..5126fbbc31 --- /dev/null +++ b/Lang/Pluto/Terminal-control-Hiding-the-cursor @@ -0,0 +1 @@ +../../Task/Terminal-control-Hiding-the-cursor/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Terminal-control-Inverse-video b/Lang/Pluto/Terminal-control-Inverse-video new file mode 120000 index 0000000000..a011de6856 --- /dev/null +++ b/Lang/Pluto/Terminal-control-Inverse-video @@ -0,0 +1 @@ +../../Task/Terminal-control-Inverse-video/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Terminal-control-Preserve-screen b/Lang/Pluto/Terminal-control-Preserve-screen new file mode 120000 index 0000000000..4985e385ae --- /dev/null +++ b/Lang/Pluto/Terminal-control-Preserve-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Preserve-screen/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Terminal-control-Ringing-the-terminal-bell b/Lang/Pluto/Terminal-control-Ringing-the-terminal-bell new file mode 120000 index 0000000000..c14ff1f9fd --- /dev/null +++ b/Lang/Pluto/Terminal-control-Ringing-the-terminal-bell @@ -0,0 +1 @@ +../../Task/Terminal-control-Ringing-the-terminal-bell/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Terminal-control-Unicode-output b/Lang/Pluto/Terminal-control-Unicode-output new file mode 120000 index 0000000000..c67e68f15d --- /dev/null +++ b/Lang/Pluto/Terminal-control-Unicode-output @@ -0,0 +1 @@ +../../Task/Terminal-control-Unicode-output/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Ternary-logic b/Lang/Pluto/Ternary-logic new file mode 120000 index 0000000000..ca522a2f56 --- /dev/null +++ b/Lang/Pluto/Ternary-logic @@ -0,0 +1 @@ +../../Task/Ternary-logic/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Test-integerness b/Lang/Pluto/Test-integerness new file mode 120000 index 0000000000..9a3717f805 --- /dev/null +++ b/Lang/Pluto/Test-integerness @@ -0,0 +1 @@ +../../Task/Test-integerness/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Textonyms b/Lang/Pluto/Textonyms new file mode 120000 index 0000000000..4c3ea903b1 --- /dev/null +++ b/Lang/Pluto/Textonyms @@ -0,0 +1 @@ +../../Task/Textonyms/Pluto \ No newline at end of file diff --git a/Lang/Pluto/The-Name-Game b/Lang/Pluto/The-Name-Game new file mode 120000 index 0000000000..de7bc541a3 --- /dev/null +++ b/Lang/Pluto/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/Pluto \ No newline at end of file diff --git a/Lang/Pluto/The-Twelve-Days-of-Christmas b/Lang/Pluto/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..0c2a346005 --- /dev/null +++ b/Lang/Pluto/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/Pluto \ No newline at end of file diff --git a/Lang/Pluto/The-sieve-of-Sundaram b/Lang/Pluto/The-sieve-of-Sundaram new file mode 120000 index 0000000000..bf60d24d46 --- /dev/null +++ b/Lang/Pluto/The-sieve-of-Sundaram @@ -0,0 +1 @@ +../../Task/The-sieve-of-Sundaram/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Thue-Morse b/Lang/Pluto/Thue-Morse new file mode 120000 index 0000000000..b1a06a67e8 --- /dev/null +++ b/Lang/Pluto/Thue-Morse @@ -0,0 +1 @@ +../../Task/Thue-Morse/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Time-a-function b/Lang/Pluto/Time-a-function new file mode 120000 index 0000000000..1ca7d0a7b7 --- /dev/null +++ b/Lang/Pluto/Time-a-function @@ -0,0 +1 @@ +../../Task/Time-a-function/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Tokenize-a-string-with-escaping b/Lang/Pluto/Tokenize-a-string-with-escaping new file mode 120000 index 0000000000..ba51452013 --- /dev/null +++ b/Lang/Pluto/Tokenize-a-string-with-escaping @@ -0,0 +1 @@ +../../Task/Tokenize-a-string-with-escaping/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Top-rank-per-group b/Lang/Pluto/Top-rank-per-group new file mode 120000 index 0000000000..c27cb54f5d --- /dev/null +++ b/Lang/Pluto/Top-rank-per-group @@ -0,0 +1 @@ +../../Task/Top-rank-per-group/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Total-circles-area b/Lang/Pluto/Total-circles-area new file mode 120000 index 0000000000..2f856ad28d --- /dev/null +++ b/Lang/Pluto/Total-circles-area @@ -0,0 +1 @@ +../../Task/Total-circles-area/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Totient-function b/Lang/Pluto/Totient-function new file mode 120000 index 0000000000..73b5eb6381 --- /dev/null +++ b/Lang/Pluto/Totient-function @@ -0,0 +1 @@ +../../Task/Totient-function/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Towers-of-Hanoi b/Lang/Pluto/Towers-of-Hanoi new file mode 120000 index 0000000000..9b1428dcf0 --- /dev/null +++ b/Lang/Pluto/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Trabb-Pardo-Knuth-algorithm b/Lang/Pluto/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..e85f9f54de --- /dev/null +++ b/Lang/Pluto/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Transliterate-English-text-using-the-Greek-alphabet b/Lang/Pluto/Transliterate-English-text-using-the-Greek-alphabet new file mode 120000 index 0000000000..329d1e52f1 --- /dev/null +++ b/Lang/Pluto/Transliterate-English-text-using-the-Greek-alphabet @@ -0,0 +1 @@ +../../Task/Transliterate-English-text-using-the-Greek-alphabet/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Trigonometric-functions b/Lang/Pluto/Trigonometric-functions new file mode 120000 index 0000000000..8bcbebbd97 --- /dev/null +++ b/Lang/Pluto/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Truncatable-primes b/Lang/Pluto/Truncatable-primes new file mode 120000 index 0000000000..e57c3ab40f --- /dev/null +++ b/Lang/Pluto/Truncatable-primes @@ -0,0 +1 @@ +../../Task/Truncatable-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Truncate-a-file b/Lang/Pluto/Truncate-a-file new file mode 120000 index 0000000000..f472b828c2 --- /dev/null +++ b/Lang/Pluto/Truncate-a-file @@ -0,0 +1 @@ +../../Task/Truncate-a-file/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Truth-table b/Lang/Pluto/Truth-table new file mode 120000 index 0000000000..e15e65e09d --- /dev/null +++ b/Lang/Pluto/Truth-table @@ -0,0 +1 @@ +../../Task/Truth-table/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Twelve-statements b/Lang/Pluto/Twelve-statements new file mode 120000 index 0000000000..f003bdd498 --- /dev/null +++ b/Lang/Pluto/Twelve-statements @@ -0,0 +1 @@ +../../Task/Twelve-statements/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Twos-complement b/Lang/Pluto/Twos-complement new file mode 120000 index 0000000000..5830145b21 --- /dev/null +++ b/Lang/Pluto/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Pluto \ No newline at end of file diff --git a/Lang/Pluto/UPC b/Lang/Pluto/UPC new file mode 120000 index 0000000000..477e69b6c6 --- /dev/null +++ b/Lang/Pluto/UPC @@ -0,0 +1 @@ +../../Task/UPC/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Ultra-useful-primes b/Lang/Pluto/Ultra-useful-primes new file mode 120000 index 0000000000..5db52360c1 --- /dev/null +++ b/Lang/Pluto/Ultra-useful-primes @@ -0,0 +1 @@ +../../Task/Ultra-useful-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Unbias-a-random-generator b/Lang/Pluto/Unbias-a-random-generator new file mode 120000 index 0000000000..14b505ac5e --- /dev/null +++ b/Lang/Pluto/Unbias-a-random-generator @@ -0,0 +1 @@ +../../Task/Unbias-a-random-generator/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Unicode-strings b/Lang/Pluto/Unicode-strings new file mode 120000 index 0000000000..482c486148 --- /dev/null +++ b/Lang/Pluto/Unicode-strings @@ -0,0 +1 @@ +../../Task/Unicode-strings/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Unprimeable-numbers b/Lang/Pluto/Unprimeable-numbers new file mode 120000 index 0000000000..ec55975821 --- /dev/null +++ b/Lang/Pluto/Unprimeable-numbers @@ -0,0 +1 @@ +../../Task/Unprimeable-numbers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/User-input-Text b/Lang/Pluto/User-input-Text new file mode 120000 index 0000000000..6c3afd2860 --- /dev/null +++ b/Lang/Pluto/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Vampire-number b/Lang/Pluto/Vampire-number new file mode 120000 index 0000000000..39b76c4ae2 --- /dev/null +++ b/Lang/Pluto/Vampire-number @@ -0,0 +1 @@ +../../Task/Vampire-number/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Van-Eck-sequence b/Lang/Pluto/Van-Eck-sequence new file mode 120000 index 0000000000..d053bbc892 --- /dev/null +++ b/Lang/Pluto/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Van-der-Corput-sequence b/Lang/Pluto/Van-der-Corput-sequence new file mode 120000 index 0000000000..e6ce56ddef --- /dev/null +++ b/Lang/Pluto/Van-der-Corput-sequence @@ -0,0 +1 @@ +../../Task/Van-der-Corput-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Variable-declaration-reset b/Lang/Pluto/Variable-declaration-reset new file mode 120000 index 0000000000..26738839ca --- /dev/null +++ b/Lang/Pluto/Variable-declaration-reset @@ -0,0 +1 @@ +../../Task/Variable-declaration-reset/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Variable-length-quantity b/Lang/Pluto/Variable-length-quantity new file mode 120000 index 0000000000..3f78793bbd --- /dev/null +++ b/Lang/Pluto/Variable-length-quantity @@ -0,0 +1 @@ +../../Task/Variable-length-quantity/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Variadic-function b/Lang/Pluto/Variadic-function new file mode 120000 index 0000000000..8d2be144f4 --- /dev/null +++ b/Lang/Pluto/Variadic-function @@ -0,0 +1 @@ +../../Task/Variadic-function/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Vector b/Lang/Pluto/Vector new file mode 120000 index 0000000000..fd56d6c8ab --- /dev/null +++ b/Lang/Pluto/Vector @@ -0,0 +1 @@ +../../Task/Vector/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Vector-products b/Lang/Pluto/Vector-products new file mode 120000 index 0000000000..83a09bc1a3 --- /dev/null +++ b/Lang/Pluto/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Verhoeff-algorithm b/Lang/Pluto/Verhoeff-algorithm new file mode 120000 index 0000000000..1b001cd3c1 --- /dev/null +++ b/Lang/Pluto/Verhoeff-algorithm @@ -0,0 +1 @@ +../../Task/Verhoeff-algorithm/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Voronoi-diagram b/Lang/Pluto/Voronoi-diagram new file mode 120000 index 0000000000..50678561e7 --- /dev/null +++ b/Lang/Pluto/Voronoi-diagram @@ -0,0 +1 @@ +../../Task/Voronoi-diagram/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Wagstaff-primes b/Lang/Pluto/Wagstaff-primes new file mode 120000 index 0000000000..d8a1a2f0da --- /dev/null +++ b/Lang/Pluto/Wagstaff-primes @@ -0,0 +1 @@ +../../Task/Wagstaff-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Water-collected-between-towers b/Lang/Pluto/Water-collected-between-towers new file mode 120000 index 0000000000..94e32bc8f3 --- /dev/null +++ b/Lang/Pluto/Water-collected-between-towers @@ -0,0 +1 @@ +../../Task/Water-collected-between-towers/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Wieferich-primes b/Lang/Pluto/Wieferich-primes new file mode 120000 index 0000000000..453231fbab --- /dev/null +++ b/Lang/Pluto/Wieferich-primes @@ -0,0 +1 @@ +../../Task/Wieferich-primes/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Wilson-primes-of-order-n b/Lang/Pluto/Wilson-primes-of-order-n new file mode 120000 index 0000000000..9bafdd051b --- /dev/null +++ b/Lang/Pluto/Wilson-primes-of-order-n @@ -0,0 +1 @@ +../../Task/Wilson-primes-of-order-n/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Wireworld b/Lang/Pluto/Wireworld new file mode 120000 index 0000000000..1eed665c2c --- /dev/null +++ b/Lang/Pluto/Wireworld @@ -0,0 +1 @@ +../../Task/Wireworld/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Word-wheel b/Lang/Pluto/Word-wheel new file mode 120000 index 0000000000..c83ad2ab7f --- /dev/null +++ b/Lang/Pluto/Word-wheel @@ -0,0 +1 @@ +../../Task/Word-wheel/Pluto \ No newline at end of file diff --git a/Lang/Pluto/World-Cup-group-stage b/Lang/Pluto/World-Cup-group-stage new file mode 120000 index 0000000000..1c8f3e8b53 --- /dev/null +++ b/Lang/Pluto/World-Cup-group-stage @@ -0,0 +1 @@ +../../Task/World-Cup-group-stage/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Write-entire-file b/Lang/Pluto/Write-entire-file new file mode 120000 index 0000000000..be63715e40 --- /dev/null +++ b/Lang/Pluto/Write-entire-file @@ -0,0 +1 @@ +../../Task/Write-entire-file/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Write-float-arrays-to-a-text-file b/Lang/Pluto/Write-float-arrays-to-a-text-file new file mode 120000 index 0000000000..eaa4582b34 --- /dev/null +++ b/Lang/Pluto/Write-float-arrays-to-a-text-file @@ -0,0 +1 @@ +../../Task/Write-float-arrays-to-a-text-file/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Write-language-name-in-3D-ASCII b/Lang/Pluto/Write-language-name-in-3D-ASCII new file mode 120000 index 0000000000..54358f8cdd --- /dev/null +++ b/Lang/Pluto/Write-language-name-in-3D-ASCII @@ -0,0 +1 @@ +../../Task/Write-language-name-in-3D-ASCII/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Y-combinator b/Lang/Pluto/Y-combinator new file mode 120000 index 0000000000..b356912f44 --- /dev/null +++ b/Lang/Pluto/Y-combinator @@ -0,0 +1 @@ +../../Task/Y-combinator/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Yellowstone-sequence b/Lang/Pluto/Yellowstone-sequence new file mode 120000 index 0000000000..f4fb013414 --- /dev/null +++ b/Lang/Pluto/Yellowstone-sequence @@ -0,0 +1 @@ +../../Task/Yellowstone-sequence/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Zebra-puzzle b/Lang/Pluto/Zebra-puzzle new file mode 120000 index 0000000000..d1dee531e9 --- /dev/null +++ b/Lang/Pluto/Zebra-puzzle @@ -0,0 +1 @@ +../../Task/Zebra-puzzle/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Zeckendorf-number-representation b/Lang/Pluto/Zeckendorf-number-representation new file mode 120000 index 0000000000..6f7ac19b32 --- /dev/null +++ b/Lang/Pluto/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Zero-to-the-zero-power b/Lang/Pluto/Zero-to-the-zero-power new file mode 120000 index 0000000000..88cbcf1376 --- /dev/null +++ b/Lang/Pluto/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/Pluto \ No newline at end of file diff --git a/Lang/Pluto/Zig-zag-matrix b/Lang/Pluto/Zig-zag-matrix new file mode 120000 index 0000000000..49521638f6 --- /dev/null +++ b/Lang/Pluto/Zig-zag-matrix @@ -0,0 +1 @@ +../../Task/Zig-zag-matrix/Pluto \ No newline at end of file diff --git a/Lang/PostScript/00-LANG.txt b/Lang/PostScript/00-LANG.txt index 32cddabaf0..8e66f5a6d8 100644 --- a/Lang/PostScript/00-LANG.txt +++ b/Lang/PostScript/00-LANG.txt @@ -1,16 +1,14 @@ {{language|PostScript}} -'''PostScript''' is a concatenative dynamically typed language with abundant meta language facilities. It allows definition of new control structures at run time, allows reflection and reification of stack, scopes, and even continuations. With Display PostScript, the language even has facilities for multi-threaded execution. Since the language is based on stack, it is suitable for combinator based programming, and all the higher order combinators (initiated by joy language) is applicable in postscript. The language also allows a form of prototype based object orientated programming using dictionaries. See {{libheader|initlib}} for implementation of higher order combinators. +'''PostScript''' is a concatenative, dynamically-typed language with abundant metalanguage facilities. It allows definition of new control structures at runtime, and supports reflection and reification of stack, scopes, and even continuations. With Display PostScript, the language even has facilities for multi-threaded execution. Since the language interpreter is essentially a stack machine, it is suitable for combinator-based programming, and all the higher-order combinators (initiated by joy language) are applicable in PostScript. The language also allows a form of prototype-based, object-orientated programming using dictionaries. See [[Category:Initlib|initlib]] for implementation of higher-order combinators. -'''PostScript''' originated as a printer definition language invented by the founders of '''Adobe'''. The language was necessitated by the increasing demands of printing and rendering jobs on the computers of the 1970s. These tasks were therefore pushed to the printers themselves, with the result that printers now had chips and built in interpreters for PostScript. With the growth of printing complexity, some printers ended up having even more powerful processors than the master systems themselves. +PostScript originated as a printer definition language invented by the founders of '''Adobe'''. The language was necessitated by the increasing demands of printing and rendering jobs on the computers of the 1970s. These tasks were therefore pushed to the printers themselves, with the result that printers now had chips and built-in interpreters for PostScript. With the growth of printing complexity, some printers ended up having even more powerful processors than the master systems themselves. -Although now almost displaced by the '''Portable Document Format''' (PDF), also developed by Adobe, PostScript's unique selling proposition lies in it's being a '''Turing complete''' language with support for the basic data types and fundamental structures and concepts of Computer Science. Many interpreters and viewers of PostScript are available, some even for free. Although primarily a language suited for 2D graphics, PostScript is complete as a language and able to handle normal computation tasks. +Although now almost displaced by the '''Portable Document Format''' (PDF), also developed by Adobe, PostScript's unique selling proposition lies in it's being a '''Turing complete''' language with support for the basic data types and fundamental structures and concepts of computer science. Many interpreters and viewers of PostScript are available, some even for free. Although primarily a language suited for 2D graphics, PostScript is complete as a language and able to handle normal computation tasks. - - -==See Also== -*[http://logand.com/sw/wps/index.html WPS - PostScript interpreter written in JavaScript.] -*[http://code.google.com/p/postcanvas/ postcanvas - Open-source PostScript interpreter written in JavaScript.] -*[http://pages.cs.wisc.edu/~ghost/ Ghostscript opensource postscript interpreter with a lot of extensions. ] -*[http://code.google.com/p/xpost/downloads/detail?name=monterey86.pdf Owen Densmore, Object-Oriented Programming in NeWS, describes the use of dictionaries for implementing single- and multiple-inheritance.] +== See Also == +* [http://logand.com/sw/wps/index.html WPS] — PostScript interpreter written in JavaScript. +* [http://www.feiri.de/pcan/ postcanvas] — Open-source PostScript interpreter written in JavaScript. +* [https://www.ghostscript.com/ GhostScript] — Open-source PostScript interpreter with a lot of extensions. +* [https://web.archive.org/web/20160711025645/http://code.google.com/p/xpost/downloads/detail?name=monterey86.pdf ''Object-Oriented Programming in NeWS''] — Paper describing single- and multiple-inheritance implementation using dictionary objects. {{Language programming paradigm|Concatenative}} \ No newline at end of file diff --git a/Lang/PostScript/Sieve-of-Eratosthenes b/Lang/PostScript/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..bf5fd9fe66 --- /dev/null +++ b/Lang/PostScript/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/PostScript \ No newline at end of file diff --git a/Lang/PostScript/Tic-tac-toe b/Lang/PostScript/Tic-tac-toe new file mode 120000 index 0000000000..1ec7f31545 --- /dev/null +++ b/Lang/PostScript/Tic-tac-toe @@ -0,0 +1 @@ +../../Task/Tic-tac-toe/PostScript \ No newline at end of file diff --git a/Lang/PowerPC-Assembly/Greatest-common-divisor b/Lang/PowerPC-Assembly/Greatest-common-divisor new file mode 120000 index 0000000000..630e6db921 --- /dev/null +++ b/Lang/PowerPC-Assembly/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/PowerPC-Assembly \ No newline at end of file diff --git a/Lang/PowerShell/AKS-test-for-primes b/Lang/PowerShell/AKS-test-for-primes new file mode 120000 index 0000000000..d5622ba541 --- /dev/null +++ b/Lang/PowerShell/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Abundant-odd-numbers b/Lang/PowerShell/Abundant-odd-numbers new file mode 120000 index 0000000000..fa7795f731 --- /dev/null +++ b/Lang/PowerShell/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Anti-primes b/Lang/PowerShell/Anti-primes new file mode 120000 index 0000000000..f56c16a315 --- /dev/null +++ b/Lang/PowerShell/Anti-primes @@ -0,0 +1 @@ +../../Task/Anti-primes/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Base64-decode-data b/Lang/PowerShell/Base64-decode-data new file mode 120000 index 0000000000..64cfcd61a8 --- /dev/null +++ b/Lang/PowerShell/Base64-decode-data @@ -0,0 +1 @@ +../../Task/Base64-decode-data/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Bell-numbers b/Lang/PowerShell/Bell-numbers new file mode 120000 index 0000000000..175671e690 --- /dev/null +++ b/Lang/PowerShell/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Brazilian-numbers b/Lang/PowerShell/Brazilian-numbers new file mode 120000 index 0000000000..93e2e48db6 --- /dev/null +++ b/Lang/PowerShell/Brazilian-numbers @@ -0,0 +1 @@ +../../Task/Brazilian-numbers/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Call-a-foreign-language-function b/Lang/PowerShell/Call-a-foreign-language-function new file mode 120000 index 0000000000..b222a9fc7d --- /dev/null +++ b/Lang/PowerShell/Call-a-foreign-language-function @@ -0,0 +1 @@ +../../Task/Call-a-foreign-language-function/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Department-numbers b/Lang/PowerShell/Department-numbers new file mode 120000 index 0000000000..089828bb9a --- /dev/null +++ b/Lang/PowerShell/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Gray-code b/Lang/PowerShell/Gray-code new file mode 120000 index 0000000000..c7adcf7cdb --- /dev/null +++ b/Lang/PowerShell/Gray-code @@ -0,0 +1 @@ +../../Task/Gray-code/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Hello-world-Web-server b/Lang/PowerShell/Hello-world-Web-server new file mode 120000 index 0000000000..3b4f878f34 --- /dev/null +++ b/Lang/PowerShell/Hello-world-Web-server @@ -0,0 +1 @@ +../../Task/Hello-world-Web-server/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Leonardo-numbers b/Lang/PowerShell/Leonardo-numbers new file mode 120000 index 0000000000..fda0fa0dbc --- /dev/null +++ b/Lang/PowerShell/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/M-bius-function b/Lang/PowerShell/M-bius-function new file mode 120000 index 0000000000..a50c276864 --- /dev/null +++ b/Lang/PowerShell/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Mayan-numerals b/Lang/PowerShell/Mayan-numerals new file mode 120000 index 0000000000..24e3ef5efb --- /dev/null +++ b/Lang/PowerShell/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Multifactorial b/Lang/PowerShell/Multifactorial new file mode 120000 index 0000000000..45d4ca2539 --- /dev/null +++ b/Lang/PowerShell/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Periodic-table b/Lang/PowerShell/Periodic-table new file mode 120000 index 0000000000..bcfd7f5cf0 --- /dev/null +++ b/Lang/PowerShell/Periodic-table @@ -0,0 +1 @@ +../../Task/Periodic-table/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Quaternion-type b/Lang/PowerShell/Quaternion-type deleted file mode 120000 index 60f8156bec..0000000000 --- a/Lang/PowerShell/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Statistics-Basic b/Lang/PowerShell/Statistics-Basic new file mode 120000 index 0000000000..604034a29d --- /dev/null +++ b/Lang/PowerShell/Statistics-Basic @@ -0,0 +1 @@ +../../Task/Statistics-Basic/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Statistics-Normal-distribution b/Lang/PowerShell/Statistics-Normal-distribution new file mode 120000 index 0000000000..9ce69e4094 --- /dev/null +++ b/Lang/PowerShell/Statistics-Normal-distribution @@ -0,0 +1 @@ +../../Task/Statistics-Normal-distribution/PowerShell \ No newline at end of file diff --git a/Lang/PowerShell/Strassens-algorithm b/Lang/PowerShell/Strassens-algorithm new file mode 120000 index 0000000000..1b221ce844 --- /dev/null +++ b/Lang/PowerShell/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/PowerShell \ No newline at end of file diff --git a/Lang/ProDOS/00-LANG.txt b/Lang/ProDOS/00-LANG.txt index 3affb9c53a..d4852ff3b2 100644 --- a/Lang/ProDOS/00-LANG.txt +++ b/Lang/ProDOS/00-LANG.txt @@ -4,18 +4,18 @@ ProDOS is an open-source command-based programming language created by Riley Hou ===Overview=== ProDOS is a command-based language. This term refers to any form of language that uses built-in commands to function, instead of strings of keywords to function. For example: -printline Hello, World! +printline Hello, World! The command "printline" is used to display the line "Hello, World". For clarification, in Java the alternative would be: -public class HelloWorld +public class HelloWorld { public static void main(String[] args) { System.out.println("Goodbye, World!"); } -} +}
    -As you can see, the difference is quite significant. The command "printline" is pre-defined, this means that the user does not have to define classes,etc. +As you can see, the difference is quite significant. The command "printline" is pre-defined, this means that the user does not have to define classes,etc. ===Future Implementations=== ProDOS has not yet reached a release stage, but due to it being only a few months left until it is able to be released, ProDOS 1 will be ready to be released for public distribution by early 2012. \ No newline at end of file diff --git a/Lang/Prog8/00-LANG.txt b/Lang/Prog8/00-LANG.txt new file mode 100644 index 0000000000..1d713f3af5 --- /dev/null +++ b/Lang/Prog8/00-LANG.txt @@ -0,0 +1,11 @@ +{{language +|exec=compiled +|tags=prog8 +}} +'''Prog8''' is a modern compiled programming language targeting computers based on the MOS 6502 family of CPUs. The compiler and standard library have support for the Atari 8-bit family (6502), Commodore 64 (6510) and 128 (8502), and the Commander X-16 (65c02). It's a relatively low-level language in the same niche as C, but specifically designed for the 8-bit architecture of its target systems. + +==Links== +* [https://prog8.readthedocs.io Documentation] +* [https://github.com/irmen/prog8 Github source] + +{{language programming paradigm|Procedural}} \ No newline at end of file diff --git a/Lang/Prog8/00-META.yaml b/Lang/Prog8/00-META.yaml new file mode 100644 index 0000000000..288f396ee5 --- /dev/null +++ b/Lang/Prog8/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Prog8 diff --git a/Lang/Prog8/Quine b/Lang/Prog8/Quine new file mode 120000 index 0000000000..d19dfe3196 --- /dev/null +++ b/Lang/Prog8/Quine @@ -0,0 +1 @@ +../../Task/Quine/Prog8 \ No newline at end of file diff --git a/Lang/Prog8/The-Twelve-Days-of-Christmas b/Lang/Prog8/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..358b85327a --- /dev/null +++ b/Lang/Prog8/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/Prog8 \ No newline at end of file diff --git a/Lang/ProgressBASIC/00-LANG.txt b/Lang/ProgressBASIC/00-LANG.txt new file mode 100644 index 0000000000..d243dbaa3d --- /dev/null +++ b/Lang/ProgressBASIC/00-LANG.txt @@ -0,0 +1,3 @@ +{{language}} +ProgressBASIC is a BASIC-like programming language used in the mobile/steam game Progressbar95. To get acses to the programming language. You must unlock the 8-bit category of systems. +To understand how this programming language works, [https://progressbar95.fandom.com/wiki/ProgressBASIC#Commands click this] \ No newline at end of file diff --git a/Lang/ProgressBASIC/00-META.yaml b/Lang/ProgressBASIC/00-META.yaml new file mode 100644 index 0000000000..82857e2590 --- /dev/null +++ b/Lang/ProgressBASIC/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:ProgressBASIC diff --git a/Lang/Prolog/100-prisoners b/Lang/Prolog/100-prisoners new file mode 120000 index 0000000000..f105600099 --- /dev/null +++ b/Lang/Prolog/100-prisoners @@ -0,0 +1 @@ +../../Task/100-prisoners/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Ascending-primes b/Lang/Prolog/Ascending-primes new file mode 120000 index 0000000000..80d5881c3e --- /dev/null +++ b/Lang/Prolog/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Boolean-values b/Lang/Prolog/Boolean-values new file mode 120000 index 0000000000..a4d04329bd --- /dev/null +++ b/Lang/Prolog/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Create-a-two-dimensional-array-at-runtime b/Lang/Prolog/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..a7d118e957 --- /dev/null +++ b/Lang/Prolog/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Damm-algorithm b/Lang/Prolog/Damm-algorithm new file mode 120000 index 0000000000..beadc26281 --- /dev/null +++ b/Lang/Prolog/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Descending-primes b/Lang/Prolog/Descending-primes new file mode 120000 index 0000000000..2841773f73 --- /dev/null +++ b/Lang/Prolog/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Determine-sentence-type b/Lang/Prolog/Determine-sentence-type new file mode 120000 index 0000000000..d87bf5b582 --- /dev/null +++ b/Lang/Prolog/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Evaluate-binomial-coefficients b/Lang/Prolog/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..15602e690b --- /dev/null +++ b/Lang/Prolog/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Generate-Chess960-starting-position b/Lang/Prolog/Generate-Chess960-starting-position new file mode 120000 index 0000000000..7c664672ab --- /dev/null +++ b/Lang/Prolog/Generate-Chess960-starting-position @@ -0,0 +1 @@ +../../Task/Generate-Chess960-starting-position/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Hello-world-Newline-omission b/Lang/Prolog/Hello-world-Newline-omission new file mode 120000 index 0000000000..c1a7a16c3a --- /dev/null +++ b/Lang/Prolog/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Prolog \ No newline at end of file diff --git a/Lang/Prolog/ISBN13-check-digit b/Lang/Prolog/ISBN13-check-digit new file mode 120000 index 0000000000..a76610ede1 --- /dev/null +++ b/Lang/Prolog/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Integer-comparison b/Lang/Prolog/Integer-comparison new file mode 120000 index 0000000000..700709dfc3 --- /dev/null +++ b/Lang/Prolog/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Iterated-digits-squaring b/Lang/Prolog/Iterated-digits-squaring new file mode 120000 index 0000000000..2783b6cb96 --- /dev/null +++ b/Lang/Prolog/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Josephus-problem b/Lang/Prolog/Josephus-problem new file mode 120000 index 0000000000..f88549c05c --- /dev/null +++ b/Lang/Prolog/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Magic-8-ball b/Lang/Prolog/Magic-8-ball new file mode 120000 index 0000000000..6daea6349e --- /dev/null +++ b/Lang/Prolog/Magic-8-ball @@ -0,0 +1 @@ +../../Task/Magic-8-ball/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Map-range b/Lang/Prolog/Map-range new file mode 120000 index 0000000000..09c2135423 --- /dev/null +++ b/Lang/Prolog/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Miller-Rabin-primality-test b/Lang/Prolog/Miller-Rabin-primality-test deleted file mode 120000 index 77f0bc56fd..0000000000 --- a/Lang/Prolog/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Old-Russian-measure-of-length b/Lang/Prolog/Old-Russian-measure-of-length new file mode 120000 index 0000000000..d1594e7647 --- /dev/null +++ b/Lang/Prolog/Old-Russian-measure-of-length @@ -0,0 +1 @@ +../../Task/Old-Russian-measure-of-length/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Order-by-pair-comparisons b/Lang/Prolog/Order-by-pair-comparisons new file mode 120000 index 0000000000..b08bc67036 --- /dev/null +++ b/Lang/Prolog/Order-by-pair-comparisons @@ -0,0 +1 @@ +../../Task/Order-by-pair-comparisons/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Parametric-polymorphism b/Lang/Prolog/Parametric-polymorphism new file mode 120000 index 0000000000..0881341d8c --- /dev/null +++ b/Lang/Prolog/Parametric-polymorphism @@ -0,0 +1 @@ +../../Task/Parametric-polymorphism/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Phrase-reversals b/Lang/Prolog/Phrase-reversals new file mode 120000 index 0000000000..1afa8eb5f5 --- /dev/null +++ b/Lang/Prolog/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Population-count b/Lang/Prolog/Population-count new file mode 120000 index 0000000000..1ffa420c15 --- /dev/null +++ b/Lang/Prolog/Population-count @@ -0,0 +1 @@ +../../Task/Population-count/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Quaternion-type b/Lang/Prolog/Quaternion-type deleted file mode 120000 index 458f5f70bc..0000000000 --- a/Lang/Prolog/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Prolog \ No newline at end of file diff --git a/Lang/Prolog/RPG-attributes-generator b/Lang/Prolog/RPG-attributes-generator new file mode 120000 index 0000000000..cde5e146a7 --- /dev/null +++ b/Lang/Prolog/RPG-attributes-generator @@ -0,0 +1 @@ +../../Task/RPG-attributes-generator/Prolog \ No newline at end of file diff --git a/Lang/Prolog/SEDOLs b/Lang/Prolog/SEDOLs new file mode 120000 index 0000000000..21d9643112 --- /dev/null +++ b/Lang/Prolog/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Semordnilap b/Lang/Prolog/Semordnilap new file mode 120000 index 0000000000..c4e2d18fc4 --- /dev/null +++ b/Lang/Prolog/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Sort-three-variables b/Lang/Prolog/Sort-three-variables new file mode 120000 index 0000000000..8518a9819c --- /dev/null +++ b/Lang/Prolog/Sort-three-variables @@ -0,0 +1 @@ +../../Task/Sort-three-variables/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Stem-and-leaf-plot b/Lang/Prolog/Stem-and-leaf-plot new file mode 120000 index 0000000000..8a3d5cbab0 --- /dev/null +++ b/Lang/Prolog/Stem-and-leaf-plot @@ -0,0 +1 @@ +../../Task/Stem-and-leaf-plot/Prolog \ No newline at end of file diff --git a/Lang/Prolog/String-concatenation b/Lang/Prolog/String-concatenation new file mode 120000 index 0000000000..47d572fb22 --- /dev/null +++ b/Lang/Prolog/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Tau-number b/Lang/Prolog/Tau-number new file mode 120000 index 0000000000..eef1b9b3ad --- /dev/null +++ b/Lang/Prolog/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Temperature-conversion b/Lang/Prolog/Temperature-conversion new file mode 120000 index 0000000000..d90353ad2a --- /dev/null +++ b/Lang/Prolog/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Thue-Morse b/Lang/Prolog/Thue-Morse new file mode 120000 index 0000000000..c42ff58a18 --- /dev/null +++ b/Lang/Prolog/Thue-Morse @@ -0,0 +1 @@ +../../Task/Thue-Morse/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Topswops b/Lang/Prolog/Topswops new file mode 120000 index 0000000000..20c5cfbba8 --- /dev/null +++ b/Lang/Prolog/Topswops @@ -0,0 +1 @@ +../../Task/Topswops/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Trabb-Pardo-Knuth-algorithm b/Lang/Prolog/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..dcd294e9ea --- /dev/null +++ b/Lang/Prolog/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Twos-complement b/Lang/Prolog/Twos-complement new file mode 120000 index 0000000000..1ba2d1e131 --- /dev/null +++ b/Lang/Prolog/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Wireworld b/Lang/Prolog/Wireworld new file mode 120000 index 0000000000..b45eaa2601 --- /dev/null +++ b/Lang/Prolog/Wireworld @@ -0,0 +1 @@ +../../Task/Wireworld/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Zero-to-the-zero-power b/Lang/Prolog/Zero-to-the-zero-power new file mode 120000 index 0000000000..5d3d1cb814 --- /dev/null +++ b/Lang/Prolog/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/Prolog \ No newline at end of file diff --git a/Lang/PureBasic/21-game b/Lang/PureBasic/21-game new file mode 120000 index 0000000000..25d4ecce76 --- /dev/null +++ b/Lang/PureBasic/21-game @@ -0,0 +1 @@ +../../Task/21-game/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/ASCII-art-diagram-converter b/Lang/PureBasic/ASCII-art-diagram-converter new file mode 120000 index 0000000000..33f4c7eea5 --- /dev/null +++ b/Lang/PureBasic/ASCII-art-diagram-converter @@ -0,0 +1 @@ +../../Task/ASCII-art-diagram-converter/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Bioinformatics-base-count b/Lang/PureBasic/Bioinformatics-base-count deleted file mode 120000 index 16be5f27be..0000000000 --- a/Lang/PureBasic/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Blum-integer b/Lang/PureBasic/Blum-integer new file mode 120000 index 0000000000..d3f0a3d564 --- /dev/null +++ b/Lang/PureBasic/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Casting-out-nines b/Lang/PureBasic/Casting-out-nines new file mode 120000 index 0000000000..80d3cd3de2 --- /dev/null +++ b/Lang/PureBasic/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Determine-if-a-string-has-all-the-same-characters b/Lang/PureBasic/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..8ce6b940bc --- /dev/null +++ b/Lang/PureBasic/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Determine-if-a-string-has-all-unique-characters b/Lang/PureBasic/Determine-if-a-string-has-all-unique-characters new file mode 120000 index 0000000000..317b8c1e43 --- /dev/null +++ b/Lang/PureBasic/Determine-if-a-string-has-all-unique-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-unique-characters/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Determine-sentence-type b/Lang/PureBasic/Determine-sentence-type new file mode 120000 index 0000000000..58f4c9411b --- /dev/null +++ b/Lang/PureBasic/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Equal-prime-and-composite-sums b/Lang/PureBasic/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..3ab6fbad07 --- /dev/null +++ b/Lang/PureBasic/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Factorial-primes b/Lang/PureBasic/Factorial-primes new file mode 120000 index 0000000000..070b58c3e7 --- /dev/null +++ b/Lang/PureBasic/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Generate-Chess960-starting-position b/Lang/PureBasic/Generate-Chess960-starting-position new file mode 120000 index 0000000000..d1a0ea8b2a --- /dev/null +++ b/Lang/PureBasic/Generate-Chess960-starting-position @@ -0,0 +1 @@ +../../Task/Generate-Chess960-starting-position/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Jewels-and-stones b/Lang/PureBasic/Jewels-and-stones new file mode 120000 index 0000000000..90d847c8e7 --- /dev/null +++ b/Lang/PureBasic/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/M-bius-function b/Lang/PureBasic/M-bius-function new file mode 120000 index 0000000000..86603635cf --- /dev/null +++ b/Lang/PureBasic/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Meissel-Mertens-constant b/Lang/PureBasic/Meissel-Mertens-constant deleted file mode 120000 index 81f0bd26b3..0000000000 --- a/Lang/PureBasic/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Miller-Rabin-primality-test b/Lang/PureBasic/Miller-Rabin-primality-test deleted file mode 120000 index af69162304..0000000000 --- a/Lang/PureBasic/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Numerical-and-alphabetical-suffixes b/Lang/PureBasic/Numerical-and-alphabetical-suffixes new file mode 120000 index 0000000000..1544fa8d4a --- /dev/null +++ b/Lang/PureBasic/Numerical-and-alphabetical-suffixes @@ -0,0 +1 @@ +../../Task/Numerical-and-alphabetical-suffixes/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Padovan-n-step-number-sequences b/Lang/PureBasic/Padovan-n-step-number-sequences new file mode 120000 index 0000000000..b9dc553ac6 --- /dev/null +++ b/Lang/PureBasic/Padovan-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Padovan-n-step-number-sequences/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Periodic-table b/Lang/PureBasic/Periodic-table new file mode 120000 index 0000000000..d212a3056c --- /dev/null +++ b/Lang/PureBasic/Periodic-table @@ -0,0 +1 @@ +../../Task/Periodic-table/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Pragmatic-directives b/Lang/PureBasic/Pragmatic-directives new file mode 120000 index 0000000000..3e7f08d0fc --- /dev/null +++ b/Lang/PureBasic/Pragmatic-directives @@ -0,0 +1 @@ +../../Task/Pragmatic-directives/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Quaternion-type b/Lang/PureBasic/Quaternion-type deleted file mode 120000 index 6551ed8e89..0000000000 --- a/Lang/PureBasic/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors b/Lang/PureBasic/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors new file mode 120000 index 0000000000..a2d1f36259 --- /dev/null +++ b/Lang/PureBasic/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Sequence:-smallest-number-with-exactly-n-divisors b/Lang/PureBasic/Sequence:-smallest-number-with-exactly-n-divisors new file mode 120000 index 0000000000..f415c741d2 --- /dev/null +++ b/Lang/PureBasic/Sequence:-smallest-number-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-with-exactly-n-divisors/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Set-consolidation b/Lang/PureBasic/Set-consolidation new file mode 120000 index 0000000000..eeb6e5b6c9 --- /dev/null +++ b/Lang/PureBasic/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Set-right-adjacent-bits b/Lang/PureBasic/Set-right-adjacent-bits new file mode 120000 index 0000000000..1d7dd8f566 --- /dev/null +++ b/Lang/PureBasic/Set-right-adjacent-bits @@ -0,0 +1 @@ +../../Task/Set-right-adjacent-bits/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Sphenic-numbers b/Lang/PureBasic/Sphenic-numbers new file mode 120000 index 0000000000..5ff07480cd --- /dev/null +++ b/Lang/PureBasic/Sphenic-numbers @@ -0,0 +1 @@ +../../Task/Sphenic-numbers/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/The-Name-Game b/Lang/PureBasic/The-Name-Game new file mode 120000 index 0000000000..50ae0fd1b6 --- /dev/null +++ b/Lang/PureBasic/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Twos-complement b/Lang/PureBasic/Twos-complement new file mode 120000 index 0000000000..dfe56459f4 --- /dev/null +++ b/Lang/PureBasic/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/PureBasic \ No newline at end of file diff --git a/Lang/PureBasic/Van-Eck-sequence b/Lang/PureBasic/Van-Eck-sequence new file mode 120000 index 0000000000..5f70e418c5 --- /dev/null +++ b/Lang/PureBasic/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/PureBasic \ No newline at end of file diff --git a/Lang/Python/Bioinformatics-base-count b/Lang/Python/Bioinformatics-base-count deleted file mode 120000 index 7f8a0873e8..0000000000 --- a/Lang/Python/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Python \ No newline at end of file diff --git a/Lang/Python/Compile-time-calculation b/Lang/Python/Compile-time-calculation new file mode 120000 index 0000000000..33879ac69d --- /dev/null +++ b/Lang/Python/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/Python \ No newline at end of file diff --git a/Lang/Python/Constrained-genericity b/Lang/Python/Constrained-genericity new file mode 120000 index 0000000000..3ac238c57a --- /dev/null +++ b/Lang/Python/Constrained-genericity @@ -0,0 +1 @@ +../../Task/Constrained-genericity/Python \ No newline at end of file diff --git a/Lang/Python/Dominoes b/Lang/Python/Dominoes new file mode 120000 index 0000000000..648f074afc --- /dev/null +++ b/Lang/Python/Dominoes @@ -0,0 +1 @@ +../../Task/Dominoes/Python \ No newline at end of file diff --git a/Lang/Python/Equal-prime-and-composite-sums b/Lang/Python/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..85cb0d4944 --- /dev/null +++ b/Lang/Python/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/Python \ No newline at end of file diff --git a/Lang/Python/Erd-s-Nicolas-numbers b/Lang/Python/Erd-s-Nicolas-numbers new file mode 120000 index 0000000000..c04d09ae0e --- /dev/null +++ b/Lang/Python/Erd-s-Nicolas-numbers @@ -0,0 +1 @@ +../../Task/Erd-s-Nicolas-numbers/Python \ No newline at end of file diff --git a/Lang/Python/Erd-s-Selfridge-categorization-of-primes b/Lang/Python/Erd-s-Selfridge-categorization-of-primes new file mode 120000 index 0000000000..fd2fdbcb3f --- /dev/null +++ b/Lang/Python/Erd-s-Selfridge-categorization-of-primes @@ -0,0 +1 @@ +../../Task/Erd-s-Selfridge-categorization-of-primes/Python \ No newline at end of file diff --git a/Lang/Python/Execute-Brain- b/Lang/Python/Execute-Brain- new file mode 120000 index 0000000000..ad83d880d6 --- /dev/null +++ b/Lang/Python/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/Python \ No newline at end of file diff --git a/Lang/Python/Home-primes b/Lang/Python/Home-primes new file mode 120000 index 0000000000..f7be54d4fc --- /dev/null +++ b/Lang/Python/Home-primes @@ -0,0 +1 @@ +../../Task/Home-primes/Python \ No newline at end of file diff --git a/Lang/Python/Im-a-software-engineer-get-me-out-of-here b/Lang/Python/Im-a-software-engineer-get-me-out-of-here new file mode 120000 index 0000000000..d238ff00d2 --- /dev/null +++ b/Lang/Python/Im-a-software-engineer-get-me-out-of-here @@ -0,0 +1 @@ +../../Task/Im-a-software-engineer-get-me-out-of-here/Python \ No newline at end of file diff --git a/Lang/Python/Isograms-and-heterograms b/Lang/Python/Isograms-and-heterograms new file mode 120000 index 0000000000..f277330152 --- /dev/null +++ b/Lang/Python/Isograms-and-heterograms @@ -0,0 +1 @@ +../../Task/Isograms-and-heterograms/Python \ No newline at end of file diff --git a/Lang/Python/Jordan-P-lya-numbers b/Lang/Python/Jordan-P-lya-numbers new file mode 120000 index 0000000000..72646172bd --- /dev/null +++ b/Lang/Python/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Python \ No newline at end of file diff --git a/Lang/Python/Meissel-Mertens-constant b/Lang/Python/Meissel-Mertens-constant deleted file mode 120000 index 04fd530b92..0000000000 --- a/Lang/Python/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Python \ No newline at end of file diff --git a/Lang/Python/Miller-Rabin-primality-test b/Lang/Python/Miller-Rabin-primality-test deleted file mode 120000 index 4ec507954a..0000000000 --- a/Lang/Python/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Python \ No newline at end of file diff --git a/Lang/Python/Multi-base-primes b/Lang/Python/Multi-base-primes new file mode 120000 index 0000000000..6190bc944f --- /dev/null +++ b/Lang/Python/Multi-base-primes @@ -0,0 +1 @@ +../../Task/Multi-base-primes/Python \ No newline at end of file diff --git a/Lang/Python/Numbers-which-are-not-the-sum-of-distinct-squares b/Lang/Python/Numbers-which-are-not-the-sum-of-distinct-squares new file mode 120000 index 0000000000..3a47a71cf2 --- /dev/null +++ b/Lang/Python/Numbers-which-are-not-the-sum-of-distinct-squares @@ -0,0 +1 @@ +../../Task/Numbers-which-are-not-the-sum-of-distinct-squares/Python \ No newline at end of file diff --git a/Lang/Python/P-Adic-square-roots b/Lang/Python/P-Adic-square-roots new file mode 120000 index 0000000000..3ecdf0d3ca --- /dev/null +++ b/Lang/Python/P-Adic-square-roots @@ -0,0 +1 @@ +../../Task/P-Adic-square-roots/Python \ No newline at end of file diff --git a/Lang/Python/Parametric-polymorphism b/Lang/Python/Parametric-polymorphism new file mode 120000 index 0000000000..b6d5668cdf --- /dev/null +++ b/Lang/Python/Parametric-polymorphism @@ -0,0 +1 @@ +../../Task/Parametric-polymorphism/Python \ No newline at end of file diff --git a/Lang/Python/Particle-fountain b/Lang/Python/Particle-fountain new file mode 120000 index 0000000000..0ce2df8e30 --- /dev/null +++ b/Lang/Python/Particle-fountain @@ -0,0 +1 @@ +../../Task/Particle-fountain/Python \ No newline at end of file diff --git a/Lang/Python/Pell-numbers b/Lang/Python/Pell-numbers new file mode 120000 index 0000000000..445be304a8 --- /dev/null +++ b/Lang/Python/Pell-numbers @@ -0,0 +1 @@ +../../Task/Pell-numbers/Python \ No newline at end of file diff --git a/Lang/Python/Peripheral-drift-illusion b/Lang/Python/Peripheral-drift-illusion new file mode 120000 index 0000000000..4e0e7d7c77 --- /dev/null +++ b/Lang/Python/Peripheral-drift-illusion @@ -0,0 +1 @@ +../../Task/Peripheral-drift-illusion/Python \ No newline at end of file diff --git a/Lang/Python/Prime-numbers-whose-neighboring-pairs-are-tetraprimes b/Lang/Python/Prime-numbers-whose-neighboring-pairs-are-tetraprimes new file mode 120000 index 0000000000..9997b73880 --- /dev/null +++ b/Lang/Python/Prime-numbers-whose-neighboring-pairs-are-tetraprimes @@ -0,0 +1 @@ +../../Task/Prime-numbers-whose-neighboring-pairs-are-tetraprimes/Python \ No newline at end of file diff --git a/Lang/Python/Quaternion-type b/Lang/Python/Quaternion-type deleted file mode 120000 index 4219e34b85..0000000000 --- a/Lang/Python/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Python \ No newline at end of file diff --git a/Lang/Python/Radical-of-an-integer b/Lang/Python/Radical-of-an-integer new file mode 120000 index 0000000000..40dac65e59 --- /dev/null +++ b/Lang/Python/Radical-of-an-integer @@ -0,0 +1 @@ +../../Task/Radical-of-an-integer/Python \ No newline at end of file diff --git a/Lang/Python/Ramanujan-primes-twins b/Lang/Python/Ramanujan-primes-twins new file mode 120000 index 0000000000..8b76bc210b --- /dev/null +++ b/Lang/Python/Ramanujan-primes-twins @@ -0,0 +1 @@ +../../Task/Ramanujan-primes-twins/Python \ No newline at end of file diff --git a/Lang/Python/Rhonda-numbers b/Lang/Python/Rhonda-numbers new file mode 120000 index 0000000000..26cc73526d --- /dev/null +++ b/Lang/Python/Rhonda-numbers @@ -0,0 +1 @@ +../../Task/Rhonda-numbers/Python \ No newline at end of file diff --git a/Lang/Python/Ruth-Aaron-numbers b/Lang/Python/Ruth-Aaron-numbers new file mode 120000 index 0000000000..933b3d03bc --- /dev/null +++ b/Lang/Python/Ruth-Aaron-numbers @@ -0,0 +1 @@ +../../Task/Ruth-Aaron-numbers/Python \ No newline at end of file diff --git a/Lang/Python/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k b/Lang/Python/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k new file mode 120000 index 0000000000..14aee87ec7 --- /dev/null +++ b/Lang/Python/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k @@ -0,0 +1 @@ +../../Task/Smallest-number-k-such-that-k+2^m-is-composite-for-all-m-less-than-k/Python \ No newline at end of file diff --git a/Lang/Python/Smarandache-Wellin-primes b/Lang/Python/Smarandache-Wellin-primes new file mode 120000 index 0000000000..87eea97b5c --- /dev/null +++ b/Lang/Python/Smarandache-Wellin-primes @@ -0,0 +1 @@ +../../Task/Smarandache-Wellin-primes/Python \ No newline at end of file diff --git a/Lang/Python/Sorting-Algorithms-Circle-Sort b/Lang/Python/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 3e7a80b339..0000000000 --- a/Lang/Python/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Python \ No newline at end of file diff --git a/Lang/Python/Square-form-factorization b/Lang/Python/Square-form-factorization new file mode 120000 index 0000000000..38da301a59 --- /dev/null +++ b/Lang/Python/Square-form-factorization @@ -0,0 +1 @@ +../../Task/Square-form-factorization/Python \ No newline at end of file diff --git a/Lang/Python/Start-from-a-main-routine b/Lang/Python/Start-from-a-main-routine new file mode 120000 index 0000000000..e9c472aaa4 --- /dev/null +++ b/Lang/Python/Start-from-a-main-routine @@ -0,0 +1 @@ +../../Task/Start-from-a-main-routine/Python \ No newline at end of file diff --git a/Lang/Python/Transliterate-English-text-using-the-Greek-alphabet b/Lang/Python/Transliterate-English-text-using-the-Greek-alphabet new file mode 120000 index 0000000000..ca70885140 --- /dev/null +++ b/Lang/Python/Transliterate-English-text-using-the-Greek-alphabet @@ -0,0 +1 @@ +../../Task/Transliterate-English-text-using-the-Greek-alphabet/Python \ No newline at end of file diff --git a/Lang/Python/Untouchable-numbers b/Lang/Python/Untouchable-numbers new file mode 120000 index 0000000000..c4bd0ba9e1 --- /dev/null +++ b/Lang/Python/Untouchable-numbers @@ -0,0 +1 @@ +../../Task/Untouchable-numbers/Python \ No newline at end of file diff --git a/Lang/Python/Wasteful-equidigital-and-frugal-numbers b/Lang/Python/Wasteful-equidigital-and-frugal-numbers new file mode 120000 index 0000000000..c89de12312 --- /dev/null +++ b/Lang/Python/Wasteful-equidigital-and-frugal-numbers @@ -0,0 +1 @@ +../../Task/Wasteful-equidigital-and-frugal-numbers/Python \ No newline at end of file diff --git a/Lang/Q/00-LANG.txt b/Lang/Q/00-LANG.txt index 761de14eda..1cf9ed3990 100644 --- a/Lang/Q/00-LANG.txt +++ b/Lang/Q/00-LANG.txt @@ -1,5 +1,6 @@ -{{language}}Q is another vector language (in the family of [[APL]] [[J]] [[K]] and [[Nial]]) +{{language}} +Q is another vector language (in the family of [[APL]], [[J]], [[K]], and [[Nial]]) -There is a totally unrelated language called Q [http://q-lang.sourceforge.net/ here]. (It is an equational programming language) +There is a totally unrelated language called Q [http://q-lang.sourceforge.net/ here]. (It is an equational programming language.) -Q [https://code.kx.com/trac/wiki/QforMortals docs](anonymous/anonymous) \ No newline at end of file +Documentation: [https://code.kx.com/q4m3/ Q for Mortals] An introduction to q programming \ No newline at end of file diff --git a/Lang/Q/Euler-method b/Lang/Q/Euler-method new file mode 120000 index 0000000000..093ad80e13 --- /dev/null +++ b/Lang/Q/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Q \ No newline at end of file diff --git a/Lang/QB64/Averages-Mean-angle b/Lang/QB64/Averages-Mean-angle new file mode 120000 index 0000000000..aab53ced3a --- /dev/null +++ b/Lang/QB64/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/QB64 \ No newline at end of file diff --git a/Lang/QB64/Blum-integer b/Lang/QB64/Blum-integer new file mode 120000 index 0000000000..6d55cd1ae1 --- /dev/null +++ b/Lang/QB64/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/QB64 \ No newline at end of file diff --git a/Lang/QB64/Determine-if-a-string-has-all-the-same-characters b/Lang/QB64/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..e5cb75941f --- /dev/null +++ b/Lang/QB64/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/QB64 \ No newline at end of file diff --git a/Lang/QB64/Fibonacci-n-step-number-sequences b/Lang/QB64/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..dbe9d19cad --- /dev/null +++ b/Lang/QB64/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/QB64 \ No newline at end of file diff --git a/Lang/QB64/Hello-world-Newline-omission b/Lang/QB64/Hello-world-Newline-omission new file mode 120000 index 0000000000..355c4d1286 --- /dev/null +++ b/Lang/QB64/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/QB64 \ No newline at end of file diff --git a/Lang/QB64/Hofstadter-Q-sequence b/Lang/QB64/Hofstadter-Q-sequence new file mode 120000 index 0000000000..636c2bd5e2 --- /dev/null +++ b/Lang/QB64/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/QB64 \ No newline at end of file diff --git a/Lang/QB64/Intersecting-number-wheels b/Lang/QB64/Intersecting-number-wheels new file mode 120000 index 0000000000..226a608551 --- /dev/null +++ b/Lang/QB64/Intersecting-number-wheels @@ -0,0 +1 @@ +../../Task/Intersecting-number-wheels/QB64 \ No newline at end of file diff --git a/Lang/QB64/Mayan-calendar b/Lang/QB64/Mayan-calendar new file mode 120000 index 0000000000..13deaa3e8a --- /dev/null +++ b/Lang/QB64/Mayan-calendar @@ -0,0 +1 @@ +../../Task/Mayan-calendar/QB64 \ No newline at end of file diff --git a/Lang/QB64/Multiple-regression b/Lang/QB64/Multiple-regression new file mode 120000 index 0000000000..f5a655fb07 --- /dev/null +++ b/Lang/QB64/Multiple-regression @@ -0,0 +1 @@ +../../Task/Multiple-regression/QB64 \ No newline at end of file diff --git a/Lang/QB64/Perfect-numbers b/Lang/QB64/Perfect-numbers new file mode 120000 index 0000000000..313898bfff --- /dev/null +++ b/Lang/QB64/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/QB64 \ No newline at end of file diff --git a/Lang/QB64/Price-fraction b/Lang/QB64/Price-fraction new file mode 120000 index 0000000000..b2a7164220 --- /dev/null +++ b/Lang/QB64/Price-fraction @@ -0,0 +1 @@ +../../Task/Price-fraction/QB64 \ No newline at end of file diff --git a/Lang/QB64/Safe-primes-and-unsafe-primes b/Lang/QB64/Safe-primes-and-unsafe-primes new file mode 120000 index 0000000000..2fe9c13027 --- /dev/null +++ b/Lang/QB64/Safe-primes-and-unsafe-primes @@ -0,0 +1 @@ +../../Task/Safe-primes-and-unsafe-primes/QB64 \ No newline at end of file diff --git a/Lang/QB64/Sum-of-a-series b/Lang/QB64/Sum-of-a-series new file mode 120000 index 0000000000..67ad320160 --- /dev/null +++ b/Lang/QB64/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/QB64 \ No newline at end of file diff --git a/Lang/QB64/Tau-number b/Lang/QB64/Tau-number new file mode 120000 index 0000000000..0690f3645f --- /dev/null +++ b/Lang/QB64/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/QB64 \ No newline at end of file diff --git a/Lang/QB64/Trabb-Pardo-Knuth-algorithm b/Lang/QB64/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..bd61960412 --- /dev/null +++ b/Lang/QB64/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/QB64 \ No newline at end of file diff --git a/Lang/QB64/Twos-complement b/Lang/QB64/Twos-complement new file mode 120000 index 0000000000..fd393f8160 --- /dev/null +++ b/Lang/QB64/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/QB64 \ No newline at end of file diff --git a/Lang/QB64/Web-scraping b/Lang/QB64/Web-scraping new file mode 120000 index 0000000000..bdf604fdc3 --- /dev/null +++ b/Lang/QB64/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/QB64 \ No newline at end of file diff --git a/Lang/QBasic/00-LANG.txt b/Lang/QBasic/00-LANG.txt index 4ab26db45d..66c4f1d834 100644 --- a/Lang/QBasic/00-LANG.txt +++ b/Lang/QBasic/00-LANG.txt @@ -1,3 +1,4 @@ {{language}} +{{implementation|BASIC}} QBasic is a BASIC that was written by Microsoft and normally executes under Windows. \ No newline at end of file diff --git a/Lang/QBasic/15-puzzle-game b/Lang/QBasic/15-puzzle-game new file mode 120000 index 0000000000..4cdffaba3f --- /dev/null +++ b/Lang/QBasic/15-puzzle-game @@ -0,0 +1 @@ +../../Task/15-puzzle-game/QBasic \ No newline at end of file diff --git a/Lang/QBasic/21-game b/Lang/QBasic/21-game new file mode 120000 index 0000000000..1f117a71e8 --- /dev/null +++ b/Lang/QBasic/21-game @@ -0,0 +1 @@ +../../Task/21-game/QBasic \ No newline at end of file diff --git a/Lang/QBasic/ASCII-art-diagram-converter b/Lang/QBasic/ASCII-art-diagram-converter new file mode 120000 index 0000000000..75bc551903 --- /dev/null +++ b/Lang/QBasic/ASCII-art-diagram-converter @@ -0,0 +1 @@ +../../Task/ASCII-art-diagram-converter/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Associative-array-Merging b/Lang/QBasic/Associative-array-Merging new file mode 120000 index 0000000000..7cdfcc0848 --- /dev/null +++ b/Lang/QBasic/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Averages-Mean-angle b/Lang/QBasic/Averages-Mean-angle new file mode 120000 index 0000000000..499df28583 --- /dev/null +++ b/Lang/QBasic/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Cantor-set b/Lang/QBasic/Cantor-set new file mode 120000 index 0000000000..7b09b7a9af --- /dev/null +++ b/Lang/QBasic/Cantor-set @@ -0,0 +1 @@ +../../Task/Cantor-set/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Casting-out-nines b/Lang/QBasic/Casting-out-nines new file mode 120000 index 0000000000..caa06c9495 --- /dev/null +++ b/Lang/QBasic/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Determine-sentence-type b/Lang/QBasic/Determine-sentence-type new file mode 120000 index 0000000000..5f23645126 --- /dev/null +++ b/Lang/QBasic/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Display-a-linear-combination b/Lang/QBasic/Display-a-linear-combination new file mode 120000 index 0000000000..e9d158c960 --- /dev/null +++ b/Lang/QBasic/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Diversity-prediction-theorem b/Lang/QBasic/Diversity-prediction-theorem new file mode 120000 index 0000000000..01e16fde09 --- /dev/null +++ b/Lang/QBasic/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Euler-method b/Lang/QBasic/Euler-method new file mode 120000 index 0000000000..f825508a08 --- /dev/null +++ b/Lang/QBasic/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Evaluate-binomial-coefficients b/Lang/QBasic/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..86b00c5e75 --- /dev/null +++ b/Lang/QBasic/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Farey-sequence b/Lang/QBasic/Farey-sequence new file mode 120000 index 0000000000..5459587548 --- /dev/null +++ b/Lang/QBasic/Farey-sequence @@ -0,0 +1 @@ +../../Task/Farey-sequence/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Fibonacci-n-step-number-sequences b/Lang/QBasic/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..77136c7137 --- /dev/null +++ b/Lang/QBasic/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Horizontal-sundial-calculations b/Lang/QBasic/Horizontal-sundial-calculations new file mode 120000 index 0000000000..48a7ed5986 --- /dev/null +++ b/Lang/QBasic/Horizontal-sundial-calculations @@ -0,0 +1 @@ +../../Task/Horizontal-sundial-calculations/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Jensens-Device b/Lang/QBasic/Jensens-Device new file mode 120000 index 0000000000..199e4d7809 --- /dev/null +++ b/Lang/QBasic/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Leonardo-numbers b/Lang/QBasic/Leonardo-numbers new file mode 120000 index 0000000000..d0e3199c8a --- /dev/null +++ b/Lang/QBasic/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Longest-string-challenge b/Lang/QBasic/Longest-string-challenge new file mode 120000 index 0000000000..b81887f21d --- /dev/null +++ b/Lang/QBasic/Longest-string-challenge @@ -0,0 +1 @@ +../../Task/Longest-string-challenge/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Loops-Continue b/Lang/QBasic/Loops-Continue new file mode 120000 index 0000000000..eeea4ac585 --- /dev/null +++ b/Lang/QBasic/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Map-range b/Lang/QBasic/Map-range new file mode 120000 index 0000000000..be9705365d --- /dev/null +++ b/Lang/QBasic/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Nested-templated-data b/Lang/QBasic/Nested-templated-data new file mode 120000 index 0000000000..ddf5a87c1b --- /dev/null +++ b/Lang/QBasic/Nested-templated-data @@ -0,0 +1 @@ +../../Task/Nested-templated-data/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Numbers-with-equal-rises-and-falls b/Lang/QBasic/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..8e3ab8bbe9 --- /dev/null +++ b/Lang/QBasic/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/QBasic \ No newline at end of file diff --git a/Lang/QBasic/One-dimensional-cellular-automata b/Lang/QBasic/One-dimensional-cellular-automata new file mode 120000 index 0000000000..e8dd1ff8b5 --- /dev/null +++ b/Lang/QBasic/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Padovan-n-step-number-sequences b/Lang/QBasic/Padovan-n-step-number-sequences new file mode 120000 index 0000000000..cbcc6fa739 --- /dev/null +++ b/Lang/QBasic/Padovan-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Padovan-n-step-number-sequences/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Phrase-reversals b/Lang/QBasic/Phrase-reversals new file mode 120000 index 0000000000..7f3671bcb7 --- /dev/null +++ b/Lang/QBasic/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Pinstripe-Display b/Lang/QBasic/Pinstripe-Display new file mode 120000 index 0000000000..f245a0ccf2 --- /dev/null +++ b/Lang/QBasic/Pinstripe-Display @@ -0,0 +1 @@ +../../Task/Pinstripe-Display/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Ramer-Douglas-Peucker-line-simplification b/Lang/QBasic/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..574b7acaf0 --- /dev/null +++ b/Lang/QBasic/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Repeat-a-string b/Lang/QBasic/Repeat-a-string deleted file mode 120000 index 4c99978a73..0000000000 --- a/Lang/QBasic/Repeat-a-string +++ /dev/null @@ -1 +0,0 @@ -../../Task/Repeat-a-string/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Rot-13 b/Lang/QBasic/Rot-13 new file mode 120000 index 0000000000..8ebe820c50 --- /dev/null +++ b/Lang/QBasic/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors b/Lang/QBasic/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors new file mode 120000 index 0000000000..a14432943b --- /dev/null +++ b/Lang/QBasic/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Sequence:-smallest-number-with-exactly-n-divisors b/Lang/QBasic/Sequence:-smallest-number-with-exactly-n-divisors new file mode 120000 index 0000000000..93a8289260 --- /dev/null +++ b/Lang/QBasic/Sequence:-smallest-number-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-with-exactly-n-divisors/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Set-consolidation b/Lang/QBasic/Set-consolidation new file mode 120000 index 0000000000..e9a53bec54 --- /dev/null +++ b/Lang/QBasic/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Set-right-adjacent-bits b/Lang/QBasic/Set-right-adjacent-bits new file mode 120000 index 0000000000..47394b478d --- /dev/null +++ b/Lang/QBasic/Set-right-adjacent-bits @@ -0,0 +1 @@ +../../Task/Set-right-adjacent-bits/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Sorting-algorithms-Gnome-sort b/Lang/QBasic/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..739e5b845e --- /dev/null +++ b/Lang/QBasic/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Soundex b/Lang/QBasic/Soundex new file mode 120000 index 0000000000..2d904fe964 --- /dev/null +++ b/Lang/QBasic/Soundex @@ -0,0 +1 @@ +../../Task/Soundex/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Split-a-character-string-based-on-change-of-character b/Lang/QBasic/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..5e5ffa8a44 --- /dev/null +++ b/Lang/QBasic/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Statistics-Normal-distribution b/Lang/QBasic/Statistics-Normal-distribution new file mode 120000 index 0000000000..9e5e8f24f2 --- /dev/null +++ b/Lang/QBasic/Statistics-Normal-distribution @@ -0,0 +1 @@ +../../Task/Statistics-Normal-distribution/QBasic \ No newline at end of file diff --git a/Lang/QBasic/The-Name-Game b/Lang/QBasic/The-Name-Game new file mode 120000 index 0000000000..f7f2e9b30b --- /dev/null +++ b/Lang/QBasic/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Van-Eck-sequence b/Lang/QBasic/Van-Eck-sequence new file mode 120000 index 0000000000..37756db6e5 --- /dev/null +++ b/Lang/QBasic/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/QBasic \ No newline at end of file diff --git a/Lang/QBasic/Vector b/Lang/QBasic/Vector new file mode 120000 index 0000000000..7bbf551f69 --- /dev/null +++ b/Lang/QBasic/Vector @@ -0,0 +1 @@ +../../Task/Vector/QBasic \ No newline at end of file diff --git a/Lang/Quackery/00-LANG.txt b/Lang/Quackery/00-LANG.txt index 498188387d..b70d597b46 100644 --- a/Lang/Quackery/00-LANG.txt +++ b/Lang/Quackery/00-LANG.txt @@ -1,9 +1,9 @@ {{language|Quackery}} {{language programming paradigm|Concatenative}} {{language programming paradigm|Imperative}} -Quackery is an open-source, lightweight, entry-level concatenative language for educational and recreational programming. +Quackery is an open-source, lightweight, entry-level concatenative language for educational and recreational programming, and an extensible compiler for a hypothetical processor, the Quackery Engine. -It is coded as a Python 3 function in under 48k of Pythonscript, about half of which is a string of Quackery code. +It is coded as a Python 3 function in about 50k of Pythonscript, about half of which is a string of Quackery code. The Quackery GitHub repository, which includes the Quackery manual "The Book of Quackery" as a pdf, is at [https://github.com/GordonCharlton/Quackery github.com/GordonCharlton/Quackery]. @@ -19,7 +19,7 @@ To compile this definition of quackery, build takes a The words is, [, and ] are builders; they can be found in the builders dictionary, which extends the functionality of build beyond building a flat nest for do to evaluate. is takes the item that do most recently added to its output nest, and adds it to the names dictionary, along with the string that follows it, "quackery" as its name. The syntax of Quackery is; words and numbers are sequences of printable characters, separated by spaces and carriage returns unless a builder treats the text that follows it otherwise. The builder builds is equivalent to is for adding new words and behaviours to the builders dictionary. -Evaluation of a nest proceeds from left to right unless a control flow operator redirects it. done causes doto stop evaluating a nest and return to the nest that pointed to it immediately, rather than at the end of the nest. again restarts the evaluation of that nest, non-recursively. The word recurse does it recursively. if and iff conditionally (depending on the item on the top of the Quackery stack) skip over the next one and two items in the nest respectively. else skips over one item, unconditionally. As with the other provided control flow operators, these words are nests, not operators, that make use of the "meta-control flow" operators, which grant the behaviours described above to words that use them. (They modify items on the return stack, rather than acting on the Quackery engine's various pointers registers directly, so their changes are enacted upon exiting the nest that called them.) +Evaluation of a nest proceeds from left to right unless a control flow operator redirects it. done causes doto stop evaluating a nest and return to the nest that pointed to it immediately, rather than at the end of the nest. again restarts the evaluation of that nest, non-recursively. The word recurse does it recursively. if and iff conditionally (depending on the item on the top of the Quackery stack) skip over the next one and two items in the nest respectively. else skips over one item, unconditionally. As with the other provided control flow operators, these words are nests, not operators, that make use of the "meta-control flow" operators, which grant the behaviours described above to words that use them. (They modify items on the return stack, rather than acting on the Quackery engine's various registers directly, so their changes are enacted upon exiting the nest that called them.) There are no variables in Quackery. Instead, there are stack management words to rearrange the uppermost items on the Quackery stack as required, and nameable ancillary stacks that fulfil the roles of variables. @@ -27,8 +27,28 @@ Everything is code except when it is data. When do does a number, t Conceptually, the Quackery engine is a stack based processor which does not have direct access to physical memory but has a memory management co-processor that intermediates, that takes care of the nests and bignums, provides pointers to the Quackery engine CPU on request, and garbage collects continuously. -Quackery is not intended to be a super-fast enterprise-level language; it is intended as a fun programming project straight out of a textbook. (The textbook is included in the download.) +Quackery is not intended to be a super-fast enterprise-level language; it is intended as an exploration of a novel architecture, and a fun programming project straight out of a textbook. (The textbook is included in the download.) -If your language supports bignums, first-class functions and dynamic arrays of bignums, functions and dynamic arrays, and has automatic garbage collection, and if you can code depth-first traversal of a tree you can implement Quackery in your preferred language with reasonable ease, and modify it as you please. +Why not try your hand at one of the [[Tasks not implemented in Quackery]]. -Or try your hand at one of the [[Tasks not implemented in Quackery]]. \ No newline at end of file +== Selected Quackery Examples == + +Rosetta Code has hundreds of Quackery examples. Here’s a curated set that showcases some of Quackery's strengths: + +* [[99 bottles of beer#Quackery|99 bottles of beer]] Shows simple, readable control flow and output. +* [[Gosper's hack#Quackery|Gosper's hack]] A nifty one-liner. +* [[Temperature conversion#Quackery|Temperature conversion]] Co-operative brevity. +* [[Balanced brackets#Quackery|Balanced brackets]] Demonstrates natural stack use for classic problems. +* [[Loops/Increment loop index within loop body#Quackery|Increment loop index within loop body]] You want a loop that's indexed ''and'' indefinite? Here's how. +* [[Quine#Quackery|Quine]] Illustrates code-as-data and quotation handling. +* [[Bacon cipher#Quackery|Bacon cipher]] Highlights clear text manipulation with minimal code. +* [[Permutations#Quackery|Permutations]] Uses recursion and stack shuffling expressively. +* [[Sorting algorithms/Insertion sort#Quackery|Insertion sort]] Demonstrates some built-in higher-order functions. +* [[Higher-order functions#Quackery|Higher-order functions]] Defining and using fold, map, and filter. +* [[Conway's Game of Life#Quackery|Conway's Game of Life]] Handles structured simulation with clarity. +* [[Execute Brain****#Quackery|Brainf*** interpreter]] Demonstrates interpreter-building and extensibility. +* [[Dinesman's multiple-dwelling problem#Quackery|Dinesman's multiple-dwelling problem]] Crafting a Domain Specific Language. + +== The Task that Nearly Broke the Author == + +* [[Zeckendorf arithmetic#Quackery|Zeckendorf arithmetic]] Forget everything you thought you knew about arithmetic… \ No newline at end of file diff --git a/Lang/Quackery/4-rings-or-4-squares-puzzle b/Lang/Quackery/4-rings-or-4-squares-puzzle new file mode 120000 index 0000000000..786cc93b7f --- /dev/null +++ b/Lang/Quackery/4-rings-or-4-squares-puzzle @@ -0,0 +1 @@ +../../Task/4-rings-or-4-squares-puzzle/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Balanced-ternary b/Lang/Quackery/Balanced-ternary new file mode 120000 index 0000000000..c02c0b6483 --- /dev/null +++ b/Lang/Quackery/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Benfords-law b/Lang/Quackery/Benfords-law new file mode 120000 index 0000000000..83c8fdffec --- /dev/null +++ b/Lang/Quackery/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Bifid-cipher b/Lang/Quackery/Bifid-cipher new file mode 120000 index 0000000000..09f8c92cff --- /dev/null +++ b/Lang/Quackery/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Bin-given-limits b/Lang/Quackery/Bin-given-limits new file mode 120000 index 0000000000..4d4b6fb373 --- /dev/null +++ b/Lang/Quackery/Bin-given-limits @@ -0,0 +1 @@ +../../Task/Bin-given-limits/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Bioinformatics-base-count b/Lang/Quackery/Bioinformatics-base-count deleted file mode 120000 index 65cab8d1ed..0000000000 --- a/Lang/Quackery/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Bulls-and-cows b/Lang/Quackery/Bulls-and-cows new file mode 120000 index 0000000000..bced5948f3 --- /dev/null +++ b/Lang/Quackery/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Chowla-numbers b/Lang/Quackery/Chowla-numbers new file mode 120000 index 0000000000..017749c553 --- /dev/null +++ b/Lang/Quackery/Chowla-numbers @@ -0,0 +1 @@ +../../Task/Chowla-numbers/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Combinations-and-permutations b/Lang/Quackery/Combinations-and-permutations new file mode 120000 index 0000000000..fc6f331f4d --- /dev/null +++ b/Lang/Quackery/Combinations-and-permutations @@ -0,0 +1 @@ +../../Task/Combinations-and-permutations/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Conways-Game-of-Life b/Lang/Quackery/Conways-Game-of-Life new file mode 120000 index 0000000000..f6bf0f9619 --- /dev/null +++ b/Lang/Quackery/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Cuban-primes b/Lang/Quackery/Cuban-primes new file mode 120000 index 0000000000..8c512d4853 --- /dev/null +++ b/Lang/Quackery/Cuban-primes @@ -0,0 +1 @@ +../../Task/Cuban-primes/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Deal-cards-for-FreeCell b/Lang/Quackery/Deal-cards-for-FreeCell new file mode 120000 index 0000000000..57f106f92f --- /dev/null +++ b/Lang/Quackery/Deal-cards-for-FreeCell @@ -0,0 +1 @@ +../../Task/Deal-cards-for-FreeCell/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Determine-if-a-string-has-all-unique-characters b/Lang/Quackery/Determine-if-a-string-has-all-unique-characters new file mode 120000 index 0000000000..213c79a0dc --- /dev/null +++ b/Lang/Quackery/Determine-if-a-string-has-all-unique-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-unique-characters/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Dice-game-probabilities b/Lang/Quackery/Dice-game-probabilities new file mode 120000 index 0000000000..87d28dc799 --- /dev/null +++ b/Lang/Quackery/Dice-game-probabilities @@ -0,0 +1 @@ +../../Task/Dice-game-probabilities/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Dinesmans-multiple-dwelling-problem b/Lang/Quackery/Dinesmans-multiple-dwelling-problem new file mode 120000 index 0000000000..2061e87b20 --- /dev/null +++ b/Lang/Quackery/Dinesmans-multiple-dwelling-problem @@ -0,0 +1 @@ +../../Task/Dinesmans-multiple-dwelling-problem/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Distribution-of-0-digits-in-factorial-series b/Lang/Quackery/Distribution-of-0-digits-in-factorial-series new file mode 120000 index 0000000000..8627f3195b --- /dev/null +++ b/Lang/Quackery/Distribution-of-0-digits-in-factorial-series @@ -0,0 +1 @@ +../../Task/Distribution-of-0-digits-in-factorial-series/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Doomsday-rule b/Lang/Quackery/Doomsday-rule new file mode 120000 index 0000000000..f3df2f0b9b --- /dev/null +++ b/Lang/Quackery/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Draw-a-clock b/Lang/Quackery/Draw-a-clock new file mode 120000 index 0000000000..961f3b71f5 --- /dev/null +++ b/Lang/Quackery/Draw-a-clock @@ -0,0 +1 @@ +../../Task/Draw-a-clock/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Dutch-national-flag-problem b/Lang/Quackery/Dutch-national-flag-problem new file mode 120000 index 0000000000..133393cf2e --- /dev/null +++ b/Lang/Quackery/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Execute-Computer-Zero b/Lang/Quackery/Execute-Computer-Zero new file mode 120000 index 0000000000..bffceead11 --- /dev/null +++ b/Lang/Quackery/Execute-Computer-Zero @@ -0,0 +1 @@ +../../Task/Execute-Computer-Zero/Quackery \ No newline at end of file diff --git a/Lang/Quackery/First-class-functions-Use-numbers-analogously b/Lang/Quackery/First-class-functions-Use-numbers-analogously new file mode 120000 index 0000000000..c8416f6780 --- /dev/null +++ b/Lang/Quackery/First-class-functions-Use-numbers-analogously @@ -0,0 +1 @@ +../../Task/First-class-functions-Use-numbers-analogously/Quackery \ No newline at end of file diff --git a/Lang/Quackery/First-perfect-square-in-base-n-with-n-unique-digits b/Lang/Quackery/First-perfect-square-in-base-n-with-n-unique-digits new file mode 120000 index 0000000000..fe9c27dfe0 --- /dev/null +++ b/Lang/Quackery/First-perfect-square-in-base-n-with-n-unique-digits @@ -0,0 +1 @@ +../../Task/First-perfect-square-in-base-n-with-n-unique-digits/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Flipping-bits-game b/Lang/Quackery/Flipping-bits-game new file mode 120000 index 0000000000..fd3aa38458 --- /dev/null +++ b/Lang/Quackery/Flipping-bits-game @@ -0,0 +1 @@ +../../Task/Flipping-bits-game/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Four-bit-adder b/Lang/Quackery/Four-bit-adder new file mode 120000 index 0000000000..3afb0e55b7 --- /dev/null +++ b/Lang/Quackery/Four-bit-adder @@ -0,0 +1 @@ +../../Task/Four-bit-adder/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Golden-ratio-Convergence b/Lang/Quackery/Golden-ratio-Convergence new file mode 120000 index 0000000000..177994dc3e --- /dev/null +++ b/Lang/Quackery/Golden-ratio-Convergence @@ -0,0 +1 @@ +../../Task/Golden-ratio-Convergence/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Hello-world-Graphical b/Lang/Quackery/Hello-world-Graphical new file mode 120000 index 0000000000..bbd497e545 --- /dev/null +++ b/Lang/Quackery/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Hofstadter-Figure-Figure-sequences b/Lang/Quackery/Hofstadter-Figure-Figure-sequences new file mode 120000 index 0000000000..5f784f3739 --- /dev/null +++ b/Lang/Quackery/Hofstadter-Figure-Figure-sequences @@ -0,0 +1 @@ +../../Task/Hofstadter-Figure-Figure-sequences/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Hunt-the-Wumpus b/Lang/Quackery/Hunt-the-Wumpus new file mode 120000 index 0000000000..1347e3f9e8 --- /dev/null +++ b/Lang/Quackery/Hunt-the-Wumpus @@ -0,0 +1 @@ +../../Task/Hunt-the-Wumpus/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Longest-common-substring b/Lang/Quackery/Longest-common-substring new file mode 120000 index 0000000000..1f341435ee --- /dev/null +++ b/Lang/Quackery/Longest-common-substring @@ -0,0 +1 @@ +../../Task/Longest-common-substring/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Longest-string-challenge b/Lang/Quackery/Longest-string-challenge new file mode 120000 index 0000000000..9ed80c8f1f --- /dev/null +++ b/Lang/Quackery/Longest-string-challenge @@ -0,0 +1 @@ +../../Task/Longest-string-challenge/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Menu b/Lang/Quackery/Menu new file mode 120000 index 0000000000..07087595bc --- /dev/null +++ b/Lang/Quackery/Menu @@ -0,0 +1 @@ +../../Task/Menu/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Miller-Rabin-primality-test b/Lang/Quackery/Miller-Rabin-primality-test deleted file mode 120000 index d8e4ec56b5..0000000000 --- a/Lang/Quackery/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/Quackery/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..ddb9ece049 --- /dev/null +++ b/Lang/Quackery/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Morse-code b/Lang/Quackery/Morse-code new file mode 120000 index 0000000000..bb500a6fda --- /dev/null +++ b/Lang/Quackery/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Numbers-which-are-not-the-sum-of-distinct-squares b/Lang/Quackery/Numbers-which-are-not-the-sum-of-distinct-squares new file mode 120000 index 0000000000..444eb69298 --- /dev/null +++ b/Lang/Quackery/Numbers-which-are-not-the-sum-of-distinct-squares @@ -0,0 +1 @@ +../../Task/Numbers-which-are-not-the-sum-of-distinct-squares/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Old-lady-swallowed-a-fly b/Lang/Quackery/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..0d6823a2fd --- /dev/null +++ b/Lang/Quackery/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Password-generator b/Lang/Quackery/Password-generator new file mode 120000 index 0000000000..8d0efee13f --- /dev/null +++ b/Lang/Quackery/Password-generator @@ -0,0 +1 @@ +../../Task/Password-generator/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Penneys-game b/Lang/Quackery/Penneys-game new file mode 120000 index 0000000000..6ee95856ce --- /dev/null +++ b/Lang/Quackery/Penneys-game @@ -0,0 +1 @@ +../../Task/Penneys-game/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Periodic-table b/Lang/Quackery/Periodic-table new file mode 120000 index 0000000000..8b9c4bf377 --- /dev/null +++ b/Lang/Quackery/Periodic-table @@ -0,0 +1 @@ +../../Task/Periodic-table/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Pseudo-random-numbers-Xorshift-star b/Lang/Quackery/Pseudo-random-numbers-Xorshift-star new file mode 120000 index 0000000000..0d802ea7eb --- /dev/null +++ b/Lang/Quackery/Pseudo-random-numbers-Xorshift-star @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Xorshift-star/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Set-consolidation b/Lang/Quackery/Set-consolidation new file mode 120000 index 0000000000..d012481c58 --- /dev/null +++ b/Lang/Quackery/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Set-puzzle b/Lang/Quackery/Set-puzzle new file mode 120000 index 0000000000..6b2dbc8928 --- /dev/null +++ b/Lang/Quackery/Set-puzzle @@ -0,0 +1 @@ +../../Task/Set-puzzle/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Set-right-adjacent-bits b/Lang/Quackery/Set-right-adjacent-bits new file mode 120000 index 0000000000..b13aa5b66e --- /dev/null +++ b/Lang/Quackery/Set-right-adjacent-bits @@ -0,0 +1 @@ +../../Task/Set-right-adjacent-bits/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Sleep b/Lang/Quackery/Sleep new file mode 120000 index 0000000000..7cd0464b5f --- /dev/null +++ b/Lang/Quackery/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Solve-the-no-connection-puzzle b/Lang/Quackery/Solve-the-no-connection-puzzle new file mode 120000 index 0000000000..d37f201a93 --- /dev/null +++ b/Lang/Quackery/Solve-the-no-connection-puzzle @@ -0,0 +1 @@ +../../Task/Solve-the-no-connection-puzzle/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Sorting-Algorithms-Circle-Sort b/Lang/Quackery/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index e4abaee49d..0000000000 --- a/Lang/Quackery/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Speech-synthesis b/Lang/Quackery/Speech-synthesis new file mode 120000 index 0000000000..e59431a52c --- /dev/null +++ b/Lang/Quackery/Speech-synthesis @@ -0,0 +1 @@ +../../Task/Speech-synthesis/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Spelling-of-ordinal-numbers b/Lang/Quackery/Spelling-of-ordinal-numbers new file mode 120000 index 0000000000..c573dbf1f0 --- /dev/null +++ b/Lang/Quackery/Spelling-of-ordinal-numbers @@ -0,0 +1 @@ +../../Task/Spelling-of-ordinal-numbers/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Square-free-integers b/Lang/Quackery/Square-free-integers new file mode 120000 index 0000000000..1d2a5a3f4e --- /dev/null +++ b/Lang/Quackery/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Subtractive-generator b/Lang/Quackery/Subtractive-generator new file mode 120000 index 0000000000..1dfd5639a9 --- /dev/null +++ b/Lang/Quackery/Subtractive-generator @@ -0,0 +1 @@ +../../Task/Subtractive-generator/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Sum-of-elements-below-main-diagonal-of-matrix b/Lang/Quackery/Sum-of-elements-below-main-diagonal-of-matrix new file mode 120000 index 0000000000..1f9736ed88 --- /dev/null +++ b/Lang/Quackery/Sum-of-elements-below-main-diagonal-of-matrix @@ -0,0 +1 @@ +../../Task/Sum-of-elements-below-main-diagonal-of-matrix/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Super-d-numbers b/Lang/Quackery/Super-d-numbers new file mode 120000 index 0000000000..808553ed7c --- /dev/null +++ b/Lang/Quackery/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Two-bullet-roulette b/Lang/Quackery/Two-bullet-roulette new file mode 120000 index 0000000000..24f00326c1 --- /dev/null +++ b/Lang/Quackery/Two-bullet-roulette @@ -0,0 +1 @@ +../../Task/Two-bullet-roulette/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Ulam-spiral-for-primes- b/Lang/Quackery/Ulam-spiral-for-primes- new file mode 120000 index 0000000000..d0b12aefe3 --- /dev/null +++ b/Lang/Quackery/Ulam-spiral-for-primes- @@ -0,0 +1 @@ +../../Task/Ulam-spiral-for-primes-/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Ultra-useful-primes b/Lang/Quackery/Ultra-useful-primes new file mode 120000 index 0000000000..d6fc3551e1 --- /dev/null +++ b/Lang/Quackery/Ultra-useful-primes @@ -0,0 +1 @@ +../../Task/Ultra-useful-primes/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Universal-Turing-machine b/Lang/Quackery/Universal-Turing-machine new file mode 120000 index 0000000000..9346211d7e --- /dev/null +++ b/Lang/Quackery/Universal-Turing-machine @@ -0,0 +1 @@ +../../Task/Universal-Turing-machine/Quackery \ No newline at end of file diff --git a/Lang/Quackery/Wagstaff-primes b/Lang/Quackery/Wagstaff-primes new file mode 120000 index 0000000000..1ff48f161f --- /dev/null +++ b/Lang/Quackery/Wagstaff-primes @@ -0,0 +1 @@ +../../Task/Wagstaff-primes/Quackery \ No newline at end of file diff --git a/Lang/QuickBASIC/AKS-test-for-primes b/Lang/QuickBASIC/AKS-test-for-primes new file mode 120000 index 0000000000..3fb1fc33c1 --- /dev/null +++ b/Lang/QuickBASIC/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Abundant-odd-numbers b/Lang/QuickBASIC/Abundant-odd-numbers new file mode 120000 index 0000000000..baf10a6d8e --- /dev/null +++ b/Lang/QuickBASIC/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Arithmetic-numbers b/Lang/QuickBASIC/Arithmetic-numbers new file mode 120000 index 0000000000..e7076b98ae --- /dev/null +++ b/Lang/QuickBASIC/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Brazilian-numbers b/Lang/QuickBASIC/Brazilian-numbers new file mode 120000 index 0000000000..28cd1e19d8 --- /dev/null +++ b/Lang/QuickBASIC/Brazilian-numbers @@ -0,0 +1 @@ +../../Task/Brazilian-numbers/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/CUSIP b/Lang/QuickBASIC/CUSIP new file mode 120000 index 0000000000..cb4c762939 --- /dev/null +++ b/Lang/QuickBASIC/CUSIP @@ -0,0 +1 @@ +../../Task/CUSIP/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Catalan-numbers b/Lang/QuickBASIC/Catalan-numbers new file mode 120000 index 0000000000..d84bc84044 --- /dev/null +++ b/Lang/QuickBASIC/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Cumulative-standard-deviation b/Lang/QuickBASIC/Cumulative-standard-deviation new file mode 120000 index 0000000000..969c73b001 --- /dev/null +++ b/Lang/QuickBASIC/Cumulative-standard-deviation @@ -0,0 +1 @@ +../../Task/Cumulative-standard-deviation/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Determine-if-a-string-is-collapsible b/Lang/QuickBASIC/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..d58e5303fd --- /dev/null +++ b/Lang/QuickBASIC/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Dutch-national-flag-problem b/Lang/QuickBASIC/Dutch-national-flag-problem new file mode 120000 index 0000000000..f213f50587 --- /dev/null +++ b/Lang/QuickBASIC/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Equilibrium-index b/Lang/QuickBASIC/Equilibrium-index new file mode 120000 index 0000000000..d38cfdf137 --- /dev/null +++ b/Lang/QuickBASIC/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Ethiopian-multiplication b/Lang/QuickBASIC/Ethiopian-multiplication new file mode 120000 index 0000000000..8a8cc43790 --- /dev/null +++ b/Lang/QuickBASIC/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Function-definition b/Lang/QuickBASIC/Function-definition new file mode 120000 index 0000000000..0251617973 --- /dev/null +++ b/Lang/QuickBASIC/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Gamma-function b/Lang/QuickBASIC/Gamma-function new file mode 120000 index 0000000000..6180b04d53 --- /dev/null +++ b/Lang/QuickBASIC/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Knights-tour b/Lang/QuickBASIC/Knights-tour new file mode 120000 index 0000000000..7c54f50c61 --- /dev/null +++ b/Lang/QuickBASIC/Knights-tour @@ -0,0 +1 @@ +../../Task/Knights-tour/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Langtons-ant b/Lang/QuickBASIC/Langtons-ant new file mode 120000 index 0000000000..c0bbe5661c --- /dev/null +++ b/Lang/QuickBASIC/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/M-bius-function b/Lang/QuickBASIC/M-bius-function new file mode 120000 index 0000000000..8f60fadaa9 --- /dev/null +++ b/Lang/QuickBASIC/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Monty-Hall-problem b/Lang/QuickBASIC/Monty-Hall-problem new file mode 120000 index 0000000000..5a322fee75 --- /dev/null +++ b/Lang/QuickBASIC/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Multifactorial b/Lang/QuickBASIC/Multifactorial new file mode 120000 index 0000000000..1f38ec7f4d --- /dev/null +++ b/Lang/QuickBASIC/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Nth-root b/Lang/QuickBASIC/Nth-root new file mode 120000 index 0000000000..db6d881466 --- /dev/null +++ b/Lang/QuickBASIC/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Prime-decomposition b/Lang/QuickBASIC/Prime-decomposition new file mode 120000 index 0000000000..1a12af5b95 --- /dev/null +++ b/Lang/QuickBASIC/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Random-numbers b/Lang/QuickBASIC/Random-numbers new file mode 120000 index 0000000000..8332f543fa --- /dev/null +++ b/Lang/QuickBASIC/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Repeat-a-string b/Lang/QuickBASIC/Repeat-a-string new file mode 120000 index 0000000000..f019b580c1 --- /dev/null +++ b/Lang/QuickBASIC/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Reverse-a-string b/Lang/QuickBASIC/Reverse-a-string new file mode 120000 index 0000000000..69b812ff8f --- /dev/null +++ b/Lang/QuickBASIC/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Semiprime b/Lang/QuickBASIC/Semiprime new file mode 120000 index 0000000000..ded745aaee --- /dev/null +++ b/Lang/QuickBASIC/Semiprime @@ -0,0 +1 @@ +../../Task/Semiprime/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Shoelace-formula-for-polygonal-area b/Lang/QuickBASIC/Shoelace-formula-for-polygonal-area new file mode 120000 index 0000000000..dc63463382 --- /dev/null +++ b/Lang/QuickBASIC/Shoelace-formula-for-polygonal-area @@ -0,0 +1 @@ +../../Task/Shoelace-formula-for-polygonal-area/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Sorting-algorithms-Gnome-sort b/Lang/QuickBASIC/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..acc8d6f390 --- /dev/null +++ b/Lang/QuickBASIC/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/QuickBASIC \ No newline at end of file diff --git a/Lang/QuickBASIC/Sorting-algorithms-Quicksort b/Lang/QuickBASIC/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..573bd236b2 --- /dev/null +++ b/Lang/QuickBASIC/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/QuickBASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/Arithmetic-Integer b/Lang/Quite-BASIC/Arithmetic-Integer new file mode 120000 index 0000000000..61ab92c6dd --- /dev/null +++ b/Lang/Quite-BASIC/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Quite-BASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/Arithmetic-geometric-mean b/Lang/Quite-BASIC/Arithmetic-geometric-mean new file mode 120000 index 0000000000..abd8fd70e0 --- /dev/null +++ b/Lang/Quite-BASIC/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Quite-BASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/Array-concatenation b/Lang/Quite-BASIC/Array-concatenation new file mode 120000 index 0000000000..474895b02d --- /dev/null +++ b/Lang/Quite-BASIC/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Quite-BASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/Box-the-compass b/Lang/Quite-BASIC/Box-the-compass new file mode 120000 index 0000000000..1e9e3a7f0c --- /dev/null +++ b/Lang/Quite-BASIC/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/Quite-BASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/Determine-sentence-type b/Lang/Quite-BASIC/Determine-sentence-type new file mode 120000 index 0000000000..6c274b9228 --- /dev/null +++ b/Lang/Quite-BASIC/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Quite-BASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/Empty-program b/Lang/Quite-BASIC/Empty-program deleted file mode 120000 index fb2bfba5b2..0000000000 --- a/Lang/Quite-BASIC/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Quite-BASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/Find-limit-of-recursion b/Lang/Quite-BASIC/Find-limit-of-recursion new file mode 120000 index 0000000000..1d1a15e407 --- /dev/null +++ b/Lang/Quite-BASIC/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Quite-BASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/Logical-operations b/Lang/Quite-BASIC/Logical-operations new file mode 120000 index 0000000000..1906c27758 --- /dev/null +++ b/Lang/Quite-BASIC/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Quite-BASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/Nim-game b/Lang/Quite-BASIC/Nim-game new file mode 120000 index 0000000000..9eafcae7df --- /dev/null +++ b/Lang/Quite-BASIC/Nim-game @@ -0,0 +1 @@ +../../Task/Nim-game/Quite-BASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/Periodic-table b/Lang/Quite-BASIC/Periodic-table new file mode 120000 index 0000000000..e16550052a --- /dev/null +++ b/Lang/Quite-BASIC/Periodic-table @@ -0,0 +1 @@ +../../Task/Periodic-table/Quite-BASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/Repeat-a-string b/Lang/Quite-BASIC/Repeat-a-string new file mode 120000 index 0000000000..8c2025611d --- /dev/null +++ b/Lang/Quite-BASIC/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Quite-BASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/Sorting-algorithms-Gnome-sort b/Lang/Quite-BASIC/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..6ce3e0bffb --- /dev/null +++ b/Lang/Quite-BASIC/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/Quite-BASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/String-interpolation-included- b/Lang/Quite-BASIC/String-interpolation-included- new file mode 120000 index 0000000000..ac2807c77b --- /dev/null +++ b/Lang/Quite-BASIC/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/Quite-BASIC \ No newline at end of file diff --git a/Lang/Quite-BASIC/String-prepend b/Lang/Quite-BASIC/String-prepend new file mode 120000 index 0000000000..7b91f7e3f1 --- /dev/null +++ b/Lang/Quite-BASIC/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/Quite-BASIC \ No newline at end of file diff --git a/Lang/R/15-puzzle-solver b/Lang/R/15-puzzle-solver new file mode 120000 index 0000000000..f3e79214e0 --- /dev/null +++ b/Lang/R/15-puzzle-solver @@ -0,0 +1 @@ +../../Task/15-puzzle-solver/R \ No newline at end of file diff --git a/Lang/R/9-billion-names-of-God-the-integer b/Lang/R/9-billion-names-of-God-the-integer new file mode 120000 index 0000000000..5514828236 --- /dev/null +++ b/Lang/R/9-billion-names-of-God-the-integer @@ -0,0 +1 @@ +../../Task/9-billion-names-of-God-the-integer/R \ No newline at end of file diff --git a/Lang/R/ADFGVX-cipher b/Lang/R/ADFGVX-cipher new file mode 120000 index 0000000000..78a519cccb --- /dev/null +++ b/Lang/R/ADFGVX-cipher @@ -0,0 +1 @@ +../../Task/ADFGVX-cipher/R \ No newline at end of file diff --git a/Lang/R/Abbreviations-automatic b/Lang/R/Abbreviations-automatic new file mode 120000 index 0000000000..c9558583a6 --- /dev/null +++ b/Lang/R/Abbreviations-automatic @@ -0,0 +1 @@ +../../Task/Abbreviations-automatic/R \ No newline at end of file diff --git a/Lang/R/Abbreviations-easy b/Lang/R/Abbreviations-easy new file mode 120000 index 0000000000..6053b1c5a7 --- /dev/null +++ b/Lang/R/Abbreviations-easy @@ -0,0 +1 @@ +../../Task/Abbreviations-easy/R \ No newline at end of file diff --git a/Lang/R/Abelian-sandpile-model b/Lang/R/Abelian-sandpile-model new file mode 120000 index 0000000000..dfec47d8c2 --- /dev/null +++ b/Lang/R/Abelian-sandpile-model @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model/R \ No newline at end of file diff --git a/Lang/R/Additive-primes b/Lang/R/Additive-primes new file mode 120000 index 0000000000..4c8f792a73 --- /dev/null +++ b/Lang/R/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/R \ No newline at end of file diff --git a/Lang/R/Angle-difference-between-two-bearings b/Lang/R/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..a27ae03f18 --- /dev/null +++ b/Lang/R/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/R \ No newline at end of file diff --git a/Lang/R/Angles-geometric-normalization-and-conversion b/Lang/R/Angles-geometric-normalization-and-conversion new file mode 120000 index 0000000000..d1e56f507e --- /dev/null +++ b/Lang/R/Angles-geometric-normalization-and-conversion @@ -0,0 +1 @@ +../../Task/Angles-geometric-normalization-and-conversion/R \ No newline at end of file diff --git a/Lang/R/Arithmetic-derivative b/Lang/R/Arithmetic-derivative new file mode 120000 index 0000000000..b37750c7e7 --- /dev/null +++ b/Lang/R/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/R \ No newline at end of file diff --git a/Lang/R/Balanced-ternary b/Lang/R/Balanced-ternary new file mode 120000 index 0000000000..593bb03a22 --- /dev/null +++ b/Lang/R/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/R \ No newline at end of file diff --git a/Lang/R/Bioinformatics-Sequence-mutation b/Lang/R/Bioinformatics-Sequence-mutation new file mode 120000 index 0000000000..2779ce82b8 --- /dev/null +++ b/Lang/R/Bioinformatics-Sequence-mutation @@ -0,0 +1 @@ +../../Task/Bioinformatics-Sequence-mutation/R \ No newline at end of file diff --git a/Lang/R/Bioinformatics-base-count b/Lang/R/Bioinformatics-base-count deleted file mode 120000 index 2ca416a985..0000000000 --- a/Lang/R/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/R \ No newline at end of file diff --git a/Lang/R/Boyer-Moore-string-search b/Lang/R/Boyer-Moore-string-search new file mode 120000 index 0000000000..32fa72f304 --- /dev/null +++ b/Lang/R/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/R \ No newline at end of file diff --git a/Lang/R/Brazilian-numbers b/Lang/R/Brazilian-numbers new file mode 120000 index 0000000000..87e6a7046a --- /dev/null +++ b/Lang/R/Brazilian-numbers @@ -0,0 +1 @@ +../../Task/Brazilian-numbers/R \ No newline at end of file diff --git a/Lang/R/CUSIP b/Lang/R/CUSIP new file mode 120000 index 0000000000..e43a376539 --- /dev/null +++ b/Lang/R/CUSIP @@ -0,0 +1 @@ +../../Task/CUSIP/R \ No newline at end of file diff --git a/Lang/R/Calendar b/Lang/R/Calendar new file mode 120000 index 0000000000..8cd0e3ee08 --- /dev/null +++ b/Lang/R/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/R \ No newline at end of file diff --git a/Lang/R/Call-a-foreign-language-function b/Lang/R/Call-a-foreign-language-function new file mode 120000 index 0000000000..606c52dbec --- /dev/null +++ b/Lang/R/Call-a-foreign-language-function @@ -0,0 +1 @@ +../../Task/Call-a-foreign-language-function/R \ No newline at end of file diff --git a/Lang/R/Camel-case-and-snake-case b/Lang/R/Camel-case-and-snake-case new file mode 120000 index 0000000000..e76dd2d66a --- /dev/null +++ b/Lang/R/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/R \ No newline at end of file diff --git a/Lang/R/Casting-out-nines b/Lang/R/Casting-out-nines new file mode 120000 index 0000000000..707cb326d0 --- /dev/null +++ b/Lang/R/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/R \ No newline at end of file diff --git a/Lang/R/Catalan-numbers-Pascals-triangle b/Lang/R/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..dbe83426e3 --- /dev/null +++ b/Lang/R/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/R \ No newline at end of file diff --git a/Lang/R/Chinese-zodiac b/Lang/R/Chinese-zodiac new file mode 120000 index 0000000000..55811323ec --- /dev/null +++ b/Lang/R/Chinese-zodiac @@ -0,0 +1 @@ +../../Task/Chinese-zodiac/R \ No newline at end of file diff --git a/Lang/R/Colour-pinstripe-Display b/Lang/R/Colour-pinstripe-Display new file mode 120000 index 0000000000..88bf4afbbd --- /dev/null +++ b/Lang/R/Colour-pinstripe-Display @@ -0,0 +1 @@ +../../Task/Colour-pinstripe-Display/R \ No newline at end of file diff --git a/Lang/R/Compare-length-of-two-strings b/Lang/R/Compare-length-of-two-strings new file mode 120000 index 0000000000..834feb9f20 --- /dev/null +++ b/Lang/R/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/R \ No newline at end of file diff --git a/Lang/R/Compare-sorting-algorithms-performance b/Lang/R/Compare-sorting-algorithms-performance new file mode 120000 index 0000000000..61629d6cd5 --- /dev/null +++ b/Lang/R/Compare-sorting-algorithms-performance @@ -0,0 +1 @@ +../../Task/Compare-sorting-algorithms-performance/R \ No newline at end of file diff --git a/Lang/R/Conjugate-transpose b/Lang/R/Conjugate-transpose new file mode 120000 index 0000000000..573e26fb04 --- /dev/null +++ b/Lang/R/Conjugate-transpose @@ -0,0 +1 @@ +../../Task/Conjugate-transpose/R \ No newline at end of file diff --git a/Lang/R/Continued-fraction b/Lang/R/Continued-fraction new file mode 120000 index 0000000000..8e8db83048 --- /dev/null +++ b/Lang/R/Continued-fraction @@ -0,0 +1 @@ +../../Task/Continued-fraction/R \ No newline at end of file diff --git a/Lang/R/Continued-fraction-Arithmetic-Construct-from-rational-number b/Lang/R/Continued-fraction-Arithmetic-Construct-from-rational-number new file mode 120000 index 0000000000..6bffaf9997 --- /dev/null +++ b/Lang/R/Continued-fraction-Arithmetic-Construct-from-rational-number @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-Construct-from-rational-number/R \ No newline at end of file diff --git a/Lang/R/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- b/Lang/R/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- new file mode 120000 index 0000000000..794241b476 --- /dev/null +++ b/Lang/R/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n-/R \ No newline at end of file diff --git a/Lang/R/Convert-seconds-to-compound-duration b/Lang/R/Convert-seconds-to-compound-duration new file mode 120000 index 0000000000..85f297d7da --- /dev/null +++ b/Lang/R/Convert-seconds-to-compound-duration @@ -0,0 +1 @@ +../../Task/Convert-seconds-to-compound-duration/R \ No newline at end of file diff --git a/Lang/R/Convex-hull b/Lang/R/Convex-hull new file mode 120000 index 0000000000..8db2946ae1 --- /dev/null +++ b/Lang/R/Convex-hull @@ -0,0 +1 @@ +../../Task/Convex-hull/R \ No newline at end of file diff --git a/Lang/R/Count-in-octal b/Lang/R/Count-in-octal new file mode 120000 index 0000000000..37edd3a31e --- /dev/null +++ b/Lang/R/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/R \ No newline at end of file diff --git a/Lang/R/Cramers-rule b/Lang/R/Cramers-rule new file mode 120000 index 0000000000..839896c59f --- /dev/null +++ b/Lang/R/Cramers-rule @@ -0,0 +1 @@ +../../Task/Cramers-rule/R \ No newline at end of file diff --git a/Lang/R/Create-an-HTML-table b/Lang/R/Create-an-HTML-table new file mode 120000 index 0000000000..209500efb4 --- /dev/null +++ b/Lang/R/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/R \ No newline at end of file diff --git a/Lang/R/Curzon-numbers b/Lang/R/Curzon-numbers new file mode 120000 index 0000000000..a381ff9f97 --- /dev/null +++ b/Lang/R/Curzon-numbers @@ -0,0 +1 @@ +../../Task/Curzon-numbers/R \ No newline at end of file diff --git a/Lang/R/De-Bruijn-sequences b/Lang/R/De-Bruijn-sequences new file mode 120000 index 0000000000..bd74daf8c7 --- /dev/null +++ b/Lang/R/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/R \ No newline at end of file diff --git a/Lang/R/Deceptive-numbers b/Lang/R/Deceptive-numbers new file mode 120000 index 0000000000..68b87065ac --- /dev/null +++ b/Lang/R/Deceptive-numbers @@ -0,0 +1 @@ +../../Task/Deceptive-numbers/R \ No newline at end of file diff --git a/Lang/R/Deepcopy b/Lang/R/Deepcopy new file mode 120000 index 0000000000..85c0e9d496 --- /dev/null +++ b/Lang/R/Deepcopy @@ -0,0 +1 @@ +../../Task/Deepcopy/R \ No newline at end of file diff --git a/Lang/R/Demings-funnel b/Lang/R/Demings-funnel new file mode 120000 index 0000000000..ae9cefb48f --- /dev/null +++ b/Lang/R/Demings-funnel @@ -0,0 +1 @@ +../../Task/Demings-funnel/R \ No newline at end of file diff --git a/Lang/R/Determine-sentence-type b/Lang/R/Determine-sentence-type new file mode 120000 index 0000000000..b5e3ac4763 --- /dev/null +++ b/Lang/R/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/R \ No newline at end of file diff --git a/Lang/R/Digital-root-Multiplicative-digital-root b/Lang/R/Digital-root-Multiplicative-digital-root new file mode 120000 index 0000000000..09c29b1f07 --- /dev/null +++ b/Lang/R/Digital-root-Multiplicative-digital-root @@ -0,0 +1 @@ +../../Task/Digital-root-Multiplicative-digital-root/R \ No newline at end of file diff --git a/Lang/R/Dijkstras-algorithm b/Lang/R/Dijkstras-algorithm new file mode 120000 index 0000000000..3bff2fae1d --- /dev/null +++ b/Lang/R/Dijkstras-algorithm @@ -0,0 +1 @@ +../../Task/Dijkstras-algorithm/R \ No newline at end of file diff --git a/Lang/R/Disarium-numbers b/Lang/R/Disarium-numbers new file mode 120000 index 0000000000..233dce846c --- /dev/null +++ b/Lang/R/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/R \ No newline at end of file diff --git a/Lang/R/Display-a-linear-combination b/Lang/R/Display-a-linear-combination new file mode 120000 index 0000000000..c292ce3aec --- /dev/null +++ b/Lang/R/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/R \ No newline at end of file diff --git a/Lang/R/Doomsday-rule b/Lang/R/Doomsday-rule new file mode 120000 index 0000000000..d2c2b8b054 --- /dev/null +++ b/Lang/R/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/R \ No newline at end of file diff --git a/Lang/R/Draw-a-cuboid b/Lang/R/Draw-a-cuboid new file mode 120000 index 0000000000..b0d15ca88e --- /dev/null +++ b/Lang/R/Draw-a-cuboid @@ -0,0 +1 @@ +../../Task/Draw-a-cuboid/R \ No newline at end of file diff --git a/Lang/R/Draw-a-pixel b/Lang/R/Draw-a-pixel new file mode 120000 index 0000000000..64a7037eb8 --- /dev/null +++ b/Lang/R/Draw-a-pixel @@ -0,0 +1 @@ +../../Task/Draw-a-pixel/R \ No newline at end of file diff --git a/Lang/R/Draw-a-sphere b/Lang/R/Draw-a-sphere new file mode 120000 index 0000000000..5508f91f81 --- /dev/null +++ b/Lang/R/Draw-a-sphere @@ -0,0 +1 @@ +../../Task/Draw-a-sphere/R \ No newline at end of file diff --git a/Lang/R/Dutch-national-flag-problem b/Lang/R/Dutch-national-flag-problem new file mode 120000 index 0000000000..422342365f --- /dev/null +++ b/Lang/R/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/R \ No newline at end of file diff --git a/Lang/R/Equilibrium-index b/Lang/R/Equilibrium-index new file mode 120000 index 0000000000..7c36abe0f6 --- /dev/null +++ b/Lang/R/Equilibrium-index @@ -0,0 +1 @@ +../../Task/Equilibrium-index/R \ No newline at end of file diff --git a/Lang/R/Euclid-Mullin-sequence b/Lang/R/Euclid-Mullin-sequence new file mode 120000 index 0000000000..3929a900d8 --- /dev/null +++ b/Lang/R/Euclid-Mullin-sequence @@ -0,0 +1 @@ +../../Task/Euclid-Mullin-sequence/R \ No newline at end of file diff --git a/Lang/R/Execute-Brain- b/Lang/R/Execute-Brain- new file mode 120000 index 0000000000..a21c162e0a --- /dev/null +++ b/Lang/R/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/R \ No newline at end of file diff --git a/Lang/R/Execute-HQ9+ b/Lang/R/Execute-HQ9+ new file mode 120000 index 0000000000..0972c0bb4f --- /dev/null +++ b/Lang/R/Execute-HQ9+ @@ -0,0 +1 @@ +../../Task/Execute-HQ9+/R \ No newline at end of file diff --git a/Lang/R/Factorial-primes b/Lang/R/Factorial-primes new file mode 120000 index 0000000000..90b75c9d38 --- /dev/null +++ b/Lang/R/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/R \ No newline at end of file diff --git a/Lang/R/Factorions b/Lang/R/Factorions new file mode 120000 index 0000000000..351fcd0d06 --- /dev/null +++ b/Lang/R/Factorions @@ -0,0 +1 @@ +../../Task/Factorions/R \ No newline at end of file diff --git a/Lang/R/Factors-of-a-Mersenne-number b/Lang/R/Factors-of-a-Mersenne-number new file mode 120000 index 0000000000..7aad181edd --- /dev/null +++ b/Lang/R/Factors-of-a-Mersenne-number @@ -0,0 +1 @@ +../../Task/Factors-of-a-Mersenne-number/R \ No newline at end of file diff --git a/Lang/R/Fermat-numbers b/Lang/R/Fermat-numbers new file mode 120000 index 0000000000..17ea6a5311 --- /dev/null +++ b/Lang/R/Fermat-numbers @@ -0,0 +1 @@ +../../Task/Fermat-numbers/R \ No newline at end of file diff --git a/Lang/R/Fibonacci-n-step-number-sequences b/Lang/R/Fibonacci-n-step-number-sequences new file mode 120000 index 0000000000..1cf227761a --- /dev/null +++ b/Lang/R/Fibonacci-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Fibonacci-n-step-number-sequences/R \ No newline at end of file diff --git a/Lang/R/File-extension-is-in-extensions-list b/Lang/R/File-extension-is-in-extensions-list new file mode 120000 index 0000000000..154f141040 --- /dev/null +++ b/Lang/R/File-extension-is-in-extensions-list @@ -0,0 +1 @@ +../../Task/File-extension-is-in-extensions-list/R \ No newline at end of file diff --git a/Lang/R/Find-palindromic-numbers-in-both-binary-and-ternary-bases b/Lang/R/Find-palindromic-numbers-in-both-binary-and-ternary-bases new file mode 120000 index 0000000000..1adf6989fe --- /dev/null +++ b/Lang/R/Find-palindromic-numbers-in-both-binary-and-ternary-bases @@ -0,0 +1 @@ +../../Task/Find-palindromic-numbers-in-both-binary-and-ternary-bases/R \ No newline at end of file diff --git a/Lang/R/Flipping-bits-game b/Lang/R/Flipping-bits-game new file mode 120000 index 0000000000..45f9cba067 --- /dev/null +++ b/Lang/R/Flipping-bits-game @@ -0,0 +1 @@ +../../Task/Flipping-bits-game/R \ No newline at end of file diff --git a/Lang/R/Floyd-Warshall-algorithm b/Lang/R/Floyd-Warshall-algorithm new file mode 120000 index 0000000000..f0f7534bc6 --- /dev/null +++ b/Lang/R/Floyd-Warshall-algorithm @@ -0,0 +1 @@ +../../Task/Floyd-Warshall-algorithm/R \ No newline at end of file diff --git a/Lang/R/Fractran b/Lang/R/Fractran new file mode 120000 index 0000000000..4684d03d23 --- /dev/null +++ b/Lang/R/Fractran @@ -0,0 +1 @@ +../../Task/Fractran/R \ No newline at end of file diff --git a/Lang/R/Gapful-numbers b/Lang/R/Gapful-numbers new file mode 120000 index 0000000000..d00abda6e0 --- /dev/null +++ b/Lang/R/Gapful-numbers @@ -0,0 +1 @@ +../../Task/Gapful-numbers/R \ No newline at end of file diff --git a/Lang/R/Gauss-Jordan-matrix-inversion b/Lang/R/Gauss-Jordan-matrix-inversion new file mode 120000 index 0000000000..abdff0e0d3 --- /dev/null +++ b/Lang/R/Gauss-Jordan-matrix-inversion @@ -0,0 +1 @@ +../../Task/Gauss-Jordan-matrix-inversion/R \ No newline at end of file diff --git a/Lang/R/Giuga-numbers b/Lang/R/Giuga-numbers new file mode 120000 index 0000000000..e45399fcf4 --- /dev/null +++ b/Lang/R/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/R \ No newline at end of file diff --git a/Lang/R/Golden-ratio-Convergence b/Lang/R/Golden-ratio-Convergence new file mode 120000 index 0000000000..c3444860a4 --- /dev/null +++ b/Lang/R/Golden-ratio-Convergence @@ -0,0 +1 @@ +../../Task/Golden-ratio-Convergence/R \ No newline at end of file diff --git a/Lang/R/Greedy-algorithm-for-Egyptian-fractions b/Lang/R/Greedy-algorithm-for-Egyptian-fractions new file mode 120000 index 0000000000..142b97c38d --- /dev/null +++ b/Lang/R/Greedy-algorithm-for-Egyptian-fractions @@ -0,0 +1 @@ +../../Task/Greedy-algorithm-for-Egyptian-fractions/R \ No newline at end of file diff --git a/Lang/R/Halt-and-catch-fire b/Lang/R/Halt-and-catch-fire new file mode 120000 index 0000000000..f754df332d --- /dev/null +++ b/Lang/R/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/R \ No newline at end of file diff --git a/Lang/R/Harshad-or-Niven-series b/Lang/R/Harshad-or-Niven-series new file mode 120000 index 0000000000..30268e28d1 --- /dev/null +++ b/Lang/R/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/R \ No newline at end of file diff --git a/Lang/R/Hello-world-Newbie b/Lang/R/Hello-world-Newbie new file mode 120000 index 0000000000..af7f835953 --- /dev/null +++ b/Lang/R/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/R \ No newline at end of file diff --git a/Lang/R/Hex-words b/Lang/R/Hex-words new file mode 120000 index 0000000000..f38acbfb8b --- /dev/null +++ b/Lang/R/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/R \ No newline at end of file diff --git a/Lang/R/Humble-numbers b/Lang/R/Humble-numbers new file mode 120000 index 0000000000..66447beec9 --- /dev/null +++ b/Lang/R/Humble-numbers @@ -0,0 +1 @@ +../../Task/Humble-numbers/R \ No newline at end of file diff --git a/Lang/R/ISBN13-check-digit b/Lang/R/ISBN13-check-digit new file mode 120000 index 0000000000..2ffb9a42ca --- /dev/null +++ b/Lang/R/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/R \ No newline at end of file diff --git a/Lang/R/Integer-overflow b/Lang/R/Integer-overflow new file mode 120000 index 0000000000..35a7fbe410 --- /dev/null +++ b/Lang/R/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/R \ No newline at end of file diff --git a/Lang/R/Isqrt-integer-square-root-of-X b/Lang/R/Isqrt-integer-square-root-of-X new file mode 120000 index 0000000000..3aa4e6becf --- /dev/null +++ b/Lang/R/Isqrt-integer-square-root-of-X @@ -0,0 +1 @@ +../../Task/Isqrt-integer-square-root-of-X/R \ No newline at end of file diff --git a/Lang/R/Kernighans-large-earthquake-problem b/Lang/R/Kernighans-large-earthquake-problem new file mode 120000 index 0000000000..e4a703f050 --- /dev/null +++ b/Lang/R/Kernighans-large-earthquake-problem @@ -0,0 +1 @@ +../../Task/Kernighans-large-earthquake-problem/R \ No newline at end of file diff --git a/Lang/R/LZW-compression b/Lang/R/LZW-compression new file mode 120000 index 0000000000..52a9a7c425 --- /dev/null +++ b/Lang/R/LZW-compression @@ -0,0 +1 @@ +../../Task/LZW-compression/R \ No newline at end of file diff --git a/Lang/R/Literals-Floating-point b/Lang/R/Literals-Floating-point new file mode 120000 index 0000000000..45971f0459 --- /dev/null +++ b/Lang/R/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/R \ No newline at end of file diff --git a/Lang/R/Loops-With-multiple-ranges b/Lang/R/Loops-With-multiple-ranges new file mode 120000 index 0000000000..b09ac16be3 --- /dev/null +++ b/Lang/R/Loops-With-multiple-ranges @@ -0,0 +1 @@ +../../Task/Loops-With-multiple-ranges/R \ No newline at end of file diff --git a/Lang/R/M-bius-function b/Lang/R/M-bius-function new file mode 120000 index 0000000000..54d202ad87 --- /dev/null +++ b/Lang/R/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/R \ No newline at end of file diff --git a/Lang/R/Magic-constant b/Lang/R/Magic-constant new file mode 120000 index 0000000000..42b2f79fd6 --- /dev/null +++ b/Lang/R/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/R \ No newline at end of file diff --git a/Lang/R/Make-directory-path b/Lang/R/Make-directory-path new file mode 120000 index 0000000000..4c5b0435c3 --- /dev/null +++ b/Lang/R/Make-directory-path @@ -0,0 +1 @@ +../../Task/Make-directory-path/R \ No newline at end of file diff --git a/Lang/R/Middle-three-digits b/Lang/R/Middle-three-digits new file mode 120000 index 0000000000..d0b65517a3 --- /dev/null +++ b/Lang/R/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/R \ No newline at end of file diff --git a/Lang/R/Modular-arithmetic b/Lang/R/Modular-arithmetic new file mode 120000 index 0000000000..d91672ac00 --- /dev/null +++ b/Lang/R/Modular-arithmetic @@ -0,0 +1 @@ +../../Task/Modular-arithmetic/R \ No newline at end of file diff --git a/Lang/R/Modular-exponentiation b/Lang/R/Modular-exponentiation new file mode 120000 index 0000000000..00a5ab3605 --- /dev/null +++ b/Lang/R/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/R \ No newline at end of file diff --git a/Lang/R/Move-to-front-algorithm b/Lang/R/Move-to-front-algorithm new file mode 120000 index 0000000000..4c2217c694 --- /dev/null +++ b/Lang/R/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/R \ No newline at end of file diff --git a/Lang/R/Multi-dimensional-array b/Lang/R/Multi-dimensional-array new file mode 120000 index 0000000000..c00f08cfcf --- /dev/null +++ b/Lang/R/Multi-dimensional-array @@ -0,0 +1 @@ +../../Task/Multi-dimensional-array/R \ No newline at end of file diff --git a/Lang/R/Munchausen-numbers b/Lang/R/Munchausen-numbers new file mode 120000 index 0000000000..aa4d45945f --- /dev/null +++ b/Lang/R/Munchausen-numbers @@ -0,0 +1 @@ +../../Task/Munchausen-numbers/R \ No newline at end of file diff --git a/Lang/R/Munching-squares b/Lang/R/Munching-squares new file mode 120000 index 0000000000..5c31288892 --- /dev/null +++ b/Lang/R/Munching-squares @@ -0,0 +1 @@ +../../Task/Munching-squares/R \ No newline at end of file diff --git a/Lang/R/Naming-conventions b/Lang/R/Naming-conventions new file mode 120000 index 0000000000..6ca70fbd5c --- /dev/null +++ b/Lang/R/Naming-conventions @@ -0,0 +1 @@ +../../Task/Naming-conventions/R \ No newline at end of file diff --git a/Lang/R/Numbers-with-equal-rises-and-falls b/Lang/R/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..bd2b09b1a8 --- /dev/null +++ b/Lang/R/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/R \ No newline at end of file diff --git a/Lang/R/Numeric-error-propagation b/Lang/R/Numeric-error-propagation new file mode 120000 index 0000000000..b4d737b26d --- /dev/null +++ b/Lang/R/Numeric-error-propagation @@ -0,0 +1 @@ +../../Task/Numeric-error-propagation/R \ No newline at end of file diff --git a/Lang/R/Old-Russian-measure-of-length b/Lang/R/Old-Russian-measure-of-length new file mode 120000 index 0000000000..10e03acc09 --- /dev/null +++ b/Lang/R/Old-Russian-measure-of-length @@ -0,0 +1 @@ +../../Task/Old-Russian-measure-of-length/R \ No newline at end of file diff --git a/Lang/R/Order-two-numerical-lists b/Lang/R/Order-two-numerical-lists new file mode 120000 index 0000000000..7823304c26 --- /dev/null +++ b/Lang/R/Order-two-numerical-lists @@ -0,0 +1 @@ +../../Task/Order-two-numerical-lists/R \ No newline at end of file diff --git a/Lang/R/Padovan-n-step-number-sequences b/Lang/R/Padovan-n-step-number-sequences new file mode 120000 index 0000000000..bb121da853 --- /dev/null +++ b/Lang/R/Padovan-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Padovan-n-step-number-sequences/R \ No newline at end of file diff --git a/Lang/R/Padovan-sequence b/Lang/R/Padovan-sequence new file mode 120000 index 0000000000..cd4a17c5b4 --- /dev/null +++ b/Lang/R/Padovan-sequence @@ -0,0 +1 @@ +../../Task/Padovan-sequence/R \ No newline at end of file diff --git a/Lang/R/Parse-an-IP-Address b/Lang/R/Parse-an-IP-Address new file mode 120000 index 0000000000..9f23986592 --- /dev/null +++ b/Lang/R/Parse-an-IP-Address @@ -0,0 +1 @@ +../../Task/Parse-an-IP-Address/R \ No newline at end of file diff --git a/Lang/R/Parsing-RPN-calculator-algorithm b/Lang/R/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..121dbc0d6c --- /dev/null +++ b/Lang/R/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/R \ No newline at end of file diff --git a/Lang/R/Parsing-Shunting-yard-algorithm b/Lang/R/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..ceae410d30 --- /dev/null +++ b/Lang/R/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/R \ No newline at end of file diff --git a/Lang/R/Pernicious-numbers b/Lang/R/Pernicious-numbers new file mode 120000 index 0000000000..e0d8d55200 --- /dev/null +++ b/Lang/R/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/R \ No newline at end of file diff --git a/Lang/R/Phrase-reversals b/Lang/R/Phrase-reversals new file mode 120000 index 0000000000..a54a2683b7 --- /dev/null +++ b/Lang/R/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/R \ No newline at end of file diff --git a/Lang/R/Pig-the-dice-game b/Lang/R/Pig-the-dice-game new file mode 120000 index 0000000000..eb7f5b9e91 --- /dev/null +++ b/Lang/R/Pig-the-dice-game @@ -0,0 +1 @@ +../../Task/Pig-the-dice-game/R \ No newline at end of file diff --git a/Lang/R/Pinstripe-Display b/Lang/R/Pinstripe-Display new file mode 120000 index 0000000000..ecca9291db --- /dev/null +++ b/Lang/R/Pinstripe-Display @@ -0,0 +1 @@ +../../Task/Pinstripe-Display/R \ No newline at end of file diff --git a/Lang/R/Plasma-effect b/Lang/R/Plasma-effect new file mode 120000 index 0000000000..0d663e21d0 --- /dev/null +++ b/Lang/R/Plasma-effect @@ -0,0 +1 @@ +../../Task/Plasma-effect/R \ No newline at end of file diff --git a/Lang/R/Poker-hand-analyser b/Lang/R/Poker-hand-analyser new file mode 120000 index 0000000000..1291d08bb2 --- /dev/null +++ b/Lang/R/Poker-hand-analyser @@ -0,0 +1 @@ +../../Task/Poker-hand-analyser/R \ No newline at end of file diff --git a/Lang/R/Pseudo-random-numbers-Middle-square-method b/Lang/R/Pseudo-random-numbers-Middle-square-method new file mode 120000 index 0000000000..27657f10ef --- /dev/null +++ b/Lang/R/Pseudo-random-numbers-Middle-square-method @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Middle-square-method/R \ No newline at end of file diff --git a/Lang/R/Quaternion-type b/Lang/R/Quaternion-type deleted file mode 120000 index 2e826895b9..0000000000 --- a/Lang/R/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/R \ No newline at end of file diff --git a/Lang/R/Quickselect-algorithm b/Lang/R/Quickselect-algorithm new file mode 120000 index 0000000000..996073d670 --- /dev/null +++ b/Lang/R/Quickselect-algorithm @@ -0,0 +1 @@ +../../Task/Quickselect-algorithm/R \ No newline at end of file diff --git a/Lang/R/Rename-a-file b/Lang/R/Rename-a-file new file mode 120000 index 0000000000..d3214c3f95 --- /dev/null +++ b/Lang/R/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/R \ No newline at end of file diff --git a/Lang/R/Rep-string b/Lang/R/Rep-string new file mode 120000 index 0000000000..6f2483d2e5 --- /dev/null +++ b/Lang/R/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/R \ No newline at end of file diff --git a/Lang/R/Repunit-primes b/Lang/R/Repunit-primes new file mode 120000 index 0000000000..9ae6100164 --- /dev/null +++ b/Lang/R/Repunit-primes @@ -0,0 +1 @@ +../../Task/Repunit-primes/R \ No newline at end of file diff --git a/Lang/R/Retrieve-and-search-chat-history b/Lang/R/Retrieve-and-search-chat-history new file mode 120000 index 0000000000..6f350b7b8c --- /dev/null +++ b/Lang/R/Retrieve-and-search-chat-history @@ -0,0 +1 @@ +../../Task/Retrieve-and-search-chat-history/R \ No newline at end of file diff --git a/Lang/R/Search-a-list-of-records b/Lang/R/Search-a-list-of-records new file mode 120000 index 0000000000..ee8b509a32 --- /dev/null +++ b/Lang/R/Search-a-list-of-records @@ -0,0 +1 @@ +../../Task/Search-a-list-of-records/R \ No newline at end of file diff --git a/Lang/R/Self-describing-numbers b/Lang/R/Self-describing-numbers new file mode 120000 index 0000000000..3e9383f257 --- /dev/null +++ b/Lang/R/Self-describing-numbers @@ -0,0 +1 @@ +../../Task/Self-describing-numbers/R \ No newline at end of file diff --git a/Lang/R/Semordnilap b/Lang/R/Semordnilap new file mode 120000 index 0000000000..8ef388caef --- /dev/null +++ b/Lang/R/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/R \ No newline at end of file diff --git a/Lang/R/Shoelace-formula-for-polygonal-area b/Lang/R/Shoelace-formula-for-polygonal-area new file mode 120000 index 0000000000..8e6ea3fcc6 --- /dev/null +++ b/Lang/R/Shoelace-formula-for-polygonal-area @@ -0,0 +1 @@ +../../Task/Shoelace-formula-for-polygonal-area/R \ No newline at end of file diff --git a/Lang/R/Soloways-recurring-rainfall b/Lang/R/Soloways-recurring-rainfall new file mode 120000 index 0000000000..33b1f84311 --- /dev/null +++ b/Lang/R/Soloways-recurring-rainfall @@ -0,0 +1 @@ +../../Task/Soloways-recurring-rainfall/R \ No newline at end of file diff --git a/Lang/R/Sort-numbers-lexicographically b/Lang/R/Sort-numbers-lexicographically new file mode 120000 index 0000000000..77a76317d2 --- /dev/null +++ b/Lang/R/Sort-numbers-lexicographically @@ -0,0 +1 @@ +../../Task/Sort-numbers-lexicographically/R \ No newline at end of file diff --git a/Lang/R/Sorting-algorithms-Bead-sort b/Lang/R/Sorting-algorithms-Bead-sort new file mode 120000 index 0000000000..4be00936ef --- /dev/null +++ b/Lang/R/Sorting-algorithms-Bead-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bead-sort/R \ No newline at end of file diff --git a/Lang/R/Sorting-algorithms-Patience-sort b/Lang/R/Sorting-algorithms-Patience-sort new file mode 120000 index 0000000000..bcaf3b078e --- /dev/null +++ b/Lang/R/Sorting-algorithms-Patience-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Patience-sort/R \ No newline at end of file diff --git a/Lang/R/Sorting-algorithms-Strand-sort b/Lang/R/Sorting-algorithms-Strand-sort new file mode 120000 index 0000000000..80a612e755 --- /dev/null +++ b/Lang/R/Sorting-algorithms-Strand-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Strand-sort/R \ No newline at end of file diff --git a/Lang/R/Spinning-rod-animation-Text b/Lang/R/Spinning-rod-animation-Text new file mode 120000 index 0000000000..3083d1bb50 --- /dev/null +++ b/Lang/R/Spinning-rod-animation-Text @@ -0,0 +1 @@ +../../Task/Spinning-rod-animation-Text/R \ No newline at end of file diff --git a/Lang/R/Split-a-character-string-based-on-change-of-character b/Lang/R/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..16a92812f1 --- /dev/null +++ b/Lang/R/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/R \ No newline at end of file diff --git a/Lang/R/Square-free-integers b/Lang/R/Square-free-integers new file mode 120000 index 0000000000..a07b4300b5 --- /dev/null +++ b/Lang/R/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/R \ No newline at end of file diff --git a/Lang/R/Start-from-a-main-routine b/Lang/R/Start-from-a-main-routine new file mode 120000 index 0000000000..915851ff80 --- /dev/null +++ b/Lang/R/Start-from-a-main-routine @@ -0,0 +1 @@ +../../Task/Start-from-a-main-routine/R \ No newline at end of file diff --git a/Lang/R/Strassens-algorithm b/Lang/R/Strassens-algorithm new file mode 120000 index 0000000000..e4aa0075a9 --- /dev/null +++ b/Lang/R/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/R \ No newline at end of file diff --git a/Lang/R/String-interpolation-included- b/Lang/R/String-interpolation-included- new file mode 120000 index 0000000000..f311002546 --- /dev/null +++ b/Lang/R/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/R \ No newline at end of file diff --git a/Lang/R/String-matching b/Lang/R/String-matching new file mode 120000 index 0000000000..2461134ac0 --- /dev/null +++ b/Lang/R/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/R \ No newline at end of file diff --git a/Lang/R/Strip-a-set-of-characters-from-a-string b/Lang/R/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..b83d60c994 --- /dev/null +++ b/Lang/R/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/R \ No newline at end of file diff --git a/Lang/R/Strip-block-comments b/Lang/R/Strip-block-comments new file mode 120000 index 0000000000..17c55383a8 --- /dev/null +++ b/Lang/R/Strip-block-comments @@ -0,0 +1 @@ +../../Task/Strip-block-comments/R \ No newline at end of file diff --git a/Lang/R/Substitution-cipher b/Lang/R/Substitution-cipher new file mode 120000 index 0000000000..ce3c7f1ac2 --- /dev/null +++ b/Lang/R/Substitution-cipher @@ -0,0 +1 @@ +../../Task/Substitution-cipher/R \ No newline at end of file diff --git a/Lang/R/Substring-Top-and-tail b/Lang/R/Substring-Top-and-tail new file mode 120000 index 0000000000..271cd3b15f --- /dev/null +++ b/Lang/R/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/R \ No newline at end of file diff --git a/Lang/R/Superellipse b/Lang/R/Superellipse new file mode 120000 index 0000000000..3b8dc95f89 --- /dev/null +++ b/Lang/R/Superellipse @@ -0,0 +1 @@ +../../Task/Superellipse/R \ No newline at end of file diff --git a/Lang/R/Sylvesters-sequence b/Lang/R/Sylvesters-sequence new file mode 120000 index 0000000000..29d289c6ff --- /dev/null +++ b/Lang/R/Sylvesters-sequence @@ -0,0 +1 @@ +../../Task/Sylvesters-sequence/R \ No newline at end of file diff --git a/Lang/R/Textonyms b/Lang/R/Textonyms new file mode 120000 index 0000000000..a6ba4b7c41 --- /dev/null +++ b/Lang/R/Textonyms @@ -0,0 +1 @@ +../../Task/Textonyms/R \ No newline at end of file diff --git a/Lang/R/The-Name-Game b/Lang/R/The-Name-Game new file mode 120000 index 0000000000..a5e981bf52 --- /dev/null +++ b/Lang/R/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/R \ No newline at end of file diff --git a/Lang/R/Tonelli-Shanks-algorithm b/Lang/R/Tonelli-Shanks-algorithm new file mode 120000 index 0000000000..2ad48c9cd5 --- /dev/null +++ b/Lang/R/Tonelli-Shanks-algorithm @@ -0,0 +1 @@ +../../Task/Tonelli-Shanks-algorithm/R \ No newline at end of file diff --git a/Lang/R/Transliterate-English-text-using-the-Greek-alphabet b/Lang/R/Transliterate-English-text-using-the-Greek-alphabet new file mode 120000 index 0000000000..0b8d7b7463 --- /dev/null +++ b/Lang/R/Transliterate-English-text-using-the-Greek-alphabet @@ -0,0 +1 @@ +../../Task/Transliterate-English-text-using-the-Greek-alphabet/R \ No newline at end of file diff --git a/Lang/R/Twelve-statements b/Lang/R/Twelve-statements new file mode 120000 index 0000000000..89536cfc68 --- /dev/null +++ b/Lang/R/Twelve-statements @@ -0,0 +1 @@ +../../Task/Twelve-statements/R \ No newline at end of file diff --git a/Lang/R/Van-der-Corput-sequence b/Lang/R/Van-der-Corput-sequence new file mode 120000 index 0000000000..66a8a345d5 --- /dev/null +++ b/Lang/R/Van-der-Corput-sequence @@ -0,0 +1 @@ +../../Task/Van-der-Corput-sequence/R \ No newline at end of file diff --git a/Lang/R/Variable-declaration-reset b/Lang/R/Variable-declaration-reset new file mode 120000 index 0000000000..d5c07caba9 --- /dev/null +++ b/Lang/R/Variable-declaration-reset @@ -0,0 +1 @@ +../../Task/Variable-declaration-reset/R \ No newline at end of file diff --git a/Lang/R/Vector b/Lang/R/Vector new file mode 120000 index 0000000000..3d5cfd297c --- /dev/null +++ b/Lang/R/Vector @@ -0,0 +1 @@ +../../Task/Vector/R \ No newline at end of file diff --git a/Lang/R/Verhoeff-algorithm b/Lang/R/Verhoeff-algorithm new file mode 120000 index 0000000000..2838835d10 --- /dev/null +++ b/Lang/R/Verhoeff-algorithm @@ -0,0 +1 @@ +../../Task/Verhoeff-algorithm/R \ No newline at end of file diff --git a/Lang/R/Wieferich-primes b/Lang/R/Wieferich-primes new file mode 120000 index 0000000000..1c103bdf36 --- /dev/null +++ b/Lang/R/Wieferich-primes @@ -0,0 +1 @@ +../../Task/Wieferich-primes/R \ No newline at end of file diff --git a/Lang/R/Wilson-primes-of-order-n b/Lang/R/Wilson-primes-of-order-n new file mode 120000 index 0000000000..0638b273a2 --- /dev/null +++ b/Lang/R/Wilson-primes-of-order-n @@ -0,0 +1 @@ +../../Task/Wilson-primes-of-order-n/R \ No newline at end of file diff --git a/Lang/R/Write-entire-file b/Lang/R/Write-entire-file new file mode 120000 index 0000000000..2972bb07fe --- /dev/null +++ b/Lang/R/Write-entire-file @@ -0,0 +1 @@ +../../Task/Write-entire-file/R \ No newline at end of file diff --git a/Lang/RATFOR/Fibonacci-sequence b/Lang/RATFOR/Fibonacci-sequence new file mode 120000 index 0000000000..5d5e412db3 --- /dev/null +++ b/Lang/RATFOR/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/RATFOR \ No newline at end of file diff --git a/Lang/RATFOR/Loops-Infinite b/Lang/RATFOR/Loops-Infinite new file mode 120000 index 0000000000..71b44f7d2b --- /dev/null +++ b/Lang/RATFOR/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/RATFOR \ No newline at end of file diff --git a/Lang/REBOL/00-LANG.txt b/Lang/REBOL/00-LANG.txt deleted file mode 100644 index 0117c8198c..0000000000 --- a/Lang/REBOL/00-LANG.txt +++ /dev/null @@ -1,3 +0,0 @@ -{{stub}}{{language|REBOL -|site=http://rebol.com}} -REBOL stands for Relative Expression Based Object Language. \ No newline at end of file diff --git a/Lang/REBOL/00-META.yaml b/Lang/REBOL/00-META.yaml deleted file mode 100644 index 58070bb517..0000000000 --- a/Lang/REBOL/00-META.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -from: http://rosettacode.org/wiki/Category:REBOL diff --git a/Lang/REBOL/100-doors b/Lang/REBOL/100-doors deleted file mode 120000 index 3c604849c4..0000000000 --- a/Lang/REBOL/100-doors +++ /dev/null @@ -1 +0,0 @@ -../../Task/100-doors/REBOL \ No newline at end of file diff --git a/Lang/REBOL/15-puzzle-game b/Lang/REBOL/15-puzzle-game deleted file mode 120000 index ca19266202..0000000000 --- a/Lang/REBOL/15-puzzle-game +++ /dev/null @@ -1 +0,0 @@ -../../Task/15-puzzle-game/REBOL \ No newline at end of file diff --git a/Lang/REBOL/99-bottles-of-beer b/Lang/REBOL/99-bottles-of-beer deleted file mode 120000 index 464d38e243..0000000000 --- a/Lang/REBOL/99-bottles-of-beer +++ /dev/null @@ -1 +0,0 @@ -../../Task/99-bottles-of-beer/REBOL \ No newline at end of file diff --git a/Lang/REBOL/A+B b/Lang/REBOL/A+B deleted file mode 120000 index a6531c3ec1..0000000000 --- a/Lang/REBOL/A+B +++ /dev/null @@ -1 +0,0 @@ -../../Task/A+B/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Abstract-type b/Lang/REBOL/Abstract-type deleted file mode 120000 index c01205f584..0000000000 --- a/Lang/REBOL/Abstract-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Abstract-type/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Accumulator-factory b/Lang/REBOL/Accumulator-factory deleted file mode 120000 index 9f94ac82f1..0000000000 --- a/Lang/REBOL/Accumulator-factory +++ /dev/null @@ -1 +0,0 @@ -../../Task/Accumulator-factory/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Add-a-variable-to-a-class-instance-at-runtime b/Lang/REBOL/Add-a-variable-to-a-class-instance-at-runtime deleted file mode 120000 index 901f7e7487..0000000000 --- a/Lang/REBOL/Add-a-variable-to-a-class-instance-at-runtime +++ /dev/null @@ -1 +0,0 @@ -../../Task/Add-a-variable-to-a-class-instance-at-runtime/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Align-columns b/Lang/REBOL/Align-columns deleted file mode 120000 index 67ffa18d54..0000000000 --- a/Lang/REBOL/Align-columns +++ /dev/null @@ -1 +0,0 @@ -../../Task/Align-columns/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Amicable-pairs b/Lang/REBOL/Amicable-pairs deleted file mode 120000 index 238ed42eb6..0000000000 --- a/Lang/REBOL/Amicable-pairs +++ /dev/null @@ -1 +0,0 @@ -../../Task/Amicable-pairs/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Animation b/Lang/REBOL/Animation deleted file mode 120000 index 0fccfbad33..0000000000 --- a/Lang/REBOL/Animation +++ /dev/null @@ -1 +0,0 @@ -../../Task/Animation/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Anonymous-recursion b/Lang/REBOL/Anonymous-recursion deleted file mode 120000 index 5c9e13cbb0..0000000000 --- a/Lang/REBOL/Anonymous-recursion +++ /dev/null @@ -1 +0,0 @@ -../../Task/Anonymous-recursion/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Apply-a-callback-to-an-array b/Lang/REBOL/Apply-a-callback-to-an-array deleted file mode 120000 index a9a331e92d..0000000000 --- a/Lang/REBOL/Apply-a-callback-to-an-array +++ /dev/null @@ -1 +0,0 @@ -../../Task/Apply-a-callback-to-an-array/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Arithmetic-Integer b/Lang/REBOL/Arithmetic-Integer deleted file mode 120000 index acafb7724e..0000000000 --- a/Lang/REBOL/Arithmetic-Integer +++ /dev/null @@ -1 +0,0 @@ -../../Task/Arithmetic-Integer/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Array-concatenation b/Lang/REBOL/Array-concatenation deleted file mode 120000 index 679c10ed62..0000000000 --- a/Lang/REBOL/Array-concatenation +++ /dev/null @@ -1 +0,0 @@ -../../Task/Array-concatenation/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Array-length b/Lang/REBOL/Array-length deleted file mode 120000 index d083adde64..0000000000 --- a/Lang/REBOL/Array-length +++ /dev/null @@ -1 +0,0 @@ -../../Task/Array-length/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Arrays b/Lang/REBOL/Arrays deleted file mode 120000 index 9fc95551ee..0000000000 --- a/Lang/REBOL/Arrays +++ /dev/null @@ -1 +0,0 @@ -../../Task/Arrays/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Averages-Arithmetic-mean b/Lang/REBOL/Averages-Arithmetic-mean deleted file mode 120000 index de8cb5e395..0000000000 --- a/Lang/REBOL/Averages-Arithmetic-mean +++ /dev/null @@ -1 +0,0 @@ -../../Task/Averages-Arithmetic-mean/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Averages-Median b/Lang/REBOL/Averages-Median deleted file mode 120000 index 96ef2cd694..0000000000 --- a/Lang/REBOL/Averages-Median +++ /dev/null @@ -1 +0,0 @@ -../../Task/Averages-Median/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Calendar b/Lang/REBOL/Calendar deleted file mode 120000 index f396941538..0000000000 --- a/Lang/REBOL/Calendar +++ /dev/null @@ -1 +0,0 @@ -../../Task/Calendar/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Check-that-file-exists b/Lang/REBOL/Check-that-file-exists deleted file mode 120000 index 70f5435458..0000000000 --- a/Lang/REBOL/Check-that-file-exists +++ /dev/null @@ -1 +0,0 @@ -../../Task/Check-that-file-exists/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Classes b/Lang/REBOL/Classes deleted file mode 120000 index f823823847..0000000000 --- a/Lang/REBOL/Classes +++ /dev/null @@ -1 +0,0 @@ -../../Task/Classes/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Comma-quibbling b/Lang/REBOL/Comma-quibbling deleted file mode 120000 index b2f7530541..0000000000 --- a/Lang/REBOL/Comma-quibbling +++ /dev/null @@ -1 +0,0 @@ -../../Task/Comma-quibbling/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Comments b/Lang/REBOL/Comments deleted file mode 120000 index 2dad54191c..0000000000 --- a/Lang/REBOL/Comments +++ /dev/null @@ -1 +0,0 @@ -../../Task/Comments/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Copy-a-string b/Lang/REBOL/Copy-a-string deleted file mode 120000 index 8babad9959..0000000000 --- a/Lang/REBOL/Copy-a-string +++ /dev/null @@ -1 +0,0 @@ -../../Task/Copy-a-string/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Create-a-file b/Lang/REBOL/Create-a-file deleted file mode 120000 index 3089537d01..0000000000 --- a/Lang/REBOL/Create-a-file +++ /dev/null @@ -1 +0,0 @@ -../../Task/Create-a-file/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Date-format b/Lang/REBOL/Date-format deleted file mode 120000 index 33ce065e87..0000000000 --- a/Lang/REBOL/Date-format +++ /dev/null @@ -1 +0,0 @@ -../../Task/Date-format/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Date-manipulation b/Lang/REBOL/Date-manipulation deleted file mode 120000 index 2722a008ce..0000000000 --- a/Lang/REBOL/Date-manipulation +++ /dev/null @@ -1 +0,0 @@ -../../Task/Date-manipulation/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Day-of-the-week b/Lang/REBOL/Day-of-the-week deleted file mode 120000 index 82d7509a60..0000000000 --- a/Lang/REBOL/Day-of-the-week +++ /dev/null @@ -1 +0,0 @@ -../../Task/Day-of-the-week/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Delete-a-file b/Lang/REBOL/Delete-a-file deleted file mode 120000 index 66f14845d7..0000000000 --- a/Lang/REBOL/Delete-a-file +++ /dev/null @@ -1 +0,0 @@ -../../Task/Delete-a-file/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Detect-division-by-zero b/Lang/REBOL/Detect-division-by-zero deleted file mode 120000 index b0ccafd718..0000000000 --- a/Lang/REBOL/Detect-division-by-zero +++ /dev/null @@ -1 +0,0 @@ -../../Task/Detect-division-by-zero/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Determine-if-a-string-is-numeric b/Lang/REBOL/Determine-if-a-string-is-numeric deleted file mode 120000 index 045a0ae13f..0000000000 --- a/Lang/REBOL/Determine-if-a-string-is-numeric +++ /dev/null @@ -1 +0,0 @@ -../../Task/Determine-if-a-string-is-numeric/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Documentation b/Lang/REBOL/Documentation deleted file mode 120000 index daa69740d8..0000000000 --- a/Lang/REBOL/Documentation +++ /dev/null @@ -1 +0,0 @@ -../../Task/Documentation/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Dot-product b/Lang/REBOL/Dot-product deleted file mode 120000 index 0e405ceca0..0000000000 --- a/Lang/REBOL/Dot-product +++ /dev/null @@ -1 +0,0 @@ -../../Task/Dot-product/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Dynamic-variable-names b/Lang/REBOL/Dynamic-variable-names deleted file mode 120000 index dc26f8842e..0000000000 --- a/Lang/REBOL/Dynamic-variable-names +++ /dev/null @@ -1 +0,0 @@ -../../Task/Dynamic-variable-names/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Echo-server b/Lang/REBOL/Echo-server deleted file mode 120000 index e5f15ce096..0000000000 --- a/Lang/REBOL/Echo-server +++ /dev/null @@ -1 +0,0 @@ -../../Task/Echo-server/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Empty-program b/Lang/REBOL/Empty-program deleted file mode 120000 index 15b162acc2..0000000000 --- a/Lang/REBOL/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Environment-variables b/Lang/REBOL/Environment-variables deleted file mode 120000 index 1742700711..0000000000 --- a/Lang/REBOL/Environment-variables +++ /dev/null @@ -1 +0,0 @@ -../../Task/Environment-variables/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Execute-Brain- b/Lang/REBOL/Execute-Brain- deleted file mode 120000 index 5d49896311..0000000000 --- a/Lang/REBOL/Execute-Brain- +++ /dev/null @@ -1 +0,0 @@ -../../Task/Execute-Brain-/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Execute-a-system-command b/Lang/REBOL/Execute-a-system-command deleted file mode 120000 index 6177e36583..0000000000 --- a/Lang/REBOL/Execute-a-system-command +++ /dev/null @@ -1 +0,0 @@ -../../Task/Execute-a-system-command/REBOL \ No newline at end of file diff --git a/Lang/REBOL/FTP b/Lang/REBOL/FTP deleted file mode 120000 index 7ab1c53c58..0000000000 --- a/Lang/REBOL/FTP +++ /dev/null @@ -1 +0,0 @@ -../../Task/FTP/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Factorial b/Lang/REBOL/Factorial deleted file mode 120000 index 8643656c0a..0000000000 --- a/Lang/REBOL/Factorial +++ /dev/null @@ -1 +0,0 @@ -../../Task/Factorial/REBOL \ No newline at end of file diff --git a/Lang/REBOL/File-input-output b/Lang/REBOL/File-input-output deleted file mode 120000 index 30e510fb5d..0000000000 --- a/Lang/REBOL/File-input-output +++ /dev/null @@ -1 +0,0 @@ -../../Task/File-input-output/REBOL \ No newline at end of file diff --git a/Lang/REBOL/File-size b/Lang/REBOL/File-size deleted file mode 120000 index 61c4252f32..0000000000 --- a/Lang/REBOL/File-size +++ /dev/null @@ -1 +0,0 @@ -../../Task/File-size/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Filter b/Lang/REBOL/Filter deleted file mode 120000 index d25c807398..0000000000 --- a/Lang/REBOL/Filter +++ /dev/null @@ -1 +0,0 @@ -../../Task/Filter/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Find-the-last-Sunday-of-each-month b/Lang/REBOL/Find-the-last-Sunday-of-each-month deleted file mode 120000 index c54d330170..0000000000 --- a/Lang/REBOL/Find-the-last-Sunday-of-each-month +++ /dev/null @@ -1 +0,0 @@ -../../Task/Find-the-last-Sunday-of-each-month/REBOL \ No newline at end of file diff --git a/Lang/REBOL/First-class-functions b/Lang/REBOL/First-class-functions deleted file mode 120000 index 729d2ef773..0000000000 --- a/Lang/REBOL/First-class-functions +++ /dev/null @@ -1 +0,0 @@ -../../Task/First-class-functions/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Fixed-length-records b/Lang/REBOL/Fixed-length-records deleted file mode 120000 index c6d6d1ea72..0000000000 --- a/Lang/REBOL/Fixed-length-records +++ /dev/null @@ -1 +0,0 @@ -../../Task/Fixed-length-records/REBOL \ No newline at end of file diff --git a/Lang/REBOL/FizzBuzz b/Lang/REBOL/FizzBuzz deleted file mode 120000 index 5fada5dc79..0000000000 --- a/Lang/REBOL/FizzBuzz +++ /dev/null @@ -1 +0,0 @@ -../../Task/FizzBuzz/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Flatten-a-list b/Lang/REBOL/Flatten-a-list deleted file mode 120000 index c63e60f1ae..0000000000 --- a/Lang/REBOL/Flatten-a-list +++ /dev/null @@ -1 +0,0 @@ -../../Task/Flatten-a-list/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Flow-control-structures b/Lang/REBOL/Flow-control-structures deleted file mode 120000 index 02978f970b..0000000000 --- a/Lang/REBOL/Flow-control-structures +++ /dev/null @@ -1 +0,0 @@ -../../Task/Flow-control-structures/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Formatted-numeric-output b/Lang/REBOL/Formatted-numeric-output deleted file mode 120000 index 6231201b56..0000000000 --- a/Lang/REBOL/Formatted-numeric-output +++ /dev/null @@ -1 +0,0 @@ -../../Task/Formatted-numeric-output/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Function-composition b/Lang/REBOL/Function-composition deleted file mode 120000 index 00fbef410f..0000000000 --- a/Lang/REBOL/Function-composition +++ /dev/null @@ -1 +0,0 @@ -../../Task/Function-composition/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Function-definition b/Lang/REBOL/Function-definition deleted file mode 120000 index 24045b17c8..0000000000 --- a/Lang/REBOL/Function-definition +++ /dev/null @@ -1 +0,0 @@ -../../Task/Function-definition/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Generic-swap b/Lang/REBOL/Generic-swap deleted file mode 120000 index 252d05095f..0000000000 --- a/Lang/REBOL/Generic-swap +++ /dev/null @@ -1 +0,0 @@ -../../Task/Generic-swap/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Greatest-common-divisor b/Lang/REBOL/Greatest-common-divisor deleted file mode 120000 index 66251fda3d..0000000000 --- a/Lang/REBOL/Greatest-common-divisor +++ /dev/null @@ -1 +0,0 @@ -../../Task/Greatest-common-divisor/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Greatest-element-of-a-list b/Lang/REBOL/Greatest-element-of-a-list deleted file mode 120000 index bf835b648c..0000000000 --- a/Lang/REBOL/Greatest-element-of-a-list +++ /dev/null @@ -1 +0,0 @@ -../../Task/Greatest-element-of-a-list/REBOL \ No newline at end of file diff --git a/Lang/REBOL/HTTP b/Lang/REBOL/HTTP deleted file mode 120000 index 7ade844f73..0000000000 --- a/Lang/REBOL/HTTP +++ /dev/null @@ -1 +0,0 @@ -../../Task/HTTP/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Hailstone-sequence b/Lang/REBOL/Hailstone-sequence deleted file mode 120000 index f668d98fe0..0000000000 --- a/Lang/REBOL/Hailstone-sequence +++ /dev/null @@ -1 +0,0 @@ -../../Task/Hailstone-sequence/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Hello-world-Graphical b/Lang/REBOL/Hello-world-Graphical deleted file mode 120000 index 65375f6063..0000000000 --- a/Lang/REBOL/Hello-world-Graphical +++ /dev/null @@ -1 +0,0 @@ -../../Task/Hello-world-Graphical/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Hello-world-Newline-omission b/Lang/REBOL/Hello-world-Newline-omission deleted file mode 120000 index a1ab230770..0000000000 --- a/Lang/REBOL/Hello-world-Newline-omission +++ /dev/null @@ -1 +0,0 @@ -../../Task/Hello-world-Newline-omission/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Hello-world-Text b/Lang/REBOL/Hello-world-Text deleted file mode 120000 index 417f675e90..0000000000 --- a/Lang/REBOL/Hello-world-Text +++ /dev/null @@ -1 +0,0 @@ -../../Task/Hello-world-Text/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Higher-order-functions b/Lang/REBOL/Higher-order-functions deleted file mode 120000 index e0da7764d4..0000000000 --- a/Lang/REBOL/Higher-order-functions +++ /dev/null @@ -1 +0,0 @@ -../../Task/Higher-order-functions/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Horners-rule-for-polynomial-evaluation b/Lang/REBOL/Horners-rule-for-polynomial-evaluation deleted file mode 120000 index 3ed4d272a6..0000000000 --- a/Lang/REBOL/Horners-rule-for-polynomial-evaluation +++ /dev/null @@ -1 +0,0 @@ -../../Task/Horners-rule-for-polynomial-evaluation/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Hostname b/Lang/REBOL/Hostname deleted file mode 120000 index 00509fe88c..0000000000 --- a/Lang/REBOL/Hostname +++ /dev/null @@ -1 +0,0 @@ -../../Task/Hostname/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Increment-a-numerical-string b/Lang/REBOL/Increment-a-numerical-string deleted file mode 120000 index 0b8ae5b473..0000000000 --- a/Lang/REBOL/Increment-a-numerical-string +++ /dev/null @@ -1 +0,0 @@ -../../Task/Increment-a-numerical-string/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Inheritance-Single b/Lang/REBOL/Inheritance-Single deleted file mode 120000 index 8790c38450..0000000000 --- a/Lang/REBOL/Inheritance-Single +++ /dev/null @@ -1 +0,0 @@ -../../Task/Inheritance-Single/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Input-loop b/Lang/REBOL/Input-loop deleted file mode 120000 index 81d9914a81..0000000000 --- a/Lang/REBOL/Input-loop +++ /dev/null @@ -1 +0,0 @@ -../../Task/Input-loop/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Integer-comparison b/Lang/REBOL/Integer-comparison deleted file mode 120000 index 6f12d33801..0000000000 --- a/Lang/REBOL/Integer-comparison +++ /dev/null @@ -1 +0,0 @@ -../../Task/Integer-comparison/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Interactive-programming-repl- b/Lang/REBOL/Interactive-programming-repl- deleted file mode 120000 index a2a59ee516..0000000000 --- a/Lang/REBOL/Interactive-programming-repl- +++ /dev/null @@ -1 +0,0 @@ -../../Task/Interactive-programming-repl-/REBOL \ No newline at end of file diff --git a/Lang/REBOL/JSON b/Lang/REBOL/JSON deleted file mode 120000 index bbdd962074..0000000000 --- a/Lang/REBOL/JSON +++ /dev/null @@ -1 +0,0 @@ -../../Task/JSON/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Josephus-problem b/Lang/REBOL/Josephus-problem deleted file mode 120000 index d092745290..0000000000 --- a/Lang/REBOL/Josephus-problem +++ /dev/null @@ -1 +0,0 @@ -../../Task/Josephus-problem/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Keyboard-macros b/Lang/REBOL/Keyboard-macros deleted file mode 120000 index 4c918106f7..0000000000 --- a/Lang/REBOL/Keyboard-macros +++ /dev/null @@ -1 +0,0 @@ -../../Task/Keyboard-macros/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Knuth-shuffle b/Lang/REBOL/Knuth-shuffle deleted file mode 120000 index e1ef5ac835..0000000000 --- a/Lang/REBOL/Knuth-shuffle +++ /dev/null @@ -1 +0,0 @@ -../../Task/Knuth-shuffle/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Last-Friday-of-each-month b/Lang/REBOL/Last-Friday-of-each-month deleted file mode 120000 index 592b3befd7..0000000000 --- a/Lang/REBOL/Last-Friday-of-each-month +++ /dev/null @@ -1 +0,0 @@ -../../Task/Last-Friday-of-each-month/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Leap-year b/Lang/REBOL/Leap-year deleted file mode 120000 index e1fde0d2a0..0000000000 --- a/Lang/REBOL/Leap-year +++ /dev/null @@ -1 +0,0 @@ -../../Task/Leap-year/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Literals-Integer b/Lang/REBOL/Literals-Integer deleted file mode 120000 index c018808d2d..0000000000 --- a/Lang/REBOL/Literals-Integer +++ /dev/null @@ -1 +0,0 @@ -../../Task/Literals-Integer/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Logical-operations b/Lang/REBOL/Logical-operations deleted file mode 120000 index b2be03cb20..0000000000 --- a/Lang/REBOL/Logical-operations +++ /dev/null @@ -1 +0,0 @@ -../../Task/Logical-operations/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Loops-Break b/Lang/REBOL/Loops-Break deleted file mode 120000 index b12b588bcd..0000000000 --- a/Lang/REBOL/Loops-Break +++ /dev/null @@ -1 +0,0 @@ -../../Task/Loops-Break/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Loops-Continue b/Lang/REBOL/Loops-Continue deleted file mode 120000 index 620f8d42c2..0000000000 --- a/Lang/REBOL/Loops-Continue +++ /dev/null @@ -1 +0,0 @@ -../../Task/Loops-Continue/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Loops-Do-while b/Lang/REBOL/Loops-Do-while deleted file mode 120000 index a092621ef7..0000000000 --- a/Lang/REBOL/Loops-Do-while +++ /dev/null @@ -1 +0,0 @@ -../../Task/Loops-Do-while/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Loops-Downward-for b/Lang/REBOL/Loops-Downward-for deleted file mode 120000 index e956288e68..0000000000 --- a/Lang/REBOL/Loops-Downward-for +++ /dev/null @@ -1 +0,0 @@ -../../Task/Loops-Downward-for/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Loops-For b/Lang/REBOL/Loops-For deleted file mode 120000 index 9c59f991f0..0000000000 --- a/Lang/REBOL/Loops-For +++ /dev/null @@ -1 +0,0 @@ -../../Task/Loops-For/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Loops-For-with-a-specified-step b/Lang/REBOL/Loops-For-with-a-specified-step deleted file mode 120000 index 3174e4899e..0000000000 --- a/Lang/REBOL/Loops-For-with-a-specified-step +++ /dev/null @@ -1 +0,0 @@ -../../Task/Loops-For-with-a-specified-step/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Loops-Foreach b/Lang/REBOL/Loops-Foreach deleted file mode 120000 index 98cc61392e..0000000000 --- a/Lang/REBOL/Loops-Foreach +++ /dev/null @@ -1 +0,0 @@ -../../Task/Loops-Foreach/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Loops-Infinite b/Lang/REBOL/Loops-Infinite deleted file mode 120000 index cd80f1fc2f..0000000000 --- a/Lang/REBOL/Loops-Infinite +++ /dev/null @@ -1 +0,0 @@ -../../Task/Loops-Infinite/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Loops-N-plus-one-half b/Lang/REBOL/Loops-N-plus-one-half deleted file mode 120000 index 530a004b19..0000000000 --- a/Lang/REBOL/Loops-N-plus-one-half +++ /dev/null @@ -1 +0,0 @@ -../../Task/Loops-N-plus-one-half/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Loops-Nested b/Lang/REBOL/Loops-Nested deleted file mode 120000 index fad704e1b5..0000000000 --- a/Lang/REBOL/Loops-Nested +++ /dev/null @@ -1 +0,0 @@ -../../Task/Loops-Nested/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Loops-While b/Lang/REBOL/Loops-While deleted file mode 120000 index 7caecdb43d..0000000000 --- a/Lang/REBOL/Loops-While +++ /dev/null @@ -1 +0,0 @@ -../../Task/Loops-While/REBOL \ No newline at end of file diff --git a/Lang/REBOL/MD5 b/Lang/REBOL/MD5 deleted file mode 120000 index 5cb019110c..0000000000 --- a/Lang/REBOL/MD5 +++ /dev/null @@ -1 +0,0 @@ -../../Task/MD5/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Mad-Libs b/Lang/REBOL/Mad-Libs deleted file mode 120000 index db4b8d6171..0000000000 --- a/Lang/REBOL/Mad-Libs +++ /dev/null @@ -1 +0,0 @@ -../../Task/Mad-Libs/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Menu b/Lang/REBOL/Menu deleted file mode 120000 index 3b0b7dc2de..0000000000 --- a/Lang/REBOL/Menu +++ /dev/null @@ -1 +0,0 @@ -../../Task/Menu/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Multiplication-tables b/Lang/REBOL/Multiplication-tables deleted file mode 120000 index 1b70d39ee9..0000000000 --- a/Lang/REBOL/Multiplication-tables +++ /dev/null @@ -1 +0,0 @@ -../../Task/Multiplication-tables/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Mutual-recursion b/Lang/REBOL/Mutual-recursion deleted file mode 120000 index cb2de22d29..0000000000 --- a/Lang/REBOL/Mutual-recursion +++ /dev/null @@ -1 +0,0 @@ -../../Task/Mutual-recursion/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Null-object b/Lang/REBOL/Null-object deleted file mode 120000 index 0b324069d2..0000000000 --- a/Lang/REBOL/Null-object +++ /dev/null @@ -1 +0,0 @@ -../../Task/Null-object/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Number-reversal-game b/Lang/REBOL/Number-reversal-game deleted file mode 120000 index a23e4203b5..0000000000 --- a/Lang/REBOL/Number-reversal-game +++ /dev/null @@ -1 +0,0 @@ -../../Task/Number-reversal-game/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Palindrome-detection b/Lang/REBOL/Palindrome-detection deleted file mode 120000 index 45e3490dd4..0000000000 --- a/Lang/REBOL/Palindrome-detection +++ /dev/null @@ -1 +0,0 @@ -../../Task/Palindrome-detection/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Percentage-difference-between-images b/Lang/REBOL/Percentage-difference-between-images deleted file mode 120000 index 47e0c29027..0000000000 --- a/Lang/REBOL/Percentage-difference-between-images +++ /dev/null @@ -1 +0,0 @@ -../../Task/Percentage-difference-between-images/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Perfect-numbers b/Lang/REBOL/Perfect-numbers deleted file mode 120000 index 888589d0dd..0000000000 --- a/Lang/REBOL/Perfect-numbers +++ /dev/null @@ -1 +0,0 @@ -../../Task/Perfect-numbers/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Primality-by-trial-division b/Lang/REBOL/Primality-by-trial-division deleted file mode 120000 index 6e14471054..0000000000 --- a/Lang/REBOL/Primality-by-trial-division +++ /dev/null @@ -1 +0,0 @@ -../../Task/Primality-by-trial-division/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Program-termination b/Lang/REBOL/Program-termination deleted file mode 120000 index 7c4ce8b3c8..0000000000 --- a/Lang/REBOL/Program-termination +++ /dev/null @@ -1 +0,0 @@ -../../Task/Program-termination/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Queue-Definition b/Lang/REBOL/Queue-Definition deleted file mode 120000 index aa21697e36..0000000000 --- a/Lang/REBOL/Queue-Definition +++ /dev/null @@ -1 +0,0 @@ -../../Task/Queue-Definition/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Queue-Usage b/Lang/REBOL/Queue-Usage deleted file mode 120000 index 488c4682f8..0000000000 --- a/Lang/REBOL/Queue-Usage +++ /dev/null @@ -1 +0,0 @@ -../../Task/Queue-Usage/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Quine b/Lang/REBOL/Quine deleted file mode 120000 index 391f27dc9c..0000000000 --- a/Lang/REBOL/Quine +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quine/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Read-a-specific-line-from-a-file b/Lang/REBOL/Read-a-specific-line-from-a-file deleted file mode 120000 index fc3cb7c086..0000000000 --- a/Lang/REBOL/Read-a-specific-line-from-a-file +++ /dev/null @@ -1 +0,0 @@ -../../Task/Read-a-specific-line-from-a-file/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Read-entire-file b/Lang/REBOL/Read-entire-file deleted file mode 120000 index 8d1ffdb8c8..0000000000 --- a/Lang/REBOL/Read-entire-file +++ /dev/null @@ -1 +0,0 @@ -../../Task/Read-entire-file/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Regular-expressions b/Lang/REBOL/Regular-expressions deleted file mode 120000 index cc056f3dfc..0000000000 --- a/Lang/REBOL/Regular-expressions +++ /dev/null @@ -1 +0,0 @@ -../../Task/Regular-expressions/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Remove-duplicate-elements b/Lang/REBOL/Remove-duplicate-elements deleted file mode 120000 index 989597f93c..0000000000 --- a/Lang/REBOL/Remove-duplicate-elements +++ /dev/null @@ -1 +0,0 @@ -../../Task/Remove-duplicate-elements/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Rename-a-file b/Lang/REBOL/Rename-a-file deleted file mode 120000 index d5b1f76dba..0000000000 --- a/Lang/REBOL/Rename-a-file +++ /dev/null @@ -1 +0,0 @@ -../../Task/Rename-a-file/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Repeat-a-string b/Lang/REBOL/Repeat-a-string deleted file mode 120000 index df3bda003c..0000000000 --- a/Lang/REBOL/Repeat-a-string +++ /dev/null @@ -1 +0,0 @@ -../../Task/Repeat-a-string/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Reverse-a-string b/Lang/REBOL/Reverse-a-string deleted file mode 120000 index 4fa66fa042..0000000000 --- a/Lang/REBOL/Reverse-a-string +++ /dev/null @@ -1 +0,0 @@ -../../Task/Reverse-a-string/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Rot-13 b/Lang/REBOL/Rot-13 deleted file mode 120000 index 344b9949b8..0000000000 --- a/Lang/REBOL/Rot-13 +++ /dev/null @@ -1 +0,0 @@ -../../Task/Rot-13/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Runtime-evaluation b/Lang/REBOL/Runtime-evaluation deleted file mode 120000 index 4f29a7904a..0000000000 --- a/Lang/REBOL/Runtime-evaluation +++ /dev/null @@ -1 +0,0 @@ -../../Task/Runtime-evaluation/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Runtime-evaluation-In-an-environment b/Lang/REBOL/Runtime-evaluation-In-an-environment deleted file mode 120000 index 00ac88948d..0000000000 --- a/Lang/REBOL/Runtime-evaluation-In-an-environment +++ /dev/null @@ -1 +0,0 @@ -../../Task/Runtime-evaluation-In-an-environment/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Search-a-list b/Lang/REBOL/Search-a-list deleted file mode 120000 index 30c4450829..0000000000 --- a/Lang/REBOL/Search-a-list +++ /dev/null @@ -1 +0,0 @@ -../../Task/Search-a-list/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Send-email b/Lang/REBOL/Send-email deleted file mode 120000 index 7a102c33ea..0000000000 --- a/Lang/REBOL/Send-email +++ /dev/null @@ -1 +0,0 @@ -../../Task/Send-email/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Shell-one-liner b/Lang/REBOL/Shell-one-liner deleted file mode 120000 index 3efd76bee3..0000000000 --- a/Lang/REBOL/Shell-one-liner +++ /dev/null @@ -1 +0,0 @@ -../../Task/Shell-one-liner/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Simple-database b/Lang/REBOL/Simple-database deleted file mode 120000 index 2171f3e8b2..0000000000 --- a/Lang/REBOL/Simple-database +++ /dev/null @@ -1 +0,0 @@ -../../Task/Simple-database/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Simple-windowed-application b/Lang/REBOL/Simple-windowed-application deleted file mode 120000 index 3eb2f5011a..0000000000 --- a/Lang/REBOL/Simple-windowed-application +++ /dev/null @@ -1 +0,0 @@ -../../Task/Simple-windowed-application/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Sleep b/Lang/REBOL/Sleep deleted file mode 120000 index 49498dee8f..0000000000 --- a/Lang/REBOL/Sleep +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sleep/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Sort-an-integer-array b/Lang/REBOL/Sort-an-integer-array deleted file mode 120000 index be40906bd3..0000000000 --- a/Lang/REBOL/Sort-an-integer-array +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sort-an-integer-array/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Sort-stability b/Lang/REBOL/Sort-stability deleted file mode 120000 index 7a6119bc4e..0000000000 --- a/Lang/REBOL/Sort-stability +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sort-stability/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Sorting-algorithms-Insertion-sort b/Lang/REBOL/Sorting-algorithms-Insertion-sort deleted file mode 120000 index 5a9f9f2f24..0000000000 --- a/Lang/REBOL/Sorting-algorithms-Insertion-sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-algorithms-Insertion-sort/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Stack b/Lang/REBOL/Stack deleted file mode 120000 index 70bb3936ee..0000000000 --- a/Lang/REBOL/Stack +++ /dev/null @@ -1 +0,0 @@ -../../Task/Stack/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Stair-climbing-puzzle b/Lang/REBOL/Stair-climbing-puzzle deleted file mode 120000 index 935f1a3925..0000000000 --- a/Lang/REBOL/Stair-climbing-puzzle +++ /dev/null @@ -1 +0,0 @@ -../../Task/Stair-climbing-puzzle/REBOL \ No newline at end of file diff --git a/Lang/REBOL/String-case b/Lang/REBOL/String-case deleted file mode 120000 index 2279191d8d..0000000000 --- a/Lang/REBOL/String-case +++ /dev/null @@ -1 +0,0 @@ -../../Task/String-case/REBOL \ No newline at end of file diff --git a/Lang/REBOL/String-concatenation b/Lang/REBOL/String-concatenation deleted file mode 120000 index 8be78ed69f..0000000000 --- a/Lang/REBOL/String-concatenation +++ /dev/null @@ -1 +0,0 @@ -../../Task/String-concatenation/REBOL \ No newline at end of file diff --git a/Lang/REBOL/String-interpolation-included- b/Lang/REBOL/String-interpolation-included- deleted file mode 120000 index 1158cc37bc..0000000000 --- a/Lang/REBOL/String-interpolation-included- +++ /dev/null @@ -1 +0,0 @@ -../../Task/String-interpolation-included-/REBOL \ No newline at end of file diff --git a/Lang/REBOL/String-length b/Lang/REBOL/String-length deleted file mode 120000 index 06c8f5cbd6..0000000000 --- a/Lang/REBOL/String-length +++ /dev/null @@ -1 +0,0 @@ -../../Task/String-length/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Substring b/Lang/REBOL/Substring deleted file mode 120000 index ae87eb5a53..0000000000 --- a/Lang/REBOL/Substring +++ /dev/null @@ -1 +0,0 @@ -../../Task/Substring/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Sum-and-product-of-an-array b/Lang/REBOL/Sum-and-product-of-an-array deleted file mode 120000 index 5ce08d6535..0000000000 --- a/Lang/REBOL/Sum-and-product-of-an-array +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sum-and-product-of-an-array/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Symmetric-difference b/Lang/REBOL/Symmetric-difference deleted file mode 120000 index 27c9c680ad..0000000000 --- a/Lang/REBOL/Symmetric-difference +++ /dev/null @@ -1 +0,0 @@ -../../Task/Symmetric-difference/REBOL \ No newline at end of file diff --git a/Lang/REBOL/System-time b/Lang/REBOL/System-time deleted file mode 120000 index 7ea31d4a27..0000000000 --- a/Lang/REBOL/System-time +++ /dev/null @@ -1 +0,0 @@ -../../Task/System-time/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Take-notes-on-the-command-line b/Lang/REBOL/Take-notes-on-the-command-line deleted file mode 120000 index f00a0f5d0a..0000000000 --- a/Lang/REBOL/Take-notes-on-the-command-line +++ /dev/null @@ -1 +0,0 @@ -../../Task/Take-notes-on-the-command-line/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Tokenize-a-string b/Lang/REBOL/Tokenize-a-string deleted file mode 120000 index ee10fb0551..0000000000 --- a/Lang/REBOL/Tokenize-a-string +++ /dev/null @@ -1 +0,0 @@ -../../Task/Tokenize-a-string/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Towers-of-Hanoi b/Lang/REBOL/Towers-of-Hanoi deleted file mode 120000 index a173272546..0000000000 --- a/Lang/REBOL/Towers-of-Hanoi +++ /dev/null @@ -1 +0,0 @@ -../../Task/Towers-of-Hanoi/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Tree-traversal b/Lang/REBOL/Tree-traversal deleted file mode 120000 index 0c44bbca9b..0000000000 --- a/Lang/REBOL/Tree-traversal +++ /dev/null @@ -1 +0,0 @@ -../../Task/Tree-traversal/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Trigonometric-functions b/Lang/REBOL/Trigonometric-functions deleted file mode 120000 index 8f4c11188c..0000000000 --- a/Lang/REBOL/Trigonometric-functions +++ /dev/null @@ -1 +0,0 @@ -../../Task/Trigonometric-functions/REBOL \ No newline at end of file diff --git a/Lang/REBOL/User-input-Graphical b/Lang/REBOL/User-input-Graphical deleted file mode 120000 index 001538e055..0000000000 --- a/Lang/REBOL/User-input-Graphical +++ /dev/null @@ -1 +0,0 @@ -../../Task/User-input-Graphical/REBOL \ No newline at end of file diff --git a/Lang/REBOL/User-input-Text b/Lang/REBOL/User-input-Text deleted file mode 120000 index b81fcf9c85..0000000000 --- a/Lang/REBOL/User-input-Text +++ /dev/null @@ -1 +0,0 @@ -../../Task/User-input-Text/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Variadic-function b/Lang/REBOL/Variadic-function deleted file mode 120000 index c3eb7c285d..0000000000 --- a/Lang/REBOL/Variadic-function +++ /dev/null @@ -1 +0,0 @@ -../../Task/Variadic-function/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Web-scraping b/Lang/REBOL/Web-scraping deleted file mode 120000 index 4c37db2bfe..0000000000 --- a/Lang/REBOL/Web-scraping +++ /dev/null @@ -1 +0,0 @@ -../../Task/Web-scraping/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Window-creation b/Lang/REBOL/Window-creation deleted file mode 120000 index d3c3450624..0000000000 --- a/Lang/REBOL/Window-creation +++ /dev/null @@ -1 +0,0 @@ -../../Task/Window-creation/REBOL \ No newline at end of file diff --git a/Lang/REBOL/XML-Input b/Lang/REBOL/XML-Input deleted file mode 120000 index f96cb4fd5e..0000000000 --- a/Lang/REBOL/XML-Input +++ /dev/null @@ -1 +0,0 @@ -../../Task/XML-Input/REBOL \ No newline at end of file diff --git a/Lang/REBOL/Y-combinator b/Lang/REBOL/Y-combinator deleted file mode 120000 index 492c58627d..0000000000 --- a/Lang/REBOL/Y-combinator +++ /dev/null @@ -1 +0,0 @@ -../../Task/Y-combinator/REBOL \ No newline at end of file diff --git a/Lang/REXX/00-LANG.txt b/Lang/REXX/00-LANG.txt index 26a483d9aa..592349f719 100644 --- a/Lang/REXX/00-LANG.txt +++ b/Lang/REXX/00-LANG.txt @@ -26,6 +26,21 @@ The '''REXX''' language was influenced by the computer programming languages:   '''ALGOL,   PL/I,   EXEC,'''  and  '''EXEC 2.''' +Using Classic REXX closely resembles pseudo code and many languages like Basic or Julia. Experienced programmers should have no problem reading REXX code and translating it to other languages.
    +Some items that might differ from what you are familiar with.
    +* Caseless, fully free format. +* Code blocks delimited by do...end, no brackets (){}. +* A programs starts always with line 1, so you'll need 'exit' before the code for procedures and routines. +* Usual control structures present: do...by...to, do while/until, select, leave, iterate, call, return, exit, & (and), \ (not). +* No data types, no declarations, everything is string. String functions such as 'Left()' or 'Substr()' may be applied on numbers. +* All arithmetic is decimal based, not binary. So stuff like bit shifting or multiply/divide by 2 using exponent add/subtract does not apply. +* Exponentiation is designated by '**' thus x^2 = x**2. +* Integer division is designated by '%' thus 13%3 = 4. +* Modulo division (remainder) is designated by '//' thus 13//3 = 1 ('13 mod 3'). +* Arrays (here called 'stems') are designated by something like 'stem.a.b. etc' (stem = name array; a, b etc any value; 'associative arrays'). +* Precision is unlimited (default 9 digits), but you have to specify it yourself ('numeric digits nn'). +* Parameter passing always by value. Stems cannot be passed, but must be made available with 'expose'. + Versions of REXX: * '''[[wp:ARexx|ARexx]]'''   is a classic REXX implementation (with extensions) for the AmigaOS,   given in bundle since AmigaOS 2.   (Regina REXX has specific support for the extended functions that were introduced in ARexx.)   ARexx was written in 1987 by William S. Hawes. @@ -36,7 +51,7 @@ The '''REXX''' language was influenced by the computer programming languages: &n * '''[[CRX REXX]]'''   (Compact REXX) is a classic REXX first written by Dr. Brian Marks. -* '''[[CTC REXX]]'''   is a classic REXX that is bundled with PC/SPF and written by Command Technology Corporation,   a license is required to use this product.   This version of REXX can only be used under PC/SPF and it's panels.   PC/SPF resembles the IBM program product SPF (which has other names and versions). +* '''[[REXX/2]]'''   is a classic REXX that is bundled with PC/SPF and written by Command Technology Corporation,   a license is required to use this product.   This version of REXX can only be used under PC/SPF and it's panels.   PC/SPF resembles the IBM program product SPF (which has other names and versions). The last version was published in 1996. Company CTC doesn't exist anymore. * '''[[KEXX]]'''   is a subset of REXX that is bundled with KEDIT and written by Keven J. Kearney of Mansfield Software Group, Inc., a license is required to use this product.   KEXX only executes under the KEDIT licensed product.   KEDIT is an XEDIT clone (an editor from IBM for VM/CMS program products). @@ -75,7 +90,7 @@ The '''REXX''' language was influenced by the computer programming languages: &n * '''[[Regina REXX]]'''   is an implementation first created by Anders Christensen (in 1992) and is now maintained by others, notably Mark Hessling.   Regina REXX runs on more different platforms than any other REXX,   too many to name here.   It can be downloaded freely. -* '''[[Reginald REXX]]'''   is a REXX developed by Jeff Glatt.   It can be downloaded freely. +* '''[[Reginald REXX]]'''   is a REXX developed by Jeff Glatt.   It can be downloaded freely. According to Rexxinfo.org, Reginald is out of maintenance. * '''[[REXX/imc]]'''   a classic REXX developed by Ian M. Collier (imc) for Linux/Unix. @@ -84,10 +99,10 @@ The '''REXX''' language was influenced by the computer programming languages: &n * '''REXX/Personal'''   is another name for   '''Personal REXX'''     (see above). -* '''[[ROO oo-REXX]]'''   an object-oriented REXX developed by Keith Watts of Kilowatt Software, Inc.     It can be downloaded freely.   '''ROO'''   is also known as   '''ROO!'''. +* '''[[ROO oo-REXX]]'''   an object-oriented REXX developed by Keith Watts of Kilowatt Software, Inc.     It can be downloaded freely.   '''ROO'''   is also known as   '''ROO!'''. According to Rexxinfo.org, Roo! is out of maintenance. -* '''[[R4 REXX]]'''   a classic REXX developed by Keith Watts of Kilowatt Software, Inc.     It was also known as '''Portable REXX'''.   It can be downloaded freely. +* '''[[R4 REXX]]'''   a classic REXX developed by Keith Watts of Kilowatt Software, Inc.     It was also known as '''Portable REXX'''.   It can be downloaded freely. According to Rexxinfo.org, R4 is out of maintenance. * '''[[T/REXX, a REXX compiler for CMS]]'''   is an implementation of classic REXX written by Leigh Lundin and Mark Woodruff   (according to Wikipedia). @@ -112,16 +127,7 @@ The '''REXX''' language was influenced by the computer programming languages: &n * [http://www.rexxla.org The Rexx Language Association - www.rexxla.org] * [http://regina-rexx.sourceforge.net/index.html Regina Rexx Interpreter] * [http://www.kedit.com/ Mansfield Software Group, Inc. (KEDIT)] -* [http://www.quercus-sys.com/ Personal REXX, Quercus Systems] -* [http://www.commandtechnology.com/ CTC Command Technology] * [http://www.rexxla.org/ CRX Open Source (right column side)] -* [http://www.kilowattsoftware.com/r4Page.htm R4, Kilowatt Software] -* [http://www.kilowattsoftware.com/rooPage.htm ROO, Kilowatt Software] -* [http://publib.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/HCSE2C00/CCONTENTS?SHELF=hcsh2ab0&DN=SC24-6221-00&DT=20090724140455 z/VM V6R1 REXX/VM Reference] -* [http://publib.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/HCSB3C00/CCONTENTS?SHELF=hcsh2ab0&DN=SC24-6222-00&DT=20090724131829 z/VM V6R1 REXX/VM User's Guide] -* [http://www.rexxinfo.org/html/rexxinfo1.html#Rexx-Manuals {many references to REXX manuals}] - - == Rosetta Code tasks not implemented in REXX == -[[Reports:Tasks_not_implemented_in_REXX]] \ No newline at end of file +[[Tasks not implemented in REXX]] \ No newline at end of file diff --git a/Lang/REXX/Arithmetic-numbers b/Lang/REXX/Arithmetic-numbers new file mode 120000 index 0000000000..71a3332017 --- /dev/null +++ b/Lang/REXX/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/REXX \ No newline at end of file diff --git a/Lang/REXX/Ascending-primes b/Lang/REXX/Ascending-primes new file mode 120000 index 0000000000..bbc0af4983 --- /dev/null +++ b/Lang/REXX/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/REXX \ No newline at end of file diff --git a/Lang/REXX/Base64-decode-data b/Lang/REXX/Base64-decode-data new file mode 120000 index 0000000000..226b0ce798 --- /dev/null +++ b/Lang/REXX/Base64-decode-data @@ -0,0 +1 @@ +../../Task/Base64-decode-data/REXX \ No newline at end of file diff --git a/Lang/REXX/Bioinformatics-base-count b/Lang/REXX/Bioinformatics-base-count deleted file mode 120000 index c722864481..0000000000 --- a/Lang/REXX/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/REXX \ No newline at end of file diff --git a/Lang/REXX/Blum-integer b/Lang/REXX/Blum-integer new file mode 120000 index 0000000000..2aa27c2ff0 --- /dev/null +++ b/Lang/REXX/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/REXX \ No newline at end of file diff --git a/Lang/REXX/Chernicks-Carmichael-numbers b/Lang/REXX/Chernicks-Carmichael-numbers new file mode 120000 index 0000000000..4050cb562e --- /dev/null +++ b/Lang/REXX/Chernicks-Carmichael-numbers @@ -0,0 +1 @@ +../../Task/Chernicks-Carmichael-numbers/REXX \ No newline at end of file diff --git a/Lang/REXX/Deceptive-numbers b/Lang/REXX/Deceptive-numbers new file mode 120000 index 0000000000..3f3cdd6f00 --- /dev/null +++ b/Lang/REXX/Deceptive-numbers @@ -0,0 +1 @@ +../../Task/Deceptive-numbers/REXX \ No newline at end of file diff --git a/Lang/REXX/Descending-primes b/Lang/REXX/Descending-primes new file mode 120000 index 0000000000..c55d765868 --- /dev/null +++ b/Lang/REXX/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/REXX \ No newline at end of file diff --git a/Lang/REXX/Euclid-Mullin-sequence b/Lang/REXX/Euclid-Mullin-sequence new file mode 120000 index 0000000000..3ded1fce93 --- /dev/null +++ b/Lang/REXX/Euclid-Mullin-sequence @@ -0,0 +1 @@ +../../Task/Euclid-Mullin-sequence/REXX \ No newline at end of file diff --git a/Lang/REXX/Eulers-constant-0.5772... b/Lang/REXX/Eulers-constant-0.5772... new file mode 120000 index 0000000000..4dd79a59f3 --- /dev/null +++ b/Lang/REXX/Eulers-constant-0.5772... @@ -0,0 +1 @@ +../../Task/Eulers-constant-0.5772.../REXX \ No newline at end of file diff --git a/Lang/REXX/Find-largest-left-truncatable-prime-in-a-given-base b/Lang/REXX/Find-largest-left-truncatable-prime-in-a-given-base new file mode 120000 index 0000000000..528dd8a890 --- /dev/null +++ b/Lang/REXX/Find-largest-left-truncatable-prime-in-a-given-base @@ -0,0 +1 @@ +../../Task/Find-largest-left-truncatable-prime-in-a-given-base/REXX \ No newline at end of file diff --git a/Lang/REXX/Goldbachs-comet b/Lang/REXX/Goldbachs-comet new file mode 120000 index 0000000000..ddf76b927f --- /dev/null +++ b/Lang/REXX/Goldbachs-comet @@ -0,0 +1 @@ +../../Task/Goldbachs-comet/REXX \ No newline at end of file diff --git a/Lang/REXX/Jacobsthal-numbers b/Lang/REXX/Jacobsthal-numbers new file mode 120000 index 0000000000..7f86ce7033 --- /dev/null +++ b/Lang/REXX/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/REXX \ No newline at end of file diff --git a/Lang/REXX/Legendre-prime-counting-function b/Lang/REXX/Legendre-prime-counting-function new file mode 120000 index 0000000000..74d1b424e1 --- /dev/null +++ b/Lang/REXX/Legendre-prime-counting-function @@ -0,0 +1 @@ +../../Task/Legendre-prime-counting-function/REXX \ No newline at end of file diff --git a/Lang/REXX/Magic-constant b/Lang/REXX/Magic-constant new file mode 120000 index 0000000000..13d81a62dd --- /dev/null +++ b/Lang/REXX/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/REXX \ No newline at end of file diff --git a/Lang/REXX/Miller-Rabin-primality-test b/Lang/REXX/Miller-Rabin-primality-test deleted file mode 120000 index 6b9607754b..0000000000 --- a/Lang/REXX/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/REXX \ No newline at end of file diff --git a/Lang/REXX/Primes---allocate-descendants-to-their-ancestors b/Lang/REXX/Primes---allocate-descendants-to-their-ancestors new file mode 120000 index 0000000000..e6293c9090 --- /dev/null +++ b/Lang/REXX/Primes---allocate-descendants-to-their-ancestors @@ -0,0 +1 @@ +../../Task/Primes---allocate-descendants-to-their-ancestors/REXX \ No newline at end of file diff --git a/Lang/REXX/Quaternion-type b/Lang/REXX/Quaternion-type deleted file mode 120000 index 18e452fac4..0000000000 --- a/Lang/REXX/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/REXX \ No newline at end of file diff --git a/Lang/REXX/Ramanujan-primes-twins b/Lang/REXX/Ramanujan-primes-twins new file mode 120000 index 0000000000..09da3d7f76 --- /dev/null +++ b/Lang/REXX/Ramanujan-primes-twins @@ -0,0 +1 @@ +../../Task/Ramanujan-primes-twins/REXX \ No newline at end of file diff --git a/Lang/REXX/Sequence-of-primorial-primes b/Lang/REXX/Sequence-of-primorial-primes new file mode 120000 index 0000000000..cd4ebe8c73 --- /dev/null +++ b/Lang/REXX/Sequence-of-primorial-primes @@ -0,0 +1 @@ +../../Task/Sequence-of-primorial-primes/REXX \ No newline at end of file diff --git a/Lang/REXX/Sieve-of-Pritchard b/Lang/REXX/Sieve-of-Pritchard new file mode 120000 index 0000000000..601b18d906 --- /dev/null +++ b/Lang/REXX/Sieve-of-Pritchard @@ -0,0 +1 @@ +../../Task/Sieve-of-Pritchard/REXX \ No newline at end of file diff --git a/Lang/REXX/Sorting-Algorithms-Circle-Sort b/Lang/REXX/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 383d356065..0000000000 --- a/Lang/REXX/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/REXX \ No newline at end of file diff --git a/Lang/REXX/Verhoeff-algorithm b/Lang/REXX/Verhoeff-algorithm new file mode 120000 index 0000000000..0bc439ccea --- /dev/null +++ b/Lang/REXX/Verhoeff-algorithm @@ -0,0 +1 @@ +../../Task/Verhoeff-algorithm/REXX \ No newline at end of file diff --git a/Lang/REXX/Web-scraping b/Lang/REXX/Web-scraping new file mode 120000 index 0000000000..818c9c985e --- /dev/null +++ b/Lang/REXX/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/REXX \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/00-LANG.txt b/Lang/RISC-V-Assembly/00-LANG.txt index f524ed95fb..3f4a6ea98e 100644 --- a/Lang/RISC-V-Assembly/00-LANG.txt +++ b/Lang/RISC-V-Assembly/00-LANG.txt @@ -1,4 +1,79 @@ {{language|RISC-V Assembly}}[https://riscv.org Risc-V] is an open source hardware instruction set architecture based on the principle of a '''R'''educed '''I'''nstruction '''S'''et '''C'''omputer. The project was started by the university of California, Berkeley in 2010. This site refers to the Risc-V assembly language. ([https://en.wikipedia.org/wiki/RISC-V#Software Wikipedia page]), Website: [https://riscv.org https://riscv.org]. +'''Riscv on raspberry pico 2''' + +A pico2 with the chip rp2335 contains 2 cores hazard3 with risc v assembly +it is possible to programm assembly riscv with the sdk C++ and a compiler riscv32-unknown-elf-as.exe + +It is also possible to programm without SDK but it is necessary to write functions for init +the clocks and to communicate for usb connexion. + +install under Windows11 (or see documentation raspberry py pico SDK) : + +Create main folder (ex : \pico2) + +install SDK C++ (see instructions in raspberry pi pico2 SDK documentation) + +install toolchaine under \Pico2\tools\bin from + +https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/riscv-toolchain-14-x64-win.zip + + +Create work folder (ex : \pico2\hello) + +Create file CMakeLists.txt (see instructions in raspberry pi pico2 SDK documentation) + +Create program hello.s with a editor + +Copy a file pico_sdk_import.cmake from \pico2\pico-sdk\external + +Create a folder build under \pico2\hello + +Go to this folder + +Compile program with : + + cmake -DPICO_PLATFORM=rp2350-riscv -DPICO_TOOLCHAIN_PATH=E:\Pico2\tools\bin -G "NMake Makefiles" .. + +and + nmake + +copy the file .uf2 to raspberry pico2 (see documentation raspberry pi pico2) + +Start serial connexion on host (ex: putty on windows11) + +Example CMakeLists.txt : + +cmake_minimum_required(VERSION 3.13) + +include(pico_sdk_import.cmake) + +project(hello C CXX ASM) + +set(CMAKE_C_STANDARD 11) + +set(CMAKE_CXX_STANDARD 17) + +pico_sdk_init() + +add_executable(hello +hello.s # pgm source assembly riscv +) + +target_link_libraries(hello pico_stdlib) + +pico_enable_stdio_usb(hello 1) + +pico_enable_stdio_uart(hello 0) + +pico_add_extra_outputs(hello) + + +see source program on hello world rosetta code + +cmake -DPython3_EXECUTABLE=C:\Users\Vincent\AppData\Local\Microsoft\WindowsApps\python3.10.exe -DPICO_PLATFORM=rp2350-riscv -DPICO_TOOLCHAIN_PATH=E:\Pico2\tools\bin -DPICO_SDK_PATH=..\..\..\pico-sdk -G "NMake Makefiles" .. + +see instructions list on chapter 3.8.1.6. Alphabetical list of instructions on rp2350 datasheet + [[Category:Assembler language]] [[Category:Assembly]] \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Address-of-a-variable b/Lang/RISC-V-Assembly/Address-of-a-variable new file mode 120000 index 0000000000..7e7b85f7fc --- /dev/null +++ b/Lang/RISC-V-Assembly/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Arithmetic-Integer b/Lang/RISC-V-Assembly/Arithmetic-Integer new file mode 120000 index 0000000000..41172f4754 --- /dev/null +++ b/Lang/RISC-V-Assembly/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Array-length b/Lang/RISC-V-Assembly/Array-length new file mode 120000 index 0000000000..51b567c37e --- /dev/null +++ b/Lang/RISC-V-Assembly/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Binary-digits b/Lang/RISC-V-Assembly/Binary-digits new file mode 120000 index 0000000000..45c4e871d7 --- /dev/null +++ b/Lang/RISC-V-Assembly/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Binary-search b/Lang/RISC-V-Assembly/Binary-search new file mode 120000 index 0000000000..ad0fc6f909 --- /dev/null +++ b/Lang/RISC-V-Assembly/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Bitwise-operations b/Lang/RISC-V-Assembly/Bitwise-operations new file mode 120000 index 0000000000..d2de2c0d91 --- /dev/null +++ b/Lang/RISC-V-Assembly/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Compare-length-of-two-strings b/Lang/RISC-V-Assembly/Compare-length-of-two-strings new file mode 120000 index 0000000000..b61a06982a --- /dev/null +++ b/Lang/RISC-V-Assembly/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Conditional-structures b/Lang/RISC-V-Assembly/Conditional-structures new file mode 120000 index 0000000000..2fb608a736 --- /dev/null +++ b/Lang/RISC-V-Assembly/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Count-in-octal b/Lang/RISC-V-Assembly/Count-in-octal new file mode 120000 index 0000000000..bf7e472328 --- /dev/null +++ b/Lang/RISC-V-Assembly/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Determine-if-a-string-is-numeric b/Lang/RISC-V-Assembly/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..fe9d1269a0 --- /dev/null +++ b/Lang/RISC-V-Assembly/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Doubly-linked-list-Definition b/Lang/RISC-V-Assembly/Doubly-linked-list-Definition new file mode 120000 index 0000000000..f016184b4e --- /dev/null +++ b/Lang/RISC-V-Assembly/Doubly-linked-list-Definition @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Definition/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Factorial b/Lang/RISC-V-Assembly/Factorial new file mode 120000 index 0000000000..d4cbcd152f --- /dev/null +++ b/Lang/RISC-V-Assembly/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Factors-of-an-integer b/Lang/RISC-V-Assembly/Factors-of-an-integer new file mode 120000 index 0000000000..e6286a7691 --- /dev/null +++ b/Lang/RISC-V-Assembly/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/FizzBuzz b/Lang/RISC-V-Assembly/FizzBuzz new file mode 120000 index 0000000000..fa85a0bece --- /dev/null +++ b/Lang/RISC-V-Assembly/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Guess-the-number b/Lang/RISC-V-Assembly/Guess-the-number new file mode 120000 index 0000000000..3c820e8397 --- /dev/null +++ b/Lang/RISC-V-Assembly/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Hello-world-Newbie b/Lang/RISC-V-Assembly/Hello-world-Newbie new file mode 120000 index 0000000000..5721ad4125 --- /dev/null +++ b/Lang/RISC-V-Assembly/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Include-a-file b/Lang/RISC-V-Assembly/Include-a-file new file mode 120000 index 0000000000..2742cb0a60 --- /dev/null +++ b/Lang/RISC-V-Assembly/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Integer-comparison b/Lang/RISC-V-Assembly/Integer-comparison new file mode 120000 index 0000000000..c89ef738d7 --- /dev/null +++ b/Lang/RISC-V-Assembly/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Jump-anywhere b/Lang/RISC-V-Assembly/Jump-anywhere new file mode 120000 index 0000000000..97bc1d7493 --- /dev/null +++ b/Lang/RISC-V-Assembly/Jump-anywhere @@ -0,0 +1 @@ +../../Task/Jump-anywhere/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Logical-operations b/Lang/RISC-V-Assembly/Logical-operations new file mode 120000 index 0000000000..c149f117e3 --- /dev/null +++ b/Lang/RISC-V-Assembly/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Loops-Do-while b/Lang/RISC-V-Assembly/Loops-Do-while new file mode 120000 index 0000000000..c6ea94d0bd --- /dev/null +++ b/Lang/RISC-V-Assembly/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Loops-For b/Lang/RISC-V-Assembly/Loops-For new file mode 120000 index 0000000000..eb2a1946a7 --- /dev/null +++ b/Lang/RISC-V-Assembly/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Loops-While b/Lang/RISC-V-Assembly/Loops-While new file mode 120000 index 0000000000..aefdc14d66 --- /dev/null +++ b/Lang/RISC-V-Assembly/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Loops-With-multiple-ranges b/Lang/RISC-V-Assembly/Loops-With-multiple-ranges new file mode 120000 index 0000000000..e4ac51774c --- /dev/null +++ b/Lang/RISC-V-Assembly/Loops-With-multiple-ranges @@ -0,0 +1 @@ +../../Task/Loops-With-multiple-ranges/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Primality-by-trial-division b/Lang/RISC-V-Assembly/Primality-by-trial-division new file mode 120000 index 0000000000..2d5326d125 --- /dev/null +++ b/Lang/RISC-V-Assembly/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Sieve-of-Eratosthenes b/Lang/RISC-V-Assembly/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..048e79765f --- /dev/null +++ b/Lang/RISC-V-Assembly/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Singly-linked-list-Element-definition b/Lang/RISC-V-Assembly/Singly-linked-list-Element-definition new file mode 120000 index 0000000000..c46a1c1483 --- /dev/null +++ b/Lang/RISC-V-Assembly/Singly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-definition/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Singly-linked-list-Element-insertion b/Lang/RISC-V-Assembly/Singly-linked-list-Element-insertion new file mode 120000 index 0000000000..3942e77b33 --- /dev/null +++ b/Lang/RISC-V-Assembly/Singly-linked-list-Element-insertion @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-insertion/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Singly-linked-list-Traversal b/Lang/RISC-V-Assembly/Singly-linked-list-Traversal new file mode 120000 index 0000000000..704ea88764 --- /dev/null +++ b/Lang/RISC-V-Assembly/Singly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Traversal/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Sorting-algorithms-Bubble-sort b/Lang/RISC-V-Assembly/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..eb7e9f655b --- /dev/null +++ b/Lang/RISC-V-Assembly/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Sorting-algorithms-Heapsort b/Lang/RISC-V-Assembly/Sorting-algorithms-Heapsort new file mode 120000 index 0000000000..623c46da1a --- /dev/null +++ b/Lang/RISC-V-Assembly/Sorting-algorithms-Heapsort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Heapsort/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Sorting-algorithms-Insertion-sort b/Lang/RISC-V-Assembly/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..3748bff361 --- /dev/null +++ b/Lang/RISC-V-Assembly/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Sorting-algorithms-Merge-sort b/Lang/RISC-V-Assembly/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..e189625c7b --- /dev/null +++ b/Lang/RISC-V-Assembly/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Sorting-algorithms-Patience-sort b/Lang/RISC-V-Assembly/Sorting-algorithms-Patience-sort new file mode 120000 index 0000000000..ff4a528100 --- /dev/null +++ b/Lang/RISC-V-Assembly/Sorting-algorithms-Patience-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Patience-sort/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Sorting-algorithms-Quicksort b/Lang/RISC-V-Assembly/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..61ec2d6c95 --- /dev/null +++ b/Lang/RISC-V-Assembly/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Sorting-algorithms-Selection-sort b/Lang/RISC-V-Assembly/Sorting-algorithms-Selection-sort new file mode 120000 index 0000000000..dc2705e303 --- /dev/null +++ b/Lang/RISC-V-Assembly/Sorting-algorithms-Selection-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Selection-sort/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Sorting-algorithms-Shell-sort b/Lang/RISC-V-Assembly/Sorting-algorithms-Shell-sort new file mode 120000 index 0000000000..3181770874 --- /dev/null +++ b/Lang/RISC-V-Assembly/Sorting-algorithms-Shell-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Shell-sort/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/String-append b/Lang/RISC-V-Assembly/String-append new file mode 120000 index 0000000000..c4e4abff3f --- /dev/null +++ b/Lang/RISC-V-Assembly/String-append @@ -0,0 +1 @@ +../../Task/String-append/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/String-comparison b/Lang/RISC-V-Assembly/String-comparison new file mode 120000 index 0000000000..05a600887a --- /dev/null +++ b/Lang/RISC-V-Assembly/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/String-concatenation b/Lang/RISC-V-Assembly/String-concatenation new file mode 120000 index 0000000000..14bea49904 --- /dev/null +++ b/Lang/RISC-V-Assembly/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/String-interpolation-included- b/Lang/RISC-V-Assembly/String-interpolation-included- new file mode 120000 index 0000000000..d5a6926006 --- /dev/null +++ b/Lang/RISC-V-Assembly/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/String-length b/Lang/RISC-V-Assembly/String-length new file mode 120000 index 0000000000..9f0b9ba1b7 --- /dev/null +++ b/Lang/RISC-V-Assembly/String-length @@ -0,0 +1 @@ +../../Task/String-length/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/String-matching b/Lang/RISC-V-Assembly/String-matching new file mode 120000 index 0000000000..daa67c8da0 --- /dev/null +++ b/Lang/RISC-V-Assembly/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/String-prepend b/Lang/RISC-V-Assembly/String-prepend new file mode 120000 index 0000000000..4cf66d1f37 --- /dev/null +++ b/Lang/RISC-V-Assembly/String-prepend @@ -0,0 +1 @@ +../../Task/String-prepend/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Substring b/Lang/RISC-V-Assembly/Substring new file mode 120000 index 0000000000..346f148efa --- /dev/null +++ b/Lang/RISC-V-Assembly/Substring @@ -0,0 +1 @@ +../../Task/Substring/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Tree-traversal b/Lang/RISC-V-Assembly/Tree-traversal new file mode 120000 index 0000000000..e386a26400 --- /dev/null +++ b/Lang/RISC-V-Assembly/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RISC-V-Assembly/Visualize-a-tree b/Lang/RISC-V-Assembly/Visualize-a-tree new file mode 120000 index 0000000000..20ab2b2342 --- /dev/null +++ b/Lang/RISC-V-Assembly/Visualize-a-tree @@ -0,0 +1 @@ +../../Task/Visualize-a-tree/RISC-V-Assembly \ No newline at end of file diff --git a/Lang/RPL/00-LANG.txt b/Lang/RPL/00-LANG.txt index baf7c8a3a4..ec09c25906 100644 --- a/Lang/RPL/00-LANG.txt +++ b/Lang/RPL/00-LANG.txt @@ -10,9 +10,9 @@ |site=https://en.wikipedia.org/wiki/RPL_(programming_language) }} -'''RPL''' (an acronym for '''Reverse Polish Lisp''') is the onboard calculator language for the HP-28 and [[wp:HP 48 series|HP 48]] lines of graphing calculators. It is a stack language (not a [[Lisp]]-like language, as its name implies), tightly integrated with the calculator system, with many instructions similar to Forth. +'''RPL''' (an acronym for '''Reverse Polish Lisp''') is the onboard calculator language for the HP-28, [[wp:HP 48 series|HP 48]] and HP-49/50 lines of graphing calculators. It is a stack language (not a [[Lisp]]-like language, as its name implies), tightly integrated with the calculator system, with many instructions similar to Forth. -It can natively handle unsigned integers (named ''binary integers''), floating-point numbers (named ''real numbers''), complex numbers, vectors and matrices (named ''arrays''), lists, character strings, and algebraic expressions. +It can natively handle unsigned integers (named ''binary integers''), floating-point numbers (named ''real numbers''), complex numbers, vectors and matrices (named ''arrays''), lists, character strings, and algebraic expressions. The HP-49/50 models can also handle long integers (up to 500 digits) and benefit from several dedicated built-in functions to work with, including testing and generation of prime numbers. There are actually two languages with the name RPL: '''User RPL''' and '''System RPL'''. System RPL is used in implementing the operating system, and User RPL is the language users use to write programs on the calculator. System RPL is highly hardware-dependent, whilst User RPL is upwardly compatible. diff --git a/Lang/RPL/Averages-Arithmetic-mean b/Lang/RPL/Averages-Arithmetic-mean deleted file mode 120000 index 44479b0504..0000000000 --- a/Lang/RPL/Averages-Arithmetic-mean +++ /dev/null @@ -1 +0,0 @@ -../../Task/Averages-Arithmetic-mean/RPL \ No newline at end of file diff --git a/Lang/RPL/Guess-the-number b/Lang/RPL/Guess-the-number deleted file mode 120000 index c108a4519e..0000000000 --- a/Lang/RPL/Guess-the-number +++ /dev/null @@ -1 +0,0 @@ -../../Task/Guess-the-number/RPL \ No newline at end of file diff --git a/Lang/RTL-2/00-LANG.txt b/Lang/RTL-2/00-LANG.txt index 4f020fcdf0..1ed7c9f33f 100644 --- a/Lang/RTL-2/00-LANG.txt +++ b/Lang/RTL-2/00-LANG.txt @@ -52,6 +52,9 @@ While the specifics varied by operating system the following is an example of a This code insert moves the value of a variable passed into the RTL/2 procedure into a variable called COUNTER in a data brick called MYDATA. +== Design and Rationale == +J. G. P. Barnes describes RTL/2 and the reasons behind some of the design decisions made during its development in his 1976 book RTL/2 Design and Philosophy. + == Reserved Words == ABS AND @@ -83,6 +86,7 @@ LENGTH LET LOR MOD +MODE NEV NOT OCT diff --git a/Lang/Racket/Arithmetic-derivative b/Lang/Racket/Arithmetic-derivative new file mode 120000 index 0000000000..67478aafca --- /dev/null +++ b/Lang/Racket/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Racket \ No newline at end of file diff --git a/Lang/Racket/Bioinformatics-base-count b/Lang/Racket/Bioinformatics-base-count deleted file mode 120000 index e2d3d89548..0000000000 --- a/Lang/Racket/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Racket \ No newline at end of file diff --git a/Lang/Racket/Miller-Rabin-primality-test b/Lang/Racket/Miller-Rabin-primality-test deleted file mode 120000 index db07b51bff..0000000000 --- a/Lang/Racket/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Racket \ No newline at end of file diff --git a/Lang/Racket/Quaternion-type b/Lang/Racket/Quaternion-type deleted file mode 120000 index 88e3ea41c9..0000000000 --- a/Lang/Racket/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Racket \ No newline at end of file diff --git a/Lang/Racket/Rare-numbers b/Lang/Racket/Rare-numbers new file mode 120000 index 0000000000..1d2887fcdc --- /dev/null +++ b/Lang/Racket/Rare-numbers @@ -0,0 +1 @@ +../../Task/Rare-numbers/Racket \ No newline at end of file diff --git a/Lang/Racket/Sorting-Algorithms-Circle-Sort b/Lang/Racket/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 4c351d18cc..0000000000 --- a/Lang/Racket/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Racket \ No newline at end of file diff --git a/Lang/Racket/Strassens-algorithm b/Lang/Racket/Strassens-algorithm new file mode 120000 index 0000000000..c6d669358e --- /dev/null +++ b/Lang/Racket/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Racket \ No newline at end of file diff --git a/Lang/Racket/Twos-complement b/Lang/Racket/Twos-complement new file mode 120000 index 0000000000..0d85b62ede --- /dev/null +++ b/Lang/Racket/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Racket \ No newline at end of file diff --git a/Lang/Raku/B-zier-curves-Intersections b/Lang/Raku/B-zier-curves-Intersections new file mode 120000 index 0000000000..3ceca0a2d5 --- /dev/null +++ b/Lang/Raku/B-zier-curves-Intersections @@ -0,0 +1 @@ +../../Task/B-zier-curves-Intersections/Raku \ No newline at end of file diff --git a/Lang/Raku/Bioinformatics-base-count b/Lang/Raku/Bioinformatics-base-count deleted file mode 120000 index 7d4ea3da69..0000000000 --- a/Lang/Raku/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Raku \ No newline at end of file diff --git a/Lang/Raku/Catmull-Clark-subdivision-surface b/Lang/Raku/Catmull-Clark-subdivision-surface new file mode 120000 index 0000000000..ca92993d5e --- /dev/null +++ b/Lang/Raku/Catmull-Clark-subdivision-surface @@ -0,0 +1 @@ +../../Task/Catmull-Clark-subdivision-surface/Raku \ No newline at end of file diff --git a/Lang/Raku/Dominoes b/Lang/Raku/Dominoes new file mode 120000 index 0000000000..48ba3c99bf --- /dev/null +++ b/Lang/Raku/Dominoes @@ -0,0 +1 @@ +../../Task/Dominoes/Raku \ No newline at end of file diff --git a/Lang/Raku/Meissel-Mertens-constant b/Lang/Raku/Meissel-Mertens-constant deleted file mode 120000 index 5a835b7f73..0000000000 --- a/Lang/Raku/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Raku \ No newline at end of file diff --git a/Lang/Raku/Miller-Rabin-primality-test b/Lang/Raku/Miller-Rabin-primality-test deleted file mode 120000 index 5ec2c83bd9..0000000000 --- a/Lang/Raku/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Raku \ No newline at end of file diff --git a/Lang/Raku/Play-recorded-sounds b/Lang/Raku/Play-recorded-sounds new file mode 120000 index 0000000000..7d18ecbdee --- /dev/null +++ b/Lang/Raku/Play-recorded-sounds @@ -0,0 +1 @@ +../../Task/Play-recorded-sounds/Raku \ No newline at end of file diff --git a/Lang/Raku/Quaternion-type b/Lang/Raku/Quaternion-type deleted file mode 120000 index 3333adafb6..0000000000 --- a/Lang/Raku/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Raku \ No newline at end of file diff --git a/Lang/Raku/Simple-turtle-graphics b/Lang/Raku/Simple-turtle-graphics new file mode 120000 index 0000000000..496cec69f4 --- /dev/null +++ b/Lang/Raku/Simple-turtle-graphics @@ -0,0 +1 @@ +../../Task/Simple-turtle-graphics/Raku \ No newline at end of file diff --git a/Lang/Raku/Sorting-Algorithms-Circle-Sort b/Lang/Raku/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 1ba8b44162..0000000000 --- a/Lang/Raku/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Raku \ No newline at end of file diff --git a/Lang/RapidQ/Levenshtein-distance b/Lang/RapidQ/Levenshtein-distance new file mode 120000 index 0000000000..43ee94415c --- /dev/null +++ b/Lang/RapidQ/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/RapidQ \ No newline at end of file diff --git a/Lang/RapidQ/Map-range b/Lang/RapidQ/Map-range new file mode 120000 index 0000000000..a3da155381 --- /dev/null +++ b/Lang/RapidQ/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/RapidQ \ No newline at end of file diff --git a/Lang/RapidQ/Nth-root b/Lang/RapidQ/Nth-root new file mode 120000 index 0000000000..f4c270323f --- /dev/null +++ b/Lang/RapidQ/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/RapidQ \ No newline at end of file diff --git a/Lang/RapidQ/Temperature-conversion b/Lang/RapidQ/Temperature-conversion new file mode 120000 index 0000000000..757db1c288 --- /dev/null +++ b/Lang/RapidQ/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/RapidQ \ No newline at end of file diff --git a/Lang/Rebol/00-LANG.txt b/Lang/Rebol/00-LANG.txt new file mode 100644 index 0000000000..4aa183678a --- /dev/null +++ b/Lang/Rebol/00-LANG.txt @@ -0,0 +1,32 @@ +{{language|Rebol +|site=http://rebol.com +|strength=strong +|checking=dynamic +|gc=yes +|exec=interpreted +|tags=rebol, REBOL}} + +{{Language programming paradigm|Dynamic}} +{{Language programming paradigm|Declarative}} +{{Language programming paradigm|Functional}} +{{Language programming paradigm|Event-driven}} +{{Language programming paradigm|Reflective}} +{{Language programming paradigm|Procedural}} +{{Language programming paradigm|Imperative}} +{{Language programming paradigm|Concurrent}} +{{Language programming paradigm|Distributed}} + +Another entry (before merge) is available at [https://rosettacode.org/wiki/Category:REBOL Category:REBOL] + +'''Rebol''' (originally named '''REBOL''') stands for Relative Expression Based Object Language and was designed by Carl Sassenrath to combat unnecessary software complexity through a language-centric approach. Rebol has been around since about 1998, with [https://www.rebol.com/downloads.html Rebol 2 widely available] and free to use across many platforms. In December 2012, the Rebol 3 (R3) interpreter was [https://github.com/rebol/rebol/ released as open source] under the Apache 2.0 license. Today, an actively maintained community fork of Rebol 3 is available at https://github.com/Oldes/Rebol3/ with [https://github.com/Oldes/Rebol3/releases current releases and binaries]. This fork's goal is to keep the code close to the original design while improving usability, maintainability, and buildability. + +The functions dictionary for the latest available Rebol version can be found at: https://rebol.tech/docs/functions.html + +==Todo== +[https://rosettacode.org/wiki/Tasks_not_implemented_in_Rebol Tasks not implemented in Rebol] + +==Useful links== +* [http://www.rebol.com Original (outdated) Rebol site] +* [https://github.com/Oldes/Rebol3 Rebol3 source] on Github (active development). +* [https://rebol.zulipchat.com/ Rebol Zulip chat]. +* [https://app.element.io/#/room/#Rebol3:gitter.im Rebol Matrix chat]. \ No newline at end of file diff --git a/Lang/Rebol/00-META.yaml b/Lang/Rebol/00-META.yaml new file mode 100644 index 0000000000..1edb7cbb3e --- /dev/null +++ b/Lang/Rebol/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Rebol diff --git a/Lang/Rebol/100-doors b/Lang/Rebol/100-doors new file mode 120000 index 0000000000..5b331a9eba --- /dev/null +++ b/Lang/Rebol/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Rebol \ No newline at end of file diff --git a/Lang/Rebol/100-prisoners b/Lang/Rebol/100-prisoners new file mode 120000 index 0000000000..97501a6eb7 --- /dev/null +++ b/Lang/Rebol/100-prisoners @@ -0,0 +1 @@ +../../Task/100-prisoners/Rebol \ No newline at end of file diff --git a/Lang/Rebol/15-puzzle-game b/Lang/Rebol/15-puzzle-game new file mode 120000 index 0000000000..067f887d80 --- /dev/null +++ b/Lang/Rebol/15-puzzle-game @@ -0,0 +1 @@ +../../Task/15-puzzle-game/Rebol \ No newline at end of file diff --git a/Lang/Rebol/21-game b/Lang/Rebol/21-game new file mode 120000 index 0000000000..26c96de104 --- /dev/null +++ b/Lang/Rebol/21-game @@ -0,0 +1 @@ +../../Task/21-game/Rebol \ No newline at end of file diff --git a/Lang/Rebol/24-game b/Lang/Rebol/24-game new file mode 120000 index 0000000000..da2db22523 --- /dev/null +++ b/Lang/Rebol/24-game @@ -0,0 +1 @@ +../../Task/24-game/Rebol \ No newline at end of file diff --git a/Lang/Rebol/9-billion-names-of-God-the-integer b/Lang/Rebol/9-billion-names-of-God-the-integer new file mode 120000 index 0000000000..73577ad2b4 --- /dev/null +++ b/Lang/Rebol/9-billion-names-of-God-the-integer @@ -0,0 +1 @@ +../../Task/9-billion-names-of-God-the-integer/Rebol \ No newline at end of file diff --git a/Lang/Rebol/99-bottles-of-beer b/Lang/Rebol/99-bottles-of-beer new file mode 120000 index 0000000000..5fa8a19390 --- /dev/null +++ b/Lang/Rebol/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/Rebol \ No newline at end of file diff --git a/Lang/Rebol/A+B b/Lang/Rebol/A+B new file mode 120000 index 0000000000..b25e6fbd34 --- /dev/null +++ b/Lang/Rebol/A+B @@ -0,0 +1 @@ +../../Task/A+B/Rebol \ No newline at end of file diff --git a/Lang/Rebol/ABC-problem b/Lang/Rebol/ABC-problem new file mode 120000 index 0000000000..4e6e666878 --- /dev/null +++ b/Lang/Rebol/ABC-problem @@ -0,0 +1 @@ +../../Task/ABC-problem/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Abbreviations-automatic b/Lang/Rebol/Abbreviations-automatic new file mode 120000 index 0000000000..85b470e105 --- /dev/null +++ b/Lang/Rebol/Abbreviations-automatic @@ -0,0 +1 @@ +../../Task/Abbreviations-automatic/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Abbreviations-easy b/Lang/Rebol/Abbreviations-easy new file mode 120000 index 0000000000..f54524f132 --- /dev/null +++ b/Lang/Rebol/Abbreviations-easy @@ -0,0 +1 @@ +../../Task/Abbreviations-easy/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Abbreviations-simple b/Lang/Rebol/Abbreviations-simple new file mode 120000 index 0000000000..1036d0a126 --- /dev/null +++ b/Lang/Rebol/Abbreviations-simple @@ -0,0 +1 @@ +../../Task/Abbreviations-simple/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Abelian-sandpile-model-Identity b/Lang/Rebol/Abelian-sandpile-model-Identity new file mode 120000 index 0000000000..fa169923d8 --- /dev/null +++ b/Lang/Rebol/Abelian-sandpile-model-Identity @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model-Identity/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Abstract-type b/Lang/Rebol/Abstract-type new file mode 120000 index 0000000000..98f9214f95 --- /dev/null +++ b/Lang/Rebol/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Abundant-odd-numbers b/Lang/Rebol/Abundant-odd-numbers new file mode 120000 index 0000000000..3a7c4247e0 --- /dev/null +++ b/Lang/Rebol/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Accumulator-factory b/Lang/Rebol/Accumulator-factory new file mode 120000 index 0000000000..2ad70f64ad --- /dev/null +++ b/Lang/Rebol/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Ackermann-function b/Lang/Rebol/Ackermann-function new file mode 120000 index 0000000000..699a619796 --- /dev/null +++ b/Lang/Rebol/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Add-a-variable-to-a-class-instance-at-runtime b/Lang/Rebol/Add-a-variable-to-a-class-instance-at-runtime new file mode 120000 index 0000000000..a74659ec86 --- /dev/null +++ b/Lang/Rebol/Add-a-variable-to-a-class-instance-at-runtime @@ -0,0 +1 @@ +../../Task/Add-a-variable-to-a-class-instance-at-runtime/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Additive-primes b/Lang/Rebol/Additive-primes new file mode 120000 index 0000000000..1f4da61e10 --- /dev/null +++ b/Lang/Rebol/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Align-columns b/Lang/Rebol/Align-columns new file mode 120000 index 0000000000..f1de5b19b7 --- /dev/null +++ b/Lang/Rebol/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Almost-prime b/Lang/Rebol/Almost-prime new file mode 120000 index 0000000000..485728d591 --- /dev/null +++ b/Lang/Rebol/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Amb b/Lang/Rebol/Amb new file mode 120000 index 0000000000..ada18b3a53 --- /dev/null +++ b/Lang/Rebol/Amb @@ -0,0 +1 @@ +../../Task/Amb/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Amicable-pairs b/Lang/Rebol/Amicable-pairs new file mode 120000 index 0000000000..7715d03a59 --- /dev/null +++ b/Lang/Rebol/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Anagrams b/Lang/Rebol/Anagrams new file mode 120000 index 0000000000..19dbe7b94f --- /dev/null +++ b/Lang/Rebol/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Anagrams-Deranged-anagrams b/Lang/Rebol/Anagrams-Deranged-anagrams new file mode 120000 index 0000000000..dc92d83901 --- /dev/null +++ b/Lang/Rebol/Anagrams-Deranged-anagrams @@ -0,0 +1 @@ +../../Task/Anagrams-Deranged-anagrams/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Animation b/Lang/Rebol/Animation new file mode 120000 index 0000000000..9bc983a74f --- /dev/null +++ b/Lang/Rebol/Animation @@ -0,0 +1 @@ +../../Task/Animation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Anonymous-recursion b/Lang/Rebol/Anonymous-recursion new file mode 120000 index 0000000000..bb89ba8ad2 --- /dev/null +++ b/Lang/Rebol/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Anti-primes b/Lang/Rebol/Anti-primes new file mode 120000 index 0000000000..a605291c15 --- /dev/null +++ b/Lang/Rebol/Anti-primes @@ -0,0 +1 @@ +../../Task/Anti-primes/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Apply-a-callback-to-an-array b/Lang/Rebol/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..846524932e --- /dev/null +++ b/Lang/Rebol/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Archimedean-spiral b/Lang/Rebol/Archimedean-spiral new file mode 120000 index 0000000000..485754061d --- /dev/null +++ b/Lang/Rebol/Archimedean-spiral @@ -0,0 +1 @@ +../../Task/Archimedean-spiral/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Arena-storage-pool b/Lang/Rebol/Arena-storage-pool new file mode 120000 index 0000000000..261e2b68b6 --- /dev/null +++ b/Lang/Rebol/Arena-storage-pool @@ -0,0 +1 @@ +../../Task/Arena-storage-pool/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Arithmetic-Integer b/Lang/Rebol/Arithmetic-Integer new file mode 120000 index 0000000000..beda640d8b --- /dev/null +++ b/Lang/Rebol/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Arithmetic-evaluation b/Lang/Rebol/Arithmetic-evaluation new file mode 120000 index 0000000000..eace662534 --- /dev/null +++ b/Lang/Rebol/Arithmetic-evaluation @@ -0,0 +1 @@ +../../Task/Arithmetic-evaluation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Array-concatenation b/Lang/Rebol/Array-concatenation new file mode 120000 index 0000000000..54981e3b27 --- /dev/null +++ b/Lang/Rebol/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Array-length b/Lang/Rebol/Array-length new file mode 120000 index 0000000000..b057893924 --- /dev/null +++ b/Lang/Rebol/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Arrays b/Lang/Rebol/Arrays new file mode 120000 index 0000000000..c2505cc17f --- /dev/null +++ b/Lang/Rebol/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Assertions b/Lang/Rebol/Assertions new file mode 120000 index 0000000000..410d203693 --- /dev/null +++ b/Lang/Rebol/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Associative-array-Creation b/Lang/Rebol/Associative-array-Creation new file mode 120000 index 0000000000..ed84b3cd74 --- /dev/null +++ b/Lang/Rebol/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Attractive-numbers b/Lang/Rebol/Attractive-numbers new file mode 120000 index 0000000000..bd3dc833b3 --- /dev/null +++ b/Lang/Rebol/Attractive-numbers @@ -0,0 +1 @@ +../../Task/Attractive-numbers/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Averages-Arithmetic-mean b/Lang/Rebol/Averages-Arithmetic-mean new file mode 120000 index 0000000000..1b2f7cd050 --- /dev/null +++ b/Lang/Rebol/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Averages-Median b/Lang/Rebol/Averages-Median new file mode 120000 index 0000000000..308cc999e7 --- /dev/null +++ b/Lang/Rebol/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Babbage-problem b/Lang/Rebol/Babbage-problem new file mode 120000 index 0000000000..da5afb5375 --- /dev/null +++ b/Lang/Rebol/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Babylonian-spiral b/Lang/Rebol/Babylonian-spiral new file mode 120000 index 0000000000..18aac82eae --- /dev/null +++ b/Lang/Rebol/Babylonian-spiral @@ -0,0 +1 @@ +../../Task/Babylonian-spiral/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Balanced-brackets b/Lang/Rebol/Balanced-brackets new file mode 120000 index 0000000000..99271027bc --- /dev/null +++ b/Lang/Rebol/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Barnsley-fern b/Lang/Rebol/Barnsley-fern new file mode 120000 index 0000000000..e98ef998d2 --- /dev/null +++ b/Lang/Rebol/Barnsley-fern @@ -0,0 +1 @@ +../../Task/Barnsley-fern/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Base64-decode-data b/Lang/Rebol/Base64-decode-data new file mode 120000 index 0000000000..0ea7b555cb --- /dev/null +++ b/Lang/Rebol/Base64-decode-data @@ -0,0 +1 @@ +../../Task/Base64-decode-data/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Bifid-cipher b/Lang/Rebol/Bifid-cipher new file mode 120000 index 0000000000..b00839dd98 --- /dev/null +++ b/Lang/Rebol/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Binary-digits b/Lang/Rebol/Binary-digits new file mode 120000 index 0000000000..7cb2d23198 --- /dev/null +++ b/Lang/Rebol/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Binary-strings b/Lang/Rebol/Binary-strings new file mode 120000 index 0000000000..9671e7ddf3 --- /dev/null +++ b/Lang/Rebol/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Biorhythms b/Lang/Rebol/Biorhythms new file mode 120000 index 0000000000..7e80c97327 --- /dev/null +++ b/Lang/Rebol/Biorhythms @@ -0,0 +1 @@ +../../Task/Biorhythms/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Bitcoin-address-validation b/Lang/Rebol/Bitcoin-address-validation new file mode 120000 index 0000000000..9344a9c4c3 --- /dev/null +++ b/Lang/Rebol/Bitcoin-address-validation @@ -0,0 +1 @@ +../../Task/Bitcoin-address-validation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Bitmap b/Lang/Rebol/Bitmap new file mode 120000 index 0000000000..629709bef1 --- /dev/null +++ b/Lang/Rebol/Bitmap @@ -0,0 +1 @@ +../../Task/Bitmap/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Bitmap-Flood-fill b/Lang/Rebol/Bitmap-Flood-fill new file mode 120000 index 0000000000..af82299463 --- /dev/null +++ b/Lang/Rebol/Bitmap-Flood-fill @@ -0,0 +1 @@ +../../Task/Bitmap-Flood-fill/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Bitmap-Histogram b/Lang/Rebol/Bitmap-Histogram new file mode 120000 index 0000000000..3dc33a01e1 --- /dev/null +++ b/Lang/Rebol/Bitmap-Histogram @@ -0,0 +1 @@ +../../Task/Bitmap-Histogram/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Bitmap-Midpoint-circle-algorithm b/Lang/Rebol/Bitmap-Midpoint-circle-algorithm new file mode 120000 index 0000000000..d8a14cc133 --- /dev/null +++ b/Lang/Rebol/Bitmap-Midpoint-circle-algorithm @@ -0,0 +1 @@ +../../Task/Bitmap-Midpoint-circle-algorithm/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Bitmap-Read-a-PPM-file b/Lang/Rebol/Bitmap-Read-a-PPM-file new file mode 120000 index 0000000000..4c8503a5c6 --- /dev/null +++ b/Lang/Rebol/Bitmap-Read-a-PPM-file @@ -0,0 +1 @@ +../../Task/Bitmap-Read-a-PPM-file/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Bitmap-Write-a-PPM-file b/Lang/Rebol/Bitmap-Write-a-PPM-file new file mode 120000 index 0000000000..f47ca4a660 --- /dev/null +++ b/Lang/Rebol/Bitmap-Write-a-PPM-file @@ -0,0 +1 @@ +../../Task/Bitmap-Write-a-PPM-file/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Bitwise-IO b/Lang/Rebol/Bitwise-IO new file mode 120000 index 0000000000..d928c50478 --- /dev/null +++ b/Lang/Rebol/Bitwise-IO @@ -0,0 +1 @@ +../../Task/Bitwise-IO/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Bitwise-operations b/Lang/Rebol/Bitwise-operations new file mode 120000 index 0000000000..ed4b6220a6 --- /dev/null +++ b/Lang/Rebol/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Box-the-compass b/Lang/Rebol/Box-the-compass new file mode 120000 index 0000000000..8772a92d1c --- /dev/null +++ b/Lang/Rebol/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Bulls-and-cows b/Lang/Rebol/Bulls-and-cows new file mode 120000 index 0000000000..acbfc00124 --- /dev/null +++ b/Lang/Rebol/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Bulls-and-cows-Player b/Lang/Rebol/Bulls-and-cows-Player new file mode 120000 index 0000000000..3cce956d9f --- /dev/null +++ b/Lang/Rebol/Bulls-and-cows-Player @@ -0,0 +1 @@ +../../Task/Bulls-and-cows-Player/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Burrows-Wheeler-transform b/Lang/Rebol/Burrows-Wheeler-transform new file mode 120000 index 0000000000..0a3a26dcec --- /dev/null +++ b/Lang/Rebol/Burrows-Wheeler-transform @@ -0,0 +1 @@ +../../Task/Burrows-Wheeler-transform/Rebol \ No newline at end of file diff --git a/Lang/Rebol/CRC-32 b/Lang/Rebol/CRC-32 new file mode 120000 index 0000000000..634c717528 --- /dev/null +++ b/Lang/Rebol/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/Rebol \ No newline at end of file diff --git a/Lang/Rebol/CSV-data-manipulation b/Lang/Rebol/CSV-data-manipulation new file mode 120000 index 0000000000..7ac497a786 --- /dev/null +++ b/Lang/Rebol/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/CSV-to-HTML-translation b/Lang/Rebol/CSV-to-HTML-translation new file mode 120000 index 0000000000..f5ad170ee4 --- /dev/null +++ b/Lang/Rebol/CSV-to-HTML-translation @@ -0,0 +1 @@ +../../Task/CSV-to-HTML-translation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Caesar-cipher b/Lang/Rebol/Caesar-cipher new file mode 120000 index 0000000000..a6b4726d60 --- /dev/null +++ b/Lang/Rebol/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Calendar b/Lang/Rebol/Calendar new file mode 120000 index 0000000000..ab6fe69315 --- /dev/null +++ b/Lang/Rebol/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Calendar---for-REAL-programmers b/Lang/Rebol/Calendar---for-REAL-programmers new file mode 120000 index 0000000000..af1c969dec --- /dev/null +++ b/Lang/Rebol/Calendar---for-REAL-programmers @@ -0,0 +1 @@ +../../Task/Calendar---for-REAL-programmers/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Catalan-numbers b/Lang/Rebol/Catalan-numbers new file mode 120000 index 0000000000..0e39f685c0 --- /dev/null +++ b/Lang/Rebol/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Catalan-numbers-Pascals-triangle b/Lang/Rebol/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..6b1b6d4970 --- /dev/null +++ b/Lang/Rebol/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Character-codes b/Lang/Rebol/Character-codes new file mode 120000 index 0000000000..3daa301cb2 --- /dev/null +++ b/Lang/Rebol/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Check-input-device-is-a-terminal b/Lang/Rebol/Check-input-device-is-a-terminal new file mode 120000 index 0000000000..82d5a1e6e2 --- /dev/null +++ b/Lang/Rebol/Check-input-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-input-device-is-a-terminal/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Check-that-file-exists b/Lang/Rebol/Check-that-file-exists new file mode 120000 index 0000000000..83129a7375 --- /dev/null +++ b/Lang/Rebol/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Chinese-zodiac b/Lang/Rebol/Chinese-zodiac new file mode 120000 index 0000000000..e983432942 --- /dev/null +++ b/Lang/Rebol/Chinese-zodiac @@ -0,0 +1 @@ +../../Task/Chinese-zodiac/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Classes b/Lang/Rebol/Classes new file mode 120000 index 0000000000..19c13253ee --- /dev/null +++ b/Lang/Rebol/Classes @@ -0,0 +1 @@ +../../Task/Classes/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Closures-Value-capture b/Lang/Rebol/Closures-Value-capture new file mode 120000 index 0000000000..c746b0b21a --- /dev/null +++ b/Lang/Rebol/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Color-quantization b/Lang/Rebol/Color-quantization new file mode 120000 index 0000000000..fca9b62778 --- /dev/null +++ b/Lang/Rebol/Color-quantization @@ -0,0 +1 @@ +../../Task/Color-quantization/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Comma-quibbling b/Lang/Rebol/Comma-quibbling new file mode 120000 index 0000000000..8f9382035d --- /dev/null +++ b/Lang/Rebol/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Comments b/Lang/Rebol/Comments new file mode 120000 index 0000000000..1a45f1afdb --- /dev/null +++ b/Lang/Rebol/Comments @@ -0,0 +1 @@ +../../Task/Comments/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Compare-a-list-of-strings b/Lang/Rebol/Compare-a-list-of-strings new file mode 120000 index 0000000000..8b48806d25 --- /dev/null +++ b/Lang/Rebol/Compare-a-list-of-strings @@ -0,0 +1 @@ +../../Task/Compare-a-list-of-strings/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Conways-Game-of-Life b/Lang/Rebol/Conways-Game-of-Life new file mode 120000 index 0000000000..1be297f380 --- /dev/null +++ b/Lang/Rebol/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Copy-a-string b/Lang/Rebol/Copy-a-string new file mode 120000 index 0000000000..713a966385 --- /dev/null +++ b/Lang/Rebol/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Create-a-file b/Lang/Rebol/Create-a-file new file mode 120000 index 0000000000..eb56f3709c --- /dev/null +++ b/Lang/Rebol/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Create-a-two-dimensional-array-at-runtime b/Lang/Rebol/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..2338b1da0a --- /dev/null +++ b/Lang/Rebol/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Create-an-HTML-table b/Lang/Rebol/Create-an-HTML-table new file mode 120000 index 0000000000..479c62b61c --- /dev/null +++ b/Lang/Rebol/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Currency b/Lang/Rebol/Currency new file mode 120000 index 0000000000..918d212fb1 --- /dev/null +++ b/Lang/Rebol/Currency @@ -0,0 +1 @@ +../../Task/Currency/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Currying b/Lang/Rebol/Currying new file mode 120000 index 0000000000..8810de2a28 --- /dev/null +++ b/Lang/Rebol/Currying @@ -0,0 +1 @@ +../../Task/Currying/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Date-format b/Lang/Rebol/Date-format new file mode 120000 index 0000000000..bbad545c0e --- /dev/null +++ b/Lang/Rebol/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Date-manipulation b/Lang/Rebol/Date-manipulation new file mode 120000 index 0000000000..0ef2caa486 --- /dev/null +++ b/Lang/Rebol/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Day-of-the-week b/Lang/Rebol/Day-of-the-week new file mode 120000 index 0000000000..27a96c7aab --- /dev/null +++ b/Lang/Rebol/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Deal-cards-for-FreeCell b/Lang/Rebol/Deal-cards-for-FreeCell new file mode 120000 index 0000000000..6092f801ff --- /dev/null +++ b/Lang/Rebol/Deal-cards-for-FreeCell @@ -0,0 +1 @@ +../../Task/Deal-cards-for-FreeCell/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Delete-a-file b/Lang/Rebol/Delete-a-file new file mode 120000 index 0000000000..60299e91d7 --- /dev/null +++ b/Lang/Rebol/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Detect-division-by-zero b/Lang/Rebol/Detect-division-by-zero new file mode 120000 index 0000000000..fb477e9779 --- /dev/null +++ b/Lang/Rebol/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Determine-if-a-string-is-numeric b/Lang/Rebol/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..6a7216a9d5 --- /dev/null +++ b/Lang/Rebol/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Digital-root b/Lang/Rebol/Digital-root new file mode 120000 index 0000000000..c70057beb3 --- /dev/null +++ b/Lang/Rebol/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Display-a-linear-combination b/Lang/Rebol/Display-a-linear-combination new file mode 120000 index 0000000000..701713c8e0 --- /dev/null +++ b/Lang/Rebol/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Documentation b/Lang/Rebol/Documentation new file mode 120000 index 0000000000..92c3f85b3b --- /dev/null +++ b/Lang/Rebol/Documentation @@ -0,0 +1 @@ +../../Task/Documentation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Dot-product b/Lang/Rebol/Dot-product new file mode 120000 index 0000000000..a29d1db870 --- /dev/null +++ b/Lang/Rebol/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Dragon-curve b/Lang/Rebol/Dragon-curve new file mode 120000 index 0000000000..e192bc1b6c --- /dev/null +++ b/Lang/Rebol/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Draw-a-clock b/Lang/Rebol/Draw-a-clock new file mode 120000 index 0000000000..9c767ac91b --- /dev/null +++ b/Lang/Rebol/Draw-a-clock @@ -0,0 +1 @@ +../../Task/Draw-a-clock/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Draw-a-pixel b/Lang/Rebol/Draw-a-pixel new file mode 120000 index 0000000000..4424b2ecc5 --- /dev/null +++ b/Lang/Rebol/Draw-a-pixel @@ -0,0 +1 @@ +../../Task/Draw-a-pixel/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Dynamic-variable-names b/Lang/Rebol/Dynamic-variable-names new file mode 120000 index 0000000000..36e09e119f --- /dev/null +++ b/Lang/Rebol/Dynamic-variable-names @@ -0,0 +1 @@ +../../Task/Dynamic-variable-names/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Echo-server b/Lang/Rebol/Echo-server new file mode 120000 index 0000000000..cdc4b2fda6 --- /dev/null +++ b/Lang/Rebol/Echo-server @@ -0,0 +1 @@ +../../Task/Echo-server/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Empty-directory b/Lang/Rebol/Empty-directory new file mode 120000 index 0000000000..2945783dae --- /dev/null +++ b/Lang/Rebol/Empty-directory @@ -0,0 +1 @@ +../../Task/Empty-directory/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Empty-program b/Lang/Rebol/Empty-program new file mode 120000 index 0000000000..f34c1f5023 --- /dev/null +++ b/Lang/Rebol/Empty-program @@ -0,0 +1 @@ +../../Task/Empty-program/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Empty-string b/Lang/Rebol/Empty-string new file mode 120000 index 0000000000..33318a0a63 --- /dev/null +++ b/Lang/Rebol/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Enumerations b/Lang/Rebol/Enumerations new file mode 120000 index 0000000000..ba3f469c4e --- /dev/null +++ b/Lang/Rebol/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Environment-variables b/Lang/Rebol/Environment-variables new file mode 120000 index 0000000000..5354438b20 --- /dev/null +++ b/Lang/Rebol/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Ethiopian-multiplication b/Lang/Rebol/Ethiopian-multiplication new file mode 120000 index 0000000000..1671fc4362 --- /dev/null +++ b/Lang/Rebol/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Euler-method b/Lang/Rebol/Euler-method new file mode 120000 index 0000000000..d587d93232 --- /dev/null +++ b/Lang/Rebol/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Eulers-constant-0.5772... b/Lang/Rebol/Eulers-constant-0.5772... new file mode 120000 index 0000000000..02917c130f --- /dev/null +++ b/Lang/Rebol/Eulers-constant-0.5772... @@ -0,0 +1 @@ +../../Task/Eulers-constant-0.5772.../Rebol \ No newline at end of file diff --git a/Lang/Rebol/Evolutionary-algorithm b/Lang/Rebol/Evolutionary-algorithm new file mode 120000 index 0000000000..ccdf89518f --- /dev/null +++ b/Lang/Rebol/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Execute-Brain- b/Lang/Rebol/Execute-Brain- new file mode 120000 index 0000000000..60bfe033c3 --- /dev/null +++ b/Lang/Rebol/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Execute-a-system-command b/Lang/Rebol/Execute-a-system-command new file mode 120000 index 0000000000..14651b49c9 --- /dev/null +++ b/Lang/Rebol/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Exponentiation-order b/Lang/Rebol/Exponentiation-order new file mode 120000 index 0000000000..852ef49526 --- /dev/null +++ b/Lang/Rebol/Exponentiation-order @@ -0,0 +1 @@ +../../Task/Exponentiation-order/Rebol \ No newline at end of file diff --git a/Lang/Rebol/FASTA-format b/Lang/Rebol/FASTA-format new file mode 120000 index 0000000000..40d663436d --- /dev/null +++ b/Lang/Rebol/FASTA-format @@ -0,0 +1 @@ +../../Task/FASTA-format/Rebol \ No newline at end of file diff --git a/Lang/Rebol/FTP b/Lang/Rebol/FTP new file mode 120000 index 0000000000..3480e1937d --- /dev/null +++ b/Lang/Rebol/FTP @@ -0,0 +1 @@ +../../Task/FTP/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Factorial b/Lang/Rebol/Factorial new file mode 120000 index 0000000000..359724a1fc --- /dev/null +++ b/Lang/Rebol/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Factors-of-an-integer b/Lang/Rebol/Factors-of-an-integer new file mode 120000 index 0000000000..9d42008357 --- /dev/null +++ b/Lang/Rebol/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Fibonacci-sequence b/Lang/Rebol/Fibonacci-sequence new file mode 120000 index 0000000000..f57b59f681 --- /dev/null +++ b/Lang/Rebol/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Rebol \ No newline at end of file diff --git a/Lang/Rebol/File-input-output b/Lang/Rebol/File-input-output new file mode 120000 index 0000000000..b8c077dcb5 --- /dev/null +++ b/Lang/Rebol/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/Rebol \ No newline at end of file diff --git a/Lang/Rebol/File-size b/Lang/Rebol/File-size new file mode 120000 index 0000000000..896b2c8e3b --- /dev/null +++ b/Lang/Rebol/File-size @@ -0,0 +1 @@ +../../Task/File-size/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Filter b/Lang/Rebol/Filter new file mode 120000 index 0000000000..eaf8ebe826 --- /dev/null +++ b/Lang/Rebol/Filter @@ -0,0 +1 @@ +../../Task/Filter/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Find-the-last-Sunday-of-each-month b/Lang/Rebol/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..d3b115bfb8 --- /dev/null +++ b/Lang/Rebol/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/Rebol \ No newline at end of file diff --git a/Lang/Rebol/First-class-functions b/Lang/Rebol/First-class-functions new file mode 120000 index 0000000000..5b2c2417e0 --- /dev/null +++ b/Lang/Rebol/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/Rebol \ No newline at end of file diff --git a/Lang/Rebol/First-class-functions-Use-numbers-analogously b/Lang/Rebol/First-class-functions-Use-numbers-analogously new file mode 120000 index 0000000000..de2ebe8414 --- /dev/null +++ b/Lang/Rebol/First-class-functions-Use-numbers-analogously @@ -0,0 +1 @@ +../../Task/First-class-functions-Use-numbers-analogously/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Five-weekends b/Lang/Rebol/Five-weekends new file mode 120000 index 0000000000..01c1c36611 --- /dev/null +++ b/Lang/Rebol/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Fixed-length-records b/Lang/Rebol/Fixed-length-records new file mode 120000 index 0000000000..9039851f51 --- /dev/null +++ b/Lang/Rebol/Fixed-length-records @@ -0,0 +1 @@ +../../Task/Fixed-length-records/Rebol \ No newline at end of file diff --git a/Lang/Rebol/FizzBuzz b/Lang/Rebol/FizzBuzz new file mode 120000 index 0000000000..eab06ab9bd --- /dev/null +++ b/Lang/Rebol/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Flatten-a-list b/Lang/Rebol/Flatten-a-list new file mode 120000 index 0000000000..c1a20ef65d --- /dev/null +++ b/Lang/Rebol/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Flow-control-structures b/Lang/Rebol/Flow-control-structures new file mode 120000 index 0000000000..07ef2d4ad0 --- /dev/null +++ b/Lang/Rebol/Flow-control-structures @@ -0,0 +1 @@ +../../Task/Flow-control-structures/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Formatted-numeric-output b/Lang/Rebol/Formatted-numeric-output new file mode 120000 index 0000000000..7f83bb070c --- /dev/null +++ b/Lang/Rebol/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Fractal-tree b/Lang/Rebol/Fractal-tree new file mode 120000 index 0000000000..dc8b11466f --- /dev/null +++ b/Lang/Rebol/Fractal-tree @@ -0,0 +1 @@ +../../Task/Fractal-tree/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Fraction-reduction b/Lang/Rebol/Fraction-reduction new file mode 120000 index 0000000000..b0104cd06a --- /dev/null +++ b/Lang/Rebol/Fraction-reduction @@ -0,0 +1 @@ +../../Task/Fraction-reduction/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Fractran b/Lang/Rebol/Fractran new file mode 120000 index 0000000000..9377d42c62 --- /dev/null +++ b/Lang/Rebol/Fractran @@ -0,0 +1 @@ +../../Task/Fractran/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Function-composition b/Lang/Rebol/Function-composition new file mode 120000 index 0000000000..76d75e3285 --- /dev/null +++ b/Lang/Rebol/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Function-definition b/Lang/Rebol/Function-definition new file mode 120000 index 0000000000..70c2821920 --- /dev/null +++ b/Lang/Rebol/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Gapful-numbers b/Lang/Rebol/Gapful-numbers new file mode 120000 index 0000000000..68fbc7017f --- /dev/null +++ b/Lang/Rebol/Gapful-numbers @@ -0,0 +1 @@ +../../Task/Gapful-numbers/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Generic-swap b/Lang/Rebol/Generic-swap new file mode 120000 index 0000000000..283afac298 --- /dev/null +++ b/Lang/Rebol/Generic-swap @@ -0,0 +1 @@ +../../Task/Generic-swap/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Get-system-command-output b/Lang/Rebol/Get-system-command-output new file mode 120000 index 0000000000..62cff72de6 --- /dev/null +++ b/Lang/Rebol/Get-system-command-output @@ -0,0 +1 @@ +../../Task/Get-system-command-output/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Globally-replace-text-in-several-files b/Lang/Rebol/Globally-replace-text-in-several-files new file mode 120000 index 0000000000..03354f183a --- /dev/null +++ b/Lang/Rebol/Globally-replace-text-in-several-files @@ -0,0 +1 @@ +../../Task/Globally-replace-text-in-several-files/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Go-Fish b/Lang/Rebol/Go-Fish new file mode 120000 index 0000000000..7c0ef6e6d5 --- /dev/null +++ b/Lang/Rebol/Go-Fish @@ -0,0 +1 @@ +../../Task/Go-Fish/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Greatest-common-divisor b/Lang/Rebol/Greatest-common-divisor new file mode 120000 index 0000000000..e924b899c0 --- /dev/null +++ b/Lang/Rebol/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Greatest-element-of-a-list b/Lang/Rebol/Greatest-element-of-a-list new file mode 120000 index 0000000000..e262faf6c6 --- /dev/null +++ b/Lang/Rebol/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Rebol \ No newline at end of file diff --git a/Lang/Rebol/HTTP b/Lang/Rebol/HTTP new file mode 120000 index 0000000000..f7583ff32a --- /dev/null +++ b/Lang/Rebol/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/Rebol \ No newline at end of file diff --git a/Lang/Rebol/HTTPS b/Lang/Rebol/HTTPS new file mode 120000 index 0000000000..39a4cf4015 --- /dev/null +++ b/Lang/Rebol/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/Rebol \ No newline at end of file diff --git a/Lang/Rebol/HTTPS-Authenticated b/Lang/Rebol/HTTPS-Authenticated new file mode 120000 index 0000000000..325f33d148 --- /dev/null +++ b/Lang/Rebol/HTTPS-Authenticated @@ -0,0 +1 @@ +../../Task/HTTPS-Authenticated/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Hailstone-sequence b/Lang/Rebol/Hailstone-sequence new file mode 120000 index 0000000000..52670d11f8 --- /dev/null +++ b/Lang/Rebol/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Halt-and-catch-fire b/Lang/Rebol/Halt-and-catch-fire new file mode 120000 index 0000000000..4e21d500fa --- /dev/null +++ b/Lang/Rebol/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Handle-a-signal b/Lang/Rebol/Handle-a-signal new file mode 120000 index 0000000000..67b30c2214 --- /dev/null +++ b/Lang/Rebol/Handle-a-signal @@ -0,0 +1 @@ +../../Task/Handle-a-signal/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Hash-from-two-arrays b/Lang/Rebol/Hash-from-two-arrays new file mode 120000 index 0000000000..de8389960e --- /dev/null +++ b/Lang/Rebol/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Hash-join b/Lang/Rebol/Hash-join new file mode 120000 index 0000000000..02b63d13c7 --- /dev/null +++ b/Lang/Rebol/Hash-join @@ -0,0 +1 @@ +../../Task/Hash-join/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Hello-world-Graphical b/Lang/Rebol/Hello-world-Graphical new file mode 120000 index 0000000000..e8f4608f84 --- /dev/null +++ b/Lang/Rebol/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Hello-world-Newline-omission b/Lang/Rebol/Hello-world-Newline-omission new file mode 120000 index 0000000000..2762747194 --- /dev/null +++ b/Lang/Rebol/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Hello-world-Text b/Lang/Rebol/Hello-world-Text new file mode 120000 index 0000000000..2b783947da --- /dev/null +++ b/Lang/Rebol/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Higher-order-functions b/Lang/Rebol/Higher-order-functions new file mode 120000 index 0000000000..6c4634db1c --- /dev/null +++ b/Lang/Rebol/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Horners-rule-for-polynomial-evaluation b/Lang/Rebol/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..2e9d363a9e --- /dev/null +++ b/Lang/Rebol/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Hostname b/Lang/Rebol/Hostname new file mode 120000 index 0000000000..3effe6dbed --- /dev/null +++ b/Lang/Rebol/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Huffman-coding b/Lang/Rebol/Huffman-coding new file mode 120000 index 0000000000..545f0a329b --- /dev/null +++ b/Lang/Rebol/Huffman-coding @@ -0,0 +1 @@ +../../Task/Huffman-coding/Rebol \ No newline at end of file diff --git a/Lang/Rebol/I-before-E-except-after-C b/Lang/Rebol/I-before-E-except-after-C new file mode 120000 index 0000000000..e2b7750d9c --- /dev/null +++ b/Lang/Rebol/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/Rebol \ No newline at end of file diff --git a/Lang/Rebol/ISBN13-check-digit b/Lang/Rebol/ISBN13-check-digit new file mode 120000 index 0000000000..aef47eac0f --- /dev/null +++ b/Lang/Rebol/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Identity-matrix b/Lang/Rebol/Identity-matrix new file mode 120000 index 0000000000..6dfa288d93 --- /dev/null +++ b/Lang/Rebol/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Image-noise b/Lang/Rebol/Image-noise new file mode 120000 index 0000000000..a58b511104 --- /dev/null +++ b/Lang/Rebol/Image-noise @@ -0,0 +1 @@ +../../Task/Image-noise/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Increment-a-numerical-string b/Lang/Rebol/Increment-a-numerical-string new file mode 120000 index 0000000000..1d874b5b6c --- /dev/null +++ b/Lang/Rebol/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Inheritance-Single b/Lang/Rebol/Inheritance-Single new file mode 120000 index 0000000000..0d3eb9573f --- /dev/null +++ b/Lang/Rebol/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Input-loop b/Lang/Rebol/Input-loop new file mode 120000 index 0000000000..62007f0b87 --- /dev/null +++ b/Lang/Rebol/Input-loop @@ -0,0 +1 @@ +../../Task/Input-loop/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Integer-comparison b/Lang/Rebol/Integer-comparison new file mode 120000 index 0000000000..7349100994 --- /dev/null +++ b/Lang/Rebol/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Integer-overflow b/Lang/Rebol/Integer-overflow new file mode 120000 index 0000000000..8caca51571 --- /dev/null +++ b/Lang/Rebol/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Interactive-programming-repl- b/Lang/Rebol/Interactive-programming-repl- new file mode 120000 index 0000000000..e63ccabe70 --- /dev/null +++ b/Lang/Rebol/Interactive-programming-repl- @@ -0,0 +1 @@ +../../Task/Interactive-programming-repl-/Rebol \ No newline at end of file diff --git a/Lang/Rebol/JSON b/Lang/Rebol/JSON new file mode 120000 index 0000000000..8bd9ae2a02 --- /dev/null +++ b/Lang/Rebol/JSON @@ -0,0 +1 @@ +../../Task/JSON/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Jacobsthal-numbers b/Lang/Rebol/Jacobsthal-numbers new file mode 120000 index 0000000000..0faf5cccbd --- /dev/null +++ b/Lang/Rebol/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Jewels-and-stones b/Lang/Rebol/Jewels-and-stones new file mode 120000 index 0000000000..b876a95e71 --- /dev/null +++ b/Lang/Rebol/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Josephus-problem b/Lang/Rebol/Josephus-problem new file mode 120000 index 0000000000..0a4a059418 --- /dev/null +++ b/Lang/Rebol/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Keyboard-macros b/Lang/Rebol/Keyboard-macros new file mode 120000 index 0000000000..6090099e1c --- /dev/null +++ b/Lang/Rebol/Keyboard-macros @@ -0,0 +1 @@ +../../Task/Keyboard-macros/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Knapsack-problem-0-1 b/Lang/Rebol/Knapsack-problem-0-1 new file mode 120000 index 0000000000..a86da2e20d --- /dev/null +++ b/Lang/Rebol/Knapsack-problem-0-1 @@ -0,0 +1 @@ +../../Task/Knapsack-problem-0-1/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Knapsack-problem-Bounded b/Lang/Rebol/Knapsack-problem-Bounded new file mode 120000 index 0000000000..75ecc0ad88 --- /dev/null +++ b/Lang/Rebol/Knapsack-problem-Bounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Bounded/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Knapsack-problem-Continuous b/Lang/Rebol/Knapsack-problem-Continuous new file mode 120000 index 0000000000..d2d9139eb3 --- /dev/null +++ b/Lang/Rebol/Knapsack-problem-Continuous @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Continuous/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Knapsack-problem-Unbounded b/Lang/Rebol/Knapsack-problem-Unbounded new file mode 120000 index 0000000000..05a28b3b91 --- /dev/null +++ b/Lang/Rebol/Knapsack-problem-Unbounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Unbounded/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Knights-tour b/Lang/Rebol/Knights-tour new file mode 120000 index 0000000000..71e91ef802 --- /dev/null +++ b/Lang/Rebol/Knights-tour @@ -0,0 +1 @@ +../../Task/Knights-tour/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Knuth-shuffle b/Lang/Rebol/Knuth-shuffle new file mode 120000 index 0000000000..34c5744ed5 --- /dev/null +++ b/Lang/Rebol/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Rebol \ No newline at end of file diff --git a/Lang/Rebol/LZW-compression b/Lang/Rebol/LZW-compression new file mode 120000 index 0000000000..6ef643485d --- /dev/null +++ b/Lang/Rebol/LZW-compression @@ -0,0 +1 @@ +../../Task/LZW-compression/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Largest-number-divisible-by-its-digits b/Lang/Rebol/Largest-number-divisible-by-its-digits new file mode 120000 index 0000000000..ded7dc4f52 --- /dev/null +++ b/Lang/Rebol/Largest-number-divisible-by-its-digits @@ -0,0 +1 @@ +../../Task/Largest-number-divisible-by-its-digits/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Last-Friday-of-each-month b/Lang/Rebol/Last-Friday-of-each-month new file mode 120000 index 0000000000..22f9e289f1 --- /dev/null +++ b/Lang/Rebol/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Leap-year b/Lang/Rebol/Leap-year new file mode 120000 index 0000000000..fe28d10471 --- /dev/null +++ b/Lang/Rebol/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Letter-frequency b/Lang/Rebol/Letter-frequency new file mode 120000 index 0000000000..f821174d22 --- /dev/null +++ b/Lang/Rebol/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Levenshtein-distance b/Lang/Rebol/Levenshtein-distance new file mode 120000 index 0000000000..8eb20cd9e5 --- /dev/null +++ b/Lang/Rebol/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Literals-Floating-point b/Lang/Rebol/Literals-Floating-point new file mode 120000 index 0000000000..446f0ca13c --- /dev/null +++ b/Lang/Rebol/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Literals-Integer b/Lang/Rebol/Literals-Integer new file mode 120000 index 0000000000..61eb2276ad --- /dev/null +++ b/Lang/Rebol/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Logical-operations b/Lang/Rebol/Logical-operations new file mode 120000 index 0000000000..4ccc093b6a --- /dev/null +++ b/Lang/Rebol/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Look-and-say-sequence b/Lang/Rebol/Look-and-say-sequence new file mode 120000 index 0000000000..5af8fa2fe8 --- /dev/null +++ b/Lang/Rebol/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loop-over-multiple-arrays-simultaneously b/Lang/Rebol/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..7e8df4a406 --- /dev/null +++ b/Lang/Rebol/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-Break b/Lang/Rebol/Loops-Break new file mode 120000 index 0000000000..a7d70b8ddf --- /dev/null +++ b/Lang/Rebol/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-Continue b/Lang/Rebol/Loops-Continue new file mode 120000 index 0000000000..eb55ae4a46 --- /dev/null +++ b/Lang/Rebol/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-Do-while b/Lang/Rebol/Loops-Do-while new file mode 120000 index 0000000000..7b9c11e6c9 --- /dev/null +++ b/Lang/Rebol/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-Downward-for b/Lang/Rebol/Loops-Downward-for new file mode 120000 index 0000000000..aabadccc5d --- /dev/null +++ b/Lang/Rebol/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-For b/Lang/Rebol/Loops-For new file mode 120000 index 0000000000..3441cbf3e4 --- /dev/null +++ b/Lang/Rebol/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-For-with-a-specified-step b/Lang/Rebol/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..48cddeed7c --- /dev/null +++ b/Lang/Rebol/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-Foreach b/Lang/Rebol/Loops-Foreach new file mode 120000 index 0000000000..5113646d4a --- /dev/null +++ b/Lang/Rebol/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-Increment-loop-index-within-loop-body b/Lang/Rebol/Loops-Increment-loop-index-within-loop-body new file mode 120000 index 0000000000..2a105f8219 --- /dev/null +++ b/Lang/Rebol/Loops-Increment-loop-index-within-loop-body @@ -0,0 +1 @@ +../../Task/Loops-Increment-loop-index-within-loop-body/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-Infinite b/Lang/Rebol/Loops-Infinite new file mode 120000 index 0000000000..b9782bb44c --- /dev/null +++ b/Lang/Rebol/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-N-plus-one-half b/Lang/Rebol/Loops-N-plus-one-half new file mode 120000 index 0000000000..fde94d5278 --- /dev/null +++ b/Lang/Rebol/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-Nested b/Lang/Rebol/Loops-Nested new file mode 120000 index 0000000000..8570918c54 --- /dev/null +++ b/Lang/Rebol/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-While b/Lang/Rebol/Loops-While new file mode 120000 index 0000000000..d6ae658607 --- /dev/null +++ b/Lang/Rebol/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-With-multiple-ranges b/Lang/Rebol/Loops-With-multiple-ranges new file mode 120000 index 0000000000..1444c994ba --- /dev/null +++ b/Lang/Rebol/Loops-With-multiple-ranges @@ -0,0 +1 @@ +../../Task/Loops-With-multiple-ranges/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Loops-Wrong-ranges b/Lang/Rebol/Loops-Wrong-ranges new file mode 120000 index 0000000000..8c6fabb9b5 --- /dev/null +++ b/Lang/Rebol/Loops-Wrong-ranges @@ -0,0 +1 @@ +../../Task/Loops-Wrong-ranges/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Ludic-numbers b/Lang/Rebol/Ludic-numbers new file mode 120000 index 0000000000..a4ebabb376 --- /dev/null +++ b/Lang/Rebol/Ludic-numbers @@ -0,0 +1 @@ +../../Task/Ludic-numbers/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Luhn-test-of-credit-card-numbers b/Lang/Rebol/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..54db6d0086 --- /dev/null +++ b/Lang/Rebol/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Lychrel-numbers b/Lang/Rebol/Lychrel-numbers new file mode 120000 index 0000000000..a9ccc00139 --- /dev/null +++ b/Lang/Rebol/Lychrel-numbers @@ -0,0 +1 @@ +../../Task/Lychrel-numbers/Rebol \ No newline at end of file diff --git a/Lang/Rebol/MAC-vendor-lookup b/Lang/Rebol/MAC-vendor-lookup new file mode 120000 index 0000000000..ea5da48c4a --- /dev/null +++ b/Lang/Rebol/MAC-vendor-lookup @@ -0,0 +1 @@ +../../Task/MAC-vendor-lookup/Rebol \ No newline at end of file diff --git a/Lang/Rebol/MD5 b/Lang/Rebol/MD5 new file mode 120000 index 0000000000..8e783d3330 --- /dev/null +++ b/Lang/Rebol/MD5 @@ -0,0 +1 @@ +../../Task/MD5/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Mad-Libs b/Lang/Rebol/Mad-Libs new file mode 120000 index 0000000000..e503266ac3 --- /dev/null +++ b/Lang/Rebol/Mad-Libs @@ -0,0 +1 @@ +../../Task/Mad-Libs/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Mandelbrot-set b/Lang/Rebol/Mandelbrot-set new file mode 120000 index 0000000000..9795649798 --- /dev/null +++ b/Lang/Rebol/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Mayan-numerals b/Lang/Rebol/Mayan-numerals new file mode 120000 index 0000000000..f3c3f1ac1b --- /dev/null +++ b/Lang/Rebol/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Maze-generation b/Lang/Rebol/Maze-generation new file mode 120000 index 0000000000..16909e3bd3 --- /dev/null +++ b/Lang/Rebol/Maze-generation @@ -0,0 +1 @@ +../../Task/Maze-generation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Menu b/Lang/Rebol/Menu new file mode 120000 index 0000000000..0970cb6584 --- /dev/null +++ b/Lang/Rebol/Menu @@ -0,0 +1 @@ +../../Task/Menu/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Morse-code b/Lang/Rebol/Morse-code new file mode 120000 index 0000000000..9b184a4368 --- /dev/null +++ b/Lang/Rebol/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Multiplication-tables b/Lang/Rebol/Multiplication-tables new file mode 120000 index 0000000000..19c593899a --- /dev/null +++ b/Lang/Rebol/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Mutual-recursion b/Lang/Rebol/Mutual-recursion new file mode 120000 index 0000000000..3927e2e3d0 --- /dev/null +++ b/Lang/Rebol/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Nim-game b/Lang/Rebol/Nim-game new file mode 120000 index 0000000000..3d509e2da0 --- /dev/null +++ b/Lang/Rebol/Nim-game @@ -0,0 +1 @@ +../../Task/Nim-game/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Null-object b/Lang/Rebol/Null-object new file mode 120000 index 0000000000..6d91c61493 --- /dev/null +++ b/Lang/Rebol/Null-object @@ -0,0 +1 @@ +../../Task/Null-object/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Number-reversal-game b/Lang/Rebol/Number-reversal-game new file mode 120000 index 0000000000..225b967208 --- /dev/null +++ b/Lang/Rebol/Number-reversal-game @@ -0,0 +1 @@ +../../Task/Number-reversal-game/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Object-serialization b/Lang/Rebol/Object-serialization new file mode 120000 index 0000000000..b546950e51 --- /dev/null +++ b/Lang/Rebol/Object-serialization @@ -0,0 +1 @@ +../../Task/Object-serialization/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Ordered-words b/Lang/Rebol/Ordered-words new file mode 120000 index 0000000000..62492c8748 --- /dev/null +++ b/Lang/Rebol/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Padovan-n-step-number-sequences b/Lang/Rebol/Padovan-n-step-number-sequences new file mode 120000 index 0000000000..6ce6076d9f --- /dev/null +++ b/Lang/Rebol/Padovan-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Padovan-n-step-number-sequences/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Palindrome-detection b/Lang/Rebol/Palindrome-detection new file mode 120000 index 0000000000..976abf960a --- /dev/null +++ b/Lang/Rebol/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Palindromic-gapful-numbers b/Lang/Rebol/Palindromic-gapful-numbers new file mode 120000 index 0000000000..ce1a9844df --- /dev/null +++ b/Lang/Rebol/Palindromic-gapful-numbers @@ -0,0 +1 @@ +../../Task/Palindromic-gapful-numbers/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Parsing-Shunting-yard-algorithm b/Lang/Rebol/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..b48c2dd4c0 --- /dev/null +++ b/Lang/Rebol/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Pentagram b/Lang/Rebol/Pentagram new file mode 120000 index 0000000000..707cf04e6c --- /dev/null +++ b/Lang/Rebol/Pentagram @@ -0,0 +1 @@ +../../Task/Pentagram/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Percentage-difference-between-images b/Lang/Rebol/Percentage-difference-between-images new file mode 120000 index 0000000000..4b4ccc789a --- /dev/null +++ b/Lang/Rebol/Percentage-difference-between-images @@ -0,0 +1 @@ +../../Task/Percentage-difference-between-images/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Perfect-numbers b/Lang/Rebol/Perfect-numbers new file mode 120000 index 0000000000..cc7bf3b1d8 --- /dev/null +++ b/Lang/Rebol/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Permutation-test b/Lang/Rebol/Permutation-test new file mode 120000 index 0000000000..33aca0c009 --- /dev/null +++ b/Lang/Rebol/Permutation-test @@ -0,0 +1 @@ +../../Task/Permutation-test/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Pick-random-element b/Lang/Rebol/Pick-random-element new file mode 120000 index 0000000000..a63070b88e --- /dev/null +++ b/Lang/Rebol/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Playing-cards b/Lang/Rebol/Playing-cards new file mode 120000 index 0000000000..77a603d4f6 --- /dev/null +++ b/Lang/Rebol/Playing-cards @@ -0,0 +1 @@ +../../Task/Playing-cards/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Poker-hand-analyser b/Lang/Rebol/Poker-hand-analyser new file mode 120000 index 0000000000..cd92bc4893 --- /dev/null +++ b/Lang/Rebol/Poker-hand-analyser @@ -0,0 +1 @@ +../../Task/Poker-hand-analyser/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Polyspiral b/Lang/Rebol/Polyspiral new file mode 120000 index 0000000000..a68aec96f7 --- /dev/null +++ b/Lang/Rebol/Polyspiral @@ -0,0 +1 @@ +../../Task/Polyspiral/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Primality-by-trial-division b/Lang/Rebol/Primality-by-trial-division new file mode 120000 index 0000000000..efa17720e9 --- /dev/null +++ b/Lang/Rebol/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Program-termination b/Lang/Rebol/Program-termination new file mode 120000 index 0000000000..24f49d0325 --- /dev/null +++ b/Lang/Rebol/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Pythagoras-tree b/Lang/Rebol/Pythagoras-tree new file mode 120000 index 0000000000..f30dc63938 --- /dev/null +++ b/Lang/Rebol/Pythagoras-tree @@ -0,0 +1 @@ +../../Task/Pythagoras-tree/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Queue-Definition b/Lang/Rebol/Queue-Definition new file mode 120000 index 0000000000..162ba667c2 --- /dev/null +++ b/Lang/Rebol/Queue-Definition @@ -0,0 +1 @@ +../../Task/Queue-Definition/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Queue-Usage b/Lang/Rebol/Queue-Usage new file mode 120000 index 0000000000..f4c7c7a4c3 --- /dev/null +++ b/Lang/Rebol/Queue-Usage @@ -0,0 +1 @@ +../../Task/Queue-Usage/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Quine b/Lang/Rebol/Quine new file mode 120000 index 0000000000..27b88ad2ff --- /dev/null +++ b/Lang/Rebol/Quine @@ -0,0 +1 @@ +../../Task/Quine/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Quoting-constructs b/Lang/Rebol/Quoting-constructs new file mode 120000 index 0000000000..cfd2d459f0 --- /dev/null +++ b/Lang/Rebol/Quoting-constructs @@ -0,0 +1 @@ +../../Task/Quoting-constructs/Rebol \ No newline at end of file diff --git a/Lang/Rebol/RPG-attributes-generator b/Lang/Rebol/RPG-attributes-generator new file mode 120000 index 0000000000..b156c392e1 --- /dev/null +++ b/Lang/Rebol/RPG-attributes-generator @@ -0,0 +1 @@ +../../Task/RPG-attributes-generator/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Read-a-specific-line-from-a-file b/Lang/Rebol/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..14a1597027 --- /dev/null +++ b/Lang/Rebol/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Read-entire-file b/Lang/Rebol/Read-entire-file new file mode 120000 index 0000000000..28b35bf7cc --- /dev/null +++ b/Lang/Rebol/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Recamans-sequence b/Lang/Rebol/Recamans-sequence new file mode 120000 index 0000000000..bfdd733327 --- /dev/null +++ b/Lang/Rebol/Recamans-sequence @@ -0,0 +1 @@ +../../Task/Recamans-sequence/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Reduced-row-echelon-form b/Lang/Rebol/Reduced-row-echelon-form new file mode 120000 index 0000000000..743fe9cee3 --- /dev/null +++ b/Lang/Rebol/Reduced-row-echelon-form @@ -0,0 +1 @@ +../../Task/Reduced-row-echelon-form/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Regular-expressions b/Lang/Rebol/Regular-expressions new file mode 120000 index 0000000000..8b6a46c176 --- /dev/null +++ b/Lang/Rebol/Regular-expressions @@ -0,0 +1 @@ +../../Task/Regular-expressions/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Remove-duplicate-elements b/Lang/Rebol/Remove-duplicate-elements new file mode 120000 index 0000000000..e15cb15fa9 --- /dev/null +++ b/Lang/Rebol/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Rename-a-file b/Lang/Rebol/Rename-a-file new file mode 120000 index 0000000000..b1a36bd846 --- /dev/null +++ b/Lang/Rebol/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Repeat-a-string b/Lang/Rebol/Repeat-a-string new file mode 120000 index 0000000000..ef9fbbc4ad --- /dev/null +++ b/Lang/Rebol/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Reverse-a-string b/Lang/Rebol/Reverse-a-string new file mode 120000 index 0000000000..58f8abd089 --- /dev/null +++ b/Lang/Rebol/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Rock-paper-scissors b/Lang/Rebol/Rock-paper-scissors new file mode 120000 index 0000000000..cda68fe0a1 --- /dev/null +++ b/Lang/Rebol/Rock-paper-scissors @@ -0,0 +1 @@ +../../Task/Rock-paper-scissors/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Rosetta-Code-Count-examples b/Lang/Rebol/Rosetta-Code-Count-examples new file mode 120000 index 0000000000..d0380c9f7b --- /dev/null +++ b/Lang/Rebol/Rosetta-Code-Count-examples @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Count-examples/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Rosetta-Code-Find-unimplemented-tasks b/Lang/Rebol/Rosetta-Code-Find-unimplemented-tasks new file mode 120000 index 0000000000..24ea450c68 --- /dev/null +++ b/Lang/Rebol/Rosetta-Code-Find-unimplemented-tasks @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Find-unimplemented-tasks/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Rosetta-Code-Rank-languages-by-popularity b/Lang/Rebol/Rosetta-Code-Rank-languages-by-popularity new file mode 120000 index 0000000000..fab9075fea --- /dev/null +++ b/Lang/Rebol/Rosetta-Code-Rank-languages-by-popularity @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Rank-languages-by-popularity/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Rot-13 b/Lang/Rebol/Rot-13 new file mode 120000 index 0000000000..237e499a3f --- /dev/null +++ b/Lang/Rebol/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Runtime-evaluation b/Lang/Rebol/Runtime-evaluation new file mode 120000 index 0000000000..b5e1f8ecde --- /dev/null +++ b/Lang/Rebol/Runtime-evaluation @@ -0,0 +1 @@ +../../Task/Runtime-evaluation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Runtime-evaluation-In-an-environment b/Lang/Rebol/Runtime-evaluation-In-an-environment new file mode 120000 index 0000000000..f0cf1819d7 --- /dev/null +++ b/Lang/Rebol/Runtime-evaluation-In-an-environment @@ -0,0 +1 @@ +../../Task/Runtime-evaluation-In-an-environment/Rebol \ No newline at end of file diff --git a/Lang/Rebol/SHA-1 b/Lang/Rebol/SHA-1 new file mode 120000 index 0000000000..6006c706a1 --- /dev/null +++ b/Lang/Rebol/SHA-1 @@ -0,0 +1 @@ +../../Task/SHA-1/Rebol \ No newline at end of file diff --git a/Lang/Rebol/SHA-256 b/Lang/Rebol/SHA-256 new file mode 120000 index 0000000000..a282c64fe3 --- /dev/null +++ b/Lang/Rebol/SHA-256 @@ -0,0 +1 @@ +../../Task/SHA-256/Rebol \ No newline at end of file diff --git a/Lang/Rebol/SHA-256-Merkle-tree b/Lang/Rebol/SHA-256-Merkle-tree new file mode 120000 index 0000000000..3ec6fddf77 --- /dev/null +++ b/Lang/Rebol/SHA-256-Merkle-tree @@ -0,0 +1 @@ +../../Task/SHA-256-Merkle-tree/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Search-a-list b/Lang/Rebol/Search-a-list new file mode 120000 index 0000000000..318894f6a3 --- /dev/null +++ b/Lang/Rebol/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Self-describing-numbers b/Lang/Rebol/Self-describing-numbers new file mode 120000 index 0000000000..e068493027 --- /dev/null +++ b/Lang/Rebol/Self-describing-numbers @@ -0,0 +1 @@ +../../Task/Self-describing-numbers/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Semordnilap b/Lang/Rebol/Semordnilap new file mode 120000 index 0000000000..0da3f78b6d --- /dev/null +++ b/Lang/Rebol/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Send-email b/Lang/Rebol/Send-email new file mode 120000 index 0000000000..bdcdb84d73 --- /dev/null +++ b/Lang/Rebol/Send-email @@ -0,0 +1 @@ +../../Task/Send-email/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Shell-one-liner b/Lang/Rebol/Shell-one-liner new file mode 120000 index 0000000000..d93fe376ad --- /dev/null +++ b/Lang/Rebol/Shell-one-liner @@ -0,0 +1 @@ +../../Task/Shell-one-liner/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Show-ASCII-table b/Lang/Rebol/Show-ASCII-table new file mode 120000 index 0000000000..73b59f4704 --- /dev/null +++ b/Lang/Rebol/Show-ASCII-table @@ -0,0 +1 @@ +../../Task/Show-ASCII-table/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Sieve-of-Eratosthenes b/Lang/Rebol/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..304a7c5cc4 --- /dev/null +++ b/Lang/Rebol/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Sieve-of-Pritchard b/Lang/Rebol/Sieve-of-Pritchard new file mode 120000 index 0000000000..ae2da5fd4b --- /dev/null +++ b/Lang/Rebol/Sieve-of-Pritchard @@ -0,0 +1 @@ +../../Task/Sieve-of-Pritchard/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Simple-database b/Lang/Rebol/Simple-database new file mode 120000 index 0000000000..91cc755165 --- /dev/null +++ b/Lang/Rebol/Simple-database @@ -0,0 +1 @@ +../../Task/Simple-database/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Simple-windowed-application b/Lang/Rebol/Simple-windowed-application new file mode 120000 index 0000000000..9329534018 --- /dev/null +++ b/Lang/Rebol/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Sleep b/Lang/Rebol/Sleep new file mode 120000 index 0000000000..93ccbde879 --- /dev/null +++ b/Lang/Rebol/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Sort-an-integer-array b/Lang/Rebol/Sort-an-integer-array new file mode 120000 index 0000000000..964bc28a49 --- /dev/null +++ b/Lang/Rebol/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Sort-stability b/Lang/Rebol/Sort-stability new file mode 120000 index 0000000000..398ebf99ce --- /dev/null +++ b/Lang/Rebol/Sort-stability @@ -0,0 +1 @@ +../../Task/Sort-stability/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Sorting-algorithms-Gnome-sort b/Lang/Rebol/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..5a1b4b5c4b --- /dev/null +++ b/Lang/Rebol/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Sorting-algorithms-Insertion-sort b/Lang/Rebol/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..542842155d --- /dev/null +++ b/Lang/Rebol/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Sorting-algorithms-Merge-sort b/Lang/Rebol/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..c0e13b1fde --- /dev/null +++ b/Lang/Rebol/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Sorting-algorithms-Stooge-sort b/Lang/Rebol/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..330c056497 --- /dev/null +++ b/Lang/Rebol/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Spiral-matrix b/Lang/Rebol/Spiral-matrix new file mode 120000 index 0000000000..5be66bebd7 --- /dev/null +++ b/Lang/Rebol/Spiral-matrix @@ -0,0 +1 @@ +../../Task/Spiral-matrix/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Stack b/Lang/Rebol/Stack new file mode 120000 index 0000000000..4ddf42dff7 --- /dev/null +++ b/Lang/Rebol/Stack @@ -0,0 +1 @@ +../../Task/Stack/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Stair-climbing-puzzle b/Lang/Rebol/Stair-climbing-puzzle new file mode 120000 index 0000000000..30110c39ff --- /dev/null +++ b/Lang/Rebol/Stair-climbing-puzzle @@ -0,0 +1 @@ +../../Task/Stair-climbing-puzzle/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Statistics-Normal-distribution b/Lang/Rebol/Statistics-Normal-distribution new file mode 120000 index 0000000000..c2c6f8e607 --- /dev/null +++ b/Lang/Rebol/Statistics-Normal-distribution @@ -0,0 +1 @@ +../../Task/Statistics-Normal-distribution/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Straddling-checkerboard b/Lang/Rebol/Straddling-checkerboard new file mode 120000 index 0000000000..b2cd63efdf --- /dev/null +++ b/Lang/Rebol/Straddling-checkerboard @@ -0,0 +1 @@ +../../Task/Straddling-checkerboard/Rebol \ No newline at end of file diff --git a/Lang/Rebol/String-case b/Lang/Rebol/String-case new file mode 120000 index 0000000000..99d32eb89d --- /dev/null +++ b/Lang/Rebol/String-case @@ -0,0 +1 @@ +../../Task/String-case/Rebol \ No newline at end of file diff --git a/Lang/Rebol/String-concatenation b/Lang/Rebol/String-concatenation new file mode 120000 index 0000000000..60e5df3a60 --- /dev/null +++ b/Lang/Rebol/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/String-interpolation-included- b/Lang/Rebol/String-interpolation-included- new file mode 120000 index 0000000000..0d16a99c3d --- /dev/null +++ b/Lang/Rebol/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/Rebol \ No newline at end of file diff --git a/Lang/Rebol/String-length b/Lang/Rebol/String-length new file mode 120000 index 0000000000..4008031d32 --- /dev/null +++ b/Lang/Rebol/String-length @@ -0,0 +1 @@ +../../Task/String-length/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Strip-comments-from-a-string b/Lang/Rebol/Strip-comments-from-a-string new file mode 120000 index 0000000000..7d0be8f55b --- /dev/null +++ b/Lang/Rebol/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Substring b/Lang/Rebol/Substring new file mode 120000 index 0000000000..16d8520df3 --- /dev/null +++ b/Lang/Rebol/Substring @@ -0,0 +1 @@ +../../Task/Substring/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Sum-and-product-of-an-array b/Lang/Rebol/Sum-and-product-of-an-array new file mode 120000 index 0000000000..f0691c6c52 --- /dev/null +++ b/Lang/Rebol/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Symmetric-difference b/Lang/Rebol/Symmetric-difference new file mode 120000 index 0000000000..ead8d7c53a --- /dev/null +++ b/Lang/Rebol/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/Rebol \ No newline at end of file diff --git a/Lang/Rebol/System-time b/Lang/Rebol/System-time new file mode 120000 index 0000000000..26192d37e7 --- /dev/null +++ b/Lang/Rebol/System-time @@ -0,0 +1 @@ +../../Task/System-time/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Take-notes-on-the-command-line b/Lang/Rebol/Take-notes-on-the-command-line new file mode 120000 index 0000000000..686f0e9609 --- /dev/null +++ b/Lang/Rebol/Take-notes-on-the-command-line @@ -0,0 +1 @@ +../../Task/Take-notes-on-the-command-line/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Terminal-control-Clear-the-screen b/Lang/Rebol/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..26092c08d5 --- /dev/null +++ b/Lang/Rebol/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Terminal-control-Coloured-text b/Lang/Rebol/Terminal-control-Coloured-text new file mode 120000 index 0000000000..91c395fe7a --- /dev/null +++ b/Lang/Rebol/Terminal-control-Coloured-text @@ -0,0 +1 @@ +../../Task/Terminal-control-Coloured-text/Rebol \ No newline at end of file diff --git a/Lang/Rebol/The-Twelve-Days-of-Christmas b/Lang/Rebol/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..1cd8cfb663 --- /dev/null +++ b/Lang/Rebol/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Tokenize-a-string b/Lang/Rebol/Tokenize-a-string new file mode 120000 index 0000000000..683933fc1a --- /dev/null +++ b/Lang/Rebol/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Towers-of-Hanoi b/Lang/Rebol/Towers-of-Hanoi new file mode 120000 index 0000000000..256a976fba --- /dev/null +++ b/Lang/Rebol/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Transliterate-English-text-using-the-Greek-alphabet b/Lang/Rebol/Transliterate-English-text-using-the-Greek-alphabet new file mode 120000 index 0000000000..6cd5a9fcd9 --- /dev/null +++ b/Lang/Rebol/Transliterate-English-text-using-the-Greek-alphabet @@ -0,0 +1 @@ +../../Task/Transliterate-English-text-using-the-Greek-alphabet/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Tree-traversal b/Lang/Rebol/Tree-traversal new file mode 120000 index 0000000000..a9acbc3e12 --- /dev/null +++ b/Lang/Rebol/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Trigonometric-functions b/Lang/Rebol/Trigonometric-functions new file mode 120000 index 0000000000..31689c9f7b --- /dev/null +++ b/Lang/Rebol/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Truncate-a-file b/Lang/Rebol/Truncate-a-file new file mode 120000 index 0000000000..a6b1c49090 --- /dev/null +++ b/Lang/Rebol/Truncate-a-file @@ -0,0 +1 @@ +../../Task/Truncate-a-file/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Twos-complement b/Lang/Rebol/Twos-complement new file mode 120000 index 0000000000..7d177dca86 --- /dev/null +++ b/Lang/Rebol/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Rebol \ No newline at end of file diff --git a/Lang/Rebol/URL-decoding b/Lang/Rebol/URL-decoding new file mode 120000 index 0000000000..13aaaaf76d --- /dev/null +++ b/Lang/Rebol/URL-decoding @@ -0,0 +1 @@ +../../Task/URL-decoding/Rebol \ No newline at end of file diff --git a/Lang/Rebol/URL-encoding b/Lang/Rebol/URL-encoding new file mode 120000 index 0000000000..f2738b2378 --- /dev/null +++ b/Lang/Rebol/URL-encoding @@ -0,0 +1 @@ +../../Task/URL-encoding/Rebol \ No newline at end of file diff --git a/Lang/Rebol/User-input-Graphical b/Lang/Rebol/User-input-Graphical new file mode 120000 index 0000000000..9826592fbf --- /dev/null +++ b/Lang/Rebol/User-input-Graphical @@ -0,0 +1 @@ +../../Task/User-input-Graphical/Rebol \ No newline at end of file diff --git a/Lang/Rebol/User-input-Text b/Lang/Rebol/User-input-Text new file mode 120000 index 0000000000..61cd5bb640 --- /dev/null +++ b/Lang/Rebol/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Validate-International-Securities-Identification-Number b/Lang/Rebol/Validate-International-Securities-Identification-Number new file mode 120000 index 0000000000..c8f6432cf5 --- /dev/null +++ b/Lang/Rebol/Validate-International-Securities-Identification-Number @@ -0,0 +1 @@ +../../Task/Validate-International-Securities-Identification-Number/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Variadic-function b/Lang/Rebol/Variadic-function new file mode 120000 index 0000000000..eb753c87ca --- /dev/null +++ b/Lang/Rebol/Variadic-function @@ -0,0 +1 @@ +../../Task/Variadic-function/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Vigen-re-cipher b/Lang/Rebol/Vigen-re-cipher new file mode 120000 index 0000000000..e4c0684470 --- /dev/null +++ b/Lang/Rebol/Vigen-re-cipher @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Walk-a-directory-Non-recursively b/Lang/Rebol/Walk-a-directory-Non-recursively new file mode 120000 index 0000000000..7d9b757781 --- /dev/null +++ b/Lang/Rebol/Walk-a-directory-Non-recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Non-recursively/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Walk-a-directory-Recursively b/Lang/Rebol/Walk-a-directory-Recursively new file mode 120000 index 0000000000..6bdc6972ee --- /dev/null +++ b/Lang/Rebol/Walk-a-directory-Recursively @@ -0,0 +1 @@ +../../Task/Walk-a-directory-Recursively/Rebol \ No newline at end of file diff --git a/Lang/Rebol/War-card-game b/Lang/Rebol/War-card-game new file mode 120000 index 0000000000..25923c64aa --- /dev/null +++ b/Lang/Rebol/War-card-game @@ -0,0 +1 @@ +../../Task/War-card-game/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Web-scraping b/Lang/Rebol/Web-scraping new file mode 120000 index 0000000000..4e9367ba38 --- /dev/null +++ b/Lang/Rebol/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Window-creation b/Lang/Rebol/Window-creation new file mode 120000 index 0000000000..bd0bbb0b87 --- /dev/null +++ b/Lang/Rebol/Window-creation @@ -0,0 +1 @@ +../../Task/Window-creation/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Word-frequency b/Lang/Rebol/Word-frequency new file mode 120000 index 0000000000..520eed281f --- /dev/null +++ b/Lang/Rebol/Word-frequency @@ -0,0 +1 @@ +../../Task/Word-frequency/Rebol \ No newline at end of file diff --git a/Lang/Rebol/XML-Input b/Lang/Rebol/XML-Input new file mode 120000 index 0000000000..014dc4f1f1 --- /dev/null +++ b/Lang/Rebol/XML-Input @@ -0,0 +1 @@ +../../Task/XML-Input/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Y-combinator b/Lang/Rebol/Y-combinator new file mode 120000 index 0000000000..dcc94474b6 --- /dev/null +++ b/Lang/Rebol/Y-combinator @@ -0,0 +1 @@ +../../Task/Y-combinator/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Zero-to-the-zero-power b/Lang/Rebol/Zero-to-the-zero-power new file mode 120000 index 0000000000..8722267184 --- /dev/null +++ b/Lang/Rebol/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/Rebol \ No newline at end of file diff --git a/Lang/Rebol/Zig-zag-matrix b/Lang/Rebol/Zig-zag-matrix new file mode 120000 index 0000000000..ff69ef9beb --- /dev/null +++ b/Lang/Rebol/Zig-zag-matrix @@ -0,0 +1 @@ +../../Task/Zig-zag-matrix/Rebol \ No newline at end of file diff --git a/Lang/Red/00-LANG.txt b/Lang/Red/00-LANG.txt index 1cb6089084..bde0f4b81e 100644 --- a/Lang/Red/00-LANG.txt +++ b/Lang/Red/00-LANG.txt @@ -8,6 +8,9 @@ Like Rebol, Red has a low memory footprint, is garbage collected, and has a [htt Red embeds several DSLs, among which Red/System (C semantics meet Red syntax), dedicated to low-level and system programming. It is also used as an intermediate language (IL) when Red is compiled. The Red executable is able to build Red/System files directly (`*.reds`) as well as Red files (`*.red`), and Red/System code may be embedded freely in Red code. +==Todo== +[https://rosettacode.org/wiki/Tasks_not_implemented_in_Red Tasks not implemented in Red] + ==Useful links== * [http://www.red-lang.org Red Language Website] * [https://twitter.com/red_lang @red_lang] on Twitter. diff --git a/Lang/Red/Accumulator-factory b/Lang/Red/Accumulator-factory new file mode 120000 index 0000000000..73cf9ffff0 --- /dev/null +++ b/Lang/Red/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/Red \ No newline at end of file diff --git a/Lang/Red/Address-of-a-variable b/Lang/Red/Address-of-a-variable new file mode 120000 index 0000000000..81b5a1a171 --- /dev/null +++ b/Lang/Red/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/Red \ No newline at end of file diff --git a/Lang/Red/Angle-difference-between-two-bearings b/Lang/Red/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..e218e0c4ee --- /dev/null +++ b/Lang/Red/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/Red \ No newline at end of file diff --git a/Lang/Red/Angles-geometric-normalization-and-conversion b/Lang/Red/Angles-geometric-normalization-and-conversion new file mode 120000 index 0000000000..f969ff2c56 --- /dev/null +++ b/Lang/Red/Angles-geometric-normalization-and-conversion @@ -0,0 +1 @@ +../../Task/Angles-geometric-normalization-and-conversion/Red \ No newline at end of file diff --git a/Lang/Red/Arithmetic-Integer b/Lang/Red/Arithmetic-Integer new file mode 120000 index 0000000000..cb3f74d046 --- /dev/null +++ b/Lang/Red/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Red \ No newline at end of file diff --git a/Lang/Red/Arithmetic-evaluation b/Lang/Red/Arithmetic-evaluation new file mode 120000 index 0000000000..c6c5c304b5 --- /dev/null +++ b/Lang/Red/Arithmetic-evaluation @@ -0,0 +1 @@ +../../Task/Arithmetic-evaluation/Red \ No newline at end of file diff --git a/Lang/Red/Boolean-values b/Lang/Red/Boolean-values new file mode 120000 index 0000000000..3df0e7a087 --- /dev/null +++ b/Lang/Red/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Red \ No newline at end of file diff --git a/Lang/Red/Calendar b/Lang/Red/Calendar new file mode 120000 index 0000000000..3283fd5906 --- /dev/null +++ b/Lang/Red/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/Red \ No newline at end of file diff --git a/Lang/Red/Calendar---for-REAL-programmers b/Lang/Red/Calendar---for-REAL-programmers new file mode 120000 index 0000000000..e0db1bd24f --- /dev/null +++ b/Lang/Red/Calendar---for-REAL-programmers @@ -0,0 +1 @@ +../../Task/Calendar---for-REAL-programmers/Red \ No newline at end of file diff --git a/Lang/Red/Call-a-function b/Lang/Red/Call-a-function new file mode 120000 index 0000000000..2907d38f1e --- /dev/null +++ b/Lang/Red/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/Red \ No newline at end of file diff --git a/Lang/Red/Call-an-object-method b/Lang/Red/Call-an-object-method new file mode 120000 index 0000000000..50c2f71ec1 --- /dev/null +++ b/Lang/Red/Call-an-object-method @@ -0,0 +1 @@ +../../Task/Call-an-object-method/Red \ No newline at end of file diff --git a/Lang/Red/Case-sensitivity-of-identifiers b/Lang/Red/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..1f46e1aec5 --- /dev/null +++ b/Lang/Red/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Red \ No newline at end of file diff --git a/Lang/Red/Classes b/Lang/Red/Classes new file mode 120000 index 0000000000..5db3a1a49b --- /dev/null +++ b/Lang/Red/Classes @@ -0,0 +1 @@ +../../Task/Classes/Red \ No newline at end of file diff --git a/Lang/Red/Compare-length-of-two-strings b/Lang/Red/Compare-length-of-two-strings new file mode 120000 index 0000000000..0a8b824021 --- /dev/null +++ b/Lang/Red/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/Red \ No newline at end of file diff --git a/Lang/Red/Compiler-AST-interpreter b/Lang/Red/Compiler-AST-interpreter new file mode 120000 index 0000000000..38de1297c9 --- /dev/null +++ b/Lang/Red/Compiler-AST-interpreter @@ -0,0 +1 @@ +../../Task/Compiler-AST-interpreter/Red \ No newline at end of file diff --git a/Lang/Red/Compiler-code-generator b/Lang/Red/Compiler-code-generator new file mode 120000 index 0000000000..7af219c35c --- /dev/null +++ b/Lang/Red/Compiler-code-generator @@ -0,0 +1 @@ +../../Task/Compiler-code-generator/Red \ No newline at end of file diff --git a/Lang/Red/Compiler-lexical-analyzer b/Lang/Red/Compiler-lexical-analyzer new file mode 120000 index 0000000000..6b88c28f94 --- /dev/null +++ b/Lang/Red/Compiler-lexical-analyzer @@ -0,0 +1 @@ +../../Task/Compiler-lexical-analyzer/Red \ No newline at end of file diff --git a/Lang/Red/Compiler-syntax-analyzer b/Lang/Red/Compiler-syntax-analyzer new file mode 120000 index 0000000000..406b1710ff --- /dev/null +++ b/Lang/Red/Compiler-syntax-analyzer @@ -0,0 +1 @@ +../../Task/Compiler-syntax-analyzer/Red \ No newline at end of file diff --git a/Lang/Red/Compiler-virtual-machine-interpreter b/Lang/Red/Compiler-virtual-machine-interpreter new file mode 120000 index 0000000000..85d28b0fea --- /dev/null +++ b/Lang/Red/Compiler-virtual-machine-interpreter @@ -0,0 +1 @@ +../../Task/Compiler-virtual-machine-interpreter/Red \ No newline at end of file diff --git a/Lang/Red/Currying b/Lang/Red/Currying new file mode 120000 index 0000000000..a40d4bf838 --- /dev/null +++ b/Lang/Red/Currying @@ -0,0 +1 @@ +../../Task/Currying/Red \ No newline at end of file diff --git a/Lang/Red/Dot-product b/Lang/Red/Dot-product new file mode 120000 index 0000000000..7a0eb69ac3 --- /dev/null +++ b/Lang/Red/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Red \ No newline at end of file diff --git a/Lang/Red/Empty-directory b/Lang/Red/Empty-directory new file mode 120000 index 0000000000..171a4f4f65 --- /dev/null +++ b/Lang/Red/Empty-directory @@ -0,0 +1 @@ +../../Task/Empty-directory/Red \ No newline at end of file diff --git a/Lang/Red/Execute-Brain- b/Lang/Red/Execute-Brain- new file mode 120000 index 0000000000..603437fa06 --- /dev/null +++ b/Lang/Red/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/Red \ No newline at end of file diff --git a/Lang/Red/Extend-your-language b/Lang/Red/Extend-your-language new file mode 120000 index 0000000000..af9a4e8c46 --- /dev/null +++ b/Lang/Red/Extend-your-language @@ -0,0 +1 @@ +../../Task/Extend-your-language/Red \ No newline at end of file diff --git a/Lang/Red/First-class-functions b/Lang/Red/First-class-functions new file mode 120000 index 0000000000..fbfe38fd28 --- /dev/null +++ b/Lang/Red/First-class-functions @@ -0,0 +1 @@ +../../Task/First-class-functions/Red \ No newline at end of file diff --git a/Lang/Red/Five-weekends b/Lang/Red/Five-weekends new file mode 120000 index 0000000000..4b364097a6 --- /dev/null +++ b/Lang/Red/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/Red \ No newline at end of file diff --git a/Lang/Red/Function-composition b/Lang/Red/Function-composition new file mode 120000 index 0000000000..880a1c6e87 --- /dev/null +++ b/Lang/Red/Function-composition @@ -0,0 +1 @@ +../../Task/Function-composition/Red \ No newline at end of file diff --git a/Lang/Red/HTTP b/Lang/Red/HTTP new file mode 120000 index 0000000000..f7d36ebcff --- /dev/null +++ b/Lang/Red/HTTP @@ -0,0 +1 @@ +../../Task/HTTP/Red \ No newline at end of file diff --git a/Lang/Red/Leap-year b/Lang/Red/Leap-year new file mode 120000 index 0000000000..cb911ae827 --- /dev/null +++ b/Lang/Red/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Red \ No newline at end of file diff --git a/Lang/Red/Logical-operations b/Lang/Red/Logical-operations new file mode 120000 index 0000000000..b02eaed36f --- /dev/null +++ b/Lang/Red/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Red \ No newline at end of file diff --git a/Lang/Red/Metaprogramming b/Lang/Red/Metaprogramming new file mode 120000 index 0000000000..764ff52337 --- /dev/null +++ b/Lang/Red/Metaprogramming @@ -0,0 +1 @@ +../../Task/Metaprogramming/Red \ No newline at end of file diff --git a/Lang/Red/Parsing-RPN-calculator-algorithm b/Lang/Red/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..f68a7bf5c6 --- /dev/null +++ b/Lang/Red/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/Red \ No newline at end of file diff --git a/Lang/Red/Parsing-RPN-to-infix-conversion b/Lang/Red/Parsing-RPN-to-infix-conversion new file mode 120000 index 0000000000..27fb99e707 --- /dev/null +++ b/Lang/Red/Parsing-RPN-to-infix-conversion @@ -0,0 +1 @@ +../../Task/Parsing-RPN-to-infix-conversion/Red \ No newline at end of file diff --git a/Lang/Red/Parsing-Shunting-yard-algorithm b/Lang/Red/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..64583c9508 --- /dev/null +++ b/Lang/Red/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/Red \ No newline at end of file diff --git a/Lang/Red/Partial-function-application b/Lang/Red/Partial-function-application new file mode 120000 index 0000000000..dbffa4d18e --- /dev/null +++ b/Lang/Red/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/Red \ No newline at end of file diff --git a/Lang/Red/Quaternion-type b/Lang/Red/Quaternion-type deleted file mode 120000 index 7b5fc87ddd..0000000000 --- a/Lang/Red/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Red \ No newline at end of file diff --git a/Lang/Red/Rosetta-Code-Find-unimplemented-tasks b/Lang/Red/Rosetta-Code-Find-unimplemented-tasks new file mode 120000 index 0000000000..53726178b5 --- /dev/null +++ b/Lang/Red/Rosetta-Code-Find-unimplemented-tasks @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Find-unimplemented-tasks/Red \ No newline at end of file diff --git a/Lang/Red/Runtime-evaluation-In-an-environment b/Lang/Red/Runtime-evaluation-In-an-environment new file mode 120000 index 0000000000..ee82b72bbd --- /dev/null +++ b/Lang/Red/Runtime-evaluation-In-an-environment @@ -0,0 +1 @@ +../../Task/Runtime-evaluation-In-an-environment/Red \ No newline at end of file diff --git a/Lang/Red/Towers-of-Hanoi b/Lang/Red/Towers-of-Hanoi new file mode 120000 index 0000000000..112b276dee --- /dev/null +++ b/Lang/Red/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Red \ No newline at end of file diff --git a/Lang/Red/Vector-products b/Lang/Red/Vector-products new file mode 120000 index 0000000000..28d3b45939 --- /dev/null +++ b/Lang/Red/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/Red \ No newline at end of file diff --git a/Lang/Red/Word-frequency b/Lang/Red/Word-frequency new file mode 120000 index 0000000000..535322fbdc --- /dev/null +++ b/Lang/Red/Word-frequency @@ -0,0 +1 @@ +../../Task/Word-frequency/Red \ No newline at end of file diff --git a/Lang/Refal/100-doors b/Lang/Refal/100-doors new file mode 120000 index 0000000000..b42ae17bb5 --- /dev/null +++ b/Lang/Refal/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Refal \ No newline at end of file diff --git a/Lang/Refal/99-bottles-of-beer b/Lang/Refal/99-bottles-of-beer new file mode 120000 index 0000000000..2ee58c482a --- /dev/null +++ b/Lang/Refal/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/Refal \ No newline at end of file diff --git a/Lang/Refal/ABC-problem b/Lang/Refal/ABC-problem new file mode 120000 index 0000000000..147e0c9c08 --- /dev/null +++ b/Lang/Refal/ABC-problem @@ -0,0 +1 @@ +../../Task/ABC-problem/Refal \ No newline at end of file diff --git a/Lang/Refal/Ackermann-function b/Lang/Refal/Ackermann-function new file mode 120000 index 0000000000..b15c3eabf7 --- /dev/null +++ b/Lang/Refal/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Refal \ No newline at end of file diff --git a/Lang/Refal/Align-columns b/Lang/Refal/Align-columns new file mode 120000 index 0000000000..8c214d7af1 --- /dev/null +++ b/Lang/Refal/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Refal \ No newline at end of file diff --git a/Lang/Refal/Arbitrary-precision-integers-included- b/Lang/Refal/Arbitrary-precision-integers-included- new file mode 120000 index 0000000000..f00d324a4e --- /dev/null +++ b/Lang/Refal/Arbitrary-precision-integers-included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers-included-/Refal \ No newline at end of file diff --git a/Lang/Refal/Arithmetic-derivative b/Lang/Refal/Arithmetic-derivative new file mode 120000 index 0000000000..c88f60d44d --- /dev/null +++ b/Lang/Refal/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Refal \ No newline at end of file diff --git a/Lang/Refal/Bell-numbers b/Lang/Refal/Bell-numbers new file mode 120000 index 0000000000..a73ced2740 --- /dev/null +++ b/Lang/Refal/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/Refal \ No newline at end of file diff --git a/Lang/Refal/Binary-digits b/Lang/Refal/Binary-digits new file mode 120000 index 0000000000..671ac48fe5 --- /dev/null +++ b/Lang/Refal/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Refal \ No newline at end of file diff --git a/Lang/Refal/Case-sensitivity-of-identifiers b/Lang/Refal/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..7def95d498 --- /dev/null +++ b/Lang/Refal/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Refal \ No newline at end of file diff --git a/Lang/Refal/Catamorphism b/Lang/Refal/Catamorphism new file mode 120000 index 0000000000..dd93ebc37a --- /dev/null +++ b/Lang/Refal/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Refal \ No newline at end of file diff --git a/Lang/Refal/Combinations b/Lang/Refal/Combinations new file mode 120000 index 0000000000..d4a5475872 --- /dev/null +++ b/Lang/Refal/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Refal \ No newline at end of file diff --git a/Lang/Refal/Comma-quibbling b/Lang/Refal/Comma-quibbling new file mode 120000 index 0000000000..e0a180f35a --- /dev/null +++ b/Lang/Refal/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Refal \ No newline at end of file diff --git a/Lang/Refal/Copy-stdin-to-stdout b/Lang/Refal/Copy-stdin-to-stdout new file mode 120000 index 0000000000..974e13964c --- /dev/null +++ b/Lang/Refal/Copy-stdin-to-stdout @@ -0,0 +1 @@ +../../Task/Copy-stdin-to-stdout/Refal \ No newline at end of file diff --git a/Lang/Refal/Count-in-factors b/Lang/Refal/Count-in-factors new file mode 120000 index 0000000000..8f09f07e9c --- /dev/null +++ b/Lang/Refal/Count-in-factors @@ -0,0 +1 @@ +../../Task/Count-in-factors/Refal \ No newline at end of file diff --git a/Lang/Refal/Count-occurrences-of-a-substring b/Lang/Refal/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..3ee1567368 --- /dev/null +++ b/Lang/Refal/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Refal \ No newline at end of file diff --git a/Lang/Refal/Damm-algorithm b/Lang/Refal/Damm-algorithm new file mode 120000 index 0000000000..9b99056b8a --- /dev/null +++ b/Lang/Refal/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/Refal \ No newline at end of file diff --git a/Lang/Refal/Determine-if-a-string-is-collapsible b/Lang/Refal/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..93d8d21f97 --- /dev/null +++ b/Lang/Refal/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/Refal \ No newline at end of file diff --git a/Lang/Refal/Determine-sentence-type b/Lang/Refal/Determine-sentence-type new file mode 120000 index 0000000000..13809ebd86 --- /dev/null +++ b/Lang/Refal/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Refal \ No newline at end of file diff --git a/Lang/Refal/Disarium-numbers b/Lang/Refal/Disarium-numbers new file mode 120000 index 0000000000..7389ead892 --- /dev/null +++ b/Lang/Refal/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/Refal \ No newline at end of file diff --git a/Lang/Refal/Discordian-date b/Lang/Refal/Discordian-date new file mode 120000 index 0000000000..e18bd824ca --- /dev/null +++ b/Lang/Refal/Discordian-date @@ -0,0 +1 @@ +../../Task/Discordian-date/Refal \ No newline at end of file diff --git a/Lang/Refal/Display-a-linear-combination b/Lang/Refal/Display-a-linear-combination new file mode 120000 index 0000000000..fc164db566 --- /dev/null +++ b/Lang/Refal/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/Refal \ No newline at end of file diff --git a/Lang/Refal/Doomsday-rule b/Lang/Refal/Doomsday-rule new file mode 120000 index 0000000000..87fb488eaa --- /dev/null +++ b/Lang/Refal/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/Refal \ No newline at end of file diff --git a/Lang/Refal/Duffinian-numbers b/Lang/Refal/Duffinian-numbers new file mode 120000 index 0000000000..7aec5bb21b --- /dev/null +++ b/Lang/Refal/Duffinian-numbers @@ -0,0 +1 @@ +../../Task/Duffinian-numbers/Refal \ No newline at end of file diff --git a/Lang/Refal/Execute-Brain- b/Lang/Refal/Execute-Brain- new file mode 120000 index 0000000000..b2a669e873 --- /dev/null +++ b/Lang/Refal/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/Refal \ No newline at end of file diff --git a/Lang/Refal/Execute-a-Markov-algorithm b/Lang/Refal/Execute-a-Markov-algorithm new file mode 120000 index 0000000000..1c5c0f5111 --- /dev/null +++ b/Lang/Refal/Execute-a-Markov-algorithm @@ -0,0 +1 @@ +../../Task/Execute-a-Markov-algorithm/Refal \ No newline at end of file diff --git a/Lang/Refal/Factorial b/Lang/Refal/Factorial new file mode 120000 index 0000000000..0fea43897c --- /dev/null +++ b/Lang/Refal/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Refal \ No newline at end of file diff --git a/Lang/Refal/Factors-of-an-integer b/Lang/Refal/Factors-of-an-integer new file mode 120000 index 0000000000..b8b431c369 --- /dev/null +++ b/Lang/Refal/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Refal \ No newline at end of file diff --git a/Lang/Refal/Fibonacci-sequence b/Lang/Refal/Fibonacci-sequence new file mode 120000 index 0000000000..ef7f1ccdd3 --- /dev/null +++ b/Lang/Refal/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Refal \ No newline at end of file diff --git a/Lang/Refal/FizzBuzz b/Lang/Refal/FizzBuzz new file mode 120000 index 0000000000..dc9c8c4e2c --- /dev/null +++ b/Lang/Refal/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Refal \ No newline at end of file diff --git a/Lang/Refal/Flatten-a-list b/Lang/Refal/Flatten-a-list new file mode 120000 index 0000000000..b2445ac726 --- /dev/null +++ b/Lang/Refal/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Refal \ No newline at end of file diff --git a/Lang/Refal/Floyds-triangle b/Lang/Refal/Floyds-triangle new file mode 120000 index 0000000000..6aecb0c402 --- /dev/null +++ b/Lang/Refal/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/Refal \ No newline at end of file diff --git a/Lang/Refal/Fractran b/Lang/Refal/Fractran new file mode 120000 index 0000000000..30b9e7a511 --- /dev/null +++ b/Lang/Refal/Fractran @@ -0,0 +1 @@ +../../Task/Fractran/Refal \ No newline at end of file diff --git a/Lang/Refal/General-FizzBuzz b/Lang/Refal/General-FizzBuzz new file mode 120000 index 0000000000..019727fd06 --- /dev/null +++ b/Lang/Refal/General-FizzBuzz @@ -0,0 +1 @@ +../../Task/General-FizzBuzz/Refal \ No newline at end of file diff --git a/Lang/Refal/Greatest-common-divisor b/Lang/Refal/Greatest-common-divisor new file mode 120000 index 0000000000..4c2254b5ab --- /dev/null +++ b/Lang/Refal/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Refal \ No newline at end of file diff --git a/Lang/Refal/Hailstone-sequence b/Lang/Refal/Hailstone-sequence new file mode 120000 index 0000000000..3262ce3df7 --- /dev/null +++ b/Lang/Refal/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Refal \ No newline at end of file diff --git a/Lang/Refal/Happy-numbers b/Lang/Refal/Happy-numbers new file mode 120000 index 0000000000..16f1b20516 --- /dev/null +++ b/Lang/Refal/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/Refal \ No newline at end of file diff --git a/Lang/Refal/Harshad-or-Niven-series b/Lang/Refal/Harshad-or-Niven-series new file mode 120000 index 0000000000..da848d997c --- /dev/null +++ b/Lang/Refal/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/Refal \ No newline at end of file diff --git a/Lang/Refal/Hello-world-Text b/Lang/Refal/Hello-world-Text new file mode 120000 index 0000000000..3c67e6fb12 --- /dev/null +++ b/Lang/Refal/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Refal \ No newline at end of file diff --git a/Lang/Refal/Horners-rule-for-polynomial-evaluation b/Lang/Refal/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..29b0a0f26a --- /dev/null +++ b/Lang/Refal/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Refal \ No newline at end of file diff --git a/Lang/Refal/ISBN13-check-digit b/Lang/Refal/ISBN13-check-digit new file mode 120000 index 0000000000..0873085510 --- /dev/null +++ b/Lang/Refal/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/Refal \ No newline at end of file diff --git a/Lang/Refal/Isqrt-integer-square-root-of-X b/Lang/Refal/Isqrt-integer-square-root-of-X new file mode 120000 index 0000000000..812b5e86d3 --- /dev/null +++ b/Lang/Refal/Isqrt-integer-square-root-of-X @@ -0,0 +1 @@ +../../Task/Isqrt-integer-square-root-of-X/Refal \ No newline at end of file diff --git a/Lang/Refal/Jewels-and-stones b/Lang/Refal/Jewels-and-stones new file mode 120000 index 0000000000..d8c63e5bb3 --- /dev/null +++ b/Lang/Refal/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/Refal \ No newline at end of file diff --git a/Lang/Refal/Lah-numbers b/Lang/Refal/Lah-numbers new file mode 120000 index 0000000000..a761f59719 --- /dev/null +++ b/Lang/Refal/Lah-numbers @@ -0,0 +1 @@ +../../Task/Lah-numbers/Refal \ No newline at end of file diff --git a/Lang/Refal/Letter-frequency b/Lang/Refal/Letter-frequency new file mode 120000 index 0000000000..e9c48e99dd --- /dev/null +++ b/Lang/Refal/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/Refal \ No newline at end of file diff --git a/Lang/Refal/Levenshtein-distance b/Lang/Refal/Levenshtein-distance new file mode 120000 index 0000000000..dffc24ebd3 --- /dev/null +++ b/Lang/Refal/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Refal \ No newline at end of file diff --git a/Lang/Refal/Longest-common-substring b/Lang/Refal/Longest-common-substring new file mode 120000 index 0000000000..2c12f47190 --- /dev/null +++ b/Lang/Refal/Longest-common-substring @@ -0,0 +1 @@ +../../Task/Longest-common-substring/Refal \ No newline at end of file diff --git a/Lang/Refal/Look-and-say-sequence b/Lang/Refal/Look-and-say-sequence new file mode 120000 index 0000000000..31bd518515 --- /dev/null +++ b/Lang/Refal/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/Refal \ No newline at end of file diff --git a/Lang/Refal/Loops-Infinite b/Lang/Refal/Loops-Infinite new file mode 120000 index 0000000000..536c01c9bd --- /dev/null +++ b/Lang/Refal/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Refal \ No newline at end of file diff --git a/Lang/Refal/Luhn-test-of-credit-card-numbers b/Lang/Refal/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..4caee7398b --- /dev/null +++ b/Lang/Refal/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Refal \ No newline at end of file diff --git a/Lang/Refal/McNuggets-problem b/Lang/Refal/McNuggets-problem new file mode 120000 index 0000000000..90628a4989 --- /dev/null +++ b/Lang/Refal/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/Refal \ No newline at end of file diff --git a/Lang/Refal/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/Refal/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..8eb3682d6d --- /dev/null +++ b/Lang/Refal/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/Refal \ No newline at end of file diff --git a/Lang/Refal/Modular-exponentiation b/Lang/Refal/Modular-exponentiation new file mode 120000 index 0000000000..68c13863de --- /dev/null +++ b/Lang/Refal/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/Refal \ No newline at end of file diff --git a/Lang/Refal/Move-to-front-algorithm b/Lang/Refal/Move-to-front-algorithm new file mode 120000 index 0000000000..e69e4f5498 --- /dev/null +++ b/Lang/Refal/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/Refal \ No newline at end of file diff --git a/Lang/Refal/Mutual-recursion b/Lang/Refal/Mutual-recursion new file mode 120000 index 0000000000..6f6c869fc0 --- /dev/null +++ b/Lang/Refal/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/Refal \ No newline at end of file diff --git a/Lang/Refal/Narcissistic-decimal-number b/Lang/Refal/Narcissistic-decimal-number new file mode 120000 index 0000000000..3c509c9753 --- /dev/null +++ b/Lang/Refal/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/Refal \ No newline at end of file diff --git a/Lang/Refal/Nested-templated-data b/Lang/Refal/Nested-templated-data new file mode 120000 index 0000000000..ceaf039a10 --- /dev/null +++ b/Lang/Refal/Nested-templated-data @@ -0,0 +1 @@ +../../Task/Nested-templated-data/Refal \ No newline at end of file diff --git a/Lang/Refal/Nth b/Lang/Refal/Nth new file mode 120000 index 0000000000..d97088a29d --- /dev/null +++ b/Lang/Refal/Nth @@ -0,0 +1 @@ +../../Task/Nth/Refal \ No newline at end of file diff --git a/Lang/Refal/Old-lady-swallowed-a-fly b/Lang/Refal/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..63d7ebf658 --- /dev/null +++ b/Lang/Refal/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/Refal \ No newline at end of file diff --git a/Lang/Refal/One-dimensional-cellular-automata b/Lang/Refal/One-dimensional-cellular-automata new file mode 120000 index 0000000000..89b9ba280e --- /dev/null +++ b/Lang/Refal/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Refal \ No newline at end of file diff --git a/Lang/Refal/Ordered-words b/Lang/Refal/Ordered-words new file mode 120000 index 0000000000..b546984c01 --- /dev/null +++ b/Lang/Refal/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Refal \ No newline at end of file diff --git a/Lang/Refal/Palindrome-detection b/Lang/Refal/Palindrome-detection new file mode 120000 index 0000000000..87f1ace89c --- /dev/null +++ b/Lang/Refal/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Refal \ No newline at end of file diff --git a/Lang/Refal/Partition-an-integer-x-into-n-primes b/Lang/Refal/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..753c6c44f9 --- /dev/null +++ b/Lang/Refal/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/Refal \ No newline at end of file diff --git a/Lang/Refal/Phrase-reversals b/Lang/Refal/Phrase-reversals new file mode 120000 index 0000000000..1ba657880f --- /dev/null +++ b/Lang/Refal/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Refal \ No newline at end of file diff --git a/Lang/Refal/Population-count b/Lang/Refal/Population-count new file mode 120000 index 0000000000..3cdd939b69 --- /dev/null +++ b/Lang/Refal/Population-count @@ -0,0 +1 @@ +../../Task/Population-count/Refal \ No newline at end of file diff --git a/Lang/Refal/Power-set b/Lang/Refal/Power-set new file mode 120000 index 0000000000..f50da086ad --- /dev/null +++ b/Lang/Refal/Power-set @@ -0,0 +1 @@ +../../Task/Power-set/Refal \ No newline at end of file diff --git a/Lang/Refal/Primality-by-Wilsons-theorem b/Lang/Refal/Primality-by-Wilsons-theorem new file mode 120000 index 0000000000..c38ba6debb --- /dev/null +++ b/Lang/Refal/Primality-by-Wilsons-theorem @@ -0,0 +1 @@ +../../Task/Primality-by-Wilsons-theorem/Refal \ No newline at end of file diff --git a/Lang/Refal/Rep-string b/Lang/Refal/Rep-string new file mode 120000 index 0000000000..07bd8a4a37 --- /dev/null +++ b/Lang/Refal/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/Refal \ No newline at end of file diff --git a/Lang/Refal/Repeat b/Lang/Refal/Repeat new file mode 120000 index 0000000000..1cdb36e096 --- /dev/null +++ b/Lang/Refal/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/Refal \ No newline at end of file diff --git a/Lang/Refal/Reverse-a-string b/Lang/Refal/Reverse-a-string new file mode 120000 index 0000000000..32d7c21312 --- /dev/null +++ b/Lang/Refal/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Refal \ No newline at end of file diff --git a/Lang/Refal/Roman-numerals-Decode b/Lang/Refal/Roman-numerals-Decode new file mode 120000 index 0000000000..a0cf44e107 --- /dev/null +++ b/Lang/Refal/Roman-numerals-Decode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Decode/Refal \ No newline at end of file diff --git a/Lang/Refal/Roman-numerals-Encode b/Lang/Refal/Roman-numerals-Encode new file mode 120000 index 0000000000..a35e7a2ee0 --- /dev/null +++ b/Lang/Refal/Roman-numerals-Encode @@ -0,0 +1 @@ +../../Task/Roman-numerals-Encode/Refal \ No newline at end of file diff --git a/Lang/Refal/Run-length-encoding b/Lang/Refal/Run-length-encoding new file mode 120000 index 0000000000..afeb7091c3 --- /dev/null +++ b/Lang/Refal/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/Refal \ No newline at end of file diff --git a/Lang/Refal/Set-consolidation b/Lang/Refal/Set-consolidation new file mode 120000 index 0000000000..cef298e79b --- /dev/null +++ b/Lang/Refal/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/Refal \ No newline at end of file diff --git a/Lang/Refal/Sierpinski-triangle b/Lang/Refal/Sierpinski-triangle new file mode 120000 index 0000000000..078d645de8 --- /dev/null +++ b/Lang/Refal/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/Refal \ No newline at end of file diff --git a/Lang/Refal/Sieve-of-Eratosthenes b/Lang/Refal/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..c82f28137f --- /dev/null +++ b/Lang/Refal/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/Refal \ No newline at end of file diff --git a/Lang/Refal/Sorting-algorithms-Insertion-sort b/Lang/Refal/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..55abe9cc64 --- /dev/null +++ b/Lang/Refal/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/Refal \ No newline at end of file diff --git a/Lang/Refal/Sorting-algorithms-Merge-sort b/Lang/Refal/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..9375e30960 --- /dev/null +++ b/Lang/Refal/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/Refal \ No newline at end of file diff --git a/Lang/Refal/Sorting-algorithms-Quicksort b/Lang/Refal/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..9251c355c6 --- /dev/null +++ b/Lang/Refal/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Refal \ No newline at end of file diff --git a/Lang/Refal/Split-a-character-string-based-on-change-of-character b/Lang/Refal/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..8a3aec8866 --- /dev/null +++ b/Lang/Refal/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/Refal \ No newline at end of file diff --git a/Lang/Refal/Square-but-not-cube b/Lang/Refal/Square-but-not-cube new file mode 120000 index 0000000000..a50417a708 --- /dev/null +++ b/Lang/Refal/Square-but-not-cube @@ -0,0 +1 @@ +../../Task/Square-but-not-cube/Refal \ No newline at end of file diff --git a/Lang/Refal/Stern-Brocot-sequence b/Lang/Refal/Stern-Brocot-sequence new file mode 120000 index 0000000000..0b56a77639 --- /dev/null +++ b/Lang/Refal/Stern-Brocot-sequence @@ -0,0 +1 @@ +../../Task/Stern-Brocot-sequence/Refal \ No newline at end of file diff --git a/Lang/Refal/Strip-a-set-of-characters-from-a-string b/Lang/Refal/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..b5ca9bf99d --- /dev/null +++ b/Lang/Refal/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Refal \ No newline at end of file diff --git a/Lang/Refal/Strip-comments-from-a-string b/Lang/Refal/Strip-comments-from-a-string new file mode 120000 index 0000000000..6f86213c31 --- /dev/null +++ b/Lang/Refal/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/Refal \ No newline at end of file diff --git a/Lang/Refal/Sum-of-squares b/Lang/Refal/Sum-of-squares new file mode 120000 index 0000000000..171c9074d7 --- /dev/null +++ b/Lang/Refal/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/Refal \ No newline at end of file diff --git a/Lang/Refal/Super-d-numbers b/Lang/Refal/Super-d-numbers new file mode 120000 index 0000000000..923b4678f8 --- /dev/null +++ b/Lang/Refal/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/Refal \ No newline at end of file diff --git a/Lang/Refal/Symmetric-difference b/Lang/Refal/Symmetric-difference new file mode 120000 index 0000000000..e1a4a3e3a0 --- /dev/null +++ b/Lang/Refal/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/Refal \ No newline at end of file diff --git a/Lang/Refal/Take-notes-on-the-command-line b/Lang/Refal/Take-notes-on-the-command-line new file mode 120000 index 0000000000..349867d9ce --- /dev/null +++ b/Lang/Refal/Take-notes-on-the-command-line @@ -0,0 +1 @@ +../../Task/Take-notes-on-the-command-line/Refal \ No newline at end of file diff --git a/Lang/Refal/Thue-Morse b/Lang/Refal/Thue-Morse new file mode 120000 index 0000000000..f4e3ddd3b0 --- /dev/null +++ b/Lang/Refal/Thue-Morse @@ -0,0 +1 @@ +../../Task/Thue-Morse/Refal \ No newline at end of file diff --git a/Lang/Refal/Tokenize-a-string b/Lang/Refal/Tokenize-a-string new file mode 120000 index 0000000000..f8ac7459de --- /dev/null +++ b/Lang/Refal/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Refal \ No newline at end of file diff --git a/Lang/Refal/Towers-of-Hanoi b/Lang/Refal/Towers-of-Hanoi new file mode 120000 index 0000000000..8fe4b6b370 --- /dev/null +++ b/Lang/Refal/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Refal \ No newline at end of file diff --git a/Lang/Refal/Tree-traversal b/Lang/Refal/Tree-traversal new file mode 120000 index 0000000000..9d83db52d1 --- /dev/null +++ b/Lang/Refal/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/Refal \ No newline at end of file diff --git a/Lang/Refal/Van-Eck-sequence b/Lang/Refal/Van-Eck-sequence new file mode 120000 index 0000000000..e8b3b8d52a --- /dev/null +++ b/Lang/Refal/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/Refal \ No newline at end of file diff --git a/Lang/Refal/Word-ladder b/Lang/Refal/Word-ladder new file mode 120000 index 0000000000..b43f6deb31 --- /dev/null +++ b/Lang/Refal/Word-ladder @@ -0,0 +1 @@ +../../Task/Word-ladder/Refal \ No newline at end of file diff --git a/Lang/Refal/Zeckendorf-number-representation b/Lang/Refal/Zeckendorf-number-representation new file mode 120000 index 0000000000..70b5a3265e --- /dev/null +++ b/Lang/Refal/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/Refal \ No newline at end of file diff --git a/Lang/Retro/Sieve-of-Eratosthenes b/Lang/Retro/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..d5617b7054 --- /dev/null +++ b/Lang/Retro/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/Retro \ No newline at end of file diff --git a/Lang/Retro/String-append b/Lang/Retro/String-append new file mode 120000 index 0000000000..db032f3f0a --- /dev/null +++ b/Lang/Retro/String-append @@ -0,0 +1 @@ +../../Task/String-append/Retro \ No newline at end of file diff --git a/Lang/Retro/Sum-multiples-of-3-and-5 b/Lang/Retro/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..cb0c42540d --- /dev/null +++ b/Lang/Retro/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/Retro \ No newline at end of file diff --git a/Lang/Rhombus/00-LANG.txt b/Lang/Rhombus/00-LANG.txt new file mode 100644 index 0000000000..ef9932595f --- /dev/null +++ b/Lang/Rhombus/00-LANG.txt @@ -0,0 +1,5 @@ +{{language +|exec=both +|gc=yes +|site=https://rhombus-lang.org/ +}} \ No newline at end of file diff --git a/Lang/Rhombus/00-META.yaml b/Lang/Rhombus/00-META.yaml new file mode 100644 index 0000000000..732b96d2eb --- /dev/null +++ b/Lang/Rhombus/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Rhombus diff --git a/Lang/Rhombus/99-bottles-of-beer b/Lang/Rhombus/99-bottles-of-beer new file mode 120000 index 0000000000..bcb9ee7049 --- /dev/null +++ b/Lang/Rhombus/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/Rhombus \ No newline at end of file diff --git a/Lang/Rhombus/Arbitrary-precision-integers-included- b/Lang/Rhombus/Arbitrary-precision-integers-included- new file mode 120000 index 0000000000..31558e19d7 --- /dev/null +++ b/Lang/Rhombus/Arbitrary-precision-integers-included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers-included-/Rhombus \ No newline at end of file diff --git a/Lang/Rhombus/Caesar-cipher b/Lang/Rhombus/Caesar-cipher new file mode 120000 index 0000000000..dd9f5453ed --- /dev/null +++ b/Lang/Rhombus/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Rhombus \ No newline at end of file diff --git a/Lang/Rhombus/Factorial b/Lang/Rhombus/Factorial new file mode 120000 index 0000000000..92b62c830f --- /dev/null +++ b/Lang/Rhombus/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Rhombus \ No newline at end of file diff --git a/Lang/Rhombus/Fibonacci-sequence b/Lang/Rhombus/Fibonacci-sequence new file mode 120000 index 0000000000..d496e8a0b2 --- /dev/null +++ b/Lang/Rhombus/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Rhombus \ No newline at end of file diff --git a/Lang/Rhombus/FizzBuzz b/Lang/Rhombus/FizzBuzz new file mode 120000 index 0000000000..5740514b72 --- /dev/null +++ b/Lang/Rhombus/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Rhombus \ No newline at end of file diff --git a/Lang/Rhombus/Guess-the-number-With-feedback b/Lang/Rhombus/Guess-the-number-With-feedback new file mode 120000 index 0000000000..c51dd719ba --- /dev/null +++ b/Lang/Rhombus/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/Rhombus \ No newline at end of file diff --git a/Lang/Rhombus/Hello-world-Text b/Lang/Rhombus/Hello-world-Text new file mode 120000 index 0000000000..11fb03859d --- /dev/null +++ b/Lang/Rhombus/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Rhombus \ No newline at end of file diff --git a/Lang/Rhombus/Inheritance-Single b/Lang/Rhombus/Inheritance-Single new file mode 120000 index 0000000000..2f478862d8 --- /dev/null +++ b/Lang/Rhombus/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/Rhombus \ No newline at end of file diff --git a/Lang/Rhombus/Polymorphism b/Lang/Rhombus/Polymorphism new file mode 120000 index 0000000000..a5540935b5 --- /dev/null +++ b/Lang/Rhombus/Polymorphism @@ -0,0 +1 @@ +../../Task/Polymorphism/Rhombus \ No newline at end of file diff --git a/Lang/Rhombus/Rot-13 b/Lang/Rhombus/Rot-13 new file mode 120000 index 0000000000..369226ff2f --- /dev/null +++ b/Lang/Rhombus/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Rhombus \ No newline at end of file diff --git a/Lang/Rhombus/Y-combinator b/Lang/Rhombus/Y-combinator new file mode 120000 index 0000000000..745c50d95d --- /dev/null +++ b/Lang/Rhombus/Y-combinator @@ -0,0 +1 @@ +../../Task/Y-combinator/Rhombus \ No newline at end of file diff --git a/Lang/Rhovas/Classes b/Lang/Rhovas/Classes new file mode 120000 index 0000000000..999aff3694 --- /dev/null +++ b/Lang/Rhovas/Classes @@ -0,0 +1 @@ +../../Task/Classes/Rhovas \ No newline at end of file diff --git a/Lang/Rhovas/Hello-world-Text b/Lang/Rhovas/Hello-world-Text new file mode 120000 index 0000000000..ecf43ced4a --- /dev/null +++ b/Lang/Rhovas/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Rhovas \ No newline at end of file diff --git a/Lang/Rhovas/Palindrome-detection b/Lang/Rhovas/Palindrome-detection new file mode 120000 index 0000000000..3bf0451ba7 --- /dev/null +++ b/Lang/Rhovas/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Rhovas \ No newline at end of file diff --git a/Lang/Ring/Bioinformatics-base-count b/Lang/Ring/Bioinformatics-base-count deleted file mode 120000 index 291f269ac6..0000000000 --- a/Lang/Ring/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Ring \ No newline at end of file diff --git a/Lang/Ring/Brilliant-numbers b/Lang/Ring/Brilliant-numbers new file mode 120000 index 0000000000..4e2621cdb9 --- /dev/null +++ b/Lang/Ring/Brilliant-numbers @@ -0,0 +1 @@ +../../Task/Brilliant-numbers/Ring \ No newline at end of file diff --git a/Lang/Ring/Colorful-numbers b/Lang/Ring/Colorful-numbers new file mode 120000 index 0000000000..0882269c01 --- /dev/null +++ b/Lang/Ring/Colorful-numbers @@ -0,0 +1 @@ +../../Task/Colorful-numbers/Ring \ No newline at end of file diff --git a/Lang/Ring/Compare-a-list-of-strings b/Lang/Ring/Compare-a-list-of-strings new file mode 120000 index 0000000000..308f7db9af --- /dev/null +++ b/Lang/Ring/Compare-a-list-of-strings @@ -0,0 +1 @@ +../../Task/Compare-a-list-of-strings/Ring \ No newline at end of file diff --git a/Lang/Ring/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k b/Lang/Ring/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k new file mode 120000 index 0000000000..cd105cb2cf --- /dev/null +++ b/Lang/Ring/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k @@ -0,0 +1 @@ +../../Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/Ring \ No newline at end of file diff --git a/Lang/Ring/Draw-a-clock b/Lang/Ring/Draw-a-clock new file mode 120000 index 0000000000..d4e59a0d8d --- /dev/null +++ b/Lang/Ring/Draw-a-clock @@ -0,0 +1 @@ +../../Task/Draw-a-clock/Ring \ No newline at end of file diff --git a/Lang/Ring/Duffinian-numbers b/Lang/Ring/Duffinian-numbers new file mode 120000 index 0000000000..297b9a5500 --- /dev/null +++ b/Lang/Ring/Duffinian-numbers @@ -0,0 +1 @@ +../../Task/Duffinian-numbers/Ring \ No newline at end of file diff --git a/Lang/Ring/Empty-program b/Lang/Ring/Empty-program deleted file mode 120000 index 05941ac0c2..0000000000 --- a/Lang/Ring/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Ring \ No newline at end of file diff --git a/Lang/Ring/Hex-words b/Lang/Ring/Hex-words new file mode 120000 index 0000000000..d85ee8e531 --- /dev/null +++ b/Lang/Ring/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/Ring \ No newline at end of file diff --git a/Lang/Ring/Miller-Rabin-primality-test b/Lang/Ring/Miller-Rabin-primality-test deleted file mode 120000 index dd0885b5c9..0000000000 --- a/Lang/Ring/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Ring \ No newline at end of file diff --git a/Lang/Ring/Selectively-replace-multiple-instances-of-a-character-within-a-string b/Lang/Ring/Selectively-replace-multiple-instances-of-a-character-within-a-string new file mode 120000 index 0000000000..238083a2d3 --- /dev/null +++ b/Lang/Ring/Selectively-replace-multiple-instances-of-a-character-within-a-string @@ -0,0 +1 @@ +../../Task/Selectively-replace-multiple-instances-of-a-character-within-a-string/Ring \ No newline at end of file diff --git a/Lang/Ring/Sorting-Algorithms-Circle-Sort b/Lang/Ring/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index de0338125a..0000000000 --- a/Lang/Ring/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Ring \ No newline at end of file diff --git a/Lang/Ring/Sorting-algorithms-Bead-sort b/Lang/Ring/Sorting-algorithms-Bead-sort new file mode 120000 index 0000000000..eea2153977 --- /dev/null +++ b/Lang/Ring/Sorting-algorithms-Bead-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bead-sort/Ring \ No newline at end of file diff --git a/Lang/Ring/Special-characters b/Lang/Ring/Special-characters new file mode 120000 index 0000000000..0dd3c257c9 --- /dev/null +++ b/Lang/Ring/Special-characters @@ -0,0 +1 @@ +../../Task/Special-characters/Ring \ No newline at end of file diff --git a/Lang/Ring/Truth-table b/Lang/Ring/Truth-table new file mode 120000 index 0000000000..b2ddf39eb1 --- /dev/null +++ b/Lang/Ring/Truth-table @@ -0,0 +1 @@ +../../Task/Truth-table/Ring \ No newline at end of file diff --git a/Lang/Ring/Twelve-statements b/Lang/Ring/Twelve-statements new file mode 120000 index 0000000000..539ba91df6 --- /dev/null +++ b/Lang/Ring/Twelve-statements @@ -0,0 +1 @@ +../../Task/Twelve-statements/Ring \ No newline at end of file diff --git a/Lang/Ring/Universal-Turing-machine b/Lang/Ring/Universal-Turing-machine new file mode 120000 index 0000000000..1e0cfd8b67 --- /dev/null +++ b/Lang/Ring/Universal-Turing-machine @@ -0,0 +1 @@ +../../Task/Universal-Turing-machine/Ring \ No newline at end of file diff --git a/Lang/Ring/Wagstaff-primes b/Lang/Ring/Wagstaff-primes new file mode 120000 index 0000000000..877433f537 --- /dev/null +++ b/Lang/Ring/Wagstaff-primes @@ -0,0 +1 @@ +../../Task/Wagstaff-primes/Ring \ No newline at end of file diff --git a/Lang/Ring/Wieferich-primes b/Lang/Ring/Wieferich-primes new file mode 120000 index 0000000000..4a7c97a04d --- /dev/null +++ b/Lang/Ring/Wieferich-primes @@ -0,0 +1 @@ +../../Task/Wieferich-primes/Ring \ No newline at end of file diff --git a/Lang/Ring/Yin-and-yang b/Lang/Ring/Yin-and-yang new file mode 120000 index 0000000000..b4e272e04d --- /dev/null +++ b/Lang/Ring/Yin-and-yang @@ -0,0 +1 @@ +../../Task/Yin-and-yang/Ring \ No newline at end of file diff --git a/Lang/Robotic/Empty-program b/Lang/Robotic/Empty-program deleted file mode 120000 index 5e2d95817a..0000000000 --- a/Lang/Robotic/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Robotic \ No newline at end of file diff --git a/Lang/Roc/00-LANG.txt b/Lang/Roc/00-LANG.txt new file mode 100644 index 0000000000..ffdb69b5dd --- /dev/null +++ b/Lang/Roc/00-LANG.txt @@ -0,0 +1,9 @@ +{{stub}} +{{language|Roc|site=https://www.roc-lang.org|tags=roc}} +{{Language programming paradigm|Functional}} + +Roc code is designed to build fast and run fast. It compiles to machine code or WebAssembly. + +Roc's syntax, semantics, and included toolset all prioritize user-friendliness. + +Roc has a small number of simple language primitives. It's a single-paradigm functional language. \ No newline at end of file diff --git a/Lang/Roc/00-META.yaml b/Lang/Roc/00-META.yaml new file mode 100644 index 0000000000..53c6cdad21 --- /dev/null +++ b/Lang/Roc/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Roc diff --git a/Lang/Roc/Binary-digits b/Lang/Roc/Binary-digits new file mode 120000 index 0000000000..da521e90f1 --- /dev/null +++ b/Lang/Roc/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Roc \ No newline at end of file diff --git a/Lang/Roc/Hello-world-Text b/Lang/Roc/Hello-world-Text new file mode 120000 index 0000000000..40fe742e73 --- /dev/null +++ b/Lang/Roc/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Roc \ No newline at end of file diff --git a/Lang/Rockstar/00-LANG.txt b/Lang/Rockstar/00-LANG.txt index 9dc3cbc2f7..c22e2c3636 100644 --- a/Lang/Rockstar/00-LANG.txt +++ b/Lang/Rockstar/00-LANG.txt @@ -1,4 +1,8 @@ -{{stub}}{{language|Rockstar}} +{{stub}} +{{language|Rockstar +|site=https://codewithrockstar.com/ +|hopl=no +}} Rockstar was created by a rockin' dude named Dylan Beattie. diff --git a/Lang/Rocq/00-LANG.txt b/Lang/Rocq/00-LANG.txt new file mode 100644 index 0000000000..3a6e02cc5b --- /dev/null +++ b/Lang/Rocq/00-LANG.txt @@ -0,0 +1,9 @@ +{{language|Rocq +|site=https://rocq-prover.org/ +}} +The '''Rocq Prover''' (previously known as '''Coq''') is a proof assistant application. It allows the expression of mathematical assertions, mechanically checks proofs of these assertions, helps to find formal proofs, and extracts a certified program from the constructive proof of its formal specification. Rocq works within the theory of the calculus of inductive constructions, a derivative of the calculus of constructions. Rocq is not an automated [[wp:Theorem_prover|theorem prover]] but includes automatic theorem proving tactics and various decision procedures. + +==Citations== +* [[wp:Rocq|Rocq]] + +[[Category:Mathematical programming languages]] \ No newline at end of file diff --git a/Lang/Rocq/00-META.yaml b/Lang/Rocq/00-META.yaml new file mode 100644 index 0000000000..7a4ef3c3e3 --- /dev/null +++ b/Lang/Rocq/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Rocq diff --git a/Lang/Rocq/100-doors b/Lang/Rocq/100-doors new file mode 120000 index 0000000000..ddc9d15706 --- /dev/null +++ b/Lang/Rocq/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Rocq \ No newline at end of file diff --git a/Lang/Rocq/Ackermann-function b/Lang/Rocq/Ackermann-function new file mode 120000 index 0000000000..2c359313d3 --- /dev/null +++ b/Lang/Rocq/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Rocq \ No newline at end of file diff --git a/Lang/Rocq/Extend-your-language b/Lang/Rocq/Extend-your-language new file mode 120000 index 0000000000..7a189585f3 --- /dev/null +++ b/Lang/Rocq/Extend-your-language @@ -0,0 +1 @@ +../../Task/Extend-your-language/Rocq \ No newline at end of file diff --git a/Lang/Rocq/Factorial b/Lang/Rocq/Factorial new file mode 120000 index 0000000000..73a7e2f546 --- /dev/null +++ b/Lang/Rocq/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Rocq \ No newline at end of file diff --git a/Lang/Rocq/Fibonacci-sequence b/Lang/Rocq/Fibonacci-sequence new file mode 120000 index 0000000000..a31a4762d2 --- /dev/null +++ b/Lang/Rocq/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Rocq \ No newline at end of file diff --git a/Lang/Rocq/FizzBuzz b/Lang/Rocq/FizzBuzz new file mode 120000 index 0000000000..3dc20e67b5 --- /dev/null +++ b/Lang/Rocq/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Rocq \ No newline at end of file diff --git a/Lang/Rocq/Hello-world-Newbie b/Lang/Rocq/Hello-world-Newbie new file mode 120000 index 0000000000..f8f6323716 --- /dev/null +++ b/Lang/Rocq/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/Rocq \ No newline at end of file diff --git a/Lang/Rocq/Hello-world-Text b/Lang/Rocq/Hello-world-Text new file mode 120000 index 0000000000..3d91fcb1de --- /dev/null +++ b/Lang/Rocq/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Rocq \ No newline at end of file diff --git a/Lang/Rocq/Loops-For b/Lang/Rocq/Loops-For new file mode 120000 index 0000000000..ea834fd5b7 --- /dev/null +++ b/Lang/Rocq/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Rocq \ No newline at end of file diff --git a/Lang/Rocq/Tree-traversal b/Lang/Rocq/Tree-traversal new file mode 120000 index 0000000000..944802a525 --- /dev/null +++ b/Lang/Rocq/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/Rocq \ No newline at end of file diff --git a/Lang/Rocq/Variadic-function b/Lang/Rocq/Variadic-function new file mode 120000 index 0000000000..0c5215f0a1 --- /dev/null +++ b/Lang/Rocq/Variadic-function @@ -0,0 +1 @@ +../../Task/Variadic-function/Rocq \ No newline at end of file diff --git a/Lang/Ruby/Bioinformatics-base-count b/Lang/Ruby/Bioinformatics-base-count deleted file mode 120000 index af92d7709c..0000000000 --- a/Lang/Ruby/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Miller-Rabin-primality-test b/Lang/Ruby/Miller-Rabin-primality-test deleted file mode 120000 index d7cbf43733..0000000000 --- a/Lang/Ruby/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Ormiston-triples b/Lang/Ruby/Ormiston-triples new file mode 120000 index 0000000000..db7035a22a --- /dev/null +++ b/Lang/Ruby/Ormiston-triples @@ -0,0 +1 @@ +../../Task/Ormiston-triples/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Padovan-n-step-number-sequences b/Lang/Ruby/Padovan-n-step-number-sequences new file mode 120000 index 0000000000..a80e7c6ea4 --- /dev/null +++ b/Lang/Ruby/Padovan-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Padovan-n-step-number-sequences/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Quaternion-type b/Lang/Ruby/Quaternion-type deleted file mode 120000 index c1af2a1904..0000000000 --- a/Lang/Ruby/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Sorting-Algorithms-Circle-Sort b/Lang/Ruby/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 022b44ef66..0000000000 --- a/Lang/Ruby/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Strassens-algorithm b/Lang/Ruby/Strassens-algorithm new file mode 120000 index 0000000000..ecb75a8f11 --- /dev/null +++ b/Lang/Ruby/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Variable-declaration-reset b/Lang/Ruby/Variable-declaration-reset new file mode 120000 index 0000000000..42ba082e34 --- /dev/null +++ b/Lang/Ruby/Variable-declaration-reset @@ -0,0 +1 @@ +../../Task/Variable-declaration-reset/Ruby \ No newline at end of file diff --git a/Lang/Run-BASIC/Casting-out-nines b/Lang/Run-BASIC/Casting-out-nines new file mode 120000 index 0000000000..883fdaf9c4 --- /dev/null +++ b/Lang/Run-BASIC/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Determine-sentence-type b/Lang/Run-BASIC/Determine-sentence-type new file mode 120000 index 0000000000..5db5f89e0c --- /dev/null +++ b/Lang/Run-BASIC/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Josephus-problem b/Lang/Run-BASIC/Josephus-problem new file mode 120000 index 0000000000..d5ce7e543e --- /dev/null +++ b/Lang/Run-BASIC/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Largest-proper-divisor-of-n b/Lang/Run-BASIC/Largest-proper-divisor-of-n new file mode 120000 index 0000000000..aa04ba2bd4 --- /dev/null +++ b/Lang/Run-BASIC/Largest-proper-divisor-of-n @@ -0,0 +1 @@ +../../Task/Largest-proper-divisor-of-n/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Meissel-Mertens-constant b/Lang/Run-BASIC/Meissel-Mertens-constant deleted file mode 120000 index 44168b020e..0000000000 --- a/Lang/Run-BASIC/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Miller-Rabin-primality-test b/Lang/Run-BASIC/Miller-Rabin-primality-test deleted file mode 120000 index 13b7319b57..0000000000 --- a/Lang/Run-BASIC/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Nested-templated-data b/Lang/Run-BASIC/Nested-templated-data new file mode 120000 index 0000000000..e2c607e939 --- /dev/null +++ b/Lang/Run-BASIC/Nested-templated-data @@ -0,0 +1 @@ +../../Task/Nested-templated-data/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Numbers-with-equal-rises-and-falls b/Lang/Run-BASIC/Numbers-with-equal-rises-and-falls new file mode 120000 index 0000000000..b0e664881e --- /dev/null +++ b/Lang/Run-BASIC/Numbers-with-equal-rises-and-falls @@ -0,0 +1 @@ +../../Task/Numbers-with-equal-rises-and-falls/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Pancake-numbers b/Lang/Run-BASIC/Pancake-numbers new file mode 120000 index 0000000000..8078e50109 --- /dev/null +++ b/Lang/Run-BASIC/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Phrase-reversals b/Lang/Run-BASIC/Phrase-reversals new file mode 120000 index 0000000000..db249e8a6e --- /dev/null +++ b/Lang/Run-BASIC/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Population-count b/Lang/Run-BASIC/Population-count new file mode 120000 index 0000000000..ba78b398e1 --- /dev/null +++ b/Lang/Run-BASIC/Population-count @@ -0,0 +1 @@ +../../Task/Population-count/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors b/Lang/Run-BASIC/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors new file mode 120000 index 0000000000..3ec8051a16 --- /dev/null +++ b/Lang/Run-BASIC/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Set-consolidation b/Lang/Run-BASIC/Set-consolidation new file mode 120000 index 0000000000..5f53334e09 --- /dev/null +++ b/Lang/Run-BASIC/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Sorting-algorithms-Gnome-sort b/Lang/Run-BASIC/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..acdf9f6a32 --- /dev/null +++ b/Lang/Run-BASIC/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/Split-a-character-string-based-on-change-of-character b/Lang/Run-BASIC/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..afd1d6a928 --- /dev/null +++ b/Lang/Run-BASIC/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/Run-BASIC \ No newline at end of file diff --git a/Lang/Run-BASIC/The-Name-Game b/Lang/Run-BASIC/The-Name-Game new file mode 120000 index 0000000000..a0ca866e4a --- /dev/null +++ b/Lang/Run-BASIC/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/Run-BASIC \ No newline at end of file diff --git a/Lang/Rust/Almkvist-Giullera-formula-for-pi b/Lang/Rust/Almkvist-Giullera-formula-for-pi new file mode 120000 index 0000000000..495c52095c --- /dev/null +++ b/Lang/Rust/Almkvist-Giullera-formula-for-pi @@ -0,0 +1 @@ +../../Task/Almkvist-Giullera-formula-for-pi/Rust \ No newline at end of file diff --git a/Lang/Rust/Ascending-primes b/Lang/Rust/Ascending-primes new file mode 120000 index 0000000000..84fdafe351 --- /dev/null +++ b/Lang/Rust/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/Rust \ No newline at end of file diff --git a/Lang/Rust/B-zier-curves-Intersections b/Lang/Rust/B-zier-curves-Intersections new file mode 120000 index 0000000000..732ede6e4e --- /dev/null +++ b/Lang/Rust/B-zier-curves-Intersections @@ -0,0 +1 @@ +../../Task/B-zier-curves-Intersections/Rust \ No newline at end of file diff --git a/Lang/Rust/Bifid-cipher b/Lang/Rust/Bifid-cipher new file mode 120000 index 0000000000..8ddce2026b --- /dev/null +++ b/Lang/Rust/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/Rust \ No newline at end of file diff --git a/Lang/Rust/Bioinformatics-Global-alignment b/Lang/Rust/Bioinformatics-Global-alignment new file mode 120000 index 0000000000..3bbbc3b358 --- /dev/null +++ b/Lang/Rust/Bioinformatics-Global-alignment @@ -0,0 +1 @@ +../../Task/Bioinformatics-Global-alignment/Rust \ No newline at end of file diff --git a/Lang/Rust/Bioinformatics-base-count b/Lang/Rust/Bioinformatics-base-count deleted file mode 120000 index 412ded1361..0000000000 --- a/Lang/Rust/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Rust \ No newline at end of file diff --git a/Lang/Rust/Biorhythms b/Lang/Rust/Biorhythms new file mode 120000 index 0000000000..8d5ffa21d8 --- /dev/null +++ b/Lang/Rust/Biorhythms @@ -0,0 +1 @@ +../../Task/Biorhythms/Rust \ No newline at end of file diff --git a/Lang/Rust/Blum-integer b/Lang/Rust/Blum-integer new file mode 120000 index 0000000000..7a0e8a69ae --- /dev/null +++ b/Lang/Rust/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/Rust \ No newline at end of file diff --git a/Lang/Rust/Boyer-Moore-string-search b/Lang/Rust/Boyer-Moore-string-search new file mode 120000 index 0000000000..b70383335b --- /dev/null +++ b/Lang/Rust/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/Rust \ No newline at end of file diff --git a/Lang/Rust/Break-OO-privacy b/Lang/Rust/Break-OO-privacy new file mode 120000 index 0000000000..37b6e0d417 --- /dev/null +++ b/Lang/Rust/Break-OO-privacy @@ -0,0 +1 @@ +../../Task/Break-OO-privacy/Rust \ No newline at end of file diff --git a/Lang/Rust/Calendar---for-REAL-programmers b/Lang/Rust/Calendar---for-REAL-programmers new file mode 120000 index 0000000000..5bd1cebf14 --- /dev/null +++ b/Lang/Rust/Calendar---for-REAL-programmers @@ -0,0 +1 @@ +../../Task/Calendar---for-REAL-programmers/Rust \ No newline at end of file diff --git a/Lang/Rust/Camel-case-and-snake-case b/Lang/Rust/Camel-case-and-snake-case new file mode 120000 index 0000000000..5c92d90b28 --- /dev/null +++ b/Lang/Rust/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/Rust \ No newline at end of file diff --git a/Lang/Rust/Chowla-numbers b/Lang/Rust/Chowla-numbers new file mode 120000 index 0000000000..73e1040f4e --- /dev/null +++ b/Lang/Rust/Chowla-numbers @@ -0,0 +1 @@ +../../Task/Chowla-numbers/Rust \ No newline at end of file diff --git a/Lang/Rust/Color-quantization b/Lang/Rust/Color-quantization new file mode 120000 index 0000000000..76c5471c0f --- /dev/null +++ b/Lang/Rust/Color-quantization @@ -0,0 +1 @@ +../../Task/Color-quantization/Rust \ No newline at end of file diff --git a/Lang/Rust/Combinations-and-permutations b/Lang/Rust/Combinations-and-permutations new file mode 120000 index 0000000000..804dbde6ee --- /dev/null +++ b/Lang/Rust/Combinations-and-permutations @@ -0,0 +1 @@ +../../Task/Combinations-and-permutations/Rust \ No newline at end of file diff --git a/Lang/Rust/Commatizing-numbers b/Lang/Rust/Commatizing-numbers new file mode 120000 index 0000000000..5df0e95315 --- /dev/null +++ b/Lang/Rust/Commatizing-numbers @@ -0,0 +1 @@ +../../Task/Commatizing-numbers/Rust \ No newline at end of file diff --git a/Lang/Rust/Compare-sorting-algorithms-performance b/Lang/Rust/Compare-sorting-algorithms-performance new file mode 120000 index 0000000000..7676ca3dd8 --- /dev/null +++ b/Lang/Rust/Compare-sorting-algorithms-performance @@ -0,0 +1 @@ +../../Task/Compare-sorting-algorithms-performance/Rust \ No newline at end of file diff --git a/Lang/Rust/Compiler-AST-interpreter b/Lang/Rust/Compiler-AST-interpreter new file mode 120000 index 0000000000..2028e35209 --- /dev/null +++ b/Lang/Rust/Compiler-AST-interpreter @@ -0,0 +1 @@ +../../Task/Compiler-AST-interpreter/Rust \ No newline at end of file diff --git a/Lang/Rust/Compiler-code-generator b/Lang/Rust/Compiler-code-generator new file mode 120000 index 0000000000..fa460708f3 --- /dev/null +++ b/Lang/Rust/Compiler-code-generator @@ -0,0 +1 @@ +../../Task/Compiler-code-generator/Rust \ No newline at end of file diff --git a/Lang/Rust/Compiler-lexical-analyzer b/Lang/Rust/Compiler-lexical-analyzer new file mode 120000 index 0000000000..b603fdc69a --- /dev/null +++ b/Lang/Rust/Compiler-lexical-analyzer @@ -0,0 +1 @@ +../../Task/Compiler-lexical-analyzer/Rust \ No newline at end of file diff --git a/Lang/Rust/Compiler-syntax-analyzer b/Lang/Rust/Compiler-syntax-analyzer new file mode 120000 index 0000000000..4fa6fc40a8 --- /dev/null +++ b/Lang/Rust/Compiler-syntax-analyzer @@ -0,0 +1 @@ +../../Task/Compiler-syntax-analyzer/Rust \ No newline at end of file diff --git a/Lang/Rust/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- b/Lang/Rust/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- new file mode 120000 index 0000000000..7e0955d429 --- /dev/null +++ b/Lang/Rust/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n-/Rust \ No newline at end of file diff --git a/Lang/Rust/Cyclops-numbers b/Lang/Rust/Cyclops-numbers new file mode 120000 index 0000000000..044bb62e43 --- /dev/null +++ b/Lang/Rust/Cyclops-numbers @@ -0,0 +1 @@ +../../Task/Cyclops-numbers/Rust \ No newline at end of file diff --git a/Lang/Rust/Cyclotomic-polynomial b/Lang/Rust/Cyclotomic-polynomial new file mode 120000 index 0000000000..8ff16fabbb --- /dev/null +++ b/Lang/Rust/Cyclotomic-polynomial @@ -0,0 +1 @@ +../../Task/Cyclotomic-polynomial/Rust \ No newline at end of file diff --git a/Lang/Rust/De-Bruijn-sequences b/Lang/Rust/De-Bruijn-sequences new file mode 120000 index 0000000000..69c62c6871 --- /dev/null +++ b/Lang/Rust/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/Rust \ No newline at end of file diff --git a/Lang/Rust/Deconvolution-1D b/Lang/Rust/Deconvolution-1D new file mode 120000 index 0000000000..d02a914ea3 --- /dev/null +++ b/Lang/Rust/Deconvolution-1D @@ -0,0 +1 @@ +../../Task/Deconvolution-1D/Rust \ No newline at end of file diff --git a/Lang/Rust/Deconvolution-2D+ b/Lang/Rust/Deconvolution-2D+ new file mode 120000 index 0000000000..4b9cb470ba --- /dev/null +++ b/Lang/Rust/Deconvolution-2D+ @@ -0,0 +1 @@ +../../Task/Deconvolution-2D+/Rust \ No newline at end of file diff --git a/Lang/Rust/Demings-funnel b/Lang/Rust/Demings-funnel new file mode 120000 index 0000000000..295d5542ba --- /dev/null +++ b/Lang/Rust/Demings-funnel @@ -0,0 +1 @@ +../../Task/Demings-funnel/Rust \ No newline at end of file diff --git a/Lang/Rust/Descending-primes b/Lang/Rust/Descending-primes new file mode 120000 index 0000000000..fc953fbf4e --- /dev/null +++ b/Lang/Rust/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/Rust \ No newline at end of file diff --git a/Lang/Rust/Determine-if-two-triangles-overlap b/Lang/Rust/Determine-if-two-triangles-overlap new file mode 120000 index 0000000000..2bc1e5e063 --- /dev/null +++ b/Lang/Rust/Determine-if-two-triangles-overlap @@ -0,0 +1 @@ +../../Task/Determine-if-two-triangles-overlap/Rust \ No newline at end of file diff --git a/Lang/Rust/Determine-sentence-type b/Lang/Rust/Determine-sentence-type new file mode 120000 index 0000000000..caee594e4d --- /dev/null +++ b/Lang/Rust/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Rust \ No newline at end of file diff --git a/Lang/Rust/Doubly-linked-list-Definition b/Lang/Rust/Doubly-linked-list-Definition new file mode 120000 index 0000000000..9eb9054258 --- /dev/null +++ b/Lang/Rust/Doubly-linked-list-Definition @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Definition/Rust \ No newline at end of file diff --git a/Lang/Rust/Doubly-linked-list-Traversal b/Lang/Rust/Doubly-linked-list-Traversal new file mode 120000 index 0000000000..b44bd60c3c --- /dev/null +++ b/Lang/Rust/Doubly-linked-list-Traversal @@ -0,0 +1 @@ +../../Task/Doubly-linked-list-Traversal/Rust \ No newline at end of file diff --git a/Lang/Rust/Duffinian-numbers b/Lang/Rust/Duffinian-numbers new file mode 120000 index 0000000000..5a84e9b8ff --- /dev/null +++ b/Lang/Rust/Duffinian-numbers @@ -0,0 +1 @@ +../../Task/Duffinian-numbers/Rust \ No newline at end of file diff --git a/Lang/Rust/Eban-numbers b/Lang/Rust/Eban-numbers new file mode 120000 index 0000000000..cf564cdce5 --- /dev/null +++ b/Lang/Rust/Eban-numbers @@ -0,0 +1 @@ +../../Task/Eban-numbers/Rust \ No newline at end of file diff --git a/Lang/Rust/Eertree b/Lang/Rust/Eertree new file mode 120000 index 0000000000..80293e575c --- /dev/null +++ b/Lang/Rust/Eertree @@ -0,0 +1 @@ +../../Task/Eertree/Rust \ No newline at end of file diff --git a/Lang/Rust/Elliptic-Curve-Digital-Signature-Algorithm b/Lang/Rust/Elliptic-Curve-Digital-Signature-Algorithm new file mode 120000 index 0000000000..f6d4ecb90e --- /dev/null +++ b/Lang/Rust/Elliptic-Curve-Digital-Signature-Algorithm @@ -0,0 +1 @@ +../../Task/Elliptic-Curve-Digital-Signature-Algorithm/Rust \ No newline at end of file diff --git a/Lang/Rust/Elliptic-curve-arithmetic b/Lang/Rust/Elliptic-curve-arithmetic new file mode 120000 index 0000000000..cb1c49b6dd --- /dev/null +++ b/Lang/Rust/Elliptic-curve-arithmetic @@ -0,0 +1 @@ +../../Task/Elliptic-curve-arithmetic/Rust \ No newline at end of file diff --git a/Lang/Rust/Faulhabers-formula b/Lang/Rust/Faulhabers-formula new file mode 120000 index 0000000000..f7691b3566 --- /dev/null +++ b/Lang/Rust/Faulhabers-formula @@ -0,0 +1 @@ +../../Task/Faulhabers-formula/Rust \ No newline at end of file diff --git a/Lang/Rust/Faulhabers-triangle b/Lang/Rust/Faulhabers-triangle new file mode 120000 index 0000000000..49b5537877 --- /dev/null +++ b/Lang/Rust/Faulhabers-triangle @@ -0,0 +1 @@ +../../Task/Faulhabers-triangle/Rust \ No newline at end of file diff --git a/Lang/Rust/Find-if-a-point-is-within-a-triangle b/Lang/Rust/Find-if-a-point-is-within-a-triangle new file mode 120000 index 0000000000..4666c24b6c --- /dev/null +++ b/Lang/Rust/Find-if-a-point-is-within-a-triangle @@ -0,0 +1 @@ +../../Task/Find-if-a-point-is-within-a-triangle/Rust \ No newline at end of file diff --git a/Lang/Rust/Find-largest-left-truncatable-prime-in-a-given-base b/Lang/Rust/Find-largest-left-truncatable-prime-in-a-given-base new file mode 120000 index 0000000000..e7da5ced0b --- /dev/null +++ b/Lang/Rust/Find-largest-left-truncatable-prime-in-a-given-base @@ -0,0 +1 @@ +../../Task/Find-largest-left-truncatable-prime-in-a-given-base/Rust \ No newline at end of file diff --git a/Lang/Rust/Fractran b/Lang/Rust/Fractran new file mode 120000 index 0000000000..46ed1ab96e --- /dev/null +++ b/Lang/Rust/Fractran @@ -0,0 +1 @@ +../../Task/Fractran/Rust \ No newline at end of file diff --git a/Lang/Rust/French-Republican-calendar b/Lang/Rust/French-Republican-calendar new file mode 120000 index 0000000000..60dfe0f429 --- /dev/null +++ b/Lang/Rust/French-Republican-calendar @@ -0,0 +1 @@ +../../Task/French-Republican-calendar/Rust \ No newline at end of file diff --git a/Lang/Rust/Functional-coverage-tree b/Lang/Rust/Functional-coverage-tree new file mode 120000 index 0000000000..fab149755e --- /dev/null +++ b/Lang/Rust/Functional-coverage-tree @@ -0,0 +1 @@ +../../Task/Functional-coverage-tree/Rust \ No newline at end of file diff --git a/Lang/Rust/Gamma-function b/Lang/Rust/Gamma-function new file mode 120000 index 0000000000..f400cc415c --- /dev/null +++ b/Lang/Rust/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/Rust \ No newline at end of file diff --git a/Lang/Rust/Graph-colouring b/Lang/Rust/Graph-colouring new file mode 120000 index 0000000000..acb44a12b7 --- /dev/null +++ b/Lang/Rust/Graph-colouring @@ -0,0 +1 @@ +../../Task/Graph-colouring/Rust \ No newline at end of file diff --git a/Lang/Rust/Hex-words b/Lang/Rust/Hex-words new file mode 120000 index 0000000000..9322882ab9 --- /dev/null +++ b/Lang/Rust/Hex-words @@ -0,0 +1 @@ +../../Task/Hex-words/Rust \ No newline at end of file diff --git a/Lang/Rust/Humble-numbers b/Lang/Rust/Humble-numbers new file mode 120000 index 0000000000..001b631312 --- /dev/null +++ b/Lang/Rust/Humble-numbers @@ -0,0 +1 @@ +../../Task/Humble-numbers/Rust \ No newline at end of file diff --git a/Lang/Rust/Introspection b/Lang/Rust/Introspection new file mode 120000 index 0000000000..31d728e58c --- /dev/null +++ b/Lang/Rust/Introspection @@ -0,0 +1 @@ +../../Task/Introspection/Rust \ No newline at end of file diff --git a/Lang/Rust/Jordan-P-lya-numbers b/Lang/Rust/Jordan-P-lya-numbers new file mode 120000 index 0000000000..498a0c552f --- /dev/null +++ b/Lang/Rust/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Rust \ No newline at end of file diff --git a/Lang/Rust/Knapsack-problem-Bounded b/Lang/Rust/Knapsack-problem-Bounded new file mode 120000 index 0000000000..db57c7551f --- /dev/null +++ b/Lang/Rust/Knapsack-problem-Bounded @@ -0,0 +1 @@ +../../Task/Knapsack-problem-Bounded/Rust \ No newline at end of file diff --git a/Lang/Rust/Kosaraju b/Lang/Rust/Kosaraju new file mode 120000 index 0000000000..69a0c5ef3e --- /dev/null +++ b/Lang/Rust/Kosaraju @@ -0,0 +1 @@ +../../Task/Kosaraju/Rust \ No newline at end of file diff --git a/Lang/Rust/Largest-proper-divisor-of-n b/Lang/Rust/Largest-proper-divisor-of-n new file mode 120000 index 0000000000..338cb9cb51 --- /dev/null +++ b/Lang/Rust/Largest-proper-divisor-of-n @@ -0,0 +1 @@ +../../Task/Largest-proper-divisor-of-n/Rust \ No newline at end of file diff --git a/Lang/Rust/Latin-Squares-in-reduced-form b/Lang/Rust/Latin-Squares-in-reduced-form new file mode 120000 index 0000000000..17d284a00f --- /dev/null +++ b/Lang/Rust/Latin-Squares-in-reduced-form @@ -0,0 +1 @@ +../../Task/Latin-Squares-in-reduced-form/Rust \ No newline at end of file diff --git a/Lang/Rust/List-rooted-trees b/Lang/Rust/List-rooted-trees new file mode 120000 index 0000000000..ef07119312 --- /dev/null +++ b/Lang/Rust/List-rooted-trees @@ -0,0 +1 @@ +../../Task/List-rooted-trees/Rust \ No newline at end of file diff --git a/Lang/Rust/Long-literals-with-continuations b/Lang/Rust/Long-literals-with-continuations new file mode 120000 index 0000000000..ad69d0820b --- /dev/null +++ b/Lang/Rust/Long-literals-with-continuations @@ -0,0 +1 @@ +../../Task/Long-literals-with-continuations/Rust \ No newline at end of file diff --git a/Lang/Rust/M-bius-function b/Lang/Rust/M-bius-function new file mode 120000 index 0000000000..96f9ab27ce --- /dev/null +++ b/Lang/Rust/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/Rust \ No newline at end of file diff --git a/Lang/Rust/Mayan-calendar b/Lang/Rust/Mayan-calendar new file mode 120000 index 0000000000..8da8002279 --- /dev/null +++ b/Lang/Rust/Mayan-calendar @@ -0,0 +1 @@ +../../Task/Mayan-calendar/Rust \ No newline at end of file diff --git a/Lang/Rust/Median-filter b/Lang/Rust/Median-filter new file mode 120000 index 0000000000..1cdae0e790 --- /dev/null +++ b/Lang/Rust/Median-filter @@ -0,0 +1 @@ +../../Task/Median-filter/Rust \ No newline at end of file diff --git a/Lang/Rust/Miller-Rabin-primality-test b/Lang/Rust/Miller-Rabin-primality-test deleted file mode 120000 index 937aebe94f..0000000000 --- a/Lang/Rust/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Rust \ No newline at end of file diff --git a/Lang/Rust/Modular-arithmetic b/Lang/Rust/Modular-arithmetic new file mode 120000 index 0000000000..bf3b8fce76 --- /dev/null +++ b/Lang/Rust/Modular-arithmetic @@ -0,0 +1 @@ +../../Task/Modular-arithmetic/Rust \ No newline at end of file diff --git a/Lang/Rust/Multiple-regression b/Lang/Rust/Multiple-regression new file mode 120000 index 0000000000..84425ee458 --- /dev/null +++ b/Lang/Rust/Multiple-regression @@ -0,0 +1 @@ +../../Task/Multiple-regression/Rust \ No newline at end of file diff --git a/Lang/Rust/Natural-sorting b/Lang/Rust/Natural-sorting new file mode 120000 index 0000000000..77b1a7de05 --- /dev/null +++ b/Lang/Rust/Natural-sorting @@ -0,0 +1 @@ +../../Task/Natural-sorting/Rust \ No newline at end of file diff --git a/Lang/Rust/Non-continuous-subsequences b/Lang/Rust/Non-continuous-subsequences new file mode 120000 index 0000000000..7152418d6c --- /dev/null +++ b/Lang/Rust/Non-continuous-subsequences @@ -0,0 +1 @@ +../../Task/Non-continuous-subsequences/Rust \ No newline at end of file diff --git a/Lang/Rust/Nonogram-solver b/Lang/Rust/Nonogram-solver new file mode 120000 index 0000000000..670a3f0f6a --- /dev/null +++ b/Lang/Rust/Nonogram-solver @@ -0,0 +1 @@ +../../Task/Nonogram-solver/Rust \ No newline at end of file diff --git a/Lang/Rust/Numerical-and-alphabetical-suffixes b/Lang/Rust/Numerical-and-alphabetical-suffixes new file mode 120000 index 0000000000..0446d710e5 --- /dev/null +++ b/Lang/Rust/Numerical-and-alphabetical-suffixes @@ -0,0 +1 @@ +../../Task/Numerical-and-alphabetical-suffixes/Rust \ No newline at end of file diff --git a/Lang/Rust/OpenWebNet-password b/Lang/Rust/OpenWebNet-password new file mode 120000 index 0000000000..24be1f8b4a --- /dev/null +++ b/Lang/Rust/OpenWebNet-password @@ -0,0 +1 @@ +../../Task/OpenWebNet-password/Rust \ No newline at end of file diff --git a/Lang/Rust/Own-digits-power-sum b/Lang/Rust/Own-digits-power-sum new file mode 120000 index 0000000000..2d8de77ac9 --- /dev/null +++ b/Lang/Rust/Own-digits-power-sum @@ -0,0 +1 @@ +../../Task/Own-digits-power-sum/Rust \ No newline at end of file diff --git a/Lang/Rust/P-Adic-numbers-basic b/Lang/Rust/P-Adic-numbers-basic new file mode 120000 index 0000000000..2ccd34b2fd --- /dev/null +++ b/Lang/Rust/P-Adic-numbers-basic @@ -0,0 +1 @@ +../../Task/P-Adic-numbers-basic/Rust \ No newline at end of file diff --git a/Lang/Rust/P-Adic-square-roots b/Lang/Rust/P-Adic-square-roots new file mode 120000 index 0000000000..ed4fb995e0 --- /dev/null +++ b/Lang/Rust/P-Adic-square-roots @@ -0,0 +1 @@ +../../Task/P-Adic-square-roots/Rust \ No newline at end of file diff --git a/Lang/Rust/Pancake-numbers b/Lang/Rust/Pancake-numbers new file mode 120000 index 0000000000..ef65209521 --- /dev/null +++ b/Lang/Rust/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/Rust \ No newline at end of file diff --git a/Lang/Rust/Permutations-Derangements b/Lang/Rust/Permutations-Derangements new file mode 120000 index 0000000000..9efa9a4159 --- /dev/null +++ b/Lang/Rust/Permutations-Derangements @@ -0,0 +1 @@ +../../Task/Permutations-Derangements/Rust \ No newline at end of file diff --git a/Lang/Rust/Playfair-cipher b/Lang/Rust/Playfair-cipher new file mode 120000 index 0000000000..f3e93df373 --- /dev/null +++ b/Lang/Rust/Playfair-cipher @@ -0,0 +1 @@ +../../Task/Playfair-cipher/Rust \ No newline at end of file diff --git a/Lang/Rust/Polynomial-regression b/Lang/Rust/Polynomial-regression new file mode 120000 index 0000000000..cdb9cdc8ff --- /dev/null +++ b/Lang/Rust/Polynomial-regression @@ -0,0 +1 @@ +../../Task/Polynomial-regression/Rust \ No newline at end of file diff --git a/Lang/Rust/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a b/Lang/Rust/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a new file mode 120000 index 0000000000..a557952f5e --- /dev/null +++ b/Lang/Rust/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Combined-recursive-generator-MRG32k3a/Rust \ No newline at end of file diff --git a/Lang/Rust/Pseudo-random-numbers-Middle-square-method b/Lang/Rust/Pseudo-random-numbers-Middle-square-method new file mode 120000 index 0000000000..07d7dfdf71 --- /dev/null +++ b/Lang/Rust/Pseudo-random-numbers-Middle-square-method @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Middle-square-method/Rust \ No newline at end of file diff --git a/Lang/Rust/Pseudo-random-numbers-PCG32 b/Lang/Rust/Pseudo-random-numbers-PCG32 new file mode 120000 index 0000000000..ea0c68c73c --- /dev/null +++ b/Lang/Rust/Pseudo-random-numbers-PCG32 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-PCG32/Rust \ No newline at end of file diff --git a/Lang/Rust/Pseudo-random-numbers-Splitmix64 b/Lang/Rust/Pseudo-random-numbers-Splitmix64 new file mode 120000 index 0000000000..af868efefa --- /dev/null +++ b/Lang/Rust/Pseudo-random-numbers-Splitmix64 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Splitmix64/Rust \ No newline at end of file diff --git a/Lang/Rust/Pseudo-random-numbers-Xorshift-star b/Lang/Rust/Pseudo-random-numbers-Xorshift-star new file mode 120000 index 0000000000..02667e7c55 --- /dev/null +++ b/Lang/Rust/Pseudo-random-numbers-Xorshift-star @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Xorshift-star/Rust \ No newline at end of file diff --git a/Lang/Rust/QR-decomposition b/Lang/Rust/QR-decomposition new file mode 120000 index 0000000000..b6ec08cee6 --- /dev/null +++ b/Lang/Rust/QR-decomposition @@ -0,0 +1 @@ +../../Task/QR-decomposition/Rust \ No newline at end of file diff --git a/Lang/Rust/Quaternion-type b/Lang/Rust/Quaternion-type deleted file mode 120000 index 92c25b946f..0000000000 --- a/Lang/Rust/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Rust \ No newline at end of file diff --git a/Lang/Rust/Ramanujan-primes-twins b/Lang/Rust/Ramanujan-primes-twins new file mode 120000 index 0000000000..ec360cedbc --- /dev/null +++ b/Lang/Rust/Ramanujan-primes-twins @@ -0,0 +1 @@ +../../Task/Ramanujan-primes-twins/Rust \ No newline at end of file diff --git a/Lang/Rust/Recamans-sequence b/Lang/Rust/Recamans-sequence new file mode 120000 index 0000000000..a23a2a87db --- /dev/null +++ b/Lang/Rust/Recamans-sequence @@ -0,0 +1 @@ +../../Task/Recamans-sequence/Rust \ No newline at end of file diff --git a/Lang/Rust/Rendezvous b/Lang/Rust/Rendezvous new file mode 120000 index 0000000000..2ae4407138 --- /dev/null +++ b/Lang/Rust/Rendezvous @@ -0,0 +1 @@ +../../Task/Rendezvous/Rust \ No newline at end of file diff --git a/Lang/Rust/Resistor-mesh b/Lang/Rust/Resistor-mesh new file mode 120000 index 0000000000..245eca7f06 --- /dev/null +++ b/Lang/Rust/Resistor-mesh @@ -0,0 +1 @@ +../../Task/Resistor-mesh/Rust \ No newline at end of file diff --git a/Lang/Rust/Shoelace-formula-for-polygonal-area b/Lang/Rust/Shoelace-formula-for-polygonal-area new file mode 120000 index 0000000000..4ce5ca075a --- /dev/null +++ b/Lang/Rust/Shoelace-formula-for-polygonal-area @@ -0,0 +1 @@ +../../Task/Shoelace-formula-for-polygonal-area/Rust \ No newline at end of file diff --git a/Lang/Rust/Singleton b/Lang/Rust/Singleton new file mode 120000 index 0000000000..480988c162 --- /dev/null +++ b/Lang/Rust/Singleton @@ -0,0 +1 @@ +../../Task/Singleton/Rust \ No newline at end of file diff --git a/Lang/Rust/Sokoban b/Lang/Rust/Sokoban new file mode 120000 index 0000000000..57d1bc73b3 --- /dev/null +++ b/Lang/Rust/Sokoban @@ -0,0 +1 @@ +../../Task/Sokoban/Rust \ No newline at end of file diff --git a/Lang/Rust/Solve-a-Holy-Knights-tour b/Lang/Rust/Solve-a-Holy-Knights-tour new file mode 120000 index 0000000000..7d376bff89 --- /dev/null +++ b/Lang/Rust/Solve-a-Holy-Knights-tour @@ -0,0 +1 @@ +../../Task/Solve-a-Holy-Knights-tour/Rust \ No newline at end of file diff --git a/Lang/Rust/Solve-a-Hopido-puzzle b/Lang/Rust/Solve-a-Hopido-puzzle new file mode 120000 index 0000000000..13eae5b688 --- /dev/null +++ b/Lang/Rust/Solve-a-Hopido-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hopido-puzzle/Rust \ No newline at end of file diff --git a/Lang/Rust/Solve-a-Numbrix-puzzle b/Lang/Rust/Solve-a-Numbrix-puzzle new file mode 120000 index 0000000000..6da0fac9a0 --- /dev/null +++ b/Lang/Rust/Solve-a-Numbrix-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Numbrix-puzzle/Rust \ No newline at end of file diff --git a/Lang/Rust/Sorting-Algorithms-Circle-Sort b/Lang/Rust/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 924c0eb5ac..0000000000 --- a/Lang/Rust/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Rust \ No newline at end of file diff --git a/Lang/Rust/Sorting-algorithms-Bead-sort b/Lang/Rust/Sorting-algorithms-Bead-sort new file mode 120000 index 0000000000..1096740d47 --- /dev/null +++ b/Lang/Rust/Sorting-algorithms-Bead-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bead-sort/Rust \ No newline at end of file diff --git a/Lang/Rust/Sorting-algorithms-Patience-sort b/Lang/Rust/Sorting-algorithms-Patience-sort new file mode 120000 index 0000000000..98bfba78ce --- /dev/null +++ b/Lang/Rust/Sorting-algorithms-Patience-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Patience-sort/Rust \ No newline at end of file diff --git a/Lang/Rust/Sorting-algorithms-Permutation-sort b/Lang/Rust/Sorting-algorithms-Permutation-sort new file mode 120000 index 0000000000..0bbf7e172b --- /dev/null +++ b/Lang/Rust/Sorting-algorithms-Permutation-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Permutation-sort/Rust \ No newline at end of file diff --git a/Lang/Rust/Sorting-algorithms-Strand-sort b/Lang/Rust/Sorting-algorithms-Strand-sort new file mode 120000 index 0000000000..c01a273a80 --- /dev/null +++ b/Lang/Rust/Sorting-algorithms-Strand-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Strand-sort/Rust \ No newline at end of file diff --git a/Lang/Rust/Special-characters b/Lang/Rust/Special-characters new file mode 120000 index 0000000000..7cb915367e --- /dev/null +++ b/Lang/Rust/Special-characters @@ -0,0 +1 @@ +../../Task/Special-characters/Rust \ No newline at end of file diff --git a/Lang/Rust/Stable-marriage-problem b/Lang/Rust/Stable-marriage-problem new file mode 120000 index 0000000000..98e509ab20 --- /dev/null +++ b/Lang/Rust/Stable-marriage-problem @@ -0,0 +1 @@ +../../Task/Stable-marriage-problem/Rust \ No newline at end of file diff --git a/Lang/Rust/State-name-puzzle b/Lang/Rust/State-name-puzzle new file mode 120000 index 0000000000..a88b598d4b --- /dev/null +++ b/Lang/Rust/State-name-puzzle @@ -0,0 +1 @@ +../../Task/State-name-puzzle/Rust \ No newline at end of file diff --git a/Lang/Rust/Steffensens-method b/Lang/Rust/Steffensens-method new file mode 120000 index 0000000000..4aa426ad52 --- /dev/null +++ b/Lang/Rust/Steffensens-method @@ -0,0 +1 @@ +../../Task/Steffensens-method/Rust \ No newline at end of file diff --git a/Lang/Rust/Stem-and-leaf-plot b/Lang/Rust/Stem-and-leaf-plot new file mode 120000 index 0000000000..c5e2a0d27c --- /dev/null +++ b/Lang/Rust/Stem-and-leaf-plot @@ -0,0 +1 @@ +../../Task/Stem-and-leaf-plot/Rust \ No newline at end of file diff --git a/Lang/Rust/Stern-Brocot-sequence b/Lang/Rust/Stern-Brocot-sequence new file mode 120000 index 0000000000..72080b645a --- /dev/null +++ b/Lang/Rust/Stern-Brocot-sequence @@ -0,0 +1 @@ +../../Task/Stern-Brocot-sequence/Rust \ No newline at end of file diff --git a/Lang/Rust/Strassens-algorithm b/Lang/Rust/Strassens-algorithm new file mode 120000 index 0000000000..059089e819 --- /dev/null +++ b/Lang/Rust/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Rust \ No newline at end of file diff --git a/Lang/Rust/Stream-merge b/Lang/Rust/Stream-merge new file mode 120000 index 0000000000..101f42c85a --- /dev/null +++ b/Lang/Rust/Stream-merge @@ -0,0 +1 @@ +../../Task/Stream-merge/Rust \ No newline at end of file diff --git a/Lang/Rust/Strip-block-comments b/Lang/Rust/Strip-block-comments new file mode 120000 index 0000000000..c9f77902d0 --- /dev/null +++ b/Lang/Rust/Strip-block-comments @@ -0,0 +1 @@ +../../Task/Strip-block-comments/Rust \ No newline at end of file diff --git a/Lang/Rust/Strip-control-codes-and-extended-characters-from-a-string b/Lang/Rust/Strip-control-codes-and-extended-characters-from-a-string new file mode 120000 index 0000000000..56a1876479 --- /dev/null +++ b/Lang/Rust/Strip-control-codes-and-extended-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-control-codes-and-extended-characters-from-a-string/Rust \ No newline at end of file diff --git a/Lang/Rust/Subleq b/Lang/Rust/Subleq new file mode 120000 index 0000000000..cc28544f34 --- /dev/null +++ b/Lang/Rust/Subleq @@ -0,0 +1 @@ +../../Task/Subleq/Rust \ No newline at end of file diff --git a/Lang/Rust/Substitution-cipher b/Lang/Rust/Substitution-cipher new file mode 120000 index 0000000000..aa3ad1011d --- /dev/null +++ b/Lang/Rust/Substitution-cipher @@ -0,0 +1 @@ +../../Task/Substitution-cipher/Rust \ No newline at end of file diff --git a/Lang/Rust/Sudan-function b/Lang/Rust/Sudan-function new file mode 120000 index 0000000000..29cdeee99f --- /dev/null +++ b/Lang/Rust/Sudan-function @@ -0,0 +1 @@ +../../Task/Sudan-function/Rust \ No newline at end of file diff --git a/Lang/Rust/Suffixation-of-decimal-numbers b/Lang/Rust/Suffixation-of-decimal-numbers new file mode 120000 index 0000000000..2428a135a4 --- /dev/null +++ b/Lang/Rust/Suffixation-of-decimal-numbers @@ -0,0 +1 @@ +../../Task/Suffixation-of-decimal-numbers/Rust \ No newline at end of file diff --git a/Lang/Rust/Sum-to-100 b/Lang/Rust/Sum-to-100 new file mode 120000 index 0000000000..a46a7b38ab --- /dev/null +++ b/Lang/Rust/Sum-to-100 @@ -0,0 +1 @@ +../../Task/Sum-to-100/Rust \ No newline at end of file diff --git a/Lang/Rust/Summarize-and-say-sequence b/Lang/Rust/Summarize-and-say-sequence new file mode 120000 index 0000000000..030276987c --- /dev/null +++ b/Lang/Rust/Summarize-and-say-sequence @@ -0,0 +1 @@ +../../Task/Summarize-and-say-sequence/Rust \ No newline at end of file diff --git a/Lang/Rust/Superpermutation-minimisation b/Lang/Rust/Superpermutation-minimisation new file mode 120000 index 0000000000..8b214e27cd --- /dev/null +++ b/Lang/Rust/Superpermutation-minimisation @@ -0,0 +1 @@ +../../Task/Superpermutation-minimisation/Rust \ No newline at end of file diff --git a/Lang/Rust/The-Name-Game b/Lang/Rust/The-Name-Game new file mode 120000 index 0000000000..92835f00de --- /dev/null +++ b/Lang/Rust/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/Rust \ No newline at end of file diff --git a/Lang/Rust/Tonelli-Shanks-algorithm b/Lang/Rust/Tonelli-Shanks-algorithm new file mode 120000 index 0000000000..b90bd71718 --- /dev/null +++ b/Lang/Rust/Tonelli-Shanks-algorithm @@ -0,0 +1 @@ +../../Task/Tonelli-Shanks-algorithm/Rust \ No newline at end of file diff --git a/Lang/Rust/Tree-datastructures b/Lang/Rust/Tree-datastructures new file mode 120000 index 0000000000..37b567712c --- /dev/null +++ b/Lang/Rust/Tree-datastructures @@ -0,0 +1 @@ +../../Task/Tree-datastructures/Rust \ No newline at end of file diff --git a/Lang/Rust/Tropical-algebra-overloading b/Lang/Rust/Tropical-algebra-overloading new file mode 120000 index 0000000000..271296f0b3 --- /dev/null +++ b/Lang/Rust/Tropical-algebra-overloading @@ -0,0 +1 @@ +../../Task/Tropical-algebra-overloading/Rust \ No newline at end of file diff --git a/Lang/Rust/Twos-complement b/Lang/Rust/Twos-complement new file mode 120000 index 0000000000..086c8719d1 --- /dev/null +++ b/Lang/Rust/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Rust \ No newline at end of file diff --git a/Lang/Rust/UPC b/Lang/Rust/UPC new file mode 120000 index 0000000000..775faf96be --- /dev/null +++ b/Lang/Rust/UPC @@ -0,0 +1 @@ +../../Task/UPC/Rust \ No newline at end of file diff --git a/Lang/Rust/Ukkonen-s-suffix-tree-construction b/Lang/Rust/Ukkonen-s-suffix-tree-construction new file mode 120000 index 0000000000..684e412fed --- /dev/null +++ b/Lang/Rust/Ukkonen-s-suffix-tree-construction @@ -0,0 +1 @@ +../../Task/Ukkonen-s-suffix-tree-construction/Rust \ No newline at end of file diff --git a/Lang/Rust/Verhoeff-algorithm b/Lang/Rust/Verhoeff-algorithm new file mode 120000 index 0000000000..fd5322e5ec --- /dev/null +++ b/Lang/Rust/Verhoeff-algorithm @@ -0,0 +1 @@ +../../Task/Verhoeff-algorithm/Rust \ No newline at end of file diff --git a/Lang/Rust/Vogels-approximation-method b/Lang/Rust/Vogels-approximation-method new file mode 120000 index 0000000000..377b0aef0a --- /dev/null +++ b/Lang/Rust/Vogels-approximation-method @@ -0,0 +1 @@ +../../Task/Vogels-approximation-method/Rust \ No newline at end of file diff --git a/Lang/Rust/War-card-game b/Lang/Rust/War-card-game new file mode 120000 index 0000000000..bc45c42250 --- /dev/null +++ b/Lang/Rust/War-card-game @@ -0,0 +1 @@ +../../Task/War-card-game/Rust \ No newline at end of file diff --git a/Lang/Rust/Word-ladder b/Lang/Rust/Word-ladder new file mode 120000 index 0000000000..9973e5c323 --- /dev/null +++ b/Lang/Rust/Word-ladder @@ -0,0 +1 @@ +../../Task/Word-ladder/Rust \ No newline at end of file diff --git a/Lang/Rust/Word-search b/Lang/Rust/Word-search new file mode 120000 index 0000000000..737b35c0c7 --- /dev/null +++ b/Lang/Rust/Word-search @@ -0,0 +1 @@ +../../Task/Word-search/Rust \ No newline at end of file diff --git a/Lang/Rust/Word-wheel b/Lang/Rust/Word-wheel new file mode 120000 index 0000000000..3c8a9835e5 --- /dev/null +++ b/Lang/Rust/Word-wheel @@ -0,0 +1 @@ +../../Task/Word-wheel/Rust \ No newline at end of file diff --git a/Lang/Rust/Wordiff b/Lang/Rust/Wordiff new file mode 120000 index 0000000000..44e42a760a --- /dev/null +++ b/Lang/Rust/Wordiff @@ -0,0 +1 @@ +../../Task/Wordiff/Rust \ No newline at end of file diff --git a/Lang/Rust/Xiaolin-Wus-line-algorithm b/Lang/Rust/Xiaolin-Wus-line-algorithm new file mode 120000 index 0000000000..68352a1cb5 --- /dev/null +++ b/Lang/Rust/Xiaolin-Wus-line-algorithm @@ -0,0 +1 @@ +../../Task/Xiaolin-Wus-line-algorithm/Rust \ No newline at end of file diff --git a/Lang/Rust/Zebra-puzzle b/Lang/Rust/Zebra-puzzle new file mode 120000 index 0000000000..2b9c2729f7 --- /dev/null +++ b/Lang/Rust/Zebra-puzzle @@ -0,0 +1 @@ +../../Task/Zebra-puzzle/Rust \ No newline at end of file diff --git a/Lang/Rust/Zeckendorf-arithmetic b/Lang/Rust/Zeckendorf-arithmetic new file mode 120000 index 0000000000..fa9675f521 --- /dev/null +++ b/Lang/Rust/Zeckendorf-arithmetic @@ -0,0 +1 @@ +../../Task/Zeckendorf-arithmetic/Rust \ No newline at end of file diff --git a/Lang/Rust/Zeckendorf-number-representation b/Lang/Rust/Zeckendorf-number-representation new file mode 120000 index 0000000000..d6de4a899a --- /dev/null +++ b/Lang/Rust/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/Rust \ No newline at end of file diff --git a/Lang/Rye/00-LANG.txt b/Lang/Rye/00-LANG.txt new file mode 100644 index 0000000000..10b016e264 --- /dev/null +++ b/Lang/Rye/00-LANG.txt @@ -0,0 +1,11 @@ +{{stub}}{{language|rye}} +Rye is a flexible, high-level programming language designed for predictable state management. Rye takes ideas from Rebol, and adds few from Factor, Linux shell, and Go. Written in Go, Rye doubles as a scripting companion for Go programs. Go's libraries integrate seamlessly, and Rye can be embedded as a scripting or config language for Go programs. + +As a high-level language, Rye explores bridging coding and user interfaces. Its interactive console features syntax highlighting, history, tab completion, and tools to explore the language and environment you’re crafting. + +==Todo== +[https://rosettacode.org/wiki/Tasks_not_implemented_in_Rye Tasks not implemented in Rye] + +==Links== +*[https://ryelang.org/ Homepage] +*[https://github.com/refaktor/rye Github repository] \ No newline at end of file diff --git a/Lang/Rye/00-META.yaml b/Lang/Rye/00-META.yaml new file mode 100644 index 0000000000..c4fbe956c0 --- /dev/null +++ b/Lang/Rye/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Rye diff --git a/Lang/Rye/100-doors b/Lang/Rye/100-doors new file mode 120000 index 0000000000..438aa2dd57 --- /dev/null +++ b/Lang/Rye/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Rye \ No newline at end of file diff --git a/Lang/Rye/99-bottles-of-beer b/Lang/Rye/99-bottles-of-beer new file mode 120000 index 0000000000..bd33c6e283 --- /dev/null +++ b/Lang/Rye/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/Rye \ No newline at end of file diff --git a/Lang/Rye/A+B b/Lang/Rye/A+B new file mode 120000 index 0000000000..cd82f2f9d7 --- /dev/null +++ b/Lang/Rye/A+B @@ -0,0 +1 @@ +../../Task/A+B/Rye \ No newline at end of file diff --git a/Lang/Rye/Arithmetic-Integer b/Lang/Rye/Arithmetic-Integer new file mode 120000 index 0000000000..3854f98ef8 --- /dev/null +++ b/Lang/Rye/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Rye \ No newline at end of file diff --git a/Lang/Rye/Array-concatenation b/Lang/Rye/Array-concatenation new file mode 120000 index 0000000000..e06de8357b --- /dev/null +++ b/Lang/Rye/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Rye \ No newline at end of file diff --git a/Lang/Rye/Array-length b/Lang/Rye/Array-length new file mode 120000 index 0000000000..f3ddf845d5 --- /dev/null +++ b/Lang/Rye/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/Rye \ No newline at end of file diff --git a/Lang/Rye/Arrays b/Lang/Rye/Arrays new file mode 120000 index 0000000000..0051f3551e --- /dev/null +++ b/Lang/Rye/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Rye \ No newline at end of file diff --git a/Lang/Rye/Assertions b/Lang/Rye/Assertions new file mode 120000 index 0000000000..55dc6c4a1c --- /dev/null +++ b/Lang/Rye/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Rye \ No newline at end of file diff --git a/Lang/Rye/Associative-array-Creation b/Lang/Rye/Associative-array-Creation new file mode 120000 index 0000000000..6d8b394caa --- /dev/null +++ b/Lang/Rye/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Rye \ No newline at end of file diff --git a/Lang/Rye/Catamorphism b/Lang/Rye/Catamorphism new file mode 120000 index 0000000000..1cc0f4cd16 --- /dev/null +++ b/Lang/Rye/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Rye \ No newline at end of file diff --git a/Lang/Rye/Check-that-file-exists b/Lang/Rye/Check-that-file-exists new file mode 120000 index 0000000000..0f1689d415 --- /dev/null +++ b/Lang/Rye/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Rye \ No newline at end of file diff --git a/Lang/Rye/Collections b/Lang/Rye/Collections new file mode 120000 index 0000000000..8619dddf36 --- /dev/null +++ b/Lang/Rye/Collections @@ -0,0 +1 @@ +../../Task/Collections/Rye \ No newline at end of file diff --git a/Lang/Rye/Compare-length-of-two-strings b/Lang/Rye/Compare-length-of-two-strings new file mode 120000 index 0000000000..3ee03067fd --- /dev/null +++ b/Lang/Rye/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/Rye \ No newline at end of file diff --git a/Lang/Rye/Copy-a-string b/Lang/Rye/Copy-a-string new file mode 120000 index 0000000000..5130e809be --- /dev/null +++ b/Lang/Rye/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Rye \ No newline at end of file diff --git a/Lang/Rye/Create-a-file b/Lang/Rye/Create-a-file new file mode 120000 index 0000000000..933dfda3ec --- /dev/null +++ b/Lang/Rye/Create-a-file @@ -0,0 +1 @@ +../../Task/Create-a-file/Rye \ No newline at end of file diff --git a/Lang/Rye/DNS-query b/Lang/Rye/DNS-query new file mode 120000 index 0000000000..25d8db99dd --- /dev/null +++ b/Lang/Rye/DNS-query @@ -0,0 +1 @@ +../../Task/DNS-query/Rye \ No newline at end of file diff --git a/Lang/Rye/Date-format b/Lang/Rye/Date-format new file mode 120000 index 0000000000..3a4d47e12d --- /dev/null +++ b/Lang/Rye/Date-format @@ -0,0 +1 @@ +../../Task/Date-format/Rye \ No newline at end of file diff --git a/Lang/Rye/Date-manipulation b/Lang/Rye/Date-manipulation new file mode 120000 index 0000000000..aae44dde34 --- /dev/null +++ b/Lang/Rye/Date-manipulation @@ -0,0 +1 @@ +../../Task/Date-manipulation/Rye \ No newline at end of file diff --git a/Lang/Rye/Day-of-the-week b/Lang/Rye/Day-of-the-week new file mode 120000 index 0000000000..39e63de9c9 --- /dev/null +++ b/Lang/Rye/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Rye \ No newline at end of file diff --git a/Lang/Rye/Delete-a-file b/Lang/Rye/Delete-a-file new file mode 120000 index 0000000000..9eea0e6587 --- /dev/null +++ b/Lang/Rye/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Rye \ No newline at end of file diff --git a/Lang/Rye/Detect-division-by-zero b/Lang/Rye/Detect-division-by-zero new file mode 120000 index 0000000000..f063a804c3 --- /dev/null +++ b/Lang/Rye/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Rye \ No newline at end of file diff --git a/Lang/Rye/Determine-if-a-string-is-numeric b/Lang/Rye/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..921464be9b --- /dev/null +++ b/Lang/Rye/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Rye \ No newline at end of file diff --git a/Lang/Rye/Dot-product b/Lang/Rye/Dot-product new file mode 120000 index 0000000000..ae39c4baea --- /dev/null +++ b/Lang/Rye/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Rye \ No newline at end of file diff --git a/Lang/Rye/Empty-string b/Lang/Rye/Empty-string new file mode 120000 index 0000000000..f9e83f3c4d --- /dev/null +++ b/Lang/Rye/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Rye \ No newline at end of file diff --git a/Lang/Rye/Environment-variables b/Lang/Rye/Environment-variables new file mode 120000 index 0000000000..61b0fc4a40 --- /dev/null +++ b/Lang/Rye/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Rye \ No newline at end of file diff --git a/Lang/Rye/Even-or-odd b/Lang/Rye/Even-or-odd new file mode 120000 index 0000000000..8e627fbc05 --- /dev/null +++ b/Lang/Rye/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/Rye \ No newline at end of file diff --git a/Lang/Rye/Exceptions b/Lang/Rye/Exceptions new file mode 120000 index 0000000000..98c5a1f0b9 --- /dev/null +++ b/Lang/Rye/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/Rye \ No newline at end of file diff --git a/Lang/Rye/Execute-a-system-command b/Lang/Rye/Execute-a-system-command new file mode 120000 index 0000000000..6ef49fa4fa --- /dev/null +++ b/Lang/Rye/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/Rye \ No newline at end of file diff --git a/Lang/Rye/File-input-output b/Lang/Rye/File-input-output new file mode 120000 index 0000000000..92a41d1ae9 --- /dev/null +++ b/Lang/Rye/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/Rye \ No newline at end of file diff --git a/Lang/Rye/File-size b/Lang/Rye/File-size new file mode 120000 index 0000000000..434016471c --- /dev/null +++ b/Lang/Rye/File-size @@ -0,0 +1 @@ +../../Task/File-size/Rye \ No newline at end of file diff --git a/Lang/Rye/Filter b/Lang/Rye/Filter new file mode 120000 index 0000000000..be25d82950 --- /dev/null +++ b/Lang/Rye/Filter @@ -0,0 +1 @@ +../../Task/Filter/Rye \ No newline at end of file diff --git a/Lang/Rye/Function-definition b/Lang/Rye/Function-definition new file mode 120000 index 0000000000..aacf81b6b4 --- /dev/null +++ b/Lang/Rye/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/Rye \ No newline at end of file diff --git a/Lang/Rye/Get-system-command-output b/Lang/Rye/Get-system-command-output new file mode 120000 index 0000000000..0faad90e64 --- /dev/null +++ b/Lang/Rye/Get-system-command-output @@ -0,0 +1 @@ +../../Task/Get-system-command-output/Rye \ No newline at end of file diff --git a/Lang/Rye/Globally-replace-text-in-several-files b/Lang/Rye/Globally-replace-text-in-several-files new file mode 120000 index 0000000000..3bc1b5796d --- /dev/null +++ b/Lang/Rye/Globally-replace-text-in-several-files @@ -0,0 +1 @@ +../../Task/Globally-replace-text-in-several-files/Rye \ No newline at end of file diff --git a/Lang/Rye/Greatest-element-of-a-list b/Lang/Rye/Greatest-element-of-a-list new file mode 120000 index 0000000000..3f8290710b --- /dev/null +++ b/Lang/Rye/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/Rye \ No newline at end of file diff --git a/Lang/Rye/Guess-the-number b/Lang/Rye/Guess-the-number new file mode 120000 index 0000000000..3554ecb000 --- /dev/null +++ b/Lang/Rye/Guess-the-number @@ -0,0 +1 @@ +../../Task/Guess-the-number/Rye \ No newline at end of file diff --git a/Lang/Rye/Hello-world-Graphical b/Lang/Rye/Hello-world-Graphical new file mode 120000 index 0000000000..8ba960fd9f --- /dev/null +++ b/Lang/Rye/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Rye \ No newline at end of file diff --git a/Lang/Rye/Hello-world-Newbie b/Lang/Rye/Hello-world-Newbie new file mode 120000 index 0000000000..404d5bf799 --- /dev/null +++ b/Lang/Rye/Hello-world-Newbie @@ -0,0 +1 @@ +../../Task/Hello-world-Newbie/Rye \ No newline at end of file diff --git a/Lang/Rye/Hello-world-Newline-omission b/Lang/Rye/Hello-world-Newline-omission new file mode 120000 index 0000000000..8978311a91 --- /dev/null +++ b/Lang/Rye/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Rye \ No newline at end of file diff --git a/Lang/Rye/Hello-world-Text b/Lang/Rye/Hello-world-Text new file mode 120000 index 0000000000..527e3f5d07 --- /dev/null +++ b/Lang/Rye/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Rye \ No newline at end of file diff --git a/Lang/Rye/Hello-world-Web-server b/Lang/Rye/Hello-world-Web-server new file mode 120000 index 0000000000..3eb3a08cd7 --- /dev/null +++ b/Lang/Rye/Hello-world-Web-server @@ -0,0 +1 @@ +../../Task/Hello-world-Web-server/Rye \ No newline at end of file diff --git a/Lang/Rye/Hostname b/Lang/Rye/Hostname new file mode 120000 index 0000000000..794d1a04af --- /dev/null +++ b/Lang/Rye/Hostname @@ -0,0 +1 @@ +../../Task/Hostname/Rye \ No newline at end of file diff --git a/Lang/Rye/Include-a-file b/Lang/Rye/Include-a-file new file mode 120000 index 0000000000..075626de41 --- /dev/null +++ b/Lang/Rye/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/Rye \ No newline at end of file diff --git a/Lang/Rye/Increment-a-numerical-string b/Lang/Rye/Increment-a-numerical-string new file mode 120000 index 0000000000..a92efbbcc7 --- /dev/null +++ b/Lang/Rye/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Rye \ No newline at end of file diff --git a/Lang/Rye/Integer-comparison b/Lang/Rye/Integer-comparison new file mode 120000 index 0000000000..b464263441 --- /dev/null +++ b/Lang/Rye/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/Rye \ No newline at end of file diff --git a/Lang/Rye/Jewels-and-stones b/Lang/Rye/Jewels-and-stones new file mode 120000 index 0000000000..2e39bc84a7 --- /dev/null +++ b/Lang/Rye/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/Rye \ No newline at end of file diff --git a/Lang/Rye/Loops-Do-while b/Lang/Rye/Loops-Do-while new file mode 120000 index 0000000000..fb7d5e8d59 --- /dev/null +++ b/Lang/Rye/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Rye \ No newline at end of file diff --git a/Lang/Rye/Loops-For b/Lang/Rye/Loops-For new file mode 120000 index 0000000000..3149a28871 --- /dev/null +++ b/Lang/Rye/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Rye \ No newline at end of file diff --git a/Lang/Rye/Loops-Foreach b/Lang/Rye/Loops-Foreach new file mode 120000 index 0000000000..5feb6cdb06 --- /dev/null +++ b/Lang/Rye/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Rye \ No newline at end of file diff --git a/Lang/Rye/Loops-Infinite b/Lang/Rye/Loops-Infinite new file mode 120000 index 0000000000..7267542117 --- /dev/null +++ b/Lang/Rye/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Rye \ No newline at end of file diff --git a/Lang/Rye/Loops-While b/Lang/Rye/Loops-While new file mode 120000 index 0000000000..376326123c --- /dev/null +++ b/Lang/Rye/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Rye \ No newline at end of file diff --git a/Lang/Rye/Nth b/Lang/Rye/Nth new file mode 120000 index 0000000000..5490f22f35 --- /dev/null +++ b/Lang/Rye/Nth @@ -0,0 +1 @@ +../../Task/Nth/Rye \ No newline at end of file diff --git a/Lang/Rye/Operator-precedence b/Lang/Rye/Operator-precedence new file mode 120000 index 0000000000..43eb0d7842 --- /dev/null +++ b/Lang/Rye/Operator-precedence @@ -0,0 +1 @@ +../../Task/Operator-precedence/Rye \ No newline at end of file diff --git a/Lang/Rye/Ordered-words b/Lang/Rye/Ordered-words new file mode 120000 index 0000000000..c1d477486c --- /dev/null +++ b/Lang/Rye/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Rye \ No newline at end of file diff --git a/Lang/Rye/Partial-function-application b/Lang/Rye/Partial-function-application new file mode 120000 index 0000000000..ae25414b27 --- /dev/null +++ b/Lang/Rye/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/Rye \ No newline at end of file diff --git a/Lang/Rye/RPG-attributes-generator b/Lang/Rye/RPG-attributes-generator new file mode 120000 index 0000000000..fa9afbb45f --- /dev/null +++ b/Lang/Rye/RPG-attributes-generator @@ -0,0 +1 @@ +../../Task/RPG-attributes-generator/Rye \ No newline at end of file diff --git a/Lang/Rye/Read-entire-file b/Lang/Rye/Read-entire-file new file mode 120000 index 0000000000..345a900f2b --- /dev/null +++ b/Lang/Rye/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Rye \ No newline at end of file diff --git a/Lang/Rye/Remove-duplicate-elements b/Lang/Rye/Remove-duplicate-elements new file mode 120000 index 0000000000..c6a95084fa --- /dev/null +++ b/Lang/Rye/Remove-duplicate-elements @@ -0,0 +1 @@ +../../Task/Remove-duplicate-elements/Rye \ No newline at end of file diff --git a/Lang/Rye/Rename-a-file b/Lang/Rye/Rename-a-file new file mode 120000 index 0000000000..3dce3fa2f0 --- /dev/null +++ b/Lang/Rye/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/Rye \ No newline at end of file diff --git a/Lang/Rye/Return-multiple-values b/Lang/Rye/Return-multiple-values new file mode 120000 index 0000000000..9f9f2d8ad1 --- /dev/null +++ b/Lang/Rye/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/Rye \ No newline at end of file diff --git a/Lang/Rye/Reverse-a-string b/Lang/Rye/Reverse-a-string new file mode 120000 index 0000000000..71a229a461 --- /dev/null +++ b/Lang/Rye/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Rye \ No newline at end of file diff --git a/Lang/Rye/Sleep b/Lang/Rye/Sleep new file mode 120000 index 0000000000..caf7749aa7 --- /dev/null +++ b/Lang/Rye/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Rye \ No newline at end of file diff --git a/Lang/Rye/Sort-an-integer-array b/Lang/Rye/Sort-an-integer-array new file mode 120000 index 0000000000..8cac11dd37 --- /dev/null +++ b/Lang/Rye/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Rye \ No newline at end of file diff --git a/Lang/Rye/String-append b/Lang/Rye/String-append new file mode 120000 index 0000000000..7184f2004b --- /dev/null +++ b/Lang/Rye/String-append @@ -0,0 +1 @@ +../../Task/String-append/Rye \ No newline at end of file diff --git a/Lang/Rye/String-case b/Lang/Rye/String-case new file mode 120000 index 0000000000..d596578a64 --- /dev/null +++ b/Lang/Rye/String-case @@ -0,0 +1 @@ +../../Task/String-case/Rye \ No newline at end of file diff --git a/Lang/Rye/String-concatenation b/Lang/Rye/String-concatenation new file mode 120000 index 0000000000..7a56a81ca6 --- /dev/null +++ b/Lang/Rye/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Rye \ No newline at end of file diff --git a/Lang/Rye/String-interpolation-included- b/Lang/Rye/String-interpolation-included- new file mode 120000 index 0000000000..8918c4450c --- /dev/null +++ b/Lang/Rye/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/Rye \ No newline at end of file diff --git a/Lang/Rye/String-length b/Lang/Rye/String-length new file mode 120000 index 0000000000..bf2836e136 --- /dev/null +++ b/Lang/Rye/String-length @@ -0,0 +1 @@ +../../Task/String-length/Rye \ No newline at end of file diff --git a/Lang/Rye/Strip-a-set-of-characters-from-a-string b/Lang/Rye/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..a8703fda98 --- /dev/null +++ b/Lang/Rye/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Rye \ No newline at end of file diff --git a/Lang/Rye/Strip-whitespace-from-a-string-Top-and-tail b/Lang/Rye/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..d53cb2cf57 --- /dev/null +++ b/Lang/Rye/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/Rye \ No newline at end of file diff --git a/Lang/Rye/Substring-Top-and-tail b/Lang/Rye/Substring-Top-and-tail new file mode 120000 index 0000000000..1cf4555801 --- /dev/null +++ b/Lang/Rye/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/Rye \ No newline at end of file diff --git a/Lang/Rye/Sum-and-product-of-an-array b/Lang/Rye/Sum-and-product-of-an-array new file mode 120000 index 0000000000..95d8d590bc --- /dev/null +++ b/Lang/Rye/Sum-and-product-of-an-array @@ -0,0 +1 @@ +../../Task/Sum-and-product-of-an-array/Rye \ No newline at end of file diff --git a/Lang/Rye/System-time b/Lang/Rye/System-time new file mode 120000 index 0000000000..14391ca376 --- /dev/null +++ b/Lang/Rye/System-time @@ -0,0 +1 @@ +../../Task/System-time/Rye \ No newline at end of file diff --git a/Lang/Rye/Tokenize-a-string b/Lang/Rye/Tokenize-a-string new file mode 120000 index 0000000000..404261ec01 --- /dev/null +++ b/Lang/Rye/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/Rye \ No newline at end of file diff --git a/Lang/Rye/User-input-Text b/Lang/Rye/User-input-Text new file mode 120000 index 0000000000..8cd3ad9295 --- /dev/null +++ b/Lang/Rye/User-input-Text @@ -0,0 +1 @@ +../../Task/User-input-Text/Rye \ No newline at end of file diff --git a/Lang/Rye/Variables b/Lang/Rye/Variables new file mode 120000 index 0000000000..d50ac89ca0 --- /dev/null +++ b/Lang/Rye/Variables @@ -0,0 +1 @@ +../../Task/Variables/Rye \ No newline at end of file diff --git a/Lang/Rye/Window-creation b/Lang/Rye/Window-creation new file mode 120000 index 0000000000..334b72f881 --- /dev/null +++ b/Lang/Rye/Window-creation @@ -0,0 +1 @@ +../../Task/Window-creation/Rye \ No newline at end of file diff --git a/Lang/Rye/Write-entire-file b/Lang/Rye/Write-entire-file new file mode 120000 index 0000000000..7a14255070 --- /dev/null +++ b/Lang/Rye/Write-entire-file @@ -0,0 +1 @@ +../../Task/Write-entire-file/Rye \ No newline at end of file diff --git a/Lang/Rye/Zero-to-the-zero-power b/Lang/Rye/Zero-to-the-zero-power new file mode 120000 index 0000000000..2c54da2a61 --- /dev/null +++ b/Lang/Rye/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/Rye \ No newline at end of file diff --git a/Lang/S-BASIC/00-LANG.txt b/Lang/S-BASIC/00-LANG.txt index 7e71ba9085..cb4f4a5c14 100644 --- a/Lang/S-BASIC/00-LANG.txt +++ b/Lang/S-BASIC/00-LANG.txt @@ -1,4 +1,5 @@ {{stub}}{{language|S-BASIC}} +{{implementation|BASIC}} S-BASIC (the S stands for "structured") was a native-code compiler for an ALGOL-like dialect of the BASIC programming language, and ran on 8-bit microcomputers using the Z80 CPU and diff --git a/Lang/S-BASIC/Additive-primes b/Lang/S-BASIC/Additive-primes new file mode 120000 index 0000000000..b90d39a158 --- /dev/null +++ b/Lang/S-BASIC/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Address-of-a-variable b/Lang/S-BASIC/Address-of-a-variable new file mode 120000 index 0000000000..e42c14ed1b --- /dev/null +++ b/Lang/S-BASIC/Address-of-a-variable @@ -0,0 +1 @@ +../../Task/Address-of-a-variable/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Babbage-problem b/Lang/S-BASIC/Babbage-problem new file mode 120000 index 0000000000..49d0b7178e --- /dev/null +++ b/Lang/S-BASIC/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Bitwise-operations b/Lang/S-BASIC/Bitwise-operations new file mode 120000 index 0000000000..08dd8f5cef --- /dev/null +++ b/Lang/S-BASIC/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Boolean-values b/Lang/S-BASIC/Boolean-values new file mode 120000 index 0000000000..20f09efd14 --- /dev/null +++ b/Lang/S-BASIC/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Case-sensitivity-of-identifiers b/Lang/S-BASIC/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..cf49bbdc11 --- /dev/null +++ b/Lang/S-BASIC/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Character-codes b/Lang/S-BASIC/Character-codes new file mode 120000 index 0000000000..f408189f94 --- /dev/null +++ b/Lang/S-BASIC/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Copy-a-string b/Lang/S-BASIC/Copy-a-string new file mode 120000 index 0000000000..cf54fdae2e --- /dev/null +++ b/Lang/S-BASIC/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Create-a-two-dimensional-array-at-runtime b/Lang/S-BASIC/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..9691176d8d --- /dev/null +++ b/Lang/S-BASIC/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Determine-if-a-string-has-all-the-same-characters b/Lang/S-BASIC/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..2a7c5f43f1 --- /dev/null +++ b/Lang/S-BASIC/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Determine-if-a-string-has-all-unique-characters b/Lang/S-BASIC/Determine-if-a-string-has-all-unique-characters new file mode 120000 index 0000000000..f2a5cead6b --- /dev/null +++ b/Lang/S-BASIC/Determine-if-a-string-has-all-unique-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-unique-characters/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Digital-root b/Lang/S-BASIC/Digital-root new file mode 120000 index 0000000000..859802aa50 --- /dev/null +++ b/Lang/S-BASIC/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Exponentiation-order b/Lang/S-BASIC/Exponentiation-order new file mode 120000 index 0000000000..e875dfd752 --- /dev/null +++ b/Lang/S-BASIC/Exponentiation-order @@ -0,0 +1 @@ +../../Task/Exponentiation-order/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Factorial b/Lang/S-BASIC/Factorial new file mode 120000 index 0000000000..3c6e9121ba --- /dev/null +++ b/Lang/S-BASIC/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/File-input-output b/Lang/S-BASIC/File-input-output new file mode 120000 index 0000000000..0708277559 --- /dev/null +++ b/Lang/S-BASIC/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Golden-ratio-Convergence b/Lang/S-BASIC/Golden-ratio-Convergence new file mode 120000 index 0000000000..4ad7ad99cc --- /dev/null +++ b/Lang/S-BASIC/Golden-ratio-Convergence @@ -0,0 +1 @@ +../../Task/Golden-ratio-Convergence/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Harmonic-series b/Lang/S-BASIC/Harmonic-series new file mode 120000 index 0000000000..32781a4eaa --- /dev/null +++ b/Lang/S-BASIC/Harmonic-series @@ -0,0 +1 @@ +../../Task/Harmonic-series/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Hello-world-Line-printer b/Lang/S-BASIC/Hello-world-Line-printer new file mode 120000 index 0000000000..c091e2e975 --- /dev/null +++ b/Lang/S-BASIC/Hello-world-Line-printer @@ -0,0 +1 @@ +../../Task/Hello-world-Line-printer/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Integer-overflow b/Lang/S-BASIC/Integer-overflow new file mode 120000 index 0000000000..60893ea23b --- /dev/null +++ b/Lang/S-BASIC/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Loops-Break b/Lang/S-BASIC/Loops-Break new file mode 120000 index 0000000000..4109f93543 --- /dev/null +++ b/Lang/S-BASIC/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Loops-Do-while b/Lang/S-BASIC/Loops-Do-while new file mode 120000 index 0000000000..026ddb5c46 --- /dev/null +++ b/Lang/S-BASIC/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Loops-Increment-loop-index-within-loop-body b/Lang/S-BASIC/Loops-Increment-loop-index-within-loop-body new file mode 120000 index 0000000000..0b105df636 --- /dev/null +++ b/Lang/S-BASIC/Loops-Increment-loop-index-within-loop-body @@ -0,0 +1 @@ +../../Task/Loops-Increment-loop-index-within-loop-body/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Loops-While b/Lang/S-BASIC/Loops-While new file mode 120000 index 0000000000..cf0317c07f --- /dev/null +++ b/Lang/S-BASIC/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Machine-code b/Lang/S-BASIC/Machine-code new file mode 120000 index 0000000000..40b7856248 --- /dev/null +++ b/Lang/S-BASIC/Machine-code @@ -0,0 +1 @@ +../../Task/Machine-code/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Real-constants-and-functions b/Lang/S-BASIC/Real-constants-and-functions new file mode 120000 index 0000000000..dd7abd08ca --- /dev/null +++ b/Lang/S-BASIC/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Rename-a-file b/Lang/S-BASIC/Rename-a-file new file mode 120000 index 0000000000..918d2d7e4f --- /dev/null +++ b/Lang/S-BASIC/Rename-a-file @@ -0,0 +1 @@ +../../Task/Rename-a-file/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Sort-an-integer-array b/Lang/S-BASIC/Sort-an-integer-array new file mode 120000 index 0000000000..ee8b6cb035 --- /dev/null +++ b/Lang/S-BASIC/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Sorting-algorithms-Insertion-sort b/Lang/S-BASIC/Sorting-algorithms-Insertion-sort new file mode 120000 index 0000000000..60391d0e75 --- /dev/null +++ b/Lang/S-BASIC/Sorting-algorithms-Insertion-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Insertion-sort/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Square-free-integers b/Lang/S-BASIC/Square-free-integers new file mode 120000 index 0000000000..d6296e2f26 --- /dev/null +++ b/Lang/S-BASIC/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/String-interpolation-included- b/Lang/S-BASIC/String-interpolation-included- new file mode 120000 index 0000000000..c71873859b --- /dev/null +++ b/Lang/S-BASIC/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Strip-a-set-of-characters-from-a-string b/Lang/S-BASIC/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..3f36145b0a --- /dev/null +++ b/Lang/S-BASIC/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Strip-whitespace-from-a-string-Top-and-tail b/Lang/S-BASIC/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..e52fe4d75d --- /dev/null +++ b/Lang/S-BASIC/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Sum-multiples-of-3-and-5 b/Lang/S-BASIC/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..e2cf16a9fe --- /dev/null +++ b/Lang/S-BASIC/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Sum-of-a-series b/Lang/S-BASIC/Sum-of-a-series new file mode 120000 index 0000000000..1396d4d958 --- /dev/null +++ b/Lang/S-BASIC/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Variables b/Lang/S-BASIC/Variables new file mode 120000 index 0000000000..09187048df --- /dev/null +++ b/Lang/S-BASIC/Variables @@ -0,0 +1 @@ +../../Task/Variables/S-BASIC \ No newline at end of file diff --git a/Lang/S-BASIC/Zero-to-the-zero-power b/Lang/S-BASIC/Zero-to-the-zero-power new file mode 120000 index 0000000000..e660e2efea --- /dev/null +++ b/Lang/S-BASIC/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/S-BASIC \ No newline at end of file diff --git a/Lang/SETL/100-prisoners b/Lang/SETL/100-prisoners new file mode 120000 index 0000000000..2a5ecc360e --- /dev/null +++ b/Lang/SETL/100-prisoners @@ -0,0 +1 @@ +../../Task/100-prisoners/SETL \ No newline at end of file diff --git a/Lang/SETL/ABC-problem b/Lang/SETL/ABC-problem new file mode 120000 index 0000000000..c18b2914bb --- /dev/null +++ b/Lang/SETL/ABC-problem @@ -0,0 +1 @@ +../../Task/ABC-problem/SETL \ No newline at end of file diff --git a/Lang/SETL/Abundant-deficient-and-perfect-number-classifications b/Lang/SETL/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..93bdd2c092 --- /dev/null +++ b/Lang/SETL/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/SETL \ No newline at end of file diff --git a/Lang/SETL/Additive-primes b/Lang/SETL/Additive-primes new file mode 120000 index 0000000000..7f7a19ec46 --- /dev/null +++ b/Lang/SETL/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/SETL \ No newline at end of file diff --git a/Lang/SETL/Align-columns b/Lang/SETL/Align-columns new file mode 120000 index 0000000000..2cc05e7b59 --- /dev/null +++ b/Lang/SETL/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/SETL \ No newline at end of file diff --git a/Lang/SETL/Amicable-pairs b/Lang/SETL/Amicable-pairs new file mode 120000 index 0000000000..16018f911c --- /dev/null +++ b/Lang/SETL/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/SETL \ No newline at end of file diff --git a/Lang/SETL/Arbitrary-precision-integers-included- b/Lang/SETL/Arbitrary-precision-integers-included- new file mode 120000 index 0000000000..36386fe719 --- /dev/null +++ b/Lang/SETL/Arbitrary-precision-integers-included- @@ -0,0 +1 @@ +../../Task/Arbitrary-precision-integers-included-/SETL \ No newline at end of file diff --git a/Lang/SETL/Arithmetic-derivative b/Lang/SETL/Arithmetic-derivative new file mode 120000 index 0000000000..56f987cef7 --- /dev/null +++ b/Lang/SETL/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/SETL \ No newline at end of file diff --git a/Lang/SETL/Arithmetic-numbers b/Lang/SETL/Arithmetic-numbers new file mode 120000 index 0000000000..e95266732d --- /dev/null +++ b/Lang/SETL/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/SETL \ No newline at end of file diff --git a/Lang/SETL/Attractive-numbers b/Lang/SETL/Attractive-numbers new file mode 120000 index 0000000000..ad7b8eb1fb --- /dev/null +++ b/Lang/SETL/Attractive-numbers @@ -0,0 +1 @@ +../../Task/Attractive-numbers/SETL \ No newline at end of file diff --git a/Lang/SETL/Balanced-brackets b/Lang/SETL/Balanced-brackets new file mode 120000 index 0000000000..2bcb45bd68 --- /dev/null +++ b/Lang/SETL/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/SETL \ No newline at end of file diff --git a/Lang/SETL/Bell-numbers b/Lang/SETL/Bell-numbers new file mode 120000 index 0000000000..32b1473efe --- /dev/null +++ b/Lang/SETL/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/SETL \ No newline at end of file diff --git a/Lang/SETL/Benfords-law b/Lang/SETL/Benfords-law new file mode 120000 index 0000000000..31311648ea --- /dev/null +++ b/Lang/SETL/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/SETL \ No newline at end of file diff --git a/Lang/SETL/Best-shuffle b/Lang/SETL/Best-shuffle new file mode 120000 index 0000000000..25f39d305e --- /dev/null +++ b/Lang/SETL/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/SETL \ No newline at end of file diff --git a/Lang/SETL/Binary-digits b/Lang/SETL/Binary-digits new file mode 120000 index 0000000000..d83b37df85 --- /dev/null +++ b/Lang/SETL/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/SETL \ No newline at end of file diff --git a/Lang/SETL/Brilliant-numbers b/Lang/SETL/Brilliant-numbers new file mode 120000 index 0000000000..8c8cbe8558 --- /dev/null +++ b/Lang/SETL/Brilliant-numbers @@ -0,0 +1 @@ +../../Task/Brilliant-numbers/SETL \ No newline at end of file diff --git a/Lang/SETL/Bulls-and-cows b/Lang/SETL/Bulls-and-cows new file mode 120000 index 0000000000..57d987184b --- /dev/null +++ b/Lang/SETL/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/SETL \ No newline at end of file diff --git a/Lang/SETL/Calculating-the-value-of-e b/Lang/SETL/Calculating-the-value-of-e new file mode 120000 index 0000000000..751e6b54b5 --- /dev/null +++ b/Lang/SETL/Calculating-the-value-of-e @@ -0,0 +1 @@ +../../Task/Calculating-the-value-of-e/SETL \ No newline at end of file diff --git a/Lang/SETL/Comma-quibbling b/Lang/SETL/Comma-quibbling new file mode 120000 index 0000000000..d7ce0447e0 --- /dev/null +++ b/Lang/SETL/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/SETL \ No newline at end of file diff --git a/Lang/SETL/Count-occurrences-of-a-substring b/Lang/SETL/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..dfd90171cb --- /dev/null +++ b/Lang/SETL/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/SETL \ No newline at end of file diff --git a/Lang/SETL/Count-the-coins b/Lang/SETL/Count-the-coins new file mode 120000 index 0000000000..ef2a7d61fb --- /dev/null +++ b/Lang/SETL/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/SETL \ No newline at end of file diff --git a/Lang/SETL/Damm-algorithm b/Lang/SETL/Damm-algorithm new file mode 120000 index 0000000000..8e8b8d193a --- /dev/null +++ b/Lang/SETL/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/SETL \ No newline at end of file diff --git a/Lang/SETL/Disarium-numbers b/Lang/SETL/Disarium-numbers new file mode 120000 index 0000000000..68cddb21a5 --- /dev/null +++ b/Lang/SETL/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/SETL \ No newline at end of file diff --git a/Lang/SETL/Doomsday-rule b/Lang/SETL/Doomsday-rule new file mode 120000 index 0000000000..b9fa54eb7b --- /dev/null +++ b/Lang/SETL/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/SETL \ No newline at end of file diff --git a/Lang/SETL/Duffinian-numbers b/Lang/SETL/Duffinian-numbers new file mode 120000 index 0000000000..93694a20c6 --- /dev/null +++ b/Lang/SETL/Duffinian-numbers @@ -0,0 +1 @@ +../../Task/Duffinian-numbers/SETL \ No newline at end of file diff --git a/Lang/SETL/Entropy b/Lang/SETL/Entropy new file mode 120000 index 0000000000..a16f82bc12 --- /dev/null +++ b/Lang/SETL/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/SETL \ No newline at end of file diff --git a/Lang/SETL/Euclid-Mullin-sequence b/Lang/SETL/Euclid-Mullin-sequence new file mode 120000 index 0000000000..0a5822cf4f --- /dev/null +++ b/Lang/SETL/Euclid-Mullin-sequence @@ -0,0 +1 @@ +../../Task/Euclid-Mullin-sequence/SETL \ No newline at end of file diff --git a/Lang/SETL/Evolutionary-algorithm b/Lang/SETL/Evolutionary-algorithm new file mode 120000 index 0000000000..392a92497c --- /dev/null +++ b/Lang/SETL/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/SETL \ No newline at end of file diff --git a/Lang/SETL/Execute-Brain- b/Lang/SETL/Execute-Brain- new file mode 120000 index 0000000000..4d94451eb9 --- /dev/null +++ b/Lang/SETL/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/SETL \ No newline at end of file diff --git a/Lang/SETL/Execute-a-Markov-algorithm b/Lang/SETL/Execute-a-Markov-algorithm new file mode 120000 index 0000000000..2be6983241 --- /dev/null +++ b/Lang/SETL/Execute-a-Markov-algorithm @@ -0,0 +1 @@ +../../Task/Execute-a-Markov-algorithm/SETL \ No newline at end of file diff --git a/Lang/SETL/Fibonacci-word b/Lang/SETL/Fibonacci-word new file mode 120000 index 0000000000..493b496498 --- /dev/null +++ b/Lang/SETL/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/SETL \ No newline at end of file diff --git a/Lang/SETL/FizzBuzz b/Lang/SETL/FizzBuzz new file mode 120000 index 0000000000..8636f2a4af --- /dev/null +++ b/Lang/SETL/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/SETL \ No newline at end of file diff --git a/Lang/SETL/Floyds-triangle b/Lang/SETL/Floyds-triangle new file mode 120000 index 0000000000..81a4b094c4 --- /dev/null +++ b/Lang/SETL/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/SETL \ No newline at end of file diff --git a/Lang/SETL/Fractran b/Lang/SETL/Fractran new file mode 120000 index 0000000000..20f759abeb --- /dev/null +++ b/Lang/SETL/Fractran @@ -0,0 +1 @@ +../../Task/Fractran/SETL \ No newline at end of file diff --git a/Lang/SETL/General-FizzBuzz b/Lang/SETL/General-FizzBuzz new file mode 120000 index 0000000000..c26977365f --- /dev/null +++ b/Lang/SETL/General-FizzBuzz @@ -0,0 +1 @@ +../../Task/General-FizzBuzz/SETL \ No newline at end of file diff --git a/Lang/SETL/Gray-code b/Lang/SETL/Gray-code new file mode 120000 index 0000000000..a07e0b4e7b --- /dev/null +++ b/Lang/SETL/Gray-code @@ -0,0 +1 @@ +../../Task/Gray-code/SETL \ No newline at end of file diff --git a/Lang/SETL/Hailstone-sequence b/Lang/SETL/Hailstone-sequence new file mode 120000 index 0000000000..4a8fad89a6 --- /dev/null +++ b/Lang/SETL/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/SETL \ No newline at end of file diff --git a/Lang/SETL/Harshad-or-Niven-series b/Lang/SETL/Harshad-or-Niven-series new file mode 120000 index 0000000000..1a226e11f4 --- /dev/null +++ b/Lang/SETL/Harshad-or-Niven-series @@ -0,0 +1 @@ +../../Task/Harshad-or-Niven-series/SETL \ No newline at end of file diff --git a/Lang/SETL/Hofstadter-Figure-Figure-sequences b/Lang/SETL/Hofstadter-Figure-Figure-sequences new file mode 120000 index 0000000000..8e11ba344b --- /dev/null +++ b/Lang/SETL/Hofstadter-Figure-Figure-sequences @@ -0,0 +1 @@ +../../Task/Hofstadter-Figure-Figure-sequences/SETL \ No newline at end of file diff --git a/Lang/SETL/Hofstadter-Q-sequence b/Lang/SETL/Hofstadter-Q-sequence new file mode 120000 index 0000000000..ec34c93a76 --- /dev/null +++ b/Lang/SETL/Hofstadter-Q-sequence @@ -0,0 +1 @@ +../../Task/Hofstadter-Q-sequence/SETL \ No newline at end of file diff --git a/Lang/SETL/Horners-rule-for-polynomial-evaluation b/Lang/SETL/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..c30c2e1637 --- /dev/null +++ b/Lang/SETL/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/SETL \ No newline at end of file diff --git a/Lang/SETL/I-before-E-except-after-C b/Lang/SETL/I-before-E-except-after-C new file mode 120000 index 0000000000..eb551181a0 --- /dev/null +++ b/Lang/SETL/I-before-E-except-after-C @@ -0,0 +1 @@ +../../Task/I-before-E-except-after-C/SETL \ No newline at end of file diff --git a/Lang/SETL/ISBN13-check-digit b/Lang/SETL/ISBN13-check-digit new file mode 120000 index 0000000000..3408d74baf --- /dev/null +++ b/Lang/SETL/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/SETL \ No newline at end of file diff --git a/Lang/SETL/Isqrt-integer-square-root-of-X b/Lang/SETL/Isqrt-integer-square-root-of-X new file mode 120000 index 0000000000..cdee92f277 --- /dev/null +++ b/Lang/SETL/Isqrt-integer-square-root-of-X @@ -0,0 +1 @@ +../../Task/Isqrt-integer-square-root-of-X/SETL \ No newline at end of file diff --git a/Lang/SETL/Jacobsthal-numbers b/Lang/SETL/Jacobsthal-numbers new file mode 120000 index 0000000000..e3f736b41e --- /dev/null +++ b/Lang/SETL/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/SETL \ No newline at end of file diff --git a/Lang/SETL/Jewels-and-stones b/Lang/SETL/Jewels-and-stones new file mode 120000 index 0000000000..51fbbc70a9 --- /dev/null +++ b/Lang/SETL/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/SETL \ No newline at end of file diff --git a/Lang/SETL/Knuth-shuffle b/Lang/SETL/Knuth-shuffle new file mode 120000 index 0000000000..004909767e --- /dev/null +++ b/Lang/SETL/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/SETL \ No newline at end of file diff --git a/Lang/SETL/Lah-numbers b/Lang/SETL/Lah-numbers new file mode 120000 index 0000000000..bacd61650e --- /dev/null +++ b/Lang/SETL/Lah-numbers @@ -0,0 +1 @@ +../../Task/Lah-numbers/SETL \ No newline at end of file diff --git a/Lang/SETL/Largest-proper-divisor-of-n b/Lang/SETL/Largest-proper-divisor-of-n new file mode 120000 index 0000000000..a82ec82f9e --- /dev/null +++ b/Lang/SETL/Largest-proper-divisor-of-n @@ -0,0 +1 @@ +../../Task/Largest-proper-divisor-of-n/SETL \ No newline at end of file diff --git a/Lang/SETL/Levenshtein-distance b/Lang/SETL/Levenshtein-distance new file mode 120000 index 0000000000..5a234fcd60 --- /dev/null +++ b/Lang/SETL/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/SETL \ No newline at end of file diff --git a/Lang/SETL/Longest-common-substring b/Lang/SETL/Longest-common-substring new file mode 120000 index 0000000000..9eb7192015 --- /dev/null +++ b/Lang/SETL/Longest-common-substring @@ -0,0 +1 @@ +../../Task/Longest-common-substring/SETL \ No newline at end of file diff --git a/Lang/SETL/Look-and-say-sequence b/Lang/SETL/Look-and-say-sequence new file mode 120000 index 0000000000..a850f015f4 --- /dev/null +++ b/Lang/SETL/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/SETL \ No newline at end of file diff --git a/Lang/SETL/Loops-Do-while b/Lang/SETL/Loops-Do-while new file mode 120000 index 0000000000..8e0329f189 --- /dev/null +++ b/Lang/SETL/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/SETL \ No newline at end of file diff --git a/Lang/SETL/Loops-Increment-loop-index-within-loop-body b/Lang/SETL/Loops-Increment-loop-index-within-loop-body new file mode 120000 index 0000000000..21b3e5953d --- /dev/null +++ b/Lang/SETL/Loops-Increment-loop-index-within-loop-body @@ -0,0 +1 @@ +../../Task/Loops-Increment-loop-index-within-loop-body/SETL \ No newline at end of file diff --git a/Lang/SETL/Loops-Infinite b/Lang/SETL/Loops-Infinite new file mode 120000 index 0000000000..582c03e313 --- /dev/null +++ b/Lang/SETL/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/SETL \ No newline at end of file diff --git a/Lang/SETL/Loops-N-plus-one-half b/Lang/SETL/Loops-N-plus-one-half new file mode 120000 index 0000000000..111820383b --- /dev/null +++ b/Lang/SETL/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/SETL \ No newline at end of file diff --git a/Lang/SETL/Luhn-test-of-credit-card-numbers b/Lang/SETL/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..d5c47a10ed --- /dev/null +++ b/Lang/SETL/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/SETL \ No newline at end of file diff --git a/Lang/SETL/Magnanimous-numbers b/Lang/SETL/Magnanimous-numbers new file mode 120000 index 0000000000..53f30352fa --- /dev/null +++ b/Lang/SETL/Magnanimous-numbers @@ -0,0 +1 @@ +../../Task/Magnanimous-numbers/SETL \ No newline at end of file diff --git a/Lang/SETL/Matrix-transposition b/Lang/SETL/Matrix-transposition new file mode 120000 index 0000000000..9a975d9213 --- /dev/null +++ b/Lang/SETL/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/SETL \ No newline at end of file diff --git a/Lang/SETL/Mayan-numerals b/Lang/SETL/Mayan-numerals new file mode 120000 index 0000000000..fd50100876 --- /dev/null +++ b/Lang/SETL/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/SETL \ No newline at end of file diff --git a/Lang/SETL/McNuggets-problem b/Lang/SETL/McNuggets-problem new file mode 120000 index 0000000000..b2aec73884 --- /dev/null +++ b/Lang/SETL/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/SETL \ No newline at end of file diff --git a/Lang/SETL/Mertens-function b/Lang/SETL/Mertens-function new file mode 120000 index 0000000000..661391c87c --- /dev/null +++ b/Lang/SETL/Mertens-function @@ -0,0 +1 @@ +../../Task/Mertens-function/SETL \ No newline at end of file diff --git a/Lang/SETL/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/SETL/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..a5595c5352 --- /dev/null +++ b/Lang/SETL/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/SETL \ No newline at end of file diff --git a/Lang/SETL/Modular-exponentiation b/Lang/SETL/Modular-exponentiation new file mode 120000 index 0000000000..fcea778ebb --- /dev/null +++ b/Lang/SETL/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/SETL \ No newline at end of file diff --git a/Lang/SETL/Monte-Carlo-methods b/Lang/SETL/Monte-Carlo-methods new file mode 120000 index 0000000000..da6adaf82b --- /dev/null +++ b/Lang/SETL/Monte-Carlo-methods @@ -0,0 +1 @@ +../../Task/Monte-Carlo-methods/SETL \ No newline at end of file diff --git a/Lang/SETL/Monty-Hall-problem b/Lang/SETL/Monty-Hall-problem new file mode 120000 index 0000000000..0740052c5e --- /dev/null +++ b/Lang/SETL/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/SETL \ No newline at end of file diff --git a/Lang/SETL/Move-to-front-algorithm b/Lang/SETL/Move-to-front-algorithm new file mode 120000 index 0000000000..7a6129ce08 --- /dev/null +++ b/Lang/SETL/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/SETL \ No newline at end of file diff --git a/Lang/SETL/Multifactorial b/Lang/SETL/Multifactorial new file mode 120000 index 0000000000..e7d0193c33 --- /dev/null +++ b/Lang/SETL/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/SETL \ No newline at end of file diff --git a/Lang/SETL/Munchausen-numbers b/Lang/SETL/Munchausen-numbers new file mode 120000 index 0000000000..cce57345fa --- /dev/null +++ b/Lang/SETL/Munchausen-numbers @@ -0,0 +1 @@ +../../Task/Munchausen-numbers/SETL \ No newline at end of file diff --git a/Lang/SETL/Mutual-recursion b/Lang/SETL/Mutual-recursion new file mode 120000 index 0000000000..daa374d788 --- /dev/null +++ b/Lang/SETL/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/SETL \ No newline at end of file diff --git a/Lang/SETL/Narcissistic-decimal-number b/Lang/SETL/Narcissistic-decimal-number new file mode 120000 index 0000000000..d2b692567b --- /dev/null +++ b/Lang/SETL/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/SETL \ No newline at end of file diff --git a/Lang/SETL/Nested-templated-data b/Lang/SETL/Nested-templated-data new file mode 120000 index 0000000000..58fd3f508a --- /dev/null +++ b/Lang/SETL/Nested-templated-data @@ -0,0 +1 @@ +../../Task/Nested-templated-data/SETL \ No newline at end of file diff --git a/Lang/SETL/Nth b/Lang/SETL/Nth new file mode 120000 index 0000000000..e6331e1f30 --- /dev/null +++ b/Lang/SETL/Nth @@ -0,0 +1 @@ +../../Task/Nth/SETL \ No newline at end of file diff --git a/Lang/SETL/Number-reversal-game b/Lang/SETL/Number-reversal-game new file mode 120000 index 0000000000..f1abe175ee --- /dev/null +++ b/Lang/SETL/Number-reversal-game @@ -0,0 +1 @@ +../../Task/Number-reversal-game/SETL \ No newline at end of file diff --git a/Lang/SETL/Old-lady-swallowed-a-fly b/Lang/SETL/Old-lady-swallowed-a-fly new file mode 120000 index 0000000000..948ed47605 --- /dev/null +++ b/Lang/SETL/Old-lady-swallowed-a-fly @@ -0,0 +1 @@ +../../Task/Old-lady-swallowed-a-fly/SETL \ No newline at end of file diff --git a/Lang/SETL/Ordered-words b/Lang/SETL/Ordered-words new file mode 120000 index 0000000000..efd35b209e --- /dev/null +++ b/Lang/SETL/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/SETL \ No newline at end of file diff --git a/Lang/SETL/Partition-an-integer-x-into-n-primes b/Lang/SETL/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..b2bcddc942 --- /dev/null +++ b/Lang/SETL/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/SETL \ No newline at end of file diff --git a/Lang/SETL/Partition-function-P b/Lang/SETL/Partition-function-P new file mode 120000 index 0000000000..f47b3bd593 --- /dev/null +++ b/Lang/SETL/Partition-function-P @@ -0,0 +1 @@ +../../Task/Partition-function-P/SETL \ No newline at end of file diff --git a/Lang/SETL/Perfect-shuffle b/Lang/SETL/Perfect-shuffle new file mode 120000 index 0000000000..25925daae7 --- /dev/null +++ b/Lang/SETL/Perfect-shuffle @@ -0,0 +1 @@ +../../Task/Perfect-shuffle/SETL \ No newline at end of file diff --git a/Lang/SETL/Pig-the-dice-game b/Lang/SETL/Pig-the-dice-game new file mode 120000 index 0000000000..6e254b1d9d --- /dev/null +++ b/Lang/SETL/Pig-the-dice-game @@ -0,0 +1 @@ +../../Task/Pig-the-dice-game/SETL \ No newline at end of file diff --git a/Lang/SETL/Pisano-period b/Lang/SETL/Pisano-period new file mode 120000 index 0000000000..735d169166 --- /dev/null +++ b/Lang/SETL/Pisano-period @@ -0,0 +1 @@ +../../Task/Pisano-period/SETL \ No newline at end of file diff --git a/Lang/SETL/Population-count b/Lang/SETL/Population-count new file mode 120000 index 0000000000..705b1439fa --- /dev/null +++ b/Lang/SETL/Population-count @@ -0,0 +1 @@ +../../Task/Population-count/SETL \ No newline at end of file diff --git a/Lang/SETL/Primality-by-Wilsons-theorem b/Lang/SETL/Primality-by-Wilsons-theorem new file mode 120000 index 0000000000..0c948a95c3 --- /dev/null +++ b/Lang/SETL/Primality-by-Wilsons-theorem @@ -0,0 +1 @@ +../../Task/Primality-by-Wilsons-theorem/SETL \ No newline at end of file diff --git a/Lang/SETL/Primality-by-trial-division b/Lang/SETL/Primality-by-trial-division new file mode 120000 index 0000000000..e7440ef21b --- /dev/null +++ b/Lang/SETL/Primality-by-trial-division @@ -0,0 +1 @@ +../../Task/Primality-by-trial-division/SETL \ No newline at end of file diff --git a/Lang/SETL/RPG-attributes-generator b/Lang/SETL/RPG-attributes-generator new file mode 120000 index 0000000000..86469ad6af --- /dev/null +++ b/Lang/SETL/RPG-attributes-generator @@ -0,0 +1 @@ +../../Task/RPG-attributes-generator/SETL \ No newline at end of file diff --git a/Lang/SETL/Radical-of-an-integer b/Lang/SETL/Radical-of-an-integer new file mode 120000 index 0000000000..7020a7b45c --- /dev/null +++ b/Lang/SETL/Radical-of-an-integer @@ -0,0 +1 @@ +../../Task/Radical-of-an-integer/SETL \ No newline at end of file diff --git a/Lang/SETL/Range-consolidation b/Lang/SETL/Range-consolidation new file mode 120000 index 0000000000..b24d504011 --- /dev/null +++ b/Lang/SETL/Range-consolidation @@ -0,0 +1 @@ +../../Task/Range-consolidation/SETL \ No newline at end of file diff --git a/Lang/SETL/Recamans-sequence b/Lang/SETL/Recamans-sequence new file mode 120000 index 0000000000..323bd2dfbb --- /dev/null +++ b/Lang/SETL/Recamans-sequence @@ -0,0 +1 @@ +../../Task/Recamans-sequence/SETL \ No newline at end of file diff --git a/Lang/SETL/Rep-string b/Lang/SETL/Rep-string new file mode 120000 index 0000000000..e0f71aa173 --- /dev/null +++ b/Lang/SETL/Rep-string @@ -0,0 +1 @@ +../../Task/Rep-string/SETL \ No newline at end of file diff --git a/Lang/SETL/Run-length-encoding b/Lang/SETL/Run-length-encoding new file mode 120000 index 0000000000..a32119613b --- /dev/null +++ b/Lang/SETL/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/SETL \ No newline at end of file diff --git a/Lang/SETL/Sequence-of-non-squares b/Lang/SETL/Sequence-of-non-squares new file mode 120000 index 0000000000..42f3e6d196 --- /dev/null +++ b/Lang/SETL/Sequence-of-non-squares @@ -0,0 +1 @@ +../../Task/Sequence-of-non-squares/SETL \ No newline at end of file diff --git a/Lang/SETL/Sequence:-smallest-number-with-exactly-n-divisors b/Lang/SETL/Sequence:-smallest-number-with-exactly-n-divisors new file mode 120000 index 0000000000..be279b1c99 --- /dev/null +++ b/Lang/SETL/Sequence:-smallest-number-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-with-exactly-n-divisors/SETL \ No newline at end of file diff --git a/Lang/SETL/Set-consolidation b/Lang/SETL/Set-consolidation new file mode 120000 index 0000000000..68db29abe2 --- /dev/null +++ b/Lang/SETL/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/SETL \ No newline at end of file diff --git a/Lang/SETL/Show-ASCII-table b/Lang/SETL/Show-ASCII-table new file mode 120000 index 0000000000..5c4e8348ce --- /dev/null +++ b/Lang/SETL/Show-ASCII-table @@ -0,0 +1 @@ +../../Task/Show-ASCII-table/SETL \ No newline at end of file diff --git a/Lang/SETL/Sierpinski-triangle b/Lang/SETL/Sierpinski-triangle new file mode 120000 index 0000000000..fbbf99df57 --- /dev/null +++ b/Lang/SETL/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/SETL \ No newline at end of file diff --git a/Lang/SETL/Sieve-of-Eratosthenes b/Lang/SETL/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..aea065e02a --- /dev/null +++ b/Lang/SETL/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/SETL \ No newline at end of file diff --git a/Lang/SETL/Sleeping-Beauty-problem b/Lang/SETL/Sleeping-Beauty-problem new file mode 120000 index 0000000000..cf1ef983c1 --- /dev/null +++ b/Lang/SETL/Sleeping-Beauty-problem @@ -0,0 +1 @@ +../../Task/Sleeping-Beauty-problem/SETL \ No newline at end of file diff --git a/Lang/SETL/Smith-numbers b/Lang/SETL/Smith-numbers new file mode 120000 index 0000000000..fbe0a251a7 --- /dev/null +++ b/Lang/SETL/Smith-numbers @@ -0,0 +1 @@ +../../Task/Smith-numbers/SETL \ No newline at end of file diff --git a/Lang/SETL/Sorting-algorithms-Merge-sort b/Lang/SETL/Sorting-algorithms-Merge-sort new file mode 120000 index 0000000000..c4887f3d58 --- /dev/null +++ b/Lang/SETL/Sorting-algorithms-Merge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Merge-sort/SETL \ No newline at end of file diff --git a/Lang/SETL/Split-a-character-string-based-on-change-of-character b/Lang/SETL/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..ff9aa0b4dd --- /dev/null +++ b/Lang/SETL/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/SETL \ No newline at end of file diff --git a/Lang/SETL/Square-free-integers b/Lang/SETL/Square-free-integers new file mode 120000 index 0000000000..328ef78775 --- /dev/null +++ b/Lang/SETL/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/SETL \ No newline at end of file diff --git a/Lang/SETL/Stern-Brocot-sequence b/Lang/SETL/Stern-Brocot-sequence new file mode 120000 index 0000000000..ed3c987e48 --- /dev/null +++ b/Lang/SETL/Stern-Brocot-sequence @@ -0,0 +1 @@ +../../Task/Stern-Brocot-sequence/SETL \ No newline at end of file diff --git a/Lang/SETL/Strip-a-set-of-characters-from-a-string b/Lang/SETL/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..d72c1a9983 --- /dev/null +++ b/Lang/SETL/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/SETL \ No newline at end of file diff --git a/Lang/SETL/Strip-comments-from-a-string b/Lang/SETL/Strip-comments-from-a-string new file mode 120000 index 0000000000..6397b858bf --- /dev/null +++ b/Lang/SETL/Strip-comments-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-comments-from-a-string/SETL \ No newline at end of file diff --git a/Lang/SETL/Subleq b/Lang/SETL/Subleq new file mode 120000 index 0000000000..8c02c191b8 --- /dev/null +++ b/Lang/SETL/Subleq @@ -0,0 +1 @@ +../../Task/Subleq/SETL \ No newline at end of file diff --git a/Lang/SETL/Sum-of-a-series b/Lang/SETL/Sum-of-a-series new file mode 120000 index 0000000000..7a9118efe1 --- /dev/null +++ b/Lang/SETL/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/SETL \ No newline at end of file diff --git a/Lang/SETL/Super-d-numbers b/Lang/SETL/Super-d-numbers new file mode 120000 index 0000000000..0f77d4c38c --- /dev/null +++ b/Lang/SETL/Super-d-numbers @@ -0,0 +1 @@ +../../Task/Super-d-numbers/SETL \ No newline at end of file diff --git a/Lang/SETL/Symmetric-difference b/Lang/SETL/Symmetric-difference new file mode 120000 index 0000000000..0f20da20ec --- /dev/null +++ b/Lang/SETL/Symmetric-difference @@ -0,0 +1 @@ +../../Task/Symmetric-difference/SETL \ No newline at end of file diff --git a/Lang/SETL/Take-notes-on-the-command-line b/Lang/SETL/Take-notes-on-the-command-line new file mode 120000 index 0000000000..8f57bffc36 --- /dev/null +++ b/Lang/SETL/Take-notes-on-the-command-line @@ -0,0 +1 @@ +../../Task/Take-notes-on-the-command-line/SETL \ No newline at end of file diff --git a/Lang/SETL/The-Twelve-Days-of-Christmas b/Lang/SETL/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..8cc8cd0542 --- /dev/null +++ b/Lang/SETL/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/SETL \ No newline at end of file diff --git a/Lang/SETL/Tokenize-a-string b/Lang/SETL/Tokenize-a-string new file mode 120000 index 0000000000..bd55474aef --- /dev/null +++ b/Lang/SETL/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/SETL \ No newline at end of file diff --git a/Lang/SETL/Totient-function b/Lang/SETL/Totient-function new file mode 120000 index 0000000000..6a46ce245e --- /dev/null +++ b/Lang/SETL/Totient-function @@ -0,0 +1 @@ +../../Task/Totient-function/SETL \ No newline at end of file diff --git a/Lang/SETL/Towers-of-Hanoi b/Lang/SETL/Towers-of-Hanoi new file mode 120000 index 0000000000..1b09a27284 --- /dev/null +++ b/Lang/SETL/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/SETL \ No newline at end of file diff --git a/Lang/SETL/Tree-traversal b/Lang/SETL/Tree-traversal new file mode 120000 index 0000000000..57c73a640b --- /dev/null +++ b/Lang/SETL/Tree-traversal @@ -0,0 +1 @@ +../../Task/Tree-traversal/SETL \ No newline at end of file diff --git a/Lang/SETL/Truth-table b/Lang/SETL/Truth-table new file mode 120000 index 0000000000..1bc47e2171 --- /dev/null +++ b/Lang/SETL/Truth-table @@ -0,0 +1 @@ +../../Task/Truth-table/SETL \ No newline at end of file diff --git a/Lang/SETL/Van-Eck-sequence b/Lang/SETL/Van-Eck-sequence new file mode 120000 index 0000000000..6f522664da --- /dev/null +++ b/Lang/SETL/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/SETL \ No newline at end of file diff --git a/Lang/SETL/Vector-products b/Lang/SETL/Vector-products new file mode 120000 index 0000000000..936d45f3d5 --- /dev/null +++ b/Lang/SETL/Vector-products @@ -0,0 +1 @@ +../../Task/Vector-products/SETL \ No newline at end of file diff --git a/Lang/SETL/Word-ladder b/Lang/SETL/Word-ladder new file mode 120000 index 0000000000..c8dccafa85 --- /dev/null +++ b/Lang/SETL/Word-ladder @@ -0,0 +1 @@ +../../Task/Word-ladder/SETL \ No newline at end of file diff --git a/Lang/SETL/Yin-and-yang b/Lang/SETL/Yin-and-yang new file mode 120000 index 0000000000..4dfaa09d59 --- /dev/null +++ b/Lang/SETL/Yin-and-yang @@ -0,0 +1 @@ +../../Task/Yin-and-yang/SETL \ No newline at end of file diff --git a/Lang/SETL/Zeckendorf-number-representation b/Lang/SETL/Zeckendorf-number-representation new file mode 120000 index 0000000000..536fc12840 --- /dev/null +++ b/Lang/SETL/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/SETL \ No newline at end of file diff --git a/Lang/SIL/00-LANG.txt b/Lang/SIL/00-LANG.txt new file mode 100644 index 0000000000..2639d4af86 --- /dev/null +++ b/Lang/SIL/00-LANG.txt @@ -0,0 +1,8 @@ +{{stub}}{{language|sil}} +SIL (Simple Interpreted Language) is designed for a nostalgic view of the past. It is simple and minimalist, but remains capable of universal computation. SIL used to be known as S.I.L.O.S. + +=== Todo === +[[Tasks not implemented in SIL]] + +==Links== +*[https://github.com/rjhunjhunwala/SIL-S.I.L.O.S SIL on GitHub] \ No newline at end of file diff --git a/Lang/SIL/00-META.yaml b/Lang/SIL/00-META.yaml new file mode 100644 index 0000000000..ac7ba9e679 --- /dev/null +++ b/Lang/SIL/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:SIL diff --git a/Lang/SIL/Apply-a-callback-to-an-array b/Lang/SIL/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..c6346f2693 --- /dev/null +++ b/Lang/SIL/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/SIL \ No newline at end of file diff --git a/Lang/SIL/Arithmetic-Integer b/Lang/SIL/Arithmetic-Integer new file mode 120000 index 0000000000..0359dfe6a8 --- /dev/null +++ b/Lang/SIL/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/SIL \ No newline at end of file diff --git a/Lang/SIL/Function-definition b/Lang/SIL/Function-definition new file mode 120000 index 0000000000..1ed935d033 --- /dev/null +++ b/Lang/SIL/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/SIL \ No newline at end of file diff --git a/Lang/SIL/Hello-world-Text b/Lang/SIL/Hello-world-Text new file mode 120000 index 0000000000..67a60a7cc4 --- /dev/null +++ b/Lang/SIL/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/SIL \ No newline at end of file diff --git a/Lang/SIL/Loops-Do-while b/Lang/SIL/Loops-Do-while new file mode 120000 index 0000000000..226040ebd7 --- /dev/null +++ b/Lang/SIL/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/SIL \ No newline at end of file diff --git a/Lang/SIL/Loops-For b/Lang/SIL/Loops-For new file mode 120000 index 0000000000..f6976d2ec6 --- /dev/null +++ b/Lang/SIL/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/SIL \ No newline at end of file diff --git a/Lang/SIL/Loops-Infinite b/Lang/SIL/Loops-Infinite new file mode 120000 index 0000000000..923cceed13 --- /dev/null +++ b/Lang/SIL/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/SIL \ No newline at end of file diff --git a/Lang/SIL/Loops-N-plus-one-half b/Lang/SIL/Loops-N-plus-one-half new file mode 120000 index 0000000000..8adce730cd --- /dev/null +++ b/Lang/SIL/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/SIL \ No newline at end of file diff --git a/Lang/SIL/Loops-While b/Lang/SIL/Loops-While new file mode 120000 index 0000000000..401dee2479 --- /dev/null +++ b/Lang/SIL/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/SIL \ No newline at end of file diff --git a/Lang/SNOBOL4/Find-the-intersection-of-two-lines b/Lang/SNOBOL4/Find-the-intersection-of-two-lines new file mode 120000 index 0000000000..b2451a2b39 --- /dev/null +++ b/Lang/SNOBOL4/Find-the-intersection-of-two-lines @@ -0,0 +1 @@ +../../Task/Find-the-intersection-of-two-lines/SNOBOL4 \ No newline at end of file diff --git a/Lang/SNOBOL4/Multiplication-tables b/Lang/SNOBOL4/Multiplication-tables new file mode 120000 index 0000000000..756425cd3a --- /dev/null +++ b/Lang/SNOBOL4/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/SNOBOL4 \ No newline at end of file diff --git a/Lang/SQL/Factorial b/Lang/SQL/Factorial new file mode 120000 index 0000000000..c6f45973cd --- /dev/null +++ b/Lang/SQL/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/SQL \ No newline at end of file diff --git a/Lang/Sage/Amicable-pairs b/Lang/Sage/Amicable-pairs new file mode 120000 index 0000000000..c06c543646 --- /dev/null +++ b/Lang/Sage/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/Sage \ No newline at end of file diff --git a/Lang/SapbotVM/00-LANG.txt b/Lang/SapbotVM/00-LANG.txt new file mode 100644 index 0000000000..a83fdbd907 --- /dev/null +++ b/Lang/SapbotVM/00-LANG.txt @@ -0,0 +1,4 @@ +{{stub}}{{language|SapbotVM}} +SapbotVM is easy-to-implement virtual machine architecture, made by Romarchive, that's not compilable, but only have interpreted Assembler. Also, this language have two formats: SVM1, SVM2. First, is based on JSON, second is custom. + +SapbotVM have limited support for monitor, no internet and plug and play devices. So only serial port. \ No newline at end of file diff --git a/Lang/SapbotVM/00-META.yaml b/Lang/SapbotVM/00-META.yaml new file mode 100644 index 0000000000..f50043dbce --- /dev/null +++ b/Lang/SapbotVM/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:SapbotVM diff --git a/Lang/SapbotVM/Guess-the-number-With-feedback b/Lang/SapbotVM/Guess-the-number-With-feedback new file mode 120000 index 0000000000..0038e4427f --- /dev/null +++ b/Lang/SapbotVM/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/SapbotVM \ No newline at end of file diff --git a/Lang/SapbotVM/Hello-world-Text b/Lang/SapbotVM/Hello-world-Text new file mode 120000 index 0000000000..c695d3ee98 --- /dev/null +++ b/Lang/SapbotVM/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/SapbotVM \ No newline at end of file diff --git a/Lang/Scala/Additive-primes b/Lang/Scala/Additive-primes new file mode 120000 index 0000000000..ba2692b54f --- /dev/null +++ b/Lang/Scala/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/Scala \ No newline at end of file diff --git a/Lang/Scala/Almkvist-Giullera-formula-for-pi b/Lang/Scala/Almkvist-Giullera-formula-for-pi new file mode 120000 index 0000000000..4d4df47135 --- /dev/null +++ b/Lang/Scala/Almkvist-Giullera-formula-for-pi @@ -0,0 +1 @@ +../../Task/Almkvist-Giullera-formula-for-pi/Scala \ No newline at end of file diff --git a/Lang/Scala/Arithmetic-derivative b/Lang/Scala/Arithmetic-derivative new file mode 120000 index 0000000000..f28c4f2425 --- /dev/null +++ b/Lang/Scala/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Scala \ No newline at end of file diff --git a/Lang/Scala/Arithmetic-numbers b/Lang/Scala/Arithmetic-numbers new file mode 120000 index 0000000000..3d59c01a8c --- /dev/null +++ b/Lang/Scala/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/Scala \ No newline at end of file diff --git a/Lang/Scala/Bin-given-limits b/Lang/Scala/Bin-given-limits new file mode 120000 index 0000000000..9debe0aa7f --- /dev/null +++ b/Lang/Scala/Bin-given-limits @@ -0,0 +1 @@ +../../Task/Bin-given-limits/Scala \ No newline at end of file diff --git a/Lang/Scala/Biorhythms b/Lang/Scala/Biorhythms new file mode 120000 index 0000000000..e60407361c --- /dev/null +++ b/Lang/Scala/Biorhythms @@ -0,0 +1 @@ +../../Task/Biorhythms/Scala \ No newline at end of file diff --git a/Lang/Scala/Blum-integer b/Lang/Scala/Blum-integer new file mode 120000 index 0000000000..5a481a686a --- /dev/null +++ b/Lang/Scala/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/Scala \ No newline at end of file diff --git a/Lang/Scala/Boyer-Moore-string-search b/Lang/Scala/Boyer-Moore-string-search new file mode 120000 index 0000000000..58b64a7997 --- /dev/null +++ b/Lang/Scala/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/Scala \ No newline at end of file diff --git a/Lang/Scala/Camel-case-and-snake-case b/Lang/Scala/Camel-case-and-snake-case new file mode 120000 index 0000000000..ce7d2434b0 --- /dev/null +++ b/Lang/Scala/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/Scala \ No newline at end of file diff --git a/Lang/Scala/Canonicalize-CIDR b/Lang/Scala/Canonicalize-CIDR new file mode 120000 index 0000000000..f594c73e4d --- /dev/null +++ b/Lang/Scala/Canonicalize-CIDR @@ -0,0 +1 @@ +../../Task/Canonicalize-CIDR/Scala \ No newline at end of file diff --git a/Lang/Scala/Church-numerals b/Lang/Scala/Church-numerals new file mode 120000 index 0000000000..b2182324c0 --- /dev/null +++ b/Lang/Scala/Church-numerals @@ -0,0 +1 @@ +../../Task/Church-numerals/Scala \ No newline at end of file diff --git a/Lang/Scala/Compare-length-of-two-strings b/Lang/Scala/Compare-length-of-two-strings new file mode 120000 index 0000000000..dac82e206f --- /dev/null +++ b/Lang/Scala/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/Scala \ No newline at end of file diff --git a/Lang/Scala/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- b/Lang/Scala/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- new file mode 120000 index 0000000000..03b359aab4 --- /dev/null +++ b/Lang/Scala/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n-/Scala \ No newline at end of file diff --git a/Lang/Scala/Cullen-and-Woodall-numbers b/Lang/Scala/Cullen-and-Woodall-numbers new file mode 120000 index 0000000000..f8b8f7d073 --- /dev/null +++ b/Lang/Scala/Cullen-and-Woodall-numbers @@ -0,0 +1 @@ +../../Task/Cullen-and-Woodall-numbers/Scala \ No newline at end of file diff --git a/Lang/Scala/De-Bruijn-sequences b/Lang/Scala/De-Bruijn-sequences new file mode 120000 index 0000000000..c833bc5131 --- /dev/null +++ b/Lang/Scala/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/Scala \ No newline at end of file diff --git a/Lang/Scala/Demings-funnel b/Lang/Scala/Demings-funnel new file mode 120000 index 0000000000..64936fefc5 --- /dev/null +++ b/Lang/Scala/Demings-funnel @@ -0,0 +1 @@ +../../Task/Demings-funnel/Scala \ No newline at end of file diff --git a/Lang/Scala/Descending-primes b/Lang/Scala/Descending-primes new file mode 120000 index 0000000000..461c6bfefd --- /dev/null +++ b/Lang/Scala/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/Scala \ No newline at end of file diff --git a/Lang/Scala/Doomsday-rule b/Lang/Scala/Doomsday-rule new file mode 120000 index 0000000000..2d0de21fa5 --- /dev/null +++ b/Lang/Scala/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/Scala \ No newline at end of file diff --git a/Lang/Scala/Eulers-constant-0.5772... b/Lang/Scala/Eulers-constant-0.5772... new file mode 120000 index 0000000000..0fe8049cca --- /dev/null +++ b/Lang/Scala/Eulers-constant-0.5772... @@ -0,0 +1 @@ +../../Task/Eulers-constant-0.5772.../Scala \ No newline at end of file diff --git a/Lang/Scala/Floyd-Warshall-algorithm b/Lang/Scala/Floyd-Warshall-algorithm new file mode 120000 index 0000000000..ef9de392a8 --- /dev/null +++ b/Lang/Scala/Floyd-Warshall-algorithm @@ -0,0 +1 @@ +../../Task/Floyd-Warshall-algorithm/Scala \ No newline at end of file diff --git a/Lang/Scala/Gaussian-elimination b/Lang/Scala/Gaussian-elimination new file mode 120000 index 0000000000..ececfb8068 --- /dev/null +++ b/Lang/Scala/Gaussian-elimination @@ -0,0 +1 @@ +../../Task/Gaussian-elimination/Scala \ No newline at end of file diff --git a/Lang/Scala/Giuga-numbers b/Lang/Scala/Giuga-numbers new file mode 120000 index 0000000000..69d4a1842f --- /dev/null +++ b/Lang/Scala/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/Scala \ No newline at end of file diff --git a/Lang/Scala/ISBN13-check-digit b/Lang/Scala/ISBN13-check-digit new file mode 120000 index 0000000000..b0dc1022b2 --- /dev/null +++ b/Lang/Scala/ISBN13-check-digit @@ -0,0 +1 @@ +../../Task/ISBN13-check-digit/Scala \ No newline at end of file diff --git a/Lang/Scala/Jordan-P-lya-numbers b/Lang/Scala/Jordan-P-lya-numbers new file mode 120000 index 0000000000..ea8b9ff9a2 --- /dev/null +++ b/Lang/Scala/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Scala \ No newline at end of file diff --git a/Lang/Scala/Miller-Rabin-primality-test b/Lang/Scala/Miller-Rabin-primality-test deleted file mode 120000 index 28de5ef463..0000000000 --- a/Lang/Scala/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Scala \ No newline at end of file diff --git a/Lang/Scala/Padovan-sequence b/Lang/Scala/Padovan-sequence new file mode 120000 index 0000000000..685b3e0f0a --- /dev/null +++ b/Lang/Scala/Padovan-sequence @@ -0,0 +1 @@ +../../Task/Padovan-sequence/Scala \ No newline at end of file diff --git a/Lang/Scala/Pancake-numbers b/Lang/Scala/Pancake-numbers new file mode 120000 index 0000000000..65ed4c5503 --- /dev/null +++ b/Lang/Scala/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/Scala \ No newline at end of file diff --git a/Lang/Scala/Parallel-calculations b/Lang/Scala/Parallel-calculations new file mode 120000 index 0000000000..525e6ca1ba --- /dev/null +++ b/Lang/Scala/Parallel-calculations @@ -0,0 +1 @@ +../../Task/Parallel-calculations/Scala \ No newline at end of file diff --git a/Lang/Scala/Parsing-Shunting-yard-algorithm b/Lang/Scala/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..84c22e4a24 --- /dev/null +++ b/Lang/Scala/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/Scala \ No newline at end of file diff --git a/Lang/Scala/Primality-by-Wilsons-theorem b/Lang/Scala/Primality-by-Wilsons-theorem new file mode 120000 index 0000000000..ed0f8a0a73 --- /dev/null +++ b/Lang/Scala/Primality-by-Wilsons-theorem @@ -0,0 +1 @@ +../../Task/Primality-by-Wilsons-theorem/Scala \ No newline at end of file diff --git a/Lang/Scala/Pseudo-random-numbers-PCG32 b/Lang/Scala/Pseudo-random-numbers-PCG32 new file mode 120000 index 0000000000..ebdb3ee5a4 --- /dev/null +++ b/Lang/Scala/Pseudo-random-numbers-PCG32 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-PCG32/Scala \ No newline at end of file diff --git a/Lang/Scala/Quaternion-type b/Lang/Scala/Quaternion-type deleted file mode 120000 index 15f3eda4c9..0000000000 --- a/Lang/Scala/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Scala \ No newline at end of file diff --git a/Lang/Scala/Ramanujan-primes-twins b/Lang/Scala/Ramanujan-primes-twins new file mode 120000 index 0000000000..9565fe8fd6 --- /dev/null +++ b/Lang/Scala/Ramanujan-primes-twins @@ -0,0 +1 @@ +../../Task/Ramanujan-primes-twins/Scala \ No newline at end of file diff --git a/Lang/Scala/Ramer-Douglas-Peucker-line-simplification b/Lang/Scala/Ramer-Douglas-Peucker-line-simplification new file mode 120000 index 0000000000..a357270663 --- /dev/null +++ b/Lang/Scala/Ramer-Douglas-Peucker-line-simplification @@ -0,0 +1 @@ +../../Task/Ramer-Douglas-Peucker-line-simplification/Scala \ No newline at end of file diff --git a/Lang/Scala/Sorting-Algorithms-Circle-Sort b/Lang/Scala/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 5b9f057951..0000000000 --- a/Lang/Scala/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Scala \ No newline at end of file diff --git a/Lang/Scala/Steffensens-method b/Lang/Scala/Steffensens-method new file mode 120000 index 0000000000..8bb21e2851 --- /dev/null +++ b/Lang/Scala/Steffensens-method @@ -0,0 +1 @@ +../../Task/Steffensens-method/Scala \ No newline at end of file diff --git a/Lang/Scala/Strassens-algorithm b/Lang/Scala/Strassens-algorithm new file mode 120000 index 0000000000..075bfeb837 --- /dev/null +++ b/Lang/Scala/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Scala \ No newline at end of file diff --git a/Lang/Scala/Sum-of-elements-below-main-diagonal-of-matrix b/Lang/Scala/Sum-of-elements-below-main-diagonal-of-matrix new file mode 120000 index 0000000000..b5a437f612 --- /dev/null +++ b/Lang/Scala/Sum-of-elements-below-main-diagonal-of-matrix @@ -0,0 +1 @@ +../../Task/Sum-of-elements-below-main-diagonal-of-matrix/Scala \ No newline at end of file diff --git a/Lang/Scala/Tau-function b/Lang/Scala/Tau-function new file mode 120000 index 0000000000..15084d09c1 --- /dev/null +++ b/Lang/Scala/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/Scala \ No newline at end of file diff --git a/Lang/Scala/Tonelli-Shanks-algorithm b/Lang/Scala/Tonelli-Shanks-algorithm new file mode 120000 index 0000000000..a29f0a9b6f --- /dev/null +++ b/Lang/Scala/Tonelli-Shanks-algorithm @@ -0,0 +1 @@ +../../Task/Tonelli-Shanks-algorithm/Scala \ No newline at end of file diff --git a/Lang/Scala/UPC b/Lang/Scala/UPC new file mode 120000 index 0000000000..bc3faec2ef --- /dev/null +++ b/Lang/Scala/UPC @@ -0,0 +1 @@ +../../Task/UPC/Scala \ No newline at end of file diff --git a/Lang/Scala/Yellowstone-sequence b/Lang/Scala/Yellowstone-sequence new file mode 120000 index 0000000000..2a1f4217a6 --- /dev/null +++ b/Lang/Scala/Yellowstone-sequence @@ -0,0 +1 @@ +../../Task/Yellowstone-sequence/Scala \ No newline at end of file diff --git a/Lang/Scheme/Cantor-set b/Lang/Scheme/Cantor-set new file mode 120000 index 0000000000..a799296687 --- /dev/null +++ b/Lang/Scheme/Cantor-set @@ -0,0 +1 @@ +../../Task/Cantor-set/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Cholesky-decomposition b/Lang/Scheme/Cholesky-decomposition new file mode 120000 index 0000000000..ade9e83803 --- /dev/null +++ b/Lang/Scheme/Cholesky-decomposition @@ -0,0 +1 @@ +../../Task/Cholesky-decomposition/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Circular-primes b/Lang/Scheme/Circular-primes new file mode 120000 index 0000000000..9f4430f520 --- /dev/null +++ b/Lang/Scheme/Circular-primes @@ -0,0 +1 @@ +../../Task/Circular-primes/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Compare-length-of-two-strings b/Lang/Scheme/Compare-length-of-two-strings new file mode 120000 index 0000000000..d6e6006fa7 --- /dev/null +++ b/Lang/Scheme/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Conjugate-transpose b/Lang/Scheme/Conjugate-transpose new file mode 120000 index 0000000000..ef50892884 --- /dev/null +++ b/Lang/Scheme/Conjugate-transpose @@ -0,0 +1 @@ +../../Task/Conjugate-transpose/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Egyptian-division b/Lang/Scheme/Egyptian-division new file mode 120000 index 0000000000..ca3a36ae83 --- /dev/null +++ b/Lang/Scheme/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Empty-program b/Lang/Scheme/Empty-program deleted file mode 120000 index ee1ee662be..0000000000 --- a/Lang/Scheme/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Find-the-missing-permutation b/Lang/Scheme/Find-the-missing-permutation new file mode 120000 index 0000000000..8f7e82d271 --- /dev/null +++ b/Lang/Scheme/Find-the-missing-permutation @@ -0,0 +1 @@ +../../Task/Find-the-missing-permutation/Scheme \ No newline at end of file diff --git a/Lang/Scheme/French-Republican-calendar b/Lang/Scheme/French-Republican-calendar new file mode 120000 index 0000000000..f19a245ee9 --- /dev/null +++ b/Lang/Scheme/French-Republican-calendar @@ -0,0 +1 @@ +../../Task/French-Republican-calendar/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Kronecker-product b/Lang/Scheme/Kronecker-product new file mode 120000 index 0000000000..58539a69b9 --- /dev/null +++ b/Lang/Scheme/Kronecker-product @@ -0,0 +1 @@ +../../Task/Kronecker-product/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Kronecker-product-based-fractals b/Lang/Scheme/Kronecker-product-based-fractals new file mode 120000 index 0000000000..c27228f2e0 --- /dev/null +++ b/Lang/Scheme/Kronecker-product-based-fractals @@ -0,0 +1 @@ +../../Task/Kronecker-product-based-fractals/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Last-letter-first-letter b/Lang/Scheme/Last-letter-first-letter new file mode 120000 index 0000000000..a5c5c31b6e --- /dev/null +++ b/Lang/Scheme/Last-letter-first-letter @@ -0,0 +1 @@ +../../Task/Last-letter-first-letter/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Machine-code b/Lang/Scheme/Machine-code new file mode 120000 index 0000000000..50965fe8eb --- /dev/null +++ b/Lang/Scheme/Machine-code @@ -0,0 +1 @@ +../../Task/Machine-code/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Miller-Rabin-primality-test b/Lang/Scheme/Miller-Rabin-primality-test deleted file mode 120000 index 644cc32269..0000000000 --- a/Lang/Scheme/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Own-digits-power-sum b/Lang/Scheme/Own-digits-power-sum new file mode 120000 index 0000000000..0897a09d02 --- /dev/null +++ b/Lang/Scheme/Own-digits-power-sum @@ -0,0 +1 @@ +../../Task/Own-digits-power-sum/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Pick-random-element b/Lang/Scheme/Pick-random-element new file mode 120000 index 0000000000..5745ea287d --- /dev/null +++ b/Lang/Scheme/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Pseudo-random-numbers-Splitmix64 b/Lang/Scheme/Pseudo-random-numbers-Splitmix64 new file mode 120000 index 0000000000..730c9170c9 --- /dev/null +++ b/Lang/Scheme/Pseudo-random-numbers-Splitmix64 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Splitmix64/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Runge-Kutta-method b/Lang/Scheme/Runge-Kutta-method new file mode 120000 index 0000000000..55b6f782a6 --- /dev/null +++ b/Lang/Scheme/Runge-Kutta-method @@ -0,0 +1 @@ +../../Task/Runge-Kutta-method/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Sierpinski-triangle-Graphical b/Lang/Scheme/Sierpinski-triangle-Graphical new file mode 120000 index 0000000000..13f8e60559 --- /dev/null +++ b/Lang/Scheme/Sierpinski-triangle-Graphical @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle-Graphical/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Tau-number b/Lang/Scheme/Tau-number new file mode 120000 index 0000000000..fe45f01d25 --- /dev/null +++ b/Lang/Scheme/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Unicode-variable-names b/Lang/Scheme/Unicode-variable-names new file mode 120000 index 0000000000..e5f49b3fae --- /dev/null +++ b/Lang/Scheme/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Word-frequency b/Lang/Scheme/Word-frequency new file mode 120000 index 0000000000..109edef2da --- /dev/null +++ b/Lang/Scheme/Word-frequency @@ -0,0 +1 @@ +../../Task/Word-frequency/Scheme \ No newline at end of file diff --git a/Lang/Scilab/Empty-program b/Lang/Scilab/Empty-program deleted file mode 120000 index 0cb8f21cc3..0000000000 --- a/Lang/Scilab/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Scilab \ No newline at end of file diff --git a/Lang/Sed/00-LANG.txt b/Lang/Sed/00-LANG.txt index 23390cea6c..5d2641e2db 100644 --- a/Lang/Sed/00-LANG.txt +++ b/Lang/Sed/00-LANG.txt @@ -6,5 +6,7 @@ a non interactive tool for text manipulation and filtering. One implementation is [[GNU Sed]] +See [[Tasks not implemented in sed]] + [[Category:Editor]] [[Category:Utility]] \ No newline at end of file diff --git a/Lang/Seed7/Miller-Rabin-primality-test b/Lang/Seed7/Miller-Rabin-primality-test deleted file mode 120000 index 298c8872f9..0000000000 --- a/Lang/Seed7/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Seed7 \ No newline at end of file diff --git a/Lang/Seed7/Quaternion-type b/Lang/Seed7/Quaternion-type deleted file mode 120000 index d621b24ce0..0000000000 --- a/Lang/Seed7/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Seed7 \ No newline at end of file diff --git a/Lang/SequenceL/00-LANG.txt b/Lang/SequenceL/00-LANG.txt index 3c3098bf74..5e5a95101f 100644 --- a/Lang/SequenceL/00-LANG.txt +++ b/Lang/SequenceL/00-LANG.txt @@ -3,7 +3,7 @@ |strength=strong |safety=safe |checking=static -|site=http://sequencel.com +|site= |tags=sequencel |hopl=no}} {{language programming paradigm|Declarative}} diff --git a/Lang/Set-lang/Empty-program b/Lang/Set-lang/Empty-program deleted file mode 120000 index e6f84e5a85..0000000000 --- a/Lang/Set-lang/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Set-lang \ No newline at end of file diff --git a/Lang/SheerPower-4GL/00-LANG.txt b/Lang/SheerPower-4GL/00-LANG.txt index bd4b7049ad..fc11170935 100644 --- a/Lang/SheerPower-4GL/00-LANG.txt +++ b/Lang/SheerPower-4GL/00-LANG.txt @@ -1,6 +1,6 @@ {{stub}} {{language -|site=http://www.sp4gl.com/ +|site=https://sheerpower.ttinet.com/index.html/ }} SheerPower 4GL is a Fourth-generation programming language developed by Touch Technologies, Inc. @@ -16,4 +16,7 @@ SheerPower 4GL has several key features: #There is also a Common Gateway Interface (CGI) interface built into SheerPower, along with many other built-in functions designed for high-performance and increased programmer productivity. == See Also == -[[wp:SheerPower4GL|Wikipedia:SheerPower4GL]] \ No newline at end of file +[[wp:SheerPower4GL|Wikipedia:SheerPower4GL]] + +==Todo== +[[Tasks_not_implemented_in_SheerPower_4GL]] \ No newline at end of file diff --git a/Lang/SheerPower-4GL/99-bottles-of-beer b/Lang/SheerPower-4GL/99-bottles-of-beer new file mode 120000 index 0000000000..71e6136936 --- /dev/null +++ b/Lang/SheerPower-4GL/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/SheerPower-4GL \ No newline at end of file diff --git a/Lang/SheerPower-4GL/Caesar-cipher b/Lang/SheerPower-4GL/Caesar-cipher new file mode 120000 index 0000000000..b9d2a1d1d1 --- /dev/null +++ b/Lang/SheerPower-4GL/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/SheerPower-4GL \ No newline at end of file diff --git a/Lang/SheerPower-4GL/FizzBuzz b/Lang/SheerPower-4GL/FizzBuzz new file mode 120000 index 0000000000..339e329e2c --- /dev/null +++ b/Lang/SheerPower-4GL/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/SheerPower-4GL \ No newline at end of file diff --git a/Lang/SheerPower-4GL/Towers-of-Hanoi b/Lang/SheerPower-4GL/Towers-of-Hanoi new file mode 120000 index 0000000000..a6bc7f6597 --- /dev/null +++ b/Lang/SheerPower-4GL/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/SheerPower-4GL \ No newline at end of file diff --git a/Lang/Sidef/00-LANG.txt b/Lang/Sidef/00-LANG.txt index a63ddf8a52..03c8af9ab7 100644 --- a/Lang/Sidef/00-LANG.txt +++ b/Lang/Sidef/00-LANG.txt @@ -18,14 +18,11 @@ [https://tio.run/#sidef Try Sidef on tio.run] {{infobox_end}} -Sidef is a modern, dynamic, object-oriented programming language, focusing on simplicity, readability and elegance, taking the best from languages like [[derived from::Ruby]], [[derived from::Go]], [[derived from::Raku]] and [[derived from::Julia]]. +Sidef is a modern, expressive programming language that combines the elegance of [[derived from::Ruby]], the versatility of [[derived from::Raku]], and the mathematical power of a built-in computer algebra system. The language is mostly used as a research programming language. -For more details, see: -* Gitbook: [https://trizen.gitbook.io/sidef-lang/ https://trizen.gitbook.io/sidef-lang/] -* Tutorial: [https://notabug.org/trizen/sidef/wiki https://notabug.org/trizen/sidef/wiki] -* Development page: [https://github.com/trizen/sidef https://github.com/trizen/sidef] +For more details, see: [https://github.com/trizen/sidef https://github.com/trizen/sidef] ==Todo== diff --git a/Lang/Sidef/Achilles-numbers b/Lang/Sidef/Achilles-numbers new file mode 120000 index 0000000000..19ed6a8115 --- /dev/null +++ b/Lang/Sidef/Achilles-numbers @@ -0,0 +1 @@ +../../Task/Achilles-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Arithmetic-derivative b/Lang/Sidef/Arithmetic-derivative new file mode 120000 index 0000000000..bdcd1874e7 --- /dev/null +++ b/Lang/Sidef/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Arithmetic-numbers b/Lang/Sidef/Arithmetic-numbers new file mode 120000 index 0000000000..672bca881d --- /dev/null +++ b/Lang/Sidef/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Binary-strings b/Lang/Sidef/Binary-strings new file mode 120000 index 0000000000..86bf141c80 --- /dev/null +++ b/Lang/Sidef/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Blum-integer b/Lang/Sidef/Blum-integer new file mode 120000 index 0000000000..9b35b73aa3 --- /dev/null +++ b/Lang/Sidef/Blum-integer @@ -0,0 +1 @@ +../../Task/Blum-integer/Sidef \ No newline at end of file diff --git a/Lang/Sidef/CRC-32 b/Lang/Sidef/CRC-32 new file mode 120000 index 0000000000..7abbf21ee3 --- /dev/null +++ b/Lang/Sidef/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Compare-sorting-algorithms-performance b/Lang/Sidef/Compare-sorting-algorithms-performance new file mode 120000 index 0000000000..d575bb9466 --- /dev/null +++ b/Lang/Sidef/Compare-sorting-algorithms-performance @@ -0,0 +1 @@ +../../Task/Compare-sorting-algorithms-performance/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Empty-program b/Lang/Sidef/Empty-program deleted file mode 120000 index c7465e3077..0000000000 --- a/Lang/Sidef/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Erd-s-Nicolas-numbers b/Lang/Sidef/Erd-s-Nicolas-numbers new file mode 120000 index 0000000000..d1d95c8581 --- /dev/null +++ b/Lang/Sidef/Erd-s-Nicolas-numbers @@ -0,0 +1 @@ +../../Task/Erd-s-Nicolas-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Giuga-numbers b/Lang/Sidef/Giuga-numbers new file mode 120000 index 0000000000..23d148c386 --- /dev/null +++ b/Lang/Sidef/Giuga-numbers @@ -0,0 +1 @@ +../../Task/Giuga-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Golden-ratio-Convergence b/Lang/Sidef/Golden-ratio-Convergence new file mode 120000 index 0000000000..18e029dadb --- /dev/null +++ b/Lang/Sidef/Golden-ratio-Convergence @@ -0,0 +1 @@ +../../Task/Golden-ratio-Convergence/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Increasing-gaps-between-consecutive-Niven-numbers b/Lang/Sidef/Increasing-gaps-between-consecutive-Niven-numbers new file mode 120000 index 0000000000..b80a20c4f5 --- /dev/null +++ b/Lang/Sidef/Increasing-gaps-between-consecutive-Niven-numbers @@ -0,0 +1 @@ +../../Task/Increasing-gaps-between-consecutive-Niven-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Jaro-Winkler-distance b/Lang/Sidef/Jaro-Winkler-distance new file mode 120000 index 0000000000..48f92f7ccd --- /dev/null +++ b/Lang/Sidef/Jaro-Winkler-distance @@ -0,0 +1 @@ +../../Task/Jaro-Winkler-distance/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Jordan-P-lya-numbers b/Lang/Sidef/Jordan-P-lya-numbers new file mode 120000 index 0000000000..b084543da1 --- /dev/null +++ b/Lang/Sidef/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Largest-proper-divisor-of-n b/Lang/Sidef/Largest-proper-divisor-of-n new file mode 120000 index 0000000000..7e30bcdac2 --- /dev/null +++ b/Lang/Sidef/Largest-proper-divisor-of-n @@ -0,0 +1 @@ +../../Task/Largest-proper-divisor-of-n/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Miller-Rabin-primality-test b/Lang/Sidef/Miller-Rabin-primality-test deleted file mode 120000 index 5bb5523a0e..0000000000 --- a/Lang/Sidef/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors b/Lang/Sidef/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors new file mode 120000 index 0000000000..101dabd3f3 --- /dev/null +++ b/Lang/Sidef/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors @@ -0,0 +1 @@ +../../Task/Numbers-which-are-the-cube-roots-of-the-product-of-their-proper-divisors/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Pell-numbers b/Lang/Sidef/Pell-numbers new file mode 120000 index 0000000000..af14680327 --- /dev/null +++ b/Lang/Sidef/Pell-numbers @@ -0,0 +1 @@ +../../Task/Pell-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Prime-numbers-whose-neighboring-pairs-are-tetraprimes b/Lang/Sidef/Prime-numbers-whose-neighboring-pairs-are-tetraprimes new file mode 120000 index 0000000000..1f840ef9e4 --- /dev/null +++ b/Lang/Sidef/Prime-numbers-whose-neighboring-pairs-are-tetraprimes @@ -0,0 +1 @@ +../../Task/Prime-numbers-whose-neighboring-pairs-are-tetraprimes/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Quaternion-type b/Lang/Sidef/Quaternion-type deleted file mode 120000 index 5e28a5e41d..0000000000 --- a/Lang/Sidef/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Radical-of-an-integer b/Lang/Sidef/Radical-of-an-integer new file mode 120000 index 0000000000..f3a2787e3f --- /dev/null +++ b/Lang/Sidef/Radical-of-an-integer @@ -0,0 +1 @@ +../../Task/Radical-of-an-integer/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Smarandache-Wellin-primes b/Lang/Sidef/Smarandache-Wellin-primes new file mode 120000 index 0000000000..056e5bc295 --- /dev/null +++ b/Lang/Sidef/Smarandache-Wellin-primes @@ -0,0 +1 @@ +../../Task/Smarandache-Wellin-primes/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sorting-Algorithms-Circle-Sort b/Lang/Sidef/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index e866329cad..0000000000 --- a/Lang/Sidef/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Sphenic-numbers b/Lang/Sidef/Sphenic-numbers new file mode 120000 index 0000000000..52f777ef9a --- /dev/null +++ b/Lang/Sidef/Sphenic-numbers @@ -0,0 +1 @@ +../../Task/Sphenic-numbers/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Square-form-factorization b/Lang/Sidef/Square-form-factorization new file mode 120000 index 0000000000..07ff6377fc --- /dev/null +++ b/Lang/Sidef/Square-form-factorization @@ -0,0 +1 @@ +../../Task/Square-form-factorization/Sidef \ No newline at end of file diff --git a/Lang/Sidef/Wagstaff-primes b/Lang/Sidef/Wagstaff-primes new file mode 120000 index 0000000000..d0053cfbed --- /dev/null +++ b/Lang/Sidef/Wagstaff-primes @@ -0,0 +1 @@ +../../Task/Wagstaff-primes/Sidef \ No newline at end of file diff --git a/Lang/SimpleCode/Empty-program b/Lang/SimpleCode/Empty-program deleted file mode 120000 index dc55c70d09..0000000000 --- a/Lang/SimpleCode/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/SimpleCode \ No newline at end of file diff --git a/Lang/Slate/Empty-program b/Lang/Slate/Empty-program deleted file mode 120000 index cea8e90b74..0000000000 --- a/Lang/Slate/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Slate \ No newline at end of file diff --git a/Lang/Smalltalk/FASTA-format b/Lang/Smalltalk/FASTA-format new file mode 120000 index 0000000000..083740df9e --- /dev/null +++ b/Lang/Smalltalk/FASTA-format @@ -0,0 +1 @@ +../../Task/FASTA-format/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Miller-Rabin-primality-test b/Lang/Smalltalk/Miller-Rabin-primality-test deleted file mode 120000 index e3a303744d..0000000000 --- a/Lang/Smalltalk/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Smalltalk \ No newline at end of file diff --git a/Lang/SmileBASIC/Execute-Brain- b/Lang/SmileBASIC/Execute-Brain- new file mode 120000 index 0000000000..f5b6561ddd --- /dev/null +++ b/Lang/SmileBASIC/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/SmileBASIC \ No newline at end of file diff --git a/Lang/Sparkling/Empty-program b/Lang/Sparkling/Empty-program deleted file mode 120000 index 519287810d..0000000000 --- a/Lang/Sparkling/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Sparkling \ No newline at end of file diff --git a/Lang/Standard-ML/Averages-Mean-angle b/Lang/Standard-ML/Averages-Mean-angle new file mode 120000 index 0000000000..38ef0bd393 --- /dev/null +++ b/Lang/Standard-ML/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/Averages-Simple-moving-average b/Lang/Standard-ML/Averages-Simple-moving-average new file mode 120000 index 0000000000..6dd59a5e2f --- /dev/null +++ b/Lang/Standard-ML/Averages-Simple-moving-average @@ -0,0 +1 @@ +../../Task/Averages-Simple-moving-average/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/Box-the-compass b/Lang/Standard-ML/Box-the-compass new file mode 120000 index 0000000000..bdb5283192 --- /dev/null +++ b/Lang/Standard-ML/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/Call-a-foreign-language-function b/Lang/Standard-ML/Call-a-foreign-language-function new file mode 120000 index 0000000000..1f398efa97 --- /dev/null +++ b/Lang/Standard-ML/Call-a-foreign-language-function @@ -0,0 +1 @@ +../../Task/Call-a-foreign-language-function/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/Evaluate-binomial-coefficients b/Lang/Standard-ML/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..c57e6c6558 --- /dev/null +++ b/Lang/Standard-ML/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/Extreme-floating-point-values b/Lang/Standard-ML/Extreme-floating-point-values new file mode 120000 index 0000000000..9f4669042a --- /dev/null +++ b/Lang/Standard-ML/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/Knuth-shuffle b/Lang/Standard-ML/Knuth-shuffle new file mode 120000 index 0000000000..da7fa35b79 --- /dev/null +++ b/Lang/Standard-ML/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/Last-Friday-of-each-month b/Lang/Standard-ML/Last-Friday-of-each-month new file mode 120000 index 0000000000..39c2756109 --- /dev/null +++ b/Lang/Standard-ML/Last-Friday-of-each-month @@ -0,0 +1 @@ +../../Task/Last-Friday-of-each-month/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/Miller-Rabin-primality-test b/Lang/Standard-ML/Miller-Rabin-primality-test deleted file mode 120000 index ba4b002043..0000000000 --- a/Lang/Standard-ML/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/Permutations b/Lang/Standard-ML/Permutations new file mode 120000 index 0000000000..420c42539e --- /dev/null +++ b/Lang/Standard-ML/Permutations @@ -0,0 +1 @@ +../../Task/Permutations/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/Pi b/Lang/Standard-ML/Pi new file mode 120000 index 0000000000..f806ddbcae --- /dev/null +++ b/Lang/Standard-ML/Pi @@ -0,0 +1 @@ +../../Task/Pi/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/Pseudo-random-numbers-Splitmix64 b/Lang/Standard-ML/Pseudo-random-numbers-Splitmix64 new file mode 120000 index 0000000000..bce7d31edd --- /dev/null +++ b/Lang/Standard-ML/Pseudo-random-numbers-Splitmix64 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Splitmix64/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/Read-a-file-line-by-line b/Lang/Standard-ML/Read-a-file-line-by-line new file mode 120000 index 0000000000..416573675c --- /dev/null +++ b/Lang/Standard-ML/Read-a-file-line-by-line @@ -0,0 +1 @@ +../../Task/Read-a-file-line-by-line/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/Sorting-algorithms-Bubble-sort b/Lang/Standard-ML/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..6b18730684 --- /dev/null +++ b/Lang/Standard-ML/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/Standard-ML \ No newline at end of file diff --git a/Lang/Standard-ML/URL-encoding b/Lang/Standard-ML/URL-encoding new file mode 120000 index 0000000000..f4e1b1b4e1 --- /dev/null +++ b/Lang/Standard-ML/URL-encoding @@ -0,0 +1 @@ +../../Task/URL-encoding/Standard-ML \ No newline at end of file diff --git a/Lang/Stax/00-LANG.txt b/Lang/Stax/00-LANG.txt index daeb2cc2d2..9436dc0940 100644 --- a/Lang/Stax/00-LANG.txt +++ b/Lang/Stax/00-LANG.txt @@ -1 +1,2 @@ -{{stub}}{{language|Stax}} \ No newline at end of file +[https://github.com/tomtheisen/stax Github] +{{language|site=https://staxlang.xyz/}} \ No newline at end of file diff --git a/Lang/Stringle/00-LANG.txt b/Lang/Stringle/00-LANG.txt new file mode 100644 index 0000000000..073e2be961 --- /dev/null +++ b/Lang/Stringle/00-LANG.txt @@ -0,0 +1,28 @@ +{{language|Stringle +|exec=interpreted +|gc=no +|parampass=both +|untyped=yes +}} + +'''Stringle''' is a simple imperative scripting language based around the manipulation of string variables created by Vacek Nules. Its name is a portmanteau of ''string'' and ''wrangle'', being a language to “wrangle strings”. It supports string assignment and concatenation, loops, conditionals with different ''predicates'' and overloaded, composable functions called ''string operators''. + +It has a concise, J-like syntax with single-character operator symbols instead of keywords. Operators are evaluated over strings as functions and are freely composable in arbitrary chains, but some of them can be assigned to as well to modify the string in their argument in various ways. + +[[File:Stringle Cheat Sheet.png|thumb]] + +Stringle has an extremely simple and basic syntax with only a few primitive operators, easily learnt in just a few hours, yet contains highly powerful ways to amplify and combine the building-block operations, like overloaded operators, function pointers and on-demand creation of extensive function chains. + +For a quick example how Stringle looks like, this line of code: + + b %.\c #c #:c + +could be expanded to the following: + + '''if''' b ''contain head reverse'' c '''then set''' ''curtail'' c '''to''' ''length tail'' c + +that is, “delete the last character of c if it occurs in the string b”. + +It is ideal as a replacement for ''sed'' or ''awk'' for creating and running text processing scripts and filters, or could also be used as the built-in macro language in larger applications. + +The complete specification of Stringle can be consulted [https://esolangs.org/wiki/Stringle here]. \ No newline at end of file diff --git a/Lang/Stringle/00-META.yaml b/Lang/Stringle/00-META.yaml new file mode 100644 index 0000000000..2f4df5814d --- /dev/null +++ b/Lang/Stringle/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Stringle diff --git a/Lang/Stringle/100-doors b/Lang/Stringle/100-doors new file mode 120000 index 0000000000..e9007112a9 --- /dev/null +++ b/Lang/Stringle/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Stringle \ No newline at end of file diff --git a/Lang/Stringle/Nth b/Lang/Stringle/Nth new file mode 120000 index 0000000000..de68672f39 --- /dev/null +++ b/Lang/Stringle/Nth @@ -0,0 +1 @@ +../../Task/Nth/Stringle \ No newline at end of file diff --git a/Lang/Stringle/Reverse-a-string b/Lang/Stringle/Reverse-a-string new file mode 120000 index 0000000000..d32056aac0 --- /dev/null +++ b/Lang/Stringle/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/Stringle \ No newline at end of file diff --git a/Lang/Stringle/Rot-13 b/Lang/Stringle/Rot-13 new file mode 120000 index 0000000000..415d6b9707 --- /dev/null +++ b/Lang/Stringle/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Stringle \ No newline at end of file diff --git a/Lang/Stringle/String-length b/Lang/Stringle/String-length new file mode 120000 index 0000000000..de0a7e0e10 --- /dev/null +++ b/Lang/Stringle/String-length @@ -0,0 +1 @@ +../../Task/String-length/Stringle \ No newline at end of file diff --git a/Lang/Stringle/Strip-a-set-of-characters-from-a-string b/Lang/Stringle/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..25f1da4301 --- /dev/null +++ b/Lang/Stringle/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Stringle \ No newline at end of file diff --git a/Lang/SuperCollider/00-LANG.txt b/Lang/SuperCollider/00-LANG.txt index f804a4a144..d6b538fcd2 100644 --- a/Lang/SuperCollider/00-LANG.txt +++ b/Lang/SuperCollider/00-LANG.txt @@ -9,4 +9,130 @@ The programming language was originally devised by James McCartney and has been [https://github.com/supercollider/supercollider SuperCollider at GitHub] -[http://supercollider.github.io/ SuperCollider Homepage] \ No newline at end of file +[http://supercollider.github.io/ SuperCollider Homepage] + + +

    +Some additional notes on SuperCollider 2024-06-21 + +From the SuperCollider GitHub website: https://supercollider.github.io/ :
    +Quote:
    +A PLATFORM FOR AUDIO SYNTHESIS AND ALGORITHMIC COMPOSITION,
    +      USED BY MUSICIANS, ARTISTS AND RESEARCHERS WORKING WITH SOUND. +

    +FREE AND OPEN SOURCE SOFTWARE FOR WINDOWS, MACOS AND LINUX. +

    +SuperCollider features three major components:
    +scsynth – A real-time audio server
    +sclang – An interpreted programming language
    +scide – An editor for sclang with an integrated help system
    +End-Quote.
    +
    +Some people try to squeeze a musical composition into 140 characters: (but just for the challenge):
    +Don't judge SuperCollider or the language by these examples, they are just for fun.
    + +f={|t|Pbind(\note,Pseq([-1,1,6,8,9,1,-1,8,6,1,9,8]+5,319),\dur,t)};Ptpar([0,f.(1/6),12,f.(0.1672)],1).play + +Listen to the results here: https://supercollider.github.io/assets/audio/sc-140/06_batuhanbozkurt_celesteh.mp3
    +You can see/hear more at: https://supercollider.github.io/sc-140.html
    +
    +
    +As of today (2024-06-21) the current version of SuperCollider for all supported platforms is: 3.13.0 +

    +While SClang (SuperCollider language) and its companion components are designed for the creation of sounds and music, the language is a full featured programming language. +

    +The language is OO, to the extent that everything is an object, even numbers.
    +In this snippet: 123 + 456 the 123 is an object, + is a method on the class of that object, and 456 is a parameter to that method.
    +Even though + is a method the syntax of the addition is what you would typically expect. +

    +The print function in SClang is a method called postln, which first appears in the root of the class tree: Object.
    +
    +Some examples, showing two possible call formats: + +postln("Hello World"); // prints: Hello World +"Hello World".postln; // prints: Hello World +postln(1001); // prints: 1001 +1001.postln; // prints: 1001 +postln(123 + 456); // prints: 579 +(123 + 456).postln; // prints: 579 + + +The method postln, adds a new-line after printing the text, if you don't want the new-line, use: post. +

    + +SuperCollider from the command line (not used much) + +SuperCollider scripts are stored in files with an extension of .scd. +These are typically referred to as supercollider documents, hence .scd. +

    +99.99% of the time, you will execute code from within the IDE (scide).
    +
    +It is possible but not typical, to run a script from the command line, for example:
    + > sclang.exe ABC_problem.scd
    +This will output the expected results. +See code at: https://rosettacode.org/wiki/ABC_problem#SuperCollider

    +However, before executing your code, sclang will compile its class library, and you will see all of the messages about the compilation, before you see the output from your code. +

    +Also, once your code is finished, you will be stuck as sclang is still waiting for more input from a file, not the keyboard. The second problem can be solved by adding exit(0); to the end of your script (.scd file); +

    +SuperCollider comes packaged with QT, and has classes that represent GUI objects, for example:
    + > sclang.exe Barnsley_fern.scd
    +Will open a window and draw the Barnsley Fern.
    +See code at: https://rosettacode.org/wiki/Barnsley_fern#SuperCollider
    +You will have to use Ctrl-c to kill the sclang process, you cannot add exit(0) to you script as the exit would happen before the GUI was fully created. +

    +It is theoretically possible to create a thread within your script which waits until all work is done and then for it to execute exit(0); but you are just giving yourself extra work. +

    +You can also run sclang without giving it a file, then it will accept input from the keyboard. + > sclang.exe
    +You will get this prompt sc3> now you can type in ONE LINE OF CODE. +For example, the following line of code has three statements, the end result is printing the sum of the two numbers:
    +sc3> var v1=123; var v2=456; postf("v1+v2=%\n", v1+v2);
    +v1+v2=579
    +-> v1+v2=579
    +
    +The line with the arrow: -> v1+v2=579, is sclang printing the value of the last expression executed +

    +Summary: You can start sclang from the command line and type in some code, or you could give sclang a script to run, both will work, but it is much more productive to use scide. +Using sclang from the command line is like playing your guitar with winter gloves on, you could do it, but why make life difficult? +

    +If you have composed (written code for) a long piece of music, and now you want to execute the code from the command line, yes, you can do it, but it isn't going to sound any different than it would if you execute the code from within scide.

    +Also, scide offers the ability to 'live code', i.e. execute some code to make some music, and change the code as the music is playing, so the music evolves as you change the code. +

    + +SuperCollider from the IDE
    +Start scide, or 'open' a SuperCollider Document (*.scd), if scide is 'associated' with that file type.
    +See: https://doc.sccode.org/Guides/SCIde.html
    +After you start scide, it starts sclang, which compiles the SuperCollider classes.
    +Now you can start coding.
    +
    +How to execute code (borrowed from the page at the URL above)
    +
    +To evaluate code, use one of the following keyboard commands:
    +Ctrl+Return
    +Most used, "smart" code evaluation:
    +Normally, the current line will be evaluated (where the cursor is).
    +If the cursor is within a region, the entire region will be evaluated. See below for explanation of regions.
    +If some code is selected, the selection will be evaluated.
    +
    +Shift+Return +

    +Evaluates either the current line, or the selection (if any). Use this to evaluate a single line within a region without the need to select it.
    +Regions make it quick and easy to evaluate larger portions of code. A region is surrounded by parentheses; to be interpreted as a region, the parenthesis must each be the only character on a line.
    + +( +Pbind( + \degree, Pseries(0, 1, 8), + \dur, 0.25 +).play; +) + +If the cursor is anywhere between the outermost parentheses, pressing Ctrl+Return will automatically evaluate the entire contents within the parentheses, starting with Pbind and ending with play;.
    +

    +To quickly evaluate a portion of code, you can also double-click on any bracket (round, squared, or curly), which will select everything between this and the other matching bracket, so you can quickly evaluate it. +

    +To stop any running code, use the Ctrl+. shortcut (Ctrl+Period).
    +This will stop all the code scheduled on the clocks, as well as all the sound processes on the audio server. +

    + +... more coming soon ... \ No newline at end of file diff --git a/Lang/SuperCollider/Averages-Pythagorean-means b/Lang/SuperCollider/Averages-Pythagorean-means new file mode 120000 index 0000000000..9ee9ff6fef --- /dev/null +++ b/Lang/SuperCollider/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/SuperCollider \ No newline at end of file diff --git a/Lang/SuperCollider/Catalan-numbers b/Lang/SuperCollider/Catalan-numbers new file mode 120000 index 0000000000..3ee9240cf0 --- /dev/null +++ b/Lang/SuperCollider/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/SuperCollider \ No newline at end of file diff --git a/Lang/SuperCollider/Golden-ratio-Convergence b/Lang/SuperCollider/Golden-ratio-Convergence new file mode 120000 index 0000000000..77807cac46 --- /dev/null +++ b/Lang/SuperCollider/Golden-ratio-Convergence @@ -0,0 +1 @@ +../../Task/Golden-ratio-Convergence/SuperCollider \ No newline at end of file diff --git a/Lang/SuperCollider/Iterated-digits-squaring b/Lang/SuperCollider/Iterated-digits-squaring new file mode 120000 index 0000000000..197266fc01 --- /dev/null +++ b/Lang/SuperCollider/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/SuperCollider \ No newline at end of file diff --git a/Lang/SuperCollider/Multiplication-tables b/Lang/SuperCollider/Multiplication-tables new file mode 120000 index 0000000000..f5418ea2b2 --- /dev/null +++ b/Lang/SuperCollider/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/SuperCollider \ No newline at end of file diff --git a/Lang/SuperCollider/Semordnilap b/Lang/SuperCollider/Semordnilap deleted file mode 120000 index ace051dba8..0000000000 --- a/Lang/SuperCollider/Semordnilap +++ /dev/null @@ -1 +0,0 @@ -../../Task/Semordnilap/SuperCollider \ No newline at end of file diff --git a/Lang/SuperCollider/Vampire-number b/Lang/SuperCollider/Vampire-number new file mode 120000 index 0000000000..96124ca653 --- /dev/null +++ b/Lang/SuperCollider/Vampire-number @@ -0,0 +1 @@ +../../Task/Vampire-number/SuperCollider \ No newline at end of file diff --git a/Lang/Swift/AVL-tree b/Lang/Swift/AVL-tree new file mode 120000 index 0000000000..ff46aae38e --- /dev/null +++ b/Lang/Swift/AVL-tree @@ -0,0 +1 @@ +../../Task/AVL-tree/Swift \ No newline at end of file diff --git a/Lang/Swift/Abstract-type b/Lang/Swift/Abstract-type new file mode 120000 index 0000000000..06a9f03e30 --- /dev/null +++ b/Lang/Swift/Abstract-type @@ -0,0 +1 @@ +../../Task/Abstract-type/Swift \ No newline at end of file diff --git a/Lang/Swift/Append-a-record-to-the-end-of-a-text-file b/Lang/Swift/Append-a-record-to-the-end-of-a-text-file new file mode 120000 index 0000000000..fd0f9e7cef --- /dev/null +++ b/Lang/Swift/Append-a-record-to-the-end-of-a-text-file @@ -0,0 +1 @@ +../../Task/Append-a-record-to-the-end-of-a-text-file/Swift \ No newline at end of file diff --git a/Lang/Swift/Averages-Median b/Lang/Swift/Averages-Median new file mode 120000 index 0000000000..697fb8b0a6 --- /dev/null +++ b/Lang/Swift/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/Swift \ No newline at end of file diff --git a/Lang/Swift/Averages-Pythagorean-means b/Lang/Swift/Averages-Pythagorean-means new file mode 120000 index 0000000000..028a483c28 --- /dev/null +++ b/Lang/Swift/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/Swift \ No newline at end of file diff --git a/Lang/Swift/Base64-decode-data b/Lang/Swift/Base64-decode-data new file mode 120000 index 0000000000..6d50fcf1a1 --- /dev/null +++ b/Lang/Swift/Base64-decode-data @@ -0,0 +1 @@ +../../Task/Base64-decode-data/Swift \ No newline at end of file diff --git a/Lang/Swift/Bioinformatics-base-count b/Lang/Swift/Bioinformatics-base-count deleted file mode 120000 index c497b7a9fe..0000000000 --- a/Lang/Swift/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Swift \ No newline at end of file diff --git a/Lang/Swift/Box-the-compass b/Lang/Swift/Box-the-compass new file mode 120000 index 0000000000..76167bcbd0 --- /dev/null +++ b/Lang/Swift/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/Swift \ No newline at end of file diff --git a/Lang/Swift/Boyer-Moore-string-search b/Lang/Swift/Boyer-Moore-string-search new file mode 120000 index 0000000000..d0d21c21e5 --- /dev/null +++ b/Lang/Swift/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/Swift \ No newline at end of file diff --git a/Lang/Swift/Canonicalize-CIDR b/Lang/Swift/Canonicalize-CIDR new file mode 120000 index 0000000000..a1566af70e --- /dev/null +++ b/Lang/Swift/Canonicalize-CIDR @@ -0,0 +1 @@ +../../Task/Canonicalize-CIDR/Swift \ No newline at end of file diff --git a/Lang/Swift/Chaocipher b/Lang/Swift/Chaocipher new file mode 120000 index 0000000000..6e9ab31392 --- /dev/null +++ b/Lang/Swift/Chaocipher @@ -0,0 +1 @@ +../../Task/Chaocipher/Swift \ No newline at end of file diff --git a/Lang/Swift/Check-output-device-is-a-terminal b/Lang/Swift/Check-output-device-is-a-terminal new file mode 120000 index 0000000000..cd3cd93d22 --- /dev/null +++ b/Lang/Swift/Check-output-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-output-device-is-a-terminal/Swift \ No newline at end of file diff --git a/Lang/Swift/Compare-length-of-two-strings b/Lang/Swift/Compare-length-of-two-strings new file mode 120000 index 0000000000..d53f307b7e --- /dev/null +++ b/Lang/Swift/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/Swift \ No newline at end of file diff --git a/Lang/Swift/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- b/Lang/Swift/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- new file mode 120000 index 0000000000..bfa2341e33 --- /dev/null +++ b/Lang/Swift/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n- @@ -0,0 +1 @@ +../../Task/Continued-fraction-Arithmetic-G-matrix-ng-continued-fraction-n-/Swift \ No newline at end of file diff --git a/Lang/Swift/De-Bruijn-sequences b/Lang/Swift/De-Bruijn-sequences new file mode 120000 index 0000000000..0fbdf1e9f8 --- /dev/null +++ b/Lang/Swift/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/Swift \ No newline at end of file diff --git a/Lang/Swift/Empty-program b/Lang/Swift/Empty-program deleted file mode 120000 index 2c1baaa481..0000000000 --- a/Lang/Swift/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Swift \ No newline at end of file diff --git a/Lang/Swift/Floyd-Warshall-algorithm b/Lang/Swift/Floyd-Warshall-algorithm new file mode 120000 index 0000000000..d1366dce22 --- /dev/null +++ b/Lang/Swift/Floyd-Warshall-algorithm @@ -0,0 +1 @@ +../../Task/Floyd-Warshall-algorithm/Swift \ No newline at end of file diff --git a/Lang/Swift/Jordan-P-lya-numbers b/Lang/Swift/Jordan-P-lya-numbers new file mode 120000 index 0000000000..df024964bb --- /dev/null +++ b/Lang/Swift/Jordan-P-lya-numbers @@ -0,0 +1 @@ +../../Task/Jordan-P-lya-numbers/Swift \ No newline at end of file diff --git a/Lang/Swift/K-d-tree b/Lang/Swift/K-d-tree new file mode 120000 index 0000000000..a4758e806b --- /dev/null +++ b/Lang/Swift/K-d-tree @@ -0,0 +1 @@ +../../Task/K-d-tree/Swift \ No newline at end of file diff --git a/Lang/Swift/M-bius-function b/Lang/Swift/M-bius-function new file mode 120000 index 0000000000..cd32d72e63 --- /dev/null +++ b/Lang/Swift/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/Swift \ No newline at end of file diff --git a/Lang/Swift/Miller-Rabin-primality-test b/Lang/Swift/Miller-Rabin-primality-test deleted file mode 120000 index 08a41b9961..0000000000 --- a/Lang/Swift/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Swift \ No newline at end of file diff --git a/Lang/Swift/Parse-an-IP-Address b/Lang/Swift/Parse-an-IP-Address new file mode 120000 index 0000000000..b157f3f9a2 --- /dev/null +++ b/Lang/Swift/Parse-an-IP-Address @@ -0,0 +1 @@ +../../Task/Parse-an-IP-Address/Swift \ No newline at end of file diff --git a/Lang/Swift/Pseudo-random-numbers-Splitmix64 b/Lang/Swift/Pseudo-random-numbers-Splitmix64 new file mode 120000 index 0000000000..7f3d66c35a --- /dev/null +++ b/Lang/Swift/Pseudo-random-numbers-Splitmix64 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Splitmix64/Swift \ No newline at end of file diff --git a/Lang/Swift/Quaternion-type b/Lang/Swift/Quaternion-type deleted file mode 120000 index d74f88c4be..0000000000 --- a/Lang/Swift/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Swift \ No newline at end of file diff --git a/Lang/Swift/Soloways-recurring-rainfall b/Lang/Swift/Soloways-recurring-rainfall new file mode 120000 index 0000000000..992f203897 --- /dev/null +++ b/Lang/Swift/Soloways-recurring-rainfall @@ -0,0 +1 @@ +../../Task/Soloways-recurring-rainfall/Swift \ No newline at end of file diff --git a/Lang/Swift/Sorting-Algorithms-Circle-Sort b/Lang/Swift/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 367310fdad..0000000000 --- a/Lang/Swift/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Swift \ No newline at end of file diff --git a/Lang/Swift/Tonelli-Shanks-algorithm b/Lang/Swift/Tonelli-Shanks-algorithm new file mode 120000 index 0000000000..9e28b1de2a --- /dev/null +++ b/Lang/Swift/Tonelli-Shanks-algorithm @@ -0,0 +1 @@ +../../Task/Tonelli-Shanks-algorithm/Swift \ No newline at end of file diff --git a/Lang/Swift/XML-Input b/Lang/Swift/XML-Input new file mode 120000 index 0000000000..d7c748b445 --- /dev/null +++ b/Lang/Swift/XML-Input @@ -0,0 +1 @@ +../../Task/XML-Input/Swift \ No newline at end of file diff --git a/Lang/Symsyn/Empty-program b/Lang/Symsyn/Empty-program deleted file mode 120000 index 73cbdf1eb6..0000000000 --- a/Lang/Symsyn/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Symsyn \ No newline at end of file diff --git a/Lang/TAV/00-LANG.txt b/Lang/TAV/00-LANG.txt new file mode 100644 index 0000000000..bb9d8890a2 --- /dev/null +++ b/Lang/TAV/00-LANG.txt @@ -0,0 +1,46 @@ +{{language|TAV +|site=https://tavpl.de +|untyped=yes +|exec=machine +|gc=no +|parampass=reference +|checking=dynamic +|safety=safe +}} +{{language programming paradigm|Procedural}} +{{CompileOnline}} + +'''TAV''' is the '''terse and verbose''' +language that borrows from [[Python]], Stage2, [[Genie]] and more. + +Its most outstanding feature is the use of templates for function calls instead of the +traditional function_name(parameter, parameter, ...) form. +Matched parenthesis are consequently rarely necessary. + +Summary of important points: + +* C precompiler, should work on any system with a reasonable C compiler +* Block structuring by indentation, like in Python; line oriented +* No keywords in the core language, only symbols (i.e. bigraphs) +* Variables are of any kind (type) dynamically; no declarations necessary +* Function definition and calls by word sequences with interspersed parameters, often no parenthesis needed +* Maps (dictionaries) with all kinds of keys (except floating-point numbers) +* Rows (arrays) if the keys are dense integers, dynamically expanding +* Arbitrary precision integer numbers +* Dynamic Unicode strings +* Fields for extra data in rows and maps +* Attributes for information about an item +* Fault items for reliable error handling +* Reference counting avoids unsolicited delays for garbage-collection +* Basic support for object-oriented programming (no inheritance) +* Discretionary type system specified, but not yet tested +* Publication syntax with common English keywords instead of symbols +* Bindings to SDL, Cairo and GTK (proof-of-concept level) + +Many examples can be run via copy and paste in the Playground. + +Because there are no keywords and rarely nested parenthesis (of any kind), +syntax highlighting is not used. + +==Links== +*[[https://tavpl.de/TAV-Online TAV Online Playground]] \ No newline at end of file diff --git a/Lang/TAV/00-META.yaml b/Lang/TAV/00-META.yaml new file mode 100644 index 0000000000..94650f22a2 --- /dev/null +++ b/Lang/TAV/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:TAV diff --git a/Lang/TAV/A+B b/Lang/TAV/A+B new file mode 120000 index 0000000000..a5e97665e3 --- /dev/null +++ b/Lang/TAV/A+B @@ -0,0 +1 @@ +../../Task/A+B/TAV \ No newline at end of file diff --git a/Lang/TAV/Ackermann-function b/Lang/TAV/Ackermann-function new file mode 120000 index 0000000000..237de07217 --- /dev/null +++ b/Lang/TAV/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/TAV \ No newline at end of file diff --git a/Lang/TAV/Anagrams b/Lang/TAV/Anagrams new file mode 120000 index 0000000000..335a62bd1c --- /dev/null +++ b/Lang/TAV/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/TAV \ No newline at end of file diff --git a/Lang/TAV/Arithmetic-Integer b/Lang/TAV/Arithmetic-Integer new file mode 120000 index 0000000000..b9d994e37f --- /dev/null +++ b/Lang/TAV/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/TAV \ No newline at end of file diff --git a/Lang/TAV/Array-concatenation b/Lang/TAV/Array-concatenation new file mode 120000 index 0000000000..a1b0d9260d --- /dev/null +++ b/Lang/TAV/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/TAV \ No newline at end of file diff --git a/Lang/TAV/Array-length b/Lang/TAV/Array-length new file mode 120000 index 0000000000..0d849f41e8 --- /dev/null +++ b/Lang/TAV/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/TAV \ No newline at end of file diff --git a/Lang/TAV/Ascending-primes b/Lang/TAV/Ascending-primes new file mode 120000 index 0000000000..b4add5cfb9 --- /dev/null +++ b/Lang/TAV/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/TAV \ No newline at end of file diff --git a/Lang/TAV/Associative-array-Iteration b/Lang/TAV/Associative-array-Iteration new file mode 120000 index 0000000000..48bdb805ad --- /dev/null +++ b/Lang/TAV/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/TAV \ No newline at end of file diff --git a/Lang/TAV/Averages-Root-mean-square b/Lang/TAV/Averages-Root-mean-square new file mode 120000 index 0000000000..75f73fbdb8 --- /dev/null +++ b/Lang/TAV/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/TAV \ No newline at end of file diff --git a/Lang/TAV/Babbage-problem b/Lang/TAV/Babbage-problem new file mode 120000 index 0000000000..141507242e --- /dev/null +++ b/Lang/TAV/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/TAV \ No newline at end of file diff --git a/Lang/TAV/Bernoulli-numbers b/Lang/TAV/Bernoulli-numbers new file mode 120000 index 0000000000..164f4e8e6c --- /dev/null +++ b/Lang/TAV/Bernoulli-numbers @@ -0,0 +1 @@ +../../Task/Bernoulli-numbers/TAV \ No newline at end of file diff --git a/Lang/TAV/Character-codes b/Lang/TAV/Character-codes new file mode 120000 index 0000000000..46e37f6e83 --- /dev/null +++ b/Lang/TAV/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/TAV \ No newline at end of file diff --git a/Lang/TAV/Command-line-arguments b/Lang/TAV/Command-line-arguments new file mode 120000 index 0000000000..72fc191937 --- /dev/null +++ b/Lang/TAV/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/TAV \ No newline at end of file diff --git a/Lang/TAV/Conditional-structures b/Lang/TAV/Conditional-structures new file mode 120000 index 0000000000..bf797da6e6 --- /dev/null +++ b/Lang/TAV/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/TAV \ No newline at end of file diff --git a/Lang/TAV/Convert-decimal-number-to-rational b/Lang/TAV/Convert-decimal-number-to-rational new file mode 120000 index 0000000000..c7b635149b --- /dev/null +++ b/Lang/TAV/Convert-decimal-number-to-rational @@ -0,0 +1 @@ +../../Task/Convert-decimal-number-to-rational/TAV \ No newline at end of file diff --git a/Lang/TAV/Copy-a-string b/Lang/TAV/Copy-a-string new file mode 120000 index 0000000000..3ca111af72 --- /dev/null +++ b/Lang/TAV/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/TAV \ No newline at end of file diff --git a/Lang/TAV/Create-a-two-dimensional-array-at-runtime b/Lang/TAV/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..ec0fae01dd --- /dev/null +++ b/Lang/TAV/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/TAV \ No newline at end of file diff --git a/Lang/TAV/Empty-string b/Lang/TAV/Empty-string new file mode 120000 index 0000000000..c001916e31 --- /dev/null +++ b/Lang/TAV/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/TAV \ No newline at end of file diff --git a/Lang/TAV/Factorial b/Lang/TAV/Factorial new file mode 120000 index 0000000000..005136367e --- /dev/null +++ b/Lang/TAV/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/TAV \ No newline at end of file diff --git a/Lang/TAV/Fibonacci-sequence b/Lang/TAV/Fibonacci-sequence new file mode 120000 index 0000000000..e65f13e72b --- /dev/null +++ b/Lang/TAV/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/TAV \ No newline at end of file diff --git a/Lang/TAV/Formatted-numeric-output b/Lang/TAV/Formatted-numeric-output new file mode 120000 index 0000000000..efbc60523a --- /dev/null +++ b/Lang/TAV/Formatted-numeric-output @@ -0,0 +1 @@ +../../Task/Formatted-numeric-output/TAV \ No newline at end of file diff --git a/Lang/TAV/Greatest-element-of-a-list b/Lang/TAV/Greatest-element-of-a-list new file mode 120000 index 0000000000..b4f81674a0 --- /dev/null +++ b/Lang/TAV/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/TAV \ No newline at end of file diff --git a/Lang/TAV/Guess-the-number-With-feedback b/Lang/TAV/Guess-the-number-With-feedback new file mode 120000 index 0000000000..5779e4d532 --- /dev/null +++ b/Lang/TAV/Guess-the-number-With-feedback @@ -0,0 +1 @@ +../../Task/Guess-the-number-With-feedback/TAV \ No newline at end of file diff --git a/Lang/TAV/HTTPS b/Lang/TAV/HTTPS new file mode 120000 index 0000000000..3b5c7b8988 --- /dev/null +++ b/Lang/TAV/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/TAV \ No newline at end of file diff --git a/Lang/TAV/Halt-and-catch-fire b/Lang/TAV/Halt-and-catch-fire new file mode 120000 index 0000000000..802c4aa7b1 --- /dev/null +++ b/Lang/TAV/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/TAV \ No newline at end of file diff --git a/Lang/TAV/Hello-world-Graphical b/Lang/TAV/Hello-world-Graphical new file mode 120000 index 0000000000..5207716bc0 --- /dev/null +++ b/Lang/TAV/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/TAV \ No newline at end of file diff --git a/Lang/TAV/Hello-world-Text b/Lang/TAV/Hello-world-Text new file mode 120000 index 0000000000..3fd6788564 --- /dev/null +++ b/Lang/TAV/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/TAV \ No newline at end of file diff --git a/Lang/TAV/Letter-frequency b/Lang/TAV/Letter-frequency new file mode 120000 index 0000000000..891b699844 --- /dev/null +++ b/Lang/TAV/Letter-frequency @@ -0,0 +1 @@ +../../Task/Letter-frequency/TAV \ No newline at end of file diff --git a/Lang/TAV/Loop-over-multiple-arrays-simultaneously b/Lang/TAV/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..b6133fd1e3 --- /dev/null +++ b/Lang/TAV/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/TAV \ No newline at end of file diff --git a/Lang/TAV/Loops-Break b/Lang/TAV/Loops-Break new file mode 120000 index 0000000000..9576a14c29 --- /dev/null +++ b/Lang/TAV/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/TAV \ No newline at end of file diff --git a/Lang/TAV/Loops-Do-while b/Lang/TAV/Loops-Do-while new file mode 120000 index 0000000000..1fc4e33872 --- /dev/null +++ b/Lang/TAV/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/TAV \ No newline at end of file diff --git a/Lang/TAV/Loops-Downward-for b/Lang/TAV/Loops-Downward-for new file mode 120000 index 0000000000..414c0842ce --- /dev/null +++ b/Lang/TAV/Loops-Downward-for @@ -0,0 +1 @@ +../../Task/Loops-Downward-for/TAV \ No newline at end of file diff --git a/Lang/TAV/Loops-For b/Lang/TAV/Loops-For new file mode 120000 index 0000000000..b5f2be83c7 --- /dev/null +++ b/Lang/TAV/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/TAV \ No newline at end of file diff --git a/Lang/TAV/Loops-Infinite b/Lang/TAV/Loops-Infinite new file mode 120000 index 0000000000..6ab04989e3 --- /dev/null +++ b/Lang/TAV/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/TAV \ No newline at end of file diff --git a/Lang/TAV/Loops-N-plus-one-half b/Lang/TAV/Loops-N-plus-one-half new file mode 120000 index 0000000000..eaeea87dec --- /dev/null +++ b/Lang/TAV/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/TAV \ No newline at end of file diff --git a/Lang/TAV/Loops-While b/Lang/TAV/Loops-While new file mode 120000 index 0000000000..b408169718 --- /dev/null +++ b/Lang/TAV/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/TAV \ No newline at end of file diff --git a/Lang/TAV/Multiplication-tables b/Lang/TAV/Multiplication-tables new file mode 120000 index 0000000000..294070cfc4 --- /dev/null +++ b/Lang/TAV/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/TAV \ No newline at end of file diff --git a/Lang/TAV/Ordered-words b/Lang/TAV/Ordered-words new file mode 120000 index 0000000000..1dd34f0734 --- /dev/null +++ b/Lang/TAV/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/TAV \ No newline at end of file diff --git a/Lang/TAV/Permutations b/Lang/TAV/Permutations new file mode 120000 index 0000000000..c61f5ead43 --- /dev/null +++ b/Lang/TAV/Permutations @@ -0,0 +1 @@ +../../Task/Permutations/TAV \ No newline at end of file diff --git a/Lang/TAV/Real-constants-and-functions b/Lang/TAV/Real-constants-and-functions new file mode 120000 index 0000000000..074b803009 --- /dev/null +++ b/Lang/TAV/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/TAV \ No newline at end of file diff --git a/Lang/TAV/Reverse-a-string b/Lang/TAV/Reverse-a-string new file mode 120000 index 0000000000..ded0969ffb --- /dev/null +++ b/Lang/TAV/Reverse-a-string @@ -0,0 +1 @@ +../../Task/Reverse-a-string/TAV \ No newline at end of file diff --git a/Lang/TAV/Semordnilap b/Lang/TAV/Semordnilap new file mode 120000 index 0000000000..2269a5f472 --- /dev/null +++ b/Lang/TAV/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/TAV \ No newline at end of file diff --git a/Lang/TAV/Show-ASCII-table b/Lang/TAV/Show-ASCII-table new file mode 120000 index 0000000000..f220b6d5c2 --- /dev/null +++ b/Lang/TAV/Show-ASCII-table @@ -0,0 +1 @@ +../../Task/Show-ASCII-table/TAV \ No newline at end of file diff --git a/Lang/TAV/Simple-windowed-application b/Lang/TAV/Simple-windowed-application new file mode 120000 index 0000000000..16b1926606 --- /dev/null +++ b/Lang/TAV/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/TAV \ No newline at end of file diff --git a/Lang/TAV/Stack b/Lang/TAV/Stack new file mode 120000 index 0000000000..a05bead248 --- /dev/null +++ b/Lang/TAV/Stack @@ -0,0 +1 @@ +../../Task/Stack/TAV \ No newline at end of file diff --git a/Lang/TAV/String-length b/Lang/TAV/String-length new file mode 120000 index 0000000000..6374cb4fac --- /dev/null +++ b/Lang/TAV/String-length @@ -0,0 +1 @@ +../../Task/String-length/TAV \ No newline at end of file diff --git a/Lang/TAV/Sudoku b/Lang/TAV/Sudoku new file mode 120000 index 0000000000..c7ddc3598c --- /dev/null +++ b/Lang/TAV/Sudoku @@ -0,0 +1 @@ +../../Task/Sudoku/TAV \ No newline at end of file diff --git a/Lang/TAV/Tic-tac-toe b/Lang/TAV/Tic-tac-toe new file mode 120000 index 0000000000..c75d3a40ab --- /dev/null +++ b/Lang/TAV/Tic-tac-toe @@ -0,0 +1 @@ +../../Task/Tic-tac-toe/TAV \ No newline at end of file diff --git a/Lang/TAV/Tokenize-a-string b/Lang/TAV/Tokenize-a-string new file mode 120000 index 0000000000..8b4118dfbe --- /dev/null +++ b/Lang/TAV/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/TAV \ No newline at end of file diff --git a/Lang/TAV/Twelve-statements b/Lang/TAV/Twelve-statements new file mode 120000 index 0000000000..0036358c10 --- /dev/null +++ b/Lang/TAV/Twelve-statements @@ -0,0 +1 @@ +../../Task/Twelve-statements/TAV \ No newline at end of file diff --git a/Lang/TAV/Window-creation b/Lang/TAV/Window-creation new file mode 120000 index 0000000000..83a0431016 --- /dev/null +++ b/Lang/TAV/Window-creation @@ -0,0 +1 @@ +../../Task/Window-creation/TAV \ No newline at end of file diff --git a/Lang/TAV/Word-frequency b/Lang/TAV/Word-frequency new file mode 120000 index 0000000000..569f86daf5 --- /dev/null +++ b/Lang/TAV/Word-frequency @@ -0,0 +1 @@ +../../Task/Word-frequency/TAV \ No newline at end of file diff --git a/Lang/TI-83-BASIC/00-LANG.txt b/Lang/TI-83-BASIC/00-LANG.txt index 571b0d2a73..a8830c103d 100644 --- a/Lang/TI-83-BASIC/00-LANG.txt +++ b/Lang/TI-83-BASIC/00-LANG.txt @@ -8,24 +8,24 @@ The language contains control flow for structured programming. The main control flow statements are: ====If==== -If condition +If condition Then ... Else ... -End +End ====For==== -For(variable,start,stop,step) +For(variable,start,stop,step) ... -End +End ====While==== -While condition +While condition ... -End +End ====Repeat==== -Repeat condition +Repeat condition ... -End +End ===Data types=== '''TI-BASIC''' is a strongly and dynamically-typed language Variables are global. There is no local variables. So programs cannot be recursive, even if a program can call itself. @@ -37,11 +37,11 @@ Variables are global. There is no local variables. So programs cannot be recursi ==Example== One popular example is the quadratic formula program. -Prompt A,B,C +Prompt A,B,C B²-4AC->D (-B-sqrt(D))/(2A)->Y (-B+sqrt(D))/(2A)->X -{Y,X} +{Y,X} As far there is a complex mode and variable can be real or complex, this program is very ubiquitous. diff --git a/Lang/TI-BASIC/00-LANG.txt b/Lang/TI-BASIC/00-LANG.txt new file mode 100644 index 0000000000..05fbe4ee20 --- /dev/null +++ b/Lang/TI-BASIC/00-LANG.txt @@ -0,0 +1,6 @@ +{{stub}}{{language|TI BASIC}} +TI BASIC is the language included in the TI-99/4 (1979) and TI-99/4A (1981) computers. It is similar to Dartmouth BASIC 6th edition. It does not have some features in Microsoft BASIC such as multi-statement lines, other statements after IF..THEN, PEEK, POKE, and USR. It's capabilites are between those of Minimal BASIC and GW-BASIC. It is slower than the BASIC in most other computers but it has high accuracy for calculations. + +It can be used to read and write data files on disk but it is not ideal for reading text files (known as DISPLAY/VARIABLE 80 in the TI file system) because the INPUT #X statement would stop reading a line before the end if it contained a comma. This problem was solved with TI Extended BASIC by the addition of the LINPUT #X statement which is like LINE INPUT# in Microsoft Disk BASIC. + +Many TI-99/4A owners had a TI Extended BASIC cartridge to write or use more advanced programs, including assembly language programs. Almost all TI BASIC programs would run correctly in TI Extended BASIC. \ No newline at end of file diff --git a/Lang/TI-BASIC/00-META.yaml b/Lang/TI-BASIC/00-META.yaml new file mode 100644 index 0000000000..ffd8ce4106 --- /dev/null +++ b/Lang/TI-BASIC/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:TI_BASIC diff --git a/Lang/TI-BASIC/Colour-bars-Display b/Lang/TI-BASIC/Colour-bars-Display new file mode 120000 index 0000000000..7be4e2a808 --- /dev/null +++ b/Lang/TI-BASIC/Colour-bars-Display @@ -0,0 +1 @@ +../../Task/Colour-bars-Display/TI-BASIC \ No newline at end of file diff --git a/Lang/TXR/Cheryls-birthday b/Lang/TXR/Cheryls-birthday new file mode 120000 index 0000000000..3755473e4e --- /dev/null +++ b/Lang/TXR/Cheryls-birthday @@ -0,0 +1 @@ +../../Task/Cheryls-birthday/TXR \ No newline at end of file diff --git a/Lang/Tailspin/00-LANG.txt b/Lang/Tailspin/00-LANG.txt index a8437326e6..02c82847dd 100644 --- a/Lang/Tailspin/00-LANG.txt +++ b/Lang/Tailspin/00-LANG.txt @@ -18,4 +18,6 @@ The inspiration comes mostly from xslt, but data structures are json-like. The m [https://github.com/tobega/tailspin-v0/blob/master/TailspinReference.md Syntax reference] -Development page, also how to run Tailspin programs [https://github.com/tobega/tailspin-v0 on github] \ No newline at end of file +Development page, also how to run Tailspin programs [https://github.com/tobega/tailspin-v0 on github] + +Next version v0.5 [https://github.com/tobega/tailspin-v0.5 under development] \ No newline at end of file diff --git a/Lang/Tailspin/Combinations b/Lang/Tailspin/Combinations new file mode 120000 index 0000000000..987b496fbb --- /dev/null +++ b/Lang/Tailspin/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Tailspin \ No newline at end of file diff --git a/Lang/Tailspin/Sierpinski-triangle b/Lang/Tailspin/Sierpinski-triangle new file mode 120000 index 0000000000..b603b111a2 --- /dev/null +++ b/Lang/Tailspin/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/Tailspin \ No newline at end of file diff --git a/Lang/Tailspin/Word-wrap b/Lang/Tailspin/Word-wrap new file mode 120000 index 0000000000..f70bd1df77 --- /dev/null +++ b/Lang/Tailspin/Word-wrap @@ -0,0 +1 @@ +../../Task/Word-wrap/Tailspin \ No newline at end of file diff --git a/Lang/Tcl/Ascending-primes b/Lang/Tcl/Ascending-primes new file mode 120000 index 0000000000..aad1d565ea --- /dev/null +++ b/Lang/Tcl/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Bioinformatics-base-count b/Lang/Tcl/Bioinformatics-base-count deleted file mode 120000 index 2d2ea8e987..0000000000 --- a/Lang/Tcl/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Canonicalize-CIDR b/Lang/Tcl/Canonicalize-CIDR new file mode 120000 index 0000000000..a6d154c647 --- /dev/null +++ b/Lang/Tcl/Canonicalize-CIDR @@ -0,0 +1 @@ +../../Task/Canonicalize-CIDR/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Chaocipher b/Lang/Tcl/Chaocipher new file mode 120000 index 0000000000..8d836b3e4a --- /dev/null +++ b/Lang/Tcl/Chaocipher @@ -0,0 +1 @@ +../../Task/Chaocipher/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Character-codes b/Lang/Tcl/Character-codes deleted file mode 120000 index 3f7702eaa9..0000000000 --- a/Lang/Tcl/Character-codes +++ /dev/null @@ -1 +0,0 @@ -../../Task/Character-codes/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Damm-algorithm b/Lang/Tcl/Damm-algorithm new file mode 120000 index 0000000000..cbcece145d --- /dev/null +++ b/Lang/Tcl/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/Tcl \ No newline at end of file diff --git a/Lang/Tcl/De-Bruijn-sequences b/Lang/Tcl/De-Bruijn-sequences new file mode 120000 index 0000000000..b3e1240d2e --- /dev/null +++ b/Lang/Tcl/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Descending-primes b/Lang/Tcl/Descending-primes new file mode 120000 index 0000000000..11b4ea6aa0 --- /dev/null +++ b/Lang/Tcl/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Find-if-a-point-is-within-a-triangle b/Lang/Tcl/Find-if-a-point-is-within-a-triangle new file mode 120000 index 0000000000..340eb44d03 --- /dev/null +++ b/Lang/Tcl/Find-if-a-point-is-within-a-triangle @@ -0,0 +1 @@ +../../Task/Find-if-a-point-is-within-a-triangle/Tcl \ No newline at end of file diff --git a/Lang/Tcl/M-bius-function b/Lang/Tcl/M-bius-function new file mode 120000 index 0000000000..1c7ccdef59 --- /dev/null +++ b/Lang/Tcl/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Miller-Rabin-primality-test b/Lang/Tcl/Miller-Rabin-primality-test deleted file mode 120000 index 5e3095425f..0000000000 --- a/Lang/Tcl/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Padovan-sequence b/Lang/Tcl/Padovan-sequence new file mode 120000 index 0000000000..554876550e --- /dev/null +++ b/Lang/Tcl/Padovan-sequence @@ -0,0 +1 @@ +../../Task/Padovan-sequence/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Pseudo-random-numbers-PCG32 b/Lang/Tcl/Pseudo-random-numbers-PCG32 new file mode 120000 index 0000000000..32494389fe --- /dev/null +++ b/Lang/Tcl/Pseudo-random-numbers-PCG32 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-PCG32/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Quaternion-type b/Lang/Tcl/Quaternion-type deleted file mode 120000 index 50905d75b8..0000000000 --- a/Lang/Tcl/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Strassens-algorithm b/Lang/Tcl/Strassens-algorithm new file mode 120000 index 0000000000..8ac35c1ae0 --- /dev/null +++ b/Lang/Tcl/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Unicode-strings b/Lang/Tcl/Unicode-strings new file mode 120000 index 0000000000..5d3bbc0431 --- /dev/null +++ b/Lang/Tcl/Unicode-strings @@ -0,0 +1 @@ +../../Task/Unicode-strings/Tcl \ No newline at end of file diff --git a/Lang/Tiny-BASIC/Leonardo-numbers b/Lang/Tiny-BASIC/Leonardo-numbers new file mode 120000 index 0000000000..731e542c2f --- /dev/null +++ b/Lang/Tiny-BASIC/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/Tiny-BASIC \ No newline at end of file diff --git a/Lang/Tiny-BASIC/Magic-constant b/Lang/Tiny-BASIC/Magic-constant new file mode 120000 index 0000000000..e64a075712 --- /dev/null +++ b/Lang/Tiny-BASIC/Magic-constant @@ -0,0 +1 @@ +../../Task/Magic-constant/Tiny-BASIC \ No newline at end of file diff --git a/Lang/Tiny-BASIC/Mandelbrot-set b/Lang/Tiny-BASIC/Mandelbrot-set new file mode 120000 index 0000000000..9aab104307 --- /dev/null +++ b/Lang/Tiny-BASIC/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/Tiny-BASIC \ No newline at end of file diff --git a/Lang/Tiny-BASIC/The-Twelve-Days-of-Christmas b/Lang/Tiny-BASIC/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..8dad6cc4e9 --- /dev/null +++ b/Lang/Tiny-BASIC/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/Tiny-BASIC \ No newline at end of file diff --git a/Lang/Tiny-Craft-Basic/00-LANG.txt b/Lang/Tiny-Craft-Basic/00-LANG.txt index 7f2581b84e..e69de29bb2 100644 --- a/Lang/Tiny-Craft-Basic/00-LANG.txt +++ b/Lang/Tiny-Craft-Basic/00-LANG.txt @@ -1,4 +0,0 @@ -{{stub}}{{language|Tiny Craft Basic}} -[http://www.lucidapogee.com/forum/viewtopic.php?t=4 Tiny Craft Basic Homepage] - -Tiny Craft Basic is a minimal line number oriented BASIC interpreter for x86 DOS. \ No newline at end of file diff --git a/Lang/Tiny-Craft-Basic/100-doors b/Lang/Tiny-Craft-Basic/100-doors deleted file mode 120000 index 2da9c7c5cd..0000000000 --- a/Lang/Tiny-Craft-Basic/100-doors +++ /dev/null @@ -1 +0,0 @@ -../../Task/100-doors/Tiny-Craft-Basic \ No newline at end of file diff --git a/Lang/Tiny-Craft-Basic/Babbage-problem b/Lang/Tiny-Craft-Basic/Babbage-problem deleted file mode 120000 index 887e8aa0f7..0000000000 --- a/Lang/Tiny-Craft-Basic/Babbage-problem +++ /dev/null @@ -1 +0,0 @@ -../../Task/Babbage-problem/Tiny-Craft-Basic \ No newline at end of file diff --git a/Lang/Tiny-Craft-Basic/Factorial b/Lang/Tiny-Craft-Basic/Factorial deleted file mode 120000 index 0d8ce4d92d..0000000000 --- a/Lang/Tiny-Craft-Basic/Factorial +++ /dev/null @@ -1 +0,0 @@ -../../Task/Factorial/Tiny-Craft-Basic \ No newline at end of file diff --git a/Lang/Tiny-Craft-Basic/Fibonacci-sequence b/Lang/Tiny-Craft-Basic/Fibonacci-sequence deleted file mode 120000 index 7480a004d5..0000000000 --- a/Lang/Tiny-Craft-Basic/Fibonacci-sequence +++ /dev/null @@ -1 +0,0 @@ -../../Task/Fibonacci-sequence/Tiny-Craft-Basic \ No newline at end of file diff --git a/Lang/Tiny-Craft-Basic/Guess-the-number-With-feedback b/Lang/Tiny-Craft-Basic/Guess-the-number-With-feedback deleted file mode 120000 index 28176bc0b4..0000000000 --- a/Lang/Tiny-Craft-Basic/Guess-the-number-With-feedback +++ /dev/null @@ -1 +0,0 @@ -../../Task/Guess-the-number-With-feedback/Tiny-Craft-Basic \ No newline at end of file diff --git a/Lang/Tiny-Craft-Basic/Hello-world-Text b/Lang/Tiny-Craft-Basic/Hello-world-Text deleted file mode 120000 index fdb67c8879..0000000000 --- a/Lang/Tiny-Craft-Basic/Hello-world-Text +++ /dev/null @@ -1 +0,0 @@ -../../Task/Hello-world-Text/Tiny-Craft-Basic \ No newline at end of file diff --git a/Lang/Tiny-Craft-Basic/Nim-game b/Lang/Tiny-Craft-Basic/Nim-game deleted file mode 120000 index 8e131a33ac..0000000000 --- a/Lang/Tiny-Craft-Basic/Nim-game +++ /dev/null @@ -1 +0,0 @@ -../../Task/Nim-game/Tiny-Craft-Basic \ No newline at end of file diff --git a/Lang/Tiny-Craft-Basic/Tau-number b/Lang/Tiny-Craft-Basic/Tau-number deleted file mode 120000 index 03f078203f..0000000000 --- a/Lang/Tiny-Craft-Basic/Tau-number +++ /dev/null @@ -1 +0,0 @@ -../../Task/Tau-number/Tiny-Craft-Basic \ No newline at end of file diff --git a/Lang/Tiny-Craft-Basic/Temperature-conversion b/Lang/Tiny-Craft-Basic/Temperature-conversion deleted file mode 120000 index 1f7a63bda3..0000000000 --- a/Lang/Tiny-Craft-Basic/Temperature-conversion +++ /dev/null @@ -1 +0,0 @@ -../../Task/Temperature-conversion/Tiny-Craft-Basic \ No newline at end of file diff --git a/Lang/Transd/Compare-length-of-two-strings b/Lang/Transd/Compare-length-of-two-strings deleted file mode 120000 index 28f3956c3e..0000000000 --- a/Lang/Transd/Compare-length-of-two-strings +++ /dev/null @@ -1 +0,0 @@ -../../Task/Compare-length-of-two-strings/Transd \ No newline at end of file diff --git a/Lang/Trith/Empty-program b/Lang/Trith/Empty-program deleted file mode 120000 index a3056b4a8b..0000000000 --- a/Lang/Trith/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Trith \ No newline at end of file diff --git a/Lang/True-BASIC/00-LANG.txt b/Lang/True-BASIC/00-LANG.txt index 765d6ad0cc..7ebdbc548e 100644 --- a/Lang/True-BASIC/00-LANG.txt +++ b/Lang/True-BASIC/00-LANG.txt @@ -2,6 +2,7 @@ |exec=interpreted |tags=basic,TrueBasic |site=http://www.truebasic.com/}} +{{implementation|BASIC}} True BASIC is a variant of the BASIC programming language descended from Dartmouth BASIC, the original BASIC. It was invented by college professors John G. Kemeny and Thomas E. Kurtz. It is an interpreted, procedural language and sold as a commercial product. Versions have existed for Microsoft Windows, Apple Mac OS, MS-DOS, OS/2, and the Atari ST. The latest version of the language is 6.007 and currently only runs on Microsoft Windows. diff --git a/Lang/True-BASIC/100-prisoners b/Lang/True-BASIC/100-prisoners new file mode 120000 index 0000000000..b793e357f7 --- /dev/null +++ b/Lang/True-BASIC/100-prisoners @@ -0,0 +1 @@ +../../Task/100-prisoners/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/21-game b/Lang/True-BASIC/21-game new file mode 120000 index 0000000000..3e04be4a0d --- /dev/null +++ b/Lang/True-BASIC/21-game @@ -0,0 +1 @@ +../../Task/21-game/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Balanced-brackets b/Lang/True-BASIC/Balanced-brackets new file mode 120000 index 0000000000..3e7fd1fa12 --- /dev/null +++ b/Lang/True-BASIC/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Benfords-law b/Lang/True-BASIC/Benfords-law new file mode 120000 index 0000000000..27ed6c42fa --- /dev/null +++ b/Lang/True-BASIC/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Cantor-set b/Lang/True-BASIC/Cantor-set new file mode 120000 index 0000000000..e1bc7d9228 --- /dev/null +++ b/Lang/True-BASIC/Cantor-set @@ -0,0 +1 @@ +../../Task/Cantor-set/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Casting-out-nines b/Lang/True-BASIC/Casting-out-nines new file mode 120000 index 0000000000..8de5b0d0d1 --- /dev/null +++ b/Lang/True-BASIC/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Determine-sentence-type b/Lang/True-BASIC/Determine-sentence-type new file mode 120000 index 0000000000..988197fd95 --- /dev/null +++ b/Lang/True-BASIC/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Dinesmans-multiple-dwelling-problem b/Lang/True-BASIC/Dinesmans-multiple-dwelling-problem new file mode 120000 index 0000000000..072ce67623 --- /dev/null +++ b/Lang/True-BASIC/Dinesmans-multiple-dwelling-problem @@ -0,0 +1 @@ +../../Task/Dinesmans-multiple-dwelling-problem/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Diversity-prediction-theorem b/Lang/True-BASIC/Diversity-prediction-theorem new file mode 120000 index 0000000000..85980181c1 --- /dev/null +++ b/Lang/True-BASIC/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Euler-method b/Lang/True-BASIC/Euler-method new file mode 120000 index 0000000000..11b2de27b9 --- /dev/null +++ b/Lang/True-BASIC/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Evaluate-binomial-coefficients b/Lang/True-BASIC/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..8a2a036883 --- /dev/null +++ b/Lang/True-BASIC/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Floyds-triangle b/Lang/True-BASIC/Floyds-triangle new file mode 120000 index 0000000000..5ea009925d --- /dev/null +++ b/Lang/True-BASIC/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Greatest-element-of-a-list b/Lang/True-BASIC/Greatest-element-of-a-list new file mode 120000 index 0000000000..3c9a45a72c --- /dev/null +++ b/Lang/True-BASIC/Greatest-element-of-a-list @@ -0,0 +1 @@ +../../Task/Greatest-element-of-a-list/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Leonardo-numbers b/Lang/True-BASIC/Leonardo-numbers new file mode 120000 index 0000000000..7faae2372e --- /dev/null +++ b/Lang/True-BASIC/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Loop-over-multiple-arrays-simultaneously b/Lang/True-BASIC/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..0cb7e37da5 --- /dev/null +++ b/Lang/True-BASIC/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/McNuggets-problem b/Lang/True-BASIC/McNuggets-problem new file mode 120000 index 0000000000..9a5d4f9331 --- /dev/null +++ b/Lang/True-BASIC/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Meissel-Mertens-constant b/Lang/True-BASIC/Meissel-Mertens-constant deleted file mode 120000 index fd72ec2c53..0000000000 --- a/Lang/True-BASIC/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/True-BASIC/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..bae83d5055 --- /dev/null +++ b/Lang/True-BASIC/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Multiple-regression b/Lang/True-BASIC/Multiple-regression new file mode 120000 index 0000000000..ca0e5c404e --- /dev/null +++ b/Lang/True-BASIC/Multiple-regression @@ -0,0 +1 @@ +../../Task/Multiple-regression/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Phrase-reversals b/Lang/True-BASIC/Phrase-reversals new file mode 120000 index 0000000000..564680054e --- /dev/null +++ b/Lang/True-BASIC/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Sequence:-smallest-number-with-exactly-n-divisors b/Lang/True-BASIC/Sequence:-smallest-number-with-exactly-n-divisors new file mode 120000 index 0000000000..d0a3d58964 --- /dev/null +++ b/Lang/True-BASIC/Sequence:-smallest-number-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-with-exactly-n-divisors/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Set-right-adjacent-bits b/Lang/True-BASIC/Set-right-adjacent-bits new file mode 120000 index 0000000000..71cf0f9f79 --- /dev/null +++ b/Lang/True-BASIC/Set-right-adjacent-bits @@ -0,0 +1 @@ +../../Task/Set-right-adjacent-bits/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Soundex b/Lang/True-BASIC/Soundex new file mode 120000 index 0000000000..33e7fb68ee --- /dev/null +++ b/Lang/True-BASIC/Soundex @@ -0,0 +1 @@ +../../Task/Soundex/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Split-a-character-string-based-on-change-of-character b/Lang/True-BASIC/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..e25a5cf6f3 --- /dev/null +++ b/Lang/True-BASIC/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/The-Name-Game b/Lang/True-BASIC/The-Name-Game new file mode 120000 index 0000000000..bf4d14fb81 --- /dev/null +++ b/Lang/True-BASIC/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/True-BASIC \ No newline at end of file diff --git a/Lang/True-BASIC/Vector b/Lang/True-BASIC/Vector new file mode 120000 index 0000000000..4da227d0fe --- /dev/null +++ b/Lang/True-BASIC/Vector @@ -0,0 +1 @@ +../../Task/Vector/True-BASIC \ No newline at end of file diff --git a/Lang/TypeScript/Additive-primes b/Lang/TypeScript/Additive-primes new file mode 120000 index 0000000000..698823ecab --- /dev/null +++ b/Lang/TypeScript/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/TypeScript \ No newline at end of file diff --git a/Lang/TypeScript/Arithmetic-numbers b/Lang/TypeScript/Arithmetic-numbers new file mode 120000 index 0000000000..0a37af8cff --- /dev/null +++ b/Lang/TypeScript/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/TypeScript \ No newline at end of file diff --git a/Lang/TypeScript/Deal-cards-for-FreeCell b/Lang/TypeScript/Deal-cards-for-FreeCell new file mode 120000 index 0000000000..04eefe17ef --- /dev/null +++ b/Lang/TypeScript/Deal-cards-for-FreeCell @@ -0,0 +1 @@ +../../Task/Deal-cards-for-FreeCell/TypeScript \ No newline at end of file diff --git a/Lang/TypeScript/Leonardo-numbers b/Lang/TypeScript/Leonardo-numbers new file mode 120000 index 0000000000..501c953b40 --- /dev/null +++ b/Lang/TypeScript/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/TypeScript \ No newline at end of file diff --git a/Lang/TypeScript/Map-range b/Lang/TypeScript/Map-range new file mode 120000 index 0000000000..50eeda25cd --- /dev/null +++ b/Lang/TypeScript/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/TypeScript \ No newline at end of file diff --git a/Lang/TypeScript/Sum-of-a-series b/Lang/TypeScript/Sum-of-a-series new file mode 120000 index 0000000000..810faf05f3 --- /dev/null +++ b/Lang/TypeScript/Sum-of-a-series @@ -0,0 +1 @@ +../../Task/Sum-of-a-series/TypeScript \ No newline at end of file diff --git a/Lang/UNIX-Shell/CRC-32 b/Lang/UNIX-Shell/CRC-32 new file mode 120000 index 0000000000..7be1bb462f --- /dev/null +++ b/Lang/UNIX-Shell/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/UNIX-Shell \ No newline at end of file diff --git a/Lang/UNIX-Shell/Color-of-a-screen-pixel b/Lang/UNIX-Shell/Color-of-a-screen-pixel new file mode 120000 index 0000000000..8344bcd2f2 --- /dev/null +++ b/Lang/UNIX-Shell/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/UNIX-Shell \ No newline at end of file diff --git a/Lang/UNIX-Shell/Color-quantization b/Lang/UNIX-Shell/Color-quantization new file mode 120000 index 0000000000..6c518f1af5 --- /dev/null +++ b/Lang/UNIX-Shell/Color-quantization @@ -0,0 +1 @@ +../../Task/Color-quantization/UNIX-Shell \ No newline at end of file diff --git a/Lang/UNIX-Shell/Copy-stdin-to-stdout b/Lang/UNIX-Shell/Copy-stdin-to-stdout new file mode 120000 index 0000000000..217727646b --- /dev/null +++ b/Lang/UNIX-Shell/Copy-stdin-to-stdout @@ -0,0 +1 @@ +../../Task/Copy-stdin-to-stdout/UNIX-Shell \ No newline at end of file diff --git a/Lang/UNIX-Shell/Doomsday-rule b/Lang/UNIX-Shell/Doomsday-rule new file mode 120000 index 0000000000..49350b93c7 --- /dev/null +++ b/Lang/UNIX-Shell/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/UNIX-Shell \ No newline at end of file diff --git a/Lang/UNIX-Shell/Generate-Chess960-starting-position b/Lang/UNIX-Shell/Generate-Chess960-starting-position new file mode 120000 index 0000000000..eee0488395 --- /dev/null +++ b/Lang/UNIX-Shell/Generate-Chess960-starting-position @@ -0,0 +1 @@ +../../Task/Generate-Chess960-starting-position/UNIX-Shell \ No newline at end of file diff --git a/Lang/UNIX-Shell/Horners-rule-for-polynomial-evaluation b/Lang/UNIX-Shell/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..18a4ccc4dc --- /dev/null +++ b/Lang/UNIX-Shell/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/UNIX-Shell \ No newline at end of file diff --git a/Lang/UNIX-Shell/Modified-random-distribution b/Lang/UNIX-Shell/Modified-random-distribution new file mode 120000 index 0000000000..0682164dd7 --- /dev/null +++ b/Lang/UNIX-Shell/Modified-random-distribution @@ -0,0 +1 @@ +../../Task/Modified-random-distribution/UNIX-Shell \ No newline at end of file diff --git a/Lang/UNIX-Shell/Pi b/Lang/UNIX-Shell/Pi new file mode 120000 index 0000000000..854a52d02a --- /dev/null +++ b/Lang/UNIX-Shell/Pi @@ -0,0 +1 @@ +../../Task/Pi/UNIX-Shell \ No newline at end of file diff --git a/Lang/UNIX-Shell/Sum-to-100 b/Lang/UNIX-Shell/Sum-to-100 new file mode 120000 index 0000000000..bd5e602fa8 --- /dev/null +++ b/Lang/UNIX-Shell/Sum-to-100 @@ -0,0 +1 @@ +../../Task/Sum-to-100/UNIX-Shell \ No newline at end of file diff --git a/Lang/UNIX-Shell/Trabb-Pardo-Knuth-algorithm b/Lang/UNIX-Shell/Trabb-Pardo-Knuth-algorithm new file mode 120000 index 0000000000..d9c18fe35b --- /dev/null +++ b/Lang/UNIX-Shell/Trabb-Pardo-Knuth-algorithm @@ -0,0 +1 @@ +../../Task/Trabb-Pardo-Knuth-algorithm/UNIX-Shell \ No newline at end of file diff --git a/Lang/Uiua/00-LANG.txt b/Lang/Uiua/00-LANG.txt new file mode 100644 index 0000000000..f3cc2f1ee5 --- /dev/null +++ b/Lang/Uiua/00-LANG.txt @@ -0,0 +1,28 @@ +{{language +|exec=bytecode +|site=https://www.uiua.org/ +|checking=dynamic +|gc=yes +|express=implicit +|LCT=yes}} +{{language programming paradigm|array}} +{{language programming paradigm|functional|array}} +From [https://www.uiua.org uiua.org]: + +"Uiua (''wee-wuh'') is a general purpose, stack-based, array-oriented programming language with a focus on simplicity, beauty, and tacit code. + +Uiua has a simple, context-free, LL(3) grammar. Code runs from right to left, top to bottom, with only one precedence rule. As operators are to the left of their operands, Uiua code reads a little bit like a Lisp, but with fewer parentheses. + +Uiua combines the stack-based and array-oriented paradigms in a single language. Combining these already terse paradigms results in code with a very high information density and little syntactic noise. + +Uiua's one and only composite data type, the array, is based on those of APL, J, and BQN. They are multidimensional and rank-polymorphic, meaning that an operation that applies to one item also applies to many items. + +Unlike other array languages, Uiua does not have monadic and dyadic versions of each glyph. Every glyph does only one thing, so you don't need to parse an entire expression to know which version it is. + +Find out more, and run code in your browser at [https://www.uiua.org https://www.uiua.org]." + +===Note=== +The Uiua programming language uses a custom font and colorful syntax highlighting to increase the readability of its code. As such syntax highlighting is not possible to display on this wiki, it is recommended to paste code into [https://www.uiua.org/pad the online Uiua pad] (or a [https://www.uiua.org/install#editor-support supported editor]) to view code more easily. + +==Todo== +[https://rosettacode.org/wiki/Tasks_not_implemented_in_Uiua Tasks not implemented in Uiua] \ No newline at end of file diff --git a/Lang/Uiua/00-META.yaml b/Lang/Uiua/00-META.yaml new file mode 100644 index 0000000000..beb4610974 --- /dev/null +++ b/Lang/Uiua/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Uiua diff --git a/Lang/Uiua/100-doors b/Lang/Uiua/100-doors new file mode 120000 index 0000000000..58d6cad56c --- /dev/null +++ b/Lang/Uiua/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Uiua \ No newline at end of file diff --git a/Lang/Uiua/15-puzzle-solver b/Lang/Uiua/15-puzzle-solver new file mode 120000 index 0000000000..d2c4541287 --- /dev/null +++ b/Lang/Uiua/15-puzzle-solver @@ -0,0 +1 @@ +../../Task/15-puzzle-solver/Uiua \ No newline at end of file diff --git a/Lang/Uiua/21-game b/Lang/Uiua/21-game new file mode 120000 index 0000000000..629762436d --- /dev/null +++ b/Lang/Uiua/21-game @@ -0,0 +1 @@ +../../Task/21-game/Uiua \ No newline at end of file diff --git a/Lang/Uiua/4-rings-or-4-squares-puzzle b/Lang/Uiua/4-rings-or-4-squares-puzzle new file mode 120000 index 0000000000..a31782d205 --- /dev/null +++ b/Lang/Uiua/4-rings-or-4-squares-puzzle @@ -0,0 +1 @@ +../../Task/4-rings-or-4-squares-puzzle/Uiua \ No newline at end of file diff --git a/Lang/Uiua/99-bottles-of-beer b/Lang/Uiua/99-bottles-of-beer new file mode 120000 index 0000000000..bd1d75c2c7 --- /dev/null +++ b/Lang/Uiua/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/Uiua \ No newline at end of file diff --git a/Lang/Uiua/A+B b/Lang/Uiua/A+B new file mode 120000 index 0000000000..df9da8c183 --- /dev/null +++ b/Lang/Uiua/A+B @@ -0,0 +1 @@ +../../Task/A+B/Uiua \ No newline at end of file diff --git a/Lang/Uiua/ABC-problem b/Lang/Uiua/ABC-problem new file mode 120000 index 0000000000..e3c88d305a --- /dev/null +++ b/Lang/Uiua/ABC-problem @@ -0,0 +1 @@ +../../Task/ABC-problem/Uiua \ No newline at end of file diff --git a/Lang/Uiua/ADFGVX-cipher b/Lang/Uiua/ADFGVX-cipher new file mode 120000 index 0000000000..3b808ce65e --- /dev/null +++ b/Lang/Uiua/ADFGVX-cipher @@ -0,0 +1 @@ +../../Task/ADFGVX-cipher/Uiua \ No newline at end of file diff --git a/Lang/Uiua/ASCII-art-diagram-converter b/Lang/Uiua/ASCII-art-diagram-converter new file mode 120000 index 0000000000..7868ebc205 --- /dev/null +++ b/Lang/Uiua/ASCII-art-diagram-converter @@ -0,0 +1 @@ +../../Task/ASCII-art-diagram-converter/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Abbreviations-automatic b/Lang/Uiua/Abbreviations-automatic new file mode 120000 index 0000000000..4ed38ebb71 --- /dev/null +++ b/Lang/Uiua/Abbreviations-automatic @@ -0,0 +1 @@ +../../Task/Abbreviations-automatic/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Abelian-sandpile-model b/Lang/Uiua/Abelian-sandpile-model new file mode 120000 index 0000000000..511d6d21ce --- /dev/null +++ b/Lang/Uiua/Abelian-sandpile-model @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Abundant-deficient-and-perfect-number-classifications b/Lang/Uiua/Abundant-deficient-and-perfect-number-classifications new file mode 120000 index 0000000000..4ea7de4aaa --- /dev/null +++ b/Lang/Uiua/Abundant-deficient-and-perfect-number-classifications @@ -0,0 +1 @@ +../../Task/Abundant-deficient-and-perfect-number-classifications/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Abundant-odd-numbers b/Lang/Uiua/Abundant-odd-numbers new file mode 120000 index 0000000000..15f27f9ef1 --- /dev/null +++ b/Lang/Uiua/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Ackermann-function b/Lang/Uiua/Ackermann-function new file mode 120000 index 0000000000..94bc0faf99 --- /dev/null +++ b/Lang/Uiua/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Additive-primes b/Lang/Uiua/Additive-primes new file mode 120000 index 0000000000..81b71f4089 --- /dev/null +++ b/Lang/Uiua/Additive-primes @@ -0,0 +1 @@ +../../Task/Additive-primes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Align-columns b/Lang/Uiua/Align-columns new file mode 120000 index 0000000000..90d8156011 --- /dev/null +++ b/Lang/Uiua/Align-columns @@ -0,0 +1 @@ +../../Task/Align-columns/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Almost-prime b/Lang/Uiua/Almost-prime new file mode 120000 index 0000000000..392773baf7 --- /dev/null +++ b/Lang/Uiua/Almost-prime @@ -0,0 +1 @@ +../../Task/Almost-prime/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Amicable-pairs b/Lang/Uiua/Amicable-pairs new file mode 120000 index 0000000000..8c9ce68129 --- /dev/null +++ b/Lang/Uiua/Amicable-pairs @@ -0,0 +1 @@ +../../Task/Amicable-pairs/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Anagrams b/Lang/Uiua/Anagrams new file mode 120000 index 0000000000..a823cee1f3 --- /dev/null +++ b/Lang/Uiua/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Angle-difference-between-two-bearings b/Lang/Uiua/Angle-difference-between-two-bearings new file mode 120000 index 0000000000..ee9bbb083d --- /dev/null +++ b/Lang/Uiua/Angle-difference-between-two-bearings @@ -0,0 +1 @@ +../../Task/Angle-difference-between-two-bearings/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Anonymous-recursion b/Lang/Uiua/Anonymous-recursion new file mode 120000 index 0000000000..8c1b1c25c3 --- /dev/null +++ b/Lang/Uiua/Anonymous-recursion @@ -0,0 +1 @@ +../../Task/Anonymous-recursion/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Anti-primes b/Lang/Uiua/Anti-primes new file mode 120000 index 0000000000..caaf04d665 --- /dev/null +++ b/Lang/Uiua/Anti-primes @@ -0,0 +1 @@ +../../Task/Anti-primes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Apply-a-callback-to-an-array b/Lang/Uiua/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..685e6558c3 --- /dev/null +++ b/Lang/Uiua/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Arithmetic-Complex b/Lang/Uiua/Arithmetic-Complex new file mode 120000 index 0000000000..acbbaad1bb --- /dev/null +++ b/Lang/Uiua/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Arithmetic-Integer b/Lang/Uiua/Arithmetic-Integer new file mode 120000 index 0000000000..8f8007cc44 --- /dev/null +++ b/Lang/Uiua/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Arithmetic-derivative b/Lang/Uiua/Arithmetic-derivative new file mode 120000 index 0000000000..940b88708d --- /dev/null +++ b/Lang/Uiua/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Arithmetic-geometric-mean b/Lang/Uiua/Arithmetic-geometric-mean new file mode 120000 index 0000000000..6adeb66a11 --- /dev/null +++ b/Lang/Uiua/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Arithmetic-geometric-mean-Calculate-Pi b/Lang/Uiua/Arithmetic-geometric-mean-Calculate-Pi new file mode 120000 index 0000000000..e30c23f938 --- /dev/null +++ b/Lang/Uiua/Arithmetic-geometric-mean-Calculate-Pi @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean-Calculate-Pi/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Arithmetic-numbers b/Lang/Uiua/Arithmetic-numbers new file mode 120000 index 0000000000..e537c98fb0 --- /dev/null +++ b/Lang/Uiua/Arithmetic-numbers @@ -0,0 +1 @@ +../../Task/Arithmetic-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Array-concatenation b/Lang/Uiua/Array-concatenation new file mode 120000 index 0000000000..48fabf1a40 --- /dev/null +++ b/Lang/Uiua/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Array-length b/Lang/Uiua/Array-length new file mode 120000 index 0000000000..7c3be21b34 --- /dev/null +++ b/Lang/Uiua/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Arrays b/Lang/Uiua/Arrays new file mode 120000 index 0000000000..ae2ca1c8a6 --- /dev/null +++ b/Lang/Uiua/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Ascending-primes b/Lang/Uiua/Ascending-primes new file mode 120000 index 0000000000..83b9f7be7a --- /dev/null +++ b/Lang/Uiua/Ascending-primes @@ -0,0 +1 @@ +../../Task/Ascending-primes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Assertions b/Lang/Uiua/Assertions new file mode 120000 index 0000000000..b370cee8a3 --- /dev/null +++ b/Lang/Uiua/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Associative-array-Creation b/Lang/Uiua/Associative-array-Creation new file mode 120000 index 0000000000..8f5e350a55 --- /dev/null +++ b/Lang/Uiua/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Associative-array-Iteration b/Lang/Uiua/Associative-array-Iteration new file mode 120000 index 0000000000..5ba8f9745a --- /dev/null +++ b/Lang/Uiua/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Associative-array-Merging b/Lang/Uiua/Associative-array-Merging new file mode 120000 index 0000000000..d769831c9b --- /dev/null +++ b/Lang/Uiua/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Attractive-numbers b/Lang/Uiua/Attractive-numbers new file mode 120000 index 0000000000..d36ccc01ec --- /dev/null +++ b/Lang/Uiua/Attractive-numbers @@ -0,0 +1 @@ +../../Task/Attractive-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Averages-Arithmetic-mean b/Lang/Uiua/Averages-Arithmetic-mean new file mode 120000 index 0000000000..b50b3b064d --- /dev/null +++ b/Lang/Uiua/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Averages-Mean-time-of-day b/Lang/Uiua/Averages-Mean-time-of-day new file mode 120000 index 0000000000..970582690e --- /dev/null +++ b/Lang/Uiua/Averages-Mean-time-of-day @@ -0,0 +1 @@ +../../Task/Averages-Mean-time-of-day/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Averages-Median b/Lang/Uiua/Averages-Median new file mode 120000 index 0000000000..254605ff30 --- /dev/null +++ b/Lang/Uiua/Averages-Median @@ -0,0 +1 @@ +../../Task/Averages-Median/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Averages-Mode b/Lang/Uiua/Averages-Mode new file mode 120000 index 0000000000..13987f5b7d --- /dev/null +++ b/Lang/Uiua/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Averages-Pythagorean-means b/Lang/Uiua/Averages-Pythagorean-means new file mode 120000 index 0000000000..a42d46aee7 --- /dev/null +++ b/Lang/Uiua/Averages-Pythagorean-means @@ -0,0 +1 @@ +../../Task/Averages-Pythagorean-means/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Averages-Root-mean-square b/Lang/Uiua/Averages-Root-mean-square new file mode 120000 index 0000000000..681a323abf --- /dev/null +++ b/Lang/Uiua/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Babbage-problem b/Lang/Uiua/Babbage-problem new file mode 120000 index 0000000000..485d090cb5 --- /dev/null +++ b/Lang/Uiua/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Barnsley-fern b/Lang/Uiua/Barnsley-fern new file mode 120000 index 0000000000..39f57d2d79 --- /dev/null +++ b/Lang/Uiua/Barnsley-fern @@ -0,0 +1 @@ +../../Task/Barnsley-fern/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Bell-numbers b/Lang/Uiua/Bell-numbers new file mode 120000 index 0000000000..88832c268c --- /dev/null +++ b/Lang/Uiua/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Benfords-law b/Lang/Uiua/Benfords-law new file mode 120000 index 0000000000..c9f7d29ef6 --- /dev/null +++ b/Lang/Uiua/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Bifid-cipher b/Lang/Uiua/Bifid-cipher new file mode 120000 index 0000000000..7118fdadf7 --- /dev/null +++ b/Lang/Uiua/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Bin-given-limits b/Lang/Uiua/Bin-given-limits new file mode 120000 index 0000000000..66cb90c004 --- /dev/null +++ b/Lang/Uiua/Bin-given-limits @@ -0,0 +1 @@ +../../Task/Bin-given-limits/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Binary-digits b/Lang/Uiua/Binary-digits new file mode 120000 index 0000000000..126c2d6665 --- /dev/null +++ b/Lang/Uiua/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Bitmap b/Lang/Uiua/Bitmap new file mode 120000 index 0000000000..6ff7a055f3 --- /dev/null +++ b/Lang/Uiua/Bitmap @@ -0,0 +1 @@ +../../Task/Bitmap/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Bitmap-Flood-fill b/Lang/Uiua/Bitmap-Flood-fill new file mode 120000 index 0000000000..8833733b75 --- /dev/null +++ b/Lang/Uiua/Bitmap-Flood-fill @@ -0,0 +1 @@ +../../Task/Bitmap-Flood-fill/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Bitwise-operations b/Lang/Uiua/Bitwise-operations new file mode 120000 index 0000000000..1b1bf97751 --- /dev/null +++ b/Lang/Uiua/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Boolean-values b/Lang/Uiua/Boolean-values new file mode 120000 index 0000000000..ac8910eee9 --- /dev/null +++ b/Lang/Uiua/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Brownian-tree b/Lang/Uiua/Brownian-tree new file mode 120000 index 0000000000..0933a35ed1 --- /dev/null +++ b/Lang/Uiua/Brownian-tree @@ -0,0 +1 @@ +../../Task/Brownian-tree/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Bulls-and-cows-Player b/Lang/Uiua/Bulls-and-cows-Player new file mode 120000 index 0000000000..b45c91dd88 --- /dev/null +++ b/Lang/Uiua/Bulls-and-cows-Player @@ -0,0 +1 @@ +../../Task/Bulls-and-cows-Player/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Burrows-Wheeler-transform b/Lang/Uiua/Burrows-Wheeler-transform new file mode 120000 index 0000000000..d53398fc74 --- /dev/null +++ b/Lang/Uiua/Burrows-Wheeler-transform @@ -0,0 +1 @@ +../../Task/Burrows-Wheeler-transform/Uiua \ No newline at end of file diff --git a/Lang/Uiua/CRC-32 b/Lang/Uiua/CRC-32 new file mode 120000 index 0000000000..063f3e4ee3 --- /dev/null +++ b/Lang/Uiua/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/Uiua \ No newline at end of file diff --git a/Lang/Uiua/CSV-data-manipulation b/Lang/Uiua/CSV-data-manipulation new file mode 120000 index 0000000000..78747e6f49 --- /dev/null +++ b/Lang/Uiua/CSV-data-manipulation @@ -0,0 +1 @@ +../../Task/CSV-data-manipulation/Uiua \ No newline at end of file diff --git a/Lang/Uiua/CSV-to-HTML-translation b/Lang/Uiua/CSV-to-HTML-translation new file mode 120000 index 0000000000..cd311bcc18 --- /dev/null +++ b/Lang/Uiua/CSV-to-HTML-translation @@ -0,0 +1 @@ +../../Task/CSV-to-HTML-translation/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Caesar-cipher b/Lang/Uiua/Caesar-cipher new file mode 120000 index 0000000000..ef50c0e2e1 --- /dev/null +++ b/Lang/Uiua/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Calculating-the-value-of-e b/Lang/Uiua/Calculating-the-value-of-e new file mode 120000 index 0000000000..d7cc261bf8 --- /dev/null +++ b/Lang/Uiua/Calculating-the-value-of-e @@ -0,0 +1 @@ +../../Task/Calculating-the-value-of-e/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Calkin-Wilf-sequence b/Lang/Uiua/Calkin-Wilf-sequence new file mode 120000 index 0000000000..23330ada15 --- /dev/null +++ b/Lang/Uiua/Calkin-Wilf-sequence @@ -0,0 +1 @@ +../../Task/Calkin-Wilf-sequence/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Call-a-function b/Lang/Uiua/Call-a-function new file mode 120000 index 0000000000..1d6b22e4f5 --- /dev/null +++ b/Lang/Uiua/Call-a-function @@ -0,0 +1 @@ +../../Task/Call-a-function/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Cantor-set b/Lang/Uiua/Cantor-set new file mode 120000 index 0000000000..1c94d38d0e --- /dev/null +++ b/Lang/Uiua/Cantor-set @@ -0,0 +1 @@ +../../Task/Cantor-set/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Cartesian-product-of-two-or-more-lists b/Lang/Uiua/Cartesian-product-of-two-or-more-lists new file mode 120000 index 0000000000..bff2250b36 --- /dev/null +++ b/Lang/Uiua/Cartesian-product-of-two-or-more-lists @@ -0,0 +1 @@ +../../Task/Cartesian-product-of-two-or-more-lists/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Catalan-numbers b/Lang/Uiua/Catalan-numbers new file mode 120000 index 0000000000..39a3cbd336 --- /dev/null +++ b/Lang/Uiua/Catalan-numbers @@ -0,0 +1 @@ +../../Task/Catalan-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Catalan-numbers-Pascals-triangle b/Lang/Uiua/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..d4426dbc39 --- /dev/null +++ b/Lang/Uiua/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Catamorphism b/Lang/Uiua/Catamorphism new file mode 120000 index 0000000000..f0a8a02f45 --- /dev/null +++ b/Lang/Uiua/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Chaos-game b/Lang/Uiua/Chaos-game new file mode 120000 index 0000000000..d29c071799 --- /dev/null +++ b/Lang/Uiua/Chaos-game @@ -0,0 +1 @@ +../../Task/Chaos-game/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Character-codes b/Lang/Uiua/Character-codes new file mode 120000 index 0000000000..511eef1d48 --- /dev/null +++ b/Lang/Uiua/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Check-output-device-is-a-terminal b/Lang/Uiua/Check-output-device-is-a-terminal new file mode 120000 index 0000000000..9599dac818 --- /dev/null +++ b/Lang/Uiua/Check-output-device-is-a-terminal @@ -0,0 +1 @@ +../../Task/Check-output-device-is-a-terminal/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Check-that-file-exists b/Lang/Uiua/Check-that-file-exists new file mode 120000 index 0000000000..2ad54c3db1 --- /dev/null +++ b/Lang/Uiua/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Circular-primes b/Lang/Uiua/Circular-primes new file mode 120000 index 0000000000..65d19beab0 --- /dev/null +++ b/Lang/Uiua/Circular-primes @@ -0,0 +1 @@ +../../Task/Circular-primes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Cistercian-numerals b/Lang/Uiua/Cistercian-numerals new file mode 120000 index 0000000000..7a072fe82a --- /dev/null +++ b/Lang/Uiua/Cistercian-numerals @@ -0,0 +1 @@ +../../Task/Cistercian-numerals/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Collections b/Lang/Uiua/Collections new file mode 120000 index 0000000000..3ea461802a --- /dev/null +++ b/Lang/Uiua/Collections @@ -0,0 +1 @@ +../../Task/Collections/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Color-wheel b/Lang/Uiua/Color-wheel new file mode 120000 index 0000000000..f9a74260bf --- /dev/null +++ b/Lang/Uiua/Color-wheel @@ -0,0 +1 @@ +../../Task/Color-wheel/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Colorful-numbers b/Lang/Uiua/Colorful-numbers new file mode 120000 index 0000000000..b2f820f214 --- /dev/null +++ b/Lang/Uiua/Colorful-numbers @@ -0,0 +1 @@ +../../Task/Colorful-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Colour-bars-Display b/Lang/Uiua/Colour-bars-Display new file mode 120000 index 0000000000..dbff1dc862 --- /dev/null +++ b/Lang/Uiua/Colour-bars-Display @@ -0,0 +1 @@ +../../Task/Colour-bars-Display/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Combinations b/Lang/Uiua/Combinations new file mode 120000 index 0000000000..1300366dbb --- /dev/null +++ b/Lang/Uiua/Combinations @@ -0,0 +1 @@ +../../Task/Combinations/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Combinations-and-permutations b/Lang/Uiua/Combinations-and-permutations new file mode 120000 index 0000000000..c2af258e0d --- /dev/null +++ b/Lang/Uiua/Combinations-and-permutations @@ -0,0 +1 @@ +../../Task/Combinations-and-permutations/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Comma-quibbling b/Lang/Uiua/Comma-quibbling new file mode 120000 index 0000000000..20d89fa970 --- /dev/null +++ b/Lang/Uiua/Comma-quibbling @@ -0,0 +1 @@ +../../Task/Comma-quibbling/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Command-line-arguments b/Lang/Uiua/Command-line-arguments new file mode 120000 index 0000000000..d8dd4a464b --- /dev/null +++ b/Lang/Uiua/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Comments b/Lang/Uiua/Comments new file mode 120000 index 0000000000..c903ca1910 --- /dev/null +++ b/Lang/Uiua/Comments @@ -0,0 +1 @@ +../../Task/Comments/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Compare-a-list-of-strings b/Lang/Uiua/Compare-a-list-of-strings new file mode 120000 index 0000000000..7a7f8f4123 --- /dev/null +++ b/Lang/Uiua/Compare-a-list-of-strings @@ -0,0 +1 @@ +../../Task/Compare-a-list-of-strings/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Compare-length-of-two-strings b/Lang/Uiua/Compare-length-of-two-strings new file mode 120000 index 0000000000..ca614fc73a --- /dev/null +++ b/Lang/Uiua/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Continued-fraction b/Lang/Uiua/Continued-fraction new file mode 120000 index 0000000000..e2c428ddc0 --- /dev/null +++ b/Lang/Uiua/Continued-fraction @@ -0,0 +1 @@ +../../Task/Continued-fraction/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Convert-seconds-to-compound-duration b/Lang/Uiua/Convert-seconds-to-compound-duration new file mode 120000 index 0000000000..7c892696f2 --- /dev/null +++ b/Lang/Uiua/Convert-seconds-to-compound-duration @@ -0,0 +1 @@ +../../Task/Convert-seconds-to-compound-duration/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Conways-Game-of-Life b/Lang/Uiua/Conways-Game-of-Life new file mode 120000 index 0000000000..577dcf20b1 --- /dev/null +++ b/Lang/Uiua/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Copy-a-string b/Lang/Uiua/Copy-a-string new file mode 120000 index 0000000000..ecc8029f9f --- /dev/null +++ b/Lang/Uiua/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Count-in-factors b/Lang/Uiua/Count-in-factors new file mode 120000 index 0000000000..fee553f727 --- /dev/null +++ b/Lang/Uiua/Count-in-factors @@ -0,0 +1 @@ +../../Task/Count-in-factors/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Count-in-octal b/Lang/Uiua/Count-in-octal new file mode 120000 index 0000000000..8d3356f54e --- /dev/null +++ b/Lang/Uiua/Count-in-octal @@ -0,0 +1 @@ +../../Task/Count-in-octal/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Count-occurrences-of-a-substring b/Lang/Uiua/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..5aa05050f1 --- /dev/null +++ b/Lang/Uiua/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Count-the-coins b/Lang/Uiua/Count-the-coins new file mode 120000 index 0000000000..061cac0c44 --- /dev/null +++ b/Lang/Uiua/Count-the-coins @@ -0,0 +1 @@ +../../Task/Count-the-coins/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Cramers-rule b/Lang/Uiua/Cramers-rule new file mode 120000 index 0000000000..cdb9c1d147 --- /dev/null +++ b/Lang/Uiua/Cramers-rule @@ -0,0 +1 @@ +../../Task/Cramers-rule/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Create-a-two-dimensional-array-at-runtime b/Lang/Uiua/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..4ef285f54f --- /dev/null +++ b/Lang/Uiua/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Cuban-primes b/Lang/Uiua/Cuban-primes new file mode 120000 index 0000000000..36dfb34863 --- /dev/null +++ b/Lang/Uiua/Cuban-primes @@ -0,0 +1 @@ +../../Task/Cuban-primes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Cut-a-rectangle b/Lang/Uiua/Cut-a-rectangle new file mode 120000 index 0000000000..c91aef1334 --- /dev/null +++ b/Lang/Uiua/Cut-a-rectangle @@ -0,0 +1 @@ +../../Task/Cut-a-rectangle/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Damm-algorithm b/Lang/Uiua/Damm-algorithm new file mode 120000 index 0000000000..af8244172d --- /dev/null +++ b/Lang/Uiua/Damm-algorithm @@ -0,0 +1 @@ +../../Task/Damm-algorithm/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Day-of-the-week b/Lang/Uiua/Day-of-the-week new file mode 120000 index 0000000000..3e8980f9e6 --- /dev/null +++ b/Lang/Uiua/Day-of-the-week @@ -0,0 +1 @@ +../../Task/Day-of-the-week/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Delete-a-file b/Lang/Uiua/Delete-a-file new file mode 120000 index 0000000000..a33b49cc5b --- /dev/null +++ b/Lang/Uiua/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Department-numbers b/Lang/Uiua/Department-numbers new file mode 120000 index 0000000000..d3bc5b010c --- /dev/null +++ b/Lang/Uiua/Department-numbers @@ -0,0 +1 @@ +../../Task/Department-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Descending-primes b/Lang/Uiua/Descending-primes new file mode 120000 index 0000000000..9ae82c1998 --- /dev/null +++ b/Lang/Uiua/Descending-primes @@ -0,0 +1 @@ +../../Task/Descending-primes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Detect-division-by-zero b/Lang/Uiua/Detect-division-by-zero new file mode 120000 index 0000000000..40e2698013 --- /dev/null +++ b/Lang/Uiua/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Determine-if-a-string-has-all-the-same-characters b/Lang/Uiua/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..55e1bace7e --- /dev/null +++ b/Lang/Uiua/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Determine-if-a-string-has-all-unique-characters b/Lang/Uiua/Determine-if-a-string-has-all-unique-characters new file mode 120000 index 0000000000..76105a59e1 --- /dev/null +++ b/Lang/Uiua/Determine-if-a-string-has-all-unique-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-unique-characters/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Determine-if-a-string-is-collapsible b/Lang/Uiua/Determine-if-a-string-is-collapsible new file mode 120000 index 0000000000..9891000cca --- /dev/null +++ b/Lang/Uiua/Determine-if-a-string-is-collapsible @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-collapsible/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Determine-if-a-string-is-numeric b/Lang/Uiua/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..12d7b2bbd9 --- /dev/null +++ b/Lang/Uiua/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Digital-root b/Lang/Uiua/Digital-root new file mode 120000 index 0000000000..709355d0c9 --- /dev/null +++ b/Lang/Uiua/Digital-root @@ -0,0 +1 @@ +../../Task/Digital-root/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Dijkstras-algorithm b/Lang/Uiua/Dijkstras-algorithm new file mode 120000 index 0000000000..f3d03f9e62 --- /dev/null +++ b/Lang/Uiua/Dijkstras-algorithm @@ -0,0 +1 @@ +../../Task/Dijkstras-algorithm/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Disarium-numbers b/Lang/Uiua/Disarium-numbers new file mode 120000 index 0000000000..28107527a2 --- /dev/null +++ b/Lang/Uiua/Disarium-numbers @@ -0,0 +1 @@ +../../Task/Disarium-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Dominoes b/Lang/Uiua/Dominoes new file mode 120000 index 0000000000..bd5d6f0291 --- /dev/null +++ b/Lang/Uiua/Dominoes @@ -0,0 +1 @@ +../../Task/Dominoes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Doomsday-rule b/Lang/Uiua/Doomsday-rule new file mode 120000 index 0000000000..d408a1ec32 --- /dev/null +++ b/Lang/Uiua/Doomsday-rule @@ -0,0 +1 @@ +../../Task/Doomsday-rule/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Dot-product b/Lang/Uiua/Dot-product new file mode 120000 index 0000000000..920d49c003 --- /dev/null +++ b/Lang/Uiua/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Draw-a-pixel b/Lang/Uiua/Draw-a-pixel new file mode 120000 index 0000000000..675a36f131 --- /dev/null +++ b/Lang/Uiua/Draw-a-pixel @@ -0,0 +1 @@ +../../Task/Draw-a-pixel/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Dutch-national-flag-problem b/Lang/Uiua/Dutch-national-flag-problem new file mode 120000 index 0000000000..198949a01a --- /dev/null +++ b/Lang/Uiua/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Earliest-difference-between-prime-gaps b/Lang/Uiua/Earliest-difference-between-prime-gaps new file mode 120000 index 0000000000..3fd8b6678f --- /dev/null +++ b/Lang/Uiua/Earliest-difference-between-prime-gaps @@ -0,0 +1 @@ +../../Task/Earliest-difference-between-prime-gaps/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Echo-server b/Lang/Uiua/Echo-server new file mode 120000 index 0000000000..13818666c0 --- /dev/null +++ b/Lang/Uiua/Echo-server @@ -0,0 +1 @@ +../../Task/Echo-server/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Emirp-primes b/Lang/Uiua/Emirp-primes new file mode 120000 index 0000000000..277723b92d --- /dev/null +++ b/Lang/Uiua/Emirp-primes @@ -0,0 +1 @@ +../../Task/Emirp-primes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Empty-string b/Lang/Uiua/Empty-string new file mode 120000 index 0000000000..9b9da2a9b4 --- /dev/null +++ b/Lang/Uiua/Empty-string @@ -0,0 +1 @@ +../../Task/Empty-string/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Enforced-immutability b/Lang/Uiua/Enforced-immutability new file mode 120000 index 0000000000..243ebb8f2a --- /dev/null +++ b/Lang/Uiua/Enforced-immutability @@ -0,0 +1 @@ +../../Task/Enforced-immutability/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Enumerations b/Lang/Uiua/Enumerations new file mode 120000 index 0000000000..08a4a901fa --- /dev/null +++ b/Lang/Uiua/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Ethiopian-multiplication b/Lang/Uiua/Ethiopian-multiplication new file mode 120000 index 0000000000..4091de8f8e --- /dev/null +++ b/Lang/Uiua/Ethiopian-multiplication @@ -0,0 +1 @@ +../../Task/Ethiopian-multiplication/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Euler-method b/Lang/Uiua/Euler-method new file mode 120000 index 0000000000..7b2e3712d9 --- /dev/null +++ b/Lang/Uiua/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Exceptions b/Lang/Uiua/Exceptions new file mode 120000 index 0000000000..4cf4e7dfeb --- /dev/null +++ b/Lang/Uiua/Exceptions @@ -0,0 +1 @@ +../../Task/Exceptions/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Exponentiation-operator b/Lang/Uiua/Exponentiation-operator new file mode 120000 index 0000000000..bf3e3a41e0 --- /dev/null +++ b/Lang/Uiua/Exponentiation-operator @@ -0,0 +1 @@ +../../Task/Exponentiation-operator/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Exponentiation-order b/Lang/Uiua/Exponentiation-order new file mode 120000 index 0000000000..8518c14141 --- /dev/null +++ b/Lang/Uiua/Exponentiation-order @@ -0,0 +1 @@ +../../Task/Exponentiation-order/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Extreme-floating-point-values b/Lang/Uiua/Extreme-floating-point-values new file mode 120000 index 0000000000..05ab571554 --- /dev/null +++ b/Lang/Uiua/Extreme-floating-point-values @@ -0,0 +1 @@ +../../Task/Extreme-floating-point-values/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Factorial b/Lang/Uiua/Factorial new file mode 120000 index 0000000000..5664c30904 --- /dev/null +++ b/Lang/Uiua/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Factors-of-an-integer b/Lang/Uiua/Factors-of-an-integer new file mode 120000 index 0000000000..c83bd4a95a --- /dev/null +++ b/Lang/Uiua/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Fibonacci-sequence b/Lang/Uiua/Fibonacci-sequence new file mode 120000 index 0000000000..af3e864449 --- /dev/null +++ b/Lang/Uiua/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Fibonacci-word b/Lang/Uiua/Fibonacci-word new file mode 120000 index 0000000000..274cb69feb --- /dev/null +++ b/Lang/Uiua/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Find-the-missing-permutation b/Lang/Uiua/Find-the-missing-permutation new file mode 120000 index 0000000000..e1361833f3 --- /dev/null +++ b/Lang/Uiua/Find-the-missing-permutation @@ -0,0 +1 @@ +../../Task/Find-the-missing-permutation/Uiua \ No newline at end of file diff --git a/Lang/Uiua/First-perfect-square-in-base-n-with-n-unique-digits b/Lang/Uiua/First-perfect-square-in-base-n-with-n-unique-digits new file mode 120000 index 0000000000..aea271d3ce --- /dev/null +++ b/Lang/Uiua/First-perfect-square-in-base-n-with-n-unique-digits @@ -0,0 +1 @@ +../../Task/First-perfect-square-in-base-n-with-n-unique-digits/Uiua \ No newline at end of file diff --git a/Lang/Uiua/FizzBuzz b/Lang/Uiua/FizzBuzz new file mode 120000 index 0000000000..d2ead5e7e2 --- /dev/null +++ b/Lang/Uiua/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Flatten-a-list b/Lang/Uiua/Flatten-a-list new file mode 120000 index 0000000000..8d22eb4f6e --- /dev/null +++ b/Lang/Uiua/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Flipping-bits-game b/Lang/Uiua/Flipping-bits-game new file mode 120000 index 0000000000..4647df0617 --- /dev/null +++ b/Lang/Uiua/Flipping-bits-game @@ -0,0 +1 @@ +../../Task/Flipping-bits-game/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Floyds-triangle b/Lang/Uiua/Floyds-triangle new file mode 120000 index 0000000000..3d4c14194b --- /dev/null +++ b/Lang/Uiua/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Forest-fire b/Lang/Uiua/Forest-fire new file mode 120000 index 0000000000..1c1ded9f8f --- /dev/null +++ b/Lang/Uiua/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Greatest-common-divisor b/Lang/Uiua/Greatest-common-divisor new file mode 120000 index 0000000000..ed42b8017f --- /dev/null +++ b/Lang/Uiua/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Hailstone-sequence b/Lang/Uiua/Hailstone-sequence new file mode 120000 index 0000000000..eb6ae1ccd8 --- /dev/null +++ b/Lang/Uiua/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Halt-and-catch-fire b/Lang/Uiua/Halt-and-catch-fire new file mode 120000 index 0000000000..098009e021 --- /dev/null +++ b/Lang/Uiua/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Happy-numbers b/Lang/Uiua/Happy-numbers new file mode 120000 index 0000000000..c3bec99245 --- /dev/null +++ b/Lang/Uiua/Happy-numbers @@ -0,0 +1 @@ +../../Task/Happy-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Hash-from-two-arrays b/Lang/Uiua/Hash-from-two-arrays new file mode 120000 index 0000000000..63b4a8d5f8 --- /dev/null +++ b/Lang/Uiua/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Hickerson-series-of-almost-integers b/Lang/Uiua/Hickerson-series-of-almost-integers new file mode 120000 index 0000000000..d1dde8e508 --- /dev/null +++ b/Lang/Uiua/Hickerson-series-of-almost-integers @@ -0,0 +1 @@ +../../Task/Hickerson-series-of-almost-integers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Identity-matrix b/Lang/Uiua/Identity-matrix new file mode 120000 index 0000000000..73bc76c89c --- /dev/null +++ b/Lang/Uiua/Identity-matrix @@ -0,0 +1 @@ +../../Task/Identity-matrix/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Include-a-file b/Lang/Uiua/Include-a-file new file mode 120000 index 0000000000..2dd83554d2 --- /dev/null +++ b/Lang/Uiua/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Increment-a-numerical-string b/Lang/Uiua/Increment-a-numerical-string new file mode 120000 index 0000000000..5102531751 --- /dev/null +++ b/Lang/Uiua/Increment-a-numerical-string @@ -0,0 +1 @@ +../../Task/Increment-a-numerical-string/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Infinity b/Lang/Uiua/Infinity new file mode 120000 index 0000000000..13e94dd0ff --- /dev/null +++ b/Lang/Uiua/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Integer-sequence b/Lang/Uiua/Integer-sequence new file mode 120000 index 0000000000..71a2ec5539 --- /dev/null +++ b/Lang/Uiua/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Iterated-digits-squaring b/Lang/Uiua/Iterated-digits-squaring new file mode 120000 index 0000000000..e658bdae0a --- /dev/null +++ b/Lang/Uiua/Iterated-digits-squaring @@ -0,0 +1 @@ +../../Task/Iterated-digits-squaring/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Jacobi-symbol b/Lang/Uiua/Jacobi-symbol new file mode 120000 index 0000000000..c75e72b791 --- /dev/null +++ b/Lang/Uiua/Jacobi-symbol @@ -0,0 +1 @@ +../../Task/Jacobi-symbol/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Jacobsthal-numbers b/Lang/Uiua/Jacobsthal-numbers new file mode 120000 index 0000000000..18c3697b6e --- /dev/null +++ b/Lang/Uiua/Jacobsthal-numbers @@ -0,0 +1 @@ +../../Task/Jacobsthal-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Knuth-shuffle b/Lang/Uiua/Knuth-shuffle new file mode 120000 index 0000000000..eb2981b0ba --- /dev/null +++ b/Lang/Uiua/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Langtons-ant b/Lang/Uiua/Langtons-ant new file mode 120000 index 0000000000..ea25fbedff --- /dev/null +++ b/Lang/Uiua/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Largest-int-from-concatenated-ints b/Lang/Uiua/Largest-int-from-concatenated-ints new file mode 120000 index 0000000000..1440573f32 --- /dev/null +++ b/Lang/Uiua/Largest-int-from-concatenated-ints @@ -0,0 +1 @@ +../../Task/Largest-int-from-concatenated-ints/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Largest-number-divisible-by-its-digits b/Lang/Uiua/Largest-number-divisible-by-its-digits new file mode 120000 index 0000000000..acf7bb2c5f --- /dev/null +++ b/Lang/Uiua/Largest-number-divisible-by-its-digits @@ -0,0 +1 @@ +../../Task/Largest-number-divisible-by-its-digits/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Leap-year b/Lang/Uiua/Leap-year new file mode 120000 index 0000000000..526002b745 --- /dev/null +++ b/Lang/Uiua/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Least-common-multiple b/Lang/Uiua/Least-common-multiple new file mode 120000 index 0000000000..83973eef06 --- /dev/null +++ b/Lang/Uiua/Least-common-multiple @@ -0,0 +1 @@ +../../Task/Least-common-multiple/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Levenshtein-distance b/Lang/Uiua/Levenshtein-distance new file mode 120000 index 0000000000..2d4dd26520 --- /dev/null +++ b/Lang/Uiua/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Uiua \ No newline at end of file diff --git a/Lang/Uiua/List-comprehensions b/Lang/Uiua/List-comprehensions new file mode 120000 index 0000000000..bf7b708e56 --- /dev/null +++ b/Lang/Uiua/List-comprehensions @@ -0,0 +1 @@ +../../Task/List-comprehensions/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Literals-Floating-point b/Lang/Uiua/Literals-Floating-point new file mode 120000 index 0000000000..47d46d3181 --- /dev/null +++ b/Lang/Uiua/Literals-Floating-point @@ -0,0 +1 @@ +../../Task/Literals-Floating-point/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Look-and-say-sequence b/Lang/Uiua/Look-and-say-sequence new file mode 120000 index 0000000000..f3d748e2f9 --- /dev/null +++ b/Lang/Uiua/Look-and-say-sequence @@ -0,0 +1 @@ +../../Task/Look-and-say-sequence/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Loop-over-multiple-arrays-simultaneously b/Lang/Uiua/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..59937c5207 --- /dev/null +++ b/Lang/Uiua/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Loops-Break b/Lang/Uiua/Loops-Break new file mode 120000 index 0000000000..34504412c0 --- /dev/null +++ b/Lang/Uiua/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Loops-While b/Lang/Uiua/Loops-While new file mode 120000 index 0000000000..d29e38976b --- /dev/null +++ b/Lang/Uiua/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Luhn-test-of-credit-card-numbers b/Lang/Uiua/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..6eae093c92 --- /dev/null +++ b/Lang/Uiua/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/M-bius-function b/Lang/Uiua/M-bius-function new file mode 120000 index 0000000000..5b29f0bb61 --- /dev/null +++ b/Lang/Uiua/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Mandelbrot-set b/Lang/Uiua/Mandelbrot-set new file mode 120000 index 0000000000..da1b6d50fa --- /dev/null +++ b/Lang/Uiua/Mandelbrot-set @@ -0,0 +1 @@ +../../Task/Mandelbrot-set/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Matrix-multiplication b/Lang/Uiua/Matrix-multiplication new file mode 120000 index 0000000000..8ecd583efc --- /dev/null +++ b/Lang/Uiua/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Matrix-transposition b/Lang/Uiua/Matrix-transposition new file mode 120000 index 0000000000..877ca2d6ea --- /dev/null +++ b/Lang/Uiua/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Maze-generation b/Lang/Uiua/Maze-generation new file mode 120000 index 0000000000..b538448a1a --- /dev/null +++ b/Lang/Uiua/Maze-generation @@ -0,0 +1 @@ +../../Task/Maze-generation/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Maze-solving b/Lang/Uiua/Maze-solving new file mode 120000 index 0000000000..02af57731f --- /dev/null +++ b/Lang/Uiua/Maze-solving @@ -0,0 +1 @@ +../../Task/Maze-solving/Uiua \ No newline at end of file diff --git a/Lang/Uiua/McNuggets-problem b/Lang/Uiua/McNuggets-problem new file mode 120000 index 0000000000..93b54a1053 --- /dev/null +++ b/Lang/Uiua/McNuggets-problem @@ -0,0 +1 @@ +../../Task/McNuggets-problem/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Mertens-function b/Lang/Uiua/Mertens-function new file mode 120000 index 0000000000..8c5970d27b --- /dev/null +++ b/Lang/Uiua/Mertens-function @@ -0,0 +1 @@ +../../Task/Mertens-function/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Middle-three-digits b/Lang/Uiua/Middle-three-digits new file mode 120000 index 0000000000..5c8f171c17 --- /dev/null +++ b/Lang/Uiua/Middle-three-digits @@ -0,0 +1 @@ +../../Task/Middle-three-digits/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Modular-inverse b/Lang/Uiua/Modular-inverse new file mode 120000 index 0000000000..70c091b2ce --- /dev/null +++ b/Lang/Uiua/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Motzkin-numbers b/Lang/Uiua/Motzkin-numbers new file mode 120000 index 0000000000..bef04d5aa9 --- /dev/null +++ b/Lang/Uiua/Motzkin-numbers @@ -0,0 +1 @@ +../../Task/Motzkin-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Multifactorial b/Lang/Uiua/Multifactorial new file mode 120000 index 0000000000..cd3719d315 --- /dev/null +++ b/Lang/Uiua/Multifactorial @@ -0,0 +1 @@ +../../Task/Multifactorial/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Munchausen-numbers b/Lang/Uiua/Munchausen-numbers new file mode 120000 index 0000000000..2170e259d6 --- /dev/null +++ b/Lang/Uiua/Munchausen-numbers @@ -0,0 +1 @@ +../../Task/Munchausen-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Munching-squares b/Lang/Uiua/Munching-squares new file mode 120000 index 0000000000..65b5e765bd --- /dev/null +++ b/Lang/Uiua/Munching-squares @@ -0,0 +1 @@ +../../Task/Munching-squares/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Musical-scale b/Lang/Uiua/Musical-scale new file mode 120000 index 0000000000..1f1e1695ce --- /dev/null +++ b/Lang/Uiua/Musical-scale @@ -0,0 +1 @@ +../../Task/Musical-scale/Uiua \ No newline at end of file diff --git a/Lang/Uiua/N-queens-problem b/Lang/Uiua/N-queens-problem new file mode 120000 index 0000000000..d8b56e5e2a --- /dev/null +++ b/Lang/Uiua/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Narcissistic-decimal-number b/Lang/Uiua/Narcissistic-decimal-number new file mode 120000 index 0000000000..fa8d4f2d6a --- /dev/null +++ b/Lang/Uiua/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Next-highest-int-from-digits b/Lang/Uiua/Next-highest-int-from-digits new file mode 120000 index 0000000000..c924583411 --- /dev/null +++ b/Lang/Uiua/Next-highest-int-from-digits @@ -0,0 +1 @@ +../../Task/Next-highest-int-from-digits/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Non-continuous-subsequences b/Lang/Uiua/Non-continuous-subsequences new file mode 120000 index 0000000000..cbb45eef3a --- /dev/null +++ b/Lang/Uiua/Non-continuous-subsequences @@ -0,0 +1 @@ +../../Task/Non-continuous-subsequences/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Non-decimal-radices-Input b/Lang/Uiua/Non-decimal-radices-Input new file mode 120000 index 0000000000..4980368463 --- /dev/null +++ b/Lang/Uiua/Non-decimal-radices-Input @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Input/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Non-decimal-radices-Output b/Lang/Uiua/Non-decimal-radices-Output new file mode 120000 index 0000000000..8d901b62f2 --- /dev/null +++ b/Lang/Uiua/Non-decimal-radices-Output @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Output/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Numbers-which-are-not-the-sum-of-distinct-squares b/Lang/Uiua/Numbers-which-are-not-the-sum-of-distinct-squares new file mode 120000 index 0000000000..fd1772b308 --- /dev/null +++ b/Lang/Uiua/Numbers-which-are-not-the-sum-of-distinct-squares @@ -0,0 +1 @@ +../../Task/Numbers-which-are-not-the-sum-of-distinct-squares/Uiua \ No newline at end of file diff --git a/Lang/Uiua/One-dimensional-cellular-automata b/Lang/Uiua/One-dimensional-cellular-automata new file mode 120000 index 0000000000..5df7e9b84a --- /dev/null +++ b/Lang/Uiua/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Ordered-words b/Lang/Uiua/Ordered-words new file mode 120000 index 0000000000..7046edd964 --- /dev/null +++ b/Lang/Uiua/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Padovan-sequence b/Lang/Uiua/Padovan-sequence new file mode 120000 index 0000000000..5ff77d41cb --- /dev/null +++ b/Lang/Uiua/Padovan-sequence @@ -0,0 +1 @@ +../../Task/Padovan-sequence/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Palindrome-detection b/Lang/Uiua/Palindrome-detection new file mode 120000 index 0000000000..3b24028406 --- /dev/null +++ b/Lang/Uiua/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Pangram-checker b/Lang/Uiua/Pangram-checker new file mode 120000 index 0000000000..f48b39bf42 --- /dev/null +++ b/Lang/Uiua/Pangram-checker @@ -0,0 +1 @@ +../../Task/Pangram-checker/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Parsing-RPN-calculator-algorithm b/Lang/Uiua/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..650f272e3c --- /dev/null +++ b/Lang/Uiua/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Particle-fountain b/Lang/Uiua/Particle-fountain new file mode 120000 index 0000000000..5a4eedea1a --- /dev/null +++ b/Lang/Uiua/Particle-fountain @@ -0,0 +1 @@ +../../Task/Particle-fountain/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Partition-an-integer-x-into-n-primes b/Lang/Uiua/Partition-an-integer-x-into-n-primes new file mode 120000 index 0000000000..b54ce3d232 --- /dev/null +++ b/Lang/Uiua/Partition-an-integer-x-into-n-primes @@ -0,0 +1 @@ +../../Task/Partition-an-integer-x-into-n-primes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Partition-function-P b/Lang/Uiua/Partition-function-P new file mode 120000 index 0000000000..e15b2a3f0a --- /dev/null +++ b/Lang/Uiua/Partition-function-P @@ -0,0 +1 @@ +../../Task/Partition-function-P/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Pascal-matrix-generation b/Lang/Uiua/Pascal-matrix-generation new file mode 120000 index 0000000000..d6006d5f28 --- /dev/null +++ b/Lang/Uiua/Pascal-matrix-generation @@ -0,0 +1 @@ +../../Task/Pascal-matrix-generation/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Pascals-triangle b/Lang/Uiua/Pascals-triangle new file mode 120000 index 0000000000..d3ded33bae --- /dev/null +++ b/Lang/Uiua/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Pascals-triangle-Puzzle b/Lang/Uiua/Pascals-triangle-Puzzle new file mode 120000 index 0000000000..9d1c439151 --- /dev/null +++ b/Lang/Uiua/Pascals-triangle-Puzzle @@ -0,0 +1 @@ +../../Task/Pascals-triangle-Puzzle/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Password-generator b/Lang/Uiua/Password-generator new file mode 120000 index 0000000000..0a559819ad --- /dev/null +++ b/Lang/Uiua/Password-generator @@ -0,0 +1 @@ +../../Task/Password-generator/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Peaceful-chess-queen-armies b/Lang/Uiua/Peaceful-chess-queen-armies new file mode 120000 index 0000000000..e3e9bf7f31 --- /dev/null +++ b/Lang/Uiua/Peaceful-chess-queen-armies @@ -0,0 +1 @@ +../../Task/Peaceful-chess-queen-armies/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Perfect-numbers b/Lang/Uiua/Perfect-numbers new file mode 120000 index 0000000000..45883a0ea8 --- /dev/null +++ b/Lang/Uiua/Perfect-numbers @@ -0,0 +1 @@ +../../Task/Perfect-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Perfect-shuffle b/Lang/Uiua/Perfect-shuffle new file mode 120000 index 0000000000..85b9185041 --- /dev/null +++ b/Lang/Uiua/Perfect-shuffle @@ -0,0 +1 @@ +../../Task/Perfect-shuffle/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Perfect-totient-numbers b/Lang/Uiua/Perfect-totient-numbers new file mode 120000 index 0000000000..473a593e75 --- /dev/null +++ b/Lang/Uiua/Perfect-totient-numbers @@ -0,0 +1 @@ +../../Task/Perfect-totient-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Periodic-table b/Lang/Uiua/Periodic-table new file mode 120000 index 0000000000..5e6b72eb1b --- /dev/null +++ b/Lang/Uiua/Periodic-table @@ -0,0 +1 @@ +../../Task/Periodic-table/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Peripheral-drift-illusion b/Lang/Uiua/Peripheral-drift-illusion new file mode 120000 index 0000000000..6946c8b8f1 --- /dev/null +++ b/Lang/Uiua/Peripheral-drift-illusion @@ -0,0 +1 @@ +../../Task/Peripheral-drift-illusion/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Permutations b/Lang/Uiua/Permutations new file mode 120000 index 0000000000..850f4f7144 --- /dev/null +++ b/Lang/Uiua/Permutations @@ -0,0 +1 @@ +../../Task/Permutations/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Pernicious-numbers b/Lang/Uiua/Pernicious-numbers new file mode 120000 index 0000000000..bcc3ebf322 --- /dev/null +++ b/Lang/Uiua/Pernicious-numbers @@ -0,0 +1 @@ +../../Task/Pernicious-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Phrase-reversals b/Lang/Uiua/Phrase-reversals new file mode 120000 index 0000000000..4584c0fe62 --- /dev/null +++ b/Lang/Uiua/Phrase-reversals @@ -0,0 +1 @@ +../../Task/Phrase-reversals/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Pick-random-element b/Lang/Uiua/Pick-random-element new file mode 120000 index 0000000000..e85c1a21e1 --- /dev/null +++ b/Lang/Uiua/Pick-random-element @@ -0,0 +1 @@ +../../Task/Pick-random-element/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Pisano-period b/Lang/Uiua/Pisano-period new file mode 120000 index 0000000000..2e3ec789ad --- /dev/null +++ b/Lang/Uiua/Pisano-period @@ -0,0 +1 @@ +../../Task/Pisano-period/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Plasma-effect b/Lang/Uiua/Plasma-effect new file mode 120000 index 0000000000..ca73067f67 --- /dev/null +++ b/Lang/Uiua/Plasma-effect @@ -0,0 +1 @@ +../../Task/Plasma-effect/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Population-count b/Lang/Uiua/Population-count new file mode 120000 index 0000000000..601ac5e44a --- /dev/null +++ b/Lang/Uiua/Population-count @@ -0,0 +1 @@ +../../Task/Population-count/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Power-set b/Lang/Uiua/Power-set new file mode 120000 index 0000000000..21a40d792f --- /dev/null +++ b/Lang/Uiua/Power-set @@ -0,0 +1 @@ +../../Task/Power-set/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Primality-by-Wilsons-theorem b/Lang/Uiua/Primality-by-Wilsons-theorem new file mode 120000 index 0000000000..8e83e31c35 --- /dev/null +++ b/Lang/Uiua/Primality-by-Wilsons-theorem @@ -0,0 +1 @@ +../../Task/Primality-by-Wilsons-theorem/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Prime-conspiracy b/Lang/Uiua/Prime-conspiracy new file mode 120000 index 0000000000..d1cad5b5e0 --- /dev/null +++ b/Lang/Uiua/Prime-conspiracy @@ -0,0 +1 @@ +../../Task/Prime-conspiracy/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Prime-decomposition b/Lang/Uiua/Prime-decomposition new file mode 120000 index 0000000000..bdff89da46 --- /dev/null +++ b/Lang/Uiua/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Prime-numbers-whose-neighboring-pairs-are-tetraprimes b/Lang/Uiua/Prime-numbers-whose-neighboring-pairs-are-tetraprimes new file mode 120000 index 0000000000..fead595d8f --- /dev/null +++ b/Lang/Uiua/Prime-numbers-whose-neighboring-pairs-are-tetraprimes @@ -0,0 +1 @@ +../../Task/Prime-numbers-whose-neighboring-pairs-are-tetraprimes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Prime-triangle b/Lang/Uiua/Prime-triangle new file mode 120000 index 0000000000..59527b37eb --- /dev/null +++ b/Lang/Uiua/Prime-triangle @@ -0,0 +1 @@ +../../Task/Prime-triangle/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Program-termination b/Lang/Uiua/Program-termination new file mode 120000 index 0000000000..58f6f7fb66 --- /dev/null +++ b/Lang/Uiua/Program-termination @@ -0,0 +1 @@ +../../Task/Program-termination/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Proper-divisors b/Lang/Uiua/Proper-divisors new file mode 120000 index 0000000000..94a040a034 --- /dev/null +++ b/Lang/Uiua/Proper-divisors @@ -0,0 +1 @@ +../../Task/Proper-divisors/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Quoting-constructs b/Lang/Uiua/Quoting-constructs new file mode 120000 index 0000000000..0a39b9c1b8 --- /dev/null +++ b/Lang/Uiua/Quoting-constructs @@ -0,0 +1 @@ +../../Task/Quoting-constructs/Uiua \ No newline at end of file diff --git a/Lang/Uiua/RPG-attributes-generator b/Lang/Uiua/RPG-attributes-generator new file mode 120000 index 0000000000..96e8262b6d --- /dev/null +++ b/Lang/Uiua/RPG-attributes-generator @@ -0,0 +1 @@ +../../Task/RPG-attributes-generator/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Radical-of-an-integer b/Lang/Uiua/Radical-of-an-integer new file mode 120000 index 0000000000..dd623262df --- /dev/null +++ b/Lang/Uiua/Radical-of-an-integer @@ -0,0 +1 @@ +../../Task/Radical-of-an-integer/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Random-Latin-squares b/Lang/Uiua/Random-Latin-squares new file mode 120000 index 0000000000..1244042116 --- /dev/null +++ b/Lang/Uiua/Random-Latin-squares @@ -0,0 +1 @@ +../../Task/Random-Latin-squares/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Random-numbers b/Lang/Uiua/Random-numbers new file mode 120000 index 0000000000..bc115ba91a --- /dev/null +++ b/Lang/Uiua/Random-numbers @@ -0,0 +1 @@ +../../Task/Random-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Real-constants-and-functions b/Lang/Uiua/Real-constants-and-functions new file mode 120000 index 0000000000..fb71bc51b7 --- /dev/null +++ b/Lang/Uiua/Real-constants-and-functions @@ -0,0 +1 @@ +../../Task/Real-constants-and-functions/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Recamans-sequence b/Lang/Uiua/Recamans-sequence new file mode 120000 index 0000000000..fdc4665a6a --- /dev/null +++ b/Lang/Uiua/Recamans-sequence @@ -0,0 +1 @@ +../../Task/Recamans-sequence/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Repeat b/Lang/Uiua/Repeat new file mode 120000 index 0000000000..e75d6dc3ae --- /dev/null +++ b/Lang/Uiua/Repeat @@ -0,0 +1 @@ +../../Task/Repeat/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Reverse-words-in-a-string b/Lang/Uiua/Reverse-words-in-a-string new file mode 120000 index 0000000000..a6f43bc773 --- /dev/null +++ b/Lang/Uiua/Reverse-words-in-a-string @@ -0,0 +1 @@ +../../Task/Reverse-words-in-a-string/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Rosetta-Code-Rank-languages-by-popularity b/Lang/Uiua/Rosetta-Code-Rank-languages-by-popularity new file mode 120000 index 0000000000..582776a4d1 --- /dev/null +++ b/Lang/Uiua/Rosetta-Code-Rank-languages-by-popularity @@ -0,0 +1 @@ +../../Task/Rosetta-Code-Rank-languages-by-popularity/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Run-length-encoding b/Lang/Uiua/Run-length-encoding new file mode 120000 index 0000000000..b6eee5ca86 --- /dev/null +++ b/Lang/Uiua/Run-length-encoding @@ -0,0 +1 @@ +../../Task/Run-length-encoding/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Ruth-Aaron-numbers b/Lang/Uiua/Ruth-Aaron-numbers new file mode 120000 index 0000000000..bbf8bc039a --- /dev/null +++ b/Lang/Uiua/Ruth-Aaron-numbers @@ -0,0 +1 @@ +../../Task/Ruth-Aaron-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Sailors-coconuts-and-a-monkey-problem b/Lang/Uiua/Sailors-coconuts-and-a-monkey-problem new file mode 120000 index 0000000000..54e530d901 --- /dev/null +++ b/Lang/Uiua/Sailors-coconuts-and-a-monkey-problem @@ -0,0 +1 @@ +../../Task/Sailors-coconuts-and-a-monkey-problem/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Self-describing-numbers b/Lang/Uiua/Self-describing-numbers new file mode 120000 index 0000000000..158e71854a --- /dev/null +++ b/Lang/Uiua/Self-describing-numbers @@ -0,0 +1 @@ +../../Task/Self-describing-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Semordnilap b/Lang/Uiua/Semordnilap new file mode 120000 index 0000000000..5b5bcf0340 --- /dev/null +++ b/Lang/Uiua/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Sequence-of-primes-by-trial-division b/Lang/Uiua/Sequence-of-primes-by-trial-division new file mode 120000 index 0000000000..d94d81ea51 --- /dev/null +++ b/Lang/Uiua/Sequence-of-primes-by-trial-division @@ -0,0 +1 @@ +../../Task/Sequence-of-primes-by-trial-division/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Set-puzzle b/Lang/Uiua/Set-puzzle new file mode 120000 index 0000000000..3e3bc1d78f --- /dev/null +++ b/Lang/Uiua/Set-puzzle @@ -0,0 +1 @@ +../../Task/Set-puzzle/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Set-right-adjacent-bits b/Lang/Uiua/Set-right-adjacent-bits new file mode 120000 index 0000000000..902c125b59 --- /dev/null +++ b/Lang/Uiua/Set-right-adjacent-bits @@ -0,0 +1 @@ +../../Task/Set-right-adjacent-bits/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Sexy-primes b/Lang/Uiua/Sexy-primes new file mode 120000 index 0000000000..8d61a811ee --- /dev/null +++ b/Lang/Uiua/Sexy-primes @@ -0,0 +1 @@ +../../Task/Sexy-primes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Shoelace-formula-for-polygonal-area b/Lang/Uiua/Shoelace-formula-for-polygonal-area new file mode 120000 index 0000000000..d0a37fe60f --- /dev/null +++ b/Lang/Uiua/Shoelace-formula-for-polygonal-area @@ -0,0 +1 @@ +../../Task/Shoelace-formula-for-polygonal-area/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Smith-numbers b/Lang/Uiua/Smith-numbers new file mode 120000 index 0000000000..3e4afb53bf --- /dev/null +++ b/Lang/Uiua/Smith-numbers @@ -0,0 +1 @@ +../../Task/Smith-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Solve-a-Hidato-puzzle b/Lang/Uiua/Solve-a-Hidato-puzzle new file mode 120000 index 0000000000..961a795fe0 --- /dev/null +++ b/Lang/Uiua/Solve-a-Hidato-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Hidato-puzzle/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Solve-a-Numbrix-puzzle b/Lang/Uiua/Solve-a-Numbrix-puzzle new file mode 120000 index 0000000000..d5e755e9d5 --- /dev/null +++ b/Lang/Uiua/Solve-a-Numbrix-puzzle @@ -0,0 +1 @@ +../../Task/Solve-a-Numbrix-puzzle/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Sort-disjoint-sublist b/Lang/Uiua/Sort-disjoint-sublist new file mode 120000 index 0000000000..247b8fbb37 --- /dev/null +++ b/Lang/Uiua/Sort-disjoint-sublist @@ -0,0 +1 @@ +../../Task/Sort-disjoint-sublist/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Spiral-matrix b/Lang/Uiua/Spiral-matrix new file mode 120000 index 0000000000..58fe68a534 --- /dev/null +++ b/Lang/Uiua/Spiral-matrix @@ -0,0 +1 @@ +../../Task/Spiral-matrix/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Split-a-character-string-based-on-change-of-character b/Lang/Uiua/Split-a-character-string-based-on-change-of-character new file mode 120000 index 0000000000..61d4dd8555 --- /dev/null +++ b/Lang/Uiua/Split-a-character-string-based-on-change-of-character @@ -0,0 +1 @@ +../../Task/Split-a-character-string-based-on-change-of-character/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Square-free-integers b/Lang/Uiua/Square-free-integers new file mode 120000 index 0000000000..7a649e9779 --- /dev/null +++ b/Lang/Uiua/Square-free-integers @@ -0,0 +1 @@ +../../Task/Square-free-integers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Stack b/Lang/Uiua/Stack new file mode 120000 index 0000000000..0f1554438f --- /dev/null +++ b/Lang/Uiua/Stack @@ -0,0 +1 @@ +../../Task/Stack/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Stem-and-leaf-plot b/Lang/Uiua/Stem-and-leaf-plot new file mode 120000 index 0000000000..cfafe7201a --- /dev/null +++ b/Lang/Uiua/Stem-and-leaf-plot @@ -0,0 +1 @@ +../../Task/Stem-and-leaf-plot/Uiua \ No newline at end of file diff --git a/Lang/Uiua/String-case b/Lang/Uiua/String-case new file mode 120000 index 0000000000..4362c13413 --- /dev/null +++ b/Lang/Uiua/String-case @@ -0,0 +1 @@ +../../Task/String-case/Uiua \ No newline at end of file diff --git a/Lang/Uiua/String-concatenation b/Lang/Uiua/String-concatenation new file mode 120000 index 0000000000..cd5c2325bd --- /dev/null +++ b/Lang/Uiua/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Uiua \ No newline at end of file diff --git a/Lang/Uiua/String-interpolation-included- b/Lang/Uiua/String-interpolation-included- new file mode 120000 index 0000000000..e880f170b4 --- /dev/null +++ b/Lang/Uiua/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/Uiua \ No newline at end of file diff --git a/Lang/Uiua/String-matching b/Lang/Uiua/String-matching new file mode 120000 index 0000000000..d45ce27782 --- /dev/null +++ b/Lang/Uiua/String-matching @@ -0,0 +1 @@ +../../Task/String-matching/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Strip-a-set-of-characters-from-a-string b/Lang/Uiua/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..951d176969 --- /dev/null +++ b/Lang/Uiua/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Sudan-function b/Lang/Uiua/Sudan-function new file mode 120000 index 0000000000..afedd391cb --- /dev/null +++ b/Lang/Uiua/Sudan-function @@ -0,0 +1 @@ +../../Task/Sudan-function/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Sudoku b/Lang/Uiua/Sudoku new file mode 120000 index 0000000000..be7e18a94a --- /dev/null +++ b/Lang/Uiua/Sudoku @@ -0,0 +1 @@ +../../Task/Sudoku/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Sum-multiples-of-3-and-5 b/Lang/Uiua/Sum-multiples-of-3-and-5 new file mode 120000 index 0000000000..1949126562 --- /dev/null +++ b/Lang/Uiua/Sum-multiples-of-3-and-5 @@ -0,0 +1 @@ +../../Task/Sum-multiples-of-3-and-5/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Sum-of-elements-below-main-diagonal-of-matrix b/Lang/Uiua/Sum-of-elements-below-main-diagonal-of-matrix new file mode 120000 index 0000000000..37e45429c6 --- /dev/null +++ b/Lang/Uiua/Sum-of-elements-below-main-diagonal-of-matrix @@ -0,0 +1 @@ +../../Task/Sum-of-elements-below-main-diagonal-of-matrix/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Summarize-primes b/Lang/Uiua/Summarize-primes new file mode 120000 index 0000000000..4ad940883d --- /dev/null +++ b/Lang/Uiua/Summarize-primes @@ -0,0 +1 @@ +../../Task/Summarize-primes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Sylvesters-sequence b/Lang/Uiua/Sylvesters-sequence new file mode 120000 index 0000000000..859c7ca10b --- /dev/null +++ b/Lang/Uiua/Sylvesters-sequence @@ -0,0 +1 @@ +../../Task/Sylvesters-sequence/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Tau-function b/Lang/Uiua/Tau-function new file mode 120000 index 0000000000..314431f8dd --- /dev/null +++ b/Lang/Uiua/Tau-function @@ -0,0 +1 @@ +../../Task/Tau-function/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Test-a-function b/Lang/Uiua/Test-a-function new file mode 120000 index 0000000000..4e61b05504 --- /dev/null +++ b/Lang/Uiua/Test-a-function @@ -0,0 +1 @@ +../../Task/Test-a-function/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Tic-tac-toe b/Lang/Uiua/Tic-tac-toe new file mode 120000 index 0000000000..fc3b26168b --- /dev/null +++ b/Lang/Uiua/Tic-tac-toe @@ -0,0 +1 @@ +../../Task/Tic-tac-toe/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Total-circles-area b/Lang/Uiua/Total-circles-area new file mode 120000 index 0000000000..8c4d5c9021 --- /dev/null +++ b/Lang/Uiua/Total-circles-area @@ -0,0 +1 @@ +../../Task/Total-circles-area/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Totient-function b/Lang/Uiua/Totient-function new file mode 120000 index 0000000000..838bb52e2f --- /dev/null +++ b/Lang/Uiua/Totient-function @@ -0,0 +1 @@ +../../Task/Totient-function/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Towers-of-Hanoi b/Lang/Uiua/Towers-of-Hanoi new file mode 120000 index 0000000000..f6bb30b5b6 --- /dev/null +++ b/Lang/Uiua/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Trigonometric-functions b/Lang/Uiua/Trigonometric-functions new file mode 120000 index 0000000000..07a1fc051e --- /dev/null +++ b/Lang/Uiua/Trigonometric-functions @@ -0,0 +1 @@ +../../Task/Trigonometric-functions/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Truncatable-primes b/Lang/Uiua/Truncatable-primes new file mode 120000 index 0000000000..b02bf04462 --- /dev/null +++ b/Lang/Uiua/Truncatable-primes @@ -0,0 +1 @@ +../../Task/Truncatable-primes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Twelve-statements b/Lang/Uiua/Twelve-statements new file mode 120000 index 0000000000..6d385334dc --- /dev/null +++ b/Lang/Uiua/Twelve-statements @@ -0,0 +1 @@ +../../Task/Twelve-statements/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Unprimeable-numbers b/Lang/Uiua/Unprimeable-numbers new file mode 120000 index 0000000000..5a99955431 --- /dev/null +++ b/Lang/Uiua/Unprimeable-numbers @@ -0,0 +1 @@ +../../Task/Unprimeable-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Validate-International-Securities-Identification-Number b/Lang/Uiua/Validate-International-Securities-Identification-Number new file mode 120000 index 0000000000..6d28391590 --- /dev/null +++ b/Lang/Uiua/Validate-International-Securities-Identification-Number @@ -0,0 +1 @@ +../../Task/Validate-International-Securities-Identification-Number/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Van-Eck-sequence b/Lang/Uiua/Van-Eck-sequence new file mode 120000 index 0000000000..3a4a993f0b --- /dev/null +++ b/Lang/Uiua/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Voronoi-diagram b/Lang/Uiua/Voronoi-diagram new file mode 120000 index 0000000000..d3162948cc --- /dev/null +++ b/Lang/Uiua/Voronoi-diagram @@ -0,0 +1 @@ +../../Task/Voronoi-diagram/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Water-collected-between-towers b/Lang/Uiua/Water-collected-between-towers new file mode 120000 index 0000000000..cfd5fa722a --- /dev/null +++ b/Lang/Uiua/Water-collected-between-towers @@ -0,0 +1 @@ +../../Task/Water-collected-between-towers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Weird-numbers b/Lang/Uiua/Weird-numbers new file mode 120000 index 0000000000..3d24f8a95b --- /dev/null +++ b/Lang/Uiua/Weird-numbers @@ -0,0 +1 @@ +../../Task/Weird-numbers/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Wieferich-primes b/Lang/Uiua/Wieferich-primes new file mode 120000 index 0000000000..b9d2d78697 --- /dev/null +++ b/Lang/Uiua/Wieferich-primes @@ -0,0 +1 @@ +../../Task/Wieferich-primes/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Wireworld b/Lang/Uiua/Wireworld new file mode 120000 index 0000000000..eaa729b6f4 --- /dev/null +++ b/Lang/Uiua/Wireworld @@ -0,0 +1 @@ +../../Task/Wireworld/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Word-frequency b/Lang/Uiua/Word-frequency new file mode 120000 index 0000000000..f59b23af8e --- /dev/null +++ b/Lang/Uiua/Word-frequency @@ -0,0 +1 @@ +../../Task/Word-frequency/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Word-wheel b/Lang/Uiua/Word-wheel new file mode 120000 index 0000000000..f8bafcb6c7 --- /dev/null +++ b/Lang/Uiua/Word-wheel @@ -0,0 +1 @@ +../../Task/Word-wheel/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Yellowstone-sequence b/Lang/Uiua/Yellowstone-sequence new file mode 120000 index 0000000000..0bae4da70f --- /dev/null +++ b/Lang/Uiua/Yellowstone-sequence @@ -0,0 +1 @@ +../../Task/Yellowstone-sequence/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Zebra-puzzle b/Lang/Uiua/Zebra-puzzle new file mode 120000 index 0000000000..cd343323b4 --- /dev/null +++ b/Lang/Uiua/Zebra-puzzle @@ -0,0 +1 @@ +../../Task/Zebra-puzzle/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Zeckendorf-number-representation b/Lang/Uiua/Zeckendorf-number-representation new file mode 120000 index 0000000000..1748bf90ef --- /dev/null +++ b/Lang/Uiua/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Zhang-Suen-thinning-algorithm b/Lang/Uiua/Zhang-Suen-thinning-algorithm new file mode 120000 index 0000000000..a7e773ae5b --- /dev/null +++ b/Lang/Uiua/Zhang-Suen-thinning-algorithm @@ -0,0 +1 @@ +../../Task/Zhang-Suen-thinning-algorithm/Uiua \ No newline at end of file diff --git a/Lang/Uiua/Zig-zag-matrix b/Lang/Uiua/Zig-zag-matrix new file mode 120000 index 0000000000..3d79e2a814 --- /dev/null +++ b/Lang/Uiua/Zig-zag-matrix @@ -0,0 +1 @@ +../../Task/Zig-zag-matrix/Uiua \ No newline at end of file diff --git a/Lang/Ultimate++/00-LANG.txt b/Lang/Ultimate++/00-LANG.txt index b340f85de9..a819e23329 100644 --- a/Lang/Ultimate++/00-LANG.txt +++ b/Lang/Ultimate++/00-LANG.txt @@ -23,7 +23,7 @@ https://www.ultimatepp.org/www$uppweb$overview$en-us.html ==Language== This example is a hello world using the Upp namespace. - +
     #include 
     #include 
     
    @@ -39,7 +39,7 @@ CONSOLE_APP_MAIN
     	for(int i = 0; i < cmdline.GetCount(); i++) {
     	}
     }
    -
    +
    {{out}} @@ -51,7 +51,7 @@ and Hello World '''A+B B-A'''   - +
     #include 
     #include 
     #include 
    @@ -69,7 +69,7 @@ CONSOLE_APP_MAIN
     	for(int i = 0; i < cmdline.GetCount(); i++) {
     	}
     }
    -
    +
    {{out}} @@ -84,7 +84,7 @@ CONSOLE_APP_MAIN '''Conditional loop''' - +
     #include 
     #include 
     #include 
    @@ -108,7 +108,7 @@ CONSOLE_APP_MAIN
     	for(int i = 0; i < cmdline.GetCount(); i++) {
     	}
     }
    -
    +
    diff --git a/Lang/Unicon/Arithmetic-Complex b/Lang/Unicon/Arithmetic-Complex new file mode 120000 index 0000000000..c0d9431037 --- /dev/null +++ b/Lang/Unicon/Arithmetic-Complex @@ -0,0 +1 @@ +../../Task/Arithmetic-Complex/Unicon \ No newline at end of file diff --git a/Lang/Unicon/Circular-primes b/Lang/Unicon/Circular-primes new file mode 120000 index 0000000000..2ebcc862f3 --- /dev/null +++ b/Lang/Unicon/Circular-primes @@ -0,0 +1 @@ +../../Task/Circular-primes/Unicon \ No newline at end of file diff --git a/Lang/Unicon/Currency b/Lang/Unicon/Currency new file mode 120000 index 0000000000..42a6027848 --- /dev/null +++ b/Lang/Unicon/Currency @@ -0,0 +1 @@ +../../Task/Currency/Unicon \ No newline at end of file diff --git a/Lang/Unicon/Deceptive-numbers b/Lang/Unicon/Deceptive-numbers new file mode 120000 index 0000000000..74debdb49f --- /dev/null +++ b/Lang/Unicon/Deceptive-numbers @@ -0,0 +1 @@ +../../Task/Deceptive-numbers/Unicon \ No newline at end of file diff --git a/Lang/Unicon/Emirp-primes b/Lang/Unicon/Emirp-primes new file mode 120000 index 0000000000..63628f22b5 --- /dev/null +++ b/Lang/Unicon/Emirp-primes @@ -0,0 +1 @@ +../../Task/Emirp-primes/Unicon \ No newline at end of file diff --git a/Lang/Unicon/Equal-prime-and-composite-sums b/Lang/Unicon/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..108da6ee4a --- /dev/null +++ b/Lang/Unicon/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/Unicon \ No newline at end of file diff --git a/Lang/Unicon/Factorial-primes b/Lang/Unicon/Factorial-primes new file mode 120000 index 0000000000..2f492134d2 --- /dev/null +++ b/Lang/Unicon/Factorial-primes @@ -0,0 +1 @@ +../../Task/Factorial-primes/Unicon \ No newline at end of file diff --git a/Lang/Unicon/Fermat-numbers b/Lang/Unicon/Fermat-numbers new file mode 120000 index 0000000000..18314c4e86 --- /dev/null +++ b/Lang/Unicon/Fermat-numbers @@ -0,0 +1 @@ +../../Task/Fermat-numbers/Unicon \ No newline at end of file diff --git a/Lang/Unicon/Pell-numbers b/Lang/Unicon/Pell-numbers new file mode 120000 index 0000000000..1e5fe97247 --- /dev/null +++ b/Lang/Unicon/Pell-numbers @@ -0,0 +1 @@ +../../Task/Pell-numbers/Unicon \ No newline at end of file diff --git a/Lang/Unicon/Repunit-primes b/Lang/Unicon/Repunit-primes new file mode 120000 index 0000000000..a063ca9ca3 --- /dev/null +++ b/Lang/Unicon/Repunit-primes @@ -0,0 +1 @@ +../../Task/Repunit-primes/Unicon \ No newline at end of file diff --git a/Lang/Unicon/Ultra-useful-primes b/Lang/Unicon/Ultra-useful-primes new file mode 120000 index 0000000000..c78c99febd --- /dev/null +++ b/Lang/Unicon/Ultra-useful-primes @@ -0,0 +1 @@ +../../Task/Ultra-useful-primes/Unicon \ No newline at end of file diff --git a/Lang/Unicon/Unix-ls b/Lang/Unicon/Unix-ls new file mode 120000 index 0000000000..4501440ef6 --- /dev/null +++ b/Lang/Unicon/Unix-ls @@ -0,0 +1 @@ +../../Task/Unix-ls/Unicon \ No newline at end of file diff --git a/Lang/Unicon/Vector b/Lang/Unicon/Vector new file mode 120000 index 0000000000..2c82c9664f --- /dev/null +++ b/Lang/Unicon/Vector @@ -0,0 +1 @@ +../../Task/Vector/Unicon \ No newline at end of file diff --git a/Lang/Unicon/Wagstaff-primes b/Lang/Unicon/Wagstaff-primes new file mode 120000 index 0000000000..9aef3c7dca --- /dev/null +++ b/Lang/Unicon/Wagstaff-primes @@ -0,0 +1 @@ +../../Task/Wagstaff-primes/Unicon \ No newline at end of file diff --git a/Lang/Unison/Spiral-matrix b/Lang/Unison/Spiral-matrix new file mode 120000 index 0000000000..423c950e4b --- /dev/null +++ b/Lang/Unison/Spiral-matrix @@ -0,0 +1 @@ +../../Task/Spiral-matrix/Unison \ No newline at end of file diff --git a/Lang/UnixPipes/00-LANG.txt b/Lang/UnixPipes/00-LANG.txt index 8a315a0473..421b024690 100644 --- a/Lang/UnixPipes/00-LANG.txt +++ b/Lang/UnixPipes/00-LANG.txt @@ -13,7 +13,7 @@ Using utilities from, [http://packages.debian.org/unstable/utils/moreutils moreu Defining unfold as the opposite of xargs, i.e take a list of arguments and send them one at a time. The definition would be - + |cat unfold num=$1 while read xxx; do @@ -27,7 +27,7 @@ done 4 5 6 7 8 - + == Deleted solutions == We delete a UnixPipes solution when it is too similar to its UNIX Shell equivalent, or when it is incorrect (but the UNIX Shell solution is correct). diff --git a/Lang/Ursalang/00-LANG.txt b/Lang/Ursalang/00-LANG.txt new file mode 100644 index 0000000000..e32184663d --- /dev/null +++ b/Lang/Ursalang/00-LANG.txt @@ -0,0 +1,5 @@ +{{language|Ursalang|exec=interpreted|site=https://ursalang.github.io|gc=yes}} + +Ursalang, or Ursa for short, is a "friendly, stable, general-purpose programming language" according to its [https://ursalang.github.io/ web site]. At present, it is quite new, and not yet stable, but according to its [https://github.com/ursalang/ursa#readme README], "The intention is that once it reaches version 1, the language will not change or evolve further." + +Ursa is functional (the syntax consists only of expressions), and imperative (using constructs familiar from mainstream languages) with a familiar syntax similar to JavaScript. \ No newline at end of file diff --git a/Lang/Ursalang/00-META.yaml b/Lang/Ursalang/00-META.yaml new file mode 100644 index 0000000000..4057e32e38 --- /dev/null +++ b/Lang/Ursalang/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Ursalang diff --git a/Lang/Ursalang/Accumulator-factory b/Lang/Ursalang/Accumulator-factory new file mode 120000 index 0000000000..1ee5d49ce5 --- /dev/null +++ b/Lang/Ursalang/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Ackermann-function b/Lang/Ursalang/Ackermann-function new file mode 120000 index 0000000000..e0c86bfacd --- /dev/null +++ b/Lang/Ursalang/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Anagrams b/Lang/Ursalang/Anagrams new file mode 120000 index 0000000000..955e3f6b2d --- /dev/null +++ b/Lang/Ursalang/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Averages-Arithmetic-mean b/Lang/Ursalang/Averages-Arithmetic-mean new file mode 120000 index 0000000000..47e790e66c --- /dev/null +++ b/Lang/Ursalang/Averages-Arithmetic-mean @@ -0,0 +1 @@ +../../Task/Averages-Arithmetic-mean/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Averages-Mode b/Lang/Ursalang/Averages-Mode new file mode 120000 index 0000000000..3250a246da --- /dev/null +++ b/Lang/Ursalang/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Averages-Root-mean-square b/Lang/Ursalang/Averages-Root-mean-square new file mode 120000 index 0000000000..1acc742630 --- /dev/null +++ b/Lang/Ursalang/Averages-Root-mean-square @@ -0,0 +1 @@ +../../Task/Averages-Root-mean-square/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Conditional-structures b/Lang/Ursalang/Conditional-structures new file mode 120000 index 0000000000..e8c70b7da2 --- /dev/null +++ b/Lang/Ursalang/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/FizzBuzz b/Lang/Ursalang/FizzBuzz new file mode 120000 index 0000000000..7a0a8b495c --- /dev/null +++ b/Lang/Ursalang/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Generator-Exponential b/Lang/Ursalang/Generator-Exponential new file mode 120000 index 0000000000..4533fcc114 --- /dev/null +++ b/Lang/Ursalang/Generator-Exponential @@ -0,0 +1 @@ +../../Task/Generator-Exponential/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Hailstone-sequence b/Lang/Ursalang/Hailstone-sequence new file mode 120000 index 0000000000..fd3a016859 --- /dev/null +++ b/Lang/Ursalang/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Hello-world-Text b/Lang/Ursalang/Hello-world-Text new file mode 120000 index 0000000000..ddd916992f --- /dev/null +++ b/Lang/Ursalang/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Integer-sequence b/Lang/Ursalang/Integer-sequence new file mode 120000 index 0000000000..7bf5336c2c --- /dev/null +++ b/Lang/Ursalang/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Loops-Break b/Lang/Ursalang/Loops-Break new file mode 120000 index 0000000000..9956e0ecbe --- /dev/null +++ b/Lang/Ursalang/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Loops-Continue b/Lang/Ursalang/Loops-Continue new file mode 120000 index 0000000000..b92db2e19a --- /dev/null +++ b/Lang/Ursalang/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Loops-For b/Lang/Ursalang/Loops-For new file mode 120000 index 0000000000..11a1ba7e0e --- /dev/null +++ b/Lang/Ursalang/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Loops-While b/Lang/Ursalang/Loops-While new file mode 120000 index 0000000000..45dc0e4ade --- /dev/null +++ b/Lang/Ursalang/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Ursalang \ No newline at end of file diff --git a/Lang/Ursalang/Man-or-boy-test b/Lang/Ursalang/Man-or-boy-test new file mode 120000 index 0000000000..14bf7f1c8c --- /dev/null +++ b/Lang/Ursalang/Man-or-boy-test @@ -0,0 +1 @@ +../../Task/Man-or-boy-test/Ursalang \ No newline at end of file diff --git a/Lang/Uxntal/00-LANG.txt b/Lang/Uxntal/00-LANG.txt new file mode 100644 index 0000000000..29f2256564 --- /dev/null +++ b/Lang/Uxntal/00-LANG.txt @@ -0,0 +1,36 @@ +{{language|Uxntal}} + +''For unimplemented tasks see: [https://rosettacode.org/wiki/Tasks_not_implemented_in_Uxntal Uxntal Unimplemened]'' + +'''Uxntal''' is the assembly language for the Uxn virtual machine. The VM has 64KiB of addressable memory, two 256-byte stacks (data and return), and a 256-byte block of I/O ports, divided into 16 devices with 16 ports each. The Uxntal assembler features sub-labels, simple lambdas, user-defined macros, and shorthands for common immediate operations. + +== Uxn VM == + +The Uxn VM relies on stacks for managing data and control flow. There are two stacks, each containing up to 256 bytes - one for general data, and one for return addresses (or anything else you want to temporarily store there). Additionally, data can be read and written anywhere in the 64KiB main memory, including to parts of the code - self-modifying code is often useful in Uxn. + +For I/O, Uxn features two instructions DEO and DEI, which are used to access a separate block of 256 8-bit registers, split into 16 devices of 16 ports each. The Varvara specification defines a standard set of computing devices, including keyboard, mouse, and controller input, and video + audio outputs. + +The 256 opcodes are divided into 8 special instructions, and 31 regular instructions with 3 flags each. The special instructions, which can't take additional flags are: BRK (break), JCI, JMI, JSI, (immediate jumps), LIT, LIT2, LITr, LIT2r (integer literals). The flags on the regular instructions are: 2 (short mode), r (use return stack), and k (keep operands). The main instructions include general stack operations, load and store operations, arithmetic operations, and jumps, as well as the two I/O instructions mentioned above. + +== Syntax == + +
    +In concatenative programming, there are no precedence rules, the calculations are merely performed in the sequence in which they are presented. The order with which elements come off a stack is known as last in, first out. '''''— [https://wiki.xxiivv.com/site/uxntal_syntax.html Uxntal Syntax]''''' +
    + +Instructions are written in uppercase, followed by any combination of the three flags 2kr. Hex values are written with lowercase a-f. + +Code can be placed at specific addresses with the | rune, which is especially important for assembling the reset vector at address 0x100 (|0100) and for defining devices and zero-page variables. Padding can be inserted with the $ rune. + +Labels are created with @ and &. The difference is that @ creates a label with the given name, while & creates a sub-label by prefixing the most recent @label and a slash. + +For further details on Uxntal syntax, see the [https://wiki.xxiivv.com/site/uxntal_syntax.html syntax page] on the XXIIVV wiki. + +[[Category:Assembler_language]] +[[Category:Assembly]] +[[Category:Esoteric_Languages]] +[[Category:Execution_method/Compiled/Bytecode]] +[[Category:Programming_paradigm/Object-oriented]] +[[Category:Programming_paradigm/Concatenative]] +[[Category:Typing/Unsafe]] +[[Category:Typing/Untyped]] \ No newline at end of file diff --git a/Lang/Uxntal/00-META.yaml b/Lang/Uxntal/00-META.yaml new file mode 100644 index 0000000000..099ea875db --- /dev/null +++ b/Lang/Uxntal/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Uxntal diff --git a/Lang/Uxntal/99-bottles-of-beer b/Lang/Uxntal/99-bottles-of-beer new file mode 120000 index 0000000000..89fe8eecd6 --- /dev/null +++ b/Lang/Uxntal/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Array-length b/Lang/Uxntal/Array-length new file mode 120000 index 0000000000..438c43e439 --- /dev/null +++ b/Lang/Uxntal/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Bitwise-operations b/Lang/Uxntal/Bitwise-operations new file mode 120000 index 0000000000..41621bed6f --- /dev/null +++ b/Lang/Uxntal/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Chaos-game b/Lang/Uxntal/Chaos-game new file mode 120000 index 0000000000..80920dd6ff --- /dev/null +++ b/Lang/Uxntal/Chaos-game @@ -0,0 +1 @@ +../../Task/Chaos-game/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Character-codes b/Lang/Uxntal/Character-codes new file mode 120000 index 0000000000..28a68bb2bb --- /dev/null +++ b/Lang/Uxntal/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Colour-bars-Display b/Lang/Uxntal/Colour-bars-Display new file mode 120000 index 0000000000..68d09e27cb --- /dev/null +++ b/Lang/Uxntal/Colour-bars-Display @@ -0,0 +1 @@ +../../Task/Colour-bars-Display/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Colour-pinstripe-Display b/Lang/Uxntal/Colour-pinstripe-Display new file mode 120000 index 0000000000..e66d8cf058 --- /dev/null +++ b/Lang/Uxntal/Colour-pinstripe-Display @@ -0,0 +1 @@ +../../Task/Colour-pinstripe-Display/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Comments b/Lang/Uxntal/Comments new file mode 120000 index 0000000000..b23db936ba --- /dev/null +++ b/Lang/Uxntal/Comments @@ -0,0 +1 @@ +../../Task/Comments/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Conditional-structures b/Lang/Uxntal/Conditional-structures new file mode 120000 index 0000000000..75d2f67746 --- /dev/null +++ b/Lang/Uxntal/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Copy-a-string b/Lang/Uxntal/Copy-a-string new file mode 120000 index 0000000000..00610fac74 --- /dev/null +++ b/Lang/Uxntal/Copy-a-string @@ -0,0 +1 @@ +../../Task/Copy-a-string/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Factorial b/Lang/Uxntal/Factorial new file mode 120000 index 0000000000..54fbd0e5fa --- /dev/null +++ b/Lang/Uxntal/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Fibonacci-sequence b/Lang/Uxntal/Fibonacci-sequence new file mode 120000 index 0000000000..7795c4564a --- /dev/null +++ b/Lang/Uxntal/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/File-input-output b/Lang/Uxntal/File-input-output new file mode 120000 index 0000000000..62c0978bde --- /dev/null +++ b/Lang/Uxntal/File-input-output @@ -0,0 +1 @@ +../../Task/File-input-output/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Find-limit-of-recursion b/Lang/Uxntal/Find-limit-of-recursion new file mode 120000 index 0000000000..469da2fb7d --- /dev/null +++ b/Lang/Uxntal/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Flow-control-structures b/Lang/Uxntal/Flow-control-structures new file mode 120000 index 0000000000..db95ed817d --- /dev/null +++ b/Lang/Uxntal/Flow-control-structures @@ -0,0 +1 @@ +../../Task/Flow-control-structures/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Hello-world-Graphical b/Lang/Uxntal/Hello-world-Graphical new file mode 120000 index 0000000000..2a5fadb101 --- /dev/null +++ b/Lang/Uxntal/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Hello-world-Newline-omission b/Lang/Uxntal/Hello-world-Newline-omission new file mode 120000 index 0000000000..3c0e2f741b --- /dev/null +++ b/Lang/Uxntal/Hello-world-Newline-omission @@ -0,0 +1 @@ +../../Task/Hello-world-Newline-omission/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Hello-world-Standard-error b/Lang/Uxntal/Hello-world-Standard-error new file mode 120000 index 0000000000..be0ab3efa0 --- /dev/null +++ b/Lang/Uxntal/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Integer-sequence b/Lang/Uxntal/Integer-sequence new file mode 120000 index 0000000000..6d76150081 --- /dev/null +++ b/Lang/Uxntal/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Literals-Integer b/Lang/Uxntal/Literals-Integer new file mode 120000 index 0000000000..cdcaff26dd --- /dev/null +++ b/Lang/Uxntal/Literals-Integer @@ -0,0 +1 @@ +../../Task/Literals-Integer/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Loops-Break b/Lang/Uxntal/Loops-Break new file mode 120000 index 0000000000..5d6d57196c --- /dev/null +++ b/Lang/Uxntal/Loops-Break @@ -0,0 +1 @@ +../../Task/Loops-Break/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Loops-Continue b/Lang/Uxntal/Loops-Continue new file mode 120000 index 0000000000..88d5768874 --- /dev/null +++ b/Lang/Uxntal/Loops-Continue @@ -0,0 +1 @@ +../../Task/Loops-Continue/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Loops-Do-while b/Lang/Uxntal/Loops-Do-while new file mode 120000 index 0000000000..a3d655278d --- /dev/null +++ b/Lang/Uxntal/Loops-Do-while @@ -0,0 +1 @@ +../../Task/Loops-Do-while/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Loops-For-with-a-specified-step b/Lang/Uxntal/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..4f79f37c9f --- /dev/null +++ b/Lang/Uxntal/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Loops-Foreach b/Lang/Uxntal/Loops-Foreach new file mode 120000 index 0000000000..f8f61da6a7 --- /dev/null +++ b/Lang/Uxntal/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Loops-Infinite b/Lang/Uxntal/Loops-Infinite new file mode 120000 index 0000000000..d61da1ed4f --- /dev/null +++ b/Lang/Uxntal/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Loops-N-plus-one-half b/Lang/Uxntal/Loops-N-plus-one-half new file mode 120000 index 0000000000..f7ee606c95 --- /dev/null +++ b/Lang/Uxntal/Loops-N-plus-one-half @@ -0,0 +1 @@ +../../Task/Loops-N-plus-one-half/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Loops-While b/Lang/Uxntal/Loops-While new file mode 120000 index 0000000000..f8307c2951 --- /dev/null +++ b/Lang/Uxntal/Loops-While @@ -0,0 +1 @@ +../../Task/Loops-While/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Mouse-position b/Lang/Uxntal/Mouse-position new file mode 120000 index 0000000000..9b9db4cee2 --- /dev/null +++ b/Lang/Uxntal/Mouse-position @@ -0,0 +1 @@ +../../Task/Mouse-position/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Quine b/Lang/Uxntal/Quine new file mode 120000 index 0000000000..9f3a4ca4d4 --- /dev/null +++ b/Lang/Uxntal/Quine @@ -0,0 +1 @@ +../../Task/Quine/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Rot-13 b/Lang/Uxntal/Rot-13 new file mode 120000 index 0000000000..e4b6e170be --- /dev/null +++ b/Lang/Uxntal/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Sierpinski-triangle b/Lang/Uxntal/Sierpinski-triangle new file mode 120000 index 0000000000..0c0c7f90eb --- /dev/null +++ b/Lang/Uxntal/Sierpinski-triangle @@ -0,0 +1 @@ +../../Task/Sierpinski-triangle/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Stack-traces b/Lang/Uxntal/Stack-traces new file mode 120000 index 0000000000..0b9cf24839 --- /dev/null +++ b/Lang/Uxntal/Stack-traces @@ -0,0 +1 @@ +../../Task/Stack-traces/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/String-concatenation b/Lang/Uxntal/String-concatenation new file mode 120000 index 0000000000..98d04ecd8b --- /dev/null +++ b/Lang/Uxntal/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/String-length b/Lang/Uxntal/String-length new file mode 120000 index 0000000000..8dd88d3b90 --- /dev/null +++ b/Lang/Uxntal/String-length @@ -0,0 +1 @@ +../../Task/String-length/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Sum-digits-of-an-integer b/Lang/Uxntal/Sum-digits-of-an-integer new file mode 120000 index 0000000000..dce70a945e --- /dev/null +++ b/Lang/Uxntal/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Towers-of-Hanoi b/Lang/Uxntal/Towers-of-Hanoi new file mode 120000 index 0000000000..8aab4983ec --- /dev/null +++ b/Lang/Uxntal/Towers-of-Hanoi @@ -0,0 +1 @@ +../../Task/Towers-of-Hanoi/Uxntal \ No newline at end of file diff --git a/Lang/Uxntal/Weird-numbers b/Lang/Uxntal/Weird-numbers new file mode 120000 index 0000000000..1bddac81d2 --- /dev/null +++ b/Lang/Uxntal/Weird-numbers @@ -0,0 +1 @@ +../../Task/Weird-numbers/Uxntal \ No newline at end of file diff --git a/Lang/V-(Vlang)/00-LANG.txt b/Lang/V-(Vlang)/00-LANG.txt index c6f78f0d01..56c1cc8279 100644 --- a/Lang/V-(Vlang)/00-LANG.txt +++ b/Lang/V-(Vlang)/00-LANG.txt @@ -1,88 +1,81 @@ {{language|V (Vlang) +|exec=machine |gc=allowed |checking=static +|safety=safe |strength=strong |site=https://vlang.io -}}The V Programming Language +|hopl=no +}} +{{provides|Concurrency}}{{provides|File access}}{{provides|File system access}}{{provides|First class functions}}{{provides|Network access}}{{provides|Objects}}{{provides|Signal handling}}{{language programming paradigm|concurrent}}{{language programming paradigm|Generic}}{{language programming paradigm|Imperative}} +The V Programming Language ''Simple, fast, safe, compiled. For developing maintainable software.''

    -'''Note: V is also known as Vlang. There was a language naming collision, so V (Vlang) was chosen.''' +'''Note: V (or Vlang). There was a language naming collision, so V (Vlang) was chosen.''' V (Vlang) is used here on Rosetta Code to disambiguate from the other language called [[:Category:V|V]]. +V is an easier to learn, read, and use language. + [https://vlang.io V] first appeared in 2019 in a trial web sandbox, "The V Playground". -V sources are published at [https://github.com/vlang/v GitHub], presently on version [https://github.com/vlang/v/releases 0.4.x]. +V's design and history has been influenced by Go, C, Oberon, Rust, Swift, Kotlin, and Python. -V is an easier to learn, read, and use language. Its design has been influenced by Go, Oberon, Rust, Swift, Kotlin, and Python. Documentation can be found [https://github.com/vlang/v/blob/master/doc/docs.md here]. +V's sources are published at [https://github.com/vlang/v GitHub], presently on version [https://github.com/vlang/v/releases 0.5.x]. -V's compiler tool is similar in implementation to a multi purpose command processor. +V's [https://github.com/vlang/v/wiki/FAQ FAQ] and [https://github.com/vlang/v/blob/master/ROADMAP.md roadmap] to see its validity, promise, and delivery of features. -https://vlang.io +V's compiler tool is similar in implementation to a multi purpose command processor: ''prompt$ v help'' -''prompt$ v help'' - -...for more information on V and the ''v'' compiler tool. +V language review and documentation is [https://github.com/vlang/v/blob/master/doc/docs.md here] for the professional, student, or as a hobby. ==Helpful links== -* [https://www.youtube.com/watch?v=ZO3vlwqvTrc Overview and introduction to Vlang] by Erdet Nasufi -* [https://www.youtube.com/watch?v=_dIAcNp9bJs Overview and presentation about Vlang] for IBM +* [https://en.everybodywiki.com/V_(programming_language) V in Wiki] +* [https://www.youtube.com/watch?v=ZO3vlwqvTrc V language overview and introduction] by Erdet Nasufi +* [https://www.youtube.com/watch?v=pchEsYwA74Q V language overview and introduction] on behalf of the Sydney Computing Society +* [https://www.youtube.com/watch?v=_dIAcNp9bJs V language overview and presentation] for IBM * Some of the code snippets are available at the archived [//github.com/v-community/v_rosetta V-Community (V Rosetta) GitHub] +* For venturing into how to contribute, join, or help the V project can be found [https://github.com/vlang/v/blob/master/CONTRIBUTING.md#how-to-help-and-contribute-to-the-v-project here]. * More info on the below can be found at [https://modules.vlang.io/ modules used by V] {| class="wikitable" -! No. !! Module name !! !! No. !! Module name +! No. !! Module name !! !! No. !! Module name !! !! No. !! Module name |- -| 1 || [https://rosettacode.org/wiki/Category:Vlang-arrays arrays] || || 2 || [https://rosettacode.org/wiki/Category:Vlang-benchmark benchmark] +| 1 || [https://modules.vlang.io/arrays.html arrays] || || 2 || [https://modules.vlang.io/benchmark.html benchmark] || || 3 || [https://modules.vlang.io/bitfield.html bifield] |- -| 3 || [https://rosettacode.org/wiki/Category:Vlang-bifield bifield] || || 4 || [https://rosettacode.org/wiki/Category:Vlang-cli cli] +| 4 || [https://modules.vlang.io/cli.html cli] || || 5 || [https://modules.vlang.io/clipboard.html clipboard] || || 6 || [https://modules.vlang.io/compress.html compress] |- -| 5 || [https://rosettacode.org/wiki/Category:Vlang-clipboard clipboard] || || 6 || [https://rosettacode.org/wiki/Category:Vlang-compress compress] +| 7 || [https://modules.vlang.io/context.html context] || || 8 || [https://modules.vlang.io/crypto.html crypto] || || 9 || [https://modules.vlang.io/net.websocket.html websocket] |- -| 7 || [https://rosettacode.org/wiki/Category:Vlang-context context] || || 8 || [https://rosettacode.org/wiki/Category:Vlang-crypto crypto] +| 10 || [https://modules.vlang.io/datatypes.html datatypes] || || 11 || [https://modules.vlang.io/main.html main] || || 12 || [https://modules.vlang.io/dl.html dl] |- -| 9 || [https://rosettacode.org/wiki/Category:Vlang-darwin darwin] || || 10 || [https://rosettacode.org/wiki/Category:Vlang-datatypes datatypes] +| 13 || [https://modules.vlang.io/dlmalloc.html dlmalloc] || || 14 || [https://modules.vlang.io/encoding.html encoding] || || 15 || [https://modules.vlang.io/eventbus.html eventbus] |- -| 11 || [https://rosettacode.org/wiki/Category:Vlang-main main] || || 12 || [https://rosettacode.org/wiki/Category:Vlang-dl dl] +| 16 || [https://modules.vlang.io/flag.html flag] || || 17 || [https://modules.vlang.io/fontstash.html fontstash] || || 18 || [https://modules.vlang.io/gg.html gg] |- -| 13 || [https://rosettacode.org/wiki/Category:Vlang-dlmalloc dlmalloc] || || 14 || [https://rosettacode.org/wiki/Category:Vlang-encoding encoding] +| 19 || [https://modules.vlang.io/gx.html gx] || || 20 || [https://modules.vlang.io/hash.html hash] || || 21 || [https://modules.vlang.io/io.html io] |- -| 15 || [https://rosettacode.org/wiki/Category:Vlang-eventbus eventbus] || || 16 || [https://rosettacode.org/wiki/Category:Vlang-flag flag] +| 22 || [https://modules.vlang.io/json.html json] || || 23 || [https://modules.vlang.io/log.html log] || || 24 || [https://modules.vlang.io/math.html math] |- -| 17 || [https://rosettacode.org/wiki/Category:Vlang-fontstash fontstash] || || 18 || [https://rosettacode.org/wiki/Category:Vlang-gg gg] +| 25 || [https://modules.vlang.io/db.mssql.html mssql] || || 26 || [https://modules.vlang.io/db.mysql.html mysql] || || 27 || [https://modules.vlang.io/net.html net] |- -| 19 || [https://rosettacode.org/wiki/Category:Vlang-gx gx] || || 20 || [https://rosettacode.org/wiki/Category:Vlang-crypto hash] +| 28 || [https://modules.vlang.io/orm.html orm] || || 29 || [https://modules.vlang.io/os.html os] || || 30 || [https://modules.vlang.io/pg.html pg] |- -| 21 || [https://rosettacode.org/wiki/Category:Vlang-io io] || || 22 || [https://rosettacode.org/wiki/Category:Vlang-json json] +| 31 || [https://modules.vlang.io/picoev.html picoev] || || 32 || [https://modules.vlang.io/veb.html veb] || || 33 || [https://modules.vlang.io/picohttpparser.html picohttpparser] |- -| 23 || [https://rosettacode.org/wiki/Category:Vlang-log log] || || 24 || [https://rosettacode.org/wiki/Category:Vlang-math math] +| 34 || [https://modules.vlang.io/rand.html rand]|| || 35 || [https://modules.vlang.io/readline.html readline] || || 36 || [https://modules.vlang.io/regex.html regex] |- -| 25 || [https://rosettacode.org/wiki/Category:Vlang-mssql mssql] || || 26 || [https://rosettacode.org/wiki/Category:Vlang-mysql mysql] +| 37 || [https://modules.vlang.io/runtime.html runtime] || || 38 || [https://modules.vlang.io/semver.html semver] || || 39 || [https://modules.vlang.io/sokol.sapp.html sokol.sapp] |- -| 27 || [https://rosettacode.org/wiki/Category:Vlang-net net] || || 28 || [https://rosettacode.org/wiki/Category:Vlang-orm orm] +| 40 || [https://modules.vlang.io/db.sqlite.html sqlite] || || 41 || [https://modules.vlang.io/stbi.html stbi] || || 42 || [https://modules.vlang.io/strconv.html strconv] |- -| 29 || [https://rosettacode.org/wiki/Category:Vlang-os os] || || 30 || [https://rosettacode.org/wiki/Category:Vlang-pg pg] +| 43 || [https://modules.vlang.io/strings.html strings] || || 44 || [https://modules.vlang.io/sync.html sync] || || 45 || [https://modules.vlang.io/szip.html szip] |- -| 31 || [https://rosettacode.org/wiki/Category:Vlang-picoev picoev] || || 32 || [https://rosettacode.org/wiki/Category:Vlang-event picoev] +| 46 || [https://modules.vlang.io/term.html term] || || 47 || [https://modules.vlang.io/time.html time] || || 48 || [https://modules.vlang.io/toml.html toml] |- -| 33 || [https://rosettacode.org/wiki/Category:Vlang-picohttpparser picohttpparser] || || 34 || [https://rosettacode.org/wiki/Category:Vlang-rand rand] -|- -| 35 || [https://rosettacode.org/wiki/Category:Vlang-readline readline] || || 36 || [https://rosettacode.org/wiki/Category:Vlang-regex regex] -|- -| 37 || [https://rosettacode.org/wiki/Category:Vlang-runtime runtime] || || 38 || [https://rosettacode.org/wiki/Category:Vlang-semver semver] -|- -| 39 || [https://rosettacode.org/wiki/Category:Vlang-sokol sokol] || || 40 || [https://rosettacode.org/wiki/Category:Vlang-sqlite sqlite] -|- -| 41 || [https://rosettacode.org/wiki/Category:Vlang-stbi stbi] || || 42 || [https://rosettacode.org/wiki/Category:Vlang-strconv strconv] -|- -| 43 || [https://rosettacode.org/wiki/Category:Vlang-strings strings] || || 44 || [https://rosettacode.org/wiki/Category:Vlang-sync sync] -|- -| 45 || [https://rosettacode.org/wiki/Category:Vlang-szip szip] || || 46 || [https://rosettacode.org/wiki/Category:Vlang-term term] -|- -| 47 || [https://rosettacode.org/wiki/Category:Vlang-time time] || || 48 || [https://rosettacode.org/wiki/Category:Vlang-toml toml] -|- -| 49 || [https://rosettacode.org/wiki/Category:Vlang-vweb vweb] || || 50 || [https://rosettacode.org/wiki/Category:Vlang-wasm wasm] +| 49 || [https://modules.vlang.io/vweb.html vweb] || || 50 || [https://modules.vlang.io/wasm.html wasm] || || 51 || [https://modules.vlang.io/maps.html maps] |- +| 52 || [https://modules.vlang.io/sokol.audio.html sokol.audio] || || 53 || [https://modules.vlang.io/x.ttf.html ttf] || || 54 || [https://modules.vlang.io/x.json2.html json2] |} \ No newline at end of file diff --git a/Lang/V-(Vlang)/15-puzzle-solver b/Lang/V-(Vlang)/15-puzzle-solver new file mode 120000 index 0000000000..9193bcde1c --- /dev/null +++ b/Lang/V-(Vlang)/15-puzzle-solver @@ -0,0 +1 @@ +../../Task/15-puzzle-solver/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Accumulator-factory b/Lang/V-(Vlang)/Accumulator-factory new file mode 120000 index 0000000000..20257d9d8b --- /dev/null +++ b/Lang/V-(Vlang)/Accumulator-factory @@ -0,0 +1 @@ +../../Task/Accumulator-factory/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Add-a-variable-to-a-class-instance-at-runtime b/Lang/V-(Vlang)/Add-a-variable-to-a-class-instance-at-runtime new file mode 120000 index 0000000000..dccc76d376 --- /dev/null +++ b/Lang/V-(Vlang)/Add-a-variable-to-a-class-instance-at-runtime @@ -0,0 +1 @@ +../../Task/Add-a-variable-to-a-class-instance-at-runtime/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Animate-a-pendulum b/Lang/V-(Vlang)/Animate-a-pendulum new file mode 120000 index 0000000000..87bb2b5f80 --- /dev/null +++ b/Lang/V-(Vlang)/Animate-a-pendulum @@ -0,0 +1 @@ +../../Task/Animate-a-pendulum/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Apply-a-callback-to-an-array b/Lang/V-(Vlang)/Apply-a-callback-to-an-array new file mode 120000 index 0000000000..8b7f34e888 --- /dev/null +++ b/Lang/V-(Vlang)/Apply-a-callback-to-an-array @@ -0,0 +1 @@ +../../Task/Apply-a-callback-to-an-array/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Approximate-equality b/Lang/V-(Vlang)/Approximate-equality new file mode 120000 index 0000000000..ba99a599b6 --- /dev/null +++ b/Lang/V-(Vlang)/Approximate-equality @@ -0,0 +1 @@ +../../Task/Approximate-equality/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Archimedean-spiral b/Lang/V-(Vlang)/Archimedean-spiral new file mode 120000 index 0000000000..0915aa0768 --- /dev/null +++ b/Lang/V-(Vlang)/Archimedean-spiral @@ -0,0 +1 @@ +../../Task/Archimedean-spiral/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Arithmetic-derivative b/Lang/V-(Vlang)/Arithmetic-derivative new file mode 120000 index 0000000000..0d28ff0c59 --- /dev/null +++ b/Lang/V-(Vlang)/Arithmetic-derivative @@ -0,0 +1 @@ +../../Task/Arithmetic-derivative/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Best-shuffle b/Lang/V-(Vlang)/Best-shuffle new file mode 120000 index 0000000000..a5a48fba81 --- /dev/null +++ b/Lang/V-(Vlang)/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Bioinformatics-base-count b/Lang/V-(Vlang)/Bioinformatics-base-count deleted file mode 120000 index 93867218eb..0000000000 --- a/Lang/V-(Vlang)/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Bitcoin-address-validation b/Lang/V-(Vlang)/Bitcoin-address-validation new file mode 120000 index 0000000000..28da42f695 --- /dev/null +++ b/Lang/V-(Vlang)/Bitcoin-address-validation @@ -0,0 +1 @@ +../../Task/Bitcoin-address-validation/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Bitwise-operations b/Lang/V-(Vlang)/Bitwise-operations new file mode 120000 index 0000000000..e781b4c06c --- /dev/null +++ b/Lang/V-(Vlang)/Bitwise-operations @@ -0,0 +1 @@ +../../Task/Bitwise-operations/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Box-the-compass b/Lang/V-(Vlang)/Box-the-compass new file mode 120000 index 0000000000..8aa45acb1f --- /dev/null +++ b/Lang/V-(Vlang)/Box-the-compass @@ -0,0 +1 @@ +../../Task/Box-the-compass/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Burrows-Wheeler-transform b/Lang/V-(Vlang)/Burrows-Wheeler-transform new file mode 120000 index 0000000000..c6a4d26892 --- /dev/null +++ b/Lang/V-(Vlang)/Burrows-Wheeler-transform @@ -0,0 +1 @@ +../../Task/Burrows-Wheeler-transform/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Canonicalize-CIDR b/Lang/V-(Vlang)/Canonicalize-CIDR new file mode 120000 index 0000000000..42ce54344e --- /dev/null +++ b/Lang/V-(Vlang)/Canonicalize-CIDR @@ -0,0 +1 @@ +../../Task/Canonicalize-CIDR/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Classes b/Lang/V-(Vlang)/Classes new file mode 120000 index 0000000000..a7d339230e --- /dev/null +++ b/Lang/V-(Vlang)/Classes @@ -0,0 +1 @@ +../../Task/Classes/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Closures-Value-capture b/Lang/V-(Vlang)/Closures-Value-capture new file mode 120000 index 0000000000..d671104741 --- /dev/null +++ b/Lang/V-(Vlang)/Closures-Value-capture @@ -0,0 +1 @@ +../../Task/Closures-Value-capture/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Color-wheel b/Lang/V-(Vlang)/Color-wheel new file mode 120000 index 0000000000..b828d5a770 --- /dev/null +++ b/Lang/V-(Vlang)/Color-wheel @@ -0,0 +1 @@ +../../Task/Color-wheel/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Compile-time-calculation b/Lang/V-(Vlang)/Compile-time-calculation new file mode 120000 index 0000000000..1ec9e378fa --- /dev/null +++ b/Lang/V-(Vlang)/Compile-time-calculation @@ -0,0 +1 @@ +../../Task/Compile-time-calculation/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Constrained-genericity b/Lang/V-(Vlang)/Constrained-genericity new file mode 120000 index 0000000000..af413abe8c --- /dev/null +++ b/Lang/V-(Vlang)/Constrained-genericity @@ -0,0 +1 @@ +../../Task/Constrained-genericity/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Convert-seconds-to-compound-duration b/Lang/V-(Vlang)/Convert-seconds-to-compound-duration new file mode 120000 index 0000000000..90e9599792 --- /dev/null +++ b/Lang/V-(Vlang)/Convert-seconds-to-compound-duration @@ -0,0 +1 @@ +../../Task/Convert-seconds-to-compound-duration/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Create-an-object-at-a-given-address b/Lang/V-(Vlang)/Create-an-object-at-a-given-address new file mode 120000 index 0000000000..2a735f50a4 --- /dev/null +++ b/Lang/V-(Vlang)/Create-an-object-at-a-given-address @@ -0,0 +1 @@ +../../Task/Create-an-object-at-a-given-address/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/De-Bruijn-sequences b/Lang/V-(Vlang)/De-Bruijn-sequences new file mode 120000 index 0000000000..03d47939a3 --- /dev/null +++ b/Lang/V-(Vlang)/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Death-Star b/Lang/V-(Vlang)/Death-Star new file mode 120000 index 0000000000..ed8ea3e0a6 --- /dev/null +++ b/Lang/V-(Vlang)/Death-Star @@ -0,0 +1 @@ +../../Task/Death-Star/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Define-a-primitive-data-type b/Lang/V-(Vlang)/Define-a-primitive-data-type new file mode 120000 index 0000000000..aebf4cbe69 --- /dev/null +++ b/Lang/V-(Vlang)/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Dijkstras-algorithm b/Lang/V-(Vlang)/Dijkstras-algorithm new file mode 120000 index 0000000000..c6cb06de44 --- /dev/null +++ b/Lang/V-(Vlang)/Dijkstras-algorithm @@ -0,0 +1 @@ +../../Task/Dijkstras-algorithm/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Dragon-curve b/Lang/V-(Vlang)/Dragon-curve new file mode 120000 index 0000000000..ea14877291 --- /dev/null +++ b/Lang/V-(Vlang)/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Draw-a-cuboid b/Lang/V-(Vlang)/Draw-a-cuboid new file mode 120000 index 0000000000..675b202e8b --- /dev/null +++ b/Lang/V-(Vlang)/Draw-a-cuboid @@ -0,0 +1 @@ +../../Task/Draw-a-cuboid/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Draw-a-rotating-cube b/Lang/V-(Vlang)/Draw-a-rotating-cube new file mode 120000 index 0000000000..c731b8a529 --- /dev/null +++ b/Lang/V-(Vlang)/Draw-a-rotating-cube @@ -0,0 +1 @@ +../../Task/Draw-a-rotating-cube/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Dutch-national-flag-problem b/Lang/V-(Vlang)/Dutch-national-flag-problem new file mode 120000 index 0000000000..826568fc3d --- /dev/null +++ b/Lang/V-(Vlang)/Dutch-national-flag-problem @@ -0,0 +1 @@ +../../Task/Dutch-national-flag-problem/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Dynamic-variable-names b/Lang/V-(Vlang)/Dynamic-variable-names new file mode 120000 index 0000000000..59780bc7d8 --- /dev/null +++ b/Lang/V-(Vlang)/Dynamic-variable-names @@ -0,0 +1 @@ +../../Task/Dynamic-variable-names/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Eertree b/Lang/V-(Vlang)/Eertree new file mode 120000 index 0000000000..df3a9103a6 --- /dev/null +++ b/Lang/V-(Vlang)/Eertree @@ -0,0 +1 @@ +../../Task/Eertree/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Elementary-cellular-automaton-Random-number-generator b/Lang/V-(Vlang)/Elementary-cellular-automaton-Random-number-generator new file mode 120000 index 0000000000..d02a93aeca --- /dev/null +++ b/Lang/V-(Vlang)/Elementary-cellular-automaton-Random-number-generator @@ -0,0 +1 @@ +../../Task/Elementary-cellular-automaton-Random-number-generator/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Enumerations b/Lang/V-(Vlang)/Enumerations new file mode 120000 index 0000000000..711e1f8ea0 --- /dev/null +++ b/Lang/V-(Vlang)/Enumerations @@ -0,0 +1 @@ +../../Task/Enumerations/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Execute-HQ9+ b/Lang/V-(Vlang)/Execute-HQ9+ new file mode 120000 index 0000000000..cecaa41a14 --- /dev/null +++ b/Lang/V-(Vlang)/Execute-HQ9+ @@ -0,0 +1 @@ +../../Task/Execute-HQ9+/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Exponentiation-with-infix-operators-in-or-operating-on-the-base b/Lang/V-(Vlang)/Exponentiation-with-infix-operators-in-or-operating-on-the-base new file mode 120000 index 0000000000..119da73572 --- /dev/null +++ b/Lang/V-(Vlang)/Exponentiation-with-infix-operators-in-or-operating-on-the-base @@ -0,0 +1 @@ +../../Task/Exponentiation-with-infix-operators-in-or-operating-on-the-base/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Find-Chess960-starting-position-identifier b/Lang/V-(Vlang)/Find-Chess960-starting-position-identifier new file mode 120000 index 0000000000..b88e0a4eb1 --- /dev/null +++ b/Lang/V-(Vlang)/Find-Chess960-starting-position-identifier @@ -0,0 +1 @@ +../../Task/Find-Chess960-starting-position-identifier/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Find-the-last-Sunday-of-each-month b/Lang/V-(Vlang)/Find-the-last-Sunday-of-each-month new file mode 120000 index 0000000000..8c3dbc9a79 --- /dev/null +++ b/Lang/V-(Vlang)/Find-the-last-Sunday-of-each-month @@ -0,0 +1 @@ +../../Task/Find-the-last-Sunday-of-each-month/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Five-weekends b/Lang/V-(Vlang)/Five-weekends new file mode 120000 index 0000000000..ed2a49051d --- /dev/null +++ b/Lang/V-(Vlang)/Five-weekends @@ -0,0 +1 @@ +../../Task/Five-weekends/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Fivenum b/Lang/V-(Vlang)/Fivenum new file mode 120000 index 0000000000..77154f6b56 --- /dev/null +++ b/Lang/V-(Vlang)/Fivenum @@ -0,0 +1 @@ +../../Task/Fivenum/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Flipping-bits-game b/Lang/V-(Vlang)/Flipping-bits-game new file mode 120000 index 0000000000..f272f02e11 --- /dev/null +++ b/Lang/V-(Vlang)/Flipping-bits-game @@ -0,0 +1 @@ +../../Task/Flipping-bits-game/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Floyds-triangle b/Lang/V-(Vlang)/Floyds-triangle new file mode 120000 index 0000000000..cc0e0a9649 --- /dev/null +++ b/Lang/V-(Vlang)/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Galton-box-animation b/Lang/V-(Vlang)/Galton-box-animation new file mode 120000 index 0000000000..2caf8cb18c --- /dev/null +++ b/Lang/V-(Vlang)/Galton-box-animation @@ -0,0 +1 @@ +../../Task/Galton-box-animation/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Generate-random-chess-position b/Lang/V-(Vlang)/Generate-random-chess-position new file mode 120000 index 0000000000..7687c7236a --- /dev/null +++ b/Lang/V-(Vlang)/Generate-random-chess-position @@ -0,0 +1 @@ +../../Task/Generate-random-chess-position/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Get-system-command-output b/Lang/V-(Vlang)/Get-system-command-output new file mode 120000 index 0000000000..1b29764574 --- /dev/null +++ b/Lang/V-(Vlang)/Get-system-command-output @@ -0,0 +1 @@ +../../Task/Get-system-command-output/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Hash-join b/Lang/V-(Vlang)/Hash-join new file mode 120000 index 0000000000..a28257577b --- /dev/null +++ b/Lang/V-(Vlang)/Hash-join @@ -0,0 +1 @@ +../../Task/Hash-join/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Hello-world-Standard-error b/Lang/V-(Vlang)/Hello-world-Standard-error new file mode 120000 index 0000000000..f1aa7945d1 --- /dev/null +++ b/Lang/V-(Vlang)/Hello-world-Standard-error @@ -0,0 +1 @@ +../../Task/Hello-world-Standard-error/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Higher-order-functions b/Lang/V-(Vlang)/Higher-order-functions new file mode 120000 index 0000000000..a6c0b9843e --- /dev/null +++ b/Lang/V-(Vlang)/Higher-order-functions @@ -0,0 +1 @@ +../../Task/Higher-order-functions/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Hilbert-curve b/Lang/V-(Vlang)/Hilbert-curve new file mode 120000 index 0000000000..d691e8f108 --- /dev/null +++ b/Lang/V-(Vlang)/Hilbert-curve @@ -0,0 +1 @@ +../../Task/Hilbert-curve/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Humble-numbers b/Lang/V-(Vlang)/Humble-numbers new file mode 120000 index 0000000000..c32de84293 --- /dev/null +++ b/Lang/V-(Vlang)/Humble-numbers @@ -0,0 +1 @@ +../../Task/Humble-numbers/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Idiomatically-determine-all-the-lowercase-and-uppercase-letters b/Lang/V-(Vlang)/Idiomatically-determine-all-the-lowercase-and-uppercase-letters new file mode 120000 index 0000000000..efa66c489c --- /dev/null +++ b/Lang/V-(Vlang)/Idiomatically-determine-all-the-lowercase-and-uppercase-letters @@ -0,0 +1 @@ +../../Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Include-a-file b/Lang/V-(Vlang)/Include-a-file new file mode 120000 index 0000000000..439a7ac6c3 --- /dev/null +++ b/Lang/V-(Vlang)/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Inheritance-Multiple b/Lang/V-(Vlang)/Inheritance-Multiple new file mode 120000 index 0000000000..5c8421d069 --- /dev/null +++ b/Lang/V-(Vlang)/Inheritance-Multiple @@ -0,0 +1 @@ +../../Task/Inheritance-Multiple/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Inheritance-Single b/Lang/V-(Vlang)/Inheritance-Single new file mode 120000 index 0000000000..e9a1dd6d9f --- /dev/null +++ b/Lang/V-(Vlang)/Inheritance-Single @@ -0,0 +1 @@ +../../Task/Inheritance-Single/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Integer-comparison b/Lang/V-(Vlang)/Integer-comparison new file mode 120000 index 0000000000..0152b2d289 --- /dev/null +++ b/Lang/V-(Vlang)/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Juggler-sequence b/Lang/V-(Vlang)/Juggler-sequence new file mode 120000 index 0000000000..56d41efb28 --- /dev/null +++ b/Lang/V-(Vlang)/Juggler-sequence @@ -0,0 +1 @@ +../../Task/Juggler-sequence/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Knights-tour b/Lang/V-(Vlang)/Knights-tour new file mode 120000 index 0000000000..542607dce0 --- /dev/null +++ b/Lang/V-(Vlang)/Knights-tour @@ -0,0 +1 @@ +../../Task/Knights-tour/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/LU-decomposition b/Lang/V-(Vlang)/LU-decomposition new file mode 120000 index 0000000000..1eb080d8ba --- /dev/null +++ b/Lang/V-(Vlang)/LU-decomposition @@ -0,0 +1 @@ +../../Task/LU-decomposition/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/LZW-compression b/Lang/V-(Vlang)/LZW-compression new file mode 120000 index 0000000000..36e201b60a --- /dev/null +++ b/Lang/V-(Vlang)/LZW-compression @@ -0,0 +1 @@ +../../Task/LZW-compression/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Langtons-ant b/Lang/V-(Vlang)/Langtons-ant new file mode 120000 index 0000000000..ccce40cc4e --- /dev/null +++ b/Lang/V-(Vlang)/Langtons-ant @@ -0,0 +1 @@ +../../Task/Langtons-ant/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Legendre-prime-counting-function b/Lang/V-(Vlang)/Legendre-prime-counting-function new file mode 120000 index 0000000000..ca54942178 --- /dev/null +++ b/Lang/V-(Vlang)/Legendre-prime-counting-function @@ -0,0 +1 @@ +../../Task/Legendre-prime-counting-function/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Logical-operations b/Lang/V-(Vlang)/Logical-operations new file mode 120000 index 0000000000..bed3efe6b2 --- /dev/null +++ b/Lang/V-(Vlang)/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/MD4 b/Lang/V-(Vlang)/MD4 new file mode 120000 index 0000000000..4ef84d93a7 --- /dev/null +++ b/Lang/V-(Vlang)/MD4 @@ -0,0 +1 @@ +../../Task/MD4/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Magic-8-ball b/Lang/V-(Vlang)/Magic-8-ball new file mode 120000 index 0000000000..01ad1da8ee --- /dev/null +++ b/Lang/V-(Vlang)/Magic-8-ball @@ -0,0 +1 @@ +../../Task/Magic-8-ball/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Magic-squares-of-odd-order b/Lang/V-(Vlang)/Magic-squares-of-odd-order new file mode 120000 index 0000000000..15a07e422e --- /dev/null +++ b/Lang/V-(Vlang)/Magic-squares-of-odd-order @@ -0,0 +1 @@ +../../Task/Magic-squares-of-odd-order/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Map-range b/Lang/V-(Vlang)/Map-range new file mode 120000 index 0000000000..bd9191a4a1 --- /dev/null +++ b/Lang/V-(Vlang)/Map-range @@ -0,0 +1 @@ +../../Task/Map-range/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Matrix-chain-multiplication b/Lang/V-(Vlang)/Matrix-chain-multiplication new file mode 120000 index 0000000000..6f5b000cff --- /dev/null +++ b/Lang/V-(Vlang)/Matrix-chain-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-chain-multiplication/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Matrix-transposition b/Lang/V-(Vlang)/Matrix-transposition new file mode 120000 index 0000000000..f283dea370 --- /dev/null +++ b/Lang/V-(Vlang)/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Mayan-numerals b/Lang/V-(Vlang)/Mayan-numerals new file mode 120000 index 0000000000..005198e98f --- /dev/null +++ b/Lang/V-(Vlang)/Mayan-numerals @@ -0,0 +1 @@ +../../Task/Mayan-numerals/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Maze-generation b/Lang/V-(Vlang)/Maze-generation new file mode 120000 index 0000000000..62cabc5306 --- /dev/null +++ b/Lang/V-(Vlang)/Maze-generation @@ -0,0 +1 @@ +../../Task/Maze-generation/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Maze-solving b/Lang/V-(Vlang)/Maze-solving new file mode 120000 index 0000000000..1dd904fdc6 --- /dev/null +++ b/Lang/V-(Vlang)/Maze-solving @@ -0,0 +1 @@ +../../Task/Maze-solving/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Memory-allocation b/Lang/V-(Vlang)/Memory-allocation new file mode 120000 index 0000000000..28b226407c --- /dev/null +++ b/Lang/V-(Vlang)/Memory-allocation @@ -0,0 +1 @@ +../../Task/Memory-allocation/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Metaprogramming b/Lang/V-(Vlang)/Metaprogramming new file mode 120000 index 0000000000..6b8564d95e --- /dev/null +++ b/Lang/V-(Vlang)/Metaprogramming @@ -0,0 +1 @@ +../../Task/Metaprogramming/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Mind-boggling-card-trick b/Lang/V-(Vlang)/Mind-boggling-card-trick new file mode 120000 index 0000000000..765932978d --- /dev/null +++ b/Lang/V-(Vlang)/Mind-boggling-card-trick @@ -0,0 +1 @@ +../../Task/Mind-boggling-card-trick/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Monads-List-monad b/Lang/V-(Vlang)/Monads-List-monad new file mode 120000 index 0000000000..60c249323a --- /dev/null +++ b/Lang/V-(Vlang)/Monads-List-monad @@ -0,0 +1 @@ +../../Task/Monads-List-monad/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Monads-Maybe-monad b/Lang/V-(Vlang)/Monads-Maybe-monad new file mode 120000 index 0000000000..bcf0927f50 --- /dev/null +++ b/Lang/V-(Vlang)/Monads-Maybe-monad @@ -0,0 +1 @@ +../../Task/Monads-Maybe-monad/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Morse-code b/Lang/V-(Vlang)/Morse-code new file mode 120000 index 0000000000..ac98ffd266 --- /dev/null +++ b/Lang/V-(Vlang)/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Multiplication-tables b/Lang/V-(Vlang)/Multiplication-tables new file mode 120000 index 0000000000..3bdff7103e --- /dev/null +++ b/Lang/V-(Vlang)/Multiplication-tables @@ -0,0 +1 @@ +../../Task/Multiplication-tables/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/N-queens-problem b/Lang/V-(Vlang)/N-queens-problem new file mode 120000 index 0000000000..50b06d4a76 --- /dev/null +++ b/Lang/V-(Vlang)/N-queens-problem @@ -0,0 +1 @@ +../../Task/N-queens-problem/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Nonoblock b/Lang/V-(Vlang)/Nonoblock new file mode 120000 index 0000000000..930ce96e10 --- /dev/null +++ b/Lang/V-(Vlang)/Nonoblock @@ -0,0 +1 @@ +../../Task/Nonoblock/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/One-dimensional-cellular-automata b/Lang/V-(Vlang)/One-dimensional-cellular-automata new file mode 120000 index 0000000000..7b9510a27e --- /dev/null +++ b/Lang/V-(Vlang)/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Operator-precedence b/Lang/V-(Vlang)/Operator-precedence new file mode 120000 index 0000000000..749797e963 --- /dev/null +++ b/Lang/V-(Vlang)/Operator-precedence @@ -0,0 +1 @@ +../../Task/Operator-precedence/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Optional-parameters b/Lang/V-(Vlang)/Optional-parameters new file mode 120000 index 0000000000..34451b5a74 --- /dev/null +++ b/Lang/V-(Vlang)/Optional-parameters @@ -0,0 +1 @@ +../../Task/Optional-parameters/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Palindrome-dates b/Lang/V-(Vlang)/Palindrome-dates new file mode 120000 index 0000000000..58cd472885 --- /dev/null +++ b/Lang/V-(Vlang)/Palindrome-dates @@ -0,0 +1 @@ +../../Task/Palindrome-dates/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Pancake-numbers b/Lang/V-(Vlang)/Pancake-numbers new file mode 120000 index 0000000000..03055f6721 --- /dev/null +++ b/Lang/V-(Vlang)/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Pangram-checker b/Lang/V-(Vlang)/Pangram-checker new file mode 120000 index 0000000000..281ca7e770 --- /dev/null +++ b/Lang/V-(Vlang)/Pangram-checker @@ -0,0 +1 @@ +../../Task/Pangram-checker/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Parametric-polymorphism b/Lang/V-(Vlang)/Parametric-polymorphism new file mode 120000 index 0000000000..2fba74d455 --- /dev/null +++ b/Lang/V-(Vlang)/Parametric-polymorphism @@ -0,0 +1 @@ +../../Task/Parametric-polymorphism/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Partial-function-application b/Lang/V-(Vlang)/Partial-function-application new file mode 120000 index 0000000000..2ab67a8d88 --- /dev/null +++ b/Lang/V-(Vlang)/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Pascals-triangle b/Lang/V-(Vlang)/Pascals-triangle new file mode 120000 index 0000000000..91982b11d4 --- /dev/null +++ b/Lang/V-(Vlang)/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Password-generator b/Lang/V-(Vlang)/Password-generator new file mode 120000 index 0000000000..7e3dac059f --- /dev/null +++ b/Lang/V-(Vlang)/Password-generator @@ -0,0 +1 @@ +../../Task/Password-generator/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Peano-curve b/Lang/V-(Vlang)/Peano-curve new file mode 120000 index 0000000000..859acf6031 --- /dev/null +++ b/Lang/V-(Vlang)/Peano-curve @@ -0,0 +1 @@ +../../Task/Peano-curve/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Permutations-by-swapping b/Lang/V-(Vlang)/Permutations-by-swapping new file mode 120000 index 0000000000..247ffcc655 --- /dev/null +++ b/Lang/V-(Vlang)/Permutations-by-swapping @@ -0,0 +1 @@ +../../Task/Permutations-by-swapping/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Polymorphic-copy b/Lang/V-(Vlang)/Polymorphic-copy new file mode 120000 index 0000000000..d1d9a95084 --- /dev/null +++ b/Lang/V-(Vlang)/Polymorphic-copy @@ -0,0 +1 @@ +../../Task/Polymorphic-copy/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Polymorphism b/Lang/V-(Vlang)/Polymorphism new file mode 120000 index 0000000000..1ca2c9e1ef --- /dev/null +++ b/Lang/V-(Vlang)/Polymorphism @@ -0,0 +1 @@ +../../Task/Polymorphism/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Polyspiral b/Lang/V-(Vlang)/Polyspiral new file mode 120000 index 0000000000..f6495b4e02 --- /dev/null +++ b/Lang/V-(Vlang)/Polyspiral @@ -0,0 +1 @@ +../../Task/Polyspiral/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Price-fraction b/Lang/V-(Vlang)/Price-fraction new file mode 120000 index 0000000000..065a5d4d27 --- /dev/null +++ b/Lang/V-(Vlang)/Price-fraction @@ -0,0 +1 @@ +../../Task/Price-fraction/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Prime-decomposition b/Lang/V-(Vlang)/Prime-decomposition new file mode 120000 index 0000000000..092f726639 --- /dev/null +++ b/Lang/V-(Vlang)/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Probabilistic-choice b/Lang/V-(Vlang)/Probabilistic-choice new file mode 120000 index 0000000000..5f44e37240 --- /dev/null +++ b/Lang/V-(Vlang)/Probabilistic-choice @@ -0,0 +1 @@ +../../Task/Probabilistic-choice/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Program-name b/Lang/V-(Vlang)/Program-name new file mode 120000 index 0000000000..9b2935c679 --- /dev/null +++ b/Lang/V-(Vlang)/Program-name @@ -0,0 +1 @@ +../../Task/Program-name/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Pseudo-random-numbers-Splitmix64 b/Lang/V-(Vlang)/Pseudo-random-numbers-Splitmix64 new file mode 120000 index 0000000000..05590ef252 --- /dev/null +++ b/Lang/V-(Vlang)/Pseudo-random-numbers-Splitmix64 @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Splitmix64/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Quine b/Lang/V-(Vlang)/Quine new file mode 120000 index 0000000000..a258f08a53 --- /dev/null +++ b/Lang/V-(Vlang)/Quine @@ -0,0 +1 @@ +../../Task/Quine/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/RPG-attributes-generator b/Lang/V-(Vlang)/RPG-attributes-generator new file mode 120000 index 0000000000..e14499c2a5 --- /dev/null +++ b/Lang/V-(Vlang)/RPG-attributes-generator @@ -0,0 +1 @@ +../../Task/RPG-attributes-generator/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Range-extraction b/Lang/V-(Vlang)/Range-extraction new file mode 120000 index 0000000000..76ae7cce99 --- /dev/null +++ b/Lang/V-(Vlang)/Range-extraction @@ -0,0 +1 @@ +../../Task/Range-extraction/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Read-a-specific-line-from-a-file b/Lang/V-(Vlang)/Read-a-specific-line-from-a-file new file mode 120000 index 0000000000..8f9a931625 --- /dev/null +++ b/Lang/V-(Vlang)/Read-a-specific-line-from-a-file @@ -0,0 +1 @@ +../../Task/Read-a-specific-line-from-a-file/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Regular-expressions b/Lang/V-(Vlang)/Regular-expressions new file mode 120000 index 0000000000..bc8ed031b0 --- /dev/null +++ b/Lang/V-(Vlang)/Regular-expressions @@ -0,0 +1 @@ +../../Task/Regular-expressions/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Respond-to-an-unknown-method-call b/Lang/V-(Vlang)/Respond-to-an-unknown-method-call new file mode 120000 index 0000000000..3cfbcab7fa --- /dev/null +++ b/Lang/V-(Vlang)/Respond-to-an-unknown-method-call @@ -0,0 +1 @@ +../../Task/Respond-to-an-unknown-method-call/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Return-multiple-values b/Lang/V-(Vlang)/Return-multiple-values new file mode 120000 index 0000000000..ddbdb0227d --- /dev/null +++ b/Lang/V-(Vlang)/Return-multiple-values @@ -0,0 +1 @@ +../../Task/Return-multiple-values/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/SEDOLs b/Lang/V-(Vlang)/SEDOLs new file mode 120000 index 0000000000..3d43f78e48 --- /dev/null +++ b/Lang/V-(Vlang)/SEDOLs @@ -0,0 +1 @@ +../../Task/SEDOLs/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Scope-modifiers b/Lang/V-(Vlang)/Scope-modifiers new file mode 120000 index 0000000000..429eb578e5 --- /dev/null +++ b/Lang/V-(Vlang)/Scope-modifiers @@ -0,0 +1 @@ +../../Task/Scope-modifiers/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Send-an-unknown-method-call b/Lang/V-(Vlang)/Send-an-unknown-method-call new file mode 120000 index 0000000000..682a1fe636 --- /dev/null +++ b/Lang/V-(Vlang)/Send-an-unknown-method-call @@ -0,0 +1 @@ +../../Task/Send-an-unknown-method-call/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Sierpinski-arrowhead-curve b/Lang/V-(Vlang)/Sierpinski-arrowhead-curve new file mode 120000 index 0000000000..ce49e15c40 --- /dev/null +++ b/Lang/V-(Vlang)/Sierpinski-arrowhead-curve @@ -0,0 +1 @@ +../../Task/Sierpinski-arrowhead-curve/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Sierpinski-square-curve b/Lang/V-(Vlang)/Sierpinski-square-curve new file mode 120000 index 0000000000..c9f1debc78 --- /dev/null +++ b/Lang/V-(Vlang)/Sierpinski-square-curve @@ -0,0 +1 @@ +../../Task/Sierpinski-square-curve/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Sieve-of-Pritchard b/Lang/V-(Vlang)/Sieve-of-Pritchard new file mode 120000 index 0000000000..c1742abeaf --- /dev/null +++ b/Lang/V-(Vlang)/Sieve-of-Pritchard @@ -0,0 +1 @@ +../../Task/Sieve-of-Pritchard/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Singly-linked-list-Element-definition b/Lang/V-(Vlang)/Singly-linked-list-Element-definition new file mode 120000 index 0000000000..4870f24a23 --- /dev/null +++ b/Lang/V-(Vlang)/Singly-linked-list-Element-definition @@ -0,0 +1 @@ +../../Task/Singly-linked-list-Element-definition/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Sokoban b/Lang/V-(Vlang)/Sokoban new file mode 120000 index 0000000000..ac9a6fb995 --- /dev/null +++ b/Lang/V-(Vlang)/Sokoban @@ -0,0 +1 @@ +../../Task/Sokoban/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Solve-a-Holy-Knights-tour b/Lang/V-(Vlang)/Solve-a-Holy-Knights-tour new file mode 120000 index 0000000000..4753f7fb1d --- /dev/null +++ b/Lang/V-(Vlang)/Solve-a-Holy-Knights-tour @@ -0,0 +1 @@ +../../Task/Solve-a-Holy-Knights-tour/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Sort-a-list-of-object-identifiers b/Lang/V-(Vlang)/Sort-a-list-of-object-identifiers new file mode 120000 index 0000000000..f40fb70fcb --- /dev/null +++ b/Lang/V-(Vlang)/Sort-a-list-of-object-identifiers @@ -0,0 +1 @@ +../../Task/Sort-a-list-of-object-identifiers/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Sort-numbers-lexicographically b/Lang/V-(Vlang)/Sort-numbers-lexicographically new file mode 120000 index 0000000000..05897e6739 --- /dev/null +++ b/Lang/V-(Vlang)/Sort-numbers-lexicographically @@ -0,0 +1 @@ +../../Task/Sort-numbers-lexicographically/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Sorting-Algorithms-Circle-Sort b/Lang/V-(Vlang)/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 90876b0ca9..0000000000 --- a/Lang/V-(Vlang)/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Special-variables b/Lang/V-(Vlang)/Special-variables new file mode 120000 index 0000000000..cf6afb2ad0 --- /dev/null +++ b/Lang/V-(Vlang)/Special-variables @@ -0,0 +1 @@ +../../Task/Special-variables/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Spiral-matrix b/Lang/V-(Vlang)/Spiral-matrix new file mode 120000 index 0000000000..3966b6fb8b --- /dev/null +++ b/Lang/V-(Vlang)/Spiral-matrix @@ -0,0 +1 @@ +../../Task/Spiral-matrix/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Stair-climbing-puzzle b/Lang/V-(Vlang)/Stair-climbing-puzzle new file mode 120000 index 0000000000..f0a6ae3661 --- /dev/null +++ b/Lang/V-(Vlang)/Stair-climbing-puzzle @@ -0,0 +1 @@ +../../Task/Stair-climbing-puzzle/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Straddling-checkerboard b/Lang/V-(Vlang)/Straddling-checkerboard new file mode 120000 index 0000000000..fcc5be8fde --- /dev/null +++ b/Lang/V-(Vlang)/Straddling-checkerboard @@ -0,0 +1 @@ +../../Task/Straddling-checkerboard/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Substring-Top-and-tail b/Lang/V-(Vlang)/Substring-Top-and-tail new file mode 120000 index 0000000000..6ff0a67c24 --- /dev/null +++ b/Lang/V-(Vlang)/Substring-Top-and-tail @@ -0,0 +1 @@ +../../Task/Substring-Top-and-tail/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Sudoku b/Lang/V-(Vlang)/Sudoku new file mode 120000 index 0000000000..930f85b4d1 --- /dev/null +++ b/Lang/V-(Vlang)/Sudoku @@ -0,0 +1 @@ +../../Task/Sudoku/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Sum-of-squares b/Lang/V-(Vlang)/Sum-of-squares new file mode 120000 index 0000000000..bdf6276079 --- /dev/null +++ b/Lang/V-(Vlang)/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Summarize-and-say-sequence b/Lang/V-(Vlang)/Summarize-and-say-sequence new file mode 120000 index 0000000000..6bf589b063 --- /dev/null +++ b/Lang/V-(Vlang)/Summarize-and-say-sequence @@ -0,0 +1 @@ +../../Task/Summarize-and-say-sequence/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Superellipse b/Lang/V-(Vlang)/Superellipse new file mode 120000 index 0000000000..f4877a60ae --- /dev/null +++ b/Lang/V-(Vlang)/Superellipse @@ -0,0 +1 @@ +../../Task/Superellipse/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Superpermutation-minimisation b/Lang/V-(Vlang)/Superpermutation-minimisation new file mode 120000 index 0000000000..8aeb5ea4bd --- /dev/null +++ b/Lang/V-(Vlang)/Superpermutation-minimisation @@ -0,0 +1 @@ +../../Task/Superpermutation-minimisation/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Table-creation-Postal-addresses b/Lang/V-(Vlang)/Table-creation-Postal-addresses new file mode 120000 index 0000000000..07c82be810 --- /dev/null +++ b/Lang/V-(Vlang)/Table-creation-Postal-addresses @@ -0,0 +1 @@ +../../Task/Table-creation-Postal-addresses/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Taxicab-numbers b/Lang/V-(Vlang)/Taxicab-numbers new file mode 120000 index 0000000000..d3f4a716c8 --- /dev/null +++ b/Lang/V-(Vlang)/Taxicab-numbers @@ -0,0 +1 @@ +../../Task/Taxicab-numbers/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/The-Twelve-Days-of-Christmas b/Lang/V-(Vlang)/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..ac2e9fb7b5 --- /dev/null +++ b/Lang/V-(Vlang)/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Thue-Morse b/Lang/V-(Vlang)/Thue-Morse new file mode 120000 index 0000000000..82f9127b9d --- /dev/null +++ b/Lang/V-(Vlang)/Thue-Morse @@ -0,0 +1 @@ +../../Task/Thue-Morse/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Topic-variable b/Lang/V-(Vlang)/Topic-variable new file mode 120000 index 0000000000..99a32af3bb --- /dev/null +++ b/Lang/V-(Vlang)/Topic-variable @@ -0,0 +1 @@ +../../Task/Topic-variable/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Transliterate-English-text-using-the-Greek-alphabet b/Lang/V-(Vlang)/Transliterate-English-text-using-the-Greek-alphabet new file mode 120000 index 0000000000..9c6f1c38d1 --- /dev/null +++ b/Lang/V-(Vlang)/Transliterate-English-text-using-the-Greek-alphabet @@ -0,0 +1 @@ +../../Task/Transliterate-English-text-using-the-Greek-alphabet/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Twos-complement b/Lang/V-(Vlang)/Twos-complement new file mode 120000 index 0000000000..b9ca937183 --- /dev/null +++ b/Lang/V-(Vlang)/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/UPC b/Lang/V-(Vlang)/UPC new file mode 120000 index 0000000000..bb6c7d3bca --- /dev/null +++ b/Lang/V-(Vlang)/UPC @@ -0,0 +1 @@ +../../Task/UPC/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/User-input-Graphical b/Lang/V-(Vlang)/User-input-Graphical new file mode 120000 index 0000000000..d985c46dcb --- /dev/null +++ b/Lang/V-(Vlang)/User-input-Graphical @@ -0,0 +1 @@ +../../Task/User-input-Graphical/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Variable-length-quantity b/Lang/V-(Vlang)/Variable-length-quantity new file mode 120000 index 0000000000..e0a7eee24f --- /dev/null +++ b/Lang/V-(Vlang)/Variable-length-quantity @@ -0,0 +1 @@ +../../Task/Variable-length-quantity/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/War-card-game b/Lang/V-(Vlang)/War-card-game new file mode 120000 index 0000000000..b1fa28907b --- /dev/null +++ b/Lang/V-(Vlang)/War-card-game @@ -0,0 +1 @@ +../../Task/War-card-game/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Word-frequency b/Lang/V-(Vlang)/Word-frequency new file mode 120000 index 0000000000..7472df9d00 --- /dev/null +++ b/Lang/V-(Vlang)/Word-frequency @@ -0,0 +1 @@ +../../Task/Word-frequency/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Yin-and-yang b/Lang/V-(Vlang)/Yin-and-yang new file mode 120000 index 0000000000..bfc21b3e37 --- /dev/null +++ b/Lang/V-(Vlang)/Yin-and-yang @@ -0,0 +1 @@ +../../Task/Yin-and-yang/V-(Vlang) \ No newline at end of file diff --git a/Lang/V-(Vlang)/Zhang-Suen-thinning-algorithm b/Lang/V-(Vlang)/Zhang-Suen-thinning-algorithm new file mode 120000 index 0000000000..b0618c7785 --- /dev/null +++ b/Lang/V-(Vlang)/Zhang-Suen-thinning-algorithm @@ -0,0 +1 @@ +../../Task/Zhang-Suen-thinning-algorithm/V-(Vlang) \ No newline at end of file diff --git a/Lang/V/00-LANG.txt b/Lang/V/00-LANG.txt index c4203ea969..6de2ee34df 100644 --- a/Lang/V/00-LANG.txt +++ b/Lang/V/00-LANG.txt @@ -5,6 +5,7 @@ |site=http://code.google.com/p/v-language/ |LCT=yes}} {{language programming paradigm|concatenative}} +''Note: There is another language called V at Rosetta Code, it can be found at [[:Category:V_(Vlang)|V (Vlang)]].'' + '''V''' is a simple, stack-based (concatenative), dynamic language. It is similar to [[Joy]] and [[PostScript]]. -
    -Note: There is another language called V at Rosetta Code, it can be found over [[:Category:V_(Vlang)|here]]. \ No newline at end of file +
    \ No newline at end of file diff --git a/Lang/V/99-bottles-of-beer b/Lang/V/99-bottles-of-beer new file mode 120000 index 0000000000..9e72431c34 --- /dev/null +++ b/Lang/V/99-bottles-of-beer @@ -0,0 +1 @@ +../../Task/99-bottles-of-beer/V \ No newline at end of file diff --git a/Lang/VBA/Abundant-odd-numbers b/Lang/VBA/Abundant-odd-numbers new file mode 120000 index 0000000000..634e142877 --- /dev/null +++ b/Lang/VBA/Abundant-odd-numbers @@ -0,0 +1 @@ +../../Task/Abundant-odd-numbers/VBA \ No newline at end of file diff --git a/Lang/VBA/Bell-numbers b/Lang/VBA/Bell-numbers new file mode 120000 index 0000000000..825db8e67d --- /dev/null +++ b/Lang/VBA/Bell-numbers @@ -0,0 +1 @@ +../../Task/Bell-numbers/VBA \ No newline at end of file diff --git a/Lang/VBA/Brazilian-numbers b/Lang/VBA/Brazilian-numbers new file mode 120000 index 0000000000..3b990aab5c --- /dev/null +++ b/Lang/VBA/Brazilian-numbers @@ -0,0 +1 @@ +../../Task/Brazilian-numbers/VBA \ No newline at end of file diff --git a/Lang/VBA/Deal-cards-for-FreeCell b/Lang/VBA/Deal-cards-for-FreeCell new file mode 120000 index 0000000000..33506ab6dc --- /dev/null +++ b/Lang/VBA/Deal-cards-for-FreeCell @@ -0,0 +1 @@ +../../Task/Deal-cards-for-FreeCell/VBA \ No newline at end of file diff --git a/Lang/VBA/Gamma-function b/Lang/VBA/Gamma-function new file mode 120000 index 0000000000..75f8622191 --- /dev/null +++ b/Lang/VBA/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/VBA \ No newline at end of file diff --git a/Lang/VBA/M-bius-function b/Lang/VBA/M-bius-function new file mode 120000 index 0000000000..eb8fdee7b1 --- /dev/null +++ b/Lang/VBA/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/VBA \ No newline at end of file diff --git a/Lang/VBA/Monty-Hall-problem b/Lang/VBA/Monty-Hall-problem new file mode 120000 index 0000000000..cbcc810f65 --- /dev/null +++ b/Lang/VBA/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/VBA \ No newline at end of file diff --git a/Lang/VBA/Quaternion-type b/Lang/VBA/Quaternion-type deleted file mode 120000 index b9d823193e..0000000000 --- a/Lang/VBA/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/VBA \ No newline at end of file diff --git a/Lang/VBScript/Bioinformatics-base-count b/Lang/VBScript/Bioinformatics-base-count deleted file mode 120000 index 27b49dfc57..0000000000 --- a/Lang/VBScript/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/VBScript \ No newline at end of file diff --git a/Lang/VBScript/Simple-windowed-application b/Lang/VBScript/Simple-windowed-application new file mode 120000 index 0000000000..99e416c344 --- /dev/null +++ b/Lang/VBScript/Simple-windowed-application @@ -0,0 +1 @@ +../../Task/Simple-windowed-application/VBScript \ No newline at end of file diff --git a/Lang/VTL-2/RPG-attributes-generator b/Lang/VTL-2/RPG-attributes-generator new file mode 120000 index 0000000000..1167e48571 --- /dev/null +++ b/Lang/VTL-2/RPG-attributes-generator @@ -0,0 +1 @@ +../../Task/RPG-attributes-generator/VTL-2 \ No newline at end of file diff --git a/Lang/VTL-2/Zeckendorf-number-representation b/Lang/VTL-2/Zeckendorf-number-representation new file mode 120000 index 0000000000..f281019c65 --- /dev/null +++ b/Lang/VTL-2/Zeckendorf-number-representation @@ -0,0 +1 @@ +../../Task/Zeckendorf-number-representation/VTL-2 \ No newline at end of file diff --git a/Lang/Vala/Execute-Brain- b/Lang/Vala/Execute-Brain- new file mode 120000 index 0000000000..ae24a4e37d --- /dev/null +++ b/Lang/Vala/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/Vala \ No newline at end of file diff --git a/Lang/Vedit-macro-language/A+B b/Lang/Vedit-macro-language/A+B new file mode 120000 index 0000000000..95c8144292 --- /dev/null +++ b/Lang/Vedit-macro-language/A+B @@ -0,0 +1 @@ +../../Task/A+B/Vedit-macro-language \ No newline at end of file diff --git a/Lang/Vedit-macro-language/Babbage-problem b/Lang/Vedit-macro-language/Babbage-problem new file mode 120000 index 0000000000..db5331b437 --- /dev/null +++ b/Lang/Vedit-macro-language/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/Vedit-macro-language \ No newline at end of file diff --git a/Lang/Verilog/Leonardo-numbers b/Lang/Verilog/Leonardo-numbers new file mode 120000 index 0000000000..fdea2f05f8 --- /dev/null +++ b/Lang/Verilog/Leonardo-numbers @@ -0,0 +1 @@ +../../Task/Leonardo-numbers/Verilog \ No newline at end of file diff --git a/Lang/Verilog/Loops-Infinite b/Lang/Verilog/Loops-Infinite new file mode 120000 index 0000000000..07545a5d7e --- /dev/null +++ b/Lang/Verilog/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/Verilog \ No newline at end of file diff --git a/Lang/Verilog/Pancake-numbers b/Lang/Verilog/Pancake-numbers new file mode 120000 index 0000000000..f9cd19af94 --- /dev/null +++ b/Lang/Verilog/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/Verilog \ No newline at end of file diff --git a/Lang/Verilog/Twos-complement b/Lang/Verilog/Twos-complement new file mode 120000 index 0000000000..8527a62e79 --- /dev/null +++ b/Lang/Verilog/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Verilog \ No newline at end of file diff --git a/Lang/Vim-Script/Hello-world-Graphical b/Lang/Vim-Script/Hello-world-Graphical new file mode 120000 index 0000000000..799696cc16 --- /dev/null +++ b/Lang/Vim-Script/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Vim-Script \ No newline at end of file diff --git a/Lang/Vim-Script/Here-document b/Lang/Vim-Script/Here-document new file mode 120000 index 0000000000..4f2967d090 --- /dev/null +++ b/Lang/Vim-Script/Here-document @@ -0,0 +1 @@ +../../Task/Here-document/Vim-Script \ No newline at end of file diff --git a/Lang/Vim-Script/Loop-over-multiple-arrays-simultaneously b/Lang/Vim-Script/Loop-over-multiple-arrays-simultaneously new file mode 120000 index 0000000000..3e8729e53b --- /dev/null +++ b/Lang/Vim-Script/Loop-over-multiple-arrays-simultaneously @@ -0,0 +1 @@ +../../Task/Loop-over-multiple-arrays-simultaneously/Vim-Script \ No newline at end of file diff --git a/Lang/Vim-Script/Loops-For b/Lang/Vim-Script/Loops-For new file mode 120000 index 0000000000..427dcdb8bf --- /dev/null +++ b/Lang/Vim-Script/Loops-For @@ -0,0 +1 @@ +../../Task/Loops-For/Vim-Script \ No newline at end of file diff --git a/Lang/Vim-Script/XML-Input b/Lang/Vim-Script/XML-Input new file mode 120000 index 0000000000..57be30dc70 --- /dev/null +++ b/Lang/Vim-Script/XML-Input @@ -0,0 +1 @@ +../../Task/XML-Input/Vim-Script \ No newline at end of file diff --git a/Lang/Visual-Basic-.NET/Execute-Brain- b/Lang/Visual-Basic-.NET/Execute-Brain- new file mode 120000 index 0000000000..40c465e5ff --- /dev/null +++ b/Lang/Visual-Basic-.NET/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/Visual-Basic-.NET \ No newline at end of file diff --git a/Lang/Visual-Basic-.NET/Quaternion-type b/Lang/Visual-Basic-.NET/Quaternion-type deleted file mode 120000 index 111784d7c2..0000000000 --- a/Lang/Visual-Basic-.NET/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Visual-Basic-.NET \ No newline at end of file diff --git a/Lang/Vyxal/00-LANG.txt b/Lang/Vyxal/00-LANG.txt new file mode 100644 index 0000000000..0acceafc9b --- /dev/null +++ b/Lang/Vyxal/00-LANG.txt @@ -0,0 +1,3 @@ +{{language|Vyxal}} + +Vyxal is an esoteric golfing language designed to make code golf challenges fun, and to allow code golfers to win said challenges. \ No newline at end of file diff --git a/Lang/Vyxal/00-META.yaml b/Lang/Vyxal/00-META.yaml new file mode 100644 index 0000000000..a5968dda5e --- /dev/null +++ b/Lang/Vyxal/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Vyxal diff --git a/Lang/Vyxal/Arithmetic-geometric-mean b/Lang/Vyxal/Arithmetic-geometric-mean new file mode 120000 index 0000000000..5c957e3635 --- /dev/null +++ b/Lang/Vyxal/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Vyxal \ No newline at end of file diff --git a/Lang/Vyxal/Execute-Brain- b/Lang/Vyxal/Execute-Brain- new file mode 120000 index 0000000000..76839bca71 --- /dev/null +++ b/Lang/Vyxal/Execute-Brain- @@ -0,0 +1 @@ +../../Task/Execute-Brain-/Vyxal \ No newline at end of file diff --git a/Lang/Vyxal/Factorial b/Lang/Vyxal/Factorial new file mode 120000 index 0000000000..1cdfde0f4b --- /dev/null +++ b/Lang/Vyxal/Factorial @@ -0,0 +1 @@ +../../Task/Factorial/Vyxal \ No newline at end of file diff --git a/Lang/Vyxal/Factorions b/Lang/Vyxal/Factorions new file mode 120000 index 0000000000..df658fe37b --- /dev/null +++ b/Lang/Vyxal/Factorions @@ -0,0 +1 @@ +../../Task/Factorions/Vyxal \ No newline at end of file diff --git a/Lang/Vyxal/FizzBuzz b/Lang/Vyxal/FizzBuzz new file mode 120000 index 0000000000..22964032ea --- /dev/null +++ b/Lang/Vyxal/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Vyxal \ No newline at end of file diff --git a/Lang/Vyxal/Linear-congruential-generator b/Lang/Vyxal/Linear-congruential-generator new file mode 120000 index 0000000000..7a8e447f9f --- /dev/null +++ b/Lang/Vyxal/Linear-congruential-generator @@ -0,0 +1 @@ +../../Task/Linear-congruential-generator/Vyxal \ No newline at end of file diff --git a/Lang/Vyxal/Narcissistic-decimal-number b/Lang/Vyxal/Narcissistic-decimal-number new file mode 120000 index 0000000000..4f717275c0 --- /dev/null +++ b/Lang/Vyxal/Narcissistic-decimal-number @@ -0,0 +1 @@ +../../Task/Narcissistic-decimal-number/Vyxal \ No newline at end of file diff --git a/Lang/Waduzitdo/00-LANG.txt b/Lang/Waduzitdo/00-LANG.txt new file mode 100644 index 0000000000..140eff39b3 --- /dev/null +++ b/Lang/Waduzitdo/00-LANG.txt @@ -0,0 +1,7 @@ +{{stub}} +{{language|Waduzitdo +|site=https://waduzitdo.org/ +|hopl=no +}} + +Waduzitdo is a programming language created by Larry Kheriaty and published in the popular computer culture magazine BYTE in 1978. It very closely resembles [[PILOT]], but is even more simplified and has been proven to not be Turing complete. It appears to have been created as an attempt to create an extremely small compiler, as well as being a good language for demonstrating basic functions; the language only has eight commands, which demonstrate input and output, along with basic pattern-matching and decision-making. The language gets its name from the fact that it was designed for demonstrating a computer to people who had never used one before who are asking "What does it do?" \ No newline at end of file diff --git a/Lang/Waduzitdo/00-META.yaml b/Lang/Waduzitdo/00-META.yaml new file mode 100644 index 0000000000..7c62d1f448 --- /dev/null +++ b/Lang/Waduzitdo/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:Waduzitdo diff --git a/Lang/Waduzitdo/Hello-world-Text b/Lang/Waduzitdo/Hello-world-Text new file mode 120000 index 0000000000..4d7c98308f --- /dev/null +++ b/Lang/Waduzitdo/Hello-world-Text @@ -0,0 +1 @@ +../../Task/Hello-world-Text/Waduzitdo \ No newline at end of file diff --git a/Lang/Waduzitdo/Nim-game b/Lang/Waduzitdo/Nim-game new file mode 120000 index 0000000000..d8c3766378 --- /dev/null +++ b/Lang/Waduzitdo/Nim-game @@ -0,0 +1 @@ +../../Task/Nim-game/Waduzitdo \ No newline at end of file diff --git a/Lang/Wee-Basic/Empty-program b/Lang/Wee-Basic/Empty-program deleted file mode 120000 index 132197773e..0000000000 --- a/Lang/Wee-Basic/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Wee-Basic \ No newline at end of file diff --git a/Lang/Wisp/Knuth-shuffle b/Lang/Wisp/Knuth-shuffle new file mode 120000 index 0000000000..14993ebaba --- /dev/null +++ b/Lang/Wisp/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Wisp \ No newline at end of file diff --git a/Lang/Wisp/Levenshtein-distance b/Lang/Wisp/Levenshtein-distance new file mode 120000 index 0000000000..4fa74a1890 --- /dev/null +++ b/Lang/Wisp/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Wisp \ No newline at end of file diff --git a/Lang/Wren/00-LANG.txt b/Lang/Wren/00-LANG.txt index 240a2360ed..2d52115f0a 100644 --- a/Lang/Wren/00-LANG.txt +++ b/Lang/Wren/00-LANG.txt @@ -15,11 +15,7 @@ It is under development on [https://github.com/wren-lang/wren GitHub] and is ful The CLI tool (Wren CLI) has its own repository and is the main focus of examples written for RC. The latest version 0.4.0 is available as a pre-built standalone executable for 64-bit Linux, MacOS and Windows and can be downloaded from [https://github.com/wren-lang/wren-cli/releases here]. -Following the migration to Miraheze and then WikiTide, RC now uses [https://pygments.org Pygments] (rather than GeSHi) for syntax highlighting and I have written a lexer for Wren which is included in version 2.14.0. However, at the time of writing (August 2023), RC is still using version 2.11.2 and it is not known when this will be updated to the latest version. - -In the meantime 'ecmascript', which we currently use for the 'lang' attribute, is supported by virtue of a GeSHi mapping to the 'javascript' lexer and highlights all Wren 0.4.0 keywords except: ''is'', ''construct'' and ''foreign''. I suggest we continue to use that until the Wren lexer is available after which we can use the latter for new tasks and when updating existing tasks. A major effort would be needed to update all existing tasks straightaway given that there are more than 1,600 of them as at August 2023. - -As a language mainly designed for embedding, Wren's standard library is (of necessity) quite small and I have therefore decided to create some additional modules to assist with writing Rosetta Code tasks so the same code does not have to be written or copy/pasted time and time again thereby bloating a task's script code unnecessarily. The ones written so far are listed below: +As a language mainly designed for embedding, Wren's standard library is (of necessity) quite small and I ([[User:PureFox|PureFox]]) have therefore decided to create some additional modules to assist with writing Rosetta Code tasks so the same code does not have to be written or copy/pasted time and time again thereby bloating a task's script code unnecessarily. The ones written so far are listed below: {| class="wikitable" ! No. !! Module name !! !! No. !! Module name @@ -68,12 +64,16 @@ As a language mainly designed for embedding, Wren's standard library is (of nece |- | 43 || [[:Category:Wren-vector|vector]] || || 44 || [[:Category:Wren-ordered|ordered]] |- -| 45 || [[:Category:Wren-psieve|psieve]] || || || +| 45 || [[:Category:Wren-psieve|psieve]] || || 46 || [[:Category:Wren-hash|hash]] +|- +| 47 || [[:Category:Wren-roman|roman]] || || 48 || [[:Category:Wren-std|std]] +|- +| 49 || [[:Category:Wren-ansi|ansi]] || || || |}
    To use a class or classes from a module (say ''fmt''), you need to import them into your script with Wren code such as the following. To use more than one class separate their names with commas: -import "./fmt" for Conv, Fmt +import "./fmt" for Conv, Fmt These modules are subject to the same license as any other code submitted to Rosetta Code though contributors' user pages should be checked to see whether more permissive terms are available. If anyone wishes to add further modules, please do so using a similar model and append them to the list. @@ -95,5 +95,7 @@ There are also a number of third-party modules available for Wren of which the f
    For further information and licensing requirements, please consult their individual pages. +Finally, there are some RC tasks which require a special C executable to solve but where it is not worthwhile to create a dedicated module to house the Wren source code. See [[:Category:libwren|libwren]] for details. + ==Todo== * [[Tasks not implemented in Wren]] \ No newline at end of file diff --git a/Lang/Wren/Bioinformatics-base-count b/Lang/Wren/Bioinformatics-base-count deleted file mode 120000 index 620c92bb71..0000000000 --- a/Lang/Wren/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Wren \ No newline at end of file diff --git a/Lang/Wren/Empty-program b/Lang/Wren/Empty-program deleted file mode 120000 index e0842518a1..0000000000 --- a/Lang/Wren/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Wren \ No newline at end of file diff --git a/Lang/Wren/Meissel-Mertens-constant b/Lang/Wren/Meissel-Mertens-constant deleted file mode 120000 index 2a9c71a439..0000000000 --- a/Lang/Wren/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Wren \ No newline at end of file diff --git a/Lang/Wren/Miller-Rabin-primality-test b/Lang/Wren/Miller-Rabin-primality-test deleted file mode 120000 index 26f77867d2..0000000000 --- a/Lang/Wren/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Wren \ No newline at end of file diff --git a/Lang/Wren/Quaternion-type b/Lang/Wren/Quaternion-type deleted file mode 120000 index 42a26f0111..0000000000 --- a/Lang/Wren/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Wren \ No newline at end of file diff --git a/Lang/Wren/Sorting-Algorithms-Circle-Sort b/Lang/Wren/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 3d8f8916cb..0000000000 --- a/Lang/Wren/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Wren \ No newline at end of file diff --git a/Lang/X-script/00-LANG.txt b/Lang/X-script/00-LANG.txt new file mode 100644 index 0000000000..af743e22c3 --- /dev/null +++ b/Lang/X-script/00-LANG.txt @@ -0,0 +1,38 @@ +{{language|X-script}} +X-script is a minimalistic programming language which is characterised by user friendlyness and simplicity. +All data are strings. It can also handle binary data, which are then encoded as hexadecimal strings. +It can read from and write to files and serial devices like TCP/IP ports and serial ports. +It has a window that has similarities with consoles, where you can start programs, call functions and call states or just write code (like in Python). + +Here is an example of an x-script that implements a chemical calculator: +[[Chemical_calculator#X-script]]. + +The development of X-script started around 1980 and the language has been improved ever since. Originally, the goal was to enable the creation of rapid prototypes of programs, to test ideas before the real programming started. + +The "Hello world" program looks like this: + + +In x-script, you can develop an application in two different ways. One is as a function, which is similar to functions in other languages, except that all data are strings. + +The other is as a state, which is a list of inputs and outputs. +A state is mostly the quickest way to solve a programming problem. It is also easy to read, since it is a list of inputs and the corresponding outputs or actions. The inputs are surrounded by ?"..."? and the corresponding outputs or actions by !"..."!. If you for example want to read a comma-separated account from a bank, the state could look like this: + +accountStatement.x +------------------ +(* Titles *) +?"TransactionDate;Reference;Amount +"? +!""! + +(* Example: 2023-09-04;Accessa Finance Inc 305653152413;-3850.00 *) +?";; +"? +!" you '<0,payed to,earned from>

    :

    dollars."! + +?""? +!""! + + +Function calls have this format: . + +The example above calls the library functions , , , ,

    , and .

    , , and are "pattern functions" which are used to match input strings.

    ,

    and are ordinary functions. prints a string to the X-window.

    retrieves stringparts identified in the input file. returns from the state, \ No newline at end of file diff --git a/Lang/X-script/00-META.yaml b/Lang/X-script/00-META.yaml new file mode 100644 index 0000000000..2fd50d732b --- /dev/null +++ b/Lang/X-script/00-META.yaml @@ -0,0 +1,2 @@ +--- +from: http://rosettacode.org/wiki/Category:X-script diff --git a/Lang/X86-64-Assembly/A+B b/Lang/X86-64-Assembly/A+B new file mode 120000 index 0000000000..8da0da2282 --- /dev/null +++ b/Lang/X86-64-Assembly/A+B @@ -0,0 +1 @@ +../../Task/A+B/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Binary-digits b/Lang/X86-64-Assembly/Binary-digits new file mode 120000 index 0000000000..1eb48aa18a --- /dev/null +++ b/Lang/X86-64-Assembly/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Command-line-arguments b/Lang/X86-64-Assembly/Command-line-arguments new file mode 120000 index 0000000000..112452a5d5 --- /dev/null +++ b/Lang/X86-64-Assembly/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Create-an-HTML-table b/Lang/X86-64-Assembly/Create-an-HTML-table new file mode 120000 index 0000000000..e10bb5efed --- /dev/null +++ b/Lang/X86-64-Assembly/Create-an-HTML-table @@ -0,0 +1 @@ +../../Task/Create-an-HTML-table/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Generate-lower-case-ASCII-alphabet b/Lang/X86-64-Assembly/Generate-lower-case-ASCII-alphabet new file mode 120000 index 0000000000..0146a7c580 --- /dev/null +++ b/Lang/X86-64-Assembly/Generate-lower-case-ASCII-alphabet @@ -0,0 +1 @@ +../../Task/Generate-lower-case-ASCII-alphabet/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/HTTPS b/Lang/X86-64-Assembly/HTTPS new file mode 120000 index 0000000000..2a06876bd2 --- /dev/null +++ b/Lang/X86-64-Assembly/HTTPS @@ -0,0 +1 @@ +../../Task/HTTPS/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Include-a-file b/Lang/X86-64-Assembly/Include-a-file new file mode 120000 index 0000000000..b94c0093ef --- /dev/null +++ b/Lang/X86-64-Assembly/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Magic-8-ball b/Lang/X86-64-Assembly/Magic-8-ball new file mode 120000 index 0000000000..63e5e8cfbb --- /dev/null +++ b/Lang/X86-64-Assembly/Magic-8-ball @@ -0,0 +1 @@ +../../Task/Magic-8-ball/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Password-generator b/Lang/X86-64-Assembly/Password-generator new file mode 120000 index 0000000000..e8e77773e7 --- /dev/null +++ b/Lang/X86-64-Assembly/Password-generator @@ -0,0 +1 @@ +../../Task/Password-generator/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Pseudo-random-numbers-Middle-square-method b/Lang/X86-64-Assembly/Pseudo-random-numbers-Middle-square-method new file mode 120000 index 0000000000..9ff7bee727 --- /dev/null +++ b/Lang/X86-64-Assembly/Pseudo-random-numbers-Middle-square-method @@ -0,0 +1 @@ +../../Task/Pseudo-random-numbers-Middle-square-method/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Random-number-generator-device- b/Lang/X86-64-Assembly/Random-number-generator-device- new file mode 120000 index 0000000000..17f5db574d --- /dev/null +++ b/Lang/X86-64-Assembly/Random-number-generator-device- @@ -0,0 +1 @@ +../../Task/Random-number-generator-device-/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Rot-13 b/Lang/X86-64-Assembly/Rot-13 new file mode 120000 index 0000000000..498ce19193 --- /dev/null +++ b/Lang/X86-64-Assembly/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Sieve-of-Eratosthenes b/Lang/X86-64-Assembly/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..2ec4e68176 --- /dev/null +++ b/Lang/X86-64-Assembly/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Stack b/Lang/X86-64-Assembly/Stack new file mode 120000 index 0000000000..f458d7ec5f --- /dev/null +++ b/Lang/X86-64-Assembly/Stack @@ -0,0 +1 @@ +../../Task/Stack/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/String-length b/Lang/X86-64-Assembly/String-length new file mode 120000 index 0000000000..d3dacaf4b5 --- /dev/null +++ b/Lang/X86-64-Assembly/String-length @@ -0,0 +1 @@ +../../Task/String-length/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Terminal-control-Clear-the-screen b/Lang/X86-64-Assembly/Terminal-control-Clear-the-screen new file mode 120000 index 0000000000..8974ae4cd4 --- /dev/null +++ b/Lang/X86-64-Assembly/Terminal-control-Clear-the-screen @@ -0,0 +1 @@ +../../Task/Terminal-control-Clear-the-screen/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-64-Assembly/Twos-complement b/Lang/X86-64-Assembly/Twos-complement new file mode 120000 index 0000000000..03daa00fb9 --- /dev/null +++ b/Lang/X86-64-Assembly/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/X86-64-Assembly \ No newline at end of file diff --git a/Lang/X86-Assembly/Pythagoras-tree b/Lang/X86-Assembly/Pythagoras-tree new file mode 120000 index 0000000000..2ed69a8164 --- /dev/null +++ b/Lang/X86-Assembly/Pythagoras-tree @@ -0,0 +1 @@ +../../Task/Pythagoras-tree/X86-Assembly \ No newline at end of file diff --git a/Lang/X86-Assembly/Stack b/Lang/X86-Assembly/Stack deleted file mode 120000 index c0f7dc8fa0..0000000000 --- a/Lang/X86-Assembly/Stack +++ /dev/null @@ -1 +0,0 @@ -../../Task/Stack/X86-Assembly \ No newline at end of file diff --git a/Lang/XBS/00-LANG.txt b/Lang/XBS/00-LANG.txt index 46cebd0203..87ee4c9802 100644 --- a/Lang/XBS/00-LANG.txt +++ b/Lang/XBS/00-LANG.txt @@ -1,29 +1,8 @@ {{language|XBS}} == What is XBS? == -XBS is an interpreted language written in [[JavaScript]]. XBS has similarities to JavaScript and Python, as well as some other languages. XBS can be used for any web page with the correct library. ----- - -== Details == - -XBS has a github page and is currently open-sourced. The github page has a wiki for the documentation; but just know, this language still isn't done. It has most features a programming language has, except for some minor details that I need to fix. - ----- - -== Code Examples == - -Variable declaration - -set x = "Hello, world!"; -log(x) - -Functions - -func FirstFunction(a,b){ - send a+b; #Add a and b -} -log(FirstFunction(1,2)); +XBS is an interpreted language written in [[JavaScript]]. The language does not have its own sandbox, and relies on methods passed down from JavaScript. XBS was created originally to help its creator understand how to create a basic programming language, and later branched out its syntax in creative ways. ---- @@ -34,4 +13,5 @@ log(FirstFunction(1,2)); == Notes == -XBS is currently going through a rewrite, and the wiki has not been rewritten yet. \ No newline at end of file +* XBS was re-written back in 2021 as the language had a lot of issues with expressional parsing priorities. Most XBS examples on this site are outdated. +* XBS is a slow language, as it is interpreted using [[JavaScript]] \ No newline at end of file diff --git a/Lang/XBasic/A+B b/Lang/XBasic/A+B new file mode 120000 index 0000000000..2ae8f1e153 --- /dev/null +++ b/Lang/XBasic/A+B @@ -0,0 +1 @@ +../../Task/A+B/XBasic \ No newline at end of file diff --git a/Lang/XBasic/AKS-test-for-primes b/Lang/XBasic/AKS-test-for-primes new file mode 120000 index 0000000000..dcd18f7155 --- /dev/null +++ b/Lang/XBasic/AKS-test-for-primes @@ -0,0 +1 @@ +../../Task/AKS-test-for-primes/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Arithmetic-Integer b/Lang/XBasic/Arithmetic-Integer new file mode 120000 index 0000000000..5503d60907 --- /dev/null +++ b/Lang/XBasic/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Array-length b/Lang/XBasic/Array-length new file mode 120000 index 0000000000..2333470822 --- /dev/null +++ b/Lang/XBasic/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Associative-array-Merging b/Lang/XBasic/Associative-array-Merging new file mode 120000 index 0000000000..9fcd826207 --- /dev/null +++ b/Lang/XBasic/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Casting-out-nines b/Lang/XBasic/Casting-out-nines new file mode 120000 index 0000000000..dce43ee2c9 --- /dev/null +++ b/Lang/XBasic/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Catalan-numbers-Pascals-triangle b/Lang/XBasic/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..10339454b2 --- /dev/null +++ b/Lang/XBasic/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Character-codes b/Lang/XBasic/Character-codes new file mode 120000 index 0000000000..43fb37069a --- /dev/null +++ b/Lang/XBasic/Character-codes @@ -0,0 +1 @@ +../../Task/Character-codes/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Compare-length-of-two-strings b/Lang/XBasic/Compare-length-of-two-strings new file mode 120000 index 0000000000..a1f14e838c --- /dev/null +++ b/Lang/XBasic/Compare-length-of-two-strings @@ -0,0 +1 @@ +../../Task/Compare-length-of-two-strings/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Create-a-two-dimensional-array-at-runtime b/Lang/XBasic/Create-a-two-dimensional-array-at-runtime new file mode 120000 index 0000000000..8726c848d3 --- /dev/null +++ b/Lang/XBasic/Create-a-two-dimensional-array-at-runtime @@ -0,0 +1 @@ +../../Task/Create-a-two-dimensional-array-at-runtime/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Determine-sentence-type b/Lang/XBasic/Determine-sentence-type new file mode 120000 index 0000000000..ea580ad280 --- /dev/null +++ b/Lang/XBasic/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Diversity-prediction-theorem b/Lang/XBasic/Diversity-prediction-theorem new file mode 120000 index 0000000000..76939265dd --- /dev/null +++ b/Lang/XBasic/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Egyptian-division b/Lang/XBasic/Egyptian-division new file mode 120000 index 0000000000..a6aa1a2cdb --- /dev/null +++ b/Lang/XBasic/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Euler-method b/Lang/XBasic/Euler-method new file mode 120000 index 0000000000..546ca521e8 --- /dev/null +++ b/Lang/XBasic/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Factors-of-an-integer b/Lang/XBasic/Factors-of-an-integer new file mode 120000 index 0000000000..7fae81222b --- /dev/null +++ b/Lang/XBasic/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Floyds-triangle b/Lang/XBasic/Floyds-triangle new file mode 120000 index 0000000000..4523e23d1e --- /dev/null +++ b/Lang/XBasic/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Jewels-and-stones b/Lang/XBasic/Jewels-and-stones new file mode 120000 index 0000000000..b0451efebb --- /dev/null +++ b/Lang/XBasic/Jewels-and-stones @@ -0,0 +1 @@ +../../Task/Jewels-and-stones/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Josephus-problem b/Lang/XBasic/Josephus-problem new file mode 120000 index 0000000000..425d14bd16 --- /dev/null +++ b/Lang/XBasic/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Levenshtein-distance b/Lang/XBasic/Levenshtein-distance new file mode 120000 index 0000000000..57fd900b58 --- /dev/null +++ b/Lang/XBasic/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Loops-Infinite b/Lang/XBasic/Loops-Infinite new file mode 120000 index 0000000000..b803a965e4 --- /dev/null +++ b/Lang/XBasic/Loops-Infinite @@ -0,0 +1 @@ +../../Task/Loops-Infinite/XBasic \ No newline at end of file diff --git a/Lang/XBasic/M-bius-function b/Lang/XBasic/M-bius-function new file mode 120000 index 0000000000..09886c7873 --- /dev/null +++ b/Lang/XBasic/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Minimum-multiple-of-m-where-digital-sum-equals-m b/Lang/XBasic/Minimum-multiple-of-m-where-digital-sum-equals-m new file mode 120000 index 0000000000..cd100be048 --- /dev/null +++ b/Lang/XBasic/Minimum-multiple-of-m-where-digital-sum-equals-m @@ -0,0 +1 @@ +../../Task/Minimum-multiple-of-m-where-digital-sum-equals-m/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Nim-game b/Lang/XBasic/Nim-game new file mode 120000 index 0000000000..49a494ab0c --- /dev/null +++ b/Lang/XBasic/Nim-game @@ -0,0 +1 @@ +../../Task/Nim-game/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Pancake-numbers b/Lang/XBasic/Pancake-numbers new file mode 120000 index 0000000000..ba6560d347 --- /dev/null +++ b/Lang/XBasic/Pancake-numbers @@ -0,0 +1 @@ +../../Task/Pancake-numbers/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Repeat-a-string b/Lang/XBasic/Repeat-a-string new file mode 120000 index 0000000000..0b1c9c7144 --- /dev/null +++ b/Lang/XBasic/Repeat-a-string @@ -0,0 +1 @@ +../../Task/Repeat-a-string/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Rot-13 b/Lang/XBasic/Rot-13 new file mode 120000 index 0000000000..9a7090ef33 --- /dev/null +++ b/Lang/XBasic/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors b/Lang/XBasic/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors new file mode 120000 index 0000000000..7b15cd8cd8 --- /dev/null +++ b/Lang/XBasic/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Sequence:-smallest-number-with-exactly-n-divisors b/Lang/XBasic/Sequence:-smallest-number-with-exactly-n-divisors new file mode 120000 index 0000000000..6eb9075421 --- /dev/null +++ b/Lang/XBasic/Sequence:-smallest-number-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-with-exactly-n-divisors/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Set-consolidation b/Lang/XBasic/Set-consolidation new file mode 120000 index 0000000000..b659c95c85 --- /dev/null +++ b/Lang/XBasic/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Sorting-algorithms-Quicksort b/Lang/XBasic/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..baefc61c90 --- /dev/null +++ b/Lang/XBasic/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/XBasic \ No newline at end of file diff --git a/Lang/XBasic/String-append b/Lang/XBasic/String-append new file mode 120000 index 0000000000..b6f1a48c3b --- /dev/null +++ b/Lang/XBasic/String-append @@ -0,0 +1 @@ +../../Task/String-append/XBasic \ No newline at end of file diff --git a/Lang/XBasic/String-interpolation-included- b/Lang/XBasic/String-interpolation-included- new file mode 120000 index 0000000000..8151e314f6 --- /dev/null +++ b/Lang/XBasic/String-interpolation-included- @@ -0,0 +1 @@ +../../Task/String-interpolation-included-/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Sum-digits-of-an-integer b/Lang/XBasic/Sum-digits-of-an-integer new file mode 120000 index 0000000000..e4727e227f --- /dev/null +++ b/Lang/XBasic/Sum-digits-of-an-integer @@ -0,0 +1 @@ +../../Task/Sum-digits-of-an-integer/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Tau-number b/Lang/XBasic/Tau-number new file mode 120000 index 0000000000..c3b088d383 --- /dev/null +++ b/Lang/XBasic/Tau-number @@ -0,0 +1 @@ +../../Task/Tau-number/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Temperature-conversion b/Lang/XBasic/Temperature-conversion new file mode 120000 index 0000000000..2d3b1dbfb0 --- /dev/null +++ b/Lang/XBasic/Temperature-conversion @@ -0,0 +1 @@ +../../Task/Temperature-conversion/XBasic \ No newline at end of file diff --git a/Lang/XBasic/The-Name-Game b/Lang/XBasic/The-Name-Game new file mode 120000 index 0000000000..bc5b69cbc8 --- /dev/null +++ b/Lang/XBasic/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/XBasic \ No newline at end of file diff --git a/Lang/XBasic/The-Twelve-Days-of-Christmas b/Lang/XBasic/The-Twelve-Days-of-Christmas new file mode 120000 index 0000000000..98d54361e6 --- /dev/null +++ b/Lang/XBasic/The-Twelve-Days-of-Christmas @@ -0,0 +1 @@ +../../Task/The-Twelve-Days-of-Christmas/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Twos-complement b/Lang/XBasic/Twos-complement new file mode 120000 index 0000000000..651db096a5 --- /dev/null +++ b/Lang/XBasic/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/XBasic \ No newline at end of file diff --git a/Lang/XBasic/Van-Eck-sequence b/Lang/XBasic/Van-Eck-sequence new file mode 120000 index 0000000000..80aaf3c605 --- /dev/null +++ b/Lang/XBasic/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/XBasic \ No newline at end of file diff --git a/Lang/XPL0/00-LANG.txt b/Lang/XPL0/00-LANG.txt index 7ac7800bc2..882639ebca 100644 --- a/Lang/XPL0/00-LANG.txt +++ b/Lang/XPL0/00-LANG.txt @@ -8,9 +8,9 @@ XPL0 compiler was written in ALGOL, which was then used to create a compiler written in XPL0's syntax. XPL0 has been implemented on more than a dozen processors, but it's -currently maintained on the Raspberry Pi and IBM-type PCs. Programs run under Linux, Windows, and DOS. Free, open-source versions of the +currently maintained on the Raspberry Pi and IBM-type PCs. Programs run under Linux, Windows, and MS-DOS. Free, open-source versions of the compilers (interpreted, assembly-code compiled, and optimizing) are -available from the official website: xpl0.org [http://www.xpl0.org/]. The 32-bit version of the DOS compiler, XPLPX, was used for most of these Rosetta Code tasks, but more recent tasks were implemented using the compilers for the Raspberry Pi. Some tasks were implemented using [[EXPL-32]]. +available from the official website: xpl0.org [http://www.xpl0.org/]. The 32-bit version of the MS-DOS compiler, XPLPX, was used for many of these Rosetta Code tasks, but more recent tasks were implemented using the compilers for the Raspberry Pi. Some tasks were implemented using [[EXPL-32]]. Here's how the traditional Hello World program is coded: @@ -30,7 +30,7 @@ outputs strings. There are over a hundred of these built-in routines that provide capabilities such as input and output, graphics, and trig functions. -The 32-bit versions of the compilers (as opposed to the older, 16-bit versions) automatically declare ''code'' declarations. Thus the above program can simply be written as: +The 32-bit versions of the compilers (as opposed to the older, 16-bit versions) automatically declare ''code'' declarations. Thus the above program can simply be rewritten as:

           Text(0, "Hello World!")
    diff --git a/Lang/XPL0/24-game b/Lang/XPL0/24-game
    new file mode 120000
    index 0000000000..90030b857d
    --- /dev/null
    +++ b/Lang/XPL0/24-game
    @@ -0,0 +1 @@
    +../../Task/24-game/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/AKS-test-for-primes b/Lang/XPL0/AKS-test-for-primes
    new file mode 120000
    index 0000000000..16474e53df
    --- /dev/null
    +++ b/Lang/XPL0/AKS-test-for-primes
    @@ -0,0 +1 @@
    +../../Task/AKS-test-for-primes/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Align-columns b/Lang/XPL0/Align-columns
    new file mode 120000
    index 0000000000..ecddcb868c
    --- /dev/null
    +++ b/Lang/XPL0/Align-columns
    @@ -0,0 +1 @@
    +../../Task/Align-columns/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Arithmetic-derivative b/Lang/XPL0/Arithmetic-derivative
    new file mode 120000
    index 0000000000..5115ecc5f7
    --- /dev/null
    +++ b/Lang/XPL0/Arithmetic-derivative
    @@ -0,0 +1 @@
    +../../Task/Arithmetic-derivative/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Arithmetic-geometric-mean-Calculate-Pi b/Lang/XPL0/Arithmetic-geometric-mean-Calculate-Pi
    new file mode 120000
    index 0000000000..34337f3f2d
    --- /dev/null
    +++ b/Lang/XPL0/Arithmetic-geometric-mean-Calculate-Pi
    @@ -0,0 +1 @@
    +../../Task/Arithmetic-geometric-mean-Calculate-Pi/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Average-loop-length b/Lang/XPL0/Average-loop-length
    new file mode 120000
    index 0000000000..b29c22437d
    --- /dev/null
    +++ b/Lang/XPL0/Average-loop-length
    @@ -0,0 +1 @@
    +../../Task/Average-loop-length/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Bifid-cipher b/Lang/XPL0/Bifid-cipher
    new file mode 120000
    index 0000000000..224f51d976
    --- /dev/null
    +++ b/Lang/XPL0/Bifid-cipher
    @@ -0,0 +1 @@
    +../../Task/Bifid-cipher/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Bin-given-limits b/Lang/XPL0/Bin-given-limits
    new file mode 120000
    index 0000000000..d093bfd306
    --- /dev/null
    +++ b/Lang/XPL0/Bin-given-limits
    @@ -0,0 +1 @@
    +../../Task/Bin-given-limits/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Bioinformatics-base-count b/Lang/XPL0/Bioinformatics-base-count
    deleted file mode 120000
    index 485c648b6c..0000000000
    --- a/Lang/XPL0/Bioinformatics-base-count
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Bioinformatics-base-count/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Cistercian-numerals b/Lang/XPL0/Cistercian-numerals
    new file mode 120000
    index 0000000000..c2ce89db06
    --- /dev/null
    +++ b/Lang/XPL0/Cistercian-numerals
    @@ -0,0 +1 @@
    +../../Task/Cistercian-numerals/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Convex-hull b/Lang/XPL0/Convex-hull
    new file mode 120000
    index 0000000000..7a2a0c2b94
    --- /dev/null
    +++ b/Lang/XPL0/Convex-hull
    @@ -0,0 +1 @@
    +../../Task/Convex-hull/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Count-the-coins b/Lang/XPL0/Count-the-coins
    new file mode 120000
    index 0000000000..7a91396756
    --- /dev/null
    +++ b/Lang/XPL0/Count-the-coins
    @@ -0,0 +1 @@
    +../../Task/Count-the-coins/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Create-an-object-at-a-given-address b/Lang/XPL0/Create-an-object-at-a-given-address
    new file mode 120000
    index 0000000000..10ca5e5926
    --- /dev/null
    +++ b/Lang/XPL0/Create-an-object-at-a-given-address
    @@ -0,0 +1 @@
    +../../Task/Create-an-object-at-a-given-address/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Currency b/Lang/XPL0/Currency
    new file mode 120000
    index 0000000000..05aee1c3b1
    --- /dev/null
    +++ b/Lang/XPL0/Currency
    @@ -0,0 +1 @@
    +../../Task/Currency/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Determinant-and-permanent b/Lang/XPL0/Determinant-and-permanent
    new file mode 120000
    index 0000000000..ffda863c8d
    --- /dev/null
    +++ b/Lang/XPL0/Determinant-and-permanent
    @@ -0,0 +1 @@
    +../../Task/Determinant-and-permanent/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Display-a-linear-combination b/Lang/XPL0/Display-a-linear-combination
    new file mode 120000
    index 0000000000..bd14d58a74
    --- /dev/null
    +++ b/Lang/XPL0/Display-a-linear-combination
    @@ -0,0 +1 @@
    +../../Task/Display-a-linear-combination/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Draw-a-clock b/Lang/XPL0/Draw-a-clock
    new file mode 120000
    index 0000000000..7d1040eda3
    --- /dev/null
    +++ b/Lang/XPL0/Draw-a-clock
    @@ -0,0 +1 @@
    +../../Task/Draw-a-clock/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Find-common-directory-path b/Lang/XPL0/Find-common-directory-path
    new file mode 120000
    index 0000000000..29427fdf4b
    --- /dev/null
    +++ b/Lang/XPL0/Find-common-directory-path
    @@ -0,0 +1 @@
    +../../Task/Find-common-directory-path/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Find-limit-of-recursion b/Lang/XPL0/Find-limit-of-recursion
    new file mode 120000
    index 0000000000..3f535420c0
    --- /dev/null
    +++ b/Lang/XPL0/Find-limit-of-recursion
    @@ -0,0 +1 @@
    +../../Task/Find-limit-of-recursion/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Fivenum b/Lang/XPL0/Fivenum
    new file mode 120000
    index 0000000000..2bd4e43614
    --- /dev/null
    +++ b/Lang/XPL0/Fivenum
    @@ -0,0 +1 @@
    +../../Task/Fivenum/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Floyd-Warshall-algorithm b/Lang/XPL0/Floyd-Warshall-algorithm
    new file mode 120000
    index 0000000000..ffd21f6111
    --- /dev/null
    +++ b/Lang/XPL0/Floyd-Warshall-algorithm
    @@ -0,0 +1 @@
    +../../Task/Floyd-Warshall-algorithm/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/GUI-component-interaction b/Lang/XPL0/GUI-component-interaction
    new file mode 120000
    index 0000000000..8745be4ca4
    --- /dev/null
    +++ b/Lang/XPL0/GUI-component-interaction
    @@ -0,0 +1 @@
    +../../Task/GUI-component-interaction/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Gaussian-elimination b/Lang/XPL0/Gaussian-elimination
    new file mode 120000
    index 0000000000..6a178b8f16
    --- /dev/null
    +++ b/Lang/XPL0/Gaussian-elimination
    @@ -0,0 +1 @@
    +../../Task/Gaussian-elimination/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Get-system-command-output b/Lang/XPL0/Get-system-command-output
    new file mode 120000
    index 0000000000..260a4a7590
    --- /dev/null
    +++ b/Lang/XPL0/Get-system-command-output
    @@ -0,0 +1 @@
    +../../Task/Get-system-command-output/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Hash-from-two-arrays b/Lang/XPL0/Hash-from-two-arrays
    new file mode 120000
    index 0000000000..13d72870ed
    --- /dev/null
    +++ b/Lang/XPL0/Hash-from-two-arrays
    @@ -0,0 +1 @@
    +../../Task/Hash-from-two-arrays/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Heronian-triangles b/Lang/XPL0/Heronian-triangles
    new file mode 120000
    index 0000000000..6766b4c3e4
    --- /dev/null
    +++ b/Lang/XPL0/Heronian-triangles
    @@ -0,0 +1 @@
    +../../Task/Heronian-triangles/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Hex-words b/Lang/XPL0/Hex-words
    new file mode 120000
    index 0000000000..4ed3e2b550
    --- /dev/null
    +++ b/Lang/XPL0/Hex-words
    @@ -0,0 +1 @@
    +../../Task/Hex-words/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Hofstadter-Conway-$10-000-sequence b/Lang/XPL0/Hofstadter-Conway-$10-000-sequence
    new file mode 120000
    index 0000000000..c4c0f0e659
    --- /dev/null
    +++ b/Lang/XPL0/Hofstadter-Conway-$10-000-sequence
    @@ -0,0 +1 @@
    +../../Task/Hofstadter-Conway-$10-000-sequence/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/I-before-E-except-after-C b/Lang/XPL0/I-before-E-except-after-C
    new file mode 120000
    index 0000000000..4eed624cc7
    --- /dev/null
    +++ b/Lang/XPL0/I-before-E-except-after-C
    @@ -0,0 +1 @@
    +../../Task/I-before-E-except-after-C/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/IBAN b/Lang/XPL0/IBAN
    new file mode 120000
    index 0000000000..ce771b5589
    --- /dev/null
    +++ b/Lang/XPL0/IBAN
    @@ -0,0 +1 @@
    +../../Task/IBAN/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Joystick-position b/Lang/XPL0/Joystick-position
    new file mode 120000
    index 0000000000..0ba634deb3
    --- /dev/null
    +++ b/Lang/XPL0/Joystick-position
    @@ -0,0 +1 @@
    +../../Task/Joystick-position/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Knapsack-problem-Bounded b/Lang/XPL0/Knapsack-problem-Bounded
    new file mode 120000
    index 0000000000..3ed5296747
    --- /dev/null
    +++ b/Lang/XPL0/Knapsack-problem-Bounded
    @@ -0,0 +1 @@
    +../../Task/Knapsack-problem-Bounded/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Knapsack-problem-Unbounded b/Lang/XPL0/Knapsack-problem-Unbounded
    new file mode 120000
    index 0000000000..8ccce2288b
    --- /dev/null
    +++ b/Lang/XPL0/Knapsack-problem-Unbounded
    @@ -0,0 +1 @@
    +../../Task/Knapsack-problem-Unbounded/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Largest-int-from-concatenated-ints b/Lang/XPL0/Largest-int-from-concatenated-ints
    new file mode 120000
    index 0000000000..c906e77c82
    --- /dev/null
    +++ b/Lang/XPL0/Largest-int-from-concatenated-ints
    @@ -0,0 +1 @@
    +../../Task/Largest-int-from-concatenated-ints/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Last-letter-first-letter b/Lang/XPL0/Last-letter-first-letter
    new file mode 120000
    index 0000000000..f77624cd59
    --- /dev/null
    +++ b/Lang/XPL0/Last-letter-first-letter
    @@ -0,0 +1 @@
    +../../Task/Last-letter-first-letter/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Left-factorials b/Lang/XPL0/Left-factorials
    new file mode 120000
    index 0000000000..c9ff64d1b6
    --- /dev/null
    +++ b/Lang/XPL0/Left-factorials
    @@ -0,0 +1 @@
    +../../Task/Left-factorials/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Levenshtein-distance b/Lang/XPL0/Levenshtein-distance
    new file mode 120000
    index 0000000000..0172b975ff
    --- /dev/null
    +++ b/Lang/XPL0/Levenshtein-distance
    @@ -0,0 +1 @@
    +../../Task/Levenshtein-distance/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Long-literals-with-continuations b/Lang/XPL0/Long-literals-with-continuations
    new file mode 120000
    index 0000000000..d850e008c5
    --- /dev/null
    +++ b/Lang/XPL0/Long-literals-with-continuations
    @@ -0,0 +1 @@
    +../../Task/Long-literals-with-continuations/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Long-primes b/Lang/XPL0/Long-primes
    new file mode 120000
    index 0000000000..4b515cb676
    --- /dev/null
    +++ b/Lang/XPL0/Long-primes
    @@ -0,0 +1 @@
    +../../Task/Long-primes/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Longest-increasing-subsequence b/Lang/XPL0/Longest-increasing-subsequence
    new file mode 120000
    index 0000000000..bed908bffb
    --- /dev/null
    +++ b/Lang/XPL0/Longest-increasing-subsequence
    @@ -0,0 +1 @@
    +../../Task/Longest-increasing-subsequence/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Longest-string-challenge b/Lang/XPL0/Longest-string-challenge
    new file mode 120000
    index 0000000000..08f945d149
    --- /dev/null
    +++ b/Lang/XPL0/Longest-string-challenge
    @@ -0,0 +1 @@
    +../../Task/Longest-string-challenge/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Magic-squares-of-doubly-even-order b/Lang/XPL0/Magic-squares-of-doubly-even-order
    new file mode 120000
    index 0000000000..31327c15e8
    --- /dev/null
    +++ b/Lang/XPL0/Magic-squares-of-doubly-even-order
    @@ -0,0 +1 @@
    +../../Task/Magic-squares-of-doubly-even-order/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Meissel-Mertens-constant b/Lang/XPL0/Meissel-Mertens-constant
    deleted file mode 120000
    index 8f73d24896..0000000000
    --- a/Lang/XPL0/Meissel-Mertens-constant
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Meissel-Mertens-constant/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Modified-random-distribution b/Lang/XPL0/Modified-random-distribution
    new file mode 120000
    index 0000000000..dfbceea492
    --- /dev/null
    +++ b/Lang/XPL0/Modified-random-distribution
    @@ -0,0 +1 @@
    +../../Task/Modified-random-distribution/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Numerical-integration-Gauss-Legendre-Quadrature b/Lang/XPL0/Numerical-integration-Gauss-Legendre-Quadrature
    new file mode 120000
    index 0000000000..a05d2a56e6
    --- /dev/null
    +++ b/Lang/XPL0/Numerical-integration-Gauss-Legendre-Quadrature
    @@ -0,0 +1 @@
    +../../Task/Numerical-integration-Gauss-Legendre-Quadrature/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Particle-fountain b/Lang/XPL0/Particle-fountain
    new file mode 120000
    index 0000000000..d512597b55
    --- /dev/null
    +++ b/Lang/XPL0/Particle-fountain
    @@ -0,0 +1 @@
    +../../Task/Particle-fountain/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Phrase-reversals b/Lang/XPL0/Phrase-reversals
    new file mode 120000
    index 0000000000..2aa0453c8b
    --- /dev/null
    +++ b/Lang/XPL0/Phrase-reversals
    @@ -0,0 +1 @@
    +../../Task/Phrase-reversals/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Poker-hand-analyser b/Lang/XPL0/Poker-hand-analyser
    new file mode 120000
    index 0000000000..5fc0329088
    --- /dev/null
    +++ b/Lang/XPL0/Poker-hand-analyser
    @@ -0,0 +1 @@
    +../../Task/Poker-hand-analyser/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Polynomial-regression b/Lang/XPL0/Polynomial-regression
    new file mode 120000
    index 0000000000..01f5c8d75a
    --- /dev/null
    +++ b/Lang/XPL0/Polynomial-regression
    @@ -0,0 +1 @@
    +../../Task/Polynomial-regression/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Primorial-numbers b/Lang/XPL0/Primorial-numbers
    new file mode 120000
    index 0000000000..6512549f63
    --- /dev/null
    +++ b/Lang/XPL0/Primorial-numbers
    @@ -0,0 +1 @@
    +../../Task/Primorial-numbers/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Quaternion-type b/Lang/XPL0/Quaternion-type
    deleted file mode 120000
    index 03ac35a45d..0000000000
    --- a/Lang/XPL0/Quaternion-type
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Quaternion-type/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Ramer-Douglas-Peucker-line-simplification b/Lang/XPL0/Ramer-Douglas-Peucker-line-simplification
    new file mode 120000
    index 0000000000..cfc7731dbf
    --- /dev/null
    +++ b/Lang/XPL0/Ramer-Douglas-Peucker-line-simplification
    @@ -0,0 +1 @@
    +../../Task/Ramer-Douglas-Peucker-line-simplification/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Read-a-configuration-file b/Lang/XPL0/Read-a-configuration-file
    new file mode 120000
    index 0000000000..338d315c72
    --- /dev/null
    +++ b/Lang/XPL0/Read-a-configuration-file
    @@ -0,0 +1 @@
    +../../Task/Read-a-configuration-file/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Rep-string b/Lang/XPL0/Rep-string
    new file mode 120000
    index 0000000000..d90ffe53d7
    --- /dev/null
    +++ b/Lang/XPL0/Rep-string
    @@ -0,0 +1 @@
    +../../Task/Rep-string/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Roots-of-a-quadratic-function b/Lang/XPL0/Roots-of-a-quadratic-function
    new file mode 120000
    index 0000000000..f39052a0fc
    --- /dev/null
    +++ b/Lang/XPL0/Roots-of-a-quadratic-function
    @@ -0,0 +1 @@
    +../../Task/Roots-of-a-quadratic-function/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Self-numbers b/Lang/XPL0/Self-numbers
    new file mode 120000
    index 0000000000..8d7258602b
    --- /dev/null
    +++ b/Lang/XPL0/Self-numbers
    @@ -0,0 +1 @@
    +../../Task/Self-numbers/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Sierpinski-square-curve b/Lang/XPL0/Sierpinski-square-curve
    new file mode 120000
    index 0000000000..f8060a7322
    --- /dev/null
    +++ b/Lang/XPL0/Sierpinski-square-curve
    @@ -0,0 +1 @@
    +../../Task/Sierpinski-square-curve/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Sort-numbers-lexicographically b/Lang/XPL0/Sort-numbers-lexicographically
    new file mode 120000
    index 0000000000..f415eaee2b
    --- /dev/null
    +++ b/Lang/XPL0/Sort-numbers-lexicographically
    @@ -0,0 +1 @@
    +../../Task/Sort-numbers-lexicographically/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Sort-three-variables b/Lang/XPL0/Sort-three-variables
    new file mode 120000
    index 0000000000..6a041ebc3e
    --- /dev/null
    +++ b/Lang/XPL0/Sort-three-variables
    @@ -0,0 +1 @@
    +../../Task/Sort-three-variables/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Sorting-Algorithms-Circle-Sort b/Lang/XPL0/Sorting-Algorithms-Circle-Sort
    deleted file mode 120000
    index a68d7b0426..0000000000
    --- a/Lang/XPL0/Sorting-Algorithms-Circle-Sort
    +++ /dev/null
    @@ -1 +0,0 @@
    -../../Task/Sorting-Algorithms-Circle-Sort/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Sorting-algorithms-Patience-sort b/Lang/XPL0/Sorting-algorithms-Patience-sort
    new file mode 120000
    index 0000000000..5ca2b1424f
    --- /dev/null
    +++ b/Lang/XPL0/Sorting-algorithms-Patience-sort
    @@ -0,0 +1 @@
    +../../Task/Sorting-algorithms-Patience-sort/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Sorting-algorithms-Permutation-sort b/Lang/XPL0/Sorting-algorithms-Permutation-sort
    new file mode 120000
    index 0000000000..a50b3c1c69
    --- /dev/null
    +++ b/Lang/XPL0/Sorting-algorithms-Permutation-sort
    @@ -0,0 +1 @@
    +../../Task/Sorting-algorithms-Permutation-sort/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Square-free-integers b/Lang/XPL0/Square-free-integers
    new file mode 120000
    index 0000000000..791b667893
    --- /dev/null
    +++ b/Lang/XPL0/Square-free-integers
    @@ -0,0 +1 @@
    +../../Task/Square-free-integers/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Stern-Brocot-sequence b/Lang/XPL0/Stern-Brocot-sequence
    new file mode 120000
    index 0000000000..a67d0ce67d
    --- /dev/null
    +++ b/Lang/XPL0/Stern-Brocot-sequence
    @@ -0,0 +1 @@
    +../../Task/Stern-Brocot-sequence/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Strip-block-comments b/Lang/XPL0/Strip-block-comments
    new file mode 120000
    index 0000000000..734cf1b909
    --- /dev/null
    +++ b/Lang/XPL0/Strip-block-comments
    @@ -0,0 +1 @@
    +../../Task/Strip-block-comments/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Substitution-cipher b/Lang/XPL0/Substitution-cipher
    new file mode 120000
    index 0000000000..e26a399b99
    --- /dev/null
    +++ b/Lang/XPL0/Substitution-cipher
    @@ -0,0 +1 @@
    +../../Task/Substitution-cipher/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Subtractive-generator b/Lang/XPL0/Subtractive-generator
    new file mode 120000
    index 0000000000..e69b094ce6
    --- /dev/null
    +++ b/Lang/XPL0/Subtractive-generator
    @@ -0,0 +1 @@
    +../../Task/Subtractive-generator/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Text-processing-1 b/Lang/XPL0/Text-processing-1
    new file mode 120000
    index 0000000000..395543f260
    --- /dev/null
    +++ b/Lang/XPL0/Text-processing-1
    @@ -0,0 +1 @@
    +../../Task/Text-processing-1/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Text-processing-2 b/Lang/XPL0/Text-processing-2
    new file mode 120000
    index 0000000000..8d2b9925ef
    --- /dev/null
    +++ b/Lang/XPL0/Text-processing-2
    @@ -0,0 +1 @@
    +../../Task/Text-processing-2/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Thieles-interpolation-formula b/Lang/XPL0/Thieles-interpolation-formula
    new file mode 120000
    index 0000000000..fcd209a547
    --- /dev/null
    +++ b/Lang/XPL0/Thieles-interpolation-formula
    @@ -0,0 +1 @@
    +../../Task/Thieles-interpolation-formula/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/User-input-Graphical b/Lang/XPL0/User-input-Graphical
    new file mode 120000
    index 0000000000..9b08de25b4
    --- /dev/null
    +++ b/Lang/XPL0/User-input-Graphical
    @@ -0,0 +1 @@
    +../../Task/User-input-Graphical/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Visualize-a-tree b/Lang/XPL0/Visualize-a-tree
    new file mode 120000
    index 0000000000..022c2d2ff2
    --- /dev/null
    +++ b/Lang/XPL0/Visualize-a-tree
    @@ -0,0 +1 @@
    +../../Task/Visualize-a-tree/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Window-creation b/Lang/XPL0/Window-creation
    new file mode 120000
    index 0000000000..8cbc53df4a
    --- /dev/null
    +++ b/Lang/XPL0/Window-creation
    @@ -0,0 +1 @@
    +../../Task/Window-creation/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/World-Cup-group-stage b/Lang/XPL0/World-Cup-group-stage
    new file mode 120000
    index 0000000000..4312a43d55
    --- /dev/null
    +++ b/Lang/XPL0/World-Cup-group-stage
    @@ -0,0 +1 @@
    +../../Task/World-Cup-group-stage/XPL0
    \ No newline at end of file
    diff --git a/Lang/XPL0/Write-float-arrays-to-a-text-file b/Lang/XPL0/Write-float-arrays-to-a-text-file
    new file mode 120000
    index 0000000000..23f438b765
    --- /dev/null
    +++ b/Lang/XPL0/Write-float-arrays-to-a-text-file
    @@ -0,0 +1 @@
    +../../Task/Write-float-arrays-to-a-text-file/XPL0
    \ No newline at end of file
    diff --git a/Lang/YAMLScript/00-LANG.txt b/Lang/YAMLScript/00-LANG.txt
    index 53857113ac..7e44330500 100644
    --- a/Lang/YAMLScript/00-LANG.txt
    +++ b/Lang/YAMLScript/00-LANG.txt
    @@ -4,19 +4,112 @@
     {{language programming paradigm|hosted}}
     {{implementation|Lisp}}
     
    -'''YAMLScript''' a hosted '''Lisp''' like '''Clojure''' (Java/JVM) and '''ClojureScript''' (JavaScript).
    -Actually it is simply an alternate syntax reader for Clojure and Lingy.
    -'''Lingy''' is a port of Clojure to various programming languages including Perl.
    +'''[https://yamlscript.org YS (pronounced "wise", aka YAMLScript)]''' is a new programming language that uses [https://yaml.org/ YAML] as its syntax. It is a complete, functional, general purpose language, but can also be easily embedded in YAML files to make them dynamic at load time. Most existing YAML files and all JSON files are already valid YS programs.
     
    -YAMLScript offers all the power of Lisp but with a various syntax features that strive to make it more readable than encoding everything as nested s-expression forms.
    +You can learn YS for free (with help from experienced mentors) at [https://exercism.org/tracks/yamlscript Exercism].
     
    -==Installing YAMLScript==
    +YS has a compiler/interpreter CLI program called [https://github.com/yaml/yamlscript/releases ys] and is also available in several programming languages as a binding module to the [https://github.com/yaml/yamlscript/releases libys.so] shared library:
     
    -Run this command to install the 'yamlscript' command line runner program.
    +* [https://www.nuget.org/packages/YAMLScript/ C#]
    +* [https://clojars.org/org.yamlscript/clj-yamlscript Clojure]
    +* [https://shardbox.org/shards/yamlscript Crystal]
    +* [https://github.com/yaml/yamlscript-go Go]
    +* [https://hackage.haskell.org/package/yamlscript Haskell]
    +* [https://clojars.org/org.yamlscript/yamlscript Java]
    +* [https://juliahub.com/ui/Packages/General/YAMLScript Julia]
    +* [https://luarocks.org/modules/ingy/yamlscript Lua]
    +* [https://www.npmjs.com/package/@yaml/yamlscript NodeJS]
    +* [https://metacpan.org/pod/YAMLScript Perl]
    +* [https://packagist.org/packages/yaml/yamlscript PHP]
    +* [https://pypi.org/project/yamlscript/ Python]
    +* [https://raku.land/zef:ingy/YAMLScript Raku]
    +* [https://rubygems.org/gems/yamlscript Ruby]
    +* [https://crates.io/crates/yamlscript Rust]
     
    - cpanm YAML
    +==Installing YS==
     
    -==See Also==
    +Run this command to install the ys command line YS runner/loader/compiler binary.
     
    -* [https://metacpan.org/pod/YAMLScript YAMLScript Doc]
    -* [https://metacpan.org/pod/Lingy Lingy Doc]
    \ No newline at end of file
    +  curl https://getys.org/ys | bash
    +
    +That will install $HOME/.local/bin/ys. If $HOME/.local/bin is not in your PATH, run:
    +
    +  export PATH=$HOME/.local/bin:$PATH
    +
    +Test the new installation:
    +
    +  $ ys --help
    +  ys - The YS Command Line Utility
    + 
    +  Usage: ys [options] [file]
    + 
    +  Options:
    +    -r, --run                Compile and evaluate a YS file (default)
    +    -l, --load               Output the evaluated YS value
    +    -e, --eval YSEXPR        Evaluate a YS expression
    +  ...
    +
    +See https://yamlscript.org for more information.
    +
    +==Adding YS Entries to Rosetta Code==
    +
    +Here's a YS program that you can use to format a YS program and it's output to a MediaWiki text to insert into a Rosetta Code task page:
    +
    +
    +#!/usr/bin/env ys-0
    +
    +# Create a Rosetta Code entry for a YS program:
    +
    +defn main(program *args):
    +  say: |-
    +
    +    =={{header|YAMLScript}}==
    +    
    +    $chomp(program:read)
    +    
    +
    +  when-not ENV.NO_OUT.?:
    +    command =: "ys $program$fmt-args(args)"
    +    output =: bash(command).out:chomp
    +    say: |-
    +
    +      {{out}}
    +      
    +      $ $command
    +      $output
    +      </pre>
    +
    +defn fmt-args(args):
    +  args =: !:joins
    +    map _ args:
    +      \(re-matches(/[-+,.:\w]+/ _:S)
    +        .if(_ pr-str(_)))
    +  when args.?: " $args"
    +
    + +You run it like this: + +
    +$ ys rosetta-code-ys-entry fibonacci-sequence.ys 5
    +
    +=={{header|YAMLScript}}==
    +
    +!YS-v0
    +
    +defn main(n=10):
    +  loop a 0, b 1, i 1:
    +    say: a
    +    when i < n:
    +      recur: b, (a + b), i.++
    +
    +
    +{{out}}
    +
    +$ ys fibonacci-sequence.ys 5
    +0
    +1
    +1
    +2
    +3
    +</pre>
    +
    \ No newline at end of file diff --git a/Lang/YAMLScript/100-doors b/Lang/YAMLScript/100-doors new file mode 120000 index 0000000000..a1f276f73f --- /dev/null +++ b/Lang/YAMLScript/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/100-prisoners b/Lang/YAMLScript/100-prisoners new file mode 120000 index 0000000000..bebf8d5d8f --- /dev/null +++ b/Lang/YAMLScript/100-prisoners @@ -0,0 +1 @@ +../../Task/100-prisoners/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/21-game b/Lang/YAMLScript/21-game new file mode 120000 index 0000000000..80f0a3594c --- /dev/null +++ b/Lang/YAMLScript/21-game @@ -0,0 +1 @@ +../../Task/21-game/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Array-length b/Lang/YAMLScript/Array-length new file mode 120000 index 0000000000..6ab2707560 --- /dev/null +++ b/Lang/YAMLScript/Array-length @@ -0,0 +1 @@ +../../Task/Array-length/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Average-loop-length b/Lang/YAMLScript/Average-loop-length new file mode 120000 index 0000000000..21710eecef --- /dev/null +++ b/Lang/YAMLScript/Average-loop-length @@ -0,0 +1 @@ +../../Task/Average-loop-length/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Base64-decode-data b/Lang/YAMLScript/Base64-decode-data new file mode 120000 index 0000000000..0f66fa60fa --- /dev/null +++ b/Lang/YAMLScript/Base64-decode-data @@ -0,0 +1 @@ +../../Task/Base64-decode-data/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Best-shuffle b/Lang/YAMLScript/Best-shuffle new file mode 120000 index 0000000000..99ffbfc9b1 --- /dev/null +++ b/Lang/YAMLScript/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Conways-Game-of-Life b/Lang/YAMLScript/Conways-Game-of-Life new file mode 120000 index 0000000000..3153c05b26 --- /dev/null +++ b/Lang/YAMLScript/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Dragon-curve b/Lang/YAMLScript/Dragon-curve new file mode 120000 index 0000000000..7f9deedb82 --- /dev/null +++ b/Lang/YAMLScript/Dragon-curve @@ -0,0 +1 @@ +../../Task/Dragon-curve/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Even-or-odd b/Lang/YAMLScript/Even-or-odd new file mode 120000 index 0000000000..95556dd2eb --- /dev/null +++ b/Lang/YAMLScript/Even-or-odd @@ -0,0 +1 @@ +../../Task/Even-or-odd/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Floyds-triangle b/Lang/YAMLScript/Floyds-triangle new file mode 120000 index 0000000000..9c388f69f3 --- /dev/null +++ b/Lang/YAMLScript/Floyds-triangle @@ -0,0 +1 @@ +../../Task/Floyds-triangle/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Function-definition b/Lang/YAMLScript/Function-definition new file mode 120000 index 0000000000..cc6f6727f4 --- /dev/null +++ b/Lang/YAMLScript/Function-definition @@ -0,0 +1 @@ +../../Task/Function-definition/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Greatest-common-divisor b/Lang/YAMLScript/Greatest-common-divisor new file mode 120000 index 0000000000..134280cc97 --- /dev/null +++ b/Lang/YAMLScript/Greatest-common-divisor @@ -0,0 +1 @@ +../../Task/Greatest-common-divisor/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Integer-comparison b/Lang/YAMLScript/Integer-comparison new file mode 120000 index 0000000000..47b0c04990 --- /dev/null +++ b/Lang/YAMLScript/Integer-comparison @@ -0,0 +1 @@ +../../Task/Integer-comparison/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Integer-overflow b/Lang/YAMLScript/Integer-overflow new file mode 120000 index 0000000000..fe6aaac55c --- /dev/null +++ b/Lang/YAMLScript/Integer-overflow @@ -0,0 +1 @@ +../../Task/Integer-overflow/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/JortSort b/Lang/YAMLScript/JortSort new file mode 120000 index 0000000000..28bb797476 --- /dev/null +++ b/Lang/YAMLScript/JortSort @@ -0,0 +1 @@ +../../Task/JortSort/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Knuth-shuffle b/Lang/YAMLScript/Knuth-shuffle new file mode 120000 index 0000000000..676dc89553 --- /dev/null +++ b/Lang/YAMLScript/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Leap-year b/Lang/YAMLScript/Leap-year new file mode 120000 index 0000000000..47e901f838 --- /dev/null +++ b/Lang/YAMLScript/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Luhn-test-of-credit-card-numbers b/Lang/YAMLScript/Luhn-test-of-credit-card-numbers new file mode 120000 index 0000000000..f96e4c4d21 --- /dev/null +++ b/Lang/YAMLScript/Luhn-test-of-credit-card-numbers @@ -0,0 +1 @@ +../../Task/Luhn-test-of-credit-card-numbers/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Munching-squares b/Lang/YAMLScript/Munching-squares new file mode 120000 index 0000000000..2b7870226f --- /dev/null +++ b/Lang/YAMLScript/Munching-squares @@ -0,0 +1 @@ +../../Task/Munching-squares/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Next-highest-int-from-digits b/Lang/YAMLScript/Next-highest-int-from-digits new file mode 120000 index 0000000000..6dd0221650 --- /dev/null +++ b/Lang/YAMLScript/Next-highest-int-from-digits @@ -0,0 +1 @@ +../../Task/Next-highest-int-from-digits/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/One-dimensional-cellular-automata b/Lang/YAMLScript/One-dimensional-cellular-automata new file mode 120000 index 0000000000..74c105b72e --- /dev/null +++ b/Lang/YAMLScript/One-dimensional-cellular-automata @@ -0,0 +1 @@ +../../Task/One-dimensional-cellular-automata/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Palindrome-detection b/Lang/YAMLScript/Palindrome-detection new file mode 120000 index 0000000000..fc4c1cdd2f --- /dev/null +++ b/Lang/YAMLScript/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Quickselect-algorithm b/Lang/YAMLScript/Quickselect-algorithm new file mode 120000 index 0000000000..978322a04a --- /dev/null +++ b/Lang/YAMLScript/Quickselect-algorithm @@ -0,0 +1 @@ +../../Task/Quickselect-algorithm/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Rot-13 b/Lang/YAMLScript/Rot-13 new file mode 120000 index 0000000000..e4ce94bf65 --- /dev/null +++ b/Lang/YAMLScript/Rot-13 @@ -0,0 +1 @@ +../../Task/Rot-13/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Sieve-of-Eratosthenes b/Lang/YAMLScript/Sieve-of-Eratosthenes new file mode 120000 index 0000000000..b42b0394f6 --- /dev/null +++ b/Lang/YAMLScript/Sieve-of-Eratosthenes @@ -0,0 +1 @@ +../../Task/Sieve-of-Eratosthenes/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Sparkline-in-unicode b/Lang/YAMLScript/Sparkline-in-unicode new file mode 120000 index 0000000000..ae2a07413c --- /dev/null +++ b/Lang/YAMLScript/Sparkline-in-unicode @@ -0,0 +1 @@ +../../Task/Sparkline-in-unicode/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Terminal-control-Ringing-the-terminal-bell b/Lang/YAMLScript/Terminal-control-Ringing-the-terminal-bell new file mode 120000 index 0000000000..21baf990a9 --- /dev/null +++ b/Lang/YAMLScript/Terminal-control-Ringing-the-terminal-bell @@ -0,0 +1 @@ +../../Task/Terminal-control-Ringing-the-terminal-bell/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Tokenize-a-string b/Lang/YAMLScript/Tokenize-a-string new file mode 120000 index 0000000000..4c9f0efdcc --- /dev/null +++ b/Lang/YAMLScript/Tokenize-a-string @@ -0,0 +1 @@ +../../Task/Tokenize-a-string/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Undefined-values b/Lang/YAMLScript/Undefined-values new file mode 120000 index 0000000000..ff7699a995 --- /dev/null +++ b/Lang/YAMLScript/Undefined-values @@ -0,0 +1 @@ +../../Task/Undefined-values/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Validate-International-Securities-Identification-Number b/Lang/YAMLScript/Validate-International-Securities-Identification-Number new file mode 120000 index 0000000000..40c80b8d7d --- /dev/null +++ b/Lang/YAMLScript/Validate-International-Securities-Identification-Number @@ -0,0 +1 @@ +../../Task/Validate-International-Securities-Identification-Number/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Van-der-Corput-sequence b/Lang/YAMLScript/Van-der-Corput-sequence new file mode 120000 index 0000000000..654ffd3cbb --- /dev/null +++ b/Lang/YAMLScript/Van-der-Corput-sequence @@ -0,0 +1 @@ +../../Task/Van-der-Corput-sequence/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Weird-numbers b/Lang/YAMLScript/Weird-numbers new file mode 120000 index 0000000000..bf5aa481d4 --- /dev/null +++ b/Lang/YAMLScript/Weird-numbers @@ -0,0 +1 @@ +../../Task/Weird-numbers/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Xiaolin-Wus-line-algorithm b/Lang/YAMLScript/Xiaolin-Wus-line-algorithm new file mode 120000 index 0000000000..be316f6902 --- /dev/null +++ b/Lang/YAMLScript/Xiaolin-Wus-line-algorithm @@ -0,0 +1 @@ +../../Task/Xiaolin-Wus-line-algorithm/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Yellowstone-sequence b/Lang/YAMLScript/Yellowstone-sequence new file mode 120000 index 0000000000..efac2d410f --- /dev/null +++ b/Lang/YAMLScript/Yellowstone-sequence @@ -0,0 +1 @@ +../../Task/Yellowstone-sequence/YAMLScript \ No newline at end of file diff --git a/Lang/YAMLScript/Zig-zag-matrix b/Lang/YAMLScript/Zig-zag-matrix new file mode 120000 index 0000000000..691eda7cd9 --- /dev/null +++ b/Lang/YAMLScript/Zig-zag-matrix @@ -0,0 +1 @@ +../../Task/Zig-zag-matrix/YAMLScript \ No newline at end of file diff --git a/Lang/Yabasic/21-game b/Lang/Yabasic/21-game new file mode 120000 index 0000000000..4e021becb9 --- /dev/null +++ b/Lang/Yabasic/21-game @@ -0,0 +1 @@ +../../Task/21-game/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Arithmetic-geometric-mean b/Lang/Yabasic/Arithmetic-geometric-mean new file mode 120000 index 0000000000..8e46032637 --- /dev/null +++ b/Lang/Yabasic/Arithmetic-geometric-mean @@ -0,0 +1 @@ +../../Task/Arithmetic-geometric-mean/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Associative-array-Merging b/Lang/Yabasic/Associative-array-Merging new file mode 120000 index 0000000000..446716ab58 --- /dev/null +++ b/Lang/Yabasic/Associative-array-Merging @@ -0,0 +1 @@ +../../Task/Associative-array-Merging/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Averages-Mean-angle b/Lang/Yabasic/Averages-Mean-angle new file mode 120000 index 0000000000..ee2478f1ef --- /dev/null +++ b/Lang/Yabasic/Averages-Mean-angle @@ -0,0 +1 @@ +../../Task/Averages-Mean-angle/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Benfords-law b/Lang/Yabasic/Benfords-law new file mode 120000 index 0000000000..c4443fd7c9 --- /dev/null +++ b/Lang/Yabasic/Benfords-law @@ -0,0 +1 @@ +../../Task/Benfords-law/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Boyer-Moore-string-search b/Lang/Yabasic/Boyer-Moore-string-search new file mode 120000 index 0000000000..b7c5418915 --- /dev/null +++ b/Lang/Yabasic/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Cantor-set b/Lang/Yabasic/Cantor-set new file mode 120000 index 0000000000..f05992b834 --- /dev/null +++ b/Lang/Yabasic/Cantor-set @@ -0,0 +1 @@ +../../Task/Cantor-set/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Casting-out-nines b/Lang/Yabasic/Casting-out-nines new file mode 120000 index 0000000000..ad68a7c4b0 --- /dev/null +++ b/Lang/Yabasic/Casting-out-nines @@ -0,0 +1 @@ +../../Task/Casting-out-nines/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Catalan-numbers-Pascals-triangle b/Lang/Yabasic/Catalan-numbers-Pascals-triangle new file mode 120000 index 0000000000..dd3d68a399 --- /dev/null +++ b/Lang/Yabasic/Catalan-numbers-Pascals-triangle @@ -0,0 +1 @@ +../../Task/Catalan-numbers-Pascals-triangle/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Determine-if-a-string-has-all-the-same-characters b/Lang/Yabasic/Determine-if-a-string-has-all-the-same-characters new file mode 120000 index 0000000000..c1da4813dd --- /dev/null +++ b/Lang/Yabasic/Determine-if-a-string-has-all-the-same-characters @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-has-all-the-same-characters/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Determine-sentence-type b/Lang/Yabasic/Determine-sentence-type new file mode 120000 index 0000000000..54129c23c0 --- /dev/null +++ b/Lang/Yabasic/Determine-sentence-type @@ -0,0 +1 @@ +../../Task/Determine-sentence-type/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Display-a-linear-combination b/Lang/Yabasic/Display-a-linear-combination new file mode 120000 index 0000000000..3089327b6e --- /dev/null +++ b/Lang/Yabasic/Display-a-linear-combination @@ -0,0 +1 @@ +../../Task/Display-a-linear-combination/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Diversity-prediction-theorem b/Lang/Yabasic/Diversity-prediction-theorem new file mode 120000 index 0000000000..5dec4248b2 --- /dev/null +++ b/Lang/Yabasic/Diversity-prediction-theorem @@ -0,0 +1 @@ +../../Task/Diversity-prediction-theorem/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Empty-program b/Lang/Yabasic/Empty-program deleted file mode 120000 index 86460983fb..0000000000 --- a/Lang/Yabasic/Empty-program +++ /dev/null @@ -1 +0,0 @@ -../../Task/Empty-program/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Equal-prime-and-composite-sums b/Lang/Yabasic/Equal-prime-and-composite-sums new file mode 120000 index 0000000000..5f96757056 --- /dev/null +++ b/Lang/Yabasic/Equal-prime-and-composite-sums @@ -0,0 +1 @@ +../../Task/Equal-prime-and-composite-sums/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Euler-method b/Lang/Yabasic/Euler-method new file mode 120000 index 0000000000..0d4bb47acc --- /dev/null +++ b/Lang/Yabasic/Euler-method @@ -0,0 +1 @@ +../../Task/Euler-method/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Evaluate-binomial-coefficients b/Lang/Yabasic/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..2d010b1897 --- /dev/null +++ b/Lang/Yabasic/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Goldbachs-comet b/Lang/Yabasic/Goldbachs-comet new file mode 120000 index 0000000000..8391b64a6e --- /dev/null +++ b/Lang/Yabasic/Goldbachs-comet @@ -0,0 +1 @@ +../../Task/Goldbachs-comet/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Hash-from-two-arrays b/Lang/Yabasic/Hash-from-two-arrays new file mode 120000 index 0000000000..5956a47e87 --- /dev/null +++ b/Lang/Yabasic/Hash-from-two-arrays @@ -0,0 +1 @@ +../../Task/Hash-from-two-arrays/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Kronecker-product b/Lang/Yabasic/Kronecker-product new file mode 120000 index 0000000000..64e2f55421 --- /dev/null +++ b/Lang/Yabasic/Kronecker-product @@ -0,0 +1 @@ +../../Task/Kronecker-product/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Meissel-Mertens-constant b/Lang/Yabasic/Meissel-Mertens-constant deleted file mode 120000 index 2300a0e96d..0000000000 --- a/Lang/Yabasic/Meissel-Mertens-constant +++ /dev/null @@ -1 +0,0 @@ -../../Task/Meissel-Mertens-constant/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Modular-inverse b/Lang/Yabasic/Modular-inverse new file mode 120000 index 0000000000..996963babe --- /dev/null +++ b/Lang/Yabasic/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Multiple-regression b/Lang/Yabasic/Multiple-regression new file mode 120000 index 0000000000..047c89f1aa --- /dev/null +++ b/Lang/Yabasic/Multiple-regression @@ -0,0 +1 @@ +../../Task/Multiple-regression/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Nested-templated-data b/Lang/Yabasic/Nested-templated-data new file mode 120000 index 0000000000..026a122d79 --- /dev/null +++ b/Lang/Yabasic/Nested-templated-data @@ -0,0 +1 @@ +../../Task/Nested-templated-data/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Padovan-n-step-number-sequences b/Lang/Yabasic/Padovan-n-step-number-sequences new file mode 120000 index 0000000000..d7ef32db4b --- /dev/null +++ b/Lang/Yabasic/Padovan-n-step-number-sequences @@ -0,0 +1 @@ +../../Task/Padovan-n-step-number-sequences/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Pascals-triangle b/Lang/Yabasic/Pascals-triangle new file mode 120000 index 0000000000..9cb7c7cced --- /dev/null +++ b/Lang/Yabasic/Pascals-triangle @@ -0,0 +1 @@ +../../Task/Pascals-triangle/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Pig-the-dice-game b/Lang/Yabasic/Pig-the-dice-game new file mode 120000 index 0000000000..4793da4b13 --- /dev/null +++ b/Lang/Yabasic/Pig-the-dice-game @@ -0,0 +1 @@ +../../Task/Pig-the-dice-game/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Semordnilap b/Lang/Yabasic/Semordnilap new file mode 120000 index 0000000000..b07f006e9c --- /dev/null +++ b/Lang/Yabasic/Semordnilap @@ -0,0 +1 @@ +../../Task/Semordnilap/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors b/Lang/Yabasic/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors new file mode 120000 index 0000000000..c31a43a3b8 --- /dev/null +++ b/Lang/Yabasic/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-greater-than-previous-term-with-exactly-n-divisors/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Sequence:-smallest-number-with-exactly-n-divisors b/Lang/Yabasic/Sequence:-smallest-number-with-exactly-n-divisors new file mode 120000 index 0000000000..21289ba764 --- /dev/null +++ b/Lang/Yabasic/Sequence:-smallest-number-with-exactly-n-divisors @@ -0,0 +1 @@ +../../Task/Sequence:-smallest-number-with-exactly-n-divisors/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Set-consolidation b/Lang/Yabasic/Set-consolidation new file mode 120000 index 0000000000..d4735a97c5 --- /dev/null +++ b/Lang/Yabasic/Set-consolidation @@ -0,0 +1 @@ +../../Task/Set-consolidation/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Sexy-primes b/Lang/Yabasic/Sexy-primes new file mode 120000 index 0000000000..a3fa026246 --- /dev/null +++ b/Lang/Yabasic/Sexy-primes @@ -0,0 +1 @@ +../../Task/Sexy-primes/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Shell-one-liner b/Lang/Yabasic/Shell-one-liner new file mode 120000 index 0000000000..04ae90ab0a --- /dev/null +++ b/Lang/Yabasic/Shell-one-liner @@ -0,0 +1 @@ +../../Task/Shell-one-liner/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Sorting-algorithms-Counting-sort b/Lang/Yabasic/Sorting-algorithms-Counting-sort new file mode 120000 index 0000000000..c5fee45d6b --- /dev/null +++ b/Lang/Yabasic/Sorting-algorithms-Counting-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Counting-sort/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Sorting-algorithms-Gnome-sort b/Lang/Yabasic/Sorting-algorithms-Gnome-sort new file mode 120000 index 0000000000..0f81572e0a --- /dev/null +++ b/Lang/Yabasic/Sorting-algorithms-Gnome-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Gnome-sort/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Sorting-algorithms-Stooge-sort b/Lang/Yabasic/Sorting-algorithms-Stooge-sort new file mode 120000 index 0000000000..920cab2b30 --- /dev/null +++ b/Lang/Yabasic/Sorting-algorithms-Stooge-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Stooge-sort/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Soundex b/Lang/Yabasic/Soundex new file mode 120000 index 0000000000..154bd39b85 --- /dev/null +++ b/Lang/Yabasic/Soundex @@ -0,0 +1 @@ +../../Task/Soundex/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Sphenic-numbers b/Lang/Yabasic/Sphenic-numbers new file mode 120000 index 0000000000..ea34dc4862 --- /dev/null +++ b/Lang/Yabasic/Sphenic-numbers @@ -0,0 +1 @@ +../../Task/Sphenic-numbers/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Statistics-Normal-distribution b/Lang/Yabasic/Statistics-Normal-distribution new file mode 120000 index 0000000000..f9d32e077f --- /dev/null +++ b/Lang/Yabasic/Statistics-Normal-distribution @@ -0,0 +1 @@ +../../Task/Statistics-Normal-distribution/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Subleq b/Lang/Yabasic/Subleq new file mode 120000 index 0000000000..c9afe7bf12 --- /dev/null +++ b/Lang/Yabasic/Subleq @@ -0,0 +1 @@ +../../Task/Subleq/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/The-Name-Game b/Lang/Yabasic/The-Name-Game new file mode 120000 index 0000000000..97bfdf9347 --- /dev/null +++ b/Lang/Yabasic/The-Name-Game @@ -0,0 +1 @@ +../../Task/The-Name-Game/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Tree-datastructures b/Lang/Yabasic/Tree-datastructures new file mode 120000 index 0000000000..da4a839e0d --- /dev/null +++ b/Lang/Yabasic/Tree-datastructures @@ -0,0 +1 @@ +../../Task/Tree-datastructures/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Twos-complement b/Lang/Yabasic/Twos-complement new file mode 120000 index 0000000000..3889fdcaf6 --- /dev/null +++ b/Lang/Yabasic/Twos-complement @@ -0,0 +1 @@ +../../Task/Twos-complement/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Van-Eck-sequence b/Lang/Yabasic/Van-Eck-sequence new file mode 120000 index 0000000000..35b84733d2 --- /dev/null +++ b/Lang/Yabasic/Van-Eck-sequence @@ -0,0 +1 @@ +../../Task/Van-Eck-sequence/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Web-scraping b/Lang/Yabasic/Web-scraping new file mode 120000 index 0000000000..2a4cb5ee13 --- /dev/null +++ b/Lang/Yabasic/Web-scraping @@ -0,0 +1 @@ +../../Task/Web-scraping/Yabasic \ No newline at end of file diff --git a/Lang/Yabasic/Window-creation-X11 b/Lang/Yabasic/Window-creation-X11 new file mode 120000 index 0000000000..4d53abb936 --- /dev/null +++ b/Lang/Yabasic/Window-creation-X11 @@ -0,0 +1 @@ +../../Task/Window-creation-X11/Yabasic \ No newline at end of file diff --git a/Lang/ZED/00-LANG.txt b/Lang/ZED/00-LANG.txt index b0cb425a84..5b0358bc17 100644 --- a/Lang/ZED/00-LANG.txt +++ b/Lang/ZED/00-LANG.txt @@ -12,8 +12,9 @@ Development of ZEDc is also happening on GitHub: https://github.com/zelah/ZEDc ZED can be seen compiling itself here: http://ideone.com/ARpMCM +(begin (define (ZED* ZEDnumber1 ZEDnumber2) (cond (#t (* ZEDnumber1 ZEDnumber2)) (else err))) (define (ZED+ ZEDnumber1 ZEDnumber2) (cond (#t (+ ZEDnumber1 ZEDnumber2)) (else err))) (define (ZED- ZEDnumber1 ZEDnumber2) (cond (#t (- ZEDnumber1 ZEDnumber2)) (else err))) (define (ZED/ ZEDnumber1 ZEDnumber2) (cond (#t (/ ZEDnumber1 ZEDnumber2)) (else err))) (define (ZED= value1 value2) (cond (#t (eqv? value1 value2)) (else err))) (define (ZEDadd-between! item list collect) (cond ((null? list) collect) ((null? (cdr list)) (cons (car list) collect)) (#t (ZEDadd-between! item (cdr list) (cons item (cons (car list) collect)))) (else err))) (define (ZEDadd-between item list) (cond (#t (reverse (ZEDadd-between! item list (quote ())))) (else err))) (define (ZEDadd-between-ra list item) (cond (#t (reverse (ZEDadd-between! item list (quote ())))) (else err))) (define (ZEDalpha) (cond (#t (ZEDwrite-all (ZEDrd (quote ()) append (ZEDrd (quote ()) append (ZEDnewlines (ZEDby-four (ZEDfunction-sort (ZEDsentences (ZEDleading-newline (ZEDspace-newline (ZEDtab-replace (ZEDnewline-space-tab-repeats (ZEDnewline-space (ZEDfilter ZEDnot-return? (ZEDreplace-trailing-white-space (ZEDread-all)))))))))))))))) (else err))) (define (ZEDapplication? expression) (cond (#t (and (not (null? expression)) (pair? (car expression)) (null? (cdar expression)))) (else err))) (define (ZEDarity arity-hash function) (cond (#t (cdr (assoc function arity-hash))) (else err))) (define (ZEDarity-hash! clause) (cond (#t (cons (ZEDclause-name clause) (ZEDclause-arity clause))) (else err))) (define (ZEDarity-hash program) (cond (#t (append (map ZEDarity-hash! program) (append (list (cons (quote ZED1) 1) (cons (quote ZED!) 1) (cons (quote ZED001) 1) (cons (quote or) 2) (cons (quote and) 2) (cons (quote begin) 2) (cons (quote ZEDc) 2) (cons (quote quote) 1)) (list (cons (quote ZED002) 2) (cons (quote ZED003) 3) (cons (quote ZED004) 4) (cons (quote ZED005) 5) (cons (quote ZED006) 6) (cons (quote ZED007) 7) (cons (quote ZED008) 8) (cons (quote ZED009) 9) (cons (quote ZED010) 10) (cons (quote ZED011) 11) (cons (quote ZED012) 12) (cons (quote ZED013) 13) (cons (quote ZED014) 14) (cons (quote ZED015) 15) (cons (quote ZED016) 16) (cons (quote ZED017) 17) (cons (quote ZED018) 18) (cons (quote ZED019) 19) (cons (quote ZED020) 20) (cons (quote ZED021) 21) (cons (quote ZED022) 22) (cons (quote ZED023) 23) (cons (quote ZED024) 24) (cons (quote ZED025) 25) (cons (quote ZED026) 26) (cons (quote ZED027) 27) (cons (quote ZED028) 28) (cons (quote ZED029) 29) (cons (quote ZED030) 30) (cons (quote ZED031) 31) (cons (quote ZED032) 32) (cons (quote ZED033) 33) (cons (quote ZED034) 34) (cons (quote ZED035) 35) (cons (quote ZED036) 36) (cons (quote ZED037) 37) (cons (quote ZED038) 38) (cons (quote ZED039) 39) (cons (quote ZED040) 40) (cons (quote ZED041) 41) (cons (quote ZED042) 42) (cons (quote ZED043) 43) (cons (quote ZED044) 44) (cons (quote ZED045) 45) (cons (quote ZED046) 46) (cons (quote ZED047) 47) (cons (quote ZED048) 48) (cons (quote ZED049) 49) (cons (quote ZED050) 50) (cons (quote ZED051) 51) (cons (quote ZED052) 52) (cons (quote ZED053) 53) (cons (quote ZED054) 54) (cons (quote ZED055) 55) (cons (quote ZED056) 56) (cons (quote ZED057) 57) (cons (quote ZED058) 58) (cons (quote ZED059) 59) (cons (quote ZED060) 60) (cons (quote ZED061) 61) (cons (quote ZED062) 62) (cons (quote ZED063) 63) (cons (quote ZED064) 64) (cons (quote ZED065) 65) (cons (quote ZED066) 66) (cons (quote ZED067) 67) (cons (quote ZED068) 68) (cons (quote ZED069) 69) (cons (quote ZED070) 70) (cons (quote ZED071) 71) (cons (quote ZED072) 72) (cons (quote ZED073) 73) (cons (quote ZED074) 74) (cons (quote ZED075) 75) (cons (quote ZED076) 76) (cons (quote ZED077) 77) (cons (quote ZED078) 78) (cons (quote ZED079) 79) (cons (quote ZED080) 80) (cons (quote ZED081) 81) (cons (quote ZED082) 82) (cons (quote ZED083) 83) (cons (quote ZED084) 84) (cons (quote ZED085) 85) (cons (quote ZED086) 86) (cons (quote ZED087) 87) (cons (quote ZED088) 88) (cons (quote ZED089) 89) (cons (quote ZED090) 90) (cons (quote ZED091) 91) (cons (quote ZED092) 92) (cons (quote ZED093) 93) (cons (quote ZED094) 94) (cons (quote ZED095) 95) (cons (quote ZED096) 96) (cons (quote ZED097) 97) (cons (quote ZED098) 98) (cons (quote ZED099) 99))))) (else err))) (define (ZEDby-four! sentences collect) (cond ((null? sentences) collect) (#t (ZEDby-four! (cddddr sentences) (cons (list (car sentences) (cadr sentences) (caddr sentences) (cadddr sentences)) collect))) (else err))) (define (ZEDby-four sentences) (cond (#t (reverse (ZEDby-four! sentences (quote ())))) (else err))) (define (ZEDby-three! sentences collect) (cond ((null? sentences) collect) (#t (ZEDby-three! (cdddr sentences) (cons (list (car sentences) (cadr sentences) (caddr sentences)) collect))) (else err))) (define (ZEDby-three sentences) (cond (#t (reverse (ZEDby-three! sentences (quote ())))) (else err))) (define (ZEDcharacter-less? character1 character2) (cond (#t (< (char->integer character1) (char->integer character2))) (else err))) (define (ZEDclause-arguments clause) (cond (#t (cadr clause)) (else err))) (define (ZEDclause-arguments-agree clause1 clause2) (cond ((equal? (ZEDclause-arguments clause1) (ZEDclause-arguments clause2)) (ZEDclause-arguments clause1)) (else err))) (define (ZEDclause-arity clause) (cond (#t (length (ZEDclause-arguments clause))) (else err))) (define (ZEDclause-body clause) (cond (#t (cddr clause)) (else err))) (define (ZEDclause-less? clause1 clause2) (cond (#t (ZEDsentence-less? (car clause1) (car clause2))) (else err))) (define (ZEDclause-name clause) (cond (#t (car clause)) (else err))) (define (ZEDclause-name-agree clause1 clause2) (cond ((eq? (ZEDclause-name clause1) (ZEDclause-name clause2)) (ZEDclause-name clause1)) (else err))) (define (ZEDcombine-all! program collect) (cond ((null? program) collect) ((null? (cdr program)) (cons (car program) collect)) ((eq? (ZEDclause-name (car program)) (ZEDclause-name (cadr program))) (ZEDcombine-all! (ZEDcombine-head-clauses program) collect)) (#t (ZEDcombine-all! (cdr program) (cons (car program) collect))) (else err))) (define (ZEDcombine-all program) (cond (#t (reverse (ZEDcombine-all! program (quote ())))) (else err))) (define (ZEDcombine-clauses clause1 clause2) (cond (#t (cons (ZEDclause-name-agree clause1 clause2) (cons (ZEDclause-arguments-agree clause1 clause2) (append (ZEDclause-body clause1) (ZEDclause-body clause2))))) (else err))) (define (ZEDcombine-head-clauses program) (cond (#t (cons (ZEDcombine-clauses (car program) (cadr program)) (cddr program))) (else err))) (define (ZEDcombine-program-clauses program) (cond (#t (ZEDcombine-all (ZEDready-program program))) (else err))) (define (ZEDcomp!) (cond (#t (ZEDcomp!a (ZEDcombine-program-clauses (ZEDby-three (ZEDread-sentences (ZEDdiscard-comments (ZEDfunction-sort (ZEDsentences (ZEDleading-newline (ZEDspace-newline (ZEDtab-replace (ZEDnewline-space-tab-repeats (ZEDnewline-space (ZEDfilter ZEDnot-return? (ZEDreplace-trailing-white-space (ZEDread-all)))))))))))))))) (else err))) (define (ZEDcomp!a combined) (cond (#t (ZEDcomp!aa (ZEDprogramize combined (ZEDarity-hash combined)))) (else err))) (define (ZEDcomp!aa programized) (cond (#t (write programized)) (else err))) (define (ZEDcomp) (cond (#t (ZEDcomp!)) (else err))) (define (ZEDcondefy! expressions collect) (cond ((null? expressions) collect) (#t (ZEDcondefy! (cddr expressions) (cons (append (car expressions) (cadr expressions)) collect))) (else err))) (define (ZEDcondefy expressions) (cond (#t (reverse (ZEDcondefy! expressions (quote ())))) (else err))) (define (ZEDcons ZEDvalue1 ZEDvalue2) (cond (#t (cons ZEDvalue1 ZEDvalue2)) (else err))) (define (ZEDcount ZEDnumber) (cond (#t (cons (delay ZEDnumber) (delay (ZEDcount (ZED+ ZEDnumber 1))))) (else err))) (define (ZEDcount-by ZEDstep ZEDnumber) (cond (#t (cons (delay ZEDnumber) (delay (ZEDcount-by ZEDstep (ZED+ ZEDnumber ZEDstep))))) (else err))) (define (ZEDdelay-wrap expression) (cond (#t (list (quote delay) expression)) (else err))) (define (ZEDdigit? character) (cond (#t (or (eqv? #\0 character) (eqv? #\1 character) (eqv? #\2 character) (eqv? #\3 character) (eqv? #\4 character) (eqv? #\5 character) (eqv? #\6 character) (eqv? #\7 character) (eqv? #\8 character) (eqv? #\9 character))) (else err))) (define (ZEDdiscard-comments! program collect) (cond ((null? program) collect) (#t (ZEDdiscard-comments! (cddddr program) (cons (cadddr program) (cons (caddr program) (cons (car program) collect))))) (else err))) (define (ZEDdiscard-comments program) (cond (#t (reverse (ZEDdiscard-comments! program (quote ())))) (else err))) (define (ZEDdr! value) (cond ((pair? value) (ZEDmp ZEDdr! (ZEDfirst 64 value))) (#t value) (else err))) (define (ZEDdr value) (cond (#t (begin (display (ZEDpr (ZEDdr! value))) (newline) (newline) value)) (else err))) (define (ZEDdrr value) (cond (#t (begin (display (ZEDpr value)) (newline) (newline) value)) (else err))) (define (ZEDfalse? noun-list) (cond (#t (equal? noun-list (list ## #\f #\a #\l #\s #\e))) (else err))) (define (ZEDfi function list) (cond ((null? list) (quote ())) ((function (if (promise? (car list)) (force (car list)) (car list))) (cons (delay (if (promise? (car list)) (force (car list)) (car list))) (delay (ZEDfi function (if (promise? (cdr list)) (force (cdr list)) (cdr list)))))) (#t (ZEDfi function (if (promise? (cdr list)) (force (cdr list)) (cdr list)))) (else err))) (define (ZEDfilter! predicate list collect) (cond ((null? list) collect) ((predicate (car list)) (ZEDfilter! predicate (cdr list) (cons (car list) collect))) (#t (ZEDfilter! predicate (cdr list) collect)) (else err))) (define (ZEDfilter predicate list) (cond (#t (reverse (ZEDfilter! predicate list (quote ())))) (else err))) (define (ZEDfirst! integer list collect) (cond ((or (zero? integer) (null? list)) (reverse collect)) ((not (pair? list)) (reverse (cons list collect))) ((> integer 0) (ZEDfirst! (- integer 1) (if (promise? (cdr list)) (force (cdr list)) (cdr list)) (cons (if (promise? (car list)) (force (car list)) (car list)) collect))) (else err))) (define (ZEDfirst integer list) (cond ((not (pair? list)) list) (#t (ZEDfirst! integer list (quote ()))) (else err))) (define (ZEDflatten! ZEDlist ZEDsub-list-found? ZEDcollect) (cond ((and (ZEDnull? ZEDlist) (ZEDnot ZEDsub-list-found?)) (ZEDreverse ZEDcollect)) ((ZEDnull? ZEDlist) (ZEDflatten! (ZEDreverse ZEDcollect) #f (quote ()))) ((ZEDnot (ZEDpair? ZEDlist)) (ZEDflatten! (quote ()) ZEDsub-list-found? (ZEDcons ZEDlist ZEDcollect))) ((ZEDpair? (if (promise? (car ZEDlist)) (force (car ZEDlist)) (car ZEDlist))) (ZEDflatten! (if (promise? (cdr ZEDlist)) (force (cdr ZEDlist)) (cdr ZEDlist)) #t (ZEDcons (if (promise? (cdr (if (promise? (car ZEDlist)) (force (car ZEDlist)) (car ZEDlist)))) (force (cdr (if (promise? (car ZEDlist)) (force (car ZEDlist)) (car ZEDlist)))) (cdr (if (promise? (car ZEDlist)) (force (car ZEDlist)) (car ZEDlist)))) (ZEDcons (if (promise? (car (if (promise? (car ZEDlist)) (force (car ZEDlist)) (car ZEDlist)))) (force (car (if (promise? (car ZEDlist)) (force (car ZEDlist)) (car ZEDlist)))) (car (if (promise? (car ZEDlist)) (force (car ZEDlist)) (car ZEDlist)))) ZEDcollect)))) ((ZEDnull? (if (promise? (car ZEDlist)) (force (car ZEDlist)) (car ZEDlist))) (ZEDflatten! (if (promise? (cdr ZEDlist)) (force (cdr ZEDlist)) (cdr ZEDlist)) ZEDsub-list-found? ZEDcollect)) (#t (ZEDflatten! (if (promise? (cdr ZEDlist)) (force (cdr ZEDlist)) (cdr ZEDlist)) ZEDsub-list-found? (ZEDcons (if (promise? (car ZEDlist)) (force (car ZEDlist)) (car ZEDlist)) ZEDcollect))) (else err))) (define (ZEDflatten ZEDlist) (cond (#t (ZEDflatten! ZEDlist #f (quote ()))) (else err))) (define (ZEDfor-each ZEDeffect ZEDlist) (cond (#t (for-each ZEDeffect ZEDlist)) (else err))) (define (ZEDfunction expression) (cond (#t (caar expression)) (else err))) (define (ZEDfunction-sort sentences) (cond (#t (ZEDrd (quote ()) append (ZEDsort ZEDclause-less? (ZEDby-four sentences)))) (else err))) (define (ZEDfunctionize clause arity-hash) (cond (#t (list (quote define) (cons (ZEDclause-name clause) (ZEDclause-arguments clause)) (cons (quote cond) (append (ZEDcondefy (ZEDmap-with ZEDschemefy (ZEDclause-body clause) arity-hash)) (list (list (quote else) (quote err))))))) (else err))) (define (ZEDgather-count?! candidate) (cond (#t (and (= 6 (length candidate)) (eqv? #\Z (car candidate)) (eqv? #\E (cadr candidate)) (eqv? #\D (caddr candidate)) (eqv? #\0 (cadddr candidate)) (ZEDdigit? (car (cddddr candidate))) (ZEDdigit? (cadr (cddddr candidate))))) (else err))) (define (ZEDgather-count? symbol) (cond (#t (ZEDgather-count?! (string->list (symbol->string symbol)))) (else err))) (define (ZEDgather-noun sentence) (cond ((null? sentence) (quote ())) ((eqv? #\space (car sentence)) (quote ())) (#t (cons (car sentence) (ZEDgather-noun (cdr sentence)))) (else err))) (define (ZEDgather-verb sentence) (cond ((eqv? #) (car sentence)) (quote ())) (#t (cons (car sentence) (ZEDgather-verb (cdr sentence)))) (else err))) (define (ZEDgr garbage value) (cond (#t (begin (ZEDdr garbage) value)) (else err))) (define (ZEDgrr garbage value) (cond (#t (begin (ZEDdrr garbage) value)) (else err))) (define (ZEDleading-newline program) (cond ((null? program) (quote ())) ((eqv? #\newline (car program)) (cdr program)) (#t program) (else err))) (define (ZEDliteral? literal-list) (cond (#t (eqv? #" (car literal-list))) (else err))) (define (ZEDmake-ZED ZED-list) (cond ((equal? ZED-list (list #\e #\r #\r)) "'err") ((equal? ZED-list (list #\n #\i #\l)) "'()") ((equal? ZED-list (list #\a #\n #\d)) "and") ((equal? ZED-list (list #\o #\r)) "or") ((equal? ZED-list (list #\q #\u #\o #\t #\e)) "quote") ((equal? ZED-list (list #\s #\e)) "begin") (#t (list->string (append (list #\Z #\E #\D) ZED-list))) (else err))) (define (ZEDmake-character noun-list) (cond (#t (list->string (cons ## (cons # +(cdr noun-list))))) (else err))) (define (ZEDmake-exact exact-list) (cond (#t (list->string (append (list ## #\e) exact-list))) (else err))) (define (ZEDmake-literal literal-list) (cond (#t (list->string (cdr (reverse (cdr (reverse literal-list)))))) (else err))) (define (ZEDmake-number-character noun-list) (cond (#t (list->string (list ## # +(integer->char (string->number (list->string (cddr noun-list))))))) (else err))) (define (ZEDmap-with! function list extra collect) (cond ((null? list) collect) (#t (ZEDmap-with! function (cdr list) extra (cons (function (car list) extra) collect))) (else err))) (define (ZEDmap-with function list extra) (cond (#t (reverse (ZEDmap-with! function list extra (quote ())))) (else err))) (define (ZEDmerge! comparator list1 list2 collect) (cond ((null? list2) (append (reverse collect) list1)) ((null? list1) (append (reverse collect) list2)) ((comparator (car list2) (car list1)) (ZEDmerge! comparator list1 (cdr list2) (cons (car list2) collect))) (#t (ZEDmerge! comparator (cdr list1) list2 (cons (car list1) collect))) (else err))) (define (ZEDmerge comparator list1 list2) (cond (#t (ZEDmerge! comparator list1 list2 (quote ()))) (else err))) (define (ZEDmp function list) (cond ((null? list) (quote ())) ((pair? list) (cons (delay (function (if (promise? (car list)) (force (car list)) (car list)))) (delay (ZEDmp function (if (promise? (cdr list)) (force (cdr list)) (cdr list)))))) (#t (function list)) (else err))) (define (ZEDnewline-space! program) (cond (#t (cons #\newline (ZEDnewline-space!a program))) (else err))) (define (ZEDnewline-space!a program) (cond (#t (ZEDnewline-space!aa program (reverse (ZEDnewline-space!ab program (quote ()))))) (else err))) (define (ZEDnewline-space!aa program transformed) (cond ((equal? program transformed) program) (#t (ZEDnewline-space!a transformed)) (else err))) (define (ZEDnewline-space!ab program collect) (cond ((null? program) collect) ((null? (cdr program)) (cons (car program) collect)) ((and (eqv? #\newline (car program)) (or (eqv? #\space (cadr program)) (eqv? #\ht (cadr program)))) (ZEDnewline-space!ab (cdr program) collect)) (#t (ZEDnewline-space!ab (cdr program) (cons (car program) collect))) (else err))) (define (ZEDnewline-space program) (cond (#t (ZEDnewline-space! program)) (else err))) (define (ZEDnewline-space-tab-repeats! program collect) (cond ((or (null? program) (null? (cdr program))) (append program collect)) ((and (eqv? #\newline (car program)) (eqv? #\newline (cadr program))) (ZEDnewline-space-tab-repeats! (cdr program) collect)) ((and (or (eqv? #\space (car program)) (eqv? #\ht (car program))) (or (eqv? #\space (cadr program)) (eqv? #\ht (cadr program)))) (ZEDnewline-space-tab-repeats! (cdr program) collect)) (#t (ZEDnewline-space-tab-repeats! (cdr program) (cons (car program) collect))) (else err))) (define (ZEDnewline-space-tab-repeats program) (cond (#t (reverse (ZEDnewline-space-tab-repeats! program (quote ())))) (else err))) (define (ZEDnewlines clauses) (cond (#t (ZEDadd-between-ra (ZEDmap-with ZEDadd-between-ra clauses (list #\newline)) (list (list #\newline #\newline)))) (else err))) (define (ZEDnormal-character? noun-list) (cond (#t (eqv? (car noun-list) ##)) (else err))) (define (ZEDnot ZEDvalue) (cond (#t (not ZEDvalue)) (else err))) (define (ZEDnot-return? character) (cond (#t (not (eqv? #\cr character))) (else err))) (define (ZEDnoun! noun-list number?) (cond (number? (ZEDmake-exact noun-list)) ((ZEDliteral? noun-list) (ZEDmake-literal noun-list)) ((ZEDtrue? noun-list) "#t") ((ZEDfalse? noun-list) "#f") ((ZEDnumber-character? noun-list) (ZEDmake-number-character noun-list)) ((ZEDnormal-character? noun-list) (ZEDmake-character noun-list)) (#t (ZEDmake-ZED noun-list)) (else err))) (define (ZEDnoun noun-list) (cond (#t (ZEDnoun! noun-list (string->number (list->string noun-list)))) (else err))) (define (ZEDnull? ZEDvalue) (cond (#t (null? ZEDvalue)) (else err))) (define (ZEDnumber-character? noun-list) (cond (#t (and (eqv? (car noun-list) ##) (eqv? (cadr noun-list) #\0) (not (null? (cddr noun-list))))) (else err))) (define (ZEDpair? ZEDvalue) (cond (#t (pair? ZEDvalue)) (else err))) (define (ZEDpop stack) (cond (#t (cdr stack)) (else err))) (define (ZEDpr! value output-string) (cond (#t (begin (display (ZEDpr!a value (quote ())) output-string) (ZEDpr!b output-string (get-output-string output-string)))) (else err))) (define (ZEDpr!a value collect) (cond ((char? value) (ZEDpr!aa (list->string (list ## value)) collect)) ((string? value) (ZEDpr!aa (string-append """ value """) collect)) ((symbol? value) (ZEDpr!aa (symbol->string value) collect)) ((number? value) (ZEDpr!aa (number->string value) collect)) ((and (boolean? value) value) (ZEDpr!aa "#true" collect)) ((boolean? value) (ZEDpr!aa "#false" collect)) ((null? value) (reverse collect)) (#t (ZEDpr!a (if (promise? (cdr value)) (force (cdr value)) (cdr value)) (cons (ZEDpr!a (if (promise? (car value)) (force (car value)) (car value)) (quote ())) collect))) (else err))) (define (ZEDpr!aa string collect) (cond ((null? collect) string) (#t (reverse (cons string (cons "." collect)))) (else err))) (define (ZEDpr!b output-string value) (cond (#t (begin (close-output-port output-string) value)) (else err))) (define (ZEDpr value) (cond (#t (ZEDpr! value (open-output-string))) (else err))) (define (ZEDprogramize program arity-hash) (cond (#t (cons (quote begin) (ZEDmap-with ZEDfunctionize program arity-hash))) (else err))) (define (ZEDpush object stack) (cond (#t (cons object stack)) (else err))) (define (ZEDrd! function list) (cond ((null? (if (promise? (cdr list)) (force (cdr list)) (cdr list))) (if (promise? (car list)) (force (car list)) (car list))) (#t (ZEDrd! function (cons (function (if (promise? (car (if (promise? (cdr list)) (force (cdr list)) (cdr list)))) (force (car (if (promise? (cdr list)) (force (cdr list)) (cdr list)))) (car (if (promise? (cdr list)) (force (cdr list)) (cdr list)))) (if (promise? (car list)) (force (car list)) (car list))) (if (promise? (cdr (if (promise? (cdr list)) (force (cdr list)) (cdr list)))) (force (cdr (if (promise? (cdr list)) (force (cdr list)) (cdr list)))) (cdr (if (promise? (cdr list)) (force (cdr list)) (cdr list))))))) (else err))) (define (ZEDrd final function list) (cond (#t (ZEDrd! function (cons final (reverse list)))) (else err))) (define (ZEDread-all! collect) (cond (#t (ZEDread-all!a (read-char) collect)) (else err))) (define (ZEDread-all!a character collect) (cond ((eof-object? character) collect) (#t (ZEDread-all! (cons character collect))) (else err))) (define (ZEDread-all) (cond (#t (reverse (ZEDread-all! (quote ())))) (else err))) (define (ZEDread-sentence!a sentence collect) (cond ((null? sentence) collect) ((eqv? #\space (car sentence)) (ZEDread-sentence!a (cdr sentence) collect)) ((eqv? #( (car sentence)) (ZEDread-sentence!aa sentence (ZEDgather-verb (cdr sentence)) collect)) (#t (ZEDread-sentence!ab sentence (ZEDgather-noun sentence) collect)) (else err))) (define (ZEDread-sentence!aa sentence gather-verb collect) (cond (#t (ZEDread-sentence!a (ZEDtails (+ 2 (length gather-verb)) sentence) (cons (ZEDverb gather-verb) collect))) (else err))) (define (ZEDread-sentence!ab sentence gather-noun collect) (cond (#t (ZEDread-sentence!a (ZEDtails (length gather-noun) sentence) (cons (ZEDnoun gather-noun) collect))) (else err))) (define (ZEDread-sentence!b list output-string) (cond (#t (begin (display list output-string) (ZEDread-sentence!ba output-string (get-output-string output-string)))) (else err))) (define (ZEDread-sentence!ba output-string get-output-string) (cond (#t (begin (close-output-port output-string) (ZEDread-sentence!baa (open-input-string get-output-string)))) (else err))) (define (ZEDread-sentence!baa input-string) (cond (#t (ZEDread-sentence!baaa input-string (read input-string))) (else err))) (define (ZEDread-sentence!baaa input-string answer) (cond (#t (begin (close-input-port input-string) answer)) (else err))) (define (ZEDread-sentence sentence) (cond (#t (ZEDread-sentence!b (reverse (ZEDread-sentence!a sentence (quote ()))) (open-output-string))) (else err))) (define (ZEDread-sentences sentences) (cond (#t (map ZEDread-sentence sentences)) (else err))) (define (ZEDready-clause clause) (cond (#t (cons (caaar clause) (cons (cdar clause) (cdr clause)))) (else err))) (define (ZEDready-program program) (cond (#t (map ZEDready-clause program)) (else err))) (define (ZEDreplace-trailing-white-space! program) (cond ((null? program) (quote ())) ((or (eqv? (car program) #\space) (eqv? (car program) #\ht) (eqv? (car program) #\cr) (eqv? (car program) #\newline)) (ZEDreplace-trailing-white-space! (cdr program))) (#t (cons #\newline program)) (else err))) (define (ZEDreplace-trailing-white-space program) (cond (#t (reverse (ZEDreplace-trailing-white-space! (reverse program)))) (else err))) (define (ZEDreverse ZEDlist) (cond (#t (reverse ZEDlist)) (else err))) (define (ZEDschemefy! expression arity-hash stack) (cond ((null? expression) (ZEDtop stack)) ((ZEDapplication? expression) (ZEDschemefy!a expression arity-hash stack (ZEDfunction expression))) (#t (ZEDschemefy! (cdr expression) arity-hash (ZEDpush (car expression) stack))) (else err))) (define (ZEDschemefy!a expression arity-hash stack function) (cond (#t (ZEDschemefy!aa expression arity-hash stack function (ZEDarity arity-hash function))) (else err))) (define (ZEDschemefy!aa expression arity-hash stack function arity) (cond ((ZEDgather-count? function) (ZEDschemefy! (cdr expression) arity-hash (ZEDpush (ZEDfirst arity stack) (ZEDtails arity stack)))) ((eq? function (quote ZED1)) (ZEDschemefy! (cdr expression) arity-hash (ZEDpush (list (quote if) (list (quote promise?) (cons (quote car) (ZEDfirst arity stack))) (list (quote force) (cons (quote car) (ZEDfirst arity stack))) (cons (quote car) (ZEDfirst arity stack))) (ZEDtails arity stack)))) ((eq? function (quote ZED!)) (ZEDschemefy! (cdr expression) arity-hash (ZEDpush (list (quote if) (list (quote promise?) (cons (quote cdr) (ZEDfirst arity stack))) (list (quote force) (cons (quote cdr) (ZEDfirst arity stack))) (cons (quote cdr) (ZEDfirst arity stack))) (ZEDtails arity stack)))) ((eq? function (quote ZEDc)) (ZEDschemefy! (cdr expression) arity-hash (ZEDpush (cons (quote cons) (map ZEDdelay-wrap (ZEDfirst arity stack))) (ZEDtails arity stack)))) (#t (ZEDschemefy! (cdr expression) arity-hash (ZEDpush (cons function (ZEDfirst arity stack)) (ZEDtails arity stack)))) (else err))) (define (ZEDschemefy expression arity-hash) (cond (#t (list (ZEDschemefy! (reverse expression) arity-hash (ZEDstack)))) (else err))) (define (ZEDsentence-less? sentence1 sentence2) (cond ((null? sentence2) #f) ((null? sentence1) #t) ((ZEDcharacter-less? (car sentence1) (car sentence2)) #t) ((ZEDcharacter-less? (car sentence2) (car sentence1)) #f) (#t (ZEDsentence-less? (cdr sentence1) (cdr sentence2))) (else err))) (define (ZEDsentences! program collect1 collect2) (cond ((null? program) collect2) ((eqv? #\newline (car program)) (ZEDsentences! (cdr program) (quote ()) (cons (reverse collect1) collect2))) (#t (ZEDsentences! (cdr program) (cons (car program) collect1) collect2)) (else err))) (define (ZEDsentences program) (cond (#t (reverse (ZEDsentences! program (quote ()) (quote ())))) (else err))) (define (ZEDsort!a jumble) (cond (#t (map list jumble)) (else err))) (define (ZEDsort!b comparator jumble) (cond ((null? jumble) (quote ())) ((null? (cdr jumble)) jumble) (#t (ZEDsort!b comparator (cons (ZEDmerge comparator (car jumble) (cadr jumble)) (ZEDsort!b comparator (cddr jumble))))) (else err))) (define (ZEDsort comparator jumble) (cond (#t (car (ZEDsort!b comparator (ZEDsort!a jumble)))) (else err))) (define (ZEDspace-newline! program collect) (cond ((or (null? program) (null? (cdr program))) (append program collect)) ((and (eqv? #\space (car program)) (eqv? #\newline (cadr program))) (ZEDspace-newline! (cdr program) collect)) (#t (ZEDspace-newline! (cdr program) (cons (car program) collect))) (else err))) (define (ZEDspace-newline program) (cond (#t (reverse (ZEDspace-newline! program (quote ())))) (else err))) (define (ZEDstack) (cond (#t (quote ())) (else err))) (define (ZEDtab-replace! program collect) (cond ((null? program) collect) ((eqv? #\ht (car program)) (ZEDtab-replace! (cdr program) (cons #\space collect))) (#t (ZEDtab-replace! (cdr program) (cons (car program) collect))) (else err))) (define (ZEDtab-replace program) (cond (#t (reverse (ZEDtab-replace! program (quote ())))) (else err))) (define (ZEDtails number list) (cond ((null? list) (quote ())) ((zero? number) list) ((> number 0) (ZEDtails (- number 1) (cdr list))) (else err))) (define (ZEDtop stack) (cond (#t (car stack)) (else err))) (define (ZEDtrue? noun-list) (cond (#t (equal? noun-list (list ## #\t #\r #\u #\e))) (else err))) (define (ZEDverb verb-list) (cond ((ZEDliteral? verb-list) (list (ZEDmake-literal verb-list))) (#t (list (ZEDmake-ZED verb-list))) (else err))) (define (ZEDwrite-all program) (cond ((null? program) (quote err)) (#t (ZEDwrite-all (begin (write-char (car program)) (cdr program)))) (else err))) (define (ZEDzed->scheme! value collect) (cond ((null? value) (reverse collect)) (#t (ZEDzed->scheme! (if (promise? (cdr value)) (force (cdr value)) (cdr value)) (cons (ZEDzed->scheme (if (promise? (car value)) (force (car value)) (car value))) collect))) (else err))) (define (ZEDzed->scheme value) (cond ((not (pair? value)) value) (#t (ZEDzed->scheme! value (quote ()))) (else err)))) (ZEDcomp) Language author on RC: [[User:Zelah|Zelah]] ([[User_talk:Zelah|talk]] | [[Special:Contributions/Zelah|contribs]]) - -165x2 194x2 207x2 . \ No newline at end of file diff --git a/Lang/ZX-Spectrum-Basic/Sorting-Algorithms-Circle-Sort b/Lang/ZX-Spectrum-Basic/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index c34f35480d..0000000000 --- a/Lang/ZX-Spectrum-Basic/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/ZX-Spectrum-Basic \ No newline at end of file diff --git a/Lang/ZX-Spectrum-Basic/Zero-to-the-zero-power b/Lang/ZX-Spectrum-Basic/Zero-to-the-zero-power new file mode 120000 index 0000000000..8f0b2baaa1 --- /dev/null +++ b/Lang/ZX-Spectrum-Basic/Zero-to-the-zero-power @@ -0,0 +1 @@ +../../Task/Zero-to-the-zero-power/ZX-Spectrum-Basic \ No newline at end of file diff --git a/Lang/Zig/100-prisoners b/Lang/Zig/100-prisoners new file mode 120000 index 0000000000..fbe8ec3d31 --- /dev/null +++ b/Lang/Zig/100-prisoners @@ -0,0 +1 @@ +../../Task/100-prisoners/Zig \ No newline at end of file diff --git a/Lang/Zig/15-puzzle-game b/Lang/Zig/15-puzzle-game new file mode 120000 index 0000000000..67842297fa --- /dev/null +++ b/Lang/Zig/15-puzzle-game @@ -0,0 +1 @@ +../../Task/15-puzzle-game/Zig \ No newline at end of file diff --git a/Lang/Zig/15-puzzle-solver b/Lang/Zig/15-puzzle-solver new file mode 120000 index 0000000000..31e2e98f6a --- /dev/null +++ b/Lang/Zig/15-puzzle-solver @@ -0,0 +1 @@ +../../Task/15-puzzle-solver/Zig \ No newline at end of file diff --git a/Lang/Zig/2048 b/Lang/Zig/2048 new file mode 120000 index 0000000000..d2ac81be16 --- /dev/null +++ b/Lang/Zig/2048 @@ -0,0 +1 @@ +../../Task/2048/Zig \ No newline at end of file diff --git a/Lang/Zig/24-game b/Lang/Zig/24-game new file mode 120000 index 0000000000..7b40225753 --- /dev/null +++ b/Lang/Zig/24-game @@ -0,0 +1 @@ +../../Task/24-game/Zig \ No newline at end of file diff --git a/Lang/Zig/24-game-Solve b/Lang/Zig/24-game-Solve new file mode 120000 index 0000000000..cf80fe1aa1 --- /dev/null +++ b/Lang/Zig/24-game-Solve @@ -0,0 +1 @@ +../../Task/24-game-Solve/Zig \ No newline at end of file diff --git a/Lang/Zig/9-billion-names-of-God-the-integer b/Lang/Zig/9-billion-names-of-God-the-integer new file mode 120000 index 0000000000..891e6336a6 --- /dev/null +++ b/Lang/Zig/9-billion-names-of-God-the-integer @@ -0,0 +1 @@ +../../Task/9-billion-names-of-God-the-integer/Zig \ No newline at end of file diff --git a/Lang/Zig/A+B b/Lang/Zig/A+B new file mode 120000 index 0000000000..99c5298cb2 --- /dev/null +++ b/Lang/Zig/A+B @@ -0,0 +1 @@ +../../Task/A+B/Zig \ No newline at end of file diff --git a/Lang/Zig/ABC-problem b/Lang/Zig/ABC-problem new file mode 120000 index 0000000000..4f4592d850 --- /dev/null +++ b/Lang/Zig/ABC-problem @@ -0,0 +1 @@ +../../Task/ABC-problem/Zig \ No newline at end of file diff --git a/Lang/Zig/AVL-tree b/Lang/Zig/AVL-tree new file mode 120000 index 0000000000..05056fdece --- /dev/null +++ b/Lang/Zig/AVL-tree @@ -0,0 +1 @@ +../../Task/AVL-tree/Zig \ No newline at end of file diff --git a/Lang/Zig/Abelian-sandpile-model b/Lang/Zig/Abelian-sandpile-model new file mode 120000 index 0000000000..aff7b1b955 --- /dev/null +++ b/Lang/Zig/Abelian-sandpile-model @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model/Zig \ No newline at end of file diff --git a/Lang/Zig/Abelian-sandpile-model-Identity b/Lang/Zig/Abelian-sandpile-model-Identity new file mode 120000 index 0000000000..5a22dd3380 --- /dev/null +++ b/Lang/Zig/Abelian-sandpile-model-Identity @@ -0,0 +1 @@ +../../Task/Abelian-sandpile-model-Identity/Zig \ No newline at end of file diff --git a/Lang/Zig/Anti-primes b/Lang/Zig/Anti-primes new file mode 120000 index 0000000000..bde3882591 --- /dev/null +++ b/Lang/Zig/Anti-primes @@ -0,0 +1 @@ +../../Task/Anti-primes/Zig \ No newline at end of file diff --git a/Lang/Zig/Arithmetic-Integer b/Lang/Zig/Arithmetic-Integer new file mode 120000 index 0000000000..3faa5af494 --- /dev/null +++ b/Lang/Zig/Arithmetic-Integer @@ -0,0 +1 @@ +../../Task/Arithmetic-Integer/Zig \ No newline at end of file diff --git a/Lang/Zig/Arrays b/Lang/Zig/Arrays new file mode 120000 index 0000000000..8271fea84a --- /dev/null +++ b/Lang/Zig/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Zig \ No newline at end of file diff --git a/Lang/Zig/Associative-array-Creation b/Lang/Zig/Associative-array-Creation new file mode 120000 index 0000000000..9dff0b181f --- /dev/null +++ b/Lang/Zig/Associative-array-Creation @@ -0,0 +1 @@ +../../Task/Associative-array-Creation/Zig \ No newline at end of file diff --git a/Lang/Zig/Associative-array-Iteration b/Lang/Zig/Associative-array-Iteration new file mode 120000 index 0000000000..0120ea3ca0 --- /dev/null +++ b/Lang/Zig/Associative-array-Iteration @@ -0,0 +1 @@ +../../Task/Associative-array-Iteration/Zig \ No newline at end of file diff --git a/Lang/Zig/Babbage-problem b/Lang/Zig/Babbage-problem new file mode 120000 index 0000000000..c79a638466 --- /dev/null +++ b/Lang/Zig/Babbage-problem @@ -0,0 +1 @@ +../../Task/Babbage-problem/Zig \ No newline at end of file diff --git a/Lang/Zig/Babylonian-spiral b/Lang/Zig/Babylonian-spiral new file mode 120000 index 0000000000..518c958994 --- /dev/null +++ b/Lang/Zig/Babylonian-spiral @@ -0,0 +1 @@ +../../Task/Babylonian-spiral/Zig \ No newline at end of file diff --git a/Lang/Zig/Balanced-brackets b/Lang/Zig/Balanced-brackets new file mode 120000 index 0000000000..0a6293637f --- /dev/null +++ b/Lang/Zig/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Zig \ No newline at end of file diff --git a/Lang/Zig/Balanced-ternary b/Lang/Zig/Balanced-ternary new file mode 120000 index 0000000000..aaf8a47b9b --- /dev/null +++ b/Lang/Zig/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/Zig \ No newline at end of file diff --git a/Lang/Zig/Base64-decode-data b/Lang/Zig/Base64-decode-data new file mode 120000 index 0000000000..9291a91364 --- /dev/null +++ b/Lang/Zig/Base64-decode-data @@ -0,0 +1 @@ +../../Task/Base64-decode-data/Zig \ No newline at end of file diff --git a/Lang/Zig/Bifid-cipher b/Lang/Zig/Bifid-cipher new file mode 120000 index 0000000000..c3e619eb90 --- /dev/null +++ b/Lang/Zig/Bifid-cipher @@ -0,0 +1 @@ +../../Task/Bifid-cipher/Zig \ No newline at end of file diff --git a/Lang/Zig/Binary-digits b/Lang/Zig/Binary-digits new file mode 120000 index 0000000000..6e0bd7354f --- /dev/null +++ b/Lang/Zig/Binary-digits @@ -0,0 +1 @@ +../../Task/Binary-digits/Zig \ No newline at end of file diff --git a/Lang/Zig/Binary-search b/Lang/Zig/Binary-search new file mode 120000 index 0000000000..0144afc2f0 --- /dev/null +++ b/Lang/Zig/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Zig \ No newline at end of file diff --git a/Lang/Zig/Bitcoin-address-validation b/Lang/Zig/Bitcoin-address-validation new file mode 120000 index 0000000000..582e8551db --- /dev/null +++ b/Lang/Zig/Bitcoin-address-validation @@ -0,0 +1 @@ +../../Task/Bitcoin-address-validation/Zig \ No newline at end of file diff --git a/Lang/Zig/Bitmap b/Lang/Zig/Bitmap new file mode 120000 index 0000000000..ef66b502ad --- /dev/null +++ b/Lang/Zig/Bitmap @@ -0,0 +1 @@ +../../Task/Bitmap/Zig \ No newline at end of file diff --git a/Lang/Zig/Boolean-values b/Lang/Zig/Boolean-values new file mode 120000 index 0000000000..8bbec67819 --- /dev/null +++ b/Lang/Zig/Boolean-values @@ -0,0 +1 @@ +../../Task/Boolean-values/Zig \ No newline at end of file diff --git a/Lang/Zig/Boyer-Moore-string-search b/Lang/Zig/Boyer-Moore-string-search new file mode 120000 index 0000000000..9c6dd89c45 --- /dev/null +++ b/Lang/Zig/Boyer-Moore-string-search @@ -0,0 +1 @@ +../../Task/Boyer-Moore-string-search/Zig \ No newline at end of file diff --git a/Lang/Zig/Break-OO-privacy b/Lang/Zig/Break-OO-privacy new file mode 120000 index 0000000000..535f70b15b --- /dev/null +++ b/Lang/Zig/Break-OO-privacy @@ -0,0 +1 @@ +../../Task/Break-OO-privacy/Zig \ No newline at end of file diff --git a/Lang/Zig/Caesar-cipher b/Lang/Zig/Caesar-cipher new file mode 120000 index 0000000000..c0eaca0400 --- /dev/null +++ b/Lang/Zig/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Zig \ No newline at end of file diff --git a/Lang/Zig/Camel-case-and-snake-case b/Lang/Zig/Camel-case-and-snake-case new file mode 120000 index 0000000000..ab00dfd34b --- /dev/null +++ b/Lang/Zig/Camel-case-and-snake-case @@ -0,0 +1 @@ +../../Task/Camel-case-and-snake-case/Zig \ No newline at end of file diff --git a/Lang/Zig/Canonicalize-CIDR b/Lang/Zig/Canonicalize-CIDR new file mode 120000 index 0000000000..792c271f68 --- /dev/null +++ b/Lang/Zig/Canonicalize-CIDR @@ -0,0 +1 @@ +../../Task/Canonicalize-CIDR/Zig \ No newline at end of file diff --git a/Lang/Zig/Case-sensitivity-of-identifiers b/Lang/Zig/Case-sensitivity-of-identifiers new file mode 120000 index 0000000000..7a873961b9 --- /dev/null +++ b/Lang/Zig/Case-sensitivity-of-identifiers @@ -0,0 +1 @@ +../../Task/Case-sensitivity-of-identifiers/Zig \ No newline at end of file diff --git a/Lang/Zig/Catamorphism b/Lang/Zig/Catamorphism new file mode 120000 index 0000000000..d7f93bdd1e --- /dev/null +++ b/Lang/Zig/Catamorphism @@ -0,0 +1 @@ +../../Task/Catamorphism/Zig \ No newline at end of file diff --git a/Lang/Zig/Cholesky-decomposition b/Lang/Zig/Cholesky-decomposition new file mode 120000 index 0000000000..7fbe65969f --- /dev/null +++ b/Lang/Zig/Cholesky-decomposition @@ -0,0 +1 @@ +../../Task/Cholesky-decomposition/Zig \ No newline at end of file diff --git a/Lang/Zig/Chowla-numbers b/Lang/Zig/Chowla-numbers new file mode 120000 index 0000000000..034b021f26 --- /dev/null +++ b/Lang/Zig/Chowla-numbers @@ -0,0 +1 @@ +../../Task/Chowla-numbers/Zig \ No newline at end of file diff --git a/Lang/Zig/Command-line-arguments b/Lang/Zig/Command-line-arguments new file mode 120000 index 0000000000..5b9231a470 --- /dev/null +++ b/Lang/Zig/Command-line-arguments @@ -0,0 +1 @@ +../../Task/Command-line-arguments/Zig \ No newline at end of file diff --git a/Lang/Zig/Compare-sorting-algorithms-performance b/Lang/Zig/Compare-sorting-algorithms-performance new file mode 120000 index 0000000000..2f98698afb --- /dev/null +++ b/Lang/Zig/Compare-sorting-algorithms-performance @@ -0,0 +1 @@ +../../Task/Compare-sorting-algorithms-performance/Zig \ No newline at end of file diff --git a/Lang/Zig/Convex-hull b/Lang/Zig/Convex-hull new file mode 120000 index 0000000000..bb63712423 --- /dev/null +++ b/Lang/Zig/Convex-hull @@ -0,0 +1 @@ +../../Task/Convex-hull/Zig \ No newline at end of file diff --git a/Lang/Zig/Conways-Game-of-Life b/Lang/Zig/Conways-Game-of-Life new file mode 120000 index 0000000000..d6337a8a7a --- /dev/null +++ b/Lang/Zig/Conways-Game-of-Life @@ -0,0 +1 @@ +../../Task/Conways-Game-of-Life/Zig \ No newline at end of file diff --git a/Lang/Zig/Count-occurrences-of-a-substring b/Lang/Zig/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..820b93c2bb --- /dev/null +++ b/Lang/Zig/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Zig \ No newline at end of file diff --git a/Lang/Zig/Cumulative-standard-deviation b/Lang/Zig/Cumulative-standard-deviation new file mode 120000 index 0000000000..225e824146 --- /dev/null +++ b/Lang/Zig/Cumulative-standard-deviation @@ -0,0 +1 @@ +../../Task/Cumulative-standard-deviation/Zig \ No newline at end of file diff --git a/Lang/Zig/Cyclops-numbers b/Lang/Zig/Cyclops-numbers new file mode 120000 index 0000000000..625d97b345 --- /dev/null +++ b/Lang/Zig/Cyclops-numbers @@ -0,0 +1 @@ +../../Task/Cyclops-numbers/Zig \ No newline at end of file diff --git a/Lang/Zig/De-Bruijn-sequences b/Lang/Zig/De-Bruijn-sequences new file mode 120000 index 0000000000..1e82ee12c7 --- /dev/null +++ b/Lang/Zig/De-Bruijn-sequences @@ -0,0 +1 @@ +../../Task/De-Bruijn-sequences/Zig \ No newline at end of file diff --git a/Lang/Zig/Deal-cards-for-FreeCell b/Lang/Zig/Deal-cards-for-FreeCell new file mode 120000 index 0000000000..8f0b26df35 --- /dev/null +++ b/Lang/Zig/Deal-cards-for-FreeCell @@ -0,0 +1 @@ +../../Task/Deal-cards-for-FreeCell/Zig \ No newline at end of file diff --git a/Lang/Zig/Deconvolution-1D b/Lang/Zig/Deconvolution-1D new file mode 120000 index 0000000000..26b778762a --- /dev/null +++ b/Lang/Zig/Deconvolution-1D @@ -0,0 +1 @@ +../../Task/Deconvolution-1D/Zig \ No newline at end of file diff --git a/Lang/Zig/Determinant-and-permanent b/Lang/Zig/Determinant-and-permanent new file mode 120000 index 0000000000..6aec06c204 --- /dev/null +++ b/Lang/Zig/Determinant-and-permanent @@ -0,0 +1 @@ +../../Task/Determinant-and-permanent/Zig \ No newline at end of file diff --git a/Lang/Zig/Determine-if-a-string-is-numeric b/Lang/Zig/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..1317ba1b29 --- /dev/null +++ b/Lang/Zig/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Zig \ No newline at end of file diff --git a/Lang/Zig/Dijkstras-algorithm b/Lang/Zig/Dijkstras-algorithm new file mode 120000 index 0000000000..e85779f749 --- /dev/null +++ b/Lang/Zig/Dijkstras-algorithm @@ -0,0 +1 @@ +../../Task/Dijkstras-algorithm/Zig \ No newline at end of file diff --git a/Lang/Zig/Eertree b/Lang/Zig/Eertree new file mode 120000 index 0000000000..297f5d26a6 --- /dev/null +++ b/Lang/Zig/Eertree @@ -0,0 +1 @@ +../../Task/Eertree/Zig \ No newline at end of file diff --git a/Lang/Zig/Egyptian-division b/Lang/Zig/Egyptian-division new file mode 120000 index 0000000000..fbc8453acb --- /dev/null +++ b/Lang/Zig/Egyptian-division @@ -0,0 +1 @@ +../../Task/Egyptian-division/Zig \ No newline at end of file diff --git a/Lang/Zig/Elliptic-Curve-Digital-Signature-Algorithm b/Lang/Zig/Elliptic-Curve-Digital-Signature-Algorithm new file mode 120000 index 0000000000..8631c5bdb3 --- /dev/null +++ b/Lang/Zig/Elliptic-Curve-Digital-Signature-Algorithm @@ -0,0 +1 @@ +../../Task/Elliptic-Curve-Digital-Signature-Algorithm/Zig \ No newline at end of file diff --git a/Lang/Zig/Elliptic-curve-arithmetic b/Lang/Zig/Elliptic-curve-arithmetic new file mode 120000 index 0000000000..6d1206bc71 --- /dev/null +++ b/Lang/Zig/Elliptic-curve-arithmetic @@ -0,0 +1 @@ +../../Task/Elliptic-curve-arithmetic/Zig \ No newline at end of file diff --git a/Lang/Zig/Evolutionary-algorithm b/Lang/Zig/Evolutionary-algorithm new file mode 120000 index 0000000000..59ff814ffb --- /dev/null +++ b/Lang/Zig/Evolutionary-algorithm @@ -0,0 +1 @@ +../../Task/Evolutionary-algorithm/Zig \ No newline at end of file diff --git a/Lang/Zig/Execute-a-Markov-algorithm b/Lang/Zig/Execute-a-Markov-algorithm new file mode 120000 index 0000000000..5b70cd7b50 --- /dev/null +++ b/Lang/Zig/Execute-a-Markov-algorithm @@ -0,0 +1 @@ +../../Task/Execute-a-Markov-algorithm/Zig \ No newline at end of file diff --git a/Lang/Zig/Factors-of-an-integer b/Lang/Zig/Factors-of-an-integer new file mode 120000 index 0000000000..9bd33985d3 --- /dev/null +++ b/Lang/Zig/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Zig \ No newline at end of file diff --git a/Lang/Zig/Farey-sequence b/Lang/Zig/Farey-sequence new file mode 120000 index 0000000000..44274502d4 --- /dev/null +++ b/Lang/Zig/Farey-sequence @@ -0,0 +1 @@ +../../Task/Farey-sequence/Zig \ No newline at end of file diff --git a/Lang/Zig/Fibonacci-sequence b/Lang/Zig/Fibonacci-sequence new file mode 120000 index 0000000000..8c7ee19f72 --- /dev/null +++ b/Lang/Zig/Fibonacci-sequence @@ -0,0 +1 @@ +../../Task/Fibonacci-sequence/Zig \ No newline at end of file diff --git a/Lang/Zig/Fibonacci-word b/Lang/Zig/Fibonacci-word new file mode 120000 index 0000000000..e5d3567eb0 --- /dev/null +++ b/Lang/Zig/Fibonacci-word @@ -0,0 +1 @@ +../../Task/Fibonacci-word/Zig \ No newline at end of file diff --git a/Lang/Zig/Find-limit-of-recursion b/Lang/Zig/Find-limit-of-recursion new file mode 120000 index 0000000000..fe08755028 --- /dev/null +++ b/Lang/Zig/Find-limit-of-recursion @@ -0,0 +1 @@ +../../Task/Find-limit-of-recursion/Zig \ No newline at end of file diff --git a/Lang/Zig/Find-the-missing-permutation b/Lang/Zig/Find-the-missing-permutation new file mode 120000 index 0000000000..720e08365d --- /dev/null +++ b/Lang/Zig/Find-the-missing-permutation @@ -0,0 +1 @@ +../../Task/Find-the-missing-permutation/Zig \ No newline at end of file diff --git a/Lang/Zig/Floyd-Warshall-algorithm b/Lang/Zig/Floyd-Warshall-algorithm new file mode 120000 index 0000000000..e20cfd03e2 --- /dev/null +++ b/Lang/Zig/Floyd-Warshall-algorithm @@ -0,0 +1 @@ +../../Task/Floyd-Warshall-algorithm/Zig \ No newline at end of file diff --git a/Lang/Zig/Gray-code b/Lang/Zig/Gray-code new file mode 120000 index 0000000000..f2147c406a --- /dev/null +++ b/Lang/Zig/Gray-code @@ -0,0 +1 @@ +../../Task/Gray-code/Zig \ No newline at end of file diff --git a/Lang/Zig/Halt-and-catch-fire b/Lang/Zig/Halt-and-catch-fire new file mode 120000 index 0000000000..c9706c0075 --- /dev/null +++ b/Lang/Zig/Halt-and-catch-fire @@ -0,0 +1 @@ +../../Task/Halt-and-catch-fire/Zig \ No newline at end of file diff --git a/Lang/Zig/Integer-sequence b/Lang/Zig/Integer-sequence new file mode 120000 index 0000000000..43f4f97f8b --- /dev/null +++ b/Lang/Zig/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Zig \ No newline at end of file diff --git a/Lang/Zig/Introspection b/Lang/Zig/Introspection new file mode 120000 index 0000000000..7b0cfb145a --- /dev/null +++ b/Lang/Zig/Introspection @@ -0,0 +1 @@ +../../Task/Introspection/Zig \ No newline at end of file diff --git a/Lang/Zig/Jaro-similarity b/Lang/Zig/Jaro-similarity new file mode 120000 index 0000000000..26cb0df4ff --- /dev/null +++ b/Lang/Zig/Jaro-similarity @@ -0,0 +1 @@ +../../Task/Jaro-similarity/Zig \ No newline at end of file diff --git a/Lang/Zig/K-d-tree b/Lang/Zig/K-d-tree new file mode 120000 index 0000000000..3fd542d0d2 --- /dev/null +++ b/Lang/Zig/K-d-tree @@ -0,0 +1 @@ +../../Task/K-d-tree/Zig \ No newline at end of file diff --git a/Lang/Zig/Knapsack-problem-0-1 b/Lang/Zig/Knapsack-problem-0-1 new file mode 120000 index 0000000000..95f8fcd9fc --- /dev/null +++ b/Lang/Zig/Knapsack-problem-0-1 @@ -0,0 +1 @@ +../../Task/Knapsack-problem-0-1/Zig \ No newline at end of file diff --git a/Lang/Zig/Knights-tour b/Lang/Zig/Knights-tour new file mode 120000 index 0000000000..a8fa50bb64 --- /dev/null +++ b/Lang/Zig/Knights-tour @@ -0,0 +1 @@ +../../Task/Knights-tour/Zig \ No newline at end of file diff --git a/Lang/Zig/LZW-compression b/Lang/Zig/LZW-compression new file mode 120000 index 0000000000..fd9ce93698 --- /dev/null +++ b/Lang/Zig/LZW-compression @@ -0,0 +1 @@ +../../Task/LZW-compression/Zig \ No newline at end of file diff --git a/Lang/Zig/Latin-Squares-in-reduced-form b/Lang/Zig/Latin-Squares-in-reduced-form new file mode 120000 index 0000000000..4ae8de3ec8 --- /dev/null +++ b/Lang/Zig/Latin-Squares-in-reduced-form @@ -0,0 +1 @@ +../../Task/Latin-Squares-in-reduced-form/Zig \ No newline at end of file diff --git a/Lang/Zig/Levenshtein-distance b/Lang/Zig/Levenshtein-distance new file mode 120000 index 0000000000..f793f74b09 --- /dev/null +++ b/Lang/Zig/Levenshtein-distance @@ -0,0 +1 @@ +../../Task/Levenshtein-distance/Zig \ No newline at end of file diff --git a/Lang/Zig/Loops-Nested b/Lang/Zig/Loops-Nested new file mode 120000 index 0000000000..a78e39957d --- /dev/null +++ b/Lang/Zig/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/Zig \ No newline at end of file diff --git a/Lang/Zig/Loops-Wrong-ranges b/Lang/Zig/Loops-Wrong-ranges new file mode 120000 index 0000000000..25a3b4b4d8 --- /dev/null +++ b/Lang/Zig/Loops-Wrong-ranges @@ -0,0 +1 @@ +../../Task/Loops-Wrong-ranges/Zig \ No newline at end of file diff --git a/Lang/Zig/M-bius-function b/Lang/Zig/M-bius-function new file mode 120000 index 0000000000..b4ad984b09 --- /dev/null +++ b/Lang/Zig/M-bius-function @@ -0,0 +1 @@ +../../Task/M-bius-function/Zig \ No newline at end of file diff --git a/Lang/Zig/Main-step-of-GOST-28147-89 b/Lang/Zig/Main-step-of-GOST-28147-89 new file mode 120000 index 0000000000..433b294fbc --- /dev/null +++ b/Lang/Zig/Main-step-of-GOST-28147-89 @@ -0,0 +1 @@ +../../Task/Main-step-of-GOST-28147-89/Zig \ No newline at end of file diff --git a/Lang/Zig/Man-or-boy-test b/Lang/Zig/Man-or-boy-test new file mode 120000 index 0000000000..bb1768f007 --- /dev/null +++ b/Lang/Zig/Man-or-boy-test @@ -0,0 +1 @@ +../../Task/Man-or-boy-test/Zig \ No newline at end of file diff --git a/Lang/Zig/Matrix-exponentiation-operator b/Lang/Zig/Matrix-exponentiation-operator new file mode 120000 index 0000000000..273e429228 --- /dev/null +++ b/Lang/Zig/Matrix-exponentiation-operator @@ -0,0 +1 @@ +../../Task/Matrix-exponentiation-operator/Zig \ No newline at end of file diff --git a/Lang/Zig/Modular-arithmetic b/Lang/Zig/Modular-arithmetic new file mode 120000 index 0000000000..a64c6161fe --- /dev/null +++ b/Lang/Zig/Modular-arithmetic @@ -0,0 +1 @@ +../../Task/Modular-arithmetic/Zig \ No newline at end of file diff --git a/Lang/Zig/Modular-inverse b/Lang/Zig/Modular-inverse new file mode 120000 index 0000000000..f96c2102b0 --- /dev/null +++ b/Lang/Zig/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/Zig \ No newline at end of file diff --git a/Lang/Zig/Monty-Hall-problem b/Lang/Zig/Monty-Hall-problem new file mode 120000 index 0000000000..5c32ef8986 --- /dev/null +++ b/Lang/Zig/Monty-Hall-problem @@ -0,0 +1 @@ +../../Task/Monty-Hall-problem/Zig \ No newline at end of file diff --git a/Lang/Zig/Move-to-front-algorithm b/Lang/Zig/Move-to-front-algorithm new file mode 120000 index 0000000000..820f21fe3e --- /dev/null +++ b/Lang/Zig/Move-to-front-algorithm @@ -0,0 +1 @@ +../../Task/Move-to-front-algorithm/Zig \ No newline at end of file diff --git a/Lang/Zig/Mutual-recursion b/Lang/Zig/Mutual-recursion new file mode 120000 index 0000000000..ad6fe03709 --- /dev/null +++ b/Lang/Zig/Mutual-recursion @@ -0,0 +1 @@ +../../Task/Mutual-recursion/Zig \ No newline at end of file diff --git a/Lang/Zig/Natural-sorting b/Lang/Zig/Natural-sorting new file mode 120000 index 0000000000..ce3fd8d2e1 --- /dev/null +++ b/Lang/Zig/Natural-sorting @@ -0,0 +1 @@ +../../Task/Natural-sorting/Zig \ No newline at end of file diff --git a/Lang/Zig/P-Adic-numbers-basic b/Lang/Zig/P-Adic-numbers-basic new file mode 120000 index 0000000000..7be77909db --- /dev/null +++ b/Lang/Zig/P-Adic-numbers-basic @@ -0,0 +1 @@ +../../Task/P-Adic-numbers-basic/Zig \ No newline at end of file diff --git a/Lang/Zig/P-Adic-square-roots b/Lang/Zig/P-Adic-square-roots new file mode 120000 index 0000000000..bf2f9425e2 --- /dev/null +++ b/Lang/Zig/P-Adic-square-roots @@ -0,0 +1 @@ +../../Task/P-Adic-square-roots/Zig \ No newline at end of file diff --git a/Lang/Zig/Parametric-polymorphism b/Lang/Zig/Parametric-polymorphism new file mode 120000 index 0000000000..76dd4a7ae3 --- /dev/null +++ b/Lang/Zig/Parametric-polymorphism @@ -0,0 +1 @@ +../../Task/Parametric-polymorphism/Zig \ No newline at end of file diff --git a/Lang/Zig/Parse-an-IP-Address b/Lang/Zig/Parse-an-IP-Address new file mode 120000 index 0000000000..dcc1d9a064 --- /dev/null +++ b/Lang/Zig/Parse-an-IP-Address @@ -0,0 +1 @@ +../../Task/Parse-an-IP-Address/Zig \ No newline at end of file diff --git a/Lang/Zig/Parsing-RPN-calculator-algorithm b/Lang/Zig/Parsing-RPN-calculator-algorithm new file mode 120000 index 0000000000..64d52e74e9 --- /dev/null +++ b/Lang/Zig/Parsing-RPN-calculator-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-RPN-calculator-algorithm/Zig \ No newline at end of file diff --git a/Lang/Zig/Parsing-Shunting-yard-algorithm b/Lang/Zig/Parsing-Shunting-yard-algorithm new file mode 120000 index 0000000000..36cb3a3892 --- /dev/null +++ b/Lang/Zig/Parsing-Shunting-yard-algorithm @@ -0,0 +1 @@ +../../Task/Parsing-Shunting-yard-algorithm/Zig \ No newline at end of file diff --git a/Lang/Zig/Pells-equation b/Lang/Zig/Pells-equation new file mode 120000 index 0000000000..dc6754d05f --- /dev/null +++ b/Lang/Zig/Pells-equation @@ -0,0 +1 @@ +../../Task/Pells-equation/Zig \ No newline at end of file diff --git a/Lang/Zig/Permutations-by-swapping b/Lang/Zig/Permutations-by-swapping new file mode 120000 index 0000000000..5e667cc7e2 --- /dev/null +++ b/Lang/Zig/Permutations-by-swapping @@ -0,0 +1 @@ +../../Task/Permutations-by-swapping/Zig \ No newline at end of file diff --git a/Lang/Zig/Quickselect-algorithm b/Lang/Zig/Quickselect-algorithm new file mode 120000 index 0000000000..7dbb81ef78 --- /dev/null +++ b/Lang/Zig/Quickselect-algorithm @@ -0,0 +1 @@ +../../Task/Quickselect-algorithm/Zig \ No newline at end of file diff --git a/Lang/Zig/Quine b/Lang/Zig/Quine new file mode 120000 index 0000000000..20f1f12898 --- /dev/null +++ b/Lang/Zig/Quine @@ -0,0 +1 @@ +../../Task/Quine/Zig \ No newline at end of file diff --git a/Lang/Zig/Read-entire-file b/Lang/Zig/Read-entire-file new file mode 120000 index 0000000000..123de25159 --- /dev/null +++ b/Lang/Zig/Read-entire-file @@ -0,0 +1 @@ +../../Task/Read-entire-file/Zig \ No newline at end of file diff --git a/Lang/Zig/SHA-1 b/Lang/Zig/SHA-1 new file mode 120000 index 0000000000..374af24054 --- /dev/null +++ b/Lang/Zig/SHA-1 @@ -0,0 +1 @@ +../../Task/SHA-1/Zig \ No newline at end of file diff --git a/Lang/Zig/Sisyphus-sequence b/Lang/Zig/Sisyphus-sequence new file mode 120000 index 0000000000..58dd5ff994 --- /dev/null +++ b/Lang/Zig/Sisyphus-sequence @@ -0,0 +1 @@ +../../Task/Sisyphus-sequence/Zig \ No newline at end of file diff --git a/Lang/Zig/Solve-a-Holy-Knights-tour b/Lang/Zig/Solve-a-Holy-Knights-tour new file mode 120000 index 0000000000..b0fe3fcb9a --- /dev/null +++ b/Lang/Zig/Solve-a-Holy-Knights-tour @@ -0,0 +1 @@ +../../Task/Solve-a-Holy-Knights-tour/Zig \ No newline at end of file diff --git a/Lang/Zig/Solve-the-no-connection-puzzle b/Lang/Zig/Solve-the-no-connection-puzzle new file mode 120000 index 0000000000..4b3367c677 --- /dev/null +++ b/Lang/Zig/Solve-the-no-connection-puzzle @@ -0,0 +1 @@ +../../Task/Solve-the-no-connection-puzzle/Zig \ No newline at end of file diff --git a/Lang/Zig/Sort-using-a-custom-comparator b/Lang/Zig/Sort-using-a-custom-comparator new file mode 120000 index 0000000000..d6d8d488b5 --- /dev/null +++ b/Lang/Zig/Sort-using-a-custom-comparator @@ -0,0 +1 @@ +../../Task/Sort-using-a-custom-comparator/Zig \ No newline at end of file diff --git a/Lang/Zig/Sorting-algorithms-Patience-sort b/Lang/Zig/Sorting-algorithms-Patience-sort new file mode 120000 index 0000000000..a696e81abf --- /dev/null +++ b/Lang/Zig/Sorting-algorithms-Patience-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Patience-sort/Zig \ No newline at end of file diff --git a/Lang/Zig/Sorting-algorithms-Strand-sort b/Lang/Zig/Sorting-algorithms-Strand-sort new file mode 120000 index 0000000000..67361c524c --- /dev/null +++ b/Lang/Zig/Sorting-algorithms-Strand-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Strand-sort/Zig \ No newline at end of file diff --git a/Lang/Zig/Stern-Brocot-sequence b/Lang/Zig/Stern-Brocot-sequence new file mode 120000 index 0000000000..4e68e871bc --- /dev/null +++ b/Lang/Zig/Stern-Brocot-sequence @@ -0,0 +1 @@ +../../Task/Stern-Brocot-sequence/Zig \ No newline at end of file diff --git a/Lang/Zig/Strassens-algorithm b/Lang/Zig/Strassens-algorithm new file mode 120000 index 0000000000..f02a6cb05a --- /dev/null +++ b/Lang/Zig/Strassens-algorithm @@ -0,0 +1 @@ +../../Task/Strassens-algorithm/Zig \ No newline at end of file diff --git a/Lang/Zig/Stream-merge b/Lang/Zig/Stream-merge new file mode 120000 index 0000000000..83ddc64918 --- /dev/null +++ b/Lang/Zig/Stream-merge @@ -0,0 +1 @@ +../../Task/Stream-merge/Zig \ No newline at end of file diff --git a/Lang/Zig/Sudoku b/Lang/Zig/Sudoku new file mode 120000 index 0000000000..cc0b8be01d --- /dev/null +++ b/Lang/Zig/Sudoku @@ -0,0 +1 @@ +../../Task/Sudoku/Zig \ No newline at end of file diff --git a/Lang/Zig/Sutherland-Hodgman-polygon-clipping b/Lang/Zig/Sutherland-Hodgman-polygon-clipping new file mode 120000 index 0000000000..2e08ab9fc7 --- /dev/null +++ b/Lang/Zig/Sutherland-Hodgman-polygon-clipping @@ -0,0 +1 @@ +../../Task/Sutherland-Hodgman-polygon-clipping/Zig \ No newline at end of file diff --git a/Lang/Zig/Tarjan b/Lang/Zig/Tarjan new file mode 120000 index 0000000000..47db828add --- /dev/null +++ b/Lang/Zig/Tarjan @@ -0,0 +1 @@ +../../Task/Tarjan/Zig \ No newline at end of file diff --git a/Lang/Zig/Thue-Morse b/Lang/Zig/Thue-Morse new file mode 120000 index 0000000000..514eeceeed --- /dev/null +++ b/Lang/Zig/Thue-Morse @@ -0,0 +1 @@ +../../Task/Thue-Morse/Zig \ No newline at end of file diff --git a/Lang/Zig/Tonelli-Shanks-algorithm b/Lang/Zig/Tonelli-Shanks-algorithm new file mode 120000 index 0000000000..364e6278fd --- /dev/null +++ b/Lang/Zig/Tonelli-Shanks-algorithm @@ -0,0 +1 @@ +../../Task/Tonelli-Shanks-algorithm/Zig \ No newline at end of file diff --git a/Lang/Zig/Tree-datastructures b/Lang/Zig/Tree-datastructures new file mode 120000 index 0000000000..2483259e7c --- /dev/null +++ b/Lang/Zig/Tree-datastructures @@ -0,0 +1 @@ +../../Task/Tree-datastructures/Zig \ No newline at end of file diff --git a/Lang/Zig/Unicode-variable-names b/Lang/Zig/Unicode-variable-names new file mode 120000 index 0000000000..2cf5330d25 --- /dev/null +++ b/Lang/Zig/Unicode-variable-names @@ -0,0 +1 @@ +../../Task/Unicode-variable-names/Zig \ No newline at end of file diff --git a/Lang/Zig/Verhoeff-algorithm b/Lang/Zig/Verhoeff-algorithm new file mode 120000 index 0000000000..d90fb8e2ca --- /dev/null +++ b/Lang/Zig/Verhoeff-algorithm @@ -0,0 +1 @@ +../../Task/Verhoeff-algorithm/Zig \ No newline at end of file diff --git a/Lang/Zig/Vigen-re-cipher-Cryptanalysis b/Lang/Zig/Vigen-re-cipher-Cryptanalysis new file mode 120000 index 0000000000..7fd7d3aa92 --- /dev/null +++ b/Lang/Zig/Vigen-re-cipher-Cryptanalysis @@ -0,0 +1 @@ +../../Task/Vigen-re-cipher-Cryptanalysis/Zig \ No newline at end of file diff --git a/Lang/Zig/Vogels-approximation-method b/Lang/Zig/Vogels-approximation-method new file mode 120000 index 0000000000..af40cfb307 --- /dev/null +++ b/Lang/Zig/Vogels-approximation-method @@ -0,0 +1 @@ +../../Task/Vogels-approximation-method/Zig \ No newline at end of file diff --git a/Lang/Zig/War-card-game b/Lang/Zig/War-card-game new file mode 120000 index 0000000000..6bc9afa5bf --- /dev/null +++ b/Lang/Zig/War-card-game @@ -0,0 +1 @@ +../../Task/War-card-game/Zig \ No newline at end of file diff --git a/Lang/Zig/Y-combinator b/Lang/Zig/Y-combinator new file mode 120000 index 0000000000..1478dbbdb7 --- /dev/null +++ b/Lang/Zig/Y-combinator @@ -0,0 +1 @@ +../../Task/Y-combinator/Zig \ No newline at end of file diff --git a/Lang/Zkl/Bioinformatics-base-count b/Lang/Zkl/Bioinformatics-base-count deleted file mode 120000 index f344937ca4..0000000000 --- a/Lang/Zkl/Bioinformatics-base-count +++ /dev/null @@ -1 +0,0 @@ -../../Task/Bioinformatics-base-count/Zkl \ No newline at end of file diff --git a/Lang/Zkl/Miller-Rabin-primality-test b/Lang/Zkl/Miller-Rabin-primality-test deleted file mode 120000 index 92bfcfa6ff..0000000000 --- a/Lang/Zkl/Miller-Rabin-primality-test +++ /dev/null @@ -1 +0,0 @@ -../../Task/Miller-Rabin-primality-test/Zkl \ No newline at end of file diff --git a/Lang/Zkl/Quaternion-type b/Lang/Zkl/Quaternion-type deleted file mode 120000 index d36f19dd00..0000000000 --- a/Lang/Zkl/Quaternion-type +++ /dev/null @@ -1 +0,0 @@ -../../Task/Quaternion-type/Zkl \ No newline at end of file diff --git a/Lang/Zkl/Sorting-Algorithms-Circle-Sort b/Lang/Zkl/Sorting-Algorithms-Circle-Sort deleted file mode 120000 index 6de597a14d..0000000000 --- a/Lang/Zkl/Sorting-Algorithms-Circle-Sort +++ /dev/null @@ -1 +0,0 @@ -../../Task/Sorting-Algorithms-Circle-Sort/Zkl \ No newline at end of file diff --git a/Lang/Zonnon/00-LANG.txt b/Lang/Zonnon/00-LANG.txt index 8a95e192c9..e4a45b3fa4 100644 --- a/Lang/Zonnon/00-LANG.txt +++ b/Lang/Zonnon/00-LANG.txt @@ -3,4 +3,11 @@ |site=http://www.zonnon.ethz.ch/ |LCT=yes }} -Zonnon is a general-purpose programming language in the [[Pascal]], [[Modula-2]] and [[Oberon]] family. It retains an emphasis on simplicity, clear syntax and separation of concerns whilst focusing on concurrency and ease of composition and expression. Unification of abstractions is at the heart of its design and this is reflected in its conceptual model based on modules, objects, definitions and implementations. Zonnon offers a new computing model based on active objects with their interaction defined by syntax controlled dialogs. It also introduces new features including operator overloading and exception handling, and is specifically designed to be platform independent. \ No newline at end of file +Zonnon is a general-purpose programming language in the [[Pascal]], [[Modula-2]] and [[Oberon]] family. It retains an emphasis on simplicity, clear syntax and separation of concerns whilst focusing on concurrency and ease of composition and expression. Unification of abstractions is at the heart of its design and this is reflected in its conceptual model based on modules, objects, definitions and implementations. Zonnon offers a new computing model based on active objects with their interaction defined by syntax controlled dialogs. It also introduces new features including operator overloading and exception handling, and is specifically designed to be platform independent. + +===See also=== +* [[Oberon-07]] +* [[Oberon-2]] +* [[Component Pascal]] +* [[Modula-2]] +* [[Modula-3]] \ No newline at end of file diff --git a/Task/100-doors/00-TASK.txt b/Task/100-doors/00-TASK.txt index fd7471448b..83471393d8 100644 --- a/Task/100-doors/00-TASK.txt +++ b/Task/100-doors/00-TASK.txt @@ -2,21 +2,26 @@ There are 100 doors in a row that are all initially closed. You make 100 [[task feature::Rosetta Code:multiple passes|passes]] by the doors. -The first time through, visit every door and  ''toggle''  the door  (if the door is closed,  open it;   if it is open,  close it). +The first time through, visit every door and ''toggle'' the door (if the door is closed, open it; if it is open, close it). -The second time, only visit every 2nd door   (door #2, #4, #6, ...),   and toggle it. +The second time, only visit every 2nd door (door #2, #4, #6, ...), and toggle it. -The third time, visit every 3rd door   (door #3, #6, #9, ...), etc,   until you only visit the 100th door. +The third time, visit every 3rd door (door #3, #6, #9, ...), etc, until you only visit the 100th door. ;Task: -Answer the question:   what state are the doors in after the last pass?   Which are open, which are closed? +Answer the question: what state are the doors in after the last pass? Which are open, which are closed? '''[[task feature::Rosetta Code:extra credit|Alternate]]:''' -As noted in this page's   [[Talk:100 doors|discussion page]],   the only doors that remain open are those whose numbers are perfect squares. +As noted in this page's [[Talk:100 doors|discussion page]], the only doors that remain open are those whose numbers are perfect squares. -Opening only those doors is an   [[task feature::Rosetta Code:optimization|optimization]]   that may also be expressed; +Opening only those doors is an [[task feature::Rosetta Code:optimization|optimization]] that may also be expressed; however, as should be obvious, this defeats the intent of comparing implementations across programming languages.

    +;Why doesn't syntax highlighting work on this page ?: +Currently, there is a limit on how many <syntaxhighlight> tags can appear on a page, so only the first few languages get highlighting, the rest are shown in monochrome.
    +You could try "manual highlighting", possibly using one of the highlighters on [[Syntax highlighting using Mediawiki formatting]] or something similar. + + diff --git a/Task/100-doors/11l/100-doors.11l b/Task/100-doors/11l/100-doors.11l index 3783f3ff5a..2808744415 100644 --- a/Task/100-doors/11l/100-doors.11l +++ b/Task/100-doors/11l/100-doors.11l @@ -1,5 +1,5 @@ V doors = [0B] * 100 -L(i) 100 +L(i) 0.<100 L(j) (i .< 100).step(i + 1) doors[j] = !doors[j] print(‘Door ’(i + 1)‘: ’(I doors[i] {‘open’} E ‘close’)) diff --git a/Task/100-doors/8080-Assembly/100-doors.8080 b/Task/100-doors/8080-Assembly/100-doors-1.8080 similarity index 100% rename from Task/100-doors/8080-Assembly/100-doors.8080 rename to Task/100-doors/8080-Assembly/100-doors-1.8080 diff --git a/Task/100-doors/8080-Assembly/100-doors-2.8080 b/Task/100-doors/8080-Assembly/100-doors-2.8080 new file mode 100644 index 0000000000..d5cb28c55f --- /dev/null +++ b/Task/100-doors/8080-Assembly/100-doors-2.8080 @@ -0,0 +1,79 @@ +wboot equ 0 ; jump to BIOS warm boot routine +bdos equ 5 ; BDOS entry +conout equ 2 ; BDOS console output function +putstr equ 9 ; BDOS print string function +ndoors equ 100 ; number of doors + ; + org 100h + lxi sp,stack ; set our own stack + lxi d,intro ; print introductory message + mvi c,putstr + call bdos + ; + ; generate sequence of squares to specified limit + ; HL holds the current square + ; DE holds the increment + ; BC holds the negative of the limit + ; +gensqr: lxi h,1 ; starting value of square + lxi d,3 ; starting value of increment + lxi b,-ndoors +sqrs2: call putdec ; otherwise print current square + mvi a,' ' ; separate with a space + call putchr + push h ; have we reached the limit? + dad b + pop h + jc done ; CY if HL > limit + dad d ; square += incrememnt + inx d ; increment += 2 + inx d + jmp sqrs2 ; repeat until finished + ; +done: jmp wboot ; exit with warm boot + ;--------------------------------------------------- + ; console output of char in A register + ;--------------------------------------------------- +putchr: push h + push d + push b + mov e,a + mvi c,conout + call bdos + pop b + pop d + pop h + ret + ;--------------------------------------------------- + ; Output decimal number to console + ; HL holds 16-bit unsigned binary number to print + ;--------------------------------------------------- +putdec: push b + push d + push h + lxi b,-10 + lxi d,-1 +putdec2: + dad b + inx d + jc putdec2 + lxi b,10 + dad b + xchg + mov a,h + ora l + cnz putdec ; recursive call + mov a,e + adi '0' + call putchr + pop h + pop d + pop b + ret + ;--------------------------------------------------- + ; data area and stack + ;--------------------------------------------------- +intro: db 'The open doors are: $' +stack equ $+128 ; 64-level stack + ; + end diff --git a/Task/100-doors/ABC/100-doors.abc b/Task/100-doors/ABC/100-doors.abc new file mode 100644 index 0000000000..59cbdecb64 --- /dev/null +++ b/Task/100-doors/ABC/100-doors.abc @@ -0,0 +1,26 @@ +HOW TO INITIALIZE: + SHARE doors + PUT {} IN doors + FOR door IN {1..100}: + PUT 0 IN doors[door] + +HOW TO TOGGLE door: + SHARE doors + PUT 1-doors[door] IN doors[door] + +HOW TO WALK step: + SHARE doors + PUT step IN door + WHILE door <= 100: + TOGGLE door + PUT door+step IN door + +HOW TO DISPLAY OPEN DOORS: + SHARE doors + FOR door IN {1..100}: + IF doors[door] = 1: + WRITE "Door", door, "is open"/ + +INITIALIZE +FOR pass IN {1..100}: WALK pass +DISPLAY OPEN DOORS diff --git a/Task/100-doors/ALGOL-60/100-doors.alg b/Task/100-doors/ALGOL-60/100-doors.alg deleted file mode 100644 index c558d5cd63..0000000000 --- a/Task/100-doors/ALGOL-60/100-doors.alg +++ /dev/null @@ -1,31 +0,0 @@ -begin - -comment - 100 doors problem in ALGOL-60; - -boolean array doors[1:100]; -integer i, j; -boolean open, closed; - -open := true; -closed := not true; - -outstring(1,"100 Doors Problem\n"); - -comment - all doors are initially closed; -for i := 1 step 1 until 100 do - doors[i] := closed; - -comment - cycle through at increasing intervals - and flip each door encountered; -for i := 1 step 1 until 100 do - for j := i step i until 100 do - doors[j] := not doors[j]; - -comment - show which doors are open; -outstring(1,"The open doors are:"); -for i := 1 step 1 until 100 do - if doors[i] then - outinteger(1,i); - -end diff --git a/Task/100-doors/ALGOL-68/100-doors-1.alg b/Task/100-doors/ALGOL-68/100-doors-1.alg deleted file mode 100644 index 8b4fc67b17..0000000000 --- a/Task/100-doors/ALGOL-68/100-doors-1.alg +++ /dev/null @@ -1,20 +0,0 @@ -PROC doors = (INT limit)VOID: -( - MODE DOORSTATE = BOOL; - BOOL closed = FALSE; - BOOL open = NOT closed; - MODE DOORLIST = [limit]DOORSTATE; - - DOORLIST the doors; - FOR i FROM LWB the doors TO UPB the doors DO the doors[i]:=closed OD; - - FOR i FROM LWB the doors TO UPB the doors DO - FOR j FROM LWB the doors BY i TO UPB the doors DO - the doors[j] := NOT the doors[j] - OD - OD; - FOR i FROM LWB the doors TO UPB the doors DO - print((whole(i,-12)," is ",(the doors[i]|"opened"|"closed"),newline)) - OD -); -doors(100) diff --git a/Task/100-doors/ALGOL-68/100-doors-2.alg b/Task/100-doors/ALGOL-68/100-doors-2.alg deleted file mode 100644 index 70f031cd84..0000000000 --- a/Task/100-doors/ALGOL-68/100-doors-2.alg +++ /dev/null @@ -1,7 +0,0 @@ -PROC doors optimised = ( INT limit )VOID: - FOR i TO limit DO - REAL num := sqrt(i); - printf(($g" is "gl$,i,(ENTIER num = num |"opened"|"closed") )) - OD -; -doors optimised(limit) diff --git a/Task/100-doors/ALGOL-W/100-doors.alg b/Task/100-doors/ALGOL-W/100-doors.alg deleted file mode 100644 index 89593f1ca1..0000000000 --- a/Task/100-doors/ALGOL-W/100-doors.alg +++ /dev/null @@ -1,32 +0,0 @@ -begin - % -- find the first few squares via the unoptimised door flipping method % - - integer doorMax; - doorMax := 100; - - begin - % -- need to start a new block so the array can have variable bounds % - - % -- array of doors - door( i ) is true if open, false if closed % - logical array door( 1 :: doorMax ); - - % -- set all doors to closed % - for i := 1 until doorMax do door( i ) := false; - - % -- repeatedly flip the doors % - for i := 1 until doorMax - do begin - for j := i step i until doorMax - do begin - door( j ) := not door( j ) - end - end; - - % -- display the results % - i_w := 1; % -- set integer field width % - s_w := 1; % -- and separator width % - for i := 1 until doorMax do if door( i ) then writeon( i ) - - end - -end. diff --git a/Task/100-doors/ANSI-BASIC/100-doors.basic b/Task/100-doors/ANSI-BASIC/100-doors.basic new file mode 100644 index 0000000000..eec806c191 --- /dev/null +++ b/Task/100-doors/ANSI-BASIC/100-doors.basic @@ -0,0 +1,21 @@ +100 REM 100 doors +110 REM The unoptimised door flipping method +120 REM which simulates the process +130 DIM IsDoorOpen(1 TO 100) +140 LET DoorMax = UBOUND(IsDoorOpen) +150 REM Set all doors to closed +160 FOR I = 1 TO DoorMax +170 LET IsDoorOpen(I) = 0 +180 NEXT I +190 REM Repeatedly flip the doors +200 FOR I = 1 TO DoorMax +210 FOR J = I TO DoorMax STEP I +220 LET IsDoorOpen(J) = 1 - IsDoorOpen(J) +230 NEXT J +240 NEXT I +250 REM Display the results +260 FOR I = 1 TO DoorMax +270 IF IsDoorOpen(I) <> 0 THEN PRINT I; +280 NEXT I +290 PRINT +300 END diff --git a/Task/100-doors/APL/100-doors-2.apl b/Task/100-doors/APL/100-doors-2.apl index ba6d739dae..bff8982b24 100644 --- a/Task/100-doors/APL/100-doors-2.apl +++ b/Task/100-doors/APL/100-doors-2.apl @@ -1,3 +1 @@ -⍝⍝ Also works with GNU APL after introduction of -⍝⍝ the ⍸ function with SVN r1368, Dec 03 2020 -⍸≠⌿0=(⍳100)∘.|⍳100 +≠⌿0=(⍳100)∘.|⍳100 diff --git a/Task/100-doors/APL/100-doors-3.apl b/Task/100-doors/APL/100-doors-3.apl new file mode 100644 index 0000000000..5fcad5e104 --- /dev/null +++ b/Task/100-doors/APL/100-doors-3.apl @@ -0,0 +1 @@ +⍸≠⌿0=(⍳100)∘.|⍳100 diff --git a/Task/100-doors/AWK/100-doors-1.awk b/Task/100-doors/AWK/100-doors-1.awk deleted file mode 100644 index 1c2a279c09..0000000000 --- a/Task/100-doors/AWK/100-doors-1.awk +++ /dev/null @@ -1,17 +0,0 @@ -BEGIN { - for(i=1; i <= 100; i++) - { - doors[i] = 0 # close the doors - } - for(i=1; i <= 100; i++) - { - for(j=i; j <= 100; j += i) - { - doors[j] = (doors[j]+1) % 2 - } - } - for(i=1; i <= 100; i++) - { - print i, doors[i] ? "open" : "close" - } -} diff --git a/Task/100-doors/AWK/100-doors-2.awk b/Task/100-doors/AWK/100-doors-2.awk deleted file mode 100644 index 9344bbec27..0000000000 --- a/Task/100-doors/AWK/100-doors-2.awk +++ /dev/null @@ -1,14 +0,0 @@ -BEGIN { - for(i=1; i <= 100; i++) { - doors[i] = 0 # close the doors - } - for(i=1; i <= 100; i++) { - if ( int(sqrt(i)) == sqrt(i) ) { - doors[i] = 1 - } - } - for(i=1; i <= 100; i++) - { - print i, doors[i] ? "open" : "close" - } -} diff --git a/Task/100-doors/Ada/100-doors-1.ada b/Task/100-doors/Ada/100-doors-1.adb similarity index 100% rename from Task/100-doors/Ada/100-doors-1.ada rename to Task/100-doors/Ada/100-doors-1.adb diff --git a/Task/100-doors/Ada/100-doors-2.ada b/Task/100-doors/Ada/100-doors-2.adb similarity index 100% rename from Task/100-doors/Ada/100-doors-2.ada rename to Task/100-doors/Ada/100-doors-2.adb diff --git a/Task/100-doors/Adina/100-doors-1.adina b/Task/100-doors/Adina/100-doors-1.adina new file mode 100644 index 0000000000..0e7190c89e --- /dev/null +++ b/Task/100-doors/Adina/100-doors-1.adina @@ -0,0 +1,16 @@ +двери = новый-массив 100 ложь + +цикл + шаг + в-диапазоне 1 101 + цикл + номер + в-диапазоне (шаг - 1) 100 шаг + двери[номер] := не двери[номер] + +цикл + номер 100 + вывести/перенос + формат «Дверь ~a ~a» + номер + 1 + двери[номер] ? «открыта» «закрыта» diff --git a/Task/100-doors/Adina/100-doors-2.adina b/Task/100-doors/Adina/100-doors-2.adina new file mode 100644 index 0000000000..6286140dc0 --- /dev/null +++ b/Task/100-doors/Adina/100-doors-2.adina @@ -0,0 +1,17 @@ +english() +doors = make-vector 100 #f + +for + $ step + in-range 1 101 + for + $ number + in-range (step - 1) 100 step + doors[number] := not doors[number] + +for + $ number 100 + displayln + format "Door ~a ~a" + number + 1 + if doors[number] "open" "closed" diff --git a/Task/100-doors/Agena/100-doors.agena b/Task/100-doors/Agena/100-doors.agena deleted file mode 100644 index 18c9cb1963..0000000000 --- a/Task/100-doors/Agena/100-doors.agena +++ /dev/null @@ -1,19 +0,0 @@ -# find the first few squares via the unoptimised door flipping method -scope - - local doorMax := 100; - local door; - create register door( doorMax ); - - # set all doors to closed - for i to doorMax do door[ i ] := false od; - - # repeatedly flip the doors - for i to doorMax do - for j from i to doorMax by i do door[ j ] := not door[ j ] od - od; - - # display the results - for i to doorMax do if door[ i ] then write( " ", i ) fi od; print() - -epocs diff --git a/Task/100-doors/ArkScript/100-doors-1.ark b/Task/100-doors/ArkScript/100-doors-1.ark new file mode 100644 index 0000000000..713e3b360f --- /dev/null +++ b/Task/100-doors/ArkScript/100-doors-1.ark @@ -0,0 +1,21 @@ +(import std.Range :range :forEach) +(import std.List) + +(mut doors (list:fill 100 false)) +(let r (range 0 100)) + +(forEach r + (fun (i) { + (mut j i) + (while (< j 100) { + (@= doors j (not (@ doors j))) + (set j (+ j i 1)) }) + (print doors) })) + +(print + (list:map + (list:filter + (list:zipWithIndex doors) + (fun (e) + (@ e 1))) + (fun (e) (@ e 0)))) diff --git a/Task/100-doors/ArkScript/100-doors-2.ark b/Task/100-doors/ArkScript/100-doors-2.ark new file mode 100644 index 0000000000..b1cb4380b2 --- /dev/null +++ b/Task/100-doors/ArkScript/100-doors-2.ark @@ -0,0 +1,4 @@ +[true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true] +... +[true false false true false false false false true false false false false false false true false false false false false false false false true false false false false false false false false false false true false false false false false false false false false false false false true false false false false false false false false false false false false false false true false false false false false false false false false false false false false false false false true false false false false false false false false false false false false false false false false false false true] +[0 3 8 15 24 35 48 63 80 99] diff --git a/Task/100-doors/AutoIt/100-doors.autoit b/Task/100-doors/AutoIt/100-doors.au3 similarity index 100% rename from Task/100-doors/AutoIt/100-doors.autoit rename to Task/100-doors/AutoIt/100-doors.au3 diff --git a/Task/100-doors/AutoLISP/100-doors.lsp b/Task/100-doors/AutoLISP/100-doors.lsp new file mode 100644 index 0000000000..d4a0ebbe77 --- /dev/null +++ b/Task/100-doors/AutoLISP/100-doors.lsp @@ -0,0 +1,18 @@ +(defun CreateDoors (n / doors) + (repeat n + (setq doors (cons nil doors)) + ) +) + +(defun Doors (doors / cnt) + (setq cnt 0) + (mapcar + '(lambda (d) + (zerop (rem (sqrt (setq cnt (1+ cnt))) 1)) + ) + doors + ) +) + +> (Doors (CreateDoors 100)) +(T nil nil T nil nil nil nil T nil nil nil nil nil nil T nil nil nil nil nil nil nil nil T nil nil nil nil nil nil nil nil nil nil T nil nil nil nil nil nil nil nil nil nil nil nil T nil nil nil nil nil nil nil nil nil nil nil nil nil nil T nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil T nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil T nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil T nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil T nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil T nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil T nil nil nil nil) diff --git a/Task/100-doors/BQN/100-doors-4.bqn b/Task/100-doors/BQN/100-doors-4.bqn new file mode 100644 index 0000000000..cfab61e191 --- /dev/null +++ b/Task/100-doors/BQN/100-doors-4.bqn @@ -0,0 +1,3 @@ +F ← {1+ / 2| +˝ 0= |⌜˜ 1+↕𝕩} +F 100 +# ⟨ 1 4 9 16 25 36 49 64 81 100 ⟩ diff --git a/Task/100-doors/BQN/100-doors-5.bqn b/Task/100-doors/BQN/100-doors-5.bqn new file mode 100644 index 0000000000..b78e4f3de6 --- /dev/null +++ b/Task/100-doors/BQN/100-doors-5.bqn @@ -0,0 +1,3 @@ +F ← {ט1+↕⌊√𝕩} +F 100 +# ⟨ 1 4 9 16 25 36 49 64 81 100 ⟩ diff --git a/Task/100-doors/BabyCobol/100-doors.cobol b/Task/100-doors/BabyCobol/100-doors.cobol new file mode 100644 index 0000000000..feccf1cab2 --- /dev/null +++ b/Task/100-doors/BabyCobol/100-doors.cobol @@ -0,0 +1,29 @@ + * NB: the implementation is rather vanilla + * besides using the idiomatic buffer overrun. + * LOOP is what PERFORM in COBOL is, with defaults. + * MOVE in this language acts like OVE CORRESPONDING, + * which is actually good here. + IDENTIFICATION DIVISION. + PROGRAM-ID. ONE HUNDRED DOORS. + DATA DIVISION. + 01 I PICTURE IS 9(3). + 01 J LIKE I. + 01 DOOR PICTURE IS 9 OCCURS 100 TIMES. + 01 STOP LIKE DOOR. + PROCEDURE DIVISION. + * Initialise the data + MOVE HIGH-VALUES TO STOP + MOVE SPACES TO DOOR. + * Do the main algorithm + LOOP VARYING I UNTIL DOOR(I) = 9 + LOOP VARYING J FROM I TO 100 BY I + SUBTRACT DOOR (J) FROM 1 GIVING DOOR (J) + END + END. + * Print the results + LOOP VARYING I UNTIL DOOR(I) = 9 + DISPLAY "Door" I "is" WITH NO ADVANCING + IF DOOR (I) = 1 + THEN DISPLAY "open" + ELSE DISPLAY "closed". + END. diff --git a/Task/100-doors/Ballerina/100-doors.ballerina b/Task/100-doors/Ballerina/100-doors.ballerina new file mode 100644 index 0000000000..35d7c63798 --- /dev/null +++ b/Task/100-doors/Ballerina/100-doors.ballerina @@ -0,0 +1,16 @@ +// https://rosettacode.org/wiki/100_doors +import ballerina/io; + +public function main() { + boolean[100] doors = []; + foreach int i in int:range(0,100,1) { + foreach int j in int:range(i, 100, i+1) { + doors[j] = ! doors[j]; + } + } + foreach int i in int:range(0,doors.length(),1) { + if doors[i] { + io:println("Door #",i+1," is ","open"); + } + } +} diff --git a/Task/100-doors/C-sharp/100-doors-1.cs b/Task/100-doors/C-sharp/100-doors-1.cs index d06413f95c..3e031cc721 100644 --- a/Task/100-doors/C-sharp/100-doors-1.cs +++ b/Task/100-doors/C-sharp/100-doors-1.cs @@ -5,11 +5,10 @@ namespace ConsoleApplication1 { static void Main(string[] args) { + // Arrays are initialized to their type default values; the default for bool is false + // Use false to indicate closed door bool[] doors = new bool[100]; - //Close all doors to start. - for (int d = 0; d < 100; d++) doors[d] = false; - //For each pass... for (int p = 0; p < 100; p++)//number of passes { @@ -24,7 +23,7 @@ namespace ConsoleApplication1 } //Output the results. - Console.WriteLine("Passes Completed!!! Here are the results: \r\n"); + Console.WriteLine("Passes Completed!!! Here are the results:"); for (int d = 0; d < 100; d++) { if (doors[d]) diff --git a/Task/100-doors/C/100-doors-3.c b/Task/100-doors/C/100-doors-3.c index fb7f7feb29..d8fed2c66e 100644 --- a/Task/100-doors/C/100-doors-3.c +++ b/Task/100-doors/C/100-doors-3.c @@ -1,19 +1,14 @@ #include +#include -int main() -{ - int square = 1, increment = 3, door; - for (door = 1; door <= 100; ++door) - { - printf("door #%d", door); - if (door == square) - { - printf(" is open.\n"); - square += increment; - increment += 2; - } - else - printf(" is closed.\n"); - } - return 0; +int main() { + uint32_t doorBytes[4] = {0}; + + for (uint32_t i = 1; i <= 100; ++i) + for (uint32_t j = i - 1; j <= 99; j += i) + doorBytes[j % 4] ^= (uint32_t)1 << j / 4; + + for (uint32_t i = 0; i <= 99; doorBytes[i++ % 4] >>= 1) + if (doorBytes[i % 4] & 1) + printf("door %d is open\n", i + 1); } diff --git a/Task/100-doors/C/100-doors-4.c b/Task/100-doors/C/100-doors-4.c index a1972a382b..fb7f7feb29 100644 --- a/Task/100-doors/C/100-doors-4.c +++ b/Task/100-doors/C/100-doors-4.c @@ -2,8 +2,18 @@ int main() { - int door, square, increment; - for (door = 1, square = 1, increment = 1; door <= 100; door++ == square && (square += increment += 2)) - printf("door #%d is %s.\n", door, (door == square? "open" : "closed")); + int square = 1, increment = 3, door; + for (door = 1; door <= 100; ++door) + { + printf("door #%d", door); + if (door == square) + { + printf(" is open.\n"); + square += increment; + increment += 2; + } + else + printf(" is closed.\n"); + } return 0; } diff --git a/Task/100-doors/C/100-doors-5.c b/Task/100-doors/C/100-doors-5.c index 4988099e36..a1972a382b 100644 --- a/Task/100-doors/C/100-doors-5.c +++ b/Task/100-doors/C/100-doors-5.c @@ -2,9 +2,8 @@ int main() { - int i; - for (i = 1; i * i <= 100; i++) - printf("door %d open\n", i * i); - - return 0; + int door, square, increment; + for (door = 1, square = 1, increment = 1; door <= 100; door++ == square && (square += increment += 2)) + printf("door #%d is %s.\n", door, (door == square? "open" : "closed")); + return 0; } diff --git a/Task/100-doors/C/100-doors-6.c b/Task/100-doors/C/100-doors-6.c new file mode 100644 index 0000000000..4988099e36 --- /dev/null +++ b/Task/100-doors/C/100-doors-6.c @@ -0,0 +1,10 @@ +#include + +int main() +{ + int i; + for (i = 1; i * i <= 100; i++) + printf("door %d open\n", i * i); + + return 0; +} diff --git a/Task/100-doors/CBASIC/100-doors.basic b/Task/100-doors/CBASIC/100-doors.basic new file mode 100644 index 0000000000..f81972b2ae --- /dev/null +++ b/Task/100-doors/CBASIC/100-doors.basic @@ -0,0 +1,27 @@ +dim doors%(100) + +print "Finding solution to the 100 Doors Problem" + +rem - all doors are initially closed +for i% = 1 to 100 + doors%(i%) = 0 +next i% + +rem - pass through at increasing intervals +for i% = 1 to 100 + for j% = i% to 100 step i% + rem - flip each door encountered + doors%(j%) = 1 - doors%(j%) + next j% +next i% + +rem - show which doors are open +print "The open doors are: "; +for i% = 1 to 100 + if doors%(i%) = 1 then print i%; +next i% + +print +print "Thanks for consulting the puzzle guru!" + +end diff --git a/Task/100-doors/COBOL/100-doors.cobol b/Task/100-doors/COBOL/100-doors.cob similarity index 100% rename from Task/100-doors/COBOL/100-doors.cobol rename to Task/100-doors/COBOL/100-doors.cob diff --git a/Task/100-doors/Component-Pascal/100-doors.pas b/Task/100-doors/Component-Pascal/100-doors.pas deleted file mode 100644 index 0e11914244..0000000000 --- a/Task/100-doors/Component-Pascal/100-doors.pas +++ /dev/null @@ -1,26 +0,0 @@ -MODULE Doors100; -IMPORT StdLog; - -PROCEDURE Do*; -VAR - i,j: INTEGER; - closed: ARRAY 101 OF BOOLEAN; -BEGIN - (* initialization of closed to true *) - FOR i := 0 TO LEN(closed) - 1 DO closed[i] := TRUE END; - (* process *) - FOR i := 1 TO LEN(closed) DO; - j := 1; - WHILE j < LEN(closed) DO - IF j MOD i = 0 THEN closed[j] := ~closed[j] END;INC(j) - END - END; - (* print results *) - i := 1; - WHILE i < LEN(closed) DO - IF (i - 1) MOD 10 = 0 THEN StdLog.Ln END; - IF closed[i] THEN StdLog.String("C ") ELSE StdLog.String("O ") END; - INC(i) - END; -END Do; -END Doors100. diff --git a/Task/100-doors/Crystal/100-doors.crystal b/Task/100-doors/Crystal/100-doors.cr similarity index 100% rename from Task/100-doors/Crystal/100-doors.crystal rename to Task/100-doors/Crystal/100-doors.cr diff --git a/Task/100-doors/DuckDB/100-doors.duckdb b/Task/100-doors/DuckDB/100-doors.duckdb new file mode 100644 index 0000000000..aa3716882e --- /dev/null +++ b/Task/100-doors/DuckDB/100-doors.duckdb @@ -0,0 +1,19 @@ +# Show the state of n doors after n iterations +create or replace function doors(n) as ( + with recursive cte(ix,d) as ( + select 0 as ix, list_transform(range(0, n), x -> false) as d + union all + select ix+1, + list_transform(d, (x,i) -> if (i % (ix + 1) = 0, NOT x, x)) + from cte + where ix < n + ) + select last(d order by ix) + from cte +); + +# For brevity, we just show the indices of the doors that are open after all +# have been visited: +select ix +from (select unnest(generate_series(1,100)) as ix, unnest(doors(100)) as d) +where d = true; diff --git a/Task/100-doors/EMal/100-doors.emal b/Task/100-doors/EMal/100-doors.emal index 6f0e0623b1..f7294803da 100644 --- a/Task/100-doors/EMal/100-doors.emal +++ b/Task/100-doors/EMal/100-doors.emal @@ -4,28 +4,21 @@ type Door model int id Door:State state - new by int =id, Door:State =state do end - fun toggle = void by block - me.state = when(me.state == Door:State.CLOSED, Door:State.OPEN, Door:State.CLOSED) - end - fun asText = text by block - return "Door #" + me.id + " is " + when(me.state == Door:State.CLOSED, "closed", "open") - end + new by int ←id, Door:State ←state do end + fun toggle ← <|me.state ← when(me.state æ Door:State.CLOSED, Door:State.OPEN, Door:State.CLOSED) + fun asText ← <|"Door #" + me.id + " is " + when(me.state æ Door:State.CLOSED, "closed", "open") end type Main ^|There are 100 doors in a row that are all initially closed.|^ -List doors = Door[].with(100) -for int i = 0; i < 100; ++i - doors[i] = Door(i + 1, Door:State.CLOSED) -end +List doors ← Door[].with(100, false); - for(int i := 0, i < 100, i := i + 1) + var Doors := Array.allocate(100).populate::(n=>false); + for(int i := 0; i < 100; i++) { - for(int j := i, j < 100, j := j + i + 1) + for(int j := i; j < 100; j := j + i + 1) { Doors[j] := Doors[j].Inverted } }; - for(int i := 0, i < 100, i := i + 1) + for(int i := 0; i < 100; i++) { - console.printLine("Door #",i + 1," :",Doors[i].iif("Open","Closed")) + Console.printLine("Door #",i + 1," :",Doors[i].iif("Open","Closed")) }; - console.readChar() + Console.readChar() } diff --git a/Task/100-doors/Elixir/100-doors.elixir b/Task/100-doors/Elixir/100-doors.ex similarity index 100% rename from Task/100-doors/Elixir/100-doors.elixir rename to Task/100-doors/Elixir/100-doors.ex diff --git a/Task/100-doors/Emacs-Lisp/100-doors.l b/Task/100-doors/Emacs-Lisp/100-doors-1.el similarity index 100% rename from Task/100-doors/Emacs-Lisp/100-doors.l rename to Task/100-doors/Emacs-Lisp/100-doors-1.el diff --git a/Task/100-doors/Emacs-Lisp/100-doors-2.el b/Task/100-doors/Emacs-Lisp/100-doors-2.el new file mode 100644 index 0000000000..66b2cff437 --- /dev/null +++ b/Task/100-doors/Emacs-Lisp/100-doors-2.el @@ -0,0 +1,16 @@ +(defun one-hundred-doors(initial-state) + "Turn doors in INITIAL-STATE according to 100 Doors problem." + (interactive "nEnter initial doors' state (as a number): ") + (cl-loop for x from 1 to 100 + do (cl-loop for y from (1- x) to 99 by x + do (setq initial-state (logxor initial-state (ash 1 y))))) + (let ((counter 1) + (open-doors nil)) + (while (> initial-state 0) + (when (eq (mod initial-state 2) 1) + (push counter open-doors)) + (cl-incf counter) + (setq initial-state (/ initial-state 2))) + (message "Open doors are %s" (reverse open-doors)))) + +(one-hundred-doors 0) diff --git a/Task/100-doors/Euphoria/100-doors.euphoria b/Task/100-doors/Euphoria/100-doors.eu similarity index 100% rename from Task/100-doors/Euphoria/100-doors.euphoria rename to Task/100-doors/Euphoria/100-doors.eu diff --git a/Task/100-doors/Excel/100-doors-4.excel b/Task/100-doors/Excel/100-doors-4.excel new file mode 100644 index 0000000000..619e31a91c --- /dev/null +++ b/Task/100-doors/Excel/100-doors-4.excel @@ -0,0 +1 @@ +=LET(i, SEQUENCE(100), root, SQRT(i), "Door " & i & ": " & IF(root = INT(root), "open", "close")) diff --git a/Task/100-doors/F-Sharp/100-doors-2.fs b/Task/100-doors/F-Sharp/100-doors-2.fs index dff5b85a51..abda597121 100644 --- a/Task/100-doors/F-Sharp/100-doors-2.fs +++ b/Task/100-doors/F-Sharp/100-doors-2.fs @@ -1,6 +1 @@ -open System -let answer2 = - let PerfectSquare n = - let sqrt = int(Math.Sqrt(float n)) - n = sqrt * sqrt - [| for i in 1..100 do yield PerfectSquare i |] +[1..100] |> List.fold (fun doors pass->List.mapi (fun i x->if ((i + 1) % pass)=0 then not x else x) doors) (List.init 100 (fun _->false)) diff --git a/Task/100-doors/F-Sharp/100-doors-3.fs b/Task/100-doors/F-Sharp/100-doors-3.fs index abda597121..0e020e7034 100644 --- a/Task/100-doors/F-Sharp/100-doors-3.fs +++ b/Task/100-doors/F-Sharp/100-doors-3.fs @@ -1 +1,8 @@ -[1..100] |> List.fold (fun doors pass->List.mapi (fun i x->if ((i + 1) % pass)=0 then not x else x) doors) (List.init 100 (fun _->false)) +let X q=not q +let mutable q = false +let mutable doors = [] +for n in 1..100 do + for g in 1..n do if n%g=0 then q<-X(q) + if q then doors<-n::doors + q<-false +printfn "%A" (doors|>List.rev) diff --git a/Task/100-doors/Fennel/100-doors.fennel b/Task/100-doors/Fennel/100-doors.fennel new file mode 100644 index 0000000000..b6e72cb03e --- /dev/null +++ b/Task/100-doors/Fennel/100-doors.fennel @@ -0,0 +1,15 @@ +(do ;;; find the first few squares via the unoptimised door flipping method + + (local door-max 100) + + ; repeatedly flip the doors and show the ones that are left open + (var door {}) + (for [i 1 door-max] + (for [j i door-max i] + (tset door j (not (. door j))) + ) + (when (. door i) + (io.write (.. " " i)) + ) + ) +) diff --git a/Task/100-doors/Fortran/100-doors-3.f b/Task/100-doors/Fortran/100-doors-3.f new file mode 100644 index 0000000000..2041b696fe --- /dev/null +++ b/Task/100-doors/Fortran/100-doors-3.f @@ -0,0 +1,73 @@ +! ============================================================================= +! DOORS PROBLEM +! ============================================================================= +! +! PROBLEM STATEMENT: +! 100 doors are all initially closed. We make 100 passes. +! Pass 1 toggles every door (1, 2, 3, ..., 100). +! Pass 2 toggles every 2nd (2, 4, 6, ..., 100). +! Pass k toggles every k-th (k, 2k, 3k, ...). +! Pass 100 toggles only door 100. +! What state is each door in after all 100 passes? +! +! ALGORITHM -- DIVISOR COUNTING: +! Door number D is toggled on pass k if and only if k divides D evenly, +! i.e. mod(D, k) == 0. So the total number of toggles that door D receives +! equals the number of divisors of D (including 1 and D itself). +! +! Example: door 6 +! Divisors of 6 are 1, 2, 3, 6 => 4 toggles => even => CLOSED +! +! Example: door 9 +! Divisors of 9 are 1, 3, 9 => 3 toggles => odd => OPEN +! +! A door ends up OPEN when its divisor count is ODD. +! A door ends up CLOSED when its divisor count is EVEN. +! +! KEY MATHEMATICAL INSIGHT (why the pattern is perfect squares): +! Divisors normally come in pairs: if j divides D then (D/j) also divides D, +! giving an even count. The only exception is when j == D/j, i.e. j*j == D. +! That "pairing trick" breaks at the square root, leaving one unpaired divisor +! and making the total ODD. This happens exactly when D is a perfect square. +! So doors 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 are open; all others closed. +! +! This program proves the result by brute-force divisor counting, rather than +! assuming the mathematical conclusion up front. +! ============================================================================= + +program doors + implicit none + + integer, parameter :: n = 100 ! total number of doors (and passes) + integer :: door ! current door being evaluated (1..n) + integer :: pass ! current pass number being tested (1..n) + integer :: toggles ! number of times this door was toggled + character(6) :: state ! final state label: 'open' or 'closed' + + ! --- outer loop: consider each door in turn --- + do door = 1, n + + toggles = 0 ! reset the toggle counter for this door + + ! --- inner loop: check every pass to see if it touches this door --- + ! Pass number 'pass' visits door 'door' only when 'pass' is a divisor + ! of 'door'. mod(door, pass) == 0 means pass divides door exactly. + do pass = 1, n + if (mod(door, pass) == 0) toggles = toggles + 1 + end do + + ! --- determine final state from parity of toggle count --- + ! Starting closed, an odd number of toggles leaves the door open; + ! an even number returns it to closed. + if (mod(toggles, 2) == 1) then + state = 'open' + else + state = 'closed' + end if + + ! --- report result for this door --- + write(*, '(A, I3, A, A)') 'Door', door, ' is ', trim(state) + + end do + +end program doors diff --git a/Task/100-doors/Goboscript/100-doors.gobo b/Task/100-doors/Goboscript/100-doors.gobo new file mode 100644 index 0000000000..f0bc39fd44 --- /dev/null +++ b/Task/100-doors/Goboscript/100-doors.gobo @@ -0,0 +1,37 @@ +costumes "assets/blank.svg"; + +list doors; + +proc do_100_doors { + delete doors; + repeat 100 {add false to doors;} + + local pass_i = 1; + repeat 100 { + local i = 0; + repeat length doors / pass_i { + i += pass_i; + doors[i] = not doors[i]; + } + + pass_i++; + } +} + +onflag{main;} +proc main { + do_100_doors; + + show doors; + local i = 1; + repeat length doors { + if doors[i] { + local state = "open"; + } else { + local state = "closed"; + } + + log "Door " & i & " is " & state; + i++; + } +} diff --git a/Task/100-doors/Haskell/100-doors-3.hs b/Task/100-doors/Haskell/100-doors-3.hs index 2cea247dfd..3b66096632 100644 --- a/Task/100-doors/Haskell/100-doors-3.hs +++ b/Task/100-doors/Haskell/100-doors-3.hs @@ -1,6 +1,9 @@ -gate :: Eq a => [a] -> [a] -> [Door] -gate (x:xs) (y:ys) | x == y = Open : gate xs ys -gate (x:xs) ys = Closed : gate xs ys -gate [] _ = [] +isDoorOpen :: Integral a => a -> Bool +-- In Haskell, we are too lazy to open and close doors. Instead we +-- count how many times we would have toggled them, and then check if +-- that number is odd. +isDoorOpen doorNumber = odd numToggles + where numToggles = length [ 1 | x <- [1..doorNumber], doorNumber `rem` x == 0] -run n = gate [1..n] [k*k | k <- [1..]] +main = do + print $ "Open doors are " ++ show [x | x <- [0..100], isDoorOpen x] diff --git a/Task/100-doors/Haskell/100-doors-4.hs b/Task/100-doors/Haskell/100-doors-4.hs index 44f44aa391..2cea247dfd 100644 --- a/Task/100-doors/Haskell/100-doors-4.hs +++ b/Task/100-doors/Haskell/100-doors-4.hs @@ -1 +1,6 @@ -run n = takeWhile (< n) [k*k | k <- [1..]] +gate :: Eq a => [a] -> [a] -> [Door] +gate (x:xs) (y:ys) | x == y = Open : gate xs ys +gate (x:xs) ys = Closed : gate xs ys +gate [] _ = [] + +run n = gate [1..n] [k*k | k <- [1..]] diff --git a/Task/100-doors/Haskell/100-doors-5.hs b/Task/100-doors/Haskell/100-doors-5.hs new file mode 100644 index 0000000000..44f44aa391 --- /dev/null +++ b/Task/100-doors/Haskell/100-doors-5.hs @@ -0,0 +1 @@ +run n = takeWhile (< n) [k*k | k <- [1..]] diff --git a/Task/100-doors/Haxe/100-doors-1.hx b/Task/100-doors/Haxe/100-doors-1.hx new file mode 100644 index 0000000000..f4cab3c8b8 --- /dev/null +++ b/Task/100-doors/Haxe/100-doors-1.hx @@ -0,0 +1,23 @@ +class Main +{ + static public function main() + { + findOpenDoors( 100 ); + } + + static function findOpenDoors( n : Int ) + { + var door = []; + for( i in 0...n + 1 ){ door[ i ] = false; } + for( i in 1...n + 1 ){ + var j = i; + while( j <= n ){ + door[ j ] = ! door[ j ]; + j += i; + } + } + for( i in 1...n + 1 ){ + if( door[ i ] ){ Sys.print( ' $i' ); } + } + } +} diff --git a/Task/100-doors/Haxe/100-doors-2.hx b/Task/100-doors/Haxe/100-doors-2.hx new file mode 100644 index 0000000000..30853b01fb --- /dev/null +++ b/Task/100-doors/Haxe/100-doors-2.hx @@ -0,0 +1,18 @@ +class RosettaDemo +{ + static public function main() + { + findOpenLockers(100); + } + + static function findOpenLockers(n : Int) + { + var i = 1; + + while((i*i) <= n) + { + Sys.println(i*i); + i++; + } + } +} diff --git a/Task/100-doors/Haxe/100-doors.haxe b/Task/100-doors/Haxe/100-doors.haxe deleted file mode 100644 index 4d86d44909..0000000000 --- a/Task/100-doors/Haxe/100-doors.haxe +++ /dev/null @@ -1,18 +0,0 @@ -class RosettaDemo -{ - static public function main() - { - findOpenLockers(100); - } - - static function findOpenLockers(n : Int) - { - var i = 1; - - while((i*i) <= n) - { - Sys.print(i*i + "\n"); - i++; - } - } -} diff --git a/Task/100-doors/Informix-4GL/100-doors-2.4gl b/Task/100-doors/Informix-4GL/100-doors-2.4gl index 77483d70d0..6a8949775e 100644 --- a/Task/100-doors/Informix-4GL/100-doors-2.4gl +++ b/Task/100-doors/Informix-4GL/100-doors-2.4gl @@ -2,7 +2,7 @@ (for i (range 1 101) i2 (range (dec i) 100 i) - (var! doors (set-at [i2] (! (i2 doors)))) + (var! doors (set-at [i2] (not (i2 doors)))) (continue)) (-> (xmap vec doors) diff --git a/Task/100-doors/JavaScript/100-doors-8.js b/Task/100-doors/JavaScript/100-doors-8.js index 7378d4bae5..fdf195657b 100644 --- a/Task/100-doors/JavaScript/100-doors-8.js +++ b/Task/100-doors/JavaScript/100-doors-8.js @@ -4,6 +4,6 @@ var sqrt = Math.sqrt(door); if (sqrt === (sqrt | 0)) { - console.log("Door %d is open", door); + console.log("Door " + door + " is open"); } }); diff --git a/Task/100-doors/Julia/100-doors-1.julia b/Task/100-doors/Julia/100-doors-1.jl similarity index 100% rename from Task/100-doors/Julia/100-doors-1.julia rename to Task/100-doors/Julia/100-doors-1.jl diff --git a/Task/100-doors/Julia/100-doors-2.julia b/Task/100-doors/Julia/100-doors-2.jl similarity index 100% rename from Task/100-doors/Julia/100-doors-2.julia rename to Task/100-doors/Julia/100-doors-2.jl diff --git a/Task/100-doors/Kotlin/100-doors.kotlin b/Task/100-doors/Kotlin/100-doors.kts similarity index 100% rename from Task/100-doors/Kotlin/100-doors.kotlin rename to Task/100-doors/Kotlin/100-doors.kts diff --git a/Task/100-doors/Langur/100-doors-1.langur b/Task/100-doors/Langur/100-doors-1.langur index 545cca3a47..caac5fccf7 100644 --- a/Task/100-doors/Langur/100-doors-1.langur +++ b/Task/100-doors/Langur/100-doors-1.langur @@ -1,9 +1,9 @@ -var .doors = arr 100, false +var doors = [false] * 100 -for .i of .doors { - for .j = .i; .j <= len(.doors); .j += .i { - .doors[.j] = not .doors[.j] +for i of doors { + for j = i; j <= len(doors); j += i { + doors[j] = not doors[j] } } -writeln for[=[]] .i of .doors { if(.doors[.i]: _for ~= [.i]) } +writeln for[=[]] i of doors { if doors[i]: _for = more(_for, i) } diff --git a/Task/100-doors/Langur/100-doors-2.langur b/Task/100-doors/Langur/100-doors-2.langur index d2e0482cab..1933c0187f 100644 --- a/Task/100-doors/Langur/100-doors-2.langur +++ b/Task/100-doors/Langur/100-doors-2.langur @@ -1 +1 @@ -writeln foldfrom(f if(.b: .a~[.c]; .a), [], .doors, series 1..len .doors) +writeln fold(doors, series(1..len(doors)), by=fn(a, b, c) { if(b: a~[c]; a) }, init=[]) diff --git a/Task/100-doors/Langur/100-doors-3.langur b/Task/100-doors/Langur/100-doors-3.langur index 5481fef9ef..61d90f3fb8 100644 --- a/Task/100-doors/Langur/100-doors-3.langur +++ b/Task/100-doors/Langur/100-doors-3.langur @@ -1 +1 @@ -writeln map(f .x ^ 2, series 1..10) +writeln map(1..10, by=fn{^2}) diff --git a/Task/100-doors/Langur/100-doors-4.langur b/Task/100-doors/Langur/100-doors-4.langur deleted file mode 100644 index f73a204644..0000000000 --- a/Task/100-doors/Langur/100-doors-4.langur +++ /dev/null @@ -1 +0,0 @@ -writeln map f{^2}, 1..10 diff --git a/Task/100-doors/Lua/100-doors.lua b/Task/100-doors/Lua/100-doors.lua deleted file mode 100644 index 3183bc7730..0000000000 --- a/Task/100-doors/Lua/100-doors.lua +++ /dev/null @@ -1,11 +0,0 @@ -local is_open = {} - -for pass = 1,100 do - for door = pass,100,pass do - is_open[door] = not is_open[door] - end -end - -for i,v in next,is_open do - print ('Door '..i..':',v and 'open' or 'close') -end diff --git a/Task/100-doors/MSX-Basic/100-doors.basic b/Task/100-doors/MSX-Basic/100-doors-1.basic similarity index 100% rename from Task/100-doors/MSX-Basic/100-doors.basic rename to Task/100-doors/MSX-Basic/100-doors-1.basic diff --git a/Task/100-doors/Minimal-BASIC/100-doors-2.basic b/Task/100-doors/MSX-Basic/100-doors-2.basic similarity index 100% rename from Task/100-doors/Minimal-BASIC/100-doors-2.basic rename to Task/100-doors/MSX-Basic/100-doors-2.basic diff --git a/Task/100-doors/Minimal-BASIC/100-doors-3.basic b/Task/100-doors/MSX-Basic/100-doors-3.basic similarity index 100% rename from Task/100-doors/Minimal-BASIC/100-doors-3.basic rename to Task/100-doors/MSX-Basic/100-doors-3.basic diff --git a/Task/100-doors/Minimal-BASIC/100-doors-4.basic b/Task/100-doors/MSX-Basic/100-doors-4.basic similarity index 100% rename from Task/100-doors/Minimal-BASIC/100-doors-4.basic rename to Task/100-doors/MSX-Basic/100-doors-4.basic diff --git a/Task/100-doors/Minimal-BASIC/100-doors-1.basic b/Task/100-doors/Minimal-BASIC/100-doors.basic similarity index 100% rename from Task/100-doors/Minimal-BASIC/100-doors-1.basic rename to Task/100-doors/Minimal-BASIC/100-doors.basic diff --git a/Task/100-doors/MoonRock/100-doors.moonrock b/Task/100-doors/MoonRock/100-doors.moonrock new file mode 100644 index 0000000000..f942ba2444 --- /dev/null +++ b/Task/100-doors/MoonRock/100-doors.moonrock @@ -0,0 +1,35 @@ +' 100 doors + +BEGIN DEF +%DoorMax = 100 +%LastI = %DoorMax - 1 +DIM DoorOpen%[%DoorMax] + +BEGIN CODE +' The unoptimised door flipping method +' which simulates the process +' Set all doors to closed +FOR I% = 0 TO %LastI + DoorOpen%[I%] = FALSE +NEXT +' Repeatedly flip the doors +FOR I% = 1 TO %DoorMax + J% = I% - 1 + WHILE J% < %DoorMax + IF DoorOpen%[J%] = TRUE THEN + DoorOpen%[J%] = FALSE + ELSE + DoorOpen%[J%] = TRUE + ENDIF + J% = J% + I% + WEND +NEXT +' Display the results +FOR I% = 0 TO %LastI + IF DoorOpen%[I%] = TRUE THEN + IPl1% = I% + 1 + PRINT " " + IPl1% + ENDIF +NEXT +PRINT "\n" +END diff --git a/Task/100-doors/OCaml/100-doors-1.ocaml b/Task/100-doors/OCaml/100-doors-1.ml similarity index 100% rename from Task/100-doors/OCaml/100-doors-1.ocaml rename to Task/100-doors/OCaml/100-doors-1.ml diff --git a/Task/100-doors/OCaml/100-doors-2.ocaml b/Task/100-doors/OCaml/100-doors-2.ml similarity index 100% rename from Task/100-doors/OCaml/100-doors-2.ocaml rename to Task/100-doors/OCaml/100-doors-2.ml diff --git a/Task/100-doors/OCaml/100-doors-3.ocaml b/Task/100-doors/OCaml/100-doors-3.ml similarity index 100% rename from Task/100-doors/OCaml/100-doors-3.ocaml rename to Task/100-doors/OCaml/100-doors-3.ml diff --git a/Task/100-doors/OPL/100-doors.opl b/Task/100-doors/OPL/100-doors.opl new file mode 100644 index 0000000000..097dc00ccd --- /dev/null +++ b/Task/100-doors/OPL/100-doors.opl @@ -0,0 +1,27 @@ +REM https://github.com/Eva-Broccoli/OPL-Rosetta-Code/blob/main/A100door.opl +PROC main: + LOCAL door%(100),i%,j% + i%=1 + j%=1 + WHILE j%<101 + WHILE i%<101 + IF door%(i%)=0 + door%(i%)=1 + ELSE + door%(i%)=0 + ENDIF + i%=i%+j% + ENDWH + j%=j%+1 + i%=0+j% + ENDWH + PRINT "Open doors:", + i%=1 + WHILE i%<101 + IF door%(i%)=1 + PRINT i%, + ENDIF + i%=i%+1 + ENDWH + GET +ENDP diff --git a/Task/100-doors/Oberon/100-doors.oberon b/Task/100-doors/Oberon/100-doors.oberon deleted file mode 100644 index ddec2b2de8..0000000000 --- a/Task/100-doors/Oberon/100-doors.oberon +++ /dev/null @@ -1,27 +0,0 @@ -MODULE Doors; - IMPORT Out; - - PROCEDURE Do*; (* In Oberon an asterisk after an identifier is an export mark *) - CONST N = 100; len = N + 1; - VAR i, j: INTEGER; - closed: ARRAY len OF BOOLEAN; (* Arrays in Oberon always start with index 0; closed[0] is not used *) - BEGIN - FOR i := 1 TO N DO closed[i] := TRUE END; - FOR i := 1 TO N DO - j := 1; - WHILE j < len DO - IF j MOD i = 0 THEN closed[j] := ~closed[j] END; INC(j) (* ~ = NOT *) - END - END; - (* Print a state diagram of all doors *) - FOR i := 1 TO N DO - IF (i - 1) MOD 10 = 0 THEN Out.Ln END; - IF closed[i] THEN Out.String("- ") ELSE Out.String("+ ") END - END; Out.Ln; - (* Print the numbers of the open doors *) - FOR i := 1 TO N DO - IF ~closed[i] THEN Out.Int(i, 0); Out.Char(" ") END - END; Out.Ln - END Do; - -END Doors. diff --git a/Task/100-doors/Odin/100-doors-1.odin b/Task/100-doors/Odin/100-doors-1.odin new file mode 100644 index 0000000000..7169d3893a --- /dev/null +++ b/Task/100-doors/Odin/100-doors-1.odin @@ -0,0 +1,22 @@ +package doors + +import "core:fmt" + +main :: proc() { + doors: [100]bool + + for every_n := 1; every_n < len(doors); every_n += 1 { + i := every_n - 1 + for true { + if i >= len(doors) do break + + doors[i] = !doors[i] + + i += every_n + } + } + + for &door, i in doors { + if door do fmt.printf("%d ", i + 1) + } +} diff --git a/Task/100-doors/Odin/100-doors-2.odin b/Task/100-doors/Odin/100-doors-2.odin new file mode 100644 index 0000000000..b4fcc95bd6 --- /dev/null +++ b/Task/100-doors/Odin/100-doors-2.odin @@ -0,0 +1,24 @@ +package main + +import "core:fmt" + +main :: proc() { + using fmt + + Door_State :: enum {Closed, Open} + + doors := [?]Door_State { 0..<100 = .Closed } + + for i in 1..=100 { + for j := i-1; j < 100; j += i { + if doors[j] == .Closed { + doors[j] = .Open + } else { + doors[j] = .Closed + } + } + } + for state, i in doors { + println("Door: ",int(i+1)," -> ",state) + } +} diff --git a/Task/100-doors/Odin/100-doors-3.odin b/Task/100-doors/Odin/100-doors-3.odin new file mode 100644 index 0000000000..77e9cd99ef --- /dev/null +++ b/Task/100-doors/Odin/100-doors-3.odin @@ -0,0 +1,22 @@ +package main + +import "core:fmt" +import "core:math" + +main :: proc() { + using fmt + + Door_State :: enum {Closed, Open} + + doors := [?]Door_State { 0..<100 = .Closed } + + for i in 1..=100 { + res := math.sqrt_f64( f64(i) ) + if math.mod_f64( res, 1) == 0 { + doors[i-1] = .Open + } else { + doors[i-1] = .Closed + } + println("Door: ", i, " -> ", doors[i-1]) + } +} diff --git a/Task/100-doors/OmniMark/100-doors-1.xom b/Task/100-doors/OmniMark/100-doors-1.xom new file mode 100644 index 0000000000..8a04ae39c7 --- /dev/null +++ b/Task/100-doors/OmniMark/100-doors-1.xom @@ -0,0 +1,18 @@ +process + local switch doors size 100 ; all initialised ('1st pass' to false) + + repeat over doors + repeat for integer door from #item to 100 by #item + do when doors[door] = false + activate doors[door] ; illustrating alternative to set ... to + else + set doors[door] to false + done + again + again + + repeat over doors + do when doors = true + put #error '%d(#item)%n' + done + again diff --git a/Task/100-doors/OmniMark/100-doors-2.xom b/Task/100-doors/OmniMark/100-doors-2.xom new file mode 100644 index 0000000000..8c4bd45aa7 --- /dev/null +++ b/Task/100-doors/OmniMark/100-doors-2.xom @@ -0,0 +1,10 @@ +process + local integer door initial {1} + local integer step initial {3} + + repeat + output "Door %d(door) is open%n" + increment door by step + increment step by 2 + exit when door > 100 + again diff --git a/Task/100-doors/PL-M/100-doors.plm b/Task/100-doors/PL-M/100-doors.plm deleted file mode 100644 index 0013832477..0000000000 --- a/Task/100-doors/PL-M/100-doors.plm +++ /dev/null @@ -1,55 +0,0 @@ -100H: /* FIND THE FIRST FEW SQUARES VIA THE UNOPTIMISED DOOR FLIPPING METHOD */ - - /* BDOS SYSTEM CALL */ - BDOS: PROCEDURE( FN, ARG ); - DECLARE FN BYTE, ARG ADDRESS; - GO TO 5; - END BDOS; - - /* PRINTS A BYTE AS A CHARACTER */ - PRINT$CHAR: PROCEDURE( CH ); - DECLARE CH BYTE; - CALL BDOS( 2, CH ); - END PRINT$CHAR; - - /* PRINTS A BYTE AS A NUMBER */ - PRINT$BYTE: PROCEDURE( N ); - DECLARE N BYTE; - DECLARE ( V, D3, D2 ) BYTE; - V = N; - D3 = V MOD 10; - IF ( V := V / 10 ) <> 0 THEN DO; - D2 = V MOD 10; - IF ( V := V / 10 ) <> 0 THEN CALL PRINT$CHAR( '0' + V ); - CALL PRINT$CHAR( '0' + D2 ); - END; - CALL PRINT$CHAR( '0' + D3 ); - END PRINT$BYTE; - - DECLARE DOOR$DCL LITERALLY '101'; - DECLARE FALSE LITERALLY '0'; - DECLARE CR LITERALLY '0DH'; - DECLARE LF LITERALLY '0AH'; - - /* ARRAY OF DOORS - DOOR( I ) IS TRUE IF OPEN, FALSE IF CLOSED */ - DECLARE DOOR( DOOR$DCL ) BYTE; - DECLARE ( I, J ) BYTE; - - /* SET ALL DOORS TO CLOSED */ - DO I = 0 TO LAST( DOOR ); DOOR( I ) = FALSE; END; - /* REPEATEDLY FLIP THE DOORS */ - DO I = 1 TO LAST( DOOR ); - DO J = I TO LAST( DOOR ) BY I; - DOOR( J ) = NOT DOOR( J ); - END; - END; - /* DISPLAY THE RESULTS */ - DO I = 1 TO LAST( DOOR ); - IF DOOR( I ) THEN DO; - CALL PRINT$CHAR( ' ' ); - CALL PRINT$BYTE( I ); - END; - END; - CALL PRINT$CHAR( CR ); - CALL PRINT$CHAR( LF ); -EOF diff --git a/Task/100-doors/PascalABC.NET/100-doors.pas b/Task/100-doors/PascalABC.NET/100-doors.pas deleted file mode 100644 index fab41ed069..0000000000 --- a/Task/100-doors/PascalABC.NET/100-doors.pas +++ /dev/null @@ -1,8 +0,0 @@ -// 100 doors. Nigel Galloway: January 1th., 2023 -type doorState=(Open,Closed); -function flip(n:doorState):doorState:=if n=Open then Closed else Open; -var Doors:Array of doorState:=ArrFill(100,Closed); -begin - for var n:=1 to 100 do for var g:=n-1 to 99 step n do Doors[g]:=flip(Doors[g]); - for var n:=0 to 99 do if Doors[n]=Open then write(n+1,' '); writeLn -end. diff --git a/Task/100-doors/Plain-English/100-doors.plain b/Task/100-doors/Plain-English/100-doors.plain index f6ee5c1b2e..2ebc38ce0b 100644 --- a/Task/100-doors/Plain-English/100-doors.plain +++ b/Task/100-doors/Plain-English/100-doors.plain @@ -1,51 +1,57 @@ -To create some doors given a count: -Loop. -If a counter is past the count, exit. -Allocate memory for a door. -Clear the door's flag. -Append the door to the doors. -Repeat. - -A door is a flag thing. - -To go through some doors given a number and some passes: -Put 0 into a counter. -Loop. -Add the number to the counter. -If the counter is greater than the passes, exit. -Pick a door from the doors given the number. -Invert the door's flag. -Repeat. - -To output the states of some doors: -Loop. -Bump a counter. -Get a door from the doors. -If the door is nil, exit. -If the door's flag is set, write "Door " then the counter then " is open" to the output; repeat. -Write "Door " then the counter then " is closed" to the output. -Repeat. - -To pass doors given a count and some passes: -Create some doors given the count. -Loop. -If a counter is past the passes, break. -Go through the doors given the counter and the passes. -Repeat. -Output the states of the doors. -Destroy the doors. - +A flag list is a doubly linked list with a flag. +A door is a flag list. A pass is a number. -To pick a door from some doors given a number: -Loop. -If a counter is past the number, exit. -Get the door from the doors. -If the door is nil, exit. -Repeat. - To run: -Start up. -Pass doors given 100 and 100 passes. -Wait for the escape key. -Shut down. + Start up. + Pass doors given 1000 and 1000 passes. + Shut down. + +To pass doors given a count and some passes: + Create some doors given the count. + Loop. + Add 1 to a counter. + If the counter is greater than the passes, break. + Go through the doors given the counter and the passes. + Repeat. + Output the states of the doors. + Destroy the doors. + +To create some doors given a count: + Loop. + Add 1 to a counter. + If the counter is greater than the count, exit. + Allocate memory for a door. + Clear the door's flag. + Append the door to the doors. + Repeat. + +To go through some doors given a number and some passes: + Put 0 into a counter. + Loop. + Add the number to the counter. + If the counter is greater than the passes, exit. + Pick a door from the doors given the number. + Invert the door's flag. + Repeat. + +To pick a door from some doors given a number: + Loop. + Add 1 to a counter. + If the counter is greater than the number, exit. + Get the door from the doors. + If the door is nil, exit. + Repeat. + +To output the states of some doors: + Loop. + Bump a counter. + Get a door from the doors. + If the door is nil, exit. + If the door's flag is set, + Write "Door " then the counter then " is open" + then the CRLF string to StdOut; + Repeat. + \Write "Door " then the counter then " is closed" + \then the CRLF string to StdOut. + Repeat. diff --git a/Task/100-doors/PowerShell/100-doors-1.psh b/Task/100-doors/PowerShell/100-doors-1.ps1 similarity index 100% rename from Task/100-doors/PowerShell/100-doors-1.psh rename to Task/100-doors/PowerShell/100-doors-1.ps1 diff --git a/Task/100-doors/PowerShell/100-doors-2.psh b/Task/100-doors/PowerShell/100-doors-2.ps1 similarity index 100% rename from Task/100-doors/PowerShell/100-doors-2.psh rename to Task/100-doors/PowerShell/100-doors-2.ps1 diff --git a/Task/100-doors/PowerShell/100-doors-3.psh b/Task/100-doors/PowerShell/100-doors-3.ps1 similarity index 100% rename from Task/100-doors/PowerShell/100-doors-3.psh rename to Task/100-doors/PowerShell/100-doors-3.ps1 diff --git a/Task/100-doors/PowerShell/100-doors-4.psh b/Task/100-doors/PowerShell/100-doors-4.ps1 similarity index 100% rename from Task/100-doors/PowerShell/100-doors-4.psh rename to Task/100-doors/PowerShell/100-doors-4.ps1 diff --git a/Task/100-doors/PowerShell/100-doors-5.psh b/Task/100-doors/PowerShell/100-doors-5.ps1 similarity index 100% rename from Task/100-doors/PowerShell/100-doors-5.psh rename to Task/100-doors/PowerShell/100-doors-5.ps1 diff --git a/Task/100-doors/PowerShell/100-doors-6.psh b/Task/100-doors/PowerShell/100-doors-6.ps1 similarity index 100% rename from Task/100-doors/PowerShell/100-doors-6.psh rename to Task/100-doors/PowerShell/100-doors-6.ps1 diff --git a/Task/100-doors/PowerShell/100-doors-7.psh b/Task/100-doors/PowerShell/100-doors-7.ps1 similarity index 100% rename from Task/100-doors/PowerShell/100-doors-7.psh rename to Task/100-doors/PowerShell/100-doors-7.ps1 diff --git a/Task/100-doors/Pyret/100-doors.pyret b/Task/100-doors/Pyret/100-doors.arr similarity index 100% rename from Task/100-doors/Pyret/100-doors.pyret rename to Task/100-doors/Pyret/100-doors.arr diff --git a/Task/100-doors/Python/100-doors-5.py b/Task/100-doors/Python/100-doors-5.py index c3f39a49a6..96e57804d7 100644 --- a/Task/100-doors/Python/100-doors-5.py +++ b/Task/100-doors/Python/100-doors-5.py @@ -1,6 +1,2 @@ for i in range(1, 101): - if i**0.5 % 1: - state='closed' - else: - state='open' - print("Door {}:{}".format(i, state)) + print(f"Door {i}:{"closed" if i**0.5 % 1 else "open"}") diff --git a/Task/100-doors/Python/100-doors-6.py b/Task/100-doors/Python/100-doors-6.py index 55126dde74..b42230ac44 100644 --- a/Task/100-doors/Python/100-doors-6.py +++ b/Task/100-doors/Python/100-doors-6.py @@ -1 +1 @@ -for i in range(1,101): print("Door %s is open" % i**2) +for i in range(1,11): print(f"Door {i**2} is open") diff --git a/Task/100-doors/Quackery/100-doors-1.quackery b/Task/100-doors/Quackery/100-doors-1.quackery new file mode 100644 index 0000000000..e3d105d0cd --- /dev/null +++ b/Task/100-doors/Quackery/100-doors-1.quackery @@ -0,0 +1,17 @@ + [ bit ^ ] is toggle ( f n --> f ) + + [ 0 + 100 times + [ i^ 1+ swap + 101 times + [ i^ toggle over step ] + nip ] ] is toggledoors ( --> f ) + + [ 100 times + [ 1 >> dup 1 & + if [ i^ 1+ echo sp ] ] + drop ] is echodoors ( f --> ) + + toggledoors + say " These doors are open: " echodoors cr + say " The rest are closed." cr diff --git a/Task/100-doors/Quackery/100-doors-2.quackery b/Task/100-doors/Quackery/100-doors-2.quackery new file mode 100644 index 0000000000..85074cd60f --- /dev/null +++ b/Task/100-doors/Quackery/100-doors-2.quackery @@ -0,0 +1 @@ + 10 times [ i^ 1+ 2 ** echo sp ] diff --git a/Task/100-doors/Quackery/100-doors.quackery b/Task/100-doors/Quackery/100-doors.quackery deleted file mode 100644 index 5577d1c6c4..0000000000 --- a/Task/100-doors/Quackery/100-doors.quackery +++ /dev/null @@ -1,22 +0,0 @@ -/O> [ bit ^ ] is toggle ( f n --> f ) -... -... [ 0 -... 100 times -... [ i^ 1+ swap -... 101 times -... [ i^ toggle over step ] -... nip ] ] is toggledoors ( --> f ) -... -... [ 100 times -... [ 1 >> dup 1 & -... if [ i^ 1+ echo sp ] ] -... drop ] is echodoors ( f --> ) -... -... toggledoors -... say " These doors are open: " echodoors cr -... say " The rest are closed." cr -... - These doors are open: 1 4 9 16 25 36 49 64 81 100 - The rest are closed. - -Stack empty. diff --git a/Task/100-doors/Quite-BASIC/100-doors.basic b/Task/100-doors/Quite-BASIC/100-doors-1.basic similarity index 100% rename from Task/100-doors/Quite-BASIC/100-doors.basic rename to Task/100-doors/Quite-BASIC/100-doors-1.basic diff --git a/Task/100-doors/TUSCRIPT/100-doors-2.tu b/Task/100-doors/Quite-BASIC/100-doors-2.basic similarity index 100% rename from Task/100-doors/TUSCRIPT/100-doors-2.tu rename to Task/100-doors/Quite-BASIC/100-doors-2.basic diff --git a/Task/100-doors/REBOL/100-doors-2.rebol b/Task/100-doors/REBOL/100-doors-2.rebol deleted file mode 100644 index 73f1f448f3..0000000000 --- a/Task/100-doors/REBOL/100-doors-2.rebol +++ /dev/null @@ -1,2 +0,0 @@ -doors: array/initial 100 'closed -repeat i 10 [doors/(i * i): 'open] diff --git a/Task/100-doors/REBOL/100-doors-1.rebol b/Task/100-doors/Rebol/100-doors-1.rebol similarity index 100% rename from Task/100-doors/REBOL/100-doors-1.rebol rename to Task/100-doors/Rebol/100-doors-1.rebol diff --git a/Task/100-doors/Rebol/100-doors-2.rebol b/Task/100-doors/Rebol/100-doors-2.rebol new file mode 100644 index 0000000000..b8428a69d9 --- /dev/null +++ b/Task/100-doors/Rebol/100-doors-2.rebol @@ -0,0 +1,26 @@ +;; Create a bitset with capacity for 100 bits (representing 100 doors) +;; Each bit represents a door state: 0 = closed, 1 = open +doors: make bitset! 100 + +;; Outer loop: Make 100 passes (i = 1 to 100) +repeat i 100 [ + ;; Inner loop: Check each door position (j = 1 to 100) + repeat j 100 [ + ;; If door j index is divisible by pass number i (no remainder) + if zero? (j // i) [ + ;; Toggle the door's bit: + ;; doors/:j accesses door j in the bitset + ;; 'not' flips the bit value (0 -> 1, 1 -> 0) + doors/:j: not doors/:j + ] + ] +] + +;; Final loop: Check which doors are open, print their numbers +repeat i 100 [ + ;; If door i's bit is set (open) + if doors/:i [ + ;; Print the door's number and that it is open + print ["door" i "is open"] + ] +] diff --git a/Task/100-doors/Rebol/100-doors-3.rebol b/Task/100-doors/Rebol/100-doors-3.rebol new file mode 100644 index 0000000000..318cdd4a11 --- /dev/null +++ b/Task/100-doors/Rebol/100-doors-3.rebol @@ -0,0 +1,6 @@ +;; Loop variable i from 1 to 10 (since 10^2 = 100, covers doors 1 to 100) +repeat i 10 [ + ;; Print that door number (i squared) is open + ;; These are exactly the doors with perfect square numbers: 1, 4, 9, ..., 100 + print ["door" (i * i) "is open"] +] diff --git a/Task/100-doors/Refal/100-doors.refal b/Task/100-doors/Refal/100-doors.refal new file mode 100644 index 0000000000..027ee823a1 --- /dev/null +++ b/Task/100-doors/Refal/100-doors.refal @@ -0,0 +1,38 @@ +$ENTRY Go { + = >>; +}; + +NDoors { = 100; }; +Doors { = Closed>; }; + +Repeat { + 0 s.val = ; + s.N s.val = s.val s.val> ; +}; + +Toggle { + 1 Closed e.rest = Open e.rest; + 1 Open e.rest = Closed e.rest; + s.N s.door e.rest = s.door e.rest>; +}; + +Pass { + s.pass s.door e.doors, >: '+' + = e.doors; + s.pass s.door e.doors + = >; +}; + +Walk { + s.pass e.doors, >: '+' + = e.doors; + s.pass e.doors + = >; +}; + +Show { + s.N Open e.rest = + e.rest>; + s.N Closed e.rest = e.rest>; + s.N = ; +}; diff --git a/Task/100-doors/Coq/100-doors-1.coq b/Task/100-doors/Rocq/100-doors-1.rocq similarity index 100% rename from Task/100-doors/Coq/100-doors-1.coq rename to Task/100-doors/Rocq/100-doors-1.rocq diff --git a/Task/100-doors/Coq/100-doors-2.coq b/Task/100-doors/Rocq/100-doors-2.rocq similarity index 100% rename from Task/100-doors/Coq/100-doors-2.coq rename to Task/100-doors/Rocq/100-doors-2.rocq diff --git a/Task/100-doors/Coq/100-doors-3.coq b/Task/100-doors/Rocq/100-doors-3.rocq similarity index 100% rename from Task/100-doors/Coq/100-doors-3.coq rename to Task/100-doors/Rocq/100-doors-3.rocq diff --git a/Task/100-doors/Coq/100-doors-4.coq b/Task/100-doors/Rocq/100-doors-4.rocq similarity index 100% rename from Task/100-doors/Coq/100-doors-4.coq rename to Task/100-doors/Rocq/100-doors-4.rocq diff --git a/Task/100-doors/Rust/100-doors-1.rust b/Task/100-doors/Rust/100-doors-1.rs similarity index 100% rename from Task/100-doors/Rust/100-doors-1.rust rename to Task/100-doors/Rust/100-doors-1.rs diff --git a/Task/100-doors/Rust/100-doors-2.rust b/Task/100-doors/Rust/100-doors-2.rs similarity index 100% rename from Task/100-doors/Rust/100-doors-2.rust rename to Task/100-doors/Rust/100-doors-2.rs diff --git a/Task/100-doors/Rust/100-doors-3.rust b/Task/100-doors/Rust/100-doors-3.rs similarity index 100% rename from Task/100-doors/Rust/100-doors-3.rust rename to Task/100-doors/Rust/100-doors-3.rs diff --git a/Task/100-doors/Rust/100-doors-4.rust b/Task/100-doors/Rust/100-doors-4.rs similarity index 100% rename from Task/100-doors/Rust/100-doors-4.rust rename to Task/100-doors/Rust/100-doors-4.rs diff --git a/Task/100-doors/Rye/100-doors.rye b/Task/100-doors/Rye/100-doors.rye new file mode 100644 index 0000000000..1bd595c1c9 --- /dev/null +++ b/Task/100-doors/Rye/100-doors.rye @@ -0,0 +1,8 @@ +replicate 100 { false } +|walk\pos 'p { + .map\pos 'r { ::d , + either r .is-multiple-of p { not d } { d } } + |at p } +|map\pos 'p { .either { p } { false } } +|filter { .is-integer } +|for { .embed "Door {} is open." |print } diff --git a/Task/100-doors/Scheme/100-doors-1.ss b/Task/100-doors/Scheme/100-doors-1.scm similarity index 100% rename from Task/100-doors/Scheme/100-doors-1.ss rename to Task/100-doors/Scheme/100-doors-1.scm diff --git a/Task/100-doors/Scheme/100-doors-2.ss b/Task/100-doors/Scheme/100-doors-2.scm similarity index 100% rename from Task/100-doors/Scheme/100-doors-2.ss rename to Task/100-doors/Scheme/100-doors-2.scm diff --git a/Task/100-doors/Scheme/100-doors-3.ss b/Task/100-doors/Scheme/100-doors-3.scm similarity index 100% rename from Task/100-doors/Scheme/100-doors-3.ss rename to Task/100-doors/Scheme/100-doors-3.scm diff --git a/Task/100-doors/Scheme/100-doors-4.scm b/Task/100-doors/Scheme/100-doors-4.scm new file mode 100644 index 0000000000..a65ab0f484 --- /dev/null +++ b/Task/100-doors/Scheme/100-doors-4.scm @@ -0,0 +1,17 @@ +(define (doors-toggle door-state) + (define (doors-toggle-helper door-state num-doors step counter) + (cond ((> step num-doors) door-state) + ((> counter (1- num-doors)) + (doors-toggle-helper door-state num-doors (1+ step) step)) + (else (vector-set! door-state + counter + (not (array-ref door-state counter))) + (doors-toggle-helper door-state + num-doors + step + (+ step counter))))) + (let ((step 1) + (num-doors (vector-length door-state))) + (doors-toggle-helper door-state num-doors step (1- step)))) + +(doors-toggle (make-vector 100 #f)) ;; #t is an open door, #f a closed one diff --git a/Task/100-doors/Stringle/100-doors.stringle b/Task/100-doors/Stringle/100-doors.stringle new file mode 100644 index 0000000000..93035308c5 --- /dev/null +++ b/Task/100-doors/Stringle/100-doors.stringle @@ -0,0 +1,15 @@ +d "." +#d +i d +#i +p "door" #i +*p *p "." +i d f "oc" +i d #@f #*p +i d .\f "o" $ #i +i i d +#i +101 i "" +#i +d d "." +#d +101 d "" +#d diff --git a/Task/100-doors/Swift/100-doors-3.swift b/Task/100-doors/Swift/100-doors-3.swift new file mode 100644 index 0000000000..05cf5c8d51 --- /dev/null +++ b/Task/100-doors/Swift/100-doors-3.swift @@ -0,0 +1 @@ +var arr: [Bool] = Array(1...100).map{ remquo(exp(log(Float($0))/2.0),1).0 == 0 } diff --git a/Task/100-doors/TUSCRIPT/100-doors-1.tu b/Task/100-doors/TUSCRIPT/100-doors.tu similarity index 100% rename from Task/100-doors/TUSCRIPT/100-doors-1.tu rename to Task/100-doors/TUSCRIPT/100-doors.tu diff --git a/Task/100-doors/Tailspin/100-doors-1.tailspin b/Task/100-doors/Tailspin/100-doors-1.tailspin new file mode 100644 index 0000000000..3a2f81f4c2 --- /dev/null +++ b/Task/100-doors/Tailspin/100-doors-1.tailspin @@ -0,0 +1,14 @@ +source hundredDoors + @: [ 1..100 -> 0 ]; + templates toggle + def jump: $; + $jump..100:$jump -> \( + when )> do @hundredDoors($): 1; + otherwise @hundredDoors($): 0; + \) -> !VOID + end toggle + 1..100 -> toggle -> !VOID + $@ -> \[i](<=1> ' $i;' !\) ! +end hundredDoors + +$hundredDoors -> 'Open doors:$...;' -> !OUT::write diff --git a/Task/100-doors/Tailspin/100-doors-2.tailspin b/Task/100-doors/Tailspin/100-doors-2.tailspin new file mode 100644 index 0000000000..fb29ae1395 --- /dev/null +++ b/Task/100-doors/Tailspin/100-doors-2.tailspin @@ -0,0 +1,14 @@ +hundredDoors source + @ set [ 1..100 -> 0 ]; + toggle templates + jump is $; + $jump..100:$jump -> templates + when <|?($@hundredDoors($) matches <|=0>)> do @hundredDoors($) set 1; + otherwise @hundredDoors($) set 0; + end -> !VOID + end toggle + 1..100 -> toggle -> !VOID + $@(.. as i; -> if <|=1> -> ' $i;') ! +end hundredDoors + +$hundredDoors -> 'Open doors:$...;' ! diff --git a/Task/100-doors/Tailspin/100-doors.tailspin b/Task/100-doors/Tailspin/100-doors.tailspin deleted file mode 100644 index 8ea97723d3..0000000000 --- a/Task/100-doors/Tailspin/100-doors.tailspin +++ /dev/null @@ -1,11 +0,0 @@ -source hundredDoors - @: [ 1..100 -> 0 ]; - templates toggle - def jump: $; - $jump..100:$jump -> \(when )> do @hundredDoors($): 1; otherwise @hundredDoors($): 0;\) -> !VOID - end toggle - 1..100 -> toggle -> !VOID - $@ -> \[i](<=1> ' $i;' !\) ! -end hundredDoors - -$hundredDoors -> 'Open doors:$...;' -> !OUT::write diff --git a/Task/100-doors/Tcl/100-doors-1.tcl b/Task/100-doors/Tcl/100-doors-1.tcl index 43badf3380..71a614db6d 100644 --- a/Task/100-doors/Tcl/100-doors-1.tcl +++ b/Task/100-doors/Tcl/100-doors-1.tcl @@ -1,11 +1,85 @@ -package require Tcl 8.5 -set n 100 -set doors [concat - [lrepeat $n 0]] -for {set step 1} {$step <= $n} {incr step} { - for {set i $step} {$i <= $n} {incr i $step} { - lset doors $i [expr { ! [lindex $doors $i]}] +#!/usr/bin/env tclsh + +# 100 doors + +proc seq { m n } { + set r {} + for {set i $m} {$i <= $n} {incr i} { + lappend r $i + } + return $r +} + +proc toggle {val a b} { + # expr has ternary operators + return [expr { + ${val} == ${a}? ${b} : + ${val} == ${b}? ${a} : + [error "bad value: ${val}"] + }] +} + +proc multiples {n max} { + set ret {} + set x $n + + # maximum multiple + set mid [expr $max / 2] + + if {$x>=$mid && $x<$max} { return $x } + + # calculate multiples + if {[expr $x <= $mid]} { + for {set i 1} {$i <= $max } {incr i} { + + set x [expr $i * $n] + + if {$x > $max} { break } + + lappend ret $x + } + } + + return $ret +} + +# states +array set state { + open "open" + closed "closed" + unknown "?" +} + +# ============================== +# start program + +# 100 doors +variable MAX 100 + +variable mid [expr int($MAX / 2)] + +variable Seq_100 [seq 1 $MAX] + +# initialize doors closed +foreach n $Seq_100 { + set door($n) $state(closed) +} + +# do for 1 .. 100 +foreach m $Seq_100 { + + set mults [multiples $m $MAX] + + foreach d $mults { + set door($d) [toggle $door($d) $state(open) $state(closed)] } } -for {set i 1} {$i <= $n} {incr i} { - puts [format "door %d is %s" $i [expr {[lindex $doors $i] ? "open" : "closed"}]] + +# output +foreach n $Seq_100 { + if { $door($n) eq $state(open) } { + puts stdout "$n: $door($n)" + } } + +# end diff --git a/Task/100-doors/Tcl/100-doors-2.tcl b/Task/100-doors/Tcl/100-doors-2.tcl index df7078d750..43badf3380 100644 --- a/Task/100-doors/Tcl/100-doors-2.tcl +++ b/Task/100-doors/Tcl/100-doors-2.tcl @@ -1,8 +1,11 @@ package require Tcl 8.5 -set doors [lrepeat [expr {$n + 1}] closed] -for {set i 1} {$i <= sqrt($n)} {incr i} { - lset doors [expr {$i ** 2}] open +set n 100 +set doors [concat - [lrepeat $n 0]] +for {set step 1} {$step <= $n} {incr step} { + for {set i $step} {$i <= $n} {incr i $step} { + lset doors $i [expr { ! [lindex $doors $i]}] + } } for {set i 1} {$i <= $n} {incr i} { - puts [format "door %d is %s" $i [lindex $doors $i]] + puts [format "door %d is %s" $i [expr {[lindex $doors $i] ? "open" : "closed"}]] } diff --git a/Task/100-doors/Tcl/100-doors-3.tcl b/Task/100-doors/Tcl/100-doors-3.tcl index 8e3db5488e..df7078d750 100644 --- a/Task/100-doors/Tcl/100-doors-3.tcl +++ b/Task/100-doors/Tcl/100-doors-3.tcl @@ -1,46 +1,8 @@ package require Tcl 8.5 -package require Tk - -array set door_status {} - -# create the gui -set doors [list x] -for {set i 0} {$i < 10} {incr i} { - for {set j 0} {$j < 10} {incr j} { - set k [expr {1 + $j + 10*$i}] - lappend doors [radiobutton .d_$k -text $k -variable door_status($k) \ - -indicatoron no -offrelief flat -width 3 -value open] - grid [lindex $doors $k] -column $j -row $i - } +set doors [lrepeat [expr {$n + 1}] closed] +for {set i 1} {$i <= sqrt($n)} {incr i} { + lset doors [expr {$i ** 2}] open } - -# create the controls -button .start -command go -text Start -label .i_label -text " door:" -entry .i -textvariable i -width 4 -label .step_label -text " step:" -entry .step -textvariable step -width 4 -grid .start - .i_label - .i - .step_label - .step - -row $i -grid configure .start -sticky ew -grid configure .i_label .step_label -sticky e -grid configure .i .step -sticky w - -proc go {} { - global doors door_status i step - - # initialize the door_status (all closed) - for {set d 1} {$d <= 100} {incr d} { - set door_status($d) closed - } - - # now, begin opening and closing - for {set step 1} {$step <= 100} {incr step} { - for {set i 1} {$i <= 100} {incr i} { - if {$i % $step == 0} { - [lindex $doors $i] [expr {$door_status($i) eq "open" ? "deselect" : "select"}] - update - after 50 - } - } - } +for {set i 1} {$i <= $n} {incr i} { + puts [format "door %d is %s" $i [lindex $doors $i]] } diff --git a/Task/100-doors/Tcl/100-doors-4.tcl b/Task/100-doors/Tcl/100-doors-4.tcl new file mode 100644 index 0000000000..8e3db5488e --- /dev/null +++ b/Task/100-doors/Tcl/100-doors-4.tcl @@ -0,0 +1,46 @@ +package require Tcl 8.5 +package require Tk + +array set door_status {} + +# create the gui +set doors [list x] +for {set i 0} {$i < 10} {incr i} { + for {set j 0} {$j < 10} {incr j} { + set k [expr {1 + $j + 10*$i}] + lappend doors [radiobutton .d_$k -text $k -variable door_status($k) \ + -indicatoron no -offrelief flat -width 3 -value open] + grid [lindex $doors $k] -column $j -row $i + } +} + +# create the controls +button .start -command go -text Start +label .i_label -text " door:" +entry .i -textvariable i -width 4 +label .step_label -text " step:" +entry .step -textvariable step -width 4 +grid .start - .i_label - .i - .step_label - .step - -row $i +grid configure .start -sticky ew +grid configure .i_label .step_label -sticky e +grid configure .i .step -sticky w + +proc go {} { + global doors door_status i step + + # initialize the door_status (all closed) + for {set d 1} {$d <= 100} {incr d} { + set door_status($d) closed + } + + # now, begin opening and closing + for {set step 1} {$step <= 100} {incr step} { + for {set i 1} {$i <= 100} {incr i} { + if {$i % $step == 0} { + [lindex $doors $i] [expr {$door_status($i) eq "open" ? "deselect" : "select"}] + update + after 50 + } + } + } +} diff --git a/Task/100-doors/Tiny-Craft-Basic/100-doors.basic b/Task/100-doors/Tiny-Craft-Basic/100-doors.basic deleted file mode 100644 index 2d31cb60f7..0000000000 --- a/Task/100-doors/Tiny-Craft-Basic/100-doors.basic +++ /dev/null @@ -1,9 +0,0 @@ -10 rem loop - - 20 let i = i + 1 - 30 print i * i, " open" - -40 if i * i < 100 then 10 - -50 shell "pause" -60 end diff --git a/Task/100-doors/Uiua/100-doors-1.uiua b/Task/100-doors/Uiua/100-doors-1.uiua new file mode 100644 index 0000000000..a9b6f157a4 --- /dev/null +++ b/Task/100-doors/Uiua/100-doors-1.uiua @@ -0,0 +1,6 @@ +◿2/+=0⊞◿.+1⇡100 + +1⇡100 # 1-100 + ⊞◿. # Mod each with 1-100 + =0 # Find where mod = 0, aka the divisors + /+ # Sum to get num of divisors +◿2 # Num divisors is odd diff --git a/Task/100-doors/Uiua/100-doors-2.uiua b/Task/100-doors/Uiua/100-doors-2.uiua new file mode 100644 index 0000000000..c1e094976b --- /dev/null +++ b/Task/100-doors/Uiua/100-doors-2.uiua @@ -0,0 +1 @@ +⊜∘/≠±⊞◿..+1⇡100 diff --git a/Task/100-doors/Uiua/100-doors-3.uiua b/Task/100-doors/Uiua/100-doors-3.uiua new file mode 100644 index 0000000000..35552aab2a --- /dev/null +++ b/Task/100-doors/Uiua/100-doors-3.uiua @@ -0,0 +1 @@ +×.+1⇡⌊√ 100 diff --git a/Task/100-doors/Unison/100-doors.unison b/Task/100-doors/Unison/100-doors.u similarity index 100% rename from Task/100-doors/Unison/100-doors.unison rename to Task/100-doors/Unison/100-doors.u diff --git a/Task/100-doors/V-(Vlang)/100-doors-2.v b/Task/100-doors/V-(Vlang)/100-doors-2.v index 6ec392d9a6..35ff929ac5 100644 --- a/Task/100-doors/V-(Vlang)/100-doors-2.v +++ b/Task/100-doors/V-(Vlang)/100-doors-2.v @@ -11,11 +11,10 @@ fn main(){ doors[current - 1] = true increment++ door_nbr += 2 * increment + 1 - } + print('O') + } else { + print('=') + } } - doors.map( fn( it bool) bool { // graphically represent opened doors - print( if it {( 'O')} else {('=')} ) - return it - }) println('') } diff --git a/Task/100-doors/V-(Vlang)/100-doors-3.v b/Task/100-doors/V-(Vlang)/100-doors-3.v new file mode 100644 index 0000000000..8f720ebff3 --- /dev/null +++ b/Task/100-doors/V-(Vlang)/100-doors-3.v @@ -0,0 +1,11 @@ +import math + +const number_doors = 101 + +fn main() { + max_i := int(math.sqrt(f64(number_doors - 1))) + 1 + for i in 1..max_i { + door := i * i + println("Door ${door} open") + } +} diff --git a/Task/100-doors/V-(Vlang)/100-doors-4.v b/Task/100-doors/V-(Vlang)/100-doors-4.v new file mode 100644 index 0000000000..bce04b6c59 --- /dev/null +++ b/Task/100-doors/V-(Vlang)/100-doors-4.v @@ -0,0 +1,5 @@ +fn main() { + for i in 1..11 { + print ( " Door ${i*i} is open.\n" ) + } +} diff --git a/Task/100-doors/VBScript/100-doors.vb b/Task/100-doors/VBScript/100-doors.vbs similarity index 100% rename from Task/100-doors/VBScript/100-doors.vb rename to Task/100-doors/VBScript/100-doors.vbs diff --git a/Task/100-doors/VHDL/100-doors-1.vhdl b/Task/100-doors/VHDL/100-doors-1.vhd similarity index 100% rename from Task/100-doors/VHDL/100-doors-1.vhdl rename to Task/100-doors/VHDL/100-doors-1.vhd diff --git a/Task/100-doors/VHDL/100-doors-2.vhdl b/Task/100-doors/VHDL/100-doors-2.vhd similarity index 100% rename from Task/100-doors/VHDL/100-doors-2.vhdl rename to Task/100-doors/VHDL/100-doors-2.vhd diff --git a/Task/100-doors/YAMLScript/100-doors.ys b/Task/100-doors/YAMLScript/100-doors.ys new file mode 100644 index 0000000000..7e63c2a67d --- /dev/null +++ b/Task/100-doors/YAMLScript/100-doors.ys @@ -0,0 +1,14 @@ +!YS-v0 + +defn main(): + open =: + reduce _ vec([true] * 100) (1 .. 100): + fn(doors i): + loop j i, doors doors: + if j < 100: + recur (j + i).++: + update-in doors [j]: \(doors.$j.!) + else: doors + say: -"Open doors after 100 passes:\ " + + (1 .. 100).map(\(_.--:open && _)) + .filter(a).join(', ') diff --git a/Task/100-doors/Zig/100-doors-4.zig b/Task/100-doors/Zig/100-doors-4.zig index 53b792a533..14d911f591 100644 --- a/Task/100-doors/Zig/100-doors-4.zig +++ b/Task/100-doors/Zig/100-doors-4.zig @@ -1,8 +1,7 @@ pub fn main() !void { const stdout = @import("std").io.getStdOut().writer(); - var door: u8 = 1; - while (door * door <= 100) : (door += 1) { + for(1..11) |door| { try stdout.print("Door {d} is open\n", .{door * door}); } } diff --git a/Task/100-prisoners/11l/100-prisoners.11l b/Task/100-prisoners/11l/100-prisoners.11l index f8e57ab878..0bacfb4489 100644 --- a/Task/100-prisoners/11l/100-prisoners.11l +++ b/Task/100-prisoners/11l/100-prisoners.11l @@ -5,7 +5,7 @@ F play_random(n) L 0 .< n random:shuffle(&in_drawer) V found = 0B - L(prisoner) 100 + L(prisoner) 0.<100 found = 0B L(reveal) random:sample(sampler, 50) V card = in_drawer[reveal] @@ -24,7 +24,7 @@ F play_optimal(n) L 0 .< n random:shuffle(&in_drawer) V found = 0B - L(prisoner) 100 + L(prisoner) 0.<100 V reveal = prisoner found = 0B L 50 diff --git a/Task/100-prisoners/ABC/100-prisoners.abc b/Task/100-prisoners/ABC/100-prisoners.abc new file mode 100644 index 0000000000..0e2c8d9853 --- /dev/null +++ b/Task/100-prisoners/ABC/100-prisoners.abc @@ -0,0 +1,40 @@ +HOW TO FILL drawers: + PUT {} IN drawers + FOR i IN {1..100}: PUT i IN drawers[i] + FOR i IN {1..100}: + PUT choice {i..100} IN j + PUT drawers[i], drawers[j] IN drawers[j], drawers[i] + +HOW TO REPORT prisoner random.strat drawers: + PUT {1..100} IN available + FOR turn IN {1..50}: + PUT choice available IN drawer + IF drawers[drawer] = prisoner: SUCCEED + REMOVE drawer FROM available + FAIL + +HOW TO REPORT prisoner optimal.strat drawers: + PUT prisoner IN drawer + FOR turn IN {1..50}: + IF drawers[drawer] = prisoner: SUCCEED + PUT drawers[drawer] IN drawer + FAIL + +HOW TO REPORT simulate strategy: + FILL drawers + FOR prisoner IN {1..100}: + SELECT: + strategy = "Random": + IF NOT prisoner random.strat drawers: FAIL + strategy = "Optimal": + IF NOT prisoner optimal.strat drawers: FAIL + SUCCEED + +HOW TO RETURN n.sim chance.of.success strategy: + PUT 0 IN success + FOR n IN {1..n.sim}: + IF simulate strategy: PUT success+1 IN success + RETURN success * 100 / n.sim + +FOR strategy IN {"Random"; "Optimal"}: + WRITE strategy, ": ", 10000 chance.of.success strategy, '%'/ diff --git a/Task/100-prisoners/ALGOL-68/100-prisoners.alg b/Task/100-prisoners/ALGOL-68/100-prisoners.alg new file mode 100644 index 0000000000..e8858ff506 --- /dev/null +++ b/Task/100-prisoners/ALGOL-68/100-prisoners.alg @@ -0,0 +1,66 @@ +BEGIN # 100 prisoners # + +CO begin code from the Knuth shuffle task CO +PROC between = (INT a, b)INT : +( + ENTIER (random * ABS (b-a+1) + (a ?n 1) do + (bind ?k (+ 1 (random ?n))) + (bind ?tmp (nth$ ?n ?lst)) + (bind ?lst (replace$ ?lst ?n ?n (nth$ ?k ?lst))) + (bind ?lst (replace$ ?lst ?k ?k ?tmp)) + (bind ?n (- ?n 1))) + ?lst) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Create a random permutation of 1..100 representing box contents +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(deffunction random-permutation () + (shuffle (create$ 1 2 3 4 5 6 7 8 9 10 + 11 12 13 14 15 16 17 18 19 20 + 21 22 23 24 25 26 27 28 29 30 + 31 32 33 34 35 36 37 38 39 40 + 41 42 43 44 45 46 47 48 49 50 + 51 52 53 54 55 56 57 58 59 60 + 61 62 63 64 65 66 67 68 69 70 + 71 72 73 74 75 76 77 78 79 80 + 81 82 83 84 85 86 87 88 89 90 + 91 92 93 94 95 96 97 98 99 100))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Prisoner loop strategy: +;; Start at your own number, open that box, then follow the chain. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(deffunction prisoner-succeeds (?id ?perm) + (bind ?next ?id) + (bind ?opens 0) + (while (< ?opens MAX-OPENS) do + (bind ?opens (+ ?opens 1)) + (bind ?found (nth$ ?next ?perm)) + (if (= ?found ?id) then + (return TRUE)) + (bind ?next ?found)) + FALSE) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Run one full trial: all prisoners must succeed +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(deffunction run-trial () + (bind ?perm (random-permutation)) + (foreach ?p (create$ 1 to NUM-PRISONERS) do + (if (not (prisoner-succeeds ?p ?perm)) then + (return FALSE))) + TRUE) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Run many trials to estimate probability +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(deffunction simulate (?trials) + (bind ?wins 0) + (loop-for-count (?i 1 ?trials) do + (if (run-trial) then + (bind ?wins (+ ?wins 1)))) + (printout t "Trials: " ?trials crlf) + (printout t "Successful trials: " ?wins crlf) + (printout t "Estimated probability: " + (/ (float ?wins) (float ?trials)) crlf)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Entry point +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(reset) +(simulate 1000) diff --git a/Task/100-prisoners/Crystal/100-prisoners.crystal b/Task/100-prisoners/Crystal/100-prisoners.cr similarity index 100% rename from Task/100-prisoners/Crystal/100-prisoners.crystal rename to Task/100-prisoners/Crystal/100-prisoners.cr diff --git a/Task/100-prisoners/D/100-prisoners.d b/Task/100-prisoners/D/100-prisoners.d index 04986ae37c..5c70291510 100644 --- a/Task/100-prisoners/D/100-prisoners.d +++ b/Task/100-prisoners/D/100-prisoners.d @@ -37,7 +37,7 @@ bool playRandom() { double exec(const size_t n, bool function() play) { size_t success = 0; - for (int i = n; i > 0; i--) { + for (size_t i = n; i > 0; i--) { if (play()) { success++; } diff --git a/Task/100-prisoners/Dart/100-prisoners.dart b/Task/100-prisoners/Dart/100-prisoners.dart new file mode 100644 index 0000000000..50b228d4d0 --- /dev/null +++ b/Task/100-prisoners/Dart/100-prisoners.dart @@ -0,0 +1,67 @@ +import 'dart:math'; + +int playRandom(int n) { + var rnd = Random(); + int pardoned = 0; + List inDrawer = List.generate(100, (i) => i); + List sampler = List.generate(100, (i) => i); + for (int round = 0; round < n; round++) { + inDrawer.shuffle(); + bool found = false; + for (int prisoner = 0; prisoner < 100; prisoner++) { + found = false; + sampler.shuffle(rnd); + for (int i = 0; i < 50; i++) { + int reveal = sampler[i]; + int card = inDrawer[reveal]; + if (card == prisoner) { + found = true; + break; + } + } + if (!found) { + break; + } + } + if (found) { + pardoned++; + } + } + return (pardoned / n * 100).round(); +} + +int playOptimal(int n) { + var rnd = Random(); + int pardoned = 0; + bool found = false; + List inDrawer = List.generate(100, (i) => i); + for (int round = 0; round < n; round++) { + inDrawer.shuffle(rnd); + for (int prisoner = 0; prisoner < 100; prisoner++) { + int reveal = prisoner; + found = false; + for (int go = 0; go < 50; go++) { + int card = inDrawer[reveal]; + if (card == prisoner) { + found = true; + break; + } + reveal = card; + } + if (!found) { + break; + } + } + if (found) { + pardoned++; + } + } + return (pardoned / n * 100).round(); +} + +void main() { + int n = 100000; + print(" Simulation count: $n"); + print(" Random play wins: ${playRandom(n).toStringAsFixed(2)}% of simulations"); + print("Optimal play wins: ${playOptimal(n).toStringAsFixed(2)}% of simulations"); +} diff --git a/Task/100-prisoners/EasyLang/100-prisoners.easy b/Task/100-prisoners/EasyLang/100-prisoners.easy index 3435445f04..d43959b394 100644 --- a/Task/100-prisoners/EasyLang/100-prisoners.easy +++ b/Task/100-prisoners/EasyLang/100-prisoners.easy @@ -1,60 +1,51 @@ -for i = 1 to 100 - drawer[] &= i - sampler[] &= i +global drawer[] sampler[] . +proc init . + for i = 1 to 100 + drawer[] &= i + sampler[] &= i + . . -subr shuffle_drawer +init +proc shuffle_drawer . for i = len drawer[] downto 2 - r = random i + r = random 1 i swap drawer[r] drawer[i] . . -subr play_random +func play_random . shuffle_drawer for prisoner = 1 to 100 - found = 0 for i = 1 to 50 - r = random (100 - i) + r = random 1 (100 - i + 1) card = drawer[sampler[r]] - swap sampler[r] sampler[100 - i - 1] - if card = prisoner - found = 1 - break 1 - . - . - if found = 0 - break 1 + swap sampler[r] sampler[100 - i + 1] + if card = prisoner : break 1 . + if i > 50 : return 0 . + return 1 . -subr play_optimal +func play_optimal . shuffle_drawer for prisoner = 1 to 100 reveal = prisoner - found = 0 for i = 1 to 50 card = drawer[reveal] - if card = prisoner - found = 1 - break 1 - . + if card = prisoner : break 1 reveal = card . - if found = 0 - break 1 - . + if i > 50 : return 0 . + return 1 . -n = 10000 -win = 0 -for _ = 1 to n - play_random - win += found +n = 100000 +for i to n + win += play_random . print "random: " & 100.0 * win / n & "%" # win = 0 -for _ = 1 to n - play_optimal - win += found +for i to n + win += play_optimal . print "optimal: " & 100.0 * win / n & "%" diff --git a/Task/100-prisoners/Ecstasy/100-prisoners.ecstasy b/Task/100-prisoners/Ecstasy/100-prisoners.ecstasy new file mode 100644 index 0000000000..9f66539ddd --- /dev/null +++ b/Task/100-prisoners/Ecstasy/100-prisoners.ecstasy @@ -0,0 +1,49 @@ +module OneHundredPrisoners { + @Inject Console console; + + void run() { + console.print($"# of executions: {attempts}"); + console.print($"Optimal play success rate: {simulate(tryOpt)}%"); + console.print($" Random play success rate: {simulate(tryRnd)}%"); + } + + Int attempts = 10000; + + Dec simulate(function Boolean(Int[]) allFoundNumber) { + Int[] drawers = new Int[100](i->i); + Int pardoned = 0; + for (Int i : 1..attempts) { + if (allFoundNumber(drawers.shuffled())) { + ++pardoned; + } + } + return (pardoned * 1000000 / attempts).toDec() / 10000; + } + + Boolean tryRnd(Int[] drawers) { + Inmates: for (Int inmate : 0..<100) { + Int[] choices = drawers.shuffled(); + for (Int attempt : 0..<50) { + if (drawers[choices[attempt]] == inmate) { + continue Inmates; + } + } + return False; + } + return True; + } + + Boolean tryOpt(Int[] drawers) { + Inmates: for (Int inmate : 0..<100) { + Int choice = inmate; + for (Int attempt : 0..<50) { + if (drawers[choice] == inmate) { + continue Inmates; + } + choice = drawers[choice]; + } + return False; + } + return True; + } +} diff --git a/Task/100-prisoners/Elixir/100-prisoners.elixir b/Task/100-prisoners/Elixir/100-prisoners.ex similarity index 100% rename from Task/100-prisoners/Elixir/100-prisoners.elixir rename to Task/100-prisoners/Elixir/100-prisoners.ex diff --git a/Task/100-prisoners/Icon/100-prisoners.icon b/Task/100-prisoners/Icon/100-prisoners.icon new file mode 100644 index 0000000000..adcfba193c --- /dev/null +++ b/Task/100-prisoners/Icon/100-prisoners.icon @@ -0,0 +1,40 @@ +link "numbers" +global lp # lucky prisoner list +global p # starting prisoner list +global pardoned # Count of trials with all prisoners pardoned + +procedure main(A) + n := \A[1] | 100 + runs := \A[2] | 3000 + + write(runs," runs using ",n," prisoners.") + every (pardoned := 0, 1 to runs) do + runTrial(simplePrisoner, n) + write("Simple: ",fix(100*pardoned,runs,6,2),"%") + every (pardoned := 0, 1 to runs) do + runTrial(smartPrisoner, n) + write("Smart: ",fix(100*pardoned,runs,6,2),"%") +end + +procedure runTrial(pCode,n) + d := mkDrawers(n) + p := set([: 1 to n :]) + lp := set() + every pCode(d, !p) + if *lp = n then pardoned +:= 1 +end + +procedure mkDrawers(n) + d := [: 1 to n :] + every !d :=: ?d + return d +end + +procedure simplePrisoner(d, n) + every 1 to *d/2 do if n = (i := ?d) then break (insert(lp,n)) +end + +procedure smartPrisoner(d, n) + i := n + every 1 to *d/2 do if n = (i := d[i]) then break (insert(lp,n)) +end diff --git a/Task/100-prisoners/Julia/100-prisoners.julia b/Task/100-prisoners/Julia/100-prisoners.jl similarity index 100% rename from Task/100-prisoners/Julia/100-prisoners.julia rename to Task/100-prisoners/Julia/100-prisoners.jl diff --git a/Task/100-prisoners/Kotlin/100-prisoners.kotlin b/Task/100-prisoners/Kotlin/100-prisoners.kts similarity index 100% rename from Task/100-prisoners/Kotlin/100-prisoners.kotlin rename to Task/100-prisoners/Kotlin/100-prisoners.kts diff --git a/Task/100-prisoners/Phix/100-prisoners.phix b/Task/100-prisoners/Phix/100-prisoners.phix index 16b5b65a25..88107e77e1 100644 --- a/Task/100-prisoners/Phix/100-prisoners.phix +++ b/Task/100-prisoners/Phix/100-prisoners.phix @@ -1,30 +1,28 @@ -(phixonline)--> - function play(integer prisoners, iterations, bool optimal) - sequence drawers = shuffle(tagset(prisoners)) - integer pardoned = 0 - bool found = false - for i=1 to iterations do - drawers = shuffle(drawers) - for prisoner=1 to prisoners do - found = false - integer drawer = iff(optimal?prisoner:rand(prisoners)) - for j=1 to prisoners/2 do - drawer = drawers[drawer] - if drawer==prisoner then found = true exit end if - if not optimal then drawer = rand(prisoners) end if - end for - if not found then exit end if - end for - pardoned += found - end for - return 100*pardoned/iterations - end function +function play(integer prisoners, iterations, bool optimal) + sequence drawers = shuffle(tagset(prisoners)) + integer pardoned = 0 + bool found = false + for i=1 to iterations do + drawers = shuffle(drawers) + for prisoner=1 to prisoners do + found = false + integer drawer = iff(optimal?prisoner:rand(prisoners)) + for j=1 to prisoners/2 do + drawer = drawers[drawer] + if drawer==prisoner then found = true exit end if + if not optimal then drawer = rand(prisoners) end if + end for + if not found then exit end if + end for + pardoned += found + end for + return 100*pardoned/iterations +end function - constant iterations = 100_000 - printf(1,"Simulation count: %d\n",iterations) - for prisoners=10 to 100 by 90 do - atom random = play(prisoners,iterations,false), - optimal = play(prisoners,iterations,true) - printf(1,"Prisoners:%d, random:%g, optimal:%g\n",{prisoners,random,optimal}) - end for - - constant ESC=27, UP=328, LEFT=331, RIGHT=333, DOWN=336 - sequence board = tagset(15)&0, solve = board - integer pos = 16 +constant ESC=27, UP=328, LEFT=331, RIGHT=333, DOWN=336 +sequence board = tagset(15)&0, solve = board +integer pos = 16 - procedure print_board() - for i=1 to length(board) do - puts(1,iff(i=pos?" ":sprintf("%3d",{board[i]}))) - if mod(i,4)=0 then puts(1,"\n") end if - end for - puts(1,"\n") - end procedure +procedure print_board() + for i=1 to length(board) do + puts(1,iff(i=pos?" ":sprintf("%3d",{board[i]}))) + if mod(i,4)=0 then puts(1,"\n") end if + end for + puts(1,"\n") +end procedure - procedure move(integer d) - integer new_pos = pos+{+4,+1,-1,-4}[d] - if new_pos>=1 and new_pos<=16 - and (mod(pos,4)=mod(new_pos,4) -- same col, or row: - or floor((pos-1)/4)=floor((new_pos-1)/4)) then - {board[pos],board[new_pos]} = {board[new_pos],0} - pos = new_pos - end if - end procedure +procedure move(integer d) + integer new_pos = pos+{+4,+1,-1,-4}[d] + if new_pos>=1 and new_pos<=16 + and (mod(pos,4)=mod(new_pos,4) -- same col, or row: + or floor((pos-1)/4)=floor((new_pos-1)/4)) then + {board[pos],board[new_pos]} = {board[new_pos],0} + pos = new_pos + end if +end procedure - for i=1 to 5 do move(rand(4)) end for - while 1 do - print_board() - if board=solve then exit end if - integer c = find(wait_key(),{ESC,UP,LEFT,RIGHT,DOWN})-1 - if c=0 then exit end if - move(c) - end while - puts(1,"solved!\n") - ", whole( sum, 0 ), newline ) ) + FI; + a /= "q" AND sum < 21 + DO + player := IF player = human THEN computer ELSE human FI + OD; + IF a /= "q" THEN + print( ( newline ) ); + print( ( IF player = human THEN "Congratulations, you won" ELSE "Sorry, you lost" FI ) ); + print( ( newline ) ) + FI +FI diff --git a/Task/21-game/Ada/21-game.ada b/Task/21-game/Ada/21-game.adb similarity index 100% rename from Task/21-game/Ada/21-game.ada rename to Task/21-game/Ada/21-game.adb diff --git a/Task/21-game/AppleScript/21-game.applescript b/Task/21-game/AppleScript/21-game.applescript new file mode 100644 index 0000000000..c850f044a1 --- /dev/null +++ b/Task/21-game/AppleScript/21-game.applescript @@ -0,0 +1,44 @@ +repeat + set pstart to some item of {true, false} + if pstart then + display alert "You go first!" + set score to 0 + else + display alert "The computer goes first!" + log "The computer chose 1" + log "The score is now 1" + set score to 1 + end if + repeat + repeat + set input to display alert "Choose a number:" buttons {1, 2, 3} + set pmove to button returned of input + set score to score + pmove + if score > 21 then + display alert "You can't go above 21! Try again." + set score to score - pmove + else + exit repeat + end if + end repeat + log "You chose " & pmove + log "The score is now " & score + if score = 21 then + log "You win!" + exit repeat + else if score mod 4 is not 1 then + set cmove to (5 - (score mod 4)) mod 4 + else + set cmove to random number from 1 to 3 + end if + set score to score + cmove + log "The computer chose " & cmove + log "The score is now " & score + if score = 21 then + log "Too bad! The computer wins." + exit repeat + end if + end repeat + set again to display alert "Play again?" buttons {"Yes", "No"} + if button returned of again = "No" then exit repeat +end repeat diff --git a/Task/21-game/Arturo/21-game.arturo b/Task/21-game/Arturo/21-game.arturo index 3b62d3b212..a4c0d5eb0f 100644 --- a/Task/21-game/Arturo/21-game.arturo +++ b/Task/21-game/Arturo/21-game.arturo @@ -5,7 +5,7 @@ print "-----------------------------" players: ["A" "B"] currentPlayer: sample players nextPlayer: first players -- currentPlayer -runningTotal: new 0 +runningTotal: 0 num: 0 getNum: function [][ diff --git a/Task/21-game/AutoHotkey/21-game.ahk b/Task/21-game/AutoHotkey/21-game.ahk index 89fc54b3c2..ba112f623d 100644 --- a/Task/21-game/AutoHotkey/21-game.ahk +++ b/Task/21-game/AutoHotkey/21-game.ahk @@ -6,7 +6,7 @@ Gui, add, text, xs vT, Total : 00 Gui, add, text, xs vComputer, Computer Dealt 00 Gui, add, text, xs Section, Player 1 loop, 3 - Gui, add, button, x+5 vPlayer1_%A_Index% gTotal, % A_Index + Gui, add, button, x+5 vPlayer1_%A_Index% gTotal, % A_Index Gui, add, button, xs vReset gReset, reset Gui show,, 21 Game Winners := [1,5,9,13,17,21] @@ -18,13 +18,13 @@ total := 0 GuiControl,, T, % "Total : " SubStr("00" Total, -1) GuiControl,, Computer, % "Computer Waiting" Loop 3 - GuiControl, Enable, % "Player1_" A_Index + GuiControl, Enable, % "Player1_" A_Index Random, rnd, 0, 1 if rnd { - Loop 3 - GuiControl, Disable, % "Player1_" A_Index - gosub ComputerTurn + Loop 3 + GuiControl, Disable, % "Player1_" A_Index + gosub ComputerTurn } return ;----------------------------------- @@ -34,12 +34,12 @@ Total += Added GuiControl,, T, % "Total : " SubStr("00" Total, -1) if (total >= 21) { - MsgBox % "Player 1 Wins" - gosub reset - return + MsgBox % "Player 1 Wins" + gosub reset + return } Loop 3 - GuiControl, Disable, % "Player1_" A_Index + GuiControl, Disable, % "Player1_" A_Index gosub, ComputerTurn return ;----------------------------------- @@ -48,38 +48,38 @@ Gui, Submit, NoHide Sleep 500 if RadioE { - if (total < 13) - RadioC := true - else - RadioH := true + if (total < 13) + RadioC := true + else + RadioH := true } if RadioC { - Random, Deal, 1, 3 - total += Deal + Random, Deal, 1, 3 + total += Deal } if RadioH { - for i, v in Winners - if (total >= v) - continue - else - { - Deal := v - total - if Deal > 3 - Random, Deal, 1, 3 - total += Deal - break - } + for i, v in Winners + if (total >= v) + continue + else + { + Deal := v - total + if Deal > 3 + Random, Deal, 1, 3 + total += Deal + break + } } GuiControl,, T, % "Total : " SubStr("00" Total, -1) GuiControl,, Computer, % "Computer Dealt " Deal if (total=21) { - MsgBox Computer Wins - gosub, reset + MsgBox Computer Wins + gosub, reset } else - Loop 3 - GuiControl, Enable, % "Player1_" A_Index + Loop 3 + GuiControl, Enable, % "Player1_" A_Index return diff --git a/Task/21-game/BASIC256/21-game.basic b/Task/21-game/BASIC256/21-game.basic new file mode 100644 index 0000000000..0f0a0cb938 --- /dev/null +++ b/Task/21-game/BASIC256/21-game.basic @@ -0,0 +1,31 @@ +PLAYER = 1 +COMP = 0 + +sum = 0 +total = 0 +turn = int(rand + 0.5) +dim precomp = {1, 1, 3, 2} + +while sum < 21 + turn = 1 - turn + print "The sum is "; sum + if turn = PLAYER then + print "It is your turn." + while total < 1 or total > 3 or total + sum > 21 + input "How many would you like to total? ", total + end while + else + print "It is the computer's turn." + total = precomp[sum mod 4] + print "The computer totals ", total, "." + end if + print + sum += total + total = 0 +end while + +if turn = PLAYER then + print "Congratulations. You win." +else + print "Bad luck. The computer wins." +end if diff --git a/Task/21-game/Chipmunk-Basic/21-game.basic b/Task/21-game/Chipmunk-Basic/21-game.basic new file mode 100644 index 0000000000..f3298f27c5 --- /dev/null +++ b/Task/21-game/Chipmunk-Basic/21-game.basic @@ -0,0 +1,133 @@ +100 rem 21 game +110 rem for rosetta code +120 ' +130 rem initialization +140 l$ = chr$(157) : rem left cursor +150 dim p$(2),hc(2),ca(4) : hc(1) = 0 : hc(2) = 0 : rem players +160 ca(0) = 1 : ca(1) = 1 : ca(2) = 3 : ca(3) = 2 : rem computer answers +170 dim cn$(6) : for i = 1 to 6 : read cn$(i) : next i : rem computer names +180 def fnm(X)=(X-(INT(X/4))*4):REM modulo function +190 ' +200 rem optionally set screen colors here +210 cls +220 print " 21 GAME" +230 print : print " The goal of this game is to take turns" +240 print " adding the value of either 1, 2, or 3" +250 print " to a running total. The first player" +260 print " to bring the total to 21..." +270 print : print " ... WINS THE GAME!" +280 print : gosub 1110 +290 for p = 1 to 2 +300 ' +310 rem game setup and get players +320 for p = 1 to 2 +330 print : print "Player ";p;l$;", [H]uman or [C]omputer? "; +340 k$ = inkey$ : if k$ <> "c" and k$ <> "h" then 340 +350 print k$ : hc(p) = (k$ = "c") +360 print : print "Player";p;l$ "," : print "Enter your name"; : if hc(p) then goto 400 +370 input p$(p) +380 next p +390 goto 420 +400 gosub 1340 : print "? ";p$(p) +410 next p +420 print +430 for p = 1 to 2 : print p;l$;". ";p$(p) : next p +440 print : print "Is this correct (y/n)? "; +450 k$ = inkey$ : if k$ <> "y" and k$ <> "n" then 450 +460 print k$ : if k$ = "n" then goto 290 +470 print : print "Who will play first (1 or 2)? "; +480 k$ = inkey$ : if k$ < "1" or k$ > "2" then 480 +490 fp = asc(k$)-48 : print k$ : print +500 print "Okay, ";p$(fp);" will play first." : print : gosub 1110 +510 cls +520 ' +530 rem start main game loop +540 pi = fp : rt = 0 +550 print "Total so far:";rt +560 print : print p$(pi);"'s turn." +570 if hc(pi) then gosub 1240 +580 if not hc(pi) then gosub 1170 +590 rt = rt+ad +600 if rt = 21 then goto 680 +610 if rt > 21 then print : print p$(pi);" loses by going over 21!!" : goto 700 +620 pi = pi+1 : if pi > 2 then pi = 1 +630 goto 550 +640 print : print " ... WINS THE GAME!" +650 print : gosub 1110 +660 ' +670 for p = 1 to 2 +680 rem winner winner chicken dinner +690 print : print "21! ";p$(pi);" wins the game!!!" +700 print : print "Would you like to play again? "; +710 k$ = inkey$ : if k$ <> "n" and k$ <> "y" then 710 +720 print k$ +730 if k$ = "n" then print : print "Okay, maybe another time. Bye!" : end +740 goto 200 +750 print k$ : hc(p) = (k$ = "c") +760 print : print "Player";p;l$ "," : print "Enter your name"; : if hc(p) then goto 800 +770 input p$(p) +780 next p +790 goto 820 +800 gosub 1340 : print "? ";p$(p) +810 next p +820 print : for p = 1 to 2 : print p;l$;". ";p$(p) : next p +830 print : print "Is this correct (y/n)? "; +840 k$ = inkey$ : if k$ <> "y" and k$ <> "n" then 840 +850 print k$ : if k$ = "n" then goto 660 +860 print : print "Who will play first (1 or 2)? "; +870 k$ = inkey$ : if k$ < "1" or k$ > "2" then 870 +880 fp = asc(k$)-48 : print k$ : print +890 print "Okay, ";p$(fp);" will play first." : print : gosub 1110 +900 ' +910 rem start main game loop +920 pi = fp : rt = 0 +930 print chr$(147);"Total so far: ";rt +940 print : print p$(pi);"'s turn." +950 if hc(pi) then gosub 1240 +960 if not hc(pi) then gosub 1170 +970 rt = rt+ad +980 if rt = 21 then goto 1030 +990 if rt > 21 then print : print p$(pi);" loses by going over 21!!" : goto 1050 +1000 pi = pi+1 : if pi > 2 then pi = 1 +1010 goto 930 +1020 ' +1030 rem winner winner chicken dinner +1040 print : print "21! ";p$(pi);" wins the game!!!" +1050 print : print "Would you like to play again? "; +1060 k$ = inkey$ : if k$ <> "n" and k$ <> "y" then 1060 +1070 print k$ +1080 if k$ = "n" then print : print "Okay, maybe another time. Bye!" : end +1090 goto 490 +1100 ' +1110 rem pause for keypress +1120 z$ = " Press a key to continue. " +1130 print z$ +1140 k$ = inkey$ : if k$ = "" then 1140 +1150 return +1160 ' +1170 rem human player move +1180 print : print "How much to add," +1190 print "1, 2, or 3 (0 to quit)"; : input ad +1200 if ad < 0 or ad > 3 then print : print "Illegal amount. Try again." : goto 1180 +1210 if ad = 0 then print : print "Game was ended by ";p$(pi);"." : end +1220 return +1230 ' +1240 rem computer player move +1250 print : print "Thinking..."; +1260 tt = int(rnd(1)*10) +1270 for t = 1 to tt : print "."; : for i = 1 to 250 : next i : next t : print +1280 rm = fn m(rt) +1290 ad = ca(rm) +1300 print : print p$(pi);" adds ";ca(rm);l$;"." +1310 for t = 1 to 1000 : next t +1320 return +1330 ' +1340 rem pick a computer name +1350 pn = int(rnd(1)*6)+1 : t$ = cn$(pn) +1360 if t$ = p$(p-1) then goto 1350 +1370 p$(p) = t$ +1380 return +1390 ' +1400 rem some computer names to pick from +1410 data "Commodore 64","VIC-20","Commodore 128" +1420 data "PET","Plus/4","Commodore 16" diff --git a/Task/21-game/EasyLang/21-game.easy b/Task/21-game/EasyLang/21-game.easy index bcbd765121..6f4e5100cd 100644 --- a/Task/21-game/EasyLang/21-game.easy +++ b/Task/21-game/EasyLang/21-game.easy @@ -2,36 +2,36 @@ print "Who reaches 21, wins" print "Do you want to begin (y/n)" who = 1 if input = "n" - who = 2 + who = 2 . who$[] = [ "Human" "Computer" ] repeat - if who = 1 - repeat - print "" - print "Choose 1,2 or 3 (q for quit)" - a$ = input - n = number a$ - until a$ = "q" or (n >= 1 and n <= 3) - . - else - sleep 1 - if sum mod 4 = 1 - n = random 3 - else - n = 4 - (sum + 3) mod 4 - . - . - sum += n - print who$[who] & ": " & n & " --> " & sum - until sum >= 21 or a$ = "q" - who = who mod 2 + 1 + if who = 1 + repeat + print "" + print "Choose 1,2 or 3 (q for quit)" + a$ = input + n = number a$ + until a$ = "q" or (n >= 1 and n <= 3) + . + else + sleep 1 + if sum mod 4 = 1 + n = random 1 3 + else + n = 4 - (sum + 3) mod 4 + . + . + sum += n + print who$[who] & ": " & n & " --> " & sum + until sum >= 21 or a$ = "q" + who = who mod 2 + 1 . if a$ <> "q" - print "" - if who = 0 - print "Congratulation, you won" - else - print "Sorry, you lost" - . + print "" + if who = 0 + print "Congratulation, you won" + else + print "Sorry, you lost" + . . diff --git a/Task/21-game/Forth/21-game.fth b/Task/21-game/Forth/21-game.fth new file mode 100644 index 0000000000..3090fa4563 --- /dev/null +++ b/Task/21-game/Forth/21-game.fth @@ -0,0 +1,32 @@ +: READKEY + 1+ BEGIN + KEY DUP 27 = ABORT" Bye!" + 48 - 2DUP > OVER 0 > AND IF + DUP 48 + EMIT CR SWAP DROP EXIT + THEN DROP + REPEAT +; +: 21GAME CLS + 0 2 RND 1- + ." 21 is a two player game." CR + ." The game is played by choosing a number (1, 2 or 3) to be added to the running total. " + ." The game is won by the player whose chosen number causes the running total to reach exactly 21." + ." The running total starts at zero. One player will be the computer." + BEGIN + NOT + CR ." The sum is " OVER . CR + SWAP OVER IF + ." How many would you like add?" + ." (1-3) " 3 READKEY + ELSE + ." It is the computer's turn." + 4 OVER 1- 4 MOD - + DUP 4 = IF 3 RND 1+ MIN THEN + DUP CR ." Computer adds " . CR + THEN + SWAP + OVER 21 < NOT UNTIL + CR + IF ." Congratulations. You win." + ELSE ." Bad Luck. Computer wins." + THEN CR DROP +; diff --git a/Task/21-game/GDScript/21-game.gd b/Task/21-game/GDScript/21-game.gd index 78f190267d..009e2e3a9a 100644 --- a/Task/21-game/GDScript/21-game.gd +++ b/Task/21-game/GDScript/21-game.gd @@ -8,81 +8,81 @@ const target: int = 21 # -1 is returned to request quit func get_player_choice(total: int) -> int: - while true: - printraw("Player's choice: ") - var input: String = OS.read_string_from_stdin().strip_edges() + while true: + printraw("Player's choice: ") + var input: String = OS.read_string_from_stdin().strip_edges() - if input == "quit": - return -1 + if input == "quit": + return -1 - if not input.is_valid_int(): - print("Please input an integer.") - continue + if not input.is_valid_int(): + print("Please input an integer.") + continue - var input_int := int(input) - if input_int < 1 or input_int > 3: - print("Please pick a number from 1 to 3") - continue + var input_int := int(input) + if input_int < 1 or input_int > 3: + print("Please pick a number from 1 to 3") + continue - if input_int + total > target: - print("Please do not exceed a total of %d" % target) - continue + if input_int + total > target: + print("Please do not exceed a total of %d" % target) + continue - return input_int + return input_int - # This is required since Godot does not detect the unreachable code path - OS.crash("unreachable") - return 0 + # This is required since Godot does not detect the unreachable code path + OS.crash("unreachable") + return 0 func get_computer_choice(total: int) -> int: - # This can be shortened using max() if you do not have type checking OCD - var remaining: int = target - total - return randi_range(1, 3 if remaining > 3 else remaining) + # This can be shortened using max() if you do not have type checking OCD + var remaining: int = target - total + return randi_range(1, 3 if remaining > 3 else remaining) func play() -> void: - print("""\ + print("""\ Welcome to the 21 game. Type quit to exit.""") - var total: int = 0 - var player: Player - match randi_range(1, 2): - 1: - player = Player.Human - print("You will go first.") - 2: - player = Player.Computer - print("The computer will go first.") + var total: int = 0 + var player: Player + match randi_range(1, 2): + 1: + player = Player.Human + print("You will go first.") + 2: + player = Player.Computer + print("The computer will go first.") - while true: - print("\nThe total is %d" % total) + while true: + print("\nThe total is %d" % total) - var choice: int - match player: - Player.Human: - choice = get_player_choice(total) - if choice == -1: - return - Player.Computer: - choice = get_computer_choice(total) - print("The computer plays %d" % choice) - assert(1 <= choice and choice <= 3) + var choice: int + match player: + Player.Human: + choice = get_player_choice(total) + if choice == -1: + return + Player.Computer: + choice = get_computer_choice(total) + print("The computer plays %d" % choice) + assert(1 <= choice and choice <= 3) - total += choice - if total == target: - match player: - Player.Human: print("You win!") - Player.Computer: print("The computer won, you lose.") - return - assert(total < target) + total += choice + if total == target: + match player: + Player.Human: print("You win!") + Player.Computer: print("The computer won, you lose.") + return + assert(total < target) - match player: - Player.Human: player = Player.Computer - Player.Computer: player = Player.Human + match player: + Player.Human: player = Player.Computer + Player.Computer: player = Player.Human func _process(_delta: float) -> bool: - randomize() - play() - return true + randomize() + play() + return true diff --git a/Task/21-game/IS-BASIC/21-game.basic b/Task/21-game/IS-BASIC/21-game.basic index d61a3efeb8..edb55d5d3c 100644 --- a/Task/21-game/IS-BASIC/21-game.basic +++ b/Task/21-game/IS-BASIC/21-game.basic @@ -1,25 +1,25 @@ 100 PROGRAM "21Game.bas" 110 RANDOMIZE 120 LET SUM,ADD=0 -130 LET TURN=RND(2) +130 LET TURN=RND(2)-1 140 CLEAR SCREEN 150 PRINT "21 is a two player game, the game is played by choosing a number (1, 2, or 3) to be added to the running total. The game is won by the player whose chosen number causes the running total to reach exactly 21." 160 PRINT "The running total starts at zero. One player will be the computer.":PRINT 170 DO -180 LET TURN=1-TURN +180 LET TURN=NOT TURN 190 SET #102:INK 3:PRINT "The sum is";SUM:SET #102:INK 1 -200 IF TURN=1 THEN +200 IF TURN THEN 210 PRINT "It is your turn.":PRINT "How many would you like to add? (1-3): "; 220 LET ADD=READKEY 230 IF ADD>21-SUM THEN PRINT "You can only add";21-SUM 240 ELSE -250 LET ADD=4-MOD((SUM-1),4) -260 IF ADD=4 THEN LET ADD=MIN(RND(3)+1,SUM) +250 LET ADD=4-MOD(SUM-1,4) +260 IF ADD=4 THEN LET ADD=RND(3)+1 270 PRINT "It is the computer's turn.":PRINT "The computer adds";ADD 280 END IF 290 PRINT :LET SUM=SUM+ADD 300 LOOP WHILE SUM<21 -310 IF TURN=1 THEN +310 IF TURN THEN 320 PRINT "Congratulations. You win." 330 ELSE 340 PRINT "Bad luck. The computer wins." diff --git a/Task/21-game/J/21-game.j b/Task/21-game/J/21-game.j index 821237993a..04b5ac792e 100644 --- a/Task/21-game/J/21-game.j +++ b/Task/21-game/J/21-game.j @@ -1,37 +1,32 @@ -g21=: summarize@play@setup ::('g21: error termination'"_) +g21=: summarize@play@setup ::'g21: error termination' -NB. non-verb must be defined before use, otherwise are assumed verbs. -Until=: 2 :'u^:(0-:v)^:_' +Until=: {{u^:(0-:v)^:_}} -t=: 'score turn choice' -(t)=: i. # ;: t -empty erase't' - -Fetch=: &{ -Alter=: } +'score turn choice'=: 0 1 2 play=: move Until done -done=: 21 <: score Fetch -move=: [: update you`it@.(turn Fetch) +move=: [: update you`it@.(turn&{) +done=: 21 <: score&{ + update=: swap@display@add -add=: score Alter~ (score Fetch + choice Fetch) -display=: [ ([: echo 'sum: {}' format~ score Fetch) -swap=: turn Alter~ ([: -. turn Fetch) +add=: score}~ score&{ + choice&{ +display=: [ 'sum: {}' echo@format~ score&{ +swap=: turn}~ [: -. turn&{ -it=: ([ [: echo 'It chose {}.' format~ choice Fetch)@(choice Alter~ cb) -cb=: (1:`r`3:`2:)@.(4 | score Fetch) NB. computer brain -r=: 3 :'>:?3' +it=: ([ 'It chose {}.' echo@format~ choice&{)@(choice}~ cb) +cb=: 1:`(>:@?@3)`3:`2:@.(4 | score&{) NB. computer brain you=: qio1@check@acquire@prompt -prompt=: [ ([: echo 'your choice?'"_) -acquire=: choice Alter~ ('123' i. 0 { ' ' ,~ read) -check=: (choice Alter~ (665 - score Fetch))@([ ([: echo 'g21: early termination'"_))^:(3 = choice Fetch) -qio1=: choice Alter~ ([: >: choice Fetch) +prompt=: [ echo@'your choice?' +acquire=: choice}~'123'i.0{' ',~read +check=: (choice}~ 665 - score&{)@([ echo@'g21: early termination')^:(3 = choice&{) +qio1=: choice}~ ([: >: choice&{) -setup=: ([ [: echo 'On your turn enter 1 2 or 3, other entries exit'"_)@((3 :'?2') turn Alter ])@0 0 0"_ NB. choose first player randomly -summarize=: ' won' ,~ (];._2 'it you ') {~ turn Fetch +setup=: ([ echo@'On your turn enter 1 2 or 3, other entries exit')@(?@2 turn} ])@0 0 0 NB. choose first player randomly -read=: 1!:1@:1: -write=: 1!:2 4: NB. unused -format=: ''&$: :([: ; (a: , [: ":&.> [) ,. '{}' ([ (E. <@}.;._1 ]) ,) ]) +summarize=: ' won',~ ];._2@'it you '{~turn&{ + +read=: 1!:1@1 +write=: 1!:2&4 NB. unused +format=: ''&$: : ([: ; (a: , [: ":&.> [) ,. '{}' ([ (E. <@}.;._1 ]) ,) ]) diff --git a/Task/21-game/Julia/21-game.julia b/Task/21-game/Julia/21-game.jl similarity index 100% rename from Task/21-game/Julia/21-game.julia rename to Task/21-game/Julia/21-game.jl diff --git a/Task/21-game/PureBasic/21-game.basic b/Task/21-game/PureBasic/21-game.basic new file mode 100644 index 0000000000..34b340cd82 --- /dev/null +++ b/Task/21-game/PureBasic/21-game.basic @@ -0,0 +1,40 @@ +If OpenConsole() + PLAYER.i = 1 + COMP.i = 0 + + sum.i = 0 + total.i = 0 + turn.i = Random(1) + 0.5 + Dim precomp.i(3) + precomp(0) = 1 + precomp(1) = 1 + precomp(2) = 3 + precomp(3) = 2 + + While sum < 21 + turn = 1 - turn + PrintN("The sum is " + Str(sum)) + If turn = PLAYER + PrintN("It is your turn.") + While total < 1 Or total > 3 Or total + sum > 21 + Print("How many would you like to total? ") + total = Val(Input()) + Wend + Else + PrintN("It is the computer's turn.") + total = precomp(sum % 4) + PrintN("The computer totals " + Str(total) + ".") + EndIf + PrintN("") + sum + total + total = 0 + Wend + + If turn = PLAYER + PrintN("Congratulations. You win.") + Else + PrintN("Bad luck. The computer wins.") + EndIf + + Input() +EndIf diff --git a/Task/21-game/Python/21-game-1.py b/Task/21-game/Python/21-game-1.py index 61db2b29a5..fa4bcbcfdc 100644 --- a/Task/21-game/Python/21-game-1.py +++ b/Task/21-game/Python/21-game-1.py @@ -1,62 +1,62 @@ from random import randint def start(): - game_count=0 - print("Enter q to quit at any time.\nThe computer will choose first.\nRunning total is now {}".format(game_count)) - roundno=1 - while game_count<21: - print("\nROUND {}: \n".format(roundno)) - t = select_count(game_count) - game_count = game_count+t - print("Running total is now {}\n".format(game_count)) - if game_count>=21: - print("So, commiserations, the computer has won!") - return 0 - t = request_count() - if not t: - print('OK,quitting the game') - return -1 - game_count = game_count+t - print("Running total is now {}\n".format(game_count)) - if game_count>=21: - print("So, congratulations, you've won!") - return 1 - roundno+=1 + game_count=0 + print("Enter q to quit at any time.\nThe computer will choose first.\nRunning total is now {}".format(game_count)) + roundno=1 + while game_count<21: + print("\nROUND {}: \n".format(roundno)) + t = select_count(game_count) + game_count = game_count+t + print("Running total is now {}\n".format(game_count)) + if game_count>=21: + print("So, commiserations, the computer has won!") + return 0 + t = request_count() + if not t: + print('OK,quitting the game') + return -1 + game_count = game_count+t + print("Running total is now {}\n".format(game_count)) + if game_count>=21: + print("So, congratulations, you've won!") + return 1 + roundno+=1 def select_count(game_count): - '''selects a random number if the game_count is less than 18. otherwise chooses the winning number''' - if game_count<18: - t= randint(1,3) - else: - t = 21-game_count - print("The computer chooses {}".format(t)) - return t + '''selects a random number if the game_count is less than 18. otherwise chooses the winning number''' + if game_count<18: + t= randint(1,3) + else: + t = 21-game_count + print("The computer chooses {}".format(t)) + return t def request_count(): - '''request user input between 1,2 and 3. It will continue till either quit(q) or one of those numbers is requested.''' - t="" - while True: - try: - t = raw_input('Your choice 1 to 3 :') - if int(t) in [1,2,3]: - return int(t) - else: - print("Out of range, try again") - except: - if t=="q": - return None - else: - print("Invalid Entry, try again") + '''request user input between 1,2 and 3. It will continue till either quit(q) or one of those numbers is requested.''' + t="" + while True: + try: + t = raw_input('Your choice 1 to 3 :') + if int(t) in [1,2,3]: + return int(t) + else: + print("Out of range, try again") + except: + if t=="q": + return None + else: + print("Invalid Entry, try again") c=0 m=0 r=True while r: - o = start() - if o==-1: - break - else: - c+=1 if o==0 else 0 - m+=1 if o==1 else 0 - print("Computer wins {0} game, human wins {1} games".format(c,m)) - t = raw_input("Another game?(press y to continue):") - r = (t=="y") + o = start() + if o==-1: + break + else: + c+=1 if o==0 else 0 + m+=1 if o==1 else 0 + print("Computer wins {0} game, human wins {1} games".format(c,m)) + t = raw_input("Another game?(press y to continue):") + r = (t=="y") diff --git a/Task/21-game/QBasic/21-game.basic b/Task/21-game/QBasic/21-game.basic new file mode 100644 index 0000000000..a43d03d38f --- /dev/null +++ b/Task/21-game/QBasic/21-game.basic @@ -0,0 +1,34 @@ +PLAYER = 1 +COMP = 0 +RANDOMIZE TIMER + +sum = 0 +total = 0 +turn = INT(RND + 0.5) +DIM precomp(0 TO 3) +precomp(0) = 1 : precomp(1) = 1 +precomp(2) = 3 : precomp(3) = 2 + +WHILE sum < 21 + turn = 1 - turn + PRINT "The sum is "; sum + IF turn = PLAYER THEN + PRINT "It is your turn." + WHILE total < 1 OR total > 3 OR total + sum > 21 + INPUT "How many would you like to total? ", total + WEND + ELSE + PRINT "It is the computer's turn." + total = precomp(sum MOD 4) + PRINT "The computer totals"; total; "." + END IF + PRINT + sum = sum + total + total = 0 +WEND + +IF turn = PLAYER THEN + PRINT "Congratulations. You win." +ELSE + PRINT "Bad luck. The computer wins." +END IF diff --git a/Task/21-game/Rebol/21-game.rebol b/Task/21-game/Rebol/21-game.rebol new file mode 100644 index 0000000000..03fa84803d --- /dev/null +++ b/Task/21-game/Rebol/21-game.rebol @@ -0,0 +1,26 @@ +Rebol [ + title: "Rosetta code: 21 game" + file: %21_game.r3 + url: https://rosettacode.org/wiki/21_game +] + +game-21: function[][ + total: 0 + human?: true + while [total <> 21][ + either human? [ + n: ask "Enter a number between 1 and 3 (CTRL+C to quit): " + if none? n [quit] + unless parse n [#"1" | #"2" | #"3"][ continue ] + n: to integer! n + ][ ;computer + if 3 < n: 21 - total [ n: random 3 ] + print ["Computer picks:" as-yellow n] + ] + total: total + n + print ["Total:" as-green total] + human?: not human? + ] + print as-green pick ["Computer wins!" "You win!"] human? +] +game-21 diff --git a/Task/21-game/Ring/21-game.ring b/Task/21-game/Ring/21-game.ring index 51094dea5e..06bcf1934e 100644 --- a/Task/21-game/Ring/21-game.ring +++ b/Task/21-game/Ring/21-game.ring @@ -100,9 +100,9 @@ func choose(ch,ym) ok func msgBox(text) { - m = new qMessageBox(win1) { - setWindowTitle("21 Game") - setText(text) - show() - } + m = new qMessageBox(win1) { + setWindowTitle("21 Game") + setText(text) + show() + } } diff --git a/Task/21-game/Rust/21-game.rust b/Task/21-game/Rust/21-game.rs similarity index 100% rename from Task/21-game/Rust/21-game.rust rename to Task/21-game/Rust/21-game.rs diff --git a/Task/21-game/True-BASIC/21-game.basic b/Task/21-game/True-BASIC/21-game.basic new file mode 100644 index 0000000000..a258d40732 --- /dev/null +++ b/Task/21-game/True-BASIC/21-game.basic @@ -0,0 +1,30 @@ +LET player = 1 +LET comp = 0 +RANDOMIZE +LET sum = 0 +LET total = 0 +LET turn = INT(RND+0.5) +DIM precomp(0 TO 3) +LET precomp(0) = 1 +LET precomp(1) = 1 +LET precomp(2) = 3 +LET precomp(3) = 2 +DO WHILE sum < 21 + LET turn = 1-turn + PRINT "The sum is "; sum + IF turn = player THEN + PRINT "It is your turn." + DO WHILE total < 1 OR total > 3 OR total+sum > 21 + INPUT prompt "How many would you like to total? ": total + LOOP + ELSE + PRINT "It is the computer's turn." + LET total = precomp(remainder(round(sum),4)) + PRINT USING "The computer totals #.": total + END IF + PRINT + LET sum = sum+total + LET total = 0 +LOOP +IF turn = player THEN PRINT "Congratulations. You win." ELSE PRINT "Bad luck. The computer wins." +END diff --git a/Task/21-game/Uiua/21-game.uiua b/Task/21-game/Uiua/21-game.uiua new file mode 100644 index 0000000000..8f17d8a5d9 --- /dev/null +++ b/Task/21-game/Uiua/21-game.uiua @@ -0,0 +1,6 @@ +T ← 21 +P ← &p$"_ played: _\tTotal: _" +Play‼ ← ⍥(&p$"_ won." ^0)⊸=T⊸P ^0 ⟜+ ^1 +Computer ← Play‼"Computer" ⍥+₁⊸=0◿4⊸˜-T # Aim for Rem mod 4 = 0 +Random ← Play‼"Random"+1⌊×3⚂ # Random play. +◌⍢(⍥Computer⊸ 21: + recur() + val + else: recur() diff --git a/Task/21-game/Yabasic/21-game.basic b/Task/21-game/Yabasic/21-game.basic new file mode 100644 index 0000000000..53ed372fb3 --- /dev/null +++ b/Task/21-game/Yabasic/21-game.basic @@ -0,0 +1,33 @@ +PLAYER = 1 +COMP = 0 + +sum = 0 +total = 0 +turn = int(ran() + 0.5) +dim precomp(3) +precomp(0) = 1 : precomp(1) = 1 +precomp(2) = 3 : precomp(3) = 2 + +while sum < 21 + turn = 1 - turn + print "The sum is ", sum + if turn = PLAYER then + print "It is your turn." + while total < 1 or total > 3 or total + sum > 21 + input "How many would you like to total? " total + wend + else + print "It is the computer's turn." + total = precomp(mod(sum, 4)) + print "The computer totals ", total, "." + fi + print + sum = sum + total + total = 0 +wend + +if turn = PLAYER then + print "Congratulations. You win." +else + print "Bad luck. The computer wins." +fi diff --git a/Task/24-game-Solve/Ada/24-game-solve.adb b/Task/24-game-Solve/Ada/24-game-solve.adb new file mode 100644 index 0000000000..2494b4e14f --- /dev/null +++ b/Task/24-game-Solve/Ada/24-game-solve.adb @@ -0,0 +1,245 @@ +with Ada.Text_IO; use Ada.Text_IO; + +procedure Game24_Solver is + subtype Index is Positive range 1 .. 4; + subtype Digit is Integer range 1 .. 9; + type Digit_Array_Type is array (Index) of Digit; + + Success_Exception : exception; + + Digit_Array : Digit_Array_Type; + + procedure Swap (A, B : Index) is + Tmp : Digit; + begin + if A /= B then + Tmp := Digit_Array (A); + Digit_Array (A) := Digit_Array (B); + Digit_Array (B) := Tmp; + end if; + end Swap; + + procedure Do_Operation_Options is + type Operation_Character is ('+', '-', '*', '/'); + type Operation_Access is + access function (Left, Right : Float) return Float; + type Allowed_Operation_Array_Type is + array (Operation_Character) of Operation_Access; + + function Operation_Character_To_String + (C : in Operation_Character) return String is + begin + case C is + when '+' => + return "+"; + + when '-' => + return "-"; + + when '*' => + return "*"; + + when '/' => + return "/"; + end case; + end Operation_Character_To_String; + + function Add_Floats (Left, Right : Float) return Float is + begin + return Left + Right; + end Add_Floats; + + function Subtract_Floats (Left, Right : Float) return Float is + begin + return Left - Right; + end Subtract_Floats; + + function Multiply_Floats (Left, Right : Float) return Float is + begin + return Left * Right; + end Multiply_Floats; + + function Divide_Floats (Left, Right : Float) return Float is + begin + return Left / Right; + end Divide_Floats; + + Allowed_Operation_Array : constant Allowed_Operation_Array_Type := + ('+' => Add_Floats'Access, + '-' => Subtract_Floats'Access, + '*' => Multiply_Floats'Access, + '/' => Divide_Floats'Access); + + A : Digit renames Digit_Array (1); + B : Digit renames Digit_Array (2); + C : Digit renames Digit_Array (3); + D : Digit renames Digit_Array (4); + begin + for Op1 in Operation_Character loop + for Op2 in Operation_Character loop + for Op3 in Operation_Character loop + if (Allowed_Operation_Array (Op3) + (Allowed_Operation_Array (Op2) + (Allowed_Operation_Array (Op1) (Float (A), Float (B)), + Float (C)), + Float (D))) + = 24.0 + then + Put_Line + ("((" + & Digit'Image (A) + & " " + & Operation_Character_To_String (Op1) + & " " + & Digit'Image (B) + & ") " + & Operation_Character_To_String (Op2) + & " " + & Digit'Image (C) + & ") " + & Operation_Character_To_String (Op3) + & " " + & Digit'Image (D)); + raise Success_Exception; + end if; + if (Allowed_Operation_Array (Op2) + (Allowed_Operation_Array (Op1) (Float (A), Float (B)), + Allowed_Operation_Array (Op3) (Float (C), Float (D)))) + = 24.0 + then + Put_Line + ("(" + & Digit'Image (A) + & " " + & Operation_Character_To_String (Op1) + & " " + & Digit'Image (B) + & ") " + & Operation_Character_To_String (Op2) + & " (" + & Digit'Image (C) + & " " + & Operation_Character_To_String (Op3) + & " " + & Digit'Image (D) + & ")"); + raise Success_Exception; + end if; + if (Allowed_Operation_Array (Op1) + (Float (A), + Allowed_Operation_Array (Op2) + (Float (B), + Allowed_Operation_Array (Op3) + (Float (C), Float (D))))) + = 24.0 + then + Put_Line + (Digit'Image (A) + & " " + & Operation_Character_To_String (Op1) + & " (" + & Digit'Image (B) + & " " + & Operation_Character_To_String (Op2) + & " (" + & Digit'Image (C) + & " " + & Operation_Character_To_String (Op3) + & " " + & Digit'Image (D) + & "))"); + raise Success_Exception; + end if; + if (Allowed_Operation_Array (Op1) + (Float (A), + Allowed_Operation_Array (Op3) + (Allowed_Operation_Array (Op2) (Float (B), Float (C)), + Float (D)))) + = 24.0 + then + Put_Line + (Digit'Image (A) + & " " + & Operation_Character_To_String (Op1) + & " ((" + & Digit'Image (B) + & " " + & Operation_Character_To_String (Op2) + & " " + & Digit'Image (C) + & ") " + & Operation_Character_To_String (Op3) + & " " + & Digit'Image (D) + & ")"); + raise Success_Exception; + end if; + if (Allowed_Operation_Array (Op3) + (Allowed_Operation_Array (Op1) + (Float (A), + Allowed_Operation_Array (Op2) (Float (B), Float (C))), + Float (D))) + = 24.0 + then + Put_Line + ("(" + & Digit'Image (A) + & " " + & Operation_Character_To_String (Op1) + & " (" + & Digit'Image (B) + & " " + & Operation_Character_To_String (Op2) + & " " + & Digit'Image (C) + & ")) " + & Operation_Character_To_String (Op3) + & " " + & Digit'Image (D)); + raise Success_Exception; + end if; + end loop; + end loop; + end loop; + end Do_Operation_Options; + + procedure Do_Permutations (Start_Index : Index := Index'First) is + begin + if Start_Index = Index'Last then + Do_Operation_Options; + return; + end if; + + for I in Start_Index .. Index'Last loop + Swap (Start_Index, I); + Do_Permutations (Start_Index + 1); + Swap (Start_Index, I); + end loop; + end Do_Permutations; +begin + Put ("Enter 4 digits: "); + declare + Zero_Pos : constant Integer := Character'Pos ('0'); + Input : String := Get_Line; + begin + if Input'Length = 4 then + for I in Index'Range loop + if Input (I) in '1' .. '9' then + Digit_Array (I) := Character'Pos (Input (I)) - Zero_Pos; + else + Put_Line + ("Invalid input: all characters must be non-zero digits"); + return; + end if; + end loop; + else + Put_Line ("Invalid input: it must have length of 4"); + return; + end if; + end; + Do_Permutations; + Put_Line ("Solution not found"); +exception + when Success_Exception => + null; +end Game24_Solver; diff --git a/Task/24-game-Solve/COBOL/24-game-solve.cobol b/Task/24-game-Solve/COBOL/24-game-solve.cob similarity index 100% rename from Task/24-game-Solve/COBOL/24-game-solve.cobol rename to Task/24-game-Solve/COBOL/24-game-solve.cob diff --git a/Task/24-game-Solve/Dart/24-game-solve.dart b/Task/24-game-Solve/Dart/24-game-solve.dart new file mode 100644 index 0000000000..38d41aaba9 --- /dev/null +++ b/Task/24-game-Solve/Dart/24-game-solve.dart @@ -0,0 +1,226 @@ +enum Operator { + Sub, + Plus, + Mul, + Div +} + +class Factor { + String content; + int value; + + Factor({this.content, this.value}); + + Factor copyWith({String content, int value}) { + return Factor( + content: content ?? this.content, + value: value ?? this.value + ); + } +} + +List apply(Operator op, List left, List right) { + List ret = []; + for (var l in left) { + for (var r in right) { + switch (op) { + case Operator.Sub: + if (l.value > r.value) { + ret.add(Factor( + content: "(${l.content} - ${r.content})", + value: l.value - r.value + )); + } + break; + case Operator.Plus: + ret.add(Factor( + content: "(${l.content} + ${r.content})", + value: l.value + r.value + )); + break; + case Operator.Mul: + ret.add(Factor( + content: "(${l.content} × ${r.content})", + value: l.value * r.value + )); + break; + case Operator.Div: + if (l.value >= r.value && r.value > 0 && l.value % r.value == 0) { + ret.add(Factor( + content: "(${l.content} / ${r.content})", + value: l.value ~/ r.value + )); + } + break; + } + } + } + return ret; +} + +List calc(List op, List numbers) { + List _calc(List op, List numbers, List acc) { + if (op.isEmpty) { + return List.from(acc); + } + + List ret = []; + var monoFactor = [Factor( + content: numbers[0].toString(), + value: numbers[0], + )]; + + switch (op[0]) { + case Operator.Mul: + ret.addAll(apply(op[0], acc, monoFactor)); + break; + case Operator.Div: + ret.addAll(apply(op[0], acc, monoFactor)); + ret.addAll(apply(op[0], monoFactor, acc)); + break; + case Operator.Sub: + ret.addAll(apply(op[0], acc, monoFactor)); + ret.addAll(apply(op[0], monoFactor, acc)); + break; + case Operator.Plus: + ret.addAll(apply(op[0], acc, monoFactor)); + break; + } + + return _calc( + op.sublist(1), + numbers.sublist(1), + ret + ); + } + + return _calc( + op, + numbers.sublist(1), + [Factor(content: numbers[0].toString(), value: numbers[0])] + ); +} + +List solutions(List numbers) { + List ret = []; + Set hashSet = {}; + + for (var ops in OpIter()) { + for (var order in orders()) { + var orderedNumbers = applyOrder(numbers, order); + var results = calc(ops, orderedNumbers); + + for (var factor in results) { + if (factor.value == 24 && !hashSet.contains(factor.content)) { + hashSet.add(factor.content); + ret.add(factor); + } + } + } + } + + return ret; +} + +class OpIter extends Iterable> { + @override + Iterator> get iterator => _OpIterator(); +} + +class _OpIterator implements Iterator> { + int _index = 0; + static const List OPTIONS = [ + Operator.Mul, + Operator.Sub, + Operator.Plus, + Operator.Div + ]; + + @override + List get current { + final f1 = OPTIONS[(_index & (3 << 4)) >> 4]; + final f2 = OPTIONS[(_index & (3 << 2)) >> 2]; + final f3 = OPTIONS[(_index & 3)]; + return [f1, f2, f3]; + } + + @override + bool moveNext() { + if (_index >= 1 << 6) { + return false; + } + _index++; + return true; + } +} + +List> orders() { + return [ + [0, 1, 2, 3], + [0, 1, 3, 2], + [0, 2, 1, 3], + [0, 2, 3, 1], + [0, 3, 1, 2], + [0, 3, 2, 1], + [1, 0, 2, 3], + [1, 0, 3, 2], + [1, 2, 0, 3], + [1, 2, 3, 0], + [1, 3, 0, 2], + [1, 3, 2, 0], + [2, 0, 1, 3], + [2, 0, 3, 1], + [2, 1, 0, 3], + [2, 1, 3, 0], + [2, 3, 0, 1], + [2, 3, 1, 0], + [3, 0, 1, 2], + [3, 0, 2, 1], + [3, 1, 0, 2], + [3, 1, 2, 0], + [3, 2, 0, 1], + [3, 2, 1, 0] + ]; +} + +List applyOrder(List numbers, List order) { + return [ + numbers[order[0]], + numbers[order[1]], + numbers[order[2]], + numbers[order[3]] + ]; +} + +void main(List args) { + List numbers = []; + + if (args.isNotEmpty) { + String input = args[0]; + for (var char in input.split('')) { + int n = int.tryParse(char); + if (n != null) { + numbers.add(n); + } + + if (numbers.length == 4) { + var sols = solutions(numbers); + var len = sols.length; + + if (len == 0) { + print('no solution for ${numbers[0]}, ${numbers[1]}, ${numbers[2]}, ${numbers[3]}'); + return; + } + + print('solutions for ${numbers[0]}, ${numbers[1]}, ${numbers[2]}, ${numbers[3]}'); + for (var s in sols) { + print(s.content); + } + print('$len solutions found'); + return; + } + } + } else { + print('empty input'); + } +} diff --git a/Task/24-game-Solve/Elixir/24-game-solve.elixir b/Task/24-game-Solve/Elixir/24-game-solve.ex similarity index 100% rename from Task/24-game-Solve/Elixir/24-game-solve.elixir rename to Task/24-game-Solve/Elixir/24-game-solve.ex diff --git a/Task/24-game-Solve/Fortran/24-game-solve-3.f b/Task/24-game-Solve/Fortran/24-game-solve-3.f new file mode 100644 index 0000000000..c3f0095d7a --- /dev/null +++ b/Task/24-game-Solve/Fortran/24-game-solve-3.f @@ -0,0 +1,481 @@ +module game24_module + use omp_lib + use iso_fortran_env, only: int64 + implicit none + ! Define constants + integer, parameter :: max_limit = 8 ! Maximum allowed value for the number of inputs + integer, parameter :: expr_len = 200 ! Maximum length for expressions + + ! Precomputed total calls for n=6,7,8 + integer(int64), parameter :: total_calls_n6 = 20000000_int64 + integer(int64), parameter :: total_calls_n7 = 2648275200_int64 + integer(int64), parameter :: total_calls_n8 = 444557593600_int64 + + !----------------------- Progress Indicator Variables --------------------- + integer(int64) :: total_calls = 0 ! Total number of recursive calls + integer(int64) :: completed_calls = 0 ! Number of completed recursive calls + integer :: last_percentage = -1 ! Last percentage reported + integer, parameter :: progress_bar_width = 50 ! Width of the progress bar + character(len=1) :: carriage_return = char(13) ! Carriage return character + logical :: show_progress = .false. ! Flag to show progress bar + !-------------------------------------------------------------------------- +contains + + !----------------------------------------------------------------------- + ! ! Aborted function: calculate_total_calls + ! ! Description: + ! ! Estimates the total number of recursive calls for a given n, + ! ! considering commutativity (addition and multiplication). + ! ! Arguments: + ! ! n: The number of input numbers. + ! ! Returns: + ! ! The estimated total number of recursive calls as an integer. + ! !----------------------------------------------------------------------- + ! integer function calculate_total_calls(n) + ! implicit none + ! integer, intent(in) :: n + ! integer :: k + ! calculate_total_calls = 1 + ! do k = 2, n + ! ! For each pair, there are 6 possible operations: + ! ! 1 addition, 1 multiplication (commutative) + ! ! 2 subtraction, 2 division (non-commutative) + ! calculate_total_calls = calculate_total_calls * ((k * (k - 1)) / 2) * 6 + ! end do + ! end function calculate_total_calls + + !----------------------------------------------------------------------- + ! Subroutine: convert_to_number + ! Description: + ! Converts user input (numbers or card values) into numeric values. + ! Handles card values such as 'A', 'J', 'Q', 'K' and converts them into + ! corresponding numbers (A=1, J=11, Q=12, K=13). + ! Arguments: + ! input_str: Input string representing the number or card. + ! number: Output real number after conversion. + ! ios: I/O status indicator (0 for success, non-zero for error). + !----------------------------------------------------------------------- + subroutine convert_to_number(input_str, number, ios) + implicit none + character(len=*), intent(in) :: input_str + real, intent(out) :: number + integer, intent(out) :: ios + character(len=1) :: first_char + real :: temp_number + + ios = 0 ! Reset the I/O status to 0 (valid input by default) + first_char = input_str(1:1) + + select case (first_char) + case ('A', 'a') + number = 1.0 + case ('J', 'j') + number = 11.0 + case ('Q', 'q') + number = 12.0 + case ('K', 'k') + number = 13.0 + case default + read (input_str, *, iostat=ios) temp_number ! Attempt to read a real number + + ! If input is not a valid real number or is not an integer, set ios to 1 + if (ios /= 0 .or. mod(temp_number, 1.0) /= 0.0) then + ios = 1 ! Invalid input + else + number = temp_number ! Valid integer input + end if + end select + end subroutine convert_to_number + + !----------------------------------------------------------------------- + ! Subroutine: remove_decimal_zeros + ! Description: + ! Removes trailing zeros after the decimal point from a string. + ! Arguments: + ! str: Input string that may contain trailing zeros. + ! result: Output string with trailing zeros removed. + !----------------------------------------------------------------------- + subroutine remove_decimal_zeros(str, result) + implicit none + character(len=*), intent(in) :: str ! Input: String to remove zeros from + character(len=*), intent(out) :: result ! Output: String without trailing zeros + integer :: i, len_str ! Loop counter and string length + + len_str = len_trim(str) + result = adjustl(str(1:len_str)) + + ! Find the position of the decimal point + i = index(result, '.') + + ! If there's a decimal point, remove trailing zeros + if (i > 0) then + do while (len_str > i .and. result(len_str:len_str) == '0') + len_str = len_str - 1 + end do + if (result(len_str:len_str) == '.') len_str = len_str - 1 + result = result(1:len_str) + end if + end subroutine remove_decimal_zeros + + !----------------------------------------------------------------------- + ! Subroutine: create_new_arrays + ! Description: + ! Creates new arrays after performing an operation. + ! Arguments: + ! nums: Input array of numbers. + ! exprs: Input array of expressions. + ! idx1: Index of the first element to remove. + ! idx2: Index of the second element to remove. + ! result: Result of the operation. + ! new_expr: New expression string. + ! new_nums: Output array of numbers with elements removed and result added. + ! new_exprs: Output array of expressions with elements removed and new_expr added. + !----------------------------------------------------------------------- + subroutine create_new_arrays(nums, exprs, idx1, idx2, result, new_expr, new_nums, new_exprs) + implicit none + real, intent(in) :: nums(:) ! Input: Array of numbers + character(len=expr_len), intent(in) :: exprs(:) ! Input: Array of expressions + integer, intent(in) :: idx1, idx2 ! Input: Indices of elements to remove + real, intent(in) :: result ! Input: Result of the operation + character(len=expr_len), intent(in) :: new_expr ! Input: New expression + real, allocatable, intent(out) :: new_nums(:) ! Output: New array of numbers + character(len=expr_len), allocatable, intent(out) :: new_exprs(:) ! Output: New array of expressions + integer :: i, j, n ! Loop counters and size of input arrays + + n = size(nums) + allocate (new_nums(n - 1)) + allocate (new_exprs(n - 1)) + + j = 0 + do i = 1, n + if (i /= idx1 .and. i /= idx2) then + j = j + 1 + new_nums(j) = nums(i) + new_exprs(j) = exprs(i) + end if + end do + + ! Add the result of the operation to the new arrays + new_nums(n - 1) = result + new_exprs(n - 1) = new_expr + end subroutine create_new_arrays + + !----------------------------------------------------------------------- + ! Subroutine: update_progress_bar + ! Description: + ! Updates and displays the horizontal percentage-based progress bar. + ! Arguments: + ! None + !----------------------------------------------------------------------- + subroutine update_progress_bar() + implicit none + real :: percentage + integer :: filled_length + character(len=progress_bar_width) :: bar + integer :: int_percentage + + if (total_calls == 0 .or. .not. show_progress) return ! Avoid division by zero and check the flag + + percentage = real(completed_calls) / real(total_calls) * 100.0 + + ! Ensure percentage does not exceed 100% + if (percentage > 100.0) percentage = 100.0 + + ! Calculate integer percentage + int_percentage = int(percentage) + + ! Update progress bar only when percentage increases by at least 1% + if (int_percentage > last_percentage) then + last_percentage = int_percentage + + ! Calculate the filled length of the progress bar + filled_length = min(int(percentage / 100.0 * progress_bar_width), progress_bar_width) + + ! Construct the progress bar string + bar = repeat('=', filled_length) + if (filled_length < progress_bar_width) then + bar = bar//'>'//repeat(' ', progress_bar_width - filled_length - 1) + end if + + ! Print the progress bar and integer percentage + write (*, '(A, F4.1, A)', advance='no') carriage_return//'['//bar//'] ', percentage, '%' + call flush (0) ! Ensure output is displayed immediately + end if + end subroutine update_progress_bar + + !----------------------------------------------------------------------- + ! Recursive Subroutine: solve_24 + ! Description: + ! Recursively solves the 24 game by trying all possible operations. + ! Utilizes OpenMP tasks for parallelization. + ! Arguments: + ! nums: Array of numbers to use in the game. + ! exprs: Array of string expressions representing the numbers. + ! found: Logical flag indicating if a solution has been found. + !----------------------------------------------------------------------- + recursive subroutine solve_24(nums, exprs, found) + use omp_lib + implicit none + real, intent(in) :: nums(:) ! Input: Array of numbers + character(len=expr_len), intent(in) :: exprs(:) ! Input: Array of expressions + logical, intent(inout) :: found ! Input/Output: Flag indicating if a solution is found + integer :: n ! Size of the input arrays + integer :: i, j, op ! Loop counters + real :: a, b, result ! Temporary variables for calculations + real, allocatable :: new_nums(:) ! Temp array to store numbers after an operation + character(len=expr_len), allocatable :: new_exprs(:) ! Temp array to store expressions after an operation + character(len=expr_len) :: expr_a, expr_b, new_expr ! Temp variables for expressions + + n = size(nums) + + ! Increment the completed_calls counter and update progress bar + if (show_progress) then + !$omp atomic + completed_calls = completed_calls + 1 + call update_progress_bar() + end if + + ! If a solution is found, return + if (found) return + + ! Base case: If only one number is left, check if it is 24 + if (n == 1) then + if (abs(nums(1) - 24.0) < 1e-4) then + if (show_progress) then + write (*, '(A, F5.1, A)', advance='no') carriage_return//'['//repeat('=', progress_bar_width)//'] ', 100.0, '%' + write (*, '(A)') '' ! Insert a blank line + end if + !$omp critical + write (*, '(A, A, A, F10.7, A)') 'Solution found:', trim(exprs(1)), '= 24 (', nums(1), ')' + found = .true. + !$omp end critical + end if + return + end if + + ! Iterate over all pairs of numbers + do i = 1, n - 1 + do j = i + 1, n + a = nums(i) + b = nums(j) + expr_a = exprs(i) + expr_b = exprs(j) + + ! Iterate over all operators + do op = 1, 4 + ! Avoid division by zero + if ((op == 4 .and. abs(b) < 1e-6)) cycle + + ! Perform the operation and create the new expression + select case (op) + case (1) + result = a + b + new_expr = '('//trim(expr_a)//'+'//trim(expr_b)//')' + case (2) + result = a - b + new_expr = '('//trim(expr_a)//'-'//trim(expr_b)//')' + case (3) + result = a * b + new_expr = '('//trim(expr_a)//'*'//trim(expr_b)//')' + case (4) + result = a / b + new_expr = '('//trim(expr_a)//'/'//trim(expr_b)//')' + end select + + ! Create new arrays with the selected numbers removed + call create_new_arrays(nums, exprs, i, j, result, new_expr, new_nums, new_exprs) + + ! For the first few recursion levels, create parallel tasks + if (n >= 6 .and. omp_get_level() < 2) then + !$omp task shared(found) firstprivate(new_nums, new_exprs) + call solve_24(new_nums, new_exprs, found) + !$omp end task + else + call solve_24(new_nums, new_exprs, found) + end if + + ! If a solution is found, deallocate memory and return + if (found) then + deallocate (new_nums) + deallocate (new_exprs) + return + end if + + ! Handle commutative operations only once + if (op == 1 .or. op == 3) cycle + + ! Swap operands for subtraction and division + if (op == 2 .or. op == 4) then + if (op == 4 .and. abs(a) < 1e-6) cycle ! Avoid division by zero + + select case (op) + case (2) + result = b - a + new_expr = '('//trim(expr_b)//'-'//trim(expr_a)//')' + case (4) + result = b / a + new_expr = '('//trim(expr_b)//'/'//trim(expr_a)//')' + end select + + ! Create new arrays with the selected numbers removed + call create_new_arrays(nums, exprs, i, j, result, new_expr, new_nums, new_exprs) + + ! For the first few recursion levels, create parallel tasks + if (n >= 6 .and. omp_get_level() < 2) then + !$omp task shared(found) firstprivate(new_nums, new_exprs) + call solve_24(new_nums, new_exprs, found) + !$omp end task + else + ! Recursively call the solve_24 function with the new arrays + call solve_24(new_nums, new_exprs, found) + end if + + ! If a solution is found, deallocate memory and return + if (found) then + deallocate (new_nums) + deallocate (new_exprs) + return + end if + end if + + end do ! End of operator loop + end do ! End of j loop + end do ! End of i loop + end subroutine solve_24 + +end module game24_module + +program game24 + use game24_module + implicit none + + ! Declare variables + integer :: maxn ! Number of numbers to be entered by the user + real, allocatable :: numbers(:) ! Array to store the numbers entered by the user + character(len=expr_len), allocatable :: expressions(:) ! Array to store the expressions + integer :: i, ios ! Loop counter and I/O status + logical :: found_solution ! Flag to indicate if a solution was found + character(len=10) :: user_input ! Variable to store user input + character(len=1) :: play_again ! Variable to store the user's decision + + do ! Game loop to allow restarting the game + + ! Prompt the user for the number of numbers to use in the game + do + write (*, '(A,I0,A)', advance='no') 'Enter the number of numbers (1 to ', max_limit, '): ' + read (*, *, iostat=ios) maxn + + ! Check if the input is valid + if (ios /= 0) then + write (*, '(A,I0,A)') 'Invalid input. Please enter an integer between 1 and ', max_limit, '.' + cycle + end if + + ! Validate the input: Ensure the number of numbers is within the valid range + if (maxn < 1 .or. maxn > max_limit) then + write (*, '(A,I0,A)') 'Error: Number of numbers must be between 1 and ', max_limit, '. Try again.' + cycle + end if + + exit ! Exit loop if the input is valid + end do + + ! Allocate memory for the arrays based on the number of numbers + allocate (numbers(maxn)) + allocate (expressions(maxn)) + + ! Prompt the user to enter the numbers or card values + write (*, '(A,I0,A)') 'Enter ', maxn, ' numbers or card values (A=1, J=11, Q=12, K=13).' + do i = 1, maxn + do + ! Prompt the user to enter a number or card value + write (*, '(A,I0,A)', advance='no') 'Enter value for card ', i, ': ' + read (*, '(A)', iostat=ios) user_input + + ! Check if input is an integer or valid card symbol (A, J, Q, K) + call convert_to_number(user_input, numbers(i), ios) + + ! If the input is valid, exit loop + if (ios == 0) exit + + ! Invalid input: prompt the user to try again + write (*, '(A)') 'Invalid input. Please enter an integer or valid card symbol (A, J, Q, K).' + end do + + ! Convert the number to a string expression and remove trailing zeros + write (expressions(i), '(F0.2)') numbers(i) + call remove_decimal_zeros(expressions(i), expressions(i)) + end do + + ! Initialize the solution flag to false + found_solution = .false. + + ! Assign precomputed total_calls based on n + select case (maxn) + case (6) + total_calls = total_calls_n6 + case (7) + total_calls = total_calls_n7 + case (8) + total_calls = total_calls_n8 + case default + total_calls = 0 + end select + + ! Decide whether to show progress bar based on n + if (maxn >= 6) then + show_progress = .true. + completed_calls = 0 + last_percentage = -1 + + ! Initialize progress bar display + write (*, '(A)', advance='no') '['//repeat(' ', progress_bar_width)//'] 0%' + call flush (0) ! Ensure the output is displayed immediately + else + show_progress = .false. + end if + + ! Start parallel region + !$omp parallel + !$omp single nowait + call solve_24(numbers, expressions, found_solution) + !$omp end single + !$omp end parallel + + ! After search completes, ensure the progress bar reaches 100% if shown + if (show_progress .and. .not. found_solution) then + write (*, '(A, A)', advance='no') carriage_return//'['//repeat('=', progress_bar_width)//'] 100% ' + call flush (0) + write (*, '(A)') '' ! Insert a blank line + end if + + ! If a solution was found and progress bar is shown, ensure a blank line + if (show_progress .and. found_solution) then + ! Progress bar already refreshed to 100% and blank line inserted in solve_24 + end if + + ! If no solution was found, print a message + if (.not. found_solution) then + write (*, '(A)') 'No valid solution found.' + end if + + ! Deallocate the memory used by the arrays + deallocate (numbers) + deallocate (expressions) + + ! Ask the user if they want to play again + if (show_progress) then + write (*, '(A)', advance='no') carriage_return//'Play again? (Enter y/n to continue or any other key to exit): ' + else + write (*, '(A)', advance='no') 'Play again? (Enter y/n to continue or any other key to exit): ' + end if + read (*, '(A)') play_again ! Read user input + + ! Check if the user wants to exit + if (play_again /= 'y' .and. play_again /= 'Y') exit + + end do ! End of game loop + + write (*, '(A)') 'Exiting the game...' + +end program game24 diff --git a/Task/24-game-Solve/FreeBASIC/24-game-solve.basic b/Task/24-game-Solve/FreeBASIC/24-game-solve.basic new file mode 100644 index 0000000000..4593f64cb2 --- /dev/null +++ b/Task/24-game-Solve/FreeBASIC/24-game-solve.basic @@ -0,0 +1,124 @@ +Type GameState + digitos(3) As Double + operaciones(2) As String +End Type + +Function randomDigits() As String + Dim As String resultado = "" + For i As Integer = 0 To 3 + resultado &= Str(Int(Rnd * 9) + 1) + Next + Return resultado +End Function + +Function evaluate(digitos() As Double, operaciones() As String) As Double + Dim As Double valor = digitos(0) + + For i As Integer = 0 To 2 + Select Case operaciones(i) + Case "+": valor += digitos(i +1) + Case "-": valor -= digitos(i +1) + Case "*": valor *= digitos(i +1) + Case "/": If digitos(i +1) <> 0 Then valor /= digitos(i +1) + End Select + Next + + Return valor +End Function + +Sub permute(digitos() As Double, soluciones() As GameState, Byref solutionCnt As Integer, k As Integer) + Dim As String*1 opChars(3) = {"+", "-", "*", "/"} + Dim As String ops(2) + Dim As Integer i, j, l, m + + If k = 4 Then + For i = 0 To 3 + ops(0) = opChars(i) + For j = 0 To 3 + ops(1) = opChars(j) + For l = 0 To 3 + ops(2) = opChars(l) + If Abs(evaluate(digitos(), ops()) - 24) < 0.001 Then + With soluciones(solutionCnt) + For m = 0 To 3: .digitos(m) = digitos(m): Next + For m = 0 To 2: .operaciones(m) = ops(m): Next + End With + solutionCnt += 1 + Exit For 'Stop after first solution + End If + Next + If solutionCnt Then Exit For + Next + If solutionCnt Then Exit For + Next + Else + For i = k To 3 + Swap digitos(i), digitos(k) + permute(digitos(), soluciones(), solutionCnt, k +1) + If solutionCnt Then Exit For + Swap digitos(k), digitos(i) + Next + End If +End Sub + +' Main program +Randomize Timer +Dim As Integer i +Dim As String cmd +Dim As Double digitos(3) +Dim As String operaciones(2) + +Do + Cls + Print "24 Game" + Print "Generating 4 digitos..." + + Dim As String inputDigits = randomDigits() + Print "Make 24 using these digitos: "; + For i = 1 To Len(inputDigits) + Print Mid(inputDigits, i, 1); " "; + Next + Print + + Line Input "Enter your expression (e.g. 4+5*3-2): ", cmd + + Dim As Integer digitCnt = 0, opCnt = 0 + ' Parse user input + For i = 1 To Len(cmd) + Select Case Mid(cmd, i, 1) + Case "1" To "9" + digitos(digitCnt) = Val(Mid(cmd, i, 1)) + digitCnt += 1 + Case "+", "-", "*", "/" + operaciones(opCnt) = Mid(cmd, i, 1) + opCnt += 1 + End Select + Next + + Dim As Double resultado = evaluate(digitos(), operaciones()) + Print "Your resultado: "; resultado + + If Abs(resultado - 24) < 0.001 Then + Print !"\nCongratulations, you found a solution!" + Else + Print !"\nThe valor of your expression is "; resultado; " instead of 24!" + + Dim As GameState soluciones(1000) + Dim As Integer solucCnt = 0 + + permute(digitos(), soluciones(), solucCnt, 0) + + If solucCnt > 0 Then + Print !"\nA possible solution could have been: "; + With soluciones(0) + Print .digitos(0) & .operaciones(0) & .digitos(1) & .operaciones(1) & .digitos(2) & .operaciones(2) & .digitos(3) + End With + Else + Print !"\nThere was no known solution for these digitos." + End If + End If + + Print !"\nDo you want to try again? (press N for exit, other key to continue)" +Loop Until (Ucase(Input(1)) = "N") + +Sleep diff --git a/Task/24-game-Solve/FutureBasic/24-game-solve.basic b/Task/24-game-Solve/FutureBasic/24-game-solve.basic index 5a2f9b5cf2..4f6e1c9984 100644 --- a/Task/24-game-Solve/FutureBasic/24-game-solve.basic +++ b/Task/24-game-Solve/FutureBasic/24-game-solve.basic @@ -15,7 +15,6 @@ void local fn eval( t as CFStringRef ) end if end fn - clear local fn work( t as CFStringRef ) Short a, b, c, d, e, f, g CGFloat n(3) @@ -44,7 +43,6 @@ clear local fn work( t as CFStringRef ) next : next : next : next end fn - window 1, @"24 Game", ( 0, 0, 250, 250 ) fn work(@"3388") fn work(@"1346") diff --git a/Task/24-game-Solve/Julia/24-game-solve.julia b/Task/24-game-Solve/Julia/24-game-solve.jl similarity index 100% rename from Task/24-game-Solve/Julia/24-game-solve.julia rename to Task/24-game-Solve/Julia/24-game-solve.jl diff --git a/Task/24-game-Solve/Kotlin/24-game-solve.kotlin b/Task/24-game-Solve/Kotlin/24-game-solve.kts similarity index 100% rename from Task/24-game-Solve/Kotlin/24-game-solve.kotlin rename to Task/24-game-Solve/Kotlin/24-game-solve.kts diff --git a/Task/24-game-Solve/OCaml/24-game-solve.ocaml b/Task/24-game-Solve/OCaml/24-game-solve.ml similarity index 100% rename from Task/24-game-Solve/OCaml/24-game-solve.ocaml rename to Task/24-game-Solve/OCaml/24-game-solve.ml diff --git a/Task/24-game-Solve/Rust/24-game-solve.rust b/Task/24-game-Solve/Rust/24-game-solve.rs similarity index 100% rename from Task/24-game-Solve/Rust/24-game-solve.rust rename to Task/24-game-Solve/Rust/24-game-solve.rs diff --git a/Task/24-game-Solve/Scheme/24-game-solve-1.ss b/Task/24-game-Solve/Scheme/24-game-solve-1.scm similarity index 100% rename from Task/24-game-Solve/Scheme/24-game-solve-1.ss rename to Task/24-game-Solve/Scheme/24-game-solve-1.scm diff --git a/Task/24-game-Solve/Scheme/24-game-solve-2.ss b/Task/24-game-Solve/Scheme/24-game-solve-2.scm similarity index 100% rename from Task/24-game-Solve/Scheme/24-game-solve-2.ss rename to Task/24-game-Solve/Scheme/24-game-solve-2.scm diff --git a/Task/24-game-Solve/Wren/24-game-solve.wren b/Task/24-game-Solve/Wren/24-game-solve.wren index da5205ec40..838e70022f 100644 --- a/Task/24-game-Solve/Wren/24-game-solve.wren +++ b/Task/24-game-Solve/Wren/24-game-solve.wren @@ -1,5 +1,5 @@ import "random" for Random -import "/dynamic" for Tuple, Enum, Struct +import "./dynamic" for Tuple, Enum, Struct var N_CARDS = 4 var SOLVE_GOAL = 24 diff --git a/Task/24-game-Solve/Zig/24-game-solve.zig b/Task/24-game-Solve/Zig/24-game-solve.zig new file mode 100644 index 0000000000..1837c9404d --- /dev/null +++ b/Task/24-game-Solve/Zig/24-game-solve.zig @@ -0,0 +1,273 @@ +const std = @import("std"); +const print = std.debug.print; +const ArrayList = std.ArrayList; +const HashMap = std.HashMap; +const Allocator = std.mem.Allocator; + +const Operator = enum { + sub, + plus, + mul, + div, +}; + +const Factor = struct { + content: []const u8, + value: i32, + + fn deinit(self: Factor, allocator: Allocator) void { + allocator.free(self.content); + } +}; + +fn apply(allocator: Allocator, op: Operator, left: []const Factor, right: []const Factor) !ArrayList(Factor) { + var ret = ArrayList(Factor).init(allocator); + + for (left) |l| { + for (right) |r| { + switch (op) { + .sub => { + if (l.value > r.value) { + const content = try std.fmt.allocPrint(allocator, "({s} - {s})", .{ l.content, r.content }); + try ret.append(Factor{ + .content = content, + .value = l.value - r.value, + }); + } + }, + .plus => { + const content = try std.fmt.allocPrint(allocator, "({s} + {s})", .{ l.content, r.content }); + try ret.append(Factor{ + .content = content, + .value = l.value + r.value, + }); + }, + .mul => { + const content = try std.fmt.allocPrint(allocator, "({s} x {s})", .{ l.content, r.content }); + try ret.append(Factor{ + .content = content, + .value = l.value * r.value, + }); + }, + .div => { + if (l.value >= r.value and r.value > 0 and @rem(l.value, r.value) == 0) { + const content = try std.fmt.allocPrint(allocator, "({s} / {s})", .{ l.content, r.content }); + try ret.append(Factor{ + .content = content, + .value = @divTrunc(l.value, r.value), + }); + } + }, + } + } + } + + return ret; +} + +fn calc(allocator: Allocator, ops: [3]Operator, numbers: [4]i32) !ArrayList(Factor) { + var current_factors = ArrayList(Factor).init(allocator); + defer { + for (current_factors.items) |factor| { + factor.deinit(allocator); + } + current_factors.deinit(); + } + + // Initialize with first number + const initial_content = try std.fmt.allocPrint(allocator, "{}", .{numbers[0]}); + try current_factors.append(Factor{ + .content = initial_content, + .value = numbers[0], + }); + + // Process each operation + for (ops, 0..) |op, i| { + var next_factors = ArrayList(Factor).init(allocator); + defer { + for (next_factors.items) |factor| { + factor.deinit(allocator); + } + next_factors.deinit(); + } + + const mono_content = try std.fmt.allocPrint(allocator, "{}", .{numbers[i + 1]}); + defer allocator.free(mono_content); + const mono_factor = Factor{ + .content = mono_content, + .value = numbers[i + 1], + }; + const mono_slice = &[_]Factor{mono_factor}; + + switch (op) { + .mul, .plus => { + var applied = try apply(allocator, op, current_factors.items, mono_slice); + defer applied.deinit(); + try next_factors.appendSlice(applied.items); + }, + .div, .sub => { + var applied1 = try apply(allocator, op, current_factors.items, mono_slice); + defer applied1.deinit(); + try next_factors.appendSlice(applied1.items); + + var applied2 = try apply(allocator, op, mono_slice, current_factors.items); + defer applied2.deinit(); + try next_factors.appendSlice(applied2.items); + }, + } + + // Clear current factors and move next_factors to current_factors + for (current_factors.items) |factor| { + factor.deinit(allocator); + } + current_factors.clearRetainingCapacity(); + + // Move ownership from next_factors to current_factors + try current_factors.appendSlice(next_factors.items); + next_factors.clearRetainingCapacity(); // Don't deinit the items, we moved them + } + + // Create result and transfer ownership + var result = ArrayList(Factor).init(allocator); + try result.appendSlice(current_factors.items); + current_factors.clearRetainingCapacity(); // Don't deinit, we transferred ownership + + return result; +} + +const OpIter = struct { + index: usize, + + const OPTIONS = [_]Operator{ .mul, .sub, .plus, .div }; + + fn init() OpIter { + return OpIter{ .index = 0 }; + } + + fn next(self: *OpIter) ?[3]Operator { + if (self.index >= 64) { + return null; + } + + const f1 = OPTIONS[(self.index & (3 << 4)) >> 4]; + const f2 = OPTIONS[(self.index & (3 << 2)) >> 2]; + const f3 = OPTIONS[(self.index & (3 << 0)) >> 0]; + + self.index += 1; + return [3]Operator{ f1, f2, f3 }; + } +}; + +fn orders() [24][4]usize { + return [24][4]usize{ + [4]usize{ 0, 1, 2, 3 }, + [4]usize{ 0, 1, 3, 2 }, + [4]usize{ 0, 2, 1, 3 }, + [4]usize{ 0, 2, 3, 1 }, + [4]usize{ 0, 3, 1, 2 }, + [4]usize{ 0, 3, 2, 1 }, + [4]usize{ 1, 0, 2, 3 }, + [4]usize{ 1, 0, 3, 2 }, + [4]usize{ 1, 2, 0, 3 }, + [4]usize{ 1, 2, 3, 0 }, + [4]usize{ 1, 3, 0, 2 }, + [4]usize{ 1, 3, 2, 0 }, + [4]usize{ 2, 0, 1, 3 }, + [4]usize{ 2, 0, 3, 1 }, + [4]usize{ 2, 1, 0, 3 }, + [4]usize{ 2, 1, 3, 0 }, + [4]usize{ 2, 3, 0, 1 }, + [4]usize{ 2, 3, 1, 0 }, + [4]usize{ 3, 0, 1, 2 }, + [4]usize{ 3, 0, 2, 1 }, + [4]usize{ 3, 1, 0, 2 }, + [4]usize{ 3, 1, 2, 0 }, + [4]usize{ 3, 2, 0, 1 }, + [4]usize{ 3, 2, 1, 0 }, + }; +} + +fn applyOrder(numbers: [4]i32, order: [4]usize) [4]i32 { + return [4]i32{ numbers[order[0]], numbers[order[1]], numbers[order[2]], numbers[order[3]] }; +} + +fn solutions(allocator: Allocator, numbers: [4]i32) !ArrayList(Factor) { + var ret = ArrayList(Factor).init(allocator); + var hash_set = HashMap([]const u8, void, std.hash_map.StringContext, std.hash_map.default_max_load_percentage).init(allocator); + defer { + // Free all keys in the hash map + var iterator = hash_set.iterator(); + while (iterator.next()) |entry| { + allocator.free(entry.key_ptr.*); + } + hash_set.deinit(); + } + + var op_iter = OpIter.init(); + while (op_iter.next()) |ops| { + const all_orders = orders(); + for (all_orders) |order| { + const reordered_numbers = applyOrder(numbers, order); + var results = calc(allocator, ops, reordered_numbers) catch continue; + defer { + for (results.items) |factor| { + factor.deinit(allocator); + } + results.deinit(); + } + + for (results.items) |factor| { + if (factor.value == 24) { + // Check if we've seen this content before + if (hash_set.contains(factor.content)) { + continue; + } + + // Add to hash set with a duplicated key + const key_copy = try allocator.dupe(u8, factor.content); + try hash_set.put(key_copy, {}); + + // Add to results with a duplicated content + try ret.append(Factor{ + .content = try allocator.dupe(u8, factor.content), + .value = factor.value, + }); + } + } + } + } + + return ret; +} + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer _ = gpa.deinit(); + const allocator = gpa.allocator(); + + // Hard-coded input: 5598 + const nums = [4]i32{ 5, 5, 9, 8 }; + + var sols = solutions(allocator, nums) catch { + print("Error computing solutions\n", .{}); + return; + }; + defer { + for (sols.items) |factor| { + factor.deinit(allocator); + } + sols.deinit(); + } + + const len = sols.items.len; + if (len == 0) { + print("no solution for {}, {}, {}, {}\n", .{ nums[0], nums[1], nums[2], nums[3] }); + return; + } + + print("solutions for {}, {}, {}, {}\n", .{ nums[0], nums[1], nums[2], nums[3] }); + for (sols.items) |s| { + print("{s}\n", .{s.content}); + } + print("{} solutions found\n", .{len}); +} diff --git a/Task/24-game/11l/24-game.11l b/Task/24-game/11l/24-game.11l index cd85851896..90d4d08a9a 100644 --- a/Task/24-game/11l/24-game.11l +++ b/Task/24-game/11l/24-game.11l @@ -9,7 +9,7 @@ T RPNParse F op(f) I .stk.len < 2 - X Error(‘Improperly written expression’) + X.throw Error(‘Improperly written expression’) V b = .stk.pop() V a = .stk.pop() .stk.append(f(a, b)) @@ -24,11 +24,11 @@ T RPNParse E I c == ‘*’ {.op((a, b) -> a * b)} E I c == ‘/’ {.op((a, b) -> a / b)} E I c != ‘ ’ - X Error(‘Wrong char: ’c) + X.throw Error(‘Wrong char: ’c) F get_result() I .stk.len != 1 - X Error(‘Improperly written expression’) + X.throw Error(‘Improperly written expression’) R .stk.last [Int] digits diff --git a/Task/24-game/ALGOL-68/24-game.alg b/Task/24-game/ALGOL-68/24-game.alg new file mode 100644 index 0000000000..b74144035a --- /dev/null +++ b/Task/24-game/ALGOL-68/24-game.alg @@ -0,0 +1,109 @@ +BEGIN # play the 24 game - present the user with 4 digits and invite them to # + # enter an expression using the digits that evaluates to 24 # + + [ 0 : 9 ]INT expression digits; # the digits entered by the user # + [ 0 : 9 ]INT puzzle digits; # the digits for the puzzle # + PROC eval = ( STRING expr )REAL: # parses and evaluates expr # + BEGIN + # syntax: expression = term ( ( "+" | "-" ) term )* # + # term = factor ( ( "*" | "/" ) factor ) * # + # factor = "0" | "1" | "2" | ... | "9" # + # | "(" expression ")" # + INT x pos := LWB expr - 1; + INT x end := UPB expr; + BOOL ok := TRUE; + PROC error = ( STRING msg )VOID: + IF ok THEN # this is the firstt error # + ok := FALSE; + print( ( msg, newline ) ); + x pos := x end + 1 + FI # error # ; + PROC curr ch = CHAR: IF x pos > x end THEN REPR 0 ELSE expr[ x pos ] FI; + PROC next ch = VOID: WHILE x pos +:= 1; curr ch = " " DO SKIP OD; + PROC factor = REAL: + IF curr ch >= "0" AND curr ch <= "9" THEN + INT digit = ABS curr ch - ABS "0"; + REAL result = digit; + expression digits[ digit ] +:= 1; + next ch; + result + ELIF curr ch = "(" THEN + next ch; + REAL result = expression; + IF curr ch = ")" THEN + next ch + ELSE + error( """)"" expected after sub-expression" ) + FI; + result + ELSE + error( "Unexpected """ + curr ch + """" ); + 0 + FI # factor # ; + PROC expr term = REAL: + BEGIN + REAL result := factor; + WHILE curr ch = "*" OR curr ch = "/" DO + CHAR op = curr ch; + next ch; + IF op = "*" THEN result *:= factor ELSE result /:= factor FI + OD; + result + END # expr term # ; + PROC expression = REAL: + BEGIN + REAL result := expr term; + WHILE curr ch = "+" OR curr ch = "-" DO + CHAR op = curr ch; + next ch; + IF op = "+" THEN result +:= expr term ELSE result -:= expr term FI + OD; + result + END # expression # ; + + next ch; + IF curr ch = REPR 0 THEN + error( "Missing expression" ); + 0 + ELSE + REAL result = expression; + IF curr ch /= REPR 0 THEN + error( "Unexpected text: """ + expr[ x pos : ] + """ after expression" ) + FI; + result + FI + END # eval # ; + + WHILE + FOR i FROM 0 TO 9 DO # initialise the digit counts # + expression digits[ i ] := 0; + puzzle digits[ i ] := 0 + OD; + print( ( "Enter an expression using these digits:" ) ); + TO 4 DO # pick 4 random digits # + INT digit := 1 + ENTIER ( next random * 9 ); + IF digit > 9 THEN digit := 9 FI; + puzzle digits[ digit ] +:= 1; + print( ( whole( digit, - 2 ) ) ) + OD; + print( ( " that evaluates to 24: " ) ); + # get and check the expression # + STRING expr; + read( ( expr, newline ) ); + REAL result = eval( expr ); + BOOL same := TRUE; + FOR i FROM 0 TO 9 WHILE same := puzzle digits[ i ] = expression digits[ i ] DO SKIP OD; + IF NOT same THEN + print( ( "That expression didn't contain the puzzle digits", newline ) ) + ELIF result = 24 THEN + print( ( "Yes! That expression evaluates to 24", newline ) ) + ELSE + print( ( "No - that expression evaluates to ", fixed( result, -8, 4 ), newline ) ) + FI; + print( ( newline, "Play again [y/n]? " ) ); + STRING play again; + read( ( play again, newline ) ); + play again = "y" OR play again = "Y" OR play again = "" + DO SKIP OD + +END diff --git a/Task/24-game/Ada/24-game.ada b/Task/24-game/Ada/24-game.adb similarity index 100% rename from Task/24-game/Ada/24-game.ada rename to Task/24-game/Ada/24-game.adb diff --git a/Task/24-game/Arturo/24-game.arturo b/Task/24-game/Arturo/24-game.arturo index a44398760e..0175c79a13 100644 --- a/Task/24-game/Arturo/24-game.arturo +++ b/Task/24-game/Arturo/24-game.arturo @@ -28,11 +28,10 @@ result: 0 while [result<>24][ got: input "Enter an expression to form 24: " blo: to :block got - if? validExpression? blo [ + switch validExpression? blo [ result: do blo print ["The result is:" result] - ] - else [ + ][ print "Invalid expression. Please try again!" ] print "" diff --git a/Task/24-game/AutoIt/24-game.autoit b/Task/24-game/AutoIt/24-game.au3 similarity index 100% rename from Task/24-game/AutoIt/24-game.autoit rename to Task/24-game/AutoIt/24-game.au3 diff --git a/Task/24-game/COBOL/24-game.cobol b/Task/24-game/COBOL/24-game.cob similarity index 100% rename from Task/24-game/COBOL/24-game.cobol rename to Task/24-game/COBOL/24-game.cob diff --git a/Task/24-game/Delphi/24-game.delphi b/Task/24-game/Delphi/24-game.pas similarity index 100% rename from Task/24-game/Delphi/24-game.delphi rename to Task/24-game/Delphi/24-game.pas diff --git a/Task/24-game/EasyLang/24-game.easy b/Task/24-game/EasyLang/24-game.easy new file mode 100644 index 0000000000..03d699645f --- /dev/null +++ b/Task/24-game/EasyLang/24-game.easy @@ -0,0 +1,68 @@ +print "Enter an equation in RPN form using all of, and only " +print "the following single digits which evaluates to 24:" +func game . + len cnt[] 9 + write ">> " + for i to 4 + h = random 1 9 + write h & " " + cnt[h] += 1 + . + print "" + s$ = input + print s$ + if s$ = "" + return 1 + . + for c$ in strchars s$ + if c$ = "+" or c$ = "-" or c$ = "*" or c$ = "/" + if len st[] < 2 + print "Stack empty" + return 1 + . + if c$ = "+" + st[$ - 1] = st[$ - 1] + st[$] + elif c$ = "-" + st[$ - 1] = st[$ - 1] - st[$] + elif c$ = "*" + st[$ - 1] = st[$ - 1] * st[$] + else + st[$ - 1] = st[$ - 1] / st[$] + . + len st[] -1 + elif c$ <> " " + h = strcode c$ - 48 + if h < 1 or h > 9 + print "Wrong command " & c$ + return 0 + . + if cnt[h] = 0 + print "Wrong number " & h + return 0 + . + cnt[h] -= 1 + st[] &= h + . + . + for c in cnt[] + s += c + . + if s > 0 + print "Not all numbers used" + return 0 + . + if len st[] > 1 + print "Calculation not finished" + return 0 + . + print st[1] + if abs (st[1] - 24) < 1e-10 + print "Well done" + else + print "Wrong result" + . +. +repeat + print "" + until game = 1 +. diff --git a/Task/24-game/Elena/24-game.elena b/Task/24-game/Elena/24-game.elena index fc6d5d8743..2a65ccecd2 100644 --- a/Task/24-game/Elena/24-game.elena +++ b/Task/24-game/Elena/24-game.elena @@ -13,18 +13,18 @@ class ExpressionTree { auto level := new Integer(0); - s.forEach:(ch) + s.forEach::(ch) { var node := new DynamicStruct(); ch => - $43 { node.Level := level + 1; node.Operation := mssg add } // + - $45 { node.Level := level + 1; node.Operation := mssg subtract } // - - $42 { node.Level := level + 2; node.Operation := mssg multiply } // * - $47 { node.Level := level + 2; node.Operation := mssg divide } // / - $40 { level.append(10); ^ self } // ( - $41 { level.reduce(10); ^ self } // ) - : { + $43 : { node.Level := level + 1; node.Operation := mssg add } // + + $45 : { node.Level := level + 1; node.Operation := mssg subtract } // - + $42 : { node.Level := level + 2; node.Operation := mssg multiply } // * + $47 : { node.Level := level + 2; node.Operation := mssg divide } // / + $40 : { level.append(10); ^ self } // ( + $41 : { level.reduce(10); ^ self } // ) + ! : { node.Leaf := ch.toString().toReal(); node.Level := level + 3 }; @@ -112,34 +112,34 @@ class TwentyFourGame { theNumbers := new object[] { - 1 + randomGenerator.nextInt:9, - 1 + randomGenerator.nextInt:9, - 1 + randomGenerator.nextInt:9, - 1 + randomGenerator.nextInt:9 + 1 + Random.nextInt(9), + 1 + Random.nextInt(9), + 1 + Random.nextInt(9), + 1 + Random.nextInt(9) } } help() { - console - .printLine:"------------------------------- Instructions ------------------------------" - .printLine:"Four digits will be displayed." - .printLine:"Enter an equation using all of those four digits that evaluates to 24" - .printLine:"Only * / + - operators and () are allowed" - .printLine:"Digits can only be used once, but in any order you need." - .printLine:"Digits cannot be combined - i.e.: 12 + 12 when given 1,2,2,1 is not allowed" - .printLine:"Submit a blank line to skip the current puzzle." - .printLine:"Type 'q' to quit" + Console + .printLine("------------------------------- Instructions ------------------------------") + .printLine("Four digits will be displayed.") + .printLine("Enter an equation using all of those four digits that evaluates to 24") + .printLine("Only * / + - operators and () are allowed") + .printLine("Digits can only be used once, but in any order you need.") + .printLine("Digits cannot be combined - i.e.: 12 + 12 when given 1,2,2,1 is not allowed") + .printLine("Submit a blank line to skip the current puzzle.") + .printLine("Type 'q' to quit") .writeLine() - .printLine:"Example: given 2 3 8 2, answer should resemble 8*3-(2-2)" - .printLine:"------------------------------- --------------------------------------------" + .printLine("Example: given 2 3 8 2, answer should resemble 8*3-(2-2)") + .printLine("------------------------------- --------------------------------------------") } prompt() { - theNumbers.forEach:(n){ console.print(n," ") }; + theNumbers.forEach::(n){ Console.print(n," ") }; - console.print:": " + Console.print(": ") } resolve(expr) @@ -147,24 +147,21 @@ class TwentyFourGame var tree := new ExpressionTree(expr); var leaves := new ArrayList(); - tree.readLeaves:leaves; + tree.readLeaves(leaves); - ifnot (leaves.ascendant().sequenceEqual(theNumbers.ascendant())) { - console - .printLine:"Invalid input. Enter an equation using all of those four digits. Try again."; - ^ self - }; + if:not (leaves.ascendant().sequenceEqual(theNumbers.ascendant())) + { Console.printLine("Invalid input. Enter an equation using all of those four digits. Try again."); ^ self }; var result := tree.Value; if (result == 24) { - console.printLine("Good work. ",expr,"=",result); + Console.printLine("Good work. ",expr,"=",result); self.newPuzzle() } else { - console.printLine("Incorrect. ",expr,"=",result) + Console.printLine("Incorrect. ",expr,"=",result) } } } @@ -181,7 +178,7 @@ extension gameOp { if (expr == "") { - console.printLine:"Skipping this puzzle"; self.newPuzzle() + Console.printLine("Skipping this puzzle"); self.newPuzzle() } else { @@ -191,8 +188,7 @@ extension gameOp } catch(Exception e) { - console.printLine:e - //console.printLine:"An error occurred. Check your input and try again." + Console.printLine("An error occurred. Check your input and try again.") } }; @@ -201,11 +197,11 @@ extension gameOp } } -// --- program --- +// --- Program --- -public program() +public Program() { var game := new TwentyFourGame().help(); - while (game.prompt().playRound(console.readLine())) {} + while (game.prompt().playRound(Console.readLine())) {} } diff --git a/Task/24-game/Elixir/24-game.elixir b/Task/24-game/Elixir/24-game.ex similarity index 100% rename from Task/24-game/Elixir/24-game.elixir rename to Task/24-game/Elixir/24-game.ex diff --git a/Task/24-game/Frink/24-game.frink b/Task/24-game/Frink/24-game.frink new file mode 100644 index 0000000000..a7a123bc86 --- /dev/null +++ b/Task/24-game/Frink/24-game.frink @@ -0,0 +1,15 @@ +ops = ["+", "-", "*", "/"] + +chosen = new array[[4], {|x| random[1,9]}] +println[chosen] + +for d = chosen.lexicographicPermute[] + multifor o = [ops, ops, ops] + { + str = "((" + d@0 + o@0 + d@1 + ")" + o@1 + d@2 + ")" + o@2 + d@3 + if eval[str] == 24 + println[str] + str = "(" + d@0 + o@0 + d@1 + ")" + o@1 + "(" + d@2 + + o@2 + d@3 + ")" + if eval[str] == 24 + println[str] + } diff --git a/Task/24-game/FutureBasic/24-game.basic b/Task/24-game/FutureBasic/24-game.basic new file mode 100644 index 0000000000..e3cb41f183 --- /dev/null +++ b/Task/24-game/FutureBasic/24-game.basic @@ -0,0 +1,310 @@ +//include resources "24 Game Icon.icns" + +#build CompilerOptions @"-Wno-unused-variable" + +_mEdit = 2 +editmenu _mEdit + +begin globals +long gPosition +end globals + +void local fn EraseErrorText + + CGRect r + r = fn CGRectMake(10, 200, 400, 15) + rect fill r,fn ColorBlack + +end fn + +local fn ArcRandom( a as long, b as long ) as long + long i + cln i = (arc4random()%(b-a+1))+a; +end fn = fn floor(i) + +local fn GetRandomNumbers as CFStringRef + + // 96 number groups + + CFArrayRef combos = @[¬ + + // The first 32 are easy + @"1 2 3 4", @"2 4 6 8", @"1 2 4 8", @"1 3 4 6", @"1 2 6 8", + @"2 3 4 8", @"1 3 6 9", @"1 2 7 8", @"2 3 6 8", @"1 4 6 8", + @"2 2 3 9", @"3 4 6 6", @"2 3 3 8", @"1 5 6 6", @"2 4 4 6", + @"1 3 8 8", @"2 2 6 9", @"3 3 6 9", @"1 2 5 9", @"2 4 5 5", + @"1 3 5 9", @"2 2 4 9", @"1 2 3 6", @"1 2 2 9", @"1 2 3 9", + @"1 2 4 6", @"1 2 4 4", @"1 2 2 6", @"1 3 3 6", @"1 1 4 6", + @"1 1 2 8", @"1 1 3 8", + // The middle 32 are medium + @"1 5 5 9", @"4 4 6 9", @"2 3 7 9",@"3 5 8 8", @"1 6 6 8", + @"3 3 5 6", @"1 4 5 8", @"3 3 6 7",@"2 5 5 8", @"4 4 7 9", + @"1 5 6 9", @"3 3 8 9", @"2 6 6 7",@"4 5 7 8", @"2 2 5 9", + @"2 4 6 7", @"1 5 6 8", @"3 4 7 7",@"2 5 6 6", @"3 4 5 9", + @"1 6 7 9", @"2 3 7 8", @"1 4 6 9",@"2 3 5 9", @"3 4 4 8", + @"2 5 8 9", @"1 4 8 9", @"3 3 4 9",@"2 6 7 9", @"1 3 5 7", + @"1 3 6 6", @"2 2 5 7", + // The last 32 are hard + @"1 5 7 9",@"3 4 7 9", @"2 5 7 8", @"3 4 8 9", @"3 4 5 8", + @"2 6 6 9",@"4 4 5 7", @"2 4 6 9", @"1 4 7 7", @"2 3 8 9", + @"2 3 4 7",@"3 3 4 8", @"1 3 7 9", @"2 4 5 9", @"1 3 6 8", + @"2 4 4 9",@"1 5 8 9", @"3 3 5 9", @"2 6 8 9", @"1 4 4 7", + @"2 3 6 7",@"1 3 5 8", @"2 4 7 8", @"1 3 4 7", @"2 3 5 6", + @"1 4 5 6",@"3 3 5 7", @"2 2 3 6", @"3 3 7 7", @"3 3 7 9", + @"4 4 8 9",@"2 4 8 9"] + + long i = fn ArcRandom( 0, len(combos) - 1 ) + gPosition = i + +end fn = combos[i] + + +local fn EvaluateMath( equation as CFStringRef ) as CFStringRef + equation = fn StringByReplacingOccurrencesOfString( lcase(equation), @"x", @"*" ) + + CFStringRef result = NULL + RegularExpressionRef regex = fn RegularExpressionWithPattern( @"[0-9.]+", NSRegularExpressionCaseInsensitive, NULL ) + CFArrayRef matches = fn RegularExpressionMatches( regex, equation, 0, fn CFRangeMake( 0, len(equation) ) ) + NSInteger intConversions = 0 + TextCheckingResultRef match + CFRange originalRange + CFRange adjustedRange + CFStringRef value + + for match in matches + originalRange = fn TextCheckingResultRange( match ) + adjustedRange = fn CFRangeMake( ( originalRange.location + ( intConversions * len( @".0") ) ), originalRange.length ) + value = fn StringSubstringWithRange( equation, adjustedRange ) + if fn StringContainsString( value, @"." ) + continue + else + equation = fn StringByReplacingCharactersInRange( equation, adjustedRange, fn StringWithFormat( @"%@.0", value ) ) + intConversions++ + end if + next + ExceptionRef e + try + ExpressionRef expression = fn ExpressionWithFormat( equation ) + CFNumberRef number = fn ExpressionValueWithObject( expression, NULL, NULL ) + result = fn StringWithFormat( @"%.3f", dblval( number ) ) + end try + + catch (e) + result = fn StringWithFormat( @"%@", e ) : exit fn + end catch + // Test if result is an integer and, if so, return result as an integer + if( fn StringDoubleValue( result ) == fn floorf( fn StringDoubleValue( result ) ) ) + result = fn ArrayFirstObject( fn StringComponentsSeparatedByString( result, @"." ) ) + end if +end fn = result + + +local fn QuitOrPlayAlert(GameResult as CFStringRef) + alert -2,,GameResult,@"You won!",@"Quit;Play Again" + AlertButtonSetKeyEquivalent( 2, 2, @"\e" ) + short result + result = alert 2 + if ( result != NSAlertSecondButtonReturn ) then appterminate +end fn + + +local fn BuildWindow + CGRect r = fn CGRectMake( 0, 0, 580, 250) + window 1, @"24 Game", r + windowcenter(1) + WindowSetBackgroundColor(1,fn ColorBlack) + +end fn + +///////// Start ////////// + +fn BuildWindow + + +short d(4), i +CFStringRef CheckForDuplicates(97) +for i = 1 to 96 + CheckForDuplicates(i) = @"" +next i + +short DuplicatesCounter +DuplicatesCounter = 0 + + +"Main" + +cls +text ,,fn colorWhite + +print +print %(10,15),"Given four numbers and using just the +, -, *, and / operators; and the" +print %(10,30),"possible use of parenthesis (), enter an expression that equates to 24." +print %(10,45),"You must use all your numbers and only those numbers." +print %(10,60),"Examples: 9618 Solution 9 + 6 + 1 + 8 or 3173 Solution (3 * 7) - (1 - 4)" +print +print %(10,85),"Enter Q to quit or S to skip to the next number." + +"GetFourNumbers" + +CFArrayRef randomNumbers : randomNumbers= fn StringComponentsSeparatedByString( fn GetRandomNumbers, @" " ) +CFStringRef RandomNumberblock : RandomNumberblock = @"" +CFStringRef RandomNumberblockAdd : RandomNumberblockAdd = @"" + +for i = 0 to 3 + // create a string from the 4 numbers + RandomNumberblockAdd = randomNumbers[i] + RandomNumberblock = fn StringByAppendingString(RandomNumberblock,RandomNumberblockAdd) + RandomNumberblock = fn StringByAppendingString(RandomNumberblock,@" ") +next i + + +if DuplicatesCounter = > 96 + // reset counter when last number is retrieved and start from the first number block + DuplicatesCounter = 0 + for i = 1 to 96 + CheckForDuplicates(i) = @"" + next i +end if + +for i = 1 to 96 + // check the current numbers with the numbers already used + if fn StringIsEqual(RandomNumberblock,CheckForDuplicates(i)) + RandomNumberblock = fn StringWithString(CheckForDuplicates(DuplicatesCounter)) + goto "GetFourNumbers" + end if +next i + +DuplicatesCounter ++ +CheckForDuplicates(DuplicatesCounter) = fn StringWithString(RandomNumberblock) + +d(1) = fn StringIntegerValue( randomNumbers[0] ) +d(2) = fn StringIntegerValue( randomNumbers[1] ) +d(3) = fn StringIntegerValue( randomNumbers[2] ) +d(4) = fn StringIntegerValue( randomNumbers[3] ) + +short dots = 0 + +//d(1) = 9:d(2) = 6:d(3) = 1:d(4) = 8 // Uncomment to test with 9618 numbers. Solution 9 + 6 + 1 + 8 +//d(1) = 6:d(2) = 5:d(3) = 3:d(4) = 8 // Uncomment to test with 6538 numbers. Solution 6 / ( 5 - 3 ) * 8 +//d(1) = 3:d(2) = 1:d(3) = 7:d(4) = 3 // Uncomment to test with 3773 numbers. Solution ((3 * 1) * 7) + 3 +//d(1) = 4:d(2) = 2:d(3) = 7:d(4) = 1 // Uncomment to test with 4271 numbers. Solution (4 * ( 7 - 2 + 1 ) +// NOTE: When using these test numbers, also uncomment dots = 0 below here to prevent misleading dot displays + + +if gPosition <= 32 then dots = 1 +if gPosition > 32 and gPosition < 65 then dots = 2 +if gPosition > 64 then dots = 3 + +//dots = 0 uncomment when testing the numbers above to prevent misleading dot displays + +print +text ,,fn colorGreen +print %(15,110),"These are your numbers, difficulty level "; +// @"\U000026AA" is white unicode dot - Easy difficulty (One-Dot) +// @"\U0001F534" is red unicode dot - Medium difficulty (Two-Dots) +// @"\U0001F7E1" is yellow unicode dot - Hard difficulty (Three-Dots) + +if dots = 1 then print @"\U000026AA Easy" +if dots = 2 then print @"\U0001F534 \U0001F534 Medium" +if dots = 3 then print @"\U0001F7E1 \U0001F7E1 \U0001F7E1 Hard" + +print %(55,125) +text ,18,fn colorGreen +for i = 1 to 4 + print d(i); " "; +next + +print + +text ,12,fn colorWhite +printf @"\n\n\n" + +CFStringRef expr +bool TryAgain : TryAgain = _false +CFStringRef MessageText +CFStringRef UserInput = NULL + +"InputExpression" + +if TryAgain + MessageText = fn StringWithFormat( @"Enter math expression: [ '%@' was incorrect ]", expr ) + UserInput = input %(10, 190), MessageText, @"123456789+-*/()qs", YES,, 0 +else + UserInput = input %(10, 190), @"Enter math expression:", @"123456789+-*/()qs", YES,, 0 +end if + +if ( UserInput == NULL ) then "InputExpression" +expr = UserInput +if expr = @"" then "InputExpression" +if fn StringIsEqual(ucase(expr) , @"Q") then appterminate +if fn StringIsEqual(ucase(expr) , @"S") then "Main" + + +//check expr for validity + +short j +bool GotAllNumbers : GotAllNumbers = _false +short ThisNumberPosition : ThisNumberPosition = 0 +short GotaNumber : GotaNumber = 0 +short TotalNumbers : TotalNumbers = 0 + +short ExtraNumbers:ExtraNumbers = 0 + +for i = 1 to len$(fn stringpascalstring(expr)) + if asc(mid$(fn stringpascalstring(expr),i,1)) > 48 && asc(mid$(fn stringpascalstring(expr),i,1)) < 58 + ExtraNumbers ++ + end if +next i + +if ExtraNumbers > 4 + fn EraseErrorText + text ,,fn colorRed + TryAgain = _true + print %(10,200);"Error! Extra numbers not allowed": goto "InputExpression" + text ,,fn colorWhite +end if + + +for i = 1 to 4 + GotaNumber = 0 + for j = 0 to len(expr) -1 + ThisNumberPosition = instr( j, expr, right(str( d(i)),1 )) + ThisNumberPosition ++ + if ThisNumberPosition then GotaNumber = _true + next j + if GotaNumber then TotalNumbers ++ +next i + +if TotalNumbers => 4 then GotAllNumbers = _true + +if GotAllNumbers = _false + fn EraseErrorText + text ,,fn colorRed + TryAgain = _true + print %(10,200);"ERROR! Must use all your numbers and only those numbers." : goto "InputExpression" + text ,,fn colorWhite +end if + +fn EraseErrorText + + +if fn EvaluateMath( expr ) = _false + text ,,fn colorRed + TryAgain = _true + Print %(10,200);"Error! Incorrect math sequence." + goto "InputExpression" + text ,,fn colorWhite +end if + +CFStringRef GameResult +if fn StringIntegerValue( fn EvaluateMath( expr ) ) == 24 then GameResult = @"Correct" else GameResult = @"Incorrect" + +if GameResult = @"Incorrect" + TryAgain = _true + goto "InputExpression" +end if + +fn QuitOrPlayAlert(GameResult) +goto "Main" + +handleevents diff --git a/Task/24-game/J/24-game.j b/Task/24-game/J/24-game.j index 73034a24eb..928663b455 100644 --- a/Task/24-game/J/24-game.j +++ b/Task/24-game/J/24-game.j @@ -1,6 +1,6 @@ require'misc' -deal=: 1 + ? bind 9 9 9 9 -rules=: smoutput bind 'see http://en.wikipedia.org/wiki/24_Game' +deal=: 1 + ? @ 9 9 9 9 +rules=: echo @ 'see http://en.wikipedia.org/wiki/24_Game' input=: prompt @ ('enter 24 expression using ', ":, ': '"_) wellformed=: (' '<;._1@, ":@[) -:&(/:~) '(+-*%)' -.&;:~ ] diff --git a/Task/24-game/Jq/24-game.jq b/Task/24-game/Jq/24-game.jq new file mode 100644 index 0000000000..09ce6dfc30 --- /dev/null +++ b/Task/24-game/Jq/24-game.jq @@ -0,0 +1,90 @@ +### The MRG32k3a combined recursive PRNG - see above +import "MRG32k3a" as MRG {search: "."}; + +### Generic utilities +def sum(stream): reduce stream as $x (0; .+$x); + +# like while/2 but emit the final term rather than the first one +def whilst(cond; update): + def _whilst: + if cond then update | (., _whilst) else empty end; + _whilst; + +### Reverse Polish Notation +# An array of the allowed operators +def operators: "+-*/" | split(""); + +# If $a and $b are numbers and $c an operator, then "$a $b $c" is evaluated as an RPN expression. +# Output: {emit, result} with .emit == null if there is a valid result. +def applyOperator($a; $b; $c): + if ([$a,$b] | map(type) | unique) == ["number"] + then + if $c == "+" then {result: ($a + $b)} + elif $c == "-" then {result: ($a - $b)} + elif $c == "*" then {result: ($a * $b)} + elif ($c == "/") then {result: ($b / $a)} + else {emit: "unrecognized operator: \($c)"} + end + else {emit: "invalid number"} + end; + +# Input: an array representing an RPN expression. +# Output: {emit, result} as per applyOperator/3 +# Example: [1,2,3,"+","+"] | evaluate #=> 6 +def evaluate: + if length == 1 + then if .[0]|type == "number" then {result: .[0]} + else {emit: "invalid RPN expression"} + end + elif length < 3 then {emit: "invalid RPN expression: \(. | join(" "))"} + else . as $in + | (first( range(0; length) as $i | select(any( operators[]; . == $in[$i]) ) | $i) // null) as $ix + | if $ix == null then {emit: "invalid RPN expression"} + else applyOperator(.[$ix-2]; .[$ix-1]; .[$ix]) as $result + | if $result.result then .[:$ix-2] + [$result.result] + .[$ix+1:] | evaluate + else $result + end + end + end; + +### The "24 Game" + +# . is the putative RPN string to be checked. +# $four is the string of the four expected digits, in order. +# Output: {emit, result} with .emit set to "Correct!" if .result == 24 +def check($four): + if (gsub("[^1-9]";"") | explode | sort | implode) != $four + then {emit: "You must use each of the four digits \($four | split("") | join(" ")) exactly once:"} + else . as $in + | {s: [], emit: null} + | [$in | split("")[] | select(. != " ") + | . as $in | explode[0] | if . >= 48 and . <= 57 then . - 48 else $in end] + | evaluate + | if .result + then if .result|round == 24 then .emit = "Correct!" + else .emit = "Value \(.result) is not 24." + end + else .emit += "\nTry again, or enter . to start again, or q to quit." + end + end ; + +def run: + # Populate .digits with four non-negative digits selected at random, with replacement: + {digits: (9 | MRG::prn(4) | map(. + 1))} + | (.digits | sort | join("")) as $four + | "At the prompt, enter an RPN string (e.g. 64*1+1-), or . for a new set of four digits, or q to quit.", + "Make 24 using these digits, once each, in any order: \(.digits):", + ( whilst( .stop | not; + .emit = null + | . as $state + | try input catch halt + | if IN( "q", "quit") then halt + elif . == "." then $state | .stop = true + else check($four) + | if .result then .stop = true end + end ) + | select(.emit).emit ), + # rerun + run; + +run diff --git a/Task/24-game/Julia/24-game.julia b/Task/24-game/Julia/24-game.jl similarity index 100% rename from Task/24-game/Julia/24-game.julia rename to Task/24-game/Julia/24-game.jl diff --git a/Task/24-game/Kotlin/24-game.kotlin b/Task/24-game/Kotlin/24-game.kts similarity index 100% rename from Task/24-game/Kotlin/24-game.kotlin rename to Task/24-game/Kotlin/24-game.kts diff --git a/Task/24-game/OCaml/24-game.ocaml b/Task/24-game/OCaml/24-game.ml similarity index 100% rename from Task/24-game/OCaml/24-game.ocaml rename to Task/24-game/OCaml/24-game.ml diff --git a/Task/24-game/Perl/24-game.pl b/Task/24-game/Perl/24-game.pl index 071bb8e2b8..d4dd33e728 100644 --- a/Task/24-game/Perl/24-game.pl +++ b/Task/24-game/Perl/24-game.pl @@ -25,18 +25,21 @@ while (1) { print "Expression (try ", $try++, "): "; my $entry = <>; - if (!defined $entry || $entry eq 'q') + if (!defined $entry || substr($entry,0,1) eq 'q') { say "Goodbye. Sorry you couldn't win."; last; } - $entry =~ s/\s+//g; # remove all white space + $entry =~ s/\s+//g; # remove all white space (newline is whitespace too) next if $entry eq ''; my $given_digits = join "", sort @digits; my $entry_digits = join "", sort grep { /\d/ } split(//, $entry); - if ($given_digits ne $entry_digits || # not correct digits - $entry =~ /\d\d/ || # combined digits - $entry =~ m|[-+*/]{2}| || # combined operators - $entry =~ tr|-0-9()+*/||c) # Invalid characters - { say "That's not valid"; next; } + if ($given_digits ne $entry_digits) + { say "incorrect digits"; next; } + if ($entry =~ /\d\d/) + { say "error, combined digits"; next; } + if ($entry =~ m|[-+*/]{2}|) + { say "error, combined operators"; next; } + if ($entry =~ tr|-0-9()+*/||c) + { say "invalid characters!"; next; } my $n = eval $entry; diff --git a/Task/24-game/PowerShell/24-game.psh b/Task/24-game/PowerShell/24-game.ps1 similarity index 100% rename from Task/24-game/PowerShell/24-game.psh rename to Task/24-game/PowerShell/24-game.ps1 diff --git a/Task/24-game/Rebol/24-game.rebol b/Task/24-game/Rebol/24-game.rebol new file mode 100644 index 0000000000..246a8cc6b5 --- /dev/null +++ b/Task/24-game/Rebol/24-game.rebol @@ -0,0 +1,43 @@ +Rebol [ + title: "Rosetta code: 24 game" + file: %24_game.r3 + url: https://rosettacode.org/wiki/24_game + needs: 3.10.0 ; or something like that (ajoin/with) +] +game-24: function/with [ + /seed val +][ + random/seed any [val now/precise] + valid: copy/part random digits 4 + prin "Using the following numbers, enter an expression that equals 24: " + print [valid/1 ", " valid/2 ", " valid/3 " and " valid/4] + print "Evaluation from left to right with no precedence, unless you use parenthesis." + sort valid + + sucess: false + + while [not sucess] [ + guess: ask "Enter your expression: " + if guess = "q" [halt] + numbers: sort copy guess + numbers: take/part find numbers digit 4 + either all [ + valid = numbers + parse guess [some chars end] + integer? result: try load ajoin/with split guess 1 #" " + ][ + print ["The result of your expression is: " result] + if result = 24 [sucess: true] + ][ + print "Something is wrong with the expression, try again." + ] + ] + print "You got it right!" +][ + valid: guess: none + digits: "123456789" + digit: charset digits + chars: union digit charset "+-*/()" +] + +game-24/seed 1 diff --git a/Task/24-game/Rust/24-game.rs b/Task/24-game/Rust/24-game.rs new file mode 100644 index 0000000000..149fb0aa62 --- /dev/null +++ b/Task/24-game/Rust/24-game.rs @@ -0,0 +1,108 @@ +use std::io::{self,BufRead}; +extern crate rand; +use rand::Rng; + +fn op_type(x: char) -> i32{ + match x { + '-' | '+' => return 1, + '/' | '*' => return 2, + '(' | ')' => return -1, + _ => return 0, + } +} + +fn to_rpn(input: &mut String){ + + let mut rpn_string : String = String::new(); + let mut rpn_stack : String = String::new(); + let mut last_token = '#'; + for token in input.chars(){ + if token.is_digit(10) { + rpn_string.push(token); + } + else if op_type(token) == 0 { + continue; + } + else if op_type(token) > op_type(last_token) || token == '(' { + rpn_stack.push(token); + last_token=token; + } + else { + while let Some(top) = rpn_stack.pop() { + if top=='(' { + break; + } + rpn_string.push(top); + } + if token != ')'{ + rpn_stack.push(token); + } + } + } + while let Some(top) = rpn_stack.pop() { + rpn_string.push(top); + } + + println!("your formula results in {}", rpn_string); + + *input=rpn_string; +} + +fn calculate(input: &String, list : &mut [u32;4]) -> f32{ + let mut stack : Vec = Vec::new(); + let mut accumulator : f32 = 0.0; + + for token in input.chars(){ + if token.is_digit(10) { + let test = token.to_digit(10).unwrap() as u32; + match list.iter().position(|&x| x == test){ + Some(idx) => list[idx]=10 , + _ => println!(" invalid digit: {} ",test), + } + stack.push(accumulator); + accumulator = test as f32; + }else{ + let a = stack.pop().unwrap(); + accumulator = match token { + '-' => a-accumulator, + '+' => a+accumulator, + '/' => a/accumulator, + '*' => a*accumulator, + _ => {accumulator},//NOP + }; + } + } + println!("your formula results in {}",accumulator); + accumulator +} + +fn main() { + + let mut rng = rand::thread_rng(); + // each from 1 ──► 9 (inclusive) + let mut list :[u32;4]=[ + rng.gen::()%9+1, + rng.gen::()%9+1, + rng.gen::()%9+1, + rng.gen::()%9+1 + ]; + + println!("form 24 with using + - / * {:?}",list); + //get user input + let mut input = String::new(); + io::stdin().read_line(&mut input).unwrap(); + //convert to rpn + to_rpn(&mut input); + let result = calculate(&input, &mut list); + + if list.iter().any(|&num| num != 10) { + println!("you didn't use all the numbers"); + } else { + println!("and you used all numbers"); + match result { + 24.0 => println!("you won"), + _ => println!("but your formula doesn't result in 24"), + } + } + +} diff --git a/Task/24-game/Rust/24-game.rust b/Task/24-game/Rust/24-game.rust deleted file mode 100644 index bdcad8b01d..0000000000 --- a/Task/24-game/Rust/24-game.rust +++ /dev/null @@ -1,102 +0,0 @@ -use std::io::{self,BufRead}; -extern crate rand; -use rand::Rng; - -fn op_type(x: char) -> i32{ - match x { - '-' | '+' => return 1, - '/' | '*' => return 2, - '(' | ')' => return -1, - _ => return 0, - } -} - -fn to_rpn(input: &mut String){ - - let mut rpn_string : String = String::new(); - let mut rpn_stack : String = String::new(); - let mut last_token = '#'; - for token in input.chars(){ - if token.is_digit(10) { - rpn_string.push(token); - } - else if op_type(token) == 0 { - continue; - } - else if op_type(token) > op_type(last_token) || token == '(' { - rpn_stack.push(token); - last_token=token; - } - else { - while let Some(top) = rpn_stack.pop() { - if top=='(' { - break; - } - rpn_string.push(top); - } - if token != ')'{ - rpn_stack.push(token); - } - } - } - while let Some(top) = rpn_stack.pop() { - rpn_string.push(top); - } - - println!("you formula results in {}", rpn_string); - - *input=rpn_string; -} - -fn calculate(input: &String, list : &mut [u32;4]) -> f32{ - let mut stack : Vec = Vec::new(); - let mut accumulator : f32 = 0.0; - - for token in input.chars(){ - if token.is_digit(10) { - let test = token.to_digit(10).unwrap() as u32; - match list.iter().position(|&x| x == test){ - Some(idx) => list[idx]=10 , - _ => println!(" invalid digit: {} ",test), - } - stack.push(accumulator); - accumulator = test as f32; - }else{ - let a = stack.pop().unwrap(); - accumulator = match token { - '-' => a-accumulator, - '+' => a+accumulator, - '/' => a/accumulator, - '*' => a*accumulator, - _ => {accumulator},//NOP - }; - } - } - println!("you formula results in {}",accumulator); - accumulator -} - -fn main() { - - let mut rng = rand::thread_rng(); - let mut list :[u32;4]=[rng.gen::()%10,rng.gen::()%10,rng.gen::()%10,rng.gen::()%10]; - - println!("form 24 with using + - / * {:?}",list); - //get user input - let mut input = String::new(); - io::stdin().read_line(&mut input).unwrap(); - //convert to rpn - to_rpn(&mut input); - let result = calculate(&input, &mut list); - - if list.iter().any(|&list| list !=10){ - println!("and you used all numbers"); - match result { - 24.0 => println!("you won"), - _ => println!("but your formulla doesn't result in 24"), - } - }else{ - println!("you didn't use all the numbers"); - } - -} diff --git a/Task/24-game/Scheme/24-game.ss b/Task/24-game/Scheme/24-game.scm similarity index 100% rename from Task/24-game/Scheme/24-game.ss rename to Task/24-game/Scheme/24-game.scm diff --git a/Task/24-game/Wren/24-game.wren b/Task/24-game/Wren/24-game.wren index 0314391daa..b025514023 100644 --- a/Task/24-game/Wren/24-game.wren +++ b/Task/24-game/Wren/24-game.wren @@ -1,6 +1,6 @@ import "random" for Random -import "/ioutil" for Input -import "/seq" for Stack +import "./ioutil" for Input +import "./seq" for Stack var R = Random.new() diff --git a/Task/24-game/XPL0/24-game.xpl0 b/Task/24-game/XPL0/24-game.xpl0 new file mode 100644 index 0000000000..f2a6bae263 --- /dev/null +++ b/Task/24-game/XPL0/24-game.xpl0 @@ -0,0 +1,42 @@ +real Stack(10), A, B; +int SP, I, Char, Digit, Digits(10); + +proc Push(X); +real X; +[Stack(SP):= X; SP:= SP+1]; + +func real Pop; +[SP:= SP-1; return Stack(SP)]; + +[SP:= 0; +for I:= 0 to 9 do Digits(I):= 0; +Text(0, "Enter an RPN expression that equals 24 using all these digits:"); +for I:= 0 to 3 do + [Digit:= Ran(9)+1; + ChOut(0, ^ ); ChOut(0, Digit+^0); + Digits(Digit):= Digits(Digit)+1; + ]; +Text(0, "^m^j> "); +loop [Char:= ChIn(1); + ChOut(0, Char); + if Char >= ^1 and Char <=^9 then + [Digit:= Char - ^0; + Push(float(Digit)); + Digits(Digit):= Digits(Digit) - 1; + ] + else [if SP >= 2 then [A:= Pop; B:= Pop] else quit; + case Char of + ^+: Push(B+A); + ^-: Push(B-A); + ^*: Push(B*A); + ^/: Push(B/A) + other quit; + ]; + ]; +CrLf(0); +for I:= 0 to 9 do + if Digits(I) # 0 then + [Text(0, "Must use each of the given digits.^m^j"); exit]; +Text(0, if abs(Pop-24.0) < 0.001 then "Correct!" else "Wrong."); +CrLf(0); +] diff --git a/Task/24-game/Zig/24-game.zig b/Task/24-game/Zig/24-game.zig new file mode 100644 index 0000000000..4c224f1030 --- /dev/null +++ b/Task/24-game/Zig/24-game.zig @@ -0,0 +1,153 @@ +const std = @import("std"); +const rand = std.Random; +// (hint: errors cannot be handled at comptime) +var stdout: std.fs.File.Writer = undefined; +var stdin: std.fs.File.Reader = undefined; + +fn opType(x: u8) i32 { + return switch (x) { + '-', '+' => 1, + '/', '*' => 2, + '(', ')' => -1, + else => 0, + }; +} + +fn toRpn(allocator: std.mem.Allocator, input: []const u8) ![]u8 { + var rpnString = std.ArrayList(u8).init(allocator); + defer rpnString.deinit(); + + var rpnStack = std.ArrayList(u8).init(allocator); + defer rpnStack.deinit(); + + var lastToken: u8 = '#'; + + for (input) |token| { + if (token >= '1' and token <= '9') { + try rpnString.append(token); + } else if (opType(token) == 0) { + continue; + } else if (opType(token) > opType(lastToken) or token == '(') { + try rpnStack.append(token); + lastToken = token; + } else { + while (rpnStack.items.len > 0) { + const top = rpnStack.pop().?; + if (top == '(') { + break; + } + try rpnString.append(top); + } + if (token != ')') { + try rpnStack.append(token); + } + } + } + + while (rpnStack.items.len > 0) { + try rpnString.append(rpnStack.pop().?); + } + + if (rpnString.items.len > 0) { + try stdout.print("your formula results in {s}\n", .{rpnString.items}); + } else { + stdout.print("no input available.\n", .{}) catch {}; + } + + return rpnString.toOwnedSlice(); +} + +fn calculate(input: []const u8, list: *[4]u32) f32 { + var stack = std.ArrayList(f32).init(std.heap.page_allocator); + defer stack.deinit(); + + var accumulator: f32 = 0.0; + + for (input) |token| { + if (token >= '1' and token <= '9') { + const digit = @as(u32, token - '0'); + + // Find and mark the used digit + var found = false; + for (list, 0..) |val, idx| { + if (val == digit) { + list[idx] = 10; + found = true; + break; + } + } + + if (!found) { + stdout.print(" invalid digit: {d} \n", .{digit}) catch {}; + } + + stack.append(accumulator) catch {}; + accumulator = @floatFromInt(digit); + } else { + const a = stack.pop().?; + + accumulator = switch (token) { + '-' => a - accumulator, + '+' => a + accumulator, + '/' => a / accumulator, + '*' => a * accumulator, + else => accumulator, // NOP + }; + } + } + + stdout.print("your formula results in {d}\n", .{accumulator}) catch {}; + return accumulator; +} + +pub fn main() !void { + stdout = std.io.getStdOut().writer(); + stdin = std.io.getStdIn().reader(); + var prng = rand.DefaultPrng.init(@as(u64, @intCast(std.time.timestamp()))); + const random = prng.random(); + // only values from 1 --> 9 (inclusive) + var list = [_]u32{ + @mod(random.int(u32), 9) + 1, + @mod(random.int(u32), 9) + 1, + @mod(random.int(u32), 9) + 1, + @mod(random.int(u32), 9) + 1, + }; + + try stdout.print("form 24 with using + - / * {d} {d} {d} {d}\n", .{ list[0], list[1], list[2], list[3] }); + + // Get user input + var buffer: [1024]u8 = undefined; + const input = try stdin.readUntilDelimiterOrEof(buffer[0..], '\n') orelse ""; + + var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); + defer arena.deinit(); + const allocator = arena.allocator(); + + // Convert to RPN + const rpnInput = try toRpn(allocator, input); + if (rpnInput.len == 0) { + stdout.print("exit.\n", .{}) catch {}; + return; + } + + const result = calculate(rpnInput, &list); + + var allUsed = true; + for (list) |val| { + if (val != 10) { + allUsed = false; + break; + } + } + + if (allUsed) { + try stdout.print("and you used all numbers\n", .{}); + if (result == 24.0) { + try stdout.print("you won\n", .{}); + } else { + try stdout.print("but your formula doesn't result in 24\n", .{}); + } + } else { + try stdout.print("you didn't use all the numbers\n", .{}); + } +} diff --git a/Task/4-rings-or-4-squares-puzzle/Ada/4-rings-or-4-squares-puzzle.ada b/Task/4-rings-or-4-squares-puzzle/Ada/4-rings-or-4-squares-puzzle.adb similarity index 100% rename from Task/4-rings-or-4-squares-puzzle/Ada/4-rings-or-4-squares-puzzle.ada rename to Task/4-rings-or-4-squares-puzzle/Ada/4-rings-or-4-squares-puzzle.adb diff --git a/Task/4-rings-or-4-squares-puzzle/Crystal/4-rings-or-4-squares-puzzle.crystal b/Task/4-rings-or-4-squares-puzzle/Crystal/4-rings-or-4-squares-puzzle.cr similarity index 100% rename from Task/4-rings-or-4-squares-puzzle/Crystal/4-rings-or-4-squares-puzzle.crystal rename to Task/4-rings-or-4-squares-puzzle/Crystal/4-rings-or-4-squares-puzzle.cr diff --git a/Task/4-rings-or-4-squares-puzzle/EasyLang/4-rings-or-4-squares-puzzle.easy b/Task/4-rings-or-4-squares-puzzle/EasyLang/4-rings-or-4-squares-puzzle.easy index f2e05dc87f..22e54e305a 100644 --- a/Task/4-rings-or-4-squares-puzzle/EasyLang/4-rings-or-4-squares-puzzle.easy +++ b/Task/4-rings-or-4-squares-puzzle/EasyLang/4-rings-or-4-squares-puzzle.easy @@ -1,12 +1,10 @@ func ok v t[] . for h in t[] - if v = h - return 0 - . + if v = h : return 0 . return 1 . -proc four lo hi uni show . . +proc four lo hi uni show . # subr bf for f = lo to hi diff --git a/Task/4-rings-or-4-squares-puzzle/Julia/4-rings-or-4-squares-puzzle.julia b/Task/4-rings-or-4-squares-puzzle/Julia/4-rings-or-4-squares-puzzle.jl similarity index 100% rename from Task/4-rings-or-4-squares-puzzle/Julia/4-rings-or-4-squares-puzzle.julia rename to Task/4-rings-or-4-squares-puzzle/Julia/4-rings-or-4-squares-puzzle.jl diff --git a/Task/4-rings-or-4-squares-puzzle/Kotlin/4-rings-or-4-squares-puzzle.kotlin b/Task/4-rings-or-4-squares-puzzle/Kotlin/4-rings-or-4-squares-puzzle.kts similarity index 100% rename from Task/4-rings-or-4-squares-puzzle/Kotlin/4-rings-or-4-squares-puzzle.kotlin rename to Task/4-rings-or-4-squares-puzzle/Kotlin/4-rings-or-4-squares-puzzle.kts diff --git a/Task/4-rings-or-4-squares-puzzle/MiniScript/4-rings-or-4-squares-puzzle.mini b/Task/4-rings-or-4-squares-puzzle/MiniScript/4-rings-or-4-squares-puzzle.mini new file mode 100644 index 0000000000..e408bacd37 --- /dev/null +++ b/Task/4-rings-or-4-squares-puzzle/MiniScript/4-rings-or-4-squares-puzzle.mini @@ -0,0 +1,71 @@ +combinations = function(elements, comboLength, unique=true) + n = elements.len + if comboLength > n then return [] + + allCombos = [] + + genCombos=function(start, currCombo) + if currCombo.len == comboLength then + allCombos.push(currCombo) + return + end if + if start == n then return + for i in range(start, n - 1) + newCombo = currCombo + [elements[i]] + genCombos(i + unique, newCombo) + end for + end function + + genCombos(0, []) + return allCombos +end function + +permutations = function(elements, permLength=null) + n = elements.len + elements.sort + if permLength == null then permLength = n + + allPerms = [] + + genPerms = function(prefix, remainingElements) + if prefix.len == permLength then + allPerms.push(prefix) + return + end if + + for i in range(0, remainingElements.len - 1) + if i > 0 and remainingElements[i] == remainingElements[i-1] then continue + newPrefix = prefix + [remainingElements[i]] + newRemains = remainingElements[:i] + remainingElements[i+1:] + genPerms(newPrefix, newRemains) + end for + end function + genPerms([],elements) + return allPerms +end function + +ringsEqual = function(a) + if a.len != 7 then return false + return a[0]+a[1] == a[1]+a[2]+a[3] == a[3]+a[4]+a[5] == a[5] + a[6] +end function + +fourRings = function(lo, hi, unique, show) + rng = range(lo, hi) + combos = combinations(rng, 7, unique) + cnt = 0 + for c in combos + for p in permutations(c) + if ringsEqual(p) then + cnt += 1 + if show then print p.join(", ") + end if + end for + end for + uniStr = [" nonunique", " unique"] + print cnt + uniStr[unique] + " solutions for " + lo + " to " + hi + print +end function + +fourRings(1, 7, true, true) +fourRings(3, 9, true, true) +fourRings(0, 9, false, false) diff --git a/Task/4-rings-or-4-squares-puzzle/OCaml/4-rings-or-4-squares-puzzle.ocaml b/Task/4-rings-or-4-squares-puzzle/OCaml/4-rings-or-4-squares-puzzle.ml similarity index 100% rename from Task/4-rings-or-4-squares-puzzle/OCaml/4-rings-or-4-squares-puzzle.ocaml rename to Task/4-rings-or-4-squares-puzzle/OCaml/4-rings-or-4-squares-puzzle.ml diff --git a/Task/4-rings-or-4-squares-puzzle/PARI-GP/4-rings-or-4-squares-puzzle.parigp b/Task/4-rings-or-4-squares-puzzle/PARI-GP/4-rings-or-4-squares-puzzle.parigp new file mode 100644 index 0000000000..d8c0e765a3 --- /dev/null +++ b/Task/4-rings-or-4-squares-puzzle/PARI-GP/4-rings-or-4-squares-puzzle.parigp @@ -0,0 +1,39 @@ +foursquares(plo, phi, punique, pshow) = { + my(lo=plo, hi=phi, unique=punique, show=pshow, solutions, a, b, c, d, e, f, g); + print(); + for (c = lo, hi, + for (d = lo, hi, + if (!unique || c != d, + a = c + d; + if (a >= lo && a <= hi && (!unique || (c != 0 && d != 0)), + for (e = lo, hi, + if (!unique || (e != a && e != c && e != d), + g = d + e; + if (g >= lo && g <= hi && (!unique || (g != a && g != c && g != d && g != e)), + for (f = lo, hi, + if (!unique || (f != a && f != c && f != d && f != g && f != e), + b = e + f - c; + if (b >= lo && b <= hi && (!unique || (b != a && b != c && b != d && b != g && b != e && b != f)), + solutions++; + if (show, print(a, " ", b, " ", c, " ", d, " ", e, " ", f, " ", g)); + ) + ) + ) + ) + ) + ) + ) + ) + ) + ); + + if (unique, + print("\n", solutions, " unique solutions in ", lo, " to ", hi); + , + print("\n", solutions, " non-unique solutions in ", lo, " to ", hi); + ); +} + +foursquares(1,7,1,1); +foursquares(3,9,1,1); +foursquares(0,9,0,0); diff --git a/Task/4-rings-or-4-squares-puzzle/Quackery/4-rings-or-4-squares-puzzle.quackery b/Task/4-rings-or-4-squares-puzzle/Quackery/4-rings-or-4-squares-puzzle.quackery new file mode 100644 index 0000000000..fd5fa00757 --- /dev/null +++ b/Task/4-rings-or-4-squares-puzzle/Quackery/4-rings-or-4-squares-puzzle.quackery @@ -0,0 +1,36 @@ + [ swap dip [ 1+ split drop ] + split nip ] is slice ( [ n n --> [ ) + + [ 0 swap witheach + ] is sum ( [ --> n ) + + [ slice sum join ] is square ( [ [ n n --> [ ) + + [ true swap + behead swap witheach + [ over = not if + [ dip not conclude ] ] + drop ] is same ( [ --> b ) + + [ [] temp put + over - 1+ times + [ dup i^ + temp gather ] + drop + temp take ] is low->high ( n n --> [ ) + + [ [] temp put + witheach + [ [] + over 0 1 square + over 1 3 square + over 3 5 square + over 5 6 square + same iff + [ nested temp gather ] + else drop ] + temp take ] is task ( [ n --> [ ) + + 1 7 low->high permutations task + witheach [ echo cr ] cr + 3 9 low->high permutations task + witheach [ echo cr ] cr + 0 9 low->high 7 arrangements task size echo diff --git a/Task/4-rings-or-4-squares-puzzle/Rust/4-rings-or-4-squares-puzzle.rust b/Task/4-rings-or-4-squares-puzzle/Rust/4-rings-or-4-squares-puzzle.rs similarity index 100% rename from Task/4-rings-or-4-squares-puzzle/Rust/4-rings-or-4-squares-puzzle.rust rename to Task/4-rings-or-4-squares-puzzle/Rust/4-rings-or-4-squares-puzzle.rs diff --git a/Task/4-rings-or-4-squares-puzzle/Scheme/4-rings-or-4-squares-puzzle.ss b/Task/4-rings-or-4-squares-puzzle/Scheme/4-rings-or-4-squares-puzzle.scm similarity index 100% rename from Task/4-rings-or-4-squares-puzzle/Scheme/4-rings-or-4-squares-puzzle.ss rename to Task/4-rings-or-4-squares-puzzle/Scheme/4-rings-or-4-squares-puzzle.scm diff --git a/Task/4-rings-or-4-squares-puzzle/Uiua/4-rings-or-4-squares-puzzle.uiua b/Task/4-rings-or-4-squares-puzzle/Uiua/4-rings-or-4-squares-puzzle.uiua new file mode 100644 index 0000000000..be7a6495bb --- /dev/null +++ b/Task/4-rings-or-4-squares-puzzle/Uiua/4-rings-or-4-squares-puzzle.uiua @@ -0,0 +1,4 @@ +# Solve 4 equations in 7 variables, all distinct. +Test ← =1⧻◴≡⌟◇(/+⊏){0_1 1_2_3 3_4_5 5_6} +▽⊸≡Test⧅≠⊸⧻+1⇡7 +▽⊸≡Test⧅≠⊸⧻+3⇡7 diff --git a/Task/4-rings-or-4-squares-puzzle/V-(Vlang)/4-rings-or-4-squares-puzzle.v b/Task/4-rings-or-4-squares-puzzle/V-(Vlang)/4-rings-or-4-squares-puzzle-1.v similarity index 100% rename from Task/4-rings-or-4-squares-puzzle/V-(Vlang)/4-rings-or-4-squares-puzzle.v rename to Task/4-rings-or-4-squares-puzzle/V-(Vlang)/4-rings-or-4-squares-puzzle-1.v diff --git a/Task/4-rings-or-4-squares-puzzle/V-(Vlang)/4-rings-or-4-squares-puzzle-2.v b/Task/4-rings-or-4-squares-puzzle/V-(Vlang)/4-rings-or-4-squares-puzzle-2.v new file mode 100644 index 0000000000..f44447a8e6 --- /dev/null +++ b/Task/4-rings-or-4-squares-puzzle/V-(Vlang)/4-rings-or-4-squares-puzzle-2.v @@ -0,0 +1,38 @@ +import math.bits + +fn main ( ) { + mut n := 0 + mut t := []u8{len:7} + + n = solve ( 0, mut t, 1, 7, true ) + println ( "$n unique solutions in 1 to 7" ) + n = solve ( 0, mut t, 3, 9, true ) + println("$n unique solutions in 3 to 9") + n = solve ( 0, mut t, 0, 9, false ) + println("$n non-unique solutions in 0 to 9") +} + +fn solve ( lvl u8, mut t []u8, low u8, high u8,unique bool ) int { + if lvl==7 { + return int(suma(t) && (!unique || isunique( t ))) + } + mut cnt:=0 + for v := low; v <= high; v++ { + t[lvl] = v + cnt += solve ( lvl + 1, mut t, low, high, unique ) + } + return cnt +} + +@[inline] +fn isunique ( t []u8 ) bool { + return bits.ones_count_32(u32(1)<= n - 1 THEN 1 + ELIF ( n - col ) < col THEN names[ n - col ] + ELIF ( n - col ) = col AND NOT ODD n THEN names[ n - col ] + ELSE + NAMEG partial sum := 0; + FOR k TO col DO partial sum +:= c[ n - col ][ k ] OD; + partial sum + FI + OD; + names[ n ]:= 0; + FOR k TO n DO names[ n ] +:= c[ n ][ k ] OD +; IF n MOD 200 = 0 THEN print( ( "...", whole( n, 0 ), newline ) ) FI +OD; + +# display the first 25 rows of the triangle # +FOR n TO 25 DO + print( ( "(", whole( names[ n ], -6 ), ")", whole( n, -3 ), ":" ) ); + FOR col TO n DO + print( ( " ", whole( c[ n ][ col ], -3 ) ) ) + OD; + print( ( newline ) ) +OD; + +print( ( " 23: ", whole( names[ 23 ], 0 ), newline ) ); +print( ( " 123: ", whole( names[ 123 ], 0 ), newline ) ) diff --git a/Task/9-billion-names-of-God-the-integer/Ada/9-billion-names-of-god-the-integer.ada b/Task/9-billion-names-of-God-the-integer/Ada/9-billion-names-of-god-the-integer.adb similarity index 100% rename from Task/9-billion-names-of-God-the-integer/Ada/9-billion-names-of-god-the-integer.ada rename to Task/9-billion-names-of-God-the-integer/Ada/9-billion-names-of-god-the-integer.adb diff --git a/Task/9-billion-names-of-God-the-integer/Crystal/9-billion-names-of-god-the-integer.crystal b/Task/9-billion-names-of-God-the-integer/Crystal/9-billion-names-of-god-the-integer.cr similarity index 100% rename from Task/9-billion-names-of-God-the-integer/Crystal/9-billion-names-of-god-the-integer.crystal rename to Task/9-billion-names-of-God-the-integer/Crystal/9-billion-names-of-god-the-integer.cr diff --git a/Task/9-billion-names-of-God-the-integer/EasyLang/9-billion-names-of-god-the-integer.easy b/Task/9-billion-names-of-God-the-integer/EasyLang/9-billion-names-of-god-the-integer.easy new file mode 100644 index 0000000000..31f4c0500b --- /dev/null +++ b/Task/9-billion-names-of-God-the-integer/EasyLang/9-billion-names-of-god-the-integer.easy @@ -0,0 +1,64 @@ +func[] bnadd a[] b[] . + if len a[] < len b[] : swap a[] b[] + for i = 1 to len a[] + bi = 0 + if i <= len b[] : bi = b[i] + h = a[i] + bi + c + r[] &= h mod 10000000 + c = h div 10000000 + . + if c > 0 : r[] &= c + return r[] +. +func[] bnsub a[] b[] . + for i = 1 to len a[] + ai = a[i] + bi = 0 + if i <= len b[] : bi = b[i] + bi += c + c = 0 + if bi > ai + ai += 10000000 + c = 1 + . + r[] &= ai - bi + . + while r[$] = 0 : len r[] -1 + return r[] +. +func$ str bn[] . + s$ = bn[$] + for i = len bn[] - 1 downto 1 + h$ = bn[i] + s$ &= substr "0000000" 1 (7 - len h$) & h$ + . + return s$ +. +proc parti n &p[][] . + subr upd + if k mod 2 = 1 + h[] = bnadd p[n][] p[d][] + else + h[] = bnsub p[n][] p[d][] + . + p[n][] = h[] + . + for k = 1 to n + d = n - k * (3 * k - 1) div 2 + if d < 0 : break 1 + upd + d -= k + if d < 0 : break 1 + upd + . +. +proc partitions_p n &p[][] . + p[][] = [ ] + len p[][] n + 1 + p[0][] = [ 1 ] + for i to n : parti i p[][] +. +for nn in [ 23 123 1234 12345 ] + partitions_p nn p[][] + print nn & ": " & str p[nn][] +. diff --git a/Task/9-billion-names-of-God-the-integer/Elixir/9-billion-names-of-god-the-integer.elixir b/Task/9-billion-names-of-God-the-integer/Elixir/9-billion-names-of-god-the-integer.ex similarity index 100% rename from Task/9-billion-names-of-God-the-integer/Elixir/9-billion-names-of-god-the-integer.elixir rename to Task/9-billion-names-of-God-the-integer/Elixir/9-billion-names-of-god-the-integer.ex diff --git a/Task/9-billion-names-of-God-the-integer/FutureBasic/9-billion-names-of-god-the-integer.basic b/Task/9-billion-names-of-God-the-integer/FutureBasic/9-billion-names-of-god-the-integer.basic new file mode 100644 index 0000000000..6c25428226 --- /dev/null +++ b/Task/9-billion-names-of-God-the-integer/FutureBasic/9-billion-names-of-god-the-integer.basic @@ -0,0 +1,179 @@ +// +// 9 billion names of G-D the integer +// +// Using FutureBasic 7.0.35 +// September 2025, R.W. +// + +include "gmp.incl" // GMP only (MPFR not needed here) + +_kTriMax = 25 +_kMaxP = 123456 // compile-time bound for big_p[] + +UInt64 tri(_kTriMax, _kTriMax) // the 25 by 25 triangle +mpz_t big_p(_kMaxP) // partition values P(0.._kMaxP) + +// +// Integer partition via GMP (mpz_t) +// +// Computes P(0..partMax) in global big_p[] +// big_p(xxxxx) will have _kMaxP elements +// +// At its largest sum term (123456), +// it would be greater than 10^385 or hundreds of digits +// beyond a centillion + +local fn ComputePartitions( partMax as long ) + long i, j, k + long a, b + mpz_t s + + if partMax > _kMaxP then partMax = _kMaxP + // temp accumulator + mpz_init( s ) + + // base case + mpz_set_ui( big_p(0), 1 ) + + for i = 1 to partMax + // generalized pentagonal sequence setup + j = 1 + k = 1 + b = 2 + a = 5 + + while j > 0 + // j = i - (3*k*k+k) \ 2 + // (implemented incrementally via b,a) + j = i - b + b = b + a + a = a + 3 + + if j >= 0 + if (k AND 1) <> 0 + mpz_add( s, s, big_p(j) ) + else + mpz_sub( s, s, big_p(j) ) + end if + end if + // second term at j + k + j = j + k + if j >= 0 + if (k AND 1) <> 0 + mpz_add( s, s, big_p(j) ) + else + mpz_sub( s, s, big_p(j) ) + end if + end if + k ++ + wend + + mpz_swap( big_p(i), s ) + next + + mpz_clear( s ) +end fn + +// +// Partition triangle using 64-bit ints +// p(n,k) -> # of partitions of n with +// largest part exactly k +// +local fn BuildPartitionTriangle + CFStringRef pLine, filler + pLine = @"" + filler = @" " + long n, k + + // first 3 rows are always 1's + tri(1,1) = 1 + tri(2,1) = 1 + tri(2,2) = 1 + tri(3,1) = 1 + tri(3,2) = 1 + tri(3,3) = 1 + + for n = 4 to _kTriMax + for k = 1 to n + if k * 2 > n + tri(n,k) = tri(n-1, k-1) + else + tri(n,k) = tri(n-1, k-1) + tri(n-k, k) + end if + next + next + + // display the triangle + for n = 1 to 25 + pLine = @"" + for k = 1 to n + pLine = concat(pLine, mid(str(tri(n,k)),1),@" ") + next k + pLine = concat(left(filler, 38 - len(pLine)/2) , pLine) + print pLine + next n +end fn +// +// MAIN +// ---------------------------------------------- +Window 1, @"9 Billion Names of G-D the integer",¬ +(0,0,980,540) + +long n, k, max +max = 123456 // must not exceed _kMaxP +CFStringRef pLine +pLine = @"" + +CFTimeInterval t +t = fn CACurrentMediaTime // start clock + +fn BuildPartitionTriangle + +// Initialize big_p(0..kPartMax) to 0 +for n = 0 to max + mpz_init( big_p(n) ) +next + +// Compute partitions P(0..kPartMax) +fn ComputePartitions( max ) +print@ +print @"Sums" +print @"----" + +long cxCount +cxCount = 5 +Int i +long cx(5) +cx(1) = 23 +cx(2) = 123 +cx(3) = 1234 +cx(4) = 12345 +cx(5) = 123456 + +long at +at = 1 + +for i = 1 to max + if at <= cxCount + if i = cx(at) + pLine = fn mpz_cf( 10,big_p(i) ) + print concat( @"G(", mid(str(i),1), @") = ", pLine ) + at = at + 1 + end if + else + exit for + end if +next +// +// stop the clock +print@ +printf @"Elapsed time = %.4f ms.", (fn CACurrentMediaTime - t)*1000 + +// Cleanup +for n = 0 to max + mpz_clear( big_p(n) ) +next + +HandleEvents + +// diff --git a/Task/9-billion-names-of-God-the-integer/Groovy/9-billion-names-of-god-the-integer.groovy b/Task/9-billion-names-of-God-the-integer/Groovy/9-billion-names-of-god-the-integer.groovy index fed2cfdfba..006cf36944 100644 --- a/Task/9-billion-names-of-God-the-integer/Groovy/9-billion-names-of-god-the-integer.groovy +++ b/Task/9-billion-names-of-God-the-integer/Groovy/9-billion-names-of-god-the-integer.groovy @@ -1,4 +1,4 @@ -def partitions(c) +static def partitions(c) { def p=[]; diff --git a/Task/9-billion-names-of-God-the-integer/Julia/9-billion-names-of-god-the-integer.julia b/Task/9-billion-names-of-God-the-integer/Julia/9-billion-names-of-god-the-integer.jl similarity index 100% rename from Task/9-billion-names-of-God-the-integer/Julia/9-billion-names-of-god-the-integer.julia rename to Task/9-billion-names-of-God-the-integer/Julia/9-billion-names-of-god-the-integer.jl diff --git a/Task/9-billion-names-of-God-the-integer/Kotlin/9-billion-names-of-god-the-integer.kotlin b/Task/9-billion-names-of-God-the-integer/Kotlin/9-billion-names-of-god-the-integer.kts similarity index 100% rename from Task/9-billion-names-of-God-the-integer/Kotlin/9-billion-names-of-god-the-integer.kotlin rename to Task/9-billion-names-of-God-the-integer/Kotlin/9-billion-names-of-god-the-integer.kts diff --git a/Task/9-billion-names-of-God-the-integer/OCaml/9-billion-names-of-god-the-integer.ocaml b/Task/9-billion-names-of-God-the-integer/OCaml/9-billion-names-of-god-the-integer.ml similarity index 100% rename from Task/9-billion-names-of-God-the-integer/OCaml/9-billion-names-of-god-the-integer.ocaml rename to Task/9-billion-names-of-God-the-integer/OCaml/9-billion-names-of-god-the-integer.ml diff --git a/Task/9-billion-names-of-God-the-integer/Pluto/9-billion-names-of-god-the-integer.pluto b/Task/9-billion-names-of-God-the-integer/Pluto/9-billion-names-of-god-the-integer.pluto new file mode 100644 index 0000000000..32f0b981d9 --- /dev/null +++ b/Task/9-billion-names-of-God-the-integer/Pluto/9-billion-names-of-god-the-integer.pluto @@ -0,0 +1,39 @@ +local bigint = require "pluto:bigint" +local fmt = require "fmt" + +local zero = bigint.new(0) +local one = bigint.new(1) + +local cache = {{one}} + +local function cumu(n) + if #cache <= n then + for l = #cache, n do + local r = {zero} + for x = 1, l do + local min = l - x + if x < min then min = x end + r:insert(r:back() + cache[l - x + 1][min + 1]) + end + cache:insert(r) + end + end + return cache[n + 1] +end + +local function row(n) + local r = cumu(n) + return range(1, n):map(|i| -> r[i + 1] - r[i]) +end + +print("Rows:") +for i = 1, 25 do + fmt.write("%2d: ", i) + local r = row(i) + fmt.tprint("%3s", r, #r) +end + +print("\nSums:") +for {23, 123, 1234, 12345} as i do + fmt.print("%5d: %s", i, cumu(i):back()) +end diff --git a/Task/9-billion-names-of-God-the-integer/R/9-billion-names-of-god-the-integer.r b/Task/9-billion-names-of-God-the-integer/R/9-billion-names-of-god-the-integer.r new file mode 100644 index 0000000000..70d49d803a --- /dev/null +++ b/Task/9-billion-names-of-God-the-integer/R/9-billion-names-of-god-the-integer.r @@ -0,0 +1,10 @@ +library(partitions) +library(stringi) + +get_row <- function(x) unname(table(parts(x)[1,])) + +center_string <- function(s,pad_len=80) stri_pad_both(s,(pad_len - length(s))," ") + +for (i in 1:25) cat(center_string(stri_c(get_row(i),collapse = " "),80),"\n") + +cat("The sum of G(25) is:", sum(get_row(25)),"\n") diff --git a/Task/9-billion-names-of-God-the-integer/Rebol/9-billion-names-of-god-the-integer.rebol b/Task/9-billion-names-of-God-the-integer/Rebol/9-billion-names-of-god-the-integer.rebol new file mode 100644 index 0000000000..4c937e4e34 --- /dev/null +++ b/Task/9-billion-names-of-God-the-integer/Rebol/9-billion-names-of-god-the-integer.rebol @@ -0,0 +1,101 @@ +Rebol [ + title: "Rosetta code: 9 billion names of God the integer" + file: %9_billion_names_of_God_the_integer.r3 + url: https://rosettacode.org/wiki/9_billion_names_of_God_the_integer + needs: 3.0.0 + note: {Based on Red language version} +] +names-of-god: function/with [ + row [integer!] "row number (>= 1)" + /show "Display intermediate results" + /all "When showing, print all intermediate data" +][ + ;; Validate input - require row >= 1, otherwise trigger a runtime error + assert [row >= 1] + + ;; If /show refinement is used, display results for the given row + if show [ + ;; Ensure nums/:row is computed; if not, recursively compute it + unless nums/:row [names-of-god row] + + ;; Loop from 1 to row + repeat i row [ + either all [ ;; If /all refinement is used, display extra details + probe reduce [i nums/:i sums/:i] ;; Show index, sequence, and sum + ][ + print nums/:i ;; Otherwise, just print the sequence + ] + ] + ] + + ;; Compute a new row from scratch (if row not already computed)... + unless sum: sums/:row [ + out: clear [] ;; Temporary storage for row's elements + half: to integer! row / 2 ;; Middle position of the row + + ;; Ensure all required previous rows exist; generate missing ones + if row - 1 > last: length? nums [ + repeat i row - last - 1 [ + names-of-god last + i + ] + ] + + ;; Build the `out` block for this row + repeat col row - 1 [ + ;; Special case: the middle element + either col = (half + 1) [ + append out at nums/(row - 1) half ;; Insert from previous row's middle + break ;; Stop building here + ][ + ;; General case: append sum-part of two earlier sequences + append out sum-part nums/(row - col) col + ] + ] + + ;; Compute the sum of the row + sum: 0.0 + forall out [ + sum: sum + out/1 + ] + + ;; Cache the computed row and its sum + sums/:row: sum + nums/:row: copy out + clear out + ] + sums/:row ;; Return sum of the row +][ + ;; ===== WITH BLOCK (local helper definitions and persistent state) ===== + + ;; Helper function: sum the first `count` elements from the given block `nums` + sum-part: function [nums [block!] count [integer!]][ + out: 0.0 + loop count [ + out: out + nums/1 + if empty? nums: next nums [break] ;; Stop if we've exhausted the block + ] + ;; If within integer range, convert to integer + if out <= 0#7fffffffffffffff [out: to integer! out] + out + ] + + ;; Persistent storage for each computed row (map! with row → sequence) + ;; Start with base cases: + ;; row 1 = [1] + ;; row 2 = [1 1] + nums: make map! [1 [1] 2 [1 1]] + + ;; Persistent storage for row sums (map! with row → sum) + ;; Base sums: row 1 sum = 1, row 2 sum = 2 + sums: make map! [1 1 2 2] +] + + + +print "rows: ^/" +names-of-god/show 25 + +print "^/sums: ^/" +probe names-of-god 23 +probe names-of-god 123 +probe names-of-god 1234 diff --git a/Task/9-billion-names-of-God-the-integer/Rust/9-billion-names-of-god-the-integer.rust b/Task/9-billion-names-of-God-the-integer/Rust/9-billion-names-of-god-the-integer.rs similarity index 100% rename from Task/9-billion-names-of-God-the-integer/Rust/9-billion-names-of-god-the-integer.rust rename to Task/9-billion-names-of-God-the-integer/Rust/9-billion-names-of-god-the-integer.rs diff --git a/Task/9-billion-names-of-God-the-integer/Scheme/9-billion-names-of-god-the-integer.ss b/Task/9-billion-names-of-God-the-integer/Scheme/9-billion-names-of-god-the-integer.scm similarity index 100% rename from Task/9-billion-names-of-God-the-integer/Scheme/9-billion-names-of-god-the-integer.ss rename to Task/9-billion-names-of-God-the-integer/Scheme/9-billion-names-of-god-the-integer.scm diff --git a/Task/9-billion-names-of-God-the-integer/Wren/9-billion-names-of-god-the-integer.wren b/Task/9-billion-names-of-God-the-integer/Wren/9-billion-names-of-god-the-integer.wren index fb9cbec15e..30cf0c81f5 100644 --- a/Task/9-billion-names-of-God-the-integer/Wren/9-billion-names-of-god-the-integer.wren +++ b/Task/9-billion-names-of-God-the-integer/Wren/9-billion-names-of-god-the-integer.wren @@ -1,5 +1,5 @@ -import "/big" for BigInt -import "/fmt" for Fmt +import "./big" for BigInt +import "./fmt" for Fmt var cache = [[BigInt.one]] var cumu = Fn.new { |n| diff --git a/Task/9-billion-names-of-God-the-integer/Zig/9-billion-names-of-god-the-integer-1.zig b/Task/9-billion-names-of-God-the-integer/Zig/9-billion-names-of-god-the-integer-1.zig new file mode 100644 index 0000000000..7502e47386 --- /dev/null +++ b/Task/9-billion-names-of-God-the-integer/Zig/9-billion-names-of-god-the-integer-1.zig @@ -0,0 +1,63 @@ +const std = @import("std"); +const print = std.debug.print; +const bigint = std.math.big.int.Managed; +const eql = std.mem.eql; +const Array = std.ArrayList; +const Array1 = Array(bigint); +const Array2 = Array(Array1); +var gpa = std.heap.GeneralPurposeAllocator(.{}){}; +const allocator = gpa.allocator(); + +fn cumu(cache: *Array2, n: usize) !*Array1 { + var y = cache.items.len; + while (cache.items.len <= n) : (y += 1) { + var roww = Array1.init(allocator); + try roww.append(try bigint.init(allocator)); + for (1..y + 1) |x| { + var cache_value = try cache.items[y - x].items[@min(x, y - x)].clone(); + try cache_value.add(&cache_value, &roww.getLast()); + try roww.append(cache_value); + } + try cache.append(roww); + } + return &(cache.items[n]); +} + +fn row(cache: *Array2, n: usize) !void { + const e = try cumu(cache, n); + var v = try bigint.init(allocator); + for (0..n) |i| { + try v.sub(&e.items[i + 1], &e.items[i]); + print(" {} ", .{v}); + } + v.deinit(); + print("\n", .{}); +} + +pub fn main() !void { + var cache = Array2.init(allocator); + defer { + cache.deinit(); + } + defer { + while (cache.popOrNull()) |l| { + l.deinit(); + } + } + var cache0 = Array1.init(allocator); + var v = try bigint.init(allocator); + try v.set(1); + try cache0.append(v); + try cache.append(cache0); + + print("rows:\n", .{}); + for (1..1000) |x| { + try row(&cache, x); + } + + print("\nsums:\n", .{}); + for ([_]usize{ 23, 123, 999 }) |num| { + const r = try cumu(&cache, num); + print("{d: >4} {d}\n", .{ num, r.getLast() }); + } +} diff --git a/Task/9-billion-names-of-God-the-integer/Zig/9-billion-names-of-god-the-integer-2.zig b/Task/9-billion-names-of-God-the-integer/Zig/9-billion-names-of-god-the-integer-2.zig new file mode 100644 index 0000000000..3b8f04f057 --- /dev/null +++ b/Task/9-billion-names-of-God-the-integer/Zig/9-billion-names-of-god-the-integer-2.zig @@ -0,0 +1,35 @@ +const std = @import("std"); +const print = std.debug.print; +const bigint = std.math.big.int.Managed; +const eql = std.mem.eql; +const Array = std.ArrayList; +const Array1 = Array(bigint); +var gpa = std.heap.GeneralPurposeAllocator(.{}){}; +const allocator = gpa.allocator(); + +fn calc ( n:usize, p:*Array1) !void { + for ( 1..n+1 ) |k| { + var d:i64 = @intCast(n); + d -= @intCast(k*(3*k - 1)/2); + inline for ( 0..2 ) |_| { + if ( d < 0 ) return; + if (k&1>0) try p.items[n].add ( &p.items[n], &p.items[@intCast(d)] ) + else try p.items[n].sub ( &p.items[n], &p.items[@intCast(d)] ); + d -= @intCast(k); + } + } +} + +fn main() !void { + const s = [_]usize{ 23, 123, 1234, 12345, 123456 }; + var p = Array1.init ( allocator ); + try p.append ( try bigint.initSet ( allocator, 1 ) ); + var i:usize=1; + for ( s )|m|{ + while (i<=m):(i+=1){ + try p.append( try bigint.init(allocator) ); + try calc( i, &p ); + } + print("P({d}) = {d}\n", .{m,p.items[m]} ); + } +} diff --git a/Task/99-bottles-of-beer/8th/99-bottles-of-beer-1.8th b/Task/99-bottles-of-beer/8th/99-bottles-of-beer-1.8th new file mode 100644 index 0000000000..f07c88a955 --- /dev/null +++ b/Task/99-bottles-of-beer/8th/99-bottles-of-beer-1.8th @@ -0,0 +1,26 @@ +\ 99 bottles of beer on the wall: +[ + "no more bottles" , + "one bottle" , + ( dup . " bottles" ) +] var, bottles + +: .bottles + dup 2 n:min bottles @ caseof ; + +: .beer + .bottles . " of beer" . ; + +: .wall + .beer " on the wall" . ; + +: .take + " Take one down and pass it around" . ; + +: beers + .wall ", " . .beer '; putc cr + n:1- 0 max .take ", " . + .wall '. putc cr drop ; + +' beers 1 99 loop- +bye diff --git a/Task/99-bottles-of-beer/8th/99-bottles-of-beer-2.8th b/Task/99-bottles-of-beer/8th/99-bottles-of-beer-2.8th new file mode 100644 index 0000000000..f736dda979 --- /dev/null +++ b/Task/99-bottles-of-beer/8th/99-bottles-of-beer-2.8th @@ -0,0 +1,12 @@ +[ + ( "Just one more bottle of beer on the wall, one bottle of beer.\n" . ) , + ( I dup "%d bottles of beer on the wall, %d bottles of beer.\n" s:strfmt . ) +] constant lyrics + +: app:main + ( + dup lyrics [2,99] rot ' n:cmp a:pigeon w:exec + n:1- "Take one down, pass it around, %d bottles of beer on the wall.\n\n" s:strfmt . + ) 1 99 loop- + + "No more bottles of beer on the wall, no more bottles of beer.\n" . ; diff --git a/Task/99-bottles-of-beer/8th/99-bottles-of-beer.8th b/Task/99-bottles-of-beer/8th/99-bottles-of-beer.8th deleted file mode 100644 index fa816e4a36..0000000000 --- a/Task/99-bottles-of-beer/8th/99-bottles-of-beer.8th +++ /dev/null @@ -1,20 +0,0 @@ -\ 99 bottles of beer on the wall: -: allout "no more bottles" ; -: just-one "1 bottle" ; -: yeah! dup . " bottles" ; - -[ - ' allout , - ' just-one , - ' yeah! , -] var, bottles - -: .bottles dup 2 n:min bottles @ swap caseof ; -: .beer .bottles . " of beer" . ; -: .wall .beer " on the wall" . ; -: .take " Take one down and pass it around" . ; -: beers .wall ", " . .beer '; putc cr - n:1- 0 max .take ", " . - .wall '. putc cr drop ; - -' beers 1 99 loop- bye diff --git a/Task/99-bottles-of-beer/ABC/99-bottles-of-beer.abc b/Task/99-bottles-of-beer/ABC/99-bottles-of-beer.abc new file mode 100644 index 0000000000..fcc2bcba65 --- /dev/null +++ b/Task/99-bottles-of-beer/ABC/99-bottles-of-beer.abc @@ -0,0 +1,19 @@ +HOW TO RETURN bottles n: + SELECT: + n<0: RETURN "99 bottles" + n=0: RETURN "No more bottles" + n=1: RETURN "1 bottle" + n>1: RETURN "`n` bottles" + +HOW TO SING VERSE n: + WRITE "`bottles n` of beer on the wall,"/ + WRITE "`bottles n` of beer,"/ + SELECT: + n=0: WRITE "Go to the store and buy some more,"/ + n=1: WRITE "Take it down and pass it around,"/ + n>1: WRITE "Take one down and pass it around,"/ + WRITE "`bottles (n-1)` of beer on the wall."/ + WRITE / + +FOR n IN {0..99}: + SING VERSE 99-n diff --git a/Task/99-bottles-of-beer/ALGOL-68/99-bottles-of-beer.alg b/Task/99-bottles-of-beer/ALGOL-68/99-bottles-of-beer.alg index 5ec893ef5a..194eebdb25 100644 --- a/Task/99-bottles-of-beer/ALGOL-68/99-bottles-of-beer.alg +++ b/Task/99-bottles-of-beer/ALGOL-68/99-bottles-of-beer.alg @@ -1,8 +1,10 @@ -main:( - FOR bottles FROM 99 TO 1 BY -1 DO - printf(($z-d" bottles of beer on the wall"l$, bottles)); - printf(($z-d" bottles of beer"l$, bottles)); - printf(($"Take one down, pass it around"l$)); - printf(($z-d" bottles of beer on the wall"ll$, bottles-1)) - OD -) +FOR bottles FROM 99 BY -1 TO 1 DO + STRING bottles now = whole(bottles,0) + " bottle" + IF bottles = 1 THEN "" ELSE "s" FI; + STRING bottles left = IF bottles = 1 THEN "No more" ELSE whole(bottles-1,0) FI + + " bottle" + + IF bottles = 2 THEN "" ELSE "s" FI; + print((bottles now," of beer on the wall",newline)); + print((bottles now," of beer",newline)); + print(("Take one down, pass it around",newline)); + print((bottles left," of beer on the wall",newline,newline)) +OD diff --git a/Task/99-bottles-of-beer/Ada/99-bottles-of-beer-1.ada b/Task/99-bottles-of-beer/Ada/99-bottles-of-beer-1.adb similarity index 100% rename from Task/99-bottles-of-beer/Ada/99-bottles-of-beer-1.ada rename to Task/99-bottles-of-beer/Ada/99-bottles-of-beer-1.adb diff --git a/Task/99-bottles-of-beer/Ada/99-bottles-of-beer-2.ada b/Task/99-bottles-of-beer/Ada/99-bottles-of-beer-2.adb similarity index 100% rename from Task/99-bottles-of-beer/Ada/99-bottles-of-beer-2.ada rename to Task/99-bottles-of-beer/Ada/99-bottles-of-beer-2.adb diff --git a/Task/99-bottles-of-beer/Aria/99-bottles-of-beer.aria b/Task/99-bottles-of-beer/Aria/99-bottles-of-beer.aria new file mode 100644 index 0000000000..7e36393581 --- /dev/null +++ b/Task/99-bottles-of-beer/Aria/99-bottles-of-beer.aria @@ -0,0 +1,48 @@ +struct Lyrics { + type func new(n: Int) { + assert n > 0; + return alloc(This) { + .n = n, + }; + } + + func prettyprint() { + val suffix_n = this.n == 1 ? "" : "s"; + val suffix_n_minus_1 = this.n == 2 ? "" : "s"; + return "{0} bottle{2} of beer on the wall, {0} bottle{2} of beer.\nTake one down and pass it around, {1} bottle{3} of beer on the wall.\n".format(this.n, this.n-1, suffix_n, suffix_n_minus_1); + } +} + +struct Song { + type func new(n: Int) { + assert n > 0; + return alloc(This) { + .n = n, + }; + } + + func iterator() { + return this; + } + + func next() { + if this.n == 0 { + return Box(){.done = true}; + } + + val n = this.n; + this.n -= 1; + + return Box() { + .done = false, + .value = Lyrics.new(n), + }; + } +} + +func main() { + val song = Song.new(99); + for verse in song { + println(verse); + } +} diff --git a/Task/99-bottles-of-beer/ArkScript/99-bottles-of-beer.ark b/Task/99-bottles-of-beer/ArkScript/99-bottles-of-beer.ark new file mode 100644 index 0000000000..d12274823c --- /dev/null +++ b/Task/99-bottles-of-beer/ArkScript/99-bottles-of-beer.ark @@ -0,0 +1,24 @@ +# try and get an argument from the command line invocation +(let arg + (if (>= (len sys:args) 1) + (toNumber (@ sys:args 0)) + nil)) +# if no argument was passed the default value will be 100 +(let i + (if (nil? arg) + 100 + arg)) + +(let explode-bottles (fun (n) + (if (> n 1) { + (print (string:format "{} Bottles of beer on the wall\n{} bottles of beer\nTake one down, pass it around" n n)) + (print (string:format "{} Bottles of beer on the wall." (- n 1))) + (explode-bottles (- n 1)) }) +(explode-bottles i) + +# alternative solution with a loop +(mut n i) +(while (> n 1) { + (print (string:format "{} Bottles of beer on the wall\n{} bottles of beer\nTake one down, pass it around" n n)) + (set n (- n 1)) + (print (string:format "{} Bottles of beer on the wall." n)) }) diff --git a/Task/99-bottles-of-beer/Arturo/99-bottles-of-beer.arturo b/Task/99-bottles-of-beer/Arturo/99-bottles-of-beer.arturo index 36bb34201e..a751484f40 100644 --- a/Task/99-bottles-of-beer/Arturo/99-bottles-of-beer.arturo +++ b/Task/99-bottles-of-beer/Arturo/99-bottles-of-beer.arturo @@ -6,9 +6,8 @@ loop 99..1 'i [ print ~"Take one down, pass it around!" if 1=i-1 -> s: "" - if? i>1 [ + switch i>1 [ print ~"|i-1| bottle|s| of beer on the wall!" print "" - ] - else -> print "No more bottles of beer on the wall!" + ] -> print "No more bottles of beer on the wall!" ] diff --git a/Task/99-bottles-of-beer/BabyCobol/99-bottles-of-beer.cobol b/Task/99-bottles-of-beer/BabyCobol/99-bottles-of-beer.cobol new file mode 100644 index 0000000000..08569d309c --- /dev/null +++ b/Task/99-bottles-of-beer/BabyCobol/99-bottles-of-beer.cobol @@ -0,0 +1,38 @@ + * Pointing out some interesting things: + * - BY 0 subclause of VARYING (illegal in some COBOL dialects) + * - PERFORM THROUGH with internal/external GO TOs + * - using non-reserved keywords (END, DATA) + * - ALTER (works the same way in COBOL) + * - fall-through from MANY-BOTTLES + * - the last NEXT SENTENCE does nothing (plays the role of EXIT) + IDENTIFICATION DIVISION. + PROGRAM-ID. 99 BOTTLES. + DATA DIVISION. + 01 DATA PICTURE IS 999. + PROCEDURE DIVISION. + LOOP VARYING DATA FROM 99 BY 0 + PERFORM COUNT-BOTTLES THROUGH END + DISPLAY DATA "bottles of beer" + DISPLAY "Take one down, pass it around" + SUBTRACT 1 FROM DATA + IF DATA = 1 + THEN ALTER COUNT-BOTTLES TO PROCEED TO SINGLE-BOTTLE + END + PERFORM COUNT-BOTTLES THROUGH END + DISPLAY "" + END. + NO-BOTTLES-LEFT. + DISPLAY "No bottles of beer on the wall" + DISPLAY "" + DISPLAY "Go to the store and buy some more" + DISPLAY "99 bottles of beer on the wall". + STOP. + COUNT-BOTTLES. + GO TO MANY-BOTTLES. + SINGLE-BOTTLE. + DISPLAY DATA "bottle of beer on the wall". + GO TO NO-BOTTLES-LEFT. + MANY-BOTTLES. + DISPLAY DATA "bottles of beer on the wall". + END. + NEXT SENTENCE. diff --git a/Task/99-bottles-of-beer/Ballerina/99-bottles-of-beer.ballerina b/Task/99-bottles-of-beer/Ballerina/99-bottles-of-beer.ballerina new file mode 100644 index 0000000000..d81204e77e --- /dev/null +++ b/Task/99-bottles-of-beer/Ballerina/99-bottles-of-beer.ballerina @@ -0,0 +1,11 @@ +// https://rosettacode.org/wiki/99_bottles_of_beer +import ballerina/io; + +public function main() { + foreach int i in int:range(99, 0, -1) { + io:print(i); io:println(" bottles of beer on the wall"); + io:print(i); io:println(" bottles of beer"); + io:println("Take one down, pass it around"); + io:print(i-1); io:println(" bottles of beer on the wall\n"); + } +} diff --git a/Task/99-bottles-of-beer/Bruijn/99-bottles-of-beer.bruijn b/Task/99-bottles-of-beer/Bruijn/99-bottles-of-beer.bruijn new file mode 100644 index 0000000000..afaffdd63f --- /dev/null +++ b/Task/99-bottles-of-beer/Bruijn/99-bottles-of-beer.bruijn @@ -0,0 +1,11 @@ +:import std/Combinator . +:import std/Number . +:import std/String . + +main [y [[=?0 case-end case-rec]] (+99)] + case-rec n ++ t1 ++ n ++ t2 ++ t3 ++ n ++ t1 ++ "\n" ++ (1 --0) + n number→string 0 + t1 " bottles of beer on the wall\n" + t2 " bottles of beer\n" + t3 "Take one down, pass it around\n" + case-end empty diff --git a/Task/99-bottles-of-beer/COBOL/99-bottles-of-beer-1.cobol b/Task/99-bottles-of-beer/COBOL/99-bottles-of-beer-1.cob similarity index 100% rename from Task/99-bottles-of-beer/COBOL/99-bottles-of-beer-1.cobol rename to Task/99-bottles-of-beer/COBOL/99-bottles-of-beer-1.cob diff --git a/Task/99-bottles-of-beer/COBOL/99-bottles-of-beer-2.cobol b/Task/99-bottles-of-beer/COBOL/99-bottles-of-beer-2.cob similarity index 100% rename from Task/99-bottles-of-beer/COBOL/99-bottles-of-beer-2.cobol rename to Task/99-bottles-of-beer/COBOL/99-bottles-of-beer-2.cob diff --git a/Task/99-bottles-of-beer/COBOL/99-bottles-of-beer-3.cobol b/Task/99-bottles-of-beer/COBOL/99-bottles-of-beer-3.cob similarity index 100% rename from Task/99-bottles-of-beer/COBOL/99-bottles-of-beer-3.cobol rename to Task/99-bottles-of-beer/COBOL/99-bottles-of-beer-3.cob diff --git a/Task/99-bottles-of-beer/Chapel/99-bottles-of-beer.chapel b/Task/99-bottles-of-beer/Chapel/99-bottles-of-beer.chpl similarity index 100% rename from Task/99-bottles-of-beer/Chapel/99-bottles-of-beer.chapel rename to Task/99-bottles-of-beer/Chapel/99-bottles-of-beer.chpl diff --git a/Task/99-bottles-of-beer/Crystal/99-bottles-of-beer.crystal b/Task/99-bottles-of-beer/Crystal/99-bottles-of-beer.cr similarity index 100% rename from Task/99-bottles-of-beer/Crystal/99-bottles-of-beer.crystal rename to Task/99-bottles-of-beer/Crystal/99-bottles-of-beer.cr diff --git a/Task/99-bottles-of-beer/Dart/99-bottles-of-beer.dart b/Task/99-bottles-of-beer/Dart/99-bottles-of-beer.dart index 3251bd7375..07a966aa75 100644 --- a/Task/99-bottles-of-beer/Dart/99-bottles-of-beer.dart +++ b/Task/99-bottles-of-beer/Dart/99-bottles-of-beer.dart @@ -57,5 +57,3 @@ class BeerSong extends Song { return theLyrics; } } - -} diff --git a/Task/99-bottles-of-beer/DuckDB/99-bottles-of-beer-1.duckdb b/Task/99-bottles-of-beer/DuckDB/99-bottles-of-beer-1.duckdb new file mode 100644 index 0000000000..3fe002df2b --- /dev/null +++ b/Task/99-bottles-of-beer/DuckDB/99-bottles-of-beer-1.duckdb @@ -0,0 +1,13 @@ +.header off +.mode list +select list_transform( range(99,-1,-1), + n -> + if (n = 0, + 'No more bottles of beer on the wall' || chr(10) + || 'no more bottles of beer.' || chr(10) + || 'Go to the store, buy some more!' || chr(10) + || '99 bottles of beer on the wall.', + n || ' bottle' || if ( n = 1, '', 's') || ' of beer on the wall' || chr(10) + || n || ' bottle' || if ( n = 1, '', 's') || ' of beer;' || chr(10) + || 'Take one down, pass it around' || chr(10) ) ) + .array_to_string(chr(10)) ; diff --git a/Task/99-bottles-of-beer/DuckDB/99-bottles-of-beer-2.duckdb b/Task/99-bottles-of-beer/DuckDB/99-bottles-of-beer-2.duckdb new file mode 100644 index 0000000000..02dd9eb97c --- /dev/null +++ b/Task/99-bottles-of-beer/DuckDB/99-bottles-of-beer-2.duckdb @@ -0,0 +1,21 @@ +.header off +.mode list + +with recursive cte as ( + select 99 as n, '' as s + union all + select n-1 as n, + if (n = 0, + 'No more bottles of beer on the wall' || chr(10) + || 'no more bottles of beer.' || chr(10) + || 'Go to the store, buy some more!' || chr(10) + || '99 bottles of beer on the wall.', + n || ' bottle' || if ( n = 1, '', 's') || ' of beer on the wall' || chr(10) + || n || ' bottle' || if ( n = 1, '', 's') || ' of beer;' || chr(10) + || 'Take one down, pass it around' || chr(10) ) + from cte + where n > -1 + ) select s + from cte + where s != '' + order by n desc ; diff --git a/Task/99-bottles-of-beer/EMal/99-bottles-of-beer.emal b/Task/99-bottles-of-beer/EMal/99-bottles-of-beer.emal index 7f8bf2daa2..4993f8c5ee 100644 --- a/Task/99-bottles-of-beer/EMal/99-bottles-of-beer.emal +++ b/Task/99-bottles-of-beer/EMal/99-bottles-of-beer.emal @@ -1,30 +1,28 @@ type NinetynineBottles -int DEFAULT_BOTTLES_COUNT = 99 +int DEFAULT_BOTTLES_COUNT ← 99 model int initialBottlesCount, bottlesCount - new by int =bottlesCount - me.initialBottlesCount = bottlesCount + new by int ←bottlesCount + me.initialBottlesCount ← bottlesCount end - fun subject = <|when(me.bottlesCount == 1, "bottle", "bottles") - fun bottles = <|when(me.bottlesCount == 0, "no more", text!me.bottlesCount) - fun goToWall = void by block - text line = me.bottles() + " " + me.subject() + " of beer on the wall, " + + fun subject ← <|when(me.bottlesCount æ 1, "bottle", "bottles") + fun bottles ← <|when(me.bottlesCount æ 0, "no more", text!me.bottlesCount) + fun goToWall ← void by block + text line ← me.bottles() + " " + me.subject() + " of beer on the wall, " + me.bottles() + " " + me.subject() + " of beer." - if me.bottlesCount == 0 do line[0] = line[0].upper() end # text can be modified + if me.bottlesCount æ 0 do line[0] ← line[0].upper() end # text can be modified writeLine(line) end - fun takeOne = logic by block + fun takeOne ← logic by block if --me.bottlesCount < 0 do return false end # cannot take a beer down writeLine("Take one down and pass it around, " + me.bottles() + " " + me.subject() + " of beer on the wall.") writeLine() return true end - fun goToStore = void by block - writeLine("Go to the store and buy some more, " + me.initialBottlesCount + - " bottles of beer on the wall.") - end - fun play = void by block + fun goToStore ← <|writeLine("Go to the store and buy some more, " + + me.initialBottlesCount + " bottles of beer on the wall.") + fun play ← void by block for ever me.goToWall() if not me.takeOne() diff --git a/Task/99-bottles-of-beer/EasyLang/99-bottles-of-beer.easy b/Task/99-bottles-of-beer/EasyLang/99-bottles-of-beer.easy index f1f30f9082..deabe7c1be 100644 --- a/Task/99-bottles-of-beer/EasyLang/99-bottles-of-beer.easy +++ b/Task/99-bottles-of-beer/EasyLang/99-bottles-of-beer.easy @@ -1,18 +1,15 @@ func$ bottle num . - if num = 1 - return "bottle" - . - return "bottles" + if num = 1 : return "1 bottle" + return num & " bottles" . -# i = 99 repeat - print i & " " & bottle i & " of beer on the wall" - print i & " " & bottle i & " of beer" + print bottle i & " of beer on the wall" + print bottle i & " of beer" print "Take one down, pass it around" i -= 1 until i = 0 - print i & " " & bottle i & " of beer on the wall" + print bottle i & " of beer on the wall" print "" . print "No more bottles of beer on the wall" diff --git a/Task/99-bottles-of-beer/Elena/99-bottles-of-beer.elena b/Task/99-bottles-of-beer/Elena/99-bottles-of-beer.elena index 54a7e75cfa..496eaa2e0c 100644 --- a/Task/99-bottles-of-beer/Elena/99-bottles-of-beer.elena +++ b/Task/99-bottles-of-beer/Elena/99-bottles-of-beer.elena @@ -8,7 +8,7 @@ extension bottleOp bottleDescription() = self.toPrintable() + (self != 1).iif(" bottles"," bottle"); - bottleEnumerator() = new Variable(self).doWith:(n) + bottleEnumerator() = new Variable(self).doWith::(n) { ^ new Enumerator { @@ -18,7 +18,7 @@ extension bottleOp .printLine(n.bottleDescription()," of beer on the wall") .printLine(n.bottleDescription()," of beer") .printLine("Take one down, pass it around") - .printLine((n.reduce:1).bottleDescription()," of beer on the wall"); + .printLine((n.reduce(1)).bottleDescription()," of beer on the wall"); reset() {} @@ -27,9 +27,9 @@ extension bottleOp }; } -public program() +public Program() { var bottles := 99; - bottles.bottleEnumerator().forEach:printingLn + bottles.bottleEnumerator().forEach(PrintingLn) } diff --git a/Task/99-bottles-of-beer/Elixir/99-bottles-of-beer.elixir b/Task/99-bottles-of-beer/Elixir/99-bottles-of-beer-1.ex similarity index 100% rename from Task/99-bottles-of-beer/Elixir/99-bottles-of-beer.elixir rename to Task/99-bottles-of-beer/Elixir/99-bottles-of-beer-1.ex diff --git a/Task/99-bottles-of-beer/Elixir/99-bottles-of-beer-2.ex b/Task/99-bottles-of-beer/Elixir/99-bottles-of-beer-2.ex new file mode 100644 index 0000000000..21f101524c --- /dev/null +++ b/Task/99-bottles-of-beer/Elixir/99-bottles-of-beer-2.ex @@ -0,0 +1,36 @@ +last = [ + """ + 2 bottles of beer on the wall + 2 bottles of beer + Take one down, pass it around + 1 bottle of beer on the wall + """, + """ + 1 bottle of beer on the wall + 1 bottle of beer + Take one down, pass it around + No bottles of beer on the wall + """, + """ + No more bottles of beer on the wall + No more bottles of beer + Go to the store and buy some more + 99 bottles of beer on the wall + """ +] + +skeleton = fn n -> + """ + #{n} bottles of beer on the wall + #{n} bottles of beer + Take one down, pass it around + #{n - 1} bottles of beer on the wall + """ +end + +99..3 +|> Stream.map(skeleton) +|> Stream.concat(last) +|> Enum.intersperse("\n") +|> IO.iodata_to_binary() +|> IO.puts() diff --git a/Task/99-bottles-of-beer/Emacs-Lisp/99-bottles-of-beer.l b/Task/99-bottles-of-beer/Emacs-Lisp/99-bottles-of-beer.el similarity index 100% rename from Task/99-bottles-of-beer/Emacs-Lisp/99-bottles-of-beer.l rename to Task/99-bottles-of-beer/Emacs-Lisp/99-bottles-of-beer.el diff --git a/Task/99-bottles-of-beer/Euphoria/99-bottles-of-beer-1.euphoria b/Task/99-bottles-of-beer/Euphoria/99-bottles-of-beer-1.eu similarity index 100% rename from Task/99-bottles-of-beer/Euphoria/99-bottles-of-beer-1.euphoria rename to Task/99-bottles-of-beer/Euphoria/99-bottles-of-beer-1.eu diff --git a/Task/99-bottles-of-beer/Euphoria/99-bottles-of-beer-2.euphoria b/Task/99-bottles-of-beer/Euphoria/99-bottles-of-beer-2.eu similarity index 100% rename from Task/99-bottles-of-beer/Euphoria/99-bottles-of-beer-2.euphoria rename to Task/99-bottles-of-beer/Euphoria/99-bottles-of-beer-2.eu diff --git a/Task/99-bottles-of-beer/Euphoria/99-bottles-of-beer-3.euphoria b/Task/99-bottles-of-beer/Euphoria/99-bottles-of-beer-3.eu similarity index 100% rename from Task/99-bottles-of-beer/Euphoria/99-bottles-of-beer-3.euphoria rename to Task/99-bottles-of-beer/Euphoria/99-bottles-of-beer-3.eu diff --git a/Task/99-bottles-of-beer/Factor/99-bottles-of-beer-1.factor b/Task/99-bottles-of-beer/Factor/99-bottles-of-beer-1.factor new file mode 100644 index 0000000000..55688df8a7 --- /dev/null +++ b/Task/99-bottles-of-beer/Factor/99-bottles-of-beer-1.factor @@ -0,0 +1,6 @@ +USE: math.parser +100 +[ dup 1 - [ >dec " bottles of beer" append [ " on the wall" append ] keep ] bi@ + "Take one down, pass it around" -rot + first CHAR: - = [ 2drop "..." "why's all the rum gone??" ] when ! if leading character is "-" then replace with new string + 4array "\n" join print nl ] each diff --git a/Task/99-bottles-of-beer/Factor/99-bottles-of-beer.factor b/Task/99-bottles-of-beer/Factor/99-bottles-of-beer-2.factor similarity index 100% rename from Task/99-bottles-of-beer/Factor/99-bottles-of-beer.factor rename to Task/99-bottles-of-beer/Factor/99-bottles-of-beer-2.factor diff --git a/Task/99-bottles-of-beer/Goboscript/99-bottles-of-beer.gobo b/Task/99-bottles-of-beer/Goboscript/99-bottles-of-beer.gobo new file mode 100644 index 0000000000..3d8b925c28 --- /dev/null +++ b/Task/99-bottles-of-beer/Goboscript/99-bottles-of-beer.gobo @@ -0,0 +1,44 @@ +%include inflator/string + +costumes "assets/blank.svg"; + +func add_bottle(n) { + local s = "s"; + local s2 = "s"; + local n_minus_1 = $n - 1; + local end = "\n"; + + if $n == 1 { + n_minus_1 = "No more"; + s = ""; + end = ""; + } elif $n == 2 { + s2 = ""; + } + + return $n&" bottle"&s&" of beer on the wall\n" & + $n&" bottle"&s&" of beer\n" & + "Take one down, pass it around\n" & + n_minus_1&" bottle"&s2&" of beer on the wall" & end; +} + +proc do_99_bottles_of_beer { + local ret = ""; + local i = 99; + repeat 99 { + ret &= add_bottle(i); + i--; + } + + split ret, "\n"; + i = 1; + repeat length split { + log split[i]; + i++; + } +} + +onflag{main;} +proc main { + do_99_bottles_of_beer; +} diff --git a/Task/99-bottles-of-beer/Haxe/99-bottles-of-beer-1.haxe b/Task/99-bottles-of-beer/Haxe/99-bottles-of-beer-1.hx similarity index 100% rename from Task/99-bottles-of-beer/Haxe/99-bottles-of-beer-1.haxe rename to Task/99-bottles-of-beer/Haxe/99-bottles-of-beer-1.hx diff --git a/Task/99-bottles-of-beer/Haxe/99-bottles-of-beer-2.haxe b/Task/99-bottles-of-beer/Haxe/99-bottles-of-beer-2.hx similarity index 100% rename from Task/99-bottles-of-beer/Haxe/99-bottles-of-beer-2.haxe rename to Task/99-bottles-of-beer/Haxe/99-bottles-of-beer-2.hx diff --git a/Task/99-bottles-of-beer/Java/99-bottles-of-beer-5.java b/Task/99-bottles-of-beer/Java/99-bottles-of-beer-5.java new file mode 100644 index 0000000000..394eb68af8 --- /dev/null +++ b/Task/99-bottles-of-beer/Java/99-bottles-of-beer-5.java @@ -0,0 +1,76 @@ +import java.util.Scanner; + +public class NineNineBottles { + static int bottlesOfBeer = 99; + static boolean hasBeer = true; + static Scanner keyboard = new Scanner(System.in); + + public static void main(String[] args) { + beerCheck(); + keyboard.close(); + } + + private static void beerCheck() { + if(hasBeer) { + party(bottlesOfBeer); + } + + if(!hasBeer) { + System.out.println("Your ran out of beer. Would you like to go to the store?: "); + String blurryVision, fallingOver, youAreDrunk; + youAreDrunk = keyboard.nextLine(); + fallingOver = "RUHFO" + youAreDrunk.toLowerCase() + "RUHFOISafhur"; + blurryVision = fallingOver.split("[a-zA-Z]", 2).toString(); + if(blurryVision.contains("y")) + blurryVision = blurryVision.substring(0, 1).toUpperCase(); + System.out.println("You entered: " + blurryVision.toString() + fallingOver); + System.out.println("Did you mean yes?: "); + blurryVision = keyboard.nextLine(); + if(blurryVision.contains("y") || blurryVision.contains("Y") || blurryVision.contains("8") + || blurryVision.contains("2") || blurryVision.equalsIgnoreCase(youAreDrunk)) + {String beRECcheeck = blurryVision.toLowerCase(); + if(beRECcheeck.equals("y")) { + goToStore(); + beerCheck(); + } + } + } + } + + private static void party(int bottlesOfBeer) { + while(bottlesOfBeer > 1) { + putOnWall(bottlesOfBeer); + bottlesOfBeer = takeOneDown(bottlesOfBeer); + } + putLastOnWall(bottlesOfBeer); + } + + private static void putOnWall(int bottlesOfBeer) { + System.out.printf("%d bottles of beer on the wall%n", bottlesOfBeer); + + } + + private static int takeOneDown(int bottlesOfBeer) { + System.out.printf("%d bottles of beer%n", bottlesOfBeer); + System.out.println("Take one down, pass it around"); + bottlesOfBeer--; + putOnWall(bottlesOfBeer); + System.out.println(); + return bottlesOfBeer; + + } + + private static void putLastOnWall(int bottleOfBeer) { + System.out.printf("%d bottle of beer on the wall%n", bottleOfBeer); + System.out.printf("%d bottle of beer%n", bottleOfBeer); + System.out.println("Take it down, pass it around"); + bottleOfBeer--; + System.out.println("No more bottles of beer on the wall."); + hasBeer = false; + } + + private static void goToStore() { + bottlesOfBeer = 99; + hasBeer = true; + } +} diff --git a/Task/99-bottles-of-beer/Julia/99-bottles-of-beer-1.julia b/Task/99-bottles-of-beer/Julia/99-bottles-of-beer-1.jl similarity index 100% rename from Task/99-bottles-of-beer/Julia/99-bottles-of-beer-1.julia rename to Task/99-bottles-of-beer/Julia/99-bottles-of-beer-1.jl diff --git a/Task/99-bottles-of-beer/Julia/99-bottles-of-beer-2.julia b/Task/99-bottles-of-beer/Julia/99-bottles-of-beer-2.jl similarity index 100% rename from Task/99-bottles-of-beer/Julia/99-bottles-of-beer-2.julia rename to Task/99-bottles-of-beer/Julia/99-bottles-of-beer-2.jl diff --git a/Task/99-bottles-of-beer/Julia/99-bottles-of-beer-3.julia b/Task/99-bottles-of-beer/Julia/99-bottles-of-beer-3.jl similarity index 100% rename from Task/99-bottles-of-beer/Julia/99-bottles-of-beer-3.julia rename to Task/99-bottles-of-beer/Julia/99-bottles-of-beer-3.jl diff --git a/Task/99-bottles-of-beer/Kotlin/99-bottles-of-beer.kotlin b/Task/99-bottles-of-beer/Kotlin/99-bottles-of-beer.kts similarity index 100% rename from Task/99-bottles-of-beer/Kotlin/99-bottles-of-beer.kotlin rename to Task/99-bottles-of-beer/Kotlin/99-bottles-of-beer.kts diff --git a/Task/99-bottles-of-beer/Langur/99-bottles-of-beer.langur b/Task/99-bottles-of-beer/Langur/99-bottles-of-beer.langur new file mode 100644 index 0000000000..355e6adcbb --- /dev/null +++ b/Task/99-bottles-of-beer/Langur/99-bottles-of-beer.langur @@ -0,0 +1,6 @@ +for i=99; i>0; i-=1 { + writeln "{{i}} bottles of beer on the wall" + writeln "{{i}} bottles of beer" + writeln "Take one down, pass it around" + writeln "{{i-1}} bottles of beer on the wall\n" +} diff --git a/Task/99-bottles-of-beer/Lua/99-bottles-of-beer-4.lua b/Task/99-bottles-of-beer/Lua/99-bottles-of-beer-4.lua new file mode 100644 index 0000000000..5fdc0aa064 --- /dev/null +++ b/Task/99-bottles-of-beer/Lua/99-bottles-of-beer-4.lua @@ -0,0 +1,13 @@ +local bottlesCount = 99 +local word = function(n) return n == 1 and "bottle" or "bottles" end +while bottlesCount do + print (string.format("%d %s of beer on the wall, %d %s of beer", bottlesCount, word(bottlesCount),bottlesCount, word(bottlesCount))) + print ("You take one down, pass it around, ") + bottlesCount = bottlesCount - 1 + if bottlesCount > 0 then + print (string.format("%d %s of beer on the wall", bottlesCount, word(bottlesCount))) + else + print ("No more bottles of beer on the wall.") + end + if bottlesCount == 0 then bottlesCount = false end -- coud use reserved word break instead +end diff --git a/Task/99-bottles-of-beer/Lua/99-bottles-of-beer-5.lua b/Task/99-bottles-of-beer/Lua/99-bottles-of-beer-5.lua new file mode 100644 index 0000000000..8bc69c1a98 --- /dev/null +++ b/Task/99-bottles-of-beer/Lua/99-bottles-of-beer-5.lua @@ -0,0 +1,10 @@ +word = function(n) return n == 1 and "bottle" or "bottles" end + +coldOne = function (bottlesCount) + if bottlesCount < 1 then return print ("drunk, eh?") end + if bottlesCount == 1 then return print ("1 bottle of beer and it's mine!") end + print (string.format("%d %s of beer on the wall, %d %s of beer", bottlesCount, word(bottlesCount),bottlesCount, word(bottlesCount))) + print ("You take one down, pass it around, ") + print (string.format("%d %s of beer on the wall", bottlesCount-1, word(bottlesCount-1))) + coldOne ( bottlesCount - 1) +end diff --git a/Task/99-bottles-of-beer/Nutt/99-bottles-of-beer.nutt b/Task/99-bottles-of-beer/Nutt/99-bottles-of-beer.nutt index ccd2ec6780..fcac676e27 100644 --- a/Task/99-bottles-of-beer/Nutt/99-bottles-of-beer.nutt +++ b/Task/99-bottles-of-beer/Nutt/99-bottles-of-beer.nutt @@ -1,8 +1,8 @@ -module main imports native.io.output.say +module main +import $native 'io' : output#sayn -for i|->{1,2..99;<|>) do - say(""+i+" bottles of beer on the wall, "+i+" bottles of beer") - say("Take one down and pass it around, "+(i-1)+" bottles of beer on the wall.") -done - -end +funct main () : () = + [1, 2; 99]#reverse#each { + sayn "\(it) bottles of beer on the wall, \(it) bottles of beer"; + sayn "Take one down and pass it around, \(it# - 1) bottles of beer on the wall." + } diff --git a/Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-1.ocaml b/Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-1.ml similarity index 100% rename from Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-1.ocaml rename to Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-1.ml diff --git a/Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-2.ocaml b/Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-2.ml similarity index 100% rename from Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-2.ocaml rename to Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-2.ml diff --git a/Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-3.ocaml b/Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-3.ml similarity index 100% rename from Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-3.ocaml rename to Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-3.ml diff --git a/Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-4.ocaml b/Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-4.ml similarity index 100% rename from Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-4.ocaml rename to Task/99-bottles-of-beer/OCaml/99-bottles-of-beer-4.ml diff --git a/Task/99-bottles-of-beer/Oxygene/99-bottles-of-beer.oxy b/Task/99-bottles-of-beer/Oxygene/99-bottles-of-beer-1.oxy similarity index 100% rename from Task/99-bottles-of-beer/Oxygene/99-bottles-of-beer.oxy rename to Task/99-bottles-of-beer/Oxygene/99-bottles-of-beer-1.oxy diff --git a/Task/99-bottles-of-beer/Oxygene/99-bottles-of-beer-2.oxy b/Task/99-bottles-of-beer/Oxygene/99-bottles-of-beer-2.oxy new file mode 100644 index 0000000000..5fc3a8fccb --- /dev/null +++ b/Task/99-bottles-of-beer/Oxygene/99-bottles-of-beer-2.oxy @@ -0,0 +1,21 @@ +namespace _99_beers; + +method bottles(number: Integer): String; +begin +if (number = 1) then + Result := "bottle" + else + Result := "bottles"; +end; + +begin + for n: Integer := 99 downto 1 do + begin + writeLn($"{n} {bottles(n)} of beer on the wall,"); + writeLn($"{n} {bottles(n)} of beer,"); + writeLn($"Take one down, and pass it around,"); + writeLn($"{n-1} {bottles(n-1)} of beer on the wall."); + writeLn(); + end; + readLn; +end. diff --git a/Task/99-bottles-of-beer/PascalABC.NET/99-bottles-of-beer-1.pas b/Task/99-bottles-of-beer/PascalABC.NET/99-bottles-of-beer-1.pas new file mode 100644 index 0000000000..f455395d06 --- /dev/null +++ b/Task/99-bottles-of-beer/PascalABC.NET/99-bottles-of-beer-1.pas @@ -0,0 +1,10 @@ +begin + for var i:=99 to 1 step -1 do + begin + Println(i,'bottles of beer on the wall'); + Println(i,'bottles of beer'); + Println('Take one down, pass it around'); + Println(i-1,'bottles of beer on the wall'); + Println + end; +end. diff --git a/Task/99-bottles-of-beer/PascalABC.NET/99-bottles-of-beer-2.pas b/Task/99-bottles-of-beer/PascalABC.NET/99-bottles-of-beer-2.pas new file mode 100644 index 0000000000..3ce09c9fc9 --- /dev/null +++ b/Task/99-bottles-of-beer/PascalABC.NET/99-bottles-of-beer-2.pas @@ -0,0 +1,10 @@ +begin + for var i:=99 to 1 step -1 do + begin + writeLn($'{i} bottles of beer on the wall'); + writeLn($'{i} bottles of beer'); + writeLn($'Take one down, pass it around'); + writeLn($'{i-1}bottles of beer on the wall'); + writeLn + end; +end. diff --git a/Task/99-bottles-of-beer/Plain-English/99-bottles-of-beer.plain b/Task/99-bottles-of-beer/Plain-English/99-bottles-of-beer.plain index 65fd694264..871d7a9918 100644 --- a/Task/99-bottles-of-beer/Plain-English/99-bottles-of-beer.plain +++ b/Task/99-bottles-of-beer/Plain-English/99-bottles-of-beer.plain @@ -1,26 +1,32 @@ To run: -Start up. -Sing 99 of bottles of beer on the wall. -Wait for the escape key. -Shut down. + Start up. + Sing 99 of bottles of beer on the wall. + Wait for the escape key. + Shut down. To sing a number of bottles of beer on the wall: -Put the number into a counter. -Loop. -Write the first line given the counter. -Write the second line given the counter. -Write "Take one down, pass it around" to the console. -Subtract 1 from the counter. -Write the first line given the counter. -If the counter is 0, break. -Write "" on the console. -Repeat. + Put the number into a counter. + Loop. + Write the first line given the counter. + Write the second line given the counter. + Write "Take one down, pass it around" to the console. + Subtract 1 from the counter. + Write the first line given the counter. + If the counter is 0, break. + Write "" on the console. + Repeat. To write the first line given a counter: -If the counter is 0, write "No more bottles of beer on the wall" to the console; exit. -If the counter is 1, write "1 bottle of beer on the wall" to the console; exit. -Write the counter then " bottles of beer on the wall" to the console. + If the counter is 0, + Write "No more bottles of beer on the wall" to the console; + Exit. + If the counter is 1, + Write "1 bottle of beer on the wall" to the console; + Exit. + Write the counter then " bottles of beer on the wall" to the console. To write the second line given a counter: -If the counter is 1, write "1 bottle of beer" to the console; exit. -Write the counter then " bottles of beer" to the console. + If the counter is 1, + Write "1 bottle of beer" to the console; + Exit. + Write the counter then " bottles of beer" to the console. diff --git a/Task/99-bottles-of-beer/Pluto/99-bottles-of-beer.pluto b/Task/99-bottles-of-beer/Pluto/99-bottles-of-beer.pluto new file mode 100644 index 0000000000..1e20d4e1f4 --- /dev/null +++ b/Task/99-bottles-of-beer/Pluto/99-bottles-of-beer.pluto @@ -0,0 +1,12 @@ +function pl(n) return n==1?"":"s" end + +function fmt(s) + return $"{s} bottle{pl(s)} of beer on the wall, \n" .. + $"{s} bottle{pl(s)} of beer. \n" .. + $"Take one down, pass it around, \n" .. + $"{s-1} bottle{pl(s-1)} of beer on the wall.\n\n" +end + +for i = 99, 1, -1 do + print(fmt(i)) +end diff --git a/Task/99-bottles-of-beer/REBOL/99-bottles-of-beer-1.rebol b/Task/99-bottles-of-beer/Rebol/99-bottles-of-beer-1.rebol similarity index 100% rename from Task/99-bottles-of-beer/REBOL/99-bottles-of-beer-1.rebol rename to Task/99-bottles-of-beer/Rebol/99-bottles-of-beer-1.rebol diff --git a/Task/99-bottles-of-beer/REBOL/99-bottles-of-beer-2.rebol b/Task/99-bottles-of-beer/Rebol/99-bottles-of-beer-2.rebol similarity index 100% rename from Task/99-bottles-of-beer/REBOL/99-bottles-of-beer-2.rebol rename to Task/99-bottles-of-beer/Rebol/99-bottles-of-beer-2.rebol diff --git a/Task/99-bottles-of-beer/REBOL/99-bottles-of-beer-3.rebol b/Task/99-bottles-of-beer/Rebol/99-bottles-of-beer-3.rebol similarity index 100% rename from Task/99-bottles-of-beer/REBOL/99-bottles-of-beer-3.rebol rename to Task/99-bottles-of-beer/Rebol/99-bottles-of-beer-3.rebol diff --git a/Task/99-bottles-of-beer/Red/99-bottles-of-beer.red b/Task/99-bottles-of-beer/Red/99-bottles-of-beer-1.red similarity index 100% rename from Task/99-bottles-of-beer/Red/99-bottles-of-beer.red rename to Task/99-bottles-of-beer/Red/99-bottles-of-beer-1.red diff --git a/Task/99-bottles-of-beer/Red/99-bottles-of-beer-2.red b/Task/99-bottles-of-beer/Red/99-bottles-of-beer-2.red new file mode 100644 index 0000000000..e01dbbd378 --- /dev/null +++ b/Task/99-bottles-of-beer/Red/99-bottles-of-beer-2.red @@ -0,0 +1,21 @@ +w: 99 +while [w][ + print [ + reform [ + w x: either 1 < w ["bottles"] ["bottle"] y: "of beer" z: "on the wall" "," + w x y + ] + ] + w: w - 1 + if w = 1 [remove at x length? x] + print [ + "take one down pass it around, " + either 0 < w [ + reform [w x y z] + ][ + w: false reform [ + "no more bottles " y rejoin [z "."] + ] + ] + ] +] diff --git a/Task/99-bottles-of-beer/Red/99-bottles-of-beer-3.red b/Task/99-bottles-of-beer/Red/99-bottles-of-beer-3.red new file mode 100644 index 0000000000..67973dc127 --- /dev/null +++ b/Task/99-bottles-of-beer/Red/99-bottles-of-beer-3.red @@ -0,0 +1,21 @@ +cold-one?: function [ + count [integer!] +][ + case [ + count < 1 [return print "drunk, eh?"] + count = 1 [print "1 bottle of beer and it's mine." ] + 'otherwise [ + print [count x: "bottles of beer" y: "on the wall" "," + count x + ] + print [ + "take one down pass it around, " + z: (-1 + count) + either z = 1 [replace x "s" ""][x] + y + ] + ] + ] + cold-one? -1 + count + +] diff --git a/Task/99-bottles-of-beer/Refal/99-bottles-of-beer.refal b/Task/99-bottles-of-beer/Refal/99-bottles-of-beer.refal new file mode 100644 index 0000000000..2d53758e21 --- /dev/null +++ b/Task/99-bottles-of-beer/Refal/99-bottles-of-beer.refal @@ -0,0 +1,29 @@ +$ENTRY Go { + = >; +}; + +Verses { + '-'1 = ; + s.1 = + >; +}; + +Verse { + s.1 = ' of beer on the wall,\n' + ' of beer,\n' + '\n' + > ' of beer on the wall!\n\n'; +}; + +Bottles { + '-'1 = '99 bottles'; + 0 = 'No more bottles'; + 1 = '1 bottle'; + s.1 = s.1 'bottles'; +}; + +ThirdLine { + 0 = 'Go to the store and buy some more,'; + 1 = 'Take it down and pass it around,'; + s.1 = 'Take one down and pass it around,'; +}; diff --git a/Task/99-bottles-of-beer/Rhombus/99-bottles-of-beer.rhombus b/Task/99-bottles-of-beer/Rhombus/99-bottles-of-beer.rhombus new file mode 100644 index 0000000000..b7564c4ae9 --- /dev/null +++ b/Task/99-bottles-of-beer/Rhombus/99-bottles-of-beer.rhombus @@ -0,0 +1,13 @@ +#lang rhombus/static + +for (i in 1..100): + fun plural(n :: Int): + if n == 1: + | "" + | "s" + let bottles = 100 - i + println(@str{@(bottles) bottle@(plural(bottles)) of beer on the wall, @(bottles) bottle@(plural(bottles)) of beer.}) + println(@str{Take one down and pass it around, @(bottles - 1) bottle@(plural(bottles - 1)) of beer on the wall.}) + +println("No more bottles of beer on the wall, no more bottles of beer.") +println("Go to the store and buy some more, 99 bottles of beer on the wall.") diff --git a/Task/99-bottles-of-beer/Rust/99-bottles-of-beer-1.rust b/Task/99-bottles-of-beer/Rust/99-bottles-of-beer-1.rs similarity index 100% rename from Task/99-bottles-of-beer/Rust/99-bottles-of-beer-1.rust rename to Task/99-bottles-of-beer/Rust/99-bottles-of-beer-1.rs diff --git a/Task/99-bottles-of-beer/Rust/99-bottles-of-beer-2.rust b/Task/99-bottles-of-beer/Rust/99-bottles-of-beer-2.rs similarity index 100% rename from Task/99-bottles-of-beer/Rust/99-bottles-of-beer-2.rust rename to Task/99-bottles-of-beer/Rust/99-bottles-of-beer-2.rs diff --git a/Task/99-bottles-of-beer/Rye/99-bottles-of-beer.rye b/Task/99-bottles-of-beer/Rye/99-bottles-of-beer.rye new file mode 100644 index 0000000000..0bfe1a8f2d --- /dev/null +++ b/Task/99-bottles-of-beer/Rye/99-bottles-of-beer.rye @@ -0,0 +1,16 @@ +private { + + bottles: fn1 { = 1 |either { "bottle" } { "bottles" } } + verse1: closure { n } { .embed join [ "{} " bottles n " of beer on the wall" ] } + verse2: closure { n } { .embed join [ "{} " bottles n " of beer" ] } + verse3: does { "Take one down and pass it around, " } + + closure { n } { + prn join [ verse1 n ", " verse2 n "." newline verse3 ] + ( n - 1 :m > 0 ) |either + { verse1 m |++ "." |print , beers m } + { print "no more bottles of beer on the wall." } + } +} :beers + +99 |beers diff --git a/Task/99-bottles-of-beer/Scheme/99-bottles-of-beer.ss b/Task/99-bottles-of-beer/Scheme/99-bottles-of-beer.scm similarity index 100% rename from Task/99-bottles-of-beer/Scheme/99-bottles-of-beer.ss rename to Task/99-bottles-of-beer/Scheme/99-bottles-of-beer.scm diff --git a/Task/99-bottles-of-beer/SheerPower-4GL/99-bottles-of-beer.4gl b/Task/99-bottles-of-beer/SheerPower-4GL/99-bottles-of-beer.4gl new file mode 100644 index 0000000000..4f2fa34121 --- /dev/null +++ b/Task/99-bottles-of-beer/SheerPower-4GL/99-bottles-of-beer.4gl @@ -0,0 +1,28 @@ +declare integer n% + +for n% = 99 to 1 step -1 + print bottles$(n%); ' of beer on the wall, '; bottles$(n%); ' of beer.' + print 'Take one down and pass it around, '; bottles$(n% - 1); ' of beer on the wall.' + print +next n% + +print 'No more bottles of beer on the wall, no more bottles of beer.' +print 'Go to the store and buy some more, 99 bottles of beer on the wall.' + +! ============================================================================= +! Routine: bottles$(n%) +! +! Return the correct phrase for n% bottles: +! 0 → "no more bottles" +! 1 → "1 bottle" +! 2 or more → " bottles" +! ============================================================================= +routine bottles$(n%) + if n% = 0 then + bottles$ = 'no more bottles' + elseif n% = 1 then + bottles$ = '1 bottle' + else + bottles$ = str$(n%) + ' bottles' + end if +end routine diff --git a/Task/99-bottles-of-beer/Tailspin/99-bottles-of-beer.tailspin b/Task/99-bottles-of-beer/Tailspin/99-bottles-of-beer-1.tailspin similarity index 100% rename from Task/99-bottles-of-beer/Tailspin/99-bottles-of-beer.tailspin rename to Task/99-bottles-of-beer/Tailspin/99-bottles-of-beer-1.tailspin diff --git a/Task/99-bottles-of-beer/Tailspin/99-bottles-of-beer-2.tailspin b/Task/99-bottles-of-beer/Tailspin/99-bottles-of-beer-2.tailspin new file mode 100644 index 0000000000..2925e02e15 --- /dev/null +++ b/Task/99-bottles-of-beer/Tailspin/99-bottles-of-beer-2.tailspin @@ -0,0 +1,16 @@ +sayBottleCount templates + when <|=1> do + '1 bottle' ! + when <|=0> do + 'No bottles' ! + otherwise + '$; bottles' ! +end sayBottleCount + +'$:99..1:-1 -> +'$->sayBottleCount; of beer on the wall, +$->sayBottleCount; of beer. +Take one down, pass it around, +$ - 1 -> sayBottleCount; of beer on the wall. + +';' ! diff --git a/Task/99-bottles-of-beer/Uiua/99-bottles-of-beer.uiua b/Task/99-bottles-of-beer/Uiua/99-bottles-of-beer.uiua new file mode 100644 index 0000000000..3909ab4598 --- /dev/null +++ b/Task/99-bottles-of-beer/Uiua/99-bottles-of-beer.uiua @@ -0,0 +1,9 @@ +b ← ( + &p $$ _ bottles of beer on the wall + $$ _ bottles of beer + $$ Take one down, pass it around + $$ _ bottles of beer on the wall + $$ +) + +⍚(b.+1.-1) ⇌↘1⇡100 diff --git a/Task/99-bottles-of-beer/Uxntal/99-bottles-of-beer.uxnatl b/Task/99-bottles-of-beer/Uxntal/99-bottles-of-beer.uxnatl new file mode 100644 index 0000000000..868c8dd512 --- /dev/null +++ b/Task/99-bottles-of-beer/Uxntal/99-bottles-of-beer.uxnatl @@ -0,0 +1,73 @@ +%\n { 0a } %\s { 20 } %\0 { 00 } +%newline { [ LIT2 \n -Console/write ] DEO } +%plural { [ LIT2 "s -Console/write ] DEO } + +|18 @Console/write + +|100 + +#63 +&loop + DUP print/verse + newline + #01 EQUk ?/done + POP #01 SUB + !/done + + &done + POP2 + +BRK + +@print/verse ( num -- ) + DUP /bottle ;msgs/wall /str + DUP /bottle newline + ;msgs/take /str + #01 SUB /bottle ;msgs/wall !/str + +@print/bottle ( num -- ) + DUP #00 EQU ?/bottle/zero + DUP #01 EQU ?/bottle/one + /dec ;msgs/bottle /str + plural + !/bottle/end + + &bottle/one ( num -- ) + /dec ;msgs/bottle /str + !/bottle/end + + &bottle/zero ( num -- ) + POP ;msgs/no-more /str + ;msgs/bottle /str + plural + ( >> ) + + &bottle/end + ;msgs/of-beer + ( >> ) + +@print/str ( str -- ) + LDAk .Console/write DEO + INC2 LDAk ?/str + POP2 JMP2r + +@print/dec ( byte -- ) + DUP #64 DIV /dec/try + DUP #0a DIV /dec/try + ( >> ) + + &dec/try/num ( num -- ) + #0a DIVk MUL SUB + [ LIT "0 ] ADD .Console/write DEO + JMP2r + + &dec/try ( num -- ) + DUP ?/dec/try/num + POP JMP2r + +@msgs [ + &no-more "No \s "more \0 + &bottle \s "bottle \0 + &of-beer \s "of \s "beer \s \0 + &wall "on \s "the \s "wall \n \0 + &take "Take \s "one \s "down, \s "pass \s "it \s "around \n \0 ] diff --git a/Task/99-bottles-of-beer/V-(Vlang)/99-bottles-of-beer.v b/Task/99-bottles-of-beer/V-(Vlang)/99-bottles-of-beer.v index 0490354be6..3e3d0cd41d 100644 --- a/Task/99-bottles-of-beer/V-(Vlang)/99-bottles-of-beer.v +++ b/Task/99-bottles-of-beer/V-(Vlang)/99-bottles-of-beer.v @@ -11,7 +11,6 @@ fn verse(beers int) { mut beer := beers - 1 mut numno := beers.str() mut elipsis := "" - if beers == 0 { numno = "No" } println("$numno bottle${plural(beers)} of beer on the wall") println("$numno bottle${plural(beers)} of beer") @@ -20,12 +19,10 @@ fn verse(beers int) { println("To the store, to buy some more") numno = "99" elipsis = "..." - } else { - println("Take one down, pass it around") } + else { println("Take one down, pass it around") } println("$numno bottle${plural(beer)} of beer on the wall${elipsis}") } - // passing time pub fn main() { for beers := 99; beers >= 0; beers-- { diff --git a/Task/99-bottles-of-beer/V/99-bottles-of-beer.v b/Task/99-bottles-of-beer/V/99-bottles-of-beer.v new file mode 100644 index 0000000000..67c9827af0 --- /dev/null +++ b/Task/99-bottles-of-beer/V/99-bottles-of-beer.v @@ -0,0 +1,12 @@ +[bottles + [newline '' puts]. + [beer + [0 =] ['No more bottles of beer' put] if + [1 =] ['One bottle of beer' put] if + [1 >] [dup put ' bottles of beer' put] if]. + [0 =] [newline] + [beer ' on the wall, ' put beer newline + 'Take one down and pass it around, ' put pred beer ' on the wall' puts newline] + tailrec]. + +99 bottles diff --git a/Task/99-bottles-of-beer/Wren/99-bottles-of-beer.wren b/Task/99-bottles-of-beer/Wren/99-bottles-of-beer.wren index 1dcb048e01..4d64db415a 100644 --- a/Task/99-bottles-of-beer/Wren/99-bottles-of-beer.wren +++ b/Task/99-bottles-of-beer/Wren/99-bottles-of-beer.wren @@ -1,6 +1,6 @@ for (i in 99...0) { - System.print("%(i) bottles of beer on the wall,") - System.print("%(i) bottles of beer,") - System.print("Take one down, pass it around,") - System.print("%(i - 1) bottles of beer on the wall.\n") + System.print("%(i) bottles of beer on the wall,") + System.print("%(i) bottles of beer,") + System.print("Take one down, pass it around,") + System.print("%(i - 1) bottles of beer on the wall.\n") } diff --git a/Task/99-bottles-of-beer/YAMLScript/99-bottles-of-beer-1.ys b/Task/99-bottles-of-beer/YAMLScript/99-bottles-of-beer-1.ys new file mode 100644 index 0000000000..30910edf41 --- /dev/null +++ b/Task/99-bottles-of-beer/YAMLScript/99-bottles-of-beer-1.ys @@ -0,0 +1,15 @@ +!ys-0 + +defn main(number=99): + each num (number .. 1): + say: | + $bottles(num) of beer on the wall, + $bottles(num) of beer. + Take one down, pass it around. + $bottles(num.--) of beer on the wall. + +defn bottles(n): + condp eq n: + 0 :: No more bottles + 1 :: 1 bottle + else : "$n bottles" diff --git a/Task/99-bottles-of-beer/YAMLScript/99-bottles-of-beer-2.ys b/Task/99-bottles-of-beer/YAMLScript/99-bottles-of-beer-2.ys new file mode 100644 index 0000000000..d830a6c4a7 --- /dev/null +++ b/Task/99-bottles-of-beer/YAMLScript/99-bottles-of-beer-2.ys @@ -0,0 +1,9 @@ +!yamlscript/v0 + +defn main(number=99): + each num (number .. 1): + say: | + $num bottles of beer on the wall, + $num bottles of beer. + Take one down, pass it around. + $(num.--) bottles of beer on the wall. diff --git a/Task/99-bottles-of-beer/YAMLScript/99-bottles-of-beer.ys b/Task/99-bottles-of-beer/YAMLScript/99-bottles-of-beer.ys deleted file mode 100644 index 5870d3643b..0000000000 --- a/Task/99-bottles-of-beer/YAMLScript/99-bottles-of-beer.ys +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env yamlscript - -# Print the verses to "99 Bottles of Beer" -# -# usage: -# yamlscript 99-bottles.ys [] - -defn main(number=99): - map(say): - map(paragraph): - (number .. 1) - -defn paragraph(num): | - $(bottles num) of beer on the wall, - $(bottles num) of beer. - Take one down, pass it around. - $(bottles (num - 1)) of beer on the wall. - -defn bottles(n): - ???: - (n == 0) : "No more bottles" - (n == 1) : "1 bottle" - :else : "$n bottles" diff --git a/Task/A+B/11l/a+b.11l b/Task/A+B/11l/a+b.11l index 2eea3c99c2..fada22ecf1 100644 --- a/Task/A+B/11l/a+b.11l +++ b/Task/A+B/11l/a+b.11l @@ -1 +1 @@ -print(sum(input().split(‘ ’, group_delimiters' 1B).map(i -> Int(i)))) +print(sum(input().split(‘ ’, group_delimiters' 1B).map(Int))) diff --git a/Task/A+B/Ada/a+b-1.ada b/Task/A+B/Ada/a+b-1.adb similarity index 100% rename from Task/A+B/Ada/a+b-1.ada rename to Task/A+B/Ada/a+b-1.adb diff --git a/Task/A+B/Ada/a+b-2.ada b/Task/A+B/Ada/a+b-2.adb similarity index 100% rename from Task/A+B/Ada/a+b-2.ada rename to Task/A+B/Ada/a+b-2.adb diff --git a/Task/A+B/Agena/a+b.agena b/Task/A+B/Agena/a+b.agena index 5b94875c68..0ac7496582 100644 --- a/Task/A+B/Agena/a+b.agena +++ b/Task/A+B/Agena/a+b.agena @@ -1,6 +1,10 @@ scope local f := trim( io.read() ) split " "; # read a line and split into fields - local a := tonumber( f[ 1 ] ); - local b := tonumber( f[ 2 ] ); - print( a + b ) -epocs + try + local a := tonumber( f[ 1 ] ); + local b := tonumber( f[ 2 ] ); + print( a + b ) + catch in ex then + print( "Unable to add the numbers: ", tostring( ex ) ) + yrt +end diff --git a/Task/A+B/ArkScript/a+b.ark b/Task/A+B/ArkScript/a+b.ark new file mode 100644 index 0000000000..71c47670c9 --- /dev/null +++ b/Task/A+B/ArkScript/a+b.ark @@ -0,0 +1,9 @@ +(import std.String :split) +(import std.List :map :reduce) + +(let in (input)) +(let numbers (map (split in " ") (fun (t) (toNumber t)))) +(print (reduce numbers (fun (a b) + (if (nil? b) + a + (+ a b))))) diff --git a/Task/A+B/AutoIt/a+b-1.autoit b/Task/A+B/AutoIt/a+b-1.au3 similarity index 100% rename from Task/A+B/AutoIt/a+b-1.autoit rename to Task/A+B/AutoIt/a+b-1.au3 diff --git a/Task/A+B/AutoIt/a+b-2.autoit b/Task/A+B/AutoIt/a+b-2.au3 similarity index 100% rename from Task/A+B/AutoIt/a+b-2.autoit rename to Task/A+B/AutoIt/a+b-2.au3 diff --git a/Task/A+B/BabyCobol/a+b.cobol b/Task/A+B/BabyCobol/a+b.cobol new file mode 100644 index 0000000000..aa35ab1873 --- /dev/null +++ b/Task/A+B/BabyCobol/a+b.cobol @@ -0,0 +1,11 @@ + * NB: COBOL's ACCEPT does not work with multiple identifiers + IDENTIFICATION DIVISION. + PROGRAM-ID. PLUS. + DATA DIVISION. + 01 A PICTURE IS S9999. + 01 B LIKE A. + PROCEDURE DIVISION. + DISPLAY "Enter two numbers: " WITH NO ADVANCING. + ACCEPT A B. + ADD A TO B. + DISPLAY "A+B =" B. diff --git a/Task/A+B/Ballerina/a+b.ballerina b/Task/A+B/Ballerina/a+b.ballerina new file mode 100644 index 0000000000..7c90b9d2f5 --- /dev/null +++ b/Task/A+B/Ballerina/a+b.ballerina @@ -0,0 +1,16 @@ +import ballerina/io; + +public function main() returns error? { + while true { + io:print("Enter two integers separated by a space : "); + string[] s = re ` `.split(io:readln()); + if s.length() < 2 { + io:println("Insufficient numbers, try again"); + } else { + int a = check int:fromString(s[0]); + int b = check int:fromString(s[1]); + io:println("Their sum is ", a + b, "."); + break; + } + } +} diff --git a/Task/A+B/Batch-File/a+b-3.bat b/Task/A+B/Batch-File/a+b-3.bat index f89aab8525..46420dac6d 100644 --- a/Task/A+B/Batch-File/a+b-3.bat +++ b/Task/A+B/Batch-File/a+b-3.bat @@ -1,6 +1 @@ -::aplusb.cmd -@echo off -setlocal -set /a c=%~1 -echo %c% -endlocal +doskey add=setlocal^& set a=$1^& set b=$2^& set /a res=a+b^& endlocal diff --git a/Task/A+B/Batch-File/a+b-5.bat b/Task/A+B/Batch-File/a+b-5.bat new file mode 100644 index 0000000000..3f5d39e1f4 --- /dev/null +++ b/Task/A+B/Batch-File/a+b-5.bat @@ -0,0 +1,12 @@ +@echo off +setlocal enableextensions +set /p ab= +call :setab %ab% +set /a res=a+b +echo %res% +goto:eof + +:setab +set a=%1 +set b=%2 +goto:eof diff --git a/Task/A+B/Batch-File/a+b-6.bat b/Task/A+B/Batch-File/a+b-6.bat new file mode 100644 index 0000000000..0f331e1554 --- /dev/null +++ b/Task/A+B/Batch-File/a+b-6.bat @@ -0,0 +1,6 @@ +@echo off +setlocal enableextensions +set /p ab= +set res=0 +for %%i in (%ab%) do set /a res+=%%i +echo %res% diff --git a/Task/A+B/Binary-Lambda-Calculus/a+b.blc b/Task/A+B/Binary-Lambda-Calculus/a+b.blc new file mode 100644 index 0000000000..4b57e7a05a --- /dev/null +++ b/Task/A+B/Binary-Lambda-Calculus/a+b.blc @@ -0,0 +1,2 @@ +(lambda (augend addend f x) + (augend f (addend f x))) diff --git a/Task/A+B/Bruijn/a+b.bruijn b/Task/A+B/Bruijn/a+b.bruijn new file mode 100644 index 0000000000..e6be6608b7 --- /dev/null +++ b/Task/A+B/Bruijn/a+b.bruijn @@ -0,0 +1,6 @@ +:import std/Combinator . +:import std/String . +:import std/Number . +:import std/Char C + +main (split-by (C.eq? ' ')) → &(add ⋔ string→number) diff --git a/Task/A+B/COBOL/a+b-1.cobol b/Task/A+B/COBOL/a+b-1.cob similarity index 100% rename from Task/A+B/COBOL/a+b-1.cobol rename to Task/A+B/COBOL/a+b-1.cob diff --git a/Task/A+B/COBOL/a+b-2.cobol b/Task/A+B/COBOL/a+b-2.cob similarity index 100% rename from Task/A+B/COBOL/a+b-2.cobol rename to Task/A+B/COBOL/a+b-2.cob diff --git a/Task/A+B/Crystal/a+b-1.crystal b/Task/A+B/Crystal/a+b-1.cr similarity index 100% rename from Task/A+B/Crystal/a+b-1.crystal rename to Task/A+B/Crystal/a+b-1.cr diff --git a/Task/A+B/Crystal/a+b-2.crystal b/Task/A+B/Crystal/a+b-2.cr similarity index 100% rename from Task/A+B/Crystal/a+b-2.crystal rename to Task/A+B/Crystal/a+b-2.cr diff --git a/Task/A+B/Delphi/a+b.delphi b/Task/A+B/Delphi/a+b.pas similarity index 100% rename from Task/A+B/Delphi/a+b.delphi rename to Task/A+B/Delphi/a+b.pas diff --git a/Task/A+B/DuckDB/a+b-1.duckdb b/Task/A+B/DuckDB/a+b-1.duckdb new file mode 100644 index 0000000000..06fc2868f4 --- /dev/null +++ b/Task/A+B/DuckDB/a+b-1.duckdb @@ -0,0 +1,5 @@ +.headers off +.mode list +select sum(c::INTEGER) +from (select unnest(regexp_extract_all(content, '[-0-9]+') ) as c + from read_text('rc-a+b.txt') ); diff --git a/Task/A+B/DuckDB/a+b-2.duckdb b/Task/A+B/DuckDB/a+b-2.duckdb new file mode 100644 index 0000000000..ce4c1aa6c7 --- /dev/null +++ b/Task/A+B/DuckDB/a+b-2.duckdb @@ -0,0 +1,2 @@ +select a+b from (select column0 as a, column1 as b +from read_csv('/dev/stdin', header=false, sep=' ')); diff --git a/Task/A+B/EMal/a+b.emal b/Task/A+B/EMal/a+b.emal index c2e2652cab..22106f56f5 100644 --- a/Task/A+B/EMal/a+b.emal +++ b/Task/A+B/EMal/a+b.emal @@ -1,17 +1,15 @@ -fun main = int by List args - text input = when(args.length == 1, args[0], ask(text, "Enter n integers separated by a space: ")) +fun main ← int by List args + text input ← when(args.length æ 1, args[0], ask(text, "Enter n integers separated by a space: ")) int sum, count for each text word in input.split(" ") - word = word.trim() + word ← word.trim() if word.isEmpty() do continue end # ignore empty words - int nr = int!word # this can raise an exception - if abs(nr) > 1000 - Event.error(0, "Integers must be in the interval [-1000, 1000]").raise() - end + int nr ← int!word # this can raise an exception + if abs(nr) > 1000 do error(0, "Integers must be in the interval [-1000, 1000]") end sum += nr ++count end - if count < 2 do Event.error(1, "At least two integers must be provided").raise() end + if count < 2 do error(1, "At least two integers must be provided") end writeLine("The sum of " + count + " integers is: " + sum) return 0 end diff --git a/Task/A+B/EasyLang/a+b.easy b/Task/A+B/EasyLang/a+b.easy index bec95e696d..b110fbde15 100644 --- a/Task/A+B/EasyLang/a+b.easy +++ b/Task/A+B/EasyLang/a+b.easy @@ -1,8 +1,8 @@ a$ = input -i = 1 -while i < len a$ and substr a$ i 1 <> " " - i += 1 +repeat + i += 1 + until i > len a$ or substr a$ i 1 = " " . a = number substr a$ 1 i -b = number substr a$ i -1 +b = number substr a$ i 99 print a + b diff --git a/Task/A+B/Ed/a+b.ed b/Task/A+B/Ed/a+b.ed new file mode 100644 index 0000000000..fdc4ec064b --- /dev/null +++ b/Task/A+B/Ed/a+b.ed @@ -0,0 +1,101 @@ +H +g/[^0-9]{1,}/s///g +,p +# decimal -> unary +g/^0+([0-9])/s//\1/ +g/^9([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiiii/ +g/^8([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiii/ +g/^7([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiii/ +g/^6([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiii/ +g/^5([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiii/ +g/^4([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiii/ +g/^3([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iii/ +g/^2([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2ii/ +g/^1([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2i/ +g/^0([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2/ +g/^9([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiiii/ +g/^8([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiii/ +g/^7([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiii/ +g/^6([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiii/ +g/^5([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiii/ +g/^4([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiii/ +g/^3([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iii/ +g/^2([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2ii/ +g/^1([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2i/ +g/^0([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2/ +g/^9([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiiii/ +g/^8([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiii/ +g/^7([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiii/ +g/^6([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiii/ +g/^5([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiii/ +g/^4([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiii/ +g/^3([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iii/ +g/^2([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2ii/ +g/^1([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2i/ +g/^0([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2/ +g/^9([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiiii/ +g/^8([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiii/ +g/^7([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiii/ +g/^6([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiii/ +g/^5([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiii/ +g/^4([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiii/ +g/^3([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iii/ +g/^2([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2ii/ +g/^1([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2i/ +g/^0([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2/ +g/^9([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiiii/ +g/^8([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiii/ +g/^7([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiii/ +g/^6([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiii/ +g/^5([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiiii/ +g/^4([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iiii/ +g/^3([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2iii/ +g/^2([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2ii/ +g/^1([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2i/ +g/^0([0-9]*)(i*)/s//\1\2\2\2\2\2\2\2\2\2\2/ +# actual logic +,j +# unary -> decimal (for 0-10000 range) +g/i{9000}(i{0,999})/s//9\1/ +g/i{8000}(i{0,999})/s//8\1/ +g/i{7000}(i{0,999})/s//7\1/ +g/i{6000}(i{0,999})/s//6\1/ +g/i{5000}(i{0,999})/s//5\1/ +g/i{4000}(i{0,999})/s//4\1/ +g/i{3000}(i{0,999})/s//3\1/ +g/i{2000}(i{0,999})/s//2\1/ +g/i{1000}(i{0,999})/s//1\1/ +v/^[0-9]i*$/s/.*/0&/ +g/i{900}(i{0,99})/s//9\1/ +g/i{800}(i{0,99})/s//8\1/ +g/i{700}(i{0,99})/s//7\1/ +g/i{600}(i{0,99})/s//6\1/ +g/i{500}(i{0,99})/s//5\1/ +g/i{400}(i{0,99})/s//4\1/ +g/i{300}(i{0,99})/s//3\1/ +g/i{200}(i{0,99})/s//2\1/ +g/i{100}(i{0,99})/s//1\1/ +v/^[0-9]{2}i*$/s/^([0-9])(i*)$/\10\2/ +g/i{90}(i{0,9})/s//9\1/ +g/i{80}(i{0,9})/s//8\1/ +g/i{70}(i{0,9})/s//7\1/ +g/i{60}(i{0,9})/s//6\1/ +g/i{50}(i{0,9})/s//5\1/ +g/i{40}(i{0,9})/s//4\1/ +g/i{30}(i{0,9})/s//3\1/ +g/i{20}(i{0,9})/s//2\1/ +g/i{10}(i{0,9})/s//1\1/ +v/^[0-9]{3}i*$/s/^([0-9]{2})(i*)$/\10\2/ +g/i{9}/s//9/ +g/i{8}/s//8/ +g/i{7}/s//7/ +g/i{6}/s//6/ +g/i{5}/s//5/ +g/i{4}/s//4/ +g/i{3}/s//3/ +g/i{2}/s//2/ +g/i{1}/s//1/ +v/^[0-9]{4}i*$/s/^([0-9]{3})(i*)$/\10\2/ +g/^0+([0-9])/s//\1/ +,p +Q diff --git a/Task/A+B/Elena/a+b-1.elena b/Task/A+B/Elena/a+b-1.elena index a4c98a1213..d585433b10 100644 --- a/Task/A+B/Elena/a+b-1.elena +++ b/Task/A+B/Elena/a+b-1.elena @@ -1,9 +1,9 @@ import extensions; -public program() +public Program() { - var A := Integer.new(); - var B := Integer.new(); + var A := Integer.new(); + var B := Integer.new(); - console.loadLine(A,B).printLine(A + B) + Console.loadLine(A,B).printLine(A + B) } diff --git a/Task/A+B/Elena/a+b-2.elena b/Task/A+B/Elena/a+b-2.elena index 8097b76574..a1042363c6 100644 --- a/Task/A+B/Elena/a+b-2.elena +++ b/Task/A+B/Elena/a+b-2.elena @@ -1,9 +1,9 @@ import system'routines; import extensions; -public program() +public Program() { - console.printLine(console.readLine() + Console.printLine(Console.readLine() .split() .selectBy(mssgconst toInt[1]) .summarize()) diff --git a/Task/A+B/Elixir/a+b.elixir b/Task/A+B/Elixir/a+b.ex similarity index 100% rename from Task/A+B/Elixir/a+b.elixir rename to Task/A+B/Elixir/a+b.ex diff --git a/Task/A+B/Emacs-Lisp/a+b.l b/Task/A+B/Emacs-Lisp/a+b.el similarity index 100% rename from Task/A+B/Emacs-Lisp/a+b.l rename to Task/A+B/Emacs-Lisp/a+b.el diff --git a/Task/A+B/Euphoria/a+b.euphoria b/Task/A+B/Euphoria/a+b.eu similarity index 100% rename from Task/A+B/Euphoria/a+b.euphoria rename to Task/A+B/Euphoria/a+b.eu diff --git a/Task/A+B/Fennel/a+b.fennel b/Task/A+B/Fennel/a+b.fennel new file mode 100644 index 0000000000..a53df95bf9 --- /dev/null +++ b/Task/A+B/Fennel/a+b.fennel @@ -0,0 +1,2 @@ +(let [(a b) (io.read :*number :*number)] + (print (+ a b))) diff --git a/Task/A+B/Forth/a+b.fth b/Task/A+B/Forth/a+b-1.fth similarity index 100% rename from Task/A+B/Forth/a+b.fth rename to Task/A+B/Forth/a+b-1.fth diff --git a/Task/A+B/Forth/a+b-2.fth b/Task/A+B/Forth/a+b-2.fth new file mode 100644 index 0000000000..f83c5b0b46 --- /dev/null +++ b/Task/A+B/Forth/a+b-2.fth @@ -0,0 +1 @@ +: addab + cr . cr ; diff --git a/Task/A+B/FutureBasic/a+b.basic b/Task/A+B/FutureBasic/a+b-1.basic similarity index 100% rename from Task/A+B/FutureBasic/a+b.basic rename to Task/A+B/FutureBasic/a+b-1.basic diff --git a/Task/A+B/FutureBasic/a+b-2.basic b/Task/A+B/FutureBasic/a+b-2.basic new file mode 100644 index 0000000000..aee4ef9505 --- /dev/null +++ b/Task/A+B/FutureBasic/a+b-2.basic @@ -0,0 +1,15 @@ +void local fn InputIntegers + while ( 1 ) + CFStringRef s = input @"", @"0123456789 ", YES + if ( !s ) then end + CFArrayRef a = fn StringComponentsSeparatedByString( s, @" " ) + if ( len(a) != 2 ) then beep : continue + cls : print %(150,95),a[0];@" + ";a[1];@" = ";intval(a[0]) + intval(a[1]) + wend +end fn + +window 1, @"A+B", (0,0,290,200) +textlabel 1, @"Enter two integers separated by space(s).\nPress 'return' to calculate or 'esc' to quit.", (20,160,270,32) +fn InputIntegers + +HandleEvents diff --git a/Task/A+B/Guile/a+b.guile b/Task/A+B/Guile/a+b.guile new file mode 100644 index 0000000000..d3ef4f223d --- /dev/null +++ b/Task/A+B/Guile/a+b.guile @@ -0,0 +1,3 @@ +;;;Actually, the solution is same as that of many other Lisp dialects here +(+ (read) (read)) +;;Yes, it is neat but not strong, error prone actually. Other than this walkaround, if you dislike fetching a line in string format then parse the chars one by one by hand or byte by byte from stdin, you can use one read and do the work, with the price of typing (1 2) instead of 1 2 at the prompt since read would treat the input as a symbolic expression. So.,.there is sadly no easy way like scanf and %d %d in c unless one is willing to type ()s! diff --git a/Task/A+B/HPPPL/a+b.hpppl b/Task/A+B/HPPPL/a+b.hpppl new file mode 100644 index 0000000000..068fec62c3 --- /dev/null +++ b/Task/A+B/HPPPL/a+b.hpppl @@ -0,0 +1,6 @@ +EXPORT A_plus_B() +BEGIN +LOCAL A, B; +INPUT({A, B}); +PRINT(A + " " + B + " " + (A + B)); +END; diff --git a/Task/A+B/Julia/a+b-1.julia b/Task/A+B/Julia/a+b-1.jl similarity index 100% rename from Task/A+B/Julia/a+b-1.julia rename to Task/A+B/Julia/a+b-1.jl diff --git a/Task/A+B/Julia/a+b-2.julia b/Task/A+B/Julia/a+b-2.jl similarity index 100% rename from Task/A+B/Julia/a+b-2.julia rename to Task/A+B/Julia/a+b-2.jl diff --git a/Task/A+B/Koka/a+b.koka b/Task/A+B/Koka/a+b.koka new file mode 100644 index 0000000000..f0f1738e2d --- /dev/null +++ b/Task/A+B/Koka/a+b.koka @@ -0,0 +1,32 @@ +import std/os/readline + +// A prompt effect which retries getting input until a valid result is returned. +effect prompt + ctl delimit(): () // Captures the retry resumption + final ctl fail(): e // A failed input + +// Prompt for input, with retry until successful result +// - `message` is the original prompt +// - `err-message` is the error shown on failure +fun prompt(message: string, err-message: string, action: (string) -> a): a + var reattempt := fn() impossible() // We ensure all paths include a delimiter + with handler + raw ctl delimit() + reattempt := (fn() rcontext.resume(())) // set reattempt resumption + reattempt() // Initial try + final ctl fail() + reattempt() // Handle failure by reattempting + // Print the initial request message + println(message) + delimit() // Mark retry point + try { + action(readline()) // Read the input and apply the action + } fn(err) + // On an exception, print the error message and retry + println(err-message) + fail() // reset + +fun main() + with line <- prompt("Enter two numbers separated by space: ", "Invalid input, please enter two integers.") + val [a, b] = line.split(" ") + a.parse-int.unjust + b.parse-int.unjust diff --git a/Task/A+B/Kotlin/a+b.kotlin b/Task/A+B/Kotlin/a+b.kts similarity index 100% rename from Task/A+B/Kotlin/a+b.kotlin rename to Task/A+B/Kotlin/a+b.kts diff --git a/Task/A+B/LOLCODE/a+b.lol b/Task/A+B/LOLCODE/a+b.lol new file mode 100644 index 0000000000..711b24849b --- /dev/null +++ b/Task/A+B/LOLCODE/a+b.lol @@ -0,0 +1,9 @@ +HAI 1.2 + I HAS A VAR1 ITZ A YARN BTW DECLARE A VARIABLE FOR LATER USE + I HAS A VAR2 ITZ A YARN BTW DECLARE A VARIABLE FOR LATER USE + VISIBLE "NUMBAH 1?" + GIMMEH VAR1 BTW GET INPUT (NUMBER) INTO VARIABLE + VISIBLE "NUMBAH 2?" + GIMMEH VAR2 BTW GET INPUT (NUMBER) INTO VARIABLE + VISIBLE SUM OF VAR1 AN VAR2 +KTHXBYE diff --git a/Task/A+B/Microsoft-Small-Basic/a+b.basic b/Task/A+B/Microsoft-Small-Basic/a+b.basic new file mode 100644 index 0000000000..d35e63fe64 --- /dev/null +++ b/Task/A+B/Microsoft-Small-Basic/a+b.basic @@ -0,0 +1,14 @@ +getIntegers: +integers = TextWindow.Read() +spacePosition = Text.GetIndexOf(integers, " ") +If spacePosition = 0 Then + TextWindow.WriteLine("Please enter two integers.") + Goto getIntegers +EndIf +A = Text.GetSubText(integers, 1, spacePosition - 1) +B = Text.GetSubTextToEnd(integers, spacePosition + 1) +If A < -1000 Or A > 1000 Or B < -1000 Or B > 1000 Then + TextWindow.WriteLine("Integers are outside the range -1000 to 1000. Try again.") + Goto getIntegers +EndIf +TextWindow.WriteLine(A + B) diff --git a/Task/A+B/Nu/a+b.nu b/Task/A+B/Nu/a+b.nu new file mode 100644 index 0000000000..1cb2baca8a --- /dev/null +++ b/Task/A+B/Nu/a+b.nu @@ -0,0 +1 @@ +input | split words | into int | math sum diff --git a/Task/A+B/Nutt/a+b.nutt b/Task/A+B/Nutt/a+b.nutt index 50a609c5d5..5b0625667e 100644 --- a/Task/A+B/Nutt/a+b.nutt +++ b/Task/A+B/Nutt/a+b.nutt @@ -1,7 +1,8 @@ module main -imports native.io{input.hear,output.say} +import $native 'io' [input#hear output#sayn] -vals a=hear(Int),b=hear(Int) -say(a+b) - -end +funct main () : () = + val read_int = {(hear ())#to_int#fold {0} {it}}; + val a = read_int (); + val b = read_int (); + sayn (a# + b) diff --git a/Task/A+B/OCaml/a+b.ocaml b/Task/A+B/OCaml/a+b.ml similarity index 100% rename from Task/A+B/OCaml/a+b.ocaml rename to Task/A+B/OCaml/a+b.ml diff --git a/Task/A+B/PascalABC.NET/a+b.pas b/Task/A+B/PascalABC.NET/a+b.pas new file mode 100644 index 0000000000..ac390aa674 --- /dev/null +++ b/Task/A+B/PascalABC.NET/a+b.pas @@ -0,0 +1,3 @@ +## +var (a,b) := ReadInteger2; +Writeln(a + b); diff --git a/Task/A+B/Plain-English/a+b.plain b/Task/A+B/Plain-English/a+b.plain index 92c92ca2e1..4187b423eb 100644 --- a/Task/A+B/Plain-English/a+b.plain +++ b/Task/A+B/Plain-English/a+b.plain @@ -1,17 +1,42 @@ To run: -Start up. -Read a number from the console. -Read another number from the console. -Output the sum of the number and the other number. -Wait for the escape key. -Shut down. + Start up. + Set up the console. + Write "Type the first number: " to Stdout. + Read a buffer from stdin. + Trim the buffer. + If the buffer is not any integer, + Write "Invalid input. Aborting Operation." + then the CRLF string to StdOut; + Shut down; + Exit. + Write "Type the second number: " to Stdout. + Read a second buffer from stdin. + Trim the second buffer. + If the second buffer is not any integer, + Write "Invalid input. Aborting Operation." + then the CRLF string to StdOut; + Shut down; + Exit. + Convert the buffer to a number. + Convert the second buffer to a second number. + Output the sum of the number and the second number. + Shut down. To output the sum of a number and another number: -If the number is not valid, write "Invalid input" to the console; exit. -If the other number is not valid, write "Invalid input" to the console; exit. -Write the number plus the other number then " is the sum." to the console. + If the number is not valid, + Write "Invalid input. Aborting Operation." + then the CRLF string to StdOut; + Exit. + If the other number is not valid, + Write "Invalid input. Aborting Operation." + then the CRLF string to StdOut; + Exit. + Add the other number to the number. + Convert the number to a string called result. + Write "The sum is " then the result + then the CRLF string to StdOut. To decide if a number is valid: -If the number is not greater than or equal to -1000, say no. -If the number is not less than or equal to 1000, say no. -Say yes. + If the number is less than -1000, say no. + If the number is greater than 1000, say no. + Say yes. diff --git a/Task/A+B/Pluto/a+b.pluto b/Task/A+B/Pluto/a+b.pluto new file mode 100644 index 0000000000..974f2e0a29 --- /dev/null +++ b/Task/A+B/Pluto/a+b.pluto @@ -0,0 +1,2 @@ +a, b = io.read("*n", "*n") +print(a+b) diff --git a/Task/A+B/PowerShell/a+b-1.psh b/Task/A+B/PowerShell/a+b-1.ps1 similarity index 100% rename from Task/A+B/PowerShell/a+b-1.psh rename to Task/A+B/PowerShell/a+b-1.ps1 diff --git a/Task/A+B/PowerShell/a+b-2.psh b/Task/A+B/PowerShell/a+b-2.ps1 similarity index 100% rename from Task/A+B/PowerShell/a+b-2.psh rename to Task/A+B/PowerShell/a+b-2.ps1 diff --git a/Task/A+B/PowerShell/a+b-3.psh b/Task/A+B/PowerShell/a+b-3.ps1 similarity index 100% rename from Task/A+B/PowerShell/a+b-3.psh rename to Task/A+B/PowerShell/a+b-3.ps1 diff --git a/Task/A+B/PowerShell/a+b-4.psh b/Task/A+B/PowerShell/a+b-4.ps1 similarity index 100% rename from Task/A+B/PowerShell/a+b-4.psh rename to Task/A+B/PowerShell/a+b-4.ps1 diff --git a/Task/A+B/REXX/a+b-1.rexx b/Task/A+B/REXX/a+b-1.rexx deleted file mode 100644 index 46a34f359e..0000000000 --- a/Task/A+B/REXX/a+b-1.rexx +++ /dev/null @@ -1,4 +0,0 @@ -/*REXX program obtains two numbers from the input stream (the console), shows their sum.*/ -parse pull a b /*obtain two numbers from input stream.*/ -say a+b /*display the sum to the terminal. */ - /*stick a fork in it, we're all done. */ diff --git a/Task/A+B/REXX/a+b-2.rexx b/Task/A+B/REXX/a+b-2.rexx deleted file mode 100644 index 064640ab38..0000000000 --- a/Task/A+B/REXX/a+b-2.rexx +++ /dev/null @@ -1,4 +0,0 @@ -/*REXX program obtains two numbers from the input stream (the console), shows their sum.*/ -parse pull a b /*obtain two numbers from input stream.*/ -say (a+b) / 1 /*display normalized sum to terminal. */ - /*stick a fork in it, we're all done. */ diff --git a/Task/A+B/REXX/a+b-3.rexx b/Task/A+B/REXX/a+b-3.rexx deleted file mode 100644 index 774178e64d..0000000000 --- a/Task/A+B/REXX/a+b-3.rexx +++ /dev/null @@ -1,6 +0,0 @@ -/*REXX program obtains two numbers from the input stream (the console), shows their sum.*/ -numeric digits 300 /*the default is nine decimal digits.*/ -parse pull a b /*obtain two numbers from input stream.*/ -z= (a+b) / 1 /*add and normalize sum, store it in Z.*/ -say z /*display normalized sum Z to terminal.*/ - /*stick a fork in it, we're all done. */ diff --git a/Task/A+B/REXX/a+b-4.rexx b/Task/A+B/REXX/a+b-4.rexx deleted file mode 100644 index 05e988dfb5..0000000000 --- a/Task/A+B/REXX/a+b-4.rexx +++ /dev/null @@ -1,11 +0,0 @@ -/*REXX program obtains some numbers from the input stream (the console), shows their sum*/ -numeric digits 1000 /*just in case the user gets ka-razy. */ -say 'enter some numbers to be summed:' /*display a prompt message to terminal.*/ -parse pull y /*obtain all numbers from input stream.*/ -many= words(y) /*obtain the number of numbers entered.*/ -$= 0 /*initialize the sum to zero. */ - do j=1 for many /*process each of the numbers. */ - $= $ + word(y, j) /*add one number to the sum. */ - end /*j*/ - /*stick a fork in it, we're all done. */ -say 'sum of ' many " numbers = " $/1 /*display normalized sum $ to terminal.*/ diff --git a/Task/A+B/REXX/a+b-5.rexx b/Task/A+B/REXX/a+b-5.rexx deleted file mode 100644 index 3aed91ea3f..0000000000 --- a/Task/A+B/REXX/a+b-5.rexx +++ /dev/null @@ -1,8 +0,0 @@ -/*REXX program obtains some numbers from the input stream (the console), shows their sum*/ -numeric digits 1000 /*just in case the user gets ka-razy. */ -say 'enter some numbers to be summed:' /*display a prompt message to terminal.*/ -parse pull y /*obtain all numbers from input stream.*/ -y=space(y) -y=translate(y,'+',' ') -Interpret 's='y -say 'sum of ' many " numbers = " s/1 /*display normalized sum s to terminal.*/ diff --git a/Task/A+B/REXX/a+b.rexx b/Task/A+B/REXX/a+b.rexx new file mode 100644 index 0000000000..787c3a6be7 --- /dev/null +++ b/Task/A+B/REXX/a+b.rexx @@ -0,0 +1,27 @@ +-- 23 Aug 2025 +include Setting + +say 'A+B' +say version +say +do forever + call Charout, 'REXX ' + pull x + if x = '' then + leave + parse var x a b + say + say 'As given...' + say 'A =' a + say 'B =' b + say 'A+B =' a+b + say + say 'Normalized...' + say 'A =' a/1 + say 'B =' b/1 + say 'A+B =' (a+b)/1 + say +end +exit + +include Abend diff --git a/Task/A+B/REBOL/a+b.rebol b/Task/A+B/Rebol/a+b.rebol similarity index 100% rename from Task/A+B/REBOL/a+b.rebol rename to Task/A+B/Rebol/a+b.rebol diff --git a/Task/A+B/Rust/a+b-1.rust b/Task/A+B/Rust/a+b-1.rs similarity index 100% rename from Task/A+B/Rust/a+b-1.rust rename to Task/A+B/Rust/a+b-1.rs diff --git a/Task/A+B/Rust/a+b-2.rust b/Task/A+B/Rust/a+b-2.rs similarity index 100% rename from Task/A+B/Rust/a+b-2.rust rename to Task/A+B/Rust/a+b-2.rs diff --git a/Task/A+B/Rye/a+b-1.rye b/Task/A+B/Rye/a+b-1.rye new file mode 100644 index 0000000000..e2cff104bd --- /dev/null +++ b/Task/A+B/Rye/a+b-1.rye @@ -0,0 +1,5 @@ +rye .stdin ; +|Read\string ; "123 321" +|load ; [ 123 321 ] +|apply* ?_+ ; 444 +|print diff --git a/Task/A+B/Rye/a+b-2.rye b/Task/A+B/Rye/a+b-2.rye new file mode 100644 index 0000000000..f929e645ca --- /dev/null +++ b/Task/A+B/Rye/a+b-2.rye @@ -0,0 +1 @@ +echo "5 2" | rye -do 'rye .stdin .Read\string .load .apply* ?_+' diff --git a/Task/A+B/Scheme/a+b.ss b/Task/A+B/Scheme/a+b.scm similarity index 100% rename from Task/A+B/Scheme/a+b.ss rename to Task/A+B/Scheme/a+b.scm diff --git a/Task/A+B/Sidef/a+b-2.sidef b/Task/A+B/Sidef/a+b-2.sidef index 0170bf8af0..54dcc35be3 100644 --- a/Task/A+B/Sidef/a+b-2.sidef +++ b/Task/A+B/Sidef/a+b-2.sidef @@ -1 +1 @@ -say read(String).words»to_i»()«+» +say read(String).words»to_i()»«+» diff --git a/Task/A+B/Sinclair-ZX81-BASIC/a+b-2.basic b/Task/A+B/Sinclair-ZX81-BASIC/a+b-2.basic deleted file mode 100644 index e6fbeebe6b..0000000000 --- a/Task/A+B/Sinclair-ZX81-BASIC/a+b-2.basic +++ /dev/null @@ -1,18 +0,0 @@ -REM Rosetta Code problem: https://rosettacode.org/wiki/A+B -REM by Jjuanhdez, 06/2022 - -10 LET C = 0 - LET D = 0 - PRINT "Enter an integer: " - INPUT A - IF A < 0 THEN LET C = A * -1 - PRINT "Enter other integer: " - INPUT B - IF B < 0 THEN LET D = B * -1 - IF C > 1000 THEN GOTO 60 - IF D > 1000 THEN GOTO 60 -50 PRINT "Their sum is ", A + B - GOTO 70 -60 PRINT "Both integers must be in the range [-1000..1000] - try again." - GOTO 10 -70 END diff --git a/Task/A+B/Sinclair-ZX81-BASIC/a+b-1.basic b/Task/A+B/Sinclair-ZX81-BASIC/a+b.basic similarity index 100% rename from Task/A+B/Sinclair-ZX81-BASIC/a+b-1.basic rename to Task/A+B/Sinclair-ZX81-BASIC/a+b.basic diff --git a/Task/A+B/TAV/a+b.tav b/Task/A+B/TAV/a+b.tav new file mode 100644 index 0000000000..29b223afca --- /dev/null +++ b/Task/A+B/TAV/a+b.tav @@ -0,0 +1,6 @@ +main(parms):+ + ?# lne =: file () give lines \ void is standard input + ab =: string lne split by many of #Whitespace + a =: string ab[1] as integer + b =: string ab[2] as integer + print a + b diff --git a/Task/A+B/Uiua/a+b.uiua b/Task/A+B/Uiua/a+b.uiua new file mode 100644 index 0000000000..4a62fbacd3 --- /dev/null +++ b/Task/A+B/Uiua/a+b.uiua @@ -0,0 +1,5 @@ +/+∵⋕⊜□≠@ .&sc +
    +{{out|input=3 4}} +
    +7
    diff --git a/Task/A+B/VBScript/a+b-1.vb b/Task/A+B/VBScript/a+b-1.vbs
    similarity index 100%
    rename from Task/A+B/VBScript/a+b-1.vb
    rename to Task/A+B/VBScript/a+b-1.vbs
    diff --git a/Task/A+B/VBScript/a+b-2.vb b/Task/A+B/VBScript/a+b-2.vbs
    similarity index 100%
    rename from Task/A+B/VBScript/a+b-2.vb
    rename to Task/A+B/VBScript/a+b-2.vbs
    diff --git a/Task/A+B/VHDL/a+b.vhdl b/Task/A+B/VHDL/a+b.vhd
    similarity index 100%
    rename from Task/A+B/VHDL/a+b.vhdl
    rename to Task/A+B/VHDL/a+b.vhd
    diff --git a/Task/A+B/Vedit-macro-language/a+b-1.vedit b/Task/A+B/Vedit-macro-language/a+b-1.vedit
    new file mode 100644
    index 0000000000..bb34177e2b
    --- /dev/null
    +++ b/Task/A+B/Vedit-macro-language/a+b-1.vedit
    @@ -0,0 +1,13 @@
    +// Input two values on single line in text format
    +Get_Input(10, "Enter two integers separated by a space: ")
    +
    +// Extract two numeric values from the text
    +Buf_Switch(Buf_Free)
    +Reg_Ins(10)
    +BOF
    +#1 = Num_Eval(ADVANCE)
    +#2 = Num_Eval()
    +Buf_Quit(OK)
    +
    +// Calculate and display the results
    +Num_Type(#1 + #2)
    diff --git a/Task/A+B/Vedit-macro-language/a+b-2.vedit b/Task/A+B/Vedit-macro-language/a+b-2.vedit
    new file mode 100644
    index 0000000000..fdecccc7c1
    --- /dev/null
    +++ b/Task/A+B/Vedit-macro-language/a+b-2.vedit
    @@ -0,0 +1,3 @@
    +#1 = Get_Num("Enter number A: ")
    +#2 = Get_Num("Enter number B: ")
    +Num_Type(#1 + #2)
    diff --git a/Task/A+B/X86-64-Assembly/a+b.x86-64 b/Task/A+B/X86-64-Assembly/a+b.x86-64
    new file mode 100644
    index 0000000000..6254ca0053
    --- /dev/null
    +++ b/Task/A+B/X86-64-Assembly/a+b.x86-64
    @@ -0,0 +1,150 @@
    +format ELF64 executable 3
    +entry start
    +bsize equ 24
    +
    +segment executable readable
    +start:
    +    pop    rdx
    +    cmp    rdx,    1
    +    jg     .getargv0
    +    mov    qword[avar], 0
    +    mov    qword[bvar], 0
    +    jmp    .calculate
    + .getargv0:
    +    pop    rdi
    +    pop    rdi
    +    call   atoq
    +    mov    qword[avar], rax
    +    cmp    rdx,     2
    +    jg     .getargv1
    +    mov    qword[bvar], 0
    +    jmp    .calculate
    + .getargv1:
    +    pop    rdi
    +    call   atoq
    +    mov    qword[bvar], rax
    + .calculate:
    +    xor    rdi,    rdi
    +    add    rdi,    qword[avar]
    +    add    rdi,    qword[bvar]
    +    call   printq
    + .exit0:
    +    mov    rax,    60
    +    xor    rdi,    rdi
    +    syscall
    +
    +atoq:
    +    push r8
    +    push r9
    +    push rdi
    +    push rsi
    +    push rdx
    +    push rcx
    +    xor  rcx, rcx
    +    xor  rax, rax
    +    xor  r8, r8
    +    mov  r9, 1
    +    cmp  byte[rdi], 0
    +    jz  .exit
    +    cmp byte[rdi], '-'
    +    jne .stbegin
    +    mov r9, -1
    +    inc rdi
    +  .stbegin:
    +    cmp byte[rdi], '0'
    +    jl  .return
    +    cmp byte[rdi], '9'
    +    jg  .return
    +  .stloop:
    +    cmp byte[rdi + r8], '0'
    +    jl .calc0
    +    cmp byte[rdi + r8], '9'
    +    jg .calc0
    +    mov sil, byte[rdi + r8]
    +    sub rsi, '0'
    +    push rsi
    +    inc r8
    +    jmp .stloop
    +  .calc0:
    +    xor rcx, rcx
    +    mov rdi,  10
    +    mov rsi, 1
    +  .calc1:
    +    pop rax
    +    mul rsi
    +    add rcx, rax
    +    dec r8
    +    jz  .return
    +    mov rax, rsi
    +    mul rdi
    +    mov rsi, rax
    +    jmp .calc1
    +  .return:
    +    xor rdx, rdx
    +    mov rax, rcx
    +    imul r9
    +  .exit:
    +    pop rcx
    +    pop rdx
    +    pop rsi
    +    pop rdi
    +    pop r9
    +    pop r8
    +    ret
    +
    +printq:
    +    push   r9
    +    push   rdi
    +    push   rsi
    +    push   rdx
    +    mov    rax,    rdi
    +    mov    r9,    bsize
    +    dec    r9
    +    mov    rsi,   10
    +    sub    rsp,   bsize
    +    sub    rax,    0
    +    jns    .stloop
    +    neg    rax
    +  .stloop:
    +    xor    rdx,   rdx
    +    div    rsi
    +    add    dl,   '0'
    +    mov    byte[rsp + r9], dl
    +    sub    rax,    0
    +    jz     .negtest
    +    dec    r9
    +    jmp .stloop
    +  .negtest:
    +    sub    rdi,    0
    +    jns    .printit
    +    dec    r9
    +    mov    byte[rsp + r9], '-'
    +  .printit:
    +    mov    rdx, bsize
    +    sub    rdx, r9
    +    mov    rsi, rsp
    +    add    rsi, r9
    +    mov    rdi, 1
    +    mov    rax, 1
    +    syscall
    +    sub    rsp, 8
    +    mov    byte[rsp], 0x0a
    +    mov    rax, 1
    +    mov    rdi, 1
    +    mov    rsi, rsp
    +    mov    rdx, 1
    +    syscall
    +    add    rsp, 8
    +  .restores:
    +    add    rsp, bsize
    +    mov    rax, rdx
    +    pop    rdx
    +    pop    rsi
    +    pop    rdi
    +    pop    r9
    +  .return:
    +    ret
    +
    +segment readable writable
    +avar: rq 1
    +bvar: rq 1
    diff --git a/Task/A+B/XBasic/a+b.basic b/Task/A+B/XBasic/a+b.basic
    new file mode 100644
    index 0000000000..14b9a144f3
    --- /dev/null
    +++ b/Task/A+B/XBasic/a+b.basic
    @@ -0,0 +1,21 @@
    +PROGRAM	"A+B"
    +VERSION	"0.0000"
    +
    +DECLARE FUNCTION  Entry ()
    +
    +FUNCTION  Entry ()
    +  a$ = INLINE$("Enter integer A: ")
    +  a = SLONG(a$)
    +  b$ = INLINE$("Enter integer B: ")
    +  b = SLONG(b$)
    +  DO WHILE 1
    +    IF ABS(a) > 1000 OR ABS(b) > 1000 THEN
    +      PRINT "Both integers must be in the interval [-1000..1000] - try again."
    +      PRINT
    +    ELSE
    +      PRINT "Their sum is"; a + b
    +      EXIT DO
    +    END IF
    +  LOOP
    +END FUNCTION
    +END PROGRAM
    diff --git a/Task/A+B/ZED/a+b.zed b/Task/A+B/ZED/a+b.zed
    index 6c28d79b86..b3605ef199 100644
    --- a/Task/A+B/ZED/a+b.zed
    +++ b/Task/A+B/ZED/a+b.zed
    @@ -1,14 +1,14 @@
     (A+B)
    -comment:
    +READ AND ADD
     #true
     (+) (read) (read)
     
     (+) one two
    -comment:
    +=========
     #true
     (003) "+" one two
     
     (read)
    -comment:
    +=========
     #true
     (001) "read"
    diff --git a/Task/A+B/Zig/a+b.zig b/Task/A+B/Zig/a+b.zig
    new file mode 100644
    index 0000000000..378622f54f
    --- /dev/null
    +++ b/Task/A+B/Zig/a+b.zig
    @@ -0,0 +1,18 @@
    +const std = @import("std");
    +
    +pub fn main() !void {
    +    var buf: [1024]u8 = undefined;
    +    const reader = std.io.getStdIn().reader();
    +    const stdout = std.io.getStdOut().writer();
    +    try stdout.writeAll("Enter two integers separated by a space: ");
    +    const input = try reader.readUntilDelimiter(&buf, '\n');
    +    const text = std.mem.trimRight(u8, input, "\r\n");
    +
    +    var it = std.mem.tokenizeScalar(u8, text, ' ');
    +
    +    const a = try std.fmt.parseInt(i64, it.next().?, 10);
    +    const b = try std.fmt.parseInt(i64, it.next().?, 10);
    +
    +
    +    try stdout.print("{d}\n", .{a + b});
    +}
    diff --git a/Task/ABC-problem/8080-Assembly/abc-problem.8080 b/Task/ABC-problem/8080-Assembly/abc-problem.8080
    index e6c7c4d5f4..1c9a496782 100644
    --- a/Task/ABC-problem/8080-Assembly/abc-problem.8080
    +++ b/Task/ABC-problem/8080-Assembly/abc-problem.8080
    @@ -1,77 +1,77 @@
    -		org	100h
    -		jmp	test
    -		;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    -		;;; Subroutine 'blocks': takes a $-terminated string in
    -		;;; DE containing a word, and checks whether it can be
    -		;;; written with the blocks.
    -		;;; Returns: carry flag set if word is accepted.
    -		;;; Uses registers: A, B, D, E, H, L
    -blocks:		push	d		; Store string pointer
    -		lxi	h,blockslist	; At the start, all blocks are
    -		lxi	d,blocksavail	; available
    -		mvi	b,40
    -blocksinit:	mov	a,m
    -		stax	d
    -		inx	h
    -		inx	d
    -		dcr	b
    -		jnz	blocksinit
    -		pop	d		; Restore string pointer
    -blockschar:	ldax	d		; Get current character
    -		cpi	'$'		; End of string?
    -		stc			; Set carry flag (accept string)
    -		rz			; And then we're done
    -		ani	0DFh		; Make uppercase
    -		lxi	h,blocksavail	; Is it available?
    -		mvi	b,40
    -blockscheck:	cmp	m
    -		jz	blocksaccept	; Yes, we found it
    -		inx	h		; Try next available char
    -		dcr	b
    -		jnz	blockscheck
    -		ana	a		; Char unavailable, clear
    -		ret			; carry and stop.
    -blocksaccept:	mvi	m,0		; We've now used this char
    -		mov	a,l		; And its blockmate
    -		xri	1
    -		mov	l,a
    -		mvi	m,0
    -		inx	d		; Try next char in string
    -		jmp	blockschar
    -		;; Note: 'blocksavail' must not cross page boundary
    -blockslist:	db	'BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM'
    -blocksavail:	ds	40
    -		;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    -		;;; Test code: run the subroutine on the given words.
    -test:		lxi	h,words
    -doword:		mov	e,m		; Get pointer to next word
    -		inx	h
    -		mov	d,m
    -		inx	h
    -		mov	a,e		; If zero, end of word list
    -		ora	d
    -		rz
    -		push	h		; Save pointer to list
    -		push	d		; Save pointer to word
    -		mvi	c,9		; Write word to console
    -		call	5
    -		pop	d		; Retrieve word ponter
    -		call	blocks		; Run the 'blocks' routine
    -		lxi	d,yes		; Say 'yes',
    -		jc	yesno		; if the carry is set.
    -		lxi	d,no		; Otherwise, say 'no'.
    -yesno:		mvi	c,9
    -		call	5
    -		pop	h		; Restore list pointer
    -		jmp	doword		; Do next word
    -yes:		db	': Yes',13,10,'$'
    -no:		db	': No',13,10,'$'
    -words:		dw	wrda,wrdbark,wrdbook,wrdtreat,wrdcommon
    -		dw	wrdsquad,wrdconfuse,0
    -wrda:		db	'A$'
    -wrdbark:	db	'BARK$'
    -wrdbook:	db	'BOOK$'
    -wrdtreat:	db	'TREAT$'
    -wrdcommon:	db	'COMMON$'
    -wrdsquad:	db	'SQUAD$'
    -wrdconfuse:	db	'CONFUSE$'
    +    org   100h
    +      jmp   test
    +      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +      ;;; Subroutine 'blocks': takes a $-terminated string in
    +      ;;; DE containing a word, and checks whether it can be
    +      ;;; written with the blocks.
    +      ;;; Returns: carry flag set if word is accepted.
    +      ;;; Uses registers: A, B, D, E, H, L
    +blocks:     push  d     ; Store string pointer
    +      lxi   h,blockslist   ; At the start, all blocks are
    +      lxi   d,blocksavail  ; available
    +      mvi   b,40
    +blocksinit: mov   a,m
    +      stax  d
    +      inx   h
    +      inx   d
    +      dcr   b
    +      jnz   blocksinit
    +      pop   d     ; Restore string pointer
    +blockschar: ldax  d     ; Get current character
    +      cpi   '$'      ; End of string?
    +      stc         ; Set carry flag (accept string)
    +      rz       ; And then we're done
    +      ani   0DFh     ; Make uppercase
    +      lxi   h,blocksavail  ; Is it available?
    +      mvi   b,40
    +blockscheck:   cmp   m
    +      jz blocksaccept   ; Yes, we found it
    +      inx   h     ; Try next available char
    +      dcr   b
    +      jnz   blockscheck
    +      ana   a     ; Char unavailable, clear
    +      ret         ; carry and stop.
    +blocksaccept:  mvi   m,0      ; We've now used this char
    +      mov   a,l      ; And its blockmate
    +      xri   1
    +      mov   l,a
    +      mvi   m,0
    +      inx   d     ; Try next char in string
    +      jmp   blockschar
    +      ;; Note: 'blocksavail' must not cross page boundary
    +blockslist: db 'BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM'
    +blocksavail:   ds 40
    +      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +      ;;; Test code: run the subroutine on the given words.
    +test:    lxi   h,words
    +doword:     mov   e,m      ; Get pointer to next word
    +      inx   h
    +      mov   d,m
    +      inx   h
    +      mov   a,e      ; If zero, end of word list
    +      ora   d
    +      rz
    +      push  h     ; Save pointer to list
    +      push  d     ; Save pointer to word
    +      mvi   c,9      ; Write word to console
    +      call  5
    +      pop   d     ; Retrieve word ponter
    +      call  blocks      ; Run the 'blocks' routine
    +      lxi   d,yes    ; Say 'yes',
    +      jc yesno    ; if the carry is set.
    +      lxi   d,no     ; Otherwise, say 'no'.
    +yesno:      mvi   c,9
    +      call  5
    +      pop   h     ; Restore list pointer
    +      jmp   doword      ; Do next word
    +yes:     db ': Yes',13,10,'$'
    +no:      db ': No',13,10,'$'
    +words:      dw wrda,wrdbark,wrdbook,wrdtreat,wrdcommon
    +      dw wrdsquad,wrdconfuse,0
    +wrda:    db 'A$'
    +wrdbark: db 'BARK$'
    +wrdbook: db 'BOOK$'
    +wrdtreat:   db 'TREAT$'
    +wrdcommon:  db 'COMMON$'
    +wrdsquad:   db 'SQUAD$'
    +wrdconfuse: db 'CONFUSE$'
    diff --git a/Task/ABC-problem/8086-Assembly/abc-problem.8086 b/Task/ABC-problem/8086-Assembly/abc-problem.8086
    index ca056dc17a..260f99738a 100644
    --- a/Task/ABC-problem/8086-Assembly/abc-problem.8086
    +++ b/Task/ABC-problem/8086-Assembly/abc-problem.8086
    @@ -1,63 +1,63 @@
    -	cpu	8086
    -	bits	16
    -	org	100h
    -section	.text
    -	jmp	demo
    -	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    -	;;; Subroutine "blocks": see if the $-terminated string in DS:BX
    -	;;; can be written with the blocks.
    -	;;; Returns: carry flag set if word is accepted.
    -	;;; Uses registers: AL, BX, CX, SI, DI
    -	;;; Assumes CS=DS=ES
    -blocks:	mov	si,.list	; Set all blocks available
    -	mov	di,.avail
    -	mov	cx,20
    -	rep	movsw
    -.char:	mov 	al,[bx]		; Get current character
    -	inc	bx
    -	cmp	al,'$'		; Are we at the end?
    -	je	.ok		; Then the string is accepted
    -	mov	cx,40		; If not, check if block is available
    -	mov	di,.avail
    -	repne	scasb
    -	test	cx,cx		; This clears the carry flag
    -	jz	.out		; If zero, block is not available
    -	dec	di		; Zero out the block we found
    -	mov	[di],ch		; CH is guaranteed 0 here
    -	xor	di,1		; Point at other character on block
    -	mov	[di],ch		; Zero out that one too.
    -	jmp	.char
    -.ok:	stc
    -.out:	ret
    -.list:	db	'BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM'
    -.avail:	db	'                                        '
    -	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    -	;;; Test code: run the subroutine on the given words
    -demo:	mov	bp,words
    -wrd:	mov	dx,[bp]		; Get word
    -	test	dx,dx		; End of words?
    -	jz	stop
    -	mov	ah,9		; Print word
    -	int	21h
    -	mov	bx,dx		; Run subroutine
    -	call	blocks
    -	mov	dx,yes		; Print yes or no depending on carry
    -	jc	print
    -	mov	dx,no
    -print:	mov	ah,9
    -	int	21h
    -	inc	bp
    -	inc	bp
    -	jmp	wrd
    -stop:	ret
    -section	.data
    -yes:	db	': Yes',13,10,'$'
    -no:	db	': No',13,10,'$'
    -words:	dw	.a,.bark,.book,.treat,.cmn,.squad,.confs,0
    -.a:	db	'A$'
    -.bark:	db	'BARK$'
    -.book:	db	'BOOK$'
    -.treat:	db	'TREAT$'
    -.cmn:	db	'COMMON$'
    -.squad:	db	'SQUAD$'
    -.confs:	db	'CONFUSE$'
    +  cpu   8086
    +   bits  16
    +   org   100h
    +section  .text
    +   jmp   demo
    +   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +   ;;; Subroutine "blocks": see if the $-terminated string in DS:BX
    +   ;;; can be written with the blocks.
    +   ;;; Returns: carry flag set if word is accepted.
    +   ;;; Uses registers: AL, BX, CX, SI, DI
    +   ;;; Assumes CS=DS=ES
    +blocks:  mov   si,.list ; Set all blocks available
    +   mov   di,.avail
    +   mov   cx,20
    +   rep   movsw
    +.char:   mov   al,[bx]     ; Get current character
    +   inc   bx
    +   cmp   al,'$'      ; Are we at the end?
    +   je .ok      ; Then the string is accepted
    +   mov   cx,40    ; If not, check if block is available
    +   mov   di,.avail
    +   repne scasb
    +   test  cx,cx    ; This clears the carry flag
    +   jz .out     ; If zero, block is not available
    +   dec   di    ; Zero out the block we found
    +   mov   [di],ch     ; CH is guaranteed 0 here
    +   xor   di,1     ; Point at other character on block
    +   mov   [di],ch     ; Zero out that one too.
    +   jmp   .char
    +.ok:  stc
    +.out: ret
    +.list:   db 'BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM'
    +.avail:  db '                                        '
    +   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +   ;;; Test code: run the subroutine on the given words
    +demo: mov   bp,words
    +wrd:  mov   dx,[bp]     ; Get word
    +   test  dx,dx    ; End of words?
    +   jz stop
    +   mov   ah,9     ; Print word
    +   int   21h
    +   mov   bx,dx    ; Run subroutine
    +   call  blocks
    +   mov   dx,yes      ; Print yes or no depending on carry
    +   jc print
    +   mov   dx,no
    +print:   mov   ah,9
    +   int   21h
    +   inc   bp
    +   inc   bp
    +   jmp   wrd
    +stop: ret
    +section  .data
    +yes:  db ': Yes',13,10,'$'
    +no:   db ': No',13,10,'$'
    +words:   dw .a,.bark,.book,.treat,.cmn,.squad,.confs,0
    +.a:   db 'A$'
    +.bark:   db 'BARK$'
    +.book:   db 'BOOK$'
    +.treat:  db 'TREAT$'
    +.cmn: db 'COMMON$'
    +.squad:  db 'SQUAD$'
    +.confs:  db 'CONFUSE$'
    diff --git a/Task/ABC-problem/8th/abc-problem.8th b/Task/ABC-problem/8th/abc-problem.8th
    index f5b7f80c51..6869fcd656 100644
    --- a/Task/ABC-problem/8th/abc-problem.8th
    +++ b/Task/ABC-problem/8th/abc-problem.8th
    @@ -171,8 +171,8 @@ var ix
       ' chkokpath s:each                          \ | path
       rdrop                                       \
       success @                                   \ success
    -	if                                          \
    -	  break                                     \
    +   if                                          \
    +     break                                     \
       then
       ;
     
    diff --git a/Task/ABC-problem/ABC/abc-problem.abc b/Task/ABC-problem/ABC/abc-problem.abc
    new file mode 100644
    index 0000000000..bda16bfbca
    --- /dev/null
    +++ b/Task/ABC-problem/ABC/abc-problem.abc
    @@ -0,0 +1,17 @@
    +HOW TO REPORT word can.be.made.with blocks:
    +    FOR letter IN upper word:
    +        IF NO block IN blocks HAS letter in block: FAIL
    +        REMOVE block FROM blocks
    +    SUCCEED
    +
    +PUT {"BO";"XK";"DQ";"CP";"NA";"GT";"RE";"TG";"QD";"FS"} IN blocks
    +PUT {"JW";"HU";"VI";"AN";"OB";"ER";"FS";"LY";"PC";"ZM"} IN blocks2
    +FOR block IN blocks2: INSERT block IN blocks
    +
    +PUT {"A";"BARK";"BOOK";"treat";"common";"Squad";"CoNfUsE"} IN words
    +
    +FOR word IN words:
    +    WRITE word, ": "
    +    SELECT:
    +        word can.be.made.with blocks: WRITE "yes"/
    +        ELSE: WRITE "no"/
    diff --git a/Task/ABC-problem/ALGOL-68/abc-problem.alg b/Task/ABC-problem/ALGOL-68/abc-problem.alg
    index 524af00c33..11c3a41ade 100644
    --- a/Task/ABC-problem/ALGOL-68/abc-problem.alg
    +++ b/Task/ABC-problem/ALGOL-68/abc-problem.alg
    @@ -1,21 +1,14 @@
    +# ABC problem:                                                               #
     # determine whether we can spell words with a set of blocks                  #
     
    -# construct the list of blocks                                               #
    -[][]STRING blocks = ( ( "B", "O" ), ( "X", "K" ), ( "D", "Q" ), ( "C", "P" )
    -                    , ( "N", "A" ), ( "G", "T" ), ( "R", "E" ), ( "T", "G" )
    -                    , ( "Q", "D" ), ( "F", "S" ), ( "J", "W" ), ( "H", "U" )
    -                    , ( "V", "I" ), ( "A", "N" ), ( "O", "B" ), ( "E", "R" )
    -                    , ( "F", "S" ), ( "L", "Y" ), ( "P", "C" ), ( "Z", "M" )
    -                    );
    -
     # Returns TRUE if we can spell the word using the blocks, FALSE otherwise    #
     # Returns TRUE for an empty string                                           #
    -PROC can spell = ( STRING word, [][]STRING blocks )BOOL:
    +PROC can spell = ( STRING word, [][]STRING block set )BOOL:
         BEGIN
     
             # construct a set of flags to indicate whether the blocks are used   #
             # or not                                                             #
    -        [ 1 LWB blocks : 1 UPB blocks ]BOOL used;
    +        [ 1 LWB block set : 1 UPB block set ]BOOL used;
             FOR block pos FROM LWB used TO UPB used
             DO
                 used[ block pos ] := FALSE
    @@ -34,11 +27,11 @@ PROC can spell = ( STRING word, [][]STRING blocks )BOOL:
     
                 # look through the unused blocks for the current letter          #
                 BOOL found := FALSE;
    -            FOR block pos FROM 1 LWB blocks TO 1 UPB blocks
    +            FOR block pos FROM 1 LWB block set TO 1 UPB block set
                 WHILE NOT found
                 DO
    -                IF  (  c = blocks[ block pos ][ 1 ][ 1 ]
    -                    OR c = blocks[ block pos ][ 2 ][ 1 ]
    +                IF  (  c = block set[ block pos ][ 1 ][ 1 ]
    +                    OR c = block set[ block pos ][ 2 ][ 1 ]
                         )
                     AND NOT used[ block pos ]
                     THEN
    @@ -56,25 +49,33 @@ PROC can spell = ( STRING word, [][]STRING blocks )BOOL:
         END; # can spell #
     
     
    -main: (
    +# main # (
    +
    +    [][]STRING abc blocks # construct the list of blocks                     #
    +                  = ( ( "B", "O" ), ( "X", "K" ), ( "D", "Q" ), ( "C", "P" )
    +                    , ( "N", "A" ), ( "G", "T" ), ( "R", "E" ), ( "T", "G" )
    +                    , ( "Q", "D" ), ( "F", "S" ), ( "J", "W" ), ( "H", "U" )
    +                    , ( "V", "I" ), ( "A", "N" ), ( "O", "B" ), ( "E", "R" )
    +                    , ( "F", "S" ), ( "L", "Y" ), ( "P", "C" ), ( "Z", "M" )
    +                    );
     
         # test the can spell procedure                                           #
    -    PROC test can spell = ( STRING word, [][]STRING blocks )VOID:
    +    PROC test can spell = ( STRING word, [][]STRING block set )VOID:
             write( ( ( "can spell: """
                      + word
                      + """ -> "
    -                 + IF can spell( word, blocks ) THEN "yes" ELSE "no" FI
    +                 + IF can spell( word, block set ) THEN "yes" ELSE "no" FI
                      )
                    , newline
                    )
                  );
     
    -    test can spell( "A",       blocks );
    -    test can spell( "BaRK",    blocks );
    -    test can spell( "BOOK",    blocks );
    -    test can spell( "TREAT",   blocks );
    -    test can spell( "COMMON",  blocks );
    -    test can spell( "SQUAD",   blocks );
    -    test can spell( "CONFUSE", blocks )
    +    test can spell( "A",       abc blocks );
    +    test can spell( "BaRK",    abc blocks );
    +    test can spell( "BOOK",    abc blocks );
    +    test can spell( "TREAT",   abc blocks );
    +    test can spell( "COMMON",  abc blocks );
    +    test can spell( "SQUAD",   abc blocks );
    +    test can spell( "CONFUSE", abc blocks )
     
     )
    diff --git a/Task/ABC-problem/Ada/abc-problem.ada b/Task/ABC-problem/Ada/abc-problem.adb
    similarity index 100%
    rename from Task/ABC-problem/Ada/abc-problem.ada
    rename to Task/ABC-problem/Ada/abc-problem.adb
    diff --git a/Task/ABC-problem/Arturo/abc-problem.arturo b/Task/ABC-problem/Arturo/abc-problem.arturo
    index 7ec68fd2ef..5365095039 100644
    --- a/Task/ABC-problem/Arturo/abc-problem.arturo
    +++ b/Task/ABC-problem/Arturo/abc-problem.arturo
    @@ -16,8 +16,8 @@ canMakeWord?: function [wrd][
         ref: new blocks
         loop split wrd 'chr [
             cib: charInBlock chr ref
    -        if? cib = ø [ return false ]
    -        else        [ ref: remove ref .index cib ]
    +        switch cib = ø [ return false ]
    +                       [ ref: remove ref .index cib ]
         ]
         return true
     ]
    diff --git a/Task/ABC-problem/AutoHotkey/abc-problem-1.ahk b/Task/ABC-problem/AutoHotkey/abc-problem-1.ahk
    index 448f692c2b..d92688964d 100644
    --- a/Task/ABC-problem/AutoHotkey/abc-problem-1.ahk
    +++ b/Task/ABC-problem/AutoHotkey/abc-problem-1.ahk
    @@ -1,24 +1,24 @@
     isWordPossible(blocks, word){
    -	o := {}
    -	loop, parse, blocks, `n, `r
    -		o.Insert(A_LoopField)
    -	loop, parse, word
    -		if !(r := isWordPossible_contains(o, A_LoopField, word))
    -			return 0
    -	return 1
    +   o := {}
    +   loop, parse, blocks, `n, `r
    +      o.Insert(A_LoopField)
    +   loop, parse, word
    +      if !(r := isWordPossible_contains(o, A_LoopField, word))
    +         return 0
    +   return 1
     }
     isWordPossible_contains(byref o, letter, word){
    -	loop 2 {
    -		for k,v in o
    -			if Instr(v,letter)
    -			{
    -				StringReplace, op, v,% letter
    -				if RegExMatch(op, "[" word "]")
    -					sap := k
    -				else added := 1 , sap := k
    -				if added
    -					return "1" o.remove(sap)
    -			}
    -		added := 1
    -	}
    +   loop 2 {
    +      for k,v in o
    +         if Instr(v,letter)
    +         {
    +            StringReplace, op, v,% letter
    +            if RegExMatch(op, "[" word "]")
    +               sap := k
    +            else added := 1 , sap := k
    +            if added
    +               return "1" o.remove(sap)
    +         }
    +      added := 1
    +   }
     }
    diff --git a/Task/ABC-problem/AutoHotkey/abc-problem-2.ahk b/Task/ABC-problem/AutoHotkey/abc-problem-2.ahk
    index dff93522ac..c68d69b1f4 100644
    --- a/Task/ABC-problem/AutoHotkey/abc-problem-2.ahk
    +++ b/Task/ABC-problem/AutoHotkey/abc-problem-2.ahk
    @@ -34,5 +34,5 @@ CONFUSE
     )"
     
     loop, parse, wordlist, `n
    -	out .= A_LoopField " - " isWordPossible(blocks, A_LoopField) "`n"
    +   out .= A_LoopField " - " isWordPossible(blocks, A_LoopField) "`n"
     msgbox % out
    diff --git a/Task/ABC-problem/BASIC256/abc-problem.basic b/Task/ABC-problem/BASIC256/abc-problem.basic
    index e448382b74..9458ea9532 100644
    --- a/Task/ABC-problem/BASIC256/abc-problem.basic
    +++ b/Task/ABC-problem/BASIC256/abc-problem.basic
    @@ -5,42 +5,42 @@ b         = int((length(blocks$) /3) +  1)
     dim blk$(b)
     
     for i = 1 to length(makeWord$)
    -	wrd$ = word$(makeWord$,i,",")
    -	dim hit(b)
    -	n = 0
    -	if wrd$ = "" then exit for
    -	for k = 1 to length(wrd$)
    -		w$ = upper(mid(wrd$,k,1))
    -		for j = 1 to b
    -			if hit[j] = 0 then
    -				if w$ = left(word$(blocks$,j,","),1) or w$ = right(word$(blocks$,j,","),1) then
    -					hit[j] = 1
    -					n += 1
    -					exit for
    -				end if
    -			end if
    -		next j
    -	next k
    -	print wrd$; chr(9);
    -	if n = length(wrd$) then print " True" else print " False"
    +   wrd$ = word$(makeWord$,i,",")
    +   dim hit(b)
    +   n = 0
    +   if wrd$ = "" then exit for
    +   for k = 1 to length(wrd$)
    +      w$ = upper(mid(wrd$,k,1))
    +      for j = 1 to b
    +         if hit[j] = 0 then
    +            if w$ = left(word$(blocks$,j,","),1) or w$ = right(word$(blocks$,j,","),1) then
    +               hit[j] = 1
    +               n += 1
    +               exit for
    +            end if
    +         end if
    +      next j
    +   next k
    +   print wrd$; chr(9);
    +   if n = length(wrd$) then print " True" else print " False"
     next i
     end
     
     function word$(sr$, wn, delim$)
    -	j = wn
    -	if j = 0 then j += 1
    -	res$ = "" : s$ = sr$ : d$ = delim$
    -	if d$ = "" then d$ = " "
    -	sd = length(d$) : sl = length(s$)
    -	while true
    -		n = instr(s$,d$) : j -= 1
    -		if j = 0 then
    -			if n = 0 then res$ = s$ else res$ = mid(s$,1,n-1)
    -			return res$
    -		end if
    -		if n = 0 then return res$
    -		if n = sl - sd then res$ = "" : return res$
    -		sl2 = sl-n : s$ = mid(s$,n+1,sl2) : sl = sl2
    -	end while
    -	return res$
    +   j = wn
    +   if j = 0 then j += 1
    +   res$ = "" : s$ = sr$ : d$ = delim$
    +   if d$ = "" then d$ = " "
    +   sd = length(d$) : sl = length(s$)
    +   while true
    +      n = instr(s$,d$) : j -= 1
    +      if j = 0 then
    +         if n = 0 then res$ = s$ else res$ = mid(s$,1,n-1)
    +         return res$
    +      end if
    +      if n = 0 then return res$
    +      if n = sl - sd then res$ = "" : return res$
    +      sl2 = sl-n : s$ = mid(s$,n+1,sl2) : sl = sl2
    +   end while
    +   return res$
     end function
    diff --git a/Task/ABC-problem/Ballerina/abc-problem.ballerina b/Task/ABC-problem/Ballerina/abc-problem.ballerina
    new file mode 100644
    index 0000000000..6210e2d24b
    --- /dev/null
    +++ b/Task/ABC-problem/Ballerina/abc-problem.ballerina
    @@ -0,0 +1,32 @@
    +import ballerina/io;
    +
    +function r(string word, string[] bl) returns boolean {
    +    if word == "" { return true; }
    +    int c = word[0].toBytes()[0] | 32;
    +   foreach int i in 0.. blocks =
    -	new List() { "bo", "xk", "dq", "cp", "na", "gt", "re", "tg", "qd", "fs",
    -		"jw", "hu", "vi", "an", "ob", "er", "fs", "ly", "pc", "zm" };
    -	List words = new List() {
    -		"A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "CONFUSE"};
    -	
    -	var solver = new ABC(blocks);
    -	
    -	foreach( var word in words)
    -	{
    -		Console.WriteLine("{0} :{1}", word, solver.CanMake(word));
    -	}
    +   List blocks =
    +   new List() { "bo", "xk", "dq", "cp", "na", "gt", "re", "tg", "qd", "fs",
    +      "jw", "hu", "vi", "an", "ob", "er", "fs", "ly", "pc", "zm" };
    +   List words = new List() {
    +      "A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "CONFUSE"};
    +
    +   var solver = new ABC(blocks);
    +
    +   foreach( var word in words)
    +   {
    +      Console.WriteLine("{0} :{1}", word, solver.CanMake(word));
    +   }
     }
     
     class ABC
     {
    -	readonly Dictionary> _blockDict = new Dictionary>();
    -	bool[] _used;
    -	int _nextBlock;
    +   readonly Dictionary> _blockDict = new Dictionary>();
    +   bool[] _used;
    +   int _nextBlock;
     
    -	readonly List _blocks;
    +   readonly List _blocks;
     
    -	private void AddBlockChar(char c)
    -	{
    -		if (!_blockDict.ContainsKey(c))
    -		{
    -			_blockDict[c] = new List();
    -		}
    -		_blockDict[c].Add(_nextBlock);
    -	}
    +   private void AddBlockChar(char c)
    +   {
    +      if (!_blockDict.ContainsKey(c))
    +      {
    +         _blockDict[c] = new List();
    +      }
    +      _blockDict[c].Add(_nextBlock);
    +   }
     
    -	private void AddBlock(string block)
    -	{
    -		AddBlockChar(block[0]);
    -		AddBlockChar(block[1]);
    -		_nextBlock++;
    -	}
    +   private void AddBlock(string block)
    +   {
    +      AddBlockChar(block[0]);
    +      AddBlockChar(block[1]);
    +      _nextBlock++;
    +   }
     
    -	public ABC(List blocks)
    -	{
    -		_blocks = blocks;
    -		foreach (var block in blocks)
    -		{
    -			AddBlock(block);
    -		}
    -	}
    +   public ABC(List blocks)
    +   {
    +      _blocks = blocks;
    +      foreach (var block in blocks)
    +      {
    +         AddBlock(block);
    +      }
    +   }
     
    -	public bool CanMake(string word)
    -	{
    -		word = word.ToLower();
    -		if (word.Length > _blockDict.Count)
    -		{
    -			return false;
    -		}
    -		_used = new bool[_blocks.Count];
    -		return TryMake(word);
    -	}
    +   public bool CanMake(string word)
    +   {
    +      word = word.ToLower();
    +      if (word.Length > _blockDict.Count)
    +      {
    +         return false;
    +      }
    +      _used = new bool[_blocks.Count];
    +      return TryMake(word);
    +   }
     
    -	public bool TryMake(string word)
    -	{
    -		if (word == string.Empty)
    -		{
    -			return true;
    -		}
    -		var blocks = _blockDict[word[0]].Where(b => !_used[b]);
    -		foreach (var block in blocks)
    -		{
    -			_used[block] = true;
    -			if (TryMake(word.Substring(1)))
    -			{
    -				return true;
    -			}
    -			_used[block] = false;
    -		}
    -		return false;
    -	}
    +   public bool TryMake(string word)
    +   {
    +      if (word == string.Empty)
    +      {
    +         return true;
    +      }
    +      var blocks = _blockDict[word[0]].Where(b => !_used[b]);
    +      foreach (var block in blocks)
    +      {
    +         _used[block] = true;
    +         if (TryMake(word.Substring(1)))
    +         {
    +            return true;
    +         }
    +         _used[block] = false;
    +      }
    +      return false;
    +   }
     }
    diff --git a/Task/ABC-problem/C/abc-problem.c b/Task/ABC-problem/C/abc-problem.c
    index 0a798cd2c4..6e248837a9 100644
    --- a/Task/ABC-problem/C/abc-problem.c
    +++ b/Task/ABC-problem/C/abc-problem.c
    @@ -3,39 +3,39 @@
     
     int can_make_words(char **b, char *word)
     {
    -	int i, ret = 0, c = toupper(*word);
    +   int i, ret = 0, c = toupper(*word);
     
     #define SWAP(a, b) if (a != b) { char * tmp = a; a = b; b = tmp; }
     
    -	if (!c) return 1;
    -	if (!b[0]) return 0;
    +   if (!c) return 1;
    +   if (!b[0]) return 0;
     
    -	for (i = 0; b[i] && !ret; i++) {
    -		if (b[i][0] != c && b[i][1] != c) continue;
    -		SWAP(b[i], b[0]);
    -		ret = can_make_words(b + 1, word + 1);
    -		SWAP(b[i], b[0]);
    -	}
    +   for (i = 0; b[i] && !ret; i++) {
    +      if (b[i][0] != c && b[i][1] != c) continue;
    +      SWAP(b[i], b[0]);
    +      ret = can_make_words(b + 1, word + 1);
    +      SWAP(b[i], b[0]);
    +   }
     
    -	return ret;
    +   return ret;
     }
     
     int main(void)
     {
    -	char* blocks[] = {
    -		"BO", "XK", "DQ", "CP", "NA",
    -		"GT", "RE", "TG", "QD", "FS",
    -		"JW", "HU", "VI", "AN", "OB",
    -		"ER", "FS", "LY", "PC", "ZM",
    -		0 };
    +   char* blocks[] = {
    +      "BO", "XK", "DQ", "CP", "NA",
    +      "GT", "RE", "TG", "QD", "FS",
    +      "JW", "HU", "VI", "AN", "OB",
    +      "ER", "FS", "LY", "PC", "ZM",
    +      0 };
     
    -	char *words[] = {
    -		"", "A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "Confuse", 0
    -	};
    +   char *words[] = {
    +      "", "A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "Confuse", 0
    +   };
     
    -	char **w;
    -	for (w = words; *w; w++)
    -		printf("%s\t%d\n", *w, can_make_words(blocks, *w));
    +   char **w;
    +   for (w = words; *w; w++)
    +      printf("%s\t%d\n", *w, can_make_words(blocks, *w));
     
    -	return 0;
    +   return 0;
     }
    diff --git a/Task/ABC-problem/COBOL/abc-problem.cob b/Task/ABC-problem/COBOL/abc-problem.cob
    new file mode 100644
    index 0000000000..7c1b0e20c6
    --- /dev/null
    +++ b/Task/ABC-problem/COBOL/abc-problem.cob
    @@ -0,0 +1,64 @@
    +       IDENTIFICATION DIVISION.
    +       PROGRAM-ID. ABC-PROBLEM.
    +
    +       DATA DIVISION.
    +       WORKING-STORAGE SECTION.
    +       01 INPUT-DATA.
    +          03 BLOCK-SET          PIC X(40) VALUE
    +                        'BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM'.
    +          03 WORD-DATA.
    +             05 FILLER          PIC X(7) VALUE 'A'.
    +             05 FILLER          PIC X(7) VALUE 'BARK'.
    +             05 FILLER          PIC X(7) VALUE 'BOOK'.
    +             05 FILLER          PIC X(7) VALUE 'TREAT'.
    +             05 FILLER          PIC X(7) VALUE 'COMMON'.
    +             05 FILLER          PIC X(7) VALUE 'SQUAD'.
    +             05 FILLER          PIC X(7) VALUE 'CONFUSE'.
    +          03 WORDS              PIC X(7) OCCURS 7 TIMES, INDEXED BY W,
    +                                REDEFINES WORD-DATA.
    +
    +       01 OUTPUT-LINE.
    +          03 OUT-WORD           PIC X(7).
    +          03 FILLER             PIC XX VALUE ': '.
    +          03 RESULT             PIC X(3).
    +          03 FOO                PIC 999.
    +
    +       01 VARIABLES.
    +          03 BLOCK-SET          PIC X(40).
    +          03 BLOCKS             OCCURS 20 TIMES, INDEXED BY B,
    +                                REDEFINES BLOCK-SET.
    +             05 FACE-A          PIC X.
    +             05 FACE-B          PIC X.
    +          03 WORD.
    +             05 LETTERS         PIC X OCCURS 7 TIMES, INDEXED BY L.
    +          03 FAIL-FLAG          PIC X.
    +             88 FAILED          VALUE 'X'.
    +
    +       PROCEDURE DIVISION.
    +       BEGIN.
    +           PERFORM CHECK-WORD VARYING W FROM 1 BY 1
    +           UNTIL W IS GREATER THAN 7.
    +           STOP RUN.
    +
    +       CHECK-WORD.
    +           MOVE BLOCK-SET OF INPUT-DATA TO BLOCK-SET OF VARIABLES.
    +
    +           MOVE WORDS(W) TO WORD.
    +           SET L TO 1.
    +           MOVE SPACE TO FAIL-FLAG.
    +           PERFORM CHECK-LETTER VARYING L FROM 1 BY 1
    +               UNTIL FAILED
    +               OR L IS GREATER THAN 7
    +               OR LETTERS(L) IS EQUAL TO SPACE.
    +
    +           MOVE WORDS(W) TO OUT-WORD.
    +           IF FAILED, MOVE 'NO' TO RESULT, ELSE MOVE 'YES' TO RESULT.
    +           DISPLAY OUTPUT-LINE.
    +
    +       CHECK-LETTER.
    +           SET B TO 1.
    +           SEARCH BLOCKS VARYING B
    +               AT END
    +                   MOVE 'X' TO FAIL-FLAG
    +               WHEN LETTERS(L) IS EQUAL TO FACE-A(B) OR FACE-B(B)
    +                   MOVE SPACES TO BLOCKS(B).
    diff --git a/Task/ABC-problem/Component-Pascal/abc-problem.pas b/Task/ABC-problem/Component-Pascal/abc-problem.pas
    index 1f278709b7..caa5e1d04f 100644
    --- a/Task/ABC-problem/Component-Pascal/abc-problem.pas
    +++ b/Task/ABC-problem/Component-Pascal/abc-problem.pas
    @@ -1,84 +1,84 @@
     MODULE ABCProblem;
     IMPORT
    -	StdLog, DevCommanders, TextMappers;
    +   StdLog, DevCommanders, TextMappers;
     CONST
    -	notfound = -1;
    -TYPE	
    -	String = ARRAY 3 OF CHAR;
    +   notfound = -1;
    +TYPE
    +   String = ARRAY 3 OF CHAR;
     VAR
    -	blocks : ARRAY 20 OF String;
    -	
    +   blocks : ARRAY 20 OF String;
    +
     PROCEDURE Check(s: ARRAY OF CHAR): BOOLEAN;
     VAR
    -	used: SET;
    -	i,blockIndex: INTEGER;
    -	
    -	PROCEDURE GetBlockFor(c: CHAR): INTEGER;
    -	VAR
    -		i: INTEGER;
    -	BEGIN
    -		c := CAP(c);
    -		i := 0;
    -		WHILE (i < LEN(blocks)) DO
    -			IF (c = blocks[i][0]) OR (c = blocks[i][1]) THEN
    -				IF ~(i IN used) THEN RETURN i END
    -			END;
    -			INC(i)
    -		END;
    -		RETURN notfound
    -	END GetBlockFor;
    -	
    +   used: SET;
    +   i,blockIndex: INTEGER;
    +
    +   PROCEDURE GetBlockFor(c: CHAR): INTEGER;
    +   VAR
    +      i: INTEGER;
    +   BEGIN
    +      c := CAP(c);
    +      i := 0;
    +      WHILE (i < LEN(blocks)) DO
    +         IF (c = blocks[i][0]) OR (c = blocks[i][1]) THEN
    +            IF ~(i IN used) THEN RETURN i END
    +         END;
    +         INC(i)
    +      END;
    +      RETURN notfound
    +   END GetBlockFor;
    +
     BEGIN
    -	used := {};
    -	FOR i := 0 TO LEN(s$) - 1 DO
    -		blockIndex := GetBlockFor(s[i]);
    -		IF blockIndex = notfound THEN
    -			RETURN FALSE
    -		ELSE
    -			INCL(used,blockIndex)
    -		END
    -	END;
    -	RETURN TRUE
    -END Check;	
    +   used := {};
    +   FOR i := 0 TO LEN(s$) - 1 DO
    +      blockIndex := GetBlockFor(s[i]);
    +      IF blockIndex = notfound THEN
    +         RETURN FALSE
    +      ELSE
    +         INCL(used,blockIndex)
    +      END
    +   END;
    +   RETURN TRUE
    +END Check;
     
     PROCEDURE CanMakeWord*;
     VAR
    -	s: TextMappers.Scanner;
    +   s: TextMappers.Scanner;
     BEGIN
    -	s.ConnectTo(DevCommanders.par.text);
    -	s.SetPos(DevCommanders.par.beg);
    -	s.Scan;
    -	WHILE (~s.rider.eot) DO
    -		IF (s.type = TextMappers.char) & (s.char = '~') THEN
    -			RETURN
    -		ELSIF (s.type = TextMappers.string) THEN
    -			StdLog.String(s.string);StdLog.String(":> ");
    -			StdLog.Bool(Check(s.string));StdLog.Ln
    -		END;
    -		s.Scan
    -	END
    +   s.ConnectTo(DevCommanders.par.text);
    +   s.SetPos(DevCommanders.par.beg);
    +   s.Scan;
    +   WHILE (~s.rider.eot) DO
    +      IF (s.type = TextMappers.char) & (s.char = '~') THEN
    +         RETURN
    +      ELSIF (s.type = TextMappers.string) THEN
    +         StdLog.String(s.string);StdLog.String(":> ");
    +         StdLog.Bool(Check(s.string));StdLog.Ln
    +      END;
    +      s.Scan
    +   END
     END CanMakeWord;
     
     BEGIN
    -	blocks[0] := "BO";
    -	blocks[1] := "XK";
    -	blocks[2] := "DQ";
    -	blocks[3] := "CP";
    -	blocks[4] := "NA";
    -	blocks[5] := "GT";
    -	blocks[6] := "RE";
    -	blocks[7] := "TG";
    -	blocks[8] := "QD";
    -	blocks[9] := "FS";
    -	blocks[10] := "JW";
    -	blocks[11] := "HU";
    -	blocks[12] := "VI";
    -	blocks[13] := "AN";
    -	blocks[14] := "OB";
    -	blocks[15] := "ER";
    -	blocks[16] := "FS";
    -	blocks[17] := "LY";
    -	blocks[18] := "PC";
    -	blocks[19] := "ZM";
    -	
    +   blocks[0] := "BO";
    +   blocks[1] := "XK";
    +   blocks[2] := "DQ";
    +   blocks[3] := "CP";
    +   blocks[4] := "NA";
    +   blocks[5] := "GT";
    +   blocks[6] := "RE";
    +   blocks[7] := "TG";
    +   blocks[8] := "QD";
    +   blocks[9] := "FS";
    +   blocks[10] := "JW";
    +   blocks[11] := "HU";
    +   blocks[12] := "VI";
    +   blocks[13] := "AN";
    +   blocks[14] := "OB";
    +   blocks[15] := "ER";
    +   blocks[16] := "FS";
    +   blocks[17] := "LY";
    +   blocks[18] := "PC";
    +   blocks[19] := "ZM";
    +
     END ABCProblem.
    diff --git a/Task/ABC-problem/Crystal/abc-problem.cr b/Task/ABC-problem/Crystal/abc-problem.cr
    new file mode 100644
    index 0000000000..5f3ec7d4ff
    --- /dev/null
    +++ b/Task/ABC-problem/Crystal/abc-problem.cr
    @@ -0,0 +1,17 @@
    +def can_make_word? (word, blocks, i=0)
    +  return true if word.empty?
    +  ch = word[0].upcase
    +  blocks.each_with_index do |block, idx|
    +    if ch.in? block.upcase
    +      return true if can_make_word? word[1..], blocks[...idx] + blocks[(idx+1)..], i+1
    +    end
    +  end
    +  false
    +end
    +
    +blocks = "BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM".split
    +
    +["A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "CONFUSE"].each do |word|
    +  print word, " -> ", can_make_word?(word, blocks), "\n"
    +end
    +print "abba", " -> ", can_make_word?("abba", ["AB", "AB", "AC", "AC"]), "\n"
    diff --git a/Task/ABC-problem/Delphi/abc-problem.delphi b/Task/ABC-problem/Delphi/abc-problem.pas
    similarity index 100%
    rename from Task/ABC-problem/Delphi/abc-problem.delphi
    rename to Task/ABC-problem/Delphi/abc-problem.pas
    diff --git a/Task/ABC-problem/DuckDB/abc-problem.duckdb b/Task/ABC-problem/DuckDB/abc-problem.duckdb
    new file mode 100644
    index 0000000000..0856cd977f
    --- /dev/null
    +++ b/Task/ABC-problem/DuckDB/abc-problem.duckdb
    @@ -0,0 +1,45 @@
    +CREATE OR REPLACE FUNCTION matches(block, letter) as (
    +  block[1] = letter or block[2] = letter
    +);
    +
    +# permute(lst, n, word) generates sub-permutations, perm (of length n), of the list lst,
    +# that satisfy matches(perm[i], word[i]), for i in range(1, n+1).
    +# Normally n = length(word).
    +# The caller is responsible for ensuring appropriate adjustment of typographical case.
    +CREATE OR REPLACE FUNCTION permute(lst, n, word) as table (
    +  WITH RECURSIVE permute(perm, remaining) as (
    +    -- base case
    +    SELECT
    +        []::VARCHAR[] as perm,
    +        lst::VARCHAR[] as remaining
    +    UNION ALL
    +    -- recursive case: add one element from remaining to perm and remove it from remaining
    +    SELECT
    +        (perm || [element]) AS perm,
    +        (remaining[1:i-1] || remaining[i+1:]) AS remaining
    +    FROM (select *, unnest(remaining) AS element, generate_subscripts(remaining,1) as i
    +          FROM permute)
    +    WHERE length(perm) < n
    +          and matches(element, word[1 + length(perm)])
    +  )
    +  SELECT perm
    +  FROM permute
    +  WHERE length(perm) = n
    +);
    +
    +# All solutions
    +CREATE OR REPLACE FUNCTION solve(word) as table (
    +  from permute(
    +    ['BO', 'XK', 'DQ', 'CP', 'NA', 'GT', 'RE', 'TG', 'QD', 'FS',
    +     'JW', 'HU', 'VI', 'AN', 'OB', 'ER', 'FS', 'LY', 'PC', 'ZM'],
    +    length(word), upper(word) )
    +);
    +
    +CREATE OR REPLACE FUNCTION one_solution(word) as (
    +  from solve(word)
    +  limit 1
    +);
    +
    +# Examples
    +select word, one_solution(word)
    +from (select unnest(['','A','BarK','BOOK','TREAT','COMMON','SQUAD','Confuse','abba']) as word);
    diff --git a/Task/ABC-problem/EMal/abc-problem.emal b/Task/ABC-problem/EMal/abc-problem.emal
    new file mode 100644
    index 0000000000..66f28bfaa3
    --- /dev/null
    +++ b/Task/ABC-problem/EMal/abc-problem.emal
    @@ -0,0 +1,28 @@
    +List words ← text["", "A", "Bark", "book", "TREAT", "COMMON", "SQuAd", "CONFUSE"]
    +List checks ← logic[true, true, true, false, true, false, true, true]
    +fun canMakeWord ← logic by text word
    +  if word.length æ 0 do return true end
    +  List wblocks ← text[
    +    "BO", "XK", "DQ", "CP", "NA",
    +    "GT", "RE", "TG", "QD", "FS",
    +    "JW", "HU", "VI", "AN", "OB",
    +    "ER", "FS", "LY", "PC", "ZM"]
    +  for each text ch in word.upper().split()
    +    logic found ← false
    +    for each text wblock in wblocks
    +      if wblock.find(ch) ≥ 0
    +        wblocks[wblockIndex] ← Text.EMPTY
    +        found ← true
    +        break
    +      end
    +    end
    +    if not found do return false end
    +  end
    +  return true
    +end
    +writeLine("word".padEnd(11, " "), "|", "canMakeWord", "|", "isCorrect")
    +for each text word in words
    +  writeLine(word.padEnd(11, " "), "|",
    +    (text!canMakeWord(word)).padEnd(11, " "), "|",
    +   (canMakeWord(word) æ checks[wordIndex]))
    +end
    diff --git a/Task/ABC-problem/EasyLang/abc-problem.easy b/Task/ABC-problem/EasyLang/abc-problem.easy
    index 4f51ed99d3..3ce60e223b 100644
    --- a/Task/ABC-problem/EasyLang/abc-problem.easy
    +++ b/Task/ABC-problem/EasyLang/abc-problem.easy
    @@ -2,7 +2,7 @@ b$[][] = [ [ "B" "O" ] [ "X" "K" ] [ "D" "Q" ] [ "C" "P" ] [ "N" "A" ] [ "G" "T"
     len b[] len b$[][]
     global w$[] cnt .
     #
    -proc backtr wi . .
    +proc backtr wi .
        if wi > len w$[]
           cnt += 1
           return
    diff --git a/Task/ABC-problem/EchoLisp/abc-problem.l b/Task/ABC-problem/EchoLisp/abc-problem.l
    index 20f3578009..1eca19b9fd 100644
    --- a/Task/ABC-problem/EchoLisp/abc-problem.l
    +++ b/Task/ABC-problem/EchoLisp/abc-problem.l
    @@ -1,16 +1,15 @@
     (lib 'list) ;; list-delete
     
     (define BLOCKS '("BO" "XK" "DQ" "CP" "NA" "GT" "RE" "TG" "QD" "FS"
    -	     "JW" "HU" "VI" "AN" "OB" "ER" "FS" "LY" "PC" "ZM" ))
    -	
    +        "JW" "HU" "VI" "AN" "OB" "ER" "FS" "LY" "PC" "ZM" ))
    +
     (define WORDS '("A" "BARK" "BOOK" "TREAT" "COMMON" "SQUAD" "CONFUSE"))
    -	
    +
     (define (spell word blocks)
         (cond
    -	((string-empty? word) #t)
    -	((empty? blocks) #f)
    -	(else
    -	(for/or [(block blocks)]
    -		#:continue (not (string-match block (string-first word)))
    -		(spell (string-rest word) (list-delete blocks block))))))
    -				
    +   ((string-empty? word) #t)
    +   ((empty? blocks) #f)
    +   (else
    +   (for/or [(block blocks)]
    +      #:continue (not (string-match block (string-first word)))
    +      (spell (string-rest word) (list-delete blocks block))))))
    diff --git a/Task/ABC-problem/Elena/abc-problem.elena b/Task/ABC-problem/Elena/abc-problem.elena
    index 0428eced88..4b068c9957 100644
    --- a/Task/ABC-problem/Elena/abc-problem.elena
    +++ b/Task/ABC-problem/Elena/abc-problem.elena
    @@ -10,7 +10,7 @@ extension op
         {
             var list := ArrayList.load(blocks);
     
    -        ^ nil == (cast string(self)).toUpper().seekEach:(ch)
    +        ^ nil == (cast string(self)).toUpper().seekEach::(ch)
             {
                 var index := list.indexOfElement
                     ((word => word.indexOf(0, ch) != -1).asComparator());
    @@ -27,20 +27,20 @@ extension op
         }
     }
     
    -public program()
    +public Program()
     {
    -    var blocks := new string[]{"BO", "XK", "DQ", "CP", "NA",
    -		"GT", "RE", "TG", "QD", "FS",
    -		"JW", "HU", "VI", "AN", "OB",
    -		"ER", "FS", "LY", "PC", "ZM"};
    +    auto blocks := new const string[]{"BO", "XK", "DQ", "CP", "NA",
    +      "GT", "RE", "TG", "QD", "FS",
    +      "JW", "HU", "VI", "AN", "OB",
    +      "ER", "FS", "LY", "PC", "ZM"};
     
    -    var words := new string[]{"", "A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "Confuse"};
    +    auto words := new const string[]{"", "A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "Confuse"};
     
         Enumerator e := words.enumerator();
         e.next();
     
    -    words.forEach:(word)
    +    words.forEach::(word)
         {
    -        console.printLine("can make '",word,"' : ",word.canMakeWordFrom(blocks));
    +        Console.printLine("can make '",word,"' : ",word.canMakeWordFrom(blocks));
         }
     }
    diff --git a/Task/ABC-problem/Elixir/abc-problem.elixir b/Task/ABC-problem/Elixir/abc-problem.ex
    similarity index 100%
    rename from Task/ABC-problem/Elixir/abc-problem.elixir
    rename to Task/ABC-problem/Elixir/abc-problem.ex
    diff --git a/Task/ABC-problem/Euphoria/abc-problem.eu b/Task/ABC-problem/Euphoria/abc-problem.eu
    new file mode 100644
    index 0000000000..be5498a568
    --- /dev/null
    +++ b/Task/ABC-problem/Euphoria/abc-problem.eu
    @@ -0,0 +1,35 @@
    +include std/text.e
    +
    +sequence blocks = {{'B','O'},{'X','K'},{'D','Q'},{'C','P'},{'N','A'},
    +                   {'G','T'},{'R','E'},{'T','G'},{'Q','D'},{'F','S'},
    +                   {'J','W'},{'H','U'},{'V','I'},{'A','N'},{'O','B'},
    +                   {'E','R'},{'F','S'},{'L','Y'},{'P','C'},{'Z','M'}}
    +sequence words = {"A","BarK","BOOK","TrEaT","COMMON","SQUAD","CONFUSE"}
    +
    +sequence current_word
    +sequence temp
    +integer matches
    +
    +for i = 1 to length(words) do
    +   current_word = upper(words[i])
    +   temp = blocks
    +   matches = 0
    +   for j = 1 to length(current_word) do
    +      for k = 1 to length(temp) do
    +         if find(current_word[j],temp[k]) then
    +            temp = remove(temp,k)
    +            matches += 1
    +            exit
    +         end if
    +      end for
    +      if length(current_word) = matches then
    +         printf(1,"%s: TRUE\n",{words[i]})
    +         exit
    +      end if
    +   end for
    +   if length(current_word) != matches then
    +      printf(1,"%s: FALSE\n",{words[i]})
    +   end if
    +end for
    +
    +if getc(0) then end if
    diff --git a/Task/ABC-problem/Euphoria/abc-problem.euphoria b/Task/ABC-problem/Euphoria/abc-problem.euphoria
    deleted file mode 100644
    index efa3352600..0000000000
    --- a/Task/ABC-problem/Euphoria/abc-problem.euphoria
    +++ /dev/null
    @@ -1,35 +0,0 @@
    -include std/text.e
    -
    -sequence blocks = {{'B','O'},{'X','K'},{'D','Q'},{'C','P'},{'N','A'},
    -                   {'G','T'},{'R','E'},{'T','G'},{'Q','D'},{'F','S'},
    -                   {'J','W'},{'H','U'},{'V','I'},{'A','N'},{'O','B'},
    -                   {'E','R'},{'F','S'},{'L','Y'},{'P','C'},{'Z','M'}}
    -sequence words = {"A","BarK","BOOK","TrEaT","COMMON","SQUAD","CONFUSE"}
    -
    -sequence current_word
    -sequence temp
    -integer matches
    -
    -for i = 1 to length(words) do
    -	current_word = upper(words[i])
    -	temp = blocks
    -	matches = 0
    -	for j = 1 to length(current_word) do
    -		for k = 1 to length(temp) do
    -			if find(current_word[j],temp[k]) then
    -				temp = remove(temp,k)
    -				matches += 1
    -				exit
    -			end if
    -		end for
    -		if length(current_word) = matches then
    -			printf(1,"%s: TRUE\n",{words[i]})
    -			exit
    -		end if
    -	end for
    -	if length(current_word) != matches then
    -		printf(1,"%s: FALSE\n",{words[i]})
    -	end if
    -end for
    -
    -if getc(0) then end if
    diff --git a/Task/ABC-problem/FBSL/abc-problem.fbsl b/Task/ABC-problem/FBSL/abc-problem.fbsl
    index 9c34a6ea72..1ef125fe0f 100644
    --- a/Task/ABC-problem/FBSL/abc-problem.fbsl
    +++ b/Task/ABC-problem/FBSL/abc-problem.fbsl
    @@ -1,44 +1,44 @@
     #APPTYPE CONSOLE
     SUB MAIN()
    -	BlockCheck("A")
    -	BlockCheck("BARK")
    -	BlockCheck("BooK")
    -	BlockCheck("TrEaT")
    -	BlockCheck("comMON")
    -	BlockCheck("sQuAd")
    -	BlockCheck("Confuse")
    -	pause
    +   BlockCheck("A")
    +   BlockCheck("BARK")
    +   BlockCheck("BooK")
    +   BlockCheck("TrEaT")
    +   BlockCheck("comMON")
    +   BlockCheck("sQuAd")
    +   BlockCheck("Confuse")
    +   pause
     END SUB
     
     FUNCTION BlockCheck(str)
    -	print str " " iif( Blockable( str ), "can", "cannot" ) " be spelled with blocks."
    +   print str " " iif( Blockable( str ), "can", "cannot" ) " be spelled with blocks."
     END FUNCTION
     
     FUNCTION Blockable(str AS STRING)
    -	DIM blocks AS STRING = "BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM"
    -	DIM C AS STRING = ""
    -	DIM POS AS INTEGER = 0
    -	
    -	FOR DIM I = 1 TO LEN(str)
    -		C = str{i}
    -		POS = INSTR(BLOCKS, C, 0, 1) 'case insensitive
    -		IF POS > 0 THEN
    -			'if the pos is odd, it's the first of the pair
    -			IF POS MOD 2 = 1 THEN
    -				'so clear the first and the second
    -				poke(@blocks + pos - 1," ")
    -				poke(@blocks + pos," ")
    -			'otherwise, it's the last of the pair	
    -			ELSE
    -				'clear the second and the first
    -				poke(@blocks + pos - 1," ")
    -				poke(@blocks + pos - 2," ")
    -			END IF
    -		ELSE
    -		'not found, so can't be spelled
    -		RETURN FALSE
    -		END IF
    -	NEXT
    -	'got thru to here, so can be spelled
    -	RETURN TRUE
    +   DIM blocks AS STRING = "BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM"
    +   DIM C AS STRING = ""
    +   DIM POS AS INTEGER = 0
    +
    +   FOR DIM I = 1 TO LEN(str)
    +      C = str{i}
    +      POS = INSTR(BLOCKS, C, 0, 1) 'case insensitive
    +      IF POS > 0 THEN
    +         'if the pos is odd, it's the first of the pair
    +         IF POS MOD 2 = 1 THEN
    +            'so clear the first and the second
    +            poke(@blocks + pos - 1," ")
    +            poke(@blocks + pos," ")
    +         'otherwise, it's the last of the pair
    +         ELSE
    +            'clear the second and the first
    +            poke(@blocks + pos - 1," ")
    +            poke(@blocks + pos - 2," ")
    +         END IF
    +      ELSE
    +      'not found, so can't be spelled
    +      RETURN FALSE
    +      END IF
    +   NEXT
    +   'got thru to here, so can be spelled
    +   RETURN TRUE
     END FUNCTION
    diff --git a/Task/ABC-problem/Fortran/abc-problem-2.f b/Task/ABC-problem/Fortran/abc-problem-2.f
    index 0c0d917d24..186802c418 100644
    --- a/Task/ABC-problem/Fortran/abc-problem-2.f
    +++ b/Task/ABC-problem/Fortran/abc-problem-2.f
    @@ -1,264 +1,264 @@
    -      MODULE PLAYPEN	!Messes with a set of alphabet blocks.
    -       INTEGER MSG		!Output unit number.
    -       PARAMETER (MSG = 6)	!Standard output.
    -       INTEGER MS		!I dislike unidentified constants...
    -       PARAMETER (MS = 2)	!So this is the maximum number of lettered sides.
    -       INTEGER LETTER(26),SUPPLY(26)	!For counting the alphabet.
    +      MODULE PLAYPEN !Messes with a set of alphabet blocks.
    +       INTEGER MSG      !Output unit number.
    +       PARAMETER (MSG = 6) !Standard output.
    +       INTEGER MS    !I dislike unidentified constants...
    +       PARAMETER (MS = 2)  !So this is the maximum number of lettered sides.
    +       INTEGER LETTER(26),SUPPLY(26)   !For counting the alphabet.
            CONTAINS
    -        SUBROUTINE SWAP(I,J)	!This really should be known to the compiler.
    -         INTEGER I,J,K		!Which could generate in-place code,
    -          K = I			!Using registers, maybe.
    -          I = J			!Or maybe, there are special op-codes.
    -          J = K			!Rather than this clunkiness.
    -        END SUBROUTINE SWAP	!And it should be for any type of thingy.
    +        SUBROUTINE SWAP(I,J)  !This really should be known to the compiler.
    +         INTEGER I,J,K     !Which could generate in-place code,
    +          K = I         !Using registers, maybe.
    +          I = J         !Or maybe, there are special op-codes.
    +          J = K         !Rather than this clunkiness.
    +        END SUBROUTINE SWAP   !And it should be for any type of thingy.
     
             INTEGER FUNCTION LSTNB(TEXT)  !Sigh. Last Not Blank.
     Concocted yet again by R.N.McLean (whom God preserve) December MM.
     Code checking reveals that the Compaq compiler generates a copy of the string and then finds the length of that when using the latter-day intrinsic LEN_TRIM. Madness!
    -Can't   DO WHILE (L.GT.0 .AND. TEXT(L:L).LE.' ')	!Control chars. regarded as spaces.
    +Can't   DO WHILE (L.GT.0 .AND. TEXT(L:L).LE.' ')   !Control chars. regarded as spaces.
     Curse the morons who think it good that the compiler MIGHT evaluate logical expressions fully.
     Crude GO TO rather than a DO-loop, because compilers use a loop counter as well as updating the index variable.
     Comparison runs of GNASH showed a saving of ~3% in its mass-data reading through the avoidance of DO in LSTNB alone.
     Crappy code for character comparison of varying lengths is avoided by using ICHAR which is for single characters only.
     Checking the indexing of CHARACTER variables for bounds evoked astounding stupidities, such as calculating the length of TEXT(L:L) by subtracting L from L!
     Comparison runs of GNASH showed a saving of ~25-30% in its mass data scanning for this, involving all its two-dozen or so single-character comparisons, not just in LSTNB.
    -         CHARACTER*(*),INTENT(IN):: TEXT	!The bumf. If there must be copy-in, at least there need not be copy back.
    -         INTEGER L		!The length of the bumf.
    -          L = LEN(TEXT)		!So, what is it?
    -    1     IF (L.LE.0) GO TO 2	!Are we there yet?
    -          IF (ICHAR(TEXT(L:L)).GT.ICHAR(" ")) GO TO 2	!Control chars are regarded as spaces also.
    -          L = L - 1		!Step back one.
    -          GO TO 1		!And try again.
    -    2     LSTNB = L		!The last non-blank, possibly zero.
    -         RETURN			!Unsafe to use LSTNB as a variable.
    -        END FUNCTION LSTNB	!Compilers can bungle it.
    +         CHARACTER*(*),INTENT(IN):: TEXT  !The bumf. If there must be copy-in, at least there need not be copy back.
    +         INTEGER L      !The length of the bumf.
    +          L = LEN(TEXT)    !So, what is it?
    +    1     IF (L.LE.0) GO TO 2 !Are we there yet?
    +          IF (ICHAR(TEXT(L:L)).GT.ICHAR(" ")) GO TO 2 !Control chars are regarded as spaces also.
    +          L = L - 1     !Step back one.
    +          GO TO 1    !And try again.
    +    2     LSTNB = L     !The last non-blank, possibly zero.
    +         RETURN         !Unsafe to use LSTNB as a variable.
    +        END FUNCTION LSTNB !Compilers can bungle it.
     
    -        SUBROUTINE LETTERCOUNT(TEXT)	!Count the occurrences of A-Z.
    -         CHARACTER*(*) TEXT	!The text to inspect.
    -         INTEGER I,K		!Assistants.
    -          DO I = 1,LEN(TEXT)		!Step through the text.
    -            K = ICHAR(TEXT(I:I)) - ICHAR("A") + 1	!This presumes that A-Z have contiguous codes!
    -            IF (K.GE.1 .AND. K.LE.26) LETTER(K) = LETTER(K) + 1	!Not so with EBCDIC!!
    -          END DO			!On to the next letter.
    -        END SUBROUTINE LETTERCOUNT	!Be careful with LETTER.
    +        SUBROUTINE LETTERCOUNT(TEXT)   !Count the occurrences of A-Z.
    +         CHARACTER*(*) TEXT   !The text to inspect.
    +         INTEGER I,K    !Assistants.
    +          DO I = 1,LEN(TEXT)     !Step through the text.
    +            K = ICHAR(TEXT(I:I)) - ICHAR("A") + 1  !This presumes that A-Z have contiguous codes!
    +            IF (K.GE.1 .AND. K.LE.26) LETTER(K) = LETTER(K) + 1   !Not so with EBCDIC!!
    +          END DO        !On to the next letter.
    +        END SUBROUTINE LETTERCOUNT  !Be careful with LETTER.
     
    -        SUBROUTINE UPCASE(TEXT)	!In the absence of an intrinsic...
    +        SUBROUTINE UPCASE(TEXT)  !In the absence of an intrinsic...
     Converts any lower case letters in TEXT to upper case...
     Concocted yet again by R.N.McLean (whom God preserve) December MM.
     Converting from a DO loop evades having both an iteration counter to decrement and an index variable to adjust.
    -         CHARACTER*(*) TEXT	!The stuff to be modified.
    -c        CHARACTER*26 LOWER,UPPER	!Tables. a-z may not be contiguous codes.
    +         CHARACTER*(*) TEXT   !The stuff to be modified.
    +c        CHARACTER*26 LOWER,UPPER   !Tables. a-z may not be contiguous codes.
     c        PARAMETER (LOWER = "abcdefghijklmnopqrstuvwxyz")
     c        PARAMETER (UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
     CAREFUL!! The below relies on a-z and A-Z being contiguous, as is NOT the case with EBCDIC.
    -         INTEGER I,L,IT		!Fingers.
    -          L = LEN(TEXT)		!Get a local value, in case LEN engages in oddities.
    -          I = L			!Start at the end and work back..
    -    1     IF (I.LE.0) RETURN 	!Are we there yet? Comparison against zero should not require a subtraction.
    -c         IT = INDEX(LOWER,TEXT(I:I))	!Well?
    -c         IF (IT .GT. 0) TEXT(I:I) = UPPER(IT:IT)	!One to convert?
    -          IT = ICHAR(TEXT(I:I)) - ICHAR("a")		!More symbols precede "a" than "A".
    -          IF (IT.GE.0 .AND. IT.LE.25) TEXT(I:I) = CHAR(IT + ICHAR("A"))	!In a-z? Convert!
    -          I = I - 1			!Back one.
    -          GO TO 1			!Inspect..
    -        END SUBROUTINE UPCASE	!Easy.
    +         INTEGER I,L,IT    !Fingers.
    +          L = LEN(TEXT)    !Get a local value, in case LEN engages in oddities.
    +          I = L         !Start at the end and work back..
    +    1     IF (I.LE.0) RETURN  !Are we there yet? Comparison against zero should not require a subtraction.
    +c         IT = INDEX(LOWER,TEXT(I:I))  !Well?
    +c         IF (IT .GT. 0) TEXT(I:I) = UPPER(IT:IT)  !One to convert?
    +          IT = ICHAR(TEXT(I:I)) - ICHAR("a")    !More symbols precede "a" than "A".
    +          IF (IT.GE.0 .AND. IT.LE.25) TEXT(I:I) = CHAR(IT + ICHAR("A")) !In a-z? Convert!
    +          I = I - 1        !Back one.
    +          GO TO 1       !Inspect..
    +        END SUBROUTINE UPCASE !Easy.
     
    -        SUBROUTINE ORDERSIDE(LETTER)	!Puts the letters into order.
    -         CHARACTER*(*) LETTER	!The letters.
    -         INTEGER I,N,H		!Assistants.
    -         CHARACTER*1 T		!A scratchpad.
    -         LOGICAL CURSE		!A bit.
    -          N = LEN(LETTER)	!So, how many letters?
    -          H = N - 1		!Last - First, and not +1.
    -          IF (H.LE.0) RETURN	!Ha ha.
    -    1     H = MAX(1,H*10/13)		!The special feature.
    -          IF (H.EQ.9 .OR. H.EQ.10) H = 11	!A twiddle.
    -          CURSE = .FALSE.		!So far, so good.
    -          DO I = N - H,1,-1		!If H = 1, this is a BubbleSort.
    -            IF (LETTER(I:I).LT.LETTER(I + H:I + H)) THEN	!One compare.
    -              T = LETTER(I:I)			!One swap.
    -              LETTER(I:I) = LETTER(I + H:I + H)	!Alas, no SWAP(A,B)
    -              LETTER(I + H:I + H) = T		!Is recognised by the compiler.
    -              CURSE = .TRUE.		!If once a tiger is seen...
    -            END IF			!So much for that comparison.
    -          END DO			!On to the next.
    +        SUBROUTINE ORDERSIDE(LETTER)   !Puts the letters into order.
    +         CHARACTER*(*) LETTER !The letters.
    +         INTEGER I,N,H     !Assistants.
    +         CHARACTER*1 T     !A scratchpad.
    +         LOGICAL CURSE     !A bit.
    +          N = LEN(LETTER)  !So, how many letters?
    +          H = N - 1     !Last - First, and not +1.
    +          IF (H.LE.0) RETURN  !Ha ha.
    +    1     H = MAX(1,H*10/13)     !The special feature.
    +          IF (H.EQ.9 .OR. H.EQ.10) H = 11 !A twiddle.
    +          CURSE = .FALSE.     !So far, so good.
    +          DO I = N - H,1,-1      !If H = 1, this is a BubbleSort.
    +            IF (LETTER(I:I).LT.LETTER(I + H:I + H)) THEN !One compare.
    +              T = LETTER(I:I)       !One swap.
    +              LETTER(I:I) = LETTER(I + H:I + H) !Alas, no SWAP(A,B)
    +              LETTER(I + H:I + H) = T     !Is recognised by the compiler.
    +              CURSE = .TRUE.     !If once a tiger is seen...
    +            END IF         !So much for that comparison.
    +          END DO        !On to the next.
               IF (CURSE .OR. H.GT.1) GO TO 1!Another pass?
    -        END SUBROUTINE ORDERSIDE	!Simple enough.
    -        SUBROUTINE ORDERBLOCKS(N,SOME)	!Puts the collection of blocks into order.
    -         INTEGER N		!The number of blocks.
    -         CHARACTER*(*) SOME(:)	!Their lists of letters.
    -         INTEGER I,H		!Assistants.
    -         CHARACTER*(LEN(SOME(1))) T	!A scratchpad matching an element of SOME.
    -         LOGICAL CURSE			!Since there is still no SWAP(SOME(I),SOME(I + H)).
    -          H = N - 1		!So here comes another CombSort.
    -          IF (H.LE.0) RETURN	!With standard suspicion.
    -    1     H = MAX(1,H*10/13)		!This is the outer loop.
    -          IF (H.EQ.9 .OR. H.EQ.10) H = 11	!This is a fiddle.
    -          CURSE = .FALSE.		!Start the next pass in hope.
    -          DO I = N - H,1,-1		!Going backwards, just for fun.
    -            IF (SOME(I).LT.SOME(I + H)) THEN	!So then?
    -              T = SOME(I)		!Disorder.
    -              SOME(I) = SOME(I + H)	!So once again,
    -              SOME(I + H) = T		!Swap the two miscreants.
    -              CURSE = .TRUE.		!And remember.
    -            END IF			!So much for that comparison.
    -          END DO			!On to the next.
    +        END SUBROUTINE ORDERSIDE !Simple enough.
    +        SUBROUTINE ORDERBLOCKS(N,SOME) !Puts the collection of blocks into order.
    +         INTEGER N      !The number of blocks.
    +         CHARACTER*(*) SOME(:)   !Their lists of letters.
    +         INTEGER I,H    !Assistants.
    +         CHARACTER*(LEN(SOME(1))) T !A scratchpad matching an element of SOME.
    +         LOGICAL CURSE        !Since there is still no SWAP(SOME(I),SOME(I + H)).
    +          H = N - 1     !So here comes another CombSort.
    +          IF (H.LE.0) RETURN  !With standard suspicion.
    +    1     H = MAX(1,H*10/13)     !This is the outer loop.
    +          IF (H.EQ.9 .OR. H.EQ.10) H = 11 !This is a fiddle.
    +          CURSE = .FALSE.     !Start the next pass in hope.
    +          DO I = N - H,1,-1      !Going backwards, just for fun.
    +            IF (SOME(I).LT.SOME(I + H)) THEN !So then?
    +              T = SOME(I)     !Disorder.
    +              SOME(I) = SOME(I + H) !So once again,
    +              SOME(I + H) = T    !Swap the two miscreants.
    +              CURSE = .TRUE.     !And remember.
    +            END IF         !So much for that comparison.
    +          END DO        !On to the next.
               IF (CURSE .OR. H.GT.1) GO TO 1!Are we there yet?
    -        END SUBROUTINE ORDERBLOCKS	!Not much code, but ringing the changes is still tedious.
    +        END SUBROUTINE ORDERBLOCKS  !Not much code, but ringing the changes is still tedious.
     
    -        SUBROUTINE PLAY(N,SOME)	!Mess about with the collection of blocks.
    -         INTEGER N		!Their number.
    -         CHARACTER*(*) SOME(:)	!Their letters.
    -         INTEGER NH,HIT(N)	!A list of blocks.
    -         INTEGER B,I,J,K,L,M	!Assistants.
    -         CHARACTER*1 C		!A letter of the moment.
    -          L = LEN(SOME(1))	!The maximum number of letters to any block.
    +        SUBROUTINE PLAY(N,SOME)  !Mess about with the collection of blocks.
    +         INTEGER N      !Their number.
    +         CHARACTER*(*) SOME(:)   !Their letters.
    +         INTEGER NH,HIT(N) !A list of blocks.
    +         INTEGER B,I,J,K,L,M  !Assistants.
    +         CHARACTER*1 C     !A letter of the moment.
    +          L = LEN(SOME(1)) !The maximum number of letters to any block.
     Cast the collection on to the floor.
    -          WRITE (MSG,1) N,L,SOME	!Announce the set as it is supplied.
    +          WRITE (MSG,1) N,L,SOME !Announce the set as it is supplied.
         1     FORMAT (I7," blocks, with at most",I2," letters:",66(1X,A))
     Change the "orientation" of some blocks.
    -          DO B = 1,N		!Step through each block.
    -            CALL UPCASE(SOME(B))	!Paranoia rules.
    -            CALL ORDERSIDE(SOME(B))	!Put its letter list into order.
    -          END DO		!On to the next block.
    -          WRITE (MSG,2) SOME	!Reveal the orderly array.
    +          DO B = 1,N    !Step through each block.
    +            CALL UPCASE(SOME(B)) !Paranoia rules.
    +            CALL ORDERSIDE(SOME(B)) !Put its letter list into order.
    +          END DO     !On to the next block.
    +          WRITE (MSG,2) SOME  !Reveal the orderly array.
         2     FORMAT (6X,"... the letters in reverse order:",66(1X,A))
     Collate the collection of blocks.
    -          CALL ORDERBLOCKS(N,SOME)	!Now order the blocks by their letters.
    -          WRITE (MSG,3) SOME		!Reveal them in neato order.
    +          CALL ORDERBLOCKS(N,SOME)  !Now order the blocks by their letters.
    +          WRITE (MSG,3) SOME     !Reveal them in neato order.
         3     FORMAT (7X,"... the blocks in reverse order:",66(1X,A))
     Count the appearances of the letters of the alphabet.
    -          LETTER = 0		!Enough of shuffling blocks around.
    -          DO B = 1,N		!Now inspect their collective letters.
    -            CALL LETTERCOUNT(SOME(B))	!A block's worth at a go.
    -          END DO		!On to the next block.
    -          SUPPLY = LETTER	!Save the counts of supplied letters.
    -          WRITE (MSG,4) (CHAR(ICHAR("A") + I - 1),I = 1,26),SUPPLY	!Results.
    -    4     FORMAT (15X,"Letters of the alphabet:",26A,/,	!First, a line with A ... Z.
    -     1     11X,"... number thereof supplied:",26I)	!Then a line of the associated counts.
    +          LETTER = 0    !Enough of shuffling blocks around.
    +          DO B = 1,N    !Now inspect their collective letters.
    +            CALL LETTERCOUNT(SOME(B))  !A block's worth at a go.
    +          END DO     !On to the next block.
    +          SUPPLY = LETTER  !Save the counts of supplied letters.
    +          WRITE (MSG,4) (CHAR(ICHAR("A") + I - 1),I = 1,26),SUPPLY   !Results.
    +    4     FORMAT (15X,"Letters of the alphabet:",26A,/,   !First, a line with A ... Z.
    +     1     11X,"... number thereof supplied:",26I)  !Then a line of the associated counts.
     Check for blocks with duplicated letters.
    -          WRITE (MSG,5)		!Announce.
    -    5     FORMAT (8X,"Blocks with duplicated letters:",$)	!Further output impends.
    -          M = 0			!No duplication found.
    -          DO B = 1,N		!So step through each block.
    -         JJ:DO J = 2,L			!Inspecting successive letters of the block,
    -              IF (SOME(B)(J:J).LE." ") EXIT JJ	!Provided they've not run out.
    -              DO K = 1,J - 1			!To see if it has appeared earlier.
    +          WRITE (MSG,5)    !Announce.
    +    5     FORMAT (8X,"Blocks with duplicated letters:",$)   !Further output impends.
    +          M = 0         !No duplication found.
    +          DO B = 1,N    !So step through each block.
    +         JJ:DO J = 2,L        !Inspecting successive letters of the block,
    +              IF (SOME(B)(J:J).LE." ") EXIT JJ  !Provided they've not run out.
    +              DO K = 1,J - 1        !To see if it has appeared earlier.
                     IF (SOME(B)(K:K).LE." ") EXIT JJ!Reverse order means that spaces will be at the end!
    -                IF (SOME(B)(J:J).EQ.SOME(B)(K:K)) THEN	!Well?
    -                  M = M + 1		!A match!
    -                  WRITE (MSG,6) SOME(B)	!Name the block.
    -    6             FORMAT (1X,A,$)	!With further output still impending,
    -                  EXIT JJ		!And give up on this block.
    -                END IF			!One duplicated letter is sufficient for its downfall.
    -              END DO			!Next letter up.
    -            END DO JJ			!On to the next letter of the block.
    -          END DO		!On to the next block.
    -          CALL HIC(M)		!Show the count and end the line.
    +                IF (SOME(B)(J:J).EQ.SOME(B)(K:K)) THEN   !Well?
    +                  M = M + 1      !A match!
    +                  WRITE (MSG,6) SOME(B)   !Name the block.
    +    6             FORMAT (1X,A,$)   !With further output still impending,
    +                  EXIT JJ     !And give up on this block.
    +                END IF        !One duplicated letter is sufficient for its downfall.
    +              END DO       !Next letter up.
    +            END DO JJ         !On to the next letter of the block.
    +          END DO     !On to the next block.
    +          CALL HIC(M)      !Show the count and end the line.
     Check for duplicate blocks, knowing that the array of blocks is ordered.
    -          WRITE (MSG,7)		!Announce.
    -    7     FORMAT (21X,"Duplicated blocks:",$)	!Again, leave the line dangling.
    -          K = 0			!No duplication found.
    -          B = 1			!Syncopation.
    -   70     B = B + 1		!Advance one.
    -          IF (B.GT.N) GO TO 72	!Are we there yet?
    -          IF (SOME(B).NE.SOME(B - 1)) GO TO 70	!No match? Search on.
    -          K = K + 1		!A match is counted.
    -          WRITE (MSG,6) SOME(B)	!Name it.
    -   71     B = B + 1		!And speed through continued matching.
    -          IF (B.GT.N) GO TO 72	!Unless we're of the end.
    -          IF (SOME(B).EQ.SOME(B - 1)) GO TO 71	!Continued matching?
    -          GO TO 70		!Mismatch: resume the normal scan.
    -   72     CALL HIC(K)		!So much for that.
    +          WRITE (MSG,7)    !Announce.
    +    7     FORMAT (21X,"Duplicated blocks:",$)   !Again, leave the line dangling.
    +          K = 0         !No duplication found.
    +          B = 1         !Syncopation.
    +   70     B = B + 1     !Advance one.
    +          IF (B.GT.N) GO TO 72   !Are we there yet?
    +          IF (SOME(B).NE.SOME(B - 1)) GO TO 70  !No match? Search on.
    +          K = K + 1     !A match is counted.
    +          WRITE (MSG,6) SOME(B)  !Name it.
    +   71     B = B + 1     !And speed through continued matching.
    +          IF (B.GT.N) GO TO 72   !Unless we're of the end.
    +          IF (SOME(B).EQ.SOME(B - 1)) GO TO 71  !Continued matching?
    +          GO TO 70      !Mismatch: resume the normal scan.
    +   72     CALL HIC(K)      !So much for that.
     Check for duplicated letters across different blocks.
    -          IF (ALL(SUPPLY.LE.1)) RETURN	!Unless there are no duplicated letters.
    -          WRITE (MSG,8)		!Announce.
    -    8     FORMAT ("Duplicated letters on different blocks:",$)	!More to come.
    -          K = 0		!Start another count.
    -          DO I = 1,26		!A well-known span.
    -            IF (SUPPLY(I).LE.1) CYCLE	!Any duplicated letters?
    +          IF (ALL(SUPPLY.LE.1)) RETURN !Unless there are no duplicated letters.
    +          WRITE (MSG,8)    !Announce.
    +    8     FORMAT ("Duplicated letters on different blocks:",$) !More to come.
    +          K = 0      !Start another count.
    +          DO I = 1,26      !A well-known span.
    +            IF (SUPPLY(I).LE.1) CYCLE  !Any duplicated letters?
                 C = CHAR(ICHAR("A") + I - 1)!Yes. This is the character.
    -            NH = 0		!So, how many blocks contribute?
    -            DO B = 1,N		!Find out.
    -              IF (INDEX(SOME(B),C).GT.0) THEN	!On this block?
    -                NH = NH + 1		!Yes.
    -                HIT(NH) = B		!Keep track of which.
    -              END IF			!So much for that block.
    -            END DO		!On to the next.
    -            IF (ANY(SOME(HIT(2:NH)) .NE. SOME(HIT(1)))) THEN	!All have the same collection of letters?
    -              K = K + 1			!No!
    -              WRITE (MSG,9) C		!Name the heterogenously supported letter.
    -    9         FORMAT (A,$)	!Use the same spacing even though one character only.
    -            END IF		!So much for that letter's search.
    -          END DO		!On to the next letter.
    -          CALL HIC(K)	!Finish the line with the count report.
    -         CONTAINS	!This is used often enough.
    -          SUBROUTINE HIC(N)	!But has very specific context.
    -           INTEGER N			!The count.
    -            IF (N.LE.0) WRITE (MSG,*) "None."	!Yes, we have no bananas.
    -            IF (N.GT.0) WRITE (MSG,*) N		!Either way, end the line.
    -          END SUBROUTINE HIC	!This service routine is not needed elsewhere.
    -        END SUBROUTINE PLAY	!Look mummy! All the blockses are neatened!
    +            NH = 0      !So, how many blocks contribute?
    +            DO B = 1,N     !Find out.
    +              IF (INDEX(SOME(B),C).GT.0) THEN   !On this block?
    +                NH = NH + 1      !Yes.
    +                HIT(NH) = B      !Keep track of which.
    +              END IF       !So much for that block.
    +            END DO      !On to the next.
    +            IF (ANY(SOME(HIT(2:NH)) .NE. SOME(HIT(1)))) THEN   !All have the same collection of letters?
    +              K = K + 1       !No!
    +              WRITE (MSG,9) C    !Name the heterogenously supported letter.
    +    9         FORMAT (A,$)  !Use the same spacing even though one character only.
    +            END IF      !So much for that letter's search.
    +          END DO     !On to the next letter.
    +          CALL HIC(K)   !Finish the line with the count report.
    +         CONTAINS !This is used often enough.
    +          SUBROUTINE HIC(N)   !But has very specific context.
    +           INTEGER N       !The count.
    +            IF (N.LE.0) WRITE (MSG,*) "None."   !Yes, we have no bananas.
    +            IF (N.GT.0) WRITE (MSG,*) N      !Either way, end the line.
    +          END SUBROUTINE HIC  !This service routine is not needed elsewhere.
    +        END SUBROUTINE PLAY   !Look mummy! All the blockses are neatened!
     
    -        LOGICAL FUNCTION CANBLOCK(WORD,N,SOME)	!Can the blocks spell out the word?
    +        LOGICAL FUNCTION CANBLOCK(WORD,N,SOME)  !Can the blocks spell out the word?
     Creates a move tree based on the letters of WORD and for each, the blocks available.
    -         CHARACTER*(*) WORD	!The word to spell out.
    -         INTEGER N		!The number of blocks.
    -         CHARACTER*(*) SOME(:)	!The blocks and their letters.
    -         INTEGER NA,AVAIL(N)	!Say not the struggle naught availeth!
    -         INTEGER NMOVE(LEN(WORD))	!I need a list of acceptable blocks,
    -         INTEGER MOVE(LEN(WORD),N)	!One list for each letter of WORD.
    -         INTEGER I,L,S		!Assistants.
    -         CHARACTER*1 C		!The letter of the moment.
    -          CANBLOCK = .FALSE.		!Initial pessimism.
    -          L = LSTNB(WORD)		!Ignore trailing spaces.
    -          IF (L.GT.N) RETURN		!Enough blocks?
    -          LETTER = 0				!To make rabbit stew,
    -          CALL LETTERCOUNT(WORD(1:L))		!First catch your rabbit.
    -          IF (ANY(SUPPLY .LT. LETTER)) RETURN	!The larder is lacking.
    -          NA = N			!Prepare a list.
    -          FORALL (I = 1:N) AVAIL(I) = I	!That fingers every block.
    -          I = 0		!Step through the letters of the WORD.
    +         CHARACTER*(*) WORD   !The word to spell out.
    +         INTEGER N      !The number of blocks.
    +         CHARACTER*(*) SOME(:)   !The blocks and their letters.
    +         INTEGER NA,AVAIL(N)  !Say not the struggle naught availeth!
    +         INTEGER NMOVE(LEN(WORD))   !I need a list of acceptable blocks,
    +         INTEGER MOVE(LEN(WORD),N)  !One list for each letter of WORD.
    +         INTEGER I,L,S     !Assistants.
    +         CHARACTER*1 C     !The letter of the moment.
    +          CANBLOCK = .FALSE.     !Initial pessimism.
    +          L = LSTNB(WORD)     !Ignore trailing spaces.
    +          IF (L.GT.N) RETURN     !Enough blocks?
    +          LETTER = 0          !To make rabbit stew,
    +          CALL LETTERCOUNT(WORD(1:L))     !First catch your rabbit.
    +          IF (ANY(SUPPLY .LT. LETTER)) RETURN   !The larder is lacking.
    +          NA = N        !Prepare a list.
    +          FORALL (I = 1:N) AVAIL(I) = I   !That fingers every block.
    +          I = 0      !Step through the letters of the WORD.
     Chug through the letters of the WORD.
    -    1     I = I + 1	!One letter after the other.
    -          IF (I.GT.L) GO TO 100	!Yay! We're through!
    -          C = WORD(I:I)		!The letter of the moment.
    -          NMOVE(I) = 0		!No moves known at this new level.
    -          DO S = 1,NA		!So, look for them amongst the available slots.
    -            IF (INDEX(SOME(AVAIL(S)),C) .GT. 0) THEN	!A hit?
    -              NMOVE(I) = NMOVE(I) + 1	!Yes! Count up another possible move.
    -              MOVE(I,NMOVE(I)) = S	!Remember its slot.
    -            END IF			!So much for that block.
    -          END DO		!On to the next.
    -    2     IF (NMOVE(I).GT.0) THEN	!Have we any moves?
    -            S = MOVE(I,NMOVE(I))	!Yes! Recover the last found.
    -            NMOVE(I) = NMOVE(I) - 1	!Uncount, as it is about to be used.
    -            IF (S.NE.NA) CALL SWAP(AVAIL(S),AVAIL(NA))	!This block is no longer available.
    -            NA = NA - 1			!Shift the boundary back.
    -            GO TO 1			!Try the next letter!
    -          END IF		!But if we can't find a move at that level...
    -          I = I - 1		!Retreat a level.
    -          IF (I.LE.0) RETURN	!Oh dear!
    -          S = MOVE(I,NMOVE(I) + 1)	!Undo the move that had been made at this level.
    -          NA = NA + 1			!And make its block is re-available.
    -          IF (S.NE.NA) CALL SWAP(AVAIL(S),AVAIL(NA))	!Move it back.
    -          GO TO 2		!See what moves remain at this level.
    +    1     I = I + 1  !One letter after the other.
    +          IF (I.GT.L) GO TO 100  !Yay! We're through!
    +          C = WORD(I:I)    !The letter of the moment.
    +          NMOVE(I) = 0     !No moves known at this new level.
    +          DO S = 1,NA      !So, look for them amongst the available slots.
    +            IF (INDEX(SOME(AVAIL(S)),C) .GT. 0) THEN  !A hit?
    +              NMOVE(I) = NMOVE(I) + 1  !Yes! Count up another possible move.
    +              MOVE(I,NMOVE(I)) = S  !Remember its slot.
    +            END IF         !So much for that block.
    +          END DO     !On to the next.
    +    2     IF (NMOVE(I).GT.0) THEN   !Have we any moves?
    +            S = MOVE(I,NMOVE(I)) !Yes! Recover the last found.
    +            NMOVE(I) = NMOVE(I) - 1 !Uncount, as it is about to be used.
    +            IF (S.NE.NA) CALL SWAP(AVAIL(S),AVAIL(NA))   !This block is no longer available.
    +            NA = NA - 1       !Shift the boundary back.
    +            GO TO 1        !Try the next letter!
    +          END IF     !But if we can't find a move at that level...
    +          I = I - 1     !Retreat a level.
    +          IF (I.LE.0) RETURN  !Oh dear!
    +          S = MOVE(I,NMOVE(I) + 1)  !Undo the move that had been made at this level.
    +          NA = NA + 1         !And make its block is re-available.
    +          IF (S.NE.NA) CALL SWAP(AVAIL(S),AVAIL(NA))  !Move it back.
    +          GO TO 2    !See what moves remain at this level.
     Completed!
    -  100     CANBLOCK = .TRUE.	!That's a relief.
    -        END FUNCTION CANBLOCK	!Some revisions might have been made.
    -      END MODULE PLAYPEN	!No sand here.
    +  100     CANBLOCK = .TRUE.   !That's a relief.
    +        END FUNCTION CANBLOCK !Some revisions might have been made.
    +      END MODULE PLAYPEN   !No sand here.
     
    -      USE PLAYPEN	!Just so.
    -      INTEGER HAVE,TESTS		!Parameters for the specified problem.
    -      PARAMETER (HAVE = 20, TESTS = 7)	!Number of blocks, number of tests.
    -      CHARACTER*(MS) BLOCKS(HAVE)	!Have blocks, will juggle.
    -      DATA BLOCKS/"BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS",	!The specified set
    -     1            "JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"/	!Of letter blocks.
    -      CHARACTER*8 WORD(TESTS)		!Now for the specified test words.
    -      LOGICAL ANS(TESTS),T,F		!And the given results.
    -      PARAMETER (T = .TRUE., F = .FALSE.)	!Enable a more compact specification.
    -      DATA WORD/"A","BARK","BOOK","TREAT","COMMON","SQUAD","CONFUSE"/	!So that these
    -      DATA  ANS/ T ,    T ,    F ,     T ,      F ,     T ,       T /	!Can be aligned.
    +      USE PLAYPEN !Just so.
    +      INTEGER HAVE,TESTS      !Parameters for the specified problem.
    +      PARAMETER (HAVE = 20, TESTS = 7) !Number of blocks, number of tests.
    +      CHARACTER*(MS) BLOCKS(HAVE)   !Have blocks, will juggle.
    +      DATA BLOCKS/"BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS", !The specified set
    +     1            "JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"/ !Of letter blocks.
    +      CHARACTER*8 WORD(TESTS)    !Now for the specified test words.
    +      LOGICAL ANS(TESTS),T,F     !And the given results.
    +      PARAMETER (T = .TRUE., F = .FALSE.) !Enable a more compact specification.
    +      DATA WORD/"A","BARK","BOOK","TREAT","COMMON","SQUAD","CONFUSE"/   !So that these
    +      DATA  ANS/ T ,    T ,    F ,     T ,      F ,     T ,       T /   !Can be aligned.
           LOGICAL YAY
           INTEGER I
     
    @@ -266,7 +266,7 @@ Completed!
         1 FORMAT ("Arranges alphabet blocks, attending only to the ",
          1 "letters on the blocks, and ignoring case and orientation.",/)
     
    -      CALL PLAY(HAVE,BLOCKS)	!Some fun first.
    +      CALL PLAY(HAVE,BLOCKS)  !Some fun first.
     
           WRITE (MSG,'(/"Now to see if some words can be spelled out.")')
           DO I = 1,TESTS
    diff --git a/Task/ABC-problem/FutureBasic/abc-problem-1.basic b/Task/ABC-problem/FutureBasic/abc-problem-1.basic
    index 5097485aa6..e9f8bea0fc 100644
    --- a/Task/ABC-problem/FutureBasic/abc-problem-1.basic
    +++ b/Task/ABC-problem/FutureBasic/abc-problem-1.basic
    @@ -1,30 +1,26 @@
    -include "NSLog.incl"
    -
     local fn CanBlocksSpell( w as CFStringRef ) as CFStringRef
    -NSUInteger  i, j
    -CFStringRef s = @"", t1, t2 : if fn StringIsEqual( w, @"" ) then exit fn = @"YES" else w = ucase(w)
    +  long        i, j
    +  CFStringRef s = @"", t1, t2 : if fn StringIsEqual( w, @"" ) then exit fn = @"YES" else w = ucase(w)
     
    -mda(0) = {@"BO",@"XK",@"DQ",@"CP",@"NA",@"GT",@"RE",@"TG",@"QD",¬
    -@"FS",@"JW",@"HU",@"VI",@"AN",@"OB",@"ER",@"FS",@"LY",@"PC",@"ZM"}
    +  mda(0) = {@"BO",@"XK",@"DQ",@"CP",@"NA",@"GT",@"RE",@"TG",@"QD",¬
    +  @"FS",@"JW",@"HU",@"VI",@"AN",@"OB",@"ER",@"FS",@"LY",@"PC",@"ZM"}
     
    -for i = 0 to len(w) - 1
    -for j = 0 to mda_count - 1
    -t1 = mid( mda(j), 0, 1 ) : t2 = mid( mda(j), 1, 1 )
    -if ( fn StringIsEqual( mid( w, i, 1 ), t1 ) ) then s = fn StringByAppendingString( s, t1 ) : mda(j) = @"  " : break
    -if ( fn StringIsEqual( mid( w, i, 1 ), t2 ) ) then s = fn StringByAppendingString( s, t2 ) : mda(j) = @"  " : break
    -next
    -next
    -if fn StringIsEqual( s, w ) then exit fn = @"YES"
    +  for i = 0 to len(w) - 1
    +    for j = 0 to mda_count - 1
    +      t1 = mid( mda(j), 0, 1 ) : t2 = mid( mda(j), 1, 1 )
    +      if ( fn StringIsEqual( mid( w, i, 1 ), t1 ) ) then s = fn StringByAppendingString( s, t1 ) : mda(j) = @"  " : break
    +      if ( fn StringIsEqual( mid( w, i, 1 ), t2 ) ) then s = fn StringByAppendingString( s, t2 ) : mda(j) = @"  " : break
    +    next
    +  next
    +  if fn StringIsEqual( s, w ) then exit fn = @"YES"
     end fn = @"NO"
     
    -NSUInteger  i
    +long        i
     CFArrayRef  words
     CFStringRef w
     words = @[@"", @"a",@"Bark",@"BOOK",@"TrEaT",@"COMMON",@"Squad",@"conFUse",@"ABBA",@"aUtO"]
     for w in words
    -printf @"Can blocks spell %7s : %@", fn StringUTF8String( w ), fn CanBlocksSpell( w )
    +  printf @"Can blocks spell %7s : %@", fn StringUTF8String( w ), fn CanBlocksSpell( w )
     next
     
    -NSLog( @"%@", fn WindowPrintViewString( 1 ) )
    -
     HandleEvents
    diff --git a/Task/ABC-problem/FutureBasic/abc-problem-2.basic b/Task/ABC-problem/FutureBasic/abc-problem-2.basic
    index 0919078013..76e7d3016f 100644
    --- a/Task/ABC-problem/FutureBasic/abc-problem-2.basic
    +++ b/Task/ABC-problem/FutureBasic/abc-problem-2.basic
    @@ -4,7 +4,7 @@ local fn blocks( wordList as str255 )
         found = instr$( 1, blocks, ch )
         select found
           case > 3: mid$( blocks, found and -2, 2 ) = "__" : text , , fn ColorYellow
    -        rect  fill ( x, y + 5.5, 15, 15 ), fn ColorBrown
    +        rect  fill ( x, y + 1, 15, 15 ), fn ColorBrown
           case   0: text , , fn ColorLightGray
           case < 4: blocks=" ,;BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM": x=3: y+=26: ch=""
         end select
    diff --git a/Task/ABC-problem/Go/abc-problem.go b/Task/ABC-problem/Go/abc-problem.go
    index 5ad1a85f59..0f28ef1f06 100644
    --- a/Task/ABC-problem/Go/abc-problem.go
    +++ b/Task/ABC-problem/Go/abc-problem.go
    @@ -1,39 +1,39 @@
     package main
     
     import (
    -	"fmt"
    -	"strings"
    +   "fmt"
    +   "strings"
     )
     
     func newSpeller(blocks string) func(string) bool {
    -	bl := strings.Fields(blocks)
    -	return func(word string) bool {
    -		return r(word, bl)
    -	}
    +   bl := strings.Fields(blocks)
    +   return func(word string) bool {
    +      return r(word, bl)
    +   }
     }
     
     func r(word string, bl []string) bool {
    -	if word == "" {
    -		return true
    -	}
    -	c := word[0] | 32
    -	for i, b := range bl {
    -		if c == b[0]|32 || c == b[1]|32 {
    -			bl[i], bl[0] = bl[0], b
    -			if r(word[1:], bl[1:]) == true {
    -				return true
    -			}
    -			bl[i], bl[0] = bl[0], bl[i]
    -		}
    -	}
    -	return false
    +   if word == "" {
    +      return true
    +   }
    +   c := word[0] | 32
    +   for i, b := range bl {
    +      if c == b[0]|32 || c == b[1]|32 {
    +         bl[i], bl[0] = bl[0], b
    +         if r(word[1:], bl[1:]) == true {
    +            return true
    +         }
    +         bl[i], bl[0] = bl[0], bl[i]
    +      }
    +   }
    +   return false
     }
     
     func main() {
    -	sp := newSpeller(
    -		"BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM")
    -	for _, word := range []string{
    -		"A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "CONFUSE"} {
    -		fmt.Println(word, sp(word))
    -	}
    +   sp := newSpeller(
    +      "BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM")
    +   for _, word := range []string{
    +      "A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "CONFUSE"} {
    +      fmt.Println(word, sp(word))
    +   }
     }
    diff --git a/Task/ABC-problem/Insitux/abc-problem.insitux b/Task/ABC-problem/Insitux/abc-problem.insitux
    index aba0f2cc01..6dd31fc0b6 100644
    --- a/Task/ABC-problem/Insitux/abc-problem.insitux
    +++ b/Task/ABC-problem/Insitux/abc-problem.insitux
    @@ -7,5 +7,5 @@
       (.. and (map in-block? word)))
     
     (-> ["A" "bark" "Book" "TREAT" "Common" "squaD" "CoNFuSe"] ; Notice case insensitivity
    -    (map #(str % " => " (can-make-word %)))
    +    (map #"{%} => {can-make-word %}")
         (join ", "))
    diff --git a/Task/ABC-problem/Julia/abc-problem.julia b/Task/ABC-problem/Julia/abc-problem.jl
    similarity index 100%
    rename from Task/ABC-problem/Julia/abc-problem.julia
    rename to Task/ABC-problem/Julia/abc-problem.jl
    diff --git a/Task/ABC-problem/Kotlin/abc-problem.kotlin b/Task/ABC-problem/Kotlin/abc-problem.kts
    similarity index 100%
    rename from Task/ABC-problem/Kotlin/abc-problem.kotlin
    rename to Task/ABC-problem/Kotlin/abc-problem.kts
    diff --git a/Task/ABC-problem/Lang/abc-problem.lang b/Task/ABC-problem/Lang/abc-problem.lang
    index 0e8e9d7054..8444fcad66 100644
    --- a/Task/ABC-problem/Lang/abc-problem.lang
    +++ b/Task/ABC-problem/Lang/abc-problem.lang
    @@ -1,37 +1,37 @@
     fp.canMakeWord = ($word, $blocks) -> {
    -	if(!$word) {
    -		return 1
    -	}
    -	
    -	$word = fn.toLower($word)
    -	
    -	$c $= $word[0]
    -	$i = 0
    -	while($i < @$blocks) {
    -		$block $= fn.toLower($blocks[$i])
    -		
    -		if($block[0] != $c && $block[1] != $c) {	
    -			$i += 1
    -			
    -			con.continue
    -		}
    -		
    -		$blocksCopy $= ^$blocks
    -		fn.listRemoveAt($blocksCopy, $i)
    -		
    -		if(fp.canMakeWord(fn.substring($word, 1), $blocksCopy)) {
    -			return 1
    -		}
    -		
    -		$i += 1
    -	}
    -	
    -	return 0
    +   if(!$word) {
    +      return 1
    +   }
    +
    +   $word = fn.toLower($word)
    +
    +   $c $= $word[0]
    +   $i = 0
    +   while($i < @$blocks) {
    +      $block $= fn.toLower($blocks[$i])
    +
    +      if($block[0] != $c && $block[1] != $c) {
    +         $i += 1
    +
    +         con.continue
    +      }
    +
    +      $blocksCopy $= ^$blocks
    +      fn.listRemoveAt($blocksCopy, $i)
    +
    +      if(fp.canMakeWord(fn.substring($word, 1), $blocksCopy)) {
    +         return 1
    +      }
    +
    +      $i += 1
    +   }
    +
    +   return 0
     }
     
     $blocks = fn.listOf(BO, XK, DQ, CP, NA, GT, RE, TG, QD, FS, JW, HU, VI, AN, OB, ER, FS, LY, PC, ZM)
     
     $word
     foreach($[word], [\e, A, BARK, BOOK, TREAT, COMMON, SQUAD, CONFUSE, Treat, cOmMoN]) {
    -	fn.printf(%s: %s%n, $word, fp.canMakeWord($word, $blocks))
    +   fn.printf(%s: %s%n, $word, fp.canMakeWord($word, $blocks))
     }
    diff --git a/Task/ABC-problem/Lua/abc-problem.lua b/Task/ABC-problem/Lua/abc-problem.lua
    index 3e18d4914a..9effcd462c 100644
    --- a/Task/ABC-problem/Lua/abc-problem.lua
    +++ b/Task/ABC-problem/Lua/abc-problem.lua
    @@ -1,31 +1,31 @@
     blocks = {
    -	{"B","O"};	{"X","K"};	{"D","Q"};	{"C","P"};
    -	{"N","A"};	{"G","T"};	{"R","E"};	{"T","G"};
    -	{"Q","D"};	{"F","S"};	{"J","W"};	{"H","U"};
    -	{"V","I"};	{"A","N"};	{"O","B"};	{"E","R"};
    -	{"F","S"};	{"L","Y"};	{"P","C"};	{"Z","M"};
    -	};
    +   {"B","O"};  {"X","K"};  {"D","Q"};  {"C","P"};
    +   {"N","A"};  {"G","T"};  {"R","E"};  {"T","G"};
    +   {"Q","D"};  {"F","S"};  {"J","W"};  {"H","U"};
    +   {"V","I"};  {"A","N"};  {"O","B"};  {"E","R"};
    +   {"F","S"};  {"L","Y"};  {"P","C"};  {"Z","M"};
    +   };
     
     function canUse(table, letter)
    -	for i,v in pairs(blocks) do
    -		if (v[1] == letter:upper() or v[2] == letter:upper())  and table[i] then
    -			table[i] = false;
    -			return true;
    -		end
    -	end
    -	return false;
    +   for i,v in pairs(blocks) do
    +      if (v[1] == letter:upper() or v[2] == letter:upper())  and table[i] then
    +         table[i] = false;
    +         return true;
    +      end
    +   end
    +   return false;
     end
     
     function canMake(Word)
    -	local Taken = {};
    -	for i,v in pairs(blocks) do
    -		table.insert(Taken,true);
    -	end
    -	local found = true;
    -	for i = 1,#Word do
    -		if not canUse(Taken,Word:sub(i,i)) then
    -			found = false;
    -		end
    -	end
    -	print(found)
    +   local Taken = {};
    +   for i,v in pairs(blocks) do
    +      table.insert(Taken,true);
    +   end
    +   local found = true;
    +   for i = 1,#Word do
    +      if not canUse(Taken,Word:sub(i,i)) then
    +         found = false;
    +      end
    +   end
    +   print(found)
     end
    diff --git a/Task/ABC-problem/MAXScript/abc-problem-1.max b/Task/ABC-problem/MAXScript/abc-problem-1.max
    index c05646f32e..0da376fc34 100644
    --- a/Task/ABC-problem/MAXScript/abc-problem-1.max
    +++ b/Task/ABC-problem/MAXScript/abc-problem-1.max
    @@ -1,98 +1,98 @@
     -- This is the blocks array
     global GlobalBlocks = #("BO","XK","DQ","CP","NA", \
    -			"GT","RE","TG","QD","FS", \
    -			"JW","HU","VI","AN","OB", \
    -			"ER","FS","LY","PC","ZM")
    +         "GT","RE","TG","QD","FS", \
    +         "JW","HU","VI","AN","OB", \
    +         "ER","FS","LY","PC","ZM")
     
     -- This function returns true if "_str" is part of "_word", false otherwise
     fn occurs _str _word =
     (
    -	if _str != undefined and _word != undefined then
    -	(
    -	matchpattern _word pattern:("*"+_str+"*")
    -	) else return false
    +   if _str != undefined and _word != undefined then
    +   (
    +   matchpattern _word pattern:("*"+_str+"*")
    +   ) else return false
     )
     
     -- This is the main function
     fn isWordPossible word blocks: = -- blocks is a keyword argument
     (
    -	word = toupper word -- convert the string to upper case, to make it case insensitive
    -	if blocks == unsupplied do blocks = GlobalBlocks
    -	-- if blocks (keyword argument) is unsupplied, use the global blocks array (this is for recursion)
    -	
    -	blocks = deepcopy blocks
    +   word = toupper word -- convert the string to upper case, to make it case insensitive
    +   if blocks == unsupplied do blocks = GlobalBlocks
    +   -- if blocks (keyword argument) is unsupplied, use the global blocks array (this is for recursion)
     
    -	local pos = 1 -- start at the beginning of the word
    -	local solvedLetters = #() -- this array stores the indices of solved letters
    -	
    -	while pos <= word.count do -- loop through every character in the word
    -	(
    -		local possibleBlocks = #() -- this array stores the blocks which can be used to make that letter
    -		for b = 1 to Blocks.count do -- this loop finds all the possible blocks that can be used to make that letter
    -		(
    -			if occurs word[pos] blocks[b] do
    -			(
    -				appendifunique possibleBlocks b
    -			)
    -		)
    -		if possibleBlocks.count > 0 then -- if it found any blocks
    -		(
    -			if possibleBlocks.count == 1 then -- if it found one block, then continue
    -			(
    -				appendifunique solvedLetters pos
    -				deleteitem blocks possibleblocks[1]
    -				pos += 1
    -			)
    -			else -- if it found more than one
    -			(
    -				for b = 1 to possibleBlocks.count do -- loop through every possible block
    -				(
    -					local possibleBlock = blocks[possibleBlocks[b]]
    -					local blockFirstLetter = possibleBlock[1]
    -					local blockSecondLetter = possibleBlock[2]
    -					local matchingLetter = if blockFirstLetter == word[pos] then 1 else 2
    -					-- ^ this is the index of the matching letter on the block
    -					
    -					local notMatchingIndex = if matchingLetter == 1 then 2 else 1
    -					local notMatchingLetter = possibleBlock[notMatchingIndex]
    -					-- ^ this is the other letter on the block
    -					
    -					if occurs notMatchingLetter (substring word (pos+1) -1) then
    -					( -- if the other letter occurs in the rest of the word
    -						local removedBlocks = deepcopy blocks -- copy the current blocks array
    -						deleteitem removedBlocks possibleBlocks[b] -- remove the item from the copied array
    -						
    -						-- recursively check if the word is possible if that block is taken away from the array:
    -						if (isWordPossible (substring word (pos+1) -1) blocks:removedBlocks) then
    -						( -- if it is, then remove the block and move to next character
    -							appendifunique solvedLetters pos
    -							deleteitem blocks possibleblocks[1]
    -							pos += 1
    -							exit
    -						)
    -						else
    -						( -- if it isn't and it looped through every possible block, then the word is not possible
    -							if b == possibleBlocks.count do return false
    -						)
    -					)
    -					else
    -					( -- if the other letter on this block doesn't occur in the rest of the word, then the letter is solved, continue
    -							appendifunique solvedLetters pos
    -							deleteitem blocks possibleblocks[b]
    -							pos += 1
    -							exit
    -					)
    -				)
    -			)
    -		) else return false -- if it didn't find any blocks, then return false
    -	)
    +   blocks = deepcopy blocks
     
    -	makeuniquearray solvedLetters -- make sure there are no duplicates in the solved array
    -	if solvedLetters.count != word.count then return false -- if number of solved letters is not equal to word length
    -		else
    -			( -- this checks if all the solved letters are the same as the word
    -				check = ""
    -				for bit in solvedLetters do append check word[bit]
    -				if check == word then return true else return false
    -			)
    +   local pos = 1 -- start at the beginning of the word
    +   local solvedLetters = #() -- this array stores the indices of solved letters
    +
    +   while pos <= word.count do -- loop through every character in the word
    +   (
    +      local possibleBlocks = #() -- this array stores the blocks which can be used to make that letter
    +      for b = 1 to Blocks.count do -- this loop finds all the possible blocks that can be used to make that letter
    +      (
    +         if occurs word[pos] blocks[b] do
    +         (
    +            appendifunique possibleBlocks b
    +         )
    +      )
    +      if possibleBlocks.count > 0 then -- if it found any blocks
    +      (
    +         if possibleBlocks.count == 1 then -- if it found one block, then continue
    +         (
    +            appendifunique solvedLetters pos
    +            deleteitem blocks possibleblocks[1]
    +            pos += 1
    +         )
    +         else -- if it found more than one
    +         (
    +            for b = 1 to possibleBlocks.count do -- loop through every possible block
    +            (
    +               local possibleBlock = blocks[possibleBlocks[b]]
    +               local blockFirstLetter = possibleBlock[1]
    +               local blockSecondLetter = possibleBlock[2]
    +               local matchingLetter = if blockFirstLetter == word[pos] then 1 else 2
    +               -- ^ this is the index of the matching letter on the block
    +
    +               local notMatchingIndex = if matchingLetter == 1 then 2 else 1
    +               local notMatchingLetter = possibleBlock[notMatchingIndex]
    +               -- ^ this is the other letter on the block
    +
    +               if occurs notMatchingLetter (substring word (pos+1) -1) then
    +               ( -- if the other letter occurs in the rest of the word
    +                  local removedBlocks = deepcopy blocks -- copy the current blocks array
    +                  deleteitem removedBlocks possibleBlocks[b] -- remove the item from the copied array
    +
    +                  -- recursively check if the word is possible if that block is taken away from the array:
    +                  if (isWordPossible (substring word (pos+1) -1) blocks:removedBlocks) then
    +                  ( -- if it is, then remove the block and move to next character
    +                     appendifunique solvedLetters pos
    +                     deleteitem blocks possibleblocks[1]
    +                     pos += 1
    +                     exit
    +                  )
    +                  else
    +                  ( -- if it isn't and it looped through every possible block, then the word is not possible
    +                     if b == possibleBlocks.count do return false
    +                  )
    +               )
    +               else
    +               ( -- if the other letter on this block doesn't occur in the rest of the word, then the letter is solved, continue
    +                     appendifunique solvedLetters pos
    +                     deleteitem blocks possibleblocks[b]
    +                     pos += 1
    +                     exit
    +               )
    +            )
    +         )
    +      ) else return false -- if it didn't find any blocks, then return false
    +   )
    +
    +   makeuniquearray solvedLetters -- make sure there are no duplicates in the solved array
    +   if solvedLetters.count != word.count then return false -- if number of solved letters is not equal to word length
    +      else
    +         ( -- this checks if all the solved letters are the same as the word
    +            check = ""
    +            for bit in solvedLetters do append check word[bit]
    +            if check == word then return true else return false
    +         )
     )
    diff --git a/Task/ABC-problem/MAXScript/abc-problem-3.max b/Task/ABC-problem/MAXScript/abc-problem-3.max
    index 4681f1b686..3aeab87682 100644
    --- a/Task/ABC-problem/MAXScript/abc-problem-3.max
    +++ b/Task/ABC-problem/MAXScript/abc-problem-3.max
    @@ -1,30 +1,30 @@
     fn isWordPossible2 word =
     (
    -	Blocks = #("BO","XK","DQ","CP","NA", \
    -			   "GT","RE","TG","QD","FS", \
    -			   "JW","HU","VI","AN","OB", \
    -			   "ER","FS","LY","PC","ZM")
    +   Blocks = #("BO","XK","DQ","CP","NA", \
    +            "GT","RE","TG","QD","FS", \
    +            "JW","HU","VI","AN","OB", \
    +            "ER","FS","LY","PC","ZM")
             word = toupper word
    -	local pos = 1
    -	local solvedLetters = #()
    -	while pos <= word.count do
    -	(
    -		for i = 1 to blocks.count do
    -		(
    -			if (matchpattern blocks[i] pattern:("*"+word[pos]+"*")) then
    -				(
    -					deleteitem blocks i
    -					appendifunique solvedLetters pos
    -					pos +=1
    -					exit
    -				)
    -			else if i == blocks.count do return false
    -		)
    -	)
    -	if solvedLetters.count == word.count then
    -	(
    -		local check = ""
    -		for bit in solvedLetters do append check word[bit]
    -		if check == word then return true else return false
    -	) else return false
    +   local pos = 1
    +   local solvedLetters = #()
    +   while pos <= word.count do
    +   (
    +      for i = 1 to blocks.count do
    +      (
    +         if (matchpattern blocks[i] pattern:("*"+word[pos]+"*")) then
    +            (
    +               deleteitem blocks i
    +               appendifunique solvedLetters pos
    +               pos +=1
    +               exit
    +            )
    +         else if i == blocks.count do return false
    +      )
    +   )
    +   if solvedLetters.count == word.count then
    +   (
    +      local check = ""
    +      for bit in solvedLetters do append check word[bit]
    +      if check == word then return true else return false
    +   ) else return false
     )
    diff --git a/Task/ABC-problem/Maple/abc-problem.maple b/Task/ABC-problem/Maple/abc-problem.maple
    index 98312bccce..0937c92c58 100644
    --- a/Task/ABC-problem/Maple/abc-problem.maple
    +++ b/Task/ABC-problem/Maple/abc-problem.maple
    @@ -1,23 +1,23 @@
     canSpell := proc(w)
    -	local blocks, i, j, word, letterFound;
    -	blocks := Array([["B", "O"], ["X", "K"], ["D", "Q"], ["C", "P"], ["N", "A"], ["G", "T"], ["R", "E"], ["T", "G"],
    +   local blocks, i, j, word, letterFound;
    +   blocks := Array([["B", "O"], ["X", "K"], ["D", "Q"], ["C", "P"], ["N", "A"], ["G", "T"], ["R", "E"], ["T", "G"],
                              ["Q", "D"], ["F", "S"], ["J", "W"], ["H", "U"], ["V", "I"], ["A", "N"], ["O", "B"], ["E", "R"],
                              ["F", "S"], ["L", "Y"], ["P", "C"], ["Z", "M"]]);
    -	word := StringTools[UpperCase](convert(w, string));
    -	for i to length(word) do
    -		letterFound := false;
    -		for j to numelems(blocks)/2 do
    -			if not letterFound and (substring(word, i) = blocks[j,1] or substring(word, i) = blocks[j,2]) then
    -				blocks[j,1] := undefined;
    -				blocks[j,2] := undefined;
    -				letterFound := true;
    -			end if;
    -		end do;
    -		if not letterFound then
    -			return false;
    -		end if;
    -	end do;
    -	return true;
    +   word := StringTools[UpperCase](convert(w, string));
    +   for i to length(word) do
    +      letterFound := false;
    +      for j to numelems(blocks)/2 do
    +         if not letterFound and (substring(word, i) = blocks[j,1] or substring(word, i) = blocks[j,2]) then
    +            blocks[j,1] := undefined;
    +            blocks[j,2] := undefined;
    +            letterFound := true;
    +         end if;
    +      end do;
    +      if not letterFound then
    +         return false;
    +      end if;
    +   end do;
    +   return true;
     end proc:
     
     seq(printf("%a: %a\n", i, canSpell(i)), i in [a, Bark, bOok, treat, COMMON, squad, confuse]);
    diff --git a/Task/ABC-problem/OCaml/abc-problem.ocaml b/Task/ABC-problem/OCaml/abc-problem.ml
    similarity index 100%
    rename from Task/ABC-problem/OCaml/abc-problem.ocaml
    rename to Task/ABC-problem/OCaml/abc-problem.ml
    diff --git a/Task/ABC-problem/Pluto/abc-problem.pluto b/Task/ABC-problem/Pluto/abc-problem.pluto
    new file mode 100644
    index 0000000000..243a9a5f79
    --- /dev/null
    +++ b/Task/ABC-problem/Pluto/abc-problem.pluto
    @@ -0,0 +1,25 @@
    +function r(word, bl)
    +    if word == "" then return true end
    +    local c = word:byte(1) | 32
    +    for i = 1, #bl do
    +        local b = bl[i]
    +        if c == b:byte(1) | 32 or c == b:byte(2) | 32 then
    +            bl[i] = bl[1]
    +            bl[1] = b
    +            if r(word:sub(2), bl:slice(2)) then return true end
    +            bl[1], bl[i] = bl[i], bl[1]
    +        end
    +    end
    +    return false
    +end
    +
    +local function new_speller(blocks)
    +    local bl = blocks:split(" ")
    +    return |word| -> r(word, bl)
    +end
    +
    +local sp = new_speller("BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM")
    +local words = {"A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "CONFUSE"}
    +for words as word do
    +    print(string.format("%-7s %s", word, sp(word)))
    +end
    diff --git a/Task/ABC-problem/PowerBASIC/abc-problem.basic b/Task/ABC-problem/PowerBASIC/abc-problem.basic
    index ff524d89eb..4a29562c45 100644
    --- a/Task/ABC-problem/PowerBASIC/abc-problem.basic
    +++ b/Task/ABC-problem/PowerBASIC/abc-problem.basic
    @@ -20,7 +20,7 @@
     '1.Once a letter on a block is used that block cannot be used again
     '2.The function should be case-insensitive
     '3. Show your output on this page for the following words:
    -'	A, BARK, BOOK, TREAT, COMMON, SQUAD, CONFUSE
    +'  A, BARK, BOOK, TREAT, COMMON, SQUAD, CONFUSE
     '-----------------------------------------------------------------------------
     ' G l o b a l   C o n s t a n t s
     '
    diff --git a/Task/ABC-problem/PowerShell/abc-problem.ps1 b/Task/ABC-problem/PowerShell/abc-problem.ps1
    new file mode 100644
    index 0000000000..3c8a1239a4
    --- /dev/null
    +++ b/Task/ABC-problem/PowerShell/abc-problem.ps1
    @@ -0,0 +1,117 @@
    +<#
    +.Synopsis
    +  ABC Problem
    +.DESCRIPTION
    +   You are given a collection of ABC blocks. Just like the ones you had when you were a kid.
    +   There are twenty blocks with two letters on each block. You are guaranteed to have a
    +   complete alphabet amongst all sides of the blocks
    +   blocks = "BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS","JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"
    +   The goal of this task is to write a function that takes a string and can determine whether
    +   you can spell the word with the given collection of blocks.
    +
    +   The rules are simple:
    +        1.Once a letter on a block is used that block cannot be used again
    +        2.The function should be case-insensitive
    +        3. Show your output on this page for the following words:
    +        >>> can_make_word("A")
    +        True
    +        >>> can_make_word("BARK")
    +        True
    +        >>> can_make_word("BOOK")
    +        False
    +        >>> can_make_word("TREAT")
    +        True
    +        >>> can_make_word("COMMON")
    +        False
    +        >>> can_make_word("SQUAD")
    +        True
    +        >>> can_make_word("CONFUSE")
    +        True
    +
    +   Using the examples below  you can either see just the value or
    +   status and the values using the verbose switch
    +
    +.EXAMPLE
    +   test-blocks -testword confuse
    +
    +.EXAMPLE
    +   test-blocks -testword confuse -verbose
    +
    +#>
    +
    +function test-blocks
    +{
    +   [CmdletBinding()]
    +   #  [OutputType([int])]
    +   Param
    +   (
    +      # word to test against blocks
    +      [Parameter(Mandatory = $true,
    +               ValueFromPipelineByPropertyName = $true)]
    +      $testword
    +
    +   )
    +
    +   $word = $testword
    +
    +   #define array of blocks
    +   [System.Collections.ArrayList]$blockarray = "BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS", "JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM"
    +
    +   #send word to chararray
    +   $chararray = $word.ToCharArray()
    +   $chars = $chararray
    +
    +   #get the character count
    +   $charscount = $chars.count
    +
    +   #get the initial count of the blocks
    +   $blockcount = $blockarray.Count
    +
    +   #find out how many blocks should be left from the difference
    +   #of the blocks and characters in the word - 1 letter/1 block
    +   $correctblockcount = $blockcount - $charscount
    +
    +   #loop through the characters in the word
    +   foreach ($char in $chars)
    +   {
    +
    +      #loop through the blocks
    +      foreach ($block in $blockarray)
    +      {
    +
    +         #check the current character against each letter on the current block
    +         #and break if found so the array can reload
    +         if ($char -in $block[0] -or $char -in $block[1])
    +         {
    +
    +            write-verbose "match for letter - $char - removing block $block"
    +            $blockarray.Remove($block)
    +            break
    +
    +         }
    +
    +      }
    +
    +   }
    +   #get final count of blocks left in array to determine if the word was
    +   #correctly made
    +   $finalblockcount = $blockarray.count
    +   if ($finalblockcount -ne $correctblockcount)
    +   {
    +      write-verbose "$word : $false "
    +      return $false
    +   }
    +   else
    +   {
    +      write-verbose "$word : $true "
    +      return $true
    +   }
    +
    +}
    +
    +#loop all the words and pass them to the function
    +$wordlist = "a", "bark", "book", "treat", "common", "squad", "confuse"
    +foreach ($word in $wordlist)
    +{
    +   test-blocks -testword $word -Verbose
    +}
    diff --git a/Task/ABC-problem/PowerShell/abc-problem.psh b/Task/ABC-problem/PowerShell/abc-problem.psh
    deleted file mode 100644
    index 9fd301dcac..0000000000
    --- a/Task/ABC-problem/PowerShell/abc-problem.psh
    +++ /dev/null
    @@ -1,117 +0,0 @@
    -<#
    -.Synopsis
    -  ABC Problem
    -.DESCRIPTION
    -   You are given a collection of ABC blocks. Just like the ones you had when you were a kid.
    -   There are twenty blocks with two letters on each block. You are guaranteed to have a
    -   complete alphabet amongst all sides of the blocks
    -   blocks = "BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS","JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"
    -   The goal of this task is to write a function that takes a string and can determine whether
    -   you can spell the word with the given collection of blocks.
    -
    -   The rules are simple:
    -        1.Once a letter on a block is used that block cannot be used again
    -        2.The function should be case-insensitive
    -        3. Show your output on this page for the following words:
    -        >>> can_make_word("A")
    -        True
    -        >>> can_make_word("BARK")
    -        True
    -        >>> can_make_word("BOOK")
    -        False
    -        >>> can_make_word("TREAT")
    -        True
    -        >>> can_make_word("COMMON")
    -        False
    -        >>> can_make_word("SQUAD")
    -        True
    -        >>> can_make_word("CONFUSE")
    -        True
    -
    -   Using the examples below  you can either see just the value or
    -   status and the values using the verbose switch
    -
    -.EXAMPLE
    -   test-blocks -testword confuse
    -
    -.EXAMPLE
    -   test-blocks -testword confuse -verbose
    -
    -#>
    -
    -function test-blocks
    -{
    -	[CmdletBinding()]
    -	#  [OutputType([int])]
    -	Param
    -	(
    -		# word to test against blocks
    -		[Parameter(Mandatory = $true,
    -				   ValueFromPipelineByPropertyName = $true)]
    -		$testword
    -		
    -	)
    -
    -	$word = $testword
    -	
    -	#define array of blocks
    -	[System.Collections.ArrayList]$blockarray = "BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS", "JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM"
    -	
    -	#send word to chararray
    -	$chararray = $word.ToCharArray()
    -	$chars = $chararray
    -	
    -	#get the character count
    -	$charscount = $chars.count
    -	
    -	#get the initial count of the blocks
    -	$blockcount = $blockarray.Count
    -	
    -	#find out how many blocks should be left from the difference
    -	#of the blocks and characters in the word - 1 letter/1 block
    -	$correctblockcount = $blockcount - $charscount
    -	
    -	#loop through the characters in the word
    -	foreach ($char in $chars)
    -	{
    -		
    -		#loop through the blocks
    -		foreach ($block in $blockarray)
    -		{
    -			
    -			#check the current character against each letter on the current block
    -			#and break if found so the array can reload
    -			if ($char -in $block[0] -or $char -in $block[1])
    -			{
    -				
    -				write-verbose "match for letter - $char - removing block $block"
    -				$blockarray.Remove($block)
    -				break
    -				
    -			}
    -			
    -		}
    -		
    -	}
    -	#get final count of blocks left in array to determine if the word was
    -	#correctly made
    -	$finalblockcount = $blockarray.count
    -	if ($finalblockcount -ne $correctblockcount)
    -	{
    -		write-verbose "$word : $false "
    -		return $false
    -	}
    -	else
    -	{
    -		write-verbose "$word : $true "
    -		return $true
    -	}
    -	
    -}
    -
    -#loop all the words and pass them to the function
    -$wordlist = "a", "bark", "book", "treat", "common", "squad", "confuse"
    -foreach ($word in $wordlist)
    -{
    -	test-blocks -testword $word -Verbose
    -}
    diff --git a/Task/ABC-problem/Prolog/abc-problem-1.pro b/Task/ABC-problem/Prolog/abc-problem-1.pro
    index 99d543c21b..90c7559163 100644
    --- a/Task/ABC-problem/Prolog/abc-problem-1.pro
    +++ b/Task/ABC-problem/Prolog/abc-problem-1.pro
    @@ -1,22 +1,22 @@
     abc_problem :-
    -	maplist(abc_problem, ['', 'A', bark, bOOk, treAT, 'COmmon', sQuaD, 'CONFUSE']).
    +   maplist(abc_problem, ['', 'A', bark, bOOk, treAT, 'COmmon', sQuaD, 'CONFUSE']).
     
     
     abc_problem(Word) :-
    -	L = [[b,o],[x,k],[d,q],[c,p],[n,a],[g,t],[r,e],[t,g],[q,d],[f,s],
    -	     [j,w],[h,u],[v,i],[a,n],[o,b],[e,r],[f,s],[l,y],[p,c],[z,m]],
    +   L = [[b,o],[x,k],[d,q],[c,p],[n,a],[g,t],[r,e],[t,g],[q,d],[f,s],
    +        [j,w],[h,u],[v,i],[a,n],[o,b],[e,r],[f,s],[l,y],[p,c],[z,m]],
     
    -	(   abc_problem(L, Word)
    -	->  format('~w OK~n', [Word])
    -	;   format('~w KO~n', [Word])).
    +   (   abc_problem(L, Word)
    +   ->  format('~w OK~n', [Word])
    +   ;   format('~w KO~n', [Word])).
     
     abc_problem(L, Word) :-
    -	atom_chars(Word, C_Words),
    -	maplist(downcase_atom, C_Words, D_Words),
    -	can_makeword(L, D_Words).
    +   atom_chars(Word, C_Words),
    +   maplist(downcase_atom, C_Words, D_Words),
    +   can_makeword(L, D_Words).
     
     can_makeword(_L, []).
     
     can_makeword(L, [H | T]) :-
    -	(   select([H, _], L, L1); select([_, H], L, L1)),
    -	can_makeword(L1, T).
    +   (   select([H, _], L, L1); select([_, H], L, L1)),
    +   can_makeword(L1, T).
    diff --git a/Task/ABC-problem/Rebol/abc-problem.rebol b/Task/ABC-problem/Rebol/abc-problem.rebol
    new file mode 100644
    index 0000000000..fe63851d8f
    --- /dev/null
    +++ b/Task/ABC-problem/Rebol/abc-problem.rebol
    @@ -0,0 +1,38 @@
    +Rebol [
    +    title: "Rosetta code: ABC problem"
    +    file:  %ABC_problem.r3
    +    url:   https://rosettacode.org/wiki/ABC_problem
    +    needs: 3.10.0 ;; or something like that
    +    note:  "Based on Red language solution"
    +]
    +;; Define the function 'test' that takes a string argument 's'
    +test: function [s [string!]][
    +    ;; Make a copy of the input string to work on (avoid mutation of original)
    +    s: copy s
    +    ;; Initialize 'p' as a copy of a specific character sequence
    +    p: copy "BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM"
    +    ;; Start an infinite loop
    +    forever [
    +        ;; If 's' is empty, return true (all characters matched/removed)
    +        if 0 = length? s [return  true]
    +        ;; If 'p' is at the tail (all pairs tried), return false (no match)
    +        if tail? p       [return false]
    +        ;; Create a parsing rule of the current two characters in 'p'
    +        rule: reduce [first p  '| second p]
    +        ;; Try to parse 's' according to the current rule:
    +        ;; If parsing succeeds, remove that rule from the string
    +        p: either parse s [to rule remove rule to end ] [
    +            ;; If parsing succeeded, remove the current pair from 'p'
    +            head remove/part p 2
    +        ][
    +            ;; If parsing failed, skip the current pair in 'p' (move to next pair)
    +            skip p 2
    +        ]
    +    ]
    +]
    +
    +;; Test the 'test' function on each word split from a string (split by space).
    +foreach word split {A bark book TrEAT COmMoN SQUAD conFUsE} space [
    +    ;; Print the word and its result from 'test'
    +    printf [8 ": "] reduce [word test word]
    +]
    diff --git a/Task/ABC-problem/Refal/abc-problem.refal b/Task/ABC-problem/Refal/abc-problem.refal
    new file mode 100644
    index 0000000000..7e9c5f8af3
    --- /dev/null
    +++ b/Task/ABC-problem/Refal/abc-problem.refal
    @@ -0,0 +1,35 @@
    +$ENTRY Go {
    +    = ) >;
    +};
    +
    +Each {
    +    s.F (e.Arg) = ;
    +    s.F (e.Arg) t.I e.R =  ;
    +};
    +
    +Show {
    +    (e.Word) e.Blocks = >;
    +};
    +
    +Blocks {
    +    = ('BO') ('XK') ('DQ') ('CP') ('NA')
    +      ('GT') ('RE') ('TG') ('QD') ('FS')
    +      ('JW') ('HU') ('VI') ('AN') ('OB')
    +      ('ER') ('FS') ('LY') ('PC') ('ZM');
    +};
    +
    +Words {
    +    = ('A') ('BARK') ('BOOK') ('TREAT')
    +      ('common') ('squad') ('CoNfUsE');
    +};
    +
    +CanMakeWord {
    +    (e.Word) e.Blocks = ) e.Blocks>;
    +}
    +
    +CanMakeWord1 {
    +    () e.Blocks = T;
    +    (s.Ltr e.Word) e.Blocks1 (e.X s.Ltr e.Y) e.Blocks2
    +        = ;
    +    (e.Word) e.Blocks = F;
    +};
    diff --git a/Task/ABC-problem/Rust/abc-problem.rust b/Task/ABC-problem/Rust/abc-problem.rs
    similarity index 100%
    rename from Task/ABC-problem/Rust/abc-problem.rust
    rename to Task/ABC-problem/Rust/abc-problem.rs
    diff --git a/Task/ABC-problem/SETL/abc-problem.setl b/Task/ABC-problem/SETL/abc-problem.setl
    new file mode 100644
    index 0000000000..1665c27216
    --- /dev/null
    +++ b/Task/ABC-problem/SETL/abc-problem.setl
    @@ -0,0 +1,21 @@
    +program ABC_problem;
    +    blocks := ["BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS",
    +               "JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"];
    +
    +    words := ["A","BARK","BOOK","treat","common","Squad","CoNfUsE"];
    +
    +    loop for word in words do
    +        print(rpad(word, 8), can_make_word(word, blocks));
    +    end loop;
    +
    +    proc can_make_word(word, blocks);
    +        loop for letter in word do
    +            if exists block = blocks(i) | to_upper(letter) in block then
    +                blocks(i) := "";
    +            else
    +                return false;
    +            end if;
    +        end loop;
    +        return true;
    +    end proc;
    +end program;
    diff --git a/Task/ABC-problem/SNOBOL4/abc-problem.sno b/Task/ABC-problem/SNOBOL4/abc-problem.sno
    index b8cb880ab1..0ed5f49e73 100644
    --- a/Task/ABC-problem/SNOBOL4/abc-problem.sno
    +++ b/Task/ABC-problem/SNOBOL4/abc-problem.sno
    @@ -4,46 +4,46 @@
     
     * Read in blocks to construct the blocks string
     in1
    -	line = replace(input,&lcase,&ucase) :f(in1end)
    -	line ? breakx(' ') . pre ' ' rem . post :f(in1end)
    -	blocks = blocks "," pre post
    -	:(in1)
    +   line = replace(input,&lcase,&ucase) :f(in1end)
    +   line ? breakx(' ') . pre ' ' rem . post :f(in1end)
    +   blocks = blocks "," pre post
    +   :(in1)
     in1end
     
     * Function to determine if a word can be constructed with the given blocks
    -	define('abc(blocks,word)s,i,let')
    -		abcpat = (breakx(',') ',') . pre (*let len(1) | len(1) *let) rem . post
    -	:(abc_end)
    +   define('abc(blocks,word)s,i,let')
    +      abcpat = (breakx(',') ',') . pre (*let len(1) | len(1) *let) rem . post
    +   :(abc_end)
     abc
    -	eq(size(word),0) :s(abc3)
    -	s = replace(word,&lcase,&ucase)
    -	i = 0
    +   eq(size(word),0) :s(abc3)
    +   s = replace(word,&lcase,&ucase)
    +   i = 0
     abc2
    -	i = lt(i,size(s)) i + 1 :f(abc4)
    -	let = substr(s,i,1)
    -	blocks ? abcpat = pre post :f(abc3)
    -	:(abc2)
    +   i = lt(i,size(s)) i + 1 :f(abc4)
    +   let = substr(s,i,1)
    +   blocks ? abcpat = pre post :f(abc3)
    +   :(abc2)
     abc3
    -	abc = 'False' :(abc5)
    +   abc = 'False' :(abc5)
     abc4
    -	abc = 'True'  :(abc5)
    +   abc = 'True'  :(abc5)
     abc5
    -	output = lpad('can_make_word("' word '"): ',26) abc
    -	abc = ""
    -	:(return)
    +   output = lpad('can_make_word("' word '"): ',26) abc
    +   abc = ""
    +   :(return)
     abc_end
     
     * Check words
    -*	output = abc(blocks,"")
    -*	output = abc(blocks," ")
    -	output = abc(blocks,'A')
    -	output = abc(blocks,'bark')
    -	output = abc(blocks,'BOOK')
    -	output = abc(blocks,'TrEAT')
    -	output = abc(blocks,'COMMON')
    -	output = abc(blocks,'SQUAD')
    -	output = abc(blocks,'CONFUSE')
    -	
    +*  output = abc(blocks,"")
    +*  output = abc(blocks," ")
    +   output = abc(blocks,'A')
    +   output = abc(blocks,'bark')
    +   output = abc(blocks,'BOOK')
    +   output = abc(blocks,'TrEAT')
    +   output = abc(blocks,'COMMON')
    +   output = abc(blocks,'SQUAD')
    +   output = abc(blocks,'CONFUSE')
    +
     * The blocks are entered below, after the following END label
     END
     b o
    diff --git a/Task/ABC-problem/Scheme/abc-problem.ss b/Task/ABC-problem/Scheme/abc-problem.scm
    similarity index 100%
    rename from Task/ABC-problem/Scheme/abc-problem.ss
    rename to Task/ABC-problem/Scheme/abc-problem.scm
    diff --git a/Task/ABC-problem/SenseTalk/abc-problem-1.sensetalk b/Task/ABC-problem/SenseTalk/abc-problem-1.sensetalk
    index abbfa87d9a..ca1dcb76f7 100644
    --- a/Task/ABC-problem/SenseTalk/abc-problem-1.sensetalk
    +++ b/Task/ABC-problem/SenseTalk/abc-problem-1.sensetalk
    @@ -1,41 +1,41 @@
     function CanMakeWord word
     
    -	put [
    -		("B", "O"),
    -		("X", "K"),
    -		("D", "Q"),
    -		("C", "P"),
    -		("N", "A"),
    -		("G", "T"),
    -		("R", "E"),
    -		("T", "G"),
    -		("Q", "D"),
    -		("F", "S"),
    -		("J", "W"),
    -		("H", "U"),
    -		("V", "I"),
    -		("A", "N"),
    -		("O", "B"),
    -		("E", "R"),
    -		("F", "S"),
    -		("L", "Y"),
    -		("P", "C"),
    -		("Z", "M")
    -	] into blocks
    -	
    -	repeat with each character letter of word
    -		put False into found
    -		repeat with each item block of blocks by reference
    -			if item 1 of block is letter ignoring case or item 2 of block is letter ignoring case
    -				delete block
    -				put True into found
    -				exit repeat
    -			end if
    -		end repeat
    -		if found is False
    -			return False
    -		end if
    -	end repeat
    -	return True
    -	
    +   put [
    +      ("B", "O"),
    +      ("X", "K"),
    +      ("D", "Q"),
    +      ("C", "P"),
    +      ("N", "A"),
    +      ("G", "T"),
    +      ("R", "E"),
    +      ("T", "G"),
    +      ("Q", "D"),
    +      ("F", "S"),
    +      ("J", "W"),
    +      ("H", "U"),
    +      ("V", "I"),
    +      ("A", "N"),
    +      ("O", "B"),
    +      ("E", "R"),
    +      ("F", "S"),
    +      ("L", "Y"),
    +      ("P", "C"),
    +      ("Z", "M")
    +   ] into blocks
    +
    +   repeat with each character letter of word
    +      put False into found
    +      repeat with each item block of blocks by reference
    +         if item 1 of block is letter ignoring case or item 2 of block is letter ignoring case
    +            delete block
    +            put True into found
    +            exit repeat
    +         end if
    +      end repeat
    +      if found is False
    +         return False
    +      end if
    +   end repeat
    +   return True
    +
     end CanMakeWord
    diff --git a/Task/ABC-problem/SenseTalk/abc-problem-2.sensetalk b/Task/ABC-problem/SenseTalk/abc-problem-2.sensetalk
    index 8949df06a2..7bbcd3910d 100644
    --- a/Task/ABC-problem/SenseTalk/abc-problem-2.sensetalk
    +++ b/Task/ABC-problem/SenseTalk/abc-problem-2.sensetalk
    @@ -1,11 +1,11 @@
     repeat with each item word in [
    -	"A",
    -	"BARK",
    -	"BOOK",
    -	"TREAT",
    -	"COMMON",
    -	"SQUAD",
    -	"CONFUSE"
    +   "A",
    +   "BARK",
    +   "BOOK",
    +   "TREAT",
    +   "COMMON",
    +   "SQUAD",
    +   "CONFUSE"
             ]
    -	put CanMakeWord(word)
    +   put CanMakeWord(word)
     end repeat
    diff --git a/Task/ABC-problem/SequenceL/abc-problem-1.sequencel b/Task/ABC-problem/SequenceL/abc-problem-1.sequencel
    index 57f03ba268..eabaaedc4f 100644
    --- a/Task/ABC-problem/SequenceL/abc-problem-1.sequencel
    +++ b/Task/ABC-problem/SequenceL/abc-problem-1.sequencel
    @@ -2,28 +2,28 @@ import ;
     import ;
     
     main(args(2)) :=
    -	let
    -		result[i] := args[i] ++ ": " ++ boolToString(can_make_word(args[i], InitBlocks));
    -	in
    -		delimit(result, '\n');
    +   let
    +      result[i] := args[i] ++ ": " ++ boolToString(can_make_word(args[i], InitBlocks));
    +   in
    +      delimit(result, '\n');
     
     InitBlocks :=  ["BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS", "JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM"];
    -			
    +
     can_make_word(word(1), blocks(2)) :=
    -	let
    -		choices[i] := i when some(blocks[i] = toUpper(head(word)));
    -		blocksAfterChoice[i] := blocks[(1 ... (choices[i] - 1)) ++ ((choices[i] + 1) ... size(blocks))];
    -	in
    -		true when size(word) = 0
    -	else
    -		false when size(choices) = 0
    -	else
    -		some(can_make_word(tail(word), blocksAfterChoice));
    -		
    +   let
    +      choices[i] := i when some(blocks[i] = toUpper(head(word)));
    +      blocksAfterChoice[i] := blocks[(1 ... (choices[i] - 1)) ++ ((choices[i] + 1) ... size(blocks))];
    +   in
    +      true when size(word) = 0
    +   else
    +      false when size(choices) = 0
    +   else
    +      some(can_make_word(tail(word), blocksAfterChoice));
    +
     toUpper(letter(0)) :=
    -	let
    -		ascii := asciiToInt(letter);
    -	in
    -		letter when ascii >= 65 and ascii <= 90
    -	else
    -		intToAscii(ascii -  32);
    +   let
    +      ascii := asciiToInt(letter);
    +   in
    +      letter when ascii >= 65 and ascii <= 90
    +   else
    +      intToAscii(ascii -  32);
    diff --git a/Task/ABC-problem/SequenceL/abc-problem-2.sequencel b/Task/ABC-problem/SequenceL/abc-problem-2.sequencel
    index a82214ee48..11b30e8581 100644
    --- a/Task/ABC-problem/SequenceL/abc-problem-2.sequencel
    +++ b/Task/ABC-problem/SequenceL/abc-problem-2.sequencel
    @@ -3,29 +3,29 @@ import ;
     import ;
     
     main(args(2)) :=
    -	let
    -		result[i] := args[i] ++ ": " ++ boolToString(can_make_word(args[i], InitBlocks));
    -	in
    -		delimit(result, '\n');
    +   let
    +      result[i] := args[i] ++ ": " ++ boolToString(can_make_word(args[i], InitBlocks));
    +   in
    +      delimit(result, '\n');
     
     InitBlocks :=  "BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM";
    -			
    +
     can_make_word(word(1), blocks(1)) :=
    -	let
    -		regEx := "(\\a" ++ [toUpper(head(word))] ++ "|" ++ [toUpper(head(word))] ++ "\\a)";
    -		
    -		newBlocks := replaceFirst(blocks, regEx, "");
    -	in
    -		true when size(word) = 0
    -	else
    -		false when size(newBlocks) = size(blocks)
    -	else
    -		can_make_word(tail(word), newBlocks);
    +   let
    +      regEx := "(\\a" ++ [toUpper(head(word))] ++ "|" ++ [toUpper(head(word))] ++ "\\a)";
    +
    +      newBlocks := replaceFirst(blocks, regEx, "");
    +   in
    +      true when size(word) = 0
    +   else
    +      false when size(newBlocks) = size(blocks)
    +   else
    +      can_make_word(tail(word), newBlocks);
     
     toUpper(letter(0)) :=
    -	let
    -		ascii := asciiToInt(letter);
    -	in
    -		letter when ascii >= 65 and ascii <= 90
    -	else
    -		intToAscii(ascii -  32);
    +   let
    +      ascii := asciiToInt(letter);
    +   in
    +      letter when ascii >= 65 and ascii <= 90
    +   else
    +      intToAscii(ascii -  32);
    diff --git a/Task/ABC-problem/Smalltalk/abc-problem.st b/Task/ABC-problem/Smalltalk/abc-problem.st
    index d6a10f2fbe..3b23286677 100644
    --- a/Task/ABC-problem/Smalltalk/abc-problem.st
    +++ b/Task/ABC-problem/Smalltalk/abc-problem.st
    @@ -1,21 +1,21 @@
     ABCPuzzle>>test
    -	#('A' 'BARK' 'BOOK' 'TreaT' 'COMMON' 'sQUAD' 'CONFuSE') do: [ :each |
    -		Transcript crShow: each, ': ', (self solveFor: each) asString ]
    +   #('A' 'BARK' 'BOOK' 'TreaT' 'COMMON' 'sQUAD' 'CONFuSE') do: [ :each |
    +      Transcript crShow: each, ': ', (self solveFor: each) asString ]
     
     ABCPuzzle>>solveFor: letters
    -	| blocks |
    -	blocks := #('BO' 'XK' 'DQ' 'CP' 'NA' 'GT' 'RE' 'TG' 'QD' 'FS' 'JW' 'HU' 'VI' 'AN' 'OB' 'ER' 'FS' 'LY' 'PC' 'ZM').
    -	^ self solveFor: letters asUppercase with: blocks asOrderedCollection
    +   | blocks |
    +   blocks := #('BO' 'XK' 'DQ' 'CP' 'NA' 'GT' 'RE' 'TG' 'QD' 'FS' 'JW' 'HU' 'VI' 'AN' 'OB' 'ER' 'FS' 'LY' 'PC' 'ZM').
    +   ^ self solveFor: letters asUppercase with: blocks asOrderedCollection
     
     ABCPuzzle>>solveFor: letters with: blocks
    -	| l ldash matches |
    -	letters isEmpty ifTrue: [ ^ true ].
    -	l := letters first.
    -	ldash := letters allButFirst.
    -	matches := blocks select: [  :b | b includes: l ].
    -	matches isEmpty ifTrue: [ ^ false ].
    -	matches do: [  :m | | bdash |
    -		bdash := blocks copy.
    -		bdash remove: m.
    -		(self solveFor: ldash with: bdash) ifTrue: [ ^ true ] ].
    -	^ false
    +   | l ldash matches |
    +   letters isEmpty ifTrue: [ ^ true ].
    +   l := letters first.
    +   ldash := letters allButFirst.
    +   matches := blocks select: [  :b | b includes: l ].
    +   matches isEmpty ifTrue: [ ^ false ].
    +   matches do: [  :m | | bdash |
    +      bdash := blocks copy.
    +      bdash remove: m.
    +      (self solveFor: ldash with: bdash) ifTrue: [ ^ true ] ].
    +   ^ false
    diff --git a/Task/ABC-problem/Swift/abc-problem-2.swift b/Task/ABC-problem/Swift/abc-problem-2.swift
    index 026a22d936..be73620266 100644
    --- a/Task/ABC-problem/Swift/abc-problem-2.swift
    +++ b/Task/ABC-problem/Swift/abc-problem-2.swift
    @@ -1,20 +1,20 @@
     import Swift
     
     func canMake(word: String) -> Bool {
    -	var blocks = [
    -		"BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS",
    -		"JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM"
    -	]
    -	
    -	for letter in word.uppercased().characters {
    -		guard let index = blocks.index(where: { $0.characters.contains(letter) }) else {
    -			return false
    -		}
    -		
    -		blocks.remove(at: index)
    -	}
    -	
    -	return true
    +   var blocks = [
    +      "BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS",
    +      "JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM"
    +   ]
    +
    +   for letter in word.uppercased().characters {
    +      guard let index = blocks.index(where: { $0.characters.contains(letter) }) else {
    +         return false
    +      }
    +
    +      blocks.remove(at: index)
    +   }
    +
    +   return true
     }
     
     let words = ["a", "bARK", "boOK", "TreAt", "CoMmon", "SquAd", "CONFUse"]
    diff --git a/Task/ABC-problem/Tcl/abc-problem.tcl b/Task/ABC-problem/Tcl/abc-problem.tcl
    index d3f4b8f321..7dab1aa0e6 100644
    --- a/Task/ABC-problem/Tcl/abc-problem.tcl
    +++ b/Task/ABC-problem/Tcl/abc-problem.tcl
    @@ -2,16 +2,16 @@ package require Tcl 8.6
     
     proc abc {word {blocks {BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM}}} {
         set abc {{letters blocks abc} {
    -	set rest [lassign $letters ch]
    -	set i 0
    -	foreach blk $blocks {
    -	    if {$ch in $blk && (![llength $rest]
    -		    || [apply $abc $rest [lreplace $blocks $i $i] $abc])} {
    -		return true
    -	    }
    -	    incr i
    -	}
    -	return false
    +   set rest [lassign $letters ch]
    +   set i 0
    +   foreach blk $blocks {
    +       if {$ch in $blk && (![llength $rest]
    +          || [apply $abc $rest [lreplace $blocks $i $i] $abc])} {
    +      return true
    +       }
    +       incr i
    +   }
    +   return false
         }}
         return [apply $abc [split $word ""] [lmap b $blocks {split $b ""}] $abc]
     }
    diff --git a/Task/ABC-problem/Transd/abc-problem.transd b/Task/ABC-problem/Transd/abc-problem.transd
    index 3ac73650a8..b0bf878924 100644
    --- a/Task/ABC-problem/Transd/abc-problem.transd
    +++ b/Task/ABC-problem/Transd/abc-problem.transd
    @@ -2,7 +2,7 @@
     
     MainModule: {
         blocks: ["BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS",
    -		"JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM"],
    +      "JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM"],
         words: ["A","BARK","BOOK","TREAT","COMMON","SQUAD","CONFUSE"],
     
         testMake: Lambda Bool>(λ
    @@ -16,7 +16,7 @@ MainModule: {
             )
             (ret false)
         ),
    -	_start: (lambda
    +   _start: (lambda
             (for word in words do
                 (lout :boolalpha word " : "
                     (exec testMake word blocks))
    diff --git a/Task/ABC-problem/Uiua/abc-problem.uiua b/Task/ABC-problem/Uiua/abc-problem.uiua
    new file mode 100644
    index 0000000000..244ecba154
    --- /dev/null
    +++ b/Task/ABC-problem/Uiua/abc-problem.uiua
    @@ -0,0 +1,4 @@
    +s   ← "BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM"
    +Flt ← ⊂⊙↘₂⊃↙↘-⊸◿2⊸˜⨂ # remove block holding letter
    +{"A" "BARK" "BOOK" "TREAT" "COMMON" "SQUAD" "CONFUSE"}
    +≡⊂⟜⍚(◌◌⍥(⍥(⊙⊙⋅0)⊸≍⟜˜Flt⊙°⊂)◡⋅⧻ s ⊙1)
    diff --git a/Task/ABC-problem/Ultimate++/abc-problem.ultimate++ b/Task/ABC-problem/Ultimate++/abc-problem.ultimate++
    index 13a35283ad..fbfcebdcc0 100644
    --- a/Task/ABC-problem/Ultimate++/abc-problem.ultimate++
    +++ b/Task/ABC-problem/Ultimate++/abc-problem.ultimate++
    @@ -19,84 +19,84 @@ using namespace Upp;
     
     int can_make_words(char **b, char *word)
     {
    -	int i, ret = 0, c = toupper(*word);
    -	
    -	if (!c) return 1;
    -	if (!b[0]) return 0;
    -	
    -	for (i = 0; b[i] && !ret; i++) {
    -		if (b[i][0] != c && b[i][1] != c) continue;
    -		Swap(b[i], b[0]);  // It needs to be Swap and not SWAP
    -		ret = can_make_words(b + 1, word + 1);
    -		Swap(b[i], b[0]);  // It needs to be Swap instead of SWAP
    -	}
    -	return ret;
    +   int i, ret = 0, c = toupper(*word);
    +
    +   if (!c) return 1;
    +   if (!b[0]) return 0;
    +
    +   for (i = 0; b[i] && !ret; i++) {
    +      if (b[i][0] != c && b[i][1] != c) continue;
    +      Swap(b[i], b[0]);  // It needs to be Swap and not SWAP
    +      ret = can_make_words(b + 1, word + 1);
    +      Swap(b[i], b[0]);  // It needs to be Swap instead of SWAP
    +   }
    +   return ret;
     }
     
     
     //C++
     
     bool can_create_word(const std::string& w, const list_t& vals) {
    -	std::set used;
    -	while (used.size() < w.size()) {
    -		const char c = toupper(w[used.size()]);
    -		uint32_t x = used.size();
    -		for (uint32_t i = 0, ii = vals.size(); i < ii; ++i) {
    -			if (used.find(i) == used.end()) {
    -				if (toupper(vals[i].first) == c || toupper(vals[i].second) == c) {
    -					used.insert(i);
    -					break;
    -				}
    -			}
    -		}
    -		if (x == used.size()) break;
    -	}
    -	return used.size() == w.size();
    +   std::set used;
    +   while (used.size() < w.size()) {
    +      const char c = toupper(w[used.size()]);
    +      uint32_t x = used.size();
    +      for (uint32_t i = 0, ii = vals.size(); i < ii; ++i) {
    +         if (used.find(i) == used.end()) {
    +            if (toupper(vals[i].first) == c || toupper(vals[i].second) == c) {
    +               used.insert(i);
    +               break;
    +            }
    +         }
    +      }
    +      if (x == used.size()) break;
    +   }
    +   return used.size() == w.size();
     }
     
     
     // U++
     CONSOLE_APP_MAIN
     {
    -	// C
    -	char* blocks[] =
    -	{
    -		(char*)"BO", (char*)"XK", (char*)"DQ", (char*)"CP",
    -		(char*)"NA", (char*)"GT", (char*)"RE", (char*)"TG",
    -		(char*)"QD", (char*)"FS", (char*)"JW", (char*)"HU",
    -		(char*)"VI", (char*)"AN", (char*)"OB", (char*)"ER",
    -		(char*)"FS", (char*)"LY", (char*)"PC", (char*)"ZM", 0
    -	};
    +   // C
    +   char* blocks[] =
    +   {
    +      (char*)"BO", (char*)"XK", (char*)"DQ", (char*)"CP",
    +      (char*)"NA", (char*)"GT", (char*)"RE", (char*)"TG",
    +      (char*)"QD", (char*)"FS", (char*)"JW", (char*)"HU",
    +      (char*)"VI", (char*)"AN", (char*)"OB", (char*)"ER",
    +      (char*)"FS", (char*)"LY", (char*)"PC", (char*)"ZM", 0
    +   };
     
    -	char *words[] =
    -	{
    -		(char*)"", (char*)"A", (char*)"BARK", (char*)"BOOK",
    -		(char*)"TREAT", (char*)"COMMON", (char*)"SQUAD", (char*)"Confuse", 0
    -	};
    -	
    -	char **w;
    -	for (w = words; *w; w++)
    -		printf("%s\t%d\n", *w, can_make_words(blocks, *w));	
    -	
    -	printf("\n");
    -	
    -	// C++
    -	list_t vals{ {'B', 'O'}, {'X', 'K'}, {'D', 'Q'}, {'C', 'P'},
    -		{'N', 'A'}, {'G', 'T'}, {'R', 'E'}, {'T', 'G'}, {'Q', 'D'},
    -		{'F', 'S'}, {'J', 'W'}, {'H', 'U'}, {'V', 'I'}, {'A', 'N'},
    -		{'O', 'B'}, {'E', 'R'}, {'F', 'S'}, {'L', 'Y'}, {'P', 'C'},
    -		{'Z', 'M'}
    -	};
    -	std::vector wordsb{"A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "Confuse"};
    -	for (const std::string& w : wordsb) {
    -		std::cout << w << ": " << std::boolalpha << can_create_word(w, vals) << ".\n";
    -	}
    -	std::cout << "\n";
    -	
    +   char *words[] =
    +   {
    +      (char*)"", (char*)"A", (char*)"BARK", (char*)"BOOK",
    +      (char*)"TREAT", (char*)"COMMON", (char*)"SQUAD", (char*)"Confuse", 0
    +   };
     
    -	
    -	const Vector& cmdline = CommandLine();
    -	for(int i = 0; i < cmdline.GetCount(); i++) {
    -	}
    +   char **w;
    +   for (w = words; *w; w++)
    +      printf("%s\t%d\n", *w, can_make_words(blocks, *w));
    +
    +   printf("\n");
    +
    +   // C++
    +   list_t vals{ {'B', 'O'}, {'X', 'K'}, {'D', 'Q'}, {'C', 'P'},
    +      {'N', 'A'}, {'G', 'T'}, {'R', 'E'}, {'T', 'G'}, {'Q', 'D'},
    +      {'F', 'S'}, {'J', 'W'}, {'H', 'U'}, {'V', 'I'}, {'A', 'N'},
    +      {'O', 'B'}, {'E', 'R'}, {'F', 'S'}, {'L', 'Y'}, {'P', 'C'},
    +      {'Z', 'M'}
    +   };
    +   std::vector wordsb{"A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "Confuse"};
    +   for (const std::string& w : wordsb) {
    +      std::cout << w << ": " << std::boolalpha << can_create_word(w, vals) << ".\n";
    +   }
    +   std::cout << "\n";
    +
    +
    +
    +   const Vector& cmdline = CommandLine();
    +   for(int i = 0; i < cmdline.GetCount(); i++) {
    +   }
     
     }
    diff --git a/Task/ABC-problem/V-(Vlang)/abc-problem.v b/Task/ABC-problem/V-(Vlang)/abc-problem.v
    index fbda461417..f34fa80d4b 100644
    --- a/Task/ABC-problem/V-(Vlang)/abc-problem.v
    +++ b/Task/ABC-problem/V-(Vlang)/abc-problem.v
    @@ -1,29 +1,28 @@
    -const
    -(
    -	blocks = ["BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS","JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"]
    -	words = ["A", BARK","BOOK","TREAT","COMMON","SQUAD","CONFUSE"]
    -)
    +const blocks = ["BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS",
    +"JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"]
    +
    +const words = ["A", "BARK","BOOK","TREAT","COMMON","SQUAD","CONFUSE"]
     
     fn main() {
    -	for word in words {
    -		println('>>> can_make_word("${word.to_upper()}"): ')
    -		if check_word(word, blocks) == true {println('True')} else {println('False')}
    -	}
    +   for word in words {
    +      println('>>> can_make_word("${word.to_upper()}"): ')
    +      if check_word(word, blocks) == true { println("True") } else { println("False") }
    +   }
     }
     
     fn check_word(word string, blocks []string) bool {
    -	mut tblocks := blocks.clone()
    -	mut found := false
    -	for chr in word {
    -		found = false
    -		for idx, _ in tblocks {
    -			if tblocks[idx].contains(chr.ascii_str()) == true {
    -				tblocks[idx] =''
    -				found = true
    -				break
    -			}
    -		}
    -		if found == false {return found}
    -	}
    -	return found
    +   mut tblocks := blocks.clone()
    +   mut found := false
    +   for chr in word {
    +      found = false
    +      for idx, _ in tblocks {
    +         if tblocks[idx].contains(chr.ascii_str()) == true {
    +            tblocks[idx] =""
    +            found = true
    +            break
    +         }
    +      }
    +      if found == false { return found }
    +   }
    +   return found
     }
    diff --git a/Task/ABC-problem/Wren/abc-problem.wren b/Task/ABC-problem/Wren/abc-problem.wren
    index dc23f745ee..c52a293bc4 100644
    --- a/Task/ABC-problem/Wren/abc-problem.wren
    +++ b/Task/ABC-problem/Wren/abc-problem.wren
    @@ -1,4 +1,4 @@
    -import "/fmt" for Fmt
    +import "./fmt" for Fmt
     
     var r // recursive
     r = Fn.new { |word, bl|
    @@ -25,5 +25,5 @@ var newSpeller = Fn.new { |blocks|
     
     var sp = newSpeller.call("BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM")
     for (word in ["A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "CONFUSE"]) {
    -    System.print("%(Fmt.s(-7, word)) %(sp.call(word))")
    +    Fmt.print("$-7s $s", word, sp.call(word))
     }
    diff --git a/Task/ABC-problem/Yabasic/abc-problem.basic b/Task/ABC-problem/Yabasic/abc-problem.basic
    index c2e561b9f7..d7db87519a 100644
    --- a/Task/ABC-problem/Yabasic/abc-problem.basic
    +++ b/Task/ABC-problem/Yabasic/abc-problem.basic
    @@ -1,28 +1,28 @@
     letters$ = "BO,XK,DQ,CP,NA,GT,RE,TG,QD,FS,JW,HU,VI,AN,OB,ER,FS,LY,PC,ZM"
     
     sub canMake(letters$, word$)
    -	local i, j, p, n, pairs$(1)
    -	
    -	n = token(letters$, pairs$(), ",")
    -	word$ = upper$(word$)
    -	
    -	for i = 1 to len(word$)
    -		for j = 1 to n
    -			p = instr(pairs$(j), mid$(word$, i, 1))
    -			if p then
    -				pairs$(j) = ""
    -				break
    -			end if
    -		next j
    -		if not p return false
    -	next i
    -	return true
    +   local i, j, p, n, pairs$(1)
    +
    +   n = token(letters$, pairs$(), ",")
    +   word$ = upper$(word$)
    +
    +   for i = 1 to len(word$)
    +      for j = 1 to n
    +         p = instr(pairs$(j), mid$(word$, i, 1))
    +         if p then
    +            pairs$(j) = ""
    +            break
    +         end if
    +      next j
    +      if not p return false
    +   next i
    +   return true
     end sub
     
    -print "a = ", canMake(letters$, "a")	// 1 = true
    -print "bark = ", canMake(letters$, "Bark")	// 1
    -print "book = ", canMake(letters$, "BooK")	// 0 = false
    -print "treat = ", canMake(letters$, "TREAt")	// 1
    -print "common = ", canMake(letters$, "common")	// 0
    -print "squad = ", canMake(letters$, "squad")	// 1
    -print "confuse = ", canMake(letters$, "confuse")	// 1
    +print "a = ", canMake(letters$, "a")   // 1 = true
    +print "bark = ", canMake(letters$, "Bark")   // 1
    +print "book = ", canMake(letters$, "BooK")   // 0 = false
    +print "treat = ", canMake(letters$, "TREAt") // 1
    +print "common = ", canMake(letters$, "common")  // 0
    +print "squad = ", canMake(letters$, "squad") // 1
    +print "confuse = ", canMake(letters$, "confuse")   // 1
    diff --git a/Task/ABC-problem/Zig/abc-problem.zig b/Task/ABC-problem/Zig/abc-problem.zig
    new file mode 100644
    index 0000000000..ea586f7323
    --- /dev/null
    +++ b/Task/ABC-problem/Zig/abc-problem.zig
    @@ -0,0 +1,54 @@
    +const std = @import("std");
    +
    +const Block: type = struct { Char1: u8, Char2: u8 };
    +const BLOCK_SIZE: comptime_int = 20;
    +const blocks: [BLOCK_SIZE]Block = .{
    +    .{ .Char1 = 'B', .Char2 = 'O' }, .{ .Char1 = 'X', .Char2 = 'K' },
    +    .{ .Char1 = 'D', .Char2 = 'Q' }, .{ .Char1 = 'C', .Char2 = 'P' },
    +    .{ .Char1 = 'N', .Char2 = 'A' }, .{ .Char1 = 'G', .Char2 = 'T' },
    +    .{ .Char1 = 'R', .Char2 = 'E' }, .{ .Char1 = 'T', .Char2 = 'G' },
    +    .{ .Char1 = 'Q', .Char2 = 'D' }, .{ .Char1 = 'F', .Char2 = 'S' },
    +    .{ .Char1 = 'J', .Char2 = 'W' }, .{ .Char1 = 'H', .Char2 = 'U' },
    +    .{ .Char1 = 'V', .Char2 = 'I' }, .{ .Char1 = 'A', .Char2 = 'N' },
    +    .{ .Char1 = 'O', .Char2 = 'B' }, .{ .Char1 = 'E', .Char2 = 'R' },
    +    .{ .Char1 = 'F', .Char2 = 'S' }, .{ .Char1 = 'L', .Char2 = 'Y' },
    +    .{ .Char1 = 'P', .Char2 = 'C' }, .{ .Char1 = 'Z', .Char2 = 'M' },
    +};
    +
    +fn can_make_word(word: []const u8) bool {
    +    var marked: [BLOCK_SIZE]bool = [_]bool{false} ** BLOCK_SIZE;
    +
    +    for (word) |char| {
    +        var hasBlock: bool = false;
    +
    +        for (blocks, 0..) |block, index| {
    +            if ((block.Char1 == char or block.Char2 == char) and !marked[index]) {
    +                hasBlock = true;
    +                marked[index] = true;
    +                break;
    +            }
    +        }
    +
    +        if (!hasBlock) {
    +            return false;
    +        }
    +    }
    +
    +    return true;
    +}
    +
    +pub fn main() !void {
    +    const words: []const []const u8 = &.{
    +        "A",
    +        "BARK",
    +        "BOOK",
    +        "TREAT",
    +        "COMMON",
    +        "SQUAD",
    +        "CONFUSE",
    +    };
    +
    +    for (words) |word| {
    +        std.debug.print("{s}\t{any}\n", .{ word, can_make_word(word) });
    +    }
    +}
    diff --git a/Task/ABC-problem/Zkl/abc-problem.zkl b/Task/ABC-problem/Zkl/abc-problem.zkl
    index 66da4854fc..a34c775681 100644
    --- a/Task/ABC-problem/Zkl/abc-problem.zkl
    +++ b/Task/ABC-problem/Zkl/abc-problem.zkl
    @@ -1,14 +1,14 @@
     var blocks=T("BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS",
    -	     "JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM", );
    +        "JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM", );
     
     fcn can_make_word(word){
        fcn(blks,word){
           if (not word) return(True);  // bottom of recursion
           foreach b in (blks){ n:=__bWalker.idx;
    -	 if(not b.holds(word[0])) continue; // letter not on this block
    -	 blks.del(n);		// remove this block from pile
    -	 if (self.fcn(blks,word[1,*])) return(True);  // try remaining blocks
    -	 blks.insert(n,b);	// put block back in pile: backtracking
    +    if(not b.holds(word[0])) continue; // letter not on this block
    +    blks.del(n);     // remove this block from pile
    +    if (self.fcn(blks,word[1,*])) return(True);  // try remaining blocks
    +    blks.insert(n,b);   // put block back in pile: backtracking
           }
           False;   // out of blocks but not out of word
        }(blocks.copy(),word.toUpper())
    diff --git a/Task/ABC-problem/Zonnon/abc-problem.zonnon b/Task/ABC-problem/Zonnon/abc-problem.zonnon
    index c0dde3c245..731ebadcf1 100644
    --- a/Task/ABC-problem/Zonnon/abc-problem.zonnon
    +++ b/Task/ABC-problem/Zonnon/abc-problem.zonnon
    @@ -1,87 +1,87 @@
     module Main;
     type
    -	Block = record
    -		l,r: char;
    -		used: boolean;
    -	end Block;
    +   Block = record
    +      l,r: char;
    +      used: boolean;
    +   end Block;
     
     var
    -	blocks: array 20 of Block;
    +   blocks: array 20 of Block;
     
     procedure Exists(c: char): boolean;
     var
    -	i: integer;
    -	r: boolean;
    +   i: integer;
    +   r: boolean;
     begin
    -	r := false;i := 0;
    -	while ~r & (i < len(blocks)) do
    -		if ~(blocks[i].used) then
    -			r := (blocks[i].l = cap(c)) or (blocks[i].r = cap(c));
    -			blocks[i].used := r;
    -		end;
    -		inc(i)
    -	end;
    -	return r
    +   r := false;i := 0;
    +   while ~r & (i < len(blocks)) do
    +      if ~(blocks[i].used) then
    +         r := (blocks[i].l = cap(c)) or (blocks[i].r = cap(c));
    +         blocks[i].used := r;
    +      end;
    +      inc(i)
    +   end;
    +   return r
     end Exists;
     
     procedure CanMakeWord(s: string);
     var
    -	i: integer;
    -	made: boolean;
    +   i: integer;
    +   made: boolean;
     begin
    -	made := true;
    -	for i := 0 to len(s) - 1 do
    -		made := made & Exists(s[i])
    -	end;
    -	writeln(s:20,"?",made);
    -	Clean()	
    +   made := true;
    +   for i := 0 to len(s) - 1 do
    +      made := made & Exists(s[i])
    +   end;
    +   writeln(s:20,"?",made);
    +   Clean()
     end CanMakeWord;
     
     procedure Clean();
     var
    -	i: integer;
    +   i: integer;
     begin
    -	for i := 0 to len(blocks) - 1 do
    -		blocks[i].used := false
    -	end
    +   for i := 0 to len(blocks) - 1 do
    +      blocks[i].used := false
    +   end
     end Clean;
     
     procedure InitBlock(i:integer;l,r:char);
     begin
    -	blocks[i].l := l;blocks[i].r := r;
    -	blocks[i].used := false;
    +   blocks[i].l := l;blocks[i].r := r;
    +   blocks[i].used := false;
     end InitBlock;
     
     procedure Init;
     begin
    -	InitBlock(0,'B','O');
    -	InitBlock(1,'X','K');
    -	InitBlock(2,'D','Q');
    -	InitBlock(3,'C','Q');
    -	InitBlock(4,'N','A');
    -	InitBlock(5,'G','T');
    -	InitBlock(6,'R','E');
    -	InitBlock(7,'T','G');
    -	InitBlock(8,'Q','D');
    -	InitBlock(9,'F','S');
    -	InitBlock(10,'J','W');
    -	InitBlock(11,'H','U');
    -	InitBlock(12,'V','I');
    -	InitBlock(13,'A','N');
    -	InitBlock(14,'O','B');
    -	InitBlock(15,'E','R');
    -	InitBlock(16,'F','S');
    -	InitBlock(17,'L','Y');
    -	InitBlock(18,'P','C');
    -	InitBlock(19,'Z','M')
    +   InitBlock(0,'B','O');
    +   InitBlock(1,'X','K');
    +   InitBlock(2,'D','Q');
    +   InitBlock(3,'C','Q');
    +   InitBlock(4,'N','A');
    +   InitBlock(5,'G','T');
    +   InitBlock(6,'R','E');
    +   InitBlock(7,'T','G');
    +   InitBlock(8,'Q','D');
    +   InitBlock(9,'F','S');
    +   InitBlock(10,'J','W');
    +   InitBlock(11,'H','U');
    +   InitBlock(12,'V','I');
    +   InitBlock(13,'A','N');
    +   InitBlock(14,'O','B');
    +   InitBlock(15,'E','R');
    +   InitBlock(16,'F','S');
    +   InitBlock(17,'L','Y');
    +   InitBlock(18,'P','C');
    +   InitBlock(19,'Z','M')
     end Init;
     
     begin
    -	Init();
    -	CanMakeWord("A");
    -	CanMakeWord("BARK");
    -	CanMakeWord("BOOK");
    -	CanMakeWord("TREAT");
    -	CanMakeWord("COMMON");
    -	CanMakeWord("confuse");
    +   Init();
    +   CanMakeWord("A");
    +   CanMakeWord("BARK");
    +   CanMakeWord("BOOK");
    +   CanMakeWord("TREAT");
    +   CanMakeWord("COMMON");
    +   CanMakeWord("confuse");
     end Main.
    diff --git a/Task/ADFGVX-cipher/11l/adfgvx-cipher.11l b/Task/ADFGVX-cipher/11l/adfgvx-cipher.11l
    index e1dd671422..739e221d0a 100644
    --- a/Task/ADFGVX-cipher/11l/adfgvx-cipher.11l
    +++ b/Task/ADFGVX-cipher/11l/adfgvx-cipher.11l
    @@ -3,8 +3,8 @@ V adfgvx = ‘ADFGVX’
     F encrypt(plainText, polybius, key)
        V s = ‘’
        L(ch) plainText
    -      L(r) 6
    -         L(c) 6
    +      L(r) 0.<6
    +         L(c) 0.<6
                 I polybius[r][c] == ch
                    s ‘’= :adfgvx[r]‘’:adfgvx[c]
     
    @@ -43,8 +43,8 @@ F decrypt(cipherText, polybius, key)
     V polybius = [[Char("\0")] * 6] * 6
     V alphabet = ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789’
     random:shuffle(&alphabet)
    -L(r) 6
    -   L(c) 6
    +L(r) 0.<6
    +   L(c) 0.<6
           polybius[r][c] = alphabet[6 * r + c]
     
     print("6 x 6 Polybius square:\n")
    diff --git a/Task/ADFGVX-cipher/APL/adfgvx-cipher.apl b/Task/ADFGVX-cipher/APL/adfgvx-cipher.apl
    new file mode 100644
    index 0000000000..93c8c07787
    --- /dev/null
    +++ b/Task/ADFGVX-cipher/APL/adfgvx-cipher.apl
    @@ -0,0 +1,39 @@
    +adfgvx←{
    +    n←⎕NS''
    +    n.split←↑{⍺≥⍴⍵:⊂⍵ ⋄ (⊂⍺↑⍵),⍺∇⍺↓⍵}
    +
    +    n.enc←⍺{
    +        t←∊(∘.,⍨'ADFGVX')[⊃∘⍸∘(⍺⍺∘=)¨⍵]
    +        w←↓⍉((⍴⍵⍵)split t)[;⍋⍵⍵]
    +        1↓∊' ',¨w~¨' '
    +    }⍵
    +
    +    n.dec←⍺{
    +        t←↓2 split (∊(⍉↑⍵⊆⍨' '≠⍵)[;⍋⍋⍵⍵])~' '
    +        ⍺⍺['ADFGVX'∘⍳¨t]
    +    }⍵
    +
    +    n
    +}
    +
    +adfgvx_test←{
    +    square←6 6⍴(⎕A,⎕D)[?⍨36]
    +    ⎕←'Polybius square:'
    +    ⎕←' ─ADFGVX','│┼││││││','A D F G V X' ⍪'─'⍪(11⍴1 0)\square
    +    ⎕←''
    +
    +    key←{
    +        file←'e:\unixdict.txt'
    +        dict←(~data∊⎕TC)⊆data←⊃⎕NGET file
    +        dict←(⍵{⍺=≢⍵}¨dict)/dict
    +        dict←({⍵≡∪⍵}¨dict)/dict
    +        1⎕C ⊃dict[?⍴dict]
    +    }9
    +    ⎕←'Key: ',key
    +
    +    a←square adfgvx key
    +
    +    ⎕←'Plaintext: ',plaintext←'ATTACKAT1200AM'
    +    ⎕←'Encrypted: ',encrypted←a.enc plaintext
    +    ⎕←'Decrypted: ',a.dec encrypted
    +}
    diff --git a/Task/ADFGVX-cipher/C++/adfgvx-cipher.cpp b/Task/ADFGVX-cipher/C++/adfgvx-cipher.cpp
    new file mode 100644
    index 0000000000..d43f9d79e9
    --- /dev/null
    +++ b/Task/ADFGVX-cipher/C++/adfgvx-cipher.cpp
    @@ -0,0 +1,133 @@
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +
    +const std::string ADFGVX = "ADFGVX";
    +const std::string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    +
    +std::random_device random;
    +std::mt19937 mersenne_twister(random());
    +
    +std::vector> initialise_polybius_square() {
    +	std::vector letters(ALPHABET.begin(), ALPHABET.end());
    +	std::shuffle(letters.begin(), letters.end(), mersenne_twister);
    +
    +	std::vector> result = { 6, std::vector(6, 0) };
    +	for ( int32_t row = 0; row < 6; ++row ) {
    +		for ( int32_t column = 0; column < 6; ++column ) {
    +			result[row][column] = letters[6 * row + column];
    +		}
    +	}
    +	return result;
    +}
    +
    +// Create a key using a word from the dictionary 'unixdict.txt'
    +std::string create_key(const uint64_t& size) {
    +	if ( size < 7 || size > 12 ) {
    +		throw std::invalid_argument("Key should contain between 7 and 12 letters, both inclusive.");
    +	}
    +
    +	std::vector candidates;
    +	std::fstream file_stream;
    +	file_stream.open("../unixdict.txt");
    +	std::string word;
    +	while ( file_stream >> word ) {
    +		if ( word.length() == size &&
    +			word.length() == std::unordered_set{ word.begin(), word.end() }.size() ) {
    +			std::transform(word.begin(), word.end(), word.begin(), [](const char& ch){ return std::toupper(ch); });
    +			if ( word.find_first_not_of(ALPHABET) == std::string::npos ) {
    +				candidates.emplace_back(word);
    +			}
    +		}
    +	}
    +	std::shuffle(candidates.begin(), candidates.end(), mersenne_twister);
    +	std::string key = candidates[0];
    +	return key;
    +}
    +
    +std::string encrypt(const std::string& plain_text,
    +					const std::vector>& polybius,
    +					const std::string& key) {
    +	std::string code = "";
    +	for ( const char& ch : plain_text ) {
    +		for ( int32_t row = 0; row < 6; ++row ) {
    +			for ( int32_t column = 0; column < 6; ++column ) {
    +				if ( polybius[row][column] == ch ) {
    +					code += ADFGVX[row];
    +					code += ADFGVX[column];
    +				}
    +			}
    +		}
    +	}
    +
    +	std::string encrypted = "";
    +	for ( const char& ch : key ) {
    +		for ( uint64_t i = key.find(ch); i < code.length(); i += key.length() ) {
    +			encrypted += code[i];
    +		}
    +		encrypted += " ";
    +	}
    +	return encrypted;
    +}
    +
    +std::string decrypt(const std::string& encrypted_text,
    +					const std::vector>& polybius,
    +					const std::string& key) {
    +	const uint64_t space_count = std::count(encrypted_text.begin(), encrypted_text.end(), ' ');
    +	const uint64_t code_size = encrypted_text.length() - space_count;
    +
    +	std::vector blocks;
    +	std::stringstream stream(encrypted_text);
    +	std:: string word;
    +	while ( stream >> word ) {
    +	    blocks.emplace_back(word);
    +	}
    +
    +	std::string code = "";
    +	for ( int32_t i = 0; code.length() < code_size; ++i ) {
    +		for ( const std::string& block : blocks ) {
    +			if ( code.length() < code_size ) {
    +				code += block[i];
    +			}
    +		}
    +	}
    +
    +	std::string plain_text = "";
    +	for ( uint64_t i = 0; i < code_size - 1; i += 2 ) {
    +		int32_t row = ADFGVX.find(code[i]);
    +		int32_t column = ADFGVX.find(code[i + 1]);
    +		plain_text += polybius[row][column];
    +	}
    +	return plain_text;
    +}
    +
    +int main() {
    +	const std::vector> polybius = initialise_polybius_square();
    +	std::cout << "The 6 x 6 Polybius square:" << std::endl;
    +	std::cout << " | A D F G V X" << std::endl;
    +	std::cout << "--------------" << std::endl;
    +	for ( int32_t row = 0; row < 6; ++row ) {
    +		std::cout << ADFGVX[row] << "|";
    +		for ( int32_t column = 0; column < 6; ++column ) {
    +			std::cout << " " << polybius[row][column];
    +		}
    +		std::cout << std::endl;
    +	}
    +	std::cout << std::endl;
    +
    +	const std::string key = create_key(9);
    +	std::cout << "The key is " << key << std::endl << std::endl;
    +	const std::string plain_text = "ATTACKAT1200AM";
    +	std::cout << "Plain text: " << plain_text <
    +    s.Length >= 7 && s.Length <= 12 && s.Length == s.Distinct().Count() && s.All(symbols.ToLowerInvariant().Contains);
    +
    +var keys = File.ReadAllLines("unixdict.txt").Where(IsSuitableTranspositionKey).ToArray();
    +var key = keys[Random.Shared.Next(keys.Length)].ToUpperInvariant();
    +Console.WriteLine();
    +Console.WriteLine($"The key is {key}");
    +var plaintext = "ATTACKAT1200AM";
    +Console.WriteLine($"Plaintext: {plaintext}");
    +
    +string Encrypt(string plaintext, string key, int[] square)
    +{
    +    // Create a lookup table from symbol to fragment
    +    var map = (from i in Enumerable.Range(0, size)
    +               let k = square[i]
    +               let code = cypher[i / N] + "" + cypher[i % N]
    +               select (k, code))
    +               .ToDictionary(kc => symbols[kc.k], kc => kc.code);
    +
    +    // Map the plaintext to fragments
    +    var e = string.Join("", plaintext.Select(c => map[c]));
    +
    +    // Determine number of rows
    +    var K = key.Length;
    +    var rows = (e.Length + K - 1) / K;
    +
    +    // Pad with spaces
    +    e += new string(' ', rows * K - e.Length);
    +
    +    // Sort the key
    +    var order = string.Join("", key.OrderBy(c => c)).Select(c => key.IndexOf(c)).ToArray();
    +
    +    // Reorder the fragments.
    +    e = string.Join("", Enumerable.Range(0, K * rows).Select(i => e[(i / K) * K + order[i % K]]));
    +
    +    // Transpose
    +    e = new([.. from col in Enumerable.Range(0, K)
    +                from row in Enumerable.Range(0, rows)
    +                select e[row * K + col]]);
    +
    +    // Read off each column.
    +    return string.Join(" ", Enumerable.Range(0, K).Select(col => e.Substring(col * rows, rows).Trim()));
    +}
    +
    +var encrypted = Encrypt(plaintext, key, square);
    +Console.WriteLine($"Encrypted: {encrypted}");
    +
    +string Decrypt(string encrypted, string key, int[] square)
    +{
    +    // Create a lookup table from fragment to symbol
    +    var map = (from i in Enumerable.Range(0, size)
    +               let k = square[i]
    +               let code = cypher[i / N] + "" + cypher[i % N]
    +               select (k, code))
    +               .ToDictionary(kc => kc.code, kc => symbols[kc.k]);
    +
    +    // Split into columns
    +    var cols = encrypted.Split(' ');
    +
    +    // Determine number of rows
    +    var K = key.Length;
    +    var rows = cols.Max(c => c.Length);
    +
    +    // Pad each column
    +    cols = [.. cols.Select(c => c.PadRight(rows))];
    +
    +    // Transpose
    +    string e = new([.. from row in Enumerable.Range(0, rows)
    +                       from col in Enumerable.Range(0, K)
    +                       select cols[col][row]]);
    +
    +    // Sort the key
    +    var sorted = string.Join("", key.OrderBy(c => c));
    +    var order = key.Select(c => sorted.IndexOf(c)).ToArray();
    +
    +    // Reorder the fragments
    +    e = string.Join("", Enumerable.Range(0, K * rows).Select(i => e[(i / K) * K + order[i % K]])).Trim();
    +
    +    // Map the fragments to plaintext
    +    return string.Join("", Enumerable.Range(0, e.Length / 2).Select(i => map[e.Substring(2 * i, 2)]));
    +}
    +
    +var decrypted = Decrypt(encrypted, key, square);
    +Console.WriteLine($"Decrypted: {decrypted}");
    diff --git a/Task/ADFGVX-cipher/Crystal/adfgvx-cipher.cr b/Task/ADFGVX-cipher/Crystal/adfgvx-cipher.cr
    new file mode 100644
    index 0000000000..3236abc45a
    --- /dev/null
    +++ b/Task/ADFGVX-cipher/Crystal/adfgvx-cipher.cr
    @@ -0,0 +1,62 @@
    +def make_square
    +  # it's a square at heart...
    +  (('A'..'Z').to_a + ('0'..'9').to_a).shuffle!
    +end
    +
    +def make_key (size)
    +  words = File.open("unixdict.txt") do |f|
    +    f.each_line.select {|w| w.size == size && w.chars.to_set.size == size }.to_a
    +  end
    +  raise "no suitable key found" if words.empty?
    +  words.sample
    +end
    +
    +def adfgvx_encrypt (message, square, key)
    +  h = "ADFGVX".chars
    +  message.chars.flat_map {|ch|
    +    row, col = square.index!(ch).divmod(6)
    +    [ h[row], h[col] ]
    +  }
    +    .in_groups_of(key.size)
    +    .transpose
    +    .zip(key.chars)
    +    .sort_by {|_, key| key }
    +    .map {|col, _| col.join }
    +    .join(" ")
    +end
    +
    +def adfgvx_decrypt (message, square, key)
    +  h = "ADFGVX".chars
    +  sorted_key = key.chars.sort!
    +  cols = message.split.map &.chars
    +  max_size = cols.max_of &.size
    +  cols.map {|col| col + [nil]*(max_size-col.size) }
    +    .zip(sorted_key)
    +    .sort_by {|_, ch| key.index! ch }
    +    .map {|col, _| col }
    +    .transpose
    +    .flatten.compact
    +    .in_slices_of(2)
    +    .map {|(row, col)| square[ h.index!(row)*6 + h.index!(col) ] }
    +    .join
    +end
    +
    +def show (title, message, square, key)
    +  encrypted = adfgvx_encrypt message, square, key
    +  decrypted = adfgvx_decrypt encrypted, square, key
    +  puts title
    +  puts " - Alphabet: #{square.join}"
    +  puts " - Key:      #{key}"
    +  puts " - Message:   #{message}"
    +  puts " - Encrypted: #{encrypted}"
    +  puts " - Decrypted: #{decrypted}"
    +  puts
    +end
    +
    +message = "ATTACKAT1200AM"
    +
    +wiki_square = "NA1C3H8TB2OME5WRPD4F6G7I9J0KLQSUVXYZ".chars
    +wiki_key = "PRIVACY"
    +
    +show "Wikipedia example:", message, wiki_square, wiki_key
    +show "Random square and key:", message, make_square, make_key(9)
    diff --git a/Task/ADFGVX-cipher/Fortran/adfgvx-cipher.f b/Task/ADFGVX-cipher/Fortran/adfgvx-cipher.f
    new file mode 100644
    index 0000000000..40af143af8
    --- /dev/null
    +++ b/Task/ADFGVX-cipher/Fortran/adfgvx-cipher.f
    @@ -0,0 +1,618 @@
    +!
    +! ADFGVX Cipher
    +! tested with Intel ifx (IFX) 2025.2.1 20250806             on Kubuntu 25.10
    +!             GNU Fortran (Ubuntu 15.2.0-4ubuntu4) 15.2.0   on Kubuntu 25.10
    +! VSI Fortran on VMS does not compile it because it cannot handle
    +! allocatable character strings.
    +! U.B., December 2025
    +!==============================================================================
    +
    +program ADFGVXCipher
    +
    +  implicit none
    +
    +  logical, parameter :: DEBUG = .false.     ! set to .true. for reproducable, not random results
    +  logical, parameter :: VERBOSE = .false.   ! set this to .true. to print some intermediate results
    +  integer, parameter :: maxLen=100          ! Maximum length of any test message (including extensions as 'X')
    +
    +  integer, parameter :: minPassLen=7, maxPassLen=12   ! Minimum and maximum password length
    +
    +  ! The complete alphabet of capital letters as used in most western languages, plus numbers 0...9
    +  character (len=36), parameter :: Alphabet ='ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567879'
    +  character (len=*), parameter :: ADFGVX = 'ADFGVX'
    +
    +  character (len=maxLen)    :: MsgToEncrypt, DecryptedMsg
    +  character (len=2*maxLen) :: EncryptedMsg   ! encrypt makes 2 letters from 1
    +  character (len=25)        :: PassPhrase
    +  integer, parameter :: ColWidth = 6     ! depends on length of the used alphabet but we use only 36 letters
    +
    +  character (len=36) :: PolyAlphabet      ! Permutation of Alphabet to represent Polybius square
    +  integer :: i
    +
    +  ! Initialize random number generator once for the entire run-time of the program and all test cases
    +  call random_seed()
    +
    +
    +  ! The message to encrypt - for 1 test case
    +  ! the plain text message is from the task description
    +  MsgToEncrypt = 'ATTACKAT1200AM'
    +
    +  if (.not. DEBUG) then
    +    print  '("Init: DEBUG is .false., i.e. password and Polybius square are randomized.")'
    +    PassPhrase = getRandomPassPhrase()       ! select random password from unixdict.txt
    +  else
    +    ! for DEBUG only: force constant password for reproducible result:
    +    print  '("Init: DEBUG is .true., i.e. the code reproduces results of the NIM solution")'
    +    PassPhrase = 'EXCURSION'  ! Taken from the NIM solution
    +  endif
    +
    +  print '("Init: PassPhrase for encode and decode is ", A)' , PassPhrase
    +
    +  if (.not. DEBUG) then
    +    call createRandomPolybiusSquare ()       ! Create random Permutation of Alphabet to represent Polybius square
    +  else
    +    ! For DEBUG only: force constant string for reproducable results
    +    ! Both the Alphabet and the password are from the NIM solution.
    +    ! If DEBUG is .true., the result of the NIM solution is exactly reproduced.
    +    PolyAlphabet =   'XOFPD6VHC40ZJMKRU5IA9YBW3L21NGQTE78S'
    +  endif
    +
    +  call PrintSquare ("Init: Following Polybius square is used for encode/decode:", PolyAlphabet, ColWidth)
    +
    +  call encode (MsgToEncrypt , EncryptedMsg, PolyAlphabet, PassPhrase)
    +  call decode (EncryptedMsg, DecryptedMsg, PolyAlphabet, PassPhrase)
    +
    +  call printResult (MsgToEncrypt, EncryptedMsg, DecryptedMsg)
    +
    +contains
    +
    +
    +
    +! ==========================================================
    +! Find random length of the new password,
    +! then pick a random word of this length from the word list
    +! ==========================================================
    +function getRandomPassPhrase()   result (retval)
    +  character (len=maxPassLen) :: retval
    +  integer :: leng                                             ! required length of password to pick
    +
    +  leng = randominInterval (minPassLen, maxPassLen)
    +  retval = getRandomWord (leng)
    +
    +end function getRandomPassPhrase
    +
    +! ==================================================================================
    +! Read the wordlist unixdict.txt and select a random word  with the requested length
    +! ==================================================================================
    +function getRandomWord (leng) result (retval)
    +  integer, intent(in) :: leng
    +  character (len=maxPassLen) :: retval
    +
    +  character(len=100)  :: word                                     ! is longer than expected input word length
    +  character (len=maxPassLen), allocatable :: Candidates (:)
    +  integer:: capacity, content
    +  integer :: io_stat, l, idx, ii
    +
    +  ! Read all words from unixdict.txt having length "len" and no repeating letters
    +  open(unit=10, file='unixdict.txt', status='old', action='read', iostat=io_stat)
    +  if (io_stat .ne. 0) then      ! File open MUST be successful, otherwise total program failure.
    +     print *, "Error opening file"
    +     stop
    +  end if
    +  capacity = 128
    +  call resize (Candidates, maxPassLen, capacity)
    +  content = 0
    +  do
    +    read (10,'(A)', iostat=io_stat)   word               ! ok for both intel and GNU.
    +    l = len_trim (word)                                  ! use this instead of Q format
    +    if (io_stat < 0) exit    ! EOF: Normal end of this loop
    +    if (io_stat > 0) then
    +      print *, "Read error" ! ERROR: (never seen)
    +      exit
    +    end if
    +    if (l .ne. leng) cycle
    +    if (hasDuplicateChars(word)) cycle
    +    if (content .eq. capacity) then
    +      capacity = capacity * 2
    +      call resize (Candidates, maxPassLen, capacity)
    +    end if
    +    content = content + 1
    +    Candidates (content) = word
    +  enddo
    +  idx = randominInterval (1, content)
    +  retval = candidates (idx)
    +  do ii=1, leng
    +    if (retval(ii:ii) .ge. 'a' .and. retval(ii:ii) .le. 'z') then
    +      retval(ii:ii) = char (ichar(retval(ii:ii)) - ichar('a') + ichar('A'))
    +    endif
    +  end do
    +  close (10)
    +
    +end function getRandomWord
    +
    +! ========================================================================
    +! Return true if argument word contains duplicate letters, otherwise false.
    +! ========================================================================
    +function hasDuplicateChars (word) result (itHas)
    +  character (len=*), intent(in) :: word
    +  logical :: itHas
    +  integer :: ii, jj, l
    +  l = len_trim(word)
    +  do ii=1, l
    +    do jj=ii+1, l
    +      if (word(ii:ii) .eq. word(jj:jj)) then
    +        itHas = .true.
    +        return
    +      endif
    +    end do
    +  end do
    +  itHas = .false.
    +end function hasDuplicateChars
    +
    +
    +  !==============================================================
    +  ! Creating a random Polybius square is equivalent with creating
    +  ! a random permutation of the used alphabet
    +  ! Use the Sattolo algorithm to create such a permutation .
    +  !==============================================================
    +subroutine createRandomPolybiusSquare ()
    +
    +  character :: tmp                                      ! for swapping single letters
    +
    +  integer :: j, k, l                                    ! Helper variables: indices into words, words' length
    +
    +
    +  PolyAlphabet = Alphabet
    +  l = len (Alphabet)
    +  do j = l, 1, -1                                       ! For all letters from end down to begin
    +    k = randominInterval (1, j-1)                       ! Select random letters between 1 and j-1
    +    tmp = PolyAlphabet(j:j)                             ! then swap letter at pos j with letter at pos k
    +    PolyAlphabet (j:j) = PolyAlphabet (k:k)
    +    PolyAlphabet (k:k) = tmp
    +  end do
    +
    +end subroutine createRandomPolybiusSquare
    +
    +
    +
    +! =============================================
    +! Increase allocated size of string array 'var'
    +! =============================================
    +subroutine resize(var, sLen, newSize)
    +  integer, intent(in)                              :: sLen       ! LEngth of 1 element of string array
    +  character (len=sLen), allocatable, intent(inout) :: var(:)     ! The array to be increased
    +  integer, intent(in)                              :: newSize    ! The new size of var
    +  character (len=sLen), allocatable                :: tmp(:)     ! Temporary storage
    +  integer                                          :: oldSize    ! Current array size
    +  integer                                          :: ii         ! Loop index
    +
    +  ! Copy allocated values to temporary, then allocate var with
    +  ! new size and copy back saved values.
    +  ! Could be done with move_alloc but this would not be portable to OpenVMS Fortran
    +
    +  if (allocated(var)) then
    +    oldSize = size(var)
    +  else
    +    oldSize = 0
    +  end if
    +
    +  if (newSize .gt. oldSize) then           ! only increment
    +    if (oldSize .gt.0) then
    +      allocate(tmp (oldSize))
    +      tmp(:oldSize) = var(:oldSize)
    +      deallocate (var)
    +    end if
    +    allocate(var(newSize))
    +    if (allocated(tmp) .and. allocated (var) ) then
    +      oldSize = min(size(tmp, 1), size(var, 1))
    +      var(:oldSize) = tmp(:oldSize)
    +      deallocate (tmp)
    +    end if
    +  end if
    +end subroutine resize
    +
    +
    +  ! ===========================================================
    +  ! Generate random number between @lo and @hi (inclusive)
    +  ! Assume Random Number Generator has been initialized before.
    +  ! ===========================================================
    +function randominInterval (lo, hi) result (r)
    +  integer, intent(in) :: lo, hi                         ! the interval
    +  integer :: r                                          ! resultant (pseudo-)random number
    +  real :: rnd                                           ! Fortran random number generator generates float values
    +
    +  call random_number (rnd)
    +  r = lo + FLOOR((hi+1-lo)*rnd)                         ! We want to choose one between [lo,hi]
    +
    +end function randominInterval
    +
    +
    +
    +! =============================================
    +! Encode a given string using the ADFGVX Cipher
    +! =============================================
    +subroutine encode (argInString, outString, argAlphabet, argPassPhrase)
    +  character (len=*), intent(in)  :: argInString     ! The string to encode
    +  character (len=*), intent(out) :: outString       ! The resultant encoded text
    +  character (len=*), intent(in)  :: argAlphabet     ! The alphabet that makes the Polybius square
    +  character (len=*), intent(in) :: argPassPhrase    ! the password used for encode and also decode.
    +  integer :: nRow
    +  integer :: argLen, passLen, newlen, ii, jj, kk, row, col
    +  character(len=2*len(OutString)+len_trim(argPassPhrase))  newAlphabet
    +
    +  character, dimension(:,:), allocatable :: Matrix, expandedMatrix
    +
    +  argLen = len_trim (argInString)
    +  passLen = len_trim (argPassPhrase)
    +  newlen = len(OutString)+len_trim(argPassPhrase)
    +  ! 1st step: encode with the given alphabet (resp. the equivalent 6x6 square),
    +  ! the output string being the row/col of each letter, expressed in terms of ADFGVX
    +  outString = ' '
    +  jj = 1
    +  do ii=1,argLen
    +    call getRC (argInString(ii:ii),row,col, argAlphabet)
    +    outString (jj:jj) = ADFGVX (row:row)
    +    jj = jj + 1
    +    outString (jj:jj) = ADFGVX (col:col)
    +    jj = jj + 1
    +  end do
    +
    +  if (VERBOSE) then
    +    print '("Encode, first step: ")'
    +    do ii=1, arglen
    +      write (*,'(A3)', advance='no') ArgInString (ii:ii)
    +    end do
    +    print *, 'becomes'
    +
    +    do ii=1, 2*argLen, 2
    +      write (*,'(x,A2)', advance='no') outString (ii:ii+1)
    +    end do
    +    write (*,'(///)')
    +  endif
    +
    +  jj = 1
    +  kk = 1
    +  newAlphabet = argPassPhrase (:passLen) // outString(:len_trim(outString))
    +
    +  nRow = (len_trim (newAlphabet) + passLen - 1)/passLen ! Required net number of lines for the Matrix
    +  allocate (Matrix (passLen, nRow))
    +
    +  ! Without any complications: Just accept that last line might be incomplete - complete it with spaces.
    +  do row=1, nRow
    +    do col=1,passLen
    +      if (row .eq. 1 ) then                             ! Top row gets the password
    +        Matrix (col,row) = newAlphabet (jj:jj)
    +        jj = jj + 1
    +      else
    +        if (jj .gt. len_trim(newAlphabet)) then         ! Entire new alphabet copied to Matrix
    +          Matrix(col,row) = ' '                         ! remaining Matrix is all blank
    +        else
    +          Matrix (col,row) = newAlphabet (jj:jj)
    +          jj = jj + 1
    +        endif
    +      endif
    +    end do
    +    if (jj .gt. len_trim(newAlphabet)) exit
    +  end do
    +  jj = 1
    +  do row=1, nRow
    +    do col=1,passLen
    +      newAlphabet (jj:jj) = Matrix (col,row)
    +      jj = jj + 1
    +    end do
    +  end do
    +
    +  if (VERBOSE) &
    +    call printMatrix ('Encode: This results in a new matrix: ', Matrix, nRow, passLen)
    +  ! Sort columns
    +  call quicksort_matrix (Matrix, passLen, nRow, 1, passlen)
    +
    +  if (VERBOSE) &
    +    call printMatrix ('Encode: After sorting columns, this becomes: ', Matrix, nRow, passLen)
    +
    +  jj = 1
    +  do row=1, nRow
    +    do col=1,passLen
    +      newAlphabet (jj:jj) = Matrix (col,row)
    +      jj = jj + 1
    +    end do
    +  end do
    +
    +  allocate (expandedMatrix (passLen, nRow))
    +  ! Initialize al to blank
    +  do row=1, 2*kk
    +    do col=1,passLen
    +      expandedMatrix (col,row) = ' '
    +    end do
    +  end do
    +
    +  jj=1
    +  do row=1, nRow
    +    do col=1,passLen
    +      if (jj .le. len_trim(newAlphabet))  then
    +        expandedMatrix (col,row) = newAlphabet (jj:jj)
    +      else
    +        expandedMatrix (col,row) = ' '
    +      endif
    +      jj = jj + 1
    +    end do
    +  end do
    +
    +  outString = ' '
    +  jj = 1
    +  do col=1,passLen
    +    do row=2, nRow
    +      if (expandedMatrix (col,row) .ne. ' ') then
    +        outString (jj:jj) = expandedMatrix (col,row)
    +        jj = jj + 1
    +      end if
    +    end do
    +    outString (jj:jj) = ' '
    +    jj = jj + 1
    +  end do
    +
    +end subroutine encode
    +
    +
    +! ==================================================================================
    +! Sort columns of a Matrix, taking elements of top row as key to decide "lt" or ge".
    +! ==================================================================================
    +recursive subroutine quicksort_matrix (mat, ncols, nrows, low, high)
    +
    +  integer, intent(in) :: ncols,nrows
    +  character, dimension (ncols,nrows), intent(inout) :: mat
    +
    +  integer, intent(in) :: low, high
    +  integer :: pivot_index
    +  integer :: i, j, mid
    +  character :: pivot, temp
    +
    +  if (low .lt. high) then
    +    ! The list is already "almost sorted", so use midlle word as pivot.
    +    mid = low + (high-low) / 2
    +    pivot = mat (mid,1)
    +
    +    !Move pivot to the end
    +    call swapMat (mat,ncols,nrows,mid,high)
    +
    +    i = low - 1
    +    do j = low, high - 1
    +      if (mat(j,1) .le. pivot) then
    +        i = i + 1
    +        call swapMat (mat,ncols,nrows,i,j)
    +      end if
    +    end do
    +
    +    call swapMat (mat,ncols,nrows,i+1,high)
    +    pivot_index = i + 1
    +
    +    call quicksort_matrix (mat, ncols,nrows, low, pivot_index - 1)
    +    call quicksort_matrix (mat, ncols,nrows,  pivot_index + 1, high)
    +  end if
    +end subroutine quicksort_matrix
    +
    +! ===============================================
    +! Swap two columns of a Matrix (Used for sorting)
    +! ===============================================
    +subroutine swapMat (mat,ncols,nrows,col1,col2)
    +  integer, intent(in) :: ncols,nrows                        ! Size of ...
    +  character, dimension (ncols,nrows), intent(inout) :: mat  ! ... the matrix
    +  integer, intent(in) :: col1, col2                         ! The 2 columns to swap
    +
    +  character :: tmp                                    ! Helpers to swap 2 elements
    +  integer :: row
    +
    +  ! early return in trivial noop case
    +  if (col1 .eq. col2) return
    +
    +  do row=1, nrows                                    ! Swap all elements of col 1 and col 2
    +    tmp = mat (col1,row)
    +    mat (col1,row) = mat(col2,row)
    +    mat(col2,row) = tmp
    +  end do
    +
    +end subroutine swapMat
    +
    +! =======================================================
    +! Decode a given (encoded) string using the ADFGVX Cipher
    +! =======================================================
    +subroutine decode (argInString, outString, argAlphabet, argPassPhrase)
    +  character (len=*), intent(in)  :: argInString     ! The encoded string to decode
    +  character (len=*), intent(out) :: outString       ! Result of the decode
    +  character (len=*), intent(in)  :: argAlphabet     ! The Polybius Square to encode and decode
    +  character (len=*), intent(in) :: argPassPhrase    ! The Password used to encode and decode
    +  character (len=MaxLen) :: tmpString               ! Temporary torage for intermediate result
    +  character, allocatable :: Matrix (:,:)            ! Matrix to constructed from input string
    +  character (len=:),allocatable :: SortedPassPhrase ! The password after sorting its letters
    +  integer :: nRow, passLen                          ! NMUmbner of rows and columns of above Matrix
    +  integer :: inLen, col,row, ii, jj, idx            ! Length of input string, and some helpers
    +
    +  ! Estimate input string lengths
    +  inLen = len_trim (argInString)
    +  passLen = len_trim (argPassPhrase)
    +
    +  outString = ' '
    +  nRow = (inLen + (passLen-1)) / passLen  + 1     ! 1 extra for top row = password
    +
    +  allocate (Matrix (passLen, nRow))
    +
    +  ! Initialize entire matrix
    +  do col=1,passLen
    +    do row=1, nRow
    +      Matrix (col,row) = ' '
    +    end do
    +    ! Fill the column as far as required
    +  end do
    +
    +
    +  ! The columns of the result matrix are sorted as password letters and
    +  ! the sorted password letters makeup top row of th is matrix
    +  SortedPassPhrase = argPassPhrase
    +  call  quicksort_matrix (SortedPassPhrase, passlen,  1, 1, passlen)
    +
    +  row=1
    +  do col=1, passLen
    +    Matrix (col,row) = SortedPassPhrase(col:col)
    +  end do
    +
    +  ! Set rest ( row 2 ff.) of the Matrix: column by column
    +  jj = 1
    +  do col=1,passLen
    +    row = 2
    +    do while (argInString (jj:jj) .ne. ' ')
    +      Matrix (col,row) = argInString (jj:jj)
    +      jj = jj + 1
    +      row = row + 1
    +    enddo
    +    jj = jj + 1
    +  end do
    +
    +  if (VERBOSE) &
    +    call printMatrix ('Decode: the reconstructed Code matrix is ', Matrix, nROw, passLen)
    +
    +  ! We know the columns of this matrix are sorted together with the password
    +  !
    +  ! restore the correct order of thet sorted matrix
    +  call UndoSort (Matrix, passLen, nRow, argPassPhrase, passlen)
    +
    +  if (VERBOSE) &
    +    call printMatrix ('Decode: After Undo Sorting, this becomes', Matrix, nRow, passLen)
    +
    +  ! The matrix is in the correct order now, so its rows, one by one,  represent the first encoded string
    +  !
    +  jj = 1
    +  tmpString = ' '
    +  do row = 2, nRow          ! Skip top row (=Passwprd)
    +    do col=1,passLen
    +      tmpString (jj:jj) = Matrix(col,row)
    +      jj = jj + 1
    +    end do
    +  end do
    +
    +  ! Now we have the encoded string, each 2 letters are row/col in ADFGVX scheme
    +  jj = 1
    +  do ii=1, len_trim(tmpString), 2
    +    row = index (ADFGVX, tmpString(ii:ii))
    +    col = index (ADFGVX, tmpString((ii+1) : (ii+1)))
    +    outString (jj:jj) = getChar (row,col,argAlphabet)   ! Decode from row/col to clear text
    +    jj = jj + 1
    +  end do
    +end subroutine decode
    +
    +! =============================================================================
    +! Print all nRow x nCol elements of a Matrix, togehther with a descriptive text
    +! =============================================================================
    +subroutine printMatrix (comment, Matrix, nRow, nCol)
    +  integer, intent(in) :: nRow, nCol
    +  character (len=*), intent(in) :: Comment
    +  character , intent(in) :: Matrix (nCol, nRow)
    +  integer :: r, c
    +
    +  write (*,'(/A/)')  Comment
    +  do r=1, nROw
    +    do c=1, nCol
    +      write (*, '(A2)', advance='no')  Matrix(c,r)
    +    end do
    +    write (*,*)
    +  end do
    +end subroutine printMatrix
    +
    +!=============================================================
    +! Matrix has been sorted before, with top row as key elements.
    +! Here undo that sort operation
    +!=============================================================
    +subroutine UndoSort (Matrix, nCol, nRow, argPassPhrase, passLen)
    +  integer, intent(in) :: nCol, nRow, passLen
    +  character, intent(inout)  :: Matrix (nCol, nROw)
    +  character                 :: resultMatrix (nCol, nROw)
    +
    +  character (len=passLen), intent(in) :: argPassPhrase
    +
    +  integer :: ii, jj, kk
    +
    +  do ii=1, passLen
    +    ! find whatever letter should be at pos ii within the unscrambled string
    +    jj = index (argPassPhrase, Matrix(ii, 1) )
    +    ! so letter "PassPhrase(jj:jj)" should be at pos ii in line 1 of Matrix
    +    if (jj .ne. ii) then
    +      do kk=1, nRow
    +        resultMatrix (jj,kk) = Matrix(ii,kk)
    +      end do
    +    else
    +      do kk=1, nRow
    +        resultMatrix (jj,kk) = Matrix(jj,kk)
    +      end do
    +    endif
    +  end do
    +  matrix = resultMatrix
    +end subroutine UndoSort
    +
    +
    +! ======================================================
    +! Get Row and Column  of a letter in the Polybius square
    +! ======================================================
    +subroutine getRC (c,row,col, argAlphabet)
    +  character, intent(in) :: c
    +  integer, intent(out) :: row,col
    +  character (len=*), intent(in)  :: argAlphabet             ! Argument to use for encoding
    +  integer :: idx
    +
    +  idx = index (argAlphabet, c) - 1
    +
    +  row = 1 + idx / ColWidth
    +  col = 1 + mod (idx, ColWidth)
    +
    +end subroutine getRC
    +
    +! ==================================================
    +! Return letter in row column of the Polybius square
    +! ==================================================
    +function getChar (row,column,argAlphabet) result (chr)
    +  integer, intent(in) :: row, column
    +  character (len=*), intent(in)  :: argAlphabet             ! Argument to use for encoding
    +  character :: chr
    +  integer :: idx
    +
    +  idx = (row-1) * ColWidth + column
    +  chr = argAlphabet (idx:idx)
    +
    +end function getChar
    +
    +! ===========================================
    +! Print original, encoded and decoded strings
    +! ===========================================
    +subroutine printResult (m1,m2,m3)
    +  character (len=*), intent(in) :: m1,m2,m3
    +  write (*,'("Original:  ", A)')  m1(:len_trim(m1))
    +  write (*,'(" Encoded:  ", A)')  m2(:len_trim(m2))
    +  write (*,'(" Decoded:  ", A)')  m3(:len_trim(m3))
    +  print *
    +end subroutine printResult
    +
    +! ================================================================================
    +! Print the resulting Polybius square based on the alphabet used for encode/decode
    +! ================================================================================
    +subroutine PrintSquare (Comment, Alp, cw)
    +  character (len=*), intent(in) :: Comment
    +  character (len=*), intent(in)  :: Alp
    +  integer, intent(in) :: cw                                     ! column width for dormatted display
    +  integer:: ii, l
    +
    +  l = len_trim(alp)
    +  write (*,'(/A/)')  Comment
    +  Write (*, "('   A D F G V X', /,' +------------',/  A, '|')", advance='no') ADFGVX (1:1)
    +  do ii=1, l
    +    write (*, '(A2)', advance='no')  Alp(ii:ii)
    +    if (mod (ii, cw) .eq. 0) then
    +      if (ii .ne. l)  then
    +        write (*,'(/,A1,"|")', advance='no') ADFGVX (1 +  ii/cw:1 +  ii/cw)
    +      else
    +        write (*,*) ! just EOL
    +      endif
    +    endif
    +  end do
    +  print *                                                       ! one extra blank line
    +end subroutine PrintSquare
    +
    +
    +end program ADFGVXCipher
    diff --git a/Task/ADFGVX-cipher/Free-Pascal-Lazarus/adfgvx-cipher.pas b/Task/ADFGVX-cipher/Free-Pascal-Lazarus/adfgvx-cipher.pas
    new file mode 100644
    index 0000000000..b35f201644
    --- /dev/null
    +++ b/Task/ADFGVX-cipher/Free-Pascal-Lazarus/adfgvx-cipher.pas
    @@ -0,0 +1,198 @@
    +program adfgvxcipher;
    +
    +uses
    +  SysUtils,
    +  Classes;
    +
    +const
    +  ADFGVX = 'ADFGVX';
    +  ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
    +  MESSAGE = 'ATTACKAT1200AM';
    +
    +type
    +  //tPolybiusarr = array[1..6,1..6] of string;
    +  tPolybiusarr = array[1..6, 1..6] of char;
    +
    +  procedure init_Polybius(var Polybius: tPolybiusarr);
    +
    +    procedure ShuffleString(var S: string);
    +    var
    +      i, j: integer;
    +      c: char;
    +    begin
    +      for i := Length(S) downto 2 do
    +      begin
    +        j := Random(i) + 1;  // 1..i
    +        c := S[i];
    +        S[i] := S[j];
    +        S[j] := c;
    +      end;
    +    end;
    +
    +  var
    +    ShuffledAlphabet: string;
    +    x, y, i: integer;
    +  begin
    +    ShuffledAlphabet := ALPHABET;
    +    ShuffleString(ShuffledAlphabet);
    +    i := 1;
    +    for x := 1 to 6 do
    +      for y := 1 to 6 do
    +      begin
    +        Polybius[x, y] := ShuffledAlphabet[i];
    +        Inc(i);
    +      end;
    +  end;
    +
    +  procedure PrintPolybius(Polybius: tPolybiusarr);
    +  var
    +    x, y: integer;
    +    ch: char;
    +  begin
    +    writeln('The 6 x 6 Polybius square:');
    +    writeln;
    +    Write('  |');
    +    for ch in ADFGVX do
    +      Write(ch: 2);
    +    writeln;
    +    writeln('---------------');
    +    for x := 1 to 6 do
    +    begin
    +      Write(ADFGVX[x], ' |');
    +      for y := 1 to 6 do
    +      begin
    +        Write(Polybius[x, y]: 2);
    +      end;
    +      writeln;
    +    end;
    +  end;
    +
    +  function CreateKey(size: integer): string;
    +
    +    procedure FilterList(var lst: TStringList; size: integer);
    +
    +      function HasRepeatedCharacters(const str: string): boolean;
    +      var
    +        seen: array[0..255] of boolean;
    +        i: integer;
    +        c: byte;
    +      begin
    +        FillChar(seen, SizeOf(seen), False);
    +        for i := 1 to Length(str) do
    +        begin
    +          c := Ord(str[i]);
    +          if seen[c] then
    +            Exit(True);    // repeated character found
    +          seen[c] := True;
    +        end;
    +        Result := False;   // no repeats
    +      end;
    +
    +    var
    +      x: integer;
    +    begin
    +      for x := lst.Count - 1 downto 0 do
    +        if (length(lst[x]) <> size) or HasRepeatedCharacters(lst[x]) then lst.Delete(x);
    +    end;
    +
    +  const
    +    FNAME = 'unixdict.txt';
    +  var
    +    list: TStringList;
    +  begin
    +    if (size < 7) or (size > 12) then
    +    begin
    +      writeln('Key should contain between 7 and 12 letters, both inclusive.');
    +      halt;
    +    end;
    +    list := TStringList.Create;
    +    list.LoadFromFile(FNAME);
    +    filterlist(list, size);
    +    Result := UpperCase(list[random(list.Count)]);
    +    list.Free;
    +  end;
    +
    +  function FindCharachter(ch: char; polybius: tPolybiusarr): string;
    +  var
    +    x, y: integer;
    +  begin
    +    for x := 1 to 6 do
    +      for y := 1 to 6 do
    +        if polybius[x, y] = ch then
    +          exit(ADFGVX[x] + ADFGVX[y]);
    +  end;
    +
    +  function Encrypt(plainText, key: string; Polybius: tPolybiusarr): string;
    +  var
    +    ch: char;
    +    str: string;
    +    lst: TStringList;
    +    x, keylength: integer;
    +  begin
    +    str := '';
    +    keylength := length(key);
    +    lst := TStringList.Create;
    +    for x := 1 to keylength do
    +      lst.Add(key[x]);
    +    x := 0;
    +    for ch in plainText do
    +    begin
    +      lst[x] := lst[x] + FindCharachter(ch, Polybius);
    +      Inc(x);
    +      if x = keylength then x := 0;
    +    end;
    +    lst.Sort;
    +    writeln;
    +    for x := 0 to keylength - 1 do
    +      str := str + lst[x] + ' ';
    +    Result := TrimRight(str);
    +    lst.Free;
    +  end;
    +
    +  function Decrypt(encryptedTex, key: string; polybius: tPolybiusarr): string;
    +    // Note: simplified decryption logic for demonstration purposes
    +    // need some work for longer messages
    +  var
    +    lst, tmp: TStringList;
    +    ch: char;
    +    s, str: string;
    +  begin
    +    lst := TStringList.Create;
    +    tmp := TStringList.Create;
    +    lst.AddDelimitedtext(encryptedTex, ' ', True);
    +    for ch in key do
    +      for str in lst do
    +        if str[1] = ch then
    +        begin
    +          tmp.Add(str);
    +          break;
    +        end;
    +    Result := '';
    +    s := '';
    +    for str in tmp do
    +    begin
    +      Result := Result + polybius[pos(str[2], ADFGVX), pos(str[3], ADFGVX)];
    +      if length(str) > 3 then s := s + polybius[pos(str[4], ADFGVX), pos(str[5], ADFGVX)];
    +    end;
    +    Result := Result + s;
    +    lst.Free;
    +    tmp.Free;
    +  end;
    +
    +var
    +  Polybius: tPolybiusarr;
    +  key, encryptedMessage, decryptedMessage: string;
    +
    +begin
    +  Randomize;
    +  init_Polybius(Polybius);
    +  PrintPolybius(Polybius);
    +  key := createkey(Random(12 - 7 + 1) + 7); //set length of word to 7 - 12
    +  encryptedMessage := Encrypt(MESSAGE, key, Polybius);
    +  decryptedMessage := Decrypt(encryptedMessage, key, polybius);
    +  writeln('The key is              : ', key);
    +  writeln('the plain message is    : ', MESSAGE);
    +  writeln('the encrypted message is: ', encryptedMessage);
    +  writeln('the decrypted message is: ', decryptedMessage);
    +
    +end.
    diff --git a/Task/ADFGVX-cipher/FreeBASIC/adfgvx-cipher.basic b/Task/ADFGVX-cipher/FreeBASIC/adfgvx-cipher.basic
    new file mode 100644
    index 0000000000..e2bd2cc64b
    --- /dev/null
    +++ b/Task/ADFGVX-cipher/FreeBASIC/adfgvx-cipher.basic
    @@ -0,0 +1,169 @@
    +Const ADFGVX As String = "ADFGVX"
    +Const ALPHABET As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    +
    +Function InitialisePolybiusSquare() As String
    +    Dim As Integer i, j
    +    Dim As String letters(35)
    +    For i = 0 To 35
    +        letters(i) = Mid(ALPHABET, i + 1, 1)
    +    Next
    +    Randomize Timer
    +    For i = 0 To 35
    +        j = Int(Rnd * 36)
    +        Swap letters(i), letters(j)
    +    Next
    +
    +    Dim As Integer row, column
    +    Dim As String result = ""
    +    For row = 0 To 5
    +        For column = 0 To 5
    +            result &= letters(6 * row + column)
    +        Next
    +    Next
    +
    +    Return result
    +End Function
    +
    +Function CreateKey(size As Integer) As String
    +    If size < 7 Or size > 12 Then
    +        Print "Key should contain between 7 and 12 letters, both inclusive."
    +        Exit Function
    +    End If
    +
    +    Dim As Integer i, j
    +    Dim As String word, candidates()
    +    Dim As Integer ff = Freefile
    +
    +    Open "i:\unixdict.txt" For Input As #ff
    +    While Not Eof(ff)
    +        Line Input #ff, word
    +
    +        Dim As String uniqueWord = ""
    +        For i = 1 To Len(word)
    +            If Instr(uniqueWord, Mid(word, i, 1)) = 0 Then
    +                uniqueWord &= Mid(word, i, 1)
    +            End If
    +        Next
    +
    +        If Len(word) = size And Len(word) = Len(uniqueWord) Then
    +            word = Ucase(word)
    +
    +            Dim isAlphanum As Boolean = TRue
    +            For i = 1 To Len(word)
    +                If Not (Mid(word, i, 1) >= "A" And Mid(word, i, 1) <= "Z") And Not (Mid(word, i, 1) >= "0" And Mid(word, i, 1) <= "9") Then
    +                    isAlphanum = False
    +                    Exit For
    +                End If
    +            Next
    +
    +            If isAlphanum Then
    +                Redim Preserve candidates(Ubound(candidates) + 1)
    +                candidates(Ubound(candidates)) = word
    +            End If
    +        End If
    +    Wend
    +    Close #ff
    +
    +    Randomize Timer
    +    For i = 0 To Ubound(candidates)
    +        j = Int(Rnd * (Ubound(candidates) + 1))
    +        Swap candidates(i), candidates(j)
    +    Next
    +
    +    Return candidates(0)
    +End Function
    +
    +Function Encrypt(plainText As String, polybius As String, key As String) As String
    +    Dim As Integer i, j, row, column
    +    Dim As String code, ch, encrypted
    +
    +    code = ""
    +    For i = 1 To Len(plainText)
    +        ch = Mid(plainText, i, 1)
    +        For row = 0 To 5
    +            For column = 0 To 5
    +                If Mid(polybius, row * 6 + column + 1, 1) = ch Then
    +                    code &= Mid(ADFGVX, row + 1, 1)
    +                    code &= Mid(ADFGVX, column + 1, 1)
    +                End If
    +            Next
    +        Next
    +    Next
    +
    +    encrypted = ""
    +    For i = 1 To Len(key)
    +        ch = Mid(key, i, 1)
    +        For j = Instr(key, ch) - 1 To Len(code) - 1 Step Len(key)
    +            encrypted &= Mid(code, j + 1, 1)
    +        Next
    +        encrypted &= " "
    +    Next
    +
    +    Return encrypted
    +End Function
    +
    +Function Decrypt(encryptedText As String, polybius As String, key As String) As String
    +    Dim As Integer i, j, row, column, spaceCount, codeSize
    +    Dim As String result, stream, word, code, plainText
    +    Dim As String blocks()
    +
    +    result = ""
    +    i = 1
    +    While i <= Len(encryptedText)
    +        If Mid(encryptedText, i, 1) = " " Then
    +            i += 1
    +        Else
    +            result += Mid(encryptedText, i, 1)
    +            i += 1
    +        End If
    +    Wend
    +    spaceCount = Len(encryptedText) - Len(result)
    +    codeSize = Len(encryptedText) - spaceCount
    +
    +    stream = encryptedText
    +    While Len(stream) > 0
    +        word = Left(stream, Instr(stream, " ") - 1)
    +        Redim Preserve blocks(Ubound(blocks) + 1)
    +        blocks(Ubound(blocks)) = word
    +        stream = Mid(stream, Instr(stream, " ") + 1)
    +    Wend
    +
    +    code = ""
    +    For i = 0 To codeSize - 1
    +        For j = 0 To Ubound(blocks)
    +            If Len(code) < codeSize Then code &= Mid(blocks(j), i + 1, 1)
    +        Next
    +    Next
    +
    +    plainText = ""
    +    For i = 1 To codeSize - 1 Step 2
    +        row = Instr(ADFGVX, Mid(code, i, 1)) - 1
    +        column = Instr(ADFGVX, Mid(code, i + 1, 1)) - 1
    +        plainText &= Mid(polybius, row * 6 + column + 1, 1)
    +    Next
    +
    +    Return plainText
    +End Function
    +
    +Dim As String polybius = InitialisePolybiusSquare()
    +Print "The 6 x 6 Polybius square:"
    +Print " | A D F G V X"
    +Print "--------------"
    +For row As Integer = 0 To 5
    +    Print Mid(ADFGVX, row + 1, 1); "|";
    +    For column As Integer = 0 To 5
    +        Print " "; Mid(polybius, row * 6 + column + 1, 1);
    +    Next
    +    Print
    +Next
    +
    +Dim As String key = CreateKey(9)
    +Print !"\nThe key is "; key
    +Dim As String plainText = "ATTACKAT1200AM"
    +Print !"\nPlain text: "; plainText
    +Dim As String encryptedText = Encrypt(plainText, polybius, key)
    +Print !"\nEncrypted: "; encryptedText
    +Dim As String decryptedText = Decrypt(encryptedText, polybius, key)
    +Print !"\nDecrypted: "; decryptedText
    +
    +Sleep
    diff --git a/Task/ADFGVX-cipher/FutureBasic/adfgvx-cipher.basic b/Task/ADFGVX-cipher/FutureBasic/adfgvx-cipher.basic
    new file mode 100644
    index 0000000000..3cbb6a7960
    --- /dev/null
    +++ b/Task/ADFGVX-cipher/FutureBasic/adfgvx-cipher.basic
    @@ -0,0 +1,208 @@
    +/*
    +ADFGVX cipher
    +https://rosettacode.org/wiki/ADFGVX_cipher
    +
    +Requires file, unixdict.txt to be on the desktop
    +https://github.com/quinnj/Rosetta-Julia/blob/master/unixdict.txt
    +
    +*/
    +
    +begin globals
    +
    +  str255 ADFGVX
    +  ADFGVX  = "ADFGVX"
    +  str255 ALPHABET
    +  ALPHABET  = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    +
    +end globals
    +
    +local fn InitialisePolybiusSquare As str255
    +  short i, j
    +
    +  str255 letters(36)
    +  For i = 0 To 35
    +    letters(i) = Mid$(ALPHABET, i + 1, 1)
    +  Next
    +
    +  For i = 0 To 35
    +    j = Int(rnd (36))
    +    Swap letters(i), letters(j)
    +  Next
    +
    +  short row, column
    +  str255 result
    +  result = ""
    +  For row = 0 To 5
    +    For column = 0 To 5
    +      result = result + letters(6 * row + column)
    +    Next
    +  Next
    +
    +End fn = result
    +
    +local fn CreateKey(size As short) As str255
    +  If size < 7 Or size > 12
    +    Print "Key should contain between 7 and 12 letters, both inclusive."
    +    Exit fn
    +  End If
    +
    +  short i, j
    +  str255 TheWord, candidates(1000)
    +  short ff = 1 // file number
    +
    +  short CandidatesCounter = 1
    +
    +  CFUrlRef ParentDirectory = fn FileManagerURLForDirectory( NSDesktopDirectory, NSUserDomainMask )
    +  CFUrlRef UnixDictURL = fn URLByAppendingPathComponent( ParentDirectory, @"unixdict.txt" )
    +
    +
    +  Open "I",ff, UnixDictURL
    +  While Eof(ff) = 0
    +    Line Input #ff, TheWord
    +
    +    str255 uniqueWord
    +    uniqueWord = ""
    +    For i = 1 To Len$(TheWord)
    +      If Instr$(1,uniqueWord, Mid$(TheWord, i, 1)) = 0
    +        uniqueWord = uniqueWord +  Mid$(TheWord, i, 1)
    +      End If
    +    Next
    +
    +    If Len$(TheWord) = size && Len$(TheWord) = Len$(uniqueWord)
    +      TheWord = Ucase$(TheWord)
    +
    +      bool isAlphanum = _true
    +      For i = 1 To Len$(TheWord)
    +        If (Mid$(TheWord, i, 1) < "A" && Mid$(TheWord, i, 1) <= "Z") && (Mid$(TheWord, i, 1) < "0" && Mid$(TheWord, i, 1) <= "9")
    +          isAlphanum = _false
    +          Exit For
    +        End If
    +      Next
    +
    +
    +      If isAlphanum
    +        //Redim Preserve candidates(Ubound(candidates) + 1)
    +        CandidatesCounter ++
    +        candidates(CandidatesCounter) = TheWord
    +      End If
    +    End If
    +  Wend
    +  Close #ff
    +
    +
    +
    +  For i = 0 To CandidatesCounter
    +    j = Int(Rnd (CandidatesCounter + 1))
    +    Swap candidates(i), candidates(j)
    +  Next
    +
    +End fn = candidates(0)
    +
    +local fn Encrypt(plainText As str255, polybius As str255, key As str255) As str255
    +  short i, j, row, column
    +  str255 code, ch, encrypted
    +
    +  code = ""
    +  For i = 1 To Len$(plainText)
    +    ch = Mid$(plainText, i, 1)
    +    For row = 0 To 5
    +      For column = 0 To 5
    +        If Mid$(polybius, row * 6 + column + 1, 1) = ch
    +          code = code +  Mid$(ADFGVX, row + 1, 1)
    +          code = code +  Mid$(ADFGVX, column + 1, 1)
    +        End If
    +      Next
    +    Next
    +  Next
    +
    +  encrypted = ""
    +  For i = 1 To Len$(key)
    +    ch = Mid$(key, i, 1)
    +    For j = Instr$(1,key, ch) - 1 To Len$(code) - 1 Step Len$(key)
    +      encrypted = encrypted +  Mid$(code, j + 1, 1)
    +    Next
    +    encrypted = encrypted +  " "
    +  Next
    +
    +
    +End fn = encrypted
    +
    +local fn Decrypt(encryptedText As str255, polybius As str255, key As str255) As str255
    +  short i, j, row, column, spaceCount, codeSize
    +  str255 result, stream, TheWord, code, plainText
    +  str255 blocks(200)
    +  short BlocksCounter = 1
    +  result = ""
    +  i = 1
    +  While i <= Len$(encryptedText)
    +    If Mid$(encryptedText, i, 1) = " "
    +      i += 1
    +    Else
    +      result += Mid$(encryptedText, i, 1)
    +      i += 1
    +    End If
    +  Wend
    +  spaceCount = Len$(encryptedText) - Len$(result)
    +  codeSize = Len$(encryptedText) - spaceCount
    +
    +
    +  stream = encryptedText
    +  While Len$(stream) > 0
    +    TheWord = Left$(stream, Instr$(1,stream, " ") - 1)
    +    //Redim Preserve blocks(Ubound(blocks) + 1)
    +    BlocksCounter ++
    +    blocks(BlocksCounter) = TheWord
    +    stream = Mid$(stream, Instr$(1,stream, " ") + 1)
    +  Wend
    +
    +  code = ""
    +  For i = 0 To codeSize - 1
    +    BlocksCounter ++
    +    For j = 0 To BlocksCounter
    +      If Len$(code) < codeSize Then code = code + Mid$(blocks(j), i + 1, 1)
    +    Next
    +  Next
    +
    +  plainText = ""
    +  For i = 1 To codeSize - 1 Step 2
    +    row = Instr$(1,ADFGVX, Mid$(code, i, 1)) - 1
    +    column = Instr$(1,ADFGVX, Mid$(code, i + 1, 1)) - 1
    +    plainText = plainText +  Mid$(polybius, row * 6 + column + 1, 1)
    +  Next
    +
    +
    +End fn = plainText
    +
    +str255 polybius
    +polybius = fn InitialisePolybiusSquare
    +Print "The 6 x 6 Polybius square:"
    +Print " | A D F G V X"
    +Print "--------------"
    +short row
    +For row = 0 To 5
    +  Print Mid$(ADFGVX, row + 1, 1); "|";
    +  short column
    +  For column  = 0 To 5
    +    Print " "; Mid$(polybius, row * 6 + column + 1, 1);
    +  Next
    +  Print
    +Next
    +
    +str255 key
    +key = fn CreateKey(9)
    +print
    +Print "The key is "; key
    +str255 plainText
    +plainText = "ATTACKAT1200AM"// 20241105
    +print
    +Print "Plain text: "; plainText
    +str255 encryptedText
    +encryptedText = fn Encrypt(plainText, polybius, key)
    +print
    +Print "Encrypted: "; encryptedText
    +str255 decryptedText
    +decryptedText = fn Decrypt(encryptedText, polybius, key)
    +print
    +Print "Decrypted: "; decryptedText
    +
    +handleevents
    diff --git a/Task/ADFGVX-cipher/Java/adfgvx-cipher.java b/Task/ADFGVX-cipher/Java/adfgvx-cipher.java
    new file mode 100644
    index 0000000000..6cf7751a51
    --- /dev/null
    +++ b/Task/ADFGVX-cipher/Java/adfgvx-cipher.java
    @@ -0,0 +1,110 @@
    +import java.io.IOException;
    +import java.nio.file.Files;
    +import java.nio.file.Path;
    +import java.util.Arrays;
    +import java.util.Collections;
    +import java.util.List;
    +import java.util.stream.Collectors;
    +
    +public final class ADFGVXCipher {
    +
    +	public static void main(String[] args) throws IOException {	
    +		final char[][] polybius = initialisePolybiusSquare();
    +		System.out.println("The 6 x 6 Polybius square:");
    +		System.out.println(" | A D F G V X");
    +		System.out.println("--------------");
    +		for ( int row = 0; row < 6; row++ ) {
    +			System.out.print(ADFGVX.charAt(row) + "|");
    +			for ( int column = 0; column < 6; column++ ) {
    +				System.out.print(" " + polybius[row][column]);
    +			}
    +			System.out.println();
    +		}
    +		System.out.println();
    +
    +		final String key = createKey(9);
    +		System.out.println("The key is " + key);
    +		System.out.println();
    +		final String plainText = "ATTACKAT1200AM";
    +		System.out.println("Plain text: " + plainText);
    +		System.out.println();
    +		final String encryptedText = encrypt(plainText, polybius, key);
    +		System.out.println("Encrypted: " + encryptedText);
    +		System.out.println();
    +		final String decryptedText = decrypt(encryptedText, polybius, key);
    +		System.out.println("Decrypted: " + decryptedText);		
    +	}
    +	
    +	private static String encrypt(String plainText, char[][] polybius, String key) {
    +		String code = "";
    +		for ( char ch : plainText.toCharArray() ) {
    +			for ( int row = 0; row < 6; row++ ) {
    +				for ( int column = 0; column < 6; column++ ) {
    +					if ( polybius[row][column] == ch ) {						
    +						code += ADFGVX.charAt(row) + "" + ADFGVX.charAt(column);
    +					}
    +				}
    +			}
    +		}
    +		
    +		String encrypted = "";
    +		for ( char ch : key.toCharArray() ) {
    +			for ( int i = key.indexOf(ch); i < code.length(); i += key.length() ) {
    +				encrypted += code.charAt(i);
    +			}
    +			encrypted += " ";
    +		}
    +		return encrypted;
    +	}
    +	
    +	private static String decrypt(String encryptedText, char[][] polybius, String key) {
    +		final int codeSize = encryptedText.replace(" ", "").length();		
    +		String code = "";
    +		for ( int i = 0; code.length() < codeSize; i++ ) {
    +			for ( String block : encryptedText.split(" ") ) {
    +				if ( code.length() < codeSize ) {
    +					code += block.charAt(i);
    +				}
    +			}
    +		}
    +		
    +		String plainText = "";
    +		for ( int i = 0; i < codeSize - 1; i += 2 ) {
    +		    int row = ADFGVX.indexOf(code.substring(i, i + 1));
    +		    int column = ADFGVX.indexOf(code.substring(i + 1, i + 2));
    +		    plainText += polybius[row][column];
    +		}		
    +		return plainText;	
    +	}
    +	
    +	// Create a key using a word from the dictionary 'unixdict.txt'
    +	private static String createKey(int size) throws IOException {
    +		if ( size < 7 || size > 12 ) {
    +			throw new AssertionError("Key should contain between 7 and 12 letters, both inclusive.");
    +		}
    +			
    +		List candidates = Files.lines(Path.of("unixdict.txt"))
    +			.filter( word -> word.length() == size )
    +			.filter( word -> word.chars().distinct().count() == word.length() )
    +			.filter( word -> word.chars().allMatch(Character::isLetterOrDigit) )
    +			.collect(Collectors.toList());
    +		Collections.shuffle(candidates);
    +		return candidates.get(0).toUpperCase();		
    +	}
    +	
    +	private static char[][] initialisePolybiusSquare() {
    +		List letters = Arrays.asList("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(""));
    +		Collections.shuffle(letters);
    +	
    +		char[][] result = new char[6][6];
    +		for ( int row = 0; row < 6; row++ ) {
    +		    for ( int column = 0; column < 6; column++ ) {
    +		        result[row][column] = letters.get(6 * row + column).charAt(0);
    +		    }
    +		}
    +		return result;
    +	}
    +	
    +	private static final String ADFGVX = "ADFGVX";	
    +
    +}
    diff --git a/Task/ADFGVX-cipher/JavaScript/adfgvx-cipher.js b/Task/ADFGVX-cipher/JavaScript/adfgvx-cipher.js
    new file mode 100644
    index 0000000000..0bdfe6eb1a
    --- /dev/null
    +++ b/Task/ADFGVX-cipher/JavaScript/adfgvx-cipher.js
    @@ -0,0 +1,134 @@
    +class ADFGVX {
    +    /** The WWI German ADFGVX cipher. */
    +    constructor(spoly, k, alph = 'ADFGVX') {
    +        this.polybius = spoly.toUpperCase().split('');
    +        this.pdim = Math.floor(Math.sqrt(this.polybius.length));
    +        this.key = k.toUpperCase().split('');
    +        this.keylen = this.key.length;
    +        this.alphabet = alph.split('');
    +        const pairs = [];
    +        for (let i = 0; i < this.alphabet.length; i++) {
    +            for (let j = 0; j < this.alphabet.length; j++) {
    +                pairs.push(this.alphabet[i] + this.alphabet[j]);
    +            }
    +        }
    +        this.encode = {};
    +        for (let i = 0; i < this.polybius.length; i++) {
    +            this.encode[this.polybius[i]] = pairs[i];
    +        }
    +        this.decode = {};
    +        for (const k in this.encode) {
    +            this.decode[this.encode[k]] = k;
    +        }
    +    }
    +
    +    encrypt(msg) {
    +        /** Encrypt with the ADFGVX cipher. */
    +        const chars = [];
    +        for (const c of msg.toUpperCase()) {
    +            if (this.polybius.includes(c)) {
    +                chars.push(this.encode[c]);
    +            }
    +        }
    +        const flatChars = chars.join('').split('');
    +        const colvecs = [];
    +        for (let i = 0; i < this.keylen; i++) {
    +            const currentCol = [];
    +            for (let j = i; j < flatChars.length; j += this.keylen) {
    +                currentCol.push(flatChars[j]);
    +            }
    +            colvecs.push([this.key[i], currentCol]);
    +        }
    +
    +        colvecs.sort((a, b) => a[0].localeCompare(b[0]));
    +
    +        let result = '';
    +        for (const a of colvecs) {
    +            result += a[1].join('');
    +        }
    +        return result;
    +    }
    +
    +    decrypt(cod) {
    +        /** Decrypt with the ADFGVX cipher. Does not depend on spacing of encoded text */
    +        const chars = [];
    +        for (const c of cod) {
    +            if (this.alphabet.includes(c)) {
    +                chars.push(c);
    +            }
    +        }
    +
    +        const sortedkey = [...this.key].sort();
    +        const order = [];
    +        for (const ch of sortedkey) {
    +            order.push(this.key.indexOf(ch));
    +        }
    +        const originalorder = [];
    +        for (const ch of this.key) {
    +            originalorder.push(sortedkey.indexOf(ch));
    +        }
    +
    +        const base = Math.floor(chars.length / this.keylen);
    +        const extra = chars.length % this.keylen;
    +        const strides = order.map((_, i) => base + (extra > i ? 1 : 0));
    +        const starts = [0];
    +        let sum = 0;
    +        for (let i = 0; i < strides.length - 1; i++) {
    +            sum += strides[i];
    +            starts.push(sum);
    +        }
    +        const ends = starts.map((start, i) => start + strides[i]);
    +        const cols = originalorder.map(i => chars.slice(starts[i], ends[i]));
    +
    +        const pairs = [];
    +        for (let i = 0; i < Math.floor((chars.length - 1) / this.keylen) + 1; i++) {
    +            for (let j = 0; j < this.keylen; j++) {
    +                if (i * this.keylen + j < chars.length) {
    +                    pairs.push(cols[j][i]);
    +                }
    +            }
    +        }
    +
    +        let decoded = '';
    +        for (let i = 0; i < pairs.length; i += 2) {
    +            decoded += this.decode[pairs[i] + pairs[i + 1]];
    +        }
    +        return decoded;
    +    }
    +}
    +
    +// Helper function to shuffle an array (Fisher-Yates shuffle)
    +function shuffle(array) {
    +    for (let i = array.length - 1; i > 0; i--) {
    +        const j = Math.floor(Math.random() * (i + 1));
    +        [array[i], array[j]] = [array[j], array[i]];
    +    }
    +    return array;
    +}
    +
    +
    +async function main() {
    +    const PCHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.split('');
    +    shuffle(PCHARS);
    +    const POLYBIUS = PCHARS.join('');
    +
    +    // Simulate reading from unixdict.txt (replace with your actual file reading method if needed)
    +    // For demonstration purposes, using a hardcoded word list:
    +    const WORDS = ['ABDEFGHIK', 'JLMNOPQRS', 'TUVWXYZ01', '23456789'];
    +    const KEY = WORDS[Math.floor(Math.random() * WORDS.length)];
    +
    +
    +    const SECRET = new ADFGVX(POLYBIUS, KEY);
    +    const MESSAGE = 'ATTACKAT1200AM';
    +
    +    console.log(`Polybius: ${POLYBIUS}, key: ${KEY}`);
    +    console.log('Message: ', MESSAGE);
    +
    +    const ENCODED = SECRET.encrypt(MESSAGE);
    +    const DECODED = SECRET.decrypt(ENCODED);
    +
    +    console.log('Encoded: ', ENCODED);
    +    console.log('Decoded: ', DECODED);
    +}
    +
    +main();
    diff --git a/Task/ADFGVX-cipher/Julia/adfgvx-cipher.julia b/Task/ADFGVX-cipher/Julia/adfgvx-cipher.jl
    similarity index 100%
    rename from Task/ADFGVX-cipher/Julia/adfgvx-cipher.julia
    rename to Task/ADFGVX-cipher/Julia/adfgvx-cipher.jl
    diff --git a/Task/ADFGVX-cipher/M2000-Interpreter/adfgvx-cipher.m2000 b/Task/ADFGVX-cipher/M2000-Interpreter/adfgvx-cipher.m2000
    new file mode 100644
    index 0000000000..1cc6519280
    --- /dev/null
    +++ b/Task/ADFGVX-cipher/M2000-Interpreter/adfgvx-cipher.m2000
    @@ -0,0 +1,116 @@
    +Module CheckADFGVX_Cipher {
    +	Class cipher {
    +	Private:
    +		buffer a as byte*36
    +		b="ADFGVX"
    +		key="ABCDEFGHIJK"
    +		orderkey="ABCDEFGHIJK"
    +		map=list
    +		map2=list
    +		module preparemaps {
    +			for i=0 to 5
    +				jj=0
    +				for j=i*6 to j+5
    +					.map(chr$(.a[j]))=mid$(.b, i+1,1)+mid$(.b,jj+1, 1)
    +					.map2(mid$(.b, i+1,1)+mid$(.b,jj+1, 1))=chr$(.a[j])
    +					jj++
    +				next
    +			next			
    +		}
    +	Public:
    +		Module SetRandom (&returnvalue) {
    +			return .a, 0:=str$("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
    +			for i=1 to 100
    +				c=random(0, 35):d=c
    +				while c=d {d=random(0, 35)}
    +				 byte o=.a[c]
    +				.a[c]<=.a[d]
    +				.a[d]<=o
    +			next
    +			returnvalue=chr$(eval$(.a)) ' convert to UTF16LE
    +			.preparemaps	
    +		}
    +		Module SetSpecific (that$){
    +			return .a, 0:=str$(Ucase$(that$))
    +			.preparemaps		
    +		}
    +		Module SetKey (.key as string) {
    +			.key<=ucase$(.key)			
    +			if len(.key)<7 or len(.key)>12 then Error "Key has not proper length"
    +			if filter$(.key, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")<>"" then
    +				Error "Key has bad letters"
    +			end if
    +			dim aa(1 to len(.key))
    +			for i=1 to len(.key):aa(i)=mid$(.key,i,1):next
    +			.orderkey<=aa()#sort()#str$("")				
    +		}
    +		Module Display {
    +			Print "The 6 x 6 Polybius square:"		
    +			Print "  | A D F G V X"
    +			Print "---------------"
    +			for i=0 to 5
    +				Print mid$(.b,i+1,1)+" | ";
    +				jj=0
    +				for j=i*6 to j+5
    +					print chr$(.a[j]);" ";
    +					jj++
    +				next
    +				print
    +			next
    +			Print "Key:";.key
    +		}
    +		Function Encrypt(p as string) {
    +			crypted=""
    +			for i=1 to len(p)	
    +				crypted+=.map$(mid$(p,i,1))
    +			next
    +			m=1
    +			encrypted=""
    +			For i = 1 To Len(.key)
    +				ch = Mid$(.orderkey, i, 1)			
    +				For j = Instr(.key, ch) - 1 To Len(crypted) - 1 Step Len(.key)
    +					encrypted += Mid$(crypted, j + 1, 1)
    +					if m mod 5=0 then encrypted += " "
    +					m++
    +				Next
    +			Next
    +			=encrypted
    +		}
    +		Function Decrypt(p as string) {
    +			p=filter$(p, " ")
    +			decrypted=""
    +			m=1
    +			dim b$(len(p))
    +			For i = 1 To Len(.key)
    +				ch = Mid$(.orderkey, i, 1)
    +				For j = Instr(.key, ch) - 1 To Len(p) - 1 Step Len(.key)
    +					b$(j)=mid$(p, m, 1)
    +					m++
    +				Next
    +			Next
    +			for i=0 to len(b$())-1 step 2
    +				decrypted+=.map2(b$(i)+b$(i+1))	
    +			next
    +			=decrypted	
    +		}
    +	}
    +	ADFGVX=cipher()
    +	for ADFGVX {
    +		.SetSpecific "A9GKMF1DQRSBVX8Z0WTEJLOPY5U4CN2H76I3"
    +		.SetKey "volcanism"
    +		.Display
    +		encode=.Encrypt("ATTACKAT1200AM")
    +		Print "Encoded: ";encode
    +		Print "Decoded: ";.Decrypt(encode)
    +		Rem { ' using randomblock
    +			thisblock=""
    +			.SetRandom	 &thisblock
    +			Print "Random Block:";thisblock
    +			.Display
    +			encode=.Encrypt("ATTACKAT1200AM")
    +			Print "Encoded: ";encode
    +			Print "Decoded: ";.Decrypt(encode)
    +		}	
    +	}
    +}
    +CheckADFGVX_Cipher
    diff --git a/Task/ADFGVX-cipher/Mathematica/adfgvx-cipher.math b/Task/ADFGVX-cipher/Mathematica/adfgvx-cipher.math
    new file mode 100644
    index 0000000000..b66c4cb9fc
    --- /dev/null
    +++ b/Task/ADFGVX-cipher/Mathematica/adfgvx-cipher.math
    @@ -0,0 +1,24 @@
    +encrypt[plaintext_, polybius_, key_] := Module[{fraction, fractioned},
    +   fraction = Thread[Characters[polybius] -> Tuples[Characters["ADFGVX"], 2]];
    +   fractioned = Partition[Flatten[Characters[plaintext] /. fraction], UpTo[StringLength[key]]];
    +   StringJoin[Flatten[Part[Flatten[fractioned, {2}], Ordering[Characters[key]]]]]];
    +
    +decrypt[encrypted_, polybius_, key_] := Module[{perm, colLengths, fractioned, defraction},
    +   perm = Ordering[Characters[key]];
    +   colLengths = Length /@ Part[Flatten[Partition[Characters[encrypted], UpTo[Length[perm]]], {2}], perm];
    +   fractioned = Flatten[Part[TakeList[Characters[encrypted], colLengths], InversePermutation[perm]], {2}];
    +   defraction = Thread[Tuples[Characters["ADFGVX"], 2] -> Characters[polybius]];
    +   StringJoin[Partition[Flatten[fractioned], 2] /. defraction]];
    +
    +words = ReadList["unixdict.txt", Word];
    +key = Select[words, StringLength[#] == 9 && DuplicateFreeQ[Characters[#]] &] // RandomChoice;
    +polybius = StringJoin@RandomSample@Characters["ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"];
    +plaintext = "ATTACKAT1200AM";
    +encrypted = encrypt[plaintext, polybius, key];
    +decrypted = decrypt[encrypted, polybius, key];
    +
    +Print["Key: ", key];
    +Print["Polybius: ", polybius];
    +Print["Plaintext: ", plaintext];
    +Print["Encrypted: ", encrypted];
    +Print["Decrypted: ", decrypted];
    diff --git a/Task/ADFGVX-cipher/R/adfgvx-cipher.r b/Task/ADFGVX-cipher/R/adfgvx-cipher.r
    new file mode 100644
    index 0000000000..87fc86e172
    --- /dev/null
    +++ b/Task/ADFGVX-cipher/R/adfgvx-cipher.r
    @@ -0,0 +1,173 @@
    +# The ADFGVX cipher.
    +# See also eg. https://www.nku.edu/~christensen/092hnr304%20ADFGVX.pdf
    +
    +# ADFGVX class using R6
    +library(R6)
    +
    +ADFGVX <- R6Class("ADFGVX",
    +  public = list(
    +    polybius = NULL,
    +    pdim = NULL,
    +    key = NULL,
    +    keylen = NULL,
    +    alphabet = NULL,
    +    encode = NULL,
    +    decode = NULL,
    +
    +    # Constructor
    +    initialize = function(s, k, alph = "ADFGVX") {
    +      self$polybius <- toupper(strsplit(s, "")[[1]])
    +      self$pdim <- floor(sqrt(length(self$polybius)))
    +      self$alphabet <- toupper(strsplit(alph, "")[[1]])
    +
    +      # Create encoding dictionary
    +      self$encode <- list()
    +      for (i in 1:self$pdim) {
    +        for (j in 1:self$pdim) {
    +          char <- self$polybius[(i - 1) * self$pdim + j]
    +          self$encode[[char]] <- c(self$alphabet[i], self$alphabet[j])
    +        }
    +      }
    +
    +      # Create decoding dictionary
    +      self$decode <- list()
    +      for (char in names(self$encode)) {
    +        key_str <- paste(self$encode[[char]], collapse = "")
    +        self$decode[[key_str]] <- char
    +      }
    +
    +      stopifnot(self$pdim^2 == length(self$polybius) &&
    +                self$pdim == length(self$alphabet))
    +
    +      self$key <- toupper(strsplit(k, "")[[1]])
    +      self$keylen <- length(self$key)
    +    },
    +
    +    # Encrypt with the ADFGVX cipher
    +    encrypt = function(s) {
    +      chars_upper <- toupper(strsplit(s, "")[[1]])
    +      chars_filtered <- chars_upper[chars_upper %in% self$polybius]
    +
    +      # Encode characters
    +      chars <- unlist(lapply(chars_filtered, function(c) self$encode[[c]]))
    +
    +      # Create column vectors
    +      colvecs <- list()
    +      for (i in 1:self$keylen) {
    +        indices <- seq(i, length(chars), by = self$keylen)
    +        colvecs[[self$key[i]]] <- chars[indices]
    +      }
    +
    +      # Sort by key
    +      sorted_names <- sort(names(colvecs))
    +      result <- unlist(lapply(sorted_names, function(name) colvecs[[name]]))
    +
    +      return(paste(result, collapse = ""))
    +    },
    +
    +    # Decrypt with the ADFGVX cipher
    +    decrypt = function(s) {
    +      chars <- toupper(strsplit(s, "")[[1]])
    +      chars <- chars[chars %in% self$alphabet]
    +
    +      sortedkey <- sort(self$key)
    +      order <- sapply(sortedkey, function(ch) which(self$key == ch)[1])
    +      originalorder <- sapply(self$key, function(ch) which(sortedkey == ch)[1])
    +
    +      # Calculate strides (column lengths)
    +      div_result <- length(chars) %/% self$keylen
    +      rem_result <- length(chars) %% self$keylen
    +      strides <- sapply(order, function(i) {
    +        div_result + ifelse(rem_result >= i, 1, 0)
    +      })
    +
    +      # Calculate starts and ends of columns
    +      starts <- c(1, cumsum(strides[-length(strides)]) + 1)
    +      ends <- starts + strides - 1
    +
    +      # Get reordered columns
    +      cols <- lapply(originalorder, function(i) {
    +        chars[starts[i]:ends[i]]
    +      })
    +
    +      # Recover the rows
    +      nrows <- (length(chars) - 1) %/% self$keylen + 1
    +      pairs <- c()
    +      for (i in 1:nrows) {
    +        for (j in 1:self$keylen) {
    +          if ((i - 1) * self$keylen + j > length(chars)) break
    +          pairs <- c(pairs, cols[[j]][i])
    +        }
    +      }
    +
    +      # Decode pairs
    +      result <- c()
    +      for (i in seq(1, length(pairs) - 1, by = 2)) {
    +        pair_str <- paste(pairs[i:(i+1)], collapse = "")
    +        result <- c(result, self$decode[[pair_str]])
    +      }
    +
    +      return(paste(result, collapse = ""))
    +    }
    +  )
    +)
    +
    +# Main execution
    +set.seed(123)  # For reproducibility
    +POLYBIUS <- paste(sample(strsplit("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", "")[[1]]),
    +                  collapse = "")
    +
    +# Get dictionary words - try multiple sources
    +get_valid_key <- function() {
    +  # Try to read unixdict.txt if it exists
    +  if (file.exists("unixdict.txt")) {
    +    dict_words <- readLines("unixdict.txt")
    +  } else {
    +    # Use sample words if file doesn't exist
    +    dict_words <- c("absolutes", "abruption", "abundance", "abysmally",
    +                    "acrobatic", "algorithm", "ambiguity", "amplitude",
    +                    "ancestory", "archetype", "asynchron", "auctioned",
    +                    "backbone", "backfired", "backlights", "bandwidth",
    +                    "benchmark", "biography", "birthplace", "blasphemy",
    +                    "boulevard", "bricklaying", "broadcast", "butchering",
    +                    "cauterize", "chemicals", "chromatic", "clipboard",
    +                    "completing", "conjugate", "copyright", "daughters",
    +                    "debuggers", "delimiters", "demograph", "dialyzing",
    +                    "dictionary", "education", "equations", "factorize",
    +                    "geography", "goshdarn", "graciously", "graphed",
    +                    "hampshire", "imploding", "indexable", "jeculates",
    +                    "keyboards", "labyrinth", "livestock", "logarithm",
    +                    "machinery", "molecules", "nightmare", "obscurity",
    +                    "particles", "quizboard", "racehorst", "reduction",
    +                    "savepoint", "sectional", "shipyard", "splatting",
    +                    "substance", "technology", "ulceration", "vineyard",
    +                    "warehouse", "workplace", "xanthopsy", "yachtsmen")
    +  }
    +
    +  # Filter for 9-letter words with unique characters
    +  valid_words <- dict_words[sapply(dict_words, function(w) {
    +    n <- nchar(w)
    +    n == 9 && length(unique(strsplit(w, "")[[1]])) == n
    +  })]
    +
    +  if (length(valid_words) == 0) {
    +    stop("No valid 9-letter words with unique characters found")
    +  }
    +
    +  return(toupper(sample(valid_words, 1)))
    +}
    +
    +KEY <- get_valid_key()
    +
    +# Create cipher and encrypt/decrypt
    +SECRETS <- ADFGVX$new(POLYBIUS, KEY)
    +message <- "ATTACKAT1200AM"
    +
    +cat("Polybius:", POLYBIUS, ", Key:", KEY, "\n")
    +cat("Message:", message, "\n")
    +
    +encoded <- SECRETS$encrypt(message)
    +decoded <- SECRETS$decrypt(encoded)
    +
    +cat("Encoded:", encoded, "\n")
    +cat("Decoded:", decoded, "\n")
    diff --git a/Task/ADFGVX-cipher/Rust/adfgvx-cipher.rust b/Task/ADFGVX-cipher/Rust/adfgvx-cipher.rs
    similarity index 100%
    rename from Task/ADFGVX-cipher/Rust/adfgvx-cipher.rust
    rename to Task/ADFGVX-cipher/Rust/adfgvx-cipher.rs
    diff --git a/Task/ADFGVX-cipher/Uiua/adfgvx-cipher.uiua b/Task/ADFGVX-cipher/Uiua/adfgvx-cipher.uiua
    new file mode 100644
    index 0000000000..d163a20723
    --- /dev/null
    +++ b/Task/ADFGVX-cipher/Uiua/adfgvx-cipher.uiua
    @@ -0,0 +1,11 @@
    +A ← ↯∞_2⊞⊟."ADFGVX"
    +P ← ⊏⍏[⍥⚂]⧻."ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
    +K ← "PACKHORSE"
    +Sw ← ⊜□≠" ".
    +Polybius ← setinv(/⊂⊡≡(⊚⌕):⊙:¤P A|⊏:P≡(⊢⊚⌕)⊙¤∩≡□↯∞_2:A)
    +SortByK ← setinv(⊏⍏⟜(⍉⬚" "↯⊟∞⧻)K|▽≠" "./⊂⍉⊏⍏⍏K)
    +Str ← setinv(/$"_ _"Sw/⊂≡(⊂:" ")|≡(⊢°□◇⬚" "↯⊟∞)/↥≡◇⧻.Sw)
    +Pt ← "ATTACKAT1200AM"
    +&p $"Key = _\nPolybius:\n_\nPlaintext = _"K↯⊟.√⧻.P Pt
    +&p$"Crypttext = _". Str SortByK Polybius Pt
    +&p$"Plaintext = _" °Polybius °SortByK °Str
    diff --git a/Task/ADFGVX-cipher/Wren/adfgvx-cipher.wren b/Task/ADFGVX-cipher/Wren/adfgvx-cipher.wren
    index b509947c38..1a0c953ce5 100644
    --- a/Task/ADFGVX-cipher/Wren/adfgvx-cipher.wren
    +++ b/Task/ADFGVX-cipher/Wren/adfgvx-cipher.wren
    @@ -1,7 +1,7 @@
     import "random" for Random
    -import "/ioutil" for FileUtil
    -import "/seq" for Lst
    -import "/str" for Char, Str
    +import "./ioutil" for FileUtil
    +import "./seq" for Lst
    +import "./str" for Char, Str
     
     var rand = Random.new()
     var adfgvx = "ADFGVX"
    diff --git a/Task/AKS-test-for-primes/11l/aks-test-for-primes.11l b/Task/AKS-test-for-primes/11l/aks-test-for-primes.11l
    index 110ea6ed1e..dc2fcec555 100644
    --- a/Task/AKS-test-for-primes/11l/aks-test-for-primes.11l
    +++ b/Task/AKS-test-for-primes/11l/aks-test-for-primes.11l
    @@ -12,7 +12,7 @@ F aks_test(p)
        R !any(ex[0 .< (len)-1].map(mult -> mult % @p != 0))
     
     print(‘# p: (x-1)^p for small p’)
    -L(p) 12
    +L(p) 0.<12
        print(‘#3: #.’.format(p, enumerate(expand_x_1(p)).map((n, e) -> ‘#.#.#.’.format(‘+’ * (e >= 0), e, I n {(‘x^#.’.format(n))} E ‘’)).join(‘ ’)))
     
     print("\n# small primes using the aks test")
    diff --git a/Task/AKS-test-for-primes/ANSI-BASIC/aks-test-for-primes.basic b/Task/AKS-test-for-primes/ANSI-BASIC/aks-test-for-primes.basic
    new file mode 100644
    index 0000000000..547da20116
    --- /dev/null
    +++ b/Task/AKS-test-for-primes/ANSI-BASIC/aks-test-for-primes.basic
    @@ -0,0 +1,79 @@
    +100 REM AKS test for primes
    +110 DECLARE EXTERNAL SUB PascalTriangle
    +120 DECLARE EXTERNAL SUB ExpandPoly
    +130 DECLARE EXTERNAL FUNCTION IsPrime
    +140 FOR N = 0 TO 9
    +150    CALL ExpandPoly(N)
    +160 NEXT N
    +170 FOR N = 2 TO 50
    +180    IF IsPrime(N) <> 0 THEN PRINT USING("###"): N;
    +190 NEXT N
    +200 PRINT
    +210 END
    +220 REM **
    +230 EXTERNAL SUB PascalTriangle(N, PasTri())
    +240 REM Calculate t!he N'th line 0.. middle
    +250 LET N = INT(N)
    +260 LET PasTri(0) = 1
    +270 LET J = 1
    +280 DO WHILE J <= N
    +290    LET J = J + 1
    +300    LET K = INT(J / 2)
    +310    LET PasTri(K) = PasTri(K - 1)
    +320    FOR K = K TO 1 STEP -1
    +330       LET PasTri(K) = PasTri(K) + PasTri(K - 1)
    +340    NEXT K
    +350 LOOP
    +360 END SUB
    +370 REM **
    +380 EXTERNAL FUNCTION IsPrime(N)
    +390 LET N = INT(N)
    +400 DIM PasTri(0 TO 50)
    +410 LET PasTriMax = UBOUND(PasTri)
    +420 IF N > PasTriMax THEN
    +430    PRINT N; "is out of range"
    +440    STOP
    +450 END IF
    +460 CALL PascalTriangle(N, PasTri)
    +470 LET Res = 1
    +480 LET I = INT(N / 2)
    +490 DO WHILE (Res <> 0) AND (I > 1)
    +500    IF (Res <> 0) AND (MOD(PasTri(I), N) = 0) THEN LET Res = 1 ELSE LET Res = 0
    +510    LET I = I - 1
    +520 LOOP
    +530 LET IsPrime = Res
    +540 END FUNCTION
    +550 REM **
    +560 EXTERNAL SUB ExpandPoly(N)
    +570 LET N = INT(N)
    +580 DIM VZ$(0 TO 1)
    +590 LET VZ$(0) = "+"
    +600 LET VZ$(1) = "-"
    +610 DIM PasTri(0 TO 50)
    +620 LET PasTriMax = UBOUND(PasTri)
    +630 IF N > PasTriMax THEN
    +640    PRINT N; "is out of range"
    +650    STOP
    +660 END IF
    +670 SELECT CASE N
    +680 CASE 0
    +690    PRINT "(x - 1) ^ 0 = 1"
    +700 CASE 1
    +710    PRINT "(x - 1) ^ 1 = x - 1"
    +720 CASE ELSE
    +730    CALL PascalTriangle(N, PasTri)
    +740    PRINT "(x - 1) ^"; N; " = x ^"; N;
    +750    LET BVZ = 1
    +760    FOR J = N - 1 TO INT(N / 2) + 1 STEP -1
    +770       PRINT VZ$(BVZ); PasTri(N - J); "* x ^"; J;
    +780       LET BVZ = ABS(1 - BVZ)
    +790    NEXT J
    +800    FOR J = INT(N / 2) TO 2 STEP -1
    +810       PRINT VZ$(BVZ); PasTri(J); "* x ^"; J;
    +820       LET BVZ = ABS(1 - BVZ)
    +830    NEXT J
    +840    PRINT VZ$(BVZ); PasTri(1); "* x ";
    +850    LET BVZ = ABS(1 - BVZ)
    +860    PRINT VZ$(BVZ); PasTri(0)
    +870 END SELECT
    +880 END SUB
    diff --git a/Task/AKS-test-for-primes/Ada/aks-test-for-primes.ada b/Task/AKS-test-for-primes/Ada/aks-test-for-primes.adb
    similarity index 100%
    rename from Task/AKS-test-for-primes/Ada/aks-test-for-primes.ada
    rename to Task/AKS-test-for-primes/Ada/aks-test-for-primes.adb
    diff --git a/Task/AKS-test-for-primes/Agena/aks-test-for-primes.agena b/Task/AKS-test-for-primes/Agena/aks-test-for-primes.agena
    new file mode 100644
    index 0000000000..6589095e8f
    --- /dev/null
    +++ b/Task/AKS-test-for-primes/Agena/aks-test-for-primes.agena
    @@ -0,0 +1,89 @@
    +# AKS test for primes
    +
    +constant pas_tri_max := 50;
    +
    +proc pascal_triangle(n :: posint) is
    +# Calculate the n'th line 1.. middle
    +# For n = 1, 2, ..
    +  create register pas_tri((n + 1) \ 2);
    +  # pas_tri[0] always is 1
    +  j := 1;
    +  case n
    +    of 1, 2 then pas_tri[1] := 2
    +    else
    +      j := 3;
    +      pas_tri[1] := 2;
    +      while j <= n do
    +        j++;
    +        k := j \ 2; # middle
    +        pas_tri[k] := pas_tri[k - 1];
    +        while k >= 2 do
    +          pas_tri[k] +:= pas_tri[k - 1];
    +          k--
    +        od;
    +        pas_tri[1] +:= 1
    +      od
    +    esle
    +  esac
    +  return pas_tri
    +end;
    +
    +proc is_prime(n :: nonnegint) :: boolean is
    +  if n > pas_tri_max then
    +    printf("%d is out of range\n", n);
    +    os.exit(-1)
    +  fi;
    +  pas_tri := pascal_triangle(n);
    +  res := true;
    +  i := n \ 2;
    +  while res and (i > 1) do
    +    res := res and (pas_tri[i] symmod n = 0);
    +    i--
    +  od;
    +  return res
    +end;
    +
    +proc vz(b :: boolean) is
    +  return if b then '-' else '+' fi
    +end;
    +
    +proc expand_poly(n :: nonnegint) is
    +  if n > pas_tri_max then
    +    printf("%d is out of range\n", n);
    +    os.exit(-1)
    +  fi;
    +  case n
    +    of 0 then printf("(x-1)^0 = 1\n");
    +    of 1 then printf("(x-1)^1 = x-1\n");
    +    else
    +      pas_tri := pascal_triangle(n);
    +      printf("(x-1)^%d = x^%d", n, n);
    +      bvz := true;
    +      n_div_2 := n \ 2
    +      for j from n - 1 to n_div_2 + 1 by -1 do
    +        printf("%s%d*x^%d", vz(bvz), pas_tri[n - j], j);
    +        bvz := not bvz
    +      od;
    +      for j from n_div_2 to 2 by -1 do
    +        printf("%s%d*x^%d", vz(bvz), pas_tri[j], j);
    +        bvz := not bvz
    +      od;
    +      printf("%s%d*x", vz(bvz), pas_tri[1]);
    +      bvz := not bvz;
    +      printf("%s1\n", vz(bvz));
    +    esle
    +  esac
    +end;
    +
    +scope
    +  local n;
    +  for n from 0 to 9 do
    +    expand_poly(n)
    +  od;
    +  for n from 2 to pas_tri_max do
    +    if is_prime(n) then
    +      printf("%3d", n)
    +    fi
    +  od;
    +  printf("\n")
    +end
    diff --git a/Task/AKS-test-for-primes/Ballerina/aks-test-for-primes.ballerina b/Task/AKS-test-for-primes/Ballerina/aks-test-for-primes.ballerina
    new file mode 100644
    index 0000000000..575c645a5f
    --- /dev/null
    +++ b/Task/AKS-test-for-primes/Ballerina/aks-test-for-primes.ballerina
    @@ -0,0 +1,58 @@
    +import ballerina/io;
    +
    +int[] e = "²³⁴⁵⁶⁷".toCodePointInts();
    +
    +function bc(int p) returns int[] {
    +    int[] c = [];
    +    c.setLength(p + 1);
    +    int r = 1;
    +    int half = p / 2;
    +    foreach int i in 0...half {
    +        c[i] = r;
    +        c[p - i] = r;
    +        r = r * (p - i) / (i + 1);
    +    }
    +    foreach int i in int:range(p - 1, -1, -2) {
    +        c[i] = -c[i];
    +    }
    +    return c;
    +}
    +
    +function pp(int[] c) returns string|error {
    +    if c.length() == 1 { return c[0].toString(); }
    +    int p = c.length() - 1;
    +    string s = "";
    +    if c[p] != 1 { s = c[p].toString(); }
    +    foreach int i in int:range(p, 0, -1) {
    +        s += "x";
    +        if i != 1 { s += check string:fromCodePointInt(e[i - 2]); }
    +        int d = c[i - 1];
    +        if d < 0 {
    +            s += " - " + (-d).toString();
    +        } else {
    +            s += " + " + d.toString();
    +        }
    +    }
    +    return s;
    +}
    +
    +function aks(int p) returns boolean {
    +    int[] c = bc(p);
    +    c[p] -= 1;
    +    c[0] += 1;
    +    foreach int d in c {
    +        if d % p != 0 { return false; }
    +    }
    +    return true;
    +}
    +
    +public function main() {
    +    foreach int p in 0...7 {
    +        io:println(p, ":  ", pp(bc(p)));
    +    }
    +    io:println("\nAll primes under 50:");
    +    foreach int p in 2...49 {
    +        if aks(p) { io:print(p, " "); }
    +    }
    +    io:println();
    +}
    diff --git a/Task/AKS-test-for-primes/Clojure/aks-test-for-primes.clj b/Task/AKS-test-for-primes/Clojure/aks-test-for-primes.clj
    index 377a586076..47c637a9e0 100644
    --- a/Task/AKS-test-for-primes/Clojure/aks-test-for-primes.clj
    +++ b/Task/AKS-test-for-primes/Clojure/aks-test-for-primes.clj
    @@ -3,7 +3,7 @@
       [n k]
       (/ (apply *' (range n (- n k) -1))
          (apply *' (range k 0 -1))
    -     (if (and (even? k) (< k n)) -1 1)))
    +     (if (even? k) 1 -1)))
     
     (defn cs
       "coefficient series for (x - 1)^n, k=[0..n]"
    diff --git a/Task/AKS-test-for-primes/Crystal/aks-test-for-primes.crystal b/Task/AKS-test-for-primes/Crystal/aks-test-for-primes.cr
    similarity index 100%
    rename from Task/AKS-test-for-primes/Crystal/aks-test-for-primes.crystal
    rename to Task/AKS-test-for-primes/Crystal/aks-test-for-primes.cr
    diff --git a/Task/AKS-test-for-primes/EasyLang/aks-test-for-primes.easy b/Task/AKS-test-for-primes/EasyLang/aks-test-for-primes.easy
    new file mode 100644
    index 0000000000..10fa6635e4
    --- /dev/null
    +++ b/Task/AKS-test-for-primes/EasyLang/aks-test-for-primes.easy
    @@ -0,0 +1,43 @@
    +func[] coefs n .
    +   len list[] n + 2
    +   list[0] = 1
    +   for k = 0 to n : list[k + 1] = list[k] * (n - k) / (k + 1)
    +   for k = 1 step 2 to n : list[k] = -list[k]
    +   return list[]
    +.
    +func isprimeaks n .
    +   c[] = coefs n
    +   c[0] -= 1
    +   c[n] += 1
    +   for i = 0 to n
    +      if c[i] mod n <> 0 : return 0
    +   .
    +   return 1
    +.
    +proc pprintcoefs n list[] .
    +   for i = 0 to n
    +      s$ = ""
    +      if i > 0
    +         s$ = " + "
    +         if list[i] < 0 : s$ = " - "
    +      .
    +      c$ = abs list[i]
    +      e = n - i
    +      if c$ = "1" and e > 0 : c$ = ""
    +      x$ = ""
    +      if e <> 0
    +         x$ = "x"
    +         if e <> 1 : x$ &= "^" & e
    +      .
    +      r$ &= s$ & c$ & x$
    +   .
    +   print "(x-1)^" & n & " : " & r$
    +.
    +for i = 0 to 7
    +   pprintcoefs i coefs i
    +.
    +print ""
    +for i = 2 to 49
    +   if isprimeaks i = 1 : write i & " "
    +.
    +print ""
    diff --git a/Task/AKS-test-for-primes/Elena/aks-test-for-primes.elena b/Task/AKS-test-for-primes/Elena/aks-test-for-primes.elena
    index 42169edf1f..bda73a4cdf 100644
    --- a/Task/AKS-test-for-primes/Elena/aks-test-for-primes.elena
    +++ b/Task/AKS-test-for-primes/Elena/aks-test-for-primes.elena
    @@ -12,9 +12,9 @@ singleton AksTest
             if ((n < 0) || (n > 63)) { AbortException.raise() }; // gracefully deal with range issue
     
             c[i] := 1l;
    -        for (int i := 0, i < n, i += 1) {
    +        for (int i := 0; i < n; i += 1) {
                 c[1 + i] := 1l;
    -            for (int j := i, j > 0, j -= 1) {
    +            for (int j := i; j > 0; j -= 1) {
                     c[j] := c[j - 1] - c[j]
                 };
                 c[0] := c[0].Negative
    @@ -45,28 +45,28 @@ singleton AksTest
             while(i != 0)
             {
                 i -= 1;
    -            console.print("+",c[i],"x^",i)
    +            Console.print("+",c[i],"x^",i)
             }
         }
     }
     
    -public program()
    +public Program()
     {
    -    for (int n := 0, n < 10, n += 1) {
    +    for (int n := 0; n < 10; n += 1) {
             AksTest.coef(n);
     
    -		console.print("(x-1)^",n," = ");
    +		Console.print("(x-1)^",n," = ");
     		AksTest.show(n);
    -        console.printLine()
    +        Console.printLine()
         };
     
    -    console.print("Primes:");
    -    for (int n := 1, n <= 63, n += 1) {
    +    Console.print("Primes:");
    +    for (int n := 1; n <= 63; n += 1) {
             if (AksTest.is_prime(n))
             {
    -            console.print(n," ")
    +            Console.print(n," ")
             }
         };
     
    -    console.printLine().readChar()
    +    Console.printLine().readChar()
     }
    diff --git a/Task/AKS-test-for-primes/Elixir/aks-test-for-primes.elixir b/Task/AKS-test-for-primes/Elixir/aks-test-for-primes.ex
    similarity index 100%
    rename from Task/AKS-test-for-primes/Elixir/aks-test-for-primes.elixir
    rename to Task/AKS-test-for-primes/Elixir/aks-test-for-primes.ex
    diff --git a/Task/AKS-test-for-primes/F-Sharp/aks-test-for-primes.fs b/Task/AKS-test-for-primes/F-Sharp/aks-test-for-primes.fs
    new file mode 100644
    index 0000000000..916ee7953d
    --- /dev/null
    +++ b/Task/AKS-test-for-primes/F-Sharp/aks-test-for-primes.fs
    @@ -0,0 +1,5 @@
    +// N-grams. Nigel Galloway: April 11th., 2024
    +let fN g=let n,g=g@[0I],0I::g in List.map2(fun n g->n-g) n g
    +Seq.unfold(fun g->Some(g,fN g))[1I]|>Seq.take 9|>Seq.iteri(fun n g->printfn "%d -> %A" n g); printfn ""
    +let fG (n::g) l=(n+1I)%l=0I && g|>List.forall(fun n->n%l=0I)
    +Seq.unfold(fun(n,g)->Some((n,g),(n+1I,fN g)))(0I,[1I])|>Seq.skip 2|>Seq.filter(fun(n,_::g)->fG (List.rev g) n)|>Seq.takeWhile(fun(n,_)->n<100I)|>Seq.iter(fun(n,_)->printf "%A " n); printfn ""
    diff --git a/Task/AKS-test-for-primes/FutureBasic/aks-test-for-primes.basic b/Task/AKS-test-for-primes/FutureBasic/aks-test-for-primes.basic
    new file mode 100644
    index 0000000000..72bc4196df
    --- /dev/null
    +++ b/Task/AKS-test-for-primes/FutureBasic/aks-test-for-primes.basic
    @@ -0,0 +1,101 @@
    +// AKS Test for Primes task
    +// https://rosettacode.org/wiki/AKS_test_for_primes
    +
    +
    +#build ShowMoreWarnings NO
    +
    +begin globals
    +  sInt64 c(100)
    +  //double n
    +end globals
    +
    +local fn coef(nx as short)
    +  // out-by-1, ie coef(1)==^0, coef(2)==^1, coef(3)==^2 etc.
    +  c(nx) = 1
    +  short i
    +  for i = nx-1 to 2 step -1
    +    c(i) = c(i) + c(i-1)
    +  next
    +end fn
    +
    +local fn is_prime(nx as short) as boolean
    +  short i
    +  bool result = _false
    +  fn coef(nx+1) // (I said it was out-by-1)
    +  for i = 2 to nx-1   // (technically "to n" is more correct)
    +    if int(c(i)/nx) <> c(i)/nx
    +      return _false
    +    end if
    +  next
    +
    +  result = _true
    +end fn = result
    +
    +local fn show(nx as short)
    +  // (As per coef, this is (working) out-by-1)
    +
    +  double ci
    +  str255 cix
    +  short i
    +
    +  for i = nx to 1 step -1
    +    ci = c(i)
    +    if ci = 1
    +      if (nx-i) mod 2 = 0
    +        if i = 1
    +          if nx = 1
    +            cix = "    1"
    +          else
    +            cix = "+1"
    +          end if
    +        else
    +          cix = ""
    +        end if
    +      else
    +        cix = "-1"
    +      end if
    +    else
    +      if (nx-i) mod 2 = 0
    +        cix = "+" + str$(ci)
    +      else
    +        cix = "-" + str$(ci)
    +      end if
    +    end if
    +
    +    if i = 1 // ie ^0
    +      print cix;
    +    else
    +      if i = 2 then print cix, "x"; // ie ^1
    +      if i <> 2 then print cix, "x^", i-1;
    +    end if
    +
    +  next i
    +end fn
    +
    +local fn AKS_test_for_primes
    +  short nx
    +
    +  for nx = 1 to 10 // (0 to 9 really)
    +    fn coef(nx)
    +    print "(x-1)^" + str$(nx-1) +  " = ";
    +    fn show(nx)
    +    print
    +  next
    +
    +  print
    +  print "primes (<=53): ";
    +  short n
    +  c(2) = 1 // (this manages "", which is all that call did anyway...)
    +  for n = 2 to 53
    +    if fn is_prime(n)
    +      print " ", n;
    +    end if
    +  next
    +  print
    +end fn
    +
    +window 1,@"AKS test for Primes",fn CGRectMake(0, 0, 850, 200)
    +
    +fn AKS_test_for_primes
    +
    +handleevents
    diff --git a/Task/AKS-test-for-primes/Julia/aks-test-for-primes-1.julia b/Task/AKS-test-for-primes/Julia/aks-test-for-primes-1.jl
    similarity index 100%
    rename from Task/AKS-test-for-primes/Julia/aks-test-for-primes-1.julia
    rename to Task/AKS-test-for-primes/Julia/aks-test-for-primes-1.jl
    diff --git a/Task/AKS-test-for-primes/Julia/aks-test-for-primes-2.julia b/Task/AKS-test-for-primes/Julia/aks-test-for-primes-2.jl
    similarity index 100%
    rename from Task/AKS-test-for-primes/Julia/aks-test-for-primes-2.julia
    rename to Task/AKS-test-for-primes/Julia/aks-test-for-primes-2.jl
    diff --git a/Task/AKS-test-for-primes/Julia/aks-test-for-primes-3.julia b/Task/AKS-test-for-primes/Julia/aks-test-for-primes-3.jl
    similarity index 100%
    rename from Task/AKS-test-for-primes/Julia/aks-test-for-primes-3.julia
    rename to Task/AKS-test-for-primes/Julia/aks-test-for-primes-3.jl
    diff --git a/Task/AKS-test-for-primes/Julia/aks-test-for-primes-4.julia b/Task/AKS-test-for-primes/Julia/aks-test-for-primes-4.jl
    similarity index 100%
    rename from Task/AKS-test-for-primes/Julia/aks-test-for-primes-4.julia
    rename to Task/AKS-test-for-primes/Julia/aks-test-for-primes-4.jl
    diff --git a/Task/AKS-test-for-primes/Kotlin/aks-test-for-primes.kotlin b/Task/AKS-test-for-primes/Kotlin/aks-test-for-primes.kts
    similarity index 100%
    rename from Task/AKS-test-for-primes/Kotlin/aks-test-for-primes.kotlin
    rename to Task/AKS-test-for-primes/Kotlin/aks-test-for-primes.kts
    diff --git a/Task/AKS-test-for-primes/Loglan82/aks-test-for-primes.loglan82 b/Task/AKS-test-for-primes/Loglan82/aks-test-for-primes.loglan82
    new file mode 100644
    index 0000000000..73629f52ea
    --- /dev/null
    +++ b/Task/AKS-test-for-primes/Loglan82/aks-test-for-primes.loglan82
    @@ -0,0 +1,89 @@
    +program AKS;
    +(* AKS test for primes *)
    +
    +const
    +  Pas_tri_last = 33; (* 33 for 32-bit integer type; 17 for 16-bit integer *)
    +var
    +  n: integer;
    +
    +  (* Calculate the n'th line 0 .. middle *)
    +  unit Pascal_triangle: procedure (n: integer; Pas_tri: arrayof integer);
    +  var
    +    j, k: integer;
    +  begin
    +    Pas_tri(0) := 1;
    +    j := 1;
    +    while j <= n
    +    do
    +      j := j + 1;
    +      k := j div 2;
    +      Pas_tri(k) := Pas_tri(k - 1);
    +      while k >= 1
    +      do
    +        Pas_tri(k) := Pas_tri(k) + Pas_tri(k - 1);
    +        k := k - 1
    +      od;
    +    od;
    +  end Pascal_triangle;
    +
    +  unit is_prime: function (n: integer): boolean;
    +  var
    +    i: integer,
    +    Pas_tri: arrayof integer;
    +  begin
    +    array Pas_tri dim (0 : n);
    +    call Pascal_triangle(n, Pas_tri);
    +    result := true;
    +    i := n div 2;
    +    while result and (i > 1)
    +    do
    +      result := result and (Pas_tri(i) mod n = 0);
    +      i := i - 1;
    +    od;
    +  end is_prime;
    +
    +  unit vz: function (b: boolean): character;
    +  begin
    +    if b then result := '-' else result := '+' fi;
    +  end vz;
    +
    +  unit expand_poly: procedure (n: integer);
    +  var
    +    Pas_tri: arrayof integer,
    +    bvz: boolean,
    +    j: integer;
    +  begin
    +    array Pas_tri dim (0 : n);
    +    case n
    +      when 0: writeln("(x - 1) ^ 0 = 1")
    +      when 1: writeln("(x - 1) ^ 1 = x - 1")
    +      otherwise
    +        call Pascal_triangle(n, Pas_tri);
    +        write("(x - 1) ^ ", n: 1, " = x ^ ", n: 1, " ");
    +        bvz := true;
    +        for j := n - 1 downto (n div 2) + 1
    +        do
    +          write(vz(bvz), " ", Pas_tri(n - j): 1, " * x ^ ", j: 1, " ");
    +          bvz := not bvz;
    +        od;
    +        for j := (n div 2) downto 2
    +        do
    +          write(vz(bvz), " ", Pas_tri(j): 1, " * x ^ ", j: 1, " ");
    +          bvz := not bvz
    +        od;
    +        write(vz(bvz), " ", Pas_tri(1): 1, " * x ");
    +        bvz := not bvz;
    +        writeln(vz(bvz), " ", Pas_tri(0): 1);
    +    esac;
    +  end expand_poly;
    +
    +begin
    +  for n := 0 to 9
    +  do
    +    call expand_poly(n)
    +  od;
    +  for n := 2 to Pas_tri_last do
    +    if is_prime(n) then write(n: 1, " ") fi;
    +  od;
    +  writeln;
    +end
    diff --git a/Task/AKS-test-for-primes/Modula-2/aks-test-for-primes.mod2 b/Task/AKS-test-for-primes/Modula-2/aks-test-for-primes.mod2
    new file mode 100644
    index 0000000000..a138aea166
    --- /dev/null
    +++ b/Task/AKS-test-for-primes/Modula-2/aks-test-for-primes.mod2
    @@ -0,0 +1,119 @@
    +MODULE AKSTest;
    +(* AKS test for primes *)
    +
    +FROM STextIO IMPORT
    +  WriteLn, WriteString;
    +FROM SWholeIO IMPORT
    +  WriteInt;
    +
    +CONST
    +  PasTriMax = 33; (* for 32-bit integer type *)
    +
    +TYPE
    +  TPasTri = ARRAY [0 .. PasTriMax] OF CARDINAL;
    +
    +VAR
    +  N: CARDINAL;
    +
    +PROCEDURE PascalTriangle(N: CARDINAL; VAR PasTri: TPasTri);
    +(* Calculate the N'th line 0.. middle *)
    +VAR
    +  J, K: CARDINAL;
    +BEGIN
    +  PasTri[0] := 1;
    +  J := 1;
    +  WHILE J <= N DO
    +    J := J + 1;
    +    K := J DIV 2;
    +    PasTri[K] := PasTri[K - 1];
    +    FOR K := K TO 1 BY -1 DO
    +      PasTri[K] := PasTri[K] + PasTri[K - 1];
    +    END
    +  END
    +END PascalTriangle;
    +
    +PROCEDURE IsPrime(N: CARDINAL): BOOLEAN;
    +VAR
    +  Res   : BOOLEAN;
    +  I     : CARDINAL;
    +  PasTri: TPasTri;
    +BEGIN
    +  IF N > PasTriMax THEN
    +    WriteInt(N, 1);
    +    WriteString(" is out of range");
    +    WriteLn;
    +    HALT;
    +  END;
    +  PascalTriangle(N, PasTri);
    +  Res := TRUE;
    +  I := N DIV 2;
    +  WHILE Res AND (I > 1) DO
    +    Res := Res AND (PasTri[I] MOD N = 0);
    +    I := I - 1
    +  END;
    +  RETURN Res;
    +END IsPrime;
    +
    +PROCEDURE ExpandPoly(N: CARDINAL);
    +TYPE
    +  TVZ = ARRAY BOOLEAN OF CHAR;
    +CONST
    +  VZ = TVZ {'+', '-'};
    +VAR
    +  J     : CARDINAL;
    +  BVZ   : BOOLEAN;
    +  PasTri: TPasTri;
    +BEGIN
    +  IF N > PasTriMax THEN
    +    WriteInt(N, 1);
    +    WriteString(" is out of range");
    +    WriteLn;
    +    HALT
    +  END;
    +  CASE N OF
    +  | 0:
    +    WriteString("(x-1)^0 = 1"); WriteLn;
    +  | 1:
    +    WriteString("(x-1)^1 = x-1"); WriteLn;
    +  ELSE
    +    PascalTriangle(N, PasTri);
    +    WriteString("(x-1)^");
    +    WriteInt(N, 1);
    +    WriteString(" = x^");
    +    WriteInt(N, 1);
    +    BVZ := TRUE;
    +    FOR J := N - 1 TO N DIV 2 + 1 BY -1 DO
    +      WriteString(VZ[BVZ]);
    +      WriteInt(PasTri[N - J], 1);
    +      WriteString("*x^");
    +      WriteInt(J, 1);
    +      BVZ := NOT BVZ
    +    END;
    +    FOR J := N DIV 2 TO 2 BY -1 DO
    +      WriteString(VZ[BVZ]);
    +      WriteInt(PasTri[J], 1);
    +      WriteString("*x^");
    +      WriteInt(J, 1);
    +      BVZ := NOT BVZ
    +    END;
    +    WriteString(VZ[BVZ]);
    +    WriteInt(PasTri[1], 1);
    +    WriteString("*x");
    +    BVZ := NOT BVZ;
    +    WriteString(VZ[BVZ]);
    +    WriteInt(PasTri[0], 1);
    +    WriteLn;
    +  END;
    +END ExpandPoly;
    +
    +BEGIN
    +  FOR N := 0 TO 9 DO
    +    ExpandPoly(N)
    +  END;
    +  FOR N := 2 TO PasTriMax DO
    +    IF IsPrime(N) THEN
    +      WriteInt(N, 3)
    +    END
    +  END;
    +  WriteLn;
    +END AKSTest.
    diff --git a/Task/AKS-test-for-primes/OCaml/aks-test-for-primes.ocaml b/Task/AKS-test-for-primes/OCaml/aks-test-for-primes.ml
    similarity index 100%
    rename from Task/AKS-test-for-primes/OCaml/aks-test-for-primes.ocaml
    rename to Task/AKS-test-for-primes/OCaml/aks-test-for-primes.ml
    diff --git a/Task/AKS-test-for-primes/PHP/aks-test-for-primes.php b/Task/AKS-test-for-primes/PHP/aks-test-for-primes.php
    new file mode 100644
    index 0000000000..9b3e9bbaa4
    --- /dev/null
    +++ b/Task/AKS-test-for-primes/PHP/aks-test-for-primes.php
    @@ -0,0 +1,80 @@
    + PAS_TRI_MAX) {
    +    echo $n, " is out of range", PHP_EOL;
    +    exit;
    +  }
    +  switch ($n) {
    +    case 0:
    +      echo "(x-1)^0 = 1", PHP_EOL;
    +      break;
    +    case 1:
    +      echo "(x-1)^1 = x-1", PHP_EOL;
    +      break;
    +    default:
    +      $pas_tri = [];
    +      pascal_triangle($n, $pas_tri);
    +      echo "(x-1)^", $n, " = x^", $n;
    +      $bvz = true;
    +      $n_div_2 = intdiv($n, 2);
    +      for ($j = $n - 1; $j > $n_div_2; $j--) {
    +        echo vz($bvz), $pas_tri[$n - $j], "*x^", $j;
    +        $bvz = !$bvz;
    +      }
    +      for ($j = $n_div_2; $j >= 2; $j--) {
    +        echo vz($bvz), $pas_tri[$j], "*x^", $j;
    +        $bvz = !$bvz;
    +      }
    +      echo vz($bvz), $pas_tri[1], "*x";
    +      $bvz = !$bvz;
    +      echo vz($bvz), $pas_tri[0], PHP_EOL;
    +  }
    +}
    +
    +function pascal_triangle($n, &$pas_tri) {
    +// Calculate the $n'th line 0.. middle
    +  $pas_tri = array_fill(0, intdiv($n + 1, 2) + 1, 0);
    +  $pas_tri[0] = 1;
    +  $j = 1;
    +  while ($j <= $n) {
    +    $j++;
    +    $k = intdiv($j, 2);
    +    $pas_tri[$k] = $pas_tri[$k - 1];
    +    while ($k >= 1) {
    +      $pas_tri[$k] += $pas_tri[$k - 1];
    +      $k--;
    +    }
    +  }
    +}
    +
    +function is_prime($n):bool {
    +  if ($n > PAS_TRI_MAX) {
    +    echo $n, " is out of range", PHP_EOL;
    +    exit;
    +  }
    +  $pas_tri = [];
    +  pascal_triangle($n, $pas_tri);
    +  $res = true;
    +  $i = intdiv($n, 2);
    +  while ($res && ($i > 1)) {
    +    $res = $res && ($pas_tri[$i] % $n == 0);
    +    --$i;
    +  }
    +  return $res;
    +}
    +
    +for ($n = 0; $n <= 9; $n++)
    +  expand_poly($n);
    +for ($n = 2; $n <= PAS_TRI_MAX; $n++)
    +  if (is_prime($n))
    +    echo str_pad($n, 3, " ", STR_PAD_LEFT);
    +echo PHP_EOL;
    +?>
    diff --git a/Task/AKS-test-for-primes/Phix/aks-test-for-primes-1.phix b/Task/AKS-test-for-primes/Phix/aks-test-for-primes-1.phix
    new file mode 100644
    index 0000000000..da1bc84810
    --- /dev/null
    +++ b/Task/AKS-test-for-primes/Phix/aks-test-for-primes-1.phix
    @@ -0,0 +1,78 @@
    +-- demo/rosetta/AKSprimes.exw
    +-- Does not work for primes above 67 (56 on 32bit), which is actually beyond the original task anyway.
    +-- Translated from the C version (with all out-by-1 stuff now eradicated).
    +with javascript_semantics
    +constant limit = iff(machine_bits()=32?56:67)
    +sequence c = repeat(0,limit+1)
    +
    +procedure coef(integer n)
    +    c[n+1] = 1
    +    for i=n to 2 by -1 do
    +        c[i] += c[i-1]
    +    end for
    +end procedure
    +
    +function is_aks_prime(integer n)
    +    coef(n)
    +    for i=2 to n-1 do
    +        if remainder(c[i],n)!=0 then
    +            return false
    +        end if
    +    end for
    +    return true
    +end function
    +
    +procedure show(integer n)
    +    for i=n+1 to 1 by -1 do
    +        object ci = c[i]
    +        if ci=1 then
    +            if remainder(n-i+1,2)=0 then
    +                if i=1 then
    +                    if n=0 then
    +                        ci = "1"
    +                    else
    +                        ci = "+1"
    +                    end if
    +                else
    +                    ci = ""
    +                end if
    +            else
    +                ci = "-1"
    +            end if
    +        else
    +            if remainder(n-i+1,2)=0 then
    +                ci = sprintf("+%d",ci)
    +            else
    +                ci = sprintf("-%d",ci)
    +            end if
    +        end if
    +        if i=1 then -- ie ^0
    +            printf(1,"%s",{ci})
    +        elsif i=2 then -- ie ^1
    +            printf(1,"%sx",{ci})
    +        else
    +            printf(1,"%sx^%d",{ci,i-1})
    +        end if
    +    end for
    +end procedure
    +
    +procedure main()
    +    for n=0 to 9 do
    +        coef(n);
    +        printf(1,"(x-1)^%d = ", n);
    +        show(n);
    +        puts(1,'\n');
    +    end for
    +
    +    printf(1,"\nprimes (<=%d):",limit);
    +--  coef(1); -- (needed to reset c, if we want to avoid saying 1 is prime...)
    +    c[2] = 1 -- (this manages "", which is all that call did anyway...)
    +    for n=2 to limit do
    +        if is_aks_prime(n) then
    +            printf(1," %d", n);
    +        end if
    +    end for
    +    puts(1,'\n');
    +  wait_key()
    +end procedure
    +main()
    diff --git a/Task/AKS-test-for-primes/Phix/aks-test-for-primes-2.phix b/Task/AKS-test-for-primes/Phix/aks-test-for-primes-2.phix
    new file mode 100644
    index 0000000000..f8bd4ad4ab
    --- /dev/null
    +++ b/Task/AKS-test-for-primes/Phix/aks-test-for-primes-2.phix
    @@ -0,0 +1,27 @@
    +include mpfr.e
    +mpz z = mpz_init()
    +atom t0 = time(), t1 = t0+1
    +sequence p = {}
    +integer maxn = 0
    +for n=2 to 10000 do -- (more than we can manage in 10s)
    +    bool nprime = true
    +    for k=1 to n-1 do
    +        mpz_bin_uiui(z,n,k)
    +        if not mpz_divisible_ui_p(z,n) then
    +            nprime = false
    +            exit
    +        end if
    +    end for
    +    if nprime then
    +        p &= n
    +    end if
    +    maxn = n
    +    if time()>t1 then
    +        if time()>t0+10 then progress("") exit end if
    +        progress("checking %d",{n})
    +        t1 = time()+1
    +    end if
    +end for
    +sequence q = get_primes_le(maxn)
    +printf(1,"%d primes < %d found, correctly:%t, in %s\n",{length(p),maxn,p=q,elapsed(time()-t0)})
    +wait_key()
    diff --git a/Task/AKS-test-for-primes/Phix/aks-test-for-primes-3.phix b/Task/AKS-test-for-primes/Phix/aks-test-for-primes-3.phix
    new file mode 100644
    index 0000000000..bfa4d0b3d9
    --- /dev/null
    +++ b/Task/AKS-test-for-primes/Phix/aks-test-for-primes-3.phix
    @@ -0,0 +1,24 @@
    +atom t0 = time(), t1 = t0+1
    +sequence p = {}
    +integer maxn = 0
    +for n=2 to 10000 do -- (more than we can manage in 10s)
    +    sequence r = {1}
    +    for k=1 to n do
    +        r &= 1
    +        for l=k to 2 by -1 do
    +            r[l] = remainder(r[l]+r[l-1],n)
    +        end for
    +    end for
    +    if sum(r)=2 then -- ie {1,<==all 0s==>,1}
    +        p &= n
    +    end if
    +    maxn = n
    +    if time()>t1 then
    +        if time()>t0+10 then progress("") exit end if
    +        progress("checking %d",{n})
    +        t1 = time()+1
    +    end if
    +end for
    +sequence q = get_primes_le(maxn)
    +printf(1,"%d primes < %d found, correctly:%t, in %s\n",{length(p),maxn,p=q,elapsed(time()-t0)})
    +wait_key()
    diff --git a/Task/AKS-test-for-primes/Phix/aks-test-for-primes.phix b/Task/AKS-test-for-primes/Phix/aks-test-for-primes.phix
    deleted file mode 100644
    index 384e622777..0000000000
    --- a/Task/AKS-test-for-primes/Phix/aks-test-for-primes.phix
    +++ /dev/null
    @@ -1,82 +0,0 @@
    --->
    - -- demo/rosetta/AKSprimes.exw
    - -- Does not work for primes above 53, which is actually beyond the original task anyway.
    - -- Translated from the C version, just about everything is (working) out-by-1, what fun.
    -
    - sequence c = repeat(0,100)
    -
    - procedure coef(integer n)
    - -- out-by-1, ie coef(1)==^0, coef(2)==^1, coef(3)==^2 etc.
    -     c[n] = 1
    -     for i=n-1 to 2 by -1 do
    -         c[i] = c[i]+c[i-1]
    -     end for
    - end procedure
    -
    - function is_aks_prime(integer n)
    -     coef(n+1); -- (I said it was out-by-1)
    -     for i=2 to n-1 do   -- (technically "to n" is more correct)
    -         if remainder(c[i],n)!=0 then
    -             return 0
    -         end if
    -     end for
    -     return 1
    - end function
    -
    - procedure show(integer n)
    - -- (As per coef, this is (working) out-by-1)
    - object ci
    -     for i=n to 1 by -1 do
    -         ci = c[i]
    -         if ci=1 then
    -             if remainder(n-i,2)=0 then
    -                 if i=1 then
    -                     if n=1 then
    -                         ci = "1"
    -                     else
    -                         ci = "+1"
    -                     end if
    -                 else
    -                     ci = ""
    -                 end if
    -             else
    -                 ci = "-1"
    -             end if
    -         else
    -             if remainder(n-i,2)=0 then
    -                 ci = sprintf("+%d",ci)
    -             else
    -                 ci = sprintf("-%d",ci)
    -             end if
    -         end if
    -         if i=1 then -- ie ^0
    -             printf(1,"%s",{ci})
    -         elsif i=2 then -- ie ^1
    -             printf(1,"%sx",{ci})
    -         else
    -             printf(1,"%sx^%d",{ci,i-1})
    -         end if
    -     end for
    - end procedure
    -
    - procedure main()
    -     for n=1 to 10 do -- (0 to 9 really)
    -         coef(n);
    -         printf(1,"(x-1)^%d = ", n-1);
    -         show(n);
    -         puts(1,'\n');
    -     end for
    -
    -     puts(1,"\nprimes (<=53):");
    - --  coef(2); -- (needed to reset c, if we want to avoid saying 1 is prime...)
    -     c[2] = 1 -- (this manages "", which is all that call did anyway...)
    -     for n = 2 to 53 do
    -         if is_aks_prime(n) then
    -             printf(1," %d", n);
    -         end if
    -     end for
    -     puts(1,'\n');
    -     if getc(0) then end if
    - end procedure
    - main()
    -
    - function abundantOdd(integer n, done, lim, bool printAll)
    -     while done<lim do
    -         atom tot = sum(factors(n,-1))
    -         if tot>n then
    -             done += 1
    -             if printAll or done=lim then
    -                 string ln = iff(printAll?sprintf("%2d. ",done):"")
    -                 printf(1,"%s%,6d (proper sum:%,d)\n",{ln,n,tot})
    -             end if
    -         end if
    -         n += 2
    -     end while
    -     printf(1,"\n")
    -     return n
    - end function
    - printf(1,"The first 25 abundant odd numbers are:\n")
    - integer n = abundantOdd(1, 0, 25, true)
    - printf(1,"The one thousandth abundant odd number is:")
    - {} = abundantOdd(n, 25, 1000, false)
    - printf(1,"The first abundant odd number above one billion is:")
    - {} = abundantOdd(1e9+1, 0, 1, false)
    - iterator
        Walker.zero().tweak(fcn(rn){
           n:=rn.value;
           while(True){
    -	 sum:=0;
    -	 foreach d in ([3.. n.toFloat().sqrt().toInt(), 2]){
    -	    if( (y:=n/d) *d != n) continue;
    -	    sum += ((y==d) and y or y+d)
    -	 }
    -	 if(sum>n){ rn.set(n+2); return(n) }
    -	 n+=2;
    +     sum:=0;
    +     foreach d in ([3.. n.toFloat().sqrt().toInt(), 2]){
    +        if( (y:=n/d) *d != n) continue;
    +        sum += ((y==d) and y or y+d)
    +     }
    +     if(sum>n){ rn.set(n+2); return(n) }
    +     n+=2;
           }
        }.fp(Ref(startAt.isOdd and startAt or startAt+1)))
     }
    diff --git a/Task/Accumulator-factory/Ada/accumulator-factory-1.ada b/Task/Accumulator-factory/Ada/accumulator-factory-1.adb
    similarity index 100%
    rename from Task/Accumulator-factory/Ada/accumulator-factory-1.ada
    rename to Task/Accumulator-factory/Ada/accumulator-factory-1.adb
    diff --git a/Task/Accumulator-factory/Ada/accumulator-factory-2.ada b/Task/Accumulator-factory/Ada/accumulator-factory-2.adb
    similarity index 100%
    rename from Task/Accumulator-factory/Ada/accumulator-factory-2.ada
    rename to Task/Accumulator-factory/Ada/accumulator-factory-2.adb
    diff --git a/Task/Accumulator-factory/Ada/accumulator-factory-3.ada b/Task/Accumulator-factory/Ada/accumulator-factory-3.adb
    similarity index 100%
    rename from Task/Accumulator-factory/Ada/accumulator-factory-3.ada
    rename to Task/Accumulator-factory/Ada/accumulator-factory-3.adb
    diff --git a/Task/Accumulator-factory/Ballerina/accumulator-factory.ballerina b/Task/Accumulator-factory/Ballerina/accumulator-factory.ballerina
    new file mode 100644
    index 0000000000..a8f8252dea
    --- /dev/null
    +++ b/Task/Accumulator-factory/Ballerina/accumulator-factory.ballerina
    @@ -0,0 +1,38 @@
    +import ballerina/io;
    +
    +type numeric int|float|decimal;
    +
    +function accumulator(numeric acc) returns (function(numeric) returns numeric) {
    +    numeric sum = acc;
    +    return function(numeric n) returns numeric {
    +        numeric sum2 = sum;
    +        if sum2 is int && n is int {
    +            sum2 += n;
    +        } else if sum2 is float && n is float {
    +            sum2 += n;
    +        } else if sum2 is decimal && n is decimal {
    +            sum2 += n;
    +        } else if sum2 is int && n is float {
    +            sum2 = sum2 + n;
    +        } else if sum2 is int && n is decimal {
    +            sum2 = sum2 + n;
    +        } else if sum2 is float && n is int {
    +            sum2 += n;
    +        } else if sum2 is float && n is decimal {
    +            sum2 = sum2 + n;
    +        } else if sum2 is decimal && n is int {
    +            sum2 += n;
    +        } else if sum2 is decimal && n is float {
    +            sum2 += n;
    +        }
    +        sum = sum2;
    +        return sum;
    +   };
    +}
    +
    +public function main() {
    +    var x = accumulator(1);
    +    _ = x(5);
    +    _ = accumulator(2);
    +    io:println(x(2.3));
    +}
    diff --git a/Task/Accumulator-factory/Crystal/accumulator-factory.crystal b/Task/Accumulator-factory/Crystal/accumulator-factory.cr
    similarity index 100%
    rename from Task/Accumulator-factory/Crystal/accumulator-factory.crystal
    rename to Task/Accumulator-factory/Crystal/accumulator-factory.cr
    diff --git a/Task/Accumulator-factory/Delphi/accumulator-factory.delphi b/Task/Accumulator-factory/Delphi/accumulator-factory.pas
    similarity index 100%
    rename from Task/Accumulator-factory/Delphi/accumulator-factory.delphi
    rename to Task/Accumulator-factory/Delphi/accumulator-factory.pas
    diff --git a/Task/Accumulator-factory/EMal/accumulator-factory.emal b/Task/Accumulator-factory/EMal/accumulator-factory.emal
    index cf4406f8ac..b0da805059 100644
    --- a/Task/Accumulator-factory/EMal/accumulator-factory.emal
    +++ b/Task/Accumulator-factory/EMal/accumulator-factory.emal
    @@ -3,13 +3,13 @@ in Org:RosettaCode
      |that are usually not nullable, such as int or real.
      |In the following code we are telling EMal that int and real implement
      |the Number virtual interface, so that it can only
    - |accept null (because it's an interface), int, and real values.
    + |accept null (because it is an interface), int, and real values.
      |^
     type Number allows int, real
     type AccumulatorUsingNumber
    -fun foo = fun by Number n
    -  fun g = Number by Number i
    -    return n += i
    +fun foo ← fun by Number n
    +  fun g ← Number by Number i
    +    return n +← i
       end
       return g
     end
    @@ -17,33 +17,33 @@ type AccumulatorUsingVar
     ^|EMal has an universal supertype Variable (var) that can be used.
      |Some manual type checks are required.
      |^
    -fun checkType = void by var value
    -  if generic!value != real and generic!value != int
    -    Event.error(1, "Only real and int values can be used").raise()
    +fun checkType ← void by var value
    +  if generic!value ≠ real and generic!value ≠ int
    +    error(1, "Only real and int values can be used")
       end
     end
    -fun foo = fun by var n
    +fun foo ← fun by var n
       checkType(n)
    -  fun g = var by var i
    +  fun g ← var by var i
         checkType(i)
    -    return n += i
    +    return n +← i
       end
       return g
     end
     type Main
     ^|we have developed two solutions,
    - |it's time to create a list holding both data types.
    + |it is time to create a list holding both data types.
      |We iterate over the solutions in order to test them.
      |^
    -List solutions = generic[AccumulatorUsingNumber, AccumulatorUsingVar]
    -for int i = 0; i < solutions.length; ++i
    -  generic solution = solutions[i]
    -  writeLine("=== solution " + (i + 1) + " ===")
    -  fun x = :solution.foo(1)
    +List solutions ← generic[AccumulatorUsingNumber, AccumulatorUsingVar]
    +for int i ← 0; i < solutions.length; ++i
    +  generic solution ← solutions[i]
    +  writeLine("[ solution " + (i + 1) + " ]")
    +  fun x ← :solution.foo(1)
       x(5)
       :solution.foo(3)
       watch(x(2.3))
    -  fun y = :solution.foo(1)
    +  fun y ← :solution.foo(1)
       y(5)
       :solution.foo(3)
       watch(y(2))
    diff --git a/Task/Accumulator-factory/Elena/accumulator-factory.elena b/Task/Accumulator-factory/Elena/accumulator-factory.elena
    index 221fb0d382..16e02b3b7b 100644
    --- a/Task/Accumulator-factory/Elena/accumulator-factory.elena
    +++ b/Task/Accumulator-factory/Elena/accumulator-factory.elena
    @@ -1,16 +1,16 @@
     function(acc)
    -    = (n => acc.append:n);
    +    = (n => acc.append(n));
     
    -accumulator(n)
    +Accumulator(n)
         = function(new Variable(n));
     
    -public program()
    +public Program()
     {
    -    var x := accumulator(1);
    +    var x := Accumulator(1);
     
         x(5);
     
    -    var y := accumulator(3);
    +    var y := Accumulator(3);
     
    -    console.write(x(2.3r))
    +    Console.write(x(2.3r))
     }
    diff --git a/Task/Accumulator-factory/Elixir/accumulator-factory-1.elixir b/Task/Accumulator-factory/Elixir/accumulator-factory-1.ex
    similarity index 100%
    rename from Task/Accumulator-factory/Elixir/accumulator-factory-1.elixir
    rename to Task/Accumulator-factory/Elixir/accumulator-factory-1.ex
    diff --git a/Task/Accumulator-factory/Elixir/accumulator-factory-2.elixir b/Task/Accumulator-factory/Elixir/accumulator-factory-2.ex
    similarity index 100%
    rename from Task/Accumulator-factory/Elixir/accumulator-factory-2.elixir
    rename to Task/Accumulator-factory/Elixir/accumulator-factory-2.ex
    diff --git a/Task/Accumulator-factory/Julia/accumulator-factory.julia b/Task/Accumulator-factory/Julia/accumulator-factory.jl
    similarity index 100%
    rename from Task/Accumulator-factory/Julia/accumulator-factory.julia
    rename to Task/Accumulator-factory/Julia/accumulator-factory.jl
    diff --git a/Task/Accumulator-factory/Kotlin/accumulator-factory.kotlin b/Task/Accumulator-factory/Kotlin/accumulator-factory.kts
    similarity index 100%
    rename from Task/Accumulator-factory/Kotlin/accumulator-factory.kotlin
    rename to Task/Accumulator-factory/Kotlin/accumulator-factory.kts
    diff --git a/Task/Accumulator-factory/M2000-Interpreter/accumulator-factory.m2000 b/Task/Accumulator-factory/M2000-Interpreter/accumulator-factory.m2000
    index 38c3698bc9..b9bdf82db9 100644
    --- a/Task/Accumulator-factory/M2000-Interpreter/accumulator-factory.m2000
    +++ b/Task/Accumulator-factory/M2000-Interpreter/accumulator-factory.m2000
    @@ -1,32 +1,33 @@
    -\\ M2000 Interpreter
    -\\ accumulator factory
    -foo=lambda acc=0 (n as double=0) -> {
    -      \\ interpreter place this: read n as double=0 as first line of lambda function
    -      if n=0 then =acc : exit
    -      acc+=n
    -      \\ acc passed as a closuer to lambda (a copy of acc in the result lambda function)
    -      =lambda acc -> {
    -            ' if stack of values is empty then return a copy of acc
    -            if empty then =acc : exit
    -            read x
    -            \\ x has no type here, can be any numeric type (also can be an object too)
    -            \\ accumulator is double, and is a closure (a copy of acc in foo)
    -            acc+=x
    -            \\ any variable in M2000 hold  first type
    -            \\ if x is an object then we get error, except if object use this operator
    -            x=acc
    -            \\ so we return x type
    -            =x
    -      }
    +Module CheckIt {
    +    Def VarType(n)=Type$(n)
    +    foo=lambda  (acc) -> {
    +          =lambda acc -> {
    +                if empty then =acc : exit
    +                read x
    +                acc+=x
    +                =acc
    +          }
    +    }
    +    Double a=1
    +    x = foo(a)
    +    call void x(5)  ' 	Without Void a non zero value count as Error.
    +    call  foo(3)
    +    print VarType(x())="Double", x(2.3)=8.3 ' Double literal
    +    Single m=1
    +    z=foo(m)
    +    long L=5
    +    ? VarType(z(L))="Single", z(2.3)=8.3~ ' Single literal
    +    Currency c=1
    +    zc=foo(c)
    +    ? VarType(zc(5))="Currency", zc(2.3)=8.3#  ' Currency literal
    +    Decimal d=1
    +    zd=foo(d)
    +    ? VarType(zd(5))="Decimal", zd(2.3)=8.3@  ' Decimal literal
    +    Date dt=1
    +    zdt=foo(dt)
    +    ? VarType(zdt(5))="Date", zdt(2.3)=8.3ud  ' Date literal
    +    Long Long LL=1
    +    zdt=foo(LL)
    +    ? VarType(zdt(5))="Long Long", zdt(2.3)=8&& ' Long Long literal
     }
    -x=foo(1&)   ' 1& is long type (32bit)
    -call void x(5) ' 5 is double type (the default type for M2000)
    -call void foo(3#)   ' void tell to interpreter to throw result, 3# is Currency type
    -print x(2.3@) ' print 8.3,   2.3@ is Decimal type
    -print foo()=4 ' print true
    -def ExpType$(z)=type$(z)
    -print ExpType$(foo())="Double"
    -print ExpType$(x(0&))="Long"
    -print ExpType$(x(0@))="Decimal"
    -print ExpType$(x())="Double"
    -print ExpType$(foo(20))="lambda"
    +CheckIt
    diff --git a/Task/Accumulator-factory/MiniScript/accumulator-factory.mini b/Task/Accumulator-factory/MiniScript/accumulator-factory.mini
    new file mode 100644
    index 0000000000..2853e433c9
    --- /dev/null
    +++ b/Task/Accumulator-factory/MiniScript/accumulator-factory.mini
    @@ -0,0 +1,25 @@
    +Accumulator = function(n)
    +	adder = {"sum": n}
    +	adder.plus = function(n)
    +		self.sum += n
    +		return self.sum
    +	end function
    +	
    +	adder.getSum = function(n)
    +		obj = self
    +		_sum = function(n)
    +			return obj.plus(n)
    +		end function
    +		return @_sum
    +	end function
    +	return adder.getSum
    +end function
    +
    +acc1 = Accumulator(0)
    +print acc1(10) // prints 10
    +print acc1(2)  // prints 12
    +
    +acc2 = Accumulator(1)
    +print acc2(100) // prints 101
    +
    +print acc1(0) // prints 12
    diff --git a/Task/Accumulator-factory/OCaml/accumulator-factory.ocaml b/Task/Accumulator-factory/OCaml/accumulator-factory.ml
    similarity index 100%
    rename from Task/Accumulator-factory/OCaml/accumulator-factory.ocaml
    rename to Task/Accumulator-factory/OCaml/accumulator-factory.ml
    diff --git a/Task/Accumulator-factory/PascalABC.NET/accumulator-factory.pas b/Task/Accumulator-factory/PascalABC.NET/accumulator-factory.pas
    new file mode 100644
    index 0000000000..86c0cbcc7d
    --- /dev/null
    +++ b/Task/Accumulator-factory/PascalABC.NET/accumulator-factory.pas
    @@ -0,0 +1,12 @@
    +function foo(n: real): real -> real :=
    +  i -> begin
    +    n += i;
    +    Result := n;
    +  end;
    +
    +begin
    +  var x := foo(1);
    +  x(5);
    +  foo(3);
    +  print(x(2.3));
    +end.
    diff --git a/Task/Accumulator-factory/Pluto/accumulator-factory.pluto b/Task/Accumulator-factory/Pluto/accumulator-factory.pluto
    new file mode 100644
    index 0000000000..5baa4348fd
    --- /dev/null
    +++ b/Task/Accumulator-factory/Pluto/accumulator-factory.pluto
    @@ -0,0 +1,11 @@
    +local function accumulator(acc)
    +    return |n| -> do
    +        acc += n
    +        return acc
    +    end
    +end
    +
    +local x = accumulator(1)
    +x(5)
    +accumulator(3)
    +print(x(2.3))
    diff --git a/Task/Accumulator-factory/PowerShell/accumulator-factory-1.psh b/Task/Accumulator-factory/PowerShell/accumulator-factory-1.ps1
    similarity index 100%
    rename from Task/Accumulator-factory/PowerShell/accumulator-factory-1.psh
    rename to Task/Accumulator-factory/PowerShell/accumulator-factory-1.ps1
    diff --git a/Task/Accumulator-factory/PowerShell/accumulator-factory-2.psh b/Task/Accumulator-factory/PowerShell/accumulator-factory-2.ps1
    similarity index 100%
    rename from Task/Accumulator-factory/PowerShell/accumulator-factory-2.psh
    rename to Task/Accumulator-factory/PowerShell/accumulator-factory-2.ps1
    diff --git a/Task/Accumulator-factory/REBOL/accumulator-factory.rebol b/Task/Accumulator-factory/REBOL/accumulator-factory.rebol
    deleted file mode 100644
    index 35b5392daf..0000000000
    --- a/Task/Accumulator-factory/REBOL/accumulator-factory.rebol
    +++ /dev/null
    @@ -1,8 +0,0 @@
    -make-acc-gen: func [start-val] [
    -    use [state] [
    -        state: start-val
    -        func [value] [
    -            state: state + value
    -        ]
    -    ]
    -]
    diff --git a/Task/Accumulator-factory/Rebol/accumulator-factory-1.rebol b/Task/Accumulator-factory/Rebol/accumulator-factory-1.rebol
    new file mode 100644
    index 0000000000..0738505b60
    --- /dev/null
    +++ b/Task/Accumulator-factory/Rebol/accumulator-factory-1.rebol
    @@ -0,0 +1,11 @@
    +make-acc-gen: func [start-val] [
    +    use [state] [
    +        state: start-val
    +        func [value] [
    +            state: state + value
    +        ]
    +    ]
    +]
    +gen: make-acc-gen 1
    +print gen 5   ;== 6
    +print gen 2.3 ;== 8.3
    diff --git a/Task/Accumulator-factory/Rebol/accumulator-factory-2.rebol b/Task/Accumulator-factory/Rebol/accumulator-factory-2.rebol
    new file mode 100644
    index 0000000000..02468d5450
    --- /dev/null
    +++ b/Task/Accumulator-factory/Rebol/accumulator-factory-2.rebol
    @@ -0,0 +1,25 @@
    +;; Define a generator function 'gen' with an optional refinement '/init'
    +;; - 'value' is a required number passed to the function
    +;; - '/init' is an optional refinement for initialization
    +gen: function/with [value [number!] /init] [
    +
    +    ;; If '/init' refinement is used, initialize state and exit immediately
    +    if init [
    +        state: value    ;; Set the initial state to the provided value
    +        exit            ;; Exit, so nothing else in the function is run
    +    ]
    +
    +    ;; If not initializing, add 'value' to 'state'
    +    state: state + value
    +
    +    ;; The function returns the new state each call
    +][state: 0]             ;; 'state' is a local variable, initialized once per definition (persistent closure)
    +
    +;; Initialize the 'state' value of gen to 1 by calling it with '/init'
    +gen/init 1
    +
    +;; Call gen with 5: Adds 5 to state and prints the result (should print 6)
    +print gen 5
    +
    +;; Call gen with 2.3: Adds 2.3 to state and prints the result (should print 8.3)
    +print gen 2.3
    diff --git a/Task/Accumulator-factory/Red/accumulator-factory.red b/Task/Accumulator-factory/Red/accumulator-factory.red
    new file mode 100644
    index 0000000000..9bceca4447
    --- /dev/null
    +++ b/Task/Accumulator-factory/Red/accumulator-factory.red
    @@ -0,0 +1,15 @@
    +Red [ "Accumulator factory - hinjolicious" ]
    +
    +; just a helper func to display informative output
    +demo: function [s b] [print ["^/==" s "==^/^/" mold/only b "^/>>"] do b]
    +
    +demo "Accumulator" [
    +foo: function [init] [
    +	acc: init
    +	closure [val][acc: acc + val]
    +]
    +x: foo 1
    +print x 5 ; 6
    +foo 3 ; no effect!
    +print x 2.3 ; 8.3
    +]
    diff --git a/Task/Accumulator-factory/Rust/accumulator-factory-1.rust b/Task/Accumulator-factory/Rust/accumulator-factory-1.rs
    similarity index 100%
    rename from Task/Accumulator-factory/Rust/accumulator-factory-1.rust
    rename to Task/Accumulator-factory/Rust/accumulator-factory-1.rs
    diff --git a/Task/Accumulator-factory/Rust/accumulator-factory-2.rust b/Task/Accumulator-factory/Rust/accumulator-factory-2.rs
    similarity index 100%
    rename from Task/Accumulator-factory/Rust/accumulator-factory-2.rust
    rename to Task/Accumulator-factory/Rust/accumulator-factory-2.rs
    diff --git a/Task/Accumulator-factory/Scheme/accumulator-factory.ss b/Task/Accumulator-factory/Scheme/accumulator-factory.scm
    similarity index 100%
    rename from Task/Accumulator-factory/Scheme/accumulator-factory.ss
    rename to Task/Accumulator-factory/Scheme/accumulator-factory.scm
    diff --git a/Task/Accumulator-factory/Ursalang/accumulator-factory.ursa b/Task/Accumulator-factory/Ursalang/accumulator-factory.ursa
    new file mode 100644
    index 0000000000..122be31ae0
    --- /dev/null
    +++ b/Task/Accumulator-factory/Ursalang/accumulator-factory.ursa
    @@ -0,0 +1,10 @@
    +let fac = fn(n) {
    +  fn(i) {
    +    n := n + i
    +  }
    +}
    +
    +let x = fac(1)
    +x(5)
    +fac(3)
    +print(x(2.3))
    diff --git a/Task/Accumulator-factory/V-(Vlang)/accumulator-factory.v b/Task/Accumulator-factory/V-(Vlang)/accumulator-factory.v
    new file mode 100644
    index 0000000000..c799934393
    --- /dev/null
    +++ b/Task/Accumulator-factory/V-(Vlang)/accumulator-factory.v
    @@ -0,0 +1,23 @@
    +struct Generator {
    +	mut:
    +    a_n []f64
    +}
    +
    +fn (mut gen Generator) generator(ir f64) fn (f64) f64 {
    +    gen.a_n << ir
    +    id := gen.a_n.len - 1
    +    return fn (mut gen Generator, id int) fn (f64) f64 {
    +        return fn [mut gen, id] (d f64) f64 {
    +            gen.a_n[id] += d
    +            return gen.a_n[id]
    +        }
    +    }(mut gen, id)
    +}
    +
    +fn main() {
    +    mut o_generator := Generator{}
    +    accumulator := o_generator.generator(1)
    +    println(accumulator(5))
    +    o_generator.generator(3)
    +    println(accumulator(2.3))
    +}
    diff --git a/Task/Accumulator-factory/VBScript/accumulator-factory-1.vb b/Task/Accumulator-factory/VBScript/accumulator-factory-1.vbs
    similarity index 100%
    rename from Task/Accumulator-factory/VBScript/accumulator-factory-1.vb
    rename to Task/Accumulator-factory/VBScript/accumulator-factory-1.vbs
    diff --git a/Task/Accumulator-factory/VBScript/accumulator-factory-2.vb b/Task/Accumulator-factory/VBScript/accumulator-factory-2.vbs
    similarity index 100%
    rename from Task/Accumulator-factory/VBScript/accumulator-factory-2.vb
    rename to Task/Accumulator-factory/VBScript/accumulator-factory-2.vbs
    diff --git a/Task/Achilles-numbers/Ada/achilles-numbers.adb b/Task/Achilles-numbers/Ada/achilles-numbers.adb
    new file mode 100644
    index 0000000000..054f448da3
    --- /dev/null
    +++ b/Task/Achilles-numbers/Ada/achilles-numbers.adb
    @@ -0,0 +1,205 @@
    +pragma Ada_2022;
    +
    +with Ada.Text_IO;
    +with Ada.Numerics; use Ada.Numerics;
    +with Ada.Numerics.Long_Elementary_Functions;
    +use  Ada.Numerics.Long_Elementary_Functions;
    +with Ada.Strings; use Ada.Strings;
    +with Ada.Strings.Fixed; use Ada.Strings.Fixed;
    +with Prime_Numbers;
    +
    +procedure Achilles_Numbers is
    +
    +   package Long_Integer_Prime_Numbers is new Prime_Numbers
    +     (Integer, 0, 1, 2);
    +   use Long_Integer_Prime_Numbers;
    +
    +   --  A powerful number N is such that for every primer factor P of it
    +   --  P^2 also divides N
    +   --  Is_Powerful function decomposes the given number N in its prime factors
    +   --  and then it checks if each factor squared is a divisor of N
    +   function Is_Powerful (Number : Natural) return Boolean is
    +      List : constant Number_List  := Decompose (Integer (Number));
    +   begin
    +      for Index in List'Range loop
    +         declare
    +            N : constant Long_Long_Integer := Long_Long_Integer (Number);
    +            F : constant Long_Long_Integer := Long_Long_Integer (List (Index));
    +         begin
    +            if N mod (F * F) /= 0 then
    +               return False;
    +            end if;
    +         end;
    +      end loop;
    +
    +      return True;
    +   end Is_Powerful;
    +
    +   --  The Is_Power  function checks if a given number N can be written
    +   --  as a power of two integers that are > 1
    +   --  It makes use of the mathematical expression N = A^B
    +   --  taking Log(N) = Log (A^B) equals to B = Log (N) / Log (A)
    +   --  where the solutions are when B is an integer > 1
    +   function Is_Power (N : Integer) return Boolean is
    +
    +      function Is_Almost_Equal (A : Long_Float;
    +                                B : Long_Float) return Boolean is
    +         Epsilon : constant := 0.000_000_000_000_001;
    +      begin
    +         if abs (A - B) < Epsilon then
    +            return True;
    +         else
    +            return False;
    +         end if;
    +      end Is_Almost_Equal;
    +
    +      A       : Integer := 2;
    +      B       : Long_Float;
    +      Log_Of_N : constant Long_Float := Log (Long_Float (N), 2.0);
    +   begin
    +      if N = 1 then
    +         return True;
    +      end if;
    +
    +      while True loop
    +         B := Log_Of_N / Log (Long_Float (A), 2.0);
    +
    +         if Is_Almost_Equal (B, Long_Float (Integer (B)))
    +           and then Integer (B) > 1
    +         then
    +            return True;
    +         end if;
    +
    +         exit when A * A > N;
    +         A := @ + 1;
    +      end loop;
    +
    +      return False;
    +
    +   end Is_Power;
    +
    +   --  An Achilles number is a powerful number that can't be expressed
    +   --  as a power
    +   function Is_Achilles (N : Integer) return Boolean is
    +   begin
    +      if Is_Powerful (N) then
    +         if Is_Power (N) = False then
    +            return True;
    +         end if;
    +      end if;
    +
    +      return False;
    +   end Is_Achilles;
    +
    +   --  Calculates the Euler totient of a number
    +   function Totient (N : Integer) return Integer is
    +      Tot : Integer := N;
    +      I   : Integer;
    +      N2  : Integer := N;
    +   begin
    +      I := 2;
    +      while I * I <= N2 loop
    +         if N2 mod I = 0 then
    +            while N2 mod I = 0 loop
    +               N2 := N2 / I;
    +            end loop;
    +            Tot := Tot - Tot / I;
    +         end if;
    +
    +         if I = 2 then
    +            I := 1;
    +         end if;
    +         I := I + 2;
    +      end loop;
    +
    +      if N2 > 1 then
    +         Tot := Tot - Tot / N2;
    +      end if;
    +
    +      return Tot;
    +   end Totient;
    +
    +   --  A Strong Achilles number is an Achilles number whose Euler Totient
    +   --  is also an Achilles number
    +   function Is_Strong_Achilles (N : Integer) return Boolean is
    +   begin
    +      if Is_Achilles (N) then
    +         if Is_Achilles (Totient (N)) then
    +            return True;
    +         end if;
    +      end if;
    +
    +      return False;
    +   end Is_Strong_Achilles;
    +
    +   --  Counts the digits in a number by taking the string from
    +   --  its 'Image attribute, trimming it and counting the characters
    +   function Count_Digits (N : Integer) return Natural is
    +      Integer_Str : constant String := Trim (N'Image, Both);
    +   begin
    +      return Integer_Str'Length;
    +   end Count_Digits;
    +
    +begin
    +   --  Find the first 50 Achilles numbers
    +   declare
    +      N : Integer := 1;
    +      Count : Integer := 1;
    +   begin
    +      Ada.Text_IO.Put_Line ("First 50 Achilles numbers:");
    +
    +      while Count <= 50 loop
    +
    +         if Is_Achilles (N) then
    +            Count := @ + 1;
    +            Ada.Text_IO.Put (N'Image & " ");
    +         end if;
    +
    +         N := @ + 1;
    +      end loop;
    +
    +      Ada.Text_IO.New_Line;
    +   end;
    +
    +   --  Find the first 20 Strong Achilles numbers
    +   declare
    +      N : Integer := 1;
    +      Count : Integer := 1;
    +   begin
    +      Ada.Text_IO.Put_Line ("First 20 Strong Achilles numbers:");
    +
    +      while Count <= 20 loop
    +
    +         if Is_Strong_Achilles (N) then
    +            Count := @ + 1;
    +            Ada.Text_IO.Put (N'Image & " ");
    +         end if;
    +
    +         N := @ + 1;
    +      end loop;
    +
    +      Ada.Text_IO.New_Line;
    +   end;
    +
    +   --  Count numbers with digits
    +   declare
    +      Counts : array (2 .. 6) of Natural := [others => 0];
    +      N      : Integer := 1;
    +   begin
    +      Ada.Text_IO.Put_Line ("Number of Achilles numbers with:");
    +
    +      while Count_Digits (N) <= Counts'Last loop
    +
    +         --  Ada.Text_IO.Put_Line ("Testing: " & N'Image);
    +
    +         if Is_Achilles (N) then
    +            Counts (Count_Digits (N)) := @ + 1;
    +         end if;
    +         N := @ + 1;
    +      end loop;
    +
    +      for I in Counts'Range loop
    +         Ada.Text_IO.Put_Line (I'Image & " digits: " & Counts (I)'Image);
    +      end loop;
    +   end;
    +end Achilles_Numbers;
    diff --git a/Task/Achilles-numbers/Arturo/achilles-numbers.arturo b/Task/Achilles-numbers/Arturo/achilles-numbers.arturo
    new file mode 100644
    index 0000000000..939ef41b2a
    --- /dev/null
    +++ b/Task/Achilles-numbers/Arturo/achilles-numbers.arturo
    @@ -0,0 +1,36 @@
    +prettyPrint: function [res][
    +    res | split.every: 10
    +        | loop => [print map & 'x -> pad to :string x 7]
    +]
    +
    +achilles?: function [n][
    +    exps: values tally factors.prime n
    +    and? -> not? some? exps => one?
    +         -> 1 = fold exps [a b] -> gcd @[a b]
    +]
    +
    +phi: function [n][
    +    pf: tally factors.prime n
    +    fold.seed:1 keys pf [res pr][
    +        ipr: to :integer pr
    +        res * (ipr - 1) * ipr ^ dec to :integer pf\[ipr]
    +    ]
    +]
    +
    +n: 50
    +print ["First" n "Achilles numbers:"]
    +2..∞ | select.first: n => achilles?
    +     | prettyPrint
    +
    +print ""
    +print ["First" n "strong Achilles numbers:"]
    +2..∞ | select.first: n 'x -> and? [achilles? x][achilles? phi x]
    +     | prettyPrint
    +
    +print ""
    +counts: 2..1000000 | select => achilles?
    +                   | map => [size digits &]
    +                   | tally
    +
    +loop counts [k v]->
    +    print [k "digits:" v]
    diff --git a/Task/Achilles-numbers/BASIC256/achilles-numbers.basic b/Task/Achilles-numbers/BASIC256/achilles-numbers.basic
    new file mode 100644
    index 0000000000..aaf7c9cd80
    --- /dev/null
    +++ b/Task/Achilles-numbers/BASIC256/achilles-numbers.basic
    @@ -0,0 +1,85 @@
    +function GCD(n, d)
    +	if(d = 0) then return n else return GCD(d, n % d)
    +end function
    +
    +function Totient(n)
    +	tot = 0
    +	for m = 1 to n
    +		if GCD(m, n) = 1 then tot += 1
    +	next m
    +	return tot
    +end function
    +
    +function isPowerful(m)
    +	n = m
    +	f = 2
    +	l = sqr(m)
    +
    +	if m <= 1 then return false
    +	while true
    +		q = n/f
    +		if (n % f) = 0 then
    +			if (m %(f*f)) then return false
    +			n = q
    +			if f > n then exit while
    +		else
    +			f += 1
    +			if f > l then
    +				if (m % (n*n)) then return false
    +				exit while
    +			end if
    +		end if
    +	end while
    +	return true
    +end function
    +
    +function isAchilles(n)
    +	if not isPowerful(n) then return false
    +	m = 2
    +	a = m*m
    +	do
    +		do
    +			if a = n then return false
    +			a *= m
    +		until a > n
    +		m += 1
    +		a = m*m
    +	until a > n
    +	return true
    +end function
    +
    +print "First 50 Achilles numbers:"
    +num = 0
    +n = 1
    +do
    +	if isAchilles(n) then
    +		print rjust(n, 5);
    +		num += 1
    +		if (num % 10) <> 0 then print "   "; else print
    +	end if
    +	n += 1
    +until num >= 50
    +
    +print : print
    +print "First 20 strong Achilles numbers:"
    +num = 0
    +n = 1
    +do
    +	if isAchilles(n) and isAchilles(Totient(n)) then
    +		print rjust(n, 5);
    +		num += 1
    +		if (num % 10) <> 0 then print "   "; else print
    +	end if
    +	n += 1
    +until num >= 20
    +
    +print : print
    +print "Number of Achilles numbers with:"
    +for i = 2 to 6
    +	inicio = fix(10.0 ^ (i-1))
    +	num = 0
    +	for n = inicio to inicio*10-1
    +		if isAchilles(n) then num += 1
    +	next n
    +	print i; " digits:"; num
    +next i
    diff --git a/Task/Achilles-numbers/Ballerina/achilles-numbers.ballerina b/Task/Achilles-numbers/Ballerina/achilles-numbers.ballerina
    new file mode 100644
    index 0000000000..ff31e0dfeb
    --- /dev/null
    +++ b/Task/Achilles-numbers/Ballerina/achilles-numbers.ballerina
    @@ -0,0 +1,92 @@
    +import ballerina/io;
    +
    +map pps = {};
    +
    +function getPerfectPowers(int maxExp) {
    +    int upper  = 10.0.pow(maxExp);
    +    int upper2 = 10.0.pow(maxExp).sqrt().floor();
    +    foreach int i in 2...upper2 {
    +        int p = i;
    +        while true {
    +            if p > int:MAX_VALUE / i { break; }
    +            p *= i;
    +            if p >= upper { break; }
    +            pps[p.toString()] = 1;
    +        }
    +    }
    +}
    +
    +function getAchilles(int minExp, int maxExp) returns map {
    +    int lower  = 10.0.pow(minExp);
    +    int upper  = 10.0.pow(maxExp);
    +    int upper2 = 10.0.pow(maxExp).cbrt().floor();
    +    int upper3 = 10.0.pow(maxExp).sqrt().floor();
    +    map achilles = {};
    +    foreach int b in 1...upper2 {
    +        int b3 = b * b * b;
    +        foreach int a in 1...upper3 {
    +            int p = b3 * a * a;
    +            if p >= upper { break; }
    +            if p >= lower {
    +                string ps = p.toString();
    +                if !pps.hasKey(ps) {
    +                    achilles[ps] = 1;
    +                }
    +            }
    +        }
    +    }
    +    return achilles;
    +}
    +
    +function totient(int m) returns int {
    +    if m < 1 { return 0; }
    +    int tot = m;
    +    int n = m;
    +    int i = 2;
    +    while  i * i <= n {
    +        if (n % i) == 0 {
    +            while (n % i) == 0 { n /= i; }
    +            tot -= tot / i;
    +        }
    +        if i == 2 { i = 1; }
    +        i += 2;
    +    }
    +    if n > 1 {  tot -= tot / n; }
    +    return tot;
    +}
    +
    +public function main() returns error? {
    +    final int maxDigits = 14;
    +    getPerfectPowers(maxDigits);
    +    map achillesSet = getAchilles(1, 5); // enough for first 2 parts
    +    int[] achilles = achillesSet.keys().map(s => check int:fromString(s)).sort();
    +    io:println("First 50 Achilles numbers:");
    +    foreach int i in 0..<50 {
    +        string s = achilles[i].toString().padStart(4);
    +        io:print(s, " ");
    +        if (i + 1) % 10 == 0 { io:println(); }
    +    }
    +    io:println("\nFirst 30 strong Achilles numbers:");
    +    int[] strongAchilles = [];
    +    int count = 0;
    +    int n = 0;
    +    while count < 30 {
    +        int tot = totient(achilles[n]);
    +        if achillesSet.hasKey(tot.toString()) {
    +            strongAchilles.push(achilles[n]);
    +            count += 1;
    +        }
    +        n += 1;
    +    }
    +    foreach int j in 0..<30 {
    +        string t = strongAchilles[j].toString().padStart(5);
    +        io:print(t, " ");
    +        if (j + 1) % 10 == 0 { io:println(); }
    +    }
    +
    +    io:println("\nNumber of Achilles numbers with:");
    +    foreach int d in 2...maxDigits {
    +        int ac = getAchilles(d - 1, d).length();
    +        io:println(d.toString().padStart(2), " digits: ", ac);
    +    }
    +}
    diff --git a/Task/Achilles-numbers/C/achilles-numbers.c b/Task/Achilles-numbers/C/achilles-numbers.c
    new file mode 100644
    index 0000000000..f7ed293f8e
    --- /dev/null
    +++ b/Task/Achilles-numbers/C/achilles-numbers.c
    @@ -0,0 +1,105 @@
    +#include 
    +#include 
    +#include 
    +#include 
    +
    +bool is_prime(int n) {
    +    if (n < 2) return false;
    +    if (n % 2 == 0 && n != 2) return false;
    +    for (int i = 3; i <= sqrt(n); i += 2) {
    +        if (n % i == 0) return false;
    +    }
    +    return true;
    +}
    +
    +int phi(int n) {
    +    int result = n;
    +    for (int p = 2; p * p <= n; p++) {
    +        if (n % p == 0) {
    +            while (n % p == 0) n /= p;
    +            result -= result / p;
    +        }
    +    }
    +    if (n > 1) result -= result / n;
    +    return result;
    +}
    +
    +bool is_powerful(int n) {
    +    int m = n;
    +    for (int p = 2; p * p <= n; p++) {
    +        if (m % p == 0) {
    +            int exp = 0;
    +            while (m % p == 0) {
    +                m /= p;
    +                exp++;
    +            }
    +            if (exp < 2) return false;
    +        }
    +    }
    +    if (m > 1) return false;
    +    return true;
    +}
    +
    +bool is_perfect_power(int n) {
    +    for (int k = 2; k <= log2(n); k++) {
    +        double root = pow(n, 1.0 / k);
    +        int r = round(root);
    +        if (pow(r, k) == n) return true;
    +    }
    +    return false;
    +}
    +
    +bool is_achilles(int n) {
    +    return is_powerful(n) && !is_perfect_power(n);
    +}
    +
    +int main() {
    +    int *achilles = NULL, *strong = NULL;
    +    int a_count = 0, s_count = 0;
    +    int digit_counts[7] = {0};
    +
    +    for (int n = 2; a_count < 50 || s_count < 50; n++) {
    +        if (is_achilles(n)) {
    +            if (a_count < 50){
    +                achilles = realloc(achilles, (a_count+1)*sizeof(int));
    +                achilles[a_count++] = n;
    +            }
    +
    +            int ph = phi(n);
    +            if (is_achilles(ph)) {
    +                if (s_count < 50){
    +                    strong = realloc(strong, (s_count+1)*sizeof(int));
    +                    strong[s_count++] = n;
    +                }
    +            }
    +
    +        }
    +    }
    +
    +    for (int n = 2; n <= 1000000; n++) {
    +        if (is_achilles(n)) {
    +            int digits = floor(log10(n)) + 1;
    +            if (digits >= 2 && digits <= 15) {
    +                digit_counts[digits]++;
    +            }
    +        }
    +    }
    +
    +    printf("First 50 Achilles numbers:\n");
    +    for (int i = 0; i < 50; i++) {
    +        printf("%d ", achilles[i]);
    +    }
    +    printf("\n\n");
    +
    +    printf("First 50 Strong Achilles numbers:\n");
    +    for (int i = 0; i < 50; i++) {
    +        printf("%d ", strong[i]);
    +    }
    +    printf("\n\n");
    +
    +    for (int d = 2; d <= 6; d++) {
    +        printf("Achilles numbers with %d digits: %d\n", d, digit_counts[d]);
    +    }
    +
    +    return 0;
    +}
    diff --git a/Task/Achilles-numbers/COBOL/achilles-numbers.cob b/Task/Achilles-numbers/COBOL/achilles-numbers.cob
    new file mode 100644
    index 0000000000..f5fdc87beb
    --- /dev/null
    +++ b/Task/Achilles-numbers/COBOL/achilles-numbers.cob
    @@ -0,0 +1,257 @@
    +       IDENTIFICATION DIVISION.
    +       PROGRAM-ID. ACHILLES-NUMBERS.
    +
    +       DATA DIVISION.
    +       WORKING-STORAGE SECTION.
    +       01 CONSTANTS.
    +          05 MAX-LIMIT     PIC 9(10) COMP VALUE 100000000.
    +          05 MAX-LIMIT-SQR PIC 9(6) COMP VALUE 10000.
    +          05 MAX-LIMIT-CUB PIC 9(6) COMP VALUE 464.
    +
    +       01 PP-TEMP-DATA.
    +          05 PP-TEMP-COUNT PIC 9(6) COMP VALUE 0.
    +          05 PP-TEMP-TABLE.
    +             10 PP-TEMP OCCURS 1 TO 15000 TIMES DEPENDING ON PP-TEMP-COUNT
    +                            ASCENDING KEY IS PP-TEMP
    +                            PIC 9(10) COMP.
    +
    +       01 PP-FINAL-DATA.
    +          05 PP-COUNT      PIC 9(6) COMP VALUE 0.
    +          05 PP-TABLE.
    +             10 P-POWER    OCCURS 1 TO 15000 TIMES DEPENDING ON PP-COUNT
    +                            ASCENDING KEY IS P-POWER
    +                            INDEXED BY PP-IDX
    +                            PIC 9(10) COMP.
    +
    +       01 ACH-TEMP-DATA.
    +          05 ACH-TEMP-COUNT PIC 9(6) COMP VALUE 0.
    +          05 ACH-TEMP-TABLE.
    +             10 ACH-TEMP   OCCURS 1 TO 35000 TIMES DEPENDING ON ACH-TEMP-COUNT
    +                            ASCENDING KEY IS ACH-TEMP
    +                            PIC 9(10) COMP.
    +
    +       01 ACH-FINAL-DATA.
    +          05 ACH-COUNT     PIC 9(6) COMP VALUE 0.
    +          05 ACH-TABLE.
    +             10 ACHILLES   OCCURS 1 TO 15000 TIMES DEPENDING ON ACH-COUNT
    +                            ASCENDING KEY IS ACHILLES
    +                            INDEXED BY ACH-IDX
    +                            PIC 9(10) COMP.
    +
    +       01 LOOP-VARS.
    +          05 I             PIC 9(6) COMP.
    +          05 B             PIC 9(6) COMP.
    +          05 A             PIC 9(6) COMP.
    +          05 LAST-VAL      PIC 9(10) COMP.
    +
    +       01 CALC-VARS.
    +          05 P             PIC 9(18) COMP.
    +          05 B3            PIC 9(18) COMP.
    +          05 SEARCH-P      PIC 9(10) COMP.
    +
    +       01 TOT-VARS.
    +          05 TOTIENT-IN    PIC 9(10) COMP.
    +          05 TOTIENT-OUT   PIC 9(10) COMP.
    +          05 TOT-I         PIC 9(10) COMP.
    +          05 TOT-N         PIC 9(10) COMP.
    +          05 TOT-Q         PIC 9(10) COMP.
    +          05 TOT-R         PIC 9(10) COMP.
    +          05 SUB-VAL       PIC 9(10) COMP.
    +
    +       01 STRONG-ACH-VARS.
    +          05 FOUND-FLAG    PIC 9 VALUE 0.
    +          05 STRONG-COUNT  PIC 9(4) COMP VALUE 0.
    +          05 STRONG-ACH    OCCURS 30 TIMES PIC 9(10) COMP.
    +
    +       01 REPORT-VARS.
    +          05 DISP-4        PIC ZZZ9.
    +          05 DISP-5        PIC ZZZZ9.
    +          05 DISP-2        PIC Z9.
    +          05 DISP-NUM      PIC Z(9)9.
    +          05 FORMATTED-LINE PIC X(60) VALUE SPACES.
    +          05 LINE-POS      PIC 9(4) COMP VALUE 1.
    +          05 ROW-COUNT     PIC 9(4) COMP VALUE 0.
    +          05 DIGIT-COUNT   PIC 9(10) COMP.
    +          05 D             PIC 9(2) COMP.
    +          05 LOWER-BND     PIC 9(10) COMP.
    +          05 UPPER-BND     PIC 9(10) COMP.
    +
    +       PROCEDURE DIVISION.
    +       MAIN-PARA.
    +           PERFORM GENERATE-PERFECT-POWERS.
    +           PERFORM GENERATE-ACHILLES.
    +           PERFORM PRINT-FIRST-50.
    +           PERFORM PRINT-STRONG-30.
    +           PERFORM PRINT-DIGITS.
    +           STOP RUN.
    +
    +       GENERATE-PERFECT-POWERS.
    +           MOVE 0 TO PP-TEMP-COUNT.
    +           PERFORM VARYING I FROM 2 BY 1 UNTIL I > MAX-LIMIT-SQR
    +               COMPUTE P = I * I
    +               PERFORM UNTIL P >= MAX-LIMIT
    +                   ADD 1 TO PP-TEMP-COUNT
    +                   MOVE P TO PP-TEMP(PP-TEMP-COUNT)
    +                   COMPUTE P = P * I
    +               END-PERFORM
    +           END-PERFORM.
    +
    +           SORT PP-TEMP ON ASCENDING KEY PP-TEMP.
    +
    +           MOVE 0 TO PP-COUNT.
    +           MOVE 0 TO LAST-VAL.
    +           PERFORM VARYING I FROM 1 BY 1 UNTIL I > PP-TEMP-COUNT
    +               IF PP-TEMP(I) NOT = LAST-VAL THEN
    +                   ADD 1 TO PP-COUNT
    +                   MOVE PP-TEMP(I) TO P-POWER(PP-COUNT)
    +                   MOVE PP-TEMP(I) TO LAST-VAL
    +               END-IF
    +           END-PERFORM.
    +
    +       GENERATE-ACHILLES.
    +           MOVE 0 TO ACH-TEMP-COUNT.
    +           PERFORM VARYING B FROM 1 BY 1 UNTIL B > MAX-LIMIT-CUB
    +               COMPUTE B3 = B * B * B
    +               PERFORM VARYING A FROM 1 BY 1 UNTIL A > MAX-LIMIT-SQR
    +                   COMPUTE P = B3 * A * A
    +                   IF P >= MAX-LIMIT THEN
    +                       EXIT PERFORM
    +                   END-IF
    +
    +                   IF P > 1 THEN
    +                       MOVE P TO SEARCH-P
    +                       MOVE 0 TO FOUND-FLAG
    +                       SEARCH ALL P-POWER
    +                           AT END
    +                               MOVE 0 TO FOUND-FLAG
    +                           WHEN P-POWER(PP-IDX) = SEARCH-P
    +                               MOVE 1 TO FOUND-FLAG
    +                       END-SEARCH
    +
    +                       IF FOUND-FLAG = 0 THEN
    +                           ADD 1 TO ACH-TEMP-COUNT
    +                           MOVE P TO ACH-TEMP(ACH-TEMP-COUNT)
    +                       END-IF
    +                   END-IF
    +               END-PERFORM
    +           END-PERFORM.
    +
    +           SORT ACH-TEMP ON ASCENDING KEY ACH-TEMP.
    +
    +           MOVE 0 TO ACH-COUNT.
    +           MOVE 0 TO LAST-VAL.
    +           PERFORM VARYING I FROM 1 BY 1 UNTIL I > ACH-TEMP-COUNT
    +               IF ACH-TEMP(I) NOT = LAST-VAL THEN
    +                   ADD 1 TO ACH-COUNT
    +                   MOVE ACH-TEMP(I) TO ACHILLES(ACH-COUNT)
    +                   MOVE ACH-TEMP(I) TO LAST-VAL
    +               END-IF
    +           END-PERFORM.
    +
    +       CALC-TOTIENT.
    +           MOVE TOTIENT-IN TO TOT-N
    +           MOVE TOTIENT-IN TO TOTIENT-OUT
    +           MOVE 2 TO TOT-I
    +           PERFORM UNTIL TOT-I * TOT-I > TOT-N
    +               DIVIDE TOT-N BY TOT-I GIVING TOT-Q REMAINDER TOT-R
    +               IF TOT-R = 0 THEN
    +                   PERFORM UNTIL TOT-R NOT = 0
    +                       DIVIDE TOT-N BY TOT-I GIVING TOT-Q REMAINDER TOT-R
    +                       IF TOT-R = 0 THEN
    +                           MOVE TOT-Q TO TOT-N
    +                       END-IF
    +                   END-PERFORM
    +                   DIVIDE TOTIENT-OUT BY TOT-I GIVING SUB-VAL
    +                   SUBTRACT SUB-VAL FROM TOTIENT-OUT
    +               END-IF
    +               IF TOT-I = 2 THEN
    +                   MOVE 1 TO TOT-I
    +               END-IF
    +               ADD 2 TO TOT-I
    +           END-PERFORM.
    +           IF TOT-N > 1 THEN
    +               DIVIDE TOTIENT-OUT BY TOT-N GIVING SUB-VAL
    +               SUBTRACT SUB-VAL FROM TOTIENT-OUT
    +           END-IF.
    +
    +       PRINT-FIRST-50.
    +           DISPLAY "First 50 Achilles numbers:".
    +           MOVE SPACES TO FORMATTED-LINE.
    +           MOVE 1 TO LINE-POS.
    +           MOVE 0 TO ROW-COUNT.
    +           PERFORM VARYING I FROM 1 BY 1 UNTIL I > 50
    +               MOVE ACHILLES(I) TO DISP-4
    +               STRING DISP-4 " " DELIMITED BY SIZE
    +                      INTO FORMATTED-LINE WITH POINTER LINE-POS
    +               ADD 1 TO ROW-COUNT
    +               IF ROW-COUNT = 10 THEN
    +                   DISPLAY FORMATTED-LINE(1:LINE-POS - 1)
    +                   MOVE SPACES TO FORMATTED-LINE
    +                   MOVE 1 TO LINE-POS
    +                   MOVE 0 TO ROW-COUNT
    +               END-IF
    +           END-PERFORM.
    +
    +       PRINT-STRONG-30.
    +           DISPLAY " ".
    +           DISPLAY "First 30 strong Achilles numbers:".
    +           MOVE 0 TO STRONG-COUNT.
    +           PERFORM VARYING I FROM 1 BY 1 UNTIL STRONG-COUNT >= 30 OR I > ACH-COUNT
    +               MOVE ACHILLES(I) TO TOTIENT-IN
    +               PERFORM CALC-TOTIENT
    +
    +               MOVE TOTIENT-OUT TO SEARCH-P
    +               MOVE 0 TO FOUND-FLAG
    +               SEARCH ALL ACHILLES
    +                   AT END
    +                       MOVE 0 TO FOUND-FLAG
    +                   WHEN ACHILLES(ACH-IDX) = SEARCH-P
    +                       MOVE 1 TO FOUND-FLAG
    +               END-SEARCH
    +
    +               IF FOUND-FLAG = 1 THEN
    +                   ADD 1 TO STRONG-COUNT
    +                   MOVE ACHILLES(I) TO STRONG-ACH(STRONG-COUNT)
    +               END-IF
    +           END-PERFORM.
    +
    +           MOVE SPACES TO FORMATTED-LINE.
    +           MOVE 1 TO LINE-POS.
    +           MOVE 0 TO ROW-COUNT.
    +           PERFORM VARYING I FROM 1 BY 1 UNTIL I > 30
    +               MOVE STRONG-ACH(I) TO DISP-5
    +               STRING DISP-5 " " DELIMITED BY SIZE
    +                      INTO FORMATTED-LINE WITH POINTER LINE-POS
    +               ADD 1 TO ROW-COUNT
    +               IF ROW-COUNT = 10 THEN
    +                   DISPLAY FORMATTED-LINE(1:LINE-POS - 1)
    +                   MOVE SPACES TO FORMATTED-LINE
    +                   MOVE 1 TO LINE-POS
    +                   MOVE 0 TO ROW-COUNT
    +               END-IF
    +           END-PERFORM.
    +
    +       PRINT-DIGITS.
    +           DISPLAY " ".
    +           DISPLAY "Number of Achilles numbers with:".
    +           MOVE 10 TO LOWER-BND.
    +           COMPUTE UPPER-BND = 100.
    +           PERFORM VARYING D FROM 2 BY 1 UNTIL D > 8
    +               MOVE 0 TO DIGIT-COUNT
    +               PERFORM VARYING I FROM 1 BY 1 UNTIL I > ACH-COUNT
    +                   IF ACHILLES(I) >= UPPER-BND THEN
    +                       EXIT PERFORM
    +                   END-IF
    +                   IF ACHILLES(I) >= LOWER-BND THEN
    +                       ADD 1 TO DIGIT-COUNT
    +                   END-IF
    +               END-PERFORM
    +
    +               MOVE D TO DISP-2
    +               MOVE DIGIT-COUNT TO DISP-NUM
    +
    +               DISPLAY DISP-2 " digits: " FUNCTION TRIM(DISP-NUM)
    +
    +               MOVE UPPER-BND TO LOWER-BND
    +               COMPUTE UPPER-BND = UPPER-BND * 10
    +           END-PERFORM.
    diff --git a/Task/Achilles-numbers/Crystal/achilles-numbers.cr b/Task/Achilles-numbers/Crystal/achilles-numbers.cr
    new file mode 100644
    index 0000000000..2cb66173f9
    --- /dev/null
    +++ b/Task/Achilles-numbers/Crystal/achilles-numbers.cr
    @@ -0,0 +1,86 @@
    +struct Int
    +  def totient
    +    n = self
    +    return 0 if n < 1
    +    tot = n
    +    i = typeof(n).new(2)
    +    while i*i <= n
    +      if n % i == 0
    +        while n % i == 0
    +          n //= i
    +        end
    +        tot -= tot // i
    +      end
    +      if i == 2; i = 1 end
    +      i += 2
    +    end
    +    if n > 1
    +      tot -= tot // n
    +    end
    +    tot
    +  end
    +end
    +
    +def get_perfect_powers (max_exp)
    +  upper = 10_u64 ** max_exp
    +  pps = Set(UInt64).new
    +  (2_u64 .. Math.isqrt(upper)).each do |i|
    +    p = i
    +    while (p *= i) < upper
    +      pps << p
    +    end
    +  end
    +  pps
    +end
    +
    +def get_achilles (min_exp, max_exp, pps)
    +  lower = 10_u64 ** min_exp
    +  upper = 10_u64 ** max_exp
    +  achilles = Set(UInt64).new
    +  (1_u64 .. Math.cbrt(upper).to_u64).each do |b|
    +    b3 = b * b * b
    +    (1_u64 .. Math.isqrt(upper)).each do |a|
    +      p = b3 * a * a
    +      break if p >= upper
    +      if p >= lower
    +        achilles << p unless p.in? pps
    +      end
    +    end
    +  end
    +  achilles
    +end
    +
    +def tprint (fmt, seq, row_sz)
    +  seq.in_slices_of(row_sz).each do |slice|
    +    puts slice.map {|elt| fmt % { elt } }.join(" ")
    +  end
    +end
    +
    +max_digits = 12
    +pps = get_perfect_powers(max_digits)
    +
    +achilles_set = get_achilles(1, 5, pps)
    +achilles = achilles_set.to_a.sort!
    +
    +puts "First 50 Achilles numbers:"
    +tprint("%4d", achilles.first(50), 10)
    +
    +puts "\nFirst 30 strong Achilles numbers:"
    +strong_achilles = [] of UInt64
    +count = 0
    +n = 0
    +while count < 30
    +  tot = achilles[n].totient
    +  if tot.in? achilles_set
    +    strong_achilles << achilles[n]
    +    count += 1
    +  end
    +  n += 1
    +end
    +tprint("%5d", strong_achilles, 10)
    +
    +puts "\nNumber of Achilles numbers with:"
    +(2..max_digits).each do |d|
    +  ac = get_achilles(d-1, d, pps).size
    +  puts "%2d digits: %d" % { d, ac }
    +end
    diff --git a/Task/Achilles-numbers/Delphi/achilles-numbers.delphi b/Task/Achilles-numbers/Delphi/achilles-numbers.pas
    similarity index 100%
    rename from Task/Achilles-numbers/Delphi/achilles-numbers.delphi
    rename to Task/Achilles-numbers/Delphi/achilles-numbers.pas
    diff --git a/Task/Achilles-numbers/EasyLang/achilles-numbers.easy b/Task/Achilles-numbers/EasyLang/achilles-numbers.easy
    new file mode 100644
    index 0000000000..c84b968a4a
    --- /dev/null
    +++ b/Task/Achilles-numbers/EasyLang/achilles-numbers.easy
    @@ -0,0 +1,82 @@
    +fastfunc gcd n d .
    +   if d = 0 : return n
    +   return gcd d (n mod d)
    +.
    +fastfunc totient n .
    +   m = 1
    +   while m <= n
    +      if gcd m n = 1 : tot += 1
    +      m += 1
    +   .
    +   return tot
    +.
    +fastfunc isPowerful m .
    +   n = m
    +   f = 2
    +   l = sqrt m
    +   if m <= 1 : return 0
    +   while 1 = 1
    +      if n mod f = 0
    +         if m mod (f * f) <> 0 : return 0
    +         n = n div f
    +         if f > n : return 1
    +      else
    +         f += 1
    +         if f > l
    +            if m mod (n * n) <> 0 : return 0
    +            return 1
    +         .
    +      .
    +   .
    +.
    +fastfunc isAchilles n .
    +   if isPowerful n = 0 : return 0
    +   m = 2
    +   a = m * m
    +   repeat
    +      repeat
    +         if a = n : return 0
    +         a *= m
    +         until a > n
    +      .
    +      m += 1
    +      a = m * m
    +      until a > n
    +   .
    +   return 1
    +.
    +print "First 50 Achilles numbers:"
    +n = 1
    +while cnt < 50
    +   if isAchilles n = 1
    +      write n & " "
    +      cnt += 1
    +      if cnt mod 10 = 0 : print ""
    +   .
    +   n += 1
    +.
    +print ""
    +print "First 20 strong Achilles numbers:"
    +cnt = 0
    +n = 1
    +while cnt < 20
    +   if isAchilles n = 1 and isAchilles totient n = 1
    +      write n & " "
    +      cnt += 1
    +      if cnt mod 10 = 0 : print ""
    +   .
    +   n += 1
    +.
    +print ""
    +print "Number of Achilles numbers with 2 to 5 digits:"
    +a = 10
    +b = 100
    +for i = 2 to 5
    +   num = 0
    +   for n = a to b - 1
    +      num += isAchilles n
    +   .
    +   write num & " "
    +   a = b
    +   b *= 10
    +.
    diff --git a/Task/Achilles-numbers/FutureBasic/achilles-numbers.basic b/Task/Achilles-numbers/FutureBasic/achilles-numbers.basic
    new file mode 100644
    index 0000000000..194d6b3e21
    --- /dev/null
    +++ b/Task/Achilles-numbers/FutureBasic/achilles-numbers.basic
    @@ -0,0 +1,90 @@
    +NSInteger local fn GCD( n as NSInteger, d as NSInteger )
    +  if ( d == 0 ) then return n else return fn GCD( d, n % d )
    +end fn = 0
    +
    +NSInteger local fn Totient( n as NSInteger )
    +  NSInteger tot = 0
    +  for NSInteger m = 1 to n
    +    if fn GCD( m, n ) = 1 then tot++
    +  next
    +  return tot
    +end fn = 0
    +
    +BOOL local fn IsPowerful( m as NSInteger )
    +  int n = m
    +  int f = 2
    +  double l = sqr(m)
    +
    +  if m <= 1 then return NO
    +  while ( YES )
    +    NSInteger q = n / f
    +    if ( n % f ) == 0
    +      if ( m % (f * f) ) then return NO
    +      n = q
    +      if f > n then exit while
    +    else
    +      f++
    +      if ( f > l )
    +        if ( m % (n * n) ) then return NO
    +        exit while
    +      end if
    +    end if
    +  wend
    +end fn = YES
    +
    +BOOL local fn IsAchilles( n as NSInteger )
    +  if fn IsPowerful(n) == NO then return NO
    +  NSInteger m = 2
    +  NSInteger a = m * m
    +  do
    +    do
    +      if a == n then return NO
    +      a *= m
    +    until ( a > n )
    +    m++
    +    a = m * m
    +  until ( a > n )
    +end fn = YES
    +
    +local fn AchillesNumbers
    +  print "First 50 Achilles numbers:"
    +  NSInteger num = 0
    +  NSInteger n = 1
    +
    +  CFTimeInterval t : t = fn CACurrentMediaTime
    +  do
    +    if fn IsAchilles( n )
    +      printf @"%4d \b", n
    +      num++
    +      if ( num % 10 ) != 0 then printf @" \b" else print
    +    end if
    +    n++
    +  until ( num >= 50 )
    +
    +  printf @"\n\nFirst 20 strong Achilles numbers:"
    +  num = 0
    +  n = 1
    +  do
    +    if fn IsAchilles(n) && fn IsAchilles( fn Totient(n) )
    +      printf @"%5d \b", n
    +      num++
    +      if ( num % 5 ) != 0 then printf @" \b" else print
    +    end if
    +    n++
    +  until ( num >= 20 )
    +
    +  printf @"\n"
    +  for NSInteger i = 2 to 6
    +    NSInteger inicio = fix( 10.0 ^ (i-1) )
    +    num = 0
    +    for n = inicio to inicio * 10 -1
    +      if fn IsAchilles(n) then num++
    +    next
    +    printf @"Achilles numbers with %d digits: %d", i, num
    +  next
    +  printf @"\nCompute time: %.3f ms", (fn CACurrentMediaTime - t ) * 1000
    +end fn
    +
    +fn AchillesNumbers
    +
    +HandleEvents
    diff --git a/Task/Achilles-numbers/Java/achilles-numbers.java b/Task/Achilles-numbers/Java/achilles-numbers.java
    index 5c4489b4a8..8feaddc1fe 100644
    --- a/Task/Achilles-numbers/Java/achilles-numbers.java
    +++ b/Task/Achilles-numbers/Java/achilles-numbers.java
    @@ -1,78 +1,108 @@
     import java.util.ArrayList;
    +import java.util.Collections;
    +import java.util.HashMap;
     import java.util.List;
    -import java.util.Set;
    -import java.util.TreeSet;
    -import java.util.stream.Collectors;
    -import java.util.stream.IntStream;
    +import java.util.Map;
     
    -public final class AchlllesNumbers {
    +public class AchillesNumbers {
     
    -	public static void main(String[] aArgs) {
    -		Set perfectPowers = perfectPowers(500_000);
    -	    List achilles = achilles(1, 250_000, perfectPowers);
    -	    List totients = totients(250_000);
    +    private Map pps = new HashMap<>();
     
    -	    System.out.println("First 50 Achilles numbers:");
    -	    for ( int i = 0; i < 50; i++ ) {
    -	    	System.out.print(String.format("%4d%s", achilles.get(i), ( ( i + 1 ) % 10 == 0 ) ? "\n" : " "));
    -	    }
    -	    System.out.println();
    -	
    -	    System.out.println("First 50 strong Achilles numbers:");
    -	    for ( int i = 0, count = 0; count < 50; i++ ) {
    -	    	if ( achilles.contains(totients.get(achilles.get(i))) ) {
    -	    		System.out.print(String.format("%6d%s", achilles.get(i), ( ++count % 10 == 0 ) ? "\n" : " "));
    -	    	}
    -	    }
    -	    System.out.println();
    -	
    -	    System.out.println("Number of Achilles numbers with:");
    -	    for ( int i = 100; i < 1_000_000; i *= 10 ) {
    -	    	final int digits = String.valueOf(i).length() - 1;
    -	    	System.out.println("    " + digits + " digits: " + achilles(i / 10, i - 1, perfectPowers).size());
    -	    }
    -	}
    -	
    -	private static List achilles(int aFrom, int aTo, Set aPerfectPowers) {
    -	    Set result = new TreeSet();
    -	    final int cubeRoot = (int) Math.cbrt(aTo / 4);
    -	    final int squareRoot = (int) Math.sqrt(aTo / 8);
    -	    for ( int b = 2; b <= cubeRoot; b++ ) {
    -	        final int bCubed = b * b * b;
    -	        for ( int a = 2; a <= squareRoot; a++ ) {
    -	            int achilles = bCubed * a * a;
    -	            if ( achilles >= aTo ) {
    -	                break;
    -	            }
    -	            if ( achilles >= aFrom && ! aPerfectPowers.contains(achilles) ) {
    -	                result.add(achilles);
    -	            }
    -	        }
    -	    }
    -	    return new ArrayList(result);
    -	}
    -	
    -	private static Set perfectPowers(int aN) {
    -	    Set result = new TreeSet();
    -	    for ( int i = 2, root = (int) Math.sqrt(aN); i <= root; i++ ) {
    -	        for ( int perfect = i * i; perfect < aN; perfect *= i ) {
    -	            result.add(perfect);
    -	        }
    -	    }
    -	    return result;
    -	}
    -	
    -	private static List totients(int aN) {
    -		List result = IntStream.rangeClosed(0, aN).boxed().collect(Collectors.toList());;
    -		for ( int i = 2; i <= aN; i++ ) {
    -			if ( result.get(i) == i ) {
    -				result.set(i, i - 1);
    -				for ( int j = i * 2; j <= aN; j = j + i ) {
    -					result.set(j, ( result.get(j) / i ) * ( i - 1 ));
    -				}
    -			}
    -		}
    -		return result;
    -	}	
    +    public int totient(int n) {
    +        int tot = n;
    +        int i = 2;
    +        while (i * i <= n) {
    +            if (n % i == 0) {
    +                while (n % i == 0) {
    +                    n /= i;
    +                }
    +                tot -= tot / i;
    +            }
    +            if (i == 2) {
    +                i = 1;
    +            }
    +            i += 2;
    +        }
    +        if (n > 1) {
    +            tot -= tot / n;
    +        }
    +        return tot;
    +    }
     
    +    public void getPerfectPowers(int maxExp) {
    +        double upper = Math.pow(10, maxExp);
    +        for (int i = 2; i <= Math.sqrt(upper); i++) {
    +            double fi = i;
    +            double p = fi;
    +            while (true) {
    +                p *= fi;
    +                if (p >= upper) {
    +                    break;
    +                }
    +                pps.put((int) p, true);
    +            }
    +        }
    +    }
    +
    +    public Map getAchilles(int minExp, int maxExp) {
    +        double lower = Math.pow(10, minExp);
    +        double upper = Math.pow(10, maxExp);
    +        Map achilles = new HashMap<>();
    +        for (int b = 1; b <= (int) Math.cbrt(upper); b++) {
    +            int b3 = b * b * b;
    +            for (int a = 1; a <= (int) Math.sqrt(upper); a++) {
    +                int p = b3 * a * a;
    +                if (p >= (int) upper) {
    +                    break;
    +                }
    +                if (p >= (int) lower) {
    +                    if (!pps.containsKey(p)) {
    +                        achilles.put(p, true);
    +                    }
    +                }
    +            }
    +        }
    +        return achilles;
    +    }
    +
    +    public static void main(String[] args) {
    +        AchillesNumbers an = new AchillesNumbers();
    +
    +        int maxDigits = 8;
    +        an.getPerfectPowers(maxDigits);
    +        Map achillesSet = an.getAchilles(1, 5);
    +        List achilles = new ArrayList<>(achillesSet.keySet());
    +        Collections.sort(achilles);
    +
    +        System.out.println("First 50 Achilles numbers:");
    +        for (int i = 0; i < 50; i++) {
    +            System.out.printf("%4d ", achilles.get(i));
    +            if ((i + 1) % 10 == 0) {
    +                System.out.println();
    +            }
    +        }
    +
    +        System.out.println("\nFirst 30 strong Achilles numbers:");
    +        List strongAchilles = new ArrayList<>();
    +        int count = 0;
    +        for (int n = 0; count < 30; n++) {
    +            int tot = an.totient(achilles.get(n));
    +            if (achillesSet.containsKey(tot)) {
    +                strongAchilles.add(achilles.get(n));
    +                count++;
    +            }
    +        }
    +        for (int i = 0; i < 30; i++) {
    +            System.out.printf("%5d ", strongAchilles.get(i));
    +            if ((i + 1) % 10 == 0) {
    +                System.out.println();
    +            }
    +        }
    +
    +        System.out.println("\nNumber of Achilles numbers with:");
    +        for (int d = 2; d <= maxDigits; d++) {
    +            int ac = an.getAchilles(d - 1, d).size();
    +            System.out.printf("%2d digits: %d\n", d, ac);
    +        }
    +    }
     }
    diff --git a/Task/Achilles-numbers/JavaScript/achilles-numbers.js b/Task/Achilles-numbers/JavaScript/achilles-numbers.js
    new file mode 100644
    index 0000000000..3f0113554c
    --- /dev/null
    +++ b/Task/Achilles-numbers/JavaScript/achilles-numbers.js
    @@ -0,0 +1,129 @@
    +class AchillesNumbers {
    +    constructor() {
    +        this.pps = new Map(); // Stores perfect powers
    +    }
    +
    +    // Euler's totient function
    +    totient(n) {
    +        let tot = n;
    +        let i = 2;
    +        while (i * i <= n) {
    +            if (n % i === 0) {
    +                // Remove all factors of i
    +                while (n % i === 0) {
    +                    n = Math.floor(n / i);
    +                }
    +                tot -= Math.floor(tot / i);
    +            }
    +            // Handle even/odd step correctly
    +            if (i === 2) {
    +                i = 1;
    +            }
    +            i += 2;
    +        }
    +        // If remaining n is a prime
    +        if (n > 1) {
    +            tot -= Math.floor(tot / n);
    +        }
    +        return tot;
    +    }
    +
    +    // Generate all perfect powers up to 10^maxExp
    +    getPerfectPowers(maxExp) {
    +        const upper = Math.pow(10, maxExp);
    +        const sqrtUpper = Math.floor(Math.sqrt(upper));
    +
    +        for (let i = 2; i <= sqrtUpper; i++) {
    +            let p = i;
    +            while (true) {
    +                p *= i;
    +                if (p >= upper) break;
    +                this.pps.set(Math.floor(p), true);
    +            }
    +        }
    +    }
    +
    +    // Generate all Achilles numbers between 10^minExp and 10^maxExp
    +    getAchilles(minExp, maxExp) {
    +        const lower = Math.pow(10, minExp);
    +        const upper = Math.pow(10, maxExp);
    +        const achilles = new Map();
    +
    +        const cbrtUpper = Math.floor(Math.cbrt(upper));
    +        for (let b = 1; b <= cbrtUpper; b++) {
    +            const b3 = b * b * b;
    +            const sqrtUpper = Math.floor(Math.sqrt(upper));
    +
    +            for (let a = 1; a <= sqrtUpper; a++) {
    +                const p = b3 * a * a;
    +                if (p >= upper) break;
    +
    +                if (p >= lower) {
    +                    if (!this.pps.has(p)) {
    +                        achilles.set(p, true);
    +                    }
    +                }
    +            }
    +        }
    +        return achilles;
    +    }
    +
    +    static main() {
    +        const an = new AchillesNumbers();
    +        const maxDigits = 8;
    +
    +        an.getPerfectPowers(maxDigits);
    +        const achillesSet = an.getAchilles(1, 5);
    +
    +        // Convert map keys to sorted array
    +        const achilles = Array.from(achillesSet.keys()).sort((a, b) => a - b);
    +
    +        // Print first 50 Achilles numbers
    +        console.log("First 50 Achilles numbers:");
    +        let output = "";
    +        for (let i = 0; i < 50; i++) {
    +            output += `${achilles[i].toString().padStart(4)} `;
    +            if ((i + 1) % 10 === 0) {
    +                console.log(output);
    +                output = "";
    +            }
    +        }
    +        if (output) console.log(output);
    +
    +        // Print first 30 strong Achilles numbers
    +        console.log("\nFirst 30 strong Achilles numbers:");
    +        const strongAchilles = [];
    +        let count = 0;
    +        let idx = 0;
    +
    +        while (count < 30 && idx < achilles.length) {
    +            const n = achilles[idx];
    +            const tot = an.totient(n);
    +            if (achillesSet.has(tot)) {
    +                strongAchilles.push(n);
    +                count++;
    +            }
    +            idx++;
    +        }
    +
    +        output = "";
    +        for (let i = 0; i < 30; i++) {
    +            output += `${strongAchilles[i].toString().padStart(5)} `;
    +            if ((i + 1) % 10 === 0) {
    +                console.log(output);
    +                output = "";
    +            }
    +        }
    +        if (output) console.log(output);
    +
    +        // Print counts per digit length
    +        console.log("\nNumber of Achilles numbers with:");
    +        for (let d = 2; d <= maxDigits; d++) {
    +            const ac = an.getAchilles(d - 1, d).size;
    +            console.log(`${d.toString().padStart(2)} digits: ${ac}`);
    +        }
    +    }
    +}
    +
    +// Execute the main method
    +AchillesNumbers.main();
    diff --git a/Task/Achilles-numbers/Jq/achilles-numbers.jq b/Task/Achilles-numbers/Jq/achilles-numbers.jq
    new file mode 100644
    index 0000000000..bee771c17d
    --- /dev/null
    +++ b/Task/Achilles-numbers/Jq/achilles-numbers.jq
    @@ -0,0 +1,90 @@
    +# Require $n > 0
    +def nwise($n):
    +  def _n: if length <= $n then . else .[:$n] , (.[$n:] | _n) end;
    +  if $n <= 0 then "nwise: argument should be non-negative" else _n end;
    +
    +### Part 1 - generic functions
    +
    +# Ensure $x is in the input sorted array
    +def ensure($x):
    +  bsearch($x) as $i
    +  | if $i >= 0 then .
    +    else (-1-$i) as $i
    +    | .[:$i] + [$x] + .[$i:]
    +    end ;
    +
    +def lpad($len): tostring | ($len - length) as $l | (" " * $l) + .;
    +
    +def table($wide; $pad):
    +   nwise($wide) | map(lpad($pad)) | join(" ");
    +
    +def count(s): reduce s as $x (0; .+1);
    +
    +def power($b): . as $in | reduce range(0;$b) as $i (1; . * $in);
    +
    +# jq optimizes the recursive call of _gcd in the following:
    +def gcd($a;$b):
    +  def _gcd:
    +    if .[1] != 0 then [.[1], .[0] % .[1]] | _gcd else .[0] end;
    +  [$a,$b] | _gcd ;
    +
    +def totient:
    +  . as $n
    +  | count( range(0; .) | select( gcd($n; .) == 1) );
    +
    +# Emit a sorted array
    +def getPerfectPowers( $maxExp ):
    +  (10 | power($maxExp)) as $upper
    +  | reduce range( 2; 1 + ($upper|sqrt|floor)) as $i ({pps: []};
    +     .p = $i * $i
    +     | until (.p >= $upper;
    +         .pps += [ .p ]
    +         | .p *= $i) )
    +  | .pps
    +  | sort;
    +
    +# Input: a sufficiently long array of perfect powers in order
    +def getAchilles($minExp; $maxExp):
    +  def cbrt: pow(.; 1/3);
    +  . as $pps
    +  | (10 | power($minExp)) as $lower
    +  | (10 | power($maxExp)) as $upper
    +  | ($upper | sqrt | floor) as $sqrtupper
    +  | reduce range(1; 1 + ($upper|cbrt|floor)) as $b ({achilles: []};
    +        ($b | .*.*.) as $b3
    +        | .done = false
    +        | .a = 1
    +        | until(.done or (.a > $sqrtupper);
    +            ($b3 * .a * .a) as $p
    +            | if $p >= $upper then .done = true
    +              elif $p >= $lower and ($pps | bsearch($p) < 0)
    +              then .achilles |= ensure($p)
    +              end
    +            | .a += 1 ) )
    +  | .achilles;
    +
    +def task($maxDigits):
    +  getPerfectPowers($maxDigits)
    +  | . as $perfectPowers
    +  | getAchilles(1; 5)
    +  | . as $achilles
    +  | "First 50 Achilles numbers:",
    +     (.[:50] | table(10;5)),
    +     "\nFirst 30 strong Achilles numbers:",
    +     ({ strongAchilles:[], count:0, n:0 }
    +     | until (.count >= 30;
    +         $achilles[.n] as $a
    +         | ($a | totient) as $tot
    +         | if ($achilles | bsearch($tot)) >= 0
    +           then .strongAchilles |= ensure($a)
    +           | .count += 1
    +           end
    +           | .n += 1 )
    +     | (.strongAchilles | table(10;5) ),
    +     "\nNumber of Achilles numbers with:",
    +     ( range(2; 1+$maxDigits) as $d
    +       | ($perfectPowers|getAchilles($d-1; $d)|length) as $ac
    +       | "\($d) digits: \($ac)" ) )
    +;
    +
    +task(10)
    diff --git a/Task/Achilles-numbers/Julia/achilles-numbers.julia b/Task/Achilles-numbers/Julia/achilles-numbers.jl
    similarity index 100%
    rename from Task/Achilles-numbers/Julia/achilles-numbers.julia
    rename to Task/Achilles-numbers/Julia/achilles-numbers.jl
    diff --git a/Task/Achilles-numbers/PARI-GP/achilles-numbers.parigp b/Task/Achilles-numbers/PARI-GP/achilles-numbers.parigp
    new file mode 100644
    index 0000000000..44391a9b19
    --- /dev/null
    +++ b/Task/Achilles-numbers/PARI-GP/achilles-numbers.parigp
    @@ -0,0 +1,8 @@
    +is(n,f=factor(n))=gcd(f[,2])==1 && vecmin(f[,2])>1
    +first(n)=my(v=List()); forfactored(k=1,10^9, if(is(k[1],k[2]), listput(v,k[1]); if(#v==n, return(Vec(v)))))
    +firstStrong(n)=my(v=List()); forfactored(k=1,10^9, if(is(k[1],k[2]) && is(eulerphi(k)), listput(v,k[1]); if(#v==n, return(Vec(v)))))
    +countBetween(a,b)=my(s); forfactored(k=a,b, if(is(k[1],k[2]), s++)); s
    +countDigits(n)=countBetween(10^(n-1),10^n-1)
    +first(50)
    +firstStrong(20)
    +apply(countDigits, [2..5])
    diff --git a/Task/Achilles-numbers/Perl/achilles-numbers-1.pl b/Task/Achilles-numbers/Perl/achilles-numbers-1.pl
    index 72b6c31ce7..319880a2b5 100644
    --- a/Task/Achilles-numbers/Perl/achilles-numbers-1.pl
    +++ b/Task/Achilles-numbers/Perl/achilles-numbers-1.pl
    @@ -2,11 +2,11 @@ use strict;
     use warnings;
     use feature ;
     use experimental 'signatures';
    -use List::AllUtils ;
    -use ntheory ;
    -use Math::AnyNum <:overload idiv iroot ipow is_coprime>;
    +use List::AllUtils ;
    +use ntheory ;
    +use Math::AnyNum <:overload idiv is_power iroot ipow is_coprime>;
     
    -sub table { my $t = shift() * (my $c = 1 + length max @_); ( sprintf( ('%'.$c.'d')x@_, @_) ) =~ s/.{1,$t}\K/\n/gr }
    +sub table { my $t = shift() * (my $c = 1 + length max @_); (sprintf(('%' . $c . 'd') x @_, @_)) =~ s/.{1,$t}\K/\n/gr }
     
     sub powerful_numbers ($n, $k = 2) {
         my @powerful;
    @@ -16,19 +16,21 @@ sub powerful_numbers ($n, $k = 2) {
                 if ($r > $k) { next unless is_square_free($v) and is_coprime($m, $v) }
                 __SUB__->($m * ipow($v, $r), $r - 1);
             }
    -    }->(1, 2*$k - 1);
    +    }->(1, 2 * $k - 1);
         sort { $a <=> $b } @powerful;
     }
     
    -my(@P, @achilles, %Ahash, @strong);
    -@P = uniqint @P, powerful_numbers(10**9, $_) for 2..9; shift @P;
    +my (@achilles, %Ahash, @strong);
    +my @P = powerful_numbers(10**9, 2);
     !is_power($_) and push @achilles, $_ and $Ahash{$_}++ for @P;
     $Ahash{euler_phi $_} and push @strong, $_ for @achilles;
     
    -say "First 50 Achilles numbers:\n"        . table 10, head 50, @achilles;
    +say "First 50 Achilles numbers:\n" . table 10,        head 50, @achilles;
     say "First 30 strong Achilles numbers:\n" . table 10, head 30, @strong;
     say "Number of Achilles numbers with:\n";
    -for my $l (2..9) {
    -    my $c; $l == length and $c++ for @achilles;
    +
    +for my $l (2 .. 9) {
    +    my $c;
    +    $l == length and $c++ for @achilles;
         say "$l digits: $c";
     }
    diff --git a/Task/Achilles-numbers/Phix/achilles-numbers.phix b/Task/Achilles-numbers/Phix/achilles-numbers.phix
    index 933e7e375a..3ebdef5c6e 100644
    --- a/Task/Achilles-numbers/Phix/achilles-numbers.phix
    +++ b/Task/Achilles-numbers/Phix/achilles-numbers.phix
    @@ -1,62 +1,67 @@
    -(phixonline)-->
    - with javascript_semantics
    - requires("1.0.2") -- [join_by(fmt)]
    - atom t0 = time()
    - constant maxDigits = iff(platform()=JS?10:12)
    - integer pps = new_dict()
    +with javascript_semantics
    +requires("1.0.2") -- [join_by(fmt)]
    +atom t0 = time()
    +constant maxDigits = iff(platform()=JS?10:12)
    +integer pps = new_dict()
     
    - procedure getPerfectPowers(integer maxExp)
    -     atom hi = power(10, maxExp)
    -     integer imax = floor(sqrt(hi))
    -     for i=2 to imax do
    -         atom p = i
    -         while true do
    -             p *= i
    -             if p>=hi then exit end if
    -             setd(p,true,pps)
    -         end while
    -     end for
    - end procedure
    +procedure getPerfectPowers(integer maxExp)
    +    atom hi = power(10, maxExp), t1 = time()+1
    +    integer imax = floor(sqrt(hi))
    +    for i=2 to imax do
    +        atom p = i
    +        while true do
    +            p *= i
    +            if p>=hi then exit end if
    +            setd(p,true,pps)
    +        end while
    +        if time()>t1 then
    +            progress("getting perfect powers, %d/%d\r",{i,imax})
    +            t1 = time()+1
    +        end if
    +    end for
    +    progress("")
    +end procedure
     
    - function get_achilles(integer minExp, maxExp)
    -     atom lo10 = power(10,minExp),
    -          hi10 = power(10,maxExp)
    -     integer bmax = floor(power(hi10,1/3)),
    -             amax = floor(sqrt(hi10))
    -     sequence achilles = {}
    -     for b=2 to bmax do
    -         atom b3 = b * b * b
    -         for a=2 to amax do
    -             atom p = b3 * a * a
    -             if p>=hi10 then exit end if
    -             if p>=lo10 then
    -                 integer node = getd_index(p,pps)
    -                 if node=NULL then
    -                     achilles &= p
    -                 end if
    -             end if
    -         end for
    -     end for
    -     achilles = unique(achilles)
    -     return achilles
    - end function
    +function get_achilles(integer minExp, maxExp)
    +    atom lo10 = power(10,minExp),
    +         hi10 = power(10,maxExp)
    +    integer bmax = floor(power(hi10,1/3)),
    +            amax = floor(sqrt(hi10))
    +    sequence achilles = {}
    +    for b=2 to bmax do
    +        atom b3 = b * b * b
    +        for a=2 to amax do
    +            atom p = b3 * a * a
    +            if p>=hi10 then exit end if
    +            if p>=lo10 then
    +                integer node = getd_index(p,pps)
    +                if node=NULL then
    +                    achilles &= p
    +                end if
    +            end if
    +        end for
    +    end for
    +    achilles = unique(achilles)
    +    return achilles
    +end function
     
    - getPerfectPowers(maxDigits)
    - sequence achilles = get_achilles(1,5)
    +getPerfectPowers(maxDigits)
     
    - function strong_achilles(integer n)
    -     integer totient = sum(sq_eq(apply(true,gcd,{tagset(n),n}),1))
    -     return find(totient,achilles)
    - end function
    +sequence achilles = get_achilles(1,5),
    +         a = join_by(achilles[1..50],1,10," ",fmt:="%4d")
    +printf(1,"First 50 Achilles numbers:\n%s\n",{a})
     
    - sequence a = join_by(achilles[1..50],1,10," ",fmt:="%4d"),
    -          sa = filter(achilles,strong_achilles)[1..30],
    -          ssa = join_by(sa,1,10," ",fmt:="%5d")
    +function strong_achilles(integer n)
    +    integer totient = sum(sq_eq(apply(true,gcd,{tagset(n),n}),1))
    +    return find(totient,achilles)
    +end function
     
    - printf(1,"First 50 Achilles numbers:\n%s\n",{a})
    - printf(1,"First 30 strong Achilles numbers:\n%s\n",{ssa})
    - for d=2 to maxDigits do
    -     printf(1,"Achilles numbers with %d digits:%d\n",{d,length(get_achilles(d-1,d))})
    - end for
    - ?elapsed(time()-t0)
    -
    +(phixonline)--(notpygments)-->
      function ack(integer m, integer n)
          if m=0 then
              return n+1
    diff --git a/Task/Ackermann-function/Phix/ackermann-function-2.phix b/Task/Ackermann-function/Phix/ackermann-function-2.phix
    index 6080743529..3c54091afd 100644
    --- a/Task/Ackermann-function/Phix/ackermann-function-2.phix
    +++ b/Task/Ackermann-function/Phix/ackermann-function-2.phix
    @@ -1,4 +1,4 @@
    -(phixonline)-->
    +(phixonline)--(notpygments)-->
      -- demo\rosetta\Ackermann.exw
      include mpfr.e
     
    diff --git a/Task/Ackermann-function/Pluto/ackermann-function.pluto b/Task/Ackermann-function/Pluto/ackermann-function.pluto
    new file mode 100644
    index 0000000000..91075937c7
    --- /dev/null
    +++ b/Task/Ackermann-function/Pluto/ackermann-function.pluto
    @@ -0,0 +1,13 @@
    +function ack(m,n)
    +  if m==0 then
    +    return n+1
    +  elseif n == 0 then
    +    return ack(m-1,1)
    +  else return ack(m-1,ack(m,n-1)) end
    +end
    +
    +for i = 0,3 do
    +   for j = 0,8 do
    +      print($"A({i},{j})={ack(i,j)}")
    +   end
    +end
    diff --git a/Task/Ackermann-function/PowerShell/ackermann-function-1.psh b/Task/Ackermann-function/PowerShell/ackermann-function-1.ps1
    similarity index 100%
    rename from Task/Ackermann-function/PowerShell/ackermann-function-1.psh
    rename to Task/Ackermann-function/PowerShell/ackermann-function-1.ps1
    diff --git a/Task/Ackermann-function/PowerShell/ackermann-function-2.psh b/Task/Ackermann-function/PowerShell/ackermann-function-2.ps1
    similarity index 100%
    rename from Task/Ackermann-function/PowerShell/ackermann-function-2.psh
    rename to Task/Ackermann-function/PowerShell/ackermann-function-2.ps1
    diff --git a/Task/Ackermann-function/PowerShell/ackermann-function-3.psh b/Task/Ackermann-function/PowerShell/ackermann-function-3.ps1
    similarity index 100%
    rename from Task/Ackermann-function/PowerShell/ackermann-function-3.psh
    rename to Task/Ackermann-function/PowerShell/ackermann-function-3.ps1
    diff --git a/Task/Ackermann-function/PowerShell/ackermann-function-4.psh b/Task/Ackermann-function/PowerShell/ackermann-function-4.ps1
    similarity index 100%
    rename from Task/Ackermann-function/PowerShell/ackermann-function-4.psh
    rename to Task/Ackermann-function/PowerShell/ackermann-function-4.ps1
    diff --git a/Task/Ackermann-function/Python/ackermann-function-2.py b/Task/Ackermann-function/Python/ackermann-function-2.py
    index a2968422e0..b52f4e5e1e 100644
    --- a/Task/Ackermann-function/Python/ackermann-function-2.py
    +++ b/Task/Ackermann-function/Python/ackermann-function-2.py
    @@ -1,6 +1,6 @@
    -from functools import lru_cache
    +from functools import cache
     
    -@lru_cache(None)
    +@cache
     def ack2(M, N):
         if M == 0:
             return N + 1
    diff --git a/Task/Ackermann-function/REXX/ackermann-function-1.rexx b/Task/Ackermann-function/REXX/ackermann-function-1.rexx
    deleted file mode 100644
    index 4166968a81..0000000000
    --- a/Task/Ackermann-function/REXX/ackermann-function-1.rexx
    +++ /dev/null
    @@ -1,25 +0,0 @@
    -/*REXX program  calculates and displays  some values for the  Ackermann function.       */
    -            /*╔════════════════════════════════════════════════════════════════════════╗
    -              ║  Note:  the Ackermann function  (as implemented here)  utilizes deep   ║
    -              ║         recursive and is limited by the largest number that can have   ║
    -              ║         "1"  (unity) added to a number  (successfully and accurately). ║
    -              ╚════════════════════════════════════════════════════════════════════════╝*/
    -high=24
    -         do     j=0  to 3;                    say
    -             do k=0  to high % (max(1, j))
    -             call tell_Ack  j, k
    -             end   /*k*/
    -         end       /*j*/
    -exit                                             /*stick a fork in it,  we're all done. */
    -/*──────────────────────────────────────────────────────────────────────────────────────*/
    -tell_Ack:  parse arg mm,nn;   calls=0            /*display an echo message to terminal. */
    -           #=right(nn,length(high))
    -           say 'Ackermann('mm", "#')='right(ackermann(mm, nn), high),
    -                                      left('', 12)     'calls='right(calls, high)
    -           return
    -/*──────────────────────────────────────────────────────────────────────────────────────*/
    -ackermann: procedure expose calls                /*compute value of Ackermann 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/REXX/ackermann-function-2.rexx b/Task/Ackermann-function/REXX/ackermann-function-2.rexx
    deleted file mode 100644
    index d489d6c82a..0000000000
    --- a/Task/Ackermann-function/REXX/ackermann-function-2.rexx
    +++ /dev/null
    @@ -1,21 +0,0 @@
    -/*REXX program  calculates and displays  some values for the  Ackermann function.       */
    -high=24
    -         do     j=0  to 3;                    say
    -             do k=0  to high % (max(1, j))
    -             call tell_Ack  j, k
    -             end   /*k*/
    -         end       /*j*/
    -exit                                             /*stick a fork in it,  we're all done. */
    -/*──────────────────────────────────────────────────────────────────────────────────────*/
    -tell_Ack:  parse arg mm,nn;   calls=0            /*display an echo message to terminal. */
    -           #=right(nn,length(high))
    -           say 'Ackermann('mm", "#')='right(ackermann(mm, nn), high),
    -                                      left('', 12)     'calls='right(calls, high)
    -           return
    -/*──────────────────────────────────────────────────────────────────────────────────────*/
    -ackermann: procedure expose calls                /*compute value of Ackermann 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 + 3 + n
    -                         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
    deleted file mode 100644
    index 46a20892d0..0000000000
    --- a/Task/Ackermann-function/REXX/ackermann-function-3.rexx
    +++ /dev/null
    @@ -1,36 +0,0 @@
    -/*REXX program  calculates and displays  some values for the  Ackermann function.       */
    -numeric digits 100                               /*use up to 100 decimal digit integers.*/
    -                       /*╔═════════════════════════════════════════════════════════════╗
    -                         ║ When REXX raises a number to an integer power  (via the  ** ║
    -                         ║ operator,  the power can be positive, zero, or negative).   ║
    -                         ║ Ackermann(5,1)   is a bit impractical to calculate.         ║
    -                         ╚═════════════════════════════════════════════════════════════╝*/
    -high=24
    -         do     j=0  to 4;                   say
    -             do k=0  to high % (max(1, j))
    -             call tell_Ack  j, k
    -             if j==4 & k==2  then leave          /*there's no sense in going overboard. */
    -             end   /*k*/
    -         end       /*j*/
    -exit                                             /*stick a fork in it,  we're all done. */
    -/*──────────────────────────────────────────────────────────────────────────────────────*/
    -tell_Ack:  parse arg mm,nn;   calls=0            /*display an echo message to terminal. */
    -           #=right(nn,length(high))
    -           say 'Ackermann('mm", "#')='right(ackermann(mm, nn), high),
    -                                      left('', 12)     'calls='right(calls, high)
    -           return
    -/*──────────────────────────────────────────────────────────────────────────────────────*/
    -ackermann: procedure expose calls                /*compute value of Ackermann 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 + 3 + n
    -           if m==3  then return 2**(n+3) - 3
    -           if m==4  then do; #=2                 /* [↓]  Ugh!  ···  and still more ughs.*/
    -                                      do (n+3)-1 /*This is where the heavy lifting is.  */
    -                                      #=2**#
    -                                      end
    -                             return #-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..5ef80aa39d
    --- /dev/null
    +++ b/Task/Ackermann-function/REXX/ackermann-function.rexx
    @@ -0,0 +1,83 @@
    +-- 27 Oct 2025
    +include Setting
    +numeric digits 310000
    +
    +say 'ACKERMANN FUNCTION'
    +say version
    +say
    +call Ackermann1
    +call Ackermann2
    +exit
    +
    +Ackermann1:
    +procedure expose glob.
    +say 'Using recursion...'
    +do i=0 to 3
    +   do j=0 to 10
    +      say 'Ackermann('i','j')' '=' Acker1(i,j) Elaps('r')'s'
    +   end
    +end
    +say
    +return
    +
    +Acker1:
    +procedure
    +arg xx,yy
    +select
    +   when xx = 0 then
    +      return yy+1
    +   when yy = 0 then
    +      return Acker1(xx-1,1)
    +   otherwise
    +      return Acker1(xx-1,Acker1(xx,yy-1))
    +end
    +
    +Ackermann2:
    +procedure expose glob.
    +say 'Using closed formulas...'
    +do i=0 to 3
    +   do j=0 to 10
    +      say 'Ackermann('i','j')' '=' Acker2(i,j) Elaps('r')'s'
    +   end
    +end
    +say 'Ackermann(3,100) =' Acker2(3,100) Elaps('r')'s'
    +say 'Ackermann(3,1000) has' Length(Acker2(3,1000)) 'digits' Elaps('r')'s'
    +say 'Ackermann(3,10000) has' Length(Acker2(3,10000)) 'digits' Elaps('r')'s'
    +say 'Ackermann(3,100000) has' Length(Acker2(3,100000)) 'digits' Elaps('r')'s'
    +say 'Ackermann(3,1000000) has' Length(Acker2(3,1000000)) 'digits' Elaps('r')'s'
    +say 'Ackermann(4,0) =' Acker2(4,0) Elaps('r')'s'
    +say 'Ackermann(4,1) =' Acker2(4,1) Elaps('r')'s'
    +say 'Ackermann(4,2) has' Length(Acker2(4,2)) 'digits' Elaps('r')'s'
    +return
    +
    +Acker2:
    +procedure
    +arg xx,yy
    +select
    +   when xx=0 then
    +      rr=yy+1
    +   when xx=1 then
    +      rr=yy+2
    +   when xx=2 then
    +      rr=yy+yy+3
    +   when xx=3 then
    +      rr=2**(yy+3)-3
    +   when xx=4 then
    +      select
    +         when yy=0 then
    +            rr=2**(2**2)-3
    +         when yy=1 then
    +            rr=2**(2**(2**2))-3
    +         when yy=2 then
    +            rr=2**(2**(2**(2**2)))-3
    +         otherwise
    +            rr=0
    +      end
    +   otherwise
    +      rr=0
    +end
    +return rr
    +
    +include Abend
    +-- Elaps
    +include Timer
    diff --git a/Task/Ackermann-function/ReScript/ackermann-function.re b/Task/Ackermann-function/ReScript/ackermann-function.res
    similarity index 100%
    rename from Task/Ackermann-function/ReScript/ackermann-function.re
    rename to Task/Ackermann-function/ReScript/ackermann-function.res
    diff --git a/Task/Ackermann-function/Rebol/ackermann-function-1.rebol b/Task/Ackermann-function/Rebol/ackermann-function-1.rebol
    new file mode 100644
    index 0000000000..52928c349e
    --- /dev/null
    +++ b/Task/Ackermann-function/Rebol/ackermann-function-1.rebol
    @@ -0,0 +1,7 @@
    +ackermann: func [m n] [
    +    case [
    +        m = 0 [n + 1]
    +        n = 0 [ackermann m - 1 1]
    +        true [ackermann m - 1 ackermann m n - 1]
    +    ]
    +]
    diff --git a/Task/Ackermann-function/Rebol/ackermann-function-2.rebol b/Task/Ackermann-function/Rebol/ackermann-function-2.rebol
    new file mode 100644
    index 0000000000..c6e294cb60
    --- /dev/null
    +++ b/Task/Ackermann-function/Rebol/ackermann-function-2.rebol
    @@ -0,0 +1,16 @@
    +ackermann: func [
    +    m [integer!]
    +    n [integer!]
    +] [
    +    ;; Small-m closed forms
    +    case [
    +        m = 0 [n + 1]
    +        m = 1 [n + 2]
    +        m = 2 [(2 * n) + 3]
    +        m = 3 [
    +            ;; 2^(n+3) - 3
    +            (to integer! power 2 (n + 3)) - 3
    +        ]
    +        ;; m >= 4 causes stack overflow
    +    ]
    +]
    diff --git a/Task/Ackermann-function/Refal/ackermann-function.refal b/Task/Ackermann-function/Refal/ackermann-function.refal
    new file mode 100644
    index 0000000000..211834abf3
    --- /dev/null
    +++ b/Task/Ackermann-function/Refal/ackermann-function.refal
    @@ -0,0 +1,9 @@
    +$ENTRY Go {
    +    =  LDAP_SUCCESS Then
    +     Print "Error authenticating with LDAP server: "; ldap_err2string(result)
    +     Sleep
    +     End 1
    +End If
    +
    +' Here you can perform LDAP operations
    +'...
    +
    +' We close the connection when finished
    +ldap_unbind(ldap)
    diff --git a/Task/Active-Directory-Connect/Julia/active-directory-connect.julia b/Task/Active-Directory-Connect/Julia/active-directory-connect.jl
    similarity index 100%
    rename from Task/Active-Directory-Connect/Julia/active-directory-connect.julia
    rename to Task/Active-Directory-Connect/Julia/active-directory-connect.jl
    diff --git a/Task/Active-Directory-Connect/Kotlin/active-directory-connect.kotlin b/Task/Active-Directory-Connect/Kotlin/active-directory-connect.kts
    similarity index 100%
    rename from Task/Active-Directory-Connect/Kotlin/active-directory-connect.kotlin
    rename to Task/Active-Directory-Connect/Kotlin/active-directory-connect.kts
    diff --git a/Task/Active-Directory-Connect/Rust/active-directory-connect.rust b/Task/Active-Directory-Connect/Rust/active-directory-connect.rs
    similarity index 100%
    rename from Task/Active-Directory-Connect/Rust/active-directory-connect.rust
    rename to Task/Active-Directory-Connect/Rust/active-directory-connect.rs
    diff --git a/Task/Active-Directory-Connect/VBScript/active-directory-connect.vb b/Task/Active-Directory-Connect/VBScript/active-directory-connect.vbs
    similarity index 100%
    rename from Task/Active-Directory-Connect/VBScript/active-directory-connect.vb
    rename to Task/Active-Directory-Connect/VBScript/active-directory-connect.vbs
    diff --git a/Task/Active-Directory-Connect/Wren/active-directory-connect-1.wren b/Task/Active-Directory-Connect/Wren/active-directory-connect-1.wren
    index 7ca7ad643e..6e80bdceaf 100644
    --- a/Task/Active-Directory-Connect/Wren/active-directory-connect-1.wren
    +++ b/Task/Active-Directory-Connect/Wren/active-directory-connect-1.wren
    @@ -1,4 +1,4 @@
    -/* active_directory_connect.wren */
    +/* Active_Directory_Connect.wren */
     
     foreign class LDAP {
         construct init(host, port) {}
    diff --git a/Task/Active-Directory-Connect/Wren/active-directory-connect-2.wren b/Task/Active-Directory-Connect/Wren/active-directory-connect-2.wren
    index c4d5574e27..59bbbdf2c5 100644
    --- a/Task/Active-Directory-Connect/Wren/active-directory-connect-2.wren
    +++ b/Task/Active-Directory-Connect/Wren/active-directory-connect-2.wren
    @@ -100,7 +100,7 @@ int main(int argc, char **argv) {
         config.bindForeignMethodFn = &bindForeignMethod;
         WrenVM* vm = wrenNewVM(&config);
         const char* module = "main";
    -    const char* fileName = "active_directory_connect.wren";
    +    const char* fileName = "Active_Directory_Connect.wren";
         char *script = readFile(fileName);
         WrenInterpretResult result = wrenInterpret(vm, module, script);
         switch (result) {
    diff --git a/Task/Active-Directory-Search-for-a-user/Julia/active-directory-search-for-a-user.julia b/Task/Active-Directory-Search-for-a-user/Julia/active-directory-search-for-a-user.jl
    similarity index 100%
    rename from Task/Active-Directory-Search-for-a-user/Julia/active-directory-search-for-a-user.julia
    rename to Task/Active-Directory-Search-for-a-user/Julia/active-directory-search-for-a-user.jl
    diff --git a/Task/Active-Directory-Search-for-a-user/PowerShell/active-directory-search-for-a-user.psh b/Task/Active-Directory-Search-for-a-user/PowerShell/active-directory-search-for-a-user.ps1
    similarity index 100%
    rename from Task/Active-Directory-Search-for-a-user/PowerShell/active-directory-search-for-a-user.psh
    rename to Task/Active-Directory-Search-for-a-user/PowerShell/active-directory-search-for-a-user.ps1
    diff --git a/Task/Active-Directory-Search-for-a-user/VBScript/active-directory-search-for-a-user-1.vb b/Task/Active-Directory-Search-for-a-user/VBScript/active-directory-search-for-a-user-1.vbs
    similarity index 100%
    rename from Task/Active-Directory-Search-for-a-user/VBScript/active-directory-search-for-a-user-1.vb
    rename to Task/Active-Directory-Search-for-a-user/VBScript/active-directory-search-for-a-user-1.vbs
    diff --git a/Task/Active-Directory-Search-for-a-user/VBScript/active-directory-search-for-a-user-2.vb b/Task/Active-Directory-Search-for-a-user/VBScript/active-directory-search-for-a-user-2.vbs
    similarity index 100%
    rename from Task/Active-Directory-Search-for-a-user/VBScript/active-directory-search-for-a-user-2.vb
    rename to Task/Active-Directory-Search-for-a-user/VBScript/active-directory-search-for-a-user-2.vbs
    diff --git a/Task/Active-Directory-Search-for-a-user/VBScript/active-directory-search-for-a-user-3.vb b/Task/Active-Directory-Search-for-a-user/VBScript/active-directory-search-for-a-user-3.vbs
    similarity index 100%
    rename from Task/Active-Directory-Search-for-a-user/VBScript/active-directory-search-for-a-user-3.vb
    rename to Task/Active-Directory-Search-for-a-user/VBScript/active-directory-search-for-a-user-3.vbs
    diff --git a/Task/Active-Directory-Search-for-a-user/Wren/active-directory-search-for-a-user-1.wren b/Task/Active-Directory-Search-for-a-user/Wren/active-directory-search-for-a-user-1.wren
    index 1ac0b1bb31..5ec080b24a 100644
    --- a/Task/Active-Directory-Search-for-a-user/Wren/active-directory-search-for-a-user-1.wren
    +++ b/Task/Active-Directory-Search-for-a-user/Wren/active-directory-search-for-a-user-1.wren
    @@ -1,4 +1,4 @@
    -/* active_directory_search_for_user.wren */
    +/* Active_Directory_Search_for_a_user.wren */
     
     var LDAP_SCOPE_SUBTREE = 0x0002
     
    diff --git a/Task/Active-Directory-Search-for-a-user/Wren/active-directory-search-for-a-user-2.wren b/Task/Active-Directory-Search-for-a-user/Wren/active-directory-search-for-a-user-2.wren
    index 71adbd6e80..15b374e36c 100644
    --- a/Task/Active-Directory-Search-for-a-user/Wren/active-directory-search-for-a-user-2.wren
    +++ b/Task/Active-Directory-Search-for-a-user/Wren/active-directory-search-for-a-user-2.wren
    @@ -125,7 +125,7 @@ int main(int argc, char **argv) {
         config.bindForeignMethodFn = &bindForeignMethod;
         WrenVM* vm = wrenNewVM(&config);
         const char* module = "main";
    -    const char* fileName = "active_directory_search_for_user.wren";
    +    const char* fileName = "Active_Directory_Search_for_a_user.wren";
         char *script = readFile(fileName);
         WrenInterpretResult result = wrenInterpret(vm, module, script);
         switch (result) {
    diff --git a/Task/Active-object/Ada/active-object.ada b/Task/Active-object/Ada/active-object.adb
    similarity index 100%
    rename from Task/Active-object/Ada/active-object.ada
    rename to Task/Active-object/Ada/active-object.adb
    diff --git a/Task/Active-object/Crystal/active-object.crystal b/Task/Active-object/Crystal/active-object.cr
    similarity index 100%
    rename from Task/Active-object/Crystal/active-object.crystal
    rename to Task/Active-object/Crystal/active-object.cr
    diff --git a/Task/Active-object/Delphi/active-object.delphi b/Task/Active-object/Delphi/active-object.pas
    similarity index 100%
    rename from Task/Active-object/Delphi/active-object.delphi
    rename to Task/Active-object/Delphi/active-object.pas
    diff --git a/Task/Active-object/Julia/active-object.julia b/Task/Active-object/Julia/active-object.jl
    similarity index 100%
    rename from Task/Active-object/Julia/active-object.julia
    rename to Task/Active-object/Julia/active-object.jl
    diff --git a/Task/Active-object/Kotlin/active-object.kotlin b/Task/Active-object/Kotlin/active-object.kts
    similarity index 100%
    rename from Task/Active-object/Kotlin/active-object.kotlin
    rename to Task/Active-object/Kotlin/active-object.kts
    diff --git a/Task/Active-object/Rust/active-object.rust b/Task/Active-object/Rust/active-object.rs
    similarity index 100%
    rename from Task/Active-object/Rust/active-object.rust
    rename to Task/Active-object/Rust/active-object.rs
    diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Ada/add-a-variable-to-a-class-instance-at-runtime.ada b/Task/Add-a-variable-to-a-class-instance-at-runtime/Ada/add-a-variable-to-a-class-instance-at-runtime.adb
    similarity index 100%
    rename from Task/Add-a-variable-to-a-class-instance-at-runtime/Ada/add-a-variable-to-a-class-instance-at-runtime.ada
    rename to Task/Add-a-variable-to-a-class-instance-at-runtime/Ada/add-a-variable-to-a-class-instance-at-runtime.adb
    diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Arturo/add-a-variable-to-a-class-instance-at-runtime.arturo b/Task/Add-a-variable-to-a-class-instance-at-runtime/Arturo/add-a-variable-to-a-class-instance-at-runtime.arturo
    index c668c74160..1709ab334f 100644
    --- a/Task/Add-a-variable-to-a-class-instance-at-runtime/Arturo/add-a-variable-to-a-class-instance-at-runtime.arturo
    +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/Arturo/add-a-variable-to-a-class-instance-at-runtime.arturo
    @@ -1,4 +1,4 @@
    -define :myClass [name,surname][]
    +define :myClass [name, surname]
     
     myInstance: to :myClass ["John" "Doe"]
     print myInstance
    diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Ballerina/add-a-variable-to-a-class-instance-at-runtime.ballerina b/Task/Add-a-variable-to-a-class-instance-at-runtime/Ballerina/add-a-variable-to-a-class-instance-at-runtime.ballerina
    new file mode 100644
    index 0000000000..a4d319d761
    --- /dev/null
    +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/Ballerina/add-a-variable-to-a-class-instance-at-runtime.ballerina
    @@ -0,0 +1,23 @@
    +import ballerina/io;
    +
    +// Person is an 'open' record type which allows fields of 'anydata' type
    +// to be added at runtime.
    +type Person record {
    +    string name;
    +    int age;
    +};
    +
    +public function main() {
    +    // Create an instance of Person with an additional 'town' field.
    +    Person p = {
    +        name: "Fred",
    +        age: 40,
    +        "town": "Boston"  // extra field name needs to be in quotes
    +    };
    +
    +    // Print name and age fields - using standard '.' syntax.
    +    io:print(p.name, " is ", p.age);
    +
    +    // Print the additional field - using a map-like syntax.
    +    io:println(" and lives in ", p["town"], ".");
    +}
    diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/C++/add-a-variable-to-a-class-instance-at-runtime.cpp b/Task/Add-a-variable-to-a-class-instance-at-runtime/C++/add-a-variable-to-a-class-instance-at-runtime.cpp
    new file mode 100644
    index 0000000000..1f83768ae0
    --- /dev/null
    +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/C++/add-a-variable-to-a-class-instance-at-runtime.cpp
    @@ -0,0 +1,34 @@
    +#include 
    +#include 
    +#include 
    +#include 
    +
    +class Demonstration {
    +public:
    +	Demonstration() {
    +		variables = { };
    +	}
    +
    +	std::map variables;
    +};
    +
    +int main() {
    +	Demonstration demo;
    +	std::cout << "Create two variables at runtime:" << std::endl;
    +	for ( uint32_t i = 1; i <= 2; ++i ) {
    +		std::cout << "    Variable number " << i << ":" << std::endl;
    +		std::cout << "        Enter name: " << std::endl;
    +		std::string name;
    +		std::cin >> name;
    +		std::cout << "        Enter value: " << std::endl;
    +		double value;
    +		std::cin >> value;
    +		demo.variables[name] = value;
    +	}
    +
    +	std::cout << std::endl;
    +	std::cout << "Two new runtime variables appear to have been created." << std::endl;
    +	for ( const auto &[key, value] : demo.variables ) {
    +		std::cout << "Variable " << key << " = " << value << std::endl;
    +	}
    +}
    diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Crystal/add-a-variable-to-a-class-instance-at-runtime.cr b/Task/Add-a-variable-to-a-class-instance-at-runtime/Crystal/add-a-variable-to-a-class-instance-at-runtime.cr
    new file mode 100644
    index 0000000000..9d091d3e04
    --- /dev/null
    +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/Crystal/add-a-variable-to-a-class-instance-at-runtime.cr
    @@ -0,0 +1,25 @@
    +class SuperDynamic
    +  @vars = {} of String => String | Int32
    +
    +  def set_vars (@vars)
    +  end
    +
    +  macro method_missing (call)
    +    {% name = call.name %}
    +    {% if name.ends_with? "=" %}
    +      {% name = name.gsub(/=$/, "") %}
    +      raise "unknown var" unless @vars.has_key? {{name.id.stringify}}
    +      @vars[{{name.id.stringify}}] = {{call.args[0].id}}
    +    {% else %}
    +      @vars[{{name.id.stringify}}]
    +    {% end %}
    +  end
    +end
    +
    +sd = SuperDynamic.new
    +
    +sd.set_vars({ "a" => 1, "b" => "2" })
    +
    +p! sd.a
    +sd.a = 99
    +p! sd.a
    diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Elena/add-a-variable-to-a-class-instance-at-runtime.elena b/Task/Add-a-variable-to-a-class-instance-at-runtime/Elena/add-a-variable-to-a-class-instance-at-runtime.elena
    index 9634046d11..07b19d327c 100644
    --- a/Task/Add-a-variable-to-a-class-instance-at-runtime/Elena/add-a-variable-to-a-class-instance-at-runtime.elena
    +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/Elena/add-a-variable-to-a-class-instance-at-runtime.elena
    @@ -10,7 +10,7 @@ class Extender : BaseExtender
        }
     }
     
    -public program()
    +public Program()
     {
        var object := 234;
     
    @@ -19,7 +19,7 @@ public program()
     
        object.foo := "bar";
     
    -   console.printLine(object,".foo=",object.foo);
    +   Console.printLine(object,".foo=",object.foo);
     
    -   console.readChar()
    +   Console.readChar()
     }
    diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Java/add-a-variable-to-a-class-instance-at-runtime.java b/Task/Add-a-variable-to-a-class-instance-at-runtime/Java/add-a-variable-to-a-class-instance-at-runtime.java
    new file mode 100644
    index 0000000000..c07f656ff0
    --- /dev/null
    +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/Java/add-a-variable-to-a-class-instance-at-runtime.java
    @@ -0,0 +1,34 @@
    +import java.util.HashMap;
    +import java.util.Map;
    +import java.util.Scanner;
    +
    +public final class AddVariableToClassInstanceAtRuntime {
    +
    +	public static void main(String[] args) {
    +		Demonstration demo = new Demonstration();
    +	    System.out.println("Create two variables at runtime: ");
    +	    Scanner scanner = new Scanner(System.in);
    +	    for ( int i = 1; i <= 2; i++ ) {	    	
    +	        System.out.println("    Variable number " + i + ":");
    +	        System.out.print("        Enter name: ");
    +	        String name = scanner.nextLine();
    +	        System.out.print("        Enter value: ");
    +	        String value = scanner.nextLine();
    +	        demo.runtimeVariables.put(name, value);
    +	        System.out.println();
    +	    }
    +	    scanner.close();
    +	
    +	    System.out.println("Two new runtime variables appear to have been created.");
    +	    for ( Map.Entry entry : demo.runtimeVariables.entrySet() ) {
    +	    	System.out.println("Variable " + entry.getKey() + " = " + entry.getValue());
    +	    }	
    +	}
    +
    +}
    +
    +final class Demonstration {
    +	
    +	Map runtimeVariables = new HashMap();
    +	
    +}
    diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Julia/add-a-variable-to-a-class-instance-at-runtime-1.julia b/Task/Add-a-variable-to-a-class-instance-at-runtime/Julia/add-a-variable-to-a-class-instance-at-runtime-1.jl
    similarity index 100%
    rename from Task/Add-a-variable-to-a-class-instance-at-runtime/Julia/add-a-variable-to-a-class-instance-at-runtime-1.julia
    rename to Task/Add-a-variable-to-a-class-instance-at-runtime/Julia/add-a-variable-to-a-class-instance-at-runtime-1.jl
    diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Julia/add-a-variable-to-a-class-instance-at-runtime-2.julia b/Task/Add-a-variable-to-a-class-instance-at-runtime/Julia/add-a-variable-to-a-class-instance-at-runtime-2.jl
    similarity index 100%
    rename from Task/Add-a-variable-to-a-class-instance-at-runtime/Julia/add-a-variable-to-a-class-instance-at-runtime-2.julia
    rename to Task/Add-a-variable-to-a-class-instance-at-runtime/Julia/add-a-variable-to-a-class-instance-at-runtime-2.jl
    diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Kotlin/add-a-variable-to-a-class-instance-at-runtime.kotlin b/Task/Add-a-variable-to-a-class-instance-at-runtime/Kotlin/add-a-variable-to-a-class-instance-at-runtime.kts
    similarity index 100%
    rename from Task/Add-a-variable-to-a-class-instance-at-runtime/Kotlin/add-a-variable-to-a-class-instance-at-runtime.kotlin
    rename to Task/Add-a-variable-to-a-class-instance-at-runtime/Kotlin/add-a-variable-to-a-class-instance-at-runtime.kts
    diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/PascalABC.NET/add-a-variable-to-a-class-instance-at-runtime.pas b/Task/Add-a-variable-to-a-class-instance-at-runtime/PascalABC.NET/add-a-variable-to-a-class-instance-at-runtime.pas
    new file mode 100644
    index 0000000000..3a8fa42045
    --- /dev/null
    +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/PascalABC.NET/add-a-variable-to-a-class-instance-at-runtime.pas
    @@ -0,0 +1,19 @@
    +type
    +  MyClass = class
    +    private
    +      dict := new Dictionary;
    +    public
    +      procedure Add(name: string; value: object) := dict[name] := value;
    +      property Items[name: string]: object read dict[name]; default;
    +  end;
    +
    +begin
    +  var obj := new MyClass;
    +  obj.Add('Name','PascalABC.NET');
    +  obj.Add('Age',16);
    +  Println(obj['Name'],obj['Age']);
    +  var obj1 := new MyClass;
    +  obj1.Add('X',2.3);
    +  obj1.Add('Y',3.8);
    +  Println(obj1['X'],obj1['Y']);
    +end.
    diff --git a/Task/Add-a-variable-to-a-class-instance-at-runtime/Phix/add-a-variable-to-a-class-instance-at-runtime.phix b/Task/Add-a-variable-to-a-class-instance-at-runtime/Phix/add-a-variable-to-a-class-instance-at-runtime.phix
    index 4a5d383d43..7e559ea226 100644
    --- a/Task/Add-a-variable-to-a-class-instance-at-runtime/Phix/add-a-variable-to-a-class-instance-at-runtime.phix
    +++ b/Task/Add-a-variable-to-a-class-instance-at-runtime/Phix/add-a-variable-to-a-class-instance-at-runtime.phix
    @@ -1,10 +1,9 @@
    --->
    - class wobbly dynamic
    -     -- (pre-define a few fields/methods if you like)
    - end class
    - wobbly wobble = new()
    - ?wobble.jelly               -- 0
    - --?wobble["jelly"]          -- for dynamic names use []
    - wobble.jelly = "green"
    - ?wobble.jelly               -- "green"
    -
    - with javascript_semantics
    - function additive(string p) return is_prime(sum(sq_sub(p,'0'))) end function
    - sequence res = filter(apply(get_primes_le(500),sprint),additive)
    - printf(1,"%d additive primes found: %s\n",{length(res),join(shorten(res,"",6))})
    -
    - --
    - -- demo\rosetta\Pattern_matching.exw
    - -- =================================
    - --
    - -- 1). Lightly modified copy of demo\rosetta\VisualiseTree.exw
    +-- demo\rosetta\Pattern_matching.exw
    +--  Lightly modified copy of demo\rosetta\VisualiseTree.exw
    +with javascript_semantics
     
    - with javascript_semantics
    +-- To the theme tune of the Milk Tray Ad iyrt,
    +-- All because the Windows console hates utf8:
    +constant TL = '\#DA', -- aka '┌'
    +         VT = '\#B3', -- aka '│'
    +         BL = '\#C0', -- aka '└'
    +         HZ = '\#C4', -- aka '─'
    +         HS = "\#C4"  -- (string version of HZ)
     
    - -- To the theme tune of the Milk Tray Ad iyrt,
    - -- All because the Windows console hates utf8:
    - constant TL = '\#DA', -- aka '┌'
    -          VT = '\#B3', -- aka '│'
    -          BL = '\#C0', -- aka '└'
    -          HZ = '\#C4', -- aka '─'
    -          HS = "\#C4"  -- (string version of HZ)
    +function w1252_to_utf8(string s)
    +    if platform()!=WINDOWS then
    +        s = substitute_all(s,{ TL, VT, BL, HZ},
    +                             {"┌","│","└","─"})
    +    end if
    +    return s
    +end function
    +--
     
    - function w1252_to_utf8(string s)
    -     if platform()!=WINDOWS then
    -         s = substitute_all(s,{ TL, VT, BL, HZ},
    -                              {"┌","│","└","─"})
    -     end if
    -     return s
    - end function
    - --</hates utf8>
    +procedure visualise_tree(object tree, string root=HS)
    +    if atom(tree) then
    +        puts(1,"\n")
    +    else
    +        object {colour,left,v,right} = tree
    +        integer g = root[$]
    +        if sequence(left) then
    +            root[$] = iff(g=TL or g=HZ?' ':VT)
    +            visualise_tree(left,root&TL)
    +        end if
    +        root[$] = g
    +        printf(1,"%s%s%v\n",{w1252_to_utf8(root),colour,v})
    +        if sequence(right) then
    +            root[$] = iff(g=TL?VT:' ')
    +            visualise_tree(right,root&BL)
    +        end if
    +    end if
    +end procedure
    +--
     
    - procedure visualise_tree(object tree, string root=HS)
    -     if atom(tree) then
    -         puts(1,"<empty>\n")
    -     else
    -         object {colour,left,v,right} = tree
    -         integer g = root[$]
    -         if sequence(left) then
    -             root[$] = iff(g=TL or g=HZ?' ':VT)
    -             visualise_tree(left,root&TL)
    -         end if
    -         root[$] = g
    -         printf(1,"%s%s%v\n",{w1252_to_utf8(root),colour,v})
    -         if sequence(right) then
    -             root[$] = iff(g=TL?VT:' ')
    -             visualise_tree(right,root&BL)
    -         end if
    -     end if
    - end procedure
    - --</copy VisualiseTree>
    +-- 2). Imagine the following is in a file, say algebraic_data_types.e - not quite generic enough
    +--      for inclusion in builtins, but not exactly difficult to copy/maintain per-project either.
     
    - -- 2). Imagine the following is in a file, say algebraic_data_types.e - not quite generic enough
    - --      for inclusion in builtins, but not exactly difficult to copy/maintain per-project either.
    +function match_one(sequence key, object t)
    +    sequence res = {}
    +    if sequence(t)
    +    and length(key)==length(t) then
    +        for i=1 to length(key) do
    +            object ki = key[i], ti = t[i]
    +            if sequence(ki) and not string(ki) then
    +                sequence r2 = match_one(ki,ti)
    +                if r2={} then res = {} exit end if
    +                res &= r2
    +            else
    +                if ki=0 then
    +                    res = append(res,ti)
    +                else
    +                    if ki!=ti then res = {} exit end if
    +                end if
    +            end if
    +        end for
    +    end if
    +    return res
    +end function
     
    - function match_one(sequence key, object t)
    -     sequence res = {}
    -     if sequence(t)
    -     and length(key)==length(t) then
    -         for i=1 to length(key) do
    -             object ki = key[i], ti = t[i]
    -             if sequence(ki) and not string(ki) then
    -                 sequence r2 = match_one(ki,ti)
    -                 if r2={} then res = {} exit end if
    -                 res &= r2
    -             else
    -                 if ki=0 then
    -                     res = append(res,ti)
    -                 else
    -                     if ki!=ti then res = {} exit end if
    -                 end if
    -             end if
    -         end for
    -     end if
    -     return res
    - end function
    +/*global*/ function match_algebraic(sequence set, t)
    +    sequence s
    +    for i=1 to length(set) do
    +        s = match_one(set[i],t)
    +        if length(s) then exit end if
    +    end for
    +    return s
    +end function
    +--
     
    - /*global*/ function match_algebraic(sequence set, t)
    -     sequence s
    -     for i=1 to length(set) do
    -         s = match_one(set[i],t)
    -         if length(s) then exit end if
    -     end for
    -     return s
    - end function
    - --</algebraic_data_types.e>
    +-- 3). The actual task
     
    - -- 3). The actual task
    +constant B = "B", R = "R"
     
    - constant B = "B", R = "R"
    +function balance(sequence t)
    +    sequence s = match_algebraic({{B,{R,{R,0,0,0},0,0},0,0},
    +                                  {B,{R,0,0,{R,0,0,0}},0,0},
    +                                  {B,0,0,{R,{R,0,0,0},0,0}},
    +                                  {B,0,0,{R,0,0,{R,0,0,0}}}},t)
    +    if length(s) then
    +        object {a,x,b,y,c,z,d} = s
    +        t = {R,{B,a,x,b},y,{B,c,z,d}}
    +    end if
    +    return t
    +end function
     
    - function balance(sequence t)
    -     sequence s = match_algebraic({{B,{R,{R,0,0,0},0,0},0,0},
    -                                   {B,{R,0,0,{R,0,0,0}},0,0},
    -                                   {B,0,0,{R,{R,0,0,0},0,0}},
    -                                   {B,0,0,{R,0,0,{R,0,0,0}}}},t)
    -     if length(s) then
    -         object {a,x,b,y,c,z,d} = s
    -         t = {R,{B,a,x,b},y,{B,c,z,d}}
    -     end if
    -     return t
    - end function
    +function ins(object tree, object leaf)
    +    if tree=NULL then
    +        tree = {R,NULL,leaf,NULL}
    +    else
    +        object {c,l,k,r} = tree
    +        if leaf!=k then
    +            if leaffunction ins(object tree, object leaf)
    -     if tree=NULL then
    -         tree = {R,NULL,leaf,NULL}
    -     else
    -         object {c,l,k,r} = tree
    -         if leaf!=k then
    -             if leaf<k then l = ins(l,leaf)
    -                       else r = ins(r,leaf)
    -             end if
    -             tree = balance({c,l,k,r})
    -         end if
    -     end if
    -     return tree
    - end function
    +function tree_insert(object tree, object leaf)
    +    tree = ins(tree,leaf)
    +    tree[1] = B
    +    return tree
    +end function
     
    - function tree_insert(object tree, object leaf)
    -     tree = ins(tree,leaf)
    -     tree[1] = B
    -     return tree
    - end function
    +sequence stuff = shuffle(tagset(10))
    +object tree = NULL
    +for i=1 to length(stuff) do
    +    tree = tree_insert(tree,stuff[i])
    +end for
    +visualise_tree(tree)
     
    - sequence stuff = shuffle(tagset(10))
    - object tree = NULL
    - for i=1 to length(stuff) do
    -     tree = tree_insert(tree,stuff[i])
    - end for
    - visualise_tree(tree)
    -
    - ?"done"
    - {} = wait_key()
    - ' high ' (inclusive):'
    +Do n=low To high                            /* process specified range             */
    +  Call classify n                           /* call subroutine To classify number. */
    +  End
    +Say
    +Say 'First numbers for each classification:'
    +class.=0                                    /* [?]  ensure one number of each class*/
    +Do q=1 Until class.sociable\==0             /*the only one that has To be counted. */
    +  Call classify  -q                         /*minus (-) sign indicates don't tell. */
    +  _=translate(what)                         /*obtain the class and uppercase it.   */
    +  class._=class._+1                         /*bump counter For this class sequence.*/
    +  If class._==1 Then                        /*first number of this class           */
    +    Call out q,what,dd
    +  End
    +Say                                         /* [?]  process Until all classes found*/
    +Say 'Classifications for specific numbers:'
    +Do i=1 To words(LL)                         /* process a list of "special numbers" */
    +  Call classify word(LL,i)                  /*call subroutine To classify number.  */
    +  End
    +Exit                                        /*stick a fork in it,we're all done.   */
    +out:
    +  Parse arg number,class,dd
    +  dd.=''
    +  Do di=1 By 1 While length(dd)>50
    +    do dj=50 To 10 By -1
    +      If substr(dd,dj,1)=' ' Then Leave
    +      End
    +    dd.di=left(dd,dj)
    +    dd=substr(dd,dj+1)
    +    End
    +  dd.di=dd
    +  Say right(number,digs)':' center(class,digs) dd.1||conti(1)
    +  Do di=2 By 1 While dd.di>''
    +    Say copies(' ',33)dd.di||conti(di)
    +    End
    +  Return
    +conti:
    +Parse arg this
    +next=this+1
    +If dd.next>'' Then Return '...'
    +Else Return ''
    +/*---------------------------------------------------------------------------------*/
    +classify:
    +  Parse Arg a 1 aa
    +  a=abs(a)                                  /*obtain number that's to be classified*/
    +  If dsum.a\==. Then
    +    s=dsum.a                                /*Was this number been  summed  before?*/
    +  Else
    +    s=dsum(a)                               /*No,Then classify number the hard way */
    +  dsum.a=s                                  /*define sum of the  proper divisors.  */
    +  dd=s                                      /*define the start of integer sequence.*/
    +  what='terminating'                        /*assume this kind of classification.  */
    +  c.=0                                      /*clear all cyclic sequences (to zero).*/
    +  c.s=1                                     /*set the first cyclic sequence.       */
    +  If dd==a Then
    +    what='perfect'                          /*check For a  "perfect"  number.      */
    +  Else Do t=1 By 1 While s>0                /*loop Until sum isn't  0   or   > big.*/
    +    m=s                                     /*obtain the last number in sequence.  */
    +    If dsum.m==. Then                       /*Not defined?                         */
    +      s=dsum(m)                             /* compute sum pro of per divisors     */
    +    Else
    +      s=dsum.m                              /*use the previously found integer.    */
    +    If m==s Then
    +      If m>=0 Then Do
    +        what='aspiring'
    +        Leave
    +        End
    +     If word(dd,2)=a Then Do
    +       what='amicable'
    +       Leave
    +       End
    +     dd=dd s                                /*append a sum To the integer sequence.*/
    +     If s==a Then
    +       If t>3 Then Do
    +         what='sociable'
    +         Leave
    +         End
    +     If c.s Then
    +       If m>0 Then Do
    +         what='cyclic'
    +         Leave
    +         End
    +     c.s=1                                  /*assign another possible cyclic number*/
    +                                            /* [?]  Rosetta Code task's limit: >16 */
    +     If t>NTlimit Then Do
    +       what='non-terminating'
    +       Leave
    +       End
    +     If s>big Then Do
    +       what='NON-TERMINATING'
    +       Leave
    +       End
    +     End
    +   If aa>0 Then                             /*  display only if  AA  is positive   */
    +     Call out a,what,dd
    +   Return
    +/*---------------------------------------------------------------------------------*/
    +dsum: Procedure Expose dsum.                /* compute the sum of proper divisors  */
    +  Parse Arg x
    +  If x<2 Then
    +    Return 0
    +  odd=x//2
    +  s=1                                       /* use EVEN or ODD integers.           */
    +  Do j=2+odd by 1+odd While j*j2   is based on the Calabi-Yau
    +The Almkvist-Giullera formula for calculating \frac{1}{\pi^2} is based on the Calabi-Yau
     differential equations of order 4 and 5,   which were originally used to describe certain manifolds
     in string theory. 
     
     
     The formula is:
    -::::: 1/π2 = (25/3)  ∑0  ((6n)! / (n!6))(532n2 + 126n + 9) / 10002n+1
    +:\frac{1}{\pi^{2}}=32 \sum_{n=0}^{\infty}\frac{(6n)!}{3 \cdot n!^{6}}(532n^{2}+126n+9)\frac{1}{10^{6n+3}}
     
     
    -This formula can be used to calculate the constant   π-2,   and thus to calculate   π.
    +This formula can be used to calculate the constant \frac{1}{\pi^2},   and thus to calculate \pi.
     
     Note that, because the product of all terms but the power of 1000 can be calculated as an integer,
     the terms in the series can be separated into a large integer term:
     
    -:::::  (25) (6n)! (532n2 + 126n + 9) / (3(n!)6)        (***)
    +:\frac{32(6n)!}{3 \cdot n!^{6}}(532n^{2}+126n+9)
     
     multiplied by a negative integer power of 10:
     
    -:::::  10-(6n + 3) 
    +:10^{-(6n + 3)}
     
     
     ;Task:
     :* Print the integer portions (the starred formula, which is without the power of 1000 divisor) of the first 10 terms of the series.
    -:* Use the complete formula to calculate and print π to 70 decimal digits of precision.
    +:* Use the complete formula to calculate and print \pi to 70 decimal digits of precision.
     
     
     ;Reference:
    diff --git a/Task/Almkvist-Giullera-formula-for-pi/ALGOL-68/almkvist-giullera-formula-for-pi.alg b/Task/Almkvist-Giullera-formula-for-pi/ALGOL-68/almkvist-giullera-formula-for-pi.alg
    index a1efd0e16e..2e06dddbbc 100644
    --- a/Task/Almkvist-Giullera-formula-for-pi/ALGOL-68/almkvist-giullera-formula-for-pi.alg
    +++ b/Task/Almkvist-Giullera-formula-for-pi/ALGOL-68/almkvist-giullera-formula-for-pi.alg
    @@ -73,17 +73,17 @@ BEGIN
             print( ( whole( n, 0 ), " | ", whole( almkvist giullera( n ), -44 ), newline ) )
         OD;
         FLOAT    epsilon = FLOAT(10) ^ -70;
    -    FLOAT    prev   := 0, pi := 0;
    +    FLOAT    prev   := 0, pi approx := 0;
         RATIONAL sum    := zero // one;
         FOR n FROM 0
         WHILE
    -        RATIONAL term = almkvist giullera( n ) // ( ten ^ ( 6 * n + 3 ) );
    -        sum +:= term;
    -        pi   := long long sqrt( FLOAT(1) / sum );
    -        ABS ( pi - prev ) >= epsilon
    +        RATIONAL nth term = almkvist giullera( n ) // ( ten ^ ( 6 * n + 3 ) );
    +        sum             +:= nth term;
    +        pi approx        := long long sqrt( FLOAT(1) / sum );
    +        ABS ( pi approx - prev ) >= epsilon
         DO
    -        prev := pi
    +        prev := pi approx
         OD;
         print( ( newline, "Pi to 70 decimal places is:", newline ) );
    -    print( ( fixed( pi, -72, 70 ), newline ) )
    +    print( ( fixed( pi approx, -72, 70 ), newline ) )
     END
    diff --git a/Task/Almkvist-Giullera-formula-for-pi/Ada/almkvist-giullera-formula-for-pi.adb b/Task/Almkvist-Giullera-formula-for-pi/Ada/almkvist-giullera-formula-for-pi.adb
    new file mode 100644
    index 0000000000..400094aff2
    --- /dev/null
    +++ b/Task/Almkvist-Giullera-formula-for-pi/Ada/almkvist-giullera-formula-for-pi.adb
    @@ -0,0 +1,94 @@
    +-- Big_Reals is an Ada 2022 unit
    +with Ada.Numerics.Big_Numbers.Big_Reals;
    +with Ada.Text_IO;
    +
    +use Ada.Numerics.Big_Numbers.Big_Reals;
    +
    +procedure Almkvist_Giullera is
    +
    +   function "+" (B : Big_Real; A : Integer) return Big_Real is (B + To_Real (A));
    +   function "*" (A : Integer; B : Big_Real) return Big_Real is (To_Real (A) * B);
    +   B0 : constant Big_Real := To_Real (0);
    +   B1 : constant Big_Real := B0 + 1;
    +
    +   function Factorial (N : Big_Real) return Big_Real
    +   is
    +      I : Big_Real := N;
    +      F : Big_Real := B1;
    +   begin
    +      while I > B1 loop
    +         F := F * I;
    +         I := I - B1;
    +      end loop;
    +
    +      return F;
    +   end Factorial;
    +
    +   function F (N : Big_Real) return Big_Real renames Factorial;
    +   procedure Put_Line (S : String) renames Ada.Text_IO.Put_Line;
    +
    +   function Integer_Term (N : Big_Real) return Big_Real is
    +     (32 * F (6 * N) / (3 * F (N) ** 6) * (532 * N ** 2 + 126 * N + 9));
    +
    +   procedure Show_Integer_Terms (N : Positive) is
    +   begin
    +      for I in 0 .. N - 1 loop
    +         Put_Line ("Almkvist-Giullera integer term "
    +                   & I'Image & " is "
    +                   & To_String (Integer_Term (To_Real (I)), Aft => 0));
    +      end loop;
    +   end Show_Integer_Terms;
    +
    +   -- Use Newton's Method
    +   function Sqrt (N : Big_Real; Precision : Positive) return Big_Real is
    +      Diff : Big_Real := To_Real (10) ** (-Precision);
    +      Estimate : Big_Real := B0;
    +      Next : Big_Real := N;
    +   begin
    +      while abs (Next - Estimate) > Diff loop
    +         Estimate := Next;
    +         Next := Estimate - (Estimate ** 2 - N) / (2 * Estimate);
    +         -- Nasty hack to limit precision. Otherwise there is a storage error.
    +         Next := From_String (To_String (Next, Aft => Precision + 2));
    +      end loop;
    +
    +      return Estimate;
    +   end Sqrt;
    +
    +   function Estimate_Pi (N : Integer; Precision : Positive) return Big_Real is
    +      Sum : Big_Real := B0;
    +   begin
    +      for I in 0 .. N loop
    +         Sum := Sum + Integer_Term (To_Real (I)) / To_Real (10) ** (6 * I + 3);
    +         Sum := From_String (To_String (Sum, Aft => Precision + 2));
    +      end loop;
    +
    +      return B1 / Sqrt (Sum, Precision + 2);
    +   end Estimate_Pi;
    +
    +   function Compute_Pi (Precision : Positive) return Big_Real is
    +      Diff : constant Big_Real := To_Real (10) ** (-Precision);
    +      Pi_Estimate : Big_Real := B0;
    +      Next : Big_Real := B1;
    +      N : Integer := 1;
    +   begin
    +      while abs (Next - Pi_Estimate) > Diff loop
    +         N := N * 2;
    +         Pi_Estimate := Next;
    +         Next := Estimate_Pi (N, Precision);
    +      end loop;
    +
    +      return Pi_Estimate;
    +   end Compute_Pi;
    +
    +   procedure Show_Pi (Precision : Positive) is
    +      Pi : constant Big_Real := Compute_Pi (Precision);
    +   begin
    +      Put_Line ("Pi to " & Precision'Image & " places is "
    +                & To_String (Pi, Aft => Precision));
    +   end Show_Pi;
    +
    +begin
    +   Show_Integer_Terms (10);
    +   Show_Pi (70);
    +end almkvist_giullera;
    diff --git a/Task/Almkvist-Giullera-formula-for-pi/FreeBASIC/almkvist-giullera-formula-for-pi.basic b/Task/Almkvist-Giullera-formula-for-pi/FreeBASIC/almkvist-giullera-formula-for-pi.basic
    new file mode 100644
    index 0000000000..d326167e00
    --- /dev/null
    +++ b/Task/Almkvist-Giullera-formula-for-pi/FreeBASIC/almkvist-giullera-formula-for-pi.basic
    @@ -0,0 +1,77 @@
    +' version 10-10-2024
    +' compile with: fbc -s console
    +
    +#Include Once "gmp.bi"
    +#Include Once "crt/stdio.bi"
    +
    +#Define prec 70
    +
    +Dim As UInteger n, tmp
    +Dim As String buffer = Space(50)
    +Dim As ZString Ptr gmp_str : gmp_str = Allocate(prec * 100)
    +
    +Dim As Mpz_ptr t1, t2, t3, t4
    +t1  = Allocate(Len(__Mpz_struct)) : Mpz_init(t1)
    +t2  = Allocate(Len(__Mpz_struct)) : Mpz_init(t2)
    +t3  = Allocate(Len(__Mpz_struct)) : Mpz_init(t3)
    +
    +Dim As mpf_ptr f1, f2, sum, pi
    +f1  = Allocate(Len(__Mpf_struct)) : Mpf_init2(f1, prec * 10)
    +f2  = Allocate(Len(__Mpf_struct)) : Mpf_init2(f2, prec * 10)
    +sum = Allocate(Len(__Mpf_struct)) : Mpf_init2(sum, prec * 10)
    +pi  = Allocate(Len(__Mpf_struct)) : Mpf_init2(pi, prec * 10)
    +
    +For n = 0 To prec
    +
    +    mpz_fac_ui(t1, 6 * n)
    +
    +    mpz_ui_pow_ui(t2 , n, 2)
    +    mpz_mul_ui(t2, t2, 532)
    +    mpz_set_ui(t3, n)
    +    mpz_mul_ui(t3, t3, 126)
    +    mpz_add(t2, t2, t3)
    +    mpz_add_ui(t2, t2, 9)
    +
    +    mpz_fac_ui(t3, n)
    +    mpz_pow_ui(t3, t3, 6)
    +    mpz_mul_ui(t3, t3, 3)
    +
    +    mpz_mul(t1, t1, t2)
    +    mpz_mul_2exp(t1, t1, 5)
    +    mpz_divexact(t1, t1, t3)
    +
    +    Mpz_get_str(gmp_str, 10, t1)
    +    If n < 10 Then
    +        RSet buffer, *gmp_str
    +        Print n; buffer
    +    EndIf
    +
    +    tmp = 6 * n +3
    +    mpf_set_z(f1, t1)
    +    mpf_set_ui(f2, 10)
    +    mpf_pow_ui(f2, f2, tmp)
    +    mpf_div(f1, f1, f2)
    +    mpf_add(sum, sum, f1)
    +
    +    If tmp - Len(*gmp_Str) > prec Then
    +        Print
    +        Print "Pi with 70 decimal digits of precision"
    +        mpf_sqrt(f2, sum)
    +        mpf_ui_div(pi , 1 , f2)
    +        gmp_printf (!"pi = %.*Ff \n", 70, pi)
    +        fflush(stdout)
    +        Exit For
    +    EndIf
    +
    +Next
    +
    +mpz_clears(t1, t2, t3, NULL)
    +mpf_clears(f1, f2, sum, pi, NULL)
    +DeAllocate(gmp_str)
    +
    +
    +' empty keyboard buffer
    +While Inkey <> "" : Wend
    +Print : Print "hit any key to end program"
    +Sleep
    +End
    diff --git a/Task/Almkvist-Giullera-formula-for-pi/FutureBasic/almkvist-giullera-formula-for-pi.basic b/Task/Almkvist-Giullera-formula-for-pi/FutureBasic/almkvist-giullera-formula-for-pi.basic
    new file mode 100644
    index 0000000000..87aaa6d0a3
    --- /dev/null
    +++ b/Task/Almkvist-Giullera-formula-for-pi/FutureBasic/almkvist-giullera-formula-for-pi.basic
    @@ -0,0 +1,139 @@
    +//
    +//   FutureBasic 7.0.35 —  Almkvist–Giullera PI
    +//
    +//  September 2025, R.W.
    +
    +include "mpfr.incl"
    +
    +long PRECISION
    +long n
    +
    +// Almkvist–Giullera PI estimate via MPFR (256-bit).
    +//
    +// 1 / π² = 32 × Σ (from n = 0 to ∞) [ (6n)! / (3 × (n!)⁶) × ¬
    +//         (532n² + 126n + 9) × 1 / (10^(6n + 3)) ]
    +
    +void local fn AG_Pi256_Compute ( AgPI as mpfr_t )
    +  long tmp
    +  CFStringRef pLine
    +  Boolean iterating = _True
    +
    +  mpz_t t1, t2, t3
    +  mpfr_t f1, f2, sum, prev, diff, epsilon
    +
    +  // Init big integers
    +  mpz_init( t1 )
    +  mpz_init( t2 )
    +  mpz_init( t3 )
    +
    +  // Init MPFR floats at 256 bits
    +
    +  mpfr_init2(        f1, PRECISION )
    +  mpfr_init2(        f2, PRECISION )
    +  mpfr_init2(       sum, PRECISION )
    +  mpfr_init2(      prev, PRECISION )
    +  mpfr_init2(      diff, PRECISION )
    +  mpfr_init2(   epsilon, PRECISION )
    +
    +  // Looking at accuracy of 70 decimal digits
    +  // Set epsilon to = 10^-70
    +
    +  fn mpfr_set_ui( epsilon, 10, MPFR_RNDN)
    +  fn mpfr_pow_ui( epsilon, epsilon, 70, MPFR_RNDN )
    +  fn mpfr_ui_div( epsilon, 1, epsilon, MPFR_RNDN )
    +
    +  // sum = 0
    +  fn mpfr_set_ui( sum, 0, MPFR_RNDN )
    +
    +  // Sum_{n = 0..kTerms}
    +  // ( (6n)! * (532 n^2 + 126 n + 9) * 2^5 ) / ( 3 * (n!)^6 * 10^(6n+3) )
    +  //
    +  While iterating
    +    mpz_fac_ui( t1, 6 * n )    // t1 = (6n)!
    +    //                         // t2 = 532 n^2 + 126 n + 9
    +    mpz_ui_pow_ui( t2, n, 2 )  // t2 = n^2
    +    mpz_mul_ui( t2, t2, 532 )  // 532 n^2
    +    mpz_set_ui( t3, n )        // t3 = n
    +    mpz_mul_ui( t3, t3, 126 )  // 126 n
    +    mpz_add( t2, t2, t3 )      // 532 n^2 + 126 n
    +    mpz_add_ui( t2, t2, 9 )    // + 9
    +    //                         // t3 = 3 * (n!)^6
    +    mpz_fac_ui( t3, n )        // t3 = n!
    +    mpz_pow_ui( t3, t3, 6 )    // (n!)^6
    +    mpz_mul_ui( t3, t3, 3 )    // 3 * (n!)^6
    +    //                         // t1 = t1 * t2 * 2^5 / t3
    +    mpz_mul( t1, t1, t2 )      // t1 = t1 * t2
    +    mpz_mul_2exp( t1, t1, 5 )  // t1 = t1 * t1 ^5
    +    mpz_divexact( t1, t1, t3 ) // t1 = t1 / t3
    +
    +    // Print t1 if n less than 10
    +    // to fullfil Rosetta Task requirement
    +    if n < 10
    +      pLine = @""
    +      pLine = fn mpz_cf(10,t1)
    +      pLine = concat(str(n),@" | ",pLine)
    +      print @ pLine
    +      if n == 9
    +        print@
    +        print@ "Estimating PI.."
    +        print @
    +      end if
    +    end if
    +
    +    // f1 = t1 / 10^(6n+3)
    +    fn mpfr_set_z( f1, t1, MPFR_RNDN )
    +    tmp = 6 * n + 3
    +    fn mpfr_set_ui( f2, 10, MPFR_RNDN )
    +    fn mpfr_pow_ui( f2, f2, tmp, MPFR_RNDN )
    +    fn mpfr_div( f1, f1, f2, MPFR_RNDN )
    +    // sum += f1
    +    fn mpfr_add( sum, sum, f1, MPFR_RNDN )
    +    // find the difference between previous sum and current
    +    fn mpfr_sub( diff, sum, prev, MPFR_RNDN)
    +    //mpfr_set_ui(prev, 10, MPFR_RNDN )    //sum -> prev
    +    fn mpfr_set(prev, sum, MPFR_RNDN)
    +
    +    // if (sum - prev) < epsilon, then we're done
    +
    +    if (fn mpfr_cmpabs( diff, epsilon ) < 0 ) then iterating = _False
    +    fn mpfr_sqrt( f2, sum, MPFR_RNDN )
    +    fn mpfr_ui_div( AgPI, 1, f2, MPFR_RNDN ) // 1 / sqrt(sum)
    +    n++
    +  wend
    +
    +  // Final output
    +  print @fn mpfr_cf2(71, AgPi, MPFR_RNDN)
    +  print@
    +  print @"70 decimal digits accuracy achieved after ";n;" iterations."
    +
    +  // Cleanup
    +  mpfr_clear( epsilon )
    +  mpfr_clear( diff )
    +  mpfr_clear( prev )
    +  mpfr_clear( sum )
    +  mpfr_clear( f2 )
    +  mpfr_clear( f1 )
    +  mpz_clear( t3 )
    +  mpz_clear( t2 )
    +  mpz_clear( t1 )
    +
    +end fn
    +
    +//------------------ Main
    +window 1, @"Almkvist–Giullera PI"
    +print@
    +print " n |              Integer of Nth term"
    +printf fn StringByPaddingToLength( @"", 48, @"-", 0 )
    +
    +PRECISION = 256
    +mpfr_t AgPi
    +mpfr_init2( AgPI, PRECISION )
    +
    +fn AG_Pi256_Compute ( AgPI )
    +
    +mpfr_clear( AgPI )
    +
    +
    +HandleEvents
    +
    +//
    diff --git a/Task/Almkvist-Giullera-formula-for-pi/Julia/almkvist-giullera-formula-for-pi.julia b/Task/Almkvist-Giullera-formula-for-pi/Julia/almkvist-giullera-formula-for-pi.jl
    similarity index 100%
    rename from Task/Almkvist-Giullera-formula-for-pi/Julia/almkvist-giullera-formula-for-pi.julia
    rename to Task/Almkvist-Giullera-formula-for-pi/Julia/almkvist-giullera-formula-for-pi.jl
    diff --git a/Task/Almkvist-Giullera-formula-for-pi/Kotlin/almkvist-giullera-formula-for-pi.kts b/Task/Almkvist-Giullera-formula-for-pi/Kotlin/almkvist-giullera-formula-for-pi.kts
    new file mode 100644
    index 0000000000..c20175ec0e
    --- /dev/null
    +++ b/Task/Almkvist-Giullera-formula-for-pi/Kotlin/almkvist-giullera-formula-for-pi.kts
    @@ -0,0 +1,65 @@
    +import java.math.BigDecimal
    +import java.math.BigInteger
    +import java.math.MathContext
    +import java.math.RoundingMode
    +
    +object CodeKt{
    +
    +    @JvmStatic
    +    fun main(args: Array) {
    +        println("n                                   Integer part")
    +        println("================================================")
    +        for (n in 0..9) {
    +            println(String.format("%d%47s", n, almkvistGiullera(n).toString()))
    +        }
    +
    +        val decimalPlaces = 70
    +        val mathContext = MathContext(decimalPlaces + 1, RoundingMode.HALF_EVEN)
    +        val epsilon = BigDecimal.ONE.divide(BigDecimal.TEN.pow(decimalPlaces))
    +        var previous = BigDecimal.ONE
    +        var sum = BigDecimal.ZERO
    +        var pi = BigDecimal.ZERO
    +        var n = 0
    +
    +        while (pi.subtract(previous).abs().compareTo(epsilon) >= 0) {
    +            val nextTerm = BigDecimal(almkvistGiullera(n)).divide(BigDecimal.TEN.pow(6 * n + 3), mathContext)
    +            sum = sum.add(nextTerm)
    +            previous = pi
    +            n += 1
    +            pi = BigDecimal.ONE.divide(sum, mathContext).sqrt(mathContext)
    +        }
    +
    +        println("\npi to $decimalPlaces decimal places:")
    +        println(pi)
    +    }
    +
    +    private fun almkvistGiullera(aN: Int): BigInteger {
    +        val term1 = factorial(6 * aN) * BigInteger.valueOf(32)
    +        val term2 = BigInteger.valueOf(532L * aN * aN + 126 * aN + 9)
    +        val term3 = factorial(aN).pow(6) * BigInteger.valueOf(3)
    +        return term1 * term2 / term3
    +    }
    +
    +    private fun factorial(aNumber: Int): BigInteger {
    +        var result = BigInteger.ONE
    +        for (i in 2..aNumber) {
    +            result *= BigInteger.valueOf(i.toLong())
    +        }
    +        return result
    +    }
    +
    +    private fun BigDecimal.sqrt(context: MathContext): BigDecimal {
    +        var x = BigDecimal(Math.sqrt(this.toDouble()), context)
    +        if (this == BigDecimal.ZERO) return BigDecimal.ZERO
    +        val two = BigDecimal.valueOf(2)
    +        while (true) {
    +            val y = this.divide(x, context)
    +            x = x.add(y).divide(two, context)
    +            val nextY = this.divide(x, context)
    +            if (y == nextY || y == nextY.add(BigDecimal.ONE.divide(BigDecimal.TEN.pow(context.precision), context))) {
    +                break
    +            }
    +        }
    +        return x
    +    }
    +}
    diff --git a/Task/Almkvist-Giullera-formula-for-pi/PARI-GP/almkvist-giullera-formula-for-pi.parigp b/Task/Almkvist-Giullera-formula-for-pi/PARI-GP/almkvist-giullera-formula-for-pi.parigp
    new file mode 100644
    index 0000000000..9761b3ae9b
    --- /dev/null
    +++ b/Task/Almkvist-Giullera-formula-for-pi/PARI-GP/almkvist-giullera-formula-for-pi.parigp
    @@ -0,0 +1,2 @@
    +\p77
    +sqrt(375/4/suminf(n=0,(6*n)!*(532*n^2+126*n+9.)/(n!*10^n)^6))
    diff --git a/Task/Almkvist-Giullera-formula-for-pi/Phix/almkvist-giullera-formula-for-pi.phix b/Task/Almkvist-Giullera-formula-for-pi/Phix/almkvist-giullera-formula-for-pi.phix
    index 0cb0773019..42386d1df4 100644
    --- a/Task/Almkvist-Giullera-formula-for-pi/Phix/almkvist-giullera-formula-for-pi.phix
    +++ b/Task/Almkvist-Giullera-formula-for-pi/Phix/almkvist-giullera-formula-for-pi.phix
    @@ -1,53 +1,51 @@
    -(phixonline)-->
    - with javascript_semantics
    - requires("1.0.0")
    - include mpfr.e
    - mpfr_set_default_precision(-70)
    +with javascript_semantics
    +requires("1.0.0")
    +include mpfr.e
    +mpfr_set_default_precision(-70)
     
    - function almkvistGiullera(integer n, bool bPrint)
    -     mpz {t1,t2,ip} = mpz_inits(3)
    -     mpz_fac_ui(t1,6*n)
    -     mpz_mul_si(t1,t1,32)                -- t1:=2^5*(6n)!
    -     mpz_fac_ui(t2,n)
    -     mpz_pow_ui(t2,t2,6)
    -     mpz_mul_si(t2,t2,3)                 -- t2:=3*(n!)^6
    -     mpz_mul_si(ip,t1,532*n*n+126*n+9)   -- ip:=t1*(532n^2+126n+9)
    -     mpz_fdiv_q(ip,ip,t2)                -- ip:=ip/t2
    -     integer pw := 6*n+3
    -     mpz_ui_pow_ui(t1,10,pw)             -- t1 := 10^(6n+3)
    -     mpq tm = mpq_init_set_z(ip,t1)      -- tm := rat(ip/t1)
    -     if bPrint then
    -         string ips = mpz_get_str(ip),
    -                tms = mpfr_get_fixed(mpfr_init_set_q(tm),50)
    -         tms = trim_tail(tms,"0")
    -         printf(1,"%d  %44s  %3d  %s\n", {n, ips, -pw, tms})
    -     end if
    -     return tm
    - end function
    +function almkvistGiullera(integer n, bool bPrint)
    +    mpz {t1,t2,ip} = mpz_inits(3)
    +    mpz_fac_ui(t1,6*n)
    +    mpz_mul_si(t1,t1,32)                -- t1:=2^5*(6n)!
    +    mpz_fac_ui(t2,n)
    +    mpz_pow_ui(t2,t2,6)
    +    mpz_mul_si(t2,t2,3)                 -- t2:=3*(n!)^6
    +    mpz_mul_si(ip,t1,532*n*n+126*n+9)   -- ip:=t1*(532n^2+126n+9)
    +    mpz_fdiv_q(ip,ip,t2)                -- ip:=ip/t2
    +    integer pw := 6*n+3
    +    mpz_ui_pow_ui(t1,10,pw)             -- t1 := 10^(6n+3)
    +    mpq tm = mpq_init_set_z(ip,t1)      -- tm := rat(ip/t1)
    +    if bPrint then
    +        string ips = mpz_get_str(ip),
    +               tms = mpfr_get_fixed(mpfr_init_set_q(tm),50)
    +        tms = trim_tail(tms,"0")
    +        printf(1,"%d  %44s  %3d  %s\n", {n, ips, -pw, tms})
    +    end if
    +    return tm
    +end function
     
    - constant hdr = "N --------------- Integer portion -------------  Pow  ----------------- Nth term (50 dp) -----------------"
    - printf(1,"%s\n%s\n",{hdr,repeat('-',length(hdr))})
    - for n=0 to 9 do
    -     {} = almkvistGiullera(n, true)
    - end for
    +constant hdr = "N --------------- Integer portion -------------  Pow  ----------------- Nth term (50 dp) -----------------"
    +printf(1,"%s\n%s\n",{hdr,repeat('-',length(hdr))})
    +for n=0 to 9 do
    +    {} = almkvistGiullera(n, true)
    +end for
     
    - mpq {res,prev,z} = mpq_inits(3),
    -     prec = mpq_init_set_str(sprintf("1/1%s",repeat('0',70)))
    - integer n = 0
    - while true do
    -     mpq term := almkvistGiullera(n, false)
    -     mpq_add(res,res,term)
    -     mpq_sub(z,res,prev)
    -     mpq_abs(z,z)
    -     if mpq_cmp(z,prec) < 0 then exit end if
    -     mpq_set(prev,res)
    -     n += 1
    - end while
    - mpq_inv(res,res)
    - mpfr pi = mpfr_init_set_q(res)
    - mpfr_sqrt(pi,pi)
    - printf(1,"\nCalculation of pi took %d iterations using the Almkvist-Giullera formula.\n\n",n)
    - printf(1,"Pi to 70 d.p.: %s\n",mpfr_get_fixed(pi,70))
    - mpfr_const_pi(pi)
    - printf(1,"Pi (builtin) : %s\n",mpfr_get_fixed(pi,70))
    -
    - sequence res = columnize({tagset(5)}) -- ie {{1},{2},{3},{4},{5}}
    - integer n = 2, found = 0
    - while found<50 do
    -     integer l = length(prime_factors(n,true))
    -     if l<=5 and length(res[l])<=10 then
    -         res[l] &= n
    -         found += 1
    -     end if
    -     n += 1
    - end while
    - string fmt = "k = %d: "&join(repeat("%4d",10))&"\n"
    - for i=1 to 5 do
    -     printf(1,fmt,res[i])
    - end for
    -
    - function amb1(sequence sets, object res=0, integer idx=1)
    -     integer ch = 0,
    -             pass = 0
    -     if idx>length(sets) then
    -         pass = 1
    -     else
    -         if res=0 then
    -             res = repeat(0,length(sets))
    -         else
    -             res = deep_copy(res)
    -             ch = sets[idx-1][res[idx-1]][$]
    -         end if
    -         for k=1 to length(sets[idx]) do
    -             if ch=0 or sets[idx][k][1]=ch then
    -                 res[idx] = k
    -                 {pass,res} = amb1(sets,res,idx+1)
    -                 if pass then exit end if
    -             end if
    -         end for
    -     end if
    -     return {pass,res}
    - end function
    +with javascript_semantics
     
    - sequence sets = {{"the","that","a"},
    -                  {"frog","elephant","thing"},
    -                  {"walked","treaded","grows"},
    -                  {"slowly","quickly"}}
    - {integer pass, sequence res} = amb1(sets)
    - if pass then
    -     puts(1,"success: ")
    -     for i=1 to length(sets) do
    -         res[i] = sets[i][res[i]]
    -     end for
    -     ?res
    - else
    -     puts(1,"failure\n")
    - end if
    -
    - function amb(sequence sets, integer testrid, integer resrid=-1, object res=0, integer idx=1)
    -     integer flag = (res==0),
    -             pass = 0
    -     if idx>length(sets) then
    -         pass = 1
    -         if resrid!=-1 then
    -             resrid(sets,res)
    -         end if
    -     else
    -         if flag then
    -             res = repeat(0,length(sets))
    -         end if
    -         for k=1 to length(sets[idx]) do
    -             res[idx] = k
    -             if flag or testrid(sets,deep_copy(res),idx) then
    -                 {pass,res} = amb(sets,testrid,resrid,deep_copy(res),idx+1)
    -                 if pass and resrid=-1 then exit end if
    -             end if
    -         end for
    -     end if
    -     return {pass,res}
    - end function
    +with javascript_semantics
    +function amb(sequence sets, integer testrid, resrid=-1, idx=1, object res=0)
    +    bool flag = (res==0),
    +         pass = false
    +    if idx>length(sets) then
    +        pass = true
    +        if resrid!=-1 then
    +            resrid(sets,res)
    +        end if
    +    else
    +        if flag then
    +            res = repeat(0,length(sets))
    +        end if
    +        for k=1 to length(sets[idx]) do
    +            res[idx] = k
    +            if flag or testrid(sets,deep_copy(res),idx) then
    +                {pass,res} = amb(sets,testrid,resrid,idx+1,deep_copy(res))
    +                if pass and resrid=-1 then exit end if
    +            end if
    +        end for
    +    end if
    +    return {pass,res}
    +end function
     
    - function pairable(sequence sets, sequence res, integer idx)
    -     return sets[idx-1][res[idx-1]][$] = sets[idx][res[idx]][1]
    - end function
    +function pairable(sequence sets, res, integer idx)
    +    return sets[idx-1][res[idx-1]][$] = sets[idx][res[idx]][1]
    +end function
     
    - procedure AMB_Show(sequence sets, sequence res)
    -     res = deep_copy(res)
    -     for i=1 to length(sets) do
    -         res[i] = sets[i][res[i]]
    -     end for
    -     printf(1,"success: %v\n",{res})
    - end procedure
    +procedure AMB_Show(sequence sets, res)
    +    res = deep_copy(res)
    +    for i=1 to length(sets) do
    +        res[i] = sets[i][res[i]]
    +    end for
    +    printf(1,"success: %v\n",{res})
    +end procedure
     
    - function pythagorean(sequence /*sets*/, sequence res, integer idx)
    - -- (note that res[idx]==sets[idx][res[idx]] in all cases)
    -     integer {x,y,z} = res
    -     return idx<3 or (x*x+y*y=z*z)
    - end function
    +function pythagorean(sequence /*sets*/, sequence res, integer idx)
    +-- (note that res[idx]==sets[idx][res[idx]] in all cases)
    +    integer {x,y,z} = res
    +    return idx<3 or (x*x+y*y=z*z)
    +end function
     
    - procedure pythag_show(sequence /*sets*/, sequence res)
    -     printf(1,"success: %v\n",{res})
    - end procedure
    +procedure pythag_show(sequence /*sets*/, sequence res)
    +    printf(1,"success: %v\n",{res})
    +end procedure
     
    - -- see http://www.randomhacks.net/articles/2005/10/11/amb-operator
    - function not8(sequence sets, sequence res, integer idx)
    - -- (note that idx==2 in all cases)
    - -- (at the last moment, I flipped the test, after realising that
    - --  someone had completely misunderstood the original article...
    - --  return sets[1][res[1]]*sets[idx][res[idx]]!=8
    -     return sets[1][res[1]]*sets[idx][res[idx]]=8
    - end function
    +-- see http://www.randomhacks.net/articles/2005/10/11/amb-operator
    +function not8(sequence sets, sequence res, integer idx)
    +-- (note that idx==2 in all cases)
    +-- (at the last moment, I flipped the test, after realising that
    +--  someone had completely misunderstood the original article...
    +--  return sets[1][res[1]]*sets[idx][res[idx]]!=8
    +    return sets[1][res[1]]*sets[idx][res[idx]]=8
    +end function
     
    - procedure not8_show(sequence sets, sequence res)
    -     puts(1,"success: ")
    -     ?{sets[1][res[1]],sets[2][res[2]]}
    - end procedure
    +procedure not8_show(sequence sets, sequence res)
    +    puts(1,"success: ")
    +    ?{sets[1][res[1]],sets[2][res[2]]}
    +end procedure
     
    - sequence sets = {{"the","that","a"},
    -                  {"frog","elephant","thing"},
    -                  {"walked","treaded","grows"},
    -                  {"slowly","quickly"}}
    - sequence sets2 = repeat(tagset(11),3)
    - sequence sets3 = {{1, 2, 3}, {4, 5, 6}}
    - puts(1,"\nThe original:\n")
    - {} = amb(sets,pairable,AMB_Show)
    - puts(1,"\nSmall Pythagorean triples problem:\n")
    - {} = amb(sets2,pythagorean,pythag_show)
    - puts(1,"\nSome strange not 8 problem:\n") -- (now fixed)
    - {} = amb(sets3,not8,not8_show)
    -
    - with javascript_semantics
    - for m=1 to 20000 do
    -     integer n = sum(factors(m,-1))
    -     if m<n and m=sum(factors(n,-1)) then ?{m,n} end if
    - end for
    -( (len,words), ...)
        if(ws.len()>1){ // two or more anagrams
           r:=List(); n:=ws[0].len(); // length of these anagrams
           foreach idx,w in (ws.enumerate()){
    -	 foreach w2 in (ws[idx+1,*]){
    -	    if(Utils.zipWith('!=,w,w2).filter().len()==n)
    -	       r.write(T(w,w2));
    -	 }
    +     foreach w2 in (ws[idx+1,*]){
    +        if(Utils.zipWith('!=,w,w2).filter().len()==n)
    +           r.write(T(w,w2));
    +     }
           }
           if(r) return(r.insert(0,n));
        }
    diff --git a/Task/Anagrams-Deranged-anagrams/Zkl/anagrams-deranged-anagrams-2.zkl b/Task/Anagrams-Deranged-anagrams/Zkl/anagrams-deranged-anagrams-2.zkl
    index ce697554b4..bca11af0eb 100644
    --- a/Task/Anagrams-Deranged-anagrams/Zkl/anagrams-deranged-anagrams-2.zkl
    +++ b/Task/Anagrams-Deranged-anagrams/Zkl/anagrams-deranged-anagrams-2.zkl
    @@ -3,7 +3,7 @@ nws:=words.values.pump(List,fcn(ws){ //-->( (len,words), ...)
           n:=ws[0].len(); // length of these anagrams
           r:=Utils.Helpers.permute(ws).filter('wrap(ws2){
                 n == Utils.zipWith('!=,ws2.xplode()).filter().len();
    -	 });
    +     });
           if(r) return(n,r[0]); // L(L("glove","vogel"))-->L(5,L("glove","vogel"))
        }
        Void.Skip
    diff --git a/Task/Anagrams/00-TASK.txt b/Task/Anagrams/00-TASK.txt
    index 1668245967..c66b1c36f9 100644
    --- a/Task/Anagrams/00-TASK.txt
    +++ b/Task/Anagrams/00-TASK.txt
    @@ -1,7 +1,7 @@
     When two or more words are composed of the same characters, but in a different order, they are called [[wp:Anagram|anagrams]]. 
     
     ;Task
    -Using the word list at   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt, 
    +Using the word list at   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt or [https://raw.githubusercontent.com/thundergnat/rc-run/refs/heads/master/rc/resources/unixdict.txt here], 
     
    find the sets of words that share the same characters that contain the most words in them. ;Related tasks diff --git a/Task/Anagrams/ALGOL-68/anagrams.alg b/Task/Anagrams/ALGOL-68/anagrams.alg index 8fe12076cc..d652d3bd06 100644 --- a/Task/Anagrams/ALGOL-68/anagrams.alg +++ b/Task/Anagrams/ALGOL-68/anagrams.alg @@ -55,7 +55,6 @@ ELSE END ); REF AARRAY words := INIT LOC AARRAY; - STRING word; WHILE NOT at eof DO STRING word; diff --git a/Task/Anagrams/Ada/anagrams.ada b/Task/Anagrams/Ada/anagrams.adb similarity index 100% rename from Task/Anagrams/Ada/anagrams.ada rename to Task/Anagrams/Ada/anagrams.adb diff --git a/Task/Anagrams/Amazing-Hopper/anagrams.hopper b/Task/Anagrams/Amazing-Hopper/anagrams.hopper new file mode 100644 index 0000000000..bfdf1a5881 --- /dev/null +++ b/Task/Anagrams/Amazing-Hopper/anagrams.hopper @@ -0,0 +1,45 @@ +#include + +#define MAX_LINE 30 + +algoritmo + + fd=0, filas=0 + word={}, 2da columna={} + old_word="",new_word="" + dimensionar (1,2) matriz de cadenas 'result' + pos=0 + + token.separador'""' + + abrir para leer("basica/unixdict.txt",fd) + + iterar mientras ' no es fin de archivo (fd) ' + usando 'MAX_LINE', leer línea desde(fd), + ---copiar en 'old_word'---, separar para 'word ' + word, ---retener--- ordenar esto, + encadenar en 'new_word' + + matriz.buscar en tabla (1,new_word,result) + copiar en 'pos' + si ' es negativo? ' + new_word,old_word, pegar fila en 'result' + sino + #( result[pos,2] = cat(result[pos,2],cat(",",old_word) ) ) + fin si + + reiterar + + cerrar archivo(fd) + + guardar 'filas de (result)' en 'filas' + #( 2da columna = result[2:filas, 2] ) + fijar separador '","' + tomar '2da columna' + contar tokens en '2da columna' ---retener resultado, + obtener máximo valor,es mayor o igual?, replicar esto + compactar esto + + fijar separador 'NL', luego imprime todo + +terminar diff --git a/Task/Anagrams/Arturo/anagrams.arturo b/Task/Anagrams/Arturo/anagrams.arturo index 9d417293a0..c6c5181269 100644 --- a/Task/Anagrams/Arturo/anagrams.arturo +++ b/Task/Anagrams/Arturo/anagrams.arturo @@ -5,7 +5,7 @@ anagrams: #[] loop wordset 'word [ anagram: sort to [:char] word unless key? anagrams anagram -> - anagrams\[anagram]: new [] + anagrams\[anagram]: [] anagrams\[anagram]: anagrams\[anagram] ++ word ] diff --git a/Task/Anagrams/COBOL/anagrams.cobol b/Task/Anagrams/COBOL/anagrams.cob similarity index 100% rename from Task/Anagrams/COBOL/anagrams.cobol rename to Task/Anagrams/COBOL/anagrams.cob diff --git a/Task/Anagrams/Crystal/anagrams.crystal b/Task/Anagrams/Crystal/anagrams.cr similarity index 100% rename from Task/Anagrams/Crystal/anagrams.crystal rename to Task/Anagrams/Crystal/anagrams.cr diff --git a/Task/Anagrams/Delphi/anagrams.delphi b/Task/Anagrams/Delphi/anagrams.pas similarity index 100% rename from Task/Anagrams/Delphi/anagrams.delphi rename to Task/Anagrams/Delphi/anagrams.pas diff --git a/Task/Anagrams/DuckDB/anagrams.duckdb b/Task/Anagrams/DuckDB/anagrams.duckdb new file mode 100644 index 0000000000..aaa0f5aad8 --- /dev/null +++ b/Task/Anagrams/DuckDB/anagrams.duckdb @@ -0,0 +1,20 @@ +# The MAP giving the frequency counts of characters in the given string +create or replace function spectrum(str) as ( + select histogram(c) + from (select unnest(regexp_extract_all(str,'.')) as c) +); + +# Find the anagram groups having the most members. +# Each group is sorted, and the groups are sorted by first word in the group. +with words as (from read_csv('unixdict.txt', header=false) _(word)), + histograms as (select word, spectrum(word) as h from words), + groups as (select h, count(h) as c from histograms group by h order by c desc), + mx as (select max(c) as mx from groups), + maximals as (select h from groups, mx where c = mx.mx), + results as (select (select array_agg(word).list_sort() + from histograms + where histograms.h = maximals.h ) as anagrams + from maximals) + select anagrams + from results + order by anagrams[1] ; diff --git a/Task/Anagrams/EasyLang/anagrams.easy b/Task/Anagrams/EasyLang/anagrams.easy new file mode 100644 index 0000000000..2e5fcff599 --- /dev/null +++ b/Task/Anagrams/EasyLang/anagrams.easy @@ -0,0 +1,46 @@ +global name$[] cnt[] . +func n2id n$ . + for id to len name$[] : if name$[id] = n$ : return id + name$[] &= n$ + cnt[] &= 0 + return id +. +func norm s$ . + d$[] = strchars s$ + for i = 1 to len d$[] - 1 + for j = i + 1 to len d$[] + if strcode d$[j] < strcode d$[i] : swap d$[j] d$[i] + . + . + n$ = strjoin d$[] "" + return n2id n$ +. +repeat + s$ = input + until s$ = "" + id = norm s$ + cnt[id] += 1 + max = higher max cnt[id] + w$[] &= s$ + wid[] &= id +. +for id to len name$[] + if cnt[id] = max + for i to len w$[] + if wid[i] = id : write w$[i] & " " + . + print "" + . +. +# +# a few lines of unixdict.txt, also works with all +input_data +abe +abed +abel +ablaze +able +ablution +angel +angle +angles diff --git a/Task/Anagrams/Elena/anagrams.elena b/Task/Anagrams/Elena/anagrams.elena index 2c53d891af..be3a530398 100644 --- a/Task/Anagrams/Elena/anagrams.elena +++ b/Task/Anagrams/Elena/anagrams.elena @@ -5,6 +5,7 @@ import system'collections; import extensions; import extensions'routines; import extensions'text; +import algorithms; extension op { @@ -12,13 +13,13 @@ extension op = self.toArray().ascendant().summarize(new StringWriter()); } -public program() +public Program() { - var start := now; + var start := Now; auto dictionary := new Map(); - File.assign("unixdict.txt").forEachLine:(word) + File.assign("unixdict.txt").forEachLine::(word) { var key := word.normalized(); var item := dictionary[key]; @@ -28,19 +29,19 @@ public program() dictionary[key] := item }; - item.append:word + item.append(word) }; dictionary.Values - .sort:(former,later => former.Item2.Length > later.Item2.Length ) - .top:20 - .forEach:(pair){ console.printLine(pair.Item2) }; + .quickSort::(former,later => former.Item2.Length > later.Item2.Length ) + .top(20) + .forEach::(pair){ Console.printLine(pair.Item2) }; - var end := now; + var end := Now; var diff := end - start; - console.printLine("Time elapsed in msec:",diff.Milliseconds); + Console.printLine("Time elapsed in msec:",diff.Milliseconds); - console.readChar() + Console.readChar() } diff --git a/Task/Anagrams/Elixir/anagrams-1.elixir b/Task/Anagrams/Elixir/anagrams-1.ex similarity index 100% rename from Task/Anagrams/Elixir/anagrams-1.elixir rename to Task/Anagrams/Elixir/anagrams-1.ex diff --git a/Task/Anagrams/Elixir/anagrams-2.elixir b/Task/Anagrams/Elixir/anagrams-2.ex similarity index 100% rename from Task/Anagrams/Elixir/anagrams-2.elixir rename to Task/Anagrams/Elixir/anagrams-2.ex diff --git a/Task/Anagrams/Emacs-Lisp/anagrams-1.el b/Task/Anagrams/Emacs-Lisp/anagrams-1.el new file mode 100644 index 0000000000..9920fae43d --- /dev/null +++ b/Task/Anagrams/Emacs-Lisp/anagrams-1.el @@ -0,0 +1,87 @@ +(defun code-letters (str) + "Sort STR into alphabetized list of individual letters." + (sort (split-string str "" t) #'string<)) + +(defun code-letters-to-string (str) + "Sort STR alphabetically and combine into one string." + (apply #'concat (code-letters str))) + +(defun remove-periods (str) + "Remove periods (full stops) from STR." + (string-replace "." "" str)) + +(defun list-pair (str) + "Create paired list from STR, STR (unchanged) and alphabetized order of STR." + ;; Remove periods from alphabetized order to make regex matching easier + (let ((letter-list (remove-periods (code-letters-to-string str)))) + (list letter-list str))) + +(defun pair-up (words) + "Make list of lists of paired words, one alphabetized one original." + (let ((paired-list) + (temp-pair)) + (dolist (word words) + (setq temp-pair (list-pair word)) + (push temp-pair paired-list)) + paired-list)) + +(defun create-list-of-numbers (my-list) + "Create list of numbers from MY-LIST." + (let ((list-of-numbers)) + (dolist (one-pair my-list) + (push (car one-pair) list-of-numbers)) + list-of-numbers)) + +(defun get-largest-number (my-list) + "Find largest number in MY-LIST." + (let ((list-of-numbers)) + (setq list-of-numbers (create-list-of-numbers my-list)) + (apply #'max list-of-numbers))) + +(defun make-list-matching-words (coded-word-and-original number-and-code-pair) + "List original words whose code matches code in NUMBER-AND-CODE-PAIR." + (dolist (word-pair coded-word-and-original) + ;; test if coded word in CODED-WORD-AND-ORIGINAL matches + ;; coded word in NUMBER-AND-CODE-PAIR + (when (string= (nth 0 word-pair) (nth 1 number-and-code-pair)) + ;; insert the original word + (insert (format "%s " (nth 1 word-pair))))) + (insert "\n")) + +(defun count-anagrams () + "Count the number of anagrams in file wordlist.txt" + (let ((coded-word-and-original) + (just-coded-words) + (unique-coded-words) + (count-and-code) + (number-of-anagrams) + (largest-number)) + ;; Path below needs to be adapted to individual case + (find-file "~/Documents/Elisp/wordlist.txt") + (beginning-of-buffer) + ;; create list of lists of coded words and originals + (setq coded-word-and-original (pair-up (split-string (buffer-string) "\n"))) + (find-file "temp-all-coded") + (erase-buffer) + (dolist (number-and-code-pair coded-word-and-original) + ;; make list of just the coded words + (push (nth 0 number-and-code-pair) just-coded-words)) + (dolist (one-word just-coded-words) + ;; write list of coded words to buffer for later processing + (insert (format "%s\n" one-word))) + ;; create a list of coded words with no repetitions + (setq unique-coded-words (seq-uniq just-coded-words)) + (dolist (one-code unique-coded-words) + (find-file "temp-all-coded") + (beginning-of-buffer) + ;; count the number of times ONE-CODE appears in buffer + (setq number-of-anagrams (how-many (format "^%s$" one-code))) + (if (>= number-of-anagrams 1) ; eliminate "words" of zero length + (push (list number-of-anagrams one-code) count-and-code))) + (find-file "anagram-listing") + (erase-buffer) + (setq largest-number (get-largest-number count-and-code)) + (dolist (number-and-code-pair count-and-code) + ;; when the number in NUMBER-AND-CODE-PAIR = largest number of anagrams + (when (= (nth 0 number-and-code-pair) largest-number) + (make-list-matching-words coded-word-and-original number-and-code-pair))))) diff --git a/Task/Anagrams/Emacs-Lisp/anagrams-2.el b/Task/Anagrams/Emacs-Lisp/anagrams-2.el new file mode 100644 index 0000000000..4a6a2b9b3d --- /dev/null +++ b/Task/Anagrams/Emacs-Lisp/anagrams-2.el @@ -0,0 +1,74 @@ +(defun code-letters (str) + "Sort STR into alphabetized list of individual letters." + (sort (split-string str "" t) #'string<)) + +(defun code-letters-to-string (str) + "Sort STR alphabetically and combine into one string." + (apply #'concat (code-letters str))) + +(defun add-to-hash (key value table) + "If KEY exists, add VALUE to list of values. +If KEY does not exist, associate value with KEY." + (let ((current-values)) + (if (gethash key table) + (progn + (setq current-values (gethash key table)) + (setq current-values (push value current-values)) + (puthash key current-values table)) + (puthash key (list value) table)))) + +(defun create-list-of-numbers (hash-table) + "Create a list of numbers from HASH-TABLE." + (let ((current-number) + (list-of-numbers)) + (setq list-of-numbers (list)) ; omit? + (maphash (lambda (key value) + (setq current-number (car (gethash key hash-table))) + (push current-number list-of-numbers)) + hash-table) + list-of-numbers)) + +(defun find-largest-number-in-hash (hash-table) + "Find largest number in HASH-TABLE." + (let ((list-of-numbers)) + (setq list-of-numbers (create-list-of-numbers hash-table)) + (apply #'max list-of-numbers))) + +(defun find-longest-lists-of-anagrams (&optional file) + "Find the set(s) of largest number of anagrams in file wordlist.txt" + (let ((largest-number) + (hash-key) + (dictionary-table (make-hash-table :test 'equal))) + ;; Path and filename below needs to be adapted to individual case if + ;; FILE is *not* passed to this function + (with-temp-buffer + (insert-file-contents (or file "~/Documents/Elisp/wordlist.txt")) + (beginning-of-buffer) + ;; set up hash table with key and word(s) + ;; key = letters of word, but with letters in + ;; alphabetical order. Create list word(s) associated + ;; with key. + (dolist (current-word (split-string (buffer-string) "\n")) + (setq hash-key (code-letters-to-string current-word)) + (add-to-hash hash-key current-word dictionary-table)) + ;; Count number of anagram words + (maphash (lambda (key value) + "Add number of anagram words to VALUE." + (add-to-hash key (length (gethash key dictionary-table)) dictionary-table)) + dictionary-table) + ;; find the size of the largest list(s) of anagrams + (setq largest-number (find-largest-number-in-hash dictionary-table))) + ;; set up empty buffer to show results + (with-current-buffer (pop-to-buffer "anagram-listing") + (erase-buffer) + ;; show results + (maphash (lambda (key value) + "Display longest lists of anagrams." + (when (= largest-number (car (gethash key dictionary-table))) + (mapc + (lambda (element) + "Insert ELEMENT followed by one space in buffer." + (insert (format "%s " element))) + (cdr (gethash key dictionary-table))) + (insert "\n"))) + dictionary-table)))) diff --git a/Task/Anagrams/Euphoria/anagrams.euphoria b/Task/Anagrams/Euphoria/anagrams.eu similarity index 100% rename from Task/Anagrams/Euphoria/anagrams.euphoria rename to Task/Anagrams/Euphoria/anagrams.eu diff --git a/Task/Anagrams/Julia/anagrams.julia b/Task/Anagrams/Julia/anagrams.jl similarity index 100% rename from Task/Anagrams/Julia/anagrams.julia rename to Task/Anagrams/Julia/anagrams.jl diff --git a/Task/Anagrams/Kotlin/anagrams.kotlin b/Task/Anagrams/Kotlin/anagrams.kts similarity index 100% rename from Task/Anagrams/Kotlin/anagrams.kotlin rename to Task/Anagrams/Kotlin/anagrams.kts diff --git a/Task/Anagrams/MiniScript/anagrams.mini b/Task/Anagrams/MiniScript/anagrams.mini new file mode 100644 index 0000000000..299f30a856 --- /dev/null +++ b/Task/Anagrams/MiniScript/anagrams.mini @@ -0,0 +1,27 @@ +wordList = http.get("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt").split(char(10)) + +makeKey = function(word) + return word.split("").sort.join("") +end function + +wordSets = {} +for word in wordList + k = makeKey(word) + if not wordSets.hasIndex(k) then + wordSets[k] = [word] + else + wordSets[k].push(word) + end if +end for + +counts = [] + +for wordSet in wordSets.values + counts.push([wordSet.len, wordSet]) +end for +counts.sort(0, false) + +maxCount = counts[0][0] +for count in counts + if count[0] == maxCount then print count[1] +end for diff --git a/Task/Anagrams/OCaml/anagrams.ocaml b/Task/Anagrams/OCaml/anagrams.ml similarity index 100% rename from Task/Anagrams/OCaml/anagrams.ocaml rename to Task/Anagrams/OCaml/anagrams.ml diff --git a/Task/Anagrams/PascalABC.NET/anagrams.pas b/Task/Anagrams/PascalABC.NET/anagrams.pas new file mode 100644 index 0000000000..937517fc8e --- /dev/null +++ b/Task/Anagrams/PascalABC.NET/anagrams.pas @@ -0,0 +1,7 @@ +begin + var s := System.Net.WebClient.Create.DownloadString('http://wiki.puzzlers.org/pub/wordlists/unixdict.txt'); + var words := s.Split; + var groups := words.GroupBy(word -> word.Order.JoinToString); + var maxCount := groups.Max(gr -> gr.Count); + groups.Where(gr -> gr.Count = maxCount).PrintLines; +end. diff --git a/Task/Anagrams/Pluto/anagrams.pluto b/Task/Anagrams/Pluto/anagrams.pluto new file mode 100644 index 0000000000..5a71e6cda7 --- /dev/null +++ b/Task/Anagrams/Pluto/anagrams.pluto @@ -0,0 +1,20 @@ +local fmt = require "fmt" + +local word_list = "unixdict.txt" -- local copy +local nl = os.platform == "windows" ? "\r\n" : "\n" +local words = io.contents(word_list):rstrip():split(nl):map(|w| -> w:strip()) +local word_map = {} +for words as word do + local letters = word:split("") + letters:sort() + local sorted_word = letters:concat("") + if word_map[sorted_word] then + word_map[sorted_word]:insert(word) + else + word_map[sorted_word] = {word} + end +end +local most = word_map:values():reduce(|max, v| -> #v > max ? #v : max, 0) +for key, val in word_map do + if #word_map[key] == most then fmt.lprint(val) end +end diff --git a/Task/Anagrams/PowerShell/anagrams-1.psh b/Task/Anagrams/PowerShell/anagrams-1.ps1 similarity index 100% rename from Task/Anagrams/PowerShell/anagrams-1.psh rename to Task/Anagrams/PowerShell/anagrams-1.ps1 diff --git a/Task/Anagrams/PowerShell/anagrams-2.psh b/Task/Anagrams/PowerShell/anagrams-2.ps1 similarity index 100% rename from Task/Anagrams/PowerShell/anagrams-2.psh rename to Task/Anagrams/PowerShell/anagrams-2.ps1 diff --git a/Task/Anagrams/Rebol/anagrams.rebol b/Task/Anagrams/Rebol/anagrams.rebol new file mode 100644 index 0000000000..b870201fcb --- /dev/null +++ b/Task/Anagrams/Rebol/anagrams.rebol @@ -0,0 +1,29 @@ +Rebol [ + title: "Rosetta code: Anagrams" + file: %Anagrams.r3 + url: https://rosettacode.org/wiki/Anagrams + note: "Based on Red language implementation!" +] +;; Build an anagram index from a local unix dictionary file and print the largest anagram families +m: make map! [] 25000 ;; pre-size a map for better performance (target ~25,000 keys) + +;; Ensure unixdict.txt exists locally; if not, download it +unless exists? %unixdict.txt [ + write %unixdict.txt read https://raw.githubusercontent.com/thundergnat/rc-run/refs/heads/master/rc/resources/unixdict.txt +] +;; Track the size of the largest anagram group found so far +maxx: 0 +;; Read the dictionary line-by-line +foreach word read/lines %unixdict.txt [ + sword: sort copy word ;; key = sorted letters of the word (anagram signature) + either find m sword [ ;; if we already have this signature + append m/:sword word ;; add the word to that anagram group + maxx: max maxx length? m/:sword ;; update maximum group size if needed + ][ ;; otherwise create a new group with this word + put m sword append copy [] word + ] +] +;; Print all groups that match the maximum size (i.e., largest anagram families) +foreach [k v] m [ + if maxx = length? v [print v] +] diff --git a/Task/Anagrams/Rust/anagrams-1.rust b/Task/Anagrams/Rust/anagrams-1.rs similarity index 100% rename from Task/Anagrams/Rust/anagrams-1.rust rename to Task/Anagrams/Rust/anagrams-1.rs diff --git a/Task/Anagrams/Rust/anagrams-2.rust b/Task/Anagrams/Rust/anagrams-2.rs similarity index 100% rename from Task/Anagrams/Rust/anagrams-2.rust rename to Task/Anagrams/Rust/anagrams-2.rs diff --git a/Task/Anagrams/Scheme/anagrams.ss b/Task/Anagrams/Scheme/anagrams.scm similarity index 100% rename from Task/Anagrams/Scheme/anagrams.ss rename to Task/Anagrams/Scheme/anagrams.scm diff --git a/Task/Anagrams/Seed7/anagrams.seed7 b/Task/Anagrams/Seed7/anagrams.seed7 index 38a87c13a0..9926d2ec8b 100644 --- a/Task/Anagrams/Seed7/anagrams.seed7 +++ b/Task/Anagrams/Seed7/anagrams.seed7 @@ -33,7 +33,7 @@ const proc: main is func var integer: length is 0; var integer: maxLength is 0; begin - dictFile := openStrifile(getHttp("wiki.puzzlers.org/pub/wordlists/unixdict.txt")); + dictFile := openStriFile(getHttp("wiki.puzzlers.org/pub/wordlists/unixdict.txt")); while hasNext(dictFile) do readln(dictFile, word); sortedLetters := sort(word); diff --git a/Task/Anagrams/TAV/anagrams.tav b/Task/Anagrams/TAV/anagrams.tav new file mode 100644 index 0000000000..6b940f7f6e --- /dev/null +++ b/Task/Anagrams/TAV/anagrams.tav @@ -0,0 +1,38 @@ +\( Find anagrams (words with the same set of letters) + Words are the lines of an input file. + Sorting the letters of the word gives the key for a map + having a list (row) of all words so far. +\) +\+ stdlib +main(parms):+ + parms[1] =~ 'unixdict.txt' \ default input file + wordmap =: get words from parms[1] + maxw =: wordmap.maxlen + ?# idx =: map wordmap give keys ascending + words =: wordmap{idx} + ? maxw = words.count + print words::join values by ', ' + +\ read the file (infn) and return a map +get words from (infn): + res =: new map \ create the result map + res.maxlen =: 0 + ?# line =: file infn give lines \ or: infn::give lines + add line to res + :> res + +\ add a word to the map +add (word) to (amap): + idx =: sort characters of word::case to upper + row =: amap{idx} \ get indexed words + ? row = () \ new entry if void + row =: new row + amap{idx} =: row + row[] =: word \ add new entry + amap.maxlen =: maximum of amap.maxlen, row.count + +\ Sort the characters of a string +sort characters of (s): + sr =: string s as character row + row sr sort ascending + :> row sr join values as string \ without separator diff --git a/Task/Anagrams/Uiua/anagrams.uiua b/Task/Anagrams/Uiua/anagrams.uiua new file mode 100644 index 0000000000..8a388e72cb --- /dev/null +++ b/Task/Anagrams/Uiua/anagrams.uiua @@ -0,0 +1,12 @@ +# Experimental! +# The "Experimental!" comment above is required by the interpreter since &fetch is currently an experimental feature and is subject to change. + +# Grab the entire contents of the page as an array of bytes, then decode it into a string of text. +°utf₈ &fetch "https://raw.githubusercontent.com/thundergnat/rc-run/refs/heads/master/rc/resources/unixdict.txt" +°/$"_\n_" # Split the string into words by line breaks +# Group words that are anagrams together. +# This is done by first sorting the letters in each word to make a "key" and grouping words together that have the same key. +⊕□⊸(⊛⍚⍆) +# Count the number of words in each group, and keep only the groups that have the maximum number of words of any group. +▽⊸(=⊸/↥≡◇⧻) +≡&p # Print each group one at a time diff --git a/Task/Anagrams/Ursalang/anagrams.ursa b/Task/Anagrams/Ursalang/anagrams.ursa new file mode 100644 index 0000000000..54ebff6dac --- /dev/null +++ b/Task/Anagrams/Ursalang/anagrams.ursa @@ -0,0 +1,21 @@ +use js.fetch +let text = fetch("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt").text() +let words = text.split("\n") + +let anagrams = {} +for word in words.iter() { + let sorted = word.split("").sorted().join("") + if anagrams.get(sorted) == null { + anagrams.set(sorted, []) + } + anagrams.get(sorted).push(word) +} + +var most_anagrams = 0 +for ana in anagrams.values() { + if ana.len() > most_anagrams {most_anagrams := ana.len()} +} + +for ana in anagrams.values() { + if ana.len() == most_anagrams {print(ana)} +} diff --git a/Task/Anagrams/V-(Vlang)/anagrams.v b/Task/Anagrams/V-(Vlang)/anagrams.v index 599471f1fa..85e11f3fdb 100644 --- a/Task/Anagrams/V-(Vlang)/anagrams.v +++ b/Task/Anagrams/V-(Vlang)/anagrams.v @@ -1,26 +1,18 @@ import os fn main(){ - words := os.read_lines('unixdict.txt')? - + words := os.read_lines('unixdict.txt')! mut m := map[string][]string{} mut ma := 0 for word in words { mut letters := word.split('') letters.sort() sorted_word := letters.join('') - if sorted_word in m { - m[sorted_word] << word - } else { - m[sorted_word] = [word] - } - if m[sorted_word].len > ma { - ma = m[sorted_word].len - } + if sorted_word in m {m[sorted_word] << word} + else {m[sorted_word] = [word]} + if m[sorted_word].len > ma {ma = m[sorted_word].len} } for _, a in m { - if a.len == ma { - println(a) - } + if a.len == ma {println(a)} } } diff --git a/Task/Anagrams/VBScript/anagrams.vb b/Task/Anagrams/VBScript/anagrams.vbs similarity index 100% rename from Task/Anagrams/VBScript/anagrams.vb rename to Task/Anagrams/VBScript/anagrams.vbs diff --git a/Task/Anagrams/Wren/anagrams.wren b/Task/Anagrams/Wren/anagrams.wren index 66756f3187..b796c90488 100644 --- a/Task/Anagrams/Wren/anagrams.wren +++ b/Task/Anagrams/Wren/anagrams.wren @@ -1,5 +1,5 @@ import "io" for File -import "/sort" for Sort +import "./sort" for Sort var words = File.read("unixdict.txt").split("\n").map { |w| w.trim() } var wordMap = {} diff --git a/Task/Angle-difference-between-two-bearings/8th/angle-difference-between-two-bearings.8th b/Task/Angle-difference-between-two-bearings/8th/angle-difference-between-two-bearings.8th new file mode 100644 index 0000000000..2c80bde6fe --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/8th/angle-difference-between-two-bearings.8th @@ -0,0 +1,43 @@ +\ diff-bearings.8th +\ Rosetta Code -- angle difference between two bearings +\ by John I. Helmers 2026.04.04 +\ 8th version 26.02 Professional + +11 ## \ sets the precision to 11 decimal places + +\ data array +[ [ 20 , 45 ] , [ -45 , 45 ] , [ -85 , 90 ] , [ -95 , 90 ] , [ -45 , 125 ] , [ -45 , 145 ] , [ 29.4803 , -88.6381 ] , [ -78.3251 , -159.036 ] ] constant BEARINGS + +\ test array +[ [ -70099.74233810938 , 29840.67437876723 ] , [ -165313.6666297357 , 33693.9894517456 ] , [ 1174.8380510598456 , -154146.66490124757 ] , [ 60175.77306795546 , 42213.07192354373 ] ] constant TEST + +360 constant LIMIT \ sets circle limit to 360 degrees + +: make-big-floats \ [ a0, a1, a2 ... ] -- [ a'0, a'1, a'2 ... ] + ( ( n:bfloat ) a:map ) a:map ; + +: subtract-bearings \ [b1,b2] -- n + 0 a:@ swap 1 a:@ rot n:- ; + +: simplify LIMIT n:fmod ; + +: find-acute \ n -- n + dup 180 > if 360 n:- else dup -180 < if 360 n:+ then then ; + +: compute-angles \ a -- a' + ( subtract-bearings simplify find-acute 2 swap a:! drop ) a:each! ; + +: .table-header \ -- +" b1___________________ b2__________________ diff_________________" . cr ; + +: .lines \ a -- | print each line of table + ( ( "%>24.11f" s:strfmt . ) a:each! drop cr ) a:each! ; + +: .table .table-header .lines ; + +: process-data make-big-floats compute-angles ; + +: do-it BEARINGS process-data .table drop cr + TEST process-data .table drop cr ; + +do-it bye diff --git a/Task/Angle-difference-between-two-bearings/ALGOL-68/angle-difference-between-two-bearings.alg b/Task/Angle-difference-between-two-bearings/ALGOL-68/angle-difference-between-two-bearings.alg new file mode 100644 index 0000000000..10787dbd52 --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/ALGOL-68/angle-difference-between-two-bearings.alg @@ -0,0 +1,38 @@ +BEGIN # angle difference between 2 bearings - translated from the 11l sample # + + PROC wrap = (REAL v, l1, l2 )REAL: + BEGIN + REAL result := v; + WHILE result < l1 DO result +:= 2 * l2 OD; + WHILE result > l2 DO result +:= 2 * l1 OD; + result + END # wrap # ; + + PROC get_difference = ( REAL b1, b2 )REAL: wrap( b2 - b1, -180.0, 180.0 ); + + OP FMT = ( REAL v )STRING: + BEGIN + STRING result := fixed( ABS v, 0, 3 ); + IF result[ LWB result ] = "." THEN "0" +=: result FI; + WHILE result[ UPB result ] = "0" DO result := result[ : UPB result - 1 ] OD; + IF result[ UPB result ] = "." THEN result := result[ : UPB result - 1 ] FI; + IF v < 0 THEN "-" ELSE " " FI + result + END # FMT # ; + + print( ( FMT get_difference( 20.0, 45.0 ), newline ) ); + print( ( FMT get_difference( -45.0, 45.0 ), newline ) ); + print( ( FMT get_difference( -85.0, 90.0 ), newline ) ); + print( ( FMT get_difference( -95.0, 90.0 ), newline ) ); + print( ( FMT get_difference( -45.0, 125.0 ), newline ) ); + print( ( FMT get_difference( -45.0, 145.0 ), newline ) ); + print( ( FMT get_difference( -45.0, 125.0 ), newline ) ); + print( ( FMT get_difference( -45.0, 145.0 ), newline ) ); + print( ( FMT get_difference( 29.4803, -88.6381 ), newline ) ); + print( ( FMT get_difference( -78.3251, -159.036 ), newline ) ); + print( ( newline ) ); + print( ( FMT get_difference( -70099.74233810938, 29840.67437876723 ), newline ) ); + print( ( FMT get_difference( -165313.6666297357, 33693.9894517456 ), newline ) ); + print( ( FMT get_difference( 1174.8380510598456, -154146.66490124757 ), newline ) ); + print( ( FMT get_difference( 60175.77306795546, 42213.07192354373 ), newline ) ) + +END diff --git a/Task/Angle-difference-between-two-bearings/ANSI-BASIC/angle-difference-between-two-bearings.basic b/Task/Angle-difference-between-two-bearings/ANSI-BASIC/angle-difference-between-two-bearings.basic new file mode 100644 index 0000000000..9a7c6b0d99 --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/ANSI-BASIC/angle-difference-between-two-bearings.basic @@ -0,0 +1,33 @@ +100 REM Angle difference between two bearings +110 DECLARE EXTERNAL FUNCTION GetDiff +120 REM +130 SUB PrintRow(B1, B2) +140 PRINT USING "#######.###### #######.###### #######.######": B1, B2, GetDiff(B1, B2) +150 END SUB +160 REM +170 print "Input in -180 to +180 range" +180 PRINT " Bearing 1 Bearing 2 Difference" +190 CALL PrintRow(20.0, 45.0) +200 CALL PrintRow(-45.0, 45.0) +210 CALL PrintRow(-85.0, 90.0) +220 CALL PrintRow(-95.0, 90.0) +230 CALL PrintRow(-45.0, 125.0) +240 CALL PrintRow(-45.0, 145.0) +250 CALL PrintRow(-45.0, 125.0) +260 CALL PrintRow(-45.0, 145.0) +270 CALL PrintRow(29.4803, -88.6381) +280 CALL PrintRow(-78.3251, -159.036) +290 PRINT +300 PRINT "Input in wider range" +310 PRINT " Bearing 1 Bearing 2 Difference" +320 CALL PrintRow(-70099.74233810938, 29840.67437876723) +330 CALL PrintRow(-165313.6666297357, 33693.9894517456) +340 CALL PrintRow(1174.8380510598456, -154146.66490124757) +350 CALL PrintRow(60175.77306795546, 42213.07192354373) +360 END +370 REM +380 EXTERNAL FUNCTION GetDiff (B1, B2) +390 LET R = MOD(B2 - B1, 360.0) +400 IF R >= 180.0 THEN LET R = R - 360.0 +410 LET GetDiff = R +420 END FUNCTION diff --git a/Task/Angle-difference-between-two-bearings/Ada/angle-difference-between-two-bearings.ada b/Task/Angle-difference-between-two-bearings/Ada/angle-difference-between-two-bearings.adb similarity index 100% rename from Task/Angle-difference-between-two-bearings/Ada/angle-difference-between-two-bearings.ada rename to Task/Angle-difference-between-two-bearings/Ada/angle-difference-between-two-bearings.adb diff --git a/Task/Angle-difference-between-two-bearings/Agena/angle-difference-between-two-bearings.agena b/Task/Angle-difference-between-two-bearings/Agena/angle-difference-between-two-bearings.agena new file mode 100644 index 0000000000..682112bf58 --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/Agena/angle-difference-between-two-bearings.agena @@ -0,0 +1,34 @@ +# Angle difference between two bearings + +proc getdiff(b1, b2) is + r := (b2 - b1) symmod 360.0; + if r >= 180.0 then r -:= 360.0 fi; + if r < -180.0 then r +:= 360.0 fi; + return r +end; + +proc printrow(b1, b2) is + printf("%14.6f %14.6f %14.6f\n", b1, b2, getdiff(b1, b2)) +end; + +scope + print("Input in -180 to +180 range"); + print(" Bearing 1 Bearing 2 Difference"); + printrow(20.0, 45.0); + printrow(-45.0, 45.0); + printrow(-85.0, 90.0); + printrow(-95.0, 90.0); + printrow(-45.0, 125.0); + printrow(-45.0, 145.0); + printrow(-45.0, 125.0); + printrow(-45.0, 145.0); + printrow(29.4803, -88.6381); + printrow(-78.3251, -159.036); + print(); + print("Input in wider range"); + print(" Bearing 1 Bearing 2 Difference"); + printrow(-70099.74233810938, 29840.67437876723); + printrow(-165313.6666297357, 33693.9894517456); + printrow(1174.8380510598456, -154146.66490124757); + printrow(60175.77306795546, 42213.07192354373) +epocs diff --git a/Task/Angle-difference-between-two-bearings/AppleScript/angle-difference-between-two-bearings.applescript b/Task/Angle-difference-between-two-bearings/AppleScript/angle-difference-between-two-bearings.applescript new file mode 100644 index 0000000000..21f8f17583 --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/AppleScript/angle-difference-between-two-bearings.applescript @@ -0,0 +1,18 @@ +on diff_bearing({b1, b2}) + set r to (b2 - b1) mod 360 + if r > 180 then + r - 360 + else if r < -180 then + r + 360 + else + r + end if +end diff_bearing + +set test_bearings to {{20, 45}, {-45, 45}, {-85, 90}, {-95, 90}, {-45, 125}, {-45, 145}, {29.4803, -88.6381}, {-78.3251, -159.036}} + +set big_bearings to {{-7.00997423381094E+4, 2.98406743787672E+4}, {-1.65313666629736E+5, 3.36939894517456E+4}, {1174.838051059846, -1.54146664901248E+5}, {6.01757730679555E+4, 4.22130719235437E+4}} + +repeat with b in test_bearings & big_bearings + log diff_bearing(b) +end repeat diff --git a/Task/Angle-difference-between-two-bearings/BQN/angle-difference-between-two-bearings.bqn b/Task/Angle-difference-between-two-bearings/BQN/angle-difference-between-two-bearings.bqn new file mode 100644 index 0000000000..df9312042d --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/BQN/angle-difference-between-two-bearings.bqn @@ -0,0 +1,12 @@ +Adiff ← 180 - 360 | 180 + - + +tests ← [20‿45, ¯45‿45, ¯85‿90, ¯95‿90, ¯45‿125, ¯45‿145 + 99‿279, 29.4803‿¯88.6381, ¯78.3251‿¯159.036 + ¯70099.74233810938‿29840.67437876723 + ¯165313.6666297357‿33693.9894517456 + 1174.8380510598456‿¯154146.66490124757 + 60175.77306795546‿42213.07192354373] + +Round ← ⌊∘+⟜0.5⌾(1e3⊸×) + +Round∘∾⟜(Adiff´)˘ tests diff --git a/Task/Angle-difference-between-two-bearings/Ballerina/angle-difference-between-two-bearings.ballerina b/Task/Angle-difference-between-two-bearings/Ballerina/angle-difference-between-two-bearings.ballerina new file mode 100644 index 0000000000..213bb46d14 --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/Ballerina/angle-difference-between-two-bearings.ballerina @@ -0,0 +1,34 @@ +import ballerina/io; + +function subtract(float b1, float b2) returns float { + float d = (b2 - b1) % 360.0; + if d < -180.0 { d += 360.0; } + if d >= 180.0 { d -= 360.0; } + return d.round(4); +} + +public function main() { + float[][] pairs = [ + [ 20, 45], + [-45, 45], + [-85, 90], + [-95, 90], + [-45, 125], + [-45, 145], + [ 29.4803, -88.6381], + [-78.3251, -159.036], + [-70099.74233810938, 29840.67437876723], + [-165313.6666297357, 33693.9894517456], + [1174.8380510598456, -154146.66490124757], + [60175.77306795546, 42213.07192354373] + ]; + + io:println("Differences (to 4dp) between these bearings:"); + foreach var pair in pairs { + float p0 = pair[0]; + float p1 = pair[1]; + float diff = subtract(p0, p1); + string offset = p0 < 0.0 ? " " : " "; + io:println(`${offset}${p0} and ${p1} -> ${diff}`); + } +} diff --git a/Task/Angle-difference-between-two-bearings/C++/angle-difference-between-two-bearings.cpp b/Task/Angle-difference-between-two-bearings/C++/angle-difference-between-two-bearings.cpp index af35a7815c..92cb3f68b7 100644 --- a/Task/Angle-difference-between-two-bearings/C++/angle-difference-between-two-bearings.cpp +++ b/Task/Angle-difference-between-two-bearings/C++/angle-difference-between-two-bearings.cpp @@ -2,34 +2,40 @@ #include using namespace std; -double getDifference(double b1, double b2) { - double r = fmod(b2 - b1, 360.0); - if (r < -180.0) - r += 360.0; - if (r >= 180.0) - r -= 360.0; - return r; +double getDifference(double b1, double b2) +{ + double r = fmod(b2 - b1, 360.0); + if (r < -180.0) + r += 360.0; + if (r >= 180.0) + r -= 360.0; + return r; +} + +inline void printRow(double b1, double b2) +{ + cout << getDifference(b1, b2) << endl; } int main() { - cout << "Input in -180 to +180 range" << endl; - cout << getDifference(20.0, 45.0) << endl; - cout << getDifference(-45.0, 45.0) << endl; - cout << getDifference(-85.0, 90.0) << endl; - cout << getDifference(-95.0, 90.0) << endl; - cout << getDifference(-45.0, 125.0) << endl; - cout << getDifference(-45.0, 145.0) << endl; - cout << getDifference(-45.0, 125.0) << endl; - cout << getDifference(-45.0, 145.0) << endl; - cout << getDifference(29.4803, -88.6381) << endl; - cout << getDifference(-78.3251, -159.036) << endl; - - cout << "Input in wider range" << endl; - cout << getDifference(-70099.74233810938, 29840.67437876723) << endl; - cout << getDifference(-165313.6666297357, 33693.9894517456) << endl; - cout << getDifference(1174.8380510598456, -154146.66490124757) << endl; - cout << getDifference(60175.77306795546, 42213.07192354373) << endl; + cout << "Input in -180 to +180 range" << endl; + printRow(20.0, 45.0); + printRow(-45.0, 45.0); + printRow(-85.0, 90.0); + printRow(-95.0, 90.0); + printRow(-45.0, 125.0); + printRow(-45.0, 145.0); + printRow(-45.0, 125.0); + printRow(-45.0, 145.0); + printRow(29.4803, -88.6381); + printRow(-78.3251, -159.036); - return 0; + cout << endl << "Input in wider range" << endl; + printRow(-70099.74233810938, 29840.67437876723); + printRow(-165313.6666297357, 33693.9894517456); + printRow(1174.8380510598456, -154146.66490124757); + printRow(60175.77306795546, 42213.07192354373); + + return 0; } diff --git a/Task/Angle-difference-between-two-bearings/COBOL/angle-difference-between-two-bearings.cobol b/Task/Angle-difference-between-two-bearings/COBOL/angle-difference-between-two-bearings.cob similarity index 100% rename from Task/Angle-difference-between-two-bearings/COBOL/angle-difference-between-two-bearings.cobol rename to Task/Angle-difference-between-two-bearings/COBOL/angle-difference-between-two-bearings.cob diff --git a/Task/Angle-difference-between-two-bearings/Chipmunk-Basic/angle-difference-between-two-bearings.basic b/Task/Angle-difference-between-two-bearings/Chipmunk-Basic/angle-difference-between-two-bearings.basic new file mode 100644 index 0000000000..2c022ab85f --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/Chipmunk-Basic/angle-difference-between-two-bearings.basic @@ -0,0 +1,32 @@ +100 cls +110 sub getdifference(b1,b2) +120 r = (b2-b1) mod 360 +130 if r >= 180 then r = r-360 +140 print using "#######.######";b1; +150 print using " #######.######";b2; +160 print using " #######.######";r +170 end sub +180 print "Input in -180 to +180 range:" +190 print " b1 b2 difference" +200 print " -------------------------------------------------" +210 getdifference(20,45) +220 getdifference(-45,45) +230 getdifference(-85,90) +240 getdifference(-95,90) +250 getdifference(-45,125) +260 getdifference(-45,145) +270 getdifference(-45,125) +280 getdifference(-45,145) +290 getdifference(29.4803,-88.6381) +300 getdifference(-78.3251,-159.036) +310 getdifference(-70099.742338,29840.674379) +320 getdifference(-165313.66663,33693.989452) +330 getdifference(1174.838051,-154146.664901) +340 print +350 print "Input in wider range:" +360 print " b1 b2 difference" +370 print " -------------------------------------------------" +380 getdifference(-70099.742338,29840.674379) +390 getdifference(-165313.66663,33693.989452) +400 getdifference(1174.838051,-154146.664901) +410 getdifference(60175.773068,42213.071924) diff --git a/Task/Angle-difference-between-two-bearings/Crystal/angle-difference-between-two-bearings.cr b/Task/Angle-difference-between-two-bearings/Crystal/angle-difference-between-two-bearings.cr new file mode 100644 index 0000000000..24aa61f987 --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/Crystal/angle-difference-between-two-bearings.cr @@ -0,0 +1,14 @@ +def angle_diff (a1, a2) + diff = (a2 - a1) % 360 + diff -= 360 if diff > +180 + diff +end + +rows = [{20, 45}, {-45, 45}, {-85, 90}, {-95, 90}, {-45, 125}, {-45, 145}, + {29.4803, -88.6381}, {-78.3251, -159.036}, + {-70099.74233810938, 29840.67437876723}, + {-165313.6666297357, 33693.9894517456}, + {1174.8380510598456, -154146.66490124757}, + {60175.77306795546, 42213.07192354373}].each do |b1, b2| + puts "Angle difference between %12.4f and %12.4f is %9.4f°" % { b1, b2, angle_diff(b1, b2) } +end diff --git a/Task/Angle-difference-between-two-bearings/EasyLang/angle-difference-between-two-bearings.easy b/Task/Angle-difference-between-two-bearings/EasyLang/angle-difference-between-two-bearings.easy index fbe96a9106..052ea0af48 100644 --- a/Task/Angle-difference-between-two-bearings/EasyLang/angle-difference-between-two-bearings.easy +++ b/Task/Angle-difference-between-two-bearings/EasyLang/angle-difference-between-two-bearings.easy @@ -7,7 +7,7 @@ func angdiff a b . . return r . -proc pd a b . . +proc pd a b . print b & " " & a & " -> " & angdiff a b . pd 20 45 diff --git a/Task/Angle-difference-between-two-bearings/J/angle-difference-between-two-bearings-1.j b/Task/Angle-difference-between-two-bearings/J/angle-difference-between-two-bearings-1.j deleted file mode 100644 index 3314b63110..0000000000 --- a/Task/Angle-difference-between-two-bearings/J/angle-difference-between-two-bearings-1.j +++ /dev/null @@ -1 +0,0 @@ -relativeBearing=: (180 -~ 360 | 180 + -~)/"1 diff --git a/Task/Angle-difference-between-two-bearings/J/angle-difference-between-two-bearings-2.j b/Task/Angle-difference-between-two-bearings/J/angle-difference-between-two-bearings-2.j deleted file mode 100644 index 788dc8defd..0000000000 --- a/Task/Angle-difference-between-two-bearings/J/angle-difference-between-two-bearings-2.j +++ /dev/null @@ -1,27 +0,0 @@ -tests=: _99&".;._2 noun define -20 45 --45 45 --85 90 --95 90 --45 125 --45 145 -29.4803 -88.6381 --78.3251 -159.036 --70099.74233810938 29840.67437876723 --165313.6666297357 33693.9894517456 -1174.8380510598456 -154146.66490124757 -60175.77306795546 42213.07192354373 -) - tests ,. relativeBearing tests - 20 45 25 - _45 45 90 - _85 90 175 - _95 90 _175 - _45 125 170 - _45 145 _170 - 29.4803 _88.6381 _118.118 -_78.3251 _159.036 _80.7109 -_70099.7 29840.7 _139.583 - _165314 33694 _72.3439 - 1174.84 _154147 _161.503 - 60175.8 42213.1 37.2989 diff --git a/Task/Angle-difference-between-two-bearings/J/angle-difference-between-two-bearings.j b/Task/Angle-difference-between-two-bearings/J/angle-difference-between-two-bearings.j new file mode 100644 index 0000000000..92920d3a2d --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/J/angle-difference-between-two-bearings.j @@ -0,0 +1,16 @@ +relativeBearing=: 180 - 360 | 180 + - + +tests=: _99&".;._2 noun define +20 45 +-45 45 +-85 90 +-95 90 +-45 125 +-45 145 +29.4803 -88.6381 +-78.3251 -159.036 +-70099.74233810938 29840.67437876723 +-165313.6666297357 33693.9894517456 +1174.8380510598456 -154146.66490124757 +60175.77306795546 42213.07192354373 +) diff --git a/Task/Angle-difference-between-two-bearings/Julia/angle-difference-between-two-bearings.julia b/Task/Angle-difference-between-two-bearings/Julia/angle-difference-between-two-bearings.jl similarity index 100% rename from Task/Angle-difference-between-two-bearings/Julia/angle-difference-between-two-bearings.julia rename to Task/Angle-difference-between-two-bearings/Julia/angle-difference-between-two-bearings.jl diff --git a/Task/Angle-difference-between-two-bearings/Kotlin/angle-difference-between-two-bearings.kotlin b/Task/Angle-difference-between-two-bearings/Kotlin/angle-difference-between-two-bearings.kts similarity index 100% rename from Task/Angle-difference-between-two-bearings/Kotlin/angle-difference-between-two-bearings.kotlin rename to Task/Angle-difference-between-two-bearings/Kotlin/angle-difference-between-two-bearings.kts diff --git a/Task/Angle-difference-between-two-bearings/Langur/angle-difference-between-two-bearings.langur b/Task/Angle-difference-between-two-bearings/Langur/angle-difference-between-two-bearings.langur new file mode 100644 index 0000000000..469a77ae69 --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/Langur/angle-difference-between-two-bearings.langur @@ -0,0 +1,26 @@ +val diff = fn(b1 number, b2 number) { + val r = (b2 - b1) mod 360 + if r > 180 { r - 360 } else { r } +} + +val pairs = [ + [ 20, 45], + [-45, 45], + [-85, 90], + [-95, 90], + [-45, 125], + [-45, 145], + [ 29.4803, -88.6381], + [-78.3251, -159.036], + [-70099.74233810938, 29840.67437876723], + [-165313.6666297357, 33693.9894517456], + [1174.8380510598456, -154146.66490124757], + [60175.77306795546, 42213.07192354373], +] + +writeln " b1 b2 diff" +writeln "-" * 63 + +for b in pairs { + writeln "{{b[1] : 21}}{{b[2] : 21}}{{diff(b[1], b[2]) : 21}}" +} diff --git a/Task/Angle-difference-between-two-bearings/Maxima/angle-difference-between-two-bearings.maxima b/Task/Angle-difference-between-two-bearings/Maxima/angle-difference-between-two-bearings.maxima new file mode 100644 index 0000000000..343fb0dcaf --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/Maxima/angle-difference-between-two-bearings.maxima @@ -0,0 +1,16 @@ +diff_bearing(b1, b2) := block( + r: mod(b2-b1, 360), + if r>180 then r-360 else r)$ + +test_bearings: [[20, 45], [-45, 45], [-85, 90], +[-95, 90], [-45, 125], [-45, 145], +[29.4803, -88.6381], [-78.3251, -159.036]]$ + +big_bearings: [[-70099.74233810938, 29840.67437876723], + [-165313.6666297357, 33693.9894517456], + [1174.8380510598456, -154146.66490124757], + [60175.77306795546, 42213.07192354373]]$ + +db_unary(list) := map(lambda([l], apply(diff_bearing, l)), list)$ +db_unary(test_bearings); +db_unary(big_bearings); diff --git a/Task/Angle-difference-between-two-bearings/OCaml/angle-difference-between-two-bearings.ocaml b/Task/Angle-difference-between-two-bearings/OCaml/angle-difference-between-two-bearings.ml similarity index 100% rename from Task/Angle-difference-between-two-bearings/OCaml/angle-difference-between-two-bearings.ocaml rename to Task/Angle-difference-between-two-bearings/OCaml/angle-difference-between-two-bearings.ml diff --git a/Task/Angle-difference-between-two-bearings/PHP/angle-difference-between-two-bearings.php b/Task/Angle-difference-between-two-bearings/PHP/angle-difference-between-two-bearings.php new file mode 100644 index 0000000000..0cec699805 --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/PHP/angle-difference-between-two-bearings.php @@ -0,0 +1,38 @@ + 180.0) + $r -= 360.0; + if ($r < -180.0) + $r += 360.0; + return $r; + } + + function echo_row($b1, $b2) { + echo str_pad(number_format($b1, 6, ".", ""), 14, " ", STR_PAD_LEFT).' '; + echo str_pad(number_format($b2, 6, ".", ""), 14, " ", STR_PAD_LEFT).' '; + echo str_pad(number_format(get_diff($b1, $b2), 6), 14, " ", STR_PAD_LEFT); + echo "\n"; + } + + echo "Input in -180 to +180 range\n"; + echo " Bearing 1 Bearing 2 Difference\n"; + echo_row(20.0, 45.0); + echo_row(-45.0, 45.0); + echo_row(-85.0, 90.0); + echo_row(-95.0, 90.0); + echo_row(-45.0, 125.0); + echo_row(-45.0, 145.0); + echo_row(-45.0, 125.0); + echo_row(-45.0, 145.0); + echo_row(29.4803, -88.6381); + echo_row(-78.3251, -159.036); + echo "\nInput in wider range\n"; + echo " Bearing 1 Bearing 2 Difference\n"; + echo_row(-70099.74233810938, 29840.67437876723); + echo_row(-165313.6666297357, 33693.9894517456); + echo_row(1174.8380510598456, -154146.66490124757); + echo_row(60175.77306795546, 42213.07192354373); +?> diff --git a/Task/Angle-difference-between-two-bearings/Pascal-P/angle-difference-between-two-bearings.pas b/Task/Angle-difference-between-two-bearings/Pascal-P/angle-difference-between-two-bearings.pas new file mode 100644 index 0000000000..597ba6ee6b --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/Pascal-P/angle-difference-between-two-bearings.pas @@ -0,0 +1,46 @@ +program anglebearings(output); + (* Angle difference between two bearings *) + + function rmod(x1, x2: real): real; + begin + rmod := x1 - trunc(x1 / x2) * x2; + end; + + function getdiff(b1, b2: real): real; + var + r: real; + begin + r := rmod((b2 - b1), 360.0); + if r >= 180.0 then + r := r - 360.0; + if r < -180.0 then + r := r + 360.0; + getdiff := r; + end; + + procedure writerow(b1, b2: real); + begin + writeln(b1: 14, ' ', b2: 14, ' ', getdiff(b1, b2):14); + end; + +begin + writeln('Input in -180 to +180 range'); + writeln(' Bearing 1 Bearing 2 Difference'); + writerow(20.0, 45.0); + writerow(-45.0, 45.0); + writerow(-85.0, 90.0); + writerow(-95.0, 90.0); + writerow(-45.0, 125.0); + writerow(-45.0, 145.0); + writerow(-45.0, 125.0); + writerow(-45.0, 145.0); + writerow(29.4803, -88.6381); + writerow(-78.3251, -159.036); + writeln; + writeln('Input in wider range'); + writeln(' Bearing 1 Bearing 2 Difference'); + writerow(-70099.74233810938, 29840.67437876723); + writerow(-165313.6666297357, 33693.9894517456); + writerow(1174.8380510598456, -154146.66490124757); + writerow(60175.77306795546, 42213.07192354373) +end. diff --git a/Task/Angle-difference-between-two-bearings/PascalABC.NET/angle-difference-between-two-bearings.pas b/Task/Angle-difference-between-two-bearings/PascalABC.NET/angle-difference-between-two-bearings.pas new file mode 100644 index 0000000000..7886d30040 --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/PascalABC.NET/angle-difference-between-two-bearings.pas @@ -0,0 +1,16 @@ +function delta(b1, b2: real): real; +begin + result := (b2 - b1) - Trunc((b2 - b1) / 360.0) * 360.0; + if result < -180.0 then result += 360.0 + else if result >= 180.0 then result -= 360.0 +end; + +begin + var testVectors := + |(20.00, 45.00), (-45.00, 45.00), (-85.00, 90.00), + (-95.00, 90.00), (-45.00, 125.00), (-45.00, 145.00), + (29.48, -88.64), (-78.33, -159.04), (-70099.74, 29840.67), + (-165313.67, 33693.99), (1174.84, -154146.66), (60175.77, 42213.07)|; + foreach var vector in testVectors do + writeln(vector[0]:10:2, vector[1]:12:2, delta(vector[0], vector[1]):10:2); +end. diff --git a/Task/Angle-difference-between-two-bearings/Pluto/angle-difference-between-two-bearings.pluto b/Task/Angle-difference-between-two-bearings/Pluto/angle-difference-between-two-bearings.pluto new file mode 100644 index 0000000000..afb336106a --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/Pluto/angle-difference-between-two-bearings.pluto @@ -0,0 +1,31 @@ +require "math2" + +local function subtract(b1, b2) + local d = (b2 - b1) % 360 + if d < -180 then d += 360 end + if d >= 180 then d -= 360 end + return math.toplaces(d, 4) +end + +local pairs = { + { 20, 45}, + {-45, 45}, + {-85, 90}, + {-95, 90}, + {-45, 125}, + {-45, 145}, + { 29.4803, -88.6381}, + {-78.3251, -159.036}, + {-70099.74233810938, 29840.67437876723}, + {-165313.6666297357, 33693.9894517456}, + {1174.8380510598456, -154146.66490124757}, + {60175.77306795546, 42213.07192354373} +} + +print("Differences (to 4dp) between these bearings:") +for pairs as pair do + local [p1, p2] = pair + local diff = subtract(p1, p2) + local offset = p1 < 0 ? " " : " " + print($"{offset}{p1} and {p2} -> {diff}") +end diff --git a/Task/Angle-difference-between-two-bearings/PowerShell/angle-difference-between-two-bearings-1.psh b/Task/Angle-difference-between-two-bearings/PowerShell/angle-difference-between-two-bearings-1.ps1 similarity index 100% rename from Task/Angle-difference-between-two-bearings/PowerShell/angle-difference-between-two-bearings-1.psh rename to Task/Angle-difference-between-two-bearings/PowerShell/angle-difference-between-two-bearings-1.ps1 diff --git a/Task/Angle-difference-between-two-bearings/PowerShell/angle-difference-between-two-bearings-2.psh b/Task/Angle-difference-between-two-bearings/PowerShell/angle-difference-between-two-bearings-2.ps1 similarity index 100% rename from Task/Angle-difference-between-two-bearings/PowerShell/angle-difference-between-two-bearings-2.psh rename to Task/Angle-difference-between-two-bearings/PowerShell/angle-difference-between-two-bearings-2.ps1 diff --git a/Task/Angle-difference-between-two-bearings/PowerShell/angle-difference-between-two-bearings-3.ps1 b/Task/Angle-difference-between-two-bearings/PowerShell/angle-difference-between-two-bearings-3.ps1 new file mode 100644 index 0000000000..ae4fb0c542 --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/PowerShell/angle-difference-between-two-bearings-3.ps1 @@ -0,0 +1,39 @@ +# Angle difference between two bearings + +function Get-Diff([double]$B1, [double]$B2) { + $r = ($B2 - $B1) % 360.0 + if ($r -lt -180.0) { + $r += 360.0 + } + if ($r -ge 180.0) { + $r -= 360.0 + } + return [double]$r +} + +function Write-Row([double]$B1, [double]$B2) { + [string]$out = "$($B1.ToString('#######.000000').PadLeft(14,' '))" + $out += " $($B2.ToString('#######.000000').PadLeft(14,' '))" + $out += " $((Get-Diff $B1 $B2).ToString('#######.000000').PadLeft(14,' '))" + Write-Output $out +} + +Write-Output "Input in -180 to +180 range" +Write-Output " Bearing 1 Bearing 2 Difference" +Write-Row 20.0 45.0 +Write-Row -45.0 45.0 +Write-Row -85.0 90.0 +Write-Row -95.0 90.0 +Write-Row -45.0 125.0 +Write-Row -45.0 145.0 +Write-Row -45.0 125.0 +Write-Row -45.0 145.0 +Write-Row 29.4803 -88.6381 +Write-Row -78.3251 -159.036 +Write-Output "" +Write-Output "Input in wider range" +Write-Output " Bearing 1 Bearing 2 Difference" +Write-Row -70099.74233810938 29840.67437876723 +Write-Row -165313.6666297357 33693.9894517456 +Write-Row 1174.8380510598456 -154146.66490124757 +Write-Row 60175.77306795546 42213.07192354373 diff --git a/Task/Angle-difference-between-two-bearings/R/angle-difference-between-two-bearings.r b/Task/Angle-difference-between-two-bearings/R/angle-difference-between-two-bearings.r new file mode 100644 index 0000000000..b561b24310 --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/R/angle-difference-between-two-bearings.r @@ -0,0 +1,17 @@ +diff_bearing <- function(b1, b2){ + r <- (b2-b1)%%360 + ifelse(r>180, r-360, r) +} + +test_bearings <- list(c(20, 45), c(-45, 45), c(-85, 90), + c(-95, 90), c(-45, 125), c(-45, 145), + c(29.4803, -88.6381), c(-78.3251, -159.036)) + +test_bigbearings <- list(c(-70099.74233810938, 29840.67437876723), + c(-165313.6666297357, 33693.9894517456), + c(1174.8380510598456, -154146.66490124757), + c(60175.77306795546, 42213.07192354373)) + +db_unary <- function(v) do.call(diff_bearing, as.list(v)) +sapply(test_bearings, db_unary) +sapply(test_bigbearings, db_unary) diff --git a/Task/Angle-difference-between-two-bearings/Red/angle-difference-between-two-bearings.red b/Task/Angle-difference-between-two-bearings/Red/angle-difference-between-two-bearings.red new file mode 100644 index 0000000000..ca3975359e --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/Red/angle-difference-between-two-bearings.red @@ -0,0 +1,26 @@ +anglediff: func [b1 b2 /local r][ + r: mod (b2 - b1) 360 + either r >= 180 + [ r - 360 ] + [ r ] +] + +b1: 180 +b2: -180 + +test-list: [ + [20 45] + [-45 45] + [-85 90] + [-95 90] + [-45 125] + [-45 145] + [29.4803 -88.6381] + [-78.3251 -159.036] +] + +foreach test-case test-list [ + b1: test-case/1 + b2: test-case/2 + print [ "b1 : " b1 " b2 : " b2 "angle diff b2 - b1 : " (anglediff b1 b2)] +] diff --git a/Task/Angle-difference-between-two-bearings/Rust/angle-difference-between-two-bearings.rust b/Task/Angle-difference-between-two-bearings/Rust/angle-difference-between-two-bearings.rs similarity index 100% rename from Task/Angle-difference-between-two-bearings/Rust/angle-difference-between-two-bearings.rust rename to Task/Angle-difference-between-two-bearings/Rust/angle-difference-between-two-bearings.rs diff --git a/Task/Angle-difference-between-two-bearings/Scheme/angle-difference-between-two-bearings.ss b/Task/Angle-difference-between-two-bearings/Scheme/angle-difference-between-two-bearings.scm similarity index 100% rename from Task/Angle-difference-between-two-bearings/Scheme/angle-difference-between-two-bearings.ss rename to Task/Angle-difference-between-two-bearings/Scheme/angle-difference-between-two-bearings.scm diff --git a/Task/Angle-difference-between-two-bearings/Uiua/angle-difference-between-two-bearings.uiua b/Task/Angle-difference-between-two-bearings/Uiua/angle-difference-between-two-bearings.uiua new file mode 100644 index 0000000000..7d01db2c61 --- /dev/null +++ b/Task/Angle-difference-between-two-bearings/Uiua/angle-difference-between-two-bearings.uiua @@ -0,0 +1,7 @@ +Wrap ← ◌◌⍢(⊙⟜+|<⊙⋅∘)⊙◌⊢⟜(⍢(⊙⟜-|>⊙⋅∘)⊣)⟜/- +Diff ← Wrap [¯180 180]/- +[20_45 ¯45_45 ¯85_90 ¯95_90 ¯45_125 ¯45_145 29.4803_¯88.6381 ¯78.3251_¯159.036] +≡(⁅₃Diff) +[¯70099.7423_29840.6744 ¯165313.6666_33693.9895 + 1174.8381_¯154146.6649 60175.7731_42213.0719] +≡(⁅₃Diff) diff --git a/Task/Angles-geometric-normalization-and-conversion/ALGOL-68/angles-geometric-normalization-and-conversion.alg b/Task/Angles-geometric-normalization-and-conversion/ALGOL-68/angles-geometric-normalization-and-conversion.alg new file mode 100644 index 0000000000..23e6245b75 --- /dev/null +++ b/Task/Angles-geometric-normalization-and-conversion/ALGOL-68/angles-geometric-normalization-and-conversion.alg @@ -0,0 +1,64 @@ +BEGIN # Angles (geometric), normalization and conversion - translated from the 11l sample # + + []REAL values = ( -2, -1, 0, 1, 2, 6.2831853, 16, 57.2957795, 359, 399, 6399, 1000000 ); + + PROC norm = ( REAL x, y )REAL: + BEGIN + INT n = ENTIER ( ABS x / ABS y ); + REAL r := x - ( n * y ); + r + END # norm # ; + + PROC normd = ( REAL x )REAL: norm( x, 360 ); + PROC normg = ( REAL x )REAL: norm( x, 400 ); + PROC normm = ( REAL x )REAL: norm( x, 6400 ); + PROC normr = ( REAL x )REAL: norm( x, 2 * pi ); + + PROC d2g = ( REAL x )REAL: normd( x ) * 10 / 9; + PROC d2m = ( REAL x )REAL: normd( x ) * 160 / 9; + PROC d2r = ( REAL x )REAL: normd( x ) * pi / 180; + + PROC g2d = ( REAL x )REAL: normg( x ) * 9 / 10; + PROC g2m = ( REAL x )REAL: normg( x ) * 16; + PROC g2r = ( REAL x )REAL: normg( x ) * pi / 200; + + PROC m2d = ( REAL x )REAL: normm( x ) * 9 / 160; + PROC m2g = ( REAL x )REAL: normm( x ) / 16; + PROC m2r = ( REAL x )REAL: normm( x ) * pi / 3200; + + PROC r2d = ( REAL x )REAL: normr( x ) * 180 / pi; + PROC r2g = ( REAL x )REAL: normr( x ) * 200 / pi; + PROC r2m = ( REAL x )REAL: normr( x ) * 3200 / pi; + + STRING underline = "----------------------------------------------------------------------------------"; + PROC f7d7 = ( REAL v )STRING: fixed( v, -15, 7 ); + + PROC print values = ( STRING heading, []PROC(REAL)REAL f )VOID: + BEGIN + print( ( heading, newline ) ); + print( ( underline, newline ) ); + FOR i FROM LWB values TO UPB values DO + REAL v = values[ i ]; + print( ( f7d7( v ) ) ); + FOR p FROM LWB f TO UPB f DO + print( ( " ", f7d7( f[ p ]( v ) ) ) ) + OD; + print( ( newline ) ) + OD; + print( ( newline ) ) + END # print values # ; + + print values( " Degrees Normalized Gradians Mils Radians" + , ( normd, d2g, d2m, d2r ) + ); + print values( " Gradians Normalized Degrees Mils Radians" + , ( normg, g2d, g2m, g2r ) + ); + print values( " Mils Normalized Degrees Gradians Radians" + , ( normm, m2d, m2g, m2r ) + ); + print values( " Radians Normalized Degrees Gradians Mils" + , ( normr, r2d, r2g, r2m ) + ) + +END diff --git a/Task/Angles-geometric-normalization-and-conversion/ALGOL-W/angles-geometric-normalization-and-conversion.alg b/Task/Angles-geometric-normalization-and-conversion/ALGOL-W/angles-geometric-normalization-and-conversion.alg new file mode 100644 index 0000000000..c26879adba --- /dev/null +++ b/Task/Angles-geometric-normalization-and-conversion/ALGOL-W/angles-geometric-normalization-and-conversion.alg @@ -0,0 +1,71 @@ +begin % Angles (geometric), normalization and conversion % + % - translation of the Algol 68 translation of the 11l sample % + + real procedure norm ( real value x, y ) ; + begin + integer n; + n := entier( abs x / abs y ); + x - ( n * y ) + end norm ; + + real procedure normd ( real value x ) ; norm( x, 360 ); + real procedure normg ( real value x ) ; norm( x, 400 ); + real procedure normm ( real value x ) ; norm( x, 6400 ); + real procedure normr ( real value x ) ; norm( x, 2 * pi ); + + real procedure d2g ( real value x ) ; normd( x ) * 10 / 9; + real procedure d2m ( real value x ) ; normd( x ) * 160 / 9; + real procedure d2r ( real value x ) ; normd( x ) * pi / 180; + + real procedure g2d ( real value x ) ; normg( x ) * 9 / 10; + real procedure g2m ( real value x ) ; normg( x ) * 16; + real procedure g2r ( real value x ) ; normg( x ) * pi / 200; + + real procedure m2d ( real value x ) ; normm( x ) * 9 / 160; + real procedure m2g ( real value x ) ; normm( x ) / 16; + real procedure m2r ( real value x ) ; normm( x ) * pi / 3200; + + real procedure r2d ( real value x ) ; normr( x ) * 180 / pi; + real procedure r2g ( real value x ) ; normr( x ) * 200 / pi; + real procedure r2m ( real value x ) ; normr( x ) * 3200 / pi; + + procedure writeonF7d7 ( real value v ) ; writeon( r_format := "A", r_w := 15, r_d := 7, s_w := 0, v ); + + procedure printValues ( string(82) value heading + ; real procedure f1, f2, f3, f4 + ; real array values( * ) + ; integer value numberOfValues + ) ; + begin + write( heading ); + write( "----------------------------------------------------------------------------------" ); + for i := 1 until numberOfValues do begin + real v; + v := values( i ); + write(); + writeonF7d7( v ); + writeon( " " ); writeonF7d7( f1( v ) ); writeon( " " ); writeonF7d7( f2( v ) ); + writeon( " " ); writeonF7d7( f3( v ) ); writeon( " " ); writeonF7d7( f4( v ) ); + end for_i ; + write() + end printValues ; + + real array values ( 1 :: 12 ); + values( 1 ) := -2; values( 2 ) := -1; values( 3 ) := 0; values( 4 ) := 1; values( 5 ) := 2; + values( 6 ) := 6.2831853; values( 7 ) := 16; values( 8 ) := 57.2957795; values( 9 ) := 359; + values( 10 ) := 399; values( 11 ) := 6399; values( 12 ) := 1000000; + + printValues( " Degrees Normalized Gradians Mils Radians" + , normd, d2g, d2m, d2r, values, 12 + ); + printValues( " Gradians Normalized Degrees Mils Radians" + , normg, g2d, g2m, g2r, values, 12 + ); + printValues( " Mils Normalized Degrees Gradians Radians" + , normm, m2d, m2g, m2r, values, 12 + ); + printValues( " Radians Normalized Degrees Gradians Mils" + , normr, r2d, r2g, r2m, values, 12 + ) + +end. diff --git a/Task/Angles-geometric-normalization-and-conversion/Ada/angles-geometric-normalization-and-conversion.adb b/Task/Angles-geometric-normalization-and-conversion/Ada/angles-geometric-normalization-and-conversion.adb new file mode 100644 index 0000000000..b63341ec27 --- /dev/null +++ b/Task/Angles-geometric-normalization-and-conversion/Ada/angles-geometric-normalization-and-conversion.adb @@ -0,0 +1,226 @@ +-- Rosetta Code Task written in Ada +-- Angles (geometric), normalization and conversion +-- https://rosettacode.org/wiki/Angles_(geometric),_normalization_and_conversion +-- translation from C (conversion functions) and (loosely) Lua (output table formatting) +-- July 2024, R. B. E. + +-- To Do: +-- Specific float format/precision rather than generic? + +with Ada.Text_IO; use Ada.Text_IO; +with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; +with Ada.Float_Text_IO; use Ada.Float_Text_IO; +with Ada.Strings.Fixed; use Ada.Strings.Fixed; +with Ada.Numerics; + +procedure Angles_Geometric_Normalization_and_Conversion is + Pi : constant := Ada.Numerics.Pi; + Two_Pi : constant := 2.0 * Ada.Numerics.Pi; + + function Normalize_to_Deg (a : Float) return Float is + tmp : Float := a; + begin +-- while (tmp < 0.0) loop + while (tmp < -360.0) loop -- task description says to preserve negative input angles + tmp := tmp + 360.0; + end loop; + while (tmp >= 360.0) loop + tmp := tmp - 360.0; + end loop; + return tmp; + end Normalize_to_Deg; + + function Normalize_to_Grad (a : Float) return Float is + tmp : Float := a; + begin + while (tmp < 0.0) loop -- task description says to preserve negative input angles (punting) + tmp := tmp + 400.0; + end loop; + while (tmp >= 400.0) loop + tmp := tmp - 400.0; + end loop; + return tmp; + end Normalize_to_Grad; + + function Normalize_to_Mil (a : Float) return Float is + tmp : Float := a; + begin + while (tmp < 0.0) loop -- task description says to preserve negative input angles (punting) + tmp := tmp + 6400.0; + end loop; + while (tmp >= 6400.0) loop + tmp := tmp - 6400.0; + end loop; + return tmp; + end Normalize_to_Mil; + + function Normalize_to_Rad (a : Float) return Float is + tmp : Float := a; + begin + while (tmp < 0.0) loop -- task description says to preserve negative input angles (punting) + tmp := tmp + Two_Pi; + end loop; + while (tmp >= Two_Pi) loop + tmp := tmp - Two_Pi; + end loop; + return tmp; + end Normalize_to_Rad; + + function Deg_to_Grad (a : Float) return Float is + tmp : Float := a; + begin + tmp := a * (10.0 / 9.0); + return tmp; + end Deg_to_Grad; + + function Deg_to_Mil (a : Float) return Float is + tmp : Float := a; + begin + tmp := a * (160.0 / 9.0); + return tmp; + end Deg_to_Mil; + + function Deg_to_Rad (a : Float) return Float is + tmp : Float := a; + begin + tmp := a * (Pi / 180.0); + return tmp; + end Deg_to_Rad; + + function Grad_to_Deg (a : Float) return Float is + tmp : Float := a; + begin + tmp := a * (9.0 / 10.0); + return tmp; + end Grad_to_Deg; + + function Grad_to_Mil (a : Float) return Float is + tmp : Float := a; + begin + tmp := a * 16.0; + return tmp; + end Grad_to_Mil; + + function Grad_to_Rad (a : Float) return Float is + tmp : Float := a; + begin + tmp := a * (Pi / 200.0); + return tmp; + end Grad_to_Rad; + + function Mil_to_Deg (a : Float) return Float is + tmp : Float := a; + begin + tmp := a * (9.0 / 160.0); + return tmp; + end Mil_to_Deg; + + function Mil_to_Grad (a : Float) return Float is + tmp : Float := a; + begin + tmp := a / 16.0; + return tmp; + end Mil_to_Grad; + + function Mil_to_Rad (a : Float) return Float is + tmp : Float := a; + begin + tmp := a * (Pi / 3200.0); + return tmp; + end Mil_to_Rad; + + function Rad_to_Deg (a : Float) return Float is + tmp : Float := a; + begin + tmp := a * (180.0 / Pi); + return tmp; + end Rad_to_Deg; + + function Rad_to_Grad (a : Float) return Float is + tmp : Float := a; + begin + tmp := a * (200.0 / Pi); + return tmp; + end Rad_to_Grad; + + function Rad_to_Mil (a : Float) return Float is + tmp : Float := a; + begin + tmp := a * (3200.0 / Pi); + return tmp; + end Rad_to_Mil; + + Three_Spaces : constant String := 3 * " "; + + type Index is range 1 .. 12; + type Test_Values_Array is array (Index) of Float; + Test_Values : Test_Values_Array := + (Float (-2), Float (-1), Float (0), Float (1), Float (2), + 6.2831853, Float (16), 57.2957795, Float (359), + Float (399), Float (6399), Float (1000000)); + +begin + Put_Line (" DEGREES GRADIANS MILS RADIANS"); + Put_Line (" TEST VALUE Normalized Converted Converted Converted"); + for I in Index loop + Put (Test_Values (I), Exp => 0, Aft => 8, Fore => 8); + Put (Three_Spaces); + Put (Normalize_to_Deg (Test_Values (I)), Exp => 0, Aft => 8, Fore => 4); + Put (Three_Spaces); + Put (Deg_to_Grad (Normalize_to_Deg (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4); + Put (Three_Spaces); + Put (Deg_to_Mil (Normalize_to_Deg (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4); + Put (Three_Spaces); + Put (Deg_to_Rad (Normalize_to_Deg (Test_Values (I))), Exp => 0, Aft => 8, Fore => 2); + New_Line; + end loop; + + New_Line; + Put_Line (" GRADIANS MILS RADIANS DEGREES"); + Put_Line (" TEST VALUE Normalized Converted Converted Converted"); + for I in Index loop + Put (Test_Values (I), Exp => 0, Aft => 8, Fore => 8); + Put (Three_Spaces); + Put (Normalize_to_Grad (Test_Values (I)), Exp => 0, Aft => 8, Fore => 4); + Put (Three_Spaces); + Put (Grad_to_Mil (Normalize_to_Grad (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4); + Put (Three_Spaces); + Put (Grad_to_Rad (Normalize_to_Grad (Test_Values (I))), Exp => 0, Aft => 8, Fore => 2); + Put (Three_Spaces); + Put (Grad_to_Deg (Normalize_to_Grad (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4); + New_Line; + end loop; + + New_Line; + Put_Line (" MILS RADIANS DEGREES GRADIANS"); + Put_Line (" TEST VALUE Normalized Converted Converted Converted"); + for I in Index loop + Put (Test_Values (I), Exp => 0, Aft => 8, Fore => 8); + Put (Three_Spaces); + Put (Normalize_to_Mil (Test_Values (I)), Exp => 0, Aft => 8, Fore => 4); + Put (Three_Spaces); + Put (Mil_to_Rad (Normalize_to_Mil (Test_Values (I))), Exp => 0, Aft => 8, Fore => 2); + Put (Three_Spaces); + Put (Mil_to_Deg (Normalize_to_Mil (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4); + Put (Three_Spaces); + Put (Mil_to_Grad (Normalize_to_Mil (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4); + New_Line; + end loop; + + New_Line; + Put_Line (" RADIANS DEGREES GRADIANS MILS"); + Put_Line (" TEST VALUE Normalized Converted Converted Converted"); + for I in Index loop + Put (Test_Values (I), Exp => 0, Aft => 8, Fore => 8); + Put (Three_Spaces); + Put (Normalize_to_Rad (Test_Values (I)), Exp => 0, Aft => 8, Fore => 4); + Put (Three_Spaces); + Put (Rad_to_Deg (Normalize_to_Rad (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4); + Put (Three_Spaces); + Put (Rad_to_Grad (Normalize_to_Rad (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4); + Put (Three_Spaces); + Put (Rad_to_Mil (Normalize_to_Rad (Test_Values (I))), Exp => 0, Aft => 8, Fore => 4); + New_Line; + end loop; + +end Angles_Geometric_Normalization_and_Conversion; diff --git a/Task/Angles-geometric-normalization-and-conversion/BBC-BASIC/angles-geometric-normalization-and-conversion.basic b/Task/Angles-geometric-normalization-and-conversion/BBC-BASIC/angles-geometric-normalization-and-conversion.basic new file mode 100644 index 0000000000..68ffd3c045 --- /dev/null +++ b/Task/Angles-geometric-normalization-and-conversion/BBC-BASIC/angles-geometric-normalization-and-conversion.basic @@ -0,0 +1,41 @@ + MODE 15 REM Suitable sized output window so that all output fits neatly + DEF FNMod(a, b) WHILE a >= b a-=b ENDWHILE =a REM Floating point mod + + DEF FNd2d(a) = FNMod(a, 360) + DEF FNg2g(a) = FNMod(a, 400) + DEF FNm2m(a) = FNMod(a, 6400) + DEF FNr2r(a) = FNMod(a, 2 * PI) + + DEF FNd2g(a) = FNd2d(a) * 10 / 9 + DEF FNd2m(a) = FNd2d(a) * 160 / 9 + DEF FNd2r(a) = RAD(FNd2d(a)) + + DEF FNg2d(a) = FNg2g(a) * 9 / 10 + DEF FNg2m(a) = FNg2g(a) * 16 + DEF FNg2r(a) = FNg2g(a) * PI / 200 + + DEF FNm2d(a) = FNm2m(a) * 9 / 160 + DEF FNm2g(a) = FNm2m(a) / 16 + DEF FNm2r(a) = FNm2m(a) * PI / 3200 + + DEF FNr2d(a) = DEG(FNr2r(a)) + DEF FNr2g(a) = FNr2r(a) * 200 / PI + DEF FNr2m(a) = FNr2r(a) * 3200 / PI + + @%=&02070F + Dash75$=STRING$(75, "-") + + PRINT TAB(0, 0) " Degrees Normalized Gradians Mils Radians"'Dash75$ + PRINT TAB(0, 15) " Gradians Normalized Degrees Mils Radians"'Dash75$ + PRINT TAB(0, 30) " Mils Normalized Degrees Gradians Radians"'Dash75$ + PRINT TAB(0, 45) " Radians Normalized Degrees Gradians Mils "'Dash75$ + + FOR I%=1 TO 12 + READ Angle + PRINT TAB(0, 1+I%) Angle, FNd2d(Angle), FNd2g(Angle), FNd2m(Angle), FNd2r(Angle) + PRINT TAB(0, 16+I%) Angle, FNg2g(Angle), FNg2d(Angle), FNg2m(Angle), FNg2r(Angle) + PRINT TAB(0, 31+I%) Angle, FNm2m(Angle), FNm2d(Angle), FNm2g(Angle), FNm2r(Angle) + PRINT TAB(0, 46+I%) Angle, FNr2r(Angle), FNr2d(Angle), FNr2g(Angle), FNr2m(Angle) + NEXT + + DATA -2, -1, 0, 1, 2, 6.2831853, 16, 57.2957795, 359, 399, 6399, 1000000 diff --git a/Task/Angles-geometric-normalization-and-conversion/Crystal/angles-geometric-normalization-and-conversion.cr b/Task/Angles-geometric-normalization-and-conversion/Crystal/angles-geometric-normalization-and-conversion.cr new file mode 100644 index 0000000000..e3f6f91d51 --- /dev/null +++ b/Task/Angles-geometric-normalization-and-conversion/Crystal/angles-geometric-normalization-and-conversion.cr @@ -0,0 +1,32 @@ +def d2d (a) a % 360 end +def g2g (a) a % 400 end +def m2m (a) a % 6400 end +def r2r (a) a.to_f % (2*Math::PI) end + +def d2g (a) d2d(a)/360 * 400 end +def d2m (a) d2d(a)/360 * 6400 end +def d2r (a) d2d(a)/360 * 2*Math::PI end + +def g2d (a) g2g(a)/400 * 360 end +def g2m (a) g2g(a)/400 * 6400 end +def g2r (a) g2g(a)/400 * 2*Math::PI end + +def m2d (a) m2m(a)/6400 * 360 end +def m2g (a) m2m(a)/6400 * 400 end +def m2r (a) m2m(a)/6400 * 2*Math::PI end + +def r2d (a) r2r(a)/(2*Math::PI) * 360 end +def r2g (a) r2r(a)/(2*Math::PI) * 400 end +def r2m (a) r2r(a)/(2*Math::PI) * 6400 end + +angles = [-2, -1, 0, 1, 2, 6.2831853, 16, 57.2957795, 359, 399, 6399, 1000000] + +puts "%-12s %-8s %12s %12s %12s %12s" % {"Angle", "Unit", "Degrees", "Gradians", "Mils", "Radians"} +puts "-"*(12+8+12+12+12+12+5) +angles.each do |a| + puts "%-12g %-8s %12g %12g %12g %12g" % {a, "degrees", d2d(a), d2g(a), d2m(a), d2r(a) } + puts "%-12g %-8s %12g %12g %12g %12g" % {a, "gradians", g2d(a), g2g(a), g2m(a), g2r(a) } + puts "%-12g %-8s %12g %12g %12g %12g" % {a, "mils", m2d(a), m2g(a), m2m(a), m2r(a) } + puts "%-12g %-8s %12g %12g %12g %12g" % {a, "radians", r2d(a), r2g(a), r2m(a), r2r(a) } + puts +end diff --git a/Task/Angles-geometric-normalization-and-conversion/Delphi/angles-geometric-normalization-and-conversion.delphi b/Task/Angles-geometric-normalization-and-conversion/Delphi/angles-geometric-normalization-and-conversion.pas similarity index 100% rename from Task/Angles-geometric-normalization-and-conversion/Delphi/angles-geometric-normalization-and-conversion.delphi rename to Task/Angles-geometric-normalization-and-conversion/Delphi/angles-geometric-normalization-and-conversion.pas diff --git a/Task/Angles-geometric-normalization-and-conversion/EasyLang/angles-geometric-normalization-and-conversion.easy b/Task/Angles-geometric-normalization-and-conversion/EasyLang/angles-geometric-normalization-and-conversion.easy index 546d276c89..2a63ef3ad8 100644 --- a/Task/Angles-geometric-normalization-and-conversion/EasyLang/angles-geometric-normalization-and-conversion.easy +++ b/Task/Angles-geometric-normalization-and-conversion/EasyLang/angles-geometric-normalization-and-conversion.easy @@ -27,7 +27,7 @@ func$ fmt s$ . # scales$[] = [ "degree" "gradian" "mil" "radian" ] values[] = [ -2 -1 0 1 2 6.2831853 16 57.2957795 359 399 6399 1000000 ] -numfmt 3 10 +numfmt 10 3 for f$ in scales$[] write fmt f$ for t$ in scales$[] diff --git a/Task/Angles-geometric-normalization-and-conversion/FutureBasic/angles-geometric-normalization-and-conversion.basic b/Task/Angles-geometric-normalization-and-conversion/FutureBasic/angles-geometric-normalization-and-conversion.basic new file mode 100644 index 0000000000..df05b07e41 --- /dev/null +++ b/Task/Angles-geometric-normalization-and-conversion/FutureBasic/angles-geometric-normalization-and-conversion.basic @@ -0,0 +1,100 @@ +include "NSLog.incl" + +double local fn Normalize( f as double, n as double ) + double a = f + while ( a < -n ) : a += n : wend + while ( a >= n ) : a -= n : wend +end fn = a + +double local fn NormalizeToDegrees( f as double ) return fn Normalize( f, 360 ) end fn = 0.0 +double local fn NormalizeToGradians( f as double ) return fn Normalize( f, 400 ) end fn = 0.0 +double local fn NormalizeToMils( f as double ) return fn Normalize( f, 6400 ) end fn = 0.0 +double local fn NormalizeToRadians( f as double ) return fn Normalize( f, 2 * M_PI ) end fn = 0.0 + +double local fn d2g( f as double ) return f * 10 / 9 end fn = 0.0 +double local fn d2m( f as double ) return f * 160 / 9 end fn = 0.0 +double local fn d2r( f as double ) return f * M_PI / 180 end fn = 0.0 + +double local fn g2d( f as double ) return f * 9 / 10 end fn = 0.0 +double local fn g2m( f as double ) return f * 16 end fn = 0.0 +double local fn g2r( f as double ) return f * M_PI / 200 end fn = 0.0 + +double local fn m2d( f as double ) return f * 9 / 160 end fn = 0.0 +double local fn m2g( f as double ) return f / 16 end fn = 0.0 +double local fn m2r( f as double ) return f * M_PI / 3200 end fn = 0.0 + +double local fn r2d( f as double ) return f * 180 / M_PI end fn = 0.0 +double local fn r2g( f as double ) return f * 200 / M_PI end fn = 0.0 +double local fn r2m( f as double ) return f * 3200 / M_PI end fn = 0.0 + +local fn CalculateDegrees + CFArrayRef angles = @[@-2, @-1, @0, @1, @2, @6.2831853, @16, @57.2957795, @359, @6399, @1000000] + double angle, degrees, gradians, mils, radians + NSUInteger i + CFStringRef unit + CFStringRef dashpad = fn StringByPaddingToLength( @"", 73, @"-", 0 ) + + ptr anglePtr = fn StringUTF8String( @"Angle" ) + ptr unitPtr = fn StringUTF8String( @"Unit" ) + ptr normalPtr = fn StringUTF8String( @"Normalized" ) + ptr gradiansPtr = fn StringUTF8String( @"Gradians" ) + ptr milsPtr = fn StringUTF8String( @"Mils" ) + ptr radiansPtr = fn StringUTF8String( @"Radians" ) + + // Header + NSLog( @"\n%@", dashpad ) + NSLog( @"%13s %5s %15s %10s %7s %15s", anglePtr, unitPtr, normalPtr, gradiansPtr, milsPtr, radiansPtr ) + NSLog( @"%@", dashpad ) + + // Degrees + for i = 0 to fn ArrayCount( angles ) - 1 + angle = dblval( angles[i] ) + unit = @"Degrees" + degrees = fn NormalizeToDegrees( angle ) + gradians = fn NormalizeToGradians( fn d2g( degrees ) ) + mils = fn NormalizeToMils( fn d2m( degrees ) ) + radians = fn NormalizeToRadians( fn d2r( degrees ) ) + NSLog( @"%13.4f %-10s % -12.4f % -11.4f % -12.4f % -13.4f", angle, fn StringUTF8String( unit ), degrees, gradians, mils, radians ) + next + NSLog( @"" ) + + // Gradians + for i = 0 to fn ArrayCount( angles ) - 1 + angle = dblval( angles[i] ) + unit = @"Gradians" + gradians = fn NormalizeToGradians( angle ) + degrees = fn NormalizeToDegrees( fn g2d( gradians ) ) + mils = fn NormalizeToMils( fn g2m( gradians ) ) + radians = fn NormalizeToRadians( fn g2r( gradians ) ) + NSLog( @"%13.4f %-10s % -12.4f % -11.4f % -12.4f % -13.4f", angle, fn StringUTF8String( unit ), degrees, gradians, mils, radians ) + next + NSLog( @"" ) + + // Mils + for i = 0 to fn ArrayCount( angles ) - 1 + angle = dblval( angles[i] ) + unit = @"Mils" + mils = fn NormalizeToMils( angle ) + degrees = fn NormalizeToDegrees( fn m2d( mils ) ) + gradians = fn NormalizeToGradians( fn m2g( mils ) ) + radians = fn NormalizeToRadians( fn m2r( mils ) ) + NSLog( @"%13.4f %-10s % -12.4f % -11.4f % -12.4f % -13.4f", angle, fn StringUTF8String( unit ), degrees, gradians, mils, radians ) + next + NSLog( @"" ) + + // Radians + for i = 0 to fn ArrayCount( angles ) - 1 + angle = dblval( angles[i] ) + unit = @"Radians" + radians = fn NormalizeToRadians( angle ) + degrees = fn NormalizeToDegrees( fn r2d( radians ) ) + gradians = fn NormalizeToGradians( fn r2g( radians ) ) + mils = fn NormalizeToMils( fn r2m( radians ) ) + NSLog( @"%13.4f %-10s % -12.4f % -11.4f % -12.4f % -13.4f", angle, fn StringUTF8String( unit ), degrees, gradians, mils, radians ) + next + NSLog( @"%@", dashpad ) +end fn + +fn CalculateDegrees + +HandleEvents diff --git a/Task/Angles-geometric-normalization-and-conversion/Julia/angles-geometric-normalization-and-conversion.julia b/Task/Angles-geometric-normalization-and-conversion/Julia/angles-geometric-normalization-and-conversion.jl similarity index 100% rename from Task/Angles-geometric-normalization-and-conversion/Julia/angles-geometric-normalization-and-conversion.julia rename to Task/Angles-geometric-normalization-and-conversion/Julia/angles-geometric-normalization-and-conversion.jl diff --git a/Task/Angles-geometric-normalization-and-conversion/Kotlin/angles-geometric-normalization-and-conversion.kotlin b/Task/Angles-geometric-normalization-and-conversion/Kotlin/angles-geometric-normalization-and-conversion.kts similarity index 100% rename from Task/Angles-geometric-normalization-and-conversion/Kotlin/angles-geometric-normalization-and-conversion.kotlin rename to Task/Angles-geometric-normalization-and-conversion/Kotlin/angles-geometric-normalization-and-conversion.kts diff --git a/Task/Angles-geometric-normalization-and-conversion/PascalABC.NET/angles-geometric-normalization-and-conversion.pas b/Task/Angles-geometric-normalization-and-conversion/PascalABC.NET/angles-geometric-normalization-and-conversion.pas new file mode 100644 index 0000000000..a0c4a80b2e --- /dev/null +++ b/Task/Angles-geometric-normalization-and-conversion/PascalABC.NET/angles-geometric-normalization-and-conversion.pas @@ -0,0 +1,41 @@ +function fmod(x, y: real): real := x - trunc(x / y) * y; + +function d2d(x: real): real := fmod(x, 360); +function g2g(x: real): real := fmod(x, 400); +function m2m(x: real): real := fmod(x, 6400); +function r2r(x: real): real := fmod(x, 2 * Pi); +function d2g(x: real): real := d2d(x) * 10 / 9; +function d2m(x: real): real := d2d(x) * 160 / 9; +function d2r(x: real): real := d2d(x) * Pi / 180; +function g2d(x: real): real := g2g(x) * 9 / 10; +function g2m(x: real): real := g2g(x) * 16; +function g2r(x: real): real := g2g(x) * Pi / 200; +function m2d(x: real): real := m2m(x) * 9 / 160; +function m2g(x: real): real := m2m(x) / 16; +function m2r(x: real): real := m2m(x) * Pi / 3200; +function r2d(x: real): real := r2r(x) * 180 / Pi; +function r2g(x: real): real := r2r(x) * 200 / Pi; +function r2m(x: real): real := r2r(x) * 3200 / Pi; + +begin + var Values: array of real := (-2, -1, 0, 1, 2, 6.2831853, 16, 57.2957795, 359, 399, 6399, 1000000); + writeln(' Degrees Normalized Gradians Mils Radians'); + writeln('———————————————————————————————————————————————————————————————————————————'); + foreach var val in Values do + writeln(val:15:7, d2d(val):15:7, d2g(val):15:7, d2m(val):15:7, d2r(val):15:7); + writeln; + writeln( ' Gradians Normalized Degrees Mils Radians'); + writeln( '———————————————————————————————————————————————————————————————————————————'); + foreach var val in Values do + writeln( val:15:7, g2g(val):15:7, g2d(val):15:7, g2m(val):15:7, g2r(val):15:7); + writeln; + writeln( ' Mils Normalized Degrees Gradians Radians'); + writeln( '———————————————————————————————————————————————————————————————————————————'); + foreach var val in Values do + writeln( val:15:7, m2m(val):15:7, m2d(val):15:7, m2g(val):15:7, m2r(val):15:7); + writeln; + writeln( ' Radians Normalized Degrees Gradians Mils'); + writeln( '———————————————————————————————————————————————————————————————————————————'); + foreach var val in Values do + writeln( val:15:7, r2r(val):15:7, r2d(val):15:7, r2g(val):15:7, r2m(val):15:7); +end. diff --git a/Task/Angles-geometric-normalization-and-conversion/Phix/angles-geometric-normalization-and-conversion.phix b/Task/Angles-geometric-normalization-and-conversion/Phix/angles-geometric-normalization-and-conversion.phix index 8bc44820c3..20520e7c70 100644 --- a/Task/Angles-geometric-normalization-and-conversion/Phix/angles-geometric-normalization-and-conversion.phix +++ b/Task/Angles-geometric-normalization-and-conversion/Phix/angles-geometric-normalization-and-conversion.phix @@ -1,21 +1,20 @@ ---> - constant units = {"degrees","gradians","mils","radians"}, - turns = {1/360,1/400,1/6400,0.5/PI} +with javascript_semantics +constant units = {"degrees","gradians","mils","radians"}, + turns = {1/360,1/400,1/6400,0.5/PI} - function convert(atom a, integer fdx, tdx) - return remainder(a*turns[fdx],1)/turns[tdx] - end function +function convert(atom a, unit, tgt) + return remainder(a*unit,1)/tgt +end function - constant tests = {-2,-1,0,1,2,2*PI,16,57.2957795,359,399,6399,1000000} - printf(1," angle unit %9s %9s %9s %9s\n",units) - for i=1 to length(tests) do - for fdx=1 to length(units) do - printf(1,"%9g %-8s",{tests[i],units[fdx]}) - for tdx=1 to length(units) do - printf(1," %9g",convert(tests[i],fdx,tdx)) - end for - puts(1,"\n") - end for - puts(1,"\n") - end for - count of proper divisors. 1-->1, wrong but OK here { [1.. (n + 1)/2 + 1].reduce('wrap(p,i){ p + (n%i==0 and n!=i) }) } -fcn antiPrimes{ // -->iterator +fcn antiPrimes{ // -->iterator Walker.chain([2..59],[60..*,30]).tweak(fcn(c,rlast){ last,mx := rlast.value, properDivsN(c); if(mx<=last) return(Void.Skip); rlast.set(mx); c - }.fp1(Ref(0))).push(1); // 1 has no proper divisors + }.fp1(Ref(0))).push(1); // 1 has no proper divisors } diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/Ada/append-a-record-to-the-end-of-a-text-file.ada b/Task/Append-a-record-to-the-end-of-a-text-file/Ada/append-a-record-to-the-end-of-a-text-file.adb similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/Ada/append-a-record-to-the-end-of-a-text-file.ada rename to Task/Append-a-record-to-the-end-of-a-text-file/Ada/append-a-record-to-the-end-of-a-text-file.adb diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/COBOL/append-a-record-to-the-end-of-a-text-file.cobol b/Task/Append-a-record-to-the-end-of-a-text-file/COBOL/append-a-record-to-the-end-of-a-text-file.cob similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/COBOL/append-a-record-to-the-end-of-a-text-file.cobol rename to Task/Append-a-record-to-the-end-of-a-text-file/COBOL/append-a-record-to-the-end-of-a-text-file.cob diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/Crystal/append-a-record-to-the-end-of-a-text-file.cr b/Task/Append-a-record-to-the-end-of-a-text-file/Crystal/append-a-record-to-the-end-of-a-text-file.cr new file mode 100644 index 0000000000..c4dd275431 --- /dev/null +++ b/Task/Append-a-record-to-the-end-of-a-text-file/Crystal/append-a-record-to-the-end-of-a-text-file.cr @@ -0,0 +1,36 @@ +record PasswdEntry, account : String, password : String, uid : Int32, gid : Int32, + gecos : Gecos, directory : String, shell : String do + def to_s (io) + io << account << ":" << password << ":" << uid.to_s << ":" << gid.to_s << ":" + gecos.to_s(io) + io << ":" << directory << ":" << shell + end +end + +record Gecos, fullname : String, office : String, extension : String, homephone : String, email : String do + def to_s (io) + io << fullname << "," << office << "," << extension << "," + io << homephone << "," << email + end +end + +filename = "rosetta.passwd" + +File.open(filename, "w") do |f| + f.puts PasswdEntry.new("jsmith", "x", 1001, 1000, + Gecos.new("Joe Smith", "Room 1007", "(234)555-8917", "(234)555-0077", "jsmith@rosettacode.org"), + "/home/jsmith", "/bin/bash") + f.puts PasswdEntry.new("jdoe", "x", 1002, 1000, + Gecos.new("Jane Doe", "Room 1004", "(234)555-8914", "(234)555-0044", "jdoe@rosettacode.org"), + "/home/jdoe", "/bin/bash") +end + +File.open(filename, "a") do |f| + f.puts PasswdEntry.new("xyz", "x", 1003, 1000, + Gecos.new("X Yz", "Room 1003", "(234)555-8913", "(234)555-0033", "xyz@rosettacode.org"), + "/home/xyz", "/bin/bash") +end + +lines = File.read_lines(filename) + +puts "Appended record (##{lines.size}): " + lines.last diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/Ed/append-a-record-to-the-end-of-a-text-file.ed b/Task/Append-a-record-to-the-end-of-a-text-file/Ed/append-a-record-to-the-end-of-a-text-file.ed new file mode 100644 index 0000000000..596c084db6 --- /dev/null +++ b/Task/Append-a-record-to-the-end-of-a-text-file/Ed/append-a-record-to-the-end-of-a-text-file.ed @@ -0,0 +1,9 @@ +H +r append.input +,p +a +xyz:x:1003:1000:X Yz,Room 1003,(234)555-8913,(234)555-0033,xyz@rosettacode.org:/home/xyz:/bin/bash +. +w +,p +q diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/Elixir/append-a-record-to-the-end-of-a-text-file.elixir b/Task/Append-a-record-to-the-end-of-a-text-file/Elixir/append-a-record-to-the-end-of-a-text-file.ex similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/Elixir/append-a-record-to-the-end-of-a-text-file.elixir rename to Task/Append-a-record-to-the-end-of-a-text-file/Elixir/append-a-record-to-the-end-of-a-text-file.ex diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/Julia/append-a-record-to-the-end-of-a-text-file.julia b/Task/Append-a-record-to-the-end-of-a-text-file/Julia/append-a-record-to-the-end-of-a-text-file.jl similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/Julia/append-a-record-to-the-end-of-a-text-file.julia rename to Task/Append-a-record-to-the-end-of-a-text-file/Julia/append-a-record-to-the-end-of-a-text-file.jl diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/Kotlin/append-a-record-to-the-end-of-a-text-file.kotlin b/Task/Append-a-record-to-the-end-of-a-text-file/Kotlin/append-a-record-to-the-end-of-a-text-file.kts similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/Kotlin/append-a-record-to-the-end-of-a-text-file.kotlin rename to Task/Append-a-record-to-the-end-of-a-text-file/Kotlin/append-a-record-to-the-end-of-a-text-file.kts diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-1.psh b/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-1.ps1 similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-1.psh rename to Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-1.ps1 diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-2.psh b/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-2.ps1 similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-2.psh rename to Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-2.ps1 diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-3.psh b/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-3.ps1 similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-3.psh rename to Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-3.ps1 diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-4.psh b/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-4.ps1 similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-4.psh rename to Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-4.ps1 diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-5.psh b/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-5.ps1 similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-5.psh rename to Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-5.ps1 diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-6.psh b/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-6.ps1 similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-6.psh rename to Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-6.ps1 diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-7.psh b/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-7.ps1 similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-7.psh rename to Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-7.ps1 diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-8.psh b/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-8.ps1 similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-8.psh rename to Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-8.ps1 diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-9.psh b/Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-9.ps1 similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-9.psh rename to Task/Append-a-record-to-the-end-of-a-text-file/PowerShell/append-a-record-to-the-end-of-a-text-file-9.ps1 diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/Python/append-a-record-to-the-end-of-a-text-file.py b/Task/Append-a-record-to-the-end-of-a-text-file/Python/append-a-record-to-the-end-of-a-text-file.py index e21feece57..1951501c2c 100644 --- a/Task/Append-a-record-to-the-end-of-a-text-file/Python/append-a-record-to-the-end-of-a-text-file.py +++ b/Task/Append-a-record-to-the-end-of-a-text-file/Python/append-a-record-to-the-end-of-a-text-file.py @@ -1,48 +1,126 @@ -############################# -# Create a passwd text file -############################# -# note that UID & gid are of type "text" -passwd_list=[ - dict(account='jsmith', password='x', UID=1001, GID=1000, # UID and GID are type int - GECOS=dict(fullname='Joe Smith', office='Room 1007', extension='(234)555-8917', - homephone='(234)555-0077', email='jsmith@rosettacode.org'), - directory='/home/jsmith', shell='/bin/bash'), - dict(account='jdoe', password='x', UID=1002, GID=1000, - GECOS=dict(fullname='Jane Doe', office='Room 1004', extension='(234)555-8914', - homephone='(234)555-0044', email='jdoe@rosettacode.org'), - directory='/home/jdoe', shell='/bin/bash') +from __future__ import annotations + +import csv +from dataclasses import astuple +from dataclasses import dataclass +from io import StringIO +from pathlib import Path + +from filelock import FileLock + + +@dataclass +class Record: + account: str + password: str + UID: int + GID: int + GECOS: GECOS + directory: str + shell: str + + +@dataclass +class GECOS: + fullname: str + office: str + extension: str + homephone: str + email: str + + +PASSWDS = [ + Record( + "jsmith", + "x", + 1001, + 1000, + GECOS( + "Joe Smith", + "Room 1007", + "(234)555-8917", + "(234)555-0077", + "jsmith@rosettacode.org", + ), + "/home/jsmith", + "/bin/bash", + ), + Record( + "jdoe", + "x", + 1002, + 1000, + GECOS( + "Jane Doe", + "Room 1004", + "(234)555-8914", + "(234)555-0044", + "jdoe@rosettacode.org", + ), + "/home/jdoe", + "/bin/bash", + ), ] -passwd_fields="account password UID GID GECOS directory shell".split() -GECOS_fields="fullname office extension homephone email".split() -def passwd_text_repr(passwd_rec): -# convert individual fields to string type - passwd_rec["GECOS"]=",".join([ passwd_rec["GECOS"][field] for field in GECOS_fields]) - for field in passwd_rec: # convert "int" fields - if not isinstance(passwd_rec[field], str): - passwd_rec[field]=`passwd_rec[field]` - return ":".join([ passwd_rec[field] for field in passwd_fields ]) +class RecordDialect(csv.unix_dialect): + delimiter = ":" + quoting = csv.QUOTE_NONE -passwd_text=open("passwd.txt","w") -for passwd_rec in passwd_list: - print >> passwd_text,passwd_text_repr(passwd_rec) -passwd_text.close() -################################# -# Load text ready for appending -################################# -passwd_text=open("passwd.txt","a+") -new_rec=dict(account='xyz', password='x', UID=1003, GID=1000, - GECOS=dict(fullname='X Yz', office='Room 1003', extension='(234)555-8913', - homephone='(234)555-0033', email='xyz@rosettacode.org'), - directory='/home/xyz', shell='/bin/bash') -print >> passwd_text, passwd_text_repr(new_rec) -passwd_text.close() +class GECOSDialect(RecordDialect): + delimiter = "," + lineterminator = "" -############################################## -# Finally reopen and check record was appended -############################################## -passwd_list=list(open("passwd.txt","r")) -if "xyz" in passwd_list[-1]: - print "Appended record:",passwd_list[-1][:-1] + +def row(record: Record) -> list[str | int]: + gecos_buffer = StringIO() + gecos_writer = csv.writer(gecos_buffer, dialect=GECOSDialect) + gecos_writer.writerow(astuple(record.GECOS)) + + return [ + record.account, + record.password, + record.UID, + record.GID, + gecos_buffer.getvalue(), + record.directory, + record.shell, + ] + + +if __name__ == "__main__": + path = Path("passwd.txt") + lock = FileLock("passwd.txt.lock") + + with lock: + with path.open("w") as fd: + record_writer = csv.writer(fd, dialect=RecordDialect) + record_writer.writerows(row(r) for r in PASSWDS) + + with lock: + print(f"Before append:\n\n{path.read_text()}") + + new_record = Record( + "xyz", + "x", + 1003, + 1001, + GECOS( + "X Yz", + "Room 1003", + "(234)555-8913", + "(234)555-0033", + "xyz@rosettacode.org", + ), + "/home/xyz", + "/bin/bash", + ) + + with lock: + with path.open("a") as fd: + record_writer = csv.writer(fd, dialect=RecordDialect) + record_writer.writerow(row(new_record)) + + with lock: + print(f"After append:\n\n{path.read_text()}") diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/Rust/append-a-record-to-the-end-of-a-text-file.rust b/Task/Append-a-record-to-the-end-of-a-text-file/Rust/append-a-record-to-the-end-of-a-text-file.rs similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/Rust/append-a-record-to-the-end-of-a-text-file.rust rename to Task/Append-a-record-to-the-end-of-a-text-file/Rust/append-a-record-to-the-end-of-a-text-file.rs diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/Scheme/append-a-record-to-the-end-of-a-text-file.ss b/Task/Append-a-record-to-the-end-of-a-text-file/Scheme/append-a-record-to-the-end-of-a-text-file.scm similarity index 100% rename from Task/Append-a-record-to-the-end-of-a-text-file/Scheme/append-a-record-to-the-end-of-a-text-file.ss rename to Task/Append-a-record-to-the-end-of-a-text-file/Scheme/append-a-record-to-the-end-of-a-text-file.scm diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/Swift/append-a-record-to-the-end-of-a-text-file-1.swift b/Task/Append-a-record-to-the-end-of-a-text-file/Swift/append-a-record-to-the-end-of-a-text-file-1.swift new file mode 100644 index 0000000000..cb306f4c37 --- /dev/null +++ b/Task/Append-a-record-to-the-end-of-a-text-file/Swift/append-a-record-to-the-end-of-a-text-file-1.swift @@ -0,0 +1,34 @@ +import Foundation + +func appendPasswd( + account: String, + passwd: String, + uid: Int, + gid: Int, + bio: String, + home: String, + shell: String +) { + let str = [ + account, + passwd, + String(uid), + String(gid), + bio, + home, + shell + ].joined(separator: ":").appending("\n") + guard let data = str.data(using: .utf8) else { return } + let url = URL(fileURLWithPath: "./passwd") + do { + if let fileHandle = try? FileHandle(forWritingTo: url) { + fileHandle.seekToEndOfFile() + fileHandle.write(data) + try? fileHandle.close() + } else { + try data.write(to: url) + } + } catch { + print(error) + } +} diff --git a/Task/Append-a-record-to-the-end-of-a-text-file/Swift/append-a-record-to-the-end-of-a-text-file-2.swift b/Task/Append-a-record-to-the-end-of-a-text-file/Swift/append-a-record-to-the-end-of-a-text-file-2.swift new file mode 100644 index 0000000000..4995452ef9 --- /dev/null +++ b/Task/Append-a-record-to-the-end-of-a-text-file/Swift/append-a-record-to-the-end-of-a-text-file-2.swift @@ -0,0 +1,9 @@ +appendPasswd( + account: "jsmith", + passwd:"x", + uid: 1001, + gid: 1000, + bio: "Joe Smith,Room 1007,(234)555-8917,(234)555-0077,jsmith@rosettacode.org", + home: "/home/jsmith", + shell: "/bin/bash" +) diff --git a/Task/Apply-a-callback-to-an-array/Ada/apply-a-callback-to-an-array.ada b/Task/Apply-a-callback-to-an-array/Ada/apply-a-callback-to-an-array-1.adb similarity index 100% rename from Task/Apply-a-callback-to-an-array/Ada/apply-a-callback-to-an-array.ada rename to Task/Apply-a-callback-to-an-array/Ada/apply-a-callback-to-an-array-1.adb diff --git a/Task/Apply-a-callback-to-an-array/Ada/apply-a-callback-to-an-array-2.adb b/Task/Apply-a-callback-to-an-array/Ada/apply-a-callback-to-an-array-2.adb new file mode 100644 index 0000000000..bf1a1147a4 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Ada/apply-a-callback-to-an-array-2.adb @@ -0,0 +1,13 @@ +pragma Ada_2022; +with Ada.Text_IO; use Ada.Text_IO; + +procedure Array_Callback is + type Integer_Array is array (Positive range <>) of Integer; + A : constant Integer_Array := (for I in 1..10 => I); + B : constant Integer_Array := (for I in A'Range => A (I) ** 2); +begin + for I in B'Range loop + Put (B (I)'Image); + end loop; + New_Line; +end Array_Callback; diff --git a/Task/Apply-a-callback-to-an-array/ArkScript/apply-a-callback-to-an-array.ark b/Task/Apply-a-callback-to-an-array/ArkScript/apply-a-callback-to-an-array.ark new file mode 100644 index 0000000000..a264075a30 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/ArkScript/apply-a-callback-to-an-array.ark @@ -0,0 +1,8 @@ +(import std.List :map) + +(let array [1 2 3 4 5 6 7 8 9 10]) +(let mapped (map array (fun (i) (* i i)))) + +(assert + (= mapped [1 4 9 16 25 36 49 64 81 100]) + "mapped is a list of squares") diff --git a/Task/Apply-a-callback-to-an-array/BQN/apply-a-callback-to-an-array.bqn b/Task/Apply-a-callback-to-an-array/BQN/apply-a-callback-to-an-array.bqn new file mode 100644 index 0000000000..22fc66a2d9 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/BQN/apply-a-callback-to-an-array.bqn @@ -0,0 +1,5 @@ +Square ← ט + +array ← 2‿3‿5‿7‿11‿13 + +Square¨ array diff --git a/Task/Apply-a-callback-to-an-array/Ballerina/apply-a-callback-to-an-array.ballerina b/Task/Apply-a-callback-to-an-array/Ballerina/apply-a-callback-to-an-array.ballerina new file mode 100644 index 0000000000..a2d7fd5818 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Ballerina/apply-a-callback-to-an-array.ballerina @@ -0,0 +1,9 @@ +import ballerina/io; + +public function main() { + int[] a = from int i in 1...10 select i; + var square = function(int i) returns int { + return i * i; + }; + io:println(a.map(i => square(i))); +} diff --git a/Task/Apply-a-callback-to-an-array/Bracmat/apply-a-callback-to-an-array-1.bracmat b/Task/Apply-a-callback-to-an-array/Bracmat/apply-a-callback-to-an-array-1.bracmat new file mode 100644 index 0000000000..3ef3a60ead --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Bracmat/apply-a-callback-to-an-array-1.bracmat @@ -0,0 +1,13 @@ +( (square=.!arg^2) +& 1 3 5 7:?numbers +& map$(square.!numbers):?squares2a { functional form } +& out$!squares2a +& map$((=.!arg^2).!numbers):?squares2b { functional form with `lambda` } +& out$!squares2b +& :?isquares1 +& whl + ' ( !numbers:#%?number ?numbers + & !isquares1 !number^2:?isquares1 + ) +& out$!isquares1 +); diff --git a/Task/Apply-a-callback-to-an-array/Bracmat/apply-a-callback-to-an-array-2.bracmat b/Task/Apply-a-callback-to-an-array/Bracmat/apply-a-callback-to-an-array-2.bracmat new file mode 100644 index 0000000000..77dc6ec596 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Bracmat/apply-a-callback-to-an-array-2.bracmat @@ -0,0 +1,22 @@ +( (square=.!arg^2) +& (1,3,5,7):?numbers +& mop + $ (square.!numbers.(=,).(=,)) + : ?squares2a +& out$!squares2a +& mop + $ ( (=.!arg^2) + . !numbers + . (=,) + . (=,) + ) + : ?squares2b +& out$!squares2b +& :?isquares1 +& whl + ' ( !numbers:(?number,?numbers) + & (!isquares1,!number^2):?isquares1 + ) +& (!isquares1,!numbers^2):(,?isquares1) +& out$!isquares1 +); diff --git a/Task/Apply-a-callback-to-an-array/Bracmat/apply-a-callback-to-an-array.bracmat b/Task/Apply-a-callback-to-an-array/Bracmat/apply-a-callback-to-an-array-3.bracmat similarity index 100% rename from Task/Apply-a-callback-to-an-array/Bracmat/apply-a-callback-to-an-array.bracmat rename to Task/Apply-a-callback-to-an-array/Bracmat/apply-a-callback-to-an-array-3.bracmat diff --git a/Task/Apply-a-callback-to-an-array/COBOL/apply-a-callback-to-an-array.cobol b/Task/Apply-a-callback-to-an-array/COBOL/apply-a-callback-to-an-array.cob similarity index 100% rename from Task/Apply-a-callback-to-an-array/COBOL/apply-a-callback-to-an-array.cobol rename to Task/Apply-a-callback-to-an-array/COBOL/apply-a-callback-to-an-array.cob diff --git a/Task/Apply-a-callback-to-an-array/Crystal/apply-a-callback-to-an-array-1.crystal b/Task/Apply-a-callback-to-an-array/Crystal/apply-a-callback-to-an-array-1.cr similarity index 100% rename from Task/Apply-a-callback-to-an-array/Crystal/apply-a-callback-to-an-array-1.crystal rename to Task/Apply-a-callback-to-an-array/Crystal/apply-a-callback-to-an-array-1.cr diff --git a/Task/Apply-a-callback-to-an-array/Crystal/apply-a-callback-to-an-array-2.crystal b/Task/Apply-a-callback-to-an-array/Crystal/apply-a-callback-to-an-array-2.cr similarity index 100% rename from Task/Apply-a-callback-to-an-array/Crystal/apply-a-callback-to-an-array-2.crystal rename to Task/Apply-a-callback-to-an-array/Crystal/apply-a-callback-to-an-array-2.cr diff --git a/Task/Apply-a-callback-to-an-array/Delphi/apply-a-callback-to-an-array.delphi b/Task/Apply-a-callback-to-an-array/Delphi/apply-a-callback-to-an-array.pas similarity index 100% rename from Task/Apply-a-callback-to-an-array/Delphi/apply-a-callback-to-an-array.delphi rename to Task/Apply-a-callback-to-an-array/Delphi/apply-a-callback-to-an-array.pas diff --git a/Task/Apply-a-callback-to-an-array/Elena/apply-a-callback-to-an-array.elena b/Task/Apply-a-callback-to-an-array/Elena/apply-a-callback-to-an-array.elena index 29c9d41f6f..a36b6c9013 100644 --- a/Task/Apply-a-callback-to-an-array/Elena/apply-a-callback-to-an-array.elena +++ b/Task/Apply-a-callback-to-an-array/Elena/apply-a-callback-to-an-array.elena @@ -2,7 +2,7 @@ import system'routines; PrintSecondPower(n){ console.writeLine(n * n) } -public program() +public Program() { - new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.forEach:PrintSecondPower + new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.forEach(PrintSecondPower) } diff --git a/Task/Apply-a-callback-to-an-array/Elixir/apply-a-callback-to-an-array.elixir b/Task/Apply-a-callback-to-an-array/Elixir/apply-a-callback-to-an-array.ex similarity index 100% rename from Task/Apply-a-callback-to-an-array/Elixir/apply-a-callback-to-an-array.elixir rename to Task/Apply-a-callback-to-an-array/Elixir/apply-a-callback-to-an-array.ex diff --git a/Task/Apply-a-callback-to-an-array/Euphoria/apply-a-callback-to-an-array.euphoria b/Task/Apply-a-callback-to-an-array/Euphoria/apply-a-callback-to-an-array.eu similarity index 100% rename from Task/Apply-a-callback-to-an-array/Euphoria/apply-a-callback-to-an-array.euphoria rename to Task/Apply-a-callback-to-an-array/Euphoria/apply-a-callback-to-an-array.eu diff --git a/Task/Apply-a-callback-to-an-array/Gleam/apply-a-callback-to-an-array.gleam b/Task/Apply-a-callback-to-an-array/Gleam/apply-a-callback-to-an-array.gleam new file mode 100644 index 0000000000..90bce5ebb9 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Gleam/apply-a-callback-to-an-array.gleam @@ -0,0 +1,7 @@ +import gleam/list + +pub fn main() { + [1, 14, 99, 23] + |> list.map(fn(x) { x * 2 }) + |> echo +} diff --git a/Task/Apply-a-callback-to-an-array/Haxe/apply-a-callback-to-an-array.hx b/Task/Apply-a-callback-to-an-array/Haxe/apply-a-callback-to-an-array.hx new file mode 100644 index 0000000000..da0f9b93f7 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Haxe/apply-a-callback-to-an-array.hx @@ -0,0 +1,10 @@ +class Main { + static function main() { + var numbers = [1, 2, 3, 4, 5]; + + var squared = (i) -> i * i; + + trace(numbers); + trace(numbers.map(squared)); + } +} diff --git a/Task/Apply-a-callback-to-an-array/Insitux/apply-a-callback-to-an-array-6.insitux b/Task/Apply-a-callback-to-an-array/Insitux/apply-a-callback-to-an-array-6.insitux new file mode 100644 index 0000000000..0d22e445cf --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Insitux/apply-a-callback-to-an-array-6.insitux @@ -0,0 +1,2 @@ +; apply an interpolated string closure +(map #"{%} + 1 = {+ 1 %}" [1 2 3 4]) diff --git a/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-1.jactl b/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-1.jactl new file mode 100644 index 0000000000..17b6f6636e --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-1.jactl @@ -0,0 +1 @@ +println [1,2,3,4,5].map{ n -> n * n } diff --git a/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-2.jactl b/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-2.jactl new file mode 100644 index 0000000000..5d89e97a87 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-2.jactl @@ -0,0 +1 @@ +[1, 4, 9, 16, 25] diff --git a/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-3.jactl b/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-3.jactl new file mode 100644 index 0000000000..84acb1c3ac --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-3.jactl @@ -0,0 +1 @@ +println [1,2,3,4,5].map{ it * it } diff --git a/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-4.jactl b/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-4.jactl new file mode 100644 index 0000000000..732e1e9933 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-4.jactl @@ -0,0 +1 @@ +println [[1,2],[2,3],[3,4],[4,5]].map{ a,b -> a * b } diff --git a/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-5.jactl b/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-5.jactl new file mode 100644 index 0000000000..74ad847b49 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Jactl/apply-a-callback-to-an-array-5.jactl @@ -0,0 +1 @@ +[2, 6, 12, 20] diff --git a/Task/Apply-a-callback-to-an-array/Julia/apply-a-callback-to-an-array.julia b/Task/Apply-a-callback-to-an-array/Julia/apply-a-callback-to-an-array.jl similarity index 100% rename from Task/Apply-a-callback-to-an-array/Julia/apply-a-callback-to-an-array.julia rename to Task/Apply-a-callback-to-an-array/Julia/apply-a-callback-to-an-array.jl diff --git a/Task/Apply-a-callback-to-an-array/Kotlin/apply-a-callback-to-an-array.kotlin b/Task/Apply-a-callback-to-an-array/Kotlin/apply-a-callback-to-an-array.kts similarity index 100% rename from Task/Apply-a-callback-to-an-array/Kotlin/apply-a-callback-to-an-array.kotlin rename to Task/Apply-a-callback-to-an-array/Kotlin/apply-a-callback-to-an-array.kts diff --git a/Task/Apply-a-callback-to-an-array/Langur/apply-a-callback-to-an-array.langur b/Task/Apply-a-callback-to-an-array/Langur/apply-a-callback-to-an-array.langur index f73a204644..61d90f3fb8 100644 --- a/Task/Apply-a-callback-to-an-array/Langur/apply-a-callback-to-an-array.langur +++ b/Task/Apply-a-callback-to-an-array/Langur/apply-a-callback-to-an-array.langur @@ -1 +1 @@ -writeln map f{^2}, 1..10 +writeln map(1..10, by=fn{^2}) diff --git a/Task/Apply-a-callback-to-an-array/MiniScript/apply-a-callback-to-an-array.mini b/Task/Apply-a-callback-to-an-array/MiniScript/apply-a-callback-to-an-array.mini new file mode 100644 index 0000000000..9438072140 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/MiniScript/apply-a-callback-to-an-array.mini @@ -0,0 +1,8 @@ +import "listUtil" +sq = function (x) + return x * x +end function + +arr = range(1, 10) +arr.apply(@sq) +print(arr) diff --git a/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-1.ocaml b/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-1.ml similarity index 100% rename from Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-1.ocaml rename to Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-1.ml diff --git a/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-2.ocaml b/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-2.ml similarity index 100% rename from Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-2.ocaml rename to Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-2.ml diff --git a/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-3.ocaml b/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-3.ml similarity index 100% rename from Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-3.ocaml rename to Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-3.ml diff --git a/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-4.ocaml b/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-4.ml similarity index 100% rename from Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-4.ocaml rename to Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-4.ml diff --git a/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-5.ocaml b/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-5.ml similarity index 100% rename from Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-5.ocaml rename to Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-5.ml diff --git a/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-6.ocaml b/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-6.ml similarity index 100% rename from Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-6.ocaml rename to Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-6.ml diff --git a/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-7.ocaml b/Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-7.ml similarity index 100% rename from Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-7.ocaml rename to Task/Apply-a-callback-to-an-array/OCaml/apply-a-callback-to-an-array-7.ml diff --git a/Task/Apply-a-callback-to-an-array/PascalABC.NET/apply-a-callback-to-an-array.pas b/Task/Apply-a-callback-to-an-array/PascalABC.NET/apply-a-callback-to-an-array.pas new file mode 100644 index 0000000000..c95fa7f852 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/PascalABC.NET/apply-a-callback-to-an-array.pas @@ -0,0 +1,5 @@ +begin + var a := Arr(1..10); + a := a.Select(x -> x * x).ToArray; + a.ForEach(x -> Print(x)); +end. diff --git a/Task/Apply-a-callback-to-an-array/PowerShell/apply-a-callback-to-an-array-1.psh b/Task/Apply-a-callback-to-an-array/PowerShell/apply-a-callback-to-an-array-1.ps1 similarity index 100% rename from Task/Apply-a-callback-to-an-array/PowerShell/apply-a-callback-to-an-array-1.psh rename to Task/Apply-a-callback-to-an-array/PowerShell/apply-a-callback-to-an-array-1.ps1 diff --git a/Task/Apply-a-callback-to-an-array/PowerShell/apply-a-callback-to-an-array-2.psh b/Task/Apply-a-callback-to-an-array/PowerShell/apply-a-callback-to-an-array-2.ps1 similarity index 100% rename from Task/Apply-a-callback-to-an-array/PowerShell/apply-a-callback-to-an-array-2.psh rename to Task/Apply-a-callback-to-an-array/PowerShell/apply-a-callback-to-an-array-2.ps1 diff --git a/Task/Apply-a-callback-to-an-array/REXX/apply-a-callback-to-an-array.rexx b/Task/Apply-a-callback-to-an-array/REXX/apply-a-callback-to-an-array.rexx index a73f3a1322..916ed41e04 100644 --- a/Task/Apply-a-callback-to-an-array/REXX/apply-a-callback-to-an-array.rexx +++ b/Task/Apply-a-callback-to-an-array/REXX/apply-a-callback-to-an-array.rexx @@ -1,23 +1,38 @@ -/*REXX program applies a callback to an array (using factorials for a demonstration).*/ -numeric digits 100 /*be able to display some huge numbers.*/ -parse arg # . /*obtain an optional value from the CL.*/ -a.= /*initialize the array A to all nulls*/ -if #=='' | #=="," then #= 12 /*Not assigned? Then use default value*/ - do j=0 to #; a.j= j /*assign the integer J ───► A.j */ - end /*j*/ /*array A will have N values: 0 ──► #*/ +-- 31 Mar 2026 +include Setting +numeric digits 4 -call listA 'before callback' /*display A array before the callback*/ -say /*display a blank line for readability.*/ -say ' ··· applying callback to array A ···' /*display what is about to happen to B.*/ -say /*display a blank line for readability.*/ -call bangit 'a' /*factorialize (the values) of A array.*/ - /* store the results ───► array B.*/ -call listA ' after callback' /*display A array after the callback.*/ -exit 0 /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -bangit: do v=0; $= value(arg(1)'.'v); if $=='' then return /*No value? Then return*/ - call value arg(1)'.'v, fact($) /*assign a value (a factorial) to array*/ - end /*i*/ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -fact: procedure; arg x; != 1; do f=2 to x; != !*f; end; /*f*/; return ! -listA: do k=0 while a.k\==''; say arg(1) 'a.'k"=" a.k; end /*k*/; return +say 'APPLY A CALLBACK TO AN ARRAY' +say version +say +say 'Generate...' +call Struct2stem 'stem.','1 2 3 4 5 6 7 8 9 10' +call ShowSt 'stem.','1 to 10 ascending',,7 +call CopySt 'stem.','copy.' + +say 'Single function Square' +call MapSt 'stem.','square' +call ShowSt 'stem.','after square',,7 + +say 'Your own function Cubic...' +call CopySt 'copy.','stem.' +call MapSt 'stem.','cube' +call ShowSt 'stem.','after cube',,7 + +say 'Expression x^2+2x+3...' +call CopySt 'copy.','stem.' +call MapSt 'stem.','x**2+2*x+3' +call ShowSt 'stem.','after simple formula',,7 + +say 'Expression Sin(x)+Square(x)...' +call CopySt 'copy.','stem.' +call MapSt 'stem.','sin(x)+square(x)' +call ShowSt 'stem.','after more involved formula',,7 +exit + +Cubic: +arg xx +return xx**3 + +-- MapSt; Struct2stem; ShowSt; CopySt; Square; Sin +include Math diff --git a/Task/Apply-a-callback-to-an-array/REBOL/apply-a-callback-to-an-array.rebol b/Task/Apply-a-callback-to-an-array/Rebol/apply-a-callback-to-an-array.rebol similarity index 98% rename from Task/Apply-a-callback-to-an-array/REBOL/apply-a-callback-to-an-array.rebol rename to Task/Apply-a-callback-to-an-array/Rebol/apply-a-callback-to-an-array.rebol index ec06fa4564..62231cfcf9 100644 --- a/Task/Apply-a-callback-to-an-array/REBOL/apply-a-callback-to-an-array.rebol +++ b/Task/Apply-a-callback-to-an-array/Rebol/apply-a-callback-to-an-array.rebol @@ -1,4 +1,4 @@ -REBOL [ +Rebol [ Title: "Array Callback" URL: http://rosettacode.org/wiki/Apply_a_callback_to_an_Array ] diff --git a/Task/Apply-a-callback-to-an-array/Rust/apply-a-callback-to-an-array.rs b/Task/Apply-a-callback-to-an-array/Rust/apply-a-callback-to-an-array.rs new file mode 100644 index 0000000000..15fefb8314 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Rust/apply-a-callback-to-an-array.rs @@ -0,0 +1,9 @@ +fn echo(n: &i32) { + println!("{}", n); +} + +fn main() { + let a: [i32; 5]; + a = [1, 2, 3, 4, 5]; + let _: Vec<_> = a.iter().map(echo).collect(); +} diff --git a/Task/Apply-a-callback-to-an-array/Rust/apply-a-callback-to-an-array.rust b/Task/Apply-a-callback-to-an-array/Rust/apply-a-callback-to-an-array.rust deleted file mode 100644 index 8e67a487bf..0000000000 --- a/Task/Apply-a-callback-to-an-array/Rust/apply-a-callback-to-an-array.rust +++ /dev/null @@ -1,9 +0,0 @@ -fn echo(n: &i32) { - println!("{}", n); -} - -fn main() { - let a: [i32; 5]; - a = [1, 2, 3, 4, 5]; - let _: Vec<_> = a.into_iter().map(echo).collect(); -} diff --git a/Task/Apply-a-callback-to-an-array/SIL/apply-a-callback-to-an-array.sil b/Task/Apply-a-callback-to-an-array/SIL/apply-a-callback-to-an-array.sil new file mode 100644 index 0000000000..77284ec80d --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/SIL/apply-a-callback-to-an-array.sil @@ -0,0 +1,32 @@ +// avoid executing function definitions +GOTO body + +// our function to apply +funcsquare +x * x +return + +lblbody +// add some values to the memory buffer +set 256 1 +set 257 2 +set 258 3 +set 259 4 +set 260 5 + +// i is our array pointer +// in sil it's customary to place data in cells > 255 +// to avoid interference with ascii variables +i = 256 + +lblloop +// place value at i where square function expects it +x = get i +// call square function +GOSUB square +printInt x +// increment pointer; this is like i += 1 in C +i + 1 +a = 261 - i +// start another iteration if we are below cell 261 +if a loop diff --git a/Task/Apply-a-callback-to-an-array/Scheme/apply-a-callback-to-an-array-1.ss b/Task/Apply-a-callback-to-an-array/Scheme/apply-a-callback-to-an-array-1.scm similarity index 100% rename from Task/Apply-a-callback-to-an-array/Scheme/apply-a-callback-to-an-array-1.ss rename to Task/Apply-a-callback-to-an-array/Scheme/apply-a-callback-to-an-array-1.scm diff --git a/Task/Apply-a-callback-to-an-array/Scheme/apply-a-callback-to-an-array-2.ss b/Task/Apply-a-callback-to-an-array/Scheme/apply-a-callback-to-an-array-2.scm similarity index 100% rename from Task/Apply-a-callback-to-an-array/Scheme/apply-a-callback-to-an-array-2.ss rename to Task/Apply-a-callback-to-an-array/Scheme/apply-a-callback-to-an-array-2.scm diff --git a/Task/Apply-a-callback-to-an-array/Scheme/apply-a-callback-to-an-array-3.ss b/Task/Apply-a-callback-to-an-array/Scheme/apply-a-callback-to-an-array-3.scm similarity index 100% rename from Task/Apply-a-callback-to-an-array/Scheme/apply-a-callback-to-an-array-3.ss rename to Task/Apply-a-callback-to-an-array/Scheme/apply-a-callback-to-an-array-3.scm diff --git a/Task/Apply-a-callback-to-an-array/Tailspin/apply-a-callback-to-an-array.tailspin b/Task/Apply-a-callback-to-an-array/Tailspin/apply-a-callback-to-an-array-1.tailspin similarity index 100% rename from Task/Apply-a-callback-to-an-array/Tailspin/apply-a-callback-to-an-array.tailspin rename to Task/Apply-a-callback-to-an-array/Tailspin/apply-a-callback-to-an-array-1.tailspin diff --git a/Task/Apply-a-callback-to-an-array/Tailspin/apply-a-callback-to-an-array-2.tailspin b/Task/Apply-a-callback-to-an-array/Tailspin/apply-a-callback-to-an-array-2.tailspin new file mode 100644 index 0000000000..88a5af5f68 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Tailspin/apply-a-callback-to-an-array-2.tailspin @@ -0,0 +1,14 @@ +numbers is [1,3,7,10]; + +cube templates + $ * $ * $ ! +end cube + +-- Using lens transforms +$numbers(.. as i; -> $ * $i) ! +$numbers(..; -> $ * $) ! +$numbers(..; -> cube) ! + +-- Using array literal and deconstructor +[ $numbers... -> $ * $ ] ! +[ $numbers... -> cube ] ! diff --git a/Task/Apply-a-callback-to-an-array/Uiua/apply-a-callback-to-an-array.uiua b/Task/Apply-a-callback-to-an-array/Uiua/apply-a-callback-to-an-array.uiua new file mode 100644 index 0000000000..4a3c9d85d0 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/Uiua/apply-a-callback-to-an-array.uiua @@ -0,0 +1 @@ +⍚&p⇡10 diff --git a/Task/Apply-a-callback-to-an-array/V-(Vlang)/apply-a-callback-to-an-array.v b/Task/Apply-a-callback-to-an-array/V-(Vlang)/apply-a-callback-to-an-array.v new file mode 100644 index 0000000000..84dd6e2ec5 --- /dev/null +++ b/Task/Apply-a-callback-to-an-array/V-(Vlang)/apply-a-callback-to-an-array.v @@ -0,0 +1,5 @@ +fn main() { + mut arr := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + new_arr := arr.map(fn (it int) int {return it * it}) + println(new_arr) +} diff --git a/Task/Apply-a-callback-to-an-array/VBScript/apply-a-callback-to-an-array-1.vb b/Task/Apply-a-callback-to-an-array/VBScript/apply-a-callback-to-an-array-1.vbs similarity index 100% rename from Task/Apply-a-callback-to-an-array/VBScript/apply-a-callback-to-an-array-1.vb rename to Task/Apply-a-callback-to-an-array/VBScript/apply-a-callback-to-an-array-1.vbs diff --git a/Task/Apply-a-callback-to-an-array/VBScript/apply-a-callback-to-an-array-2.vb b/Task/Apply-a-callback-to-an-array/VBScript/apply-a-callback-to-an-array-2.vbs similarity index 100% rename from Task/Apply-a-callback-to-an-array/VBScript/apply-a-callback-to-an-array-2.vb rename to Task/Apply-a-callback-to-an-array/VBScript/apply-a-callback-to-an-array-2.vbs diff --git a/Task/Apply-a-digital-filter-direct-form-II-transposed-/ALGOL-68/apply-a-digital-filter-direct-form-ii-transposed-.alg b/Task/Apply-a-digital-filter-direct-form-II-transposed-/ALGOL-68/apply-a-digital-filter-direct-form-ii-transposed-.alg index 4c7615c3bb..b5417588b2 100644 --- a/Task/Apply-a-digital-filter-direct-form-II-transposed-/ALGOL-68/apply-a-digital-filter-direct-form-ii-transposed-.alg +++ b/Task/Apply-a-digital-filter-direct-form-II-transposed-/ALGOL-68/apply-a-digital-filter-direct-form-ii-transposed-.alg @@ -1,5 +1,4 @@ BEGIN # apply a digital filter # - # the lower bounds of a, b, signal and result must all be equal # PROC filter = ( []REAL a, b, signal, REF[]REAL result )VOID: IF LWB a /= LWB b OR LWB a /= LWB signal OR LWB a /= LWB result THEN print( ( "Array lower bounds must be equal for filter", newline ) ); @@ -11,25 +10,27 @@ BEGIN # apply a digital filter # FOR j FROM LWB b TO IF i > UPB b THEN UPB b ELSE i FI DO tmp +:= b[ j ] * signal[ LWB signal + ( i - j ) ] OD; - FOR j FROM LWB a + 1 TO IF i > UPB a THEN UPB a ELSE i FI DO + FOR j FROM LWB a + 1 TO IF i > UPB a THEN UPB a ELSE i FI DO tmp -:= a[ j ] * result[ LWB result + ( i - j ) ] OD; result[ i ] := tmp / a[ LWB a ] OD FI # filter # ; - [ 4 ]REAL a := []REAL( 1, -2.77555756e-16, 3.33333333e-01, -1.85037171e-17 ); - [ 4 ]REAL b := []REAL( 0.16666667, 0.5, 0.5, 0.16666667 ); - [ 20 ]REAL signal - := []REAL( -0.917843918645, 0.141984778794, 1.20536903482, 0.190286794412 - , -0.662370894973, -1.00700480494, -0.404707073677, 0.800482325044 - , 0.743500089861, 1.01090520172, 0.741527555207, 0.277841675195 - , 0.400833448236, -0.2085993586, -0.172842103641, -0.134316096293 - , 0.0259303398477, 0.490105989562, 0.549391221511, 0.9047198589 - ); - [ 20 ]REAL result; - filter( a, b, signal, result ); - FOR i FROM LWB result TO UPB result DO - print( ( " ", fixed( result[ i ], -9, 6 ) ) ); - IF i MOD 5 /= 0 THEN print( ( ", " ) ) ELSE print( ( newline ) ) FI - OD + BEGIN + [ 4 ]REAL a := []REAL( 1, -2.77555756e-16, 3.33333333e-01, -1.85037171e-17 ); + [ 4 ]REAL b := []REAL( 0.16666667, 0.5, 0.5, 0.16666667 ); + [ 20 ]REAL signal + := []REAL( -0.917843918645, 0.141984778794, 1.20536903482, 0.190286794412 + , -0.662370894973, -1.00700480494, -0.404707073677, 0.800482325044 + , 0.743500089861, 1.01090520172, 0.741527555207, 0.277841675195 + , 0.400833448236, -0.2085993586, -0.172842103641, -0.134316096293 + , 0.0259303398477, 0.490105989562, 0.549391221511, 0.9047198589 + ); + [ 20 ]REAL result; + filter( a, b, signal, result ); + FOR i FROM LWB result TO UPB result DO + print( ( " ", fixed( result[ i ], -9, 6 ) ) ); + IF i MOD 5 /= 0 THEN print( ( ", " ) ) ELSE print( ( newline ) ) FI + OD + END END diff --git a/Task/Apply-a-digital-filter-direct-form-II-transposed-/Ada/apply-a-digital-filter-direct-form-ii-transposed-.ada b/Task/Apply-a-digital-filter-direct-form-II-transposed-/Ada/apply-a-digital-filter-direct-form-ii-transposed-.adb similarity index 100% rename from Task/Apply-a-digital-filter-direct-form-II-transposed-/Ada/apply-a-digital-filter-direct-form-ii-transposed-.ada rename to Task/Apply-a-digital-filter-direct-form-II-transposed-/Ada/apply-a-digital-filter-direct-form-ii-transposed-.adb diff --git a/Task/Apply-a-digital-filter-direct-form-II-transposed-/Crystal/apply-a-digital-filter-direct-form-ii-transposed-.cr b/Task/Apply-a-digital-filter-direct-form-II-transposed-/Crystal/apply-a-digital-filter-direct-form-ii-transposed-.cr new file mode 100644 index 0000000000..8758d38c65 --- /dev/null +++ b/Task/Apply-a-digital-filter-direct-form-II-transposed-/Crystal/apply-a-digital-filter-direct-form-ii-transposed-.cr @@ -0,0 +1,26 @@ +def filter (b, a, inp) + outp = Array.new(inp.size, 0.0) + (0...inp.size).each do |i| + tmp = 0.0 + (0...b.size).each do |j| + next if i - j < 0 + tmp += b[j] * inp[i-j] + end + (1...a.size).each do |j| + next if i - j < 0 + tmp -= a[j] * outp[i-j] + end + tmp /= a[0] + outp[i] = tmp + end + outp +end + +sig = [-0.917843918645, 0.141984778794, 1.20536903482, 0.190286794412, -0.662370894973, + -1.00700480494, -0.404707073677 ,0.800482325044, 0.743500089861, 1.01090520172, + 0.741527555207, 0.277841675195, 0.400833448236, -0.2085993586, -0.172842103641, + -0.134316096293, 0.0259303398477, 0.490105989562, 0.549391221511, 0.9047198589] +a = [1.00000000, -2.77555756e-16, 3.33333333e-01, -1.85037171e-17] +b = [0.16666667, 0.5, 0.5, 0.16666667] + +p filter(b, a, sig) diff --git a/Task/Apply-a-digital-filter-direct-form-II-transposed-/Fortran/apply-a-digital-filter-direct-form-ii-transposed-.f b/Task/Apply-a-digital-filter-direct-form-II-transposed-/Fortran/apply-a-digital-filter-direct-form-ii-transposed-.f new file mode 100644 index 0000000000..82aef332a6 --- /dev/null +++ b/Task/Apply-a-digital-filter-direct-form-II-transposed-/Fortran/apply-a-digital-filter-direct-form-ii-transposed-.f @@ -0,0 +1,42 @@ +module df2_filter + implicit none + real, parameter :: a(4) = [1.00000000, -2.77555756e-16, 3.33333333e-01, -1.85037171e-17] + real, parameter :: b(4) = [0.16666667, 0.5, 0.5, 0.16666667] + real :: w(4) = 0.0 ! State vector + +contains + function filter(x) result(y) + real, intent(in) :: x + real :: y + integer :: i + + y = x * b(1) + w(1) + + do i = 2, 4 + w(i-1) = x * b(i) - y * a(i) + w(i) + end do + end function filter +end module df2_filter + +program apply_filter + use df2_filter + implicit none + real, dimension(20) :: input = [ & + -0.917843918645, 0.141984778794, 1.20536903482, 0.190286794412, & + -0.662370894973, -1.00700480494, -0.404707073677, 0.800482325044, & + 0.743500089861, 1.01090520172, 0.741527555207, 0.277841675195, & + 0.400833448236, -0.2085993586, -0.172842103641, -0.134316096293, & + 0.0259303398477, 0.490105989562, 0.549391221511, 0.9047198589 ] + real, dimension(20) :: output + integer :: i + + do i = 1, 20 + output(i) = filter(input(i)) + end do + + print *, "Filtered signal:" + do i = 1,20 + write(*, '(f12.9,2x)',advance='no') output(i) + if(mod(i,5)==0)write(*,*) + end do +end program apply_filter diff --git a/Task/Apply-a-digital-filter-direct-form-II-transposed-/Julia/apply-a-digital-filter-direct-form-ii-transposed-.julia b/Task/Apply-a-digital-filter-direct-form-II-transposed-/Julia/apply-a-digital-filter-direct-form-ii-transposed-.jl similarity index 100% rename from Task/Apply-a-digital-filter-direct-form-II-transposed-/Julia/apply-a-digital-filter-direct-form-ii-transposed-.julia rename to Task/Apply-a-digital-filter-direct-form-II-transposed-/Julia/apply-a-digital-filter-direct-form-ii-transposed-.jl diff --git a/Task/Apply-a-digital-filter-direct-form-II-transposed-/Kotlin/apply-a-digital-filter-direct-form-ii-transposed-.kotlin b/Task/Apply-a-digital-filter-direct-form-II-transposed-/Kotlin/apply-a-digital-filter-direct-form-ii-transposed-.kts similarity index 100% rename from Task/Apply-a-digital-filter-direct-form-II-transposed-/Kotlin/apply-a-digital-filter-direct-form-ii-transposed-.kotlin rename to Task/Apply-a-digital-filter-direct-form-II-transposed-/Kotlin/apply-a-digital-filter-direct-form-ii-transposed-.kts diff --git a/Task/Apply-a-digital-filter-direct-form-II-transposed-/M2000-Interpreter/apply-a-digital-filter-direct-form-ii-transposed-.m2000 b/Task/Apply-a-digital-filter-direct-form-II-transposed-/M2000-Interpreter/apply-a-digital-filter-direct-form-ii-transposed-.m2000 new file mode 100644 index 0000000000..7cc823c84a --- /dev/null +++ b/Task/Apply-a-digital-filter-direct-form-II-transposed-/M2000-Interpreter/apply-a-digital-filter-direct-form-ii-transposed-.m2000 @@ -0,0 +1,49 @@ +module Checkit { + locale 1033 ' use of dot for decimals + window 12, window ' set 12pt for current display monitor + form 60 ' 60 chars width, any for heigh + Print $("0.00000000",12) ' 12 chars per tab + ' all data push to end of stack, so we use the stack of values as FIFO + Flush + ' a() + Data 1, -2.77555756e-16, 3.33333333e-01, -1.85037171e-17 + ' b() + Data 0.16666667, 0.5, 0.5, 0.16666667 + ' signal() + Data -0.917843918645, 0.141984778794, 1.20536903482, 0.190286794412 + Data -0.662370894973, -1.00700480494, -0.404707073677, 0.800482325044 + Data 0.743500089861, 1.01090520172, 0.741527555207, 0.277841675195 + Data 0.400833448236, -0.2085993586, -0.172842103641, -0.134316096293 + Data 0.0259303398477, 0.490105989562, 0.549391221511, 0.9047198589 + Dim Base 0, a(4) as Double , b(4) as Double , signal(20) as Double + Integer i + For i = 0 To 3 : Read a(i) : Next i + For i = 0 To 3 : Read b(i) : Next i + For i = 0 To 19 : Read signal(i) : Next i + dim resp() + resp()=@Filter_a_b(&signal()) + k=each(resp()) + while k + Print array(k), + if pos>0 then if (k^+1) mod 5=0 then Print + end while + Function Filter_a_b(&c()) + Local Integer j, k + Local Double tmp + Local result(0 to len(c())-1) as Double + For j = 0 To Len(c())-1 + tmp = 0 + For k = 0 To Len(b())-1 + If (j-k < 0) Then Continue For + tmp += b(k) * c(j-k) + Next k + For k = 0 To Len(a())-1 + If (j-k < 0) Then Continue For + tmp -= a(k) * result(j-k) + Next k + result(j) = tmp/a(0) + Next j + =result() + End Function +} +Checkit diff --git a/Task/Apply-a-digital-filter-direct-form-II-transposed-/Phix/apply-a-digital-filter-direct-form-ii-transposed-.phix b/Task/Apply-a-digital-filter-direct-form-II-transposed-/Phix/apply-a-digital-filter-direct-form-ii-transposed-.phix index aa33f346b9..3c4df0029e 100644 --- a/Task/Apply-a-digital-filter-direct-form-II-transposed-/Phix/apply-a-digital-filter-direct-form-ii-transposed-.phix +++ b/Task/Apply-a-digital-filter-direct-form-II-transposed-/Phix/apply-a-digital-filter-direct-form-ii-transposed-.phix @@ -1,22 +1,20 @@ -(phixonline)--> - with javascript_semantics - function direct_form_II_transposed_filter(sequence a, b, signal) - sequence result = repeat(0,length(signal)) - for i=1 to length(signal) do - atom tmp = 0 - for j=1 to min(i,length(b)) do tmp += b[j]*signal[i-j+1] end for - for j=2 to min(i,length(a)) do tmp -= a[j]*result[i-j+1] end for - result[i] = tmp/a[1] - end for - return result - end function +with javascript_semantics +function direct_form_II_transposed_filter(sequence a, b, signal) + sequence result = repeat(0,length(signal)) + for i=1 to length(signal) do + atom tmp = 0 + for j=1 to min(i,length(b)) do tmp += b[j]*signal[i-j+1] end for + for j=2 to min(i,length(a)) do tmp -= a[j]*result[i-j+1] end for + result[i] = tmp/a[1] + end for + return result +end function - constant acoef = {1.00000000, -2.77555756e-16, 3.33333333e-01, -1.85037171e-17}, - bcoef = {0.16666667, 0.5, 0.5, 0.16666667}, - signal = {-0.917843918645,0.141984778794,1.20536903482,0.190286794412,-0.662370894973, - -1.00700480494,-0.404707073677,0.800482325044,0.743500089861,1.01090520172, - 0.741527555207,0.277841675195,0.400833448236,-0.2085993586,-0.172842103641, - -0.134316096293,0.0259303398477,0.490105989562,0.549391221511,0.9047198589} +constant acoef = {1.00000000, -2.77555756e-16, 3.33333333e-01, -1.85037171e-17}, + bcoef = {0.16666667, 0.5, 0.5, 0.16666667}, + signal = {-0.917843918645,0.141984778794,1.20536903482,0.190286794412,-0.662370894973, + -1.00700480494,-0.404707073677,0.800482325044,0.743500089861,1.01090520172, + 0.741527555207,0.277841675195,0.400833448236,-0.2085993586,-0.172842103641, + -0.134316096293,0.0259303398477,0.490105989562,0.549391221511,0.9047198589} - pp(direct_form_II_transposed_filter(acoef, bcoef, signal),{pp_FltFmt,"%9.6f",pp_Maxlen,110}) - - without js - atom mem = allocate(size,true) - - without js - sequence ap = {} - function ap_allocate(integer size) - -- allocate some memory and add it to the arena pool 'ap' for later release - atom res = allocate(size) - ap = append(ap,res) - return res - end function - procedure ap_free() - -- free all memory allocated in arena pool 'ap' - free(ap) - ap = {} - end procedure - - -- demo\rosetta\ArithComplex.exw - with javascript_semantics - include complex.e - complex a = complex_new(1,1), -- (or just {1,1}) - b = complex_new(3.14159,1.25), - c = complex_new(1,0), - d = complex_new(0,1) - printf(1,"a = %s\n",{complex_sprint(a)}) - printf(1,"b = %s\n",{complex_sprint(b)}) - printf(1,"c = %s\n",{complex_sprint(c)}) - printf(1,"d = %s\n",{complex_sprint(d)}) - printf(1,"a+b = %s\n",{complex_sprint(complex_add(a,b))}) - printf(1,"a*b = %s\n",{complex_sprint(complex_mul(a,b))}) - printf(1,"1/a = %s\n",{complex_sprint(complex_inv(a))}) - printf(1,"c/a = %s\n",{complex_sprint(complex_div(c,a))}) - printf(1,"c-a = %s\n",{complex_sprint(complex_sub(c,a))}) - printf(1,"d-a = %s\n",{complex_sprint(complex_sub(d,a))}) - printf(1,"-a = %s\n",{complex_sprint(complex_neg(a))}) - printf(1,"conj a = %s\n",{complex_sprint(complex_conjugate(a))}) - convierte a notación polaca \ + --> evalúa expresión --> despliega resultados ) + --largo de datos + mientras ' largo de datos' + +terminar + +subrutinas + +convierte a matriz: + + argumentos 'expr' + transformar(" ","",\ + transformar("(-","(0-",expr)), guardar en 'expr' + + l=0, #( l = len(expr) ) + v="", num="", cte="" + para cada caracter (v, expr, l) + cuando ( #(typechar(v,"digit") || v==".")){ + num, v, concatenar esto, guardar en 'num' + continuar + } + cuando ( #(typechar(v,"alpha") )){ + cte, v, concatenar esto, guardar en 'cte' + continuar + } + cuando (num) {num, meter en 'q', num=""} + cuando (cte) {cte, meter en 'q', cte=""} + v, meter en 'q' + siguiente + + cuando (num) {num, meter en 'q'} + cuando (cte) {cte, meter en 'q'} + "(", meter en 'pila' + ")", meter en 'q' + // imprimir( "Q = {", q, "}\n" ) + +retornar + +convierte a notación polaca: + + l="", m="" + + iterar mientras '#( not(is empty(q)) )' + sw = 1 + +///imprimir("P = ",p,"\nQ = ",q,"\nPILA = ",pila,NL) + + extraer tope 'q' para 'l' + + // ¿es un operando? + cuando ' #(not( occurs(l,"+-*^/)(%") )) ' { + si ' se verifica constante en (l) ' + meter en 'p' + sino si ' se verifica función en (l) ' + l, meter en 'pila' + sino + #( number(l) ), meter en 'p' + fin si + continuar + } + // es un simbolo... + + // es un parentesis izquierdo? + cuando ( #( l=="(" ) ) { + l, meter en 'pila' + continuar + } + // es un operador? + cuando ( #( occurs(l,"+-*^/%")) ) { + + iterar mientras ' sw ' + extraer cabeza 'pila' para 'm' + + cuando ' #(m=="(") '{ + m,l, apilar en 'pila' + sw=0, continuar + } + cuando ' #(l=="^") '{ + si ' #(m=="^") ' + //m,l, apilar en 'p' + m, meter en 'p' + sino + m,l, apilar en 'pila' + sw=0 + fin si, continuar + } + cuando ' #(l=="*") ' { + si ' #(occurs(m, "^*/%"))' + m, meter en 'p' + sino + m,l, apilar en 'pila' + sw=0 + fin si, continuar + } + //cuando ' #(l=="/") ' { + // decisión de diseño para resto módulo + cuando ' #( occurs(l,"/%")) ' { + si ' #( occurs(m, "/^*%") )' + m, meter en 'p' + l, meter en 'pila' + sino + m,l, apilar en 'pila' + fin si + sw=0, continuar + } + + cuando ' #(occurs(l, "+-"))' { + m, meter en 'p' + // saber si ya hay un símbolo "-" en pila + tmp=0 + tope(pila), mover a 'tmp' + si ' #( occurs(tmp,"+-") ) ' + extraer cabeza (pila) + meter en 'p' + fin si + l, meter en 'pila' + sw=0 + } + + reiterar + + si ' #( length (pila)==0 ) ' + "(", meter en 'pila' + fin si + + continuar + } + // es un paréntesis derecho? + cuando( #(l==")") ) { + extraer cabeza (pila) para 'm' + + iterar mientras ' #( m<>"(") ' + m, meter en 'p' + extraer cabeza 'pila' para 'm' + reiterar + } + reiterar +retornar + +evalúa expresión: + + l = " ", a=0, b=0 + iterar mientras ' #( not(is empty(p)) ) ' + extraer tope 'p' para 'l' + si ' es numérico (l) ' + l, meter en 'pila' + sino + si ' se verifica función en (l) ' + extraer cabeza 'pila' para 'b' + seleccionar 'l' + caso ("sqrt"){ #(sqrt(b)), salir } + caso ("log"){ #(log10(b)), salir } + caso ("ln"){ #(log(b)), salir } + caso ("fact"){ + si ' #(int(b)<>b) ' // límite de Euler + x=0,i=2, xb=1, + // aproximación muy burda. + #basic{ + b = b + 1 + x = fact(163)*(163^b) + xb = b*(b+1) + while( i<=163 ) + xb = xb * ( i+b ) + i+=1 + wend + x/xb + } + sino // normal + #(fact(b)) + fin si + salir + } + fin seleccionar + sino + extraer cabeza 'pila' para 'b' + extraer cabeza 'pila' para 'a' + seleccionar 'l' + caso ("+"){ #(a+b), salir } + caso ("-"){ #(a-b), salir } + caso ("*"){ #(a*b), salir } + // n/0 = inf, no es necesario detectar esto: + caso ("/"){ #(a/b), salir } + caso ("^"){ #(a^b), salir } + caso ("%"){ #(a%b), salir } + fin seleccionar + fin si + meter en 'pila' + fin si + + reiterar + +retornar + +despliega resultados: + + imprimir(expresión," : ", \ + tomar si( #(length(pila)==1),pila, \ + #(utf8("expresión mal formada!"))), NL) + +retornar + +verificar constante (x) + seleccionar 'x' + caso ("pi"){ M_PI, 1, salir } + caso ("e") { M_E, 1, salir } + caso ("phi"){ M_PHI, 1, salir } + // etcétera... + caso por defecto{ 0, salir } + fin seleccionar +retornar + +verificar función (f) + seleccionar 'f' + caso ("sqrt"){ '1', salir } + caso ("log"){ '1', salir } + caso ("ln"){ '1', salir } + caso ("fact"){ '1', salir } + // etcétera... + caso por defecto { '0', salir } + fin seleccionar +retornar + +DATA_EXPRESIONES: + datos("((30+4.5) * ( 7 / 9.67 )+3)-4*(-1)") //31.9741468459168 + datos("1 + 2*(3 - 2*(3 - 2)*((2 - 4)*5 - 22/(7 + 2*(3 - 1)) - 1)) + 1") // 60! + datos("(1 - 5) * 2 / (20 + 1)") // -8/21 + datos("(3 * 2) - (1 + 2) / (4") // error! + datos("(3 * 2) a - (1 + 2) / 4") // error! + datos("(6^2)*2/3") //24 + datos("6^2*2/3") //24 + datos("(6^2)*2/0") //inf + datos("2 * (3 + ((5) / (7 - 11)))") // 3.5 + + datos("1 - 5 * 2 / 20 + 1") //1,5! + datos ("(1 + 2) * 10 / 100") // 0.3 + datos("1+3.78") // 4.78 + datos("2.5 * 2 + 2 * pi") // 11.28 + datos("1 + 2 * (3 + (4 * 5 + 6 * 7 * 8) - 9) / 10") // 71 + datos("1+1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+1/15)/14)/13)/12)/11)/10)/9)/8)/7)/6)/5)/4)/3)/2") // 2.7182818284589946 + datos("((11+15)*15)*2-(3)*4*1") // 768 + datos(" 2*(-3)-(-4)+(-0.25)") //-2.25 + datos(" 2-25 % 3+1") // 2 + datos(" 2-(25 % 3)+1") // 2 + datos(" (2-25) % (3+1)") // -3 + datos(" 2- 25 % 3 % 2") // 1 + datos(" 2- 25 / 3 % 2") // 1.66666 + datos(" 2- ((25 / 3) % 2)") // 1.66666 + datos(" 2- 25 / 3 / 2") // 2.166666 + datos(" (-23) %3") // -2 + datos(" (6*pi-1)^0.5-e") // 1,506591651... + datos("2^2^3^4") + datos("(4-2*phi)*pi") // 2,3999632297286 + datos("( (1+sqrt(5))/2)^(2/pi)") // 1.3584562741830 + datos("1-(1+ln(ln(2)))/ln(2)") // 0.0860713320559 + datos("pi / (2 * ln(1+sqrt(2)))") // 1,7822139781 .... + datos("( (e^(pi/8)) * sqrt(pi)) /(4 * (2^(3/4)) * (fact(1/4))^2) ") //0,47494 93799... + datos(" fact(1/2)") // 0.906402477055... +back diff --git a/Task/Arithmetic-evaluation/AutoHotkey/arithmetic-evaluation-1.ahk b/Task/Arithmetic-evaluation/AutoHotkey/arithmetic-evaluation-1.ahk index d0230a6858..216449b35f 100644 --- a/Task/Arithmetic-evaluation/AutoHotkey/arithmetic-evaluation-1.ahk +++ b/Task/Arithmetic-evaluation/AutoHotkey/arithmetic-evaluation-1.ahk @@ -1,8 +1,8 @@ /* hand coded recursive descent parser -expr : term ( ( PLUS | MINUS ) term )* ; -term : factor ( ( MULT | DIV ) factor )* ; -factor : NUMBER | '(' expr ')'; +expr : term ( ( PLUS | MINUS ) term )* ; +term : factor ( ( MULT | DIV ) factor )* ; +factor : NUMBER | '(' expr ')'; */ calcLexer := makeCalcLexer() diff --git a/Task/Arithmetic-evaluation/C++/arithmetic-evaluation-1.cpp b/Task/Arithmetic-evaluation/C++/arithmetic-evaluation-1.cpp new file mode 100644 index 0000000000..52d4ee160e --- /dev/null +++ b/Task/Arithmetic-evaluation/C++/arithmetic-evaluation-1.cpp @@ -0,0 +1,240 @@ +#include +#include +#include +using namespace std; + +template +class stack { + private: + vector st; + T sentinel; + public: + stack() { sentinel = T(); } + bool empty() { return st.empty(); } + void push(T info) { st.push_back(info); } + T& top() { + if (!st.empty()) { + return st.back(); + } + return sentinel; + } + T pop() { + T ret = top(); + if (!st.empty()) st.pop_back(); + return ret; + } +}; + +//determine associativity of operator, returns true if left, false if right +bool leftAssociate(char c) { + switch (c) { + case '^': return false; + case '*': return true; + case '/': return true; + case '%': return true; + case '+': return true; + case '-': return true; + default: + break; + } + return false; +} + +//determins precedence level of operator +int precedence(char c) { + switch (c) { + case '^': return 7; + case '*': return 5; + case '/': return 5; + case '%': return 5; + case '+': return 3; + case '-': return 3; + default: + break; + } + return 0; +} + +//converts infix expression string to postfix expression string +string shuntingYard(string expr) { + stack ops; + string output; + for (char c : expr) { + if (c == '(') { + ops.push(c); + } else if (c == '+' || c == '-' || c == '*' || c == '/' || c == '^' || c == '%') { + if (precedence(c) < precedence(ops.top()) || + (precedence(c) == precedence(ops.top()) && leftAssociate(c))) { + output.push_back(' '); + output.push_back(ops.pop()); + output.push_back(' '); + ops.push(c); + } else { + ops.push(c); + output.push_back(' '); + } + } else if (c == ')') { + while (!ops.empty()) { + if (ops.top() != '(') { + output.push_back(ops.pop()); + } else { + ops.pop(); + break; + } + } + } else { + output.push_back(c); + } + } + while (!ops.empty()) + if (ops.top() != '(') + output.push_back(ops.pop()); + else ops.pop(); + cout<<"Postfix: "< lex(string pfExpr) { + vector tokens; + for (int i = 0; i < pfExpr.size(); i++) { + char c = pfExpr[i]; + if (isdigit(c)) { + string num; + do { + num.push_back(c); + c = pfExpr[++i]; + } while (i < pfExpr.size() && isdigit(c)); + tokens.push_back(Token(stof(num))); + i--; + continue; + } else if (c == '+' || c == '-' || c == '*' || c == '/' || c == '^' || c == '%') { + tokens.push_back(Token(c)); + } + } + return tokens; +} + +//structure used for nodes of expression tree +struct node { + Token token; + node* left; + node* right; + node(Token tok) : token(tok), left(nullptr), right(nullptr) { } +}; + +//builds expression tree from vector of tokens +node* buildTree(vector tokens) { + cout<<"Building Expression Tree: "< sf; + for (int i = 0; i < tokens.size(); i++) { + Token c = tokens[i]; + if (c.type == 1) { + node* x = new node(c); + x->right = sf.pop(); + x->left = sf.pop(); + sf.push(x); + cout<<"Push Operator Node: "<token.op<token.type == 0) { + for (int i = 0; i < recd; i++) cout<<" "; + cout<<"Value Node: "<token.num<token.num; + } + if (x->token.type == 1) { + for (int i = 0; i < recd; i++) cout<<" "; + cout<<"Operator Node: "<token.op<left); + double rhs = eval(x->right); + for (int i = 0; i < recd; i++) cout<<" "; + cout<token.op<<" "<token.op) { + case '^': return pow(lhs, rhs); + case '*': return lhs*rhs; + case '/': + if (rhs == 0) { + cout<<"Error: divide by zero."<= c 5) (order-ops %))) + (cond (even? c) (throw (Exception. "Must be an odd number of forms")) + (= c 1) (first %) + (= c 3) % + (>= c 5) (order-ops %))) %) s)) @@ -34,16 +34,16 @@ add-parens)) (def ops {'* * - '+ + - '- - - '/ /}) + '+ + + '- - + '/ /}) (def eval-ast (partial clojure.walk/postwalk - #(if (seq? %) - (let [[a o b] %] - ((ops o) a b)) - %))) + #(if (seq? %) + (let [[a o b] %] + ((ops o) a b)) + %))) (defn evaluate [s] "Parse and evaluate an infix arithmetic expression" diff --git a/Task/Arithmetic-evaluation/Crystal/arithmetic-evaluation.cr b/Task/Arithmetic-evaluation/Crystal/arithmetic-evaluation.cr new file mode 100644 index 0000000000..283db9c131 --- /dev/null +++ b/Task/Arithmetic-evaluation/Crystal/arithmetic-evaluation.cr @@ -0,0 +1,142 @@ +abstract class Expression + abstract def eval +end + +class IntLiteral < Expression + property value + + def initialize (@value : Int32) + end + + def eval + @value + end + + def to_s (io) + io << @value.to_s + end +end + +alias UnFun = Int32 -> Int32 +alias BinFun = Int32, Int32 -> Int32 + +class UnOp < Expression + getter operand : Expression, op : String + @function : UnFun + + def initialize (@operand, @op, &block : UnFun) + @function = block + end + + def eval + @function.call @operand.eval + end + + def to_s (io) + io << @op + @operand.to_s io + end +end + +class BinOp < Expression + getter left : Expression, right : Expression, op : String + @function : BinFun + + def initialize (@left, @right, @op, &block : BinFun) + @function = block + end + + def eval + @function.call @left.eval, @right.eval + end + + def to_s (io) + io << "(" + @left.to_s io + io << " " << @op << " " + @right.to_s io + io << ")" + end +end + +class Parser + UNOPS = { + '-' => { func: UnFun.new {|a| -a } } + } + BINOPS = { + '+' => { prio: 2, func: BinFun.new {|a, b| a + b } }, + '-' => { prio: 2, func: BinFun.new {|a, b| a - b } }, + '*' => { prio: 1, func: BinFun.new {|a, b| a * b } }, + '/' => { prio: 1, func: BinFun.new {|a, b| a // b } } + } + @chars : Array(Char) + + def initialize (s) + @chars = s.chars + end + + def consume (ch) + raise "'#{ch}' expected" unless @chars.present? && @chars.first == ch + @chars.shift + end + + def skip_spaces + while @chars.present? && @chars.first.whitespace? + @chars.shift + end + end + + def parse_unit + skip_spaces + raise "Unexpected end of input" if @chars.empty? + case @chars.first + when '(' + consume '(' + res = parse_binop prio: 2 + consume ')' + res + when .in? UNOPS.keys + op = @chars.shift + UnOp.new parse_unit, op.to_s, &UNOPS[op][:func] + when '0'..'9' + n = 0 + while @chars.present? && @chars.first.in? '0'..'9' + n = n * 10 + @chars.shift.to_i + end + IntLiteral.new n + else + raise "Unexpected '#{@chars.first}'" + end + end + + def parse_binop (prio) + left = if prio == 0 + parse_unit + else + parse_binop prio-1 + end + loop do + skip_spaces + return left if @chars.empty? + op = @chars.first + opdata = BINOPS[op]? + return left if !opdata || opdata[:prio] != prio + consume op + right = parse_binop prio-1 + left = BinOp.new left, right, op.to_s, &opdata[:func] + end + end + + def parse + res = parse_binop prio: 2 + skip_spaces + raise "Unexpected '#{@chars.first}'" unless @chars.empty? + res + end +end + +formula = "1 + 2*(3 - 2*(3 - 2)*((2 - 4)*5 - 22/(7 + 2*(3 - 1)) - 1)) + -1*-1" +ast = Parser.new(formula).parse +print "Original: ", formula, "\n" +print "Parsed: ", ast, "\n" +print "Result: ", ast.eval, "\n" diff --git a/Task/Arithmetic-evaluation/EasyLang/arithmetic-evaluation.easy b/Task/Arithmetic-evaluation/EasyLang/arithmetic-evaluation.easy index f8bbf4ec53..bf0629bde2 100644 --- a/Task/Arithmetic-evaluation/EasyLang/arithmetic-evaluation.easy +++ b/Task/Arithmetic-evaluation/EasyLang/arithmetic-evaluation.easy @@ -9,9 +9,7 @@ subr nch . # subr ntok - while ch$ = " " - nch - . + while ch$ = " " : nch if ch >= 48 and ch <= 58 tok$ = "n" s$ = "" @@ -33,14 +31,14 @@ subr init0 astright[] = [ ] err = 0 . -proc init s$ . . +proc init s$ . inp$[] = strchars s$ inp_ind = 1 nch ntok init0 . -proc ast_print nd . . +proc ast_print nd . write "AST:" for i to len astop$[] write " ( " diff --git a/Task/Arithmetic-evaluation/Elena/arithmetic-evaluation.elena b/Task/Arithmetic-evaluation/Elena/arithmetic-evaluation.elena index 5e072298d5..25d33f7820 100644 --- a/Task/Arithmetic-evaluation/Elena/arithmetic-evaluation.elena +++ b/Task/Arithmetic-evaluation/Elena/arithmetic-evaluation.elena @@ -94,10 +94,10 @@ singleton operatorState eval(ch) { ch => - $40 { // ( + $40 : { // ( ^ weak self.newBracket().gotoStarting() } - : { + ! : { ^ weak self.newToken().append(ch).gotoToken() } } @@ -108,23 +108,23 @@ singleton tokenState eval(ch) { ch => - $41 { // ) + $41 : { // ) ^ weak self.closeBracket().gotoToken() } - $42 { // * + $42 : { // * ^ weak self.newProduct().gotoOperator() } - $43 { // + + $43 : { // + ^ weak self.newSummary().gotoOperator() } - $45 { // - + $45 : { // - ^ weak self.newDifference().gotoOperator() } - $47 { // / + $47 : { // / ^ weak self.newFraction().gotoOperator() } - : { - ^ weak self.append:ch + ! : { + ^ weak self.append(ch) } } } @@ -134,25 +134,25 @@ singleton startState eval(ch) { ch => - $40 { // ( + $40 : { // ( ^ weak self.newBracket().gotoStarting() } - $45 { // - + $45 : { // - ^ weak self.newToken().append("0").newDifference().gotoOperator() } - : { - ^ weak self.newToken().append:ch.gotoToken() + ! : { + ^ weak self.newToken().append(ch).gotoToken() } } } class Scope { - object _state; - int _level; - object _parser; - object _token; - object _expression; + object _state; + int _level; + object _parser; + object? _token; + object _expression; constructor new(parser) { @@ -207,7 +207,7 @@ class Scope closeBracket() { if (_level < 10) - { InvalidArgumentException.new:"Invalid expression".raise() }; + { InvalidArgumentException.new("Invalid expression").raise() }; _level := _level - 10 } @@ -216,17 +216,17 @@ class Scope { if(ch >= $48 && ch < $58) { - _token.append:ch + _token.append(ch) } else { - InvalidArgumentException.new:"Invalid expression".raise() + InvalidArgumentException.new("Invalid expression").raise() } } append(string s) { - s.forEach:(ch){ self.append:ch } + s.forEach::(ch){ self.append(ch) } } gotoStarting() @@ -316,26 +316,26 @@ class Parser { var scope := Scope.new(self); - text.forEach:(ch){ scope.eval:ch }; + text.forEach::(ch){ scope.eval(ch) }; ^ scope.Number } } -public program() +public Program() { var text := new StringWriter(); var parser := new Parser(); - while (console.readLine().writeTo(text).Length > 0) + while (Console.readLine().writeTo(text).Length > 0) { try { - console.printLine("=",parser.run:text) + Console.printLine("=",parser.run(text as:string)) } catch(Exception e) { - console.writeLine:"Invalid Expression" + Console.writeLine("Invalid Expression") }; text.clear() diff --git a/Task/Arithmetic-evaluation/Elixir/arithmetic-evaluation.elixir b/Task/Arithmetic-evaluation/Elixir/arithmetic-evaluation.ex similarity index 100% rename from Task/Arithmetic-evaluation/Elixir/arithmetic-evaluation.elixir rename to Task/Arithmetic-evaluation/Elixir/arithmetic-evaluation.ex diff --git a/Task/Arithmetic-evaluation/Emacs-Lisp/arithmetic-evaluation.l b/Task/Arithmetic-evaluation/Emacs-Lisp/arithmetic-evaluation.el similarity index 100% rename from Task/Arithmetic-evaluation/Emacs-Lisp/arithmetic-evaluation.l rename to Task/Arithmetic-evaluation/Emacs-Lisp/arithmetic-evaluation.el diff --git a/Task/Arithmetic-evaluation/Jq/arithmetic-evaluation-4.jq b/Task/Arithmetic-evaluation/Jq/arithmetic-evaluation-4.jq index 1e12c8a998..e6cedfc6f7 100644 --- a/Task/Arithmetic-evaluation/Jq/arithmetic-evaluation-4.jq +++ b/Task/Arithmetic-evaluation/Jq/arithmetic-evaluation-4.jq @@ -10,7 +10,7 @@ def eval: elif .[-2] == "+" then $v + .[-1] elif .[-2] == "-" then $v - .[-1] else tostring|error - end + end end end else . diff --git a/Task/Arithmetic-evaluation/Julia/arithmetic-evaluation.julia b/Task/Arithmetic-evaluation/Julia/arithmetic-evaluation.jl similarity index 100% rename from Task/Arithmetic-evaluation/Julia/arithmetic-evaluation.julia rename to Task/Arithmetic-evaluation/Julia/arithmetic-evaluation.jl diff --git a/Task/Arithmetic-evaluation/Kotlin/arithmetic-evaluation.kotlin b/Task/Arithmetic-evaluation/Kotlin/arithmetic-evaluation.kts similarity index 100% rename from Task/Arithmetic-evaluation/Kotlin/arithmetic-evaluation.kotlin rename to Task/Arithmetic-evaluation/Kotlin/arithmetic-evaluation.kts diff --git a/Task/Arithmetic-evaluation/Lua/arithmetic-evaluation.lua b/Task/Arithmetic-evaluation/Lua/arithmetic-evaluation.lua index 8f01f75d1e..b5ab23f239 100644 --- a/Task/Arithmetic-evaluation/Lua/arithmetic-evaluation.lua +++ b/Task/Arithmetic-evaluation/Lua/arithmetic-evaluation.lua @@ -19,20 +19,20 @@ function eval(expr) --arithmetic functions tb = {["+"] = function(a,b) return eval(a) + eval(b) end, - ["-"] = function(a,b) return eval(a) - eval(b) end, - ["*"] = function(a,b) return eval(a) * eval(b) end, - ["/"] = function(a,b) return eval(a) / eval(b) end} + ["-"] = function(a,b) return eval(a) - eval(b) end, + ["*"] = function(a,b) return eval(a) * eval(b) end, + ["/"] = function(a,b) return eval(a) / eval(b) end} --you could add ^ or other operators to this pretty easily for i, v in ipairs{"*/", "+-"} do for s, u in ipairs(expr) do - local k = type(u) == "string" and C(S(v)):match(u) - if k then - expr[s-1] = tb[k](expr[s-1],expr[s+1]) - table.remove(expr, s) - table.remove(expr, s) - end - end + local k = type(u) == "string" and C(S(v)):match(u) + if k then + expr[s-1] = tb[k](expr[s-1],expr[s+1]) + table.remove(expr, s) + table.remove(expr, s) + end + end end return expr[1] end diff --git a/Task/Arithmetic-evaluation/M2000-Interpreter/arithmetic-evaluation-2.m2000 b/Task/Arithmetic-evaluation/M2000-Interpreter/arithmetic-evaluation-2.m2000 index cc109626f0..edff59268c 100644 --- a/Task/Arithmetic-evaluation/M2000-Interpreter/arithmetic-evaluation-2.m2000 +++ b/Task/Arithmetic-evaluation/M2000-Interpreter/arithmetic-evaluation-2.m2000 @@ -1,85 +1,85 @@ Module CheckAst { - class EvalAst { - private: - Function Ast(&in$) { - object Ast=stack, op=stack - Do - stack Ast {stack .Ast1(&in$)} - in$=Trim$(in$) - oper$=left$(in$,1) - if Instr("+-", oper$)>0 else exit - if len(oper$)>0 then stack op {push oper$} - in$=Mid$(in$, 2) - until len(in$)=0 - stack Ast {stack op} // dump op to end of stack Ast - =Ast - } - Function Ast1(&in$) { - object Ast=stack, op=stack - Do - stack Ast {stack .Ast2(&in$)} - in$=Trim$(in$) - oper$=left$(in$,1) - if Instr("*/", oper$)>0 else exit - if len(oper$)>0 then stack op {push oper$} - in$=Mid$(in$, 2) - until len(in$)=0 - stack Ast {stack op} - =Ast - } - Function Ast2(&in$) { - in$=Trim$(in$) - if Asc(in$)<>40 then =.GetNumber(&in$) : exit - in$=Mid$(in$, 2) - =.Ast(&in$) - in$=Mid$(in$, 2) - } - Function GetNumber (&in$) { - Def ch$, num$ - Do - ch$=left$(in$,1) - if instr("0123456789", ch$)>0 else exit - num$+=ch$ - in$=Mid$(in$, 2) - until len(in$)=0 - =stack:=val(num$) - } - public: - value () { - =.Ast(![]) - } - } - Ast=EvalAst() - Expr$ = "1+2 * (3 + (4 * 5 + 6 * 7 * 8) - 9) / 10" - // Expr$="1/2+(4-3)/2+1/2" - print "Result through eval$:";eval(Expr$) - print "Expr :";Expr$ - mres=Ast(&Expr$) - print "RPN :";array(stack(mres))#str$() - reg=stack - stack mres { - while not empty - if islet then - read op$ - stack reg { - select case op$ - case "+" - push number+number - case "-" - shift 2:push number-number - case "*" - push number*number - case "/" - shift 2:push number/number // shif 2 swap top 2 values - end select - } - else - read v - stack reg {push v} - end if - end while - } - if len(reg)<>1 then Error "Wrong Evaluation" - print "Result :";stackitem(reg) + class EvalAst { + private: + Function Ast(&in$) { + object Ast=stack, op=stack + Do + stack Ast {stack .Ast1(&in$)} + in$=Trim$(in$) + oper$=left$(in$,1) + if Instr("+-", oper$)>0 else exit + if len(oper$)>0 then stack op {push oper$} + in$=Mid$(in$, 2) + until len(in$)=0 + stack Ast {stack op} // dump op to end of stack Ast + =Ast + } + Function Ast1(&in$) { + object Ast=stack, op=stack + Do + stack Ast {stack .Ast2(&in$)} + in$=Trim$(in$) + oper$=left$(in$,1) + if Instr("*/", oper$)>0 else exit + if len(oper$)>0 then stack op {push oper$} + in$=Mid$(in$, 2) + until len(in$)=0 + stack Ast {stack op} + =Ast + } + Function Ast2(&in$) { + in$=Trim$(in$) + if Asc(in$)<>40 then =.GetNumber(&in$) : exit + in$=Mid$(in$, 2) + =.Ast(&in$) + in$=Mid$(in$, 2) + } + Function GetNumber (&in$) { + Def ch$, num$ + Do + ch$=left$(in$,1) + if instr("0123456789", ch$)>0 else exit + num$+=ch$ + in$=Mid$(in$, 2) + until len(in$)=0 + =stack:=val(num$) + } + public: + value () { + =.Ast(![]) + } + } + Ast=EvalAst() + Expr$ = "1+2 * (3 + (4 * 5 + 6 * 7 * 8) - 9) / 10" + // Expr$="1/2+(4-3)/2+1/2" + print "Result through eval$:";eval(Expr$) + print "Expr :";Expr$ + mres=Ast(&Expr$) + print "RPN :";array(stack(mres))#str$() + reg=stack + stack mres { + while not empty + if islet then + read op$ + stack reg { + select case op$ + case "+" + push number+number + case "-" + shift 2:push number-number + case "*" + push number*number + case "/" + shift 2:push number/number // shif 2 swap top 2 values + end select + } + else + read v + stack reg {push v} + end if + end while + } + if len(reg)<>1 then Error "Wrong Evaluation" + print "Result :";stackitem(reg) } CheckAst diff --git a/Task/Arithmetic-evaluation/MiniScript/arithmetic-evaluation.mini b/Task/Arithmetic-evaluation/MiniScript/arithmetic-evaluation.mini index c7e674dd44..f57883ff12 100644 --- a/Task/Arithmetic-evaluation/MiniScript/arithmetic-evaluation.mini +++ b/Task/Arithmetic-evaluation/MiniScript/arithmetic-evaluation.mini @@ -3,60 +3,60 @@ Expr.eval = 0 BinaryExpr = new Expr BinaryExpr.eval = function() - if self.op == "+" then return self.lhs.eval + self.rhs.eval - if self.op == "-" then return self.lhs.eval - self.rhs.eval - if self.op == "*" then return self.lhs.eval * self.rhs.eval - if self.op == "/" then return self.lhs.eval / self.rhs.eval + if self.op == "+" then return self.lhs.eval + self.rhs.eval + if self.op == "-" then return self.lhs.eval - self.rhs.eval + if self.op == "*" then return self.lhs.eval * self.rhs.eval + if self.op == "/" then return self.lhs.eval / self.rhs.eval end function binop = function(lhs, op, rhs) - e = new BinaryExpr - e.lhs = lhs - e.op = op - e.rhs = rhs - return e + e = new BinaryExpr + e.lhs = lhs + e.op = op + e.rhs = rhs + return e end function parseAtom = function(inp) - tok = inp.pull - if tok >= "0" and tok <= "9" then - e = new Expr - e.eval = val(tok) - while inp and inp[0] >= "0" and inp[0] <= "9" - e.eval = e.eval * 10 + val(inp.pull) - end while - else if tok == "(" then - e = parseAddSub(inp) - inp.pull // swallow closing ")" - return e - else - print "Unexpected token: " + tok - exit - end if - return e + tok = inp.pull + if tok >= "0" and tok <= "9" then + e = new Expr + e.eval = val(tok) + while inp and inp[0] >= "0" and inp[0] <= "9" + e.eval = e.eval * 10 + val(inp.pull) + end while + else if tok == "(" then + e = parseAddSub(inp) + inp.pull // swallow closing ")" + return e + else + print "Unexpected token: " + tok + exit + end if + return e end function parseMultDiv = function(inp) - next = @parseAtom - e = next(inp) - while inp and (inp[0] == "*" or inp[0] == "/") - e = binop(e, inp.pull, next(inp)) - end while - return e + next = @parseAtom + e = next(inp) + while inp and (inp[0] == "*" or inp[0] == "/") + e = binop(e, inp.pull, next(inp)) + end while + return e end function parseAddSub = function(inp) - next = @parseMultDiv - e = next(inp) - while inp and (inp[0] == "+" or inp[0] == "-") - e = binop(e, inp.pull, next(inp)) - end while - return e + next = @parseMultDiv + e = next(inp) + while inp and (inp[0] == "+" or inp[0] == "-") + e = binop(e, inp.pull, next(inp)) + end while + return e end function while true - s = input("Enter expression: ").replace(" ","") - if not s then break - inp = split(s, "") - ast = parseAddSub(inp) - print ast.eval + s = input("Enter expression: ").replace(" ","") + if not s then break + inp = split(s, "") + ast = parseAddSub(inp) + print ast.eval end while diff --git a/Task/Arithmetic-evaluation/OCaml/arithmetic-evaluation-1.ocaml b/Task/Arithmetic-evaluation/OCaml/arithmetic-evaluation-1.ml similarity index 100% rename from Task/Arithmetic-evaluation/OCaml/arithmetic-evaluation-1.ocaml rename to Task/Arithmetic-evaluation/OCaml/arithmetic-evaluation-1.ml diff --git a/Task/Arithmetic-evaluation/OCaml/arithmetic-evaluation-2.ocaml b/Task/Arithmetic-evaluation/OCaml/arithmetic-evaluation-2.ml similarity index 100% rename from Task/Arithmetic-evaluation/OCaml/arithmetic-evaluation-2.ocaml rename to Task/Arithmetic-evaluation/OCaml/arithmetic-evaluation-2.ml diff --git a/Task/Arithmetic-evaluation/PascalABC.NET/arithmetic-evaluation.pas b/Task/Arithmetic-evaluation/PascalABC.NET/arithmetic-evaluation.pas new file mode 100644 index 0000000000..b19c2a67d1 --- /dev/null +++ b/Task/Arithmetic-evaluation/PascalABC.NET/arithmetic-evaluation.pas @@ -0,0 +1,127 @@ +type + IExprNode = interface + function Evaluate: real; + end; + + NumberNode = auto class(IExprNode) + public + value: real; + function Evaluate: real := value; + end; + + BinaryOpNode = auto class(IExprNode) + public + op: char; + left, right: IExprNode; + + function Evaluate: real; + begin + case op of + '+': Result := left.Evaluate + right.Evaluate; + '-': Result := left.Evaluate - right.Evaluate; + '*': Result := left.Evaluate * right.Evaluate; + '/': Result := left.Evaluate / right.Evaluate; + else + raise new Exception($'Unknown operator {op}'); + end; + end; + end; + + ExpressionParser = class + s: string; + pos: integer; + + constructor Create(input: string); + begin + s := input; + pos := 1; + end; + + function NextChar: char := + if pos <= s.Length then s[pos] else #0; + + procedure SkipSpaces := + while NextChar = ' ' do pos += 1; + + function ParseNumber: IExprNode; + begin + SkipSpaces; + var start := pos; + while NextChar.IsDigit do pos += 1; + if NextChar = '.' then + begin + pos += 1; + while NextChar.IsDigit do pos += 1; + end; + var value := s[start:pos].ToReal; + Result := new NumberNode(value); + end; + + function ParseFactor: IExprNode; + begin + SkipSpaces; + if NextChar = '(' then + begin + pos += 1; + Result := ParseExpr; + SkipSpaces; + if NextChar = ')' then + pos += 1 + else raise new Exception('Expected )'); + end + else + Result := ParseNumber; + end; + + function ParseTerm: IExprNode; + begin + Result := ParseFactor; + while true do + begin + SkipSpaces; + var ch := NextChar; + if (ch = '*') or (ch = '/') then + begin + pos += 1; + Result := new BinaryOpNode(ch, Result, ParseFactor); + end + else break; + end; + end; + + function ParseExpr: IExprNode; + begin + Result := ParseTerm; + while true do + begin + SkipSpaces; + var ch := NextChar; + if (ch = '+') or (ch = '-') then + begin + pos += 1; + Result := new BinaryOpNode(ch, Result, ParseTerm); + end + else break; + end; + end; + + function Parse: IExprNode := ParseExpr; + + end; + +begin + var inputs := [ + '2+3*(4-1)', + '10 + 2 / 3', + '(7+3)*(2+2)', + '8*(5+(2-3))', + '1/3', + '2.5 + 4.1 * (3 - 1.1/2)']; + + foreach var expr in inputs do + begin + var parser := new ExpressionParser(expr); + var tree := parser.Parse; + Println($'{expr} = {tree.Evaluate:0.###}'); + end; +end. diff --git a/Task/Arithmetic-evaluation/Perl/arithmetic-evaluation.pl b/Task/Arithmetic-evaluation/Perl/arithmetic-evaluation-1.pl similarity index 100% rename from Task/Arithmetic-evaluation/Perl/arithmetic-evaluation.pl rename to Task/Arithmetic-evaluation/Perl/arithmetic-evaluation-1.pl diff --git a/Task/Arithmetic-evaluation/Perl/arithmetic-evaluation-2.pl b/Task/Arithmetic-evaluation/Perl/arithmetic-evaluation-2.pl new file mode 100644 index 0000000000..47161a8da0 --- /dev/null +++ b/Task/Arithmetic-evaluation/Perl/arithmetic-evaluation-2.pl @@ -0,0 +1,49 @@ +#!/usr/bin/perl + +use strict; # https://rosettacode.org/wiki/Arithmetic_evaluation +use warnings; + +sub node { bless [ splice @_, 1 ], shift } +sub error { die s/\G.*//sr =~ tr/\t/ /cr, "^ @_ !\n" } +sub want { /\G$_[1]/gc ? shift : error pop } + +sub expr + { + /\G\h+/gc; + my $ast = + /\G\d+/gc ? node NUMBER => $& : + /\G\(/gc ? want expr(0), qr/\)/, 'Missing Right Paren' : + error 'Operand Expected'; + /\G\h+/gc, $ast = + $_[0] <= 0 && /\G\+/gc ? node ADD => $ast, expr(1) : + $_[0] <= 0 && /\G\-/gc ? node SUBTRACT => $ast, expr(1) : + $_[0] <= 1 && /\G\*/gc ? node MULTIPLY => $ast, expr(2) : + $_[0] <= 1 && /\G\//gc ? node DIVIDE => $ast, expr(2) : + return $ast while 1; + } + +sub ADD::value { $_[0][0]->value + $_[0][1]->value } +sub SUBTRACT::value { $_[0][0]->value - $_[0][1]->value } +sub MULTIPLY::value { $_[0][0]->value * $_[0][1]->value } +sub DIVIDE::value { $_[0][0]->value / $_[0][1]->value } +sub NUMBER::value { $_[0][0] } + +sub NUMBER::show { "$_[0][0]\n" } +sub UNIVERSAL::show + { ref($_[0]) . "\n" . join('', map $_->show, @{$_[0]}) =~ s/^/ /gmr } + +while( ) + { + eval + { + print; + my $ast = want expr(0), "\n", 'Incomplete Parse'; + print $ast->show, "value of ast = ", $ast->value, "\n\n"; + } or print "$@\n"; + } + +__DATA__ +(1+3)*7 +2 * 3 + 4 * 5 +2 + 3 * 4 + 5 +2 + 3 ** 4 + 5 diff --git a/Task/Arithmetic-evaluation/Phix/arithmetic-evaluation.phix b/Task/Arithmetic-evaluation/Phix/arithmetic-evaluation.phix index c9f6b820f0..6d75ab77e6 100644 --- a/Task/Arithmetic-evaluation/Phix/arithmetic-evaluation.phix +++ b/Task/Arithmetic-evaluation/Phix/arithmetic-evaluation.phix @@ -1,221 +1,201 @@ -(phixonline)--> - -- demo\rosetta\Arithmetic_evaluation.exw - with javascript_semantics +-- demo\rosetta\Arithmetic_evaluation.exw +sequence opstack = {} -- atom elements are literals, + -- sequence elements are subexpressions + -- on completion length(opstack) should be 1 +object token - sequence opstack = {} -- atom elements are literals, - -- sequence elements are subexpressions - -- on completion length(opstack) should be 1 - object token +constant p_p_op = -1, -- expressions stored as p1,p2,op + p_op_p = 0, -- expressions stored as p1,op,p2 + op_p_p = +1, -- expressions stored as op,p1,p2 + opp = op_p_p - constant op_p_p = 1 -- 1: expressions stored as op,p1,p2 - -- p_op_p -- 0: expressions stored as p1,op,p2 - -- p_p_op -- -1: expressions stored as p1,p2,op +object op = 0 -- 0 if none, else "+", "-", "*", "/", "^", "%", or "u-" - object op = 0 -- 0 if none, else "+", "-", "*", "/", "^", "%", or "u-" +string s -- the expression being parsed +integer ch +integer sidx - string s -- the expression being parsed - integer ch - integer sidx +procedure err(string msg) + crash("%s\n%s^ %s\n\nPressEnter...",{s,repeat(' ',sidx-1),msg}) +end procedure - procedure err(string msg) - printf(1,"%s\n%s^ %s\n\nPressEnter...",{s,repeat(' ',sidx-1),msg}) - {} = wait_key() - abort(0) - end procedure +procedure nxtch(object msg="eof") + sidx += 1 + if sidx>length(s) then + if string(msg) then err(msg) end if + ch = -1 + else + ch = s[sidx] + end if +end procedure - procedure nxtch(object msg="eof") - sidx += 1 - if sidx>length(s) then - if string(msg) then err(msg) end if - ch = -1 - else - ch = s[sidx] - end if - end procedure +procedure skipspaces() + while find(ch," \t\r\n") do nxtch(0) end while +end procedure - procedure skipspaces() - while find(ch,{' ','\t','\r','\n'})!=0 do nxtch(0) end while - end procedure +procedure get_token() + skipspaces() + if ch=-1 then token = "eof" return end if + if ch>='0' and ch<='9' then + atom n = ch-'0' + while 1 do + nxtch(0) + if ch<'0' or ch>'9' then exit end if + n = n*10+(ch-'0') + end while + if ch='.' then + integer decimal = 1 + atom fraction = 0 + while true do + nxtch(0) + if ch<'0' or ch>'9' then exit end if + fraction = fraction*10 + (ch-'0') + decimal *= 10 + end while + n += fraction/decimal + end if +-- if find(ch,"eE") then -- you get the idea +-- end if + token = n + return + end if + if find(ch,"+-/*()^%")=0 then err("syntax error") end if + token = s[sidx..sidx] + nxtch(0) + return +end procedure - procedure get_token() - atom n, fraction - integer dec - skipspaces() - if ch=-1 then token = "eof" return end if - if ch>='0' and ch<='9' then - n = ch-'0' - while 1 do - nxtch(0) - if ch<'0' or ch>'9' then exit end if - n = n*10+ch-'0' - end while - if ch='.' then - dec = 1 - fraction = 0 - while 1 do - nxtch(0) - if ch<'0' or ch>'9' then exit end if - fraction = fraction*10 + ch-'0' - dec *= 10 - end while - n += fraction/dec - end if - -- if find(ch,"eE") then -- you get the idea - -- end if - token = n - return - end if - if find(ch,"+-/*()^%")=0 then err("syntax error") end if - token = s[sidx..sidx] - nxtch(0) - return - end procedure +procedure Match(string t) + if token!=t then err(t&" expected") end if + get_token() +end procedure - procedure Match(string t) - if token!=t then err(t&" expected") end if - get_token() - end procedure +procedure PopFactor() + object p1, p2 = opstack[$], f + if op="u-" then + p1 = 0 + else + opstack = opstack[1..$-1] + p1 = opstack[$] + end if + switch opp do + case op_p_p: f = {op,p1,p2} + case p_op_p: f = {p1,op,p2} + case p_p_op: f = {p1,p2,op} + end switch + opstack[$] = f + op = 0 +end procedure - procedure PopFactor() - object p1, p2 = opstack[$] - if op="u-" then - p1 = 0 - else - opstack = opstack[1..$-1] - p1 = opstack[$] - end if - if op_p_p=1 then - opstack[$] = {op,p1,p2} -- op_p_p - elsif op_p_p=0 then - opstack[$] = {p1,op,p2} -- p_op_p - else -- -1 - opstack[$] = {p1,p2,op} -- p_p_op - end if - op = 0 - end procedure +procedure PushFactor(atom t) + if op!=0 then PopFactor() end if + opstack = append(opstack,t) +end procedure - procedure PushFactor(atom t) - if op!=0 then PopFactor() end if - opstack = append(opstack,t) - end procedure +procedure PushOp(string t) + if op!=0 then PopFactor() end if + op = t +end procedure - procedure PushOp(string t) - if op!=0 then PopFactor() end if - op = t - end procedure +forward procedure Expr(integer p) - forward procedure Expr(integer p) +procedure Factor() + if atom(token) then + PushFactor(token) + if ch!=-1 then + get_token() + end if + elsif token="+" then -- (ignore) + nxtch() + Factor() + elsif token="-" then + get_token() +-- Factor() + Expr(3) -- makes "-3^2" yield -9 (ie -(3^2)) not 9 (ie (-3)^2). + if op!=0 then PopFactor() end if + if integer(opstack[$]) then + opstack[$] = -opstack[$] + else + PushOp("u-") + end if + elsif token="(" then + get_token() + Expr(0) + Match(")") + else + err("syntax error") + end if +end procedure - procedure Factor() - if atom(token) then - PushFactor(token) - if ch!=-1 then - get_token() - end if - elsif token="+" then -- (ignore) - nxtch() - Factor() - elsif token="-" then - get_token() - -- Factor() - Expr(3) -- makes "-3^2" yield -9 (ie -(3^2)) not 9 (ie (-3)^2). - if op!=0 then PopFactor() end if - if integer(opstack[$]) then - opstack[$] = -opstack[$] - else - PushOp("u-") - end if - elsif token="(" then - get_token() - Expr(0) - Match(")") - else - err("syntax error") - end if - end procedure +constant {operators, + precedence, + associativity} = columnize({{"^",3,0}, + {"%",2,1}, + {"*",2,1}, + {"/",2,1}, + {"+",1,1}, + {"-",1,1}, + $}) - constant {operators, - precedence, - associativity} = columnize({{"^",3,0}, - {"%",2,1}, - {"*",2,1}, - {"/",2,1}, - {"+",1,1}, - {"-",1,1}, - $}) +procedure Expr(integer p) +-- +-- Parse an expression, using precedence climbing. +-- +-- p is the precedence level we should parse to, eg/ie +-- 4: Factor only (may as well just call Factor) +-- 3: "" and ^ +-- 2: "" and *,/,% +-- 1: "" and +,- +-- 0: full expression (effectively the same as 1) +-- obviously, parentheses override any setting of p. +-- + Factor() + while 1 do + integer k = find(token,operators) -- *,/,+,- + if k=0 then exit end if + integer thisp = precedence[k] + if thisp

    procedure Expr(integer p) - -- - -- Parse an expression, using precedence climbing. - -- - -- p is the precedence level we should parse to, eg/ie - -- 4: Factor only (may as well just call Factor) - -- 3: "" and ^ - -- 2: "" and *,/,% - -- 1: "" and +,- - -- 0: full expression (effectively the same as 1) - -- obviously, parentheses override any setting of p. - -- - integer k, thisp - Factor() - while 1 do - k = find(token,operators) -- *,/,+,- - if k=0 then exit end if - thisp = precedence[k] - if thisp<p then exit end if - get_token() - Expr(thisp+associativity[k]) - PushOp(operators[k]) - end while - end procedure +function evaluate(object s) + object lhs, rhs + string op + if atom(s) then return s end if + switch opp do + case op_p_p: {op,lhs,rhs} = s + case p_op_p: {lhs,op,rhs} = s + case p_p_op: {lhs,rhs,op} = s + default: ?9/0 + end switch + if sequence(lhs) then lhs = evaluate(lhs) end if + if sequence(rhs) then rhs = evaluate(rhs) end if + if op="+" then return lhs+rhs + elsif op="-" then return lhs-rhs + elsif op="*" then return lhs*rhs + elsif op="/" then return lhs/rhs + elsif op="^" then return power(lhs,rhs) + elsif op="%" then return rmdr(lhs,rhs) + elsif op="u-" then return -rhs + else ?9/0 + end if +end function - function evaluate(object s) - object lhs, rhs - string op - if atom(s) then - return s - end if - if op_p_p=1 then -- op_p_p - {op,lhs,rhs} = s - elsif op_p_p=0 then -- p_op_p - {lhs,op,rhs} = s - else -- -1 -- p_p_op - {lhs,rhs,op} = s - end if - if sequence(lhs) then lhs = evaluate(lhs) end if - if sequence(rhs) then rhs = evaluate(rhs) end if - if op="+" then - return lhs+rhs - elsif op="-" then - return lhs-rhs - elsif op="*" then - return lhs*rhs - elsif op="/" then - return lhs/rhs - elsif op="^" then - return power(lhs,rhs) - elsif op="%" then - return remainder(lhs,rhs) - elsif op="u-" then - return -rhs - else - ?9/0 - end if - end function - - s = "3+4+5+6*7/1*5^2^3" -- 16406262 - sidx = 0 - nxtch() - get_token() - Expr(0) - if op!=0 then PopFactor() end if - if length(opstack)!=1 then err("some error") end if - printf(1,"expression: \"%s\"\n",{s}) - puts(1,"AST (flat): ") - ?opstack[1] - puts(1,"AST (tree):\n") - ppEx(opstack[1],{pp_Nest,9999}) - puts(1,"result: ") - ?evaluate(opstack[1]) - {} = wait_key() - - with javascript_semantics - sequence arithmetic = {1} - integer composite = 0 +with javascript_semantics +sequence arithmetic = {1} +integer composite = 0 - function get_arithmetic(integer nth) - integer n = arithmetic[$]+1 - while length(arithmetic)<nth do - sequence divs = factors(n,1) - if remainder(sum(divs),length(divs))=0 then - composite += length(divs)>2 - arithmetic &= n - end if - n += 1 - end while - return arithmetic[nth] - end function +procedure get_arithmetics(integer nth) + integer n = arithmetic[$]+1 + while length(arithmetic)2 + arithmetic &= n + end if + n += 1 + end while +end procedure - {} = get_arithmetic(100) - printf(1,"The first 100 arithmetic numbers are:\n%s\n", - {join_by(arithmetic,1,10," ",fmt:="%3d")}) - constant fmt = "The %,dth arithmetic number is %,d up to which %,d are composite.\n" - for n in {1e3,1e4,1e5,1e6} do - integer nth = get_arithmetic(n) - printf(1,fmt,{n,nth,composite}) - end for -(quotient,remainder) - if(r==0) return(self.fcn(q,k,acc.write(k),q.toFloat().sqrt())); - return(self.fcn(n,k+1+k.isOdd,acc,maxD)) + q,r:=n.divr(k); // divr-->(quotient,remainder) + if(r==0) return(self.fcn(q,k,acc.write(k),q.toFloat().sqrt())); + return(self.fcn(n,k+1+k.isOdd,acc,maxD)) } }(n,2,Sink(List),n.toFloat().sqrt()); m:=acc.reduce('*,1); // mulitply factors diff --git a/Task/Average-loop-length/Ada/average-loop-length.ada b/Task/Average-loop-length/Ada/average-loop-length.adb similarity index 100% rename from Task/Average-loop-length/Ada/average-loop-length.ada rename to Task/Average-loop-length/Ada/average-loop-length.adb diff --git a/Task/Average-loop-length/Crystal/average-loop-length.cr b/Task/Average-loop-length/Crystal/average-loop-length.cr new file mode 100644 index 0000000000..713284e441 --- /dev/null +++ b/Task/Average-loop-length/Crystal/average-loop-length.cr @@ -0,0 +1,26 @@ +struct Int + def factorial + raise "only positive" if self < 0 + (1_i64..self.to_i64).product + end +end + +def rand_until_rep (n) + rands = {} of Int32 => Bool + loop do + r = rand(1..n) + return rands.size if rands[r]? + rands[r] = true + end +end + +runs = 1_000_000 + +puts " N average exp. diff ", + "=== ======== ======== ===========" +(1..20).each do |n| + sum_of_runs = runs.times.sum(0_i64) { rand_until_rep(n) } + avg = sum_of_runs / runs + analytical = (1..n).sum(0.0) {|i| (n.factorial / (n.to_f**i) / (n-i).factorial) } + puts "%3d %8.4f %8.4f (%8.4f%%)" % {n, avg, analytical, (avg/analytical - 1)*100} +end diff --git a/Task/Average-loop-length/Delphi/average-loop-length.delphi b/Task/Average-loop-length/Delphi/average-loop-length.pas similarity index 100% rename from Task/Average-loop-length/Delphi/average-loop-length.delphi rename to Task/Average-loop-length/Delphi/average-loop-length.pas diff --git a/Task/Average-loop-length/EasyLang/average-loop-length.easy b/Task/Average-loop-length/EasyLang/average-loop-length.easy new file mode 100644 index 0000000000..d036ff7912 --- /dev/null +++ b/Task/Average-loop-length/EasyLang/average-loop-length.easy @@ -0,0 +1,37 @@ +fastfunc average n reps . + len f[] n + len seen[] n + for r to reps + for i = 1 to n + f[i] = random 1 n + seen[i] = 0 + . + x = 1 + while seen[x] = 0 + seen[x] = 1 + x = f[x] + count += 1 + . + . + return count / reps +. +fastfunc analytical n . + s = 1 + t = 1 + for i = n - 1 downto 1 + t = t * i / n + s += t + . + return s +. +print " N average analytical (error)" +print "=== ======= ========== =======" +for n to 20 + avg = average n 1e6 + ana = analytical n + err = (avg - ana) / ana * 100 + numfmt 2 0 + write n + numfmt 9 4 + print avg & ana & err & "%" +. diff --git a/Task/Average-loop-length/Elixir/average-loop-length.elixir b/Task/Average-loop-length/Elixir/average-loop-length.ex similarity index 100% rename from Task/Average-loop-length/Elixir/average-loop-length.elixir rename to Task/Average-loop-length/Elixir/average-loop-length.ex diff --git a/Task/Average-loop-length/JavaScript/average-loop-length.js b/Task/Average-loop-length/JavaScript/average-loop-length.js new file mode 100644 index 0000000000..68e1ae0b93 --- /dev/null +++ b/Task/Average-loop-length/JavaScript/average-loop-length.js @@ -0,0 +1,49 @@ +const MAX_N = 20 +const TIMES = 1000000 + +function factorial(n) { + let prod = 1; + for (let i = n; i > 1; i--) { + prod *= i; + } + return prod; +} + +function getRandomInt(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min + 1)) + min; +} + + +function analytical(n) { + let items = []; + + for (let i = 1; i < n+1; i++) { + items.push(factorial(n) / Math.pow(n, i) / factorial(n - i)); + } + + return items.reduce((p, v) => p + v, 0); +} + +function test(n, times) { + let count = 0; + for (let i = 0; i < times; i++) { + let x = 1, bits = 0; + + while (!(bits & x)) { + count += 1; + bits |= x; + x = 1 << getRandomInt(0, n-1); + } + } + return count / times; +} + +console.log(" n\tavg\texp.\tdiff\n-------------------------------"); +for(let n = 1; n < MAX_N+1; n++) { + const avg = test(n, TIMES); + const theory = analytical(n); + const diff = (avg / theory - 1) * 100; + console.log(`${n.toString().padStart(2)} ${avg.toFixed(4).padStart(8)} ${theory.toFixed(4).padStart(8)} ${diff.toFixed(3).padStart(6)}%`); +} diff --git a/Task/Average-loop-length/Julia/average-loop-length.julia b/Task/Average-loop-length/Julia/average-loop-length.jl similarity index 100% rename from Task/Average-loop-length/Julia/average-loop-length.julia rename to Task/Average-loop-length/Julia/average-loop-length.jl diff --git a/Task/Average-loop-length/Kotlin/average-loop-length.kotlin b/Task/Average-loop-length/Kotlin/average-loop-length.kts similarity index 100% rename from Task/Average-loop-length/Kotlin/average-loop-length.kotlin rename to Task/Average-loop-length/Kotlin/average-loop-length.kts diff --git a/Task/Average-loop-length/Phix/average-loop-length.phix b/Task/Average-loop-length/Phix/average-loop-length.phix index bb282fbcdf..275c4a1507 100644 --- a/Task/Average-loop-length/Phix/average-loop-length.phix +++ b/Task/Average-loop-length/Phix/average-loop-length.phix @@ -1,35 +1,31 @@ -(phixonline)--> - constant MAX = 20, - ITER = 1000000 +with javascript_semantics +constant MAX = 20, + ITER = 1000000 - function expected(integer n) - atom sum = 0 - for i=1 to n do - sum += factorial(n) / power(n,i) / factorial(n-i) - end for - return sum - end function +function expected(integer n) + atom res = 0 + for i=1 to n do + res += factorial(n)/power(n,i)/factorial(n-i) + end for + return res +end function - function test(integer n) - integer count = 0, x, bits - for i=1 to ITER do - x = 1 - bits = 0 - while not and_bits(bits,x) do - count += 1 - bits = or_bits(bits,x) - x = power(2,rand(n)-1) - end while - end for - return count/ITER - end function +function test(integer n) + integer count = 0 + for i=1 to ITER do + integer x = 1, bits = 0 + while not and_bits(bits,x) do + count += 1 + bits = or_bits(bits,x) + x = power(2,rand(n)-1) + end while + end for + return count/ITER +end function - atom av, ex - puts(1," n avg. exp. (error%)\n"); - puts(1,"== ====== ====== ========\n"); - for n=1 to MAX do - av = test(n) - ex = expected(n) - printf(1,"%2d %8.4f %8.4f (%5.3f%%)\n", {n,av,ex,abs(1-av/ex)*100}) - end for - - with javascript_semantics - function MeanAngle(sequence angles) - atom x = 0, y = 0 - for i=1 to length(angles) do - atom ai_rad = angles[i]*PI/180 - x += cos(ai_rad) - y += sin(ai_rad) - end for - if abs(x)<1e-16 then return "not meaningful" end if - return sprintf("%g",round(atan2(y,x)*180/PI,1e10)) - end function +with javascript_semantics +function MeanAngle(sequence angles) + atom x = 0, y = 0 + for a in sq_mul(angles,PI/180) do + x += cos(a) + y += sin(a) + end for + if abs(x)<1e-15 then return "not meaningful" end if + return sprintf("%g",round(atan2(y,x)*180/PI,1e10)) +end function - constant AngleLists = {{350,10},{90,180,270,360},{10,20,30},{180},{0,180}} - for i=1 to length(AngleLists) do - sequence ai = AngleLists[i] - printf(1,"%16V: Mean Angle is %s\n",{ai,MeanAngle(ai)}) - end for - - with javascript_semantics - function MeanAngle(sequence angles) - atom x = 0, y = 0 - for i=1 to length(angles) do - atom ai_rad = angles[i]*PI/180 - x += cos(ai_rad) - y += sin(ai_rad) - end for - if abs(x)<1e-16 then return "not meaningful" end if - return atan2(y,x)*180/PI - end function +with javascript_semantics +function MeanAngle(sequence angles) + atom x = 0, y = 0 + for i=1 to length(angles) do + atom ai_rad = angles[i]*PI/180 + x += cos(ai_rad) + y += sin(ai_rad) + end for + if abs(x)<1e-16 then return "not meaningful" end if + return atan2(y,x)*180/PI +end function - function toSecAngle(integer hours, integer minutes, integer seconds) - return ((hours*60+minutes)*60+seconds)/(24*60*60)*360 - end function +function toSecAngle(integer hours, integer minutes, integer seconds) + return ((hours*60+minutes)*60+seconds)/(24*60*60)*360 +end function - constant Times = {toSecAngle(23,00,17), - toSecAngle(23,40,20), - toSecAngle(00,12,45), - toSecAngle(00,17,19)} +constant Times = {toSecAngle(23,00,17), + toSecAngle(23,40,20), + toSecAngle(00,12,45), + toSecAngle(00,17,19)} - function toHMS(object s) - if not string(s) then - if s<0 then s+=360 end if - s = 24*60*60*s/360 - atom hours = floor(s/3600), - mins = floor(remainder(s,3600)/60), - secs = remainder(s,60) - s = sprintf("%02d:%02d:%02d",{hours,mins,secs}) - end if - return s - end function +function toHMS(object s) + if not string(s) then + if s<0 then s+=360 end if + s = 24*60*60*s/360 + atom hours = floor(s/3600), + mins = floor(remainder(s,3600)/60), + secs = remainder(s,60) + s = sprintf("%02d:%02d:%02d",{hours,mins,secs}) + end if + return s +end function - printf(1,"Mean Time is %s\n",{toHMS(MeanAngle(Times))}) - - function mode(sequence s) - -- returns a list of the most common values, each of which occurs the same number of times - integer nxt = 1, count = 1, maxc = 1 - sequence res = {} - if length(s)!=0 then - s = sort(s) - object prev = s[1] - for i=2 to length(s) do - if s[i]!=prev then - s[nxt] = {count,prev} - nxt += 1 - prev = s[i] - count = 1 - else - count += 1 - if count>maxc then - maxc = count - end if - end if - end for - s[nxt] = {count,prev} - res = "" - for i=1 to nxt do - if s[i][1]=maxc then - res = append(res,s[i][2]) - end if - end for - end if - return res - end function +with javascript_semantics +function mode(sequence s) +-- returns a list of the most common values, each of which occurs the same number of times + integer nxt = 1, count = 1, maxc = 1 + sequence res = {} + if length(s)!=0 then + s = sort(s) + object prev = s[1] + for i=2 to length(s) do + if s[i]!=prev then + s[nxt] = {count,prev} + nxt += 1 + prev = s[i] + count = 1 + else + count += 1 + if count>maxc then + maxc = count + end if + end if + end for + s[nxt] = {count,prev} + res = "" + for i=1 to nxt do + if s[i][1]=maxc then + res = append(res,s[i][2]) + end if + end for + end if + return res +end function - ?mode({1, 2, 5, -5, -9.5, 3.14159}) - ?mode({ 1, "blue", 2, 7.5, 5, "green", "red", 5, 2, "blue", "white" }) - ?mode({1, 2, 3, 1, 2, 4, 2, 5, 2, 3, 3, 1, 3, 6}) - ?mode({.2, .7, .1, .8, .2}) - ?mode({"two", 7, 1, 8, "two", 8}) - ?mode("Hello there world") - ?mode({}) - {} = wait_key() - - with javascript_semantics - sequence sma = {} -- ((period,history,circnxt)) (private to sma.e) - integer sma_free = 0 - - global function new_sma(integer period) - integer res - if sma_free then - res = sma_free - sma_free = sma[sma_free] - sma[res] = {period,{},0} - else - sma = append(sma,{period,{},0}) - res = length(sma) - end if - return res - end function - - global procedure add_sma(integer sidx, atom val) - integer period, circnxt - sequence history - {period,history,circnxt} = sma[sidx] - sma[sidx][2] = 0 -- (kill refcount) - if length(history)<period then - history = append(history,val) - else - circnxt += 1 - if circnxt>period then - circnxt = 1 - end if - sma[sidx][3] = circnxt - history[circnxt] = val - end if - sma[sidx][2] = history - end procedure - - global function get_sma_average(integer sidx) - sequence history = sma[sidx][2] - integer l = length(history) - if l=0 then return 0 end if - return sum(history)/l - end function - - global function moving_average(integer sidx, atom val) - add_sma(sidx,val) - return get_sma_average(sidx) - end function - - global procedure free_sma(integer sidx) - sma[sidx] = sma_free - sma_free = sidx - end procedure - - with javascript_semantics - include sma.e - - constant sma3 = new_sma(3) - constant sma5 = new_sma(5) - constant s = {1,2,3,4,5,5,4,3,2,1} - integer si - - for i=1 to length(s) do - si = s[i] - printf(1,"%2g: sma3=%8g, sma5=%8g\n",{si,moving_average(sma3,si),moving_average(sma5,si)}) - end for - - with javascript_semantics - for i=2 to 99736 by 2 do - if remainder(i*i,1000000)=269696 then ?i exit end if - end for - - with javascript_semantics - procedure solve_babbage_problem() -- (so that return quits 3 loops) - sequence cands = {0}, -- n-digit candidates (n initially 0) - nextc = {} -- n+1-digit candidates, aka next "" - integer p10 = 1, -- power of 10 for adding prefixes - r10 = 10, -- power of 10 for getting remainder - cc = 0 -- count of calculations - for digits=1 to 6 do -- aka 1..length("269696") - for prefix=0 to 9*p10 by p10 do - for cand in sq_add(prefix,cands) do - atom square = cand*cand - cc += 1 - if remainder(square,r10) = remainder(269696,r10) then - if digits=6 then - printf(1,"Solution: %d (%d calcs)\n",{cand,cc}) - return -- leave solve_babbage_problem() - end if - nextc &= cand -- add candidate for next iteration - end if - end for - end for - {cands,nextc} = {nextc,{}} - printf(1,"%d-digit candidates: %v\n",{digits,cands}) - p10 *= 10 - r10 *= 10 - end for - end procedure - solve_babbage_problem() - []. 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). + {N1 is N - 1, + R is random(2)}, + bracket(R), + gen_bracket(N1). bracket(0) --> ['[']. bracket(1) --> [']']. diff --git a/Task/Balanced-brackets/Rebol/balanced-brackets.rebol b/Task/Balanced-brackets/Rebol/balanced-brackets.rebol new file mode 100644 index 0000000000..63f0bd4e48 --- /dev/null +++ b/Task/Balanced-brackets/Rebol/balanced-brackets.rebol @@ -0,0 +1,21 @@ +Rebol [ + title: "Rosetta code: Balanced brackets" + file: %Balanced_brackets.r3 + url: https://rosettacode.org/wiki/Balanced_brackets +] + +;; Returns TRUE if all square brackets in `str` are properly nested and balanced +balanced?: function/with [str][parse str rule][ + ;; Recursive rule: a balanced group is [ followed by any nested balanced groups, then ] + balanced-brackets: [#"[" any balanced-brackets #"]"] + ;; Full string must consist entirely of balanced groups with nothing left over + rule: [any balanced-brackets end] +] + +;; Test: generate 10 random substrings of bracket pairs and check each +random/seed 2 +repeat i 10 [ + str: random copy/part "[][][][][][][][][][]" i * 2 ;; shuffle first i*2 chars + res: pick ["balanced" "unbalanced"] balanced? str ;; label the result + printf [-2 ". " 11] reduce [i res mold str] ;; print index, verdict, string +] diff --git a/Task/Balanced-brackets/Red/balanced-brackets.red b/Task/Balanced-brackets/Red/balanced-brackets.red index a5fc247878..40d773a9f3 100644 --- a/Task/Balanced-brackets/Red/balanced-brackets.red +++ b/Task/Balanced-brackets/Red/balanced-brackets.red @@ -5,18 +5,18 @@ balanced?: func [str][parse str rule] ; Tests tests: [ - good: ["" "[]" "[][]" "[[]]" "[[][]]" "[[[[[]]][][[]]]]"] - bad: ["[" "]" "][" "[[]" "[]]" "[]][[]" "[[[[[[]]]]]]]"] + good: ["" "[]" "[][]" "[[]]" "[[][]]" "[[[[[]]][][[]]]]"] + bad: ["[" "]" "][" "[[]" "[]]" "[]][[]" "[[[[[[]]]]]]]"] ] foreach str tests/good [ - if not balanced? str [print [mold str "failed!"]] + if not balanced? str [print [mold str "failed!"]] ] foreach str tests/bad [ - if balanced? str [print [mold str "failed!"]] + if balanced? str [print [mold str "failed!"]] ] repeat i 10 [ - str: random copy/part "[][][][][][][][][][]" i * 2 - print [mold str "is" either balanced? str ["balanced"]["unbalanced"]] + str: random copy/part "[][][][][][][][][][]" i * 2 + print [mold str "is" either balanced? str ["balanced"]["unbalanced"]] ] diff --git a/Task/Balanced-brackets/Rust/balanced-brackets.rust b/Task/Balanced-brackets/Rust/balanced-brackets.rs similarity index 100% rename from Task/Balanced-brackets/Rust/balanced-brackets.rust rename to Task/Balanced-brackets/Rust/balanced-brackets.rs diff --git a/Task/Balanced-brackets/SETL/balanced-brackets.setl b/Task/Balanced-brackets/SETL/balanced-brackets.setl new file mode 100644 index 0000000000..c2147ea335 --- /dev/null +++ b/Task/Balanced-brackets/SETL/balanced-brackets.setl @@ -0,0 +1,31 @@ +program balanced_brackets; + setrandom(0); + + loop for length in [1..10] do + s := generate length; + print(balanced s, s); + end loop; + + op generate(n); + s := "["*n + "]"*n; + loop for i in [n*2, n*2-1..2] do + j := 1 + random(i - 1); + [s(i), s(j)] := [s(j), s(i)]; + end loop; + return s; + end op; + + op balanced(s); + depth := 0; + loop for c in s do + case c of + ("["): + depth +:= 1; + ("]"): + depth -:= 1; + if depth<0 then return false; end if; + end case; + end loop; + return depth = 0; + end op; +end program; diff --git a/Task/Balanced-brackets/Scheme/balanced-brackets.ss b/Task/Balanced-brackets/Scheme/balanced-brackets.scm similarity index 100% rename from Task/Balanced-brackets/Scheme/balanced-brackets.ss rename to Task/Balanced-brackets/Scheme/balanced-brackets.scm diff --git a/Task/Balanced-brackets/Stata/balanced-brackets.stata b/Task/Balanced-brackets/Stata/balanced-brackets.stata index ce238f97e3..83eedcefc9 100644 --- a/Task/Balanced-brackets/Stata/balanced-brackets.stata +++ b/Task/Balanced-brackets/Stata/balanced-brackets.stata @@ -1,12 +1,12 @@ mata function random_brackets(n) { - return(invtokens(("[","]")[runiformint(1,2*n,1,2)],"")) + return(invtokens(("[","]")[runiformint(1,2*n,1,2)],"")) } function is_balanced(s) { - n = strlen(s) - if (n==0) return(1) - a = runningsum(92:-ascii(s)) - return(all(a:>=0) & a[n]==0) + n = strlen(s) + if (n==0) return(1) + a = runningsum(92:-ascii(s)) + return(all(a:>=0) & a[n]==0) } end diff --git a/Task/Balanced-brackets/Tcl/balanced-brackets-1.tcl b/Task/Balanced-brackets/Tcl/balanced-brackets-1.tcl index 82d7ece066..2e2beb8e8f 100644 --- a/Task/Balanced-brackets/Tcl/balanced-brackets-1.tcl +++ b/Task/Balanced-brackets/Tcl/balanced-brackets-1.tcl @@ -3,9 +3,9 @@ proc generate {n} { 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 + 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 ""] } @@ -13,11 +13,11 @@ proc generate {n} { 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}} - } + # Everything unmatched is ignored, which is what we want + switch -exact -- $c { + "\[" {incr n} + "\]" {if {[incr n -1] < 0} {return false}} + } } expr {!$n} } diff --git a/Task/Balanced-brackets/Tcl/balanced-brackets-2.tcl b/Task/Balanced-brackets/Tcl/balanced-brackets-2.tcl index f01beac2ea..e0e4f4a0b7 100644 --- a/Task/Balanced-brackets/Tcl/balanced-brackets-2.tcl +++ b/Task/Balanced-brackets/Tcl/balanced-brackets-2.tcl @@ -1,8 +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]" + 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/True-BASIC/balanced-brackets.basic b/Task/Balanced-brackets/True-BASIC/balanced-brackets.basic new file mode 100644 index 0000000000..8e6441afdd --- /dev/null +++ b/Task/Balanced-brackets/True-BASIC/balanced-brackets.basic @@ -0,0 +1,26 @@ +DIM brk$(10) +LET brk$(1) = "[[[][]]]" +LET brk$(2) = "[[[]][[[][[][]]]]]" +LET brk$(3) = "][][]][[" +LET brk$(4) = "[][][]" +LET brk$(5) = "[][]][]][[]]][[[" +LET brk$(6) = "]][[[[]]]][]]][[[[" +LET brk$(7) = "[[][[[]]][]]" +LET brk$(8) = "[]][][][[[]]" +LET brk$(9) = "][]][[" +LET brk$(10) = "[]][][][[]" + +FOR i = 1 TO 7 + LET b$ = brk$(i) + DO WHILE POS(b$,"[]") <> 0 + LET x = POS(b$,"[]") + IF x > 0 THEN LET b$ = (b$)[1:x-1] & (b$)[x+2:maxnum] + LOOP + IF TRIM$(b$) = "" THEN + PRINT " OK "; + ELSE + PRINT "Not OK "; + END IF + PRINT brk$(i) +NEXT i +END diff --git a/Task/Balanced-brackets/VBScript/balanced-brackets-1.vb b/Task/Balanced-brackets/VBScript/balanced-brackets-1.vb deleted file mode 100644 index 8a458a26f4..0000000000 --- a/Task/Balanced-brackets/VBScript/balanced-brackets-1.vb +++ /dev/null @@ -1,36 +0,0 @@ -For n = 1 To 10 - sequence = Generate_Sequence(n) - WScript.Echo sequence & " is " & Check_Balance(sequence) & "." -Next - -Function Generate_Sequence(n) - For i = 1 To n - j = Round(Rnd()) - If j = 0 Then - Generate_Sequence = Generate_Sequence & "[" - Else - Generate_Sequence = Generate_Sequence & "]" - End If - Next -End Function - -Function Check_Balance(s) - Set Stack = CreateObject("System.Collections.Stack") - For i = 1 To Len(s) - char = Mid(s,i,1) - If i = 1 Or char = "[" Then - Stack.Push(char) - ElseIf Stack.Count <> 0 Then - If char = "]" And Stack.Peek = "[" Then - Stack.Pop - End If - Else - Stack.Push(char) - End If - Next - If Stack.Count > 0 Then - Check_Balance = "Not Balanced" - Else - Check_Balance = "Balanced" - End If -End Function diff --git a/Task/Balanced-brackets/VBScript/balanced-brackets-1.vbs b/Task/Balanced-brackets/VBScript/balanced-brackets-1.vbs new file mode 100644 index 0000000000..d271076d80 --- /dev/null +++ b/Task/Balanced-brackets/VBScript/balanced-brackets-1.vbs @@ -0,0 +1,36 @@ +For n = 1 To 10 + sequence = Generate_Sequence(n) + WScript.Echo sequence & " is " & Check_Balance(sequence) & "." +Next + +Function Generate_Sequence(n) + For i = 1 To n + j = Round(Rnd()) + If j = 0 Then + Generate_Sequence = Generate_Sequence & "[" + Else + Generate_Sequence = Generate_Sequence & "]" + End If + Next +End Function + +Function Check_Balance(s) + Set Stack = CreateObject("System.Collections.Stack") + For i = 1 To Len(s) + char = Mid(s,i,1) + If i = 1 Or char = "[" Then + Stack.Push(char) + ElseIf Stack.Count <> 0 Then + If char = "]" And Stack.Peek = "[" Then + Stack.Pop + End If + Else + Stack.Push(char) + End If + Next + If Stack.Count > 0 Then + Check_Balance = "Not Balanced" + Else + Check_Balance = "Balanced" + End If +End Function diff --git a/Task/Balanced-brackets/VBScript/balanced-brackets-2.vb b/Task/Balanced-brackets/VBScript/balanced-brackets-2.vb deleted file mode 100644 index cb0beeaef5..0000000000 --- a/Task/Balanced-brackets/VBScript/balanced-brackets-2.vb +++ /dev/null @@ -1,40 +0,0 @@ -option explicit - -function do_brackets(bal) - dim s,i,cnt,r - if bal then s="[":cnt=1 else s="":cnt=0 - for i=1 to 20 - if (rnd>0.7) then r=not r - if not r then - s=s+"[" :cnt=cnt+1 - else - if not bal or (bal and cnt>0) then s=s+"]":cnt=cnt-1 - end if - next - if bal and cnt<>0 then s=s&string(cnt,"]") - if not bal and cnt=0 then s=s&"]" - do_brackets=s -end function - -function isbalanced(s) - dim s1,i,cnt: cnt=0 - for i=1 to len(s) - s1=mid(s,i,1) - if s1="[" then cnt=cnt+1 - if s1="]" then cnt=cnt-1 - if cnt<0 then isbalanced=false:exit function - next - isbalanced=(cnt=0) -end function - -function iif(a,b,c): if a then iif=b else iif=c end if : end function - -randomize timer -dim i,s,bal,bb -for i=1 to 10 - bal=(rnd>.5) - s=do_brackets(bal) - bb=isbalanced(s) - wscript.echo iif (bal,"","un")& "balanced string " &vbtab _ - & s & vbtab & " Checks as " & iif(bb,"","un")&"balanced" -next diff --git a/Task/Balanced-brackets/VBScript/balanced-brackets-2.vbs b/Task/Balanced-brackets/VBScript/balanced-brackets-2.vbs new file mode 100644 index 0000000000..674efc6e13 --- /dev/null +++ b/Task/Balanced-brackets/VBScript/balanced-brackets-2.vbs @@ -0,0 +1,40 @@ +option explicit + +function do_brackets(bal) + dim s,i,cnt,r + if bal then s="[":cnt=1 else s="":cnt=0 + for i=1 to 20 + if (rnd>0.7) then r=not r + if not r then + s=s+"[" :cnt=cnt+1 + else + if not bal or (bal and cnt>0) then s=s+"]":cnt=cnt-1 + end if + next + if bal and cnt<>0 then s=s&string(cnt,"]") + if not bal and cnt=0 then s=s&"]" + do_brackets=s +end function + +function isbalanced(s) + dim s1,i,cnt: cnt=0 + for i=1 to len(s) + s1=mid(s,i,1) + if s1="[" then cnt=cnt+1 + if s1="]" then cnt=cnt-1 + if cnt<0 then isbalanced=false:exit function + next + isbalanced=(cnt=0) +end function + +function iif(a,b,c): if a then iif=b else iif=c end if : end function + +randomize timer +dim i,s,bal,bb +for i=1 to 10 + bal=(rnd>.5) + s=do_brackets(bal) + bb=isbalanced(s) + wscript.echo iif (bal,"","un")& "balanced string " &vbtab _ + & s & vbtab & " Checks as " & iif(bb,"","un")&"balanced" +next diff --git a/Task/Balanced-brackets/XBS/balanced-brackets.xbs b/Task/Balanced-brackets/XBS/balanced-brackets.xbs index 3bccd7da4a..11305dd643 100644 --- a/Task/Balanced-brackets/XBS/balanced-brackets.xbs +++ b/Task/Balanced-brackets/XBS/balanced-brackets.xbs @@ -1,17 +1,17 @@ const Chars:[string] = ["[","]"]; func GenerateString(Amount:number=4):string{ - set Result:string = ""; - <|(*1..Amount)=>Result+=Chars[math.random(0,?Chars-1)]; - send Result; + set Result:string = ""; + <|(*1..Amount)=>Result+=Chars[math.random(0,?Chars-1)]; + send Result; } func IsBalanced(String:string):boolean{ - set Pairs:number = 0; - <|(*(0..(?String-1)))=>(String::at(_)=="[")?(Pairs<0)?=>send false,Pairs++,=>Pairs--; - send (Opens==Closes)&(Pairs==0); + set Pairs:number = 0; + <|(*(0..(?String-1)))=>(String::at(_)=="[")?(Pairs<0)?=>send false,Pairs++,=>Pairs--; + send (Opens==Closes)&(Pairs==0); } repeat 10 { - set s = GenerateString(math.random(2,4)*2); - log(`{s}: {IsBalanced(s)}`); + set s = GenerateString(math.random(2,4)*2); + log(`{s}: {IsBalanced(s)}`); } diff --git a/Task/Balanced-brackets/Ya/balanced-brackets.ya b/Task/Balanced-brackets/Ya/balanced-brackets.ya index 0b3e76f880..40698505e5 100644 --- a/Task/Balanced-brackets/Ya/balanced-brackets.ya +++ b/Task/Balanced-brackets/Ya/balanced-brackets.ya @@ -4,34 +4,34 @@ // definition of anything new is prefixed by \, like \MakeNew_[]s and \len // MakeNew_[]s is Ok ident in Ya: _ starts sign part of ident, which must be ended by _ or alphanum `Char[^] \MakeNew_[]s(`Int+ \len) // `Char[^] and `Char[=] are arrays that owns their items, like it's usally in other langs; - // yet in assignment of `Char[^] to `Char[=] the allocated memory is moved from old to new owner, and old string becomes empty - // there are tabs at starts of many lines; these tabs specify what in C++ is {} blocks, just like in Python - len & 1 ==0 ! // it's a call to postfix function '!' which is an assert: len must be even - `Char[=] \r(len) // allocate new string of length len - // most statements are analogous to C++ but written starting by capital letter: For If Switch Ret - For `Char[] \eye = r; eye // // `Char[] is a simplest array of chars, which does not hold a memory used by array items; inc part of For loop is missed: it's Ok, and condition and init could also be missed - *eye++ = '['; *eye++ = '[' // fill r by "[][][]...". The only place with ; as statement delemiter: required because the statement is not started at new line. - // below is a shuffle of "[][][]..." array - For `Char[] \eye = r; ++eye // var eye is already defined, but being the same `Char[] it's Ok by using already exisiting var. ++eye is used: it allows use of eye[-1] inside - `Int+ \at = Random(eye/Length) // `Int+ is C++'s unsigned int. eye/Length: / is used for access to field, like in file path - eye[-1],eye[at] = eye[at],eye[-1] // swap using tuples; eye[-1] accesses char that is out of current array, yet it's allowed - Ret r // Ret is C's return + // yet in assignment of `Char[^] to `Char[=] the allocated memory is moved from old to new owner, and old string becomes empty + // there are tabs at starts of many lines; these tabs specify what in C++ is {} blocks, just like in Python + len & 1 ==0 ! // it's a call to postfix function '!' which is an assert: len must be even + `Char[=] \r(len) // allocate new string of length len + // most statements are analogous to C++ but written starting by capital letter: For If Switch Ret + For `Char[] \eye = r; eye // // `Char[] is a simplest array of chars, which does not hold a memory used by array items; inc part of For loop is missed: it's Ok, and condition and init could also be missed + *eye++ = '['; *eye++ = '[' // fill r by "[][][]...". The only place with ; as statement delemiter: required because the statement is not started at new line. + // below is a shuffle of "[][][]..." array + For `Char[] \eye = r; ++eye // var eye is already defined, but being the same `Char[] it's Ok by using already exisiting var. ++eye is used: it allows use of eye[-1] inside + `Int+ \at = Random(eye/Length) // `Int+ is C++'s unsigned int. eye/Length: / is used for access to field, like in file path + eye[-1],eye[at] = eye[at],eye[-1] // swap using tuples; eye[-1] accesses char that is out of current array, yet it's allowed + Ret r // Ret is C's return `Bool \AreBalanced(`Char[] \brackets) - `Int+ \extra = 0 - For ;brackets ;++brackets - Switch *brackets - '[' // it's a C++'s 'case': both 'case' and ':' are skipped being of no value; but the code for a case should be in block, which is here specifyed by tabs at next line start - ++extra - ']' - If !!extra // '!!' is `Bool not, like all other `Bool ops: && || ^^ - Ret No // No and False are C's false; Yes and True are C's true - --extra - // There is no default case, which is written as ':' - so if no case is Ok then it will fail just like if being written as on the next line - // : { 0! } // C's default: assert(0); - Ret extra == 0 + `Int+ \extra = 0 + For ;brackets ;++brackets + Switch *brackets + '[' // it's a C++'s 'case': both 'case' and ':' are skipped being of no value; but the code for a case should be in block, which is here specifyed by tabs at next line start + ++extra + ']' + If !!extra // '!!' is `Bool not, like all other `Bool ops: && || ^^ + Ret No // No and False are C's false; Yes and True are C's true + --extra + // There is no default case, which is written as ':' - so if no case is Ok then it will fail just like if being written as on the next line + // : { 0! } // C's default: assert(0); + Ret extra == 0 // function ala 'main' is not used: all global code from all modules are executed; so below is what typically is in ala 'main' For `Int \n=10; n; --n - // below note that new var 'brackets' is created inside args of func call - //@Std/StdIO/ is used here to use Print function; else it maybe changed to Use @Std/StdIO at global level before this For loop - @Std/StdIO/Print(; "%s : %s\n" ;`Char[=] \brackets = MakeNew_[]s(10) /* all bracket strings are of length 10 */; AreBalanced(brackets) ? "Ok" : "bad") - // note that starting arg of Print is missed by using ';' - default arg value is allowed to use for any arg, even if next args are written + // below note that new var 'brackets' is created inside args of func call + //@Std/StdIO/ is used here to use Print function; else it maybe changed to Use @Std/StdIO at global level before this For loop + @Std/StdIO/Print(; "%s : %s\n" ;`Char[=] \brackets = MakeNew_[]s(10) /* all bracket strings are of length 10 */; AreBalanced(brackets) ? "Ok" : "bad") + // note that starting arg of Print is missed by using ';' - default arg value is allowed to use for any arg, even if next args are written diff --git a/Task/Balanced-brackets/Yabasic/balanced-brackets.basic b/Task/Balanced-brackets/Yabasic/balanced-brackets.basic index f92e2488aa..f318913bce 100644 --- a/Task/Balanced-brackets/Yabasic/balanced-brackets.basic +++ b/Task/Balanced-brackets/Yabasic/balanced-brackets.basic @@ -1,6 +1,6 @@ sub check_brackets(s$) local level, i - + for i = 1 to len(s$) switch mid$(s$, i, 1) case "[": level = level + 1 : break diff --git a/Task/Balanced-brackets/Zig/balanced-brackets.zig b/Task/Balanced-brackets/Zig/balanced-brackets.zig new file mode 100644 index 0000000000..5528f6e13e --- /dev/null +++ b/Task/Balanced-brackets/Zig/balanced-brackets.zig @@ -0,0 +1,41 @@ +const std = @import("std"); +const print = std.debug.print; + +const max_pairs = 256; + +pub fn is_balanced(buf: []u8) bool { + var count: usize = 0; + for (buf) |ch| switch (ch) { + '[' => count += 1, + ']' => { + if (count == 0) return false; + count -= 1; + }, + else => return false, + }; + return count == 0; +} + +pub fn main() !void { + for (0..10) |n_pairs| { + if (n_pairs > max_pairs) + return error.MaximumNumberOfPairsExceded; + + var buf: [2 * max_pairs]u8 = undefined; + for (0..n_pairs) |i| buf[i] = '['; + for (n_pairs..n_pairs * 2) |i| buf[i] = ']'; + + const rand = std.crypto.random; + const len = n_pairs * 2; + const reps = 2; + for (0..len * reps) |i_rep| { + const i = i_rep % len; + const j = rand.int(usize) % len; + const temp = buf[i]; + buf[i] = buf[j]; + buf[j] = temp; + } + const s = buf[0..len]; + print("'{s}': {}\n", .{ s, is_balanced(s) }); + } +} diff --git a/Task/Balanced-ternary/00-TASK.txt b/Task/Balanced-ternary/00-TASK.txt index 6b6f6bb48f..f548e4c8c0 100644 --- a/Task/Balanced-ternary/00-TASK.txt +++ b/Task/Balanced-ternary/00-TASK.txt @@ -10,13 +10,13 @@ Decimal 6 = 32 − 31 + 0 × 30, thus it can b ;Task: Implement balanced ternary representation of integers with the following: # 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 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 "efficient" (and with a reasonable definition of "reasonable"). -'''Test case''' With balanced ternaries ''a'' from string "+-0++0+", ''b'' from native integer -436, ''c'' "+-++-": +'''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. diff --git a/Task/Balanced-ternary/11l/balanced-ternary.11l b/Task/Balanced-ternary/11l/balanced-ternary.11l index a31242bd2a..d873a1517f 100644 --- a/Task/Balanced-ternary/11l/balanced-ternary.11l +++ b/Task/Balanced-ternary/11l/balanced-ternary.11l @@ -9,7 +9,7 @@ T BalancedTernary I all(inp.map(d -> d C (0, 1, -1))) .digits = copy(inp) E - X ValueError(‘BalancedTernary: Wrong input digits.’) + X.throw ValueError(‘BalancedTernary: Wrong input digits.’) F :from_str(inp) R BalancedTernary(reversed(inp).map(c -> .:str2dig[c])) @@ -21,7 +21,7 @@ T BalancedTernary I n3 == 0 {R [0] [+] .:int2ternary(n -I/ 3)} I n3 == 1 {R [1] [+] .:int2ternary(n -I/ 3)} I n3 == 2 {R [-1] [+] .:int2ternary((n + 1) -I/ 3)} - X RuntimeError(‘’) + X.throw RuntimeError(‘’) F :from_int(inp) R BalancedTernary(.:int2ternary(inp)) diff --git a/Task/Balanced-ternary/Ada/balanced-ternary-1.ada b/Task/Balanced-ternary/Ada/balanced-ternary-1.adb similarity index 100% rename from Task/Balanced-ternary/Ada/balanced-ternary-1.ada rename to Task/Balanced-ternary/Ada/balanced-ternary-1.adb diff --git a/Task/Balanced-ternary/Ada/balanced-ternary-2.ada b/Task/Balanced-ternary/Ada/balanced-ternary-2.adb similarity index 100% rename from Task/Balanced-ternary/Ada/balanced-ternary-2.ada rename to Task/Balanced-ternary/Ada/balanced-ternary-2.adb diff --git a/Task/Balanced-ternary/Ada/balanced-ternary-3.ada b/Task/Balanced-ternary/Ada/balanced-ternary-3.adb similarity index 100% rename from Task/Balanced-ternary/Ada/balanced-ternary-3.ada rename to Task/Balanced-ternary/Ada/balanced-ternary-3.adb diff --git a/Task/Balanced-ternary/Bruijn/balanced-ternary.bruijn b/Task/Balanced-ternary/Bruijn/balanced-ternary.bruijn new file mode 100644 index 0000000000..5f7aa99ad9 --- /dev/null +++ b/Task/Balanced-ternary/Bruijn/balanced-ternary.bruijn @@ -0,0 +1,100 @@ +:import std/Combinator . +:import std/Logic . +:import std/Pair . + +# negative trit indicating coefficient of (-1) +t⁻ [[[2]]] + +# positive trit indicating coefficient of (+1) +t⁺ [[[1]]] + +# zero trit indicating coefficient of 0 +t⁰ [[[0]]] + +# shifts a negative trit into a balanced ternary number +↑⁻‣ [[[[[2 (4 3 2 1 0)]]]]] + +# shifts a positive trit into a balanced ternary number +↑⁺‣ [[[[[1 (4 3 2 1 0)]]]]] + +# shifts a zero trit into a balanced ternary number +↑⁰‣ [[[[[0 (4 3 2 1 0)]]]]] + +# shifts a specified trit into a balanced ternary number +…↑… [[[[[[5 2 1 0 (4 3 2 1 0)]]]]]] + +# negates a balanced ternary number +-‣ [[[[[4 3 1 2 0]]]]] + +# increments a balanced ternary number (can introduce leading 0s) +++‣ [~(0 z a⁻ a⁺ a⁰)] + z (+0) : (+1) + a⁻ &[[↑⁻1 : ↑⁰1]] + a⁺ &[[↑⁺1 : ↑⁻0]] + a⁰ &[[↑⁰1 : ↑⁺1]] + +# decrements a balanced ternary number (can introduce leading 0s) +--‣ [~(0 z a⁻ a⁺ a⁰)] + z (+0) : (-1) + a⁻ &[[↑⁻1 : ↑⁺0]] + a⁺ &[[↑⁺1 : ↑⁰1]] + a⁰ &[[↑⁰1 : ↑⁻1]] + +# converts the normal balanced ternary representation into abstract form +→^‣ [0 z a⁻ a⁺ a⁰] + z (+0) + a⁻ [[[[[2 4]]]]] + a⁺ [[[[[1 4]]]]] + a⁰ [[[[[0 4]]]]] + +# converts the abstracted balanced ternary representation back to normal +→_‣ y [[0 z a⁻ a⁺ a⁰]] + z (+0) + a⁻ [↑⁻(2 0)] + a⁺ [↑⁺(2 0)] + a⁰ [↑⁰(2 0)] + +# adds two balanced ternary numbers (can introduce leading 0s) +…+… [[[c (0 z a⁻ a⁺ a⁰)] 1 →^0]] + b⁻ [1 ↑⁺(3 0 t⁻) ↑⁰(3 0 t⁰) ↑⁻(3 0 t⁰)] + b⁰ [1 ↑ (3 0 t⁰)] + b⁺ [1 ↑⁰(3 0 t⁰) ↑⁻(3 0 t⁺) ↑⁺(3 0 t⁰)] + a⁻ [[[1 (b⁻ 1) b⁻' b⁰ b⁻]]] + b⁻' [1 ↑⁰(3 0 t⁻) ↑⁻(3 0 t⁰) ↑⁺(3 0 t⁻)] + a⁺ [[[1 (b⁺ 1) b⁰ b⁺' b⁺]]] + b⁺' [1 ↑⁺(3 0 t⁰) ↑⁰(3 0 t⁺) ↑⁻(3 0 t⁺)] + a⁰ [[[1 (b⁰ 1) b⁻ b⁺ b⁰]]] + z [[0 --(→_1) ++(→_1) →_1]] + c [[1 0 t⁰]] + +# subtracts two balanced ternary numbers (can introduce leading 0s) +…-… [[1 + -0]] + +# multiplicates two balanced ternary numbers (can introduce leading 0s) +…⋅… [[1 z a⁻ a⁺ a⁰]] + z (+0) + a⁻ [↑⁰0 - 1] + a⁺ [↑⁰0 + 1] + a⁰ [↑⁰0] + +# true if balanced ternary number is zero +=?‣ [0 true [false] [false] i] + +# true if two balanced ternary numbers are equal +# → ignores leading 0s! +…=?… [[[0 z a⁻ a⁺ a⁰] 1 →^0]] + z [=?(→_0)] + a⁻ [[0 false [2 0] [false] [false]]] + a⁺ [[0 false [false] [2 0] [false]]] + a⁰ [[0 (1 0) [false] [false] [2 0]]] + +main [[0]] + +# --- tests/examples --- + +:test ((-42) + (-1) =? (-43)) (true) +:test ((+1) + (+2) =? (+3)) (true) +:test ((-42) - (-1) =? (-41)) (true) +:test ((+1) - (+2) =? (-1)) (true) +:test ((-1) ⋅ (+42) =? (-42)) (true) +:test ((+3) ⋅ (+11) =? (+33)) (true) diff --git a/Task/Balanced-ternary/Elixir/balanced-ternary.elixir b/Task/Balanced-ternary/Elixir/balanced-ternary.ex similarity index 100% rename from Task/Balanced-ternary/Elixir/balanced-ternary.elixir rename to Task/Balanced-ternary/Elixir/balanced-ternary.ex diff --git a/Task/Balanced-ternary/JavaScript/balanced-ternary.js b/Task/Balanced-ternary/JavaScript/balanced-ternary.js new file mode 100644 index 0000000000..29ae058c1c --- /dev/null +++ b/Task/Balanced-ternary/JavaScript/balanced-ternary.js @@ -0,0 +1,203 @@ +class BTernary { + constructor(input) { + if (typeof input === 'string') { + let i = 0; + while (i < input.length && input.charAt(i) === '0') { + i++; + } + this.value = input.substring(i); + } else if (typeof input === 'number') { + this.value = this.convertToBT(input); + } + } + + convertToBT(v) { + if (v < 0) { + return this.flip(this.convertToBT(-v)); + } + if (v === 0) { + return ""; + } + const rem = this.mod3(v); + if (rem === 0) { + return this.convertToBT(Math.floor(v / 3)) + "0"; + } + if (rem === 1) { + return this.convertToBT(Math.floor(v / 3)) + "+"; + } + if (rem === 2) { + return this.convertToBT(Math.floor((v + 1) / 3)) + "-"; + } + return "You can't see me"; + } + + flip(s) { + let flip = ""; + for (let i = 0; i < s.length; i++) { + if (s.charAt(i) === '+') { + flip += '-'; + } else if (s.charAt(i) === '-') { + flip += '+'; + } else { + flip += '0'; + } + } + return flip; + } + + mod3(v) { + if (v > 0) { + return v % 3; + } + v = v % 3; + return (v + 3) % 3; + } + + intValue() { + let sum = 0; + const s = this.value; + for (let i = 0; i < s.length; i++) { + const c = s.charAt(s.length - i - 1); + let dig = 0; + if (c === '+') { + dig = 1; + } else if (c === '-') { + dig = -1; + } + sum += dig * Math.pow(3, i); + } + return sum; + } + + add(that) { + let a = this.value; + let b = that.value; + + const longer = a.length > b.length ? a : b; + let shorter = a.length > b.length ? b : a; + + while (shorter.length < longer.length) { + shorter = '0' + shorter; + } + + a = longer; + b = shorter; + + let carry = '0'; + let sum = ""; + for (let i = 0; i < a.length; i++) { + const place = a.length - i - 1; + const digisum = this.addDigitsWithCarry(a.charAt(place), b.charAt(place), carry); + if (digisum.length !== 1) { + carry = digisum.charAt(0); + } else { + carry = '0'; + } + sum = digisum.charAt(digisum.length - 1) + sum; + } + sum = carry + sum; + + return new BTernary(sum); + } + + addDigitsWithCarry(a, b, carry) { + const sum1 = this.addDigits(a, b); + const sum2 = this.addDigits(sum1.charAt(sum1.length - 1), carry); + + if (sum1.length === 1) { + return sum2; + } + if (sum2.length === 1) { + return sum1.charAt(0) + sum2; + } + return sum1.charAt(0) + ""; + } + + addDigits(a, b) { + let sum = ""; + if (a === '0') { + sum = b + ""; + } else if (b === '0') { + sum = a + ""; + } else if (a === '+') { + if (b === '+') { + sum = "+-"; + } else { + sum = "0"; + } + } else { + if (b === '+') { + sum = "0"; + } else { + sum = "-+"; + } + } + return sum; + } + + neg() { + return new BTernary(this.flip(this.value)); + } + + sub(that) { + return this.add(that.neg()); + } + + mul(that) { + const one = new BTernary(1); + const zero = new BTernary(0); + let mul = new BTernary(0); + + let flipflag = 0; + if (that.compareTo(zero) === -1) { + that = that.neg(); + flipflag = 1; + } + + for (let i = new BTernary(1); i.compareTo(that) < 1; i = i.add(one)) { + mul = mul.add(this); + } + + if (flipflag === 1) { + mul = mul.neg(); + } + return mul; + } + + equals(that) { + return this.value === that.value; + } + + compareTo(that) { + if (this.intValue() > that.intValue()) { + return 1; + } else if (this.equals(that)) { + return 0; + } + return -1; + } + + toString() { + return this.value; + } +} + +// Main execution +function main() { + const a = new BTernary("+-0++0+"); + const b = new BTernary(-436); + const c = new BTernary("+-++-"); + + console.log("a=" + a.intValue()); + console.log("b=" + b.intValue()); + console.log("c=" + c.intValue()); + console.log(); + + // result = a * (b - c) + const result = a.mul(b.sub(c)); + + console.log("result= " + result + " " + result.intValue()); +} + +// Run the main function +main(); diff --git a/Task/Balanced-ternary/Jq/balanced-ternary.jq b/Task/Balanced-ternary/Jq/balanced-ternary.jq new file mode 100644 index 0000000000..c727d99902 --- /dev/null +++ b/Task/Balanced-ternary/Jq/balanced-ternary.jq @@ -0,0 +1,137 @@ +### Generic utilities + +# Emit a stream of the constituent characters of the input string +def chars: explode[] | [.] | implode; + +# Flip "+" and "-" in the input string, and change other characters to 0 +def flip: + {"+": "-", "-": "+"} as $t + | reduce chars as $c (""; . + ($t[$c] // "0") ); + +### Balanced ternaries (BT) + +# Input is assumed to be an integer (use `new` if checking is required) +def toBT: + # Helper - input should be an integer + def mod3: + if . > 0 then . % 3 + else ((. % 3) + 3) % 3 + end; + + if . < 0 then - . | toBT | flip + else if . == 0 then "" + else mod3 as $rem + | if $rem == 0 then (. / 3 | toBT) + "0" + elif $rem == 1 then (. / 3 | toBT) + "+" + else ((. + 1) / 3 | toBT) + "-" + end + end + | sub("^00*";"") + | if . == "" then "0" end + end ; + +# Input: BT +def integer: + . as $in + | length as $len + | { sum: 0, + pow: 1 } + | reduce range (0;$len) as $i (.; + $in[$len-$i-1: $len-$i] as $c + | (if $c == "+" then 1 elif $c == "-" then -1 else 0 end) as $digit + | if $digit != 0 then .sum += $digit * .pow else . end + | .pow *= 3 ) + | .sum ; + +# If the input is a string, check it is a valid BT, and trim leading 0s; +# if the input is an integer, convert it to a BT; +# otherwise raise an error. +def new: + if type == "string" and all(chars; IN("0", "+", "-")) + then sub("^00*"; "") | if . == "" then "0" end + elif type == "number" and trunc == . + then toBT + else "'new' given invalid input: \(.)" | error + end; + +# . + $b +def plus($b): + # Helper functions: + def at($i): .[$i:$i+1]; + + # $a and $b should each be "0", "+" or "-" + def addDigits2($a; $b): + if $a == "0" then $b + elif $b == "0" then $a + elif $a == "+" + then if $b == "+" then "+-" else "0" end + elif $b == "+" then "0" else "-+" + end; + + def addDigits3($a; $b; $carry): + addDigits2($a; $b) as $sum1 + | addDigits2($sum1[-1:]; $carry) as $sum2 + | if ($sum1|length) == 1 + then $sum2 + elif ($sum2|length) == 1 + then $sum1[0:1] + $sum2 + else $sum1[0:1] + end; + + { longer: (if length > ($b|length) then . else $b end), + shorter: (if length > ($b|length) then $b else . end) } + | until ( (.shorter|length) >= (.longer|length); .shorter = "0" + .shorter ) + | .a = .longer + | .b = .shorter + | .carry = "0" + | .sum = "" + | reduce range(0; .a|length) as $i (.; + ( (.a|length) - $i - 1) as $place + | addDigits3(.a | at($place); .b | at($place); .carry) as $digisum + | .carry = (if ($digisum|length) != 1 then $digisum[0:1] else "0" end) + | .sum = $digisum[-1:] + .sum ) + | .carry + .sum + | new; + +def minus: flip; + +# . - $b +def minus($b): plus($b | flip); + +def mult($b): + (1 | new) as $one + | (0 | new) as $zero + | { a: ., + $b, + mul: $zero, + flipFlag: false } + | if .b[0:1] == "-" # i.e. .b < 0 + then .b |= minus + | .flipFlag = true + end + | .i = $one + | .in = 1 + | (.b | integer) as $bn + | until ( .in > $bn; + .a as $a + | .mul |= plus($a) + | .i |= plus($one) + | .in += 1 ) + | if .flipFlag then .mul | minus else .mul end ; + + +### Illustration + +def a: "+-0++0+"; +def b: -436 | new; +def c: "+-++-"; + + (a | integer) as $an +| (b | integer) as $bn +| (c | integer) as $cn +| ($an * ($bn - $cn)) as $in +| (a | mult( (b | minus(c)))) as $i +| "a = \($an)", + "b = \($bn)", + "c = \($cn)", + "a * (b - c) = \($i) ~ \($in) => \($in|new)" diff --git a/Task/Balanced-ternary/Julia/balanced-ternary.julia b/Task/Balanced-ternary/Julia/balanced-ternary.jl similarity index 100% rename from Task/Balanced-ternary/Julia/balanced-ternary.julia rename to Task/Balanced-ternary/Julia/balanced-ternary.jl diff --git a/Task/Balanced-ternary/Kotlin/balanced-ternary.kotlin b/Task/Balanced-ternary/Kotlin/balanced-ternary.kts similarity index 100% rename from Task/Balanced-ternary/Kotlin/balanced-ternary.kotlin rename to Task/Balanced-ternary/Kotlin/balanced-ternary.kts diff --git a/Task/Balanced-ternary/OCaml/balanced-ternary.ocaml b/Task/Balanced-ternary/OCaml/balanced-ternary.ml similarity index 100% rename from Task/Balanced-ternary/OCaml/balanced-ternary.ocaml rename to Task/Balanced-ternary/OCaml/balanced-ternary.ml diff --git a/Task/Balanced-ternary/Quackery/balanced-ternary.quackery b/Task/Balanced-ternary/Quackery/balanced-ternary.quackery new file mode 100644 index 0000000000..f28cf0fdc1 --- /dev/null +++ b/Task/Balanced-ternary/Quackery/balanced-ternary.quackery @@ -0,0 +1,79 @@ + [ -1 1 clamp 1+ ]'[ swap peek do ] is sif ( n --> ) + + [ $ "" swap witheach + [ sif [ char - char 0 char + ] + swap join ] ] is t->$ ( t --> ) + + [ [] swap witheach + [ char - - sif [ 1 -1 0 ] + swap join ] ] is $->t ( $ --> t ) + + [ 0 swap reverse witheach [ swap 3 * + ] ] is t->n ( $ --> t ) + + [ [] swap + [ 3 /mod [ table 0 1 [ 1+ -1 ] ] do + swap dip join dup 0 = until ] + drop ] is n->t ( n --> t ) + + [ -1 peek ] is tsign ( t --> n ) + + [ ' [ 0 ] = ] is tzero ( t --> b ) + + [ tsign -1 = ] is tneg ( t --> b ) + + [ tsign 1 = ] is tpos ( t --> b ) + + [ [] swap witheach [ negate join ] ] is -t ( t --> t ) + + [ 0 over size times + [ 1 - 2dup peek if conclude ] + 1+ dup if split drop ] is tnorm ( t --> t ) + + [ [] 0 2swap + over size over size - dup 0 < + if [ dip swap negate ] + 0 swap of join temp put + witheach + [ temp share i^ peek + + + 3 + + [ table + [ 0 -1 ] [ 1 -1 ] [ -1 0 ] + [ 0 0 ] [ 1 0 ] [ -1 1 ] + [ 0 1 ] ] do + dip join ] + join tnorm + temp release ] is t+ ( t t --> t ) + + [ -t t+ ] is t- ( t t --> t ) + + [ t- tneg ] is t< ( t t --> b ) + + [ t- tpos ] is t> ( t t --> b ) + + [ behead swap witheach + [ 2dup t> if swap + drop ] ] is tmin ( [ --> t ) + + [ behead swap witheach + [ 2dup t< if swap + drop ] ] is tmax ( [ --> t ) + + [ dup t+ ] is twice ( t --> t ) + + [ 0 swap join ] is thrice ( t --> t ) + + [ ' [ 0 ] swap witheach + [ dip over + sif [ t- drop t+ ] + dip thrice ] + nip ] is t* ( t t --> t ) + + say "a: " $ "+-0++0+" dup echo$ say " = " $->t t->n echo cr + say "b: " -436 dup echo say " = " n->t t->$ echo$ cr + say "c: " $ "+-++-" dup echo$ say " = " $->t t->n echo cr + say "a*(b-c): = " + $ "+-0++0+" $->t + -436 n->t + $ "+-++-" $->t + t- t* + dup t->$ echo$ say " = " t->n echo cr diff --git a/Task/Balanced-ternary/R/balanced-ternary.r b/Task/Balanced-ternary/R/balanced-ternary.r new file mode 100644 index 0000000000..2c8f76dd35 --- /dev/null +++ b/Task/Balanced-ternary/R/balanced-ternary.r @@ -0,0 +1,138 @@ +## BalancedTernary in R (S3) + +## Constructor helpers ---- +new_BalancedTernary <- function(digits) { + # digits are least-significant first, values in {-1,0,1} + structure(list(digits = as.integer(digits)), class = "BalancedTernary") +} + +BalancedTernary <- function(x = 0L) { + if (inherits(x, "BalancedTernary")) return(x) + if (is.character(x)) return(BalancedTernary_from_string(x)) + if (length(x) != 1 || !is.finite(x)) stop("BalancedTernary: need a single finite number or a string.") + BalancedTernary_from_int(as.integer(x)) +} + +BalancedTernary_zero <- function() new_BalancedTernary(0L) + +## Conversions ---- +BalancedTernary_from_int <- function(n) { + n <- as.integer(n) + if (n == 0L) return(new_BalancedTernary(0L)) + digs <- integer(0) + while (n != 0L) { + r <- n %% 3L + if (r == 0L) { + digs <- c(digs, 0L); n <- n %/% 3L + } else if (r == 1L) { + digs <- c(digs, 1L); n <- n %/% 3L + } else { # r == 2 -> digit -1 and carry +1 (i.e., add 1 then divide) + digs <- c(digs, -1L); n <- (n + 1L) %/% 3L + } + } + new_BalancedTernary(digs) +} + +BalancedTernary_from_string <- function(s) { + # string is most-significant first with '-', '0', '+' + map <- c("-" = -1L, "0" = 0L, "+" = 1L) + chs <- strsplit(s, "", fixed = TRUE)[[1]] + if (!all(chs %in% names(map))) stop("String may only contain '-', '0', '+'.") + # reverse to least-significant first + new_BalancedTernary(unname(map[rev(chs)])) +} + +bt <- function(s) BalancedTernary_from_string(s) # macro-ish convenience + +## Printing & coercion ---- +print.BalancedTernary <- function(x, ...) { + cat(as.character(x), "\n", sep = "") + invisible(x) +} + +as.character.BalancedTernary <- function(x, ...) { + map <- c(`-1` = "-", `0` = "0", `1` = "+") + # display most-significant first + paste0(rev(map[as.character(x$digits)]), collapse = "") +} + +as.integer.BalancedTernary <- function(x, ...) { + s <- x$digits + if (length(s) == 1L && s[1] == 0L) return(0L) + ex <- seq_along(s) - 1L + # use double accumulate then coerce to integer (safe for moderate sizes) + val <- sum((3 ^ ex) * s) + as.integer(val) +} + +## Unary minus ---- +`-.BalancedTernary` <- function(e1) new_BalancedTernary(-e1$digits) + +## Core arithmetic helpers ---- +# Addition table for (a1 + b1 + c) -> (digit, carry), +# indexed by 4 + a1 + b1 + c where a1,b1,c in {-1,0,1} gives 1..7 +.bt_table_digit <- c( 0, 1, -1, 0, 1, -1, 0) # d +.bt_table_carry <- c(-1, -1, 0, 0, 0, 1, 1) # c + +.bt_add <- function(a, b, c = 0L) { + # a,b are integer vectors of digits (LSB first) in {-1,0,1} + if (length(a) == 0L || length(b) == 0L) { + if (c == 0L) return(if (length(a) == 0L) b else a) + return(.bt_add(c(c), if (length(a) == 0L) b else a)) + } else { + a1 <- a[1]; b1 <- b[1] + idx <- 4L + a1 + b1 + c + d <- .bt_table_digit[idx] + c2 <- .bt_table_carry[idx] + r <- .bt_add(a[-1], b[-1], c2) + if (length(r) != 0L || d != 0L) { + return(c(d, r)) # unshift + } else { + return(r) + } + } +} + +.bt_mul <- function(a, b) { + # schoolbook recursion with balanced digits + if (length(a) == 0L || length(b) == 0L) return(integer(0)) + a1 <- a[1] + if (a1 == -1L) x <- (-BalancedTernary(new_BalancedTernary(b)))$digits + else if (a1 == 0L) x <- integer(0) + else if (a1 == 1L) x <- b + # shift (multiply by 3) = prepend a 0 digit to recursive product + y <- c(0L, .bt_mul(a[-1], b)) + .bt_add(x, y) +} + +.normalize_zero <- function(v) if (length(v) == 0L) 0L else v + +## Binary operators ---- +`+.BalancedTernary` <- function(e1, e2) { + v <- .bt_add(e1$digits, e2$digits) + new_BalancedTernary(.normalize_zero(v)) +} + +`-.BalancedTernary` # already defined (unary) + +`%minus_bt%` <- function(a, b) a + (-b) # internal helper if needed + +`*.BalancedTernary` <- function(e1, e2) { + v <- .bt_mul(e1$digits, e2$digits) + new_BalancedTernary(.normalize_zero(v)) +} + +## Demo / tests ---- +a <- bt("+-0++0+") +cat("a: ", as.integer(a), ", ", as.character(a), "\n", sep = "") + +b <- BalancedTernary(-436L) +cat("b: ", as.integer(b), ", ", as.character(b), "\n", sep = "") + +c <- BalancedTernary("+-++-") +cat("c: ", as.integer(c), ", ", as.character(c), "\n", sep = "") + +r <- a * (b + (-c)) # a * (b - c) +cat("a * (b - c): ", as.integer(r), ", ", as.character(r), "\n", sep = "") + +stopifnot(as.integer(r) == as.integer(a) * (as.integer(b) - as.integer(c))) diff --git a/Task/Balanced-ternary/Rust/balanced-ternary.rust b/Task/Balanced-ternary/Rust/balanced-ternary.rs similarity index 100% rename from Task/Balanced-ternary/Rust/balanced-ternary.rust rename to Task/Balanced-ternary/Rust/balanced-ternary.rs diff --git a/Task/Balanced-ternary/Wren/balanced-ternary.wren b/Task/Balanced-ternary/Wren/balanced-ternary.wren index 6c0fca76f4..ac3e10ab26 100644 --- a/Task/Balanced-ternary/Wren/balanced-ternary.wren +++ b/Task/Balanced-ternary/Wren/balanced-ternary.wren @@ -1,5 +1,5 @@ -import "/big" for BigInt -import "/trait" for Comparable +import "./big" for BigInt +import "./trait" for Comparable class BTernary is Comparable { toBT_(v) { diff --git a/Task/Balanced-ternary/Zig/balanced-ternary.zig b/Task/Balanced-ternary/Zig/balanced-ternary.zig new file mode 100644 index 0000000000..cf7423ff0a --- /dev/null +++ b/Task/Balanced-ternary/Zig/balanced-ternary.zig @@ -0,0 +1,297 @@ +const std = @import("std"); +const ArrayList = std.ArrayList; +const Allocator = std.mem.Allocator; + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer _ = gpa.deinit(); + const allocator = gpa.allocator(); + + const stdout = std.io.getStdOut().writer(); + + var a = try BalancedTernary.fromString(allocator, "+-0++0+"); + defer a.deinit(); + const a_val = try a.toI128(); + const a_str = try a.toString(allocator); + defer allocator.free(a_str); + try stdout.print("a = {s} = {d}\n", .{ a_str, a_val }); + + var b = try BalancedTernary.fromI128(allocator, -436); + defer b.deinit(); + const b_val = try b.toI128(); + const b_str = try b.toString(allocator); + defer allocator.free(b_str); + try stdout.print("b = {s} = {d}\n", .{ b_str, b_val }); + + var c = try BalancedTernary.fromString(allocator, "+-++-"); + defer c.deinit(); + const c_val = try c.toI128(); + const c_str = try c.toString(allocator); + defer allocator.free(c_str); + try stdout.print("c = {s} = {d}\n", .{ c_str, c_val }); + + var c_neg = try c.clone(allocator); + defer c_neg.deinit(); + c_neg.negate(); + + var b_plus_neg_c = try b.add(allocator, c_neg); + defer b_plus_neg_c.deinit(); + + var d = try a.mul(allocator, b_plus_neg_c); + defer d.deinit(); + const d_val = try d.toI128(); + const d_str = try d.toString(allocator); + defer allocator.free(d_str); + try stdout.print("a * (b - c) = {s} = {d}\n", .{ d_str, d_val }); + + var e = try BalancedTernary.fromString(allocator, "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + defer e.deinit(); + const e_result = e.toI128(); + try std.testing.expect(e_result == error.Overflow); +} + +const Trit = enum { + Zero, + Pos, + Neg, + + fn fromChar(c: u8) !Trit { + return switch (c) { + '0' => .Zero, + '+' => .Pos, + '-' => .Neg, + else => error.InvalidCharacter, + }; + } + + fn toChar(self: Trit) u8 { + return switch (self) { + .Zero => '0', + .Pos => '+', + .Neg => '-', + }; + } + + fn add(self: Trit, rhs: Trit) struct { carry: Trit, current: Trit } { + return switch (self) { + .Zero => .{ .carry = .Zero, .current = rhs }, + .Pos => switch (rhs) { + .Zero => .{ .carry = .Zero, .current = .Pos }, + .Neg => .{ .carry = .Zero, .current = .Zero }, + .Pos => .{ .carry = .Pos, .current = .Neg }, + }, + .Neg => switch (rhs) { + .Zero => .{ .carry = .Zero, .current = .Neg }, + .Pos => .{ .carry = .Zero, .current = .Zero }, + .Neg => .{ .carry = .Neg, .current = .Pos }, + }, + }; + } + + fn mul(self: Trit, rhs: Trit) Trit { + return switch (self) { + .Zero => .Zero, + .Pos => switch (rhs) { + .Zero => .Zero, + .Pos => .Pos, + .Neg => .Neg, + }, + .Neg => switch (rhs) { + .Zero => .Zero, + .Pos => .Neg, + .Neg => .Pos, + }, + }; + } + + fn negate(self: Trit) Trit { + return switch (self) { + .Zero => .Zero, + .Pos => .Neg, + .Neg => .Pos, + }; + } +}; + +const BalancedTernary = struct { + digits: ArrayList(Trit), + + fn deinit(self: *BalancedTernary) void { + self.digits.deinit(); + } + + fn clone(self: BalancedTernary, allocator: Allocator) !BalancedTernary { + var new_digits = try ArrayList(Trit).initCapacity(allocator, self.digits.items.len); + try new_digits.appendSlice(self.digits.items); + return BalancedTernary{ .digits = new_digits }; + } + + fn fromString(allocator: Allocator, s: []const u8) !BalancedTernary { + var digits = ArrayList(Trit).init(allocator); + errdefer digits.deinit(); + + var i: usize = s.len; + while (i > 0) { + i -= 1; + const trit = try Trit.fromChar(s[i]); + try digits.append(trit); + } + + return BalancedTernary{ .digits = digits }; + } + + fn fromI128(allocator: Allocator, x: i128) !BalancedTernary { + var digits = ArrayList(Trit).init(allocator); + errdefer digits.deinit(); + + var curr = x; + + while (true) { + const rem = @rem(curr, 3); + + const trit: Trit = switch (rem) { + 0 => .Zero, + 1, -2 => .Pos, + 2, -1 => .Neg, + else => unreachable, + }; + try digits.append(trit); + + const offset = @as(i128, @intFromFloat(@round(@as(f64, @floatFromInt(rem)) / 3.0))); + curr = @divTrunc(curr, 3) + offset; + + if (curr == 0) break; + } + + return BalancedTernary{ .digits = digits }; + } + + fn toString(self: BalancedTernary, allocator: Allocator) ![]const u8 { + var result = try ArrayList(u8).initCapacity(allocator, self.digits.items.len); + defer result.deinit(); + + var i: usize = self.digits.items.len; + while (i > 0) { + i -= 1; + try result.append(self.digits.items[i].toChar()); + } + + return result.toOwnedSlice(); + } + + fn toI128(self: BalancedTernary) !i128 { + var acc: i128 = 0; + + for (self.digits.items, 0..) |trit, i| { + const index: u32 = std.math.cast(u32, i) orelse return error.Overflow; + + switch (trit) { + .Zero => {}, + .Pos => { + const power = std.math.powi(i128, 3, index) catch return error.Overflow; + acc = std.math.add(i128, acc, power) catch return error.Overflow; + }, + .Neg => { + const power = std.math.powi(i128, 3, index) catch return error.Overflow; + acc = std.math.sub(i128, acc, power) catch return error.Overflow; + }, + } + } + + return acc; + } + + fn trim(digits: *ArrayList(Trit)) void { + while (digits.items.len > 0) { + const last = digits.items[digits.items.len - 1]; + if (last != .Zero) { + break; + } + _ = digits.pop(); + } + } + + fn add(self: BalancedTernary, allocator: Allocator, rhs: BalancedTernary) !BalancedTernary { + if (rhs.digits.items.len == 0) { + if (self.digits.items.len == 0) { + var digits = ArrayList(Trit).init(allocator); + try digits.append(.Zero); + return BalancedTernary{ .digits = digits }; + } + return try self.clone(allocator); + } + + const length = @min(self.digits.items.len, rhs.digits.items.len); + var sum = ArrayList(Trit).init(allocator); + errdefer sum.deinit(); + + var carry = ArrayList(Trit).init(allocator); + errdefer carry.deinit(); + try carry.append(.Zero); + + for (0..length) |i| { + const result = self.digits.items[i].add(rhs.digits.items[i]); + try sum.append(result.current); + try carry.append(result.carry); + } + + if (self.digits.items.len > length) { + try sum.appendSlice(self.digits.items[length..]); + } + if (rhs.digits.items.len > length) { + try sum.appendSlice(rhs.digits.items[length..]); + } + + trim(&sum); + trim(&carry); + + var sum_bt = BalancedTernary{ .digits = sum }; + const carry_bt = BalancedTernary{ .digits = carry }; + //defer carry_bt.deinit(); + + return try sum_bt.add(allocator, carry_bt); + } + + fn mul(self: BalancedTernary, allocator: Allocator, rhs: BalancedTernary) !BalancedTernary { + var results = ArrayList(BalancedTernary).init(allocator); + defer { + for (results.items) |*item| { + item.deinit(); + } + results.deinit(); + } + + for (rhs.digits.items, 0..) |rhs_trit, i| { + var digits = ArrayList(Trit).init(allocator); + errdefer digits.deinit(); + + for (0..i) |_| { + try digits.append(.Zero); + } + + for (self.digits.items) |self_trit| { + try digits.append(self_trit.mul(rhs_trit)); + } + + try results.append(BalancedTernary{ .digits = digits }); + } + + var acc_digits = ArrayList(Trit).init(allocator); + try acc_digits.append(.Zero); + var acc = BalancedTernary{ .digits = acc_digits }; + + for (results.items) |item| { + const new_acc = try acc.add(allocator, item); + acc.deinit(); + acc = new_acc; + } + + return acc; + } + + fn negate(self: *BalancedTernary) void { + for (self.digits.items) |*trit| { + trit.* = trit.negate(); + } + } +}; diff --git a/Task/Barnsley-fern/Ada/barnsley-fern.ada b/Task/Barnsley-fern/Ada/barnsley-fern.adb similarity index 100% rename from Task/Barnsley-fern/Ada/barnsley-fern.ada rename to Task/Barnsley-fern/Ada/barnsley-fern.adb diff --git a/Task/Barnsley-fern/Delphi/barnsley-fern.delphi b/Task/Barnsley-fern/Delphi/barnsley-fern.pas similarity index 100% rename from Task/Barnsley-fern/Delphi/barnsley-fern.delphi rename to Task/Barnsley-fern/Delphi/barnsley-fern.pas diff --git a/Task/Barnsley-fern/EasyLang/barnsley-fern.easy b/Task/Barnsley-fern/EasyLang/barnsley-fern.easy index 3d5e535c80..b326a0836e 100644 --- a/Task/Barnsley-fern/EasyLang/barnsley-fern.easy +++ b/Task/Barnsley-fern/EasyLang/barnsley-fern.easy @@ -1,21 +1,21 @@ -color 060 -for i = 1 to 200000 - r = randomf - if r < 0.01 - nx = 0 - ny = 0.16 * y - elif r < 0.08 - nx = 0.2 * x - 0.26 * y - ny = 0.23 * x + 0.22 * y + 1.6 - elif r < 0.15 - nx = -0.15 * x + 0.28 * y - ny = 0.26 * x + 0.24 * y + 0.44 - else - nx = 0.85 * x + 0.04 * y - ny = -0.04 * x + 0.85 * y + 1.6 - . - x = nx - y = ny - move 50 + x * 15 y * 10 - rect 0.3 0.3 +gbackground 000 +gcolor 263 +for i = 1 to 100000 + r = randomf + if r < 0.01 + nx = 0 + ny = 0.16 * y + elif r < 0.08 + nx = 0.2 * x - 0.26 * y + ny = 0.23 * x + 0.22 * y + 1.6 + elif r < 0.15 + nx = -0.15 * x + 0.28 * y + ny = 0.26 * x + 0.24 * y + 0.44 + else + nx = 0.85 * x + 0.04 * y + ny = -0.04 * x + 0.85 * y + 1.6 + . + x = nx + y = ny + grect 50 + x * 15 y * 10 0.3 0.3 . diff --git a/Task/Barnsley-fern/Emacs-Lisp/barnsley-fern.l b/Task/Barnsley-fern/Emacs-Lisp/barnsley-fern.el similarity index 100% rename from Task/Barnsley-fern/Emacs-Lisp/barnsley-fern.l rename to Task/Barnsley-fern/Emacs-Lisp/barnsley-fern.el diff --git a/Task/Barnsley-fern/FutureBasic/barnsley-fern.basic b/Task/Barnsley-fern/FutureBasic/barnsley-fern.basic new file mode 100644 index 0000000000..bf2badd71f --- /dev/null +++ b/Task/Barnsley-fern/FutureBasic/barnsley-fern.basic @@ -0,0 +1,34 @@ +void local fn BarnsleyFern( height as long ) + double x = 0, y = 0, xn, yn, f = height / 10.6 + long n, r, offsetX = height / 4 - height / 40 + + for n = 1 to height * 50 + r = rnd(100) - 1 + select + case r >= 0 && r <= 84 + xn = 0.85 * x + 0.04 * y + yn = -0.04 * x + 0.85 * y + 1.6 + case r >= 85 && r <= 91 + xn = 0.2 * x - 0.26 * y + yn = 0.23 * x + 0.22 * y + 1.6 + case r >= 92 && r <= 98 + xn = -0.15 * x + 0.28 * y + yn = 0.26 * x + 0.24 * y + 0.44 + case else + xn = 0 + yn = 0.16 * y + end select + + x = xn : y = yn + pen -1 + oval fill (offsetX + x * f, height - y * f, 1.5, 1.5), _zGreen + next + +end fn + +window 1, @"Barnsley fern", (0,0,300,600) +WindowSetBackgroundColor( 1, fn ColorBlack ) + +fn BarnsleyFern( 600 ) + +HandleEvents diff --git a/Task/Barnsley-fern/Julia/barnsley-fern.julia b/Task/Barnsley-fern/Julia/barnsley-fern.jl similarity index 100% rename from Task/Barnsley-fern/Julia/barnsley-fern.julia rename to Task/Barnsley-fern/Julia/barnsley-fern.jl diff --git a/Task/Barnsley-fern/Kotlin/barnsley-fern.kotlin b/Task/Barnsley-fern/Kotlin/barnsley-fern.kts similarity index 100% rename from Task/Barnsley-fern/Kotlin/barnsley-fern.kotlin rename to Task/Barnsley-fern/Kotlin/barnsley-fern.kts diff --git a/Task/Barnsley-fern/Pluto/barnsley-fern.pluto b/Task/Barnsley-fern/Pluto/barnsley-fern.pluto new file mode 100644 index 0000000000..fe97f4f1e1 --- /dev/null +++ b/Task/Barnsley-fern/Pluto/barnsley-fern.pluto @@ -0,0 +1,35 @@ +require "bitmap" + +local w, h = 640, 640 +local bmp = bitmap.of(w, h, color.black, "Barnsley Fern") +local n = 200_000 + +local function create_fern() + local x = 0 + local y = 0 + local c = bitmap.rgbColor(0x32, 0xcd, 0x32) + for i = 0, n - 1 do + local tx + local ty + local r = math.random() + if r <= 0.01 then + tx = 0 + ty = 0.16 * y + elseif r <= 0.86 then + tx = 0.85 * x + 0.04 * y + ty = -0.04 * x + 0.85 * y + 1.6 + elseif r <= 0.93 then + tx = 0.2 * x - 0.26 * y + ty = 0.23 * x + 0.22 * y + 1.6 + else + tx = -0.15 * x + 0.28 * y + ty = 0.26 * x + 0.24 * y + 0.44 + end + x = tx + y = ty + bmp:set(math.round(w / 2 + x * w / 11), math.round(h - y * h / 11), c) + end +end + +create_fern() +bmp:view() diff --git a/Task/Barnsley-fern/Rebol/barnsley-fern.rebol b/Task/Barnsley-fern/Rebol/barnsley-fern.rebol new file mode 100644 index 0000000000..b272eaf806 --- /dev/null +++ b/Task/Barnsley-fern/Rebol/barnsley-fern.rebol @@ -0,0 +1,35 @@ +Rebol [ + title: "Rosetta code: Barnsley Fern" + file: %Barnsley_fern.r3 + url: https://rosettacode.org/wiki/Barnsley_fern + needs: 3.0.0 +] +barnsley-fern: function [size [pair!]][ + img: make image! reduce [size 0.0.0] + width: size/x + height: size/y + + p: 0x0 x: y: 0.0 + repeat i 100000 [ + xt: yt: 0.0 + r: random 100 + case [ + r <= 1 [xt: 0.0 yt: 0.16 * y] + r <= 8 [xt: ( 0.20 * x) - (0.26 * y) yt: ( 0.23 * x) + (0.22 * y) + 1.60] + r <= 15 [xt: (-0.15 * x) + (0.28 * y) yt: ( 0.26 * x) + (0.24 * y) + 0.44] + 'else [xt: ( 0.85 * x) + (0.04 * y) yt: (-0.04 * x) + (0.85 * y) + 1.60] + ] + x: xt y: yt + p/x: round (width / 2 + (60 * x)) + p/y: height - round (60 * y) + change at img p green + ] +] + +img: barnsley-fern 640x640 +save %barnsley-fern.png img + +if cv: attempt [import 'opencv][ + cv/imshow/name img "Barnsley" + cv/waitKey 0 +] diff --git a/Task/Barnsley-fern/Rust/barnsley-fern.rs b/Task/Barnsley-fern/Rust/barnsley-fern.rs new file mode 100644 index 0000000000..fe8f6a528c --- /dev/null +++ b/Task/Barnsley-fern/Rust/barnsley-fern.rs @@ -0,0 +1,45 @@ +extern crate rand; +extern crate raster; + +use rand::Rng; + +fn main() { + let max_iterations = 200_000u32; + let height = 640i32; + let width = 640i32; + + let mut rng = rand::thread_rng(); + let mut image = raster::Image::blank(width, height); + raster::editor::fill(&mut image, raster::Color::white()).unwrap(); + + let mut x = 0.; + let mut y = 0.; + for _ in 0..max_iterations { + let r = rng.r#gen::(); + let cx: f64; + let cy: f64; + + if r <= 0.01 { + cx = 0f64; + cy = 0.16 * y as f64; + } else if r <= 0.08 { + cx = 0.2 * x as f64 - 0.26 * y as f64; + cy = 0.23 * x as f64 + 0.22 * y as f64 + 1.6; + } else if r <= 0.15 { + cx = -0.15 * x as f64 + 0.28 * y as f64; + cy = 0.26 * x as f64 + 0.26 * y as f64 + 0.44; + } else { + cx = 0.85 * x as f64 + 0.04 * y as f64; + cy = -0.04 * x as f64 + 0.85 * y as f64 + 1.6; + } + x = cx; + y = cy; + + let _ = image.set_pixel( + ((width as f64) / 2. + x * (width as f64) / 11.).round() as i32, + ((height as f64) - y * (height as f64) / 11.).round() as i32, + raster::Color::rgb(50, 205, 50)); + } + + raster::save(&image, "fractal.png").unwrap(); +} diff --git a/Task/Barnsley-fern/Rust/barnsley-fern.rust b/Task/Barnsley-fern/Rust/barnsley-fern.rust deleted file mode 100644 index d756f3ebee..0000000000 --- a/Task/Barnsley-fern/Rust/barnsley-fern.rust +++ /dev/null @@ -1,45 +0,0 @@ -extern crate rand; -extern crate raster; - -use rand::Rng; - -fn main() { - let max_iterations = 200_000u32; - let height = 640i32; - let width = 640i32; - - let mut rng = rand::thread_rng(); - let mut image = raster::Image::blank(width, height); - raster::editor::fill(&mut image, raster::Color::white()).unwrap(); - - let mut x = 0.; - let mut y = 0.; - for _ in 0..max_iterations { - let r = rng.gen::(); - let cx: f64; - let cy: f64; - - if r <= 0.01 { - cx = 0f64; - cy = 0.16 * y as f64; - } else if r <= 0.08 { - cx = 0.2 * x as f64 - 0.26 * y as f64; - cy = 0.23 * x as f64 + 0.22 * y as f64 + 1.6; - } else if r <= 0.15 { - cx = -0.15 * x as f64 + 0.28 * y as f64; - cy = 0.26 * x as f64 + 0.26 * y as f64 + 0.44; - } else { - cx = 0.85 * x as f64 + 0.04 * y as f64; - cy = -0.04 * x as f64 + 0.85 * y as f64 + 1.6; - } - x = cx; - y = cy; - - let _ = image.set_pixel( - ((width as f64) / 2. + x * (width as f64) / 11.).round() as i32, - ((height as f64) - y * (height as f64) / 11.).round() as i32, - raster::Color::rgb(50, 205, 50)); - } - - raster::save(&image, "fractal.png").unwrap(); -} diff --git a/Task/Barnsley-fern/Scheme/barnsley-fern.ss b/Task/Barnsley-fern/Scheme/barnsley-fern.scm similarity index 100% rename from Task/Barnsley-fern/Scheme/barnsley-fern.ss rename to Task/Barnsley-fern/Scheme/barnsley-fern.scm diff --git a/Task/Barnsley-fern/Uiua/barnsley-fern.uiua b/Task/Barnsley-fern/Uiua/barnsley-fern.uiua new file mode 100644 index 0000000000..a2d94aeac6 --- /dev/null +++ b/Task/Barnsley-fern/Uiua/barnsley-fern.uiua @@ -0,0 +1,11 @@ +Fs ← [[[0 0 0] [0 0.16 0]] + [[0.85 0.04 0] [¯0.04 0.85 1.6]] + [[0.2 ¯0.26 0] [0.23 0.22 1.6]] + [[¯0.15 0.28 0] [0.26 0.24 0.44]]] +Ps ← [1 86 93 100] +PickF ← (⊡:Fs⊢⊚/⊢)sym⊐⊢ + +B64Dec "VG8gZXJyIGlzIGh1bWFuLCBidXQgdG8gcmVhbGx5IGZvdWwgdGhpbmdzIHVwIHlvdSBuZWVkIGEgY29tcHV0ZXIuCiAgICAtLSBQYXVsIFIuIEVocmxpY2g=" diff --git a/Task/Base64-decode-data/Batch-File/base64-decode-data.bat b/Task/Base64-decode-data/Batch-File/base64-decode-data.bat new file mode 100644 index 0000000000..73b80ec78d --- /dev/null +++ b/Task/Base64-decode-data/Batch-File/base64-decode-data.bat @@ -0,0 +1,2 @@ +certutil -f -decodehex "%temp%\favicon.tmp" favicon1.ico 1 +fc /B favicon.ico favicon1.ico diff --git a/Task/Base64-decode-data/Crystal/base64-decode-data.crystal b/Task/Base64-decode-data/Crystal/base64-decode-data.cr similarity index 100% rename from Task/Base64-decode-data/Crystal/base64-decode-data.crystal rename to Task/Base64-decode-data/Crystal/base64-decode-data.cr diff --git a/Task/Base64-decode-data/Delphi/base64-decode-data.delphi b/Task/Base64-decode-data/Delphi/base64-decode-data.pas similarity index 100% rename from Task/Base64-decode-data/Delphi/base64-decode-data.delphi rename to Task/Base64-decode-data/Delphi/base64-decode-data.pas diff --git a/Task/Base64-decode-data/Ed/base64-decode-data.ed b/Task/Base64-decode-data/Ed/base64-decode-data.ed new file mode 100644 index 0000000000..177f09f0a1 --- /dev/null +++ b/Task/Base64-decode-data/Ed/base64-decode-data.ed @@ -0,0 +1,172 @@ +H +,p +g/.*/s/\B/ /g +g/\b=\b/s// 000000 /g +g/\bA\b/s// 000000 /g +g/\bB\b/s// 000001 /g +g/\bC\b/s// 000010 /g +g/\bD\b/s// 000011 /g +g/\bE\b/s// 000100 /g +g/\bF\b/s// 000101 /g +g/\bG\b/s// 000110 /g +g/\bH\b/s// 000111 /g +g/\bI\b/s// 001000 /g +g/\bJ\b/s// 001001 /g +g/\bK\b/s// 001010 /g +g/\bL\b/s// 001011 /g +g/\bM\b/s// 001100 /g +g/\bN\b/s// 001101 /g +g/\bO\b/s// 001110 /g +g/\bP\b/s// 001111 /g +g/\bQ\b/s// 010000 /g +g/\bR\b/s// 010001 /g +g/\bS\b/s// 010010 /g +g/\bT\b/s// 010011 /g +g/\bU\b/s// 010100 /g +g/\bV\b/s// 010101 /g +g/\bW\b/s// 010110 /g +g/\bX\b/s// 010111 /g +g/\bY\b/s// 011000 /g +g/\bZ\b/s// 011001 /g +g/\ba\b/s// 011010 /g +g/\bb\b/s// 011011 /g +g/\bc\b/s// 011100 /g +g/\bd\b/s// 011101 /g +g/\be\b/s// 011110 /g +g/\bf\b/s// 011111 /g +g/\bg\b/s// 100000 /g +g/\bh\b/s// 100001 /g +g/\bi\b/s// 100010 /g +g/\bj\b/s// 100011 /g +g/\bk\b/s// 100100 /g +g/\bl\b/s// 100101 /g +g/\bm\b/s// 100110 /g +g/\bn\b/s// 100111 /g +g/\bo\b/s// 101000 /g +g/\bp\b/s// 101001 /g +g/\bq\b/s// 101010 /g +g/\br\b/s// 101011 /g +g/\bs\b/s// 101100 /g +g/\bt\b/s// 101101 /g +g/\bu\b/s// 101110 /g +g/\bv\b/s// 101111 /g +g/\bw\b/s// 110000 /g +g/\bx\b/s// 110001 /g +g/\by\b/s// 110010 /g +g/\bz\b/s// 110011 /g +g/\b0\b/s// 110100 /g +g/\b1\b/s// 110101 /g +g/\b2\b/s// 110110 /g +g/\b3\b/s// 110111 /g +g/\b4\b/s// 111000 /g +g/\b5\b/s// 111001 /g +g/\b6\b/s// 111010 /g +g/\b7\b/s// 111011 /g +g/\b8\b/s// 111100 /g +g/\b9\b/s// 111101 /g +g/\b=\b/s// 000000 /g +g/\b\+\b/s// 111110 /g +g/\b\/\b/s// 111111 /g +g/[[:space:]]/s///g +g/[01]{8}/s// & /g +g/00000000/s///g +g/00001010/s//\ +/g +g/00100000/s// /g +g/00100001/s//!/g +g/00100010/s//"/g +g/00100011/s//#/g +g/00100100/s//$/g +g/00100101/s//%/g +g/00100110/s//&/g +g/00100111/s//'/g +g/00101000/s//(/g +g/00101001/s//)/g +g/00101010/s//*/g +g/00101011/s//+/g +g/00101100/s//,/g +g/00101101/s//-/g +g/00101110/s//./g +g/00101111/s////g +g/00110000/s//0/g +g/00110001/s//1/g +g/00110010/s//2/g +g/00110011/s//3/g +g/00110100/s//4/g +g/00110101/s//5/g +g/00110110/s//6/g +g/00110111/s//7/g +g/00111000/s//8/g +g/00111001/s//9/g +g/00111010/s//:/g +g/00111011/s//;/g +g/00111100/s///g +g/00111111/s//?/g +g/01000000/s//@/g +g/01000001/s//A/g +g/01000010/s//B/g +g/01000011/s//C/g +g/01000100/s//D/g +g/01000101/s//E/g +g/01000110/s//F/g +g/01000111/s//G/g +g/01001000/s//H/g +g/01001001/s//I/g +g/01001010/s//J/g +g/01001011/s//K/g +g/01001100/s//L/g +g/01001101/s//M/g +g/01001110/s//N/g +g/01001111/s//O/g +g/01010000/s//P/g +g/01010001/s//Q/g +g/01010010/s//R/g +g/01010011/s//S/g +g/01010100/s//T/g +g/01010101/s//U/g +g/01010110/s//V/g +g/01010111/s//W/g +g/01011000/s//X/g +g/01011001/s//Y/g +g/01011010/s//Z/g +g/01011011/s//[/g +g/01011100/s//\/g +g/01011101/s//]/g +g/01011110/s//^/g +g/01011111/s//_/g +g/01100000/s//`/g +g/01100001/s//a/g +g/01100010/s//b/g +g/01100011/s//c/g +g/01100100/s//d/g +g/01100101/s//e/g +g/01100110/s//f/g +g/01100111/s//g/g +g/01101000/s//h/g +g/01101001/s//i/g +g/01101010/s//j/g +g/01101011/s//k/g +g/01101100/s//l/g +g/01101101/s//m/g +g/01101110/s//n/g +g/01101111/s//o/g +g/01110000/s//p/g +g/01110001/s//q/g +g/01110010/s//r/g +g/01110011/s//s/g +g/01110100/s//t/g +g/01110101/s//u/g +g/01110110/s//v/g +g/01110111/s//w/g +g/01111000/s//x/g +g/01111001/s//y/g +g/01111010/s//z/g +g/01111011/s//{/g +g/01111100/s//|/g +g/01111101/s//}/g +g/01111110/s//~/g +g/[ ][ ](.)[ ][ ]/s//\1/g +,p +Q diff --git a/Task/Base64-decode-data/FutureBasic/base64-decode-data.basic b/Task/Base64-decode-data/FutureBasic/base64-decode-data.basic index 384292a93e..8837b09bef 100644 --- a/Task/Base64-decode-data/FutureBasic/base64-decode-data.basic +++ b/Task/Base64-decode-data/FutureBasic/base64-decode-data.basic @@ -20,7 +20,7 @@ originalString = @"This is a test string to be encoded as Base64 and then decode NSLog( @"This is the original string:\n\t%@\n", originalString ) encodedBase64String = fn EncodeStringAsBase64( originalString ) -NSLog( @"This is the original string encoded as Base84:\n\t%@\n", encodedBase64String ) +NSLog( @"This is the original string encoded as Base64:\n\t%@\n", encodedBase64String ) decodedBase64String = fn DecodeBase64String( encodedBase64String ) NSLog( @"This is the Base64 string decoded:\n\t%@", decodedBase64String ) diff --git a/Task/Base64-decode-data/Haxe/base64-decode-data.haxe b/Task/Base64-decode-data/Haxe/base64-decode-data.hx similarity index 100% rename from Task/Base64-decode-data/Haxe/base64-decode-data.haxe rename to Task/Base64-decode-data/Haxe/base64-decode-data.hx diff --git a/Task/Base64-decode-data/Julia/base64-decode-data.julia b/Task/Base64-decode-data/Julia/base64-decode-data.jl similarity index 100% rename from Task/Base64-decode-data/Julia/base64-decode-data.julia rename to Task/Base64-decode-data/Julia/base64-decode-data.jl diff --git a/Task/Base64-decode-data/Kotlin/base64-decode-data.kotlin b/Task/Base64-decode-data/Kotlin/base64-decode-data.kts similarity index 100% rename from Task/Base64-decode-data/Kotlin/base64-decode-data.kotlin rename to Task/Base64-decode-data/Kotlin/base64-decode-data.kts diff --git a/Task/Base64-decode-data/M2000-Interpreter/base64-decode-data-1.m2000 b/Task/Base64-decode-data/M2000-Interpreter/base64-decode-data-1.m2000 index 5ede834f8d..1229d1d3e8 100644 --- a/Task/Base64-decode-data/M2000-Interpreter/base64-decode-data-1.m2000 +++ b/Task/Base64-decode-data/M2000-Interpreter/base64-decode-data-1.m2000 @@ -5,7 +5,7 @@ uCiAgICAtLSBQYXVsIFIuIEVocmxpY2g= } tmp$=tempname$ open tmp$ for wide output as #f - print #f, string$(inp$ as decode64); + print #f, string$(inp$ as decode64); close #f document a$ load.doc a$, tmp$ diff --git a/Task/Base64-decode-data/Nu/base64-decode-data.nu b/Task/Base64-decode-data/Nu/base64-decode-data.nu new file mode 100644 index 0000000000..a55526dfa1 --- /dev/null +++ b/Task/Base64-decode-data/Nu/base64-decode-data.nu @@ -0,0 +1,2 @@ +'VG8gZXJyIGlzIGh1bWFuLCBidXQgdG8gcmVhbGx5IGZvdWwgdGhpbmdzIHVwIHlvdSBuZWVkIGEgY29tcHV0ZXIuCiAgICAtLSBQYXVsIFIuIEVocmxpY2g=' +| decode base64 diff --git a/Task/Base64-decode-data/Pluto/base64-decode-data.pluto b/Task/Base64-decode-data/Pluto/base64-decode-data.pluto new file mode 100644 index 0000000000..b8359fd691 --- /dev/null +++ b/Task/Base64-decode-data/Pluto/base64-decode-data.pluto @@ -0,0 +1,4 @@ +local base64 = require("base64") + +local s = "VG8gZXJyIGlzIGh1bWFuLCBidXQgdG8gcmVhbGx5IGZvdWwgdGhpbmdzIHVwIHlvdSBuZWVkIGEgY29tcHV0ZXIuCiAgICAtLSBQYXVsIFIuIEVocmxpY2g=" +print(base64.decode(s)) diff --git a/Task/Base64-decode-data/PowerShell/base64-decode-data-1.ps1 b/Task/Base64-decode-data/PowerShell/base64-decode-data-1.ps1 new file mode 100644 index 0000000000..429bf1334a --- /dev/null +++ b/Task/Base64-decode-data/PowerShell/base64-decode-data-1.ps1 @@ -0,0 +1 @@ +[Text.Encoding]::ASCII.GetString([Convert]::FromBase64String("VG8gZXJyIGlzIGh1bWFuLCBidXQgdG8gcmVhbGx5IGZvdWwgdGhpbmdzIHVwIHlvdSBuZWVkIGEgY29tcHV0ZXIuCiAgICAtLSBQYXVsIFIuIEVocmxpY2g=")) diff --git a/Task/Base64-decode-data/PowerShell/base64-decode-data-2.ps1 b/Task/Base64-decode-data/PowerShell/base64-decode-data-2.ps1 new file mode 100644 index 0000000000..8e3ff8d7a3 --- /dev/null +++ b/Task/Base64-decode-data/PowerShell/base64-decode-data-2.ps1 @@ -0,0 +1,2 @@ +$bytes=... +[IO.File]::WriteAllBytes('favicon.ico', [Convert]::FromBase64String($bytes)) diff --git a/Task/Base64-decode-data/REXX/base64-decode-data-1.rexx b/Task/Base64-decode-data/REXX/base64-decode-data-1.rexx new file mode 100644 index 0000000000..3d85bbec31 --- /dev/null +++ b/Task/Base64-decode-data/REXX/base64-decode-data-1.rexx @@ -0,0 +1,20 @@ +z= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +do i=1 to 64 + bs.i=x2b(d2x(i-1)) + c=substr(z,i,1) + ds.c=right(bs.i,6,0) + End +e='YW55IGNhcm5hbCBwbGVhc3VyZS4' +r='' +ec=e +Do While ec<>'' + Parse Var ec c +1 ec + r=r||ds.c + End +res='' +Do while r<>'' + Parse Var r x +8 r + res=res||x2c(b2x(x)) + End +Say 'Input: >'e'<' +Say 'decoded: >'res'<' diff --git a/Task/Base64-decode-data/REXX/base64-decode-data-2.rexx b/Task/Base64-decode-data/REXX/base64-decode-data-2.rexx new file mode 100644 index 0000000000..90d8c0c1ce --- /dev/null +++ b/Task/Base64-decode-data/REXX/base64-decode-data-2.rexx @@ -0,0 +1,56 @@ +-- 3 Oct 2025 +include Setting +signal off notready + +say 'BASE64 DECODE DATA' +say version +say +call Task1 'TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsu' +call Task1 'TWFu' +call Task1 'TWE=' +call Task1 'TQ==' +call Task1 'YW55IGNhcm5hbCBwbGVhc3VyZS4=' +call Task2 +exit + +Task1: +procedure +parse arg xx +say 'Encoded ' xx +say 'Original' Decode64(xx) +say +return + +Task2: +procedure +in='favicon.dat'; out='favcopy.ico' +rr=Decode64(Charin(in,1,30000)) +call Charout out,rr,1 +return + +Decode64: +procedure +parse arg xx +-- Alphabet +a='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +lx=Length(xx) +rr='' +-- Loop thru encoded characters +do i=1 to lx + c=Substr(xx,i,1) +-- If padding, discard 2 bits + if c='=' then do + rr=Left(rr,Length(rr)-2) + iterate i + end +-- Find position in alphabet + p=Pos(c,a)-1 +-- Convert to bits and take last 6 + b=Right(0000||X2b(D2x(p)),6) +-- Append + rr||=b +end +-- Convert to character +return X2c(B2x(rr)) + +include Abend diff --git a/Task/Base64-decode-data/Rebol/base64-decode-data.rebol b/Task/Base64-decode-data/Rebol/base64-decode-data.rebol new file mode 100644 index 0000000000..a921880d20 --- /dev/null +++ b/Task/Base64-decode-data/Rebol/base64-decode-data.rebol @@ -0,0 +1,3 @@ +print to string! debase { +VG8gZXJyIGlzIGh1bWFuLCBidXQgdG8gcmVhbGx5IGZvdWwgdGhpbmdzIH +VwIHlvdSBuZWVkIGEgY29tcHV0ZXIuCiAgICAtLVBhdWwgUi5FaHJsaWNo} 64 diff --git a/Task/Base64-decode-data/Rust/base64-decode-data.rust b/Task/Base64-decode-data/Rust/base64-decode-data.rs similarity index 100% rename from Task/Base64-decode-data/Rust/base64-decode-data.rust rename to Task/Base64-decode-data/Rust/base64-decode-data.rs diff --git a/Task/Base64-decode-data/Swift/base64-decode-data.swift b/Task/Base64-decode-data/Swift/base64-decode-data.swift new file mode 100644 index 0000000000..bc056552f2 --- /dev/null +++ b/Task/Base64-decode-data/Swift/base64-decode-data.swift @@ -0,0 +1,10 @@ +import Foundation + +let input = """ +VG8gZXJyIGlzIGh1bWFuLCBidXQgdG8gcmVhbGx5IGZvdWwgdGhpbmdzIHVwIHlvdSBuZWVkIGEgY29tcHV0ZXIuCiAgICAtLSBQYXVsIFIuIEVocmxpY2g= +""" + +if let decoded = Data(base64Encoded: input), +let str = String(data: decoded, encoding: .utf8) { + print( str ) +} diff --git a/Task/Base64-decode-data/Wren/base64-decode-data.wren b/Task/Base64-decode-data/Wren/base64-decode-data.wren index 9c8e94f12f..9b527a7be8 100644 --- a/Task/Base64-decode-data/Wren/base64-decode-data.wren +++ b/Task/Base64-decode-data/Wren/base64-decode-data.wren @@ -1,6 +1,6 @@ import "io" for Stdout -import "/fmt" for Conv, Fmt -import "/str" for Str +import "./fmt" for Conv, Fmt +import "./str" for Str var alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" diff --git a/Task/Base64-decode-data/YAMLScript/base64-decode-data.ys b/Task/Base64-decode-data/YAMLScript/base64-decode-data.ys new file mode 100644 index 0000000000..940785796f --- /dev/null +++ b/Task/Base64-decode-data/YAMLScript/base64-decode-data.ys @@ -0,0 +1,4 @@ +!YS-v0 + +defn main(str): + say: base64-decode(str) diff --git a/Task/Base64-decode-data/Zig/base64-decode-data.zig b/Task/Base64-decode-data/Zig/base64-decode-data.zig new file mode 100644 index 0000000000..cad232e18b --- /dev/null +++ b/Task/Base64-decode-data/Zig/base64-decode-data.zig @@ -0,0 +1,86 @@ +const std = @import("std"); +const print = std.debug.print; +const ArrayList = std.ArrayList; +const Allocator = std.mem.Allocator; + +const INPUT = "VG8gZXJyIGlzIGh1bWFuLCBidXQgdG8gcmVhbGx5IGZvdWwgdGhpbmdzIHVwIHlvdSBuZWVkIGEgY29tcHV0ZXIuCiAgICAtLVBhdWwgUi5FaHJsaWNo"; +const UPPERCASE_OFFSET: i8 = -65; +const LOWERCASE_OFFSET: i8 = 26 - 97; +const NUM_OFFSET: i8 = 52 - 48; + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer _ = gpa.deinit(); + const allocator = gpa.allocator(); + + print("Input: {s}\n", .{INPUT}); + + // Create a dynamic array to collect binary strings + var binary_strings = ArrayList([]const u8).init(allocator); + defer { + for (binary_strings.items) |item| { + allocator.free(item); + } + binary_strings.deinit(); + } + + // Process each character and convert to binary + for (INPUT) |ch| { + if (ch == '=') continue; // Filter '=' chars + + // Map char values using Base64 Characters Table + const ascii: i8 = @intCast(ch); + const convert: u8 = switch (ch) { + '0'...'9' => @intCast(ascii + NUM_OFFSET), + 'a'...'z' => @intCast(ascii + LOWERCASE_OFFSET), + 'A'...'Z' => @intCast(ascii + UPPERCASE_OFFSET), + '+' => 62, + '/' => 63, + else => { + print("Not a valid base64 encoded string\n", .{}); + return; + }, + }; + + // Convert to binary format (6 bits for base64) + const binary_str = try std.fmt.allocPrint(allocator, "{b:0>6}", .{convert}); + try binary_strings.append(binary_str); + } + + // Concatenate all binary strings + var total_len: usize = 0; + for (binary_strings.items) |item| { + total_len += item.len; + } + + const concatenated = try allocator.alloc(u8, total_len); + defer allocator.free(concatenated); + + var pos: usize = 0; + for (binary_strings.items) |item| { + @memcpy(concatenated[pos..pos + item.len], item); + pos += item.len; + } + + // Split into 8-character chunks and convert to bytes + var result_bytes = ArrayList(u8).init(allocator); + defer result_bytes.deinit(); + + var i: usize = 0; + while (i + 8 <= concatenated.len) : (i += 8) { + const chunk = concatenated[i..i + 8]; + const byte_value = std.fmt.parseInt(u8, chunk, 2) catch |err| { + print("Error parsing binary: {}\n", .{err}); + return; + }; + try result_bytes.append(byte_value); + } + + // Convert to UTF-8 string and print + const result_str = result_bytes.items; + if (std.unicode.utf8ValidateSlice(result_str)) { + print("Output: {s}\n", .{result_str}); + } else { + print("Invalid UTF-8 sequence\n", .{}); + } +} diff --git a/Task/Base64-decode-data/Zkl/base64-decode-data-1.zkl b/Task/Base64-decode-data/Zkl/base64-decode-data-1.zkl index d8d7d8dc96..365675c755 100644 --- a/Task/Base64-decode-data/Zkl/base64-decode-data-1.zkl +++ b/Task/Base64-decode-data/Zkl/base64-decode-data-1.zkl @@ -1,7 +1,7 @@ var [const] MsgHash=Import("zklMsgHash"), Curl=Import("zklCurl"); icon:=Curl().get("http://rosettacode.org/favicon.ico"); //-->(Data(4,331),693,0) -icon=icon[0][icon[1],*]; // remove header +icon=icon[0][icon[1],*]; // remove header iconEncoded:=MsgHash.base64encode(icon); iconDecoded:=MsgHash.base64decode(iconEncoded); File("rosettaCodeIcon.ico","wb").write(iconDecoded); # eyeball checking says good diff --git a/Task/Bell-numbers/ALGOL-W/bell-numbers.alg b/Task/Bell-numbers/ALGOL-W/bell-numbers.alg new file mode 100644 index 0000000000..7a9422b621 --- /dev/null +++ b/Task/Bell-numbers/ALGOL-W/bell-numbers.alg @@ -0,0 +1,18 @@ +begin % show some Bell numbers % + integer MAX_BELL; + MAX_BELL := 15; + begin + procedure showBell ( integer value n, bellNumber ) ; + write( i_w := 2, s_w := 0, n, ": ", i_w := 1, bellNumber ); + integer array a ( 0 :: MAX_BELL - 2 ); + for i := 1 until MAX_BELL - 2 do a( i ) := 0; + a( 0 ) := 1; + showBell( 1, a( 0 ) ); + for n := 0 until MAX_BELL - 2 do begin + % replace a with the next line of the triangle % + a( n ) := a( 0 ); + for j := n step -1 until 1 do a( j - 1 ) := a( j - 1 ) + a( j ); + showBell( n + 2, a( 0 ) ) + end for_n + end +end. diff --git a/Task/Bell-numbers/ANSI-BASIC/bell-numbers.basic b/Task/Bell-numbers/ANSI-BASIC/bell-numbers.basic index f164dbfea7..b2d2b6c711 100644 --- a/Task/Bell-numbers/ANSI-BASIC/bell-numbers.basic +++ b/Task/Bell-numbers/ANSI-BASIC/bell-numbers.basic @@ -1,7 +1,7 @@ 100 REM Bell numbers -110 LET MaxN = 14 -120 OPTION BASE 0 -130 DIM A(13) ! i.e. DIM A(MaxN - 1), ANSI BASIC does not allow expressions in the bound arguments. +110 OPTION BASE 0 +120 DIM A(13) +130 LET MaxN = UBOUND(A) + 1 140 FOR I = 0 TO MaxN - 1 150 LET A(I) = 0 160 NEXT I diff --git a/Task/Bell-numbers/AWK/bell-numbers.awk b/Task/Bell-numbers/AWK/bell-numbers.awk new file mode 100644 index 0000000000..f304853fb9 --- /dev/null +++ b/Task/Bell-numbers/AWK/bell-numbers.awk @@ -0,0 +1,23 @@ +# syntax: GAWK --bignum -f BELL_NUMBERS.AWK +BEGIN { + arr[0,0] = 1 + printf(" 0: %10d\n",arr[0,0]) + printf(" 1: %10d\n",arr[0,0]) + for (i=1; i<50; i++) { + arr[i,0] = arr[i-1,i-1] + for (j=1; j<=i; j++) { + arr[i,j] = arr[i,j-1] + arr[i-1,j-1] + bt[i] = sprintf("%s%s ",bt[i],arr[i-1,j-1]) # build Bell's triangle + } + if (i <= 13) { + printf("%2d: %10d\n",i+1,arr[i,i]) + } + if (i == 49) { + printf("%2d: %d (%d digits)\n\n",i+1,arr[i,i],length(arr[i,i])) + } + } + for (i=1; i<=10; i++) { # show Bell's triangle + printf("%2d: %s\n",i,bt[i]) + } + exit(0) +} diff --git a/Task/Bell-numbers/Ada/bell-numbers.ada b/Task/Bell-numbers/Ada/bell-numbers.adb similarity index 100% rename from Task/Bell-numbers/Ada/bell-numbers.ada rename to Task/Bell-numbers/Ada/bell-numbers.adb diff --git a/Task/Bell-numbers/BQN/bell-numbers.bqn b/Task/Bell-numbers/BQN/bell-numbers.bqn new file mode 100644 index 0000000000..918f1357ad --- /dev/null +++ b/Task/Bell-numbers/BQN/bell-numbers.bqn @@ -0,0 +1,8 @@ +Bell ← {(+`⊢´⊸∾)⍟(↕𝕩)⋈1} + +•Out "First 15 Bell numbers:" +•Show ⊑¨ Bell 15 + +•Out "" +•Out "First 10 rows of the Bell triangle:" +•Show¨ Bell 10 diff --git a/Task/Bell-numbers/Berkeley-Logo/bell-numbers.logo b/Task/Bell-numbers/Berkeley-Logo/bell-numbers.logo new file mode 100644 index 0000000000..6a7e9966a9 --- /dev/null +++ b/Task/Bell-numbers/Berkeley-Logo/bell-numbers.logo @@ -0,0 +1,21 @@ +to bell.numbers :max.n + make "a (array :max.n 0) + make "n 0 + make "ubound.a :max.n - 1 + for [i 0 :ubound.a] [setitem :i :a 0] + setitem 0 :a 1 + type "|B(| + type form :n 2 0 + type "|) = | + print form item 0 :a 9 0 + while [:n < :max.n] ~ + [setitem :n :a item 0 :a + for [j :n 1 -1] ~ + [setitem :j - 1 :a (item :j - 1 :a) + (item :j :a)] + make "n :n + 1 + type "|B(| + type form :n 2 0 + type "|) = | + print form item 0 :a 9 0] + erase [[] [a] []] +end diff --git a/Task/Bell-numbers/C-sharp/bell-numbers.cs b/Task/Bell-numbers/C-sharp/bell-numbers-1.cs similarity index 100% rename from Task/Bell-numbers/C-sharp/bell-numbers.cs rename to Task/Bell-numbers/C-sharp/bell-numbers-1.cs diff --git a/Task/Bell-numbers/C-sharp/bell-numbers-2.cs b/Task/Bell-numbers/C-sharp/bell-numbers-2.cs new file mode 100644 index 0000000000..f2da84e2ba --- /dev/null +++ b/Task/Bell-numbers/C-sharp/bell-numbers-2.cs @@ -0,0 +1,25 @@ +using System.Numerics; + +foreach (var row in BellTriangle().Take(15)) +{ + Console.WriteLine(row[0]); +} + +Console.WriteLine(BellTriangle().ElementAt(49)[0]); + +foreach (var row in BellTriangle().Take(10)) +{ + Console.WriteLine(string.Join(", ", row)); +} + +IEnumerable> BellTriangle() +{ + List row = [1]; + + while (true) + { + yield return row; + var scan = row[^1]; + row = [scan, .. row.Select(r => scan += r) ]; + } +} diff --git a/Task/Bell-numbers/Crystal/bell-numbers.cr b/Task/Bell-numbers/Crystal/bell-numbers.cr new file mode 100644 index 0000000000..2ad901f5b0 --- /dev/null +++ b/Task/Bell-numbers/Crystal/bell-numbers.cr @@ -0,0 +1,12 @@ +require "big" + +row = [1.to_big_i] + +(1..50).each do |i| + puts "%2d: %s" % { i, i <= 10 ? row : row.first } if 1 <= i <= 15 || i == 50 + next_row = [row.last] + row.each do |n| + next_row << n + next_row.last + end + row = next_row +end diff --git a/Task/Bell-numbers/Delphi/bell-numbers.delphi b/Task/Bell-numbers/Delphi/bell-numbers.pas similarity index 100% rename from Task/Bell-numbers/Delphi/bell-numbers.delphi rename to Task/Bell-numbers/Delphi/bell-numbers.pas diff --git a/Task/Bell-numbers/EasyLang/bell-numbers.easy b/Task/Bell-numbers/EasyLang/bell-numbers.easy index e554895111..d4a9e3ac8c 100644 --- a/Task/Bell-numbers/EasyLang/bell-numbers.easy +++ b/Task/Bell-numbers/EasyLang/bell-numbers.easy @@ -10,5 +10,6 @@ func bell n . return list[n] . for i = 1 to 15 - print bell i + write bell i & " " . +print "" diff --git a/Task/Bell-numbers/Elixir/bell-numbers.elixir b/Task/Bell-numbers/Elixir/bell-numbers.ex similarity index 100% rename from Task/Bell-numbers/Elixir/bell-numbers.elixir rename to Task/Bell-numbers/Elixir/bell-numbers.ex diff --git a/Task/Bell-numbers/Forth/bell-numbers.fth b/Task/Bell-numbers/Forth/bell-numbers.fth new file mode 100644 index 0000000000..6b7c8259fa --- /dev/null +++ b/Task/Bell-numbers/Forth/bell-numbers.fth @@ -0,0 +1,51 @@ +: triangle-allocate ( u -- addr ) + dup 1+ * 2/ cells dup + allocate abort" out of memory" + tuck swap erase ; + +: triangle-deallocate ( addr -- ) + free abort" memory deallocation error" ; + +: triangle-row-address ( addr u -- addr ) + dup 1+ * 2/ cells + ; + +: bell-triangle-row ( addr u -- ) + tuck 1- triangle-row-address + 2dup swap cells + + dup 1 cells - @ over ! + rot 0 ?do + dup @ >r over @ r> + >r + cell+ r> over ! + swap cell+ swap + loop 2drop ; + +: bell-triangle ( u -- addr ) + dup triangle-allocate + dup 1 swap ! + swap 1 ?do + dup i bell-triangle-row + loop ; + +: print-bell-numbers ( addr u -- ) + 0 ?do + dup i triangle-row-address @ . cr + loop drop ; + +: print-bell-row ( addr u -- ) + tuck triangle-row-address swap + 1+ 0 ?do + dup @ . cell+ + loop drop cr ; + +: main ( -- ) + 15 bell-triangle + ." First 15 Bell numbers:" cr + dup 15 print-bell-numbers cr + ." First 10 rows of the Bell triangle:" cr + 10 0 do + dup i print-bell-row + loop + triangle-deallocate ; + +main +bye diff --git a/Task/Bell-numbers/Pascal/bell-numbers.pas b/Task/Bell-numbers/Free-Pascal-Lazarus/bell-numbers.pas similarity index 100% rename from Task/Bell-numbers/Pascal/bell-numbers.pas rename to Task/Bell-numbers/Free-Pascal-Lazarus/bell-numbers.pas diff --git a/Task/Bell-numbers/Haskell/bell-numbers-5.hs b/Task/Bell-numbers/Haskell/bell-numbers-5.hs new file mode 100644 index 0000000000..2574f2daa3 --- /dev/null +++ b/Task/Bell-numbers/Haskell/bell-numbers-5.hs @@ -0,0 +1,17 @@ +import Data.Ratio ((%), numerator) + +infixl 7 *. +(*.) :: Num a => a -> [a] -> [a] +x *. (p:ps) = x*p : x*.ps + +instance Num a => Num [a] where + negate = map negate + (+) = zipWith (+) + (*) (p:ps) (q:qs) = p*q : ((p*.qs) + ps*(q:qs)) + fromInteger n = fromInteger n:repeat 0 + +instance (Eq a, Fractional a) => Fractional [a] where + (/) (0:ps) (0:qs) = ps/qs + (/) (p:ps) (q:qs) = let r=p/q in r : (ps - r*.qs)/(q:qs) + + fromRational q = fromRational q:repeat 0 diff --git a/Task/Bell-numbers/Haskell/bell-numbers-6.hs b/Task/Bell-numbers/Haskell/bell-numbers-6.hs new file mode 100644 index 0000000000..1cccede973 --- /dev/null +++ b/Task/Bell-numbers/Haskell/bell-numbers-6.hs @@ -0,0 +1,2 @@ +expseq :: [Rational] -> [Rational] +expseq ps = zipWith (\p q -> p*fromInteger q) ps (scanl (*) 1 [1..]) diff --git a/Task/Bell-numbers/Haskell/bell-numbers-7.hs b/Task/Bell-numbers/Haskell/bell-numbers-7.hs new file mode 100644 index 0000000000..e6c2d50d9c --- /dev/null +++ b/Task/Bell-numbers/Haskell/bell-numbers-7.hs @@ -0,0 +1,3 @@ +infixr 9 |> +(|>) :: (Eq a, Num a) => [a] -> [a] -> [a] +(p:ps) |> (0:qs) = p : qs*(ps |> (0:qs)) diff --git a/Task/Bell-numbers/Haskell/bell-numbers-8.hs b/Task/Bell-numbers/Haskell/bell-numbers-8.hs new file mode 100644 index 0000000000..9cc115db88 --- /dev/null +++ b/Task/Bell-numbers/Haskell/bell-numbers-8.hs @@ -0,0 +1,11 @@ +exp1 :: [Rational] +exp1 = 0 : map (1%) factorials + where + factorials = scanl (*) 1 [2..] + +exps :: [Rational] +exps = 1 : zipWith (*) exps [ 1%n | n <- [1..] ] + +bell :: [Integer] +bell = map numerator + (expseq (exps |> exp1)) diff --git a/Task/Bell-numbers/Haskell/bell-numbers-9.hs b/Task/Bell-numbers/Haskell/bell-numbers-9.hs new file mode 100644 index 0000000000..11d50b5761 --- /dev/null +++ b/Task/Bell-numbers/Haskell/bell-numbers-9.hs @@ -0,0 +1,4 @@ +ghci> take 15 bell +[1,1,2,5,15,52,203,877,4140,21147,115975,678570,4213597,27644437,190899322] +ghci> bell !! 49 +10726137154573358400342215518590002633917247281 diff --git a/Task/Bell-numbers/JavaScript/bell-numbers.js b/Task/Bell-numbers/JavaScript/bell-numbers.js new file mode 100644 index 0000000000..d6982673f0 --- /dev/null +++ b/Task/Bell-numbers/JavaScript/bell-numbers.js @@ -0,0 +1,75 @@ +// --------------------------------------------------------------- +// Bell Triangle implementation (JavaScript) +// --------------------------------------------------------------- + +class BellTriangle { + /** + * @param {number} n – number of rows to generate + */ + constructor(n) { + // total number of elements in a triangular array of size n + const length = (n * (n + 1)) / 2; + // use a plain array, pre‑filled with zeros + this.arr = new Array(length).fill(0); + + // initialise first element (row 1, col 0) = 1 + this.set(1, 0, 1); + + // build the triangle row by row + for (let i = 2; i <= n; ++i) { + // first element of a row copies the last element of the previous row + this.set(i, 0, this.get(i - 1, i - 2)); + + // the remaining entries are sums of the element above‑left + // and the element to the left in the current row + for (let j = 1; j < i; ++j) { + const value = this.get(i, j - 1) + this.get(i - 1, j - 1); + this.set(i, j, value); + } + } + } + + /** Convert (row, col) into a linear index. Rows start at 1. */ + index(row, col) { + if (row > 0 && col >= 0 && col < row) { + // triangular number formula: sum_{k=1}^{row-1} k = row*(row-1)/2 + return (row * (row - 1)) / 2 + col; + } + throw new Error('Invalid row/col'); + } + + /** Return the value at (row, col). */ + get(row, col) { + const i = this.index(row, col); + return this.arr[i]; + } + + /** Store `value` at (row, col). */ + set(row, col, value) { + const i = this.index(row, col); + this.arr[i] = value; + } +} + +// --------------------------------------------------------------- +// Main program – reproduces the Java `main` method +// --------------------------------------------------------------- +(function main() { + const rows = 15; + const bt = new BellTriangle(rows); + + console.log('First fifteen Bell numbers:'); + for (let i = 0; i < rows; ++i) { + // the Bell number Bₙ is the first entry of row n (row index = n, col = 0) + console.log(`${i + 1}: ${bt.get(i + 1, 0)}`); + } + + // Print the whole triangle for the first 10 rows (exactly as Java did) + for (let i = 1; i <= 10; ++i) { + let line = `${bt.get(i, 0)}`; + for (let j = 1; j < i; ++j) { + line += `, ${bt.get(i, j)}`; + } + console.log(line); + } +})(); diff --git a/Task/Bell-numbers/Julia/bell-numbers.julia b/Task/Bell-numbers/Julia/bell-numbers.jl similarity index 100% rename from Task/Bell-numbers/Julia/bell-numbers.julia rename to Task/Bell-numbers/Julia/bell-numbers.jl diff --git a/Task/Bell-numbers/Kotlin/bell-numbers.kotlin b/Task/Bell-numbers/Kotlin/bell-numbers.kts similarity index 100% rename from Task/Bell-numbers/Kotlin/bell-numbers.kotlin rename to Task/Bell-numbers/Kotlin/bell-numbers.kts diff --git a/Task/Bell-numbers/Loglan82/bell-numbers.loglan82 b/Task/Bell-numbers/Loglan82/bell-numbers.loglan82 new file mode 100644 index 0000000000..141ec17f83 --- /dev/null +++ b/Task/Bell-numbers/Loglan82/bell-numbers.loglan82 @@ -0,0 +1,28 @@ +(* Bell numbers *) + +block +const + max_n = 13; +var + a: arrayof integer, + i, j, n: integer; +begin + array a dim (0 : max_n); + n := 0; + for i := 0 to max_n - 1 + do + a(i) := 0 + od; + a(0) := 1; + writeln("B(", n: 2, ") = ", a(0): 9); + while n < max_n + do + a(n) := a(0); + for j := n downto 1 + do + a(j - 1) := a(j - 1) + a(j) + od; + n := n + 1; + writeln("B(", n: 2, ") = ", a(0): 9); + od; +end; diff --git a/Task/Bell-numbers/Miranda/bell-numbers.miranda b/Task/Bell-numbers/Miranda/bell-numbers.miranda new file mode 100644 index 0000000000..67a573f599 --- /dev/null +++ b/Task/Bell-numbers/Miranda/bell-numbers.miranda @@ -0,0 +1,16 @@ +main :: [sys_message] +main = [Stdout "First 15 and 50th Bell numbers:\n", + Stdout (lay [(rjustify 2 (show i)) ++ ": " ++ show (bell_numbers ! i) + | i <- [1..15] ++ [50]]), + Stdout "\nFirst 10 rows of the Bell triangle:\n", + Stdout (lay [concat [rjustify 7 (show n) | n <- row] + | row <- take 10 bell_triangle]) + ] + + +bell_numbers :: [num] +bell_numbers = map last bell_triangle + +bell_triangle :: [[num]] +bell_triangle = iterate bell_step [1] + where bell_step row = scan (+) (last row) row diff --git a/Task/Bell-numbers/MoonRock/bell-numbers.moonrock b/Task/Bell-numbers/MoonRock/bell-numbers.moonrock new file mode 100644 index 0000000000..21caf0d119 --- /dev/null +++ b/Task/Bell-numbers/MoonRock/bell-numbers.moonrock @@ -0,0 +1,43 @@ +' Bell numbers + +BEGIN DEF +SUB PrintStr(S$, Width%) +%MaxN = 14 +DIM A&[%MaxN] + +BEGIN CODE +N% = 0 +FOR I% = 0 TO %MaxN -1 + A&[I%] = 0 +NEXT +A&[0] = 1 +PRINT "B(" +CALL PrintStr(STR(N%), 2) +PRINT ") = " +CALL PrintStr(STR(A&[0]), 9) +PRINT "\n" +WHILE N% < %MaxN + A&[N%] = A&[0] + J% = N% + WHILE J% >= 1 + JMin1% = J% - 1 + A&[JMin1%] = A&[JMin1%] + A&[J%] + J% = J% - 1 + WEND + N% = N% + 1 + PRINT "B(" + CALL PrintStr(STR(N%), 2) + PRINT ") = " + CALL PrintStr(STR(A&[0]), 9) + PRINT "\n" +WEND +END + +SUB PrintStr(S$, Width%) +IF LEN(S$) > Width% THEN + PRINT S$ +ELSE + S$ = SPACE(Width%) + S$ + PRINT RIGHT(S$, Width%) +ENDIF +END SUB diff --git a/Task/Bell-numbers/Oberon-07/bell-numbers.oberon b/Task/Bell-numbers/Oberon-07/bell-numbers.oberon new file mode 100644 index 0000000000..0d8ac34e3d --- /dev/null +++ b/Task/Bell-numbers/Oberon-07/bell-numbers.oberon @@ -0,0 +1,28 @@ +MODULE BellNumbers; + IMPORT Out; + + PROCEDURE showBellNumbers; + CONST maxBell = 15; + VAR a : ARRAY maxBell - 1 OF INTEGER; + i, n, j : INTEGER; + + PROCEDURE showOneBellNumber( n, bellNumber : INTEGER ); + BEGIN + Out.Int( n, 2 );Out.String( ": " );Out.Int( bellNumber, 0 );Out.Ln + END showOneBellNumber; + + BEGIN + FOR i := 1 TO LEN( a ) - 1 DO a[ i ] := 0 END; + a[ 0 ] := 1; + showOneBellNumber( 1, a[ 0 ] ); + FOR n := 0 TO maxBell - 2 DO + (* replace a with the next line of the triangle *) + a[ n ] := a[ 0 ]; + FOR j := n TO 1 BY -1 DO INC( a[ j - 1 ], a[ j ] ) END; + showOneBellNumber( n + 2, a[ 0 ] ) + END + END showBellNumbers; + +BEGIN + showBellNumbers +END BellNumbers. diff --git a/Task/Bell-numbers/PARI-GP/bell-numbers.parigp b/Task/Bell-numbers/PARI-GP/bell-numbers.parigp new file mode 100644 index 0000000000..f62bf25259 --- /dev/null +++ b/Task/Bell-numbers/PARI-GP/bell-numbers.parigp @@ -0,0 +1,4 @@ +genit(maxx=50)={bell=List(); +for(n=0,maxx,q=sum(k=0,n,stirling(n,k,2)); +listput(bell,q));bell} +END diff --git a/Task/Bell-numbers/PHP/bell-numbers.php b/Task/Bell-numbers/PHP/bell-numbers.php new file mode 100644 index 0000000000..ead13effb8 --- /dev/null +++ b/Task/Bell-numbers/PHP/bell-numbers.php @@ -0,0 +1,17 @@ += 1; $j--) + $a[$j - 1] += $a[$j]; + $n++; + echo 'B('.str_pad($n, 2, " ", STR_PAD_LEFT).') = '. + str_pad($a[0], 9, " ", STR_PAD_LEFT).PHP_EOL; +} +?> diff --git a/Task/Bell-numbers/PL-I/bell-numbers.pli b/Task/Bell-numbers/PL-I/bell-numbers.pli new file mode 100644 index 0000000000..f9386c59bf --- /dev/null +++ b/Task/Bell-numbers/PL-I/bell-numbers.pli @@ -0,0 +1,25 @@ +/* Bell numbers */ + +Bell_nums: + procedure options(main); + %replace nmax by 9; + declare + a(0 : nmax) fixed binary(15), + (i, j, n) fixed binary(15); + n = 0; + do i = 0 to nmax - 1; + a(i) = 0; + end; + a(0) = 1; + put list('B('); + put edit(n, ') = ', a(0))(f(2), a, f(9)); + do while (n < nmax); + a(n) = a(0); + do j = n to 1 by -1; + a(j - 1) = a(j - 1) + a(j); + end; + n = n + 1; + put skip list('B('); + put edit(n, ') = ', a(0))(f(2), a, f(9)); + end; +end Bell_nums; diff --git a/Task/Bell-numbers/Pascal-P/bell-numbers.pas b/Task/Bell-numbers/Pascal-P/bell-numbers.pas new file mode 100644 index 0000000000..4cfaf86cfc --- /dev/null +++ b/Task/Bell-numbers/Pascal-P/bell-numbers.pas @@ -0,0 +1,20 @@ +program bellnums(output); + (* Bell numbers *) +const + maxn = 14; (* with 32-bit integer *) +var + a: array[0..maxn - 1] of integer; + i, j, n: integer; +begin + n := 0; + for i := 0 to maxn - 1 do a[i] := 0; + a[0] := 1; + writeln('B(', n: 2, ') = ', a[0]: 9); + while n < maxn do + begin + a[n] := a[0]; + for j := n downto 1 do a[j - 1] := a[j - 1] + a[j]; + n := n + 1; + writeln('B(', n: 2, ') = ', a[0]: 9); + end; +end. diff --git a/Task/Bell-numbers/Pluto/bell-numbers.pluto b/Task/Bell-numbers/Pluto/bell-numbers.pluto new file mode 100644 index 0000000000..5cabc1baca --- /dev/null +++ b/Task/Bell-numbers/Pluto/bell-numbers.pluto @@ -0,0 +1,32 @@ +local bigint = require "bigint" +local fmt = require "fmt" + +local function bell_triangle(n) + local zero = bigint.new(0) + local tri = {} + for i = 1, n do + tri[i] = {} + for j = 1, i - 1 do tri[i][j] = zero end + end + tri[2][1] = bigint.new(1) + for i = 3, n do + tri[i][1] = tri[i - 1][i - 2] + for j = 2, i - 1 do + tri[i][j] = tri[i][j - 1] + tri[i - 1][j - 1] + end + end + return tri +end + +local bt = bell_triangle(51) +print("First fifteen and fiftieth Bell numbers:") +for i = 2, 16 do + local s = bt[i][1]:tostring() + fmt.print("%2d: %s", i - 1, fmt.int(s)) +end +local s50 = bt[51][1]:tostring() +fmt.print("%2d: %s", 50, fmt.int(s50)) +print("\nThe first ten rows of Bell's triangle:") +for i = 2, 11 do + fmt.tprint("%7s", bt[i]:map(|j| -> fmt.int(j:tostring())), #bt[i]) +end diff --git a/Task/Bell-numbers/PowerShell/bell-numbers.ps1 b/Task/Bell-numbers/PowerShell/bell-numbers.ps1 new file mode 100644 index 0000000000..2a173ea9e9 --- /dev/null +++ b/Task/Bell-numbers/PowerShell/bell-numbers.ps1 @@ -0,0 +1,19 @@ +# Bell numbers +[uint32]$script:MaxN = 14 +$a = [uint32[]]::new($script:MaxN) +foreach ($i in 0..($script:MaxN - 1)) { + $a[$i] = 0 +} +[uint32]$n = 0 +$a[0] = 1 +[string]$row = "B({0, 2}) = {1,9}" -f $n, $a[0] +Write-Output $row +while ($n -lt $script:MaxN) { + $a[$n] = $a[0] + foreach ($j in $n..1) { + $a[$j - 1] += $a[$j] + } + $n++ + [string]$row = "B({0, 2}) = {1,9}" -f $n, $a[0] + Write-Output $row +} diff --git a/Task/Bell-numbers/Refal/bell-numbers.refal b/Task/Bell-numbers/Refal/bell-numbers.refal new file mode 100644 index 0000000000..f65c59ce11 --- /dev/null +++ b/Task/Bell-numbers/Refal/bell-numbers.refal @@ -0,0 +1,41 @@ +$ENTRY Go { + , : e.Bell (e.B50) + , : (e.F15) e.Rest + = + + >; +} + +Show { + (e.X) = >; +}; + +BellNumbers { + s.N, : e.Rows = ; +}; + +BellTriangle { + s.N = ((1))>; + 0 e.T = e.T; + s.N e.Rs (e.R) = e.Rs (e.R) ()>; +}; + +BellStep { + e.Row, e.Row: e.X (e.Last) = ; +}; + +Rsum { + (Acc e.Acc) = ; + (Acc e.Acc) (e.N) e.Ns, : e.N2 = + (e.N2) ; + e.Ns = ; +}; + +Each { + (e.F) = ; + (e.F) (e.X) e.Xs = () ; +}; + +Head { + t.X e.Y = t.X; +}; diff --git a/Task/Bell-numbers/Rust/bell-numbers.rust b/Task/Bell-numbers/Rust/bell-numbers.rs similarity index 100% rename from Task/Bell-numbers/Rust/bell-numbers.rust rename to Task/Bell-numbers/Rust/bell-numbers.rs diff --git a/Task/Bell-numbers/SETL/bell-numbers.setl b/Task/Bell-numbers/SETL/bell-numbers.setl new file mode 100644 index 0000000000..83c7ca45d4 --- /dev/null +++ b/Task/Bell-numbers/SETL/bell-numbers.setl @@ -0,0 +1,31 @@ +program bell_numbers; + print("First 15 and 50th Bell numbers:"); + b := bell_nums(50); + loop for i in [1..15] with 50 do + print(lpad(str i, 2) + ": " + str b(i)); + end loop; + + print; + print("First 10 rows of the Bell triangle:"); + loop for row in bell_triangle(10) do + print(+/[lpad(str n, 7) : n in row]); + end loop; + + proc bell_nums(n); + tri := bell_triangle(n); + return [row(#row) : row in tri]; + end proc; + + proc bell_triangle(rows); + tri := [[1]]; + loop for i in [2..rows] do + row := tri(#tri); + nextrow := [row(#row)]; + loop for n in row do + nextrow with:= nextrow(#nextrow) + n; + end loop; + tri with:= nextrow; + end loop; + return tri; + end proc; +end program; diff --git a/Task/Bell-numbers/Scheme/bell-numbers.ss b/Task/Bell-numbers/Scheme/bell-numbers.scm similarity index 100% rename from Task/Bell-numbers/Scheme/bell-numbers.ss rename to Task/Bell-numbers/Scheme/bell-numbers.scm diff --git a/Task/Bell-numbers/Uiua/bell-numbers.uiua b/Task/Bell-numbers/Uiua/bell-numbers.uiua new file mode 100644 index 0000000000..c6d1180ce3 --- /dev/null +++ b/Task/Bell-numbers/Uiua/bell-numbers.uiua @@ -0,0 +1,12 @@ +# Generate Bell numbers. + +# Use Marcos' BigInt library. +~ "git: https://github.com/Marcos-cat/uiua-bigint" ~ Add New Str + +# Generate next row of the Bell triangle. +# Supply simple `+` for ints, or `⍜∩°□Add` for BigInts. +Next! ← ⊙◌⍢(⊂⊙^0⊓⟜⊣°⊂|>0⋅⧻)⊸[⊣] + +&p⍥⊃Next!+⊢15 [1] # First fifteen. +&pStr°□⊢⍥Next!⍜∩°□Add49[1] # Fiftieth. +≡&p⍥⊃Next!+□10 [1] # First ten lines of triangle. diff --git a/Task/Bell-numbers/VBA/bell-numbers.vba b/Task/Bell-numbers/VBA/bell-numbers.vba new file mode 100644 index 0000000000..35b134c90f --- /dev/null +++ b/Task/Bell-numbers/VBA/bell-numbers.vba @@ -0,0 +1,32 @@ +' Bell numbers + +Const MaxN As Integer = 14 + +Sub BellNumsMain() + Dim A(MaxN - 1) As Long + Dim N, J As Integer + For I = 0 To MaxN - 1 + A(I) = 0 + Next I + N = 0 + A(0) = 1 + Debug.Print "B(" & FormatLong(N, 2) & ") = " & FormatLong(A(0), 9) + Do While N < MaxN + A(N) = A(0) + For J = N To 1 Step -1 + A(J - 1) = A(J - 1) + A(J) + Next J + N = N + 1 + Debug.Print "B(" & FormatLong(N, 2) & ") = " & FormatLong(A(0), 9) + Loop +End Sub + +Function FormatLong(ByVal Num As Long, L As Integer) As String + Dim S As String + S = Trim(Str(Num)) + If Len(S) > L Then + FormatLong = String(L, "#") + Else + FormatLong = Right(String(L, " ") & S, L) + End If +End Function diff --git a/Task/Bell-numbers/Wren/bell-numbers.wren b/Task/Bell-numbers/Wren/bell-numbers.wren index 5aa1fe18e1..a6064c4f83 100644 --- a/Task/Bell-numbers/Wren/bell-numbers.wren +++ b/Task/Bell-numbers/Wren/bell-numbers.wren @@ -1,5 +1,5 @@ -import "/big" for BigInt -import "/fmt" for Fmt +import "./big" for BigInt +import "./fmt" for Fmt var bellTriangle = Fn.new { |n| var tri = List.filled(n, null) diff --git a/Task/Benfords-law/ABC/benfords-law.abc b/Task/Benfords-law/ABC/benfords-law.abc new file mode 100644 index 0000000000..7d3f54fa55 --- /dev/null +++ b/Task/Benfords-law/ABC/benfords-law.abc @@ -0,0 +1,25 @@ +HOW TO RETURN fibonacci.numbers n: + PUT 1, 1 IN a, b + PUT {} IN fibo + FOR i IN {1..n}: + INSERT a IN fibo + PUT b, a+b IN a, b + RETURN fibo + +HOW TO RETURN digit.distribution nums: + PUT {} IN digits + FOR i IN {1..9}: PUT i IN digits["`i`"] + PUT {} IN dist + FOR i IN {1..9}: PUT 0 IN dist[i] + FOR n IN nums: + PUT digits["`n`"|1] IN digit + PUT dist[digit] + 1 IN dist[digit] + FOR i IN {1..9}: + PUT dist[i] / #nums IN dist[i] + RETURN dist + +PUT digit.distribution fibonacci.numbers 1000 IN observations + +WRITE "Digit"<<6, "Expected">>10, "Observed">>10/ +FOR d IN {1..9}: + WRITE d<<6, ((10 log (1 + 1/d))>>10)|10, observations[d]>>10/ diff --git a/Task/Benfords-law/APL/benfords-law.apl b/Task/Benfords-law/APL/benfords-law.apl new file mode 100644 index 0000000000..7dc69444dd --- /dev/null +++ b/Task/Benfords-law/APL/benfords-law.apl @@ -0,0 +1,10 @@ +task←{ + benf ← ≢÷⍨(⍳9)(+/∘.=)(⍎⊃∘⍕)¨ + + fibs ← (⊢,(+/¯2↑⊢))⍣998⊢1 1 + + exp ← 10⍟1+÷⍳9 + obs ← benf fibs + + ⎕←'Expected Actual'⍪5⍕exp,[1.5]obs +} diff --git a/Task/Benfords-law/Ada/benfords-law-1.ada b/Task/Benfords-law/Ada/benfords-law-1.adb similarity index 100% rename from Task/Benfords-law/Ada/benfords-law-1.ada rename to Task/Benfords-law/Ada/benfords-law-1.adb diff --git a/Task/Benfords-law/Ada/benfords-law-2.ada b/Task/Benfords-law/Ada/benfords-law-2.adb similarity index 100% rename from Task/Benfords-law/Ada/benfords-law-2.ada rename to Task/Benfords-law/Ada/benfords-law-2.adb diff --git a/Task/Benfords-law/BASIC256/benfords-law.basic b/Task/Benfords-law/BASIC256/benfords-law.basic new file mode 100644 index 0000000000..406fdc921b --- /dev/null +++ b/Task/Benfords-law/BASIC256/benfords-law.basic @@ -0,0 +1,34 @@ +n = 1000 +dim actual(n) fill 0 + +for nr = 1 to n + num$ = string(fibonacci(nr)) + j = int(left(num$,1)) + actual[j] += 1 +next + +print "First 1000 Fibonacci numbers" +print "Digit ", "Actual freq ", "Expected freq" +for i = 1 to 9 + freq = frequency(i)*100 + print " "; ljust(i,4), rjust(actual[i]/10,5), rjust(freq,5) +next +end + +function frequency(n) + return (log10(n+1) - log10(n)) +end function + +function fibonacci(f) + f = int(f) + a = 0 : b = 1 : c = 0 : n = 0 + + while n < f + a = b + b = c + c = a + b + n += 1 + end while + + return c +end function diff --git a/Task/Benfords-law/Chipmunk-Basic/benfords-law.basic b/Task/Benfords-law/Chipmunk-Basic/benfords-law.basic new file mode 100644 index 0000000000..33868aa943 --- /dev/null +++ b/Task/Benfords-law/Chipmunk-Basic/benfords-law.basic @@ -0,0 +1,38 @@ +100 cls +110 n = 1000 +120 dim actual(n) +130 for nr = 1 to n +140 num$ = str$(fibonacci(nr)) +150 j = val(left$(num$,1)) +160 actual(j) = actual(j)+1 +170 next +180 print "First 1000 Fibonacci numbers" +190 print "Digit Actual freq Expected freq" +200 for i = 1 to 9 +210 freq = frequency(i)*100 +220 print format$(i,"###"); +230 print using " ##.###";actual(i)/10; +240 print using " ##.###";freq +250 next +260 end +270 sub frequency(n) +280 frequency = (log10(n+1)-log10(n)) +290 end sub +300 sub log10(n) +310 log10 = log(n)/log(10) +320 end sub +330 sub fibonacci(n) +335 rem https://rosettacode.org/wiki/Fibonacci_sequence#Chipmunk_Basic +340 n1 = 0 +350 n2 = 1 +360 for k = 1 to abs(n) +370 sum = n1+n2 +380 n1 = n2 +390 n2 = sum +400 next k +410 if n < 0 then +420 fibonacci = n1*((-1)^((-n)+1)) +430 else +440 fibonacci = n1 +450 endif +460 end sub diff --git a/Task/Benfords-law/Crystal/benfords-law.crystal b/Task/Benfords-law/Crystal/benfords-law.cr similarity index 100% rename from Task/Benfords-law/Crystal/benfords-law.crystal rename to Task/Benfords-law/Crystal/benfords-law.cr diff --git a/Task/Benfords-law/Dart/benfords-law.dart b/Task/Benfords-law/Dart/benfords-law.dart new file mode 100644 index 0000000000..4182f28c03 --- /dev/null +++ b/Task/Benfords-law/Dart/benfords-law.dart @@ -0,0 +1,35 @@ +import 'dart:math'; + +digits(n) sync* { + double a = 0, b = 1; + for (var i = 0; i < n; i++) { + yield b.toString().codeUnitAt(0) - 48; + (a, b) = (b, a + b); + } +} + +lineout(s1, s2, s3) { + print( + s1.toString().padLeft(8) + + s2.toString().padLeft(12) + + s3.toString().padLeft(12), + ); +} + +main() { + var tally = List.filled(9, 0); + for (var d in digits(1000)) { + tally[d - 1] += 1; + } + + lineout("Digit", "Expected", "Actual"); + print("-" * 40); + + for (var d = 1; d < 10; d += 1) { + lineout( + d, + (log(1 + 1 / d) * log10e).toStringAsFixed(4), + (tally[d - 1] / 1000).toStringAsFixed(3), + ); + } +} diff --git a/Task/Benfords-law/DuckDB/benfords-law.duckdb b/Task/Benfords-law/DuckDB/benfords-law.duckdb new file mode 100644 index 0000000000..ec7d41aaa2 --- /dev/null +++ b/Task/Benfords-law/DuckDB/benfords-law.duckdb @@ -0,0 +1,22 @@ +with recursive fib (n1, n2) as ( + select + 1::double, 1::double + union all + select n2, n1+n2 + from fib + ), +lastdigits as ( + select format('{}', n1)[1]::int as digit + from fib + limit 1000 -- N.B. + ), +counts as ( + select digit, count() as actual + from lastdigits group by digit + ), +total as ( + select count() as total from lastdigits + ) +select digit, actual, (total * log(10, 1 + (1 / digit))) as expected + from counts, total + order by digit; diff --git a/Task/Benfords-law/EasyLang/benfords-law.easy b/Task/Benfords-law/EasyLang/benfords-law.easy new file mode 100644 index 0000000000..7f84888fa7 --- /dev/null +++ b/Task/Benfords-law/EasyLang/benfords-law.easy @@ -0,0 +1,49 @@ +func$ add a$ b$ . + if len a$ < len b$ : swap a$ b$ + for i to len a$ + a = number substr a$ i 1 + b = 0 + if i <= len b$ : b = number substr b$ i 1 + r = a + b + c + c = r div 10 + r$ &= r mod 10 + . + if c > 0 : r$ &= c + return r$ +. +len fibdist[] 9 +proc mkfibdist . + # generate 1000 fibonacci numbers as + # (reversed) strings, because 53 bit + # integers are too small + # + n = 1000 + prev$ = 0 + val$ = 1 + fibdist[1] = 1 + for i = 2 to n + h$ = add prev$ val$ + prev$ = val$ + val$ = h$ + ind = number substr val$ len val$ 1 + fibdist[ind] += 1 + . + for i to len fibdist[] + fibdist[i] = fibdist[i] / n + . +. +mkfibdist +# +len benfdist[] 9 +proc mkbenfdist . + for i to 9 + benfdist[i] = log (1 + 1 / i) 10 + . +. +mkbenfdist +# +numfmt 0 3 +print "Actual Expected" +for i to 9 + print fibdist[i] & " " & benfdist[i] +. diff --git a/Task/Benfords-law/Elixir/benfords-law.elixir b/Task/Benfords-law/Elixir/benfords-law.ex similarity index 100% rename from Task/Benfords-law/Elixir/benfords-law.elixir rename to Task/Benfords-law/Elixir/benfords-law.ex diff --git a/Task/Benfords-law/Fortran/benfords-law-3.f b/Task/Benfords-law/Fortran/benfords-law-3.f new file mode 100644 index 0000000000..5c2ca6d8b6 --- /dev/null +++ b/Task/Benfords-law/Fortran/benfords-law-3.f @@ -0,0 +1,33 @@ + PROGRAM benford + INTEGER counts(9) + + expected(d) = log10(1.0 + 1.0/d) + + CALL tally(counts) + + PRINT 100, 'Digit', 'Actual', 'Expected' + DO 10, i = 1, 9 +10 PRINT 101, i, counts(i)/1E3, expected(real(i)) + +100 FORMAT (A6, 1X, A9, 1X, A9) +101 FORMAT (I4, 3X, F9.3, 1X, F9.4) + END PROGRAM + + + SUBROUTINE tally(counts) + INTEGER counts(9) + CHARACTER*20 str + DOUBLE PRECISION a, b, c + INTEGER d + + counts = [(0, i = 1, 9)] + a = 0 + b = 1 + DO 10, i = 1, 1000 + WRITE (str, '(E12.6)') b + d = ichar(str(3:3)) - ichar('0') + counts(d) = counts(d) + 1 + c = a + b + a = b +10 b = c + END SUBROUTINE diff --git a/Task/Benfords-law/FutureBasic/benfords-law.basic b/Task/Benfords-law/FutureBasic/benfords-law.basic new file mode 100644 index 0000000000..b9230ff827 --- /dev/null +++ b/Task/Benfords-law/FutureBasic/benfords-law.basic @@ -0,0 +1,64 @@ +Short t, i, j, k, m +Double a(9), z +Double phi, psi +CFStringRef s + +print @"Benford:" +for i = 1 to 9 + a(i) = log10( 1 + 1 / i ) + print fn StringWithFormat( @"%.3f ", a(i) ), +next + + +// Fibonacci according to DeMoivre and Binet +for t = 1 to 9 : a(t) = 0 : next // Clean array +phi = ( 1 + sqr(5) ) / 2 +psi = ( 1 - sqr(5) ) / 2 +for i = 1 to 1000 + z = ( phi^i - psi^i ) / sqr( 5 ) + s = fn StringWithFormat( @"%e", z) // Get first digit + t = fn StringIntegerValue( left( s, 1 ) ) + a(t) = a(t) + 1 +next +print @"\n\nFibonacci:" +for i = 1 to 9 + print fn StringWithFormat( @"%.3f ", a(i) / 1000 ), +next + + +// Multiplication tables +for t = 1 to 9 : a(t) = 0 : next // Clean array +for i = 1 to 10 + for j = 1 to 10 + for k = 1 to 10 + for m = 1 to 10 + z = i * j * k * m + s = fn StringWithFormat( @"%e", z ) + t = fn StringIntegerValue( left( s, 1 ) ) + a(t) = a(t) + 1 + next + next + next +next +print @"\n\nMultiplication:" +for i = 1 to 9 + print fn StringWithFormat( @"%.3f ", a(i) / 1e4 ), +next + + +// Factorials according to DeMoivre and Stirling +for t = 1 to 9 : a(t) = 0 : next // Clean array +for i = 10 to 110 + z = sqr(2 * pi * i ) * (i / exp(1) )^i + s = fn StringWithFormat( @"%e", z ) + t = fn StringIntegerValue( left( s, 1 ) ) + a(t) = a(t) + 1 +next +print @"\n\nFactorials:" +for i = 1 to 9 + print fn StringWithFormat( @"%.2f ", a(i) / 100 ), +next + + +handleevents +} diff --git a/Task/Benfords-law/Julia/benfords-law.jl b/Task/Benfords-law/Julia/benfords-law.jl new file mode 100644 index 0000000000..21483c4a19 --- /dev/null +++ b/Task/Benfords-law/Julia/benfords-law.jl @@ -0,0 +1,30 @@ +# Benford's Law +P(d) = log10(1+1/d) + +function benford(numbers) + firstdigit(n) = last(digits(n)) + counts = zeros(9) + foreach(n -> counts[firstdigit(n)] += 1, numbers) + counts ./ sum(counts) +end + +struct Fibonacci end +Base.iterate(::Fibonacci, (a, b) = big.((0, 1))) = b, (b, a + b) + +sample = Iterators.take(Fibonacci(), 1000) + +observed = benford(sample) .* 100 +expected = P.(1:9) .* 100 + +table = Real[1:9 observed expected] + +using Plots +plot([observed expected]; title = "Benford's Law", + seriestype = [:bar :line], linewidth = [0 5], + xticks = 1:9, xlabel = "first digit", ylabel = "frequency %", + label = ["1000 Fibonacci numbers" "P(d)=log10(1+1/d)"]) + +using Printf +println("Benford's Law\nFrequency of first digit\nin 1000 Fibonacci numbers") +println("digit observed expected") +foreach(i -> @printf("%3d%9.2f%%%9.2f%%\n", table[i,:]...), 1:9) diff --git a/Task/Benfords-law/Julia/benfords-law.julia b/Task/Benfords-law/Julia/benfords-law.julia deleted file mode 100644 index 096f17b0d7..0000000000 --- a/Task/Benfords-law/Julia/benfords-law.julia +++ /dev/null @@ -1,30 +0,0 @@ -# Benford's Law -P(d) = log10(1+1/d) - -function benford(numbers) - firstdigit(n) = parse(Int, first(string(n))) - counts = zeros(9) - foreach(n -> counts[firstdigit(n)] += 1, numbers) - counts ./ sum(counts) -end - -struct Fibonacci end -Base.iterate(::Fibonacci, (a, b) = big.((0, 1))) = b, (b, a + b) - -sample = Iterators.take(Fibonacci(), 1000) - -observed = benford(sample) .* 100 -expected = P.(1:9) .* 100 - -table = Real[1:9 observed expected] - -using Plots -plot([observed expected]; title = "Benford's Law", - seriestype = [:bar :line], linewidth = [0 5], - xticks = 1:9, xlabel = "first digit", ylabel = "frequency %", - label = ["1000 Fibonacci numbers" "P(d)=log10(1+1/d)"]) - -using Printf -println("Benford's Law\nFrequency of first digit\nin 1000 Fibonacci numbers") -println("digit observed expected") -foreach(i -> @printf("%3d%9.2f%%%9.2f%%\n", table[i,:]...), 1:9) diff --git a/Task/Benfords-law/K/benfords-law.k b/Task/Benfords-law/K/benfords-law.k new file mode 100644 index 0000000000..5418b93641 --- /dev/null +++ b/Task/Benfords-law/K/benfords-law.k @@ -0,0 +1,7 @@ +law: {(`ln 1 + 1%x) % `ln 10} +tally: #' = {*$x}' +\[1000; 0.0; 1.0] + +`0: (8$"digit"), (12$"Expected"), "Actual" + +row: {`0: (-3$$x), (-13$7#$law x), -10$"0.", $tally[*$x]} +nop: 9 {row x; x + 1}/ 1 diff --git a/Task/Benfords-law/Kotlin/benfords-law.kotlin b/Task/Benfords-law/Kotlin/benfords-law.kts similarity index 100% rename from Task/Benfords-law/Kotlin/benfords-law.kotlin rename to Task/Benfords-law/Kotlin/benfords-law.kts diff --git a/Task/Benfords-law/MATLAB/benfords-law.m b/Task/Benfords-law/MATLAB/benfords-law.m new file mode 100644 index 0000000000..290a42ccc1 --- /dev/null +++ b/Task/Benfords-law/MATLAB/benfords-law.m @@ -0,0 +1,57 @@ +benfords_law(); + +function benfords_law + % Benford's Law + P = @(d) log10(1 + 1./d); + + % Benford function + function counts = benford(numbers) + firstdigit = @(n) floor(mod(n / 10^floor(log10(n)), 10)); + counts = zeros(1, 9); + for i = 1:length(numbers) + digit = firstdigit(numbers(i)); + if digit ~= 0 + counts(digit) = counts(digit) + 1; + end + end + counts = counts ./ sum(counts); + end + + % Generate Fibonacci numbers + function fibNums = fibonacci(n) + fibNums = zeros(1, n); + a = 0; + b = 1; + for i = 1:n + c = b; + b = a + b; + a = c; + fibNums(i) = b; + end + end + + % Sample + sample = fibonacci(1000); + + % Observed and expected frequencies + observed = benford(sample) * 100; + expected = arrayfun(P, 1:9) * 100; + + % Table + mytable = [1:9; observed; expected]'; + + % Plotting + bar(1:9, observed); + hold on; + plot(1:9, expected, 'LineWidth', 2); + hold off; + title("Benford's Law"); + xlabel("First Digit"); + ylabel("Frequency %"); + legend("1000 Fibonacci Numbers", "P(d) = log10(1 + 1/d)"); + xticks(1:9); + + % Displaying the results + fprintf("Benford's Law\nFrequency of first digit\nin 1000 Fibonacci numbers\n"); + disp(table(mytable(:,1),mytable(:,2),mytable(:,3),'VariableNames',{'digit', 'observed(%)', 'expected(%)'})) +end diff --git a/Task/Benfords-law/OCaml/benfords-law.ocaml b/Task/Benfords-law/OCaml/benfords-law.ml similarity index 100% rename from Task/Benfords-law/OCaml/benfords-law.ocaml rename to Task/Benfords-law/OCaml/benfords-law.ml diff --git a/Task/Benfords-law/Pluto/benfords-law.pluto b/Task/Benfords-law/Pluto/benfords-law.pluto new file mode 100644 index 0000000000..b5354c40ab --- /dev/null +++ b/Task/Benfords-law/Pluto/benfords-law.pluto @@ -0,0 +1,30 @@ +local bigint = require "pluto:bigint" +local fmt = require "fmt" +require "table2" + +local function fib1000() + local a = bigint.new(0) + local b = bigint.new(1) + local r = table.create(1000) + for i = 1, 1000 do + r[i] = b + a, b = b, b + a + end + return r +end + +local function show(c, title) + local f = table.rep(9, 0) + for c as v do + local t = v:tostring():byte() - 48 + f[t] += 1 + end + print(title) + print("Digit Observed Predicted") + for i = 1, #f do + local t = math.log(1 / i + 1, 10) + fmt.print(" %d %8.3f %8.3f", i, f[i] / #c, t) + end +end + +show(fib1000(), "First 1000 Fibonacci numbers:") diff --git a/Task/Benfords-law/PowerShell/benfords-law.psh b/Task/Benfords-law/PowerShell/benfords-law.ps1 similarity index 100% rename from Task/Benfords-law/PowerShell/benfords-law.psh rename to Task/Benfords-law/PowerShell/benfords-law.ps1 diff --git a/Task/Benfords-law/Quackery/benfords-law.quackery b/Task/Benfords-law/Quackery/benfords-law.quackery new file mode 100644 index 0000000000..c18ea50a99 --- /dev/null +++ b/Task/Benfords-law/Quackery/benfords-law.quackery @@ -0,0 +1,36 @@ + [ $ "bigrat.qky" loadfile ] now! + + [ ' [ 1 1 ] + swap 2 - times + [ dup -1 peek + over -2 peek + + join ] ] is fibonacci ( n --> [ ) + + [ 0 swap witheach + ] is sum ( [ --> n ) + + [ [ 10 /mod over while + drop again ] nip ] is msd ( n --> n ) + + [ 2dup peek 1+ unrot poke ] is tallydigit ( [ n --> [ ) + + [ 0 10 of swap + witheach + [ msd tallydigit ] ] is msdcount ( [ --> [ ) + + [ [ table + $ "0.30103" $ "0.17609" + $ "0.12494" $ "0.09691" + $ "0.07918" $ "0.06695" + $ "0.05799" $ "0.05115" + $ "0.04576" ] do echo$ ] is expected ( --> ) + + say "n expected counted" cr + 1000 fibonacci msdcount + behead drop + dup sum swap + witheach + [ i^ 1+ echo sp sp + i^ expected sp sp + over reduce + 5 point$ echo$ cr ] + drop diff --git a/Task/Benfords-law/Rust/benfords-law.rust b/Task/Benfords-law/Rust/benfords-law.rs similarity index 100% rename from Task/Benfords-law/Rust/benfords-law.rust rename to Task/Benfords-law/Rust/benfords-law.rs diff --git a/Task/Benfords-law/SETL/benfords-law.setl b/Task/Benfords-law/SETL/benfords-law.setl new file mode 100644 index 0000000000..ec6e559aa5 --- /dev/null +++ b/Task/Benfords-law/SETL/benfords-law.setl @@ -0,0 +1,31 @@ +program benfords_law; + fibos := fibo_list(1000); + + expected := [log(1 + 1/d)/log 10 : d in [1..9]]; + actual := benford(fibos); + + print('d Expected Actual'); + loop for d in [1..9] do + print(d, ' ', fixed(expected(d), 7, 5), ' ', fixed(actual(d), 7, 5)); + end loop; + + proc benford(list); + dist := []; + loop for n in list do + dist(val(str n)(1)) +:= 1; + end loop; + return [d / #list : d in dist]; + end proc; + + proc fibo_list(n); + a := 1; + b := 1; + fibs := []; + loop while n>0 do + fibs with:= a; + [a, b] := [b, a+b]; + n -:= 1; + end loop; + return fibs; + end proc; +end program; diff --git a/Task/Benfords-law/Scheme/benfords-law.ss b/Task/Benfords-law/Scheme/benfords-law.scm similarity index 100% rename from Task/Benfords-law/Scheme/benfords-law.ss rename to Task/Benfords-law/Scheme/benfords-law.scm diff --git a/Task/Benfords-law/Sidef/benfords-law.sidef b/Task/Benfords-law/Sidef/benfords-law.sidef index ac2689ebf6..f61086623c 100644 --- a/Task/Benfords-law/Sidef/benfords-law.sidef +++ b/Task/Benfords-law/Sidef/benfords-law.sidef @@ -1,14 +1,15 @@ var (actuals, expected) = ([], []) -var fibonacci = 1000.of {|i| fib(i).digit(0) } +var fibonacci = 1000.of {|i| fib(i).digit(-1) } -for i (1..9) { +for i in (1..9) { var num = fibonacci.count_by {|j| j == i } actuals.append(num / 1000) expected.append(1 + (1/i) -> log10) } "%17s%17s\n".printf("Observed","Expected") -for i (1..9) { + +for i in (1..9) { "%d : %11s %%%15s %%\n".printf( i, "%.2f".sprintf(100 * actuals[i - 1]), "%.2f".sprintf(100 * expected[i - 1]), diff --git a/Task/Benfords-law/True-BASIC/benfords-law.basic b/Task/Benfords-law/True-BASIC/benfords-law.basic new file mode 100644 index 0000000000..d6b6666e65 --- /dev/null +++ b/Task/Benfords-law/True-BASIC/benfords-law.basic @@ -0,0 +1,38 @@ +FUNCTION log10(n) + LET log10 = LOG(n)/LOG(10) +END FUNCTION + +FUNCTION frequency(n) + LET frequency = (log10(n+1)-log10(n)) +END FUNCTION + +FUNCTION fibonacci(n) + !https://rosettacode.org/wiki/Fibonacci_sequence#True_BASIC + LET n1 = 0 + LET n2 = 1 + FOR k = 1 TO ABS(n) + LET sum = n1+n2 + LET n1 = n2 + LET n2 = sum + NEXT k + IF n < 0 THEN LET fibonacci = n1*((-1)^((-n)+1)) ELSE LET fibonacci = n1 +END FUNCTION + +CLEAR +LET n = 1000 +DIM actual(0) +MAT REDIM actual(n) +FOR nr = 1 TO n + LET num$ = STR$(fibonacci(nr)) + LET j = VAL((num$)[1:1]) + LET actual(j) = actual(j)+1 +NEXT nr +PRINT "First 1000 Fibonacci numbers" +PRINT "Digit Actual freq Expected freq" +FOR i = 1 TO 9 + LET freq = frequency(i)*100 + PRINT USING "###": i; + PRINT USING " ##.###": actual(i)/10; + PRINT USING " ##.###": freq +NEXT i +END diff --git a/Task/Benfords-law/Uiua/benfords-law.uiua b/Task/Benfords-law/Uiua/benfords-law.uiua new file mode 100644 index 0000000000..343c2304a9 --- /dev/null +++ b/Task/Benfords-law/Uiua/benfords-law.uiua @@ -0,0 +1,4 @@ +F ← |1 memo(⨬(+∩F-1.-1|⋅1)<2.) +Lim ← 1000 +&p$"Expected: _"⁅×Limₙ10+1÷:1↘1⇡10 +&p$"Got: _"⊕⧻⊛.≡(⊢°⋕F)⇡Lim diff --git a/Task/Benfords-law/Wren/benfords-law.wren b/Task/Benfords-law/Wren/benfords-law.wren index c326af0c61..b528b4a306 100644 --- a/Task/Benfords-law/Wren/benfords-law.wren +++ b/Task/Benfords-law/Wren/benfords-law.wren @@ -1,4 +1,4 @@ -import "/fmt" for Fmt +import "./fmt" for Fmt var fib1000 = Fn.new { var a = 0 diff --git a/Task/Benfords-law/Yabasic/benfords-law.basic b/Task/Benfords-law/Yabasic/benfords-law.basic new file mode 100644 index 0000000000..edd3a6bdfd --- /dev/null +++ b/Task/Benfords-law/Yabasic/benfords-law.basic @@ -0,0 +1,41 @@ +n = 1000 +dim actual(n) + +for nr = 1 to n + num$ = str$(fibonacci(nr)) + j = val(left$(num$,1)) + actual(j) = actual(j) + 1 +next + +print "First 1000 Fibonacci numbers" +print "Digit ", "Actual freq ", "Expected freq" +for i = 1 to 9 + freq = frequency(i)*100 + print i using("###"), " ", (actual(i)/10) using("##.###"), " ", freq using("##.###") +next +end + +sub frequency(n) + return (log10(n+1) - log10(n)) +end sub + +sub log10(n) + return log(n) / log(10) +end sub + +sub fibonacci(n) + local n1, n2, k, sum + + n1 = 0 + n2 = 1 + for k = 1 to abs(n) + sum = n1 + n2 + n1 = n2 + n2 = sum + next k + if n < 0 then + return n1 * ((-1) ^ ((-n) + 1)) + else + return n1 + end if +end sub diff --git a/Task/Bernoulli-numbers/ALGOL-68/bernoulli-numbers.alg b/Task/Bernoulli-numbers/ALGOL-68/bernoulli-numbers.alg index 915f596b5e..3f48297679 100644 --- a/Task/Bernoulli-numbers/ALGOL-68/bernoulli-numbers.alg +++ b/Task/Bernoulli-numbers/ALGOL-68/bernoulli-numbers.alg @@ -33,14 +33,7 @@ BEGIN num OF result//den OF result ); - OP - = (FRAC a, b)FRAC: a + -b, - * = (FRAC a, b)FRAC: ( - LONG LONG INT num = num OF a * num OF b, - den = den OF a * den OF b; - LONG LONG INT common = gcd(num, den); - (num OVER common) // (den OVER common) - ); - + OP - = (FRAC a, b)FRAC: a + -b; OP - = (FRAC frac)FRAC: (-num OF frac, den OF frac); # ============================================================== # @@ -71,7 +64,8 @@ BEGIN FRAC bn := bernoulli( n ); IF num OF bn /= 0 THEN # have a non-0 Bn # - print( ( "B(", whole( n, -2 ), ") ", whole( num OF bn, -50 ), " / ", whole( den OF bn, 0 ), newline ) ) + print( ( "B(", whole( n, -2 ), ") ", whole( num OF bn, -50 ) ) ); + print( ( " / ", whole( den OF bn, 0 ), newline ) ) FI OD END diff --git a/Task/Bernoulli-numbers/Ada/bernoulli-numbers.ada b/Task/Bernoulli-numbers/Ada/bernoulli-numbers-1.adb similarity index 100% rename from Task/Bernoulli-numbers/Ada/bernoulli-numbers.ada rename to Task/Bernoulli-numbers/Ada/bernoulli-numbers-1.adb diff --git a/Task/Bernoulli-numbers/Ada/bernoulli-numbers-2.adb b/Task/Bernoulli-numbers/Ada/bernoulli-numbers-2.adb new file mode 100644 index 0000000000..16ff6c98fa --- /dev/null +++ b/Task/Bernoulli-numbers/Ada/bernoulli-numbers-2.adb @@ -0,0 +1,45 @@ +with Ada.Text_IO; use Ada.Text_IO; +with Strings_Edit; use Strings_Edit; +with Strings_Edit.Integers; use Strings_Edit.Integers; +with Unbounded_Rationals; use Unbounded_Rationals; +with Unbounded_Unsigneds; use Unbounded_Unsigneds; + +with Strings_Edit.Unbounded_Unsigned_Edit; +use Strings_Edit.Unbounded_Unsigned_Edit; + +procedure Bernoulli is + function Bernoulli_Number (N : Natural) return Unbounded_Rational is + A : array (0..Half_Word (N)) of Unbounded_Rational; + begin + for M in 0..Half_Word (N) loop + A (M) := Unbounded_Rationals.One / (M + 1); + for J in reverse 1..M LOOP + A (J - 1) := J * (A (J - 1) - A (J)); + end loop; + end loop; + return A (0); + end Bernoulli_Number; + B : Unbounded_Rational; + Line : String (1..80); + Pointer : Integer; +begin + for I in 0..60 loop + if I mod 2 = 0 or else I = 1 then + B := Bernoulli_Number (I); + if not Is_Zero (B) then + Pointer := 1; + Put (Line, Pointer, "B("); + Put (Line, Pointer, I, 10, False, 2, Right); + Put (Line, Pointer, ") = "); + if Is_Negative (B) then + Put (Line, Pointer, '-' & Image (Get_Numerator (B)), 45, Right); + else + Put (Line, Pointer, Get_Numerator (B), 10, 45, Right); + end if; + Put (Line, Pointer, " / "); + Put (Line, Pointer, Get_Denominator (B)); + Put_Line (Line (1..Pointer - 1)); + end if; + end if; + end loop; +end Bernoulli; diff --git a/Task/Bernoulli-numbers/Crystal/bernoulli-numbers-1.crystal b/Task/Bernoulli-numbers/Crystal/bernoulli-numbers-1.cr similarity index 100% rename from Task/Bernoulli-numbers/Crystal/bernoulli-numbers-1.crystal rename to Task/Bernoulli-numbers/Crystal/bernoulli-numbers-1.cr diff --git a/Task/Bernoulli-numbers/Crystal/bernoulli-numbers-2.crystal b/Task/Bernoulli-numbers/Crystal/bernoulli-numbers-2.cr similarity index 100% rename from Task/Bernoulli-numbers/Crystal/bernoulli-numbers-2.crystal rename to Task/Bernoulli-numbers/Crystal/bernoulli-numbers-2.cr diff --git a/Task/Bernoulli-numbers/Crystal/bernoulli-numbers-3.crystal b/Task/Bernoulli-numbers/Crystal/bernoulli-numbers-3.cr similarity index 100% rename from Task/Bernoulli-numbers/Crystal/bernoulli-numbers-3.crystal rename to Task/Bernoulli-numbers/Crystal/bernoulli-numbers-3.cr diff --git a/Task/Bernoulli-numbers/Delphi/bernoulli-numbers.delphi b/Task/Bernoulli-numbers/Delphi/bernoulli-numbers.pas similarity index 100% rename from Task/Bernoulli-numbers/Delphi/bernoulli-numbers.delphi rename to Task/Bernoulli-numbers/Delphi/bernoulli-numbers.pas diff --git a/Task/Bernoulli-numbers/Elixir/bernoulli-numbers.elixir b/Task/Bernoulli-numbers/Elixir/bernoulli-numbers.ex similarity index 100% rename from Task/Bernoulli-numbers/Elixir/bernoulli-numbers.elixir rename to Task/Bernoulli-numbers/Elixir/bernoulli-numbers.ex diff --git a/Task/Bernoulli-numbers/FutureBasic/bernoulli-numbers.basic b/Task/Bernoulli-numbers/FutureBasic/bernoulli-numbers.basic new file mode 100644 index 0000000000..b0d0000ba4 --- /dev/null +++ b/Task/Bernoulli-numbers/FutureBasic/bernoulli-numbers.basic @@ -0,0 +1,93 @@ +// +// Bernoulli Number +// Using FutureBasic 7.0.35 +// +// September 2025, R.W +// + +include "gmp.incl" + +_kMaxN = 200 // max Bernoulli terms + +mpq_t tmp +dim a( _kMaxN ) as mpq_t // workspace a(0.._kMaxN) + +// Bernoulli: +// B_m = -(1 / (m+1)) * sum_{k=0..m-1} binomial(m+1, k) * B_k + +local fn Bernoulli( rop as mpq_t, n as long ) + long m, j + if n < 0 then n = 0 + if n > _kMaxN then n = _kMaxN + for m = 1 to n + 1 + mpq_set_si( a(m-1), 1, m ) + // j = m-1..1 + for j = m - 1 to 1 step -1 + // a[j] = a[j+1] - a[j] with 0-based mapping + mpq_sub( a(j-1), a(j), a(j-1) ) + // multiply by j + mpq_set_si( tmp, j, 1 ) + mpq_mul( a(j-1), a(j-1), tmp ) + next + next + mpq_set( rop, a(0) ) +end fn + + +//-------------- Main --------- + +Window 1, @"Bernoulli Numbers",(0,0,500,500) + +CFStringRef cfnum, cfden, pLine, filler,sp,sp2 +Int terms +long i + +terms = 60 + +mpq_init( tmp ) +for i = 0 to terms + mpq_init( a(i) ) +next +filler = @" " +mpq_t rop +mpz_t num, den + +mpq_init( rop ) +mpz_init( num ) +mpz_init( den ) +pLine = @"" +for i = 0 to 60 step 2 + if i = 2 then i-- + if i = 3 then i-- + fn Bernoulli( rop, i ) + mpq_get_num( num, rop ) + if i == 1 + mpz_neg( num, num ) + end if + if fn mpz_cmp_si( num, 0 ) // nonzero? + mpq_get_den( den, rop ) + cfnum = fn mpz_cf(10, num) + cfden = fn mpz_cf(10, den) + if i < 10 + sp = @" " + else + sp = @"" + end if + sp2 = left(filler,44 - len(cfnum)) + pLine = concat(sp, @"B(",mid(str(i),1),@") = ",sp2 ,cfnum, @" / ", cfden) + print@ pLine + end if +next + +// clean up +for i = 0 to terms + mpq_clear( a(i) ) +next +mpq_clear( tmp ) +mpz_clear( den ) +mpz_clear( num ) +mpq_clear( rop ) + +HandleEvents + +// diff --git a/Task/Bernoulli-numbers/Isabelle/bernoulli-numbers-1.isabelle b/Task/Bernoulli-numbers/Isabelle/bernoulli-numbers-1.isabelle new file mode 100644 index 0000000000..485cee8d92 --- /dev/null +++ b/Task/Bernoulli-numbers/Isabelle/bernoulli-numbers-1.isabelle @@ -0,0 +1,373 @@ +theory Mini_Bernoulli +imports Complex_Main + "HOL-Computational_Algebra.Computational_Algebra" + "HOL-Combinatorics.Stirling" + "HOL-Library.Stream" + "Coinductive.Coinductive_List" + "HOL-Library.Code_Target_Numeral" + "HOL-Library.Code_Lazy" + +begin + +subsection ‹Definition of Bernoulli numbers› + +(* We define Bernoulli numbers in the standard fashion as those numbers B_n whose exponential + generating function function is X / (1 - e^(-X)): *) + +definition bernoulli_fps :: "rat fps" + where "bernoulli_fps = fps_X / (1 - fps_exp (-1))" + +definition bernoulli :: "nat ⇒ rat" where + "bernoulli n = fps_nth bernoulli_fps n * fact n" + + +subsection ‹Stirling numbers of the 2nd kind› + +(* We use the Stirling numbers from the Isabelle library and prove a few additional things + about them. *) + +lemma Stirling_n_0: "Stirling n 0 = (if n = 0 then 1 else 0)" + by (cases n) simp_all + +lemma sum_Stirling_binomial: + "Stirling (Suc n) (Suc m) = (∑i=0..n. Stirling i m * (n choose i))" +proof - + have "real (Stirling (Suc n) (Suc m)) = real (∑i = 0..n. Stirling i m * (n choose i))" + proof (induction n arbitrary: m) + case (Suc n m) + have "real (∑i = 0..Suc n. Stirling i m * (Suc n choose i)) = + real (∑i = 0..n. Stirling (Suc i) m * (Suc n choose Suc i)) + real (Stirling 0 m)" + by (subst sum.atLeast0_atMost_Suc_shift) simp_all + also have "real (∑i = 0..n. Stirling (Suc i) m * (Suc n choose Suc i)) = + real (∑i = 0..n. (n choose i) * Stirling (Suc i) m) + + real (∑i = 0..n. (n choose Suc i) * Stirling (Suc i) m)" + by (simp add: algebra_simps sum.distrib) + also have "(∑i = 0..n. (n choose Suc i) * Stirling (Suc i) m) = + (∑i = Suc 0..Suc n. (n choose i) * Stirling i m)" + by (subst sum.shift_bounds_cl_Suc_ivl) simp_all + also have "… = (∑i = Suc 0..n. (n choose i) * Stirling i m)" + by (intro sum.mono_neutral_right) auto + also have "… = real (∑i = 0..n. Stirling i m * (n choose i)) - real (Stirling 0 m)" + by (simp add: sum.atLeast_Suc_atMost mult_ac) + also have "real (∑i = 0..n. Stirling i m * (n choose i)) = real (Stirling (Suc n) (Suc m))" + by (rule Suc.IH [symmetric]) + also have "real (∑i = 0..n. (n choose i) * Stirling (Suc i) m) = + real m * real (Stirling (Suc n) (Suc m)) + real (Stirling (Suc n) m)" + by (cases m; (simp only: Suc.IH, simp add: algebra_simps sum.distrib + sum_distrib_left sum_distrib_right)) + also have "… + (real (Stirling (Suc n) (Suc m)) - real (Stirling 0 m)) + real (Stirling 0 m) = + real (Suc m * Stirling (Suc n) (Suc m) + Stirling (Suc n) m)" + by (simp add: algebra_simps del: Stirling.simps) + also have "Suc m * Stirling (Suc n) (Suc m) + Stirling (Suc n) m = + Stirling (Suc (Suc n)) (Suc m)" + by (rule Stirling.simps(4) [symmetric]) + finally show ?case .. + qed simp_all + thus ?thesis by (subst (asm) of_nat_eq_iff) +qed + +(* The exponential generating function of the Stirling numbers (of the 2nd kind) with + fixed second argument $m$ is S_m(X) = (e^X - 1)^m / m!. + We use this fact to derive a closed form for them. *) +lemma Stirling_fps_aux: + "(fps_exp 1 - 1) ^ m $ n * fact n = (fact m * of_nat (Stirling n m) :: 'a :: field_char_0)" +proof (induction m arbitrary: n) + case 0 + thus ?case by (simp add: Stirling_n_0) +next + case (Suc m n) + show ?case + proof (cases n) + case 0 + thus ?thesis by simp + next + case (Suc n') + hence "(fps_exp 1 - 1 :: 'a fps) ^ Suc m $ n * fact n = + fps_deriv ((fps_exp 1 - 1) ^ Suc m) $ n' * fact n'" + by (simp_all add: algebra_simps del: power_Suc) + also have "fps_deriv ((fps_exp 1 - 1 :: 'a fps) ^ Suc m) = + fps_const (of_nat (Suc m)) * ((fps_exp 1 - 1) ^ m * fps_exp 1)" + by (subst fps_deriv_power) simp_all + also have "… $ n' * fact n' = + of_nat (Suc m) * ((∑i = 0..n'. (fps_exp 1 - 1) ^ m $ i / fact (n' - i)) * fact n')" + unfolding fps_mult_left_const_nth + by (simp add: fps_mult_nth Suc.IH sum_distrib_right del: of_nat_Suc) + also have "(∑i = 0..n'. (fps_exp 1 - 1 :: 'a fps) ^ m $ i / fact (n' - i)) * fact n' = + (∑i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact n' / fact (n' - i))" + by (subst sum_distrib_right, rule sum.cong) (simp_all add: divide_simps) + also have "… = (∑i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact i * of_nat (n' choose i))" + by (intro sum.cong refl) (simp_all add: binomial_fact) + also have "… = (∑i = 0..n'. fact m * of_nat (Stirling i m) * of_nat (n' choose i))" + by (simp only: Suc.IH) + also have "of_nat (Suc m) * … = (fact (Suc m) :: 'a) * + (∑i = 0..n'. of_nat (Stirling i m) * of_nat (n' choose i))" (is "_ = _ * ?S") + by (simp add: sum_distrib_left sum_distrib_right mult_ac del: of_nat_Suc) + also have "?S = of_nat (Stirling (Suc n') (Suc m))" + by (subst sum_Stirling_binomial) simp + also have "Suc n' = n" by (simp add: Suc) + finally show ?thesis . + qed +qed + +theorem Stirling_closed_form: + "(of_nat (Stirling n k) :: 'a :: field_char_0) = + (∑j≤k. (-1)^(k - j) * of_nat (k choose j) * of_nat j ^ n) / fact k" +proof - + have "(fps_exp 1 - 1 :: 'a fps) = (fps_exp 1 + (-1))" by simp + also have "… ^ k = (∑j≤k. of_nat (k choose j) * fps_exp 1 ^ j * (- 1) ^ (k - j))" + unfolding binomial_ring .. + also have "… = (∑j≤k. fps_const ((-1) ^ (k - j) * of_nat (k choose j)) * fps_exp (of_nat j))" + by (simp add: fps_const_mult [symmetric] fps_const_power [symmetric] + fps_const_neg [symmetric] mult_ac fps_of_nat fps_exp_power_mult + del: fps_const_mult fps_const_power fps_const_neg) + also have "fps_nth … n = (∑j≤k. (- 1) ^ (k - j) * of_nat (k choose j) * of_nat j ^ n) / fact n" + by (simp add: fps_sum_nth sum_divide_distrib) + also have "… * fact n = (∑j≤k. (- 1) ^ (k - j) * of_nat (k choose j) * of_nat j ^ n)" + by simp + also note Stirling_fps_aux[of k n] + finally show ?thesis by (simp add: atLeast0AtMost field_simps) +qed + + +(* + We now define a somewhat ad-hoc operator formal power series: XD' maps a formal power + series A(X) to the series (X - 1) A'(X). + + The relevance of this operator to us is that the n-fold iteration of this operator + is related to Stirling numbers. +*) +definition fps_XD' :: "'a :: field_char_0 fps ⇒ 'a fps" + where "fps_XD' = (λb. (fps_X - 1) * fps_deriv b)" + +lemma fps_XD'_0 [simp]: "fps_XD' 0 = 0" + and fps_XD'_1 [simp]: "fps_XD' 1 = 0" + and fps_XD'_add [simp]: "fps_XD' (b + c) = fps_XD' b + fps_XD' c" + and fps_XD'_mult: "fps_XD' (b * c) = fps_XD' b * c + b * fps_XD' c" + by (simp_all add: fps_XD'_def algebra_simps) + +lemma fps_XD'_power: "fps_XD' (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' b" + by (induction n) (simp_all add: algebra_simps fps_XD'_mult power_eq_if) + +lemma fps_XD'_sum: "fps_XD' (sum f A) = sum (λx. fps_XD' (f x)) A" + by (induction A rule: infinite_finite_induct) simp_all + +lemma fps_XD'_funpow: + defines "S ≡ λn i. fps_const (of_nat (Stirling n i))" + shows "(fps_XD' ^^ n) H = (∑m≤n. S n m * (fps_X - 1) ^ m * (fps_deriv ^^ m) H)" +proof (induction n arbitrary: H) + case 0 + thus ?case by (simp add: S_def) +next + case (Suc n H) + define G where "G = (fps_X - 1 :: 'a fps)" + have "(∑m≤Suc n. S (Suc n) m * G ^ m * (fps_deriv ^^ m) H) = + (∑i≤n. of_nat (Suc i) * S n (Suc i) * G ^ Suc i * (fps_deriv ^^ Suc i) H) + + (∑i≤n. S n i * G ^ Suc i * (fps_deriv ^^ Suc i) H)" + (is "_ = sum (λi. ?f (Suc i)) … + ?S2") + by (subst sum.atMost_Suc_shift) (simp_all add: sum.distrib algebra_simps fps_of_nat S_def + fps_const_add [symmetric] fps_const_mult [symmetric] del: fps_const_add fps_const_mult) + also have "sum (λi. ?f (Suc i)) {..n} = sum (λi. ?f (Suc i)) {..= 1; j--) { + A[j - 1] = A[j - 1].subtract(A[j]).multiply(new Fraction(j)); + } + } + return A[0]; +} + +// Main execution +const ZERO = new Fraction(0); +for (let n = 0; n <= 60; n++) { + const b = bernoulli(n); + if (!b.equals(ZERO)) { + console.log(`B(${n.toString().padEnd(2)}) = ${b}`); + } +} diff --git a/Task/Bernoulli-numbers/Julia/bernoulli-numbers.julia b/Task/Bernoulli-numbers/Julia/bernoulli-numbers.jl similarity index 100% rename from Task/Bernoulli-numbers/Julia/bernoulli-numbers.julia rename to Task/Bernoulli-numbers/Julia/bernoulli-numbers.jl diff --git a/Task/Bernoulli-numbers/Kotlin/bernoulli-numbers.kotlin b/Task/Bernoulli-numbers/Kotlin/bernoulli-numbers.kts similarity index 100% rename from Task/Bernoulli-numbers/Kotlin/bernoulli-numbers.kotlin rename to Task/Bernoulli-numbers/Kotlin/bernoulli-numbers.kts diff --git a/Task/Bernoulli-numbers/M2000-Interpreter/bernoulli-numbers.m2000 b/Task/Bernoulli-numbers/M2000-Interpreter/bernoulli-numbers.m2000 new file mode 100644 index 0000000000..8f39e733c1 --- /dev/null +++ b/Task/Bernoulli-numbers/M2000-Interpreter/bernoulli-numbers.m2000 @@ -0,0 +1,96 @@ +module Bernoulli_Numbers { + Class Rational { + numerator as decimal, denominator as decimal + gcd=lambda->0 + lcm=lambda->0 + operator "+" { + Read l + denom=.lcm(l.denominator, .denominator) + .numerator<=denom/l.denominator*l.numerator+denom/.denominator*.numerator + if .numerator==0 then denom=1 + .denominator<=denom + } + Operator Unary { + .numerator-! + } + Operator "-" { + Read l + Call Operator "+", -l + } + Group Real { + value { + link parent numerator, denominator to n, d + =n/d + } + } + Group ToString$ { + value { + link parent numerator, denominator to n, d + =Str$(n)+"/"+Str$(d,"") + } + } + class: + Module Rational (.numerator, .denominator) { + if .denominator=0 then .denominator<=1 + while frac(.numerator)<>0 { + .numerator*=10@ + .denominator*=10@ + } + sgn=Sgn(.numerator)*Sgn(.denominator) + .denominator<=abs(.denominator) + .numerator<=abs(.numerator)*sgn + gcd1=lambda (a as decimal, b as decimal) -> { + if a0 then + .denominator/=gdcval + .numerator/=gdcval + end if + .gcd<=gcd1 + .lcm<=lambda gcd=gcd1 (a as decimal, b as decimal) -> { + =a/gcd(a,b)*b + } + } + } + Open "out.txt" for output as #f + r1=Rational(1,1) + b=0 + nextBern() + b=1 + nextBern() + for b=2 to 28 step 2 + nextBern() + next + close #f + + sub nextBern() + local m=@bernoulli(b) + Print #F, format$("B({0::-2})={1}",b, m.tostring$) + end sub + function bernoulli(n as decimal) + Local a(1 to n+1)=Rational(1,1), z + local decimal m, j + for m=0 to n + a(m + 1) = Rational(1 , m + 1) + if m<1 then continue + for j = m to 1 + z= a(J) - a(j+1) + r1 + a(j)=z + nn=z.gcd(j, z.denominator) + a(j).numerator*=j/nn + a(j).denominator/=nn + next + for a(1) { + this=rational(.numerator, .denominator) + } + next + =a(1) + end function +} +Bernoulli_Numbers diff --git a/Task/Bernoulli-numbers/Pluto/bernoulli-numbers.pluto b/Task/Bernoulli-numbers/Pluto/bernoulli-numbers.pluto new file mode 100644 index 0000000000..2a23069296 --- /dev/null +++ b/Task/Bernoulli-numbers/Pluto/bernoulli-numbers.pluto @@ -0,0 +1,22 @@ +require "bignum" +local fmt = require "fmt" + +local function bernoulli(n) + assert(n >= 0, "Argument must be non-negative") + local a = table.create(n + 1) + for m = 0, n do + a[m + 1] = bigrat.recip(m + 1) + local j = m + while j >= 1 do + a[j] = (a[j] - a[j + 1]) * bigrat.int(j) + j -= 1 + end + end + return n != 1 ? a[1] : -a[1] --'first' Bernoulli number +end + +local zero = bigrat.int(0) +for n = 0, 60 do + local b = bernoulli(n) + if b != zero then fmt.print("B(%2d) = %44s / %s", n, b:getNum(), b:getDen()) end +end diff --git a/Task/Bernoulli-numbers/R/bernoulli-numbers.r b/Task/Bernoulli-numbers/R/bernoulli-numbers.r index e6c84acce2..71e908ffcf 100644 --- a/Task/Bernoulli-numbers/R/bernoulli-numbers.r +++ b/Task/Bernoulli-numbers/R/bernoulli-numbers.r @@ -1,8 +1,6 @@ -library(pracma) +library(gmp) -for (idx in c(1,2*0:30)) { - b <- bernoulli(idx) - d <- as.character(denominator(b)) - n <- as.character(numerator(b)) - cat("B(",idx,") = ",n,"/",d,"\n", sep = "") -} +indices <- c(0,1,2*(1:30)) +bnums <- sapply(indices, BernoulliQ) +names(bnums) <- paste0("B(", indices, ")") +print(bnums, initLine=FALSE) diff --git a/Task/Bernoulli-numbers/REXX/bernoulli-numbers.rexx b/Task/Bernoulli-numbers/REXX/bernoulli-numbers.rexx index a1673236bf..0fa77e3ed1 100644 --- a/Task/Bernoulli-numbers/REXX/bernoulli-numbers.rexx +++ b/Task/Bernoulli-numbers/REXX/bernoulli-numbers.rexx @@ -1,55 +1,125 @@ -/*REXX program calculates N number of Bernoulli numbers expressed as vulgar fractions.*/ -parse arg N .; if N=='' | N=="," then N= 60 /*Not specified? Then use the default.*/ -numeric digits max(9, n*2) /*increase the decimal digits if needed*/ -w= max(length(N), 4); Nw= N + w + N % 4 /*used for aligning (output) fractions.*/ -say 'B(n)' center("Bernoulli numbers expressed as vulgar fractions", max(78-w, Nw) ) -say copies('─',w) copies("─", max(78-w,Nw+2*w)) /*display 2nd line of title, separators*/ -!.= .; do #=0 to N /*process the numbers from 0 ──► N. */ - b= bern(#); if b==0 then iterate /*calculate Bernoulli number, skip if 0*/ - indent= max(0, nW - pos('/', b) ) /*calculate the alignment (indentation)*/ - say right(#, w) left('', indent) b /*display the indented Bernoulli number*/ - end /*#*/ /* [↑] align the Bernoulli fractions. */ -exit 0 /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -bern: parse arg x; if x==0 then return '1/1' /*handle the special case of zero. */ - if x==1 then return '-1/2' /* " " " " " one. */ - if x//2 then return 0 /* " " " " " odds > 1.*/ - do j=2 to x by 2; jp= j+1 /*process the positive integers up to X*/ - sn= 1 - j /*define the numerator. */ - sd= 2 /* " " denominator. */ - do k=2 to j-1 by 2 /*calculate a SN/SD sequence. */ - parse var @.k bn '/' ad /*get a previously calculated fraction.*/ - an= comb(jp, k) * bn /*use COMBination for the next term. */ - $lcm= LCM(sd, ad) /*use Least Common Denominator function*/ - sn= $lcm % sd * sn; sd= $lcm /*calculate the current numerator. */ - an= $lcm % ad * an /* " " next " */ - sn= sn + an /* " " current " */ - end /*k*/ /* [↑] calculate the SN/SD sequence.*/ - sn= -sn /*flip the sign for the numerator. */ - sd= sd * jp /*calculate the denominator. */ - if sn\==1 then do; _= GCD(sn, sd) /*get the Greatest Common Denominator.*/ - sn= sn%_; sd= sd%_ /*reduce the numerator and denominator.*/ - end /* [↑] done with the reduction(s). */ - @.j= sn'/'sd /*save the result for the next round. */ - end /*j*/ /* [↑] done calculating Bernoulli #'s.*/ - return sn'/'sd -/*──────────────────────────────────────────────────────────────────────────────────────*/ -comb: procedure expose !.; parse arg x,y; if x==y then return 1 - if !.C.x.y\==. then return !.C.x.y /*combination computed before?*/ - if x-y < y then y= x-y /*x-y < y? Then use a new Y.*/ - z= perm(x, y); do j=2 for y-1; z= z % j - end /*j*/ - !.C.x.y= z; return z /*assign memoization & return.*/ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -GCD: procedure; parse arg x,y; x= abs(x) - do until y==0; parse value x//y y with y x; end; return x -/*──────────────────────────────────────────────────────────────────────────────────────*/ -LCM: procedure; parse arg x,y /*X=ABS(X); Y=ABS(Y) not needed for Bernoulli #s.*/ - /*IF Y==0 THEN RETURN 0 " " " " " */ - $= x * y /*calculate part of the LCM here. */ - do until y==0; parse value x//y y with y x - end /*until*/ /* [↑] this is a short & fast GCD*/ - return $ % x /*divide the pre─calculated value.*/ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -perm: procedure expose !.; parse arg x,y; if !.P.x.y\==. then return !.P.x.y - z= 1; do j=x-y+1 to x; z= z*j; end; !.P.x.y= z; return z +-- 23 Aug 2025 +include Setting +numeric digits 16 +arg xx +if xx = '' then + xx=60 +ss=(xx>0); xx=Abs(xx) + +say 'BERNOULLI NUMBERS' +say version +say + +call Rational1 xx +if ss then + call ShowFractions xx +call Timer 'R' + +call Rational2 xx +if ss then + call ShowFractions xx +call Timer 'R' + +call Decimal1 xx +if ss then + call ShowDecimals xx +call Timer 'R' + +call Decimal2 xx +if ss then + call ShowDecimals xx +call Timer 'R' +exit + +Rational1: +procedure expose Memo. Bern. +arg xx +say 'Rational arithmetic' +say 'cf Generating function' +numeric digits Max(Digits(),3*xx) +Bern.=0; Bern.0='1 1'; Bern.1='-1 2' +do n = 2 by 2 to xx + s=0 + do k = 0 to n-1 + s=Addq(s,Scaleq(Bern.k,Comb(n+1,k))) + end k + Bern.n=Mulq(Negq(s),Invq(n+1)) +end n +return + +Rational2: +procedure expose Memo. Bern. +arg xx +say 'Numerator and denominator calculations' +say 'cf Double sum formula optimized' +numeric digits Max(Digits(),3*xx) +Bern.=0; Bern.0='1 1'; Bern.1='-1 2' +do j = 2 by 2 to xx + jp=j+1; sn=1-j; sd=2 + do k = 2 by 2 to j-1 + bn=bn.k; ad=ad.k; an=Comb(jp,k)*bn; tl=Lcm(sd,ad) + sn=tl%sd*sn; sd=tl; an=tl%ad*an; sn=sn+an + end k + sn=-sn; sd=sd*jp; bn.j=sn; ad.j=sd; g=Gcd(Abs(sn),sd) + Bern.j=sn/g sd/g +end j +return + +ShowFractions: +procedure expose Bern. +arg xx +w=Length(Word(Bern.xx,1))+2 +say ' Bn' Right('Num',w) '/' Left('Den',10) 'Decimal' +do i = 0 to xx + if Bern.i <> 0 then do + parse var Bern.i num den + say Right(i,3) Right(num,w) '/' Left(den,10) Digit(num/den,16) + end +end i +return + +Decimal1: +procedure expose Bern. Memo. +arg xx +say 'Floating point calculations' +say 'cf Generating function' +numeric digits Max(Digits(),2*xx) +Bern.=0; Bern.0=1; Bern.1='-0.5' +do n = 2 by 2 to xx + s=0 + do k = 0 to n-1 + s=s+Bern.k*Comb(n+1,k) + end k + Bern.n=-s/(n+1) +end n +return xx + +Decimal2: +procedure expose Bern. Memo. +arg xx +say 'Floating point calculations' +say 'cf Akiyama-Tanigawa' +numeric digits Max(Digits(),3*xx) +Bern.=0; Bern.0=1; Bern.1=-0.5 +do i = 2 by 2 to xx + do m = 0 to i + a.m=1/(m+1) + do j = m by -1 to 1 + j1=j-1; a.j1=j*(a.j1-a.j) + end + end m + Bern.i=a.0 +end i +return xx + +ShowDecimals: +procedure expose Bern. +arg xx +say ' Bn' 'Decimal' +do i = 0 to xx + if Bern.i <> 0 then + say Right(i,3) Digit(Bern.i,16) +end i +return + +include Math diff --git a/Task/Bernoulli-numbers/Rust/bernoulli-numbers.rust b/Task/Bernoulli-numbers/Rust/bernoulli-numbers.rs similarity index 100% rename from Task/Bernoulli-numbers/Rust/bernoulli-numbers.rust rename to Task/Bernoulli-numbers/Rust/bernoulli-numbers.rs diff --git a/Task/Bernoulli-numbers/Scheme/bernoulli-numbers.ss b/Task/Bernoulli-numbers/Scheme/bernoulli-numbers.scm similarity index 100% rename from Task/Bernoulli-numbers/Scheme/bernoulli-numbers.ss rename to Task/Bernoulli-numbers/Scheme/bernoulli-numbers.scm diff --git a/Task/Bernoulli-numbers/TAV/bernoulli-numbers-1.tav b/Task/Bernoulli-numbers/TAV/bernoulli-numbers-1.tav new file mode 100644 index 0000000000..b24fd56d97 --- /dev/null +++ b/Task/Bernoulli-numbers/TAV/bernoulli-numbers-1.tav @@ -0,0 +1,14 @@ +bernoulli (n): + a =: new row + for m =: from 0 upto n + a[m] =: 1 / (m + 1) + for j =: from m downto 1 + a[j-1] =: j * (a[j-1] - a[j]) + return a[0] + +main (p):+ + max =: string p.1 as integer else 60 \ max number as parameter + for i =: from 2 upto max step 2 + b =: bernoulli i + \ to align the slash, print numerator and denominator separately + print format "B(%2;) = %50; / %;" i, b.num, b.den diff --git a/Task/Bernoulli-numbers/TAV/bernoulli-numbers-2.tav b/Task/Bernoulli-numbers/TAV/bernoulli-numbers-2.tav new file mode 100644 index 0000000000..67e1634b4b --- /dev/null +++ b/Task/Bernoulli-numbers/TAV/bernoulli-numbers-2.tav @@ -0,0 +1,22 @@ +main (parms):+ + n =: string parms[1] as integer else 30 + print n bernoullis + +\ ierative version as used by Ada Lovelace +print (max) bernoullis: + b =: [] + b[1] =: 1/6 + print 'B[1]=' _ b[1] + ?# n =: from 2 upto max + k =: 2*n - 1 + n2 =: 2*n + a0 =: - (n2 - 1) / (n2 + 1) / 2 + a1 =: n2 / 2 + x =: a0 + (b[1] * a1) + aj =: a1 + ?# j =: from 3 upto k-1 step 2 + aj =* (n2 - (j-2)) / j + aj =* (n2 - (j-1)) / (j + 1) + x =+ b[j] * aj + b[k] =: -x + print format "B(%2;) = %50; / %;" k, b[k].num, b[k].den diff --git a/Task/Bernoulli-numbers/Wren/bernoulli-numbers.wren b/Task/Bernoulli-numbers/Wren/bernoulli-numbers.wren index 4a91d97ed2..b7e6712d4f 100644 --- a/Task/Bernoulli-numbers/Wren/bernoulli-numbers.wren +++ b/Task/Bernoulli-numbers/Wren/bernoulli-numbers.wren @@ -1,5 +1,5 @@ -import "/fmt" for Fmt -import "/big" for BigRat +import "./fmt" for Fmt +import "./big" for BigRat var bernoulli = Fn.new { |n| if (n < 0) Fiber.abort("Argument must be non-negative") diff --git a/Task/Best-shuffle/Ada/best-shuffle.ada b/Task/Best-shuffle/Ada/best-shuffle.adb similarity index 100% rename from Task/Best-shuffle/Ada/best-shuffle.ada rename to Task/Best-shuffle/Ada/best-shuffle.adb diff --git a/Task/Best-shuffle/Crystal/best-shuffle.crystal b/Task/Best-shuffle/Crystal/best-shuffle.cr similarity index 100% rename from Task/Best-shuffle/Crystal/best-shuffle.crystal rename to Task/Best-shuffle/Crystal/best-shuffle.cr diff --git a/Task/Best-shuffle/Delphi/best-shuffle.delphi b/Task/Best-shuffle/Delphi/best-shuffle.pas similarity index 100% rename from Task/Best-shuffle/Delphi/best-shuffle.delphi rename to Task/Best-shuffle/Delphi/best-shuffle.pas diff --git a/Task/Best-shuffle/EasyLang/best-shuffle.easy b/Task/Best-shuffle/EasyLang/best-shuffle.easy new file mode 100644 index 0000000000..4f6a5e338f --- /dev/null +++ b/Task/Best-shuffle/EasyLang/best-shuffle.easy @@ -0,0 +1,39 @@ +proc best_shuffle s$ &r$ &diff . + l = len s$ + for c$ in strchars s$ + s[] &= strcode c$ + . + len cnt[] 128 + for i to l + cnt[s[i]] += 1 + max = higher max cnt[s[i]] + . + for i to 128 + while cnt[i] > 0 + cnt[i] -= 1 + buf[] &= i + . + . + r[] = s[] + for i to l + for j to l + if r[i] = buf[j] + r[i] = buf[(j + max) mod1 l] mod 128 + if buf[j] <= 128 + buf[j] += 128 + . + break 1 + . + . + . + diff = 0 + r$ = "" + for i to l + diff += if r[i] = s[i] + r$ &= strchar r[i] + . +. +for s$ in [ "abracadabra" "seesaw" "elk" "grrrrrr" "up" "a" ] + best_shuffle s$ r$ d + print s$ & " " & r$ & " " & d +. diff --git a/Task/Best-shuffle/Elena/best-shuffle.elena b/Task/Best-shuffle/Elena/best-shuffle.elena index e06155442f..19abfc3e25 100644 --- a/Task/Best-shuffle/Elena/best-shuffle.elena +++ b/Task/Best-shuffle/Elena/best-shuffle.elena @@ -4,45 +4,45 @@ import extensions'text; extension op { - get Shuffled() - { - var original := self.toArray(); - var shuffled := self.toArray(); + get Shuffled() + { + var original := self.toArray(); + var shuffled := self.toArray(); - for (int i := 0, i < original.Length, i += 1) { - for (int j := 0, j < original.Length, j += 1) { - if (i != j && original[i] != shuffled[j] && original[j] != shuffled[i]) - { - shuffled.exchange(i,j) - } + for (int i := 0; i < original.Length; i += 1) { + for (int j := 0; j < original.Length; j += 1) { + if (i != j && original[i] != shuffled[j] && original[j] != shuffled[i]) + { + shuffled.exchange(i,j) } - }; + } + }; - ^ shuffled.summarize(new StringWriter()).toString() - } + ^ shuffled.summarize(new StringWriter()).toString() + } - score(originalText) - { - var shuffled := self.toArray(); - var original := originalText.toArray(); - int score := 0; + score(originalText) + { + var shuffled := self.toArray(); + var original := originalText.toArray(); + int score := 0; - for (int i := 0, i < original.Length, i += 1) { - if (original[i] == shuffled[i]) { score += 1 } - }; + for (int i := 0; i < original.Length; i += 1) { + if (original[i] == shuffled[i]) { score += 1 } + }; - ^ score - } + ^ score + } } -public program() +public Program() { - new string[]{"abracadabra", "seesaw", "grrrrrr", "pop", "up", "a"}.forEach:(s) - { - var shuffled_s := s.Shuffled; + new string[]{"abracadabra", "seesaw", "grrrrrr", "pop", "up", "a"}.forEach::(s) + { + var shuffled_s := s.Shuffled; - console.printLine("The best shuffle of ",s," is ",shuffled_s,"(",shuffled_s.score(s),")") - }; + Console.printLine("The best shuffle of ",s," is ",shuffled_s,"(",shuffled_s.score(s),")") + }; - console.readChar() + Console.readChar() } diff --git a/Task/Best-shuffle/Factor/best-shuffle.factor b/Task/Best-shuffle/Factor/best-shuffle.factor new file mode 100644 index 0000000000..ac380801c1 --- /dev/null +++ b/Task/Best-shuffle/Factor/best-shuffle.factor @@ -0,0 +1,26 @@ +USING: arrays combinators.short-circuit formatting kernel random +sequences sequences.extras ; + +:: best-shuffle ( str -- str' ) + str clone :> new-str + str length :> n + n >array randomize :> range1 + n >array randomize :> range2 + + range1 [| i | + range2 [| j | + { + [ i j = ] + [ i new-str nth j new-str nth = ] + [ i str nth j new-str nth = ] + [ i new-str nth j str nth = ] + } 0|| [ + i j new-str exchange + ] unless + ] each + ] each + + new-str ; + +: best-shuffle. ( str -- ) + dup best-shuffle 2dup [ = ] 2count "%s, %s, (%d)\n" printf ; diff --git a/Task/Best-shuffle/Fortran/best-shuffle.f b/Task/Best-shuffle/Fortran/best-shuffle.f new file mode 100644 index 0000000000..8a02f8f4a4 --- /dev/null +++ b/Task/Best-shuffle/Fortran/best-shuffle.f @@ -0,0 +1,110 @@ +! +! Best Shuffle +! tested with Intel ifx (IFX) 2025.2.1 20250806 on Kubuntu 25.10 +! GNU Fortran (Ubuntu 15.2.0-4ubuntu4) 15.2.0 on Kubuntu 25.10 +! +! VSI Fortran on VMS does not compile this code because its current version +! cannot handle allocatable character strings +! +! U.B., October 2025 +!============================================================================== + +program bestShuffle + + implicit none + + integer, parameter :: MAXLEN = 100 ! Maximum length of strings to shuffle + character (len=MAXLEN), dimension(:),allocatable :: wordsToShuffle ! Test cases as in task description + character (len=MAXLEN) shuffledWord ! Result of a shuffle operation + integer :: ii, nWords, scr ! little helpers + integer:: longest ! Length of longest test string + character (len=50) :: vFormat ! Variable format for printing + + wordsToShuffle = & ! Preset test cases + [character(len=MAXLEN) :: 'abcdefghijk', & ! all letters different -> always score 0 + 'abracadabra', & ! The other test cases from task description + 'seesaw', & + 'elk', & + 'grrrrrrr', & + 'up', & + 'a'] ! This style makes both ifx AND gfortran happy. + nWords = size (wordsToShuffle) ! Number of test cases + longest = 0 + do ii=1, nWords ! Find length of longest test string + longest = max (longest, len_trim(wordsToShuffle(ii))) + end do + + ! Create a variable format depending on the length of the longest test string, + ! to print the original string, the shuffled string and the score in three columns + write (vFormat,'("(A", i0, ", x, A, T", i0,", i0)" )') longest, 2*longest+3 + + ! Initialize random number generator once for the entire run-time of the program and all test cases + call random_seed() + + do ii = 1, nWords + ! Using the Sattolo cycle guarantees that each and every letter will be moved from its original + ! position. However, duplicate letters within a word can lead to shuffled words that have a score >0 + ! If all letters aof the string are different, score will be 0 each time this program is run. + call sattolo_cycle (wordsToShuffle(ii), shuffledWord, scr) + print vFormat, trim(wordsToShuffle(ii)), trim(shuffledWord), scr + end do + + contains + + !============================================================= + ! shuffle using the Sattolo algorithm, and calculate the score + ! @win: word to shuffle, @wout: resultant string + ! @resultantscore: with the obvious meaning + !============================================================= + subroutine sattolo_cycle (win, wout, resultantscore) + + character (len=MAXLEN) , intent (in) :: win ! The word to shuffle + character (len=MAXLEN) , intent (out) :: wout ! The resultant word after shuffling + character :: tmp ! for swapping single letters + integer, intent(out) :: resultantscore ! the calculated score of the resultant string + + integer :: j, k, l ! Helper variables: indices into words, words' length + + wout = win + l = len_trim (wout) + do j = l, 1, -1 ! For all letters from end down to begin + k = randominInterval (1, j-1) ! Select random letters between 1 and j-1 + tmp = wout(j:j) ! then swap letter at pos j with letter at pos k + wout (j:j) = wout (k:k) + wout(k:k) = tmp + end do + + resultantscore = score (win,wout,l) ! Calculate score + end subroutine sattolo_cycle + + + ! =========================================================== + ! Generate random number between @lo and @hi (inclusive) + ! Assume Random Number Generator has been initialized before. + ! =========================================================== + function randominInterval (lo, hi) result (r) + integer, intent(in) :: lo, hi ! the interval + integer :: r ! resultant (pseudo-)random number + real :: rnd ! Fortran random number generator generates float values + + call random_number (rnd) + r = lo + FLOOR((hi+1-lo)*rnd) ! We want to choose one between [lo,hi] + + end function randominInterval + + !=============================================================================== + ! Calculate score: count positions that have the same letter as before shuffling + !=============================================================================== + function score (win, wout, l) result (scr) + character (len=MAXLEN) , intent (in) :: win, wout ! The two words to compare + integer , intent(in) :: l ! Length of the words to consider + integer :: scr ! Resultant score + integer :: jj ! Loop index + + scr = 0 + do jj=1,l + if (win(jj:jj) .eq. wout(jj:jj) ) scr = scr + 1 + enddo + end function score + +end program bestShuffle diff --git a/Task/Best-shuffle/Julia/best-shuffle.julia b/Task/Best-shuffle/Julia/best-shuffle.jl similarity index 100% rename from Task/Best-shuffle/Julia/best-shuffle.julia rename to Task/Best-shuffle/Julia/best-shuffle.jl diff --git a/Task/Best-shuffle/Kotlin/best-shuffle.kotlin b/Task/Best-shuffle/Kotlin/best-shuffle.kts similarity index 100% rename from Task/Best-shuffle/Kotlin/best-shuffle.kotlin rename to Task/Best-shuffle/Kotlin/best-shuffle.kts diff --git a/Task/Best-shuffle/OCaml/best-shuffle.ocaml b/Task/Best-shuffle/OCaml/best-shuffle.ml similarity index 100% rename from Task/Best-shuffle/OCaml/best-shuffle.ocaml rename to Task/Best-shuffle/OCaml/best-shuffle.ml diff --git a/Task/Best-shuffle/Pluto/best-shuffle.pluto b/Task/Best-shuffle/Pluto/best-shuffle.pluto new file mode 100644 index 0000000000..1f4a50c9bd --- /dev/null +++ b/Task/Best-shuffle/Pluto/best-shuffle.pluto @@ -0,0 +1,17 @@ +require "table2" +local fmt = require "fmt" + +local tests = {"abracadabra", "seesaw", "elk", "grrrrrr", "up", "a"} +for tests as s do + local t = s:split(""):shuffle() + for i = 1, #t do + for j = 1, #t do + if i != j and t[i] != s[j] and t[j] != s[i] then + t[i], t[j] = t[j], t[i] + break + end + end + end + local c = range(1, #s):count(|i| -> s[i] == t[i]) + fmt.print("%s, %s, (%d)\n", s, t:concat(""), c) +end diff --git a/Task/Best-shuffle/PowerShell/best-shuffle-1.psh b/Task/Best-shuffle/PowerShell/best-shuffle-1.ps1 similarity index 100% rename from Task/Best-shuffle/PowerShell/best-shuffle-1.psh rename to Task/Best-shuffle/PowerShell/best-shuffle-1.ps1 diff --git a/Task/Best-shuffle/PowerShell/best-shuffle-2.psh b/Task/Best-shuffle/PowerShell/best-shuffle-2.ps1 similarity index 100% rename from Task/Best-shuffle/PowerShell/best-shuffle-2.psh rename to Task/Best-shuffle/PowerShell/best-shuffle-2.ps1 diff --git a/Task/Best-shuffle/Rust/best-shuffle.rust b/Task/Best-shuffle/Rust/best-shuffle.rs similarity index 100% rename from Task/Best-shuffle/Rust/best-shuffle.rust rename to Task/Best-shuffle/Rust/best-shuffle.rs diff --git a/Task/Best-shuffle/SETL/best-shuffle.setl b/Task/Best-shuffle/SETL/best-shuffle.setl new file mode 100644 index 0000000000..0071908659 --- /dev/null +++ b/Task/Best-shuffle/SETL/best-shuffle.setl @@ -0,0 +1,20 @@ +program find_best_shuffle; + tests := ["tree", "abracadabra", "seesaw", "elk", "grrrrrr", "up", "a"]; + loop for test in tests do + print(test, '->', sh := best_shuffle(test), same(test, sh)); + end loop; + + proc best_shuffle(s); + r := s; + loop for i in [1..#s] do + loop for j in [1..#s] | i /= j and s(i) /= r(j) and s(j) /= r(i) do + [r(i), r(j)] := [r(j), r(i)]; + end loop; + end loop; + return r; + end proc; + + proc same(r, s); + return 0 +/[1 : i in [1..#s] | r(i) = s(i)]; + end proc; +end program; diff --git a/Task/Best-shuffle/Scheme/best-shuffle.ss b/Task/Best-shuffle/Scheme/best-shuffle.scm similarity index 100% rename from Task/Best-shuffle/Scheme/best-shuffle.ss rename to Task/Best-shuffle/Scheme/best-shuffle.scm diff --git a/Task/Best-shuffle/V-(Vlang)/best-shuffle.v b/Task/Best-shuffle/V-(Vlang)/best-shuffle.v new file mode 100644 index 0000000000..082b173897 --- /dev/null +++ b/Task/Best-shuffle/V-(Vlang)/best-shuffle.v @@ -0,0 +1,30 @@ +fn best_shuffle(s1 string) string { + mut s2 := s1.clone() + len_s2 := s2.len + mut s2_bytes := s2.bytes() + s1_bytes := s1.bytes() + for i in 0 .. len_s2 { + for j in 0 .. len_s2 { + if i != j && s2_bytes[i] != s1_bytes[j] && s2_bytes[j] != s1_bytes[i] { + i1 := if j < i { j } else { i } + j1 := if j < i { i } else { j } + // swap characters at i1 and j1 in s2_bytes + s2_bytes[i1], s2_bytes[j1] = s2_bytes[j1], s2_bytes[i1] + } + } + } + return s2_bytes.bytestr() +} + +fn main() { + lista := ["abracadabra", "seesaw", "pop", "grrrrrr", "up", "a"] + mut puntos := 0 + for palabra in lista { + bs := best_shuffle(palabra) + puntos = 0 + for i := 0; i < palabra.len; i++ { + if palabra[i] == bs[i] { puntos++ } + } + println("$palabra ==> $bs (puntuación: $puntos)") + } +} diff --git a/Task/Best-shuffle/VBScript/best-shuffle.vb b/Task/Best-shuffle/VBScript/best-shuffle.vbs similarity index 100% rename from Task/Best-shuffle/VBScript/best-shuffle.vb rename to Task/Best-shuffle/VBScript/best-shuffle.vbs diff --git a/Task/Best-shuffle/YAMLScript/best-shuffle.ys b/Task/Best-shuffle/YAMLScript/best-shuffle.ys new file mode 100644 index 0000000000..40b2a8e761 --- /dev/null +++ b/Task/Best-shuffle/YAMLScript/best-shuffle.ys @@ -0,0 +1,45 @@ +!YS-v0 + +defn main(*inputs): + each input inputs: !:say + apply format '%s, %s, (%d)': + best-shuffle(input) + +defn best-shuffle(s): + ref =: s:group-indices:cycles + prm =: concat.apply(map(partial(rotate 1) ref)) + ref =: concat(ref*) + + map(vector ref prm): + .sort-by(first _) + .map(second) + .map(partial(get s)) + .str(*) + .call(\([s _ s.score(_)]) _) + +defn score(before after): + map(== before after) + .filter(true?).# + +defn group-indices(s): + map-indexed(vector s) + .merge-vecs({}):vals + .sort-by(count _):reverse + +defn cycles(coll): + n =: coll.0.# + cycle =: range(n):cycle + coll =: concat(coll*) + map(vector coll cycle): + .merge-vecs([]) + +defn rotate(n coll): + c =: coll.# + n =: (c + n) % c + concat coll.drop(n): coll.take(n) + +defn merge-vecs(vecs init): + reduce _ init vecs: + fn(counts [index x]): + assoc counts x: + counts.$x.or([]).conj(index) diff --git a/Task/Bifid-cipher/00-TASK.txt b/Task/Bifid-cipher/00-TASK.txt index 867d98b92f..178c9d6429 100644 --- a/Task/Bifid-cipher/00-TASK.txt +++ b/Task/Bifid-cipher/00-TASK.txt @@ -58,4 +58,3 @@ Suggest a way in which the cipher could be modified so that ALL 26 letters can b ;Related task [[Playfair_cipher|Playfair cipher]]

    - diff --git a/Task/Bifid-cipher/AArch64-Assembly/bifid-cipher.aarch64 b/Task/Bifid-cipher/AArch64-Assembly/bifid-cipher.aarch64 new file mode 100644 index 0000000000..37aa0bd8b0 --- /dev/null +++ b/Task/Bifid-cipher/AArch64-Assembly/bifid-cipher.aarch64 @@ -0,0 +1,394 @@ +/* ARM assembly AARCH64 Raspberry PI 3B */ +/* program bifid64.s */ + +/*******************************************/ +/* Constantes */ +/*******************************************/ +/* for this file see task include a file in language AArch64 assembly*/ +.include "../includeConstantesARM64.inc" + +.equ MESSSIZE, 2000 +.equ BUFFERSIZE, 2000 +/*******************************************/ +/* Macros */ +/*******************************************/ +//.include "../../ficmacros64.inc" // for developer debugging + + +/*******************************************/ +/* Initialized data */ +/*******************************************/ +.data +szMessDebutPgm: .asciz "Program 64 bits start. \n" +szCarriageReturn: .asciz "\n" +szMessFinOK: .asciz "Program normal end. \n" +szMessError: .asciz "\nError Buffer too small!!!\n" +szMessString: .asciz "String :\n" +szMessEncrip: .asciz "\nEncrypted :\n" +szMessDecrip: .asciz "\nDecrypted :\n" +//szString1: .asciz "ABCDEFGHIJKLMNOPQRSTUVWXYZ!.?abcdefghijklmnopqrstuvwxyz" +//szString1: .asciz "attackatdawn" +szString1: .asciz "ATTACKATDAWN" +//szString1: .asciz "ABCD" +szString2: .asciz "FLEEATONCE" +szString3: .asciz "The invasion will start on the first of January" + +szPolybe1: .ascii "ABCDE" + .ascii "FGHIK" + .ascii "LMNOP" + .ascii "QRSTU" + .asciz "VWXYZ" + +szPolybe2: .ascii "BGWKZ" + .ascii "QPNDS" + .ascii "IOAXE" + .ascii "FCLUM" + .asciz "THYVR" + +/*******************************************/ +/* UnInitialized data */ +/*******************************************/ +.bss +.align 4 +tabiposX: .skip 8 * MESSSIZE +tabiposY: .skip 8 * MESSSIZE +sBuffex1: .skip BUFFERSIZE +sBuffex2: .skip BUFFERSIZE +/*******************************************/ +/* code section */ +/*******************************************/ +.text +.global main +main: + ldr x0,qAdrszMessDebutPgm + bl affichageMess + ldr x0,qAdrszMessString // display message + bl affichageMess + ldr x0,qAdrszString1 // display string + bl affichageMess + ldr x0,qAdrszString1 // string address + ldr x1,qAdrszPolybe1 // Polybe key + ldr x2,qAdrsBuffex1 // encrypted buffer result + bl encrypt + cmp x0,#0 + ble 99f + ldr x0,qAdrszMessEncrip + bl affichageMess + ldr x0,qAdrsBuffex1 // display encrypted buffer + bl affichageMess + + + ldr x0,qAdrsBuffex1 // encrypted buffer + ldr x1,qAdrszPolybe1 // Polybe key + ldr x2,qAdrsBuffex2 // decrypted buffer + bl decrypt + ldr x0,qAdrszMessDecrip + bl affichageMess + ldr x0,qAdrsBuffex2 // display decrypted buffer + bl affichageMess + ldr x0,qAdrszCarriageReturn + bl affichageMess + + ldr x0,qAdrszMessString // display message + bl affichageMess + ldr x0,qAdrszString2 // display string + bl affichageMess + ldr x0,qAdrszString2 // string address + ldr x1,qAdrszPolybe2 // Polybe key + ldr x2,qAdrsBuffex1 // encrypted buffer result + bl encrypt + cmp x0,#0 + ble 99f + ldr x0,qAdrszMessEncrip + bl affichageMess + ldr x0,qAdrsBuffex1 // display encrypted buffer + bl affichageMess + + + ldr x0,qAdrsBuffex1 // encrypted buffer + ldr x1,qAdrszPolybe2 // Polybe key + ldr x2,qAdrsBuffex2 // decrypted buffer + bl decrypt + ldr x0,qAdrszMessDecrip + bl affichageMess + ldr x0,qAdrsBuffex2 // display decrypted buffer + bl affichageMess + ldr x0,qAdrszCarriageReturn + bl affichageMess + + ldr x0,qAdrszMessString // display message + bl affichageMess + ldr x0,qAdrszString1 // display string + bl affichageMess + ldr x0,qAdrszString1 // string address + ldr x1,qAdrszPolybe2 // Polybe key + ldr x2,qAdrsBuffex1 // encrypted buffer result + bl encrypt + cmp x0,#0 + ble 99f + ldr x0,qAdrszMessEncrip + bl affichageMess + ldr x0,qAdrsBuffex1 // display encrypted buffer + bl affichageMess + + + ldr x0,qAdrsBuffex1 // encrypted buffer + ldr x1,qAdrszPolybe2 // Polybe key + ldr x2,qAdrsBuffex2 // decrypted buffer + bl decrypt + ldr x0,qAdrszMessDecrip + bl affichageMess + ldr x0,qAdrsBuffex2 // display decrypted buffer + bl affichageMess + ldr x0,qAdrszCarriageReturn + bl affichageMess + + ldr x0,qAdrszMessString // display message + bl affichageMess + ldr x0,qAdrszString3 // display string + bl affichageMess + ldr x0,qAdrszString3 // string address + ldr x1,qAdrszPolybe1 // Polybe key + ldr x2,qAdrsBuffex1 // encrypted buffer result + bl encrypt + cmp x0,#0 + ble 99f + ldr x0,qAdrszMessEncrip + bl affichageMess + ldr x0,qAdrsBuffex1 // display encrypted buffer + bl affichageMess + + + ldr x0,qAdrsBuffex1 // encrypted buffer + ldr x1,qAdrszPolybe1 // Polybe key + ldr x2,qAdrsBuffex2 // decrypted buffer + bl decrypt + ldr x0,qAdrszMessDecrip + bl affichageMess + ldr x0,qAdrsBuffex2 // display decrypted buffer + bl affichageMess + ldr x0,qAdrszCarriageReturn + bl affichageMess + + ldr x0,qAdrszMessFinOK + bl affichageMess + b 100f +99: + ldr x0,qAdrszMessError // error + bl affichageMess + mov x0, #1 +100: // standard end of the program + mov x0, #0 // return code + mov x8,EXIT + svc 0 // perform system call +qAdrszMessString: .quad szMessString +qAdrszMessDecrip: .quad szMessDecrip +qAdrszMessEncrip: .quad szMessEncrip +qAdrszString1: .quad szString1 +qAdrszPolybe1: .quad szPolybe1 +qAdrszString2: .quad szString2 +qAdrszString3: .quad szString3 +qAdrszPolybe2: .quad szPolybe2 +qAdrsBuffex1: .quad sBuffex1 +qAdrsBuffex2: .quad sBuffex2 +qAdrszMessDebutPgm: .quad szMessDebutPgm +qAdrszMessFinOK: .quad szMessFinOK +qAdrszCarriageReturn: .quad szCarriageReturn +qAdrszMessError: .quad szMessError +/******************************************************************/ +/* encrypt strings */ +/******************************************************************/ +/* r0 contains the address of the string1 */ +/* r1 contains Polybe area address +/* r2 contains the address of the encrypted string */ +/* r0 return buffer lenght */ +encrypt: + stp x1,lr,[sp,-16]! // save registers + stp x2,x3,[sp,-16]! // + stp x4,x5,[sp,-16]! // + stp x6,x7,[sp,-16]! // + stp x8,x9,[sp,-16]! // + stp x10,x11,[sp,-16]! // + mov x3,#0 // counter byte string 1 + mov x5,#0 // counter byte buffer +1: + ldrb w7,[x0,x3] // load byte string 1 + cmp x7,#0 // zero final ? + beq 4f + cmp x7,#65 // < A ? + cinc x3,x3,lt + blt 1b + cmp x7,#90 // > Z + ble 2f + + cmp x7,#97 // < a ? + cinc x3,x3,lt + blt 1b + cmp x7,#122 //> z + cinc x3,x3,gt + bgt 1b + sub x7,x7,#32 // convert minuscul to majuscule +2: + mov x11,'I' + cmp x7,#'J' // change J to I + csel x7,x11,x7,eq + ldr x11,qAdrtabiposX + ldr x12,qAdrtabiposY + mov x6,#0 + mov x9,#5 +3: // loop to search char in polybe square + ldrb w8,[x1,x6] // load byte polybe + cmp x8,x7 // equal ? + cinc x6,x6,ne + bne 3b + udiv x10,x6,x9 // compute coordonnés + msub x8,x10,x9,x6 + strb w10,[x11,x5] // save X position + strb w8,[x12,x5] // save Y position + add x5,x5,#1 // increment indice + add x3,x3,#1 + b 1b // and loop + +4: + mov x6,#0 + mov x8,x5 + mov x5,#0 + mov x3,#5 +5: // convert position line 1 in char + ldrb w9,[x11,x6] + add x6,x6,#1 + cmp x6,x8 // first line end ? + csel x6,xzr,x6,ge + bge 7f // jmp for second line + + ldrb w7,[x11,x6] // compute rank with position X and Y + mul x9,x3,x9 + add x9,x9,x7 + ldrb w9,[x1,x9] // load polybe char + strb w9,[x2,x5] + add x5,x5,#1 + + add x6,x6,#1 + cmp x6,x8 + blt 5b + + mov x6,#0 +6: // convert position line 2 in char + ldrb w9,[x12,x6] + add x6,x6,#1 +7: + ldrb w7,[x12,x6] // compute rank with position X and Y + mul x9,x3,x9 + add x9,x9,x7 + ldrb w9,[x1,x9] // load polybe char + strb w9,[x2,x5] + add x5,x5,#1 + add x6,x6,#1 + cmp x6,x8 + blt 6b + + mov x9,#0 // zero final + strb w9,[x2,x5] + mov x0,x5 +100: + ldp x10,x11,[sp],16 // restau registers + ldp x8,x9,[sp],16 // + ldp x6,x7,[sp],16 // + ldp x4,x5,[sp],16 // + ldp x2,x3,[sp],16 // + ldp x1,lr,[sp],16 // + ret +qAdrtabiposX: .quad tabiposX +qAdrtabiposY: .quad tabiposY +/******************************************************************/ +/* decrypt strings */ +/******************************************************************/ +/* r0 contains the address of the encrypted string1 */ +/* r1 contains Polybe area address +/* r2 contains the address of the decrypted string */ +/* r0 return buffer lenght */ +decrypt: + stp x1,lr,[sp,-16]! // save registers + stp x2,x3,[sp,-16]! // + stp x4,x5,[sp,-16]! // + stp x6,x7,[sp,-16]! // + stp x8,x9,[sp,-16]! // + stp x10,x11,[sp,-16]! // + mov x3,#0 // counter byte string 1 + mov x5,#0 // counter byte result buffer +1: + ldrb w7,[x0,x3] // load byte string 1 + cmp x7,#0 // zero final ? + csel x0,x5,x0,eq + beq 4f + + cmp x7,#65 // < A ? + cinc x3,x3,lt + blt 1b + cmp x7,#90 // > Z + ble 2f + + cmp x7,#97 // < a ? + cinc x3,x3,lt + blt 1b + cmp x7,#122 //> z + cinc x3,x3,gt + bgt 1b + sub x7,x7,#32 // convert minuscul to majuscule +2: + ldr x11,qAdrtabiposX + mov x6,#0 + mov x9,#5 +3: // loop to search char in polybe square + ldrb w8,[x1,x6] // load byte polybe + cmp x8,x7 + cinc x6,x6,ne + bne 3b + + udiv x10,x6,x9 + msub x8,x10,x9,x6 + strb w10,[x11,x5] + add x5,x5,#1 + strb w8,[x11,x5] + add x5,x5,#1 + + add x3,x3,#1 + b 1b + +4: + mov x6,#0 // start indice first line + lsr x8,x5,#1 + mov x10,x8 // start indice second line + mov x5,#0 + mov x3,#5 + +5: + ldrb w9,[x11,x6] // load position + ldrb w7,[x11,x10] + mul x9,x3,x9 // compute rank + add x9,x9,x7 + ldrb w9,[x1,x9] // load polybe byte + strb w9,[x2,x5] // and store to result + add x5,x5,#1 + add x10,x10,#1 + add x6,x6,#1 + cmp x6,x8 // end ? + blt 5b + + mov x9,#0 // 0 final + strb w9,[x2,x5] + mov x0,x5 +100: + ldp x10,x11,[sp],16 // restaur registers + ldp x8,x9,[sp],16 // + ldp x6,x7,[sp],16 // + ldp x4,x5,[sp],16 // + ldp x2,x3,[sp],16 // + ldp x1,lr,[sp],16 // + ret + +/***************************************************/ +/* ROUTINES INCLUDE */ +/***************************************************/ +/* for this file see task include a file in language AArch64 assembly*/ +.include "../includeARM64.inc" diff --git a/Task/Bifid-cipher/ALGOL-68/bifid-cipher.alg b/Task/Bifid-cipher/ALGOL-68/bifid-cipher.alg new file mode 100644 index 0000000000..67fdc9f82f --- /dev/null +++ b/Task/Bifid-cipher/ALGOL-68/bifid-cipher.alg @@ -0,0 +1,141 @@ +BEGIN # Bifid cipher # + + # mode to hold the details of a Bifid cipher # + MODE BIFID = STRUCT( STRING key # the Polybius square, linearised # + , STRING pre from # pre-translation, "from" string # + , STRING pre to # pre-tramslatiion "to" string # + ); + + # string utilities # + + # returns the length of s # + OP LENGTH = ( STRING s )INT: ( UPB s - LWB s ) + 1; + # returns the index of c in s, or LWB s - 1 if it is not present # + PRIO INDEXOF = 1; + OP INDEXOF = ( STRING s, CHAR c )INT: + BEGIN + INT index := LWB s - 1; + VOID( char in string( c, index, s ) ); # discard the result # + index + END # INDEXOF # ; + # returns text with the characters in from chars replaced with the # + # corresponding characters in to chars # + PROC translate = ( STRING text, from chars, to chars )STRING: + IF LWB from chars /= LWB to chars OR UPB from chars /= UPB to chars + THEN """from"" and ""to"" have different bounds (translate)" + ELIF from chars = "" + THEN text + ELSE # the from and to strings have the same bounds # + STRING result := text; + FOR r pos FROM LWB result TO UPB result DO + INT t pos = from chars INDEXOF result[ r pos ]; + IF t pos >= LWB from chars THEN result[ r pos ] := to chars[ t pos ] FI + OD; + result + FI # translate # ; + # end string utilities # + + # returns text encrypted according to cipher # + PRIO ENCRYPT = 9; + OP ENCRYPT = ( STRING text, BIFID cipher )STRING: + IF STRING key = ( key OF cipher )[ AT 1 ]; + INT key length = LENGTH key; + INT sq width = ENTIER sqrt( key length ); + sq width * sq width /= key length + THEN "**** Bifid key is not a square" + ELSE # the key is a square # + STRING msg1 = translate( text, pre from OF cipher, pre to OF cipher )[ AT 1 ]; + STRING msg := ""; + FOR m pos FROM LWB msg1 TO UPB msg1 DO + IF msg1[ m pos ] /= " " THEN msg +:= msg1[ m pos ] FI + OD; + INT m max = LENGTH msg; + [ 1 : 2 * m max ]INT coordinates; + FOR m pos TO m max DO + INT c index := key INDEXOF msg[ m pos ]; + IF c index >= LWB key THEN c index -:= 1 FI; + coordinates[ m pos ] := c index OVER sq width; + coordinates[ m pos + m max ] := c index MOD sq width + OD; + STRING result := ""; + FOR c pos BY 2 TO UPB coordinates DO + result +:= key[ ( coordinates[ c pos ] * sq width ) + + coordinates[ c pos + 1 ] + + 1 + ] + OD; + result + FI # ENCRYPT # ; + + # returns text decrypted according to cipher # + PRIO DECRYPT = 9; + OP DECRYPT = ( STRING text, BIFID cipher )STRING: + IF STRING key = ( key OF cipher )[ AT 1 ]; + INT key length = LENGTH key; + INT sq width = ENTIER sqrt( key length ); + sq width * sq width /= key length + THEN "**** Bifid key is not a square" + ELSE # the key is a square # + STRING msg = text[ AT 1 ]; + INT m max = LENGTH msg; + [ 1 : 2 * m max ]INT coordinates; + INT c pos := 0; + FOR m pos TO m max DO + INT c index := key INDEXOF msg[ m pos ]; + IF c index >= LWB key THEN c index -:= 1 FI; + coordinates[ c pos +:= 1 ] := c index OVER sq width; + coordinates[ c pos +:= 1 ] := c index MOD sq width + OD; + STRING result := ""; + FOR i TO m max DO + result +:= key[ ( coordinates[ i ] * sq width ) + + coordinates[ i + m max ] + + 1 + ] + OD; + result + FI # DECRYPT # ; + + # tests the ENCRYPT and DECRYPT operators # + PROC test bifid = ( BIFID cipher, STRING text )VOID: + BEGIN + STRING code = text ENCRYPT cipher; + print( ( text, " -> ", code, newline ) ); + print( ( code, " -> ", code DECRYPT cipher, newline ) ) + END # text bifid # ; + + # Bifid ciphers for tests # + + BIFID bifid 5 abc = ( "ABCDEFGHIKLMNOPQRSTUVWXYZ" + , "Jabcdefghijklmnopqrstuvwxyz" + , "IABCDEFGHIIKLMNOPQRSTUVWXYZ" + ); + BIFID bifid 5 bgw = ( "BGWKZQPNDSIOAXEFCLUMTHYVR" + , "Jabcdefghijklmnopqrstuvwxyz" + , "IABCDEFGHIIKLMNOPQRSTUVWXYZ" + ); + BIFID bifid 6 abc = ( "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + , "abcdefghijklmnopqrstuvwxyz" + , "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + ); + BIFID bifid 8 abc = ( "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\/" + , " " + , "/" + ); + + # basic task - using 5x5 Polybius squares # + test bifid( bifid 5 abc, "ATTACKATDAWN" ); + print( ( newline ) ); + test bifid( bifid 5 bgw, "FLEEATONCE" ); + test bifid( bifid 5 bgw, "ATTACKATDAWN" ); + test bifid( bifid 5 bgw, "The invasion will begin on the first of January" ); + print( ( newline ) ); + + # bonus - using a 6x6 square # + test bifid( bifid 6 abc, "The invasion will begin on the first of January" ); + print( ( newline ) ); + + # bonus - using an 8x8 square # + test bifid( bifid 8 abc, "The invasion will begin on the first of January" ) + +END diff --git a/Task/Bifid-cipher/ARM-Assembly/bifid-cipher.arm b/Task/Bifid-cipher/ARM-Assembly/bifid-cipher.arm new file mode 100644 index 0000000000..f2ce9e6951 --- /dev/null +++ b/Task/Bifid-cipher/ARM-Assembly/bifid-cipher.arm @@ -0,0 +1,376 @@ +/* ARM assembly Raspberry PI */ +/* program bifid.s */ +/* REMARK 1 : this program use routines in a include file + see task Include a file language arm assembly + for the routine affichageMess conversion10 + see at end of this program the instruction include */ + +/*******************************************/ +/* Constantes */ +/*******************************************/ +.include "../constantes.inc" + +.equ MESSSIZE, 2000 +.equ BUFFERSIZE, 2000 +/*******************************************/ +/* Macros */ +/*******************************************/ +//.include "../../ficmacros32.inc" @ for developer debugging + + +/*******************************************/ +/* Initialized data */ +/*******************************************/ +.data +szMessDebutPgm: .asciz "Program 32 bits start. \n" +szCarriageReturn: .asciz "\n" +szMessFinOK: .asciz "Program normal end. \n" +szMessError: .asciz "\nError Buffer too small!!!\n" +szMessString: .asciz "String :\n" +szMessEncrip: .asciz "\nEncrypted :\n" +szMessDecrip: .asciz "\nDecrypted :\n" +//szString1: .asciz "ABCDEFGHIJKLMNOPQRSTUVWXYZ!.?abcdefghijklmnopqrstuvwxyz" +//szString1: .asciz "attackatdawn" +szString1: .asciz "ATTACKATDAWN" +//szString1: .asciz "ABCD" +szString2: .asciz "FLEEATONCE" +szString3: .asciz "L'invasion commencera le premier janvier" + +szPolybe1: .ascii "ABCDE" + .ascii "FGHIK" + .ascii "LMNOP" + .ascii "QRSTU" + .asciz "VWXYZ" + +szPolybe2: .ascii "BGWKZ" + .ascii "QPNDS" + .ascii "IOAXE" + .ascii "FCLUM" + .asciz "THYVR" + +/*******************************************/ +/* UnInitialized data */ +/*******************************************/ +.bss +.align 4 +tabiposX: .skip 4 * MESSSIZE +tabiposY: .skip 4 * MESSSIZE +sBuffer1: .skip BUFFERSIZE +sBuffer2: .skip BUFFERSIZE +/*******************************************/ +/* code section */ +/*******************************************/ +.text +.global main +main: + ldr r0,iAdrszMessDebutPgm + bl affichageMess + ldr r0,iAdrszMessString @ display message + bl affichageMess + ldr r0,iAdrszString1 @ display string + bl affichageMess + ldr r0,iAdrszString1 @ string address + ldr r1,iAdrszPolybe1 @ Polybe key + ldr r2,iAdrsBuffer1 @ encrypted buffer result + bl encrypt + cmp r0,#0 + ble 99f + ldr r0,iAdrszMessEncrip + bl affichageMess + ldr r0,iAdrsBuffer1 @ display encrypted buffer + bl affichageMess + + + ldr r0,iAdrsBuffer1 @ encrypted buffer + ldr r1,iAdrszPolybe1 @ Polybe key + ldr r2,iAdrsBuffer2 @ decrypted buffer + bl decrypt + ldr r0,iAdrszMessDecrip + bl affichageMess + ldr r0,iAdrsBuffer2 @ display decrypted buffer + bl affichageMess + ldr r0,iAdrszCarriageReturn + bl affichageMess + + ldr r0,iAdrszMessString @ display message + bl affichageMess + ldr r0,iAdrszString2 @ display string + bl affichageMess + ldr r0,iAdrszString2 @ string address + ldr r1,iAdrszPolybe2 @ Polybe key + ldr r2,iAdrsBuffer1 @ encrypted buffer result + bl encrypt + cmp r0,#0 + ble 99f + ldr r0,iAdrszMessEncrip + bl affichageMess + ldr r0,iAdrsBuffer1 @ display encrypted buffer + bl affichageMess + + + ldr r0,iAdrsBuffer1 @ encrypted buffer + ldr r1,iAdrszPolybe2 @ Polybe key + ldr r2,iAdrsBuffer2 @ decrypted buffer + bl decrypt + ldr r0,iAdrszMessDecrip + bl affichageMess + ldr r0,iAdrsBuffer2 @ display decrypted buffer + bl affichageMess + ldr r0,iAdrszCarriageReturn + bl affichageMess + + ldr r0,iAdrszMessString @ display message + bl affichageMess + ldr r0,iAdrszString1 @ display string + bl affichageMess + ldr r0,iAdrszString1 @ string address + ldr r1,iAdrszPolybe2 @ Polybe key + ldr r2,iAdrsBuffer1 @ encrypted buffer result + bl encrypt + cmp r0,#0 + ble 99f + ldr r0,iAdrszMessEncrip + bl affichageMess + ldr r0,iAdrsBuffer1 @ display encrypted buffer + bl affichageMess + + + ldr r0,iAdrsBuffer1 @ encrypted buffer + ldr r1,iAdrszPolybe2 @ Polybe key + ldr r2,iAdrsBuffer2 @ decrypted buffer + bl decrypt + ldr r0,iAdrszMessDecrip + bl affichageMess + ldr r0,iAdrsBuffer2 @ display decrypted buffer + bl affichageMess + ldr r0,iAdrszCarriageReturn + bl affichageMess + + ldr r0,iAdrszMessString @ display message + bl affichageMess + ldr r0,iAdrszString3 @ display string + bl affichageMess + ldr r0,iAdrszString3 @ string address + ldr r1,iAdrszPolybe1 @ Polybe key + ldr r2,iAdrsBuffer1 @ encrypted buffer result + bl encrypt + cmp r0,#0 + ble 99f + ldr r0,iAdrszMessEncrip + bl affichageMess + ldr r0,iAdrsBuffer1 @ display encrypted buffer + bl affichageMess + + + ldr r0,iAdrsBuffer1 @ encrypted buffer + ldr r1,iAdrszPolybe1 @ Polybe key + ldr r2,iAdrsBuffer2 @ decrypted buffer + bl decrypt + ldr r0,iAdrszMessDecrip + bl affichageMess + ldr r0,iAdrsBuffer2 @ display decrypted buffer + bl affichageMess + ldr r0,iAdrszCarriageReturn + bl affichageMess + + ldr r0,iAdrszMessFinOK + bl affichageMess + b 100f +99: + ldr r0,iAdrszMessError @ error + bl affichageMess + mov r0, #1 +100: @ standard end of the program + mov r0, #0 @ return code + mov r7, #EXIT @ request to exit program + svc 0 @ perform system call +iAdrszMessString: .int szMessString +iAdrszMessDecrip: .int szMessDecrip +iAdrszMessEncrip: .int szMessEncrip +iAdrszString1: .int szString1 +iAdrszPolybe1: .int szPolybe1 +iAdrszString2: .int szString2 +iAdrszString3: .int szString3 +iAdrszPolybe2: .int szPolybe2 +iAdrsBuffer1: .int sBuffer1 +iAdrsBuffer2: .int sBuffer2 +iAdrszMessDebutPgm: .int szMessDebutPgm +iAdrszMessFinOK: .int szMessFinOK +iAdrszCarriageReturn: .int szCarriageReturn +iAdrszMessError: .int szMessError +/******************************************************************/ +/* encrypt strings */ +/******************************************************************/ +/* r0 contains the address of the string1 */ +/* r1 contains Polybe area address +/* r2 contains the address of the encrypted string */ +/* r0 return buffer lenght */ +encrypt: + push {r3-r12,lr} @ save registers + mov r3,#0 @ counter byte string 1 + mov r5,#0 @ counter byte buffer + +1: + ldrb r7,[r0,r3] @ load byte string 1 + cmp r7,#0 @ zero final ? + beq 4f + cmp r7,#65 @ < A ? + addlt r3,#1 + blt 1b + cmp r7,#90 @ > Z + ble 2f + + cmp r7,#97 @ < a ? + addlt r3,#1 + blt 1b + cmp r7,#122 @> z + addgt r3,#1 + bgt 1b + sub r7,#32 @ convert minuscul to majuscule +2: + cmp r7,#'J' @ change J to I + moveq r7,#'I' + ldr r11,iAdrtabiposX + ldr r12,iAdrtabiposY + mov r6,#0 + mov r9,#5 +3: @ loop to search char in polybe square + ldrb r8,[r1,r6] @ load byte polybe + cmp r8,r7 @ equal ? + addne r6,#1 + bne 3b + udiv r10,r6,r9 @ compute coordonnés + mls r8,r10,r9,r6 + + strb r10,[r11,r5] @ save X position + strb r8,[r12,r5] @ save Y position + add r5,r5,#1 @ increment indice + add r3,r3,#1 + b 1b @ and loop + +4: + mov r6,#0 + mov r8,r5 + mov r5,#0 + mov r3,#5 +5: @ convert position line 1 in char + ldrb r9,[r11,r6] + add r6,r6,#1 + cmp r6,r8 @ first line end ? + movge r6,#0 + bge 7f @ jmp for second line + + ldrb r7,[r11,r6] @ compute rank with position X and Y + mul r9,r3,r9 + add r9,r9,r7 + ldrb r9,[r1,r9] @ load polybe char + strb r9,[r2,r5] + add r5,r5,#1 + + add r6,r6,#1 + cmp r6,r8 + blt 5b + + mov r6,#0 +6: @ convert position line 2 in char + ldrb r9,[r12,r6] + add r6,r6,#1 +7: + ldrb r7,[r12,r6] @ compute rank with position X and Y + mul r9,r3,r9 + add r9,r9,r7 + ldrb r9,[r1,r9] @ load polybe char + strb r9,[r2,r5] + add r5,r5,#1 + add r6,r6,#1 + cmp r6,r8 + blt 6b + + mov r9,#0 @ zero final + strb r9,[r2,r5] + mov r0,r5 +100: + pop {r3-r12,pc} @ restaur registers +iAdrtabiposX: .int tabiposX +iAdrtabiposY: .int tabiposY +/******************************************************************/ +/* decrypt strings */ +/******************************************************************/ +/* r0 contains the address of the encrypted string1 */ +/* r1 contains Polybe area address +/* r2 contains the address of the decrypted string */ +/* r0 return buffer lenght */ +decrypt: + push {r3-r11,lr} @ save registers + mov r3,#0 @ counter byte string 1 + mov r5,#0 @ counter byte result buffer +1: + ldrb r7,[r0,r3] @ load byte string 1 + cmp r7,#0 @ zero final ? + moveq r0,r5 + beq 4f + + cmp r7,#65 @ < A ? + addlt r3,#1 + blt 1b + cmp r7,#90 @ > Z + ble 2f + + cmp r7,#97 @ < a ? + addlt r3,#1 + blt 1b + cmp r7,#122 @> z + addgt r3,#1 + bgt 1b + sub r7,#32 @ convert minuscul to majuscule +2: + ldr r11,iAdrtabiposX + mov r6,#0 + mov r9,#5 +3: @ loop to search char in polybe square + ldrb r8,[r1,r6] @ load byte polybe + cmp r8,r7 + addne r6,#1 + bne 3b + + udiv r10,r6,r9 + mls r8,r10,r9,r6 + strb r10,[r11,r5] + add r5,r5,#1 + strb r8,[r11,r5] + add r5,r5,#1 + + add r3,#1 + b 1b + +4: + mov r6,#0 @ start indice first line + lsr r8,r5,#1 + mov r10,r8 @ start indice second line + mov r5,#0 + mov r3,#5 + +5: + ldrb r9,[r11,r6] @ load position + ldrb r7,[r11,r10] + mul r9,r3,r9 @ compute rank + add r9,r9,r7 + ldrb r9,[r1,r9] @ load polybe byte + strb r9,[r2,r5] @ and store to result + add r5,r5,#1 + add r10,r10,#1 + add r6,r6,#1 + cmp r6,r8 @ end ? + blt 5b + + mov r9,#0 @ 0 final + strb r9,[r2,r5] + mov r0,r5 +100: + pop {r3-r11,pc} @ restaur registers + + +/***************************************************/ +/* ROUTINES INCLUDE */ +/***************************************************/ +.include "../affichage.inc" diff --git a/Task/Bifid-cipher/Ada/bifid-cipher.ada b/Task/Bifid-cipher/Ada/bifid-cipher.adb similarity index 100% rename from Task/Bifid-cipher/Ada/bifid-cipher.ada rename to Task/Bifid-cipher/Ada/bifid-cipher.adb diff --git a/Task/Bifid-cipher/C++/bifid-cipher.cpp b/Task/Bifid-cipher/C++/bifid-cipher.cpp index 0e93a81f8a..411515802a 100644 --- a/Task/Bifid-cipher/C++/bifid-cipher.cpp +++ b/Task/Bifid-cipher/C++/bifid-cipher.cpp @@ -9,104 +9,104 @@ typedef std::pair point; class Bifid { public: - Bifid(const int32_t n, std::string_view text) { - if ( text.length() != n * n ) { - throw std::invalid_argument("Incorrect length of text"); - } + Bifid(const int32_t n, std::string_view text) { + if ( text.length() != n * n ) { + throw std::invalid_argument("Incorrect length of text"); + } - grid.resize(n); - for ( uint64_t i = 0; i < grid.size(); i++ ) { - grid[i].resize(n); - } + grid.resize(n); + for ( uint64_t i = 0; i < grid.size(); i++ ) { + grid[i].resize(n); + } - int32_t row = 0; - int32_t col = 0; - for ( const char& ch : text ) { - grid[row][col] = ch; - coordinates[ch] = point(row, col); - col += 1; - if ( col == n ) { - col = 0; - row += 1; - } - } + int32_t row = 0; + int32_t col = 0; + for ( const char& ch : text ) { + grid[row][col] = ch; + coordinates[ch] = point(row, col); + col += 1; + if ( col == n ) { + col = 0; + row += 1; + } + } - if ( n == 5 ) { - coordinates['J'] = coordinates['I']; - } - } + if ( n == 5 ) { + coordinates['J'] = coordinates['I']; + } + } - std::string encrypt(std::string_view text) { - std::vector row_one, row_two; - for ( const char& ch : text ) { - point coordinate = coordinates[ch]; - row_one.push_back(coordinate.first); - row_two.push_back(coordinate.second); - } + std::string encrypt(std::string_view text) { + std::vector row_one, row_two; + for ( const char& ch : text ) { + point coordinate = coordinates[ch]; + row_one.push_back(coordinate.first); + row_two.push_back(coordinate.second); + } - row_one.insert(row_one.end(), row_two.begin(), row_two.end()); - std::string result; - for ( uint64_t i = 0; i < row_one.size() - 1; i += 2 ) { - result += grid[row_one[i]][row_one[i + 1]]; - } - return result; - } + row_one.insert(row_one.end(), row_two.begin(), row_two.end()); + std::string result; + for ( uint64_t i = 0; i < row_one.size() - 1; i += 2 ) { + result += grid[row_one[i]][row_one[i + 1]]; + } + return result; + } - std::string decrypt(std::string_view text) { - std::vector row; - for ( const char& ch : text ) { - point coordinate = coordinates[ch]; - row.push_back(coordinate.first); - row.push_back(coordinate.second); - } + std::string decrypt(std::string_view text) { + std::vector row; + for ( const char& ch : text ) { + point coordinate = coordinates[ch]; + row.push_back(coordinate.first); + row.push_back(coordinate.second); + } - const int middle = row.size() / 2; - std::vector row_one = { row.begin(), row.begin() + middle }; - std::vector row_two = { row.begin() + middle, row.end() }; - std::string result; - for ( int32_t i = 0; i < middle; i++ ) { - result += grid[row_one[i]][row_two[i]]; - } - return result; - } + const int middle = row.size() / 2; + std::vector row_one = { row.begin(), row.begin() + middle }; + std::vector row_two = { row.begin() + middle, row.end() }; + std::string result; + for ( int32_t i = 0; i < middle; i++ ) { + result += grid[row_one[i]][row_two[i]]; + } + return result; + } - void display() const { - for ( const std::vector& row : grid ) { - for ( const char& ch : row ) { - std::cout << ch << " "; - } - std::cout << std::endl; - } - } + void display() const { + for ( const std::vector& row : grid ) { + for ( const char& ch : row ) { + std::cout << ch << " "; + } + std::cout << std::endl; + } + } private: - std::vector> grid; - std::unordered_map coordinates; + std::vector> grid; + std::unordered_map coordinates; }; void runTest(Bifid& bifid, std::string_view message) { - std::cout << "Using Polybius square:" << std::endl; - bifid.display(); - std::cout << "Message: " << message << std::endl; - std::string encrypted = bifid.encrypt(message); - std::cout << "Encrypted: " << encrypted << std::endl; - std::string decrypted = bifid.decrypt(encrypted); - std::cout << "Decrypted: " << decrypted << std::endl; - std::cout << std::endl; + std::cout << "Using Polybius square:" << std::endl; + bifid.display(); + std::cout << "Message: " << message << std::endl; + std::string encrypted = bifid.encrypt(message); + std::cout << "Encrypted: " << encrypted << std::endl; + std::string decrypted = bifid.decrypt(encrypted); + std::cout << "Decrypted: " << decrypted << std::endl; + std::cout << std::endl; } int main() { - const std::string_view message1 = "ATTACKATDAWN"; - const std::string_view message2 = "FLEEATONCE"; - const std::string_view message3 = "THEINVASIONWILLSTARTONTHEFIRSTOFJANUARY"; + const std::string_view message1 = "ATTACKATDAWN"; + const std::string_view message2 = "FLEEATONCE"; + const std::string_view message3 = "THEINVASIONWILLSTARTONTHEFIRSTOFJANUARY"; - Bifid bifid1(5, "ABCDEFGHIKLMNOPQRSTUVWXYZ"); - Bifid bifid2(5, "BGWKZQPNDSIOAXEFCLUMTHYVR"); + Bifid bifid1(5, "ABCDEFGHIKLMNOPQRSTUVWXYZ"); + Bifid bifid2(5, "BGWKZQPNDSIOAXEFCLUMTHYVR"); - runTest(bifid1, message1); - runTest(bifid2, message2); - runTest(bifid2, message1); - runTest(bifid1, message2); + runTest(bifid1, message1); + runTest(bifid2, message2); + runTest(bifid2, message1); + runTest(bifid1, message2); - Bifid bifid3(6, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); - runTest(bifid3, message3); + Bifid bifid3(6, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); + runTest(bifid3, message3); } diff --git a/Task/Bifid-cipher/C-sharp/bifid-cipher.cs b/Task/Bifid-cipher/C-sharp/bifid-cipher.cs new file mode 100644 index 0000000000..c00f4074d4 --- /dev/null +++ b/Task/Bifid-cipher/C-sharp/bifid-cipher.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Drawing; + +public class BifidCipher +{ + public static void Main(string[] args) + { + string message1 = "ATTACKATDAWN"; + string message2 = "FLEEATONCE"; + string message3 = "The invasion will start on the first of January".ToUpper().Replace(" ", ""); + + Bifid bifid1 = new Bifid(5, "ABCDEFGHIKLMNOPQRSTUVWXYZ"); + Bifid bifid2 = new Bifid(5, "BGWKZQPNDSIOAXEFCLUMTHYVR"); + + RunTest(bifid1, message1); + RunTest(bifid2, message2); + RunTest(bifid2, message1); + RunTest(bifid1, message2); + + Bifid bifid3 = new Bifid(6, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); + RunTest(bifid3, message3); + } + + private static void RunTest(Bifid bifid, string message) + { + Console.WriteLine("Using Polybius square:"); + bifid.Display(); + Console.WriteLine("Message: " + message); + string encrypted = bifid.Encrypt(message); + Console.WriteLine("Encrypted: " + encrypted); + string decrypted = bifid.Decrypt(encrypted); + Console.WriteLine("Decrypted: " + decrypted); + Console.WriteLine(); + } +} + +public class Bifid +{ + private char[,] grid; + private Dictionary coordinates = new Dictionary(); + + public Bifid(int n, string text) + { + if (text.Length != n * n) + { + throw new ArgumentException("Incorrect length of text"); + } + + grid = new char[n, n]; + int row = 0; + int col = 0; + + foreach (char ch in text) + { + grid[row, col] = ch; + coordinates[ch] = new Point(row, col); + col += 1; + if (col == n) + { + col = 0; + row += 1; + } + } + + if (n == 5) + { + coordinates['J'] = coordinates['I']; + } + } + + public string Encrypt(string text) + { + List rowOne = new List(); + List rowTwo = new List(); + + foreach (char ch in text) + { + Point coordinate = coordinates[ch]; + rowOne.Add(coordinate.X); + rowTwo.Add(coordinate.Y); + } + + rowOne.AddRange(rowTwo); + var result = new System.Text.StringBuilder(); + + for (int i = 0; i < rowOne.Count - 1; i += 2) + { + result.Append(grid[rowOne[i], rowOne[i + 1]]); + } + + return result.ToString(); + } + + public string Decrypt(string text) + { + List row = new List(); + + foreach (char ch in text) + { + Point coordinate = coordinates[ch]; + row.Add(coordinate.X); + row.Add(coordinate.Y); + } + + int middle = row.Count / 2; + List rowOne = row.GetRange(0, middle); + List rowTwo = row.GetRange(middle, row.Count - middle); + var result = new System.Text.StringBuilder(); + + for (int i = 0; i < middle; i++) + { + result.Append(grid[rowOne[i], rowTwo[i]]); + } + + return result.ToString(); + } + + public void Display() + { + for (int i = 0; i < grid.GetLength(0); i++) + { + for (int j = 0; j < grid.GetLength(1); j++) + { + Console.Write(grid[i, j] + " "); + } + Console.WriteLine(); + } + } +} diff --git a/Task/Bifid-cipher/Crystal/bifid-cipher.cr b/Task/Bifid-cipher/Crystal/bifid-cipher.cr new file mode 100644 index 0000000000..ce327b9dfa --- /dev/null +++ b/Task/Bifid-cipher/Crystal/bifid-cipher.cr @@ -0,0 +1,46 @@ +enum BifidOp + Encode + Decode +end + +def bifid_encode (message, alphabet, op : BifidOp = :encode) + square = alphabet.chars + side = Math.isqrt(square.size) + raise "alphabet not a square" unless side*side == square.size + chars = message.chars + raise "incomplete alphabet" unless chars.all?(&.in? square) + + coords = chars.flat_map {|ch| [*square.index!(ch).divmod(side)] } + + coords = if op.encode? + (0...coords.size).step(2).map {|i| coords[i] }.to_a + + (1...coords.size).step(2).map {|i| coords[i] }.to_a + else + half = coords.size//2 + coords[...half].zip(coords[half..]).map {|c1, c2| + [c1, c2] + }.flatten + end + coords.each_slice(2).map {|(row, col)| + square[row * side + col] + }.join +end + +poly1 = "ABCDEFGHIKLMNOPQRSTUVWXYZ" +poly2 = "BGWKZQPNDSIOAXEFCLUMTHYVR" +superpoly = (' '..'~').join + "¡éßñø" + +attack = "ATTACKATDAWN" +flee = "FLEEATONCE" +invasion = "The invasion will start on the first of January".upcase.tr("J", "I").delete("^A-Z") +ataque = "¡Attack on 1/1 at 23:59, señor!" + +[{attack, poly1}, {flee, poly2}, {attack, poly2}, + {invasion, poly1}, {ataque, superpoly}].each do |message, alphabet| + encoded = bifid_encode(message, alphabet) + decoded = bifid_encode(encoded, alphabet, :decode) + puts "Message: #{message} #{alphabet.size > 80 ? "\n" : " "}- Alphabet: #{alphabet}" + puts "Encoded: #{encoded}" + puts "Decoded: #{decoded}" + puts +end diff --git a/Task/Bifid-cipher/EMal/bifid-cipher.emal b/Task/Bifid-cipher/EMal/bifid-cipher.emal new file mode 100644 index 0000000000..786b4e3400 --- /dev/null +++ b/Task/Bifid-cipher/EMal/bifid-cipher.emal @@ -0,0 +1,82 @@ +type PolybiusSquare +model + Map map + List grid + new by int side, text symbols + me.map ← text%Pair[] + me.grid ← List[].with(side, = 97 + h -= 32 + . + if h >= 65 and h <= 91 + if h = 74 + h = 73 + . + r$ &= strchar h + . + . + swap s$ r$ +. +func$ encr msg$ key$ . + prepare msg$ + len h[] len msg$ * 2 + for i to len msg$ + c$ = substr msg$ i 1 + j = strpos key$ c$ - 1 + h[i] = j div 5 + h[len msg$ + i] = j mod 5 + . + for i = 1 step 2 to len h[] - 1 + j = h[i] * 5 + h[i + 1] + 1 + r$ &= substr key$ j 1 + . + return r$ +. +func$ decr msg$ key$ . + for i to len msg$ + c$ = substr msg$ i 1 + j = strpos key$ c$ - 1 + h[] &= j div 5 + h[] &= j mod 5 + . + mid = len h[] div 2 + for i = 1 to mid + j = h[i] * 5 + h[i + mid] + 1 + r$ &= substr key$ j 1 + . + return r$ +. +key$ = "ABCDEFGHIKLMNOPQRSTUVWXYZ" +h$ = encr "ATTACKATDAWN" key$ +print h$ +print decr h$ key$ +print "" +# +key$ = "BGWKZQPNDSIOAXEFCLUMTHYVR" +h$ = encr "FLEEATONCE" key$ +print h$ +print decr h$ key$ +print "" +h$ = encr "ATTACKATDAWN" key$ +print h$ +print decr h$ key$ +print "" +h$ = encr "The invasion will start on the first of January" key$ +print h$ +print decr h$ key$ diff --git a/Task/Bifid-cipher/F-Sharp/bifid-cipher.fs b/Task/Bifid-cipher/F-Sharp/bifid-cipher.fs new file mode 100644 index 0000000000..50904e931d --- /dev/null +++ b/Task/Bifid-cipher/F-Sharp/bifid-cipher.fs @@ -0,0 +1,17 @@ +// Bifid cipher. Nigel Galloway: September 17th., 2024 +let polybius alphabet n g=let ng=Seq.allPairs [1..n] [1..g] in (Seq.zip ng alphabet|>Map.ofSeq,Seq.zip alphabet ng|>Map.ofSeq) +let fN (i,g) (e:Map<(int*int),char>)=i@g|>List.chunkBySize 2|>List.map(fun n->e[(n[0],n[1])])|>Array.ofList|>System.String +let fG (n:Map) g=g|>Seq.map(fun g->n[g])|>List.ofSeq|>List.unzip +let encrypt (n:Map<(int * int),char>,g:Map) text=fN (fG g text) n +let decrypt (n:Map<(int * int),char>,g:Map) text= + let p,q=let p,q=fG g text in List.map2(fun p q->[p;q]) p q|>List.concat|>List.splitAt p.Length + List.zip p q |>List.map(fun g->n[g])|>Array.ofList|>System.String + +let p1=polybius "abcdefghiklmnopqrstuvwxyz" 5 5 +let s="attackatdawn" in let e=encrypt p1 s in printfn $"%s{s} -> %s{e} -> %s{decrypt p1 e}" +let s="fleeatonce" in let e=encrypt p1 s in printfn $"%s{s} -> %s{e} -> %s{decrypt p1 e}" +let p2=polybius "bgwkzqpndsioaxefclumthyvr" 5 5 +let s="attackatdawn" in let e=encrypt p2 s in printfn $"%s{s} -> %s{e} -> %s{decrypt p2 e}" +let s="fleeatonce" in let e=encrypt p2 s in printfn $"%s{s} -> %s{e} -> %s{decrypt p2 e}" +let p3=polybius "abcdefghijklmnopqrstuvwxyz0123456789" 6 6 +let s="theinvasionwillstarton1january2025" in let e=encrypt p3 s in printfn $"%s{s} -> %s{e} -> %s{decrypt p3 e}" diff --git a/Task/Bifid-cipher/Fortran/bifid-cipher.f b/Task/Bifid-cipher/Fortran/bifid-cipher.f new file mode 100644 index 0000000000..4d804626f9 --- /dev/null +++ b/Task/Bifid-cipher/Fortran/bifid-cipher.f @@ -0,0 +1,219 @@ +! +! Bifid cipher +! tested with Intel ifx (IFX) 2025.2.1 20250806 on Kubuntu 25.10 +! GNU Fortran (Ubuntu 15.2.0-4ubuntu4) 15.2.0 on Kubuntu 25.10 +! VSI Fortran x86-64 V8.6-001 on OpenVMS x86_64 V9.2-3 +! No Non-standard features used, should compile on any fairly recent Fortran. +! +! U.B., October 2025 +!============================================================================== + +program BifidCipher + +implicit none + +! Constants: + +integer, parameter :: nTests = 6 ! NUmber of different test messages +integer, parameter :: maxLen=100 ! Maximum length of any test message + +! Instead of drawing the Polybius squares, we only define the alphabet to applied and calculate +! row and column number on the fly when needed. +! If necessary, the Encrypt and Decrypt subroutines extend the alphabets using "SpareAlpha" +! until the total length of the extended alphabet is a square number. This is important because +! otherwise the enccrypt or decrypt algorithm may calculate a row/column combination that is +! not used by the actual alphabet. + +! The alphabet as shown in the task description has no J. +character (len=*), parameter :: Alphabet_no_J ='ABCDEFGHIKLMNOPQRSTUVWXYZ' + +! The alphabet of capital letters as used in most western languages +character (len=*), parameter :: Alphabet_With_J ='ABCDEFGHIJKLMNOPQRSTUVWXYZ' + +! The square in the wikipedia article in 1 long string: +character (len=*), parameter :: AlternateAlphabet = 'BGWKZQPNDSIOAXEFCLUMTHYVR' + +! Standard Alphabet with CAPITAL and small letters +character (len=*), parameter :: Alphabet_withSmallLetters = & + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' + +! Printable spare characters to extend alphabets so the total length becomes the +! next larger square number > the alphabet's length +character (len=*), parameter :: SpareAlpha = '1234567890!"§$%&/()=' ! omitted ! and " + +! Variables: + +character (len=maxLen) :: MsgToEncrypt (nTests), EncryptedMsg (nTests), DecryptedMsg (nTests) + +integer :: ColWidth ! Is variable and depends on length of the used alphabet + +integer :: i, lx + +! The test strings: (1) is from the task description, (2) is from the Wikipedia Article, (3) is +! the additional message as presented in the task description +MsgToEncrypt(1) = 'ATTACKATDAWN' +MsgToEncrypt(2) = 'FLEEATONCE' +MsgToEncrypt(3) = 'THEINVASIONWILLSTARTONTHEFIRSTOFJANUARY' + +! Same text, with both small and capital letters, to be used with an extended Polybius square +MsgToEncrypt(4) = 'AttackAtDawn' +MsgToEncrypt(5) = 'FleeAtOnce' +MsgToEncrypt(6) = 'TheInvasionWillStartOnTheFirstOfJanuary' + +print '(A/)', 'Using the alphabet and Polybius square without "J"' +call PrintSquare (Alphabet_no_J) +do i=1, nTests/2 + lx = len_trim (MsgToEncrypt(i)) + call encrypt (MsgToEncrypt(i)(:lx) , EncryptedMsg (i) , Alphabet_no_J) + call decrypt (EncryptedMsg(i) (:lx), DecryptedMsg (i) , Alphabet_no_J) + print '(A, " => ", A, " => ", A)', MsgToEncrypt(i)(:lx), EncryptedMsg (i)(:lx), DecryptedMsg (i)(:lx) +enddo + +print '(/A/)', 'Using the extended alphabet and Polybius square that includes "J"' +call PrintSquare (Alphabet_with_J) +do i=1, nTests/2 + lx = len_trim (MsgToEncrypt(i)) + call encrypt (MsgToEncrypt(i)(:lx) , EncryptedMsg (i) , Alphabet_with_J) + call decrypt (EncryptedMsg(i) (:lx), DecryptedMsg (i) , Alphabet_with_J) + print '(A, " => ", A, " => ", A)', MsgToEncrypt(i)(:lx), EncryptedMsg (i)(:lx), DecryptedMsg (i)(:lx) +end do + +print '(/A/)', 'Using the alphabet and Polybius square as shown in the Wikipedia article (no J!)' +call PrintSquare (AlternateAlphabet) +do i=1, nTests/2 + lx = len_trim (MsgToEncrypt(i)) + call encrypt (MsgToEncrypt(i)(:lx) , EncryptedMsg (i) , AlternateAlphabet) + call decrypt (EncryptedMsg(i) (:lx), DecryptedMsg (i) , AlternateAlphabet) + print '(A, " => ", A, " => ", A)', MsgToEncrypt(i)(:lx), EncryptedMsg (i)(:lx), DecryptedMsg (i)(:lx) +end do + +print '(/A/)', 'Using the extended alphabet with both upper case and lower case letters, including J and j' +call PrintSquare (Alphabet_withSmallLetters) +do i=nTests/2+1, nTests + lx = len_trim (MsgToEncrypt(i)) + call encrypt (MsgToEncrypt(i)(:lx) , EncryptedMsg (i) , Alphabet_withSmallLetters) + call decrypt (EncryptedMsg(i) (:lx), DecryptedMsg (i) , Alphabet_withSmallLetters) + print '(A, " => ", A, " => ", A)', MsgToEncrypt(i)(:lx), EncryptedMsg (i)(:lx), DecryptedMsg (i)(:lx) +end do + +contains + +!====================== +! Encode a given string +! ====================== +subroutine encrypt (inString,outString, argAlphabet) +character (len=*), intent(in) :: argAlphabet +character (len=*), intent(in) :: inString +character (len=*), intent(out) :: outString +character (len=100) :: Alphabet + +integer :: idxLine(2*maxLen) +integer :: l, ii, idx, row, col + +! Calculate required column width: so that ColWidth^2 >= (length of Alphabet) +Alphabet = argAlphabet +l = len_trim(alphabet) +ColWidth = 1 +do while (ColWidth*ColWidth .lt. l) + ColWidth = ColWidth + 1 +end do +if (ColWidth .gt.8) stop 'ERROR: Cannot handle Alphabets with more than 64 characters.' +! Provide some printable chars until the length is a square number +Alphabet (l+1:) = SpareAlpha + +l = len_trim (inString) +if (l .gt. len(outString)) stop 'ERROR: not enough storage space for encrypt result string.' + +do ii=1, l +! print *, ' ii = ', ii, ' instring(ii) = ', inString(ii:ii) + idx = index (Alphabet, inString(ii:ii)) + if (idx .eq. 0) idx = index (Alphabet, char(ichar(instring(ii:ii))-1)) ! J=I, j=i, just in case + row = (idx+ColWidth-1) / ColWidth ! e.g. 'A' ...'E', idx=1...5, row=(5...9)/5 = 1, col = 1...5 + col = 1+mod (idx+ColWidth-1, ColWidth) ! e.g. 'F' ...'K', idx=6...10, row=(10...14)/5 = 2, col = 1...5 + idxLine (ii) = row + idxLine (ii+l) = col +end do + +do ii=1, l + idx = 10*idxLine(1+2*(ii-1)) + idxLine (2+2*(ii-1)) + row = idxLine(1+2*(ii-1)) + col = idxLine (2+2*(ii-1)) + idx = ColWidth*(row-1) + col + outString (ii:ii) = alphabet (idx:idx) +enddo +end subroutine encrypt + + +!====================== +! Decode a given string +!====================== +subroutine decrypt (inString,outString, argAlphabet) + +character (len=*), intent(in) :: inString +character (len=*), intent(out) :: outString +character (len=*), intent(in) :: argAlphabet + +character (len=100) :: Alphabet + +integer :: idxLine(2*maxLen) +integer :: l, ii, idx, row, col + +! Calculate required column width: so that ColWidth^2 >= (length of Alphabet) +Alphabet = argAlphabet +l = len_trim(alphabet) +ColWidth = 1 +do while (ColWidth*ColWidth .lt. l) + ColWidth = ColWidth + 1 +end do + +! Append some spare characters so that the square is completely filled without undefined fields +Alphabet (l+1:) = SpareAlpha + +l = len_trim (inString) +if (l .gt. len(outString)) stop 'ERROR: not enough storage space for decrypt result string.' + +do ii=1, l + idx = index (Alphabet, inString(ii:ii)) + row = (idx+ColWidth-1) / ColWidth ! idx 1...5 is row 1, 6...10 is row 2 etc + col = 1+mod (idx+ColWidth-1, ColWidth) ! so that 21...29 -> 1...9 etc. + idxLine (1+2*(ii-1)) = row + idxLine (2+2*(ii-1)) = col +end do + +do ii=1, l + row = idxLine (ii) + col = idxLine (ii+l) + idx = ColWidth*(row-1) + col + outString (ii:ii) = alphabet (idx:idx) +end do + +end subroutine decrypt + + +! ================================================================================ +! Print the resulting Polybius square based on the alphabet used for encode/decode +! ================================================================================ +subroutine PrintSquare (Alphabet) +character (len=*), intent(in) :: Alphabet +integer:: ii, l + +l = len_trim(alphabet) +ColWidth = 1 +do while (ColWidth*ColWidth .lt. l) + ColWidth = ColWidth + 1 +end do +print '("The alphabet has a length of ", I0, " so it requires the square size of ", I0, "x", I0 /)' , l, ColWidth, ColWidth + +do ii=1, ColWidth*ColWidth + if (ii .le. l) then + write (*, '(A2)', advance='no') Alphabet(ii:ii) + else + write (*, '(A2)', advance='no') SpareAlpha (ii-l:ii-l) ! Use spares to complete the square + endif + if (mod (ii, ColWidth) .eq. 0) print * ! End of line +end do +print * ! one extra blank line +end subroutine PrintSquare + + +end program BifidCipher diff --git a/Task/Bifid-cipher/FreeBASIC/bifid-cipher.basic b/Task/Bifid-cipher/FreeBASIC/bifid-cipher.basic new file mode 100644 index 0000000000..67b6e9ffad --- /dev/null +++ b/Task/Bifid-cipher/FreeBASIC/bifid-cipher.basic @@ -0,0 +1,81 @@ +Dim Shared As String encrypted, decrypted + +Sub BifidEncode(Byref polybius As String, Byref mensaje As String) + Dim As String filas, columas + Dim As Integer c, i, j, k, longi + + encrypted = Ucase(mensaje) + For i = 1 To Len(encrypted) + If Mid(encrypted, i, 1) = Chr(10) Then Mid(encrypted, i, 1) = Chr(9) + Next i + + + i = 0 : j = 0 + While i < Len(encrypted) + c = Asc(Mid(encrypted, i + 1, 1)) + i += 1 + k = Instr(polybius, Chr(c)) - 1 + If k >= 0 Then + filas &= Chr(k \ 5 + Asc("0")) + columas &= Chr(k Mod 5 + Asc("0")) + j += 1 + End If + Wend + + longi = j + filas &= columas + + encrypted = "" + For i = 0 To longi - 1 + k = (Asc(Mid(filas, i * 2 + 1, 1)) - Asc("0")) * 5 + (Asc(Mid(filas, i * 2 + 2, 1)) - Asc("0")) + encrypted &= Mid(polybius, k + 1, 1) + Next i +End Sub + +Sub BifidDecode(Byref polybius As String, Byref mensaje As String) + Dim As String filas, columas + Dim As Integer c, k, i, j, longi + + i = 0 : j = 0 + While i < Len(mensaje) + c = Asc(Mid(mensaje, i + 1, 1)) + i += 1 + k = Instr(polybius, Chr(c)) - 1 + filas &= Chr(k \ 5 + Asc("0")) + filas &= Chr(k Mod 5 + Asc("0")) + j += 2 + Wend + + longi = i + columas = Right(filas, longi) + filas = Left(filas, longi) + + decrypted = "" + For i = 0 To longi - 1 + k = (Asc(Mid(filas, i + 1, 1)) - Asc("0")) * 5 + (Asc(Mid(columas, i + 1, 1)) - Asc("0")) + decrypted &= Mid(polybius, k + 1, 1) + Next i +End Sub + +Dim As String polys(3), msgs(3) + +polys(0) = "ABCDEFGHIKLMNOPQRSTUVWXYZ" +polys(1) = "BGWKZQPNDSIOAXEFCLUMTHYVR" +polys(2) = "BGWKZQPNDSIOAXEFCLUMTHYVR" +polys(3) = "PLAYFIREXMBCDGHKNOQSTUVWZ" + +msgs(0) = "ATTACKATDAWN" +msgs(1) = "FLEEATONCE" +msgs(2) = "ATTACKATDAWN" +msgs(3) = "The invasion will start on the first of January" + +For i As Integer = 0 To Ubound(msgs) + BifidEncode(polys(i), msgs(i)) + BifidDecode(polys(i), encrypted) + Print "Mensaje : "; msgs(i) + Print "Encrypted : "; encrypted + Print "Decrypted : "; decrypted + If i < Ubound(msgs) Then Print +Next i + +Sleep diff --git a/Task/Bifid-cipher/FutureBasic/bifid-cipher.basic b/Task/Bifid-cipher/FutureBasic/bifid-cipher.basic new file mode 100644 index 0000000000..e6b2e686af --- /dev/null +++ b/Task/Bifid-cipher/FutureBasic/bifid-cipher.basic @@ -0,0 +1,62 @@ +clear local fn recode( t as CFStringRef, code as CFStringRef ) as CFStringRef + CFStringRef s = @"" + Short i, k, w = sqr( len( code ) ) + + for i = 0 to len( t ) - 1 step 2 + k = intval( mid( t, i, 2 ) ) // Get ‘coordinates’ of char in code string + k = w * ( k / 10 ) + k mod 10 + s = fn StringByAppendingString( s, mid( code, k, 1 ) ) + next + +end fn = s + +// + +clear local fn encode( s as CFStringRef, code as CFStringRef ) as CFStringRef + CFStringRef a = @"", b = @"", c + Short i, k, w = sqr( len( code ) ) + if w == 5 then s = fn StringByReplacingOccurrencesOfString( s, @"J", @"I" ) + print s + + for i = 0 to len( s ) - 1 + c = mid( s, i, 1 ) + k = instr( 0, code, c ) // Put row in one string, column in the other + a = fn StringByAppendingString( a, fn StringWithFormat( @"%d", k / w ) ) + b = fn StringByAppendingString( b, fn StringWithFormat( @"%d", k mod w ) ) + next + + a = fn StringByAppendingString( a, b ) // Combine the two strings, and recode + +end fn = fn recode( a, code ) + +// + +clear local fn decode( s as CFStringRef, code as CFStringRef ) as CFStringRef + CFStringRef a = @"", b = @"", c + Short i, k, w = sqr( len( code ) ) + + for i = 0 to ( len( s ) - 1 ) + c = mid( s, i, 1 ) + k = instr( 0, code, c ) // Put row and columm in one long string + a = fn StringByAppendingString( a, fn StringWithFormat( @"%d%d", k / w, k mod w ) ) + next + + for i = 0 to len( a ) / 2 - 1 // Take row from first half of string, column from second + c = fn StringByAppendingString( mid( a, i, 1 ), mid( a, i + len( a ) / 2 , 1 ) ) + b = fn StringByAppendingString( b , c ) // Combine, and recode + next + +end fn = fn recode( b, code ) + +// + +print fn encode( @"ATTACKATDAWN", @"ABCDEFGHIKLMNOPQRSTUVWXYZ" ) +print fn decode( @"DQBDAXDQPDQH", @"ABCDEFGHIKLMNOPQRSTUVWXYZ" ) +print +print fn encode( @"FLEEATONCE", @"BGWKZQPDNSIOAXEFCLUMTHYVR" ) +print fn decode( @"UAEOLWRINS", @"BGWKZQPDNSIOAXEFCLUMTHYVR" ) +print +print fn encode( @"HAPPY40THDAD", @"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ) +print fn decode( @"GO31GAGVANJD", @"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ) + +handleevents diff --git a/Task/Bifid-cipher/Go/bifid-cipher.go b/Task/Bifid-cipher/Go/bifid-cipher.go new file mode 100644 index 0000000000..ad8846cf1b --- /dev/null +++ b/Task/Bifid-cipher/Go/bifid-cipher.go @@ -0,0 +1,180 @@ +/* + Only use ASCII letters between A and Z or the Characters in square... . If the row with 'J' is removed from the squares, + then the square is a 'Polybios square' and you must use removeSpaceI(text) to encrypt and decrypt +*/ +package main + +import ( + "fmt" + "strings" +) + +var ( + squareRosetta [][]byte = [][]byte{ //rosettacode + {'A', 'B', 'C', 'D', 'E'}, + {'F', 'G', 'H', 'I', 'K'}, + {'L', 'M', 'N', 'O', 'P'}, + {'Q', 'R', 'S', 'T', 'U'}, + {'V', 'W', 'X', 'Y', 'Z'}, + {'J', '1', '2', '3', '4'}, + } + + squareWikipedia [][]byte = [][]byte{ // wikipedia + + {'B', 'G', 'W', 'K', 'Z'}, + {'Q', 'P', 'N', 'D', 'S'}, + {'I', 'O', 'A', 'X', 'E'}, + {'F', 'C', 'L', 'U', 'M'}, + {'T', 'H', 'Y', 'V', 'R'}, + {'J', '1', '2', '3', '4'}, + } + + textRosetta string = "0ATTACKATDAWN" + textRosettaEncoded string = "DQBDAXDQPDQH" // only for test + textWikipedia string = "FLEEATONCE" + textWikipediaEncoded string = "UAEOLWRINS" // only for test + textTest string = "The invasion will start on the first of January" + textTextEncoded string = "RASOAQXFIOORXESXADETSWLTNIAZQOISBRGBALY" // only for test +) + +type koord struct { + X byte + Y byte +} + +func (k *koord) LessThen(other *koord) bool { + if k.Y > other.Y { + return false + } + if k.Y < other.Y { + return true + } + if k.X < other.X { + return true + } + return false +} + +func (k *koord) EqualTo(other koord) bool { + if k.X == other.X && k.Y == other.Y { + return true + } + return false +} + +var encryptMap map[byte]koord +var decryptMap map[koord]byte + +func squareToMaps(square [][]byte) (map[byte]koord, map[koord]byte) { + eMap := make(map[byte]koord) + dMap := make(map[koord]byte) + for x, col := range square { + for y, v := range col { + eMap[v] = koord{byte(x), byte(y)} + dMap[koord{byte(x), byte(y)}] = v + + } + } + return eMap, dMap +} + +func removeSpaceI(text string) string { + var n string + s := strings.ToUpper(text) + for _, b := range []byte(s) { + //use only ASCII Characters from A to Z + if b < 'A' || b > 'Z' { + continue + } + if b == 'J' { + b = 'I' + } + n = n + string(b) + } + return n +} + +func removeSpace(text string, square map[byte]koord) string { + var n string + //to UpperCase and then remove all Spaces an Characters witch are not in square + s := strings.ReplaceAll(strings.ToUpper(text), " ", "") + for _, b := range []byte(s) { + _, ok := square[b] + if ok { + n = n + string(b) + } + } + return n +} + +func encrypt(text string, emap map[byte]koord, dmap map[koord]byte) string { + text = removeSpace(text, emap) + var row0, row1 []byte + for _, b := range []byte(text) { + xy := emap[b] + row0 = append(row0, xy.X) + row1 = append(row1, xy.Y) + } + row0 = append(row0, row1...) + + var s string + for i := 0; i < len(row0); i += 2 { + s = s + string(dmap[koord{row0[i], row0[i+1]}]) + } + return s +} + +func decrypt(text string, emap map[byte]koord, dmap map[koord]byte) string { + text = removeSpace(text, emap) + k := make([]koord, len(text)) + + for i, b := range []byte(text) { + k[i] = emap[b] + } + + kl := make([]byte, len(k)*2) + i := int(0) + for _, ki := range k { + kl[i] = ki.X + kl[i+1] = ki.Y + i += 2 + } + l := len(kl) / 2 + k1 := kl[:l] + k2 := kl[l:] + var s string + + for i := 0; i < l; i++ { + s = s + string(dmap[koord{k1[i], k2[i]}]) + } + return s +} + +func main() { + + encryptMap, decryptMap = squareToMaps(squareRosetta) + fmt.Println("from Rosettacode") + fmt.Println("original:\t", textRosetta) + s := encrypt(textRosetta, encryptMap, decryptMap) + fmt.Println("codiert:\t", s) + s = decrypt(s, encryptMap, decryptMap) + fmt.Println("and back:\t", s) + + fmt.Println("from Wikipedia") + encryptMap, decryptMap = squareToMaps(squareWikipedia) + fmt.Println("original:\t", textWikipedia) + s = encrypt(textWikipedia, encryptMap, decryptMap) + fmt.Println("codiert:\t", s) + s = decrypt(s, encryptMap, decryptMap) + fmt.Println("and back:\t", s) + + encryptMap, decryptMap = squareToMaps(squareWikipedia) + fmt.Println("from Rosettacode long part") + fmt.Println("original:\t", textTest) + s = encrypt(textTest, encryptMap, decryptMap) + fmt.Println("codiert:\t", s) + // Wenn der Text eine ungerade Anzahl Buchstaben hat, funktioniert der Algorithmus nicht!!! + s = decrypt(s, encryptMap, decryptMap) + fmt.Println("and back:\t", s) + +} diff --git a/Task/Bifid-cipher/Haskell/bifid-cipher.hs b/Task/Bifid-cipher/Haskell/bifid-cipher.hs new file mode 100644 index 0000000000..9964f7aa9d --- /dev/null +++ b/Task/Bifid-cipher/Haskell/bifid-cipher.hs @@ -0,0 +1,60 @@ +import Data.List +import Data.Char + +-- Defining all the grids I'll be using in one go. + +rcBifid = [ + 'A','B','C','D','E', + 'F','G','H','I','K', + 'L','M','N','O','P', + 'Q','R','S','T','U', + 'V','W','X','Y','Z' + ] -- We will use strings here onwards. This was just a demonstration. + +wikiBifid = "POLYBIUSCHERADFGKMNQTVWXZ" +cmiBifid = "CMIHASKELQWRTYUOPDFGZXVBN" + +-- Convert a character to its grid coordinates (1-based index) +chr2pair square x = if x == 'J' then chr2pair square 'I' else case elemIndex x square of + Nothing -> error "char is not in cipher grid" + Just a -> (\(x,y) -> (x+1,y+1)) (divMod a 5) -- Convert flat index to (row, col) + +pair2chr square (x,y) = square !! ((x-1)*5+y-1) + +-- Pairs up elements from a list, used in Bifid encoding process +pairUp :: [a] -> [(a,a)] +pairUp [] = [] +pairUp [a] = error "Odd number of elements" +pairUp (x:y:ys) = (x,y):(pairUp ys) + +encrypt square message = map (pair2chr square) (pairUp (l ++ r)) where + (l,r) = unzip $ map (chr2pair square) message + +decrypt square message = map (pair2chr square) (zip u d) where + (u,d) = splitAt (length message) $ concatMap (\(x,y) -> [x,y]) $ map (chr2pair square) message + +main = do + let + message1 = "ATTACKATDAWN" + message2 = "FLEEATONCE" + encrypt1 = encrypt rcBifid message1 + encrypt2 = encrypt wikiBifid message2 + encrypt3 = encrypt wikiBifid message1 + myMessage = "The invasion will start on the first of January" + encrypt4 = encrypt cmiBifid $ map toUpper $ filter (/= ' ') myMessage -- Remove spaces, uppercase + + putStrLn $ "Message 1: " ++ message1 + putStrLn $ "Encryption wrt RC's square: " ++ encrypt1 + putStrLn $ "Decrypt: " ++ show (decrypt rcBifid encrypt1) + + putStrLn $ "Message 2: " ++ message2 + putStrLn $ "Encryption wrt Wiki's square: " ++ encrypt2 + putStrLn $ "Decrypt: " ++ show (decrypt wikiBifid encrypt2) + + putStrLn $ "Message 3: " ++ message1 + putStrLn $ "Encryption wrt Wiki's square: " ++ encrypt3 + putStrLn $ "Decrypt: " ++ show (decrypt wikiBifid encrypt3) + + putStrLn $ "Message 4: " ++ myMessage + putStrLn $ "Encryption wrt CMI square: " ++ encrypt4 + putStrLn $ "Decrypt: " ++ show (decrypt cmiBifid encrypt4) diff --git a/Task/Bifid-cipher/Java/bifid-cipher.java b/Task/Bifid-cipher/Java/bifid-cipher.java index a4a88f3db9..90b4f09174 100644 --- a/Task/Bifid-cipher/Java/bifid-cipher.java +++ b/Task/Bifid-cipher/Java/bifid-cipher.java @@ -7,101 +7,101 @@ import java.util.Map; public final class BifidCipher { - public static void main(String[] aArgs) { - final String message1 = "ATTACKATDAWN"; - final String message2 = "FLEEATONCE"; - final String message3 = "The invasion will start on the first of January".toUpperCase().replace(" ", ""); - - Bifid bifid1 = new Bifid(5, "ABCDEFGHIKLMNOPQRSTUVWXYZ"); - Bifid bifid2 = new Bifid(5, "BGWKZQPNDSIOAXEFCLUMTHYVR"); - - runTest(bifid1, message1); - runTest(bifid2, message2); - runTest(bifid2, message1); - runTest(bifid1, message2); - - Bifid bifid3 = new Bifid(6, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); - runTest(bifid3, message3); - } - - private static void runTest(Bifid aBifid, String aMessage) { - System.out.println("Using Polybius square:"); - aBifid.display(); - System.out.println("Message: " + aMessage); - String encrypted = aBifid.encrypt(aMessage); - System.out.println("Encrypted: " + encrypted); - String decrypted = aBifid.decrypt(encrypted); - System.out.println("Decrypted: " + decrypted); - System.out.println(); - } - + public static void main(String[] aArgs) { + final String message1 = "ATTACKATDAWN"; + final String message2 = "FLEEATONCE"; + final String message3 = "The invasion will start on the first of January".toUpperCase().replace(" ", ""); + + Bifid bifid1 = new Bifid(5, "ABCDEFGHIKLMNOPQRSTUVWXYZ"); + Bifid bifid2 = new Bifid(5, "BGWKZQPNDSIOAXEFCLUMTHYVR"); + + runTest(bifid1, message1); + runTest(bifid2, message2); + runTest(bifid2, message1); + runTest(bifid1, message2); + + Bifid bifid3 = new Bifid(6, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); + runTest(bifid3, message3); + } + + private static void runTest(Bifid aBifid, String aMessage) { + System.out.println("Using Polybius square:"); + aBifid.display(); + System.out.println("Message: " + aMessage); + String encrypted = aBifid.encrypt(aMessage); + System.out.println("Encrypted: " + encrypted); + String decrypted = aBifid.decrypt(encrypted); + System.out.println("Decrypted: " + decrypted); + System.out.println(); + } + } - + final class Bifid { - - public Bifid(int aN, String aText) { - if ( aText.length() != aN * aN ) { - throw new IllegalArgumentException("Incorrect length of text"); - } - - grid = new char[aN][aN]; - int row = 0; - int col = 0; - for ( char ch : aText.toCharArray() ) { - grid[row][col] = ch; - coordinates.put(ch, new Point(row, col) ); - col += 1; - if ( col == aN ) { - col = 0; - row += 1; - } - } - - if ( aN == 5 ) { - coordinates.put('J', coordinates.get('I')); - } - } - - public String encrypt(String aText) { - List rowOne = new ArrayList(); - List rowTwo = new ArrayList(); - for ( char ch : aText.toCharArray() ) { - Point coordinate = coordinates.get(ch); - rowOne.add(coordinate.x); - rowTwo.add(coordinate.y); - } - - rowOne.addAll(rowTwo); - StringBuilder result = new StringBuilder(); - for ( int i = 0; i < rowOne.size() - 1; i += 2 ) { - result.append(grid[rowOne.get(i)][rowOne.get(i + 1)]); - } - return result.toString(); - } - - public String decrypt(String aText) { - List row = new ArrayList(); - for ( char ch : aText.toCharArray() ) { - Point coordinate = coordinates.get(ch); - row.add(coordinate.x); - row.add(coordinate.y); - } - - final int middle = row.size() / 2; - List rowOne = row.subList(0, middle); - List rowTwo = row.subList(middle, row.size()); - StringBuilder result = new StringBuilder(); - for ( int i = 0; i < middle; i++ ) { - result.append(grid[rowOne.get(i)][rowTwo.get(i)]); - } - return result.toString(); - } + + public Bifid(int aN, String aText) { + if ( aText.length() != aN * aN ) { + throw new IllegalArgumentException("Incorrect length of text"); + } + + grid = new char[aN][aN]; + int row = 0; + int col = 0; + for ( char ch : aText.toCharArray() ) { + grid[row][col] = ch; + coordinates.put(ch, new Point(row, col) ); + col += 1; + if ( col == aN ) { + col = 0; + row += 1; + } + } + + if ( aN == 5 ) { + coordinates.put('J', coordinates.get('I')); + } + } + + public String encrypt(String aText) { + List rowOne = new ArrayList(); + List rowTwo = new ArrayList(); + for ( char ch : aText.toCharArray() ) { + Point coordinate = coordinates.get(ch); + rowOne.add(coordinate.x); + rowTwo.add(coordinate.y); + } + + rowOne.addAll(rowTwo); + StringBuilder result = new StringBuilder(); + for ( int i = 0; i < rowOne.size() - 1; i += 2 ) { + result.append(grid[rowOne.get(i)][rowOne.get(i + 1)]); + } + return result.toString(); + } + + public String decrypt(String aText) { + List row = new ArrayList(); + for ( char ch : aText.toCharArray() ) { + Point coordinate = coordinates.get(ch); + row.add(coordinate.x); + row.add(coordinate.y); + } + + final int middle = row.size() / 2; + List rowOne = row.subList(0, middle); + List rowTwo = row.subList(middle, row.size()); + StringBuilder result = new StringBuilder(); + for ( int i = 0; i < middle; i++ ) { + result.append(grid[rowOne.get(i)][rowTwo.get(i)]); + } + return result.toString(); + } public void display() { - Arrays.stream(grid).forEach( row -> System.out.println(Arrays.toString(row)) ); - } - - private char[][] grid; - private Map coordinates = new HashMap(); - + Arrays.stream(grid).forEach( row -> System.out.println(Arrays.toString(row)) ); + } + + private char[][] grid; + private Map coordinates = new HashMap(); + } diff --git a/Task/Bifid-cipher/JavaScript/bifid-cipher.js b/Task/Bifid-cipher/JavaScript/bifid-cipher.js new file mode 100644 index 0000000000..a4f210b4c0 --- /dev/null +++ b/Task/Bifid-cipher/JavaScript/bifid-cipher.js @@ -0,0 +1,199 @@ +// ADFGVX Cipher Implementation in JavaScript + +// Cipher squares +const squareRosetta = [ // from Rosetta Code + ['A', 'B', 'C', 'D', 'E'], + ['F', 'G', 'H', 'I', 'K'], + ['L', 'M', 'N', 'O', 'P'], + ['Q', 'R', 'S', 'T', 'U'], + ['V', 'W', 'X', 'Y', 'Z'], + ['J', '1', '2', '3', '4'] +]; + +const squareWikipedia = [ // from Wikipedia + ['B', 'G', 'W', 'K', 'Z'], + ['Q', 'P', 'N', 'D', 'S'], + ['I', 'O', 'A', 'X', 'E'], + ['F', 'C', 'L', 'U', 'M'], + ['T', 'H', 'Y', 'V', 'R'], + ['J', '1', '2', '3', '4'] +]; + +// Test text strings +const textRosetta = "0ATTACKATDAWN"; +const textRosettaEncoded = "DQBDAXDQPDQH"; // only for test +const textWikipedia = "FLEEATONCE"; +const textWikipediaEncoded = "UAEOLWRINS"; // only for test +const textTest = "The invasion will start on the first of January"; +const textTestEncoded = "RASOAQXFIOORXESXADETSWLTNIAZQOISBRGBALY"; // only for test + +// Coordinate class (equivalent to koord struct in Go) +class Coord { + constructor(x, y) { + this.x = x; + this.y = y; + } + + lessThan(other) { + if (this.y > other.y) { + return false; + } + if (this.y < other.y) { + return true; + } + if (this.x < other.x) { + return true; + } + return false; + } + + equalTo(other) { + return this.x === other.x && this.y === other.y; + } +} + +// Convert square to encryption and decryption maps +function squareToMaps(square) { + const encryptMap = new Map(); + const decryptMap = new Map(); + + for (let x = 0; x < square.length; x++) { + for (let y = 0; y < square[x].length; y++) { + const value = square[x][y]; + const coord = new Coord(x, y); + + // For encryption map, use character as key + encryptMap.set(value, coord); + + // For decryption map, use coordinate string as key + // (JavaScript Maps can't use objects as keys directly, so convert to string) + decryptMap.set(`${x},${y}`, value); + } + } + + return { encryptMap, decryptMap }; +} + +// Remove spaces and non-valid characters +function removeSpace(text, encryptMap) { + const upper = text.toUpperCase().replace(/\s/g, ''); + let result = ''; + + for (const char of upper) { + if (encryptMap.has(char)) { + result += char; + } + } + + return result; +} + +// Replace 'J' with 'I' (for specific Polybius square implementations) +function removeSpaceI(text) { + const upper = text.toUpperCase(); + let result = ''; + + for (const char of upper) { + // Use only ASCII characters from A to Z + if (char >= 'A' && char <= 'Z') { + result += char === 'J' ? 'I' : char; + } + } + + return result; +} + +// Encrypt using ADFGVX cipher +function encrypt(text, encryptMap, decryptMap) { + text = removeSpace(text, encryptMap); + + const row0 = []; + const row1 = []; + + // Get coordinates for each character + for (const char of text) { + const coord = encryptMap.get(char); + row0.push(coord.x); + row1.push(coord.y); + } + + // Combine coordinates + const combined = [...row0, ...row1]; + + let result = ''; + // Convert pairs of coordinates back to characters + for (let i = 0; i < combined.length; i += 2) { + const key = `${combined[i]},${combined[i+1]}`; + result += decryptMap.get(key); + } + + return result; +} + +// Decrypt using ADFGVX cipher +function decrypt(text, encryptMap, decryptMap) { + text = removeSpace(text, encryptMap); + + const coords = []; + + // Get coordinates for each character + for (const char of text) { + coords.push(encryptMap.get(char)); + } + + // Extract x and y values + const flatCoords = []; + for (const coord of coords) { + flatCoords.push(coord.x); + flatCoords.push(coord.y); + } + + const half = Math.floor(flatCoords.length / 2); + const firstHalf = flatCoords.slice(0, half); + const secondHalf = flatCoords.slice(half); + + let result = ''; + + // Recombine coordinates to get original text + for (let i = 0; i < firstHalf.length; i++) { + const key = `${firstHalf[i]},${secondHalf[i]}`; + result += decryptMap.get(key); + } + + return result; +} + +// Main function to test +function main() { + // Test with Rosetta square + let { encryptMap, decryptMap } = squareToMaps(squareRosetta); + + console.log("From Rosetta Code"); + console.log("original:\t", textRosetta); + let encoded = encrypt(textRosetta, encryptMap, decryptMap); + console.log("encoded:\t", encoded); + let decoded = decrypt(encoded, encryptMap, decryptMap); + console.log("and back:\t", decoded); + + // Test with Wikipedia square + ({ encryptMap, decryptMap } = squareToMaps(squareWikipedia)); + + console.log("\nFrom Wikipedia"); + console.log("original:\t", textWikipedia); + encoded = encrypt(textWikipedia, encryptMap, decryptMap); + console.log("encoded:\t", encoded); + decoded = decrypt(encoded, encryptMap, decryptMap); + console.log("and back:\t", decoded); + + // Test with longer text + console.log("\nFrom Rosetta Code (longer text)"); + console.log("original:\t", textTest); + encoded = encrypt(textTest, encryptMap, decryptMap); + console.log("encoded:\t", encoded); + // Note: If the text has an odd number of letters, the algorithm doesn't work! + decoded = decrypt(encoded, encryptMap, decryptMap); + console.log("and back:\t", decoded); +} + +// Run the main function +main(); diff --git a/Task/Bifid-cipher/Jq/bifid-cipher-2.jq b/Task/Bifid-cipher/Jq/bifid-cipher-2.jq index 9d4b6f076c..6eabe468da 100644 --- a/Task/Bifid-cipher/Jq/bifid-cipher-2.jq +++ b/Task/Bifid-cipher/Jq/bifid-cipher-2.jq @@ -48,7 +48,7 @@ def task: | ($encrypted | decrypt(polys[$i] )) as $decrypted | "Message : \(.)", "Encrypted : \($encrypted)", - "Decrypted : \($decrypted)" + "Decrypted : \($decrypted)", "" ; task diff --git a/Task/Bifid-cipher/Julia/bifid-cipher.julia b/Task/Bifid-cipher/Julia/bifid-cipher.jl similarity index 100% rename from Task/Bifid-cipher/Julia/bifid-cipher.julia rename to Task/Bifid-cipher/Julia/bifid-cipher.jl diff --git a/Task/Bifid-cipher/Kotlin/bifid-cipher.kotlin b/Task/Bifid-cipher/Kotlin/bifid-cipher.kts similarity index 100% rename from Task/Bifid-cipher/Kotlin/bifid-cipher.kotlin rename to Task/Bifid-cipher/Kotlin/bifid-cipher.kts diff --git a/Task/Bifid-cipher/M2000-Interpreter/bifid-cipher.m2000 b/Task/Bifid-cipher/M2000-Interpreter/bifid-cipher.m2000 new file mode 100644 index 0000000000..b0234f8353 --- /dev/null +++ b/Task/Bifid-cipher/M2000-Interpreter/bifid-cipher.m2000 @@ -0,0 +1,68 @@ +module Bifid_cipher (f, code$) { + n=sqrt(len(code$)) + print #f," "; + for i=1 to n + print #f, i+" "; + next + print #f + for i=0 to n-1 + Print #f, (i+1)+" "+STR$(mid$(code$,1+i*n, n),STRING$("@ ", 5)) + next + tables=lambda (a$)->{ + n=sqrt(len(a$)) + a=list + for i=1 to len(a$) + append a, mid$(a$,i, 1):=((i-1) mod n+1, (i-1) div n+1 ) + next + b=list + m=each(a) + while m + z=eval(m) + append b, z#val$(1)+z#val$(0):=eval$(m!) + end while + =a, b + }(code$) + encode= lambda (a, b)->{ + =lambda a,b (mess as string) -> { + document code$ + for n=1 to 0 + for i=1 to len(mess) + q=mid$(mess, i,1) + if not exist(a, q) then + if q="J" then q="I" else q="A" + end if + code$=a(q)#val$(n) + next + next + document final$ + for i=1 to len(code$) step 2 + final$=b$(mid$(code$, i, 2)) + next + = final$ + } + }(!tables) + decode= lambda (a, b)->{ + =lambda a,b (final as string) -> { + document code$, mess$ + for i=1 to len(final) + q=a(mid$(final, i, 1)) + code$=q#val$(1)+q#val$(0) + next + offset=len(code$) div 2 + for i=1 to offset + mess$=b$(mid$(code$,i,1)+mid$(code$,i+offset,1)) + next + = mess$ + } + }(!tables) + Print #f, encode("ATTACKATDAWN") + Print #f, decode(encode("ATTACKATDAWN"))="ATTACKATDAWN" + Print #f, encode(ucase$(filter$("The invasion will start on the first of January", " "))) + Print #f, decode(encode(ucase$(filter$("The invasion will start on the first of January", " ")))) +} +open "out.txt" for output as #a +Bifid_cipher a, "ABCDEFGHIKLMNOPQRSTUVWXYZ" +Bifid_cipher a, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +Bifid_cipher a, "BGWKZQPNDSIOAXEFCLUMTHYVR" +close #a +win "out.txt" diff --git a/Task/Bifid-cipher/PascalABC.NET/bifid-cipher.pas b/Task/Bifid-cipher/PascalABC.NET/bifid-cipher.pas new file mode 100644 index 0000000000..4440353bf4 --- /dev/null +++ b/Task/Bifid-cipher/PascalABC.NET/bifid-cipher.pas @@ -0,0 +1,28 @@ +// Bifid cipher. Nigel Galloway: September 18th., 2024 +function polybius(alphabet:string;n,g:integer):(Dictionary,Dictionary<(integer,integer),char>); +begin + var ng:=Cartesian(1..n,1..g); + Result:=(Dict(Zip(alphabet,ng)),Dict(Zip(ng,alphabet))); +end; +function fN(e:Dictionary;n:string):(sequence of integer,sequence of integer):=(n.Substring(1).Scan(e[n[1]],(n,g)->e[g])).UnZipTuple; +function encrypt(e:(Dictionary,Dictionary<(integer,integer),char>);text:string):string; +begin + var fG:((sequence of integer,sequence of integer),Dictionary<(integer,integer),char>)->string:=(n,e)->(n[0]+n[1]).Batch(2).Aggregate('',(n,g)->n+e[(g[0],g[1])]); + Result:=fG(fN(e[0],text),e[1]); +end; +function decrypt(e:(Dictionary,Dictionary<(integer,integer),char>);text:string):string; +begin + var fG:(sequence of (integer,integer),Dictionary<(integer,integer),char>)->string:=(n,e)->n.Aggregate('',(n,g)->n+e[(g[0],g[1])]); + var t:=fN(e[0],text); var z:=t[0].Interleave(t[1]).SplitAt(t[0].count); + Result:=fG(z[0].ZipTuple(z[1]),e[1]); +end; +begin + var p:=polybius('abcdefghiklmnopqrstuvwxyz',5,5); var s,e:string; + s:='fleeatonce'; e:=encrypt(p,s); println($'{s} -> {e} -> {decrypt(p,e)}'); + s:='attackatdawn'; e:=encrypt(p,s); println($'{s} -> {e} -> {decrypt(p,e)}'); + p:=polybius('bgwkzqpndsioaxefclumthyvr',5,5); + e:=encrypt(p,s); println($'{s} -> {e} -> {decrypt(p,e)}'); + s:='fleeatonce'; e:=encrypt(p,s); println($'{s} -> {e} -> {decrypt(p,e)}'); + p:=polybius('abcdefghijklmnopqrstuvwxyz0123456789',6,6); + s:='theinvasionwillstarton1january2025'; e:=encrypt(p,s); println($'{s} -> {e} -> {decrypt(p,e)}'); +end. diff --git a/Task/Bifid-cipher/Phix/bifid-cipher.phix b/Task/Bifid-cipher/Phix/bifid-cipher.phix index 57af305806..e1aa112fda 100644 --- a/Task/Bifid-cipher/Phix/bifid-cipher.phix +++ b/Task/Bifid-cipher/Phix/bifid-cipher.phix @@ -1,41 +1,39 @@ -(phixonline)--> - with javascript_semantics - enum encrypt,decrypt - function bifid(string msg, polybius, sequence p, integer n, ed) - string res = "" - sequence dx = {}, dy = {}, dxy - for i=1 to length(msg) do - integer k = find(msg[i],polybius)-1 - dx &= floor(k/n)+1 - dy &= remainder(k,n)+1 - end for - if ed=encrypt then - dxy = split_by(dx&dy,2) - else - -- "simply reversing these steps" - yeah, right... - dxy = columnize(split_by(flatten(columnize({dx,dy})),length(dx))) - end if - for i=1 to length(dxy) do - integer {x,y} = dxy[i] - res &= p[x][y] - end for - return res - end function +with javascript_semantics +enum encrypt,decrypt +function bifid(string msg, polybius, sequence p, integer n, ed) + string res = "" + sequence dx = {}, dy = {}, dxy + for i=1 to length(msg) do + integer k = find(msg[i],polybius)-1 + dx &= floor(k/n)+1 + dy &= remainder(k,n)+1 + end for + if ed=encrypt then + dxy = split_by(dx&dy,2) + else + -- "simply reversing these steps" - yeah, right... + dxy = columnize(split_by(flatten(columnize({dx,dy})),length(dx))) + end if + for i=1 to length(dxy) do + integer {x,y} = dxy[i] + res &= p[x][y] + end for + return res +end function - procedure test(string msg, polybius) - integer n = sqrt(length(polybius)) - if n=5 then msg = substitute(upper(msg),"J","I") end if - sequence p = split_by(polybius,n) - string enc = bifid(msg,polybius,p,n,encrypt), - dec = bifid(enc,polybius,p,n,decrypt) - printf(1,"For %dx%d polybius %s\n\n",{n,n,join(p,"\n ")}) - printf(1,"Message : %s\nEncrypted: %s\nDecrypted: %s\n\n",{msg,enc,dec}) - end procedure +procedure test(string msg, polybius) + integer n = sqrt(length(polybius)) + if n=5 then msg = substitute(upper(msg),"J","I") end if + sequence p = split_by(polybius,n) + string enc = bifid(msg,polybius,p,n,encrypt), + dec = bifid(enc,polybius,p,n,decrypt) + printf(1,"For %dx%d polybius %s\n\n",{n,n,join(p,"\n ")}) + printf(1,"Message : %s\nEncrypted: %s\nDecrypted: %s\n\n",{msg,enc,dec}) +end procedure - constant polybii = {tagstart('A','J'-'A')&tagstart('K','Z'-'J'), - "BGWKZQPNDSIOAXEFCLUMTHYVR", - " ."&tagstart('A',26)&tagstart('a',26)&tagstart('0',10)}, - messages = {"ATTACKATDAWN","FLEEATONCE", - "The invasion will start on the first of January 2023."} - for t=1 to 3 do test(messages[t],polybii[t]) end for - [ ) + + [ $ "" swap + witheach + [ char A + + dup char I > if 1+ + join ] ] is ->A..Z ( [ --> $ ) + + [ [] 5 times + [ dip ->0..24 join ] ] is makesquare ( $ $ $ $ $ --> [ ) + + [ dup witheach + [ i^ unrot poke ] ] is makeindex ( [ --> [ ) + + [ dup temp put + makeindex temp put + ->0..24 + [] swap witheach + [ temp share swap peek + 5 /mod join + nested join ] + temp release + transpose + unpack join + [] swap + dup size 2 / times + [ 2 split dip + [ nested join ] ] + drop + $ "" swap + witheach + [ unpack swap 5 * + + temp share swap peek + join ] + ->A..Z + temp release ] is encrypt ( $ [ --> $ ) + + [ dup temp put + makeindex temp put + ->0..24 + [] swap witheach + [ temp share swap peek + 5 /mod join join ] + temp release + dup size 2 / split + 2 pack + transpose + [] swap witheach + [ unpack swap 5 * + + temp share swap peek + join ] + ->A..Z + temp release ] is decrypt ( $ [ --> $ ) + + [ $ "ABCDE" + $ "FGHIK" + $ "LMNOP" + $ "QRSTU" + $ "VWXYZ" + makesquare ] constant is tasksquare ( --> [ ) + + [ $ "BGWKZ" + $ "QPNDS" + $ "IOAXE" + $ "FCLUM" + $ "THYVR" + makesquare ] constant is wikisquare ( --> [ ) + + [ $ "QUACK" + $ "DEPTH" + $ "LYING" + $ "FORMS" + $ "BVWXZ" + makesquare ] constant is ducksquare ( --> [ ) + + + say "Using tasksquare:" cr + $ "Attack at dawn." dup echo$ say " -> " + tasksquare encrypt dup echo$ say " -> " + tasksquare decrypt echo$ + cr cr + say "Using wikisquare:" cr + $ "Flee at once." dup echo$ say " -> " + wikisquare encrypt dup echo$ say " -> " + wikisquare decrypt echo$ + cr cr + say "Using ducksquare:" cr + $ "The invasion will start on the first of January." dup echo$ cr say " -> " + ducksquare encrypt dup echo$ cr say " -> " + ducksquare decrypt echo$ diff --git a/Task/Bifid-cipher/Rebol/bifid-cipher.rebol b/Task/Bifid-cipher/Rebol/bifid-cipher.rebol new file mode 100644 index 0000000000..8d8f219f6c --- /dev/null +++ b/Task/Bifid-cipher/Rebol/bifid-cipher.rebol @@ -0,0 +1,137 @@ +Rebol [ + title: "Rosetta code: Bifid cipher" + file: %Bifid_cipher.r3 + url: https://rosettacode.org/wiki/Bifid_cipher +] + +make-square: function [ + {Build a Polybius square from an alphabet string. + Returns a block of rows, each row a block of single-character strings. + The square is sized ceil(sqrt(len)) x ceil(sqrt(len)), with none padding + if the alphabet does not fill the last row exactly.} + alphabet [string!] +][ + size: to-integer round/ceiling square-root length? alphabet + rows: copy [] + row: copy [] + i: 0 + foreach ch alphabet [ + append row ch + ++ i + if i = size [ + append/only rows row + row: copy [] + i: 0 + ] + ] + unless empty? row [ ;; pad final row with none + append/dup row none (size - length? row) + append/only rows row + ] + new-line/all rows true +] + +square-map: function [ + {Return a map of character -> [row col] (1-based) for the given square.} + square [block!] +][ + m: make map! 64 + r: 1 + foreach row square [ + c: 1 + foreach ch row [ + if ch [ m/:ch: reduce [r c] ] ; skip none padding + ++ c + ] + ++ r + ] + m +] + +encrypt: function [ + {Encrypt plaintext using the bifid cipher with the given Polybius square. + Collects all row coordinates then all column coordinates, pairs them up, + and maps each pair back through the square.} + message [string!] + square [block!] +][ + m: square-map square + rows: copy [] + cols: copy [] + foreach ch message [ + if coord: m/:ch [ + append rows coord/1 + append cols coord/2 + ] + ] + combined: append copy rows cols ;; [r1 r2 .. rN c1 c2 .. cN] + result: copy "" + i: 1 + while [i < length? combined] [ + r: pick combined i + c: pick combined i + 1 + append result pick (pick square r) c + i: i + 2 + ] + result +] + +decrypt: function [ + {Decrypt ciphertext using the bifid cipher with the given Polybius square. + Splits the coordinate stream into the first half (rows) and second half + (cols), zips them, and maps each pair back through the square.} + message [string!] + square [block!] +][ + m: square-map square + coords: copy [] + foreach ch message [ + if coord: m/:ch [ repend coords coord ] + ] + half: (length? coords) / 2 ;; split interleaved coords at midpoint + rows: copy/part coords half + cols: copy/part (skip coords half) half + result: copy "" + i: 1 + while [i <= half] [ + r: rows/:i + c: cols/:i + append result square/:r/:c + ++ i + ] + result +] + +normalize: func [ + {Replace J with I for a standard 25-letter Polybius square.} + message [string!] +][ + replace/all copy message "J" "I" +] + +; --- Polybius squares used in test cases --- + +typical-square: make-square "ABCDEFGHIKLMNOPQRSTUVWXYZ" ;; 25 letters, no J +example-square: make-square "BGWKZQPNDSIOAXEFCLUMTHYVR" +playfair-square: make-square "PLAYFIREXMBCDGHKNOQSTUVWZ" +digits-square: make-square "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + +; --- Test cases --- + +test-cases: reduce [ + "ATTACKATDAWN" typical-square + "FLEEATONCE" example-square + "FLEEATONCE" typical-square + normalize "The invasion will start on the first of January" playfair-square + "The invasion will start on the first of January" digits-square +] + +foreach [msg square] test-cases [ + probe square + enc: encrypt msg square + dec: decrypt enc square + print ["Message :" msg] + print ["Encrypted:" enc] + print ["Decrypted:" dec] + print "" +] diff --git a/Task/Bifid-cipher/Rust/bifid-cipher.rs b/Task/Bifid-cipher/Rust/bifid-cipher.rs new file mode 100644 index 0000000000..57868d8c09 --- /dev/null +++ b/Task/Bifid-cipher/Rust/bifid-cipher.rs @@ -0,0 +1,125 @@ +use std::collections::HashMap; + +type Point = (i32, i32); + + +struct Bifid { + grid: Vec>, + coordinates: HashMap, + n: i32, +} + +impl Bifid { + pub fn new(n: i32, text: &str) -> Result { + if (text.len() as i32) != n * n { + return Err("Incorrect length of text".to_string()); + } + + let mut grid = vec![vec!['\0'; n as usize]; n as usize]; + let mut coordinates: HashMap = HashMap::new(); + + let mut row: i32 = 0; + let mut col: i32 = 0; + + for ch in text.chars() { + grid[row as usize][col as usize] = ch; + coordinates.insert(ch, (row, col)); + + col += 1; + if col == n { + col = 0; + row += 1; + } + } + + if n == 5 { + if let Some(&i_coords) = coordinates.get(&'I') { + coordinates.insert('J', i_coords); + } + } + + Ok(Bifid { + grid, + coordinates, + n, + }) + } + + pub fn encrypt(&self, text: &str) -> String { + let mut row_one: Vec = Vec::new(); + let mut row_two: Vec = Vec::new(); + + for ch in text.chars() { + if let Some(coordinate) = self.coordinates.get(&ch) { + row_one.push(coordinate.0); + row_two.push(coordinate.1); + } + } + + row_one.extend(row_two.iter()); + let mut result = String::new(); + for i in (0..row_one.len() - 1).step_by(2) { + result.push(self.grid[row_one[i] as usize][row_one[i + 1] as usize]); + } + result + } + + pub fn decrypt(&self, text: &str) -> String { + let mut row: Vec = Vec::new(); + for ch in text.chars() { + if let Some(coordinate) = self.coordinates.get(&ch) { + row.push(coordinate.0); + row.push(coordinate.1); + } + } + + let middle = row.len() / 2; + let row_one: Vec = row[..middle].to_vec(); + let row_two: Vec = row[middle..].to_vec(); + + let mut result = String::new(); + for i in 0..middle { + result.push(self.grid[row_one[i] as usize][row_two[i] as usize]); + } + result + } + + pub fn display(&self) { + for row in &self.grid { + for ch in row { + print!("{} ", ch); + } + println!(); + } + } +} + +fn run_test(bifid: &Bifid, message: &str) { + println!("Using Polybius square:"); + bifid.display(); + println!("Message: {}", message); + let encrypted = bifid.encrypt(message); + println!("Encrypted: {}", encrypted); + let decrypted = bifid.decrypt(&encrypted); + println!("Decrypted: {}", decrypted); + println!(); +} + +fn main() -> Result<(), String> { + let message1 = "ATTACKATDAWN"; + let message2 = "FLEEATONCE"; + let message3 = "THEINVASIONWILLSTARTONTHEFIRSTOFJANUARY"; + + let bifid1 = Bifid::new(5, "ABCDEFGHIKLMNOPQRSTUVWXYZ")?; + let bifid2 = Bifid::new(5, "BGWKZQPNDSIOAXEFCLUMTHYVR")?; + + run_test(&bifid1, message1); + run_test(&bifid2, message2); + run_test(&bifid2, message1); + run_test(&bifid1, message2); + + let bifid3 = Bifid::new(6, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")?; + run_test(&bifid3, message3); + + Ok(()) +} diff --git a/Task/Bifid-cipher/Uiua/bifid-cipher-1.uiua b/Task/Bifid-cipher/Uiua/bifid-cipher-1.uiua new file mode 100644 index 0000000000..7a2d0a35ce --- /dev/null +++ b/Task/Bifid-cipher/Uiua/bifid-cipher-1.uiua @@ -0,0 +1,9 @@ +S ← "ABCDEFGHIKLMNOPQRSTUVWXYZ" +P ← ↯⊟.√⧻.S +Prep ← ▽∊:S.∧⍜⊡⋅@I⊚⌕@J.⌵ +Bifid ← setinv( + ⊡:⟜(↯∞_2/⊂⇌⍉≡(⊢⊚⌕)Prep:¤)P +| ⊡:⟜(⍉⇌↯2_∞/⊂≡(⊢⊚⌕):¤)P +) +°Bifid.Bifid. "This is it" +°Bifid.Bifid. "The invasion will start on the first of January" diff --git a/Task/Bifid-cipher/Uiua/bifid-cipher-2.uiua b/Task/Bifid-cipher/Uiua/bifid-cipher-2.uiua new file mode 100644 index 0000000000..c9ef4c623e --- /dev/null +++ b/Task/Bifid-cipher/Uiua/bifid-cipher-2.uiua @@ -0,0 +1,9 @@ +S ← "GLYPHABCDEFIJKMNOQRSTUVWXZ0123456789" +P ← ↯⊟.√⧻.S +Prep ← ▽∊:S.⌵ +Bifid ← setinv( + ⊡:⟜(↯∞_2/⊂⇌⍉≡(⊢⊚⌕)Prep:¤)P +| ⊡:⟜(⍉⇌↯2_∞/⊂≡(⊢⊚⌕):¤)P +) +°Bifid.Bifid. "This is it" +°Bifid.Bifid. "The invasion will start at 0600 on the 1st of January" diff --git a/Task/Bifid-cipher/XPL0/bifid-cipher.xpl0 b/Task/Bifid-cipher/XPL0/bifid-cipher.xpl0 new file mode 100644 index 0000000000..4cc1050db2 --- /dev/null +++ b/Task/Bifid-cipher/XPL0/bifid-cipher.xpl0 @@ -0,0 +1,101 @@ +string 0; \use zero-terminated strings +def MaxLen = 100; \more than length of longest message + +func StrLen(A); \Return number of characters in an ASCIIZ string +char A; +int I; +for I:= 0 to MaxLen do + if A(I) = 0 then return I; + +proc StrUpper(S); \In string S, convert lowercase characters to uppercase +char S; +int I; +for I:= 0 to StrLen(S)-1 do + if S(I)>=^a & S(I)<=^z then S(I):= S(I) & $DF; + +proc StrReplace(S, C1, C2); \In string S, convert character C1 to C2 +char S, C1, C2; +int I; +for I:= 0 to StrLen(S)-1 do + if S(I) = C1 then S(I):= C2; + +func IndexOf(S, C); \Return offset of character C in string S +char S, C; +int I; +[for I:= 0 to StrLen(S)-1 do + if S(I) = C then return I; +return -1; +]; + +char Encrypted(MaxLen), Decrypted(MaxLen); + +proc Encrypt(Polybius, Message); \Copy encrypted Message into Encrypted +char Polybius, Message; +char Rows(MaxLen*2), Cols(MaxLen); +int C, IX, I, J, Len; +[Len:= StrLen(Message); +for I:= 0 to Len do \copy Message into Encrypted + Encrypted(I):= Message(I); +StrUpper(Encrypted); +StrReplace(Encrypted, ^J, ^I); +I:= 0; J:= 0; +loop [C:= Encrypted(I); + I:= I+1; + if C = 0 then quit; + IX:= IndexOf(Polybius, C); + if IX >= 0 then \ignores spaces, etc. + [Rows(J):= IX/5; + Cols(J):= rem(0); + J:= J+1; + ]; + ]; +Len:= J; \length of encrypted message +for I:= 0 to Len-1 do \append Cols onto end of Rows + Rows(I+Len):= Cols(I); +for I:= 0 to Len-1 do + [IX:= Rows(I*2)*5 + Rows(I*2+1); + Encrypted(I):= Polybius(IX); + ]; +Encrypted(I):= 0; \terminate string +]; + +proc Decrypt(Polybius, Message); \Copy decrypted Message into Decrypted +char Polybius, Message; +char Rows(MaxLen*2), Cols(MaxLen); +int C, IX, I, J, Len; +[I:= 0; J:= 0; +loop [C:= Message(I); + if C = 0 then quit; + I:= I+1; + IX:= IndexOf(Polybius, C); + Rows(J):= IX/5; + Rows(J+1):= rem(0); + J:= J+2; + ]; +Len:= I; +Cols:= Rows + Len; +for I:= 0 to Len-1 do + [IX:= Rows(I)*5 + Cols(I); + Decrypted(I):= Polybius(IX); + ]; +Decrypted(I):= 0; +]; + +int Polys, Msgs, I; +[Polys:= ["ABCDEFGHIKLMNOPQRSTUVWXYZ", + "BGWKZQPNDSIOAXEFCLUMTHYVR", + "BGWKZQPNDSIOAXEFCLUMTHYVR", + "PLAYFIREXMBCDGHKNOQSTUVWZ"]; +Msgs:= ["ATTACKATDAWN", + "FLEEATONCE", + "ATTACKATDAWN", + "The invasion will start on the first of January"]; +for I:= 0 to 4-1 do + [Encrypt(Polys(I), Msgs(I)); + Decrypt(Polys(I), Encrypted); + Text(0, "Message : "); Text(0, Msgs(I)); CrLf(0); + Text(0, "Encrypted : "); Text(0, Encrypted); CrLf(0); + Text(0, "Decrypted : "); Text(0, Decrypted); CrLf(0); + if I < 4-1 then CrLf(0); + ]; +] diff --git a/Task/Bifid-cipher/Zig/bifid-cipher.zig b/Task/Bifid-cipher/Zig/bifid-cipher.zig new file mode 100644 index 0000000000..1647e357f2 --- /dev/null +++ b/Task/Bifid-cipher/Zig/bifid-cipher.zig @@ -0,0 +1,164 @@ +const std = @import("std"); + +const Point = struct { + row: i32, + col: i32, +}; + +const Bifid = struct { + grid: [][]u8, + coordinates: std.AutoHashMap(u8, Point), + n: i32, + allocator: std.mem.Allocator, + + pub fn init(allocator: std.mem.Allocator, n: i32, text: []const u8) !*Bifid { + if (text.len != @as(usize, @intCast(n * n))) { + return error.IncorrectLength; + } + + var self = try allocator.create(Bifid); + self.* = .{ + .grid = try allocator.alloc([]u8, @intCast(n)), + .coordinates = std.AutoHashMap(u8, Point).init(allocator), + .n = n, + .allocator = allocator, + }; + + for (0..@intCast(n)) |i| { + self.grid[i] = try allocator.alloc(u8, @intCast(n)); + } + + var row: i32 = 0; + var col: i32 = 0; + + for (text) |ch| { + self.grid[@intCast(row)][@intCast(col)] = ch; + try self.coordinates.put(ch, .{ .row = row, .col = col }); + + col += 1; + if (col == n) { + col = 0; + row += 1; + } + } + + if (n == 5) { + // Handle I/J as the same letter in traditional 5x5 grid + if (self.coordinates.get('I')) |i_coords| { + try self.coordinates.put('J', i_coords); + } + } + + return self; + } + + pub fn deinit(self: *Bifid) void { + for (self.grid) |row| { + self.allocator.free(row); + } + self.allocator.free(self.grid); + self.coordinates.deinit(); + self.allocator.destroy(self); + } + + pub fn encrypt(self: *const Bifid, text: []const u8, allocator: std.mem.Allocator) ![]u8 { + var row_one = std.ArrayList(i32).init(allocator); + defer row_one.deinit(); + var row_two = std.ArrayList(i32).init(allocator); + defer row_two.deinit(); + + for (text) |ch| { + if (self.coordinates.get(ch)) |coordinate| { + try row_one.append(coordinate.row); + try row_two.append(coordinate.col); + } + } + + // Extend row_one with all elements from row_two + for (row_two.items) |col| { + try row_one.append(col); + } + + var result = std.ArrayList(u8).init(allocator); + var i: usize = 0; + while (i < row_one.items.len - 1) : (i += 2) { + const r = @as(usize, @intCast(row_one.items[i])); + const c = @as(usize, @intCast(row_one.items[i + 1])); + try result.append(self.grid[r][c]); + } + + return result.toOwnedSlice(); + } + + pub fn decrypt(self: *const Bifid, text: []const u8, allocator: std.mem.Allocator) ![]u8 { + var row = std.ArrayList(i32).init(allocator); + defer row.deinit(); + + for (text) |ch| { + if (self.coordinates.get(ch)) |coordinate| { + try row.append(coordinate.row); + try row.append(coordinate.col); + } + } + + const middle = row.items.len / 2; + + var result = std.ArrayList(u8).init(allocator); + + for (0..middle) |i| { + const r = @as(usize, @intCast(row.items[i])); + const c = @as(usize, @intCast(row.items[i + middle])); + try result.append(self.grid[r][c]); + } + + return result.toOwnedSlice(); + } + + pub fn display(self: *const Bifid) void { + for (self.grid) |row| { + for (row) |ch| { + std.debug.print("{c} ", .{ch}); + } + std.debug.print("\n", .{}); + } + } +}; + +fn runTest(bifid: *const Bifid, message: []const u8, allocator: std.mem.Allocator) !void { + std.debug.print("Using Polybius square:\n", .{}); + bifid.display(); + std.debug.print("Message: {s}\n", .{message}); + + const encrypted = try bifid.encrypt(message, allocator); + defer allocator.free(encrypted); + std.debug.print("Encrypted: {s}\n", .{encrypted}); + + const decrypted = try bifid.decrypt(encrypted, allocator); + defer allocator.free(decrypted); + std.debug.print("Decrypted: {s}\n\n", .{decrypted}); +} + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer _ = gpa.deinit(); + const allocator = gpa.allocator(); + + const message1 = "ATTACKATDAWN"; + const message2 = "FLEEATONCE"; + const message3 = "THEINVASIONWILLSTARTONTHEFIRSTOFJANUARY"; + + const bifid1 = try Bifid.init(allocator, 5, "ABCDEFGHIKLMNOPQRSTUVWXYZ"); + defer bifid1.deinit(); + + const bifid2 = try Bifid.init(allocator, 5, "BGWKZQPNDSIOAXEFCLUMTHYVR"); + defer bifid2.deinit(); + + try runTest(bifid1, message1, allocator); + try runTest(bifid2, message2, allocator); + try runTest(bifid2, message1, allocator); + try runTest(bifid1, message2, allocator); + + const bifid3 = try Bifid.init(allocator, 6, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); + defer bifid3.deinit(); + try runTest(bifid3, message3, allocator); +} diff --git a/Task/Bin-given-limits/Ada/bin-given-limits-1.ada b/Task/Bin-given-limits/Ada/bin-given-limits-1.adb similarity index 100% rename from Task/Bin-given-limits/Ada/bin-given-limits-1.ada rename to Task/Bin-given-limits/Ada/bin-given-limits-1.adb diff --git a/Task/Bin-given-limits/Ada/bin-given-limits-2.ada b/Task/Bin-given-limits/Ada/bin-given-limits-2.adb similarity index 100% rename from Task/Bin-given-limits/Ada/bin-given-limits-2.ada rename to Task/Bin-given-limits/Ada/bin-given-limits-2.adb diff --git a/Task/Bin-given-limits/Ada/bin-given-limits-3.ada b/Task/Bin-given-limits/Ada/bin-given-limits-3.adb similarity index 100% rename from Task/Bin-given-limits/Ada/bin-given-limits-3.ada rename to Task/Bin-given-limits/Ada/bin-given-limits-3.adb diff --git a/Task/Bin-given-limits/AppleScript/bin-given-limits.applescript b/Task/Bin-given-limits/AppleScript/bin-given-limits.applescript new file mode 100644 index 0000000000..9d4b93c9c4 --- /dev/null +++ b/Task/Bin-given-limits/AppleScript/bin-given-limits.applescript @@ -0,0 +1,42 @@ +property bins : {} + +local limits, theData, n, i, p, flag, output +set limits to {14, 18, 249, 312, 389, 392, 513, 591, 634, 720} +set theData to {445, 814, 519, 697, 700, 130, 255, 889, 481, 122, 932, 77, 323, 525, 570, 219, 367, 523, 442, 933, ¬ + 416, 589, 930, 373, 202, 253, 775, 47, 731, 685, 293, 126, 133, 450, 545, 100, 741, 583, 763, 306, ¬ + 655, 267, 248, 477, 549, 238, 62, 678, 98, 534, 622, 907, 406, 714, 184, 391, 913, 42, 560, 247, ¬ + 346, 860, 56, 138, 546, 38, 985, 948, 58, 213, 799, 319, 390, 634, 458, 945, 733, 507, 916, 123, ¬ + 345, 110, 720, 917, 313, 845, 426, 9, 457, 628, 410, 723, 354, 895, 881, 953, 677, 137, 397, 97, ¬ + 854, 740, 83, 216, 421, 94, 517, 479, 292, 963, 376, 981, 480, 39, 257, 272, 157, 5, 316, 395, ¬ + 787, 942, 456, 242, 759, 898, 576, 67, 298, 425, 894, 435, 831, 241, 989, 614, 987, 770, 384, 692, ¬ + 698, 765, 331, 487, 251, 600, 879, 342, 982, 527, 736, 795, 585, 40, 54, 901, 408, 359, 577, 237, ¬ + 605, 847, 353, 968, 832, 205, 838, 427, 876, 959, 686, 646, 835, 127, 621, 892, 443, 198, 988, 791, ¬ + 466, 23, 707, 467, 33, 670, 921, 180, 991, 396, 160, 436, 717, 918, 8, 374, 101, 684, 727, 749} + +repeat (count limits) + 1 times + set end of bins to 0 +end repeat + +repeat with n in theData + set flag to false + repeat with i from 1 to count limits + if n < item i of limits then + set flag to true + exit repeat + end if + end repeat + if flag then + set item i of bins to (item i of bins) + 1 + else + set item -1 of bins to (item -1 of bins) + 1 + end if +end repeat +set p to item 1 of limits +set output to "< " & p & " := " & (item 1 of bins) & linefeed +repeat with i from 2 to count limits + set n to item i of limits + set output to output & ">= " & p & " .. < " & n & " := " & (item i of bins) & linefeed + set p to n +end repeat +set output to output & ">= " & p & " := " & (item -1 of bins) +get output diff --git a/Task/Bin-given-limits/Crystal/bin-given-limits.cr b/Task/Bin-given-limits/Crystal/bin-given-limits.cr new file mode 100644 index 0000000000..84f3d18ad5 --- /dev/null +++ b/Task/Bin-given-limits/Crystal/bin-given-limits.cr @@ -0,0 +1,43 @@ +def bin (limits, seq) + bins = Array.new limits.size+1, 0 + seq.each do |v| + bins[limits.bsearch_index {|l, _| v < l } || -1] += 1 + end + bins +end + +def print_bins (limits, bins) + limit_width = limits.values_at(0, -1).map(&.to_s.size).max + tally_width = bins.max.to_s.size + bins.each_with_index do |n, i| + left = if i > 0; limits[i-1] end + right = if i < limits.size; limits[i] end + printf "%*s %s n %s %*s ⇒ %*s\n", + limit_width, left, left ? "≤" : " ", + right ? "<" : " ", limit_width, right, + tally_width, n + end +end + +limits = [23, 37, 43, 53, 67, 83] +data = [95,21,94,12,99,4,70,75,83,93,52,80,57,5,53,86,65,17,92,83,71,61,54,58,47, + 16, 8, 9,32,84,7,87,46,19,30,37,96,6,98,40,79,97,45,64,60,29,49,36,43,55] + +puts "P. 1" +print_bins(limits, bin(limits, data)) +puts + +limits = [14, 18, 249, 312, 389, 392, 513, 591, 634, 720] +data = [445,814,519,697,700,130,255,889,481,122,932, 77,323,525,570,219,367,523,442,933, + 416,589,930,373,202,253,775, 47,731,685,293,126,133,450,545,100,741,583,763,306, + 655,267,248,477,549,238, 62,678, 98,534,622,907,406,714,184,391,913, 42,560,247, + 346,860, 56,138,546, 38,985,948, 58,213,799,319,390,634,458,945,733,507,916,123, + 345,110,720,917,313,845,426, 9,457,628,410,723,354,895,881,953,677,137,397, 97, + 854,740, 83,216,421, 94,517,479,292,963,376,981,480, 39,257,272,157, 5,316,395, + 787,942,456,242,759,898,576, 67,298,425,894,435,831,241,989,614,987,770,384,692, + 698,765,331,487,251,600,879,342,982,527,736,795,585, 40, 54,901,408,359,577,237, + 605,847,353,968,832,205,838,427,876,959,686,646,835,127,621,892,443,198,988,791, + 466, 23,707,467, 33,670,921,180,991,396,160,436,717,918, 8,374,101,684,727,749] + +puts "P. 2" +print_bins(limits, bin(limits, data)) diff --git a/Task/Bin-given-limits/DuckDB/bin-given-limits-1.duckdb b/Task/Bin-given-limits/DuckDB/bin-given-limits-1.duckdb new file mode 100644 index 0000000000..3ac65257db --- /dev/null +++ b/Task/Bin-given-limits/DuckDB/bin-given-limits-1.duckdb @@ -0,0 +1,24 @@ +# Return 'inf'::DOUBLE if the value is too large +# Assume limits is sorted +create or replace function classify(x, limits) as ( + with recursive cte as ( + select 0 as i, null as found + union all + select i+1, if(x < limits[1+i], limits[1+i], null) as found + from cte + where found is null and i < length(limits) + ) + select coalesce(last(found order by i), 'inf'::DOUBLE) from cte +); + +create or replace function bins(data, limits) as table ( + select value, classify(value, limits) + from unnest(data) _(value) +); + +set variable limits = [23, 37, 43, 53, 67, 83]; +set variable data = [95,21,94,12,99,4,70,75,83,93,52,80,57,5,53,86,65,17,92,83,71,61,54,58,47, + 16, 8, 9,32,84,7,87,46,19,30,37,96,6,98,40,79,97,45,64,60,29,49,36,43,55]; + +select histogram(boundary) +from bins(getvariable('data'), getvariable('limits') ) t(value, boundary); diff --git a/Task/Bin-given-limits/DuckDB/bin-given-limits-2.duckdb b/Task/Bin-given-limits/DuckDB/bin-given-limits-2.duckdb new file mode 100644 index 0000000000..dcd69d9fe2 --- /dev/null +++ b/Task/Bin-given-limits/DuckDB/bin-given-limits-2.duckdb @@ -0,0 +1,14 @@ +# "pretty print" the histogram as a table +create or replace function pp(data, limits) as table ( + with hist as ( + select histogram(boundary) as h + from bins(data, limits) t(value, boundary) + ), + upper as (select h['inf'::DOUBLE][1] as upper from hist) + select '< ' || x::VARCHAR as bin, (select coalesce(h[x][1],0) from hist) as frequency + from unnest(limits) _(x) + union all + select '< inf', upper from upper +); + +from pp(getvariable('data'), getvariable('limits')); diff --git a/Task/Bin-given-limits/EasyLang/bin-given-limits.easy b/Task/Bin-given-limits/EasyLang/bin-given-limits.easy new file mode 100644 index 0000000000..534a7c72d0 --- /dev/null +++ b/Task/Bin-given-limits/EasyLang/bin-given-limits.easy @@ -0,0 +1,23 @@ +global limits[] data[] . +# +proc count . + len cnt[] len limits[] + 1 + for e in data[] + for i to len limits[] + if e < limits[i] : break 1 + . + cnt[i] += 1 + . + for i to len limits[] + print "< " & limits[i] & " : " & cnt[i] + . + print "Rest: " & cnt[i] + print "" +. +limits[] = [ 23 37 43 53 67 83 ] +data[] = [ 95 21 94 12 99 4 70 75 83 93 52 80 57 5 53 86 65 17 92 83 71 61 54 58 47 16 8 9 32 84 7 87 46 19 30 37 96 6 98 40 79 97 45 64 60 29 49 36 43 55 ] +count +# +limits[] = [ 14 18 249 312 389 392 513 591 634 720 ] +data[] = [ 445 814 519 697 700 130 255 889 481 122 932 77 323 525 570 219 367 523 442 933 416 589 930 373 202 253 775 47 731 685 293 126 133 450 545 100 741 583 763 306 655 267 248 477 549 238 62 678 98 534 622 907 406 714 184 391 913 42 560 247 346 860 56 138 546 38 985 948 58 213 799 319 390 634 458 945 733 507 916 123 345 110 720 917 313 845 426 9 457 628 410 723 354 895 881 953 677 137 397 97 854 740 83 216 421 94 517 479 292 963 376 981 480 39 257 272 157 5 316 395 787 942 456 242 759 898 576 67 298 425 894 435 831 241 989 614 987 770 384 692 698 765 331 487 251 600 879 342 982 527 736 795 585 40 54 901 408 359 577 237 605 847 353 968 832 205 838 427 876 959 686 646 835 127 621 892 443 198 988 791 466 23 707 467 33 670 921 180 991 396 160 436 717 918 8 374 101 684 727 749 ] +count diff --git a/Task/Bin-given-limits/Fortran/bin-given-limits.f b/Task/Bin-given-limits/Fortran/bin-given-limits.f new file mode 100644 index 0000000000..91a2dac4bb --- /dev/null +++ b/Task/Bin-given-limits/Fortran/bin-given-limits.f @@ -0,0 +1,98 @@ +! +! Bin given limits +! tested with Intel ifx (IFX) 2025.2.1 20250806 on Kubuntu 25.10 +! GNU Fortran (Ubuntu 15.2.0-4ubuntu4) 15.2.0 on Kubuntu 25.10 +! VSI Fortran (V8.6) does compile this code because it +! does not like the dimension (*) of the parameters +! U.B., January 2026 +!============================================================================== +program binLimits + +implicit none + +! Limits and Data for first example from task description +integer, parameter :: limits1 (*) = [23, 37, 43, 53, 67, 83 ] +integer, parameter :: values1 (*) = [95,21,94,12,99,4,70,75,83,93,52,80,57,5,53,86,65,17,92,83,71,61,54,58,47, & + 16, 8, 9,32,84,7,87,46,19,30,37,96,6,98,40,79,97,45,64,60,29,49,36,43,55] + +! Second example +integer, parameter :: limits2 (*) = [14, 18, 249, 312, 389, 392, 513, 591, 634, 720] +integer, parameter :: values2 (*) = [445,814,519,697,700,130,255,889,481,122,932, 77,323,525,570,219,367,523,442,933, & + 416,589,930,373,202,253,775, 47,731,685,293,126,133,450,545,100,741,583,763,306, & + 655,267,248,477,549,238, 62,678, 98,534,622,907,406,714,184,391,913, 42,560,247, & + 346,860, 56,138,546, 38,985,948, 58,213,799,319,390,634,458,945,733,507,916,123, & + 345,110,720,917,313,845,426, 9,457,628,410,723,354,895,881,953,677,137,397, 97, & + 854,740, 83,216,421, 94,517,479,292,963,376,981,480, 39,257,272,157, 5,316,395, & + 787,942,456,242,759,898,576, 67,298,425,894,435,831,241,989,614,987,770,384,692, & + 698,765,331,487,251,600,879,342,982,527,736,795,585, 40, 54,901,408,359,577,237, & + 605,847,353,968,832,205,838,427,876,959,686,646,835,127,621,892,443,198,988,791, & + 466, 23,707,467, 33,670,921,180,991,396,160,436,717,918, 8,374,101,684,727,749] + +call solve (limits1, size(limits1), values1, size(values1)) +call solve (limits2, size(limits2), values2, size(values2)) + +contains + +! ================================================== +! Create array of Histogram bins, then print results +! ================================================== +subroutine solve (l, nl, v,nv) +integer, intent(in) :: nl, nv ! Array sizes +integer, intent(in) :: l(nl), v(nv) ! Limits and Data arryays +integer :: hist (0:nl) ! THe resultant histogram + +call build_Histogram (l,nl,v,nv,hist) +call print_LimitsAndHistogram (l,nl,hist) + +end subroutine solve + + +! ============================== +! Create array of Histogram bins +! ============================== +subroutine build_Histogram (l,nl,v,nv,hist) + +integer, intent(in) :: nl, nv ! Array sizes +integer, intent(in) :: l(nl), v(nv) ! Limits and Data arryays +integer,intent(out) :: hist (0:nl) ! The resultant histogram + +integer :: iv, il ! Loop indices into values and limits + +hist = 0 +do iv=1, nv + ! If number of limits nl is small (here: 5 resp. 10), linear search for bin is sufficient. + ! for large nl consider to use binary search, that can be more efficient. + do il= nl, 1, -1 + if (v(iv) .ge. l(il)) then + hist(il) = hist(il) + 1 + exit + else if (il .eq. 1) then + hist(0) = hist(0) + 1 + end if + end do +end do + +end subroutine build_Histogram + +subroutine print_LimitsAndHistogram (l,nl,hist) + +integer, intent(in) :: nl ! Array size +integer, intent(in) :: l(nl) ! Limits to print +integer, intent(in) :: hist (0:nl) ! Histogram values to print + +integer :: il ! Loop index + +do il=0, nl + if (il .eq. 0) then + write (*,'(" < ", i3, ": ", i3)') l(1), hist(il) + else if (il .lt. nl) then + write (*,'(">= ", i3, " ... < ", i3, ": ", i3)') l(il), l(il+1), hist(il) + else + write (*,'(">= ", i3, " : ", i3)') l(il) , hist(il) + end if +end do +write (*,*) ! 1 empty line + +end subroutine print_LimitsAndHistogram + +end program binLimits diff --git a/Task/Bin-given-limits/Free-Pascal-Lazarus/bin-given-limits.pas b/Task/Bin-given-limits/Free-Pascal-Lazarus/bin-given-limits.pas new file mode 100644 index 0000000000..393a72a5e5 --- /dev/null +++ b/Task/Bin-given-limits/Free-Pascal-Lazarus/bin-given-limits.pas @@ -0,0 +1,56 @@ +Program bin_given_limits; + +const + limits1: array of integer = (23, 37, 43, 53, 67, 83); + data1: array of integer = (95, 21, 94, 12, 99, 4, 70, 75, 83, 93, 52, 80, 57, + 5, 53, 86, 65, 17, 92, 83, 71, 61, 54, 58, 47, 16, 8, 9, 32, 84, 7, 87, 46, + 19, 30, 37, 96, 6, 98, 40, 79, 97, 45, 64, 60, 29, 49, 36, 43, 55); + limits2: array of integer = (14, 18, 249, 312, 389, 392, 513, 591, 634, 720); + data2: array of integer = (445, 814, 519, 697, 700, 130, 255, 889, 481, 122, + 932, 77, 323, 525, 570, 219, 367, 523, 442, 933, 416, 589, 930, 373, 202, + 253, 775, 47, 731, 685, 293, 126, 133, 450, 545, 100, 741, 583, 763, 306, + 655, 267, 248, 477, 549, 238, 62, 678, 98, 534, 622, 907, 406, 714, 184, + 391, 913, 42, 560, 247, 346, 860, 56, 138, 546, 38,985, 948, 58, 213, 799, + 319, 390, 634, 458, 945, 733, 507, 916, 123, 345, 110, 720, 917, 313, 845, + 426, 9, 457, 628, 410, 723, 354, 895, 881, 953, 677, 137, 397, 97, 854, 740, + 83, 216, 421, 94, 517, 479, 292, 963, 376, 981, 480, 39, 257, 272, 157, 5, + 316, 395, 787, 942, 456, 242, 759, 898, 576, 67, 298, 425, 894, 435, 831, + 241, 989, 614, 987, 770, 384, 692, 698, 765, 331, 487, 251, 600, 879, 342, + 982, 527, 736, 795, 585, 40, 54, 901, 408, 359, 577, 237, 605, 847, 353, + 968, 832, 205, 838, 427, 876, 959, 686, 646, 835, 127, 621, 892, 443, 198, + 988, 791, 466, 23, 707, 467, 33, 670, 921, 180, 991, 396, 160, 436, 717, + 918, 8, 374, 101, 684, 727, 749); + + procedure print_bins(bins, limits: array of integer); + var + i: integer; + begin + writeln(' < ', limits[0]: 3, ' := ', bins[0]: 2); + for i := 0 to high(bins) - 2 do + writeln('>= ', limits[i]: 3, ' .. < ', limits[i + 1]: 3, ' := ', bins[i + 1]: 2); + writeln('>= ', limits[high(limits)]: 3, ' := ', bins[high(bins)]: 2); + end; + + procedure do_bins(limits, Data: array of integer); + var + bins: array of integer; + i, b: integer; + begin + setlength(bins, high(limits) + 2); + for i in Data do + if i < limits[0] then Inc(bins[0]) + else + begin + for b := 1 to high(limits) do + if ((i >= limits[b - 1]) and (i < limits[b])) then Inc(bins[b]); + if i >= limits[high(limits)] then + Inc(bins[high(bins)]); + end; + print_bins(bins, limits); + end; + +begin + do_bins(limits1, data1); + writeln; + do_bins(limits2, data2); +end. diff --git a/Task/Bin-given-limits/FutureBasic/bin-given-limits.basic b/Task/Bin-given-limits/FutureBasic/bin-given-limits.basic new file mode 100644 index 0000000000..d374699b52 --- /dev/null +++ b/Task/Bin-given-limits/FutureBasic/bin-given-limits.basic @@ -0,0 +1,74 @@ +include "NSLog.incl" + +local fn Comparator( obj1 as CFTypeRef, obj2 as CFTypeRef, userData as ptr ) as NSComparisonResult +end fn = fn NumberCompare( obj1, obj2 ) + +local fn Bins( limits as CFArrayRef, dta as CFArrayRef ) as CFArrayRef + long count = len(limits) + CFMutableArrayRef result = fn MutableArrayWithCapacity( count + 1 ) + + long i + for i = 0 to count + MutableArrayAddObject( result, @0 ) + next + + NSBinarySearchingOptions options = NSBinarySearchingInsertionIndex + NSBinarySearchingLastEqual + CFNumberRef n + for n in dta + i = fn ArrayIndexOfObjectInSortedRangeUsingComparator( limits, n, fn CFRangeMake( 0, count ), options, @fn Comparator, NULL ) + mid( result, i ) = @( intval(result[i]) + 1 ) + next +end fn = result + +void local fn PrintBins( limits as CFArrayRef, bins as CFArrayRef ) + long n = len(limits) + + if ( n == 0 ) then return + + NSLog(@" < %3ld: %2ld", intval(limits[0]), intval(bins[0])) + + long i + for i = 1 to n - 1 + NSLog(@">= %3ld and < %3ld: %2ld", intval(limits[i-1]), intval(limits[i]), intval(bins[i])) + next + + NSLog(@">= %3ld : %2ld", intval(limits[n-1]), intval(bins[n])) +end fn + +void local fn Doit + CFArrayRef limits = @[@23, @37, @43, @53, @67, @83] + CFArrayRef dta = @[ + @95, @21, @94, @12, @99, @4, @70, @75, @83, @93, @52, @80, @57, @5, @53, @86, @65, + @17, @92, @83, @71, @61, @54, @58, @47, @16, @8, @9, @32, @84, @7, @87, @46, @19, + @30, @37, @96, @6, @98, @40, @79, @97, @45, @64, @60, @29, @49, @36, @43, @55] + + NSLog(@"Example 1:") + fn PrintBins( limits, fn Bins(limits, dta) ) + + + limits = @[@14, @18, @249, @312, @389, @392, @513, @591, @634, @720] + dta = @[ + @445, @814, @519, @697, @700, @130, @255, @889, @481, @122, @932, @77, @323, @525, + @570, @219, @367, @523, @442, @933, @416, @589, @930, @373, @202, @253, @775, @47, + @731, @685, @293, @126, @133, @450, @545, @100, @741, @583, @763, @306, @655, @267, + @248, @477, @549, @238, @62, @678, @98, @534, @622, @907, @406, @714, @184, @391, + @913, @42, @560, @247, @346, @860, @56, @138, @546, @38, @985, @948, @58, @213, + @799, @319, @390, @634, @458, @945, @733, @507, @916, @123, @345, @110, @720, @917, + @313, @845, @426, @9, @457, @628, @410, @723, @354, @895, @881, @953, @677, @137, + @397, @97, @854, @740, @83, @216, @421, @94, @517, @479, @292, @963, @376, @981, + @480, @39, @257, @272, @157, @5, @316, @395, @787, @942, @456, @242, @759, @898, + @576, @67, @298, @425, @894, @435, @831, @241, @989, @614, @987, @770, @384, @692, + @698, @765, @331, @487, @251, @600, @879, @342, @982, @527, @736, @795, @585, @40, + @54, @901, @408, @359, @577, @237, @605, @847, @353, @968, @832, @205, @838, @427, + @876, @959, @686, @646, @835, @127, @621, @892, @443, @198, @988, @791, @466, @23, + @707, @467, @33, @670, @921, @180, @991, @396, @160, @436, @717, @918, @8, @374, + @101, @684, @727, @749] + + NSLog(@"") + NSLog(@"Example 2:") + fn PrintBins(limits, fn Bins(limits, dta)) +end fn + +fn DoIt + +HandleEvents diff --git a/Task/Bin-given-limits/Icon/bin-given-limits.icon b/Task/Bin-given-limits/Icon/bin-given-limits.icon new file mode 100644 index 0000000000..dc6aaa8920 --- /dev/null +++ b/Task/Bin-given-limits/Icon/bin-given-limits.icon @@ -0,0 +1,43 @@ +procedure main() + limits := [23, 37, 43, 53, 67, 83] + data := [95,21,94,12,99,4,70,75,83,93,52,80,57,5,53,86,65,17,92,83,71, + 61,54,58,47,16, 8, 9,32,84,7,87,46,19,30,37,96,6,98,40,79,97, + 45,64,60,29,49,36,43,55] + write("1st limits and data set:") + bins := buildbins(limits, data) + summary(limits, bins) + + limits := [14, 18, 249, 312, 389, 392, 513, 591, 634, 720] + data := [445,814,519,697,700,130,255,889,481,122,932, 77,323,525,570, + 219,367,523,442,933,416,589,930,373,202,253,775, 47,731,685, + 293,126,133,450,545,100,741,583,763,306,655,267,248,477,549, + 238, 62,678, 98,534,622,907,406,714,184,391,913, 42,560,247, + 346,860, 56,138,546, 38,985,948, 58,213,799,319,390,634,458, + 945,733,507,916,123,345,110,720,917,313,845,426, 9,457,628, + 410,723,354,895,881,953,677,137,397, 97,854,740, 83,216,421, + 94,517,479,292,963,376,981,480, 39,257,272,157, 5,316,395, + 787,942,456,242,759,898,576, 67,298,425,894,435,831,241,989, + 614,987,770,384,692,698,765,331,487,251,600,879,342,982,527, + 736,795,585, 40, 54,901,408,359,577,237,605,847,353,968,832, + 205,838,427,876,959,686,646,835,127,621,892,443,198,988,791, + 466, 23,707,467, 33,670,921,180,991,396,160,436,717,918, 8, + 374,101,684,727,749] + write("\n2nd limits and data set:") + bins := buildbins(limits, data) + summary(limits, bins) +end + +procedure buildbins(limits, data) + bins := list(*limits+1, 0) + every item := !data do + if item < (limits[i := 1 to *limits]) then bins[i] +:= 1 + else bins[*limits+1] +:= 1 + return bins +end + +procedure summary(limits, bins) + write(repl(" ",8)," < ",right(limits[1],5)," -> ",right(bins[1],4)) + every i := 2 to *limits do + write(right(limits[i-1],8)," .. ",right(limits[i],4)," -> ",right(bins[i],4)) + write(right("> ",11),right(limits[*limits],5)," -> ",right(bins[*bins],4)) +end diff --git a/Task/Bin-given-limits/Julia/bin-given-limits.julia b/Task/Bin-given-limits/Julia/bin-given-limits.jl similarity index 100% rename from Task/Bin-given-limits/Julia/bin-given-limits.julia rename to Task/Bin-given-limits/Julia/bin-given-limits.jl diff --git a/Task/Bin-given-limits/Perl/bin-given-limits-3.pl b/Task/Bin-given-limits/Perl/bin-given-limits-3.pl new file mode 100644 index 0000000000..854d56e080 --- /dev/null +++ b/Task/Bin-given-limits/Perl/bin-given-limits-3.pl @@ -0,0 +1,43 @@ +#!/usr/bin/perl + +use strict; # https://rosettacode.org/wiki/Bin_given_limits +use warnings; +use List::MoreUtils qw( upper_bound slide ); + +for ( +{ +example => 1, +limits => [23, 37, 43, 53, 67, 83], +data => [ + 95,21,94,12,99,4,70,75,83,93,52,80,57, 5,53,86,65,17,92,83,71,61,54,58,47, + 16, 8, 9,32,84,7,87,46,19,30,37,96, 6,98,40,79,97,45,64,60,29,49,36,43,55 +] +}, +{ +example => 2, +limits => [14, 18, 249, 312, 389, 392, 513, 591, 634, 720], +data => [ + 445,814,519,697,700,130,255,889,481,122,932, 77,323,525,570,219,367,523,442,933, + 416,589,930,373,202,253,775, 47,731,685,293,126,133,450,545,100,741,583,763,306, + 655,267,248,477,549,238, 62,678, 98,534,622,907,406,714,184,391,913, 42,560,247, + 346,860, 56,138,546, 38,985,948, 58,213,799,319,390,634,458,945,733,507,916,123, + 345,110,720,917,313,845,426, 9,457,628,410,723,354,895,881,953,677,137,397, 97, + 854,740, 83,216,421, 94,517,479,292,963,376,981,480, 39,257,272,157, 5,316,395, + 787,942,456,242,759,898,576, 67,298,425,894,435,831,241,989,614,987,770,384,692, + 698,765,331,487,251,600,879,342,982,527,736,795,585, 40, 54,901,408,359,577,237, + 605,847,353,968,832,205,838,427,876,959,686,646,835,127,621,892,443,198,988,791, + 466, 23,707,467, 33,670,921,180,991,396,160,436,717,918, 8,374,101,684,727,749 +] +} +) + { + print "\nExample $_->{example}:\n"; + my @bins; + my @limits = @{ $_->{limits} }; + for my $n ( @{ $_->{data} } ) + { + $bins[ upper_bound { $_ <=> $n } @limits ]++; + } + slide { printf "%4s <= value < %4s : %d\n", $a, $b, shift @bins // 0 } + '-inf', @limits, '+inf'; + } diff --git a/Task/Bin-given-limits/Phix/bin-given-limits.phix b/Task/Bin-given-limits/Phix/bin-given-limits.phix index 524dd12a08..5ca8990539 100644 --- a/Task/Bin-given-limits/Phix/bin-given-limits.phix +++ b/Task/Bin-given-limits/Phix/bin-given-limits.phix @@ -1,42 +1,40 @@ -(phixonline)--> - with javascript_semantics - function bin_it(sequence limits, data) - -- Bin data according to (ascending) limits. - sequence bins = repeat(0,length(limits)+1) -- adds under/over range bins too - for i=1 to length(data) do - integer bdx = binary_search(data[i],limits) - bdx = abs(bdx)+(bdx>0) - bins[bdx] += 1 - end for - return bins - end function +with javascript_semantics +function bin_it(sequence limits, data) + -- Bin data according to (ascending) limits. + sequence bins = repeat(0,length(limits)+1) -- adds under/over range bins too + for i=1 to length(data) do + integer bdx = binary_search(data[i],limits) + bdx = abs(bdx)+(bdx>0) + bins[bdx] += 1 + end for + return bins +end function - procedure bin_print(sequence limits, bins) - printf(1," < %3d := %3d\n",{limits[1],bins[1]}) - for i=2 to length(limits) do - printf(1,">= %3d and < %3d := %3d\n",{limits[i-1],limits[i],bins[i]}) - end for - printf(1,">= %3d := %3d\n\n",{limits[$],bins[$]}) - end procedure +procedure bin_print(sequence limits, bins) + printf(1," < %3d := %3d\n",{limits[1],bins[1]}) + for i=2 to length(limits) do + printf(1,">= %3d and < %3d := %3d\n",{limits[i-1],limits[i],bins[i]}) + end for + printf(1,">= %3d := %3d\n\n",{limits[$],bins[$]}) +end procedure - sequence limits, data - printf(1,"Example 1:\n") - limits = {23, 37, 43, 53, 67, 83} - data = {95,21,94,12,99,4,70,75,83,93,52,80,57,5,53,86,65,17,92,83,71,61,54,58,47, - 16, 8, 9,32,84,7,87,46,19,30,37,96,6,98,40,79,97,45,64,60,29,49,36,43,55} - bin_print(limits, bin_it(limits, data)) +sequence limits, data +printf(1,"Example 1:\n") +limits = {23, 37, 43, 53, 67, 83} +data = {95,21,94,12,99,4,70,75,83,93,52,80,57,5,53,86,65,17,92,83,71,61,54,58,47, + 16, 8, 9,32,84,7,87,46,19,30,37,96,6,98,40,79,97,45,64,60,29,49,36,43,55} +bin_print(limits, bin_it(limits, data)) - printf(1,"Example 2:\n") - limits = {14, 18, 249, 312, 389, 392, 513, 591, 634, 720} - data = {445,814,519,697,700,130,255,889,481,122,932, 77,323,525,570,219,367,523,442,933, - 416,589,930,373,202,253,775, 47,731,685,293,126,133,450,545,100,741,583,763,306, - 655,267,248,477,549,238, 62,678, 98,534,622,907,406,714,184,391,913, 42,560,247, - 346,860, 56,138,546, 38,985,948, 58,213,799,319,390,634,458,945,733,507,916,123, - 345,110,720,917,313,845,426, 9,457,628,410,723,354,895,881,953,677,137,397, 97, - 854,740, 83,216,421, 94,517,479,292,963,376,981,480, 39,257,272,157, 5,316,395, - 787,942,456,242,759,898,576, 67,298,425,894,435,831,241,989,614,987,770,384,692, - 698,765,331,487,251,600,879,342,982,527,736,795,585, 40, 54,901,408,359,577,237, - 605,847,353,968,832,205,838,427,876,959,686,646,835,127,621,892,443,198,988,791, - 466, 23,707,467, 33,670,921,180,991,396,160,436,717,918, 8,374,101,684,727,749} - bin_print(limits, bin_it(limits, data)) - [ ) + + [ dup size 1+ 0 swap of + swap rot witheach + [ over + findwith [ over > ] drop + swap dip inc ] + drop ] is ->bins ( [ [ --> [ ) + + [ tuck ->bins + say "Less than " + over 0 peek echo + say ": " behead echo cr + dup size 1 - times + [ over i^ peek echo + say " or more, " + say "but less than " + over i^ 1+ peek echo + say ": " + dup i^ peek echo cr ] + swap + -1 peek echo + say " or more: " + -1 peek echo cr ] is report ( [ [ --> ) + + ' [ 95 21 94 12 99 4 70 75 83 93 + 52 80 57 5 53 86 65 17 92 83 + 71 61 54 58 47 16 8 9 32 84 + 7 87 46 19 30 37 96 6 98 40 + 79 97 45 64 60 29 49 36 43 55 ] + + ' [ 23 37 43 53 67 83 ] + + say "Part 1" cr cr + report cr cr + + ' [ 445 814 519 697 700 130 255 889 481 122 + 932 77 323 525 570 219 367 523 442 933 + 416 589 930 373 202 253 775 47 731 685 + 293 126 133 450 545 100 741 583 763 306 + 655 267 248 477 549 238 62 678 98 534 + 622 907 406 714 184 391 913 42 560 247 + 346 860 56 138 546 38 985 948 58 213 + 799 319 390 634 458 945 733 507 916 123 + 345 110 720 917 313 845 426 9 457 628 + 410 723 354 895 881 953 677 137 397 97 + 854 740 83 216 421 94 517 479 292 963 + 376 981 480 39 257 272 157 5 316 395 + 787 942 456 242 759 898 576 67 298 425 + 894 435 831 241 989 614 987 770 384 692 + 698 765 331 487 251 600 879 342 982 527 + 736 795 585 40 54 901 408 359 577 237 + 605 847 353 968 832 205 838 427 876 959 + 686 646 835 127 621 892 443 198 988 791 + 466 23 707 467 33 670 921 180 991 396 + 160 436 717 918 8 374 101 684 727 749 ] + + ' [ 14 18 249 312 389 392 513 591 634 720 ] + + say "Part 2" cr cr + report diff --git a/Task/Bin-given-limits/REXX/bin-given-limits.rexx b/Task/Bin-given-limits/REXX/bin-given-limits.rexx index c37a925865..d4b06a8c85 100644 --- a/Task/Bin-given-limits/REXX/bin-given-limits.rexx +++ b/Task/Bin-given-limits/REXX/bin-given-limits.rexx @@ -1,42 +1,67 @@ -/*REXX program counts how many numbers of a set that fall in the range of each bin. */ -lims= 23 37 43 53 67 83 /* ◄■■■■■■1st set of bin limits & data.*/ -data= 95 21 94 12 99 4 70 75 83 93 52 80 57 5 53 86 65 17 92 83 71 61 54 58 47 , +/*REXX program counts how many numbers of a set that fall in the range of each bin. */ +lims= 23 37 43 53 67 83 /* <----- 1st set of bin limits & data.*/ +data= 95 21 94 12 99 4 70 75 83 93 52 80 57 5 53 86 65 17 92 83 71 61 54 58 47, 16 8 9 32 84 7 87 46 19 30 37 96 6 98 40 79 97 45 64 60 29 49 36 43 55 -call lims lims; call bins data +call limits lims +call bins data call show 'the 1st set of bin counts for the specified data:' - say; say; say -lims= 14 18 249 312 389 392 513 591 634 720 /* ◄■■■■■■2nd set of bin limits & data.*/ -data= 445 814 519 697 700 130 255 889 481 122 932 77 323 525 570 219 367 523 442 933 , - 416 589 930 373 202 253 775 47 731 685 293 126 133 450 545 100 741 583 763 306 , - 655 267 248 477 549 238 62 678 98 534 622 907 406 714 184 391 913 42 560 247 , - 346 860 56 138 546 38 985 948 58 213 799 319 390 634 458 945 733 507 916 123 , - 345 110 720 917 313 845 426 9 457 628 410 723 354 895 881 953 677 137 397 97 , - 854 740 83 216 421 94 517 479 292 963 376 981 480 39 257 272 157 5 316 395 , - 787 942 456 242 759 898 576 67 298 425 894 435 831 241 989 614 987 770 384 692 , - 698 765 331 487 251 600 879 342 982 527 736 795 585 40 54 901 408 359 577 237 , - 605 847 353 968 832 205 838 427 876 959 686 646 835 127 621 892 443 198 988 791 , +Do 3; say''; End +lims= 14 18 249 312 389 392 513 591 634 720 /* <-----2nd set of bin limits & data.*/ +data= 445 814 519 697 700 130 255 889 481 122 932 77 323 525 570 219 367 523 442 933, + 416 589 930 373 202 253 775 47 731 685 293 126 133 450 545 100 741 583 763 306, + 655 267 248 477 549 238 62 678 98 534 622 907 406 714 184 391 913 42 560 247, + 346 860 56 138 546 38 985 948 58 213 799 319 390 634 458 945 733 507 916 123, + 345 110 720 917 313 845 426 9 457 628 410 723 354 895 881 953 677 137 397 97, + 854 740 83 216 421 94 517 479 292 963 376 981 480 39 257 272 157 5 316 395, + 787 942 456 242 759 898 576 67 298 425 894 435 831 241 989 614 987 770 384 692, + 698 765 331 487 251 600 879 342 982 527 736 795 585 40 54 901 408 359 577 237, + 605 847 353 968 832 205 838 427 876 959 686 646 835 127 621 892 443 198 988 791, 466 23 707 467 33 670 921 180 991 396 160 436 717 918 8 374 101 684 727 749 -call lims lims; call bins data +call limits lims +call bins data call show 'the 2nd set of bin counts for the specified data:' -exit 0 /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -bins: parse arg nums; !.= 0; datum= words(nums); wc= length(datum) /*max width count.*/ - do j=1 for datum; x= word(nums, j) - do k=0 for # /*find the bin that this number is in. */ - if x < @.k then do; !.k= !.k + 1; iterate j; end /*bump a bin count*/ - end /*k*/ - !.k= !.k + 1 /*number is > the highest bin specified*/ - end /*j*/; return -/*──────────────────────────────────────────────────────────────────────────────────────*/ -lims: parse arg limList; #= words(limList); wb= 0 /*max width binLim*/ - do j=1 for #; _= j - 1; @._= word(limList, j); wb= max(wb, length(@._) ) - end /*j*/; return -/*──────────────────────────────────────────────────────────────────────────────────────*/ -show: parse arg t; say center(t, 51 ); $= left('', 9) /*$: for indentation*/ - say center('', 51, "═") /*show title separator.*/ - jp= # - 1; ge= '≥'; le='<'; eq= ' count=' - do j=0 for #; jm= j - 1; bin= right(@.j, wb) - if j==0 then say $ left('', length(ge) +3+wb+length(..) )le bin eq right(!.j, wc) - else say $ ge right(@.jm, wb) .. le bin eq right(!.j, wc) - if j==jp then say $ ge right(@.jp,wb) left('', 3+length(..)+wb) eq right(!.#, wc) - end /*j*/; return +exit 0 +/*------------------------------------------------------------------------------*/ +bins: + Parse Arg numbers + count.=0 + Do j=1 To words(numbers) + x=word(numbers,j) + Do k=1 To bins-1 Until x +int main() { + std::println("{:b}", 5); + std::println("{:b}", 50); + std::println("{:b}", 9000); } -int main(int argc, char* argv[]) { - printBits(5); - printBits(50); - printBits(9000); -} // for testing with n=0 printBits<32>(0); diff --git a/Task/Binary-digits/C++/binary-digits-3.cpp b/Task/Binary-digits/C++/binary-digits-3.cpp deleted file mode 100644 index 411105fe87..0000000000 --- a/Task/Binary-digits/C++/binary-digits-3.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include -int main(int argc, char* argv[]) { - unsigned int in[] = {5, 50, 9000}; // Use int like most programming languages - for (int i = 0; i < 3; i++) // Use all inputs - for (int at = 31; at >= 0; at--) // reverse iteration from the max bit-length to 0, because msb is at the end - if (int b = (in[i] >> at)) // skip leading zeros. Start output when significant bits are set - std::cout << ('0' + b & 1) << (!at ? "\n": ""); // '0' or '1'. Add EOL if last bit of num -} diff --git a/Task/Binary-digits/C++/binary-digits-4.cpp b/Task/Binary-digits/C++/binary-digits-4.cpp deleted file mode 100644 index d4a1ee0cc0..0000000000 --- a/Task/Binary-digits/C++/binary-digits-4.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include -int main(int argc, char* argv[]) { // Usage: program.exe 5 50 9000 - for (int i = 1; i < argc; i++) // argv[0] is program name - for (int at = 31; at >= 0; at--) // reverse iteration from the max bit-length to 0, because msb is at the end - if (int b = (atoi(argv[i]) >> at)) // skip leading zeros - std::cout << ('0' + b & 1) << (!at ? "\n": ""); // '0' or '1'. Add EOL if last bit of num -} diff --git a/Task/Binary-digits/C++/binary-digits-5.cpp b/Task/Binary-digits/C++/binary-digits-5.cpp deleted file mode 100644 index d50e44914c..0000000000 --- a/Task/Binary-digits/C++/binary-digits-5.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -std::string binary(int n) { - return n == 0 ? "" : binary(n >> 1) + std::to_string(n & 1); -} - -int main(int argc, char* argv[]) { - for (int i = 1; i < argc; ++i) { - std::cout << binary(std::stoi(argv[i])) << std::endl; - } -} diff --git a/Task/Binary-digits/C3/binary-digits.c3 b/Task/Binary-digits/C3/binary-digits.c3 new file mode 100644 index 0000000000..9b4073dfff --- /dev/null +++ b/Task/Binary-digits/C3/binary-digits.c3 @@ -0,0 +1,8 @@ +import std::io; +fn void main() +{ + io::printfn("%b", 0); + io::printfn("%b", 5); + io::printfn("%b", 50); + io::printfn("%b", 5000); +} diff --git a/Task/Binary-digits/CBASIC/binary-digits.basic b/Task/Binary-digits/CBASIC/binary-digits.basic new file mode 100644 index 0000000000..6f704244a7 --- /dev/null +++ b/Task/Binary-digits/CBASIC/binary-digits.basic @@ -0,0 +1,21 @@ +rem - Return binary representation of n as a string +def fn.bin$(n%) + s$ = "" + while n% > 0 + if (n% - (n% / 2) * 2) = 0 then \ + s$ = "0" + s$ \ + else \ + s$ = "1" + s$ + n% = n% / 2 + wend + fn.bin$ = s$ + return +fend + +rem - exercise the function + +print "5 = "; fn.bin$(5) +print "50 = "; fn.bin$(50) +print "9000 = "; fn.bin$(9000) + +end diff --git a/Task/Binary-digits/COBOL/binary-digits-1.cobol b/Task/Binary-digits/COBOL/binary-digits-1.cob similarity index 100% rename from Task/Binary-digits/COBOL/binary-digits-1.cobol rename to Task/Binary-digits/COBOL/binary-digits-1.cob diff --git a/Task/Binary-digits/COBOL/binary-digits-2.cobol b/Task/Binary-digits/COBOL/binary-digits-2.cob similarity index 100% rename from Task/Binary-digits/COBOL/binary-digits-2.cobol rename to Task/Binary-digits/COBOL/binary-digits-2.cob diff --git a/Task/Binary-digits/Chipmunk-Basic/binary-digits.basic b/Task/Binary-digits/Chipmunk-Basic/binary-digits.basic new file mode 100644 index 0000000000..0aedb75173 --- /dev/null +++ b/Task/Binary-digits/Chipmunk-Basic/binary-digits.basic @@ -0,0 +1,15 @@ +10 for c = 1 to 3 +20 read n +30 print n;"-> ";vin$(n) +40 next c +80 end +100 sub vin$(n) +110 b$ = "" +120 n = abs(int(n)) +130 ' +140 b$ = str$(n mod 2)+b$ +150 n = int(n/2) +160 if n > 0 then 130 +170 vin$ = b$ +180 end sub +200 data 5,50,9000 diff --git a/Task/Binary-digits/Crystal/binary-digits-1.crystal b/Task/Binary-digits/Crystal/binary-digits-1.cr similarity index 100% rename from Task/Binary-digits/Crystal/binary-digits-1.crystal rename to Task/Binary-digits/Crystal/binary-digits-1.cr diff --git a/Task/Binary-digits/Crystal/binary-digits-2.crystal b/Task/Binary-digits/Crystal/binary-digits-2.cr similarity index 100% rename from Task/Binary-digits/Crystal/binary-digits-2.crystal rename to Task/Binary-digits/Crystal/binary-digits-2.cr diff --git a/Task/Binary-digits/Delphi/binary-digits.delphi b/Task/Binary-digits/Delphi/binary-digits.pas similarity index 100% rename from Task/Binary-digits/Delphi/binary-digits.delphi rename to Task/Binary-digits/Delphi/binary-digits.pas diff --git a/Task/Binary-digits/Draco/binary-digits.draco b/Task/Binary-digits/Draco/binary-digits.draco new file mode 100644 index 0000000000..3fae378dd2 --- /dev/null +++ b/Task/Binary-digits/Draco/binary-digits.draco @@ -0,0 +1,5 @@ +proc main() void: + writeln(5:b); + writeln(50:b); + writeln(9000:b); +corp diff --git a/Task/Binary-digits/DuckDB/binary-digits-1.duckdb b/Task/Binary-digits/DuckDB/binary-digits-1.duckdb new file mode 100644 index 0000000000..b0439c7cc0 --- /dev/null +++ b/Task/Binary-digits/DuckDB/binary-digits-1.duckdb @@ -0,0 +1,2 @@ +SELECT n, format('{:b}', n) +FROM (select unnest(range(0, 6) || [50, 9000]) as n); diff --git a/Task/Binary-digits/DuckDB/binary-digits-2.duckdb b/Task/Binary-digits/DuckDB/binary-digits-2.duckdb new file mode 100644 index 0000000000..943b003cac --- /dev/null +++ b/Task/Binary-digits/DuckDB/binary-digits-2.duckdb @@ -0,0 +1,22 @@ +# n is assumed to be a non-negative integer +CREATE OR REPLACE FUNCTION binary_digits(n) as ( + WITH RECURSIVE cte(num, str) as ( + -- Base case + SELECT n, '' + UNION ALL + -- Recursive case: divide by 2 and build the binary string + SELECT num // 2, (num % 2) || str + FROM cte + WHERE num > 0 + ) + SELECT CASE WHEN str = '' THEN '0' ELSE str END + FROM cte + WHERE num = 0 + LIMIT 1 +); + +select n, binary_digits(n) +from (select unnest(range(0, 6) || [50, 9000]) as n); + +.maxwidth 200 +select n, binary_digits(n) from (select 123456789123456789123456789123456789 as n) diff --git a/Task/Binary-digits/EasyLang/binary-digits.easy b/Task/Binary-digits/EasyLang/binary-digits.easy index f8bc72d15f..222c41fe5e 100644 --- a/Task/Binary-digits/EasyLang/binary-digits.easy +++ b/Task/Binary-digits/EasyLang/binary-digits.easy @@ -1,14 +1,8 @@ func$ bin num . - b$ = "" - if num = 0 - b$ = "0" - . - while num > 0 - b$ = num mod 2 & b$ - num = num div 2 - . - return b$ + if num <= 1 : return num + return bin (num div 2) & num mod 2 . -print bin 2 +print bin 0 +print bin 5 print bin 50 print bin 9000 diff --git a/Task/Binary-digits/Ed/binary-digits-1.ed b/Task/Binary-digits/Ed/binary-digits-1.ed new file mode 100644 index 0000000000..e208861964 --- /dev/null +++ b/Task/Binary-digits/Ed/binary-digits-1.ed @@ -0,0 +1,2 @@ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ diff --git a/Task/Binary-digits/Ed/binary-digits-2.ed b/Task/Binary-digits/Ed/binary-digits-2.ed new file mode 100644 index 0000000000..8cd0a4f458 --- /dev/null +++ b/Task/Binary-digits/Ed/binary-digits-2.ed @@ -0,0 +1,90 @@ +# by Artyom Bologov +H +# decimal -> unary +g/[^0-9]\{1,\}/s///g +g/^0\{1,\}\([0-9]\)/s//\1/ +g/^9\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiiii/ +g/^8\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiii/ +g/^7\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiii/ +g/^6\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiii/ +g/^5\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiii/ +g/^4\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiii/ +g/^3\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iii/ +g/^2\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2ii/ +g/^1\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2i/ +g/^0\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2/ +g/^9\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiiii/ +g/^8\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiii/ +g/^7\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiii/ +g/^6\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiii/ +g/^5\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiii/ +g/^4\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiii/ +g/^3\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iii/ +g/^2\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2ii/ +g/^1\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2i/ +g/^0\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2/ +g/^9\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiiii/ +g/^8\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiii/ +g/^7\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiii/ +g/^6\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiii/ +g/^5\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiii/ +g/^4\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiii/ +g/^3\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iii/ +g/^2\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2ii/ +g/^1\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2i/ +g/^0\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2/ +g/^9\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiiii/ +g/^8\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiii/ +g/^7\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiii/ +g/^6\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiii/ +g/^5\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiii/ +g/^4\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiii/ +g/^3\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iii/ +g/^2\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2ii/ +g/^1\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2i/ +g/^0\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2/ +g/^9\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiiii/ +g/^8\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiiii/ +g/^7\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiiii/ +g/^6\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiiii/ +g/^5\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiiii/ +g/^4\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iiii/ +g/^3\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2iii/ +g/^2\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2ii/ +g/^1\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2i/ +g/^0\([0-9]*\)\(i*\)/s//\1\2\2\2\2\2\2\2\2\2\2/ +# actual logic +g/.*/s/$/0/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^\(i*\)\1i\([^i]\)/s//\11\2/ +g/^\(i*\)\1\([^i]\)/s//\10\2/ +g/^0*\(1.*\)0$/s//\1/ +,p +Q diff --git a/Task/Binary-digits/Elena/binary-digits.elena b/Task/Binary-digits/Elena/binary-digits.elena index 8fdf161ca2..a76dc82919 100644 --- a/Task/Binary-digits/Elena/binary-digits.elena +++ b/Task/Binary-digits/Elena/binary-digits.elena @@ -1,10 +1,10 @@ import system'routines; import extensions; -public program() +public Program() { - new int[]{5,50,9000}.forEach:(n) + new int[]{5,50,9000}.forEach::(n) { - console.printLine(n.toString(2)) + Console.printLine(n.toString(2)) } } diff --git a/Task/Binary-digits/Elixir/binary-digits-1.elixir b/Task/Binary-digits/Elixir/binary-digits-1.ex similarity index 100% rename from Task/Binary-digits/Elixir/binary-digits-1.elixir rename to Task/Binary-digits/Elixir/binary-digits-1.ex diff --git a/Task/Binary-digits/Elixir/binary-digits-2.elixir b/Task/Binary-digits/Elixir/binary-digits-2.ex similarity index 100% rename from Task/Binary-digits/Elixir/binary-digits-2.elixir rename to Task/Binary-digits/Elixir/binary-digits-2.ex diff --git a/Task/Binary-digits/Elixir/binary-digits-3.elixir b/Task/Binary-digits/Elixir/binary-digits-3.ex similarity index 100% rename from Task/Binary-digits/Elixir/binary-digits-3.elixir rename to Task/Binary-digits/Elixir/binary-digits-3.ex diff --git a/Task/Binary-digits/Elixir/binary-digits-4.elixir b/Task/Binary-digits/Elixir/binary-digits-4.ex similarity index 100% rename from Task/Binary-digits/Elixir/binary-digits-4.elixir rename to Task/Binary-digits/Elixir/binary-digits-4.ex diff --git a/Task/Binary-digits/Elixir/binary-digits-5.elixir b/Task/Binary-digits/Elixir/binary-digits-5.ex similarity index 100% rename from Task/Binary-digits/Elixir/binary-digits-5.elixir rename to Task/Binary-digits/Elixir/binary-digits-5.ex diff --git a/Task/Binary-digits/Emacs-Lisp/binary-digits.l b/Task/Binary-digits/Emacs-Lisp/binary-digits.el similarity index 100% rename from Task/Binary-digits/Emacs-Lisp/binary-digits.l rename to Task/Binary-digits/Emacs-Lisp/binary-digits.el diff --git a/Task/Binary-digits/Euphoria/binary-digits-1.euphoria b/Task/Binary-digits/Euphoria/binary-digits-1.eu similarity index 100% rename from Task/Binary-digits/Euphoria/binary-digits-1.euphoria rename to Task/Binary-digits/Euphoria/binary-digits-1.eu diff --git a/Task/Binary-digits/Euphoria/binary-digits-2.euphoria b/Task/Binary-digits/Euphoria/binary-digits-2.eu similarity index 100% rename from Task/Binary-digits/Euphoria/binary-digits-2.euphoria rename to Task/Binary-digits/Euphoria/binary-digits-2.eu diff --git a/Task/Binary-digits/Gleam/binary-digits.gleam b/Task/Binary-digits/Gleam/binary-digits.gleam new file mode 100644 index 0000000000..26d5c7ebab --- /dev/null +++ b/Task/Binary-digits/Gleam/binary-digits.gleam @@ -0,0 +1,9 @@ +import gleam/format +import gleam/list + +pub fn main() -> Nil { + // Using format library: https://hexdocs.pm/format/gleam/format.html + [5, 50, 9000] + |> list.map(format.printf("~.2B~n", _)) + Nil +} diff --git a/Task/Binary-digits/Haxe/binary-digits.hx b/Task/Binary-digits/Haxe/binary-digits.hx new file mode 100644 index 0000000000..f732d3f6e8 --- /dev/null +++ b/Task/Binary-digits/Haxe/binary-digits.hx @@ -0,0 +1,15 @@ +class Main { + static public function main() { + var integers = [5, 50, 9000]; + + for (i in integers) { + var bin = ""; + while (i > 1) { + bin = (i % 2) + bin; + i = Std.int(i / 2); + } + bin = i + bin; + trace(bin); + } + } +} diff --git a/Task/Binary-digits/Icon/binary-digits.icon b/Task/Binary-digits/Icon/binary-digits-1.icon similarity index 100% rename from Task/Binary-digits/Icon/binary-digits.icon rename to Task/Binary-digits/Icon/binary-digits-1.icon diff --git a/Task/Binary-digits/Icon/binary-digits-2.icon b/Task/Binary-digits/Icon/binary-digits-2.icon new file mode 100644 index 0000000000..54b725932a --- /dev/null +++ b/Task/Binary-digits/Icon/binary-digits-2.icon @@ -0,0 +1,12 @@ +procedure main() + every write(bstring(0|5|50|255|1285|9000)) +end + +procedure bstring(i) + s := "" + repeat{ + s := string(iand(i,1)) || s + if (i := ishift(i,-1)) = 0 then break + } + return s +end diff --git a/Task/Binary-digits/J/binary-digits.j b/Task/Binary-digits/J/binary-digits.j index c8ef29b83f..473f04fb1d 100644 --- a/Task/Binary-digits/J/binary-digits.j +++ b/Task/Binary-digits/J/binary-digits.j @@ -1,4 +1,4 @@ - tobin=: -.&' '@":@#: + tobin=: '01'{~#: tobin 5 101 tobin 50 diff --git a/Task/Binary-digits/Julia/binary-digits.julia b/Task/Binary-digits/Julia/binary-digits.jl similarity index 100% rename from Task/Binary-digits/Julia/binary-digits.julia rename to Task/Binary-digits/Julia/binary-digits.jl diff --git a/Task/Binary-digits/Kotlin/binary-digits.kotlin b/Task/Binary-digits/Kotlin/binary-digits.kts similarity index 100% rename from Task/Binary-digits/Kotlin/binary-digits.kotlin rename to Task/Binary-digits/Kotlin/binary-digits.kts diff --git a/Task/Binary-digits/LSL/binary-digits.lsl b/Task/Binary-digits/LSL/binary-digits.lsl new file mode 100644 index 0000000000..d0381e6ce8 --- /dev/null +++ b/Task/Binary-digits/LSL/binary-digits.lsl @@ -0,0 +1,75 @@ +/* This script could convert base10 to any base number system, & in any symbol-set +charset can be anything, any symbols, but the frist one should be the zero symbol */ +string charset = "01"; + +string int2chr(integer int) { +// convert integer to unsigned charset + integer base = llStringLength(charset); + string out; + integer j; + if(int < 0) { + j = ((0x7FFFFFFF & int) % base) - (0x80000000 % base); + integer k = j % base; + int = (j / base) + ((0x7FFFFFFF & int) / base) - (0x80000000 / base); + out = llGetSubString(charset, k, k); + } + do + out = llGetSubString(charset, j = int % base, j) + out; + while(int /= base); + return out; +} + +integer chr2int(string chr) { +// convert unsigned charset to integer + integer base = llStringLength(charset); + integer i = -llStringLength(chr); + integer j = 0; + while(i) + j = (j * base) + llSubStringIndex(charset, llGetSubString(chr, i, i++)); + return j; +} + +string pad (string input, integer width) +{ + integer i=llStringLength(input); + string zero=llGetSubString(charset,0,0); +//first symbol of charset should be for zero +// add padding if necessary + + while(width>i) + { + i=i+1; + input=zero+input; // prepend string and loop + } +// take away padding if necessary + + while(width Hex2Binary -> Normalize +say left(xx,9) '=' X2B(D2X(xx)) +say left(xx,9) '=' X2B(D2X(xx))+0 +return 0 + +include Math diff --git a/Task/Binary-digits/RISC-V-Assembly/binary-digits.asm b/Task/Binary-digits/RISC-V-Assembly/binary-digits.asm new file mode 100644 index 0000000000..4c9a8b927b --- /dev/null +++ b/Task/Binary-digits/RISC-V-Assembly/binary-digits.asm @@ -0,0 +1,185 @@ + # riscv assembly raspberry pico2 rp2350 +# program binaryDigits.s +# For construction see the riscv main page +# Exec by connexion putty com3 +/*********************************************/ +/* CONSTANTES */ +/********************************************/ +.equ LENGTHDEC, 12 +.equ LENGTHBIN, 33 +/*******************************************/ +/* INITIALED DATAS */ +/*******************************************/ +.data +szMessStart: .asciz "Program riscv start.\r\n" + +szMessAffdeb: .asciz "Decimal value : " +szMessAfffin: .asciz " binary value : " +szCarriageReturn: .asciz " \r\n" +/*******************************************/ +/* UNINITIALED DATA */ +/*******************************************/ +.bss +sConvDec: .skip LENGTHDEC +sConvBin: .skip LENGTHBIN +.align 2 +/**********************************************/ +/* SECTION CODE */ +/**********************************************/ +.text +.global main + +main: + call stdio_init_all # général init +1: # start loop connexion + li a0,0 # raz argument register + call tud_cdc_n_connected # connexion usb by function sdk c++ + beqz a0,1b # return code = zero ? loop + + la a0,szMessStart # message address + call writeString # display string + li a0,50 + call conversion + li a0,-1 + call conversion + li a0,1 + call conversion + li a0,1<<30 + call conversion + call getchar +100: # final loop + j 100b +/************************************/ +/* conversion and display */ +/***********************************/ +/* a0 value */ +conversion: + addi sp, sp, -8 + sw ra, 0(sp) # save registers + sw s0, 4(sp) + mv s0,a0 + la a0,szMessAffdeb + call writeString # display message + mv a0,s0 + la a1,sConvDec + call conversion10S + call writeString # display + la a0,szMessAfffin + call writeString # display message + mv a0,s0 + la a1,sConvBin + call conversion2 + la a0,sConvBin + call writeString # display message + la a0,szCarriageReturn + call writeString # display newline + +100: + lw ra, 0(sp) # restaur registers + lw s0, 4(sp) + addi sp, sp, 8 + ret +/************************************/ +/* binary conversion */ +/***********************************/ +/* a0 value */ +/* a1 result area address */ +/* size mini 33 character */ +conversion2: # INFO: conversion2 + addi sp, sp, -8 # save registres + sw ra, 0(sp) + li t2,0 + li t1,0 +1: + slt t3,a0,x0 # if negative bit 31 is 1 + + slli a0,a0,1 # shift left one bit + add t0,a1,t1 # compute indice to store char in area + addi t3,t3,'0' # conversion byte to ascii char + sb t3,(t0) # store char in area + addi t1,t1,1 # next position + li t0,7 # for add a space separation + beq t2,t0,4f + li t0,15 # for add a space + beq t2,t0,4f + li t0,23 # for add a space + beq t2,t0,4f + j 5f + +4: # store space + li t3,' ' + add t0,a1,t1 + sb t3,(t0) + addi t1,t1,1 +5: + addi t2,t2,1 # increment bit indice + li t0,32 # maxi ? + blt t2,t0,1b # and loop + + add t0,a1,t1 + sb x0,(t0) # final zero +100: + lw ra, 0(sp) + addi sp, sp, 8 + ret +/***************************************************/ +/* register conversion in décimal signed */ +/***************************************************/ +/* a0 value */ +/* a1 result area address size mini 12c */ +/* a0 return result start address */ +/* a1 return characters number in area */ +conversion10S: # INFO: conversion10S + addi sp, sp, -8 # save registers + sw ra, 0(sp) + mv t5,a1 # begin store area + li t6,'+' + bge a0,x0,1f # positive number ? + li t6,'-' # negative + sub a0,x0,a0 # inversion +1: + li t4,LENGTHDEC # area size + add t2,t4,t5 + sb x0,(t2) # final zero + addi t4,t4,-1 # position précedente + li t1,10 +2: + remu t3,a0,t1 # reminder division by 10 + addi t3,t3,48 # conversion ascii + add t2,t4,t5 # compute store indice + sb t3,(t2) + addi t4,t4,-1 # position précedente + divu a0,a0,t1 # division by 10 + bne a0,x0,2b + # store signe in current position + add t2,t4,t5 + sb t6,(t2) +3: + add a0,t4,t5 # return store area begin address + li t0,LENGTHDEC # and size + sub a1,t0,t4 + +100: + lw ra, 0(sp) # restaur registers + addi sp, sp, 8 + ret +/************************************/ +/* string write on connexion usb */ +/***********************************/ +/* a0 String address */ +writeString: # INFO: writeString + addi sp, sp, -8 # save registers on stack + sw ra, 0(sp) + sw s0, 4(sp) + mv s0,a0 # save address +1: + lbu a0,(s0) # load one character + beqz a0,100f # end if zero + call __wrap_putchar # character write + add s0,s0,1 # increment address + j 1b # and loop +100: + lw ra, 0(sp) # restaur registers + lw s0, 4(sp) + addi sp, sp, 8 + ret diff --git a/Task/Binary-digits/Rebol/binary-digits.rebol b/Task/Binary-digits/Rebol/binary-digits.rebol new file mode 100644 index 0000000000..8796ee675f --- /dev/null +++ b/Task/Binary-digits/Rebol/binary-digits.rebol @@ -0,0 +1,5 @@ +foreach number [5 50 9000] [ + ;; any returns first not false value, used to cut leading zeroes + binstr: copy any [find enbase/flat to binary! number 2 #"1" #"0"] + print reduce [ pad number -5 binstr ] +] diff --git a/Task/Binary-digits/Refal/binary-digits.refal b/Task/Binary-digits/Refal/binary-digits.refal new file mode 100644 index 0000000000..da17d999cb --- /dev/null +++ b/Task/Binary-digits/Refal/binary-digits.refal @@ -0,0 +1,15 @@ +$ENTRY Go { + = + + >; +}; + +Binary { + 0 = '0\n'; + s.N = '\n'; +}; + +Binary1 { + 0 = ; + s.N, : (s.R) s.D = ; +}; diff --git a/Task/Binary-digits/Roc/binary-digits.roc b/Task/Binary-digits/Roc/binary-digits.roc new file mode 100644 index 0000000000..db133b0da5 --- /dev/null +++ b/Task/Binary-digits/Roc/binary-digits.roc @@ -0,0 +1,6 @@ +binstr : Int * -> Str +binstr = \n -> + if n < 2 then + Num.toStr n + else + Str.concat (binstr (Num.shiftRightZfBy n 1)) (Num.toStr (Num.bitwiseAnd n 1)) diff --git a/Task/Binary-digits/Rust/binary-digits.rust b/Task/Binary-digits/Rust/binary-digits.rs similarity index 100% rename from Task/Binary-digits/Rust/binary-digits.rust rename to Task/Binary-digits/Rust/binary-digits.rs diff --git a/Task/Binary-digits/SETL/binary-digits.setl b/Task/Binary-digits/SETL/binary-digits.setl new file mode 100644 index 0000000000..6cfe046536 --- /dev/null +++ b/Task/Binary-digits/SETL/binary-digits.setl @@ -0,0 +1,9 @@ +program binary_digits; + loop for n in [5, 50, 9000] do + print(bin n); + end loop; + + op bin(n); + return reverse +/[str [n mod 2, n div:=2](1) : until n=0]; + end op; +end program; diff --git a/Task/Binary-digits/Scheme/binary-digits.ss b/Task/Binary-digits/Scheme/binary-digits.scm similarity index 100% rename from Task/Binary-digits/Scheme/binary-digits.ss rename to Task/Binary-digits/Scheme/binary-digits.scm diff --git a/Task/Binary-digits/Uiua/binary-digits.uiua b/Task/Binary-digits/Uiua/binary-digits.uiua new file mode 100644 index 0000000000..68ccbb0d2e --- /dev/null +++ b/Task/Binary-digits/Uiua/binary-digits.uiua @@ -0,0 +1,2 @@ +PrintBits ← &p/$"__"⇌⋯ +≡PrintBits 5_50_9000 diff --git a/Task/Binary-digits/VBScript/binary-digits.vb b/Task/Binary-digits/VBScript/binary-digits.vbs similarity index 100% rename from Task/Binary-digits/VBScript/binary-digits.vb rename to Task/Binary-digits/VBScript/binary-digits.vbs diff --git a/Task/Binary-digits/Wren/binary-digits.wren b/Task/Binary-digits/Wren/binary-digits.wren index 6c6c3d3cb3..fbae7f0348 100644 --- a/Task/Binary-digits/Wren/binary-digits.wren +++ b/Task/Binary-digits/Wren/binary-digits.wren @@ -1,4 +1,4 @@ -import "/fmt" for Fmt +import "./fmt" for Fmt System.print("Converting to binary:") for (i in [5, 50, 9000]) Fmt.print("$d -> $b", i, i) diff --git a/Task/Binary-digits/X86-64-Assembly/binary-digits-1.x86-64 b/Task/Binary-digits/X86-64-Assembly/binary-digits-1.x86-64 new file mode 100644 index 0000000000..5fc98ac09e --- /dev/null +++ b/Task/Binary-digits/X86-64-Assembly/binary-digits-1.x86-64 @@ -0,0 +1,45 @@ +format ELF64 executable 9 + +segment readable + nums: dd 5, 50, 9000, 0 ;numbers to convert, 0 as end of data indicator + +segment readable writable + result: times 16 db 0 ;empty string for printing the result later + db 10, 0 + +segment readable executable + entry start + +start: + xor rbx, rbx ;index for nums + mov eax, [nums + 4 * rbx] + mov rcx, 16 ;index for result string + +convert: + dec rcx + mov rdi, 1 ;get least significant bit + and rdi, rax + add rdi, '0' ;convert to char + mov [result + rcx], dil ;and put it in result[ecx] + shr rax, 1 ;right shift, 1 bit + test rax, rax ;eax still > 0 + jnz convert ;if yes, repeat + + mov rax, 4 ;print result + mov rdi, 1 + mov rsi, result + mov rdx, 18 + syscall + + xor rax, rax ;reset string to 0s (not strictly needed, + mov [result], rax ;because we have increasing numbers, and + mov [result + 8], rax ;old chars will be overwritten) + inc rbx ;and repeat if list isn't done + mov eax, [nums + 4 * rbx] + mov rcx, 16 + test rax, rax + jnz convert + + mov rax, 1 ;exit + xor rdi, rdi + syscall diff --git a/Task/Binary-digits/X86-64-Assembly/binary-digits-2.x86-64 b/Task/Binary-digits/X86-64-Assembly/binary-digits-2.x86-64 new file mode 100644 index 0000000000..3e9972485c --- /dev/null +++ b/Task/Binary-digits/X86-64-Assembly/binary-digits-2.x86-64 @@ -0,0 +1,150 @@ +global _start + +bsize equ 72 +outbase equ 2 ; 2 to 16 +section .text +_start: + pop rcx + dec rcx + or rcx, rcx + jz .exit0 + pop rdx + xor rdx, rdx + .cmdloop: + pop rdi + call atoq + mov qword [slot + rdx * 8], rax + inc rdx + cmp rdx, rcx + jne .cmdloop + xor rdx, rdx + .printloop: + mov rdi, qword [slot + rdx * 8] + call printq + inc rdx + cmp rdx, rcx + jne .printloop + .exit0: + mov rax, 60 + mov rdi, 0 + syscall +atoq: + push r8 + push r9 + push rdi + push rsi + push rdx + push rcx + xor rcx, rcx + xor rax, rax + xor r8, r8 + mov r9, 1 + cmp byte[rdi], 0 + jz .exit + cmp byte[rdi], '-' + jne .stbegin + mov r9, -1 + inc rdi + .stbegin: + cmp byte[rdi], '0' + jl .return + cmp byte[rdi], '9' + jg .return + .stloop: + cmp byte[rdi + r8], '0' + jl .calc0 + cmp byte[rdi + r8], '9' + jg .calc0 + mov sil, byte[rdi + r8] + sub rsi, '0' + push rsi + inc r8 + jmp .stloop + .calc0: + xor rcx, rcx + mov rdi, 10 + mov rsi, 1 + .calc1: + pop rax + mul rsi + add rcx, rax + dec r8 + jz .return + mov rax, rsi + mul rdi + mov rsi, rax + jmp .calc1 + .return: + xor rdx, rdx + mov rax, rcx + imul r9 + .exit: + pop rcx + pop rdx + pop rsi + pop rdi + pop r9 + pop r8 + ret + +printq: + push r9 + push rdi + push rsi + push rdx + push rcx + push rax + mov rax, rdi + mov r9, bsize + dec r9 + mov rsi, outbase + sub rsp, bsize + sub rax, 0 + jns .stloop + neg rax + .stloop: + xor rdx, rdx + div rsi + mov dl, byte [charset + rdx] + mov byte[rsp + r9], dl + sub rax, 0 + jz .negtest + dec r9 + jmp .stloop + .negtest: + sub rdi, 0 + jns .printit + dec r9 + mov byte[rsp + r9], '-' + .printit: + mov rdx, bsize + sub rdx, r9 + mov rsi, rsp + add rsi, r9 + mov rdi, 1 + mov rax, 1 + syscall + mov rsi, 0x0a + push rsi + mov rsi, rsp + mov rdx, 1 + mov rax, 1 + mov rdi, 1 + syscall + pop rsi + .restores: + add rsp, bsize + pop rax + pop rcx + pop rdx + pop rsi + pop rdi + pop r9 + .return: + ret + + +section .data +charset: db "0123456789abcdef" +section .bss +slot: resq 16 diff --git a/Task/Binary-digits/Zig/binary-digits.zig b/Task/Binary-digits/Zig/binary-digits.zig new file mode 100644 index 0000000000..8b207ca0b0 --- /dev/null +++ b/Task/Binary-digits/Zig/binary-digits.zig @@ -0,0 +1,7 @@ +const std = @import("std"); + +pub fn main() void { + for(0..10) |i| { + std.debug.print("{b}\n", .{i}); + } +} diff --git a/Task/Binary-search/ALGOL-68/binary-search.alg b/Task/Binary-search/ALGOL-68/binary-search.alg index 2dbfbe0670..a20f10eece 100644 --- a/Task/Binary-search/ALGOL-68/binary-search.alg +++ b/Task/Binary-search/ALGOL-68/binary-search.alg @@ -30,20 +30,19 @@ PROC recursive binary search = ([]ELEMENT hay stack, ELEMENT needle)INT: ( ELSE mid FI FI ); -# Test cases: # -test:( - ELEMENT needle = "mister"; - []ELEMENT hay stack = ("AA","Maestro","Mario","Master","Mattress","Mister","Mistress","ZZ"), - test cases = ("A","Master","Monk","ZZZ"); - - PROC test search = (PROC([]ELEMENT, ELEMENT)INT search, []ELEMENT test cases)VOID: - FOR case TO UPB test cases DO +PROC test search = (PROC([]ELEMENT, ELEMENT)INT search, []ELEMENT hay stack, []ELEMENT test cases)VOID: + FOR case TO UPB test cases DO ELEMENT needle = test cases[case]; INT index = search(hay stack, needle); BOOL found = ( index <= 0 | FALSE | hay stack[index]=needle); print(("""", needle, """ ", (found|"FOUND at"|"near"), " index ", whole(index, 0), newline)) - OD; - test search(iterative binary search, test cases); - test search(recursive binary search, test cases) -) + OD; + + BEGIN # Test cases: # + []ELEMENT hay stack = ("AA","Maestro","Mario","Master","Mattress","Mister","Mistress","ZZ") + , test cases = ("A","Master","Monk","ZZZ") + ; + test search(iterative binary search, hay stack, test cases); + test search(recursive binary search, hay stack, test cases) + END END diff --git a/Task/Binary-search/Ada/binary-search-1.ada b/Task/Binary-search/Ada/binary-search-1.adb similarity index 100% rename from Task/Binary-search/Ada/binary-search-1.ada rename to Task/Binary-search/Ada/binary-search-1.adb diff --git a/Task/Binary-search/Ada/binary-search-2.ada b/Task/Binary-search/Ada/binary-search-2.adb similarity index 100% rename from Task/Binary-search/Ada/binary-search-2.ada rename to Task/Binary-search/Ada/binary-search-2.adb diff --git a/Task/Binary-search/Arturo/binary-search.arturo b/Task/Binary-search/Arturo/binary-search.arturo index 5ac977eb88..e9488de395 100644 --- a/Task/Binary-search/Arturo/binary-search.arturo +++ b/Task/Binary-search/Arturo/binary-search.arturo @@ -1,10 +1,11 @@ binarySearch: function [arr,val,low,high][ if high < low -> return ø mid: shr low+high 1 - case [val] - when? [< arr\[mid]] -> return binarySearch arr val low mid-1 - when? [> arr\[mid]] -> return binarySearch arr val mid+1 high - else -> return mid + when.has: val [ + [< arr\[mid]] -> return binarySearch arr val low mid-1 + [> arr\[mid]] -> return binarySearch arr val mid+1 high + true -> return mid + ] ] ary: [ @@ -15,6 +16,6 @@ ary: [ loop [0 42 45 24324 99999] 'v [ i: binarySearch ary v 0 (size ary)-1 - if? not? null? i -> print ["found" v "at index:" i] - else -> print [v "not found"] + switch not? null? i -> print ["found" v "at index:" i] + -> print [v "not found"] ] diff --git a/Task/Binary-search/Bruijn/binary-search.bruijn b/Task/Binary-search/Bruijn/binary-search.bruijn new file mode 100644 index 0000000000..e8493367bf --- /dev/null +++ b/Task/Binary-search/Bruijn/binary-search.bruijn @@ -0,0 +1,18 @@ +:import std/Combinator . +:import std/Math . +:import std/List . +:import std/Option . + +binary-search [y [[[[[2 (iterate ++‣ (-50))) + +:test (find (+100)) ("not found") +:test ((head (find (+125))) =? (+55)) ([[1]]) +:test ((head (find (+117649))) =? (+99)) ([[1]]) diff --git a/Task/Binary-search/COBOL/binary-search.cobol b/Task/Binary-search/COBOL/binary-search.cob similarity index 100% rename from Task/Binary-search/COBOL/binary-search.cobol rename to Task/Binary-search/COBOL/binary-search.cob diff --git a/Task/Binary-search/Chapel/binary-search.chapel b/Task/Binary-search/Chapel/binary-search.chapel deleted file mode 100644 index c03efcb729..0000000000 --- a/Task/Binary-search/Chapel/binary-search.chapel +++ /dev/null @@ -1,17 +0,0 @@ -proc binsearch(A:[], value) { - var low = A.domain.dim(1).low; - var high = A.domain.dim(1).high; - while (low <= high) { - var mid = (low + high) / 2; - - if A(mid) > value then - high = mid - 1; - else if A(mid) < value then - low = mid + 1; - else - return mid; - } - return 0; -} - -writeln(binsearch([3, 4, 6, 9, 11], 9)); diff --git a/Task/Binary-search/Chapel/binary-search.chpl b/Task/Binary-search/Chapel/binary-search.chpl new file mode 100644 index 0000000000..e5ab05d298 --- /dev/null +++ b/Task/Binary-search/Chapel/binary-search.chpl @@ -0,0 +1,19 @@ +proc binsearch(A : [], value) +{ + var low = A.domain.dim(0).low; + var high = A.domain.dim(0).high; + while (low <= high) + { + var mid = (low + high) / 2; + + if A(mid) > value then + high = mid - 1; + else if A(mid) < value then + low = mid + 1; + else + return mid; + } + return 0; +} + +writeln(binsearch([3, 4, 6, 9, 11], 9)); diff --git a/Task/Binary-search/Crystal/binary-search-1.crystal b/Task/Binary-search/Crystal/binary-search-1.cr similarity index 100% rename from Task/Binary-search/Crystal/binary-search-1.crystal rename to Task/Binary-search/Crystal/binary-search-1.cr diff --git a/Task/Binary-search/Crystal/binary-search-2.crystal b/Task/Binary-search/Crystal/binary-search-2.cr similarity index 100% rename from Task/Binary-search/Crystal/binary-search-2.crystal rename to Task/Binary-search/Crystal/binary-search-2.cr diff --git a/Task/Binary-search/EMal/binary-search.emal b/Task/Binary-search/EMal/binary-search.emal index 6888c2fe32..f4fc192e50 100644 --- a/Task/Binary-search/EMal/binary-search.emal +++ b/Task/Binary-search/EMal/binary-search.emal @@ -1,8 +1,8 @@ type BinarySearch:Recursive -fun binarySearch = int by List values, int value - fun recurse = int by int low, int high +fun binarySearch ← int by List values, int value + fun recurse ← int by int low, int high if high < low do return -1 end - int mid = low + (high - low) / 2 + int mid ← low + (high - low) / 2 return when(values[mid] > value, recurse(low, mid - 1), when(values[mid] < value, @@ -12,23 +12,22 @@ fun binarySearch = int by List values, int value return recurse(0, values.length - 1) end type BinarySearch:Iterative -fun binarySearch = int by List values, int value - int low = 0 - int high = values.length - 1 - while low <= high - int mid = low + (high - low) / 2 - if values[mid] > value do high = mid - 1 - else if values[mid] < value do low = mid + 1 +fun binarySearch ← int by List values, int value + int low ← 0 + int high ← values.length - 1 + while low ≤ high + int mid ← low + (high - low) / 2 + if values[mid] > value do high ← mid - 1 + else if values[mid] < value do low ← mid + 1 else do return mid end end return -1 end -List values = int[0, 1, 4, 5, 6, 7, 8, 9, 12, 26, 45, 67, 78, +List values ← int[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] -List matches = int[24324, 32, 78, 287, 0, 42, 45, 99999] -for each int match in matches - writeLine("index is: " + - BinarySearch:Recursive.binarySearch(values, match) + ", " + - BinarySearch:Iterative.binarySearch(values, match)) -end +List matches ← int[24324, 32, 78, 287, 0, 42, 45, 99999] +writeLine("recursive | iterative") +matches.list( val high = mid - 1 elif a[mid] < val low = mid + 1 else - res = mid + return mid . . + return 0 . a[] = [ 2 4 6 8 9 ] -binSearch 8 a[] r -print r +print binSearch a[] 8 diff --git a/Task/Binary-search/Elixir/binary-search.elixir b/Task/Binary-search/Elixir/binary-search.ex similarity index 100% rename from Task/Binary-search/Elixir/binary-search.elixir rename to Task/Binary-search/Elixir/binary-search.ex diff --git a/Task/Binary-search/Emacs-Lisp/binary-search.l b/Task/Binary-search/Emacs-Lisp/binary-search.el similarity index 100% rename from Task/Binary-search/Emacs-Lisp/binary-search.l rename to Task/Binary-search/Emacs-Lisp/binary-search.el diff --git a/Task/Binary-search/Euphoria/binary-search-1.euphoria b/Task/Binary-search/Euphoria/binary-search-1.eu similarity index 100% rename from Task/Binary-search/Euphoria/binary-search-1.euphoria rename to Task/Binary-search/Euphoria/binary-search-1.eu diff --git a/Task/Binary-search/Euphoria/binary-search-2.euphoria b/Task/Binary-search/Euphoria/binary-search-2.eu similarity index 100% rename from Task/Binary-search/Euphoria/binary-search-2.euphoria rename to Task/Binary-search/Euphoria/binary-search-2.eu diff --git a/Task/Binary-search/FutureBasic/binary-search-1.basic b/Task/Binary-search/FutureBasic/binary-search-1.basic new file mode 100644 index 0000000000..35cd36e78c --- /dev/null +++ b/Task/Binary-search/FutureBasic/binary-search-1.basic @@ -0,0 +1,27 @@ +include "NSLog.incl" + +NSInteger local fn BinarySearch( array as CFArrayRef, key as CFTypeRef ) +NSInteger lo = 0 +NSInteger hi = len(array) - 1 +while ( lo <= hi ) + NSInteger i = lo + (hi - lo) / 2 + CFTypeRef midVal = array[i] + select ( fn NumberCompare( midVal, key ) ) + case NSOrderedAscending + lo = i + 1 + case NSOrderedDescending + hi = i - 1 + case NSOrderedSame: + return i + end select +wend +end fn = NSNotFound + +void local fn DoIt + CFArrayRef a = @[@1, @3, @4, @5, @6, @7, @8, @9, @10] + NSLog(@"6 is at position %d", fn BinarySearch( a, @6 ) ) // prints 4 +end fn + +fn DoIt + +HandleEvents diff --git a/Task/Binary-search/FutureBasic/binary-search-2.basic b/Task/Binary-search/FutureBasic/binary-search-2.basic new file mode 100644 index 0000000000..db5b3992f5 --- /dev/null +++ b/Task/Binary-search/FutureBasic/binary-search-2.basic @@ -0,0 +1,28 @@ +include "NSLog.incl" + +NSInteger local fn BinarySearch( array as CFArrayRef, key as CFTypeRef ) +NSInteger lo = 0 +include "NSLog.incl" + +NSInteger local fn BinarySearch( array as CFArrayRef, key as CFTypeRef, range as CFRange ) +if ( range.length == 0 ) then return NSNotFound + +NSInteger i = range.location + range.length / 2 +CFTypeRef midVal = array[i] + +select ( fn NumberCompare( midVal, key ) ) + case NSOrderedAscending + return fn BinarySearch( array, key, fn CFRangeMake( i + 1, range.length - i + 1 ) ) + case NSOrderedDescending + return fn BinarySearch( array, key, fn CFRangeMake( range.location, i - range.location ) ) +end select +end fn = i + +void local fn DoIt + CFArrayRef a = @[@1, @3, @4, @5, @6, @7, @8, @9, @10] + NSLog(@"6 is at position %d", fn BinarySearch( a, @6, fn CFRangeMake(0,len(a)) )) // prints 4 +end fn + +fn DoIt + +HandleEvents diff --git a/Task/Binary-search/J/binary-search-3.j b/Task/Binary-search/J/binary-search-3.j index 2c3d764d3e..284f2ace42 100644 --- a/Task/Binary-search/J/binary-search-3.j +++ b/Task/Binary-search/J/binary-search-3.j @@ -1,13 +1,11 @@ -'X Y L H M'=. i.5 NB. Setting mnemonics for boxes -f=. &({::) NB. Fetching the contents of a box -o=. @: NB. Composing verbs (functions) +'`X Y L H M'=. ,{{y&{::`''}}&>i.5 NB. Setting mnemonics for boxes (e.g. X=.0&{::) +'l h m' =. 2 3 4 NB. more box mnemonics (used for e.g. m}) -boxes=. ; , a: $~ 3: NB. Appending 3 (empty) boxes to the inputs -LowHigh=. (0 ; # o (X f)) (L,H)} ] NB. Setting the low and high bounds -midpoint=. < o (<. o (2 %~ L f + H f)) M} ] NB. Updating the midpoint -case=. >: o * o (Y f - M f { X f) NB. Less=0, equal=1, or greater=2 +boxes =. ;,a:$~3: NB. Appending 3 (empty) boxes to the inputs +LowHigh =. (0;#@X) (l,h)} ] NB. Setting the low and high bounds +midpoint=. <@(<.@(2%~L+H)) m} ] NB. Updating the midpoint +case =. >:@:*@(Y-M{X) NB. Less=0, equal=1, or greater=2 -squeeze=. (< o (_1 + M f) H} ])`(< o _: L} ])`(< o (1 + M f) L} ])@.case -return=. (M f) o ((<@:('Not Found'"_) M} ]) ^: (_ ~: L f)) - -bs=. return o (squeeze o midpoint ^: (L f <: H f) ^:_) o LowHigh o boxes +squeeze =. (<@(_1+M) h} ])`(<@_ l} ])`(<@(1+M) l} ])@.case +return =. [: M (<@'Not Found' m} ])^:(_~:L) +bs =. return@(squeeze@midpoint^:(L<:H)^:_)@LowHigh@boxes diff --git a/Task/Binary-search/J/binary-search-4.j b/Task/Binary-search/J/binary-search-4.j index c2bbee104e..4e69af9096 100644 --- a/Task/Binary-search/J/binary-search-4.j +++ b/Task/Binary-search/J/binary-search-4.j @@ -1,11 +1,10 @@ -'X Y L H M'=. i.5 NB. Setting mnemonics for boxes -f=. &({::) NB. Fetching the contents of a box -o=. @: NB. Composing verbs (functions) +'`X Y L H M'=. ,{{y&{::`''}}&>i.5 NB. Setting mnemonics for boxes (e.g. X=.0&{::) +'l h m' =. 2 3 4 NB. more box mnemonics (used for e.g. m}) -boxes=. a: ,~ ; NB. Appending 1 (empty) box to the inputs -midpoint=. < o (<. o (2 %~ L f + H f)) M} ] NB. Updating the midpoint -case=. >: o * o (Y f - M f { X f) NB. Less=0, equal=1, or greater=2 +boxes =. a:,~; NB. Appending 3 (empty) boxes to the inputs +LowHigh =. (0;#@X) (l,h)} ] NB. Setting the low and high bounds +midpoint=. <@(<.@(2%~L+H)) m} ] NB. Updating the midpoint +case =. >:@:*@(Y-M{X) NB. Less=0, equal=1, or greater=2 -recur=. (X f bs Y f ; L f ; (_1 + M f))`(M f)`(X f bs Y f ; (1 + M f) ; H f)@.case - -bs=. (recur o midpoint`('Not Found'"_) @. (H f < L f) o boxes) :: ([ bs ] ; 0 ; (<: o # o [)) +recur =. (X bs Y;L;(_1+M))`M`(X bs Y;(1+M);H)@.case +bs =. recur@midpoint`('Not Found'"_)@.(H a[mid] then + l := mid + 1 + else r := mid - 1; + until l > r; + Result := -1; +end; + +function BinarySearchRecursive(a: array of integer; x: integer): integer; + function BinarySearchHelper(a: array of integer; x: integer; l,r: integer): integer; + begin + if l > r then + Result := -1 + else begin + var mid := (l + r) div 2; + if x = a[mid] then + Result := mid + else if x < a[mid] then + Result := BinarySearchHelper(a, x, l, mid - 1) + else Result := BinarySearchHelper(a, x, mid + 1, r) + end; + end; +begin + Result := BinarySearchHelper(a,x,0,a.Length-1); +end; + +begin + var a := ArrRandomInteger(10,1,20); + a.Sort; + a.Println; + var x := 10; + var ind := BinarySearch(a,x); + if ind >= 0 then + Println($'{x} found at index {ind}') + else Println($'{x} not found'); + + ind := BinarySearchRecursive(a,x); + if ind >= 0 then + Println($'{x} found at index {ind}') + else Println($'{x} not found'); + + x := a.RandomElement; + ind := BinarySearch(a,x); + if ind >= 0 then + Println($'{x} found at index {ind}') + else Println($'{x} not found'); + + ind := BinarySearchRecursive(a,x); + if ind >= 0 then + Println($'{x} found at index {ind}') + else Println($'{x} not found'); +end. diff --git a/Task/Binary-search/PascalABC.NET/binary-search-2.pas b/Task/Binary-search/PascalABC.NET/binary-search-2.pas new file mode 100644 index 0000000000..3457b3278d --- /dev/null +++ b/Task/Binary-search/PascalABC.NET/binary-search-2.pas @@ -0,0 +1,3 @@ +## +var s := |2,3,4,5,6,7,8,9,10,12,14,16,18,20,22,25,27,30|; +s.binarysearch(10).println; diff --git a/Task/Binary-search/Pluto/binary-search.pluto b/Task/Binary-search/Pluto/binary-search.pluto new file mode 100644 index 0000000000..49dfe6e967 --- /dev/null +++ b/Task/Binary-search/Pluto/binary-search.pluto @@ -0,0 +1,34 @@ +require "table2" +local fmt = require "fmt" + +local function rec_bsearch(a, v, low = 1, high = #a) + if high < low then return false, 0 end + local mid = low + (high - low) // 2 + if a[mid] > v then return rec_bsearch(a, v, low, mid - 1) end + if a[mid] < v then return rec_bsearch(a, v, mid + 1, high) end + return true, mid +end + +local a = {10, 22, 45, 67, 89, 97} +fmt.lprint(a, ", ", "{}", "array = ") +print() + +local texts = {"Using the library function (iterative algorithm):", + "Using the recursive algorithm:"} + +local values = { {22, 70}, {67, 93} } + +local fns = {table.bsearch, rec_bsearch} + +for i = 1, 2 do + print(texts[i]) + for values[i] as v do + local found, index = fns[i](a, v) + if found then + print($" {v} was found at index {index} of the array") + else + print($" {v} was not found in the array") + end + end + if i == 1 then print() end +end diff --git a/Task/Binary-search/PowerShell/binary-search-1.psh b/Task/Binary-search/PowerShell/binary-search-1.ps1 similarity index 100% rename from Task/Binary-search/PowerShell/binary-search-1.psh rename to Task/Binary-search/PowerShell/binary-search-1.ps1 diff --git a/Task/Binary-search/PowerShell/binary-search-2.psh b/Task/Binary-search/PowerShell/binary-search-2.ps1 similarity index 100% rename from Task/Binary-search/PowerShell/binary-search-2.psh rename to Task/Binary-search/PowerShell/binary-search-2.ps1 diff --git a/Task/Binary-search/RISC-V-Assembly/binary-search.asm b/Task/Binary-search/RISC-V-Assembly/binary-search.asm new file mode 100644 index 0000000000..067c70654e --- /dev/null +++ b/Task/Binary-search/RISC-V-Assembly/binary-search.asm @@ -0,0 +1,145 @@ +# riscv assembly raspberry pico2 rp2350 +# program binarysearch.s +# connexion putty com3 +/*********************************************/ +/* CONSTANTES */ +/********************************************/ +/* for this file see risc-v task include a file */ +.include "../../constantesRiscv.inc" + +/****************************************************/ +/* MACROS */ +/****************************************************/ +#.include "../ficmacrosriscv.inc" # for debugging only + +/*******************************************/ +/* INITIALED DATAS */ +/*******************************************/ +.data +szMessStart: .asciz "Program riscv start.\r\n" +szMessEnd: .asciz "\nProgram end OK.\r\n" +szCariageReturn: .asciz "\r\n" +szMessResult: .asciz "Value found at index : " +szMessNotFound: .asciz "Value not found. \r\n" + +.align 2 +TableNumber: .int -10,4,6,7,10,11,15,22,30,35 +.equ NBELEMENTS1, . - TableNumber +.equ NBELEMENTS, NBELEMENTS1 / 4 + +.align 2 +/*******************************************/ +/* UNINITIALED DATA */ +/*******************************************/ +.bss +.align 2 +sConvArea: .skip 24 + +/********************************...-..--*****/ +/* SECTION CODE */ +/**********************************************/ +.text +.global main + +main: + call stdio_init_all # général init +1: # start loop connexion + li a0,0 # raz argument register + call tud_cdc_n_connected # waiting for USB connection + beqz a0,1b # return code = zero ? + + la a0,szMessStart # message address + call writeString # display message + + li a0,-10 # find first value + call testSearch + li a0,35 # find last value + call testSearch + li a0,10 # find medium value + call testSearch + + li a0,100 # value not in array + call testSearch + li a0,-100 # value not in array + call testSearch + + + la a0,szMessEnd + call writeString + call getchar +100: # final loop + j 100b +/**********************************************/ +/* test binary search */ +/**********************************************/ +/* a0 search value */ +testSearch: # INFO: testSearch + addi sp, sp, -8 # reserve stack + sw ra, 0(sp) + sw s0,4(sp) + mv s0,a0 + la a1,TableNumber + li a2,NBELEMENTS + call bsearch + bltz a0,1f + mv s0,a0 + la a0,szMessResult + call writeString + mv a0,s0 + la a1,sConvArea + call conversion10 + la a0,sConvArea + call writeString + + la a0,szCariageReturn + call writeString + j 100f +1: + la a0,szMessNotFound + call writeString +100: + lw ra, 0(sp) + lw s0, 4(sp) + addi sp, sp, 8 + ret + +/***************************************************/ +/* binary search */ +/***************************************************/ +/* a0 search value */ +/* a1 array address */ +/* a2 array size */ +/* a0 return index or -1 if not find */ +bsearch: # INFO: bsearch + addi sp, sp, -8 # save registres + sw ra, 0(sp) + li t0,0 # low index + addi t1,a2,-1 # high index N - 1 +1: + bgt t0,t1,99f # not found + add t2,t0,t1 + srli t2,t2,1 # compute (low+high)/ 2 + sh2add t3,t2,a1 # compute index address + lw t4,(t3) # load array value + blt t4,a0,2f + bgt t4,a0,3f + mv a0,t2 # value found return index + j 100f +2: # lower + addi t0,t2,1 # low index = index + 1 + j 1b +3: # upper + addi t1,t2,-1 # high index = index - 1 + j 1b +99: + li a0,-1 +100: + lw ra, 0(sp) + addi sp, sp, 8 + ret + +/************************************/ +/* file include Fonctions */ +/***********************************/ +/* for this file see risc-v task include a file */ +.include "../../includeFunctions.s" diff --git a/Task/Binary-search/Rust/binary-search.rs b/Task/Binary-search/Rust/binary-search.rs new file mode 100644 index 0000000000..c3fd70a943 --- /dev/null +++ b/Task/Binary-search/Rust/binary-search.rs @@ -0,0 +1,15 @@ +fn binary_search(searchvalue: T, v: &[T] ) -> Option { + let mut lower = 0 as usize; + let mut upper = v.len(); + while upper > lower { + let mid = lower + (upper - lower) / 2; + if v[mid] == searchvalue { + return Some(mid); + } else if searchvalue < v[mid] { + upper = mid; + } else { + lower = mid + 1; + } + } + None +} diff --git a/Task/Binary-search/Rust/binary-search.rust b/Task/Binary-search/Rust/binary-search.rust deleted file mode 100644 index fde2a40905..0000000000 --- a/Task/Binary-search/Rust/binary-search.rust +++ /dev/null @@ -1,17 +0,0 @@ -fn binary_search(v: &[T], searchvalue: T) -> Option { - let mut lower = 0 as usize; - let mut upper = v.len() - 1; - - while upper >= lower { - let mid = (upper + lower) / 2; - if v[mid] == searchvalue { - return Some(searchvalue); - } else if searchvalue < v[mid] { - upper = mid - 1; - } else { - lower = mid + 1; - } - } - - None -} diff --git a/Task/Binary-search/Scheme/binary-search.ss b/Task/Binary-search/Scheme/binary-search.scm similarity index 100% rename from Task/Binary-search/Scheme/binary-search.ss rename to Task/Binary-search/Scheme/binary-search.scm diff --git a/Task/Binary-search/VBScript/binary-search.vb b/Task/Binary-search/VBScript/binary-search.vbs similarity index 100% rename from Task/Binary-search/VBScript/binary-search.vb rename to Task/Binary-search/VBScript/binary-search.vbs diff --git a/Task/Binary-search/Zig/binary-search-1.zig b/Task/Binary-search/Zig/binary-search-1.zig new file mode 100644 index 0000000000..dd5c94912c --- /dev/null +++ b/Task/Binary-search/Zig/binary-search-1.zig @@ -0,0 +1,20 @@ +pub fn binarySearch(comptime T: type, input: []const T, search_value: T) ?usize { + if (input.len == 0) return null; + if (@sizeOf(T) == 0) return 0; + + var view: []const T = input; + const item_ptr: *const T = item_ptr: while (view.len > 0) { + const mid = (view.len - 1) / 2; + const mid_elem_ptr: *const T = &view[mid]; + + if (mid_elem_ptr.* > search_value) + view = view[0..mid] + else if (mid_elem_ptr.* < search_value) + view = view[mid + 1 .. view.len] + else + break :item_ptr mid_elem_ptr; + } else return null; + + const distance_in_bytes = @intFromPtr(item_ptr) - @intFromPtr(input.ptr); + return (distance_in_bytes / @sizeOf(T)); +} diff --git a/Task/Binary-search/Zig/binary-search-2.zig b/Task/Binary-search/Zig/binary-search-2.zig new file mode 100644 index 0000000000..d2b5370b1d --- /dev/null +++ b/Task/Binary-search/Zig/binary-search-2.zig @@ -0,0 +1,18 @@ +pub fn binarySearch(comptime T: type, input: []const T, search_value: T) ?usize { + return binarySearchInner(T, input, search_value, @intFromPtr(input.ptr)); +} + +fn binarySearchInner(comptime T: type, input: []const T, search_value: T, start_address: usize) ?usize { + if (input.len == 0) return null; + if (@sizeOf(T) == 0) return 0; + + const mid = (input.len - 1) / 2; + const mid_elem_ptr: *const T = &input[mid]; + + return if (mid_elem_ptr.* > search_value) + binarySearchInner(T, input[0..mid], search_value, start_address) + else if (mid_elem_ptr.* < search_value) + binarySearchInner(T, input[mid + 1 .. input.len], search_value, start_address) + else + (@intFromPtr(mid_elem_ptr) - start_address) / @sizeOf(T); +} diff --git a/Task/Binary-search/Zig/binary-search-3.zig b/Task/Binary-search/Zig/binary-search-3.zig new file mode 100644 index 0000000000..00f97a3123 --- /dev/null +++ b/Task/Binary-search/Zig/binary-search-3.zig @@ -0,0 +1,19 @@ +const math = @import("std").math; + +pub fn binarySearch(comptime T: type, input: []const T, search_value: T) ?usize { + if (input.len == 0) return null; + if (@sizeOf(T) == 0) return 0; + + var low: usize = 0; + var high: usize = input.len - 1; + return while (low <= high) { + const mid = ((high - low) / 2) + low; + const mid_elem: T = input[mid]; + if (mid_elem > search_value) + high = math.sub(usize, mid, 1) catch break null + else if (mid_elem < search_value) + low = mid + 1 + else + break mid; + } else null; +} diff --git a/Task/Binary-search/Zig/binary-search-4.zig b/Task/Binary-search/Zig/binary-search-4.zig new file mode 100644 index 0000000000..cd79a20fb7 --- /dev/null +++ b/Task/Binary-search/Zig/binary-search-4.zig @@ -0,0 +1,22 @@ +const math = @import("std").math; + +pub fn binarySearch(comptime T: type, input: []const T, search_value: T) ?usize { + if (input.len == 0) return null; + if (@sizeOf(T) == 0) return 0; + + return binarySearchInner(T, input, search_value, 0, input.len - 1); +} + +fn binarySearchInner(comptime T: type, input: []const T, search_value: T, low: usize, high: usize) ?usize { + if (low > high) return null; + + const mid = ((high - low) / 2) + low; + const mid_elem: T = input[mid]; + + return if (mid_elem > search_value) + binarySearchInner(T, input, search_value, low, math.sub(usize, mid, 1) catch return null) + else if (mid_elem < search_value) + binarySearchInner(T, input, search_value, mid + 1, high) + else + mid; +} diff --git a/Task/Binary-strings/AArch64-Assembly/binary-strings.aarch64 b/Task/Binary-strings/AArch64-Assembly/binary-strings.aarch64 new file mode 100644 index 0000000000..d07a853138 --- /dev/null +++ b/Task/Binary-strings/AArch64-Assembly/binary-strings.aarch64 @@ -0,0 +1,533 @@ +/* ARM assembly AARCH64 Raspberry PI 3B */ +/* program routstring64.s */ + +/*******************************************/ +/* Constantes */ +/*******************************************/ +/* for this file see task include a file in language AArch64 assembly*/ +.include "../includeConstantesARM64.inc" +.equ BUFFERSIZE, 80 + +/*******************************************/ +/* macros */ +/*******************************************/ +//.include "../../ficmacros64.inc" // for developper debugging + +/*********************************/ +/* Initialized data */ +/*********************************/ +.data +szMessDebutPgm: .asciz "Program 64 bits start. \n" +szCarriageReturn: .asciz "\n" +szMessFinOK: .asciz "Program normal end. \n" +szMessErreur: .asciz "Error !!!\n" +szMessValString: .asciz "String value : " +szMessLenStr: .asciz "String length : " +szMessCopyString: .asciz "String copy : " +szMessEmpty: .asciz "String empty.\n" +szMessStrEqual: .asciz "Strings are equals.\n" +szMessStrNotEqual: .asciz "Strings are not equals.\n" +szMessStringfound: .asciz "String found at position :" +szMessStringJoint: .asciz "Joint string : " +szMessStringRep: .asciz "Replace occurences string : " +szMessBufferError: .asciz "Error : Buffer too small !!\n" +szString1: .asciz "ABCDE" +.equ LGSTRING1, . - szString1 - 1 +szString2: .asciz "" +szString3: .asciz "ABCDF" +szString4: .asciz "CD" +szString5: .asciz "AABCIEFAAGHIAA" +szStringOcc: .asciz "AA" +szStringRep: .asciz "ZZ" + +.align 4 +/*********************************/ +/* UnInitialized data */ +/*********************************/ +.bss +sZoneConv: .skip 24 +szStringRec: .skip BUFFERSIZE +.align 4 + +/*********************************/ +/* code section */ +/*********************************/ +.text +.global main +main: + ldr x0,qAdrszMessDebutPgm + bl affichageMess // start message + + ldr x0,qAdrszMessValString + bl affichageMess + ldr x0,qAdrszString1 + bl affichageMess + ldr x0,qAdrszCarriageReturn + bl affichageMess + + ldr x0,qAdrszMessLenStr + bl affichageMess + mov x0,#LGSTRING1 // string length static + bl displayNumber + + ldr x0,qAdrszMessLenStr + bl affichageMess + ldr x0,qAdrszString1 + bl stringLen // string length + bl displayNumber + + + ldr x0,qAdrszString1 // string copy + ldr x1,qAdrszStringRec + mov x2,#BUFFERSIZE + bl copyString + cmp x0,#-1 + beq 100f + ldr x0,qAdrszMessCopyString + bl affichageMess + ldr x0,qAdrszStringRec + bl affichageMess + ldr x0,qAdrszCarriageReturn + bl affichageMess + + ldr x0,qAdrszString2 // empty string + bl emptyString + + ldr x0,qAdrszString1 // string comparison + ldr x0,qAdrszString3 + bl comparString + cmp x0,#0 + bne 1f + ldr x0,qAdrszMessStrEqual + bl affichageMess + b 2f +1: + ldr x0,qAdrszMessStrNotEqual + bl affichageMess +2: + ldr x0,qAdrszString1 // search substring + ldr x1,qAdrszString4 + bl searchSubString + cmp x0,#-1 + beq 3f + mov x1,x0 + ldr x0,qAdrszMessStringfound + bl affichageMess + mov x0,x1 + bl displayNumber +3: + ldr x0,qAdrszMessStringJoint // joint strings + bl affichageMess + ldr x0,qAdrszString1 + ldr x1,qAdrszString3 + ldr x2,qAdrszStringRec + mov x3,#BUFFERSIZE + bl concatString + cmp x0,#-1 + beq 100f + ldr x0,qAdrszStringRec + bl affichageMess + ldr x0,qAdrszCarriageReturn + bl affichageMess + + ldr x0,qAdrszMessStringRep // replace string or char + bl affichageMess + ldr x0,qAdrszString5 // string + ldr x1,qAdrszStringOcc // string occurence + ldr x2,qAdrszStringRep // replace string + ldr x3,qAdrszStringRec // buffer + mov x4,#BUFFERSIZE // buffer size + bl replaceOccString + cmp x0,#-1 + beq 100f + ldr x0,qAdrszStringRec + bl affichageMess + ldr x0,qAdrszCarriageReturn + bl affichageMess + + ldr x0,qAdrszMessFinOK + bl affichageMess + b 100f +99: + ldr x0,qAdrszMessErreur // error + bl affichageMess + mov x0, #1 // return code error + b 100f +100: + mov x8,EXIT + svc #0 // system call +qAdrszMessDebutPgm: .quad szMessDebutPgm +qAdrszMessFinOK: .quad szMessFinOK +qAdrszMessErreur: .quad szMessErreur +qAdrsZoneConv: .quad sZoneConv +qAdrszMessLenStr: .quad szMessLenStr +qAdrszMessValString: .quad szMessValString +qAdrszMessCopyString: .quad szMessCopyString +qAdrszMessStrEqual: .quad szMessStrEqual +qAdrszMessStrNotEqual: .quad szMessStrNotEqual +qAdrszMessStringfound: .quad szMessStringfound +qAdrszMessStringJoint: .quad szMessStringJoint +qAdrszMessStringRep: .quad szMessStringRep +qAdrszString1: .quad szString1 +qAdrszString2: .quad szString2 +qAdrszString3: .quad szString3 +qAdrszString4: .quad szString4 +qAdrszString5: .quad szString5 +qAdrszStringRec: .quad szStringRec +qAdrszStringOcc: .quad szStringOcc +qAdrszStringRep: .quad szStringRep +/***************************************************/ +/* String length */ +/***************************************************/ +/* x0 contains string address */ +/* x0 returns length */ +stringLen: + stp x1,lr,[sp,-16]! // + stp x2,x3,[sp,-16]! + mov x1,#0 // byte counter +1: + ldrb w2,[x0,x1] // load byte + cmp x2,#0 // final zero ? + csel x0,x1,x0,eq // return counter + beq 100f + add x1,x1,#1 // increment counter + b 1b // and loop +100: + ldp x2,x3,[sp],16 + ldp x1,lr,[sp],16 + ret +/***************************************************/ +/* empty String */ +/***************************************************/ +/* x0 contains string address */ +/* x0 returns 0 if string empty */ +emptyString: + stp x1,lr,[sp,-16]! + ldrb w0,[x0] // load first byte + cmp x0,#0 + bne 100f + ldr x0,qAdrszMessEmpty + bl affichageMess + mov x0,#0 +100: + ldp x1,lr,[sp],16 + ret +qAdrszMessEmpty: .quad szMessEmpty +/***************************************************/ +/* String copy */ +/***************************************************/ +/* x0 contains string address */ +/* x1 contains area string */ +/* x2 contains area size */ +copyString: + stp x1,lr,[sp,-16]! + stp x2,x3,[sp,-16]! + stp x4,x5,[sp,-16]! + mov x5,#0 // indice +1: + ldrb w3,[x0,x5] // load byte + strb w3,[x1,x5] // store byte + cmp x3,#0 // final zero ? + csel x0,x5,x0,eq + beq 100f + add x5,x5,#1 // increment indice + cmp x5,x2 // > buffer size ? + bge 99f // error + b 1b // loop +99: + ldr x0,qAdrszMessBufferError + bl affichageMess + mov x0,#-1 +100: + ldp x4,x5,[sp],16 + ldp x2,x3,[sp],16 + ldp x1,lr,[sp],16 + ret +/***************************************************/ +/* display number */ +/***************************************************/ +/* x0 contains number */ +displayNumber: + stp x1,lr,[sp,-16]! // TODO: a completer + ldr x1,qAdrsZoneConv + bl conversion10 + ldr x0,qAdrsZoneConv + bl affichageMess + ldr x0,qAdrszCarriageReturn + bl affichageMess +100: + ldp x1,lr,[sp],16 // TODO: a completer + ret +qAdrszCarriageReturn: .quad szCarriageReturn +/************************************/ +/* String compare */ +/************************************/ +/* x0 et x1 contains strings address */ +/* x0 returns 0 if equals -1 if less 1 if higter */ +comparString: + stp x1,lr,[sp,-16]! + stp x2,x3,[sp,-16]! + stp x4,x5,[sp,-16]! + mov x2,#0 // indice +1: + ldrb w3,[x0,x2] // load byte string 1 + ldrb w4,[x1,x2] // load byte string 2 + cmp x3,x4 + blt 2f + bgt 3f + cmp x3,#0 // final zero ? + csel x0,xzr,x0,eq // equal + beq 100f // and end + add x2,x2,#1 // increment indice + b 1b // and loop +2: + mov x0,#-1 // less + b 100f +3: // higt + mov x0,#1 +100: + ldp x4,x5,[sp],16 + ldp x2,x3,[sp],16 + ldp x1,lr,[sp],16 + ret +/******************************************************************/ +/* search a substring in the string */ +/******************************************************************/ +/* x0 contains the address of the input string */ +/* x1 contains the address of substring */ +/* x0 returns index of substring in string or -1 if not found */ +searchSubString: + stp x1,lr,[sp,-16]! + stp x2,x3,[sp,-16]! + stp x4,x5,[sp,-16]! + stp x6,x7,[sp,-16]! + mov x2,#0 // counter byte input string + mov x3,#0 // counter byte string + mov x6,#-1 // index found + ldrb w4,[x1,x3] +1: + ldrb w5,[x0,x2] // load byte string + cmp x5,#0 // zero final ? + mov x7,-1 + csel x0,x7,x0,eq // yes returns error + beq 100f + cmp x5,x4 // compare character + beq 2f + mov x6,#-1 // no equals - > raz index + mov x3,#0 // and raz counter byte + add x2,x2,#1 // and increment counter byte + b 1b // and loop +2: // characters equals + cmp x6,#-1 // first characters equals ? + csel x6,x2,x6,eq // yes -> index begin in r6 + add x3,x3,#1 // increment counter substring + ldrb w4,[x1,x3] // and load next byte + cmp x4,#0 // zero final ? + beq 3f // yes -> end search + add x2,x2,#1 // else increment counter string + b 1b // and loop +3: + mov x0,x6 +100: + ldp x6,x7,[sp],16 + ldp x4,x5,[sp],16 + ldp x2,x3,[sp],16 + ldp x1,lr,[sp],16 + ret +/******************************************************************/ +/* joint strings */ +/******************************************************************/ +/* x0 and x1 contains strings address */ +/* x2 contains address buffer */ +/* x3 contains buffer length */ +concatString: + stp x1,lr,[sp,-16]! + stp x2,x3,[sp,-16]! + stp x4,x5,[sp,-16]! + stp x6,x7,[sp,-16]! + mov x6,#0 + mov x5,#0 + 1: + ldrb w4,[x0,x6] // load byte string 1 + cmp x4,#0 // final zero ? + beq 2f + strb w4,[x2,x6] // store byte in buffer + add x6,x6,#1 // increment indice + cmp x6,x3 // buffer max length ? + bge 99f // error + b 1b // else loop + + 2: + ldrb w4,[x1,x5] // load byte string 2 + strb w4,[x2,x6] // store byte in buffer + cmp x4,#0 // zero final ? + beq 3f // end + add x6,x6,#1 // increment indice + cmp x6,x3 // buffer max length ? + bge 99f // yes error + add x5,x5,#1 // else loop + b 2b +3: + mov x0,x6 + b 100f +99: + ldr x0,qAdrszMessBufferError + bl affichageMess + mov x0,#-1 + + 100: + ldp x6,x7,[sp],16 + ldp x4,x5,[sp],16 + ldp x2,x3,[sp],16 + ldp x1,lr,[sp],16 + ret +qAdrszMessBufferError: .quad szMessBufferError +/******************************************************************/ +/* replace occurences strings */ +/******************************************************************/ +/* x0 string address */ +/* x1 occurence string address */ +/* x2 replace string address */ +/* x3 contains address buffer */ +/* x4 contains buffer length */ +replaceOccString: + stp x1,lr,[sp,-16]! // TODO: a completer + stp x2,x3,[sp,-16]! + stp x4,x5,[sp,-16]! + stp x6,x7,[sp,-16]! + stp x8,x9,[sp,-16]! + stp x10,x11,[sp,-16]! + mov x12,x0 + mov x11,x1 + mov x9,#0 // indice string + mov x6,#0 // indice occurence + mov x8,#0 // indice write buffer + mov x10,#-1 // string occ start address +1: + ldrb w0,[x11,x6] // load search byte + cmp x0,#0 // final zero ? + beq 3f +2: + ldrb w7,[x12,x9] // load string byte + cmp x7,#0 // zero final ? + beq 6f + cmp x0,x7 + bne 4f // if not equal + cmp x10,#-1 // string equal begin + csel x10,x9,x10,eq // string equal begin = string indice + add x9,x9,#1 // increment indice + add x6,x6,#1 + b 1b // loop +3: // end of strings equals + mov x1,x8 + bl replaceStr // replace string + cmp x0,#-1 // error ? + beq 99f + mov x8,x0 + mov x6,#0 // raz indice search + mov x10,#-1 // raz string equal begin + b 1b +4: // bytes not equals + cmp x10,#-1 // if not string equal begin + beq 5f +41: + ldrb w0,[x12,x10] // store bytes string + strb w0,[x3,x8] + add x8,x8,#1 + cmp x8,x4 + bge 99f + add x10,x10,#1 + cmp x10,x9 + blt 41b + mov x10,#-1 // raz string equal begin + mov x6,#0 // raz indice occurence + b 1b // loop + +5: // byte not equal + str x7,[x3,x8] // store byte string in buffer + add x8,x8,#1 + cmp x8,x4 // max buffer size ? + bge 99f // error + add x9,x9,#1 // inc indice chaine + mov x6,#0 // raz indice occ + b 1b // loop + +6: // end string + ldrb w0,[x11,x6] // load search byte + cmp x0,#0 // final zero + bne 7f + cmp x10,#-1 // + beq 100f + mov x1,x8 + bl replaceStr // replace + b 100f +7: + cmp x10,#-1 // pas de char en cours + bne 8f + mov x0,#0 + strb w0,[x3,x8] // final zero + b 100f + 8: + ldrb w0,[x12,x10] // load string byte + strb w0,[x3,x8] // store buffer byte + add x8,x8,#1 + cmp x8,x4 + bge 99f + add x10,x10,#1 // increment begin string + cmp x10,x9 // compare with position string + blt 8b // loop + mov x0,#0 + strb w0,[x3,x8] // final zero + + b 100f +99: // buffer size error + ldr x0,qAdrszMessBufferError + bl affichageMess + mov x0,#-1 + 100: + ldp x10,x11,[sp],16 + ldp x8,x9,[sp],16 + ldp x6,x7,[sp],16 + ldp x4,x5,[sp],16 + ldp x2,x3,[sp],16 + ldp x1,lr,[sp],16 // TODO: a completer + ret +/******************************************************************/ +/* replace occurences strings */ +/******************************************************************/ +/* x0 string address */ +/* x1 indice to replace */ +/* x2 replace string address */ +/* x3 contains address buffer */ +/* x4 contains buffer length */ +/* x0 return new buffer position */ +replaceStr: + stp x1,lr,[sp,-16]! // TODO: a completer + stp x5,x6,[sp,-16]! + mov x5,#0 +1: + ldrb w6,[x2,x5] // load replace byte + cmp x6,#0 // final zero + csel x0,x1,x0,eq + beq 100f + strb w6,[x3,x1] // store byte in buffer + add x1,x1,#1 + cmp x1,x4 // max size buffer ? + bge 99f // error + add x5,x5,#1 + b 1b + +99: + ldr x0,qAdrszMessBufferError + bl affichageMess + mov x0,#-1 + +100: + ldp x5,x6,[sp],16 + ldp x1,lr,[sp],16 // TODO: a completer + ret +/***************************************************/ +/* ROUTINES INCLUDE */ +/***************************************************/ +/* for this file see task include a file in language AArch64 assembly*/ +.include "../includeARM64.inc" diff --git a/Task/Binary-strings/ARM-Assembly/binary-strings.arm b/Task/Binary-strings/ARM-Assembly/binary-strings.arm new file mode 100644 index 0000000000..097335d986 --- /dev/null +++ b/Task/Binary-strings/ARM-Assembly/binary-strings.arm @@ -0,0 +1,490 @@ +/* ARM assembly Raspberry PI */ +/* program routstring.s */ + +/* REMARK 1 : this program use routines in a include file + see task Include a file language arm assembly + for the routine affichageMess conversion10 + see at end of this program the instruction include */ + +/*******************************************/ +/* Constantes */ +/*******************************************/ +.include "../constantes.inc" +.equ BUFFERSIZE, 80 + +/*******************************************/ +/* macros */ +/*******************************************/ +//.include "../../ficmacros32.inc" @ for developper debugging + +/*********************************/ +/* Initialized data */ +/*********************************/ +.data +szMessDebutPgm: .asciz "Program 32 bits start. \n" +szCarriageReturn: .asciz "\n" +szMessFinOK: .asciz "Program normal end. \n" +szMessErreur: .asciz "Error !!!\n" +szMessValString: .asciz "String value : " +szMessLenStr: .asciz "String length : " +szMessCopyString: .asciz "String copy : " +szMessEmpty: .asciz "String empty.\n" +szMessStrEqual: .asciz "Strings are equals.\n" +szMessStrNotEqual: .asciz "Strings are not equals.\n" +szMessStringfound: .asciz "String found at position :" +szMessStringJoint: .asciz "Joint string : " +szMessStringRep: .asciz "Replace occurences string : " +szMessBufferError: .asciz "Error : Buffer too small !!\n" +szString1: .asciz "ABCDE" +.equ LGSTRING1, . - szString1 - 1 +szString2: .asciz "" +szString3: .asciz "ABCDF" +szString4: .asciz "CD" +szString5: .asciz "AABCIEFAAGHIAA" +szStringOcc: .asciz "AA" +szStringRep: .asciz "ZZ" + +.align 4 +/*********************************/ +/* UnInitialized data */ +/*********************************/ +.bss +sZoneConv: .skip 24 +szStringRec: .skip BUFFERSIZE +.align 4 + +/*********************************/ +/* code section */ +/*********************************/ +.text +.global main +main: + ldr r0,iAdrszMessDebutPgm + bl affichageMess @ start message + + ldr r0,iAdrszMessValString + bl affichageMess + ldr r0,iAdrszString1 + bl affichageMess + ldr r0,iAdrszCarriageReturn + bl affichageMess + + ldr r0,iAdrszMessLenStr + bl affichageMess + mov r0,#LGSTRING1 @ string length static + bl displayNumber + + ldr r0,iAdrszMessLenStr + bl affichageMess + ldr r0,iAdrszString1 + bl stringLen @ string length + bl displayNumber + + + ldr r0,iAdrszString1 @ string copy + ldr r1,iAdrszStringRec + mov r2,#BUFFERSIZE + bl copyString + cmp r0,#-1 + beq 100f + ldr r0,iAdrszMessCopyString + bl affichageMess + ldr r0,iAdrszStringRec + bl affichageMess + ldr r0,iAdrszCarriageReturn + bl affichageMess + + ldr r0,iAdrszString2 @ empty string + bl emptyString + + ldr r0,iAdrszString1 @ string comparison + ldr r0,iAdrszString3 + bl comparString + cmp r0,#0 + bne 1f + ldr r0,iAdrszMessStrEqual + bl affichageMess + b 2f +1: + ldr r0,iAdrszMessStrNotEqual + bl affichageMess +2: + ldr r0,iAdrszString1 @ search substring + ldr r1,iAdrszString4 + bl searchSubString + cmp r0,#-1 + beq 3f + mov r1,r0 + ldr r0,iAdrszMessStringfound + bl affichageMess + mov r0,r1 + bl displayNumber +3: + ldr r0,iAdrszMessStringJoint @ joint strings + bl affichageMess + ldr r0,iAdrszString1 + ldr r1,iAdrszString3 + ldr r2,iAdrszStringRec + mov r3,#BUFFERSIZE + bl concatString + cmp r0,#-1 + beq 100f + ldr r0,iAdrszStringRec + bl affichageMess + ldr r0,iAdrszCarriageReturn + bl affichageMess + + ldr r0,iAdrszMessStringRep @ replace string or char + bl affichageMess + ldr r0,iAdrszString5 @ string + ldr r1,iAdrszStringOcc @ string occurence + ldr r2,iAdrszStringRep @ replace string + ldr r3,iAdrszStringRec @ buffer + mov r4,#BUFFERSIZE @ buffer size + bl replaceOccString + cmp r0,#-1 + beq 100f + ldr r0,iAdrszStringRec + bl affichageMess + ldr r0,iAdrszCarriageReturn + bl affichageMess + + ldr r0,iAdrszMessFinOK + bl affichageMess + b 100f +99: + ldr r0,iAdrszMessErreur @ error + bl affichageMess + mov r0, #1 @ return code error + b 100f +100: + mov r7,#EXIT @ program end + svc #0 @ system call +iAdrszMessDebutPgm: .int szMessDebutPgm +iAdrszMessFinOK: .int szMessFinOK +iAdrszMessErreur: .int szMessErreur +iAdrsZoneConv: .int sZoneConv +iAdrszMessLenStr: .int szMessLenStr +iAdrszMessValString: .int szMessValString +iAdrszMessCopyString: .int szMessCopyString +iAdrszMessStrEqual: .int szMessStrEqual +iAdrszMessStrNotEqual: .int szMessStrNotEqual +iAdrszMessStringfound: .int szMessStringfound +iAdrszMessStringJoint: .int szMessStringJoint +iAdrszMessStringRep: .int szMessStringRep +iAdrszString1: .int szString1 +iAdrszString2: .int szString2 +iAdrszString3: .int szString3 +iAdrszString4: .int szString4 +iAdrszString5: .int szString5 +iAdrszStringRec: .int szStringRec +iAdrszStringOcc: .int szStringOcc +iAdrszStringRep: .int szStringRep +/***************************************************/ +/* String length */ +/***************************************************/ +/* r0 contains string address */ +/* r0 returns length */ +stringLen: + push {r1,r2,lr} @ save registers + mov r1,#0 @ byte counter +1: + ldrb r2,[r0,r1] @ load byte + cmp r2,#0 @ final zero ? + moveq r0,r1 @ return counter + beq 100f + add r1,r1,#1 @ increment counter + b 1b @ and loop +100: + pop {r1,r2,pc} @ restaur registers +/***************************************************/ +/* empty String */ +/***************************************************/ +/* r0 contains string address */ +/* r0 returns 0 if string empty */ +emptyString: + push {lr} @ save registers + ldrb r0,[r0] @ load first byte + cmp r0,#0 + bne 100f + ldr r0,iAdrszMessEmpty + bl affichageMess + mov r0,#0 +100: + pop {pc} @ restaur registers +iAdrszMessEmpty: .int szMessEmpty +/***************************************************/ +/* String copy */ +/***************************************************/ +/* r0 contains string address */ +/* r1 contains area string */ +/* r2 contains area size */ +copyString: + push {r3-r5,lr} @ save registers + mov r5,#0 @ indice +1: + ldrb r3,[r0,r5] @ load byte + strb r3,[r1,r5] @ store byte + cmp r3,#0 @ final zero ? + moveq r0,r5 + beq 100f + add r5,r5,#1 @ increment indice + cmp r5,r2 @ > buffer size ? + bge 99f @ error + b 1b @ loop +99: + ldr r0,iAdrszMessBufferError + bl affichageMess + mov r0,#-1 +100: + pop {r3-r5,pc} @ restaur registers +/***************************************************/ +/* display number */ +/***************************************************/ +/* r0 contains number */ +displayNumber: + push {r1,lr} @ save registers + ldr r1,iAdrsZoneConv + bl conversion10 + ldr r0,iAdrsZoneConv + bl affichageMess + ldr r0,iAdrszCarriageReturn + bl affichageMess +100: + pop {r1,pc} @ restaur registers +iAdrszCarriageReturn: .int szCarriageReturn +/************************************/ +/* String compare */ +/************************************/ +/* r0 et r1 contains strings address */ +/* r0 returns 0 if equals -1 if less 1 if higter */ +comparString: + push {r1-r4} @ save registers + mov r2,#0 @ indice +1: + ldrb r3,[r0,r2] @ load byte string 1 + ldrb r4,[r1,r2] @ load byte string 2 + cmp r3,r4 + movlt r0,#-1 @ less + movgt r0,#1 @ hight + bne 100f @ not equal + cmp r3,#0 @ final zero ? + moveq r0,#0 @ equal + beq 100f @ and end + add r2,r2,#1 @ increment indice + b 1b @ and loop +100: + pop {r1-r4} + bx lr +/******************************************************************/ +/* search a substring in the string */ +/******************************************************************/ +/* r0 contains the address of the input string */ +/* r1 contains the address of substring */ +/* r0 returns index of substring in string or -1 if not found */ +searchSubString: + push {r1-r6,lr} @ save registers + mov r2,#0 @ counter byte input string + mov r3,#0 @ counter byte string + mov r6,#-1 @ index found + ldrb r4,[r1,r3] +1: + ldrb r5,[r0,r2] @ load byte string + cmp r5,#0 @ zero final ? + moveq r0,#-1 @ yes returns error + beq 100f + cmp r5,r4 @ compare character + beq 2f + mov r6,#-1 @ no equals - > raz index + mov r3,#0 @ and raz counter byte + add r2,#1 @ and increment counter byte + b 1b @ and loop +2: @ characters equals + cmp r6,#-1 @ first characters equals ? + moveq r6,r2 @ yes -> index begin in r6 + add r3,#1 @ increment counter substring + ldrb r4,[r1,r3] @ and load next byte + cmp r4,#0 @ zero final ? + beq 3f @ yes -> end search + add r2,#1 @ else increment counter string + b 1b @ and loop +3: + mov r0,r6 +100: + pop {r1-r6,lr} @ restaur registers + bx lr +/******************************************************************/ +/* joint strings */ +/******************************************************************/ +/* r0 and r1 contains strings address */ +/* r2 contains address buffer */ +/* r3 contains buffer length */ +concatString: + push {r3-r6,lr} @ save registers + mov r6,#0 + mov r5,#0 + 1: + ldrb r4,[r0,r6] @ load byte string 1 + cmp r4,#0 @ final zero ? + beq 2f + strb r4,[r2,r6] @ store byte in buffer + add r6,r6,#1 @ increment indice + cmp r6,r3 @ buffer max length ? + bge 99f @ error + b 1b @ else loop + + 2: + ldrb r4,[r1,r5] @ load byte string 2 + strb r4,[r2,r6] @ store byte in buffer + cmp r4,#0 @ zero final ? + beq 3f @ end + add r6,r6,#1 @ increment indice + cmp r6,r3 @ buffer max length ? + bge 99f @ yes error + add r5,r5,#1 @ else loop + b 2b +3: + mov r0,r6 + b 100f +99: + ldr r0,iAdrszMessBufferError + bl affichageMess + mov r0,#-1 + + 100: + pop {r3-r6,pc} @ restaur registers +iAdrszMessBufferError: .int szMessBufferError +/******************************************************************/ +/* replace occurences strings */ +/******************************************************************/ +/* r0 string address */ +/* r1 occurence string address */ +/* r2 replace string address */ +/* r3 contains address buffer */ +/* r4 contains buffer length */ +replaceOccString: + push {r4-r6,lr} @ save registers + mov r12,r0 + mov r11,r1 + mov r9,#0 @ indice string + mov r6,#0 @ indice occurence + mov r8,#0 @ indice write buffer + mov r10,#-1 @ string occ start address +1: + ldrb r0,[r11,r6] @ load search byte + cmp r0,#0 @ final zero ? + beq 3f +2: + ldrb r7,[r12,r9] @ load string byte + cmp r7,#0 @ zero final ? + beq 6f + cmp r0,r7 + bne 4f @ if not equal + cmp r10,#-1 @ string equal begin + moveq r10,r9 @ string equal begin = string indice + add r9,r9,#1 @ increment indice + add r6,r6,#1 + b 1b @ loop +3: @ end of strings equals + mov r1,r8 + bl replaceStr @ replace string + cmp r0,#-1 @ error ? + beq 99f + mov r8,r0 + mov r6,#0 @ raz indice search + mov r10,#-1 @ raz string equal begin + b 1b +4: @ bytes not equals + cmp r10,#-1 @ if not string equal begin + beq 5f +41: + ldrb r0,[r12,r10] @ store bytes string + strb r0,[r3,r8] + add r8,r8,#1 + cmp r8,r4 + bge 99f + add r10,r10,#1 + cmp r10,r9 + blt 41b + mov r10,#-1 @ raz string equal begin + mov r6,#0 @ raz indice occurence + b 1b @ loop + +5: @ byte not equal + str r7,[r3,r8] @ store byte string in buffer + add r8,r8,#1 + cmp r8,r4 @ max buffer size ? + bge 99f @ error + add r9,r9,#1 @ inc indice chaine + mov r6,#0 @ raz indice occ + b 1b @ loop + +6: @ end string + ldrb r0,[r11,r6] @ load search byte + cmp r0,#0 @ final zero + bne 7f + cmp r10,#-1 @ + beq 100f + mov r1,r8 + bl replaceStr @ replace + b 100f +7: + cmp r10,#-1 @ pas de char en cours + bne 8f + mov r0,#0 + strb r0,[r3,r8] @ final zero + b 100f + 8: + ldrb r0,[r12,r10] @ load string byte + strb r0,[r3,r8] @ store buffer byte + add r8,r8,#1 + cmp r8,r4 + bge 99f + add r10,r10,#1 @ increment begin string + cmp r10,r9 @ compare with position string + blt 8b @ loop + mov r0,#0 + strb r0,[r3,r8] @ final zero + + b 100f +99: @ buffer size error + ldr r0,iAdrszMessBufferError + bl affichageMess + mov r0,#-1 + 100: + pop {r4-r6,pc} +/******************************************************************/ +/* replace occurences strings */ +/******************************************************************/ +/* r0 string address */ +/* r1 indice to replace */ +/* r2 replace string address */ +/* r3 contains address buffer */ +/* r4 contains buffer length */ +/* r0 return new buffer position */ +replaceStr: + push {r1-r6,lr} @ save registers + mov r5,#0 +1: + ldrb r6,[r2,r5] @ load replace byte + cmp r6,#0 @ final zero + moveq r0,r1 + beq 100f + strb r6,[r3,r1] @ store byte in buffer + add r1,r1,#1 + cmp r1,r4 @ max size buffer ? + bge 99f @ error + add r5,r5,#1 + b 1b + +99: + ldr r0,iAdrszMessBufferError + bl affichageMess + mov r0,#-1 + +100: + pop {r1-r6,pc} +/***************************************************/ +/* ROUTINES INCLUDE */ +/***************************************************/ +.include "../affichage.inc" diff --git a/Task/Binary-strings/Ada/binary-strings-1.ada b/Task/Binary-strings/Ada/binary-strings-1.adb similarity index 100% rename from Task/Binary-strings/Ada/binary-strings-1.ada rename to Task/Binary-strings/Ada/binary-strings-1.adb diff --git a/Task/Binary-strings/Ada/binary-strings-2.ada b/Task/Binary-strings/Ada/binary-strings-2.adb similarity index 100% rename from Task/Binary-strings/Ada/binary-strings-2.ada rename to Task/Binary-strings/Ada/binary-strings-2.adb diff --git a/Task/Binary-strings/Ada/binary-strings-3.ada b/Task/Binary-strings/Ada/binary-strings-3.adb similarity index 100% rename from Task/Binary-strings/Ada/binary-strings-3.ada rename to Task/Binary-strings/Ada/binary-strings-3.adb diff --git a/Task/Binary-strings/Arturo/binary-strings.arturo b/Task/Binary-strings/Arturo/binary-strings.arturo index cc70d17dc3..3f92e5069d 100644 --- a/Task/Binary-strings/Arturo/binary-strings.arturo +++ b/Task/Binary-strings/Arturo/binary-strings.arturo @@ -16,8 +16,8 @@ y: z y: new z ; check if empty -if? empty? x -> print "empty" -else -> print "not empty" +switch empty? x -> print "empty" + -> print "not empty" ; append a string 'x ++ "!" diff --git a/Task/Binary-strings/Delphi/binary-strings.delphi b/Task/Binary-strings/Delphi/binary-strings.pas similarity index 100% rename from Task/Binary-strings/Delphi/binary-strings.delphi rename to Task/Binary-strings/Delphi/binary-strings.pas diff --git a/Task/Binary-strings/Elixir/binary-strings.elixir b/Task/Binary-strings/Elixir/binary-strings.ex similarity index 100% rename from Task/Binary-strings/Elixir/binary-strings.elixir rename to Task/Binary-strings/Elixir/binary-strings.ex diff --git a/Task/Binary-strings/Free-Pascal-Lazarus/binary-strings.pas b/Task/Binary-strings/Free-Pascal-Lazarus/binary-strings.pas new file mode 100644 index 0000000000..7a8bb08035 --- /dev/null +++ b/Task/Binary-strings/Free-Pascal-Lazarus/binary-strings.pas @@ -0,0 +1,31 @@ +uses sysutils; +var + { declaration is creation } + a,b:string; + { creation with default value } + c:string = 'this is a string'; +begin + { assignment } + a := 'test'; + b := 'test'; + writeln(a:6, b:6); + { comparison } + writeln('equal? ', a = b ); + { empty string } + writeln('empty? ', a = ''); + { cloning, copying } + a := c; + writeln('copy c to a, a is now: ', a); + { append } + b := b +'W'; + writeln('append W to b: ',b); + { extract substring } + b := copy(a,6,2); + writeln('this should be is": ',b); + { replace } + a := stringreplace(a,'i','I',[rfReplaceAll]); + writeln('replace i with I: ',a); + { join } + a:= concat(b,c); + writeln('join b and c; ',a); +end. diff --git a/Task/Binary-strings/Julia/binary-strings.julia b/Task/Binary-strings/Julia/binary-strings.jl similarity index 100% rename from Task/Binary-strings/Julia/binary-strings.julia rename to Task/Binary-strings/Julia/binary-strings.jl diff --git a/Task/Binary-strings/Kotlin/binary-strings.kotlin b/Task/Binary-strings/Kotlin/binary-strings.kts similarity index 100% rename from Task/Binary-strings/Kotlin/binary-strings.kotlin rename to Task/Binary-strings/Kotlin/binary-strings.kts diff --git a/Task/Binary-strings/M2000-Interpreter/binary-strings.m2000 b/Task/Binary-strings/M2000-Interpreter/binary-strings.m2000 new file mode 100644 index 0000000000..02751bf64b --- /dev/null +++ b/Task/Binary-strings/M2000-Interpreter/binary-strings.m2000 @@ -0,0 +1,51 @@ +' String assignment +a$="alfa" +string a="beta" +b="beta too" +all=a$+a+b +Print All +' String comparison +Print a$=a, a=b, a+A+" too"+a$=a+b+a$ ' false false true +b$=a$ +// compare return 0 for equal (-1,0, 1), +//same as <=> but compare work with variables only (without coping values) +print "using compare", compare(a$, b$), a$<=>b$ ' 0 0 +' String cloning and copying +a2$=a$ ' copy +' Check if a string is empty +print a2$="", len(a$)=0 +' Append a byte to a string +c$=Str$("ABCDE") ' utf16le "ABCDE" convert to ANSI (one byte per code) +Print len(c$)=2.5 ' measure 16bit, so we get 2.5x2=5 bytes +c$+=Str$("Z") +Print Len(c$)=3 +Print chr$(c$)="ABCDEZ" ' convert to UTF16LE and then compare +' Extract a substring from a string +Print chr$(mid$(c$,2, 2 as byte))="BC" +Print mid$("ABCDEZ",2,2) ="BC" +' Replace every occurrence of a byte (or a string) in a string with another string +Print Replace$("BC", "?", "ABCDEZBC")="A?DEZ?" +Print Replace$("BC", "?", CHR$(c$))="A?DEZ" +' String creation and destruction (using buffers. Memory Blocks) +' (when needed and if there's no garbage collection or similar mechanism) +'Join strings (IN A BUFFRT) +buffer clear K as byte*10 ' using clear to erase the buffer with 0 +Return K, 0:=c$ +Print eval(k, 2)=asc("C"), eval(k, 3)=asc("D") +Return k, 2:=str$("KL") +Print chr$(eval$(k, 0, 6))="ABKLEZ" +' rotate one byte +M= eval(K,0) +return k, 0:=eval$(k, 1, 5), 5:=m ' we can place strings or bytes at specific index - from 0. +Print chr$(eval$(k, 0, 6))="BKLEZA" ' true +// change length of buffer +buffer K as byte*6 +// now we get the full string (with the length of 6 bytes) +Print chr$(eval$(k))="BKLEZA" ' true +buffer K1 as byte*6 +// buffers are special objects, so we have strings refering by object pointer. +// we can pass the buffer pointer or return it from a function, also we can swap variables for buffers +swap K, k1 +Print chr$(eval$(k1))="BKLEZA" ' true +// we can get the address of string: +Print k1(0) ' return the absolute address of byte at offset 0 on k1 buffer diff --git a/Task/Binary-strings/OCaml/binary-strings-1.ocaml b/Task/Binary-strings/OCaml/binary-strings-1.ml similarity index 100% rename from Task/Binary-strings/OCaml/binary-strings-1.ocaml rename to Task/Binary-strings/OCaml/binary-strings-1.ml diff --git a/Task/Binary-strings/OCaml/binary-strings-10.ocaml b/Task/Binary-strings/OCaml/binary-strings-10.ml similarity index 100% rename from Task/Binary-strings/OCaml/binary-strings-10.ocaml rename to Task/Binary-strings/OCaml/binary-strings-10.ml diff --git a/Task/Binary-strings/OCaml/binary-strings-2.ocaml b/Task/Binary-strings/OCaml/binary-strings-2.ml similarity index 100% rename from Task/Binary-strings/OCaml/binary-strings-2.ocaml rename to Task/Binary-strings/OCaml/binary-strings-2.ml diff --git a/Task/Binary-strings/OCaml/binary-strings-3.ocaml b/Task/Binary-strings/OCaml/binary-strings-3.ml similarity index 100% rename from Task/Binary-strings/OCaml/binary-strings-3.ocaml rename to Task/Binary-strings/OCaml/binary-strings-3.ml diff --git a/Task/Binary-strings/OCaml/binary-strings-4.ocaml b/Task/Binary-strings/OCaml/binary-strings-4.ml similarity index 100% rename from Task/Binary-strings/OCaml/binary-strings-4.ocaml rename to Task/Binary-strings/OCaml/binary-strings-4.ml diff --git a/Task/Binary-strings/OCaml/binary-strings-5.ocaml b/Task/Binary-strings/OCaml/binary-strings-5.ml similarity index 100% rename from Task/Binary-strings/OCaml/binary-strings-5.ocaml rename to Task/Binary-strings/OCaml/binary-strings-5.ml diff --git a/Task/Binary-strings/OCaml/binary-strings-6.ocaml b/Task/Binary-strings/OCaml/binary-strings-6.ml similarity index 100% rename from Task/Binary-strings/OCaml/binary-strings-6.ocaml rename to Task/Binary-strings/OCaml/binary-strings-6.ml diff --git a/Task/Binary-strings/OCaml/binary-strings-7.ocaml b/Task/Binary-strings/OCaml/binary-strings-7.ml similarity index 100% rename from Task/Binary-strings/OCaml/binary-strings-7.ocaml rename to Task/Binary-strings/OCaml/binary-strings-7.ml diff --git a/Task/Binary-strings/OCaml/binary-strings-8.ocaml b/Task/Binary-strings/OCaml/binary-strings-8.ml similarity index 100% rename from Task/Binary-strings/OCaml/binary-strings-8.ocaml rename to Task/Binary-strings/OCaml/binary-strings-8.ml diff --git a/Task/Binary-strings/OCaml/binary-strings-9.ocaml b/Task/Binary-strings/OCaml/binary-strings-9.ml similarity index 100% rename from Task/Binary-strings/OCaml/binary-strings-9.ocaml rename to Task/Binary-strings/OCaml/binary-strings-9.ml diff --git a/Task/Binary-strings/Phix/binary-strings.phix b/Task/Binary-strings/Phix/binary-strings.phix index ba6af38cc2..b580c1c84c 100644 --- a/Task/Binary-strings/Phix/binary-strings.phix +++ b/Task/Binary-strings/Phix/binary-strings.phix @@ -1,27 +1,25 @@ -(phixonline)--> - with javascript_semantics - string s = "abc" - s = x"ef bb bf" -- explicit binary string (the utf8 BOM) - s[2] = 0 - s[3] = 'z' - if s="\#EF\0z" then puts(1,"ok\n") end if - string t = s - t[1..2] = "xy" -- s remains unaltered - ?t -- "xyz" - t = "food" ?t - t[2..3] = 'e' ?t -- "feed" - t[3..2] = "ast" ?t -- "feasted" - t[3..-2] = "" ?t -- "fed" - if length(t)=0 then puts(1,"t is empty\n") end if - if t!="" then puts(1,"t is not empty\n") end if - t = "be" - t &= 't' ?t -- bet - t = 'a'&t ?t -- abet - ?t[2..3] -- be - ?substitute(t,"be","bbo") -- abbot - ?substitute(t,"be","dep") -- adept - t = substitute(t,"be","dep") -- to actually modify t - ?join({"abc","def","ghi"}) -- "abc def ghi" - ?join({"abc","def","ghi"},"") -- "abcdefghi" - ?join({"abc","def","ghi"},"\n") -- "abc\ndef\nghi" - DNA - -{def base_count - {def base_count.r - {lambda {:dna :b :n :i :count} - {if {> :i :n} - then :count - else {base_count.r :dna :b :n {+ :i 1} - {if {W.equal? {W.get :i :dna} :b} - then {+ :count 1} - else :count}} }}} - {lambda {:dna :b} - {base_count.r :dna :b {- {W.length :dna} 1} 0 0} }} --> base_count - -{def S {S.map {base_count {DNA}}} A C G T}} --> S -[A C G T] = (129 97 119 155) - -A+C+G+T = {+ {S}} --> A+C+G+T = 500 diff --git a/Task/Bioinformatics-base-count/Lua/bioinformatics-base-count.lua b/Task/Bioinformatics-base-count/Lua/bioinformatics-base-count.lua deleted file mode 100644 index 13dc7d2a11..0000000000 --- a/Task/Bioinformatics-base-count/Lua/bioinformatics-base-count.lua +++ /dev/null @@ -1,27 +0,0 @@ -function prettyprint(seq) -- approx DDBJ format - seq = seq:gsub("%A",""):lower() - local sums, n = { a=0, c=0, g=0, t=0 }, 1 - seq:gsub("(%a)", function(c) sums[c]=sums[c]+1 end) - local function printf(s,...) io.write(s:format(...)) end - printf("LOCUS AB000000 %12d bp mRNA linear HUM 01-JAN-2001\n", #seq) - printf(" BASE COUNT %12d a %12d c %12d g %12d t\n", sums.a, sums.c, sums.g, sums.t) - printf("ORIGIN\n") - while n < #seq do - local sub60 = seq:sub(n,n+59) - printf("%9d %s\n", n, sub60:gsub("(..........)","%1 ")) - n = n + #sub60 - end -end - -prettyprint[[ -CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG -CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG -AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT -GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT -CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG -TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA -TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT -CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG -TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC -GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAAT -]] diff --git a/Task/Bioinformatics-base-count/MATLAB/bioinformatics-base-count.m b/Task/Bioinformatics-base-count/MATLAB/bioinformatics-base-count.m deleted file mode 100644 index 12c2f553f4..0000000000 --- a/Task/Bioinformatics-base-count/MATLAB/bioinformatics-base-count.m +++ /dev/null @@ -1,13 +0,0 @@ -function r = base_count(f) - fid = fopen(f,'r'); - nn=[0,0,0,0]; - while ~feof(fid) - s = fgetl(fid); - fprintf(1,'%5d :%s\n', sum(nn), s(s=='A'|s=='C'|s=='G'|s=='T')); - nn = nn+[sum(s=='A'),sum(s=='C'),sum(s=='G'),sum(s=='T')]; - end - fclose(fid); - - fprintf(1, '\nBases:\n\n A : %d\n C : %d\n G : %d\n T : %d\n', nn); - fprintf(1, '\nTotal: %d\n\n', sum(nn)); -end; diff --git a/Task/Bioinformatics-base-count/Mathematica/bioinformatics-base-count.math b/Task/Bioinformatics-base-count/Mathematica/bioinformatics-base-count.math deleted file mode 100644 index c4ace88df1..0000000000 --- a/Task/Bioinformatics-base-count/Mathematica/bioinformatics-base-count.math +++ /dev/null @@ -1,14 +0,0 @@ -seq = "CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATGCTCGTGCTTTCCA\ -ATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTGAGGACAAAGGTCAAGATGGAGCGCATCGAACGC\ -AATAAGGATCATTTGATGGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTTCGA\ -TTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGGTCAGTCCCAATGTGCGGGGTTTC\ -TTTTAGTACGTCGGGAGTGGTATTATATTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTT\ -AGGTTATCGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTGTCCTAAATTTGAA\ -TGGCAAACACAAATAAGATTTAGCAATTCGTGTAGACGACCGGGGACTTGCATGATGGGAGCAGCTTTGT\ -TAAACTACGAACGTAAT"; -size = 70; -parts = StringPartition[seq, UpTo[size]]; -begins = Most[Accumulate[Prepend[StringLength /@ parts, 1]]]; -ends = Rest[Accumulate[Prepend[StringLength /@ parts, 0]]]; -StringRiffle[MapThread[ToString[#1] <> "-" <> ToString[#2] <> ": " <> #3 &, {begins, ends, parts}], "\n"] -StringRiffle[#1 <> ": " <> ToString[#2] & @@@ Tally[Characters[seq]], "\n"] diff --git a/Task/Bioinformatics-base-count/Nim/bioinformatics-base-count.nim b/Task/Bioinformatics-base-count/Nim/bioinformatics-base-count.nim deleted file mode 100644 index db0e61d7be..0000000000 --- a/Task/Bioinformatics-base-count/Nim/bioinformatics-base-count.nim +++ /dev/null @@ -1,59 +0,0 @@ -import strformat -import strutils - -const Source = "CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG" & - "CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG" & - "AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT" & - "GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT" & - "CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG" & - "TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA" & - "TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT" & - "CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG" & - "TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC" & - "GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAAT" - -# Enumeration type for bases. -type Base* {.pure.} = enum A, C, G, T, Other = "other" - -proc display*(dnaSeq: string) = - ## Display a DNA sequence using EMBL format. - - var counts: array[Base, Natural] # Count of bases. - for c in dnaSeq: - inc counts[parseEnum[Base]($c, Other)] # Use Other as default value. - - # Display the SQ line. - var sqline = fmt"SQ {dnaSeq.len} BP; " - for (base, count) in counts.pairs: - sqline &= fmt"{count} {base}; " - echo sqline - - # Display the sequence. - var idx = 0 - var row = newStringOfCap(80) - var remaining = dnaSeq.len - - while remaining > 0: - row.setLen(0) - row.add(" ") - - # Add groups of 10 bases. - for group in 1..6: - let nextIdx = idx + min(10, remaining) - row.add(dnaSeq[idx..8}") - echo row - - # Add termination. - echo "//" - - -when isMainModule: - Source.display() diff --git a/Task/Bioinformatics-base-count/Pascal/bioinformatics-base-count.pas b/Task/Bioinformatics-base-count/Pascal/bioinformatics-base-count.pas deleted file mode 100644 index 541e8e1eca..0000000000 --- a/Task/Bioinformatics-base-count/Pascal/bioinformatics-base-count.pas +++ /dev/null @@ -1,77 +0,0 @@ -program DNA_Base_Count; -{$IFDEF FPC} - {$MODE DELPHI}//String = AnsiString -{$ELSE} - {$APPTYPE CONSOLE} -{$ENDIF} -const - dna = - 'CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG' + - 'CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG' + - 'AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT' + - 'GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT' + - 'CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG' + - 'TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA' + - 'TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT' + - 'CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG' + - 'TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC' + - 'GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAAT'; -var - CntIdx : array of NativeUint; - DNABases : String; - SumBaseTotal : NativeInt; - -procedure OutFormatBase(var DNA: String;colWidth:NativeInt); -var - j: NativeInt; -Begin - j := 0; - Writeln(' DNA base sequence'); - While j) { - chomp; - printf "%4d: %s\n", $total+1, s/(.{10})/$1 /gr; - $total += length; - $cnt{$_}++ for split // -} - -say "\nTotal bases: $total"; -say "$_: " . ($cnt{$_}//0) for ; - -__DATA__ -CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG -CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG -AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT -GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT -CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG -TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA -TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT -CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG -TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC -GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAAT diff --git a/Task/Bioinformatics-base-count/Phix/bioinformatics-base-count.phix b/Task/Bioinformatics-base-count/Phix/bioinformatics-base-count.phix deleted file mode 100644 index ff060d39d4..0000000000 --- a/Task/Bioinformatics-base-count/Phix/bioinformatics-base-count.phix +++ /dev/null @@ -1,24 +0,0 @@ -(phixonline)--> - constant dna = substitute(""" - CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG - CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG - AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT - GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT - CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG - TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA - TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT - CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG - TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC - GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAAT - ""","\n","") - sequence acgt = repeat(0,5) - for i=1 to length(dna) do - acgt[find(dna[i],"ACGT")] += 1 - end for - acgt[$] = sum(acgt) - sequence s = split(trim(join_by(split(join_by(dna,1,10,""),"\n"),1,5," ")),"\n") - for i=1 to length(s) do - printf(1,"%3d: %s\n",{(i-1)*50+1,s[i]}) - end for - printf(1,"\nBase counts: A:%d, C:%d, G:%d, T:%d, total:%d\n",acgt) - $ ) - - [ 0 swap - [ dup $ "" != while - cr over number$ - 4 justify echo$ - 5 times - [ dup $ "" = iff - conclude done - sp - 10 split swap echo$ ] - dip [ 50 + ] again ] - 2drop ] is prettyprint ( $ --> ) - - [ stack ] is adenine ( --> s ) - [ stack ] is cytosine ( --> s ) - [ stack ] is guanine ( --> s ) - [ stack ] is thymine ( --> s ) - - [ table - adenine cytosine - guanine thymine ] is bases ( --> [ ) - - [ 4 times - [ 0 i^ bases put ] - witheach - [ $ "ACGT" find bases - 1 swap tally ] - 4 times - [ sp - i^ bases dup echo - sp share echo cr ] - 0 4 times - [ i^ bases take + ] - cr say " total " echo ] is tallybases ( [ --> ) - - $ "CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG" - $ "CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG" join - $ "AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT" join - $ "GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT" join - $ "CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG" join - $ "TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA" join - $ "TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT" join - $ "CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG" join - $ "TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC" join - $ "GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAAT" join - - dup prettyprint cr cr tallybases diff --git a/Task/Bioinformatics-base-count/R/bioinformatics-base-count.r b/Task/Bioinformatics-base-count/R/bioinformatics-base-count.r deleted file mode 100644 index 7a6b6c1221..0000000000 --- a/Task/Bioinformatics-base-count/R/bioinformatics-base-count.r +++ /dev/null @@ -1,42 +0,0 @@ -#Data -gene1 <- "CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG -CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG -AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT -GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT -CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG -TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA -TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT -CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG -TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC -GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAAT" - -#Analysis: -gene2 <- gsub("\n", "", gene1) #remove \n chars -gene3 <- strsplit(gene2, split = character(0)) #split into list -gene4 <- gene3[[1]] #pull out character vector from list -basecounts <- as.data.frame(table(gene4)) #make table of base counts - -#quick helper function to print table results -print_row <- function(df, row){paste0(df$gene[row],": ", df$Freq[row])} - -#Print Function for Data with Results: -cat(" Data: \n", - " 1:",substring(gene2, 1, 50),"\n", - " 51:",substring(gene2, 51, 100),"\n", - "101:",substring(gene2, 101, 150),"\n", - "151:",substring(gene2, 151, 200),"\n", - "201:",substring(gene2, 201, 250),"\n", - "251:",substring(gene2, 251, 300),"\n", - "301:",substring(gene2, 301, 350),"\n", - "351:",substring(gene2, 351, 400),"\n", - "401:",substring(gene2, 401, 450),"\n", - "451:",substring(gene2, 451, 500),"\n", - "\n", - "Base Count Results: \n", - print_row(basecounts,1), "\n", - print_row(basecounts,2), "\n", - print_row(basecounts,3), "\n", - print_row(basecounts,4), "\n", - "\n", - "Total Base Count:", paste(length(gene4)) - ) diff --git a/Task/Bioinformatics-base-count/REXX/bioinformatics-base-count.rexx b/Task/Bioinformatics-base-count/REXX/bioinformatics-base-count.rexx deleted file mode 100644 index 99c88e767b..0000000000 --- a/Task/Bioinformatics-base-count/REXX/bioinformatics-base-count.rexx +++ /dev/null @@ -1,36 +0,0 @@ -/*REXX program finds the number of each base in a DNA string */ -/* (along with a total). */ -Parse Arg dna . -If dna==''|dna==',' Then - dna='cgtaaaaaattacaacgtcctttggctatctcttaaactcctgctaaatg', - 'ctcgtgctttccaattatgtaagcgttccgagacggggtggtcgattctg', - 'aggacaaaggtcaagatggagcgcatcgaacgcaataaggatcatttgat', - 'gggacgtttcgtcgacaaagtcttgtttcgagagtaacggctaccgtctt', - 'cgattctgcttataacactatgttcttatgaaatggatgttctgagttgg', - 'tcagtcccaatgtgcggggtttcttttagtacgtcgggagtggtattata', - 'tttaatttttctatatagcgatctgtatttaagcaattcatttaggttat', - 'cgccgcgatgctcggttcggaccgccaagcatctggctccactgctagtg', - 'tcctaaatttgaatggcaaacacaaataagatttagcaattcgtgtagac', - 'gaccggggacttgcatgatgggagcagctttgttaaactacgaacgtaat' -dna=translate(space(dna,0)) /* elide blanks from DNA; uppercas*/ -Say '--------length of the DNA string: ' length(dna) -count.=0 /* initialize the count for all bases*/ -w=1 /* the maximum width of a base count */ -names='' /* list of all names */ -Do j=1 To length(dna) /* traipse through the DNA string */ - name=substr(dna,j,1) /* obtain a base name from the DNA */ - If pos(name,names)==0 Then - names=names||name /* if not found, add it to the list */ - count.name=count.name+1 /* bump the count of this base. */ - w=max(w,length(count.name)) /* compute the maximum number width */ - End -Say -Do k=0 To 255 - z=d2c(k) /* traipse through all possibilities */ - If pos(z,names)>0 Then Do - Say ' base ' z ' has a basecount of: ' right(count.z,w) - count.tot=count.tot+count.z /* add to a grand total to verify */ - End - End -Say -Say '--------total for all basecounts:' right(count.tot,w+1) diff --git a/Task/Bioinformatics-base-count/Racket/bioinformatics-base-count.rkt b/Task/Bioinformatics-base-count/Racket/bioinformatics-base-count.rkt deleted file mode 100644 index b0614e6269..0000000000 --- a/Task/Bioinformatics-base-count/Racket/bioinformatics-base-count.rkt +++ /dev/null @@ -1,55 +0,0 @@ -#lang racket - -(define (fold-sequence seq kons #:finalise (finalise (λ x (apply values x))) . k0s) - (define (recur seq . ks) - (if (null? seq) - (call-with-values (λ () (apply finalise ks)) (λ vs (apply values vs))) - (call-with-values (λ () (apply kons (car seq) ks)) (λ ks+ (apply recur (cdr seq) ks+))))) - (apply recur (if (string? seq) (string->list (regexp-replace* #px"[^ACGT]" seq "")) seq) k0s)) - -(define (sequence->pretty-printed-string seq) - (define (fmt idx cs-rev) (format "~a: ~a" (~a idx #:width 3 #:align 'right) (list->string (reverse cs-rev)))) - (fold-sequence - seq - (λ (b n start-idx lns-rev cs-rev) - (if (zero? (modulo n 50)) - (values (+ n 1) n (if (pair? cs-rev) (cons (fmt start-idx cs-rev) lns-rev) lns-rev) (cons b null)) - (values (+ n 1) start-idx lns-rev (cons b cs-rev)))) - 0 0 null null - #:finalise (λ (n idx lns-rev cs-rev) - (string-join (reverse (if (null? cs-rev) lns-rev (cons (fmt idx cs-rev) lns-rev))) "\n")))) - -(define (count-bases b as cs gs ts n) - (values (+ as (if (eq? b #\A) 1 0)) - (+ cs (if (eq? b #\C) 1 0)) - (+ gs (if (eq? b #\T) 1 0)) - (+ ts (if (eq? b #\G) 1 0)) - (add1 n))) - -(define (bioinformatics-Base_count s) - (define-values (as cs gs ts n) (fold-sequence s count-bases 0 0 0 0 0)) - (printf "SEQUENCE:~%~%~a~%~%" (sequence->pretty-printed-string s)) - (printf "BASE COUNT:~%-----------~%~%~a~%~%" - (string-join (map (λ (c n) (format " ~a :~a" c (~a #:width 4 #:align 'right n))) - '(A T C G) - (list as ts cs gs)) "\n")) - (newline) - (printf "TOTAL: ~a~%" n)) - -(module+ - main - (define the-string - #< = base_count.iter().collect(); // HashMaps can't be sorted, so collect into Vec - base_count.sort_by_key(|bc| bc.0); // Sort bases alphabetically - for (base, count) in base_count.iter() { - println!(" {}: {:3}", base, count); - } - println!(); - println!("Total: {}", total_count); -} diff --git a/Task/Bioinformatics-base-count/Swift/bioinformatics-base-count.swift b/Task/Bioinformatics-base-count/Swift/bioinformatics-base-count.swift deleted file mode 100644 index 22b27dd044..0000000000 --- a/Task/Bioinformatics-base-count/Swift/bioinformatics-base-count.swift +++ /dev/null @@ -1,22 +0,0 @@ -import Foundation - -let dna = """ - CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG - CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG - AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT - GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT - CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG - TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA - TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT - CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG - TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC - GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAAT - """ - -print("input:\n\(dna)\n") - -let counts = - dna.replacingOccurrences(of: "\n", with: "").reduce(into: [:], { $0[$1, default: 0] += 1 }) - -print("Counts: \(counts)") -print("Total: \(counts.values.reduce(0, +))") diff --git a/Task/Bioinformatics-base-count/Tcl/bioinformatics-base-count.tcl b/Task/Bioinformatics-base-count/Tcl/bioinformatics-base-count.tcl deleted file mode 100644 index 0d691e71c8..0000000000 --- a/Task/Bioinformatics-base-count/Tcl/bioinformatics-base-count.tcl +++ /dev/null @@ -1,28 +0,0 @@ -namespace path ::tcl::mathop - -proc process {data {width 50}} { - set len [string length $data] - set addrwidth [string length [* [/ $len $width] $width]] - for {set i 0} {$i < $len} {incr i $width} { - puts "[format %${addrwidth}u $i] [string range $data $i $i+[- $width 1]]" - } - puts "\nBase count:" - foreach base {A C G T} { - puts "$base [regexp -all $base $data]" - } - puts "Total $len" -} - - -set test [string cat \ - CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG \ - CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG \ - AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT \ - GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT \ - CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG \ - TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA \ - TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT \ - CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG \ - TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC \ - GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAAT] -process $test 50 diff --git a/Task/Bioinformatics-base-count/V-(Vlang)/bioinformatics-base-count.v b/Task/Bioinformatics-base-count/V-(Vlang)/bioinformatics-base-count.v deleted file mode 100644 index 36e3777cd4..0000000000 --- a/Task/Bioinformatics-base-count/V-(Vlang)/bioinformatics-base-count.v +++ /dev/null @@ -1,37 +0,0 @@ -fn main() { - dna := "" + - "CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG" + - "CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG" + - "AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT" + - "GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT" + - "CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG" + - "TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA" + - "TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT" + - "CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG" + - "TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC" + - "GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAAT" - - println("SEQUENCE:") - le := dna.len - for i := 0; i < le; i += 50 { - mut k := i + 50 - if k > le { - k = le - } - println("${i:5}: ${dna[i..k]}") - } - mut base_map := map[byte]int{} // allows for 'any' base - for i in 0..le { - base_map[dna[i]]++ - } - mut bases := base_map.keys() - bases.sort() - - println("\nBASE COUNT:") - for base in bases { - println(" $base: ${base_map[base]:3}") - } - println(" ------") - println(" Σ: $le") - println(" ======") -} diff --git a/Task/Bioinformatics-base-count/VBScript/bioinformatics-base-count.vb b/Task/Bioinformatics-base-count/VBScript/bioinformatics-base-count.vb deleted file mode 100644 index 422d98cd55..0000000000 --- a/Task/Bioinformatics-base-count/VBScript/bioinformatics-base-count.vb +++ /dev/null @@ -1,31 +0,0 @@ -b=_ -"CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG" &_ -"CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG" &_ -"AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT" &_ -"GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT" &_ -"CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG" &_ -"TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA" &_ -"TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT" &_ -"CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG" &_ -"TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC" &_ -"GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAAT" - -s="SEQUENCE:" -acnt=0:ccnt=0:gcnt=0:tcnt=0 - -for i=0 to len(b)-1 - if (i mod 30)=0 then s = s & vbcrlf & right(" "& i+1,3)&": " - if (i mod 5)=0 then s=s& " " - m=mid(b,i+1,1) - s=s & m - select case m - case "A":acnt=acnt+1 - case "C":ccnt=ccnt+1 - case "G":gcnt=gcnt+1 - case "T":tcnt=tcnt+1 - case else - wscript.echo "error at ",i+1, m - end select -next -wscript.echo s & vbcrlf -wscript.echo "Count: A="&acnt & " C=" & ccnt & " G=" & gcnt & " T=" & tcnt diff --git a/Task/Bioinformatics-base-count/Wren/bioinformatics-base-count.wren b/Task/Bioinformatics-base-count/Wren/bioinformatics-base-count.wren deleted file mode 100644 index c284aa8c14..0000000000 --- a/Task/Bioinformatics-base-count/Wren/bioinformatics-base-count.wren +++ /dev/null @@ -1,38 +0,0 @@ -import "/fmt" for Fmt -import "/sort" for Sort -import "/iterate" for Stepped - -var dna = "CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG" + - "CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG" + - "AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT" + - "GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT" + - "CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG" + - "TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA" + - "TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT" + - "CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG" + - "TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC" + - "GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAAT" - -System.print("SEQUENCE:") -var le = dna.count -for (i in Stepped.new(0...le, 50)) { - var k = i + 50 - if (k > le) k = le - System.print("%(Fmt.d(5, i)): %(dna[i...k])") -} -var baseMap = {} // allows for 'any' base -for (i in 0...le) { - var d = dna[i] - var v = baseMap[d] - baseMap[d] = !v ? 1 : v + 1 -} -var bases = baseMap.keys.toList -Sort.quick(bases) - -System.print("\nBASE COUNT:") -for (base in bases) { - System.print(" %(base): %(Fmt.d(3, baseMap[base]))") -} -System.print(" ------") -System.print(" Σ: %(le)") -System.print(" ======") diff --git a/Task/Bioinformatics-base-count/XPL0/bioinformatics-base-count.xpl0 b/Task/Bioinformatics-base-count/XPL0/bioinformatics-base-count.xpl0 deleted file mode 100644 index 2f6adbf6f4..0000000000 --- a/Task/Bioinformatics-base-count/XPL0/bioinformatics-base-count.xpl0 +++ /dev/null @@ -1,35 +0,0 @@ -char Bases; -int Counts(256), Cnt, I, Ch; -[Bases:= " -CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG -CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG -AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT -GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT -CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG -TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA -TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT -CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG -TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC -GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAATx "; - -for I:= 0 to 255 do Counts(I):= 0; -Format(5, 0); -Cnt:= 0; -I:= 0; -loop [repeat Ch:= Bases(I); - I:= I+1; - if Ch = ^x then quit; - Counts(Ch):= Counts(Ch)+1; - ChOut(0, Ch); - until Ch = \LF\$0A; - RlOut(0, float(Cnt)); Text(0, ": "); - Cnt:= Cnt + 50; - ]; -CrLf(0); CrLf(0); -Text(0, "Base counts A: "); IntOut(0, Counts(^A)); -Text(0, " C: "); IntOut(0, Counts(^C)); -Text(0, " G: "); IntOut(0, Counts(^G)); -Text(0, " T: "); IntOut(0, Counts(^T)); -Text(0, " -Total: "); IntOut(0, Cnt); CrLf(0); -] diff --git a/Task/Bioinformatics-base-count/Zkl/bioinformatics-base-count.zkl b/Task/Bioinformatics-base-count/Zkl/bioinformatics-base-count.zkl deleted file mode 100644 index 51481d619d..0000000000 --- a/Task/Bioinformatics-base-count/Zkl/bioinformatics-base-count.zkl +++ /dev/null @@ -1,19 +0,0 @@ -bases:= -#<<<" -CGTAAAAAATTACAACGTCCTTTGGCTATCTCTTAAACTCCTGCTAAATG -CTCGTGCTTTCCAATTATGTAAGCGTTCCGAGACGGGGTGGTCGATTCTG -AGGACAAAGGTCAAGATGGAGCGCATCGAACGCAATAAGGATCATTTGAT -GGGACGTTTCGTCGACAAAGTCTTGTTTCGAGAGTAACGGCTACCGTCTT -CGATTCTGCTTATAACACTATGTTCTTATGAAATGGATGTTCTGAGTTGG -TCAGTCCCAATGTGCGGGGTTTCTTTTAGTACGTCGGGAGTGGTATTATA -TTTAATTTTTCTATATAGCGATCTGTATTTAAGCAATTCATTTAGGTTAT -CGCCGCGATGCTCGGTTCGGACCGCCAAGCATCTGGCTCCACTGCTAGTG -TCCTAAATTTGAATGGCAAACACAAATAAGATTTAGCAATTCGTGTAGAC -GACCGGGGACTTGCATGATGGGAGCAGCTTTGTTAAACTACGAACGTAAT" - " \n"; -#<<< - -[0..*,50].zipWith(fcn(n,bases){ println("%6d: %s".fmt(n,bases.concat())) }, - bases.walker().walk.fp(50)).pump(Void); // .pump forces the iterator - -println("\nBase Counts: ", bases.counts().pump(String,Void.Read,"%s: %d ".fmt)); -println("Total: ",bases.len()); diff --git a/Task/Biorhythms/11l/biorhythms.11l b/Task/Biorhythms/11l/biorhythms.11l index d38daa2837..5e64e6837e 100644 --- a/Task/Biorhythms/11l/biorhythms.11l +++ b/Task/Biorhythms/11l/biorhythms.11l @@ -21,7 +21,7 @@ F biorhythms(birthdate_str, targetdate_str) V cycle_lengths = [23, 28, 33] V quadrants = [(‘up and rising’, ‘peak’), (‘up but falling’, ‘transition’), (‘down and falling’, ‘valley’), (‘down but rising’, ‘transition’)] - L(i) 3 + L(i) 0.<3 V label = cycle_labels[i] V length = cycle_lengths[i] V position = days % length diff --git a/Task/Biorhythms/ALGOL-68/biorhythms.alg b/Task/Biorhythms/ALGOL-68/biorhythms.alg new file mode 100644 index 0000000000..9687f0aefa --- /dev/null +++ b/Task/Biorhythms/ALGOL-68/biorhythms.alg @@ -0,0 +1,76 @@ +BEGIN # biorythms # + + # code from the Day of the week of Christmas and New Year task # + []STRING day name = + []STRING( "SAT", "SUN", "MON", "TUE", "WED", "THU", "FRI" )[ AT 0 ]; + PROC day of week = ( INT y, m, d )INT: + BEGIN + INT mm := m; + INT yy := y; + IF mm <= 2 THEN + mm +:= 12; + yy -:= 1 + FI; + INT j = yy OVER 100; + INT k = yy MOD 100; + ( d + ( ( mm + 1 ) * 26 ) OVER 10 + k + k OVER 4 + j OVER 4 + 5 * j ) MOD 7 + END # day of week # ; + # end code from the Day of the week of Christmas and New Year task # + # code from the days between dates task # + PROC gregorian = ( INT y, m, d )INT: + BEGIN + INT n = ( m + 9 ) - ( ( ( m + 9 ) OVER 12 ) * 12 ); + INT w = y - ( n OVER 10 ); + ( 365 * w ) + ( w OVER 4 ) - ( w OVER 100 ) + ( w OVER 400 ) + + ( ( ( n * 306 ) + 5 ) OVER 10 ) + ( d - 1 ) + END # gregorian # ; + # end code from the days between dates task # + + BEGIN # main routine - translated from the Fortran sample's main program # + PROC double line = VOID: print( ( "=" * 75, newline ) ); + PROC in range = ( REAL v, INT low, high )INT: + IF v < low THEN low ELIF v > high THEN high ELSE ENTIER v FI; + + REAL pi2 = pi * 2; + + INT byear, bmon, bday, tyear, tmon, tday, nday; + print( ( "ENTER YOUR BIRTHDAY YYYY MM DD: " ) ); + read( ( byear, bmon, bday ) ); + print( ( "ENTER START DATE YYYY MM DD: " ) ); + read( ( tyear, tmon, tday ) ); + print( ( "ENTER NUMBER OF DAYS TO PLOT : " ) ); + read( ( nday ) ); + + INT jd0 = gregorian( tyear, 1, 1 ); + INT jd1 = gregorian( byear, bmon, bday ); + INT jd2 := gregorian( tyear, tmon, tday ); + INT dob = day of week( byear, bmon, bday ); + INT dow := day of week( tyear, tmon, tday ); + + double line; + print( ( "YOU WERE BORN ON A (", day name[ dob MOD 7 ], ") YOU WERE " ) ); + print( ( whole( jd2 - jd1, 0 ), " DAYS OLD ON THE START DATE.", newline ) ); + print( ( "-1", 31 * " ", "0", 30 * " ", "+1 DOY", newline ) ); + TO nday DO + INT dif = jd2 - jd1; + INT phy = in range( 3.3e1+3.2e1*sin( pi2 * dif / 2.3e1 ), 1, 65 ); + INT emd = in range( 3.3e1+3.2e1*sin( pi2 * dif / 2.8e1 ), 1, 65 ); + INT men = in range( 3.3e1+3.2e1*sin( pi2 * dif / 3.3e1 ), 1, 65 ); + STRING g row := 65 * IF day name[ dow ] = "SUN" THEN "." ELSE " " FI; + g row[ 1 ] := "|"; + g row[ 17 ] := ":"; + g row[ 33 ] := "|"; + g row[ 49 ] := ":"; + g row[ 65 ] := "|"; + g row[ phy ] := "P"; + g row[ emd ] := "E"; + g row[ men ] := "M"; + IF phy = emd OR phy = men THEN g row[ phy ] := "*" FI; + IF emd = men THEN g row[ emd ] := "*" FI; + print( ( " ", g row, " ", day name[ dow ], " ", whole( jd2 - jd0 + 1, -3 ), newline ) ); + jd2 +:= 1; + dow +:= 1 MODAB 7 + OD; + double line + END +END diff --git a/Task/Biorhythms/Ada/biorhythms.adb b/Task/Biorhythms/Ada/biorhythms.adb new file mode 100644 index 0000000000..8f1fb796b8 --- /dev/null +++ b/Task/Biorhythms/Ada/biorhythms.adb @@ -0,0 +1,65 @@ +with Ada.Calendar; +with Ada.Calendar.Arithmetic; +with Ada.Calendar.Formatting; +with Ada.Command_Line; +with Ada.Numerics; +with Ada.Numerics.Elementary_Functions; +with Ada.Text_IO; + +use Ada.Calendar; +use Ada.Calendar.Arithmetic; +use Ada.Calendar.Formatting; +use Ada.Command_Line; +use Ada.Numerics; +use Ada.Numerics.Elementary_Functions; +use Ada.Text_IO; + +procedure Biorhythms is + Birth_Date : Time := Value (Argument (1) & " 00:00:00"); + Target_Date : Time := Value (Argument (2) & " 00:00:00"); + Days : Day_Count := Target_Date - Birth_Date; + + -- There's not much point having types for these for such a short + -- problem, but in a big program this would be useful to prevent + -- accidentally assigning wrong values. + type Physical_Type is mod 23; + type Emotional_Type is mod 28; + type Mental_Type is mod 33; + type Biorhythm_Type is + record + Physical : Physical_Type; + Emotional : Emotional_Type; + Mental : Mental_Type; + end record; + + function To_Biorhythm (D : Day_Count) return Biorhythm_Type is + ( + Physical_Type (D mod Physical_Type'Modulus), + Emotional_Type (D mod Emotional_Type'Modulus), + Mental_Type (D mod Mental_Type'Modulus) + ); + + Biorhythm : Biorhythm_Type := To_Biorhythm (Days); + + package Float_IO is new Ada.Text_IO.Float_IO (Float); + use Float_IO; + + function To_Percent (F : Float) return Float is + (100.0 * Sin (2.0 * Pi * F)); + + procedure Report_Biorhythm (B : Biorhythm_Type) is + PFrac : Float := Float (B.Physical) / Float (Physical_Type'Modulus); + EFrac : Float := Float (B.Emotional) / Float (Emotional_Type'Modulus); + MFrac : Float := Float (B.Mental) / Float (Mental_Type'Modulus); + Physical : Float := To_Percent (PFrac); + Emotional : Float := To_Percent (EFrac); + Mental : Float := To_Percent (MFrac); + begin + Put_Line ("Age in days: " & Days'Image); + Put ("Physical cycle: "); Put (Physical, 3, 1, 0); Put ("%"); New_Line; + Put ("Emotional cycle: "); Put (Emotional, 3, 1, 0); Put ("%"); New_Line; + Put ("Mental cycle: "); Put (Mental, 3, 1, 0); Put ("%"); New_Line; + end Report_Biorhythm; +begin + Report_Biorhythm (Biorhythm); +end Biorhythms; diff --git a/Task/Biorhythms/C/biorhythms-2.c b/Task/Biorhythms/C/biorhythms-2.c index 3e2d9d0f69..ddd8256686 100644 --- a/Task/Biorhythms/C/biorhythms-2.c +++ b/Task/Biorhythms/C/biorhythms-2.c @@ -3,3 +3,4 @@ gcc -o cbio cbio.c -lm Age: 10717 days Physical cycle: -27% Emotional cycle: -100% +Intellectual cycle: -100% diff --git a/Task/Biorhythms/COBOL/biorhythms-1.cobol b/Task/Biorhythms/COBOL/biorhythms-1.cob similarity index 100% rename from Task/Biorhythms/COBOL/biorhythms-1.cobol rename to Task/Biorhythms/COBOL/biorhythms-1.cob diff --git a/Task/Biorhythms/COBOL/biorhythms-2.cobol b/Task/Biorhythms/COBOL/biorhythms-2.cob similarity index 100% rename from Task/Biorhythms/COBOL/biorhythms-2.cobol rename to Task/Biorhythms/COBOL/biorhythms-2.cob diff --git a/Task/Biorhythms/Crystal/biorhythms.cr b/Task/Biorhythms/Crystal/biorhythms.cr new file mode 100644 index 0000000000..b6c9cdba70 --- /dev/null +++ b/Task/Biorhythms/Crystal/biorhythms.cr @@ -0,0 +1,48 @@ +module BioRhythms + enum Cycle + Physical = 23 + Emotional = 28 + Mental = 33 + end + + Quadrants = [ {"up and raising", "peak"}, + {"up but falling", "transition"}, + {"down and falling", "valley"}, + {"down but raising", "transition"} ] + + def self.report (birthday, date = Time.utc) + # regularize to avoid fractional days difference + birthday, date = birthday.to_utc, date.to_utc + birthday -= birthday.time_of_day + date -= date.time_of_day + + days = (date - birthday).days + + puts "Born #{birthday.to_s("%F")}, Target #{date.to_s("%F")}" + puts "Day #{days}:" + Cycle.each do |kind, length| + position = days % length + quadrant = (position / length * 4).to_i + percentage = (Math.sin(position / length * 2 * Math::PI)*1000).to_i / 10 + description = if percentage > 95 + "peak" + elsif percentage < -95 + "valley" + elsif percentage.abs < 5 + "critical transition" + else + transition = date + ((quadrant + 1)/4 * length).to_i.days - position.days + trend, the_next = Quadrants[quadrant] + "#{percentage}% (#{trend}, next #{the_next} #{transition.to_s("%F")})" + end + puts "%-13s %2d: %s" % {kind.to_s + " day", position, description} + end + end +end + +[{"1943-03-09", "1972-07-11"}, + {"1809-01-12", "1863-11-19"}, + {"1809-02-12", "1863-11-19"}].each do |bd, target| + BioRhythms.report Time.parse_utc(bd, "%F"), Time.parse_utc(target, "%F") + puts +end diff --git a/Task/Biorhythms/Delphi/biorhythms.delphi b/Task/Biorhythms/Delphi/biorhythms.pas similarity index 100% rename from Task/Biorhythms/Delphi/biorhythms.delphi rename to Task/Biorhythms/Delphi/biorhythms.pas diff --git a/Task/Biorhythms/EasyLang/biorhythms.easy b/Task/Biorhythms/EasyLang/biorhythms.easy new file mode 100644 index 0000000000..8307ee3761 --- /dev/null +++ b/Task/Biorhythms/EasyLang/biorhythms.easy @@ -0,0 +1,40 @@ +birth$ = "1943-03-09" +date$ = "1972-07-11" +# date$ = substr timestr systime 1 10 +# +func day d$ . + y = number substr d$ 1 4 + m = number substr d$ 6 2 + d = number substr d$ 9 2 + return 367 * y - 7 * (y + (m + 9) div 12) div 4 + 275 * m div 9 + d - 730530 +. +gtextsize 4 +func init b$ d$ . + glinewidth 0.2 + gline 50 0 50 100 + gline 0 50 100 50 + for d = -20 to 20 + gcircle x 50 0.5 + x += 2.5 + . + gtext 4 94 b$ + gtext 4 88 d$ + days = day date$ - day birth$ + gtext 4 80 days & " days" + return days +. +proc cycle now cyc t$ col . + gcolor col + gtext 4 cyc * 1.2 - 20 t$ + glinewidth 0.5 + gpenup + for d = now - 20 step 0.2 to now + 20 + y = 50 + 20 * sin (360 * d / cyc) + glineto x y + x += 0.5 + . +. +days = init birth$ date$ +cycle days 23 "Physical" 900 +cycle days 28 "Emotional" 090 +cycle days 33 "Intellectual" 009 diff --git a/Task/Biorhythms/Emacs-Lisp/biorhythms.l b/Task/Biorhythms/Emacs-Lisp/biorhythms.el similarity index 100% rename from Task/Biorhythms/Emacs-Lisp/biorhythms.l rename to Task/Biorhythms/Emacs-Lisp/biorhythms.el diff --git a/Task/Biorhythms/FutureBasic/biorhythms.basic b/Task/Biorhythms/FutureBasic/biorhythms.basic new file mode 100644 index 0000000000..3c1d0ead45 --- /dev/null +++ b/Task/Biorhythms/FutureBasic/biorhythms.basic @@ -0,0 +1,112 @@ +/* +Biorhythms task for Rosetta Code +https://rosettacode.org/wiki/Biorhythms + +Translated from FreeBASIC to FutureBasic +Rich Love May 24, 2024 + +Oct 16, 2024 fixed the percentage amounts + +*/ + + + +local fn Gregorian(db As str255) As short + short M, Y, D + Y = val(Left$(db,4)) : M = Val(Mid$(db,6,2)) : D = Val(Right$(db,2)) + short N = (M+9) - Int((M+9)/12) * 12 + short W = Y - Int(N/10) + short G = 365 * W + Int(W/4) - Int(W/100) + Int(W/400) + G += Int((N*306+5)/10)+(D-1) +end fn = G + + +void local fn Biorhythm(Birthdate As str255, Targetdate As str255) + + str255 TextArray(4,2) + TextArray(0,0) = "up and rising" + TextArray(1,0) = "up but falling" + TextArray(2,0) = "down and falling" + TextArray(3,0) = "down but rising" + TextArray(0,1) = "peak" + TextArray(1,1) = "transition" + TextArray(2,1) = "valley" + TextArray(3,1) = "transition" + + + short DaysBetween = fn Gregorian(Targetdate) - fn Gregorian(Birthdate) + 1 + short positionP = DaysBetween Mod 23 + short positionE = DaysBetween Mod 28 + short positionM = DaysBetween Mod 33 + short quadrantP = Int(4 * positionP / 23) + short quadrantE = Int(4 * positionE / 28) + short quadrantM = Int(4 * positionM / 33) + short percentageP = int(100 * Sin(2 * (pi * positionP) / 23)) + short percentageE = int(100 * Sin(2 * (pi * positionE) / 28)) + short percentageM = int(100 * Sin(2 * (pi * positionM) / 33)) + + str255 textP, textE, textM, Header1Text, Header2Text + + + Select Case percentageP + Case > 95 + textP = "Physical day " + str$(positionP) + " : " + "peak" + Case < -95 + textP = "Physical day " + str$(positionP) + " : " + "valley" + Case -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 + textP = "Physical day " + str$(positionP) + " : " + "critical transition" + Case Else + textP = "Physical day " + str$(positionP) + " : " + str$(percentageP) + "% (" + TextArray(quadrantP,0) + ")" + End Select + + Select Case percentageE + Case > 95 + textE = "Emotional day " + STR$(positionE) + " : " + "peak" + Case < -95 + textE = "Emotional day " + STR$(positionE) + " : " + "valley" + Case -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 + textE = "Emotional day " + STR$(positionE) + " : " + "critical transition" + Case Else + textE = "Emotional day " + STR$(positionE) + " : " + str$(percentageE) + "% (" + TextArray(quadrantE,0) + ")" + End Select + + Select Case percentageM + Case > 95 + textM = "Mental day " + str$(positionM)+ " : " + "peak" + Case < - 95 + textM = "Mental day " + str$(positionM) + " : " + "valley" + Case -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 + textM = "Mental day " + str$(positionM) + " : " + "critical transition" + Case Else + textM = "Mental day " + str$(positionM) + " : " + str$(percentageM) + "% (" + TextArray(quadrantM,0) + ")" + End Select + + Header1Text = "Born " + Birthdate + ", Target " + Targetdate + Header2Text = "Day " + str$(DaysBetween) + + Print Header1Text + Print Header2Text + Print textP + Print textE + Print textM + Print +end fn + +window 1, @"Biorhythms" +windowcenter(1) +WindowSetBackgroundColor(1,fn ColorBlack) + +print + +// Lets do four different birthdates and target dates +text ,,fn colorCyan +fn Biorhythm("1943-03-09", "1972-07-11") +text ,,fn colorGreen +fn Biorhythm("1809-02-12", "1863-11-19") // DOB for Abraham Lincoln +text ,,fn colorYellow +fn Biorhythm("1809-01-12", "1863-11-19") +text ,,fn colorWhite +fn Biorhythm("1943-03-09", "1972-07-11") // Bobby Fisher Chess Tournament + + +handleevents diff --git a/Task/Biorhythms/Julia/biorhythms.julia b/Task/Biorhythms/Julia/biorhythms.jl similarity index 100% rename from Task/Biorhythms/Julia/biorhythms.julia rename to Task/Biorhythms/Julia/biorhythms.jl diff --git a/Task/Biorhythms/Kotlin/biorhythms.kts b/Task/Biorhythms/Kotlin/biorhythms.kts new file mode 100644 index 0000000000..8cc7529557 --- /dev/null +++ b/Task/Biorhythms/Kotlin/biorhythms.kts @@ -0,0 +1,64 @@ +import java.time.LocalDate +import java.time.format.DateTimeFormatter +import java.time.temporal.ChronoUnit +import kotlin.math.roundToInt +import kotlin.math.sin + +fun main() { + val datePairs = listOf( + listOf("1943-03-09", "1972-07-11"), + listOf("1809-01-12", "1863-11-19"), + listOf("1809-02-12", "1863-11-19") + ) + + for (datePair in datePairs) { + calculateBiorhythms(datePair) + } +} + +fun calculateBiorhythms(datePair: List) { + val formatter = DateTimeFormatter.ISO_LOCAL_DATE + val birthDate = LocalDate.parse(datePair[0], formatter) + val targetDate = LocalDate.parse(datePair[1], formatter) + val daysBetween = ChronoUnit.DAYS.between(birthDate, targetDate).toInt() + println("Birth date $birthDate, Target date $targetDate") + println("Days between: $daysBetween") + + for (cycle in Cycle.values()) { + val cycleLength = cycle.getLength() + val positionInCycle = daysBetween % cycleLength + val quadrantIndex = 4 * positionInCycle / cycleLength + val percentage = (100 * sin(2 * Math.PI * positionInCycle / cycleLength)).roundToInt() + + val description = when { + percentage > 95 -> "peak" + percentage < -95 -> "valley" + Math.abs(percentage) < 5 -> "critical transition" + else -> { + val daysToTransition = (cycleLength * (quadrantIndex + 1) / 4) - positionInCycle + val transitionDate = targetDate.plusDays(daysToTransition.toLong()) + val (trend, nextTransition) = cycle.descriptions(quadrantIndex) + "$percentage% ($trend, next $nextTransition $transitionDate)" + } + } + + println("${cycle.name} day $positionInCycle: $description") + } + println() +} + +enum class Cycle(private val length: Int) { + PHYSICAL(23), EMOTIONAL(28), MENTAL(33); + + fun getLength() = length + + fun descriptions(index: Int): Pair { + val descriptions = listOf( + listOf("up and rising", "peak"), + listOf("up but falling", "transition"), + listOf("down and falling", "valley"), + listOf("down but rising", "transition") + ) + return descriptions[index][0] to descriptions[index][1] + } +} diff --git a/Task/Biorhythms/M2000-Interpreter/biorhythms.m2000 b/Task/Biorhythms/M2000-Interpreter/biorhythms.m2000 index 04f46aedc7..732e4e600f 100644 --- a/Task/Biorhythms/M2000-Interpreter/biorhythms.m2000 +++ b/Task/Biorhythms/M2000-Interpreter/biorhythms.m2000 @@ -1,24 +1,21 @@ -Module Biorhythms { - form 80 - enum bio {Physical=23, Emotional=28,Mental=33} - quadrants=(("up and rising", "peak"), ("up but falling", "transition"), ("down and falling", "valley"), ("down but rising", "transition")) - date birth="1943-03-09" - date bioDay="1972-07-11", transition - for k=1 to 1 +Module Biorhythms (birth, bioDay, N as long = 1) { + date birth, bioDay, transition + enum bio {Physical=23, Emotional=28, Mental=33} + dim quadrants(4) + quadrants(0):=("up and rising", "peak"), ("up but falling", "transition"), ("down and falling", "valley"), ("down but rising", "transition") + if N<1 then N=1 + for k=1 to N long Days=bioDay-birth - Print "Day "+Days+":" - + Print "Day "+bioDay+" | Age in days: "+Days string frm="{0:-20} : {1}", pword, dfmt="YYYY-MM-DD" - long position, percentage, length, targetday + long position, percentage, length k=each(bio) while k - length=eval(k) - + length=eval(k) position=days mod length quadrant=int(4*position/length) - targetday=bioDay // get the long value of day from date type percentage=100*sin(360*position/length) - transition=bioDay+floor((quadrant+1)/4*23)-position + transition=bioDay+floor((quadrant+1)/4*length)-position select case percentage case >95 pword="peak" @@ -27,14 +24,15 @@ Module Biorhythms { case -5 to 5 pword="critical " case else - { - pword=percentage+"% ("+quadrants#val(quadrant)#val$(0)+", next " - pword+=quadrants#val(quadrant)#val$(1)+" "+str$(transition,dfmt)+")" - } + { + pword=percentage+"% ("+quadrants(quadrant)#val$(0)+", next " + pword+=quadrants(quadrant)#val$(1)+" "+str$(transition, dfmt)+")" + } end select print format$(frm, eval$(k)+" day "+(days mod length), pword) End while bioDay++ next k } -Biorhythms +form 80 +Biorhythms "1943-03-09", "1972-07-11" diff --git a/Task/Biorhythms/Phix/biorhythms.phix b/Task/Biorhythms/Phix/biorhythms.phix index e88bb994b4..d4c003fc47 100644 --- a/Task/Biorhythms/Phix/biorhythms.phix +++ b/Task/Biorhythms/Phix/biorhythms.phix @@ -1,44 +1,42 @@ -(phixonline)--> - with javascript_semantics - include timedate.e +with javascript_semantics +include timedate.e - constant cycles = {"Physical day ", "Emotional day", "Mental day "}, - lengths = {23, 28, 33}, - quadrants = {{"up and rising", "peak"}, - {"up but falling", "transition"}, - {"down and falling", "valley"}, - {"down but rising", "transition"}} +constant cycles = {"Physical day ", "Emotional day", "Mental day "}, + lengths = {23, 28, 33}, + quadrants = {{"up and rising", "peak"}, + {"up but falling", "transition"}, + {"down and falling", "valley"}, + {"down but rising", "transition"}} - procedure biorhythms(string birthDate, targetDate) - timedate bd = parse_date_string(birthDate,{"YYYY-MM-DD"}), - td = parse_date_string(targetDate,{"YYYY-MM-DD"}) - integer days = floor(timedate_diff(bd, td, DT_DAY)/(60*60*24)) - printf(1,"Born %s, Target %s\n",{birthDate,targetDate}) - printf(1,"Day %d\n",days) - for i=1 to 3 do - integer len = lengths[i], - posn = remainder(days,len), - quadrant = floor(posn/len*4)+1 - atom percent = floor(sin(2*PI*posn/len)*1000)/10 - string cycle = cycles[i], - desc = iff(percent>95 ? " peak" : - iff(percent<-95 ? " valley" : - iff(abs(percent)<5 ? " critical transition" : "other"))) - if desc == "other" then - timedate t = adjust_timedate(td,timedelta(days:=floor(quadrant/4*len)-posn)) - string transition = format_timedate(t,"YYYY-MM-DD"), - {trend,next} = quadrants[quadrant] - desc = sprintf("%5.1f%% (%s, next %s %s)", {percent, trend, next, transition}) - end if - printf(1,"%s %2d : %s\n", {cycle, posn, desc}) - end for - printf(1,"\n") - end procedure +procedure biorhythms(string birthDate, targetDate) + timedate bd = parse_date_string(birthDate,{"YYYY-MM-DD"}), + td = parse_date_string(targetDate,{"YYYY-MM-DD"}) + integer days = floor(timedate_diff(bd, td, DT_DAY)/(60*60*24)) + printf(1,"Born %s, Target %s\n",{birthDate,targetDate}) + printf(1,"Day %d\n",days) + for i=1 to 3 do + integer len = lengths[i], + posn = remainder(days,len), + quadrant = floor(posn/len*4)+1 + atom percent = floor(sin(2*PI*posn/len)*1000)/10 + string cycle = cycles[i], + desc = iff(percent>95 ? " peak" : + iff(percent<-95 ? " valley" : + iff(abs(percent)<5 ? " critical transition" : "other"))) + if desc == "other" then + timedate t = adjust_timedate(td,timedelta(days:=floor(quadrant/4*len)-posn)) + string transition = format_timedate(t,"YYYY-MM-DD"), + {trend,next} = quadrants[quadrant] + desc = sprintf("%5.1f%% (%s, next %s %s)", {percent, trend, next, transition}) + end if + printf(1,"%s %2d : %s\n", {cycle, posn, desc}) + end for + printf(1,"\n") +end procedure - constant datePairs = { - {"1943-03-09", "1972-07-11"}, - {"1809-01-12", "1863-11-19"}, - {"1809-02-12", "1863-11-19"} // correct DOB for Abraham Lincoln - } - for i=1 to length(datePairs) do biorhythms(datePairs[i][1], datePairs[i][2]) end for - Data (byte bucket) out:=Data().fill(0,25); @@ -9,7 +9,7 @@ fcn unbase58(str){ // --> Data (byte bucket) [24..0,-1].reduce('wrap(c,idx){ c+=58*out[idx]; // throws if not enough data out[idx]=c; - c/256; // should be zero when done + c/256; // should be zero when done },n) : if(_) throw(Exception.ValueError("address too long")); }); out; diff --git a/Task/Bitcoin-public-point-to-address/C++/bitcoin-public-point-to-address.cpp b/Task/Bitcoin-public-point-to-address/C++/bitcoin-public-point-to-address.cpp new file mode 100644 index 0000000000..3a5ee44ffc --- /dev/null +++ b/Task/Bitcoin-public-point-to-address/C++/bitcoin-public-point-to-address.cpp @@ -0,0 +1,103 @@ +#include +#include +#include +#include +#include + +#include "SHA256.cpp" +#include "RIPEMD160.cpp" +SHA256 sha256{ }; +RIPEMD160 ripemd160{ }; + +const std::string BITCOIN_SPECIAL_VALUE = "04"; +const std::string BITCOIN_VERSION_NUMBER = "00"; + +std::map base_map = + { { '0', 0 }, { '1', 1 }, { '2', 2 }, { '3', 3 }, { '4', 4 }, { '5', 5 }, { '6', 6 }, { '7', 7 }, + { '8', 8 }, { '9', 9 }, { 'a', 10 }, { 'b', 11 }, { 'c', 12 }, { 'd', 13 }, { 'e', 14 }, { 'f', 15 }, + { 'A', 10 }, { 'B', 11 }, { 'C', 12 }, { 'D', 13 }, { 'E', 14 }, { 'F', 15 } }; + +std::vector hex_to_bytes(const std::string& text) { + std::vector bytes(text.size() / 2, 0); + for ( uint64_t i = 0; i < text.size(); i += 2 ) { + const uint32_t first_digit = base_map[text[i]]; + const uint32_t second_digit = base_map[text[i + 1]]; + bytes[i / 2] = ( first_digit << 4 ) + second_digit; + } + return bytes; +} + +std::string vector_to_ascii_string(const std::vector& bytes) { + std::string result = ""; + for ( uint64_t i = 0; i < bytes.size(); ++i ) { + result += static_cast(bytes[i]); + } + return result; +} + +std::vector compute_message_bytes(const std::string& text) { + // Convert the hexadecimal string 'text' into a suitable ASCII string for the SHA256 hash + std::vector bytes_1 = hex_to_bytes(text); + std::string ascii_1 = vector_to_ascii_string(bytes_1); + std::string hexSHA256 = sha256.message_digest(ascii_1); + // Convert the hexadecimal string 'hexSHA256' into a suitable ASCII string for the RIPEMD160 hash + std::vector bytes_2 = hex_to_bytes(hexSHA256); + std::string ascii_2 = vector_to_ascii_string(bytes_2); + std::string hexRIPEMD160 = BITCOIN_VERSION_NUMBER + ripemd160.message_digest(ascii_2); + return hex_to_bytes(hexRIPEMD160); +} + +std::vector compute_checksum(const std::vector& bytes) { + // Convert the given byte array into a suitable ASCII string for the first SHA256 hash + std::string ascii_1 = vector_to_ascii_string(bytes); + std::string hex_1 = sha256.message_digest(ascii_1); + // Convert the hexadecimal string 'hex1' into a suitable ASCII string for the second SHA256 hash + std::vector bytes_1 = hex_to_bytes(hex_1); + std::string ascii_2 = vector_to_ascii_string(bytes_1); + std::string hex_2 = sha256.message_digest(ascii_2); + std::vector bytes_2 = hex_to_bytes(hex_2); + std::vector result(bytes_2.begin(), bytes_2.begin() + 4); + return result; +} + +// Return the given byte array encoded into a base58 starting with most one '1' +std::string encode_base_58(std::vector bytes) { + const std::string ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + const uint32_t ALPHABET_SIZE = ALPHABET.size(); + + std::string result(34, ' '); + for ( int64_t n = result.size() - 1; n >= 0; --n ) { + uint32_t c = 0; + for ( uint64_t i = 0; i < bytes.size(); ++i ) { + c = c * 256 + bytes[i]; + bytes[i] = c / ALPHABET_SIZE; + c %= ALPHABET_SIZE; + } + result[n] = ALPHABET[c]; + } + + while ( result.starts_with("11") ) { + result = result.substr(1); + } + return result; +} + +// Return the encoded address of the given coordinates. +std::string encode_address(const std::string& x, const std::string& y) { + std::string public_point = BITCOIN_SPECIAL_VALUE + x + y; + if ( public_point.size() != 130 ) { + throw std::invalid_argument("Invalid public point string"); + } + + std::vector message_bytes = compute_message_bytes(public_point); + std::vector checksum = compute_checksum(message_bytes); + message_bytes.insert(message_bytes.end(), checksum.begin(), checksum.end()); + return encode_base_58(message_bytes); +} + +int main() { + std::string x = "50863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2352"; + std::string y = "2CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6"; + + std::cout << encode_address(x, y) << std::endl; +} diff --git a/Task/Bitcoin-public-point-to-address/Delphi/bitcoin-public-point-to-address.delphi b/Task/Bitcoin-public-point-to-address/Delphi/bitcoin-public-point-to-address.pas similarity index 100% rename from Task/Bitcoin-public-point-to-address/Delphi/bitcoin-public-point-to-address.delphi rename to Task/Bitcoin-public-point-to-address/Delphi/bitcoin-public-point-to-address.pas diff --git a/Task/Bitcoin-public-point-to-address/FreeBASIC/bitcoin-public-point-to-address.basic b/Task/Bitcoin-public-point-to-address/FreeBASIC/bitcoin-public-point-to-address.basic new file mode 100644 index 0000000000..902427a908 --- /dev/null +++ b/Task/Bitcoin-public-point-to-address/FreeBASIC/bitcoin-public-point-to-address.basic @@ -0,0 +1,142 @@ +#include "SHA_256.bas" +#include "RIPEMD_160.bas" + +Const BITCOIN_SPECIAL_VALUE As String = "04" +Const BITCOIN_VERSION_NUMBER As String = "00" + +Dim Shared base_map(255) As Integer + +Sub init_base_map() + Dim As Integer i + For i = 0 To 255 + base_map(i) = -1 + Next + For i = 0 To 9 + base_map(Asc("0") + i) = i + Next + For i = 0 To 5 + base_map(Asc("a") + i) = 10 + i + base_map(Asc("A") + i) = 10 + i + Next + For i = 6 To 15 + base_map(Asc("a") + i) = 10 + i + base_map(Asc("A") + i) = 10 + i + Next +End Sub + +Sub hex_to_bytes(text As String, bytes() As Integer) + Dim As Integer first_digit, second_digit + Dim As Integer n = Len(text) \ 2 + Redim bytes(n - 1) + + For i As Integer = 0 To n - 1 + first_digit = base_map(Asc(Mid(text, 2 * i + 1, 1))) + second_digit = base_map(Asc(Mid(text, 2 * i + 2, 1))) + bytes(i) = (first_digit Shl 4) + second_digit + Next +End Sub + +Function vector_to_ascii_string(bytes() As Integer) As String + Dim As String result = "" + + For i As Integer = 0 To Ubound(bytes) + result &= Chr(bytes(i)) + Next + + Return result +End Function + +Sub compute_message_bytes(text As String, out_bytes() As Integer) + Dim As Integer bytes_1() + hex_to_bytes(text, bytes_1()) + + Dim As String ascii_1 = vector_to_ascii_string(bytes_1()) + Dim As String hexSHA_256 = SHA_256(ascii_1) + Dim As Integer bytes_2() + hex_to_bytes(hexSHA_256, bytes_2()) + + Dim As String ascii_2 = vector_to_ascii_string(bytes_2()) + Dim As String hexRIPEMD_160 = BITCOIN_VERSION_NUMBER & RIPEMD_160(ascii_2) + hex_to_bytes(hexRIPEMD_160, out_bytes()) +End Sub + +Sub compute_checksum(bytes() As Integer, out_checksum() As Integer) + Dim As String ascii_1 = vector_to_ascii_string(bytes()) + Dim As String hex_1 = SHA_256(ascii_1) + Dim As Integer bytes_1() + hex_to_bytes(hex_1, bytes_1()) + + Dim As String ascii_2 = vector_to_ascii_string(bytes_1()) + Dim As String hex_2 = SHA_256(ascii_2) + Dim As Integer bytes_2() + hex_to_bytes(hex_2, bytes_2()) + Redim out_checksum(3) + + For i As Integer = 0 To 3 + out_checksum(i) = bytes_2(i) + Next +End Sub + +Function encode_base_58(bytes() As Integer) As String + Const As String ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" + Const As Integer ALPHABET_SIZE = 58 + Dim As String result = String(34, " ") + Dim As Integer i, j, n, c + Dim As Integer temp() + + Redim As Integer bytes_copy(Ubound(bytes)) + For i = 0 To Ubound(bytes) + bytes_copy(i) = bytes(i) + Next + + For n = Len(result) - 1 To 0 Step -1 + c = 0 + For i = 0 To Ubound(bytes_copy) + c = c * 256 + bytes_copy(i) + bytes_copy(i) = c \ ALPHABET_SIZE + c Mod= ALPHABET_SIZE + Next + Mid(result, n + 1, 1) = Mid(ALPHABET, c + 1, 1) + Next + + ' Quitar los '1' iniciales extra + While Left(result, 2) = "11" + result = Mid(result, 2) + Wend + Return result +End Function + +Function encode_address(x As String, y As String) As String + Dim As String public_point = BITCOIN_SPECIAL_VALUE & x & y + If Len(public_point) <> 130 Then + Print "Invalid public point string" + Exit Function + End If + Dim As Integer message_bytes() + compute_message_bytes(public_point, message_bytes()) + + Dim As Integer checksum() + compute_checksum(message_bytes(), checksum()) + + Dim As Integer i + Dim As Integer full_bytes() + Redim full_bytes(Ubound(message_bytes) + 4) + For i = 0 To Ubound(message_bytes) + full_bytes(i) = message_bytes(i) + Next + For i = 0 To 3 + full_bytes(Ubound(message_bytes) + 1 + i) = checksum(i) + Next + + Return encode_base_58(full_bytes()) +End Function + +' Test Program +init_base_map() + +Dim As String x = "50863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2352" +Dim As String y = "2CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6" + +Print encode_address(x, y) + +Sleep diff --git a/Task/Bitcoin-public-point-to-address/Java/bitcoin-public-point-to-address.java b/Task/Bitcoin-public-point-to-address/Java/bitcoin-public-point-to-address.java new file mode 100644 index 0000000000..6f28ff3d99 --- /dev/null +++ b/Task/Bitcoin-public-point-to-address/Java/bitcoin-public-point-to-address.java @@ -0,0 +1,99 @@ +import java.math.BigInteger; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.stream.Collectors; + +public final class BitcoinPublicPointToAddess { + + public static void main(String[] args) { + String x = "50863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2352"; + String y = "2CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6"; + + if ( areValidCoordinates(x, y) ) { + System.out.println(encodeAddress(x, y)); + } else { + System.out.println("Invalid Bitcoin public point coordinates"); + } + } + + // Return the encoded address of the given coordinates. + private static String encodeAddress(String x, String y) { + String publicPoint = BITCOIN_SPECIAL_VALUE + x + y; + if ( publicPoint.length() != 130 ) { + throw new AssertionError("Invalid public point string: " + publicPoint); + } + + byte[] messageBytes = computeMessageBytes(publicPoint); + byte[] checksum = computeChecksum(messageBytes); + messageBytes = Arrays.copyOf(messageBytes, messageBytes.length + 4); + System.arraycopy(checksum, 0, messageBytes, 21, checksum.length); + return encodeBase58(messageBytes); + } + + // Return the given byte array encoded into a base58 starting with most one '1' + private static String encodeBase58(byte[] bytes) { + final String ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + final int ALPHABET_SIZE = ALPHABET.length(); + + String[] temp = new String[34]; + for ( int n = temp.length - 1; n >= 0; n-- ) { + int c = 0; + for ( int i = 0; i < bytes.length; i++ ) { + c = c * 256 + (int) ( bytes[i] & 0xFF ); + bytes[i] = (byte) ( c / ALPHABET_SIZE ); + c %= ALPHABET_SIZE; + } + temp[n] = ALPHABET.substring(c, c + 1); + } + + String result = Arrays.stream(temp).collect(Collectors.joining("")); + while ( result.startsWith("11") ) { + result = result.substring(1); + } + return result; + } + + // Return whether the given coordinates are those of a point on the secp256k1 elliptic curve + private static boolean areValidCoordinates(String x, String y) { + BigInteger modulus = new BigInteger("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", 16); + BigInteger X = new BigInteger(x, 16); + BigInteger Y = new BigInteger(y, 16); + return Y.multiply(Y).mod(modulus).equals(X.multiply(X).multiply(X).add(BigInteger.valueOf(7)).mod(modulus)); + } + + private static byte[] computeMessageBytes(String text) { + // Convert the hexadecimal string 'text' into a suitable ASCII string for the SHA256 hash + byte[] bytesOne = hexToBytes(text); + String asciiOne = new String(bytesOne, StandardCharsets.ISO_8859_1); + String hexSHA256 = SHA256.messageDigest(asciiOne); + // Convert the hexadecimal string 'hexSHA256' into a suitable ASCII string for the RIPEMD160 hash + byte[] bytesTwo = hexToBytes(hexSHA256); + String asciiTwo = new String(bytesTwo, StandardCharsets.ISO_8859_1); + String hexRIPEMD160 = BITCOIN_VERSION_NUMBER + RIPEMD160.messageDigest(asciiTwo); + return hexToBytes(hexRIPEMD160); + } + + private static byte[] computeChecksum(byte[] bytes) { + // Convert the given byte array into a suitable ASCII string for the first SHA256 hash + String asciiOne = new String(bytes, StandardCharsets.ISO_8859_1); + String hexOne = SHA256.messageDigest(asciiOne); + // Convert the hexadecimal string 'hex1' into a suitable ASCII string for the second SHA256 hash + byte[] bytesOne = hexToBytes(hexOne); + String asciiTwo = new String(bytesOne, StandardCharsets.ISO_8859_1); + String hexTwo = SHA256.messageDigest(asciiTwo); + return Arrays.copyOfRange(hexToBytes(hexTwo), 0, 4); + } + + private static byte[] hexToBytes(String text) { + byte[] bytes = new byte[text.length() / 2]; + for ( int i = 0; i < text.length(); i += 2 ) { + final int firstDigit = Character.digit(text.charAt(i), 16); + final int secondDigit = Character.digit(text.charAt(i + 1), 16); + bytes[i / 2] = (byte) ( ( firstDigit << 4 ) + secondDigit );; + } + return bytes; + } + + private static final String BITCOIN_SPECIAL_VALUE = "04"; + private static final String BITCOIN_VERSION_NUMBER = "00"; +} diff --git a/Task/Bitcoin-public-point-to-address/JavaScript/bitcoin-public-point-to-address.js b/Task/Bitcoin-public-point-to-address/JavaScript/bitcoin-public-point-to-address.js new file mode 100644 index 0000000000..1076901568 --- /dev/null +++ b/Task/Bitcoin-public-point-to-address/JavaScript/bitcoin-public-point-to-address.js @@ -0,0 +1,52 @@ +const crypto = require('crypto'); + +const digits58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; + +function b58(n) { + if (n === 0n) return ''; + return b58(n / 58n) + digits58[Number(n % 58n)]; +} + +function publicPointToAddress(x, y) { + // Convert hex strings to buffers + const xBuffer = Buffer.from(x, 'hex'); + const yBuffer = Buffer.from(y, 'hex'); + + // Create uncompressed public key format (0x04 + x + y) + const publicKey = Buffer.concat([Buffer.from([0x04]), xBuffer, yBuffer]); + + // SHA256 hash + const sha256Hash = crypto.createHash('sha256').update(publicKey).digest(); + + // RIPEMD160 hash + const ripemd160Hash = crypto.createHash('ripemd160').update(sha256Hash).digest(); + + // Add version byte (0x00 for mainnet) + const versionedHash = Buffer.concat([Buffer.from([0x00]), ripemd160Hash]); + + // Double SHA256 for checksum + const checksum = crypto.createHash('sha256') + .update(crypto.createHash('sha256').update(versionedHash).digest()) + .digest() + .slice(0, 4); + + // Combine versioned hash with checksum + const addressBytes = Buffer.concat([versionedHash, checksum]); + + // Convert to BigInt for base58 encoding + let n = 0n; + for (let i = 0; i < addressBytes.length; i++) { + n = (n << 8n) | BigInt(addressBytes[i]); + } + + return b58(n); +} + +// Test with the provided values +if (require.main === module) { + const address = publicPointToAddress( + '50863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2352', + '2CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6' + ); + console.log(address); +} diff --git a/Task/Bitcoin-public-point-to-address/Julia/bitcoin-public-point-to-address-1.julia b/Task/Bitcoin-public-point-to-address/Julia/bitcoin-public-point-to-address-1.jl similarity index 100% rename from Task/Bitcoin-public-point-to-address/Julia/bitcoin-public-point-to-address-1.julia rename to Task/Bitcoin-public-point-to-address/Julia/bitcoin-public-point-to-address-1.jl diff --git a/Task/Bitcoin-public-point-to-address/Julia/bitcoin-public-point-to-address-2.julia b/Task/Bitcoin-public-point-to-address/Julia/bitcoin-public-point-to-address-2.jl similarity index 100% rename from Task/Bitcoin-public-point-to-address/Julia/bitcoin-public-point-to-address-2.julia rename to Task/Bitcoin-public-point-to-address/Julia/bitcoin-public-point-to-address-2.jl diff --git a/Task/Bitcoin-public-point-to-address/Rust/bitcoin-public-point-to-address.rs b/Task/Bitcoin-public-point-to-address/Rust/bitcoin-public-point-to-address.rs new file mode 100644 index 0000000000..57c7e6ba02 --- /dev/null +++ b/Task/Bitcoin-public-point-to-address/Rust/bitcoin-public-point-to-address.rs @@ -0,0 +1,65 @@ +use ring::digest::{digest, SHA256}; +use ripemd::{Digest, Ripemd160}; + +use hex::FromHex; + +static X: &str = "50863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2352"; +static Y: &str = "2CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6"; +static ALPHABET: [char; 58] = [ + '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', + 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', + 'f', 'g', 'h', 'i', 'j', 'k', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', + 'z', +]; + +fn base58_encode(bytes: &mut [u8]) -> String { + let base = ALPHABET.len(); + if bytes.is_empty() { + return String::from(""); + } + let mut output: Vec = Vec::new(); + let mut num: usize; + for _ in 0..33 { + num = 0; + for byte in bytes.iter_mut() { + num = num * 256 + *byte as usize; + *byte = (num / base) as u8; + num %= base; + } + output.push(num as u8); + } + let mut string = String::new(); + for b in output.iter().rev() { + string.push(ALPHABET[*b as usize]); + } + string +} + +// stolen from address-validation/src/main.rs +/// Hashes the input with the SHA-256 algorithm twice, and returns the output. +fn double_sha256(bytes: &[u8]) -> Vec { + let digest_1 = digest(&SHA256, bytes); + + let digest_2 = digest(&SHA256, digest_1.as_ref()); + digest_2.as_ref().to_vec() +} + +fn point_to_address(x: &str, y: &str) -> String { + let mut addrv: Vec = Vec::with_capacity(65); + addrv.push(4u8); + addrv.append(&mut >::from_hex(x).unwrap()); + addrv.append(&mut >::from_hex(y).unwrap()); + // hash the addresses first using SHA256 + let sha_digest = digest(&SHA256, &addrv); + let mut ripemd_digest = Ripemd160::digest(&sha_digest.as_ref()).as_slice().to_vec(); + // prepend a 0 to the vector + ripemd_digest.insert(0, 0); + // calculate checksum of extended ripemd digest + let checksum = double_sha256(&ripemd_digest); + ripemd_digest.extend_from_slice(&checksum[..4]); + base58_encode(&mut ripemd_digest) +} + +fn main() { + println!("{}", point_to_address(X, Y)); +} diff --git a/Task/Bitcoin-public-point-to-address/Rust/bitcoin-public-point-to-address.rust b/Task/Bitcoin-public-point-to-address/Rust/bitcoin-public-point-to-address.rust deleted file mode 100644 index e9c6c90584..0000000000 --- a/Task/Bitcoin-public-point-to-address/Rust/bitcoin-public-point-to-address.rust +++ /dev/null @@ -1,65 +0,0 @@ -use ring::digest::{digest, SHA256}; -use ripemd160::{Digest, Ripemd160}; - -use hex::FromHex; - -static X: &str = "50863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2352"; -static Y: &str = "2CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6"; -static ALPHABET: [char; 58] = [ - '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', - 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', - 'f', 'g', 'h', 'i', 'j', 'k', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', - 'z', -]; - -fn base58_encode(bytes: &mut [u8]) -> String { - let base = ALPHABET.len(); - if bytes.is_empty() { - return String::from(""); - } - let mut output: Vec = Vec::new(); - let mut num: usize; - for _ in 0..33 { - num = 0; - for byte in bytes.iter_mut() { - num = num * 256 + *byte as usize; - *byte = (num / base) as u8; - num %= base; - } - output.push(num as u8); - } - let mut string = String::new(); - for b in output.iter().rev() { - string.push(ALPHABET[*b as usize]); - } - string -} - -// stolen from address-validation/src/main.rs -/// Hashes the input with the SHA-256 algorithm twice, and returns the output. -fn double_sha256(bytes: &[u8]) -> Vec { - let digest_1 = digest(&SHA256, bytes); - - let digest_2 = digest(&SHA256, digest_1.as_ref()); - digest_2.as_ref().to_vec() -} - -fn point_to_address(x: &str, y: &str) -> String { - let mut addrv: Vec = Vec::with_capacity(65); - addrv.push(4u8); - addrv.append(&mut >::from_hex(x).unwrap()); - addrv.append(&mut >::from_hex(y).unwrap()); - // hash the addresses first using SHA256 - let sha_digest = digest(&SHA256, &addrv); - let mut ripemd_digest = Ripemd160::digest(&sha_digest.as_ref()).as_slice().to_vec(); - // prepend a 0 to the vector - ripemd_digest.insert(0, 0); - // calculate checksum of extended ripemd digest - let checksum = double_sha256(&ripemd_digest); - ripemd_digest.extend_from_slice(&checksum[..4]); - base58_encode(&mut ripemd_digest) -} - -fn main() { - println!("{}", point_to_address(X, Y)); -} diff --git a/Task/Bitcoin-public-point-to-address/Wren/bitcoin-public-point-to-address.wren b/Task/Bitcoin-public-point-to-address/Wren/bitcoin-public-point-to-address.wren index 4f9c3fe5a4..96413686ea 100644 --- a/Task/Bitcoin-public-point-to-address/Wren/bitcoin-public-point-to-address.wren +++ b/Task/Bitcoin-public-point-to-address/Wren/bitcoin-public-point-to-address.wren @@ -1,6 +1,6 @@ -import "/crypto" for Sha256, Ripemd160 -import "/str" for Str -import "/fmt" for Conv +import "./crypto" for Sha256, Ripemd160 +import "./str" for Str +import "./fmt" for Conv // converts an hexadecimal string to a byte list. var HexToBytes = Fn.new { |s| Str.chunks(s, 2).map { |c| Conv.atoi(c, 16) }.toList } diff --git a/Task/Bitmap-B-zier-curves-Cubic/11l/bitmap-b-zier-curves-cubic.11l b/Task/Bitmap-B-zier-curves-Cubic/11l/bitmap-b-zier-curves-cubic.11l index 7d538ce4eb..4d73742931 100644 --- a/Task/Bitmap-B-zier-curves-Cubic/11l/bitmap-b-zier-curves-cubic.11l +++ b/Task/Bitmap-B-zier-curves-Cubic/11l/bitmap-b-zier-curves-cubic.11l @@ -1,13 +1,4 @@ -T Colour - Byte r, g, b - - F ==(other) - R .r == other.r & .g == other.g & .b == other.b - - F (r, g, b) - .r = r - .g = g - .b = b +T Colour = BVec3 V black = Colour(0, 0, 0) V white = Colour(255, 255, 255) diff --git a/Task/Bitmap-B-zier-curves-Cubic/ALGOL-68/bitmap-b-zier-curves-cubic-2.alg b/Task/Bitmap-B-zier-curves-Cubic/ALGOL-68/bitmap-b-zier-curves-cubic-2.alg index e19cad1f9b..64efe22d15 100644 --- a/Task/Bitmap-B-zier-curves-Cubic/ALGOL-68/bitmap-b-zier-curves-cubic-2.alg +++ b/Task/Bitmap-B-zier-curves-Cubic/ALGOL-68/bitmap-b-zier-curves-cubic-2.alg @@ -1,12 +1,12 @@ #!/usr/bin/a68g --script # # -*- coding: utf-8 -*- # -PR READ "prelude/Bitmap.a68" PR; # c.f. [[rc:Bitmap]] # -PR READ "prelude/Bitmap/Bresenhams_line_algorithm.a68" PR; # c.f. [[rc:Bitmap/Bresenhams_line_algorithm]] # +PR READ "prelude/Bitmap.a68" PR; +PR READ "prelude/Bitmap/Bresenhams_line_algorithm.a68" PR; PR READ "prelude/Bitmap/Bezier_curves/Cubic.a68" PR; -# The following test # -test:( +### test program ### +( REF IMAGE x = INIT LOC[16,16]PIXEL; (fill OF class image)(x, (white OF class image)); (cubic bezier OF class image)(x, (16, 1), (1, 4), (3, 16), (15, 11), (black OF class image), EMPTY); diff --git a/Task/Bitmap-B-zier-curves-Cubic/Ada/bitmap-b-zier-curves-cubic-1.ada b/Task/Bitmap-B-zier-curves-Cubic/Ada/bitmap-b-zier-curves-cubic-1.adb similarity index 100% rename from Task/Bitmap-B-zier-curves-Cubic/Ada/bitmap-b-zier-curves-cubic-1.ada rename to Task/Bitmap-B-zier-curves-Cubic/Ada/bitmap-b-zier-curves-cubic-1.adb diff --git a/Task/Bitmap-B-zier-curves-Cubic/Ada/bitmap-b-zier-curves-cubic-2.ada b/Task/Bitmap-B-zier-curves-Cubic/Ada/bitmap-b-zier-curves-cubic-2.adb similarity index 100% rename from Task/Bitmap-B-zier-curves-Cubic/Ada/bitmap-b-zier-curves-cubic-2.ada rename to Task/Bitmap-B-zier-curves-Cubic/Ada/bitmap-b-zier-curves-cubic-2.adb diff --git a/Task/Bitmap-B-zier-curves-Cubic/Delphi/bitmap-b-zier-curves-cubic.delphi b/Task/Bitmap-B-zier-curves-Cubic/Delphi/bitmap-b-zier-curves-cubic.pas similarity index 100% rename from Task/Bitmap-B-zier-curves-Cubic/Delphi/bitmap-b-zier-curves-cubic.delphi rename to Task/Bitmap-B-zier-curves-Cubic/Delphi/bitmap-b-zier-curves-cubic.pas diff --git a/Task/Bitmap-B-zier-curves-Cubic/FutureBasic/bitmap-b-zier-curves-cubic.basic b/Task/Bitmap-B-zier-curves-Cubic/FutureBasic/bitmap-b-zier-curves-cubic.basic new file mode 100644 index 0000000000..e947c6024f --- /dev/null +++ b/Task/Bitmap-B-zier-curves-Cubic/FutureBasic/bitmap-b-zier-curves-cubic.basic @@ -0,0 +1,31 @@ +void local fn BuildWindow + window 1, @"Cubic Bezier Curve", ( 0, 0, 300, 300 ), NSWindowStyleMaskTitled + NSWindowStyleMaskClosable + WindowSetBackgroundColor( 1, fn ColorBlack ) + WindowSubclassContentView(1) + ViewSetNeedsDisplay( _windowContentViewTag ) +end fn + +void local fn DrawInView( tag as NSInteger ) + ColorSetStroke( fn ColorYellow ) + BezierPathRef path = fn BezierPathInit + BezierPathMoveToPoint( path, fn CGPointMake( 50, 50 ) ) + CGPoint controlPoint1 = fn CGPointMake( 120, 200 ) + CGPoint controlPoint2 = fn CGPointMake( 180, 0 ) + CGPoint endPoint = fn CGPointMake( 260, 100 ) + BezierPathRelativeCurveToPoint( path, controlPoint1, controlPoint2, endPoint ) + BezierPathSetLineWidth( path, 4.0 ) + BezierPathStroke( path ) +end fn + +void local fn DoDialog( ev as long, tag as long ) + select ( ev ) + case _viewDrawRect : fn DrawInView(tag) + case _windowWillClose : end + end select +end fn + +fn BuildWindow + +on dialog fn DoDialog + +HandleEvents diff --git a/Task/Bitmap-B-zier-curves-Cubic/Julia/bitmap-b-zier-curves-cubic.julia b/Task/Bitmap-B-zier-curves-Cubic/Julia/bitmap-b-zier-curves-cubic.jl similarity index 100% rename from Task/Bitmap-B-zier-curves-Cubic/Julia/bitmap-b-zier-curves-cubic.julia rename to Task/Bitmap-B-zier-curves-Cubic/Julia/bitmap-b-zier-curves-cubic.jl diff --git a/Task/Bitmap-B-zier-curves-Cubic/Kotlin/bitmap-b-zier-curves-cubic.kotlin b/Task/Bitmap-B-zier-curves-Cubic/Kotlin/bitmap-b-zier-curves-cubic.kts similarity index 100% rename from Task/Bitmap-B-zier-curves-Cubic/Kotlin/bitmap-b-zier-curves-cubic.kotlin rename to Task/Bitmap-B-zier-curves-Cubic/Kotlin/bitmap-b-zier-curves-cubic.kts diff --git a/Task/Bitmap-B-zier-curves-Cubic/MiniScript/bitmap-b-zier-curves-cubic.mini b/Task/Bitmap-B-zier-curves-Cubic/MiniScript/bitmap-b-zier-curves-cubic.mini new file mode 100644 index 0000000000..3a94acef9d --- /dev/null +++ b/Task/Bitmap-B-zier-curves-Cubic/MiniScript/bitmap-b-zier-curves-cubic.mini @@ -0,0 +1,71 @@ +Point = {"x": 0, "y":0} +Point.init = function(x, y) + p = new Point + p.x = x; p.y = y + return p +end function + +drawLine = function(img, x0, y0, x1, y1, colr) + sign = function(a, b) + if a < b then return 1 + return -1 + end function + + dx = abs(x1 - x0) + sx = sign(x0, x1) + + dy = abs(y1 - y0) + sy = sign(y0, y1) + + if dx > dy then + err = dx + else + err = -dy + end if + err = floor(err / 2) + + while true + img.setPixel x0, y0, colr + if x0 == x1 and y0 == y1 then break + e2 = err + if e2 > -dx then + err -= dy + x0 += sx + end if + if e2 < dy then + err += dx + y0 += sy + end if + end while +end function + +cubicBezier = function(img, p1, p2, p3, p4, numPoints, colr) + points = [] + for i in range(0, numPoints) + t = i / numPoints + u = 1 - t + a = (1 - t)^3 + b = 3 * t * (1 - t)^2 + c = 3 * t^2 * (1 - t) + d = t^3 + + x = floor(a * p1.x + b * p2.x + c * p3.x + d * p4.x) + y = floor(a * p1.y + b * p2.y + c * p3.y + d * p4.y) + points.push(Point.init(x, y)) + img.setPixel x, y, colr + end for + + for i in range(1, numPoints) + drawLine img, points[i-1].x, points[i-1].y, points[i].x, points[i].y, colr + end for +end function + +bezier = Image.create(480, 480) +p1 = Point.init(50, 100) +p2 = Point.init(200, 400) +p3 = Point.init(360, 0) +p4 = Point.init(300, 424) + +cubicBezier bezier, p1, p2, p3, p4, 20, color.red +gfx.clear +gfx.drawImage bezier, 0, 0 diff --git a/Task/Bitmap-B-zier-curves-Cubic/OCaml/bitmap-b-zier-curves-cubic.ocaml b/Task/Bitmap-B-zier-curves-Cubic/OCaml/bitmap-b-zier-curves-cubic.ml similarity index 100% rename from Task/Bitmap-B-zier-curves-Cubic/OCaml/bitmap-b-zier-curves-cubic.ocaml rename to Task/Bitmap-B-zier-curves-Cubic/OCaml/bitmap-b-zier-curves-cubic.ml diff --git a/Task/Bitmap-B-zier-curves-Quadratic/ALGOL-68/bitmap-b-zier-curves-quadratic.alg b/Task/Bitmap-B-zier-curves-Quadratic/ALGOL-68/bitmap-b-zier-curves-quadratic.alg new file mode 100644 index 0000000000..c06ba96d7a --- /dev/null +++ b/Task/Bitmap-B-zier-curves-Quadratic/ALGOL-68/bitmap-b-zier-curves-quadratic.alg @@ -0,0 +1,41 @@ +BEGIN # draw a quadratic curve using Bresenham's line algoritm # + + PR READ "prelude/Bitmap.a68" PR; + PR READ "prelude/Bitmap/Bresenhams_line_algorithm.a68" PR; + + PROC quadratic bezier = ( REF IMAGE bm, INT x1, y1, x2, y2, x3, y3, nseg, REAL scale )VOID: + BEGIN + INT prevx := 0, prevy := 0; + FOR i FROM 0 TO nseg DO + REAL t = i / nseg; + REAL t1 = 1 - t; + REAL a = t1 * t1; + REAL b = 2 * t * t1; + REAL c = t * t; + INT currx = ENTIER ( scale * ( a * x1 + b * x2 + c * x3 + 0.5 ) ); + INT curry = ENTIER ( scale * ( a * y1 + b * y2 + c * y3 + 0.5 ) ); + IF i > 0 THEN + ( line OF class image )( bm + , ( prevx, prevy ) + , ( currx, curry ) + , black OF class image + ) + FI; + prevx := currx; + prevy := curry + OD + END # quadratic bezier # ; + + BEGIN + REF IMAGE bm = INIT LOC[ 1 : 60, 1 : 40 ]PIXEL; + ( fill OF class image )( bm, white OF class image ); + quadratic bezier( bm, 10, 100, 250, 270, 150, 20, 20, 70 / 300 ); + # print in monochrome # + FOR y FROM 2 UPB bm BY -1 TO 2 LWB bm DO + FOR x FROM 1 LWB bm TO 1 UPB bm DO + print( ( IF PIXEL( bm[ x, y ] ) /= white OF class image THEN "##" ELSE " " FI ) ) + OD; + print( ( newline ) ) + OD + END +END diff --git a/Task/Bitmap-B-zier-curves-Quadratic/Ada/bitmap-b-zier-curves-quadratic-1.ada b/Task/Bitmap-B-zier-curves-Quadratic/Ada/bitmap-b-zier-curves-quadratic-1.adb similarity index 100% rename from Task/Bitmap-B-zier-curves-Quadratic/Ada/bitmap-b-zier-curves-quadratic-1.ada rename to Task/Bitmap-B-zier-curves-Quadratic/Ada/bitmap-b-zier-curves-quadratic-1.adb diff --git a/Task/Bitmap-B-zier-curves-Quadratic/Ada/bitmap-b-zier-curves-quadratic-2.ada b/Task/Bitmap-B-zier-curves-Quadratic/Ada/bitmap-b-zier-curves-quadratic-2.adb similarity index 100% rename from Task/Bitmap-B-zier-curves-Quadratic/Ada/bitmap-b-zier-curves-quadratic-2.ada rename to Task/Bitmap-B-zier-curves-Quadratic/Ada/bitmap-b-zier-curves-quadratic-2.adb diff --git a/Task/Bitmap-B-zier-curves-Quadratic/Delphi/bitmap-b-zier-curves-quadratic.delphi b/Task/Bitmap-B-zier-curves-Quadratic/Delphi/bitmap-b-zier-curves-quadratic.pas similarity index 100% rename from Task/Bitmap-B-zier-curves-Quadratic/Delphi/bitmap-b-zier-curves-quadratic.delphi rename to Task/Bitmap-B-zier-curves-Quadratic/Delphi/bitmap-b-zier-curves-quadratic.pas diff --git a/Task/Bitmap-B-zier-curves-Quadratic/EasyLang/bitmap-b-zier-curves-quadratic.easy b/Task/Bitmap-B-zier-curves-Quadratic/EasyLang/bitmap-b-zier-curves-quadratic.easy new file mode 100644 index 0000000000..4d1203c99e --- /dev/null +++ b/Task/Bitmap-B-zier-curves-Quadratic/EasyLang/bitmap-b-zier-curves-quadratic.easy @@ -0,0 +1,16 @@ +sysconf topleft +proc quadraticbezier x1 y1 x2 y2 x3 y3 nseg . + gpenup + for i = 0 to nseg + t = i / nseg + t1 = 1 - t + a = t1 * t1 + b = 2 * t * t1 + c = t * t + x = a * x1 + b * x2 + c * x3 + 0.5 + y = a * y1 + b * y2 + c * y3 + 0.5 + glineto x y + . +. +glinewidth 0.5 +quadraticbezier 1 1 30 37 59 1 100 diff --git a/Task/Bitmap-B-zier-curves-Quadratic/Kotlin/bitmap-b-zier-curves-quadratic.kotlin b/Task/Bitmap-B-zier-curves-Quadratic/Kotlin/bitmap-b-zier-curves-quadratic.kts similarity index 100% rename from Task/Bitmap-B-zier-curves-Quadratic/Kotlin/bitmap-b-zier-curves-quadratic.kotlin rename to Task/Bitmap-B-zier-curves-Quadratic/Kotlin/bitmap-b-zier-curves-quadratic.kts diff --git a/Task/Bitmap-B-zier-curves-Quadratic/M2000-Interpreter/bitmap-b-zier-curves-quadratic.m2000 b/Task/Bitmap-B-zier-curves-Quadratic/M2000-Interpreter/bitmap-b-zier-curves-quadratic.m2000 new file mode 100644 index 0000000000..a5b02611cc --- /dev/null +++ b/Task/Bitmap-B-zier-curves-Quadratic/M2000-Interpreter/bitmap-b-zier-curves-quadratic.m2000 @@ -0,0 +1,191 @@ +module bezier { + Function Bitmap { + def x as long, y as long, Import as boolean + If match("NN") then + Read x, y + else.if Match("N") Then + \\ is a file? + Read f as long + byte whitespace[0] + if not Eof(f) then + get #f, whitespace :P6$=chr$(whitespace[0]) + get #f, whitespace : P6$+=chr$(whitespace[0]) + boolean getW=true, getH=true, getV=true + long v + If p6$="P6" Then + do + get #f, whitespace + select case whitespace[0] + case 35 + {do get #f, whitespace + until whitespace[0]=10 + } + case 32, 9, 13, 10 + { if getW and x<>0 then + getW=false + else.if getH and y<>0 then + getH=false + else.if getV and v<>0 then + getV=false + end if + } + case 48 to 57 + {if getW then + x*=10 + x+=whitespace[0]-48 + else.if getH then + y*=10 + y+=whitespace[0]-48 + else.if getV then + v*=10 + v+=whitespace[0]-48 + end if + } + End Select + iF eof(f) then Error "Not a ppm file" + until getV=false + else + Error "Not a P6 ppm" + end if + Import=True + end if + else + Error "No proper arguments" + end if + if x<1 or y<1 then Error "Wrong dimensions" + structure rgb { + red as byte + green as byte + blue as byte + } + m=len(rgb)*x mod 4 + if m>0 then m=4-m ' add some bytes to raster line + m+=len(rgb) *x + Structure rasterline { + { + pad as byte*m + } + hline as rgb*x + } + Structure Raster { + magic as integer*4 + w as integer*4 + h as integer*4 + { + linesB as byte*len(rasterline)*y + } + lines as rasterline*y + } + Buffer Clear Image1 as Raster + Return Image1, 0!magic:="cDIB", 0!w:=Hex$(x,2), 0!h:=Hex$(y, 2) + if not Import then Return Image1, 0!lines:=String$(chrcode$(0xffff), Len(rasterline)*y div 2) + Buffer Clear Pad as Byte*4 + SetPixel=Lambda Image1, Pad, aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x, y, c) ->{ + where=alines+3*x+blines*y + if c>0 then c=color(c) + c-! + Return Pad, 0:=c as long + Return Image1, 0!where:=Eval(Pad, 2) as byte, 0!where+1:=Eval(Pad, 1) as byte, 0!where+2:=Eval(Pad, 0) as byte + } + GetPixel=Lambda Image1,aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x,y) ->{ + where=alines+3*x+blines*y + =color(Eval(image1, where+2 as byte), Eval(image1, where+1 as byte), Eval(image1, where as byte)) + } + StrDib$=Lambda$ Image1, Raster -> { + =Eval$(Image1, 0, Len(Raster)) + } + CopyImage=Lambda Image1 (image$) -> { + if left$(image$,12)=Eval$(Image1, 0, 24 ) Then { + Return Image1, 0:=Image$ + } Else Error "Can't Copy Image" + } + Export2File=Lambda Image1, x, y (f) -> { + Print #f, "P6";chr$(10);"# Created using M2000 Interpreter";chr$(10); + Print #f, x;" ";y;" 255";chr$(10); + x2=x-1 : where=0 + x0=x*3 + structure rgbP6 { + r as byte + g as byte + b as byte + } + buffer Pad as rgbP6*x*y + For y1=y-1 to 0 { + Return pad, x*y1:=eval$(image1, 0!linesB!where, x0) + where+=x0 + m=where mod 4 : if m<>0 then where+=4-m + } + For x1=0 to x*y-1 { + Push Eval(pad, x1!b) : Return pad, x1!b:=Eval(pad, x1!r), x1!r:=Number + } + Put #f, pad + } + if Import then { + x0=x-1 : where=0 + structure rgbP6 { + r as byte, g as byte, b as byte + } + buffer Pad1 as rgbP6*x*y + Get #f, Pad1 + For x1=0 to x*y-1 { + Push Eval(pad1, x1!b) : Return pad1, x1!b:=Eval(pad1, x1!r), x1!r:=Number + } + x1=x*3 + For y1=y-1 to 0 { + Return Image1, 0!linesB!where:=Eval$(Pad1, y1*x, x1) + where+=3*(x0+1) + m=where mod 4 : if m<>0 then where+=4-m + } + } + Group Bitmap { + type:Bitmap + SetPixel=SetPixel + GetPixel=GetPixel + Image$=StrDib$ + Copy=CopyImage + ToFile=Export2File + } + =Bitmap + } + module bezier (&ppm as Bitmap, x1, y1, x2, y2, x3, y3, n, col=0){ + Group point_ { + long x,y + } + Long i + Double t, t1, a, b, c, d + Dim p(n+1)=point_ + For i = 0 To n + t = i / n + t1 = 1 - t + a = t1 ^ 2 + b = t * t1 * 2 + c = t ^ 2 + p(i).x = Int(a * x1 + b * x2 + c * x3 + .5) + p(i).y = Int(a * y1 + b * y2 + c * y3 + .5) + Next + + For i = 0 To n -1 + Br_line(p(i).x, p(i).y, p(i +1).x, p(i +1).y, col) + Next + sub Br_line(x0 As Long, y0 As Long, x1 As Long, y1 As Long, Col=0) + Local Long dx = Abs(x1 - x0), dy = Abs(y1 - y0) + Local Long sx = If(x0 < x1-> 1, -1) + Local Long sy = If(y0 < y1-> 1, -1) + Local Long er = If(dx > dy-> dx, -dy) div 2, e2 + Do + Call ppm.SetPixel(x0, y0, Col) + If x0=x1 And y0=y1 Then Exit + e2 = er + If e2 > -dx Then Er -= dy : x0 += sx + If e2 < dy Then Er += dx : y0 += sy + Always + end sub + } + A=Bitmap(250, 250) + bezier &A, 10, 100, 220, 310, 150, 20, 20 + move 3000,3000 : image A.Image$() + Open "curve.ppm" for output as #f + Call A.tofile(f) + close #f +} +bezier diff --git a/Task/Bitmap-B-zier-curves-Quadratic/MiniScript/bitmap-b-zier-curves-quadratic.mini b/Task/Bitmap-B-zier-curves-Quadratic/MiniScript/bitmap-b-zier-curves-quadratic.mini new file mode 100644 index 0000000000..bfc5fbf3a5 --- /dev/null +++ b/Task/Bitmap-B-zier-curves-Quadratic/MiniScript/bitmap-b-zier-curves-quadratic.mini @@ -0,0 +1,69 @@ +Point = {"x": 0, "y":0} +Point.init = function(x, y) + p = new Point + p.x = x; p.y = y + return p +end function + +drawLine = function(img, x0, y0, x1, y1, colr) + sign = function(a, b) + if a < b then return 1 + return -1 + end function + + dx = abs(x1 - x0) + sx = sign(x0, x1) + + dy = abs(y1 - y0) + sy = sign(y0, y1) + + if dx > dy then + err = dx + else + err = -dy + end if + err = floor(err / 2) + + while true + img.setPixel x0, y0, colr + if x0 == x1 and y0 == y1 then break + e2 = err + if e2 > -dx then + err -= dy + x0 += sx + end if + if e2 < dy then + err += dx + y0 += sy + end if + end while +end function + +quadraticBezier = function(img, p1, p2, p3, numPoints, colr) + points = [] + for i in range(0, numPoints) + t = i / numPoints + u = 1 - t + a = u * u + b = 2 * t * u + c = t * t + + x = floor(a * p1.x + b * p2.x + c * p3.x) + y = floor(a * p1.y + b * p2.y + c * p3.y) + points.push(Point.init(x, y)) + img.setPixel x, y, colr + end for + + for i in range(1, numPoints) + drawLine img, points[i-1].x, points[i-1].y, points[i].x, points[i].y, colr + end for +end function + +bezier = Image.create(480, 480) +p1 = Point.init(50, 100) +p2 = Point.init(200, 400) +p3 = Point.init(360, 55) + +quadraticBezier bezier, p1, p2, p3, 20, color.red +gfx.clear +gfx.drawImage bezier, 0, 0 diff --git a/Task/Bitmap-B-zier-curves-Quadratic/OCaml/bitmap-b-zier-curves-quadratic.ocaml b/Task/Bitmap-B-zier-curves-Quadratic/OCaml/bitmap-b-zier-curves-quadratic.ml similarity index 100% rename from Task/Bitmap-B-zier-curves-Quadratic/OCaml/bitmap-b-zier-curves-quadratic.ocaml rename to Task/Bitmap-B-zier-curves-Quadratic/OCaml/bitmap-b-zier-curves-quadratic.ml diff --git a/Task/Bitmap-Bresenhams-line-algorithm/11l/bitmap-bresenhams-line-algorithm.11l b/Task/Bitmap-Bresenhams-line-algorithm/11l/bitmap-bresenhams-line-algorithm.11l index 3c00cb16f4..928f45dde9 100644 --- a/Task/Bitmap-Bresenhams-line-algorithm/11l/bitmap-bresenhams-line-algorithm.11l +++ b/Task/Bitmap-Bresenhams-line-algorithm/11l/bitmap-bresenhams-line-algorithm.11l @@ -1,13 +1,4 @@ -T Colour - Byte r, g, b - - F (r, g, b) - .r = r - .g = g - .b = b - - F ==(other) - R .r == other.r & .g == other.g & .b == other.b +T Colour = BVec3 V black = Colour(0, 0, 0) V white = Colour(255, 255, 255) diff --git a/Task/Bitmap-Bresenhams-line-algorithm/ALGOL-68/bitmap-bresenhams-line-algorithm-1.alg b/Task/Bitmap-Bresenhams-line-algorithm/ALGOL-68/bitmap-bresenhams-line-algorithm-1.alg deleted file mode 100644 index 71ca3c026d..0000000000 --- a/Task/Bitmap-Bresenhams-line-algorithm/ALGOL-68/bitmap-bresenhams-line-algorithm-1.alg +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- # - -line OF class image := (REF IMAGE picture, POINT start, stop, PIXEL color)VOID: -BEGIN - REAL dx = ABS (x OF stop - x OF start), - dy = ABS (y OF stop - y OF start); - REAL err; - POINT here := start, - step := (1, 1); - IF x OF start > x OF stop THEN - x OF step := -1 - FI; - IF y OF start > y OF stop THEN - y OF step := -1 - FI; - IF dx > dy THEN - err := dx / 2; - WHILE x OF here /= x OF stop DO - picture[x OF here, y OF here] := color; - err -:= dy; - IF err < 0 THEN - y OF here +:= y OF step; - err +:= dx - FI; - x OF here +:= x OF step - OD - ELSE - err := dy / 2; - WHILE y OF here /= y OF stop DO - picture[x OF here, y OF here] := color; - err -:= dx; - IF err < 0 THEN - x OF here +:= x OF step; - err +:= dy - FI; - y OF here +:= y OF step - OD - FI; - picture[x OF here, y OF here] := color # ensure dots to be drawn # -END # line #; - -SKIP diff --git a/Task/Bitmap-Bresenhams-line-algorithm/ALGOL-68/bitmap-bresenhams-line-algorithm-2.alg b/Task/Bitmap-Bresenhams-line-algorithm/ALGOL-68/bitmap-bresenhams-line-algorithm-2.alg deleted file mode 100644 index d1ba6015a9..0000000000 --- a/Task/Bitmap-Bresenhams-line-algorithm/ALGOL-68/bitmap-bresenhams-line-algorithm-2.alg +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/a68g --script # -# -*- coding: utf-8 -*- # - -PR READ "prelude/Bitmap.a68" PR; # c.f. [[rc:Bitmap]] # -PR READ "prelude/Bitmap/Bresenhams_line_algorithm.a68" PR; - -### The test program: ### -test:( - REF IMAGE x = INIT LOC[1:16, 1:16]PIXEL; - (fill OF class image)(x, white OF class image); - (line OF class image)(x, ( 1, 8), ( 8,16), black OF class image); - (line OF class image)(x, ( 8,16), (16, 8), black OF class image); - (line OF class image)(x, (16, 8), ( 8, 1), black OF class image); - (line OF class image)(x, ( 8, 1), ( 1, 8), black OF class image); - (print OF class image)(x) -) diff --git a/Task/Bitmap-Bresenhams-line-algorithm/ALGOL-68/bitmap-bresenhams-line-algorithm.alg b/Task/Bitmap-Bresenhams-line-algorithm/ALGOL-68/bitmap-bresenhams-line-algorithm.alg new file mode 100644 index 0000000000..223c635fd0 --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/ALGOL-68/bitmap-bresenhams-line-algorithm.alg @@ -0,0 +1,16 @@ +#!/usr/bin/a68g --script # +# -*- coding: utf-8 -*- # + +PR READ "prelude/Bitmap.a68" PR; +PR READ "prelude/Bitmap/Bresenhams_line_algorithm.a68" PR; + +### The test program: ### +( + REF IMAGE x = INIT LOC[1:16, 1:16]PIXEL; + (fill OF class image)(x, white OF class image); + (line OF class image)(x, ( 1, 8), ( 8,16), black OF class image); + (line OF class image)(x, ( 8,16), (16, 8), black OF class image); + (line OF class image)(x, (16, 8), ( 8, 1), black OF class image); + (line OF class image)(x, ( 8, 1), ( 1, 8), black OF class image); + (print OF class image)(x) +) diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Ada/bitmap-bresenhams-line-algorithm-1.ada b/Task/Bitmap-Bresenhams-line-algorithm/Ada/bitmap-bresenhams-line-algorithm-1.adb similarity index 100% rename from Task/Bitmap-Bresenhams-line-algorithm/Ada/bitmap-bresenhams-line-algorithm-1.ada rename to Task/Bitmap-Bresenhams-line-algorithm/Ada/bitmap-bresenhams-line-algorithm-1.adb diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Ada/bitmap-bresenhams-line-algorithm-2.ada b/Task/Bitmap-Bresenhams-line-algorithm/Ada/bitmap-bresenhams-line-algorithm-2.adb similarity index 100% rename from Task/Bitmap-Bresenhams-line-algorithm/Ada/bitmap-bresenhams-line-algorithm-2.ada rename to Task/Bitmap-Bresenhams-line-algorithm/Ada/bitmap-bresenhams-line-algorithm-2.adb diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Arturo/bitmap-bresenhams-line-algorithm.arturo b/Task/Bitmap-Bresenhams-line-algorithm/Arturo/bitmap-bresenhams-line-algorithm.arturo new file mode 100644 index 0000000000..874b30a87e --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/Arturo/bitmap-bresenhams-line-algorithm.arturo @@ -0,0 +1,67 @@ +; Bitmap object definition +define :bitmap [ + init: method [width :integer height :integer][ + \width: width + \height: height + \grid: array.of:@[width height] false + ] + + setOn: method [x :integer y :integer][ + \grid\[y]\[x]: true + ] + + line: method [x0 :integer y0 :integer x1 :integer y1 :integer][ + [dx,dy]: @[abs x1 - x0, abs y1 - y0] + [x,y]: @[x0, y0] + sx: (x0 > x1) ? -> neg 1 -> 1 + sy: (y0 > y1) ? -> neg 1 -> 1 + + switch dx > dy [ + err: dx // 2 + while [x <> x1][ + \setOn x y + if negative? err: <= err - dy -> + [y, err]: @[y + sy, err + dx] + + x: x + sx + ] + ][ + err: dy // 2 + while [y <> y1][ + \setOn x y + if negative? err: <= err - dx -> + [x, err]: @[x + sx, err + dy] + y: y + sy + ] + ] + \setOn x y + ] + + string: method [][ + join.with:"\n" @[ + "+" ++ (repeat "-" \width) ++ "+" + join.with:"\n" map 0..dec \height 'y [ + "|" ++ (join.with:"" map 0..dec \width 'x -> + \grid\[dec \height-y]\[x] ? -> "@" -> " " + ) ++ "|" + ] + "+" ++ (repeat "-" \width) ++ "+" + ] + ] +] + +; Create bitmap +bitmap: to :bitmap @[17 17]! + +; and... draw a diamond shape +points: @[ + [1 8 8 16] + [8 16 16 8] + [16 8 8 1] + [8 1 1 8] +] + +loop points 'p -> + bitmap\line p\0 p\1 p\2 p\3 + +print bitmap diff --git a/Task/Bitmap-Bresenhams-line-algorithm/AutoIt/bitmap-bresenhams-line-algorithm.autoit b/Task/Bitmap-Bresenhams-line-algorithm/AutoIt/bitmap-bresenhams-line-algorithm.au3 similarity index 100% rename from Task/Bitmap-Bresenhams-line-algorithm/AutoIt/bitmap-bresenhams-line-algorithm.autoit rename to Task/Bitmap-Bresenhams-line-algorithm/AutoIt/bitmap-bresenhams-line-algorithm.au3 diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Crystal/bitmap-bresenhams-line-algorithm-1.cr b/Task/Bitmap-Bresenhams-line-algorithm/Crystal/bitmap-bresenhams-line-algorithm-1.cr new file mode 100644 index 0000000000..f0a7e50bb0 --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/Crystal/bitmap-bresenhams-line-algorithm-1.cr @@ -0,0 +1,17 @@ +require "./pixmap" + +class Pixmap + def line (x0, y0, x1, y1, color) + dx, sx = (x1-x0).abs, x0dy ? dx : -dy) // 2 + + loop do + self[x0, y0] = color + break if x0 == x1 && y0 == y1 + e2 = err + (err -= dy; x0 += sx) if e2 >-dx + (err += dx; y0 += sy) if e2 < dy + end + end +end diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Crystal/bitmap-bresenhams-line-algorithm-2.cr b/Task/Bitmap-Bresenhams-line-algorithm/Crystal/bitmap-bresenhams-line-algorithm-2.cr new file mode 100644 index 0000000000..fa74ba9af7 --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/Crystal/bitmap-bresenhams-line-algorithm-2.cr @@ -0,0 +1,7 @@ +require "./bresenham" + +img = Pixmap.new 10, 5, Color::WHITE + +img.line 0, 3, 9, 0, Color::RED + +img.write STDOUT diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Delphi/bitmap-bresenhams-line-algorithm.delphi b/Task/Bitmap-Bresenhams-line-algorithm/Delphi/bitmap-bresenhams-line-algorithm.pas similarity index 100% rename from Task/Bitmap-Bresenhams-line-algorithm/Delphi/bitmap-bresenhams-line-algorithm.delphi rename to Task/Bitmap-Bresenhams-line-algorithm/Delphi/bitmap-bresenhams-line-algorithm.pas diff --git a/Task/Bitmap-Bresenhams-line-algorithm/EasyLang/bitmap-bresenhams-line-algorithm.easy b/Task/Bitmap-Bresenhams-line-algorithm/EasyLang/bitmap-bresenhams-line-algorithm.easy new file mode 100644 index 0000000000..b0a250c7ec --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/EasyLang/bitmap-bresenhams-line-algorithm.easy @@ -0,0 +1,36 @@ +proc pset x y . + grect x / 4 y / 4 0.25 0.25 +. +proc drawline x0 y0 x1 y1 . + dx = abs (x1 - x0) + sx = -1 + if x0 < x1 + sx = 1 + . + dy = abs (y1 - y0) + sy = -1 + if y0 < y1 + sy = 1 + . + err = -dy div 2 + if dx > dy + err = dx div 2 + . + repeat + pset x0 y0 + until x0 = x1 and y0 = y1 + e2 = err + if e2 > -dx + err -= dy + x0 += sx + . + if e2 < dy + err += dx + y0 += sy + . + . +. +drawline 200 10 100 200 +drawline 100 200 200 390 +drawline 200 390 300 200 +drawline 300 200 200 10 diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Euphoria/bitmap-bresenhams-line-algorithm.euphoria b/Task/Bitmap-Bresenhams-line-algorithm/Euphoria/bitmap-bresenhams-line-algorithm.eu similarity index 100% rename from Task/Bitmap-Bresenhams-line-algorithm/Euphoria/bitmap-bresenhams-line-algorithm.euphoria rename to Task/Bitmap-Bresenhams-line-algorithm/Euphoria/bitmap-bresenhams-line-algorithm.eu diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Julia/bitmap-bresenhams-line-algorithm.julia b/Task/Bitmap-Bresenhams-line-algorithm/Julia/bitmap-bresenhams-line-algorithm.jl similarity index 100% rename from Task/Bitmap-Bresenhams-line-algorithm/Julia/bitmap-bresenhams-line-algorithm.julia rename to Task/Bitmap-Bresenhams-line-algorithm/Julia/bitmap-bresenhams-line-algorithm.jl diff --git a/Task/Bitmap-Bresenhams-line-algorithm/M2000-Interpreter/bitmap-bresenhams-line-algorithm.m2000 b/Task/Bitmap-Bresenhams-line-algorithm/M2000-Interpreter/bitmap-bresenhams-line-algorithm.m2000 new file mode 100644 index 0000000000..5ed0c0f987 --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/M2000-Interpreter/bitmap-bresenhams-line-algorithm.m2000 @@ -0,0 +1,20 @@ +' using Twips +' twipsX is 15 twips. So for 96 dpi, we have 1440/96=15 twips/pixel +Module Bresenham_s_line_algorithm { + Module Br_line(x0 As Long, y0 As Long, x1 As Long, y1 As Long, Col=15) { + Long dx = Abs(x1 - x0), dy = Abs(y1 - y0) + Long sx = If(x0 < x1-> TWIPSX, -TWIPSX) + Long sy = If(y0 < y1-> TWIPSY, -TWIPSY) + Long er = If(dx > dy-> dx, -dy) div 2, e2 + Do + PSet col, x0, y0 + If abs(x0-x1)<=TWIPSX And abs(y0-y1)<=TWIPSY Then Exit + e2 = er + If e2 > -dx Then Er -= dy : x0 += sx + If e2 < dy Then Er += dx : y0 += sy + Always + } + cls ,0 + Br_line scale.x*.2, scale.y*.2, scale.x*.8, scale.y*.8 , #FFbb77 +} +Bresenham_s_line_algorithm diff --git a/Task/Bitmap-Bresenhams-line-algorithm/MiniScript/bitmap-bresenhams-line-algorithm.mini b/Task/Bitmap-Bresenhams-line-algorithm/MiniScript/bitmap-bresenhams-line-algorithm.mini new file mode 100644 index 0000000000..e546a12bb6 --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/MiniScript/bitmap-bresenhams-line-algorithm.mini @@ -0,0 +1,38 @@ +drawLine = function(img, x0, y0, x1, y1, colr) + sign = function(a, b) + if a < b then return 1 + return -1 + end function + + dx = abs(x1 - x0) + sx = sign(x0, x1) + + dy = abs(y1 - y0) + sy = sign(y0, y1) + + if dx > dy then + err = dx + else + err = -dy + end if + err = floor(err / 2) + + while true + img.setPixel x0, y0, colr + if x0 == x1 and y0 == y1 then break + e2 = err + if e2 > -dx then + err -= dy + x0 += sx + end if + if e2 < dy then + err += dx + y0 += sy + end if + end while +end function + +img= Image.create(320, 320) +drawLine img, 0, 0, 250, 300, color.red +gfx.clear +gfx.drawImage img, 0, 0 diff --git a/Task/Bitmap-Bresenhams-line-algorithm/OCaml/bitmap-bresenhams-line-algorithm.ocaml b/Task/Bitmap-Bresenhams-line-algorithm/OCaml/bitmap-bresenhams-line-algorithm.ml similarity index 100% rename from Task/Bitmap-Bresenhams-line-algorithm/OCaml/bitmap-bresenhams-line-algorithm.ocaml rename to Task/Bitmap-Bresenhams-line-algorithm/OCaml/bitmap-bresenhams-line-algorithm.ml diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Pluto/bitmap-bresenhams-line-algorithm-1.pluto b/Task/Bitmap-Bresenhams-line-algorithm/Pluto/bitmap-bresenhams-line-algorithm-1.pluto new file mode 100644 index 0000000000..8ab23127e7 --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/Pluto/bitmap-bresenhams-line-algorithm-1.pluto @@ -0,0 +1,27 @@ +local canvas = require "canvas" + +local function line(c, x0, y0, x1, y1, col) + local dx = math.abs(x1 - x0) + local dy = math.abs(y1 - y0) + local sx = (x0 < x1) ? 1 : -1 + local sy = (y0 < y1) ? 1 : -1 + local err = (dx > dy ? dx : - dy) // 2 + while true do + c:set(x0, y0, col) + if x0 == x1 and y0 == y1 then break end + local e2 = err + if e2 > -dx then + err -= dy + x0 += sx + end + if e2 < dy then + err += dx + y0 += sy + end + end +end + +local c = canvas.new(400, 400) +c:fill(0xffffff) -- white background +line(c, 0, 0, 399, 399, 0x0000ff) -- draw a red diagonal +io.contents("mybmp.bmp", c:tobmp()) -- save to a bitmap file diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Pluto/bitmap-bresenhams-line-algorithm-2.pluto b/Task/Bitmap-Bresenhams-line-algorithm/Pluto/bitmap-bresenhams-line-algorithm-2.pluto new file mode 100644 index 0000000000..a3504b25b4 --- /dev/null +++ b/Task/Bitmap-Bresenhams-line-algorithm/Pluto/bitmap-bresenhams-line-algorithm-2.pluto @@ -0,0 +1,6 @@ +require "bitmap" + +local bmp = bitmap.of(400, 400, color.white, "mybmp") +bmp:line(0, 0, 399, 399, color.red) +bmp:view() +bmp:save() -- if required diff --git a/Task/Bitmap-Bresenhams-line-algorithm/Rust/bitmap-bresenhams-line-algorithm.rust b/Task/Bitmap-Bresenhams-line-algorithm/Rust/bitmap-bresenhams-line-algorithm.rs similarity index 100% rename from Task/Bitmap-Bresenhams-line-algorithm/Rust/bitmap-bresenhams-line-algorithm.rust rename to Task/Bitmap-Bresenhams-line-algorithm/Rust/bitmap-bresenhams-line-algorithm.rs diff --git a/Task/Bitmap-Bresenhams-line-algorithm/VBScript/bitmap-bresenhams-line-algorithm.vb b/Task/Bitmap-Bresenhams-line-algorithm/VBScript/bitmap-bresenhams-line-algorithm.vbs similarity index 100% rename from Task/Bitmap-Bresenhams-line-algorithm/VBScript/bitmap-bresenhams-line-algorithm.vb rename to Task/Bitmap-Bresenhams-line-algorithm/VBScript/bitmap-bresenhams-line-algorithm.vbs diff --git a/Task/Bitmap-Flood-fill/Ada/bitmap-flood-fill-1.ada b/Task/Bitmap-Flood-fill/Ada/bitmap-flood-fill-1.adb similarity index 100% rename from Task/Bitmap-Flood-fill/Ada/bitmap-flood-fill-1.ada rename to Task/Bitmap-Flood-fill/Ada/bitmap-flood-fill-1.adb diff --git a/Task/Bitmap-Flood-fill/Ada/bitmap-flood-fill-2.ada b/Task/Bitmap-Flood-fill/Ada/bitmap-flood-fill-2.adb similarity index 100% rename from Task/Bitmap-Flood-fill/Ada/bitmap-flood-fill-2.ada rename to Task/Bitmap-Flood-fill/Ada/bitmap-flood-fill-2.adb diff --git a/Task/Bitmap-Flood-fill/AutoHotkey/bitmap-flood-fill-2.ahk b/Task/Bitmap-Flood-fill/AutoHotkey/bitmap-flood-fill-2.ahk index 9ff5334cf8..ab321c5681 100644 --- a/Task/Bitmap-Flood-fill/AutoHotkey/bitmap-flood-fill-2.ahk +++ b/Task/Bitmap-Flood-fill/AutoHotkey/bitmap-flood-fill-2.ahk @@ -1,55 +1,55 @@ #NoEnv #SingleInstance, Force - SetBatchLines, -1 - CoordMode, Mouse - CoordMode, Pixel + SetBatchLines, -1 + CoordMode, Mouse + CoordMode, Pixel return CapsLock:: - KeyWait, CapsLock - MouseGetPos, X, Y - PixelGetColor, color, X, Y - FloodFill(x, y, color, 0x000000, 1, "Esc") - MsgBox Done! + KeyWait, CapsLock + MouseGetPos, X, Y + PixelGetColor, color, X, Y + FloodFill(x, y, color, 0x000000, 1, "Esc") + MsgBox Done! Return FloodFill( 0x, 0y, target, replacement, mode=1, key="" ) { - VarSetCapacity(Rect, 16, 0) - hDC := DllCall("GetDC", UInt, 0) - hBrush := DllCall("CreateSolidBrush", UInt, replacement) - - l := 0 - while l >= 0 - { - if getkeystate(key, "P") - return - x := %l%x, y := %l%y - %l%p++ - p := %l%p - PixelGetColor, color, x, y - if (color = target) - { - NumPut(x, Rect, 0) - NumPut(y, Rect, 4) - NumPut(x+1, Rect, 8) - NumPut(y+1, Rect, 12) - DllCall("FillRect", UInt, hDC, Str, Rect, UInt, hBrush) - } - else if (p = 1) - { - %l%x := %l%y := %l%p := "", l-- - continue - } - if (p < 5) - ol := l++ - , %l%x := %ol%x + (p = 1 ? 1 : p = 2 ? -1 : 0) - , %l%y := %ol%y + (p = 3 ? 1 : p = 4 ? -1 : 0) - else - %l%x := %l%y := %l%p := "", l-- - } - - DllCall("ReleaseDC", UInt, 0, UInt, hDC) - DllCall("DeleteObject", UInt, hBrush) + VarSetCapacity(Rect, 16, 0) + hDC := DllCall("GetDC", UInt, 0) + hBrush := DllCall("CreateSolidBrush", UInt, replacement) + + l := 0 + while l >= 0 + { + if getkeystate(key, "P") + return + x := %l%x, y := %l%y + %l%p++ + p := %l%p + PixelGetColor, color, x, y + if (color = target) + { + NumPut(x, Rect, 0) + NumPut(y, Rect, 4) + NumPut(x+1, Rect, 8) + NumPut(y+1, Rect, 12) + DllCall("FillRect", UInt, hDC, Str, Rect, UInt, hBrush) + } + else if (p = 1) + { + %l%x := %l%y := %l%p := "", l-- + continue + } + if (p < 5) + ol := l++ + , %l%x := %ol%x + (p = 1 ? 1 : p = 2 ? -1 : 0) + , %l%y := %ol%y + (p = 3 ? 1 : p = 4 ? -1 : 0) + else + %l%x := %l%y := %l%p := "", l-- + } + + DllCall("ReleaseDC", UInt, 0, UInt, hDC) + DllCall("DeleteObject", UInt, hBrush) } diff --git a/Task/Bitmap-Flood-fill/C++/bitmap-flood-fill-2.cpp b/Task/Bitmap-Flood-fill/C++/bitmap-flood-fill-2.cpp index 3518acceab..1791da5b87 100644 --- a/Task/Bitmap-Flood-fill/C++/bitmap-flood-fill-2.cpp +++ b/Task/Bitmap-Flood-fill/C++/bitmap-flood-fill-2.cpp @@ -16,25 +16,25 @@ void FloodFillAlgorithm::flood(Point startPoint, Mat* tgtMat) { if (image->at(startPoint) == srcColor) { queue pointQueue; - pointQueue.push(startPoint); + pointQueue.push(startPoint); - while (!pointQueue.empty()) { - Point p = pointQueue.front(); - pointQueue.pop(); + while (!pointQueue.empty()) { + Point p = pointQueue.front(); + pointQueue.pop(); - if (insideImage(p)) { + if (insideImage(p)) { - if ((image->at(p) == srcColor)) { - image->at(p) = tgtMat->at(p); + if ((image->at(p) == srcColor)) { + image->at(p) = tgtMat->at(p); - pointQueue.push(Point(p.x + 1, p.y)); - pointQueue.push(Point(p.x - 1, p.y)); - pointQueue.push(Point(p.x, p.y + 1)); - pointQueue.push(Point(p.x, p.y - 1)); - } - } + pointQueue.push(Point(p.x + 1, p.y)); + pointQueue.push(Point(p.x - 1, p.y)); + pointQueue.push(Point(p.x, p.y + 1)); + pointQueue.push(Point(p.x, p.y - 1)); + } + } - } + } } } diff --git a/Task/Bitmap-Flood-fill/C/bitmap-flood-fill-3.c b/Task/Bitmap-Flood-fill/C/bitmap-flood-fill-3.c index 9e3b20b4a1..69c8175bc1 100644 --- a/Task/Bitmap-Flood-fill/C/bitmap-flood-fill-3.c +++ b/Task/Bitmap-Flood-fill/C/bitmap-flood-fill-3.c @@ -5,5 +5,5 @@ typedef struct { typedef rgb_color *rgb_color_p; void floodfill(image img, int px, int py, - rgb_color_p bankscolor, - rgb_color_p rcolor); + rgb_color_p bankscolor, + rgb_color_p rcolor); diff --git a/Task/Bitmap-Flood-fill/C/bitmap-flood-fill-4.c b/Task/Bitmap-Flood-fill/C/bitmap-flood-fill-4.c index 8e9134edf6..453c999fed 100644 --- a/Task/Bitmap-Flood-fill/C/bitmap-flood-fill-4.c +++ b/Task/Bitmap-Flood-fill/C/bitmap-flood-fill-4.c @@ -29,8 +29,8 @@ inline void _ffill_enqueue(_ffill_queue *q, int px, int py) inline double color_distance( rgb_color_p a, rgb_color_p b ) { return sqrt( (double)(a->red - b->red)*(a->red - b->red) + - (double)(a->green - b->green)*(a->green - b->green) + - (double)(a->blue - b->blue)*(a->blue - b->blue) ) / (256.0*sqrt(3.0)); + (double)(a->green - b->green)*(a->green - b->green) + + (double)(a->blue - b->blue)*(a->blue - b->blue) ) / (256.0*sqrt(3.0)); } inline void _ffill_rgbcolor(image img, rgb_color_p tc, int px, int py) @@ -41,25 +41,25 @@ inline void _ffill_rgbcolor(image img, rgb_color_p tc, int px, int py) } -#define NSOE(X,Y) do { \ - if ( ((X)>=0)&&((Y)>=0) && ((X)width)&&((Y)height)) { \ - _ffill_rgbcolor(img, &thisnode, (X), (Y)); \ - if ( color_distance(&thisnode, bankscolor) > tolerance ) { \ - if (color_distance(&thisnode, rcolor) > 0.0) { \ - put_pixel_unsafe(img, (X), (Y), rcolor->red, \ - rcolor->green, \ - rcolor->blue); \ - _ffill_enqueue(&head, (X), (Y)); \ - pixelcount++; \ - } \ - } \ - } \ +#define NSOE(X,Y) do { \ + if ( ((X)>=0)&&((Y)>=0) && ((X)width)&&((Y)height)) { \ + _ffill_rgbcolor(img, &thisnode, (X), (Y)); \ + if ( color_distance(&thisnode, bankscolor) > tolerance ) { \ + if (color_distance(&thisnode, rcolor) > 0.0) { \ + put_pixel_unsafe(img, (X), (Y), rcolor->red, \ + rcolor->green, \ + rcolor->blue); \ + _ffill_enqueue(&head, (X), (Y)); \ + pixelcount++; \ + } \ + } \ + } \ } while(0) unsigned int floodfill(image img, int px, int py, - rgb_color_p bankscolor, - rgb_color_p rcolor) + rgb_color_p bankscolor, + rgb_color_p rcolor) { _ffill_queue head; rgb_color thisnode; diff --git a/Task/Bitmap-Flood-fill/Crystal/bitmap-flood-fill-1.cr b/Task/Bitmap-Flood-fill/Crystal/bitmap-flood-fill-1.cr new file mode 100644 index 0000000000..1a294cd573 --- /dev/null +++ b/Task/Bitmap-Flood-fill/Crystal/bitmap-flood-fill-1.cr @@ -0,0 +1,37 @@ +require "./pixmap" + +class Pixmap + def flood_fill (x, y, color) + old_color = self[x, y] + queue = Deque(Int32).new + width = @width + size = @data.size + idx = y * width + x + queue << idx + + until queue.empty? + idx = queue.shift + next unless @data[idx] == old_color + start = idx + # go left + limit = start // width * width + while idx >= limit && @data[idx] == old_color + @data[idx] = color + up, dn = idx - width, idx + width + queue << up if up >= 0 && @data[up] == old_color + queue << dn if dn < size && @data[dn] == old_color + idx -= 1 + end + # go right + limit = (start + width) // width * width + idx = start + 1 + while idx < limit && @data[idx] == old_color + @data[idx] = color + up, dn = idx - width, idx + width + queue << up if up >= 0 && @data[up] == old_color + queue << dn if dn < size && @data[dn] == old_color + idx += 1 + end + end + end +end diff --git a/Task/Bitmap-Flood-fill/Crystal/bitmap-flood-fill-2.cr b/Task/Bitmap-Flood-fill/Crystal/bitmap-flood-fill-2.cr new file mode 100644 index 0000000000..eb33ea7d5d --- /dev/null +++ b/Task/Bitmap-Flood-fill/Crystal/bitmap-flood-fill-2.cr @@ -0,0 +1,22 @@ +require "./circle" +require "./flood_fill" +require "./write_ppm" +require "./load_ppm" + +img = Pixmap.new 120, 80, Color::WHITE +img.circle 60, 40, 35, Color::BLACK +img.circle 100, 20, 18, Color::RED + +img.flood_fill 10, 10, Color.new(210, 230, 0) +img.flood_fill 60, 40, Color.new(255, 128, 76) + +img.write "crystal_flood_fill.ppm" + + +img = Pixmap.load "Unfilledcirc.ppm" +img.flood_fill 10, 10, Color.new(0, 128, 240) +img.flood_fill img.width-1, img.height-1, Color.new(0, 128, 240) +img.flood_fill 10, img.height//2, Color.new(240, 180, 10) +img.flood_fill 100, 100, Color.new(255, 60, 10) + +img.write "crystal_filledcirc.ppm" diff --git a/Task/Bitmap-Flood-fill/FBSL/bitmap-flood-fill.fbsl b/Task/Bitmap-Flood-fill/FBSL/bitmap-flood-fill.fbsl index 2cc3085c3c..b359ffe534 100644 --- a/Task/Bitmap-Flood-fill/FBSL/bitmap-flood-fill.fbsl +++ b/Task/Bitmap-Flood-fill/FBSL/bitmap-flood-fill.fbsl @@ -15,23 +15,23 @@ FBSL.GETCLIENTRECT(ME, 0, 0, Breadth, Height) DrawCircles() ' Initialize circles BEGIN EVENTS - SELECT CASE CBMSG - CASE WM_LBUTTONDOWN: FillCircles() ' Flood fill circles - CASE WM_CLOSE: FBSL.RELEASEDC(ME, FBSL.GETDC) ' Clean up - END SELECT + SELECT CASE CBMSG + CASE WM_LBUTTONDOWN: FillCircles() ' Flood fill circles + CASE WM_CLOSE: FBSL.RELEASEDC(ME, FBSL.GETDC) ' Clean up + END SELECT END EVENTS SUB FillCircles() - FILL(FBSL.GETDC, Breadth / 2, Height / 2, &HFFFF) ' Yellow: flood fill using intrinsics - FOR DIM x = 0 TO Breadth / 2 ' Red: flood fill iteratively - FOR DIM y = 0 TO Height / 2 - IF NOT POINT(FBSL.GETDC, x, y) THEN PSET(FBSL.GETDC, x, y, &HFF) - NEXT - NEXT - FBSLSETTEXT(ME, "After Flood Fill") ' Reset form caption + FILL(FBSL.GETDC, Breadth / 2, Height / 2, &HFFFF) ' Yellow: flood fill using intrinsics + FOR DIM x = 0 TO Breadth / 2 ' Red: flood fill iteratively + FOR DIM y = 0 TO Height / 2 + IF NOT POINT(FBSL.GETDC, x, y) THEN PSET(FBSL.GETDC, x, y, &HFF) + NEXT + NEXT + FBSLSETTEXT(ME, "After Flood Fill") ' Reset form caption END SUB SUB DrawCircles() ' Concatenate function calls - CIRCLE(FBSL.GETDC, Breadth / 2, Height / 2, 85, &HFFFFFF, 0, 360, 1, TRUE) _ ' White - (FBSL.GETDC, Breadth / 3, Height / 3, 30, 0, 0, 360, 1, TRUE) ' Black + CIRCLE(FBSL.GETDC, Breadth / 2, Height / 2, 85, &HFFFFFF, 0, 360, 1, TRUE) _ ' White + (FBSL.GETDC, Breadth / 3, Height / 3, 30, 0, 0, 360, 1, TRUE) ' Black END SUB diff --git a/Task/Bitmap-Flood-fill/Julia/bitmap-flood-fill.julia b/Task/Bitmap-Flood-fill/Julia/bitmap-flood-fill.jl similarity index 100% rename from Task/Bitmap-Flood-fill/Julia/bitmap-flood-fill.julia rename to Task/Bitmap-Flood-fill/Julia/bitmap-flood-fill.jl diff --git a/Task/Bitmap-Flood-fill/Kotlin/bitmap-flood-fill.kotlin b/Task/Bitmap-Flood-fill/Kotlin/bitmap-flood-fill.kts similarity index 100% rename from Task/Bitmap-Flood-fill/Kotlin/bitmap-flood-fill.kotlin rename to Task/Bitmap-Flood-fill/Kotlin/bitmap-flood-fill.kts diff --git a/Task/Bitmap-Flood-fill/MiniScript/bitmap-flood-fill.mini b/Task/Bitmap-Flood-fill/MiniScript/bitmap-flood-fill.mini new file mode 100644 index 0000000000..e4a6dfa8d6 --- /dev/null +++ b/Task/Bitmap-Flood-fill/MiniScript/bitmap-flood-fill.mini @@ -0,0 +1,21 @@ +floodFill = function(bmp, x, y, targetColor, replacementColor) + // Check if pixel is outside the bounds + if not(0 < x < bmp.width) or not(0 < y < bmp.height) then return + + // Check the current pixel color + currentColor = bmp.pixel(x, y) + if currentColor != targetColor then return + + // Replace the color + bmp.setPixel x, y, replacementColor + // Recursively apply to adjacent pixels + floodFill(bmp, x + 1, y, targetColor, replacementColor) + floodFill(bmp, x - 1, y, targetColor, replacementColor) + floodFill(bmp, x, y + 1, targetColor, replacementColor) + floodFill(bmp, x, y - 1, targetColor, replacementColor) +end function +clear +img = file.loadImage("Unfilledcirc.png") +gfx.drawImage img, 0, 0 +floodFill gfx, 50, 50, "#FFFFFFFF", "#00FFFFFF" +floodFill gfx, 100, 125, "#000000FF", "#0000FFFF" diff --git a/Task/Bitmap-Flood-fill/OCaml/bitmap-flood-fill.ocaml b/Task/Bitmap-Flood-fill/OCaml/bitmap-flood-fill.ml similarity index 100% rename from Task/Bitmap-Flood-fill/OCaml/bitmap-flood-fill.ocaml rename to Task/Bitmap-Flood-fill/OCaml/bitmap-flood-fill.ml diff --git a/Task/Bitmap-Flood-fill/Perl/bitmap-flood-fill-2.pl b/Task/Bitmap-Flood-fill/Perl/bitmap-flood-fill-2.pl index 049af58478..dae6942463 100644 --- a/Task/Bitmap-Flood-fill/Perl/bitmap-flood-fill-2.pl +++ b/Task/Bitmap-Flood-fill/Perl/bitmap-flood-fill-2.pl @@ -23,20 +23,20 @@ sub floodfill if ( colordistance(\@tcol, \@col) > $distparameter ) { return; } push @queue, [$x, $y]; while ( @queue ) { - my $pointref = shift(@queue); - ( $x, $y ) = @$pointref; - if ( ($x < 0) || ($y < 0) || ( $x >= $img->width ) || ( $y >= $img->height ) ) { next; } - if ( ! exists($visited{"$x,$y"}) ) { - @col = $img->query_pixel($x, $y); - if ( colordistance(\@tcol, \@col) <= $distparameter ) { - $img->draw_point($x, $y); - $visited{"$x,$y"} = 1; - push @queue, [$x+1, $y]; - push @queue, [$x-1, $y]; - push @queue, [$x, $y+1]; - push @queue, [$x, $y-1]; - } - } + my $pointref = shift(@queue); + ( $x, $y ) = @$pointref; + if ( ($x < 0) || ($y < 0) || ( $x >= $img->width ) || ( $y >= $img->height ) ) { next; } + if ( ! exists($visited{"$x,$y"}) ) { + @col = $img->query_pixel($x, $y); + if ( colordistance(\@tcol, \@col) <= $distparameter ) { + $img->draw_point($x, $y); + $visited{"$x,$y"} = 1; + push @queue, [$x+1, $y]; + push @queue, [$x-1, $y]; + push @queue, [$x, $y+1]; + push @queue, [$x, $y-1]; + } + } } } diff --git a/Task/Bitmap-Flood-fill/Raku/bitmap-flood-fill.raku b/Task/Bitmap-Flood-fill/Raku/bitmap-flood-fill.raku index fa29c20997..7cafc0de1d 100644 --- a/Task/Bitmap-Flood-fill/Raku/bitmap-flood-fill.raku +++ b/Task/Bitmap-Flood-fill/Raku/bitmap-flood-fill.raku @@ -4,16 +4,16 @@ class Bitmap { has Pixel @.data; method pixel( - $i where ^$!width, - $j where ^$!height - --> Pixel + $i where ^$!width, + $j where ^$!height + --> Pixel ) is rw { @!data[$i + $j * $!width] } } role PPM { method P6 returns Blob { - "P6\n{self.width} {self.height}\n255\n".encode('ascii') - ~ Blob.new: flat map { .R, .G, .B }, self.data + "P6\n{self.width} {self.height}\n255\n".encode('ascii') + ~ Blob.new: flat map { .R, .G, .B }, self.data } } diff --git a/Task/Bitmap-Flood-fill/Rebol/bitmap-flood-fill.rebol b/Task/Bitmap-Flood-fill/Rebol/bitmap-flood-fill.rebol new file mode 100644 index 0000000000..f5deeabdf5 --- /dev/null +++ b/Task/Bitmap-Flood-fill/Rebol/bitmap-flood-fill.rebol @@ -0,0 +1,64 @@ +Rebol [ + title: "Rosetta code: Bitmap/Flood fill" + file: %Bitmap-Flood_fill.r3 + url: https://rosettacode.org/wiki/Bitmap/Bitmap-Flood_fill +] + +flood-fill: function [ + image [image! file! url!] + position [pair!] "Start position" + color1 [tuple!] "Target color to replace" + color2 [tuple!] "Replacement color" +][ + unless image? image [image: load image] ;; Load image if not already loaded + xsize: image/size/x + ysize: image/size/y + + color2/4: color1/4: 255 ;; Ensure both colors are fully opaque + + que: copy [] + if image/:position != color1 [return image] ;; Bail if seed pixel isn't target color + + append que position + while [not empty? que][ + position: take que ;; Dequeue next position to process + if image/:position == color1 [ ;; Skip if already recolored + W: position + ;; Scan west, recoloring pixels until we leave the target-color region + while [image/:W == color1][ + image/:W: color2 + next: W + 0x1 ;; Pixel south of W + if all [next/y < ysize color1 == image/:next][append que next] + next: W - 0x1 ;; Pixel north of W + if all [next/y > 0 color1 == image/:next][append que next] + next: W - 1x0 ;; Step west + either next/x > 1 [W: next][break] ;; Stop at left edge + ] + E: position + 1x0 ;; Start east scan one step right of seed + if E/x < xsize [ + ;; Scan east, recoloring pixels until we leave the target-color region + while [image/:E == color1][ + image/:E: color2 + next: E + 0x1 ;; Pixel south of E + if all [next/y < ysize color1 == image/:next][append que next] + next: E - 0x1 ;; Pixel north of E + if all [next/y > 0 color1 == image/:next][append que next] + next: E + 1x0 ;; Step east + either next/x < xsize [E: next][break] ;; Stop at right edge + ] + ] + ] + ] + image ;; Return the modified image +] + +;; Download the test image if not already cached locally +unless exists? file: %Unfilledcirc.png [ + write file read https://static.wikitide.net/rosettacodewiki/0/0f/Unfilledcirc.png +] + +img: load %Unfilledcirc.png +img: flood-fill img 200x200 white red +img: flood-fill img 100x100 black blue + +browse save %Filledcirc.png img ;; Save result and open in browser diff --git a/Task/Bitmap-Flood-fill/Rust/bitmap-flood-fill.rust b/Task/Bitmap-Flood-fill/Rust/bitmap-flood-fill.rs similarity index 100% rename from Task/Bitmap-Flood-fill/Rust/bitmap-flood-fill.rust rename to Task/Bitmap-Flood-fill/Rust/bitmap-flood-fill.rs diff --git a/Task/Bitmap-Flood-fill/Uiua/bitmap-flood-fill.uiua b/Task/Bitmap-Flood-fill/Uiua/bitmap-flood-fill.uiua new file mode 100644 index 0000000000..0808eee12c --- /dev/null +++ b/Task/Bitmap-Flood-fill/Uiua/bitmap-flood-fill.uiua @@ -0,0 +1,12 @@ +# Drop a png onto this pane, then Run. +&p$"Found a _" °img&frab "image.png" +≡≡⊢ # Convert to greyscale. +Sensitivity ← 0.3 # Lower is finer. +N₄ ← [1_0 0_1 ¯ 1_0 0_¯1] +[40_40]⊙0.8 # Starting point, fill colour. +Good ← >Sensitivity⌵-⬚0.5⊡⊢ # Needs filling. Simple edges-check. +# Take first of list. If needs fill, do so and then add +# its four neighbours into queue. Repeat until queue is empty. +⍢(⨬(↘1|◴⊂+N₄¤°⊂ ⊃(⋅∘|∘|⋅⋅⋅∘)◡(⍜(⊡|⋅∘)⊢))◡Good +| >0⧻) +⋅⊙⋅ diff --git a/Task/Bitmap-Flood-fill/Zkl/bitmap-flood-fill-1.zkl b/Task/Bitmap-Flood-fill/Zkl/bitmap-flood-fill-1.zkl index ccd3c7df5a..24f859e0a8 100644 --- a/Task/Bitmap-Flood-fill/Zkl/bitmap-flood-fill-1.zkl +++ b/Task/Bitmap-Flood-fill/Zkl/bitmap-flood-fill-1.zkl @@ -4,11 +4,11 @@ fcn flood(pixmap, x,y, repl){ // slow! while(stack){ x,y:=stack.pop(); if((0<=y hist(j) Then + Swap hist(i), hist(j) + Swap idx(i), idx(j) + End If + Next +Next + +' Encontrar la mediana +total = 0 +For i = 0 To 255 + total += hist(i) +Next + +half = 0 +For i = 0 To 255 + half += hist(i) + If half >= total \ 2 Then + median = idx(i) + Exit For + End If +Next + +'Windowtitle("Histogram") +Windowtitle "Original vs Black and White" + +' Mostrar versión en blanco y negro en la mitad derecha +For y = 0 To alto - 1 + For x = 0 To ancho - 1 + l = Point(x, y) And &HFF + If l > median Then + Pset (x + ancho, y), Rgb(255, 255, 255) + Else + Pset (x + ancho, y), Rgb(0, 0, 0) + End If + Next +Next + +' Guardar la imagen resultante (ambas imágenes juntas) +Bsave "Lena_Original_and_BW.bmp", 0 + +Sleep diff --git a/Task/Bitmap-Histogram/Julia/bitmap-histogram.julia b/Task/Bitmap-Histogram/Julia/bitmap-histogram.jl similarity index 100% rename from Task/Bitmap-Histogram/Julia/bitmap-histogram.julia rename to Task/Bitmap-Histogram/Julia/bitmap-histogram.jl diff --git a/Task/Bitmap-Histogram/Kotlin/bitmap-histogram.kotlin b/Task/Bitmap-Histogram/Kotlin/bitmap-histogram.kts similarity index 100% rename from Task/Bitmap-Histogram/Kotlin/bitmap-histogram.kotlin rename to Task/Bitmap-Histogram/Kotlin/bitmap-histogram.kts diff --git a/Task/Bitmap-Histogram/OCaml/bitmap-histogram-1.ocaml b/Task/Bitmap-Histogram/OCaml/bitmap-histogram-1.ml similarity index 100% rename from Task/Bitmap-Histogram/OCaml/bitmap-histogram-1.ocaml rename to Task/Bitmap-Histogram/OCaml/bitmap-histogram-1.ml diff --git a/Task/Bitmap-Histogram/OCaml/bitmap-histogram-2.ocaml b/Task/Bitmap-Histogram/OCaml/bitmap-histogram-2.ml similarity index 100% rename from Task/Bitmap-Histogram/OCaml/bitmap-histogram-2.ocaml rename to Task/Bitmap-Histogram/OCaml/bitmap-histogram-2.ml diff --git a/Task/Bitmap-Histogram/OCaml/bitmap-histogram-3.ocaml b/Task/Bitmap-Histogram/OCaml/bitmap-histogram-3.ml similarity index 100% rename from Task/Bitmap-Histogram/OCaml/bitmap-histogram-3.ocaml rename to Task/Bitmap-Histogram/OCaml/bitmap-histogram-3.ml diff --git a/Task/Bitmap-Histogram/PHP/bitmap-histogram.php b/Task/Bitmap-Histogram/PHP/bitmap-histogram.php index 631623d041..f2e10b03ca 100644 --- a/Task/Bitmap-Histogram/PHP/bitmap-histogram.php +++ b/Task/Bitmap-Histogram/PHP/bitmap-histogram.php @@ -1,11 +1,11 @@ -define('src_name', 'input.jpg'); // source image -define('dest_name', 'output.jpg'); // destination image +define('src_name', 'input.jpg'); // source image +define('dest_name', 'output.jpg'); // destination image -$img = imagecreatefromjpeg(src_name); // read image +$img = imagecreatefromjpeg(src_name); // read image if(empty($img)){ - echo 'Image could not be loaded!'; - exit; + echo 'Image could not be loaded!'; + exit; } $black = imagecolorallocate($img, 0, 0, 0); @@ -13,42 +13,42 @@ $white = imagecolorallocate($img, 255, 255, 255); $width = imagesx($img); $height = imagesy($img); -$array_lum = array(); // for storage of luminosity of each pixel -$sum_lum = 0; // total sum of luminosity -$average_lum = 0; // average luminosity of whole image +$array_lum = array(); // for storage of luminosity of each pixel +$sum_lum = 0; // total sum of luminosity +$average_lum = 0; // average luminosity of whole image -for($x = 0; $x < $width; $x++){ - for($y = 0; $y < $height; $y++){ - // read pixel value - $color = imagecolorat($img, $x, $y); - $r = ($color >> 16) & 0xFF; - $g = ($color >> 8) & 0xFF; - $b = $color & 0xFF; - // save pixel luminosity in temporary array - $array_lum[$x][$y] = ($r + $g + $b); - // add pixel luminosity to sum - $sum_lum += $array_lum[$x][$y]; - } +for($x = 0; $x < $width; $x++){ + for($y = 0; $y < $height; $y++){ + // read pixel value + $color = imagecolorat($img, $x, $y); + $r = ($color >> 16) & 0xFF; + $g = ($color >> 8) & 0xFF; + $b = $color & 0xFF; + // save pixel luminosity in temporary array + $array_lum[$x][$y] = ($r + $g + $b); + // add pixel luminosity to sum + $sum_lum += $array_lum[$x][$y]; + } } // calculate average luminosity $average_lum = $sum_lum / ($width * $height); -for($x = 0; $x < $width; $x++){ - for($y = 0; $y < $height; $y++){ - // pixel is brighter than average -> set white - // else -> set black - if($array_lum[$x][$y] > $average_lum){ - imagesetpixel($img, $x, $y, $white); - } - else{ - imagesetpixel($img, $x, $y, $black); - } - } +for($x = 0; $x < $width; $x++){ + for($y = 0; $y < $height; $y++){ + // pixel is brighter than average -> set white + // else -> set black + if($array_lum[$x][$y] > $average_lum){ + imagesetpixel($img, $x, $y, $white); + } + else{ + imagesetpixel($img, $x, $y, $black); + } + } } // save black and white image to dest_name imagejpeg($img, dest_name); if(!file_exists(dest_name)){ - echo 'Image not saved! Check permission!'; + echo 'Image not saved! Check permission!'; } diff --git a/Task/Bitmap-Histogram/Raku/bitmap-histogram.raku b/Task/Bitmap-Histogram/Raku/bitmap-histogram.raku index fa9a0b9efc..e94fea18fb 100644 --- a/Task/Bitmap-Histogram/Raku/bitmap-histogram.raku +++ b/Task/Bitmap-Histogram/Raku/bitmap-histogram.raku @@ -7,8 +7,8 @@ class Bitmap { role PBM { has @.BM; method P4 returns Blob { - "P4\n{self.width} {self.height}\n".encode('ascii') - ~ Blob.new: self.BM + "P4\n{self.width} {self.height}\n".encode('ascii') + ~ Blob.new: self.BM } } diff --git a/Task/Bitmap-Histogram/Rebol/bitmap-histogram-1.rebol b/Task/Bitmap-Histogram/Rebol/bitmap-histogram-1.rebol new file mode 100644 index 0000000000..94755e279b --- /dev/null +++ b/Task/Bitmap-Histogram/Rebol/bitmap-histogram-1.rebol @@ -0,0 +1,27 @@ +Rebol [ + title: "Rosetta code: Bitmap/Histogram" + file: %Bitmap-Histogram.r3 + url: https://rosettacode.org/wiki/Bitmap/Bitmap-Histogram + needs: 3.21.9 +] + +;; Load source image from file +img: load %Lenna50.jpg +;; Extract luminosity as vector for statistical operations +vec: to vector! img/luminosity +;; Compute median brightness threshold +med: vec/median +;; Allocate 256-bucket uint32 histogram (one bucket per brightness level) +histogram: make vector! [uint32! 255] +;; In a single pass: build brightness histogram and threshold each pixel +forall vec [ + val: vec/1 + histogram/:val: histogram/:val + 1 ;; tally pixel's brightness bucket + vec/1: either val < med [0][255] ;; binarize: black or white +] +;; Inspect histogram distribution +? histogram +;; Write thresholded grayscale data back to image +img/gray: vec +;; Save result as PNG and open in browser +browse save %Lenna50-bw.png img diff --git a/Task/Bitmap-Histogram/Rebol/bitmap-histogram-2.rebol b/Task/Bitmap-Histogram/Rebol/bitmap-histogram-2.rebol new file mode 100644 index 0000000000..2586976144 --- /dev/null +++ b/Task/Bitmap-Histogram/Rebol/bitmap-histogram-2.rebol @@ -0,0 +1,8 @@ +img: load %Lenna50.jpg +foreach channel [red green blue] [ + vec: to vector! img/:channel + med: vec/median + forall vec [vec/1: either vec/1 < med [0][255]] + img/:channel: vec +] +browse save %Lenna50-rgb.png img diff --git a/Task/Bitmap-Histogram/Rust/bitmap-histogram.rust b/Task/Bitmap-Histogram/Rust/bitmap-histogram.rs similarity index 100% rename from Task/Bitmap-Histogram/Rust/bitmap-histogram.rust rename to Task/Bitmap-Histogram/Rust/bitmap-histogram.rs diff --git a/Task/Bitmap-Histogram/Scala/bitmap-histogram-1.scala b/Task/Bitmap-Histogram/Scala/bitmap-histogram-1.scala index 4646774d80..2d5144c867 100644 --- a/Task/Bitmap-Histogram/Scala/bitmap-histogram-1.scala +++ b/Task/Bitmap-Histogram/Scala/bitmap-histogram-1.scala @@ -27,6 +27,6 @@ object BitmapOps { val c2=Color.WHITE for(x <- 0 until bm.width; y <- 0 until bm.height; l=luminosity(bm.getPixel(x,y))) image.setPixel(x, y, if(l>threshold) c2 else c1) - image + image } } diff --git a/Task/Bitmap-Histogram/Vedit-macro-language/bitmap-histogram.vedit b/Task/Bitmap-Histogram/Vedit-macro-language/bitmap-histogram.vedit index df0380645d..8018fff516 100644 --- a/Task/Bitmap-Histogram/Vedit-macro-language/bitmap-histogram.vedit +++ b/Task/Bitmap-Histogram/Vedit-macro-language/bitmap-histogram.vedit @@ -1,10 +1,10 @@ :HISTOGRAM: -#30 = Buf_Free // #30 = buffer to store histogram data +#30 = Buf_Free // #30 = buffer to store histogram data for (#9=0; #9<256; #9++) { - Out_Reg(21) TC(#9) Out_Reg(Clear) // @21 = intensity value to be counted - Buf_Switch(#15) // switch to image buffer - #8 = Search(@21, CASE+BEGIN+ALL+NOERR) // count intensity values - Buf_Switch(#30) // switch to histogram buffer - Num_Ins(#8, FILL) // store count + Out_Reg(21) TC(#9) Out_Reg(Clear) // @21 = intensity value to be counted + Buf_Switch(#15) // switch to image buffer + #8 = Search(@21, CASE+BEGIN+ALL+NOERR) // count intensity values + Buf_Switch(#30) // switch to histogram buffer + Num_Ins(#8, FILL) // store count } Return diff --git a/Task/Bitmap-Histogram/Wren/bitmap-histogram.wren b/Task/Bitmap-Histogram/Wren/bitmap-histogram.wren index a761b397f3..17a91f84af 100644 --- a/Task/Bitmap-Histogram/Wren/bitmap-histogram.wren +++ b/Task/Bitmap-Histogram/Wren/bitmap-histogram.wren @@ -3,7 +3,7 @@ import "graphics" for Canvas, Color, ImageData class ImageHistogram { construct new(filename, filename2) { - _image = ImageData.loadFromFile(filename) + _image = ImageData.load(filename) Window.resize(_image.width, _image.height) Canvas.resize(_image.width, _image.height) Window.title = filename2 diff --git a/Task/Bitmap-Histogram/Zkl/bitmap-histogram-1.zkl b/Task/Bitmap-Histogram/Zkl/bitmap-histogram-1.zkl index 5d99339833..69d94f35f3 100644 --- a/Task/Bitmap-Histogram/Zkl/bitmap-histogram-1.zkl +++ b/Task/Bitmap-Histogram/Zkl/bitmap-histogram-1.zkl @@ -1,5 +1,5 @@ fcn histogram(image){ - hist:=List.createLong(256,0); // array[256] of zero + hist:=List.createLong(256,0); // array[256] of zero image.data.howza(0).pump(Void,'wrap(c){ hist[c]+=1 }); // byte by byte loop hist; } @@ -8,7 +8,7 @@ fcn histogramMedian(hist){ left,right:=hist[from],hist[to]; while(from!=to){ if(left=y - plot( x + x0, y + y0) - plot( y + x0, x + y0) - plot(-x + x0, y + y0) - plot(-y + x0, x + y0) - plot(-x + x0, -y + y0) - plot(-y + x0, -x + y0) - plot( x + x0, -y + y0) - plot( y + x0, -x + y0) + while x>=y + plot( x + x0, y + y0) + plot( y + x0, x + y0) + plot(-x + x0, y + y0) + plot(-y + x0, x + y0) + plot(-x + x0, -y + y0) + plot(-y + x0, -x + y0) + plot( x + x0, -y + y0) + plot( y + x0, -x + y0) - y++ + y++ - if decisionOver2<=0 then - decisionOver2+=2*y+1 - else - x-- - decisionOver2+=2*(y-x)+1 - end if - end while - return 0 + if decisionOver2<=0 then + decisionOver2+=2*y+1 + else + x-- + decisionOver2+=2*(y-x)+1 + end if + end while + return 0 End Function diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Batch-File/bitmap-midpoint-circle-algorithm.bat b/Task/Bitmap-Midpoint-circle-algorithm/Batch-File/bitmap-midpoint-circle-algorithm.bat index 45665a2733..ba0ddcb5fe 100644 --- a/Task/Bitmap-Midpoint-circle-algorithm/Batch-File/bitmap-midpoint-circle-algorithm.bat +++ b/Task/Bitmap-Midpoint-circle-algorithm/Batch-File/bitmap-midpoint-circle-algorithm.bat @@ -1,7 +1,7 @@ @echo off setlocal enabledelayedexpansion - %== Initializations ==% + %== Initializations ==% set width=50 set height=30 @@ -11,62 +11,62 @@ echo Rendering... set "outp=" for /l %%i in (1,1,%height%) do ( - for /l %%j in (1,1,%width%) do ( - set "c[%%i][%%j]= " - ) + for /l %%j in (1,1,%width%) do ( + set "c[%%i][%%j]= " + ) ) - %== Set the parameters for making circle ==% + %== Set the parameters for making circle ==% call :DrawCircle 20 20 10 call :DrawCircle 10 30 15 - %== Output result ==% + %== Output result ==% for /l %%i in (1,1,%height%) do ( - for /l %%j in (1,1,%width%) do ( - set "outp=!outp!!c[%%i][%%j]!" - ) + for /l %%j in (1,1,%width%) do ( + set "outp=!outp!!c[%%i][%%j]!" + ) ) cls echo !outp! pause>nul exit /b - %== The main function ==% + %== The main function ==% :DrawCircle - set x0=%1 - set y0=%2 - set radius=%3 + set x0=%1 + set y0=%2 + set radius=%3 - set x=!radius! - set y=0 - set /a decisionOver2 = 1 - !x! + set x=!radius! + set y=0 + set /a decisionOver2 = 1 - !x! - :circle_loop - if !x! geq !y! ( - set /a "hor=x + x0","ver=y + y0" - set "c[!hor!][!ver!]=Û" - set /a "hor=y + x0","ver=x + y0" - set "c[!hor!][!ver!]=Û" - set /a "hor=-x + x0","ver=y + y0" - set "c[!hor!][!ver!]=Û" - set /a "hor=-y + x0","ver=x + y0" - set "c[!hor!][!ver!]=Û" - set /a "hor=-x + x0","ver=-y + y0" - set "c[!hor!][!ver!]=Û" - set /a "hor=-y + x0","ver=-x + y0" - set "c[!hor!][!ver!]=Û" - set /a "hor=x + x0","ver=-y + y0" - set "c[!hor!][!ver!]=Û" - set /a "hor=y + x0","ver=-x + y0" - set "c[!hor!][!ver!]=Û" + :circle_loop + if !x! geq !y! ( + set /a "hor=x + x0","ver=y + y0" + set "c[!hor!][!ver!]=Û" + set /a "hor=y + x0","ver=x + y0" + set "c[!hor!][!ver!]=Û" + set /a "hor=-x + x0","ver=y + y0" + set "c[!hor!][!ver!]=Û" + set /a "hor=-y + x0","ver=x + y0" + set "c[!hor!][!ver!]=Û" + set /a "hor=-x + x0","ver=-y + y0" + set "c[!hor!][!ver!]=Û" + set /a "hor=-y + x0","ver=-x + y0" + set "c[!hor!][!ver!]=Û" + set /a "hor=x + x0","ver=-y + y0" + set "c[!hor!][!ver!]=Û" + set /a "hor=y + x0","ver=-x + y0" + set "c[!hor!][!ver!]=Û" - set /a y+=1 - if !decisionOver2! leq 0 ( - set /a "decisionOver2 = !decisionOver2! + (2 * y^) + 1" - ) else ( - set /a x-=1 - set /a "decisionOver2 = !decisionOver2! + 2 * (y - x^) + 1" - ) - goto circle_loop - ) + set /a y+=1 + if !decisionOver2! leq 0 ( + set /a "decisionOver2 = !decisionOver2! + (2 * y^) + 1" + ) else ( + set /a x-=1 + set /a "decisionOver2 = !decisionOver2! + 2 * (y - x^) + 1" + ) + goto circle_loop + ) goto :EOF diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Crystal/bitmap-midpoint-circle-algorithm-1.cr b/Task/Bitmap-Midpoint-circle-algorithm/Crystal/bitmap-midpoint-circle-algorithm-1.cr new file mode 100644 index 0000000000..662403d75a --- /dev/null +++ b/Task/Bitmap-Midpoint-circle-algorithm/Crystal/bitmap-midpoint-circle-algorithm-1.cr @@ -0,0 +1,40 @@ +require "./pixmap" +require "./bresenham" + +class Pixmap + def circle (cx, cy, r, color, fill = false) + f = 1 - r + ddF_X = 0 + ddF_Y = -2 * r + x = 0 + y = r + self[cx, cy + r] = color + self[cx, cy - r] = color + p1, p2 = {cx + r, cy}, {cx - r, cy} + if fill + line(*p1, *p2, color) + else + self[*p1] = self[*p2] = color + end + while x < y + if f >= 0 + y -= 1 + ddF_Y += 2 + f += ddF_Y + end + x += 1 + ddF_X += 2 + f += ddF_X + 1 + [{cx - x, cy - y}, {cx + x, cy - y}, + {cx - x, cy + y}, {cx + x, cy + y}, + {cx - y, cy - x}, {cx + y, cy - x}, + {cx - y, cy + x}, {cx + y, cy + x}].each_slice(2, reuse: true) do |(p1, p2)| + if fill + line(*p1, *p2, color) + else + self[*p1] = self[*p2] = color + end + end + end + end +end diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Crystal/bitmap-midpoint-circle-algorithm-2.cr b/Task/Bitmap-Midpoint-circle-algorithm/Crystal/bitmap-midpoint-circle-algorithm-2.cr new file mode 100644 index 0000000000..821729bbd3 --- /dev/null +++ b/Task/Bitmap-Midpoint-circle-algorithm/Crystal/bitmap-midpoint-circle-algorithm-2.cr @@ -0,0 +1,12 @@ +require "./circle" +require "./write_ppm" + +img = Pixmap.new 100, 100, Color::WHITE + +img.circle 50, 50, 40, Color::RED, true +img.circle 70, 60, 15, Color::BLUE, true +img.circle 40, 20, 20, Color::BLACK +img.circle 40, 20, 19, Color.new(255, 144, 0) +img.circle 40, 20, 18, Color::BLACK + +img.write "crystal_circles.ppm" diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Delphi/bitmap-midpoint-circle-algorithm.delphi b/Task/Bitmap-Midpoint-circle-algorithm/Delphi/bitmap-midpoint-circle-algorithm.delphi deleted file mode 100644 index a27d5aad00..0000000000 --- a/Task/Bitmap-Midpoint-circle-algorithm/Delphi/bitmap-midpoint-circle-algorithm.delphi +++ /dev/null @@ -1,50 +0,0 @@ -procedure DrawCircle(Image: TImage; Radius: integer; Center: TPoint); -var T1,T2: integer; -var X,Y: integer; -var Cnt: integer; - - procedure DrawPixels(X,Y: integer); - {Draw pixel into all 8 octents} - begin - Image.Canvas.Pixels[Center.X + x, Center.Y + y]:=clRed; - Image.Canvas.Pixels[Center.X - X, Center.Y + Y]:=clRed; - Image.Canvas.Pixels[Center.X + X, Center.Y - Y]:=clRed; - Image.Canvas.Pixels[Center.X - X, Center.Y - Y]:=clRed; - Image.Canvas.Pixels[Center.X + Y, Center.Y + X]:=clRed; - Image.Canvas.Pixels[Center.X - Y, Center.Y + X]:=clRed; - Image.Canvas.Pixels[Center.X + y, Center.Y - X]:=clRed; - Image.Canvas.Pixels[Center.X - Y, Center.Y - X]:=clRed; - end; - -begin -Cnt:=0; -T1:= Radius div 32; -{Start on X-axis} -X:= Radius; Y:= 0; -repeat - begin - DrawPixels(X, Y); - Y:=Y + 1; - T1:=T1 + Y; - T2:=T1 - X; - if T2 >= 0 then - begin - T1:=T2; - X:=X - 1; - end; - Inc(Cnt); - end -until x < y; -Form1.Caption:=IntToStr(Cnt); -end; - - - -procedure ShowBrezCircle(Image: TImage); -begin -{Draw three times to make line thicker} -DrawCircle(Image,100,Point(200,200)); -DrawCircle(Image,99,Point(200,200)); -DrawCircle(Image,98,Point(200,200)); -Image.Invalidate; -end; diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Delphi/bitmap-midpoint-circle-algorithm.pas b/Task/Bitmap-Midpoint-circle-algorithm/Delphi/bitmap-midpoint-circle-algorithm.pas new file mode 100644 index 0000000000..70e6487fce --- /dev/null +++ b/Task/Bitmap-Midpoint-circle-algorithm/Delphi/bitmap-midpoint-circle-algorithm.pas @@ -0,0 +1,50 @@ +procedure DrawCircle(Image: TImage; Radius: integer; Center: TPoint); +var T1,T2: integer; +var X,Y: integer; +var Cnt: integer; + + procedure DrawPixels(X,Y: integer); + {Draw pixel into all 8 octents} + begin + Image.Canvas.Pixels[Center.X + x, Center.Y + y]:=clRed; + Image.Canvas.Pixels[Center.X - X, Center.Y + Y]:=clRed; + Image.Canvas.Pixels[Center.X + X, Center.Y - Y]:=clRed; + Image.Canvas.Pixels[Center.X - X, Center.Y - Y]:=clRed; + Image.Canvas.Pixels[Center.X + Y, Center.Y + X]:=clRed; + Image.Canvas.Pixels[Center.X - Y, Center.Y + X]:=clRed; + Image.Canvas.Pixels[Center.X + y, Center.Y - X]:=clRed; + Image.Canvas.Pixels[Center.X - Y, Center.Y - X]:=clRed; + end; + +begin +Cnt:=0; +T1:= Radius div 32; +{Start on X-axis} +X:= Radius; Y:= 0; +repeat + begin + DrawPixels(X, Y); + Y:=Y + 1; + T1:=T1 + Y; + T2:=T1 - X; + if T2 >= 0 then + begin + T1:=T2; + X:=X - 1; + end; + Inc(Cnt); + end +until x < y; +Form1.Caption:=IntToStr(Cnt); +end; + + + +procedure ShowBrezCircle(Image: TImage); +begin +{Draw three times to make line thicker} +DrawCircle(Image,100,Point(200,200)); +DrawCircle(Image,99,Point(200,200)); +DrawCircle(Image,98,Point(200,200)); +Image.Invalidate; +end; diff --git a/Task/Bitmap-Midpoint-circle-algorithm/EasyLang/bitmap-midpoint-circle-algorithm.easy b/Task/Bitmap-Midpoint-circle-algorithm/EasyLang/bitmap-midpoint-circle-algorithm.easy new file mode 100644 index 0000000000..2e0418ae0b --- /dev/null +++ b/Task/Bitmap-Midpoint-circle-algorithm/EasyLang/bitmap-midpoint-circle-algorithm.easy @@ -0,0 +1,27 @@ +proc pix x y . + grect x / 5 y / 5 0.25 0.25 +. +proc circ x0 y0 r . + t1 = r div 16 + x = r + while x >= y + pix x0 - x, y0 + y + pix x0 - x, y0 - y + pix x0 - y, y0 + x + pix x0 - y, y0 - x + pix x0 + x, y0 + y + pix x0 + x, y0 - y + pix x0 + y, y0 + x + pix x0 + y, y0 - x + y += 1 + t1 += y + t2 = t1 - x + if t2 >= 0 + t1 = t2 + x -= 1 + . + . +. +for r = 20 step 20 to 240 + circ 250 250 r +. diff --git a/Task/Bitmap-Midpoint-circle-algorithm/FBSL/bitmap-midpoint-circle-algorithm.fbsl b/Task/Bitmap-Midpoint-circle-algorithm/FBSL/bitmap-midpoint-circle-algorithm.fbsl index 4ab0e557c9..c26d8ea33c 100644 --- a/Task/Bitmap-Midpoint-circle-algorithm/FBSL/bitmap-midpoint-circle-algorithm.fbsl +++ b/Task/Bitmap-Midpoint-circle-algorithm/FBSL/bitmap-midpoint-circle-algorithm.fbsl @@ -13,29 +13,29 @@ DIM Breadth AS INTEGER, Height AS INTEGER FBSL.GETCLIENTRECT(ME, 0, 0, Breadth, Height) BEGIN EVENTS ' Main message loop - SELECT CASE CBMSG - CASE WM_LBUTTONDOWN: MidpointCircle() ' Draw - CASE WM_CLOSE: FBSL.RELEASEDC(ME, FBSL.GETDC) ' Clean up - END SELECT + SELECT CASE CBMSG + CASE WM_LBUTTONDOWN: MidpointCircle() ' Draw + CASE WM_CLOSE: FBSL.RELEASEDC(ME, FBSL.GETDC) ' Clean up + END SELECT END EVENTS SUB MidpointCircle() - BresenhamCircle(Breadth \ 2, Height \ 2, 80, &HFF) ' Red: Windows stores colors in BGR order - BresenhamCircle(Breadth \ 2, Height \ 2, 40, 0) ' Black - - SUB BresenhamCircle(cx, cy, radius, colour) - DIM x = 0, y = radius, f = 1 - radius, dx = 0, dy = -2 * radius - - PSET(FBSL.GETDC, cx, cy + radius, colour)(FBSL.GETDC, cx, cy - radius, colour) - PSET(FBSL.GETDC, cx + radius, cy, colour)(FBSL.GETDC, cx - radius, cy, colour) - - WHILE x < y - IF f >= 0 THEN: DECR(y): INCR(dy, 2)(f, dy): END IF ' Try also "IF f THEN" :) - INCR(x)(dx, 2)(f, dx + 1) - PSET(FBSL.GETDC, cx + x, cy + y, colour)(FBSL.GETDC, cx - x, cy + y, colour) - PSET(FBSL.GETDC, cx + x, cy - y, colour)(FBSL.GETDC, cx - x, cy - y, colour) - PSET(FBSL.GETDC, cx + y, cy + x, colour)(FBSL.GETDC, cx - y, cy + x, colour) - PSET(FBSL.GETDC, cx + y, cy - x, colour)(FBSL.GETDC, cx - y, cy - x, colour) - WEND - END SUB + BresenhamCircle(Breadth \ 2, Height \ 2, 80, &HFF) ' Red: Windows stores colors in BGR order + BresenhamCircle(Breadth \ 2, Height \ 2, 40, 0) ' Black + + SUB BresenhamCircle(cx, cy, radius, colour) + DIM x = 0, y = radius, f = 1 - radius, dx = 0, dy = -2 * radius + + PSET(FBSL.GETDC, cx, cy + radius, colour)(FBSL.GETDC, cx, cy - radius, colour) + PSET(FBSL.GETDC, cx + radius, cy, colour)(FBSL.GETDC, cx - radius, cy, colour) + + WHILE x < y + IF f >= 0 THEN: DECR(y): INCR(dy, 2)(f, dy): END IF ' Try also "IF f THEN" :) + INCR(x)(dx, 2)(f, dx + 1) + PSET(FBSL.GETDC, cx + x, cy + y, colour)(FBSL.GETDC, cx - x, cy + y, colour) + PSET(FBSL.GETDC, cx + x, cy - y, colour)(FBSL.GETDC, cx - x, cy - y, colour) + PSET(FBSL.GETDC, cx + y, cy + x, colour)(FBSL.GETDC, cx - y, cy + x, colour) + PSET(FBSL.GETDC, cx + y, cy - x, colour)(FBSL.GETDC, cx - y, cy - x, colour) + WEND + END SUB END SUB diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Java/bitmap-midpoint-circle-algorithm.java b/Task/Bitmap-Midpoint-circle-algorithm/Java/bitmap-midpoint-circle-algorithm.java index 9019b3a968..67697a0840 100644 --- a/Task/Bitmap-Midpoint-circle-algorithm/Java/bitmap-midpoint-circle-algorithm.java +++ b/Task/Bitmap-Midpoint-circle-algorithm/Java/bitmap-midpoint-circle-algorithm.java @@ -1,35 +1,35 @@ import java.awt.Color; public class MidPointCircle { - private BasicBitmapStorage image; + private BasicBitmapStorage image; - public MidPointCircle(final int imageWidth, final int imageHeight) { - this.image = new BasicBitmapStorage(imageWidth, imageHeight); - } + public MidPointCircle(final int imageWidth, final int imageHeight) { + this.image = new BasicBitmapStorage(imageWidth, imageHeight); + } - private void drawCircle(final int centerX, final int centerY, final int radius) { - int d = (5 - radius * 4)/4; - int x = 0; - int y = radius; - Color circleColor = Color.white; + private void drawCircle(final int centerX, final int centerY, final int radius) { + int d = (5 - radius * 4)/4; + int x = 0; + int y = radius; + Color circleColor = Color.white; - do { - image.setPixel(centerX + x, centerY + y, circleColor); - image.setPixel(centerX + x, centerY - y, circleColor); - image.setPixel(centerX - x, centerY + y, circleColor); - image.setPixel(centerX - x, centerY - y, circleColor); - image.setPixel(centerX + y, centerY + x, circleColor); - image.setPixel(centerX + y, centerY - x, circleColor); - image.setPixel(centerX - y, centerY + x, circleColor); - image.setPixel(centerX - y, centerY - x, circleColor); - if (d < 0) { - d += 2 * x + 1; - } else { - d += 2 * (x - y) + 1; - y--; - } - x++; - } while (x <= y); + do { + image.setPixel(centerX + x, centerY + y, circleColor); + image.setPixel(centerX + x, centerY - y, circleColor); + image.setPixel(centerX - x, centerY + y, circleColor); + image.setPixel(centerX - x, centerY - y, circleColor); + image.setPixel(centerX + y, centerY + x, circleColor); + image.setPixel(centerX + y, centerY - x, circleColor); + image.setPixel(centerX - y, centerY + x, circleColor); + image.setPixel(centerX - y, centerY - x, circleColor); + if (d < 0) { + d += 2 * x + 1; + } else { + d += 2 * (x - y) + 1; + y--; + } + x++; + } while (x <= y); - } + } } diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Julia/bitmap-midpoint-circle-algorithm.jl b/Task/Bitmap-Midpoint-circle-algorithm/Julia/bitmap-midpoint-circle-algorithm.jl new file mode 100644 index 0000000000..1295233abb --- /dev/null +++ b/Task/Bitmap-Midpoint-circle-algorithm/Julia/bitmap-midpoint-circle-algorithm.jl @@ -0,0 +1,31 @@ +using Images, ImageView + +function drawcircle!(img::Matrix{T}, col::T, x0::Int, y0::Int, radius::Int) where T + x = radius - 1 + y = 0 + δx = δy = 1 + er = δx - (radius << 1) + + s = x + y + while x ≥ y + for opx in (+, -), opy in (+, -), el in (x, y) + @inbounds img[opx(x0, el) + 1, opy(y0, s - el) + 1] = col + end + if er ≤ 0 + y += 1 + er += δy + δy += 2 + end + if er > 0 + x -= 1 + δx += 2 + er += (-radius << 1) + δx + end + s = x + y + end + return img +end + +img = fill(Gray(255.0), 25, 25); +drawcircle!(img, Gray(0.0), 12, 12, 12) +imshow(img) diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Julia/bitmap-midpoint-circle-algorithm.julia b/Task/Bitmap-Midpoint-circle-algorithm/Julia/bitmap-midpoint-circle-algorithm.julia deleted file mode 100644 index 5b1e33d063..0000000000 --- a/Task/Bitmap-Midpoint-circle-algorithm/Julia/bitmap-midpoint-circle-algorithm.julia +++ /dev/null @@ -1,31 +0,0 @@ -function drawcircle!(img::Matrix{T}, col::T, x0::Int, y0::Int, radius::Int) where T - x = radius - 1 - y = 0 - δx = δy = 1 - er = δx - (radius << 1) - - s = x + y - while x ≥ y - for opx in (+, -), opy in (+, -), el in (x, y) - @inbounds img[opx(x0, el) + 1, opy(y0, s - el) + 1] = col - end - if er ≤ 0 - y += 1 - er += δy - δy += 2 - end - if er > 0 - x -= 1 - δx += 2 - er += (-radius << 1) + δx - end - s = x + y - end - return img -end - -# Test -using Images - -img = fill(Gray(255.0), 25, 25); -drawcircle!(img, Gray(0.0), 12, 12, 12) diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Kotlin/bitmap-midpoint-circle-algorithm.kotlin b/Task/Bitmap-Midpoint-circle-algorithm/Kotlin/bitmap-midpoint-circle-algorithm.kts similarity index 100% rename from Task/Bitmap-Midpoint-circle-algorithm/Kotlin/bitmap-midpoint-circle-algorithm.kotlin rename to Task/Bitmap-Midpoint-circle-algorithm/Kotlin/bitmap-midpoint-circle-algorithm.kts diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Pluto/bitmap-midpoint-circle-algorithm-1.pluto b/Task/Bitmap-Midpoint-circle-algorithm/Pluto/bitmap-midpoint-circle-algorithm-1.pluto new file mode 100644 index 0000000000..c0d4f3ed9c --- /dev/null +++ b/Task/Bitmap-Midpoint-circle-algorithm/Pluto/bitmap-midpoint-circle-algorithm-1.pluto @@ -0,0 +1,33 @@ +local canvas = require "canvas" + +local function trunc(x) return x >= 0 ? math.floor(x) : math.ceil(x) end + +local function circle(c, cx, cy, r, col) + local d = trunc((5 - r * 4) / 4) + local x = 0 + local y = r + repeat + c:set(cx + x, cy + y, col) + c:set(cx + x, cy - y, col) + c:set(cx - x, cy + y, col) + c:set(cx - x, cy - y, col) + c:set(cx + y, cy + x, col) + c:set(cx + y, cy - x, col) + c:set(cx - y, cy + x, col) + c:set(cx - y, cy - x, col) + if d < 0 then + d += 2 * x + 1 + else + d += 2 * (x - y) + 1 + y -= 1 + end + ++x + until x > y +end + +local c = canvas.new(400, 400) +c:fill(0xffffff) -- white background + +-- Draw a blue circle with centre at (200, 200) and radius 100. +circle(c, 200, 200, 100, 0xff0000) +io.contents("mybmp.bmp", c:tobmp()) -- save to a bitmap file diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Pluto/bitmap-midpoint-circle-algorithm-2.pluto b/Task/Bitmap-Midpoint-circle-algorithm/Pluto/bitmap-midpoint-circle-algorithm-2.pluto new file mode 100644 index 0000000000..97f3494948 --- /dev/null +++ b/Task/Bitmap-Midpoint-circle-algorithm/Pluto/bitmap-midpoint-circle-algorithm-2.pluto @@ -0,0 +1,6 @@ +require "bitmap" + +local bmp = bitmap.of(400, 400, color.white, "mybmp") +bmp:circle(200, 200, 100, color.blue) +bmp:view() +bmp:save() -- if required diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Rebol/bitmap-midpoint-circle-algorithm.rebol b/Task/Bitmap-Midpoint-circle-algorithm/Rebol/bitmap-midpoint-circle-algorithm.rebol new file mode 100644 index 0000000000..fe3a8f7661 --- /dev/null +++ b/Task/Bitmap-Midpoint-circle-algorithm/Rebol/bitmap-midpoint-circle-algorithm.rebol @@ -0,0 +1,49 @@ +Rebol [ + title: "Rosetta code: Bitmap/Midpoint circle algorithm" + file: %Bitmap-Midpoint_circle_algorithm.r3 + url: https://rosettacode.org/wiki/Bitmap/Midpoint_circle_algorithm +] + +draw-circle: func [ + "Draw a circle on an image using the Midpoint Circle Algorithm." + bitmap [image!] center [pair!] radius [integer!] color [tuple!] +][ + x: center/x ;; unpack center coords from pair for arithmetic + y: center/y + dx: radius dy: 0 + err: 1 - radius ;; initial error term for midpoint decision + + while [dx >= dy] [ ;; iterate through the first octant only + ;; Mirror the single computed point into all 8 octants at once, + ;; exploiting the 8-fold symmetry of the circle. + bitmap/(as-pair x + dx y + dy): color ; octant 1 + bitmap/(as-pair x - dx y + dy): color ; octant 2 + bitmap/(as-pair x + dx y - dy): color ; octant 8 + bitmap/(as-pair x - dx y - dy): color ; octant 7 + bitmap/(as-pair x + dy y + dx): color ; octant 3 + bitmap/(as-pair x - dy y + dx): color ; octant 4 (swapped dx/dy) + bitmap/(as-pair x + dy y - dx): color ; octant 5 + bitmap/(as-pair x - dy y - dx): color ; octant 6 + + dy: dy + 1 ;; advance one step along the minor axis + + ;; Update the error term and conditionally step inward on dx. + ;; err < 0 means we are still inside the circle boundary + either err < 0 [ + err: err + (2 * dy) + 1 ;; correct error for dy step + ][ + dx: dx - 1 ;; step inward on major axis + err: err + (2 * (dy - dx)) + 1 ;; correct error for both steps + ] + ] +] + +img: make image! 29x29 ;; create a blank 29x29 canvas (white by default) +draw-circle img 15x15 5 black ;; small inner circle +draw-circle img 15x15 10 red ;; mid-size red ring +draw-circle img 15x15 14 green ;; large green ring, nearly fills the canvas + +;; scale up 10x with nearest-neighbour (Box) to keep pixel edges sharp +img: resize/filter img 290 'Box +save %midpoint-circles.png img +try [view img] diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Scala/bitmap-midpoint-circle-algorithm.scala b/Task/Bitmap-Midpoint-circle-algorithm/Scala/bitmap-midpoint-circle-algorithm.scala index a9a9542002..1cb33f2446 100644 --- a/Task/Bitmap-Midpoint-circle-algorithm/Scala/bitmap-midpoint-circle-algorithm.scala +++ b/Task/Bitmap-Midpoint-circle-algorithm/Scala/bitmap-midpoint-circle-algorithm.scala @@ -22,7 +22,7 @@ object BitmapOps { x+=1 ddF_x+=2 f+=ddF_x - + bm.setPixel(x0+x, y0+y, c) bm.setPixel(x0-x, y0+y, c) bm.setPixel(x0+x, y0-y, c) diff --git a/Task/Bitmap-Midpoint-circle-algorithm/UNIX-Shell/bitmap-midpoint-circle-algorithm.sh b/Task/Bitmap-Midpoint-circle-algorithm/UNIX-Shell/bitmap-midpoint-circle-algorithm.sh index c11e2e9da6..e4db4df45c 100644 --- a/Task/Bitmap-Midpoint-circle-algorithm/UNIX-Shell/bitmap-midpoint-circle-algorithm.sh +++ b/Task/Bitmap-Midpoint-circle-algorithm/UNIX-Shell/bitmap-midpoint-circle-algorithm.sh @@ -13,10 +13,10 @@ function drawcircle { for y in $( seq $((y0-radius)) $((y0+radius)) ) do echo -en "\e[${y}H" - for x in $( seq $((x0+radius)) ) - do - echo -n "-" - done + for x in $( seq $((x0+radius)) ) + do + echo -n "-" + done done x=$((radius-1)) @@ -38,12 +38,12 @@ function drawcircle { if [ $err -le 0 ] then - ((++y)) + ((++y)) ((err+=dy)) ((dy+=2)) fi if [ $err -gt 0 ] - then + then ((--x)) ((dx+=2)) ((err+=dx-(radius<<1))) diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Vedit-macro-language/bitmap-midpoint-circle-algorithm.vedit b/Task/Bitmap-Midpoint-circle-algorithm/Vedit-macro-language/bitmap-midpoint-circle-algorithm.vedit index 3a37522166..96c740f247 100644 --- a/Task/Bitmap-Midpoint-circle-algorithm/Vedit-macro-language/bitmap-midpoint-circle-algorithm.vedit +++ b/Task/Bitmap-Midpoint-circle-algorithm/Vedit-macro-language/bitmap-midpoint-circle-algorithm.vedit @@ -2,11 +2,11 @@ // #21 = center x, #22 = center y; #23 = radius :DRAW_CIRCLE: -#30 = 1 - #23 // f -#31 = 0 // ddF_x -#32 = -2 * #23 // ddF_y -#41 = 0 // x -#42 = #23 // y +#30 = 1 - #23 // f +#31 = 0 // ddF_x +#32 = -2 * #23 // ddF_y +#41 = 0 // x +#42 = #23 // y while (#41 <= #42) { #1 = #21+#41; #2 = #22+#42; Call("DRAW_PIXEL") @@ -18,9 +18,9 @@ while (#41 <= #42) { #1 = #21+#42; #2 = #22-#41; Call("DRAW_PIXEL") #1 = #21-#42; #2 = #22-#41; Call("DRAW_PIXEL") if (#30 >= 0) { - #42-- - #32 += 2 - #30 += #32 + #42-- + #32 += 2 + #30 += #32 } #41++ #31 += 2 diff --git a/Task/Bitmap-Midpoint-circle-algorithm/Zkl/bitmap-midpoint-circle-algorithm-1.zkl b/Task/Bitmap-Midpoint-circle-algorithm/Zkl/bitmap-midpoint-circle-algorithm-1.zkl index f651983a78..82685d593e 100644 --- a/Task/Bitmap-Midpoint-circle-algorithm/Zkl/bitmap-midpoint-circle-algorithm-1.zkl +++ b/Task/Bitmap-Midpoint-circle-algorithm/Zkl/bitmap-midpoint-circle-algorithm-1.zkl @@ -2,15 +2,15 @@ x:=r; y:=0; radiusError:=1-x; while(x >= y){ __sSet(rgb, x + x0, y + y0); - __sSet(rgb, y + x0, x + y0); - __sSet(rgb,-x + x0, y + y0); - __sSet(rgb,-y + x0, x + y0); - self[-x + x0, -y + y0]=rgb; // or do it this way, __sSet gets called as above - self[-y + x0, -x + y0]=rgb; - self[ x + x0, -y + y0]=rgb; - self[ y + x0, -x + y0]=rgb; - y+=1; - if (radiusError<0) radiusError+=2*y + 1; - else{ x-=1; radiusError+=2*(y - x + 1); } + __sSet(rgb, y + x0, x + y0); + __sSet(rgb,-x + x0, y + y0); + __sSet(rgb,-y + x0, x + y0); + self[-x + x0, -y + y0]=rgb; // or do it this way, __sSet gets called as above + self[-y + x0, -x + y0]=rgb; + self[ x + x0, -y + y0]=rgb; + self[ y + x0, -x + y0]=rgb; + y+=1; + if (radiusError<0) radiusError+=2*y + 1; + else{ x-=1; radiusError+=2*(y - x + 1); } } } diff --git a/Task/Bitmap-PPM-conversion-through-a-pipe/FreeBASIC/bitmap-ppm-conversion-through-a-pipe.basic b/Task/Bitmap-PPM-conversion-through-a-pipe/FreeBASIC/bitmap-ppm-conversion-through-a-pipe.basic new file mode 100644 index 0000000000..5633823dd7 --- /dev/null +++ b/Task/Bitmap-PPM-conversion-through-a-pipe/FreeBASIC/bitmap-ppm-conversion-through-a-pipe.basic @@ -0,0 +1,64 @@ +Const ancho = 400 +Const alto = 300 +Dim As Integer i, x, y +Dim As Ulong kolor + +' Set up graphics +Screenres ancho, alto, 32 +Windowtitle "Pattern Generator" + +' A little extravagant, this draws a design of dots and lines +' Fill background with color Rgb(&h40, &h80, &hc0) +Line (0, 0)-(ancho-1, alto-1), Rgb(64, 128, 192), BF + +' Draw random dots Rgb(&h20, &h40, &h80) +For i = 1 To 2000 + Pset (Rnd * (ancho-1), Rnd * (alto-1)), Rgb(32, 64, 128) +Next + +' Draw horizontal lines +For x = 0 To ancho-1 + For y = 240 To 244 + Pset (x, y), Rgb(32, 64, 128) + Next + For y = 260 To 264 + Pset (x, y), Rgb(32, 64, 128) + Next +Next + +' Draw vertical lines +For y = 0 To alto-1 + For x = 80 To 84 + Pset (x, y), Rgb(32, 64, 128) + Next + For x = 95 To 99 + Pset (x, y), Rgb(32, 64, 128) + Next +Next + +' Open PPM file to write +Dim As Integer ff = Freefile +Open "noutput.ppm" For Binary As #ff +If Err > 0 Then Print "Error opening output file": End + +' Write PPM header +Put #ff, , "P6" & Chr(10) +Put #ff, , Str(ancho) & " " & Str(alto) & Chr(10) +Put #ff, , "255" & Chr(10) + +' Write pixel data +For y = 0 To alto - 1 + For x = 0 To ancho - 1 + kolor = Point(x, y) + Put #ff, , Cbyte(kolor Shr 16) ' Blue + Put #ff, , Cbyte(kolor Shr 8) ' Green + Put #ff, , Cbyte(kolor) ' Red + Next +Next + +Close #ff + +' Convert to JPG using ImageMagick (pipe logic) +Shell "magick.exe noutput.ppm noutput.jpg" + +Sleep diff --git a/Task/Bitmap-PPM-conversion-through-a-pipe/Julia/bitmap-ppm-conversion-through-a-pipe.julia b/Task/Bitmap-PPM-conversion-through-a-pipe/Julia/bitmap-ppm-conversion-through-a-pipe.jl similarity index 100% rename from Task/Bitmap-PPM-conversion-through-a-pipe/Julia/bitmap-ppm-conversion-through-a-pipe.julia rename to Task/Bitmap-PPM-conversion-through-a-pipe/Julia/bitmap-ppm-conversion-through-a-pipe.jl diff --git a/Task/Bitmap-PPM-conversion-through-a-pipe/Kotlin/bitmap-ppm-conversion-through-a-pipe.kotlin b/Task/Bitmap-PPM-conversion-through-a-pipe/Kotlin/bitmap-ppm-conversion-through-a-pipe.kts similarity index 100% rename from Task/Bitmap-PPM-conversion-through-a-pipe/Kotlin/bitmap-ppm-conversion-through-a-pipe.kotlin rename to Task/Bitmap-PPM-conversion-through-a-pipe/Kotlin/bitmap-ppm-conversion-through-a-pipe.kts diff --git a/Task/Bitmap-Read-a-PPM-file/11l/bitmap-read-a-ppm-file.11l b/Task/Bitmap-Read-a-PPM-file/11l/bitmap-read-a-ppm-file.11l index eb8c2c11c4..93aeb15ba7 100644 --- a/Task/Bitmap-Read-a-PPM-file/11l/bitmap-read-a-ppm-file.11l +++ b/Task/Bitmap-Read-a-PPM-file/11l/bitmap-read-a-ppm-file.11l @@ -1,13 +1,4 @@ -T Colour - Byte r, g, b - - F (r, g, b) - .r = r - .g = g - .b = b - - F ==(other) - R .r == other.r & .g == other.g & .b == other.b +T Colour = BVec3 V black = Colour(0, 0, 0) V white = Colour(255, 255, 255) diff --git a/Task/Bitmap-Read-a-PPM-file/Ada/bitmap-read-a-ppm-file-1.ada b/Task/Bitmap-Read-a-PPM-file/Ada/bitmap-read-a-ppm-file-1.adb similarity index 100% rename from Task/Bitmap-Read-a-PPM-file/Ada/bitmap-read-a-ppm-file-1.ada rename to Task/Bitmap-Read-a-PPM-file/Ada/bitmap-read-a-ppm-file-1.adb diff --git a/Task/Bitmap-Read-a-PPM-file/Ada/bitmap-read-a-ppm-file-2.ada b/Task/Bitmap-Read-a-PPM-file/Ada/bitmap-read-a-ppm-file-2.adb similarity index 100% rename from Task/Bitmap-Read-a-PPM-file/Ada/bitmap-read-a-ppm-file-2.ada rename to Task/Bitmap-Read-a-PPM-file/Ada/bitmap-read-a-ppm-file-2.adb diff --git a/Task/Bitmap-Read-a-PPM-file/AutoHotkey/bitmap-read-a-ppm-file.ahk b/Task/Bitmap-Read-a-PPM-file/AutoHotkey/bitmap-read-a-ppm-file.ahk index 13ce33a881..df5682b996 100644 --- a/Task/Bitmap-Read-a-PPM-file/AutoHotkey/bitmap-read-a-ppm-file.ahk +++ b/Task/Bitmap-Read-a-PPM-file/AutoHotkey/bitmap-read-a-ppm-file.ahk @@ -46,11 +46,11 @@ loop % width * height if (j == width) { - j := 1 - i += 1 + j := 1 + i += 1 } else - j++ + j++ } return bitmap } diff --git a/Task/Bitmap-Read-a-PPM-file/Common-Lisp/bitmap-read-a-ppm-file-1.lisp b/Task/Bitmap-Read-a-PPM-file/Common-Lisp/bitmap-read-a-ppm-file-1.lisp index 511eba41d7..c68f4c654d 100644 --- a/Task/Bitmap-Read-a-PPM-file/Common-Lisp/bitmap-read-a-ppm-file-1.lisp +++ b/Task/Bitmap-Read-a-PPM-file/Common-Lisp/bitmap-read-a-ppm-file-1.lisp @@ -13,59 +13,59 @@ (defun read-ppm-file-header (file) (with-open-file (s file :direction :input) (do ((failure-count 0 (1+ failure-count)) - (tokens nil (let ((t1 (read-header-chars s))) - (if (> (length t1) 0) - (cons t1 tokens) - tokens)))) - ((>= (length tokens) 4) (values (nreverse tokens) - (file-position s))) + (tokens nil (let ((t1 (read-header-chars s))) + (if (> (length t1) 0) + (cons t1 tokens) + tokens)))) + ((>= (length tokens) 4) (values (nreverse tokens) + (file-position s))) (when (>= failure-count 10) - (error (format nil "File ~a does not seem to be a proper ppm file - maybe too many comment lines" file))) + (error (format nil "File ~a does not seem to be a proper ppm file - maybe too many comment lines" file))) (when (= (length tokens) 1) - (when (not (or (string= (first tokens) "P6") (string= (first tokens) "P3"))) - (error (format nil "File ~a is not a ppm file - wrong magic-number. Read ~a instead of P6 or P3 " file (first tokens)))))))) + (when (not (or (string= (first tokens) "P6") (string= (first tokens) "P3"))) + (error (format nil "File ~a is not a ppm file - wrong magic-number. Read ~a instead of P6 or P3 " file (first tokens)))))))) (defun read-ppm-image (file) (flet ((image-data-reader (stream start-position width height image-build-function read-function) - (file-position stream start-position) - (dotimes (row height) - (dotimes (col width) - (funcall image-build-function row col (funcall read-function stream)))))) + (file-position stream start-position) + (dotimes (row height) + (dotimes (col width) + (funcall image-build-function row col (funcall read-function stream)))))) (multiple-value-bind (header file-pos) (read-ppm-file-header file) (let* ((image-type (first header)) - (width (parse-integer (second header) :junk-allowed t)) - (height (parse-integer (third header) :junk-allowed t)) - (max-value (parse-integer (fourth header) :junk-allowed t)) - (image (make-rgb-pixel-buffer width height))) - (when (> max-value 255) - (error "unsupported depth - convert to 1byte depth with pamdepth")) - (cond ((string= "P6" image-type) - (with-open-file (stream file :direction :input :element-type '(unsigned-byte 8)) - (image-data-reader stream - file-pos - width - height - #'(lambda (w h val) - (setf (rgb-pixel image w h) val)) - #'(lambda (stream) - (make-rgb-pixel (read-byte stream) - (read-byte stream) - (read-byte stream)))) - image)) - ((string= "P3" image-type) - (with-open-file (stream file :direction :input) - (image-data-reader stream - file-pos - width - height - #'(lambda (w h val) - (setf (rgb-pixel image w h) val)) - #'(lambda (stream) - (make-rgb-pixel (read stream) - (read stream) - (read stream)))) - image)) - (t 'unsupported)) + (width (parse-integer (second header) :junk-allowed t)) + (height (parse-integer (third header) :junk-allowed t)) + (max-value (parse-integer (fourth header) :junk-allowed t)) + (image (make-rgb-pixel-buffer width height))) + (when (> max-value 255) + (error "unsupported depth - convert to 1byte depth with pamdepth")) + (cond ((string= "P6" image-type) + (with-open-file (stream file :direction :input :element-type '(unsigned-byte 8)) + (image-data-reader stream + file-pos + width + height + #'(lambda (w h val) + (setf (rgb-pixel image w h) val)) + #'(lambda (stream) + (make-rgb-pixel (read-byte stream) + (read-byte stream) + (read-byte stream)))) + image)) + ((string= "P3" image-type) + (with-open-file (stream file :direction :input) + (image-data-reader stream + file-pos + width + height + #'(lambda (w h val) + (setf (rgb-pixel image w h) val)) + #'(lambda (stream) + (make-rgb-pixel (read stream) + (read stream) + (read stream)))) + image)) + (t 'unsupported)) image)))) (export 'read-ppm-image) diff --git a/Task/Bitmap-Read-a-PPM-file/Crystal/bitmap-read-a-ppm-file.cr b/Task/Bitmap-Read-a-PPM-file/Crystal/bitmap-read-a-ppm-file.cr new file mode 100644 index 0000000000..4b8e3b6639 --- /dev/null +++ b/Task/Bitmap-Read-a-PPM-file/Crystal/bitmap-read-a-ppm-file.cr @@ -0,0 +1,51 @@ +require "./pixmap" + +class Pixmap + def self.load_ppm (io) + blanks = StaticArray[9, 10, 11, 12, 13, 32] + magic = Bytes.new(3) + io.read magic + raise "Invalid format" unless magic[0] == 'P'.ord && + magic[1] == '6'.ord && + magic[2].in? blanks + data = io.getb_to_end + pos = 0 + get_number = -> : Int32 { + start = pos + loop do # skip blanks and comments + case data[start] + when .in? blanks then start += 1 + when '#'.ord + while data[start] != 10 + start += 1 + end + else break + end + end + stop = start + until data[stop].in? blanks + stop += 1 + end + pos = stop + String.new(data[start..stop]).to_i + } + begin + width = get_number.call + height = get_number.call + maxval = get_number.call + rescue ex + raise "Bad P6 file" + end + raise "Unsupported color depth" unless maxval = 255 + pos += 1 + raise "Invalid data" unless (data.size - pos) % 3 == 0 + len = (data.size - pos) // 3 + raise "Bad bounds" unless len == width * height + pixels = Array(Color).new(len) { |i| + Color.new(data[i*3 + pos], data[i*3 + pos + 1], data[i*3 + pos + 2]) + } + Pixmap.new width, height, pixels + end + + register_loader ".ppm", load_ppm +end diff --git a/Task/Bitmap-Read-a-PPM-file/Delphi/bitmap-read-a-ppm-file.delphi b/Task/Bitmap-Read-a-PPM-file/Delphi/bitmap-read-a-ppm-file.pas similarity index 100% rename from Task/Bitmap-Read-a-PPM-file/Delphi/bitmap-read-a-ppm-file.delphi rename to Task/Bitmap-Read-a-PPM-file/Delphi/bitmap-read-a-ppm-file.pas diff --git a/Task/Bitmap-Read-a-PPM-file/Euphoria/bitmap-read-a-ppm-file-1.euphoria b/Task/Bitmap-Read-a-PPM-file/Euphoria/bitmap-read-a-ppm-file-1.eu similarity index 100% rename from Task/Bitmap-Read-a-PPM-file/Euphoria/bitmap-read-a-ppm-file-1.euphoria rename to Task/Bitmap-Read-a-PPM-file/Euphoria/bitmap-read-a-ppm-file-1.eu diff --git a/Task/Bitmap-Read-a-PPM-file/Euphoria/bitmap-read-a-ppm-file-2.euphoria b/Task/Bitmap-Read-a-PPM-file/Euphoria/bitmap-read-a-ppm-file-2.eu similarity index 100% rename from Task/Bitmap-Read-a-PPM-file/Euphoria/bitmap-read-a-ppm-file-2.euphoria rename to Task/Bitmap-Read-a-PPM-file/Euphoria/bitmap-read-a-ppm-file-2.eu diff --git a/Task/Bitmap-Read-a-PPM-file/FBSL/bitmap-read-a-ppm-file.fbsl b/Task/Bitmap-Read-a-PPM-file/FBSL/bitmap-read-a-ppm-file.fbsl index b2d7f3528e..188aa0caa2 100644 --- a/Task/Bitmap-Read-a-PPM-file/FBSL/bitmap-read-a-ppm-file.fbsl +++ b/Task/Bitmap-Read-a-PPM-file/FBSL/bitmap-read-a-ppm-file.fbsl @@ -8,11 +8,11 @@ blobsize = INSTR(FILEGET, "\n255\n") + 4 ' Get sizeof PPM header head = @FILEGET + blobsize: tail = @FILEGET + FILELEN ' Set loop bounds FOR ptr = head TO tail STEP 3 ' Transform color triplets - r = PEEK(ptr + 0, 1) ' Read colors stored in RGB order - g = PEEK(ptr + 1, 1) - b = PEEK(ptr + 2, 1) - l = 0.2126 * r + 0.7152 * g + 0.0722 * b ' Derive luminance - POKE(ptr + 0, CHR(l))(ptr + 1, CHR)(ptr + 2, CHR) ' Write grayscale + r = PEEK(ptr + 0, 1) ' Read colors stored in RGB order + g = PEEK(ptr + 1, 1) + b = PEEK(ptr + 2, 1) + l = 0.2126 * r + 0.7152 * g + 0.0722 * b ' Derive luminance + POKE(ptr + 0, CHR(l))(ptr + 1, CHR)(ptr + 2, CHR) ' Write grayscale NEXT FILEPUT(FILEOPEN(grayscale, BINARY_NEW), FILEGET): FILECLOSE(FILEOPEN) ' Save buffer diff --git a/Task/Bitmap-Read-a-PPM-file/Forth/bitmap-read-a-ppm-file.fth b/Task/Bitmap-Read-a-PPM-file/Forth/bitmap-read-a-ppm-file.fth index 20b30e7793..28824390fc 100644 --- a/Task/Bitmap-Read-a-PPM-file/Forth/bitmap-read-a-ppm-file.fth +++ b/Task/Bitmap-Read-a-PPM-file/Forth/bitmap-read-a-ppm-file.fth @@ -3,7 +3,7 @@ s" P6" compare abort" Only P6 supported." pad dup 80 fid read-line throw 0= abort" Partial line" 0. 2swap >number - 1 /string \ skip space + 1 /string \ skip space 0. 2swap >number 2drop drop nip ( w h ) bitmap { bmp } diff --git a/Task/Bitmap-Read-a-PPM-file/FreeBASIC/bitmap-read-a-ppm-file.basic b/Task/Bitmap-Read-a-PPM-file/FreeBASIC/bitmap-read-a-ppm-file.basic new file mode 100644 index 0000000000..578d40b501 --- /dev/null +++ b/Task/Bitmap-Read-a-PPM-file/FreeBASIC/bitmap-read-a-ppm-file.basic @@ -0,0 +1,33 @@ +Dim As String imagen = "Lena.ppm" + +Sub readPPM (fs As String) + Dim As Integer x, y, ancho, alto + Dim As String t, kolor + Dim As Ubyte r, g, b + + If Len(fs) = 0 Then Print "No PPM file name indicated.": Exit Sub + + Dim As Long ff = Freefile + Open fs For Binary As #ff + If Err Then Print "File "; fs; " not found.": Exit Sub + + Input #ff, t, ancho, alto, kolor + + If t = "P6" Then + Screenres ancho, alto, 32 + For y = 0 To alto - 1 + For x = 0 To ancho - 1 + Get #ff, , r + Get #ff, , g + Get #ff, , b + Pset (x, y), Rgb(r, g, b) + Next x + Next y + Close #ff + Else + Print "File is NOT PPM P6 type." + End If +End Sub + +readPPM(imagen) +Sleep diff --git a/Task/Bitmap-Read-a-PPM-file/Java/bitmap-read-a-ppm-file.java b/Task/Bitmap-Read-a-PPM-file/Java/bitmap-read-a-ppm-file.java index 6d1e33c878..9670723d2d 100644 --- a/Task/Bitmap-Read-a-PPM-file/Java/bitmap-read-a-ppm-file.java +++ b/Task/Bitmap-Read-a-PPM-file/Java/bitmap-read-a-ppm-file.java @@ -12,32 +12,32 @@ import javax.imageio.ImageIO; public class ReadPPMFile { - public static void main(String[] aArgs) throws IOException { + public static void main(String[] aArgs) throws IOException { // Using the file created in the Bitmap task - String filePath = "output.ppm"; - - reader = new BufferedInputStream( new FileInputStream(filePath) ); - final char header1 = (char) reader.read(); + String filePath = "output.ppm"; + + reader = new BufferedInputStream( new FileInputStream(filePath) ); + final char header1 = (char) reader.read(); final char header2 = (char) reader.read(); final char header3 = (char) reader.read(); if ( header1 != 'P' || header2 != '6' || header3 != END_OF_LINE) { - reader.close(); - throw new IllegalArgumentException("Not a valid P6 PPM file"); + reader.close(); + throw new IllegalArgumentException("Not a valid P6 PPM file"); } final int width = processCharacters(SPACE_CHARACTER); final int height = processCharacters(END_OF_LINE); final int maxColorValue = processCharacters(END_OF_LINE); if ( maxColorValue < 0 || maxColorValue > 255 ) { - reader.close(); - throw new IllegalArgumentException("Maximum color value is outside the range 0..255"); + reader.close(); + throw new IllegalArgumentException("Maximum color value is outside the range 0..255"); } // Remove any comments before reading data reader.mark(1); while ( reader.read() == START_OF_COMMENT ) { - while ( reader.read() != END_OF_LINE ); - reader.mark(1); + while ( reader.read() != END_OF_LINE ); + reader.mark(1); } reader.reset(); @@ -47,10 +47,10 @@ public class ReadPPMFile { byte[] buffer = new byte[width * 3]; for ( int y = 0; y < height; y++ ) { reader.read(buffer, 0, buffer.length); - for ( int x = 0; x < width; x++ ) { + for ( int x = 0; x < width; x++ ) { Color color = new Color(Byte.toUnsignedInt(buffer[x * 3]), - Byte.toUnsignedInt(buffer[x * 3 + 1]), - Byte.toUnsignedInt(buffer[x * 3 + 2])); + Byte.toUnsignedInt(buffer[x * 3 + 1]), + Byte.toUnsignedInt(buffer[x * 3 + 2])); bitmap.setPixel(x, y, color); } } @@ -60,29 +60,29 @@ public class ReadPPMFile { // Convert to gray scale and save to a file bitmap.convertToGrayscale(); File grayFile = new File("outputGray.jpg"); - ImageIO.write((RenderedImage) bitmap.getImage(), "jpg", grayFile); - } - - private static int processCharacters(char aChar) throws IOException { - StringBuilder characters = new StringBuilder(); - char ch; - while ( ( ch = (char) reader.read() ) != aChar ) { - if ( ch == START_OF_COMMENT ) { - while ( reader.read() != END_OF_LINE ); - continue; - } - characters.append(ch); - } - return Integer.valueOf(characters.toString()); - } - - private static BufferedInputStream reader; - - private static final char START_OF_COMMENT = '#'; - private static final char SPACE_CHARACTER = ' '; - private static final char END_OF_LINE = '\n'; + ImageIO.write((RenderedImage) bitmap.getImage(), "jpg", grayFile); + } -} + private static int processCharacters(char aChar) throws IOException { + StringBuilder characters = new StringBuilder(); + char ch; + while ( ( ch = (char) reader.read() ) != aChar ) { + if ( ch == START_OF_COMMENT ) { + while ( reader.read() != END_OF_LINE ); + continue; + } + characters.append(ch); + } + return Integer.valueOf(characters.toString()); + } + + private static BufferedInputStream reader; + + private static final char START_OF_COMMENT = '#'; + private static final char SPACE_CHARACTER = ' '; + private static final char END_OF_LINE = '\n'; + +} final class BasicBitmapStorage { @@ -105,12 +105,12 @@ final class BasicBitmapStorage { } public Image getImage() { - return image; + return image; } public void convertToGrayscale() { for ( int y = 0; y < image.getHeight(); y++ ) { - for ( int x = 0; x < image.getWidth(); x++ ) { + for ( int x = 0; x < image.getWidth(); x++ ) { int color = image.getRGB(x, y); int alpha = ( color >> 24 ) & 255; diff --git a/Task/Bitmap-Read-a-PPM-file/Julia/bitmap-read-a-ppm-file.julia b/Task/Bitmap-Read-a-PPM-file/Julia/bitmap-read-a-ppm-file.jl similarity index 100% rename from Task/Bitmap-Read-a-PPM-file/Julia/bitmap-read-a-ppm-file.julia rename to Task/Bitmap-Read-a-PPM-file/Julia/bitmap-read-a-ppm-file.jl diff --git a/Task/Bitmap-Read-a-PPM-file/Kotlin/bitmap-read-a-ppm-file.kotlin b/Task/Bitmap-Read-a-PPM-file/Kotlin/bitmap-read-a-ppm-file.kts similarity index 100% rename from Task/Bitmap-Read-a-PPM-file/Kotlin/bitmap-read-a-ppm-file.kotlin rename to Task/Bitmap-Read-a-PPM-file/Kotlin/bitmap-read-a-ppm-file.kts diff --git a/Task/Bitmap-Read-a-PPM-file/OCaml/bitmap-read-a-ppm-file-1.ocaml b/Task/Bitmap-Read-a-PPM-file/OCaml/bitmap-read-a-ppm-file-1.ml similarity index 100% rename from Task/Bitmap-Read-a-PPM-file/OCaml/bitmap-read-a-ppm-file-1.ocaml rename to Task/Bitmap-Read-a-PPM-file/OCaml/bitmap-read-a-ppm-file-1.ml diff --git a/Task/Bitmap-Read-a-PPM-file/OCaml/bitmap-read-a-ppm-file-2.ocaml b/Task/Bitmap-Read-a-PPM-file/OCaml/bitmap-read-a-ppm-file-2.ml similarity index 100% rename from Task/Bitmap-Read-a-PPM-file/OCaml/bitmap-read-a-ppm-file-2.ocaml rename to Task/Bitmap-Read-a-PPM-file/OCaml/bitmap-read-a-ppm-file-2.ml diff --git a/Task/Bitmap-Read-a-PPM-file/Oz/bitmap-read-a-ppm-file-1.oz b/Task/Bitmap-Read-a-PPM-file/Oz/bitmap-read-a-ppm-file-1.oz index 5d3fd1c6e4..33b5a7e6ef 100644 --- a/Task/Bitmap-Read-a-PPM-file/Oz/bitmap-read-a-ppm-file-1.oz +++ b/Task/Bitmap-Read-a-PPM-file/Oz/bitmap-read-a-ppm-file-1.oz @@ -10,31 +10,31 @@ define F = {New Open.file init(name:Filename)} fun {ReadColor8 _} - Bytes = {F read(list:$ size:3)} + Bytes = {F read(list:$ size:3)} in - {List.toTuple color Bytes} + {List.toTuple color Bytes} end fun {ReadColor16 _} - Bytes = {F read(list:$ size:6)} + Bytes = {F read(list:$ size:6)} in - {List.toTuple color {Map {PairUp Bytes} FromBytes}} + {List.toTuple color {Map {PairUp Bytes} FromBytes}} end in try - Magic = {F read(size:2 list:$)} - if Magic \= "P6" then raise bitmapIO(read unsupportedFormat(Magic)) end end - Width = {ReadNumber F} - Height = {ReadNumber F} - MaxVal = {ReadNumber F} - MaxVal =< 0xffff = true - Reader = if MaxVal =< 0xff then ReadColor8 else ReadColor16 end - B = {Bitmap.new Width Height} + Magic = {F read(size:2 list:$)} + if Magic \= "P6" then raise bitmapIO(read unsupportedFormat(Magic)) end end + Width = {ReadNumber F} + Height = {ReadNumber F} + MaxVal = {ReadNumber F} + MaxVal =< 0xffff = true + Reader = if MaxVal =< 0xff then ReadColor8 else ReadColor16 end + B = {Bitmap.new Width Height} in - {Bitmap.transform B Reader} - B + {Bitmap.transform B Reader} + B finally - {F close} + {F close} end end @@ -43,12 +43,12 @@ define in {SkipWS F} Ds = for collect:Collect break:Break do - [C] = {F read(list:$ size:1)} - in - if {Char.isDigit C} then {Collect C} - else {Break} - end - end + [C] = {F read(list:$ size:1)} + in + if {Char.isDigit C} then {Collect C} + else {Break} + end + end {SkipWS F} {String.toInt Ds} end @@ -58,9 +58,9 @@ define in if {Char.isSpace C} then {SkipWS F} elseif C == &# then - {SkipLine F} + {SkipLine F} else - {F seek(whence:current offset:~1)} + {F seek(whence:current offset:~1)} end end diff --git a/Task/Bitmap-Read-a-PPM-file/Raku/bitmap-read-a-ppm-file.raku b/Task/Bitmap-Read-a-PPM-file/Raku/bitmap-read-a-ppm-file.raku index 5f77cfb471..395d55219b 100644 --- a/Task/Bitmap-Read-a-PPM-file/Raku/bitmap-read-a-ppm-file.raku +++ b/Task/Bitmap-Read-a-PPM-file/Raku/bitmap-read-a-ppm-file.raku @@ -7,8 +7,8 @@ class Bitmap { role PGM { has @.GS; method P5 returns Blob { - "P5\n{self.width} {self.height}\n255\n".encode('ascii') - ~ Blob.new: self.GS + "P5\n{self.width} {self.height}\n255\n".encode('ascii') + ~ Blob.new: self.GS } } diff --git a/Task/Bitmap-Read-a-PPM-file/Rebol/bitmap-read-a-ppm-file.rebol b/Task/Bitmap-Read-a-PPM-file/Rebol/bitmap-read-a-ppm-file.rebol new file mode 100644 index 0000000000..7c8de98fa0 --- /dev/null +++ b/Task/Bitmap-Read-a-PPM-file/Rebol/bitmap-read-a-ppm-file.rebol @@ -0,0 +1,50 @@ +Rebol [ + title: "Rosetta code: Bitmap/Read a PPM file" + file: %Bitmap-Read_a_PPM_file.r3 + url: https://rosettacode.org/wiki/Bitmap/Read_a_PPM_file +] + +decode-ppm: function[ppm [string! file! url!]][ + ;; Load source into a string if a file or URL was given + unless string? ppm [ppm: read/string ppm] + if all [ + ;; Strip the "P3" magic header and any comment lines + parse/case ppm ["P3" any [LF | #"#" to LF skip] ppm: to end] + ;; Lex the remaining text into Rebol values + try [ppm: transcode ppm] + ;; Extract image dimensions, colour depth, and raw RGB values + parse ppm [ + set width: integer! + set height: integer! + set depth: integer! + rgb: to end + ] + ][ + img: make image! as-pair width height + i: 1 clr: 0.0.0 + foreach [r g b] rgb [ + ;; Normalise each channel to 0–255 + clr/1: 255 * (r / depth) + clr/2: 255 * (g / depth) + clr/3: 255 * (b / depth) + img/:i: clr + ++ i + ] + ;; Return the completed image + img + ] +] + +img: decode-ppm {P3 +# feep.ppm +4 4 +15 +0 0 0 0 0 0 0 0 0 15 0 15 +0 0 0 0 15 7 0 0 0 0 0 0 +0 0 0 0 0 0 0 15 7 0 0 0 +15 0 15 0 0 0 0 0 0 0 0 0} + +print "Source image:" +print img +print "Grayscale PPM output:" +print to-ppm grayscale img ;@@ https://rosettacode.org/wiki/Bitmap/Write_a_PPM_file diff --git a/Task/Bitmap-Read-a-PPM-file/Rust/bitmap-read-a-ppm-file.rust b/Task/Bitmap-Read-a-PPM-file/Rust/bitmap-read-a-ppm-file.rs similarity index 100% rename from Task/Bitmap-Read-a-PPM-file/Rust/bitmap-read-a-ppm-file.rust rename to Task/Bitmap-Read-a-PPM-file/Rust/bitmap-read-a-ppm-file.rs diff --git a/Task/Bitmap-Read-a-PPM-file/Scala/bitmap-read-a-ppm-file-1.scala b/Task/Bitmap-Read-a-PPM-file/Scala/bitmap-read-a-ppm-file-1.scala index 672dee049f..c97a82aeab 100644 --- a/Task/Bitmap-Read-a-PPM-file/Scala/bitmap-read-a-ppm-file-1.scala +++ b/Task/Bitmap-Read-a-PPM-file/Scala/bitmap-read-a-ppm-file-1.scala @@ -6,7 +6,7 @@ import javax.swing.ImageIcon object Pixmap { private case class PpmHeader(format:String, width:Int, height:Int, maxColor:Int) - + def load(filename:String):Option[RgbBitmap]={ implicit val in=new BufferedInputStream(new FileInputStream(filename)) val header=readHeader @@ -22,7 +22,7 @@ object Pixmap { private def readHeader(implicit in:InputStream)={ var format=readLine - + var line=readLine while(line.startsWith("#")) //skip comments line=readLine @@ -31,7 +31,7 @@ object Pixmap { val width=parts(0).toInt val height=parts(1).toInt val maxColor=readLine.toInt - + new PpmHeader(format, width, height, maxColor) } diff --git a/Task/Bitmap-Read-a-PPM-file/Vedit-macro-language/bitmap-read-a-ppm-file-1.vedit b/Task/Bitmap-Read-a-PPM-file/Vedit-macro-language/bitmap-read-a-ppm-file-1.vedit index c5de2d216f..4e7dbe614d 100644 --- a/Task/Bitmap-Read-a-PPM-file/Vedit-macro-language/bitmap-read-a-ppm-file-1.vedit +++ b/Task/Bitmap-Read-a-PPM-file/Vedit-macro-language/bitmap-read-a-ppm-file-1.vedit @@ -7,11 +7,11 @@ :LOAD_PPM: File_Open(@10) BOF -Search("|X", ADVANCE) // skip "P6" -#11 = Num_Eval(ADVANCE) // #11 = width -Match("|X", ADVANCE) // skip separator -#12 = Num_Eval(ADVANCE) // #12 = height +Search("|X", ADVANCE) // skip "P6" +#11 = Num_Eval(ADVANCE) // #11 = width +Match("|X", ADVANCE) // skip separator +#12 = Num_Eval(ADVANCE) // #12 = height Match("|X", ADVANCE) -Search("|X", ADVANCE) // skip maxval (assume 255) -Del_Block(0,CP) // remove the header +Search("|X", ADVANCE) // skip maxval (assume 255) +Del_Block(0,CP) // remove the header Return diff --git a/Task/Bitmap-Read-a-PPM-file/Wren/bitmap-read-a-ppm-file.wren b/Task/Bitmap-Read-a-PPM-file/Wren/bitmap-read-a-ppm-file.wren index 6de8e91656..e877a8972e 100644 --- a/Task/Bitmap-Read-a-PPM-file/Wren/bitmap-read-a-ppm-file.wren +++ b/Task/Bitmap-Read-a-PPM-file/Wren/bitmap-read-a-ppm-file.wren @@ -24,6 +24,7 @@ class Bitmap { loadPPMFile(fileName) { var ppm = FileSystem.load(fileName) + var count = ppm.count // ensure file is fully loaded before proceeding if (ppm[0..1] != "P6") { System.print("The loaded file is not a P6 file.") Process.exit() diff --git a/Task/Bitmap-Read-a-PPM-file/Yabasic/bitmap-read-a-ppm-file.basic b/Task/Bitmap-Read-a-PPM-file/Yabasic/bitmap-read-a-ppm-file.basic index 6252db3926..4bf6e89591 100644 --- a/Task/Bitmap-Read-a-PPM-file/Yabasic/bitmap-read-a-ppm-file.basic +++ b/Task/Bitmap-Read-a-PPM-file/Yabasic/bitmap-read-a-ppm-file.basic @@ -1,27 +1,27 @@ sub readPPM(f$) - local ff, x, y, t$, dcol$, wid, hei + local ff, x, y, t$, dcol$, wid, hei - if f$ = "" print "No PPM file name indicate." : return false + if f$ = "" print "No PPM file name indicate." : return false - ff = open (f$, "rb") - if not ff print "File ", f$, " not found." : return false + ff = open (f$, "rb") + if not ff print "File ", f$, " not found." : return false - input #ff t$, wid, hei, dcol$ + input #ff t$, wid, hei, dcol$ - if t$ = "P6" then - open window wid, hei - - for x = 0 to hei - 1 - for y = 0 to wid - 1 - color peek(#ff), peek(#ff), peek(#ff) - dot y, x - next y - next x - - close #ff - else - print "File is NOT PPM P6 type." : return false - end if - - return true + if t$ = "P6" then + open window wid, hei + + for x = 0 to hei - 1 + for y = 0 to wid - 1 + color peek(#ff), peek(#ff), peek(#ff) + dot y, x + next y + next x + + close #ff + else + print "File is NOT PPM P6 type." : return false + end if + + return true end sub diff --git a/Task/Bitmap-Read-an-image-through-a-pipe/FreeBASIC/bitmap-read-an-image-through-a-pipe.basic b/Task/Bitmap-Read-an-image-through-a-pipe/FreeBASIC/bitmap-read-an-image-through-a-pipe.basic new file mode 100644 index 0000000000..532b629312 --- /dev/null +++ b/Task/Bitmap-Read-an-image-through-a-pipe/FreeBASIC/bitmap-read-an-image-through-a-pipe.basic @@ -0,0 +1,65 @@ +Type IMAGE + w As Integer + h As Integer + bpp As Integer + dato(Any) As Ubyte +End Type + +Function readImageFile(filename As String, img As IMAGE) As Boolean + ' First convert image to PPM using temp file + Dim As String cmd = "magick.exe " & filename & " temp.ppm" + Shell(cmd) + + Dim As Integer ff = Freefile + Open "temp.ppm" For Binary As #ff + + ' Read PPM header + Dim As String linea + Line Input #ff, linea ' P6 + If Left(linea, 2) <> "P6" Then Return True + + ' Skip comments + Do + Line Input #ff, linea + If Left(linea, 1) <> "#" Then Exit Do + Loop + + img.w = Val(Left(linea, Instr(linea, " "))) + img.h = Val(Mid(linea, Instr(linea, " "))) + + ' Allocate memory for image data + Redim img.dato(img.w * img.h * 3 - 1) + + ' Read binary pixel data + Get #ff, , img.dato() + + Close #ff + Kill("temp.ppm") ' Clean up temp file + Return False +End Function + +Function writePPM(filename As String, img As IMAGE) As Boolean + Dim As Integer ff = Freefile + Open filename For Binary As #ff + + ' Write PPM header + Put #ff, , "P6" & Chr(10) + Put #ff, , Str(img.w) & " " & Str(img.h) & Chr(10) + Put #ff, , "255" & Chr(10) + + ' Write image data + For i As Integer = 0 To (img.w * img.h * 3 - 1) Step 3 + Put #ff, , img.dato(i + 1) ' Green + Put #ff, , img.dato(i + 2) ' Blue + Put #ff, , img.dato(i) ' Red + Next + + Close #ff + Return False +End Function + +' Main program +Dim As IMAGE img + +If readImageFile("example.png", img) Then Print "Error reading input file" +If writePPM("output.ppm", img) Then Print "i:\Error writing PPM file" diff --git a/Task/Bitmap-Read-an-image-through-a-pipe/Julia/bitmap-read-an-image-through-a-pipe.julia b/Task/Bitmap-Read-an-image-through-a-pipe/Julia/bitmap-read-an-image-through-a-pipe.jl similarity index 100% rename from Task/Bitmap-Read-an-image-through-a-pipe/Julia/bitmap-read-an-image-through-a-pipe.julia rename to Task/Bitmap-Read-an-image-through-a-pipe/Julia/bitmap-read-an-image-through-a-pipe.jl diff --git a/Task/Bitmap-Read-an-image-through-a-pipe/Kotlin/bitmap-read-an-image-through-a-pipe.kotlin b/Task/Bitmap-Read-an-image-through-a-pipe/Kotlin/bitmap-read-an-image-through-a-pipe.kts similarity index 100% rename from Task/Bitmap-Read-an-image-through-a-pipe/Kotlin/bitmap-read-an-image-through-a-pipe.kotlin rename to Task/Bitmap-Read-an-image-through-a-pipe/Kotlin/bitmap-read-an-image-through-a-pipe.kts diff --git a/Task/Bitmap-Read-an-image-through-a-pipe/OCaml/bitmap-read-an-image-through-a-pipe.ocaml b/Task/Bitmap-Read-an-image-through-a-pipe/OCaml/bitmap-read-an-image-through-a-pipe.ml similarity index 100% rename from Task/Bitmap-Read-an-image-through-a-pipe/OCaml/bitmap-read-an-image-through-a-pipe.ocaml rename to Task/Bitmap-Read-an-image-through-a-pipe/OCaml/bitmap-read-an-image-through-a-pipe.ml diff --git a/Task/Bitmap-Read-an-image-through-a-pipe/Wren/bitmap-read-an-image-through-a-pipe.wren b/Task/Bitmap-Read-an-image-through-a-pipe/Wren/bitmap-read-an-image-through-a-pipe.wren index 00286f7223..bb0079e85e 100644 --- a/Task/Bitmap-Read-an-image-through-a-pipe/Wren/bitmap-read-an-image-through-a-pipe.wren +++ b/Task/Bitmap-Read-an-image-through-a-pipe/Wren/bitmap-read-an-image-through-a-pipe.wren @@ -31,6 +31,7 @@ class Bitmap { loadPPMFile(fileName) { var ppm = FileSystem.load(fileName) + var count = ppm.count //ensure file is fully loaded before proceeding if (ppm[0..1] != "P6") { System.print("The loaded file is not a P6 file.") Process.exit() diff --git a/Task/Bitmap-Write-a-PPM-file/11l/bitmap-write-a-ppm-file.11l b/Task/Bitmap-Write-a-PPM-file/11l/bitmap-write-a-ppm-file.11l index 5f43fae154..ab83896090 100644 --- a/Task/Bitmap-Write-a-PPM-file/11l/bitmap-write-a-ppm-file.11l +++ b/Task/Bitmap-Write-a-PPM-file/11l/bitmap-write-a-ppm-file.11l @@ -1,13 +1,4 @@ -T Colour - Byte r, g, b - - F (r, g, b) - .r = r - .g = g - .b = b - - F ==(other) - R .r == other.r & .g == other.g & .b == other.b +T Colour = BVec3 V black = Colour(0, 0, 0) V white = Colour(255, 255, 255) @@ -65,4 +56,4 @@ bitmap.fillrect(1, 0, 1, 2, white) bitmap.set(3, 3, Colour(127, 0, 63)) print(bitmap.writeppmp3()) -File(‘tmp.ppm’, ‘w’).write_bytes(bitmap.writeppmp6()) +File(‘tmp.ppm’, WRITE).write_bytes(bitmap.writeppmp6()) diff --git a/Task/Bitmap-Write-a-PPM-file/Ada/bitmap-write-a-ppm-file.ada b/Task/Bitmap-Write-a-PPM-file/Ada/bitmap-write-a-ppm-file.ada deleted file mode 100644 index 8eb4b7a790..0000000000 --- a/Task/Bitmap-Write-a-PPM-file/Ada/bitmap-write-a-ppm-file.ada +++ /dev/null @@ -1,26 +0,0 @@ -with Ada.Characters.Latin_1; -with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; - -procedure Put_PPM (File : File_Type; Picture : Image) is - use Ada.Characters.Latin_1; - Size : constant String := Integer'Image (Picture'Length (2)) & Integer'Image (Picture'Length (1)); - Buffer : String (1..Picture'Length (2) * 3); - Color : Pixel; - Index : Positive; -begin - String'Write (Stream (File), "P6" & LF); - String'Write (Stream (File), Size (2..Size'Last) & LF); - String'Write (Stream (File), "255" & LF); - for I in Picture'Range (1) loop - Index := Buffer'First; - for J in Picture'Range (2) loop - Color := Picture (I, J); - Buffer (Index) := Character'Val (Color.R); - Buffer (Index + 1) := Character'Val (Color.G); - Buffer (Index + 2) := Character'Val (Color.B); - Index := Index + 3; - end loop; - String'Write (Stream (File), Buffer); - end loop; - Character'Write (Stream (File), LF); -end Put_PPM; diff --git a/Task/Bitmap-Write-a-PPM-file/Ada/bitmap-write-a-ppm-file.adb b/Task/Bitmap-Write-a-PPM-file/Ada/bitmap-write-a-ppm-file.adb new file mode 100644 index 0000000000..c3611189b3 --- /dev/null +++ b/Task/Bitmap-Write-a-PPM-file/Ada/bitmap-write-a-ppm-file.adb @@ -0,0 +1,29 @@ +with Ada.Characters.Latin_1; +with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; + +with Bitmap_Store; use Bitmap_Store; +-- This package is defined in the Bitmap task. + +procedure Put_PPM (File : File_Type; Picture : Image) is + use Ada.Characters.Latin_1; + Size : constant String := Integer'Image (Picture'Length (2)) & Integer'Image (Picture'Length (1)); + Buffer : String (1..Picture'Length (2) * 3); + Color : Pixel; + Index : Positive; +begin + String'Write (Stream (File), "P6" & LF); + String'Write (Stream (File), Size (2..Size'Last) & LF); + String'Write (Stream (File), "255" & LF); + for I in Picture'Range (1) loop + Index := Buffer'First; + for J in Picture'Range (2) loop + Color := Picture (I, J); + Buffer (Index) := Character'Val (Color.R); + Buffer (Index + 1) := Character'Val (Color.G); + Buffer (Index + 2) := Character'Val (Color.B); + Index := Index + 3; + end loop; + String'Write (Stream (File), Buffer); + end loop; + Character'Write (Stream (File), LF); +end Put_PPM; diff --git a/Task/Bitmap-Write-a-PPM-file/Common-Lisp/bitmap-write-a-ppm-file.lisp b/Task/Bitmap-Write-a-PPM-file/Common-Lisp/bitmap-write-a-ppm-file.lisp index d922a0db8d..d4046e677b 100644 --- a/Task/Bitmap-Write-a-PPM-file/Common-Lisp/bitmap-write-a-ppm-file.lisp +++ b/Task/Bitmap-Write-a-PPM-file/Common-Lisp/bitmap-write-a-ppm-file.lisp @@ -1,28 +1,28 @@ (defun write-rgb-buffer-to-ppm-file (filename buffer) (with-open-file (stream filename - :element-type '(unsigned-byte 8) - :direction :output - :if-does-not-exist :create - :if-exists :supersede) + :element-type '(unsigned-byte 8) + :direction :output + :if-does-not-exist :create + :if-exists :supersede) (let* ((dimensions (array-dimensions buffer)) - (width (first dimensions)) - (height (second dimensions)) - (header (format nil "P6~A~D ~D~A255~A" - #\newline - width height #\newline - #\newline))) + (width (first dimensions)) + (height (second dimensions)) + (header (format nil "P6~A~D ~D~A255~A" + #\newline + width height #\newline + #\newline))) (loop - :for char :across header - :do (write-byte (char-code char) stream)) #| Assumes char-codes match ASCII |# + :for char :across header + :do (write-byte (char-code char) stream)) #| Assumes char-codes match ASCII |# (loop - :for x :upfrom 0 :below width - :do (loop :for y :upfrom 0 :below height - :do (let ((pixel (rgb-pixel buffer x y))) - (let ((red (rgb-pixel-red pixel)) - (green (rgb-pixel-green pixel)) - (blue (rgb-pixel-blue pixel))) - (write-byte red stream) - (write-byte green stream) - (write-byte blue stream))))))) + :for x :upfrom 0 :below width + :do (loop :for y :upfrom 0 :below height + :do (let ((pixel (rgb-pixel buffer x y))) + (let ((red (rgb-pixel-red pixel)) + (green (rgb-pixel-green pixel)) + (blue (rgb-pixel-blue pixel))) + (write-byte red stream) + (write-byte green stream) + (write-byte blue stream))))))) filename) diff --git a/Task/Bitmap-Write-a-PPM-file/Crystal/bitmap-write-a-ppm-file-1.cr b/Task/Bitmap-Write-a-PPM-file/Crystal/bitmap-write-a-ppm-file-1.cr new file mode 100644 index 0000000000..24affee476 --- /dev/null +++ b/Task/Bitmap-Write-a-PPM-file/Crystal/bitmap-write-a-ppm-file-1.cr @@ -0,0 +1,13 @@ +require "./pixmap" + +class Pixmap + def write_ppm (io) + io.print "P6\n# Visit Rosetta code!\n#{width} #{height}\n255\n" + @data.each do |c| + io.write_byte c.r + io.write_byte c.g + io.write_byte c.b + end + end + register_writer ".ppm", write_ppm +end diff --git a/Task/Bitmap-Write-a-PPM-file/Crystal/bitmap-write-a-ppm-file-2.cr b/Task/Bitmap-Write-a-PPM-file/Crystal/bitmap-write-a-ppm-file-2.cr new file mode 100644 index 0000000000..1e3919cea7 --- /dev/null +++ b/Task/Bitmap-Write-a-PPM-file/Crystal/bitmap-write-a-ppm-file-2.cr @@ -0,0 +1,14 @@ +require "./write_ppm" + +img = Pixmap.new 3, 2, Color::WHITE + +[[0xFF0000, 0x00FF00, 0x0000FF], + [0xFFFF00, 0x00FFFF, 0xFF00FF]].each_with_index do |row, y| + row.each_with_index do |color, x| + img[x, y] = Color.new color + end +end + +img.write "mini.ppm" + +File.read("mini.ppm").unsafe_byte_slice(0).hexdump(STDOUT) diff --git a/Task/Bitmap-Write-a-PPM-file/Delphi/bitmap-write-a-ppm-file.delphi b/Task/Bitmap-Write-a-PPM-file/Delphi/bitmap-write-a-ppm-file.pas similarity index 100% rename from Task/Bitmap-Write-a-PPM-file/Delphi/bitmap-write-a-ppm-file.delphi rename to Task/Bitmap-Write-a-PPM-file/Delphi/bitmap-write-a-ppm-file.pas diff --git a/Task/Bitmap-Write-a-PPM-file/Euphoria/bitmap-write-a-ppm-file-1.euphoria b/Task/Bitmap-Write-a-PPM-file/Euphoria/bitmap-write-a-ppm-file-1.eu similarity index 100% rename from Task/Bitmap-Write-a-PPM-file/Euphoria/bitmap-write-a-ppm-file-1.euphoria rename to Task/Bitmap-Write-a-PPM-file/Euphoria/bitmap-write-a-ppm-file-1.eu diff --git a/Task/Bitmap-Write-a-PPM-file/Euphoria/bitmap-write-a-ppm-file-2.euphoria b/Task/Bitmap-Write-a-PPM-file/Euphoria/bitmap-write-a-ppm-file-2.eu similarity index 100% rename from Task/Bitmap-Write-a-PPM-file/Euphoria/bitmap-write-a-ppm-file-2.euphoria rename to Task/Bitmap-Write-a-PPM-file/Euphoria/bitmap-write-a-ppm-file-2.eu diff --git a/Task/Bitmap-Write-a-PPM-file/FBSL/bitmap-write-a-ppm-file.fbsl b/Task/Bitmap-Write-a-PPM-file/FBSL/bitmap-write-a-ppm-file.fbsl index 2c7f0057d2..6db33e290f 100644 --- a/Task/Bitmap-Write-a-PPM-file/FBSL/bitmap-write-a-ppm-file.fbsl +++ b/Task/Bitmap-Write-a-PPM-file/FBSL/bitmap-write-a-ppm-file.fbsl @@ -12,12 +12,12 @@ DIM head = @ppmdata + STRLEN, tail = @FILEGET + FILELEN - breadth * 3 - 2 ' Star ppmdata = ppmheader ' Copy PPM file header WHILE tail >= @FILEGET + bmpblob ' Flip upside down - FOR DIM w = 0 TO (breadth - 1) * 3 STEP 3 - POKE(head + 0 + w, CHR(PEEK(tail + 2 + w, 1))) ' Swap R - POKE(head + 1 + w, CHR(PEEK(tail + 1 + w, 1))) ' Keep G - POKE(head + 2 + w, CHR(PEEK(tail + 0 + w, 1))) ' Swap B - NEXT - INCR(head, breadth * 3): DECR(tail, breadth * 3) ' Next scanline + FOR DIM w = 0 TO (breadth - 1) * 3 STEP 3 + POKE(head + 0 + w, CHR(PEEK(tail + 2 + w, 1))) ' Swap R + POKE(head + 1 + w, CHR(PEEK(tail + 1 + w, 1))) ' Keep G + POKE(head + 2 + w, CHR(PEEK(tail + 0 + w, 1))) ' Swap B + NEXT + INCR(head, breadth * 3): DECR(tail, breadth * 3) ' Next scanline WEND FILEPUT(FILEOPEN(ppmout, BINARY_NEW), ppmdata): FILECLOSE(FILEOPEN) diff --git a/Task/Bitmap-Write-a-PPM-file/FreeBASIC/bitmap-write-a-ppm-file.basic b/Task/Bitmap-Write-a-PPM-file/FreeBASIC/bitmap-write-a-ppm-file.basic new file mode 100644 index 0000000000..d658dc3b0d --- /dev/null +++ b/Task/Bitmap-Write-a-PPM-file/FreeBASIC/bitmap-write-a-ppm-file.basic @@ -0,0 +1,37 @@ +Dim As Integer ancho, alto +ancho = 150: alto = 200 +Dim As Integer x, y ' width, height +Dim As Ulong kolor +Screenres ancho, alto, 32 + +' Draw circles +Screenlock +Circle (75, 100), 50, Rgb(255, 0, 0),,,, F +Circle (75, 100), 35, Rgb(0, 255, 0),,,, F +Circle (75, 100), 20, Rgb(0, 0, 255),,,, F +Screenunlock + +' Open PPM file to write +Dim As Integer ff = Freefile +Open "example.ppm" For Binary As #ff +If Err > 0 Then Print "Error opening output file": End + +' Create PPM file header +Print #ff, "P6" +Print #ff, "# Created using FreeBASIC" +Print #ff, ancho & " " & alto +Print #ff, "255" + +' Write image data to PPM file +For y = 0 To alto - 1 + For x = 0 To ancho - 1 + kolor = Point(x, y) + Put #ff, , Cbyte(kolor Shr 8) ' Green + Put #ff, , Cbyte(kolor) ' Blue + Put #ff, , Cbyte(kolor Shr 16) ' Red + Next +Next + +Close #ff + +Sleep diff --git a/Task/Bitmap-Write-a-PPM-file/Julia/bitmap-write-a-ppm-file.julia b/Task/Bitmap-Write-a-PPM-file/Julia/bitmap-write-a-ppm-file.jl similarity index 100% rename from Task/Bitmap-Write-a-PPM-file/Julia/bitmap-write-a-ppm-file.julia rename to Task/Bitmap-Write-a-PPM-file/Julia/bitmap-write-a-ppm-file.jl diff --git a/Task/Bitmap-Write-a-PPM-file/Kotlin/bitmap-write-a-ppm-file.kotlin b/Task/Bitmap-Write-a-PPM-file/Kotlin/bitmap-write-a-ppm-file.kts similarity index 100% rename from Task/Bitmap-Write-a-PPM-file/Kotlin/bitmap-write-a-ppm-file.kotlin rename to Task/Bitmap-Write-a-PPM-file/Kotlin/bitmap-write-a-ppm-file.kts diff --git a/Task/Bitmap-Write-a-PPM-file/M2000-Interpreter/bitmap-write-a-ppm-file-1.m2000 b/Task/Bitmap-Write-a-PPM-file/M2000-Interpreter/bitmap-write-a-ppm-file-1.m2000 index c2892cc958..b3c4b9607b 100644 --- a/Task/Bitmap-Write-a-PPM-file/M2000-Interpreter/bitmap-write-a-ppm-file-1.m2000 +++ b/Task/Bitmap-Write-a-PPM-file/M2000-Interpreter/bitmap-write-a-ppm-file-1.m2000 @@ -50,26 +50,28 @@ Module Checkit { Return Image1, 0:=Image$ } Else Error "Can't Copy Image" } - Export2File=Lambda Image1, x, y (f) -> { + Export2File=Lambda Image1, x, y, r=len(rasterline) (f) -> { \\ use this between open and close Print #f, "P3" Print #f,"# Created using M2000 Interpreter" Print #f, x;" ";y Print #f, 255 x2=x-1 - where=24 - For y1= 0 to y-1 { + For y1= y-1 to 0 { a$="" - For x1=0 to x2 { - Print #f, a$;Eval(Image1, where +2 as byte);" "; + where=24+r*y1 + x1=0 + Print #f, Eval(Image1, where +2 as byte);" "; + Print #f, Eval(Image1, where+1 as byte);" "; + Print #f, Eval(Image1, where as byte); + where+=3 + For x1=1 to x2 { + Print #f, " ";Eval(Image1, where +2 as byte);" "; Print #f, Eval(Image1, where+1 as byte);" "; Print #f, Eval(Image1, where as byte); where+=3 - a$=" " } Print #f - m=where mod 4 - if m<>0 then where+=4-m } } Group Bitmap { @@ -81,31 +83,10 @@ Module Checkit { } =Bitmap } - A=Bitmap(10, 10) Call A.SetPixel(5,5, color(128,0,255)) Open "A2.PPM" for Output as #F Call A.ToFile(F) Close #f - ' is the same as this one - Try { - Open "A.PPM" for Output as #F - Print #f, "P3" - Print #f,"# Created using M2000 Interpreter" - Print #f, 10;" ";10 - Print #f, 255 - For y=10-1 to 0 { - a$="" - For x=0 to 10-1 { - rgb=-A.GetPixel(x, y) - Print #f, a$;Binary.And(rgb, 0xFF); " "; - Print #f, Binary.And(Binary.Shift(rgb, -8), 0xFF); " "; - Print #f, Binary.Shift(rgb, -16); - a$=" " - } - Print #f - } - Close #f - } } Checkit diff --git a/Task/Bitmap-Write-a-PPM-file/M2000-Interpreter/bitmap-write-a-ppm-file-2.m2000 b/Task/Bitmap-Write-a-PPM-file/M2000-Interpreter/bitmap-write-a-ppm-file-2.m2000 index f65d2af1b7..0cc430b1ff 100644 --- a/Task/Bitmap-Write-a-PPM-file/M2000-Interpreter/bitmap-write-a-ppm-file-2.m2000 +++ b/Task/Bitmap-Write-a-PPM-file/M2000-Interpreter/bitmap-write-a-ppm-file-2.m2000 @@ -1,177 +1,180 @@ -Module PPMbinaryP6 { - If Version<9.4 then 1000 - If Version=9.4 Then if Revision<19 then 1000 - Module Checkit { - Function Bitmap { - def x as long, y as long - If match("NN") then { - Read x, y - } else.if Match("N") Then { - E$="Not a ppm file" - Read f as long - buffer whitespace as byte - if not Eof(f) then { - get #f, whitespace : iF eof(f) then Error E$ - P6$=eval$(whitespace) - get #f, whitespace : iF eof(f) then Error E$ - P6$+=eval$(whitespace) - def boolean getW=true, getH=true, getV=true - def long v - \\ str$("P6") has 2 bytes. "P6" has 4 bytes - If p6$=str$("P6") Then { - do { - get #f, whitespace - if Eval$(whitespace)=str$("#") then { - do { - iF eof(f) then Error E$ - get #f, whitespace - } until eval(whitespace)=10 - } else { - select case eval(whitespace) - case 32, 9, 13, 10 - { - if getW and x<>0 then { - getW=false - } else.if getH and y<>0 then { - getH=false - } else.if getV and v<>0 then { - getV=false - } - } - case 48 to 57 - { - if getW then { - x*=10 - x+=eval(whitespace, 0)-48 - } else.if getH then { - y*=10 - y+=eval(whitespace, 0)-48 - } else.if getV then { - v*=10 - v+=eval(whitespace, 0)-48 - } - } - End Select - } - iF eof(f) then Error E$ - } until getV=false - } else Error "Not a P6 ppm" - } - } else Error "No proper arguments" - if x<1 or y<1 then Error "Wrong dimensions" - structure rgb { - red as byte - green as byte - blue as byte - } - m=len(rgb)*x mod 4 - if m>0 then m=4-m ' add some bytes to raster line - m+=len(rgb) *x - Structure rasterline { - { - pad as byte*m - } - \\ union pad+hline - hline as rgb*x - } - \\ we use union linesB and lines - \\ so we can address linesb as bytes - Structure Raster { - magic as integer*4 - w as integer*4 - h as integer*4 - { - linesB as byte*len(rasterline)*y - } - lines as rasterline*y - } - Buffer Clear Image1 as Raster - \\ 24 chars as header to be used from bitmap render build in functions - Return Image1, 0!magic:="cDIB", 0!w:=Hex$(x,2), 0!h:=Hex$(y, 2) - \\ fill white (all 255) - \\ Str$(string) convert to ascii, so we get all characters from words width to byte width - if not valid(f) then Return Image1, 0!lines:=Str$(String$(chrcode$(255), Len(rasterline)*y)) - Buffer Clear Pad as Byte*4 - SetPixel=Lambda Image1, Pad,aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x, y, c) ->{ - where=alines+3*x+blines*y - if c>0 then c=color(c) - c-! - Return Pad, 0:=c as long - Return Image1, 0!where:=Eval(Pad, 2) as byte, 0!where+1:=Eval(Pad, 1) as byte, 0!where+2:=Eval(Pad, 0) as byte - } - GetPixel=Lambda Image1,aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x,y) ->{ - where=alines+3*x+blines*y - =color(Eval(image1, where+2 as byte), Eval(image1, where+1 as byte), Eval(image1, where as byte)) - } - StrDib$=Lambda$ Image1, Raster -> { - =Eval$(Image1, 0, Len(Raster)) - } - CopyImage=Lambda Image1 (image$) -> { - if left$(image$,12)=Eval$(Image1, 0, 24 ) Then { - Return Image1, 0:=Image$ - } Else Error "Can't Copy Image" - } - Export2File=Lambda Image1, x, y (f) -> { - \\ use this between open and close - Print #f, "P6";chr$(10); - Print #f,"# Created using M2000 Interpreter";chr$(10); - Print #f, x;" ";y;" 255";chr$(10); - x2=x-1 - where=0 - Buffer pad as byte*3 - For y1= 0 to y-1 { - For x1=0 to x2 { - \\ use linesB which is array of bytes - Return pad, 0:=eval$(image1, 0!linesB!where, 3) - Push Eval(pad, 2) - Return pad, 2:=Eval(pad, 0), 0:=Number - Put #f, pad - where+=3 - } - m=where mod 4 - if m<>0 then where+=4-m - } - } - if valid(F) then { - x0=x-1 - where=0 - Buffer Pad1 as byte*3 - For y1=y-1 to 0 { - For x1=0 to x0 { - Get #f, Pad1 ' Read binary - \\ reverse rgb - Push Eval(pad1, 2) - Return pad1, 2:=Eval(pad1, 0), 0:=Number - Return Image1, 0!linesB!where:=Eval$(Pad1) - where+=3 +Module P6 { + Function Bitmap { + def x as long, y as long, Import as boolean + If match("NN") then + Read x, y + else.if Match("N") Then + \\ is a file? + Read f as long + byte whitespace[0] + if not Eof(f) then + get #f, whitespace :P6$=chr$(whitespace[0]) + get #f, whitespace : P6$+=chr$(whitespace[0]) + boolean getW=true, getH=true, getV=true + long v + If p6$="P6" Then + do + get #f, whitespace + select case whitespace[0] + case 35 + {do get #f, whitespace + until whitespace[0]=10 } - m=where mod 4 - if m<>0 then where+=4-m - } - } - Group Bitmap { - SetPixel=SetPixel - GetPixel=GetPixel - Image$=StrDib$ - Copy=CopyImage - ToFile=Export2File - } - =Bitmap + case 32, 9, 13, 10 + { if getW and x<>0 then + getW=false + else.if getH and y<>0 then + getH=false + else.if getV and v<>0 then + getV=false + end if + } + case 48 to 57 + {if getW then + x*=10 + x+=whitespace[0]-48 + else.if getH then + y*=10 + y+=whitespace[0]-48 + else.if getV then + v*=10 + v+=whitespace[0]-48 + end if + } + End Select + iF eof(f) then Error "Not a ppm file" + until getV=false + else + Error "Not a P6 ppm" + end if + Import=True + end if + else + Error "No proper arguments" + end if + if x<1 or y<1 then Error "Wrong dimensions" + structure rgb { + red as byte + green as byte + blue as byte } - A=Bitmap(10, 10) - Call A.SetPixel(5,5, color(128,0,255)) - Open "A.PPM" for Output as #F - Call A.ToFile(F) - Close #f - - Print "Saved" - Open "A.PPM" for Input as #F - C=Bitmap(f) - Copy 400*twipsx,200*twipsy use C.Image$() - Close #f - } - Checkit - End - 1000 Error "Need Version 9.4, Revision 19 or higher" + m=len(rgb)*x mod 4 + if m>0 then m=4-m ' add some bytes to raster line + m+=len(rgb) *x + Structure rasterline { + { + pad as byte*m + } + hline as rgb*x + } + Structure Raster { + magic as integer*4 + w as integer*4 + h as integer*4 + { + linesB as byte*len(rasterline)*y + } + lines as rasterline*y + } + Buffer Clear Image1 as Raster + Return Image1, 0!magic:="cDIB", 0!w:=Hex$(x,2), 0!h:=Hex$(y, 2) + if not Import then Return Image1, 0!lines:=Str$(String$(chrcode$(255), Len(rasterline)*y)) + Buffer Clear Pad as Byte*4 + SetPixel=Lambda Image1, Pad, aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x, y, c) ->{ + where=alines+3*x+blines*y + if c>0 then c=color(c) + c-! + Return Pad, 0:=c as long + Return Image1, 0!where:=Eval(Pad, 2) as byte, 0!where+1:=Eval(Pad, 1) as byte, 0!where+2:=Eval(Pad, 0) as byte + } + GetPixel=Lambda Image1,aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x,y) ->{ + where=alines+3*x+blines*y + =color(Eval(image1, where+2 as byte), Eval(image1, where+1 as byte), Eval(image1, where as byte)) + } + StrDib$=Lambda$ Image1, Raster -> { + =Eval$(Image1, 0, Len(Raster)) + } + CopyImage=Lambda Image1 (image$) -> { + if left$(image$,12)=Eval$(Image1, 0, 24 ) Then { + Return Image1, 0:=Image$ + } Else Error "Can't Copy Image" + } + Export2File=Lambda Image1, x, y (f) -> { + Print #f, "P6";chr$(10);"# Created using M2000 Interpreter";chr$(10); + Print #f, x;" ";y;" 255";chr$(10); + x2=x-1 : where=0 + x0=x*3 + structure rgbP6 { + r as byte + g as byte + b as byte + } + buffer Pad as rgbP6*x*y + For y1=y-1 to 0 { + Return pad, x*y1:=eval$(image1, 0!linesB!where, x0) + where+=x0 + m=where mod 4 : if m<>0 then where+=4-m + } + For x1=0 to x*y-1 { + Push Eval(pad, x1!b) : Return pad, x1!b:=Eval(pad, x1!r), x1!r:=Number + } + Put #f, pad + } + if Import then { + x0=x-1 : where=0 + structure rgbP6 { + r as byte + g as byte + b as byte + } + buffer Pad1 as rgbP6*x*y + Get #f, Pad1 + For x1=0 to x*y-1 { + Push Eval(pad1, x1!b) : Return pad1, x1!b:=Eval(pad1, x1!r), x1!r:=Number + } + x1=x*3 + For y1=y-1 to 0 { + Return Image1, 0!linesB!where:=Eval$(Pad1, y1*x, x1) + where+=3*(x0+1) + m=where mod 4 : if m<>0 then where+=4-m + } + } + Group Bitmap { + SetPixel=SetPixel + GetPixel=GetPixel + Image$=StrDib$ + Copy=CopyImage + ToFile=Export2File + } + =Bitmap + } + A=Bitmap(150,100) + For i=0 to 98 { + Call A.SetPixel(i, i, 0) + Call A.SetPixel(99, i, 0) + } + Call A.SetPixel(i,i,0) + Copy 200*twipsx, 100*twipsy use A.Image$() + Profiler + Open "a.ppm" for output as #F + Call A.tofile(f) + Close #f + Print Filelen("a.ppm") + Print Timecount/1000;"sec" + Profiler + exit + Image A.Image$() Export "a.jpg", 100 ' per cent quality + Print Filelen("a.jpg") + Image A.Image$() Export "a1.jpg", 10 ' per cent quality + Print Filelen("a1.jpg") + Image A.Image$() Export "a.bmp" + Print Filelen("a.bmp") ' no compression + Print Timecount/1000;"sec" + Move 5000,5000 ' twips + Image "a.jpg" + Move 5000,8000 + Image "a1.jpg" + Move 8000, 5000 + Image "a.bmp" } -PPMbinaryP6 +p6 diff --git a/Task/Bitmap-Write-a-PPM-file/Oz/bitmap-write-a-ppm-file.oz b/Task/Bitmap-Write-a-PPM-file/Oz/bitmap-write-a-ppm-file.oz index dca6a5e19e..c05f456d0a 100644 --- a/Task/Bitmap-Write-a-PPM-file/Oz/bitmap-write-a-ppm-file.oz +++ b/Task/Bitmap-Write-a-PPM-file/Oz/bitmap-write-a-ppm-file.oz @@ -12,28 +12,28 @@ define F = {New Open.file init(name:Filename flags:[write create truncate binary])} proc {WriteColor8 color(R G B)} - {F write(vs:[R G B])} + {F write(vs:[R G B])} end fun {ToBytes C} - [C div 0x100 C mod 0x100] + [C div 0x100 C mod 0x100] end proc {WriteColor16 color(R G B)} - {F write(vs:{Flatten {Map [R G B] ToBytes}})} + {F write(vs:{Flatten {Map [R G B] ToBytes}})} end MaxCol = {Bitmap.maxValue B} MaxVal#Writer = if MaxCol =< 0xff then 0xff#WriteColor8 - else 0xffff#WriteColor16 - end + else 0xffff#WriteColor16 + end Header = "P6\n"#W#" "#H#" "#MaxVal#"\n" in try - {F write(vs:Header)} - {Bitmap.forAllPixels B Writer} + {F write(vs:Header)} + {Bitmap.forAllPixels B Writer} finally - {F close} + {F close} end end end diff --git a/Task/Bitmap-Write-a-PPM-file/Prolog/bitmap-write-a-ppm-file-1.pro b/Task/Bitmap-Write-a-PPM-file/Prolog/bitmap-write-a-ppm-file-1.pro index c10545d911..7b7fd228ad 100644 --- a/Task/Bitmap-Write-a-PPM-file/Prolog/bitmap-write-a-ppm-file-1.pro +++ b/Task/Bitmap-Write-a-PPM-file/Prolog/bitmap-write-a-ppm-file-1.pro @@ -1,16 +1,16 @@ :- module(bitmapIO, [ - write_ppm_p6/2]). + write_ppm_p6/2]). :- use_module(library(lists)). %write_ppm_p6(File,Bitmap) write_ppm_p6(Filename,[[X,Y],Pixels]):- - open(Filename,write,Output,[encoding(octet)]), - %write p6 header - writeln(Output, 'P6'), - atomic_list_concat([X, Y], ' ', Dimensions), - writeln(Output, Dimensions), - writeln(Output, '255'), - %write bytes - maplist(maplist(maplist(put_byte(Output))),Pixels), - close(Output). + open(Filename,write,Output,[encoding(octet)]), + %write p6 header + writeln(Output, 'P6'), + atomic_list_concat([X, Y], ' ', Dimensions), + writeln(Output, Dimensions), + writeln(Output, '255'), + %write bytes + maplist(maplist(maplist(put_byte(Output))),Pixels), + close(Output). diff --git a/Task/Bitmap-Write-a-PPM-file/Prolog/bitmap-write-a-ppm-file-2.pro b/Task/Bitmap-Write-a-PPM-file/Prolog/bitmap-write-a-ppm-file-2.pro index 6c3b784711..63e26ab585 100644 --- a/Task/Bitmap-Write-a-PPM-file/Prolog/bitmap-write-a-ppm-file-2.pro +++ b/Task/Bitmap-Write-a-PPM-file/Prolog/bitmap-write-a-ppm-file-2.pro @@ -2,6 +2,6 @@ :- use_module(bitmapIO). write :- - new_bitmap(AllBlack,[50,50],[0,0,0]), - set_pixel0(AlmostAllBlack,AllBlack,[25,25],[255,255,255]), - write_ppm_p6('AlmostAllBlack.ppm',AlmostAllBlack). + new_bitmap(AllBlack,[50,50],[0,0,0]), + set_pixel0(AlmostAllBlack,AllBlack,[25,25],[255,255,255]), + write_ppm_p6('AlmostAllBlack.ppm',AlmostAllBlack). diff --git a/Task/Bitmap-Write-a-PPM-file/Raku/bitmap-write-a-ppm-file.raku b/Task/Bitmap-Write-a-PPM-file/Raku/bitmap-write-a-ppm-file.raku index 3efa08e181..7739ea243e 100644 --- a/Task/Bitmap-Write-a-PPM-file/Raku/bitmap-write-a-ppm-file.raku +++ b/Task/Bitmap-Write-a-PPM-file/Raku/bitmap-write-a-ppm-file.raku @@ -7,9 +7,9 @@ class Bitmap { @!data = $p.clone xx ($!width*$!height) } method pixel( - $i where ^$!width, - $j where ^$!height - --> Pixel + $i where ^$!width, + $j where ^$!height + --> Pixel ) is rw { @!data[$i*$!height + $j] } method data { @!data } @@ -17,8 +17,8 @@ class Bitmap { role PPM { method P6 returns Blob { - "P6\n{self.width} {self.height}\n255\n".encode('ascii') - ~ Blob.new: flat map { .R, .G, .B }, self.data + "P6\n{self.width} {self.height}\n255\n".encode('ascii') + ~ Blob.new: flat map { .R, .G, .B }, self.data } } diff --git a/Task/Bitmap-Write-a-PPM-file/Rebol/bitmap-write-a-ppm-file.rebol b/Task/Bitmap-Write-a-PPM-file/Rebol/bitmap-write-a-ppm-file.rebol new file mode 100644 index 0000000000..fd0ef3b840 --- /dev/null +++ b/Task/Bitmap-Write-a-PPM-file/Rebol/bitmap-write-a-ppm-file.rebol @@ -0,0 +1,57 @@ +Rebol [ + title: "Rosetta code: Bitmap/Write a PPM file" + file: %Bitmap-Write_a_PPM_file.r3 + url: https://rosettacode.org/wiki/Bitmap/Write_a_PPM_file +] + +to-ppm: function [ + "Converts an image to a PPM (Portable Pixmap) format string" + ;; This function is using padding in the output. + ;; In the real life usage it could be removed. + img [image!] +][ + ;; Extract image dimensions as integers + wide: to integer! img/size/x + high: to integer! img/size/y + + ;; Build the PPM header: + ;; P3 = plain RGB text format + ;; wide/high = pixel dimensions + ;; 255 = max color value (8-bit per channel) + out: rejoin ["P3^/" wide SP high "^/255^/"] + + ;; Iterate over every pixel in the image + n: 0 ;; Pixel counter, used to detect end of each row + foreach clr img [ + ++ n + ;; Append R, G, B channel values, right-aligned in fixed-width columns + ;; pad ... -5/-4 = right-align in field of 5 or 4 characters + append out ajoin [ + pad clr/1 -5 ;R + pad clr/2 -4 ;G + pad clr/3 -4 ;B + ;; After the last pixel in each row, insert a newline + if zero? n % wide [ newline ] + ] + ] + out +] + +; --- Demo --- +; Create a 2x2 image and set pixels 1 (top-left) and 4 (bottom-right) to black +img: make image! 2x2 +img/1: img/4: black +print to-ppm img + +;; It is also possible to register a PPM codec +register-codec [ + name: 'ppm + type: 'image + title: "Portable Pixmap (PPM) File Format" + suffixes: [%.ppm] + encode: :to-ppm +] +;; Then use it as: +ppm-data: encode 'ppm img +;; or +save %image.ppm img diff --git a/Task/Bitmap-Write-a-PPM-file/Rust/bitmap-write-a-ppm-file.rust b/Task/Bitmap-Write-a-PPM-file/Rust/bitmap-write-a-ppm-file.rs similarity index 100% rename from Task/Bitmap-Write-a-PPM-file/Rust/bitmap-write-a-ppm-file.rust rename to Task/Bitmap-Write-a-PPM-file/Rust/bitmap-write-a-ppm-file.rs diff --git a/Task/Bitmap-Write-a-PPM-file/Scheme/bitmap-write-a-ppm-file-1.ss b/Task/Bitmap-Write-a-PPM-file/Scheme/bitmap-write-a-ppm-file-1.scm similarity index 100% rename from Task/Bitmap-Write-a-PPM-file/Scheme/bitmap-write-a-ppm-file-1.ss rename to Task/Bitmap-Write-a-PPM-file/Scheme/bitmap-write-a-ppm-file-1.scm diff --git a/Task/Bitmap-Write-a-PPM-file/Scheme/bitmap-write-a-ppm-file-2.ss b/Task/Bitmap-Write-a-PPM-file/Scheme/bitmap-write-a-ppm-file-2.scm similarity index 100% rename from Task/Bitmap-Write-a-PPM-file/Scheme/bitmap-write-a-ppm-file-2.ss rename to Task/Bitmap-Write-a-PPM-file/Scheme/bitmap-write-a-ppm-file-2.scm diff --git a/Task/Bitmap-Write-a-PPM-file/Stata/bitmap-write-a-ppm-file.stata b/Task/Bitmap-Write-a-PPM-file/Stata/bitmap-write-a-ppm-file.stata index 62077b718a..23beb00d54 100644 --- a/Task/Bitmap-Write-a-PPM-file/Stata/bitmap-write-a-ppm-file.stata +++ b/Task/Bitmap-Write-a-PPM-file/Stata/bitmap-write-a-ppm-file.stata @@ -1,16 +1,16 @@ mata void writeppm(name, r, g, b) { - n = rows(r) - p = cols(r) - f = fopen(name, "w") - fput(f, "P3") - fput(f, strofreal(p) + " " + strofreal(n) + " 255") - for (i = 1; i <= n; i++) { - for (j = 1; j <= p; j++) { - fput(f, strofreal(r[i,j]) + " " + strofreal(g[i,j]) + " " + strofreal(b[i,j])) - } - } - fclose(f) + n = rows(r) + p = cols(r) + f = fopen(name, "w") + fput(f, "P3") + fput(f, strofreal(p) + " " + strofreal(n) + " 255") + for (i = 1; i <= n; i++) { + for (j = 1; j <= p; j++) { + fput(f, strofreal(r[i,j]) + " " + strofreal(g[i,j]) + " " + strofreal(b[i,j])) + } + } + fclose(f) } r = J(1, 6, (0::5) * 51) diff --git a/Task/Bitmap-Write-a-PPM-file/Wren/bitmap-write-a-ppm-file.wren b/Task/Bitmap-Write-a-PPM-file/Wren/bitmap-write-a-ppm-file.wren index f5e11667c2..a7b0e9e575 100644 --- a/Task/Bitmap-Write-a-PPM-file/Wren/bitmap-write-a-ppm-file.wren +++ b/Task/Bitmap-Write-a-PPM-file/Wren/bitmap-write-a-ppm-file.wren @@ -1,6 +1,7 @@ import "graphics" for Canvas, ImageData, Color import "dome" for Window, Process import "io" for FileSystem +import "./str" for Strs class Bitmap { construct new(name, width, height) { @@ -21,16 +22,16 @@ class Bitmap { init() { // write bitmap to a PPM file - var ppm = "P6\n%(_w) %(_h)\n255\n" + var ppm = ["P6\n%(_w) %(_h)\n255\n"] for (y in 0..._h) { for (x in 0..._w) { var c = pget(x, y) - ppm = ppm + String.fromByte(c.r) - ppm = ppm + String.fromByte(c.g) - ppm = ppm + String.fromByte(c.b) + ppm.add(String.fromByte(c.r)) + ppm.add(String.fromByte(c.g)) + ppm.add(String.fromByte(c.b)) } } - FileSystem.save("output.ppm", ppm) + FileSystem.save("output.ppm", Strs.concat(ppm)) Process.exit(0) } diff --git a/Task/Bitmap-Write-a-PPM-file/Yabasic/bitmap-write-a-ppm-file.basic b/Task/Bitmap-Write-a-PPM-file/Yabasic/bitmap-write-a-ppm-file.basic index 3d5929176a..9f907661eb 100644 --- a/Task/Bitmap-Write-a-PPM-file/Yabasic/bitmap-write-a-ppm-file.basic +++ b/Task/Bitmap-Write-a-PPM-file/Yabasic/bitmap-write-a-ppm-file.basic @@ -18,12 +18,12 @@ fn = open("exmaple.PPM", "wb") print #fn header$ for x = 0 to hei - 1 - for y = 0 to wid - 1 - c$ = right$(getbit$(y, x, y, x), 6) - poke #fn, dec(left$(c$, 2)) - poke #fn, dec(right$(c$, 2)) - poke #fn, dec(mid$(c$, 3, 2)) - next y + for y = 0 to wid - 1 + c$ = right$(getbit$(y, x, y, x), 6) + poke #fn, dec(left$(c$, 2)) + poke #fn, dec(right$(c$, 2)) + poke #fn, dec(mid$(c$, 3, 2)) + next y next x poke #fn, asc("\n") diff --git a/Task/Bitmap/11l/bitmap.11l b/Task/Bitmap/11l/bitmap.11l index 1c27ab573c..66ed317106 100644 --- a/Task/Bitmap/11l/bitmap.11l +++ b/Task/Bitmap/11l/bitmap.11l @@ -1,13 +1,4 @@ -T Colour - Byte r, g, b - - F (r, g, b) - .r = r - .g = g - .b = b - - F ==(other) - R .r == other.r & .g == other.g & .b == other.b +T Colour = Vec3b V black = Colour(0, 0, 0) V white = Colour(255, 255, 255) diff --git a/Task/Bitmap/ALGOL-68/bitmap-1.alg b/Task/Bitmap/ALGOL-68/bitmap-1.alg deleted file mode 100644 index 896165161a..0000000000 --- a/Task/Bitmap/ALGOL-68/bitmap-1.alg +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- # - -MODE PIXEL = STRUCT(#SHORT# BITS red,green,blue); -MODE POINT = STRUCT(INT x,y); - -MODE IMAGE = [0,0]PIXEL; # instance attributes # - -MODE CLASSIMAGE = STRUCT ( # class attributes # - PIXEL black, red, green, blue, white, - PROC (REF IMAGE)REF IMAGE init, - PROC (REF IMAGE, PIXEL)VOID fill, - PROC (REF IMAGE)VOID print, -# virtual: # - REF PROC (REF IMAGE, POINT, POINT, PIXEL)VOID line, - REF PROC (REF IMAGE, POINT, INT, PIXEL)VOID circle, - REF PROC (REF IMAGE, POINT, POINT, POINT, POINT, PIXEL, UNION(INT, VOID))VOID cubic bezier -); - -CLASSIMAGE class image = ( - # black = # (#SHORTEN# 16r00, #SHORTEN# 16r00, #SHORTEN# 16r00), - # red = # (#SHORTEN# 16rff, #SHORTEN# 16r00, #SHORTEN# 16r00), - # green = # (#SHORTEN# 16r00, #SHORTEN# 16rff, #SHORTEN# 16r00), - # blue = # (#SHORTEN# 16r00, #SHORTEN# 16r00, #SHORTEN# 16rff), - # white = # (#SHORTEN# 16rff, #SHORTEN# 16rff, #SHORTEN# 16rff), - # PROC init = # (REF IMAGE self)REF IMAGE: - BEGIN - (fill OF class image)(self, black OF class image); - self - END, - - # PROC fill = # (REF IMAGE self, PIXEL color)VOID: - FOR x FROM 1 LWB self TO 1 UPB self DO - FOR y FROM 2 LWB self TO 2 UPB self DO - self[x,y] := color - OD - OD, - # PROC print = # (REF IMAGE self)VOID: - printf(($n(UPB self)(3(16r2d))l$, self)), -# virtual: # - # REF PROC line = # LOC PROC (REF IMAGE, POINT, POINT, PIXEL)VOID, - # REF PROC circle = # LOC PROC (REF IMAGE, POINT, INT, PIXEL)VOID, - # REF PROC cubic bezier = # LOC PROC (REF IMAGE, POINT, POINT, POINT, POINT, PIXEL, UNION(INT, VOID))VOID -); - -OP CLASSOF = (IMAGE image)CLASSIMAGE: class image; -OP INIT = (REF IMAGE image)REF IMAGE: (init OF (CLASSOF image))(image); - -SKIP diff --git a/Task/Bitmap/ALGOL-68/bitmap-2.alg b/Task/Bitmap/ALGOL-68/bitmap.alg similarity index 100% rename from Task/Bitmap/ALGOL-68/bitmap-2.alg rename to Task/Bitmap/ALGOL-68/bitmap.alg diff --git a/Task/Bitmap/ARM-Assembly/bitmap.arm b/Task/Bitmap/ARM-Assembly/bitmap.arm index a10f4f2666..a547d1f0c9 100644 --- a/Task/Bitmap/ARM-Assembly/bitmap.arm +++ b/Task/Bitmap/ARM-Assembly/bitmap.arm @@ -1,51 +1,51 @@ Bitmap_FloodFill: - ;input: - ;r0 = color to fill screen with (15-bit color) - STMFD sp!,{r0-r12,lr} - - MOV R2,#160 - MOV R4,#0x06000000 + ;input: + ;r0 = color to fill screen with (15-bit color) + STMFD sp!,{r0-r12,lr} + + MOV R2,#160 + MOV R4,#0x06000000 outerloop_floodfill: - MOV R1,#240 ;restore inner loop counter + MOV R1,#240 ;restore inner loop counter innerloop_floodfill: - strH r0,[r4] - add r4,r4,#2 ;next pixel - subs r1,r1,#1 ;decrement loop counter - bne innerloop_floodfill - subs r2,r2,#1 - bne outerloop_floodfill - - LDMFD sp!,{r0-r12,pc} - + strH r0,[r4] + add r4,r4,#2 ;next pixel + subs r1,r1,#1 ;decrement loop counter + bne innerloop_floodfill + subs r2,r2,#1 + bne outerloop_floodfill + + LDMFD sp!,{r0-r12,pc} + Bitmap_Locate: ;given x and y coordinates, offsets vram addr to that pixel on screen. - ;input: - ;r0 = x - ;r1 = y - ;output: r2 = vram area - STMFD sp!,{r4-r12,lr} - mov r2,#0x06000000 ;vram base + ;input: + ;r0 = x + ;r1 = y + ;output: r2 = vram area + STMFD sp!,{r4-r12,lr} + mov r2,#0x06000000 ;vram base + + + mov r4,#240*2 ;240 pixels across, 2 bytes per pixel + mul r1,r4,r1 + add r2,r2,r1 ;add y*480 + add r2,r2,r0,lsl #1 ;add x*2 + LDMFD sp!,{r4-r12,pc} - - mov r4,#240*2 ;240 pixels across, 2 bytes per pixel - mul r1,r4,r1 - add r2,r2,r1 ;add y*480 - add r2,r2,r0,lsl #1 ;add x*2 - LDMFD sp!,{r4-r12,pc} - Bitmap_StorePixel: - ;input: r3 = color - ;r0 = x - ;r1 = y - bl Bitmap_Locate - strH r3,[r2] ;store the pixel color in video memory - bx lr - + ;input: r3 = color + ;r0 = x + ;r1 = y + bl Bitmap_Locate + strH r3,[r2] ;store the pixel color in video memory + bx lr + Bitmap_GetPixel: ;retrieves the color of the pixel at [r2] and stores its color value in r3. - ;r0 = x - ;r1 = y - ;output in r3 - bl Bitmap_Locate - ldrH r3,[r2] - bx lr + ;r0 = x + ;r1 = y + ;output in r3 + bl Bitmap_Locate + ldrH r3,[r2] + bx lr diff --git a/Task/Bitmap/Ada/bitmap-1.ada b/Task/Bitmap/Ada/bitmap-1.adb similarity index 100% rename from Task/Bitmap/Ada/bitmap-1.ada rename to Task/Bitmap/Ada/bitmap-1.adb diff --git a/Task/Bitmap/Ada/bitmap-2.ada b/Task/Bitmap/Ada/bitmap-2.adb similarity index 100% rename from Task/Bitmap/Ada/bitmap-2.ada rename to Task/Bitmap/Ada/bitmap-2.adb diff --git a/Task/Bitmap/Ada/bitmap-3.ada b/Task/Bitmap/Ada/bitmap-3.adb similarity index 100% rename from Task/Bitmap/Ada/bitmap-3.ada rename to Task/Bitmap/Ada/bitmap-3.adb diff --git a/Task/Bitmap/AutoHotkey/bitmap.ahk b/Task/Bitmap/AutoHotkey/bitmap.ahk index 791a7d7bc8..2c8ccd888f 100644 --- a/Task/Bitmap/AutoHotkey/bitmap.ahk +++ b/Task/Bitmap/AutoHotkey/bitmap.ahk @@ -21,13 +21,13 @@ background := black if !BitmapType BitmapType := Object("fill", "Bitmap_Fill" - ,"write", "Bitmap_write_ppm3") + ,"write", "Bitmap_write_ppm3") - img := Object("width", width + img := Object("width", width ,"height", height , "base" , BitmapType) - img._SetCapacity(height) ; an array of rows + img._SetCapacity(height) ; an array of rows img.fill(background) Return img } diff --git a/Task/Bitmap/C/bitmap-1.c b/Task/Bitmap/C/bitmap-1.c index 44b484cea5..0ff4592b18 100644 --- a/Task/Bitmap/C/bitmap-1.c +++ b/Task/Bitmap/C/bitmap-1.c @@ -24,14 +24,14 @@ void fill_img(image img, color_component g, color_component b ); void put_pixel_unsafe( - image img, + image img, unsigned int x, unsigned int y, color_component r, color_component g, color_component b ); void put_pixel_clip( - image img, + image img, unsigned int x, unsigned int y, color_component r, diff --git a/Task/Bitmap/C/bitmap-2.c b/Task/Bitmap/C/bitmap-2.c index 22756034b3..b8b6167bce 100644 --- a/Task/Bitmap/C/bitmap-2.c +++ b/Task/Bitmap/C/bitmap-2.c @@ -31,7 +31,7 @@ void fill_img( } void put_pixel_unsafe( - image img, + image img, unsigned int x, unsigned int y, color_component r, @@ -46,7 +46,7 @@ void put_pixel_unsafe( } void put_pixel_clip( - image img, + image img, unsigned int x, unsigned int y, color_component r, diff --git a/Task/Bitmap/Clojure/bitmap.clj b/Task/Bitmap/Clojure/bitmap.clj index b447f4462c..d2bba0e538 100644 --- a/Task/Bitmap/Clojure/bitmap.clj +++ b/Task/Bitmap/Clojure/bitmap.clj @@ -1,5 +1,5 @@ (import '[java.awt Color Graphics Image] - '[java.awt.image BufferedImage]) + '[java.awt.image BufferedImage]) (defn blank-bitmap [width height] (BufferedImage. width height BufferedImage/TYPE_3BYTE_BGR)) diff --git a/Task/Bitmap/Common-Lisp/bitmap-2.lisp b/Task/Bitmap/Common-Lisp/bitmap-2.lisp index c50a1e9e8a..926118a474 100644 --- a/Task/Bitmap/Common-Lisp/bitmap-2.lisp +++ b/Task/Bitmap/Common-Lisp/bitmap-2.lisp @@ -59,11 +59,11 @@ (declare (type rgb-pixel-buffer buffer)) (declare (type rgb-pixel pixel)) (let* ((dimensions (array-dimensions buffer)) - (width (first dimensions)) - (height (second dimensions))) + (width (first dimensions)) + (height (second dimensions))) (loop :for y :of-type fixnum :upfrom 0 :below height :do (loop - :for x :of-type fixnum :upfrom 0 :below width - :do (setf (rgb-pixel buffer x y) pixel))) + :for x :of-type fixnum :upfrom 0 :below width + :do (setf (rgb-pixel buffer x y) pixel))) buffer)) diff --git a/Task/Bitmap/Crystal/bitmap-1.cr b/Task/Bitmap/Crystal/bitmap-1.cr new file mode 100644 index 0000000000..ad7043f36d --- /dev/null +++ b/Task/Bitmap/Crystal/bitmap-1.cr @@ -0,0 +1,105 @@ +record Color, r : UInt8, g : UInt8, b : UInt8 do + def self.new (r : Int32, g : Int32, b : Int32) + self.new r.to_u8, g.to_u8, b.to_u8 + end + + def self.new (hex : Int32) + self.new (hex >> 16 & 0xFF).to_u8, (hex >> 8 & 0xFF).to_u8, (hex & 0xFF).to_u8 + end + + def to_i + (r.to_i << 16) + (g.to_i << 8) + b.to_i + end + + def == (other : Color) + self.to_i == other.to_i + end + + WHITE = new 0xFFFFFF + BLACK = new 0x000000 + RED = new 0xFF0000 + GREEN = new 0x00FF00 + BLUE = new 0x0000FF +end + +class Pixmap + getter width, height + @data : Array(Color) + + def initialize (@width : Int32, @height : Int32, bg_color = Color::BLACK) + @data = Array.new(@width * @height, bg_color) + end + + def initialize (@width : Int32, @height : Int32, @data : Array(Color), copy = false) + raise "Wrong bounds" unless @width * @height == @data.size + @data = @data.dup if copy + end + + def initialize (other : self) + @width = other.@width + @height = other.@height + @data = other.@data.dup + end + + def fill (color) + @data.fill color + end + + def [] (x, y) + raise "Outside bounds" unless 0 <= x < @width && 0 <= y < @height + @data[y * @width + x] + end + + def []= (x, y, color) + if 0 <= x < @width && 0 <= y < @height + @data[y * @width + x] = color + end + color + end + + @@loaders = {} of String => Proc(IO, Pixmap) + @@writers = {} of String | Nil => Proc(Pixmap, IO, Nil) + + macro register_loader (ext, method) + @@loaders[{{ext}}] = ->(io : IO) { {{method.id}}(io) } + end + + macro register_writer (ext, method) + @@writers[{{ext}}] = ->(img : Pixmap, io : IO) { img.{{method.id}}(io) } + end + + def self.load (filename) + ext = File.extname(filename) + loader = @@loaders[ext]? || raise "No loader for '.#{ext}'" + File.open(filename) do |f| + loader.call(f) + end + end + + def write (filename_or_io : Path | String | IO) + if filename_or_io.is_a?(IO) + writer = @@writers[nil]? || raise "No console writer" + writer.call(self, filename_or_io) + else + ext = File.extname(filename_or_io) + writer = @@writers[ext]? || raise "No writer for '#{ext}'" + File.open(filename_or_io, "w") do |f| + writer.call(self, f) + end + end + end + + def write_poor_text (io) + (0...@height).each do |y| + (0...@width).each do |x| + print case self[x, y] + when Color::BLACK then '#' + when Color::WHITE then ' ' + else 'X' + end + end + puts + end + end + register_writer nil, write_poor_text +end diff --git a/Task/Bitmap/Crystal/bitmap-2.cr b/Task/Bitmap/Crystal/bitmap-2.cr new file mode 100644 index 0000000000..99b21e439e --- /dev/null +++ b/Task/Bitmap/Crystal/bitmap-2.cr @@ -0,0 +1,9 @@ +require "./pixmap" + +img = Pixmap.new(10, 5) +(0...10).each do |x| + img[x, x // 2] = Color::WHITE + img[9-x, x // 2] = Color::RED +end + +img.write(STDOUT) diff --git a/Task/Bitmap/Crystal/bitmap.crystal b/Task/Bitmap/Crystal/bitmap.crystal deleted file mode 100644 index fb4b8d9952..0000000000 --- a/Task/Bitmap/Crystal/bitmap.crystal +++ /dev/null @@ -1,36 +0,0 @@ -class RGBColor - getter red, green, blue - - def initialize(@red = 0_u8, @green = 0_u8, @blue = 0_u8) - end - - RED = new(red: 255_u8) - GREEN = new(green: 255_u8) - BLUE = new(blue: 255_u8) - BLACK = new - WHITE = new(255_u8, 255_u8, 255_u8) -end - -class Pixmap - getter width, height - @data : Array(Array(RGBColor)) - - def initialize(@width : Int32, @height : Int32) - @data = Array.new(@width) { Array.new(@height, RGBColor::WHITE) } - end - - def fill(color) - @data.each &.fill(color) - end - - def [](x, y) - @data[x][y] - end - - def []=(x, y, color) - @data[x][y] = color - end -end - -bmap = Pixmap.new(5, 5) -pp bmap diff --git a/Task/Bitmap/Delphi/bitmap.delphi b/Task/Bitmap/Delphi/bitmap.delphi deleted file mode 100644 index 70def79db7..0000000000 --- a/Task/Bitmap/Delphi/bitmap.delphi +++ /dev/null @@ -1,43 +0,0 @@ -procedure ShowBitmapFunctions(Image: TImage); -{Code to demonstrate some of the main features the Delphi "TCanvas" object} -var I,X,Y: integer; -var C: TColor; -begin -{Draw red rectangle with 3 pixels wide lines} -Image.Canvas.Pen.Color:=clRed; -Image.Canvas.Pen.Width:=3; -Image.Canvas.Rectangle(50,50,500,300); -{Flood fill rectangle blue} -Image.Canvas.Brush.Color:=clBlue; -Image.Canvas.FloodFill(55,55,clRed,fsBorder); -{Draw random dots on the screen} -for I:=1 to 1000 do - begin - X:=trunc((Random * 450) + 50); - Y:=trunc((Random * 250) + 50); - C:=RGB(Random(255),Random(255),Random(255)); - {draw 9 pixels for each point to make dots more visible} - Image.Canvas.Pixels[X-1,Y-1]:=C; - Image.Canvas.Pixels[X ,Y-1]:=C; - Image.Canvas.Pixels[X+1,Y-1]:=C; - Image.Canvas.Pixels[X-1,Y ]:=C; - Image.Canvas.Pixels[X ,Y ]:=C; - Image.Canvas.Pixels[X+1,Y ]:=C; - Image.Canvas.Pixels[X-1,Y+1]:=C; - Image.Canvas.Pixels[X ,Y+1]:=C; - Image.Canvas.Pixels[X+1,Y+1]:=C; - end; -{Draw lime-green line from corner to cornder} -Image.Canvas.Pen.Color:=clLime; -Image.Canvas.MoveTo(50,50); -Image.Canvas.LineTo(500,300); -{Sample pixel color at 51,51} -C:=Image.Canvas.Pixels[51,51]; -{Display the color value } -Image.Canvas.Brush.Color:=clAqua; -Image.Canvas.Font.Size:=25; -Image.Canvas.Font.Color:=clRed; -Image.Canvas.TextOut(5,5,IntToHex(C,8)); -{Tell Delphi to update the Window} -Image.Repaint; -end; diff --git a/Task/Bitmap/Delphi/bitmap.pas b/Task/Bitmap/Delphi/bitmap.pas new file mode 100644 index 0000000000..7f6926a01d --- /dev/null +++ b/Task/Bitmap/Delphi/bitmap.pas @@ -0,0 +1,43 @@ +procedure ShowBitmapFunctions(Image: TImage); +{Code to demonstrate some of the main features the Delphi "TCanvas" object} +var I,X,Y: integer; +var C: TColor; +begin +{Draw red rectangle with 3 pixels wide lines} +Image.Canvas.Pen.Color:=clRed; +Image.Canvas.Pen.Width:=3; +Image.Canvas.Rectangle(50,50,500,300); +{Flood fill rectangle blue} +Image.Canvas.Brush.Color:=clBlue; +Image.Canvas.FloodFill(55,55,clRed,fsBorder); +{Draw random dots on the screen} +for I:=1 to 1000 do + begin + X:=trunc((Random * 450) + 50); + Y:=trunc((Random * 250) + 50); + C:=RGB(Random(255),Random(255),Random(255)); + {draw 9 pixels for each point to make dots more visible} + Image.Canvas.Pixels[X-1,Y-1]:=C; + Image.Canvas.Pixels[X ,Y-1]:=C; + Image.Canvas.Pixels[X+1,Y-1]:=C; + Image.Canvas.Pixels[X-1,Y ]:=C; + Image.Canvas.Pixels[X ,Y ]:=C; + Image.Canvas.Pixels[X+1,Y ]:=C; + Image.Canvas.Pixels[X-1,Y+1]:=C; + Image.Canvas.Pixels[X ,Y+1]:=C; + Image.Canvas.Pixels[X+1,Y+1]:=C; + end; +{Draw lime-green line from corner to cornder} +Image.Canvas.Pen.Color:=clLime; +Image.Canvas.MoveTo(50,50); +Image.Canvas.LineTo(500,300); +{Sample pixel color at 51,51} +C:=Image.Canvas.Pixels[51,51]; +{Display the color value } +Image.Canvas.Brush.Color:=clAqua; +Image.Canvas.Font.Size:=25; +Image.Canvas.Font.Color:=clRed; +Image.Canvas.TextOut(5,5,IntToHex(C,8)); +{Tell Delphi to update the Window} +Image.Repaint; +end; diff --git a/Task/Bitmap/Elixir/bitmap.elixir b/Task/Bitmap/Elixir/bitmap.ex similarity index 100% rename from Task/Bitmap/Elixir/bitmap.elixir rename to Task/Bitmap/Elixir/bitmap.ex diff --git a/Task/Bitmap/Euphoria/bitmap.euphoria b/Task/Bitmap/Euphoria/bitmap.eu similarity index 100% rename from Task/Bitmap/Euphoria/bitmap.euphoria rename to Task/Bitmap/Euphoria/bitmap.eu diff --git a/Task/Bitmap/FBSL/bitmap.fbsl b/Task/Bitmap/FBSL/bitmap.fbsl index 910530fbc6..dccbf2fbf5 100644 --- a/Task/Bitmap/FBSL/bitmap.fbsl +++ b/Task/Bitmap/FBSL/bitmap.fbsl @@ -11,12 +11,12 @@ CENTER(ME) SHOW(ME) BEGIN EVENTS - SELECT CASE CBMSG - CASE WM_LBUTTONDOWN ' Set color at current coords as hex literal - PSET(FBSL.GETDC, LOWORD(CBLPARAM), HIWORD(CBLPARAM), &H0000FF) ' Red: Windows stores colors in BGR order - CASE WM_RBUTTONDOWN ' Get color at current coords as hex literal - FBSLSETTEXT(ME, "&H" & HEX(POINT(FBSL.GETDC, LOWORD(CBLPARAM), HIWORD(CBLPARAM)))) - CASE WM_CLOSE ' Clean up - FBSL.RELEASEDC(ME, FBSL.GETDC) - END SELECT + SELECT CASE CBMSG + CASE WM_LBUTTONDOWN ' Set color at current coords as hex literal + PSET(FBSL.GETDC, LOWORD(CBLPARAM), HIWORD(CBLPARAM), &H0000FF) ' Red: Windows stores colors in BGR order + CASE WM_RBUTTONDOWN ' Get color at current coords as hex literal + FBSLSETTEXT(ME, "&H" & HEX(POINT(FBSL.GETDC, LOWORD(CBLPARAM), HIWORD(CBLPARAM)))) + CASE WM_CLOSE ' Clean up + FBSL.RELEASEDC(ME, FBSL.GETDC) + END SELECT END EVENTS diff --git a/Task/Bitmap/FutureBasic/bitmap.basic b/Task/Bitmap/FutureBasic/bitmap.basic new file mode 100644 index 0000000000..3f1e55672d --- /dev/null +++ b/Task/Bitmap/FutureBasic/bitmap.basic @@ -0,0 +1,59 @@ +include "NSLog.incl" +/* + +This task creates an image with a background filled with red pixels. +Then sets one pixel to blue in the center of the image. +Then gets the RGB color values at that pixel position. +Then saves the image as a jpg to the desktop. + +*/ + +_Window = 1 +_Horz = 300 +_Vert = 100 +_X = 150 +_Y = 50 + +window _Window, @"Bitmap window with blue dot",(0,0,_Horz, _Vert) +WindowSetBackgroundColor(_Window,fn colorwhite) + + +local fn DrawImage as ImageRef + ImageRef image = fn ImageWithSize( fn CGSizeMake(_Horz,_Vert ) ) // create blank image + + ImageLockFocus( image ) // lock image during drawing + + CFIndex i + + for i = 0 to _Horz // fill all horizontal pixels with red dots + BezierPathStrokeLine( fn CGPointMake( i, 0 ), fn CGPointMake( i, _Vert ), 1, fn Colorred ) + next + + BezierPathStrokeRect( fn CGRectMake( _X,_Y,1,1), 1.0, fn ColorBlue) // Draw a blue dot in the center. + + ImageUnlockFocus( image ) // unlock image afer drawing + +end fn = image + + +// Draw the image +ImageRef theImage +theImage = fn DrawImage + +// Display the image +imageview 1,, theImage, (0,0,_Horz, _Vert) + +// Get the color of the pixel at horizontal position X and vertical position Y +colorref color +color = fn ViewColorAtXY( _Window, _X, _Y ) +NSLog( @"RGB Color values at pixel position X,Y are %@", color) + +// Save the image as a jpg +CFURLRef DesktopDirectory,url +DesktopDirectory = fn FileManagerURLForDirectory( NSDesktopDirectory, NSUserDomainMask ) +url = fn URLByAppendingPathComponent( DesktopDirectory, @"Bitmap Image.jpg" ) +bool err +err = fn ImageWriteToURL( theImage, url, NSBitmapImageFileTypeJPEG, _true ) // save image as jpg + + +handleevents diff --git a/Task/Bitmap/Go/bitmap-1.go b/Task/Bitmap/Go/bitmap-1.go index d6dd1a630b..f275d34761 100644 --- a/Task/Bitmap/Go/bitmap-1.go +++ b/Task/Bitmap/Go/bitmap-1.go @@ -1,57 +1,57 @@ package main import ( - "bytes" - "fmt" - "image" - "image/color" - "image/draw" - "image/png" + "bytes" + "fmt" + "image" + "image/color" + "image/draw" + "image/png" ) func main() { - // A rectangle from 0,0 to 300,240. - r := image.Rect(0, 0, 300, 240) + // A rectangle from 0,0 to 300,240. + r := image.Rect(0, 0, 300, 240) - // Create an image - im := image.NewNRGBA(r) + // Create an image + im := image.NewNRGBA(r) - // set some color variables for convience - var ( - red = color.RGBA{0xff, 0x00, 0x00, 0xff} - blue = color.RGBA{0x00, 0x00, 0xff, 0xff} - ) + // set some color variables for convience + var ( + red = color.RGBA{0xff, 0x00, 0x00, 0xff} + blue = color.RGBA{0x00, 0x00, 0xff, 0xff} + ) - // Fill with a uniform color - draw.Draw(im, r, &image.Uniform{red}, image.ZP, draw.Src) + // Fill with a uniform color + draw.Draw(im, r, &image.Uniform{red}, image.ZP, draw.Src) - // Set individual pixels - im.Set(10, 20, blue) - im.Set(20, 30, color.Black) - im.Set(30, 40, color.RGBA{0x10, 0x20, 0x30, 0xff}) + // Set individual pixels + im.Set(10, 20, blue) + im.Set(20, 30, color.Black) + im.Set(30, 40, color.RGBA{0x10, 0x20, 0x30, 0xff}) - // Get the values of specific pixels as color.Color types. - // The color will be in the color.Model of the image (in this - // case color.NRGBA) but color models can convert their values - // to other models. - c1 := im.At(0, 0) - c2 := im.At(10, 20) + // Get the values of specific pixels as color.Color types. + // The color will be in the color.Model of the image (in this + // case color.NRGBA) but color models can convert their values + // to other models. + c1 := im.At(0, 0) + c2 := im.At(10, 20) - // or directly as RGB components (scaled values) - redc, greenc, bluec, _ := c1.RGBA() - redc, greenc, bluec, _ = im.At(30, 40).RGBA() + // or directly as RGB components (scaled values) + redc, greenc, bluec, _ := c1.RGBA() + redc, greenc, bluec, _ = im.At(30, 40).RGBA() - // Images can be read and writen in various formats - var buf bytes.Buffer - err := png.Encode(&buf, im) - if err != nil { - fmt.Println(err) - } + // Images can be read and writen in various formats + var buf bytes.Buffer + err := png.Encode(&buf, im) + if err != nil { + fmt.Println(err) + } - fmt.Println("Image size:", im.Bounds().Dx(), "×", im.Bounds().Dy()) - fmt.Println(buf.Len(), "bytes when encoded as PNG.") - fmt.Printf("Pixel at %7v is %v\n", image.Pt(0, 0), c1) - fmt.Printf("Pixel at %7v is %#v\n", image.Pt(10, 20), c2) // %#v shows type details - fmt.Printf("Pixel at %7v has R=%d, G=%d, B=%d\n", - image.Pt(30, 40), redc, greenc, bluec) + fmt.Println("Image size:", im.Bounds().Dx(), "×", im.Bounds().Dy()) + fmt.Println(buf.Len(), "bytes when encoded as PNG.") + fmt.Printf("Pixel at %7v is %v\n", image.Pt(0, 0), c1) + fmt.Printf("Pixel at %7v is %#v\n", image.Pt(10, 20), c2) // %#v shows type details + fmt.Printf("Pixel at %7v has R=%d, G=%d, B=%d\n", + image.Pt(30, 40), redc, greenc, bluec) } diff --git a/Task/Bitmap/Julia/bitmap.julia b/Task/Bitmap/Julia/bitmap.jl similarity index 100% rename from Task/Bitmap/Julia/bitmap.julia rename to Task/Bitmap/Julia/bitmap.jl diff --git a/Task/Bitmap/Kotlin/bitmap.kotlin b/Task/Bitmap/Kotlin/bitmap.kts similarity index 100% rename from Task/Bitmap/Kotlin/bitmap.kotlin rename to Task/Bitmap/Kotlin/bitmap.kts diff --git a/Task/Bitmap/M2000-Interpreter/bitmap-1.m2000 b/Task/Bitmap/M2000-Interpreter/bitmap-1.m2000 index 905292d6cb..ebd64b552a 100644 --- a/Task/Bitmap/M2000-Interpreter/bitmap-1.m2000 +++ b/Task/Bitmap/M2000-Interpreter/bitmap-1.m2000 @@ -1,72 +1,102 @@ -\ Bitmap width in pixels, height in pixels -\ Return a group object with some lambda as members: SetPixel, GetPixel, Image$ -\ copyimage -\ using Copy x, y Use Image$ we can display image$ to x, y as twips -\ we can use x*twipsx, y*twipsy for x,y as pixels -Function Bitmap (x as long, y as long) { - if x<1 or y<1 then Error "Wrong dimensions" - structure rgb { - red as byte - green as byte - blue as byte - } - m=len(rgb)*x mod 4 - if m>0 then m=4-m ' add some bytes to raster line - m+=len(rgb) *x - Structure rasterline { - { - pad as byte*m +Module Checkit { + Function Bitmap (x as long, y as long) { + if x<1 or y<1 then Error "Wrong dimensions" + structure rgb { + red as byte + green as byte + blue as byte + } + m=len(rgb)*x mod 4 + if m>0 then m=4-m ' add some bytes to raster line + m+=len(rgb) *x + Structure rasterline { + { + pad as byte*m + } + \\ union pad+hline + hline as rgb*x } - \\ union pad+hline - hline as rgb*x - } - Structure Raster { - magic as integer*4 - w as integer*4 - h as integer*4 - lines as rasterline*y - } - Buffer Clear Image1 as Raster - \\ 24 chars as header to be used from bitmap render build in functions - Return Image1, 0!magic:="cDIB", 0!w:=Hex$(x,2), 0!h:=Hex$(y, 2) - \\ fill white (all 255) - \\ Str$(string) convert to ascii, so we get all characters from words width to byte width - Return Image1, 0!lines:=Str$(String$(chrcode$(255), Len(rasterline)*y)) - Buffer Clear Pad as Byte*4 - SetPixel=Lambda Image1, Pad,aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x, y, c) ->{ - where=alines+3*x+blines*y - if c>0 then c=color(c) - c-! - Return Pad, 0:=c as long - Return Image1, 0!where:=Eval(Pad, 2) as byte, 0!where+1:=Eval(Pad, 1) as byte, 0!where+2:=Eval(Pad, 0) as byte + Structure Raster { + magic as integer*4 + w as integer*4 + h as integer*4 + lines as rasterline*y + } + Buffer Clear Image1 as Raster + \\ 24 chars as header to be used from bitmap render build in functions + Return Image1, 0!magic:="cDIB", 0!w:=Hex$(x,2), 0!h:=Hex$(y, 2) + \\ fill white (all 255) + \\ Str$(string) convert to ascii, so we get all characters from words width to byte width + Return Image1, 0!lines:=Str$(String$(chrcode$(255), Len(rasterline)*y)) + Buffer Clear Pad as Byte*4 + SetPixel=Lambda Image1, Pad,aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x, y, c) ->{ + where=alines+3*x+blines*y + if c>0 then c=color(c) + c-! + Return Pad, 0:=c as long + Return Image1, 0!where:=Eval(Pad, 2) as byte, 0!where+1:=Eval(Pad, 1) as byte, 0!where+2:=Eval(Pad, 0) as byte + } + GetPixel=Lambda Image1,aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x,y) ->{ + where=alines+3*x+blines*y + =color(Eval(image1, where+2 as byte), Eval(image1, where+1 as byte), Eval(image1, where as byte)) + } + StrDib$=Lambda$ Image1, Raster -> { + =Eval$(Image1, 0, Len(Raster)) + } + CopyImage=Lambda Image1 (image$) -> { + if left$(image$,12)=Eval$(Image1, 0, 24 ) Then { + Return Image1, 0:=Image$ + } Else Error "Can't Copy Image" + } + Export2File=Lambda Image1, x, y, r=len(rasterline) (f) -> { + \\ use this between open and close + Print #f, "P3" + Print #f,"# Created using M2000 Interpreter" + Print #f, x;" ";y + Print #f, 255 + x2=x-1 + For y1= y-1 to 0 { + a$="" + where=24+r*y1 + x1=0 + Print #f, Eval(Image1, where +2 as byte);" "; + Print #f, Eval(Image1, where+1 as byte);" "; + Print #f, Eval(Image1, where as byte); + where+=3 + For x1=1 to x2 { + Print #f, " ";Eval(Image1, where +2 as byte);" "; + Print #f, Eval(Image1, where+1 as byte);" "; + Print #f, Eval(Image1, where as byte); + where+=3 + } + Print #f + } + } + Group Bitmap { + SetPixel=SetPixel + GetPixel=GetPixel + Image$=StrDib$ + Copy=CopyImage + ToFile=Export2File + } + =Bitmap } - GetPixel=Lambda Image1,aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x,y) ->{ - where=alines+3*x+blines*y - =color(Eval(image1, where+2 as byte), Eval(image1, where+1 as byte), Eval(image1, where as byte)) + A=Bitmap(150,100) + For i=0 to 98 { + Call A.SetPixel(i, i, 5) + Call A.SetPixel(99, i, color(128,0,255)) } - StrDib$=Lambda$ Image1, Raster -> { - =Eval$(Image1, 0, Len(Raster)) - } - CopyImage=Lambda Image1 (image$) -> { - if left$(image$,12)=Eval$(Image1, 0, 24 ) Then { - Return Image1, 0:=Image$ - } Else Error "Can't Copy Image" - } - Group Bitmap { - SetPixel=SetPixel - GetPixel=GetPixel - Image$=StrDib$ - Copy=CopyImage - } - =Bitmap + Call A.SetPixel(i,i,0) + Call A.SetPixel(30,50, color(128,0,255)) + Print A.GetPixel(30,50)=color(128,0,255) + move 3000, 3000 + Image A.image$() + profiler + Open "A2.PPM" for Output as #F + Call A.ToFile(F) + Close #f + print timecount } -A=Bitmap(100,100) -Call A.SetPixel(50,50, color(128,0,255)) -Print A.GetPixel(50,50)=color(128,0,255) -\\ display image to screen at 100, 50 pixel -copy 100*twipsx,50*twipsy use A.Image$() -A1=Bitmap(100,100) -Call A1.copy(A.Image$()) -copy 500*twipsx,50*twipsy use A1.Image$() +Checkit diff --git a/Task/Bitmap/M2000-Interpreter/bitmap-2.m2000 b/Task/Bitmap/M2000-Interpreter/bitmap-2.m2000 index 562ea41c5b..bae307643e 100644 --- a/Task/Bitmap/M2000-Interpreter/bitmap-2.m2000 +++ b/Task/Bitmap/M2000-Interpreter/bitmap-2.m2000 @@ -1,55 +1,57 @@ Module P6 { Function Bitmap { def x as long, y as long, Import as boolean - - If match("NN") then { + If match("NN") then Read x, y - } else.if Match("N") Then { + else.if Match("N") Then \\ is a file? Read f as long - buffer whitespace as byte - if not Eof(f) then { - get #f, whitespace :P6$=eval$(whitespace) - get #f, whitespace : P6$+=eval$(whitespace) - def boolean getW=true, getH=true, getV=true - def long v - \\ str$("P6") has 2 bytes. "P6" has 4 bytes - If p6$=str$("P6") Then { - do { + byte whitespace[0] + if not Eof(f) then + get #f, whitespace :P6$=chr$(whitespace[0]) + get #f, whitespace : P6$+=chr$(whitespace[0]) + boolean getW=true, getH=true, getV=true + long v + If p6$="P6" Then + do get #f, whitespace - if Eval$(whitespace)=str$("#") then { - do {get #f, whitespace} until eval(whitespace)=10 - } else { - select case eval(whitespace) - case 32, 9, 13, 10 - { if getW and x<>0 then { - getW=false - } else.if getH and y<>0 then { - getH=false - } else.if getV and v<>0 then { - getV=false - } - } - case 48 to 57 - {if getW then { - x*=10 - x+=eval(whitespace, 0)-48 - } else.if getH then { - y*=10 - y+=eval(whitespace, 0)-48 - } else.if getV then { - v*=10 - v+=eval(whitespace, 0)-48 - } - } - End Select + select case whitespace[0] + case 35 + {do get #f, whitespace + until whitespace[0]=10 } + case 32, 9, 13, 10 + { if getW and x<>0 then + getW=false + else.if getH and y<>0 then + getH=false + else.if getV and v<>0 then + getV=false + end if + } + case 48 to 57 + {if getW then + x*=10 + x+=whitespace[0]-48 + else.if getH then + y*=10 + y+=whitespace[0]-48 + else.if getV then + v*=10 + v+=whitespace[0]-48 + end if + } + End Select iF eof(f) then Error "Not a ppm file" - } until getV=false - } else Error "Not a P6 ppm" + until getV=false + else + Error "Not a P6 ppm" + end if Import=True - } - } else Error "No proper arguments" + end if + else + Error "No proper arguments" + end if if x<1 or y<1 then Error "Wrong dimensions" structure rgb { red as byte @@ -78,7 +80,7 @@ Module P6 { Return Image1, 0!magic:="cDIB", 0!w:=Hex$(x,2), 0!h:=Hex$(y, 2) if not Import then Return Image1, 0!lines:=Str$(String$(chrcode$(255), Len(rasterline)*y)) Buffer Clear Pad as Byte*4 - SetPixel=Lambda Image1, Pad,aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x, y, c) ->{ + SetPixel=Lambda Image1, Pad, aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x, y, c) ->{ where=alines+3*x+blines*y if c>0 then c=color(c) c-! @@ -101,23 +103,41 @@ Module P6 { Print #f, "P6";chr$(10);"# Created using M2000 Interpreter";chr$(10); Print #f, x;" ";y;" 255";chr$(10); x2=x-1 : where=0 - Buffer pad as byte*3 - For y1= 0 to y-1 { - For x1=0 to x2 { - Return pad, 0:=eval$(image1, 0!linesB!where, 3) - Push Eval(pad, 2) : Return pad, 2:=Eval(pad, 0), 0:=Number - Put #f, pad : where+=3 - } + x0=x*3 + structure rgbP6 { + r as byte + g as byte + b as byte + } + buffer Pad as rgbP6*x*y + For y1=y-1 to 0 { + Return pad, x*y1:=eval$(image1, 0!linesB!where, x0) + where+=x0 m=where mod 4 : if m<>0 then where+=4-m } + For x1=0 to x*y-1 { + Push Eval(pad, x1!b) : Return pad, x1!b:=Eval(pad, x1!r), x1!r:=Number + } + Put #f, pad } if Import then { - x0=x-1 : where=0 - Buffer Pad1 as byte*3 - For y1=y-1 to 0 { - For x1=0 to x0 {Get #f, Pad1 : Push Eval(pad1, 2) : Return pad1, 2:=Eval(pad1, 0), 0:=Number - Return Image1, 0!linesB!where:=Eval$(Pad1) : where+=3} - m=where mod 4 : if m<>0 then where+=4-m} + x0=x-1 : where=0 + structure rgbP6 { + r as byte + g as byte + b as byte + } + buffer Pad1 as rgbP6*x*y + Get #f, Pad1 + For x1=0 to x*y-1 { + Push Eval(pad1, x1!b) : Return pad1, x1!b:=Eval(pad1, x1!r), x1!r:=Number + } + x1=x*3 + For y1=y-1 to 0 { + Return Image1, 0!linesB!where:=Eval$(Pad1, y1*x, x1) + where+=3*(x0+1) + m=where mod 4 : if m<>0 then where+=4-m + } } Group Bitmap { SetPixel=SetPixel diff --git a/Task/Bitmap/Maple/bitmap.maple b/Task/Bitmap/Maple/bitmap.maple index c09fcaa799..5182a05be3 100644 --- a/Task/Bitmap/Maple/bitmap.maple +++ b/Task/Bitmap/Maple/bitmap.maple @@ -1,23 +1,23 @@ allocateImg := proc(width, height) - return Array(1..width, 1..height, 1..3); + return Array(1..width, 1..height, 1..3); end proc: fillColor := proc(img, rgb::list) - local i; - for i from 1 to 3 do - img[..,..,i] := map(x->rgb[i], img[..,..,i]): - end do: + local i; + for i from 1 to 3 do + img[..,..,i] := map(x->rgb[i], img[..,..,i]): + end do: end proc: setColor := proc(x, y, img, rgb::list) - local i: - for i from 1 to 3 do - img[x,y,i] := rgb[i]: - end do: + local i: + for i from 1 to 3 do + img[x,y,i] := rgb[i]: + end do: end proc: getColor := proc(x,y,img) - local rgb,i: - rgb := Array(1..3): - for i from 1 to 3 do - rgb(i) := img[x,y,i]: - end do: - return rgb: + local rgb,i: + rgb := Array(1..3): + for i from 1 to 3 do + rgb(i) := img[x,y,i]: + end do: + return rgb: end proc: diff --git a/Task/Bitmap/MiniScript/bitmap.mini b/Task/Bitmap/MiniScript/bitmap.mini new file mode 100644 index 0000000000..28cfdc4c47 --- /dev/null +++ b/Task/Bitmap/MiniScript/bitmap.mini @@ -0,0 +1,30 @@ +// MiniMicro version of MiniScript has all the +// necessary methods built-in to complete this task. +width = 256 +height = 256 +colr = color.aqua + +// Create the image with specified width/heigh. With +// no parameters, it defaults width/height to 64 and +// color to black +img = Image.create(width, height, colr) + +// Create a diagonal line of multiple colors. Uses +// Cartesian coordinates so (0, 0) is lower left corner. +for i in range(0, 255) + img.setPixel i, i, color.rgb(i, i, i) +end for + +// Get pixel color as RGBA hex values +print "Color at pixel (100, 100): " + img.pixel(100, 100) +print "Color at pixel (0, 0): " + img.pixel(0, 0) +print "Color at pixel (127, 127): " + img.pixel(127, 127) +print "Color at pixel (255, 255): " + img.pixel(255, 255) + +// Display the image, resizing it to 127 x 127 +gfx.drawImage img, 0, 0, 127, 127 + +// Save the file - accepted file extensions: +// tga, jpg, jpeg, and png (retains transparency) +// Optional third parameter is JPG compression quality. +file.saveImage "/usr/test.png", img diff --git a/Task/Bitmap/OCaml/bitmap-1.ocaml b/Task/Bitmap/OCaml/bitmap-1.ml similarity index 100% rename from Task/Bitmap/OCaml/bitmap-1.ocaml rename to Task/Bitmap/OCaml/bitmap-1.ml diff --git a/Task/Bitmap/OCaml/bitmap-2.ocaml b/Task/Bitmap/OCaml/bitmap-2.ml similarity index 100% rename from Task/Bitmap/OCaml/bitmap-2.ocaml rename to Task/Bitmap/OCaml/bitmap-2.ml diff --git a/Task/Bitmap/OCaml/bitmap-3.ocaml b/Task/Bitmap/OCaml/bitmap-3.ml similarity index 100% rename from Task/Bitmap/OCaml/bitmap-3.ocaml rename to Task/Bitmap/OCaml/bitmap-3.ml diff --git a/Task/Bitmap/OCaml/bitmap-4.ocaml b/Task/Bitmap/OCaml/bitmap-4.ml similarity index 100% rename from Task/Bitmap/OCaml/bitmap-4.ocaml rename to Task/Bitmap/OCaml/bitmap-4.ml diff --git a/Task/Bitmap/OCaml/bitmap-5.ocaml b/Task/Bitmap/OCaml/bitmap-5.ml similarity index 100% rename from Task/Bitmap/OCaml/bitmap-5.ocaml rename to Task/Bitmap/OCaml/bitmap-5.ml diff --git a/Task/Bitmap/OCaml/bitmap-6.ocaml b/Task/Bitmap/OCaml/bitmap-6.ml similarity index 100% rename from Task/Bitmap/OCaml/bitmap-6.ocaml rename to Task/Bitmap/OCaml/bitmap-6.ml diff --git a/Task/Bitmap/OCaml/bitmap-7.ocaml b/Task/Bitmap/OCaml/bitmap-7.ml similarity index 100% rename from Task/Bitmap/OCaml/bitmap-7.ocaml rename to Task/Bitmap/OCaml/bitmap-7.ml diff --git a/Task/Bitmap/Oz/bitmap-1.oz b/Task/Bitmap/Oz/bitmap-1.oz index 894345a7e0..e7394ba62c 100644 --- a/Task/Bitmap/Oz/bitmap-1.oz +++ b/Task/Bitmap/Oz/bitmap-1.oz @@ -9,12 +9,12 @@ define C = {Array.new 1 Height unit} in for Row in 1..Height do - C.Row := {Array.new 1 Width Init} + C.Row := {Array.new 1 Width Init} end array2d(width:Width - height:Height - contents:C) + height:Height + contents:C) end fun {Get array2d(contents:C ...) X Y} @@ -27,9 +27,9 @@ define proc {Transform array2d(contents:C width:W height:H ...) Fun} for Y in 1..H do - for X in 1..W do - C.Y.X := {Fun C.Y.X} - end + for X in 1..W do + C.Y.X := {Fun C.Y.X} + end end end diff --git a/Task/Bitmap/POV-Ray/bitmap.povray b/Task/Bitmap/POV-Ray/bitmap.povray new file mode 100644 index 0000000000..2578b0aa32 --- /dev/null +++ b/Task/Bitmap/POV-Ray/bitmap.povray @@ -0,0 +1,74 @@ +//cmd: +w300 +h300 +am2 +a0.01 + +#version 3.7; + +#global_settings {assumed_gamma 1} +#default{ finish{ ambient 0.1 diffuse 0.9 }} +background {rgb 0} + + +#macro mapInit(DimX, DimY) + #local Map = array[DimX][DimY]; + mapFillSolid(Map, rgb<0,0,0>) + Map +#end + + +#macro mapFillSolid(Map, Colour) + mapFillRect(Map,<0,0>,, Colour) +#end + + +#macro mapFillRect(Map, RectLowerLeft, RectUpperRight, Colour) + #for (X, RectLowerLeft.x, RectUpperRight.x - 1) + #for (Y, RectLowerLeft.y, RectUpperRight.y - 1) + #local Map[X][Y] = Colour; + #end + #end +#end + + +#macro mapSetPixel(Map, Pixel, Colour) + #local Map[Pixel.x][Pixel.y] = Colour; +#end + + +#macro mapGetPixel(Map, Pixel) + Map[Pixel.x][Pixel.y] +#end + + +#macro mapObject(Map) + // to visualize the map, each pixel is rendered as a sphere + #for (X,0,dimension_size(Map,1)-1) + #for (Y,0,dimension_size(Map,2)-1) + sphere{ + , 0.5 + pigment{colour Map[X][Y]} + } + #end + #end +#end + +//== Scene + +#declare DimX = 100; +#declare DimY = 100; +#declare ImgMap = mapInit(DimX, DimY); +mapFillSolid(ImgMap, rgb<1, 0, 0>) +mapSetPixel(ImgMap, <25,25>, rgb<1,1,1>) +mapFillRect(ImgMap, <50,50>, <75,75>, rgb<0,0,1>) + +#debug concat("Colour at: <", vstr(2,<25,25>,", ",0,0),"> is: <", vstr(3, mapGetPixel(ImgMap, <25,25>),", ",0,0),">\n") + +mapObject(ImgMap) + +camera{ + location + look_at + right x*image_width/image_height +} +light_source{ + + rgb 1 +} diff --git a/Task/Bitmap/Pascal/bitmap.pas b/Task/Bitmap/Pascal/bitmap.pas index 09867f7945..d588e54d4e 100644 --- a/Task/Bitmap/Pascal/bitmap.pas +++ b/Task/Bitmap/Pascal/bitmap.pas @@ -117,14 +117,14 @@ Procedure CreateBmpFile32(directory: string; FileName: string; { fill the pixel data area } for y := (height - 1) downto 0 do begin - for x := 0 to (width - 1) do - begin { Pixel(x,y) } - color32.Blue := 255; - color32.Green := 0; - color32.Red := 0; - color32.Alfa := 0; - BlockWrite(bmpFile, color32, 4); - end; { for x ... } + for x := 0 to (width - 1) do + begin { Pixel(x,y) } + color32.Blue := 255; + color32.Green := 0; + color32.Red := 0; + color32.Alfa := 0; + BlockWrite(bmpFile, color32, 4); + end; { for x ... } end; { for y ... } Close(bmpFile); end; { with bmpInfoHeader, bmpFileHeader } diff --git a/Task/Bitmap/Pluto/bitmap-1.pluto b/Task/Bitmap/Pluto/bitmap-1.pluto new file mode 100644 index 0000000000..8901f27d06 --- /dev/null +++ b/Task/Bitmap/Pluto/bitmap-1.pluto @@ -0,0 +1,23 @@ +local canvas = require "canvas" + +-- Create a new canvas object: 400 pixels wide and 400 pixels high. +local c = canvas.new(400, 400) + +-- Color the whole canvas blue. +c:fill(0xff0000) + +-- Draw a red square in the middle. +for i = 1, 51 do + for j = 1, 51 do + c:set(174 + i, 174 + j, 0x0000ff) + end +end + +-- Print to the terminal the color (as an integer) of a pixel. +print(c:get(200, 200)) -- 255 + +-- Convert the canvas to a BMP image. +local image = c:tobmp() + +-- Save the image to a file. +io.contents("mybmp.bmp", image) diff --git a/Task/Bitmap/Pluto/bitmap-2.pluto b/Task/Bitmap/Pluto/bitmap-2.pluto new file mode 100644 index 0000000000..bee038a9ef --- /dev/null +++ b/Task/Bitmap/Pluto/bitmap-2.pluto @@ -0,0 +1,16 @@ +require "bitmap" + +-- Create a new bitmap object: 400 pixels wide and 400 pixels high +local bmp = bitmap.of(400, 400, color.blue, "mybmp") + +-- Draw a red square in the middle. +bmp:square(200, 200, 50, color.red, 0, true) + +-- Print to the terminal the color (as an integer) of a pixel. +print(bmp:get(200, 200)) -- 255 + +-- View the image using the default viewer for the platform. +bmp:view() + +-- Save the image to the file mybmp.bmp in the current directory. +bmp:save() diff --git a/Task/Bitmap/Prolog/bitmap.pro b/Task/Bitmap/Prolog/bitmap.pro index 1ea949bb5f..13b5e3511d 100644 --- a/Task/Bitmap/Prolog/bitmap.pro +++ b/Task/Bitmap/Prolog/bitmap.pro @@ -1,20 +1,20 @@ :- module(bitmap, [ - new_bitmap/3, - fill_bitmap/3, - get_pixel0/3, - set_pixel0/4 ]). + new_bitmap/3, + fill_bitmap/3, + get_pixel0/3, + set_pixel0/4 ]). :- use_module(library(lists)). %-----------------------------------------------------------------------------% % Convenience Predicates replicate(Term,Times,L):- - length(L,Times), - maplist(=(Term),L). + length(L,Times), + maplist(=(Term),L). replace0(N,OL,E,NL):- - nth0(N,OL,_,TL), - nth0(N,NL,E,TL). + nth0(N,OL,_,TL), + nth0(N,NL,E,TL). %-----------------------------------------------------------------------------% % Bitmap Utilities % @@ -25,27 +25,27 @@ replace0(N,OL,E,NL):- % in other bitmap tasks it is assumed to be a list [R,G,B] where % each is an int between 0 and 255, in code: rgb_pixel(RGB):- - length(RGB,3), - maplist(integer,RGB), - maplist(between(0,255),RGB). + length(RGB,3), + maplist(integer,RGB), + maplist(between(0,255),RGB). %new_bitmap(Bitmap,Dimensions,RGB) new_bitmap([[X,Y],Pixels],[X,Y],RGB) :- - replicate(RGB,X,Row), - replicate(Row,Y,Pixels). - + replicate(RGB,X,Row), + replicate(Row,Y,Pixels). + %fill_bitmap(New_Bitmap,Bitmap,RGB) fill_bitmap(New_Bitmap,[[X,Y],_],RGB) :- - new_bitmap(New_Bitmap,[X,Y],RGB). + new_bitmap(New_Bitmap,[X,Y],RGB). %here get and set use 0 based indexing %get_pixel0(Bitmap,Coordinates,RGB) get_pixel0([[_DimX,_DimY],Pixels],[X,Y],RGB) :- - nth0(Y,Pixels,Row), - nth0(X,Row,RGB). + nth0(Y,Pixels,Row), + nth0(X,Row,RGB). %set_pixel0(New Bitmap, Bitmap, Coordinates, RGB) set_pixel0([[DimX,DimY],New_Pixels],[[DimX,DimY],Pixels],[X,Y],RGB) :- - nth0(Y,Pixels,Row), - replace0(X,Row,RGB,New_Row), - replace0(Y,Pixels,New_Row,New_Pixels). + nth0(Y,Pixels,Row), + replace0(X,Row,RGB,New_Row), + replace0(Y,Pixels,New_Row,New_Pixels). diff --git a/Task/Bitmap/Raku/bitmap.raku b/Task/Bitmap/Raku/bitmap.raku index 1bf117941a..e2a0e66931 100644 --- a/Task/Bitmap/Raku/bitmap.raku +++ b/Task/Bitmap/Raku/bitmap.raku @@ -7,16 +7,16 @@ class Bitmap { @!data = $p.clone xx ($!width*$!height) } method pixel( - $i where ^$!width, - $j where ^$!height - --> Pixel + $i where ^$!width, + $j where ^$!height + --> Pixel ) is rw { @!data[$i + $j * $!width] } method set-pixel ($i, $j, Pixel $p) { - self.pixel($i, $j) = $p.clone; + self.pixel($i, $j) = $p.clone; } method get-pixel ($i, $j) returns Pixel { - self.pixel($i, $j); + self.pixel($i, $j); } } diff --git a/Task/Bitmap/RapidQ/bitmap.rapidq b/Task/Bitmap/RapidQ/bitmap.rapidq index ad4ebfe355..71baea5c92 100644 --- a/Task/Bitmap/RapidQ/bitmap.rapidq +++ b/Task/Bitmap/RapidQ/bitmap.rapidq @@ -5,8 +5,8 @@ CREATE form AS QForm Height = 480 CREATE canvas AS QCanvas Height = form.ClientHeight - Width = form.ClientWidth - OnPaint = PaintCanvas + Width = form.ClientWidth + OnPaint = PaintCanvas END CREATE END CREATE diff --git a/Task/Bitmap/Rebol/bitmap.rebol b/Task/Bitmap/Rebol/bitmap.rebol new file mode 100644 index 0000000000..f4d893806b --- /dev/null +++ b/Task/Bitmap/Rebol/bitmap.rebol @@ -0,0 +1,58 @@ +;; make image using pair +img: make image! 2x2 +;; make image using pair and RGB tuple +img: make image! [2x2 255.0.0] +;; make image using pair and RGBA tuple" +img: make image! [2x2 255.0.0.10] + +;; Rebol3's construction syntax +img1: #(image! 4x4) ;; white by default +img2: #(image! 2x2 0.0.0) ;; black image + +;; Raw binary access: +probe img1/rgb +;== #{ +;== FFFFFFFFFFFFFFFFFFFFFFFF +;== FFFFFFFFFFFFFFFFFFFFFFFF +;== FFFFFFFFFFFFFFFFFFFFFFFF +;== FFFFFFFFFFFFFFFFFFFFFFFF} + +;; Blit image to image +change at img1 2x2 img2 +probe img1/rgb +;== #{ +;== FFFFFFFFFFFFFFFFFFFFFFFF +;== FFFFFF000000000000FFFFFF +;== FFFFFF000000000000FFFFFF +;== FFFFFFFFFFFFFFFFFFFFFFFF} + +;; Pixel access +img1/1 ;== 255.255.255.255 +img2/1 ;== 0.0.0.255 +img1/2x2 ;== 0.0.0.255 + +;; Other binary accessors: +img: #(image! 2x1) +img/1: 1.2.3.100 +img/2: 4.5.6.200 +img/rgba ;== #{01020364040506C8} +img/rgbo ;== #{0102039B04050637} +img/argb ;== #{64010203C8040506} +img/orgb ;== #{9B01020337040506} +img/bgra ;== #{03020164060504C8} +img/bgro ;== #{0302019B06050437} +img/abgr ;== #{64030201C8060504} +img/obgr ;== #{9B03020137060504} +img/opacity ;== #{9B37} +img/alpha ;== #{64C8} + +;; Drawing may be done using extensions like Blend2D +import blend2d ;@@ https://github.com/Siskin-framework/Rebol-Blend2D +img: draw 100x100 [ + fill red + pen black + line-width 10 + circle 50x50 20 + fill none + line 0x0 100x100 +] diff --git a/Task/Bitmap/Rust/bitmap.rust b/Task/Bitmap/Rust/bitmap.rs similarity index 100% rename from Task/Bitmap/Rust/bitmap.rust rename to Task/Bitmap/Rust/bitmap.rs diff --git a/Task/Bitmap/Scheme/bitmap-1.ss b/Task/Bitmap/Scheme/bitmap-1.scm similarity index 100% rename from Task/Bitmap/Scheme/bitmap-1.ss rename to Task/Bitmap/Scheme/bitmap-1.scm diff --git a/Task/Bitmap/Scheme/bitmap-2.ss b/Task/Bitmap/Scheme/bitmap-2.scm similarity index 100% rename from Task/Bitmap/Scheme/bitmap-2.ss rename to Task/Bitmap/Scheme/bitmap-2.scm diff --git a/Task/Bitmap/Scheme/bitmap-3.ss b/Task/Bitmap/Scheme/bitmap-3.scm similarity index 100% rename from Task/Bitmap/Scheme/bitmap-3.ss rename to Task/Bitmap/Scheme/bitmap-3.scm diff --git a/Task/Bitmap/Scheme/bitmap-4.ss b/Task/Bitmap/Scheme/bitmap-4.scm similarity index 100% rename from Task/Bitmap/Scheme/bitmap-4.ss rename to Task/Bitmap/Scheme/bitmap-4.scm diff --git a/Task/Bitmap/Scheme/bitmap-5.ss b/Task/Bitmap/Scheme/bitmap-5.scm similarity index 100% rename from Task/Bitmap/Scheme/bitmap-5.ss rename to Task/Bitmap/Scheme/bitmap-5.scm diff --git a/Task/Bitmap/SequenceL/bitmap.sequencel b/Task/Bitmap/SequenceL/bitmap.sequencel index 5facc762fe..ba7a4ffd42 100644 --- a/Task/Bitmap/SequenceL/bitmap.sequencel +++ b/Task/Bitmap/SequenceL/bitmap.sequencel @@ -2,37 +2,37 @@ RGB ::= (R: int(0), G: int(0), B: int(0)); newBitmap: int * int -> RGB(2); newBitmap(width, height)[y, x] := - (R: 0, G: 0, B: 0) - foreach y within 1 ... height, - x within 1 ... width; + (R: 0, G: 0, B: 0) + foreach y within 1 ... height, + x within 1 ... width; fill: RGB(2) * RGB -> RGB(2); fill(bitmap(2), color)[y, x] := - color - foreach y within 1 ... size(bitmap), - x within 1 ... size(bitmap[y]); + color + foreach y within 1 ... size(bitmap), + x within 1 ... size(bitmap[y]); setColorAt: RGB(2) * int * int * RGB -> RGB(2); setColorAt(bitmap(2), x, y, color)[Y, X] := - color when Y = y and X = x - else - bitmap[Y, X]; - -getColorAt: RGB(2) * int * int -> RGB; + color when Y = y and X = x + else + bitmap[Y, X]; + +getColorAt: RGB(2) * int * int -> RGB; getColorAt(bitmap(2), x, y) := bitmap[y, x]; lightGreen := (R: 51, G: 255, B: 51); lightRed := (R: 255, G: 51, B: 51); main(args(2)) := - let - width := 1920; - height := 1200; - - cleanImage := newBitmap(width, height); - - filledGreen := fill(cleanImage, lightGreen); - - redCenter := setColorAt(filledGreen, width / 2, height / 2, lightRed); - in - getColorAt(redCenter, width / 2, height / 2); + let + width := 1920; + height := 1200; + + cleanImage := newBitmap(width, height); + + filledGreen := fill(cleanImage, lightGreen); + + redCenter := setColorAt(filledGreen, width / 2, height / 2, lightRed); + in + getColorAt(redCenter, width / 2, height / 2); diff --git a/Task/Bitmap/Uiua/bitmap.uiua b/Task/Bitmap/Uiua/bitmap.uiua new file mode 100644 index 0000000000..3e952126ca --- /dev/null +++ b/Task/Bitmap/Uiua/bitmap.uiua @@ -0,0 +1,3 @@ +↯ 50_50_3 Red # Fill with red. +⍜(⊡25_25|⋅White) # Add white spot. +⊸⊡0_0 # Get pixel [0 0]. diff --git a/Task/Bitmap/Vedit-macro-language/bitmap.vedit b/Task/Bitmap/Vedit-macro-language/bitmap.vedit index 616c17071b..56f41c3f72 100644 --- a/Task/Bitmap/Vedit-macro-language/bitmap.vedit +++ b/Task/Bitmap/Vedit-macro-language/bitmap.vedit @@ -1,5 +1,5 @@ -#11 = 400 // Width of the image -#12 = 300 // Height of the image +#11 = 400 // Width of the image +#12 = 300 // Height of the image // Create an empty RGB image and fill it with black color // @@ -13,16 +13,16 @@ Repeat(#11 * #12) { // Fill the image with dark blue color // -#5 = 0 // Red -#6 = 0 // Green -#7 = 64 // Blue +#5 = 0 // Red +#6 = 0 // Green +#7 = 64 // Blue Call("FILL_IMAGE") // Draw one pixel in orange color // -#1 = 100 // x -#2 = 50 // y -#5 = 255 #6 = 128 #7 = 0 // Orange color +#1 = 100 // x +#2 = 50 // y +#5 = 255 #6 = 128 #7 = 0 // Orange color Call("DRAW_PIXEL") // Get the color of a pixel diff --git a/Task/Bitmap/Yabasic/bitmap.basic b/Task/Bitmap/Yabasic/bitmap.basic index cad0519374..0dbe5417f2 100644 --- a/Task/Bitmap/Yabasic/bitmap.basic +++ b/Task/Bitmap/Yabasic/bitmap.basic @@ -6,8 +6,8 @@ backcolor 255, 0, 0 // red clear window -color 0, 255, 0 // green +color 0, 255, 0 // green dot 100, 100 -c$ = getbit$(100, 100, 100, 100) // get color area 1x1 pixel +c$ = getbit$(100, 100, 100, 100) // get color area 1x1 pixel print c$ diff --git a/Task/Bitmap/Zig/bitmap.zig b/Task/Bitmap/Zig/bitmap.zig new file mode 100644 index 0000000000..08b57964ef --- /dev/null +++ b/Task/Bitmap/Zig/bitmap.zig @@ -0,0 +1,96 @@ +const std = @import("std"); + +pub const Rgb = struct { + r: u8, + g: u8, + b: u8, +}; + +pub const PixelOutOfBounds = error{PixelOutOfBounds}; + +pub const Bitmap = struct { + width: usize, + height: usize, + pixels: []Rgb, + + // The ! next to the return type communicates that the function may return an error + pub fn new(allocator: std.mem.Allocator, width: usize, height: usize) !Bitmap { + // In Zig libraries that allocate receive an allocator + // instead of choosing one themselves + var pixels = try allocator.alloc(Rgb, width * height); + + for (0..width*height) | i | { + pixels[i] = Rgb { .r = 0, .g = 0, .b = 0 }; + } + + return Bitmap { + .width = width, + .height = height, + .pixels = pixels, + }; + } + + pub fn free(self: Bitmap, allocator: std.mem.Allocator) void { + allocator.free(self.pixels); + } + + pub fn fill(self: *Bitmap, color: Rgb) void { + for (0..self.width*self.height) | i | { + self.pixels[i] = color; + } + } + + pub fn get_pixel_unchecked(self: Bitmap, x: usize, y: usize) Rgb { + return self.pixels[self.height * y + x]; + } + + pub fn get_pixel(self: Bitmap, x: usize, y: usize) !Rgb { + if (self.width <= x or self.height <= y) { + return error.PixelOutOfBounds; + } + + return self.get_pixel_unchecked(x, y); + } + + pub fn set_pixel_unchecked(self: *Bitmap, x: usize, y: usize, color: Rgb) void { + self.pixels[self.height * y + x] = color; + } + + pub fn set_pixel(self: *Bitmap, x: usize, y: usize, color: Rgb) !void { + if (self.width <= x or self.height <= y) { + return error.PixelOutOfBounds; + } + + return self.set_pixel_unchecked(x, y, color); + } +}; + +test "putting a pixel gets the pixel" { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + const allocator = gpa.allocator(); + + var bm = try Bitmap.new(allocator, 10, 10); + defer bm.free(allocator); + + try bm.set_pixel(4, 4, Rgb {.r=255, .g=0, .b=0}); + + const pixel = try bm.get_pixel(4, 4); + + try std.testing.expectEqual(255, pixel.r); +} + +test "filling a pixel gets all the pixels" { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + const allocator = gpa.allocator(); + + var bm = try Bitmap.new(allocator, 10, 10); + defer bm.free(allocator); + + bm.fill(Rgb {.r=255, .g=0, .b=0}); + + for (0..10) | x | { + for (0..10) | y | { + try std.testing.expectEqual(255, bm.get_pixel_unchecked(x, y).r); + } + } +} diff --git a/Task/Bitmap/Zkl/bitmap-1.zkl b/Task/Bitmap/Zkl/bitmap-1.zkl index b0784bda52..684616c368 100644 --- a/Task/Bitmap/Zkl/bitmap-1.zkl +++ b/Task/Bitmap/Zkl/bitmap-1.zkl @@ -1,16 +1,16 @@ -class PPM{ // (0,0) is logically bottom left +class PPM{ // (0,0) is logically bottom left fcn init(width,height){ sz:=width*height*3; var [const] data=sz.pump(Data(sz),0), // initialize to Black (RGB=000) - w=width, h=height; + w=width, h=height; } fcn fill(rgb){ sz:=data.len()/3; data.clear(); sz.pump(data,T(Void,rgb.toBigEndian(3))); } fcn __sGet(x,y) { data.toBigEndian(3*y*w + 3*x,3); } //ppm[x,y] - fcn __sSet(rbg,x,y){ data[3*y*w + 3*x,3]=rbg.toBigEndian(3); } //ppm[x,y]=rgb + fcn __sSet(rbg,x,y){ data[3*y*w + 3*x,3]=rbg.toBigEndian(3); } //ppm[x,y]=rgb fcn write(out){ // write bottom to top to move (0,0) from bottom left to bottom left out.write("P6\n#rosettacode PPM\n%d %d\n255\n".fmt(w,h)); [h-1..0, -1].pump(out,'wrap(h){ data.seek(3*h*w); data.read(3*w) }); diff --git a/Task/Bitwise-IO/11l/bitwise-io.11l b/Task/Bitwise-IO/11l/bitwise-io.11l index 965a6ec7d3..65b35526b7 100644 --- a/Task/Bitwise-IO/11l/bitwise-io.11l +++ b/Task/Bitwise-IO/11l/bitwise-io.11l @@ -1,10 +1,10 @@ T BitWriter - File out + FileWr out accumulator = 0 bcount = 0 F (fname) - .out = File(fname, ‘w’) + .out = File(fname, WRITE) F _writebit(bit) I .bcount == 8 @@ -34,11 +34,11 @@ T BitReader read = 0 F (fname) - .input = File(fname, ‘r’) + .input = File(fname) F _readbit() I .bcount == 0 - V a = .input.read_bytes(1) + V a = .input.read_bytes(at_most' 1) I !a.empty .accumulator = a[0] .bcount = 8 diff --git a/Task/Bitwise-IO/Ada/bitwise-io-1.ada b/Task/Bitwise-IO/Ada/bitwise-io-1.adb similarity index 100% rename from Task/Bitwise-IO/Ada/bitwise-io-1.ada rename to Task/Bitwise-IO/Ada/bitwise-io-1.adb diff --git a/Task/Bitwise-IO/Ada/bitwise-io-2.ada b/Task/Bitwise-IO/Ada/bitwise-io-2.adb similarity index 100% rename from Task/Bitwise-IO/Ada/bitwise-io-2.ada rename to Task/Bitwise-IO/Ada/bitwise-io-2.adb diff --git a/Task/Bitwise-IO/Ada/bitwise-io-3.ada b/Task/Bitwise-IO/Ada/bitwise-io-3.adb similarity index 100% rename from Task/Bitwise-IO/Ada/bitwise-io-3.ada rename to Task/Bitwise-IO/Ada/bitwise-io-3.adb diff --git a/Task/Bitwise-IO/C++/bitwise-io.cpp b/Task/Bitwise-IO/C++/bitwise-io.cpp new file mode 100644 index 0000000000..70fcad159c --- /dev/null +++ b/Task/Bitwise-IO/C++/bitwise-io.cpp @@ -0,0 +1,114 @@ +#include +#include +#include +#include + +class BitFilter { +public: + BitFilter(const std::string& filePath) { + writer.open(filePath, std::ios_base::binary); + reader.open(filePath, std::ios_base::binary); + accumulator = 0; + bits = 0; + } + + void write(const std::vector& chars, const uint32_t& startIndex, + uint32_t bitCount, uint32_t bitsOmittedCount) { + uint32_t index = startIndex + bitsOmittedCount / 8; + bitsOmittedCount %= 8; + + while ( bitCount > 0 || bits >= 8 ) { + while ( bits >= 8 ) { + bits -= 8; + writer.put(accumulator >> bits); + accumulator &= ( 1 << bits ) - 1; + } + + while ( bits < 8 && bitCount > 0 ) { + accumulator = ( accumulator << 1 ) | + ( ( ( 128 >> bitsOmittedCount ) & chars[index] ) >> ( 7 - bitsOmittedCount ) ); + bitCount -= 1; + bits += 1; + if ( ++bitsOmittedCount == 8 ) { + bitsOmittedCount = 0; + index += 1; + } + } + } + } + + void read(std::vector& chars, const uint32_t& startIndex, + uint32_t bitCount, uint32_t bitsOmittedCount) { + uint32_t index = startIndex + bitsOmittedCount / 8; + bitsOmittedCount %= 8; + + while ( bitCount > 0 ) { + while ( bits > 0 && bitCount > 0 ) { + const uint32_t mask = 128 >> bitsOmittedCount; + if ( ( accumulator & ( 1 << ( bits - 1 ) ) ) > 0 ) { + chars[index] = chars[index] | mask; + } else { + chars[index] = chars[index] & ( ~mask & 0xff ); + } + + bitCount -= 1; + bits -= 1; + if ( ++bitsOmittedCount >= 8 ) { + bitsOmittedCount = 0; + index += 1; + } + } + + if ( bitCount > 0 ) { + char qq; + reader.read((&qq), 1); + accumulator = ( accumulator << 8 ) | qq; + bits += 8; + } + } + } + + void close_writer() { + if ( bits != 0 ) { + accumulator <<= 8 - bits; + writer.put(accumulator); + } + + writer.close(); + accumulator = 0; + bits = 0; + } + + void close_reader() { + reader.close(); + accumulator = 0; + bits = 0; + } + +private: + uint32_t accumulator, bits; + std::ofstream writer; + std::ifstream reader; +}; + +int main() { + BitFilter bitFilter("BitwiseIO.dat"); + std::string source = "abcde12345"; + std::vector chars(source.begin(), source.end()); + + // For each char in 'chars', write 7 bits omitting the most significant bit + for ( uint32_t i = 0; i < chars.size(); ++i ) { + bitFilter.write(chars, i, 7, 1); + } + bitFilter.close_writer(); + + // Read 7 bits and expand to a char of 'destination' by reconstructing the most significant bit + std::vector destination(chars.size()); + for ( uint32_t i = 0; i < destination.size(); ++i ) { + bitFilter.read(destination, i, 7, 1); + } + bitFilter.close_reader(); + + std::string result(destination.data()); + std::cout << result << std::endl; +} diff --git a/Task/Bitwise-IO/Delphi/bitwise-io.delphi b/Task/Bitwise-IO/Delphi/bitwise-io.pas similarity index 100% rename from Task/Bitwise-IO/Delphi/bitwise-io.delphi rename to Task/Bitwise-IO/Delphi/bitwise-io.pas diff --git a/Task/Bitwise-IO/DuckDB/bitwise-io-1.duckdb b/Task/Bitwise-IO/DuckDB/bitwise-io-1.duckdb new file mode 100644 index 0000000000..df8d7f60c4 --- /dev/null +++ b/Task/Bitwise-IO/DuckDB/bitwise-io-1.duckdb @@ -0,0 +1,8 @@ +# s should be a bitstring. +# Right-pad s with 0s so that the length of the output string is a multiple of 8. +CREATE OR REPLACE FUNCTION print_bits(s) as ( + format('{:0<{}}', s, (ceil(length(s) / 8) * 8)::INT) +); + +# Example: +select print_bits('101'::BITSTRING); diff --git a/Task/Bitwise-IO/DuckDB/bitwise-io-2.duckdb b/Task/Bitwise-IO/DuckDB/bitwise-io-2.duckdb new file mode 100644 index 0000000000..57ab55eb4d --- /dev/null +++ b/Task/Bitwise-IO/DuckDB/bitwise-io-2.duckdb @@ -0,0 +1,13 @@ +# "Compress" a string by printing it as a bitstring without the left-most bit of each byte +CREATE OR REPLACE FUNCTION sevenbits(str) as ( + select string_agg(format('{}', ascii(s)::BITSTRING)[-7:], '') + from (select unnest(regexp_extract_all(str, '.')) as s) +); + +# Undo sevenbits() +CREATE OR REPLACE FUNCTION from_sevenbits(str) as ( + select string_agg(chr(s::BIT::INT), '') + from (select unnest(regexp_extract_all(str, '.......')) as s) +); + +select from_sevenbits(sevenbits('abracadabra')); diff --git a/Task/Bitwise-IO/FreeBASIC/bitwise-io.basic b/Task/Bitwise-IO/FreeBASIC/bitwise-io.basic new file mode 100644 index 0000000000..b93e488d79 --- /dev/null +++ b/Task/Bitwise-IO/FreeBASIC/bitwise-io.basic @@ -0,0 +1,112 @@ +Type BitFilter + nombre As String + accu As Integer + bits As Integer + bw As Integer + br As Integer + offset As Integer +End Type + +Sub openWriter(bf As BitFilter) + bf.bw = Freefile + Open bf.nombre For Binary Access Write As #bf.bw +End Sub + +Sub openReader(bf As BitFilter) + bf.br = Freefile + Open bf.nombre For Binary Access Read As #bf.br + bf.offset = 0 +End Sub + +Sub escribe(bf As BitFilter, buf() As Byte, start As Integer, nBits As Integer, shift As Integer) + Dim As Integer index = start + (shift \ 8) + shift Mod= 8 + While nBits <> 0 Or bf.bits >= 8 + While bf.bits >= 8 + bf.bits -= 8 + Dim As Byte outByte = ((bf.accu Shr bf.bits) And &hFF) + Put #bf.bw, , outByte + Wend + While bf.bits < 8 And nBits <> 0 + Dim As Byte b = buf(index) + bf.accu = (bf.accu Shl 1) Or (((128 Shr shift) And b) Shr (7 - shift)) + nBits -= 1 + bf.bits += 1 + shift += 1 + If shift = 8 Then + shift = 0 + index += 1 + End If + Wend + Wend +End Sub + +Sub lee(bf As BitFilter, buf() As Byte, start As Integer, nBits As Integer, shift As Integer) + Dim As Integer index = start + (shift \ 8) + shift Mod= 8 + While nBits <> 0 + While bf.bits <> 0 And nBits <> 0 + Dim As Byte mask = 128 Shr shift + buf(index) = Iif((bf.accu And (1 Shl (bf.bits - 1))) <> 0, (buf(index) Or mask) And &hFF, (buf(index) And Not mask) And &hFF) + nBits -= 1 + bf.bits -= 1 + shift += 1 + If shift >= 8 Then + shift = 0 + index += 1 + End If + Wend + If nBits = 0 Then Exit Sub + Dim As Byte inByte + Get #bf.br, bf.offset + 1, inByte + bf.accu = (bf.accu Shl 8) Or inByte + bf.bits += 8 + bf.offset += 1 + Wend +End Sub + +Sub closeWriter(bf As BitFilter) + If bf.bits <> 0 Then + bf.accu Shl= (8 - bf.bits) + Dim As Byte outByte = (bf.accu And &hFF) + Put #bf.bw, , outByte + End If + Close #bf.bw + bf.accu = 0 + bf.bits = 0 +End Sub + +Sub closeReader(bf As BitFilter) + Close #bf.br + bf.accu = 0 + bf.bits = 0 + bf.offset = 0 +End Sub + +Dim As Integer i +Dim As BitFilter bf +bf.nombre = "test.bin" + +' for each byte in s, write 7 bits skipping 1 +Dim As Byte s(10) => {Asc("a"), Asc("b"), Asc("c"), Asc("d"), _ +Asc("e"), Asc("f"), Asc("g"), Asc("h"), Asc("i"), Asc("j"), Asc("k")} +openWriter(bf) +For i = 0 To Ubound(s) + escribe(bf, s(), i, 7, 1) +Next i +closeWriter(bf) + +' read 7 bits and expand to each byte of s2 skipping 1 bit +openReader(bf) +Dim As Byte s2(0 To Ubound(s)) = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +For i = 0 To Ubound(s2) + lee(bf, s2(), i, 7, 1) +Next i +closeReader(bf) + +For i = 0 To Ubound(s2) + Print Chr(s2(i)); +Next i +Print + +Sleep diff --git a/Task/Bitwise-IO/Java/bitwise-io.java b/Task/Bitwise-IO/Java/bitwise-io.java new file mode 100644 index 0000000000..06a000098b --- /dev/null +++ b/Task/Bitwise-IO/Java/bitwise-io.java @@ -0,0 +1,112 @@ +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.charset.StandardCharsets; + +public final class BitwiseIO { + + public static void main(String[] args) throws IOException { + BitFilter bitFilter = new BitFilter("BitwiseIO.dat"); + byte[] source = "abcde12345".getBytes(StandardCharsets.ISO_8859_1); + + // For each byte in 'source', write 7 bits omitting the most significant bit + for ( int i = 0; i < source.length; i++ ) { + bitFilter.write(source, i, 7, 1); + } + bitFilter.closeWriter(); + + // Read 7 bits and expand to a byte of 'destination' by reconstructing the most significant bit + byte[] destination = new byte[source.length]; + for ( int i = 0; i < destination.length; i++ ) { + bitFilter.read(destination, i, 7, 1); + } + bitFilter.closeReader(); + + System.out.println( new String(destination) ); + } + +} + +final class BitFilter { + + public BitFilter(String filePath) throws IOException { + bufferedWriter = new BufferedWriter( new FileWriter(filePath) ); + bufferedReader = new BufferedReader( new FileReader(filePath) ); + } + + public void write(byte[] bytes, int startIndex, int bitCount, int bitsOmittedCount) throws IOException { + int index = startIndex + bitsOmittedCount / 8; + bitsOmittedCount %= 8; + + while ( bitCount > 0 || bits >= 8 ) { + while ( bits >= 8 ) { + bits -= 8; + bufferedWriter.write(accumulator >>> bits); + accumulator &= ( 1 << bits ) - 1; + } + + while ( bits < 8 && bitCount > 0 ) { + accumulator = ( accumulator << 1 ) | + ( ( ( 128 >>> bitsOmittedCount ) & bytes[index] ) >>> ( 7 - bitsOmittedCount ) ); + bitCount -= 1; + bits += 1; + if ( ++bitsOmittedCount == 8 ) { + bitsOmittedCount = 0; + index += 1; + } + } + } + } + + public void read(byte[] bytes, int startIndex, int bitCount, int bitsOmittedCount) throws IOException { + int index = startIndex + bitsOmittedCount / 8; + bitsOmittedCount %= 8; + + while ( bitCount > 0 ) { + while ( bits > 0 && bitCount > 0 ) { + final int mask = 128 >>> bitsOmittedCount; + if ( ( accumulator & ( 1 << ( bits - 1 ) ) ) > 0 ) { + bytes[index] = (byte) ( bytes[index] | mask ); + } else { + bytes[index] = (byte) ( bytes[index] & ( ~mask & 0xff ) ); + } + + bitCount -= 1; + bits -= 1; + if ( ++bitsOmittedCount >= 8 ) { + bitsOmittedCount = 0; + index += 1; + } + } + + if ( bitCount > 0 ) { + accumulator = ( accumulator << 8 ) | bufferedReader.read(); + bits += 8; + } + } + } + + public void closeWriter() throws IOException { + if ( bits != 0 ) { + accumulator <<= 8 - bits; + bufferedWriter.write(accumulator); + } + + bufferedWriter.close(); + accumulator = 0; + bits = 0; + } + + public void closeReader() throws IOException { + bufferedReader.close(); + accumulator = 0; + bits = 0; + } + + private int accumulator, bits; + private BufferedWriter bufferedWriter; + private BufferedReader bufferedReader; + +} diff --git a/Task/Bitwise-IO/Julia/bitwise-io.julia b/Task/Bitwise-IO/Julia/bitwise-io.jl similarity index 100% rename from Task/Bitwise-IO/Julia/bitwise-io.julia rename to Task/Bitwise-IO/Julia/bitwise-io.jl diff --git a/Task/Bitwise-IO/Kotlin/bitwise-io.kotlin b/Task/Bitwise-IO/Kotlin/bitwise-io.kts similarity index 100% rename from Task/Bitwise-IO/Kotlin/bitwise-io.kotlin rename to Task/Bitwise-IO/Kotlin/bitwise-io.kts diff --git a/Task/Bitwise-IO/OCaml/bitwise-io-1.ocaml b/Task/Bitwise-IO/OCaml/bitwise-io-1.ml similarity index 100% rename from Task/Bitwise-IO/OCaml/bitwise-io-1.ocaml rename to Task/Bitwise-IO/OCaml/bitwise-io-1.ml diff --git a/Task/Bitwise-IO/OCaml/bitwise-io-2.ocaml b/Task/Bitwise-IO/OCaml/bitwise-io-2.ml similarity index 100% rename from Task/Bitwise-IO/OCaml/bitwise-io-2.ocaml rename to Task/Bitwise-IO/OCaml/bitwise-io-2.ml diff --git a/Task/Bitwise-IO/Rebol/bitwise-io.rebol b/Task/Bitwise-IO/Rebol/bitwise-io.rebol new file mode 100644 index 0000000000..80dccaaf08 --- /dev/null +++ b/Task/Bitwise-IO/Rebol/bitwise-io.rebol @@ -0,0 +1,59 @@ +Rebol [ + title: "Rosetta code: Bitwise IO" + file: %Bitwise_IO.r3 + url: https://rosettacode.org/wiki/Bitwise_IO + note: "Based on Vasyl Zubko's Red language implementation!" +] + +compress-7bit: function [ + "Pack 8-bit bytes into 7-bit chunks (lossless for 7-bit ASCII)" + str [string! binary!] +][ + buf: clear "" ;; string buffer for 7-bit bitstream + bits: enbase/flat str 2 ;; convert input to a flat binary string "0101..." + while [not tail? bits][ ;; take 7 bits out of every 8 + append buf copy/part next bits 7 ;; append bits 2..8 (skip the first bit of each byte) + bits: skip bits 8 ;; move to next 8-bit group + ] + ;; Pad to multiple of 8 bits so it can be debased to bytes + unless zero? (pad-bits: (length? buf) // 8) [ + append/dup buf #"0" 8 - pad-bits + ] + debase buf 2 ;; turn the 7-bit stream (padded) back into binary bytes +] + +decompress-7bit: function [ + "Unpack 7-bit chunks back to 8-bit by re-inserting the leading zero bit per group of 7" + bin [binary!] +][ + bits: enbase/flat bin 2 ;; bitstring of the compressed bytes + filled: 0 ;; counter within a 7-bit group + buf: clear #{} ;; output binary buffer + acc: clear "" ;; accumulator for 7 bits + + foreach bit bits [ + append acc bit ;; collect one bit + filled: filled + 1 + if filled = 7 [ + ;; Prepend a '0' to restore 8th bit, debase to a byte, append to output + append buf debase join #"0" acc 2 + clear acc + filled: 0 + ] + ] + ;; If padding produced a final 0 byte, drop it + if 0 == last buf [take/last buf] + to string! buf ;; return original as string +] + +;- DEMO: +in-string: "Rebol is not dead!" +compressed: compress-7bit in-string ;; compress to 7-bit packed binary +expanded: decompress-7bit compressed ;; decompress back to original + +print [ + "^/in-string :" in-string + "^/in-binary :" to binary! in-string + "^/compressed:" compressed + "^/expanded :" expanded +] diff --git a/Task/Bitwise-IO/Rust/bitwise-io.rust b/Task/Bitwise-IO/Rust/bitwise-io.rs similarity index 100% rename from Task/Bitwise-IO/Rust/bitwise-io.rust rename to Task/Bitwise-IO/Rust/bitwise-io.rs diff --git a/Task/Bitwise-IO/Seed7/bitwise-io.seed7 b/Task/Bitwise-IO/Seed7/bitwise-io.seed7 index be4d07b5cc..413c230ed9 100644 --- a/Task/Bitwise-IO/Seed7/bitwise-io.seed7 +++ b/Task/Bitwise-IO/Seed7/bitwise-io.seed7 @@ -1,14 +1,7 @@ $ include "seed7_05.s7i"; include "bitdata.s7i"; - include "strifile.s7i"; -const proc: initWriteAscii (inout file: outFile, inout integer: bitPos) is func - begin - outFile.bufferChar := '\0;'; - bitPos := 0; - end func; - -const proc: writeAscii (inout file: outFile, inout integer: bitPos, in string: ascii) is func +const proc: writeAscii (inout msbOutBitStream: outStream, in string: ascii) is func local var char: ch is ' '; begin @@ -16,45 +9,38 @@ const proc: writeAscii (inout file: outFile, inout integer: bitPos, in string: a if ch > '\127;' then raise RANGE_ERROR; else - putBitsMsb(outFile, bitPos, ord(ch), 7); + putBits(outStream, ord(ch), 7); end if; end for; end func; -const proc: finishWriteAscii (inout file: outFile, inout integer: bitPos) is func +const proc: finishWriteAscii (inout msbOutBitStream: outStream) is func begin - write(outFile, chr(ord(outFile.bufferChar))); + putBits(outStream, 0, 7); # Write a terminating NUL char. + flush(outStream); end func; -const proc: initReadAscii (inout file: outFile, inout integer: bitPos) is func - begin - bitPos := 8; - end func; - -const func string: readAscii (inout file: inFile, inout integer: bitPos, in integer: length) is func +const func string: readAscii (inout msbInBitStream: inStream) is func result var string: stri is ""; local var char: ch is ' '; begin - while not eof(inFile) and length(stri) < length do - ch := chr(getBitsMsb(inFile, bitPos, 7)); - if inFile.bufferChar <> EOF then + repeat + ch := chr(getBits(inStream, 7)); + if ch <> '\0;' then stri &:= ch; end if; - end while; + until ch = '\0;'; end func; const proc: main is func local - var file: aFile is STD_NULL; - var integer: bitPos is 0; + var msbOutBitStream: outStream is msbOutBitStream.value; + var msbInBitStream: inStream is msbInBitStream.value; begin - aFile := openStrifile; - initWriteAscii(aFile, bitPos); - writeAscii(aFile, bitPos, "Hello, Rosetta Code!"); - finishWriteAscii(aFile, bitPos); - seek(aFile, 1); - initReadAscii(aFile, bitPos); - writeln(literal(readAscii(aFile, bitPos, 100))); + writeAscii(outStream, "Hello, Rosetta Code!"); + finishWriteAscii(outStream); + inStream := openMsbInBitStream(getBytes(outStream)); + writeln(literal(readAscii(inStream))); end func; diff --git a/Task/Bitwise-operations/11l/bitwise-operations.11l b/Task/Bitwise-operations/11l/bitwise-operations.11l index 824918ca04..cd2aa30c15 100644 --- a/Task/Bitwise-operations/11l/bitwise-operations.11l +++ b/Task/Bitwise-operations/11l/bitwise-operations.11l @@ -2,7 +2,7 @@ V x = 10 V y = 2 print(‘x = ’x) print(‘y = ’y) -print(‘NOT x = ’(-)x) +print(‘NOT x = ’(~x)) print(‘x AND y = ’(x [&] y)) print(‘x OR y = ’(x [|] y)) print(‘x XOR y = ’(x (+) y)) diff --git a/Task/Bitwise-operations/ALGOL-68/bitwise-operations-1.alg b/Task/Bitwise-operations/ALGOL-68/bitwise-operations-1.alg index 7fdf9b8d88..ea11b79d5f 100644 --- a/Task/Bitwise-operations/ALGOL-68/bitwise-operations-1.alg +++ b/Task/Bitwise-operations/ALGOL-68/bitwise-operations-1.alg @@ -1,8 +1,13 @@ -main:( +BEGIN + + BITS all bits mask = NOT 16r0; + LONG BITS long bits mask = LENG all bits mask; PRIO SLC = 8, SRC = 8; # SLC and SRC are not built in, define and overload them here # OP SLC = (BITS b, INT rotate) BITS: b SHL rotate OR b SHR ( bits width - rotate ); - OP SRC = (BITS b, INT rotate) BITS: b SHR rotate OR b SHL ( bits width - rotate ); + OP SRC = (BITS b, INT rotate) BITS: b SHR rotate OR SHORTEN ( long bits mask + AND ( LENG b SHL ( bits width - rotate ) ) + ); # SRC and SRL are non-standard, but versions are built in to ALGOL 68R's standard prelude # PRIO XOR = 2; @@ -10,7 +15,10 @@ main:( # XOR is non-standard, but a version is built in to ALGOL 68G's standard prelude # # ALGOL 68 has 5 different ways of representing a BINary BITS - Bases: 2, 4, 8, 16 and flip/flop # - FORMAT b5 = $"2r"2r32d," 4r"4r16d," 8r"8r11d," 16r"16r8d," "gl$; + FORMAT b5 = IF bits width > 32 + THEN $"2r"2r64d," 4r"4r32d,l" 8r"8r22d," 16r"16r16d,l" "gl$ + ELSE $"2r"2r32d," 4r"4r16d," 8r"8r11d," 16r"16r8d,l" "gl$ + FI; OP BBBBB = (BITS b)[]BITS: (b,b,b,b,b); PROC bitwise = (BITS a, BITS b, INT shift)VOID: @@ -61,4 +69,4 @@ CO bitwise(8r377,8r252,5); bitwise(16rff,16raa,5) END CO -) +END diff --git a/Task/Bitwise-operations/Ada/bitwise-operations.ada b/Task/Bitwise-operations/Ada/bitwise-operations.adb similarity index 100% rename from Task/Bitwise-operations/Ada/bitwise-operations.ada rename to Task/Bitwise-operations/Ada/bitwise-operations.adb diff --git a/Task/Bitwise-operations/AutoIt/bitwise-operations.autoit b/Task/Bitwise-operations/AutoIt/bitwise-operations.au3 similarity index 100% rename from Task/Bitwise-operations/AutoIt/bitwise-operations.autoit rename to Task/Bitwise-operations/AutoIt/bitwise-operations.au3 diff --git a/Task/Bitwise-operations/COBOL/bitwise-operations-1.cobol b/Task/Bitwise-operations/COBOL/bitwise-operations-1.cob similarity index 100% rename from Task/Bitwise-operations/COBOL/bitwise-operations-1.cobol rename to Task/Bitwise-operations/COBOL/bitwise-operations-1.cob diff --git a/Task/Bitwise-operations/COBOL/bitwise-operations-2.cobol b/Task/Bitwise-operations/COBOL/bitwise-operations-2.cob similarity index 100% rename from Task/Bitwise-operations/COBOL/bitwise-operations-2.cobol rename to Task/Bitwise-operations/COBOL/bitwise-operations-2.cob diff --git a/Task/Bitwise-operations/Crystal/bitwise-operations.cr b/Task/Bitwise-operations/Crystal/bitwise-operations.cr new file mode 100644 index 0000000000..3fa0470d8a --- /dev/null +++ b/Task/Bitwise-operations/Crystal/bitwise-operations.cr @@ -0,0 +1,9 @@ +def operations (x, y) + p! x, y, + x & y, x | y, x ^ y, + ~x, + x << y, x >> y, + x.rotate_left(y), x.rotate_right(y) +end + +operations 10, 2 diff --git a/Task/Bitwise-operations/Delphi/bitwise-operations.delphi b/Task/Bitwise-operations/Delphi/bitwise-operations.pas similarity index 100% rename from Task/Bitwise-operations/Delphi/bitwise-operations.delphi rename to Task/Bitwise-operations/Delphi/bitwise-operations.pas diff --git a/Task/Bitwise-operations/DuckDB/bitwise-operations-1.duckdb b/Task/Bitwise-operations/DuckDB/bitwise-operations-1.duckdb new file mode 100644 index 0000000000..d81bf307e5 --- /dev/null +++ b/Task/Bitwise-operations/DuckDB/bitwise-operations-1.duckdb @@ -0,0 +1,5 @@ +create or replace function task(a,b) as table ( + select a, b, a&b, a|b, xor(a, b), ~a, a << b, a >> b +); + +from task(10, 2); diff --git a/Task/Bitwise-operations/DuckDB/bitwise-operations-2.duckdb b/Task/Bitwise-operations/DuckDB/bitwise-operations-2.duckdb new file mode 100644 index 0000000000..2e48fb4dd1 --- /dev/null +++ b/Task/Bitwise-operations/DuckDB/bitwise-operations-2.duckdb @@ -0,0 +1,5 @@ +select 10 as v, + ~(v::BITSTRING), + ~(v::INT) as "~INT", + ~(v::BIGINT) as "~BIGINT", + ~(10::UINTEGER) as "~UINTEGER"; diff --git a/Task/Bitwise-operations/EasyLang/bitwise-operations.easy b/Task/Bitwise-operations/EasyLang/bitwise-operations.easy index 433a6625bb..800e7fa354 100644 --- a/Task/Bitwise-operations/EasyLang/bitwise-operations.easy +++ b/Task/Bitwise-operations/EasyLang/bitwise-operations.easy @@ -1,9 +1,10 @@ -# numbers are doubles, bit operations use 32 bits and are unsigned -x = 11 -y = 2 -print bitnot x -print bitand x y -print bitor x y -print bitxor x y -print bitshift x y -print bitshift x -y +# numbers are doubles, bit operations are unsigned, truncate +# the fractional part and use 53 integer bits +a = 14 +b = 3 +print bitand a b +print bitor a b +print bitxor a b +print bitshift a b +print bitshift a -b +print bitand a bitnot b diff --git a/Task/Bitwise-operations/Elena/bitwise-operations.elena b/Task/Bitwise-operations/Elena/bitwise-operations.elena index 941e955022..d176f667cd 100644 --- a/Task/Bitwise-operations/Elena/bitwise-operations.elena +++ b/Task/Bitwise-operations/Elena/bitwise-operations.elena @@ -2,18 +2,18 @@ import extensions; extension testOp { - bitwiseTest(y) - { - console.printLine(self," and ",y," = ",self & y); - console.printLine(self," or ",y," = ",self | y); - console.printLine(self," xor ",y," = ",self ^ y); - console.printLine("not ",self," = ",self.BInverted); - console.printLine(self," shr ",y," = ",self.shiftRight(y)); - console.printLine(self," shl ",y," = ",self.shiftLeft(y)); - } + bitwiseTest(y) + { + Console.printLine(self," and ",y," = ",self.band(y)); + Console.printLine(self," or ",y," = ",self.bor(y)); + Console.printLine(self," xor ",y," = ",self.bxor(y)); + Console.printLine("not ",self," = ",self.BInverted); + Console.printLine(self," shr ",y," = ",self.shiftRight(y)); + Console.printLine(self," shl ",y," = ",self.shiftLeft(y)); + } } -public program() +public Program() { - console.loadLineTo(new Integer()).bitwiseTest(console.loadLineTo(new Integer())) + Console.loadLineTo(new Integer()).bitwiseTest(Console.loadLineTo(new Integer())) } diff --git a/Task/Bitwise-operations/Elixir/bitwise-operations.elixir b/Task/Bitwise-operations/Elixir/bitwise-operations.ex similarity index 100% rename from Task/Bitwise-operations/Elixir/bitwise-operations.elixir rename to Task/Bitwise-operations/Elixir/bitwise-operations.ex diff --git a/Task/Bitwise-operations/Icon/bitwise-operations.icon b/Task/Bitwise-operations/Icon/bitwise-operations.icon index 4bcace1afa..92610583bb 100644 --- a/Task/Bitwise-operations/Icon/bitwise-operations.icon +++ b/Task/Bitwise-operations/Icon/bitwise-operations.icon @@ -1,3 +1,5 @@ +link bitint # for int2bit + procedure main() bitdemo(255,2) bitdemo(-15,3) diff --git a/Task/Bitwise-operations/Jq/bitwise-operations.jq b/Task/Bitwise-operations/Jq/bitwise-operations.jq new file mode 100644 index 0000000000..4724c12f65 --- /dev/null +++ b/Task/Bitwise-operations/Jq/bitwise-operations.jq @@ -0,0 +1,32 @@ +include "bitwise" {search: "."}; # adjust as required + +def leftshift($n; $width): + [(range(0,$n)| 0), limit($width - $n; bitwise)][:$width] | to_int; + +# Using a width of $width bits: x << n | x >> ($width-n) +def rotateLeft($x; $n; $width): + $x | bitwise_or(leftshift($n; $width); rightshift($width-$n)); + +# Using a width of $width bits: x << n | x >> ($width-n) +def rotateRight($x; $n; $width): + $x | bitwise_or(rightshift($n); leftshift($width-$n; $width) ); + +def task($x; $y): + def isInteger: type == "number" and . == round; + if ($x|isInteger|not) or ($y|isInteger|not) or + $x < 0 or $y < 0 or $x > 4294967295 or $y > 4294967295 + then "Operands must be in the range of a 32-bit unsigned integer" | error + else + " x = \($x)", + " y = \($y)", + " x & y = \(bitwise_and($x; $y))", + " x | y = \(bitwise_or($x; $y))", + " x ^ y = \(null | xor(x; $y))", + "~x = \(32 | flip($x))", + " x << y = \($x | leftshift($y))", + " x >> y = \($x | rightshift($y))", + " x rl y = \(rotateLeft($x; $y; 32))", + " x rr y = \(rotateRight($x; $y; 32))" + end; + +task(10; 2) diff --git a/Task/Bitwise-operations/Julia/bitwise-operations.julia b/Task/Bitwise-operations/Julia/bitwise-operations.jl similarity index 100% rename from Task/Bitwise-operations/Julia/bitwise-operations.julia rename to Task/Bitwise-operations/Julia/bitwise-operations.jl diff --git a/Task/Bitwise-operations/Kotlin/bitwise-operations.kotlin b/Task/Bitwise-operations/Kotlin/bitwise-operations.kts similarity index 100% rename from Task/Bitwise-operations/Kotlin/bitwise-operations.kotlin rename to Task/Bitwise-operations/Kotlin/bitwise-operations.kts diff --git a/Task/Bitwise-operations/M2000-Interpreter/bitwise-operations.m2000 b/Task/Bitwise-operations/M2000-Interpreter/bitwise-operations.m2000 new file mode 100644 index 0000000000..7185314544 --- /dev/null +++ b/Task/Bitwise-operations/M2000-Interpreter/bitwise-operations.m2000 @@ -0,0 +1,43 @@ +module binary_ops{ + select case random(1, 6) + case 1 + Double x=10, y=2 + case 2 + Decimal x=10, y=2 + case 3 + Integer x=10, y=2 + case 4 + Long x=10, y=2 + case 5 ' byte from 0 to 255 (unsigned) + Byte x=10, y=2 + case else + Long Long x=10, y=2 + end select + print type$(x) + //x & y values from 0 to 4294967295 + print binary.not(x)=4294967285, sint(binary.not(x))=-11 + print binary.and(x, y)=2 + print binary.or(x, y)=10 + // y values -31 to 31 + print binary.xor(x, y)=8 + print binary.shift(x, y)=40 + print binary.shift(x, -y)=2 + print binary.rotate(x, y)=40 + print binary.rotate(x, -y)=2147483650, sint(binary.rotate(x, -y))=-2147483646 + // Binary.Neg return Unsigned from signed values: -2147483648 (0x8000_0000&) to 2147483647 (0x7FFF_FFFF&) + // values>2147483647 return 2147483648 + // values <-2147483648 return 2147483647 + // 0xFFFF_ABCD& (signed value), 0xFFFF_ABCD unsinged value same bits + print 0xFFFF_ABCD&=-21555, 0xFFFF_ABCD=4294945741, sint(0xFFFF_ABCD)=-21555 + print Binary.Neg(0xFFFF_ABCD&)=21554, Binary.Not(0xFFFF_ABCD)=21554 + print sint(Binary.Neg(0xFFFF_ABCD&)+ uint(0xFFFF_ABCD&))=sint(Binary.Neg(0)) + // signed 0xFFFF_ABCD& has same bits as unsigned 0xFFFF_ABCD, + // but have different value as used in calculations + print Binary.Neg(0xFFFF_ABCD&)=Binary.Not(0xFFFF_ABCD), 0xFFFF_ABCD&<>0xFFFF_ABCD + print Binary.Neg(0x0FFF_ABCD&)=Binary.Not(0x0FFF_ABCD), 0xFFFF_ABCD&<>0xFFFF_ABCD + // Add (modulo 32), x unsigned and add a negate signed (converted to unsigned) + print binary.add(x, binary.neg(y), 1)=8 ' 10 - 2 =12 + print binary.add(x, binary.neg(-y), 1)=12 ' 10 - - 2 = 12 + print sint(binary.neg(x))=-11, binary.neg(x)=binary.not(x) +} +binary_ops diff --git a/Task/Bitwise-operations/Nim/bitwise-operations.nim b/Task/Bitwise-operations/Nim/bitwise-operations.nim index 6932b12574..d831e18c5f 100644 --- a/Task/Bitwise-operations/Nim/bitwise-operations.nim +++ b/Task/Bitwise-operations/Nim/bitwise-operations.nim @@ -1,4 +1,4 @@ -proc bitwise(a, b) = +proc bitwise[T: SomeInteger](a, b: T) = echo "a and b: " , a and b echo "a or b: ", a or b echo "a xor b: ", a xor b diff --git a/Task/Bitwise-operations/OCaml/bitwise-operations.ocaml b/Task/Bitwise-operations/OCaml/bitwise-operations.ml similarity index 100% rename from Task/Bitwise-operations/OCaml/bitwise-operations.ocaml rename to Task/Bitwise-operations/OCaml/bitwise-operations.ml diff --git a/Task/Bitwise-operations/PascalABC.NET/bitwise-operations.pas b/Task/Bitwise-operations/PascalABC.NET/bitwise-operations.pas new file mode 100644 index 0000000000..b1805c5213 --- /dev/null +++ b/Task/Bitwise-operations/PascalABC.NET/bitwise-operations.pas @@ -0,0 +1,9 @@ +begin + var (a,b) := ReadInteger2; + Println($'not {a} = {not a}'); + Println($'{a} and {b} = {a and b}'); + Println($'{a} or {b} = {a or b}'); + Println($'{a} xor {b} = {a xor b}'); + Println($'{a} shl {b} = {a shl b}'); + Println($'{a} shr {b} = {a shr b}'); +end. diff --git a/Task/Bitwise-operations/Pluto/bitwise-operations.pluto b/Task/Bitwise-operations/Pluto/bitwise-operations.pluto new file mode 100644 index 0000000000..a42f1b211c --- /dev/null +++ b/Task/Bitwise-operations/Pluto/bitwise-operations.pluto @@ -0,0 +1,20 @@ +-- Rotate left and right are not built-in but we use the +-- same 32-bit substitutes as in the Lua 5.3+ example. +local function rl(x, y) return ((x << y) & 0xffffffff) | (x >> (32 - y)) end + +local function rr(x, y) return (x >> y) | ((x << (32 - y)) & 0xffffffff) end + +local function bitwise(x, y) + print($" x = {x}") + print($" y = {y}") + print($" x & y = {x & y}") + print($" x | y = {x | y}") + print($" x ~ y = {x ~ y}") + print($"~x = {~x}") + print($" x << y = {x << y}") + print($" x >> y = {x >> y}") + print($" x rl y = {rl(x, y)}") + print($" x rr y = {rr(x, y)}") +end + +bitwise(10, 2) diff --git a/Task/Bitwise-operations/PowerShell/bitwise-operations-1.psh b/Task/Bitwise-operations/PowerShell/bitwise-operations-1.ps1 similarity index 100% rename from Task/Bitwise-operations/PowerShell/bitwise-operations-1.psh rename to Task/Bitwise-operations/PowerShell/bitwise-operations-1.ps1 diff --git a/Task/Bitwise-operations/PowerShell/bitwise-operations-2.psh b/Task/Bitwise-operations/PowerShell/bitwise-operations-2.ps1 similarity index 100% rename from Task/Bitwise-operations/PowerShell/bitwise-operations-2.psh rename to Task/Bitwise-operations/PowerShell/bitwise-operations-2.ps1 diff --git a/Task/Bitwise-operations/RISC-V-Assembly/bitwise-operations.asm b/Task/Bitwise-operations/RISC-V-Assembly/bitwise-operations.asm new file mode 100644 index 0000000000..a3766dfca1 --- /dev/null +++ b/Task/Bitwise-operations/RISC-V-Assembly/bitwise-operations.asm @@ -0,0 +1,295 @@ + # riscv assembly raspberry pico2 rp2350 +# program bitwise.s +# connexion putty com3 +/*********************************************/ +/* CONSTANTES */ +/********************************************/ +/* for this file see risc-v task include a file */ +.include "../../constantesRiscv.inc" + +/*******************************************/ +/* INITIALED DATAS */ +/*******************************************/ +.data +szMessStart: .asciz "Program riscv start.\r\n" +szCariageReturn: .asciz "\r\n" +szMessReg0: .asciz "Register s0:\r\n" +szMessReg1: .asciz "Register s1:\r\n" +szMessAnd: .asciz "And result:\r\n" +szMessOr: .asciz "Or result :\r\n" +szMessXor: .asciz "Xor result :\r\n" +szMessNot: .asciz "Not result :\r\n" +szMessNeg: .asciz "Neg result :\r\n" +szMessBset: .asciz "Set single bit result :\r\n" +szMessSll: .asciz "Shift left result :\r\n" +szMessSrl: .asciz "Shift right result :\r\n" +szMessSra: .asciz "Shift right arithmetic result :\r\n" +szMessRol: .asciz "Rotation left result :\r\n" +szMessRor: .asciz "Rotation right result :\r\n" +szMessBclr: .asciz "Clear single bit result :\r\n" +szMessBext: .asciz "Extraction single bit result :\r\n" +szMessBinv: .asciz "Inversion single bit result :\r\n" +szMessBrev: .asciz "Bit-reverse within each byte result :\r\n" +szMessClz: .asciz "Count leading zeroes result :\r\n" +szMessCtz: .asciz "Count trailing zeroes result :\r\n" +szMessCpop: .asciz "Population count result :\r\n" +szMessPack: .asciz "Pack two halfwords into one word result :\r\n" +szMessPackh: .asciz "Pack two byte into one halfword result :\r\n" +szMessZip: .asciz "Zip result :\r\n" +szMessUnzip: .asciz "Unzip result :\r\n" +.align 2 + +/*******************************************/ +/* UNINITIALED DATA */ +/*******************************************/ +.bss +.align 2 +sConvArea: .skip 24 +sConvBinaire: .skip 36 +/**********************************************/ +/* SECTION CODE */ +/**********************************************/ +.text +.global main + +main: + call stdio_init_all # général init +1: # start loop connexion + li a0,0 # raz argument register + call tud_cdc_n_connected # waiting for USB connection + beqz a0,1b # return code = zero ? + + la a0,szMessStart # message address + call writeString # display message + + la a0,szMessReg0 # message address + call writeString # display message + li s0,0b1100 + mv a0,s0 + call displayResult + + la a0,szMessReg1 # message address + call writeString # display message + li s1,0b1001 + mv a0,s1 + call displayResult + + la a0,szMessAnd # and + call writeString # display message + andi a0,s0,0b1001 # and immediat value + call displayResult + and a0,s0,s1 # register and + call displayResult + andn a0,s0,s1 # register and and not + call displayResult + + la a0,szMessOr # or + call writeString # display message + ori a0,s0,0b1001 # or immediat value + call displayResult + or a0,s0,s1 # or register + call displayResult + orn a0,s0,s1 # or and not register + call displayResult + orc.b a0,s0 # OR-combine of bits within each byte. Generates a mask of nonzero bytes + call displayResult + + + la a0,szMessXor # xor + call writeString # display message + xori a0,s0,0b1001 # xor immediat value + call displayResult + xor a0,s0,s1 # xor register + call displayResult + xnor a0,s0,s1 # Bitwise XOR with inverted operand. Equivalently, bitwise NOT of bitwise XOR + call displayResult + + la a0,szMessNot # not + call writeString # display message + not a0,s0 # not + call displayResult + + la a0,szMessNeg # negation + call writeString # display message + neg a0,s0 # negation + call displayResult + + la a0,szMessSll # shift left + call writeString # display message + slli a0,s0,11 # shift left immediat value + call displayResult + li t0,5 + sll a0,s0,t0 # shift left register + call displayResult + + la a0,szMessSrl # shift right + call writeString # display message + srli a0,s0,1 # shift right immediat value + call displayResult + li t0,5 + srl a0,s0,t0 # shift right register + call displayResult + + la a0,szMessSra # Shift right, arithmetic + call writeString # display message + srai a0,s0,1 # shift right arithmetic immediat value + call displayResult + li t0,5 + li t1,0b10000000000000001100000000000000 + sra a0,t1,t0 # shift right arithmetic register + call displayResult + + la a0,szMessRol # rotation left + call writeString # display message + li t0,5 + rol a0,s0,t0 # rotation left register + call displayResult + + la a0,szMessRor # rotation right + call writeString # display message + rori a0,s0,10 # rotation right immediat value + call displayResult + li t0,5 + ror a0,s0,t0 # rotation right register + call displayResult + + la a0,szMessBclr # Clear single bit. + call writeString # display message + bclri a0,s0,3 # Clear single bit. immediat value + call displayResult + li t0,2 + bclr a0,s0,t0 # Clear single bit. register + call displayResult + + la a0,szMessBext # Extraction single bit. + call writeString # display message + bexti a0,s0,3 # Extraction single bit. immediat value + call displayResult + li t0,2 + bext a0,s0,t0 # Extraction single bit. register + call displayResult + + la a0,szMessBinv # Inversion single bit. + call writeString # display message + binvi a0,s0,3 # Inversion bit. immediat value + call displayResult + li t0,2 + binv a0,s0,t0 # Inversion single bit. register + call displayResult + + la a0,szMessBset # Set single bit + call writeString # display message + bseti a0,s0,8 # Set single bit (immediate). + call displayResult + li t0,17 + bset a0,s0,t0 # Set single bit + call displayResult + + la a0,szMessClz # Count leading zeroes (starting from MSB, searching LSB-ward). + call writeString # display message + clz a0,s0 # + call displayResultD + + la a0,szMessCtz # Count trailing zeroes (starting from LSB, searching MSB-ward). + call writeString # display message + ctz a0,s0 # + call displayResultD + + la a0,szMessCpop # Population count + call writeString # display message + cpop a0,s0 # + call displayResultD + + la a0,szMessBrev # Bit-reverse within each byte + call writeString # display message + brev8 a0,s0 # + call displayResult + + la a0,szMessPack # Pack two halfwords into one word + call writeString # display message + li t0,0x1234 + li t1,0x5678 + pack a0,t1,t0 # + call displayResultHex + + la a0,szMessPackh # Pack two halfwords into one word + call writeString # display message + li t0,0x12 + li t1,0x34 + packh a0,t1,t0 # + call displayResultHex + + la a0,szMessZip # Interleave upper/lower half of register into odd/even bits of result + call writeString # display message + zip s2,s0 + mv a0,s2 # + call displayResult + + la a0,szMessUnzip # Deinterleave odd/even bits of register into upper/lower half of result + call writeString # display message + unzip a0,s2 # + call displayResult + call getchar +100: # final loop + j 100b + +/**********************************************/ +/* display binary Result */ +/**********************************************/ +/* a0 value */ +.equ LGZONECONV, 20 +displayResult: + addi sp, sp, -4 # reserve stack + sw ra, 0(sp) + la a1,sConvBinaire # conversion result address + call conversion2 # binary conversion + la a0,sConvBinaire # message address + call writeString # display message + la a0,szCariageReturn + call writeString +100: + lw ra, 0(sp) + addi sp, sp, 4 + ret +/**********************************************/ +/* display Result décimal */ +/**********************************************/ +/* a0 value */ +.equ LGZONECONV, 20 +displayResultD: + addi sp, sp, -4 # reserve stack + sw ra, 0(sp) + la a1,sConvArea # conversion result address + call conversion10 # binary conversion + la a0,sConvArea # message address + call writeString # display message + la a0,szCariageReturn + call writeString +100: + lw ra, 0(sp) + addi sp, sp, 4 + ret +/**********************************************/ +/* display hexadecimal result */ +/**********************************************/ +/* a0 value */ +.equ LGZONECONV, 20 +displayResultHex: + addi sp, sp, -4 # reserve stack + sw ra, 0(sp) + la a1,sConvArea # conversion result address + call conversion16 # conversion decimal + la a0,sConvArea # message address + call writeString # display message + la a0,szCariageReturn + call writeString +100: + lw ra, 0(sp) + addi sp, sp, 4 + ret + +/************************************/ +/* file include Fonctions */ +/***********************************/ +/* for this file see risc-v task include a file */ +.include "../../includeFunctions.s" diff --git a/Task/Bitwise-operations/Raku/bitwise-operations.raku b/Task/Bitwise-operations/Raku/bitwise-operations.raku index a7596faadb..7cbeacac55 100644 --- a/Task/Bitwise-operations/Raku/bitwise-operations.raku +++ b/Task/Bitwise-operations/Raku/bitwise-operations.raku @@ -9,7 +9,8 @@ sub int-bits (Int $a, Int $b) { say ''; say_bit "$a", $a; say ''; - say_bit "2's complement $a", +^$a; + say_bit "1's complement (not) $a", +^$a; + say_bit "2's complement $a", +^$a + 1; say_bit "$a and $b", $a +& $b; say_bit "$a or $b", $a +| $b; say_bit "$a xor $b", $a +^ $b; diff --git a/Task/Bitwise-operations/Rebol/bitwise-operations.rebol b/Task/Bitwise-operations/Rebol/bitwise-operations.rebol new file mode 100644 index 0000000000..13a05d8bd0 --- /dev/null +++ b/Task/Bitwise-operations/Rebol/bitwise-operations.rebol @@ -0,0 +1,32 @@ +Rebol [ + title: "Rosetta code: Bitwise operations" + file: %Bitwise_operations.r3 + url: https://rosettacode.org/wiki/Bitwise_operations + needs: 3.10.0 +] + +do-test: function [code][ + res: try code + case [ + error? res [res: join "error: " res/id] + integer? res [res: enbase to-binary res 2] + ] + printf [-21 " == "] reduce [form code res] +] +foreach test [ + [10] + [2] + [10 AND 2] + [10 & 2] + [10 OR 2] + [10 | 2] + [10 XOR 2] + [10 >> 2] + [10 << 2] + [-65432] + [complement -65432] + [255] + [shift 255 -2] + [shift 255 56] + [shift/logical 255 56] +][ do-test test ] diff --git a/Task/Bitwise-operations/Rust/bitwise-operations.rust b/Task/Bitwise-operations/Rust/bitwise-operations.rs similarity index 100% rename from Task/Bitwise-operations/Rust/bitwise-operations.rust rename to Task/Bitwise-operations/Rust/bitwise-operations.rs diff --git a/Task/Bitwise-operations/S-BASIC/bitwise-operations.basic b/Task/Bitwise-operations/S-BASIC/bitwise-operations.basic new file mode 100644 index 0000000000..7fc07c1d66 --- /dev/null +++ b/Task/Bitwise-operations/S-BASIC/bitwise-operations.basic @@ -0,0 +1,11 @@ +var a, b = integer +a = 10 +b = 2 +print "a ="; a; tab(16); hex$(a) +print "b ="; b; tab(16); hex$(b) +print "a and b ="; a and b; tab(16); hex$(a and b) +print "a or b ="; a or b; tab(16); hex$(a or b) +print "a xor b ="; a xor b; tab(16); hex$(a xor b) +print "not a ="; not a; tab(16); hex$(not a) + +end diff --git a/Task/Bitwise-operations/Scheme/bitwise-operations-1.ss b/Task/Bitwise-operations/Scheme/bitwise-operations-1.scm similarity index 100% rename from Task/Bitwise-operations/Scheme/bitwise-operations-1.ss rename to Task/Bitwise-operations/Scheme/bitwise-operations-1.scm diff --git a/Task/Bitwise-operations/Scheme/bitwise-operations-2.ss b/Task/Bitwise-operations/Scheme/bitwise-operations-2.scm similarity index 100% rename from Task/Bitwise-operations/Scheme/bitwise-operations-2.ss rename to Task/Bitwise-operations/Scheme/bitwise-operations-2.scm diff --git a/Task/Bitwise-operations/Uiua/bitwise-operations.uiua b/Task/Bitwise-operations/Uiua/bitwise-operations.uiua new file mode 100644 index 0000000000..3b42c9fbd9 --- /dev/null +++ b/Task/Bitwise-operations/Uiua/bitwise-operations.uiua @@ -0,0 +1,9 @@ +a ← 10 +b ← 2 +# Experimental! +¬a # bitwise NOT +°⋯ /× ⋯ ⊟ a b # bitwise AND +°⋯ /∨ ⋯ ⊟ a b # bitwise OR +°⋯ /≠ ⋯ ⊟ a b # bitwise XOR +* a ⁿ:2 b # SHL +⌊÷: a ⁿ:2 b # ASR diff --git a/Task/Bitwise-operations/Uxntal/bitwise-operations.uxnatl b/Task/Bitwise-operations/Uxntal/bitwise-operations.uxnatl new file mode 100644 index 0000000000..695abf3123 --- /dev/null +++ b/Task/Bitwise-operations/Uxntal/bitwise-operations.uxnatl @@ -0,0 +1,73 @@ +%\n { 0a } %\s { 20 } %\0 { 00 } +%newline { [ LIT2 \n -Console/write ] DEO } + +%not { #ff EOR } +%and { AND } +%or { ORA } +%xor { EOR } +%shl { #40 SFT SFT } +%shr { SFT } +%rol { #40 SFT #00 ROT ROT SFT2 ORA } +%ror { SWP #00 ROT SFT2 ORA } + +|18 @Console/write + +|100 + +#0a02 +DUP2 SWP ;msgs/a print/arg ;msgs/b print/arg +bitwise + +BRK + +@bitwise ( a b -- ) + ;msgs/not print/str ;msgs/a print/str + ;msgs/equ print/str OVR not print/result + ;msgs/and print/label DUP2 and print/result + ;msgs/or print/label DUP2 or print/result + ;msgs/xor print/label DUP2 xor print/result + ;msgs/shl print/label DUP2 shl print/result + ;msgs/shr print/label DUP2 shr print/result + ;msgs/rol print/label DUP2 rol print/result + ;msgs/ror print/label ror !print/result + +@print/label ( label* -- ) + ;msgs/a /str + /str + ;msgs/b /str + ;msgs/equ !/str + +@print/byte ( byte -- ) + [ LIT "$ ] .Console/write DEO + DUP #04 SFT /nibble + ( >> ) + +@print/nibble ( -- ) + #0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD .Console/write DEO + JMP2r + +@print/arg ( a name* -- ) + /str ;msgs/equ /str + ( >> ) + +@print/result ( a -- ) + /byte newline + JMP2r + +@print/str ( str* -- ) + LDAk .Console/write DEO + INC2 LDAk ?/str + POP2 JMP2r + +@msgs [ + &a "a \s \0 + &b "b \s \0 + &equ "= \s \0 + ¬ "NOT \s \0 + &and "AND \s \0 + &or "OR \s \0 + &xor "XOR \s \0 + &shl "SHL \s \0 + &shr "SHR \s \0 + &rol "ROL \s \0 + &ror "ROR \s \0 ] diff --git a/Task/Bitwise-operations/V-(Vlang)/bitwise-operations.v b/Task/Bitwise-operations/V-(Vlang)/bitwise-operations.v new file mode 100644 index 0000000000..9f8b2187cb --- /dev/null +++ b/Task/Bitwise-operations/V-(Vlang)/bitwise-operations.v @@ -0,0 +1,9 @@ +fn bitwise(a int, b int) { + println("a AND b: ${a & b}") + println("a OR b: ${a | b}") + println("a XOR b: ${a ^ b}") + println("NOT a: ${~a}") + println("a SHL b: ${a << b}") // left shift + println("a SHR b: ${a >> b}") // right shift + println("a USHR b: ${a >>> b}") // unsigned right shift +} diff --git a/Task/Blum-integer/AWK/blum-integer.awk b/Task/Blum-integer/AWK/blum-integer.awk new file mode 100644 index 0000000000..a50028c636 --- /dev/null +++ b/Task/Blum-integer/AWK/blum-integer.awk @@ -0,0 +1,53 @@ +# syntax: GAWK -f BLUM_INTEGER.AWK +# converted from FutureBasic +# +# sorting: +# PROCINFO["sorted_in"] is used by GAWK +# SORTTYPE is used by Thompson Automation's TAWK +# +BEGIN { + n = 3 + prime2 = 0 + print("The first 50 Blum integers:") + while (1) { + if (is_semiprime(n)) { + if (prime1 % 4 == 3) { + prime2 = n / prime1 + if ((prime2 != prime1) && (prime2 % 4 == 3)) { + arr[substr(n,length(n),1)]++ + total++ + if (++count <= 50) { + printf("%4d%s",n,count%10?"":"\n") + } + if (count ~ /^(26828|[1-4]00000)$/) { + printf("\nThe %6dth Blum integer: %7d",count,n) + if (count >= 400000) { + break + } + } + } + } + } + n += 2 + } + PROCINFO["sorted_in"] = "@ind_num_asc" ; SORTTYPE = 1 + printf("\n\nFor Blum integers up to %d:\n",count) + for (i in arr) { + printf("%7.3f%% end in %d\n",arr[i]/total*100,i) + } + exit(0) +} +function is_semiprime(n, c,d) { + c = 0 + d = 3 + while (d * d <= n) { + while (n % d == 0) { + if (c == 2) { return(0) } + n /= d + c++ + } + d += 2 + } + prime1 = n + return(c == 1) +} diff --git a/Task/Blum-integer/Ada/blum-integer.adb b/Task/Blum-integer/Ada/blum-integer.adb new file mode 100644 index 0000000000..5c8e2c59ca --- /dev/null +++ b/Task/Blum-integer/Ada/blum-integer.adb @@ -0,0 +1,89 @@ +with Ada.Text_IO; use Ada.Text_IO; +with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; +with Ada.Float_Text_IO; use Ada.Float_Text_IO; + +procedure Blum is + + Inc : Constant array (1 .. 8) of Integer := (4, 2, 4, 2, 4, 6, 2, 6); + + function Is_Prime (N : Integer) return Boolean is + D : Integer := 5; + begin + if N < 2 then return False; end if; + if N mod 2 = 0 then return N = 2; end if; + if N mod 3 = 0 then return N = 3; end if; + + while D * D <= N loop + if N mod D = 0 then return False; end if; + D := D + 2; + if N mod D = 0 then return False; end if; + D := D + 4; + end loop; + + return True; + end Is_Prime; + + function First_Prime_Factor (N : Integer) return Integer is + D : Integer := 7; + I : Integer := 1; + begin + if N = 1 then return 1; end if; + if N mod 3 = 0 then return 3; end if; + if N mod 5 = 0 then return 5; end if; + + while D * D <= N loop + if N mod D = 0 then + return D; + end if; + D := D + Inc(I); + I := (I mod 8) + 1; + end loop; + + return N; + end First_Prime_Factor; + + I, Blum_Count : Integer := 1; + J, P, Q : Integer; + Blums : Array (1 .. 50) of Integer; + Counts : Array (1 .. 4) of Integer := (others => 0); + Final_Digits : Array (1 .. 4) of Integer := (1, 3, 7, 9); + +begin + loop + P := First_Prime_Factor(I); + if P mod 4 = 3 then + Q := I / P; + if Q /= P and Q mod 4 = 3 and Is_Prime(Q) then + if Blum_Count < 51 then Blums(Blum_Count) := I; end if; + Counts(((I mod 10) / 3) + 1) := Counts(((I mod 10) / 3) + 1) + 1; + Blum_Count := Blum_Count + 1; + if Blum_Count = 51 then + Put("First 50 Blum Integers:"); New_Line; + for J in Integer range 1 .. 50 loop + Put(Item => Blums(J), Width => 3); Put(" "); + if J mod 10 = 0 then New_Line; end if; + end loop; + New_Line; + elsif Blum_Count = 26829 or Blum_Count mod 100000 = 1 then + Put("The "); Put(Item => Blum_Count, Width => 7); + Put("th Blum Integer is: "); Put(Item => I, Width => 9); + New_Line; + if Blum_Count = 400001 then + New_Line; Put("% Distribution of the First 400,000 Blum Integers:"); New_Line; + for J in Integer range 1 .. 4 loop + Put(" "); Put(Item => Float(Counts(J)) / 4000.0, Fore => 2, Aft => 3, Exp => 0); + Put("% end in "); Put(Item => Final_Digits(J), Width => 1); + New_Line; + end loop; + exit; + end if; + end if; + end if; + end if; + if I mod 5 = 3 then + I := I + 4; + else + I := I + 2; + end if; + end loop; +end Blum; diff --git a/Task/Blum-integer/Arturo/blum-integer.arturo b/Task/Blum-integer/Arturo/blum-integer.arturo new file mode 100644 index 0000000000..2ca6df51a1 --- /dev/null +++ b/Task/Blum-integer/Arturo/blum-integer.arturo @@ -0,0 +1,17 @@ +blum?: function [n][ + if any? @[n < 21, even? n, zero? n % 5] + -> return false + + f: factors.prime n + if or? [2 <> size f][f\0 = f\1] + -> return false + + every? f => [3 = & % 4] +] + +print "First 50 Blum numbers:" +1..∞ | select.first: 50 => blum? + | split.every: 10 + | loop => [print map & 'x -> pad to :string x 4] + +print ["\n26828th Blum number:" select.n:26828 1..∞ => blum?] diff --git a/Task/Blum-integer/BASIC256/blum-integer.basic b/Task/Blum-integer/BASIC256/blum-integer.basic new file mode 100644 index 0000000000..09ef9bc466 --- /dev/null +++ b/Task/Blum-integer/BASIC256/blum-integer.basic @@ -0,0 +1,40 @@ +global Prime1 +n = 3 +c = 0 + +print "The first 50 Blum integers:" +while True + if isSemiprime(n) then + if Prime1 % 4 = 3 then + Prime2 = n / Prime1 + if (Prime2 <> Prime1) and (Prime2 % 4 = 3) then + c += 1 + if c <= 50 then + print rjust(string(n), 4); + if c % 10 = 0 then print + end if + if c >= 26828 then + print : print "The 26828th Blum integer is: "; n + exit while + end if + end if + end if + end if + n += 2 +end while +end + +function isSemiprime(n) + d = 3 + c = 0 + while d*d <= n + while n % d = 0 + if c = 2 then return false + n /= d + c += 1 + end while + d += 2 + end while + Prime1 = n + return c = 1 +end function diff --git a/Task/Blum-integer/C++/blum-integer.cpp b/Task/Blum-integer/C++/blum-integer.cpp index 6e85a93099..ffa52d38cd 100644 --- a/Task/Blum-integer/C++/blum-integer.cpp +++ b/Task/Blum-integer/C++/blum-integer.cpp @@ -4,24 +4,24 @@ #include #include -bool is_prime_type_3(const int32_t number) { +bool is_prime_type_3(const uint32_t& number) { if ( number < 2 ) return false; if ( number % 2 == 0 ) return false; if ( number % 3 == 0 ) return number == 3; - for ( int divisor = 5; divisor * divisor <= number; divisor += 2 ) { + for ( uint32_t divisor = 5; divisor * divisor <= number; divisor += 2 ) { if ( number % divisor == 0 ) { return false; } } return number % 4 == 3; } -int32_t least_prime_factor(const int32_t number) { +uint32_t least_prime_factor(const uint32_t& number) { if ( number == 1 ) { return 1; } if ( number % 3 == 0 ) { return 3; } if ( number % 5 == 0 ) { return 5; } - for ( int divisor = 7; divisor * divisor <= number; divisor += 2 ) { + for ( uint32_t divisor = 7; divisor * divisor <= number; divisor += 2 ) { if ( number % divisor == 0 ) { return divisor; } } @@ -29,15 +29,15 @@ int32_t least_prime_factor(const int32_t number) { } int main() { - int32_t blums[50]; - int32_t blum_count = 0; - int32_t last_digit_counts[10] = {}; - int32_t number = 1; + uint32_t blums[50]; + uint32_t blum_count = 0; + uint32_t last_digit_counts[10] = {}; + uint32_t number = 1; while ( blum_count < 400'000 ) { - const int32_t prime = least_prime_factor(number); + const uint32_t prime = least_prime_factor(number); if ( prime % 4 == 3 ) { - const int32_t quotient = number / prime; + const uint32_t quotient = number / prime; if ( quotient != prime && is_prime_type_3(quotient) ) { if ( blum_count < 50 ) { blums[blum_count] = number; @@ -46,7 +46,7 @@ int main() { blum_count += 1; if ( blum_count == 50 ) { std::cout << "The first 50 Blum integers:" << std::endl; - for ( int32_t i = 0; i < 50; ++i ) { + for ( uint32_t i = 0; i < 50; ++i ) { std::cout << std::setw(3) << blums[i] << ( ( i % 10 == 9 ) ? "\n" : " " ); } std::cout << std::endl; @@ -54,7 +54,8 @@ int main() { std::cout << "The " << std::setw(6) << blum_count << "th Blum integer is: " << std::setw(7) << number << std::endl; if ( blum_count == 400'000 ) { - std::cout << "\nPercent distribution of the first 400000 Blum integers:" << std::endl; + std::cout << "\n" << "Percent distribution of the first 400000 Blum integers:" + << std::endl; for ( const int32_t& i : { 1, 3, 7, 9 } ) { std::cout << " " << std::setw(6) << std::setprecision(5) << (double) last_digit_counts[i] / 4'000 << "% end in " << i << std::endl; diff --git a/Task/Blum-integer/C-sharp/blum-integer.cs b/Task/Blum-integer/C-sharp/blum-integer.cs new file mode 100644 index 0000000000..a242084856 --- /dev/null +++ b/Task/Blum-integer/C-sharp/blum-integer.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; + +public class BlumInteger +{ + public static void Main(string[] args) + { + int[] blums = new int[50]; + int blumCount = 0; + Dictionary lastDigitCounts = new Dictionary(); + int number = 1; + + while (blumCount < 400000) + { + int prime = LeastPrimeFactor(number); + if (prime % 4 == 3) + { + int quotient = number / prime; + if (quotient != prime && IsPrimeType3(quotient)) + { + if (blumCount < 50) + { + blums[blumCount] = number; + } + + if (!lastDigitCounts.ContainsKey(number % 10)) + { + lastDigitCounts[number % 10] = 0; + } + lastDigitCounts[number % 10]++; + + blumCount++; + if (blumCount == 50) + { + Console.WriteLine("The first 50 Blum integers:"); + for (int i = 0; i < 50; i++) + { + Console.Write($"{blums[i],3}"); + Console.Write((i % 10 == 9) ? Environment.NewLine : " "); + } + Console.WriteLine(); + } + else if (blumCount == 26828 || blumCount % 100000 == 0) + { + Console.WriteLine($"The {blumCount}th Blum integer is: {number}"); + if (blumCount == 400000) + { + Console.WriteLine(); + Console.WriteLine("Percent distribution of the first 400000 Blum integers:"); + foreach (var key in lastDigitCounts.Keys) + { + Console.WriteLine($" {((double)lastDigitCounts[key] / 4000):0.000}% end in {key}"); + } + } + } + } + } + number += (number % 5 == 3) ? 4 : 2; + } + } + + private static bool IsPrimeType3(int number) + { + if (number < 2) return false; + if (number % 2 == 0) return number == 2; + if (number % 3 == 0) return number == 3; + + for (int divisor = 5; divisor * divisor <= number; divisor += 2) + { + if (number % divisor == 0) return false; + } + return number % 4 == 3; + } + + private static int LeastPrimeFactor(int number) + { + if (number == 1) return 1; + if (number % 2 == 0) return 2; + if (number % 3 == 0) return 3; + if (number % 5 == 0) return 5; + + for (int divisor = 7; divisor * divisor <= number; divisor += 2) + { + if (number % divisor == 0) return divisor; + } + return number; + } +} diff --git a/Task/Blum-integer/Common-Lisp/blum-integer.lisp b/Task/Blum-integer/Common-Lisp/blum-integer.lisp new file mode 100644 index 0000000000..6f3c559ebb --- /dev/null +++ b/Task/Blum-integer/Common-Lisp/blum-integer.lisp @@ -0,0 +1,47 @@ +(defun is-factor (x y) + (zerop (mod x y))) + +(defun is-congruent (num a n) + (= (mod num n) a)) + +(defun is-prime (n) + (cond ((< n 4) (or (= n 2) (= n 3))) + ((or (zerop (mod n 2)) (zerop (mod n 3))) nil) + (t (loop for i from 5 to (floor (sqrt n)) by 6 + never (or (is-factor n i) + (is-factor n (+ i 2))))))) + +(defun first-factor (n) + (loop for i from 2 to (floor (sqrt n)) + thereis (if (is-factor n i) i nil))) + +(defun is-blum (n) + (let ((factor (first-factor n))) + (and factor + (is-congruent factor 3 4) + (/= factor (/ n factor)) + (is-congruent (/ n factor) 3 4) + (is-prime factor) + (is-prime (/ n factor))))) + +(defun main () + (let ((n 0) + (i 1) + (blums '()) + (counts '())) + (dotimes (i 10) (push (cons i 0) counts)) + (loop while (<= n 400000) + do (setf i (+ i 2)) + (when (is-blum i) + (incf n) + (incf (cdr (assoc (mod i 10) counts))) + (when (<= n 50) + (push i blums) + (when (= n 50) + (format t "First 50 Blum integers:~%") + (format t "~{~5d~5d~5d~5d~5d~5d~5d~5d~5d~5d~%~}~%" (reverse blums)))) + (if (find n '(26828 100000 200000 300000 400000)) + (format t "The ~7:dth Blum integer is: ~9:d~%" n i)))) + (format t "~%% distribution of the first 400,000 Blum integers:~%") + (dolist (x '(1 3 7 9)) + (format t "~3$% end in ~a~%" (/ (cdr (assoc x counts)) 4000) x)))) diff --git a/Task/Blum-integer/EasyLang/blum-integer.easy b/Task/Blum-integer/EasyLang/blum-integer.easy index 7b73286f92..603f83fb51 100644 --- a/Task/Blum-integer/EasyLang/blum-integer.easy +++ b/Task/Blum-integer/EasyLang/blum-integer.easy @@ -2,32 +2,27 @@ fastfunc semiprim n . d = 3 while d * d <= n while n mod d = 0 - if c = 2 - return 0 - . + if c = 2 : return 0 n /= d c += 1 . d += 2 . - if c = 1 - return n - . + if c = 1 : return n + return 0 . print "The first 50 Blum integers:" n = 3 -numfmt 0 4 +numfmt 4 0 repeat prim1 = semiprim n - if prim1 <> 0 - if prim1 mod 4 = 3 - prim2 = n div prim1 - if prim2 <> prim1 and prim2 mod 4 = 3 - c += 1 - if c <= 50 - write n - if c mod 10 = 0 ; print "" ; . - . + if prim1 <> 0 and prim1 mod 4 = 3 + prim2 = n div prim1 + if prim2 <> prim1 and prim2 mod 4 = 3 + c += 1 + if c <= 50 + write n + if c mod 10 = 0 : print "" . . . diff --git a/Task/Blum-integer/Fortran/blum-integer.f b/Task/Blum-integer/Fortran/blum-integer.f new file mode 100644 index 0000000000..1108cc2fbe --- /dev/null +++ b/Task/Blum-integer/Fortran/blum-integer.f @@ -0,0 +1,158 @@ +program BlumInteger + use, intrinsic :: iso_fortran_env, only: int32, int64 + implicit none + + integer(int32), parameter :: LIMIT = 10*1000*1000 + integer(int32), allocatable :: BlumPrimes(:) + integer(int32), allocatable :: BlumPrimes2(:) + logical :: BlumField(0:LIMIT) + integer(int32) :: EndDigit(0:9) + integer(int64) :: k + integer(int32) :: n, idx, j, P4n3Cnt,xx,yy + call system_clock(count=xx) + call Sieve4n_3_Primes(LIMIT, BlumPrimes2) +! allocate(blumprimes(0:size(BlumPrimes2)-1)) +! The blumprimes2 array is allocated in the subroutine as a zero based array +! but, the main program doesn't know that and assumes it's 1 based so we allocate +! a zero based array then use move_alloc to correctly resize it a transfer the data + allocate(blumprimes(0:1)) + call move_alloc(blumprimes2,blumprimes) + P4n3Cnt = size(BlumPrimes) -1 + print *, 'There are ', CommaUint(int(P4n3Cnt, int64)), ' needed primes 4*n+3 to Limit ', CommaUint(int(LIMIT, int64)) + P4n3Cnt = P4n3Cnt - 1 + print * + + ! Generate Blum-Integers + BlumField = .false. + do idx = 0, P4n3Cnt + n = BlumPrimes(idx) + do j = idx+1, P4n3Cnt + k = int(n, int64) * int(BlumPrimes(j), int64) + if (k > LIMIT) exit + BlumField(k) = .true. + end do + end do + call system_clock(count=yy) + print *, 'First 50 Blum-Integers ' + idx = 0 + j = 0 + do + do while (idx < LIMIT .and. .not. BlumField(idx)) + idx = idx + 1 + end do + if (idx == LIMIT) exit + if (mod(j, 10) == 0 .and. j /= 0) print * + write(*, '(I5)', advance='no') idx + j = j + 1 + idx = idx + 1 + if (j >= 50) exit + end do + print '(//)' + + print *, ' relative occurence of digit' + print *, ' n.th |BlumInteger|Digit: 1 3 7 9' + idx = 0 + j = 0 + n = 0 + k = 26828 + EndDigit = 0 + do + do while (idx < LIMIT .and. .not. BlumField(idx)) + idx = idx + 1 + end do + if (idx == LIMIT) exit + ! Count last decimal digit + EndDigit(mod(idx, 10)) = EndDigit(mod(idx, 10)) + 1 + j = j + 1 + if (j == k) then + write(*, '(A10,A1,A11,A1)', advance='no') CommaUint(int(j, int64)), '|', CommaUint(int(idx, int64)), '|' + write(*, '(F7.3,A4)', advance='no') real(EndDigit(1))/j*100, '% |' + write(*, '(F7.3,A4)', advance='no') real(EndDigit(3))/j*100, '% |' + write(*, '(F7.3,A4)', advance='no') real(EndDigit(7))/j*100, '% |' + write(*, '(F7.3,A2)') real(EndDigit(9))/j*100, '%' + if (k < 100000) then + k = 100000 + else + k = k + 100000 + end if + end if + idx = idx + 1 + if (j >= 400000) exit + end do + print '(/,a,f8.6,1x,a)', 'Elapsed time = ',(yy-xx)/1000.0,'seconds' +contains + + subroutine Sieve4n_3_Primes(Limit, P4n3) + use iso_fortran_env + integer(int32), intent(in) :: Limit + integer(int32), allocatable, intent(out) :: P4n3(:) + integer(kind=1), allocatable :: sieve(:) + integer(int32) :: BlPrCnt, idx, n, j, sieve_size + + sieve_size = (Limit / 3 - 3) / 4 + 1 + allocate(sieve(0:sieve_size-1)) + allocate(P4n3(0:sieve_size-1)) + + sieve = 0 + BlPrCnt = 0 + idx = 0 + do + if (sieve(idx) == 0) then + n = idx*4 + 3 + P4n3(BlPrCnt) = n + BlPrCnt = BlPrCnt + 1 + j = idx + n + if (j > ubound(sieve, 1)) exit + do while (j <= ubound(sieve, 1)) + sieve(j) = 1 + j = j + n + end do + end if + idx = idx + 1 + if (idx > ubound(sieve, 1)) exit + end do + ! Collect the rest + do idx = idx, ubound(sieve, 1) + if (sieve(idx) == 0) then + P4n3(BlPrCnt) = idx*4 + 3 + BlPrCnt = BlPrCnt + 1 + end if + end do + P4n3 = P4n3(0:BlPrCnt-1) + end subroutine Sieve4n_3_Primes + + function CommaUint(n) result(res) + integer, parameter :: sizer = 30 + integer(int64), intent(in) :: n + character(:), allocatable :: res + character(len=sizer) :: temp + integer :: fromIdx, toIdx, i + character :: pRes(sizer) + + write(temp, '(I0)') n + fromIdx = len_trim(temp) + toIdx = fromIdx - 1 + if (toIdx < 3) then + res = temp(1:fromIdx) + return + end if + allocate(res, mold=repeat(' ',sizer)) + toIdx = 4*(toIdx / 3) + mod(toIdx, 3) + 1 + pRes = ' ' + + do i = 1, fromIdx + pRes(toIdx) = temp(fromIdx-i+1:fromIdx-i+1) + toIdx = toIdx - 1 + if (mod(i, 3) == 0 .and. i /= fromIdx) then + pRes(toIdx) = ',' + toIdx = toIdx - 1 + end if + end do + do i = 1,sizer ! Go from character array to string + res(I:I) = pRes(i) + end do +! + res = trim(adjustl(Res)) + end function CommaUint + +end program BlumInteger diff --git a/Task/Blum-integer/FreeBASIC/blum-integer.basic b/Task/Blum-integer/FreeBASIC/blum-integer.basic index 8b1bdd7df5..4f8b7da16f 100644 --- a/Task/Blum-integer/FreeBASIC/blum-integer.basic +++ b/Task/Blum-integer/FreeBASIC/blum-integer.basic @@ -1,39 +1,76 @@ -Dim Shared As Uinteger Prime1 -Dim As Uinteger n = 3, c = 0, Prime2 +#include "isprime.bas" -Function isSemiprime(n As Uinteger) As Boolean - Dim As Uinteger d = 3, c = 0 - While d*d <= n - While n Mod d = 0 - If c = 2 Then Return False - n /= d - c += 1 - Wend - d += 2 - Wend - Prime1 = n - Return c = 1 +Type PrimeHelper + inc(7) As Integer + idx As Integer +End Type + +Function initPrimeHelper() As PrimeHelper + Dim helper As PrimeHelper + helper.inc(0) = 4 : helper.inc(1) = 2 : helper.inc(2) = 4 + helper.inc(3) = 2 : helper.inc(4) = 4 : helper.inc(5) = 6 + helper.inc(6) = 2 : helper.inc(7) = 6 + helper.idx = 0 + Return helper End Function -Print "The first 50 Blum integers:" -Do - If isSemiprime(n) Then - If Prime1 Mod 4 = 3 Then - Prime2 = n / Prime1 - If (Prime2 <> Prime1) And (Prime2 Mod 4 = 3) Then - c += 1 - If c <= 50 Then - Print Using "####"; n; - If c Mod 10 = 0 Then Print - End If - If c >= 26828 Then - Print !"\nThe 26828th Blum integer is: " ; n - Exit Do +Function firstPrimeFactor(n As Integer) As Integer + If n = 1 Then Return 1 + If n Mod 3 = 0 Then Return 3 + If n Mod 5 = 0 Then Return 5 + + Dim helper As PrimeHelper = initPrimeHelper() + Dim k As Integer = 7 + + While k * k <= n + If n Mod k = 0 Then Return k + k += helper.inc(helper.idx) + helper.idx = (helper.idx + 1) Mod 8 + Wend + + Return n +End Function + +Sub main() + Dim As Integer blum(49), counts(9) + Dim As Integer bc = 0, i = 1, p, q + Dim As Integer j + + Dim As Double t0 = Timer + Do + p = firstPrimeFactor(i) + If p Mod 4 = 3 Then + q = i \ p + If q <> p Andalso q Mod 4 = 3 Andalso isPrime(q) Then + If bc < 50 Then blum(bc) = i + counts(i Mod 10) += 1 + bc += 1 + + If bc = 50 Then + Print "First 50 Blum integers:" + For j = 0 To 49 + Print Using "####"; blum(j); + If (j + 1) Mod 10 = 0 Then Print + Next + Print + Elseif bc = 26828 Orelse bc Mod 100000 = 0 Then + Print Using "The ###,###th Blum integer is: #,###,###"; bc; i + + If bc = 400000 Then + Print !"\n% distribution of the first 400,000 Blum integers:" + For j = 1 To 9 Step 2 + If j <> 5 Then Print Using " ##.###% end in #"; (counts(j)/4000); j + Next + Exit Do + End If End If End If End If - End If - n += 2 -Loop + i += Iif(i Mod 5 = 3, 4, 2) + Loop + Print Chr(10); Timer - t0; " sec." +End Sub + +main() Sleep diff --git a/Task/Blum-integer/Frink/blum-integer.frink b/Task/Blum-integer/Frink/blum-integer.frink new file mode 100644 index 0000000000..7f566d6cf6 --- /dev/null +++ b/Task/Blum-integer/Frink/blum-integer.frink @@ -0,0 +1,27 @@ +isBlum = {|x| + f = factorFlat[x] + if length[f] != 2 + return false + + f1 = first[f] + f2 = last[f] + return (f1 != f2) and (first[f] mod 4 == 3) and (last[f] mod 4 == 3) +} + +println["First 50:"] +println[first[select[count[1], isBlum], 50]] + +ret = new array +for n = [26828, 100000, 200000, 300000, 400000] + ret.push[["${n}th is: ", nth1[select[count[1], isBlum], n]]] + +println[formatTable[ret, "right"]] + +d = new dict +for n = first[select[count[1], isBlum], 400000] + d.increment[right[toString[n],1]] + +println["Distribution of the first 400000 Blum integers:"] +sum = sum[d.values[]] +for k = sort[d.keys[]] + println[formatFix[d@k / sum, "percent", 3] + " end in $k"] diff --git a/Task/Blum-integer/FutureBasic/blum-integer.basic b/Task/Blum-integer/FutureBasic/blum-integer.basic new file mode 100644 index 0000000000..86d825bda9 --- /dev/null +++ b/Task/Blum-integer/FutureBasic/blum-integer.basic @@ -0,0 +1,47 @@ +begin globals +UInt32 gPrime1 +end globals + +local fn IsSemiprime( n as UInt32 ) as BOOL + BOOL result = NO + UInt32 d = 3, c = 0 + while d * d <= n + while ( n % d = 0 ) + if ( c == 2 ) then return NO + n /= d + c += 1 + wend + d += 2 + wend + gPrime1 = n + result = ( c == 1 ) +end fn = result + +void local fn BlumIntegers + UInt32 prime2 = 0, n = 3, c = 0 + + print @"The first 50 Blum integers:" + while ( 1 ) + if ( fn IsSemiprime( n ) ) + if ( gPrime1 % 4 == 3 ) + prime2 = n / gPrime1 + if ( prime2 != gPrime1 ) && ( prime2 % 4 == 3 ) + c++ + if ( c <= 50 ) + printf @"%4d\b",n + if ( c % 10 == 0 ) then print + end if + if ( c >= 26828 ) + print : print @"The 26828th Blum integer is: "; n + break + end if + end if + end if + end if + n += 2 + wend +end fn + +fn BlumIntegers + +HandleEvents diff --git a/Task/Blum-integer/Gambas/blum-integer.gambas b/Task/Blum-integer/Gambas/blum-integer.gambas new file mode 100644 index 0000000000..ce94e9d661 --- /dev/null +++ b/Task/Blum-integer/Gambas/blum-integer.gambas @@ -0,0 +1,67 @@ +Use "isprime.bas" + +Private inc As Integer[] = [4, 2, 4, 2, 4, 6, 2, 6] + +Private Function FirstPrimeFactor(n As Long) As Long + + If n = 1 Then Return 1 + If n Mod 3 = 0 Then Return 3 + If n Mod 5 = 0 Then Return 5 + + Dim k As Long = 7 + Dim i As Integer = 0 + + While k * k <= n + If n Mod k = 0 Then Return k + k += inc[i] + i = (i + 1) Mod 8 + Wend + + Return n + +End + +Public Sub Main() + + Dim blum As New Long[50] + Dim counts As New Collection + + counts[1] = 0 + counts[3] = 0 + counts[7] = 0 + counts[9] = 0 + + Dim bc As Long = 0, i As Long = 1 + + While True + Dim p As Long = FirstPrimeFactor(i) + If p Mod 4 = 3 Then + Dim q As Long = i \ p + If q <> p And q Mod 4 = 3 And IsPrime(q) Then + If bc < 50 Then blum[bc] = i + counts[i Mod 10] += 1 + bc += 1 + + If bc = 50 Then + Print "First 50 Blum integers:" + For j As Integer = 0 To 49 + Print Format(blum[j], "####"); " "; + If (j + 1) Mod 10 = 0 Then Print + Next + Print + Else If bc = 26828 Or bc Mod 100000 = 0 Then + Print "The "; Format(bc, " ###,###"); "th Blum integer is: "; Format(i, " #,###,###") + If bc = 400000 Then + Print Chr(10); "% distribution of the first 400,000 Blum integers:" + For Each j As Integer In [1, 3, 7, 9] + Print Format(counts[j] / 4000, " ##.###"); "% end in "; j + Next + Return + Endif + Endif + Endif + Endif + i += If(i Mod 5 = 3, 4, 2) + Wend + +End diff --git a/Task/Blum-integer/Haskell/blum-integer.hs b/Task/Blum-integer/Haskell/blum-integer.hs new file mode 100644 index 0000000000..641108a516 --- /dev/null +++ b/Task/Blum-integer/Haskell/blum-integer.hs @@ -0,0 +1,114 @@ +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE DeriveFunctor #-} +{-# LANGUAGE ScopedTypeVariables #-} + +module Rosetta.BlumInteger + ( Stream (..) + , Stats (..) + , toList + , blumIntegers + , countLastDigits + ) where + +import GHC.Natural (Natural) +import Math.NumberTheory.Primes (Prime (..), nextPrime) + +-- | A stream is an infinite list. +data Stream a = a :> Stream a + deriving Functor + +-- | Converts a stream to the corresponding infinite list. +toList :: Stream a -> [a] +toList (x :> xs) = x : toList xs + +unsafeFromList :: [a] -> Stream a +unsafeFromList = foldr (:>) $ error "fromList: finite list" + +primes3mod4 :: Stream (Prime Natural) +primes3mod4 = unsafeFromList [nextPrime 3, nextPrime 7 ..] + +-- Assume: +-- * All numbers in all the streams are distinct. +-- * Each stream is sorted. +-- * In the stream of streams, the first element of each stream is less than the first element of the next stream. +sortStreams :: forall a. Ord a => Stream (Stream a) -> Stream a +sortStreams ((x :> xs) :> xss) = x :> sortStreams (insert xs xss) + where + insert :: Stream a -> Stream (Stream a) -> Stream (Stream a) + insert ys@(y :> _) zss@(zs@(z :> _) :> zss') + | y < z = ys :> zss + | otherwise = zs :> insert ys zss' + +-- | The +blumIntegers :: Stream Natural +blumIntegers = sortStreams $ go $ unPrime <$> primes3mod4 + where + go :: Stream Natural -> Stream (Stream Natural) + go (p :> ps) = ((p *) <$> ps) :> go ps + +data Stats a = Stats + { s1 :: !a + , s3 :: !a + , s7 :: !a + , s9 :: !a + } deriving (Show, Eq, Ord, Functor) + +lastDigit :: Natural -> Int +lastDigit n = fromIntegral $ n `mod` 10 + +updateCount :: Stats Int -> Natural -> Stats Int +updateCount !dc n = case lastDigit n of + 1 -> dc { s1 = s1 dc + 1 } + 3 -> dc { s3 = s3 dc + 1 } + 7 -> dc { s7 = s7 dc + 1 } + 9 -> dc { s9 = s9 dc + 1 } + _ -> error "updateCount: impossible" + +countLastDigits :: forall a. Fractional a => Int -> Stream Natural -> Stats a +countLastDigits n = fmap f . go Stats { s1 = 0, s3 = 0, s7 = 0, s9 = 0 } n + where + go :: Stats Int -> Int -> Stream Natural -> Stats Int + go !dc 0 _ = dc + go !dc m (x :> xs) = go (updateCount dc x) (m - 1) xs + + f :: Int -> a + f m = fromIntegral m / fromIntegral n + + +{-# LANGUAGE NumericUnderscores #-} +{-# LANGUAGE TypeApplications #-} + +module Main + ( main + ) where + +import Control.Monad (forM_) +import Text.Printf (printf) + +import Numeric.Natural (Natural) + +import Rosetta.BlumInteger + +main :: IO () +main = do + let xs = toList blumIntegers + + printf "The first 50 Blum integers are:\n\n" + forM_ (take 50 xs) $ \x -> do + printf "%3d\n" x + printf "\n" + + nth xs 26_828 + forM_ [100_000, 200_000 .. 400_000] $ nth xs + printf "\n" + + printf "Distribution by final digit for the first 400000 Blum integers:\n\n" + let Stats r1 r3 r7 r9 = countLastDigits @Double 400_000 blumIntegers + forM_ [(1 :: Int, r1), (3, r3), (7, r7), (9, r9)] $ \(d, r) -> + printf "%d: %6.3f%%\n" d $ r * 100 + printf "\n" + + where + + nth :: [Natural] -> Int -> IO () + nth xs n = printf "The %6dth Blum integer is %8d.\n" n $ xs !! (n - 1) diff --git a/Task/Blum-integer/Julia/blum-integer.julia b/Task/Blum-integer/Julia/blum-integer.jl similarity index 100% rename from Task/Blum-integer/Julia/blum-integer.julia rename to Task/Blum-integer/Julia/blum-integer.jl diff --git a/Task/Blum-integer/Mathematica/blum-integer.math b/Task/Blum-integer/Mathematica/blum-integer.math new file mode 100644 index 0000000000..45c6441282 --- /dev/null +++ b/Task/Blum-integer/Mathematica/blum-integer.math @@ -0,0 +1,70 @@ +ClearAll[BlumIntegerQ, BlumIntegersInRange, PrimePi2, BlumCount, binarySearch, BlumInts, timing, upperLimitEstimate, lastDigit, lastDigitDistributionPercents]; + +BlumIntegerQ[n_Integer] := With[{factors = FactorInteger[n]}, + n ~ Mod ~ 4 == 1 && + Length[factors] == 2 && + factors[[1, 1]] ~ Mod ~ 4 == 3 && + Last@Total@factors == 2 +]; +SetAttributes[BlumIntegerQ, Listable]; + +BlumIntegersInRange[n_Integer] := BlumIntegersInRange[1, n]; +BlumIntegersInRange[start_Integer, end_Integer] := + Select[Range[start + (4 - start) ~ Mod ~ 4, end, 4] + 1, BlumIntegerQ]; + +(* Counts semiprimes. See https://people.maths.ox.ac.uk/erban/papers/paperDCRE.pdf *) + +PrimePi2[x_] := (PrimePi[Sqrt[x]] - PrimePi[Sqrt[x]]^2)/2 + Sum[PrimePi[x/Prime[p]], {p, 1, PrimePi[Sqrt[x]]}]; +SetAttributes[PrimePi2, Listable]; + +(* Blum integers are semiprimes that are 1 mod 4, with two distinct factors where both factors are 3 mod 4. The following function gives an approximation of the number of Blum integers <= x. + +According to my tests, this function tends to overestimate by approximately 5% in the range we're interested in. +*) + +BlumCount[x_] := Ceiling[(PrimePi2[x] - PrimePi[Sqrt[x]]) / 4]; +SetAttributes[BlumCount, Listable]; + +binarySearch[f_, targetValue_] := + Module[{lo = 1, mid, hi = 1, currentValue}, + While[f[hi] < targetValue, + hi *= 2;]; + While[lo <= hi, + mid = Ceiling[(lo + hi) / 2]; + currentValue = f[mid]; + If[currentValue < targetValue, + lo = mid + 1;]; + If[currentValue > targetValue, + hi = mid - 1;]; + If[currentValue == targetValue, + While[f[mid] == targetValue, + mid++; + ]; + Return[mid - 1]; + ]; + ]; + ]; + +lastDigit[n_Integer] := n ~ Mod ~ 10; +SetAttributes[lastDigit, Listable]; + +upperLimitEstimate = Ceiling[binarySearch[BlumCount, 400000]* 1.1]; +timing = First@AbsoluteTiming[BlumInts = BlumIntegersInRange[upperLimitEstimate];]; +lastDigitDistributionPercents = N[Counts@lastDigit@BlumInts[[;; 400000]] / 4000, 5]; + +Print["Calculated the first ", Length[BlumInts], + " Blum integers in ", timing, " seconds."]; +Print[]; +Print["First 50 Blum integers:"]; +Print[TableForm[Partition[BlumInts[[;; 50]], 10], + TableAlignments -> Right]]; +Print[]; +Print[Grid[ + Table[{"The ", n , "th Blum integer is: ", + BlumInts[[n]]}, {n, {26828, 100000, 200000, 300000, 400000}}] , + Alignment -> Right]] +Print[]; +Print["% distribution of the first 400,000 Blum integers:"]; +Print[Grid[ + Table[{lastDigitDistributionPercents[n], "% end in ", + n}, {n, {1, 3, 7, 9}} ], Alignment -> Right]]; diff --git a/Task/Blum-integer/OxygenBasic/blum-integer.basic b/Task/Blum-integer/OxygenBasic/blum-integer.basic new file mode 100644 index 0000000000..50ba04d0a0 --- /dev/null +++ b/Task/Blum-integer/OxygenBasic/blum-integer.basic @@ -0,0 +1,78 @@ +#include "isprime.bas" +uses console + +dim inc(7) as integer +inc(0) = 4: inc(1) = 2: inc(2) = 4 +inc(3) = 2: inc(4) = 4: inc(5) = 6 +inc(6) = 2: inc(7) = 6 + +function firstPrimeFactor(n as long) as long + if n = 1 then return 1 + if n mod 3 = 0 then return 3 + if n mod 5 = 0 then return 5 + + long k = 7 + int idx = 0 + + while k * k <= n + if mod(n, k) = 0 then return k + k += inc(idx) + idx = mod((idx + 1), 8) + wend + return n +end function + +sub main() + dim as long blum(49), counts(9) + long bc = 0, i = 1, pct, p, q + int j + string s, t + + do + p = firstPrimeFactor(i) + if p mod 4 = 3 then + q = i \ p + if q <> p and q mod 4 = 3 and isPrime(q) then + if bc < 50 then blum(bc) = i + counts(i mod 10) = counts(i mod 10) + 1 + bc += 1 + + if bc = 50 then + printl "First 50 Blum integers:" + for j = 0 to 49 + s = str(blum(j)) + while len(s) < 4: s = " " + s: wend + print s; + if mod((j + 1), 10) = 0 then printl + next + printl + elseif bc = 26828 or bc mod 100000 = 0 then + s = str(bc) + while len(s) < 6: s = " " + s: wend + t = str(i) + while len(t) < 7: t = " " + t: wend + printl "The " + s + "th Blum integer is: " + t + if bc = 400000 then + printl cr "% distribution of the first 400,000 Blum integers:" + + for j = 1 to 9 step 2 + if j <> 5 then + pct = counts(j)/4000 + s = str(pct) + while len(s) < 5: s = " " + s: wend + printl s + "% end in " + str(j) + end if + next + end + end if + end if + end if + end if + if mod(i, 5) = 3 then i += 4 else i += 2 + end do +end sub + +main() + +printl cr "Enter ..." +waitkey diff --git a/Task/Blum-integer/Perl/blum-integer.pl b/Task/Blum-integer/Perl/blum-integer.pl index cd1f209fa2..cadee23b20 100644 --- a/Task/Blum-integer/Perl/blum-integer.pl +++ b/Task/Blum-integer/Perl/blum-integer.pl @@ -1,43 +1,23 @@ use v5.36; -use enum ; -use ntheory ; +use ntheory qw(is_square is_semiprime factor vecall); -sub comma { reverse ((reverse shift) =~ s/.{3}\K/,/gr) =~ s/^,//r } -sub table ($c, @V) { my $t = $c * (my $w = 5); ( sprintf( ('%'.$w.'d')x@V, @V) ) =~ s/.{1,$t}\K/\n/gr } +sub comma { reverse((reverse shift) =~ s/.{3}\K/,/gr) =~ s/^,//r } +sub table ($c, @V) { my $t = $c * (my $w = 5); (sprintf(('%' . $w . 'd') x @V, @V)) =~ s/.{1,$t}\K/\n/gr } sub is_blum ($n) { - return false if $n < 2 or is_prime $n; - my $factor = find_factor($n); - my $div = int($n / $factor); - return true if is_prime($factor) && is_prime($div) && ($div != $factor) && ($factor%4 == 3) && ($div%4 == 3); - false; + ($n % 4) == 1 && is_semiprime($n) && !is_square($n) && vecall { ($_ % 4) == 3 } factor($n); } -sub find_factor ($n, $constant = 1) { - my($x, $rho, $factor) = (2, 1, 1); - while ($factor == 1) { - $rho *= 2; - my $fixed = $x; - for (0..$rho) { - $x = ( $x * $x + $constant ) % $n; - $factor = gcd(($x-$fixed), $n); - last if 1 < $factor; - } - } - $factor = find_factor($n, $constant+1) if $n == $factor; - $factor; -} - -my($i, @blum, %C); my @nth = (26828, 1e5, 2e5, 3e5, 4e5); -while (++$i) { +my (@blum, %C); +for (my $i = 1 ; ; ++$i) { push @blum, $i if is_blum $i; - last if $nth[-1] == scalar @blum; + last if $nth[-1] == @blum; } -$C{substr $_, -1, 1}++ for @blum; +$C{$_ % 10}++ for @blum; -say "The first fifty Blum integers:\n" . table 10, @blum[0..49]; -printf "The %7sth Blum integer: %9s\n", comma($_), comma $blum[$_-1] for @nth; +say "The first fifty Blum integers:\n" . table 10, @blum[0 .. 49]; +printf "The %7sth Blum integer: %9s\n", comma($_), comma $blum[$_ - 1] for @nth; say ''; -printf "$_: %6d (%.3f%%)\n", $C{$_}, 100*$C{$_}/scalar @blum for <1 3 7 9>; +printf "$_: %6d (%.3f%%)\n", $C{$_}, 100 * $C{$_} / scalar @blum for <1 3 7 9>; diff --git a/Task/Blum-integer/Phix/blum-integer.phix b/Task/Blum-integer/Phix/blum-integer.phix index 340fab0e13..77f9aec49d 100644 --- a/Task/Blum-integer/Phix/blum-integer.phix +++ b/Task/Blum-integer/Phix/blum-integer.phix @@ -1,59 +1,57 @@ -(phixonline)--> - with javascript_semantics - constant LIMIT = 1e7, N = floor((floor(LIMIT/3)-1)/4)+1 +with javascript_semantics +constant LIMIT = 1e7, N = floor((floor(LIMIT/3)-1)/4)+1 - function Sieve4n_3_Primes() - sequence sieve = repeat(0,N), p4n3 = {} - for idx=1 to N do - if sieve[idx]=0 then - integer n = idx*4-1 - p4n3 &= n - if idx+n>N then - // collect the rest - for j=idx+1 to N do - if sieve[j]=0 then - p4n3 &= 4*j-1 - end if - end for - exit - end if - for j=idx+n to N by n do - sieve[j] = 1 - end for - end if - end for - return p4n3 - end function +function Sieve4n_3_Primes() + sequence sieve = repeat(0,N), p4n3 = {} + for idx=1 to N do + if sieve[idx]=0 then + integer n = idx*4-1 + p4n3 &= n + if idx+n>N then + // collect the rest + for j=idx+1 to N do + if sieve[j]=0 then + p4n3 &= 4*j-1 + end if + end for + exit + end if + for j=idx+n to N by n do + sieve[j] = 1 + end for + end if + end for + return p4n3 +end function - sequence p4n3 = Sieve4n_3_Primes(), - BlumField = repeat(false,LIMIT), - Blum50 = {}, counts = repeat(0,10) +sequence p4n3 = Sieve4n_3_Primes(), + BlumField = repeat(false,LIMIT), + Blum50 = {}, counts = repeat(0,10) - for idx,n in p4n3 do - for bj in p4n3 from idx+1 do - atom k = n*bj - if k>LIMIT then exit end if - BlumField[k] = true - end for - end for - integer count = 0 - for n,k in BlumField do - if k then - if count<50 then Blum50 &= n end if - counts[remainder(n,10)] += 1 - count += 1 - if count=50 then - printf(1,"First 50 Blum integers:\n%s\n",{join_by(Blum50,1,10," ",fmt:="%3d")}) - elsif count=26828 or remainder(count,1e5)=0 then - printf(1,"The %,7d%s Blum integer is: %,9d\n", {count,ord(count),n}) - if count=4e5 then exit end if - end if - end if - end for - printf(1,"\nPercentage distribution of the first 400,000 Blum integers:\n") - for i,n in counts do - if n then - printf(1," %6.3f%% end in %d\n", {n/4000, i}) - end if - end for - 1 += 4 5 # --> 1 +↧ 1 0 # --> 0 +↥ 0 1 # --> 1 diff --git a/Task/Boolean-values/VBScript/boolean-values.vb b/Task/Boolean-values/VBScript/boolean-values.vbs similarity index 100% rename from Task/Boolean-values/VBScript/boolean-values.vb rename to Task/Boolean-values/VBScript/boolean-values.vbs diff --git a/Task/Boolean-values/Zig/boolean-values.zig b/Task/Boolean-values/Zig/boolean-values.zig new file mode 100644 index 0000000000..f7b10d4ab0 --- /dev/null +++ b/Task/Boolean-values/Zig/boolean-values.zig @@ -0,0 +1,15 @@ +const std = @import("std"); + +pub fn main() !void { + const stdout = std.io.getStdOut().writer(); + + const bool1: bool = true; + const bool2: bool = false; + const bool3 = 2 + 2 == 4; + const bool4 = 2 + 2 == 5; + + try stdout.print("{any}\n", .{bool1}); + try stdout.print("{any}\n", .{bool2}); + try stdout.print("{any} {any}\n", .{@TypeOf(bool3), bool3}); + try stdout.print("{any} {any}\n", .{@TypeOf(bool4), bool4}); +} diff --git a/Task/Box-the-compass/11l/box-the-compass.11l b/Task/Box-the-compass/11l/box-the-compass.11l index 7ff6f201ec..ff86715b26 100644 --- a/Task/Box-the-compass/11l/box-the-compass.11l +++ b/Task/Box-the-compass/11l/box-the-compass.11l @@ -17,7 +17,7 @@ F degrees2compasspoint(=d) R q[minorindex].replace(‘N’, p1).replace(‘E’, p2).capitalize() :start: -L(i) 33 +L(i) 0.<33 V d = i * 11.25 S i % 3 1 diff --git a/Task/Box-the-compass/Ada/box-the-compass.ada b/Task/Box-the-compass/Ada/box-the-compass.adb similarity index 100% rename from Task/Box-the-compass/Ada/box-the-compass.ada rename to Task/Box-the-compass/Ada/box-the-compass.adb diff --git a/Task/Box-the-compass/AutoIt/box-the-compass.autoit b/Task/Box-the-compass/AutoIt/box-the-compass.au3 similarity index 100% rename from Task/Box-the-compass/AutoIt/box-the-compass.autoit rename to Task/Box-the-compass/AutoIt/box-the-compass.au3 diff --git a/Task/Box-the-compass/COBOL/box-the-compass.cobol b/Task/Box-the-compass/COBOL/box-the-compass.cob similarity index 100% rename from Task/Box-the-compass/COBOL/box-the-compass.cobol rename to Task/Box-the-compass/COBOL/box-the-compass.cob diff --git a/Task/Box-the-compass/Chipmunk-Basic/box-the-compass.basic b/Task/Box-the-compass/Chipmunk-Basic/box-the-compass.basic new file mode 100644 index 0000000000..3138b8ccc3 --- /dev/null +++ b/Task/Box-the-compass/Chipmunk-Basic/box-the-compass.basic @@ -0,0 +1,32 @@ +100 dim names$(31) +110 restore 300 +120 for c = 0 to ubound(names$) +130 read a$ +140 names$(c) = a$ +150 next c +160 dim degrees(32) +170 restore 380 +180 for c = 0 to ubound(degrees) +190 read b +200 degrees(c) = b +210 next c +220 for i = 0 to ubound(degrees) +230 j = int((degrees(i)+5.625)/11.25) +240 if j > 31 then j = j-32 +250 print using "####.##";degrees(i); +260 print using " ## ";j; +270 print names$(j) +280 next i +290 end +300 data "North","North by east","North-northeast","Northeast by north" +310 data "Northeast","Northeast by east","East-northeast","East by north" +320 data "East","East by south","East-southeast","Southeast by east" +330 data "Southeast","Southeast by south","South-southeast","South by east" +340 data "South","South by west","South-southwest","Southwest by south" +350 data "Southwest","Southwest by west","West-southwest","West by south" +360 data "West","West by north","West-northwest","Northwest by west","Northwest" +370 data "Northwest by north","North-northwest","North by west","North" +380 data 0,16.87,16.88,33.75,50.62,50.63,67.5,84.37,84.38,101.25 +390 data 118.12,118.13,135,151.87,151.88,168.75,185.62,185.63,202.5,219.37 +400 data 219.38,236.25,253.12,253.13,270,286.87,286.88,303.75,320.62,320.63 +410 data 337.5,354.37,354.388 diff --git a/Task/Box-the-compass/EasyLang/box-the-compass.easy b/Task/Box-the-compass/EasyLang/box-the-compass.easy new file mode 100644 index 0000000000..0bb02b538d --- /dev/null +++ b/Task/Box-the-compass/EasyLang/box-the-compass.easy @@ -0,0 +1,35 @@ +func$ expand cp$ . + for c$ in strchars cp$ + if c$ = "N" + r$ &= "north" + elif c$ = "E" + r$ &= "east" + elif c$ = "S" + r$ &= "south" + elif c$ = "W" + r$ &= "west" + elif c$ = "b" + r$ &= "by" + else + r$ &= "-" + . + . + h$ = strchar (strcode substr r$ 1 1 - 32) + return h$ & substr r$ 2 999 +. +proc main . + cp$[] = [ "N" "NbE" "N-NE" "NEbN" "NE" "NEbE" "E-NE" "EbN" "E" "EbS" "E-SE" "SEbE" "SE" "SEbS" "S-SE" "SbE" "S" "SbW" "S-SW" "SWbS" "SW" "SWbW" "W-SW" "WbS" "W" "WbN" "W-NW" "NWbW" "NW" "NWbN" "N-NW" "NbW" ] + print "Index Degrees Compass point" + print "----- ------- -------------" + for i = 0 to 32 + ind = (i + 1) mod1 32 + heading = i * 11.25 + if i mod 3 = 1 + heading += 5.62 + elif i mod 3 = 2 + heading -= 5.62 + . + print ind & "\t" & heading & "\t" & expand cp$[ind] + . +. +main diff --git a/Task/Box-the-compass/Elixir/box-the-compass.elixir b/Task/Box-the-compass/Elixir/box-the-compass.ex similarity index 100% rename from Task/Box-the-compass/Elixir/box-the-compass.elixir rename to Task/Box-the-compass/Elixir/box-the-compass.ex diff --git a/Task/Box-the-compass/Euphoria/box-the-compass.euphoria b/Task/Box-the-compass/Euphoria/box-the-compass.eu similarity index 100% rename from Task/Box-the-compass/Euphoria/box-the-compass.euphoria rename to Task/Box-the-compass/Euphoria/box-the-compass.eu diff --git a/Task/Box-the-compass/FutureBasic/box-the-compass.basic b/Task/Box-the-compass/FutureBasic/box-the-compass.basic new file mode 100644 index 0000000000..44c7b8dca8 --- /dev/null +++ b/Task/Box-the-compass/FutureBasic/box-the-compass.basic @@ -0,0 +1,32 @@ +window 1,@"Box the Compass" +_Name = 0 +_Degrees = 1 + + +// mda defaults to mda _Name +mda(0)=@"North":mda(1)=@"North by east":mda(2)=@"North-northeast" +mda(3)=@"Northeast by north":mda(4)=@"Northeast":mda(5)=@"Northeast by east":mda(6)=@"East-northeast" +mda(7)=@"East by north":mda(8)=@"East":mda(9)=@"East by south":mda(10)=@"East-southeast" +mda(11)=@"Southeast by east":mda(12)=@"Southeast":mda(13)=@"Southeast by south":mda(14)=@"South-southeast" +mda(15)=@"South by east":mda(16)= @"South":mda(17)= @"South by west":mda(18)= @"South-southwest" +mda(19)=@"Southwest by south":mda(20)=@"Southwest":mda(21)=@"Southwest by west":mda(22)=@"West-southwest" +mda(23)=@"West by south":mda(24)=@"West":mda(25)=@"West by north":mda(26)=@"West-northwest" +mda(27)=@"Northwest by west":mda(28)=@"Northwest":mda(29)=@"Northwest by north":mda(30)=@"North-northwest" +mda(31)=@"North by west":mda(32)=@"North" + +mda _Degrees (0) = { 0, 16.87, 16.88, 33.75, 50.62, 50.63,¬ +67.5, 84.37, 84.38, 101.25, 118.12, 118.13, 135, 151.87, 151.88, 168.75,¬ +185.62, 185.63, 202.5, 219.37, 219.38, 236.25, 253.12, 253.13, 270,¬ +286.87, 286.88, 303.75, 320.62, 320.63, 337.5, 354.37, 354.38 } + +unsigned Long i, j + +For i = 0 To 32 + j = fix((mda_double _Degrees(i) + 5.625) / 11.25) + If j > 31 Then j = j - 32 + Print Using "###.## "; (mda_double _Degrees(i)); + Print Using "## "; j; + Print mda _Name(j) +Next + +handleevents diff --git a/Task/Box-the-compass/GW-BASIC/box-the-compass.basic b/Task/Box-the-compass/GW-BASIC/box-the-compass.basic new file mode 100644 index 0000000000..ddb7d421b7 --- /dev/null +++ b/Task/Box-the-compass/GW-BASIC/box-the-compass.basic @@ -0,0 +1,32 @@ +100 dim n$(31) +110 restore 300 +120 for c = 0 to 31 +130 read a$ +140 n$(c) = a$ +150 next c +160 dim d(32) +170 restore 380 +180 for c = 0 to 32 +190 read b +200 d(c) = b +210 next c +220 for i = 0 to 32 +230 j = int((d(i)+5.625)/11.25) +240 if j > 31 then j = j-32 +250 print using "####.##";d(i); +260 print using " ## ";j; +270 print n$(j) +280 next i +290 end +300 data "North","North by east","North-northeast","Northeast by north" +310 data "Northeast","Northeast by east","East-northeast","East by north" +320 data "East","East by south","East-southeast","Southeast by east" +330 data "Southeast","Southeast by south","South-southeast","South by east" +340 data "South","South by west","South-southwest","Southwest by south" +350 data "Southwest","Southwest by west","West-southwest","West by south" +360 data "West","West by north","West-northwest","Northwest by west","Northwest" +370 data "Northwest by north","North-northwest","North by west","North" +380 data 0,16.87,16.88,33.75,50.62,50.63,67.5,84.37,84.38,101.25 +390 data 118.12,118.13,135,151.87,151.88,168.75,185.62,185.63,202.5,219.37 +400 data 219.38,236.25,253.12,253.13,270,286.87,286.88,303.75,320.62,320.63 +410 data 337.5,354.37,354.38 diff --git a/Task/Box-the-compass/Icon/box-the-compass.icon b/Task/Box-the-compass/Icon/box-the-compass.icon index c1f1f16e6a..f9d3562942 100644 --- a/Task/Box-the-compass/Icon/box-the-compass.icon +++ b/Task/Box-the-compass/Icon/box-the-compass.icon @@ -7,7 +7,7 @@ every heading := 11.25 * (i := 0 to 32) do { 1: heading +:= 5.62 2: heading -:= 5.62 } - write(right(i+1,3)," ",left(direction(heading),20)," ",fix(heading,,7,2)) + write(right(i%32+1,3)," ",left(direction(heading),20)," ",fix(heading,,7,2)) } end @@ -17,10 +17,10 @@ initial { every put(dirs := [], replacem(!["N","NbE","N-NE","NEbN","NE","NEbE","E-NE","EbN", "E","EbS","E-SE","SEbE","SE","SEbS","S-SE","SbE", - "S","SbW","S-SW","SWbS","SW","SWbW","W-SW","WbS", - "W","WbN","W-NW","NWbW","NW","NWbN","N-NW","NbW"], + "S","SbW","S-SW","SWbS","SW","SWbW","W-SW","WbS", + "W","WbN","W-NW","NWbW","NW","NWbN","N-NW","NbW"], "N","north","E","east","W","west","S","south","b"," by ")) } - return dirs[round(((((d%360)+360)%360)/11.25)%32 + 1)] + return dirs[round(((((d%360)+360)%360)/11.25))%32 + 1] end diff --git a/Task/Box-the-compass/Julia/box-the-compass.julia b/Task/Box-the-compass/Julia/box-the-compass.jl similarity index 100% rename from Task/Box-the-compass/Julia/box-the-compass.julia rename to Task/Box-the-compass/Julia/box-the-compass.jl diff --git a/Task/Box-the-compass/Kotlin/box-the-compass.kotlin b/Task/Box-the-compass/Kotlin/box-the-compass.kts similarity index 100% rename from Task/Box-the-compass/Kotlin/box-the-compass.kotlin rename to Task/Box-the-compass/Kotlin/box-the-compass.kts diff --git a/Task/Box-the-compass/Langur/box-the-compass.langur b/Task/Box-the-compass/Langur/box-the-compass.langur index 17635c933e..997f98881a 100644 --- a/Task/Box-the-compass/Langur/box-the-compass.langur +++ b/Task/Box-the-compass/Langur/box-the-compass.langur @@ -1,4 +1,4 @@ -val .box = ["North", "North by east", "North-northeast", "Northeast by north", +val box = ["North", "North by east", "North-northeast", "Northeast by north", "Northeast", "Northeast by east", "East-northeast", "East by north", "East", "East by south", "East-southeast", "Southeast by east", "Southeast", "Southeast by south", "South-southeast", "South by east", @@ -7,7 +7,7 @@ val .box = ["North", "North by east", "North-northeast", "Northeast by north", "West", "West by north", "West-northwest", "Northwest by west", "Northwest", "Northwest by north", "North-northwest", "North by west"] -val .angles = [ +val angles = [ 0.0, 16.87, 16.88, 33.75, 50.62, 50.63, 67.5, 84.37, 84.38, 101.25, 118.12, 118.13, 135.0, 151.87, 151.88, 168.75, 185.62, 185.63, 202.5, 219.37, 219.38, 236.25, 253.12, 253.13, 270.0, @@ -16,7 +16,7 @@ val .angles = [ writeln "index degrees compass point" writeln "----- ------- -------------" -for .phi in .angles { - val .i = truncate(.phi x 32 / 360 + 0.5) rem 32 + 1 - writeln $"\.i:5; \.phi:r2:6; \.box[.i];" +for phi in angles { + val i = trunc(phi * 32 / 360 + 0.5) rem 32 + 1 + writeln "{{i:5}} {{phi:r2:6}} {{box[i]}}" } diff --git a/Task/Box-the-compass/OCaml/box-the-compass.ocaml b/Task/Box-the-compass/OCaml/box-the-compass.ml similarity index 100% rename from Task/Box-the-compass/OCaml/box-the-compass.ocaml rename to Task/Box-the-compass/OCaml/box-the-compass.ml diff --git a/Task/Box-the-compass/Phix/box-the-compass-1.phix b/Task/Box-the-compass/Phix/box-the-compass-1.phix index 4377ed54b4..8710cca852 100644 --- a/Task/Box-the-compass/Phix/box-the-compass-1.phix +++ b/Task/Box-the-compass/Phix/box-the-compass-1.phix @@ -1,48 +1,46 @@ -(phixonline)--> - with javascript_semantics - function get225(integer d, string p1, string p2, string p4) - string p3 = p1&'-'&lower(p2) - p2 &= " by "&lower(p1) - p1 &= " by "&lower(p4) - if d then - return {p1,p3,p2} -- eg {North by east,North-northeast,Northeast by north} - else - return {p2,p3,p1} -- eg {Northeast by east,East-northeast,East by north} - end if - end function +with javascript_semantics +function get225(integer d, string p1, string p2, string p4) + string p3 = p1&'-'&lower(p2) + p2 &= " by "&lower(p1) + p1 &= " by "&lower(p4) + if d then + return {p1,p3,p2} -- eg {North by east,North-northeast,Northeast by north} + else + return {p2,p3,p1} -- eg {Northeast by east,East-northeast,East by north} + end if +end function - function get45(sequence res, integer d, string p1, string p2) - string p3 - res = append(res,p1) -- North/East/South/West - if d then - p3 = p1&lower(p2) -- Northeast/Southwest - else - p3 = p2&lower(p1) -- Southeast/Northwest - end if - res &= get225(1,p1,p3,p2) -- eg get225(1,North,Northeast,East) - -- -> {North by east,North-northeast,Northeast by north} - res = append(res,p3) -- Northeast/Southeast/Southwest/Northwest - res &= get225(0,p2,p3,p1) -- eg get225(0,East,Northeast,North) - -- -> {Northeast by east,East-northeast,East by north} - return res - end function +function get45(sequence res, integer d, string p1, string p2) + string p3 + res = append(res,p1) -- North/East/South/West + if d then + p3 = p1&lower(p2) -- Northeast/Southwest + else + p3 = p2&lower(p1) -- Southeast/Northwest + end if + res &= get225(1,p1,p3,p2) -- eg get225(1,North,Northeast,East) + -- -> {North by east,North-northeast,Northeast by north} + res = append(res,p3) -- Northeast/Southeast/Southwest/Northwest + res &= get225(0,p2,p3,p1) -- eg get225(0,East,Northeast,North) + -- -> {Northeast by east,East-northeast,East by north} + return res +end function - function get90(sequence points) - sequence res = {} - for i=1 to length(points) do - res = get45(res,remainder(i,2),points[i],points[remainder(i,4)+1]) - end for -- ie get45(1,North,East) - -- get45(0,East,South) - -- get45(1,South,West) - -- get45(0,West,North) - return res - end function +function get90(sequence points) + sequence res = {} + for i=1 to length(points) do + res = get45(res,remainder(i,2),points[i],points[remainder(i,4)+1]) + end for -- ie get45(1,North,East) + -- get45(0,East,South) + -- get45(1,South,West) + -- get45(0,West,North) + return res +end function - constant compass_points = get90({"North","East","South","West"}) +constant compass_points = get90({"North","East","South","West"}) - for i = 1 to 33 do - atom test_point = (i-1)*11.25 + 5.62*(remainder(i,3)-1) - integer compass_point = remainder(floor(test_point*32/360+0.5),32)+1 - printf(1, "%2d %-22s %6.2f\n", {compass_point, compass_points[compass_point], test_point}) - end for - - with javascript_semantics - constant compass_points = { "North", "North by east", "North-northeast", "Northeast by north", - "Northeast", "Northeast by east", "East-northeast", "East by north", - "East", "East by south", "East-southeast", "Southeast by east", - "Southeast", "Southeast by south", "South-southeast", "South by east", - "South", "South by west", "South-southwest", "Southwest by south", - "Southwest", "Southwest by west", "West-southwest", "West by south", - "West", "West by north", "West-northwest", "Northwest by west", - "Northwest", "Northwest by north", "North-northwest", "North by west"}, - test_points = { 0.0, 16.87, 16.88, 33.75, 50.62, 50.63, 67.5, 84.37, 84.38, 101.25, 118.12, - 118.13, 135.0, 151.87, 151.88, 168.75, 185.62, 185.63, 202.5, 219.37, 219.38, 236.25, - 253.12, 253.13, 270.0, 286.87, 286.88, 303.75, 320.62, 320.63, 337.5, 354.37, 354.38} - for i=1 to length(test_points) do - integer compass_point = remainder(floor(test_points[i]*32/360+0.5),32)+1 - printf(1, "%2d %-22s %6.2f\n", {compass_point, compass_points[compass_point], test_points[i]}) - end for - - -- - -- demo\rosetta\BoyerMoore.exw - -- =========================== - -- - -- based on https://www-igm.univ-mlv.fr/~lecroq/string/node14.html - -- - with javascript_semantics - function preBmBc(string pat) - integer m = length(pat) - sequence bmBc = repeat(m,255) - for i=1 to m-1 do - bmBc[pat[i]] = m - i - end for - return bmBc - end function +-- demo\rosetta\BoyerMoore.exw +-- based on https://www-igm.univ-mlv.fr/~lecroq/string/node14.html +with javascript_semantics +function preBmBc(string pat) + integer m = length(pat) + sequence bmBc = repeat(m,255) + for i=1 to m-1 do + bmBc[pat[i]] = m - i + end for + return bmBc +end function - function suffixes(string pat) - integer m = length(pat), g = m, f - sequence suff = repeat(0,m) - suff[m] = m; - for i=m-1 to 1 by -1 do - if i > g and suff[i + m - f] < i - g then - suff[i] = suff[i + m - f] - else - if i < g then g = i end if - f = i - while g >= 1 and pat[g] == pat[g + m - f] do - g -= 1; - end while - suff[i] = f - g - end if - end for - return suff - end function +function suffixes(string pat) + integer m = length(pat), g = m, f + sequence suff = repeat(0,m) + suff[m] = m; + for i=m-1 to 1 by -1 do + if i > g and suff[i + m - f] < i - g then + suff[i] = suff[i + m - f] + else + if i < g then g = i end if + f = i + while g >= 1 and pat[g] == pat[g + m - f] do + g -= 1; + end while + suff[i] = f - g + end if + end for + return suff +end function - function preBmGs(string pat) - integer m = length(pat), j = 1 - sequence suff = suffixes(pat), - bmGs = repeat(m,m) - for i=m to 1 by -1 do - if (suff[i] == i) then - while j < m - i do - if (bmGs[j] == m) then - bmGs[j] = m - i; - end if - j += 1 - end while - end if - end for - for i=1 to m-1 do - bmGs[m - suff[i]] = m - i; - end for - return bmGs - end function +function preBmGs(string pat) + integer m = length(pat), j = 1 + sequence suff = suffixes(pat), + bmGs = repeat(m,m) + for i=m to 1 by -1 do + if (suff[i] == i) then + while j < m - i do + if (bmGs[j] == m) then + bmGs[j] = m - i; + end if + j += 1 + end while + end if + end for + for i=1 to m-1 do + bmGs[m - suff[i]] = m - i; + end for + return bmGs +end function - procedure BM(string pat, s, bool case_insensitive = false) - string pins = sprintf("`%s` in `%s`",{pat,shorten(s,"characters",10)}) - if case_insensitive then - pat = lower(pat) - s = lower(s) - end if - /* Preprocessing */ - sequence bmGs = preBmGs(pat), - bmBc = preBmBc(pat) - /* Searching */ - sequence res = {} - integer i, j = 0, - n = length(s), - m = length(pat), - cc = 0 - while j <= n - m do - for i=m to 1 by -1 do - cc += 1 - if pat[i]!=s[i+j] then exit end if - end for - if i<1 then - res &= j+1 - j += bmGs[1]; - else - j += max(bmGs[i], bmBc[s[i + j]] - m + i); - end if - end while - string ccs = sprintf("(%d character comparisons)",cc) - if length(res) then - string many = ordinant(length(res)) - printf(1,"Found %s %s at %v %s\n",{pins,many,res,ccs}) - else - printf(1,"No %s %s\n",{pins,ccs}) - end if - end procedure +procedure BM(string pat, s, bool case_insensitive = false) + string pins = sprintf("`%s` in `%s`",{pat,shorten(s,"characters",10)}) + if case_insensitive then + pat = lower(pat) + s = lower(s) + end if + /* Preprocessing */ + sequence bmGs = preBmGs(pat), + bmBc = preBmBc(pat) + /* Searching */ + sequence res = {} + integer i, j = 0, + n = length(s), + m = length(pat), + cc = 0 + while j <= n - m do + for i=m to 1 by -1 do + cc += 1 + if pat[i]!=s[i+j] then exit end if + end for + if i<1 then + res &= j+1 + j += bmGs[1]; + else + j += max(bmGs[i], bmBc[s[i + j]] - m + i); + end if + end while + string ccs = sprintf("(%d character comparisons)",cc) + if length(res) then + string many = ordinant(length(res)) + printf(1,"Found %s %s at %v %s\n",{pins,many,res,ccs}) + else + printf(1,"No %s %s\n",{pins,ccs}) + end if +end procedure - BM("GCAGAGAG","GCATCGCAGAGAGTATACAGTACG") - BM("TCTA","GCTAGCTCTACGAGTCTA") - BM("TAATAAA","GGCTATAATGCGTA") - BM("word","there would have been a time for such a word") - BM("needle","needle need noodle needle") - constant book = "InhisbookseriesTheArtofComputerProgrammingpublishedbyAddisonWesley"& - "DKnuthusesanimaginarycomputertheMIXanditsassociatedmachinecodeand"& - "assemblylanguagestoillustratetheconceptsandalgorithmsastheyarepresented" - BM("put",book) - BM("and",book) - constant farm = "Nearby farms grew a half acre of alfalfa on the dairy's behalf, with "& - "bales of all that alfalfa exchanged for milk." - BM("alfalfa",farm) - --BM("aLfAlfa",farm) -- none - --BM("aLfAlfa",farm,true) -- as -2 - - with javascript_semantics - function same_digits(integer n, b) - integer f = remainder(n,b) - n = floor(n/b) - while n>0 do - if remainder(n,b)!=f then return false end if - n = floor(n/b) - end while - return true - end function +with javascript_semantics +function same_digits(integer n, b) + integer f = remainder(n,b) + n = floor(n/b) + while n>0 do + if remainder(n,b)!=f then return false end if + n = floor(n/b) + end while + return true +end function - function is_brazilian(integer n) - if n>=7 then - if remainder(n,2)=0 then return true end if - for b=2 to n-2 do - if same_digits(n,b) then return true end if - end for - end if - return false - end function +function is_brazilian(integer n) + if n>=7 then + if remainder(n,2)=0 then return true end if + for b=2 to n-2 do + if same_digits(n,b) then return true end if + end for + end if + return false +end function - constant kinds = {" ", " odd ", " prime "} - for i=1 to length(kinds) do - printf(1,"First 20%sBrazilian numbers:\n", {kinds[i]}) - integer c = 0, n = 7, p = 4 - while true do - if is_brazilian(n) then - printf(1,"%d ",n) - c += 1 - if c==20 then - printf(1,"\n\n") - exit - end if - end if - switch i - case 1: n += 1 - case 2: n += 2 - case 3: p += 1; n = get_prime(p) - end switch - end while - end for +constant kinds = {" ", " odd ", " prime "} +for i=1 to length(kinds) do + printf(1,"First 20%sBrazilian numbers:\n", {kinds[i]}) + integer c = 0, n = 7, p = 4 + while true do + if is_brazilian(n) then + printf(1,"%d ",n) + c += 1 + if c==20 then + printf(1,"\n\n") + exit + end if + end if + switch i + case 1: n += 1 + case 2: n += 2 + case 3: p += 1; n = get_prime(p) + end switch + end while +end for - integer n = 7, c = 0 - atom t0 = time(), t1 = time()+1 - while c<100000 do - if platform()!=JS and time()>t1 then - printf(1,"checking %d [count:%d]...\r",{n,c}) - t1 = time()+1 - end if - c += is_brazilian(n) - n += 1 - end while - printf(1,"The %,dth Brazilian number: %d\n", {c,n-1}) - ?elapsed(time()-t0) - - without js -- (no class under p2js) - class test - private string msg = "this is a test" - procedure show() ?this.msg end procedure - end class - test t = new() - t.show() - --?t.msg -- illegal - --t.msg = "this is broken" -- illegal - include builtins\structs.e as structs - constant ctx = routine_id("test") -- magic/context - --constant ctx = "test" -- also works - --constant ctx = test -- also works - ?structs:fetch_field(t,"msg",ctx)&" (with some magic)" - structs:store_field(t,"msg","this breaks privacy",ctx) - t.show() - - -- - -- demo\rosetta\BrilliantNumbers.exw - -- ================================= - -- - with javascript_semantics - requires("1.0.2") -- (for in) - atom t0 = time() +with javascript_semantics +requires("1.0.2") -- (for in) +atom t0 = time() - function get_primes_by_digits(integer limit) - sequence primes = get_primes_le(power(10,limit)), - primes_by_digits = {} - integer p = 10 - while length(primes) do - integer pi = abs(binary_search(p,primes))-1 - primes_by_digits &= {primes[1..pi]} - primes = primes[pi+1..$] - p*= 10 - end while - return primes_by_digits - end function - sequence primes_by_digits = get_primes_by_digits(8) +function get_primes_by_digits(integer limit) + sequence primes = get_primes_le(power(10,limit)), + primes_by_digits = {} + integer p = 10 + while length(primes) do + integer pi = abs(binary_search(p,primes))-1 + primes_by_digits &= {primes[1..pi]} + primes = primes[pi+1..$] + p*= 10 + end while + return primes_by_digits +end function +sequence primes_by_digits = get_primes_by_digits(8) - procedure first100() - sequence brilliant_numbers = {} - for primes in primes_by_digits do - for i=1 to length(primes) do - --see talk page - -- for j=i to length(primes) do - for j=1 to i do - brilliant_numbers &= primes[i]*primes[j] - end for - end for - if length(brilliant_numbers)>=100 then exit end if - end for - brilliant_numbers = sort(brilliant_numbers)[1..100] - sequence j100 = join_by(brilliant_numbers,1,10," ","\n","%,5d") - printf(1,"First 100 brilliant numbers:\n%s\n\n",{j100}) - end procedure - first100() +procedure first100() + sequence brilliant_numbers = {} + for primes in primes_by_digits do + for i=1 to length(primes) do +--see talk page +-- for j=i to length(primes) do + for j=1 to i do + brilliant_numbers &= primes[i]*primes[j] + end for + end for + if length(brilliant_numbers)>=100 then exit end if + end for + brilliant_numbers = sort(brilliant_numbers)[1..100] + sequence j100 = join_by(brilliant_numbers,1,10," ","\n","%,5d") + printf(1,"First 100 brilliant numbers:\n%s\n\n",{j100}) +end procedure +first100() - atom pwr = 10, count = 0 - for p=1 to 2*length(primes_by_digits)-1 do - sequence primes = primes_by_digits[floor(p/2)+1] - atom pos = count+1, - min_product = 0 - for i=1 to length(primes) do - integer p1 = primes[i], - j = abs(binary_search(floor((pwr+p1-1)/p1),primes,i)) - if j<=length(primes) then -- (always is, I think) - integer p2 = primes[j] - atom prod = p1*p2 - if min_product=0 or prod<min_product then - min_product = prod - end if - pos += j-i - if p1>=p2 then exit end if - end if - end for - printf(1,"First brilliant number >= 10^%d is %,d at position %,d\n", {p, min_product, pos}) - pwr *= 10; - if odd(p) then - integer size = length(primes) - count += size * (size + 1) / 2; - end if - end for - ?elapsed(time()-t0) - {} = wait_key() - b ) + + [ true swap witheach + [ char 1 char 9 1+ within not if + [ say "Must be 1-9 only." cr + not conclude ] ] ] is 1-9 ( $ --> b ) + + [ 0 9 of + swap witheach + [ 1 unrot char 1 - poke ] + 0 swap witheach + + 4 = dup not if + [ say "Must all be different." cr ] ] is all-diff ( $ --> b ) + + + [ $ "Guess four digits, 1-9, no duplicates: " + input + dup 4chars not iff drop again + dup 1-9 not iff drop again + dup all-diff not iff drop again ] is guess ( $ --> $ ) + + [ $ "123456789" shuffle 4 split drop ] is rand$ ( --> $ ) + + [ 2 pack transpose + [] swap witheach + [ dup unpack != iff + [ nested join ] + else drop ] + dup [] != if + [ transpose unpack ] + 4 over size - ] is -bulls ( $ $ --> $ $ n ) + + [ join sort + 0 swap + behead swap witheach + [ tuck = if [ dip 1+ ] ] + drop ] is cows ( $ $ --> n ) + + [ say "Guess the four numbers." cr cr + say "They are all different and" + say " between 1 and 9 inclusive." cr cr + randomise rand$ + [ guess + over -bulls + dup 4 = iff say "Correct." done + dup echo 1 = iff + [ say " bull." cr ] + else + [ say " bulls." cr ] + cows + dup echo 1 = iff + [ say " cow." cr ] + else + [ say " cows." cr ] + again ] + cr drop 2drop ] is play ( --> ) diff --git a/Task/Bulls-and-cows/Rebol/bulls-and-cows.rebol b/Task/Bulls-and-cows/Rebol/bulls-and-cows.rebol new file mode 100644 index 0000000000..3287a848ee --- /dev/null +++ b/Task/Bulls-and-cows/Rebol/bulls-and-cows.rebol @@ -0,0 +1,47 @@ +Rebol [ + title: "Rosetta code: Bulls and cows" + file: %Bulls_and_cows.r3 + url: https://rosettacode.org/wiki/Bulls_and_cows + needs: 3.10.0 ;; or something like that + note: "Based on Red language solution" +] + +bulls-and-cows: function/with [ + "Bulls and cows game" + /seed "optional refinement to provide a custom RNG seed" + value +][ + ;; Initialize RNG seed: use provided value, otherwise current time + random/seed any [value now/time] + ;; Secret 4-digit number with (implicitly) distinct digits from a random permutation + number: copy/part random numbers 4 + guesses: 0 + ;; Main game loop: continue until all 4 digits are correct and in correct positions + while [bulls <> 4] [ + bulls: cows: 0 ;; reset counters for this round + ;; Read user's guess + unless guess: ask "Make a guess: " [return none] ;; none on CTRL+C + ;; Validate: exactly 4 digits (note: does not enforce distinctness here) + unless parse guess [4 digits] [ + print "Guess should include exactly four different digits!" + continue + ] + ++ guesses + ;; Count bulls: correct digit in the correct position + repeat i 4 [ + if guess/:i == number/:i [++ bulls] + ] + ;; Count cows: correct digits in any position, minus the bulls + cows: (length? intersect guess number) - bulls + print ["bulls: " bulls " cows: " cows] + ] + print ["You won after" guesses "guesses!"] +][ + ;; WITH body: shared environment for the function + numbers: "0123456789" ;; pool of digits for generating the secret number + digits: charset numbers ;; character set used by the parser rule [4 digits] + bulls: cows: guesses: 0 ;; initialize counters +] + +;; DEMO: +bulls-and-cows/seed 1 diff --git a/Task/Bulls-and-cows/Red/bulls-and-cows.red b/Task/Bulls-and-cows/Red/bulls-and-cows.red index 8418d60be8..2fb3788045 100644 --- a/Task/Bulls-and-cows/Red/bulls-and-cows.red +++ b/Task/Bulls-and-cows/Red/bulls-and-cows.red @@ -4,13 +4,13 @@ bulls: 0 random/seed now/time number: copy/part random a 4 while [bulls <> 4] [ - bulls: 0 - cows: 0 - guess: ask "make a guess: " - repeat i 4 [ - if (pick guess i) = (pick number i) [bulls: bulls + 1] - ] - cows: (length? intersect guess number) - bulls - print ["bulls: " bulls " cows: " cows] + bulls: 0 + cows: 0 + guess: ask "make a guess: " + repeat i 4 [ + if (pick guess i) = (pick number i) [bulls: bulls + 1] + ] + cows: (length? intersect guess number) - bulls + print ["bulls: " bulls " cows: " cows] ] print "You won!" diff --git a/Task/Bulls-and-cows/Rust/bulls-and-cows.rust b/Task/Bulls-and-cows/Rust/bulls-and-cows.rs similarity index 100% rename from Task/Bulls-and-cows/Rust/bulls-and-cows.rust rename to Task/Bulls-and-cows/Rust/bulls-and-cows.rs diff --git a/Task/Bulls-and-cows/SETL/bulls-and-cows.setl b/Task/Bulls-and-cows/SETL/bulls-and-cows.setl new file mode 100644 index 0000000000..5ec7cb23da --- /dev/null +++ b/Task/Bulls-and-cows/SETL/bulls-and-cows.setl @@ -0,0 +1,58 @@ +program bulls_and_cows; + setrandom(0); + + print("Bulls and cows"); + print("--------------"); + print; + + secret := make_secret(); + + loop do + guess := read_guess(); + tries +:= 1; + bulls := count_bulls(guess, secret); + cows := count_cows(guess, secret); + print(bulls, "bulls,", cows, "cows."); + if bulls = 4 then + print("You win! Tries:", tries); + exit; + end if; + end loop; + + proc make_secret(); + digits := []; + loop for i in [1..4] do + loop until not digit in digits do + digit := 1 + random(8); + end loop; + digits with:= digit; + end loop; + return digits; + end proc; + + proc read_guess(); + loop do + putchar("Guess? "); + flush(stdout); + guess := getline(stdin); + if exists d in guess | not d in "123456789" then + print("invalid input:", d); + elseif #guess /= #{d : d in guess} then + print("no duplicates allowed"); + elseif #guess /= 4 then + print("need 4 digits"); + else + exit; + end if; + end loop; + return [val d : d in guess]; + end proc; + + proc count_bulls(guess, secret); + return #[i : i in [1..4] | guess(i) = secret(i)]; + end proc; + + proc count_cows(guess, secret); + return #[d : d in guess | d in secret] - count_bulls(guess, secret); + end proc; +end program; diff --git a/Task/Bulls-and-cows/Scheme/bulls-and-cows.ss b/Task/Bulls-and-cows/Scheme/bulls-and-cows.scm similarity index 100% rename from Task/Bulls-and-cows/Scheme/bulls-and-cows.ss rename to Task/Bulls-and-cows/Scheme/bulls-and-cows.scm diff --git a/Task/Bulls-and-cows/SenseTalk/bulls-and-cows.sensetalk b/Task/Bulls-and-cows/SenseTalk/bulls-and-cows.sensetalk index 1b05017e8f..3bb8673e2b 100644 --- a/Task/Bulls-and-cows/SenseTalk/bulls-and-cows.sensetalk +++ b/Task/Bulls-and-cows/SenseTalk/bulls-and-cows.sensetalk @@ -1,77 +1,77 @@ repeat forever - repeat forever - put random(1111,9999) into num - if character 1 of num is not equal to character 2 of num - if character 1 of num is not equal to character 3 of num - if character 1 of num is not equal to character 4 of num - if character 2 of num is not equal to character 3 of num - if character 2 of num is not equal to character 4 of num - if character 3 of num is not equal to character 4 of num - if num does not contain 0 - exit repeat - end if - end if - end if - end if - end if - end if - end if - end repeat - set description to "Guess the 4 digit number" & newline & "- zero's excluded" & newline & "- each digit is unique" & newline & newline & "Receive 1 Bull for each digit that equals the corresponding digit in the random number." & newline & newline & "Receive 1 Cow for each digit that appears in the wrong position." & newline - repeat forever - repeat forever - Ask "Guess the number" title "Bulls & Cows" message description - put it into guess - if number of characters in guess is equal to 4 - exit repeat - else if guess is "" - Answer "" with "Play" or "Quit" title "Quit Bulls & Cows?" - put it into myAnswer - if myAnswer is "Quit" - exit all - end if - end if - end repeat - set score to { - bulls: { - qty: 0, - values: [] - }, - cows: { - qty: 0, - values: [] - } - } - repeat the number of characters in num times - if character the counter of guess is equal to character the counter of num - add 1 to score.bulls.qty - insert character the counter of guess into score.bulls.values - else - if num contains character the counter of guess - if character the counter of guess is not equal to character the counter of num - if score.bulls.values does not contain character the counter of guess and score.cows.values does not contain character the counter of guess - add 1 to score.cows.qty - insert character the counter of guess into score.cows.values - end if - end if - end if - end if - end repeat - set showScores to "Your score is:" & newline & newline & "Bulls:" && score.bulls.qty & newline & newline & "Cows:" && score.cows.qty - if guess is not equal to num - Answer showScores with "Guess Again" or "Quit" title "Score" - put it into myAnswer - if myAnswer is "Quit" - exit all - end if - else - set winShowScores to showScores & newline & newline & "Your Guess:" && guess & newline & "Random Number:" && num & newline - Answer winShowScores with "Play Again" or "Quit" title "You Win!" - put it into myAnswer - if myAnswer is "Quit" - exit all - end if - exit repeat - end if - end repeat + repeat forever + put random(1111,9999) into num + if character 1 of num is not equal to character 2 of num + if character 1 of num is not equal to character 3 of num + if character 1 of num is not equal to character 4 of num + if character 2 of num is not equal to character 3 of num + if character 2 of num is not equal to character 4 of num + if character 3 of num is not equal to character 4 of num + if num does not contain 0 + exit repeat + end if + end if + end if + end if + end if + end if + end if + end repeat + set description to "Guess the 4 digit number" & newline & "- zero's excluded" & newline & "- each digit is unique" & newline & newline & "Receive 1 Bull for each digit that equals the corresponding digit in the random number." & newline & newline & "Receive 1 Cow for each digit that appears in the wrong position." & newline + repeat forever + repeat forever + Ask "Guess the number" title "Bulls & Cows" message description + put it into guess + if number of characters in guess is equal to 4 + exit repeat + else if guess is "" + Answer "" with "Play" or "Quit" title "Quit Bulls & Cows?" + put it into myAnswer + if myAnswer is "Quit" + exit all + end if + end if + end repeat + set score to { + bulls: { + qty: 0, + values: [] + }, + cows: { + qty: 0, + values: [] + } + } + repeat the number of characters in num times + if character the counter of guess is equal to character the counter of num + add 1 to score.bulls.qty + insert character the counter of guess into score.bulls.values + else + if num contains character the counter of guess + if character the counter of guess is not equal to character the counter of num + if score.bulls.values does not contain character the counter of guess and score.cows.values does not contain character the counter of guess + add 1 to score.cows.qty + insert character the counter of guess into score.cows.values + end if + end if + end if + end if + end repeat + set showScores to "Your score is:" & newline & newline & "Bulls:" && score.bulls.qty & newline & newline & "Cows:" && score.cows.qty + if guess is not equal to num + Answer showScores with "Guess Again" or "Quit" title "Score" + put it into myAnswer + if myAnswer is "Quit" + exit all + end if + else + set winShowScores to showScores & newline & newline & "Your Guess:" && guess & newline & "Random Number:" && num & newline + Answer winShowScores with "Play Again" or "Quit" title "You Win!" + put it into myAnswer + if myAnswer is "Quit" + exit all + end if + exit repeat + end if + end repeat end repeat diff --git a/Task/Bulls-and-cows/Swift/bulls-and-cows-1.swift b/Task/Bulls-and-cows/Swift/bulls-and-cows-1.swift index a79ec9f274..cae51f0783 100644 --- a/Task/Bulls-and-cows/Swift/bulls-and-cows-1.swift +++ b/Task/Bulls-and-cows/Swift/bulls-and-cows-1.swift @@ -1,57 +1,57 @@ func generateRandomNumArray(numDigits: Int = 4) -> [Character] { - guard (1 ... 9).contains(numDigits) else { fatalError("number out of range") } + guard (1 ... 9).contains(numDigits) else { fatalError("number out of range") } - return Array("123456789".shuffled()[0 ..< numDigits]) + return Array("123456789".shuffled()[0 ..< numDigits]) } func parseGuess(_ guess: String, numDigits: Int = 4) -> String? { - guard guess.count == numDigits else { return nil } + guard guess.count == numDigits else { return nil } // Only digits 0 to 9 allowed, no Unicode fractions or numbers from other languages - let guessArray = guess.filter{ $0.isASCII && $0.isWholeNumber } + let guessArray = guess.filter{ $0.isASCII && $0.isWholeNumber } - guard Set(guessArray).count == numDigits else { return nil } + guard Set(guessArray).count == numDigits else { return nil } - return guessArray + return guessArray } func pluralIfNeeded(_ count: Int, _ units: String) -> String { - return "\(count) " + units + (count == 1 ? "" : "s") + return "\(count) " + units + (count == 1 ? "" : "s") } var guessAgain = "y" while guessAgain == "y" { - let num = generateRandomNumArray() - var bulls = 0 - var cows = 0 + let num = generateRandomNumArray() + var bulls = 0 + var cows = 0 - print("Please enter a 4 digit number with digits between 1-9, no repetitions: ") + print("Please enter a 4 digit number with digits between 1-9, no repetitions: ") - if let guessStr = readLine(strippingNewline: true), let guess = parseGuess(guessStr) - { - for (guess, actual) in zip(guess, num) - { - if guess == actual - { - bulls += 1 - } - else if num.contains(guess) - { - cows += 1 - } - } + if let guessStr = readLine(strippingNewline: true), let guess = parseGuess(guessStr) + { + for (guess, actual) in zip(guess, num) + { + if guess == actual + { + bulls += 1 + } + else if num.contains(guess) + { + cows += 1 + } + } - print("Actual number: " + num) - print("Your score: \(pluralIfNeeded(bulls, "bull")) and \(pluralIfNeeded(cows, "cow"))\n") - print("Would you like to play again? (y): ") + print("Actual number: " + num) + print("Your score: \(pluralIfNeeded(bulls, "bull")) and \(pluralIfNeeded(cows, "cow"))\n") + print("Would you like to play again? (y): ") - guessAgain = readLine(strippingNewline: true)?.lowercased() ?? "n" - } - else - { - print("Invalid input") - } + guessAgain = readLine(strippingNewline: true)?.lowercased() ?? "n" + } + else + { + print("Invalid input") + } } diff --git a/Task/Bulls-and-cows/V-(Vlang)/bulls-and-cows.v b/Task/Bulls-and-cows/V-(Vlang)/bulls-and-cows.v index 0e34eb49e2..f03661d301 100644 --- a/Task/Bulls-and-cows/V-(Vlang)/bulls-and-cows.v +++ b/Task/Bulls-and-cows/V-(Vlang)/bulls-and-cows.v @@ -2,52 +2,52 @@ import rand import os fn main() { - valid := ['1','2','3','4','5','6','7','8','9'] - mut value := []string{} - mut guess, mut elem := '', '' - mut cows, mut bulls := 0, 0 - println('Cows and Bulls') - println('Guess four digit numbers of unique digits in the range 1 to 9.') - println('A correct digit, but not in the correct place is a cow.') - println('A correct digit, and in the correct place is a bull.') - // generate pattern - for value.len < 4 { - elem = rand.string_from_set('123456789', 1) - if value.any(it == elem) == false { - value << elem - } - } - // start game - input: for _ in 0..3 { - guess = os.input('Guess: ').str() - // deal with malformed guesses - if guess.len != 4 {println('Please input a four digit number.') continue input} - for val in guess { - if valid.contains(val.ascii_str()) == false { - {println('Please input a number between 1 to 9.') continue input} - } - if guess.count(val.ascii_str()) > 1 { - {println('Please do not repeat the same digit.') continue input} - } - } - // score guesses - for idx, gval in guess { - match true { - gval.ascii_str() == value[idx] { - bulls++ - println('${gval.ascii_str()} was correctly guessed, and in the correct location! ') + valid := ['1','2','3','4','5','6','7','8','9'] + mut value := []string{} + mut guess, mut elem := '', '' + mut cows, mut bulls := 0, 0 + println('Cows and Bulls') + println('Guess four digit numbers of unique digits in the range 1 to 9.') + println('A correct digit, but not in the correct place is a cow.') + println('A correct digit, and in the correct place is a bull.') + // generate pattern + for value.len < 4 { + elem = rand.string_from_set('123456789', 1) + if value.any(it == elem) == false { + value << elem + } + } + // start game + input: for _ in 0..3 { + guess = os.input('Guess: ').str() + // deal with malformed guesses + if guess.len != 4 {println('Please input a four digit number.') continue input} + for val in guess { + if valid.contains(val.ascii_str()) == false { + {println('Please input a number between 1 to 9.') continue input} + } + if guess.count(val.ascii_str()) > 1 { + {println('Please do not repeat the same digit.') continue input} + } + } + // score guesses + for idx, gval in guess { + match true { + gval.ascii_str() == value[idx] { + bulls++ + println('${gval.ascii_str()} was correctly guessed, and in the correct location! ') - } - gval.ascii_str() in value { - cows++ - println('${gval.ascii_str()} was correctly quessed, but not in the exact location! ') - } - else {} - } - if bulls == 4 {println('You are correct and have won!!! Congratulations!!!') exit(0)} - } - println('score: bulls: $bulls cows: $cows') - } - println('Only 3 guesses allowed. The correct value was: $value') - println('Sorry, you lost this time, try again.') + } + gval.ascii_str() in value { + cows++ + println('${gval.ascii_str()} was correctly quessed, but not in the exact location! ') + } + else {} + } + if bulls == 4 {println('You are correct and have won!!! Congratulations!!!') exit(0)} + } + println('score: bulls: $bulls cows: $cows') + } + println('Only 3 guesses allowed. The correct value was: $value') + println('Sorry, you lost this time, try again.') } diff --git a/Task/Bulls-and-cows/VBScript/bulls-and-cows.vb b/Task/Bulls-and-cows/VBScript/bulls-and-cows.vb deleted file mode 100644 index 4a82091cab..0000000000 --- a/Task/Bulls-and-cows/VBScript/bulls-and-cows.vb +++ /dev/null @@ -1,43 +0,0 @@ -randomize timer -fail=array("Wrong number of chars","Only figures 0 to 9 allowed","Two or more figures are the same") -p=dopuzzle() -wscript.echo "Bulls and Cows. Guess my 4 figure number!" -do - do - wscript.stdout.write vbcrlf & "your move ": s=trim(wscript.stdin.readline) - c=checkinput(s) - if not isarray (c) then wscript.stdout.write fail(c) :exit do - bu=c(0) - wscript.stdout.write "bulls: " & c(0) & " | cows: " & c(1) - loop while 0 -loop until bu=4 -wscript.stdout.write vbcrlf & "You won! " - - -function dopuzzle() - dim b(10) - for i=1 to 4 - do - r=fix(rnd*10) - loop until b(r)=0 - b(r)=1:dopuzzle=dopuzzle+chr(r+48) - next -end function - -function checkinput(s) - dim c(10) - bu=0:co=0 - if len(s)<>4 then checkinput=0:exit function - for i=1 to 4 - b=mid(s,i,1) - if instr("0123456789",b)=0 then checkinput=1 :exit function - if c(asc(b)-48)<>0 then checkinput=2 :exit function - c(asc(b)-48)=1 - for j=1 to 4 - if asc(b)=asc(mid(p,j,1)) then - if i=j then bu=bu+1 else co=co+1 - end if - next - next - checkinput=array(bu,co) -end function diff --git a/Task/Bulls-and-cows/VBScript/bulls-and-cows.vbs b/Task/Bulls-and-cows/VBScript/bulls-and-cows.vbs new file mode 100644 index 0000000000..0c0f44c378 --- /dev/null +++ b/Task/Bulls-and-cows/VBScript/bulls-and-cows.vbs @@ -0,0 +1,43 @@ +randomize timer +fail=array("Wrong number of chars","Only figures 0 to 9 allowed","Two or more figures are the same") +p=dopuzzle() +wscript.echo "Bulls and Cows. Guess my 4 figure number!" +do + do + wscript.stdout.write vbcrlf & "your move ": s=trim(wscript.stdin.readline) + c=checkinput(s) + if not isarray (c) then wscript.stdout.write fail(c) :exit do + bu=c(0) + wscript.stdout.write "bulls: " & c(0) & " | cows: " & c(1) + loop while 0 +loop until bu=4 +wscript.stdout.write vbcrlf & "You won! " + + +function dopuzzle() + dim b(10) + for i=1 to 4 + do + r=fix(rnd*10) + loop until b(r)=0 + b(r)=1:dopuzzle=dopuzzle+chr(r+48) + next +end function + +function checkinput(s) + dim c(10) + bu=0:co=0 + if len(s)<>4 then checkinput=0:exit function + for i=1 to 4 + b=mid(s,i,1) + if instr("0123456789",b)=0 then checkinput=1 :exit function + if c(asc(b)-48)<>0 then checkinput=2 :exit function + c(asc(b)-48)=1 + for j=1 to 4 + if asc(b)=asc(mid(p,j,1)) then + if i=j then bu=bu+1 else co=co+1 + end if + next + next + checkinput=array(bu,co) +end function diff --git a/Task/Burrows-Wheeler-transform/ALGOL-68/burrows-wheeler-transform.alg b/Task/Burrows-Wheeler-transform/ALGOL-68/burrows-wheeler-transform.alg new file mode 100644 index 0000000000..a401340fef --- /dev/null +++ b/Task/Burrows-Wheeler-transform/ALGOL-68/burrows-wheeler-transform.alg @@ -0,0 +1,63 @@ +BEGIN # Burrows-Wheeler transform - translated from the EasyLang sample # + PR read "sort.incl.a68" PR # include sort utilities # + CHAR stx = REPR 2, etx = REPR 3; + OP BWT = ( STRING s )STRING: + BEGIN + [ LWB s : UPB s + 2 ]STRING tbl; + STRING ss = stx + s + etx; + FOR i FROM LWB ss TO UPB ss DO + STRING a = ss[ LWB ss : i ]; + STRING b = IF i >= UPB ss THEN "" ELSE ss[ i + 1 : ] FI; + tbl[ i ] := b + a + OD; + QUICKSORT tbl; + STRING r := ""; + FOR s pos FROM LWB tbl TO UPB tbl DO + r +:= tbl[ s pos ][ UPB tbl[ s pos ] ] + OD; + r + END # BWT # ; + OP IBWT = ( STRING r )STRING: + BEGIN + [ LWB r : UPB r ]STRING tbl; + FOR j FROM LWB r TO UPB r DO tbl[ j ] := "" OD; + FROM LWB r TO UPB r DO + FOR k FROM LWB r TO UPB r DO + r[ k ] +=: tbl[ k ] + OD; + QUICKSORT tbl + OD; + STRING result := ""; + FOR r pos FROM LWB tbl TO UPB tbl WHILE result = "" DO + STRING row = tbl[ r pos ]; + IF row[ UPB row ] = etx THEN result := row[ LWB row + 1 : UPB row - 1 ] FI + OD; + result + END # IBWT # ; + + BEGIN + OP XTX = ( STRING s )STRING: # make stx and etx visible # + BEGIN + STRING result := ""; + FOR s pos FROM LWB s TO UPB s DO + CHAR c = s[ s pos ]; + result +:= IF c = stx THEN "" + ELIF c = etx THEN "" + ELSE c + FI + OD; + result + END # XTX # ; + []STRING tests = ( "banana", "appellee", "dogwood" + , "TO BE OR NOT TO BE OR WANT TO BE OR NOT?" + , "SIX.MIXED.PIXIES.SIFT.SIXTY.PIXIE.DUST.BOXES" + ); + FOR t pos FROM LWB tests TO UPB tests DO + STRING s = tests[ t pos ]; + print( ( s, newline ) ); + STRING h = BWT s; + print( ( " -> ", XTX h, newline ) ); + print( ( IBWT h, newline, newline ) ) + OD + END +END diff --git a/Task/Burrows-Wheeler-transform/Dart/burrows-wheeler-transform.dart b/Task/Burrows-Wheeler-transform/Dart/burrows-wheeler-transform.dart new file mode 100644 index 0000000000..4da16a962d --- /dev/null +++ b/Task/Burrows-Wheeler-transform/Dart/burrows-wheeler-transform.dart @@ -0,0 +1,67 @@ +import "dart:io"; + +void main() { + List tests = [ + "banana", + "appellee", + "dogwood", + "TO BE OR NOT TO BE OR WANT TO BE OR NOT?", + "SIX.MIXED.PIXIES.SIFT.SIXTY.PIXIE.DUST.BOXES", + "\u0002ABC\u0003" + ]; + for (String test in tests) { + print(makePrintable(test)); + stdout.write(" --> "); + String t = ""; + try { + t = bwt(test); + print(makePrintable(t)); + } catch (e) { + print("ERROR: ${e.toString()}"); + } + String r = ibwt(t); + print(" --> $r\n"); + } +} + +const String STX = "\u0002"; +const String ETX = "\u0003"; + +String bwt(String s) { + if (s.contains(STX) || s.contains(ETX)) { + throw FormatException("String cannot contain STX or ETX"); + } + + String ss = STX + s + ETX; + List table = []; + for (int i = 0; i < ss.length; i++) { + String before = ss.substring(i); + String after = ss.substring(0, i); + table.add(before + after); + } + table.sort(); + + return table.map((str) => str[str.length - 1]).join(); +} + +String ibwt(String r) { + int len = r.length; + List table = List.filled(len, ""); + for (int j = 0; j < len; ++j) { + for (int i = 0; i < len; ++i) { + table[i] = r[i] + table[i]; + } + table.sort(); + } + for (String row in table) { + if (row.endsWith(ETX)) { + return row.substring(1, len - 1); + } + } + return ""; +} + +String makePrintable(String s) { + // substitute ^ for STX and | for ETX to print results + return s.replaceAll(STX, "^").replaceAll(ETX, "|"); +} diff --git a/Task/Burrows-Wheeler-transform/EasyLang/burrows-wheeler-transform.easy b/Task/Burrows-Wheeler-transform/EasyLang/burrows-wheeler-transform.easy new file mode 100644 index 0000000000..2e078b2b25 --- /dev/null +++ b/Task/Burrows-Wheeler-transform/EasyLang/burrows-wheeler-transform.easy @@ -0,0 +1,49 @@ +# stx$ = strchar 2 +# etx$ = strchar 3 +stx$ = "¹" +etx$ = "²" +# +proc sort &d$[] . + for i = 2 to len d$[] + h$ = d$[i] + j = i - 1 + while j >= 1 and strcmp h$ d$[j] < 1 + d$[j + 1] = d$[j] + j -= 1 + . + d$[j + 1] = h$ + . +. +func$ bwt s$ . + ss$ = stx$ & s$ & etx$ + for i to len ss$ + a$ = substr ss$ 1 i + b$ = substr ss$ (i + 1) 9999 + tbl$[] &= b$ & a$ + . + sort tbl$[] + for s$ in tbl$[] : r$ &= substr s$ len s$ 1 + return r$ +. +func$ ibwt r$ . + le = len r$ + for i to le : tbl$[] &= "" + for j to le + for i to le + tbl$[i] = substr r$ i 1 & tbl$[i] + . + sort tbl$[] + . + for row$ in tbl$[] + if substr row$ le 1 = etx$ + return substr row$ 2 (le - 2) + . + . +. +for s$ in [ "banana" "appellee" "dogwood" "TO BE OR NOT TO BE OR WANT TO BE OR NOT?" "SIX.MIXED.PIXIES.SIFT.SIXTY.PIXIE.DUST.BOXES" ] + print s$ + h$ = bwt s$ + print h$ + print ibwt h$ + print "" +. diff --git a/Task/Burrows-Wheeler-transform/Fortran/burrows-wheeler-transform.f b/Task/Burrows-Wheeler-transform/Fortran/burrows-wheeler-transform.f new file mode 100644 index 0000000000..8fcb501e51 --- /dev/null +++ b/Task/Burrows-Wheeler-transform/Fortran/burrows-wheeler-transform.f @@ -0,0 +1,163 @@ +program BurrowsWheeler + implicit none + + ! Main program + call Test("BANANA") + call Test("CANAAN") + call Test("CANCAN") + call Test("appellee") + call Test("dogwood") + call Test("TO BE OR NOT TO BE OR WANT TO BE OR NOT?") + call Test("SIX.MIXED.PIXIES.SIFT.SIXTY.PIXIE.DUST.BOXES") + call Test("Four score and 7 years ago, our forefathers set forth on this continent to establish a new nation "//& + "conceived in liberty and dedicated to he proposition that all men were created equal") + contains + ! Function to compare rotations + integer function CompareRotations(input, n, a, b) + character(len=*), intent(in) :: input + integer, intent(in) :: n, a, b + integer :: p, q, nrNotTested + integer :: i ,k + + CompareRotations = 0 + p = a + q = b + nrNotTested = n + do + p = p + 1 + if (p == n) p = 0 + q = q + 1 + if (q == n) q = 0 + i = p + 1 + k = q + 1 + if (input(i:i) == input(k:k)) then + nrNotTested = nrNotTested - 1 + else if (input(i:i) > input(k:k)) then + CompareRotations = 1 + exit + else + CompareRotations = -1 + exit + end if + if (nrNotTested == 0) exit + end do + end function CompareRotations + + ! Subroutine to encode the input string + subroutine Encode(input, encoded, index) + character(len=*), intent(in) :: input + character(len=*), intent(out) :: encoded + integer, intent(out) :: index + integer :: n, i, j, k, incr, v + integer, allocatable :: perm(:) + + n = len(input) + allocate(perm(0:n-1)) + do j = 0, n - 1 + perm(j) = j + end do + + ! Shell sort + incr = 1 + do + incr = 3 * incr + 1 + if (incr >= n) exit + end do + do + incr = incr / 3 + do i = incr, n - 1 + v = perm(i) + j = i + do while (j >= incr) + if(CompareRotations(input, n, perm(j - incr), v) /= 1)exit + perm(j) = perm(j - incr) + j = j - incr + end do + perm(j) = v + end do + if (incr == 1) exit + end do + + ! Create the output + do j = 0, n - 1 + k = perm(j) + encoded(j + 1:j + 1) = input(k + 1:k + 1) + if (k == n - 1) index = j + end do + + deallocate(perm) + end subroutine Encode + + ! Function to decode the encoded string + function Decode(encoded, index) result(decoded) + character(len=*), intent(in) :: encoded + integer, intent(in) :: index + character(len=:), allocatable :: decoded + integer :: charInfo(0:255) + integer, allocatable :: perm(:) + integer :: n, j, k, total, prev + character :: c + + n = len(encoded) + if (n == 0) then + decoded = "" + return + end if + + charInfo = 0 + do j = 0, n - 1 + c = encoded(j + 1:j + 1) + charInfo(ichar(c)) = charInfo(ichar(c)) + 1 + end do + + total = 0 + prev = 0 + do k = 0, 255 + total = total + prev + prev = charInfo(k) + charInfo(k) = total + end do + + allocate(perm(0:n-1)) + do j = 0, n - 1 + c = encoded(j + 1:j + 1) + k = charInfo(ichar(c)) + perm(k) = j + charInfo(ichar(c)) = charInfo(ichar(c)) + 1 + end do + + allocate(character(len=n) :: decoded) + k = 0 + j = index + do + j = perm(j) + decoded(k + 1:k + 1) = encoded(j + 1:j + 1) + k = k + 1 + if (j == index) exit + end do + + if (k < n) then + do j = k, n - 1 + decoded(j + 1:j + 1) = decoded(j - k + 1:j - k + 1) + end do + end if + end function Decode + + ! Subroutine to test the encoding and decoding + subroutine Test(s) + character(len=*), intent(in) :: s + character(len=:), allocatable :: encoded, decoded + integer :: index + + print *, "" + print *, " ", s + allocate(character(len=len(s)) :: encoded) + call Encode(s, encoded, index) + print *, "---> ", encoded + print *, " index = ", index + decoded = Decode(encoded, index) + print *, "---> ", decoded + deallocate(encoded) + end subroutine Test + +end program BurrowsWheeler diff --git a/Task/Burrows-Wheeler-transform/FreeBASIC/burrows-wheeler-transform.basic b/Task/Burrows-Wheeler-transform/FreeBASIC/burrows-wheeler-transform.basic new file mode 100644 index 0000000000..2e73fee45e --- /dev/null +++ b/Task/Burrows-Wheeler-transform/FreeBASIC/burrows-wheeler-transform.basic @@ -0,0 +1,103 @@ +#define STX Chr(&H2) +#define ETX Chr(&H3) + +Sub Sort(arr() As String) + Dim As Integer i, j, n + n = Ubound(arr) + 1 + For i = 0 To n - 1 + For j = i + 1 To n - 1 + If arr(i) > arr(j) Then Swap arr(i), arr(j) + Next j + Next i +End Sub + +Function Replace(Byval cadena As String, Byval subcadena As String, Byval reemplazaCon As String) As String + Dim As Integer posic = Instr(cadena, subcadena) + While posic <> 0 + cadena = Left(cadena, posic - 1) & reemplazaCon & Mid(cadena, posic + Len(subcadena)) + posic = Instr(posic + Len(reemplazaCon), cadena, subcadena) + Wend + Return cadena +End Function + +Sub Rotate(s As String) + Dim As Integer longi = Len(s) + Dim As String t = Right(s, 1) + s = t & Left(s, longi - 1) +End Sub + +Function BWT(s As String) As String + Dim As Integer i + For i = 1 To Len(s) + If Mid(s, i, 1) = STX Orelse Mid(s, i, 1) = ETX Then + Print "ERROR: String can't contain STX or ETX"; + Exit Function + End If + Next i + + Dim As String ss = STX & s & ETX + Dim As Integer longi = Len(ss) + Dim As String tabla(longi) + + For i = 1 To longi + tabla(i) = ss + Rotate(ss) + Next i + + Sort tabla() + + Dim As String salida + For i = 1 To longi + salida &= Right(tabla(i), 1) + Next i + + Return salida +End Function + +Function Ibwt(r As String) As String + Dim As Integer i, j + Dim As Integer longi = Len(r) + Dim As String sa(1 To longi) + Dim As String tabla(Lbound(sa) To Ubound(sa)) + + For i = 1 To longi + For j = 1 To longi + tabla(j) = Mid(r, j, 1) & tabla(j) + Next j + Sort tabla() + Next i + + For i = Lbound(tabla) To Ubound(tabla) + If Right(tabla(i), 1) = ETX Then Return Mid(tabla(i), 2, longi - 2) + Next i + + Return "" +End Function + +Function makePrintable(s As String) As String + Dim As String ls = s + + For i As Integer = 1 To Len(ls) + Select Case Mid(ls, i, 1) + Case STX : Mid(ls, i, 1) = "^" + Case ETX : Mid(ls, i, 1) = "|" + End Select + Next i + + Return ls +End Function + +Dim As String tests(5) = { _ +"banana", "appellee", "dogwood", "TO BE OR NOT TO BE OR WANT TO BE OR NOT?", _ +"SIX.MIXED.PIXIES.SIFT.SIXTY.PIXIE.DUST.BOXES", STX & "ABC" & ETX } + +For i As Integer = Lbound(tests) To Ubound(tests) + Print makePrintable(tests(i)) + Print " --> "; + Dim As String t = BWT(tests(i)) + Print makePrintable(t) + Dim As String r = iBWT(t) + Print " --> "; r; Chr(10); Chr(10); +Next i + +Sleep diff --git a/Task/Burrows-Wheeler-transform/JavaScript/burrows-wheeler-transform.js b/Task/Burrows-Wheeler-transform/JavaScript/burrows-wheeler-transform.js new file mode 100644 index 0000000000..dc7efff102 --- /dev/null +++ b/Task/Burrows-Wheeler-transform/JavaScript/burrows-wheeler-transform.js @@ -0,0 +1,76 @@ +class BWT { + static STX = "\u0002"; + static ETX = "\u0003"; + + static bwt(s) { + if (s.includes(BWT.STX) || s.includes(BWT.ETX)) { + throw new Error("String cannot contain STX or ETX"); + } + + const ss = BWT.STX + s + BWT.ETX; + const table = []; + for (let i = 0; i < ss.length; i++) { + const before = ss.substring(i); + const after = ss.substring(0, i); + table.push(before + after); + } + table.sort(); + + let sb = ""; + for (const str of table) { + sb += str.charAt(str.length - 1); + } + return sb; + } + + static ibwt(r) { + const len = r.length; + const table = []; + for (let i = 0; i < len; ++i) { + table.push(""); + } + for (let j = 0; j < len; ++j) { + for (let i = 0; i < len; ++i) { + table[i] = r.charAt(i) + table[i]; + } + table.sort(); + } + for (const row of table) { + if (row.endsWith(BWT.ETX)) { + return row.substring(1, len - 1); + } + } + return ""; + } + + static makePrintable(s) { + // substitute ^ for STX and | for ETX to print results + return s.replace(BWT.STX, "^").replace(BWT.ETX, "|"); + } + + static main() { + const tests = [ + "banana", + "appellee", + "dogwood", + "TO BE OR NOT TO BE OR WANT TO BE OR NOT?", + "SIX.MIXED.PIXIES.SIFT.SIXTY.PIXIE.DUST.BOXES", + "\u0002ABC\u0003" + ]; + for (const test of tests) { + console.log(BWT.makePrintable(test)); + process.stdout.write(" --> "); + let t = ""; + try { + t = BWT.bwt(test); + console.log(BWT.makePrintable(t)); + } catch (e) { + console.log("ERROR: " + e.message); + } + const r = BWT.ibwt(t); + console.log(` --> ${r}\n`); + } + } +} + +BWT.main(); diff --git a/Task/Burrows-Wheeler-transform/Jq/burrows-wheeler-transform-1.jq b/Task/Burrows-Wheeler-transform/Jq/burrows-wheeler-transform-1.jq index 1f34d0aec0..4151d553f4 100644 --- a/Task/Burrows-Wheeler-transform/Jq/burrows-wheeler-transform-1.jq +++ b/Task/Burrows-Wheeler-transform/Jq/burrows-wheeler-transform-1.jq @@ -20,6 +20,6 @@ def ibwt: | length as $len | reduce range(0;$len) as $i ([]; reduce range(0; $len) as $j (.; - .[$j] = $r[$j:$j+1] + .[$j]) | sort) + .[$j] = $r[$j:$j+1] + .[$j]) | sort) | first( .[] | select(endswith("\u0003"))) | .[1:-1] ; diff --git a/Task/Burrows-Wheeler-transform/Julia/burrows-wheeler-transform.julia b/Task/Burrows-Wheeler-transform/Julia/burrows-wheeler-transform.jl similarity index 100% rename from Task/Burrows-Wheeler-transform/Julia/burrows-wheeler-transform.julia rename to Task/Burrows-Wheeler-transform/Julia/burrows-wheeler-transform.jl diff --git a/Task/Burrows-Wheeler-transform/Kotlin/burrows-wheeler-transform.kotlin b/Task/Burrows-Wheeler-transform/Kotlin/burrows-wheeler-transform.kts similarity index 100% rename from Task/Burrows-Wheeler-transform/Kotlin/burrows-wheeler-transform.kotlin rename to Task/Burrows-Wheeler-transform/Kotlin/burrows-wheeler-transform.kts diff --git a/Task/Burrows-Wheeler-transform/Ksh/burrows-wheeler-transform.ksh b/Task/Burrows-Wheeler-transform/Ksh/burrows-wheeler-transform.ksh index 97c9efba0f..dd2d4c0c0b 100644 --- a/Task/Burrows-Wheeler-transform/Ksh/burrows-wheeler-transform.ksh +++ b/Task/Burrows-Wheeler-transform/Ksh/burrows-wheeler-transform.ksh @@ -2,12 +2,12 @@ # Burrows–Wheeler transform -# # Variables: +# # Variables: # export LC_COLLATE=POSIX -STX=\^ # start marker -ETX=\| # end marker +STX=\^ # start marker +ETX=\| # end marker typeset -a str str[0]='BANANA' @@ -17,75 +17,75 @@ str[3]='TO BE OR NOT TO BE OR WANT TO BE OR NOT?' str[4]='SIX.MIXED.PIXIES.SIFT.SIXTY.PIXIE.DUST.BOXES' str[5]='|ABC^' -# # Functions: +# # Functions: # -# # Function _bwt(str, arr, lc) - sort all circular shifts of arr, return last col +# # Function _bwt(str, arr, lc) - sort all circular shifts of arr, return last col # function _bwt { - typeset _str ; _str="$1" - typeset _arr ; nameref _arr="$2" - typeset _lastcol ; nameref _lastcol="$3" - typeset _i _j _newstr ; integer _i _j + typeset _str ; _str="$1" + typeset _arr ; nameref _arr="$2" + typeset _lastcol ; nameref _lastcol="$3" + typeset _i _j _newstr ; integer _i _j - [[ ${_str} == *+("$STX"|"$ETX")* ]] && return 1 - - _str="$STX${_str}$ETX" - for ((_i=0; _i<${#_str}; _i++)); do - _newstr=${_str:${#_str}-1:1} - for ((_j=0; _j<${#_str}-1; _j++)); do - _newstr+=${_str:${_j}:1} - done - _arr+=( "${_newstr}" ) - _str="${_newstr}" - done + [[ ${_str} == *+("$STX"|"$ETX")* ]] && return 1 - set -sA arr # Sort arr + _str="$STX${_str}$ETX" + for ((_i=0; _i<${#_str}; _i++)); do + _newstr=${_str:${#_str}-1:1} + for ((_j=0; _j<${#_str}-1; _j++)); do + _newstr+=${_str:${_j}:1} + done + _arr+=( "${_newstr}" ) + _str="${_newstr}" + done - for ((_i=0; _i<${#_arr[*]}; _i++)); do - _lastcol+=${_arr[_i]:${#_arr[_i]}-1:1} - done + set -sA arr # Sort arr + + for ((_i=0; _i<${#_arr[*]}; _i++)); do + _lastcol+=${_arr[_i]:${#_arr[_i]}-1:1} + done } -# # Function _ibwt(str) - inverse bwt +# # Function _ibwt(str) - inverse bwt # function _ibwt { - typeset _str ; _str="$1" - typeset _arr _vec _ret _i ; typeset -a _arr _vec ; integer _i + typeset _str ; _str="$1" + typeset _arr _vec _ret _i ; typeset -a _arr _vec ; integer _i - _intovec "${_str}" _vec - for ((_i=1; _i<${#_str}; _i++)); do - _intoarr _vec _arr - set -sA _arr - done + _intovec "${_str}" _vec + for ((_i=1; _i<${#_str}; _i++)); do + _intoarr _vec _arr + set -sA _arr + done - for ((_i=0; _i<${#arr[*]}; _i++)); do - [[ "${arr[_i]}" == ${STX}*${ETX} ]] && echo "${arr[_i]}" && return - done + for ((_i=0; _i<${#arr[*]}; _i++)); do + [[ "${arr[_i]}" == ${STX}*${ETX} ]] && echo "${arr[_i]}" && return + done } -# # Function _intovec(str, vec) - trans str into vec[] +# # Function _intovec(str, vec) - trans str into vec[] # function _intovec { - typeset _str ; _str="$1" - typeset _vec ; nameref _vec="$2" - typeset _i ; integer _i + typeset _str ; _str="$1" + typeset _vec ; nameref _vec="$2" + typeset _i ; integer _i - for ((_i=0; _i<${#_str}; _i++)); do - _vec+=( "${_str:${_i}:1}" ) - done + for ((_i=0; _i<${#_str}; _i++)); do + _vec+=( "${_str:${_i}:1}" ) + done } -# # Function _intoarr(i, vec, arr) - insert vec into arr +# # Function _intoarr(i, vec, arr) - insert vec into arr # function _intoarr { - typeset _vec ; nameref _vec="$1" - typeset _arr ; nameref _arr="$2" - typeset _j ; integer _j + typeset _vec ; nameref _vec="$1" + typeset _arr ; nameref _arr="$2" + typeset _j ; integer _j - for ((_j=0; _j<${#_vec[*]}; _j++)); do - _arr="${_vec[_j]}${_arr[_j]}" - done + for ((_j=0; _j<${#_vec[*]}; _j++)); do + _arr="${_vec[_j]}${_arr[_j]}" + done } ###### @@ -93,14 +93,14 @@ function _intoarr { ###### for ((i=0; i<${#str[*]}; i++)); do - unset arr lastcol result ; typeset -a arr + unset arr lastcol result ; typeset -a arr - print -- "${str[i]}" - _bwt "${str[i]}" arr lastcol - (( $? )) && print "ERROR: string cannot contain $STX or $ETX" && continue + print -- "${str[i]}" + _bwt "${str[i]}" arr lastcol + (( $? )) && print "ERROR: string cannot contain $STX or $ETX" && continue - print -- "${lastcol}" - result=$(_ibwt "${lastcol}") - print -- "${result}" - echo + print -- "${lastcol}" + result=$(_ibwt "${lastcol}") + print -- "${result}" + echo done diff --git a/Task/Burrows-Wheeler-transform/Phix/burrows-wheeler-transform.phix b/Task/Burrows-Wheeler-transform/Phix/burrows-wheeler-transform.phix index 24245c2262..cd5ab9b110 100644 --- a/Task/Burrows-Wheeler-transform/Phix/burrows-wheeler-transform.phix +++ b/Task/Burrows-Wheeler-transform/Phix/burrows-wheeler-transform.phix @@ -1,147 +1,145 @@ -(phixonline)--> - -- demo\rosetta\burrows_wheeler.exw - --/* - The traditional method: +-- demo\rosetta\burrows_wheeler.exw +--/* +The traditional method: - 7 banana$ $banana 6 - 6 $banana ===> a$banan 5 - 5 a$banan ana$ban 3 - 4 na$bana sort anana$b 1 - 3 ana$ban banana$ 7 - 2 nana$ba ===> na$bana 4 - 1 anana$b nana$ba 2 - ^ desired answer == "annb$aa" + 7 banana$ $banana 6 + 6 $banana ===> a$banan 5 + 5 a$banan ana$ban 3 + 4 na$bana sort anana$b 1 + 3 ana$ban banana$ 7 + 2 nana$ba ===> na$bana 4 + 1 anana$b nana$ba 2 + ^ desired answer == "annb$aa" - First ignore the numbers: the desired answer is found by creating a table of all - rotations of "banana$", sorting it, and then extracting the right-hand column. +First ignore the numbers: the desired answer is found by creating a table of all +rotations of "banana$", sorting it, and then extracting the right-hand column. - However, there is no need to actually create such a table, which could be very - expensive for long strings, instead just number them logically (admittedly that - was somewhat arbitrarily chosen to get the indexes to work out nicely, I picked - the original index of the last character), and perform a custom sort on those. +However, there is no need to actually create such a table, which could be very +expensive for long strings, instead just number them logically (admittedly that +was somewhat arbitrarily chosen to get the indexes to work out nicely, I picked +the original index of the last character), and perform a custom sort on those. - The latter effectively just recreates the rotations one character at a time until - there is a mismatch (which there always will be since there is only one $). - The left hand column is my arbitrary numbering scheme and the right hand column - is those sorted into order, which is also the indexes to the original string of - the characters that we want. +The latter effectively just recreates the rotations one character at a time until +there is a mismatch (which there always will be since there is only one $). +The left hand column is my arbitrary numbering scheme and the right hand column +is those sorted into order, which is also the indexes to the original string of +the characters that we want. - The code below uses $ as the terminator, but eg 1 (== '\#01') should be fine, - except of course for the display of that on a console. - --*/ - with javascript_semantics - constant terminator = '$' +The code below uses $ as the terminator, but eg 1 (== '\#01') should be fine, +except of course for the display of that on a console. +--*/ +with javascript_semantics +constant terminator = '$' - function rot_sort(integer i,j, sequence s) - -- i,j are indexes of the last character, so bump before first compare. - -- eg/ie rot_sort(i,j,s) should yield compare(rotate(s,i),rotate(s,j)), - -- as in rot_sort(7,6,"banana$") == compare("banana$","$banana") - -- - but one character at a time rather than constructing both. - integer l = length(s) - while true do - i = mod(i,l)+1 - j = mod(j,l)+1 - integer c = compare(s[i],s[j]) - if c!=0 then return c end if - end while - end function +function rot_sort(integer i,j, sequence s) +-- i,j are indexes of the last character, so bump before first compare. +-- eg/ie rot_sort(i,j,s) should yield compare(rotate(s,i),rotate(s,j)), +-- as in rot_sort(7,6,"banana$") == compare("banana$","$banana") +-- - but one character at a time rather than constructing both. + integer l = length(s) + while true do + i = mod(i,l)+1 + j = mod(j,l)+1 + integer c = compare(s[i],s[j]) + if c!=0 then return c end if + end while +end function - function burrows_wheeler_transform(string s) - if find(terminator,s) then return "error" end if - s &= terminator - integer l = length(s) - sequence t = custom_sort(routine_id("rot_sort"),tagset(l),{s}) - string res = repeat(' ',l) - for i=1 to l do - res[i] = s[t[i]] - end for - return res - end function +function burrows_wheeler_transform(string s) + if find(terminator,s) then return "error" end if + s &= terminator + integer l = length(s) + sequence t = custom_sort(routine_id("rot_sort"),tagset(l),{s}) + string res = repeat(' ',l) + for i=1 to l do + res[i] = s[t[i]] + end for + return res +end function - --/* - Inversion. The traditional method is add column and sort, seven times, - to reconstruct the table above, then pick the entry that ends with the - marker. Showing that technique in full detail here is not helpful, and - like above that would be hideously inefficient for large strings. +--/* +Inversion. The traditional method is add column and sort, seven times, +to reconstruct the table above, then pick the entry that ends with the +marker. Showing that technique in full detail here is not helpful, and +like above that would be hideously inefficient for large strings. - $banana 1 $ (1 ) a 2 - a$banan 2 a ( 1) n 6 - ana$ban 3 a ( 2) n 7 - anana$b 4 a ( 3) b 5 - banana$ 5 b $ 1 - na$bana 6 n (2 ) a 3 - nana$ba 7 n (3 ) a 4 - ^ ^ ^ ^ ^ - f l f l t + $banana 1 $ (1 ) a 2 + a$banan 2 a ( 1) n 6 + ana$ban 3 a ( 2) n 7 + anana$b 4 a ( 3) b 5 + banana$ 5 b $ 1 + na$bana 6 n (2 ) a 3 + nana$ba 7 n (3 ) a 4 + ^ ^ ^ ^ ^ + f l f l t - However, we already have the last column, and the first is just that - sorted alphabetically, and with just those two, we have all possible - character pairings of the original message. The trick is in figuring - out how to stitch them together in the right order. If you carefully - study the three that end in a, and the three that start in a, notice - the $banan,na$ban,nana$b parts are sorted in the same order, whether - they are prefixed with a or not. That is, the middle (parenthesised) - matching numbers are both 123, not 123 and say 231. It is quite hard - to see that being useful, but eventually the penny should drop. The - right-hand 1 with an a rotated right gives the left-hand 1, and the - same goes for 2 and 3: they are in fact links to the prior pairing. +However, we already have the last column, and the first is just that +sorted alphabetically, and with just those two, we have all possible +character pairings of the original message. The trick is in figuring +out how to stitch them together in the right order. If you carefully +study the three that end in a, and the three that start in a, notice +the $banan,na$ban,nana$b parts are sorted in the same order, whether +they are prefixed with a or not. That is, the middle (parenthesised) +matching numbers are both 123, not 123 and say 231. It is quite hard +to see that being useful, but eventually the penny should drop. The +right-hand 1 with an a rotated right gives the left-hand 1, and the +same goes for 2 and 3: they are in fact links to the prior pairing. - In other words the first a in l always corresponds to the first in f, - the second to the second, and so on, and that (amazingly) forms the - order in which the pairings need to be daisy-chained together. +In other words the first a in l always corresponds to the first in f, +the second to the second, and so on, and that (amazingly) forms the +order in which the pairings need to be daisy-chained together. - Try following (1->)2a->6n->3a->7n->4a->5b->$, == reverse("banana"), - in the above f and t tables. +Try following (1->)2a->6n->3a->7n->4a->5b->$, == reverse("banana"), +in the above f and t tables. - The code below builds a queue of 'a' ({1,6,7}, built backwards) then - we pop {2,3,4} into those slots in t as we find 'a' in f, likewise - for all other letters, forming the links for each pairing as shown. - See the trivial step 3 scan below, then go back and stare at f and - t as shown above, and once again, eventually the penny should drop. - I will admit I had to read ten or so explanations before I got it. - --*/ +The code below builds a queue of 'a' ({1,6,7}, built backwards) then +we pop {2,3,4} into those slots in t as we find 'a' in f, likewise +for all other letters, forming the links for each pairing as shown. +See the trivial step 3 scan below, then go back and stare at f and +t as shown above, and once again, eventually the penny should drop. +I will admit I had to read ten or so explanations before I got it. +--*/ - function inverse_burrows_wheeler(string s) - if find('\0',s) then ?9/0 end if -- (doable, but needs some +1s) - integer l = length(s), c - string f = sort(s) - sequence q = repeat(0,256), -- queue heads (per char) - x = repeat(0,l), -- queue links - t = repeat(0,l) -- reformed/pairing links - -- Step 1. discover/build queues (backwards) - for i=l to 1 by -1 do - c = s[i] - x[i] = q[c] - q[c] = i - end for - -- Step 2. reform/pop char queues into pairing links - for i=1 to l do - c = f[i] - t[q[c]] = i - q[c] = x[q[c]] - end for - -- Step 3. rebuild (backwards) - c = find(terminator,f) - if c=0 then return "error" end if - string res = repeat(' ',l-1) - for i=l-1 to 1 by -1 do - c = t[c] -- (first time in, skip the end marker) - res[i] = f[c] - end for - return res - end function +function inverse_burrows_wheeler(string s) + if find('\0',s) then ?9/0 end if -- (doable, but needs some +1s) + integer l = length(s), c + string f = sort(s) + sequence q = repeat(0,256), -- queue heads (per char) + x = repeat(0,l), -- queue links + t = repeat(0,l) -- reformed/pairing links + -- Step 1. discover/build queues (backwards) + for i=l to 1 by -1 do + c = s[i] + x[i] = q[c] + q[c] = i + end for + -- Step 2. reform/pop char queues into pairing links + for i=1 to l do + c = f[i] + t[q[c]] = i + q[c] = x[q[c]] + end for + -- Step 3. rebuild (backwards) + c = find(terminator,f) + if c=0 then return "error" end if + string res = repeat(' ',l-1) + for i=l-1 to 1 by -1 do + c = t[c] -- (first time in, skip the end marker) + res[i] = f[c] + end for + return res +end function - procedure test(string src) - string enc = burrows_wheeler_transform(src), - dec = inverse_burrows_wheeler(enc) - src = shorten(src,"characters") - enc = shorten(enc,"characters") - dec = shorten(dec,"characters") - printf(1,"original: %s --> %s\n inverse: %s\n",{src,enc,dec}) - end procedure +procedure test(string src) +string enc = burrows_wheeler_transform(src), + dec = inverse_burrows_wheeler(enc) + src = shorten(src,"characters") + enc = shorten(enc,"characters") + dec = shorten(dec,"characters") + printf(1,"original: %s --> %s\n inverse: %s\n",{src,enc,dec}) +end procedure - test("banana") - test("dogwood") - test("TO BE OR NOT TO BE OR WANT TO BE OR NOT?") - test("SIX.MIXED.PIXIES.SIFT.SIXTY.PIXIE.DUST.BOXES") - ") + local t = bwt(test) + if !t then + print("ERROR: String can't contain STX or ETX") + t = "" + else + print(make_printable(t)) + end + local r = ibwt(t) + print($" --> {r}\n") +end diff --git a/Task/Burrows-Wheeler-transform/Rebol/burrows-wheeler-transform.rebol b/Task/Burrows-Wheeler-transform/Rebol/burrows-wheeler-transform.rebol new file mode 100644 index 0000000000..c9d62158d6 --- /dev/null +++ b/Task/Burrows-Wheeler-transform/Rebol/burrows-wheeler-transform.rebol @@ -0,0 +1,80 @@ +Rebol [ + title: "Rosetta code: Burrows–Wheeler transform" + file: %Burrows–Wheeler_transform.r3 + url: https://rosettacode.org/wiki/Burrows–Wheeler_transform +] + +bwt: function [ + "Burrows–Wheeler Transform" + input [string!] "The original text to encode" +][ + ;; Add sentinel markers: + ;; STX (^(02)) at the front to mark the start + ;; ETX (^(03)) at the end to mark the terminus + ;; These ensure unambiguous reconstruction and a fixed sort position. + input: rejoin [#"^(02)" input #"^(03)"] + len: length? input ;; Length of the sentinel-marked string + rotations: clear [] ;; Will hold all cyclic rotations of the string + ;; Generate all cyclic rotations: + repeat i len [ + append rotations rejoin [ + copy at input i ;; from position i to end + copy/part input i - 1 ;; then from start up to (i-1) + ] + ] + ;; Sort all rotations lexicographically + rotations: sort rotations + transformed: copy "" ;; This will be the BWT output (last column) + ;; Take the last character from each sorted rotation and accumulate + foreach r rotations [ + append transformed last r + ] + ;; Return the "last column" as the BWT-transformed string + transformed +] + + +ibwt: function [ + "Inverse Burrows–Wheeler Transform" + input [string!] "The BWT-produced last column string" +][ + ;; Make a copy so we preserve the original argument + input: copy input + len: length? input ;; Number of rows/characters + ;; Initialise a table (block of strings), initially containing `len` empty strings + table: make block! len + loop len [append table copy ""] + ;; Rebuild rotation table iteratively: + ;; Each iteration: + ;; 1. Prepend each character of last column to corresponding row + ;; 2. Sort the rows + repeat j len [ + repeat i len [ + insert table/:i input/:i ;; insert char from last column at row start + ] + table: sort table ;; keep table lexicographically sorted + ] + ;; After len iterations, table contains all sorted rotations. + ;; The original rotation is the one starting with STX and ending with ETX. + ;; With STX as the smallest char, it will always be the first row (table/1). + if table/1/1 == #"^(02)" [ + ;; Skip STX, copy the rest minus ETX. + ;; `next table/1` skips first char (STX) + ;; `len - 2` excludes both sentinels + copy/part next table/1 len - 2 + ] +] + +; Example usage +foreach text [ + "banana" + "appellee" + "abracadabra" + "TO BE OR NOT TO BE OR WANT TO BE OR NOT?" + "SIX.MIXED.PIXIES.SIFT.SIXTY.PIXIE.DUST.BOXES" +][ + print ["Original text: " mold text] + print ["After transformation: " mold a: bwt text] + print ["After inverse transformation:" mold b: ibwt a lf] + assert [b == text] +] diff --git a/Task/Burrows-Wheeler-transform/Rust/burrows-wheeler-transform.rust b/Task/Burrows-Wheeler-transform/Rust/burrows-wheeler-transform.rs similarity index 100% rename from Task/Burrows-Wheeler-transform/Rust/burrows-wheeler-transform.rust rename to Task/Burrows-Wheeler-transform/Rust/burrows-wheeler-transform.rs diff --git a/Task/Burrows-Wheeler-transform/Sidef/burrows-wheeler-transform.sidef b/Task/Burrows-Wheeler-transform/Sidef/burrows-wheeler-transform-1.sidef similarity index 100% rename from Task/Burrows-Wheeler-transform/Sidef/burrows-wheeler-transform.sidef rename to Task/Burrows-Wheeler-transform/Sidef/burrows-wheeler-transform-1.sidef diff --git a/Task/Burrows-Wheeler-transform/Sidef/burrows-wheeler-transform-2.sidef b/Task/Burrows-Wheeler-transform/Sidef/burrows-wheeler-transform-2.sidef new file mode 100644 index 0000000000..e5772e985e --- /dev/null +++ b/Task/Burrows-Wheeler-transform/Sidef/burrows-wheeler-transform-2.sidef @@ -0,0 +1,62 @@ +define LOOKAHEAD_LEN = 128 + +func bwt_sort (String s) { # O(n * LOOKAHEAD_LEN) space (fast) + ^s.len -> map {|i| + var t = s.slice(i, LOOKAHEAD_LEN) + + if (t.len < LOOKAHEAD_LEN) { + t += s.slice(0, min(i, LOOKAHEAD_LEN - t.len)) + } + + [t, i] + }.sort {|a,b| + (a[0] <=> b[0]) || (s.rotate(a[1]) <=> s.rotate(b[1])) + }.map { .[1] } +} + +func bwt_encode(String s) { + + var bwt = bwt_sort(s) + var ret = bwt.map {|i| s.slice(i-1, 1) }.join + var idx = bwt.first_index_by { .is_zero } + + return (ret, idx) +} + +func bwt_decode(String bwt, Number idx) { # fast inversion + + var tail = bwt.chars + var head = tail.sort + + var indices = Hash() + tail.each_kv {|i,v| + indices{v} := [] << i + } + + var table = [] + head.each_kv {|i,v| + table[i] = indices{v}.shift + } + + var dec = '' + var i = idx + + head.len.times { + dec += head[i] + i = table[i] + } + + return dec +} + +var tests = [ + "banana", "appellee", "dogwood", "TOBEORNOTTOBEORTOBEORNOT" + "SIX.MIXED.PIXIES.SIFT.SIXTY.PIXIE.DUST.BOXES", +] + +tests.each { |str| + var (enc, idx) = bwt_encode(str) + var dec = bwt_decode(enc, idx) + say "BWT(#{dec.dump}) = (#{enc.dump}, #{idx})" + assert_eq(str, dec) +} diff --git a/Task/Burrows-Wheeler-transform/Uiua/burrows-wheeler-transform.uiua b/Task/Burrows-Wheeler-transform/Uiua/burrows-wheeler-transform.uiua new file mode 100644 index 0000000000..e3b6984a28 --- /dev/null +++ b/Task/Burrows-Wheeler-transform/Uiua/burrows-wheeler-transform.uiua @@ -0,0 +1,5 @@ +# Apply Burrows–Wheeler transform + +Bwt ← ⌅(⊣⍉⍆≡⌟↻⇡⊸⧻$"\x02_\x03"|↘₁↘₋₁⊢⊙◌⍥(⍆⊸≡˜⊂)⤙˜↯""⊸⧻) +{"banana" "appellee" "abracadabra" "Unusual Uiua"} +≡(&p$"_ > _ > _"⊸°Bwt⊸Bwt) diff --git a/Task/Burrows-Wheeler-transform/V-(Vlang)/burrows-wheeler-transform.v b/Task/Burrows-Wheeler-transform/V-(Vlang)/burrows-wheeler-transform.v new file mode 100644 index 0000000000..cc21976c5e --- /dev/null +++ b/Task/Burrows-Wheeler-transform/V-(Vlang)/burrows-wheeler-transform.v @@ -0,0 +1,65 @@ +const tests = [ + "banana", + "appellee", + "dogwood", + "TO BE OR NOT TO BE OR WANT TO BE OR NOT?", + "SIX.MIXED.PIXIES.SIFT.SIXTY.PIXIE.DUST.BOXES", + "\x02ABC\x03" +] + +struct BWT { + mut: + stx string = "\x02" + etx string = "\x03" +} + +fn (bwt BWT) bwt(sg string) !string { + if sg.contains(bwt.stx) || sg.contains(bwt.etx) { + return error("FormatException: String cannot contain STX or ETX") + } + ss := bwt.stx + sg + bwt.etx + mut table := []string{} + for ial in 0 .. ss.len { + before := ss[ial..] + after := ss[..ial] + table << before + after + } + table.sort() + return table.map(it[it.len - 1].ascii_str()).join("") +} + +fn (bwt BWT) ibwt(r string) string { + len := r.len + mut table := []string{len: len, init: ""} + for _ in 0 .. len { + for ial in 0 .. len { + table[ial] = r[ial].ascii_str() + table[ial] + } + table.sort() + } + for row in table { + if row.ends_with(bwt.etx) { return row[1..len - 1] } + } + return "" +} + +fn (bwt BWT) make_printable(sg string) string { + return sg.replace(bwt.stx, "^").replace(bwt.etx, "|") +} + +fn main() { + mut bwt_inst := BWT{} + mut tsg := "" + for idx, test in tests { + println(bwt_inst.make_printable(test)) + print(" --> ") + tsg = bwt_inst.bwt(test) or { + println("ERROR: {$err}") + tsg = "" + continue + } + println(bwt_inst.make_printable(tsg)) + rsg := bwt_inst.ibwt(tsg) + if idx < tests.len { println(" --> $rsg\n") } else { println(" --> $rsg") } + } +} diff --git a/Task/Burrows-Wheeler-transform/Wren/burrows-wheeler-transform.wren b/Task/Burrows-Wheeler-transform/Wren/burrows-wheeler-transform.wren index a7bd08211e..87fa55f8dd 100644 --- a/Task/Burrows-Wheeler-transform/Wren/burrows-wheeler-transform.wren +++ b/Task/Burrows-Wheeler-transform/Wren/burrows-wheeler-transform.wren @@ -1,4 +1,4 @@ -import "/sort" for Sort +import "./sort" for Sort var stx = "\x02" var etx = "\x03" diff --git a/Task/Burrows-Wheeler-transform/Zkl/burrows-wheeler-transform-1.zkl b/Task/Burrows-Wheeler-transform/Zkl/burrows-wheeler-transform-1.zkl index c99add158b..cc528094ee 100644 --- a/Task/Burrows-Wheeler-transform/Zkl/burrows-wheeler-transform-1.zkl +++ b/Task/Burrows-Wheeler-transform/Zkl/burrows-wheeler-transform-1.zkl @@ -4,13 +4,13 @@ class BurrowsWheelerTransform{ _assert_(not str.holds(special), "String cannot contain char \"%s\"".fmt(special) ); str=str.append(special); str.len().pump(List().merge,'wrap(n){ String(str[n,*],str[0,n]) }) - .pump(String,T("get",-1)); // last char of each "permutation" + .pump(String,T("get",-1)); // last char of each "permutation" } fcn decode(str){ - table:=List.createLong(str.len(),""); // ("",""..), mutable + table:=List.createLong(str.len(),""); // ("",""..), mutable do(str.len()){ - foreach n in (str.len()){ table[n]=str[n] + table[n] } - table.sort(); + foreach n in (str.len()){ table[n]=str[n] + table[n] } + table.sort(); } // --> ("$dogwood","d$dogwoo","dogwood$",...) table.filter1("%s*".fmt(special).glob)[1,*]; // str[0]==$, often first element } diff --git a/Task/CRC-32/11l/crc-32.11l b/Task/CRC-32/11l/crc-32.11l index 080f37f5a0..62304e3579 100644 --- a/Task/CRC-32/11l/crc-32.11l +++ b/Task/CRC-32/11l/crc-32.11l @@ -1,5 +1,5 @@ V crc_table = [0] * 256 -L(i) 256 +L(i) 0.<256 UInt32 rem = i L 8 I rem [&] 1 != 0 @@ -10,9 +10,9 @@ L(i) 256 crc_table[i] = rem F crc32(buf, =crc = UInt32(0)) - crc = (-)crc + crc = ~crc L(k) buf crc = (crc >> 8) (+) :crc_table[(crc [&] F'F) (+) k.code] - R (-)crc + R ~crc print(hex(crc32(‘The quick brown fox jumps over the lazy dog’))) diff --git a/Task/CRC-32/ALGOL-68/crc-32.alg b/Task/CRC-32/ALGOL-68/crc-32.alg index 6e949b4d94..3020332f39 100644 --- a/Task/CRC-32/ALGOL-68/crc-32.alg +++ b/Task/CRC-32/ALGOL-68/crc-32.alg @@ -32,7 +32,7 @@ PROC update_crc = (BITS crc, STRING buf) BITS: PROC hex = (BITS x) STRING : BEGIN - PROC hexdig = (BITS x) CHAR: REPR (IF ABS x ≤ 9 THEN ABS x + ABS "0" + PROC hexdig = (BITS x) CHAR: REPR (IF ABS x <= 9 THEN ABS x + ABS "0" ELSE ABS x - 10 + ABS "a" FI); STRING h := ""; @@ -40,7 +40,7 @@ PROC update_crc = (BITS crc, STRING buf) BITS: h := "0" ELSE BITS n := x; - WHILE h := hexdig (n AND 16rf) + h; n ≠ 16r0 DO + WHILE h := hexdig (n AND 16rf) + h; n /= 16r0 DO n := n SHR 4 OD FI; diff --git a/Task/CRC-32/Ada/crc-32.ada b/Task/CRC-32/Ada/crc-32.adb similarity index 100% rename from Task/CRC-32/Ada/crc-32.ada rename to Task/CRC-32/Ada/crc-32.adb diff --git a/Task/CRC-32/Bait/crc-32.bait b/Task/CRC-32/Bait/crc-32.bait new file mode 100644 index 0000000000..5371a32855 --- /dev/null +++ b/Task/CRC-32/Bait/crc-32.bait @@ -0,0 +1,7 @@ +import hash.crc32 + +fun main() { + text := 'The quick brown fox jumps over the lazy dog' + sum := crc32.checksum(text.bytes()) + println(sum.hex()) +} diff --git a/Task/CRC-32/COBOL/crc-32.cobol b/Task/CRC-32/COBOL/crc-32.cob similarity index 100% rename from Task/CRC-32/COBOL/crc-32.cobol rename to Task/CRC-32/COBOL/crc-32.cob diff --git a/Task/CRC-32/Crystal/crc-32.crystal b/Task/CRC-32/Crystal/crc-32.cr similarity index 100% rename from Task/CRC-32/Crystal/crc-32.crystal rename to Task/CRC-32/Crystal/crc-32.cr diff --git a/Task/CRC-32/Delphi/crc-32.delphi b/Task/CRC-32/Delphi/crc-32.pas similarity index 100% rename from Task/CRC-32/Delphi/crc-32.delphi rename to Task/CRC-32/Delphi/crc-32.pas diff --git a/Task/CRC-32/EasyLang/crc-32.easy b/Task/CRC-32/EasyLang/crc-32.easy new file mode 100644 index 0000000000..35d2803aa5 --- /dev/null +++ b/Task/CRC-32/EasyLang/crc-32.easy @@ -0,0 +1,25 @@ +global table[] . +proc mktable . + for i = 0 to 0xff + rem = i + for j to 8 + if bitand rem 1 = 1 + rem = bitxor bitshift rem -1 0xedb88320 + else + rem = bitshift rem -1 + . + . + table[] &= rem + . +. +func crc32 s$ . + crc = 0xffffffff + for c$ in strchars s$ + c = strcode c$ + crb = bitxor bitand crc 0xff c + crc = bitxor (bitshift crc -8) table[crb + 1] + . + return bitand bitnot crc 0xffffffff +. +mktable +print crc32 "The quick brown fox jumps over the lazy dog" diff --git a/Task/CRC-32/Elixir/crc-32.elixir b/Task/CRC-32/Elixir/crc-32.ex similarity index 100% rename from Task/CRC-32/Elixir/crc-32.elixir rename to Task/CRC-32/Elixir/crc-32.ex diff --git a/Task/CRC-32/FutureBasic/crc-32.basic b/Task/CRC-32/FutureBasic/crc-32.basic new file mode 100644 index 0000000000..3ca9fab1e9 --- /dev/null +++ b/Task/CRC-32/FutureBasic/crc-32.basic @@ -0,0 +1,46 @@ +// +// CRC_32 Checksum +// +// FutureBasic 7.0.34, August 2025 R.W +//---------------------------------------------- + +// Get CRC_32 checksum from a CFstring +// using the standard bits reversed 0x04C11DB7 + +// Verified accuracy using the site +// https://codeshack.io/crc32-checksum-generator/ + +local fn getCRC_32 (textStr As CFStringRef) As UInt32 + UInt32 i, j, crc, byte + crc = 0xFFFFFFFF + + for i = 0 to len(textStr) -1 + byte = ucc(textStr, i) + crc = crc XOR byte + for j = 0 to 7 + if ( crc AND 1 ) + crc = (crc >> 1) XOR 0xEDB88320 + else + crc = crc >> 1 + end if + next + next + crc = crc XOR 0xFFFFFFFF +end fn = crc + + +window 1,@"CRC checksum" + +CFStringRef testString +testString = @"The quick brown fox jumps over the lazy dog" + +UInt32 checksum +checksum = fn getCRC_32(testString) + +print +print @" ";testString +print @" has a checksum of ";hex(checksum) + +handleEvents + +// diff --git a/Task/CRC-32/Haxe/crc-32.haxe b/Task/CRC-32/Haxe/crc-32.hx similarity index 100% rename from Task/CRC-32/Haxe/crc-32.haxe rename to Task/CRC-32/Haxe/crc-32.hx diff --git a/Task/CRC-32/Jq/crc-32-1.jq b/Task/CRC-32/Jq/crc-32-1.jq new file mode 100644 index 0000000000..38abfc0ed9 --- /dev/null +++ b/Task/CRC-32/Jq/crc-32-1.jq @@ -0,0 +1,2 @@ +def div($j): + ((. - (. % $j)) / $j) | round; diff --git a/Task/CRC-32/Jq/crc-32-2.jq b/Task/CRC-32/Jq/crc-32-2.jq new file mode 100644 index 0000000000..20a741ca65 --- /dev/null +++ b/Task/CRC-32/Jq/crc-32-2.jq @@ -0,0 +1,34 @@ +include "bitwise" {search: "."}; # see above + +# non-negative decimal integer to hex string +def hex: + def stream: + recurse(if . >= 16 then ./16|floor else empty end) | . % 16 ; + [stream] | reverse + | map(if . < 10 then 48 + . else . + 87 end) | implode ; + +### CRC-32 + +def crc32Table: + reduce range(0; 256) as $i ([]; + . + [reduce range(0; 8) as $j ($i; + if bitwise_and(.;1) == 1 + then bitwise_xor(rightshift(1); 3988292384) # 0xedb88320 + else rightshift( 1 ) + end) ] ); + +# Input: an ASCII string +# Output: its CRC-32 +def crc32: + explode as $s + | crc32Table as $table + | reduce range(0; $s|length) as $i (4294967295 ; # ~0 + # 0xff is 255 + bitwise_and(.; 255 ) as $crb + | bitwise_xor( $table[bitwise_xor($crb; $s[$i])] ; rightshift(8)) ) + | flip(32) ; + +def task: + crc32 | hex; + +"The quick brown fox jumps over the lazy dog" | task diff --git a/Task/CRC-32/Julia/crc-32-1.julia b/Task/CRC-32/Julia/crc-32-1.jl similarity index 100% rename from Task/CRC-32/Julia/crc-32-1.julia rename to Task/CRC-32/Julia/crc-32-1.jl diff --git a/Task/CRC-32/Julia/crc-32-2.jl b/Task/CRC-32/Julia/crc-32-2.jl new file mode 100644 index 0000000000..0c99a75649 --- /dev/null +++ b/Task/CRC-32/Julia/crc-32-2.jl @@ -0,0 +1,31 @@ +function crc32(crc::Int, str::String) + table = zeros(UInt32, 256) + + for i in 0:255 + tmp = i + for j in 0:7 + if tmp & 1 == 1 + tmp >>= 1 + tmp ⊻= 0xedb88320 + else + tmp >>= 1 + end + end + + table[i+1] = tmp + end + + crc ⊻= 0xffffffff + + for i in UInt32.(collect(str)) + crc = (crc >> 8) ⊻ table[(crc&0xff)⊻i+1] + end + + crc ⊻ 0xffffffff +end + +str = "The quick brown fox jumps over the lazy dog" +crc = crc32(0, str) +@assert(crc == 0x414fa339) +println("Message: ", str) +println("Checksum: ", string(crc, base = 16)) diff --git a/Task/CRC-32/Julia/crc-32-2.julia b/Task/CRC-32/Julia/crc-32-2.julia deleted file mode 100644 index fb6e0e6953..0000000000 --- a/Task/CRC-32/Julia/crc-32-2.julia +++ /dev/null @@ -1,31 +0,0 @@ -function crc32(crc::Int, str::String) - table = zeros(UInt32, 256) - - for i in 0:255 - tmp = i - for j in 0:7 - if tmp & 1 == 1 - tmp >>= 1 - tmp ⊻= 0xedb88320 - else - tmp >>= 1 - end - end - - table[i + 1] = tmp - end - - crc ⊻= 0xffffffff - - for i in UInt32.(collect(str)) - crc = (crc >> 8) ⊻ table[(crc & 0xff) ⊻ i + 1] - end - - crc ⊻ 0xffffffff -end - -str = "The quick brown fox jumps over the lazy dog" -crc = crc32(0, str) -assert(crc == 0x414fa339) -println("Message: ", str) -println("Checksum: ", hex(crc)) diff --git a/Task/CRC-32/Kotlin/crc-32.kotlin b/Task/CRC-32/Kotlin/crc-32.kts similarity index 100% rename from Task/CRC-32/Kotlin/crc-32.kotlin rename to Task/CRC-32/Kotlin/crc-32.kts diff --git a/Task/CRC-32/M2000-Interpreter/crc-32-1.m2000 b/Task/CRC-32/M2000-Interpreter/crc-32-1.m2000 index 52eb55078b..c6073ef05e 100644 --- a/Task/CRC-32/M2000-Interpreter/crc-32-1.m2000 +++ b/Task/CRC-32/M2000-Interpreter/crc-32-1.m2000 @@ -1,25 +1,30 @@ -Module CheckIt { - Function PrepareTable { - Dim Base 0, table(256) - For i = 0 To 255 { - k = i - For j = 0 To 7 { - If binary.and(k,1)=1 Then { - k =binary.Xor(binary.shift(k, -1) , 0xEDB88320) - } Else k=binary.shift(k, -1) - } - table(i) = k - } - =table() - } - crctable=PrepareTable() - crc32= lambda crctable (buf$) -> { - crc =0xFFFFFFFF - For i = 0 To Len(buf$) -1 - crc = binary.xor(binary.shift(crc, -8), array(crctable, binary.xor(binary.and(crc, 0xff), asc(mid$(buf$, i+1, 1))))) - Next i - =0xFFFFFFFF-crc - } - Print crc32("The quick brown fox jumps over the lazy dog")=0x414fa339 +odule CheckIt { + crc32 = lambda ->{ + Function PrepareTable { + buffer t as long * 256 + For i = 0 To 255 + k = i + For j = 0 To 7 + If binary.and(k,1)=1 Then + k =binary.Xor(binary.shift(k, -1) , 0xEDB88320) + Else + k=binary.shift(k, -1) + End If + Next + Return t, i:=k + Next + =t + } + = lambda crctable=PrepareTable() (c, buf$) -> { + crc=0xFFFFFFFF-c + For i = 1 To Len(buf$) + crc = binary.xor(binary.shift(crc, -8), eval(crctable, binary.xor(binary.and(crc, 0xff), asc(mid$(buf$, i, 1))))) + Next i + =0xFFFFFFFF-crc + } + }() ' execute now + Print crc32(0, "The quick brown fox jumps over the lazy dog")=0x414fa339& + Print crc32(crc32(0, "The quick brown fox jumps"), " over the lazy dog")=0x414fa339& + Print crc32(crc32(crc32(0, "The qu"), "ick brown"), " fox jumps over the lazy dog")=0x414fa339& } CheckIt diff --git a/Task/CRC-32/OCaml/crc-32.ocaml b/Task/CRC-32/OCaml/crc-32.ml similarity index 100% rename from Task/CRC-32/OCaml/crc-32.ocaml rename to Task/CRC-32/OCaml/crc-32.ml diff --git a/Task/CRC-32/PascalABC.NET/crc-32.pas b/Task/CRC-32/PascalABC.NET/crc-32.pas new file mode 100644 index 0000000000..de5a336f00 --- /dev/null +++ b/Task/CRC-32/PascalABC.NET/crc-32.pas @@ -0,0 +1,29 @@ +type + TCrc32 = array[0..255] of longword; + +function CreateCrcTable(): TCrc32; +begin + for var i: longword := 0 to 255 do + begin + var rem := i; + for var j := 0 to 7 do + if (rem and 1) > 0 then rem := (rem shr 1) xor $edb88320 + else rem := rem shr 1; + result[i] := rem + end; +end; + +const + Crc32Table = CreateCrcTable; + +function Crc32(s: string): longword; +begin + result := $ffffffff; + foreach var c in s do + result := (result shr 8) xor Crc32Table[(result and $ff) xor byte(c)]; + result := not result +end; + +begin + writeln('crc32 = ', crc32('The quick brown fox jumps over the lazy dog').ToString('X')); +end. diff --git a/Task/CRC-32/Pluto/crc-32.pluto b/Task/CRC-32/Pluto/crc-32.pluto new file mode 100644 index 0000000000..310616ad92 --- /dev/null +++ b/Task/CRC-32/Pluto/crc-32.pluto @@ -0,0 +1,5 @@ +local crypto = require "crypto" +local fmt = require "fmt" + +local str = "The quick brown fox jumps over the lazy dog" +print(fmt.hex(crypto.crc32(str))) diff --git a/Task/CRC-32/Python/crc-32-1.py b/Task/CRC-32/Python/crc-32-1.py index 5cc64560d7..ff585a4368 100644 --- a/Task/CRC-32/Python/crc-32-1.py +++ b/Task/CRC-32/Python/crc-32-1.py @@ -1,8 +1,8 @@ >>> s = 'The quick brown fox jumps over the lazy dog' >>> import zlib ->>> hex(zlib.crc32(s)) +>>> hex(zlib.crc32(s.encode())) '0x414fa339' >>> import binascii ->>> hex(binascii.crc32(s)) +>>> hex(binascii.crc32(s.encode())) '0x414fa339' diff --git a/Task/CRC-32/R/crc-32.r b/Task/CRC-32/R/crc-32.r index a8bdc5c253..36236927d7 100644 --- a/Task/CRC-32/R/crc-32.r +++ b/Task/CRC-32/R/crc-32.r @@ -1 +1,2 @@ +library(digest) digest("The quick brown fox jumps over the lazy dog","crc32", serialize=F) diff --git a/Task/CRC-32/Rebol/crc-32.rebol b/Task/CRC-32/Rebol/crc-32.rebol new file mode 100644 index 0000000000..ac677bfc59 --- /dev/null +++ b/Task/CRC-32/Rebol/crc-32.rebol @@ -0,0 +1,4 @@ +sum: checksum "The quick brown fox jumps over the lazy dog" 'crc32 +;== 1095738169 +enbase sum 16 ;; available since 3.19.5 +;== "414FA339" diff --git a/Task/CRC-32/Rust/crc-32.rust b/Task/CRC-32/Rust/crc-32.rs similarity index 100% rename from Task/CRC-32/Rust/crc-32.rust rename to Task/CRC-32/Rust/crc-32.rs diff --git a/Task/CRC-32/Sidef/crc-32.sidef b/Task/CRC-32/Sidef/crc-32.sidef new file mode 100644 index 0000000000..5cd1cdb40c --- /dev/null +++ b/Task/CRC-32/Sidef/crc-32.sidef @@ -0,0 +1,27 @@ +func create_crc32_table { + 256.of {|k| + 8.times { + if (k & 1) { + k >>= 1 + k ^= 0xedb88320 + } + else { + k >>= 1 + } + } + k + } +} + +func crc32(str, crc = 0) { + static crc_table = create_crc32_table() + crc &= 0xffffffff + crc ^= 0xffffffff + str.codes.each {|c| + crc = ((crc >> 8) ^ crc_table[(crc & 0xff) ^ c]) + } + return ((crc & 0xffffffff) ^ 0xffffffff) +} + +say crc32("The quick brown fox jumps over the lazy dog").as_hex +say crc32("over the lazy dog", crc32("The quick brown fox jumps ")).as_hex diff --git a/Task/CRC-32/UNIX-Shell/crc-32-1.sh b/Task/CRC-32/UNIX-Shell/crc-32-1.sh new file mode 100644 index 0000000000..d3f1b53f48 --- /dev/null +++ b/Task/CRC-32/UNIX-Shell/crc-32-1.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +declare -i -a CRC32_LOOKUP_TABLE + +__generate_crc_lookup_table() { + local -i -r LSB_CRC32_POLY=0xEDB88320 # The CRC32 polynomal LSB order + local -i index byte lsb + for index in {0..255}; do + ((byte = 255 - index)) + for _ in {0..7}; do # 8-bit lsb shift + ((lsb = byte & 0x01, byte = ((byte >> 1) & 0x7FFFFFFF) ^ (lsb == 0 ? LSB_CRC32_POLY : 0))) + done + ((CRC32_LOOKUP_TABLE[index] = byte)) + done +} +__generate_crc_lookup_table +typeset -r CRC32_LOOKUP_TABLE + +crc32_string() { + [[ ${#} -eq 1 ]] || return + local -i i byte crc=0xFFFFFFFF index + for ((i = 0; i < ${#1}; i++)); do + byte=$(printf '%d' "'${1:i:1}") # Get byte value of character at i + ((index = (crc ^ byte) & 0xFF, crc = (CRC32_LOOKUP_TABLE[index] ^ (crc >> 8)) & 0xFFFFFFFF)) + done + echo $((crc ^ 0xFFFFFFFF)) +} + +printf 'The CRC32 of: %s\nis: 0x%08x\n' "${1}" "$(crc32_string "${1}")" + +# crc32_string "The quick brown fox jumps over the lazy dog" +# yields 414fa339 diff --git a/Task/CRC-32/UNIX-Shell/crc-32-2.sh b/Task/CRC-32/UNIX-Shell/crc-32-2.sh new file mode 100644 index 0000000000..79918e4f81 --- /dev/null +++ b/Task/CRC-32/UNIX-Shell/crc-32-2.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env sh +# POSIX Shell CRC32 of string +# @Name: crc32.sh +# @Version: 1.0.1 +# @Author: Léa Gris +# @Date: Wed, 27 Mar 2019 +# @License: WTFPL http://www.wtfpl.net/ + +# POSIX Shell has no array or string index +# Implementing a pre-computed CRC32 byte indexed look-up table +# would cost more CPU cycles calling external tools like +# awk or tr to index records from a string. + +# Computes the CRC32 of the input data stream +# <&1: The input data stream +# >&1: The CRC32 integer of the input data stream +crc32_stream() { + crc=0xFFFFFFFF # The Initial CRC32 value + p=0xedb88320 # The CRC32 polynomial + r=0 # The polynomial reminder + c='' # The current character + byte=0 # The byte value of the current character + # Iterates each character of the input stream + while c="$(dd bs=1 count=1 2>/dev/null)" && [ -n "$c" ]; do + byte=$(printf '%d' "'$c") # Converts the character into its byte value + r=$(((crc & 0xff) ^ byte)) # XOR LSB of CRC with current byte + # 8-bit lsb shift with XOR polynomial reminder when odd + for _ in _ _ _ _ _ _ _ _; do + t=$((r >> 1)) + r=$(((r & 1) ? t ^ p : t)) + done + crc=$(((crc >> 8) ^ r)) # XOR MSB of CRC with Reminder + done + + # Output CRC32 integer XOR mask 32 bits + echo $((crc ^ 0xFFFFFFFF)) +} + +# Computes the CRC32 of the argument string +# 1: The argument string +# >&1: The CRC32 integer of the argument string +crc32_string() { + [ $# -eq 1 ] || return # argument required + # Streams with printf to prevent suffixing the string + # with a newline, since echo -n is not available in POSIX Shell + printf '%s' "$1" | crc32_stream +} + +printf 'The CRC32 of: %s\nis: %08x\n' "$1" "$(crc32_string "$1")" + +# crc32_string "The quick brown fox jumps over the lazy dog" +# yields 414fa339 diff --git a/Task/CRC-32/Uiua/crc-32.uiua b/Task/CRC-32/Uiua/crc-32.uiua new file mode 100644 index 0000000000..c43fd20584 --- /dev/null +++ b/Task/CRC-32/Uiua/crc-32.uiua @@ -0,0 +1,8 @@ +String ← "The quick brown fox jumps over the lazy dog" +Key ← ⋕₁₆"1db710640" +InitCRC ← ⋕₁₆"ffffffff" +Xor ← °⋯⬚0≡≠∩⋯ +ShR ← ⍜⋯(⬚0˜↻)⊃⋅∘∘ +Table ← ≡⍥₈(ShR1 ⍥(Xor Key)⊸◿2)⇡256 +⍢(Xor⊃(ShR8|˜⊡Table Xor◿256)⊙°⊂|>0⧻◌) InitCRC -@\0String +°⋕₁₆⍜⋯¬⊙◌ diff --git a/Task/CRC-32/VBScript/crc-32.vb b/Task/CRC-32/VBScript/crc-32.vbs similarity index 100% rename from Task/CRC-32/VBScript/crc-32.vb rename to Task/CRC-32/VBScript/crc-32.vbs diff --git a/Task/CRC-32/Wren/crc-32.wren b/Task/CRC-32/Wren/crc-32.wren index ba28aa8043..74eb19c7db 100644 --- a/Task/CRC-32/Wren/crc-32.wren +++ b/Task/CRC-32/Wren/crc-32.wren @@ -1,4 +1,4 @@ -import "/fmt" for Conv +import "./fmt" for Conv class CRC32 { static init() { diff --git a/Task/CRC-32/Zig/crc-32.zig b/Task/CRC-32/Zig/crc-32.zig index 10a6bf31c1..629dbde918 100644 --- a/Task/CRC-32/Zig/crc-32.zig +++ b/Task/CRC-32/Zig/crc-32.zig @@ -2,6 +2,6 @@ const std = @import("std"); const Crc32Ieee = std.hash.Crc32; pub fn main() !void { - var res: u32 = Crc32Ieee.hash("The quick brown fox jumps over the lazy dog"); + const res: u32 = Crc32Ieee.hash("The quick brown fox jumps over the lazy dog"); std.debug.print("{x}\n", .{res}); } diff --git a/Task/CSV-data-manipulation/00-TASK.txt b/Task/CSV-data-manipulation/00-TASK.txt index 325ca57c4b..f419b925c2 100644 --- a/Task/CSV-data-manipulation/00-TASK.txt +++ b/Task/CSV-data-manipulation/00-TASK.txt @@ -21,5 +21,7 @@ For this task we will use the following CSV file:

  • Show how to add a column, headed 'SUM', of the sums of the rows.
  • If possible, illustrate the use of built-in or standard functions, methods, or libraries, that handle generic CSV files.
+
+;Related tasks: +* [[Convert_CSV_records_to_TSV]]

- diff --git a/Task/CSV-data-manipulation/ALGOL-68/csv-data-manipulation.alg b/Task/CSV-data-manipulation/ALGOL-68/csv-data-manipulation.alg index 749c7da413..97c2d04278 100644 --- a/Task/CSV-data-manipulation/ALGOL-68/csv-data-manipulation.alg +++ b/Task/CSV-data-manipulation/ALGOL-68/csv-data-manipulation.alg @@ -3,8 +3,8 @@ PROC char count = (CHAR c, STRING str) INT: BEGIN INT count := 0; FOR i TO UPB str DO - IF c = str[i] THEN count +:= 1 - FI + IF c = str[i] THEN count +:= 1 + FI OD; count END; @@ -17,9 +17,9 @@ PROC char split = (STRING str, CHAR sep) FLEX[]STRING : INT start := 1; [char count (sep, str) + 1] STRING list; WHILE start <= strlen ANDF char in string (sep, p, str[start:]) DO - p +:= start - 1; - list[cnt +:= 1] := str[start:p-1]; - start := p + 1 + p +:= start - 1; + list[cnt +:= 1] := str[start:p-1]; + start := p + 1 OD; IF cnt = 0 THEN list[cnt +:= 1] := str ELIF start <= UPB str + 1 THEN list[cnt +:= 1] := str[start:] @@ -31,7 +31,7 @@ PROC join = ([]STRING words, STRING sep) STRING: IF UPB words > 0 THEN STRING str := words [1]; FOR i FROM 2 TO UPB words DO - str +:= sep + words[i] + str +:= sep + words[i] OD; str ELSE @@ -60,10 +60,10 @@ OP TOINT = (STRING str) INT: BEGIN INT n := 0, sign := 1; FOR i TO UPB str WHILE sign /= 0 DO - IF is digit (str[i]) THEN n := n * 10 + ABS str[i] - ABS "0" - ELIF i = 1 AND str[i] = "-" THEN sign := -1 - ELIF i /= 1 OR str[i] /= "+" THEN sign := 0 - FI + IF is digit (str[i]) THEN n := n * 10 + ABS str[i] - ABS "0" + ELIF i = 1 AND str[i] = "-" THEN sign := -1 + ELIF i /= 1 OR str[i] /= "+" THEN sign := 0 + FI OD; n * sign END; diff --git a/Task/CSV-data-manipulation/AWK/csv-data-manipulation.awk b/Task/CSV-data-manipulation/AWK/csv-data-manipulation.awk index f45946981e..5f148a16dd 100644 --- a/Task/CSV-data-manipulation/AWK/csv-data-manipulation.awk +++ b/Task/CSV-data-manipulation/AWK/csv-data-manipulation.awk @@ -6,7 +6,7 @@ NR==1 { } { sum = 0 - for (i=1; i<=NF; i++) { + for (i=1; i<=NF; i++) { sum += $i } print $0, sum diff --git a/Task/CSV-data-manipulation/Ada/csv-data-manipulation-1.ada b/Task/CSV-data-manipulation/Ada/csv-data-manipulation-1.adb similarity index 100% rename from Task/CSV-data-manipulation/Ada/csv-data-manipulation-1.ada rename to Task/CSV-data-manipulation/Ada/csv-data-manipulation-1.adb diff --git a/Task/CSV-data-manipulation/Ada/csv-data-manipulation-2.ada b/Task/CSV-data-manipulation/Ada/csv-data-manipulation-2.adb similarity index 100% rename from Task/CSV-data-manipulation/Ada/csv-data-manipulation-2.ada rename to Task/CSV-data-manipulation/Ada/csv-data-manipulation-2.adb diff --git a/Task/CSV-data-manipulation/Ada/csv-data-manipulation-3.ada b/Task/CSV-data-manipulation/Ada/csv-data-manipulation-3.adb similarity index 100% rename from Task/CSV-data-manipulation/Ada/csv-data-manipulation-3.ada rename to Task/CSV-data-manipulation/Ada/csv-data-manipulation-3.adb diff --git a/Task/CSV-data-manipulation/C/csv-data-manipulation-1.c b/Task/CSV-data-manipulation/C/csv-data-manipulation-1.c index 060dd21931..6f6b83c3bc 100644 --- a/Task/CSV-data-manipulation/C/csv-data-manipulation-1.c +++ b/Task/CSV-data-manipulation/C/csv-data-manipulation-1.c @@ -16,10 +16,10 @@ typedef struct { - char * delim; - unsigned int rows; - unsigned int cols; - char ** table; + char * delim; + unsigned int rows; + unsigned int cols; + char ** table; } CSV; @@ -27,28 +27,28 @@ typedef struct { * Utility function to trim whitespaces from left & right of a string */ int trim(char ** str) { - int trimmed; - int n; - int len; - - len = strlen(*str); - n = len - 1; - /* from right */ - while((n>=0) && isspace((*str)[n])) { - (*str)[n] = '\0'; - trimmed += 1; - n--; - } + int trimmed; + int n; + int len; - /* from left */ - n = 0; - while((n < len) && (isspace((*str)[0]))) { - (*str)[0] = '\0'; - *str = (*str)+1; - trimmed += 1; - n++; - } - return trimmed; + len = strlen(*str); + n = len - 1; + /* from right */ + while((n>=0) && isspace((*str)[n])) { + (*str)[n] = '\0'; + trimmed += 1; + n--; + } + + /* from left */ + n = 0; + while((n < len) && (isspace((*str)[0]))) { + (*str)[0] = '\0'; + *str = (*str)+1; + trimmed += 1; + n++; + } + return trimmed; } @@ -56,11 +56,11 @@ int trim(char ** str) { * De-allocate csv structure */ int csv_destroy(CSV * csv) { - if (csv == NULL) { return 0; } - if (csv->table != NULL) { free(csv->table); } - if (csv->delim != NULL) { free(csv->delim); } - free(csv); - return 0; + if (csv == NULL) { return 0; } + if (csv->table != NULL) { free(csv->table); } + if (csv->delim != NULL) { free(csv->delim); } + free(csv); + return 0; } @@ -68,23 +68,23 @@ int csv_destroy(CSV * csv) { * Allocate memory for a CSV structure */ CSV * csv_create(unsigned int cols, unsigned int rows) { - CSV * csv; - - csv = malloc(sizeof(CSV)); - csv->rows = rows; - csv->cols = cols; - csv->delim = strdup(","); + CSV * csv; - csv->table = malloc(sizeof(char *) * cols * rows); - if (csv->table == NULL) { goto error; } + csv = malloc(sizeof(CSV)); + csv->rows = rows; + csv->cols = cols; + csv->delim = strdup(","); - memset(csv->table, 0, sizeof(char *) * cols * rows); + csv->table = malloc(sizeof(char *) * cols * rows); + if (csv->table == NULL) { goto error; } - return csv; + memset(csv->table, 0, sizeof(char *) * cols * rows); + + return csv; error: - csv_destroy(csv); - return NULL; + csv_destroy(csv); + return NULL; } @@ -92,9 +92,9 @@ error: * Get value in CSV table at COL, ROW */ char * csv_get(CSV * csv, unsigned int col, unsigned int row) { - unsigned int idx; - idx = col + (row * csv->cols); - return csv->table[idx]; + unsigned int idx; + idx = col + (row * csv->cols); + return csv->table[idx]; } @@ -102,84 +102,84 @@ char * csv_get(CSV * csv, unsigned int col, unsigned int row) { * Set value in CSV table at COL, ROW */ int csv_set(CSV * csv, unsigned int col, unsigned int row, char * value) { - unsigned int idx; - idx = col + (row * csv->cols); - csv->table[idx] = value; - return 0; + unsigned int idx; + idx = col + (row * csv->cols); + csv->table[idx] = value; + return 0; } void csv_display(CSV * csv) { - int row, col; - char * content; - if ((csv->rows == 0) || (csv->cols==0)) { - printf("[Empty table]\n"); - return ; - } + int row, col; + char * content; + if ((csv->rows == 0) || (csv->cols==0)) { + printf("[Empty table]\n"); + return ; + } - printf("\n[Table cols=%d rows=%d]\n", csv->cols, csv->rows); - for (row=0; rowrows; row++) { - printf("[|"); - for (col=0; colcols; col++) { - content = csv_get(csv, col, row); + printf("\n[Table cols=%d rows=%d]\n", csv->cols, csv->rows); + for (row=0; rowrows; row++) { + printf("[|"); + for (col=0; colcols; col++) { + content = csv_get(csv, col, row); printf("%s\t|", content); - } + } printf("]\n"); - } - printf("\n"); + } + printf("\n"); } /** * Resize CSV table */ int csv_resize(CSV * old_csv, unsigned int new_cols, unsigned int new_rows) { - unsigned int cur_col, - cur_row, - max_cols, - max_rows; - CSV * new_csv; - char * content; - bool in_old, in_new; + unsigned int cur_col, + cur_row, + max_cols, + max_rows; + CSV * new_csv; + char * content; + bool in_old, in_new; - /* Build a new (fake) csv */ - new_csv = csv_create(new_cols, new_rows); - if (new_csv == NULL) { goto error; } + /* Build a new (fake) csv */ + new_csv = csv_create(new_cols, new_rows); + if (new_csv == NULL) { goto error; } - new_csv->rows = new_rows; - new_csv->cols = new_cols; + new_csv->rows = new_rows; + new_csv->cols = new_cols; - max_cols = (new_cols > old_csv->cols)? new_cols : old_csv->cols; - max_rows = (new_rows > old_csv->rows)? new_rows : old_csv->rows; + max_cols = (new_cols > old_csv->cols)? new_cols : old_csv->cols; + max_rows = (new_rows > old_csv->rows)? new_rows : old_csv->rows; - for (cur_col=0; cur_colcols) && (cur_row < old_csv->rows); - in_new = (cur_col < new_csv->cols) && (cur_row < new_csv->rows); + for (cur_col=0; cur_colcols) && (cur_row < old_csv->rows); + in_new = (cur_col < new_csv->cols) && (cur_row < new_csv->rows); - if (in_old && in_new) { - /* re-link data */ - content = csv_get(old_csv, cur_col, cur_row); - csv_set(new_csv, cur_col, cur_row, content); - } else if (in_old) { - /* destroy data */ - content = csv_get(old_csv, cur_col, cur_row); - free(content); - } else { /* skip */ } - } - } - /* on rows */ - free(old_csv->table); - old_csv->rows = new_rows; - old_csv->cols = new_cols; - old_csv->table = new_csv->table; - new_csv->table = NULL; - csv_destroy(new_csv); + if (in_old && in_new) { + /* re-link data */ + content = csv_get(old_csv, cur_col, cur_row); + csv_set(new_csv, cur_col, cur_row, content); + } else if (in_old) { + /* destroy data */ + content = csv_get(old_csv, cur_col, cur_row); + free(content); + } else { /* skip */ } + } + } + /* on rows */ + free(old_csv->table); + old_csv->rows = new_rows; + old_csv->cols = new_cols; + old_csv->table = new_csv->table; + new_csv->table = NULL; + csv_destroy(new_csv); - return 0; + return 0; error: - printf("Unable to resize CSV table: error %d - %s\n", errno, strerror(errno)); - return -1; + printf("Unable to resize CSV table: error %d - %s\n", errno, strerror(errno)); + return -1; } @@ -187,42 +187,42 @@ error: * Open CSV file and load its content into provided CSV structure **/ int csv_open(CSV * csv, char * filename) { - FILE * fp; - unsigned int m_rows; - unsigned int m_cols, cols; - char line[2048]; - char * lineptr; - char * token; + FILE * fp; + unsigned int m_rows; + unsigned int m_cols, cols; + char line[2048]; + char * lineptr; + char * token; - fp = fopen(filename, "r"); - if (fp == NULL) { goto error; } + fp = fopen(filename, "r"); + if (fp == NULL) { goto error; } - m_rows = 0; - m_cols = 0; - while(fgets(line, sizeof(line), fp) != NULL) { - m_rows += 1; - cols = 0; - lineptr = line; - while ((token = strtok(lineptr, csv->delim)) != NULL) { - lineptr = NULL; - trim(&token); + m_rows = 0; + m_cols = 0; + while(fgets(line, sizeof(line), fp) != NULL) { + m_rows += 1; + cols = 0; + lineptr = line; + while ((token = strtok(lineptr, csv->delim)) != NULL) { + lineptr = NULL; + trim(&token); cols += 1; - if (cols > m_cols) { m_cols = cols; } + if (cols > m_cols) { m_cols = cols; } csv_resize(csv, m_cols, m_rows); csv_set(csv, cols-1, m_rows-1, strdup(token)); } - } + } - fclose(fp); - csv->rows = m_rows; - csv->cols = m_cols; - return 0; + fclose(fp); + csv->rows = m_rows; + csv->cols = m_cols; + return 0; error: - fclose(fp); - printf("Unable to open %s for reading.", filename); - return -1; + fclose(fp); + printf("Unable to open %s for reading.", filename); + return -1; } @@ -230,22 +230,22 @@ error: * Open CSV file and save CSV structure content into it **/ int csv_save(CSV * csv, char * filename) { - FILE * fp; - int row, col; - char * content; + FILE * fp; + int row, col; + char * content; - fp = fopen(filename, "w"); - for (row=0; rowrows; row++) { - for (col=0; colcols; col++) { - content = csv_get(csv, col, row); + fp = fopen(filename, "w"); + for (row=0; rowrows; row++) { + for (col=0; colcols; col++) { + content = csv_get(csv, col, row); fprintf(fp, "%s%s", content, - ((col == csv->cols-1) ? "" : csv->delim) ); - } + ((col == csv->cols-1) ? "" : csv->delim) ); + } fprintf(fp, "\n"); - } + } - fclose(fp); - return 0; + fclose(fp); + return 0; } @@ -253,23 +253,23 @@ int csv_save(CSV * csv, char * filename) { * Test */ int main(int argc, char ** argv) { - CSV * csv; + CSV * csv; - printf("%s\n%s\n\n",TITLE, URL); + printf("%s\n%s\n\n",TITLE, URL); - csv = csv_create(0, 0); - csv_open(csv, "fixtures/csv-data-manipulation.csv"); - csv_display(csv); + csv = csv_create(0, 0); + csv_open(csv, "fixtures/csv-data-manipulation.csv"); + csv_display(csv); - csv_set(csv, 0, 0, "Column0"); - csv_set(csv, 1, 1, "100"); - csv_set(csv, 2, 2, "200"); - csv_set(csv, 3, 3, "300"); - csv_set(csv, 4, 4, "400"); - csv_display(csv); + csv_set(csv, 0, 0, "Column0"); + csv_set(csv, 1, 1, "100"); + csv_set(csv, 2, 2, "200"); + csv_set(csv, 3, 3, "300"); + csv_set(csv, 4, 4, "400"); + csv_display(csv); - csv_save(csv, "tmp/csv-data-manipulation.result.csv"); - csv_destroy(csv); + csv_save(csv, "tmp/csv-data-manipulation.result.csv"); + csv_destroy(csv); - return 0; + return 0; } diff --git a/Task/CSV-data-manipulation/COBOL/csv-data-manipulation.cobol b/Task/CSV-data-manipulation/COBOL/csv-data-manipulation.cob similarity index 100% rename from Task/CSV-data-manipulation/COBOL/csv-data-manipulation.cobol rename to Task/CSV-data-manipulation/COBOL/csv-data-manipulation.cob diff --git a/Task/CSV-data-manipulation/Delphi/csv-data-manipulation.delphi b/Task/CSV-data-manipulation/Delphi/csv-data-manipulation.pas similarity index 100% rename from Task/CSV-data-manipulation/Delphi/csv-data-manipulation.delphi rename to Task/CSV-data-manipulation/Delphi/csv-data-manipulation.pas diff --git a/Task/CSV-data-manipulation/DuckDB/csv-data-manipulation-1.duckdb b/Task/CSV-data-manipulation/DuckDB/csv-data-manipulation-1.duckdb new file mode 100644 index 0000000000..dd05c0680d --- /dev/null +++ b/Task/CSV-data-manipulation/DuckDB/csv-data-manipulation-1.duckdb @@ -0,0 +1,5 @@ +create or replace table csv as +from read_csv_auto('rc-csv-data-manipulation.csv'); + +# View the first row of the table: +from csv limit 1; diff --git a/Task/CSV-data-manipulation/DuckDB/csv-data-manipulation-2.duckdb b/Task/CSV-data-manipulation/DuckDB/csv-data-manipulation-2.duckdb new file mode 100644 index 0000000000..5078ee97a4 --- /dev/null +++ b/Task/CSV-data-manipulation/DuckDB/csv-data-manipulation-2.duckdb @@ -0,0 +1,4 @@ +copy + (select *, (C1 + C2 + C3 + C4 + C5) as sum + from csv) + to 'junk.csv'; diff --git a/Task/CSV-data-manipulation/DuckDB/csv-data-manipulation-3.duckdb b/Task/CSV-data-manipulation/DuckDB/csv-data-manipulation-3.duckdb new file mode 100644 index 0000000000..b3c1bedcf5 --- /dev/null +++ b/Task/CSV-data-manipulation/DuckDB/csv-data-manipulation-3.duckdb @@ -0,0 +1,6 @@ +ALTER TABLE csv ADD COLUMN sum integer; + +UPDATE csv +SET sum = C1 + C2 + C3 + C4 + C5; + +copy csv to 'junk2.csv'; diff --git a/Task/CSV-data-manipulation/ECL/csv-data-manipulation.ecl b/Task/CSV-data-manipulation/ECL/csv-data-manipulation.ecl index b69c763781..1e1feac64c 100644 --- a/Task/CSV-data-manipulation/ECL/csv-data-manipulation.ecl +++ b/Task/CSV-data-manipulation/ECL/csv-data-manipulation.ecl @@ -5,7 +5,7 @@ STRING Field2; STRING Field3; STRING Field4; STRING Field5; -END; +END; MyDataset := DATASET ('~Rosetta::myCSVFile', MyFileLayout,CSV(SEPARATOR(','))); diff --git a/Task/CSV-data-manipulation/EasyLang/csv-data-manipulation.easy b/Task/CSV-data-manipulation/EasyLang/csv-data-manipulation.easy new file mode 100644 index 0000000000..75513102c2 --- /dev/null +++ b/Task/CSV-data-manipulation/EasyLang/csv-data-manipulation.easy @@ -0,0 +1,17 @@ +s$ = input +print s$ & ",SUM" +repeat + s$ = input + until s$ = "" + sum = 0 + for v in number strsplit s$ "," + sum += v + . + print s$ & "," & sum +. +input_data +C1,C2,C3,C4,C5 +1,5,9,13,17 +2,6,10,14,18 +3,7,11,15,19 +4,8,12,16,20 diff --git a/Task/CSV-data-manipulation/EchoLisp/csv-data-manipulation-1.l b/Task/CSV-data-manipulation/EchoLisp/csv-data-manipulation-1.l index 9afa63c6bb..d621e254ba 100644 --- a/Task/CSV-data-manipulation/EchoLisp/csv-data-manipulation-1.l +++ b/Task/CSV-data-manipulation/EchoLisp/csv-data-manipulation-1.l @@ -10,12 +10,10 @@ (define (task file) (let* - ((table (csv->table file)) - (header (first table)) - (rows (rest table))) - - (table->csv - (append header "SUM") ;; add last column - (for/list ((row rows)) (append row (apply + row)))))) + ((table (csv->table file)) + (header (first table)) + (rows (rest table))) - + (table->csv + (append header "SUM") ;; add last column + (for/list ((row rows)) (append row (apply + row)))))) diff --git a/Task/CSV-data-manipulation/Elixir/csv-data-manipulation.elixir b/Task/CSV-data-manipulation/Elixir/csv-data-manipulation.ex similarity index 100% rename from Task/CSV-data-manipulation/Elixir/csv-data-manipulation.elixir rename to Task/CSV-data-manipulation/Elixir/csv-data-manipulation.ex diff --git a/Task/CSV-data-manipulation/Euphoria/csv-data-manipulation.eu b/Task/CSV-data-manipulation/Euphoria/csv-data-manipulation.eu new file mode 100644 index 0000000000..66f5a8b1dd --- /dev/null +++ b/Task/CSV-data-manipulation/Euphoria/csv-data-manipulation.eu @@ -0,0 +1,91 @@ +--- Read CSV file and add columns headed with 'SUM' +--- with trace +-- trace(0) + +include get.e +include std/text.e + +function split(sequence s, integer c) + sequence removables = " \t\n\r\x05\u0234\" " + sequence out + integer first, delim + out = {} + first = 1 + while first <= length(s) do + delim = find_from(c,s,first) + if delim = 0 then + delim = length(s)+1 + end if + out = append(out,trim(s[first..delim-1],removables)) + first = delim + 1 + end while + return out +end function + +procedure main() + integer fn -- the file number + integer fn2 -- the output file number + integer e -- the number of lines read + object line -- the next line from the file + sequence data = {} -- parsed csv data row + sequence headerNames = {} -- array saving column names + atom sum = 0.0 -- sum for each row + sequence var -- holds numerical data read + + -- First we try to open the file called "data.csv". + fn = open("data.csv", "r") + if fn = -1 then + puts(1, "Can't open data.csv\n") + -- abort(); + end if + + -- Then we create an output file for processed data. + fn2 = open("newdata.csv", "w") + if fn2 = -1 then + puts(1, "Can't create newdata.csv\n") + end if + + -- By successfully opening the file we have established that + -- the file exists, and open() gives us a file number (or "handle") + -- that we can use to perform operations on the file. + + e = 1 + while 1 do + line = gets(fn) + if atom(line) then + exit + end if + data = split(line, ',') + + if (e=1) then + -- Save the header labels and + -- write them to output file. + headerNames = data + for i=1 to length(headerNames) do + printf(fn2, "%s,", {headerNames[i]}) + end for + printf(fn2, "SUM\n") + end if + + -- Run a sum for the numerical data. + if (e >= 2) then + for i=1 to length(data) do + printf(fn2, "%s,", {data[i]}) + var = value(data[i]) + if var[1] = 0 then + -- data read is numerical + -- add to sum + sum = sum + var[2] + end if + end for + printf(fn2, "%g\n", {sum}) + sum = 0.0 + end if + e = e + 1 + end while + + close(fn) + close(fn2) +end procedure + +main() diff --git a/Task/CSV-data-manipulation/Euphoria/csv-data-manipulation.euphoria b/Task/CSV-data-manipulation/Euphoria/csv-data-manipulation.euphoria deleted file mode 100644 index 85ed288be0..0000000000 --- a/Task/CSV-data-manipulation/Euphoria/csv-data-manipulation.euphoria +++ /dev/null @@ -1,91 +0,0 @@ ---- Read CSV file and add columns headed with 'SUM' ---- with trace --- trace(0) - -include get.e -include std/text.e - -function split(sequence s, integer c) - sequence removables = " \t\n\r\x05\u0234\" " - sequence out - integer first, delim - out = {} - first = 1 - while first <= length(s) do - delim = find_from(c,s,first) - if delim = 0 then - delim = length(s)+1 - end if - out = append(out,trim(s[first..delim-1],removables)) - first = delim + 1 - end while - return out -end function - -procedure main() - integer fn -- the file number - integer fn2 -- the output file number - integer e -- the number of lines read - object line -- the next line from the file - sequence data = {} -- parsed csv data row - sequence headerNames = {} -- array saving column names - atom sum = 0.0 -- sum for each row - sequence var -- holds numerical data read - - -- First we try to open the file called "data.csv". - fn = open("data.csv", "r") - if fn = -1 then - puts(1, "Can't open data.csv\n") - -- abort(); - end if - - -- Then we create an output file for processed data. - fn2 = open("newdata.csv", "w") - if fn2 = -1 then - puts(1, "Can't create newdata.csv\n") - end if - - -- By successfully opening the file we have established that - -- the file exists, and open() gives us a file number (or "handle") - -- that we can use to perform operations on the file. - - e = 1 - while 1 do - line = gets(fn) - if atom(line) then - exit - end if - data = split(line, ',') - - if (e=1) then - -- Save the header labels and - -- write them to output file. - headerNames = data - for i=1 to length(headerNames) do - printf(fn2, "%s,", {headerNames[i]}) - end for - printf(fn2, "SUM\n") - end if - - -- Run a sum for the numerical data. - if (e >= 2) then - for i=1 to length(data) do - printf(fn2, "%s,", {data[i]}) - var = value(data[i]) - if var[1] = 0 then - -- data read is numerical - -- add to sum - sum = sum + var[2] - end if - end for - printf(fn2, "%g\n", {sum}) - sum = 0.0 - end if - e = e + 1 - end while - - close(fn) - close(fn2) -end procedure - -main() diff --git a/Task/CSV-data-manipulation/Fortran/csv-data-manipulation-2.f b/Task/CSV-data-manipulation/Fortran/csv-data-manipulation-2.f index ef63969cbc..6e400d25ef 100644 --- a/Task/CSV-data-manipulation/Fortran/csv-data-manipulation-2.f +++ b/Task/CSV-data-manipulation/Fortran/csv-data-manipulation-2.f @@ -1,20 +1,20 @@ Copies a file with 5 comma-separated values to a line, appending a column holding their sum. - INTEGER N !Instead of littering the source with "5" - PARAMETER (N = 5) !Provide some provenance. - CHARACTER*6 HEAD(N) !A perfect size? - INTEGER X(N) !Integers suffice. - INTEGER LINPR,IN !I/O unit numbers. - LINPR = 6 !Standard output via this unit number. - IN = 10 !Some unit number for the input file. - OPEN (IN,FILE="CSVtest.csv",STATUS="OLD",ACTION="READ") !For formatted input. + INTEGER N !Instead of littering the source with "5" + PARAMETER (N = 5) !Provide some provenance. + CHARACTER*6 HEAD(N) !A perfect size? + INTEGER X(N) !Integers suffice. + INTEGER LINPR,IN !I/O unit numbers. + LINPR = 6 !Standard output via this unit number. + IN = 10 !Some unit number for the input file. + OPEN (IN,FILE="CSVtest.csv",STATUS="OLD",ACTION="READ") !For formatted input. - READ (IN,*) HEAD !The first line has texts as column headings. - WRITE (LINPR,1) (TRIM(HEAD(I)), I = 1,N),"Sum" !Append a "Sum" column. - 1 FORMAT (666(A:",")) !The : sez "stop if no list element awaits". - 2 READ (IN,*,END = 10) X !Read a line's worth of numbers, separated by commas or spaces. - WRITE (LINPR,3) X,SUM(X) !Write, with a total appended. - 3 FORMAT (666(I0:",")) !I0 editing uses only as many columns as are needed. - GO TO 2 !Do it again. + READ (IN,*) HEAD !The first line has texts as column headings. + WRITE (LINPR,1) (TRIM(HEAD(I)), I = 1,N),"Sum" !Append a "Sum" column. + 1 FORMAT (666(A:",")) !The : sez "stop if no list element awaits". + 2 READ (IN,*,END = 10) X !Read a line's worth of numbers, separated by commas or spaces. + WRITE (LINPR,3) X,SUM(X) !Write, with a total appended. + 3 FORMAT (666(I0:",")) !I0 editing uses only as many columns as are needed. + GO TO 2 !Do it again. - 10 CLOSE (IN) !All done. - END !That's all. + 10 CLOSE (IN) !All done. + END !That's all. diff --git a/Task/CSV-data-manipulation/FunL/csv-data-manipulation.funl b/Task/CSV-data-manipulation/FunL/csv-data-manipulation.funl index 17cee74435..2bb6312e7a 100644 --- a/Task/CSV-data-manipulation/FunL/csv-data-manipulation.funl +++ b/Task/CSV-data-manipulation/FunL/csv-data-manipulation.funl @@ -34,7 +34,7 @@ def updateRow( header, row, updates ) = updates( r ) vector( r(f) | f <- header ) -def update( table, updates ) = +def update( table, updates ) = Table( table.header, (updateRow(table.header, r, updates) | r <- table.rows).toList() ) def addColumn( table, column, updates ) = diff --git a/Task/CSV-data-manipulation/Go/csv-data-manipulation.go b/Task/CSV-data-manipulation/Go/csv-data-manipulation.go index d6adc29b82..b893656760 100644 --- a/Task/CSV-data-manipulation/Go/csv-data-manipulation.go +++ b/Task/CSV-data-manipulation/Go/csv-data-manipulation.go @@ -1,58 +1,58 @@ package main import ( - "encoding/csv" - "log" - "os" - "strconv" + "encoding/csv" + "log" + "os" + "strconv" ) func main() { - rows := readSample() - appendSum(rows) - writeChanges(rows) + rows := readSample() + appendSum(rows) + writeChanges(rows) } func readSample() [][]string { - f, err := os.Open("sample.csv") - if err != nil { - log.Fatal(err) - } - rows, err := csv.NewReader(f).ReadAll() - f.Close() - if err != nil { - log.Fatal(err) - } - return rows + f, err := os.Open("sample.csv") + if err != nil { + log.Fatal(err) + } + rows, err := csv.NewReader(f).ReadAll() + f.Close() + if err != nil { + log.Fatal(err) + } + return rows } func appendSum(rows [][]string) { - rows[0] = append(rows[0], "SUM") - for i := 1; i < len(rows); i++ { - rows[i] = append(rows[i], sum(rows[i])) - } + rows[0] = append(rows[0], "SUM") + for i := 1; i < len(rows); i++ { + rows[i] = append(rows[i], sum(rows[i])) + } } func sum(row []string) string { - sum := 0 - for _, s := range row { - x, err := strconv.Atoi(s) - if err != nil { - return "NA" - } - sum += x - } - return strconv.Itoa(sum) + sum := 0 + for _, s := range row { + x, err := strconv.Atoi(s) + if err != nil { + return "NA" + } + sum += x + } + return strconv.Itoa(sum) } func writeChanges(rows [][]string) { - f, err := os.Create("output.csv") - if err != nil { - log.Fatal(err) - } - err = csv.NewWriter(f).WriteAll(rows) - f.Close() - if err != nil { - log.Fatal(err) - } + f, err := os.Create("output.csv") + if err != nil { + log.Fatal(err) + } + err = csv.NewWriter(f).WriteAll(rows) + f.Close() + if err != nil { + log.Fatal(err) + } } diff --git a/Task/CSV-data-manipulation/Julia/csv-data-manipulation.julia b/Task/CSV-data-manipulation/Julia/csv-data-manipulation.jl similarity index 100% rename from Task/CSV-data-manipulation/Julia/csv-data-manipulation.julia rename to Task/CSV-data-manipulation/Julia/csv-data-manipulation.jl diff --git a/Task/CSV-data-manipulation/Kotlin/csv-data-manipulation.kotlin b/Task/CSV-data-manipulation/Kotlin/csv-data-manipulation.kts similarity index 100% rename from Task/CSV-data-manipulation/Kotlin/csv-data-manipulation.kotlin rename to Task/CSV-data-manipulation/Kotlin/csv-data-manipulation.kts diff --git a/Task/CSV-data-manipulation/Logo/csv-data-manipulation-1.logo b/Task/CSV-data-manipulation/Logo/csv-data-manipulation-1.logo new file mode 100644 index 0000000000..c8936190c7 --- /dev/null +++ b/Task/CSV-data-manipulation/Logo/csv-data-manipulation-1.logo @@ -0,0 +1,19 @@ +to csv.data.manipulation :in :out + local [header line list sum] + openread :in + setread :in + openwrite :out + setwrite :out + make "header readword + print word :header ",SUM + while [not eofp] [ + make "line readword + make "list parse map [ifelse equalp ? ", ["\ ] [?]] :line + make "sum apply "sum :list + print (word :line "\, :sum) + ] + close :in + setread [] + close :out + setwrite [] +end diff --git a/Task/CSV-data-manipulation/Logo/csv-data-manipulation-2.logo b/Task/CSV-data-manipulation/Logo/csv-data-manipulation-2.logo new file mode 100644 index 0000000000..13633defa8 --- /dev/null +++ b/Task/CSV-data-manipulation/Logo/csv-data-manipulation-2.logo @@ -0,0 +1 @@ +csv.data.manipulation "data.csv "output.csv diff --git a/Task/CSV-data-manipulation/Lua/csv-data-manipulation-1.lua b/Task/CSV-data-manipulation/Lua/csv-data-manipulation-1.lua new file mode 100644 index 0000000000..8296349d52 --- /dev/null +++ b/Task/CSV-data-manipulation/Lua/csv-data-manipulation-1.lua @@ -0,0 +1,11 @@ +-- Lua has no built in methods to handle csv files. +-- it does have string.gmatch, which we use to global.match whatever isn't a comma + +print(io.read"l" .. ",SUM") +for line in io.lines() do + local sum = 0 + for field in line:gmatch"[^,]+" do + sum = sum + field + end + print(line .. "," .. sum) +end diff --git a/Task/CSV-data-manipulation/Lua/csv-data-manipulation-2.lua b/Task/CSV-data-manipulation/Lua/csv-data-manipulation-2.lua new file mode 100644 index 0000000000..0469930ba1 --- /dev/null +++ b/Task/CSV-data-manipulation/Lua/csv-data-manipulation-2.lua @@ -0,0 +1,26 @@ +local csv={} + +-- read csv file, save records and fields into table +for line in io.lines('file.csv') do + local fields = {} + for field in line:gmatch"[^,]+" do + table.insert(fields, tonumber(field) or field) + end + table.insert(csv, fields) +end + +-- change csv values +table.insert(csv[1], 'SUM') +for i=2,#csv do + local sum=0 + for _, val in ipairs(csv[i]) do + sum = sum + val + end + table.insert(csv[i], sum) +end + +-- Save +local fileHandler = io.open('file.csv', 'w') +for NR, fields in ipairs(csv) do + fileHandler:write(table.concat(fields,","), "\n") +end diff --git a/Task/CSV-data-manipulation/Lua/csv-data-manipulation.lua b/Task/CSV-data-manipulation/Lua/csv-data-manipulation.lua deleted file mode 100644 index 26ddaeabc9..0000000000 --- a/Task/CSV-data-manipulation/Lua/csv-data-manipulation.lua +++ /dev/null @@ -1,31 +0,0 @@ -local csv={} -for line in io.lines('file.csv') do - table.insert(csv, {}) - local i=1 - for j=1,#line do - if line:sub(j,j) == ',' then - table.insert(csv[#csv], line:sub(i,j-1)) - i=j+1 - end - end - table.insert(csv[#csv], line:sub(i,j)) -end - -table.insert(csv[1], 'SUM') -for i=2,#csv do - local sum=0 - for j=1,#csv[i] do - sum=sum + tonumber(csv[i][j]) - end - if sum>0 then - table.insert(csv[i], sum) - end -end - -local newFileData = '' -for i=1,#csv do - newFileData=newFileData .. table.concat(csv[i], ',') .. '\n' -end - -local file=io.open('file.csv', 'w') -file:write(newFileData) diff --git a/Task/CSV-data-manipulation/M2000-Interpreter/csv-data-manipulation.m2000 b/Task/CSV-data-manipulation/M2000-Interpreter/csv-data-manipulation.m2000 index 7ef687eccb..ebca3c0383 100644 --- a/Task/CSV-data-manipulation/M2000-Interpreter/csv-data-manipulation.m2000 +++ b/Task/CSV-data-manipulation/M2000-Interpreter/csv-data-manipulation.m2000 @@ -1,6 +1,7 @@ +Locale 1032 Module Checkit { Function Sum { - Long c=0 + DECIMAL c=0 while not empty { c+=number } @@ -8,7 +9,7 @@ Module Checkit { } Document CSV$ = {C1,C2,C3,C4,C5 1,5,9,13,17 - 2,6,10,14,18 + 2,6,10.3,14,18 3,7,11,15,19 4,8,12,16,20 } @@ -19,13 +20,13 @@ Module Checkit { \\ use standard decimal point char \\ use standard (non json style string) \\ True = use bare strings (without "") - Input With "",,,true - Write With"",,,true + Input With "","",,true + Write With chr$(9),locale$(0xE),,true \\ for excel csv use Input With chr$(9),,true, true Open "data1.csv" for Wide Input as #M Open "data2.csv" for Wide Output as #M1 Input #M, h1$, h2$, h3$, h4$, h5$ - Write #M1, h1$, h2$, h3$, h4$, h5$ + Write #M1, h1$, h2$, h3$, h4$, h5$, "SUM" Print h1$, h2$, h3$, h4$, h5$ While not Eof(#M) { @@ -35,13 +36,15 @@ Module Checkit { } close #M1 Close #M + Input With chr$(9),locale$(0xE),,true Open "data2.csv" for Wide Input as #M - Input #M, h1$, h2$, h3$, h4$, h5$ - Print h1$, h2$, h3$, h4$, h5$ + Input #M, h1$, h2$, h3$, h4$, h5$, h6$ + Print h1$, h2$, h3$, h4$, h5$, h6$ While not Eof(#M) { Input #M, A1, A2, A3, A4, A5, Sum Print A1, A2, A3, A4, A5, Sum } Close #M + Win "Excel", dir$+"data2.csv" } Checkit diff --git a/Task/CSV-data-manipulation/MATLAB/csv-data-manipulation-1.m b/Task/CSV-data-manipulation/MATLAB/csv-data-manipulation-1.m index 16512a1db4..ad5d27aed9 100644 --- a/Task/CSV-data-manipulation/MATLAB/csv-data-manipulation-1.m +++ b/Task/CSV-data-manipulation/MATLAB/csv-data-manipulation-1.m @@ -7,7 +7,7 @@ X = dlmread(filename,',',1,0); fid = fopen('data.out.csv','w+'); fprintf(fid,'%s,sum\n',header); for k=1:size(X,1), - fprintf(fid,"%i,",X(k,:)); - fprintf(fid,"%i\n",sum(X(k,:))); + fprintf(fid,"%i,",X(k,:)); + fprintf(fid,"%i\n",sum(X(k,:))); end; fclose(fid); diff --git a/Task/CSV-data-manipulation/Nu/csv-data-manipulation-1.nu b/Task/CSV-data-manipulation/Nu/csv-data-manipulation-1.nu new file mode 100644 index 0000000000..d137dc1b65 --- /dev/null +++ b/Task/CSV-data-manipulation/Nu/csv-data-manipulation-1.nu @@ -0,0 +1,5 @@ +open 'test_in.csv' | + each { |row| + let sum = ($row | values | math sum); + $row | insert Sum $sum + } diff --git a/Task/CSV-data-manipulation/Nu/csv-data-manipulation-2.nu b/Task/CSV-data-manipulation/Nu/csv-data-manipulation-2.nu new file mode 100644 index 0000000000..82640ab976 --- /dev/null +++ b/Task/CSV-data-manipulation/Nu/csv-data-manipulation-2.nu @@ -0,0 +1 @@ +open 'test_in.csv' | upsert Sum {|row| $row | values | math sum } diff --git a/Task/CSV-data-manipulation/OCaml/csv-data-manipulation.ocaml b/Task/CSV-data-manipulation/OCaml/csv-data-manipulation.ml similarity index 100% rename from Task/CSV-data-manipulation/OCaml/csv-data-manipulation.ocaml rename to Task/CSV-data-manipulation/OCaml/csv-data-manipulation.ml diff --git a/Task/CSV-data-manipulation/PascalABC.NET/csv-data-manipulation.pas b/Task/CSV-data-manipulation/PascalABC.NET/csv-data-manipulation.pas new file mode 100644 index 0000000000..c2a30c8cee --- /dev/null +++ b/Task/CSV-data-manipulation/PascalABC.NET/csv-data-manipulation.pas @@ -0,0 +1,9 @@ +begin + var lines := ReadLines('data.csv').Select((line,i) -> begin + if i = 0 then + Result := line + ',SUM' + else Result := line + ',' + line.Split(',').Sum(x -> x.ToInteger); + end); + WriteLines('outdata.csv',lines); + lines.PrintLines; +end. diff --git a/Task/CSV-data-manipulation/PowerShell/csv-data-manipulation.psh b/Task/CSV-data-manipulation/PowerShell/csv-data-manipulation.ps1 similarity index 100% rename from Task/CSV-data-manipulation/PowerShell/csv-data-manipulation.psh rename to Task/CSV-data-manipulation/PowerShell/csv-data-manipulation.ps1 diff --git a/Task/CSV-data-manipulation/Prolog/csv-data-manipulation.pro b/Task/CSV-data-manipulation/Prolog/csv-data-manipulation.pro index 028345fd11..4f86884d47 100644 --- a/Task/CSV-data-manipulation/Prolog/csv-data-manipulation.pro +++ b/Task/CSV-data-manipulation/Prolog/csv-data-manipulation.pro @@ -2,21 +2,21 @@ test :- augment('test.csv', 'test.out.csv'). % augment( +InFileName, +OutFileName) augment(InFile, OutFile) :- - open(OutFile, write, OutStream), - ( ( csv_read_file_row(InFile, Row, [line(Line)]), - % Row is of the form row( Item1, Item2, ....). - addrow(Row, Out), - csv_write_stream(OutStream, [Out], []), - fail - ) - ; close(OutStream) - ). + open(OutFile, write, OutStream), + ( ( csv_read_file_row(InFile, Row, [line(Line)]), + % Row is of the form row( Item1, Item2, ....). + addrow(Row, Out), + csv_write_stream(OutStream, [Out], []), + fail + ) + ; close(OutStream) + ). % If the first item in a row is an integer, then append the sum; % otherwise append 'SUM': addrow( Term, NewTerm ) :- - Term =.. [F | List], - List = [X|_], - (integer(X) -> sum_list(List, Sum) ; Sum = 'SUM'), - append(List, [Sum], NewList), - NewTerm =.. [F | NewList]. + Term =.. [F | List], + List = [X|_], + (integer(X) -> sum_list(List, Sum) ; Sum = 'SUM'), + append(List, [Sum], NewList), + NewTerm =.. [F | NewList]. diff --git a/Task/CSV-data-manipulation/Python/csv-data-manipulation-4.py b/Task/CSV-data-manipulation/Python/csv-data-manipulation-4.py new file mode 100644 index 0000000000..a35b14ce8d --- /dev/null +++ b/Task/CSV-data-manipulation/Python/csv-data-manipulation-4.py @@ -0,0 +1,9 @@ +import polars as pl + +filepath = "data.csv" + +( + pl.scan_csv(filepath) + .with_columns(pl.sum_horizontal(pl.all()).alias("SUM")) + .sink_csv(filepath) +) diff --git a/Task/CSV-data-manipulation/Rebol/csv-data-manipulation.rebol b/Task/CSV-data-manipulation/Rebol/csv-data-manipulation.rebol new file mode 100644 index 0000000000..5f0eab3980 --- /dev/null +++ b/Task/CSV-data-manipulation/Rebol/csv-data-manipulation.rebol @@ -0,0 +1,35 @@ +Rebol [ + title: "Rosetta code: CSV data manipulation" + file: %CSV_data_manipulation.r3 + url: https://rosettacode.org/wiki/CSV_data_manipulation +] + +write %test.csv {C1,C2,C3,C4,C5 +1,5,9,13,17 +2,6,10,14,18 +3,7,11,15,19 +4,8,12,16,20} ;; create a sample CSV file on disk + +probe-csv: func [data][ + foreach row data [probe row] ;; helper: print each parsed CSV row using probe +] + +import csv ;; enable CSV codec for load/save of CSV files + +data: load %test.csv ;; load CSV into a block of rows (row 1 is header) +print "^/Original:" probe-csv data ;; show original data + +;; Add SUM column: +append data/1 "SUM" ;; extend header with a new column "SUM" +foreach row next data [ ;; iterate over data rows (skip header) + sum: 0 + forall row [ ;; walk each cell in the row in place + change row to integer! row/1 ;; convert current cell to integer (mutates row) + sum: sum + row/1 ;; accumulate the running total + ] + append row sum ;; append the computed sum at the end of the row +] +print "^/Modified:" probe-csv data ;; show data after adding the SUM column + +save %new.csv data ;; save the modified data to a new CSV file +print "^/Reloaded:" probe-csv load %new.csv ;; reload and display to verify persistence diff --git a/Task/CSV-data-manipulation/Red/csv-data-manipulation-2.red b/Task/CSV-data-manipulation/Red/csv-data-manipulation-2.red index caf8b0fc9d..c48fba572d 100644 --- a/Task/CSV-data-manipulation/Red/csv-data-manipulation-2.red +++ b/Task/CSV-data-manipulation/Red/csv-data-manipulation-2.red @@ -1,6 +1,6 @@ >>forall data [either (index? data) = 1[ - append data/1 "SUM" + append data/1 "SUM" ][ - append data/1 to string! - (to integer! data/1/1) + (to integer! data/1/2) + (to integer! data/1/3) + (to integer! data/1/4) + (to integer! data/1/5) + append data/1 to string! + (to integer! data/1/1) + (to integer! data/1/2) + (to integer! data/1/3) + (to integer! data/1/4) + (to integer! data/1/5) ]] diff --git a/Task/CSV-data-manipulation/Rust/csv-data-manipulation.rust b/Task/CSV-data-manipulation/Rust/csv-data-manipulation.rs similarity index 100% rename from Task/CSV-data-manipulation/Rust/csv-data-manipulation.rust rename to Task/CSV-data-manipulation/Rust/csv-data-manipulation.rs diff --git a/Task/CSV-data-manipulation/Scala/csv-data-manipulation.scala b/Task/CSV-data-manipulation/Scala/csv-data-manipulation.scala index 634a37b191..2abe9cda6f 100644 --- a/Task/CSV-data-manipulation/Scala/csv-data-manipulation.scala +++ b/Task/CSV-data-manipulation/Scala/csv-data-manipulation.scala @@ -3,10 +3,10 @@ import scala.io.Source object parseCSV extends App { val rawData = """|C1,C2,C3,C4,C5 - |1,5,9,13,17 - |2,6,10,14,18 - |3,7,11,15,19 - |20,21,22,23,24""".stripMargin + |1,5,9,13,17 + |2,6,10,14,18 + |3,7,11,15,19 + |20,21,22,23,24""".stripMargin val data = Seq((Source.fromString(rawData).getLines()).map(_.split(",")).toSeq: _*) diff --git a/Task/CSV-data-manipulation/SenseTalk/csv-data-manipulation.sensetalk b/Task/CSV-data-manipulation/SenseTalk/csv-data-manipulation.sensetalk index da0e4ef1f9..8278882de7 100644 --- a/Task/CSV-data-manipulation/SenseTalk/csv-data-manipulation.sensetalk +++ b/Task/CSV-data-manipulation/SenseTalk/csv-data-manipulation.sensetalk @@ -14,7 +14,7 @@ insert "SUM" into item 1 of csvData -- add a new column heading // Go through all of the data rows to add the sum repeat with rowNum= 2 to the number of items in csvData - insert the sum of item rowNum of csvData into item rowNum of csvData + insert the sum of item rowNum of csvData into item rowNum of csvData end repeat put csvData -- see the modified data as a list of lists diff --git a/Task/CSV-data-manipulation/Tcl/csv-data-manipulation-1.tcl b/Task/CSV-data-manipulation/Tcl/csv-data-manipulation-1.tcl index 9d26066be0..ad39da5984 100644 --- a/Task/CSV-data-manipulation/Tcl/csv-data-manipulation-1.tcl +++ b/Task/CSV-data-manipulation/Tcl/csv-data-manipulation-1.tcl @@ -13,9 +13,9 @@ proc addSumColumn {filename {title "SUM"}} { set sumcol [$m columns] $m add column $title for {set i 1} {$i < [$m rows]} {incr i} { - # Fill out a dummy value - $m set cell $sumcol $i 0 - $m set cell $sumcol $i [tcl::mathop::+ {*}[$m get row $i]] + # Fill out a dummy value + $m set cell $sumcol $i 0 + $m set cell $sumcol $i [tcl::mathop::+ {*}[$m get row $i]] } # Write the CSV out diff --git a/Task/CSV-data-manipulation/Tcl/csv-data-manipulation-2.tcl b/Task/CSV-data-manipulation/Tcl/csv-data-manipulation-2.tcl index e863925092..328e7512b6 100644 --- a/Task/CSV-data-manipulation/Tcl/csv-data-manipulation-2.tcl +++ b/Task/CSV-data-manipulation/Tcl/csv-data-manipulation-2.tcl @@ -1,6 +1,6 @@ set f [open example.csv r] puts "[gets $f],SUM" while { [gets $f row] > 0 } { - puts "$row,[expr [string map {, +} $row]]" + puts "$row,[expr [string map {, +} $row]]" } close $f diff --git a/Task/CSV-data-manipulation/Uiua/csv-data-manipulation.uiua b/Task/CSV-data-manipulation/Uiua/csv-data-manipulation.uiua new file mode 100644 index 0000000000..e6b7e04c7f --- /dev/null +++ b/Task/CSV-data-manipulation/Uiua/csv-data-manipulation.uiua @@ -0,0 +1,11 @@ +# Simple CSV manipulation + +# Effect of running `&fras "example.csv"` +$ C1,C2,C3,C4,C5 +$ 1,5,9,13,17 +$ 2,6,10,14,18 +$ 3,7,11,15,19 +$ 4,8,12,16,20 + +&p⍜°csv(⍜⍉˜⊂⊂□"SUM"≡(□⍜⋕/+)⊸↘1) +# Save using `&fwa "example.csv"` diff --git a/Task/CSV-data-manipulation/VBScript/csv-data-manipulation.vb b/Task/CSV-data-manipulation/VBScript/csv-data-manipulation.vb deleted file mode 100644 index da5502ec55..0000000000 --- a/Task/CSV-data-manipulation/VBScript/csv-data-manipulation.vb +++ /dev/null @@ -1,35 +0,0 @@ -'Instatiate FSO. -Set objFSO = CreateObject("Scripting.FileSystemObject") -'Open the CSV file for reading. The file is in the same folder as the script and named csv_sample.csv. -Set objInCSV = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) & "\csv_sample.csv",1,False) -'Set header status to account for the first line as the column headers. -IsHeader = True -'Initialize the var for the output string. -OutTxt = "" -'Read each line of the file. -Do Until objInCSV.AtEndOfStream - line = objInCSV.ReadLine - If IsHeader Then - OutTxt = OutTxt & line & ",SUM" & vbCrLf - IsHeader = False - Else - OutTxt = OutTxt & line & "," & AddElements(line) & vbCrLf - End If -Loop -'Close the file. -objInCSV.Close -'Open the same file for writing. -Set objOutCSV = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) & "\csv_sample.csv",2,True) -'Write the var OutTxt to the file overwriting existing contents. -objOutCSV.Write OutTxt -'Close the file. -objOutCSV.Close -Set objFSO = Nothing - -'Routine to add each element in a row. -Function AddElements(s) - arr = Split(s,",") - For i = 0 To UBound(arr) - AddElements = AddElements + CInt(arr(i)) - Next -End Function diff --git a/Task/CSV-data-manipulation/VBScript/csv-data-manipulation.vbs b/Task/CSV-data-manipulation/VBScript/csv-data-manipulation.vbs new file mode 100644 index 0000000000..00e334063a --- /dev/null +++ b/Task/CSV-data-manipulation/VBScript/csv-data-manipulation.vbs @@ -0,0 +1,35 @@ +'Instatiate FSO. +Set objFSO = CreateObject("Scripting.FileSystemObject") +'Open the CSV file for reading. The file is in the same folder as the script and named csv_sample.csv. +Set objInCSV = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) & "\csv_sample.csv",1,False) +'Set header status to account for the first line as the column headers. +IsHeader = True +'Initialize the var for the output string. +OutTxt = "" +'Read each line of the file. +Do Until objInCSV.AtEndOfStream + line = objInCSV.ReadLine + If IsHeader Then + OutTxt = OutTxt & line & ",SUM" & vbCrLf + IsHeader = False + Else + OutTxt = OutTxt & line & "," & AddElements(line) & vbCrLf + End If +Loop +'Close the file. +objInCSV.Close +'Open the same file for writing. +Set objOutCSV = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) & "\csv_sample.csv",2,True) +'Write the var OutTxt to the file overwriting existing contents. +objOutCSV.Write OutTxt +'Close the file. +objOutCSV.Close +Set objFSO = Nothing + +'Routine to add each element in a row. +Function AddElements(s) + arr = Split(s,",") + For i = 0 To UBound(arr) + AddElements = AddElements + CInt(arr(i)) + Next +End Function diff --git a/Task/CSV-to-HTML-translation/Ada/csv-to-html-translation-1.ada b/Task/CSV-to-HTML-translation/Ada/csv-to-html-translation-1.adb similarity index 100% rename from Task/CSV-to-HTML-translation/Ada/csv-to-html-translation-1.ada rename to Task/CSV-to-HTML-translation/Ada/csv-to-html-translation-1.adb diff --git a/Task/CSV-to-HTML-translation/Ada/csv-to-html-translation-2.ada b/Task/CSV-to-HTML-translation/Ada/csv-to-html-translation-2.adb similarity index 100% rename from Task/CSV-to-HTML-translation/Ada/csv-to-html-translation-2.ada rename to Task/CSV-to-HTML-translation/Ada/csv-to-html-translation-2.adb diff --git a/Task/CSV-to-HTML-translation/Ada/csv-to-html-translation-3.ada b/Task/CSV-to-HTML-translation/Ada/csv-to-html-translation-3.adb similarity index 100% rename from Task/CSV-to-HTML-translation/Ada/csv-to-html-translation-3.ada rename to Task/CSV-to-HTML-translation/Ada/csv-to-html-translation-3.adb diff --git a/Task/CSV-to-HTML-translation/AutoIt/csv-to-html-translation.au3 b/Task/CSV-to-HTML-translation/AutoIt/csv-to-html-translation.au3 new file mode 100644 index 0000000000..050b3b68a8 --- /dev/null +++ b/Task/CSV-to-HTML-translation/AutoIt/csv-to-html-translation.au3 @@ -0,0 +1,28 @@ + Local $ascarray[4] = [34,38,60,62] + $String = "Character,Speech" & @CRLF + $String &= "The multitude,The messiah! Show us the messiah!" & @CRLF + $String &= "Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!" & @CRLF + $String &= "The multitude,Who are you?" & @CRLF + $String &= "Brians mother,I'm his mother; that's who!" & @CRLF + $String &= "The multitude,Behold his mother! Behold his mother!" + For $i = 0 To UBound($ascarray) -1 + $String = Stringreplace($String, chr($ascarray[$i]), "&#"&$ascarray[$i]&";") + Next + $newstring = "" & @CRLF + $crlfsplit = StringSplit($String, @CRLF, 1) + For $i = 1 To $crlfsplit[0] + If $i = 1 Then $newstring &= "" & @CRLF + $newstring &= "" & @CRLF + $komsplit = StringSplit($crlfsplit[$i], ",") + For $k = 1 To $komsplit[0] + If $i = 1 Then + $newstring &= "" & @CRLF + Else + $newstring &= "" & @CRLF + EndIf + Next + $newstring &= "" & @CRLF + If $i = 1 Then $newstring &= "" & @CRLF + Next + $newstring &= "
" &$komsplit[$k] & "" &$komsplit[$k] & "
" + ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $newstring = ' & $newstring & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console diff --git a/Task/CSV-to-HTML-translation/AutoIt/csv-to-html-translation.autoit b/Task/CSV-to-HTML-translation/AutoIt/csv-to-html-translation.autoit deleted file mode 100644 index a7f613cb1e..0000000000 --- a/Task/CSV-to-HTML-translation/AutoIt/csv-to-html-translation.autoit +++ /dev/null @@ -1,28 +0,0 @@ - Local $ascarray[4] = [34,38,60,62] - $String = "Character,Speech" & @CRLF - $String &= "The multitude,The messiah! Show us the messiah!" & @CRLF - $String &= "Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!" & @CRLF - $String &= "The multitude,Who are you?" & @CRLF - $String &= "Brians mother,I'm his mother; that's who!" & @CRLF - $String &= "The multitude,Behold his mother! Behold his mother!" - For $i = 0 To UBound($ascarray) -1 - $String = Stringreplace($String, chr($ascarray[$i]), "&#"&$ascarray[$i]&";") - Next - $newstring = "" & @CRLF - $crlfsplit = StringSplit($String, @CRLF, 1) - For $i = 1 To $crlfsplit[0] - If $i = 1 Then $newstring &= "" & @CRLF - $newstring &= "" & @CRLF - $komsplit = StringSplit($crlfsplit[$i], ",") - For $k = 1 To $komsplit[0] - If $i = 1 Then - $newstring &= "" & @CRLF - Else - $newstring &= "" & @CRLF - EndIf - Next - $newstring &= "" & @CRLF - If $i = 1 Then $newstring &= "" & @CRLF - Next - $newstring &= "
" &$komsplit[$k] & "" &$komsplit[$k] & "
" - ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $newstring = ' & $newstring & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console diff --git a/Task/CSV-to-HTML-translation/C++/csv-to-html-translation-1.cpp b/Task/CSV-to-HTML-translation/C++/csv-to-html-translation-1.cpp index aa156642cd..3d37c4ac15 100644 --- a/Task/CSV-to-HTML-translation/C++/csv-to-html-translation-1.cpp +++ b/Task/CSV-to-HTML-translation/C++/csv-to-html-translation-1.cpp @@ -7,10 +7,10 @@ std::string csvToHTML( const std::string & ) ; int main( ) { std::string text = "Character,Speech\n" "The multitude,The messiah! Show us the messiah!\n" - "Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!\n" - "The multitude,Who are you?\n" - "Brians mother,I'm his mother; that's who!\n" - "The multitude,Behold his mother! Behold his mother!\n" ; + "Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!\n" + "The multitude,Who are you?\n" + "Brians mother,I'm his mother; that's who!\n" + "The multitude,Behold his mother! Behold his mother!\n" ; std::cout << csvToHTML( text ) ; return 0 ; } diff --git a/Task/CSV-to-HTML-translation/C-sharp/csv-to-html-translation-4.cs b/Task/CSV-to-HTML-translation/C-sharp/csv-to-html-translation-4.cs index 57a1a95782..0f5c4a0ec4 100644 --- a/Task/CSV-to-HTML-translation/C-sharp/csv-to-html-translation-4.cs +++ b/Task/CSV-to-HTML-translation/C-sharp/csv-to-html-translation-4.cs @@ -1,26 +1,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
diff --git a/Task/CSV-to-HTML-translation/C/csv-to-html-translation-1.c b/Task/CSV-to-HTML-translation/C/csv-to-html-translation-1.c index 226784fac0..a4931a238c 100644 --- a/Task/CSV-to-HTML-translation/C/csv-to-html-translation-1.c +++ b/Task/CSV-to-HTML-translation/C/csv-to-html-translation-1.c @@ -1,29 +1,29 @@ #include const char *input = - "Character,Speech\n" - "The multitude,The messiah! Show us the messiah!\n" - "Brians mother,Now you listen here! He's not the messiah; " - "he's a very naughty boy! Now go away!\n" - "The multitude,Who are you?\n" - "Brians mother,I'm his mother; that's who!\n" - "The multitude,Behold his mother! Behold his mother!"; + "Character,Speech\n" + "The multitude,The messiah! Show us the messiah!\n" + "Brians mother,Now you listen here! He's not the messiah; " + "he's a very naughty boy! Now go away!\n" + "The multitude,Who are you?\n" + "Brians mother,I'm his mother; that's who!\n" + "The multitude,Behold his mother! Behold his mother!"; int main() { - const char *s; - printf("\n\n\n
"); - for (s = input; *s; s++) { - switch(*s) { - case '\n': printf("
"); break; - case ',': printf(""); break; - case '<': printf("<"); break; - case '>': printf(">"); break; - case '&': printf("&"); break; - default: putchar(*s); - } - } - puts("
"); + const char *s; + printf("\n\n\n
"); + for (s = input; *s; s++) { + switch(*s) { + case '\n': printf("
"); break; + case ',': printf(""); break; + case '<': printf("<"); break; + case '>': printf(">"); break; + case '&': printf("&"); break; + default: putchar(*s); + } + } + puts("
"); - return 0; + return 0; } diff --git a/Task/CSV-to-HTML-translation/CoffeeScript/csv-to-html-translation-1.coffee b/Task/CSV-to-HTML-translation/CoffeeScript/csv-to-html-translation-1.coffee index ed257aadae..3d1193f8f7 100644 --- a/Task/CSV-to-HTML-translation/CoffeeScript/csv-to-html-translation-1.coffee +++ b/Task/CSV-to-HTML-translation/CoffeeScript/csv-to-html-translation-1.coffee @@ -1,8 +1,8 @@ String::__defineGetter__ 'escaped', () -> - this.replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') // rosettacode doesn't like " + this.replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') // rosettacode doesn't like " text = ''' Character,Speech @@ -19,21 +19,21 @@ header = lines.shift() console.log """ - - - - - + + + + + """ for line in lines - [character, speech] = line - console.log """ - - - """ + [character, speech] = line + console.log """ + + + """ console.log """ - +
#{header[0]}#{header[1]}
#{header[0]}#{header[1]}
#{character}#{speech.escaped}#{character}#{speech.escaped}
- """ + """ diff --git a/Task/CSV-to-HTML-translation/Common-Lisp/csv-to-html-translation-1.lisp b/Task/CSV-to-HTML-translation/Common-Lisp/csv-to-html-translation-1.lisp index db8c7f95f8..b61d81aa92 100644 --- a/Task/CSV-to-HTML-translation/Common-Lisp/csv-to-html-translation-1.lisp +++ b/Task/CSV-to-HTML-translation/Common-Lisp/csv-to-html-translation-1.lisp @@ -8,9 +8,9 @@ The multitude,Behold his mother! Behold his mother!") (defun split-string (string delim-char) (let ((result '())) (do* ((start 0 (1+ end)) - (end (position delim-char string) - (position delim-char string :start start))) - ((not end) (reverse (cons (subseq string start) result))) + (end (position delim-char string) + (position delim-char string :start start))) + ((not end) (reverse (cons (subseq string start) result))) (push (subseq string start end) result)))) ;;; HTML escape code modified from: @@ -27,27 +27,27 @@ The multitude,Behold his mother! Behold his mother!") (let ((to-escape "<>&")) (flet ((needs-escape-p (char) (find char to-escape))) (with-output-to-string (out) - (loop for start = 0 then (1+ pos) - for pos = (position-if #'needs-escape-p in :start start) - do (write-sequence in out :start start :end pos) - when pos do (write-sequence (escape-char (char in pos)) out) - while pos))))) + (loop for start = 0 then (1+ pos) + for pos = (position-if #'needs-escape-p in :start start) + do (write-sequence in out :start start :end pos) + when pos do (write-sequence (escape-char (char in pos)) out) + while pos))))) (defun html-row (values headerp) (let ((tag (if headerp "th" "td"))) (with-output-to-string (out) (write-string "" out) (dolist (val values) - (format out "<~A>~A" tag (escape val) tag)) + (format out "<~A>~A" tag (escape val) tag)) (write-string "" out)))) (defun csv->html (csv) (let* ((lines (split-string csv #\Newline)) - (cols (split-string (first lines) #\,)) - (rows (mapcar (lambda (row) (split-string row #\,)) (rest lines)))) + (cols (split-string (first lines) #\,)) + (rows (mapcar (lambda (row) (split-string row #\,)) (rest lines)))) (with-output-to-string (html) (format html "~C" #\Newline) (format html "~C~A~C" #\Tab (html-row cols t) #\Newline) (dolist (row rows) - (format html "~C~A~C" #\Tab (html-row row nil) #\Newline)) + (format html "~C~A~C" #\Tab (html-row row nil) #\Newline)) (write-string "
" html)))) diff --git a/Task/CSV-to-HTML-translation/Common-Lisp/csv-to-html-translation-2.lisp b/Task/CSV-to-HTML-translation/Common-Lisp/csv-to-html-translation-2.lisp index 66cb3587a8..06570481c8 100644 --- a/Task/CSV-to-HTML-translation/Common-Lisp/csv-to-html-translation-2.lisp +++ b/Task/CSV-to-HTML-translation/Common-Lisp/csv-to-html-translation-2.lisp @@ -1,8 +1,8 @@ - - - - - - + + + + + +
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
diff --git a/Task/CSV-to-HTML-translation/Delphi/csv-to-html-translation-1.delphi b/Task/CSV-to-HTML-translation/Delphi/csv-to-html-translation-1.pas similarity index 100% rename from Task/CSV-to-HTML-translation/Delphi/csv-to-html-translation-1.delphi rename to Task/CSV-to-HTML-translation/Delphi/csv-to-html-translation-1.pas diff --git a/Task/CSV-to-HTML-translation/Delphi/csv-to-html-translation-2.delphi b/Task/CSV-to-HTML-translation/Delphi/csv-to-html-translation-2.pas similarity index 100% rename from Task/CSV-to-HTML-translation/Delphi/csv-to-html-translation-2.delphi rename to Task/CSV-to-HTML-translation/Delphi/csv-to-html-translation-2.pas diff --git a/Task/CSV-to-HTML-translation/Delphi/csv-to-html-translation-3.delphi b/Task/CSV-to-HTML-translation/Delphi/csv-to-html-translation-3.pas similarity index 100% rename from Task/CSV-to-HTML-translation/Delphi/csv-to-html-translation-3.delphi rename to Task/CSV-to-HTML-translation/Delphi/csv-to-html-translation-3.pas diff --git a/Task/CSV-to-HTML-translation/EasyLang/csv-to-html-translation.easy b/Task/CSV-to-HTML-translation/EasyLang/csv-to-html-translation.easy new file mode 100644 index 0000000000..7403d22932 --- /dev/null +++ b/Task/CSV-to-HTML-translation/EasyLang/csv-to-html-translation.easy @@ -0,0 +1,37 @@ +h$ = "\n\n\n\n
" +repeat + s$ = input + until s$ = "" + write h$ + for c$ in strchars s$ + if c$ = "," + if scnd = 0 + c$ = "" + else + c$ = "" + . + elif c$ = "<" + c$ = "<" + elif c$ = ">" + c$ = ">" + elif c$ = "&" + c$ = "&" + . + write c$ + . + if scnd = 0 + h$ = "
" + scnd = 1 + else + h$ = "
" + . +. +print "
" +# +input_data +Character,Speech +The multitude,The messiah! Show us the messiah! +Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away! +The multitude,Who are you? +Brians mother,I'm his mother; that's who! +The multitude,Behold his mother! Behold his mother! diff --git a/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-1.l b/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-1.l index a7a16c05df..d19889b08f 100644 --- a/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-1.l +++ b/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-1.l @@ -5,25 +5,25 @@ ;; LISTS->HTML (define html 'html) (define (emit-tag tag html-proc content ) - (if (style tag) - (push html (format "<%s style='%a'>" tag (style tag))) - (push html (format "<%s>" tag ))) - (html-proc content) - (push html (format " " tag ))) - + (if (style tag) + (push html (format "<%s style='%a'>" tag (style tag))) + (push html (format "<%s>" tag ))) + (html-proc content) + (push html (format " " tag ))) + ;; html procs : 1 tag, 1 proc (define (h-raw content) - (push html (format "%s" content))) + (push html (format "%s" content))) (define (h-header headers) - (for ((h headers)) (emit-tag 'th h-raw h))) + (for ((h headers)) (emit-tag 'th h-raw h))) (define (h-row row) - (for ((item row)) (emit-tag 'td h-raw item))) + (for ((item row)) (emit-tag 'td h-raw item))) (define (h-table table ) - (emit-tag 'tr h-header (first table)) - (for ((row (rest table))) (emit-tag 'tr h-row row))) - + (emit-tag 'tr h-header (first table)) + (for ((row (rest table))) (emit-tag 'tr h-row row))) + (define (html-dump) (string-join (stack->list html) " ")) - + ;; STYLES (style 'td "text-align:left") (style 'table "border-spacing: 10px;border:28px ridge orange") ;; special biblical border diff --git a/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-2.l b/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-2.l index 777daf9665..72ca8f6071 100644 --- a/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-2.l +++ b/Task/CSV-to-HTML-translation/EchoLisp/csv-to-html-translation-2.l @@ -9,9 +9,9 @@ >>#) (define (task speech) - (define table (csv->table speech)) - (stack html) - (emit-tag 'table h-table table) - (html-dump)) - + (define table (csv->table speech)) + (stack html) + (emit-tag 'table h-table table) + (html-dump)) + (task MontyPython) diff --git a/Task/CSV-to-HTML-translation/Ed/csv-to-html-translation.ed b/Task/CSV-to-HTML-translation/Ed/csv-to-html-translation.ed new file mode 100644 index 0000000000..88664bdb10 --- /dev/null +++ b/Task/CSV-to-HTML-translation/Ed/csv-to-html-translation.ed @@ -0,0 +1,15 @@ +H +g/&/s//\&/g +g//s//\>/g +g/"/s//\"e;/g +g/^/s// /g +g/,/s//<\/td>/g +g/$/s//<\/td>\ + <\/tr>/ +1s/^/\ +/ +$s/$/\ +<\/table>/ +,p +Q diff --git a/Task/CSV-to-HTML-translation/Erlang/csv-to-html-translation.erl b/Task/CSV-to-HTML-translation/Erlang/csv-to-html-translation.erl index b319341dbb..31bfd905e1 100644 --- a/Task/CSV-to-HTML-translation/Erlang/csv-to-html-translation.erl +++ b/Task/CSV-to-HTML-translation/Erlang/csv-to-html-translation.erl @@ -3,9 +3,9 @@ -export( [table_translation/1, task/0] ). table_translation( CSV ) -> - [Headers | Contents] = [string:tokens(X, ",") || X <- string:tokens( CSV, "\n")], - Table = create_html_table:html_table( [{border, "1"}, {cellpadding, "10"}], Headers, Contents ), - create_html_table:external_format( Table ). + [Headers | Contents] = [string:tokens(X, ",") || X <- string:tokens( CSV, "\n")], + Table = create_html_table:html_table( [{border, "1"}, {cellpadding, "10"}], Headers, Contents ), + create_html_table:external_format( Table ). task() -> table_translation( csv() ). diff --git a/Task/CSV-to-HTML-translation/Euphoria/csv-to-html-translation-1.euphoria b/Task/CSV-to-HTML-translation/Euphoria/csv-to-html-translation-1.eu similarity index 100% rename from Task/CSV-to-HTML-translation/Euphoria/csv-to-html-translation-1.euphoria rename to Task/CSV-to-HTML-translation/Euphoria/csv-to-html-translation-1.eu diff --git a/Task/CSV-to-HTML-translation/Euphoria/csv-to-html-translation-2.euphoria b/Task/CSV-to-HTML-translation/Euphoria/csv-to-html-translation-2.eu similarity index 100% rename from Task/CSV-to-HTML-translation/Euphoria/csv-to-html-translation-2.euphoria rename to Task/CSV-to-HTML-translation/Euphoria/csv-to-html-translation-2.eu diff --git a/Task/CSV-to-HTML-translation/Forth/csv-to-html-translation-1.fth b/Task/CSV-to-HTML-translation/Forth/csv-to-html-translation-1.fth index b59459c399..9bf8d4b906 100644 --- a/Task/CSV-to-HTML-translation/Forth/csv-to-html-translation-1.fth +++ b/Task/CSV-to-HTML-translation/Forth/csv-to-html-translation-1.fth @@ -5,18 +5,18 @@ : END-ROW END-COLUMN ." " CR ; : CSV2HTML - ."
" CR BEGIN-ROW - BEGIN KEY DUP #EOF <> WHILE - CASE - 10 OF END-ROW BEGIN-ROW ENDOF - [CHAR] , OF END-COLUMN BEGIN-COLUMN ENDOF - [CHAR] < OF ." <" ENDOF - [CHAR] > OF ." >" ENDOF - [CHAR] & OF ." &" ENDOF - DUP EMIT - ENDCASE - REPEAT - END-ROW ."
" CR + ." " CR BEGIN-ROW + BEGIN KEY DUP #EOF <> WHILE + CASE + 10 OF END-ROW BEGIN-ROW ENDOF + [CHAR] , OF END-COLUMN BEGIN-COLUMN ENDOF + [CHAR] < OF ." <" ENDOF + [CHAR] > OF ." >" ENDOF + [CHAR] & OF ." &" ENDOF + DUP EMIT + ENDCASE + REPEAT + END-ROW ."
" CR ; CSV2HTML BYE diff --git a/Task/CSV-to-HTML-translation/Fortran/csv-to-html-translation.f b/Task/CSV-to-HTML-translation/Fortran/csv-to-html-translation.f index 73683283d8..99aae70f36 100644 --- a/Task/CSV-to-HTML-translation/Fortran/csv-to-html-translation.f +++ b/Task/CSV-to-HTML-translation/Fortran/csv-to-html-translation.f @@ -1,71 +1,71 @@ - SUBROUTINE CSVTEXT2HTML(FNAME,HEADED) !Does not recognise quoted strings. + SUBROUTINE CSVTEXT2HTML(FNAME,HEADED) !Does not recognise quoted strings. Converts without checking field counts, or noting special characters. - CHARACTER*(*) FNAME !Names the input file. - LOGICAL HEADED !Perhaps its first line is to be a heading. - INTEGER MANY !How long is a piece of string? - PARAMETER (MANY=666) !This should suffice. - CHARACTER*(MANY) ALINE !A scratchpad for the input. - INTEGER MARK(0:MANY + 1) !Fingers the commas on a line. - INTEGER I,L,N !Assistants. - CHARACTER*2 WOT(2) !I don't see why a "table datum" could not be for either. - PARAMETER (WOT = (/"th","td"/)) !A table heding or a table datum - INTEGER IT !But, one must select appropriately. - INTEGER KBD,MSG,IN !A selection. - COMMON /IOUNITS/ KBD,MSG,IN !The caller thus avoids collisions. - OPEN(IN,FILE=FNAME,STATUS="OLD",ACTION="READ",ERR=661) !Go for the file. - WRITE (MSG,1) !Start the blather. - 1 FORMAT ("") !By stating that a table follows. - MARK(0) = 0 !Syncopation for the comma fingers. - N = 0 !No records read. + CHARACTER*(*) FNAME !Names the input file. + LOGICAL HEADED !Perhaps its first line is to be a heading. + INTEGER MANY !How long is a piece of string? + PARAMETER (MANY=666) !This should suffice. + CHARACTER*(MANY) ALINE !A scratchpad for the input. + INTEGER MARK(0:MANY + 1) !Fingers the commas on a line. + INTEGER I,L,N !Assistants. + CHARACTER*2 WOT(2) !I don't see why a "table datum" could not be for either. + PARAMETER (WOT = (/"th","td"/)) !A table heding or a table datum + INTEGER IT !But, one must select appropriately. + INTEGER KBD,MSG,IN !A selection. + COMMON /IOUNITS/ KBD,MSG,IN !The caller thus avoids collisions. + OPEN(IN,FILE=FNAME,STATUS="OLD",ACTION="READ",ERR=661) !Go for the file. + WRITE (MSG,1) !Start the blather. + 1 FORMAT ("
") !By stating that a table follows. + MARK(0) = 0 !Syncopation for the comma fingers. + N = 0 !No records read. - 10 READ (IN,11,END = 20) L,ALINE(1:MIN(L,MANY)) !Carefully acquire some text. - 11 FORMAT (Q,A) !Q = number of characters yet to read, A = characters. - N = N + 1 !So, a record has been read. - IF (L.GT.MANY) THEN !Perhaps it is rather long? - WRITE (MSG,12) N,L,MANY !Alas! - 12 FORMAT ("Line ",I0," has length ",I0,"! My limit is ",I0) !Squawk/ - L = MANY !The limit actually read. - END IF !So much for paranoia. - IF (N.EQ.1 .AND. HEADED) THEN !Is the first line to be treated specially? - WRITE (MSG,*) "" !Yep. Nominate a heading. - IT = 1 !And select "th" rather than "td". - ELSE !But mostly, - IT = 2 !Just another row for the table. - END IF !So much for the first line. - NCOLS = 0 !No commas have been seen. - DO I = 1,L !So scan the text for them. - IF (ICHAR(ALINE(I:I)).EQ.ICHAR(",")) THEN !Here? - NCOLS = NCOLS + 1 !Yes! - MARK(NCOLS) = I !The texts are between commas. - END IF !So much for that character. - END DO !On to the next. - NCOLS = NCOLS + 1 !This is why the + 1 for the size of MARK. - MARK(NCOLS) = L + 1 !End-of-line is as if a comma was one further along. - WRITE (MSG,13) !Now roll all the texts. - 1 (WOT(IT), !This starting a cell, - 2 ALINE(MARK(I - 1) + 1:MARK(I) - 1), !This being the text between the commas, - 3 WOT(IT), !And this ending each cell. - 4 I = 1,NCOLS), !For this number of columns. - 5 "/tr" !And this ends the row. - 13 FORMAT (" ",666("<",A,">",A,"")) !How long is a piece of string? - IF (N.EQ.1 .AND. HEADED) WRITE (MSG,*) "" !Finish the possible header. - GO TO 10 !And try for another record. + 10 READ (IN,11,END = 20) L,ALINE(1:MIN(L,MANY)) !Carefully acquire some text. + 11 FORMAT (Q,A) !Q = number of characters yet to read, A = characters. + N = N + 1 !So, a record has been read. + IF (L.GT.MANY) THEN !Perhaps it is rather long? + WRITE (MSG,12) N,L,MANY !Alas! + 12 FORMAT ("Line ",I0," has length ",I0,"! My limit is ",I0) !Squawk/ + L = MANY !The limit actually read. + END IF !So much for paranoia. + IF (N.EQ.1 .AND. HEADED) THEN !Is the first line to be treated specially? + WRITE (MSG,*) "" !Yep. Nominate a heading. + IT = 1 !And select "th" rather than "td". + ELSE !But mostly, + IT = 2 !Just another row for the table. + END IF !So much for the first line. + NCOLS = 0 !No commas have been seen. + DO I = 1,L !So scan the text for them. + IF (ICHAR(ALINE(I:I)).EQ.ICHAR(",")) THEN !Here? + NCOLS = NCOLS + 1 !Yes! + MARK(NCOLS) = I !The texts are between commas. + END IF !So much for that character. + END DO !On to the next. + NCOLS = NCOLS + 1 !This is why the + 1 for the size of MARK. + MARK(NCOLS) = L + 1 !End-of-line is as if a comma was one further along. + WRITE (MSG,13) !Now roll all the texts. + 1 (WOT(IT), !This starting a cell, + 2 ALINE(MARK(I - 1) + 1:MARK(I) - 1), !This being the text between the commas, + 3 WOT(IT), !And this ending each cell. + 4 I = 1,NCOLS), !For this number of columns. + 5 "/tr" !And this ends the row. + 13 FORMAT (" ",666("<",A,">",A,"")) !How long is a piece of string? + IF (N.EQ.1 .AND. HEADED) WRITE (MSG,*) "" !Finish the possible header. + GO TO 10 !And try for another record. - 20 CLOSE (IN) !Finished with input. - WRITE (MSG,21) !And finished with output. - 21 FORMAT ("
") !This writes starting at column one. - RETURN !Done! + 20 CLOSE (IN) !Finished with input. + WRITE (MSG,21) !And finished with output. + 21 FORMAT ("") !This writes starting at column one. + RETURN !Done! Confusions. - 661 WRITE (MSG,*) "Can't open file ",FNAME !Alas. - END !So much for the conversion. + 661 WRITE (MSG,*) "Can't open file ",FNAME !Alas. + END !So much for the conversion. INTEGER KBD,MSG,IN COMMON /IOUNITS/ KBD,MSG,IN - KBD = 5 !Standard input. - MSG = 6 !Standard output. - IN = 10 !Some unspecial number. + KBD = 5 !Standard input. + MSG = 6 !Standard output. + IN = 10 !Some unspecial number. - CALL CSVTEXT2HTML("Text.csv",.FALSE.) !The first line is not special. + CALL CSVTEXT2HTML("Text.csv",.FALSE.) !The first line is not special. WRITE (MSG,*) - CALL CSVTEXT2HTML("Text.csv",.TRUE.) !The first line is a heading. + CALL CSVTEXT2HTML("Text.csv",.TRUE.) !The first line is a heading. END diff --git a/Task/CSV-to-HTML-translation/Haskell/csv-to-html-translation-2.hs b/Task/CSV-to-HTML-translation/Haskell/csv-to-html-translation-2.hs index e1a1189b39..19062de634 100644 --- a/Task/CSV-to-HTML-translation/Haskell/csv-to-html-translation-2.hs +++ b/Task/CSV-to-HTML-translation/Haskell/csv-to-html-translation-2.hs @@ -6,6 +6,6 @@ main = interact (\csv -> "\n" ++ (unlines $ map ((\cols -> "\n" ++ (concatMap (\x -> " \n") cols) ++ "") . split (==',')) $ lines csv) ++ "
" ++ concatMap (\c -> case c of {'<' -> "<"; '>' -> ">"; - '&' -> "&"; '"' -> """; _ -> [c]}) x + '&' -> "&"; '"' -> """; _ -> [c]}) x ++ "
") diff --git a/Task/CSV-to-HTML-translation/Java/csv-to-html-translation-2.java b/Task/CSV-to-HTML-translation/Java/csv-to-html-translation-2.java index 348dee6b96..854a68e627 100644 --- a/Task/CSV-to-HTML-translation/Java/csv-to-html-translation-2.java +++ b/Task/CSV-to-HTML-translation/Java/csv-to-html-translation-2.java @@ -4,83 +4,83 @@ import java.io.PrintStream; class Csv2Html { - public static String escapeChars(String lineIn) { - StringBuilder sb = new StringBuilder(); - int lineLength = lineIn.length(); - for (int i = 0; i < lineLength; i++) { - char c = lineIn.charAt(i); - switch (c) { - case '"': - sb.append("""); - break; - case '&': - sb.append("&"); - break; - case '\'': - sb.append("'"); - break; - case '<': - sb.append("<"); - break; - case '>': - sb.append(">"); - break; - default: sb.append(c); - } - } - return sb.toString(); - } + public static String escapeChars(String lineIn) { + StringBuilder sb = new StringBuilder(); + int lineLength = lineIn.length(); + for (int i = 0; i < lineLength; i++) { + char c = lineIn.charAt(i); + switch (c) { + case '"': + sb.append("""); + break; + case '&': + sb.append("&"); + break; + case '\'': + sb.append("'"); + break; + case '<': + sb.append("<"); + break; + case '>': + sb.append(">"); + break; + default: sb.append(c); + } + } + return sb.toString(); + } - public static void tableHeader(PrintStream ps, String[] columns) { - ps.print(""); - for (int i = 0; i < columns.length; i++) { - ps.print(""); - ps.print(columns[i]); - ps.print(""); - } - ps.println(""); - } - - public static void tableRow(PrintStream ps, String[] columns) { - ps.print(""); - for (int i = 0; i < columns.length; i++) { - ps.print(""); - ps.print(columns[i]); - ps.print(""); - } - ps.println(""); - } - - public static void main(String[] args) throws Exception { - boolean withTableHeader = (args.length != 0); - - InputStreamReader isr = new InputStreamReader(System.in); - BufferedReader br = new BufferedReader(isr); - PrintStream stdout = System.out; - - stdout.println(""); - stdout.println(""); - stdout.println(""); - stdout.println("Csv2Html"); - stdout.println(""); - stdout.println("

Csv2Html

"); + public static void tableHeader(PrintStream ps, String[] columns) { + ps.print(""); + for (int i = 0; i < columns.length; i++) { + ps.print(""); + ps.print(columns[i]); + ps.print(""); + } + ps.println(""); + } - stdout.println(""); - String stdinLine; - boolean firstLine = true; - while ((stdinLine = br.readLine()) != null) { - String[] columns = escapeChars(stdinLine).split(","); - if (withTableHeader == true && firstLine == true) { - tableHeader(stdout, columns); - firstLine = false; - } else { - tableRow(stdout, columns); - } - } - stdout.println("
"); - } + public static void tableRow(PrintStream ps, String[] columns) { + ps.print(""); + for (int i = 0; i < columns.length; i++) { + ps.print(""); + ps.print(columns[i]); + ps.print(""); + } + ps.println(""); + } + + public static void main(String[] args) throws Exception { + boolean withTableHeader = (args.length != 0); + + InputStreamReader isr = new InputStreamReader(System.in); + BufferedReader br = new BufferedReader(isr); + PrintStream stdout = System.out; + + stdout.println(""); + stdout.println(""); + stdout.println(""); + stdout.println("Csv2Html"); + stdout.println(""); + stdout.println("

Csv2Html

"); + + stdout.println(""); + String stdinLine; + boolean firstLine = true; + while ((stdinLine = br.readLine()) != null) { + String[] columns = escapeChars(stdinLine).split(","); + if (withTableHeader == true && firstLine == true) { + tableHeader(stdout, columns); + firstLine = false; + } else { + tableRow(stdout, columns); + } + } + stdout.println("
"); + } } diff --git a/Task/CSV-to-HTML-translation/JavaScript/csv-to-html-translation-1.js b/Task/CSV-to-HTML-translation/JavaScript/csv-to-html-translation-1.js index 216911471c..c3c985804f 100644 --- a/Task/CSV-to-HTML-translation/JavaScript/csv-to-html-translation-1.js +++ b/Task/CSV-to-HTML-translation/JavaScript/csv-to-html-translation-1.js @@ -1,9 +1,9 @@ var csv = "Character,Speech\n" + - "The multitude,The messiah! Show us the messiah!\n" + - "Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!\n" + - "The multitude,Who are you?\n" + - "Brians mother,I'm his mother; that's who!\n" + - "The multitude,Behold his mother! Behold his mother!"; + "The multitude,The messiah! Show us the messiah!\n" + + "Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!\n" + + "The multitude,Who are you?\n" + + "Brians mother,I'm his mother; that's who!\n" + + "The multitude,Behold his mother! Behold his mother!"; var lines = csv.replace(/&/g, '&') .replace(/ - - CharacterSpeech - - - The multitudeThe messiah! Show us the messiah! - Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry> - The multitudeWho are you? - Brians motherI'm his mother; that's who! - The multitudeBehold his mother! Behold his mother! + + CharacterSpeech + + + The multitudeThe messiah! Show us the messiah! + Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry> + The multitudeWho are you? + Brians motherI'm his mother; that's who! + The multitudeBehold his mother! Behold his mother! diff --git a/Task/CSV-to-HTML-translation/JavaScript/csv-to-html-translation-4.js b/Task/CSV-to-HTML-translation/JavaScript/csv-to-html-translation-4.js new file mode 100644 index 0000000000..1124a5e5d1 --- /dev/null +++ b/Task/CSV-to-HTML-translation/JavaScript/csv-to-html-translation-4.js @@ -0,0 +1,40 @@ +function csvToHtml(input) { + if (!input || typeof input !== 'string') { + throw new Error('Invalid input!'); + } + + function _createTableCell(cellContents, index) { + if (!cellContents || typeof cellContents !== 'string') { + throw new Error('Invalid data!'); + } + + const tableCell = document.createElement( + (index === 0) ? 'th' : 'td' + ); + + tableCell.textContent = cellContents.trim(); + return tableCell; + } + + const rows = input.split('\n'); + const table = document.createElement('table'); + + rows.forEach((row, index) => { + const tableRow = document.createElement('tr'); + const tableCells = row.split(','); + + tableCells.forEach((cell) => { + try { + tableRow.appendChild( + _createTableCell(cell, index), + ); + } catch (error) { + console.error(error); + } + }); + + table.appendChild(tableRow); + }); + + return table; +} diff --git a/Task/CSV-to-HTML-translation/JavaScript/csv-to-html-translation-5.js b/Task/CSV-to-HTML-translation/JavaScript/csv-to-html-translation-5.js new file mode 100644 index 0000000000..986924331b --- /dev/null +++ b/Task/CSV-to-HTML-translation/JavaScript/csv-to-html-translation-5.js @@ -0,0 +1,14 @@ +const inputData = `Character,Speech +The multitude,The messiah! Show us the messiah! +Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away! +The multitude,Who are you? +Brians mother,I'm his mother; that's who! +The multitude,Behold his mother! Behold his mother!`; + +try { + document.body.append( + csvToHtml(inputData), + ); +} catch (error) { + console.error(error) +} diff --git a/Task/CSV-to-HTML-translation/Julia/csv-to-html-translation-1.julia b/Task/CSV-to-HTML-translation/Julia/csv-to-html-translation-1.jl similarity index 100% rename from Task/CSV-to-HTML-translation/Julia/csv-to-html-translation-1.julia rename to Task/CSV-to-HTML-translation/Julia/csv-to-html-translation-1.jl diff --git a/Task/CSV-to-HTML-translation/Julia/csv-to-html-translation-2.julia b/Task/CSV-to-HTML-translation/Julia/csv-to-html-translation-2.jl similarity index 100% rename from Task/CSV-to-HTML-translation/Julia/csv-to-html-translation-2.julia rename to Task/CSV-to-HTML-translation/Julia/csv-to-html-translation-2.jl diff --git a/Task/CSV-to-HTML-translation/Kotlin/csv-to-html-translation-1.kotlin b/Task/CSV-to-HTML-translation/Kotlin/csv-to-html-translation-1.kts similarity index 100% rename from Task/CSV-to-HTML-translation/Kotlin/csv-to-html-translation-1.kotlin rename to Task/CSV-to-HTML-translation/Kotlin/csv-to-html-translation-1.kts diff --git a/Task/CSV-to-HTML-translation/Kotlin/csv-to-html-translation-2.kotlin b/Task/CSV-to-HTML-translation/Kotlin/csv-to-html-translation-2.kts similarity index 100% rename from Task/CSV-to-HTML-translation/Kotlin/csv-to-html-translation-2.kotlin rename to Task/CSV-to-HTML-translation/Kotlin/csv-to-html-translation-2.kts diff --git a/Task/CSV-to-HTML-translation/M2000-Interpreter/csv-to-html-translation.m2000 b/Task/CSV-to-HTML-translation/M2000-Interpreter/csv-to-html-translation.m2000 index af515e282b..446db07183 100644 --- a/Task/CSV-to-HTML-translation/M2000-Interpreter/csv-to-html-translation.m2000 +++ b/Task/CSV-to-HTML-translation/M2000-Interpreter/csv-to-html-translation.m2000 @@ -1,72 +1,72 @@ module csv2html { - nl$={ - } - Repl$=lambda$ (a$) ->{ - a$=replace$("&", "&",a$) - a$=replace$(">", ">",a$) - a$=replace$("""", """,a$) - // add any other replacement here - =replace$("<", "<",a$) - } - Tag$=lambda$ nl$, repl$ (a$, b$, n=4)->{ - if n>0 then - a$=rtrim$(replace$(nl$, nl$+string$(" ", n), nl$+a$)) - if right$(a$,2)<>nl$ then a$+=nl$ - else - if right$(a$, 2)=nl$ then if left$(a$,2)<>nl$ then a$=nl$+a$ - end if - prop=(,) : Read ? prop // forth parameter optional (we have to initalize first with an empty array) - p=each(prop) : prop$="" // p is an iteration object. - while p - prop$+=" "+repl$(prop#val$(p^))+"="+quote$(repl$(prop#val$(p^+1))) - p=each(prop,p^+2) // start new from p^+2 (p^ is the internal counter) - end while - ="<"+b$+prop$+">"+a$+""+nl$ - } - - // Prepare FILE csv - tofile$={Character,Speech - The multitude,The messiah! Show us the messiah! - Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away! - The multitude,Who are you? - Brians mother,I'm his mother; that's who! - The multitude,Behold his mother! Behold his mother! - } - open "forHtml.csv" for wide output as #f - Print #f, tofile$; - close #f - // prepare the input style for Input from file statement - // "," - we use comma between fields - // "." - for numbers we use dot for decimal separator - // false - we didn't read json style strings to normal strings (so \n convert to code 13, \t to code 9) - // true - we read strings unquote - input with ",",".",false, true - - // Read csv file - i=1 - document export$="" - Open "forHtml.csv" for wide input as #f - while not eof(#f) - input #f, a$, b$ - a$=repl$(a$) - b$=repl$(b$) - if i=1 then - export$+=tag$(tag$(a$, "th", 0)+tag$(b$,"th", 0), "tr", 4) - else - export$+=tag$(tag$(a$, "td", 0)+tag$(b$,"td", 0), "tr", 4) - end if - i++ - end while - close #f - style$=tag$({TD {background-color:#ddddff; } - thead TD {background-color:#ddffdd; text-align:center; } - },"style",4,("type", "text/css")) - title$= tag$("CSV to HTML translation - Extra Credit","title",0) - Head$= tag$(title$+ style$,"head") - html$={}+nl$+tag$(head$+tag$(tag$(export$, "table"), "body"), "html") - clipboard html$ - Report html$ - Print "Press Esc to exit browser" - browser "about: "+html$ + nl$={ + } + Repl$=lambda$ (a$) ->{ + a$=replace$("&", "&",a$) + a$=replace$(">", ">",a$) + a$=replace$("""", """,a$) + // add any other replacement here + =replace$("<", "<",a$) + } + Tag$=lambda$ nl$, repl$ (a$, b$, n=4)->{ + if n>0 then + a$=rtrim$(replace$(nl$, nl$+string$(" ", n), nl$+a$)) + if right$(a$,2)<>nl$ then a$+=nl$ + else + if right$(a$, 2)=nl$ then if left$(a$,2)<>nl$ then a$=nl$+a$ + end if + prop=(,) : Read ? prop // forth parameter optional (we have to initalize first with an empty array) + p=each(prop) : prop$="" // p is an iteration object. + while p + prop$+=" "+repl$(prop#val$(p^))+"="+quote$(repl$(prop#val$(p^+1))) + p=each(prop,p^+2) // start new from p^+2 (p^ is the internal counter) + end while + ="<"+b$+prop$+">"+a$+""+nl$ + } + + // Prepare FILE csv + tofile$={Character,Speech + The multitude,The messiah! Show us the messiah! + Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away! + The multitude,Who are you? + Brians mother,I'm his mother; that's who! + The multitude,Behold his mother! Behold his mother! + } + open "forHtml.csv" for wide output as #f + Print #f, tofile$; + close #f + // prepare the input style for Input from file statement + // "," - we use comma between fields + // "." - for numbers we use dot for decimal separator + // false - we didn't read json style strings to normal strings (so \n convert to code 13, \t to code 9) + // true - we read strings unquote + input with ",",".",false, true + + // Read csv file + i=1 + document export$="" + Open "forHtml.csv" for wide input as #f + while not eof(#f) + input #f, a$, b$ + a$=repl$(a$) + b$=repl$(b$) + if i=1 then + export$+=tag$(tag$(a$, "th", 0)+tag$(b$,"th", 0), "tr", 4) + else + export$+=tag$(tag$(a$, "td", 0)+tag$(b$,"td", 0), "tr", 4) + end if + i++ + end while + close #f + style$=tag$({TD {background-color:#ddddff; } + thead TD {background-color:#ddffdd; text-align:center; } + },"style",4,("type", "text/css")) + title$= tag$("CSV to HTML translation - Extra Credit","title",0) + Head$= tag$(title$+ style$,"head") + html$={}+nl$+tag$(head$+tag$(tag$(export$, "table"), "body"), "html") + clipboard html$ + Report html$ + Print "Press Esc to exit browser" + browser "about: "+html$ } csv2html diff --git a/Task/CSV-to-HTML-translation/MATLAB/csv-to-html-translation-3.m b/Task/CSV-to-HTML-translation/MATLAB/csv-to-html-translation-3.m index fc8d987cac..26001f6ada 100644 --- a/Task/CSV-to-HTML-translation/MATLAB/csv-to-html-translation-3.m +++ b/Task/CSV-to-HTML-translation/MATLAB/csv-to-html-translation-3.m @@ -1,25 +1,25 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + +
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
diff --git a/Task/CSV-to-HTML-translation/Maple/csv-to-html-translation.maple b/Task/CSV-to-HTML-translation/Maple/csv-to-html-translation.maple index 5b6d65d7eb..0203f01f0d 100644 --- a/Task/CSV-to-HTML-translation/Maple/csv-to-html-translation.maple +++ b/Task/CSV-to-HTML-translation/Maple/csv-to-html-translation.maple @@ -1,10 +1,10 @@ #A translation of the C code posted html_table := proc(str) - local char; + local char; printf("\n\n\n\n" + htmlrow = "\t\n" - // loop through the values in the current csv row - for i in range(1, len(record)) - htmlrow = htmlrow + "\t\t<" + tag + ">" + (record ~ i) + "\n" - end for + // loop through the values in the current csv row + for i in range(1, len(record)) + htmlrow = htmlrow + "\t\t<" + tag + ">" + (record ~ i) + "\n" + end for - return htmlrow + "\t\n" + return htmlrow + "\t\n" end def // get the name of the csv file then open it @@ -23,7 +23,7 @@ htmltable = (htmltable + toHtmlRow(#0, "th")) // add all other rows to the table for i in range(1, $dbsize) - htmltable = (htmltable + toHtmlRow(#i, "td")) + htmltable = (htmltable + toHtmlRow(#i, "td")) end for // close the html table diff --git a/Task/CSV-to-HTML-translation/Nom/csv-to-html-translation-1.num b/Task/CSV-to-HTML-translation/Nom/csv-to-html-translation-1.num new file mode 100644 index 0000000000..c250b2c016 --- /dev/null +++ b/Task/CSV-to-HTML-translation/Nom/csv-to-html-translation-1.num @@ -0,0 +1,85 @@ +#* +(this is a multiline comment in Nom) + +GRAMMAR OR PARSE TOKENS + nl* - new line, end of line + field* - one csv field + fieldset* - a number of fields + record* - one record (line) or a set of csv fields + recordset* - +*# + + # using the empty recordset trick + begin { + add "recordset*"; push; + } + read; + # ignore whitespace outside of quotes + " " { while [ ]; clear; .restart } + "\n" { put; clear; add "nl*"; push; .reparse } + '"' { + until '"'; clip; clop; unescape '"'; + whilenot [\n,]; + replace "&" "&"; replace "<" "<"; replace ">" ">"; + put; clear; add ""; put; clear; + add "field*"; push; + clear; .reparse + } + "," { clear; } + + whilenot [\n,]; + replace "&" "&"; replace "<" "<"; replace ">" ">"; + put; clear; add ""; put; clear; + add "field*"; push; + +parse> + # useful for debugging + #add "line "; lines; add " char "; chars; add ": "; print; clear; + #add "\n"; unstack; print; clip; stack; + + # 1 token + pop; + # a record may be terminated by the end of input + (eof)."fieldset*" { + clear; add ""; get; add "\n"; put; clear; + add "record*"; push; .reparse + } + # 2 tokens + pop; + "recordset*field*" { + replace "field" "fieldset"; push; push; .reparse + } + # ignore blank lines + "recordset*nl*" { + clip; clip; clip; push; .reparse + } + "fieldset*field*" { + clear; get; ++; get; --; put; clear; + add "fieldset*"; push; .reparse + } + "fieldset*nl*" { + clear; add "\n "; get; add "\n"; put; clear; + add "record*"; push; .reparse + } + "recordset*record*" { + clear; a+; get; + ++; get; --; put; clear; + # if the count is 1, then this is the 1st + # record and should be marked up as a table header. + count; "1" { + clear; get; replace "tr>" "thead>"; put; + } + clear; add "recordset*"; push; .reparse + } + + (eof) { + !"recordset*" { + clear; add "[invalid csv]\nThe parse stack was: "; print; + clear; unstack; add "\n"; print; quit; + } + clear; + add "
"); for char in str do if char = "\n" then - printf("
") + printf("
") elif char = "," then printf("") elif char = "<" then @@ -12,7 +12,7 @@ html_table := proc(str) elif char = ">" then printf(">") elif char = "&" then - printf("&") + printf("&") else printf(char) end if; diff --git a/Task/CSV-to-HTML-translation/Nanoquery/csv-to-html-translation.nanoquery b/Task/CSV-to-HTML-translation/Nanoquery/csv-to-html-translation.nanoquery index 1421fc83b6..7af517fddc 100644 --- a/Task/CSV-to-HTML-translation/Nanoquery/csv-to-html-translation.nanoquery +++ b/Task/CSV-to-HTML-translation/Nanoquery/csv-to-html-translation.nanoquery @@ -1,13 +1,13 @@ // a method that converts a csv row into a html table row as a string def toHtmlRow(record, tag) - htmlrow = "\t
"; get; add ""; get; add "
\n"; get; add "
\n"; + add "[valid csv!] Found "; count; add " records.\n"; + print; quit; + } + push; push; diff --git a/Task/CSV-to-HTML-translation/Nom/csv-to-html-translation-2.num b/Task/CSV-to-HTML-translation/Nom/csv-to-html-translation-2.num new file mode 100644 index 0000000000..fa64e7c50e --- /dev/null +++ b/Task/CSV-to-HTML-translation/Nom/csv-to-html-translation-2.num @@ -0,0 +1,14 @@ + + + + + + + + + + + + + +
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
diff --git a/Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-1.ocaml b/Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-1.ml similarity index 100% rename from Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-1.ocaml rename to Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-1.ml diff --git a/Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-2.ocaml b/Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-2.ml similarity index 100% rename from Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-2.ocaml rename to Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-2.ml diff --git a/Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-3.ocaml b/Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-3.ml similarity index 100% rename from Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-3.ocaml rename to Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-3.ml diff --git a/Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-4.ocaml b/Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-4.ml similarity index 100% rename from Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-4.ocaml rename to Task/CSV-to-HTML-translation/OCaml/csv-to-html-translation-4.ml diff --git a/Task/CSV-to-HTML-translation/OmniMark/csv-to-html-translation-1.xom b/Task/CSV-to-HTML-translation/OmniMark/csv-to-html-translation-1.xom new file mode 100644 index 0000000000..10f9ee5923 --- /dev/null +++ b/Task/CSV-to-HTML-translation/OmniMark/csv-to-html-translation-1.xom @@ -0,0 +1,73 @@ +global switch thead initial {true} +global switch tbody-first initial {true} + +define function process-tr (value stream line) as + do when thead + output '%n' + else when tbody-first + output '%n' + output '%n' + deactivate tbody-first + else + output '' + done + repeat scan line + match ',' any-text => char + output '' when thead + output '' unless thead + using group ents submit char + match any-text => char + using group ents submit char + again + output '' unless thead + output '' when thead + output '' + deactivate thead + + +process-start + output '%n' || + '%n' || + '%n' || + '%n' || + 'Monty Python’s Life of Brian (1979). Scene 20 (extract).%n' || + '%n' || + '%n' || + '%n' || + '%n' || + '%n' || + '%n' || + '%n' + +process-end + output '%n' || + '
%n' || + '%n' || + '%n' + ; Output validates to XHTML 1.0 - https://validator.w3.org/check + +process + local stream s + set s to "Character,Speech%n" || + "The multitude,The messiah! Show us the messiah!%n" || + "Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!%n" || + "The multitude,Who are you?%n" || + "Brians mother,I'm his mother; that's who!%n" || + "The multitude,Behold his mother! Behold his mother!%n" + using group line submit s + +group ents + + find '<' + output '<' + + find '>' + output '>' + + find "'" + output ''' + +group line + + find line-start any-text+ => line + process-tr(line) diff --git a/Task/CSV-to-HTML-translation/OmniMark/csv-to-html-translation-2.xom b/Task/CSV-to-HTML-translation/OmniMark/csv-to-html-translation-2.xom new file mode 100644 index 0000000000..92ff6b135c --- /dev/null +++ b/Task/CSV-to-HTML-translation/OmniMark/csv-to-html-translation-2.xom @@ -0,0 +1,27 @@ + + + + +Monty Python’s Life of Brian (1979). Scene 20 (extract). + + + + + + + + + + + + + + + + + +
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
+ + diff --git a/Task/CSV-to-HTML-translation/OpenEdge-Progress/csv-to-html-translation-2.openedge b/Task/CSV-to-HTML-translation/OpenEdge-Progress/csv-to-html-translation-2.openedge index 0a1dc0c135..5d586a5912 100644 --- a/Task/CSV-to-HTML-translation/OpenEdge-Progress/csv-to-html-translation-2.openedge +++ b/Task/CSV-to-HTML-translation/OpenEdge-Progress/csv-to-html-translation-2.openedge @@ -1,28 +1,28 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
+ + + + + + + + + + + + + + + + + + + + + + + + + +
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
diff --git a/Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-1.psh b/Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-1.ps1 similarity index 100% rename from Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-1.psh rename to Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-1.ps1 diff --git a/Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-2.psh b/Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-2.ps1 similarity index 100% rename from Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-2.psh rename to Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-2.ps1 diff --git a/Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-3.psh b/Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-3.ps1 similarity index 100% rename from Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-3.psh rename to Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-3.ps1 diff --git a/Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-4.psh b/Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-4.ps1 similarity index 100% rename from Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-4.psh rename to Task/CSV-to-HTML-translation/PowerShell/csv-to-html-translation-4.ps1 diff --git a/Task/CSV-to-HTML-translation/Prolog/csv-to-html-translation-1.pro b/Task/CSV-to-HTML-translation/Prolog/csv-to-html-translation-1.pro index 06bf8c825f..735abd10f0 100644 --- a/Task/CSV-to-HTML-translation/Prolog/csv-to-html-translation-1.pro +++ b/Task/CSV-to-HTML-translation/Prolog/csv-to-html-translation-1.pro @@ -1,52 +1,52 @@ csv_html :- - L = "Character,Speech + L = "Character,Speech The multitude,The messiah! Show us the messiah! Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away! The multitude,Who are you? Brians mother,I'm his mother; that's who! The multitude,Behold his mother! Behold his mother!", - csv_html(L, Out, []), - string_to_list(Str, Out), - writeln(Str). + csv_html(L, Out, []), + string_to_list(Str, Out), + writeln(Str). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % simple HTML % csv_html(L) --> - "\n", - csv_tr(L), - "
". + "\n", + csv_tr(L), + "
". csv_tr([]) --> []. csv_tr(L) --> - "\n", - csv_td(L, S), - "\n\n", - csv_tr(S). + "\n", + csv_td(L, S), + "\n\n", + csv_tr(S). csv_td(L, S) --> - "", - csv_td_in(L, S), - "". + "", + csv_td_in(L, S), + "". csv_td_in([], []) --> []. csv_td_in([10|L], L) --> []. csv_td_in([44|L], S) --> - "", - csv_td_in(L,S). + "", + csv_td_in(L,S). csv_td_in([60|T], S) --> - "<", - csv_td_in(T, S). + "<", + csv_td_in(T, S). csv_td_in([62|T], S) --> - ">", - csv_td_in(T, S). + ">", + csv_td_in(T, S). csv_td_in([H|T], S) --> - [H], - csv_td_in(T, S). + [H], + csv_td_in(T, S). diff --git a/Task/CSV-to-HTML-translation/Prolog/csv-to-html-translation-3.pro b/Task/CSV-to-HTML-translation/Prolog/csv-to-html-translation-3.pro index c5c27aeaa0..317040a50e 100644 --- a/Task/CSV-to-HTML-translation/Prolog/csv-to-html-translation-3.pro +++ b/Task/CSV-to-HTML-translation/Prolog/csv-to-html-translation-3.pro @@ -1,5 +1,5 @@ csv_html_plus :- - L = + L = "Character,Speech The multitude,The messiah! Show us the messiah! Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away! @@ -7,84 +7,84 @@ The multitude,Who are you? Brians mother,I'm his mother; that's who! The multitude,Behold his mother! Behold his mother!", - csv_html_plus(L, Out1, []), - string_to_list(Str1, Out1), - writeln(Str1). + csv_html_plus(L, Out1, []), + string_to_list(Str1, Out1), + writeln(Str1). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % HTML + % csv_html_plus(L) --> - "\n", - csv_head(L, R), - csv_body(R), - "
". + "\n", + csv_head(L, R), + csv_body(R), + "
". csv_head(L, R) --> - "\n", - csv_head_tr(L, R), - "\n". + "\n", + csv_head_tr(L, R), + "\n". csv_head_tr(L, R) --> - "\n", - csv_head_th(L, R), - "\n\n". + "\n", + csv_head_th(L, R), + "\n\n". csv_head_th(L, S) --> - "", - csv_head_th_in(L, S), - "". + "", + csv_head_th_in(L, S), + "". csv_head_th_in([], []) --> []. csv_head_th_in([10|L], L) --> []. csv_head_th_in([44|L], S) --> - "", - csv_head_th_in(L,S). + "", + csv_head_th_in(L,S). csv_head_th_in([H|T], S) --> - [H], - csv_head_th_in(T, S). + [H], + csv_head_th_in(T, S). csv_body(L) --> - "\n", - csv_body_tr(L), - "\n". + "\n", + csv_body_tr(L), + "\n". csv_body_tr([]) --> []. csv_body_tr(L) --> - "\n", - csv_body_td(L, S), - "\n\n", - csv_body_tr(S). + "\n", + csv_body_td(L, S), + "\n\n", + csv_body_tr(S). csv_body_td(L, S) --> - "", - csv_body_td_in(L, S), - "". + "", + csv_body_td_in(L, S), + "". csv_body_td_in([], []) --> []. csv_body_td_in([10|L], L) --> []. csv_body_td_in([44|L], S) --> - "", - csv_body_td_in(L,S). + "", + csv_body_td_in(L,S). csv_body_td_in([60|T], S) --> - "<", - csv_body_td_in(T, S). + "<", + csv_body_td_in(T, S). csv_body_td_in([62|T], S) --> - ">", - csv_body_td_in(T, S). + ">", + csv_body_td_in(T, S). csv_body_td_in([H|T], S) --> - [H], - csv_body_td_in(T, S). + [H], + csv_body_td_in(T, S). diff --git a/Task/CSV-to-HTML-translation/Raku/csv-to-html-translation-1.raku b/Task/CSV-to-HTML-translation/Raku/csv-to-html-translation-1.raku index c171689eae..f6bfab0ad8 100644 --- a/Task/CSV-to-HTML-translation/Raku/csv-to-html-translation-1.raku +++ b/Task/CSV-to-HTML-translation/Raku/csv-to-html-translation-1.raku @@ -25,4 +25,4 @@ printf # that / at the end is just an unspace, you can omit it, but then you have to delete # all whitespace and comments between split(…) and .map .map({tag 'td', $^cell}))})\ # map those cells as td - .join("\n"); # append a newline for nicer output + .join("\n"); # append a newline for nicer output diff --git a/Task/CSV-to-HTML-translation/Rebol/csv-to-html-translation-1.rebol b/Task/CSV-to-HTML-translation/Rebol/csv-to-html-translation-1.rebol new file mode 100644 index 0000000000..406c067313 --- /dev/null +++ b/Task/CSV-to-HTML-translation/Rebol/csv-to-html-translation-1.rebol @@ -0,0 +1,53 @@ +Rebol [ + title: "Rosetta code: CSV to HTML translation" + file: %CSV_to_HTML_translation.r3 + url: https://rosettacode.org/wiki/CSV_to_HTML_translation + needs: 3.15.0 ;; or something like that +] +import csv + +csv-to-html: function/with [ + "Generate string with html table from csv data file" + csv [string! file!] "input .csv data" +][ + escape-html csv + + data: decode 'csv csv + html: copy "^/" + + emit-row/head data/1 + foreach row next data [ emit-row row ] + emit
+][ + html: none + emit: func [val][ + if block? val [val: ajoin val] + append html val + ] + emit-row: func[row /head][ + emit [""] + foreach col row [ + emit-tag either head ['th]['td] col + ] + emit "^/" + ] + emit-tag: func [tag content][ + emit [#"<" tag #">" content ""] + ] + escape-html: function/with [str][ + parse str [any[ + to esc [ + change #"<" "<" + | change #">" ">" + | change #"&" "&" + ] + ]] + ][ esc: charset "<>&" ] +] + +print csv-to-html {Character,Speech +The multitude,The messiah! Show us the messiah! +Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away! +The multitude,Who are you? +Brians mother,I'm his mother; that's who! +The multitude,Behold his mother! Behold his mother!} diff --git a/Task/CSV-to-HTML-translation/Rebol/csv-to-html-translation-2.rebol b/Task/CSV-to-HTML-translation/Rebol/csv-to-html-translation-2.rebol new file mode 100644 index 0000000000..dfebcd13ff --- /dev/null +++ b/Task/CSV-to-HTML-translation/Rebol/csv-to-html-translation-2.rebol @@ -0,0 +1,8 @@ + + + + + + + +
CharacterSpeech
The multitudeThe messiah! Show us the messiah!
Brians mother<angry>Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!</angry>
The multitudeWho are you?
Brians motherI'm his mother; that's who!
The multitudeBehold his mother! Behold his mother!
diff --git a/Task/CSV-to-HTML-translation/Run-BASIC/csv-to-html-translation.basic b/Task/CSV-to-HTML-translation/Run-BASIC/csv-to-html-translation.basic index 4fa25a5ea3..41e53b8200 100644 --- a/Task/CSV-to-HTML-translation/Run-BASIC/csv-to-html-translation.basic +++ b/Task/CSV-to-HTML-translation/Run-BASIC/csv-to-html-translation.basic @@ -5,7 +5,7 @@ The multitude,Who are you? Brians mother,I'm his mother; that's who! The multitude,Behold his mother! Behold his mother!" -k = instr(csv$,",") ' 2 exra lines to get heading +k = instr(csv$,",") ' 2 exra lines to get heading csv$ = left$(csv$,k - 1) + " + mid$(csv$,k + 1) csv$ = strRep$(csv$,",","") @@ -15,10 +15,10 @@ wait ' string replace rep str with ' -------------------------------- FUNCTION strRep$(strRep$,rep$,with$) -ln = len(rep$) -k = instr(strRep$,rep$) +ln = len(rep$) +k = instr(strRep$,rep$) while k - strRep$ = left$(strRep$,k - 1) + with$ + mid$(strRep$,k + ln) - k = instr(strRep$,rep$) + strRep$ = left$(strRep$,k - 1) + with$ + mid$(strRep$,k + ln) + k = instr(strRep$,rep$) WEND END FUNCTION diff --git a/Task/CSV-to-HTML-translation/Rust/csv-to-html-translation-1.rust b/Task/CSV-to-HTML-translation/Rust/csv-to-html-translation-1.rs similarity index 100% rename from Task/CSV-to-HTML-translation/Rust/csv-to-html-translation-1.rust rename to Task/CSV-to-HTML-translation/Rust/csv-to-html-translation-1.rs diff --git a/Task/CSV-to-HTML-translation/Rust/csv-to-html-translation-2.rust b/Task/CSV-to-HTML-translation/Rust/csv-to-html-translation-2.rs similarity index 100% rename from Task/CSV-to-HTML-translation/Rust/csv-to-html-translation-2.rust rename to Task/CSV-to-HTML-translation/Rust/csv-to-html-translation-2.rs diff --git a/Task/CSV-to-HTML-translation/Tcl/csv-to-html-translation-1.tcl b/Task/CSV-to-HTML-translation/Tcl/csv-to-html-translation-1.tcl index 6b41ae0db4..2761df41e6 100644 --- a/Task/CSV-to-HTML-translation/Tcl/csv-to-html-translation-1.tcl +++ b/Task/CSV-to-HTML-translation/Tcl/csv-to-html-translation-1.tcl @@ -18,7 +18,7 @@ html::init puts [subst { [html::openTag table {summary="csv2html program output"}] [html::while {[rows size]} { - [html::row {*}[html::quoteFormValue [rows get]]] + [html::row {*}[html::quoteFormValue [rows get]]] }] [html::closeTag] }] diff --git a/Task/CSV-to-HTML-translation/Tcl/csv-to-html-translation-2.tcl b/Task/CSV-to-HTML-translation/Tcl/csv-to-html-translation-2.tcl index 748d62eea4..18c6bcdfff 100644 --- a/Task/CSV-to-HTML-translation/Tcl/csv-to-html-translation-2.tcl +++ b/Task/CSV-to-HTML-translation/Tcl/csv-to-html-translation-2.tcl @@ -37,9 +37,9 @@ foreach line [split $csvData "\n"] { # Generate the output puts [subst { [table { - [tr [html::quoteFormValue [rows get]] {bgcolor="yellow"}] - [html::while {[rows size]} { - [tr [html::quoteFormValue [rows get]]] - }] + [tr [html::quoteFormValue [rows get]] {bgcolor="yellow"}] + [html::while {[rows size]} { + [tr [html::quoteFormValue [rows get]]] + }] }] }] diff --git a/Task/CSV-to-HTML-translation/Uiua/csv-to-html-translation.uiua b/Task/CSV-to-HTML-translation/Uiua/csv-to-html-translation.uiua new file mode 100644 index 0000000000..8b7fe76408 --- /dev/null +++ b/Task/CSV-to-HTML-translation/Uiua/csv-to-html-translation.uiua @@ -0,0 +1,9 @@ +$ Character,Speech +$ The multitude,The messiah! Show us the messiah! +$ Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away! +$ The multitude,Who are you? +$ Brians mother,I'm his mother; that's who! +$ The multitude,Behold his mother! Behold his mother! +⊜(□$"_"/◇⊂⊜(□$"_")⊸≠@,)⊸≠@\n +/◇$"_\n_" +&p$"\n\n_\n
CharacterSpeech
" diff --git a/Task/CSV-to-HTML-translation/VBScript/csv-to-html-translation.vb b/Task/CSV-to-HTML-translation/VBScript/csv-to-html-translation.vb deleted file mode 100644 index 2eadb9ed6f..0000000000 --- a/Task/CSV-to-HTML-translation/VBScript/csv-to-html-translation.vb +++ /dev/null @@ -1,33 +0,0 @@ -Set objfso = CreateObject("Scripting.FileSystemObject") - -parent_folder = objfso.GetParentFolderName(WScript.ScriptFullName) & "\" - -Set objcsv = objfso.OpenTextFile(parent_folder & "in.csv",1,False) -Set objhtml = objfso.OpenTextFile(paren_folder & "out.html",2,True) - -objhtml.Write(csv_to_html(objcsv.ReadAll)) - -objcsv.Close -objhtml.Close -Set objfso = Nothing - -Function csv_to_html(s) - row = Split(s,vbCrLf) - 'write the header - tmp = "" - For i = 0 To UBound(row) - field = Split(row(i),",") - If i = 0 Then - tmp = tmp & "" - Else - tmp = tmp & "" - End If - Next - 'write the footer - tmp = tmp & "
" & replace_chars(field(0)) & "" & replace_chars(field(1)) & "
" & replace_chars(field(0)) & "" & replace_chars(field(1)) & "
" - csv_to_html = tmp -End Function - -Function replace_chars(s) - replace_chars = Replace(Replace(s,"<","<"),">",">") -End Function diff --git a/Task/CSV-to-HTML-translation/VBScript/csv-to-html-translation.vbs b/Task/CSV-to-HTML-translation/VBScript/csv-to-html-translation.vbs new file mode 100644 index 0000000000..33894748ed --- /dev/null +++ b/Task/CSV-to-HTML-translation/VBScript/csv-to-html-translation.vbs @@ -0,0 +1,33 @@ +Set objfso = CreateObject("Scripting.FileSystemObject") + +parent_folder = objfso.GetParentFolderName(WScript.ScriptFullName) & "\" + +Set objcsv = objfso.OpenTextFile(parent_folder & "in.csv",1,False) +Set objhtml = objfso.OpenTextFile(paren_folder & "out.html",2,True) + +objhtml.Write(csv_to_html(objcsv.ReadAll)) + +objcsv.Close +objhtml.Close +Set objfso = Nothing + +Function csv_to_html(s) + row = Split(s,vbCrLf) + 'write the header + tmp = "" + For i = 0 To UBound(row) + field = Split(row(i),",") + If i = 0 Then + tmp = tmp & "" + Else + tmp = tmp & "" + End If + Next + 'write the footer + tmp = tmp & "
" & replace_chars(field(0)) & "" & replace_chars(field(1)) & "
" & replace_chars(field(0)) & "" & replace_chars(field(1)) & "
" + csv_to_html = tmp +End Function + +Function replace_chars(s) + replace_chars = Replace(Replace(s,"<","<"),">",">") +End Function diff --git a/Task/CUSIP/11l/cusip.11l b/Task/CUSIP/11l/cusip.11l index c1a3973294..c3bafa6306 100644 --- a/Task/CUSIP/11l/cusip.11l +++ b/Task/CUSIP/11l/cusip.11l @@ -1,10 +1,10 @@ F cusip_check(=cusip) I cusip.len != 9 - X ValueError(‘CUSIP must be 9 characters’) + X.throw ValueError(‘CUSIP must be 9 characters’) cusip = cusip.uppercase() V total = 0 - L(i) 8 + L(i) 0.<8 V v = 0 V c = cusip[i] I c.is_digit() diff --git a/Task/CUSIP/ALGOL-68/cusip.alg b/Task/CUSIP/ALGOL-68/cusip.alg index 32d1c0bad0..95cae39ff8 100644 --- a/Task/CUSIP/ALGOL-68/cusip.alg +++ b/Task/CUSIP/ALGOL-68/cusip.alg @@ -1,44 +1,35 @@ -BEGIN - # returns TRUE if cusip is a valid CUSIP code # - OP ISCUSIP = ( STRING cusip )BOOL: - IF ( UPB cusip - LWB cusip ) /= 8 - THEN - # code is wrong length # - FALSE - ELSE - # string is 9 characters long - check it is valid # - STRING cusip digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ*@#"[ AT 0 ]; - INT check digit := 0; - IF NOT char in string( cusip[ UPB cusip ], check digit, cusip digits ) - THEN - # invalid check digit # - FALSE - ELSE - # OK so far compare the calculated check sum to the supplied one # - INT sum := 0; - INT c pos := LWB cusip - 1; - FOR i TO 8 DO - INT digit := 0; - IF NOT char in string( cusip[ i + c pos ], digit, cusip digits ) - THEN - # invalid digit # - digit := -999 - FI; - IF NOT ODD i - THEN - # even digit # - digit *:= 2 - FI; - sum +:= ( digit OVER 10 ) + ( digit MOD 10 ) - OD; - ( 10 - ( sum MOD 10 ) ) MOD 10 = check digit - FI - FI ; # ISCUSIP # +BEGIN # validate CUSIP codes # + + # returns TRUE if cusip string is a valid CUSIP code, FALSE otherwise # + OP ISCUSIP = ( STRING cusip string )BOOL: + IF UPB cusip string - LWB cusip string /= 8 + THEN FALSE # CUSIP code is not 9 characters long # + ELSE # CUSIP code has the correct length # + + # returns the base 39 digit corresponding to a character of a CUSIP code # + PROC cusip digit = ( CHAR c char )INT: + IF STRING cusip digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ*@#"[ AT 0 ]; + INT digit := 0; + char in string( c char, digit, cusip digits ) + THEN digit + ELSE -999 # invalid digit # + FI # cusip digit # ; + + []CHAR cusip = cusip string[ AT 1 ]; + INT sum := 0; + INT check digit = cusip digit( cusip[ UPB cusip ] ); + FOR c pos TO UPB cusip - 1 DO + INT digit := cusip digit( cusip[ c pos ] ); + IF NOT ODD c pos THEN digit *:= 2 FI; + sum +:= ( digit OVER 10 ) + ( digit MOD 10 ) + OD; + ( 10 - ( sum MOD 10 ) ) MOD 10 = check digit + FI # is cusip # ; # task test cases # PROC test cusip = ( STRING cusip )VOID: - print( ( cusip, IF ISCUSIP cusip THEN " valid" ELSE " invalid" FI, newline ) ); + print( ( cusip, IF ISCUSIP cusip THEN " valid" ELSE " invalid" FI, newline ) ); test cusip( "037833100" ); test cusip( "17275R102" ); diff --git a/Task/CUSIP/ANSI-BASIC/cusip.basic b/Task/CUSIP/ANSI-BASIC/cusip.basic new file mode 100644 index 0000000000..13e8080304 --- /dev/null +++ b/Task/CUSIP/ANSI-BASIC/cusip.basic @@ -0,0 +1,63 @@ +100 REM CUSIP +110 DECLARE EXTERNAL SUB PrintVerdict +120 DECLARE EXTERNAL FUNCTION CusipCheckDigit +130 DECLARE EXTERNAL FUNCTION IsValidCusip +140 PRINT "CUSIP Verdict" +150 CALL PrintVerdict("037833100") +160 CALL PrintVerdict("17275R102") +170 CALL PrintVerdict("38259P508") +180 CALL PrintVerdict("594918104") +190 CALL PrintVerdict("68389X106") +200 CALL PrintVerdict("68389X105") +210 END +220 REM ** +230 EXTERNAL FUNCTION CusipCheckDigit(Cusip$) +240 LET I = 1 +250 LET Sum = 0 +260 LET L = LEN(Cusip$) +270 DO WHILE I < L +280 LET C$ = Cusip$(I:I) +290 IF ("0" <= C$) AND (C$ <= "9") THEN +300 LET V = VAL(C$) +310 ELSEIF ("A" <= C$) AND (C$ <= "Z") THEN +320 LET V = ORD(C$) - 65 + 10 +330 ELSEIF C$ = "*" THEN +340 LET V = 36 +350 ELSEIF C$ = "@" THEN +360 LET V = 37 +370 ELSEIF C$ = "#" THEN +380 LET V = 38 +390 ELSE +400 LET CusipCheckDigit = -1 +410 EXIT FUNCTION +420 END IF +430 IF MOD(I - 1, 2) = 1 THEN LET V = 2 * V +440 IF I <= 8 THEN LET Sum = Sum + INT(V / 10) + MOD(V, 10) +450 LET I = I + 1 +460 LOOP +470 IF I <> 9 THEN +480 LET CusipCheckDigit = -1 +490 ELSE +500 LET CusipCheckDigit = MOD(10 - MOD(Sum, 10), 10) +510 END IF +520 END FUNCTION +530 REM ** +540 EXTERNAL FUNCTION IsValidCusip (Cusip$) +550 LET Check = CusipCheckDigit(Cusip$) +560 IF Check < 0 THEN +570 LET IsValidCusip = 0 +580 ELSEIF Cusip$(9:9) = CHR$(48 + Check) THEN +590 LET IsValidCusip = -1 +600 ELSE +610 LET IsValidCusip = 0 +620 END IF +630 END FUNCTION +640 REM ** +650 EXTERNAL SUB PrintVerdict (Cusip$) +660 PRINT Cusip$; +670 IF IsValidCusip(Cusip$) <>0 THEN +680 PRINT " : Valid" +690 ELSE +700 PRINT " : Invalid" +710 END IF +720 END SUB diff --git a/Task/CUSIP/Ada/cusip.ada b/Task/CUSIP/Ada/cusip.adb similarity index 100% rename from Task/CUSIP/Ada/cusip.ada rename to Task/CUSIP/Ada/cusip.adb diff --git a/Task/CUSIP/Arturo/cusip.arturo b/Task/CUSIP/Arturo/cusip.arturo index b8615d3d49..bde0bd1ddc 100644 --- a/Task/CUSIP/Arturo/cusip.arturo +++ b/Task/CUSIP/Arturo/cusip.arturo @@ -1,17 +1,17 @@ validCUSIP?: function [cusip][ s: 0 - alpha: `A`..`Z` + alpha: 'A'..'Z' loop.with:'i chop cusip 'c [ v: 0 - case ø - when? [numeric? c] -> v: to :integer to :string c - when? [in? c alpha] -> v: (index alpha c) + 1 + 9 - when? [c = `*`] -> v: 36 - when? [c = `@`] -> v: 37 - when? [c = `#`] -> v: 38 - else [] + when.has: c [ + [|numeric?] -> v: to :integer to :string c + [|in? alpha] -> v: (index alpha c) + 1 + 9 + [= '*'] -> v: 36 + [= '@'] -> v: 37 + [= '#'] -> v: 38 + ] if odd? i -> v: 2 * v diff --git a/Task/CUSIP/BQN/cusip.bqn b/Task/CUSIP/BQN/cusip.bqn new file mode 100644 index 0000000000..dd8bf31a89 --- /dev/null +++ b/Task/CUSIP/BQN/cusip.bqn @@ -0,0 +1,5 @@ +d ← ∾"0A*@#"+⟜↕¨10‿26‿1‿1‿1 +m ← 8⥊1‿2 +Check ← ¯1(⊑=10|0-˜´10(|+⌊∘÷˜)m×↓)d⊐⊢ + +Check¨ "037833100"‿"17275R102"‿"38259P508"‿"594918104"‿"68389X106"‿"68389X105" diff --git a/Task/CUSIP/C++/cusip.cpp b/Task/CUSIP/C++/cusip.cpp index 801e0800fb..12e2532ff9 100644 --- a/Task/CUSIP/C++/cusip.cpp +++ b/Task/CUSIP/C++/cusip.cpp @@ -12,9 +12,11 @@ bool isCusip(const std::string& s) { if ('0' <= c && c <= '9') { v = c - '0'; } else if ('A' <= c && c <= 'Z') { - v = c - '@'; + v = c - 'A' + 10; } else if (c = '*') { v = 36; + } else if (c = '@') { + v = 37; } else if (c = '#') { v = 38; } else { diff --git a/Task/CUSIP/Crystal/cusip.cr b/Task/CUSIP/Crystal/cusip.cr new file mode 100644 index 0000000000..f601d4b0cf --- /dev/null +++ b/Task/CUSIP/Crystal/cusip.cr @@ -0,0 +1,28 @@ +def cusip_check (input) + return false unless input.size == 9 + sum = 0 + input.chars.each_with_index do |c, i| + break if i == 8 + v = case c + when .ascii_number? then c.to_i + when .ascii_uppercase? then c.ord - 'A'.ord + 10 + when '*' then 36 + when '@' then 37 + when '#' then 38 + else return false + end + v *= 2 if (i+1).even? + + sum += v // 10 + v % 10 + end + input[-1].to_i? == (10 - sum % 10) % 10 +end + +["037833100", + "17275R102", + "38259P508", + "594918104", + "68389X106", + "68389X105"].each do |cusip| + print cusip, ": ", cusip_check(cusip) ? "valid" : "invalid", "\n" +end diff --git a/Task/CUSIP/Delphi/cusip.delphi b/Task/CUSIP/Delphi/cusip.pas similarity index 100% rename from Task/CUSIP/Delphi/cusip.delphi rename to Task/CUSIP/Delphi/cusip.pas diff --git a/Task/CUSIP/EasyLang/cusip.easy b/Task/CUSIP/EasyLang/cusip.easy new file mode 100644 index 0000000000..574de473d0 --- /dev/null +++ b/Task/CUSIP/EasyLang/cusip.easy @@ -0,0 +1,27 @@ +func check inp$ . + for i = 1 to 8 + c = strcode substr inp$ i 1 + if c >= 48 and c <= 57 + v = c - 48 + elif c >= 65 and c <= 91 + v = c - 64 + 9 + elif c = 42 + v = 36 + elif c = 64 + v = 37 + elif c = 35 + v = 38 + . + if i mod 2 = 0 : v *= 2 + sum += v div 10 + v mod 10 + . + return if (10 - sum mod 10) mod 10 = number substr inp$ 9 1 +. +for s$ in [ "037833100" "17275R102" "38259P508" "594918104" "68389X106" "68389X105" ] + write s$ & " is " + if check s$ = 1 + print "valid" + else + print "invalid" + . +. diff --git a/Task/CUSIP/Julia/cusip.julia b/Task/CUSIP/Julia/cusip.jl similarity index 100% rename from Task/CUSIP/Julia/cusip.julia rename to Task/CUSIP/Julia/cusip.jl diff --git a/Task/CUSIP/Kotlin/cusip.kotlin b/Task/CUSIP/Kotlin/cusip.kts similarity index 100% rename from Task/CUSIP/Kotlin/cusip.kotlin rename to Task/CUSIP/Kotlin/cusip.kts diff --git a/Task/CUSIP/Langur/cusip-1.langur b/Task/CUSIP/Langur/cusip-1.langur index 0182e11c55..69451c3430 100644 --- a/Task/CUSIP/Langur/cusip-1.langur +++ b/Task/CUSIP/Langur/cusip-1.langur @@ -1,23 +1,21 @@ -val .isCusip = f(.s) { - if not isString(.s) or len(.s) != 9 { - return false +val isCusip = fn(s string) { + if len(s) != 9 : return false + + val basechars = '0'..'9' ~ 'A'..'Z' ~ "*@#" + + val sum = for[=0] i of 8 { + var v = index(basechars, by=s2s(s, of=i)) + if not v: return false + v = v[1]-1 + if i div 2: v *= 2 + _for += v \ 10 + v rem 10 } - val .basechars = cp2s('0'..'9') ~ cp2s('A'..'Z') ~ "*@#" - - val .sum = for[=0] .i of 8 { - var .v = index(s2s(.s, .i), .basechars) - if not .v: return false - .v = .v[1]-1 - if .i div 2: .v x= 2 - _for += .v \ 10 + .v rem 10 - } - - .s[9]-'0' == (10-(.sum rem 10)) rem 10 + s[9]-'0' == (10-(sum rem 10)) rem 10 } -val .candidates = w/037833100 17275R102 38259P508 594918104 68389X106 68389X105/ +val candidates = fw/037833100 17275R102 38259P508 594918104 68389X106 68389X105/ -for .c in .candidates { - writeln .c, ": ", if(.isCusip(.c): "good" ; "bad") +for c in candidates { + writeln c, ": ", if(isCusip(c): "good" ; "bad") } diff --git a/Task/CUSIP/Langur/cusip-2.langur b/Task/CUSIP/Langur/cusip-2.langur index e855068536..ed2dd39a3f 100644 --- a/Task/CUSIP/Langur/cusip-2.langur +++ b/Task/CUSIP/Langur/cusip-2.langur @@ -1,37 +1,35 @@ -val .isCusip = f(.s) { - if not isString(.s) or len(.s) != 9 { - return false - } +val isCusip = fn(s string) { + if len(s) != 9 : return false - val .sum = for[=0] .i of 8 { - val .c = .s[.i] - var .v = 0 + val basechars = '0'..'9' ~ 'A'..'Z' ~ "*@#" - given .c { - # for given, default op between conditions is "and" - # for switch, default op between conditions is "or" + val sum = for[=0] i of 8 { + val c = s[i] + var v = 0 + + switch[and] c { case >= '0', <= '9': - .v = .c-'0' + v = c-'0' case >= 'A', <= 'Z': - .v = .c-55 # .c-'A'+10 + v = c-55 # c-'A'+10 - case '*': .v = 36 - case '@': .v = 37 - case '#': .v = 38 + case '*': v = 36 + case '@': v = 37 + case '#': v = 38 default: return false } - if .i div 2: .v x= 2 - _for += .v \ 10 + .v rem 10 + if i div 2: v *= 2 + _for += v \ 10 + v rem 10 } - .s[9]-'0' == (10-(.sum rem 10)) rem 10 + s[9]-'0' == (10-(sum rem 10)) rem 10 } -val .candidates = w/037833100 17275R102 38259P508 594918104 68389X106 68389X105/ +val candidates = fw/037833100 17275R102 38259P508 594918104 68389X106 68389X105/ -for .c in .candidates { - writeln .c, ": ", if(.isCusip(.c): "good" ; "bad") +for c in candidates { + writeln c, ": ", if(isCusip(c): "good" ; "bad") } diff --git a/Task/CUSIP/Loglan82/cusip.loglan82 b/Task/CUSIP/Loglan82/cusip.loglan82 new file mode 100644 index 0000000000..7a3a1210de --- /dev/null +++ b/Task/CUSIP/Loglan82/cusip.loglan82 @@ -0,0 +1,89 @@ +(* CUSIP *) + +block + + unit check_digit: function (cusip: string): integer; + var + sum, v, i_first, i_last, i: integer, + c: character, + check_needed: boolean, + ccusip: arrayof character; + begin + sum := 0; + ccusip := unpack(cusip); + i, i_first := lower(ccusip); + i_last := upper(ccusip); + check_needed := true; + while (i < i_last) and check_needed + do + c := ccusip(i); + if ord(c) >= ord('0') and ord(c) <= ord('9') + then + v := ord(c) - ord('0') + else + if ord('A') <= ord(c) and ord(c) <= ord('Z') + then + v := ord(c) - ord('A') + 10 + else + case c + when '*': v := 36; + when '@': v := 37; + when '#': v := 38; + otherwise + result := -1; + check_needed := false + esac + fi + fi; + if check_needed + then + if (i - i_first) mod 2 = 1 then v := 2 * v fi; + if i - i_first <= 7 then sum := sum + v div 10 + v mod 10 fi; + i := i + 1 + fi; + od; + if check_needed + then + if i - i_first =/= 8 + then + result := -1 + else + result := (10 - sum mod 10) mod 10 + fi; + fi; + end check_digit; + + unit is_valid: function (cusip: string): boolean; + var + check: integer, + ccusip: arrayof character; + begin + check := check_digit(cusip); + if check < 0 + then + result := false + else + ccusip := unpack(cusip); + result := ord(ccusip(lower(ccusip) + 8)) = ord('0') + check + fi; + end is_valid; + + unit write_verdict: procedure (cusip: string); + begin + if is_valid(cusip) + then + writeln(cusip, " : Valid") + else + writeln(cusip, " : Invalid") + fi + end write_verdict; + +begin + writeln("CUSIP Verdict"); + call write_verdict("037833100"); + call write_verdict("17275R102"); + call write_verdict("38259P508"); + call write_verdict("594918104"); + call write_verdict("68389X106"); + call write_verdict("68389X105"); +end; diff --git a/Task/CUSIP/MiniScript/cusip.mini b/Task/CUSIP/MiniScript/cusip.mini new file mode 100644 index 0000000000..332bcb24f8 --- /dev/null +++ b/Task/CUSIP/MiniScript/cusip.mini @@ -0,0 +1,34 @@ +isCusip = function(s) + if s.len != 9 then return false + sum = 0 + for i in range(0, 7) + c = s[i] + v = 0 + if c >= "0" and c <= "9" then + v = code(c) - 48 + else if c >= "A" and c <= "Z" then + v = code(c) - 55 + else if c == "*" then + v = 36 + else if c == "@" then + v = 37 + else if c == "#" then + v = 38 + else + return false + end if + if i%2 == 1 then v *= 2 // check if odd as using 0-based indexing + sum += floor(v/10) + v%10 + end for + return code(s[8]) - 48 == (10 - (sum%10)) % 10 +end function + +candidates = [ + "037833100", "17275R102", "38259P508", + "594918104", "68389X106", "68389X105", +] +for candidate in candidates + s = "valid" + if not isCusip(candidate) then s = "invalid" + print candidate + " -> " + s +end for diff --git a/Task/CUSIP/Oberon-07/cusip.oberon b/Task/CUSIP/Oberon-07/cusip.oberon new file mode 100644 index 0000000000..23d635fd12 --- /dev/null +++ b/Task/CUSIP/Oberon-07/cusip.oberon @@ -0,0 +1,60 @@ +MODULE Cusip; (* validate CUSIP codes *) + IMPORT Strings, Out; + + CONST cusipBase = 39; + cusipLength = 9; + VAR cusipDigits : ARRAY cusipBase + 1 OF CHAR; (* 39 digits + trailing nul *) + + (* returns TRUE if cusip is a valid CUSIP code, FALSE otherwise *) + PROCEDURE isCusip( cusip : ARRAY OF CHAR ) : BOOLEAN; + VAR sum, digit, cPos, checkDigit : INTEGER; + isValid : BOOLEAN; + + (* returns the base 39 digit corresponding to a character of a CUSIP code *) + PROCEDURE cusipDigit( cChar : CHAR ) : INTEGER; + VAR digit, dPos : INTEGER; + BEGIN + digit := -999; + dPos := 0; + WHILE ( dPos <= cusipBase ) & ( digit < 0 ) DO + IF cusipDigits[ dPos ] = cChar THEN digit := dPos END; + INC( dPos ) + END + RETURN digit + END cusipDigit ; + + BEGIN + IF Strings.Length( cusip ) # cusipLength THEN + isValid := FALSE (* invalid length code *) + ELSE + (* CUSIP code has the correct length *) + sum := 0; + checkDigit := cusipDigit( cusip[ cusipLength - 1 ] ); + FOR cPos := 0 TO cusipLength - 2 DO + digit := cusipDigit( cusip[ cPos ] ); + IF ODD( cPos ) THEN digit := digit * 2 END; + INC( sum, ( digit DIV 10 ) + ( digit MOD 10 ) ) + END; + isValid := ( 10 - ( sum MOD 10 ) ) MOD 10 = checkDigit + END + RETURN isValid + END isCusip ; + + PROCEDURE testCusip( cusip : ARRAY OF CHAR ) ; + BEGIN + Out.String( cusip ); + IF isCusip( cusip ) THEN Out.String( " valid" ) ELSE Out.String( " invalid" ) END; + Out.Ln + END testCusip; + +BEGIN + + cusipDigits := "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ*@#"; + + testCusip( "037833100" ); + testCusip( "17275R102" ); + testCusip( "38259P508" ); + testCusip( "594918104" ); + testCusip( "68389X106" ); + testCusip( "68389X105" ) +END Cusip. diff --git a/Task/CUSIP/Pascal-P/cusip.pas b/Task/CUSIP/Pascal-P/cusip.pas new file mode 100644 index 0000000000..34d081a34a --- /dev/null +++ b/Task/CUSIP/Pascal-P/cusip.pas @@ -0,0 +1,70 @@ +program cusip(output); + +const + cusiplen = 9; + +type + tcusip = array [1 .. cusiplen] of char; + + function cusipcheckdigit(cusip: tcusip): integer; + (* Check digit *) + var + i, sum, v: integer; + c: char; + contcheck: boolean; (* Continue checking? *) + begin + i := 1; + sum := 0; + contcheck := true; + while (i <= cusiplen) and contcheck do + begin + c := cusip[i]; + if ('0' <= c) and (c <= '9') then v := ord(c) - 48 + else if ('A' <= c) and (c <= 'Z') then v := ord(c) - 65 + 10 + else if c = '*' then v := 36 + else if c = '@' then v := 37 + else if c = '#' then v := 38 + else + begin + cusipcheckdigit := -1; + contcheck := false; + end; + if contcheck then + begin + if (i - 1) mod 2 = 1 then v := 2 * v; + if i <= 8 then sum := sum + (v div 10) + (v mod 10); + i := i + 1; + end; + end; + if contcheck then + if i <> 10 then cusipcheckdigit := -1 + else cusipcheckdigit := (10 - (sum mod 10)) mod 10; + end; + + function isvalidcusip(cusip: tcusip): boolean; + var + check: integer; + begin + check := cusipcheckdigit(cusip); + if check < 0 then isvalidcusip := false + else isvalidcusip := (ord(cusip[9]) = ord(48 + check)); + end; + + procedure writeverdict(cusip: tcusip); + (* Write the verdict *) + begin + write(cusip); + if isvalidcusip(cusip) then writeln(' : Valid') + else writeln(' : Invalid'); + end; + +begin + writeln('CUSIP Verdict'); + writeverdict('037833100'); + writeverdict('17275R102'); + writeverdict('38259P508'); + writeverdict('594918104'); + writeverdict('68389X106'); + writeverdict('68389X105'); + (* readln; *) +end. diff --git a/Task/CUSIP/PascalABC.NET/cusip.pas b/Task/CUSIP/PascalABC.NET/cusip.pas new file mode 100644 index 0000000000..30d756c32e --- /dev/null +++ b/Task/CUSIP/PascalABC.NET/cusip.pas @@ -0,0 +1,32 @@ +function IsCusip(s: string): boolean; +begin + result := false; + if (s.Length <> 9) then exit; + var sum := 0; + var v := 0; + for var i := 1 to 8 do + begin + var c := s[i]; + if c.isdigit then + v := c.todigit + else if (c >= 'A') and (c <= 'Z') then + v := ord(c) - ord('A') + 10 + else if c = '*' then + v := 36 + else if c = '@' then + v := 37 + else if c = '#' then + v := 38; + if (i mod 2) = 0 then + v := v * 2; + sum += (v div 10) + (v mod 10); + end; + var check := (10 - (sum mod 10)) mod 10; + result := s[9].todigit = check; +end; + +begin + var candidates := |'037833100', '17275R102', '38259P508', '594918104', '68389X106', '68389X105'|; + foreach var candidate in candidates do + println(candidate, if IsCusip(candidate) then 'correct' else 'incorrect'); +end. diff --git a/Task/CUSIP/Phix/cusip.phix b/Task/CUSIP/Phix/cusip.phix index 4db8980c3d..e0bfdfac32 100644 --- a/Task/CUSIP/Phix/cusip.phix +++ b/Task/CUSIP/Phix/cusip.phix @@ -1,42 +1,40 @@ -(phixonline)--> - sequence cch = {} +sequence cch = {} - function CusipCheckDigit(string cusip) - integer s = 0, c, v - if length(cch)=0 then - cch = repeat(-1,256) - for i='0' to '9' do - cch[i] = i-'0' - end for - for i='A' to 'Z' do - cch[i] = i-55 - end for - cch['*'] = 36 - cch['@'] = 37 - cch['#'] = 38 - end if - if length(cusip)!=9 or find('\0',cusip) then return 0 end if - for i=1 to 8 do - c := cusip[i] - v := cch[c] - if v=-1 then return 0 end if - if remainder(i,2)=0 then - v *= 2 - end if - s += floor(v/10)+mod(v,10) - end for - return cusip[9]=mod(10-mod(s,10),10)+'0' - end function +function CusipCheckDigit(string cusip) +integer s = 0, c, v + if length(cch)=0 then + cch = repeat(-1,256) + for i='0' to '9' do + cch[i] = i-'0' + end for + for i='A' to 'Z' do + cch[i] = i-55 + end for + cch['*'] = 36 + cch['@'] = 37 + cch['#'] = 38 + end if + if length(cusip)!=9 or find('\0',cusip) then return 0 end if + for i=1 to 8 do + c := cusip[i] + v := cch[c] + if v=-1 then return 0 end if + if remainder(i,2)=0 then + v *= 2 + end if + s += floor(v/10)+mod(v,10) + end for + return cusip[9]=mod(10-mod(s,10),10)+'0' +end function - sequence tests = {"037833100", -- Apple Incorporated - "17275R102", -- Cisco Systems - "38259P508", -- Google Incorporated - "594918104", -- Microsoft Corporation - "68389X106", -- Oracle Corporation (incorrect) - "68389X105"} -- Oracle Corporation +sequence tests = {"037833100", -- Apple Incorporated + "17275R102", -- Cisco Systems + "38259P508", -- Google Incorporated + "594918104", -- Microsoft Corporation + "68389X106", -- Oracle Corporation (incorrect) + "68389X105"} -- Oracle Corporation - for i=1 to length(tests) do - string ti = tests[i] - printf(1,"%s : %s\n",{ti,{"invalid","valid"}[CusipCheckDigit(ti)+1]}) - end for -" & Text); - Text := crypt(Text, Key); - Ada.Text_IO.Put_Line("Ciphertext ----------->" & Text); - Ada.Text_IO.Put_Line("Decrypted Ciphertext ->" & crypt(Text, -Key)); - -end Caesar; diff --git a/Task/Caesar-cipher/Ada/caesar-cipher.adb b/Task/Caesar-cipher/Ada/caesar-cipher.adb new file mode 100644 index 0000000000..2969e50b30 --- /dev/null +++ b/Task/Caesar-cipher/Ada/caesar-cipher.adb @@ -0,0 +1,58 @@ +-- Caesar Cipher Implementation in Ada + +with Ada.Text_IO; use Ada.Text_IO; + +procedure Caesar is + + -- Base function to encrypt a character + function Cipher(Char_To_Encrypt: Character; Shift: Integer; Base: Character) return Character is + Base_Pos : constant Natural := Character'Pos(Base); + begin + return Character'Val((Character'Pos(Char_To_Encrypt) + Shift - Base_Pos) mod 26 + Base_Pos); + end Cipher; + + -- Function to encrypt a character + function Encrypt_Char(Char_To_Encrypt: Character; Shift: Integer) return Character is + begin + case Char_To_Encrypt is + when 'A'..'Z' => + -- Encrypt uppercase letters + return Cipher (Char_To_Encrypt, Shift, 'A'); + when 'a'..'z' => + -- Encrypt lowercase letters + return Cipher (Char_To_Encrypt, Shift, 'a'); + when others => + -- Leave other characters unchanged + return Char_To_Encrypt; + end case; + end Encrypt_Char; + + -- Function to decrypt a character + function Decrypt_Char(Char_To_Decrypt: Character; Shift: Integer) return Character is + begin + return Encrypt_Char(Char_To_Decrypt, -Shift); + end Decrypt_Char; + + Message: constant String := Ada.Text_IO.Get_Line; + Shift: Positive := 3; -- Default key from "Commentarii de Bello Gallico" shift cipher + -- Shift value (can be any positive integer) + + Encrypted_Message: String(Message'Range); + Decrypted_Message: String(Message'Range); +begin + -- Encrypt the message + for I in Message'Range loop + Encrypted_Message(I) := Encrypt_Char(Message(I), Shift); + end loop; + + -- Decrypt the encrypted message + for I in Message'Range loop + Decrypted_Message(I) := Decrypt_Char(Encrypted_Message(I), Shift); + end loop; + + -- Display results + Put_Line("Plaintext: " & Message); + Put_Line("Ciphertext: " & Encrypted_Message); + Put_Line("Decrypted Ciphertext: " & Decrypted_Message); + +end Caesar; diff --git a/Task/Caesar-cipher/Arturo/caesar-cipher.arturo b/Task/Caesar-cipher/Arturo/caesar-cipher.arturo index fae4207181..99de7301d6 100644 --- a/Task/Caesar-cipher/Arturo/caesar-cipher.arturo +++ b/Task/Caesar-cipher/Arturo/caesar-cipher.arturo @@ -1,11 +1,11 @@ -ia: to :integer `a` -iA: to :integer `A` -lowAZ: `a`..`z` -uppAZ: `A`..`Z` +ia: to :integer 'a' +iA: to :integer 'A' +lowAZ: 'a'..'z' +uppAZ: 'A'..'Z' caesar: function [s, xx][ k: (not? null? attr 'decode)? -> 26-xx -> xx - result: new "" + result: "" loop s 'i [ (in? i lowAZ)? -> 'result ++ to :char ia + (k + (to :integer i) - ia) % 26 [ diff --git a/Task/Caesar-cipher/AutoHotkey/caesar-cipher-2.ahk b/Task/Caesar-cipher/AutoHotkey/caesar-cipher-2.ahk index f1ee9d5a1d..f7915dd6a9 100644 --- a/Task/Caesar-cipher/AutoHotkey/caesar-cipher-2.ahk +++ b/Task/Caesar-cipher/AutoHotkey/caesar-cipher-2.ahk @@ -1,13 +1,13 @@ Caesar(string, n){ - Loop Parse, string - { - If (Asc(A_LoopField) >= Asc("A") and Asc(A_LoopField) <= Asc("Z")) - out .= Chr(Mod(Asc(A_LoopField)-Asc("A")+n,26)+Asc("A")) - Else If (Asc(A_LoopField) >= Asc("a") and Asc(A_LoopField) <= Asc("z")) - out .= Chr(Mod(Asc(A_LoopField)-Asc("a")+n,26)+Asc("a")) - Else out .= A_LoopField - } - return out + Loop Parse, string + { + If (Asc(A_LoopField) >= Asc("A") and Asc(A_LoopField) <= Asc("Z")) + out .= Chr(Mod(Asc(A_LoopField)-Asc("A")+n,26)+Asc("A")) + Else If (Asc(A_LoopField) >= Asc("a") and Asc(A_LoopField) <= Asc("z")) + out .= Chr(Mod(Asc(A_LoopField)-Asc("a")+n,26)+Asc("a")) + Else out .= A_LoopField + } + return out } MsgBox % Caesar("h i", 2) "`n" Caesar("Hi", 20) diff --git a/Task/Caesar-cipher/AutoIt/caesar-cipher.au3 b/Task/Caesar-cipher/AutoIt/caesar-cipher.au3 new file mode 100644 index 0000000000..38bc2d140f --- /dev/null +++ b/Task/Caesar-cipher/AutoIt/caesar-cipher.au3 @@ -0,0 +1,32 @@ +$Caesar = Caesar("Hi", 2, True) +MsgBox(0, "Caesar", $Caesar) +Func Caesar($String, $int, $encrypt = True) + If Not IsNumber($int) Or Not StringIsDigit($int) Then Return SetError(1, 0, 0) + If $int < 1 Or $int > 25 Then Return SetError(2, 0, 0) + Local $sLetters, $x + $String = StringUpper($String) + $split = StringSplit($String, "") + For $i = 1 To $split[0] + If Asc($split[$i]) - 64 > 26 Or Asc($split[$i]) - 64 < 1 Then + $sLetters &= $split[$i] + ContinueLoop + EndIf + If $encrypt = True Then + $move = Asc($split[$i]) - 64 + $int + Else + $move = Asc($split[$i]) - 64 - $int + EndIf + If $move > 26 Then + $move -= 26 + ElseIf $move < 1 Then + $move += 26 + EndIf + While $move + $x = Mod($move, 26) + If $x = 0 Then $x = 26 + $sLetters &= Chr($x + 64) + $move = ($move - $x) / 26 + WEnd + Next + Return $sLetters +EndFunc ;==>Caesar diff --git a/Task/Caesar-cipher/AutoIt/caesar-cipher.autoit b/Task/Caesar-cipher/AutoIt/caesar-cipher.autoit deleted file mode 100644 index c10d78e8b2..0000000000 --- a/Task/Caesar-cipher/AutoIt/caesar-cipher.autoit +++ /dev/null @@ -1,32 +0,0 @@ -$Caesar = Caesar("Hi", 2, True) -MsgBox(0, "Caesar", $Caesar) -Func Caesar($String, $int, $encrypt = True) - If Not IsNumber($int) Or Not StringIsDigit($int) Then Return SetError(1, 0, 0) - If $int < 1 Or $int > 25 Then Return SetError(2, 0, 0) - Local $sLetters, $x - $String = StringUpper($String) - $split = StringSplit($String, "") - For $i = 1 To $split[0] - If Asc($split[$i]) - 64 > 26 Or Asc($split[$i]) - 64 < 1 Then - $sLetters &= $split[$i] - ContinueLoop - EndIf - If $encrypt = True Then - $move = Asc($split[$i]) - 64 + $int - Else - $move = Asc($split[$i]) - 64 - $int - EndIf - If $move > 26 Then - $move -= 26 - ElseIf $move < 1 Then - $move += 26 - EndIf - While $move - $x = Mod($move, 26) - If $x = 0 Then $x = 26 - $sLetters &= Chr($x + 64) - $move = ($move - $x) / 26 - WEnd - Next - Return $sLetters -EndFunc ;==>Caesar diff --git a/Task/Caesar-cipher/Ballerina/caesar-cipher.ballerina b/Task/Caesar-cipher/Ballerina/caesar-cipher.ballerina new file mode 100644 index 0000000000..c0061314bf --- /dev/null +++ b/Task/Caesar-cipher/Ballerina/caesar-cipher.ballerina @@ -0,0 +1,32 @@ +import ballerina/io; + +function encrypt(string s, int key) returns string { + final int offset = key % 26; + if offset == 0 { return s; } + int d; + int[] chars = []; + foreach int c in s.toCodePointInts() { + if c >= 64 && c <= 90 { + d = c + offset; + if d > 90 { d -= 26; } + } else if c >= 97 && c <= 122 { + d = c + offset; + if d > 122 { d -= 26; } + } else { + d = c; + } + chars.push(d); + } + return checkpanic string:fromCodePointInts(chars); +} + +function decrypt(string s, int key) returns string { + return encrypt(s, 26 - key); +} + +public function main() { + string encoded = encrypt("Bright vixens jump; dozy fowl quack.", 8); + io:println(encoded); + string decoded = decrypt(encoded, 8); + io:println(decoded); +} diff --git a/Task/Caesar-cipher/Beads/caesar-cipher.beads b/Task/Caesar-cipher/Beads/caesar-cipher.beads index cf30bf8193..a52cddd6b2 100644 --- a/Task/Caesar-cipher/Beads/caesar-cipher.beads +++ b/Task/Caesar-cipher/Beads/caesar-cipher.beads @@ -1,33 +1,33 @@ beads 1 program 'Caesar cipher' calc main_init - var str = "The five boxing wizards (🤖) jump quickly." - log "Plain: {str}" - str = Encrypt(str, 3) - log "Encrypted: {str}" - str = Decrypt(str, 3) - log "Decrypted: {str}" + var str = "The five boxing wizards (🤖) jump quickly." + log "Plain: {str}" + str = Encrypt(str, 3) + log "Encrypted: {str}" + str = Decrypt(str, 3) + log "Decrypted: {str}" // encrypt a string by shifting the letters over by a number of slots // pass through any characters that are not in the Roman alphabet calc Encrypt( - input:str --- string to encrypt - nshift --- number of characters to slide over - ) : str --- encrypted string - - var newStr = "" - loop from:1 to:str_len(input) count:myCount - var unicode : num = from_char(subset(input, from:myCount, len:1)) - if unicode >= 65 and unicode <= 90 - unicode = mod((unicode - 65 + nshift), 26) + 65 - elif unicode >= 97 and unicode <= 122 - unicode = mod((unicode - 97 + nshift), 26) + 97 - newStr = newStr & to_char(unicode) - return newStr + input:str --- string to encrypt + nshift --- number of characters to slide over + ) : str --- encrypted string + + var newStr = "" + loop from:1 to:str_len(input) count:myCount + var unicode : num = from_char(subset(input, from:myCount, len:1)) + if unicode >= 65 and unicode <= 90 + unicode = mod((unicode - 65 + nshift), 26) + 65 + elif unicode >= 97 and unicode <= 122 + unicode = mod((unicode - 97 + nshift), 26) + 97 + newStr = newStr & to_char(unicode) + return newStr // undo the encryption calc Decrypt( - input:str - nshift - ) : str - // we could also just shift by 26-nshift, same as going in reverse - return Encrypt(input, -nshift) + input:str + nshift + ) : str + // we could also just shift by 26-nshift, same as going in reverse + return Encrypt(input, -nshift) diff --git a/Task/Caesar-cipher/C++/caesar-cipher-1.cpp b/Task/Caesar-cipher/C++/caesar-cipher-1.cpp index a896bbf42b..561efccc0f 100644 --- a/Task/Caesar-cipher/C++/caesar-cipher-1.cpp +++ b/Task/Caesar-cipher/C++/caesar-cipher-1.cpp @@ -11,15 +11,15 @@ public : char operator( )( char c ) { if ( isspace( c ) ) - return ' ' ; + return ' ' ; else { - static std::string letters( "abcdefghijklmnopqrstuvwxyz" ) ; - std::string::size_type found = letters.find(tolower( c )) ; - int shiftedpos = ( static_cast( found ) + shift ) % 26 ; - if ( shiftedpos < 0 ) //in case of decryption possibly - shiftedpos = 26 + shiftedpos ; - char shifted = letters[shiftedpos] ; - return shifted ; + static std::string letters( "abcdefghijklmnopqrstuvwxyz" ) ; + std::string::size_type found = letters.find(tolower( c )) ; + int shiftedpos = ( static_cast( found ) + shift ) % 26 ; + if ( shiftedpos < 0 ) //in case of decryption possibly + shiftedpos = 26 + shiftedpos ; + char shifted = letters[shiftedpos] ; + return shifted ; } } } ; @@ -33,12 +33,12 @@ int main( ) { std::cin >> myshift ; std::cout << "Before encryption:\n" << input << std::endl ; std::transform ( input.begin( ) , input.end( ) , input.begin( ) , - MyTransform( myshift ) ) ; + MyTransform( myshift ) ) ; std::cout << "encrypted:\n" ; std::cout << input << std::endl ; myshift *= -1 ; //decrypting again std::transform ( input.begin( ) , input.end( ) , input.begin( ) , - MyTransform( myshift ) ) ; + MyTransform( myshift ) ) ; std::cout << "Decrypted again:\n" ; std::cout << input << std::endl ; return 0 ; diff --git a/Task/Caesar-cipher/C/caesar-cipher.c b/Task/Caesar-cipher/C/caesar-cipher.c index 3d5cdffa65..a1c557ead9 100644 --- a/Task/Caesar-cipher/C/caesar-cipher.c +++ b/Task/Caesar-cipher/C/caesar-cipher.c @@ -9,7 +9,7 @@ void rot(int c, char *str) { - int l = strlen(str); + int l = strlen(str); const char* alpha_low = "abcdefghijklmnopqrstuvwxyz"; @@ -21,32 +21,32 @@ void rot(int c, char *str) int i; /* loop var */ - for (i = 0; i < l; i++) /* for each letter in string */ - { - if( 0 == isalpha(str[i]) ) continue; /* not alphabet character */ + for (i = 0; i < l; i++) /* for each letter in string */ + { + if( 0 == isalpha(str[i]) ) continue; /* not alphabet character */ idx = (int) (tolower(str[i]) - 'a') + c) % 26; /* compute index */ - if( isupper(str[i]) ) + if( isupper(str[i]) ) subst = alpha_high[idx]; else subst = alpha_low[idx]; str[i] = subst; - } + } } int main(int argc, char** argv) { - 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; + 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/COBOL/caesar-cipher-1.cobol b/Task/Caesar-cipher/COBOL/caesar-cipher-1.cob similarity index 100% rename from Task/Caesar-cipher/COBOL/caesar-cipher-1.cobol rename to Task/Caesar-cipher/COBOL/caesar-cipher-1.cob diff --git a/Task/Caesar-cipher/COBOL/caesar-cipher-2.cobol b/Task/Caesar-cipher/COBOL/caesar-cipher-2.cob similarity index 100% rename from Task/Caesar-cipher/COBOL/caesar-cipher-2.cobol rename to Task/Caesar-cipher/COBOL/caesar-cipher-2.cob diff --git a/Task/Caesar-cipher/Clojure/caesar-cipher-3.clj b/Task/Caesar-cipher/Clojure/caesar-cipher-3.clj new file mode 100644 index 0000000000..d6436b49b6 --- /dev/null +++ b/Task/Caesar-cipher/Clojure/caesar-cipher-3.clj @@ -0,0 +1,7 @@ +(defn fast-caesar [n s] + (let [m (mod n 26) + upper (map char (range 65 91)) + upper->new (zipmap upper (drop m (cycle upper))) + lower (map char (range 97 123)) + lower->new (zipmap lower (drop m (cycle lower)))] + (clojure.string/escape s (merge upper->new lower->new)))) diff --git a/Task/Caesar-cipher/Crystal/caesar-cipher.crystal b/Task/Caesar-cipher/Crystal/caesar-cipher.cr similarity index 100% rename from Task/Caesar-cipher/Crystal/caesar-cipher.crystal rename to Task/Caesar-cipher/Crystal/caesar-cipher.cr diff --git a/Task/Caesar-cipher/Cubescript/caesar-cipher-1.cube b/Task/Caesar-cipher/Cubescript/caesar-cipher-1.cube index 1d272423ca..cb7ede7b2e 100644 --- a/Task/Caesar-cipher/Cubescript/caesar-cipher-1.cube +++ b/Task/Caesar-cipher/Cubescript/caesar-cipher-1.cube @@ -2,57 +2,57 @@ alias modn [ mod (+ (mod $arg1 $arg2) $arg2) $arg2 ] //Cubescript's built-in mod will fail on negative numbers alias cipher [ - push alpha [ - "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" - "a b c d e f g h i j k l m n o p q r s t u v w x y z" - ] [ push chars [] [ - loop i (strlen $arg1) [ - looplist n $alpha [ - if (! (listlen $chars)) [ - alias chars (? (> (listindex $n (substr $arg1 $i 1)) -1) $n []) - ] - ] - alias arg1 ( - concatword (substr $arg1 0 $i) ( - ? (> (listindex $chars (substr $arg1 $i 1)) -1) ( - at $chars ( - modn (+ ( - listindex $chars (substr $arg1 $i 1) - ) $arg2) (listlen $chars) - ) - ) (substr $arg1 $i 1) - ) (substr $arg1 (+ $i 1) (strlen $arg1)) - ) - alias chars [] - ] - ] ] - result $arg1 + push alpha [ + "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" + "a b c d e f g h i j k l m n o p q r s t u v w x y z" + ] [ push chars [] [ + loop i (strlen $arg1) [ + looplist n $alpha [ + if (! (listlen $chars)) [ + alias chars (? (> (listindex $n (substr $arg1 $i 1)) -1) $n []) + ] + ] + alias arg1 ( + concatword (substr $arg1 0 $i) ( + ? (> (listindex $chars (substr $arg1 $i 1)) -1) ( + at $chars ( + modn (+ ( + listindex $chars (substr $arg1 $i 1) + ) $arg2) (listlen $chars) + ) + ) (substr $arg1 $i 1) + ) (substr $arg1 (+ $i 1) (strlen $arg1)) + ) + alias chars [] + ] + ] ] + result $arg1 ] alias decipher [ - push alpha [ - "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" - "a b c d e f g h i j k l m n o p q r s t u v w x y z" - ] [ push chars [] [ - loop i (strlen $arg1) [ - looplist n $alpha [ - if (! (listlen $chars)) [ - alias chars (? (> (listindex $n (substr $arg1 $i 1)) -1) $n []) - ] - ] - alias arg1 ( - concatword (substr $arg1 0 $i) ( - ? (> (listindex $chars (substr $arg1 $i 1)) -1) ( - at $chars ( - modn (- ( - listindex $chars (substr $arg1 $i 1) - ) $arg2 ) (listlen $chars) - ) - ) (substr $arg1 $i 1) - ) (substr $arg1 (+ $i 1) (strlen $arg1)) - ) - alias chars [] - ] - ] ] - result $arg1 + push alpha [ + "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" + "a b c d e f g h i j k l m n o p q r s t u v w x y z" + ] [ push chars [] [ + loop i (strlen $arg1) [ + looplist n $alpha [ + if (! (listlen $chars)) [ + alias chars (? (> (listindex $n (substr $arg1 $i 1)) -1) $n []) + ] + ] + alias arg1 ( + concatword (substr $arg1 0 $i) ( + ? (> (listindex $chars (substr $arg1 $i 1)) -1) ( + at $chars ( + modn (- ( + listindex $chars (substr $arg1 $i 1) + ) $arg2 ) (listlen $chars) + ) + ) (substr $arg1 $i 1) + ) (substr $arg1 (+ $i 1) (strlen $arg1)) + ) + alias chars [] + ] + ] ] + result $arg1 ] diff --git a/Task/Caesar-cipher/EasyLang/caesar-cipher.easy b/Task/Caesar-cipher/EasyLang/caesar-cipher.easy new file mode 100644 index 0000000000..8fe83e93e8 --- /dev/null +++ b/Task/Caesar-cipher/EasyLang/caesar-cipher.easy @@ -0,0 +1,15 @@ +func$ crypt str$ key . + for c$ in strchars str$ + c = strcode c$ + if c >= 65 and c <= 90 + c = (c + key - 65) mod 26 + 65 + elif c >= 97 and c <= 122 + c = (c + key - 97) mod 26 + 97 + . + enc$ &= strchar c + . + return enc$ +. +enc$ = crypt "Rosetta Code" 4 +print enc$ +print crypt enc$ -4 diff --git a/Task/Caesar-cipher/Eiffel/caesar-cipher.e b/Task/Caesar-cipher/Eiffel/caesar-cipher.e index 05b947e03d..685702644b 100644 --- a/Task/Caesar-cipher/Eiffel/caesar-cipher.e +++ b/Task/Caesar-cipher/Eiffel/caesar-cipher.e @@ -1,53 +1,53 @@ class - APPLICATION + APPLICATION inherit - ARGUMENTS + ARGUMENTS create - make + make feature {NONE} -- Initialization - make - -- Run application. - local - s: STRING_32 - do - s := "The tiny tiger totally taunted the tall Till." - print ("%NString to encode: " + s) - print ("%NEncoded string: " + encode (s, 12)) - print ("%NDecoded string (after encoding and decoding): " + decode (encode (s, 12), 12)) - end + make + -- Run application. + local + s: STRING_32 + do + s := "The tiny tiger totally taunted the tall Till." + print ("%NString to encode: " + s) + print ("%NEncoded string: " + encode (s, 12)) + print ("%NDecoded string (after encoding and decoding): " + decode (encode (s, 12), 12)) + end -feature -- Basic operations +feature -- Basic operations - decode (to_be_decoded: STRING_32; offset: INTEGER): STRING_32 - -- Decode `to be decoded' according to `offset'. - do - Result := encode (to_be_decoded, 26 - offset) - end + decode (to_be_decoded: STRING_32; offset: INTEGER): STRING_32 + -- Decode `to be decoded' according to `offset'. + do + Result := encode (to_be_decoded, 26 - offset) + end - encode (to_be_encoded: STRING_32; offset: INTEGER): STRING_32 - -- Encode `to be encoded' according to `offset'. - local - l_offset: INTEGER - l_char_code: INTEGER - do - create Result.make_empty - l_offset := (offset \\ 26) + 26 - across to_be_encoded as tbe loop - if tbe.item.is_alpha then - if tbe.item.is_upper then - l_char_code := ('A').code + (tbe.item.code - ('A').code + l_offset) \\ 26 - Result.append_character (l_char_code.to_character_32) - else - l_char_code := ('a').code + (tbe.item.code - ('a').code + l_offset) \\ 26 - Result.append_character (l_char_code.to_character_32) - end - else - Result.append_character (tbe.item) - end - end - end + encode (to_be_encoded: STRING_32; offset: INTEGER): STRING_32 + -- Encode `to be encoded' according to `offset'. + local + l_offset: INTEGER + l_char_code: INTEGER + do + create Result.make_empty + l_offset := (offset \\ 26) + 26 + across to_be_encoded as tbe loop + if tbe.item.is_alpha then + if tbe.item.is_upper then + l_char_code := ('A').code + (tbe.item.code - ('A').code + l_offset) \\ 26 + Result.append_character (l_char_code.to_character_32) + else + l_char_code := ('a').code + (tbe.item.code - ('a').code + l_offset) \\ 26 + Result.append_character (l_char_code.to_character_32) + end + else + Result.append_character (tbe.item) + end + end + end end diff --git a/Task/Caesar-cipher/Elena/caesar-cipher.elena b/Task/Caesar-cipher/Elena/caesar-cipher.elena index 4a89a12e15..1565b7d1f0 100644 --- a/Task/Caesar-cipher/Elena/caesar-cipher.elena +++ b/Task/Caesar-cipher/Elena/caesar-cipher.elena @@ -33,14 +33,14 @@ class Encrypting : Enumerator if (-1 < index) { - ^ Letters[(_key+index).mod:26] + ^ Letters[(_key+index).mod(26)] } else { index := BigLetters.indexOf(0, ch); if (-1 < index) { - ^ BigLetters[(_key+index).mod:26] + ^ BigLetters[(_key+index).mod(26)] } else { @@ -59,17 +59,17 @@ extension encryptOp = new Encrypting(26 - key, self).summarize(new StringWriter()); } -public program() +public Program() { - console.printLine("Original text :",TestText); + Console.printLine("Original text :",TestText); - var encryptedText := TestText.encrypt:Key; + var encryptedText := TestText.encrypt(Key); - console.printLine("Encrypted text:",encryptedText); + Console.printLine("Encrypted text:",encryptedText); - var decryptedText := encryptedText.decrypt:Key; + var decryptedText := encryptedText.decrypt(Key); - console.printLine("Decrypted text:",decryptedText); + Console.printLine("Decrypted text:",decryptedText); - console.readChar() + Console.readChar() } diff --git a/Task/Caesar-cipher/Elixir/caesar-cipher.elixir b/Task/Caesar-cipher/Elixir/caesar-cipher.ex similarity index 100% rename from Task/Caesar-cipher/Elixir/caesar-cipher.elixir rename to Task/Caesar-cipher/Elixir/caesar-cipher.ex diff --git a/Task/Caesar-cipher/Elm/caesar-cipher.elm b/Task/Caesar-cipher/Elm/caesar-cipher.elm new file mode 100644 index 0000000000..b4a7c073f9 --- /dev/null +++ b/Task/Caesar-cipher/Elm/caesar-cipher.elm @@ -0,0 +1,88 @@ +module Main exposing (main) + +import Browser +import Html exposing (Html, h2, div, p, input, button, text, textarea) +import Html.Attributes exposing (style, class, placeholder, value) +import Html.Events exposing (onInput, onClick) + + +-- MAIN + +main = + Browser.sandbox { init = init, update = update, view = view } + + +-- MODEL + +type alias Model = + { codeKey : Int + , normtext : String + } + + +init : Model +init = + { codeKey = 3 + , normtext = "" } + + +-- UPDATE + +type Msg + = Change String + | DecKey + | IncKey + + +update : Msg -> Model -> Model +update msg model = + case msg of + DecKey -> + { model | codeKey = model.codeKey - 1} + IncKey -> + { model | codeKey = model.codeKey + 1} + Change newContent -> + { model | normtext = String.toUpper newContent } + + + +encodeChar : Int -> Char -> Char +encodeChar codeKey character = + if Char.isUpper character then + Char.fromCode (modBy 26 (Char.toCode character - 65 + codeKey) + 65) + + else if Char.isLower character then + Char.fromCode (modBy 26 (Char.toCode (Char.toUpper character) - 65 + codeKey) + 65) + + else + character + + +encodeText : Int -> String -> String +encodeText codeKey normtext = + String.map (encodeChar codeKey) normtext + + +subheads aKey = + if aKey > 0 then "Original" + else if aKey < 0 then "Encrypted text" + else "?" + +-- VIEW + +view : Model -> Html Msg +view model = + div [] + [ div [] + [h2 [class "h2style"] [text (subheads model.codeKey)] + , textarea [ class "textframe", placeholder "Write here your text!" + , value model.normtext, onInput Change ] [] + ] + , div [] + [h2 [class "h2style"] [text (subheads (negate model.codeKey))] + , textarea [ class "textframe", value (encodeText model.codeKey model.normtext) ] []] + , div [class "keystyle"] [ button [ class "butstyle", onClick DecKey ] [ text "-1" ] + , text (" Key " ++ String.fromInt model.codeKey) + , button [ class "butstyle", onClick IncKey ] [ text "+1" ] + ] + ] diff --git a/Task/Caesar-cipher/Euphoria/caesar-cipher.eu b/Task/Caesar-cipher/Euphoria/caesar-cipher.eu new file mode 100644 index 0000000000..f7ca288339 --- /dev/null +++ b/Task/Caesar-cipher/Euphoria/caesar-cipher.eu @@ -0,0 +1,54 @@ +--caesar cipher for Rosetta Code wiki +--User:Lnettnay + +--usage eui caesar ->default text, key and encode flag +--usage eui caesar 'Text with spaces and punctuation!' 5 D +--If text has imbedded spaces must use apostophes instead of quotes so all punctuation works +--key = integer from 1 to 25, defaults to 13 +--flag = E (Encode) or D (Decode), defaults to E +--no error checking is done on key or flag + +include std/get.e +include std/types.e + + +sequence cmd = command_line() +sequence val +-- default text for encryption +sequence text = "The Quick Brown Fox Jumps Over The Lazy Dog." +atom key = 13 -- default to Rot-13 +sequence flag = "E" -- default to Encrypt +atom offset +atom num_letters = 26 -- number of characters in alphabet + +--get text +if length(cmd) >= 3 then + text = cmd[3] +end if + +--get key value +if length(cmd) >= 4 then + val = value(cmd[4]) + key = val[2] +end if + +--get Encrypt/Decrypt flag +if length(cmd) = 5 then + flag = cmd[5] + if compare(flag, "D") = 0 then + key = 26 - key + end if +end if + +for i = 1 to length(text) do + if t_alpha(text[i]) then + if t_lower(text[i]) then + offset = 'a' + else + offset = 'A' + end if + text[i] = remainder(text[i] - offset + key, num_letters) + offset + end if +end for + +printf(1,"%s\n",{text}) diff --git a/Task/Caesar-cipher/Euphoria/caesar-cipher.euphoria b/Task/Caesar-cipher/Euphoria/caesar-cipher.euphoria deleted file mode 100644 index 939241f9f7..0000000000 --- a/Task/Caesar-cipher/Euphoria/caesar-cipher.euphoria +++ /dev/null @@ -1,54 +0,0 @@ ---caesar cipher for Rosetta Code wiki ---User:Lnettnay - ---usage eui caesar ->default text, key and encode flag ---usage eui caesar 'Text with spaces and punctuation!' 5 D ---If text has imbedded spaces must use apostophes instead of quotes so all punctuation works ---key = integer from 1 to 25, defaults to 13 ---flag = E (Encode) or D (Decode), defaults to E ---no error checking is done on key or flag - -include std/get.e -include std/types.e - - -sequence cmd = command_line() -sequence val --- default text for encryption -sequence text = "The Quick Brown Fox Jumps Over The Lazy Dog." -atom key = 13 -- default to Rot-13 -sequence flag = "E" -- default to Encrypt -atom offset -atom num_letters = 26 -- number of characters in alphabet - ---get text -if length(cmd) >= 3 then - text = cmd[3] -end if - ---get key value -if length(cmd) >= 4 then - val = value(cmd[4]) - key = val[2] -end if - ---get Encrypt/Decrypt flag -if length(cmd) = 5 then - flag = cmd[5] - if compare(flag, "D") = 0 then - key = 26 - key - end if -end if - -for i = 1 to length(text) do - if t_alpha(text[i]) then - if t_lower(text[i]) then - offset = 'a' - else - offset = 'A' - end if - text[i] = remainder(text[i] - offset + key, num_letters) + offset - end if -end for - -printf(1,"%s\n",{text}) diff --git a/Task/Caesar-cipher/Fhidwfe/caesar-cipher.fhidwfe b/Task/Caesar-cipher/Fhidwfe/caesar-cipher.fhidwfe index 29eb95324a..099eb3b7af 100644 --- a/Task/Caesar-cipher/Fhidwfe/caesar-cipher.fhidwfe +++ b/Task/Caesar-cipher/Fhidwfe/caesar-cipher.fhidwfe @@ -8,7 +8,7 @@ function void caesar_encode(message:ptr key:uint) { temp = + temp key// shift lowercase letters if > temp 'z' { temp = - temp 26ub - } ; + } ; } { if in temp uppers { temp = + temp key// shift uppercase letters diff --git a/Task/Caesar-cipher/FutureBasic/caesar-cipher.basic b/Task/Caesar-cipher/FutureBasic/caesar-cipher.basic new file mode 100644 index 0000000000..d76978d854 --- /dev/null +++ b/Task/Caesar-cipher/FutureBasic/caesar-cipher.basic @@ -0,0 +1,42 @@ +CFStringRef local fn Encrypt( s as CFStringRef, key as int ) + CFMutableStringRef s1 = fn MutableStringWithString(s) + for int i = 0 to len(s1) - 1 + unichar c = ucc(s1,i) + select + case ( c >= _"A" && c <= _"Z") + c += key : if ( c > _"Z" ) then c -= 26 + case ( c >= _"a" && c <= _"z" ) + c += key : if ( c > _"z" ) then c -= 26 + end select + mid(s1,i,1) = ucs(c) + next +end fn = s1 + +CFStringRef local fn Decrypt( s as CFStringRef, key as int ) + CFMutableStringRef s1 = fn MutableStringWithString(s) + for int i = 0 to len(s1) - 1 + unichar c = ucc(s1,i) + select + case ( c >= _"A" && c <= _"Z") + c -= key : if ( c < _"A" ) then c += 26 + case ( c >= _"a" && c <= _"z" ) + c -= key : if ( c < _"a" ) then c += 26 + end select + mid(s1,i,1) = ucs(c) + next +end fn = s1 + +void local fn DoIt + CFStringRef s = @"The sun's not yellow, it's chicken" + print s + + s = fn Encrypt( s, 6 ) + print s + + s = fn Decrypt( s, 6 ) + print s +end fn + +fn DoIt + +HandleEvents diff --git a/Task/Caesar-cipher/GAP/caesar-cipher.gap b/Task/Caesar-cipher/GAP/caesar-cipher.gap index 0a3b660ca3..87c53d8859 100644 --- a/Task/Caesar-cipher/GAP/caesar-cipher.gap +++ b/Task/Caesar-cipher/GAP/caesar-cipher.gap @@ -1,22 +1,22 @@ CaesarCipher := function(s, n) - local r, c, i, lower, upper; - lower := "abcdefghijklmnopqrstuvwxyz"; - upper := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - r := ""; - for c in s do - i := Position(lower, c); - if i <> fail then - Add(r, lower[RemInt(i + n - 1, 26) + 1]); - else - i := Position(upper, c); - if i <> fail then - Add(r, upper[RemInt(i + n - 1, 26) + 1]); - else - Add(r, c); - fi; - fi; - od; - return r; + local r, c, i, lower, upper; + lower := "abcdefghijklmnopqrstuvwxyz"; + upper := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + r := ""; + for c in s do + i := Position(lower, c); + if i <> fail then + Add(r, lower[RemInt(i + n - 1, 26) + 1]); + else + i := Position(upper, c); + if i <> fail then + Add(r, upper[RemInt(i + n - 1, 26) + 1]); + else + Add(r, c); + fi; + fi; + od; + return r; end; CaesarCipher("IBM", 25); diff --git a/Task/Caesar-cipher/Icon/caesar-cipher-2.icon b/Task/Caesar-cipher/Icon/caesar-cipher-2.icon index 86efede9f2..a8ccbb7d25 100644 --- a/Task/Caesar-cipher/Icon/caesar-cipher-2.icon +++ b/Task/Caesar-cipher/Icon/caesar-cipher-2.icon @@ -7,6 +7,6 @@ (let original "The Quick Brown Fox Jumps Over The Lazy Dog." encrypted (caeser -1 original) decrypted (caeser 1 encrypted)) -(str "Original: " original " -Encrypted: " encrypted " -Decrypted: " decrypted) +"Original: {original} +Encrypted: {encrypted} +Decrypted: {decrypted}" diff --git a/Task/Caesar-cipher/JavaScript/caesar-cipher-1.js b/Task/Caesar-cipher/JavaScript/caesar-cipher-1.js index 44f68eb7d2..88ee6f5baf 100644 --- a/Task/Caesar-cipher/JavaScript/caesar-cipher-1.js +++ b/Task/Caesar-cipher/JavaScript/caesar-cipher-1.js @@ -1,6 +1,6 @@ function caesar (text, shift) { return text.toUpperCase().replace(/[^A-Z]/g,'').replace(/./g, function(a) { - return String.fromCharCode(65+(a.charCodeAt(0)-65+shift)%26); + return String.fromCharCode(((a.charCodeAt(0) - 65 + shift) % 26 + 26) % 26 + 65); }); } diff --git a/Task/Caesar-cipher/JavaScript/caesar-cipher-2.js b/Task/Caesar-cipher/JavaScript/caesar-cipher-2.js index 3d30b7a5ac..f2a3cc1a6b 100644 --- a/Task/Caesar-cipher/JavaScript/caesar-cipher-2.js +++ b/Task/Caesar-cipher/JavaScript/caesar-cipher-2.js @@ -2,4 +2,4 @@ var caesar = (text, shift) => text .toUpperCase() .replace(/[^A-Z]/g, '') .replace(/./g, a => - String.fromCharCode(65 + (a.charCodeAt(0) - 65 + shift) % 26)); + String.fromCharCode(((a.charCodeAt(0) - 65 + shift) % 26 + 26) % 26 + 65)); diff --git a/Task/Caesar-cipher/Jq/caesar-cipher.jq b/Task/Caesar-cipher/Jq/caesar-cipher.jq index 7bf6d7b4ec..00df4895b4 100644 --- a/Task/Caesar-cipher/Jq/caesar-cipher.jq +++ b/Task/Caesar-cipher/Jq/caesar-cipher.jq @@ -12,11 +12,11 @@ def encrypt(key): else if ($c >= 97 and $c <= 122) # 'a' to 'z' then .d = $c + $offset | if (.d > 122) - then .d += -26 - else . - end - else . - end + then .d += -26 + else . + end + else . + end end | .chars[$i] = .d ) | .chars | implode diff --git a/Task/Caesar-cipher/Julia/caesar-cipher.julia b/Task/Caesar-cipher/Julia/caesar-cipher.jl similarity index 100% rename from Task/Caesar-cipher/Julia/caesar-cipher.julia rename to Task/Caesar-cipher/Julia/caesar-cipher.jl diff --git a/Task/Caesar-cipher/Kotlin/caesar-cipher.kotlin b/Task/Caesar-cipher/Kotlin/caesar-cipher.kts similarity index 100% rename from Task/Caesar-cipher/Kotlin/caesar-cipher.kotlin rename to Task/Caesar-cipher/Kotlin/caesar-cipher.kts diff --git a/Task/Caesar-cipher/Langur/caesar-cipher.langur b/Task/Caesar-cipher/Langur/caesar-cipher.langur index 8b2463f249..447cb4856b 100644 --- a/Task/Caesar-cipher/Langur/caesar-cipher.langur +++ b/Task/Caesar-cipher/Langur/caesar-cipher.langur @@ -1,10 +1,10 @@ -val .rot = f(.s, .key) { - cp2s map(f(.c) rotate(rotate(.c, .key, 'a'..'z'), .key, 'A'..'Z'), s2cp .s) +val rot = fn(s, key) { + cp2s map(s2cp(s), by=fn(c) { rotate(rotate(c, distance=key, range='a'..'z'), distance=key, range='A'..'Z') }) } -val .s = "A quick brown fox jumped over something." -val .key = 3 +val s = "A quick brown fox jumped over something." +val key = 3 -writeln " original: ", .s -writeln "encrypted: ", .rot(.s, .key) -writeln "decrypted: ", .rot(.rot(.s, .key), -.key) +writeln " original: ", s +writeln "encrypted: ", rot(s, key) +writeln "decrypted: ", rot(rot(s, key), -key) diff --git a/Task/Caesar-cipher/Lua/caesar-cipher-1.lua b/Task/Caesar-cipher/Lua/caesar-cipher-1.lua index 517bb19671..eacdfb1093 100644 --- a/Task/Caesar-cipher/Lua/caesar-cipher-1.lua +++ b/Task/Caesar-cipher/Lua/caesar-cipher-1.lua @@ -1,30 +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')) + 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) + 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) + return encrypt(text, -key) end caesar = { - encrypt = encrypt, - decrypt = decrypt, + 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) + 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/M2000-Interpreter/caesar-cipher.m2000 b/Task/Caesar-cipher/M2000-Interpreter/caesar-cipher.m2000 index 5d55037e59..93f88beb46 100644 --- a/Task/Caesar-cipher/M2000-Interpreter/caesar-cipher.m2000 +++ b/Task/Caesar-cipher/M2000-Interpreter/caesar-cipher.m2000 @@ -16,6 +16,6 @@ Print Cipher$(B$,-10) n=1 ' n negative or positive or zero for i=65 to 65+25 - a=(1+(i -64)+n+24) mod 26 + 65 - ? chr$(a), + a=(1+(i -64)+n+24) mod 26 + 65 + ? chr$(a), next diff --git a/Task/Caesar-cipher/MATLAB/caesar-cipher-1.m b/Task/Caesar-cipher/MATLAB/caesar-cipher-1.m index ba19440994..bf35b9494d 100644 --- a/Task/Caesar-cipher/MATLAB/caesar-cipher-1.m +++ b/Task/Caesar-cipher/MATLAB/caesar-cipher-1.m @@ -1,6 +1,6 @@ function s = cipherCaesar(s, key) s = char( mod(s - 'A' + key, 25 ) + 'A'); - end; + end; function s = decipherCaesar(s, key) s = char( mod(s - 'A' - key, 25 ) + 'A'); end; diff --git a/Task/Caesar-cipher/MLite/caesar-cipher.mlite b/Task/Caesar-cipher/MLite/caesar-cipher.mlite index 2d6971bf8e..7fe15099ea 100644 --- a/Task/Caesar-cipher/MLite/caesar-cipher.mlite +++ b/Task/Caesar-cipher/MLite/caesar-cipher.mlite @@ -6,35 +6,35 @@ fun readfile () = readfile [] readfile ` ln :: x end -local - val lower_a = ord #"a"; - val lower_z = ord #"z"; - val upper_a = ord #"A"; - val upper_z = ord #"Z"; +local + val lower_a = ord #"a"; + val lower_z = ord #"z"; + val upper_a = ord #"A"; + val upper_z = ord #"Z"; + + fun which + (c_upper c) = (upper_a, upper_z) + | _ = (lower_a, lower_z) + ; + + fun scale + (c, az) where (c > #1 az) = scale( (#0 az + (c - #1 az - 1)), az) + | (c, az) = c - fun which - (c_upper c) = (upper_a, upper_z) - | _ = (lower_a, lower_z) - ; - - fun scale - (c, az) where (c > #1 az) = scale( (#0 az + (c - #1 az - 1)), az) - | (c, az) = c - in - fun encipher - ([], offset, t) = implode ` rev t - | (x :: xs, offset, t) where (c_alphabetic x) = encipher (xs, offset, (chr ` scale (ord x + offset, which x)) :: t) - | (x :: xs, offset, t) = encipher (xs, offset, x :: t) - | (s, offset) = if (offset < 0) then - encipher (explode s, 26 + (offset rem 26), []) - else - encipher (explode s, offset rem 26, []) + fun encipher + ([], offset, t) = implode ` rev t + | (x :: xs, offset, t) where (c_alphabetic x) = encipher (xs, offset, (chr ` scale (ord x + offset, which x)) :: t) + | (x :: xs, offset, t) = encipher (xs, offset, x :: t) + | (s, offset) = if (offset < 0) then + encipher (explode s, 26 + (offset rem 26), []) + else + encipher (explode s, offset rem 26, []) end fun default - (false, y) = y - | (x, _) = x + (false, y) = y + | (x, _) = x ; map println ` map (fn s = encipher (s,ston ` default (argv 0, "1"))) ` readfile (); diff --git a/Task/Caesar-cipher/Nanoquery/caesar-cipher.nanoquery b/Task/Caesar-cipher/Nanoquery/caesar-cipher.nanoquery index f44fbeb3a6..7859f16aeb 100644 --- a/Task/Caesar-cipher/Nanoquery/caesar-cipher.nanoquery +++ b/Task/Caesar-cipher/Nanoquery/caesar-cipher.nanoquery @@ -1,35 +1,35 @@ def caesar_encode(plaintext, shift) - uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - lowercase = "abcdefghijklmnopqrstuvwxyz" + uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + lowercase = "abcdefghijklmnopqrstuvwxyz" - cipher = "" - for char in plaintext - if char in uppercase - cipher += uppercase[uppercase[char] - (26 - shift)] - else if char in lowercase - cipher += lowercase[lowercase[char] - (26 - shift)] - else - cipher += char - end - end + cipher = "" + for char in plaintext + if char in uppercase + cipher += uppercase[uppercase[char] - (26 - shift)] + else if char in lowercase + cipher += lowercase[lowercase[char] - (26 - shift)] + else + cipher += char + end + end - return cipher + return cipher end def caesar_decode(cipher, shift) - uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - lowercase = "abcdefghijklmnopqrstuvwxyz" + uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + lowercase = "abcdefghijklmnopqrstuvwxyz" - plaintext = "" - for char in cipher - if char in uppercase - plaintext += uppercase[uppercase[char] - shift] - else if char in lowercase - plaintext += lowercase[lowercase[char] - shift] - else - plaintext += char - end - end + plaintext = "" + for char in cipher + if char in uppercase + plaintext += uppercase[uppercase[char] - shift] + else if char in lowercase + plaintext += lowercase[lowercase[char] - shift] + else + plaintext += char + end + end - return plaintext + return plaintext end diff --git a/Task/Caesar-cipher/OCaml/caesar-cipher-1.ocaml b/Task/Caesar-cipher/OCaml/caesar-cipher-1.ml similarity index 100% rename from Task/Caesar-cipher/OCaml/caesar-cipher-1.ocaml rename to Task/Caesar-cipher/OCaml/caesar-cipher-1.ml diff --git a/Task/Caesar-cipher/OCaml/caesar-cipher-2.ocaml b/Task/Caesar-cipher/OCaml/caesar-cipher-2.ml similarity index 100% rename from Task/Caesar-cipher/OCaml/caesar-cipher-2.ocaml rename to Task/Caesar-cipher/OCaml/caesar-cipher-2.ml diff --git a/Task/Caesar-cipher/OmniMark/caesar-cipher.xom b/Task/Caesar-cipher/OmniMark/caesar-cipher.xom new file mode 100644 index 0000000000..8395716c58 --- /dev/null +++ b/Task/Caesar-cipher/OmniMark/caesar-cipher.xom @@ -0,0 +1,25 @@ +; caesar.xom +global integer gi-k initial {13} +global stream gs-ed initial {'encode'} +global stream gs-phrase + +define stream function apply-cipher (value stream phrase, value integer k, value stream ed) as + local integer b + local stream ciphered + open ciphered as buffer + repeat scan phrase + match letter => char + set b to char binary 0 + increment b by k when ed = 'encode' + increment b by 26 - k when ed = 'decode' + decrement b by 26 when char matches uc and b > 90 + decrement b by 26 when char matches lc and b > 122 + put ciphered "b" % b + match any => char + put ciphered char + again + close ciphered + return ciphered + +process + output apply-cipher(gs-phrase, gi-k, gs-ed) || '%n%n' diff --git a/Task/Caesar-cipher/PascalABC.NET/caesar-cipher.pas b/Task/Caesar-cipher/PascalABC.NET/caesar-cipher.pas new file mode 100644 index 0000000000..722c8f1b44 --- /dev/null +++ b/Task/Caesar-cipher/PascalABC.NET/caesar-cipher.pas @@ -0,0 +1,20 @@ +## +function encrypt(msg:string;k:integer):string; +begin + var big:=('A'..'Z').ToArray; + var ltl:=('a'..'z').ToArray; + foreach var c in msg do + case c of + 'A'..'Z': result+=big[(big.IndexOf(c)+k) mod 26]; + 'a'..'z': result+=ltl[(ltl.IndexOf(c)+k) mod 26]; + else result+=c; + end; +end; +function decrypt(msg:string;k:integer):=encrypt(msg, 26-k); + +var (key, message):=(3,'The five boxing wizards jump quickly'); +Println('Original:',message); +message:=encrypt(message, 3); +Println('Encrypted:',message); +message:=decrypt(message, 3); +Println('Decrypted:',message); diff --git a/Task/Caesar-cipher/Pluto/caesar-cipher.pluto b/Task/Caesar-cipher/Pluto/caesar-cipher.pluto new file mode 100644 index 0000000000..ce61edf0ca --- /dev/null +++ b/Task/Caesar-cipher/Pluto/caesar-cipher.pluto @@ -0,0 +1,20 @@ +local function caesar(s, k, e=true) + -- Parameters: s (string), k (key) + -- e (true=encode, false=decode) + if !e do k=-k end + local out = "" + for i = 1, #s do + local c = s[i] + if c:islower() then + out ..= string.char((c:byte() - 97 + k) % 26 + 97) + elseif c:isupper() then + out ..= string.char((c:byte() - 65 + k) % 26 + 65) + else + out ..= c + end + end + return out +end + +print(caesar("The quick brown fox jumps over the lazy dog.", 3)) +print(caesar("Wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj.", 3, false)) diff --git a/Task/Caesar-cipher/PowerShell/caesar-cipher.psh b/Task/Caesar-cipher/PowerShell/caesar-cipher.ps1 similarity index 100% rename from Task/Caesar-cipher/PowerShell/caesar-cipher.psh rename to Task/Caesar-cipher/PowerShell/caesar-cipher.ps1 diff --git a/Task/Caesar-cipher/Prolog/caesar-cipher.pro b/Task/Caesar-cipher/Prolog/caesar-cipher.pro index bf0e31a910..bd0957e07b 100644 --- a/Task/Caesar-cipher/Prolog/caesar-cipher.pro +++ b/Task/Caesar-cipher/Prolog/caesar-cipher.pro @@ -1,33 +1,33 @@ :- use_module(library(clpfd)). caesar :- - L1 = "The five boxing wizards jump quickly", - writef("Original : %s\n", [L1]), + 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]), + % 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]). + % 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). + maplist(caesar_cipher(Key), L1, L2). caesar_cipher(_, 32, 32) :- !. caesar_cipher(Key, V1, V2) :- - V #= Key + V1, + 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, + % 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, + % 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]). + % compute values of V1 and V2 + label([A, V1, V2]). diff --git a/Task/Caesar-cipher/Python/caesar-cipher-1.py b/Task/Caesar-cipher/Python/caesar-cipher-1.py index 975933b38c..7f31eb37ce 100644 --- a/Task/Caesar-cipher/Python/caesar-cipher-1.py +++ b/Task/Caesar-cipher/Python/caesar-cipher-1.py @@ -1,8 +1,8 @@ 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 ]) + 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 diff --git a/Task/Caesar-cipher/Rebol/caesar-cipher.rebol b/Task/Caesar-cipher/Rebol/caesar-cipher.rebol new file mode 100644 index 0000000000..80053bbce7 --- /dev/null +++ b/Task/Caesar-cipher/Rebol/caesar-cipher.rebol @@ -0,0 +1,37 @@ +Rebol [ + title: "Rosetta code: Caesar cipher" + file: %Caesar_cipher.r3 + url: https://rosettacode.org/wiki/Caesar_cipher + needs: 3.0.0 + note: {Based on Red language version} +] + +caesar: function/with [ + src [string!] + key [integer!] +][ + parse/case src [ + any [ + change s: [lower (o: #"a") | upper (o: #"A")] (rot s/1 key o) + | skip + ] + ] + src +][ + lower: charset [#"a" - #"z"] + upper: charset [#"A" - #"Z"] + rot: func [ + char [char!] + key [number!] + ofs [char!] + ][ + to char! key + char - ofs // 26 + ofs + ] +] + +encrypt: :caesar +decrypt: func spec-of :caesar [caesar src negate key] + +;; DEMO: +print encrypt "Ceasar Cipher" 4 ;== Giewev Gmtliv +print decrypt "Giewev Gmtliv" 4 ;== Ceasar Cipher diff --git a/Task/Caesar-cipher/Rhombus/caesar-cipher.rhombus b/Task/Caesar-cipher/Rhombus/caesar-cipher.rhombus new file mode 100644 index 0000000000..eb65b69fc6 --- /dev/null +++ b/Task/Caesar-cipher/Rhombus/caesar-cipher.rhombus @@ -0,0 +1,25 @@ +#lang rhombus/static + +import lib("racket/base.rkt") expose: + #{string->list} as string_to_list + #{list->string} as list_to_string + modulo + +fun make_rot13_char(key :: Int): + fun (char :: Char): + let char_int = char.to_int() + fun rot13_by_case(char_int, a_char :: Char) :: Int : + modulo(char_int - a_char.to_int() + key, 26) + a_char.to_int() + if char.is_alphabetic(): + | if char.is_lowercase(): + | Char.from_int(rot13_by_case(char_int, Char"a")) + | Char.from_int(rot13_by_case(char_int, Char"A")) + | char + +fun rot13_string(str :: String, key :: Int) :: String : + let chars :: PairList = string_to_list(str) + let rot13_char = make_rot13_char(key) + let str :: MutableString = list_to_string(chars.map(rot13_char)) + str.snapshot() + +rot13_string("Hello, World!", 14) // Output: "Vszzc, Kcfzr!"" diff --git a/Task/Caesar-cipher/Rust/caesar-cipher.rust b/Task/Caesar-cipher/Rust/caesar-cipher.rs similarity index 100% rename from Task/Caesar-cipher/Rust/caesar-cipher.rust rename to Task/Caesar-cipher/Rust/caesar-cipher.rs diff --git a/Task/Caesar-cipher/Scheme/caesar-cipher.ss b/Task/Caesar-cipher/Scheme/caesar-cipher.scm similarity index 100% rename from Task/Caesar-cipher/Scheme/caesar-cipher.ss rename to Task/Caesar-cipher/Scheme/caesar-cipher.scm diff --git a/Task/Caesar-cipher/Sed/caesar-cipher.sed b/Task/Caesar-cipher/Sed/caesar-cipher.sed index a599313519..7b8eb7895b 100644 --- a/Task/Caesar-cipher/Sed/caesar-cipher.sed +++ b/Task/Caesar-cipher/Sed/caesar-cipher.sed @@ -2,26 +2,26 @@ # Input: \ntext to encode /^[0-9]+$/ { - # validate a number and translate it to analog form - s/$/;9876543210dddddddddd/ - s/([0-9]);.*\1.{10}(.?)/\2/ - s/2/11/ - s/1/dddddddddd/g - /[3-9]|d{25}d+/ { - s/.*/Error: Key must be <= 25/ - q - } - # append from-table - s/$/\nabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/ - # .. and to-table - s/$/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/ - # rotate to-table, lower and uppercase independently, removing one `d' at a time - : rotate - s/^d(.*\n[^Z]+Z)(.)(.{25})(.)(.{25})/\1\3\2\5\4/ - t rotate - s/\n// - h - d + # validate a number and translate it to analog form + s/$/;9876543210dddddddddd/ + s/([0-9]);.*\1.{10}(.?)/\2/ + s/2/11/ + s/1/dddddddddd/g + /[3-9]|d{25}d+/ { + s/.*/Error: Key must be <= 25/ + q + } + # append from-table + s/$/\nabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/ + # .. and to-table + s/$/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/ + # rotate to-table, lower and uppercase independently, removing one `d' at a time + : rotate + s/^d(.*\n[^Z]+Z)(.)(.{25})(.)(.{25})/\1\3\2\5\4/ + t rotate + s/\n// + h + d } # use \n to mark character to convert @@ -29,9 +29,9 @@ s/^/\n/ # append conversion table to pattern space G : loop - # look up converted character and place it instead of old one - s/\n(.)(.*\n.*\1.{51}(.))/\n\3\2/ - # advance \n even if prev. command fails, thus skip non-alphabetical characters - /\n\n/! s/\n([^\n])/\1\n/ + # look up converted character and place it instead of old one + s/\n(.)(.*\n.*\1.{51}(.))/\n\3\2/ + # advance \n even if prev. command fails, thus skip non-alphabetical characters + /\n\n/! s/\n([^\n])/\1\n/ t loop s/\n\n.*// diff --git a/Task/Caesar-cipher/SequenceL/caesar-cipher.sequencel b/Task/Caesar-cipher/SequenceL/caesar-cipher.sequencel index 3e23c88d8f..f075eb3691 100644 --- a/Task/Caesar-cipher/SequenceL/caesar-cipher.sequencel +++ b/Task/Caesar-cipher/SequenceL/caesar-cipher.sequencel @@ -5,28 +5,28 @@ lowerAlphabet := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; upperAlphabet := "abcdefghijklmnopqrstuvwxyz"; caesarEncrypt(ch, key) := - let - correctAlphabet := - lowerAlphabet when some(ch = lowerAlphabet) - else - upperAlphabet; - - index := Sequence::firstIndexOf(correctAlphabet, ch); - - newIndex := (index + key - 1) mod 26 + 1; - in - ch when not(some(ch = lowerAlphabet) or some(ch = upperAlphabet)) - else - correctAlphabet[newIndex]; - + let + correctAlphabet := + lowerAlphabet when some(ch = lowerAlphabet) + else + upperAlphabet; + + index := Sequence::firstIndexOf(correctAlphabet, ch); + + newIndex := (index + key - 1) mod 26 + 1; + in + ch when not(some(ch = lowerAlphabet) or some(ch = upperAlphabet)) + else + correctAlphabet[newIndex]; + caesarDecrypt(ch, key) := caesarEncrypt(ch, 26 - key); main(args(2)) := - let - key := Conversion::stringToInt(args[2]); - encrypted := caesarEncrypt(args[1], key); - decrypted := caesarDecrypt(encrypted, key); - in - "Input: \t" ++ args[1] ++ "\n" ++ - "Encrypted:\t" ++ encrypted ++ "\n" ++ - "Decrypted:\t" ++ decrypted; + let + key := Conversion::stringToInt(args[2]); + encrypted := caesarEncrypt(args[1], key); + decrypted := caesarDecrypt(encrypted, key); + in + "Input: \t" ++ args[1] ++ "\n" ++ + "Encrypted:\t" ++ encrypted ++ "\n" ++ + "Decrypted:\t" ++ decrypted; diff --git a/Task/Caesar-cipher/SheerPower-4GL/caesar-cipher.4gl b/Task/Caesar-cipher/SheerPower-4GL/caesar-cipher.4gl new file mode 100644 index 0000000000..0e623ae1f1 --- /dev/null +++ b/Task/Caesar-cipher/SheerPower-4GL/caesar-cipher.4gl @@ -0,0 +1,46 @@ +declare string plaintext$, ciphertext$, decrypted$ + +plaintext$ = 'The Quick Brown Fox Jumps Over The Lazy Dog' + +print 'Plaintext: '; plaintext$ + +ciphertext$ = caesar$(plaintext$, 13) +print 'ROT13: '; ciphertext$ + +decrypted$ = caesar$(ciphertext$, 13) +print 'Decrypted: '; decrypted$ + +print +print 'Shift 3 example (classic Caesar):' +ciphertext$ = caesar$('Attack at dawn', 3) +print 'Encrypted: '; ciphertext$ +print 'Decrypted: '; caesar$(ciphertext$, 23) + +! ============================================================================= +! Routine: caesar$(text$, shift%) +! +! Shift each letter in text$ by shift% positions. A–Z and a–z wrap +! within their own ranges; all other characters are copied unchanged. +! ============================================================================= +routine caesar$(text$, shift%) + declare string result$, ch$ + declare integer i%, code% + + result$ = '' + for i% = 1 to len(text$) + ch$ = mid$(text$, i%, 1) + code% = ord(ch$) + + if code% >= 65 and code% <= 90 then + ! Uppercase A–Z: rotate within 65–90 + result$ = result$ + chr$((code% - 65 + shift%) mod 26 + 65) + elseif code% >= 97 and code% <= 122 then + ! Lowercase a–z: rotate within 97–122 + result$ = result$ + chr$((code% - 97 + shift%) mod 26 + 97) + else + ! Non-letter: pass through unchanged + result$ = result$ + ch$ + end if + next i% + caesar$ = result$ +end routine diff --git a/Task/Caesar-cipher/Stata/caesar-cipher.stata b/Task/Caesar-cipher/Stata/caesar-cipher.stata index 823b54b67f..781a4a32cb 100644 --- a/Task/Caesar-cipher/Stata/caesar-cipher.stata +++ b/Task/Caesar-cipher/Stata/caesar-cipher.stata @@ -1,10 +1,10 @@ function caesar(s, k) { - u = ascii(s) - i = selectindex(u:>=65 :& u:<=90) - if (length(i)>0) u[i] = mod(u[i]:+(k-65), 26):+65 - i = selectindex(u:>=97 :& u:<=122) - if (length(i)>0) u[i] = mod(u[i]:+(k-97), 26):+97 - return(char(u)) + u = ascii(s) + i = selectindex(u:>=65 :& u:<=90) + if (length(i)>0) u[i] = mod(u[i]:+(k-65), 26):+65 + i = selectindex(u:>=97 :& u:<=122) + if (length(i)>0) u[i] = mod(u[i]:+(k-97), 26):+97 + return(char(u)) } caesar("layout", 20) diff --git a/Task/Caesar-cipher/Tcl/caesar-cipher-1.tcl b/Task/Caesar-cipher/Tcl/caesar-cipher-1.tcl index 27c85f38e0..78343594f8 100644 --- a/Task/Caesar-cipher/Tcl/caesar-cipher-1.tcl +++ b/Task/Caesar-cipher/Tcl/caesar-cipher-1.tcl @@ -3,21 +3,21 @@ 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}]] - } + 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 + string map $encryptMap $text } method decrypt text { - string map $decryptMap $text + string map $decryptMap $text } } diff --git a/Task/Caesar-cipher/TypeScript/caesar-cipher.ts b/Task/Caesar-cipher/TypeScript/caesar-cipher.ts index 2721324997..cee247c48a 100644 --- a/Task/Caesar-cipher/TypeScript/caesar-cipher.ts +++ b/Task/Caesar-cipher/TypeScript/caesar-cipher.ts @@ -1,8 +1,8 @@ function replace(input: string, key: number) : string { - return input.replace(/([a-z])/g, - ($1) => String.fromCharCode(($1.charCodeAt(0) + key + 26 - 97) % 26 + 97) - ).replace(/([A-Z])/g, - ($1) => String.fromCharCode(($1.charCodeAt(0) + key + 26 - 65) % 26 + 65)); + return input.replace(/([a-z])/g, + ($1) => String.fromCharCode(($1.charCodeAt(0) + key + 26 - 97) % 26 + 97) + ).replace(/([A-Z])/g, + ($1) => String.fromCharCode(($1.charCodeAt(0) + key + 26 - 65) % 26 + 65)); } // test diff --git a/Task/Caesar-cipher/Uiua/caesar-cipher.uiua b/Task/Caesar-cipher/Uiua/caesar-cipher.uiua new file mode 100644 index 0000000000..4f3720c52e --- /dev/null +++ b/Task/Caesar-cipher/Uiua/caesar-cipher.uiua @@ -0,0 +1,7 @@ +k ← 3 +m ← -:26 k +Rot ← +@A◿26+k-@A +Rrot ← +@A◿26+m-@A +&sc +&p. ⍥(¯≡(⍥Rot=1±.))2 +&p ⍥(¯≡(⍥Rrot=1±.))2 diff --git a/Task/Caesar-cipher/Ursa/caesar-cipher.ursa b/Task/Caesar-cipher/Ursa/caesar-cipher.ursa index 0039e259da..70ec888a94 100644 --- a/Task/Caesar-cipher/Ursa/caesar-cipher.ursa +++ b/Task/Caesar-cipher/Ursa/caesar-cipher.ursa @@ -1,7 +1,7 @@ decl string mode while (not (or (= mode "encode") (= mode "decode"))) - out "encode/decode: " console - set mode (lower (in string console)) + out "encode/decode: " console + set mode (lower (in string console)) end while decl string message @@ -12,17 +12,17 @@ decl int key out "key: " console set key (in int console) if (or (> key 26) (< key 0)) - out endl "invalid key" endl console - stop + out endl "invalid key" endl console + stop end if if (= mode "decode") - set key (int (- 26 key)) + set key (int (- 26 key)) end if for (decl int i) (< i (size message)) (inc i) - if (and (> (ord message) 64) (< (ord message) 91)) - out (chr (int (+ (mod (int (+ (- (ord message) 65) key)) 26) 65))) console - end if + if (and (> (ord message) 64) (< (ord message) 91)) + out (chr (int (+ (mod (int (+ (- (ord message) 65) key)) 26) 65))) console + end if end for out endl console diff --git a/Task/Caesar-cipher/V-(Vlang)/caesar-cipher.v b/Task/Caesar-cipher/V-(Vlang)/caesar-cipher.v index 41f5a5ece3..6be2839b81 100644 --- a/Task/Caesar-cipher/V-(Vlang)/caesar-cipher.v +++ b/Task/Caesar-cipher/V-(Vlang)/caesar-cipher.v @@ -1,40 +1,35 @@ import rand -const -( - lo_abc = 'abcdefghijklmnopqrstuvwxyz' - up_abc = 'ABCDEFGHIJKLMNIPQRSTUVWXYZ' -) +const lo_abc = 'abcdefghijklmnopqrstuvwxyz' +const up_abc = 'ABCDEFGHIJKLMNIPQRSTUVWXYZ' fn main() { - key := rand.int_in_range(2, 25) or {13} - encrypted := caesar_encrypt('The five boxing wizards jump quickly', key) - println(encrypted) - println(caesar_decrypt(encrypted, key)) + key := rand.int_in_range(2, 25) or {13} + encrypted := caesar_encrypt('The five boxing wizards jump quickly', key) + println(encrypted) + println(caesar_decrypt(encrypted, key)) } fn caesar_encrypt(str string, key int) string { - offset := key % 26 - if offset == 0 {return str} - mut nchr := u8(0) - mut chr_arr := []u8{} - for chr in str { - if chr.ascii_str() in up_abc.split('') { - nchr = chr + u8(offset) - if nchr > u8(90) {nchr -= 26} - } - else if chr.ascii_str() in lo_abc.split('') { - nchr = chr + u8(offset) - if nchr > u8(122) {nchr -= 26} - } - else { - nchr = chr - } - chr_arr << nchr - } - return chr_arr.bytestr() + offset := key % 26 + if offset == 0 {return str} + mut nchr := u8(0) + mut chr_arr := []u8{} + for chr in str { + if chr.ascii_str() in up_abc.split('') { + nchr = chr + u8(offset) + if nchr > u8(90) {nchr -= 26} + } + else if chr.ascii_str() in lo_abc.split('') { + nchr = chr + u8(offset) + if nchr > u8(122) {nchr -= 26} + } + else {nchr = chr} + chr_arr << nchr + } + return chr_arr.bytestr() } fn caesar_decrypt(str string, key int) string { - return caesar_encrypt(str, 26 - key) + return caesar_encrypt(str, 26 - key) } diff --git a/Task/Caesar-cipher/VBScript/caesar-cipher.vb b/Task/Caesar-cipher/VBScript/caesar-cipher.vb deleted file mode 100644 index 80a55326d5..0000000000 --- a/Task/Caesar-cipher/VBScript/caesar-cipher.vb +++ /dev/null @@ -1,35 +0,0 @@ - str = "IT WAS THE BEST OF TIMES, IT WAS THE WORST OF TIMES." - - Wscript.Echo str - Wscript.Echo Rotate(str,5) - Wscript.Echo Rotate(Rotate(str,5),-5) - - 'Rotate (Caesar encrypt/decrypt) test positions. - ' numpos < 0 - rotate left - ' numpos > 0 - rotate right - 'Left rotation is converted to equivalent right rotation - - Function Rotate (text, numpos) - - dim dic: set dic = CreateObject("Scripting.Dictionary") - dim ltr: ltr = Split("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z") - dim rot: rot = (26 + numpos Mod 26) Mod 26 'convert all to right rotation - dim ch - dim i - - for i = 0 to ubound(ltr) - dic(ltr(i)) = ltr((rot+i) Mod 26) - next - - Rotate = "" - - for i = 1 to Len(text) - ch = Mid(text,i,1) - if dic.Exists(ch) Then - Rotate = Rotate & dic(ch) - else - Rotate = Rotate & ch - end if - next - - End Function diff --git a/Task/Caesar-cipher/VBScript/caesar-cipher.vbs b/Task/Caesar-cipher/VBScript/caesar-cipher.vbs new file mode 100644 index 0000000000..73b7fd082c --- /dev/null +++ b/Task/Caesar-cipher/VBScript/caesar-cipher.vbs @@ -0,0 +1,35 @@ + str = "IT WAS THE BEST OF TIMES, IT WAS THE WORST OF TIMES." + + Wscript.Echo str + Wscript.Echo Rotate(str,5) + Wscript.Echo Rotate(Rotate(str,5),-5) + + 'Rotate (Caesar encrypt/decrypt) test positions. + ' numpos < 0 - rotate left + ' numpos > 0 - rotate right + 'Left rotation is converted to equivalent right rotation + + Function Rotate (text, numpos) + + dim dic: set dic = CreateObject("Scripting.Dictionary") + dim ltr: ltr = Split("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z") + dim rot: rot = (26 + numpos Mod 26) Mod 26 'convert all to right rotation + dim ch + dim i + + for i = 0 to ubound(ltr) + dic(ltr(i)) = ltr((rot+i) Mod 26) + next + + Rotate = "" + + for i = 1 to Len(text) + ch = Mid(text,i,1) + if dic.Exists(ch) Then + Rotate = Rotate & dic(ch) + else + Rotate = Rotate & ch + end if + next + + End Function diff --git a/Task/Caesar-cipher/Vedit-macro-language/caesar-cipher.vedit b/Task/Caesar-cipher/Vedit-macro-language/caesar-cipher.vedit index 058a1d7857..52623467cf 100644 --- a/Task/Caesar-cipher/Vedit-macro-language/caesar-cipher.vedit +++ b/Task/Caesar-cipher/Vedit-macro-language/caesar-cipher.vedit @@ -6,6 +6,6 @@ while(Cur_Pos < Block_End) { if (Cur_Char >= 'A') { Ins_Char((Cur_Char - #11 + 26 + #10) % 26 + #11, OVERWRITE) } else { - Char(1) + Char(1) } } diff --git a/Task/Caesar-cipher/XBS/caesar-cipher.xbs b/Task/Caesar-cipher/XBS/caesar-cipher.xbs index 79c542bd70..3b717a8a5f 100644 --- a/Task/Caesar-cipher/XBS/caesar-cipher.xbs +++ b/Task/Caesar-cipher/XBS/caesar-cipher.xbs @@ -1,33 +1,33 @@ set letters="ABCDEFGHIJKLMNOPQRSTUVWXYZ"::split(); func caesar(text,shift:number=1){ - set res:string=""; - for(i=0;?text-1;1){ - set t=text::at(i); - set n=(letters::find(t::upper())+shift)%?letters; - while(n<0){ - n=?letters+n; - } - set l=letters[n]; - (t::upper()==t)|=>l=l::lower() - res+=l; - } - send res; + set res:string=""; + for(i=0;?text-1;1){ + set t=text::at(i); + set n=(letters::find(t::upper())+shift)%?letters; + while(n<0){ + n=?letters+n; + } + set l=letters[n]; + (t::upper()==t)|=>l=l::lower() + res+=l; + } + send res; } func decode(text,shift:number=1){ - set res:string=""; - for(i=0;?text-1;1){ - set t=text::at(i); - set n=(letters::find(t::upper())-shift)%?letters; - while(n<0){ - n=?letters+n; - } - set l=letters[n]; - (t::upper()==t)|=>l=l::lower() - res+=l; - } - send res; + set res:string=""; + for(i=0;?text-1;1){ + set t=text::at(i); + set n=(letters::find(t::upper())-shift)%?letters; + while(n<0){ + n=?letters+n; + } + set l=letters[n]; + (t::upper()==t)|=>l=l::lower() + res+=l; + } + send res; } set e=caesar("Hi",20); diff --git a/Task/Caesar-cipher/Yabasic/caesar-cipher.basic b/Task/Caesar-cipher/Yabasic/caesar-cipher.basic index a6563221c0..501b949c9b 100644 --- a/Task/Caesar-cipher/Yabasic/caesar-cipher.basic +++ b/Task/Caesar-cipher/Yabasic/caesar-cipher.basic @@ -11,25 +11,25 @@ print encrypted$ : print print criptex$(encrypted$, key$, DECIPHER) sub criptex$(text$, key$, mode) - local i, k, delta, longtext, longPattern, longkey, pattern$, res$ - - pattern$ = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 .,;:()-" - - longPattern = len(pattern$) - longtext = len(text$) - longkey = len(key$) - - for i = 1 to longtext - k = k + 1 : if k > longkey k = 1 - delta = instr(pattern$, mid$(text$, i, 1)) - delta = delta + (mode * instr(pattern$, mid$(key$, k, 1))) - if delta > longPattern then - delta = delta - longPattern - elseif delta < 1 then - delta = longPattern + delta - end if - res$ = res$ + mid$(pattern$, delta, 1) - next i + local i, k, delta, longtext, longPattern, longkey, pattern$, res$ - return res$ + pattern$ = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 .,;:()-" + + longPattern = len(pattern$) + longtext = len(text$) + longkey = len(key$) + + for i = 1 to longtext + k = k + 1 : if k > longkey k = 1 + delta = instr(pattern$, mid$(text$, i, 1)) + delta = delta + (mode * instr(pattern$, mid$(key$, k, 1))) + if delta > longPattern then + delta = delta - longPattern + elseif delta < 1 then + delta = longPattern + delta + end if + res$ = res$ + mid$(pattern$, delta, 1) + next i + + return res$ end sub diff --git a/Task/Caesar-cipher/Zig/caesar-cipher.zig b/Task/Caesar-cipher/Zig/caesar-cipher.zig new file mode 100644 index 0000000000..d705cdd1c4 --- /dev/null +++ b/Task/Caesar-cipher/Zig/caesar-cipher.zig @@ -0,0 +1,23 @@ +const std = @import("std"); +const stdout = @import("std").io.getStdOut().writer(); + +pub fn rot(txt: []u8, key: u8) void { + for (txt, 0..txt.len) |c, i| { + if (std.ascii.isLower(c)) { + txt[i] = (c - 'a' + key) % 26 + 'a'; + } else if (std.ascii.isUpper(c)) { + txt[i] = (c - 'A' + key) % 26 + 'A'; + } + } +} + +pub fn main() !void { + const key = 3; + var txt = "The five boxing wizards jump quickly".*; + + try stdout.print("Original: {s}\n", .{txt}); + rot(&txt, key); + try stdout.print("Encrypted: {s}\n", .{txt}); + rot(&txt, 26 - key); + try stdout.print("Decrypted: {s}\n", .{txt}); +} diff --git a/Task/Caesar-cipher/Zonnon/caesar-cipher.zonnon b/Task/Caesar-cipher/Zonnon/caesar-cipher.zonnon index 0473b3a2dc..e22a314696 100644 --- a/Task/Caesar-cipher/Zonnon/caesar-cipher.zonnon +++ b/Task/Caesar-cipher/Zonnon/caesar-cipher.zonnon @@ -1,57 +1,57 @@ module Caesar; const - size = 25; + size = 25; type - Operation = (code,decode); + Operation = (code,decode); procedure C_D(s:string;k:integer;op: Operation): string; var - i,key: integer; - resp: string; - n,c: char; + i,key: integer; + resp: string; + n,c: char; begin - resp := ""; - if op = Operation.decode then key := k else key := (26 - k) end; - for i := 0 to len(s) - 1 do - c := cap(s[i]); - if (c >= 'A') & (c <= 'Z') then - resp := resp + - string(char(integer('A') + ((integer(c) - integer('A') + key )) mod 26)); - else - resp := resp + string(c) - end; - end; - return resp + resp := ""; + if op = Operation.decode then key := k else key := (26 - k) end; + for i := 0 to len(s) - 1 do + c := cap(s[i]); + if (c >= 'A') & (c <= 'Z') then + resp := resp + + string(char(integer('A') + ((integer(c) - integer('A') + key )) mod 26)); + else + resp := resp + string(c) + end; + end; + return resp end C_D; procedure {public} Cipher(s:string;k:integer):string; var - i: integer; - resp: string; - n,c: char; + i: integer; + resp: string; + n,c: char; begin - return C_D(s,k,Operation.code) + return C_D(s,k,Operation.code) end Cipher; procedure {public} Decipher(s:string;k:integer):string; var - i: integer; - resp: string; - n,c: char; + i: integer; + resp: string; + n,c: char; begin - return C_D(s,k,Operation.decode) + return C_D(s,k,Operation.decode) end Decipher; var - txt,cipher,decipher: string; + txt,cipher,decipher: string; begin - txt := "HI";cipher := Caesar.Cipher(txt,2);decipher := Caesar.Decipher(cipher,2); - writeln(txt," -c-> ",cipher," -d-> ",decipher); - txt := "ZA";cipher := Caesar.Cipher(txt,2);decipher := Caesar.Decipher(cipher,2); - writeln(txt," -c-> ",cipher," -d-> ",decipher); - txt := "The five boxing wizards jump quickly"; - cipher := Caesar.Cipher(txt,2);decipher := Caesar.Decipher(cipher,2); - writeln(txt," -c-> ",cipher," -d-> ",decipher) + txt := "HI";cipher := Caesar.Cipher(txt,2);decipher := Caesar.Decipher(cipher,2); + writeln(txt," -c-> ",cipher," -d-> ",decipher); + txt := "ZA";cipher := Caesar.Cipher(txt,2);decipher := Caesar.Decipher(cipher,2); + writeln(txt," -c-> ",cipher," -d-> ",decipher); + txt := "The five boxing wizards jump quickly"; + cipher := Caesar.Cipher(txt,2);decipher := Caesar.Decipher(cipher,2); + writeln(txt," -c-> ",cipher," -d-> ",decipher) end Caesar. diff --git a/Task/Calculating-the-value-of-e/AArch64-Assembly/calculating-the-value-of-e.aarch64 b/Task/Calculating-the-value-of-e/AArch64-Assembly/calculating-the-value-of-e.aarch64 new file mode 100644 index 0000000000..9a78341a45 --- /dev/null +++ b/Task/Calculating-the-value-of-e/AArch64-Assembly/calculating-the-value-of-e.aarch64 @@ -0,0 +1,41 @@ +#include + +.globl main +.section .text + +/* + eulers constant is the sum of the + series Σ_0 ^ ∞ 1/n! = 1 + 1/1 + 1/2 + 1/2*3 ... +*/ + +main: + stp x29, x30, [sp, #-16]! + + fmov d0, #1.0 + fadd d0, d0, d0 // sum accumulator = 2 to start + + fmov d1, #1.0 // fraction value + fmov d4, #1.0 // permanent 1.0 + + mov x0, #16 // max step + mov x1, #1 // start value + + 1: + add x1, x1, #1 + + scvtf d2, x1 + fmul d1, d1, d2 + fdiv d3, d4, d1 + fadd d0, d0, d3 + + cmp x1, x0 + b.lt 1b + + adr x0, string + bl printf + + ldp x29, x30, [sp], 16 + ret + +.section .rodata +string: .asciz "euler's constant e ≈ %18.16f\n" diff --git a/Task/Calculating-the-value-of-e/ALGOL-68/calculating-the-value-of-e.alg b/Task/Calculating-the-value-of-e/ALGOL-68/calculating-the-value-of-e.alg index 44a167fc1a..fac6fe1652 100644 --- a/Task/Calculating-the-value-of-e/ALGOL-68/calculating-the-value-of-e.alg +++ b/Task/Calculating-the-value-of-e/ALGOL-68/calculating-the-value-of-e.alg @@ -1,14 +1,14 @@ BEGIN # calculate an approximation to e # LONG REAL epsilon = 1.0e-15; - LONG INT fact := 1; - LONG REAL e := 2; - LONG INT n := 2; + LONG INT f := 1; + LONG REAL e := 2; + LONG INT n := 2; WHILE LONG REAL e0 = e; - fact *:= n; - n +:= 1; - e +:= 1.0 / fact; + f *:= n; + n +:= 1; + e +:= 1.0 / f; ABS ( e - e0 ) >= epsilon DO SKIP OD; print( ( "e = ", fixed( e, -17, 15 ), newline ) ) diff --git a/Task/Calculating-the-value-of-e/ALGOL-W/calculating-the-value-of-e.alg b/Task/Calculating-the-value-of-e/ALGOL-W/calculating-the-value-of-e.alg new file mode 100644 index 0000000000..2e559bfec8 --- /dev/null +++ b/Task/Calculating-the-value-of-e/ALGOL-W/calculating-the-value-of-e.alg @@ -0,0 +1,16 @@ +begin % calculate an approximation to e % + long real epsilon; + long real e0, e, f; + integer n; + epsilon := 1'-14; f := 1; e := n := 2; + while begin + e0 := e; + f := f * n; + n := n + 1; + e := e + 1.0 / f; + abs ( e - e0 ) >= epsilon + end do begin end; + write( I_w := 1, s_w := 0, r_format := "A", r_w := 16, r_d := 14 % <-- sets output formatting % + , "e = ", e, " after ", n - 1, " iterations" + ) +end. diff --git a/Task/Calculating-the-value-of-e/Ada/calculating-the-value-of-e.ada b/Task/Calculating-the-value-of-e/Ada/calculating-the-value-of-e.adb similarity index 100% rename from Task/Calculating-the-value-of-e/Ada/calculating-the-value-of-e.ada rename to Task/Calculating-the-value-of-e/Ada/calculating-the-value-of-e.adb diff --git a/Task/Calculating-the-value-of-e/ArkScript/calculating-the-value-of-e.ark b/Task/Calculating-the-value-of-e/ArkScript/calculating-the-value-of-e.ark new file mode 100644 index 0000000000..a344a4416c --- /dev/null +++ b/Task/Calculating-the-value-of-e/ArkScript/calculating-the-value-of-e.ark @@ -0,0 +1,22 @@ +(import std.Range :range) +(import std.List) + +(let fact (fun (n acc) { + (if (> n 0) + (fact (- n 1) (* acc n)) + acc) })) + +(let r (range 1 18)) +(let p + (list:sum + (list:map + (list:reverse (r.asList)) + (fun (n) + (/ 1 (fact n 1)) )))) + +(import std.Math :abs) + +(let my_e (+ p 1)) +(print my_e) +(print math:e) +(assert (< (abs (- my_e math:e)) (toNumber "1e-15")) "computed e is near the math:e") diff --git a/Task/Calculating-the-value-of-e/BBC-BASIC/calculating-the-value-of-e.basic b/Task/Calculating-the-value-of-e/BBC-BASIC/calculating-the-value-of-e.basic new file mode 100644 index 0000000000..fd02c1168e --- /dev/null +++ b/Task/Calculating-the-value-of-e/BBC-BASIC/calculating-the-value-of-e.basic @@ -0,0 +1,14 @@ + @%=&1302 + EPSILON = 1.0E-15 + Fact = 1 + E = 2.0 + E0 = 0.0 + N% = 2 + WHILE ABS(E - E0) >= EPSILON + E0 = E + Fact *= N% + N% += 1 + E += 1.0 / Fact + ENDWHILE + PRINT "e = ";E + END diff --git a/Task/Calculating-the-value-of-e/Ballerina/calculating-the-value-of-e.ballerina b/Task/Calculating-the-value-of-e/Ballerina/calculating-the-value-of-e.ballerina new file mode 100644 index 0000000000..126270884a --- /dev/null +++ b/Task/Calculating-the-value-of-e/Ballerina/calculating-the-value-of-e.ballerina @@ -0,0 +1,17 @@ +import ballerina/io; + +const EPSILON = 1e-15; + +public function main() { + int fact = 1; + float e = 2.0; + int n = 2; + while true { + float e0 = e; + fact *= n; + n += 1; + e += 1.0 / fact; + if (e - e0).abs() < EPSILON { break; } + } + io:println("e = ", e); +} diff --git a/Task/Calculating-the-value-of-e/COBOL/calculating-the-value-of-e.cob b/Task/Calculating-the-value-of-e/COBOL/calculating-the-value-of-e.cob new file mode 100644 index 0000000000..d20ba6e3fe --- /dev/null +++ b/Task/Calculating-the-value-of-e/COBOL/calculating-the-value-of-e.cob @@ -0,0 +1,23 @@ + IDENTIFICATION DIVISION. + PROGRAM-ID. euler. + DATA DIVISION. + WORKING-STORAGE SECTION. + 77 epsilon USAGE FLOAT-LONG VALUE IS 1.0E-15. + 77 fact USAGE IS BINARY-DOUBLE UNSIGNED VALUE IS 1. + 77 n USAGE IS BINARY-LONG UNSIGNED. + 77 e USAGE IS FLOAT-LONG VALUE IS 2.0. + 77 e0 USAGE IS FLOAT-LONG VALUE IS 0.0. + 01 result-message. + 03 FILLER PICTURE IS X(4) VALUE IS 'e = '. + 03 result-value PICTURE IS 9.9(18) USAGE IS DISPLAY. + PROCEDURE DIVISION. + PERFORM WITH TEST BEFORE VARYING n FROM 2 BY 1 + UNTIL FUNCTION ABS(e - e0) IS LESS THAN epsilon + MOVE e TO e0 + MULTIPLY n BY fact + COMPUTE e = e + 1.0 / fact + END-PERFORM. + MOVE e TO result-value. + DISPLAY result-message. + STOP RUN. + END PROGRAM euler. diff --git a/Task/Calculating-the-value-of-e/COBOL/calculating-the-value-of-e.cobol b/Task/Calculating-the-value-of-e/COBOL/calculating-the-value-of-e.cobol deleted file mode 100644 index 6a72c6a31e..0000000000 --- a/Task/Calculating-the-value-of-e/COBOL/calculating-the-value-of-e.cobol +++ /dev/null @@ -1,25 +0,0 @@ - >>SOURCE FORMAT IS FIXED - IDENTIFICATION DIVISION. - PROGRAM-ID. EULER. - DATA DIVISION. - WORKING-STORAGE SECTION. - 01 EPSILON USAGE COMPUTATIONAL-2 VALUE 1.0E-15. - 01 FACT USAGE BINARY-DOUBLE UNSIGNED VALUE 1. - 01 N USAGE BINARY-INT UNSIGNED. - 01 E USAGE COMPUTATIONAL-2 VALUE 2.0. - 01 E0 USAGE COMPUTATIONAL-2 value 0.0. - 01 RESULT-MESSAGE. - 03 FILLER PIC X(4) VALUE 'e = '. - 03 RESULT-VALUE PIC 9.9(18) USAGE DISPLAY. - PROCEDURE DIVISION. - MAIN SECTION. - PERFORM - VARYING N FROM 2 BY 1 - UNTIL FUNCTION ABS(E - E0) < EPSILON - MOVE E TO E0 - COMPUTE FACT = FACT * N - COMPUTE E = E + 1.0 / FACT - END-PERFORM. - MOVE E TO RESULT-VALUE. - DISPLAY RESULT-MESSAGE. - STOP RUN. diff --git a/Task/Calculating-the-value-of-e/Delphi/calculating-the-value-of-e.delphi b/Task/Calculating-the-value-of-e/Delphi/calculating-the-value-of-e.pas similarity index 100% rename from Task/Calculating-the-value-of-e/Delphi/calculating-the-value-of-e.delphi rename to Task/Calculating-the-value-of-e/Delphi/calculating-the-value-of-e.pas diff --git a/Task/Calculating-the-value-of-e/EDSAC-order-code/calculating-the-value-of-e-1.edsac b/Task/Calculating-the-value-of-e/EDSAC-order-code/calculating-the-value-of-e-1.edsac index 84c31ea9eb..d51b3a4a5e 100644 --- a/Task/Calculating-the-value-of-e/EDSAC-order-code/calculating-the-value-of-e-1.edsac +++ b/Task/Calculating-the-value-of-e/EDSAC-order-code/calculating-the-value-of-e-1.edsac @@ -1,5 +1,6 @@ [Calculate e] [EDSAC program, Initial Orders 2] + [2024-12-25 Bug fix: ensure sandwich bit in 35-bit constant is 0] [Library subroutine M3. Prints header and is then overwritten] [Here, last character sets teleprinter to figures] @@ -29,6 +30,8 @@ GK [set @ (theta) for relative addresses] [0] PF PF [build sum 4*(1/3! + 1/4! + 1/5! + ...)] [2] PF PF [term in sum] + T4#ZPF [load time: clear whole of #4, including sandwich bit] + T4Z [load time: resume normal loading] [4] PD PF [2^-34, stop when term < this] [6] PF [divisor] [7] IF [1/2] diff --git a/Task/Calculating-the-value-of-e/EasyLang/calculating-the-value-of-e.easy b/Task/Calculating-the-value-of-e/EasyLang/calculating-the-value-of-e.easy index eef33599f1..2c5eb9d8bf 100644 --- a/Task/Calculating-the-value-of-e/EasyLang/calculating-the-value-of-e.easy +++ b/Task/Calculating-the-value-of-e/EasyLang/calculating-the-value-of-e.easy @@ -1,11 +1,11 @@ -numfmt 5 0 +numfmt 0 15 fact = 1 n = 2 e = 2 -while abs (e - e0) > 0.0001 - e0 = e - fact = fact * n - n += 1 - e += 1 / fact +while e - e0 > 1e-15 + e0 = e + fact = fact * n + e += 1 / fact + n += 1 . print e diff --git a/Task/Calculating-the-value-of-e/Emacs-Lisp/calculating-the-value-of-e.l b/Task/Calculating-the-value-of-e/Emacs-Lisp/calculating-the-value-of-e.el similarity index 100% rename from Task/Calculating-the-value-of-e/Emacs-Lisp/calculating-the-value-of-e.l rename to Task/Calculating-the-value-of-e/Emacs-Lisp/calculating-the-value-of-e.el diff --git a/Task/Calculating-the-value-of-e/Euphoria/calculating-the-value-of-e.eu b/Task/Calculating-the-value-of-e/Euphoria/calculating-the-value-of-e.eu new file mode 100644 index 0000000000..19492b0e56 --- /dev/null +++ b/Task/Calculating-the-value-of-e/Euphoria/calculating-the-value-of-e.eu @@ -0,0 +1,23 @@ +include std/math.e + +-- native +? E +? exp(1) + +-- calculated +atom n, n1 +atom e1, e + +n = 1.0 +n1 = 1.0 +e1 = 0.0 +e = 1.0 + +while (e != e1) do + e1 = e + e += (1.0 / n) + n1 += 1 + n *= n1 +end while + +? e diff --git a/Task/Calculating-the-value-of-e/Fortran/calculating-the-value-of-e.f b/Task/Calculating-the-value-of-e/Fortran/calculating-the-value-of-e-1.f similarity index 100% rename from Task/Calculating-the-value-of-e/Fortran/calculating-the-value-of-e.f rename to Task/Calculating-the-value-of-e/Fortran/calculating-the-value-of-e-1.f diff --git a/Task/Calculating-the-value-of-e/Fortran/calculating-the-value-of-e-2.f b/Task/Calculating-the-value-of-e/Fortran/calculating-the-value-of-e-2.f new file mode 100644 index 0000000000..6501cc105a --- /dev/null +++ b/Task/Calculating-the-value-of-e/Fortran/calculating-the-value-of-e-2.f @@ -0,0 +1,32 @@ +program calculate_e + use iso_fortran_env, only: ep => real128 + implicit none + + integer :: n + real(kind=ep) :: sum_e, term, eps, c, y, t + real(kind=ep), parameter :: e_ref = 2.7182818284590452353602874713526624_ep + + sum_e = 0.0_ep + c = 0.0_ep + n = 0 + eps = epsilon(1.0_ep) + + do + term = 1.0_ep / gamma(real(n + 1, kind=ep)) + if (term < eps) exit + + ! Kahan summation to keep precision + y = term - c + t = sum_e + y + c = (t - sum_e) - y + sum_e = t + + n = n + 1 + end do + + write(*,'(a,t45,a)') 'Literature supplied value = ', & + '2.7182818284590452353602874713526624' + write(*,'(a,t41,F40.34)') 'Approximation of e using Taylor series = ', sum_e + write(*,'(a,t45,EN0.5)') 'Variance = ', abs(sum_e - e_ref) + write(*,*) 'Converged after', n, 'terms.' +end program calculate_e diff --git a/Task/Calculating-the-value-of-e/Haskell/calculating-the-value-of-e-1.hs b/Task/Calculating-the-value-of-e/Haskell/calculating-the-value-of-e-1.hs index e7ff6b2acd..d43cad0693 100644 --- a/Task/Calculating-the-value-of-e/Haskell/calculating-the-value-of-e-1.hs +++ b/Task/Calculating-the-value-of-e/Haskell/calculating-the-value-of-e-1.hs @@ -1,8 +1,7 @@ ------ APPROXIMATION OF E OBTAINED AFTER N ITERATIONS ---- eApprox :: Int -> Double -eApprox n = - (sum . take n) $ (1 /) <$> scanl (*) 1 [1 ..] +eApprox n = sum . map (1 /) $ scanl (*) 1 [1..n] --------------------------- TEST ------------------------- main :: IO () diff --git a/Task/Calculating-the-value-of-e/Haskell/calculating-the-value-of-e-3.hs b/Task/Calculating-the-value-of-e/Haskell/calculating-the-value-of-e-3.hs index 3b9b856f95..a13155388a 100644 --- a/Task/Calculating-the-value-of-e/Haskell/calculating-the-value-of-e-3.hs +++ b/Task/Calculating-the-value-of-e/Haskell/calculating-the-value-of-e-3.hs @@ -1,16 +1,4 @@ -{-# LANGUAGE TupleSections #-} - -------------------- APPROXIMATIONS TO E ------------------ - -approximatEs :: [Double] -approximatEs = - fst - <$> iterate - ( \(e, (i, n)) -> - (,) . (e +) . (1 /) <*> (succ i,) $ i * n - ) - (1, (1, 1)) - ---------------------------- TEST ------------------------- -main :: IO () -main = print $ approximatEs !! 17 +eApprox n = snd $ foldr f (1, 1) [n, pred n .. 1] + where + f x (fl, e) = + let y = fl * x in (y, e + 1 / y) diff --git a/Task/Calculating-the-value-of-e/Haskell/calculating-the-value-of-e-4.hs b/Task/Calculating-the-value-of-e/Haskell/calculating-the-value-of-e-4.hs new file mode 100644 index 0000000000..3b9b856f95 --- /dev/null +++ b/Task/Calculating-the-value-of-e/Haskell/calculating-the-value-of-e-4.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE TupleSections #-} + +------------------- APPROXIMATIONS TO E ------------------ + +approximatEs :: [Double] +approximatEs = + fst + <$> iterate + ( \(e, (i, n)) -> + (,) . (e +) . (1 /) <*> (succ i,) $ i * n + ) + (1, (1, 1)) + +--------------------------- TEST ------------------------- +main :: IO () +main = print $ approximatEs !! 17 diff --git a/Task/Calculating-the-value-of-e/Julia/calculating-the-value-of-e-1.julia b/Task/Calculating-the-value-of-e/Julia/calculating-the-value-of-e-1.jl similarity index 100% rename from Task/Calculating-the-value-of-e/Julia/calculating-the-value-of-e-1.julia rename to Task/Calculating-the-value-of-e/Julia/calculating-the-value-of-e-1.jl diff --git a/Task/Calculating-the-value-of-e/Julia/calculating-the-value-of-e-2.julia b/Task/Calculating-the-value-of-e/Julia/calculating-the-value-of-e-2.jl similarity index 100% rename from Task/Calculating-the-value-of-e/Julia/calculating-the-value-of-e-2.julia rename to Task/Calculating-the-value-of-e/Julia/calculating-the-value-of-e-2.jl diff --git a/Task/Calculating-the-value-of-e/Kotlin/calculating-the-value-of-e-1.kotlin b/Task/Calculating-the-value-of-e/Kotlin/calculating-the-value-of-e-1.kts similarity index 100% rename from Task/Calculating-the-value-of-e/Kotlin/calculating-the-value-of-e-1.kotlin rename to Task/Calculating-the-value-of-e/Kotlin/calculating-the-value-of-e-1.kts diff --git a/Task/Calculating-the-value-of-e/Kotlin/calculating-the-value-of-e-2.kotlin b/Task/Calculating-the-value-of-e/Kotlin/calculating-the-value-of-e-2.kts similarity index 100% rename from Task/Calculating-the-value-of-e/Kotlin/calculating-the-value-of-e-2.kotlin rename to Task/Calculating-the-value-of-e/Kotlin/calculating-the-value-of-e-2.kts diff --git a/Task/Calculating-the-value-of-e/Langur/calculating-the-value-of-e.langur b/Task/Calculating-the-value-of-e/Langur/calculating-the-value-of-e.langur index 1202af1ca2..b56040b204 100644 --- a/Task/Calculating-the-value-of-e/Langur/calculating-the-value-of-e.langur +++ b/Task/Calculating-the-value-of-e/Langur/calculating-the-value-of-e.langur @@ -1,17 +1,14 @@ mode divMaxScale = 104 -val .epsilon = 1.0e-104 +val epsilon = 1e-104 -var .e = 2 +var e = 2 -for .fact, .n = 1, 2 ; ; .n += 1 { - val .e0 = .e - .fact x= .n - .e += 1 / .fact - if abs(.e - .e0) < .epsilon: break +for fact, n = 1, 2 ; ; n += 1 { + val e0 = e + fact *= n + e += 1 / fact + if abs(e - e0) < epsilon: break } -writeln ".e = ", .e - -# compare to built-in constant e -writeln " e = ", e +writeln "e = ", e diff --git a/Task/Calculating-the-value-of-e/Liberty-BASIC/calculating-the-value-of-e.basic b/Task/Calculating-the-value-of-e/Liberty-BASIC/calculating-the-value-of-e.basic new file mode 100644 index 0000000000..83db0832f4 --- /dev/null +++ b/Task/Calculating-the-value-of-e/Liberty-BASIC/calculating-the-value-of-e.basic @@ -0,0 +1,30 @@ +' Cálculo de e con alta precisión visual usando Brother's formula +eFLB = exp(1) +euler = 0 + +print "Primeras 10 aproximaciones con Fórmula de Brother" +print +print "Iter.", "Valor (14 decim)", "Error" +print "----------------------------------------------------------" + +for n = 0 to 10 + numerador = 2*n + 2 + denominador = factorial(2*n + 1) + termino = numerador / denominador + euler = euler + termino + diferencia = abs(euler - eFLB) + print n, using("#.##############", euler), diferencia ' Ver 14 decimales +next n + +print "----------------------------------------------------------" +print +print "Valor de la función LB exp(1): "; using("#.##############", eFLB) +end + +function factorial(num) + f = 1 + for i = 1 to num + f = f*i + next i + factorial = f +end function diff --git a/Task/Calculating-the-value-of-e/M2000-Interpreter/calculating-the-value-of-e-1.m2000 b/Task/Calculating-the-value-of-e/M2000-Interpreter/calculating-the-value-of-e-1.m2000 index 3971cc6e8c..25ce9e9897 100644 --- a/Task/Calculating-the-value-of-e/M2000-Interpreter/calculating-the-value-of-e-1.m2000 +++ b/Task/Calculating-the-value-of-e/M2000-Interpreter/calculating-the-value-of-e-1.m2000 @@ -1,17 +1,22 @@ Module FindE { - Function comp_e (n){ - \\ max 28 for decimal (in one line with less spaces) - n/=28:For i=27to 1:n=1+n/i:Next i:=n - } - Clipboard Str$(comp_e(1@),"")+" Decimal"+{ - }+Str$(comp_e(1),"")+" Double"+{ - }+Str$(comp_e(1~),"")+" Float"+{ - }+Str$(comp_e(1#),"")+" Currency"+{ - } - Report Str$(comp_e(1@),"")+" Decimal"+{ - }+Str$(comp_e(1),"")+" Double"+{ - }+Str$(comp_e(1~),"")+" Float"+{ - }+Str$(comp_e(1#),"")+" Currency"+{ - } + Function comp_e (n, decimals ){ + unit=n:n/=decimals:For i=decimals-1 to 1:n=Unit+n/i:Next i:=n + } + p=1000 + k=comp_e(biginteger("1"+string$("0", p)), p) + string t1=str$(k), t=left$(t1, 39) + if len(t1)>39 then + for i=40 to len(t1) step 40 + t+={ + }+mid$(t1, i, 40) + next + end if + all=(comp_e(1@, 28))+" Decimal"+{ + }+(comp_e(1, 19))+" Double"+{ + }+(comp_e(1~, 11))+" Float"+{ + }+(comp_e(1#, 8))+" Currency"+{ + }+ left$(t,1)+locale$(14)+mid$(t,2) +" Arbitrary-precision :"+p + Clipboard all + Report all } FindE diff --git a/Task/Calculating-the-value-of-e/Maxima/calculating-the-value-of-e.maxima b/Task/Calculating-the-value-of-e/Maxima/calculating-the-value-of-e.maxima new file mode 100644 index 0000000000..d86f7a0058 --- /dev/null +++ b/Task/Calculating-the-value-of-e/Maxima/calculating-the-value-of-e.maxima @@ -0,0 +1,4 @@ +block(cfexpand([2,1,2,1,1,4,1,1,6,1,1,8,1,1,10,1,1,12,1,1,14]),float(%%[1,1]/%%[2,1])); + +/* Comparing with built-in constant */ +%e,numer; diff --git a/Task/Calculating-the-value-of-e/Nu/calculating-the-value-of-e.nu b/Task/Calculating-the-value-of-e/Nu/calculating-the-value-of-e.nu new file mode 100644 index 0000000000..43b7cf309b --- /dev/null +++ b/Task/Calculating-the-value-of-e/Nu/calculating-the-value-of-e.nu @@ -0,0 +1 @@ +let e = do {|n| (1 / $n + 1) ** $n } (2. ** 52) diff --git a/Task/Calculating-the-value-of-e/OCaml/calculating-the-value-of-e.ocaml b/Task/Calculating-the-value-of-e/OCaml/calculating-the-value-of-e.ml similarity index 100% rename from Task/Calculating-the-value-of-e/OCaml/calculating-the-value-of-e.ocaml rename to Task/Calculating-the-value-of-e/OCaml/calculating-the-value-of-e.ml diff --git a/Task/Calculating-the-value-of-e/Oberon-07/calculating-the-value-of-e.oberon b/Task/Calculating-the-value-of-e/Oberon-07/calculating-the-value-of-e.oberon new file mode 100644 index 0000000000..82212e18c0 --- /dev/null +++ b/Task/Calculating-the-value-of-e/Oberon-07/calculating-the-value-of-e.oberon @@ -0,0 +1,25 @@ +MODULE CalculateE; +IMPORT Out; + +VAR + fact,n : INTEGER; + e,e0 : REAL; + +BEGIN + fact := 1; + e := 2.0; + e0 := 0.0; + n := 2; + + WHILE e > e0 DO + e0 := e; + fact := fact * n; + INC(n); + e := e + 1.0 / FLT(fact) + END; + + Out.String("e = ");Out.Real(e, 0); + Out.String(", ");Out.Int(n,0); + Out.String(" iterations");Out.Ln + +END CalculateE. diff --git a/Task/Calculating-the-value-of-e/PascalABC.NET/calculating-the-value-of-e.pas b/Task/Calculating-the-value-of-e/PascalABC.NET/calculating-the-value-of-e.pas new file mode 100644 index 0000000000..e59efe7c9a --- /dev/null +++ b/Task/Calculating-the-value-of-e/PascalABC.NET/calculating-the-value-of-e.pas @@ -0,0 +1,19 @@ +function MyExp(x: real): real; +const eps = 1e-15; +begin + var y := 1.0; + var s := y; + var i := 1; + while y > eps do + begin + y *= x / i; + s += y; + i += 1; + end; + Result := s; +end; + +begin + Println(MyExp(1)); + Println(Exp(1)); +end. diff --git a/Task/Calculating-the-value-of-e/Phix/calculating-the-value-of-e.phix b/Task/Calculating-the-value-of-e/Phix/calculating-the-value-of-e.phix index 01e06fe609..0dd9865010 100644 --- a/Task/Calculating-the-value-of-e/Phix/calculating-the-value-of-e.phix +++ b/Task/Calculating-the-value-of-e/Phix/calculating-the-value-of-e.phix @@ -1,15 +1,13 @@ -(phixonline)--> - with javascript_semantics - requires("1.0.2") -- (builtin constant E renamed as EULER) - atom e0 = 0, e = 2, n = 0, fact = 1 - while abs(e-e0)>=1e-15 do - e0 = e - n += 1 - fact *= 2*n*(2*n+1) - e += (2*n+2)/fact - end while - printf(1,"Computed e = %.15f\n",e) - printf(1," Real e = %.15f\n",EULER) - printf(1," Error = %g\n",EULER-e) - printf(1,"Number of iterations = %d\n",n) - - return repeat(' ',left)&s&repeat(' ',right) - - return repeat(' ',left)&upper(s)&repeat(' ',right) - - initialSymEntry("integer", S_Type,"TI",opInt, E_none) -- #01 / 0b0001 integer - - Alias("INTEGER",symlimit) - - procedure tt_stringA(sequence text, integer alias) - tt_string(text,-2) - tt[pcurr] = alias - end procedure - - global constant T_include = 596 tt_stringF("include",T_include) - - tt_stringA("INCLUDE",T_include) - - Ch = find(Ch,escchar) - - Ch = find(lower(Ch),escchar) - - with javascript_semantics - constant year = 1969 +with javascript_semantics +constant year = 1969 - include builtins\timedate.e +include builtins\timedate.e - function centre(string s, integer width) - integer gap = width-length(s), - left = floor(gap/2), - right = gap-left - return repeat(' ',left) & s & repeat(' ',right) - end function +function centre(string s, integer width) + integer gap = width-length(s), + left = floor(gap/2), + right = gap-left + return repeat(' ',left) & s & repeat(' ',right) +end function - function one_month(integer year, integer month, bool sun_to_sat) - string weekdays = iff(sun_to_sat?"Su Mo Tu We Th Fr Sa" - :"Mo Tu We Th Fr Sa Su"), - line = repeat(' ',20) - sequence ldm = adjust_timedate(iff(month=12?{year+1,1,1,0,0,0,0,0} - :{year,month+1,1,0,0,0,0,0}), - timedelta(days:=-1)), - res = {centre(format_timedate(ldm,"Mmmm"),20),weekdays} - integer dow = day_of_week(year,month,1) - if sun_to_sat then dow = remainder(dow,7)+1 end if - integer lastday = ldm[DT_DAY], - p = dow*3-2 - for d=1 to lastday do - line[p..p+1] = sprintf("%2d",d) - p += 3 - if dow=7 or d=lastday then - res = append(res,line) - line = repeat(' ',20) - dow = 1 - p = 1 - else - dow += 1 - end if - end for - return res - end function +function one_month(integer year, integer month, bool sun_to_sat) + string weekdays = iff(sun_to_sat?"Su Mo Tu We Th Fr Sa" + :"Mo Tu We Th Fr Sa Su"), + line = repeat(' ',20) + sequence ldm = adjust_timedate(iff(month=12?{year+1,1,1,0,0,0,0,0} + :{year,month+1,1,0,0,0,0,0}), + timedelta(days:=-1)), + res = {centre(format_timedate(ldm,"Mmmm"),20),weekdays} + integer dow = day_of_week(year,month,1) + if sun_to_sat then dow = remainder(dow,7)+1 end if + integer lastday = ldm[DT_DAY], + p = dow*3-2 + for d=1 to lastday do + line[p..p+1] = sprintf("%2d",d) + p += 3 + if dow=7 or d=lastday then + res = append(res,line) + line = repeat(' ',20) + dow = 1 + p = 1 + else + dow += 1 + end if + end for + return res +end function - procedure print_calendar(integer year, width, bool sun_to_sat=false) - sequence months = repeat(0,12) - integer wide = floor((width+2)/22) - printf(1,centre("[Spot Reserved For Snoopy]",width)&"\n") - printf(1,centre(sprintf("%d",year),width)&"\n") - for month=1 to 12 do - months[month] = one_month(year,month,sun_to_sat) - end for - for month=1 to 12 by wide do - for k=1 to 9 do -- (more than enough) - integer any = 0 - string line = "" - for j=0 to wide-1 do - if length(line) then - line &= " " - end if - if k>length(months[month+j]) then - line &= repeat(' ',20) - else - line &= months[month+j][k] - any = 1 - end if - end for - if any=0 then exit end if - printf(1,centre(line,width)&"\n") - end for - end for - end procedure +procedure print_calendar(integer year, width, bool sun_to_sat=false) + sequence months = repeat(0,12) + integer wide = floor((width+2)/22) + printf(1,centre("[Spot Reserved For Snoopy]",width)&"\n") + printf(1,centre(sprintf("%d",year),width)&"\n") + for month=1 to 12 do + months[month] = one_month(year,month,sun_to_sat) + end for + for month=1 to 12 by wide do + for k=1 to 9 do -- (more than enough) + integer any = 0 + string line = "" + for j=0 to wide-1 do + if length(line) then + line &= " " + end if + if k>length(months[month+j]) then + line &= repeat(' ',20) + else + line &= months[month+j][k] + any = 1 + end if + end for + if any=0 then exit end if + printf(1,centre(line,width)&"\n") + end for + end for +end procedure - print_calendar(year,80) - printf(1,join(repeat("1234567890",8),"")&"\n") - print_calendar(year,132,true) - printf(1,join(repeat("1234567890",13),"")&"12\n") - - without js -- not from a browser, mate! - string {libname,funcname} = iff(platform()=WINDOWS?{"user32","CharLowerA"}:{"libc","tolower"}) - atom lib = open_dll(libname) - integer func = define_c_func(lib,funcname,{C_INT},C_INT) - if func=-1 then - ?{{lower('A')}} -- (you don't //have// to crash!) - else - ?c_func(func,{'A'}) -- ('A'==65) - end if - - without js -- (no class in p2js) - class test - string msg = "this is a test" - procedure show() ?this.msg end procedure - procedure inst() ?"this is dynamic" end procedure - end class - test t = new() - t.show() -- prints "this is a test" - t.inst() -- prints "this is dynamic" - t.inst = t.show - t.inst() -- prints "this is a test" - {ToSnakeCase(text)}"); + } + + Console.WriteLine(); + Console.WriteLine($"{"=== To camelCase ===",48}"); + foreach (string text in variableNames) + { + Console.WriteLine($"{text,34} --> {ToCamelCase(text)}"); + } + } + + private static string ToSnakeCase(string aCamel) + { + aCamel = aCamel.Trim().Replace(SPACE, UNDERSCORE).Replace(HYPHEN, UNDERSCORE); + StringBuilder snake = new StringBuilder(); + bool first = true; + foreach (char ch in aCamel) + { + if (first) + { + snake.Append(ch); + first = false; + } + else if (!first && char.IsUpper(ch)) + { + if (snake.ToString().EndsWith(UNDERSCORE)) + { + snake.Append(char.ToLower(ch)); + } + else + { + snake.Append(UNDERSCORE + char.ToLower(ch)); + } + } + else + { + snake.Append(ch); + } + } + return snake.ToString(); + } + + private static string ToCamelCase(string aSnake) + { + aSnake = aSnake.Trim().Replace(SPACE, UNDERSCORE).Replace(HYPHEN, UNDERSCORE); + StringBuilder camel = new StringBuilder(); + bool underscore = false; + foreach (char ch in aSnake) + { + if (ch.ToString().Equals(UNDERSCORE)) + { + underscore = true; + } + else if (underscore) + { + camel.Append(char.ToUpper(ch)); + underscore = false; + } + else + { + camel.Append(ch); + } + } + return camel.ToString(); + } + + private static readonly string SPACE = " "; + private static readonly string UNDERSCORE = "_"; + private static readonly string HYPHEN = "-"; +} diff --git a/Task/Camel-case-and-snake-case/Crystal/camel-case-and-snake-case.cr b/Task/Camel-case-and-snake-case/Crystal/camel-case-and-snake-case.cr new file mode 100644 index 0000000000..38a8fc567f --- /dev/null +++ b/Task/Camel-case-and-snake-case/Crystal/camel-case-and-snake-case.cr @@ -0,0 +1,6 @@ +["snakeCase", "snake_case", "variable_10_case", "variable10Case", "ɛrgo rE tHis", + "hurry-up-joe!", "c://my-docs/happy_Flag-Day/12.doc", " spaces "].each do |ident| + print ident, " => " + print ident.strip.gsub(/[ -]/, "_").camelcase, ", " + puts ident.strip.gsub(/[ -]/, "_").underscore +end diff --git a/Task/Camel-case-and-snake-case/Delphi/camel-case-and-snake-case.delphi b/Task/Camel-case-and-snake-case/Delphi/camel-case-and-snake-case.pas similarity index 100% rename from Task/Camel-case-and-snake-case/Delphi/camel-case-and-snake-case.delphi rename to Task/Camel-case-and-snake-case/Delphi/camel-case-and-snake-case.pas diff --git a/Task/Camel-case-and-snake-case/EasyLang/camel-case-and-snake-case.easy b/Task/Camel-case-and-snake-case/EasyLang/camel-case-and-snake-case.easy new file mode 100644 index 0000000000..52eb2646ce --- /dev/null +++ b/Task/Camel-case-and-snake-case/EasyLang/camel-case-and-snake-case.easy @@ -0,0 +1,69 @@ +func$ strip s$ . + a = 1 + while substr s$ a 1 = " " + a += 1 + . + b = len s$ + while substr s$ b 1 = " " + b -= 1 + . + return substr s$ a (b - a + 1) +. +func$ toupper c$ . + c = strcode c$ + if c >= 97 and c <= 122 + c$ = strchar (c - 32) + . + return c$ +. +func$ tolower c$ . + c = strcode c$ + if c >= 65 and c <= 90 + c$ = strchar (c + 32) + . + return c$ +. +func isupper c$ . + c = strcode c$ + if c >= 65 and c <= 90 + return 1 + . +. +delim$ = "_- " +func$ snakecase s$ . + s$ = strip s$ + for c$ in strchars s$ + if isupper c$ = 1 and prev$ <> "" + if strpos delim$ prev$ = 0 + r$ &= "_" + . + r$ &= tolower c$ + else + r$ &= c$ + . + prev$ = c$ + . + return r$ +. +func$ camelcase s$ . + s$ = strip s$ + prev$ = "x" + for c$ in strchars s$ + if strpos delim$ prev$ <> 0 + r$ &= toupper c$ + elif strpos delim$ c$ = 0 + r$ &= c$ + . + prev$ = c$ + . + return r$ +. +test$[] = [ "snakeCase" "snake_case" "variable_10_case" "variable10Case" "ɛrgo rE tHis" "hurry-up-joe!" "c://my-docs/happy_Flag-Day/12.doc" " spaces " ] +print "=== To snake_case ===" +for s$ in test$[] + print s$ & " -> " & snakecase s$ +. +print "\n=== To camelCase ===" +for s$ in test$[] + print s$ & " -> " & camelcase s$ +. diff --git a/Task/Camel-case-and-snake-case/Ed/camel-case-and-snake-case.ed b/Task/Camel-case-and-snake-case/Ed/camel-case-and-snake-case.ed new file mode 100644 index 0000000000..cd21f1e1b7 --- /dev/null +++ b/Task/Camel-case-and-snake-case/Ed/camel-case-and-snake-case.ed @@ -0,0 +1,7 @@ +# by Artyom Bologov +H +g/.*/s/\([A-Z]\)/_&/g +g/^\<_*/s/// +g/^_*\>/s/// +,p +Q diff --git a/Task/Camel-case-and-snake-case/Fortran/camel-case-and-snake-case.f b/Task/Camel-case-and-snake-case/Fortran/camel-case-and-snake-case.f new file mode 100644 index 0000000000..8d54399adc --- /dev/null +++ b/Task/Camel-case-and-snake-case/Fortran/camel-case-and-snake-case.f @@ -0,0 +1,291 @@ +! Camel case and snake case +! +! tested with Intel ifx (IFX) 2025.2.1 20250806 on Kubuntu 25.04 +! GNU Fortran (Ubuntu 14.2.0-19ubuntu2) 14.2.0 on Kubuntu 25.04 +! +! +! U.B., August 2025 +! +program CaseConverter + +implicit none + +! sep is a marker to separate words within given strings. +! Selected "§" because this is never part of a legit text. +! +character, parameter :: sep='§' + +character (len=:), allocatable :: testWord + + +print *, ' ***** Converting test strings to Snake Case *****' + +testWord = 'snakeCase' +call printResult (testWord, toSnakeCase (testWord)) + +testWord = 'snake_case' +call printResult (testWord, toSnakeCase (testWord)) + +testWord = 'variable_10_case' +call printResult (testWord, toSnakeCase (testWord)) + +testWord = 'variable10Case' +call printResult (testWord, toSnakeCase (testWord)) + +testWord = 'ɛrgo rE tHis' +call printResult (testWord, toSnakeCase (testWord)) + +testWord = 'hurry-up-joe!' +call printResult (testWord, toSnakeCase (testWord)) + +testWord = 'c://my-docs/happy_Flag-Day/12.doc' +call printResult (testWord, toSnakeCase (testWord)) + +testWord = ' spaces ' +call printResult (testWord, toSnakeCase (testWord)) + +print * +print *, ' ***** Converting test strings to Camel Case *****' + +testWord = 'snakeCase' +call printResult ( testWord, toCamelCase (testWord) ) + +testWord = 'snake_case' +call printResult ( testWord, toCamelCase (testWord) ) + +testWord = 'variable_10_case' +call printResult ( testWord, toCamelCase (testWord) ) + +testWord = 'variable10Case' +call printResult ( testWord, toCamelCase (testWord) ) + +testWord = 'ɛrgo rE tHis' +call printResult (testWord, toCamelCase(testWord)) + +testWord = 'hurry-up-joe!' +call printResult ( testWord, toCamelCase (testWord) ) + +testWord = 'c://my-docs/happy_Flag-Day/12.doc' +call printResult ( testWord, toCamelCase (testWord) ) + +testWord = ' spaces ' +call printResult ( testWord, toCamelCase (testWord) ) + + + + +contains + + +! ---------------------------------------------------------- +! print with variable format to display the greek "ɛ" +! and the following text positioned correctly. +! Letter "ɛ" uses 2 bytes so len("ɛ") = 2 but ulen("ɛ") = 1 +! ---------------------------------------------------------- + +subroutine printResult (a,b) +character*(*), intent(in) :: a,b +character (len=100) ::fmt +write (fmt, *) '(A', 34+ (len(a)-ulen(a)) ,', " => ",A)' +print fmt, a, b + +end subroutine printResult + + +!--------------------------------------- +! change ASCII a...z to upper case a...z +!--------------------------------------- +function toupper (c) result(retc) + +character ::c +character :: retc + +if (c >='a' .and. c <= 'z') then + retc = achar (iachar('A') + (iachar(c)-iachar('a'))) +else + retc = c +end if + +end function toupper + +!--------------------------------------- +! change ASCII A...Z to lower case a...z +!--------------------------------------- +function tolower (c) result(retc) + +character ::c +character :: retc + +if (c >='A' .and. c <= 'Z') then ! is upper case + retc = achar (iachar('a') + (iachar(c)-iachar('A'))) +else + retc = c +end if + +end function tolower + +!--------------------------------------------------------------------------------- +! Scan input text, mark all positions between distinct words within the text +! so that later in the actual conversion these points can be rewritten accordingly. +!--------------------------------------------------------------------------------- +function prepare (txt) result (newtext) + +character (len=*), intent (in) :: txt +character (len=:), allocatable :: text, newtext +integer :: ip1, ip2, ip3, l +character :: beginword + + +newtext=''; + +! First remove leading and trailing spaces +text = trim (txt) +text = adjustl (text) +text = trim (text) +l = len_trim(text) + +ip1 = 1 +ip2 = 2 +ip3 = 1 +do while (ip2 <= l) + if (text(ip2:ip2) >= 'A' .and. text(ip2:ip2) <='Z' ) then ! upcase letter indicates beginning of a word + newtext = newtext(:len_trim(newtext)) // text(ip1:ip2-1) // sep + ip1 = ip2 + ip2 = ip1+1 + else if (text(ip2:ip2) .eq. '_' & + .or. text(ip2:ip2) .eq. '-' & + .or. text(ip2:ip2) .eq. ' ' ) then ! Separator is behind current word, new word following. + if (ip2 .lt. l) then ! ip2+1 still inside text + beginword = tolower (text(ip2+1:ip2+1)) + newtext = newtext(:len_trim(newtext)) // text (ip1:ip2-1) // sep // beginword + else + ! separator at ip2 is last character of text. Just drop it. + newtext = newtext(:len_trim(newtext)) // text (ip1:ip2-1) + endif + ip1 = ip2+2 ! skip separator and begin of next word + ip2 = ip1 + else + ip2 = ip2 + 1 + end if +end do + +newtext = newtext(:len_trim(newtext)) // text(ip1:) + +end function prepare + +!----------------------------------- +! Convert prepared text to CamelCase +!----------------------------------- +function toCamelCase (txt) result(newtext) +! +! 1st char is lowercase, all spaces removed and word beginnings upperCase +! +character (len=*), intent (in) :: txt +character (:), allocatable :: text, newtext +integer :: ip, l +character :: beginword + +newtext = '' +text = prepare (txt) + +l = len_trim(text) +newtext = newtext(:len_trim(newtext)) // tolower (text(1:1)) + +ip = 2 + +do while (ip <= l) + if (text(ip:ip) .eq. sep) then + ip = ip + 1 ! skip the separator + if (ip ( int(Z'C0') + 1)) .and. ( ich < int(Z'E0') )) THEN + retlen=2 + else if ( ich < int(Z'F0') ) THEN + retlen=3 + else if ( ich <= int(Z'F4') ) THEN + retlen=4 + else + retlen=1 !assume we process larger seqences, 1 by 1 bytes + end if +end function + + +end program diff --git a/Task/Camel-case-and-snake-case/FutureBasic/camel-case-and-snake-case-1.basic b/Task/Camel-case-and-snake-case/FutureBasic/camel-case-and-snake-case-1.basic new file mode 100644 index 0000000000..3956f8db63 --- /dev/null +++ b/Task/Camel-case-and-snake-case/FutureBasic/camel-case-and-snake-case-1.basic @@ -0,0 +1,47 @@ +include "NSLog.incl" +local fn snake_toCamel( s as CFStringRef ) as CFStringRef + long r,f + s = fn StringByTrimmingCharactersInSet( s, fn CFCharacterSetGetPredefined(_kCFCharacterSetWhitespace )) + for r = 1 to len(s)-2 + f = instr(0, @"_- ", mid(s, r, 1)) + if f <> NSNotFound + s = fn stringwithformat(@"%@%@%@", left( s, r ), ucase(mid(s,r+1,1)), mid(s,r+2)) + end if + next +end fn = s + +local fn CamelTo_snake( s as CFStringRef ) as CFStringRef + long r,f + s = fn StringByTrimmingCharactersInSet( s, fn CFCharacterSetGetPredefined(_kCFCharacterSetWhitespace )) + s = fn StringByReplacingOccurrencesOfString( s, @" ", @"_") + s = fn StringByReplacingOccurrencesOfString( s, @"-", @"_") + for r = 1 to len(s)-2 + f = instr(0, @"ABCDEFGHIJKLMNOPQRSTUVWXYZ", mid(s, r, 1)) + if f <> NSNotFound + if fn StringIsEqual(@"_", mid(s, r-1, 1)) then continue + s = fn stringwithformat(@"%@%@%@", left( s, r ), @"_", mid(s,r)) + end if + next + s = fn stringwithformat(@"%@%@",left( s, 1), lcase(mid(s, 1))) +end fn = s + +local fn show( s1 as CFStringRef ) + CFStringRef s = @" " + CFStringRef s2 = fn snake_toCamel( s1 ) + CFStringRef s3 = fn CamelTo_snake( s1 ) + nslog(@" \"%@\"%@\"%@\"%@\"%@\"", s1, mid(s, len(s1)), s2, mid(s, len(s2)), s3) +end fn + +nslog( @"%@",@"String ¬ +fn snake_toCamel ¬ +fn CamelTo_snake") +fn show(@"snakeCase") +fn show(@"snake_case") +fn show(@"variable_10_case") +fn show(@"variable10Case") +fn show(@"ɛrgo rE tHis") +fn show(@"hurry-up-joe!") +fn show(@"c://my-docs/happy_Flag-Day/12.doc") +fn show(@" spaces ") + +handleevents diff --git a/Task/Camel-case-and-snake-case/FutureBasic/camel-case-and-snake-case-2.basic b/Task/Camel-case-and-snake-case/FutureBasic/camel-case-and-snake-case-2.basic new file mode 100644 index 0000000000..bce565d1b6 --- /dev/null +++ b/Task/Camel-case-and-snake-case/FutureBasic/camel-case-and-snake-case-2.basic @@ -0,0 +1,9 @@ +String fn snake_toCamel fn CamelTo_snake + "snakeCase" "snakeCase" "snake_case" + "snake_case" "snakeCase" "snake_case" + "variable_10_case" "variable10Case" "variable_10_case" + "variable10Case" "variable10Case" "variable10_case" + "ɛrgo rE tHis" "ɛrgoRETHis" "ɛrgo_r_e_t_his" + "hurry-up-joe!" "hurryUpJoe!" "hurry_up_joe!" + " spaces " "spaces" "spaces" + "c://my-docs/happy_Flag-Day/12.doc" "c://myDocs/happyFlagDay/12.doc" "c://my_docs/happy_flag_day/12.doc" diff --git a/Task/Camel-case-and-snake-case/Go/camel-case-and-snake-case.go b/Task/Camel-case-and-snake-case/Go/camel-case-and-snake-case.go new file mode 100644 index 0000000000..143ef584c5 --- /dev/null +++ b/Task/Camel-case-and-snake-case/Go/camel-case-and-snake-case.go @@ -0,0 +1,104 @@ +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func snakeCaseToCamelCase(word string, sep rune) string { + var sb strings.Builder + + wordRunes := []rune(strings.TrimSpace(word)) + wordLen := len(wordRunes) + + for i := 0; i < wordLen; i++ { + c := wordRunes[i] + + if c == sep { + if i+1 < wordLen && wordRunes[i+1] != sep { + sb.WriteRune(unicode.ToUpper(wordRunes[i+1])) + i++ + } + } else { + if i == 0 { + c = unicode.ToLower(c) + } + sb.WriteRune(c) + } + } + + return sb.String() +} + +func camelCaseToSnakeCase(word string, sep rune) string { + word = strings.TrimSpace(word) + var sb strings.Builder + var lastRune rune + + for i, c := range word { + if i != 0 && unicode.IsUpper(c) { + if lastRune != sep { + sb.WriteRune(sep) + } + } + sb.WriteRune(unicode.ToLower(c)) + lastRune = c + } + + return sb.String() +} + +func main() { + words := []string{ + "snakeCase", + "snake_case", + "variable_10_case", + "variable10Case", + "ɛrgo rE tHis", + "hurry-up-joe!", + "c://my-docs/happy_Flag-Day/12.doc", + " spaces ", + } + + fmt.Print("snake_case to camelCase:\n\n") + + for _, word := range words { + fmt.Println(word, "=>", snakeCaseToCamelCase(word, '_')) + } + + fmt.Println() + fmt.Print("kebab-case to camelCase:\n\n") + + for _, word := range words { + fmt.Println(word, "=>", snakeCaseToCamelCase(word, '-')) + } + + fmt.Println() + fmt.Print("space case to camelCase:\n\n") + + for _, word := range words { + fmt.Println(word, "=>", snakeCaseToCamelCase(word, ' ')) + } + + fmt.Println() + fmt.Print("camelCase to snake_case:\n\n") + + for _, word := range words { + fmt.Println(word, "=>", camelCaseToSnakeCase(word, '_')) + } + + fmt.Println() + fmt.Print("camelCase to kebab-case:\n\n") + + for _, word := range words { + fmt.Println(word, "=>", camelCaseToSnakeCase(word, '-')) + } + + fmt.Println() + fmt.Print("camelCase to space case:\n\n") + + for _, word := range words { + fmt.Println(word, "=>", camelCaseToSnakeCase(word, ' ')) + } +} diff --git a/Task/Camel-case-and-snake-case/JavaScript/camel-case-and-snake-case.js b/Task/Camel-case-and-snake-case/JavaScript/camel-case-and-snake-case.js new file mode 100644 index 0000000000..73b10c2641 --- /dev/null +++ b/Task/Camel-case-and-snake-case/JavaScript/camel-case-and-snake-case.js @@ -0,0 +1,82 @@ +const HYPHEN = '-'; +const SPACE = ' '; +const UNDERSCORE = '_'; +const WHITESPACE = " \n\r\t\f\v"; + +function leftTrim(text) { + const start = text.search(/\S/); // Find the index of the first non-whitespace character + return start === -1 ? "" : text.substring(start); +} + +function rightTrim(text) { + const end = text.search(/\S(?![\s\S]*\S)/); // Find the index of the last non-whitespace character + return end === -1 ? "" : text.substring(0, end + 1); +} + +function trim(text) { + return leftTrim(rightTrim(text)); +} + +function prepareForConversion(text) { + text = trim(text); + text = text.replace(new RegExp(SPACE, 'g'), UNDERSCORE); + text = text.replace(new RegExp(HYPHEN, 'g'), UNDERSCORE); + return text; // Return the modified text +} + +function toSnakeCase(camel) { + camel = prepareForConversion(camel); + let snake = ""; + let first = true; + for (const ch of camel) { + if (first) { + snake += ch; + first = false; + } else if (!first && ch >= 'A' && ch <= 'Z') { + if (snake.slice(-1) === UNDERSCORE) { + snake += ch.toLowerCase(); + } else { + snake += UNDERSCORE; + snake += ch.toLowerCase(); + } + } else { + snake += ch; + } + } + return snake; +} + +function toCamelCase(snake) { + snake = prepareForConversion(snake); + let camel = ""; + let underscore = false; + for (const ch of snake) { + if (ch === UNDERSCORE) { + underscore = true; + } else if (underscore) { + camel += ch.toUpperCase(); + underscore = false; + } else { + camel += ch; + } + } + return camel; +} + +function main() { + const variableNames = ["snakeCase", "snake_case", "variable_10_case", + "variable10Case", "ergo rE tHis", "hurry-up-joe!", "c://my-docs/happy_Flag-Day/12.doc", " spaces "]; + + console.log("".padEnd(48, " ") + "=== To snake_case ==="); + for (const text of variableNames) { + console.log("".padEnd(34, " ") + text + " --> " + toSnakeCase(text)); + } + + console.log("\n"); + console.log("".padEnd(48, " ") + "=== To camelCase ==="); + for (const text of variableNames) { + console.log("".padEnd(34, " ") + text + " --> " + toCamelCase(text)); + } +} + +main(); diff --git a/Task/Camel-case-and-snake-case/Julia/camel-case-and-snake-case.julia b/Task/Camel-case-and-snake-case/Julia/camel-case-and-snake-case.jl similarity index 100% rename from Task/Camel-case-and-snake-case/Julia/camel-case-and-snake-case.julia rename to Task/Camel-case-and-snake-case/Julia/camel-case-and-snake-case.jl diff --git a/Task/Camel-case-and-snake-case/Kotlin/camel-case-and-snake-case.kts b/Task/Camel-case-and-snake-case/Kotlin/camel-case-and-snake-case.kts new file mode 100644 index 0000000000..8159af38c2 --- /dev/null +++ b/Task/Camel-case-and-snake-case/Kotlin/camel-case-and-snake-case.kts @@ -0,0 +1,41 @@ +fun main() { + val variableNames = listOf("snakeCase", "snake_case", "variable_10_case", "variable10Case", + "ergo rE tHis", "hurry-up-joe!", "c://my-docs/happy_Flag-Day/12.doc", " spaces ") + + println(" ".repeat(26) + "=== To snake_case ===") + variableNames.forEach { text -> + println("${text.padStart(34)} --> ${toSnakeCase(text)}") + } + + println("\n" + " ".repeat(26) + "=== To camelCase ===") + variableNames.forEach { text -> + println("${text.padStart(34)} --> ${toCamelCase(text)}") + } +} + +fun toSnakeCase(camel: String): String { + val snake = StringBuilder() + camel.trim().replace(" ", "_").replace("-", "_").forEach { ch -> + if (snake.isEmpty() || snake.last() != '_' || ch != '_') { + if (ch.isUpperCase() && snake.isNotEmpty() && snake.last() != '_') snake.append('_') + snake.append(ch.toLowerCase()) + } + } + return snake.toString() +} + +fun toCamelCase(snake: String): String { + val camel = StringBuilder() + var underscore = false + snake.trim().replace(" ", "_").replace("-", "_").forEach { ch -> + if (ch == '_') { + underscore = true + } else if (underscore) { + camel.append(ch.toUpperCase()) + underscore = false + } else { + camel.append(ch) + } + } + return camel.toString() +} diff --git a/Task/Camel-case-and-snake-case/Mathematica/camel-case-and-snake-case.math b/Task/Camel-case-and-snake-case/Mathematica/camel-case-and-snake-case.math new file mode 100644 index 0000000000..ecae1a970d --- /dev/null +++ b/Task/Camel-case-and-snake-case/Mathematica/camel-case-and-snake-case.math @@ -0,0 +1,85 @@ +(* String case conversion functions in Mathematica *) + +snakeToCamelCase[nam_String, sep_String : "[_]+", lcmiddle_ : False] := Module[{words}, + If[nam == "", Return[nam]]; + words = StringSplit[StringTrim[nam], RegularExpression[sep]]; + If[lcmiddle, words = ToLowerCase /@ words]; + words[[2 ;;]] = StringJoin[ToUpperCase[StringTake[#, 1]], StringDrop[#, 1]] & /@ Select[words[[2 ;;]], StringLength[#] > 0 &]; + StringJoin[words] +] + +spaceToCamelCase[nam_String] := snakeToCamelCase[nam, "\\s+"] + +kebabToCamelCase[nam_String] := snakeToCamelCase[nam, "[\\-]+"] + +periodToCamelCase[nam_String] := snakeToCamelCase[nam, "[\\.]+"] + +allsepToCamelCase[nam_String] := snakeToCamelCase[nam, "[ \\-_\\.]+"] + +lowermiddleAllsepToCamelCase[nam_String] := snakeToCamelCase[nam, "[ \\-_\\.]+", True] + +camelToSnakeCase[nam_String, sep_String : "_", allsep_String : "[_]+", lcmiddle_ : True] := Module[{result, sep1, words}, + result = StringReplace[StringTrim[nam], RegularExpression["([A-Z]+)"] -> sep <> "$1"]; + sep1 = If[sep == ".", "\\.", sep]; + If[lcmiddle, + words = Select[StringSplit[result, sep1], StringLength[#] > 0 &]; + result = StringRiffle[ToLowerCase /@ words, sep], + words = Select[StringSplit[result, sep1], StringLength[#] > 0 &]; + result = StringRiffle[StringJoin[ToLowerCase[StringTake[#, 1]], StringDrop[#, 1]] & /@ words, sep] + ]; + StringReplace[result, RegularExpression[allsep] -> sep] +] + +preserveMidcapsCamelToSnakeCase[nam_String] := camelToSnakeCase[nam, "_", "[_]+", False] + +allsepToSnakeCase[nam_String] := camelToSnakeCase[nam, "_", "[ \\-\\._]+"] + +allsepToKebabCase[nam_String] := camelToSnakeCase[nam, "-", "[ \\-\\._]+"] + +allsepToSpaceCase[nam_String] := camelToSnakeCase[nam, " ", "[ \\-\\._]+"] + +allsepToPeriodCase[nam_String] := camelToSnakeCase[nam, ".", "[ \\-\\._]+"] + +allsepToSlashCase[nam_String] := camelToSnakeCase[nam, "/", "[ \\-\\._]+"] + +(* Test the functions *) +testFunctions = { + snakeToCamelCase, + spaceToCamelCase, + kebabToCamelCase, + periodToCamelCase, + allsepToCamelCase, + lowermiddleAllsepToCamelCase, + camelToSnakeCase, + preserveMidcapsCamelToSnakeCase, + allsepToSnakeCase, + allsepToKebabCase, + allsepToSpaceCase, + allsepToPeriodCase, + allsepToSlashCase +}; + +testStrings = { + "snakeCase", + "snake_case", + "snake-case", + "snake case", + "snake CASE", + "snake.case", + "variable_10_case", + "variable10Case", + "ɛrgo rE tHis", + "hurry-up-joe!", + "c://my-docs/happy_Flag-Day/12.doc", + " spaces " +}; + +Do[ + Print["Testing function ", f, ":"]; + Do[ + Print[StringPadLeft[testString, 36], " => ", f[testString]], + {testString, testStrings} + ]; + Print[""], + {f, testFunctions} +] diff --git a/Task/Camel-case-and-snake-case/OmniMark/camel-case-and-snake-case.xom b/Task/Camel-case-and-snake-case/OmniMark/camel-case-and-snake-case.xom new file mode 100644 index 0000000000..69c54a13fc --- /dev/null +++ b/Task/Camel-case-and-snake-case/OmniMark/camel-case-and-snake-case.xom @@ -0,0 +1,58 @@ +define stream function to_snake_case (value stream txt) as + local stream ls + open ls as buffer + repeat scan txt + match white-space* value-end + ; "trailing whitespace may be ignored" + match value-start white-space* + ; "leading ... whitespace may be ignored" + match (lc | digit) => char1 uc => char2 + put ls '%x(char1)_%lx(char2)' + match ('_' | space | "-" | '.') + ; normalise to underscore and lowercase letter + put ls '_' + match any => char + ; all other characters are lowercase + put ls '%lx(char)' + again + close ls + return ls + +define stream function toCamelCase (value stream txt) as + local stream ls + open ls as buffer + repeat scan txt + match white-space* value-end + ; "trailing whitespace may be ignored" + match value-start white-space* letter+ => word1 + ; "leading ... whitespace may be ignored" + put ls word1 + match ('_' | space | "-" | '.') any => makeUpper + ; consume dividing underscore, space, hyphen or full stop + put ls '%ux(makeUpper)' + match ([digit] letter) => chars + ; a letter preceded by a numeral should be uppercase + put ls '%ux(chars)' + match any => char + ; all other characters are lowercase + put ls '%lx(char)' + again + close ls + return ls + +process + local stream ls variable initial {"snakeCase", "snake_case", + "variable_10_case", "variable10Case", + "ɛrgo rE tHis", "hurry-up-joe!", "c://my-docs/happy_Flag-Day/12.doc", + " spaces "} + output 'to_snake_case%n' + output '=============%n' + repeat over ls + output ls || ' => ' || to_snake_case(ls) || '%n' + again + output '%n' + output 'toCamelCase%n' + output '===========%n' + repeat over ls + output ls || ' => ' || toCamelCase(ls) || '%n' + again diff --git a/Task/Camel-case-and-snake-case/Phix/camel-case-and-snake-case.phix b/Task/Camel-case-and-snake-case/Phix/camel-case-and-snake-case.phix index c9a701e73d..ff87c84e3a 100644 --- a/Task/Camel-case-and-snake-case/Phix/camel-case-and-snake-case.phix +++ b/Task/Camel-case-and-snake-case/Phix/camel-case-and-snake-case.phix @@ -1,33 +1,31 @@ -(phixonline)--> - with javascript_semantics - function to_snake_case(string s) - string snake = substitute(trim(s)," ","_") - for i=length(snake) to 1 by -1 do - if isupper(snake[i]) then - snake[i..i] = '_'&lower(snake[i]) - end if - end for - return snake - end function +with javascript_semantics +function to_snake_case(string s) + string snake = substitute(trim(s)," ","_") + for i=length(snake) to 1 by -1 do + if isupper(snake[i]) then + snake[i..i] = '_'&lower(snake[i]) + end if + end for + return snake +end function - function toCamelCase(string s) - string camel = substitute_all(trim(s),"- ","__") - for i=length(camel)-1 to 1 by -1 do - if camel[i]='_' then - camel[i..i+1] = upper(camel[i+1..i+1]) - end if - end for - return camel - end function +function toCamelCase(string s) + string camel = substitute_all(trim(s),"- ","__") + for i=length(camel)-1 to 1 by -1 do + if camel[i]='_' then + camel[i..i+1] = upper(camel[i+1..i+1]) + end if + end for + return camel +end function - constant tests = {"snakeCase", "snake_case", "variable_10_case", "variable10Case", "ergo rE tHis", - "hurry-up-joe!", "c://my-docs/happy_Flag-Day/12.doc", " spaces "} - procedure test(string title, integer fn) - printf(1,title) - for i=1 to length(tests) do - printf(1,"%33s ===> %s\n", {tests[i], fn(tests[i])}) - end for - end procedure - test(" === to_snake_case ===\n",to_snake_case) - test("\n === toCamelCase ===\n",toCamelCase) - {}", text, to_snake_case(text)); + } + + println!(); + println!("{:>48}", "=== To camelCase ==="); + for text in &variable_names { + println!("{:>34} --> {}", text, to_camel_case(text)); + } +} diff --git a/Task/Camel-case-and-snake-case/Scala/camel-case-and-snake-case.scala b/Task/Camel-case-and-snake-case/Scala/camel-case-and-snake-case.scala new file mode 100644 index 0000000000..209ba2986b --- /dev/null +++ b/Task/Camel-case-and-snake-case/Scala/camel-case-and-snake-case.scala @@ -0,0 +1,39 @@ +object CamelCaseAndSnakeCase extends App { + + val variableNames = List("snakeCase", "snake_case", "variable_10_case", "variable10Case", + "ergo rE tHis", "hurry-up-joe!", "c://my-docs/happy_Flag-Day/12.doc", " spaces ") + + println(" " * 26 + "=== To snake_case ===") + variableNames.foreach { text => + println(f"$text%34s --> ${toSnakeCase(text)}") + } + + println("\n" + " " * 26 + "=== To camelCase ===") + variableNames.foreach { text => + println(f"$text%34s --> ${toCamelCase(text)}") + } + + def toSnakeCase(camel: String): String = { + val snake = new StringBuilder + camel.trim.replace(" ", "_").replace("-", "_").foreach { ch => + if (snake.isEmpty || snake.last != '_' || ch != '_') { + if (ch.isUpper && snake.nonEmpty && snake.last != '_') snake.append('_') + snake.append(ch.toLower) + } + } + snake.toString + } + + def toCamelCase(snake: String): String = { + val camel = new StringBuilder + var underscore = false + snake.trim.replace(" ", "_").replace("-", "_").foreach { ch => + if (ch == '_') underscore = true + else if (underscore) { + camel.append(ch.toUpper) + underscore = false + } else camel.append(ch) + } + camel.toString + } +} diff --git a/Task/Camel-case-and-snake-case/Wren/camel-case-and-snake-case.wren b/Task/Camel-case-and-snake-case/Wren/camel-case-and-snake-case.wren index e7bdf59398..66d04c3e49 100644 --- a/Task/Camel-case-and-snake-case/Wren/camel-case-and-snake-case.wren +++ b/Task/Camel-case-and-snake-case/Wren/camel-case-and-snake-case.wren @@ -1,5 +1,5 @@ import "./str" for Char -import "/fmt" for Fmt +import "./fmt" for Fmt var toCamel = Fn.new { |snake| snake = snake.trim() diff --git a/Task/Camel-case-and-snake-case/Zig/camel-case-and-snake-case.zig b/Task/Camel-case-and-snake-case/Zig/camel-case-and-snake-case.zig new file mode 100644 index 0000000000..faee5b8822 --- /dev/null +++ b/Task/Camel-case-and-snake-case/Zig/camel-case-and-snake-case.zig @@ -0,0 +1,134 @@ +const std = @import("std"); +const print = std.debug.print; +const ArrayList = std.ArrayList; + +const HYPHEN: u8 = '-'; +const SPACE: u8 = ' '; +const UNDERSCORE: u8 = '_'; +const WHITESPACE = " \n\r\t\x0C\x0B"; + +fn isWhitespace(ch: u8) bool { + for (WHITESPACE) |ws| { + if (ch == ws) return true; + } + return false; +} + +fn leftTrim(text: []const u8) []const u8 { + var start: usize = 0; + while (start < text.len and isWhitespace(text[start])) { + start += 1; + } + return text[start..]; +} + +fn rightTrim(text: []const u8) []const u8 { + var end: usize = text.len; + while (end > 0 and isWhitespace(text[end - 1])) { + end -= 1; + } + return text[0..end]; +} + +fn trim(text: []const u8) []const u8 { + return rightTrim(leftTrim(text)); +} + +fn prepareForConversion(allocator: std.mem.Allocator, text: []const u8) ![]u8 { + const trimmed = trim(text); + var result = try ArrayList(u8).initCapacity(allocator, trimmed.len); + defer result.deinit(); + + for (trimmed) |ch| { + if (ch == SPACE or ch == HYPHEN) { + try result.append(UNDERSCORE); + } else { + try result.append(ch); + } + } + + return result.toOwnedSlice(); +} + +fn toSnakeCase(allocator: std.mem.Allocator, camel: []const u8) ![]u8 { + const text = try prepareForConversion(allocator, camel); + defer allocator.free(text); + + var snake = ArrayList(u8).init(allocator); + defer snake.deinit(); + + var first = true; + + for (text) |ch| { + if (first) { + try snake.append(ch); + first = false; + } else if (std.ascii.isUpper(ch)) { + if (snake.items.len > 0 and snake.items[snake.items.len - 1] == UNDERSCORE) { + try snake.append(std.ascii.toLower(ch)); + } else { + try snake.append(UNDERSCORE); + try snake.append(std.ascii.toLower(ch)); + } + } else { + try snake.append(ch); + } + } + + return snake.toOwnedSlice(); +} + +fn toCamelCase(allocator: std.mem.Allocator, snake: []const u8) ![]u8 { + const text = try prepareForConversion(allocator, snake); + defer allocator.free(text); + + var camel = ArrayList(u8).init(allocator); + defer camel.deinit(); + + var underscore = false; + + for (text) |ch| { + if (ch == UNDERSCORE) { + underscore = true; + } else if (underscore) { + try camel.append(std.ascii.toUpper(ch)); + underscore = false; + } else { + try camel.append(ch); + } + } + + return camel.toOwnedSlice(); +} + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer _ = gpa.deinit(); + const allocator = gpa.allocator(); + + const variable_names = [_][]const u8{ + "snakeCase", + "snake_case", + "variable_10_case", + "variable10Case", + "ergo rE tHis", + "hurry-up-joe!", + "c://my-docs/happy_Flag-Day/12.doc", + " spaces " + }; + + print("{s:>48}\n", .{"=== To snake_case ==="}); + for (variable_names) |text| { + const snake = try toSnakeCase(allocator, text); + defer allocator.free(snake); + print("{s:>34} --> {s}\n", .{ text, snake }); + } + + print("\n", .{}); + print("{s:>48}\n", .{"=== To camelCase ==="}); + for (variable_names) |text| { + const camel = try toCamelCase(allocator, text); + defer allocator.free(camel); + print("{s:>34} --> {s}\n", .{ text, camel }); + } +} diff --git a/Task/Canny-edge-detector/FreeBASIC/canny-edge-detector.basic b/Task/Canny-edge-detector/FreeBASIC/canny-edge-detector.basic new file mode 100644 index 0000000000..947ea3deca --- /dev/null +++ b/Task/Canny-edge-detector/FreeBASIC/canny-edge-detector.basic @@ -0,0 +1,116 @@ +#define MIN(a, b) iif((a) < (b), (a), (b)) +#define MAX(a, b) iif((a) > (b), (a), (b)) + +Const MaxBrightness = 255 + +' Función para leer un archivo PPM +Function readPPM(nombre As String, Byref ancho As Integer, Byref alto As Integer, image() As Ubyte) As Boolean + Dim As Integer ff + Dim As String t, dcol + + If nombre = "" Then + Print "No PPM file name indicated." + Return False + End If + + ff = Freefile + Open nombre For Binary As #ff + If Err Then + Print "File "; nombre; " not found." + Return False + End If + + Line Input #ff, t + If t <> "P6" Then + Print "File is NOT PPM P6 type." + Close #ff + Return False + End If + + Do + Line Input #ff, t + Loop While Left(t, 1) = "#" + + Dim As Integer posic = 1 + While Mid(t, posic, 1) = " " + posic += 1 + Wend + ancho = Val(Mid(t, posic)) + + While Mid(t, posic, 1) <> " " + posic += 1 + Wend + While Mid(t, posic, 1) = " " + posic += 1 + Wend + alto = Val(Mid(t, posic)) + + Line Input #ff, dcol + + Redim image(0 To ancho * alto * 3 - 1) + Get #ff, , image() + + Close #ff + Return True +End Function + +Dim As Integer ancho, alto +Dim image() As Ubyte + +If readPPM("i:\Lena.ppm", ancho, alto, image()) Then + Dim As Integer newAncho = ancho, newAlto = alto + Dim pixelsGray(newAncho - 1, newAlto - 1) As Integer + Dim C_E_D(2, 2) As Integer + + ' Define edge detection filter + Dim As Integer dato(8) => {-1, -1, -1, -1, 8, -1, -1, -1, -1} + Dim As Integer i, j + For i = 0 To 2 + For j = 0 To 2 + C_E_D(i, j) = dato(i * 3 + j) + Next j + Next i + + ' Convert image to grayscale + Dim As Integer x, y, r, g, b, lumin, k + For y = 0 To newAlto - 1 + For x = 0 To newAncho - 1 + r = image((y * newAncho + x) * 3) + g = image((y * newAncho + x) * 3 + 1) + b = image((y * newAncho + x) * 3 + 2) + lumin = Int(0.2126 * r + 0.7152 * g + 0.0722 * b) + pixelsGray(x, y) = lumin + Next x + Next y + + Dim new_image(newAncho - 1, newAlto - 1) As Integer + Dim As Integer divisor = 1 + + ' Apply edge detection filter + Dim As Integer newRGB + For y = 1 To newAlto - 2 + For x = 1 To newAncho - 2 + newRGB = 0 + For i = -1 To 1 + For j = -1 To 1 + newRGB += C_E_D(i + 1, j + 1) * pixelsGray(x + i, y + j) + Next j + Next i + new_image(x, y) = Max(Min(newRGB / divisor, 255), 0) + Next x + Next y + + ' Show the result + Screenres newAncho, newAlto, 32 + Windowtitle ("Canny edge detector") + For y = 0 To newAlto - 1 + For x = 0 To newAncho - 1 + k = new_image(x, y) + Pset (x, y), Rgb(k, k, k) + Next x + Next y +Else + Print "Error loading PPM file." +End If + +Sleep diff --git a/Task/Canny-edge-detector/Julia/canny-edge-detector.julia b/Task/Canny-edge-detector/Julia/canny-edge-detector.jl similarity index 100% rename from Task/Canny-edge-detector/Julia/canny-edge-detector.julia rename to Task/Canny-edge-detector/Julia/canny-edge-detector.jl diff --git a/Task/Canny-edge-detector/Wren/canny-edge-detector.wren b/Task/Canny-edge-detector/Wren/canny-edge-detector.wren index afd47fef7f..788766699d 100644 --- a/Task/Canny-edge-detector/Wren/canny-edge-detector.wren +++ b/Task/Canny-edge-detector/Wren/canny-edge-detector.wren @@ -8,7 +8,7 @@ var MaxBrightness = 255 class Canny { construct new(inFile, outFile) { Window.title = "Canny edge detection" - var image1 = ImageData.loadFromFile(inFile) + var image1 = ImageData.load(inFile) var w = image1.width var h = image1.height Window.resize(w * 2 + 20, h) diff --git a/Task/Canonicalize-CIDR/11l/canonicalize-cidr.11l b/Task/Canonicalize-CIDR/11l/canonicalize-cidr.11l index dcb2faf15e..b6ddd2a1f7 100644 --- a/Task/Canonicalize-CIDR/11l/canonicalize-cidr.11l +++ b/Task/Canonicalize-CIDR/11l/canonicalize-cidr.11l @@ -8,7 +8,7 @@ F cidr_parse(str) | c < 0 | c > 255 | d < 0 | d > 255 R (0, 0) - V mask = (-)((1 << (32 - m)) - 1) + V mask = ~((1 << (32 - m)) - 1) V address = (a << 24) + (b << 16) + (c << 8) + d address [&]= mask R (address, m) diff --git a/Task/Canonicalize-CIDR/ALGOL-68/canonicalize-cidr.alg b/Task/Canonicalize-CIDR/ALGOL-68/canonicalize-cidr.alg index 7befa0b1eb..6a3f49135f 100644 --- a/Task/Canonicalize-CIDR/ALGOL-68/canonicalize-cidr.alg +++ b/Task/Canonicalize-CIDR/ALGOL-68/canonicalize-cidr.alg @@ -1,22 +1,22 @@ BEGIN # show IPv4 addresses in CIDR notation in canonical form # # mode to hold an IPv4 address in CIDR notation # - MODE CIDR = STRUCT( BITS address - , INT network bits - , BOOL valid - , STRING error + MODE CIDR = STRUCT( LONG BITS address + , INT network bits + , BOOL valid + , STRING error ); # returns a CIDR parsed from address # OP TOCIDR = ( STRING address text )CIDR: BEGIN - STRING addr = "." + address text + "$"; - STRING error := ""; - BITS address := 16r0; - INT bits count := 0; - INT dot count := 0; - INT slash count := 0; - BOOL valid := TRUE; - INT s pos := LWB addr; - INT s max = UPB addr; + STRING addr = "." + address text + "$"; + STRING error := ""; + LONG BITS address := 16r0; + INT bits count := 0; + INT dot count := 0; + INT slash count := 0; + BOOL valid := TRUE; + INT s pos := LWB addr; + INT s max = UPB addr; WHILE s pos < s max AND valid DO IF addr[ s pos ] = "." THEN # must have an octet next # @@ -70,7 +70,7 @@ BEGIN # show IPv4 addresses in CIDR notation in canonical form # address ELSE # valid address - retain the top most bits # - CIDR( address OF address AND ( 16rffffffff + CIDR( address OF address AND ( LONG 16rffffffff SHL ( 32 - network bits OF address ) ) , network bits OF address @@ -82,9 +82,9 @@ BEGIN # show IPv4 addresses in CIDR notation in canonical form # OP TOSTRING = ( CIDR address )STRING: BEGIN [ 1 : 4 ]INT octet; - BITS addr := address OF address; + LONG BITS addr := address OF address; FOR o pos FROM UPB octet BY -1 TO LWB octet DO - octet[ o pos ] := ABS ( addr AND 16rff ); + octet[ o pos ] := SHORTEN ABS ( addr AND 16rff ); addr := addr SHR 8 OD; STRING result := whole( octet[ LWB octet ], 0 ); diff --git a/Task/Canonicalize-CIDR/Ada/canonicalize-cidr.adb b/Task/Canonicalize-CIDR/Ada/canonicalize-cidr.adb new file mode 100644 index 0000000000..a138a754ae --- /dev/null +++ b/Task/Canonicalize-CIDR/Ada/canonicalize-cidr.adb @@ -0,0 +1,105 @@ +with Ada.Strings; +with Ada.Strings.Fixed; +with Ada.Strings.Maps; +with Ada.Text_IO; + +use Ada.Strings; +use Ada.Strings.Fixed; +use Ada.Strings.Maps; +use Ada.Text_IO; + +procedure Canonicalize_CIDR is + type IP_Octet_Type is mod 256; + + type IP_Record_Type is record + A, B, C, D : IP_Octet_Type; + end record + with Size => 32; + + for IP_Record_Type use record + -- Use little-endian ordering to match bit array + D at 0 range 0 .. 7; + C at 1 range 0 .. 7; + B at 2 range 0 .. 7; + A at 3 range 0 .. 7; + end record; + + type IP_Bitarray_Type is array (0 .. 31) of Boolean + with Component_Size => 1; + + subtype IP_Mask_Type is Natural range 0 .. 32; + + type IP_CIDR_Type is record + IP : IP_Record_Type; + Mask : IP_Mask_Type; + end record; + + function Parse_IP_CIDR (S : String) return IP_CIDR_Type is + IP_Record : IP_CIDR_Type; + Digit_Range : Character_Range := ('0', '9'); + Digit_Set : Character_Set := To_Set (Digit_Range); + Octets : array (1 .. 4) of IP_Octet_Type; + First : Positive; + Last : Natural := 0; + begin + for I in Octets'Range loop + Find_Token (S, Digit_Set, Last + 1, Inside, First, Last); + Octets (I) := IP_Octet_Type'Value (S (First .. Last)); + end loop; + IP_Record.IP.A := Octets (1); + IP_Record.IP.B := Octets (2); + IP_Record.IP.C := Octets (3); + IP_Record.IP.D := Octets (4); + + Find_Token (S, Digit_Set, Last + 1, Inside, First, Last); + IP_Record.Mask := IP_Mask_Type'Value (S (First .. Last)); + + return IP_Record; + end Parse_IP_CIDR; + + procedure Canonicalize_IP_CIDR (Addr : in out IP_CIDR_Type) is + -- Fun part. I can overlay different types over the same bits. + Bit_Overlay : IP_Bitarray_Type with Address => Addr.IP'Address; + begin + for I in Bit_Overlay'First .. Bit_Overlay'Last - Addr.Mask loop + Bit_Overlay (I) := False; + end loop; + end Canonicalize_IP_CIDR; + + procedure Put_IP_CIDR (Addr : IP_CIDR_TYPE) is + package Octet_IO is new Ada.Text_IO.Modular_IO (IP_Octet_Type); + package Mask_IO is new Ada.Text_IO.Integer_IO (IP_Mask_Type); + begin + Octet_IO.Put (Addr.IP.A, 0); + Put ("."); + Octet_IO.Put (Addr.IP.B, 0); + Put ("."); + Octet_IO.Put (Addr.IP.C, 0); + Put ("."); + Octet_IO.Put (Addr.IP.D, 0); + Put ("/"); + Mask_IO.Put (Addr.Mask, 0); + end Put_IP_CIDR; + + procedure Show_IP_Canonicalize (S : String) is + Canon : IP_CIDR_Type := Parse_IP_CIDR (S); + begin + Canonicalize_IP_Cidr (Canon); + Put (S & " -> "); + Put_IP_CIDR (Canon); + New_Line; + end Show_IP_Canonicalize; + + Test_IPs : array (1 .. 5) of String (1 .. 18) := + ( + "36.18.154.103/12 ", + "62.62.197.11/29 ", + "67.137.119.181/4 ", + "161.214.74.21/24 ", + "184.232.176.184/18" + ); +begin + for I of Test_IPs loop + Show_IP_Canonicalize (I); + end loop; +end Canonicalize_CIDR; diff --git a/Task/Canonicalize-CIDR/EasyLang/canonicalize-cidr.easy b/Task/Canonicalize-CIDR/EasyLang/canonicalize-cidr.easy new file mode 100644 index 0000000000..7c1c9054e8 --- /dev/null +++ b/Task/Canonicalize-CIDR/EasyLang/canonicalize-cidr.easy @@ -0,0 +1,30 @@ +func$ can_cidr s$ . + n[] = number strtok s$ "./" + if len n[] <> 5 : return "" + for i to 4 + if n[i] < 0 or n[i] > 255 : return "" + ad = ad * 256 + n[i] + . + if n[5] > 31 or n[5] < 1 : return "" + mask = bitnot (bitshift 1 (32 - n[5]) - 1) + ad = bitand ad mask + for i to 4 + if r$ <> "" : r$ = "." & r$ + r$ = ad mod 256 & r$ + ad = ad div 256 + . + return r$ & "/" & n[5] +. +repeat + s$ = input + until s$ = "" + print s$ & " -> " & can_cidr s$ +. +# +input_data +87.70.141.1/22 +36.18.154.103/12 +62.62.197.11/29 +67.137.119.181/4 +161.214.74.21/24 +184.232.176.184/18 diff --git a/Task/Canonicalize-CIDR/FreeBASIC/canonicalize-cidr.basic b/Task/Canonicalize-CIDR/FreeBASIC/canonicalize-cidr.basic index 97b62bc879..bd4af5e919 100644 --- a/Task/Canonicalize-CIDR/FreeBASIC/canonicalize-cidr.basic +++ b/Task/Canonicalize-CIDR/FreeBASIC/canonicalize-cidr.basic @@ -1,54 +1,99 @@ -#lang "qb" +Const MAX_OCTET = 255 +Const MIN_NETWORK = 1 +Const MAX_NETWORK = 32 +Const OCTET_BITS = 8 -REM THE Binary OPS ONLY WORK On SIGNED 16-Bit NUMBERS -REM SO WE STORE THE IP ADDRESS As AN ARRAY OF FOUR OCTETS -Cls -Dim IP(3) -Do - REM Read DEMO Data - 140 Read CI$ - If CI$ = "" Then Exit Do 'Sleep: End - REM FIND / - SL = 0 - For I = Len(CI$) To 1 Step -1 - If Mid$(CI$,I,1) = "/" Then SL = I : I = 1 - Next I - If SL = 0 Then Print "INVALID CIDR STRING: '"; CI$; "'": Goto 140 - NW = Val(Mid$(CI$,SL+1)) - If NW < 1 Or NW > 32 Then Print "INVALID NETWORK WIDTH:"; NW: Goto 140 - REM PARSE OCTETS INTO IP ARRAY - BY = 0 : N = 0 - For I = 1 To SL-1 - C$ = Mid$(CI$,I,1) - If Not (C$ <> ".") Then - IP(N) = BY : N = N + 1 - BY = 0 - If IP(N-1) < 256 Then 310 - Print "INVALID OCTET VALUE:"; IP(N-1): Goto 140 - Else C = Val(C$):If C Or (C$="0") Then BY = BY*10+C +Type IPAddress + octets(3) As Integer +End Type + +Function isDigit(Byval ch As String) As Boolean + Return (Asc(ch) >= Asc("0")) And (Asc(ch) <= Asc("9")) +End Function + +Function ParseIPAddress(cidr As String, Byref networkWidth As Integer) As IPAddress + Dim As IPAddress ip + Dim As Integer slashPos = Instr(cidr, "/") + Dim As String ipPart = Left(cidr, slashPos - 1) + + networkWidth = Val(Mid(cidr, slashPos + 1)) + + Dim As Integer i, currentOctet = 0, octetValue = 0 + For i = 1 To Len(ipPart) + If Mid(ipPart, i, 1) = "." Then + ip.octets(currentOctet) = octetValue + currentOctet += 1 + octetValue = 0 + Elseif IsDigit(Mid(ipPart, i, 1)) Then + octetValue = octetValue * 10 + Val(Mid(ipPart, i, 1)) End If - 310 ' - Next I - IP(N) = BY : N = N + 1 - If IP(N-1) > 255 Then Print "INVALID OCTET VALUE:"; IP(N-1): Goto 140 - REM NUMBER OF COMPLETE OCTETS IN NETWORK PART - NB = Int(NW/8) - REM NUMBER OF NETWORK BITS IN PARTIAL OCTET - XB = NW And 7 - REM ZERO Out HOST BITS IN PARTIAL OCTET - IP(NB) = IP(NB) And (255 - 2^(8-XB) + 1) - REM And SET Any ALL-HOST OCTETS To 0 - If NB < 3 Then For I = NB +1 To 3 : IP(I) = 0 : Next I - REM Print Out THE RESULT - Print Mid$(Str$(IP(0)),2); - For I = 1 To 3 - Print "."; Mid$(Str$(IP( I)),2); - Next I - Print Mid$(CI$,SL) -Loop -Data "87.70.141.1/22", "36.18.154.103/12", "62.62.197.11/29" -Data "67.137.119.181/4", "161.214.74.21/24", "184.232.176.184/18" -REM SOME INVALID INPUTS -Data "127.0.0.1", "123.45.67.89/0", "98.76.54.32/100", "123.456.789.0/12" + Next + ip.octets(currentOctet) = octetValue + + Return ip +End Function + +Function ApplyNetworkMask(ip As IPAddress, networkWidth As Integer) As IPAddress + Dim As IPAddress result = ip + Dim As Integer completeOctets = networkWidth \ OCTET_BITS + Dim As Integer remainingBits = networkWidth And 7 + + ' Apply mask to partial octet + If completeOctets < 4 Then + result.octets(completeOctets) And= (MAX_OCTET - 2^(OCTET_BITS-remainingBits) + 1) + ' Zero remaining octets + For i As Integer = completeOctets + 1 To 3 + result.octets(i) = 0 + Next + End If + + Return result +End Function + +Function ValidateInput(ip As IPAddress, networkWidth As Integer, cidr As String) As Boolean + If Instr(cidr, "/") = 0 Then + Print "INVALID CIDR STRING: '"; cidr; "'" + Return False + End If + + If networkWidth < MIN_NETWORK Or networkWidth > MAX_NETWORK Then + Print "INVALID NETWORK WIDTH:"; networkWidth + Return False + End If + + For i As Integer = 0 To 3 + If ip.octets(i) > MAX_OCTET Then + Print "INVALID OCTET VALUE:"; ip.octets(i) + Return False + End If + Next + + Return True +End Function + +Sub ProcessCIDR(cidr As String) + Dim As Integer networkWidth + Dim As IPAddress ip = ParseIPAddress(cidr, networkWidth) + + If Not ValidateInput(ip, networkWidth, cidr) Then Exit Sub + + ip = ApplyNetworkMask(ip, networkWidth) + + Dim As String result = Str(ip.octets(0)) + For i As Integer = 1 To 3 + result &= "." & Str(ip.octets(i)) + Next + Print result & "/" & networkWidth +End Sub + +' Main program +Dim As String cidr(9) = { _ +"87.70.141.1/22", "36.18.154.103/12", "62.62.197.11/29", _ +"67.137.119.181/4", "161.214.74.21/24", "184.232.176.184/18", _ +"127.0.0.1", "123.45.67.89/0", "98.76.54.32/100", "123.456.789.0/12" } + +For i As Integer = 0 To 9 + ProcessCIDR(cidr(i)) +Next Sleep diff --git a/Task/Canonicalize-CIDR/FutureBasic/canonicalize-cidr.basic b/Task/Canonicalize-CIDR/FutureBasic/canonicalize-cidr.basic new file mode 100644 index 0000000000..8594d42eb7 --- /dev/null +++ b/Task/Canonicalize-CIDR/FutureBasic/canonicalize-cidr.basic @@ -0,0 +1,132 @@ +// +// Canonicalize CIDR +// +// Using FutureBasic 7.0.34 +// August 25, R.W +// +// Given a Classless Inter-Domain Routing (CIDR) +// IPv4 address, returns the canonical form. +// + +Int networkWidth // network width in bits +CFStringRef errorCode // global err and CCIDR +CFStringRef CCIDR // canonical CIDR IPv4 + +// Type for IP address +begin record IPv4_Address + Int octets[3] // xxx.xxx.xxx.xx/xx +end record + +// Validate CIDR string +local fn ValidateCIDR(ip as IPv4_Address, SnetworkWidth as Int, cidr as CFStringRef) as Boolean + Int i + boolean result + result = _True + if instr(0, cidr, @"/") == NSNotFound + errorCode = concat(@"Bad CIDR ",cidr) + result = _False + return result + end if + if SnetworkWidth < 1 || SnetworkWidth > 32 //validate network width + errorCode = concat(@"Bad Net Width",str(networkWidth)) + result = _False + return result + end if + for i = 0 to 3 + if ip.octets[i] > 255 + errorCode = concat(@"Bad Octet ",str(ip.octets[i])) + result = _False + return result + end if + next +end fn = result + +// Check if a character is a digit +local fn IsDigit(ch as CFStringRef) as boolean + Boolean IsDigit + IsDigit = (ucc(ch) > 47) && (ucc(ch) < 58) +end fn = IsDigit + +// Parse CIDR string into IP structure and network width +local fn ParseIPv4_Address(cidr as CFStringRef) as IPv4_Address + IPv4_Address ip + Int i, slashPos, currentOctet, octetValue + CFStringRef ipPart + ipPart = @"" + slashPos = instr(0, cidr, @"/") + if slashPos > 0 + ipPart = left(cidr, slashPos) + networkWidth = Intval(mid(cidr, slashPos + 1)) + else + ipPart = cidr + networkWidth = -1 + end if + currentOctet = 0: octetValue = 0 + for i = 0 to len(ipPart)-1 + select case mid(ipPart, i, 1) + case @"." + ip.octets[currentOctet] = octetValue + currentOctet ++ + octetValue = 0 + case else + if fn IsDigit(mid(ipPart, i, 1)) + octetValue = octetValue * 10 + Intval(mid(ipPart, i, 1)) + end if + end select + next + ip.octets[currentOctet] = octetValue +end fn = ip + +// Apply network mask to IP +local fn ApplyNetworkMask(ip as IPv4_Address, SnetworkWidth as Int) as IPv4_Address + IPv4_Address result + Int completeOctets, remainingBits, i + result = ip + completeOctets = SnetworkWidth \ 8 //octet bits + remainingBits = SnetworkWidth AND 7 + if completeOctets < 4 + result.octets[completeOctets] = result.octets[completeOctets] AND (255 - 2^(8 - remainingBits) + 1) + for i = completeOctets + 1 to 3 + result.octets[i] = 0 + next + end if +end fn = result + +// Process a CIDR string, sets global CCIDR +local fn ProcessCIDR(cidr as CFStringRef) as CFStringRef + IPv4_Address ip + CFStringRef result + Int i + result = @"" + ip = fn ParseIPv4_Address(cidr) + if fn ValidateCIDR(ip, networkWidth, cidr) // validate + ip = fn ApplyNetworkMask(ip, networkWidth) + result = mid(str(ip.octets[0]),1) + for i = 1 to 3 + result = concat(result,@".",mid(str(ip.octets[i]),1)) + next + result = concat(result,@"/",mid(str(networkWidth),1)) + else + print@ errorCode + end if + CCIDR = result +end fn = result + +// +// Main + +Window 1,@"Canonicalize CIDR" +print@ + +// Test data from the Rosetta Stone task + +CFStringRef cidr(5) = {@"87.70.141.1/22", @"36.18.154.103/12", @"62.62.197.11/29", ¬ +@"67.137.119.181/4", @"161.214.74.21/24", @"184.232.176.184/18"} + +for Int i = 0 to 5 + print@ fn ProcessCIDR(cidr(i)) +next + +HandleEvents + +// diff --git a/Task/Canonicalize-CIDR/Julia/canonicalize-cidr.julia b/Task/Canonicalize-CIDR/Julia/canonicalize-cidr.jl similarity index 100% rename from Task/Canonicalize-CIDR/Julia/canonicalize-cidr.julia rename to Task/Canonicalize-CIDR/Julia/canonicalize-cidr.jl diff --git a/Task/Canonicalize-CIDR/MATLAB/canonicalize-cidr.m b/Task/Canonicalize-CIDR/MATLAB/canonicalize-cidr.m new file mode 100644 index 0000000000..debc175a80 --- /dev/null +++ b/Task/Canonicalize-CIDR/MATLAB/canonicalize-cidr.m @@ -0,0 +1,49 @@ +clear all;close all;clc; +cidrCanonicalizer(); + +function cidrCanonicalizer + % Main function to test CIDR canonicalization + + % Define test cases + testCases = { + '36.18.154.103/12', '36.16.0.0/12'; + '62.62.197.11/29', '62.62.197.8/29'; + '67.137.119.181/4', '64.0.0.0/4'; + '161.214.74.21/24', '161.214.74.0/24'; + '184.232.176.184/18', '184.232.128.0/18' + }; + + % Run test cases + for i = 1:size(testCases, 1) + ip = testCases{i, 1}; + expected = testCases{i, 2}; + result = canonicalize(ip); + fprintf('%s -> %s\n', ip, result); + assert(strcmp(result, expected)); + end +end + +function result = dottedToInt(dotted) + % Convert dotted IP to integer representation + parts = str2double(strsplit(dotted, '.')); + result = sum(parts .* (256 .^ (3:-1:0))); +end + +function result = intToDotted(ip) + % Convert integer IP to dotted representation + result = strjoin(arrayfun(@(x) num2str(bitshift(bitand(ip, bitshift(255, x)), -x)), [24 16 8 0], 'UniformOutput', false), '.'); +end + +function result = networkMask(numberOfBits) + % Create a network mask for the given number of bits + result = bitshift((bitshift(1, numberOfBits) - 1), (32 - numberOfBits)); +end + +function result = canonicalize(ip) + % Canonicalize the given CIDR IP + [dotted, networkBits] = strtok(ip, '/'); + networkBits = str2double(strrep(networkBits, '/', '')); + i = dottedToInt(dotted); + mask = networkMask(networkBits); + result = strcat(intToDotted(bitand(i, mask)), '/', num2str(networkBits)); +end diff --git a/Task/Canonicalize-CIDR/OCaml/canonicalize-cidr.ocaml b/Task/Canonicalize-CIDR/OCaml/canonicalize-cidr.ml similarity index 100% rename from Task/Canonicalize-CIDR/OCaml/canonicalize-cidr.ocaml rename to Task/Canonicalize-CIDR/OCaml/canonicalize-cidr.ml diff --git a/Task/Canonicalize-CIDR/Phix/canonicalize-cidr.phix b/Task/Canonicalize-CIDR/Phix/canonicalize-cidr.phix index 187988d1b3..aca9dd0ac3 100644 --- a/Task/Canonicalize-CIDR/Phix/canonicalize-cidr.phix +++ b/Task/Canonicalize-CIDR/Phix/canonicalize-cidr.phix @@ -1,35 +1,31 @@ -(phixonline)--> - with javascript_semantics -- (not likely useful) - function canonicalize_cidr(string cidr) - cidr = substitute(cidr,"."," ") -- (else %d eats 0.0 etc) - if not find('/',cidr) then cidr &= "/32" end if - sequence res = scanf(cidr,"%d %d %d %d/%d") - if length(res)=1 then - integer {a,b,c,d,m} = res[1] - if a>=0 and a<=255 - and b>=0 and b<=255 - and c>=0 and c<=255 - and d>=0 and d<=255 - and m>=1 and m<=32 then - atom mask = power(2,32-m)-1, - addr = bytes_to_int({d,c,b,a}) - addr -= and_bits(addr,mask) - {d,c,b,a} = int_to_bytes(addr) - return sprintf("%d.%d.%d.%d/%d",{a,b,c,d,m}) - end if - end if - return "???" - end function +with javascript_semantics +function canonicalize_cidr(string cidr) + cidr = substitute(cidr,"."," ") -- (else %d eats 0.0 etc) + if not find('/',cidr) then cidr &= "/32" end if + sequence res = scanf(cidr,"%d %d %d %d/%d") + if length(res)=1 then + integer {a,b,c,d,m} = res[1] + if a>=0 and a<=255 + and b>=0 and b<=255 + and c>=0 and c<=255 + and d>=0 and d<=255 + and m>=1 and m<=32 then + atom mask = power(2,32-m)-1, + addr = bytes_to_int({d,c,b,a}) + addr -= and_bits(addr,mask) + {d,c,b,a} = int_to_bytes(addr) + return sprintf("%d.%d.%d.%d/%d",{a,b,c,d,m}) + end if + end if + return "???" +end function - constant tests = {"87.70.141.1/22", - "36.18.154.103/12", - "62.62.197.11/29", - "67.137.119.181/4", - "161.214.74.21/24", - "184.232.176.184/18"} - - for i=1 to length(tests) do - string ti = tests[i] - printf(1,"%-18s -> %s\n",{ti,canonicalize_cidr(ti)}) - end for - - integer n = 5, - w = power(3,n-1), - len = w - string line = repeat('#',w)&"\n" - - while 1 do - puts(1,line) - if len=1 then exit end if - len /= 3 - integer pos = 1 - while pos<(w-len) do - pos += len - line[pos..pos+len-1] = ' ' - pos += len - end while - end while - - with javascript_semantics - integer count = 0 - for p1=1 to 61 do - if is_prime(p1) then - for h3=1 to p1 do - atom h3p1 = h3 + p1 - for d=1 to h3p1-1 do - if mod(h3p1*(p1-1),d)=0 - and mod(-(p1*p1),h3) = mod(d,h3) then - atom p2 := 1 + floor(((p1-1)*h3p1)/d), - p3 := 1 +floor(p1*p2/h3) - if is_prime(p2) - and is_prime(p3) - and mod(p2*p3,p1-1)=1 then - if count<5 or count>65 then - printf(1,"%d * %d * %d = %d\n",{p1,p2,p3,p1*p2*p3}) - elsif count=35 then puts(1,"...\n") end if - count += 1 - end if - end if - end for - end for - end if - end for - printf(1,"%d Carmichael numbers found\n",count) - [ ) + [ [] temp put + over witheach + [ dip dup join + nested temp gather ] + drop temp take + temp gather ] + drop temp take ] is cart ( [ [ --> [ ) - ' [ 1 2 ] ' [ 3 4 ] cartprod echo cr - ' [ 3 4 ] ' [ 1 2 ] cartprod echo cr - ' [ 1 2 ] ' [ ] cartprod echo cr - ' [ ] ' [ 1 2 ] cartprod echo cr + [ behead swap witheach cart ] is n-cart ( [ --> [ ) + + ' [ 1 2 ] ' [ 3 4 ] cart echo cr cr + ' [ 1 2 ] ' [ ] cart echo cr cr + ' [ ] ' [ 1 2 ] cart echo cr cr + + ' [ [ 1776 1789 ] [ 7 12 ] [ 4 14 23 ] [ 0 1 ] ] n-cart + say "[ " + witheach + [ i^ 0 != if [ say " " ] + echo + i 0 = if [ say " ]" ] cr ] + cr + + ' [ [ 1 2 3 ] [ 30 ] [ 500 100 ] ] n-cart echo cr cr + ' [ [ 1 2 3 ] [ ] [ 500 100 ] ] n-cart echo cr cr diff --git a/Task/Cartesian-product-of-two-or-more-lists/Rust/cartesian-product-of-two-or-more-lists-1.rs b/Task/Cartesian-product-of-two-or-more-lists/Rust/cartesian-product-of-two-or-more-lists-1.rs new file mode 100644 index 0000000000..4bde4f9f43 --- /dev/null +++ b/Task/Cartesian-product-of-two-or-more-lists/Rust/cartesian-product-of-two-or-more-lists-1.rs @@ -0,0 +1,42 @@ +fn cartesian_product<'a, T>(lists: &[&'a [T]]) -> Vec> { + let mut res = vec![vec![]]; + + for &list in lists { + let mut tmp = Vec::new(); + + for r in res { + for item in list { + let mut r = r.clone(); + r.push(item); + tmp.push(r); + } + } + + res = tmp; + } + + res +} + +fn main() { + let cases: [&[&[u32]]; 7] = [ + &[&[1, 2], &[3, 4]], + &[&[3, 4], &[1, 2]], + &[&[1, 2], &[]], + &[&[], &[1, 2]], + &[&[1776, 1789], &[7, 12], &[4, 14, 23], &[0, 1]], + &[&[1, 2, 3], &[30], &[500, 100]], + &[&[1, 2, 3], &[], &[500, 100]], + ]; + + for case in cases { + println!( + "{}\n{:?}\n", + case.iter() + .map(|c| format!("{:?}", c)) + .collect::>() + .join(" × "), + cartesian_product(case) + ) + } +} diff --git a/Task/Cartesian-product-of-two-or-more-lists/Rust/cartesian-product-of-two-or-more-lists-2.rs b/Task/Cartesian-product-of-two-or-more-lists/Rust/cartesian-product-of-two-or-more-lists-2.rs new file mode 100644 index 0000000000..88f569f91f --- /dev/null +++ b/Task/Cartesian-product-of-two-or-more-lists/Rust/cartesian-product-of-two-or-more-lists-2.rs @@ -0,0 +1,2 @@ +[dependencies] +itertools = { version = "0.14.0", features = ["use_alloc"] } diff --git a/Task/Cartesian-product-of-two-or-more-lists/Rust/cartesian-product-of-two-or-more-lists-3.rs b/Task/Cartesian-product-of-two-or-more-lists/Rust/cartesian-product-of-two-or-more-lists-3.rs new file mode 100644 index 0000000000..e8d4eff8e3 --- /dev/null +++ b/Task/Cartesian-product-of-two-or-more-lists/Rust/cartesian-product-of-two-or-more-lists-3.rs @@ -0,0 +1,28 @@ +use itertools::{Itertools, MultiProduct}; + +fn cartesian_product<'a, T>(inputs: &[&'a [T]]) -> MultiProduct> { + inputs + .iter() + .map(|slice| slice.iter()) + .multi_cartesian_product() +} + +fn main() { + let cases: [&[&[u32]]; 7] = [ + &[&[1, 2], &[3, 4]], + &[&[3, 4], &[1, 2]], + &[&[1, 2], &[]], + &[&[], &[1, 2]], + &[&[1776, 1789], &[7, 12], &[4, 14, 23], &[0, 1]], + &[&[1, 2, 3], &[30], &[500, 100]], + &[&[1, 2, 3], &[], &[500, 1000]], + ]; + + for case in cases { + println!( + "{:?}\n[{:?}]\n", + case.iter().format(" × "), + cartesian_product(case).format(", ") + ); + } +} diff --git a/Task/Cartesian-product-of-two-or-more-lists/Rust/cartesian-product-of-two-or-more-lists.rust b/Task/Cartesian-product-of-two-or-more-lists/Rust/cartesian-product-of-two-or-more-lists.rust deleted file mode 100644 index 9345a4ad79..0000000000 --- a/Task/Cartesian-product-of-two-or-more-lists/Rust/cartesian-product-of-two-or-more-lists.rust +++ /dev/null @@ -1,41 +0,0 @@ -fn cartesian_product(lists: &Vec>) -> Vec> { - let mut res = vec![]; - - let mut list_iter = lists.iter(); - if let Some(first_list) = list_iter.next() { - for &i in first_list { - res.push(vec![i]); - } - } - for l in list_iter { - let mut tmp = vec![]; - for r in res { - for &el in l { - let mut tmp_el = r.clone(); - tmp_el.push(el); - tmp.push(tmp_el); - } - } - res = tmp; - } - res -} - -fn main() { - let cases = vec![ - vec![vec![1, 2], vec![3, 4]], - vec![vec![3, 4], vec![1, 2]], - vec![vec![1, 2], vec![]], - vec![vec![], vec![1, 2]], - vec![vec![1776, 1789], vec![7, 12], vec![4, 14, 23], vec![0, 1]], - vec![vec![1, 2, 3], vec![30], vec![500, 100]], - vec![vec![1, 2, 3], vec![], vec![500, 100]], - ]; - for case in cases { - println!( - "{}\n{:?}\n", - case.iter().map(|c| format!("{:?}", c)).collect::>().join(" × "), - cartesian_product(&case) - ) - } -} diff --git a/Task/Cartesian-product-of-two-or-more-lists/Scheme/cartesian-product-of-two-or-more-lists.ss b/Task/Cartesian-product-of-two-or-more-lists/Scheme/cartesian-product-of-two-or-more-lists.scm similarity index 100% rename from Task/Cartesian-product-of-two-or-more-lists/Scheme/cartesian-product-of-two-or-more-lists.ss rename to Task/Cartesian-product-of-two-or-more-lists/Scheme/cartesian-product-of-two-or-more-lists.scm diff --git a/Task/Cartesian-product-of-two-or-more-lists/Uiua/cartesian-product-of-two-or-more-lists.uiua b/Task/Cartesian-product-of-two-or-more-lists/Uiua/cartesian-product-of-two-or-more-lists.uiua new file mode 100644 index 0000000000..2895add665 --- /dev/null +++ b/Task/Cartesian-product-of-two-or-more-lists/Uiua/cartesian-product-of-two-or-more-lists.uiua @@ -0,0 +1,9 @@ +# Cartesian products + +☇1⊞⊂[1 2] [3 4] +☇1⊞⊂[3 4] [1 2] +☇1⊞⊂[3 4] [] +C ← /◇(☇1⊞⊂) +≡⍚C{{[1776 1789] [7 12] [4 14 23] [0 1]} + {[1 2 3] [30] [500 100]} + {[1 2 3] [] [500 100]}} diff --git a/Task/Cartesian-product-of-two-or-more-lists/Wren/cartesian-product-of-two-or-more-lists.wren b/Task/Cartesian-product-of-two-or-more-lists/Wren/cartesian-product-of-two-or-more-lists.wren index 86ff4d5f86..513e4d875a 100644 --- a/Task/Cartesian-product-of-two-or-more-lists/Wren/cartesian-product-of-two-or-more-lists.wren +++ b/Task/Cartesian-product-of-two-or-more-lists/Wren/cartesian-product-of-two-or-more-lists.wren @@ -1,4 +1,4 @@ -import "/seq" for Lst +import "./seq" for Lst var prod2 = Fn.new { |l1, l2| var res = [] diff --git a/Task/Case-sensitivity-of-identifiers/ALGOL-M/case-sensitivity-of-identifiers.alg b/Task/Case-sensitivity-of-identifiers/ALGOL-M/case-sensitivity-of-identifiers.alg new file mode 100644 index 0000000000..5e25c79838 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/ALGOL-M/case-sensitivity-of-identifiers.alg @@ -0,0 +1,13 @@ +begin + +string dog; +comment + An attempt to declare Dog or DOG after declaring + dog will result in a compile-time error ("Doubly + Declared identifier"); +dog := "Benjamin"; +Dog := "Samba"; +DOG := "Bernie"; +write("There is just one dog named ", dog); + +end diff --git a/Task/Case-sensitivity-of-identifiers/Ada/case-sensitivity-of-identifiers.ada b/Task/Case-sensitivity-of-identifiers/Ada/case-sensitivity-of-identifiers.adb similarity index 100% rename from Task/Case-sensitivity-of-identifiers/Ada/case-sensitivity-of-identifiers.ada rename to Task/Case-sensitivity-of-identifiers/Ada/case-sensitivity-of-identifiers.adb diff --git a/Task/Case-sensitivity-of-identifiers/Ballerina/case-sensitivity-of-identifiers.ballerina b/Task/Case-sensitivity-of-identifiers/Ballerina/case-sensitivity-of-identifiers.ballerina new file mode 100644 index 0000000000..6b87eea744 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Ballerina/case-sensitivity-of-identifiers.ballerina @@ -0,0 +1,8 @@ +import ballerina/io; + +public function main() { + string dog = "Benjamin"; + string Dog = "Samba"; + string DOG = "Bernie"; + io:println(`The three dogs are named ${dog}, ${Dog} and ${DOG}.`); +} diff --git a/Task/Case-sensitivity-of-identifiers/COBOL/case-sensitivity-of-identifiers.cobol b/Task/Case-sensitivity-of-identifiers/COBOL/case-sensitivity-of-identifiers.cob similarity index 100% rename from Task/Case-sensitivity-of-identifiers/COBOL/case-sensitivity-of-identifiers.cobol rename to Task/Case-sensitivity-of-identifiers/COBOL/case-sensitivity-of-identifiers.cob diff --git a/Task/Case-sensitivity-of-identifiers/Crystal/case-sensitivity-of-identifiers.crystal b/Task/Case-sensitivity-of-identifiers/Crystal/case-sensitivity-of-identifiers.cr similarity index 100% rename from Task/Case-sensitivity-of-identifiers/Crystal/case-sensitivity-of-identifiers.crystal rename to Task/Case-sensitivity-of-identifiers/Crystal/case-sensitivity-of-identifiers.cr diff --git a/Task/Case-sensitivity-of-identifiers/D/case-sensitivity-of-identifiers.d b/Task/Case-sensitivity-of-identifiers/D/case-sensitivity-of-identifiers.d index c140100011..549512886a 100644 --- a/Task/Case-sensitivity-of-identifiers/D/case-sensitivity-of-identifiers.d +++ b/Task/Case-sensitivity-of-identifiers/D/case-sensitivity-of-identifiers.d @@ -5,6 +5,6 @@ void main() { // identifiers that start with capital letters are type names string Dog = "Samba"; string DOG = "Bernie"; - writefln("There are three dogs named ", - dog, ", ", Dog, ", and ", DOG, "'"); + writeln("There are three dogs named ", + dog, ", ", Dog, ", and ", DOG, "."); } diff --git a/Task/Case-sensitivity-of-identifiers/Delphi/case-sensitivity-of-identifiers.delphi b/Task/Case-sensitivity-of-identifiers/Delphi/case-sensitivity-of-identifiers.pas similarity index 100% rename from Task/Case-sensitivity-of-identifiers/Delphi/case-sensitivity-of-identifiers.delphi rename to Task/Case-sensitivity-of-identifiers/Delphi/case-sensitivity-of-identifiers.pas diff --git a/Task/Case-sensitivity-of-identifiers/DuckDB/case-sensitivity-of-identifiers-1.duckdb b/Task/Case-sensitivity-of-identifiers/DuckDB/case-sensitivity-of-identifiers-1.duckdb new file mode 100644 index 0000000000..0b9cd57834 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/DuckDB/case-sensitivity-of-identifiers-1.duckdb @@ -0,0 +1,3 @@ +create or replace function task(dog, Dog, DOG) as ( + format('The three dogs are named {:s}, {:s} and {:s}.', dog, Dog, DOG) +); diff --git a/Task/Case-sensitivity-of-identifiers/DuckDB/case-sensitivity-of-identifiers-2.duckdb b/Task/Case-sensitivity-of-identifiers/DuckDB/case-sensitivity-of-identifiers-2.duckdb new file mode 100644 index 0000000000..d7c7d9bd1c --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/DuckDB/case-sensitivity-of-identifiers-2.duckdb @@ -0,0 +1,2 @@ +select format('The three dogs are named {:s}, {:s} and {:s}.', dog, Dog, DOG) as example +from (select 'Benjamin' as dog, 'Samba' as Dog, 'Bernie' as DOG); diff --git a/Task/Case-sensitivity-of-identifiers/Elena/case-sensitivity-of-identifiers.elena b/Task/Case-sensitivity-of-identifiers/Elena/case-sensitivity-of-identifiers.elena index b33d071054..2deacb71ce 100644 --- a/Task/Case-sensitivity-of-identifiers/Elena/case-sensitivity-of-identifiers.elena +++ b/Task/Case-sensitivity-of-identifiers/Elena/case-sensitivity-of-identifiers.elena @@ -1,9 +1,9 @@ import extensions; -public program() +public Program() { var dog := "Benjamin"; var Dog := "Samba"; var DOG := "Bernie"; - console.printLineFormatted("The three dogs are named {0}, {1} and {2}", dog, Dog, DOG) + Console.printLineFormatted("The three dogs are named {0}, {1} and {2}", dog, Dog, DOG) } diff --git a/Task/Case-sensitivity-of-identifiers/Elixir/case-sensitivity-of-identifiers.elixir b/Task/Case-sensitivity-of-identifiers/Elixir/case-sensitivity-of-identifiers.ex similarity index 100% rename from Task/Case-sensitivity-of-identifiers/Elixir/case-sensitivity-of-identifiers.elixir rename to Task/Case-sensitivity-of-identifiers/Elixir/case-sensitivity-of-identifiers.ex diff --git a/Task/Case-sensitivity-of-identifiers/Euphoria/case-sensitivity-of-identifiers.euphoria b/Task/Case-sensitivity-of-identifiers/Euphoria/case-sensitivity-of-identifiers.eu similarity index 100% rename from Task/Case-sensitivity-of-identifiers/Euphoria/case-sensitivity-of-identifiers.euphoria rename to Task/Case-sensitivity-of-identifiers/Euphoria/case-sensitivity-of-identifiers.eu diff --git a/Task/Case-sensitivity-of-identifiers/GW-BASIC/case-sensitivity-of-identifiers.basic b/Task/Case-sensitivity-of-identifiers/GW-BASIC/case-sensitivity-of-identifiers.basic deleted file mode 100644 index 33a43f9953..0000000000 --- a/Task/Case-sensitivity-of-identifiers/GW-BASIC/case-sensitivity-of-identifiers.basic +++ /dev/null @@ -1,5 +0,0 @@ -10 dog$ = "Benjamin" -20 dog$ = "Smokey" -30 dog$ = "Samba" -40 dog$ = "Bernie" -50 print "There is just one dog, named ";dog$ diff --git a/Task/Case-sensitivity-of-identifiers/Joy/case-sensitivity-of-identifiers.joy b/Task/Case-sensitivity-of-identifiers/Joy/case-sensitivity-of-identifiers.joy new file mode 100644 index 0000000000..5e074a15e6 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Joy/case-sensitivity-of-identifiers.joy @@ -0,0 +1,17 @@ +DEFINE dog == "Benjamin". +DEFINE Dog == "Samba". +DEFINE DOG == "Bernie". +"The three dogs are named" +"." DOG "and" Dog "," dog "The three dogs are named" +. +"The three dogs are named" +. +"Benjamin" +. +"," +. +"Samba" +. +"and" +. +"Bernie" diff --git a/Task/Case-sensitivity-of-identifiers/Julia/case-sensitivity-of-identifiers.julia b/Task/Case-sensitivity-of-identifiers/Julia/case-sensitivity-of-identifiers.jl similarity index 100% rename from Task/Case-sensitivity-of-identifiers/Julia/case-sensitivity-of-identifiers.julia rename to Task/Case-sensitivity-of-identifiers/Julia/case-sensitivity-of-identifiers.jl diff --git a/Task/Case-sensitivity-of-identifiers/Kotlin/case-sensitivity-of-identifiers.kotlin b/Task/Case-sensitivity-of-identifiers/Kotlin/case-sensitivity-of-identifiers.kts similarity index 100% rename from Task/Case-sensitivity-of-identifiers/Kotlin/case-sensitivity-of-identifiers.kotlin rename to Task/Case-sensitivity-of-identifiers/Kotlin/case-sensitivity-of-identifiers.kts diff --git a/Task/Case-sensitivity-of-identifiers/LOLCODE/case-sensitivity-of-identifiers.lol b/Task/Case-sensitivity-of-identifiers/LOLCODE/case-sensitivity-of-identifiers.lol new file mode 100644 index 0000000000..bbf2bc3047 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/LOLCODE/case-sensitivity-of-identifiers.lol @@ -0,0 +1,12 @@ +HAI 1.3 + +I HAS A dog ITZ "Benjamin" +I HAS A Dog ITZ "Samba" +I HAS A DOG ITZ "Bernie" + +EITHER OF DIFFRINT dog AN Dog AN DIFFRINT Dog AN DOG, O RLY? + YA RLY, VISIBLE "TEH 3 DOGZ R NAEMD :{dog}, :{Dog}, AN :{DOG}." + NO WAI, VISIBLE "THERE IZ JUST 1 DOG NAEMD :{DOG}." +OIC + +KTHXBYE diff --git a/Task/Case-sensitivity-of-identifiers/Nim/case-sensitivity-of-identifiers.nim b/Task/Case-sensitivity-of-identifiers/Nim/case-sensitivity-of-identifiers.nim index 6968431516..37894e4681 100644 --- a/Task/Case-sensitivity-of-identifiers/Nim/case-sensitivity-of-identifiers.nim +++ b/Task/Case-sensitivity-of-identifiers/Nim/case-sensitivity-of-identifiers.nim @@ -3,7 +3,7 @@ var dog, Dog: string if dog == Dog: if dog == DOG: - echo "There is only one dog, ", DOG) + echo "There is only one dog, ", DOG else: echo "There are two dogs: ", dog, " and ", DOG elif Dog == DOG : diff --git a/Task/Case-sensitivity-of-identifiers/OCaml/case-sensitivity-of-identifiers.ocaml b/Task/Case-sensitivity-of-identifiers/OCaml/case-sensitivity-of-identifiers.ml similarity index 100% rename from Task/Case-sensitivity-of-identifiers/OCaml/case-sensitivity-of-identifiers.ocaml rename to Task/Case-sensitivity-of-identifiers/OCaml/case-sensitivity-of-identifiers.ml diff --git a/Task/Case-sensitivity-of-identifiers/PascalABC.NET/case-sensitivity-of-identifiers.pas b/Task/Case-sensitivity-of-identifiers/PascalABC.NET/case-sensitivity-of-identifiers.pas new file mode 100644 index 0000000000..d697568ba5 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/PascalABC.NET/case-sensitivity-of-identifiers.pas @@ -0,0 +1,8 @@ +var + dog: string; +begin + dog := 'Benjamin'; + Dog := 'Samba'; + DOG := 'Bernie'; + Writeln('There is just one dog named ' + dog); +end. diff --git a/Task/Case-sensitivity-of-identifiers/Pluto/case-sensitivity-of-identifiers.pluto b/Task/Case-sensitivity-of-identifiers/Pluto/case-sensitivity-of-identifiers.pluto new file mode 100644 index 0000000000..79d19b3417 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Pluto/case-sensitivity-of-identifiers.pluto @@ -0,0 +1,13 @@ +do + local dog = "Benjamin"; + do + local Dog = "Samba"; + do + local DOG = "Bernie"; + if DOG != Dog or DOG != dog + then print( $"The three dogs are named: {dog}, {Dog} and {DOG}" ) + else print( $"There is just one dog named: {DOG}" ) + end + end + end +end diff --git a/Task/Case-sensitivity-of-identifiers/PowerShell/case-sensitivity-of-identifiers.psh b/Task/Case-sensitivity-of-identifiers/PowerShell/case-sensitivity-of-identifiers.ps1 similarity index 100% rename from Task/Case-sensitivity-of-identifiers/PowerShell/case-sensitivity-of-identifiers.psh rename to Task/Case-sensitivity-of-identifiers/PowerShell/case-sensitivity-of-identifiers.ps1 diff --git a/Task/Case-sensitivity-of-identifiers/Red/case-sensitivity-of-identifiers.red b/Task/Case-sensitivity-of-identifiers/Red/case-sensitivity-of-identifiers.red new file mode 100644 index 0000000000..5d1432eea1 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Red/case-sensitivity-of-identifiers.red @@ -0,0 +1,8 @@ +dog: "Benjamin" +Dog: "Samba" +DOG: "Bernie" + +print [ "The three dogs are " dog "," Dog "," DOG ] + +;- as Red is not case sensitive, will ouput +;- The three dogs are Bernie , Bernie , Bernie diff --git a/Task/Case-sensitivity-of-identifiers/Refal/case-sensitivity-of-identifiers.refal b/Task/Case-sensitivity-of-identifiers/Refal/case-sensitivity-of-identifiers.refal new file mode 100644 index 0000000000..11adce0813 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Refal/case-sensitivity-of-identifiers.refal @@ -0,0 +1,6 @@ +$ENTRY Go { + , 'Benjamin': e.dog + , 'Samba': e.Dog + , 'Bernie': e.DOG + = ; +}; diff --git a/Task/Case-sensitivity-of-identifiers/Rust/case-sensitivity-of-identifiers-1.rust b/Task/Case-sensitivity-of-identifiers/Rust/case-sensitivity-of-identifiers-1.rs similarity index 100% rename from Task/Case-sensitivity-of-identifiers/Rust/case-sensitivity-of-identifiers-1.rust rename to Task/Case-sensitivity-of-identifiers/Rust/case-sensitivity-of-identifiers-1.rs diff --git a/Task/Case-sensitivity-of-identifiers/Rust/case-sensitivity-of-identifiers-2.rust b/Task/Case-sensitivity-of-identifiers/Rust/case-sensitivity-of-identifiers-2.rs similarity index 100% rename from Task/Case-sensitivity-of-identifiers/Rust/case-sensitivity-of-identifiers-2.rust rename to Task/Case-sensitivity-of-identifiers/Rust/case-sensitivity-of-identifiers-2.rs diff --git a/Task/Case-sensitivity-of-identifiers/Rust/case-sensitivity-of-identifiers-3.rust b/Task/Case-sensitivity-of-identifiers/Rust/case-sensitivity-of-identifiers-3.rs similarity index 100% rename from Task/Case-sensitivity-of-identifiers/Rust/case-sensitivity-of-identifiers-3.rust rename to Task/Case-sensitivity-of-identifiers/Rust/case-sensitivity-of-identifiers-3.rs diff --git a/Task/Case-sensitivity-of-identifiers/S-BASIC/case-sensitivity-of-identifiers.basic b/Task/Case-sensitivity-of-identifiers/S-BASIC/case-sensitivity-of-identifiers.basic new file mode 100644 index 0000000000..de5524ecca --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/S-BASIC/case-sensitivity-of-identifiers.basic @@ -0,0 +1,13 @@ +var dog = string +comment + An attempt to declare Dog or DOG after declaring dog + will result in a compile-time error ("One of these VAR + names in use") +end + +dog = "Benjamin" +Dog = "Samba" +DOG = "Bernie" +print "There is just one dog named "; dog + +end diff --git a/Task/Case-sensitivity-of-identifiers/Scheme/case-sensitivity-of-identifiers.ss b/Task/Case-sensitivity-of-identifiers/Scheme/case-sensitivity-of-identifiers.scm similarity index 100% rename from Task/Case-sensitivity-of-identifiers/Scheme/case-sensitivity-of-identifiers.ss rename to Task/Case-sensitivity-of-identifiers/Scheme/case-sensitivity-of-identifiers.scm diff --git a/Task/Case-sensitivity-of-identifiers/Swift/case-sensitivity-of-identifiers.swift b/Task/Case-sensitivity-of-identifiers/Swift/case-sensitivity-of-identifiers.swift index b027c8aadd..e0af4e9df0 100644 --- a/Task/Case-sensitivity-of-identifiers/Swift/case-sensitivity-of-identifiers.swift +++ b/Task/Case-sensitivity-of-identifiers/Swift/case-sensitivity-of-identifiers.swift @@ -1,4 +1,4 @@ let dog = "Benjamin" let Dog = "Samba" let DOG = "Bernie" -println("The three dogs are named \(dog), \(Dog), and \(DOG).") +print("The three dogs are named \(dog), \(Dog), and \(DOG).") diff --git a/Task/Case-sensitivity-of-identifiers/Zig/case-sensitivity-of-identifiers.zig b/Task/Case-sensitivity-of-identifiers/Zig/case-sensitivity-of-identifiers.zig new file mode 100644 index 0000000000..46dbdaaf75 --- /dev/null +++ b/Task/Case-sensitivity-of-identifiers/Zig/case-sensitivity-of-identifiers.zig @@ -0,0 +1,9 @@ +const std = @import("std"); + +pub fn main() void { + const dog = "Benjamin"; + const Dog = "Samba"; + const DOG = "Bernie"; + + std.debug.print("The three dogs are named {s}, {s}, and {s}.\n", .{ dog, Dog, DOG }); +} diff --git a/Task/Casting-out-nines/ABC/casting-out-nines.abc b/Task/Casting-out-nines/ABC/casting-out-nines.abc new file mode 100644 index 0000000000..72dd29d4b4 --- /dev/null +++ b/Task/Casting-out-nines/ABC/casting-out-nines.abc @@ -0,0 +1,12 @@ +\ casting out nines - based on the Action! sample + +HOW TO ADD v TO n: PUT n + v IN n + +PUT 10, 2, 0, 0 IN base, n, count, total +FOR i IN { 1 .. base ** n }: + ADD 1 TO total + IF i mod ( base - 1 ) = ( i * i ) mod ( base - 1 ): + ADD 1 TO count + WRITE i +WRITE // "Trying", count, "numbers instead of", total, "numbers saves" +WRITE 100 - ( ( 100 * count ) / total ), "%" / diff --git a/Task/Casting-out-nines/BASIC256/casting-out-nines.basic b/Task/Casting-out-nines/BASIC256/casting-out-nines.basic new file mode 100644 index 0000000000..a11ff0fa58 --- /dev/null +++ b/Task/Casting-out-nines/BASIC256/casting-out-nines.basic @@ -0,0 +1,10 @@ +base = 10 +c1 = 0 +c2 = 0 +for k = 1 to (base ^ 2) - 1 + c1 += 1 + if k % (base - 1) = (k * k) % (base - 1) then c2 += 1: print k; " "; +next k +print +print "Trying "; c2; " numbers instead of "; c1; " numbers saves "; 100 - (100 * c2 / c1); "%" +end diff --git a/Task/Casting-out-nines/Chipmunk-Basic/casting-out-nines.basic b/Task/Casting-out-nines/Chipmunk-Basic/casting-out-nines.basic new file mode 100644 index 0000000000..b605fc071d --- /dev/null +++ b/Task/Casting-out-nines/Chipmunk-Basic/casting-out-nines.basic @@ -0,0 +1,9 @@ +100 cls +110 bs = 10 : c1 = 0 : c2 = 0 +120 for k = 1 to (bs^2)-1 +130 c1 = c1+1 +140 if k mod (bs-1) = (k*k) mod (bs-1) then c2 = c2+1 : print k; +150 next k +160 print +170 print "Trying ";c2;"numbers instead of ";c1;"numbers saves ";100-(100*c2/c1);"%" +180 end diff --git a/Task/Casting-out-nines/EasyLang/casting-out-nines.easy b/Task/Casting-out-nines/EasyLang/casting-out-nines.easy new file mode 100644 index 0000000000..46412c7702 --- /dev/null +++ b/Task/Casting-out-nines/EasyLang/casting-out-nines.easy @@ -0,0 +1,10 @@ +base = 10 +for k = 1 to base * base - 1 + c1 += 1 + if k mod (base - 1) = (k * k) mod (base - 1) + c2 += 1 + write k & " " + . +. +print "" +print "Trying " & c2 & " numbers instead of " & c1 & " numbers saves " & 100 - 100 * c2 / c1 diff --git a/Task/Casting-out-nines/Fortran/casting-out-nines.f b/Task/Casting-out-nines/Fortran/casting-out-nines.f new file mode 100644 index 0000000000..a2e0705db8 --- /dev/null +++ b/Task/Casting-out-nines/Fortran/casting-out-nines.f @@ -0,0 +1,220 @@ +program main + implicit none + + type :: test_case + integer :: base + character(len=10) :: begin, end_ + character(len=10), dimension(5) :: kaprekar + integer :: nkap + end type test_case + + type(test_case), dimension(2) :: testcases + type(test_case) :: tc + integer :: it, i, j + character(len=20), allocatable :: s(:) + logical :: found + + ! Initialize test cases + testcases(1)%base = 10 + testcases(1)%begin = '1' + testcases(1)%end_ = '100' + testcases(1)%kaprekar(1:5) = (/'1 ', '9 ', '45 ', '55 ', '99 '/) + testcases(1)%nkap = 5 + + testcases(2)%base = 17 + testcases(2)%begin = '10' + testcases(2)%end_ = 'gg' + testcases(2)%kaprekar(1:3) = (/'3d', 'd4', 'gg'/) + testcases(2)%nkap = 3 + + do it = 1, 2 + tc = testcases(it) + write(*, *) '' + write(*, '(A, I0, A, A, A, A)') 'Test case base = ', tc%base, ', begin = ', trim(tc%begin), ', end = ', trim(tc%end_) + call subset(tc%base, tc%begin, tc%end_, s) + write(*, '(A)', advance='no') 'Subset: ' + do i = 1, size(s) + write(*, '(A, A)', advance='no') trim(s(i)), ' ' + end do + write(*, *) + write(*, '(A)', advance='no') 'Kaprekar: ' + do i = 1, tc%nkap + write(*, '(A, A)', advance='no') trim(tc%kaprekar(i)), ' ' + end do + write(*, *) + + ! Check if all Kaprekar are in subset + j = 1 + do i = 1, tc%nkap + found = .false. + do while (j <= size(s)) + if (trim(s(j)) == trim(tc%kaprekar(i))) then + found = .true. + j = j + 1 + exit + end if + j = j + 1 + end do + if (.not. found) then + write(*, '(A, A, A)') 'Fail: ', trim(tc%kaprekar(i)), ' not in subset' + stop + end if + end do + write(*, *) 'Valid subset.' + if (allocated(s)) deallocate(s) + end do + +contains + + subroutine subset(base, begin, end_, s) + integer, intent(in) :: base + character(len=*), intent(in) :: begin, end_ + character(len=20), allocatable, intent(out) :: s(:) + integer(8) :: begin64, end64, k, kk + character(len=20) :: ks, kks + character(1) :: rk, rk2 + + begin64 = str_to_int(base, begin) + end64 = str_to_int(base, end_) + + allocate(s(0)) ! Start empty + + do k = begin64, end64 + ks = int_to_str(base, k) + rk = check_digit(base, ks) + kk = k * k + kks = int_to_str(base, kk) + rk2 = check_digit(base, kks) + if (rk == rk2) then + call append_str(s, ks) + end if + end do + end subroutine subset + + subroutine append_str(list, val) + character(len=20), allocatable, intent(inout) :: list(:) + character(len=*), intent(in) :: val + character(len=20), allocatable :: tmp(:) + + if (allocated(list)) then + allocate(tmp(size(list))) + tmp = list + deallocate(list) + allocate(list(size(tmp) + 1)) + list(1:size(tmp)) = tmp + list(size(tmp) + 1) = val + else + allocate(list(1)) + list(1) = val + end if + end subroutine append_str + + recursive function check_digit(base, n) result(r) + integer, intent(in) :: base + character(len=*), intent(in) :: n + character(1) :: r + character(1) :: d, b9 + character(len=20) :: s, s9 + integer :: i, v9 + + v9 = base - 1 + s9 = int_to_str(base, int(v9, 8)) + b9 = s9(1:1) ! Single digit + + r = '0' + do i = 1, len_trim(n) + d = n(i:i) + if (d == b9) cycle + if (r == '0') then + r = d + cycle + end if + s = add_digits(base, r, d) + if (trim(s) == trim(s9)) then + r = '0' + cycle + end if + if (len_trim(s) == 1) then + r = s(1:1) + cycle + end if + ! Recurse on two-digit sum + r = check_digit(base, trim(s)) + end do + end function check_digit + + function add_digits(base, a, b) result(res) + integer, intent(in) :: base + character(1), intent(in) :: a, b + character(len=20) :: res + integer :: ai, bi + + ai = digit_value(a, base) + bi = digit_value(b, base) + res = int_to_str(base, int(ai + bi, 8)) + end function add_digits + + function digit_value(c, base) result(v) + character(1), intent(in) :: c + integer, intent(in) :: base + integer :: v + + if (c >= '0' .and. c <= '9') then + v = iachar(c) - iachar('0') + else if (c >= 'a' .and. c <= 'z') then + v = 10 + iachar(c) - iachar('a') + else + stop 'invalid digit' + end if + if (v < 0 .or. v >= base) stop 'invalid digit for base' + end function digit_value + + function value_to_digit(v) result(c) + integer, intent(in) :: v + character(1) :: c + + if (v < 10) then + c = achar(iachar('0') + v) + else + c = achar(iachar('a') + v - 10) + end if + end function value_to_digit + + function int_to_str(base, k) result(s) + integer, intent(in) :: base + integer(8), intent(in) :: k + character(len=20) :: s + integer(8) :: kk + integer :: digit + + kk = k + if (kk < 0) kk = -kk ! But not handling negatives in this context + s = '' + if (kk == 0) then + s = '0' + return + end if + do while (kk > 0) + digit = mod(kk, int(base, 8)) + s = value_to_digit(digit) // s + kk = kk / int(base, 8) + end do + end function int_to_str + + function str_to_int(base, s) result(val) + integer, intent(in) :: base + character(len=*), intent(in) :: s + integer(8) :: val + integer :: i, lens, v + character(len=20) :: ss + + ss = adjustl(s) + lens = len_trim(ss) + val = 0 + do i = 1, lens + v = digit_value(ss(i:i), base) + val = val * int(base, 8) + int(v, 8) + end do + end function str_to_int + +end program main diff --git a/Task/Casting-out-nines/Gambas/casting-out-nines.gambas b/Task/Casting-out-nines/Gambas/casting-out-nines.gambas new file mode 100644 index 0000000000..64769e472e --- /dev/null +++ b/Task/Casting-out-nines/Gambas/casting-out-nines.gambas @@ -0,0 +1,16 @@ +Public Sub Main() + + Dim base10 As Integer = 10 + Dim c1 As Integer = 0, c2 As Integer = 0, k As Integer + + For k = 1 To base10 ^ 2 + c1 += 1 + If (k Mod (base10 - 1) = (k * k) Mod (base10 - 1)) Then + c2 += 1 + Print k; " "; + End If + Next + + Print "\nTrying "; c2; " numbers instead of "; c1; " numbers saves "; 100 - (100 * c2 / c1); "%" + +End diff --git a/Task/Casting-out-nines/Julia/casting-out-nines.julia b/Task/Casting-out-nines/Julia/casting-out-nines.jl similarity index 100% rename from Task/Casting-out-nines/Julia/casting-out-nines.julia rename to Task/Casting-out-nines/Julia/casting-out-nines.jl diff --git a/Task/Casting-out-nines/Kotlin/casting-out-nines.kotlin b/Task/Casting-out-nines/Kotlin/casting-out-nines.kts similarity index 100% rename from Task/Casting-out-nines/Kotlin/casting-out-nines.kotlin rename to Task/Casting-out-nines/Kotlin/casting-out-nines.kts diff --git a/Task/Casting-out-nines/MSX-Basic/casting-out-nines.basic b/Task/Casting-out-nines/MSX-Basic/casting-out-nines.basic new file mode 100644 index 0000000000..e8b2011dcd --- /dev/null +++ b/Task/Casting-out-nines/MSX-Basic/casting-out-nines.basic @@ -0,0 +1,9 @@ +100 CLS +110 BS = 10 : C1 = 0 : C2 = 0 +120 FOR K = 1 TO (BS^2)-1 +130 C1 = C1+1 +140 IF K MOD (BS-1) = (K*K) MOD (BS-1) THEN C2 = C2+1 : PRINT K; +150 NEXT K +160 PRINT +170 PRINT USING "Trying ## numbers instead of ### numbers saves ##.##%";C2;C1;100-(100*C2/C1) +180 END diff --git a/Task/Casting-out-nines/PascalABC.NET/casting-out-nines.pas b/Task/Casting-out-nines/PascalABC.NET/casting-out-nines.pas new file mode 100644 index 0000000000..3c185151a6 --- /dev/null +++ b/Task/Casting-out-nines/PascalABC.NET/casting-out-nines.pas @@ -0,0 +1,16 @@ +## +function co9(x: integer): integer; +begin + if x = 9 then result := 0 + else if x < 9 then result := x + else result := co9(x.ToString.select(x -> StrToInt(x)).sum); +end; + +var kaprekars := [1, 9, 45, 55, 99, 297, 703, 999]; + +Print('Checksums: '); (1..20).Select(x -> co9(x)).Println; +Print('co9(k) = co9(k*k): '); +Println((1..1000).Where(x -> co9(x) = co9(x * x))); +var part2 := (1..1000).Where(x -> co9(x) = co9(x * x)).ToSet; +Println('Kaprekars: ', kaprekars); +if kaprekars <= part2 then Println('Kaprekars are included.', part2.Count, 'numbers in range 1000'); diff --git a/Task/Casting-out-nines/Pluto/casting-out-nines.pluto b/Task/Casting-out-nines/Pluto/casting-out-nines.pluto new file mode 100644 index 0000000000..123bf40ebc --- /dev/null +++ b/Task/Casting-out-nines/Pluto/casting-out-nines.pluto @@ -0,0 +1,30 @@ +local function cast_out(base, start, finish) + local b = base - 1 + local ran = range(0, b - 1):filter(|n| -> n % b == (n * n) % b) + local x = start // b + local result = {} + while true do + for ran as n do + local k = b * x + n + if k >= start then + if k > finish then return result end + result:insert(k) + end + end + ++x + end +end + +local function print_array(a, w = 3, n = 10) + for i = 1, #a do + io.write(string.format($"%{w}d ", a[i])) + if i % n == 0 then print() end + end + if #a % 10 != n then print() end +end + +print_array(cast_out(16, 1, 255)) +print() +print_array(cast_out(10, 1, 99)) +print() +print_array(cast_out(17, 1, 288)) diff --git a/Task/Casting-out-nines/PureBasic/casting-out-nines.basic b/Task/Casting-out-nines/PureBasic/casting-out-nines.basic new file mode 100644 index 0000000000..5428d61c14 --- /dev/null +++ b/Task/Casting-out-nines/PureBasic/casting-out-nines.basic @@ -0,0 +1,18 @@ +OpenConsole() +Define.i base, c1, c2, k + +base = 10 +c1 = 0 +c2 = 0 +For k = 1 To Pow(base, 2) - 1 + c1 + 1 + If k % (base - 1) = (k * k) % (base - 1) + c2 + 1 + Print(Str(k) + " ") + EndIf +Next k + +PrintN(#CRLF$ + "Trying " + Str(c2) + " numbers instead of " + Str(c1) + " numbers saves " + Str(100 - (100 * c2 / c1)) + "%") + +PrintN(#CRLF$ + "Press ENTER to exit"): Input() +CloseConsole() diff --git a/Task/Casting-out-nines/QBasic/casting-out-nines.basic b/Task/Casting-out-nines/QBasic/casting-out-nines.basic new file mode 100644 index 0000000000..56d9ac30e9 --- /dev/null +++ b/Task/Casting-out-nines/QBasic/casting-out-nines.basic @@ -0,0 +1,8 @@ +CLS +bs = 10: c1 = 0: c2 = 0 +FOR k = 1 TO (bs ^ 2) - 1 + c1 = c1 + 1 + IF k MOD (bs - 1) = (k * k) MOD (bs - 1) THEN c2 = c2 + 1: PRINT k; +NEXT k +PRINT +PRINT USING "Trying ## numbers instead of ### numbers saves ##.##%"; c2; c1; 100 - (100 * c2 / c1) diff --git a/Task/Casting-out-nines/R/casting-out-nines.r b/Task/Casting-out-nines/R/casting-out-nines.r new file mode 100644 index 0000000000..6b66c9b2b5 --- /dev/null +++ b/Task/Casting-out-nines/R/casting-out-nines.r @@ -0,0 +1,5 @@ +co9 <- function(base) { + x <- 1:(base^2-1) + x[(x %% (base-1)) == (x^2 %% (base-1))] +} +Map(co9,c(10,16,17)) diff --git a/Task/Casting-out-nines/Run-BASIC/casting-out-nines.basic b/Task/Casting-out-nines/Run-BASIC/casting-out-nines.basic new file mode 100644 index 0000000000..037b9067c8 --- /dev/null +++ b/Task/Casting-out-nines/Run-BASIC/casting-out-nines.basic @@ -0,0 +1,10 @@ +base = 10 +c1 = 0 +c2 = 0 +for k = 1 to (base ^ 2) - 1 + c1 = c1 + 1 + if k mod (base - 1) = (k * k) mod (base - 1) then c2 = c2 + 1: print k; " "; +next k +print +print "Trying "; using("##", c2); " numbers instead of "; using("###", c1); " numbers saves "; using("##.##", (100 - (100 * c2 / c1))); "%" +end diff --git a/Task/Casting-out-nines/Rust/casting-out-nines.rust b/Task/Casting-out-nines/Rust/casting-out-nines.rs similarity index 100% rename from Task/Casting-out-nines/Rust/casting-out-nines.rust rename to Task/Casting-out-nines/Rust/casting-out-nines.rs diff --git a/Task/Casting-out-nines/True-BASIC/casting-out-nines.basic b/Task/Casting-out-nines/True-BASIC/casting-out-nines.basic new file mode 100644 index 0000000000..b61f3b8db4 --- /dev/null +++ b/Task/Casting-out-nines/True-BASIC/casting-out-nines.basic @@ -0,0 +1,13 @@ +LET bs = 10 +LET c1 = 0 +LET c2 = 0 +FOR k = 1 TO (bs^2)-1 + LET c1 = c1 + 1 + IF REMAINDER(k,(bs-1)) = REMAINDER((k*k),(bs-1)) THEN + LET c2 = c2 + 1 + PRINT k; + END IF +NEXT k +PRINT +PRINT USING "Trying ## numbers instead of ### numbers saves ##.##%": c2, c1, 100-(100*c2/c1) +END diff --git a/Task/Casting-out-nines/XBasic/casting-out-nines.basic b/Task/Casting-out-nines/XBasic/casting-out-nines.basic new file mode 100644 index 0000000000..25621a5d46 --- /dev/null +++ b/Task/Casting-out-nines/XBasic/casting-out-nines.basic @@ -0,0 +1,17 @@ +PROGRAM "Casting out nines" +VERSION "0.0000" + +DECLARE FUNCTION Entry () + +FUNCTION Entry () + bs = 10 + c1 = 0 + c2 = 0 + FOR k = 1 TO (bs ** 2) - 1 + INC c1 + IF k MOD (bs - 1) = (k * k) MOD (bs - 1) THEN INC c2: PRINT k; + NEXT k + PRINT + PRINT "Trying "; c2; " numbers instead of "; c1; " numbers saves "; 100 - (100 * c2 / c1); "%" +END FUNCTION +END PROGRAM diff --git a/Task/Casting-out-nines/Yabasic/casting-out-nines.basic b/Task/Casting-out-nines/Yabasic/casting-out-nines.basic new file mode 100644 index 0000000000..502e8d6d5d --- /dev/null +++ b/Task/Casting-out-nines/Yabasic/casting-out-nines.basic @@ -0,0 +1,9 @@ +base = 10 +c1 = 0 +c2 = 0 +for k = 1 to (base ^ 2) - 1 + c1 = c1 + 1 + if mod(k, (base - 1)) = mod((k * k), (base - 1)) then c2 = c2 + 1: print k, " "; : fi +next k +print "\nTrying ", c2 using("##"), " numbers instead of ", c1 using("###"), " numbers saves ", (100 - (100 * c2 / c1)) using("##.##"), "%" +end diff --git a/Task/Catalan-numbers-Pascals-triangle/360-Assembly/catalan-numbers-pascals-triangle.360 b/Task/Catalan-numbers-Pascals-triangle/360-Assembly/catalan-numbers-pascals-triangle.360 index a0cc83dae1..633d55d35e 100644 --- a/Task/Catalan-numbers-Pascals-triangle/360-Assembly/catalan-numbers-pascals-triangle.360 +++ b/Task/Catalan-numbers-Pascals-triangle/360-Assembly/catalan-numbers-pascals-triangle.360 @@ -68,7 +68,7 @@ ENLOOP2J EQU * MVC C,Z OI C+L'C-1,X'F0' MVC WTOBUF(8),C+8 - WTO MF=(E,WTOMSG) + WTO MF=(E,WTOMSG) B LOOPI ENDLOOPI EQU * * ---- END CODE diff --git a/Task/Catalan-numbers-Pascals-triangle/Ada/catalan-numbers-pascals-triangle.ada b/Task/Catalan-numbers-Pascals-triangle/Ada/catalan-numbers-pascals-triangle.adb similarity index 100% rename from Task/Catalan-numbers-Pascals-triangle/Ada/catalan-numbers-pascals-triangle.ada rename to Task/Catalan-numbers-Pascals-triangle/Ada/catalan-numbers-pascals-triangle.adb diff --git a/Task/Catalan-numbers-Pascals-triangle/Applesoft-BASIC/catalan-numbers-pascals-triangle.basic b/Task/Catalan-numbers-Pascals-triangle/Applesoft-BASIC/catalan-numbers-pascals-triangle.basic new file mode 100644 index 0000000000..3c43ec09a4 --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/Applesoft-BASIC/catalan-numbers-pascals-triangle.basic @@ -0,0 +1,12 @@ +10 HOME +20 n = 15 +30 DIM t(n+2) +50 t(1) = 1 +55 PRINT "The first 15 Catalan numbers are: "; CHR$(10) +60 FOR i = 1 TO n +70 FOR j = i TO 1 STEP -1 : t(j) = t(j) + t(j-1) : NEXT j +80 t(i+1) = t(i) +90 FOR j = i+1 TO 1 STEP -1 : t(j) = t(j) + t(j-1) : NEXT j +100 PRINT i; ": "; t(i+1) - t(i) +120 NEXT i +130 END diff --git a/Task/Catalan-numbers-Pascals-triangle/AutoHotkey/catalan-numbers-pascals-triangle.ahk b/Task/Catalan-numbers-Pascals-triangle/AutoHotkey/catalan-numbers-pascals-triangle.ahk index 4921c4ed98..67ce3c01c6 100644 --- a/Task/Catalan-numbers-Pascals-triangle/AutoHotkey/catalan-numbers-pascals-triangle.ahk +++ b/Task/Catalan-numbers-Pascals-triangle/AutoHotkey/catalan-numbers-pascals-triangle.ahk @@ -6,25 +6,25 @@ Array := [], Array[2,1] := Array[2,2] := 1 ; Array inititated and 2nd row of pas INI := 3 ; starts with calculating the 3rd row and as such the value Loop, 31 ; every odd row is taken for calculating catalan number as such to obtain 15 we need 2n+1 { - if ( A_index > 2 ) - { - Loop, % A_INDEX - { - old := ini-1, index := A_index, index_1 := A_index + 1 - Array[ini, index_1] := Array[old, index] + Array[old, index_1] - Array[ini, 1] := Array[ini, ini] := 1 - line .= Array[ini, A_index] " " - } - ;~ MsgBox % line ; gives rows of pascal's triangle - ; calculating every odd row starting from 1st so as to obtain catalan's numbers - if ( mod(ini,2) != 0) - { - StringSplit, res, line, %A_Space% - ans := res0//2, ans_1 := ans++ - result := result . res%ans_1% - res%ans% " " - } - line := - ini++ - } + if ( A_index > 2 ) + { + Loop, % A_INDEX + { + old := ini-1, index := A_index, index_1 := A_index + 1 + Array[ini, index_1] := Array[old, index] + Array[old, index_1] + Array[ini, 1] := Array[ini, ini] := 1 + line .= Array[ini, A_index] " " + } + ;~ MsgBox % line ; gives rows of pascal's triangle + ; calculating every odd row starting from 1st so as to obtain catalan's numbers + if ( mod(ini,2) != 0) + { + StringSplit, res, line, %A_Space% + ans := res0//2, ans_1 := ans++ + result := result . res%ans_1% - res%ans% " " + } + line := + ini++ + } } MsgBox % result diff --git a/Task/Catalan-numbers-Pascals-triangle/Batch-File/catalan-numbers-pascals-triangle.bat b/Task/Catalan-numbers-Pascals-triangle/Batch-File/catalan-numbers-pascals-triangle.bat index 707de0dc95..9c096844a1 100644 --- a/Task/Catalan-numbers-Pascals-triangle/Batch-File/catalan-numbers-pascals-triangle.bat +++ b/Task/Catalan-numbers-Pascals-triangle/Batch-File/catalan-numbers-pascals-triangle.bat @@ -8,15 +8,15 @@ for /L %%i in (1,1,%n%) do ( set /A ip=%%i+1 for /L %%j in (%%i,-1,1) do ( set /A jm=%%j-1 - set /A t.%%j=t.%%j+t.!jm! - ) - set /A t.!ip!=t.%%i + set /A t.%%j=t.%%j+t.!jm! + ) + set /A t.!ip!=t.%%i for /L %%j in (!ip!,-1,1) do ( set /A jm=%%j-1 - set /A t.%%j=t.%%j+t.!jm! - ) + set /A t.%%j=t.%%j+t.!jm! + ) set /A ci=t.!ip!-t.%%i - echo !ci! + echo !ci! ) ) pause diff --git a/Task/Catalan-numbers-Pascals-triangle/Chipmunk-Basic/catalan-numbers-pascals-triangle.basic b/Task/Catalan-numbers-Pascals-triangle/Chipmunk-Basic/catalan-numbers-pascals-triangle.basic new file mode 100644 index 0000000000..1e968a5219 --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/Chipmunk-Basic/catalan-numbers-pascals-triangle.basic @@ -0,0 +1,13 @@ +100 cls +110 n = 15 +120 dim t(n+2) +130 t(1) = 1 +140 print "The first 15 Catalan numbers are: ";chr$(10) +150 for i = 1 to n +160 for j = i to 1 step -1 : t(j) = t(j)+t(j-1) : next j +170 t(i+1) = t(i) +180 for j = i+1 to 1 step -1 : t(j) = t(j)+t(j-1) : next j +190 print using "###";i;": "; +200 print using "#########";t(i+1)-t(i) +210 next i +220 end diff --git a/Task/Catalan-numbers-Pascals-triangle/DuckDB/catalan-numbers-pascals-triangle-1.duckdb b/Task/Catalan-numbers-Pascals-triangle/DuckDB/catalan-numbers-pascals-triangle-1.duckdb new file mode 100644 index 0000000000..90833b9fbe --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/DuckDB/catalan-numbers-pascals-triangle-1.duckdb @@ -0,0 +1,20 @@ +# Compute nCr naively using UHUGEINT +# The caller should ensure 2r < n +create or replace function nCr_(n, r) as + (with recursive cte as + (SELECT 1::UHUGEINT as c, n as numerator, 1::UHUGEINT as m + UNION ALL + SELECT (c * numerator / m) as c, + (numerator - 1) as numerator, + (m + 1) as m + FROM cte + WHERE m <= r) + SELECT last(c order by m) + FROM cte +); + +create or replace function nCr(n,r) as ( + if( n - N2=N*(S+S), - D2=D*S, - K = N2 div D2 ; + N2=N*(S+S), + D2=D*S, + K = N2 div D2 ; mul(N,D,S,L)-> - N2=N*(S+L), - D2=D*L, - K = mul(N2,D2,S,L+1). - + N2=N*(S+L), + D2=D*L, + K = mul(N2,D2,S,L+1). + catl(Ans,16) -> Ans; catl(D,S)-> - C=mul(1,1,S,2), - catl([D|C],S+1). + C=mul(1,1,S,2), + catl([D|C],S+1). main()-> - Ans=catl(1,2). + Ans=catl(1,2). diff --git a/Task/Catalan-numbers-Pascals-triangle/Fortran/catalan-numbers-pascals-triangle.f b/Task/Catalan-numbers-Pascals-triangle/Fortran/catalan-numbers-pascals-triangle.f new file mode 100644 index 0000000000..aeb18b829c --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/Fortran/catalan-numbers-pascals-triangle.f @@ -0,0 +1,64 @@ + ! Catalan numbers/Pascal's triangle + ! + ! tested with Intel ifx (IFX) 2025.2.0 20250605 on Kubuntu 25.04 + ! GNU Fortran (Ubuntu 14.2.0-19ubuntu2) 14.2.0 on Kubuntu 25.04 + ! VSI Fortran x86-64 V8.6-001 on OpenVMS x86_64 V9.2-3 + ! Note that VMS requires switch $Fortran/ccdefault=LIST + ! otherwise 1st character of each output line is interpreted as + ! Carriage Control character. + ! U.B., July 2025 + + program calc_catalan + implicit none + + integer, parameter :: nMax=15 ! Number of catalan numbers to print + integer :: catalan ! result of calculation + integer :: i, j ! Loop indices + integer :: t(nMax+3) ! 1 line of pascal's triangle + + ! straight copy of the algorithm presented in the C++ solution + ! + ! Try to explain what we are doing: + ! + ! Pascal's Triangle + ! # 1: 1 + ! # 2: 1 2 1 C1 = 2-1 = 1 + ! # 3: 1 3 3 1 + ! # 4: 1 4 6 4 1 C2 = 6-4 = 2 + ! # 5: 1 5 10 10 5 1 + ! # 6: 1 6 15 20 15 6 1 C3 = 20 - 15 = 5 + ! # 7: 1 7 21 35 35 21 7 1 + ! # 8: 1 8 28 56 70 56 28 8 1 C4 = 70 - 56 = 14 + ! t1 2 3 4 5 ... + ! etc. Note for Cn we need even row #(2*n) up to index n+1. + ! and we dont need to store all values, just go from row to row. + t(1) = 0 + t(2) = 1 ! first odd row (i.e. row #1) will be t(2)+t(1) + + do i=2, nMax+1 ! to calculate C(1)... C(nMax) + ! get entries of next odd row (at index 2...i). + ! currently t has values of previous even row + do j = i, 2, -1 + t(j) = t(j) + t(j-1) + end do + ! Now t has values of next odd row. + + ! shift index by 1 so that soon "t" will carry values of next even row + t(i+1) = t(i) + + ! combine values of previously odd row to become values of even row + do j=i+1, 2, -1 + t(j) = t(j) + t(j-1) + end do + ! Now t has values 1...n+1 of 2n'th row of pascals triangle. + + ! Result: catalan number is center number - (left of center)number + ! e. g. for C4 its t(5)-t(4) = 70-56 = 14 + ! (remember i is 5 to calculate C4.) + catalan = t(i+1) - t(i) + + write (*, '(I0,x) ', ADVANCE='NO') catalan ! all in 1 line + end do + + write (*,*) ' ' ! Terminate output line + end program calc_catalan diff --git a/Task/Catalan-numbers-Pascals-triangle/FutureBasic/catalan-numbers-pascals-triangle.basic b/Task/Catalan-numbers-Pascals-triangle/FutureBasic/catalan-numbers-pascals-triangle.basic new file mode 100644 index 0000000000..f8d7a51702 --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/FutureBasic/catalan-numbers-pascals-triangle.basic @@ -0,0 +1,20 @@ + local fn CatalanNumbers( levels as int ) + int k, n + double num, den, cat + + printf @"1" + + for n = 2 to levels + num = 1 : den = 1 + for k = 2 to n + num *= ( n + k ) + den *= k + cat = num / den + next + printf @"%.f", cat + next +end fn + +fn CatalanNumbers( 30 ) + +HandleEvents diff --git a/Task/Catalan-numbers-Pascals-triangle/Julia/catalan-numbers-pascals-triangle.julia b/Task/Catalan-numbers-Pascals-triangle/Julia/catalan-numbers-pascals-triangle.jl similarity index 100% rename from Task/Catalan-numbers-Pascals-triangle/Julia/catalan-numbers-pascals-triangle.julia rename to Task/Catalan-numbers-Pascals-triangle/Julia/catalan-numbers-pascals-triangle.jl diff --git a/Task/Catalan-numbers-Pascals-triangle/Kotlin/catalan-numbers-pascals-triangle.kotlin b/Task/Catalan-numbers-Pascals-triangle/Kotlin/catalan-numbers-pascals-triangle.kts similarity index 100% rename from Task/Catalan-numbers-Pascals-triangle/Kotlin/catalan-numbers-pascals-triangle.kotlin rename to Task/Catalan-numbers-Pascals-triangle/Kotlin/catalan-numbers-pascals-triangle.kts diff --git a/Task/Catalan-numbers-Pascals-triangle/MSX-Basic/catalan-numbers-pascals-triangle.basic b/Task/Catalan-numbers-Pascals-triangle/MSX-Basic/catalan-numbers-pascals-triangle.basic new file mode 100644 index 0000000000..e801b9f952 --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/MSX-Basic/catalan-numbers-pascals-triangle.basic @@ -0,0 +1,12 @@ +100 CLS +110 N = 15 +120 DIM T(N+2) +130 T(1) = 1 +140 PRINT "The first 15 Catalan numbers are: "; CHR$(10) +150 FOR I = 1 TO N +160 FOR J = I TO 1 STEP -1 : T(J) = T(J) + T(J-1) : NEXT J +170 T(I+1) = T(I) +180 FOR J = I+1 TO 1 STEP -1 : T(J) = T(J) + T(J-1) : NEXT J +190 PRINT USING "###: #########";I; T(I+1) - T(I) +200 NEXT I +210 END diff --git a/Task/Catalan-numbers-Pascals-triangle/Maxima/catalan-numbers-pascals-triangle.maxima b/Task/Catalan-numbers-Pascals-triangle/Maxima/catalan-numbers-pascals-triangle.maxima new file mode 100644 index 0000000000..dd02905ec7 --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/Maxima/catalan-numbers-pascals-triangle.maxima @@ -0,0 +1,5 @@ +/* The Catalan triangle can be generated using genmatrix */ +genmatrix(lambda([n,k],if n>=k then binomial(n+k-1,k-1)-2*binomial(n+k-2,k-2) else 0),15,15)$ + +/* The Catalan numbers are in the main diagonal */ +makelist(%[i,i],i,1,15); diff --git a/Task/Catalan-numbers-Pascals-triangle/OCaml/catalan-numbers-pascals-triangle.ocaml b/Task/Catalan-numbers-Pascals-triangle/OCaml/catalan-numbers-pascals-triangle.ml similarity index 100% rename from Task/Catalan-numbers-Pascals-triangle/OCaml/catalan-numbers-pascals-triangle.ocaml rename to Task/Catalan-numbers-Pascals-triangle/OCaml/catalan-numbers-pascals-triangle.ml diff --git a/Task/Catalan-numbers-Pascals-triangle/Objeck/catalan-numbers-pascals-triangle.objeck b/Task/Catalan-numbers-Pascals-triangle/Objeck/catalan-numbers-pascals-triangle.objeck new file mode 100644 index 0000000000..37ecabb22c --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/Objeck/catalan-numbers-pascals-triangle.objeck @@ -0,0 +1,23 @@ +class Test { + function : Main(args : String[]) ~ Nil { + N := 15; + t := Int->New[N + 2]; + t[1] := 1; + + for(i := 1; i <= N; i++) { + + for(j := i; j > 1; j--){ + t[j] := t[j] + t[j - 1]; + }; + + t[i + 1] := t[i]; + + for(j := i + 1; j > 1; j--) { + t[j] := t[j] + t[j - 1]; + }; + + v := t[i + 1] - t[i]; + "{$v} "->Print(); + }; + } +} diff --git a/Task/Catalan-numbers-Pascals-triangle/PascalABC.NET/catalan-numbers-pascals-triangle.pas b/Task/Catalan-numbers-Pascals-triangle/PascalABC.NET/catalan-numbers-pascals-triangle.pas new file mode 100644 index 0000000000..f031c01feb --- /dev/null +++ b/Task/Catalan-numbers-Pascals-triangle/PascalABC.NET/catalan-numbers-pascals-triangle.pas @@ -0,0 +1,14 @@ +const + n = 15; + +begin + var t: array[0..n + 1] of integer; + t[1] := 1; + for var i := 1 to n do + begin + for var j := i downto 1 do t[j] += t[j - 1]; + t[i + 1] := t[i]; + for var j := i + 1 downto 1 do t[j] += t[j - 1]; + print(t[i + 1] - t[i]); + end; +end. diff --git a/Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-1.phix b/Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-1.phix index 636407e5ea..9df9e2a484 100644 --- a/Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-1.phix +++ b/Task/Catalan-numbers-Pascals-triangle/Phix/catalan-numbers-pascals-triangle-1.phix @@ -1,16 +1,12 @@ -(phixonline)--> - constant N = 15 -- accurate to 30, nan/inf for anything over 514 (gmp version is below). - sequence catalan = {}, -- (>=1 only) - p = repeat(1,N+1) - atom p1 - for i=1 to N do - p1 = p[1]*2 - catalan = append(catalan,p1-p[2]) - for j=1 to N-i+1 do - p1 += p[j+1] - p[j] = p1 - end for - -- ?p[1..N-i+1] - end for - ?catalan - - with javascript_semantics - include builtins\mpfr.e +with javascript_semantics +include builtins\mpfr.e - function catalanB(integer n) -- very very fast! - sequence catalan = mpz_inits(n), - p = mpz_inits(n+1,1) - mpz p1 = mpz_init(1) - if n=0 then return p1 end if - for i=1 to n do - mpz_mul_si(p1,p[1],2) - mpz_sub(catalan[i],p1,p[2]) - for j=1 to n-i+1 do - mpz_add(p1,p1,p[j+1]) - mpz_set(p[j],p1) - end for - end for - return catalan[n] - end function +function catalanB(integer n) -- very very fast! +sequence catalan = mpz_inits(n), + p = mpz_inits(n+1,1) +mpz p1 = mpz_init(1) + if n=0 then return p1 end if + for i=1 to n do + mpz_mul_si(p1,p[1],2) + mpz_sub(catalan[i],p1,p[2]) + for j=1 to n-i+1 do + mpz_add(p1,p1,p[j+1]) + mpz_set(p[j],p1) + end for + end for + return catalan[n] +end function - printf(1,"%d: %s\n",{100,shorten(mpz_get_str(catalanB(100)))}) - printf(1,"%d: %s\n",{250,shorten(mpz_get_str(catalanB(250)))}) - - with javascript_semantics - -- returns inf/-nan for n>85, and needs the rounding for n>=14, accurate to n=29 - function catalan1(integer n) - return floor(factorial(2*n)/(factorial(n+1)*factorial(n))+0.5) - end function +with javascript_semantics +-- returns inf/-nan for n>85, and needs the rounding for n>=14, accurate to n=29 +function catalan1(integer n) + return round(factorial(2*n)/(factorial(n+1)*factorial(n))) +end function - -- returns inf for n>519, accurate to n=30: - function catalan2(integer n) -- NB: very slow! - atom res = not n - n -= 1 - for i=0 to n do - res += catalan2(i)*catalan2(n-i) - end for - return res - end function +-- returns inf for n>519, accurate to n=30: +function catalan2(integer n) -- NB: very slow! +atom res = not n + n -= 1 + for i=0 to n do + res += catalan2(i)*catalan2(n-i) + end for + return res +end function - -- returns inf for n>514, accurate to n=30: - function catalan3(integer n) - if n=0 then return 1 end if - return 2*(2*n-1)/(1+n)*catalan3(n-1) - end function +-- returns inf for n>514, accurate to n=30: +function catalan3(integer n) + if n=0 then return 1 end if + return 2*(2*n-1)/(1+n)*catalan3(n-1) +end function - sequence res = repeat(repeat(0,4),16), - times = repeat(0,3) - for t=1 to 4 do - atom t0 = time() - for i=0 to 15 do - switch t do - case 1: res[i+1][2] = catalan1(i) - case 2: res[i+1][3] = catalan2(i) - case 3: res[i+1][4] = catalan3(i) - case 4: res[i+1][1] = i; printf(1,"%2d: %10d %10d %10d\n",res[i+1]) - end switch - end for - if t=4 then exit end if - times[t] = elapsed(time()-t0) - end for - printf(1,"times:%8s %10s %10s\n",times) - - with javascript_semantics - include builtins\mpfr.e +with javascript_semantics +include builtins\mpfr.e - sequence c2cache = {} +sequence c2cache = {} - function catalan2m(integer n) -- very fast! - object r -- result (a [cached/shared] mpz) - -- (nb: modifying result will mess up cache) - if n<=0 then return mpz_init(1) end if - if n<=length(c2cache) then - r = c2cache[n] - if r!=0 then return r end if - else - c2cache &= repeat(0,n-length(c2cache)) - end if - r = mpz_init(0) - mpz t = mpz_init() - for i=0 to n-1 do - mpz_mul(t,catalan2m(i),catalan2m(n-1-i)) - mpz_add(r,r,t) - end for - t = mpz_free(t) - c2cache[n] = r - return r - end function +function catalan2m(integer n) -- very fast! +object r -- result (a [cached/shared] mpz) + -- (nb: modifying result will mess up cache) + if n<=0 then return mpz_init(1) end if + if n<=length(c2cache) then + r = c2cache[n] + if r!=0 then return r end if + else + c2cache &= repeat(0,n-length(c2cache)) + end if + r = mpz_init(0) + mpz t = mpz_init() + for i=0 to n-1 do + mpz_mul(t,catalan2m(i),catalan2m(n-1-i)) + mpz_add(r,r,t) + end for + t = mpz_free(t) + c2cache[n] = r + return r +end function - sequence s = {} - for i=0 to 15 do s = append(s,mpz_get_str(catalan2m(i))) end for - printf(1,"0..15: %s\n",join(s,",")) - printf(1,"100: %s\n",{mpz_get_str(catalan2m(100))}) - int32) is native($glutlib) {*} + +# OpenGL Bindings +constant $gllib = 'GL'; +sub glClear(int32) is native($gllib) {*} +sub glClearColor(num32, num32, num32, num32) is native($gllib) {*} +sub glClearDepth(num64) is native($gllib) {*} +sub glEnable(int32) is native($gllib) {*} +sub glDisable(int32) is native($gllib) {*} +sub glViewport(int32, int32, int32, int32) is native($gllib) {*} +sub glMatrixMode(int32) is native($gllib) {*} +sub glLoadIdentity() is native($gllib) {*} +sub glBegin(int32) is native($gllib) {*} +sub glEnd() is native($gllib) {*} +sub glVertex3f(num32, num32, num32) is native($gllib) {*} +sub glVertex3fv(CArray[num32]) is native($gllib) {*} +sub glNormal3fv(CArray[num32]) is native($gllib) {*} +sub glColor3f(num32, num32, num32) is native($gllib) {*} +sub glPushAttrib(int32) is native($gllib) {*} +sub glPopAttrib() is native($gllib) {*} +sub glMaterialfv(int32, int32, CArray[num32]) is native($gllib) {*} +sub glLightfv(int32, int32, CArray[num32]) is native($gllib) {*} +sub glPolygonMode(int32, int32) is native($gllib) {*} +sub glFrustum(num64, num64, num64, num64, num64, num64) is native($gllib) {*} +sub glTranslatef(num32, num32, num32) is native($gllib) {*} +sub glRotatef(num32, num32, num32, num32) is native($gllib) {*} +sub glScalef(num32, num32, num32) is native($gllib) {*} + +# Vector Math +class Vec3 { has num32 ($.x, $.y, $.z); + method new(num32 $x = 0e0, num32 $y = 0e0, num32 $z = 0e0) { + self.bless(:$x, :$y, :$z) + } + method copy() { Vec3.new: $!x, $!y, $!z } + method add(Vec3 $v) { Vec3.new: $!x + $v.x, $!y + $v.y, $!z + $v.z } + method sub(Vec3 $v) { Vec3.new: $!x - $v.x, $!y - $v.y, $!z - $v.z } + method mul(num32 $s) { Vec3.new: $!x * $s, $!y * $s, $!z * $s } + method dot(Vec3 $v) { $!x * $v.x + $!y * $v.y + $!z * $v.z } + method len() { sqrt(self.dot(self)).Num } + method normalize() { do given self { .len > 0 ?? .mul(1e0/.len) !! .copy } } + method cross(Vec3 $v) { + Vec3.new: $!y*$v.z - $!z*$v.y, $!z*$v.x - $!x*$v.z, $!x*$v.y - $!y*$v.x + } + method to-array() { CArray[num32].new: $!x, $!y, $!z } +} + +# Mesh Data Structures +class Vertex { + has (@.edges, @.faces) is rw; + has Vec3 ($.pos, $.newpos) is rw; + method new(Vec3 :$pos!) { self.bless(:$pos, newpos => $pos.copy) } +} + +class Face { + has @.verts is rw; + has Int $.fvert is rw; +} + +class Edge { has Int ($.v0, $.v1, $.f0, $.f1, $.evert) is rw } + +class Mesh { has (@.vertices, @.normals, @.faces); + method add-vertex(Vec3 $v) { @!vertices.push($v) } + method add-normal(Vec3 $n) { @!normals.push($n) } + method add-face(@verts) { @!faces.push: Face.new(:verts(@verts),:fvert(-1)) } + + method compute-normals() { + @!normals = Vec3.new xx @!vertices.elems; + for @!faces -> $face { + for ^$face.verts.elems -> \j { + my $v0=@!vertices[$face.verts[j]]; + my $v1=@!vertices[$face.verts[(j+1) % +$face.verts]]; + my $v2=@!vertices[$face.verts[(j+ +$face.verts-1) % +$face.verts]]; + given $v1.sub($v0).cross($v2.sub($v0)) { + @!normals[$face.verts[j]] .= add: $_ + } + } + } + $_ .= normalize for @!normals + } +} + +# Subdivision +class SubdivMesh { has (@.verts, @.faces, @.edges); + method find-edge(Int $v0, Int $v1) { + for @!verts[$v0].edges -> $ei { + my $e = @!edges[$ei]; + return $ei if $e.v0==$v0 && $e.v1==$v1 or $e.v0==$v1 && $e.v1==$v0 + } + return -1; + } + + method update-links() { + for @!verts { ( .faces, .edges ) = | [] xx 2 } + @!edges = []; + for @!faces.kv -> $fi, $face { + for ^$face.verts.elems -> $j { + @!verts[ my $v0 = $face.verts[$j] ].faces.push: $fi; + my $v1 = $face.verts[ ($j+1) % $face.verts.elems ]; + if ( my $ei = self.find-edge($v0, $v1) ) == -1 { + @!edges.push: Edge.new( :v0($v0), :v1($v1), + :f0($fi), :f1(-1), :evert(-1)); + given $ei=+@!edges-1 { @!verts[$_].edges.push($ei) for $v0,$v1 } + } else { + @!edges[$ei].f1 = $fi + } + } + } + } + + method subdivide() { + my ($V, $F, $E) = [ @!verts, @!faces, @!edges].map: *.elems; + for @!faces -> $face { # Create face vertices + my $p = Vec3.new; + for $face.verts -> $vi { $p .= add: @!verts[$vi].pos } + @!verts.push: Vertex.new(pos => $p.mul(1e0 / $face.verts.elems)); + $face.fvert = @!verts.elems - 1 + } + for @!edges -> $edge { # Create edge vertices + my $p = Vec3.new; + $p .= add(@!verts[$edge.v0].pos); + $p .= add(@!verts[$edge.v1].pos); + $p .= add(@!verts[@!faces[$edge.f0].fvert].pos); + $p .= add(@!verts[@!faces[$edge.f1].fvert].pos); + @!verts.push: Vertex.new(pos => $p.mul(0.25e0)); + $edge.evert = @!verts.elems - 1 + } + for ^$V -> $vi { # Update original vertices + my $n = (my $v = @!verts[$vi]).faces.elems; + my ($newp,$p1) = $v.pos.mul(($n-2e0)/$n), Vec3.new; + + for $v.faces -> $fi { $p1 .= add(@!verts[@!faces[$fi].fvert].pos) } + $newp .= add($p1.mul(1e0 / ($n * $n))); + my $p2 = Vec3.new; + for $v.edges -> $ei { + given @!edges[$ei] { $p2 .= add(@!verts[.v0==$vi??.v1!!.v0].pos) } + } + $v.newpos = $newp .= add($p2.mul(1e0 / ($n * $n))) + } + for ^$V -> $vi { @!verts[$vi].pos = @!verts[$vi].newpos.copy } + + @!faces = gather for @!faces -> $face { # Create new faces + for ^$face.verts.elems -> $j { + my $v0 = $face.verts[($j-1+$face.verts.elems) % $face.verts.elems]; + my $v = $face.verts[$j]; + my $v1 = $face.verts[($j + 1) % $face.verts.elems]; + my $e0 = @!edges[self.find-edge($v0, $v)]; + my $e1 = @!edges[self.find-edge($v, $v1)]; + take Face.new(:verts($e0.evert,$v,$e1.evert,$face.fvert),:fvert(-1)) + } + } + self.update-links(); + } + + method to-mesh() { + my $mesh = Mesh.new; + for @!verts -> $v { $mesh.add-vertex($v.pos) } + for @!faces -> $face { $mesh.add-face($face.verts) } + $mesh.compute-normals; + return $mesh + } +} + +sub load-cube() { # Load Cube OBJ + my $mesh = Mesh.new; + for (-1,-1,1,1,-1,1,-1,1,1,1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1).rotor(3) { + $mesh.add-vertex(Vec3.new: | ($_ X* 0.5e0)) # 8 Corner vertices + } + for [0,1,3,2], [2,3,5,4], [4,5,7,6], [6,7,1,0], [1,7,5,3], [6,0,2,4] { + $mesh.add-face: $_ # 6 Faces + } + $mesh.compute-normals; + return $mesh +} + +sub create-subdivision-levels(Mesh $base, Int $levels) { + my @meshes = $base; + my $sd = SubdivMesh.new; + + for $base.vertices -> $v { $sd.verts.push(Vertex.new(pos => $v)) } + for $base.faces -> $face { + $sd.faces.push(Face.new(verts => $face.verts, fvert => -1)) + } + $sd.update-links; + return @meshes.append: ^($levels - 1) .map: { + $sd.subdivide; + $sd.to-mesh + } +} + +sub render-mesh(Mesh $mesh) { + for $mesh.faces -> $face { + glBegin(GL_POLYGON); + for $face.verts -> $vi { + glNormal3fv($mesh.normals[$vi].to-array); + glVertex3fv($mesh.vertices[$vi].to-array); + } + glEnd + } +} + +sub draw-xyz() { # Draw XYZ Axis Lines + glPushAttrib(GL_LIGHTING_BIT +| GL_ENABLE_BIT); + glDisable(GL_LIGHTING); + glBegin(GL_LINES); + for (1e0,0e0,0e0), (0e0,1e0,0e0), (0e0,0e0,1e0) -> @color { # XYZ <-> RGB + glColor3f(|@color); + glVertex3f(0e0, 0e0, 0e0); + glVertex3f(|@color) + } + glEnd; + glPopAttrib +} + +# Global State +my ( $auto-phase, $auto-dir, $auto-level, $cur-level, $y-rot, $x-rot ) = + 0, 1, 0, 0, 0e0, 0e0 ; +my ($wireframe, @meshes) = False; + +sub display() { + glClear(GL_COLOR_BUFFER_BIT +| GL_DEPTH_BUFFER_BIT); + + # Setup projection + glMatrixMode(GL_PROJECTION); + glLoadIdentity; + my ( $fovy, $near, $far, $aspect ) = + 60e0, 0.1e0, 1000e0, WIN-WIDTH.Num / WIN-HEIGHT.Num ; + my $top = $near * tan($fovy * pi / 360e0); + glFrustum(-$top * $aspect, $top * $aspect, -$top, $top, $near, 1000e0); + + # Setup modelview + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; + + # Headlamp Lighting + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glLightfv(GL_LIGHT0, GL_DIFFUSE, CArray[num32].new(1e0, 1e0, 1e0, 1e0)); + glLightfv(GL_LIGHT0, GL_POSITION, CArray[num32].new(0e0, 0e0, 0e0, 1e0)); + + # Transformations + glTranslatef(0e0, 0e0, -5e0); # Move back from camera + glRotatef($x-rot, 1e0, 0e0, 0e0); # Rotate around X + glRotatef($y-rot, 0e0, 1e0, 0e0); # Rotate around Y + + # Scale Object + glScalef(OBJ-SCALE, OBJ-SCALE, OBJ-SCALE); + + # Render mesh + glPushAttrib(GL_LIGHTING_BIT +| GL_POLYGON_BIT); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, CArray[num32].new(1e0, 1e0, 1e0, 1e0)); + + if $wireframe { + glDisable(GL_LIGHTING); + glColor3f(0e0, 1e0, 0e0); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) + } + render-mesh(@meshes[$cur-level]); + glPopAttrib; + draw-xyz(); + glutSwapBuffers; +} + +sub reshape(int32 $w, int32 $h) { + glViewport(0, 0, $w, $h); + glClearDepth(1e0); + glClearColor(0e0, 0e0, 0e0, 0e0); + glEnable(GL_DEPTH_TEST) +} + +sub keyboard(uint8 $key, int32 $x, int32 $y) { + given $key.chr { when 'q' | 'Q' | "\x1b" { exit(0) } } # q, Q, or Esc +} + +sub auto-step() { + return unless @meshes.Bool; + ($wireframe, $cur-level) = ($auto-phase == 0), $auto-level; + + if $auto-dir > 0 { + $auto-level >= @meshes.elems - 1 ?? ( $auto-dir = -1 ) !! $auto-level++ + } else { + $auto-level <= 0 ?? (($auto-phase,$auto-dir) = ($auto-phase + 1) % 2, 1) + !! $auto-level-- + } +} + +sub idle() { + state ($last-ms, $last-auto-ms) = -1, -1; + my $now = glutGet(GLUT_ELAPSED_TIME); + if $last-ms < 0 { ($last-ms, $last-auto-ms) = $now xx 2 } + + given my $dt = ($now - $last-ms) / 1000e0 { + $last-ms = $now; + $y-rot += 35e0 * $dt; + $x-rot = 15e0 * sin($now * X-ROT-FREQ); + } + if ($now - $last-auto-ms) >= 500 { + auto-step(); + $last-auto-ms = $now; + } + glutPostRedisplay +} + +# Main +glutInit(CArray[uint32].new, CArray[Str].new); +glutInitDisplayMode(0x0000 +| 0x0002 +| 0x0010); +glutInitWindowSize(WIN-WIDTH, WIN-HEIGHT); +glutCreateWindow("Catmull-Clark (Raku)"); +glutReshapeFunc(&reshape); +glutDisplayFunc(&display); +glutKeyboardFunc(&keyboard); +glutIdleFunc(&idle); + +say "Generating meshes..."; +@meshes = create-subdivision-levels(load-cube(), 5); +say "Starting loop.\nPress , or to quit."; + +glutMainLoop; diff --git a/Task/Catmull-Clark-subdivision-surface/Rust/catmull-clark-subdivision-surface.rust b/Task/Catmull-Clark-subdivision-surface/Rust/catmull-clark-subdivision-surface.rs similarity index 100% rename from Task/Catmull-Clark-subdivision-surface/Rust/catmull-clark-subdivision-surface.rust rename to Task/Catmull-Clark-subdivision-surface/Rust/catmull-clark-subdivision-surface.rs diff --git a/Task/Catmull-Clark-subdivision-surface/Wren/catmull-clark-subdivision-surface.wren b/Task/Catmull-Clark-subdivision-surface/Wren/catmull-clark-subdivision-surface.wren index b96526a682..79c0966aee 100644 --- a/Task/Catmull-Clark-subdivision-surface/Wren/catmull-clark-subdivision-surface.wren +++ b/Task/Catmull-Clark-subdivision-surface/Wren/catmull-clark-subdivision-surface.wren @@ -1,7 +1,7 @@ -import "/dynamic" for Tuple, Struct -import "/sort" for Sort -import "/math" for Int -import "/fmt" for Fmt +import "./dynamic" for Tuple, Struct +import "./sort" for Sort +import "./math" for Int +import "./fmt" for Fmt var Point = Tuple.create("Point", ["x", "y", "z"]) var fields = [ diff --git a/Task/Chaocipher/00-TASK.txt b/Task/Chaocipher/00-TASK.txt index 8c2723b21f..d328256b71 100644 --- a/Task/Chaocipher/00-TASK.txt +++ b/Task/Chaocipher/00-TASK.txt @@ -1,7 +1,7 @@ ;Description: The [[wp:Chaocipher|Chaocipher]] was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. -The algorithm is described in [http://www.mountainvistasoft.com/chaocipher/ActualChaocipher/Chaocipher-Revealed-Algorithm.pdf this paper] by M.Rubin in 2010 and there is a C# implementation [https://www.c-sharpcorner.com/UploadFile/b942f9/implementing-the-chaocipher-in-C-Sharp/ here]. +The algorithm is described in [http://www.chaocipher.com/ActualChaocipher/Chaocipher-Revealed-Algorithm.pdf this paper] by M.Rubin in 2010 and there is a C# implementation [https://www.c-sharpcorner.com/UploadFile/b942f9/implementing-the-chaocipher-in-C-Sharp/ here]. ;Task: diff --git a/Task/Chaocipher/ALGOL-68/chaocipher.alg b/Task/Chaocipher/ALGOL-68/chaocipher.alg new file mode 100644 index 0000000000..ceaedc0ca8 --- /dev/null +++ b/Task/Chaocipher/ALGOL-68/chaocipher.alg @@ -0,0 +1,75 @@ +BEGIN # Chaocipher, translated from the Kotlin with permutations as in Ada # + + STRING lalphabet = "HXUCZVAMDSLKPEFJRIGTWOBNYQ"; + STRING ralphabet = "PTLNBQDEOYSFAVZKGJRIHWXUMC"; + + PROC chaocipher = ( STRING text in, BOOL encrypt, show steps )STRING: + BEGIN + STRING left := lalphabet[ AT 1 ]; + STRING right := ralphabet[ AT 1 ]; + STRING text = text in [ AT 1 ]; + OP LENGTH = ( STRING s )INT: UPB s - LWB s + 1; + [ 1 : LENGTH text ]CHAR e text; + [ 1 : LENGTH left ]CHAR temp; + + FOR i TO UPB text DO + IF show steps THEN print( ( left, " ", right, newline ) ) FI; + INT index; + IF encrypt THEN + VOID( char in string( text[ i ], index, right ) ); + e text[ i ] := IF index >= LWB left AND index <= UPB left + THEN left[ index ] + ELSE "?" + FI + ELSE + VOID( char in string( text[ i ], index, left ) ); + e text[ i ] := IF index >= LWB right AND index <= UPB right + THEN right[ index ] + ELSE "?" + FI + FI; + IF index > 1 THEN + CHAR store; + + # the permutations are performed using array slices # + # rather than explicit loops # + + # permute left # + + INT offset = 26 - index; + temp[ 1 : offset + 1 ] := left[ index : index + offset ]; + temp[ offset + 2 : 26 ] := left[ 1 : index - 1 ]; + store := temp[ 2 ]; + + temp[ 2 : 13 ] := temp[ 3 : 14 ]; + temp[ 14 ] := store; + left := temp; + + # permute right # + + temp[ 1 : offset + 1 ] := right[ index : index + offset ]; + temp[ offset + 2 : 26 ] := right[ 1 : index - 1 ]; + store := temp[ 1 ]; + + temp[ 1 : 25 ] := temp[ 2 : 26 ]; + temp[ 26 ] := store; + store := temp[ 3 ]; + + temp[ 3 : 13 ] := temp[ 4 : 14 ]; + temp[ 14 ] := store; + right := temp + FI + OD; + e text + END # chaocipher # ; + + STRING plaintext = "WELLDONEISBETTERTHANWELLSAID"; + print( ( "The original plaintext is : ", plaintext, newline ) ); + print( ( newline, "The left and right alphabets after each permutation" ) ); + print( ( " during encryption are :", newline, newline ) ); + STRING ciphertext = chaocipher( plaintext, TRUE, TRUE ); + print( ( newline, "The ciphertext is : ", ciphertext, newline ) ); + STRING plaintext2 = chaocipher( ciphertext, FALSE, FALSE ); + print( ( newline, "The recovered plaintext is : ", plaintext2 ) ); + print( ( " ", IF plaintext = plaintext2 THEN "" ELSE "NOT " FI, "as expected", newline ) ) +END diff --git a/Task/Chaocipher/Ada/chaocipher.ada b/Task/Chaocipher/Ada/chaocipher.adb similarity index 100% rename from Task/Chaocipher/Ada/chaocipher.ada rename to Task/Chaocipher/Ada/chaocipher.adb diff --git a/Task/Chaocipher/Crystal/chaocipher.cr b/Task/Chaocipher/Crystal/chaocipher.cr new file mode 100644 index 0000000000..452e1edf99 --- /dev/null +++ b/Task/Chaocipher/Crystal/chaocipher.cr @@ -0,0 +1,40 @@ +enum Chaoperation + Encode + Decode +end + +class Array + # useful method to work on parts of the array + def slice (start, length) + start = size - start if start < 0 + raise "Out of bounds" unless start >= 0 && length >= 0 && start + length <= size + Slice.new(to_unsafe + start, length) + end +end + +def chaocipher (message : String, left : String, right : String, + op : Chaoperation = Chaoperation::Encode) + ct = left.chars + pt = right.chars + String.build do |s| + message.each_char do |ch| + idx = (op == Chaoperation::Encode ? pt : ct).index! ch + s << (op == Chaoperation::Encode ? ct : pt)[idx] + # permute left + ct.rotate! idx + ct.slice(1, 13).rotate! 1 + # permute right + pt.rotate! idx+1 + pt.slice(2, 12).rotate! 1 + end + end +end + +left = "HXUCZVAMDSLKPEFJRIGTWOBNYQ" +right = "PTLNBQDEOYSFAVZKGJRIHWXUMC" +message = "WELLDONEISBETTERTHANWELLSAID" + +encoded = chaocipher(message, left, right) +decoded = chaocipher(encoded, left, right, Chaoperation::Decode) + +print message, " -> ", encoded, " -> ", decoded, "\n" diff --git a/Task/Chaocipher/Delphi/chaocipher.delphi b/Task/Chaocipher/Delphi/chaocipher.pas similarity index 100% rename from Task/Chaocipher/Delphi/chaocipher.delphi rename to Task/Chaocipher/Delphi/chaocipher.pas diff --git a/Task/Chaocipher/EMal/chaocipher.emal b/Task/Chaocipher/EMal/chaocipher.emal index 5409bcda5d..968427b1f1 100644 --- a/Task/Chaocipher/EMal/chaocipher.emal +++ b/Task/Chaocipher/EMal/chaocipher.emal @@ -3,49 +3,49 @@ enum int ENCRYPT, DECRYPT end type Chaocipher -text L_ALPHABET = "HXUCZVAMDSLKPEFJRIGTWOBNYQ" -text R_ALPHABET = "PTLNBQDEOYSFAVZKGJRIHWXUMC" -fun exec = text by text value, Chaocipher:Mode mode, logic showSteps +text L_ALPHABET ← "HXUCZVAMDSLKPEFJRIGTWOBNYQ" +text R_ALPHABET ← "PTLNBQDEOYSFAVZKGJRIHWXUMC" +fun exec ← text by text value, Chaocipher:Mode mode, logic showSteps ^|since texts are mutable, we can operate directly on them without the need of Lists|^ - text left = *L_ALPHABET # by using the valueOf operator we are sure that the string is copied - text right = *R_ALPHABET - text eText = text(" ", value.length) - text temp = text(" ", 26) - for int i = 0; i < value.length; ++i + text left ← *L_ALPHABET # by using the valueOf operator we are sure that the string is copied + text right ← *R_ALPHABET + text eText ← text(" ", value.length) + text temp ← text(" ", 26) + for int i ← 0; i < value.length; ++i if showSteps do writeLine(left + " " + right) end - int index = 0 - if mode == Chaocipher:Mode.ENCRYPT - index = right.find(value[i]) - eText[i] = left[index] + int index ← 0 + if mode æ Chaocipher:Mode.ENCRYPT + index ← right.find(value[i]) + eText[i] ← left[index] else - index = left.find(value[i]) - eText[i] = right[index] + index ← left.find(value[i]) + eText[i] ← right[index] end - if i == value.length - 1 do break end + if i æ value.length - 1 do break end # permute left - for int j = index; j < 26; ++j do temp[j - index] = left[j] end - for int j = 0; j < index; ++j do temp[26 - index + j] = left[j] end - var store = temp[1] - for int j = 2; j < 14; ++j do temp[j - 1] = temp[j] end - temp[13] = store - left = *temp + for int j ← index; j < 26; ++j do temp[j - index] ← left[j] end + for int j ← 0; j < index; ++j do temp[26 - index + j] ← left[j] end + var store ← temp[1] + for int j ← 2; j < 14; ++j do temp[j - 1] ← temp[j] end + temp[13] ← store + left ← *temp # permute right - for int j = index; j < 26; ++j do temp[j - index] = right[j] end - for int j = 0; j < index; ++j do temp[26 - index + j] = right[j] end - store = temp[0] - for int j = 1; j < 26; ++j do temp[j - 1] = temp[j] end - temp[25] = store - store = temp[2] - for int j = 3; j < 14; ++j do temp[j - 1] = temp[j] end - temp[13] = store - right = *temp + for int j ← index; j < 26; ++j do temp[j - index] ← right[j] end + for int j ← 0; j < index; ++j do temp[26 - index + j] ← right[j] end + store ← temp[0] + for int j ← 1; j < 26; ++j do temp[j - 1] ← temp[j] end + temp[25] ← store + store ← temp[2] + for int j ← 3; j < 14; ++j do temp[j - 1] ← temp[j] end + temp[13] ← store + right ← *temp end return eText end -var plainText = "WELLDONEISBETTERTHANWELLSAID" -writeLine("The original plaintext is : " + plainText) -writeLine(EOL + "The left and right alphabets after each permutation during encryption are :" + EOL) -var cipherText = exec(plainText, Chaocipher:Mode.ENCRYPT, true) -writeLine(EOL + "The ciphertext is : " + cipherText) -var plainText2 = exec(cipherText, Chaocipher:Mode.DECRYPT, false) -writeLine(EOL + "The recovered plaintext is : " + plainText2) +var plainText ← "WELLDONEISBETTERTHANWELLSAID" +writeLine("The original plaintext is : ", plainText) +writeLine(EOL, "The left and right alphabets after each permutation during encryption are :", EOL) +var cipherText ← exec(plainText, Chaocipher:Mode.ENCRYPT, true) +writeLine(EOL, "The ciphertext is : ", cipherText) +var plainText2 ← exec(cipherText, Chaocipher:Mode.DECRYPT, false) +writeLine(EOL, "The recovered plaintext is : ", plainText2) diff --git a/Task/Chaocipher/EasyLang/chaocipher.easy b/Task/Chaocipher/EasyLang/chaocipher.easy new file mode 100644 index 0000000000..f2eb029db7 --- /dev/null +++ b/Task/Chaocipher/EasyLang/chaocipher.easy @@ -0,0 +1,64 @@ +func index a$[] c$ . + for ind = 1 to len a$[] + if a$[ind] = c$ : return ind + . + return 0 +. +left$ = "HXUCZVAMDSLKPEFJRIGTWOBNYQ" +right$ = "PTLNBQDEOYSFAVZKGJRIHWXUMC" +# +func$ chao txt$ mode . + left$[] = strchars left$ + right$[] = strchars right$ + len tmp$[] 26 + for c$ in strchars txt$ + if mode = 1 + ind = index right$[] c$ + if ind = 0 : return "" + r$ &= left$[ind] + else + ind = index left$[] c$ + if ind = 0 + print c$ + return "" + . + r$ &= right$[ind] + . + # permute left + for j = ind to 26 + tmp$[j - ind + 1] = left$[j] + . + for j = 1 to ind - 1 + tmp$[26 - ind + j + 1] = left$[j] + . + h$ = tmp$[2] + for j = 3 to 14 + tmp$[j - 1] = tmp$[j] + . + tmp$[14] = h$ + swap tmp$[] left$[] + # + # permute right + for j = ind to 26 + tmp$[j - ind + 1] = right$[j] + . + for j = 1 to ind - 1 + tmp$[26 - ind + j + 1] = right$[j] + . + h$ = tmp$[1] + for j = 2 to 26 + tmp$[j - 1] = tmp$[j] + . + tmp$[26] = h$ + h$ = tmp$[3] + for j = 4 to 14 + tmp$[j - 1] = tmp$[j] + . + tmp$[14] = h$ + swap tmp$[] right$[] + . + return r$ +. +h$ = chao "WELLDONEISBETTERTHANWELLSAID" 1 +print h$ +print chao h$ 2 diff --git a/Task/Chaocipher/Forth/chaocipher.fth b/Task/Chaocipher/Forth/chaocipher.fth new file mode 100644 index 0000000000..630e902613 --- /dev/null +++ b/Task/Chaocipher/Forth/chaocipher.fth @@ -0,0 +1,77 @@ + \ triple words +: 3drop drop drop drop ; ( n1 n2 n3 ---) +: 3dup >r over over r@ rot rot r> ; ( n1 n2 n3 -- n1 n2 n3 n1 n2 n3) + \ ASCIIZ string words +: zstring create chars allot ; ( a1 -- a1 n1) +: zcount dup begin dup c@ while char+ repeat over - ; +: zplace over chars over + >r swap cmove 0 r> c! ; +: +zplace zcount chars + zplace ; ( a1 n1 a2 --) + \ find character in string +: where? ( c a1 n1 -- n2) + 0 ?do over over i chars + c@ = if drop i negate leave then loop nip negate ; + +64 constant /str \ size of input/output string +27 constant /alpha \ size of alphabet + +/str zstring {i} \ input string +/str zstring {o} \ output string + +/alpha zstring l \ left alphabet +/alpha zstring r \ right alphabet +/alpha zstring t \ temporary alphabet + +: [] chars + ; ( a n -- a+n) +: .tab 9 emit ; ( --) +: .list cr .tab zcount type cr ; ( a --) + +: PermuteLeft ( index --) + 26 over ?do t over negate i + [] l i [] c@ swap c! loop + dup 0 ?do t over negate 26 i + + [] l i [] c@ swap c! loop drop + t char+ c@ >r t 2 [] dup char- 12 cmove r> t 13 [] c! t zcount l zplace +; + +: PermuteRight ( index --) + 26 over ?do t over negate i + [] r i [] c@ swap c! loop + dup 0 ?do t over negate 26 i + + [] r i [] c@ swap c! loop drop + t c@ >r t char+ dup char- 25 cmove r> t 25 [] c! + t 2 [] c@ >r t 3 [] dup char- 11 cmove r> t 13 [] c! t zcount r zplace +; + +: Encrypt ( input output index1 -- index2) + >r swap r@ [] c@ r /alpha where? dup 0< abort" Corrupt right alphabet" + l over [] c@ rot r> [] c! +; + +: Decrypt ( input output index1 -- index2) + >r swap r@ [] c@ l /alpha where? dup 0< abort" Corrupt left alphabet" + r over [] c@ rot r> [] c! +; + +: chao ( i o xt f --) + s" HXUCZVAMDSLKPEFJRIGTWOBNYQ" l zplace + s" PTLNBQDEOYSFAVZKGJRIHWXUMC" r zplace + t /alpha erase >r \ erase temporary string + ( i o xt R: f) + r@ if cr ." The left and right alphabets after each permutation:" cr then + >r over r> swap zcount 1- nip >r ( i o xt R: f len) + + 0 begin ( i o xt 0 R: f len) + r> r@ if l zcount type 2 spaces r zcount type cr then >r + >r 3dup r@ swap execute r> dup r@ < + while ( i o xt 0 R: f len) + >r dup PermuteLeft PermuteRight r> 1+ + repeat rdrop rdrop drop drop 3drop +; + +: main + s" WELLDONEISBETTERTHANWELLSAID" {i} zplace + {o} /str erase \ initialize output string + + ." The original plaintext is :" {i} .list + {i} {o} ['] Encrypt true chao + cr ." The ciphertext is :" {o} .list + {o} {i} ['] Decrypt false chao + cr ." The recovered plaintext is :" {i} .list +; + +main diff --git a/Task/Chaocipher/Fortran/chaocipher.f b/Task/Chaocipher/Fortran/chaocipher.f new file mode 100644 index 0000000000..ef2f081da9 --- /dev/null +++ b/Task/Chaocipher/Fortran/chaocipher.f @@ -0,0 +1,190 @@ +! +!This program implements the **Chaocipher encryption algorithm** in FORTRAN, extended to handle all printable ASCII characters (32-127). +! The Chaocipher is a polyalphabetic cipher invented by John F. Byrne in 1918, which dynamically permutes two alphabets after +! processing each character, making it highly secure and resistant to cryptanalysis. +! +!#### Key Features: +!1. **Initialization**: +! - Two alphabets (`left` and `right`) are initialized with shuffled ASCII characters (32-127). +! - The `plaintext` is set to "WELLDONEISBETTERTHANWELLSAID". +! +!2. **Enciphering**: +! - For each character in the plaintext: +! - Locate the character in the `right` alphabet. +! - Find the corresponding ciphertext character in the `left` alphabet. +! - Permute both alphabets based on the Chaocipher rules: +! - The `left` alphabet is rotated to bring the ciphertext character to the top, and a specific character is moved to a new position. +! - The `right` alphabet is similarly rotated, with an additional rotation step. +! +!3. **Deciphering**: +! - The ciphertext is decrypted back into plaintext using the reverse process: +! - Locate the ciphertext character in the `left` alphabet. +! - Find the corresponding plaintext character in the `right` alphabet. +! - Permute both alphabets identically as in enciphering. +! +!4. **Verification**: +! - After enciphering and deciphering, the program compares the original plaintext with the decrypted text to ensure correctness. +! +!#### Output: +!The program prints: +!- Initial left and right alphabets. +!- Enciphered ciphertext. +!- Deciphered plaintext. +!- A success message if decryption matches the original plaintext. +! +!#### Example Execution: +!For input plaintext "WELLDONEISBETTERTHANWELLSAID", the program outputs: +!- Ciphertext: `OAHQHCNYNXTSZJRRHJBYHQKSOUJY` +!- Decrypted Text: `WELLDONEISBETTERTHANWELLSAID` +!- Verification: "Decryption successful: plaintext matches decrypted text." +! +!This implementation demonstrates both encryption and decryption processes while adhering to Chaocipher's dynamic permutation rules, +!extended for modern ASCII characters. +! +! +PROGRAM Chaocipher + IMPLICIT NONE + CHARACTER(LEN=96) :: left, right, left_orig, right_orig + CHARACTER(LEN=1000) :: plaintext, ciphertext, decrypted + INTEGER :: i, len, ascii_start + LOGICAL :: trace + + ! Initialize alphabets and input + CALL initialize_alphabets(left, right) + left_orig = left + right_orig = right + plaintext = 'Well, when I was in Egypt, I had a conversation with the Sphinx! She taught me how to sew.' + ciphertext = '' + decrypted = '' + trace = .FALSE. + ascii_start = 32 ! ASCII start at space character + + len = LEN_TRIM(plaintext) + + PRINT *, 'Initial Left: ', left + PRINT *, 'Initial Right:', right + PRINT *, 'Plaintext: ', TRIM(plaintext) + + ! Encipher + DO i = 1, len + CALL encipher(plaintext(i:i), ciphertext(i:i), left, right, ascii_start) + IF (trace) THEN + PRINT *, 'Step ', i + PRINT *, 'Left: ', left + PRINT *, 'Right: ', right + END IF + END DO + + PRINT *, 'Ciphertext: ', TRIM(ciphertext) + + ! Reset alphabets for deciphering + left = left_orig + right = right_orig + + ! Decipher + DO i = 1, len + CALL decipher(ciphertext(i:i), decrypted(i:i), left, right, ascii_start) + END DO + + PRINT *, 'Decrypted: ', TRIM(decrypted) + + ! Check for correctness + IF (plaintext == decrypted) THEN + PRINT *, 'Decryption successful: plaintext matches decrypted text' + ELSE + PRINT *, 'Decryption failed: plaintext does not match decrypted text' + END IF + +CONTAINS + + SUBROUTINE initialize_alphabets(left, right) + CHARACTER(LEN=96), INTENT(OUT) :: left, right + INTEGER :: i, j + CHARACTER :: temp + REAL :: r + + ! Initialize alphabets with ASCII characters 32-127 + DO i = 1, 96 + left(i:i) = CHAR(i + 31) + right(i:i) = CHAR(i + 31) + END DO + + ! Fisher-Yates shuffle for left alphabet + DO i = 96, 2, -1 + CALL RANDOM_NUMBER(r) + j = 1 + FLOOR(i * r) + temp = left(i:i) + left(i:i) = left(j:j) + left(j:j) = temp + END DO + + ! Fisher-Yates shuffle for right alphabet + DO i = 96, 2, -1 + CALL RANDOM_NUMBER(r) + j = 1 + FLOOR(i * r) + temp = right(i:i) + right(i:i) = right(j:j) + right(j:j) = temp + END DO +END SUBROUTINE initialize_alphabets + + SUBROUTINE encipher(p, c, left, right, ascii_start) + CHARACTER(LEN=1), INTENT(IN) :: p + CHARACTER(LEN=1), INTENT(OUT) :: c + CHARACTER(LEN=96), INTENT(INOUT) :: left, right + INTEGER, INTENT(IN) :: ascii_start + INTEGER :: pos + + pos = INDEX(right, p) + c = left(pos:pos) + + CALL permute_left(left, c, ascii_start) + CALL permute_right(right, p, ascii_start) + END SUBROUTINE encipher + + SUBROUTINE decipher(c, p, left, right, ascii_start) + CHARACTER(LEN=1), INTENT(IN) :: c + CHARACTER(LEN=1), INTENT(OUT) :: p + CHARACTER(LEN=96), INTENT(INOUT) :: left, right + INTEGER, INTENT(IN) :: ascii_start + INTEGER :: pos + + pos = INDEX(left, c) + p = right(pos:pos) + + CALL permute_left(left, c, ascii_start) + CALL permute_right(right, p, ascii_start) + END SUBROUTINE decipher + + SUBROUTINE permute_left(alphabet, pivot, ascii_start) + CHARACTER(LEN=96), INTENT(INOUT) :: alphabet + CHARACTER(LEN=1), INTENT(IN) :: pivot + INTEGER, INTENT(IN) :: ascii_start + INTEGER :: pos + CHARACTER(LEN=1) :: temp + + pos = INDEX(alphabet, pivot) + alphabet = alphabet(pos:) // alphabet(:pos-1) + + temp = alphabet(2:2) + alphabet(2:49) = alphabet(3:50) + alphabet(50:50) = temp + END SUBROUTINE permute_left + + SUBROUTINE permute_right(alphabet, pivot, ascii_start) + CHARACTER(LEN=96), INTENT(INOUT) :: alphabet + CHARACTER(LEN=1), INTENT(IN) :: pivot + INTEGER, INTENT(IN) :: ascii_start + INTEGER :: pos + CHARACTER(LEN=1) :: temp + + pos = INDEX(alphabet, pivot) + alphabet = alphabet(pos:) // alphabet(:pos-1) + alphabet = alphabet(2:) // alphabet(1:1) + + temp = alphabet(3:3) + alphabet(3:49) = alphabet(4:50) + alphabet(50:50) = temp + END SUBROUTINE permute_right + +END PROGRAM Chaocipher diff --git a/Task/Chaocipher/Jq/chaocipher.jq b/Task/Chaocipher/Jq/chaocipher.jq new file mode 100644 index 0000000000..8035df93a1 --- /dev/null +++ b/Task/Chaocipher/Jq/chaocipher.jq @@ -0,0 +1,58 @@ +# If using jaq, then see remark above regarding `inform/1` +# Convenience function for emitting progress messages: +def inform(msg): + (msg | tostring | stderr | empty), .; + +# $encrypt should be one of true (for encryption) or false (for decryption) +def Chao($encrypt; $showSteps): + . as $text + | length as $len + | if any(explode[]; . > 128) + then "Text contains non-ASCII characters." | error + else {left: "HXUCZVAMDSLKPEFJRIGTWOBNYQ", + right: "PTLNBQDEOYSFAVZKGJRIHWXUMC", + eText: "", + temp: [range(0;26) | ""] + } + | reduce range(0; $len) as $i (.; + if $showSteps then inform("\(.left) \(.right)\n") end + + | if $encrypt + then .index = (.left|index($text[$i:$i+1])) + | .eText += .right[.index:.index+1] + else .index = (.right|index($text[$i:$i+1])) + | .eText += .left[.index:.index+1] + end + + | if $i == $len - 1 then . + else # permute left + reduce range(.index; 26) as $j (.; .temp[$j-.index] = .left[$j:$j+1]) + | reduce range(0; .index) as $j (.; .temp[26-.index+$j] = .left[$j:$j+1]) + | .store = .temp[1] + | reduce range(2; 14) as $j (.; .temp[$j-1] = .temp[$j]) + | .temp[13] = .store + | .left = (.temp | join("")) + + # permute right + | reduce range(.index; 26) as $j (.; .temp[$j-.index] = .right[$j:$j+1]) + | reduce range(0; .index) as $j (.; .temp[26-.index+$j] = .right[$j:$j+1]) + | .store = .temp[0] + | reduce range(1; 26) as $j (.; .temp[$j-1] = .temp[$j]) + | .temp[25] = .store + | .store = .temp[2] + | reduce range(3; 14) as $j (.; .temp[$j-1] = .temp[$j]) + | .temp[13] = .store + | .right = (.temp | join("")) + end ) + | .eText + end ; + +# Input: plaintext +def task: + "The original plaintext is : \(.)", + "The left and right alphabets after each permutation during encryption are:", + (Chao(true; true) + | "The ciphertext is : \(.)", + "The recovered plaintext is : \(Chao(false; false))" ); + +"WELLDONEISBETTERTHANWELLSAID" | task diff --git a/Task/Chaocipher/Julia/chaocipher.julia b/Task/Chaocipher/Julia/chaocipher.jl similarity index 100% rename from Task/Chaocipher/Julia/chaocipher.julia rename to Task/Chaocipher/Julia/chaocipher.jl diff --git a/Task/Chaocipher/Kotlin/chaocipher.kotlin b/Task/Chaocipher/Kotlin/chaocipher.kts similarity index 100% rename from Task/Chaocipher/Kotlin/chaocipher.kotlin rename to Task/Chaocipher/Kotlin/chaocipher.kts diff --git a/Task/Chaocipher/Pluto/chaocipher.pluto b/Task/Chaocipher/Pluto/chaocipher.pluto new file mode 100644 index 0000000000..92add48042 --- /dev/null +++ b/Task/Chaocipher/Pluto/chaocipher.pluto @@ -0,0 +1,55 @@ +require "table2" + +enum chao begin + encrypt, + decrypt +end + +local function exec(text, mode, show_steps) + local len = #text + local left = "HXUCZVAMDSLKPEFJRIGTWOBNYQ" + local right = "PTLNBQDEOYSFAVZKGJRIHWXUMC" + local etext = table.rep(len, 0) + local temp = table.rep(26, "") + for i = 1, len do + if show_steps then print($"{left} {right}") end + local index + if mode == chao.encrypt then + index = right:find(text[i], 1, true) + etext[i] = left[index] + else + index = left:find(text[i], 1, true) + etext[i] = right[index] + end + if i == len then break end + + -- Permute left. + for j = index, 26 do temp[j - index + 1] = left[j] end + for j = 1, index - 1 do temp[27 - index + j] = left[j] end + local store = temp[2] + for j = 3, 14 do temp[j - 1] = temp[j] end + temp[14] = store + left = temp:concat("") + + -- Permute right. + for j = index, 26 do temp[j - index + 1] = right[j] end + for j = 1, index - 1 do temp[27 - index + j] = right[j] end + store = temp[1] + for j = 2, 26 do temp[j - 1] = temp[j] end + temp[26] = store + store = temp[3] + for j = 4, 14 do temp[j - 1] = temp[j] end + temp[14] = store + right = temp:concat("") + end + return etext:concat("") +end + +local plain_text = "WELLDONEISBETTERTHANWELLSAID" +print($"The original plaintext is : {plain_text}") +io.write("\nThe left and right alphabets after each permutation ") +print("during encryption are :\n") +local cipher_text = exec(plain_text, chao.encrypt, true) +print($"\nThe ciphertext is : {cipher_text}") +local plain_text2 = exec(cipher_text, chao.decrypt, false) +print($"\nThe recovered plaintext is : {plain_text2}") diff --git a/Task/Chaocipher/Rust/chaocipher.rust b/Task/Chaocipher/Rust/chaocipher.rs similarity index 100% rename from Task/Chaocipher/Rust/chaocipher.rust rename to Task/Chaocipher/Rust/chaocipher.rs diff --git a/Task/Chaocipher/Swift/chaocipher.swift b/Task/Chaocipher/Swift/chaocipher.swift new file mode 100644 index 0000000000..ae0cc62b27 --- /dev/null +++ b/Task/Chaocipher/Swift/chaocipher.swift @@ -0,0 +1,84 @@ +enum Mode { + case encrypt + case decrypt +} + +class Chaocipher { + private static let L_ALPHABET = "HXUCZVAMDSLKPEFJRIGTWOBNYQ" + private static let R_ALPHABET = "PTLNBQDEOYSFAVZKGJRIHWXUMC" + + private static func indexOf(array: [Character], char: Character) -> Int { + for i in 0.. String { + var left = Array(L_ALPHABET) + var right = Array(R_ALPHABET) + var eText = [Character](repeating: " ", count: text.count) + var temp = [Character](repeating: " ", count: 26) + + let textChars = Array(text) + + for i in 0.. String { + return exec(text: text, mode: .encrypt, showSteps: showSteps) + } + + static func decrypt(text: String, showSteps: Bool = false) -> String { + return exec(text: text, mode: .decrypt, showSteps: showSteps) + } +} + +// Main program +let plainText = "WELLDONEISBETTERTHANWELLSAID" +print("The original plaintext is : \(plainText)") +print("\nThe left and right alphabets after each permutation during encryption are:") +let cipherText = Chaocipher.encrypt(text: plainText, showSteps: true) +print("\nThe cipher text is : \(cipherText)") +let plainText2 = Chaocipher.decrypt(text: cipherText) +print("\nThe recovered plaintext is : \(plainText2)") diff --git a/Task/Chaocipher/Tcl/chaocipher.tcl b/Task/Chaocipher/Tcl/chaocipher.tcl new file mode 100644 index 0000000000..a0fc593619 --- /dev/null +++ b/Task/Chaocipher/Tcl/chaocipher.tcl @@ -0,0 +1,160 @@ +#!/usr/bin/env tclsh + +# Tcl implementation of Chaocipher +# (John F. Byrne, 1918) +# +# from paper "CHAOCIPHER REVEALED: THE ALGORITHM" +# (Moshe Rubin, 2010) +# http://www.mountainvistasoft.com/chaocipher/ActualChaocipher/Chaocipher-Revealed-Algorithm.pdf +# + +# ============ globals "wheels" ============ +variable l_key {HXUCZVAMDSLKPEFJRIGTWOBNYQ} +variable r_key {PTLNBQDEOYSFAVZKGJRIHWXUMC} + + + +# ============ procedures ================== + + +# swap range of n letters from end to front +proc permute {alpha n } { + + set A [string range $alpha 0 $n-1 ] + set B [string range $alpha $n end ] + + return "${B}${A}" +} + + +# rotate based on key in right alphabet +# (permute each by same amnount) +proc rotate { left right key } { + + set idx [string first $key $right] + + set L [permute $left $idx ] + + set R [permute $right $idx] + + return [list $L $R] +} + + +# split and rearrange each alphabet +# according to recipe +proc cycle { left right } { + + # (0)(2-13)(1)(14-25) + set l1 [string index $left 0 ] + set l2 [string range $left 2 13 ] + set l3 [string index $left 1 ] + set l4 [string range $left 14 end] + + set L [join [list $l1 $l2 $l3 $l4] ""] + + # (1-2)(4-14)(3)(15-25)(0) + set r1 [string range $right 1 2 ] + set r2 [string range $right 4 14 ] + set r3 [string index $right 3 ] + set r4 [string range $right 15 end] + set r5 [string index $right 0 ] + + set R [join [list $r1 $r2 $r3 $r4 $r5] ""] + + return [list $L $R] +} + + +# rotate wheels and generate cipher text or +# recover plain text +proc chao { input left right mode verbose } { + + set out {} + + set wheels {} + + set len [string length $input] + + if { $verbose } { + puts stdout "input\t$input\tLENGTH $len" + + set s [format "%-${len}s\t|\t%-${len}s" $left $right] + + puts stdout "keys:\t$s" + + puts stdout "\ncycled keys:" + } + + # string -> list + set input_list [split $input ""] + + set count 0 + # iterate each letter + foreach letter $input_list { + + incr count + + if {$mode eq "encrypt" } { + # encrypt + + # rotate and permute + set wheels [rotate $left $right $letter] + lassign $wheels left right + + # ciphered letter to output (left[0]) + lappend out [string index $left 0] + + } else { + + # decrypt + + # rotate and permute + set wheels [rotate $right $left $letter] + lassign $wheels right left + + # deciphered letter to output (right[0]) + lappend out [string index $right 0] + } + + # cycle the alphabets + set cycled [cycle $left $right] + lassign $cycled left right + + if {$verbose} { puts stderr "${count}\t${left}\t|\t${right}" } + + + } ; # foreach letter + + # list -> string + set out [join $out ""] + + return $out +} + + +# ============= main ================= +if { [info script] eq $::argv0 } { + + # --------- init ------------------ + set left $l_key + set right $r_key + set plain_text "WELLDONEISBETTERTHANWELLSAID" + + # ---------- encipher ------------- + + set cipher_text [chao $plain_text $left $right encrypt 1] + + # ---------- decipher ------------- + + set decrypted_text [chao $cipher_text $left $right decrypt 0] + # ----------- output -------------- + + puts stdout "\nplain text: \t ${plain_text}" + puts stdout "\ncipher text: \t ${cipher_text}" + puts stdout "\ndecrypted: \t ${decrypted_text}" + + return 0 +} + +# end diff --git a/Task/Chaos-game/Ada/chaos-game.adb b/Task/Chaos-game/Ada/chaos-game.adb new file mode 100644 index 0000000000..fe213c85fc --- /dev/null +++ b/Task/Chaos-game/Ada/chaos-game.adb @@ -0,0 +1,45 @@ +pragma Ada_2022; +with Ada.Numerics; use Ada.Numerics; +with Ada.Numerics.Discrete_Random; +with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions; +with Easy_Graphics; use Easy_Graphics; + +procedure Chaos_Game is + Img : Easy_Image := New_Image ((1, 1), (512, 512), WHITE); + + procedure Chaos (Image : in out Easy_Image; + Vertex_Count : Positive; + Radius : Float; + Iters : Positive) is + type Vertex_Array is array (1 .. Vertex_Count) of Point; + Vertices : Vertex_Array; + subtype Vertex_Range is Integer range 1 .. Vertex_Count; + package Rand_V is new Ada.Numerics.Discrete_Random (Vertex_Range); + use Rand_V; + Gen : Generator; + Half_X : constant Integer := X_Last (Image) / 2; + Half_Y : constant Integer := Y_Last (Image) / 2; + Half_Pi : constant Float := Float (Pi) / 2.0; + Two_Pi : constant Float := Float (Pi) * 2.0; + V : Integer; + X : Integer := Half_X; + Y : Integer := Half_Y; + begin + for V in 1 .. Vertex_Count loop + Vertices (V).X := Half_X + Integer (Float (Half_X) * + Cos (Half_Pi + (Float (V - 1)) * Two_Pi / Float (Vertex_Count))); + Vertices (V).Y := Half_Y - Integer (Float (Half_Y) * + Sin (Half_Pi + (Float (V - 1)) * Two_Pi / Float (Vertex_Count))); + end loop; + for I in 1 .. Iters loop + V := Random (Gen); + X := X + Integer (Radius * Float (Vertices (V).X - X)); + Y := Y + Integer (Radius * Float (Vertices (V).Y - Y)); + Plot (Image, (X, Y), BLACK); + end loop; + end Chaos; + +begin + Chaos (Img, 3, 0.5, 250_000); + Write_GIF (Img, "chaos_game.gif"); +end Chaos_Game; diff --git a/Task/Chaos-game/AmigaBASIC/chaos-game.basic b/Task/Chaos-game/AmigaBASIC/chaos-game.basic new file mode 100644 index 0000000000..637e89a1da --- /dev/null +++ b/Task/Chaos-game/AmigaBASIC/chaos-game.basic @@ -0,0 +1,28 @@ +DEFINT a-z +w=600:h=180:w2=300 +x=w*RND:y=h*RND + +FOR i=1 TO 32000 + v=2*RND+1 + ON v GOTO One, Two, Three + +One: + x=x/2 + y=y/2 + GOTO Draw + +Two: + x=w2+(w2-x)/2 + y=h-(h-y)/2 + GOTO Draw + +Three: + x=w-(w-x)/2 + y=y/2 + +Draw: + PSET (x,y),v +NEXT + +loop: + GOTO loop diff --git a/Task/Chaos-game/Atari-BASIC/chaos-game.basic b/Task/Chaos-game/Atari-BASIC/chaos-game.basic new file mode 100644 index 0000000000..b612f7a348 --- /dev/null +++ b/Task/Chaos-game/Atari-BASIC/chaos-game.basic @@ -0,0 +1,18 @@ +10 GRAPHICS 7+16 +20 W=159:H=95:W2=79 +30 X=INT(W*RND(0)) +40 Y=INT(H*RND(0)) +50 FOR I=1 TO 5000 +60 V=INT(3*RND(0))+1 +70 GOTO 100*V +100 X=X/2:Y=Y/2 +110 GOTO 500 +200 X=W2+(W2-X)/2 +210 Y=H-(H-Y)/2 +220 GOTO 500 +300 X=W-(W-X)/2 +310 Y=Y/2 +500 COLOR V +510 PLOT X,Y +520 NEXT I +530 GOTO 530 diff --git a/Task/Chaos-game/Delphi/chaos-game.delphi b/Task/Chaos-game/Delphi/chaos-game.pas similarity index 100% rename from Task/Chaos-game/Delphi/chaos-game.delphi rename to Task/Chaos-game/Delphi/chaos-game.pas diff --git a/Task/Chaos-game/EasyLang/chaos-game.easy b/Task/Chaos-game/EasyLang/chaos-game.easy index b0a7b03aae..ae10673f1b 100644 --- a/Task/Chaos-game/EasyLang/chaos-game.easy +++ b/Task/Chaos-game/EasyLang/chaos-game.easy @@ -1,12 +1,11 @@ -color 900 +gcolor 900 x[] = [ 0 100 50 ] -y[] = [ 7 7 93 ] +y[] = [ 14 14 100 ] x = randomf * 100 y = randomf * 100 for i = 1 to 100000 - move x y - rect 0.3 0.3 - h = random 3 - x = (x + x[h]) / 2 - y = (y + y[h]) / 2 + grect x y 0.3 0.3 + h = random 1 3 + x = (x + x[h]) / 2 + y = (y + y[h]) / 2 . diff --git a/Task/Chaos-game/Emacs-Lisp/chaos-game.l b/Task/Chaos-game/Emacs-Lisp/chaos-game.el similarity index 100% rename from Task/Chaos-game/Emacs-Lisp/chaos-game.l rename to Task/Chaos-game/Emacs-Lisp/chaos-game.el diff --git a/Task/Chaos-game/GW-BASIC/chaos-game.basic b/Task/Chaos-game/GW-BASIC/chaos-game.basic new file mode 100644 index 0000000000..73af477166 --- /dev/null +++ b/Task/Chaos-game/GW-BASIC/chaos-game.basic @@ -0,0 +1,19 @@ +100 REM Chaos game +110 CLS +120 SCREEN 7 '320x200 EGA Color +130 X = INT(RND(1) * 200) +140 Y = INT(RND(1) * 173) +150 FOR I=1 TO 20000 +160 V = INT(RND(1) * 3) + 1 +170 ON V GOTO 180,210,240 +180 X = X/2 +190 Y = Y/2 +200 GOTO 260 +210 X = 100 + (100-X)/2 +220 Y = 173 - (173-Y)/2 +230 GOTO 260 +240 X = 200 - (200-X)/2 +250 Y = Y/2 +260 PSET(X,Y),V +270 NEXT I +280 END diff --git a/Task/Chaos-game/IS-BASIC/chaos-game.basic b/Task/Chaos-game/IS-BASIC/chaos-game.basic new file mode 100644 index 0000000000..ab560fabbf --- /dev/null +++ b/Task/Chaos-game/IS-BASIC/chaos-game.basic @@ -0,0 +1,20 @@ +100 PROGRAM "ChaosGam.bas" +110 RANDOMIZE +120 GRAPHICS HIRES 4 +130 LET X=RND(800):LET Y=RND(600) +140 FOR I=1 TO 20000 +150 LET VERTEX=RND(3) +160 SELECT CASE VERTEX +170 CASE 0 +180 LET X=X/2 +190 LET Y=Y/2 +200 CASE 1 +210 LET X=400+(400-X)/2 +220 LET Y=600-(600-Y)/2 +230 CASE 2 +240 LET X=800-(800-X)/2 +250 LET Y=Y/2 +260 END SELECT +270 SET INK VERTEX+1 +280 PLOT X,Y +290 NEXT diff --git a/Task/Chaos-game/J/chaos-game.j b/Task/Chaos-game/J/chaos-game.j index bdf828c34e..bad0f35b60 100644 --- a/Task/Chaos-game/J/chaos-game.j +++ b/Task/Chaos-game/J/chaos-game.j @@ -1,33 +1,6 @@ -Note 'plan, Working in complex plane' - Make an equilateral triangle. - Make a list of N targets - Starting with a random point near the triangle, - iteratively generate new points. - plot the new points. - - j has a particularly rich notation for numbers. - - 1ad_90 specifies a complex number with radius 1 - at an angle of negative 90 degrees. - - 2p1 is 2 times (pi raised to the first power). -) - -N=: 3000 - require'plot' -TAU=: 2p1 NB. tauday.com -mean=: +/ % # - -NB. equilateral triangle with vertices on unit circle -NB. rotated for fun. -TRIANGLE=: *(j./2 1 o.(TAU%6)*?0)*1ad_90 1ad150 1ad30 - -TARGETS=: (N ?@:# 3) { TRIANGLE - -NB. start on unit circle -START=: j./2 1 o.TAU*?0 - -NEW_POINTS=: (mean@:(, {.) , ])/ TARGETS , START - -'marker'plot NEW_POINTS +NB. equilateral triangle with vertices on unit circle. rotated for fun. +Triangle=: *1ad_90 1ad150 1ad30*j./2 1 o.(2p1%6)*?0 +Targets=: (?3000#3) { Triangle +Start=: j./2 1 o.2p1*?0 NB. start on unit circle +'marker' plot ((+/%#)@(,{.) , ])/Targets,Start diff --git a/Task/Chaos-game/Julia/chaos-game.julia b/Task/Chaos-game/Julia/chaos-game.jl similarity index 100% rename from Task/Chaos-game/Julia/chaos-game.julia rename to Task/Chaos-game/Julia/chaos-game.jl diff --git a/Task/Chaos-game/Kotlin/chaos-game.kotlin b/Task/Chaos-game/Kotlin/chaos-game.kts similarity index 100% rename from Task/Chaos-game/Kotlin/chaos-game.kotlin rename to Task/Chaos-game/Kotlin/chaos-game.kts diff --git a/Task/Chaos-game/MSX-Basic/chaos-game.basic b/Task/Chaos-game/MSX-Basic/chaos-game.basic new file mode 100644 index 0000000000..f5d3c3748e --- /dev/null +++ b/Task/Chaos-game/MSX-Basic/chaos-game.basic @@ -0,0 +1,22 @@ +100 REM Chaos game +110 CLS +120 SCREEN 2 +130 X = INT(RND(1) * 256) +140 Y = INT(RND(1) * 192) +150 FOR I=1 TO 20000 +160 V = INT(RND(1) * 3) + 1 +170 ON V GOTO 180,220,260 +180 X = X/2 +190 Y = Y/2 +200 V = 8 'red +210 GOTO 290 +220 X = 128 + (128-X)/2 +230 Y = 192 - (192-Y)/2 +240 V = 3 'green +250 GOTO 290 +260 X = 256 - (256-X)/2 +270 Y = Y/2 +280 V = 7 'blue +290 PSET(X,Y),V +300 NEXT I +310 END diff --git a/Task/Chaos-game/Rust/chaos-game.rust b/Task/Chaos-game/Rust/chaos-game.rs similarity index 100% rename from Task/Chaos-game/Rust/chaos-game.rust rename to Task/Chaos-game/Rust/chaos-game.rs diff --git a/Task/Chaos-game/Uiua/chaos-game.uiua b/Task/Chaos-game/Uiua/chaos-game.uiua new file mode 100644 index 0000000000..23cfb68508 --- /dev/null +++ b/Task/Chaos-game/Uiua/chaos-game.uiua @@ -0,0 +1,20 @@ +Dim ← 500 +Points ← [[50 ⌊÷2Dim] [-50Dim 50] [-50Dim -50Dim]] +# Uncomment to try different square or pentagonal references. +# Points ← [[50 50] [-50Dim 50] [50 -50Dim][-50Dim -50Dim]] +# Points ← [[50 ⌊÷2Dim] [⌊×0.4Dim 50] [⌊×0.4Dim -50Dim] [-50Dim 120] [-50Dim -120Dim]] +Colours ← [[1 0 0] [0 1 0] [0 0 1] [1 1 0] [1 0 1] [0 1 1]] +Rand ← ⌊×⚂ + +↯Dim_Dim_3 0 +∧(⍜(⊡|[1 1 1]◌))Points +⊟Rand Dim Rand Dim +⍥( + Rand⧻Points + # Set next point and colour based on target. + ⊃(⌊÷2+⊡:Points|⊙◌⊡:Colours) + ⟜⍜⊡◌⊙: +)10000 +◌ +# Uncomment to save image. +# &fwa "UiuaChaosGameSerpinski.png" &ime "png" diff --git a/Task/Chaos-game/Uxntal/chaos-game.uxnatl b/Task/Chaos-game/Uxntal/chaos-game.uxnatl new file mode 100644 index 0000000000..13873818ad --- /dev/null +++ b/Task/Chaos-game/Uxntal/chaos-game.uxnatl @@ -0,0 +1,82 @@ +|00 @System/vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 +|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 +|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 + +|00 + @State &x $2 &y $2 + +|0100 +@on-reset ( -> ) + .DateTime/minute DEI2 SWP #20 SFT2 lcg/ + + #0f0f DUP2k + .System/r DEO2 + .System/g DEO2 + .System/b DEO2 + + ( 256 x 222 fits all three reference points ) + #0100 .Screen/width DEO2 + #00de .Screen/height DEO2 + + start-point + .State/x STZ2 + .State/y STZ2 + + ;on-frame .Screen/vector DEO2 + BRK + +@on-frame ( -> ) + [ LIT2 00 -State/x ] LDZ .Screen/x DEO2 + [ LIT2 00 -State/y ] LDZ .Screen/y DEO2 + [ LIT2 01 -Screen/pixel ] DEO + + next-point + .State/x STZ2 + .State/y STZ2 + BRK + +@start-point ( -- y* x* ) + ( pick a random point in a square ) + lcg/next lcg/next + ( mirror point if needed to move point to top left triangle ) + ADD2k OVR2 GTH2 ?{ + #0000 SWP2 SUB2 SWP2 + #0000 SWP2 SUB2 + } + ( skew points so triangle has a point in the bottom middle ) + SWP2 OVR2 #01 SFT2 ADD2 + ( mirror points vertically to make the triangle point up ) + STH2 #0000 SWP2 SUB2 + ( fixed point multiply y by cos 30deg to make it equilateral ) + ( hi * hi ) OVR #00 SWP #00dd MUL2 STH2 + ( hi * lo ) SWP #00 SWP #00b4 MUL2 STH2 + ( lo * hi ) #00 SWP #00dd MUL2 + ( add low bytes ) STH2r ADD2 #08 SFT2 + ( add to high product ) STH2r ADD2 + STH2r + + JMP2r + +@next-point ( -- y* x* ) + ( midpoint of previous State and a random corner ) + random-corner + #01 SFT2 .State/x LDZ2 #01 SFT2 ADD2 + STH2 + #01 SFT2 .State/y LDZ2 #01 SFT2 ADD2 + STH2r JMP2r + +@random-corner ( -- y* x* ) + ( randomly pick one of the three corners ) + lcg/next + #0003 DIV2k INC2 MUL2 SUB2 NIP + INC DUP ?{ POP #0000 #8000 JMP2r } + INC DUP ?{ POP #ddb4 #0000 JMP2r } + POP #ddb4 #ffff JMP2r + +@lcg/ ( seed* -- ) + ,&State STR2 JMP2r + +@lcg/next ( -- x* ) + [ LIT2 &State $2 ] + #0815 MUL2 #1419 ADD2 DUP2 ,&State STR2 + JMP2r diff --git a/Task/Character-codes/Ada/character-codes.ada b/Task/Character-codes/Ada/character-codes.adb similarity index 100% rename from Task/Character-codes/Ada/character-codes.ada rename to Task/Character-codes/Ada/character-codes.adb diff --git a/Task/Character-codes/Agena/character-codes.agena b/Task/Character-codes/Agena/character-codes.agena new file mode 100644 index 0000000000..a1410f30ad --- /dev/null +++ b/Task/Character-codes/Agena/character-codes.agena @@ -0,0 +1,2 @@ +print( abs "a" ); # prints the character code of a (97 in ASCII) +print( char( 97 ) ); # prints the character corresponding to code 97 ("a" in ASCII) diff --git a/Task/Character-codes/ArkScript/character-codes.ark b/Task/Character-codes/ArkScript/character-codes.ark new file mode 100644 index 0000000000..d96abc35c4 --- /dev/null +++ b/Task/Character-codes/ArkScript/character-codes.ark @@ -0,0 +1,4 @@ +(import std.String) + +(print (string:ord "a")) +(print (string:chr 97)) diff --git a/Task/Character-codes/Arturo/character-codes.arturo b/Task/Character-codes/Arturo/character-codes.arturo index e98e2586e9..f9ac1ae91b 100644 --- a/Task/Character-codes/Arturo/character-codes.arturo +++ b/Task/Character-codes/Arturo/character-codes.arturo @@ -1,3 +1,3 @@ print to :integer first "a" -print to :integer `a` +print to :integer 'a' print to :char 97 diff --git a/Task/Character-codes/Ballerina/character-codes.ballerina b/Task/Character-codes/Ballerina/character-codes.ballerina new file mode 100644 index 0000000000..c16ce85fc2 --- /dev/null +++ b/Task/Character-codes/Ballerina/character-codes.ballerina @@ -0,0 +1,15 @@ +import ballerina/io; + +public function main() returns error? { + int[] cps = []; + foreach string c in ["a", "π", "字", "🐘"] { + int cp = c[0].toCodePointInt(); + cps.push(cp); + io:println(`${c} = ${cp}`); + } + io:println(); + foreach int i in cps { + var c = check string:fromCodePointInt(i); + io:println(`${i} = ${c}`); + } +} diff --git a/Task/Character-codes/COBOL/character-codes.cobol b/Task/Character-codes/COBOL/character-codes.cob similarity index 100% rename from Task/Character-codes/COBOL/character-codes.cobol rename to Task/Character-codes/COBOL/character-codes.cob diff --git a/Task/Character-codes/Chipmunk-Basic/character-codes.basic b/Task/Character-codes/Chipmunk-Basic/character-codes.basic new file mode 100644 index 0000000000..14eb2171df --- /dev/null +++ b/Task/Character-codes/Chipmunk-Basic/character-codes.basic @@ -0,0 +1,2 @@ +10 print "a - > ";asc("a") +20 print "98 -> ";chr$(98) diff --git a/Task/Character-codes/Crystal/character-codes.cr b/Task/Character-codes/Crystal/character-codes.cr new file mode 100644 index 0000000000..5fb1cfa9e7 --- /dev/null +++ b/Task/Character-codes/Crystal/character-codes.cr @@ -0,0 +1,2 @@ +'Ω'.ord # => 937 +937.chr # => 'Ω' diff --git a/Task/Character-codes/Dart/character-codes.dart b/Task/Character-codes/Dart/character-codes.dart new file mode 100644 index 0000000000..b1b602f4bd --- /dev/null +++ b/Task/Character-codes/Dart/character-codes.dart @@ -0,0 +1,6 @@ +void main() { + const string = 'D'; + print(string.runes.first); + var out = String.fromCharCode(67); + print(out); +} diff --git a/Task/Character-codes/Delphi/character-codes.delphi b/Task/Character-codes/Delphi/character-codes.pas similarity index 100% rename from Task/Character-codes/Delphi/character-codes.delphi rename to Task/Character-codes/Delphi/character-codes.pas diff --git a/Task/Character-codes/EMal/character-codes.emal b/Task/Character-codes/EMal/character-codes.emal index d5b9bb52d9..f7b1fe0929 100644 --- a/Task/Character-codes/EMal/character-codes.emal +++ b/Task/Character-codes/EMal/character-codes.emal @@ -4,14 +4,11 @@ writeLine(chr(97)) # prints "a" writeLine(ord("π")) # prints "960" writeLine(chr(960)) # prints "π" writeLine() -var cps = int[] +var cps ← int[] for each var c in text["a", "π", "字", "🐘"] - var cp = ord(c) + var cp ← ord(c) cps.append(cp) - writeLine(c + " = " + cp) + writeLine(c, " = ", cp) end writeLine() -for each int i in cps - var c = chr(i) - writeLine(i + " = " + c) -end +cps.list( "; ASC("a") +20 PRINT "98 -> "; CHR$(98) diff --git a/Task/Character-codes/Gambas/character-codes-1.gambas b/Task/Character-codes/Gambas/character-codes.gambas similarity index 100% rename from Task/Character-codes/Gambas/character-codes-1.gambas rename to Task/Character-codes/Gambas/character-codes.gambas diff --git a/Task/Character-codes/Haxe/character-codes.hx b/Task/Character-codes/Haxe/character-codes.hx new file mode 100644 index 0000000000..3d1788b91d --- /dev/null +++ b/Task/Character-codes/Haxe/character-codes.hx @@ -0,0 +1,7 @@ +class Main { + static public function main():Void { + trace("a".code); + trace("∅".code); + trace("🍆".code); + } +} diff --git a/Task/Character-codes/Julia/character-codes.julia b/Task/Character-codes/Julia/character-codes.jl similarity index 100% rename from Task/Character-codes/Julia/character-codes.julia rename to Task/Character-codes/Julia/character-codes.jl diff --git a/Task/Character-codes/K/character-codes.k b/Task/Character-codes/K/character-codes.k index 038c6a31d1..8f4455a296 100644 --- a/Task/Character-codes/K/character-codes.k +++ b/Task/Character-codes/K/character-codes.k @@ -1,5 +1,5 @@ - _ic "abcABC" + `i$ "abcABC" 97 98 99 65 66 67 - _ci 97 98 99 65 66 67 + `c$ 97 98 99 65 66 67 "abcABC" diff --git a/Task/Character-codes/Kotlin/character-codes.kotlin b/Task/Character-codes/Kotlin/character-codes.kts similarity index 100% rename from Task/Character-codes/Kotlin/character-codes.kotlin rename to Task/Character-codes/Kotlin/character-codes.kts diff --git a/Task/Character-codes/Langur/character-codes.langur b/Task/Character-codes/Langur/character-codes.langur index 25f711852a..053f7ab322 100644 --- a/Task/Character-codes/Langur/character-codes.langur +++ b/Task/Character-codes/Langur/character-codes.langur @@ -1,11 +1,11 @@ -val .a1 = 'a' -val .a2 = 97 -val .a3 = "a"[1] -val .a4 = s2cp "a", 1 -val .a5 = [.a1, .a2, .a3, .a4] +val a1 = 'a' +val a2 = 97 +val a3 = "a"[1] +val a4 = s2cp("a", of=1) +val a5 = [a1, a2, a3, a4] -writeln .a1 == .a2 -writeln .a2 == .a3 -writeln .a3 == .a4 -writeln "numbers: ", join ", ", [.a1, .a2, .a3, .a4, .a5] -writeln "letters: ", join ", ", [cp2s(.a1), cp2s(.a2), cp2s(.a3), cp2s(.a4), cp2s(.a5)] +writeln a1 == a2 +writeln a2 == a3 +writeln a3 == a4 +writeln "numbers: ", join(map([a1, a2, a3, a4, a5], by=string), by=", ") +writeln "letters: ", join(map([a1, a2, a3, a4, a5], by=cp2s), by=", ") diff --git a/Task/Character-codes/M2000-Interpreter/character-codes.m2000 b/Task/Character-codes/M2000-Interpreter/character-codes.m2000 index f334be9e7a..2f909d53d2 100644 --- a/Task/Character-codes/M2000-Interpreter/character-codes.m2000 +++ b/Task/Character-codes/M2000-Interpreter/character-codes.m2000 @@ -7,16 +7,33 @@ Print ChrCode$(ChrCode("a")) \\ (,) is an empty array. -Function Codes(a$) { - If Len(A$)=0 then =(,) : Exit - Buffer Mem as byte*Len(a$) - \\ Str$(string) return one byte character - Return Mem, 0:=Str$(a$) - Inventory Codes - For i=0 to len(Mem)-1 - Append Codes, i:=Eval(Mem, i) - Next i - =Codes +Function Codes(a$, localeID=1033) { + If Len(A$)=0 then =(,) : Exit + \\ Str$(string) return one byte character + oldlocale=locale + locale localeID + a=Str$(a$) + locale oldlocale + Codes=(,) + locale 1033 + // 1 byte length returns 0.5 from len() ' 1 for 2 bytes. + // chr$(string) convert to UTF16LE with current LOCALE + For i=1 to len(a)*2 + Append Codes, (chrcode(chr$(mid$(a,i,1 as byte))),) + Next i + locale oldlocale + =Codes } -Print Codes("abcd") -\\ 97 98 99 100 +Print Codes("abcdΩ", 1032)#str$(", ") +\\ 97, 98, 99, 100, 217 + +Function CodesUNICODE(a) { + If Len(a)=0 then =(,) : Exit + Codes=(,) + For i=1 to len(a) + Append Codes, (chrcode(mid$(a,i,1)),) + Next i + =Codes +} +Print CodesUNICODE("abcdΩ")#str$(", ") +\\ 97, 98, 99, 100, 937 diff --git a/Task/Character-codes/MSX-Basic/character-codes.basic b/Task/Character-codes/MSX-Basic/character-codes.basic new file mode 100644 index 0000000000..340eaa4010 --- /dev/null +++ b/Task/Character-codes/MSX-Basic/character-codes.basic @@ -0,0 +1,2 @@ +10 PRINT "a - > "; ASC("a") +20 PRINT "98 -> "; CHR$(98) diff --git a/Task/Character-codes/MiniScript/character-codes.mini b/Task/Character-codes/MiniScript/character-codes.mini new file mode 100644 index 0000000000..d204f9122c --- /dev/null +++ b/Task/Character-codes/MiniScript/character-codes.mini @@ -0,0 +1,10 @@ +cps = [] +for c in ["a", "π", "字", "🐘"] + cp = c.code + cps.push cp + print c + " = " + cp +end for +print +for i in cps + print i + " = " + char(i) +end for diff --git a/Task/Character-codes/OCaml/character-codes-1.ocaml b/Task/Character-codes/OCaml/character-codes-1.ml similarity index 100% rename from Task/Character-codes/OCaml/character-codes-1.ocaml rename to Task/Character-codes/OCaml/character-codes-1.ml diff --git a/Task/Character-codes/OCaml/character-codes-2.ocaml b/Task/Character-codes/OCaml/character-codes-2.ml similarity index 100% rename from Task/Character-codes/OCaml/character-codes-2.ocaml rename to Task/Character-codes/OCaml/character-codes-2.ml diff --git a/Task/Character-codes/OPL/character-codes.opl b/Task/Character-codes/OPL/character-codes.opl new file mode 100644 index 0000000000..05ff6d3090 --- /dev/null +++ b/Task/Character-codes/OPL/character-codes.opl @@ -0,0 +1,5 @@ +PROC main: + PRINT "a ->",ASC("a") + PRINT "97 ->",CHR$(97) + GET +ENDP diff --git a/Task/Character-codes/Odin/character-codes.odin b/Task/Character-codes/Odin/character-codes.odin new file mode 100644 index 0000000000..0acc50a345 --- /dev/null +++ b/Task/Character-codes/Odin/character-codes.odin @@ -0,0 +1,11 @@ +package main + +import "core:fmt" + +main :: proc() { + // No difference between chracters and ints + a:int=97 + fmt.println(rune(a)) + number:int='a' + fmt.println(number) +} diff --git a/Task/Character-codes/PL-I-80/character-codes.pli b/Task/Character-codes/PL-I-80/character-codes.pli new file mode 100644 index 0000000000..e41644b762 --- /dev/null +++ b/Task/Character-codes/PL-I-80/character-codes.pli @@ -0,0 +1,8 @@ +char_codes: procedure options (main); + dcl ch char(1); + dcl n fixed bin; + ch = 'a'; + n = 97; + put skip edit (ch,' = ',rank(ch)) (a, a, f(2)); + put skip edit (n,' = ',ascii(n)) (f(2), a, a); +end char_codes; diff --git a/Task/Character-codes/PascalABC.NET/character-codes.pas b/Task/Character-codes/PascalABC.NET/character-codes.pas new file mode 100644 index 0000000000..deacfdd34e --- /dev/null +++ b/Task/Character-codes/PascalABC.NET/character-codes.pas @@ -0,0 +1,6 @@ +begin + var c := 'a'; + var i := c.Code; + Println(i); + Println(Chr(i)) +end. diff --git a/Task/Character-codes/Plain-English/character-codes.plain b/Task/Character-codes/Plain-English/character-codes.plain new file mode 100644 index 0000000000..e28e77ddc4 --- /dev/null +++ b/Task/Character-codes/Plain-English/character-codes.plain @@ -0,0 +1,4 @@ +\ Obs: The little-a byte is a byte equal to 97. +Write the little-a byte's whereabouts on the console. +Put 97 into a number. +Write the number's target on the console. diff --git a/Task/Character-codes/PowerShell/character-codes-1.psh b/Task/Character-codes/PowerShell/character-codes-1.ps1 similarity index 100% rename from Task/Character-codes/PowerShell/character-codes-1.psh rename to Task/Character-codes/PowerShell/character-codes-1.ps1 diff --git a/Task/Character-codes/PowerShell/character-codes-2.psh b/Task/Character-codes/PowerShell/character-codes-2.ps1 similarity index 100% rename from Task/Character-codes/PowerShell/character-codes-2.psh rename to Task/Character-codes/PowerShell/character-codes-2.ps1 diff --git a/Task/Character-codes/PowerShell/character-codes-3.psh b/Task/Character-codes/PowerShell/character-codes-3.ps1 similarity index 100% rename from Task/Character-codes/PowerShell/character-codes-3.psh rename to Task/Character-codes/PowerShell/character-codes-3.ps1 diff --git a/Task/Character-codes/PowerShell/character-codes-4.psh b/Task/Character-codes/PowerShell/character-codes-4.ps1 similarity index 100% rename from Task/Character-codes/PowerShell/character-codes-4.psh rename to Task/Character-codes/PowerShell/character-codes-4.ps1 diff --git a/Task/Character-codes/PowerShell/character-codes-5.psh b/Task/Character-codes/PowerShell/character-codes-5.ps1 similarity index 100% rename from Task/Character-codes/PowerShell/character-codes-5.psh rename to Task/Character-codes/PowerShell/character-codes-5.ps1 diff --git a/Task/Character-codes/Rebol/character-codes.rebol b/Task/Character-codes/Rebol/character-codes.rebol new file mode 100644 index 0000000000..8566b5bd09 --- /dev/null +++ b/Task/Character-codes/Rebol/character-codes.rebol @@ -0,0 +1,7 @@ +print to integer! first "a" ;; == 97 +print to integer! #"a" ;; == 97 +print to binary! "a" ;; == #{61} +print to char! 97 ;; == a +print to char! 0#61 ;; == a ;; available only in Rebol3 +print #"^(61)" ;; == a +print to-hex #"a" ;; == 61 ;; since Rebol 3.20.0 diff --git a/Task/Character-codes/Retro/character-codes.retro b/Task/Character-codes/Retro/character-codes.retro index 2272064c6f..783d9773d1 100644 --- a/Task/Character-codes/Retro/character-codes.retro +++ b/Task/Character-codes/Retro/character-codes.retro @@ -1 +1,2 @@ -'c putc +$a n:put nl +#97 c:put nl diff --git a/Task/Character-codes/Rust/character-codes.rust b/Task/Character-codes/Rust/character-codes.rs similarity index 100% rename from Task/Character-codes/Rust/character-codes.rust rename to Task/Character-codes/Rust/character-codes.rs diff --git a/Task/Character-codes/S-BASIC/character-codes.basic b/Task/Character-codes/S-BASIC/character-codes.basic new file mode 100644 index 0000000000..c3a772f23b --- /dev/null +++ b/Task/Character-codes/S-BASIC/character-codes.basic @@ -0,0 +1,14 @@ +var ch = char +var n = integer + +ch = 'a' +n = ch +print ch; " = "; n +print ch; " = "; asc(ch) + +n = 97 +ch = n +print n; " = "; ch +print n; " = "; chr$(n) + +end diff --git a/Task/Character-codes/Scheme/character-codes.ss b/Task/Character-codes/Scheme/character-codes.scm similarity index 100% rename from Task/Character-codes/Scheme/character-codes.ss rename to Task/Character-codes/Scheme/character-codes.scm diff --git a/Task/Character-codes/TAV/character-codes.tav b/Task/Character-codes/TAV/character-codes.tav new file mode 100644 index 0000000000..727bf15da6 --- /dev/null +++ b/Task/Character-codes/TAV/character-codes.tav @@ -0,0 +1,2 @@ + print string 'a' code point at 1 \ print 'a'.Codepoint + print integer 97 code point as string \ print 97.Character diff --git a/Task/Character-codes/Tcl/character-codes.tcl b/Task/Character-codes/Tcl/character-codes.tcl deleted file mode 100644 index 949c5ff094..0000000000 --- a/Task/Character-codes/Tcl/character-codes.tcl +++ /dev/null @@ -1,6 +0,0 @@ -# ASCII -puts [scan "a" %c] ;# ==> 97 -puts [format %c 97] ;# ==> a -# Unicode is the same -puts [scan "π" %c] ;# ==> 960 -puts [format %c 960] ;# ==> π diff --git a/Task/Character-codes/Uiua/character-codes.uiua b/Task/Character-codes/Uiua/character-codes.uiua new file mode 100644 index 0000000000..75f72c71f7 --- /dev/null +++ b/Task/Character-codes/Uiua/character-codes.uiua @@ -0,0 +1,2 @@ +-@\0@a ++@\097 diff --git a/Task/Character-codes/Uxntal/character-codes.uxnatl b/Task/Character-codes/Uxntal/character-codes.uxnatl new file mode 100644 index 0000000000..f2fd52e587 --- /dev/null +++ b/Task/Character-codes/Uxntal/character-codes.uxnatl @@ -0,0 +1,19 @@ +%\n { 0a } +%newline { [ LIT2 \n -Console/write ] DEO } + +|18 @Console/write + +|100 + +[ LIT "a ] print/byte newline +#61 .Console/write DEO newline + +BRK + +@print/byte ( byte -- ) + DUP #04 SFT /nibble + ( >> ) + +@print/nibble ( byte -- ) + #0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD .Console/write DEO + JMP2r diff --git a/Task/Character-codes/VBScript/character-codes.vb b/Task/Character-codes/VBScript/character-codes.vbs similarity index 100% rename from Task/Character-codes/VBScript/character-codes.vb rename to Task/Character-codes/VBScript/character-codes.vbs diff --git a/Task/Character-codes/XBasic/character-codes.basic b/Task/Character-codes/XBasic/character-codes.basic new file mode 100644 index 0000000000..216d2a45b9 --- /dev/null +++ b/Task/Character-codes/XBasic/character-codes.basic @@ -0,0 +1,10 @@ +PROGRAM "Character codes" +VERSION "0.0000" + +DECLARE FUNCTION Entry () + +FUNCTION Entry () + PRINT "a - >"; ASC("a") + PRINT "98 -> "; CHR$(98) +END FUNCTION +END PROGRAM diff --git a/Task/Chat-server/Ada/chat-server.ada b/Task/Chat-server/Ada/chat-server.adb similarity index 100% rename from Task/Chat-server/Ada/chat-server.ada rename to Task/Chat-server/Ada/chat-server.adb diff --git a/Task/Chat-server/FreeBASIC/chat-server.basic b/Task/Chat-server/FreeBASIC/chat-server.basic new file mode 100644 index 0000000000..4070f9e3cd --- /dev/null +++ b/Task/Chat-server/FreeBASIC/chat-server.basic @@ -0,0 +1,122 @@ +#include once "windows.bi" +#include once "win/winsock2.bi" + +Type SOCKET As Ulongint +Type ThreadCallback As Sub(Byval As Any Ptr) + +Const MAX_CLIENTS = 10 +Const CRLF = Chr(13) & Chr(10) +Const BUFFER_SIZE = 256 + +Dim Shared clients(MAX_CLIENTS) As SOCKET +Dim Shared nicknames(MAX_CLIENTS) As String +Dim Shared clientCount As Integer = 0 + +' Initialize Winsock +Dim As WSADATA wsaData +If WSAStartup(&h0202, @wsaData) Then + Print "Error initializing Winsock" + End 1 +End If + +' Create server socket +Dim As SOCKET serverSocket = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, 0) +If serverSocket = INVALID_SOCKET Then + Print "Error creating socket" + WSACleanup() + End 1 +End If + +' Configure server address +Dim As sockaddr_in serverAddr +With serverAddr + .sin_family = AF_INET + .sin_addr.s_addr = INADDR_ANY + .sin_port = htons(8080) +End With + +' Bind socket +If bind(serverSocket, Cast(sockaddr Ptr, @serverAddr), Sizeof(sockaddr_in)) = SOCKET_ERROR Then + Print "Error binding socket" + closesocket(serverSocket) + WSACleanup() + End 1 +End If + +' Listen for incoming connections +If listen(serverSocket, SOMAXCONN) = SOCKET_ERROR Then + Print "Error listening on socket" + closesocket(serverSocket) + WSACleanup() + End 1 +End If + +Print "Chat server is running on port 8080" + +Sub broadcastMessage(message As String) + Dim As String fullMsg = message + For i As Integer = 0 To clientCount - 1 + If clients(i) <> 0 Then + send(clients(i), Strptr(fullMsg), Len(fullMsg), 0) + End If + Next i +End Sub + +Sub handleClient(Byval param As Any Ptr) + Dim As Integer clientIndex = Cast(Integer, param) + Dim As SOCKET clientSocket = clients(clientIndex) + Dim As String nickname + Dim As ZString * BUFFER_SIZE buffer + Dim As Long bytesReceived + + ' Get nickname + Dim As String welcomeMsg = "Enter your nickname: " + send(clientSocket, Strptr(welcomeMsg), Len(welcomeMsg), 0) + bytesReceived = recv(clientSocket, @buffer, BUFFER_SIZE-1, 0) + If bytesReceived > 0 Then + nickname = Left(buffer, bytesReceived - 2) + nicknames(clientIndex) = nickname + + ' Announce new user + broadcastMessage(nickname & " has joined the chat." & CRLF) + + ' Message loop + Do + bytesReceived = recv(clientSocket, @buffer, BUFFER_SIZE-1, 0) + If bytesReceived <= 0 Then Exit Do + buffer[bytesReceived] = 0 + broadcastMessage(nickname & ": " & *Cast(ZString Ptr, @buffer) & CRLF) + Loop + + ' Announce departure + broadcastMessage(nickname & " has left the chat." & CRLF) + End If + + ' Cleanup + closesocket(clientSocket) + clients(clientIndex) = 0 + nicknames(clientIndex) = "" +End Sub + +' Main server loop +Do + Dim As sockaddr_in clientAddr + Dim As Long clientAddrLen = Sizeof(sockaddr_in) + + Dim As SOCKET clientSocket = accept(serverSocket, Cast(sockaddr Ptr, @clientAddr), @clientAddrLen) + If clientSocket <> INVALID_SOCKET Then + If clientCount < MAX_CLIENTS Then + clients(clientCount) = clientSocket + clientCount += 1 + Threadcreate(Cast(ThreadCallback, @handleClient), Cast(Any Ptr, clientCount - 1)) + Else + Dim As String fullMsg = "Server is full." & CRLF + send(clientSocket, Strptr(fullMsg), Len(fullMsg), 0) + closesocket(clientSocket) + End If + End If +Loop + +' Final cleaning +closesocket(serverSocket) +WSACleanup() diff --git a/Task/Chat-server/Julia/chat-server.julia b/Task/Chat-server/Julia/chat-server.jl similarity index 100% rename from Task/Chat-server/Julia/chat-server.julia rename to Task/Chat-server/Julia/chat-server.jl diff --git a/Task/Chat-server/Kotlin/chat-server.kotlin b/Task/Chat-server/Kotlin/chat-server.kts similarity index 100% rename from Task/Chat-server/Kotlin/chat-server.kotlin rename to Task/Chat-server/Kotlin/chat-server.kts diff --git a/Task/Chat-server/Rust/chat-server.rust b/Task/Chat-server/Rust/chat-server.rs similarity index 100% rename from Task/Chat-server/Rust/chat-server.rust rename to Task/Chat-server/Rust/chat-server.rs diff --git a/Task/Chat-server/Wren/chat-server-1.wren b/Task/Chat-server/Wren/chat-server-1.wren index c8e43d7b19..0dc19c6b84 100644 --- a/Task/Chat-server/Wren/chat-server-1.wren +++ b/Task/Chat-server/Wren/chat-server-1.wren @@ -1,4 +1,4 @@ -/* chat_server.wren */ +/* Chat_server.wren */ class Clients { foreign static max diff --git a/Task/Chat-server/Wren/chat-server-2.wren b/Task/Chat-server/Wren/chat-server-2.wren index 8df0f2373b..783eca36b5 100644 --- a/Task/Chat-server/Wren/chat-server-2.wren +++ b/Task/Chat-server/Wren/chat-server-2.wren @@ -1,4 +1,4 @@ -/* gcc chat_server.c -o chat_server -lpthread -lwren -lm */ +/* gcc Chat_server.c -o Chat_server -lpthread -lwren -lm */ #include #include @@ -278,7 +278,7 @@ int main(int argc, char **argv) { config.errorFn = &errorFn; config.bindForeignMethodFn = &bindForeignMethod; const char* module = "main"; - const char* fileName = "chat_server.wren"; + const char* fileName = "Chat_server.wren"; script = readFile(fileName); /* config the VMs and interpret the script */ diff --git a/Task/Check-Machin-like-formulas/00-TASK.txt b/Task/Check-Machin-like-formulas/00-TASK.txt index d6db6e1191..c28978d512 100644 --- a/Task/Check-Machin-like-formulas/00-TASK.txt +++ b/Task/Check-Machin-like-formulas/00-TASK.txt @@ -35,7 +35,7 @@ These identities are useful in calculating the values:
You can store the equations in any convenient data structure, but for extra credit parse them from human-readable [[Check_Machin-like_formulas/text_equations|text input]]. -Note: to formally prove the formula correct, it would have to be shown that ''{-3 pi \over 4} < right hand side < {5 pi \over 4}'' due to ''\tan()'' periodicity. +Note: to formally prove the formula correct, it would have to be shown that ''{-3 \pi \over 4} < right hand side < {5 \pi \over 4}'' due to ''\tan()'' periodicity.

diff --git a/Task/Check-Machin-like-formulas/Julia/check-machin-like-formulas.julia b/Task/Check-Machin-like-formulas/Julia/check-machin-like-formulas.jl similarity index 100% rename from Task/Check-Machin-like-formulas/Julia/check-machin-like-formulas.julia rename to Task/Check-Machin-like-formulas/Julia/check-machin-like-formulas.jl diff --git a/Task/Check-Machin-like-formulas/Kotlin/check-machin-like-formulas.kotlin b/Task/Check-Machin-like-formulas/Kotlin/check-machin-like-formulas.kts similarity index 100% rename from Task/Check-Machin-like-formulas/Kotlin/check-machin-like-formulas.kotlin rename to Task/Check-Machin-like-formulas/Kotlin/check-machin-like-formulas.kts diff --git a/Task/Check-Machin-like-formulas/OCaml/check-machin-like-formulas.ocaml b/Task/Check-Machin-like-formulas/OCaml/check-machin-like-formulas.ml similarity index 100% rename from Task/Check-Machin-like-formulas/OCaml/check-machin-like-formulas.ocaml rename to Task/Check-Machin-like-formulas/OCaml/check-machin-like-formulas.ml diff --git a/Task/Check-Machin-like-formulas/Wren/check-machin-like-formulas.wren b/Task/Check-Machin-like-formulas/Wren/check-machin-like-formulas.wren index 1384ed0ff1..444ac4e66a 100644 --- a/Task/Check-Machin-like-formulas/Wren/check-machin-like-formulas.wren +++ b/Task/Check-Machin-like-formulas/Wren/check-machin-like-formulas.wren @@ -1,5 +1,5 @@ -import "/big" for BigRat -import "/fmt" for Fmt +import "./big" for BigRat +import "./fmt" for Fmt /** represents a term of the form: c * atan(n / d) */ class Term { diff --git a/Task/Check-input-device-is-a-terminal/Ada/check-input-device-is-a-terminal.ada b/Task/Check-input-device-is-a-terminal/Ada/check-input-device-is-a-terminal.adb similarity index 100% rename from Task/Check-input-device-is-a-terminal/Ada/check-input-device-is-a-terminal.ada rename to Task/Check-input-device-is-a-terminal/Ada/check-input-device-is-a-terminal.adb diff --git a/Task/Check-input-device-is-a-terminal/Batch-File/check-input-device-is-a-terminal.bat b/Task/Check-input-device-is-a-terminal/Batch-File/check-input-device-is-a-terminal.bat new file mode 100644 index 0000000000..8fcd2d94e2 --- /dev/null +++ b/Task/Check-input-device-is-a-terminal/Batch-File/check-input-device-is-a-terminal.bat @@ -0,0 +1 @@ +(timeout /t 0 >nul 2>nul && echo Stdin is a terminal || echo Stdin is not a terminal) b.out will write to b.out, and this contains unit 5 is a terminal but unit 6 ism't +! ./checktty < a.out >b.out will write to b.out, and both units 5 and 6 are not terminals. +! +! Check units 1...10 if they are connected to a terminal. +do unit=1,10 + if (isatty (unit)) then + write (*, '("Unit ", i2, " is a Terminal")') unit + else + write (*, '("Unit ", i2, " is NOT a Terminal")') unit + endif +enddo + +end program checkTTY diff --git a/Task/Check-input-device-is-a-terminal/Janet/check-input-device-is-a-terminal.janet b/Task/Check-input-device-is-a-terminal/Janet/check-input-device-is-a-terminal.janet new file mode 100644 index 0000000000..f0fb90c650 --- /dev/null +++ b/Task/Check-input-device-is-a-terminal/Janet/check-input-device-is-a-terminal.janet @@ -0,0 +1,3 @@ +(if (os/isatty stdin) + (print "The input device is a terminal.") + (print "The input device is not a terminal.")) diff --git a/Task/Check-input-device-is-a-terminal/Julia/check-input-device-is-a-terminal.julia b/Task/Check-input-device-is-a-terminal/Julia/check-input-device-is-a-terminal.jl similarity index 100% rename from Task/Check-input-device-is-a-terminal/Julia/check-input-device-is-a-terminal.julia rename to Task/Check-input-device-is-a-terminal/Julia/check-input-device-is-a-terminal.jl diff --git a/Task/Check-input-device-is-a-terminal/Kotlin/check-input-device-is-a-terminal.kotlin b/Task/Check-input-device-is-a-terminal/Kotlin/check-input-device-is-a-terminal.kts similarity index 100% rename from Task/Check-input-device-is-a-terminal/Kotlin/check-input-device-is-a-terminal.kotlin rename to Task/Check-input-device-is-a-terminal/Kotlin/check-input-device-is-a-terminal.kts diff --git a/Task/Check-input-device-is-a-terminal/Lua/check-input-device-is-a-terminal.lua b/Task/Check-input-device-is-a-terminal/Lua/check-input-device-is-a-terminal.lua new file mode 100644 index 0000000000..53aa2d1991 --- /dev/null +++ b/Task/Check-input-device-is-a-terminal/Lua/check-input-device-is-a-terminal.lua @@ -0,0 +1,6 @@ +local posix = require"posix" +print( + posix.unistd.isatty(posix.stdio.fileno(io.stdin)) + and "stdin is a terminal" + or "stdin is not a terminal" +) diff --git a/Task/Check-input-device-is-a-terminal/Nu/check-input-device-is-a-terminal.nu b/Task/Check-input-device-is-a-terminal/Nu/check-input-device-is-a-terminal.nu new file mode 100644 index 0000000000..0a1e81828c --- /dev/null +++ b/Task/Check-input-device-is-a-terminal/Nu/check-input-device-is-a-terminal.nu @@ -0,0 +1 @@ +$'stdin is a terminal: (is-terminal -i)' diff --git a/Task/Check-input-device-is-a-terminal/OCaml/check-input-device-is-a-terminal.ocaml b/Task/Check-input-device-is-a-terminal/OCaml/check-input-device-is-a-terminal.ml similarity index 100% rename from Task/Check-input-device-is-a-terminal/OCaml/check-input-device-is-a-terminal.ocaml rename to Task/Check-input-device-is-a-terminal/OCaml/check-input-device-is-a-terminal.ml diff --git a/Task/Check-input-device-is-a-terminal/PascalABC.NET/check-input-device-is-a-terminal.pas b/Task/Check-input-device-is-a-terminal/PascalABC.NET/check-input-device-is-a-terminal.pas new file mode 100644 index 0000000000..0c5e7e3fdb --- /dev/null +++ b/Task/Check-input-device-is-a-terminal/PascalABC.NET/check-input-device-is-a-terminal.pas @@ -0,0 +1,3 @@ +## +uses system; +system.Console.IsInputRedirected.println; diff --git a/Task/Check-input-device-is-a-terminal/Phix/check-input-device-is-a-terminal.phix b/Task/Check-input-device-is-a-terminal/Phix/check-input-device-is-a-terminal.phix index a8e739efdc..8f2a7843e3 100644 --- a/Task/Check-input-device-is-a-terminal/Phix/check-input-device-is-a-terminal.phix +++ b/Task/Check-input-device-is-a-terminal/Phix/check-input-device-is-a-terminal.phix @@ -1,4 +1,2 @@ -(notonline)--> - without js -- (no input redirection in a browser!) - printf(1,"stdin:%t, stdout:%t, stderr:%t\n",{isatty(0),isatty(1),isatty(2)}) - - without js -- (no input or output redirection in a browser!) - printf(1,"stdin:%t, stdout:%t, stderr:%t\n",{isatty(0),isatty(1),isatty(2)}) - - without js -- (file i/o) - procedure check(string name) - bool bExists = file_exists(name), - bDir = get_file_type(name)=FILETYPE_DIRECTORY - string exists = iff(bExists?"exists":"does not exist"), - dfs = iff(bExists?iff(bDir?"directory ":"file "):"") - printf(1,"%s%s %s.\n",{dfs,name,exists}) - end procedure +without js -- (file i/o) +procedure check(string name) + bool bExists = file_exists(name), + bDir = get_file_type(name)=FILETYPE_DIRECTORY + string exists = iff(bExists?"exists":"does not exist"), + dfs = iff(bExists?iff(bDir?"directory ":"file "):"") + printf(1,"%s%s %s.\n",{dfs,name,exists}) +end procedure - check("input.txt") - check("docs") - check("/input.txt") - check("/docs") - check("/pagefile.sys") - check("/Program Files (x86)") - - with javascript_semantics - function chernick_carmichael_factors(integer n, m) - sequence res = {6*m + 1, 12*m + 1} - for i=1 to n-2 do - res &= power(2,i) * 9*m + 1 - end for - return res - end function - - include mpfr.e - mpz p = mpz_init() - - function m_prime(atom a) - mpz_set_d(p,a) - return mpz_prime(p) - end function - - function is_chernick_carmichael(integer n, m) - return iff(n==2 ? m_prime(6*m + 1) and m_prime(12*m + 1) - : m_prime(power(2,n-2) * 9*m + 1) and - is_chernick_carmichael(n-1, m)) - end function - - function chernick_carmichael_number(integer n) - integer m = iff(n>4 ? power(2,n-4) : 1), mm = m - while not is_chernick_carmichael(n, mm) do mm += m end while - return {chernick_carmichael_factors(n, mm),mm} - end function - - for n=3 to 9 do - {sequence f, integer m} = chernick_carmichael_number(n) - mpz_set_si(p,1) - for i=1 to length(f) do - mpz_mul_d(p,p,f[i]) - f[i] = sprintf("%d",f[i]) - end for - printf(1,"U(%d,%d): %s = %s\n",{n,m,mpz_get_str(p),join(f," * ")}) - end for - - with javascript_semantics - include mpfr.e - sequence ppp = {3,5,7,11,13,17,19,23} - function primality_pretest(atom k) - for i=1 to length(ppp) do - if remainder(k,ppp[i])=0 then return (k<=23) end if - end for - return true - end function - - function probprime(atom k, mpz n) - mpz_set_d(n, k) - return mpz_prime(n) - end function - - function is_chernick(integer n, atom m, mpz z) - atom t = 9 * m; - if primality_pretest(6 * m + 1) == false then return false end if - if primality_pretest(12 * m + 1) == false then return false end if - for i=1 to n-3 do - if primality_pretest(t*power(2,i) + 1) == false then return false end if - end for - if probprime(6 * m + 1, z) == false then return false end if - if probprime(12 * m + 1, z) == false then return false end if - for i=1 to n-2 do - if probprime(t*power(2,i) + 1, z) == false then return false end if - end for - return true - end function - - procedure main() - atom t0 = time() - mpz z = mpz_init(0) - - for n=3 to 10 do - atom multiplier = iff(n>4 ? power(2,n-4) : 1), k = 1 - if n>5 then multiplier *= 5 end if - - while true do - if n=10 then k += 12564168 end if -- cheat! - atom m = k * multiplier; - if is_chernick(n, m, z) then - printf(1,"a(%d) has m = %d\n", {n, m}) - exit - end if - k += 1 - end while - end for - ?elapsed(time()-t0) - end procedure - main() - - -- demo\rosetta\Cheryls_Birthday.exw - with javascript_semantics - sequence choices = {{5, 15}, {5, 16}, {5, 19}, {6, 17}, {6, 18}, - {7, 14}, {7, 16}, {8, 14}, {8, 15}, {8, 17}} +-- demo\rosetta\Cheryls_Birthday.exw +with javascript_semantics +sequence choices = {{5, 15}, {5, 16}, {5, 19}, {6, 17}, {6, 18}, + {7, 14}, {7, 16}, {8, 14}, {8, 15}, {8, 17}} - sequence mwud = repeat(false,12) -- months with unique days +sequence mwud = repeat(false,12) -- months with unique days - for step=1 to 4 do - sequence {months,days} = columnize(choices) - bool impossible = false - for i=length(choices) to 1 by -1 do - integer {m,d} = choices[i] - switch step do - case 1: mwud[m] += (sum(sq_eq(days,d))=1) - case 2: impossible = mwud[m] - case 3: impossible = (sum(sq_eq(days,d))!=1) - case 4: impossible = (sum(sq_eq(months,m))!=1) - end switch - if impossible then - choices[i..i] = {} - end if - end for - end for - ?choices - - with javascript_semantics - enum MONTH, DAY +with javascript_semantics +enum MONTH, DAY - function unique_month(sequence si, months) - return sum(sq_eq(months,si[MONTH]))=1 - end function +function unique_month(sequence si, months) + return sum(sq_eq(months,si[MONTH]))=1 +end function - function unique_day(sequence si, days) - return sum(sq_eq(days,si[DAY]))=1 - end function +function unique_day(sequence si, days) + return sum(sq_eq(days,si[DAY]))=1 +end function - function month_without_unique_day(sequence si, months_with_unique_day) - return not find(si[MONTH],months_with_unique_day) - end function +function month_without_unique_day(sequence si, months_with_unique_day) + return not find(si[MONTH],months_with_unique_day) +end function - sequence choices = {{5, 15}, {5, 16}, {5, 19}, {6, 17}, {6, 18}, - {7, 14}, {7, 16}, {8, 14}, {8, 15}, {8, 17}} +sequence choices = {{5, 15}, {5, 16}, {5, 19}, {6, 17}, {6, 18}, + {7, 14}, {7, 16}, {8, 14}, {8, 15}, {8, 17}} - -- Albert knows the month but does not know the day. - -- So the month cannot be unique within the choices. - -- However this step would change nothing, hence omit it. - -- (obvs. non_unique_month() would be as above, but !=1) - --choices = filter(choices,non_unique_month,vslice(choices,MONTH)) +-- Albert knows the month but does not know the day. +-- So the month cannot be unique within the choices. +-- However this step would change nothing, hence omit it. +-- (obvs. non_unique_month() would be as above, but !=1) +--choices = filter(choices,non_unique_month,vslice(choices,MONTH)) - -- Albert also knows that Bernard doesn't know the answer. - -- So the month cannot have a unique day. - sequence unique_days = filter(choices,unique_day,vslice(choices,DAY)) - sequence months_with_unique_day = unique(vslice(unique_days,MONTH)) +-- Albert also knows that Bernard doesn't know the answer. +-- So the month cannot have a unique day. +sequence unique_days = filter(choices,unique_day,vslice(choices,DAY)) +sequence months_with_unique_day = unique(vslice(unique_days,MONTH)) - choices = filter(choices,month_without_unique_day,months_with_unique_day) +choices = filter(choices,month_without_unique_day,months_with_unique_day) - -- Bernard now knows the answer. - -- So the day must be unique within the remaining choices. - choices = filter(choices,unique_day,vslice(choices,DAY)) +-- Bernard now knows the answer. +-- So the day must be unique within the remaining choices. +choices = filter(choices,unique_day,vslice(choices,DAY)) - -- Albert now knows the answer too. - -- So the month must be unique within the remaining choices. - choices = filter(choices,unique_month,vslice(choices,MONTH)) +-- Albert now knows the answer too. +-- So the month must be unique within the remaining choices. +choices = filter(choices,unique_month,vslice(choices,MONTH)) - if length(choices)!=1 then crash("Something went wrong!") end if +if length(choices)!=1 then crash("Something went wrong!") end if - include builtins\timedate.e - timedate td = repeat(0,6) - {td[DT_MONTH],td[DT_DAY]} = choices[1] - printf(1,"Cheryl's birthday is %s\n", {format_timedate(td,"Mmmm ddth")}) - - with javascript_semantics - constant animals = {"Rat","Ox","Tiger","Rabbit","Dragon","Snake","Horse","Goat","Monkey","Rooster","Dog","Pig"}, - elements = {"Wood","Fire","Earth","Metal","Water"}, - yinyang = {"yang","yin"}, - years = {1935,1938,1968,1972,1976,2018} +with javascript_semantics +constant animals = {"Rat","Ox","Tiger","Rabbit","Dragon","Snake","Horse","Goat","Monkey","Rooster","Dog","Pig"}, + elements = {"Wood","Fire","Earth","Metal","Water"}, + yinyang = {"yang","yin"}, + years = {1935,1938,1968,1972,1976,2018} - for i=1 to length(years) do - integer year = years[i], - cycle = mod(year-4,60) - string element = elements[floor(mod(cycle,10)/2)+1], - animal = animals[mod(cycle,12)+1], - yy = yinyang[mod(cycle,2)+1] - printf(1,"%d: %s %s; %s, year %d of the cycle.\n", - {year,element,animal,yy,cycle+1}) - end for - list of strings +fcn ceToChineseZodiac(ce_year){ // --> list of strings # encoding: utf-8 var [const] pinyin=SD( // create some static variables, SD is small fixed dictionary "甲","jiă", "乙","yĭ", "丙","bĭng", "丁","dīng", "戊","wù", "己","jĭ", @@ -11,7 +11,7 @@ fcn ceToChineseZodiac(ce_year){ // --> list of strings celestial =T("甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"), terrestrial=T("子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"), animals =T("Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake", - "Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"), + "Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"), elements =T("Wood", "Fire", "Earth", "Metal", "Water"), aspects =T("yang","yin"), ; @@ -28,5 +28,5 @@ fcn ceToChineseZodiac(ce_year){ // --> list of strings branch_han,branch_pinyin := terrestrial[branch_number], pinyin[branch_han]; return(stem_han,branch_han, - stem_pinyin,branch_pinyin, element,animal,aspect) + stem_pinyin,branch_pinyin, element,animal,aspect) } diff --git a/Task/Cholesky-decomposition/Ada/cholesky-decomposition-1.ada b/Task/Cholesky-decomposition/Ada/cholesky-decomposition-1.adb similarity index 100% rename from Task/Cholesky-decomposition/Ada/cholesky-decomposition-1.ada rename to Task/Cholesky-decomposition/Ada/cholesky-decomposition-1.adb diff --git a/Task/Cholesky-decomposition/Ada/cholesky-decomposition-2.ada b/Task/Cholesky-decomposition/Ada/cholesky-decomposition-2.adb similarity index 100% rename from Task/Cholesky-decomposition/Ada/cholesky-decomposition-2.ada rename to Task/Cholesky-decomposition/Ada/cholesky-decomposition-2.adb diff --git a/Task/Cholesky-decomposition/Ada/cholesky-decomposition-3.ada b/Task/Cholesky-decomposition/Ada/cholesky-decomposition-3.adb similarity index 100% rename from Task/Cholesky-decomposition/Ada/cholesky-decomposition-3.ada rename to Task/Cholesky-decomposition/Ada/cholesky-decomposition-3.adb diff --git a/Task/Cholesky-decomposition/EasyLang/cholesky-decomposition.easy b/Task/Cholesky-decomposition/EasyLang/cholesky-decomposition.easy new file mode 100644 index 0000000000..f06a3216a5 --- /dev/null +++ b/Task/Cholesky-decomposition/EasyLang/cholesky-decomposition.easy @@ -0,0 +1,19 @@ +func[][] cholesky a[][] . + n = len a[][] + len r[][] n + for i to n + len r[i][] n + for j to i + s = 0 + for k to j : s += r[i][k] * r[j][k] + if i = j + r[i][j] = sqrt (a[i][i] - s) + else + r[i][j] = 1 / r[j][j] * (a[i][j] - s) + . + . + . + return r[][] +. +print cholesky [ [ 25 15 -5 ] [ 15 18 0 ] [ -5 0 11 ] ] +print cholesky [ [ 18 22 54 42 ] [ 22 70 86 62 ] [ 54 86 174 134 ] [ 42 62 134 106 ] ] diff --git a/Task/Cholesky-decomposition/Excel/cholesky-decomposition.excel b/Task/Cholesky-decomposition/Excel/cholesky-decomposition.excel new file mode 100644 index 0000000000..1586be05f1 --- /dev/null +++ b/Task/Cholesky-decomposition/Excel/cholesky-decomposition.excel @@ -0,0 +1,38 @@ +=LAMBDA(A, + LET( + r, ROWS(A), + sqa, SQRT(INDEX(A,1,1)), + IF( + r=1, + sqa, + REDUCE( + VSTACK(sqa, DROP(TAKE(A,,1),1)/sqa), + SEQUENCE(r-1,,2), + LAMBDA(s, t, + LET( + diag, SQRT(INDEX(A,t,t) - SUMSQ(INDEX(s,t))), + HSTACK( + s, + VSTACK( + EXPAND(0,t-1,1,0), + IF( + t=r, + diag, + REDUCE( + diag, + SEQUENCE(r-t,1,t+1), + LAMBDA(x,y, + VSTACK( + x, + (INDEX(A,y,t) - SUM(INDEX(s,t)*INDEX(s,y))) / diag + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) +) diff --git a/Task/Cholesky-decomposition/Julia/cholesky-decomposition.julia b/Task/Cholesky-decomposition/Julia/cholesky-decomposition.jl similarity index 100% rename from Task/Cholesky-decomposition/Julia/cholesky-decomposition.julia rename to Task/Cholesky-decomposition/Julia/cholesky-decomposition.jl diff --git a/Task/Cholesky-decomposition/Kotlin/cholesky-decomposition.kotlin b/Task/Cholesky-decomposition/Kotlin/cholesky-decomposition.kts similarity index 100% rename from Task/Cholesky-decomposition/Kotlin/cholesky-decomposition.kotlin rename to Task/Cholesky-decomposition/Kotlin/cholesky-decomposition.kts diff --git a/Task/Cholesky-decomposition/OCaml/cholesky-decomposition.ocaml b/Task/Cholesky-decomposition/OCaml/cholesky-decomposition.ml similarity index 100% rename from Task/Cholesky-decomposition/OCaml/cholesky-decomposition.ocaml rename to Task/Cholesky-decomposition/OCaml/cholesky-decomposition.ml diff --git a/Task/Cholesky-decomposition/PascalABC.NET/cholesky-decomposition.pas b/Task/Cholesky-decomposition/PascalABC.NET/cholesky-decomposition.pas new file mode 100644 index 0000000000..94dfe940b1 --- /dev/null +++ b/Task/Cholesky-decomposition/PascalABC.NET/cholesky-decomposition.pas @@ -0,0 +1,51 @@ +function Cholesky(a: array of real): array of real; +begin + var n := Round(Sqrt(a.Length)); + Result := new real[n * n]; + for var i := 0 to n - 1 do + begin + for var j := 0 to i do + begin + var s := 0.0; + for var k := 0 to j - 1 do + s += Result[i * n + k] * Result[j * n + k]; + if i = j then + Result[i * n + j] := Sqrt(a[i * n + i] - s) + else Result[i * n + j] := 1 / Result[j * n + j] * (a[i * n + j] - s); + end; + end; +end; + +procedure ShowMatrix(a: array of real); +begin + var n := Round(Sqrt(a.Length)); + for var i := 0 to n - 1 do + begin + for var j := 0 to n - 1 do + write(a[i * n + j]:10:5); + PrintLn(''); + end; +end; + +begin + var m1 := new real[9]; + m1 := |25.0, 15.0, -5.0, + 15.0, 18.0, 0.0, + -5.0, 0.0, 11.0 |; + var c1 := Cholesky(m1); + ShowMatrix(m1); + println('=>'); + ShowMatrix(c1); + + PrintLn(''); + + var m2: array of real := + |18.0, 22.0, 54.0, 42.0, + 22.0, 70.0, 86.0, 62.0, + 54.0, 86.0, 174.0, 134.0, + 42.0, 62.0, 134.0, 106.0 |; + var c2 := Cholesky(m2); + Showmatrix(m2); + println('=>'); + ShowMatrix(c2); +end. diff --git a/Task/Cholesky-decomposition/Pluto/cholesky-decomposition.pluto b/Task/Cholesky-decomposition/Pluto/cholesky-decomposition.pluto new file mode 100644 index 0000000000..5a31f92f26 --- /dev/null +++ b/Task/Cholesky-decomposition/Pluto/cholesky-decomposition.pluto @@ -0,0 +1,21 @@ +require "matrix" + +local arrays = { + { {25, 15, -5}, + {15, 18, 0}, + {-5, 0, 11} }, + + { {18, 22, 54, 42}, + {22, 70, 86, 62}, + {54, 86, 174, 134}, + {42, 62, 134, 106} } +} + +for arrays as array do + local m = matrix.from(array) + print("Original:") + print(m) + print("\nLower Cholesky factor:") + print(m:cholesky():format("%8.5f")) + print() +end diff --git a/Task/Cholesky-decomposition/PowerShell/cholesky-decomposition.psh b/Task/Cholesky-decomposition/PowerShell/cholesky-decomposition.ps1 similarity index 100% rename from Task/Cholesky-decomposition/PowerShell/cholesky-decomposition.psh rename to Task/Cholesky-decomposition/PowerShell/cholesky-decomposition.ps1 diff --git a/Task/Cholesky-decomposition/Rust/cholesky-decomposition.rust b/Task/Cholesky-decomposition/Rust/cholesky-decomposition.rs similarity index 100% rename from Task/Cholesky-decomposition/Rust/cholesky-decomposition.rust rename to Task/Cholesky-decomposition/Rust/cholesky-decomposition.rs diff --git a/Task/Cholesky-decomposition/Scheme/cholesky-decomposition.scm b/Task/Cholesky-decomposition/Scheme/cholesky-decomposition.scm new file mode 100644 index 0000000000..fbe516a678 --- /dev/null +++ b/Task/Cholesky-decomposition/Scheme/cholesky-decomposition.scm @@ -0,0 +1,55 @@ +(import srfi/231) + +(define (Cholesky A) + ;; Assumes the domain of A is [0,n)\\times [0,n) + (let ((n (interval-upper-bound (array-domain A) 0)) + (A_ (array-getter A)) + (A! (array-setter A))) + (do ((i 0 (+ i 1))) + ((= i n) A) + (let* ((pivot (sqrt (A_ i i))) + (column/row-domain + ;; both will be one-dimensional + (make-interval (vector (+ i 1)) (vector n))) + (column + ;; the column below the (i,i) entry + (specialized-array-share A + column/row-domain + (lambda (k) (values k i)))) + (row + ;; the row to the right of the (i,i) entry + (specialized-array-share A + column/row-domain + (lambda (k) (values i k)))) + (subarray + ;; the subarray to the right and below the (i,i) entry + (array-extract A (make-interval (vector (+ i 1) (+ i 1)) (vector n n))))) + ;; set diagonal value + (A! pivot i i) + ;; compute multipliers + (array-assign! column (array-map (lambda (x) (/ x pivot)) column)) + ;; zero the rest of the ith row, preserving exactness + (array-assign! row (make-array column/row-domain + ;; a zero with the same exactness as pivot + (lambda (j) (- pivot pivot)))) + ;; subtract the outer product of i'th + ;; row and column from the subarray + (array-assign! subarray + (array-map - + subarray + (array-outer-product * column column))))))) + +(define Example-1 + (list*->array 2 '((25 15 -5) + (15 18 0) + (-5 0 11)))) + +(define Example-2 + (list*->array 2 '((18 22 54 42) + (22 70 86 62) + (54 86 174 134) + (42 62 134 106)))) + +(pretty-print (array->list* (Cholesky Example-1))) +(newline) +(pretty-print (array->list* (Cholesky Example-2))) diff --git a/Task/Cholesky-decomposition/Wren/cholesky-decomposition.wren b/Task/Cholesky-decomposition/Wren/cholesky-decomposition.wren index b166ba0f51..afd5b0c961 100644 --- a/Task/Cholesky-decomposition/Wren/cholesky-decomposition.wren +++ b/Task/Cholesky-decomposition/Wren/cholesky-decomposition.wren @@ -1,5 +1,5 @@ -import "/matrix" for Matrix -import "/fmt" for Fmt +import "./matrix" for Matrix +import "./fmt" for Fmt var arrays = [ [ [25, 15, -5], diff --git a/Task/Cholesky-decomposition/Zig/cholesky-decomposition.zig b/Task/Cholesky-decomposition/Zig/cholesky-decomposition.zig new file mode 100644 index 0000000000..39a4ebad30 --- /dev/null +++ b/Task/Cholesky-decomposition/Zig/cholesky-decomposition.zig @@ -0,0 +1,64 @@ +const std = @import("std"); + +fn cholesky(mat: []const f64, n: usize, allocator: std.mem.Allocator) ![]f64 { + const res = try allocator.alloc(f64, mat.len); + @memset(res, 0.0); + + for (0..n) |i| { + for (0..i+1) |j| { + var s: f64 = 0.0; + for (0..j) |k| { + s += res[i * n + k] * res[j * n + k]; + } + + res[i * n + j] = if (i == j) + std.math.sqrt(mat[i * n + i] - s) + else + (1.0 / res[j * n + j] * (mat[i * n + j] - s)); + } + } + return res; +} + +fn showMatrix(matrix: []const f64, n: usize) void { + for (0..n) |i| { + for (0..n) |j| { + std.debug.print("{d:.4}\t", .{matrix[i * n + j]}); + } + std.debug.print("\n", .{}); + } + std.debug.print("\n", .{}); +} + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + const allocator = gpa.allocator(); + defer _ = gpa.deinit(); + + { + const dimension: usize = 3; + const m1 = [_]f64{ + 25.0, 15.0, -5.0, + 15.0, 18.0, 0.0, + -5.0, 0.0, 11.0 + }; + + const res1 = try cholesky(&m1, dimension, allocator); + defer allocator.free(res1); + showMatrix(res1, dimension); + } + + { + const dimension: usize = 4; + const m2 = [_]f64{ + 18.0, 22.0, 54.0, 42.0, + 22.0, 70.0, 86.0, 62.0, + 54.0, 86.0, 174.0, 134.0, + 42.0, 62.0, 134.0, 106.0 + }; + + const res2 = try cholesky(&m2, dimension, allocator); + defer allocator.free(res2); + showMatrix(res2, dimension); + } +} diff --git a/Task/Chowla-numbers/ALGOL-68/chowla-numbers.alg b/Task/Chowla-numbers/ALGOL-68/chowla-numbers.alg index 641726dfd2..6fefcfb901 100644 --- a/Task/Chowla-numbers/ALGOL-68/chowla-numbers.alg +++ b/Task/Chowla-numbers/ALGOL-68/chowla-numbers.alg @@ -1,16 +1,33 @@ BEGIN # find some Chowla numbers ( Chowla n = sum of divisors of n exclusing n and 1 ) # + + # returns the divisor sums of [1 n], the sums exclude 1 and n # + PROC sum divisors = ( INT n )[]INT: + BEGIN + [ 1 : n ]INT sums; + FOR i TO n DO sums[ i ] := 0 OD; + FOR i FROM 2 TO n DO + FOR j FROM i + i BY i TO n DO sums[ j ] +:= i OD + OD; + sums + END # sum divisors # ; + + []INT ds = sum divisors( 10 000 000 ); # get a table of divisor sums for 1..n # + # returs the Chowla number of n # PROC chowla = ( INT n )INT: - BEGIN - INT sum := 0; - FOR i FROM 2 WHILE i * i <= n DO - IF n MOD i = 0 THEN - INT j = n OVER i; - sum +:= i + IF i = j THEN 0 ELSE j FI - FI - OD; - sum - END # chowla # ; + IF n < 2 + THEN 0 + ELIF n <= UPB ds - LWB ds + 1 + THEN ds[ n ] + ELSE INT sum := 0; + FOR i FROM 2 WHILE i * i <= n DO + IF n MOD i = 0 THEN + INT j = n OVER i; + sum +:= i + IF i = j THEN 0 ELSE j FI + FI + OD; + sum + FI # chowla # ; FOR n TO 37 DO print( ( "chowla(", whole( n, 0 ), ") = ", whole( chowla( n ), 0 ), newline ) ) OD; @@ -23,7 +40,7 @@ BEGIN # find some Chowla numbers ( Chowla n = sum of divisors of n exclusing n a FI OD; count := 0; - INT limit = 350 000 000; + INT limit = 35 000 000; INT k := 2, kk := 3; WHILE INT p = k * kk; p <= limit diff --git a/Task/Chowla-numbers/Ada/chowla-numbers.ada b/Task/Chowla-numbers/Ada/chowla-numbers.ada deleted file mode 100644 index 8b9451b145..0000000000 --- a/Task/Chowla-numbers/Ada/chowla-numbers.ada +++ /dev/null @@ -1,70 +0,0 @@ -with Ada.Text_IO; - -procedure Chowla_Numbers is - - function Chowla (N : Positive) return Natural is - Sum : Natural := 0; - I : Positive := 2; - J : Positive; - begin - while I * I <= N loop - if N mod I = 0 then - J := N / I; - Sum := Sum + I + (if I = J then 0 else J); - end if; - I := I + 1; - end loop; - return Sum; - end Chowla; - - procedure Put_37_First is - use Ada.Text_IO; - begin - for A in Positive range 1 .. 37 loop - Put_Line ("chowla(" & A'Image & ") = " & Chowla (A)'Image); - end loop; - end Put_37_First; - - procedure Put_Prime is - use Ada.Text_IO; - Count : Natural := 0; - Power : Positive := 100; - begin - for N in Positive range 2 .. 10_000_000 loop - if Chowla (N) = 0 then - Count := Count + 1; - end if; - if N mod Power = 0 then - Put_Line ("There is " & Count'Image & " primes < " & Power'Image); - Power := Power * 10; - end if; - end loop; - end Put_Prime; - - procedure Put_Perfect is - use Ada.Text_IO; - Count : Natural := 0; - Limit : constant := 350_000_000; - K : Natural := 2; - Kk : Natural := 3; - P : Natural; - begin - loop - P := K * Kk; - exit when P > Limit; - - if Chowla (P) = P - 1 then - Put_Line (P'Image & " is a perfect number"); - Count := Count + 1; - end if; - K := Kk + 1; - Kk := Kk + K; - end loop; - Put_Line ("There are " & Count'Image & " perfect numbers < " & Limit'Image); - end Put_Perfect; - -begin - Put_37_First; - Put_Prime; - Put_Perfect; -end Chowla_Numbers; diff --git a/Task/Chowla-numbers/Ada/chowla-numbers.adb b/Task/Chowla-numbers/Ada/chowla-numbers.adb new file mode 100644 index 0000000000..4f48ba270c --- /dev/null +++ b/Task/Chowla-numbers/Ada/chowla-numbers.adb @@ -0,0 +1,70 @@ +with Ada.Text_IO; + +procedure Chowla_Numbers is + + function Chowla (N : Positive) return Natural is + Sum : Natural := 0; + I : Positive := 2; + J : Positive; + begin + while I * I <= N loop + if N mod I = 0 then + J := N / I; + Sum := Sum + I + (if I = J then 0 else J); + end if; + I := I + 1; + end loop; + return Sum; + end Chowla; + + procedure Put_37_First is + use Ada.Text_IO; + begin + for A in Positive range 1 .. 37 loop + Put_Line ("chowla(" & A'Image & ") = " & Chowla (A)'Image); + end loop; + end Put_37_First; + + procedure Put_Prime is + use Ada.Text_IO; + Count : Natural := 0; + Power : Positive := 100; + begin + for N in Positive range 2 .. 10_000_000 loop + if Chowla (N) = 0 then + Count := Count + 1; + end if; + if N mod Power = 0 then + Put_Line ("There are " & Count'Image & " primes < " & Power'Image); + Power := Power * 10; + end if; + end loop; + end Put_Prime; + + procedure Put_Perfect is + use Ada.Text_IO; + Count : Natural := 0; + Limit : constant := 350_000_000; + K : Natural := 2; + Kk : Natural := 3; + P : Natural; + begin + loop + P := K * Kk; + exit when P > Limit; + + if Chowla (P) = P - 1 then + Put_Line (P'Image & " is a perfect number"); + Count := Count + 1; + end if; + K := Kk + 1; + Kk := Kk + K; + end loop; + Put_Line ("There are " & Count'Image & " perfect numbers < " & Limit'Image); + end Put_Perfect; + +begin + Put_37_First; + Put_Prime; + Put_Perfect; +end Chowla_Numbers; diff --git a/Task/Chowla-numbers/Agena/chowla-numbers.agena b/Task/Chowla-numbers/Agena/chowla-numbers.agena new file mode 100644 index 0000000000..f483192c9a --- /dev/null +++ b/Task/Chowla-numbers/Agena/chowla-numbers.agena @@ -0,0 +1,57 @@ +scope # find some Chowla numbers ( Chowla n = sum of divisors of n exclusing n and 1 ) + + # returns the divisor sums of [1 n], the sums exclude 1 and n + local proc sumDivisors( n :: number ) :: sequence + local constant sums := seq(); + for i to n do sums[ i ] := 0 od; + for i from 2 to n do + for j from i + i to n by i do sums[ j ] +:= i od + od; + return sums + end; + + local constant ds := sumDivisors( 10_000_000 ); + + local proc chowla( n :: number ) :: number # returns the Chowla number of n + local sum := 0; + if n > 0 then + if n <= size ds then + sum := ds[ n ] + else + for i from 2 while i * i <= n do + if n mod i = 0 then + local constant j := n \ i; + sum +:= i + if i = j then 0 else j fi + fi + od + fi + fi; + return sum + end; + + # first 37 chowla numbers + for n to 37 do printf( "chowla(%d) = %d\n", n, chowla( n ) ) od; + + # number of primes up to 10_000_000 + local count, power := 0, 100; + for n from 2 to 10_000_000 do + if chowla( n ) = 0 then count +:= 1 fi; + if n mod power = 0 then + printf( "There are %6d primes < %d\n", count, power ); + power *:= 10 + fi + od; + + # perfect numbers to 35_000_000 + local constant perfectMax := 35_000_000; + count := 0; + local k, kk, p := 2, 3, 6; # p is k * kk; + while p <= perfectMax do + if chowla( p ) = p - 1 then + printf( " %8d is a perfect number\n", p ); + count +:= 1 + fi; + k := kk + 1; kk +:= k; p := k * kk + od; + printf( "There are %d perfect numbers < %d\n", count, perfectMax ) +end diff --git a/Task/Chowla-numbers/EMal/chowla-numbers.emal b/Task/Chowla-numbers/EMal/chowla-numbers.emal index ae58e913ba..cd3aa6dcee 100644 --- a/Task/Chowla-numbers/EMal/chowla-numbers.emal +++ b/Task/Chowla-numbers/EMal/chowla-numbers.emal @@ -1,44 +1,44 @@ -fun chowla = int by int n - int sum = 0 - int j = 0 - for int i = 2; i * i <= n; i++ do - if n % i == 0 do sum += i + when(i == (j = n / i), 0, j) end +fun chowla ← int by int n + int sum ← 0 + int j ← 0 + for int i ← 2; i * i ≤ n; ++i do + if n % i æ 0 do sum += i + when(i æ (j ← n / i), 0, j) end end return sum end -fun sieve = List by int limit - List c = logic[].with(limit) - for int i = 3; i * 3 < limit; i += 2 - if c[i] or chowla(i) != 0 do continue end - for int j = 3 * i; j < limit; j += 2 * i do c[j] = true end +fun sieve ← List by int limit + List c ← logic[].with(limit) + for int i ← 3; i * 3 < limit; i += 2 + if c[i] or chowla(i) ≠ 0 do continue end + for int j ← 3 * i; j < limit; j += 2 * i do c[j] ← true end end return c end # find and display (1 per line) for the 1st 37 integers -for int i = 1; i <= 37; i++ do writeLine("chowla(" + i + ") = " + chowla(i)) end -int count = 1 -int limit = 10000000 -int power = 100 -List c = sieve(limit) -for int i = 3; i < limit; i += 2 - if not c[i] do count++ end - if i == power - 1 - writeLine("Count of primes up to " + power + " = " + count) +for int i ← 1; i ≤ 37; ++i do writeLine("chowla(" + i + ") = ", chowla(i)) end +int count ← 1 +int limit ← 10000000 +int power ← 100 +List c ← sieve(limit) +for int i ← 3; i < limit; i += 2 + if not c[i] do ++count end + if i æ power - 1 + writeLine("Count of primes up to ", power, " = ", count) power *= 10 end end -count = 0 -limit = 35000000 -int k = 2 -int kk = 3 +count ← 0 +limit ← 35000000 +int k ← 2 +int kk ← 3 int p -for int i = 2; ; i++ - if (p = k * kk) > limit do break end - if chowla(p) == p - 1 - writeLine(p + " is a number that is perfect") - count++ +for int i ← 2; ; ++i + if (p ← k * kk) > limit do break end + if chowla(p) æ p - 1 + writeLine(p, " is a number that is perfect") + ++count end - k = kk + 1 + k ← kk + 1 kk += k end -writeLine("There are " + count + " perfect numbers <= 35,000,000") +writeLine("There are ", count, " perfect numbers ≤ 35,000,000") diff --git a/Task/Chowla-numbers/EasyLang/chowla-numbers.easy b/Task/Chowla-numbers/EasyLang/chowla-numbers.easy index 612642b535..3cecf7520f 100644 --- a/Task/Chowla-numbers/EasyLang/chowla-numbers.easy +++ b/Task/Chowla-numbers/EasyLang/chowla-numbers.easy @@ -1,5 +1,4 @@ fastfunc chowla n . - sum = 0 i = 2 while i * i <= n if n mod i = 0 @@ -14,7 +13,7 @@ fastfunc chowla n . . return sum . -proc sieve . c[] . +proc sieve &c[] . i = 3 while i * 3 <= len c[] if c[i] = 0 @@ -29,23 +28,22 @@ proc sieve . c[] . i += 2 . . -proc commatize n . s$ . +func$ comma n . s$[] = strchars n s$ = "" l = len s$[] for i = 1 to len s$[] - if i > 1 and l mod 3 = 0 - s$ &= "," - . + if i > 1 and l mod 3 = 0 : s$ &= "," l -= 1 s$ &= s$[i] . + return s$ . print "chowla number from 1 to 37" for i = 1 to 37 print " " & i & ": " & chowla i . -proc main . . +proc main . print "" len c[] 10000000 count = 1 @@ -53,13 +51,9 @@ proc main . . power = 100 i = 3 while i <= len c[] - if c[i] = 0 - count += 1 - . + if c[i] = 0 : count += 1 if i = power - 1 - commatize power p$ - commatize count c$ - print "There are " & c$ & " primes up to " & p$ + print "There are " & comma count & " primes up to " & comma power power *= 10 . i += 2 @@ -74,15 +68,13 @@ proc main . . p = k * kk until p > limit if chowla p = p - 1 - commatize p s$ - print s$ & " is a perfect number" + print comma p & " is a perfect number" count += 1 . k = kk + 1 kk += k i += 1 . - commatize limit s$ - print "There are " & count & " perfect mumbers up to " & s$ + print "There are " & count & " perfect mumbers up to " & comma limit . main diff --git a/Task/Chowla-numbers/Fennel/chowla-numbers.fennel b/Task/Chowla-numbers/Fennel/chowla-numbers.fennel new file mode 100644 index 0000000000..5bfb4bd8c4 --- /dev/null +++ b/Task/Chowla-numbers/Fennel/chowla-numbers.fennel @@ -0,0 +1,61 @@ +(do ;;; find some Chowla numbers ( Chowla n = sum of divisors of n exclusing n and 1 ) + + (fn sum-divisors [n] + (local sums {}) + (for [i 1 n] (tset sums i 0)) + (for [i 2 n] + (for [j (+ i i) n i] (tset sums j (+ (. sums j) i))) + ) + sums + ) + + (local ds (sum-divisors 10_000_000)) + + (fn chowla [n] ; returns the Chowla number of n + (var sum 0) + (when (> n 0) + (if (<= n (length ds)) + (set sum (. ds n)) + ;else + (for [i 2 (math.floor (math.sqrt n))] + (when (= 0 (% n i)) + (local j (math.floor (/ n i))) + (set sum (+ sum i (if (= i j) 0 j))) + ) + ) + ) + ) + sum + ) + + + ; first 37 chowla numbers + (for [n 1 37] (print (.. "chowla(" n ") = " (chowla n)))) + + ; number of primes up to 10_000_000 + (var (count power) (values 0 100)) + (for [n 2 10_000_000] + (when (= 0 (chowla n)) + (set count (+ count 1)) + ) + (when (= 0 (% n power)) + (print (string.format "There are %6d primes < %d" count power)) + (set power (* power 10)) + ) + ) + + ; perfect numbers to 35_000_000 + (local perfect-max 35_000_000) + (set count 0) + (var (k kk p) (values 2 3 6)) ; p is k * kk + (while (<= p perfect-max) + (when (= (chowla p) (- p 1)) + (print (string.format " %8d is a perfect number" p)) + (set count (+ count 1)) + ) + (set k (+ kk 1)) + (set kk (+ kk k)) + (set p (* kk k)) + ) + (print (.. "There are " count " perfect numbers < " perfect-max)) +) diff --git a/Task/Chowla-numbers/Fortran/chowla-numbers.f b/Task/Chowla-numbers/Fortran/chowla-numbers.f new file mode 100644 index 0000000000..9da7c28d01 --- /dev/null +++ b/Task/Chowla-numbers/Fortran/chowla-numbers.f @@ -0,0 +1,114 @@ + PROGRAM CHOWLA + + CALL PUT_1ST_37 + CALL PUT_PRIME + CALL PUT_PERFECT + + END + + INTEGER*4 FUNCTION CHOWLA1(N) + +C The Chowla number of N is the sum of the divisors of N +C excluding unity and N where N is a positive integer + + IMPLICIT INTEGER*4 (A-Z) + + IF (N .LE. 0) STOP 'Argument to Chowla function must be > 0' + + SUM = 0 + I = 2 + + 100 CONTINUE + IF (I * I .GT. N) GOTO 200 + + IF (MOD(N, I) .NE. 0) GOTO 110 + J = N / I + SUM = SUM + I + IF ( I .NE. J) SUM = SUM + J + 110 CONTINUE + + I = I + 1 + GOTO 100 + + 200 CONTINUE + + CHOWLA1 = SUM + + RETURN + + END + + SUBROUTINE PUT_1ST_37 + IMPLICIT INTEGER*4 (A-Z) + + DO 100 I = 1, 37 + PRINT 900, I, CHOWLA1(I) + 100 CONTINUE + + RETURN + + 900 FORMAT(1H , 'CHOWLA(', I2, ') = ', I2) + + END + + SUBROUTINE PUT_PRIME + IMPLICIT INTEGER*4 (A-Z) + PARAMETER LIMIT = 10000000 + + COUNT = 0 + POWER = 100 + + DO 200 N = 2, LIMIT + + IF (CHOWLA1(N) .EQ. 0) COUNT = COUNT + 1 + + IF (MOD(N, POWER) .NE. 0) GOTO 100 + + PRINT 900, COUNT, POWER + POWER = POWER * 10 + + 100 CONTINUE + + 200 CONTINUE + + RETURN + + 900 FORMAT(1H ,'There are ', I12, ' primes < ', I12) + + END + + SUBROUTINE PUT_PERFECT + IMPLICIT INTEGER*4 (A-Z) + PARAMETER LIMIT = 35000000 + + COUNT = 0 + K = 2 + KK = 3 + + 100 CONTINUE + + P = K * KK + + IF (P .GT. LIMIT) GOTO 300 + + IF (CHOWLA1(P) .NE. P - 1) GOTO 200 + PRINT 900, P + COUNT = COUNT + 1 + + 200 CONTINUE + + K = KK + 1 + KK = KK + K + + GOTO 100 + + 300 CONTINUE + + PRINT 910, COUNT, LIMIT + + RETURN + + 900 FORMAT(1H , I10, ' is a perfect number') + 910 FORMAT(1H , 'There are ', I10, ' perfect numbers < ', I10) + + END diff --git a/Task/Chowla-numbers/JavaScript/chowla-numbers.js b/Task/Chowla-numbers/JavaScript/chowla-numbers.js new file mode 100644 index 0000000000..1ff725b65f --- /dev/null +++ b/Task/Chowla-numbers/JavaScript/chowla-numbers.js @@ -0,0 +1,79 @@ +// Chowla function: calculates sum of proper divisors of n (excluding n itself) +function chowla(n) { + let sum = 0; + for (let i = 2; i * i <= n; i++) { + if (n % i === 0) { + const j = n / i; + sum += i + (i === j ? 0 : j); + } + } + return sum; +} + +// Sieve function: returns array where true denotes composite, false denotes prime +// Only interested in odd numbers >= 3 +function sieve(limit) { + // True denotes composite, false denotes prime + const c = new Array(limit).fill(false); + + for (let i = 3; i * 3 < limit; i += 2) { + if (!c[i] && chowla(i) === 0) { + for (let j = 3 * i; j < limit; j += 2 * i) { + c[j] = true; + } + } + } + return c; +} + +// Main execution +function main() { + // Part 1: Print chowla values for 1-37 + console.log("Chowla function values for 1-37:"); + for (let i = 1; i <= 37; i++) { + console.log(`chowla(${i}) = ${chowla(i)}`); + } + console.log("\n"); + + // Part 2: Count primes up to powers of 10 + console.log("Prime counting using Chowla's sieve:"); + let count = 1; + const limit = 10000000; // 1e7 + let power = 100; + + const c = sieve(limit); + + for (let i = 3; i < limit; i += 2) { + if (!c[i]) count++; + + if (i === power - 1) { + console.log(`Count of primes up to ${power.toLocaleString()} = ${count.toLocaleString()}`); + power *= 10; + } + } + console.log("\n"); + + // Part 3: Find perfect numbers + console.log("Perfect numbers <= 35,000,000:"); + count = 0; + const perfectLimit = 35000000; + + let k = 2, kk = 3, p; + for (let i = 2; ; i++) { + p = k * kk; + if (p > perfectLimit) break; + + if (chowla(p) === p - 1) { + console.log(`${p.toLocaleString()} is a perfect number`); + count++; + } + + k = kk + 1; + kk += k; + } + + console.log(`\nThere are ${count} perfect numbers <= 35,000,000`); +} + +// Execute the main function +main(); diff --git a/Task/Chowla-numbers/Julia/chowla-numbers.jl b/Task/Chowla-numbers/Julia/chowla-numbers.jl new file mode 100644 index 0000000000..1402756727 --- /dev/null +++ b/Task/Chowla-numbers/Julia/chowla-numbers.jl @@ -0,0 +1,40 @@ +using Primes, Format + +function chowla(n) + if n < 1 + throw("Chowla function argument must be positive") + elseif n < 4 + return zero(n) + else + f = [one(n)] + for (p,e) in factor(n) + f = reduce(vcat, [f*p^j for j in 1:e], init=f) + end + return sum(f) - one(n) - n + end +end + +function countchowlas(n, asperfect=false, verbose=false) + count = 0 + for i in 2:n # 1 is not prime or perfect so skip + chow = chowla(i) + if (asperfect && chow == i - 1) || (!asperfect && chow == 0) + count += 1 + verbose && println("The number $(format(i, commas=true)) is ", asperfect ? "perfect." : "prime.") + end + end + count +end + +function testchowla() + println("The first 37 chowla numbers are:") + for i in 1:37 + println("Chowla($i) is ", chowla(i)) + end + for i in [100, 1000, 10000, 100000, 1000000, 10000000] + println("The count of the primes up to $(format(i, commas=true)) is $(format(countchowlas(i), commas=true))") + end + println("The count of perfect numbers up to 35,000,000 is $(countchowlas(35000000, true, true)).") +end + +testchowla() diff --git a/Task/Chowla-numbers/Julia/chowla-numbers.julia b/Task/Chowla-numbers/Julia/chowla-numbers.julia deleted file mode 100644 index cc27df514d..0000000000 --- a/Task/Chowla-numbers/Julia/chowla-numbers.julia +++ /dev/null @@ -1,40 +0,0 @@ -using Primes, Formatting - -function chowla(n) - if n < 1 - throw("Chowla function argument must be positive") - elseif n < 4 - return zero(n) - else - f = [one(n)] - for (p,e) in factor(n) - f = reduce(vcat, [f*p^j for j in 1:e], init=f) - end - return sum(f) - one(n) - n - end -end - -function countchowlas(n, asperfect=false, verbose=false) - count = 0 - for i in 2:n # 1 is not prime or perfect so skip - chow = chowla(i) - if (asperfect && chow == i - 1) || (!asperfect && chow == 0) - count += 1 - verbose && println("The number $(format(i, commas=true)) is ", asperfect ? "perfect." : "prime.") - end - end - count -end - -function testchowla() - println("The first 37 chowla numbers are:") - for i in 1:37 - println("Chowla($i) is ", chowla(i)) - end - for i in [100, 1000, 10000, 100000, 1000000, 10000000] - println("The count of the primes up to $(format(i, commas=true)) is $(format(countchowlas(i), commas=true))") - end - println("The count of perfect numbers up to 35,000,000 is $(countchowlas(35000000, true, true)).") -end - -testchowla() diff --git a/Task/Chowla-numbers/Kotlin/chowla-numbers.kotlin b/Task/Chowla-numbers/Kotlin/chowla-numbers.kts similarity index 100% rename from Task/Chowla-numbers/Kotlin/chowla-numbers.kotlin rename to Task/Chowla-numbers/Kotlin/chowla-numbers.kts diff --git a/Task/Chowla-numbers/Maxima/chowla-numbers.maxima b/Task/Chowla-numbers/Maxima/chowla-numbers.maxima new file mode 100644 index 0000000000..be58f3e5ab --- /dev/null +++ b/Task/Chowla-numbers/Maxima/chowla-numbers.maxima @@ -0,0 +1,13 @@ +chowla(n) := if(n=1) then 0 else divsum(n)-n-1$ +chowla_seq(n, start) := map(chowla, makelist(i,i,start,n))$ +chowla_seq(37, 1); + +chowla_numprimes(n) := length(sublist_indices(chowla_seq(n, 2), lambda([x], x=0)))$ +map(chowla_numprimes, makelist(10^i, i, 2, 7)); + +chowla_perfects(n) := block( + chowla_list: chowla_seq(n, 1), + is_perfect(x) := if(x>n or x=0) then false else x=chowla_list[x+1], + unique(sublist(chowla_list, is_perfect)+1))$ + +chowla_perfects(10000); diff --git a/Task/Chowla-numbers/PARI-GP/chowla-numbers.parigp b/Task/Chowla-numbers/PARI-GP/chowla-numbers.parigp new file mode 100644 index 0000000000..a3b5237301 --- /dev/null +++ b/Task/Chowla-numbers/PARI-GP/chowla-numbers.parigp @@ -0,0 +1,28 @@ +chowla(n) = { + if (n < 1, error("Chowla function argument must be positive")); + if (n < 4, return(0)); + my(divs = divisors(n)); + sum(i=1, #divs, divs[i]) - n - 1; +} + +\\ Function to count Chowla numbers +countchowlas(n, asperfect = 1, verbose = 1) = { + my(count = 0, chow, i); + for (i = 2, n, + chow = chowla(i); + if ( (asperfect && (chow == i - 1)) || ((!asperfect) && (chow == 0)), + count++; + if (verbose, print("The number " i " is " if (asperfect, "perfect.", "prime."))); + ); + ); + count; +} + +\\ Main execution block +{ + print("The first 37 chowla numbers are:"); + for (i = 1, 37, printf("Chowla(%s) is %s\n", Str(i), Str(chowla(i)) ) ); + m=100; + while(m<=10000000, print("The count of the primes up to " m " is " countchowlas(m, 0, 0)); m=m*10); + print("The count of perfect numbers up to 35,000,000 is " countchowlas(35000000, 1, 1)); +} diff --git a/Task/Chowla-numbers/PascalABC.NET/chowla-numbers.pas b/Task/Chowla-numbers/PascalABC.NET/chowla-numbers.pas new file mode 100644 index 0000000000..7274f05fc9 --- /dev/null +++ b/Task/Chowla-numbers/PascalABC.NET/chowla-numbers.pas @@ -0,0 +1,54 @@ +function chowla(n: Integer): Integer; +begin + result := 0; + var i := 2; + while i * i <= n do + begin + if n mod i = 0 then + result += i + (if i = n div i then 0 else n div i); + i += 1 + end; +end; + +function sieve(limit: Integer): array of Boolean; +begin + result := new Boolean[limit]; + for var i := 3 to limit div 3 step 2 do + if not result[i] and (chowla(i) = 0) Then + for var j := 3 * i to limit step 2 * i do + result[j] := true; +end; + +begin + for var i := 1 To 37 do + WriteLn('chowla(', i, ') = ', chowla(i)); + + var count := 1; + var limit := 10_000_000; + var power := 100; + var c := sieve(limit); + for var i := 3 To limit Step 2 do + begin + if not c[i] Then count += 1; + if i = power - 1 Then begin + WriteLn('Count of primes up to ', power:8, ' = ', count); + power *= 10; + end; + end; + + count := 0; + limit := 35_000_000; + var k := 2; var kk := 3; + while True do + begin + var p := k * kk; + if p > limit Then break; + if chowla(p) = p - 1 Then begin + WriteLn(p:8, ' is a number that is perfect'); + count += 1; + end; + k := kk + 1; + kk += k; + end; + WriteLn('There are ', count, ' perfect numbers <= 35,000,000') +end. diff --git a/Task/Chowla-numbers/Pluto/chowla-numbers.pluto b/Task/Chowla-numbers/Pluto/chowla-numbers.pluto new file mode 100644 index 0000000000..7170013ac8 --- /dev/null +++ b/Task/Chowla-numbers/Pluto/chowla-numbers.pluto @@ -0,0 +1,57 @@ +do -- find some Chowla numbers ( Chowla n = sum of divisors of n exclusing n and 1 ) + + -- returns the divisor sums of [1 n], the sums exclude 1 and n + local function sumDivisors( n : number ) : table + local sums = {} + for i = 1, n do sums[ i ] = 0 end + for i = 2, n do + for j = i + i, n, i do sums[ j ] += i end + end + return sums + end + + local ds = sumDivisors( 10_000_000 ) + + local function chowla( n : number ) : number -- returns the Chowla number of n + local sum = 0 + if n > 0 then + if n <= # ds then + sum = ds[ n ] + else + for i = 2, math.floor( math.sqrt( n ) ) do + if n % i == 0 then + local j = n // i + sum += i + if i == j then 0 else j end + end + end + end + end + return sum + end + + -- first 37 chowla numbers + for n = 1, 37 do print( $"chowla({n}) = {chowla(n)}" ) end + + -- number of primes up to 10_000_000 + local count, power = 0, 100 + for n = 2, 10_000_000 do + if chowla( n ) == 0 then count += 1 end + if n % power == 0 then + print( string.format( "There are %6d primes < %d", count, power ) ) + power *= 10 + end + end + + -- perfect numbers to 35_000_000 + local perfectMax = 35_000_000 + count = 0 + local k, kk, p = 2, 3, 6 -- p is k * kk + while p <= perfectMax do + if chowla( p ) == p - 1 then + print( string.format( " %8d is a perfect number", p ) ) + count += 1 + end + k = kk + 1; kk += k; p = k * kk + end + print( $"There are {count} perfect numbers < {perfectMax}" ) +end diff --git a/Task/Chowla-numbers/Quackery/chowla-numbers.quackery b/Task/Chowla-numbers/Quackery/chowla-numbers.quackery new file mode 100644 index 0000000000..6fc47e0c39 --- /dev/null +++ b/Task/Chowla-numbers/Quackery/chowla-numbers.quackery @@ -0,0 +1,31 @@ + [ 2 max + dup sqrt+ + iff 0 else [ dup negate ] + unrot + times + [ dup i^ 1+ /mod + 0 = iff + [ i^ 1+ + + swap dip + ] + else drop ] + 1+ - ] is chowla ( n --> n ) + + 37 times + [ say "chowla(" + i^ 1+ dup echo + say ")= " + chowla echo cr ] + cr + ' [ 100 1000 10000 100000 1000000 10000000 ] + witheach + [ 0 over 2 - times + [ i^ 2 + chowla 0 = + ] + say "There are " echo + say " primes less than " + echo cr ] + cr + 35000000 2 - times + [ i^ 2 + dup chowla 1+ = if + [ i^ 2 + echo + say " is perfect" + cr ] ] diff --git a/Task/Chowla-numbers/REXX/chowla-numbers.rexx b/Task/Chowla-numbers/REXX/chowla-numbers.rexx index 54447064f1..7f52a942e8 100644 --- a/Task/Chowla-numbers/REXX/chowla-numbers.rexx +++ b/Task/Chowla-numbers/REXX/chowla-numbers.rexx @@ -1,29 +1,73 @@ -/*REXX program computes/displays chowla numbers (and may count primes & perfect numbers.*/ -parse arg LO HI . /*obtain optional arguments from the CL*/ -if LO=='' | LO=="," then LO= 1 /*Not specified? Then use the default.*/ -perf= LO<0; LO= abs(LO) /*Negative? Then determine if perfect.*/ -if HI=='' | HI=="," then HI= LO /*Not specified? Then use the default.*/ -prim= HI<0; HI= abs(HI) /*Negative? Then determine if a prime.*/ -numeric digits max(9, length(HI) + 1 ) /*use enough decimal digits for // */ -w= length( commas(HI) ) /*W: used in aligning output numbers.*/ -tell= \(prim | perf) /*set boolean value for showing chowlas*/ -p= 0 /*the number of primes found (so far).*/ - do j=LO to HI; #= chowla(j) /*compute the cholwa number for J. */ - if tell then say right('chowla('commas(j)")", w+9) ' = ' right( commas(#), w) - else if #==0 then if j>1 then p= p+1 - if perf then if j-1==# & j>1 then say right(commas(j), w) ' is a perfect number.' - end /*j*/ +-- 21 Feb 2026 +include Setting +numeric digits 12 -if prim & \perf then say 'number of primes found for the range ' commas(LO) " to " , - commas(HI) " (inclusive) is: " commas(p) -exit /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -chowla: procedure; parse arg x; if x<2 then return 0; odd= x // 2 - s=0 /* [↓] use EVEN or ODD integers. ___*/ - do k=2+odd by 1+odd while k*k d then do + say Right(10**e,8) Right(n,8) + d = e + end + if work.i = 0 then + iterate i + if Chowla(i) = 0 then do + n = n+1 + if i > 1 then do + j = i+i + do while j < m + work.j = 0; j = j+i + end + end + end +end +say sep +return + +PerfectNumbers: +procedure expose Divi. Memo. +sep = Copies('-',12) +say sep; say Right('Perfect',12); say sep +k = 2; kk = 3; m = 140e9; n = 0 +do forever + p = k * kk + if p > 140e9 then + leave + if Chowla(p) = p-1 then do + n = n+1 + say Right(p,12) + end + k = kk+1; kk = kk+k +end +say sep +say n 'perfect numbers found below 140e9' +return + +-- Chowla; Xpon; Timer +include Math diff --git a/Task/Chowla-numbers/Rust/chowla-numbers.rs b/Task/Chowla-numbers/Rust/chowla-numbers.rs new file mode 100644 index 0000000000..bb9e557d57 --- /dev/null +++ b/Task/Chowla-numbers/Rust/chowla-numbers.rs @@ -0,0 +1,69 @@ +fn chowla(n: usize) -> usize { + let mut sum = 0; + let mut i = 2; + while i * i <= n { + if n % i == 0 { + sum += i; + let j = n / i; + if i != j { + sum += j; + } + } + i += 1; + } + sum +} + +fn sieve(limit: usize) -> Vec { + let mut c = vec![false; limit]; + let mut i = 3; + while i * i < limit { + if !c[i] && chowla(i) == 0 { + let mut j = 3 * i; + while j < limit { + c[j] = true; + j += 2 * i; + } + } + i += 2; + } + c +} + +fn main() { + for i in 1..=37 { + println!("chowla({}) = {}", i, chowla(i)); + } + + let mut count = 1; + let limit = 1e7 as usize; + let mut power = 100; + let c = sieve(limit); + for i in (3..limit).step_by(2) { + if !c[i] { + count += 1; + } + if i == power - 1 { + println!("Count of primes up to {} = {}", power, count); + power *= 10; + } + } + + count = 0; + let limit = 35000000; + let mut k = 2; + let mut kk = 3; + loop { + let p = k * kk; + if p > limit { + break; + } + if chowla(p) == p - 1 { + println!("{} is a number that is perfect", p); + count += 1; + } + k = kk + 1; + kk += k; + } + println!("There are {} perfect numbers <= 35,000,000", count); +} diff --git a/Task/Chowla-numbers/Zig/chowla-numbers.zig b/Task/Chowla-numbers/Zig/chowla-numbers.zig new file mode 100644 index 0000000000..2aac5c07f3 --- /dev/null +++ b/Task/Chowla-numbers/Zig/chowla-numbers.zig @@ -0,0 +1,77 @@ +const std = @import("std"); + +/// Calculates the sum of proper divisors of n (excluding n itself) +fn chowla(n: usize) usize { + var sum: usize = 0; + var i: usize = 2; + while (i * i <= n) : (i += 1) { + if (n % i == 0) { + const j = n / i; + sum += i; + if (i != j) sum += j; + } + } + return sum; +} + +/// Creates a sieve of Eratosthenes for finding primes +/// Returns a slice where true denotes composite, false denotes prime +fn sieve(limit: usize) []bool { + const allocator = std.heap.page_allocator; + const c = allocator.alloc(bool, limit) catch unreachable; + @memset(c, false); + + var i: usize = 3; + while (i * 3 < limit) : (i += 2) { + if (!c[i] and chowla(i) == 0) { + var j: usize = 3 * i; + while (j < limit) : (j += 2 * i) { + c[j] = true; + } + } + } + return c; +} + +pub fn main() void { + // Demonstrate chowla function for numbers 1-37 + var i: usize = 1; + while (i <= 37) : (i += 1) { + std.debug.print("chowla({}) = {}\n", .{ i, chowla(i) }); + } + + // Count primes up to 10 million + const limit = 10_000_000; + const c = sieve(limit); + var count: usize = 1; + var power: usize = 100; + + i = 3; + while (i < limit) : (i += 2) { + if (!c[i]) count += 1; + if (i == power - 1) { + std.debug.print("Count of primes up to {} = {}\n", .{ power, count }); + power *= 10; + } + } + + // Find perfect numbers using the formula: p = k * (k+1) / 2 where + // p is perfect if and only if 2^k - 1 is prime (Mersenne prime) + const perfect_limit = 35_000_000; + var perfect_count: usize = 0; + var k: usize = 2; + var kk: usize = 3; + + while (true) { + const p = k * kk; + if (p > perfect_limit) break; + if (chowla(p) == p - 1) { + std.debug.print("{} is a number that is perfect\n", .{p}); + perfect_count += 1; + } + k = kk + 1; + kk += k; + } + + std.debug.print("There are {} perfect numbers <= 35,000,000\n", .{perfect_count}); +} diff --git a/Task/Church-numerals/Applesoft-BASIC/church-numerals.basic b/Task/Church-numerals/Applesoft-BASIC/church-numerals.basic new file mode 100644 index 0000000000..954ef14625 --- /dev/null +++ b/Task/Church-numerals/Applesoft-BASIC/church-numerals.basic @@ -0,0 +1,29 @@ + 0 DIM OP(13),N(13),X(13,1):READ OP(ZERO),N(ZERO),X(ZERO,0),X(ZERO,1):CN = CN + 1:DATA1,0,0,1 + 1 C = ZERO:GOSUB 10:C=R:GOSUB 10:C=R:GOSUB 10:THREE = R + 2 C = THREE :GOSUB 10:FOUR = R + 3 C = THREE :GOSUB 80:PRINT "THREE -> "R + 4 C = FOUR :GOSUB 80:PRINT "FOUR -> "R + 5 C = THREE:D = FOUR :GOSUB 50:C = R:GOSUB 80:PRINT "THREE + FOUR -> "R + 6 C = THREE:D = FOUR :GOSUB 60:C = R:GOSUB 80:PRINT "THREE * FOUR -> "R + 7 C = THREE:D = FOUR :GOSUB 70:C = R:GOSUB 80:PRINT "THREE ^ FOUR -> "R + 8 C = FOUR :D = THREE:GOSUB 70:C = R:GOSUB 80:PRINT "FOUR ^ THREE -> "R + 9 I = 5 :GOSUB 90:C = R:GOSUB 80:PRINT "5 -> FIVE -> "R;:END +REM SUCC + 10 R = CN:OP(R) = OP(C):N(R) = N(C) + 1:X(R,0) = X(C,0):X(R,1) = X(C,1):CN = CN + 1:RETURN +REM SUM + 20 FOR I = 1 TO N:A = A + B:NEXT I:R = A:RETURN +REM MUL + 30 FOR I = 1 TO N:A = A * B:NEXT I:R = A:RETURN +REM POW + 40 FOR I = 1 TO N:A = A ^ B:NEXT I:R = INT (A):RETURN +REM CHURCH SUM + 50 RES = CN:OP(RES) = 1:N(RES) = 1:X(RES,0) = N(C):X(RES,1) = N(D):CN = CN + 1:R = RES:RETURN +REM CHURCH MUL + 60 RES = CN:OP(RES) = 2:N(RES) = 1:X(RES,0) = N(C):X(RES,1) = N(D):CN = CN + 1:R = RES:RETURN +REM CHURCH POW + 70 RES = CN:OP(RES) = 3:N(RES) = 1:X(RES,0) = N(C):X(RES,1) = N(D):CN = CN + 1:R = RES:RETURN +REM CHURCH TO NUM + 80 N = N(C):A = X(C,0):B = X(C,1):ON OP(C) GOTO 20,30,40:STOP +REM NUM TO CHURCH + 90 R = ZERO:IF I = 0 THEN RETURN + 91 I = I - 1:GOSUB 90:C = R:GOTO 10"SUCC diff --git a/Task/Church-numerals/Binary-Lambda-Calculus/church-numerals.blc b/Task/Church-numerals/Binary-Lambda-Calculus/church-numerals.blc new file mode 100644 index 0000000000..d228e6480d --- /dev/null +++ b/Task/Church-numerals/Binary-Lambda-Calculus/church-numerals.blc @@ -0,0 +1,27 @@ +(let ((zero 0) + (succ (lambda (n f x) + (f (n f x)))) + (one (succ zero)) + (two (succ one)) + (three (succ two)) + (four (succ three)) + (plus (lambda (m n f x) + (m f (n f x)))) + (times (lambda (m n f) + (m (n f)))) + (power (lambda (m n) + (n m))) + (cons (lambda (x y f) + (f x y)))) + (lambda (in) + (cons + (plus three four) + (cons + (times three four) + (cons + (power three four) + (cons + (power four three) + (cons + (power (power two two) (plus two one)) + nil))))))) diff --git a/Task/Church-numerals/Chapel/church-numerals.chapel b/Task/Church-numerals/Chapel/church-numerals.chpl similarity index 100% rename from Task/Church-numerals/Chapel/church-numerals.chapel rename to Task/Church-numerals/Chapel/church-numerals.chpl diff --git a/Task/Church-numerals/Crystal/church-numerals.crystal b/Task/Church-numerals/Crystal/church-numerals.cr similarity index 100% rename from Task/Church-numerals/Crystal/church-numerals.crystal rename to Task/Church-numerals/Crystal/church-numerals.cr diff --git a/Task/Church-numerals/FreeBASIC/church-numerals.basic b/Task/Church-numerals/FreeBASIC/church-numerals.basic new file mode 100644 index 0000000000..a53eccda1c --- /dev/null +++ b/Task/Church-numerals/FreeBASIC/church-numerals.basic @@ -0,0 +1,93 @@ +Type church + ' eg {r_add,1,{a,b}} + op As Integer + n As Integer + x(1 To 2) As Integer +End Type + +Dim Shared As church zero = Type(1, 0, {0, 1}) + +Function succ(c As church) As church + ' eg {r_add,1,{a,b}} => {r_add,2,{a,b}} aka a+b -> a+b+b + c.n += 1 + Return c +End Function + +' three normal integer-handling routines... +Function sum(n As Integer, a As Integer, b As Integer) As Integer + For i As Integer = 1 To n + a += b + Next i + Return a +End Function + +Function mul(n As Integer, a As Integer, b As Integer) As Integer + For i As Integer = 1 To n + a *= b + Next i + Return a +End Function + +Function pow(n As Integer, a As Integer, b As Integer) As Integer + For i As Integer = 1 To n + a = a ^ b + Next i + Return a +End Function + +' ...and three church constructors to match +' (no maths here, just pure static data) +Function churchSum(c As church, d As church) As church + Dim res As church + res.op = 1 ' 1 for add + res.n = 1 + res.x(1) = c.n + res.x(2) = d.n + Return res +End Function + +Function churchMul(c As church, d As church) As church + Dim res As church + res.op = 2 ' 2 for mul + res.n = 1 + res.x(1) = c.n + res.x(2) = d.n + Return res +End Function + +Function churchPow(c As church, d As church) As church + Dim res As church + res.op = 3 ' 3 for pow + res.n = 1 + res.x(1) = c.n + res.x(2) = d.n + Return res +End Function + +Function churchToNum(c As church) As Integer + ' note this is where the bulk of any processing happens + Select Case c.op + Case 1 + Return sum(c.n, c.x(1), c.x(2)) + Case 2 + Return mul(c.n, c.x(1), c.x(2)) + Case 3 + Return pow(c.n, c.x(1), c.x(2)) + End Select +End Function + +Function numToChurch(i As Integer) As church + Return Iif(i = 0, zero, succ(numToChurch(i - 1))) +End Function + +Dim As church three = succ(succ(succ(zero))) +Dim As church four = succ(three) +Print "three -> "; churchToNum(three) +Print "four -> "; churchToNum(four) +Print "three + four -> "; churchToNum(churchSum(three, four)) +Print "three * four -> "; churchToNum(churchMul(three, four)) +Print "three ^ four -> "; churchToNum(churchPow(three, four)) +Print "four ^ three -> "; churchToNum(churchPow(four, three)) +Print "5 -> five -> "; churchToNum(numToChurch(5)) + +Sleep diff --git a/Task/Church-numerals/Go/church-numerals.go b/Task/Church-numerals/Go/church-numerals-1.go similarity index 100% rename from Task/Church-numerals/Go/church-numerals.go rename to Task/Church-numerals/Go/church-numerals-1.go diff --git a/Task/Church-numerals/Go/church-numerals-2.go b/Task/Church-numerals/Go/church-numerals-2.go new file mode 100644 index 0000000000..0b8a0724a4 --- /dev/null +++ b/Task/Church-numerals/Go/church-numerals-2.go @@ -0,0 +1,88 @@ +package main + +import "fmt" + +type Church func(Church) Church + +func id[X any](x X) X { + return x +} + +func compose[X any, Y any, Z any](f func(Y) Z, g func(X) Y) func(X) Z { + return func(x X) Z { + return f(g(x)) + } +} + +func zero() Church { + return func(f Church) Church { + return id[Church] + } +} + +func one() Church { + return id[Church] +} + +func succ(n Church) Church { + return func(f Church) Church { + return compose(f, n(f)) + } +} + +func plus(m, n Church) Church { + return func(f Church) Church { + return compose(m(f), n(f)) + } +} + +func mult(m, n Church) Church { + return compose(m, n) +} + +func exp(m, n Church) Church { + return n(m) +} + +func toInt(x Church) int { + counter := 0 + fCounter := func(f Church) Church { + counter++ + return f + } + + x(fCounter)(id[Church]) + return counter +} + +func toStr(x Church) string { + counter := "" + fCounter := func(f Church) Church { + counter += "|" + return f + } + + x(fCounter)(id[Church]) + return counter +} + +func main() { + fmt.Println("zero =", toInt(zero())) + + one := one() + fmt.Println("one =", toInt(one)) + + two := succ(succ(zero())) + fmt.Println("two =", toInt(two)) + + three := plus(one, two) + fmt.Println("three =", toInt(three)) + + four := mult(two, two) + fmt.Println("four =", toInt(four)) + + eight := exp(two, three) + fmt.Println("eight =", toInt(eight)) + + fmt.Println("toStr(four) =", toStr(four)) +} diff --git a/Task/Church-numerals/Julia/church-numerals-1.julia b/Task/Church-numerals/Julia/church-numerals-1.jl similarity index 100% rename from Task/Church-numerals/Julia/church-numerals-1.julia rename to Task/Church-numerals/Julia/church-numerals-1.jl diff --git a/Task/Church-numerals/Julia/church-numerals-2.julia b/Task/Church-numerals/Julia/church-numerals-2.jl similarity index 100% rename from Task/Church-numerals/Julia/church-numerals-2.julia rename to Task/Church-numerals/Julia/church-numerals-2.jl diff --git a/Task/Church-numerals/OCaml/church-numerals.ocaml b/Task/Church-numerals/OCaml/church-numerals.ml similarity index 100% rename from Task/Church-numerals/OCaml/church-numerals.ocaml rename to Task/Church-numerals/OCaml/church-numerals.ml diff --git a/Task/Church-numerals/Phix/church-numerals.phix b/Task/Church-numerals/Phix/church-numerals.phix index 3765569a3c..3f885e80e9 100644 --- a/Task/Church-numerals/Phix/church-numerals.phix +++ b/Task/Church-numerals/Phix/church-numerals.phix @@ -1,91 +1,86 @@ -(phixonline)--> - with javascript_semantics +with javascript_semantics - type church(object c) - -- eg {r_add,1,{a,b}} - return sequence(c) and length(c)=3 - and integer(c[1]) and integer(c[2]) - and sequence(c[3]) and length(c[3])=2 - end type +type church(object c) +-- eg {r_add,1,{a,b}} + return sequence(c) and length(c)=3 + and integer(c[1]) and integer(c[2]) + and sequence(c[3]) and length(c[3])=2 +end type - function succ(church c) - -- eg {r_add,1,{a,b}} => {r_add,2,{a,b}} aka a+b -> a+b+b - c = deep_copy(c) - c[2] += 1 - return c - end function +function succ(church c) +-- eg {add,1,{a,b}} => {add,2,{a,b}} aka a+b => a+b+b + c = deep_copy(c) + c[2] += 1 + return c +end function - -- three normal integer-handling routines... - function add(integer n, a, b) - for i=1 to n do - a += b - end for - return a - end function - constant r_add = routine_id("add") +-- three normal integer-handling routines... +function add(integer n, a, b) + for i=1 to n do + a += b + end for + return a +end function - function mul(integer n, a, b) - for i=1 to n do - a *= b - end for - return a - end function - constant r_mul = routine_id("mul") +function mul(integer n, a, b) + for i=1 to n do + a *= b + end for + return a +end function - function pow(integer n, a, b) - for i=1 to n do - a = power(a,b) - end for - return a - end function - constant r_pow = routine_id("pow") +function pow(integer n, a, b) + for i=1 to n do + a = power(a,b) + end for + return a +end function - -- ...and three church constructors to match - -- (no maths here, just pure static data) - function addch(church c, d) - church res = {r_add,1,{c,d}} - return res - end function +-- ...and three church constructors to match +-- (no maths here, just pure static data) +function addch(church c, d) + church res = {add,1,{c,d}} + return res +end function - function mulch(church c, d) - church res = {r_mul,1,{c,d}} - return res - end function +function mulch(church c, d) + church res = {mul,1,{c,d}} + return res +end function - function powch(church c, d) - church res = {r_pow,1,{c,d}} - return res - end function +function powch(church c, d) + church res = {pow,1,{c,d}} + return res +end function - function tointch(church c) - -- note this is where the bulk of any processing happens - {integer rid, integer n, object x} = c - x = deep_copy(x) - for i=1 to length(x) do - if church(x[i]) then x[i] = tointch(x[i]) end if - end for - -- return call_func(rid,n&x) - x = deep_copy({n})&deep_copy(x) - return call_func(rid,x) - end function +function tointch(church c) +-- note this is where the bulk of any processing happens + {integer rid, integer n, object x} = c + x = deep_copy(x) + for i=1 to length(x) do + if church(x[i]) then x[i] = tointch(x[i]) end if + end for +-- return call_func(rid,n&x) + x = deep_copy({n})&deep_copy(x) + return call_func(rid,x) +end function - constant church zero = {r_add,0,{0,1}} +constant church zero = {add,0,{0,1}} - function inttoch(integer i) - if i=0 then - return zero - else - return succ(inttoch(i-1)) - end if - end function +function inttoch(integer i) + if i=0 then + return zero + else + return succ(inttoch(i-1)) + end if +end function - church three = succ(succ(succ(zero))), - four = succ(three) - printf(1,"three -> %d\n",tointch(three)) - printf(1,"four -> %d\n",tointch(four)) - printf(1,"three + four -> %d\n",tointch(addch(three,four))) - printf(1,"three * four -> %d\n",tointch(mulch(three,four))) - printf(1,"three ^ four -> %d\n",tointch(powch(three,four))) - printf(1,"four ^ three -> %d\n",tointch(powch(four,three))) - printf(1,"5 -> five -> %d\n",tointch(inttoch(5))) - - with javascript_semantics - constant tests = {{0.1234, 0.9876, 0.8765, 0.2345, 2.0}, - {0.0000, 2.0000, 0.0000, 0.0000, 1.0}, - {0.1234, 0.9876, 0.1234, 0.9876, 2.0}, - {0.1234, 0.9876, 0.8765, 0.2345, 0.5}, - {0.1234, 0.9876, 0.1234, 0.9876, 0.0}} - for i=1 to length(tests) do - atom {x1,y1,x2,y2,r} = tests[i], - xd = x2-x1, yd = y1-y2, - s2 = xd*xd+yd*yd, sep = sqrt(s2), - xh = (x1+x2)/2, yh = (y1+y2)/2 - string txt - if sep=0 then - txt = "same points/"&iff(r=0?"radius is zero":"infinite solutions") - elsif sep=2*r then - txt = sprintf("opposite ends of diameter with centre {%.4f,%.4f}",{xh,yh}) - elsif sep>2*r then - txt = sprintf("too far apart (%.4f > %.4f)",{sep,2*r}) - else - atom md = sqrt(r*r-s2/4), xs = md*xd/sep, ys = md*yd/sep - txt = sprintf("{%.4f,%.4f} and {%.4f,%.4f}",{xh+ys,yh+xs,xh-ys,yh-xs}) - end if - printf(1,"points {%.4f,%.4f}, {%.4f,%.4f} with radius %.1f ==> %s\n",{x1,y1,x2,y2,r,txt}) - end for - - with javascript_semantics - function circular(integer p) - integer len = length(sprintf("%d",p)), - pow = power(10,len-1), - p0 = p - for i=1 to len-1 do - p = pow*remainder(p,10)+floor(p/10) - if p<p0 or not is_prime(p) then return false end if - end for - return true - end function +with javascript_semantics +function circular(integer p) + integer len = length(sprintf("%d",p)), + pow = power(10,len-1), + p0 = p + for i=1 to len-1 do + p = pow*remainder(p,10)+floor(p/10) + if psequence c = {} - integer n = 1 - while length(c)<19 do - integer p = get_prime(n) - if circular(p) then c &= p end if - n += 1 - end while - printf(1,"The first 19 circular primes are:\n%v\n\n",{c}) +sequence c = {} +integer n = 1 +while length(c)<19 do + integer p = get_prime(n) + if circular(p) then c &= p end if + n += 1 +end while +printf(1,"The first 19 circular primes are:\n%v\n\n",{c}) - include mpfr.e - procedure repunit(mpz z, integer n) - mpz_set_str(z,repeat('1',n)) - end procedure - - c = {} - n = 7 - mpz z = mpz_init() - while length(c)<4 do - repunit(z,n) - if mpz_prime(z) then - c = append(c,sprintf("R(%d)",n)) - end if - n += 1 - end while - printf(1,"The next 4 circular primes, in repunit format, are:\n%s\n\n",{join(c)}) - - constant t = {5003, 9887, 15073, 25031, 35317, 49081} - printf(1,"The following repunits are probably circular primes:\n") - for i=1 to length(t) do - integer ti = t[i] - atom t0 = time() - repunit(z,ti) - bool bPrime = mpz_prime(z,1) - printf(1,"R(%d) : %t (%s)\n", {ti, bPrime, elapsed(time()-t0)}) - end for - - with javascript_semantics - function bruteForceClosestPair(sequence s) - atom {x1,y1} = s[1], {x2,y2} = s[2], - dx = x1-x2, dy = y1-y2, - mind = dx*dx+dy*dy - sequence minp = s[1..2] - for i=1 to length(s)-1 do - {x1,y1} = s[i] - for j=i+1 to length(s) do - {x2,y2} = s[j] - dx = x1-x2 - dx = dx*dx - if dx<mind then - dy = y1-y2 - dx += dy*dy - if dx<mind then - mind = dx - minp = {s[i],s[j]} - end if - end if - end for - end for - return {sqrt(mind),minp} - end function +with javascript_semantics +function bruteForceClosestPair(sequence s) + atom {x1,y1} = s[1], {x2,y2} = s[2], + dx = x1-x2, dy = y1-y2, + mind = dx*dx+dy*dy + sequence minp = s[1..2] + for i,si in s to length(s)-1 do + {x1,y1} = si + for sj in s from i+1 do + {x2,y2} = sj + dx = x1-x2 + dx = dx*dx + if dxsequence testset = sq_rnd(repeat({1,1},10000)) - atom t0 = time() - {atom d, sequence points} = bruteForceClosestPair(testset) - -- (Sorting the final point pair makes brute/dc more likely to tally. Note however - -- when >1 equidistant pairs exist, brute and dc may well return different pairs; - -- it is only a problem if they decide to return different minimum distances.) - atom {{x1,y1},{x2,y2}} = sort(deep_copy(points)) - printf(1,"Closest pair: {%f,%f} {%f,%f}, distance=%f (%3.2fs)\n",{x1,y2,x2,y2,d,time()-t0}) +sequence testset = sq_rnd(repeat({1,1},10000)) +atom t0 = time() +atom {d, {{x1,y1},{x2,y2}}} = bruteForceClosestPair(testset) +-- (Sorting the final point pair makes brute/dc more likely to tally. Note however +-- when >1 equidistant pairs exist, brute and dc may well return different pairs; +-- it is only a problem if they decide to return different minimum distances.) +printf(1,"Closest pair: {%f,%f} {%f,%f}, distance=%f (%3.2fs)\n",{x1,y2,x2,y2,d,time()-t0}) - t0 = time() - constant X = 1, Y = 2 - sequence xP = sort(deep_copy(testset)) +t0 = time() +constant X = 1, Y = 2 +sequence xP = sort(deep_copy(testset)), + yP = sort_columns(deep_copy(testset),{Y}) - function byY(sequence p1, p2) - return compare(p1[Y],p2[Y]) - end function - sequence yP = custom_sort(routine_id("byY"),deep_copy(testset)) +function distsq(sequence p1,p2) + atom {x1,y1} = p1, {x2,y2} = p2 + x1 -= x2 + y1 -= y2 + return x1*x1 + y1*y1 +end function - function distsq(sequence p1,p2) - atom {x1,y1} = p1, {x2,y2} = p2 - x1 -= x2 - y1 -= y2 - return x1*x1 + y1*y1 - end function +function closestPair(sequence xP, yP) +-- where xP is P(1) .. P(N) sorted by x coordinate, and +-- yP is P(1) .. P(N) sorted by y coordinate (ascending order) + integer N = length(xP), + midN = floor(N/2) + assert(length(yP)=N) + if N<=3 then + return bruteForceClosestPair(xP) + end if + sequence xL = xP[1..midN], + xR = xP[midN+1..N], + yL = {}, + yR = {} + atom xm = xP[midN][X] + for yi in yP do + if yi[X]<=xm then + yL = append(yL,yi) + else + yR = append(yR,yi) + end if + end for + {atom dmin, sequence pairMin} = min(closestPair(xL, yL), + closestPair(xR, yR)) + sequence yS = {} + for yi in yP do + if abs(xm-yi[X])=dmin then exit end if + d = distsq(yk,yi) + if dfunction closestPair(sequence xP, yP) - -- where xP is P(1) .. P(N) sorted by x coordinate, and - -- yP is P(1) .. P(N) sorted by y coordinate (ascending order) - integer N = length(xP), - midN = floor(N/2) - assert(length(yP)=N) - if N<=3 then - return bruteForceClosestPair(xP) - end if - sequence xL = xP[1..midN], - xR = xP[midN+1..N], - yL = {}, - yR = {} - atom xm = xP[midN][X] - for i=1 to N do - if yP[i][X]<=xm then - yL = append(yL,yP[i]) - else - yR = append(yR,yP[i]) - end if - end for - {atom dL, sequence pairL} = closestPair(xL, yL) - {atom dR, sequence pairR} = closestPair(xR, yR) - {atom dmin, sequence pairMin} = min({dL, pairL},{dR, pairR}) - sequence yS = {} - for i=1 to length(yP) do - if abs(xm-yP[i][X])<dmin then - yS = append(yS,yP[i]) - end if - end for - integer nS = length(yS) - {atom closest, sequence cPair} = {dmin*dmin, pairMin} - for i=1 to nS-1 do - integer k = i + 1 - while k<=nS and (yS[k][Y]-yS[i][Y])<dmin do - d = distsq(yS[k],yS[i]) - if d<closest then - {closest, cPair} = {d, {yS[k], yS[i]}} - end if - k += 1 - end while - end for - return {sqrt(closest), cPair} - end function - - {d,points} = closestPair(xP,yP) - {{x1,y1},{x2,y2}} = sort(deep_copy(points)) -- (see note above) - printf(1,"Closest pair: {%f,%f} {%f,%f}, distance=%f (%3.2fs)\n",{x1,y2,x2,y2,d,time()-t0}) - +(phixonline) with javascript_semantics sequence collection = {} collection = append(collection,"one") collection = prepend(collection,2) ? collection -- {2,"one"} - +(phixonline) with javascript_semantics setd("one",0) setd(2,0) @@ -7,4 +7,3 @@ return 1 end function traverse_dict(routine_id("visitor")) -- shows 2, "one" - - with javascript_semantics - function colourful(integer n) - if n<10 then return n>=0 end if - sequence digits = sq_sub(sprintf("%d",n),'0'), - ud = unique(deep_copy(digits)) - integer ln = length(digits) - if ud[1]<=1 or length(ud)!=ln then return false end if - for i=1 to ln-1 do - for j=i+1 to ln do - atom prod = product(digits[i..j]) - if find(prod,ud) then return false end if - ud &= prod - end for - end for - return true - end function +with javascript_semantics +function colourful(integer n) + if n<10 then return n>=0 end if + sequence digits = sq_sub(sprintf("%d",n),'0'), + ud = unique(deep_copy(digits)) + integer ln = length(digits) + if ud[1]<=1 or length(ud)!=ln then return false end if + for i=1 to ln-1 do + for j=i+1 to ln do + atom prod = product(digits[i..j]) + if find(prod,ud) then return false end if + ud &= prod + end for + end for + return true +end function - atom t0 = time() - sequence cn = apply(true,sprintf,{{"%2d"},filter(tagset(100,0),colourful)}) - printf(1,"The %d colourful numbers less than 100 are:\n%s\n", - {length(cn),join_by(cn,1,10," ")}) +atom t0 = time() +sequence cn = apply(true,sprintf,{{"%2d"},filter(tagset(100,0),colourful)}) +printf(1,"The %d colourful numbers less than 100 are:\n%s\n", + {length(cn),join_by(cn,1,10," ")}) - sequence count = repeat(0,8), - used = repeat(false,10) - integer largestcn = 0 +sequence count = repeat(0,8), + used = repeat(false,10) +integer largestcn = 0 - procedure count_colourful(integer taken=0, string n="") - if taken=0 then - for digit='0' to '9' do - integer dx = digit-'0'+1 - used[dx] = true - count_colourful(iff(digit<'2'?9:1),""&digit) - used[dx] = false - end for - else - integer nn = to_integer(n) - if colourful(nn) then - integer ln = length(n) - count[ln] += 1 - if nn>largestcn then largestcn = nn end if - end if - if taken<9 then - for digit='2' to '9' do - integer dx = digit-'0'+1 - if not used[dx] then - used[dx] = true - count_colourful(taken+1,n&digit) - used[dx] = false - end if - end for - end if - end if - end procedure - count_colourful() - printf(1,"The largest possible colourful number is: %,d\n\n",largestcn) - atom pow = 10 - for dc=1 to length(count) do - printf(1," %d digit colourful number count: %,6d - %7.3f%%\n", - {dc, count[dc], 100*count[dc]/pow}) - pow = iff(pow=10?90:pow*10) - end for - printf(1,"\nTotal colourful numbers: %,d\n", sum(count)) - ?elapsed(time()-t0) - n ) + + [ dip dup - ! dip ! / ] is p ( n n --> n ) + + [ tuck p swap ! / ] is c ( n n --> n ) + + ' [ [ 1 0 ] [ 12 4 ] [ 60 20 ] [ 105 103 ] [ 15000 333 ] ] + witheach + [ unpack 2dup + say " P(" + swap echo say "," echo + say ") = " + p shorten echo$ cr ] + cr + ' [ [ 10 5 ] [ 60 30 ] [ 50 48 ] [ 900 675 ] [ 970 730 ] ] + witheach + [ unpack 2dup + say " C(" + swap echo say "," echo + say ") = " + c shorten echo$ cr ] diff --git a/Task/Combinations-and-permutations/Rust/combinations-and-permutations.rs b/Task/Combinations-and-permutations/Rust/combinations-and-permutations.rs new file mode 100644 index 0000000000..ef42c1512d --- /dev/null +++ b/Task/Combinations-and-permutations/Rust/combinations-and-permutations.rs @@ -0,0 +1,34 @@ +fn perm(n: f64, k: f64) -> f64 { + let mut result: f64 = 1.0; + let mut i: f64 = 0.0; + + while i < k { + result *= n - i; + i += 1.0; + } + + result +} + +fn comb(n: f64, k: f64) -> f64 { + perm(n, k) / perm(k, k) +} + +fn main() { + const P: f64 = 12.0; + const C: f64 = 60.0; + + let mut j: f64 = 1.0; + let mut k: f64 = 10.0; + + while j < P { + println!("P({},{}) = {}", P, j, perm(P, j).floor()); + j += 1.0; + } + + while k < C { + println!("C({},{}) = {}", C, k, comb(C, k).floor()); + k += 10.0; + } + +} diff --git a/Task/Combinations-and-permutations/Scheme/combinations-and-permutations.ss b/Task/Combinations-and-permutations/Scheme/combinations-and-permutations.scm similarity index 100% rename from Task/Combinations-and-permutations/Scheme/combinations-and-permutations.ss rename to Task/Combinations-and-permutations/Scheme/combinations-and-permutations.scm diff --git a/Task/Combinations-and-permutations/Uiua/combinations-and-permutations.uiua b/Task/Combinations-and-permutations/Uiua/combinations-and-permutations.uiua new file mode 100644 index 0000000000..ec81fca266 --- /dev/null +++ b/Task/Combinations-and-permutations/Uiua/combinations-and-permutations.uiua @@ -0,0 +1,15 @@ +P ← /×+1˜↙⇡⊙¯ # Simple Perm calc. +C ← ÷/×+1⇡⤙P # Simple Comb calc. +# Better version: casts out common factors first. +C ← ( + AllFactors ← map⊕(⊃⊢⧻)⊸⊛▽⊸>₁/⊂(°/×) + ⊃(+1⇡◌|+1˜↙⇡⊙¯) # Collect numerator, denominator terms. + ⍆◴⊂◡∩(⊙◌°map)∩AllFactors # Identify common factors. + /×ⁿ⤚(-∩⌞≡⬚0get⊙¤⊙⊙¤) # Cast out, mult +) +≡⌞P 12 ↘1⇡12 +≡⌞C 60 ×10↘1⇡6 + +P 105 103 +P 15000 333 +C 900 674 diff --git a/Task/Combinations-and-permutations/VBScript/combinations-and-permutations.vb b/Task/Combinations-and-permutations/VBScript/combinations-and-permutations.vbs similarity index 100% rename from Task/Combinations-and-permutations/VBScript/combinations-and-permutations.vb rename to Task/Combinations-and-permutations/VBScript/combinations-and-permutations.vbs diff --git a/Task/Combinations-and-permutations/Wren/combinations-and-permutations.wren b/Task/Combinations-and-permutations/Wren/combinations-and-permutations.wren index 352e2b0af1..5577af47a2 100644 --- a/Task/Combinations-and-permutations/Wren/combinations-and-permutations.wren +++ b/Task/Combinations-and-permutations/Wren/combinations-and-permutations.wren @@ -1,6 +1,6 @@ -import "/big" for BigInt -import "/fmt" for Fmt -import "/iterate" for Stepped +import "./big" for BigInt +import "./fmt" for Fmt +import "./iterate" for Stepped var perm = Fn.new { |n, k| if (n <= 0 || k < 0) Fiber.abort("Invalid argument(s).") diff --git a/Task/Combinations-with-repetitions/Ada/combinations-with-repetitions.ada b/Task/Combinations-with-repetitions/Ada/combinations-with-repetitions.adb similarity index 100% rename from Task/Combinations-with-repetitions/Ada/combinations-with-repetitions.ada rename to Task/Combinations-with-repetitions/Ada/combinations-with-repetitions.adb diff --git a/Task/Combinations-with-repetitions/Crystal/combinations-with-repetitions.crystal b/Task/Combinations-with-repetitions/Crystal/combinations-with-repetitions.cr similarity index 100% rename from Task/Combinations-with-repetitions/Crystal/combinations-with-repetitions.crystal rename to Task/Combinations-with-repetitions/Crystal/combinations-with-repetitions.cr diff --git a/Task/Combinations-with-repetitions/DuckDB/combinations-with-repetitions.duckdb b/Task/Combinations-with-repetitions/DuckDB/combinations-with-repetitions.duckdb new file mode 100644 index 0000000000..b2312e949b --- /dev/null +++ b/Task/Combinations-with-repetitions/DuckDB/combinations-with-repetitions.duckdb @@ -0,0 +1,49 @@ +create or replace function choose(lst,k) as table ( + with recursive cte as ( + select 0 as ix, + lst[0:0] as combination -- i.e. an empty array of the correct type + union all + select ix+1, combination || [ lst[j] ] + from cte, range(ix+1, 1+length(lst) ) _(j) + where length(combination) < k + ) + select combination + from cte + where ix = k +); + +# Assume 0 0 s$ = "" @@ -14,7 +14,7 @@ proc output . . print s$ . . -proc combine pos val . . +proc combine pos val . if pos > k output else diff --git a/Task/Combinations-with-repetitions/Elixir/combinations-with-repetitions.elixir b/Task/Combinations-with-repetitions/Elixir/combinations-with-repetitions.ex similarity index 100% rename from Task/Combinations-with-repetitions/Elixir/combinations-with-repetitions.elixir rename to Task/Combinations-with-repetitions/Elixir/combinations-with-repetitions.ex diff --git a/Task/Combinations-with-repetitions/Jq/combinations-with-repetitions-1.jq b/Task/Combinations-with-repetitions/Jq/combinations-with-repetitions-1.jq index 3972206ac5..bb25c96913 100644 --- a/Task/Combinations-with-repetitions/Jq/combinations-with-repetitions-1.jq +++ b/Task/Combinations-with-repetitions/Jq/combinations-with-repetitions-1.jq @@ -6,3 +6,5 @@ def pick(n): else ([.[m]] + pick(n-1; m)), pick(n; m+1) end; pick(n;0) ; + +def count(s): reduce s as $_ (0; .+1); diff --git a/Task/Combinations-with-repetitions/Jq/combinations-with-repetitions-2.jq b/Task/Combinations-with-repetitions/Jq/combinations-with-repetitions-2.jq index 6c2692b448..50f06bd1e4 100644 --- a/Task/Combinations-with-repetitions/Jq/combinations-with-repetitions-2.jq +++ b/Task/Combinations-with-repetitions/Jq/combinations-with-repetitions-2.jq @@ -1,4 +1,4 @@ - "Pick 2:", +"Pick 2:", (["iced", "jam", "plain"] | pick(2)), - ([[range(0;10)] | pick(3)] | length) as $n - | "There are \($n) ways to pick 3 objects with replacement from 10." + (count( [range(0;10)] | pick(3)) as $n + | "There are \($n) ways to pick 3 objects with replacement from 10.") diff --git a/Task/Combinations-with-repetitions/Julia/combinations-with-repetitions.julia b/Task/Combinations-with-repetitions/Julia/combinations-with-repetitions.jl similarity index 100% rename from Task/Combinations-with-repetitions/Julia/combinations-with-repetitions.julia rename to Task/Combinations-with-repetitions/Julia/combinations-with-repetitions.jl diff --git a/Task/Combinations-with-repetitions/Kotlin/combinations-with-repetitions.kotlin b/Task/Combinations-with-repetitions/Kotlin/combinations-with-repetitions.kts similarity index 100% rename from Task/Combinations-with-repetitions/Kotlin/combinations-with-repetitions.kotlin rename to Task/Combinations-with-repetitions/Kotlin/combinations-with-repetitions.kts diff --git a/Task/Combinations-with-repetitions/OCaml/combinations-with-repetitions-1.ocaml b/Task/Combinations-with-repetitions/OCaml/combinations-with-repetitions-1.ml similarity index 100% rename from Task/Combinations-with-repetitions/OCaml/combinations-with-repetitions-1.ocaml rename to Task/Combinations-with-repetitions/OCaml/combinations-with-repetitions-1.ml diff --git a/Task/Combinations-with-repetitions/OCaml/combinations-with-repetitions-2.ocaml b/Task/Combinations-with-repetitions/OCaml/combinations-with-repetitions-2.ml similarity index 100% rename from Task/Combinations-with-repetitions/OCaml/combinations-with-repetitions-2.ocaml rename to Task/Combinations-with-repetitions/OCaml/combinations-with-repetitions-2.ml diff --git a/Task/Combinations-with-repetitions/PascalABC.NET/combinations-with-repetitions.pas b/Task/Combinations-with-repetitions/PascalABC.NET/combinations-with-repetitions.pas new file mode 100644 index 0000000000..be42b9c098 --- /dev/null +++ b/Task/Combinations-with-repetitions/PascalABC.NET/combinations-with-repetitions.pas @@ -0,0 +1,8 @@ +## +var t:=|'iced', 'jam', 'plain'|; +var p:=t.CartesianPower(2).Where(t->t[0]<=t[1]); +write($'{p.Count}'); +Print(':'); +p.Println; +write((1..10).CartesianPower(3).Where(t->(t[0]<=t[1])and(t[1]<=t[2])).count); +Print(': Choices of 3 from 10'); diff --git a/Task/Combinations-with-repetitions/Pluto/combinations-with-repetitions.pluto b/Task/Combinations-with-repetitions/Pluto/combinations-with-repetitions.pluto new file mode 100644 index 0000000000..a5fb293809 --- /dev/null +++ b/Task/Combinations-with-repetitions/Pluto/combinations-with-repetitions.pluto @@ -0,0 +1,15 @@ +require "perm" +local fmt = require "fmt" + +local function rep(a, multiple) + local aa = {} + for i = 1, #a do + for _ = 1, multiple do aa:insert(a[i]) end + end + return aa +end + +local a = {"iced", "jam", "plain"} +fmt.lprint(comb.list(rep(a, 2), 2, true)) +a = range(1, 10) +print(#comb.list(rep(a, 3), 3, true)) diff --git a/Task/Combinations-with-repetitions/Rust/combinations-with-repetitions.rust b/Task/Combinations-with-repetitions/Rust/combinations-with-repetitions.rs similarity index 100% rename from Task/Combinations-with-repetitions/Rust/combinations-with-repetitions.rust rename to Task/Combinations-with-repetitions/Rust/combinations-with-repetitions.rs diff --git a/Task/Combinations-with-repetitions/Scheme/combinations-with-repetitions-1.ss b/Task/Combinations-with-repetitions/Scheme/combinations-with-repetitions-1.scm similarity index 100% rename from Task/Combinations-with-repetitions/Scheme/combinations-with-repetitions-1.ss rename to Task/Combinations-with-repetitions/Scheme/combinations-with-repetitions-1.scm diff --git a/Task/Combinations-with-repetitions/Scheme/combinations-with-repetitions-2.ss b/Task/Combinations-with-repetitions/Scheme/combinations-with-repetitions-2.scm similarity index 100% rename from Task/Combinations-with-repetitions/Scheme/combinations-with-repetitions-2.ss rename to Task/Combinations-with-repetitions/Scheme/combinations-with-repetitions-2.scm diff --git a/Task/Combinations-with-repetitions/VBScript/combinations-with-repetitions.vb b/Task/Combinations-with-repetitions/VBScript/combinations-with-repetitions.vbs similarity index 100% rename from Task/Combinations-with-repetitions/VBScript/combinations-with-repetitions.vb rename to Task/Combinations-with-repetitions/VBScript/combinations-with-repetitions.vbs diff --git a/Task/Combinations-with-repetitions/Wren/combinations-with-repetitions-1.wren b/Task/Combinations-with-repetitions/Wren/combinations-with-repetitions-1.wren index fb47e3c35f..791340f70a 100644 --- a/Task/Combinations-with-repetitions/Wren/combinations-with-repetitions-1.wren +++ b/Task/Combinations-with-repetitions/Wren/combinations-with-repetitions-1.wren @@ -1,9 +1,8 @@ -var combrep // recursive -combrep = Fn.new { |n, lst| +var Combrep = Fn.new { |n, lst| if (n == 0 ) return [[]] if (lst.count == 0) return [] - var r = combrep.call(n, lst[1..-1]) - for (x in combrep.call(n-1, lst)) { + var r = Combrep.call(n, lst[1..-1]) + for (x in Combrep.call(n-1, lst)) { var y = x.toList y.add(lst[0]) r.add(y) @@ -11,5 +10,5 @@ combrep = Fn.new { |n, lst| return r } -System.print(combrep.call(2, ["iced", "jam", "plain"])) -System.print(combrep.call(3, (1..10).toList).count) +System.print(Combrep.call(2, ["iced", "jam", "plain"])) +System.print(Combrep.call(3, (1..10).toList).count) diff --git a/Task/Combinations/APL/combinations-1.apl b/Task/Combinations/APL/combinations-1.apl new file mode 100644 index 0000000000..1fde8720bc --- /dev/null +++ b/Task/Combinations/APL/combinations-1.apl @@ -0,0 +1,7 @@ + comb←{(⍺=0)∨⍺=⍵:⌷⍉⍪⍳⍺ ⋄ (0,1+(⍺-1)∇ ⍵-1)⍪1+⍺ ∇ ⍵-1} + 4 comb 5 +0 1 2 3 +0 1 2 5 +0 1 4 5 +0 3 4 5 +2 3 4 5 diff --git a/Task/Combinations/APL/combinations-2.apl b/Task/Combinations/APL/combinations-2.apl new file mode 100644 index 0000000000..c0eebd9932 --- /dev/null +++ b/Task/Combinations/APL/combinations-2.apl @@ -0,0 +1,7 @@ +comb←{ + ⍺{ + 0=⍺:⊂⍬ + 0=≢⍵:⍬ + ((⊃⍵),¨(⍺-1)∇r),⍺∇r←1↓⍵ + }⍳⍵ +} diff --git a/Task/Combinations/Ada/combinations-1.ada b/Task/Combinations/Ada/combinations-1.adb similarity index 100% rename from Task/Combinations/Ada/combinations-1.ada rename to Task/Combinations/Ada/combinations-1.adb diff --git a/Task/Combinations/Ada/combinations-2.ada b/Task/Combinations/Ada/combinations-2.adb similarity index 100% rename from Task/Combinations/Ada/combinations-2.ada rename to Task/Combinations/Ada/combinations-2.adb diff --git a/Task/Combinations/Crystal/combinations-1.crystal b/Task/Combinations/Crystal/combinations-1.cr similarity index 100% rename from Task/Combinations/Crystal/combinations-1.crystal rename to Task/Combinations/Crystal/combinations-1.cr diff --git a/Task/Combinations/Crystal/combinations-2.crystal b/Task/Combinations/Crystal/combinations-2.cr similarity index 100% rename from Task/Combinations/Crystal/combinations-2.crystal rename to Task/Combinations/Crystal/combinations-2.cr diff --git a/Task/Combinations/DuckDB/combinations.duckdb b/Task/Combinations/DuckDB/combinations.duckdb new file mode 100644 index 0000000000..714f42167e --- /dev/null +++ b/Task/Combinations/DuckDB/combinations.duckdb @@ -0,0 +1,22 @@ +CREATE OR REPLACE FUNCTION combinations(n, k) as table ( + WITH RECURSIVE cte(current, remaining) AS ( + -- start with empty combination and the full list + SELECT + [], + range(1, n + 1) + UNION ALL + -- recursive case: add one item to the current combination + SELECT + current || remaining[j:j], + remaining[j+1:] + FROM cte, range(1, length(remaining)+1) _(j) + WHERE length(current) < k + ) + SELECT current AS combination + FROM cte + WHERE length(current) = k +); + +## Example: +FROM combinations(5,3) +ORDER BY combination; diff --git a/Task/Combinations/EasyLang/combinations.easy b/Task/Combinations/EasyLang/combinations.easy index 17b909ce4a..34c4b35b4d 100644 --- a/Task/Combinations/EasyLang/combinations.easy +++ b/Task/Combinations/EasyLang/combinations.easy @@ -2,14 +2,14 @@ n = 5 m = 3 len result[] m # -proc combinations pos val . . - if pos <= m - for i = val to n - m - result[pos] = pos + i - combinations pos + 1 i - . - else +proc combinations pos val . + if pos > m print result[] + return + . + for i = val to pos + n - m + result[pos] = i + combinations pos + 1 i + 1 . . -combinations 1 0 +combinations 1 1 diff --git a/Task/Combinations/Elena/combinations.elena b/Task/Combinations/Elena/combinations.elena index 8493fde0ba..2cd24012e3 100644 --- a/Task/Combinations/Elena/combinations.elena +++ b/Task/Combinations/Elena/combinations.elena @@ -7,16 +7,16 @@ const int N = 5; Numbers(n) { - ^ Array.allocate(n).populate:(int n => n) + ^ Array.allocate(n).populate::(int n => n) } -public program() +public Program() { var numbers := Numbers(N); - Combinator.new(M, numbers).forEach:(row) + Combinator.new(M, numbers).forEach::(row) { - console.printLine(row.toString()) + Console.printLine(row.toString()) }; - console.readChar() + Console.readChar() } diff --git a/Task/Combinations/Elixir/combinations.elixir b/Task/Combinations/Elixir/combinations.ex similarity index 100% rename from Task/Combinations/Elixir/combinations.elixir rename to Task/Combinations/Elixir/combinations.ex diff --git a/Task/Combinations/Emacs-Lisp/combinations.l b/Task/Combinations/Emacs-Lisp/combinations.el similarity index 100% rename from Task/Combinations/Emacs-Lisp/combinations.l rename to Task/Combinations/Emacs-Lisp/combinations.el diff --git a/Task/Combinations/Euphoria/combinations.eu b/Task/Combinations/Euphoria/combinations.eu new file mode 100644 index 0000000000..522f4df73e --- /dev/null +++ b/Task/Combinations/Euphoria/combinations.eu @@ -0,0 +1,32 @@ +sequence combinations = {} + +procedure recurse(sequence remaining, /* digits remaining to compute */ + integer ne, /* number of digits expected for a valid combination */ + sequence selected = {}) /* digits already selected for a potential combination */ + integer nr = length(remaining) -- number of digits remaining to compute + integer ns = length(selected) -- number of digits already selected for a potential combination + if ns+nr = ne then + combinations = append(combinations, selected & remaining) + return + end if + if nr = 1 or ns = ne then + combinations = append(combinations, selected) + return + end if + -- select next + recurse(remove(remaining, 1), ne, selected & remaining[1]) + -- skip next + recurse(remove(remaining, 1), ne, selected) +end procedure + +function get_combinations(sequence s, integer lg) + combinations = {} + recurse(s, lg) + return combinations +end function + +constant TEST_SEQUENCE = {0,1,2,3,4} + +combinations = {} +recurse(TEST_SEQUENCE, 3) +? combinations diff --git a/Task/Combinations/FOCAL/combinations.focal b/Task/Combinations/FOCAL/combinations.focal new file mode 100644 index 0000000000..9a95a01740 --- /dev/null +++ b/Task/Combinations/FOCAL/combinations.focal @@ -0,0 +1,17 @@ +01.10 S M=3 +01.20 S N=5 +01.30 D 2 +01.40 Q + +02.10 F I=1,M;S C(I)=I-1 +02.20 D 3 +02.30 S I=M +02.40 S C(I)=C(I)+1 +02.50 I (C(I)-N+M-I)2.8 +02.60 S I=I-1 +02.70 I (-I)2.4;R +02.80 F J=I+1,M;S C(J)=C(J-1)+1 +02.90 G 2.2 + +03.10 F I=1,M;T %3,C(I) +03.20 T ! diff --git a/Task/Combinations/Frink/combinations.frink b/Task/Combinations/Frink/combinations.frink new file mode 100644 index 0000000000..16a86a5857 --- /dev/null +++ b/Task/Combinations/Frink/combinations.frink @@ -0,0 +1,7 @@ +combinations[m, n] := +{ + a = toArray[0 to n-1] + return lexicalSort[a.combinations[m]] +} + +println[formatTable[combinations[3,5]]] diff --git a/Task/Combinations/FutureBasic/combinations.basic b/Task/Combinations/FutureBasic/combinations.basic new file mode 100644 index 0000000000..6953e2870c --- /dev/null +++ b/Task/Combinations/FutureBasic/combinations.basic @@ -0,0 +1,16 @@ +void local fn Combinations( currStr as CFStringRef, start as int, stp as int, depth as int ) + int i + + for i = start to stp + if depth = 0 then printf @"%@ %d", currStr, i + fn Combinations( fn StringWithFormat( @"%@ %d", currStr, i ), i+1, stp, depth-1 ) + next +end fn + +int n : n = 3 +int m : m = 5 + +printf @" %d combinations of integers 0 through %d are:", n, m-1 +fn Combinations( @"", 0, m-1, n-1 ) + +HandleEvents diff --git a/Task/Combinations/J/combinations-10.j b/Task/Combinations/J/combinations-10.j new file mode 100644 index 0000000000..13e4c36a64 --- /dev/null +++ b/Task/Combinations/J/combinations-10.j @@ -0,0 +1 @@ +combb=: (#~ ((-:/:~)>/:~-:\:~)"1)@(# #: [: i. ^~) diff --git a/Task/Combinations/J/combinations-5.j b/Task/Combinations/J/combinations-5.j index b3a630bb1f..c026f8839f 100644 --- a/Task/Combinations/J/combinations-5.j +++ b/Task/Combinations/J/combinations-5.j @@ -1,3 +1 @@ -combr=: dyad define M. - if. (x>:y)+.0=x do. i.(x<:y),x else. (0,.x combr&.<: y),1+x combr y-1 end. -) +combr=: ((0,.$:&.<:),1+($:<:))` (<:i.@,[) @.(>:+.0=[)M. diff --git a/Task/Combinations/J/combinations-6.j b/Task/Combinations/J/combinations-6.j index 980099ca22..b3a630bb1f 100644 --- a/Task/Combinations/J/combinations-6.j +++ b/Task/Combinations/J/combinations-6.j @@ -1,7 +1,3 @@ - combr=: dyad define - if.(x=#y) +. x=1 do. - y - else. - (({.y) ,. (x-1) combr (}.y)) , (x combr }.y) - end. +combr=: dyad define M. + if. (x>:y)+.0=x do. i.(x<:y),x else. (0,.x combr&.<: y),1+x combr y-1 end. ) diff --git a/Task/Combinations/J/combinations-7.j b/Task/Combinations/J/combinations-7.j index 13e4c36a64..e1c75813ab 100644 --- a/Task/Combinations/J/combinations-7.j +++ b/Task/Combinations/J/combinations-7.j @@ -1 +1 @@ -combb=: (#~ ((-:/:~)>/:~-:\:~)"1)@(# #: [: i. ^~) +combr1=: (({.@],.<:@[$:}.@]),($:}.))` ] @.((= #)+.1=[) diff --git a/Task/Combinations/J/combinations-8.j b/Task/Combinations/J/combinations-8.j new file mode 100644 index 0000000000..399595ae74 --- /dev/null +++ b/Task/Combinations/J/combinations-8.j @@ -0,0 +1,7 @@ + combr1=: dyad define + if.(x=#y) +. x=1 do. + y + else. + (({.y) ,. (x-1) combr (}.y)) , (x combr }.y) + end. +) diff --git a/Task/Combinations/J/combinations-9.j b/Task/Combinations/J/combinations-9.j new file mode 100644 index 0000000000..b5d40efaeb --- /dev/null +++ b/Task/Combinations/J/combinations-9.j @@ -0,0 +1 @@ +comb3=: ((= +/"1) |.@:I.@# ]) #:@i.@(2&^) diff --git a/Task/Combinations/Java/combinations.java b/Task/Combinations/Java/combinations-1.java similarity index 100% rename from Task/Combinations/Java/combinations.java rename to Task/Combinations/Java/combinations-1.java diff --git a/Task/Combinations/Java/combinations-2.java b/Task/Combinations/Java/combinations-2.java new file mode 100644 index 0000000000..7a9bfe00d0 --- /dev/null +++ b/Task/Combinations/Java/combinations-2.java @@ -0,0 +1,29 @@ +import java.util.ArrayList; +import java.util.List; + +public final class Combinations { + + public static void main(String[] args) { + System.out.println(createCombinations(List.of( 0, 1, 2, 3, 4 ), 3)); + System.out.println(createCombinations(List.of( "Crosby", "Nash", "Stills", "Young" ), 3)); + } + + private static List> createCombinations(List elements, int k) { + List> combinations = new ArrayList>(); + createCombinations(elements, k, new ArrayList(), combinations, 0); + return combinations; + } + + private static void createCombinations( + List elements, int k, List accumulator, List> combinations, int index) { + if ( accumulator.size() == k ) { + combinations.addFirst( new ArrayList(accumulator) ); + } else if ( k - accumulator.size() <= elements.size() - index ) { + createCombinations(elements, k, accumulator, combinations, index + 1); + accumulator.add(elements.get(index)); + createCombinations(elements, k, accumulator, combinations, index + 1); + accumulator.removeLast(); + } + } + +} diff --git a/Task/Combinations/Julia/combinations-1.julia b/Task/Combinations/Julia/combinations-1.jl similarity index 100% rename from Task/Combinations/Julia/combinations-1.julia rename to Task/Combinations/Julia/combinations-1.jl diff --git a/Task/Combinations/Julia/combinations-2.julia b/Task/Combinations/Julia/combinations-2.jl similarity index 100% rename from Task/Combinations/Julia/combinations-2.julia rename to Task/Combinations/Julia/combinations-2.jl diff --git a/Task/Combinations/Julia/combinations-3.julia b/Task/Combinations/Julia/combinations-3.jl similarity index 100% rename from Task/Combinations/Julia/combinations-3.julia rename to Task/Combinations/Julia/combinations-3.jl diff --git a/Task/Combinations/Kotlin/combinations-1.kotlin b/Task/Combinations/Kotlin/combinations-1.kts similarity index 100% rename from Task/Combinations/Kotlin/combinations-1.kotlin rename to Task/Combinations/Kotlin/combinations-1.kts diff --git a/Task/Combinations/Kotlin/combinations-2.kotlin b/Task/Combinations/Kotlin/combinations-2.kts similarity index 100% rename from Task/Combinations/Kotlin/combinations-2.kotlin rename to Task/Combinations/Kotlin/combinations-2.kts diff --git a/Task/Combinations/M2000-Interpreter/combinations-1.m2000 b/Task/Combinations/M2000-Interpreter/combinations-1.m2000 index a5f1f5bb7e..47e46a34ce 100644 --- a/Task/Combinations/M2000-Interpreter/combinations-1.m2000 +++ b/Task/Combinations/M2000-Interpreter/combinations-1.m2000 @@ -1,41 +1,32 @@ Module Checkit { - Global a$ - Document a$ - Module Combinations (m as long, n as long){ + Function Combinations (m as long, n as long){ + Global a$ + Document a$ Module Level (n, s, h) { - If n=1 then { - while Len(s) { - Print h, car(s) - ToClipBoard() + If n=1 then + while Len(s) + a$<=h#str$("-")+"-"+car(s)#str$()+{ + } s=cdr(s) - } - } Else { - While len(s) { + End While + Else + While len(s) call Level n-1, cdr(s), cons(h, car(s)) s=cdr(s) - } - } - Sub ToClipBoard() - local m=each(h) - Local b$="" - While m { - b$+=If$(Len(b$)<>0->" ","")+Format$("{0::-10}",Array(m)) - } - b$+=If$(Len(b$)<>0->" ","")+Format$("{0::-10}",Array(s,0))+{ - } - a$<=b$ ' assign to global need <= - End Sub + End While + End if } If m<1 or n<1 then Error s=(,) - for i=0 to n-1 { - s=cons(s, (i,)) - } + for i=0 to n-1 + Append s, (i,) + next + s=s#sort() Head=(,) Call Level m, s, Head + =a$ } - Clear a$ - Combinations 3, 5 - ClipBoard a$ + ClipBoard Combinations( 3, 5) + report clipboard$ } Checkit diff --git a/Task/Combinations/M2000-Interpreter/combinations-2.m2000 b/Task/Combinations/M2000-Interpreter/combinations-2.m2000 index 96566c892d..9d851f853b 100644 --- a/Task/Combinations/M2000-Interpreter/combinations-2.m2000 +++ b/Task/Combinations/M2000-Interpreter/combinations-2.m2000 @@ -1,45 +1,55 @@ Module StepByStep { - Function CombinationsStep (a, nn) { - c1=lambda (&f, &a) ->{ - =car(a) : a=cdr(a) : f=len(a)=0 - } - m=len(a) + Function CombinationsStep (a, nn) { + c1=lambda (&f, &a) ->{ + =car(a) : a=cdr(a) : f=len(a)=0 + } + m=len(a) + c=c1 + n=m-nn+1 + p=2 + While m>n + c1=lambda c2=c,n=p, z=(,) (&f, &m) ->{ + if len(z)=0 then z=cdr(m) + =cons(car(m),c2(&f, &z)) + if f then z=(,) : m=cdr(m) : f=len(m)+len(z)n { - c1=lambda c2=c,n=p, z=(,) (&f, &m) ->{ - if len(z)=0 then z=cdr(m) - =cons(car(m),c2(&f, &z)) - if f then z=(,) : m=cdr(m) : f=len(m)+len(z) { + =c(&f, &a) } - =lambda c, a (&f) -> { - =c(&f, &a) - } - } - k=false - StepA=CombinationsStep((1, 2, 3, 4,5), 3) - while not k { - Print StepA(&k) - } - k=false - StepA=CombinationsStep((0, 1, 2, 3, 4), 3) - while not k { - Print StepA(&k) - } - k=false - StepA=CombinationsStep(("A", "B", "C", "D","E"), 3) - while not k { - Print StepA(&k) - } - k=false - StepA=CombinationsStep(("CAT", "DOG", "BAT"), 2) - while not k { - Print StepA(&k) - } + } + enum out {screen="", file="out.txt"} + m=each(out) + while m + open eval(m) for output as #f + k=false + StepA=CombinationsStep((1, 2, 3, 4,5), 3) + While not k + Print #f, StepA(&k)#str$() + End While + Print #f + k=false + StepA=CombinationsStep((0, 1, 2, 3, 4), 3) + While not k + Print #f, StepA(&k)#str$() + End While + Print #f + k=false + StepA=CombinationsStep(("A", "B", "C", "D","E"), 3) + While not k + Print #f, StepA(&k)#str$("-") + End While + Print #f + k=false + StepA=CombinationsStep(("CAT", "DOG", "BAT"), 2) + While not k + Print #f, StepA(&k)#str$("-") + End While + close #f + end while + win "notepad", dir$+file } StepByStep diff --git a/Task/Combinations/Miranda/combinations.miranda b/Task/Combinations/Miranda/combinations.miranda new file mode 100644 index 0000000000..eecb62e799 --- /dev/null +++ b/Task/Combinations/Miranda/combinations.miranda @@ -0,0 +1,8 @@ +main :: [sys_message] +main = [Stdout (lay (map show (comb 3 5)))] + +comb :: num->num->[[num]] +comb m n = comb' m [0..n-1] + where comb' 0 xs = [[]] + comb' m [] = [] + comb' m (x:xs) = map (x:) (comb' (m-1) xs) ++ comb' m xs diff --git a/Task/Combinations/OCaml/combinations.ocaml b/Task/Combinations/OCaml/combinations.ml similarity index 100% rename from Task/Combinations/OCaml/combinations.ocaml rename to Task/Combinations/OCaml/combinations.ml diff --git a/Task/Combinations/PascalABC.NET/combinations.pas b/Task/Combinations/PascalABC.NET/combinations.pas new file mode 100644 index 0000000000..c57e1ec639 --- /dev/null +++ b/Task/Combinations/PascalABC.NET/combinations.pas @@ -0,0 +1,2 @@ +## +(0..4).combinations(3).printlines; diff --git a/Task/Combinations/Pluto/combinations.pluto b/Task/Combinations/Pluto/combinations.pluto new file mode 100644 index 0000000000..7ce223467b --- /dev/null +++ b/Task/Combinations/Pluto/combinations.pluto @@ -0,0 +1,10 @@ +require "perm" +local fmt = require "fmt" + +local a = range(0, 4) +local co = coroutine.create(comb.generate) +while true do + local _, res = coroutine.resume(co, a, 3) + if !res then break end + fmt.lprint(res) +end diff --git a/Task/Combinations/PowerShell/combinations.psh b/Task/Combinations/PowerShell/combinations.ps1 similarity index 100% rename from Task/Combinations/PowerShell/combinations.psh rename to Task/Combinations/PowerShell/combinations.ps1 diff --git a/Task/Combinations/Pyret/combinations.pyret b/Task/Combinations/Pyret/combinations.arr similarity index 100% rename from Task/Combinations/Pyret/combinations.pyret rename to Task/Combinations/Pyret/combinations.arr diff --git a/Task/Combinations/Quackery/combinations-1.quackery b/Task/Combinations/Quackery/combinations-1.quackery index 697808559d..ccf881afbe 100644 --- a/Task/Combinations/Quackery/combinations-1.quackery +++ b/Task/Combinations/Quackery/combinations-1.quackery @@ -1,48 +1,21 @@ - [ 0 swap - [ dup 0 != while - dup 1 & if - [ dip 1+ ] - 1 >> again ] - drop ] is bits ( n --> n ) - - [ [] unrot - bit times - [ i bits - over = if - [ dip - [ i join ] ] ] - drop ] is combnums ( n n --> [ ) - - [ [] 0 rot - [ dup 0 != while - dup 1 & if - [ dip - [ dup dip join ] ] - dip 1+ - 1 >> - again ] - 2drop ] is makecomb ( n --> [ ) - [ over 0 = iff - [ 2drop [] ] done - combnums - [] swap witheach - [ makecomb - nested join ] ] is comb ( n n --> [ ) + [ 2drop ' [ [ ] ] ] + done + dup [] = iff nip done + 1 split rot tuck + 1 - over recurse + dip [ rot [] ] + witheach + [ dip over join + nested join ] + nip unrot recurse join ] is comb ( n [ --> [ ) - [ behead swap witheach max ] is largest ( [ --> n ) + [ [] swap times + [ i^ join ] + comb + witheach + [ witheach + [ echo sp ] + cr ] ] is task ( n n --> ) - [ 0 rot witheach - [ [ dip [ over * ] ] + ] - nip ] is comborder ( [ n --> n ) - - [ dup [] != while - sortwith - [ 2dup join - largest 1+ dup dip - [ comborder swap ] - comborder < ] ] is sortcombs ( [ --> [ ) - - 3 5 comb - sortcombs - witheach [ witheach [ echo sp ] cr ] + 3 5 task diff --git a/Task/Combinations/Quackery/combinations-2.quackery b/Task/Combinations/Quackery/combinations-2.quackery index 5626470d75..697808559d 100644 --- a/Task/Combinations/Quackery/combinations-2.quackery +++ b/Task/Combinations/Quackery/combinations-2.quackery @@ -1,31 +1,48 @@ - [ stack ] is comb.stack - [ stack ] is comb.items - [ stack ] is comb.required - [ stack ] is comb.result + [ 0 swap + [ dup 0 != while + dup 1 & if + [ dip 1+ ] + 1 >> again ] + drop ] is bits ( n --> n ) - [ 1 - comb.items put - 1+ comb.required put - 0 comb.stack put - [] comb.result put - [ comb.required share - comb.stack size = if - [ comb.result take - comb.stack behead - drop nested join - comb.result put ] - comb.stack take - dup comb.items share - = iff - [ drop - comb.stack size 1 > iff - [ 1 comb.stack tally ] ] - else - [ dup comb.stack put - 1+ comb.stack put ] - comb.stack size 1 = until ] - comb.items release - comb.required release - comb.result take ] is comb ( n n --> ) + [ [] unrot + bit times + [ i bits + over = if + [ dip + [ i join ] ] ] + drop ] is combnums ( n n --> [ ) + + [ [] 0 rot + [ dup 0 != while + dup 1 & if + [ dip + [ dup dip join ] ] + dip 1+ + 1 >> + again ] + 2drop ] is makecomb ( n --> [ ) + + [ over 0 = iff + [ 2drop [] ] done + combnums + [] swap witheach + [ makecomb + nested join ] ] is comb ( n n --> [ ) + + [ behead swap witheach max ] is largest ( [ --> n ) + + [ 0 rot witheach + [ [ dip [ over * ] ] + ] + nip ] is comborder ( [ n --> n ) + + [ dup [] != while + sortwith + [ 2dup join + largest 1+ dup dip + [ comborder swap ] + comborder < ] ] is sortcombs ( [ --> [ ) 3 5 comb + sortcombs witheach [ witheach [ echo sp ] cr ] diff --git a/Task/Combinations/Quackery/combinations-3.quackery b/Task/Combinations/Quackery/combinations-3.quackery index 721a651555..5626470d75 100644 --- a/Task/Combinations/Quackery/combinations-3.quackery +++ b/Task/Combinations/Quackery/combinations-3.quackery @@ -1,16 +1,31 @@ - [ dup size dip - [ witheach - [ over swap peek swap ] ] - nip pack ] is arrange ( [ [ --> [ ) + [ stack ] is comb.stack + [ stack ] is comb.items + [ stack ] is comb.required + [ stack ] is comb.result + + [ 1 - comb.items put + 1+ comb.required put + 0 comb.stack put + [] comb.result put + [ comb.required share + comb.stack size = if + [ comb.result take + comb.stack behead + drop nested join + comb.result put ] + comb.stack take + dup comb.items share + = iff + [ drop + comb.stack size 1 > iff + [ 1 comb.stack tally ] ] + else + [ dup comb.stack put + 1+ comb.stack put ] + comb.stack size 1 = until ] + comb.items release + comb.required release + comb.result take ] is comb ( n n --> ) - ' [ 10 20 30 40 50 ] 3 5 comb - witheach - [ dip dup arrange - witheach [ echo sp ] - cr ] - drop - cr - $ "zero one two three four" nest$ - ' [ 4 3 1 0 1 4 3 ] arrange - witheach [ echo$ sp ] + witheach [ witheach [ echo sp ] cr ] diff --git a/Task/Combinations/Quackery/combinations-4.quackery b/Task/Combinations/Quackery/combinations-4.quackery new file mode 100644 index 0000000000..721a651555 --- /dev/null +++ b/Task/Combinations/Quackery/combinations-4.quackery @@ -0,0 +1,16 @@ + [ dup size dip + [ witheach + [ over swap peek swap ] ] + nip pack ] is arrange ( [ [ --> [ ) + + ' [ 10 20 30 40 50 ] + 3 5 comb + witheach + [ dip dup arrange + witheach [ echo sp ] + cr ] + drop + cr + $ "zero one two three four" nest$ + ' [ 4 3 1 0 1 4 3 ] arrange + witheach [ echo$ sp ] diff --git a/Task/Combinations/Refal/combinations.refal b/Task/Combinations/Refal/combinations.refal new file mode 100644 index 0000000000..8b8d5ce984 --- /dev/null +++ b/Task/Combinations/Refal/combinations.refal @@ -0,0 +1,23 @@ +$ENTRY Go { + = >; +}; + +Comb { + s.M s.N = >>; +}; + +Comb1 { + 0 e.X = (); + s.M = ; + s.M s.X e.X = e.X>> ; +}; + +PfxEach { + s.X = ; + s.X (e.X) e.Y = (s.X e.X) ; +}; + +Iota { + s.E s.E = s.E; + s.S s.E = s.S s.E>; +}; diff --git a/Task/Combinations/Rust/combinations-1.rust b/Task/Combinations/Rust/combinations-1.rs similarity index 100% rename from Task/Combinations/Rust/combinations-1.rust rename to Task/Combinations/Rust/combinations-1.rs diff --git a/Task/Combinations/Rust/combinations-2.rust b/Task/Combinations/Rust/combinations-2.rs similarity index 100% rename from Task/Combinations/Rust/combinations-2.rust rename to Task/Combinations/Rust/combinations-2.rs diff --git a/Task/Combinations/Rust/combinations-3.rust b/Task/Combinations/Rust/combinations-3.rs similarity index 100% rename from Task/Combinations/Rust/combinations-3.rust rename to Task/Combinations/Rust/combinations-3.rs diff --git a/Task/Combinations/Scheme/combinations.ss b/Task/Combinations/Scheme/combinations.scm similarity index 100% rename from Task/Combinations/Scheme/combinations.ss rename to Task/Combinations/Scheme/combinations.scm diff --git a/Task/Combinations/Tailspin/combinations.tailspin b/Task/Combinations/Tailspin/combinations.tailspin new file mode 100644 index 0000000000..9f728e50c4 --- /dev/null +++ b/Task/Combinations/Tailspin/combinations.tailspin @@ -0,0 +1,7 @@ +operator (m comb n) + [by 0..~$n] -> # + when <[](..~$m)> do [$..., by $(last)~..~$n] -> # + otherwise $! +end comb + +(3 comb 5) -> !OUT::write diff --git a/Task/Combinations/Uiua/combinations.uiua b/Task/Combinations/Uiua/combinations.uiua new file mode 100644 index 0000000000..e0d299cce6 --- /dev/null +++ b/Task/Combinations/Uiua/combinations.uiua @@ -0,0 +1,3 @@ +3 5 # 3 combo 5 +⊙⇡ # Create the array of numbers +⧅< # Get the permutations diff --git a/Task/Combinations/VBScript/combinations.vb b/Task/Combinations/VBScript/combinations.vbs similarity index 100% rename from Task/Combinations/VBScript/combinations.vb rename to Task/Combinations/VBScript/combinations.vbs diff --git a/Task/Comma-quibbling/00-TASK.txt b/Task/Comma-quibbling/00-TASK.txt index 4e431d60f7..6e334a374a 100644 --- a/Task/Comma-quibbling/00-TASK.txt +++ b/Task/Comma-quibbling/00-TASK.txt @@ -1,4 +1,4 @@ -Comma quibbling is a task originally set by Eric Lippert in his [http://blogs.msdn.com/b/ericlippert/archive/2009/04/15/comma-quibbling.aspx blog]. +Comma quibbling is a task originally set by Eric Lippert in his [https://web.archive.org/web/20190202111812/https://blogs.msdn.microsoft.com/ericlippert/2009/04/15/comma-quibbling/ blog]. ;Task: @@ -11,12 +11,15 @@ Write a function to generate a string output which is the concatenation of input
Test your function with the following series of inputs showing your output here on this page: -* [] # (No input words). +* [] # (No input words). * ["ABC"] * ["ABC", "DEF"] * ["ABC", "DEF", "G", "H"]
Note: Assume words are non-empty strings of uppercase characters for this task. + + +{{Template:Strings}}

diff --git a/Task/Comma-quibbling/AArch64-Assembly/comma-quibbling.aarch64 b/Task/Comma-quibbling/AArch64-Assembly/comma-quibbling.aarch64 new file mode 100644 index 0000000000..50ff3b829d --- /dev/null +++ b/Task/Comma-quibbling/AArch64-Assembly/comma-quibbling.aarch64 @@ -0,0 +1,270 @@ +/* ARM assembly AARCH64 Raspberry PI 3B */ +/* program Comma quibbling */ + +/*******************************************/ +/* Constantes */ +/*******************************************/ +/* for this file see task include a file in language AArch64 assembly*/ +.include "../includeConstantesARM64.inc" +.equ BUFFERSIZE, 80 + +/*******************************************/ +/* macros */ +/*******************************************/ +//.include "../../ficmacros64.inc" // for developper debugging + +/*********************************/ +/* Initialized data */ +/*********************************/ +.data +szMessDebutPgm: .asciz "Program 64 bits start. \n" +szCarriageReturn: .asciz "\n" +szMessFinOK: .asciz "Program normal end. \n" +szMessStringError: .asciz "Error : Empty string !!!\n" +szMessBufferError: .asciz "Error : Buffer too small !!\n" +szMessEndStringError: .asciz "Error: End string, not ].\n" +szMessWordErr: .asciz "Error word empty.\n" +szAnd: .asciz " and " +szString1: .asciz "[]" +szString2: .asciz "[\"ABC\"]" +szString3: .asciz "[\"ABC\",\"DEF\"]" +szString4: .asciz "[\"ABC\",\"DEF\",\"G\",\"H\"]" +szString5: .asciz "[\"AB" +szString6: .asciz "[\"ABC\",,\"DEF\"]" + +.align 4 +/*********************************/ +/* UnInitialized data */ +/*********************************/ +.bss +sBuffer: .skip BUFFERSIZE +.align 4 + +/*********************************/ +/* code section */ +/*********************************/ +.text +.global main +main: + ldr x0,qAdrszMessDebutPgm + bl affichageMess // start message + + ldr x0,qAdrszString1 + bl execTest + ldr x0,qAdrszString2 + bl execTest + ldr x0,qAdrszString3 + bl execTest + ldr x0,qAdrszString4 + bl execTest + ldr x0,qAdrszString5 + bl execTest + ldr x0,qAdrszString6 + bl execTest + + ldr x0,qAdrszMessFinOK + bl affichageMess + +100: + mov x8,EXIT + svc #0 // system call +qAdrszMessDebutPgm: .quad szMessDebutPgm +qAdrszMessFinOK: .quad szMessFinOK +qAdrszCarriageReturn: .quad szCarriageReturn +qAdrszString1: .quad szString1 +qAdrszString2: .quad szString2 +qAdrszString3: .quad szString3 +qAdrszString4: .quad szString4 +qAdrszString5: .quad szString5 +qAdrszString6: .quad szString6 +qAdrsBuffer: .quad sBuffer +/******************************************************************/ +/* test execution */ +/******************************************************************/ +/* x0 contains string address */ +execTest: + stp x1,lr,[sp,-16]! + stp x2,x4,[sp,-16]! + mov x4,x0 + bl affichageMess // display start string + ldr x0,qAdrszCarriageReturn + bl affichageMess + mov x0,x4 // string address + ldr x1,qAdrsBuffer // buffer address + mov x2,#BUFFERSIZE + bl stringAnalyse + cmp x0,#-1 // error ? + beq 100f + ldr x0,qAdrsBuffer // buffer display + bl affichageMess + ldr x0,qAdrszCarriageReturn + bl affichageMess +100: + ldp x2,x4,[sp],16 + ldp x1,lr,[sp],16 + ret +/******************************************************************/ +/* string conversion */ +/******************************************************************/ +/* x0 contains string address */ +/* x1 contains buffer address */ +/* x2 contains buffer length */ +stringAnalyse: + stp x1,lr,[sp,-16]! + stp x2,x3,[sp,-16]! + stp x4,x5,[sp,-16]! + stp x6,x7,[sp,-16]! + stp x8,x9,[sp,-16]! + sub sp,sp,#BUFFERSIZE // reserve area on stack for temporary buffer + mov fp,sp + mov x7,#0 // indice write buffer + mov x5,#0 // word counter + mov x6,#0 // word char count + + mov x3,#0 // indice string +1: + ldrb w4,[x0,x3] // load string char + cmp x4,#0 // end ? + bne 2f + cmp x3,#0 // first char ? + beq 97f // error empty string + b 97f // end string error +2: + cmp x4,#'[' // first symbol ? + bne 3f + mov x4,#'{' // write symbol + strb w4,[x1,x7] + add x7,x7,#1 + cmp x7,x2 + bge 99f // buffer error + add x3,x3,#1 // increment indice + b 1b // and loop + 3: + cmp x4,#']' // end symbol ? + bne 8f + cmp x5,#0 // no word ? + beq 7f + cmp x5,#1 + beq 5f // last and first word + + mov x9,#0 + ldr x12,qAdrszAnd +4: // loop write and + ldrb w4,[x12,x9] + strb w4,[x1,x7] + add x7,x7,#1 + cmp x7,x2 + bge 99f // buffer error + add x9,x9,#1 + cmp x9,#5 + blt 4b + +5: // last word + mov x9,#0 +6: // loop write temporary buffer + ldrb w4,[fp,x9] + strb w4,[x1,x7] + add x7,x7,#1 + cmp x7,x2 + bge 99f // buffer error + add x9,x9,#1 + cmp x9,x6 + blt 6b + mov x6,#0 // raz indice temporary buffer +7: + mov x4,#'}' + strb w4,[x1,x7] + add x7,x7,#1 + cmp x7,x2 + bge 99f // buffer error + mov x4,#0 + strb w4,[x1,x7] // final 0 + b 100f +8: + cmp x4,#',' // comma ? + beq 9f + cmp x6,#0 + cinc x5,x5,eq // new word increment word counter + //addeq x5,x5,#1 // new word increment word counter + strb w4,[fp,x6] // store char in temporary buffer + add x6,x6,#1 + add x3,x3,#1 + b 1b // loop + +9: + cmp x6,#0 // word empty ? + beq 96f + cmp x5,#1 // first word ? + bne 11f + // first word, write only the word + mov x9,#0 +10: // loop write temporary buffer + ldrb w4,[fp,x9] + strb w4,[x1,x7] + add x7,x7,#1 + cmp x7,x2 + bge 99f // buffer error + add x9,x9,#1 + cmp x9,x6 + blt 10b + mov x6,#0 // raz indice temporary buffer + add x3,x3,#1 + b 1b // loop +11: + mov x4,#',' + strb w4,[x1,x7] + add x7,x7,#1 + cmp x7,x2 + bge 99f // buffer error + + mov x9,#0 +12: // loop write temporary buffer + ldrb w4,[fp,x9] + strb w4,[x1,x7] + add x7,x7,#1 + cmp x7,x2 + bge 99f // buffer error + add x9,x9,#1 + cmp x9,x6 + blt 12b + mov x6,#0 // raz indice temporary buffer + add x3,x3,#1 + b 1b // loop + +96: // errors messages + ldr x0,qAdrszMessWordErr + bl affichageMess + mov x0,#-1 + b 100f +97: + ldr x0,qAdrszMessEndStringErr + bl affichageMess + mov x0,#-1 + b 100f +98: + ldr x0,qAdrszMessStringError + bl affichageMess + mov x0,#-1 + b 100f +99: + ldr x0,qAdrszMessBufferError + bl affichageMess + mov x0,#-1 +100: + add sp,sp,#BUFFERSIZE + ldp x8,x9,[sp],16 + ldp x6,x7,[sp],16 + ldp x4,x5,[sp],16 + ldp x2,x3,[sp],16 + ldp x1,lr,[sp],16 + ret +qAdrszMessStringError: .quad szMessStringError +qAdrszMessBufferError: .quad szMessBufferError +qAdrszMessEndStringErr: .quad szMessEndStringError +qAdrszMessWordErr: .quad szMessWordErr +qAdrszAnd: .quad szAnd +/***************************************************/ +/* ROUTINES INCLUDE */ +/***************************************************/ +/* for this file see task include a file in language AArch64 assembly*/ +.include "../includeARM64.inc" diff --git a/Task/Comma-quibbling/ABC/comma-quibbling.abc b/Task/Comma-quibbling/ABC/comma-quibbling.abc new file mode 100644 index 0000000000..42fb869f67 --- /dev/null +++ b/Task/Comma-quibbling/ABC/comma-quibbling.abc @@ -0,0 +1,17 @@ +HOW TO RETURN quibble words: + PUT "" IN result + PUT #words IN remaining + FOR word IN words: + PUT result^word IN result + PUT remaining-1 IN remaining + IF remaining = 1: PUT result^" and " IN result + IF remaining > 1: PUT result^", " IN result + RETURN "{" ^ result ^ "}" + +PUT {} IN tests +INSERT {} IN tests +INSERT {[1]: "ABC"} IN tests +INSERT {[1]: "ABC"; [2]: "DEF"} IN tests +INSERT {[1]: "ABC"; [2]: "DEF"; [3]: "G"; [4]: "H"} IN tests +FOR test IN tests: + WRITE quibble test/ diff --git a/Task/Comma-quibbling/ARM-Assembly/comma-quibbling.arm b/Task/Comma-quibbling/ARM-Assembly/comma-quibbling.arm new file mode 100644 index 0000000000..ebbae869ca --- /dev/null +++ b/Task/Comma-quibbling/ARM-Assembly/comma-quibbling.arm @@ -0,0 +1,260 @@ +/* ARM assembly Raspberry PI */ +/* program Comma quibbling */ + +/* REMARK 1 : this program use routines in a include file + see task Include a file language arm assembly + for the routine affichageMess conversion10 + see at end of this program the instruction include */ + +/*******************************************/ +/* Constantes */ +/*******************************************/ +.include "../constantes.inc" +.equ BUFFERSIZE, 80 + +/*******************************************/ +/* macros */ +/*******************************************/ +//.include "../../ficmacros32.inc" @ for developper debugging + +/*********************************/ +/* Initialized data */ +/*********************************/ +.data +szMessDebutPgm: .asciz "Program 32 bits start. \n" +szCarriageReturn: .asciz "\n" +szMessFinOK: .asciz "Program normal end. \n" +szMessStringError: .asciz "Error : Empty string !!!\n" +szMessBufferError: .asciz "Error : Buffer too small !!\n" +szMessEndStringError: .asciz "Error: End string, not ].\n" +szMessWordErr: .asciz "Error word empty.\n" +szAnd: .asciz " and " +szString1: .asciz "[]" +szString2: .asciz "[\"ABC\"]" +szString3: .asciz "[\"ABC\",\"DEF\"]" +szString4: .asciz "[\"ABC\",\"DEF\",\"G\",\"H\"]" +szString5: .asciz "[\"AB" +szString6: .asciz "[\"ABC\",,\"DEF\"]" + +.align 4 +/*********************************/ +/* UnInitialized data */ +/*********************************/ +.bss +sBuffer: .skip BUFFERSIZE +.align 4 + +/*********************************/ +/* code section */ +/*********************************/ +.text +.global main +main: + ldr r0,iAdrszMessDebutPgm + bl affichageMess @ start message + + ldr r0,iAdrszString1 + bl execTest + ldr r0,iAdrszString2 + bl execTest + ldr r0,iAdrszString3 + bl execTest + ldr r0,iAdrszString4 + bl execTest + ldr r0,iAdrszString5 + bl execTest + ldr r0,iAdrszString6 + bl execTest + + ldr r0,iAdrszMessFinOK + bl affichageMess + +100: + mov r7,#EXIT @ program end + svc #0 @ system call +iAdrszMessDebutPgm: .int szMessDebutPgm +iAdrszMessFinOK: .int szMessFinOK +iAdrszCarriageReturn: .int szCarriageReturn +iAdrszString1: .int szString1 +iAdrszString2: .int szString2 +iAdrszString3: .int szString3 +iAdrszString4: .int szString4 +iAdrszString5: .int szString5 +iAdrszString6: .int szString6 +iAdrsBuffer: .int sBuffer +/******************************************************************/ +/* test execution */ +/******************************************************************/ +/* r0 contains string address */ +execTest: + push {r1-r4,lr} @ save registers + mov r4,r0 + bl affichageMess @ display start string + ldr r0,iAdrszCarriageReturn + bl affichageMess + mov r0,r4 @ string address + ldr r1,iAdrsBuffer @ buffer address + mov r2,#BUFFERSIZE + bl stringAnalyse + cmp r0,#-1 @ error ? + beq 100f + ldr r0,iAdrsBuffer @ buffer display + bl affichageMess + ldr r0,iAdrszCarriageReturn + bl affichageMess +100: + pop {r1-r4,pc} +/******************************************************************/ +/* string conversion */ +/******************************************************************/ +/* r0 contains string address */ +/* r1 contains buffer address */ +/* r2 contains buffer length */ +stringAnalyse: + push {r1-r9,fp,lr} @ save registers + sub sp,sp,#BUFFERSIZE @ reserve area on stack for temporary buffer + mov fp,sp + mov r7,#0 @ indice write buffer + mov r5,#0 @ word counter + mov r6,#0 @ word char count + + mov r3,#0 @ indice string +1: + ldrb r4,[r0,r3] @ load string char + cmp r4,#0 @ end ? + bne 2f + cmp r3,#0 @ first char ? + beq 97f @ error empty string + b 97f @ end string error +2: + cmp r4,#'[' @ first symbol ? + bne 3f + mov r4,#'{' @ write symbol + strb r4,[r1,r7] + add r7,r7,#1 + cmp r7,r2 + bge 99f @ buffer error + add r3,r3,#1 @ increment indice + b 1b @ and loop + 3: + cmp r4,#']' @ end symbol ? + bne 8f + cmp r5,#0 @ no word ? + beq 7f + cmp r5,#1 + beq 5f @ last and first word + + mov r9,#0 + ldr r12,iAdrszAnd +4: @ loop write and + ldrb r4,[r12,r9] + strb r4,[r1,r7] + add r7,r7,#1 + cmp r7,r2 + bge 99f @ buffer error + add r9,r9,#1 + cmp r9,#5 + blt 4b + +5: @ last word + mov r9,#0 +6: @ loop write temporary buffer + ldrb r4,[fp,r9] + strb r4,[r1,r7] + add r7,r7,#1 + cmp r7,r2 + bge 99f @ buffer error + add r9,r9,#1 + cmp r9,r6 + blt 6b + mov r6,#0 @ raz indice temporary buffer +7: + mov r4,#'}' + strb r4,[r1,r7] + add r7,r7,#1 + cmp r7,r2 + bge 99f @ buffer error + mov r4,#0 + strb r4,[r1,r7] @ final 0 + b 100f +8: + cmp r4,#',' @ comma ? + beq 9f + cmp r6,#0 + addeq r5,r5,#1 @ new word increment word counter + strb r4,[fp,r6] @ store char in temporary buffer + add r6,r6,#1 + add r3,r3,#1 + b 1b @ loop + +9: + cmp r6,#0 @ word empty ? + beq 96f + cmp r5,#1 @ first word ? + bne 11f + @ first word, write only the word + mov r9,#0 +10: @ loop write temporary buffer + ldrb r4,[fp,r9] + strb r4,[r1,r7] + add r7,r7,#1 + cmp r7,r2 + bge 99f @ buffer error + add r9,r9,#1 + cmp r9,r6 + blt 10b + mov r6,#0 @ raz indice temporary buffer + add r3,r3,#1 + b 1b @ loop +11: + mov r4,#',' + strb r4,[r1,r7] + add r7,r7,#1 + cmp r7,r2 + bge 99f @ buffer error + + mov r9,#0 +12: @ loop write temporary buffer + ldrb r4,[fp,r9] + strb r4,[r1,r7] + add r7,r7,#1 + cmp r7,r2 + bge 99f @ buffer error + add r9,r9,#1 + cmp r9,r6 + blt 12b + mov r6,#0 @ raz indice temporary buffer + add r3,r3,#1 + b 1b @ loop + +96: @ errors messages + ldr r0,iAdrszMessWordErr + bl affichageMess + mov r0,#-1 + b 100f +97: + ldr r0,iAdrszMessEndStringErr + bl affichageMess + mov r0,#-1 + b 100f +98: + ldr r0,iAdrszMessStringError + bl affichageMess + mov r0,#-1 + b 100f +99: + ldr r0,iAdrszMessBufferError + bl affichageMess + mov r0,#-1 +100: + add sp,sp,#BUFFERSIZE + pop {r1-r9,fp,pc} +iAdrszMessStringError: .int szMessStringError +iAdrszMessBufferError: .int szMessBufferError +iAdrszMessEndStringErr: .int szMessEndStringError +iAdrszMessWordErr: .int szMessWordErr +iAdrszAnd: .int szAnd +/***************************************************/ +/* ROUTINES INCLUDE */ +/***************************************************/ +.include "../affichage.inc" diff --git a/Task/Comma-quibbling/Ada/comma-quibbling.ada b/Task/Comma-quibbling/Ada/comma-quibbling.adb similarity index 100% rename from Task/Comma-quibbling/Ada/comma-quibbling.ada rename to Task/Comma-quibbling/Ada/comma-quibbling.adb diff --git a/Task/Comma-quibbling/Arturo/comma-quibbling.arturo b/Task/Comma-quibbling/Arturo/comma-quibbling.arturo index e34a1676ac..a427253a6f 100644 --- a/Task/Comma-quibbling/Arturo/comma-quibbling.arturo +++ b/Task/Comma-quibbling/Arturo/comma-quibbling.arturo @@ -1,9 +1,9 @@ quibble: $[sequence :block][ - if? 0 = size sequence - -> return "{}" + if 0 = size sequence + -> return "{}" - if? 1 = size sequence - -> return ~"{|sequence\0|}" + if 1 = size sequence + -> return ~"{|sequence\0|}" last: pop 'sequence return ~« {|join.with: ", " sequence| and |last|} diff --git a/Task/Comma-quibbling/COBOL/comma-quibbling.cobol b/Task/Comma-quibbling/COBOL/comma-quibbling.cob similarity index 100% rename from Task/Comma-quibbling/COBOL/comma-quibbling.cobol rename to Task/Comma-quibbling/COBOL/comma-quibbling.cob diff --git a/Task/Comma-quibbling/Commodore-BASIC/comma-quibbling.basic b/Task/Comma-quibbling/Commodore-BASIC/comma-quibbling.basic new file mode 100644 index 0000000000..b0011e5f3b --- /dev/null +++ b/Task/Comma-quibbling/Commodore-BASIC/comma-quibbling.basic @@ -0,0 +1,25 @@ +100 DIM A$(3) +110 FOR TC=1 TO 4 +120 : READ A: IF A=0 THEN 160 +130 : FOR I=0 TO A-1 +140 : READ A$(I) +150 : NEXT I +160 : GOSUB 200 +170 : PRINT CQ$ +180 NEXT TC +190 END +200 CQ$="[" +210 IF A < 1 THEN 290 +220 CQ$ = CQ$ + A$(0) +230 IF A < 2 THEN 290 +240 IF A < 3 THEN 280 +250 FOR I=1 TO A - 2 +260 : CQ$ = CQ$ + ", " + A$(I) +270 NEXT I +280 CQ$ = CQ$ + " AND " + A$(A - 1) +290 CQ$ = CQ$ + "]" +300 RETURN +310 DATA 0 +320 DATA 1, ABC +330 DATA 2, ABC, DEF +340 DATA 4, ABC, DEF, G, H diff --git a/Task/Comma-quibbling/Crystal/comma-quibbling.cr b/Task/Comma-quibbling/Crystal/comma-quibbling.cr new file mode 100644 index 0000000000..c9464e6016 --- /dev/null +++ b/Task/Comma-quibbling/Crystal/comma-quibbling.cr @@ -0,0 +1,19 @@ +def comma_quibble (arr) + "{" + + case arr.size + when 0 + "" + when 1 + arr[0] + else + arr[..-2].join(", ") + " and #{arr[-1]}" + end + "}" +end + +[[] of String, # (No input words). + ["ABC"], + ["ABC", "DEF"], + ["ABC", "DEF", "G", "H"], +].each do |input| + puts comma_quibble(input) +end diff --git a/Task/Comma-quibbling/Dc/comma-quibbling.dc b/Task/Comma-quibbling/Dc/comma-quibbling.dc new file mode 100644 index 0000000000..33bb18889b --- /dev/null +++ b/Task/Comma-quibbling/Dc/comma-quibbling.dc @@ -0,0 +1,32 @@ +[(q)uibble: main entry point. print brackets, calling n in between if stack not + empty.]sx +[ [{]n z 0 !=n [}]pR ]sq + +[(n)onempty: if more than 1 item, call m. then print top of stack.]sx +[ z 1 !=m n ]sn + +[(m)ore: call f to flip stack into r register, call p to print most of it, + then pop the last item back onto the main stack so it's there to be printed + after we return]sx +[ lfx lpx Lr ]sm + +[(f)lip: utility routine to reverse the stack into the r register]sx +[ Sr z 0 !=f ]sf + +[(p)rint: get next item from stack in r register and print it. If there are + more than 2 items left on the register stack (which never drops below one + item), print a comma (c) and recurse. If there are exactly two items left, + print " and " (a) and return.]sx +[ Lr n 2 yr >c 2 yr =a 2 yr >p]sp + +[(c)omma: utility routine to print a comma followed by a space]sx +[ [, ]n ]sc + +[(a)and: utility routine to print " and "]sx +[ [ and ]n ]sa + +[run tests]sx +lqx +[ABC] lqx +[ABC] [DEF] lqx +[ABC] [DEF] [G] [H] lqx diff --git a/Task/Comma-quibbling/EasyLang/comma-quibbling.easy b/Task/Comma-quibbling/EasyLang/comma-quibbling.easy new file mode 100644 index 0000000000..9241769aeb --- /dev/null +++ b/Task/Comma-quibbling/EasyLang/comma-quibbling.easy @@ -0,0 +1,16 @@ +func$ tolist s$ . + s$[] = strsplit s$ " " + r$ = "{" + n = len s$[] + for i = 1 to n - 2 : r$ &= s$[i] & ", " + if n > 0 + if n > 1 : r$ &= s$[n - 1] & " and " + r$ &= s$[n] + . + r$ &= "}" + return r$ +. +print tolist "" +print tolist "ABC" +print tolist "ABC DEF" +print tolist "ABC DEF G H" diff --git a/Task/Comma-quibbling/Ed/comma-quibbling.ed b/Task/Comma-quibbling/Ed/comma-quibbling.ed new file mode 100644 index 0000000000..ac9da0cba8 --- /dev/null +++ b/Task/Comma-quibbling/Ed/comma-quibbling.ed @@ -0,0 +1,8 @@ +# by Artyom Bologov +H +,p +g/.*/s/ /, /g +g/[,]/s/,\([^,]*\)$/ and\1/ +g/.*/s//{&}/ +,p +Q diff --git a/Task/Comma-quibbling/Elena/comma-quibbling-1.elena b/Task/Comma-quibbling/Elena/comma-quibbling-1.elena new file mode 100644 index 0000000000..7d110e9b1f --- /dev/null +++ b/Task/Comma-quibbling/Elena/comma-quibbling-1.elena @@ -0,0 +1,23 @@ +import system'routines; +import extensions; +import extensions'text; + +public extension QuibbleOp : Array +{ + string quibble() + { + ^ self.zipBy( + self.Length.coundDown().selectBy::(n => (n == self.Length) ? EmptyString : ((n == 1) ? " and " : ", ") ), + (word, prefix => prefix + word) + ) + .summarize(StringWriter.load("{")) + "}" + } +} + +public Program() +{ + Console.printLine(new string[] { }.quibble()); + Console.printLine(new string[] { "ABC" }.quibble()); + Console.printLine(new string[] { "ABC", "ADF" }.quibble()); + Console.printLine(new string[] { "ABC", "DEF", "G", "H" }.quibble()) +} diff --git a/Task/Comma-quibbling/Elena/comma-quibbling-2.elena b/Task/Comma-quibbling/Elena/comma-quibbling-2.elena new file mode 100644 index 0000000000..f59b89451f --- /dev/null +++ b/Task/Comma-quibbling/Elena/comma-quibbling-2.elena @@ -0,0 +1,31 @@ +import extensions; +import textgen; + +const string Script = "<={{=>for (var i := 0; i < self.Length; i := i + 1) { + if (i > 0) { + if (i == self.Length - 1) { + <= and => + } + else { + <=, => + } + }; + + <={self[i]}=> + }; <=}}=>"; + +public extension QuibbleOp : Array +{ + string quibble() + { + ^ self.generateFrom(Script); + } +} + +public Program() +{ + Console.printLine(new string[] { }.quibble()); + Console.printLine(new string[] { "ABC" }.quibble()); + Console.printLine(new string[] { "ABC", "ADF" }.quibble()); + Console.printLine(new string[] { "ABC", "DEF", "G", "H" }.quibble()) +} diff --git a/Task/Comma-quibbling/Elixir/comma-quibbling.elixir b/Task/Comma-quibbling/Elixir/comma-quibbling.ex similarity index 100% rename from Task/Comma-quibbling/Elixir/comma-quibbling.elixir rename to Task/Comma-quibbling/Elixir/comma-quibbling.ex diff --git a/Task/Comma-quibbling/FutureBasic/comma-quibbling-3.basic b/Task/Comma-quibbling/FutureBasic/comma-quibbling-3.basic new file mode 100644 index 0000000000..aca32cb04f --- /dev/null +++ b/Task/Comma-quibbling/FutureBasic/comma-quibbling-3.basic @@ -0,0 +1,16 @@ +local fn Quibble( string as CFStringRef ) as CFStringRef + CfArrayRef arr = fn StringComponentsSeparatedByString( string, @" " ) + CFStringRef rst + if ( len(arr) == 0 ) then rst = @"" else rst = fn StringWithFormat( @"%@", fn ArrayLastObject( arr ) ) + if ( len(arr) > 1 ) + CFArrayRef subArray = fn ArraySubarrayWithRange( arr, fn CFRangeMake( 0, len(arr) - 1 ) ) + rst = fn StringWithFormat( @"%@ and %@", fn ArrayComponentsJoinedByString( subArray, @", " ), rst ) + end if +end fn = fn StringWithFormat( @"{%@}", rst ) + +print fn Quibble( @"" ) +print fn Quibble( @"ABC") +print fn Quibble( @"ABC DEF" ) +print fn Quibble( @"ABC DEF G H" ) + +HandleEvents diff --git a/Task/Comma-quibbling/Julia/comma-quibbling.julia b/Task/Comma-quibbling/Julia/comma-quibbling.jl similarity index 100% rename from Task/Comma-quibbling/Julia/comma-quibbling.julia rename to Task/Comma-quibbling/Julia/comma-quibbling.jl diff --git a/Task/Comma-quibbling/Kotlin/comma-quibbling.kotlin b/Task/Comma-quibbling/Kotlin/comma-quibbling.kts similarity index 100% rename from Task/Comma-quibbling/Kotlin/comma-quibbling.kotlin rename to Task/Comma-quibbling/Kotlin/comma-quibbling.kts diff --git a/Task/Comma-quibbling/Nu/comma-quibbling.nu b/Task/Comma-quibbling/Nu/comma-quibbling.nu new file mode 100644 index 0000000000..1af48327db --- /dev/null +++ b/Task/Comma-quibbling/Nu/comma-quibbling.nu @@ -0,0 +1,13 @@ +def quibble [] { + if ($in | length) < 3 { $in } else [($in | drop | str join ', ') ($in | last)] + | $'{($in | str join " and ")}' +} + +# test +[ + [] + [ABC] + [ABC DEF] + [ABC DEF G H] +] +| each { quibble } diff --git a/Task/Comma-quibbling/OCaml/comma-quibbling-1.ocaml b/Task/Comma-quibbling/OCaml/comma-quibbling-1.ml similarity index 100% rename from Task/Comma-quibbling/OCaml/comma-quibbling-1.ocaml rename to Task/Comma-quibbling/OCaml/comma-quibbling-1.ml diff --git a/Task/Comma-quibbling/OCaml/comma-quibbling-2.ocaml b/Task/Comma-quibbling/OCaml/comma-quibbling-2.ml similarity index 100% rename from Task/Comma-quibbling/OCaml/comma-quibbling-2.ocaml rename to Task/Comma-quibbling/OCaml/comma-quibbling-2.ml diff --git a/Task/Comma-quibbling/PHP/comma-quibbling.php b/Task/Comma-quibbling/PHP/comma-quibbling.php index 296c9e2c0f..8562b6bafd 100644 --- a/Task/Comma-quibbling/PHP/comma-quibbling.php +++ b/Task/Comma-quibbling/PHP/comma-quibbling.php @@ -1,18 +1,21 @@ diff --git a/Task/Comma-quibbling/Pluto/comma-quibbling.pluto b/Task/Comma-quibbling/Pluto/comma-quibbling.pluto new file mode 100644 index 0000000000..ae82288a57 --- /dev/null +++ b/Task/Comma-quibbling/Pluto/comma-quibbling.pluto @@ -0,0 +1,10 @@ +local function quibbling(w) + local c = #w + if c == 0 then return "{}" end + if c == 1 then return $"\{{w[1]}}" end + if c == 2 then return $"\{{w[1]} and {w[2]}}" end + return $"\{{w:slice(1, #w - 1):concat(", ")} and {w[#w]}}" +end + +local words = { {}, {"ABC"}, {"ABC", "DEF"}, {"ABC", "DEF", "G", "H"} } +for words as w do print(quibbling(w)) end diff --git a/Task/Comma-quibbling/PowerShell/comma-quibbling-1.psh b/Task/Comma-quibbling/PowerShell/comma-quibbling-1.ps1 similarity index 100% rename from Task/Comma-quibbling/PowerShell/comma-quibbling-1.psh rename to Task/Comma-quibbling/PowerShell/comma-quibbling-1.ps1 diff --git a/Task/Comma-quibbling/PowerShell/comma-quibbling-2.psh b/Task/Comma-quibbling/PowerShell/comma-quibbling-2.ps1 similarity index 100% rename from Task/Comma-quibbling/PowerShell/comma-quibbling-2.psh rename to Task/Comma-quibbling/PowerShell/comma-quibbling-2.ps1 diff --git a/Task/Comma-quibbling/PowerShell/comma-quibbling-3.psh b/Task/Comma-quibbling/PowerShell/comma-quibbling-3.ps1 similarity index 100% rename from Task/Comma-quibbling/PowerShell/comma-quibbling-3.psh rename to Task/Comma-quibbling/PowerShell/comma-quibbling-3.ps1 diff --git a/Task/Comma-quibbling/REBOL/comma-quibbling-2.rebol b/Task/Comma-quibbling/REBOL/comma-quibbling-2.rebol deleted file mode 100644 index 42c9c25002..0000000000 --- a/Task/Comma-quibbling/REBOL/comma-quibbling-2.rebol +++ /dev/null @@ -1,24 +0,0 @@ -Rebol [] - -; builds string instead of using an intermediate block - -comma-quibbling: func [block /oxford /local s length] [ - length: length? block - rejoin [ - "^{" - - either length < 2 [to-string block] [ - s: to-string block/1 - for n 2 (length - 1) 1 [repend s [", " pick block n]] - if all [oxford (length > 2)] [append s ","] - repend s [" and " last block] - ] - - "^}" - ] -] - -test: [[] [ABC] [ABC DEF] [ABC DEF G H]] -foreach t test [print comma-quibbling t] -print "Now with Oxford comma" -foreach t test [print comma-quibbling/oxford t] diff --git a/Task/Comma-quibbling/Rebol/comma-quibbling-1.rebol b/Task/Comma-quibbling/Rebol/comma-quibbling-1.rebol new file mode 100644 index 0000000000..9adf877190 --- /dev/null +++ b/Task/Comma-quibbling/Rebol/comma-quibbling-1.rebol @@ -0,0 +1,2 @@ +head change/part find/last combine/with [ABC DEF G H] ", " #"," " and" 1 +;== "ABC, DEF, G and H" diff --git a/Task/Comma-quibbling/REBOL/comma-quibbling-1.rebol b/Task/Comma-quibbling/Rebol/comma-quibbling-2.rebol similarity index 100% rename from Task/Comma-quibbling/REBOL/comma-quibbling-1.rebol rename to Task/Comma-quibbling/Rebol/comma-quibbling-2.rebol diff --git a/Task/Comma-quibbling/Rebol/comma-quibbling-3.rebol b/Task/Comma-quibbling/Rebol/comma-quibbling-3.rebol new file mode 100644 index 0000000000..1680b96b7d --- /dev/null +++ b/Task/Comma-quibbling/Rebol/comma-quibbling-3.rebol @@ -0,0 +1,24 @@ +Rebol [] + +; builds string instead of using an intermediate block + +comma-quibbling: func [block /oxford /local s length] [ + length: length? block + rejoin [ + "^{" + + either length < 2 [to string! block] [ + s: to string! block/1 + for n 2 (length - 1) 1 [repend s [", " pick block n]] + if all [oxford (length > 2)] [append s ","] + repend s [" and " last block] + ] + + "^}" + ] +] + +test: [[] [ABC] [ABC DEF] [ABC DEF G H]] +foreach t test [print comma-quibbling t] +print "Now with Oxford comma" +foreach t test [print comma-quibbling/oxford t] diff --git a/Task/Comma-quibbling/Refal/comma-quibbling.refal b/Task/Comma-quibbling/Refal/comma-quibbling.refal new file mode 100644 index 0000000000..5c52faa392 --- /dev/null +++ b/Task/Comma-quibbling/Refal/comma-quibbling.refal @@ -0,0 +1,17 @@ +$ENTRY Go { + = > + > + > + >; +}; + +Quibble { + e.X = '{' '}'; +}; + +Quibble1 { + = ; + (e.Word) = e.Word; + (e.Word1) (e.Word2) = e.Word1 ' and ' e.Word2; + (e.Word) e.Words = e.Word ', ' ; +}; diff --git a/Task/Comma-quibbling/Rust/comma-quibbling.rust b/Task/Comma-quibbling/Rust/comma-quibbling.rs similarity index 100% rename from Task/Comma-quibbling/Rust/comma-quibbling.rust rename to Task/Comma-quibbling/Rust/comma-quibbling.rs diff --git a/Task/Comma-quibbling/SETL/comma-quibbling.setl b/Task/Comma-quibbling/SETL/comma-quibbling.setl new file mode 100644 index 0000000000..8d332e3245 --- /dev/null +++ b/Task/Comma-quibbling/SETL/comma-quibbling.setl @@ -0,0 +1,27 @@ +program comma_quibbling; + tests := [ + [], + ["ABC"], + ["ABC","DEF"], + ["ABC","DEF","G","H"] + ]; + + loop for t in tests do + print(t, "=", quibble(t)); + end loop; + + proc quibble(words); + ret := '{'; + loop while words /= [] do + word fromb words; + ret +:= word; + case of + (#words = 1): + ret +:= " and "; + (#words > 1): + ret +:= ", "; + end case; + end loop; + return ret + '}'; + end proc; +end program; diff --git a/Task/Comma-quibbling/Scheme/comma-quibbling.ss b/Task/Comma-quibbling/Scheme/comma-quibbling.scm similarity index 100% rename from Task/Comma-quibbling/Scheme/comma-quibbling.ss rename to Task/Comma-quibbling/Scheme/comma-quibbling.scm diff --git a/Task/Comma-quibbling/UNIX-Shell/comma-quibbling-1.sh b/Task/Comma-quibbling/UNIX-Shell/comma-quibbling-1.sh new file mode 100644 index 0000000000..2d01c5e9a7 --- /dev/null +++ b/Task/Comma-quibbling/UNIX-Shell/comma-quibbling-1.sh @@ -0,0 +1,15 @@ +quibble() { + printf '{' + while (( $# > 2 )); do + printf '%s, ' "$1" + shift + done + if (( $# )); then + printf '%s' "$1" + shift + fi + if (( $# )); then + printf ' and %s' "$1" + fi + printf '%s\n' '}' +} diff --git a/Task/Comma-quibbling/UNIX-Shell/comma-quibbling-2.sh b/Task/Comma-quibbling/UNIX-Shell/comma-quibbling-2.sh new file mode 100644 index 0000000000..1f9d5837f0 --- /dev/null +++ b/Task/Comma-quibbling/UNIX-Shell/comma-quibbling-2.sh @@ -0,0 +1,15 @@ +quibble() { + printf '{' + while [ $# -gt 2 ]; do + printf '%s, ' "$1" + shift + done + if [ $# -gt 0 ]; then + printf '%s' "$1" + shift + fi + if [ $# -gt 0 ]; then + printf ' and %s' "$1" + fi + printf '%s\n' '}' +} diff --git a/Task/Comma-quibbling/UNIX-Shell/comma-quibbling-3.sh b/Task/Comma-quibbling/UNIX-Shell/comma-quibbling-3.sh new file mode 100644 index 0000000000..ee2aec6306 --- /dev/null +++ b/Task/Comma-quibbling/UNIX-Shell/comma-quibbling-3.sh @@ -0,0 +1,5 @@ +quibble() { + printf '{' + if (( $# > 1 )) printf '%s and ' ${(j:, :)@[1,-2]} + printf '%s}\n' $@[-1] +} diff --git a/Task/Comma-quibbling/UNIX-Shell/comma-quibbling-4.sh b/Task/Comma-quibbling/UNIX-Shell/comma-quibbling-4.sh new file mode 100644 index 0000000000..9dd8361285 --- /dev/null +++ b/Task/Comma-quibbling/UNIX-Shell/comma-quibbling-4.sh @@ -0,0 +1,4 @@ +quibble +quibble ABC +quibble ABC DEF +quibble ABC DEF G H diff --git a/Task/Comma-quibbling/UNIX-Shell/comma-quibbling.sh b/Task/Comma-quibbling/UNIX-Shell/comma-quibbling.sh deleted file mode 100644 index 0753bac442..0000000000 --- a/Task/Comma-quibbling/UNIX-Shell/comma-quibbling.sh +++ /dev/null @@ -1,15 +0,0 @@ -quibble() { - # Here awk(1) is easier than sed(1). - awk 'BEGIN { - for (i = 1; i < ARGC - 2; i++) s = s ARGV[i] ", " - i = ARGC - 2; if (i > 0) s = s ARGV[i] " and " - i = ARGC - 1; if (i > 0) s = s ARGV[i] - printf "{%s}\n", s - exit 0 - }' "$@" -} - -quibble -quibble ABC -quibble ABC DEF -quibble ABC DEF G H diff --git a/Task/Comma-quibbling/Uiua/comma-quibbling.uiua b/Task/Comma-quibbling/Uiua/comma-quibbling.uiua new file mode 100644 index 0000000000..318a769baa --- /dev/null +++ b/Task/Comma-quibbling/Uiua/comma-quibbling.uiua @@ -0,0 +1,6 @@ +Tests ← {{} + {"ABC"} + {"ABC" "DEF"} + {"ABC" "DEF" "G" "H"}} +Quibble ← |1 ⨬(⋅""|°□⊢|$"_ and _"°⊟|Quibble⊂⊃(□$"_, _"°⊟↙2)↘₂)↧3⊸⧻ +⍚(&p$"{_}"Quibble) Tests diff --git a/Task/Comma-quibbling/V-(Vlang)/comma-quibbling.v b/Task/Comma-quibbling/V-(Vlang)/comma-quibbling.v index dbfb561110..6d8c5779ea 100644 --- a/Task/Comma-quibbling/V-(Vlang)/comma-quibbling.v +++ b/Task/Comma-quibbling/V-(Vlang)/comma-quibbling.v @@ -1,23 +1,15 @@ fn q(s []string) string { match s.len { - 0 { - return '{}' - } - 1 { - return '{${s[0]}}' - } - 2 { - return '{${s[0]} and ${s[1]}}' - } - else{ - return '{${s[0..s.len-1].join(', ')} and ${s[s.len-1]}}' - } + 0 { return "{}" } + 1 { return "{${s[0]}}" } + 2 { return "{${s[0]} and ${s[1]}}" } + else { return "{${s[0..s.len-1].join(", ")} and ${s[s.len-1]}}" } } } fn main(){ println(q([])) - println(q(['ABC'])) - println(q(['ABC','DEF'])) - println(q(['ABC','DEF','G','H'])) + println(q(["ABC"])) + println(q(["ABC","DEF"])) + println(q(["ABC","DEF","G","H"])) } diff --git a/Task/Comma-quibbling/VBScript/comma-quibbling.vb b/Task/Comma-quibbling/VBScript/comma-quibbling.vbs similarity index 100% rename from Task/Comma-quibbling/VBScript/comma-quibbling.vb rename to Task/Comma-quibbling/VBScript/comma-quibbling.vbs diff --git a/Task/Command-line-arguments/AArch64-Assembly/command-line-arguments.aarch64 b/Task/Command-line-arguments/AArch64-Assembly/command-line-arguments-1.aarch64 similarity index 100% rename from Task/Command-line-arguments/AArch64-Assembly/command-line-arguments.aarch64 rename to Task/Command-line-arguments/AArch64-Assembly/command-line-arguments-1.aarch64 diff --git a/Task/Command-line-arguments/AArch64-Assembly/command-line-arguments-2.aarch64 b/Task/Command-line-arguments/AArch64-Assembly/command-line-arguments-2.aarch64 new file mode 100644 index 0000000000..134551fb07 --- /dev/null +++ b/Task/Command-line-arguments/AArch64-Assembly/command-line-arguments-2.aarch64 @@ -0,0 +1,26 @@ +.global _start +.text +_start: + mov x9, sp // move stack pointer to x9 + 0: ldr x0, [x9, #8]! // add 8 to x9, load long int value at x9 into x0 + cbz x0, 9f // if x0 is zero (null pointer) jump forward to 9: + bl writez // call our function that prints a null terminated string + adr x0, lfz // load address of lfz (line feed, zero) into x0 + bl writez // print it + b 0b // jump backward to label 0: + 9: mov x8, #93 // 93 is exit + mov x0, xzr // return (0); + svc #0 // syscall + // If using as a function in C declare it as +writez: // extern long writez(char *str); + mov x1, x0 // address of str needs to be in x1 for syscall + sub x0, x0, #1 // decrement x0, because the next statement increments it first. + 0: ldrb w2, [x0, #1]! // increment x0, load byte value at x0 in w2 + cbnz w2, 0b // if w2 is not zero jump back to 0: label + sub x2, x0, x1 // subtract x1 from x0, load into x2. length of str + mov x0, #1 // mov into x0 1. stdout + mov x8, #64 // mov into x8 64. write + svc #0 // syscall + ret // return from function. + // return value is number of characters written. +lfz: .byte 10, 0 // line feed (0x0a), zero (null character) diff --git a/Task/Command-line-arguments/Ada/command-line-arguments-1.ada b/Task/Command-line-arguments/Ada/command-line-arguments-1.adb similarity index 100% rename from Task/Command-line-arguments/Ada/command-line-arguments-1.ada rename to Task/Command-line-arguments/Ada/command-line-arguments-1.adb diff --git a/Task/Command-line-arguments/Ada/command-line-arguments-2.ada b/Task/Command-line-arguments/Ada/command-line-arguments-2.adb similarity index 100% rename from Task/Command-line-arguments/Ada/command-line-arguments-2.ada rename to Task/Command-line-arguments/Ada/command-line-arguments-2.adb diff --git a/Task/Command-line-arguments/ArkScript/command-line-arguments.ark b/Task/Command-line-arguments/ArkScript/command-line-arguments.ark new file mode 100644 index 0000000000..c7a36a1db6 --- /dev/null +++ b/Task/Command-line-arguments/ArkScript/command-line-arguments.ark @@ -0,0 +1,2 @@ +(import std.Sys) +(print sys:args) diff --git a/Task/Command-line-arguments/COBOL/command-line-arguments-1.cobol b/Task/Command-line-arguments/COBOL/command-line-arguments-1.cob similarity index 100% rename from Task/Command-line-arguments/COBOL/command-line-arguments-1.cobol rename to Task/Command-line-arguments/COBOL/command-line-arguments-1.cob diff --git a/Task/Command-line-arguments/COBOL/command-line-arguments-2.cobol b/Task/Command-line-arguments/COBOL/command-line-arguments-2.cob similarity index 100% rename from Task/Command-line-arguments/COBOL/command-line-arguments-2.cobol rename to Task/Command-line-arguments/COBOL/command-line-arguments-2.cob diff --git a/Task/Command-line-arguments/COBOL/command-line-arguments-3.cobol b/Task/Command-line-arguments/COBOL/command-line-arguments-3.cob similarity index 100% rename from Task/Command-line-arguments/COBOL/command-line-arguments-3.cobol rename to Task/Command-line-arguments/COBOL/command-line-arguments-3.cob diff --git a/Task/Command-line-arguments/Delphi/command-line-arguments.delphi b/Task/Command-line-arguments/Delphi/command-line-arguments.pas similarity index 100% rename from Task/Command-line-arguments/Delphi/command-line-arguments.delphi rename to Task/Command-line-arguments/Delphi/command-line-arguments.pas diff --git a/Task/Command-line-arguments/Elena/command-line-arguments.elena b/Task/Command-line-arguments/Elena/command-line-arguments.elena index f2b40e0a6f..5fc9385721 100644 --- a/Task/Command-line-arguments/Elena/command-line-arguments.elena +++ b/Task/Command-line-arguments/Elena/command-line-arguments.elena @@ -1,8 +1,8 @@ import system'routines; import extensions; -public program() +public Program() { - program_arguments.forEvery:(int i) - { console.printLine("Argument ",i," is ",program_arguments[i]) } + Program_arguments.forEvery::(int i) + { Console.printLine("Argument ",i," is ",Program_arguments[i]) } } diff --git a/Task/Command-line-arguments/Elixir/command-line-arguments-1.elixir b/Task/Command-line-arguments/Elixir/command-line-arguments-1.ex similarity index 100% rename from Task/Command-line-arguments/Elixir/command-line-arguments-1.elixir rename to Task/Command-line-arguments/Elixir/command-line-arguments-1.ex diff --git a/Task/Command-line-arguments/Elixir/command-line-arguments-2.elixir b/Task/Command-line-arguments/Elixir/command-line-arguments-2.ex similarity index 100% rename from Task/Command-line-arguments/Elixir/command-line-arguments-2.elixir rename to Task/Command-line-arguments/Elixir/command-line-arguments-2.ex diff --git a/Task/Command-line-arguments/Emacs-Lisp/command-line-arguments.l b/Task/Command-line-arguments/Emacs-Lisp/command-line-arguments.el similarity index 100% rename from Task/Command-line-arguments/Emacs-Lisp/command-line-arguments.l rename to Task/Command-line-arguments/Emacs-Lisp/command-line-arguments.el diff --git a/Task/Command-line-arguments/Euphoria/command-line-arguments.euphoria b/Task/Command-line-arguments/Euphoria/command-line-arguments.eu similarity index 100% rename from Task/Command-line-arguments/Euphoria/command-line-arguments.euphoria rename to Task/Command-line-arguments/Euphoria/command-line-arguments.eu diff --git a/Task/Command-line-arguments/FutureBasic/command-line-arguments.basic b/Task/Command-line-arguments/FutureBasic/command-line-arguments.basic new file mode 100644 index 0000000000..ed30014088 --- /dev/null +++ b/Task/Command-line-arguments/FutureBasic/command-line-arguments.basic @@ -0,0 +1,14 @@ +include "NSLog.incl" + +void local fn DoCommandLineArguments + CFArrayRef args = fn ProcessInfoArguments + NSLog(@"This program is named %@.",args[0]) + NSLog(@"There are %d arguments.",len(args)-1) + for long i = 1 to len(args)-1 + NSLog(@"the argument #%d is %@", i, args[i]) + next +end fn + +fn DoCommandLineArguments + +HandleEvents diff --git a/Task/Command-line-arguments/Julia/command-line-arguments.julia b/Task/Command-line-arguments/Julia/command-line-arguments.jl similarity index 100% rename from Task/Command-line-arguments/Julia/command-line-arguments.julia rename to Task/Command-line-arguments/Julia/command-line-arguments.jl diff --git a/Task/Command-line-arguments/Kotlin/command-line-arguments.kotlin b/Task/Command-line-arguments/Kotlin/command-line-arguments.kts similarity index 100% rename from Task/Command-line-arguments/Kotlin/command-line-arguments.kotlin rename to Task/Command-line-arguments/Kotlin/command-line-arguments.kts diff --git a/Task/Command-line-arguments/LDPL/command-line-arguments-1.ldpl b/Task/Command-line-arguments/LDPL/command-line-arguments-1.ldpl new file mode 100644 index 0000000000..26aa218485 --- /dev/null +++ b/Task/Command-line-arguments/LDPL/command-line-arguments-1.ldpl @@ -0,0 +1,10 @@ +DATA: + argument_count IS NUMBER + +PROCEDURE: + GET LENGTH OF argv IN argument_count + IF argument_count IS EQUAL TO 0 THEN + DISPLAY "No arguments!" CRLF + ELSE + DISPLAY argv:0 CRLF + END IF diff --git a/Task/Command-line-arguments/LDPL/command-line-arguments-2.ldpl b/Task/Command-line-arguments/LDPL/command-line-arguments-2.ldpl new file mode 100644 index 0000000000..6cc4b9df78 --- /dev/null +++ b/Task/Command-line-arguments/LDPL/command-line-arguments-2.ldpl @@ -0,0 +1,6 @@ +$ ldpl argv.ldpl +* Loading argv.ldpl +* Compiling argv.ldpl +* Building argv-bin +* Saved as argv-bin +* File(s) compiled successfully. diff --git a/Task/Command-line-arguments/LDPL/command-line-arguments-3.ldpl b/Task/Command-line-arguments/LDPL/command-line-arguments-3.ldpl new file mode 100644 index 0000000000..ff51e1fe0c --- /dev/null +++ b/Task/Command-line-arguments/LDPL/command-line-arguments-3.ldpl @@ -0,0 +1,4 @@ +$ ./argv-bin test +test +$ ./argv-bin +No arguments! diff --git a/Task/Command-line-arguments/Nu/command-line-arguments.nu b/Task/Command-line-arguments/Nu/command-line-arguments.nu new file mode 100644 index 0000000000..dfa5746f77 --- /dev/null +++ b/Task/Command-line-arguments/Nu/command-line-arguments.nu @@ -0,0 +1,3 @@ +def main [...argv] { + $argv | print +} diff --git a/Task/Command-line-arguments/OCaml/command-line-arguments-1.ocaml b/Task/Command-line-arguments/OCaml/command-line-arguments-1.ml similarity index 100% rename from Task/Command-line-arguments/OCaml/command-line-arguments-1.ocaml rename to Task/Command-line-arguments/OCaml/command-line-arguments-1.ml diff --git a/Task/Command-line-arguments/OCaml/command-line-arguments-2.ocaml b/Task/Command-line-arguments/OCaml/command-line-arguments-2.ml similarity index 100% rename from Task/Command-line-arguments/OCaml/command-line-arguments-2.ocaml rename to Task/Command-line-arguments/OCaml/command-line-arguments-2.ml diff --git a/Task/Command-line-arguments/PascalABC.NET/command-line-arguments.pas b/Task/Command-line-arguments/PascalABC.NET/command-line-arguments.pas new file mode 100644 index 0000000000..657c2b12b1 --- /dev/null +++ b/Task/Command-line-arguments/PascalABC.NET/command-line-arguments.pas @@ -0,0 +1,4 @@ +begin + for var i:=1 to ParamCount do + Print(ParamStr(i)); +end. diff --git a/Task/Command-line-arguments/Pluto/command-line-arguments.pluto b/Task/Command-line-arguments/Pluto/command-line-arguments.pluto new file mode 100644 index 0000000000..b002fdaeb6 --- /dev/null +++ b/Task/Command-line-arguments/Pluto/command-line-arguments.pluto @@ -0,0 +1 @@ +arg:slice(1):foreach(print) diff --git a/Task/Command-line-arguments/PowerShell/command-line-arguments.psh b/Task/Command-line-arguments/PowerShell/command-line-arguments.ps1 similarity index 100% rename from Task/Command-line-arguments/PowerShell/command-line-arguments.psh rename to Task/Command-line-arguments/PowerShell/command-line-arguments.ps1 diff --git a/Task/Command-line-arguments/REXX/command-line-arguments-1.rexx b/Task/Command-line-arguments/REXX/command-line-arguments-1.rexx index 2355afa823..7d8785a1c8 100644 --- a/Task/Command-line-arguments/REXX/command-line-arguments-1.rexx +++ b/Task/Command-line-arguments/REXX/command-line-arguments-1.rexx @@ -1,2 +1,32 @@ -say 'command arguments:' -say arg(1) +-- 12 Sep 2025 +include Setting + +-- Use arguments -c "alpha beta" -h "gamma" +say 'COMMAND-LINE ARGUMENTS (SPACE SEPARATED)' +say version +say +say 'parse arg xx:' +parse arg xx; say 'xx='xx +say +say 'arg xx:' +arg xx; say 'xx='xx +say +say 'arg x1 x2 x3 x4 x5:' +arg x1 x2 x3 x4 x5; say 'x1='x1 'x2='x2 'x3='x3 'x4='x4 'x5='x5 +say +say 'parse arg x1 x2 x3 x4 x5:' +parse arg x1 x2 x3 x4 x5; say 'x1='x1 'x2='x2 'x3='x3 'x4='x4 'x5='x5 +say +say 'arg x1 . x3 (placeholder):' +arg x1 . x3; say 'x1='x1 'x3='x3 +say +say 'Arg(1):' +say Arg(1) +say +say 'Words:' +do n = 1 to Words(Arg(1)) + say 'n='n 'Word(Arg(1),n)='Word(Arg(1),n) +end +exit + +include Abend diff --git a/Task/Command-line-arguments/REXX/command-line-arguments-2.rexx b/Task/Command-line-arguments/REXX/command-line-arguments-2.rexx index bd43c95964..3b97099b75 100644 --- a/Task/Command-line-arguments/REXX/command-line-arguments-2.rexx +++ b/Task/Command-line-arguments/REXX/command-line-arguments-2.rexx @@ -1,22 +1,27 @@ -parse arg aaa /*get the arguments. */ - /*another version: */ - /* aaa=arg(1) */ -say 'command arguments:' -say aaa +-- 12 Sep 2025 +include Setting -opts='' /*placeholder for options. */ -data='' /*placeholder for data. */ - - do j=1 to words(aaa) - x=word(aaa,j) - if left(x,1)=='-' then opts=opts x /*Option? Then add to opts.*/ - else data=data x /*Must be data. Add to data.*/ - end - - /*the above process adds a leading blank to OPTS and DATA*/ - -opts=strip(opts,'L') /*strip leading blanks. */ -data=strip(data,'l') /*strip leading blanks. */ +-- Use arguments -c,alpha beta,-h,gamma +say 'COMMAND-LINE ARGUMENTS (COMMA SEPARATED)' +say version say -say 'options='opts -say ' data='data +say 'parse arg xx:' +parse arg xx; say xx +say +say 'arg xx:' +arg xx; say xx +say +say 'parse arg x1,x2,x3,x4:' +parse arg x1','x2','x3','x4; say 'x1' x1 'x2' x2 'x3' x3 'x4' x4 +say +say 'arg x1,x2,x3,x4:' +arg x1','x2','x3','x4; say 'x1' x1 'x2' x2 'x3' x3 'x4' x4 +say +say 'parse arg x1,.,x3 (placeholder):' +parse arg x1','.','x3; say 'x1' x1 'x3' x3 +say +say 'arg(1):' +say arg(1) +exit + +include Abend diff --git a/Task/Command-line-arguments/Rust/command-line-arguments-1.rust b/Task/Command-line-arguments/Rust/command-line-arguments-1.rs similarity index 100% rename from Task/Command-line-arguments/Rust/command-line-arguments-1.rust rename to Task/Command-line-arguments/Rust/command-line-arguments-1.rs diff --git a/Task/Command-line-arguments/Rust/command-line-arguments-2.rust b/Task/Command-line-arguments/Rust/command-line-arguments-2.rs similarity index 100% rename from Task/Command-line-arguments/Rust/command-line-arguments-2.rust rename to Task/Command-line-arguments/Rust/command-line-arguments-2.rs diff --git a/Task/Command-line-arguments/Scheme/command-line-arguments.ss b/Task/Command-line-arguments/Scheme/command-line-arguments.scm similarity index 100% rename from Task/Command-line-arguments/Scheme/command-line-arguments.ss rename to Task/Command-line-arguments/Scheme/command-line-arguments.scm diff --git a/Task/Command-line-arguments/TAV/command-line-arguments.tav b/Task/Command-line-arguments/TAV/command-line-arguments.tav new file mode 100644 index 0000000000..9586ed1181 --- /dev/null +++ b/Task/Command-line-arguments/TAV/command-line-arguments.tav @@ -0,0 +1,3 @@ +main (parms):+ + ?# i =: give keys parms + print i __ parms[i] diff --git a/Task/Command-line-arguments/Tcl/command-line-arguments-1.tcl b/Task/Command-line-arguments/Tcl/command-line-arguments-1.tcl new file mode 100644 index 0000000000..3e39085837 --- /dev/null +++ b/Task/Command-line-arguments/Tcl/command-line-arguments-1.tcl @@ -0,0 +1,3 @@ +if { $argc >= 1 } { + puts [lindex $argv 0] +} diff --git a/Task/Command-line-arguments/Tcl/command-line-arguments-2.tcl b/Task/Command-line-arguments/Tcl/command-line-arguments-2.tcl new file mode 100644 index 0000000000..8db1f98495 --- /dev/null +++ b/Task/Command-line-arguments/Tcl/command-line-arguments-2.tcl @@ -0,0 +1,2 @@ +$ tclsh file.tcl test +test diff --git a/Task/Command-line-arguments/Tcl/command-line-arguments.tcl b/Task/Command-line-arguments/Tcl/command-line-arguments.tcl deleted file mode 100644 index 0827817f9e..0000000000 --- a/Task/Command-line-arguments/Tcl/command-line-arguments.tcl +++ /dev/null @@ -1,3 +0,0 @@ -if { $argc > 1 } { - puts [lindex $argv 1] -} diff --git a/Task/Command-line-arguments/Uiua/command-line-arguments.uiua b/Task/Command-line-arguments/Uiua/command-line-arguments.uiua new file mode 100644 index 0000000000..6d3c8fe5b3 --- /dev/null +++ b/Task/Command-line-arguments/Uiua/command-line-arguments.uiua @@ -0,0 +1 @@ +&args diff --git a/Task/Command-line-arguments/VBScript/command-line-arguments.vb b/Task/Command-line-arguments/VBScript/command-line-arguments.vbs similarity index 100% rename from Task/Command-line-arguments/VBScript/command-line-arguments.vb rename to Task/Command-line-arguments/VBScript/command-line-arguments.vbs diff --git a/Task/Command-line-arguments/X86-64-Assembly/command-line-arguments.x86-64 b/Task/Command-line-arguments/X86-64-Assembly/command-line-arguments.x86-64 new file mode 100644 index 0000000000..42af33fb12 --- /dev/null +++ b/Task/Command-line-arguments/X86-64-Assembly/command-line-arguments.x86-64 @@ -0,0 +1,58 @@ +format ELF64 executable 3 +entry start + +segment executable readable +start: + pop rax ; pop argc off stack. It should be at least 1 + .loop0: + pop rdi ; pop the pointer to argument string off stack + call prints ; call a function to print a string + mov rdi, 0x0a ; parameter to next function. 0x0a = line feed = 10 + call printc ; call a function to print a single character + dec rax ; decrement RAX. + jnz .loop0 ; get next argument if RAX is not yet 0 + .exit: + mov rax, 60 + mov rdi, 0 + syscall + +prints: ; function that prints a zero terminated string + push rax + push rdi + push rsi + push rdx + xor rdx, rdx + cmp byte [rdi + rdx], 0 + je .return + .stloop: + cmp byte [rdi + rdx], 0 + je .printit + inc rdx + jmp .stloop + .printit: + mov rax, 1 + mov rsi, rdi + mov rdi, 1 + syscall + .return: + pop rdx + pop rsi + pop rdi + pop rax + ret + +printc: ;function that prints a single character in rdi (dil). + push rax + push rsi + push rdx + push rdi + mov rax, 1 + mov rdi, 1 + mov rsi, rsp + mov rdx, 1 + syscall + pop rdi + pop rdx + pop rsi + pop rax + ret diff --git a/Task/Command-line-arguments/Zig/command-line-arguments.zig b/Task/Command-line-arguments/Zig/command-line-arguments.zig new file mode 100644 index 0000000000..5b35ff255c --- /dev/null +++ b/Task/Command-line-arguments/Zig/command-line-arguments.zig @@ -0,0 +1,13 @@ +const std = @import("std"); + +pub fn main() !void { + const stdout = std.io.getStdOut().writer(); + + var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); + defer arena.deinit(); + const allocator = arena.allocator(); + + const args = try std.process.argsAlloc(allocator); + + try stdout.print("{s}\n", .{args}); +} diff --git a/Task/Commatizing-numbers/ALGOL-68/commatizing-numbers.alg b/Task/Commatizing-numbers/ALGOL-68/commatizing-numbers.alg index 290bfb3719..161b62d233 100644 --- a/Task/Commatizing-numbers/ALGOL-68/commatizing-numbers.alg +++ b/Task/Commatizing-numbers/ALGOL-68/commatizing-numbers.alg @@ -53,35 +53,48 @@ PROC commatize = ( STRING text, INT location, INT period, STRING separator )STRI # commatizing procedure # MODE COMMATIZINGOPTIONS = STRUCT( STRING text, INT location, INT period, STRING separator ); PRIO LOCATION = 9; -OP LOCATION = ( STRING text, INT location )COMMATIZINGOPTIONS: COMMATIZINGOPTIONS( text, location, 0, "" ); +OP LOCATION = ( STRING text, INT location )COMMATIZINGOPTIONS: + COMMATIZINGOPTIONS( text, location, 0, "" ); PRIO PERIOD = 9; -OP PERIOD = ( STRING text, INT period )COMMATIZINGOPTIONS: COMMATIZINGOPTIONS( text, 0, period, "" ); +OP PERIOD = ( STRING text, INT period )COMMATIZINGOPTIONS: + COMMATIZINGOPTIONS( text, 0, period, "" ); PRIO SEPARATOR = 9; -OP SEPARATOR = ( STRING text, CHAR separator )COMMATIZINGOPTIONS: COMMATIZINGOPTIONS( text, 0, 0, separator ); -OP SEPARATOR = ( STRING text, STRING separator )COMMATIZINGOPTIONS: COMMATIZINGOPTIONS( text, 0, 0, separator ); +OP SEPARATOR = ( STRING text, CHAR separator )COMMATIZINGOPTIONS: + COMMATIZINGOPTIONS( text, 0, 0, separator ); +OP SEPARATOR = ( STRING text, STRING separator )COMMATIZINGOPTIONS: + COMMATIZINGOPTIONS( text, 0, 0, separator ); OP LOCATION = ( COMMATIZINGOPTIONS opts, INT location )COMMATIZINGOPTIONS: - COMMATIZINGOPTIONS( text OF opts, location, period OF opts, separator OF opts ); + COMMATIZINGOPTIONS( text OF opts, location, period OF opts, separator OF opts ); OP PERIOD = ( COMMATIZINGOPTIONS opts, INT period )COMMATIZINGOPTIONS: - COMMATIZINGOPTIONS( text OF opts, location OF opts, period, separator OF opts ); + COMMATIZINGOPTIONS( text OF opts, location OF opts, period, separator OF opts ); OP SEPARATOR = ( COMMATIZINGOPTIONS opts, CHAR separator )COMMATIZINGOPTIONS: - COMMATIZINGOPTIONS( text OF opts, location OF opts, period OF opts, separator ); + COMMATIZINGOPTIONS( text OF opts, location OF opts, period OF opts, separator ); OP SEPARATOR = ( COMMATIZINGOPTIONS opts, STRING separator )COMMATIZINGOPTIONS: - COMMATIZINGOPTIONS( text OF opts, location OF opts, period OF opts, separator ); + COMMATIZINGOPTIONS( text OF opts, location OF opts, period OF opts, separator ); OP COMMATIZE = ( STRING text )STRING: commatize( text, 0, 0, "" ); OP COMMATIZE = ( COMMATIZINGOPTIONS opts )STRING: - commatize( text OF opts, location OF opts, period OF opts, separator OF opts ); + commatize( text OF opts, location OF opts, period OF opts, separator OF opts ); # test the commatization procedure and operators # -print( ( COMMATIZE( "pi=3.14159265358979323846264338327950288419716939937510582097494459231" PERIOD 5 SEPARATOR " " LOCATION 6 ), - newline ) ); -print( ( COMMATIZE( "The author has two Z$100000000000000 Zimbabwe notes (100 trillion)." SEPARATOR "." ), newline ) ); -print( ( COMMATIZE """-in Aus$+1411.8millions""", newline ) ); -print( ( COMMATIZE "===US$0017440 millions=== (in 2000 dollars)", newline ) ); -print( ( COMMATIZE "123.e8000 is pretty big.", newline ) ); -print( ( COMMATIZE "The land area of the earth is 57268900(29% of the surface) square miles.", newline ) ); -print( ( COMMATIZE "Ain't no numbers in this here words, nohow, no way, Jose.", newline ) ); -print( ( COMMATIZE "James was never known as 0000000007", newline ) ); -print( ( COMMATIZE "Arthur Eddington wrote: I believe there are 15747724136275002577605653961181555468044717914527116709366231425076185631031296 protons in the universe.", - newline ) ); -print( ( COMMATIZE " $-140000±100 millions.", newline ) ); -print( ( COMMATIZE "6/9/1946 was a good year for some.", newline ) ) +print( ( COMMATIZE( "pi=3.14159265358979323846264338327950288419716939937510582097494459231" + PERIOD 5 SEPARATOR " " LOCATION 6 ), newline ) ); +print( ( COMMATIZE( "The author has two Z$100000000000000 Zimbabwe notes (100 trillion)." + SEPARATOR "." ), newline ) ); +print( ( COMMATIZE( "The author has two Z$100000000000000 Zimbabwe notes (100 trillion)." + SEPARATOR "." PERIOD 6 ), newline ) ); +print( ( COMMATIZE( "The author has two Z$100000000000000 Zimbabwe notes (100 trillion)." + SEPARATOR "__" ), newline ) ); +print( ( COMMATIZE( "The author has two Z$100000000000000 Zimbabwe notes (100 trillion)." + LOCATION 26 PERIOD 1 SEPARATOR "::" ), newline ) ); +print( ( COMMATIZE """-in Aus$+1411.8millions""", newline ) ); +print( ( COMMATIZE "===US$0017440 millions=== (in 2000 dollars)", newline ) ); +print( ( COMMATIZE "123.e8000 is pretty big.", newline ) ); +print( ( COMMATIZE "The land area of the earth is 57268900(29% of the surface) square miles.", newline ) ); +print( ( COMMATIZE "Ain't no numbers in this here words, nohow, no way, Jose.", newline ) ); +print( ( COMMATIZE "James was never known as 0000000007", newline ) ); +print( ( COMMATIZE ( "Arthur Eddington wrote: I believe there are " + + "15747724136275002577605653961181555468044717914527116709366231425076185631031296 " + + "protons in the universe." + ), newline ) ); +print( ( COMMATIZE " $-140000±100 millions.", newline ) ); +print( ( COMMATIZE "6/9/1946 was a good year for some.", newline ) ) diff --git a/Task/Commatizing-numbers/Ballerina/commatizing-numbers.ballerina b/Task/Commatizing-numbers/Ballerina/commatizing-numbers.ballerina new file mode 100644 index 0000000000..9b5aaf9eca --- /dev/null +++ b/Task/Commatizing-numbers/Ballerina/commatizing-numbers.ballerina @@ -0,0 +1,90 @@ +import ballerina/io; + +function commatize(string s, int begin = 0, int step = 3, string sep = ",") { + var invert = function(string n) returns string { + string t = ""; + foreach int i in int:range(n.length() - 1, -1, -1) { t += n[i]; } + return t; + }; + + var addSeps = function(string nn, boolean dp) returns string { + string n = nn; + string lz = ""; + if !dp && n.startsWith("0") && n != "0" { + string:RegExp pattern = re `^0+`; + string k = pattern.replace(n, ""); + if k == "" { k = "0"; } + foreach int i in 1 ... n.length() - k.length() { lz += "0"; } + n = k; + } + if dp { n = invert(n); } // invert if after decimal point + int i = n.length() - step; + while i >= 1 { + n = n.substring(0, i) + sep + n.substring(i); + i -= step; + } + if dp { n = invert(n); } // invert back + return lz + n; + }; + + var isExponent = function(string:Char c) returns boolean { + return "eEdDpP^∙x↑*⁰¹²³⁴⁵⁶⁷⁸⁹".includes(c); + }; + + string t = s; + string acc = (begin == 0) ? "" : t.substring(0, begin); + string n = ""; + boolean dp = false; + foreach int j in begin ..< t.length() { + string:Char c = t[j]; + if c >= "0" && c <= "9" { + n += t[j]; + if j == t.length() - 1 { + if acc != "" && isExponent(acc[acc.length() - 1]) { + acc = s; + } else { + acc += addSeps(n, dp); + } + } + } else if n != "" { + if acc != "" && isExponent(acc[acc.length() - 1]) { + acc = s; + break; + } else if t[j] != "." { + acc += addSeps(n, dp) + t.substring(j); + break; + } else { + acc += addSeps(n, dp) + t[j]; + dp = true; + n = ""; + } + } else { + acc += t[j]; + } + } + io:println(s); + io:println(acc); + io:println(); +} + +public function main() { + commatize("123456789.123456789", 0, 2, "*"); + commatize(".123456789", 0, 3, "-"); + commatize("57256.1D-4", 0, 4, "__"); + commatize("pi=3.14159265358979323846264338327950288419716939937510582097494459231", 0, 5, " "); + commatize("The author has two Z$100000000000000 Zimbabwe notes (100 trillion).", 0, 3, "."); + + string[] defaults = [ + "\"-in Aus$+1411.8millions\"", + "===US$0017440 millions=== (in 2000 dollars)", + "123.e8000 is pretty big.", + "The land area of the earth is 57268900(29% of the surface) square miles.", + "Ain't no numbers in this here words, nohow, no way, Jose.", + "James was never known as 0000000007", + "Arthur Eddington wrote: I believe there are 15747724136275002577605653961181555468044717914527116709366231425076185631031296 protons in the universe.", + " $-140000±100 millions.", + "6/9/1946 was a good year for some." + ]; + + foreach string d in defaults { commatize(d); } +} diff --git a/Task/Commatizing-numbers/C++/commatizing-numbers.cpp b/Task/Commatizing-numbers/C++/commatizing-numbers.cpp new file mode 100644 index 0000000000..f9e7ce9e09 --- /dev/null +++ b/Task/Commatizing-numbers/C++/commatizing-numbers.cpp @@ -0,0 +1,46 @@ +#include +#include +#include +#include + +bool contains(const std::string& haystack, const char needle) { + return haystack.find(needle) != std::string::npos; +} + +void commatize(std::string text, const int32_t& start_index = 0, + const int32_t& step = 3, const std::string& separator = ",") { + std::cout << "Before: " << text << std::endl; + const int32_t size = text.size(); + + for ( int32_t i = start_index; i < size; ++i ) { + if ( contains("123456789", text[i]) ) { + for ( int32_t j = i + 1; j <= size; ++j ) { + if ( j > size || ! contains("0123456789", text[j]) ) { + for ( int32_t k = j - 1 - step; k >= i; k -= step ) { + text.insert(k + 1, separator); + } + break; + } + } + break; + } + } + + std::cout << " After: " << text << std::endl << std::endl; +} + +int main() { + commatize("pi=3.14159265358979323846264338327950288419716939937510582097494459231", 6, 5, " "); + commatize("The author has two Z$100000000000000 Zimbabwe notes (100 trillion)."); + commatize("\"-in Aus$+1411.8millions\""); + commatize("===US$0017440 millions=== (in 2000 dollars)"); + commatize("123.e8000 is pretty big."); + commatize("The land area of the earth is 57268900(29% of the surface) square miles."); + commatize("Ain't no numbers in this here words, nohow, no way, Jose."); + commatize("James was never known as 0000000007"); + commatize("Arthur Eddington wrote: I believe there are " + "15747724136275002577605653961181555468044717914527116709366231425076185631031296" + " protons in the universe."); + commatize(" $-140000±100 millions."); + commatize("6/9/1946 was a good year for some."); +} diff --git a/Task/Commatizing-numbers/Delphi/commatizing-numbers.delphi b/Task/Commatizing-numbers/Delphi/commatizing-numbers.pas similarity index 100% rename from Task/Commatizing-numbers/Delphi/commatizing-numbers.delphi rename to Task/Commatizing-numbers/Delphi/commatizing-numbers.pas diff --git a/Task/Commatizing-numbers/Fortran/commatizing-numbers.f b/Task/Commatizing-numbers/Fortran/commatizing-numbers.f new file mode 100644 index 0000000000..626b9ccf8f --- /dev/null +++ b/Task/Commatizing-numbers/Fortran/commatizing-numbers.f @@ -0,0 +1,207 @@ +! Commatizing numbers +! +! tested with Intel ifx (IFX) 2025.2.1 20250806 on Kubuntu 25.04 +! GNU Fortran (Ubuntu 14.2.0-19ubuntu2) 14.2.0 on Kubuntu 25.04 +! Note that VSI Fortran on VMS does not compile this code because its current version +! cannot handle allocatable character strings +! +! U.B., August 2025 +! +program commatisator + +implicit none + +logical, parameter ::DEBUG=.false. + + +call commatize("pi=3.14159265358979323846264338327950288419716939937510582097494459231", 3, 5) +call commatize("The author has two Z$100000000000000 Zimbabwe notes (100 trillion).", 1,3, '.') ! Use decimal point as separator +call commatize('"-in Aus$+1411.8millions"') ! Here the double quotes (") are part of the text. +call commatize("===US$0017440 millions=== (in 2000 dollars)") +call commatize("123.e8000 is pretty big.") +call commatize("The land area of the earth is 57268900(29% of the surface) square miles.") +call commatize("Ain't no numbers in this here words, nohow, no way, Jose.") +call commatize("James was never known as 0000000007", 0,3) +call commatize("Arthur Eddington wrote: I believe there are " // & + "15747724136275002577605653961181555468044717914527116709366231425076185631031296" // & + " protons in the universe.") +call commatize(" $-140000±100 millions.") +call commatize("6/9/1946 was a good year for some.") + +contains + +subroutine commatize (text, astartIdx, agroupSize, aseparator) + ! Arguments + character(*), intent(in) :: text + integer, intent(in), optional :: astartIdx + integer, intent(in), optional :: agroupSize + character, intent(in), optional :: aseparator + + ! These variables are there even if optional args are omitted. + integer :: startIdx + integer :: groupSize + character :: separator + + integer :: sz, ii + integer :: ipBegin, ipPoint, ipEnd + + character(:), allocatable :: newtext + ! + ! Defaults for optional arguments + ! and protect against invalid arguments + if (present (astartIdx)) then + startIDx = max (1, astartidx) + else + startIdx = 1 + endif + if (present (agroupSize)) then + groupsize = max(1, agroupsize) + else + groupsize = 3 + endif + if (present (aseparator)) then + separator = aseparator + else + separator = ',' + endif + + sz = len (text) + ipBegin = 0 + ipPoint = 0 + ipEnd = 0 + + ! Find beginning and end of the first numeric part of the string + do ii=startidx,sz + if (isadigit (text(ii:ii), '1','9')) then ! ignoring leading zeroes + ipBegin = ii + exit ! Only the very first number is of any interest. + else if (text(ii:ii) .eq. '.') then ! Leading Decimal point + if (ii .lt. sz) then + if (isadigit (text(ii+1:ii+1), '0','9')) then ! must be followed by a valid digit + ! Entire number starts here, it is something valid like ".123" + if (DEBUG) print *, 'Decimal point detected at ii,sz= ', ii, sz + ipBegin = ii + ipPoint = ii + exit + endif + endif + end if + end do + + ! Any number detected? Search for the end and, if necessary, the decimal point + if (ipBegin .gt. 0 .and. ipBegin .le. sz) then + do ii=ipBegin+1, sz+1 + if (ii > sz) then + ipEnd = sz + else if (text(ii:ii) .eq. '.' .and. ipPoint .eq. 0 .and. ii .lt. sz ) then + if (isadigit (text(ii+1:ii+1), '0','9')) then ! Decimal point must be followed by valid digit + ipPoint = ii + else + ipEnd = ii-1 ! Might be valid decimal point, but terminates the number. + exit ! no need to continue, have found the end. + endif + else if (.not. isadigit (text(ii:ii), '0','9')) then ! Anything other than a digit or point terminated the number. + ipEnd = ii-1 + exit + end if + enddo + end if + + ! Found a number? + ! Three possibe cases: real number (>=1) with decimal point and digits before and after + ! real number (<1) starting with decimal point such as .71 + ! integer number without decimal point. + if (ipBegin .ne. 0) then ! Any nmumber + if (ipPoint .gt. ipbegin) then ! Not starting with a decimal point but decimal point inside + if (ipBegin .gt. 1) then + newtext = text (:ipBegin-1) ! copy entire text before the numeric + else + newtext = '' ! In any case variable 'newtext' must be initialized + end if + newtext = newtext // setSeparators (text, ipPoint-1, ipBegin, & + groupsize, separator , requiredSize (ipPoint-1, ipBegin, groupsize)) // '.' + newtext = newtext // setSeparators (text, ipPoint+1, ipEnd, & + groupsize, separator, requiredSize (ipPoint+1, ipEnd ,groupsize)) + else if (ipPoint .ne. 0 .and. ipPoint .lt. sz) then ! Starting with decimal point + newtext = '.' // setSeparators (text, ipPoint+1, ipEnd, & + groupsize, separator, requiredSize (ipPoint+1, ipEnd,groupsize) ) + else ! Integer number + newtext = text (:ipBegin-1) // setSeparators (text, ipEnd, ipBegin, & + groupsize, separator, requiredSize (ipEnd, ipBegin, groupsize) ) + endif + if (ipEnd .lt. sz) then + newtext = newtext // text (ipend+1:) ! Append alltext behind the number + endif + else ! No number, just print straight copy + newtext = text + endif + + print '("Before: ", A)' , text + print '(" After: ", A/)', newtext + + +end subroutine commatize + + ! estimate how many separators wii be needed in a given range of digits + ! and calculate the new tring length therefrom. + function requiredSize (i0,i1,step) result (size) + integer, intent(in) :: i0, i1, step + integer :: size + integer :: l,c + + l = iabs (i1-i0) + 1 ! Length of the string to be considered + c = (l-1) / step ! Number of separators to insert + + size = l + c + end function requiredSize + + ! Insert separators into a numerical string + function setSeparators (text, i0, i1, step, separator, resSize ) result (ntext ) + character(*), intent(in) :: text ! entire text + integer, intent(in) :: i0,i1 ! The numeric part goes from i0 to i1 (incl) + integer, intent(in) :: step ! the group size between separators + character, intent(in) :: separator ! the separator character + integer, intent(in) :: resSize ! New size of result string + character(len=resSize) :: ntext ! The resultant string, including th e separators + integer :: ii, jj, cnt, direction ! Helpers + + ! character-wise copy the old text into new text + ! Loop index can go into either direction + if (i0 .gt. i1 ) then + direction = -1 + else + direction = 1 + end if + + ! Position of text(ii:ii) inside the resultant text + if (i0 .lt. i1) then + jj = 1 + else + jj = resSize + end if + + cnt = 0 + do ii = i0, i1, direction + ntext (jj:jj) = text (ii:ii) ! Copy characters + jj = jj + direction + cnt = cnt + 1 ! count copied characters + ! Group complete? Insert separator + if (cnt .eq. step .and. jj .gt. 0 .and. jj .lt. resSize) then + ntext(jj:jj) = separator + jj = jj + direction + cnt = 0 + end if + end do + end function setSeparators + +! Decide if a given character c is a digit in the range from "from" to "to". +function isadigit (c, from, to) result (YN) + character, intent(in) :: c, from, to + logical :: YN + + YN = c>= from .and. c<=to +end function isadigit + + + +end program commatisator diff --git a/Task/Commatizing-numbers/JavaScript/commatizing-numbers.js b/Task/Commatizing-numbers/JavaScript/commatizing-numbers.js new file mode 100644 index 0000000000..ab6c8185ab --- /dev/null +++ b/Task/Commatizing-numbers/JavaScript/commatizing-numbers.js @@ -0,0 +1,42 @@ +function contains(haystack, needle) { + return haystack.indexOf(needle) !== -1; +} + +function commatize(text, start_index = 0, step = 3, separator = ",") { + console.log("Before: " + text); + const size = text.length; + + for (let i = start_index; i < size; ++i) { + if (contains("123456789", text[i])) { + for (let j = i + 1; j <= size; ++j) { + if (j > size || !contains("0123456789", text[j])) { + for (let k = j - 1 - step; k >= i; k -= step) { + text = text.slice(0, k + 1) + separator + text.slice(k + 1); + } + break; + } + } + break; + } + } + + console.log(" After: " + text + "\n"); +} + +function main() { + commatize("pi=3.14159265358979323846264338327950288419716939937510582097494459231", 6, 5, " "); + commatize("The author has two Z$100000000000000 Zimbabwe notes (100 trillion)."); + commatize("\"-in Aus$+1411.8millions\""); + commatize("===US$0017440 millions=== (in 2000 dollars)"); + commatize("123.e8000 is pretty big."); + commatize("The land area of the earth is 57268900(29% of the surface) square miles."); + commatize("Ain't no numbers in this here words, nohow, no way, Jose."); + commatize("James was never known as 0000000007"); + commatize("Arthur Eddington wrote: I believe there are " + + "15747724136275002577605653961181555468044717914527116709366231425076185631031296" + + " protons in the universe."); + commatize(" $-140000±100 millions."); + commatize("6/9/1946 was a good year for some."); +} + +main(); diff --git a/Task/Commatizing-numbers/Julia/commatizing-numbers.julia b/Task/Commatizing-numbers/Julia/commatizing-numbers.jl similarity index 100% rename from Task/Commatizing-numbers/Julia/commatizing-numbers.julia rename to Task/Commatizing-numbers/Julia/commatizing-numbers.jl diff --git a/Task/Commatizing-numbers/Kotlin/commatizing-numbers.kotlin b/Task/Commatizing-numbers/Kotlin/commatizing-numbers.kts similarity index 100% rename from Task/Commatizing-numbers/Kotlin/commatizing-numbers.kotlin rename to Task/Commatizing-numbers/Kotlin/commatizing-numbers.kts diff --git a/Task/Commatizing-numbers/Pluto/commatizing-numbers.pluto b/Task/Commatizing-numbers/Pluto/commatizing-numbers.pluto new file mode 100644 index 0000000000..a364a0fa06 --- /dev/null +++ b/Task/Commatizing-numbers/Pluto/commatizing-numbers.pluto @@ -0,0 +1,78 @@ +require "uchar" + +local function commatize(s, start = 1, step = 3, sep = ",") + local function add_seps(n, dp) + local lz = "" + if !dp and n:startswith("0") and n != "0" then + local k = n:lstrip("0") + if k == "" then k = "0" end + lz = "0":rep(#n - #k) + n = k + end + if dp then n = n:reverse() end -- invert if after decimal point + local i = #n - step + 1 + while i >= 2 do + n = n:sub(1, i - 1) .. sep .. n:sub(i) + i -= step + end + if dp then n = n:reverse() end -- invert back + return lz .. n + end + + local function is_exponent(c) return c in "eEdDpP^∙x↑*⁰¹²³⁴⁵⁶⁷⁸⁹" end + + local t = uchar.of(s) + local acc = start == 1 ? "" : t:sub(1, start - 1) + local n = "" + local dp = false + for j = start, t:len() do + local c = t:get(j) + if c >= "0" and c <= "9" then + n ..= t:get(j) + if j == t:len() do + if acc != "" and is_exponent(acc[-1]) then + acc = s + else + acc ..= add_seps(n, dp) + end + end + elseif n != "" then + if acc != "" and is_exponent(acc[-1]) then + acc = s + break + elseif t:get(j) != "." then + acc ..= add_seps(n, dp) .. t:sub(j) + break + else + acc ..= add_seps(n, dp) .. t:get(j) + dp = true + n = "" + end + else + acc ..= t:get(j) + end + end + print(s); + print(acc); + print() +end + +commatize("123456789.123456789", 1, 2, "*") +commatize(".123456789", 1, 3, "-") +commatize("57256.1D-4", 1, 4, "__") +commatize("pi=3.14159265358979323846264338327950288419716939937510582097494459231", 1, 5, " ") +commatize("The author has two Z$100000000000000 Zimbabwe notes (100 trillion).", 1, 3, ".") + +local defaults = { + "\"-in Aus$+1411.8millions\"", + "===US$0017440 millions=== (in 2000 dollars)", + "123.e8000 is pretty big.", + "The land area of the earth is 57268900(29% of the surface) square miles.", + "Ain't no numbers in this here words, nohow, no way, Jose.", + "James was never known as 0000000007", + "Arthur Eddington wrote: I believe there are 15747724136275002577605653961181555468044717914527116709366231425076185631031296 protons in the universe.", + " $-140000±100 millions.", + "6/9/1946 was a good year for some." +} + +for defaults as d do commatize(d) end diff --git a/Task/Commatizing-numbers/Rust/commatizing-numbers.rs b/Task/Commatizing-numbers/Rust/commatizing-numbers.rs new file mode 100644 index 0000000000..cc7751fc9f --- /dev/null +++ b/Task/Commatizing-numbers/Rust/commatizing-numbers.rs @@ -0,0 +1,45 @@ +use itertools::Itertools; + +fn commatize(old_text: &str, start_index: usize, step: usize, sep: &str) -> String { + let mut text = old_text.to_string(); + let len = text.len(); + let textchars = text.chars().collect_vec(); + for i in start_index..len { + if "123456789".contains(textchars[i]) { + for j in i + 1..=len { + if j >= len || !"0123456789".contains(textchars[j]) { //start at end + if step <= j - i { + for k in (i..j - step).rev().step_by(step) { + text.insert_str(k + 1, sep); + } + break; + } + } + } + break; + } + } + return text; +} + +fn main() { + let tests = [ + ("pi=3.14159265358979323846264338327950288419716939937510582097494459231", 6, 5, " "), + ("The author has two Z$100000000000000 Zimbabwe notes (100 trillion).", 0, 3, ","), + ("\"-in Aus$+1411.8millions\"", 0, 3, ","), + ("===US$0017440 millions=== (in 2000 dollars)", 0, 3, ","), + ("123.e8000 is pretty big.", 0, 3, ","), + ("The land area of the earth is 57268900(29% of the surface) square miles.", 0, 3, ","), + ("Ain't no numbers in this here words, nohow, no way, Jose.", 0, 3, ","), + ("James was never known as 0000000007", 0, 3, ","), + ("Arthur Eddington wrote: I believe there are 15747724136275002577605653961181555468044717914527116709366231425076185631031296 protons in the universe.", 0, 3, ","), + (" $-140000±100 millions.", 0, 3, ","), + ("6/9/1946 was a good year for some.", 0, 3, ","),]; + for t in tests { + println!( + "Before: {}\nAfter: {}\n", + t.0, + commatize(t.0, t.1, t.2, t.3) + ); + } +} diff --git a/Task/Commatizing-numbers/VBScript/commatizing-numbers.vb b/Task/Commatizing-numbers/VBScript/commatizing-numbers.vbs similarity index 100% rename from Task/Commatizing-numbers/VBScript/commatizing-numbers.vb rename to Task/Commatizing-numbers/VBScript/commatizing-numbers.vbs diff --git a/Task/Comments/11l/comments.11l b/Task/Comments/11l/comments.11l deleted file mode 100644 index 93be840d01..0000000000 --- a/Task/Comments/11l/comments.11l +++ /dev/null @@ -1,15 +0,0 @@ -// Single line comment -\\ Also single line comment (continuation of the comment in previous line) - -\[ This is -a multi line -comment ] - -\{ And -this } - -\( And -this ) - -\‘ And -this ’ diff --git a/Task/Comments/Ada/comments.ada b/Task/Comments/Ada/comments.adb similarity index 100% rename from Task/Comments/Ada/comments.ada rename to Task/Comments/Ada/comments.adb diff --git a/Task/Comments/ArkScript/comments.ark b/Task/Comments/ArkScript/comments.ark new file mode 100644 index 0000000000..3c09c8229b --- /dev/null +++ b/Task/Comments/ArkScript/comments.ark @@ -0,0 +1,4 @@ +# this is a comment + +# another comment +# with another below diff --git a/Task/Comments/AutoIt/comments.au3 b/Task/Comments/AutoIt/comments.au3 new file mode 100644 index 0000000000..3fcfacc68f --- /dev/null +++ b/Task/Comments/AutoIt/comments.au3 @@ -0,0 +1,5 @@ +#cs +Everything between the cs and the ce is commented. +Commented code is not used by the computer. +#ce +;individual lines after a semicolon are commented. diff --git a/Task/Comments/AutoIt/comments.autoit b/Task/Comments/AutoIt/comments.autoit deleted file mode 100644 index 260be4b084..0000000000 --- a/Task/Comments/AutoIt/comments.autoit +++ /dev/null @@ -1,5 +0,0 @@ -#cs -Everything between the cs and and the ce is commented. -Commented code is not used by the computer. -#ce -;individual lines after a semicolon are commented. diff --git a/Task/Comments/Ballerina/comments.ballerina b/Task/Comments/Ballerina/comments.ballerina new file mode 100644 index 0000000000..42158b75f2 --- /dev/null +++ b/Task/Comments/Ballerina/comments.ballerina @@ -0,0 +1,10 @@ +// This is a single-line comment +int x = 10; // This is an inline comment + +# Represents a user record. +type User record { + # User's ID. + int id; + # User's name. + string name; +}; diff --git a/Task/Comments/Brainf---/comments.bf b/Task/Comments/Brainf---/comments-1.bf similarity index 100% rename from Task/Comments/Brainf---/comments.bf rename to Task/Comments/Brainf---/comments-1.bf diff --git a/Task/Comments/Brainf---/comments-2.bf b/Task/Comments/Brainf---/comments-2.bf new file mode 100644 index 0000000000..9b682b9f35 --- /dev/null +++ b/Task/Comments/Brainf---/comments-2.bf @@ -0,0 +1,3 @@ +[ This is a header comment ] + +++++++++[->++++++++<]>. diff --git a/Task/Comments/Bruijn/comments.bruijn b/Task/Comments/Bruijn/comments.bruijn new file mode 100644 index 0000000000..7dd15c1854 --- /dev/null +++ b/Task/Comments/Bruijn/comments.bruijn @@ -0,0 +1 @@ +# This is a comment diff --git a/Task/Comments/CMake/comments-1.cmake b/Task/Comments/CMake/comments-1.cmake new file mode 100644 index 0000000000..3e26cd948c --- /dev/null +++ b/Task/Comments/CMake/comments-1.cmake @@ -0,0 +1 @@ +# A single-line comment diff --git a/Task/Comments/CMake/comments-2.cmake b/Task/Comments/CMake/comments-2.cmake new file mode 100644 index 0000000000..8b9706c974 --- /dev/null +++ b/Task/Comments/CMake/comments-2.cmake @@ -0,0 +1,4 @@ +#[[A multi-line + comment ]] +#[==[A multi-line comment + with [[nested brackets]]. ]==] diff --git a/Task/Comments/COBOL/comments-1.cobol b/Task/Comments/COBOL/comments-1.cob similarity index 100% rename from Task/Comments/COBOL/comments-1.cobol rename to Task/Comments/COBOL/comments-1.cob diff --git a/Task/Comments/COBOL/comments-2.cobol b/Task/Comments/COBOL/comments-2.cob similarity index 100% rename from Task/Comments/COBOL/comments-2.cobol rename to Task/Comments/COBOL/comments-2.cob diff --git a/Task/Comments/COBOL/comments-3.cobol b/Task/Comments/COBOL/comments-3.cob similarity index 100% rename from Task/Comments/COBOL/comments-3.cobol rename to Task/Comments/COBOL/comments-3.cob diff --git a/Task/Comments/COBOL/comments-4.cobol b/Task/Comments/COBOL/comments-4.cob similarity index 100% rename from Task/Comments/COBOL/comments-4.cobol rename to Task/Comments/COBOL/comments-4.cob diff --git a/Task/Comments/COBOL/comments-5.cobol b/Task/Comments/COBOL/comments-5.cob similarity index 100% rename from Task/Comments/COBOL/comments-5.cobol rename to Task/Comments/COBOL/comments-5.cob diff --git a/Task/Comments/COBOL/comments-6.cobol b/Task/Comments/COBOL/comments-6.cob similarity index 100% rename from Task/Comments/COBOL/comments-6.cobol rename to Task/Comments/COBOL/comments-6.cob diff --git a/Task/Comments/Chapel/comments.chapel b/Task/Comments/Chapel/comments.chpl similarity index 100% rename from Task/Comments/Chapel/comments.chapel rename to Task/Comments/Chapel/comments.chpl diff --git a/Task/Comments/Crystal/comments.crystal b/Task/Comments/Crystal/comments.cr similarity index 100% rename from Task/Comments/Crystal/comments.crystal rename to Task/Comments/Crystal/comments.cr diff --git a/Task/Comments/Delphi/comments.delphi b/Task/Comments/Delphi/comments.pas similarity index 100% rename from Task/Comments/Delphi/comments.delphi rename to Task/Comments/Delphi/comments.pas diff --git a/Task/Comments/Dragonstone/comments.dragonstone b/Task/Comments/Dragonstone/comments.dragonstone new file mode 100644 index 0000000000..e8359c75d5 --- /dev/null +++ b/Task/Comments/Dragonstone/comments.dragonstone @@ -0,0 +1,19 @@ +#[ + Multi-Line Comment. +]# + +#[ + Nested Multi-Line Comment. + #[ + Inner comment. + #[ + It can go deep. + ]# + ]# + Outer comment. +]# + +# Single Line Comment + +#[ Multi-Line Comment on line ]# message = "Hello!" #[ Inside or Outside ]# +echo message # Another Trailing Comment. diff --git a/Task/Comments/Ed/comments.ed b/Task/Comments/Ed/comments.ed new file mode 100644 index 0000000000..8ae6029f77 --- /dev/null +++ b/Task/Comments/Ed/comments.ed @@ -0,0 +1,3 @@ +# A single-line comment. +# The only type of comment, really. +# No block comments in ed diff --git a/Task/Comments/Elixir/comments.elixir b/Task/Comments/Elixir/comments.ex similarity index 100% rename from Task/Comments/Elixir/comments.elixir rename to Task/Comments/Elixir/comments.ex diff --git a/Task/Comments/Emacs-Lisp/comments-1.l b/Task/Comments/Emacs-Lisp/comments-1.el similarity index 100% rename from Task/Comments/Emacs-Lisp/comments-1.l rename to Task/Comments/Emacs-Lisp/comments-1.el diff --git a/Task/Comments/Emacs-Lisp/comments-2.l b/Task/Comments/Emacs-Lisp/comments-2.el similarity index 100% rename from Task/Comments/Emacs-Lisp/comments-2.l rename to Task/Comments/Emacs-Lisp/comments-2.el diff --git a/Task/Comments/Emacs-Lisp/comments-3.l b/Task/Comments/Emacs-Lisp/comments-3.el similarity index 100% rename from Task/Comments/Emacs-Lisp/comments-3.l rename to Task/Comments/Emacs-Lisp/comments-3.el diff --git a/Task/Comments/Euphoria/comments-1.euphoria b/Task/Comments/Euphoria/comments-1.eu similarity index 100% rename from Task/Comments/Euphoria/comments-1.euphoria rename to Task/Comments/Euphoria/comments-1.eu diff --git a/Task/Comments/Euphoria/comments-2.euphoria b/Task/Comments/Euphoria/comments-2.eu similarity index 100% rename from Task/Comments/Euphoria/comments-2.euphoria rename to Task/Comments/Euphoria/comments-2.eu diff --git a/Task/Comments/Fennel/comments.fennel b/Task/Comments/Fennel/comments.fennel new file mode 100644 index 0000000000..082426ebfe --- /dev/null +++ b/Task/Comments/Fennel/comments.fennel @@ -0,0 +1 @@ +; This is a single-line comment diff --git a/Task/Comments/FutureBasic/comments.basic b/Task/Comments/FutureBasic/comments.basic index d05a6c06d6..52cd38da36 100644 --- a/Task/Comments/FutureBasic/comments.basic +++ b/Task/Comments/FutureBasic/comments.basic @@ -1,5 +1,4 @@ // Single line comment -' Single line comment rem Single line comment /* Single line comment */ diff --git a/Task/Comments/Gleam/comments.gleam b/Task/Comments/Gleam/comments.gleam new file mode 100644 index 0000000000..cc85cea83d --- /dev/null +++ b/Task/Comments/Gleam/comments.gleam @@ -0,0 +1 @@ +// comments start with "//" and continue to the end of the line. diff --git a/Task/Comments/Haxe/comments.haxe b/Task/Comments/Haxe/comments.hx similarity index 100% rename from Task/Comments/Haxe/comments.haxe rename to Task/Comments/Haxe/comments.hx diff --git a/Task/Comments/Idris/comments.idris b/Task/Comments/Idris/comments.idris new file mode 100644 index 0000000000..6494468b7c --- /dev/null +++ b/Task/Comments/Idris/comments.idris @@ -0,0 +1,9 @@ +(according to Gemini AI): + +Idris2 uses comment characters similar to Haskell: + +Single-line comments: Start with -- (two hyphens). Everything from -- to the end of the line is a comment. + +Multi-line comments: Enclosed by {- and -}. These can span multiple lines and can also be nested. + +Additionally, Idris2 supports inline documentation comments which begin with ||| (three pipe symbols). These are parsed by the compiler and can be used to generate documentation. diff --git a/Task/Comments/Janet/comments.janet b/Task/Comments/Janet/comments.janet new file mode 100644 index 0000000000..c72e9ad78b --- /dev/null +++ b/Task/Comments/Janet/comments.janet @@ -0,0 +1,7 @@ +(according to Gemini AI): + +The Janet programming language uses the # character for comments. + +Single-line comments: Everything from # to the end of the line is treated as a comment. + +Janet does not have built-in multi-line comments in the same way some other languages do (like {- ... -} in Idris2 or /* ... */ in C-like languages). However, because Janet is expression-oriented, you can often use multi-line strings as a form of "comment" if you put them in a context where their value isn't used. diff --git a/Task/Comments/Julia/comments.julia b/Task/Comments/Julia/comments.jl similarity index 100% rename from Task/Comments/Julia/comments.julia rename to Task/Comments/Julia/comments.jl diff --git a/Task/Comments/Kotlin/comments.kotlin b/Task/Comments/Kotlin/comments.kts similarity index 100% rename from Task/Comments/Kotlin/comments.kotlin rename to Task/Comments/Kotlin/comments.kts diff --git a/Task/Comments/MiniScript/comments.mini b/Task/Comments/MiniScript/comments.mini new file mode 100644 index 0000000000..225d3cd667 --- /dev/null +++ b/Task/Comments/MiniScript/comments.mini @@ -0,0 +1,2 @@ +// How many roads must a man walk down? +x = 6 * 7 // forty-two diff --git a/Task/Comments/Modula-2/comments.mod2 b/Task/Comments/Modula-2/comments.mod2 index 0d7a59997a..c6c4b9311c 100644 --- a/Task/Comments/Modula-2/comments.mod2 +++ b/Task/Comments/Modula-2/comments.mod2 @@ -1,3 +1,4 @@ -(* Comments (* can nest *) +(* Modula-2/Modula-3 use the same style of comments *) +(* ...and comments (* can nest *) and they can span multiple lines. *) diff --git a/Task/Comments/Modula-3/comments.mod3 b/Task/Comments/Modula-3/comments.mod3 deleted file mode 100644 index 0d7a59997a..0000000000 --- a/Task/Comments/Modula-3/comments.mod3 +++ /dev/null @@ -1,3 +0,0 @@ -(* Comments (* can nest *) - and they can span multiple lines. - *) diff --git a/Task/Comments/OCaml/comments.ocaml b/Task/Comments/OCaml/comments.ml similarity index 100% rename from Task/Comments/OCaml/comments.ocaml rename to Task/Comments/OCaml/comments.ml diff --git a/Task/Comments/OPL/comments.opl b/Task/Comments/OPL/comments.opl new file mode 100644 index 0000000000..901aa3e30b --- /dev/null +++ b/Task/Comments/OPL/comments.opl @@ -0,0 +1,2 @@ +REM This is a comment. +PAUSE 20 REM Can be placed behind statements, too. diff --git a/Task/Comments/Oberon/comments.oberon b/Task/Comments/Oberon/comments.oberon index 0af8c335d3..1177dbb75c 100644 --- a/Task/Comments/Oberon/comments.oberon +++ b/Task/Comments/Oberon/comments.oberon @@ -1,4 +1,4 @@ -(* this is a comment *) +(* Oberon-07/Oberon-2 use the same style of comments as Modula-2: this is a comment *) (* and this is a multiline comment diff --git a/Task/Comments/Odin/comments.odin b/Task/Comments/Odin/comments.odin new file mode 100644 index 0000000000..f8e21d0d05 --- /dev/null +++ b/Task/Comments/Odin/comments.odin @@ -0,0 +1,17 @@ +(According to Gemini AI): + +The Odin programming language supports two types of comment characters: + +Single-line comments: Begin with //. + +Code snippet +// This is a single-line comment +my_variable: int // A comment for documentation +Multi-line comments: Begin with /* and end with */. Multi-line comments can also be nested. + +Code snippet +/* +This is a multi-line comment. +/* NOTE: comments can be nested! */ +You can have any text or code here and have it be commented. +*/ diff --git a/Task/Comments/PascalABC.NET/comments.pas b/Task/Comments/PascalABC.NET/comments.pas new file mode 100644 index 0000000000..3af3369dfc --- /dev/null +++ b/Task/Comments/PascalABC.NET/comments.pas @@ -0,0 +1,7 @@ +(* This is a + multiline comment *) + +{ This is also a + multiline comment } + +// This is a single line comment diff --git a/Task/Comments/Pluto/comments.pluto b/Task/Comments/Pluto/comments.pluto new file mode 100644 index 0000000000..357b06dcd5 --- /dev/null +++ b/Task/Comments/Pluto/comments.pluto @@ -0,0 +1,9 @@ +-- Single line comment + +--[[ Multi-line + comment ]] + +--[===[ + Another syntax + [[ which may contain square brackets ]] +]===] diff --git a/Task/Comments/PowerShell/comments-1.psh b/Task/Comments/PowerShell/comments-1.ps1 similarity index 100% rename from Task/Comments/PowerShell/comments-1.psh rename to Task/Comments/PowerShell/comments-1.ps1 diff --git a/Task/Comments/PowerShell/comments-2.psh b/Task/Comments/PowerShell/comments-2.ps1 similarity index 100% rename from Task/Comments/PowerShell/comments-2.psh rename to Task/Comments/PowerShell/comments-2.ps1 diff --git a/Task/Comments/REBOL/comments-1.rebol b/Task/Comments/Rebol/comments-1.rebol similarity index 100% rename from Task/Comments/REBOL/comments-1.rebol rename to Task/Comments/Rebol/comments-1.rebol diff --git a/Task/Comments/REBOL/comments-2.rebol b/Task/Comments/Rebol/comments-2.rebol similarity index 100% rename from Task/Comments/REBOL/comments-2.rebol rename to Task/Comments/Rebol/comments-2.rebol diff --git a/Task/Comments/Rust/comments.rust b/Task/Comments/Rust/comments.rs similarity index 100% rename from Task/Comments/Rust/comments.rust rename to Task/Comments/Rust/comments.rs diff --git a/Task/Comments/Scheme/comments.ss b/Task/Comments/Scheme/comments.scm similarity index 100% rename from Task/Comments/Scheme/comments.ss rename to Task/Comments/Scheme/comments.scm diff --git a/Task/Comments/Uiua/comments.uiua b/Task/Comments/Uiua/comments.uiua new file mode 100644 index 0000000000..7dd15c1854 --- /dev/null +++ b/Task/Comments/Uiua/comments.uiua @@ -0,0 +1 @@ +# This is a comment diff --git a/Task/Comments/Uxntal/comments.uxnatl b/Task/Comments/Uxntal/comments.uxnatl new file mode 100644 index 0000000000..74169c1755 --- /dev/null +++ b/Task/Comments/Uxntal/comments.uxnatl @@ -0,0 +1,31 @@ +( + Print a hex byte to decimal. +) + +( macros ) +%\n { 0a } +%newline { [ LIT2 \n -Console/write ] DEO } + +( devices ) +|10 @Console/vector $2 &read $1 ( &pad is unused ) &pad $5 &write $1 &error $1 + +( main program ) +|100 + +@on-reset ( -> ) + #42 print/dec newline + BRK + +( library ) +@print/dec ( dec -- ) + DUP #64 DIV /dec/try + DUP #0a DIV /dec/try + ( >> ) + + &dec/num ( num -- ) + #0a DIVk MUL SUB [ LIT "0 ] ADD .Console/write DEO + JMP2r + + &dec/try ( num -- ) + DUP ?/dec/num + POP JMP2r diff --git a/Task/Comments/VBScript/comments.vb b/Task/Comments/VBScript/comments.vbs similarity index 100% rename from Task/Comments/VBScript/comments.vb rename to Task/Comments/VBScript/comments.vbs diff --git a/Task/Comments/VHDL/comments.vhdl b/Task/Comments/VHDL/comments.vhd similarity index 100% rename from Task/Comments/VHDL/comments.vhdl rename to Task/Comments/VHDL/comments.vhd diff --git a/Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-1.ada b/Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-1.adb similarity index 100% rename from Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-1.ada rename to Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-1.adb diff --git a/Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-2.ada b/Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-2.adb similarity index 100% rename from Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-2.ada rename to Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-2.adb diff --git a/Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-3.ada b/Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-3.adb similarity index 100% rename from Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-3.ada rename to Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-3.adb diff --git a/Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-4.ada b/Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-4.adb similarity index 100% rename from Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-4.ada rename to Task/Compare-a-list-of-strings/Ada/compare-a-list-of-strings-4.adb diff --git a/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-1.basic b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-1.basic new file mode 100644 index 0000000000..421239e7bb --- /dev/null +++ b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-1.basic @@ -0,0 +1,2 @@ +EQ = 1:N = VAL (S7$(0)): IF N > 1 THEN FOR I = 2 TO N:EQ = S7$(I - 1) = S7$(I): IF EQ THEN NEXT +LT = 1:N = VAL (S7$(0)): IF N > 1 THEN FOR I = 2 TO N:LT = S7$(I - 1) < S7$(I): IF LT THEN NEXT diff --git a/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-2.basic b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-2.basic new file mode 100644 index 0000000000..1f1d5f90b0 --- /dev/null +++ b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-2.basic @@ -0,0 +1,12 @@ + 0 GOSUB 4"PRINT & READ + 1 EQ = 1: IF N > 1 THEN FOR I = 2 TO N:EQ = S7$(I - 1) = S7$(I): IF EQ THEN NEXT : REMALL EQUAL + 2 LT = 1: IF N > 1 THEN FOR I = 2 TO N:LT = S7$(I - 1) < S7$(I): IF LT THEN NEXT : REMSTRICTLY ASCENDING + 3 FOR I = 0 TO 0: NEXT : END : GOTO : REMCLEAR ANY "FOR I" LOOP, QUIT & ALLOW "CONT" TO CONTINUE + 4 N = VAL (S7RING$(0)): IF N THEN FOR I = 1 TO N: PRINT MID$ (",",1,I > 1)S7RING$(I);: NEXT : REM​PRINT STRINGS + 5 READ S7RING$(0):N = VAL (S7RING$(0)): IF N THEN FOR I = 1 TO N: READ S7RING$(I): NEXT : REMREAD STRINGS + 6 RETURN + 160 DATA3,AA,BB,CC + 170 DATA3,AA,AA,AA + 180 DATA3,AA,CC,BB + 190 DATA4,AA,ACB,BB,CC + 200 DATA1,SINGLE ELEMENT diff --git a/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-3.basic b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-3.basic new file mode 100644 index 0000000000..1e3c7bc6e9 --- /dev/null +++ b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-3.basic @@ -0,0 +1,2 @@ +RUN +FOR J = 160 TO 200 STEP 10: PRINT EQ" "LT" ";: CONT diff --git a/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-4.basic b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-4.basic new file mode 100644 index 0000000000..5bba4099eb --- /dev/null +++ b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-4.basic @@ -0,0 +1 @@ +NEXT diff --git a/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-5.basic b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-5.basic new file mode 100644 index 0000000000..5bba4099eb --- /dev/null +++ b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-5.basic @@ -0,0 +1 @@ +NEXT diff --git a/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-6.basic b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-6.basic new file mode 100644 index 0000000000..5bba4099eb --- /dev/null +++ b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-6.basic @@ -0,0 +1 @@ +NEXT diff --git a/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-7.basic b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-7.basic new file mode 100644 index 0000000000..5bba4099eb --- /dev/null +++ b/Task/Compare-a-list-of-strings/Applesoft-BASIC/compare-a-list-of-strings-7.basic @@ -0,0 +1 @@ +NEXT diff --git a/Task/Compare-a-list-of-strings/Arturo/compare-a-list-of-strings.arturo b/Task/Compare-a-list-of-strings/Arturo/compare-a-list-of-strings.arturo index 647d6bb6be..e019d6165f 100644 --- a/Task/Compare-a-list-of-strings/Arturo/compare-a-list-of-strings.arturo +++ b/Task/Compare-a-list-of-strings/Arturo/compare-a-list-of-strings.arturo @@ -1,4 +1,4 @@ -allEqual?: function [lst] -> 1 = size unique lst +allEqual?: function [lst] -> one? unique lst ascending?: function [lst] -> lst = sort lst lists: [ diff --git a/Task/Compare-a-list-of-strings/BQN/compare-a-list-of-strings-1.bqn b/Task/Compare-a-list-of-strings/BQN/compare-a-list-of-strings-1.bqn index 513bc811cf..a840cab418 100644 --- a/Task/Compare-a-list-of-strings/BQN/compare-a-list-of-strings-1.bqn +++ b/Task/Compare-a-list-of-strings/BQN/compare-a-list-of-strings-1.bqn @@ -1,8 +1 @@ -AllEq ← ⍋≡⍒ -Asc ← ¬∘AllEq∧∧≡⊢ - -•Show AllEq ⟨"AA", "AA", "AA", "AA"⟩ -•Show Asc ⟨"AA", "AA", "AA", "AA"⟩ - -•Show AllEq ⟨"AA", "ACB", "BB", "CC"⟩ -•Show Asc ⟨"AA", "ACB", "BB", "CC"⟩ +⊣` diff --git a/Task/Compare-a-list-of-strings/BQN/compare-a-list-of-strings-2.bqn b/Task/Compare-a-list-of-strings/BQN/compare-a-list-of-strings-2.bqn index 680eb502aa..51394587b4 100644 --- a/Task/Compare-a-list-of-strings/BQN/compare-a-list-of-strings-2.bqn +++ b/Task/Compare-a-list-of-strings/BQN/compare-a-list-of-strings-2.bqn @@ -1,4 +1,8 @@ -1 -0 -0 -1 +AllEq ← ⍋≡⍒ # or ⊣`⊸≡ +Asc ← ⍷∘∧⊸≡ + +•Show AllEq ⟨"AA", "AA", "AA", "AA"⟩ +•Show Asc ⟨"AA", "AA", "AA", "AA"⟩ + +•Show AllEq ⟨"AA", "ACB", "BB", "CC"⟩ +•Show Asc ⟨"AA", "ACB", "BB", "CC"⟩ diff --git a/Task/Compare-a-list-of-strings/BQN/compare-a-list-of-strings-3.bqn b/Task/Compare-a-list-of-strings/BQN/compare-a-list-of-strings-3.bqn new file mode 100644 index 0000000000..680eb502aa --- /dev/null +++ b/Task/Compare-a-list-of-strings/BQN/compare-a-list-of-strings-3.bqn @@ -0,0 +1,4 @@ +1 +0 +0 +1 diff --git a/Task/Compare-a-list-of-strings/Bruijn/compare-a-list-of-strings.bruijn b/Task/Compare-a-list-of-strings/Bruijn/compare-a-list-of-strings.bruijn new file mode 100644 index 0000000000..46380c5a29 --- /dev/null +++ b/Task/Compare-a-list-of-strings/Bruijn/compare-a-list-of-strings.bruijn @@ -0,0 +1,16 @@ +:import std/String . + +all-eq? [land? (zip-with eq? 0 (tail 0))] + +all-gt? [land? (zip-with lt? 0 (tail 0))] + +# --- tests --- + +list-a "abc" : ("abc" : {}("abc")) + +list-b "abc" : ("def" : {}("ghi")) + +:test (all-eq? list-a) ([[1]]) +:test (all-eq? list-b) ([[0]]) +:test (all-gt? list-a) ([[0]]) +:test (all-gt? list-b) ([[1]]) diff --git a/Task/Compare-a-list-of-strings/COBOL/compare-a-list-of-strings.cobol b/Task/Compare-a-list-of-strings/COBOL/compare-a-list-of-strings.cob similarity index 100% rename from Task/Compare-a-list-of-strings/COBOL/compare-a-list-of-strings.cobol rename to Task/Compare-a-list-of-strings/COBOL/compare-a-list-of-strings.cob diff --git a/Task/Compare-a-list-of-strings/Crystal/compare-a-list-of-strings.cr b/Task/Compare-a-list-of-strings/Crystal/compare-a-list-of-strings.cr new file mode 100644 index 0000000000..d01e7aac6e --- /dev/null +++ b/Task/Compare-a-list-of-strings/Crystal/compare-a-list-of-strings.cr @@ -0,0 +1,14 @@ +def all_equal? (strings) + strings.all? {|elt| elt == strings[0] } +end + +def ascending? (strings) + strings.each.cons_pair.all? {|a, b| a < b } +end + +puts "strings all_equal? ascending?" +puts "-------------------------------" +["a a a a", "", "a", "a b c", "a c a"].each do |s| + ss = s.split + printf "%-10s %-5s %-5s\n", "["+ss.join(" ")+"]", all_equal?(ss), ascending?(ss) +end diff --git a/Task/Compare-a-list-of-strings/Delphi/compare-a-list-of-strings.delphi b/Task/Compare-a-list-of-strings/Delphi/compare-a-list-of-strings.pas similarity index 100% rename from Task/Compare-a-list-of-strings/Delphi/compare-a-list-of-strings.delphi rename to Task/Compare-a-list-of-strings/Delphi/compare-a-list-of-strings.pas diff --git a/Task/Compare-a-list-of-strings/DuckDB/compare-a-list-of-strings-1.duckdb b/Task/Compare-a-list-of-strings/DuckDB/compare-a-list-of-strings-1.duckdb new file mode 100644 index 0000000000..1d1f8d16c8 --- /dev/null +++ b/Task/Compare-a-list-of-strings/DuckDB/compare-a-list-of-strings-1.duckdb @@ -0,0 +1,2 @@ +select true = all (select coalesce( (lag(s) over ()) = s, true) + from t); diff --git a/Task/Compare-a-list-of-strings/DuckDB/compare-a-list-of-strings-2.duckdb b/Task/Compare-a-list-of-strings/DuckDB/compare-a-list-of-strings-2.duckdb new file mode 100644 index 0000000000..42fd797832 --- /dev/null +++ b/Task/Compare-a-list-of-strings/DuckDB/compare-a-list-of-strings-2.duckdb @@ -0,0 +1,2 @@ +select true = all (select coalesce(lag(s) over () <= s, true) + from t); diff --git a/Task/Compare-a-list-of-strings/DuckDB/compare-a-list-of-strings-3.duckdb b/Task/Compare-a-list-of-strings/DuckDB/compare-a-list-of-strings-3.duckdb new file mode 100644 index 0000000000..4ad4d70f8b --- /dev/null +++ b/Task/Compare-a-list-of-strings/DuckDB/compare-a-list-of-strings-3.duckdb @@ -0,0 +1,16 @@ +create or replace function all_equal(lst) as ( + with l as (select unnest(lst) as s) + select true = all (select coalesce( (lag(s) over ()) = s, true) + from l) +); + +create or replace function monotonic_non_decreasing(lst) as ( + with l as (select unnest(lst) as s) + select true = all (select coalesce(lag(s) over () <= s, true) + from l) +); + +# Examples + +select l, all_equal(l), monotonic_non_decreasing(l) +from (select ['a','b'] as l union all select [] as l); diff --git a/Task/Compare-a-list-of-strings/EasyLang/compare-a-list-of-strings.easy b/Task/Compare-a-list-of-strings/EasyLang/compare-a-list-of-strings.easy index 86039c73d8..a451eb048b 100644 --- a/Task/Compare-a-list-of-strings/EasyLang/compare-a-list-of-strings.easy +++ b/Task/Compare-a-list-of-strings/EasyLang/compare-a-list-of-strings.easy @@ -1,22 +1,14 @@ -proc test s$[] . . +proc test s$[] . ident = 1 ascend = 1 for i = 2 to len s$[] h = strcmp s$[i] s$[i - 1] - if h <> 0 - ident = 0 - . - if h <= 0 - ascend = 0 - . + if h <> 0 : ident = 0 + if h <= 0 : ascend = 0 . print s$[] - if ident = 1 - print "all equal" - . - if ascend = 1 - print "ascending" - . + if ident = 1 : print "all equal" + if ascend = 1 : print "ascending" print "" . test [ "AA" "BB" "CC" ] diff --git a/Task/Compare-a-list-of-strings/Elena/compare-a-list-of-strings.elena b/Task/Compare-a-list-of-strings/Elena/compare-a-list-of-strings.elena index a126c3d586..6329a3c522 100644 --- a/Task/Compare-a-list-of-strings/Elena/compare-a-list-of-strings.elena +++ b/Task/Compare-a-list-of-strings/Elena/compare-a-list-of-strings.elena @@ -5,7 +5,7 @@ import extensions; extension helper { isEqual() - = nil == self.seekEach(self.FirstMember, (n,m => m.equal:n.Inverted )); + = nil == self.seekEach(self.FirstMember, (n,m => m != n)); isAscending() { @@ -14,7 +14,7 @@ extension helper later.next(); - ^ nil == former.zipBy(later, (prev,next => next <= prev )).seekEach:(b => b) + ^ nil == former.zipBy(later, (prev,next => next <= prev )).seekEach::(b => b) } } @@ -26,13 +26,13 @@ testCases new string[]{"AA","ACB","BB","CC"}, new string[]{"single_element"}}; -public program() +public Program() { - testCases.forEach:(list) + testCases.forEach::(list) { - console.printLine(list.asEnumerable()," all equal - ",list.isEqual()); - console.printLine(list.asEnumerable()," ascending - ",list.isAscending()) + Console.printLine(list.asEnumerable()," all equal - ",list.isEqual()); + Console.printLine(list.asEnumerable()," ascending - ",list.isAscending()) }; - console.readChar() + Console.readChar() } diff --git a/Task/Compare-a-list-of-strings/Elixir/compare-a-list-of-strings.elixir b/Task/Compare-a-list-of-strings/Elixir/compare-a-list-of-strings.ex similarity index 100% rename from Task/Compare-a-list-of-strings/Elixir/compare-a-list-of-strings.elixir rename to Task/Compare-a-list-of-strings/Elixir/compare-a-list-of-strings.ex diff --git a/Task/Compare-a-list-of-strings/Gleam/compare-a-list-of-strings.gleam b/Task/Compare-a-list-of-strings/Gleam/compare-a-list-of-strings.gleam new file mode 100644 index 0000000000..501b6bb6ed --- /dev/null +++ b/Task/Compare-a-list-of-strings/Gleam/compare-a-list-of-strings.gleam @@ -0,0 +1,12 @@ +pub fn all_equal(strs: List(String)) -> Bool { + all_fulfill(fn(s1, s2) { s1 == s2 }, strs) +} + +pub fn all_increasing(strs: List(String)) -> Bool { + all_fulfill(fn(s1, s2) { string.compare(s1, s2) == order.Lt }, strs) +} + +fn all_fulfill(check: fn(String, String) -> Bool, strings: List(String)) -> Bool { + let pairs = list.zip(strings, list.drop(strings, 1)) + list.all(pairs, fn(pair) { check(pair.0, pair.1) }) +} diff --git a/Task/Compare-a-list-of-strings/Go/compare-a-list-of-strings.go b/Task/Compare-a-list-of-strings/Go/compare-a-list-of-strings.go index 5c7546426d..920341f797 100644 --- a/Task/Compare-a-list-of-strings/Go/compare-a-list-of-strings.go +++ b/Task/Compare-a-list-of-strings/Go/compare-a-list-of-strings.go @@ -11,7 +11,7 @@ func AllEqual(strings []string) bool { func AllLessThan(strings []string) bool { for i := 1; i < len(strings); i++ { - if !(strings[i - 1] < s) { + if strings[i - 1] >= strings[i] { return false } } diff --git a/Task/Compare-a-list-of-strings/Icon/compare-a-list-of-strings.icon b/Task/Compare-a-list-of-strings/Icon/compare-a-list-of-strings-1.icon similarity index 100% rename from Task/Compare-a-list-of-strings/Icon/compare-a-list-of-strings.icon rename to Task/Compare-a-list-of-strings/Icon/compare-a-list-of-strings-1.icon diff --git a/Task/Compare-a-list-of-strings/Icon/compare-a-list-of-strings-2.icon b/Task/Compare-a-list-of-strings/Icon/compare-a-list-of-strings-2.icon new file mode 100644 index 0000000000..05598811ee --- /dev/null +++ b/Task/Compare-a-list-of-strings/Icon/compare-a-list-of-strings-2.icon @@ -0,0 +1,9 @@ +# test for all identical +procedure allequal(L) + if *L >= 2 & !L ~== L[1] then fail else return +end + +# test for strictly ascending +procedure ascending(L) + if *L >= 2 & i := 1 to *L-1 & L[i] >>= L[i+1] then fail else return +end diff --git a/Task/Compare-a-list-of-strings/Icon/compare-a-list-of-strings-3.icon b/Task/Compare-a-list-of-strings/Icon/compare-a-list-of-strings-3.icon new file mode 100644 index 0000000000..14327c0456 --- /dev/null +++ b/Task/Compare-a-list-of-strings/Icon/compare-a-list-of-strings-3.icon @@ -0,0 +1 @@ +writes(if allequal(L) then "true" else "false") diff --git a/Task/Compare-a-list-of-strings/Icon/compare-a-list-of-strings-4.icon b/Task/Compare-a-list-of-strings/Icon/compare-a-list-of-strings-4.icon new file mode 100644 index 0000000000..bfd62b39e8 --- /dev/null +++ b/Task/Compare-a-list-of-strings/Icon/compare-a-list-of-strings-4.icon @@ -0,0 +1 @@ +writes(if *L >= 2 & !L ~== L[1] then "false" else "true") diff --git a/Task/Compare-a-list-of-strings/Jq/compare-a-list-of-strings-1.jq b/Task/Compare-a-list-of-strings/Jq/compare-a-list-of-strings-1.jq index 9d9694486b..9a73ae5c6f 100644 --- a/Task/Compare-a-list-of-strings/Jq/compare-a-list-of-strings-1.jq +++ b/Task/Compare-a-list-of-strings/Jq/compare-a-list-of-strings-1.jq @@ -1,11 +1,11 @@ # Are the strings all equal? def lexically_equal: - . as $in - | reduce range(0;length-1) as $i - (true; if . then $in[$i] == $in[$i + 1] else false end); + if length <= 1 then true + else . as $in + | all( range(0;length-1); $in[0] == $in[. + 1]) + end; -# Are the strings in strictly ascending order? +# Are the elements in strictly ascending order? def lexically_ascending: . as $in - | reduce range(0;length-1) as $i - (true; if . then $in[$i] < $in[$i + 1] else false end); + | all( range(0;length-1); $in[.] < $in[. + 1]); diff --git a/Task/Compare-a-list-of-strings/Julia/compare-a-list-of-strings.julia b/Task/Compare-a-list-of-strings/Julia/compare-a-list-of-strings.jl similarity index 100% rename from Task/Compare-a-list-of-strings/Julia/compare-a-list-of-strings.julia rename to Task/Compare-a-list-of-strings/Julia/compare-a-list-of-strings.jl diff --git a/Task/Compare-a-list-of-strings/K/compare-a-list-of-strings.k b/Task/Compare-a-list-of-strings/K/compare-a-list-of-strings.k new file mode 100644 index 0000000000..94f07991ed --- /dev/null +++ b/Task/Compare-a-list-of-strings/K/compare-a-list-of-strings.k @@ -0,0 +1,2 @@ +alleq:&/1_~': +asc:&/(*<,)':,:' diff --git a/Task/Compare-a-list-of-strings/Kotlin/compare-a-list-of-strings.kotlin b/Task/Compare-a-list-of-strings/Kotlin/compare-a-list-of-strings.kts similarity index 100% rename from Task/Compare-a-list-of-strings/Kotlin/compare-a-list-of-strings.kotlin rename to Task/Compare-a-list-of-strings/Kotlin/compare-a-list-of-strings.kts diff --git a/Task/Compare-a-list-of-strings/M2000-Interpreter/compare-a-list-of-strings.m2000 b/Task/Compare-a-list-of-strings/M2000-Interpreter/compare-a-list-of-strings.m2000 index 14627c3e47..b02abbc166 100644 --- a/Task/Compare-a-list-of-strings/M2000-Interpreter/compare-a-list-of-strings.m2000 +++ b/Task/Compare-a-list-of-strings/M2000-Interpreter/compare-a-list-of-strings.m2000 @@ -37,3 +37,38 @@ Module CheckIt { Print LessThan(A$())=False } Checkit +MODULE UsingLambdaFunctionAndFold { + equ=LAMBDA ->{ + =LAMBDA p$, c=0 -> { + IF c=0 THEN + p$=LETTER$: PUSH 1=1 : c++ + ELSE + READ q$ + IF STACKITEM() THEN + DROP + PUSH p$=q$ + p$=q$ + END IF + END IF + } + } + LessThan=LAMBDA ->{ + =LAMBDA p$, c=0 -> { + IF c=0 THEN + p$=LETTER$: PUSH 1=1 : c++ + ELSE + READ q$ + IF STACKITEM() THEN + DROP + PUSH p$ lst.First = x); + +function IsStrictAscending(lst: sequence of string): boolean + := lst.Pairwise.All(x -> x[0] < x[1]); + +begin + var strings := |'abc','abc','abc','abc'|; + Print(AllEqual(strings)); + var strings1 := |'abc','abd','ade','aef'|; + Print(IsStrictAscending(strings1)); +end. diff --git a/Task/Compare-a-list-of-strings/Phix/compare-a-list-of-strings.phix b/Task/Compare-a-list-of-strings/Phix/compare-a-list-of-strings.phix index 4faabce3f2..05991641e5 100644 --- a/Task/Compare-a-list-of-strings/Phix/compare-a-list-of-strings.phix +++ b/Task/Compare-a-list-of-strings/Phix/compare-a-list-of-strings.phix @@ -1,26 +1,24 @@ -(phixonline)--> - with javascript_semantics - function allsame(sequence s) - for i=2 to length(s) do - if s[i]!=s[1] then return false end if - end for - return true - end function +with javascript_semantics +function allsame(sequence s) + for i=2 to length(s) do + if s[i]!=s[1] then return false end if + end for + return true +end function - function strict_order(sequence s) - for i=2 to length(s) do - if s[i]<=s[i-1] then return false end if - end for - return true - end function +function strict_order(sequence s) + for i=2 to length(s) do + if s[i]<=s[i-1] then return false end if + end for + return true +end function - procedure test(sequence s) - printf(1,"%-22V allsame:%5t, strict_order:%5t\n",{s,allsame(s),strict_order(s)}) - end procedure +procedure test(sequence s) + printf(1,"%-22V allsame:%5t, strict_order:%5t\n",{s,allsame(s),strict_order(s)}) +end procedure - test({"AA","BB","CC"}) - test({"AA","AA","AA"}) - test({"AA","CC","BB"}) - test({"AA","ACB","BB","CC"}) - test({"single_element"}) - - integer a,b - a = 10*9*8*7*6*5*4*3*2*1 - b = factorial(10) - ?{a,b} - - -- - -- demo\rosetta\Compiler\interp.exw - -- ================================ - -- - with javascript_semantics - include parse.e +-- demo\rosetta\Compiler\interp.exw +with javascript_semantics +include parse.e - sequence vars = {}, - vals = {} +sequence vars = {}, + vals = {} - function var_idx(sequence inode) - if inode[1]!=tk_Identifier then ?9/0 end if - string ident = inode[2] - integer n = find(ident,vars) - if n=0 then - vars = append(vars,ident) - vals = append(vals,0) - n = length(vars) - end if - return n - end function +function var_idx(sequence inode) + if inode[1]!=tk_Identifier then ?9/0 end if + string ident = inode[2] + integer n = find(ident,vars) + if n=0 then + vars = append(vars,ident) + vals = append(vals,0) + n = length(vars) + end if + return n +end function - function interp(object t) - if t!=NULL then - integer ntype = t[1] - object t2 = t[2], - t3 = iff(length(t)=3?t[3]:0) - switch ntype do - case tk_Sequence: {} = interp(t2) {} = interp(t3) - case tk_assign: vals[var_idx(t2)] = interp(t3) - case tk_Identifier: return vals[var_idx(t)] - case tk_Integer: return t2 - case tk_String: return t2 - case tk_lt: return interp(t2) < interp(t3) - case tk_add: return interp(t2) + interp(t3) - case tk_sub: return interp(t2) - interp(t3) - case tk_while: while interp(t2) do {} = interp(t3) end while - case tk_Prints: puts(1,interp(t2)) - case tk_Printi: printf(1,"%d",interp(t2)) - case tk_putc: printf(1,"%c",interp(t2)) - case tk_and: return interp(t2) and interp(t3) - case tk_or: return interp(t2) or interp(t3) - case tk_le: return interp(t2) <= interp(t3) - case tk_ge: return interp(t2) >= interp(t3) - case tk_ne: return interp(t2) != interp(t3) - case tk_gt: return interp(t2) > interp(t3) - case tk_mul: return interp(t2) * interp(t3) - case tk_div: return trunc(interp(t2)/interp(t3)) - case tk_mod: return remainder(interp(t2),interp(t3)) - case tk_if: {} = interp(t3[iff(interp(t2)?2:3)]) - case tk_not: return not interp(t2) - case tk_neg: return - interp(t2) - else - error("unknown node type") - end switch - end if - return NULL - end function +function interp(object t) + if t!=NULL then + integer ntype = t[1] + object t2 = t[2], + t3 = iff(length(t)=3?t[3]:0) + switch ntype do + case tk_Sequence: {} = interp(t2) {} = interp(t3) + case tk_assign: vals[var_idx(t2)] = interp(t3) + case tk_Identifier: return vals[var_idx(t)] + case tk_Integer: return t2 + case tk_String: return t2 + case tk_lt: return interp(t2) < interp(t3) + case tk_add: return interp(t2) + interp(t3) + case tk_sub: return interp(t2) - interp(t3) + case tk_while: while interp(t2) do {} = interp(t3) end while + case tk_Prints: puts(1,interp(t2)) + case tk_Printi: printf(1,"%d",interp(t2)) + case tk_putc: printf(1,"%c",interp(t2)) + case tk_and: return interp(t2) and interp(t3) + case tk_or: return interp(t2) or interp(t3) + case tk_le: return interp(t2) <= interp(t3) + case tk_ge: return interp(t2) >= interp(t3) + case tk_ne: return interp(t2) != interp(t3) + case tk_gt: return interp(t2) > interp(t3) + case tk_mul: return interp(t2) * interp(t3) + case tk_div: return trunc(interp(t2)/interp(t3)) + case tk_mod: return remainder(interp(t2),interp(t3)) + case tk_if: {} = interp(t3[iff(interp(t2)?2:3)]) + case tk_not: return not interp(t2) + case tk_neg: return - interp(t2) + else + error("unknown node type") + end switch + end if + return NULL +end function - procedure main(sequence cl) - open_files(cl) - toks = lex() - object t = parse() - {} = interp(t) - close_files() - end procedure +procedure main(sequence cl) + open_files(cl) + toks = lex() + object t = parse() + {} = interp(t) + close_files() +end procedure - --main(command_line()) - main({0,0,"primes.c"}) - - -- - -- demo\rosetta\Compiler\cgen.e - -- ============================ - -- - -- The reusable part of cgen.exw - -- - without js -- (machine code!) - include parse.e +-- demo\rosetta\Compiler\cgen.e +-- The reusable part of cgen.exw +without js -- (machine code!) +include parse.e - global sequence vars = {}, - strings = {}, - stringptrs = {} +global sequence vars = {}, + strings = {}, + stringptrs = {} - global integer chain = 0 - global sequence code = {} +global integer chain = 0 +global sequence code = {} - function var_idx(sequence inode) - if inode[1]!=tk_Identifier then ?9/0 end if - string ident = inode[2] - integer n = find(ident,vars) - if n=0 then - vars = append(vars,ident) - n = length(vars) - end if - return n - end function +function var_idx(sequence inode) + if inode[1]!=tk_Identifier then ?9/0 end if + string ident = inode[2] + integer n = find(ident,vars) + if n=0 then + vars = append(vars,ident) + n = length(vars) + end if + return n +end function - function string_idx(sequence inode) - if inode[1]!=tk_String then ?9/0 end if - string s = inode[2] - integer n = find(s,strings) - if n=0 then - strings = append(strings,s) - stringptrs = append(stringptrs,0) - n = length(strings) - end if - return n - end function +function string_idx(sequence inode) + if inode[1]!=tk_String then ?9/0 end if + string s = inode[2] + integer n = find(s,strings) + if n=0 then + strings = append(strings,s) + stringptrs = append(stringptrs,0) + n = length(strings) + end if + return n +end function - function gen_size(object t) - -- note: must be kept precisely in sync with gen_rec! - -- (relentlessly tested via estsize/actsize) - integer size = 0 - if t!=NULL then - integer n_type = t[1] - string node_type = tkNames[n_type] - switch n_type do - case tk_Sequence: - size += gen_size(t[2]) - size += gen_size(t[3]) - case tk_assign: - size += gen_size(t[3])+6 - case tk_Integer: - size += 5 - case tk_Identifier: - size += 6 - case tk_String: - size += 5 - case tk_while: - -- emit: @@:<condition><topjmp(@f)><body><tailjmp(@b)>@@: - size += gen_size(t[2])+3 - integer body = gen_size(t[3]) - integer stail = iff(size+body+2>128?5:2) - integer stop = iff(body+stail >127?6:2) - size += stop+body+stail - case tk_lt: - case tk_le: - case tk_ne: - case tk_eq: - case tk_gt: - case tk_ge: - size += gen_size(t[2]) - size += gen_size(t[3]) - size += 10 - case tk_and: - case tk_or: - size += gen_size(t[2]) - size += gen_size(t[3]) - size += 15 - case tk_add: - case tk_sub: - size += gen_size(t[2]) - size += gen_size(t[3]) - size += 4 - case tk_mul: - size += gen_size(t[2]) - size += gen_size(t[3]) - size += 5 - case tk_div: - case tk_mod: - size += gen_size(t[2]) - size += gen_size(t[3]) - size += 6 - case tk_putc: - case tk_Printi: - case tk_Prints: - size += gen_size(t[2]) - size += 5 - case tk_if: - size += gen_size(t[2])+3 - if t[3][1]!=tk_if then ?9/0 end if - integer truesize = gen_size(t[3][2]) - integer falsesize = gen_size(t[3][3]) - integer elsejmp = iff(falsesize=0?0:iff(falsesize>127?5:2)) - integer mainjmp = iff(truesize+elsejmp>127?6:2) - size += mainjmp+truesize+elsejmp+falsesize - case tk_not: - size += gen_size(t[2]) - size += 9 - case tk_neg: - size += gen_size(t[2]) - size += 4 - else: - ?9/0 - end switch - end if - return size - end function +function gen_size(object t) +-- note: must be kept precisely in sync with gen_rec! +-- (relentlessly tested via estsize/actsize) +integer size = 0 + if t!=NULL then + integer n_type = t[1] + string node_type = tkNames[n_type] + switch n_type do + case tk_Sequence: + size += gen_size(t[2]) + size += gen_size(t[3]) + case tk_assign: + size += gen_size(t[3])+6 + case tk_Integer: + size += 5 + case tk_Identifier: + size += 6 + case tk_String: + size += 5 + case tk_while: + -- emit: @@:@@: + size += gen_size(t[2])+3 + integer body = gen_size(t[3]) + integer stail = iff(size+body+2>128?5:2) + integer stop = iff(body+stail >127?6:2) + size += stop+body+stail + case tk_lt: + case tk_le: + case tk_ne: + case tk_eq: + case tk_gt: + case tk_ge: + size += gen_size(t[2]) + size += gen_size(t[3]) + size += 10 + case tk_and: + case tk_or: + size += gen_size(t[2]) + size += gen_size(t[3]) + size += 15 + case tk_add: + case tk_sub: + size += gen_size(t[2]) + size += gen_size(t[3]) + size += 4 + case tk_mul: + size += gen_size(t[2]) + size += gen_size(t[3]) + size += 5 + case tk_div: + case tk_mod: + size += gen_size(t[2]) + size += gen_size(t[3]) + size += 6 + case tk_putc: + case tk_Printi: + case tk_Prints: + size += gen_size(t[2]) + size += 5 + case tk_if: + size += gen_size(t[2])+3 + if t[3][1]!=tk_if then ?9/0 end if + integer truesize = gen_size(t[3][2]) + integer falsesize = gen_size(t[3][3]) + integer elsejmp = iff(falsesize=0?0:iff(falsesize>127?5:2)) + integer mainjmp = iff(truesize+elsejmp>127?6:2) + size += mainjmp+truesize+elsejmp+falsesize + case tk_not: + size += gen_size(t[2]) + size += 9 + case tk_neg: + size += gen_size(t[2]) + size += 4 + else: + ?9/0 + end switch + end if + return size +end function - procedure gen_rec(object t) - -- the recursive part of code_gen - if t!=NULL then - integer initsize = length(code) - integer estsize = gen_size(t) -- (test the gen_size function) - integer n_type = t[1] - string node_type = tkNames[n_type] - switch n_type do - case tk_Sequence: - gen_rec(t[2]) - gen_rec(t[3]) - case tk_assign: - integer n = var_idx(t[2]) - gen_rec(t[3]) - code &= {0o217,0o005,chain,1,n,0} -- pop [i] - chain = length(code)-3 - case tk_Integer: - integer n = t[2] - code &= 0o150&int_to_bytes(n) -- push imm32 - case tk_while: - -- emit: @@:<condition><topjmp(@f)><body><tailjmp(@b)>@@: - integer looptop = length(code) - gen_rec(t[2]) - code &= {0o130, -- pop eax - 0o205,0o300} -- test eax,eax - integer bodysize = gen_size(t[3]) - -- can we use short jumps? - -- disclaimer: size calcs are not heavily tested; if in - -- doubt reduce 128/7 by 8, and if that works - -- then yep, you just found a boundary case. - integer stail = iff(length(code)+bodysize+4-looptop>128?5:2) - integer offset = bodysize+stail - integer stop = iff(offset>127?6:2) - if stop=2 then - code &= {0o164,offset} -- jz (short) end - else - code &= {0o017,0o204}&int_to_bytes(offset) -- jz (long) end - end if - gen_rec(t[3]) - offset = looptop-(length(code)+stail) - if stail=2 then - code &= 0o353&offset -- jmp looptop (short) - else - code &= 0o351&int_to_bytes(offset) -- jmp looptop (long) - end if - case tk_lt: - case tk_le: - case tk_gt: - case tk_ge: - case tk_ne: - case tk_eq: - gen_rec(t[2]) - gen_rec(t[3]) - integer xrm - if n_type=tk_ne then xrm = 0o225 -- (#95) - elsif n_type=tk_lt then xrm = 0o234 -- (#9C) - elsif n_type=tk_ge then xrm = 0o235 -- (#9D) - elsif n_type=tk_le then xrm = 0o236 -- (#9E) - elsif n_type=tk_gt then xrm = 0o237 -- (#9F) - else ?9/0 - end if - code &= { 0o061,0o300, -- xor eax,eax - 0o132, -- pop edx - 0o131, -- pop ecx - 0o071,0o321, -- cmp ecx,edx - 0o017,xrm,0o300, -- setcc al - 0o120} -- push eax - case tk_or: - case tk_and: - gen_rec(t[2]) - gen_rec(t[3]) - integer op = find(n_type,{tk_or,0,0,tk_and}) - op *= 0o010 - code &= { 0o130, -- pop eax - 0o131, -- pop ecx - 0o205,0o300, -- test eax,eax - 0o017,0o225,0o300, -- setne al - 0o205,0o311, -- test ecx,ecx - 0o017,0o225,0o301, -- setne cl - op,0o310, -- or/and al,cl - 0o120} -- push eax - case tk_add: - case tk_sub: - gen_rec(t[2]) - gen_rec(t[3]) - integer op = find(n_type,{tk_add,0,0,0,0,tk_sub}) - op = 0o001 + (op-1)*0o010 - code &= { 0o130, -- pop eax - op,0o004,0o044} -- add/or/and/sub [esp],eax - case tk_mul: - gen_rec(t[2]) - gen_rec(t[3]) - code &= { 0o131, -- pop ecx - 0o130, -- pop eax - 0o367,0o341, -- mul ecx - 0o120} -- push eax - case tk_div: - case tk_mod: - gen_rec(t[2]) - gen_rec(t[3]) - integer push = 0o120+(n_type=tk_mod)*2 - code &= { 0o131, -- pop ecx - 0o130, -- pop eax - 0o231, -- cdq (eax -> edx:eax) - 0o367,0o371, -- idiv ecx - push} -- push eax|edx - case tk_Identifier: - integer n = var_idx(t) - code &= {0o377,0o065,chain,1,n,0} -- push [n] - chain = length(code)-3 - case tk_putc: - case tk_Printi: - case tk_Prints: - gen_rec(t[2]) - integer n = find(n_type,{tk_putc,tk_Printi,tk_Prints}) - code &= {0o350,chain,3,n,0} -- call :printc/i/s - chain = length(code)-3 - case tk_String: - integer n = string_idx(t) - code &= {0o150,chain,2,n,0} -- push RawStringPtr(string) - chain = length(code)-3 - case tk_if: - -- emit: <condition><mainjmp><truepart>[<elsejmp><falsepart>] - gen_rec(t[2]) - code &= {0o130, -- pop eax - 0o205,0o300} -- test eax,eax - if t[3][1]!=tk_if then ?9/0 end if - integer truesize = gen_size(t[3][2]) - integer falsesize = gen_size(t[3][3]) - integer elsejmp = iff(falsesize=0?0:iff(falsesize>127?5:2)) - integer offset = truesize+elsejmp - integer mainjmp = iff(offset>127?6:2) - if mainjmp=2 then - code &= {0o164,offset} -- jz (short) else/end - else - code &= {0o017,0o204}&int_to_bytes(offset) -- jz (long) else/end - end if - gen_rec(t[3][2]) - if falsesize!=0 then - offset = falsesize - if elsejmp=2 then - code &= 0o353&offset -- jmp end if (short) - else - code &= 0o351&int_to_bytes(offset) -- jmp end if (long) - end if - gen_rec(t[3][3]) - end if - case tk_not: - gen_rec(t[2]) - code &= {0o132, -- pop edx - 0o061,0o300, -- xor eax,eax - 0o205,0o322, -- test edx,edx - 0o017,0o224,0o300, -- setz al - 0o120} -- push eax - case tk_neg: - gen_rec(t[2]) - code &= {0o130, -- pop eax - 0o367,0o330, -- neg eax - 0o120} -- push eax - else: - error("error in code generator - found %d, expecting operator\n", {n_type}) - end switch - integer actsize = length(code) - if initsize+estsize!=actsize then ?"9/0" end if -- (test gen_size) - end if - end procedure +procedure gen_rec(object t) +-- the recursive part of code_gen + if t!=NULL then + integer initsize = length(code) + integer estsize = gen_size(t) -- (test the gen_size function) + integer n_type = t[1] + string node_type = tkNames[n_type] + switch n_type do + case tk_Sequence: + gen_rec(t[2]) + gen_rec(t[3]) + case tk_assign: + integer n = var_idx(t[2]) + gen_rec(t[3]) + code &= {0o217,0o005,chain,1,n,0} -- pop [i] + chain = length(code)-3 + case tk_Integer: + integer n = t[2] + code &= 0o150&int_to_bytes(n) -- push imm32 + case tk_while: + -- emit: @@:@@: + integer looptop = length(code) + gen_rec(t[2]) + code &= {0o130, -- pop eax + 0o205,0o300} -- test eax,eax + integer bodysize = gen_size(t[3]) + -- can we use short jumps? + -- disclaimer: size calcs are not heavily tested; if in + -- doubt reduce 128/7 by 8, and if that works + -- then yep, you just found a boundary case. + integer stail = iff(length(code)+bodysize+4-looptop>128?5:2) + integer offset = bodysize+stail + integer stop = iff(offset>127?6:2) + if stop=2 then + code &= {0o164,offset} -- jz (short) end + else + code &= {0o017,0o204}&int_to_bytes(offset) -- jz (long) end + end if + gen_rec(t[3]) + offset = looptop-(length(code)+stail) + if stail=2 then + code &= 0o353&offset -- jmp looptop (short) + else + code &= 0o351&int_to_bytes(offset) -- jmp looptop (long) + end if + case tk_lt: + case tk_le: + case tk_gt: + case tk_ge: + case tk_ne: + case tk_eq: + gen_rec(t[2]) + gen_rec(t[3]) + integer xrm + if n_type=tk_ne then xrm = 0o225 -- (#95) + elsif n_type=tk_lt then xrm = 0o234 -- (#9C) + elsif n_type=tk_ge then xrm = 0o235 -- (#9D) + elsif n_type=tk_le then xrm = 0o236 -- (#9E) + elsif n_type=tk_gt then xrm = 0o237 -- (#9F) + else ?9/0 + end if + code &= { 0o061,0o300, -- xor eax,eax + 0o132, -- pop edx + 0o131, -- pop ecx + 0o071,0o321, -- cmp ecx,edx + 0o017,xrm,0o300, -- setcc al + 0o120} -- push eax + case tk_or: + case tk_and: + gen_rec(t[2]) + gen_rec(t[3]) + integer op = find(n_type,{tk_or,0,0,tk_and}) + op *= 0o010 + code &= { 0o130, -- pop eax + 0o131, -- pop ecx + 0o205,0o300, -- test eax,eax + 0o017,0o225,0o300, -- setne al + 0o205,0o311, -- test ecx,ecx + 0o017,0o225,0o301, -- setne cl + op,0o310, -- or/and al,cl + 0o120} -- push eax + case tk_add: + case tk_sub: + gen_rec(t[2]) + gen_rec(t[3]) + integer op = find(n_type,{tk_add,0,0,0,0,tk_sub}) + op = 0o001 + (op-1)*0o010 + code &= { 0o130, -- pop eax + op,0o004,0o044} -- add/or/and/sub [esp],eax + case tk_mul: + gen_rec(t[2]) + gen_rec(t[3]) + code &= { 0o131, -- pop ecx + 0o130, -- pop eax + 0o367,0o341, -- mul ecx + 0o120} -- push eax + case tk_div: + case tk_mod: + gen_rec(t[2]) + gen_rec(t[3]) + integer push = 0o120+(n_type=tk_mod)*2 + code &= { 0o131, -- pop ecx + 0o130, -- pop eax + 0o231, -- cdq (eax -> edx:eax) + 0o367,0o371, -- idiv ecx + push} -- push eax|edx + case tk_Identifier: + integer n = var_idx(t) + code &= {0o377,0o065,chain,1,n,0} -- push [n] + chain = length(code)-3 + case tk_putc: + case tk_Printi: + case tk_Prints: + gen_rec(t[2]) + integer n = find(n_type,{tk_putc,tk_Printi,tk_Prints}) + code &= {0o350,chain,3,n,0} -- call :printc/i/s + chain = length(code)-3 + case tk_String: + integer n = string_idx(t) + code &= {0o150,chain,2,n,0} -- push RawStringPtr(string) + chain = length(code)-3 + case tk_if: + -- emit: [] + gen_rec(t[2]) + code &= {0o130, -- pop eax + 0o205,0o300} -- test eax,eax + if t[3][1]!=tk_if then ?9/0 end if + integer truesize = gen_size(t[3][2]) + integer falsesize = gen_size(t[3][3]) + integer elsejmp = iff(falsesize=0?0:iff(falsesize>127?5:2)) + integer offset = truesize+elsejmp + integer mainjmp = iff(offset>127?6:2) + if mainjmp=2 then + code &= {0o164,offset} -- jz (short) else/end + else + code &= {0o017,0o204}&int_to_bytes(offset) -- jz (long) else/end + end if + gen_rec(t[3][2]) + if falsesize!=0 then + offset = falsesize + if elsejmp=2 then + code &= 0o353&offset -- jmp end if (short) + else + code &= 0o351&int_to_bytes(offset) -- jmp end if (long) + end if + gen_rec(t[3][3]) + end if + case tk_not: + gen_rec(t[2]) + code &= {0o132, -- pop edx + 0o061,0o300, -- xor eax,eax + 0o205,0o322, -- test edx,edx + 0o017,0o224,0o300, -- setz al + 0o120} -- push eax + case tk_neg: + gen_rec(t[2]) + code &= {0o130, -- pop eax + 0o367,0o330, -- neg eax + 0o120} -- push eax + else: + error("error in code generator - found %d, expecting operator\n", {n_type}) + end switch + integer actsize = length(code) + if initsize+estsize!=actsize then ?"9/0" end if -- (test gen_size) + end if +end procedure - global procedure code_gen(object t) - -- - -- Generates proper machine code. - -- - -- Example: i=10; print "\n"; print i; print "\n" - -- Result in vars, strings, chain, code (declared above) - -- where vars is: {"i"}, - -- strings is {"\n"}, - -- code is { 0o150,#0A,#00,#00,#00, -- 1: push 10 - -- 0o217,0o005,0,1,1,0 -- 6: pop [i] - -- 0o150,8,2,1,0, -- 12: push ("\n") - -- 0o350,13,3,3,0, -- 17: call :prints - -- 0o377,0o065,18,1,1,0, -- 22: push [i] - -- 0o350,24,3,2,0, -- 28: call :printi - -- 0o150,29,2,1,0, -- 33: push ("\n") - -- 0o350,34,3,3,0, -- 38: call :prints - -- 0o303} -- 43: ret - -- and chain is 39 (->34->29->24->18->13->8->0) - -- The chain connects all places where we need an actual address before - -- the code is executed, with the byte after the link differentiating - -- between var(1), string(2), and builtin(3), and the byte after that - -- determining the instance of the given type - not that any of them - -- are actually limited to a byte in the above intermediate form, and - -- of course the trailing 0 of each {link,type,id,0} is just there to - -- reserve the space we will need. - -- - gen_rec(t) - code = append(code,0o303) -- ret (0o303=#C3) - end procedure +global procedure code_gen(object t) +-- +-- Generates proper machine code. +-- +-- Example: i=10; print "\n"; print i; print "\n" +-- Result in vars, strings, chain, code (declared above) +-- where vars is: {"i"}, +-- strings is {"\n"}, +-- code is { 0o150,#0A,#00,#00,#00, -- 1: push 10 +-- 0o217,0o005,0,1,1,0 -- 6: pop [i] +-- 0o150,8,2,1,0, -- 12: push ("\n") +-- 0o350,13,3,3,0, -- 17: call :prints +-- 0o377,0o065,18,1,1,0, -- 22: push [i] +-- 0o350,24,3,2,0, -- 28: call :printi +-- 0o150,29,2,1,0, -- 33: push ("\n") +-- 0o350,34,3,3,0, -- 38: call :prints +-- 0o303} -- 43: ret +-- and chain is 39 (->34->29->24->18->13->8->0) +-- The chain connects all places where we need an actual address before +-- the code is executed, with the byte after the link differentiating +-- between var(1), string(2), and builtin(3), and the byte after that +-- determining the instance of the given type - not that any of them +-- are actually limited to a byte in the above intermediate form, and +-- of course the trailing 0 of each {link,type,id,0} is just there to +-- reserve the space we will need. +-- + gen_rec(t) + code = append(code,0o303) -- ret (0o303=#C3) +end procedure - include builtins/VM/puts1.e -- low-level console i/o routines +include builtins/VM/puts1.e -- low-level console i/o routines - function setbuiltins() - atom printc,printi,prints - #ilASM{ - jmp :setbuiltins - ::printc - lea edi,[esp+4] - mov esi,1 - call :%puts1ediesi -- (edi=raw text, esi=length) - ret 4 - ::printi - mov eax,[esp+4] - push 0 -- no cr - call :%putsint -- (nb limited to +/-9,999,999,999) - ret 4 - ::prints - mov edi,[esp+4] - mov esi,[edi-12] - call :%puts1ediesi -- (edi=raw text, esi=length) - ret 4 - ::setbuiltins - mov eax,:printc - lea edi,[printc] - call :%pStoreMint - mov eax,:printi - lea edi,[printi] - call :%pStoreMint - mov eax,:prints - lea edi,[prints] - call :%pStoreMint - } - return {printc,printi,prints} - end function +function setbuiltins() +atom printc,printi,prints + #ilASM{ + jmp :setbuiltins + ::printc + lea edi,[esp+4] + mov esi,1 + call :%puts1ediesi -- (edi=raw text, esi=length) + ret 4 + ::printi + mov eax,[esp+4] + push 0 -- no cr + call :%putsint -- (nb limited to +/-9,999,999,999) + ret 4 + ::prints + mov edi,[esp+4] + mov esi,[edi-12] + call :%puts1ediesi -- (edi=raw text, esi=length) + ret 4 + ::setbuiltins + mov eax,:printc + lea edi,[printc] + call :%pStoreMint + mov eax,:printi + lea edi,[printi] + call :%pStoreMint + mov eax,:prints + lea edi,[prints] + call :%pStoreMint + } + return {printc,printi,prints} +end function - global constant builtin_names = {"printc","printi","prints"} - global constant builtins = setbuiltins() +global constant builtin_names = {"printc","printi","prints"} +global constant builtins = setbuiltins() - global atom var_mem, code_mem +global atom var_mem, code_mem - function RawStringPtr(integer n) -- (based on IupRawStringPtr from pGUI.e) - -- - -- Returns a raw string pointer for s, somewhat like allocate_string(s), but using the existing memory. - -- NOTE: The return is only valid as long as the value passed as the parameter remains in existence. - -- - atom res - string s = strings[n] - #ilASM{ - mov eax,[s] - lea edi,[res] - shl eax,2 - call :%pStoreMint - } - stringptrs[n] = res - return res - end function +function RawStringPtr(integer n) -- (based on IupRawStringPtr from pGUI.e) +-- +-- Returns a raw string pointer for s, somewhat like allocate_string(s), but using the existing memory. +-- NOTE: The return is only valid as long as the value passed as the parameter remains in existence. +-- +atom res + string s = strings[n] + #ilASM{ + mov eax,[s] + lea edi,[res] + shl eax,2 + call :%pStoreMint + } + stringptrs[n] = res + return res +end function - global procedure fixup() - var_mem = allocate(length(vars)*4) - mem_set(var_mem,0,length(vars)*4) - code_mem = allocate(length(code)) - poke(code_mem,code) - while chain!=0 do - integer this = chain - chain = code[this] - integer ftype = code[this+1] - integer id = code[this+2] - switch ftype do - case 1: -- vars - poke4(code_mem+this-1,var_mem+(id-1)*4) - case 2: -- strings - poke4(code_mem+this-1,RawStringPtr(id)) - case 3: -- builtins - poke4(code_mem+this-1,builtins[id]-(code_mem+this+3)) - end switch - end while - end procedure - - -- - -- demo\rosetta\Compiler\cgen.exw - -- ============================== - -- - -- Generates 32-bit machine code (see note in vm.exw) - -- - without js -- (machine code!) - include cgen.e +-- demo\rosetta\Compiler\cgen.exw +-- Generates 32-bit machine code (see note in vm.exw) +without js -- (machine code!) +include cgen.e - function get_var_name(atom addr) - integer n = (addr-var_mem)/4+1 - if n<1 or n>length(vars) then ?9/0 end if - return vars[n] - end function +function get_var_name(atom addr) + integer n = (addr-var_mem)/4+1 + if n<1 or n>length(vars) then ?9/0 end if + return vars[n] +end function - function hxl(integer pc, object oh, string fmt, sequence args={}) - -- helper routine to display the octal/hex bytes just decoded, - -- along with the code offset and the human-readable text. - if length(args) then fmt = sprintf(fmt,args) end if - sequence octhex = {} - atom base = code_mem+pc - integer len = 0 - if integer(oh) then -- all octal - for i=1 to oh do - octhex = append(octhex,sprintf("0o%03o",peek(base))) - base += 1 - end for - len = oh - else -- some octal and some hex - for i=1 to length(oh) by 2 do - for j=1 to oh[i] do - octhex = append(octhex,sprintf("0o%03o",peek(base))) - base += 1 - end for - len += oh[i] - for j=1 to oh[i+1] do - octhex = append(octhex,sprintf("#%02x",peek(base))) - base += 1 - end for - len += oh[i+1] - end for - end if - printf(output_file,"%4d: %-30s %s\n",{pc+1,join(octhex,","),fmt}) - return len - end function +function hxl(integer pc, object oh, string fmt, sequence args={}) +-- helper routine to display the octal/hex bytes just decoded, +-- along with the code offset and the human-readable text. + if length(args) then fmt = sprintf(fmt,args) end if + sequence octhex = {} + atom base = code_mem+pc + integer len = 0 + if integer(oh) then -- all octal + for i=1 to oh do + octhex = append(octhex,sprintf("0o%03o",peek(base))) + base += 1 + end for + len = oh + else -- some octal and some hex + for i=1 to length(oh) by 2 do + for j=1 to oh[i] do + octhex = append(octhex,sprintf("0o%03o",peek(base))) + base += 1 + end for + len += oh[i] + for j=1 to oh[i+1] do + octhex = append(octhex,sprintf("#%02x",peek(base))) + base += 1 + end for + len += oh[i+1] + end for + end if + printf(output_file,"%4d: %-30s %s\n",{pc+1,join(octhex,","),fmt}) + return len +end function - constant cccodes = {"o?" ,"no?","b?" ,"ae?","z" ,"ne" ,"be?","a?", - -- 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , - "s?" ,"ns?","pe?","po?","l" ,"ge" ,"le" ,"g" } - -- 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 +constant cccodes = {"o?" ,"no?","b?" ,"ae?","z" ,"ne" ,"be?","a?", +-- 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , + "s?" ,"ns?","pe?","po?","l" ,"ge" ,"le" ,"g" } +-- 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 - constant regs = {"eax","ecx","edx"} -- (others as/when needed) +constant regs = {"eax","ecx","edx"} -- (others as/when needed) - procedure decode() - -- for a much more complete (and better organised) disassembler, see p2asm.e - integer pc = 0, -- nb 0-based - opcode, xrm +procedure decode() +-- for a much more complete (and better organised) disassembler, see p2asm.e +integer pc = 0, -- nb 0-based + opcode, xrm - while pc<length(code) do - opcode = peek(code_mem+pc) - xrm = -1 - switch opcode do - case 0o150: - atom vaddr = peek4s(code_mem+pc+1) - integer n = find(vaddr,stringptrs) - object arg = iff(n?enquote(strings[n]) - :sprintf("%d",vaddr)) - pc += hxl(pc,{1,4},"push %s",{arg}) - case 0o217: - case 0o377: - integer n = find(opcode,{0o217,0o377}) - string op = {"pop","push"}[n] - xrm = peek(code_mem+pc+1) - if n!=find(xrm,{0o005,0o065}) then exit end if - atom addr = peek4u(code_mem+pc+2) - pc += hxl(pc,{2,4},"%s [%s]",{op,get_var_name(addr)}) - case 0o061: - case 0o071: - case 0o205: - integer n = find(opcode,{0o061,0o071,0o205}) - string op = {"xor","cmp","test"}[n] - xrm = peek(code_mem+pc+1) - if and_bits(xrm,0o300)!=0o300 then exit end if - string r1 = regs[and_bits(xrm,0o070)/0o010+1] - string r2 = regs[and_bits(xrm,0o007)+1] - pc += hxl(pc,2,"%s %s,%s",{op,r1,r2}) - case 0o017: - xrm = peek(code_mem+pc+1) - switch xrm do - case 0o224: - case 0o225: - case 0o234: - case 0o235: - case 0o236: - case 0o237: - string cc = cccodes[and_bits(xrm,0o017)+1] - xrm = peek(code_mem+pc+2) - if xrm=0o300 then - pc += hxl(pc,3,"set%s al",{cc}) - elsif xrm=0o301 then - pc += hxl(pc,3,"set%s cl",{cc}) - else - exit - end if - case 0o204: - integer offset = peek4s(code_mem+pc+2) - pc += hxl(pc,{2,4},"jz %d",{pc+6+offset+1}) - else - exit - end switch - case 0o010: - case 0o040: - xrm = peek(code_mem+pc+1) - if xrm=0o310 then - string lop = {"or","and"}[find(opcode,{0o010,0o040})] - pc += hxl(pc,2,"%s al,cl",{lop}) - else - exit - end if - case 0o120: - case 0o122: - case 0o130: - case 0o131: - case 0o132: - string op = {"push","pop"}[find(and_bits(opcode,0o070),{0o020,0o030})] - string reg = regs[and_bits(opcode,0o007)+1] - pc += hxl(pc,1,"%s %s",{op,reg}) - case 0o231: - pc += hxl(pc,1,"cdq") - case 0o164: - case 0o353: - string jop = iff(opcode=0o164?"jz":"jmp") - integer offset = peek1s(code_mem+pc+1) - pc += hxl(pc,{1,1},"%s %d",{jop,pc+2+offset+1}) - case 0o351: - integer offset = peek4s(code_mem+pc+1) - pc += hxl(pc,{1,4},"jmp %d",{pc+5+offset+1}) - case 0o303: - pc += hxl(pc,1,"ret") - case 0o350: - integer offset = peek4s(code_mem+pc+1) - atom addr = offset+code_mem+pc+5 - integer n = find(addr,builtins) - pc += hxl(pc,{1,4},"call :%s",{builtin_names[n]}) - case 0o001: - case 0o041: - case 0o051: - integer n = find(opcode,{0o001,0o041,0o051}) - string op = {"add","and","sub"}[n] - xrm = peek(code_mem+pc+1) - switch xrm do - case 0o004: - if peek(code_mem+pc+2)=0o044 then - pc += hxl(pc,3,"%s [esp],eax",{op}) - else - exit - end if - else - exit - end switch - case 0o367: - xrm = peek(code_mem+pc+1) - if and_bits(xrm,0o300)!=0o300 then exit end if - integer n = find(and_bits(xrm,0o070),{0o030,0o040,0o070}) - if n=0 then exit end if - string op = {"neg","mul","idiv"}[n] - string reg = regs[and_bits(xrm,0o007)+1] - pc += hxl(pc,2,"%s %s",{op,reg}) - else - exit - end switch - end while - if pc<length(code) then - ?"incomplete:" - if xrm=-1 then - ?{pc+1,sprintf("0o%03o",opcode)} - else - ?{pc+1,sprintf("0o%03o 0o%03o",{opcode,xrm})} - end if - end if - end procedure + while pcprocedure main(sequence cl) - open_files(cl) - toks = lex() - object t = parse() - code_gen(t) - fixup() - decode() - free({var_mem,code_mem}) - close_files() - end procedure +procedure main(sequence cl) + open_files(cl) + toks = lex() + object t = parse() + code_gen(t) + fixup() + decode() + free({var_mem,code_mem}) + close_files() +end procedure - --main(command_line()) - main({0,0,"gcd.c"}) - - -- - -- demo\rosetta\Compiler\core.e - -- ============================ - -- - -- Standard declarations and routines used by lex.exw, parse.exw, cgen.exw, and interp.exw - -- (included in distribution as above, which contains some additional sanity checks) - -- - with javascript_semantics - global constant EOF = -1, STDIN = 0, STDOUT = 1 +-- demo\rosetta\Compiler\core.e +-- Standard declarations and routines used by lex.exw, parse.exw, cgen.exw, and interp.exw +-- (included in distribution as above, which contains some additional sanity checks) +with javascript_semantics +global constant EOF = -1, STDIN = 0, STDOUT = 1 - global enum NONE=0, UNARY=1, BINARY=2 - global type nary(integer n) return n=NONE or n=UNARY or n=BINARY end type +global enum NONE=0, UNARY=1, BINARY=2 +global type nary(integer n) return n=NONE or n=UNARY or n=BINARY end type - global sequence tkNames = {} -- eg/ie {"Op_multiply","Op_divide",..} - global sequence precedences = {} - global sequence narys = {} -- NONE/UNARY/BINARY - global sequence operators = {} -- eg/ie {"*","/","+","-","<","<=",..} - global sequence opcodes = {} -- idx to tkNames, matching operators +global sequence tkNames = {} -- eg/ie {"Op_multiply","Op_divide",..} +global sequence precedences = {} +global sequence narys = {} -- NONE/UNARY/BINARY +global sequence operators = {} -- eg/ie {"*","/","+","-","<","<=",..} +global sequence opcodes = {} -- idx to tkNames, matching operators - global constant KEYWORDS = new_dict() -- eg/ie {"if"=>idx to tkNames} +global constant KEYWORDS = new_dict() -- eg/ie {"if"=>idx to tkNames} - global enum OPERATOR=1, DIGIT, LETTER -- character classes +global enum OPERATOR=1, DIGIT, LETTER -- character classes - global sequence charmap = repeat(0,255) - charmap['0'..'9'] = DIGIT - charmap['A'..'Z'] = LETTER - charmap['a'..'z'] = LETTER - charmap['_'] = LETTER +global sequence charmap = repeat(0,255) + charmap['0'..'9'] = DIGIT + charmap['A'..'Z'] = LETTER + charmap['a'..'z'] = LETTER + charmap['_'] = LETTER - function tkName(string s, nary n = NONE, integer precedence = -1) - tkNames = append(tkNames,s) - narys = append(narys,n) - precedences = append(precedences,precedence) - return length(tkNames) - end function +function tkName(string s, nary n = NONE, integer precedence = -1) + tkNames = append(tkNames,s) + narys = append(narys,n) + precedences = append(precedences,precedence) + return length(tkNames) +end function - function tkOp(string s, string op, nary n, integer precedence) - integer res = tkName(s, n, precedence) - operators = append(operators,op) - opcodes = append(opcodes,res) - for i=1 to length(op) do - charmap[op[i]] = OPERATOR - end for - return res - end function +function tkOp(string s, string op, nary n, integer precedence) + integer res = tkName(s, n, precedence) + operators = append(operators,op) + opcodes = append(opcodes,res) + for i=1 to length(op) do + charmap[op[i]] = OPERATOR + end for + return res +end function - function tkKw(string s, string keyword) - integer res = tkName(s) - putd(keyword, res, KEYWORDS) - return res - end function +function tkKw(string s, string keyword) + integer res = tkName(s) + putd(keyword, res, KEYWORDS) + return res +end function - global constant - tk_EOI = tkName("End_of_input"), --1 - tk_mul = tkOp("Op_multiply", "*", BINARY,13), --2 - tk_div = tkOp("Op_divide", "/", BINARY,13), --3 - tk_mod = tkOp("Op_mod", "%", BINARY,13), --4 - tk_add = tkOp("Op_add", "+", BINARY,12), --5 - tk_sub = tkOp("Op_subtract", "-", BINARY,12), --6 - tk_neg = tkName("Op_negate", UNARY, 14), --7 - tk_not = tkOp("Op_not", "!", UNARY, 14), --8 - tk_lt = tkOp("Op_less", "<", BINARY,10), --9 - tk_le = tkOp("Op_lessequal", "<=",BINARY,10), --10 - tk_gt = tkOp("Op_greater", ">", BINARY,10), --11 - tk_ge = tkOp("Op_greaterequal", ">=",BINARY,10), --12 - tk_eq = tkOp("Op_equal", "==",BINARY, 9), --13 - tk_ne = tkOp("Op_notequal", "!=",BINARY, 9), --14 - tk_assign = tkOp("Op_assign", "=", NONE, -1), --15 - tk_and = tkOp("Op_and", "&&",BINARY, 5), --16 - tk_or = tkOp("Op_or", "||",BINARY, 4), --17 - tk_if = tkKw("Keyword_if", "if"), --18 - tk_else = tkKw("Keyword_else", "else"), --19 - tk_while = tkKw("Keyword_while","while"), --20 - tk_print = tkKw("Keyword_print","print"), --21 - tk_putc = tkKw("Keyword_putc", "putc"), --22 - tk_LeftParen = tkOp("LeftParen", "(", NONE, -1), --23 - tk_RightParen = tkOp("RightParen", ")", NONE, -1), --24 - tk_LeftBrace = tkOp("LeftBrace", "{", NONE, -1), --25 - tk_RightBrace = tkOp("RightBrace", "}", NONE, -1), --26 - tk_Semicolon = tkOp("Semicolon", ";", NONE, -1), --27 - tk_Comma = tkOp("Comma", ",", NONE, -1), --28 - tk_Identifier = tkName("Identifier"), --29 - tk_Integer = tkName("Integer"), --30 - tk_String = tkName("String"), --31 - tk_Sequence = tkName("Sequence"), --32 - tk_Prints = tkName("tk_Prints"), --33 - tk_Printi = tkName("tk_Printi") --34 +global constant + tk_EOI = tkName("End_of_input"), --1 + tk_mul = tkOp("Op_multiply", "*", BINARY,13), --2 + tk_div = tkOp("Op_divide", "/", BINARY,13), --3 + tk_mod = tkOp("Op_mod", "%", BINARY,13), --4 + tk_add = tkOp("Op_add", "+", BINARY,12), --5 + tk_sub = tkOp("Op_subtract", "-", BINARY,12), --6 + tk_neg = tkName("Op_negate", UNARY, 14), --7 + tk_not = tkOp("Op_not", "!", UNARY, 14), --8 + tk_lt = tkOp("Op_less", "<", BINARY,10), --9 + tk_le = tkOp("Op_lessequal", "<=",BINARY,10), --10 + tk_gt = tkOp("Op_greater", ">", BINARY,10), --11 + tk_ge = tkOp("Op_greaterequal", ">=",BINARY,10), --12 + tk_eq = tkOp("Op_equal", "==",BINARY, 9), --13 + tk_ne = tkOp("Op_notequal", "!=",BINARY, 9), --14 + tk_assign = tkOp("Op_assign", "=", NONE, -1), --15 + tk_and = tkOp("Op_and", "&&",BINARY, 5), --16 + tk_or = tkOp("Op_or", "||",BINARY, 4), --17 + tk_if = tkKw("Keyword_if", "if"), --18 + tk_else = tkKw("Keyword_else", "else"), --19 + tk_while = tkKw("Keyword_while","while"), --20 + tk_print = tkKw("Keyword_print","print"), --21 + tk_putc = tkKw("Keyword_putc", "putc"), --22 + tk_LeftParen = tkOp("LeftParen", "(", NONE, -1), --23 + tk_RightParen = tkOp("RightParen", ")", NONE, -1), --24 + tk_LeftBrace = tkOp("LeftBrace", "{", NONE, -1), --25 + tk_RightBrace = tkOp("RightBrace", "}", NONE, -1), --26 + tk_Semicolon = tkOp("Semicolon", ";", NONE, -1), --27 + tk_Comma = tkOp("Comma", ",", NONE, -1), --28 + tk_Identifier = tkName("Identifier"), --29 + tk_Integer = tkName("Integer"), --30 + tk_String = tkName("String"), --31 + tk_Sequence = tkName("Sequence"), --32 + tk_Prints = tkName("tk_Prints"), --33 + tk_Printi = tkName("tk_Printi") --34 - global integer input_file = STDIN, - output_file = STDOUT +global integer input_file = STDIN, + output_file = STDOUT - type strint(object o) - return string(o) or integer(o) - end type +type strint(object o) + return string(o) or integer(o) +end type - global strint tok_line, -- save of line/col at the start of - tok_col -- token/comment, for result/errors +global strint tok_line, -- save of line/col at the start of + tok_col -- token/comment, for result/errors - global object oneline = "" +global object oneline = "" - constant errfmt = "Line %s column %s:\n%s%s" +constant errfmt = "Line %s column %s:\n%s%s" - function errline() - oneline = substitute(trim(oneline,"\r\n"),'\t',' ') - string padding = repeat(' ',tok_col) - return sprintf("%s\n%s^ ",{oneline,padding}) - end function +function errline() + oneline = substitute(trim(oneline,"\r\n"),'\t',' ') + string padding = repeat(' ',tok_col) + return sprintf("%s\n%s^ ",{oneline,padding}) +end function - global procedure error(sequence msg, sequence args={}) - if length(args) then - msg = sprintf(msg,args) - end if - string el = iff(atom(oneline)?"":errline()) - if integer(tok_line) then tok_line = sprintf("%d",tok_line) end if - if integer(tok_col) then tok_col = sprintf("%d",tok_col) end if - printf(STDOUT,errfmt,{tok_line,tok_col,el,msg}) - {} = wait_key() - abort(1) - end procedure +global procedure error(sequence msg, sequence args={}) + if length(args) then + msg = sprintf(msg,args) + end if + string el = iff(atom(oneline)?"":errline()) + if integer(tok_line) then tok_line = sprintf("%d",tok_line) end if + if integer(tok_col) then tok_col = sprintf("%d",tok_col) end if + printf(STDOUT,errfmt,{tok_line,tok_col,el,msg}) + {} = wait_key() + abort(1) +end procedure - include js_io.e -- fake file i/o for running under pwa/p2js +include js_io.e -- fake file i/o for running under pwa/p2js - function open_file(string file_name, string mode) - integer fn = iff(platform()=JS?js_open(file_name) - :open(file_name, mode)) - if fn<=0 then - printf(STDOUT, "Could not open %s", {file_name}) - {} = wait_key() - abort(1) - end if - return fn - end function +function open_file(string file_name, string mode) + integer fn = iff(platform()=JS?js_open(file_name) + :open(file_name, mode)) + if fn<=0 then + printf(STDOUT, "Could not open %s", {file_name}) + {} = wait_key() + abort(1) + end if + return fn +end function - global procedure open_files(sequence cl) - if length(cl)>2 then - input_file = open_file(cl[3],"r") - if length(cl)>3 then - output_file = open_file(cl[4],"w") - end if - end if - end procedure +global procedure open_files(sequence cl) + if length(cl)>2 then + input_file = open_file(cl[3],"r") + if length(cl)>3 then + output_file = open_file(cl[4],"w") + end if + end if +end procedure - global procedure close_files() - if platform()!=JS then - if input_file!=STDIN then close(input_file) end if - if output_file!=STDOUT then close(output_file) end if - end if - end procedure +global procedure close_files() + if platform()!=JS then + if input_file!=STDIN then close(input_file) end if + if output_file!=STDOUT then close(output_file) end if + end if +end procedure - global function enquote(string s) - return sprintf(`"%s"`,substitute(s,"\n","\\n")) - end function +global function enquote(string s) + return sprintf(`"%s"`,substitute(s,"\n","\\n")) +end function - global function unquote(string s) - if s[1]!='\"' then ?9/0 end if - if s[$]!='\"' then ?9/0 end if - s = substitute(s[2..-2],"\\n","\n") - return s - end function - - -- - -- demo\rosetta\Compiler\js_io.e - -- ============================= - -- - -- Fake file i/o for running under pwa/p2js in a browser - -- Does not cover the human readable reload parts of extra.e - -- - with javascript_semantics - sequence {known_files,kfc} = columnize({ - {"test3.c",split(""" - /* - All lexical tokens - not syntactically correct, but that will - have to wait until syntax analysis - */ - /* Print */ print /* Sub */ - - /* Putc */ putc /* Lss */ < - /* If */ if /* Gtr */ > - /* Else */ else /* Leq */ <= - /* While */ while /* Geq */ >= - /* Lbrace */ { /* Eq */ == - /* Rbrace */ } /* Neq */ != - /* Lparen */ ( /* And */ && - /* Rparen */ ) /* Or */ || - /* Uminus */ - /* Semi */ ; - /* Not */ ! /* Comma */ , - /* Mul */ * /* Assign */ = - /* Div */ / /* Integer */ 42 - /* Mod */ % /* String */ "String literal" - /* Add */ + /* Ident */ variable_name - /* character literal */ '\n' - /* character literal **/ '\\' - /* character literal */ ' ' - ""","\n")}, - {"test4.c",split(""" - /*** test printing, embedded \n and comments with lots of '*' ***/ - print(42); - print("\nHello World\nGood Bye\nok\n"); - print("Print a slash n - \\n.\n"); - ""","\n")}, - {"primes.c",split(""" - /* - Simple prime number generator - */ - count = 1; - n = 1; - limit = 100; - while (n < limit) { - k=3; - p=1; - n=n+2; - while ((k*k<=n) && (p)) { - p=n/k*k!=n; - k=k+2; - } - if (p) { - print(n, " is prime\n"); - count = count + 1; - } - } - print("Total primes found: ", count, "\n"); - ""","\n")}, - {"gcd.c",split(""" - /* Compute the gcd of 1071, 1029: 21 */ +-- demo\rosetta\Compiler\js_io.e +-- Fake file i/o for running under pwa/p2js in a browser +-- Does not cover the human readable reload parts of extra.e +with javascript_semantics +sequence {known_files,kfc} = columnize({ +{"test3.c",split(` +/* + All lexical tokens - not syntactically correct, but that will + have to wait until syntax analysis + */ +/* Print */ print /* Sub */ - +/* Putc */ putc /* Lss */ < +/* If */ if /* Gtr */ > +/* Else */ else /* Leq */ <= +/* While */ while /* Geq */ >= +/* Lbrace */ { /* Eq */ == +/* Rbrace */ } /* Neq */ != +/* Lparen */ ( /* And */ && +/* Rparen */ ) /* Or */ || +/* Uminus */ - /* Semi */ ; +/* Not */ ! /* Comma */ , +/* Mul */ * /* Assign */ = +/* Div */ / /* Integer */ 42 +/* Mod */ % /* String */ "String literal" +/* Add */ + /* Ident */ variable_name +/* character literal */ '\n' +/* character literal **/ '\\' +/* character literal */ ' ' +`,"\n")}, +{"test4.c",split(` +/*** test printing, embedded \n and comments with lots of '*' ***/ +print(42); +print("\nHello World\nGood Bye\nok\n"); +print("Print a slash n - \\n.\n"); +`,"\n")}, +{"primes.c",split(` +/* + Simple prime number generator + */ +count = 1; +n = 1; +limit = 100; +while (n < limit) { + k=3; + p=1; + n=n+2; + while ((k*k<=n) && (p)) { + p=n/k*k!=n; + k=k+2; + } + if (p) { + print(n, " is prime\n"); + count = count + 1; + } +} +print("Total primes found: ", count, "\n"); +`,"\n")}, +{"gcd.c",split(` +/* Compute the gcd of 1071, 1029: 21 */ - a = 1071; - b = 1029; +a = 1071; +b = 1029; - while (b != 0) { - new_a = b; - b = a % b; - a = new_a; - } - print(a); - ""","\n")}, - {"Header.h",split(""" - #define area(h, w) h * w - ""","\n")}, - {"Source.t",split(""" - #include "Header.h" - #define width 5 - #define height 6 - area = #area(height, width)#; - ""","\n")}}) +while (b != 0) { + new_a = b; + b = a % b; + a = new_a; +} +print(a); +`,"\n")}, +{"Header.h",split(` +#define area(h, w) h * w +`,"\n")}, +{"Source.t",split(` +#include "Header.h" +#define width 5 +#define height 6 +area = #area(height, width)#; +`,"\n")}}) - sequence linenos = repeat(-1,length(known_files)) +sequence linenos = repeat(-1,length(known_files)) - global function js_open(string filename) - integer fn = find(filename,known_files) - assert(fn!=0) - linenos[fn] = 0 - return fn - end function +global function js_open(string filename) + integer fn = find(filename,known_files) + assert(fn!=0) + linenos[fn] = 0 + return fn +end function - global function js_gets(integer fn) - integer lineno = linenos[fn]+1 - if lineno<=length(kfc[fn]) then - linenos[fn] = lineno - return kfc[fn][lineno] - end if - return EOF - end function - - -- - -- demo\\rosetta\\Compiler\\lex.e - -- ============================== - -- - -- The reusable part of lex.exw - -- This is only kept separate from core.e for consistency with later modules. +-- demo\\rosetta\\Compiler\\lex.e +-- The reusable part of lex.exw +-- This is only kept separate from core.e for consistency with later modules. +with javascript_semantics +include core.e - with javascript_semantics - include core.e +integer ch = ' ', + line = 0, + col = 0 - integer ch = ' ', - line = 0, - col = 0 +procedure eof(string s) + error("%s in %s literal",{iff(ch=EOF?"EOF":"EOL"),s}) +end procedure - procedure eof(string s) - error("%s in %s literal",{iff(ch=EOF?"EOF":"EOL"),s}) - end procedure +function next_ch() + while 1 do + col += 1 + if oneline=EOF then + ch = EOF + exit + elsif col>length(oneline) then + line += 1 + col = 0 + oneline = iff(platform()=JS?js_gets(input_file) + :gets(input_file)) + else + ch = oneline[col] + exit + end if + end while + return ch +end function - function next_ch() - while 1 do - col += 1 - if oneline=EOF then - ch = EOF - exit - elsif col>length(oneline) then - line += 1 - col = 0 - oneline = iff(platform()=JS?js_gets(input_file) - :gets(input_file)) - else - ch = oneline[col] - exit - end if - end while - return ch - end function +-- for pwa/p2js (JavaScript *really* dislikes tabs in strings): +--constant whitespace = " \t\r\n\x0B\xA0" +constant whitespace = {' ','\t','\r','\n',#0B,#A0} +-- (0x0B is Vertical Tab, 0xA0 is Non-breaking space) - -- for pwa/p2js (JavaScript *really* dislikes tabs in strings): - --constant whitespace = " \t\r\n\x0B\xA0" - constant whitespace = {' ','\t','\r','\n',#0B,#A0} - -- (0x0B is Vertical Tab, 0xA0 is Non-breaking space) +procedure skipspacesandcomments() + while 1 do + if not find(ch,whitespace) then + if ch='/' and colprocedure skipspacesandcomments() - while 1 do - if not find(ch,whitespace) then - if ch='/' and col<length(oneline) and oneline[col+1]='*' then - tok_line = line -- (in case of EOF error) - tok_col = col - ch = next_ch() -- (can be EOF) - ch = next_ch() -- ( "" ) - while 1 do - if ch='*' then - ch = next_ch() - if ch='/' then exit end if - elsif ch=EOF then - error("EOF in comment") - else - ch = next_ch() - end if - end while - else - exit - end if - end if - ch = next_ch() - end while - end procedure +function escape_char(string s) + ch = next_ch() -- (discard the '\\') + if ch='n' then + ch = '\n' + elsif ch='\\' then + ch = '\\' + elsif ch=EOF + or ch='\n' then + eof(s) + else + error(`unknown escape sequence \%c`, {ch}) + end if + return ch +end function - function escape_char(string s) - ch = next_ch() -- (discard the '\\') - if ch='n' then - ch = '\n' - elsif ch='\\' then - ch = '\\' - elsif ch=EOF - or ch='\n' then - eof(s) - else - error(`unknown escape sequence \%c`, {ch}) - end if - return ch - end function +function char_lit() + integer startch = ch, + res = next_ch() -- (skip opening quote, save res) + if ch=startch then + error("empty character constant") + elsif ch='\\' then + res = escape_char("character") + end if + ch = next_ch() + if ch=EOF + or ch='\n' then + eof("character") + elsif ch!=startch then + error("multi-character constant") + end if + ch = next_ch() + return {tk_Integer, res} +end function - function char_lit() - integer startch = ch, - res = next_ch() -- (skip opening quote, save res) - if ch=startch then - error("empty character constant") - elsif ch='\\' then - res = escape_char("character") - end if - ch = next_ch() - if ch=EOF - or ch='\n' then - eof("character") - elsif ch!=startch then - error("multi-character constant") - end if - ch = next_ch() - return {tk_Integer, res} - end function +function string_lit() + integer startch = ch + string text = "" + while next_ch()!=startch do + if ch=EOF + or ch='\n' then + eof("string") + elsif ch='\\' then + ch = escape_char("string") + end if + text &= ch + end while + ch = next_ch() + return {tk_String, text} +end function - function string_lit() - integer startch = ch - string text = "" - while next_ch()!=startch do - if ch=EOF - or ch='\n' then - eof("string") - elsif ch='\\' then - ch = escape_char("string") - end if - text &= ch - end while - ch = next_ch() - return {tk_String, text} - end function +function get_op() +-- sequence operator = {ch} + string operator = ""&ch + ch = next_ch() + while charmap[ch]=OPERATOR + and find(operator&ch,operators) do + -- (^ ie/eg merge ">=", but not ");") + operator &= ch + ch = next_ch() + end while + integer k = find(operator,operators) + if k=0 then error("unknown operator") end if + return {opcodes[k], 0} -- (0 unused) +end function - function get_op() - -- sequence operator = {ch} - string operator = ""&ch - ch = next_ch() - while charmap[ch]=OPERATOR - and find(operator&ch,operators) do - -- (^ ie/eg merge ">=", but not ");") - operator &= ch - ch = next_ch() - end while - integer k = find(operator,operators) - if k=0 then error("unknown operator") end if - return {opcodes[k], 0} -- (0 unused) - end function +function get_int() + integer i = 0 + while charmap[ch]=DIGIT do + i = i*10 + (ch-'0') + ch = next_ch() + end while + if charmap[ch]=LETTER then + error("invalid number") + end if + return {tk_Integer, i} +end function - function get_int() - integer i = 0 - while charmap[ch]=DIGIT do - i = i*10 + (ch-'0') - ch = next_ch() - end while - if charmap[ch]=LETTER then - error("invalid number") - end if - return {tk_Integer, i} - end function +function get_ident() + string text = "" + while find(charmap[ch],{LETTER,DIGIT}) do + text &= ch + ch = next_ch() + end while + integer keyword = getd(text,KEYWORDS) + if keyword!=NULL then + return {keyword, 0} -- (0 unused) + end if + return {tk_Identifier, text} +end function - function get_ident() - string text = "" - while find(charmap[ch],{LETTER,DIGIT}) do - text &= ch - ch = next_ch() - end while - integer keyword = getd(text,KEYWORDS) - if keyword!=NULL then - return {keyword, 0} -- (0 unused) - end if - return {tk_Identifier, text} - end function +function get_token() + skipspacesandcomments() + tok_line = line + tok_col = col + switch ch do + case EOF then return {tk_EOI, 0} -- (0 unused) + case '\'' then return char_lit() + case '"' then return string_lit() + else + switch charmap[ch] do + case OPERATOR then return get_op() + case DIGIT then return get_int() + case LETTER then return get_ident() + else error("unrecognized character: (%d)", {ch}) + end switch + end switch +end function - function get_token() - skipspacesandcomments() - tok_line = line - tok_col = col - switch ch do - case EOF then return {tk_EOI, 0} -- (0 unused) - case '\'' then return char_lit() - case '"' then return string_lit() - else - switch charmap[ch] do - case OPERATOR then return get_op() - case DIGIT then return get_int() - case LETTER then return get_ident() - else error("unrecognized character: (%d)", {ch}) - end switch - end switch - end function - - global function lex() - sequence toks = {} - integer tok = -1 - object v - while tok!=tk_EOI do - {tok,v} = get_token() - toks = append(toks,{tok_line,tok_col,tok,v}) - end while - return toks - end function - - -- - -- demo\rosetta\Compiler\extra.e - -- ============================= - -- - -- Routines to reload human-readable files (deviation from task requirement) - -- - without js -- (file i/o) +-- demo\rosetta\Compiler\extra.e +-- Routines to reload human-readable files (deviation from task requirement) +without js -- (file i/o) - --The following can be used to load .lex files, as created by lex.exw: - -- (in place of the existing get_tok() in parse.e) - function get_tok() - string line = trim(gets(input_file)) - sequence tok = split(line,' ',limit:=4,no_empty:=1) - integer k = find(tok[3],tkNames) - if k=0 then ?9/0 end if - tok[3] = k - return tok - end function +--The following can be used to load .lex files, as created by lex.exw: +-- (in place of the existing get_tok() in parse.e) +function get_tok() + string line = trim(gets(input_file)) + sequence tok = split(line,' ',limit:=4,no_empty:=1) + integer k = find(tok[3],tkNames) + if k=0 then ?9/0 end if + tok[3] = k + return tok +end function - --The following can be used to load .ast files, as created by parse.exw: - -- (in place of the existing lex()/parse() pairs in cgen.exw and interp.exw) - function load_ast() - string line = trim(gets(input_file)) - -- Each line has at least one token - sequence node = split(line,' ',limit:=2,no_empty:=1) +--The following can be used to load .ast files, as created by parse.exw: +-- (in place of the existing lex()/parse() pairs in cgen.exw and interp.exw) +function load_ast() + string line = trim(gets(input_file)) + -- Each line has at least one token + sequence node = split(line,' ',limit:=2,no_empty:=1) - string node_type = node[1] + string node_type = node[1] - if node_type == ";" then -- a terminal node - return NULL - end if + if node_type == ";" then -- a terminal node + return NULL + end if - integer n_type = find(node_type,tkNames) - if n_type=0 then ?9/0 end if + integer n_type = find(node_type,tkNames) + if n_type=0 then ?9/0 end if - -- A line with two tokens is a leaf node - -- Leaf nodes are: Identifier, Integer, String - -- The 2nd token is the value - if length(node)>1 then - node[1] = n_type - if n_type=tk_Integer then - node[2] = to_integer(node[2]) - elsif n_type=tk_String then - node[2] = unquote(node[2]) - end if - return node - end if - object left = load_ast() - object right = load_ast() - return {n_type, left, right} - end function - - -- - -- demo\rosetta\Compiler\lex.exw - -- ============================= - -- - with javascript_semantics - include lex.e +-- demo\rosetta\Compiler\lex.exw +with javascript_semantics +include lex.e - procedure main(sequence cl) - open_files(cl) - sequence toks = lex() - integer tok - object v - for i=1 to length(toks) do - {tok_line,tok_col,tok,v} = toks[i] - switch tok do - case tk_Identifier: v = sprintf(" %s",v) - case tk_Integer: v = sprintf(" %5d",v) - case tk_String: v = sprintf(" %s",enquote(v)) - else v = "" - end switch - printf(output_file, "%5d %5d %-10s%s\n", {tok_line,tok_col,tkNames[tok],v}) - end for - close_files() - end procedure +procedure main(sequence cl) + open_files(cl) + sequence toks = lex() + integer tok + object v + for i=1 to length(toks) do + {tok_line,tok_col,tok,v} = toks[i] + switch tok do + case tk_Identifier: v = sprintf(" %s",v) + case tk_Integer: v = sprintf(" %5d",v) + case tk_String: v = sprintf(" %s",enquote(v)) + else v = "" + end switch + printf(output_file, "%5d %5d %-10s%s\n", {tok_line,tok_col,tkNames[tok],v}) + end for + close_files() +end procedure - --main(command_line()) - main({0,0,"test4.c"}) - - -- - -- demo\rosetta\Compiler\parse.e - -- ============================= - -- - -- The reusable part of parse.exw - -- - with javascript_semantics - include lex.e +-- demo\rosetta\Compiler\parse.e +-- The reusable part of parse.exw +with javascript_semantics +include lex.e - sequence tok +sequence tok - procedure errd(sequence msg, sequence args={}) - {tok_line,tok_col} = tok - error(msg,args) - end procedure +procedure errd(sequence msg, sequence args={}) + {tok_line,tok_col} = tok + error(msg,args) +end procedure - global sequence toks - integer next_tok = 1 +global sequence toks +integer next_tok = 1 - function get_tok() - sequence tok = toks[next_tok] - next_tok += 1 - return tok - end function +function get_tok() + sequence tok = toks[next_tok] + next_tok += 1 + return tok +end function - procedure expect(string msg, integer s) - integer tk = tok[3] - if tk!=s then - errd("%s: Expecting '%s', found '%s'\n", {msg, tkNames[s], tkNames[tk]}) - end if - tok = get_tok() - end procedure +procedure expect(string msg, integer s) + integer tk = tok[3] + if tk!=s then + errd("%s: Expecting '%s', found '%s'\n", {msg, tkNames[s], tkNames[tk]}) + end if + tok = get_tok() +end procedure - function expr(integer p) - object x = NULL, node - integer op = tok[3] +function expr(integer p) + object x = NULL, node + integer op = tok[3] - switch op do - case tk_LeftParen: - tok = get_tok() - x = expr(0) - expect("expr",tk_RightParen) - case tk_sub: - case tk_add: - tok = get_tok() - node = expr(precedences[tk_neg]); - x = iff(op==tk_sub?{tk_neg, node, NULL}:node) - case tk_not: - tok = get_tok(); - x = {tk_not, expr(precedences[tk_not]), NULL} - case tk_Identifier: - x = {tk_Identifier, tok[4]} - tok = get_tok(); - case tk_Integer: - x = {tk_Integer, tok[4]} - tok = get_tok(); - default: - errd("Expecting a primary, found: %s\n", tkNames[op]) - end switch + switch op do + case tk_LeftParen: + tok = get_tok() + x = expr(0) + expect("expr",tk_RightParen) + case tk_sub: + case tk_add: + tok = get_tok() + node = expr(precedences[tk_neg]); + x = iff(op==tk_sub?{tk_neg, node, NULL}:node) + case tk_not: + tok = get_tok(); + x = {tk_not, expr(precedences[tk_not]), NULL} + case tk_Identifier: + x = {tk_Identifier, tok[4]} + tok = get_tok(); + case tk_Integer: + x = {tk_Integer, tok[4]} + tok = get_tok(); + default: + errd("Expecting a primary, found: %s\n", tkNames[op]) + end switch - op = tok[3] - while narys[op]=BINARY - and precedences[op]>=p do - tok = get_tok() - x = {op, x, expr(precedences[op]+1)} - op = tok[3] - end while - return x; - end function + op = tok[3] + while narys[op]=BINARY + and precedences[op]>=p do + tok = get_tok() + x = {op, x, expr(precedences[op]+1)} + op = tok[3] + end while + return x; +end function - function paren_expr(string msg) - expect(msg, tk_LeftParen); - object t = expr(0) - expect(msg, tk_RightParen); - return t - end function +function paren_expr(string msg) + expect(msg, tk_LeftParen); + object t = expr(0) + expect(msg, tk_RightParen); + return t +end function - function stmt() - object t = NULL, e, s +function stmt() + object t = NULL, e, s - switch tok[3] do - case tk_if: - tok = get_tok(); - object condition = paren_expr("If-cond"); - object ifblock = stmt(); - object elseblock = NULL; - if tok[3] == tk_else then - tok = get_tok(); - elseblock = stmt(); - end if - t = {tk_if, condition, {tk_if, ifblock, elseblock}} - case tk_putc: - tok = get_tok(); - e = paren_expr("Prtc") - t = {tk_putc, e, NULL} - expect("Putc", tk_Semicolon); - case tk_print: - tok = get_tok(); - expect("Print",tk_LeftParen) - while 1 do - if tok[3] == tk_String then - e = {tk_Prints, {tk_String, tok[4]}, NULL} - tok = get_tok(); - else - e = {tk_Printi, expr(0), NULL} - end if - t = {tk_Sequence, t, e} - if tok[3]!=tk_Comma then exit end if - expect("Print", tk_Comma) - end while - expect("Print", tk_RightParen); - expect("Print", tk_Semicolon); - case tk_Semicolon: - tok = get_tok(); - case tk_Identifier: - object v - v = {tk_Identifier, tok[4]} - tok = get_tok(); - expect("assign", tk_assign); - e = expr(0); - t = {tk_assign, v, e} - expect("assign", tk_Semicolon); - case tk_while: - tok = get_tok(); - e = paren_expr("while"); - s = stmt(); - t = {tk_while, e, s} - case tk_LeftBrace: /* {stmt} */ - expect("LeftBrace", tk_LeftBrace) - while not find(tok[3],{tk_RightBrace,tk_EOI}) do - t = {tk_Sequence, t, stmt()} - end while - expect("LeftBrace", tk_RightBrace); - break; - case tk_EOI: - break; - default: - errd("expecting start of statement, found '%s'\n", tkNames[tok[3]]); - end switch - return t - end function + switch tok[3] do + case tk_if: + tok = get_tok(); + object condition = paren_expr("If-cond"); + object ifblock = stmt(); + object elseblock = NULL; + if tok[3] == tk_else then + tok = get_tok(); + elseblock = stmt(); + end if + t = {tk_if, condition, {tk_if, ifblock, elseblock}} + case tk_putc: + tok = get_tok(); + e = paren_expr("Prtc") + t = {tk_putc, e, NULL} + expect("Putc", tk_Semicolon); + case tk_print: + tok = get_tok(); + expect("Print",tk_LeftParen) + while 1 do + if tok[3] == tk_String then + e = {tk_Prints, {tk_String, tok[4]}, NULL} + tok = get_tok(); + else + e = {tk_Printi, expr(0), NULL} + end if + t = {tk_Sequence, t, e} + if tok[3]!=tk_Comma then exit end if + expect("Print", tk_Comma) + end while + expect("Print", tk_RightParen); + expect("Print", tk_Semicolon); + case tk_Semicolon: + tok = get_tok(); + case tk_Identifier: + object v + v = {tk_Identifier, tok[4]} + tok = get_tok(); + expect("assign", tk_assign); + e = expr(0); + t = {tk_assign, v, e} + expect("assign", tk_Semicolon); + case tk_while: + tok = get_tok(); + e = paren_expr("while"); + s = stmt(); + t = {tk_while, e, s} + case tk_LeftBrace: /* {stmt} */ + expect("LeftBrace", tk_LeftBrace) + while not find(tok[3],{tk_RightBrace,tk_EOI}) do + t = {tk_Sequence, t, stmt()} + end while + expect("LeftBrace", tk_RightBrace); + break; + case tk_EOI: + break; + default: + errd("expecting start of statement, found '%s'\n", tkNames[tok[3]]); + end switch + return t +end function - global function parse() - object t = NULL - tok = get_tok() - while 1 do - object s = stmt() - if s=NULL then exit end if - t = {tk_Sequence, t, s} - end while - return t - end function - - -- - -- demo\rosetta\Compiler\parse.exw - -- =============================== - -- - with javascript_semantics - include parse.e +-- demo\rosetta\Compiler\parse.exw +with javascript_semantics +include parse.e - procedure print_ast(object t) - if t == NULL then - printf(output_file,";\n") - else - integer ttype = t[1] - printf(output_file,tkNames[ttype]) - if ttype=tk_Identifier then - printf(output_file," %s\n",t[2]) - elsif ttype=tk_Integer then - printf(output_file," %d\n",t[2]) - elsif ttype=tk_String then - printf(output_file," %s\n",enquote(t[2])) - else - printf(output_file,"\n") - print_ast(t[2]) - print_ast(t[3]) - end if - end if - end procedure +procedure print_ast(object t) + if t == NULL then + printf(output_file,";\n") + else + integer ttype = t[1] + printf(output_file,tkNames[ttype]) + if ttype=tk_Identifier then + printf(output_file," %s\n",t[2]) + elsif ttype=tk_Integer then + printf(output_file," %d\n",t[2]) + elsif ttype=tk_String then + printf(output_file," %s\n",enquote(t[2])) + else + printf(output_file,"\n") + print_ast(t[2]) + print_ast(t[3]) + end if + end if +end procedure - function ptree(object t) - if sequence(t) then - integer t1 = t[1] - t = deep_copy(t) - t[1] = tkNames[t1] - if not find(t1,{tk_Identifier,tk_String}) then - for i=2 to length(t) do - if t1=tk_Sequence and t[i]=NULL then - t[i] = "NULL" - else - t[i] = ptree(t[i]) - end if - end for - end if - end if - return t - end function +function ptree(object t) + if sequence(t) then + integer t1 = t[1] + t = deep_copy(t) + t[1] = tkNames[t1] + if not find(t1,{tk_Identifier,tk_String}) then + for i=2 to length(t) do + if t1=tk_Sequence and t[i]=NULL then + t[i] = "NULL" + else + t[i] = ptree(t[i]) + end if + end for + end if + end if + return t +end function - procedure main(sequence cl) - open_files(cl) - toks = lex() - object t = parse() - print_ast(t) - pp(ptree(t),{pp_Nest,10,pp_Pause,0,pp_IntCh,false}) - close_files() - end procedure +procedure main(sequence cl) + open_files(cl) + toks = lex() + object t = parse() + print_ast(t) +pp(ptree(t),{pp_Nest,10,pp_Pause,0,pp_IntCh,false}) + close_files() +end procedure - --main(command_line()) - main({0,0,"test3.c"}) -- not parseable! - --main({0,0,"primes.c"}) -- as Algol, C, Python (apart from spacing) - --main({0,0,"count.c"}) -- as AWK ( "" ) - - -- - -- demo\rosetta\Compiler\vm.exw - -- ============================ - -- - -- Since we have generated executable machine code, the virtual machine, such as it is, is just - -- the higher level implementations of printc/i/s, see setbuiltins() in cgen.e - -- Otherwise the only difference between this and cgen.exw is call(code_mem) instead of decode(). - -- - -- A quick test (calculating fib(44) 10^6 times) suggests ~500 times faster than interp.exw - - -- which is to be expected given that a single add instruction (1 clock) here is implemented as - -- at least three (and quite possibly five!) resursive calls to interp() in the other. +-- demo\rosetta\Compiler\vm.exw +-- Since we have generated executable machine code, the virtual machine, such as it is, is just +-- the higher level implementations of printc/i/s, see setbuiltins() in cgen.e +-- Otherwise the only difference between this and cgen.exw is call(code_mem) instead of decode(). +-- A quick test (calculating fib(44) 10^6 times) suggests ~500 times faster than interp.exw - +-- which is to be expected given that a single add instruction (1 clock) here is implemented as +-- at least three (and quite possibly five!) resursive calls to interp() in the other. +format PE32 +--format ELF32 +-- Note: cgen generates 32-bit machine code, which cannot be executed directly from a 64-bit interpreter. +-- You can however, via the magic of either the above format directives, use a 64-bit version of +-- Phix to compile this (just add a -c command line option) to a 32-bit executable, which can. +-- It would not be particularly difficult to emit 32 or 64 bit code, but some source code files +-- would, fairly obviously, then be very nearly twice as long, and a fair bit harder to read. +without js -- (machine code!) +include cgen.e - format PE32 - --format ELF32 - -- Note: cgen generates 32-bit machine code, which cannot be executed directly from a 64-bit interpreter. - -- You can however, via the magic of either the above format directives, use a 64-bit version of - -- Phix to compile this (just add a -c command line option) to a 32-bit executable, which can. - -- It would not be particularly difficult to emit 32 or 64 bit code, but some source code files - -- would, fairly obviously, then be very nearly twice as long, and a fair bit harder to read. +procedure main(sequence cl) + open_files(cl) + toks = lex() + object t = parse() + code_gen(t) + fixup() + if machine_bits()=32 then + -- ^ as per note above + call(code_mem) + end if + free({var_mem,code_mem}) + close_files() +end procedure - without js -- (machine code!) - include cgen.e - - procedure main(sequence cl) - open_files(cl) - toks = lex() - object t = parse() - code_gen(t) - fixup() - if machine_bits()=32 then - -- ^ as per note above - call(code_mem) - end if - free({var_mem,code_mem}) - close_files() - end procedure - - --main(command_line()) - main({0,0,"count.c"}) - - with javascript_semantics - integer count = 0, n = 11*11, - limit = iff(platform()=JS?10:20) - atom t0 = time(), t1 = time() - while count<limit do - if gcd(n,3*5*7)=1 then - sequence f = prime_factors(n,true,-1) - if length(f)>1 then - string s = sprintf("%d",n) - bool valid = true - for i=1 to length(f) do - if (i=1 or f[i]!=f[i-1]) - and not match(sprintf("%d",f[i]),s) then - valid = false - exit - end if - end for - if valid then - count += 1 - string t = join(apply(f,sprint),"x"), - e = elapsed(time()-t1) - printf(1,"%2d: %,10d = %-17s (%s)\n",{count,n,t,e}) - t1 = time() - end if - end if - end if - n += 2 - end while - printf(1,"Total time:%s\n",{elapsed(time()-t0)}) - - with javascript_semantics - integer count = 0, n = 11*11, - limit = iff(platform()=JS?10:20) - atom t0 = time(), t1 = time() - while count<limit do - string s = sprintf("%d",n) - integer l = floor(sqrt(n)), k = n, f = 3 - bool valid = true - while true do - if remainder(k,f)=0 then - if f<10 or not match(sprintf("%d",f),s) then - valid = false - exit - end if - if f=k then exit end if - k /= f - else - f += 2 - if f>l then - if k=n or not match(sprintf("%d",k),s) then - valid = false - end if - exit - end if - end if - end while - if valid then - count += 1; - string t = join(apply(prime_factors(n,true,-1),sprint),"x"), - e = elapsed(time()-t1) - printf(1,"%2d: %,10d = %-17s (%s)\n",{count,n,t,e}) - t1 = time() - end if - n += 2 - end while - printf(1,"Total time:%s\n",{elapsed(time()-t0)}) - - without js -- (threads) - procedure echo(string s) - sleep(rand(100)/100) - enter_cs() - puts(1,s) - puts(1,'\n') - leave_cs() - end procedure +without js -- (threads) +procedure echo(string s) + sleep(rand(100)/100) + enter_cs() + puts(1,s) + puts(1,'\n') + leave_cs() +end procedure - constant threads = {create_thread(routine_id("echo"),{"Enjoy"}), - create_thread(routine_id("echo"),{"Rosetta"}), - create_thread(routine_id("echo"),{"Code"})} +constant threads = {create_thread(routine_id("echo"),{"Enjoy"}), + create_thread(routine_id("echo"),{"Rosetta"}), + create_thread(routine_id("echo"),{"Code"})} - wait_thread(threads) - puts(1,"done") - {} = wait_key() - - with javascript_semantics - constant precision = 10000 +with javascript_semantics +constant precision = 10000 - function continued_fraction(integer f, steps=precision) - atom a, b, res = 0 - for n=steps to 1 by -1 do - {a, b} = f(n) - res := b / (a + res) - end for - {a} = f(0) - return a + res - end function +function continued_fraction(integer f, steps=precision) + atom a, b, res = 0 + for n=steps to 1 by -1 do + {a, b} = f(n) + res := b / (a + res) + end for + {a} = f(0) + return a + res +end function - function sqr2(integer n) return {iff(n=0?1:2),1} end function +function sqr2(integer n) return {iff(n=0?1:2),1} end function - function nap(integer n) return {iff(n=0?2:n),iff(n=1?1:n-1)} end function +function nap(integer n) return {iff(n=0?2:n),iff(n=1?1:n-1)} end function - function pi(integer n) return {iff(n=0?3:6),power(2*n-1,2)} end function +function pi(integer n) return {iff(n=0?3:6),power(2*n-1,2)} end function - printf(1,"Precision: %d\n", {precision}) - printf(1,"Sqr(2): %.10g\n", {continued_fraction(sqr2)}) - printf(1,"Napier: %.10g\n", {continued_fraction(nap)}) - printf(1,"Pi: %.10g\n", {continued_fraction(pi)}) - - with javascript_semantics - function decrat(string s) - integer nom = 0, - denom = 1 - assert(s[1..2]="0.") - for i=3 to length(s) do - integer ch = s[i] - assert(ch>='0' and ch<='9') - nom = nom*10 + ch-'0' - denom *= 10 - end for - return sq_div({nom,denom},gcd(nom,denom)) - end function +with javascript_semantics +function decrat(string s) + integer nom = 0, + denom = 1 + assert(s[1..2]="0.") + for i=3 to length(s) do + integer ch = s[i] + assert(ch>='0' and ch<='9') + nom = nom*10 + ch-'0' + denom *= 10 + end for + return sq_div({nom,denom},gcd(nom,denom)) +end function - ?decrat("0.9054054") - ?decrat("0.518518") - ?decrat("0.75") - - with javascript_semantics - ?elapsed(7259) - ?elapsed(86400) - ?elapsed(6000000) - - with javascript_semantics - include timedate.e - ?elapsed(6000000-timedelta(days:=6,hours:=10)) - ) + + [ dup 1 + [ 2dup > while + 1 >> 2dup / again ] + drop nip ] is sqrt ( n --> n ) + + [ stack ] is width ( --> s ) + + [ tuck witheach + [ over i^ peek + rot i^ poke swap ] + drop ] is add ( [ [ --> [ ) + + [ 1 split swap join ] is left ( [ --> [ ) + + [ -1 split swap join ] is right ( [ --> [ ) + + [ width share split swap join ] is up ( [ --> [ ) + + [ width share negate split swap join ] is down ( [ --> [ ) + + [ left dup up tuck add + swap right tuck add + swap right tuck add + swap down tuck add + swap down tuck add + swap left tuck add + swap left add ] is neighbours ( [ --> [ ) + + [ [] swap + width share times + [ width share split + dip [ 0 swap 0 join join join ] ] + drop + 2 width tally + 0 width share of tuck join join ] is makeborder ( [ --> [ ) + + [ dup size times + [ 0 swap i^ poke + 0 swap i^ width share + 1 - poke + width share step ] + width share times + [ 0 swap i^ poke + 0 swap i^ 1 + negate poke ] ] is clearborder ( [ --> [ ) + + [ dup neighbours + witheach + [ over i^ peek iff + [ 1 | 3 != if + [ 0 swap i^ poke ] ] + done + 3 = if [ 1 swap i^ poke ] ] + clearborder ] is nextgen ( [ --> [ ) + + [ 6 random + [ table + [ 200 200 255 ] [ 200 255 200 ] + [ 255 200 200 ] [ 200 255 255 ] + [ 255 200 255 ] [ 255 255 200 ] ] + fill + [ 4 times + [ 20 1 walk -1 4 turn ] ] ] is block ( --> ) + + + [ clear + width share 10 * + dup negate + 4 - 1 fly + -1 4 turn + 16 - 1 fly + 1 4 turn + 20 1 fly + ' [ 200 200 200 ] colour + 4 times + [ width share 2 - 20 * 1 walk + 1 4 turn ] + -20 1 fly + ' [ 63 63 63 ] colour + width share times + [ width share split + swap witheach + [ if block + 20 1 fly ] + width share -20 * 1 fly + 1 4 turn + 20 1 fly + -1 4 turn ] + drop wait frame ] is draw ( [ --> ) + + [ turtle 0 frames 2 wide + dup size sqrt width put + makeborder + dup + [ dup draw nextgen + dip [ nextgen nextgen ] + 2dup = until ] + 5 times + [ dup draw nextgen 2dup = until ] + 2drop width release ] is life ( [ --> ) + + ' [ 0 0 0 + 1 1 1 + 0 0 0 ] life ( task requirement ) + + ' [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 1 1 1 1 1 0 1 1 1 1 1 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] life ( more interesting ) + + randomise + [ [] + 1089 times + [ 2 random join ] + life + again ] ( ... runs forever ) diff --git a/Task/Conways-Game-of-Life/Rebol/conways-game-of-life.rebol b/Task/Conways-Game-of-Life/Rebol/conways-game-of-life.rebol new file mode 100644 index 0000000000..081d04e55e --- /dev/null +++ b/Task/Conways-Game-of-Life/Rebol/conways-game-of-life.rebol @@ -0,0 +1,81 @@ +Rebol [ + title: "Rosetta code: Conway's Game of Life" + file: %Conway's_Game_of_Life.r3 + url: https://rosettacode.org/wiki/Conway%27s_Game_of_Life + note: "Based on Joe Smith's Red language implementation!" +] +conway: function/with [ + "Conway's Game of Life" + petri [block!] "Current grid (Petri dish) as a block of rows, each row a block of 0/1" + /display "Print the grid" +][ + if display [print-table petri] ;; optionally render current generation + new-petri: copy/deep petri ;; prepare next generation grid + repeat row length? petri [ ;; iterate rows + repeat col length? petri [ ;; iterate columns (assumes square grid; adjust if rectangular) + live-neigh: 0 ;; count of live neighbors + ;; Accumulate live neighbors using relative offsets; ignore out-of-bounds via try + foreach cell neigh [ + try [ + if petri/(:row + cell/1)/(:col + cell/2) = 1 [ + live-neigh: live-neigh + 1 + ] + ] + ] + ;; Apply Conway's Game of Life rules + switch petri/:row/:col [ + 1 [ ;; live cell + if any [live-neigh < 2 live-neigh > 3] [ + new-petri/:row/:col: 0 ;; underpopulation or overcrowding -> dies + ] + ] + 0 [ ;; dead cell + if live-neigh = 3 [ + new-petri/:row/:col: 1 ;; reproduction -> becomes alive + ] + ] + ] + ] + ] + ;; Replace current grid with the newly computed one (in-place update) + clear insert petri new-petri +][ + ;; Neighbor offsets: N, S, E, W, and four diagonals + neigh: [[0 1] [0 -1] [1 0] [-1 0] [1 1] [1 -1] [-1 1] [-1 -1]] + + ;; Render a binary grid using buffered terminal output, with simple ANSI escapes + print-table: function [table] [ + buf: clear "" ;; output buffer (reduces flicker) + append buf "^[[H^[[2J^[[3J^/" ;; clear screen and home cursor + foreach row table [ + append buf replace/all (replace/all to-string row "0" "_") "1" "#" + append buf LF + ] + print buf + wait 0.2 ;; small delay for animation pacing + table + ] +] + +;- DEMO: + +*3-3: [ ;; a 3x3 blinker oscillator + [0 1 0] + [0 1 0] + [0 1 0] +] +*8-8: [ ;; an 8x8 glider pattern (top-left) + [0 0 1 0 0 0 0 0] + [0 0 0 1 0 0 0 0] + [0 1 1 1 0 0 0 0] + [0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0] +] + +print "^[[?25l" ;; hide cursor for animation +loop 10 [ conway/display *3-3 ] ;; run 10 generations of the blinker +loop 23 [ conway/display *8-8 ] ;; run 23 generations of the glider +print "^[[?25h" ;; show cursor after animation diff --git a/Task/Conways-Game-of-Life/Red/conways-game-of-life-1.red b/Task/Conways-Game-of-Life/Red/conways-game-of-life-1.red new file mode 100644 index 0000000000..60c6fb2278 --- /dev/null +++ b/Task/Conways-Game-of-Life/Red/conways-game-of-life-1.red @@ -0,0 +1,56 @@ +Red [ + Purpose: "Conway's Game of Life" + Author: "Joe Smith" +] + +neigh: [[0 1] [0 -1] [1 0] [-1 0] [1 1] [1 -1] [-1 1] [-1 -1]] +conway: function [petri] [ + new-petri: copy/deep petri + repeat row length? petri [ + repeat col length? petri [ + live-neigh: 0 + foreach cell neigh [ + try [ + if petri/(:row + cell/1)/(:col + cell/2) = 1 [live-neigh: live-neigh + 1] + ] + ] + switch petri/:row/:col [ + 1 [if any [live-neigh < 2 live-neigh > 3] + [new-petri/:row/:col: 0] + ] + 0 [if live-neigh = 3 [new-petri/:row/:col: 1]] + ]]] + clear insert petri new-petri +] + +*3-3: [ + [0 1 0] + [0 1 0] + [0 1 0] +] + +*8-8: [ + [0 0 1 0 0 0 0 0] + [0 0 0 1 0 0 0 0] + [0 1 1 1 0 0 0 0] + [0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0] +] + +display: function [table] [ + foreach row table [ + print replace/all (replace/all to-string row "0" "_") "1" "#" + ] print "" +] + +loop 5 [ + display *3-3 + conway *3-3 +] +loop 23 [ + display *8-8 + conway *8-8 +] diff --git a/Task/Conways-Game-of-Life/Red/conways-game-of-life-2.red b/Task/Conways-Game-of-Life/Red/conways-game-of-life-2.red new file mode 100644 index 0000000000..1b28ee8f37 --- /dev/null +++ b/Task/Conways-Game-of-Life/Red/conways-game-of-life-2.red @@ -0,0 +1,130 @@ +Red [ + title: "Conway's Game of Life (graphical view)" + author: "hinjolicious" + needs: 'view +] + +func-to-string: func [f][rejoin ["func [" form spec-of :f "] [" body-of :f "]"]] ; not used! + +PLOTTER: make object! [ + ; just some defaults: + display-size: 500x500 + x-range: [-4.0 4.0] y-range: [-4.0 4.0] + x1: -1.0 x2: 1.0 y1: -1.0 y2: 1.0 x-step: 0.01 + color: blue background-color: black line-size: 1 + fn: func [x][sin x] ; a function + draws: none + header: none + + ; Internal function to map a math coordinate (x,y) to a pixel pair (xp, yp) + MAP-TO-PIXELS: function [x y][ + xp: (x - x1) * (display-size/1 / (x2 - x1)) + ; Invert y because screen origin is top-left + yp: display-size/2 - ((y - y1) * (display-size/2 / (y2 - y1))) + as-point2D xp yp + ] + + DRAW: func [/local points x y][ + x-step: 0.01 + points: collect [ + x: x1 while [x <= x2][ + y: fn x + keep map-to-pixels x y + x: x + x-step] + ] + draws: compose [line-width (line-size) pen (color) line (points)] + ] + + SHOW: func [][ + if none? header [header: func-to-string :fn] + view/tight/flags [ + title header + canv: base display-size + background-color + draw draws + rate 100 ; for on-time func! + on-time [CHANGER] + [quit] ; mouse click = quit + ][no-border] + ] + + CHANGER: func[/local x y xy s n t][ + clear skip draws 5 ; clear display + ; display update and process next generation + repeat x xmax [ + repeat y ymax [ + s: mat/:x/:y ; current status? 1=live 0=dead + n: nb x y ; neigbours + + ; display current states with color indicators + color: case [ + all [s = 1 n < 2] [00.127.00] ; lonely + all [s = 1 n > 3] [127.00.00] ; crowded + s = 1 [00.127.00] ; n would be 2,3 --> stable + all [s = 0 n = 3] [00.00.127] ; new birth + true [black] ; barren + ] + xy: map-to-pixels x y + append draws compose [fill-pen (color) circle (xy) (rad)] + + ; process next generation + nxt/:x/:y: either any [ + all [mat/:x/:y = 1 n > 1 n < 4] ; lives on + all [mat/:x/:y = 0 n = 3] ; birth + ][1][0] + ] + ] + ; swap matrix + t: mat mat: nxt nxt: t + if (gen: gen + 1) > maxgen [init] + ] ; changer +] + +matrix-rand: func [a b][collect [loop a [keep/only collect [loop b [keep random/only [0 1]]]]]] +matrix-zero: func [a b][collect [loop a [keep/only collect [loop b [keep 0]]]]] + +; neighbour counting in a wrapped world! +nb: func [x y][ + xm1: x - 1 if xm1 < 1 [xm1: xmax] + xp1: x + 1 if xp1 > xmax [xp1: 1] + ym1: y - 1 if ym1 < 1 [ym1: ymax] + yp1: y + 1 if yp1 > ymax [yp1: 1] + mat/:xm1/:ym1 + mat/:xm1/:y + mat/:xm1/:yp1 + + mat/:x/:ym1 + mat/:x/:yp1 + + mat/:xp1/:ym1 + mat/:xp1/:y + mat/:xp1/:yp1 +] + +xmax: 100 ; number of cells, horiz +ymax: 100 ; vert +dispx: xmax * 10 ; display size for 10 pixels cell size +dispy: ymax * 10 ; vert +rad: 0 ; radial size for cells (calculated) + +; matrixes for generations: +mat: matrix-rand xmax ymax +nxt: matrix-zero xmax ymax + +; counters: +gen: 0 +maxgen: 500 + +init: does [ + mat: matrix-rand xmax ymax + nxt: matrix-zero xmax ymax + gen: 0 +] + +main: func [/local p][ + p: make plotter [] + p/header "Conway's Game of Life" + p/display-size: to-pair reduce [dispx dispy] ; display size regardless for x and y range + p/x1: 1 p/x2: xmax + p/y1: 1 p/y2: ymax + p/fn: func [x][x] ; dummy, not used + rad: (min (dispx / xmax) (dispy / ymax)) / 2 + p/draw ; generate drawing + p/draws/line-width: 0 + ;p/draws/pen: white + p/show ; display it +] +main diff --git a/Task/Conways-Game-of-Life/Red/conways-game-of-life.red b/Task/Conways-Game-of-Life/Red/conways-game-of-life.red deleted file mode 100644 index e72164f9bc..0000000000 --- a/Task/Conways-Game-of-Life/Red/conways-game-of-life.red +++ /dev/null @@ -1,56 +0,0 @@ -Red [ - Purpose: "Conway's Game of Life" - Author: "Joe Smith" -] - -neigh: [[0 1] [0 -1] [1 0] [-1 0] [1 1] [1 -1] [-1 1] [-1 -1]] -conway: function [petri] [ - new-petri: copy/deep petri - repeat row length? petri [ - repeat col length? petri [ - live-neigh: 0 - foreach cell neigh [ - try [ - if petri/(:row + cell/1)/(:col + cell/2) = 1 [live-neigh: live-neigh + 1] - ] - ] - switch petri/:row/:col [ - 1 [if any [live-neigh < 2 live-neigh > 3] - [new-petri/:row/:col: 0] - ] - 0 [if live-neigh = 3 [new-petri/:row/:col: 1]] - ]]] - clear insert petri new-petri -] - -*3-3: [ - [0 1 0] - [0 1 0] - [0 1 0] -] - -*8-8: [ - [0 0 1 0 0 0 0 0] - [0 0 0 1 0 0 0 0] - [0 1 1 1 0 0 0 0] - [0 0 0 0 0 0 0 0] - [0 0 0 0 0 0 0 0] - [0 0 0 0 0 0 0 0] - [0 0 0 0 0 0 0 0] - [0 0 0 0 0 0 0 0] -] - -display: function [table] [ - foreach row table [ - print replace/all (replace/all to-string row "0" "_") "1" "#" - ] print "" -] - -loop 5 [ - display *3-3 - conway *3-3 -] -loop 23 [ - display *8-8 - conway *8-8 -] diff --git a/Task/Conways-Game-of-Life/Rust/conways-game-of-life.rust b/Task/Conways-Game-of-Life/Rust/conways-game-of-life.rs similarity index 100% rename from Task/Conways-Game-of-Life/Rust/conways-game-of-life.rust rename to Task/Conways-Game-of-Life/Rust/conways-game-of-life.rs diff --git a/Task/Conways-Game-of-Life/Scheme/conways-game-of-life.ss b/Task/Conways-Game-of-Life/Scheme/conways-game-of-life-1.scm similarity index 100% rename from Task/Conways-Game-of-Life/Scheme/conways-game-of-life.ss rename to Task/Conways-Game-of-Life/Scheme/conways-game-of-life-1.scm diff --git a/Task/Conways-Game-of-Life/Scheme/conways-game-of-life-2.scm b/Task/Conways-Game-of-Life/Scheme/conways-game-of-life-2.scm new file mode 100644 index 0000000000..b692b693b0 --- /dev/null +++ b/Task/Conways-Game-of-Life/Scheme/conways-game-of-life-2.scm @@ -0,0 +1,62 @@ +(import (srfi 231)) + +(define (pad-array-with-zeros a N) + + ;; Pad two-dimensional array with N rows and columns of zeros, + ;; top and bottom, left and right. + ;; Assumes that the domain of a has zero lower bounds. + + (let* ((domain (array-domain a)) + (m (interval-upper-bound domain 0)) + (n (interval-upper-bound domain 1)) + (a_ (array-getter a))) + (make-array (interval-dilate domain (vector (- N) (- N)) (vector N N)) + (lambda (i j) + (or (and (< -1 i m) (< -1 j n) (a_ i j)) + 0))))) + +(define (neighbor-count a) + + ;; Returns a generalized array that contains the number + ;; of 1s in the 8 cells surrounding each cell in the original array. + + (let* ((big-a (array-copy! (pad-array-with-zeros a 1) + (array-storage-class a))) + (domain (array-domain a)) + (translates (map (lambda (translation) + (array-extract (array-translate big-a translation) domain)) + '(#(1 0) #(0 1) #(-1 0) #(0 -1) + #(1 1) #(1 -1) #(-1 1) #(-1 -1))))) + (apply array-map + translates))) + +(define (game-rules a neighbor-count) + + ;; a is the value in a single cell, neighbor-count is the count of 1s in + ;; its 8 neighboring cells. + + (if (zero? a) + (if (eqv? neighbor-count 3) 1 0) + (if (<= 2 neighbor-count 3) 1 0))) + +(define (advance a) + (array-copy! (array-map game-rules a (neighbor-count a)) + (array-storage-class a))) + +(define life-storage-class u1-storage-class) + +(define glider + (list*->array + 2 + '((0 0 0 0 0 0) + (0 0 1 0 0 0) + (0 0 0 1 0 0) + (0 1 1 1 0 0) + (0 0 0 0 0 0) + (0 0 0 0 0 0)) + life-storage-class)) + +(do ((i 0 (+ i 1)) + (pattern glider (advance pattern))) + ((= i 5)) + (pretty-print (array->list* pattern)) + (newline)) diff --git a/Task/Conways-Game-of-Life/SequenceL/conways-game-of-life-1.sequencel b/Task/Conways-Game-of-Life/SequenceL/conways-game-of-life-1.sequencel index 3307c338b7..f4b1ca088b 100644 --- a/Task/Conways-Game-of-Life/SequenceL/conways-game-of-life-1.sequencel +++ b/Task/Conways-Game-of-Life/SequenceL/conways-game-of-life-1.sequencel @@ -1,21 +1,21 @@ life(Cells(2))[I, J] := - let - numNeighbors := Cells[I-1,J-1] + Cells[I-1,J] + Cells[I-1,J+1] + - Cells[I,J-1] +/*current cell*/Cells[I,J+1] + - Cells[I+1,J-1] + Cells[I+1,J] + Cells[I+1,J+1]; - in - 0 when I=1 or J=1 or I=size(Cells) or J=size(Cells[I]) //On Border - else - 0 when numNeighbors < 2 or numNeighbors > 3 //Cell Dies - else - 1 when Cells[I,J] = 1 and numNeighbors = 2 or numNeighbors = 3 //Cell lives on or is born. - else - Cells[I,J]; //No Change - - + let + numNeighbors := Cells[I-1,J-1] + Cells[I-1,J] + Cells[I-1,J+1] + + Cells[I,J-1] +/*current cell*/Cells[I,J+1] + + Cells[I+1,J-1] + Cells[I+1,J] + Cells[I+1,J+1]; + in + 0 when I=1 or J=1 or I=size(Cells) or J=size(Cells[I]) //On Border + else + 0 when numNeighbors < 2 or numNeighbors > 3 //Cell Dies + else + 1 when Cells[I,J] = 1 and numNeighbors = 2 or numNeighbors = 3 //Cell lives on or is born. + else + Cells[I,J]; //No Change + + stressTestInput(n(0))[y,x] := - 0 when not y = n / 2 - else - 1 - foreach y within 1 ... n, - x within 1 ... n; + 0 when not y = n / 2 + else + 1 + foreach y within 1 ... n, + x within 1 ... n; diff --git a/Task/Conways-Game-of-Life/SequenceL/conways-game-of-life-2.sequencel b/Task/Conways-Game-of-Life/SequenceL/conways-game-of-life-2.sequencel index 5c10981d9f..54e33fabc0 100644 --- a/Task/Conways-Game-of-Life/SequenceL/conways-game-of-life-2.sequencel +++ b/Task/Conways-Game-of-Life/SequenceL/conways-game-of-life-2.sequencel @@ -17,150 +17,150 @@ std::string get_file_contents(const char*); int main(int argc, char ** argv) { - int cores = 0; - int maxSize = 700; + int cores = 0; + int maxSize = 700; - int drawSkip = 1; - int drawWait = 0; + int drawSkip = 1; + int drawWait = 0; - string inputFile = "test"; + string inputFile = "test"; - if(argc > 1) - { - inputFile = argv[1]; - } - if(argc > 2) - { - cores = atoi(argv[2]); - } + if(argc > 1) + { + inputFile = argv[1]; + } + if(argc > 2) + { + cores = atoi(argv[2]); + } - if(argc > 3) - { - maxSize = atoi(argv[3]); - } + if(argc > 3) + { + maxSize = atoi(argv[3]); + } - if(argc > 4) - { - drawSkip = atoi(argv[4]); + if(argc > 4) + { + drawSkip = atoi(argv[4]); - if(drawSkip < 0) - { - drawWait = abs(drawSkip); - drawSkip = 1; - } - } + if(drawSkip < 0) + { + drawWait = abs(drawSkip); + drawSkip = 1; + } + } - sl_init(cores); + sl_init(cores); - SLTimer drawTimer; + SLTimer drawTimer; - sprintf(titleBuffer, "Conway's Game of Life in SequenceL: %d Cores", cores); + sprintf(titleBuffer, "Conway's Game of Life in SequenceL: %d Cores", cores); - int width = 0; - int height = 0; + int width = 0; + int height = 0; - //Read input file-------------- - Sequence> initialGrid; + //Read input file-------------- + Sequence> initialGrid; - if(inputFile != "test") - { - stringstream ss(get_file_contents(inputFile.c_str())); - string stringItem; - vector elems; - char delim = ','; + if(inputFile != "test") + { + stringstream ss(get_file_contents(inputFile.c_str())); + string stringItem; + vector elems; + char delim = ','; - getline(ss, stringItem, delim); - width = atoi(stringItem.c_str()); - getline(ss, stringItem, delim); - height = atoi(stringItem.c_str()); + getline(ss, stringItem, delim); + width = atoi(stringItem.c_str()); + getline(ss, stringItem, delim); + height = atoi(stringItem.c_str()); - while(getline(ss, stringItem, delim)) - { - elems.push_back(atoi(stringItem.c_str())); - } + while(getline(ss, stringItem, delim)) + { + elems.push_back(atoi(stringItem.c_str())); + } - //Sequence Pointer Constructor---- - int gridDims[] = {height, width, 0}; - Sequence> tempGrid( (void*)&elems[0], gridDims); - initialGrid.hard_copy(tempGrid, 0); - //----------------------------- - } - else - { - width = maxSize; - height = maxSize; - sl_stressTestInput(maxSize, cores, initialGrid); - } - //-------- + //Sequence Pointer Constructor---- + int gridDims[] = {height, width, 0}; + Sequence> tempGrid( (void*)&elems[0], gridDims); + initialGrid.hard_copy(tempGrid, 0); + //----------------------------- + } + else + { + width = maxSize; + height = maxSize; + sl_stressTestInput(maxSize, cores, initialGrid); + } + //-------- - Sequence> result; + Sequence> result; - const unsigned char black[] = {0}; + const unsigned char black[] = {0}; - CImg visu(width * 4, height * 4, 1, 1, 0); - CImgDisplay draw_disp(visu, titleBuffer); - cout << "Conway's Game of Life in SequenceL" << endl << "Cores: " << cores << endl; + CImg visu(width * 4, height * 4, 1, 1, 0); + CImgDisplay draw_disp(visu, titleBuffer); + cout << "Conway's Game of Life in SequenceL" << endl << "Cores: " << cores << endl; - int generations = 0; - double compTime = 0; - double drawTime = 0; - SLTimer t; + int generations = 0; + double compTime = 0; + double drawTime = 0; + SLTimer t; - while(!draw_disp.is_closed()) - { - t.start(); - sl_life(initialGrid, cores, result); - generations++; - initialGrid.hard_copy(result, 0); - t.stop(); - compTime += t.getTime(); + while(!draw_disp.is_closed()) + { + t.start(); + sl_life(initialGrid, cores, result); + generations++; + initialGrid.hard_copy(result, 0); + t.stop(); + compTime += t.getTime(); - drawTimer.start(); + drawTimer.start(); - if(drawSkip > 0 && generations % drawSkip == 0) - { + if(drawSkip > 0 && generations % drawSkip == 0) + { - visu.fill(255); + visu.fill(255); - for(int i = 1; i <= result.size(); i++) - { - for(int j = 1; j <= result[i].size(); j++) - { - if(result[i][j] == 1) visu.draw_circle((j-1) * 4, (i - 1) * 4, 2, black, 1); - } - } + for(int i = 1; i <= result.size(); i++) + { + for(int j = 1; j <= result[i].size(); j++) + { + if(result[i][j] == 1) visu.draw_circle((j-1) * 4, (i - 1) * 4, 2, black, 1); + } + } - visu.display(draw_disp); + visu.display(draw_disp); - int drawWidth = maxSize; - int drawHeight = maxSize; + int drawWidth = maxSize; + int drawHeight = maxSize; - if(width < height) - { - drawWidth = ((double)drawHeight * ((double)width / (double)height)); - } - else - { - drawHeight = ((double)drawWidth * ((double)height / (double)width)); - } + if(width < height) + { + drawWidth = ((double)drawHeight * ((double)width / (double)height)); + } + else + { + drawHeight = ((double)drawWidth * ((double)height / (double)width)); + } - draw_disp.resize(drawWidth, drawHeight, false); + draw_disp.resize(drawWidth, drawHeight, false); - draw_disp.wait(drawWait); - drawTimer.stop(); - drawTime += drawTimer.getTime(); - } - } + draw_disp.wait(drawWait); + drawTimer.stop(); + drawTime += drawTimer.getTime(); + } + } - cout << "Total Generations: " << generations << endl; + cout << "Total Generations: " << generations << endl; - cout << "Average Compute Time: " << compTime / generations << " seconds" << endl; + cout << "Average Compute Time: " << compTime / generations << " seconds" << endl; - cout << "Average Draw Time: " << drawTime / generations << " seconds" << endl; + cout << "Average Draw Time: " << drawTime / generations << " seconds" << endl; - sl_done(); + sl_done(); - return 0; + return 0; } std::string get_file_contents(const char *filename) diff --git a/Task/Conways-Game-of-Life/Smalltalk/conways-game-of-life-2.st b/Task/Conways-Game-of-Life/Smalltalk/conways-game-of-life-2.st index 2819d03b89..444c414241 100644 --- a/Task/Conways-Game-of-Life/Smalltalk/conways-game-of-life-2.st +++ b/Task/Conways-Game-of-Life/Smalltalk/conways-game-of-life-2.st @@ -9,7 +9,7 @@ GameOfLife class>>withAliveCells: aCollectionOfCells ofSize: aBoardSize ^self new initializeWithAliveCells: aCollectionOfCells ofSize: aBoardSize GameOfLife class>>assertAll: aCollectionOfAliveCells areInside: aSize - | origin | + | origin | origin := 0@0. aCollectionOfAliveCells do: [:aCell | (aCell between: origin and: aSize) ifFalse: [ self error: 'Cell ', aCell printString,' out of range' ]] diff --git a/Task/Conways-Game-of-Life/Smalltalk/conways-game-of-life-4.st b/Task/Conways-Game-of-Life/Smalltalk/conways-game-of-life-4.st index dcdbda1181..aec636a5e2 100644 --- a/Task/Conways-Game-of-Life/Smalltalk/conways-game-of-life-4.st +++ b/Task/Conways-Game-of-Life/Smalltalk/conways-game-of-life-4.st @@ -12,7 +12,7 @@ GameOfLifeView class>>openFor: aGameOfLife GameOfLifeView class>>blinker ^GameOfLife withAliveCells: { 4@2. 4@3. 4@4. 3@3. 4@3. 5@3 } ofSize: 10@10 - + GameOfLifeView class>>toad ^GameOfLife withAliveCells: { 2@4. 3@4. 4@4. 3@3. 4@3. 5@3 } ofSize: 10@10 @@ -20,7 +20,7 @@ GameOfLifeView class>>openBlinker ^self openFor: self blinker GameOfLifeView class>>openToad - ^self openFor: self toad + ^self openFor: self toad initializeFor: aGameOfLife game := aGameOfLife. diff --git a/Task/Conways-Game-of-Life/Uiua/conways-game-of-life.uiua b/Task/Conways-Game-of-Life/Uiua/conways-game-of-life.uiua new file mode 100644 index 0000000000..fe9d89fede --- /dev/null +++ b/Task/Conways-Game-of-Life/Uiua/conways-game-of-life.uiua @@ -0,0 +1,4 @@ +Life ← ↥⊙↧∩=3⊃⋅∘⊙∘2⊸˜-/+≡↻♭₂-1⇡3_3⊸¤ +⁅×0.6 ≡₀⋅⚂ ↯⟜⊚ 50 # Init +⇌◌⍥(⟜⊂Life)300⟜¤ # Run +≡(▽⟜≡▽4) # Upscale diff --git a/Task/Conways-Game-of-Life/V-(Vlang)/conways-game-of-life.v b/Task/Conways-Game-of-Life/V-(Vlang)/conways-game-of-life.v index 5406961503..bb952499d4 100644 --- a/Task/Conways-Game-of-Life/V-(Vlang)/conways-game-of-life.v +++ b/Task/Conways-Game-of-Life/V-(Vlang)/conways-game-of-life.v @@ -4,95 +4,95 @@ import time struct Field { mut: - s [][]bool - w int - h int + s [][]bool + w int + h int } fn new_field(w int, h int) Field { - s := [][]bool{len: h, init: []bool{len: w}} - return Field{s, w, h} + s := [][]bool{len: h, init: []bool{len: w}} + return Field{s, w, h} } fn (mut f Field) set(x int, y int, b bool) { - f.s[y][x] = b + f.s[y][x] = b } fn (f Field) next(x int, y int) bool { - mut on := 0 - for i := -1; i <= 1; i++ { - for j := -1; j <= 1; j++ { - if f.state(x+i, y+j) && !(j == 0 && i == 0) { - on++ - } - } - } - return on == 3 || (on == 2 && f.state(x, y)) + mut on := 0 + for i := -1; i <= 1; i++ { + for j := -1; j <= 1; j++ { + if f.state(x+i, y+j) && !(j == 0 && i == 0) { + on++ + } + } + } + return on == 3 || (on == 2 && f.state(x, y)) } fn (f Field) state(xx int, yy int) bool { - mut x, mut y := xx, yy - for y < 0 { - y += f.h - } - for x < 0 { - x += f.w - } - return f.s[y%f.h][x%f.w] + mut x, mut y := xx, yy + for y < 0 { + y += f.h + } + for x < 0 { + x += f.w + } + return f.s[y%f.h][x%f.w] } struct Life { mut: - w int - h int - a Field - b Field + w int + h int + a Field + b Field } fn new_life(w int, h int) Life { - mut a := new_field(w, h) - for _ in 0..(w * h / 2) { - a.set(rand.intn(w) or {0}, rand.intn(h) or {0}, true) - } - return Life{ - a: a, - b: new_field(w, h), - w: w - h: h, - } + mut a := new_field(w, h) + for _ in 0..(w * h / 2) { + a.set(rand.intn(w) or {0}, rand.intn(h) or {0}, true) + } + return Life{ + a: a, + b: new_field(w, h), + w: w + h: h, + } } fn (mut l Life) step() { - for y in 0..l.h { - for x in 0.. l.w { - l.b.set(x, y, l.a.next(x, y)) - } - } - l.a, l.b = l.b, l.a + for y in 0..l.h { + for x in 0.. l.w { + l.b.set(x, y, l.a.next(x, y)) + } + } + l.a, l.b = l.b, l.a } fn (l Life) str() string { - mut buf := strings.new_builder(128) - for y in 0..l.h { - for x in 0..l.w { - mut b := ' ' - if l.a.state(x, y) { - b = '*' - } - buf.write_string(b) - } - buf.write_string('\n') - } - return buf.str() + mut buf := strings.new_builder(128) + for y in 0..l.h { + for x in 0..l.w { + mut b := ' ' + if l.a.state(x, y) { + b = '*' + } + buf.write_string(b) + } + buf.write_string('\n') + } + return buf.str() } fn main() { - mut l := new_life(80, 15) - for i := 0; i < 300; i++ { - l.step() - //println("------------------------------------------------") - print('\x0c') - println(l) - time.sleep(time.second / 30) - } + mut l := new_life(80, 15) + for i := 0; i < 300; i++ { + l.step() + //println("------------------------------------------------") + print('\x0c') + println(l) + time.sleep(time.second / 30) + } } diff --git a/Task/Conways-Game-of-Life/VBScript/conways-game-of-life-1.vb b/Task/Conways-Game-of-Life/VBScript/conways-game-of-life-1.vb deleted file mode 100644 index 3f97b566c7..0000000000 --- a/Task/Conways-Game-of-Life/VBScript/conways-game-of-life-1.vb +++ /dev/null @@ -1,85 +0,0 @@ -option explicit -const tlcr=3, tlcc=3 -const maxdim=15 - -dim a(15,15) -dim b(15,15) -dim ans0:ans0=chr(27)&"[" -dim gen,n - -erase a -'glider -a(0,1)=true:a(1,2)=true:a(2,0)=true:a(2,1)=true:a(2,2)=true -'blinker -a(3,13)=true:a(4,13)=true:a(5,13)=true -'beacon -a(11,1)=true:a(11,2)=true: a(12,1)=true:a(12,2)=true -a(13,3)=true:a(13,4)=true: a(14,3)=true:a(14,4)=true - -gen=0 -doframe - -do - display - wscript.sleep(100) - n=newgen -loop until n=0 -display - -sub cls() wscript.StdOut.Write ans0 &"2J"&ans0 &"?25l":end sub 'hide cursor too -sub toxy(r,c,s) wscript.StdOut.Write ans0 & r & ";" & c & "f" & s :end sub -function iif(a,b,c) if a then iif=b else iif=c end if :end function - -sub doframe - dim r,c,s - const frame="@" - cls - toxy 1,tlcc-1, "Conway's Game of Life" - toxy tlcr-1,tlcc-1,string(maxdim+3,frame) - s=frame&space(maxdim+1)&frame - for r=0 to maxdim - toxy tlcr+r,tlcc-1,s - next - toxy tlcr+maxdim+1,tlcc-1,string(maxdim+3,frame) -end sub - -sub display -dim r,c -const pix="#" -for r=0 to maxdim - for c=0 to maxdim - toxy tlcr+r,tlcc+c,iif (a(r,c),pix," ") - next -next -toxy tlcr+maxdim+2,tlcc-1,gen & " " & n -toxy tlcr+maxdim+3,tlcc-1,"" -gen=gen+1 -end sub - -function newgen - dim r,c,cnt,cp,cm,rp,rm - for r=0 to maxdim - for c=0 to maxdim - cp=(c+1) and maxdim 'wrap around - cm=(c-1) and maxdim - rp=(r+1) and maxdim - rm=(r-1) and maxdim - cnt=0 - cnt=- a(rp,cp) - a(rp,c) - a(rp,cm) 'true =-1 - cnt=cnt- a(r,cp)- a(r,cm) - cnt=cnt- a(rm,cp)- a(rm,c) - a(rm,cm) - - if a(r,c) then - b(r,c)=iif (cnt=2 or cnt=3,true,false) - else - b(r,c)=iif (cnt=3,true,false) - end if - next - next - for r=0 to maxdim - for c=0 to maxdim - a(r,c)=b(r,c) - newgen=newgen- b(r,c) - next - next -end function diff --git a/Task/Conways-Game-of-Life/VBScript/conways-game-of-life-1.vbs b/Task/Conways-Game-of-Life/VBScript/conways-game-of-life-1.vbs new file mode 100644 index 0000000000..66315d235d --- /dev/null +++ b/Task/Conways-Game-of-Life/VBScript/conways-game-of-life-1.vbs @@ -0,0 +1,85 @@ +option explicit +const tlcr=3, tlcc=3 +const maxdim=15 + +dim a(15,15) +dim b(15,15) +dim ans0:ans0=chr(27)&"[" +dim gen,n + +erase a +'glider +a(0,1)=true:a(1,2)=true:a(2,0)=true:a(2,1)=true:a(2,2)=true +'blinker +a(3,13)=true:a(4,13)=true:a(5,13)=true +'beacon +a(11,1)=true:a(11,2)=true: a(12,1)=true:a(12,2)=true +a(13,3)=true:a(13,4)=true: a(14,3)=true:a(14,4)=true + +gen=0 +doframe + +do + display + wscript.sleep(100) + n=newgen +loop until n=0 +display + +sub cls() wscript.StdOut.Write ans0 &"2J"&ans0 &"?25l":end sub 'hide cursor too +sub toxy(r,c,s) wscript.StdOut.Write ans0 & r & ";" & c & "f" & s :end sub +function iif(a,b,c) if a then iif=b else iif=c end if :end function + +sub doframe + dim r,c,s + const frame="@" + cls + toxy 1,tlcc-1, "Conway's Game of Life" + toxy tlcr-1,tlcc-1,string(maxdim+3,frame) + s=frame&space(maxdim+1)&frame + for r=0 to maxdim + toxy tlcr+r,tlcc-1,s + next + toxy tlcr+maxdim+1,tlcc-1,string(maxdim+3,frame) +end sub + +sub display +dim r,c +const pix="#" +for r=0 to maxdim + for c=0 to maxdim + toxy tlcr+r,tlcc+c,iif (a(r,c),pix," ") + next +next +toxy tlcr+maxdim+2,tlcc-1,gen & " " & n +toxy tlcr+maxdim+3,tlcc-1,"" +gen=gen+1 +end sub + +function newgen + dim r,c,cnt,cp,cm,rp,rm + for r=0 to maxdim + for c=0 to maxdim + cp=(c+1) and maxdim 'wrap around + cm=(c-1) and maxdim + rp=(r+1) and maxdim + rm=(r-1) and maxdim + cnt=0 + cnt=- a(rp,cp) - a(rp,c) - a(rp,cm) 'true =-1 + cnt=cnt- a(r,cp)- a(r,cm) + cnt=cnt- a(rm,cp)- a(rm,c) - a(rm,cm) + + if a(r,c) then + b(r,c)=iif (cnt=2 or cnt=3,true,false) + else + b(r,c)=iif (cnt=3,true,false) + end if + next + next + for r=0 to maxdim + for c=0 to maxdim + a(r,c)=b(r,c) + newgen=newgen- b(r,c) + next + next +end function diff --git a/Task/Conways-Game-of-Life/VBScript/conways-game-of-life-2.vb b/Task/Conways-Game-of-Life/VBScript/conways-game-of-life-2.vbs similarity index 100% rename from Task/Conways-Game-of-Life/VBScript/conways-game-of-life-2.vb rename to Task/Conways-Game-of-Life/VBScript/conways-game-of-life-2.vbs diff --git a/Task/Conways-Game-of-Life/Vedit-macro-language/conways-game-of-life.vedit b/Task/Conways-Game-of-Life/Vedit-macro-language/conways-game-of-life.vedit index c1f5784b3a..069dd75cfb 100644 --- a/Task/Conways-Game-of-Life/Vedit-macro-language/conways-game-of-life.vedit +++ b/Task/Conways-Game-of-Life/Vedit-macro-language/conways-game-of-life.vedit @@ -3,7 +3,7 @@ IT(".O.") IN IT(".O.") IN IT(".O.") -#9 = 2 // number of generations to calculate +#9 = 2 // number of generations to calculate #10 = Cur_Line #11 = Cur_Col-1 for (#2 = 1; #2 <= #9; #2++) { @@ -20,24 +20,24 @@ Return :calculate: Goto_Line(2) While (At_EOF == 0) { - Search("|A",ERRBREAK) // find next living cell + Search("|A",ERRBREAK) // find next living cell #3 = Cur_Line #4 = #7 = #8 = Cur_Col - if (#4 > 1) { // increment cell at left + if (#4 > 1) { // increment cell at left #7 = #4-1 Goto_Col(#7) Ins_Char(Cur_Char+1,OVERWRITE) } - if (#4 < #11) { // increment cell at right + if (#4 < #11) { // increment cell at right #8 = #4+1 Goto_Col(#8) Ins_Char(Cur_Char+1,OVERWRITE) } - if (#3 > 2) { // increment 3 cells above + if (#3 > 2) { // increment 3 cells above Goto_Line(#3-1) Call("inc_3") } - if (#3 < #10) { // increment 3 cells below + if (#3 < #10) { // increment 3 cells below Goto_Line(#3+1) Call("inc_3") } @@ -45,7 +45,7 @@ While (At_EOF == 0) { Goto_Col(#4+1) } -Replace("[1QR]", "O", REGEXP+BEGIN+ALL) // these cells alive +Replace("[1QR]", "O", REGEXP+BEGIN+ALL) // these cells alive Replace("[/-7P-X]", ".", REGEXP+BEGIN+ALL) // these cells dead Return diff --git a/Task/Conways-Game-of-Life/YAMLScript/conways-game-of-life.ys b/Task/Conways-Game-of-Life/YAMLScript/conways-game-of-life.ys new file mode 100644 index 0000000000..ae2f9357d5 --- /dev/null +++ b/Task/Conways-Game-of-Life/YAMLScript/conways-game-of-life.ys @@ -0,0 +1,42 @@ +!YS-v0 + +glider =: \{[1 0] [2 1] [0 2] [1 2] [2 2]} +blinker =: \{[1 2] [2 2] [3 2]} + +defn main(): + game-of-life 10 40: glider + +defn game-of-life(size steps cells): + loop s steps, cells cells: + shell:: clear + print-world: cells size + sleep: 0.25 + when 0 < s: + recur s.--: step(cells) + +defn print-world: + (cells): + print-world: cells 10 + + (cells size): + each y (0 .. size): + row =: + join: + for x (0 .. size): + cells([x y]).if('* ' ' ') + say: "| $row|" + +defn step(cells): + set: + ? for [cell count] + neighborhood.mapcat(cells):frequencies + :when ((3 == count) || + ((2 == count) && + cell.in?(cells))) + : cell + +defn neighborhood([x y]): + ? for dx [-1 0 1] + dy [-1 0 1] + :when [dx dy].ne([0 0]) + : vector: (x + dx) (y + dy) diff --git a/Task/Conways-Game-of-Life/Zig/conways-game-of-life.zig b/Task/Conways-Game-of-Life/Zig/conways-game-of-life.zig new file mode 100644 index 0000000000..524afe1ece --- /dev/null +++ b/Task/Conways-Game-of-Life/Zig/conways-game-of-life.zig @@ -0,0 +1,85 @@ +const std = @import("std"); +const mem = std.mem; + +pub fn main() !void { + // ---------------------------- pseudo random number generator + var prng = std.Random.DefaultPrng.init(blk: { + var seed: u64 = undefined; + std.posix.getrandom(mem.asBytes(&seed)) catch unreachable; + break :blk seed; + }); + const random = prng.random(); + // ---------------------------------------------------------- + const stdout = std.io.getStdOut(); + var bw = std.io.bufferedWriter(stdout.writer()); + const writer = bw.writer(); + // ---------------------------------------------------------- + var life = Life(80, 15).init(random); + for (0..300) |_| { + life.step(); + try writer.writeByte('\x0c'); + try writer.print("{}", .{life}); + try bw.flush(); + std.time.sleep(comptime (1_000_000_000 / 30)); // 1/30th second + } +} +fn Life(comptime w: usize, comptime h: usize) type { + return struct { + const Self = @This(); + a: Field(w, h), + b: Field(w, h), + + fn init(random: std.Random) Self { + var life = Self{ + .a = Field(w, h).init(), + .b = Field(w, h).init(), + }; + for (0..w * h / 2) |_| { + const x = random.uintLessThan(usize, w); + const y = random.uintLessThan(usize, h); + life.a.set(x, y, true); + } + return life; + } + fn step(self: *Self) void { + for (0..h) |y| + for (0..w) |x| + self.b.set(x, y, self.a.next(x, y)); + mem.swap(Field(w, h), &self.a, &self.b); + } + pub fn format(self: *const Self, comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void { + for (0..h) |y| { + for (0..w) |x| + try writer.writeByte(if (self.a.state(x, y)) '*' else ' '); + try writer.writeByte('\n'); + } + } + }; +} +fn Field(comptime w: usize, comptime h: usize) type { + return struct { + const Self = @This(); + s: std.StaticBitSet(w * h), + + fn init() Self { + return .{ .s = std.StaticBitSet(w * h).initEmpty() }; + } + fn set(self: *Self, x: usize, y: usize, b: bool) void { + self.s.setValue(y * w + x, b); + } + fn next(self: *const Self, x_: usize, y_: usize) bool { + var on: usize = 0; + // Use wraparound arithmetic, i.e. -% + inline for ([3]usize{ x_ -% 1, x_, x_ + 1 }) |x| + inline for ([3]usize{ y_ -% 1, y_, y_ + 1 }) |y| + if (self.state(x, y)) { + on += 1; + }; + return on == 3 or on == 2 and self.state(x_, y_); + } + fn state(self: *const Self, x: usize, y: usize) bool { + if (x >= w or y >= h) return false; + return self.s.isSet(y * w + x); + } + }; +} diff --git a/Task/Conways-Game-of-Life/Zkl/conways-game-of-life-1.zkl b/Task/Conways-Game-of-Life/Zkl/conways-game-of-life-1.zkl index da3f4350f4..73b0d9723d 100644 --- a/Task/Conways-Game-of-Life/Zkl/conways-game-of-life-1.zkl +++ b/Task/Conways-Game-of-Life/Zkl/conways-game-of-life-1.zkl @@ -3,7 +3,7 @@ class Life{ var N=n, cells=Data(n*n), tmp=Data(n*n), ds=T(T(-1,-1),T(-1,0),T(-1,1), T(0,-1),T(0,1), T(1,-1),T(1,0),T(1,1)); icells:=vm.arglist[1,*]; - (N*N).pump(Void,cells.append.fpM("1-",0)); // clear board + (N*N).pump(Void,cells.append.fpM("1-",0)); // clear board icells.pump(Void,Void.Read,fcn(row,col){ cells[row*N+col]=1 }); } fcn get(row,col){ diff --git a/Task/Conways-Game-of-Life/Zkl/conways-game-of-life-2.zkl b/Task/Conways-Game-of-Life/Zkl/conways-game-of-life-2.zkl index 7d59e7b5c2..ca7561ab4d 100644 --- a/Task/Conways-Game-of-Life/Zkl/conways-game-of-life-2.zkl +++ b/Task/Conways-Game-of-Life/Zkl/conways-game-of-life-2.zkl @@ -1,4 +1,4 @@ -cells:=Life(4, 0,1, 1,1, 2,1); // blinker +cells:=Life(4, 0,1, 1,1, 2,1); // blinker do(3){ cells.println("="*4); cells.cycle(); } cells:=Life(30, 0,1, 1,2, 2,0, 2,1, 2,2); // glider diff --git a/Task/Copy-a-string/68000-Assembly/copy-a-string-2.68000 b/Task/Copy-a-string/68000-Assembly/copy-a-string-2.68000 index 7f91645c39..10041191cb 100644 --- a/Task/Copy-a-string/68000-Assembly/copy-a-string-2.68000 +++ b/Task/Copy-a-string/68000-Assembly/copy-a-string-2.68000 @@ -7,10 +7,7 @@ LEA myString,A3 LEA StringRam,A4 CopyString: -MOVE.B (A3)+,D0 -MOVE.B D0,(A4)+ ;we could have used "MOVE.B (A3)+,(A4)+" but this makes it easier to check for the terminator. -BEQ Terminated -BRA CopyString +MOVE.B (A3)+,(A4)+ ;Copy one byte. +BNE CopyString ;Not zero, do more bytes. -Terminated: ;the null terminator is already stored along with the string itself, so we are done. ;program ends here. diff --git a/Task/Copy-a-string/ALGOL-W/copy-a-string.alg b/Task/Copy-a-string/ALGOL-W/copy-a-string.alg deleted file mode 100644 index 24bae16956..0000000000 --- a/Task/Copy-a-string/ALGOL-W/copy-a-string.alg +++ /dev/null @@ -1,9 +0,0 @@ -begin - % strings are (fixed length) values in algol W. Assignment makes a copy % - string(10) a, copyOfA; - a := "some text"; - copyOfA := a; - % assignment to a will not change copyOfA % - a := "new value"; - write( a, copyOfA ) -end. diff --git a/Task/Copy-a-string/Ada/copy-a-string-1.ada b/Task/Copy-a-string/Ada/copy-a-string-1.adb similarity index 100% rename from Task/Copy-a-string/Ada/copy-a-string-1.ada rename to Task/Copy-a-string/Ada/copy-a-string-1.adb diff --git a/Task/Copy-a-string/Ada/copy-a-string-2.ada b/Task/Copy-a-string/Ada/copy-a-string-2.adb similarity index 100% rename from Task/Copy-a-string/Ada/copy-a-string-2.ada rename to Task/Copy-a-string/Ada/copy-a-string-2.adb diff --git a/Task/Copy-a-string/Ada/copy-a-string-3.ada b/Task/Copy-a-string/Ada/copy-a-string-3.adb similarity index 100% rename from Task/Copy-a-string/Ada/copy-a-string-3.ada rename to Task/Copy-a-string/Ada/copy-a-string-3.adb diff --git a/Task/Copy-a-string/Ada/copy-a-string-4.ada b/Task/Copy-a-string/Ada/copy-a-string-4.adb similarity index 100% rename from Task/Copy-a-string/Ada/copy-a-string-4.ada rename to Task/Copy-a-string/Ada/copy-a-string-4.adb diff --git a/Task/Copy-a-string/BaCon/copy-a-string-1.bacon b/Task/Copy-a-string/Applesoft-BASIC/copy-a-string-4.basic similarity index 100% rename from Task/Copy-a-string/BaCon/copy-a-string-1.bacon rename to Task/Copy-a-string/Applesoft-BASIC/copy-a-string-4.basic diff --git a/Task/Copy-a-string/BaCon/copy-a-string-2.bacon b/Task/Copy-a-string/Applesoft-BASIC/copy-a-string-5.basic similarity index 100% rename from Task/Copy-a-string/BaCon/copy-a-string-2.bacon rename to Task/Copy-a-string/Applesoft-BASIC/copy-a-string-5.basic diff --git a/Task/Copy-a-string/ArkScript/copy-a-string.ark b/Task/Copy-a-string/ArkScript/copy-a-string.ark new file mode 100644 index 0000000000..4ceafe0b2d --- /dev/null +++ b/Task/Copy-a-string/ArkScript/copy-a-string.ark @@ -0,0 +1,7 @@ +(mut str "hello world") +(mut copy str) + +(set copy "clone destroyed") + +(print str) +(print copy) diff --git a/Task/Copy-a-string/Arturo/copy-a-string.arturo b/Task/Copy-a-string/Arturo/copy-a-string.arturo index 41cb6efd44..0001140d7d 100644 --- a/Task/Copy-a-string/Arturo/copy-a-string.arturo +++ b/Task/Copy-a-string/Arturo/copy-a-string.arturo @@ -1,4 +1,4 @@ -a: new "Hello" +a: "Hello" b: a ; reference the same string ; changing one string in-place diff --git a/Task/Copy-a-string/AutoIt/copy-a-string.autoit b/Task/Copy-a-string/AutoIt/copy-a-string.au3 similarity index 100% rename from Task/Copy-a-string/AutoIt/copy-a-string.autoit rename to Task/Copy-a-string/AutoIt/copy-a-string.au3 diff --git a/Task/Copy-a-string/Ballerina/copy-a-string.ballerina b/Task/Copy-a-string/Ballerina/copy-a-string.ballerina new file mode 100644 index 0000000000..ed5f916660 --- /dev/null +++ b/Task/Copy-a-string/Ballerina/copy-a-string.ballerina @@ -0,0 +1,7 @@ +import ballerina/io; + +public function main() { + string s = "ballerina"; + string t = s; + io:println(`Are s and t equal? ${t == s}`); +} diff --git a/Task/Copy-a-string/COBOL/copy-a-string.cobol b/Task/Copy-a-string/COBOL/copy-a-string.cob similarity index 100% rename from Task/Copy-a-string/COBOL/copy-a-string.cobol rename to Task/Copy-a-string/COBOL/copy-a-string.cob diff --git a/Task/Copy-a-string/Crystal/copy-a-string.crystal b/Task/Copy-a-string/Crystal/copy-a-string.cr similarity index 100% rename from Task/Copy-a-string/Crystal/copy-a-string.crystal rename to Task/Copy-a-string/Crystal/copy-a-string.cr diff --git a/Task/Copy-a-string/Delphi/copy-a-string.delphi b/Task/Copy-a-string/Delphi/copy-a-string.pas similarity index 100% rename from Task/Copy-a-string/Delphi/copy-a-string.delphi rename to Task/Copy-a-string/Delphi/copy-a-string.pas diff --git a/Task/Copy-a-string/DuckDB/copy-a-string.duckdb b/Task/Copy-a-string/DuckDB/copy-a-string.duckdb new file mode 100644 index 0000000000..b039bd2ade --- /dev/null +++ b/Task/Copy-a-string/DuckDB/copy-a-string.duckdb @@ -0,0 +1,40 @@ +D create or replace table t as (select 'This is a string' as s); + +D from t; +┌──────────────────┐ +│ s │ +│ varchar │ +├──────────────────┤ +│ This is a string │ +└──────────────────┘ + +# Now make two copies. +D create or replace table tt as (select s as s1, s as s2 from t); + +D from tt; +┌──────────────────┬──────────────────┐ +│ s1 │ s2 │ +│ varchar │ varchar │ +├──────────────────┼──────────────────┤ +│ This is a string │ This is a string │ +└──────────────────┴──────────────────┘ + +# Change s2 and then verify that s1 is unaltered +D UPDATE tt SET s2 = s2[1]; + +D from tt; +┌──────────────────┬─────────┐ +│ s1 │ s2 │ +│ varchar │ varchar │ +├──────────────────┼─────────┤ +│ This is a string │ T │ +└──────────────────┴─────────┘ + +# Check that s and s1 are also still equal +D select s = s1 from t positional join tt; +┌──────────┐ +│ (s = s1) │ +│ boolean │ +├──────────┤ +│ true │ +└──────────┘ diff --git a/Task/Copy-a-string/EMal/copy-a-string.emal b/Task/Copy-a-string/EMal/copy-a-string.emal index c7d403d343..81e78bf2e8 100644 --- a/Task/Copy-a-string/EMal/copy-a-string.emal +++ b/Task/Copy-a-string/EMal/copy-a-string.emal @@ -1,11 +1,10 @@ -text original = "Yellow world" -text ref = original # copying the reference -text copied = *original # copying the content -original[0] = "H" # texts are indexable and mutable -original[5] = "," +^|in EMal strings are mutable|^ +text original ← "Yellow world" +text ref ← original # copying the reference +text copied ← *original # copying the content +original[0] ← "H" # texts are indexable and mutable +original[5] ← "," ref.append("!") # texts are coercible and growable copied += "?" -^| - | original == ref == "Hello, world!" - | copied == "Yellow world?" - |^ +writeLine(original æ ref and original æ "Hello, world!") +writeLine(copied æ "Yellow world?") diff --git a/Task/Copy-a-string/EasyLang/copy-a-string.easy b/Task/Copy-a-string/EasyLang/copy-a-string.easy index dbe2fe3be1..17fa4c005b 100644 --- a/Task/Copy-a-string/EasyLang/copy-a-string.easy +++ b/Task/Copy-a-string/EasyLang/copy-a-string.easy @@ -1,3 +1,5 @@ a$ = "hello" b$ = a$ +a$ &= " a" +print a$ print b$ diff --git a/Task/Copy-a-string/Ed/copy-a-string.ed b/Task/Copy-a-string/Ed/copy-a-string.ed new file mode 100644 index 0000000000..a2732d422d --- /dev/null +++ b/Task/Copy-a-string/Ed/copy-a-string.ed @@ -0,0 +1 @@ +,t diff --git a/Task/Copy-a-string/Elixir/copy-a-string.elixir b/Task/Copy-a-string/Elixir/copy-a-string.ex similarity index 100% rename from Task/Copy-a-string/Elixir/copy-a-string.elixir rename to Task/Copy-a-string/Elixir/copy-a-string.ex diff --git a/Task/Copy-a-string/Emacs-Lisp/copy-a-string.l b/Task/Copy-a-string/Emacs-Lisp/copy-a-string.el similarity index 100% rename from Task/Copy-a-string/Emacs-Lisp/copy-a-string.l rename to Task/Copy-a-string/Emacs-Lisp/copy-a-string.el diff --git a/Task/Copy-a-string/Euphoria/copy-a-string.euphoria b/Task/Copy-a-string/Euphoria/copy-a-string.eu similarity index 100% rename from Task/Copy-a-string/Euphoria/copy-a-string.euphoria rename to Task/Copy-a-string/Euphoria/copy-a-string.eu diff --git a/Task/Copy-a-string/Extended-Color-BASIC/copy-a-string.basic b/Task/Copy-a-string/Extended-Color-BASIC/copy-a-string.basic new file mode 100644 index 0000000000..5f6527cb7a --- /dev/null +++ b/Task/Copy-a-string/Extended-Color-BASIC/copy-a-string.basic @@ -0,0 +1,7 @@ +10 A$ = "HELLO" +20 REM COPY CONTENTS OF A$ TO B$ +30 B$ = A$ +40 REM CHANGE CONTENTS OF A$ +50 A$ = "WORLD" +60 REM DISPLAY CONTENTS +70 PRINT A$, B$ diff --git a/Task/Copy-a-string/Gleam/copy-a-string.gleam b/Task/Copy-a-string/Gleam/copy-a-string.gleam new file mode 100644 index 0000000000..cfe412774e --- /dev/null +++ b/Task/Copy-a-string/Gleam/copy-a-string.gleam @@ -0,0 +1,2 @@ +let src = "Hello" +let dest = src diff --git a/Task/Copy-a-string/Julia/copy-a-string.julia b/Task/Copy-a-string/Julia/copy-a-string.jl similarity index 100% rename from Task/Copy-a-string/Julia/copy-a-string.julia rename to Task/Copy-a-string/Julia/copy-a-string.jl diff --git a/Task/Copy-a-string/Kotlin/copy-a-string.kotlin b/Task/Copy-a-string/Kotlin/copy-a-string.kts similarity index 100% rename from Task/Copy-a-string/Kotlin/copy-a-string.kotlin rename to Task/Copy-a-string/Kotlin/copy-a-string.kts diff --git a/Task/Copy-a-string/LOLCODE/copy-a-string.lol b/Task/Copy-a-string/LOLCODE/copy-a-string.lol new file mode 100644 index 0000000000..eaa7cf013b --- /dev/null +++ b/Task/Copy-a-string/LOLCODE/copy-a-string.lol @@ -0,0 +1,10 @@ +HAI 1.3 + + I HAS A FRANK ITZ "Hello," + I HAS A PAUL ITZ "World!" + VISIBLE FRANK " " PAUL + + FRANK R PAUL + VISIBLE FRANK " " PAUL + +KTHXBYE diff --git a/Task/Copy-a-string/OCaml/copy-a-string-1.ocaml b/Task/Copy-a-string/OCaml/copy-a-string-1.ml similarity index 100% rename from Task/Copy-a-string/OCaml/copy-a-string-1.ocaml rename to Task/Copy-a-string/OCaml/copy-a-string-1.ml diff --git a/Task/Copy-a-string/OCaml/copy-a-string-2.ocaml b/Task/Copy-a-string/OCaml/copy-a-string-2.ml similarity index 100% rename from Task/Copy-a-string/OCaml/copy-a-string-2.ocaml rename to Task/Copy-a-string/OCaml/copy-a-string-2.ml diff --git a/Task/Copy-a-string/OCaml/copy-a-string-3.ocaml b/Task/Copy-a-string/OCaml/copy-a-string-3.ml similarity index 100% rename from Task/Copy-a-string/OCaml/copy-a-string-3.ocaml rename to Task/Copy-a-string/OCaml/copy-a-string-3.ml diff --git a/Task/Copy-a-string/OCaml/copy-a-string-4.ocaml b/Task/Copy-a-string/OCaml/copy-a-string-4.ml similarity index 100% rename from Task/Copy-a-string/OCaml/copy-a-string-4.ocaml rename to Task/Copy-a-string/OCaml/copy-a-string-4.ml diff --git a/Task/Copy-a-string/OPL/copy-a-string.opl b/Task/Copy-a-string/OPL/copy-a-string.opl new file mode 100644 index 0000000000..db34e40a63 --- /dev/null +++ b/Task/Copy-a-string/OPL/copy-a-string.opl @@ -0,0 +1,8 @@ +PROC main: + LOCAL src$(6),dst$(5) + src$="Hello" + dst$=src$ + src$="world!" + PRINT dst$,src$ + GET +ENDP diff --git a/Task/Copy-a-string/Pascal/copy-a-string.pas b/Task/Copy-a-string/Pascal/copy-a-string.pas index 90fe98f704..6fc5be060c 100644 --- a/Task/Copy-a-string/Pascal/copy-a-string.pas +++ b/Task/Copy-a-string/Pascal/copy-a-string.pas @@ -1,28 +1,16 @@ -program in,out; - -type - - pString = ^string; - -var - - s1,s2 : string ; - pStr : pString ; - -begin - - /* direct copy */ - s1 := 'Now is the time for all good men to come to the aid of their party.' - s2 := s1 ; - - writeln(s1); - writeln(s2); - - /* By Reference */ - pStr := @s1 ; - writeln(pStr^); - - pStr := @s2 ; - writeln(pStr^); - -end; +program copyAString; + var + { The Extended Pascal `string` schema data type + is essentially a `packed array[1..capacity] of char`. } + source, destination: string(80); + begin + source := 'Hello world!'; + { In Pascal _whole_ array data type values can be copied by assignment. } + destination := source; + { Provided `source` is a _non-empty_ string value + you can copy in Extended Pascal sub-ranges _of_ _string_ types, too. + Note, the sub-range notation is not permitted for a `bindable` data type. } + destination := source[1..length(source)]; + { You can also employ Extended Pascal’s `writeStr` routine: } + writeStr(destination, source); + end. diff --git a/Task/Copy-a-string/PascalABC.NET/copy-a-string.pas b/Task/Copy-a-string/PascalABC.NET/copy-a-string.pas new file mode 100644 index 0000000000..92afc0925c --- /dev/null +++ b/Task/Copy-a-string/PascalABC.NET/copy-a-string.pas @@ -0,0 +1,4 @@ +begin + var s: string := 'Hello'; + var s1 := s; +end. diff --git a/Task/Copy-a-string/PowerShell/copy-a-string-1.psh b/Task/Copy-a-string/PowerShell/copy-a-string-1.ps1 similarity index 100% rename from Task/Copy-a-string/PowerShell/copy-a-string-1.psh rename to Task/Copy-a-string/PowerShell/copy-a-string-1.ps1 diff --git a/Task/Copy-a-string/PowerShell/copy-a-string-2.psh b/Task/Copy-a-string/PowerShell/copy-a-string-2.ps1 similarity index 100% rename from Task/Copy-a-string/PowerShell/copy-a-string-2.psh rename to Task/Copy-a-string/PowerShell/copy-a-string-2.ps1 diff --git a/Task/Copy-a-string/REXX/copy-a-string.rexx b/Task/Copy-a-string/REXX/copy-a-string.rexx index 6d7223de5c..9db0cf1336 100644 --- a/Task/Copy-a-string/REXX/copy-a-string.rexx +++ b/Task/Copy-a-string/REXX/copy-a-string.rexx @@ -1,2 +1,16 @@ -src = "this is a string" -dst = src +-- 8 Nov 2025 +include Setting + +say 'COPY A STRING' +say version +say +say 'Just assign the string variable to a new one.' +a='This is a string.' +b=a +say a b +c="This is also a string." +d=c +say d c +exit + +include Abend diff --git a/Task/Copy-a-string/REBOL/copy-a-string.rebol b/Task/Copy-a-string/Rebol/copy-a-string.rebol similarity index 98% rename from Task/Copy-a-string/REBOL/copy-a-string.rebol rename to Task/Copy-a-string/Rebol/copy-a-string.rebol index 07ad9d7e8b..02d96fc778 100644 --- a/Task/Copy-a-string/REBOL/copy-a-string.rebol +++ b/Task/Copy-a-string/Rebol/copy-a-string.rebol @@ -1,4 +1,4 @@ -REBOL [ +Rebol [ Title: "String Copy" URL: http://rosettacode.org/wiki/Copy_a_string ] diff --git a/Task/Copy-a-string/Rust/copy-a-string-1.rust b/Task/Copy-a-string/Rust/copy-a-string-1.rs similarity index 100% rename from Task/Copy-a-string/Rust/copy-a-string-1.rust rename to Task/Copy-a-string/Rust/copy-a-string-1.rs diff --git a/Task/Copy-a-string/Rust/copy-a-string-2.rust b/Task/Copy-a-string/Rust/copy-a-string-2.rs similarity index 100% rename from Task/Copy-a-string/Rust/copy-a-string-2.rust rename to Task/Copy-a-string/Rust/copy-a-string-2.rs diff --git a/Task/Copy-a-string/Rye/copy-a-string.rye b/Task/Copy-a-string/Rye/copy-a-string.rye new file mode 100644 index 0000000000..39ec8eac96 --- /dev/null +++ b/Task/Copy-a-string/Rye/copy-a-string.rye @@ -0,0 +1,8 @@ +str:: "Hello" +;Returns [String: Hello] +str2:: str +;Returns [String: Hello] +str:: "World" +;Returns [String: World] +str2 +;Returns [String: Hello] diff --git a/Task/Copy-a-string/S-BASIC/copy-a-string.basic b/Task/Copy-a-string/S-BASIC/copy-a-string.basic new file mode 100644 index 0000000000..81d04da265 --- /dev/null +++ b/Task/Copy-a-string/S-BASIC/copy-a-string.basic @@ -0,0 +1,23 @@ +var original, copy = string +based referenced = string +var strloc = integer + +rem - position referenced string on top of original string +location var strloc = original +base referenced at strloc + +original = "Hello, World" +copy = original + +print "Original : ", original +print "Copy : ", copy +print "Referenced: ", referenced +print + +original = "Goodbye, World" + +print "Original : ", original rem - changed +print "Copy : ", copy rem - unchanged +print "Referenced: ", referenced rem - changed + +end diff --git a/Task/Copy-a-string/Scheme/copy-a-string.ss b/Task/Copy-a-string/Scheme/copy-a-string.scm similarity index 100% rename from Task/Copy-a-string/Scheme/copy-a-string.ss rename to Task/Copy-a-string/Scheme/copy-a-string.scm diff --git a/Task/Copy-a-string/TAV/copy-a-string.tav b/Task/Copy-a-string/TAV/copy-a-string.tav new file mode 100644 index 0000000000..c885d727e1 --- /dev/null +++ b/Task/Copy-a-string/TAV/copy-a-string.tav @@ -0,0 +1,6 @@ + s =: "hello" + print s.Usecount + t =: s \ reference copy + print s.Usecount + u =: string (s _ 'x') clip upto -2 + print (quote u), u.Usecount, s.Usecount diff --git a/Task/Copy-a-string/Tcl/copy-a-string.tcl b/Task/Copy-a-string/Tcl/copy-a-string-1.tcl similarity index 100% rename from Task/Copy-a-string/Tcl/copy-a-string.tcl rename to Task/Copy-a-string/Tcl/copy-a-string-1.tcl diff --git a/Task/Copy-a-string/Tcl/copy-a-string-2.tcl b/Task/Copy-a-string/Tcl/copy-a-string-2.tcl new file mode 100644 index 0000000000..2b6c1980c5 --- /dev/null +++ b/Task/Copy-a-string/Tcl/copy-a-string-2.tcl @@ -0,0 +1,28 @@ +set A "a string" + +set B $A ; # B is a reference to the string + +Set C "$A" ; # a new string is created + +set D "This is $C" ; # the string bound to C is copied into a new string. + + +# the append command is internally optimized +# for adding to the end of a string or list +# as is string index for returning a letter + +# reverse a string +proc reverse {s} { + set len [string length $s] + set r "" + for { set i $len} { $i >= 0} {incr i -1} { + append r [string index $s $i] + } + return $r +} + +set a 12345 + +set b [reverse $a] + +puts stdout "b: $b" diff --git a/Task/Copy-a-string/Tcl/copy-a-string-3.tcl b/Task/Copy-a-string/Tcl/copy-a-string-3.tcl new file mode 100644 index 0000000000..cfbdcf9402 --- /dev/null +++ b/Task/Copy-a-string/Tcl/copy-a-string-3.tcl @@ -0,0 +1,4 @@ +# replace substrings in a string + +set rep [string map {"apple" "orange"} "I like apples."] +puts stdout $rep diff --git a/Task/Copy-a-string/Uiua/copy-a-string.uiua b/Task/Copy-a-string/Uiua/copy-a-string.uiua new file mode 100644 index 0000000000..be6db2389c --- /dev/null +++ b/Task/Copy-a-string/Uiua/copy-a-string.uiua @@ -0,0 +1,2 @@ +."hello" +first diff --git a/Task/Copy-a-string/Uxntal/copy-a-string.uxnatl b/Task/Copy-a-string/Uxntal/copy-a-string.uxnatl new file mode 100644 index 0000000000..0b7adb7b1a --- /dev/null +++ b/Task/Copy-a-string/Uxntal/copy-a-string.uxnatl @@ -0,0 +1,25 @@ +%\n { 0a } %\0 { 00 } + +|18 @Console/write + +|100 + +;str2 ;str1 copy-str +;str2 print-str + +BRK + +@copy/str ( dest* src* -: ) + STH2 + &loop + LDAkr STH2k STAr INC2 LDAkr STHr INC2r ?/loop + POP2 POP2r + JMP2r + +@print/str_ ( str* -: ) + LDAk .Console/write DEO + INC2 @print/str LDAk ?/str_ + POP2 JMP2r + +@str1 "Uxntal \n \0 +@str2 diff --git a/Task/Copy-stdin-to-stdout/Ada/copy-stdin-to-stdout.ada b/Task/Copy-stdin-to-stdout/Ada/copy-stdin-to-stdout.adb similarity index 100% rename from Task/Copy-stdin-to-stdout/Ada/copy-stdin-to-stdout.ada rename to Task/Copy-stdin-to-stdout/Ada/copy-stdin-to-stdout.adb diff --git a/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-1.bat b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-1.bat new file mode 100644 index 0000000000..c395545bf5 --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-1.bat @@ -0,0 +1 @@ +findstr ^^ diff --git a/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-2.bat b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-2.bat new file mode 100644 index 0000000000..4993fe87a3 --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-2.bat @@ -0,0 +1 @@ +findstr "^" diff --git a/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-3.bat b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-3.bat new file mode 100644 index 0000000000..b4d82224f4 --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-3.bat @@ -0,0 +1 @@ +findstr $ diff --git a/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-4.bat b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-4.bat new file mode 100644 index 0000000000..e45275e17e --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-4.bat @@ -0,0 +1 @@ +find/v "" diff --git a/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-5.bat b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-5.bat new file mode 100644 index 0000000000..ef49dd86a6 --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-5.bat @@ -0,0 +1 @@ +more diff --git a/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-6.bat b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-6.bat new file mode 100644 index 0000000000..6482121afa --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-6.bat @@ -0,0 +1 @@ +copy con[:] con[:] diff --git a/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-7.bat b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-7.bat new file mode 100644 index 0000000000..bd13d6aad4 --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-7.bat @@ -0,0 +1 @@ +type con[:] diff --git a/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-8.bat b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-8.bat new file mode 100644 index 0000000000..2cc3128981 --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Batch-File/copy-stdin-to-stdout-8.bat @@ -0,0 +1,2 @@ +@setlocal enabledelayedexpansion +@ -int main(){ - char c; - while ( (c=getchar()) != EOF ){ +int main() { + int c; + while ((c = getchar()) != EOF) { putchar(c); } return 0; diff --git a/Task/Copy-stdin-to-stdout/Crystal/copy-stdin-to-stdout.crystal b/Task/Copy-stdin-to-stdout/Crystal/copy-stdin-to-stdout.cr similarity index 100% rename from Task/Copy-stdin-to-stdout/Crystal/copy-stdin-to-stdout.crystal rename to Task/Copy-stdin-to-stdout/Crystal/copy-stdin-to-stdout.cr diff --git a/Task/Copy-stdin-to-stdout/Fortran/copy-stdin-to-stdout-1.f b/Task/Copy-stdin-to-stdout/Fortran/copy-stdin-to-stdout-1.f new file mode 100644 index 0000000000..892373388e --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Fortran/copy-stdin-to-stdout-1.f @@ -0,0 +1,20 @@ +! Copy stdin to stdout +! tested with GNU Fortran (Ubuntu 15.2.0-4ubuntu4) 15.2.0 on Kubuntu 25.10 +! uses non-standard function fget and gput, both are available in gfortran only. +! ------------------------------------------------------------------------------------------ +! +program cp + +implicit none + +character :: c ! The chcaracter to read +integer :: ios ! IO Status + + +do + ios = fget (c) ! gfortran only + if (ios .ne. 0) exit + call fput(c) ! gfortran only +end do + +end program cp diff --git a/Task/Copy-stdin-to-stdout/Fortran/copy-stdin-to-stdout-2.f b/Task/Copy-stdin-to-stdout/Fortran/copy-stdin-to-stdout-2.f new file mode 100644 index 0000000000..8a0d0d80df --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Fortran/copy-stdin-to-stdout-2.f @@ -0,0 +1,20 @@ +! Copy stdin to stdout +! tested with Intel ifx (IFX) 2025.2.1 20250806 on Kubuntu 25.10 +! +! can also be compiled with gfortran but fails at run-time because it cannot change the access parameter +! ------------------------------------------------------------------------------------------------------- +! +program cp +character :: c +integer:: ios + +open (unit=5, form='unformatted', access='stream', action ='read') +open (unit=6, form='unformatted', access='stream', action ='write') + +do + read (5, iostat=ios) c + if (ios .ne. 0) exit + write (6) c +end do + +end program cp diff --git a/Task/Copy-stdin-to-stdout/FutureBasic/copy-stdin-to-stdout.basic b/Task/Copy-stdin-to-stdout/FutureBasic/copy-stdin-to-stdout.basic new file mode 100644 index 0000000000..277e5331b6 --- /dev/null +++ b/Task/Copy-stdin-to-stdout/FutureBasic/copy-stdin-to-stdout.basic @@ -0,0 +1,13 @@ +// Create file handles for standard input and output +FileHandleRef stdIn = fn FileHandleWithStandardInput +FileHandleRef stdOut = fn FileHandleWithStandardOutput + +// Continuously read from standard input… +while (YES) + CFDataRef availableData = fn FileHandleAvailableData( stdIn ) + if ( fn DataLength( availableData ) == 0 ) + break // End of input + end if + // … and write to standard output + fn FileHandleWriteData( stdOut, availableData, NULL ) +wend diff --git a/Task/Copy-stdin-to-stdout/Icon/copy-stdin-to-stdout.icon b/Task/Copy-stdin-to-stdout/Icon/copy-stdin-to-stdout.icon new file mode 100644 index 0000000000..ceec19034b --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Icon/copy-stdin-to-stdout.icon @@ -0,0 +1,3 @@ +procedure main() + every write(!&input) +end diff --git a/Task/Copy-stdin-to-stdout/Java/copy-stdin-to-stdout.java b/Task/Copy-stdin-to-stdout/Java/copy-stdin-to-stdout-1.java similarity index 100% rename from Task/Copy-stdin-to-stdout/Java/copy-stdin-to-stdout.java rename to Task/Copy-stdin-to-stdout/Java/copy-stdin-to-stdout-1.java diff --git a/Task/Copy-stdin-to-stdout/Java/copy-stdin-to-stdout-2.java b/Task/Copy-stdin-to-stdout/Java/copy-stdin-to-stdout-2.java new file mode 100644 index 0000000000..df4b2adbe3 --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Java/copy-stdin-to-stdout-2.java @@ -0,0 +1,5 @@ +public class CopyStdinToStdout { + public static void main(String[] args) throws java.io.IOException { + System.in.transferTo(System.out); + } +} diff --git a/Task/Copy-stdin-to-stdout/Julia/copy-stdin-to-stdout.julia b/Task/Copy-stdin-to-stdout/Julia/copy-stdin-to-stdout.jl similarity index 100% rename from Task/Copy-stdin-to-stdout/Julia/copy-stdin-to-stdout.julia rename to Task/Copy-stdin-to-stdout/Julia/copy-stdin-to-stdout.jl diff --git a/Task/Copy-stdin-to-stdout/Kotlin/copy-stdin-to-stdout.kotlin b/Task/Copy-stdin-to-stdout/Kotlin/copy-stdin-to-stdout.kts similarity index 100% rename from Task/Copy-stdin-to-stdout/Kotlin/copy-stdin-to-stdout.kotlin rename to Task/Copy-stdin-to-stdout/Kotlin/copy-stdin-to-stdout.kts diff --git a/Task/Copy-stdin-to-stdout/OCaml/copy-stdin-to-stdout.ocaml b/Task/Copy-stdin-to-stdout/OCaml/copy-stdin-to-stdout.ml similarity index 100% rename from Task/Copy-stdin-to-stdout/OCaml/copy-stdin-to-stdout.ocaml rename to Task/Copy-stdin-to-stdout/OCaml/copy-stdin-to-stdout.ml diff --git a/Task/Copy-stdin-to-stdout/Oberon-07/copy-stdin-to-stdout.oberon b/Task/Copy-stdin-to-stdout/Oberon-07/copy-stdin-to-stdout.oberon new file mode 100644 index 0000000000..32bc3ee1b1 --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Oberon-07/copy-stdin-to-stdout.oberon @@ -0,0 +1,10 @@ +MODULE CopyStdinToStdout; + IMPORT In, Out; + VAR c : CHAR; +BEGIN + In.Char( c ); + WHILE In.Done DO + Out.Char( c ); + In.Char( c ) + END +END CopyStdinToStdout. diff --git a/Task/Copy-stdin-to-stdout/Objeck/copy-stdin-to-stdout.objeck b/Task/Copy-stdin-to-stdout/Objeck/copy-stdin-to-stdout.objeck new file mode 100644 index 0000000000..05e460ff31 --- /dev/null +++ b/Task/Copy-stdin-to-stdout/Objeck/copy-stdin-to-stdout.objeck @@ -0,0 +1,9 @@ +class StdInToOut { + function : Main(args : String[]) ~ Nil { + do { + input := System.IO.Console->ReadLine(); + System.IO.Console->PrintLine(input); + } + while(<>input->IsEmpty()); + } +} diff --git a/Task/Copy-stdin-to-stdout/PascalABC.NET/copy-stdin-to-stdout.pas b/Task/Copy-stdin-to-stdout/PascalABC.NET/copy-stdin-to-stdout.pas new file mode 100644 index 0000000000..1b297471d0 --- /dev/null +++ b/Task/Copy-stdin-to-stdout/PascalABC.NET/copy-stdin-to-stdout.pas @@ -0,0 +1,2 @@ +## +Console.OpenStandardInput().CopyTo(Console.OpenStandardOutput()); diff --git a/Task/Copy-stdin-to-stdout/Phix/copy-stdin-to-stdout.phix b/Task/Copy-stdin-to-stdout/Phix/copy-stdin-to-stdout.phix index 6d08a056ab..f1b2eaf38c 100644 --- a/Task/Copy-stdin-to-stdout/Phix/copy-stdin-to-stdout.phix +++ b/Task/Copy-stdin-to-stdout/Phix/copy-stdin-to-stdout.phix @@ -1,8 +1,6 @@ -(notonline)--> - without js - while true do - integer ch = wait_key() - if ch=#1B then exit end if - puts(1,ch) - end while - - with javascript_semantics - procedure factorise(integer n) - sequence res = prime_factors(n,true) - res = join(apply(res,sprint)," x ") - printf(1,"%2d: %s\n",{n,res}) - end procedure +with javascript_semantics +procedure factorise(integer n) + sequence res = prime_factors(n,true,-1) + printf(1,"%2d: %s\n",{n,join(res," x ",fmt:="%d")}) +end procedure - papply(tagset(10)&{2144,1000000000},factorise) - - sequence tests = {{"the three truths","th"}, - {"ababababab","abab"}, - {"ababababab","aba"}, - {"ababababab","ab"}, - {"ababababab","a"}, - {"ababababab",""}} - integer start, count - string test, substring - for i=1 to length(tests) do - start = 1 - count = 0 - {test, substring} = tests[i] - while 1 do - start = match(substring,test,start) - if start=0 then exit end if - start += length(substring) - count += 1 - end while - printf(1,"The string \"%s\" occurs as a non-overlapping substring %d times in \"%s\"\n",{substring,count,test}) - end for -') !Disclaiming responsibility... - INDEEP = 1 !Finishing the content of the header. - CALL HTML("") !Enough of that. - CALL HTML("") !A fresh line seems polite. - INDEEP = 2 !Its content follows.. - END SUBROUTINE HTMLSTART !Others will follow on. Hopefully, correctly. - SUBROUTINE HTMLSTOP !And hopefully, this will be a good closure. + CALL HTML('') !But said to be worthy. + CALL HTML(METAH//'Description" Content="'//DESC//'">') !Hopefully, helpful. + CALL HTML(METAH//'Generator" Content="'//I AM//'">') !I said. + CALL DATE_AND_TIME(DATE = D,TIME = T) !Not assignments, but attachments. + CALL HTML(METAH//'Created" Content="' !Convert the timestamp + 1 //D(1:4)//"-"//D(5:6)//"-"//D(7:8) !Into an international standard. + 2 //" "//T(1:2)//":"//T(3:4)//":"//T(5:10)//'">') !For date and time. + IF (LUSERCODE.GT.0) CALL HTML(METAH !Possibly, the user's code is known. + 1 //'Author" Content="'//USERCODE(1:LUSERCODE) !If so, reveal. + 2 //'"> ') !Disclaiming responsibility... + INDEEP = 1 !Finishing the content of the header. + CALL HTML("") !Enough of that. + CALL HTML("") !A fresh line seems polite. + INDEEP = 2 !Its content follows.. + END SUBROUTINE HTMLSTART !Others will follow on. Hopefully, correctly. + SUBROUTINE HTMLSTOP !And hopefully, this will be a good closure. Could be more sophisticated and track the stack via INDEEP+- and names, to enable a desperate close-off if INDEEP is not 2. - IF (INDEEP.NE.2) CALL ECART("Misclosure! InDeep not 2 but" !But, - 1 //I8FMT(INDEEP)) !It may not be. - INDEEP = 1 !Retreat to the first level. - CALL HTML("") !End the "body". - INDEEP = 0 !Retreat to the start level. - CALL HTML("") !End the whole thing. - END SUBROUTINE HTMLSTOP !Ah... + IF (INDEEP.NE.2) CALL ECART("Misclosure! InDeep not 2 but" !But, + 1 //I8FMT(INDEEP)) !It may not be. + INDEEP = 1 !Retreat to the first level. + CALL HTML("") !End the "body". + INDEEP = 0 !Retreat to the start level. + CALL HTML("") !End the whole thing. + END SUBROUTINE HTMLSTOP !Ah... - SUBROUTINE HTMLTSTART(B,SUMMARY) !Start a table. - INTEGER B !Border thickness. - CHARACTER*(*) SUMMARY !Some well-chosen words. - CALL HTML("') !Not displayed, but potentially used by non-display agencies... - INDEEP = INDEEP + 1 !Another level dug. + SUBROUTINE HTMLTSTART(B,SUMMARY) !Start a table. + INTEGER B !Border thickness. + CHARACTER*(*) SUMMARY !Some well-chosen words. + CALL HTML("
') !Not displayed, but potentially used by non-display agencies... + INDEEP = INDEEP + 1 !Another level dug. END SUBROUTINE HTMLTSTART!That part was easy. - SUBROUTINE HTMLTSTOP !And the ending is easy too. - INDEEP = INDEEP - 1 !Withdraw a level. - CALL HTML("
") !Hopefully, aligning. - END SUBROUTINE HTMLTSTOP !The bounds are easy. + SUBROUTINE HTMLTSTOP !And the ending is easy too. + INDEEP = INDEEP - 1 !Withdraw a level. + CALL HTML("") !Hopefully, aligning. + END SUBROUTINE HTMLTSTOP !The bounds are easy. - SUBROUTINE HTMLTHEADSTART !Start a table's heading. - CALL HTML("") !Thus. - INDEEP = INDEEP + 1 !Dig deeper. - END SUBROUTINE HTMLTHEADSTART !Content should follow. - SUBROUTINE HTMLTHEADSTOP !And now, enough. - INDEEP = INDEEP - 1 !Retreat a level. - CALL HTML("") !And end the head. - END SUBROUTINE HTMLTHEADSTOP !At the neck of the body? + SUBROUTINE HTMLTHEADSTART !Start a table's heading. + CALL HTML("") !Thus. + INDEEP = INDEEP + 1 !Dig deeper. + END SUBROUTINE HTMLTHEADSTART !Content should follow. + SUBROUTINE HTMLTHEADSTOP !And now, enough. + INDEEP = INDEEP - 1 !Retreat a level. + CALL HTML("") !And end the head. + END SUBROUTINE HTMLTHEADSTOP !At the neck of the body? - SUBROUTINE HTMLTHEAD(N,TEXT) !Cast forth a whole-span table heading. - INTEGER N !The count of columns to be spanned. - CHARACTER*(*) TEXT !A brief description to place there. - CALL HTML3("',"") !Start the specification. - CALL HTML3("",TEXT(1:LSTNB(TEXT)),"") !This text, possibly verbose. - END SUBROUTINE HTMLTHEAD !Thus, all contained on one line. + SUBROUTINE HTMLTHEAD(N,TEXT) !Cast forth a whole-span table heading. + INTEGER N !The count of columns to be spanned. + CHARACTER*(*) TEXT !A brief description to place there. + CALL HTML3("',"") !Start the specification. + CALL HTML3("",TEXT(1:LSTNB(TEXT)),"") !This text, possibly verbose. + END SUBROUTINE HTMLTHEAD !Thus, all contained on one line. - SUBROUTINE HTMLTBODYSTART !Start on the table body. - CALL HTML(' ') !And I don't think much of the "comment" formalism, either. - INDEEP = INDEEP + 1 !Anyway, we're ready with the alignment. - END SUBROUTINE HTMLTBODYSTART !Others will provide the body. - SUBROUTINE HTMLTBODYSTOP !And, they've had enough. - INDEEP = INDEEP - 1 !So, up out of the hole. - CALL HTML("") !Take a breath. - END SUBROUTINE HTMLTBODYSTOP !And wander off. - SUBROUTINE HTMLTROWTEXT(TEXT,N) !Roll a row of column headings. - CHARACTER*(*) TEXT(:) !The headings. - INTEGER N !Their number. - INTEGER I,L !Assistants. - CALL HTML3("","","") !Start a row of headings-to-come, and don't end the line. - DO I = 1,N !Step through the headings. - L = LSTNB(TEXT(I)) !Trailing spaces are to be ignored. - IF (L.LE.0) THEN !Thus discovering blank texts. - CALL HTML3(""," ","") !This prevents the cell being collapsed. - ELSE !But for those with text, - CALL HTML3("",""//TEXT(I)(1:L)//"","") !Roll it. - END IF !So much for that text. - END DO !On to the next. - CALL HTML3("","","") !Finish the row, and thus the line. - END SUBROUTINE HTMLTROWTEXT !So much for texts. - SUBROUTINE HTMLTROWINTEGER(V,N) !Now for all integers. - INTEGER V(:) !The integers. - INTEGER N !Their number. - INTEGER I !A stepper. - CALL HTML3('',"","") !Start a row of entries. - DO I = 1,N !Work through the row's values. - CALL HTML3("",""//I8FMT(V(I))//"","") !One by one. - END DO !On to the next. - CALL HTML3("","","") !Finish the row, and thus the line. - END SUBROUTINE HTMLTROWINTEGER !All the same type is not troublesome. - END MODULE HTMLSTUFF !Enough already. + SUBROUTINE HTMLTBODYSTART !Start on the table body. + CALL HTML(' ') !And I don't think much of the "comment" formalism, either. + INDEEP = INDEEP + 1 !Anyway, we're ready with the alignment. + END SUBROUTINE HTMLTBODYSTART !Others will provide the body. + SUBROUTINE HTMLTBODYSTOP !And, they've had enough. + INDEEP = INDEEP - 1 !So, up out of the hole. + CALL HTML("") !Take a breath. + END SUBROUTINE HTMLTBODYSTOP !And wander off. + SUBROUTINE HTMLTROWTEXT(TEXT,N) !Roll a row of column headings. + CHARACTER*(*) TEXT(:) !The headings. + INTEGER N !Their number. + INTEGER I,L !Assistants. + CALL HTML3("","","") !Start a row of headings-to-come, and don't end the line. + DO I = 1,N !Step through the headings. + L = LSTNB(TEXT(I)) !Trailing spaces are to be ignored. + IF (L.LE.0) THEN !Thus discovering blank texts. + CALL HTML3(""," ","") !This prevents the cell being collapsed. + ELSE !But for those with text, + CALL HTML3("",""//TEXT(I)(1:L)//"","") !Roll it. + END IF !So much for that text. + END DO !On to the next. + CALL HTML3("","","") !Finish the row, and thus the line. + END SUBROUTINE HTMLTROWTEXT !So much for texts. + SUBROUTINE HTMLTROWINTEGER(V,N) !Now for all integers. + INTEGER V(:) !The integers. + INTEGER N !Their number. + INTEGER I !A stepper. + CALL HTML3('',"","") !Start a row of entries. + DO I = 1,N !Work through the row's values. + CALL HTML3("",""//I8FMT(V(I))//"","") !One by one. + END DO !On to the next. + CALL HTML3("","","") !Finish the row, and thus the line. + END SUBROUTINE HTMLTROWINTEGER !All the same type is not troublesome. + END MODULE HTMLSTUFF !Enough already. PROGRAM MAKETABLE USE PARAMETERS USE ASSISTANCE USE HTMLSTUFF INTEGER KBD,MSG - INTEGER NCOLS !The usage of V must conform to this! - PARAMETER (NCOLS = 4) !Specified number of columns. - CHARACTER*3 COLNAME(NCOLS) !And they have names. - PARAMETER (COLNAME = (/"","X","Y","Z"/)) !As specified. - INTEGER V(NCOLS) !A scratchpad for a line's worth. - COMMON KBD,MSG !I/O units. - KBD = 5 !Keyboard. - MSG = 6 !Screen. - CALL GETLOG(USERCODE) !Who has poked me into life? - LUSERCODE = LSTNB(USERCODE) !Ah, text gnashing. + INTEGER NCOLS !The usage of V must conform to this! + PARAMETER (NCOLS = 4) !Specified number of columns. + CHARACTER*3 COLNAME(NCOLS) !And they have names. + PARAMETER (COLNAME = (/"","X","Y","Z"/)) !As specified. + INTEGER V(NCOLS) !A scratchpad for a line's worth. + COMMON KBD,MSG !I/O units. + KBD = 5 !Keyboard. + MSG = 6 !Screen. + CALL GETLOG(USERCODE) !Who has poked me into life? + LUSERCODE = LSTNB(USERCODE) !Ah, text gnashing. - CALL HTMLSTART(MSG,"Powers","Table of integer powers") !Output to the screen will do. - CALL HTMLTSTART(1,"Successive powers of successive integers") !Start the table. - CALL HTMLTHEADSTART !The table heading. - CALL HTMLTHEAD(NCOLS,"Successive powers") !A full-width heading. - CALL HTMLTROWTEXT(COLNAME,NCOLS) !Headings for each column. - CALL HTMLTHEADSTOP !So much for the heading. - CALL HTMLTBODYSTART !Now for the content. - DO I = 1,10 !This should be enough. - V(1) = I !The unheaded row number. - V(2) = I**2 !Its square. - V(3) = I**3 !Cube. - V(4) = I**4 !Fourth power. - CALL HTMLTROWINTEGER(V,NCOLS) !Show a row's worth.. - END DO !On to the next line. - CALL HTMLTBODYSTOP !No more content. - CALL HTMLTSTOP !End the table. + CALL HTMLSTART(MSG,"Powers","Table of integer powers") !Output to the screen will do. + CALL HTMLTSTART(1,"Successive powers of successive integers") !Start the table. + CALL HTMLTHEADSTART !The table heading. + CALL HTMLTHEAD(NCOLS,"Successive powers") !A full-width heading. + CALL HTMLTROWTEXT(COLNAME,NCOLS) !Headings for each column. + CALL HTMLTHEADSTOP !So much for the heading. + CALL HTMLTBODYSTART !Now for the content. + DO I = 1,10 !This should be enough. + V(1) = I !The unheaded row number. + V(2) = I**2 !Its square. + V(3) = I**3 !Cube. + V(4) = I**4 !Fourth power. + CALL HTMLTROWINTEGER(V,NCOLS) !Show a row's worth.. + END DO !On to the next line. + CALL HTMLTBODYSTOP !No more content. + CALL HTMLTSTOP !End the table. CALL HTMLSTOP END diff --git a/Task/Create-an-HTML-table/Java/create-an-html-table-3.java b/Task/Create-an-HTML-table/Java/create-an-html-table-3.java index f5306aa7ac..3c85302f31 100644 --- a/Task/Create-an-HTML-table/Java/create-an-html-table-3.java +++ b/Task/Create-an-HTML-table/Java/create-an-html-table-3.java @@ -1,25 +1,25 @@ public class HTML { - public static String array2HTML(Object[][] array){ - StringBuilder html = new StringBuilder( - ""); - for(Object elem:array[0]){ - html.append(""); - } - for(int i = 1; i < array.length; i++){ - Object[] row = array[i]; - html.append(""); - for(Object elem:row){ - html.append(""); - } - html.append(""); - } - html.append("
" + elem.toString() + "
" + elem.toString() + "
"); - return html.toString(); - } - - public static void main(String[] args){ - Object[][] ints = {{"","X","Y","Z"},{1,1,2,3},{2,4,5,6},{3,7,8,9},{4,10,11,12}}; - System.out.println(array2HTML(ints)); - } + public static String array2HTML(Object[][] array){ + StringBuilder html = new StringBuilder( + ""); + for(Object elem:array[0]){ + html.append(""); + } + for(int i = 1; i < array.length; i++){ + Object[] row = array[i]; + html.append(""); + for(Object elem:row){ + html.append(""); + } + html.append(""); + } + html.append("
" + elem.toString() + "
" + elem.toString() + "
"); + return html.toString(); + } + + public static void main(String[] args){ + Object[][] ints = {{"","X","Y","Z"},{1,1,2,3},{2,4,5,6},{3,7,8,9},{4,10,11,12}}; + System.out.println(array2HTML(ints)); + } } diff --git a/Task/Create-an-HTML-table/JavaScript/create-an-html-table-1.js b/Task/Create-an-HTML-table/JavaScript/create-an-html-table-1.js index 02d28e0f6d..9ba8c08860 100644 --- a/Task/Create-an-HTML-table/JavaScript/create-an-html-table-1.js +++ b/Task/Create-an-HTML-table/JavaScript/create-an-html-table-1.js @@ -4,32 +4,32 @@ Node.prototype.a = function (e) { this.appendChild(e); return this } function ce(tag, txt) { - var x = document.createElement(tag); - x.textContent = (txt === undefined) ? '' : txt; - return x; + var x = document.createElement(tag); + x.textContent = (txt === undefined) ? '' : txt; + return x; } function make_table(cols, rows) { - var tbl = ce('table', ''), tr = ce('tr'), th; + var tbl = ce('table', ''), tr = ce('tr'), th; - tbl.a(tr.a(ce('th'))); + tbl.a(tr.a(ce('th'))); - var z = 'Z'.charCodeAt(0); - for (var l = z - cols + 1; l <= z; l++) - tr.a(ce('th', String.fromCharCode(l))); + var z = 'Z'.charCodeAt(0); + for (var l = z - cols + 1; l <= z; l++) + tr.a(ce('th', String.fromCharCode(l))); - for (var r = 1; r <= rows; r++) { - tbl.a(tr = ce('tr').a(ce('th', r))); - for (var c = 0; c < cols; c++) - tr.a(ce('td', Math.floor(Math.random() * 10000))); - } + for (var r = 1; r <= rows; r++) { + tbl.a(tr = ce('tr').a(ce('th', r))); + for (var c = 0; c < cols; c++) + tr.a(ce('td', Math.floor(Math.random() * 10000))); + } - document.body - .a(ce('style', - 'td, th {border: 1px solid #696;' + - 'padding:.4ex} td {text-align: right }' + - 'table { border-collapse: collapse}')) - .a(tbl); + document.body + .a(ce('style', + 'td, th {border: 1px solid #696;' + + 'padding:.4ex} td {text-align: right }' + + 'table { border-collapse: collapse}')) + .a(tbl); } diff --git a/Task/Create-an-HTML-table/Julia/create-an-html-table-1.julia b/Task/Create-an-HTML-table/Julia/create-an-html-table-1.jl similarity index 100% rename from Task/Create-an-HTML-table/Julia/create-an-html-table-1.julia rename to Task/Create-an-HTML-table/Julia/create-an-html-table-1.jl diff --git a/Task/Create-an-HTML-table/Julia/create-an-html-table-2.julia b/Task/Create-an-HTML-table/Julia/create-an-html-table-2.jl similarity index 100% rename from Task/Create-an-HTML-table/Julia/create-an-html-table-2.julia rename to Task/Create-an-HTML-table/Julia/create-an-html-table-2.jl diff --git a/Task/Create-an-HTML-table/Kotlin/create-an-html-table-1.kotlin b/Task/Create-an-HTML-table/Kotlin/create-an-html-table-1.kts similarity index 100% rename from Task/Create-an-HTML-table/Kotlin/create-an-html-table-1.kotlin rename to Task/Create-an-HTML-table/Kotlin/create-an-html-table-1.kts diff --git a/Task/Create-an-HTML-table/Kotlin/create-an-html-table-2.kotlin b/Task/Create-an-HTML-table/Kotlin/create-an-html-table-2.kts similarity index 100% rename from Task/Create-an-HTML-table/Kotlin/create-an-html-table-2.kotlin rename to Task/Create-an-HTML-table/Kotlin/create-an-html-table-2.kts diff --git a/Task/Create-an-HTML-table/Lasso/create-an-html-table.lasso b/Task/Create-an-HTML-table/Lasso/create-an-html-table.lasso index 738052d5ac..bac8e0748f 100644 --- a/Task/Create-an-HTML-table/Lasso/create-an-html-table.lasso +++ b/Task/Create-an-HTML-table/Lasso/create-an-html-table.lasso @@ -1,20 +1,20 @@ define rand4dig => integer_random(9999, 1) local( - output = '\n' + output = '
\n' ) with el in (' ,X,Y,Z') -> split(',') do { - #output -> append('') + #output -> append('') } #output -> append('\n') loop(5) => { - #output -> append('\n') - loop(3) => { - #output -> append('') - } - #output -> append('\n') + #output -> append('\n') + loop(3) => { + #output -> append('') + } + #output -> append('\n') } #output -> append('
' + #el + '' + #el + '
' + loop_count + '' + rand4dig + '
' + loop_count + '' + rand4dig + '
\n') diff --git a/Task/Create-an-HTML-table/M2000-Interpreter/create-an-html-table.m2000 b/Task/Create-an-HTML-table/M2000-Interpreter/create-an-html-table.m2000 index a4f9c77305..e212abd32f 100644 --- a/Task/Create-an-HTML-table/M2000-Interpreter/create-an-html-table.m2000 +++ b/Task/Create-an-HTML-table/M2000-Interpreter/create-an-html-table.m2000 @@ -1,36 +1,36 @@ MODULE HtmlTable { - tag$=LAMBDA$ (a$)-> { - =LAMBDA$ a$ -> { - IF ISNUM THEN w$=STR$(NUMBER,0) ELSE w$=LETTER$ - READ ? part$ - ="<"+a$+IF$(LEN(part$)>0->" "+part$,"")+">"+w$+""+CHR$(13)+CHR$(10) - } - } - INVENTORY Fun - STACK NEW { - DATA "html", "head", "body", "table", "tr", "th", "td" - WHILE NOT EMPTY - OVER ' duplicate top of stack - APPEND Fun, LETTER$:=tag$(LETTER$) - END WHILE - } - DEF body0$="",body$="" - STACK NEW { - DATA "", "X", "Y", "Z" - FOR i=1 TO 4 - body0$+=Fun$("th")(LETTER$) - z$="" - FOR j=1 TO 3 : z$+=Fun$("td")(RANDOM(0, 9999), {align="right"}) : NEXT j - body$+=Fun$("tr")(Fun$("th")(i)+z$) - NEXT i - } - table$=fun$("table")(fun$("tr")(body0$)+body$,"border=1 cellpadding=10 cellspacing=0") - DOCUMENT final$=""+CHR$(13)+CHR$(10) - final$=fun$("html")(fun$("head")("")+fun$("body")(table$), {lang="en"}) - file$="c:\doc.html" - REPORT final$ - CLIPBOARD final$ - SAVE.DOC final$, file$ - WIN file$ ' execute, no wait + tag$=LAMBDA$ (a$)-> { + =LAMBDA$ a$ -> { + IF ISNUM THEN w$=STR$(NUMBER,0) ELSE w$=LETTER$ + READ ? part$ + ="<"+a$+IF$(LEN(part$)>0->" "+part$,"")+">"+w$+""+CHR$(13)+CHR$(10) + } + } + INVENTORY Fun + STACK NEW { + DATA "html", "head", "body", "table", "tr", "th", "td" + WHILE NOT EMPTY + OVER ' duplicate top of stack + APPEND Fun, LETTER$:=tag$(LETTER$) + END WHILE + } + DEF body0$="",body$="" + STACK NEW { + DATA "", "X", "Y", "Z" + FOR i=1 TO 4 + body0$+=Fun$("th")(LETTER$) + z$="" + FOR j=1 TO 3 : z$+=Fun$("td")(RANDOM(0, 9999), {align="right"}) : NEXT j + body$+=Fun$("tr")(Fun$("th")(i)+z$) + NEXT i + } + table$=fun$("table")(fun$("tr")(body0$)+body$,"border=1 cellpadding=10 cellspacing=0") + DOCUMENT final$=""+CHR$(13)+CHR$(10) + final$=fun$("html")(fun$("head")("")+fun$("body")(table$), {lang="en"}) + file$="c:\doc.html" + REPORT final$ + CLIPBOARD final$ + SAVE.DOC final$, file$ + WIN file$ ' execute, no wait } HtmlTable diff --git a/Task/Create-an-HTML-table/Modula-3/create-an-html-table.mod3 b/Task/Create-an-HTML-table/Modula-3/create-an-html-table.mod3 index 86b0df0df1..a78a020685 100644 --- a/Task/Create-an-HTML-table/Modula-3/create-an-html-table.mod3 +++ b/Task/Create-an-HTML-table/Modula-3/create-an-html-table.mod3 @@ -5,16 +5,16 @@ FROM Fmt IMPORT Int, F; BEGIN IO.Put("" - & "" + & "" - & "", - Int(I), - Int(rand.integer(0, 1000)), - Int(rand.integer(0, 1000)), - Int(rand.integer(0, 1000)))); - END; + FOR I := 0 TO 3 DO + IO.Put(F("" + & "", + Int(I), + Int(rand.integer(0, 1000)), + Int(rand.integer(0, 1000)), + Int(rand.integer(0, 1000)))); + END; END; END Table. diff --git a/Task/Create-an-HTML-table/Nanoquery/create-an-html-table.nanoquery b/Task/Create-an-HTML-table/Nanoquery/create-an-html-table.nanoquery index e3c367c973..b5ff55121d 100644 --- a/Task/Create-an-HTML-table/Nanoquery/create-an-html-table.nanoquery +++ b/Task/Create-an-HTML-table/Nanoquery/create-an-html-table.nanoquery @@ -9,11 +9,11 @@ println "" // generate five rows for i in range(1, 5) - println "" - println "" - println "" - println "" - println "" + println "" + println "" + println "" + println "" + println "" end for println "
XY"); + & "border: 1px solid\">XY"); WITH rand = NEW(Random.Default).init() DO - FOR I := 0 TO 3 DO - IO.Put(F("
%s%s%s%s
%s%s%s%s
XYZ
" + i + "" + int($random.getInt(8999) + 1000) + "" + int($random.getInt(8999) + 1000) + "" + int($random.getInt(8999) + 1000) + "
" + i + "" + int($random.getInt(8999) + 1000) + "" + int($random.getInt(8999) + 1000) + "" + int($random.getInt(8999) + 1000) + "
" diff --git a/Task/Create-an-HTML-table/OCaml/create-an-html-table-1.ocaml b/Task/Create-an-HTML-table/OCaml/create-an-html-table-1.ml similarity index 100% rename from Task/Create-an-HTML-table/OCaml/create-an-html-table-1.ocaml rename to Task/Create-an-HTML-table/OCaml/create-an-html-table-1.ml diff --git a/Task/Create-an-HTML-table/OCaml/create-an-html-table-2.ocaml b/Task/Create-an-HTML-table/OCaml/create-an-html-table-2.ml similarity index 100% rename from Task/Create-an-HTML-table/OCaml/create-an-html-table-2.ocaml rename to Task/Create-an-HTML-table/OCaml/create-an-html-table-2.ml diff --git a/Task/Create-an-HTML-table/OCaml/create-an-html-table-3.ocaml b/Task/Create-an-HTML-table/OCaml/create-an-html-table-3.ml similarity index 100% rename from Task/Create-an-HTML-table/OCaml/create-an-html-table-3.ocaml rename to Task/Create-an-HTML-table/OCaml/create-an-html-table-3.ml diff --git a/Task/Create-an-HTML-table/OCaml/create-an-html-table-4.ocaml b/Task/Create-an-HTML-table/OCaml/create-an-html-table-4.ml similarity index 100% rename from Task/Create-an-HTML-table/OCaml/create-an-html-table-4.ocaml rename to Task/Create-an-HTML-table/OCaml/create-an-html-table-4.ml diff --git a/Task/Create-an-HTML-table/Oz/create-an-html-table.oz b/Task/Create-an-HTML-table/Oz/create-an-html-table.oz index 8d353080da..e7695d8b19 100644 --- a/Task/Create-an-HTML-table/Oz/create-an-html-table.oz +++ b/Task/Create-an-HTML-table/Oz/create-an-html-table.oz @@ -5,30 +5,30 @@ declare fun {Table Session} html( head(title("Show a table with row and column headings") - style(type:"text/css" - css(td 'text-align':center) - )) + style(type:"text/css" + css(td 'text-align':center) + )) body( - {TagFromList table - tr(th th("X") th("Y") th("Z")) - | - {CreateRows 3 5} - })) + {TagFromList table + tr(th th("X") th("Y") th("Z")) + | + {CreateRows 3 5} + })) end fun {CreateRows NumCols NumRows} {List.map {List.number 1 NumRows 1} fun {$ Row} {TagFromList tr - td( {Int.toString Row} ) - | - {List.map {List.number 1 NumCols 1} - fun {$ Col} - SequentialNumber = (Row-1)*NumCols + Col - in - td( {Int.toString SequentialNumber} ) - end - }} + td( {Int.toString Row} ) + | + {List.map {List.number 1 NumCols 1} + fun {$ Col} + SequentialNumber = (Row-1)*NumCols + Col + in + td( {Int.toString SequentialNumber} ) + end + }} end } end diff --git a/Task/Create-an-HTML-table/PHP/create-an-html-table-1.php b/Task/Create-an-HTML-table/PHP/create-an-html-table-1.php index f7fc655559..78ddb2115b 100644 --- a/Task/Create-an-HTML-table/PHP/create-an-html-table-1.php +++ b/Task/Create-an-HTML-table/PHP/create-an-html-table-1.php @@ -9,27 +9,27 @@ $rows = 3; $html = ''; foreach($cols as $col) { - $html .= ''; + $html .= ''; } unset($col); $html .= ''; foreach($cols as $col) { - $html .= ""; + $html .= ""; } unset($col); $html .= ''; for($r = 1; $r <= $rows; $r++) { - $html .= ''; - foreach($cols as $key => $col) - { - $html .= ''; - } - unset($col); - $html .= ''; + $html .= ''; + foreach($cols as $key => $col) + { + $html .= ''; + } + unset($col); + $html .= ''; } $html .= '
{$col}{$col}
' . (($key > 0) ? rand(1, 9999) : $r) . '
' . (($key > 0) ? rand(1, 9999) : $r) . '
'; diff --git a/Task/Create-an-HTML-table/PHP/create-an-html-table-2.php b/Task/Create-an-HTML-table/PHP/create-an-html-table-2.php index a13b5fb1b9..3abf9fd3ee 100644 --- a/Task/Create-an-HTML-table/PHP/create-an-html-table-2.php +++ b/Task/Create-an-HTML-table/PHP/create-an-html-table-2.php @@ -9,27 +9,27 @@ $rows = 3; - - - - - - - - - - - - - - - - $col): ?> - - - - - + + + + + + + + + + + + + + + + $col): ?> + + + + +
0) ? rand(1, 9999) : $r ?>
0) ? rand(1, 9999) : $r ?>
diff --git a/Task/Create-an-HTML-table/Peloton/create-an-html-table.peloton b/Task/Create-an-HTML-table/Peloton/create-an-html-table.peloton index 45b01ab02e..37ba932a85 100644 --- a/Task/Create-an-HTML-table/Peloton/create-an-html-table.peloton +++ b/Task/Create-an-HTML-table/Peloton/create-an-html-table.peloton @@ -1,17 +1,17 @@ <@ SDCLIT> - <@ DTBLIT> - <@ DTRLITLIT> - <@ DTDLITLIT>|[style]background-color:white - <@ DTD>X - <@ DTD>Y - <@ DTD>Z|[style]width:100%; background-color:brown;color:white; text-align:center - <@ ITEFORLIT>10| - <@ DTRLITCAP> - <@ DTDPOSFORLIT>...|[style]background-color:Brown; color:white; text-align:right - <@ DTDCAPLIT><@ SAYR!ILI2>1|9999|[style]width:50;text-align:right - <@ DTDCAPLIT><@ SAYR!ILI2>1|9999|[style]width:50;text-align:right - <@ DTDCAPLIT><@ SAYR!ILI2>1|9999|[style]width:50;text-align:right - |[style]background-color:white;color:black - - + <@ DTBLIT> + <@ DTRLITLIT> + <@ DTDLITLIT>|[style]background-color:white + <@ DTD>X + <@ DTD>Y + <@ DTD>Z|[style]width:100%; background-color:brown;color:white; text-align:center + <@ ITEFORLIT>10| + <@ DTRLITCAP> + <@ DTDPOSFORLIT>...|[style]background-color:Brown; color:white; text-align:right + <@ DTDCAPLIT><@ SAYR!ILI2>1|9999|[style]width:50;text-align:right + <@ DTDCAPLIT><@ SAYR!ILI2>1|9999|[style]width:50;text-align:right + <@ DTDCAPLIT><@ SAYR!ILI2>1|9999|[style]width:50;text-align:right + |[style]background-color:white;color:black + + |Number Table diff --git a/Task/Create-an-HTML-table/PowerShell/create-an-html-table-1.psh b/Task/Create-an-HTML-table/PowerShell/create-an-html-table-1.ps1 similarity index 100% rename from Task/Create-an-HTML-table/PowerShell/create-an-html-table-1.psh rename to Task/Create-an-HTML-table/PowerShell/create-an-html-table-1.ps1 diff --git a/Task/Create-an-HTML-table/PowerShell/create-an-html-table-2.psh b/Task/Create-an-HTML-table/PowerShell/create-an-html-table-2.ps1 similarity index 100% rename from Task/Create-an-HTML-table/PowerShell/create-an-html-table-2.psh rename to Task/Create-an-HTML-table/PowerShell/create-an-html-table-2.ps1 diff --git a/Task/Create-an-HTML-table/PowerShell/create-an-html-table-3.psh b/Task/Create-an-HTML-table/PowerShell/create-an-html-table-3.ps1 similarity index 100% rename from Task/Create-an-HTML-table/PowerShell/create-an-html-table-3.psh rename to Task/Create-an-HTML-table/PowerShell/create-an-html-table-3.ps1 diff --git a/Task/Create-an-HTML-table/Prolog/create-an-html-table-1.pro b/Task/Create-an-HTML-table/Prolog/create-an-html-table-1.pro index b84bdb97ae..cac87a0a7f 100644 --- a/Task/Create-an-HTML-table/Prolog/create-an-html-table-1.pro +++ b/Task/Create-an-HTML-table/Prolog/create-an-html-table-1.pro @@ -5,12 +5,12 @@ trows([],_) --> []. trows([R|T], N) --> html(tr([td(N),\trow(R)])), { N1 is N + trow([]) --> []. trow([E|T]) --> html(td(E)), trow(T). table :- - Header = ['X','Y','Z'], - Rows = [ - [7055,5334,5795], - [2895,3019,7747], - [140,7607,8144], - [7090,475,4140] - ], - phrase(html(table([tr(\theader(Header)), \trows(Rows,1)])), Out, []), - print_html(Out). + Header = ['X','Y','Z'], + Rows = [ + [7055,5334,5795], + [2895,3019,7747], + [140,7607,8144], + [7090,475,4140] + ], + phrase(html(table([tr(\theader(Header)), \trows(Rows,1)])), Out, []), + print_html(Out). diff --git a/Task/Create-an-HTML-table/R/create-an-html-table.r b/Task/Create-an-HTML-table/R/create-an-html-table.r new file mode 100644 index 0000000000..4818c382a0 --- /dev/null +++ b/Task/Create-an-HTML-table/R/create-an-html-table.r @@ -0,0 +1,15 @@ +html_table <- function(headings, nrows){ + ncols <- length(headings) + pad_table <- function(s, char2="d"){ + pad <- paste0("", s, "", collapse="") + paste0("", pad, "", collapse="") + } + theader <- pad_table(c("", headings), char2="h") + gen_row <- function(n) c(n, sample(9999, ncols)) + tbody <- lapply(1:nrows, gen_row) |> sapply(pad_table) + cat("", theader, sep="\n") + writeLines(tbody) + cat("
\n") +} + +html_table(c("X", "Y", "Z"), 3) diff --git a/Task/Create-an-HTML-table/Rascal/create-an-html-table-1.rascal b/Task/Create-an-HTML-table/Rascal/create-an-html-table-1.rascal index 6d7cfdfdd8..47f6edacf3 100644 --- a/Task/Create-an-HTML-table/Rascal/create-an-html-table-1.rascal +++ b/Task/Create-an-HTML-table/Rascal/create-an-html-table-1.rascal @@ -8,11 +8,11 @@ str tr(str content) = item("tr", content); str td(str content) = item("td", content); public str generateTable(int rows){ - int i(){return arbInt(10000);}; - rows = (tr(td("")+td("X")+td("Y")+td("Z")) - | it + tr(td("")+td("")+td("")+td("")) - | x <- [1..rows]); - writeFile(|file:///location|, - html("Rosetta Code Table", table(rows))); - return "written"; + int i(){return arbInt(10000);}; + rows = (tr(td("")+td("X")+td("Y")+td("Z")) + | it + tr(td("")+td("")+td("")+td("")) + | x <- [1..rows]); + writeFile(|file:///location|, + html("Rosetta Code Table", table(rows))); + return "written"; } diff --git a/Task/Create-an-HTML-table/Rebol/create-an-html-table-1.rebol b/Task/Create-an-HTML-table/Rebol/create-an-html-table-1.rebol new file mode 100644 index 0000000000..6460883556 --- /dev/null +++ b/Task/Create-an-HTML-table/Rebol/create-an-html-table-1.rebol @@ -0,0 +1,37 @@ +Rebol [ + title: "Rosetta code: Create an HTML table" + file: %Create_an_HTML_table.r3 + url: https://rosettacode.org/wiki/Create_an_HTML_table + note: "Based on Red language implementation!" +] +table-rows: func [][rejoin [ + first-tr newline + rand-tr 1 newline + rand-tr 2 newline + rand-tr 3 newline + rand-tr 4 newline + rand-tr 5 newline +]] +td-data: does [999 + random 9000] +rand-td: does [form-tag 'td td-data] +rand-tr: func [i][rejoin [ + form-tag 'tr + rejoin [(form-tag 'td i) rand-td rand-td rand-td] +]] +first-tr: func[][rejoin [ + form-tag 'tr rejoin [ + form-tag 'th "" + form-tag 'th "X" + form-tag 'th "Y" + form-tag 'th "Z" + ] +]] +form-tag: func [tag contents /attr a][ + ajoin [ + "<" tag (if attr [ajoin [" " a/1 "=" {"} a/2 {"}]]) ">" + contents + "" + ] +] + +print form-tag 'table table-rows diff --git a/Task/Create-an-HTML-table/Rebol/create-an-html-table-2.rebol b/Task/Create-an-HTML-table/Rebol/create-an-html-table-2.rebol new file mode 100644 index 0000000000..c3c7cbc8af --- /dev/null +++ b/Task/Create-an-HTML-table/Rebol/create-an-html-table-2.rebol @@ -0,0 +1,7 @@ + + + + + + +
XYZ
1209634429408
2967939177056
3215143569440
4274197384967
5237771907304
diff --git a/Task/Create-an-HTML-table/Rust/create-an-html-table-1.rust b/Task/Create-an-HTML-table/Rust/create-an-html-table-1.rs similarity index 100% rename from Task/Create-an-HTML-table/Rust/create-an-html-table-1.rust rename to Task/Create-an-HTML-table/Rust/create-an-html-table-1.rs diff --git a/Task/Create-an-HTML-table/Rust/create-an-html-table-2.rust b/Task/Create-an-HTML-table/Rust/create-an-html-table-2.rs similarity index 100% rename from Task/Create-an-HTML-table/Rust/create-an-html-table-2.rust rename to Task/Create-an-HTML-table/Rust/create-an-html-table-2.rs diff --git a/Task/Create-an-HTML-table/SNOBOL4/create-an-html-table.sno b/Task/Create-an-HTML-table/SNOBOL4/create-an-html-table.sno index df2ca8af52..496e49d4ba 100644 --- a/Task/Create-an-HTML-table/SNOBOL4/create-an-html-table.sno +++ b/Task/Create-an-HTML-table/SNOBOL4/create-an-html-table.sno @@ -1,12 +1,12 @@ * HTML Table - output = "" - output = " " - i = 1 -o1 output = "" - j = 1 -o2 output = "" - j = lt(j,3) j + 1 :s(o2) - output = "" - i = lt(i,3) i + 1 :s(o1) - output = "
XYZ
" i "" i j "
" + output = "" + output = " " + i = 1 +o1 output = "" + j = 1 +o2 output = "" + j = lt(j,3) j + 1 :s(o2) + output = "" + i = lt(i,3) i + 1 :s(o1) + output = "
XYZ
" i "" i j "
" end diff --git a/Task/Create-an-HTML-table/Scheme/create-an-html-table.ss b/Task/Create-an-HTML-table/Scheme/create-an-html-table.scm similarity index 100% rename from Task/Create-an-HTML-table/Scheme/create-an-html-table.ss rename to Task/Create-an-HTML-table/Scheme/create-an-html-table.scm diff --git a/Task/Create-an-HTML-table/Standard-ML/create-an-html-table.ml b/Task/Create-an-HTML-table/Standard-ML/create-an-html-table.ml index 9ffc1b1e25..4446dc7c10 100644 --- a/Task/Create-an-HTML-table/Standard-ML/create-an-html-table.ml +++ b/Task/Create-an-HTML-table/Standard-ML/create-an-html-table.ml @@ -1,34 +1,34 @@ (* * val mkHtmlTable : ('a list * 'b list) -> ('a -> string * 'b -> string) - * -> (('a * 'b) -> string) -> string + * -> (('a * 'b) -> string) -> string * The int list is list of colums, the function returns the values * at a given colum and row. * returns the HTML code of the generated table. *) fun mkHtmlTable (columns, rows) (rowToStr, colToStr) values = - let - val text = ref "\n" - in - (* Add headers *) - map (fn colum => text := !text ^ "") columns; + let + val text = ref "
" ^ (colToStr colum) ^ "
\n" + in + (* Add headers *) + map (fn colum => text := !text ^ "") columns; - text := !text ^ "\n"; - (* Add data rows *) - map (fn row => - (* row name *) - (text := !text ^ ""; - (* data *) - map (fn col => text := !text ^ "") columns; - text := !text ^ "\n") - ) rows; - !text ^ "
" ^ (colToStr colum) ^ "
" ^ (rowToStr row) ^ "" ^ (values (row, col)) ^ "
" - end + text := !text ^ "\n"; + (* Add data rows *) + map (fn row => + (* row name *) + (text := !text ^ "" ^ (rowToStr row) ^ ""; + (* data *) + map (fn col => text := !text ^ "" ^ (values (row, col)) ^ "") columns; + text := !text ^ "\n") + ) rows; + !text ^ "" + end fun mkHtmlWithBody (title, body) = "\n\n" ^ title ^ "\n\n\n" ^ body ^ "\n\n\n" fun samplePage () = mkHtmlWithBody ("Sample Page", - mkHtmlTable ([1.0,2.0,3.0,4.0,5.0], [1.0,2.0,3.0,4.0]) - (Real.toString, Real.toString) - (fn (a, b) => Real.toString (Math.pow (a, b)))) + mkHtmlTable ([1.0,2.0,3.0,4.0,5.0], [1.0,2.0,3.0,4.0]) + (Real.toString, Real.toString) + (fn (a, b) => Real.toString (Math.pow (a, b)))) val _ = print (samplePage ()) diff --git a/Task/Create-an-HTML-table/Stata/create-an-html-table-1.stata b/Task/Create-an-HTML-table/Stata/create-an-html-table-1.stata index e0aac840d1..0bca7e1ec7 100644 --- a/Task/Create-an-HTML-table/Stata/create-an-html-table-1.stata +++ b/Task/Create-an-HTML-table/Stata/create-an-html-table-1.stata @@ -16,19 +16,19 @@ file write `f' `""' _n file write `f' "" _n file write `f' "" _n forv j = 1/`nc' { - local s `: word `j' of `cn'' - file write `f' `""' _n + local s `: word `j' of `cn'' + file write `f' `""' _n } file write `f' "" _n * write row names & data forv i = 1/`nr' { - file write `f' "" _n - local s `: word `i' of `rn'' - file write `f' `""' _n - forv j = 1/`nc' { - file write `f' `""' _n - } - file write `f' "" _n + file write `f' "" _n + local s `: word `i' of `rn'' + file write `f' `""' _n + forv j = 1/`nc' { + file write `f' `""' _n + } + file write `f' "" _n } file write `f' "
`s'`s'
`s'`=el(`1',`i',`j')'
`s'`=el(`1',`i',`j')'
" _n file write `f' "" _n diff --git a/Task/Create-an-HTML-table/Tcl/create-an-html-table.tcl b/Task/Create-an-HTML-table/Tcl/create-an-html-table.tcl index 0a25494ed2..0c28ec5b37 100644 --- a/Task/Create-an-HTML-table/Tcl/create-an-html-table.tcl +++ b/Task/Create-an-HTML-table/Tcl/create-an-html-table.tcl @@ -3,7 +3,7 @@ proc TAG {name args} { set body [lindex $args end] set result "<$name" foreach {t v} [lrange $args 0 end-1] { - append result " $t=\"" $v "\"" + append result " $t=\"" $v "\"" } append result ">" [string trim [uplevel 1 [list subst $body]]] "" } @@ -21,21 +21,21 @@ set data {} for {set x 0} {$x < 4} {incr x} { # Inspired by the Go solution, but with extra arbitrary digits to show 4-char wide values lappend data [list \ - [expr {$x+1}] [expr {$x*3010}] [expr {$x*3+1298}] [expr {$x*2579+2182}]] + [expr {$x+1}] [expr {$x*3010}] [expr {$x*3+1298}] [expr {$x*2579+2182}]] } # Write the table to standard out puts [TAG table border 1 { [TAG tr bgcolor #f0f0f0 { - [FOREACH head $titles { - [TAG th {$head}] - }] + [FOREACH head $titles { + [TAG th {$head}] + }] }] [FOREACH row $data { - [TAG tr bgcolor #ffffff { - [FOREACH col $row { - [TAG td align right {$col}] - }] - }] + [TAG tr bgcolor #ffffff { + [FOREACH col $row { + [TAG td align right {$col}] + }] + }] }] }] diff --git a/Task/Create-an-HTML-table/VBScript/create-an-html-table.vb b/Task/Create-an-HTML-table/VBScript/create-an-html-table.vb deleted file mode 100644 index 35deed3f02..0000000000 --- a/Task/Create-an-HTML-table/VBScript/create-an-html-table.vb +++ /dev/null @@ -1,40 +0,0 @@ -Set objFSO = CreateObject("Scripting.FileSystemObject") - -'Open the input csv file for reading. The file is in the same folder as the script. -Set objInFile = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) &_ - "\in.csv",1) - -'Create the output html file. -Set objOutHTML = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) &_ - "\out.html",2,True) - -'Write the html opening tags. -objOutHTML.Write "" & vbCrLf - -'Declare table properties. -objOutHTML.Write "" & vbCrLf - -'Write column headers. -objOutHTML.Write "" & vbCrLf - -'Go through each line of the input csv file and write to the html output file. -n = 1 -Do Until objInFile.AtEndOfStream - line = objInFile.ReadLine - If Len(line) > 0 Then - token = Split(line,",") - objOutHTML.Write "" - For i = 0 To UBound(token) - objOutHTML.Write "" - Next - objOutHTML.Write "" & vbCrLf - End If - n = n + 1 -Loop - -'Write the html closing tags. -objOutHTML.Write "
XYZ
" & n & "" & token(i) & "
" - -objInFile.Close -objOutHTML.Close -Set objFSO = Nothing diff --git a/Task/Create-an-HTML-table/VBScript/create-an-html-table.vbs b/Task/Create-an-HTML-table/VBScript/create-an-html-table.vbs new file mode 100644 index 0000000000..488b88273f --- /dev/null +++ b/Task/Create-an-HTML-table/VBScript/create-an-html-table.vbs @@ -0,0 +1,40 @@ +Set objFSO = CreateObject("Scripting.FileSystemObject") + +'Open the input csv file for reading. The file is in the same folder as the script. +Set objInFile = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) &_ + "\in.csv",1) + +'Create the output html file. +Set objOutHTML = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) &_ + "\out.html",2,True) + +'Write the html opening tags. +objOutHTML.Write "" & vbCrLf + +'Declare table properties. +objOutHTML.Write "" & vbCrLf + +'Write column headers. +objOutHTML.Write "" & vbCrLf + +'Go through each line of the input csv file and write to the html output file. +n = 1 +Do Until objInFile.AtEndOfStream + line = objInFile.ReadLine + If Len(line) > 0 Then + token = Split(line,",") + objOutHTML.Write "" + For i = 0 To UBound(token) + objOutHTML.Write "" + Next + objOutHTML.Write "" & vbCrLf + End If + n = n + 1 +Loop + +'Write the html closing tags. +objOutHTML.Write "
XYZ
" & n & "" & token(i) & "
" + +objInFile.Close +objOutHTML.Close +Set objFSO = Nothing diff --git a/Task/Create-an-HTML-table/Wren/create-an-html-table.wren b/Task/Create-an-HTML-table/Wren/create-an-html-table.wren index 995fe7255f..3ec9fa84b4 100644 --- a/Task/Create-an-HTML-table/Wren/create-an-html-table.wren +++ b/Task/Create-an-HTML-table/Wren/create-an-html-table.wren @@ -1,5 +1,5 @@ import "random" for Random -import "/fmt" for Fmt +import "./fmt" for Fmt var r = Random.new() var sb = "" diff --git a/Task/Create-an-HTML-table/X86-64-Assembly/create-an-html-table.x86-64 b/Task/Create-an-HTML-table/X86-64-Assembly/create-an-html-table.x86-64 new file mode 100644 index 0000000000..1df6b26b15 --- /dev/null +++ b/Task/Create-an-HTML-table/X86-64-Assembly/create-an-html-table.x86-64 @@ -0,0 +1,323 @@ +; creating html table +; assembly X86 window +; download and install visual studio 2022 free site microsoft +; search and open X64 native tools command prompt +; compil and link program with this command : +; ml64 .asm /link /ENTRY:main /SUBSYSTEM:console kernel32.lib user32.lib Shell32.lib +; this program respects the 64-bit calling convention : +; registers arguments : rcx rdx r8 r9 and stack +; registers saved : rbx,rbp,rdi,rsi, r12-r15 +; ATTENTION les registres rax,rcx,rdx,r8-r11 peuvent être +; perdus lors d'un appel de fonction +;********************************* +; constantes +;********************************* +STD_OUTPUT_HANDLE equ -11 + +NBLIGNES equ 5 +BUFFERSIZE equ 200 + +;********************************* +; MACROS +;********************************* +afficherLib MACRO messa +local mess1,LGMESS1C +.data + mess1 db messa,10,0 + LGMESS1C equ $ - mess1 +.code + push rax + push rcx + push rdx + push r8 + push r9 + push r10 + push r11 + mov rcx, offset mess1 + mov rdx,LGMESS1C + call afficherConsole + pop r11 + pop r10 + pop r9 + pop r8 + pop rdx + pop rcx + pop rax + +ENDM + +;********************************* +; user data +;********************************* +.data +szarrayheader db " ",10,0 +LGSZARRAYHEADER equ $ - szarrayheader -1 +szarrayend db "
",10,0 +LGSZARRAYEND equ $ - szarrayend -1 +szLine1 db "XYZ",10,0 +LGSZLINE1 equ $ - szLine1 - 1 +szDebLine db "",0 +LGSZDEBLINE equ $ - szDebLine - 1 +szEndLine db "",10,0 +LGSZENDLINE equ $ - szEndLine - 1 +szEndCol db "",0 +LGSZENDCOL equ $ - szEndCol - 1 + +sBuffer db BUFFERSIZE dup (' ') + +szRetourLigne db 10,0 +sZoneConv db 24 dup (' ') +sZoneConv1 db 24 dup (' ') +sZoneConv2 db 24 dup (' ') +sZoneConv3 db 24 dup (' ') + +align 8 +qgraine dq 123456789 +qNbDep1 dq 0019660dh +qNbDep2 dq 3c6ef35fh +hConsole dq 0 + +;********************************* +; user code fonction principale +;********************************* +.code + +extern WriteFile : proc, GetStdHandle : proc, ExitProcess : proc +extern GetLastError : proc + +main PROC public + afficherLib "Program start." + mov rcx, offset szarrayheader + mov rdx,LGSZARRAYHEADER + call afficherConsole + + mov rcx, offset szLine1 + mov rdx,LGSZLINE1 + call afficherConsole + + mov rbx,1 ; indice loop +lineLoop: ; line loop begin + mov rcx,rbx + mov rdx,offset sZoneConv + call conversion10 + mov rax, offset szDebLine + push rax + mov rax,LGSZDEBLINE + push rax + mov rax,offset sZoneConv + push rax + push 1 + mov rax,offset szEndCol + push rax + mov rax,LGSZENDCOL + push rax + mov rcx,10000 + call randomNumber + mov rcx,rax + mov rdx,offset sZoneConv1 + call conversion10 + mov rcx,offset sZoneConv1 + push rcx + push rax + mov rax,offset szEndCol + push rax + mov rax,LGSZENDCOL + push rax + mov rcx,10000 + call randomNumber + mov rcx,rax + mov rdx,offset sZoneConv2 + call conversion10 + mov rcx,offset sZoneConv2 + push rcx + push rax + + mov rax,offset szEndCol + push rax + mov rax,LGSZENDCOL + push rax + mov rcx,10000 + call randomNumber + mov rcx,rax + mov rdx,offset sZoneConv3 + call conversion10 + mov rcx,offset sZoneConv3 + push rcx + push rax + + mov rax, offset szEndLine + push rax + mov rax,LGSZENDLINE + push rax + mov rcx, offset sBuffer + mov rdx,BUFFERSIZE + mov r8,9 + call grouperChaines + add rsp,8 * 2 * 9 + + mov rcx, offset sBuffer + mov rdx,rax + call afficherConsole + + inc rbx + cmp rbx,NBLIGNES + jle lineLoop + + mov rcx, offset szarrayend + mov rdx,LGSZARRAYEND + call afficherConsole + + + mov rcx, offset szRetourLigne + mov rdx,1 + call afficherConsole + + +finProgramme: + afficherLib "Programm end." + sub rsp,28h + mov rcx,0 ; return code + call ExitProcess +main ENDP + +;************************************** +; console display +;************************************** +; rcx : string address +; rdx : length string +afficherConsole: + push rbx + push r12 + sub rsp,28h ; 40 bytes on stack (shadow variables) + mov rbx,rcx ; string address + mov r12,rdx ; size string + + cmp QWORD ptr hConsole,0 ; console handle ? + jne @B3 + mov rcx,STD_OUTPUT_HANDLE + call GetStdHandle ; load console handle + mov hConsole, rax ; save in data +@B3: + mov rcx,hconsole ; handle + mov rdx,rbx ; string address + mov r8,r12 ; string length + mov r9,0 ; + + sub rsp,8 ; stack alignement (one push) + push 0 + sub rsp,20h ; stack for shadow variable + call WriteFile ; winapi function + add rsp,20h + add rsp,10h ; 1 push and alignement + add rsp,28h ; stack alignement + pop r12 + pop rbx + ret +;*************************************************** +;conversion to unsigned base 10 +;with removal of unnecessary zeros +;and left shift +;**************************************************** +; rcx : value to convert +; rdx : conversion area address length > 22 +LONGUEUR equ 24 +conversion10: + push rbx + push rdi + mov rdi,rdx ; conversion area address + mov BYTE ptr [rdi+LONGUEUR],0 ; 0 final conversion area + mov rax,rcx ; value + mov rcx,LONGUEUR-1 + mov rbx ,10 +CA1: ; loop begin + mov rdx,0 ; division rax by 10 + div rbx + add rdx,'0' ; remainder conversion ascii + mov byte ptr [rdi+rcx],dl + dec rcx + cmp rax,0 ; end ? + jne CA1 + xor rax,rax + inc rcx +CA5: ; copy loop + mov dl,[rdi+rcx] ; load a result character + mov byte ptr [rdi+rax],dl ; and store at conversion area begin + inc rcx + inc rax + cmp rcx,LONGUEUR ; loop if not zero final + jle CA5 + pop rdi + pop rbx + ret +;************************************** +; generate random number +;************************************** +; rcx number limit +randomNumber: + mov rax,0 + cmp rcx,0 + je randfin + mov rax, qGraine ; load seed + mov r8,qNbDep1 + mov rdx,qNbDep2 + mul r8 + add rax,rdx + mov qGraine,rax ; store new seed + inc rcx + mov rdx,0 + div rcx + mov rax,rdx ; result = remainder +randfin: + ret +;*************************************************** +; string concatenation +;************************************************** +; rcx destination area address +; rdx destination area length +; r8 strings number +; r9 0 +; on stack address and length of each string +; in order of insertion +grouperChaines: + enter 0,0 + push rbx + push r12 + push r13 + cmp r8,0 + je fingrp + mov r12,rdx + mov r9,0 ; indice strings + mov r10,0 ; number of characters inserted +bouclezone: + mov r13,r8 + shl r13,1 + mov rbx,[rbp+8+(r13 * 8)] ; string address + mov rax,[rbp+(r13 * 8)] ; sring length + mov r11,0 +bouclecopie: ; loop string copy + mov dl,byte ptr[rbx+r11] + mov byte ptr[rcx+r10],dl + inc r11 + cmp r11,rax + jg finbouclecopie + inc r10 ;number of characters inserted + cmp r10,r12 ; max? + jge erreur + jmp bouclecopie +finbouclecopie: + dec r8 ; other string + jnz bouclezone + + mov rax,r10 ; return size final string + jmp fingrp +erreur: + afficherLib "reception area too small" + mov rax,0 +fingrp: + pop r13 + pop r12 + pop rbx + leave + ret + +end diff --git a/Task/Create-an-object-at-a-given-address/Ada/create-an-object-at-a-given-address-1.ada b/Task/Create-an-object-at-a-given-address/Ada/create-an-object-at-a-given-address-1.adb similarity index 100% rename from Task/Create-an-object-at-a-given-address/Ada/create-an-object-at-a-given-address-1.ada rename to Task/Create-an-object-at-a-given-address/Ada/create-an-object-at-a-given-address-1.adb diff --git a/Task/Create-an-object-at-a-given-address/Ada/create-an-object-at-a-given-address-2.ada b/Task/Create-an-object-at-a-given-address/Ada/create-an-object-at-a-given-address-2.adb similarity index 100% rename from Task/Create-an-object-at-a-given-address/Ada/create-an-object-at-a-given-address-2.ada rename to Task/Create-an-object-at-a-given-address/Ada/create-an-object-at-a-given-address-2.adb diff --git a/Task/Create-an-object-at-a-given-address/COBOL/create-an-object-at-a-given-address.cobol b/Task/Create-an-object-at-a-given-address/COBOL/create-an-object-at-a-given-address.cob similarity index 100% rename from Task/Create-an-object-at-a-given-address/COBOL/create-an-object-at-a-given-address.cobol rename to Task/Create-an-object-at-a-given-address/COBOL/create-an-object-at-a-given-address.cob diff --git a/Task/Create-an-object-at-a-given-address/Delphi/create-an-object-at-a-given-address.delphi b/Task/Create-an-object-at-a-given-address/Delphi/create-an-object-at-a-given-address.pas similarity index 100% rename from Task/Create-an-object-at-a-given-address/Delphi/create-an-object-at-a-given-address.delphi rename to Task/Create-an-object-at-a-given-address/Delphi/create-an-object-at-a-given-address.pas diff --git a/Task/Create-an-object-at-a-given-address/FutureBasic/create-an-object-at-a-given-address.basic b/Task/Create-an-object-at-a-given-address/FutureBasic/create-an-object-at-a-given-address.basic new file mode 100644 index 0000000000..c3b79eb3b6 --- /dev/null +++ b/Task/Create-an-object-at-a-given-address/FutureBasic/create-an-object-at-a-given-address.basic @@ -0,0 +1,24 @@ +include "NSLog.incl" + + +local fn DoIt + NSLog( @"Dimension in integer \"x\", but do not assign it a value.\n" ) + long x + // Note that the @ (at sign) prefixing x is a pointer to its machine address + NSLog( @"The machine address of x is: %p", @x ) + NSLog( @"While x is unassigned, the machine address will contain a garbage value: %ld\n", x ) + + // Assign x a value of 1234 + x = 1234 + NSLog( @"When x is assigned a value of %ld, that value will be stored in the machine address: %p", x, @x ) + NSLog( @"The machine address now contains the value: %ld\n", x ) + + // Reassign x a value of 5678 + x = 5678 + NSLog( @"Wnen x is reassigned the new value %ld, that value will be stored in the existing machine address: %p", x, @x ) + NSLog( @"The machine address now contains the value: %ld\n", x ) +end fn + +fn DoIt + +HandleEvents diff --git a/Task/Create-an-object-at-a-given-address/Julia/create-an-object-at-a-given-address.julia b/Task/Create-an-object-at-a-given-address/Julia/create-an-object-at-a-given-address.jl similarity index 100% rename from Task/Create-an-object-at-a-given-address/Julia/create-an-object-at-a-given-address.julia rename to Task/Create-an-object-at-a-given-address/Julia/create-an-object-at-a-given-address.jl diff --git a/Task/Create-an-object-at-a-given-address/Kotlin/create-an-object-at-a-given-address.kotlin b/Task/Create-an-object-at-a-given-address/Kotlin/create-an-object-at-a-given-address.kts similarity index 100% rename from Task/Create-an-object-at-a-given-address/Kotlin/create-an-object-at-a-given-address.kotlin rename to Task/Create-an-object-at-a-given-address/Kotlin/create-an-object-at-a-given-address.kts diff --git a/Task/Create-an-object-at-a-given-address/PascalABC.NET/create-an-object-at-a-given-address.pas b/Task/Create-an-object-at-a-given-address/PascalABC.NET/create-an-object-at-a-given-address.pas new file mode 100644 index 0000000000..1feef12947 --- /dev/null +++ b/Task/Create-an-object-at-a-given-address/PascalABC.NET/create-an-object-at-a-given-address.pas @@ -0,0 +1,12 @@ +begin + var pi: ^integer; + New(pi); + pi^ := 3; + Writeln(pi,' ',pi^); + pi^ := 5; + Writeln(pi,' ',pi^); + var pi1: ^integer := pi; + pi1^ := 666; + Writeln(pi1,' ',pi1^); + Writeln(pi,' ',pi^); +end. diff --git a/Task/Create-an-object-at-a-given-address/Rust/create-an-object-at-a-given-address.rust b/Task/Create-an-object-at-a-given-address/Rust/create-an-object-at-a-given-address.rs similarity index 100% rename from Task/Create-an-object-at-a-given-address/Rust/create-an-object-at-a-given-address.rust rename to Task/Create-an-object-at-a-given-address/Rust/create-an-object-at-a-given-address.rs diff --git a/Task/Create-an-object-at-a-given-address/V-(Vlang)/create-an-object-at-a-given-address.v b/Task/Create-an-object-at-a-given-address/V-(Vlang)/create-an-object-at-a-given-address.v new file mode 100644 index 0000000000..f0895f2e33 --- /dev/null +++ b/Task/Create-an-object-at-a-given-address/V-(Vlang)/create-an-object-at-a-given-address.v @@ -0,0 +1,22 @@ +fn main() { + // create an integer object + + mut target := 42 + mut target_ref := &target + + println("Here is an integer: ${target}") + + // print the machine address of the object + + println("And its reference is: ${target_ref}") + + // take the address of the object and create another integer object at this address + + unsafe{(*target_ref) = 69} + + println("Newly assigned value is: ${*target_ref}") + + // print the value of this object to verify that it is same as one of the origin + + println("Compared with referent: ${target}") +} diff --git a/Task/Create-an-object-at-a-given-address/Wren/create-an-object-at-a-given-address-1.wren b/Task/Create-an-object-at-a-given-address/Wren/create-an-object-at-a-given-address-1.wren index d71d23fd4c..a0686fcbd8 100644 --- a/Task/Create-an-object-at-a-given-address/Wren/create-an-object-at-a-given-address-1.wren +++ b/Task/Create-an-object-at-a-given-address/Wren/create-an-object-at-a-given-address-1.wren @@ -1,4 +1,4 @@ -/* create_object_at_given_address.wren */ +/* Create_an_object_at_a_given_address.wren */ import "./fmt" for Fmt diff --git a/Task/Create-an-object-at-a-given-address/Wren/create-an-object-at-a-given-address-2.wren b/Task/Create-an-object-at-a-given-address/Wren/create-an-object-at-a-given-address-2.wren index ce8f1e121b..cb93454cc9 100644 --- a/Task/Create-an-object-at-a-given-address/Wren/create-an-object-at-a-given-address-2.wren +++ b/Task/Create-an-object-at-a-given-address/Wren/create-an-object-at-a-given-address-2.wren @@ -1,4 +1,4 @@ -/* gcc create_object_at_given_address.c -o create_object_at_given_address -lwren -lm */ +/* gcc Create_an_object_at_a_given_address.c -o Create_an_object_at_a_given_address -lwren -lm */ #include #include @@ -113,7 +113,7 @@ int main(int argc, char **argv) { config.loadModuleFn = &loadModule; WrenVM* vm = wrenNewVM(&config); const char* module = "main"; - const char* fileName = "create_object_at_given_address.wren"; + const char* fileName = "Create_an_object_at_a_given_address.wren"; char *script = readFile(fileName); WrenInterpretResult result = wrenInterpret(vm, module, script); switch (result) { diff --git a/Task/Create-an-object-at-a-given-address/XPL0/create-an-object-at-a-given-address.xpl0 b/Task/Create-an-object-at-a-given-address/XPL0/create-an-object-at-a-given-address.xpl0 new file mode 100644 index 0000000000..fd3ff6cb00 --- /dev/null +++ b/Task/Create-an-object-at-a-given-address/XPL0/create-an-object-at-a-given-address.xpl0 @@ -0,0 +1,15 @@ +int Obj; \create an integer object +char Addr; +[HexOut(0, @Obj); \print the machine address of the object (relative to some base) +CrLf(0); +Addr:= @Obj; \take the address of the object and +Addr(0):= $78; \ create another integer object at this address +Addr(1):= $56; +Addr(2):= $34; +Addr(3):= $12; +HexOut(0, Obj); \print the value of this object to verify that +CrLf(0); \ it is same as one of the origin +Obj:= $DEADBEEF; \change the value of the origin and verify it again +HexOut(0, Obj); +CrLf(0); +] diff --git a/Task/Cuban-primes/ALGOL-68/cuban-primes.alg b/Task/Cuban-primes/ALGOL-68/cuban-primes.alg index 781a845dec..d3121f0c9c 100644 --- a/Task/Cuban-primes/ALGOL-68/cuban-primes.alg +++ b/Task/Cuban-primes/ALGOL-68/cuban-primes.alg @@ -2,7 +2,7 @@ BEGIN # find some cuban primes (using the definition: a prime p is a cuban prime if # # p = n^3 - ( n - 1 )^3 # # for some n > 0) # - + PR read "primes.incl.a68" PR # include prime utilities # # returns a string representation of n with commas # PROC commatise = ( LONG INT n )STRING: BEGIN @@ -18,32 +18,15 @@ BEGIN result END # commatise # ; - # sieve the primes # INT sieve max = 2 000 000; - [ sieve max ]BOOL sieve; FOR i TO UPB sieve DO sieve[ i ] := TRUE OD; - sieve[ 1 ] := FALSE; - FOR s FROM 2 TO ENTIER sqrt( sieve max ) DO - IF sieve[ s ] THEN - FOR p FROM s * s BY s TO sieve max DO sieve[ p ] := FALSE OD - FI - OD; - # count the primes, we can ignore 2, as we know it isn't a cuban prime # - sieve[ 2 ] := FALSE; - INT prime count := 0; - FOR s TO UPB sieve DO IF sieve[ s ] THEN prime count +:= 1 FI OD; - # construct a list of the primes # - [ 1 : prime count ]INT primes; - INT prime pos := LWB primes; - FOR s FROM LWB sieve TO UPB sieve DO - IF sieve[ s ] THEN primes[ prime pos ] := s; prime pos +:= 1 FI - OD; + []BOOL sieve = PRIMESIEVE sieve max; # sieve the primes to max sieve # # find the cuban primes # INT cuban count := 0; LONG INT final cuban := 0; INT max cuban = 100 000; # mximum number of cubans to find # INT print limit = 200; # show all cubans up to this one # - print( ( "First ", commatise( print limit ), " cuban primes: ", newline ) ); + print( ( "First ", commatise( print limit ), " cuban primes:", newline ) ); LONG INT prev cube := 1; FOR n FROM 2 WHILE LONG INT this cube = ( LENG n * n ) * n; @@ -51,15 +34,10 @@ BEGIN prev cube := this cube; IF ODD p THEN # 2 is not a cuban prime so we only test odd numbers # - BOOL is prime := TRUE; - INT max factor = SHORTEN ENTIER long sqrt( p ); - FOR f FROM LWB primes WHILE is prime AND primes[ f ] <= max factor DO - is prime := p MOD primes[ f ] /= 0 - OD; - IF is prime THEN + IF IF p <= UPB sieve THEN sieve[ SHORTEN p ] ELSE is probably prime( p ) FI + THEN # have a cuban prime # - cuban count +:= 1; - IF cuban count <= print limit THEN + IF ( cuban count +:= 1 ) <= print limit THEN # must show this cuban # STRING p formatted = commatise( p ); print( ( " "[ UPB p formatted : ], p formatted ) ); diff --git a/Task/Cuban-primes/AWK/cuban-primes.awk b/Task/Cuban-primes/AWK/cuban-primes.awk new file mode 100644 index 0000000000..93acddba9e --- /dev/null +++ b/Task/Cuban-primes/AWK/cuban-primes.awk @@ -0,0 +1,28 @@ +# syntax: GAWK -f CUBAN_PRIMES.AWK +# converted from EasyLang +BEGIN { + limit = 200 + printf("The first %d cuban primes are:\n",limit) + while (count < 10000 ) { + i++ + di = 3 * i * (i + 1) + 1 + if (is_prime(di) == 1) { + if (++count <= limit) { + printf("%8d%s",di,count%10?"":"\n") + } + } + } + printf("\ncuban prime # %d is: %'d\n",count,di) + exit(0) +} +function is_prime(x, i) { + if (x <= 1) { + return(0) + } + for (i=2; i<=int(sqrt(x)); i++) { + if (x % i == 0) { + return(0) + } + } + return(1) +} diff --git a/Task/Cuban-primes/Ada/cuban-primes.adb b/Task/Cuban-primes/Ada/cuban-primes.adb new file mode 100644 index 0000000000..d824856bc4 --- /dev/null +++ b/Task/Cuban-primes/Ada/cuban-primes.adb @@ -0,0 +1,136 @@ +-- Rosetta Code Task written in Ada +-- Cuban primes (related to "Cubes", not "Cubans") +-- https://rosettacode.org/wiki/Cuban_primes +-- July 2024, R. B. E. + +-- Using this Cuban Primes Definition: primes of the form: n^3 - (n-1)^3. + +-- ToDo: +-- Commatize the results (an advanced subtask) +-- Could replace the "activity dots" generated during the big calculations with a spinner + +-- NOTE: Using GNAT Big_Numbers package. +-- Takes a very long time to generate the 100_000th cuban prime: about 75 minutes on a M1 Mac Mini. + +pragma Ada_2022; +with Ada.Text_IO; use Ada.Text_IO; +with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; +with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions; +with Ada.Numerics.Big_Numbers.Big_Integers; use Ada.Numerics.Big_Numbers.Big_Integers; +with Ada.Strings; use Ada.Strings; +with Ada.Strings.Fixed; use Ada.Strings.Fixed; +with Ada.Strings.Maps; use Ada.Strings.Maps; +with Ada.Real_Time; use Ada.Real_Time; + +procedure Cuban_Primes is + + function Is_Prime (A : Positive) return Boolean is + D : Positive; + begin + if A < 2 then + return False; + end if; + if A in 2 .. 3 then + return True; + end if; + if A mod 2 = 0 then + return False; + end if; + if A mod 3 = 0 then + return False; + end if; + D := 5; + while D * D <= A loop + if A mod D = 0 then + return False; + end if; + D := D + 2; + if A mod D = 0 then + return False; + end if; + D := D + 4; + end loop; + return True; + end Is_Prime; + + function Is_Prime (A : Big_Natural) return Boolean is + D : Big_Natural; + B0 : constant Big_Natural := To_Big_Integer (0); + B1 : constant Big_Natural := To_Big_Integer (1); + B2 : constant Big_Natural := To_Big_Integer (2); + B3 : constant Big_Natural := To_Big_Integer (3); + B4 : constant Big_Natural := To_Big_Integer (4); + B5 : constant Big_Natural := To_Big_Integer (5); + begin + if A < B2 then + return False; + end if; + if (A = B2) or (A = B3) then + return True; + end if; + if A mod B2 = B0 then + return False; + end if; + if A mod B3 = B0 then + return False; + end if; + D := B5; + while D * D <= A loop + if A mod D = B0 then + return False; + end if; + D := D + B2; + if A mod D = B0 then + return False; + end if; + D := D + B4; + end loop; + return True; + end Is_Prime; + + Cuban_Count : Natural := 1; + Candidate : Natural; + Big_Candidate : Big_Natural; + Max_Cuban_for_the_Table : constant Integer := 200; + Max_Cuban_below_the_Table : constant Integer := 100_000; + Start_Time, Stop_Time : Time; + Elapsed_Time : Time_Span; + +begin + Put ("The first "); + Put (Max_Cuban_for_the_Table, 1); + Put_Line (" Cuban Primes..."); + for I in 1 .. Integer'Last loop + Candidate := ((I + 1) ** 3) - (I ** 3); + if Is_Prime (Candidate) then + Put (Candidate, 8); + if ((Cuban_Count rem 14) = 0) then + New_Line; + end if; + Cuban_Count := Cuban_Count + 1; + end if; + exit when Cuban_Count > Max_Cuban_for_the_Table; + end loop; + New_Line (2); + Cuban_Count := 1; + Start_Time := Clock; + Put ("The "); + Put (Max_Cuban_below_the_Table, 1); + Put ("th Cuban Prime is: "); + for I in 1 .. Integer'Last loop + Big_Candidate := (((To_Big_Integer (I) + 1) ** 3) - (To_Big_Integer (I) ** 3)); + if Is_Prime (Big_Candidate) then + Cuban_Count := Cuban_Count + 1; + if (Cuban_Count rem 10_000) = 0 then + Put ("."); + end if; + end if; + exit when Cuban_Count = Max_Cuban_below_the_Table; + end loop; + New_Line; + Put (Trim (To_String (Big_Candidate), Right)); + Stop_Time := Clock; + Elapsed_Time := Stop_Time - Start_Time; + New_Line; + Put_Line ("Elapsed time to calculate: " & Duration'Image (To_Duration (Elapsed_Time)) & " seconds"); +end Cuban_Primes; diff --git a/Task/Cuban-primes/EasyLang/cuban-primes.easy b/Task/Cuban-primes/EasyLang/cuban-primes.easy new file mode 100644 index 0000000000..8140fa46a5 --- /dev/null +++ b/Task/Cuban-primes/EasyLang/cuban-primes.easy @@ -0,0 +1,24 @@ +fastfunc isprim num . + if num mod 2 = 0 : return 0 + if num mod 3 = 0 : return 0 + i = 5 + while i <= sqrt num + if num mod i = 0 : return 0 + i += 2 + if num mod i = 0 : return 0 + i += 4 + . + return 1 +. +i = 1 +while cnt < 50000 + di = 3 * i * (i + 1) + 1 + if isprim di = 1 + cnt += 1 + if cnt <= 200 : write di & " " + . + i += 1 +. +print "" +print "" +print di diff --git a/Task/Cuban-primes/Fortran/cuban-primes.f b/Task/Cuban-primes/Fortran/cuban-primes.f new file mode 100644 index 0000000000..d2dcee4458 --- /dev/null +++ b/Task/Cuban-primes/Fortran/cuban-primes.f @@ -0,0 +1,201 @@ +! Cuban Prime Numbers +! tested with GNU Fortran (Ubuntu 14.2.0-19ubuntu2) 14.2.0 on Kubuntu 25.04 +! +! Note that both intel ifx and VSI Fortran do not compile this code because they do not +! support 16-byte-integers. +! +! U.B., September 2025 +! + +program CubanPrimes + implicit none + + integer, parameter :: llint=16 + integer, parameter ::strLen = 20 + + integer (kind=llint) :: nc = 0, i=0, di + character (len=strLen) :: sdi ! for formatted output of di + + write (*, *) 'The first 200 cuban prime numbers are:' + do while (nc .lt. 100001) + di = diff_cubes(i) + if (isprime(di)) then + nc = nc + 1 + if (nc .le. 200) then + sdi = GroupedDigits (di, 10) + write (*, '(A10)', advance='no') sdi + if (mod (nc,10) .eq. 0 ) then + write (*,*) + end if + end if + if (nc .eq. 100000) then + sdi = GroupedDigits (di, 18) + write (*,'(//"The 100000th cuban prime number is: ", A)') sdi + exit + end if + end if + i = i + 1 + end do + + + contains + + !------------------------------------------------ + ! Calculate difference (n+1)³ - n³ = 3n² + 3n + 1 + !------------------------------------------------ + function diff_cubes( n ) result (n3) + integer (kind=llint),intent(in) ::n + integer (kind=llint) :: n3 + n3 = 3*n*(n+1) + 1 + end function + + + ! ---------------------------------------------------------------- + ! Fortran does not have a way to use locales for output. + ! Manual insert of separating commas such as 1,345,678 for 1345678 + ! ---------------------------------------------------------------- + function GroupedDigits (n, width) result (outStr) + integer(kind=llint), intent (in) :: n + integer :: width + character (len=width) :: outStr + character (len=2*strLen) :: workStr + integer :: ii, jj, cnt, trueLen + + + ! Write n into a string, then copy the digits to a second string, + ! inserting separater after every 3 digits. + write (workStr, '(i0)') n + ! Adjust left, then cutoff trailing blanks + workstr = adjustl (workstr) + trueLen = len_trim (workStr) + + outStr = ' ' + jj = width + cnt = 0 + do ii=trueLen, 1, -1 ! Copy backwards for correct grouping. + outStr (jj:jj) = workStr (ii:ii) + jj = jj -1 + cnt = cnt + 1 + ! Insert comma after 3 digits, but only if more digits follow. + if (mod (cnt, 3) .eq. 0 .and. ii .gt. 1 .and. workStr(ii-1:ii-1) .ne. ' ') then + outStr (jj:jj) = ',' + jj = jj - 1 + endif + end do + + end function GroupedDigits + + + + + + + ! ---------------------------------------- + ! Miller-Rabin test if n is a prime number + ! ---------------------------------------- + function isPrime(n) result (YN) + + integer(kind=llint), intent(in) ::n + logical :: YN + integer (kind=llint) :: ar (5), i + + ! Early return in most trivial cases + if (n .le. 1) then ! Too small + YN=.false. + return + endif + if (n .eq. 2) then ! 2 is prime + YN=.true. + return + endif + if (mod (n , 2) .eq. 0) then ! all other even number are not prime + YN=.false. + return + endif + if (n .lt. 9) then ! all odd numbers < 9 are prime + YN=.true. + return + endif + if (mod (n , 3) .eq. 0) then ! multiples of 3 aren't prime + YN=.false. + return + endif + if (mod (n , 5) .eq. 0) then ! multiples of 5 aren't prime + YN=.false. + return + endif + + ! these 5 bases are required and sufficient to test numbers up to 2,152,302,898,747 + ar(1) = 2 + ar(2) = 3 + ar(3) = 5 + ar(4) = 7 + ar(5) = 11 + do i = 1, 5 + if (Witness(ar(i), n)) then + YN=.false. ! Not prime + return + endif + end do + YN= .true. ! prime + + end function isPrime + + ! ------------------------------------- + ! helper function for Miller Rabin test + ! ------------------------------------- + function Witness(a, n) result (YN) + + integer (kind=llint) , intent(in) :: a + integer (kind=llint) , intent(in) :: n + + + integer (kind=llint) :: t, u, i + logical :: YN + integer (kind=llint) :: xi1, xi2 + + t = 0 + u = n - 1 + do while (iand(u , 1_llint) .eq. 0) + t = t + 1 + u = u / 2 + end do + + xi1 = ModularExp(a, u, n); + do i = 0, t-1 + xi2 = mod (xi1 * xi1 , n) + if ((xi2 .eq. 1) .and. (xi1 .ne. 1) .and. (xi1 .ne. (n - 1))) then + YN = .true. + return + endif + xi1 = xi2 + end do + if (xi1 .ne. 1) then + YN=.true. + else + YN = .false. + endif + end function Witness + + ! ------------------------------------- + ! helper function for Miller Rabin test + ! ------------------------------------- + function ModularExp(a, b, n) result(d) + + integer(kind=llint) , intent(in) :: a,b,n + integer (kind=llint) :: d + integer (kind=llint) :: i, k + d = 1 + k = 0 + do while (ishft (b, -k) .gt. 0) + k = k + 1 + end do + do i = k - 1, 0, -1 + d = mod (d*d, n) + if (iand (ishft (b, -i) , 1_llint) .gt. 0) d = mod (d*a ,n); + end do + + end function ModularExp + + +end program diff --git a/Task/Cuban-primes/FutureBasic/cuban-primes.basic b/Task/Cuban-primes/FutureBasic/cuban-primes.basic new file mode 100644 index 0000000000..3bbad2af09 --- /dev/null +++ b/Task/Cuban-primes/FutureBasic/cuban-primes.basic @@ -0,0 +1,40 @@ +BBOOL local fn IsPrime( p as UInt64 ) + if ( p < 2 ) then return NO + if ( p % 2 == 0 ) then return ( p == 2 ) + UInt64 limit = fn sqrt( (double)p ) + for UInt64 i = 3 to limit step 2 + if ( p % i == 0 ) then return NO + next +end fn = YES + +local fn CubanPrimes( howMany as NSUInteger ) + CFMutableArrayRef cubanPrimes = fn MutableArrayNew + UInt64 n = 1 + + while ( fn ArrayCount( cubanPrimes ) < howMany ) + UInt64 p = 3 * n * n + 3 * n + 1 + if ( fn IsPrime( p ) ) + MutableArrayAddObject( cubanPrimes, @(p) ) + end if + n++ + wend + + printf @"\nFirst 200 Cuban primes:\n" + for NSUInteger i = 0 to fn ArrayCount( cubanPrimes ) - 1 + printf @"%7lu\b", fn NumberUnsignedLongValue( cubanPrimes[i] ) + if ( i < fn ArrayCount( cubanPrimes ) - 1 ) + if ( i % 8 == 7 ) + print + else + print @"\t" + end if + end if + next + print +end fn + +window 1, @"cuban Primes", ( 0, 0, 630, 440 ) + +fn CubanPrimes( 200 ) + +HandleEvents diff --git a/Task/Cuban-primes/JavaScript/cuban-primes.js b/Task/Cuban-primes/JavaScript/cuban-primes.js new file mode 100644 index 0000000000..86fd7b9358 --- /dev/null +++ b/Task/Cuban-primes/JavaScript/cuban-primes.js @@ -0,0 +1,68 @@ +const MAX = 1400000; +const primes = new Array(MAX); + +function preCompute() { + // Initialize sieve + for (let i = 2; i < MAX; i++) { + primes[i] = true; + } + + // Sieve of Eratosthenes + for (let i = 2; i < MAX; i++) { + if (primes[i]) { + for (let j = 2 * i; j < MAX; j += i) { + primes[j] = false; + } + } + } +} + +function isPrime(n) { + if (n < MAX) { + return primes[n]; + } + const max = Math.floor(Math.sqrt(n)); + for (let i = 3; i <= max; i++) { + if (primes[i] && n % i === 0) { + return false; + } + } + return true; +} + +function cubanPrime(n, display) { + let count = 0; + let result = 0; + let output = ''; + + for (let i = 0; count < n; i++) { + const test = 1 + 3 * i * (i + 1); + if (isPrime(test)) { + count++; + result = test; + if (display) { + const formatted = test.toLocaleString('en-US').padStart(10); + output += formatted + (count % 10 === 0 ? '\n' : ''); + } + } + } + + if (display) { + console.log(output); + } + return result; +} + +// Main execution +preCompute(); + +// First 200 Cuban primes +cubanPrime(200, true); +console.log(); + +// Specific Cuban primes +for (let i = 1; i <= 5; i++) { + const max = Math.pow(10, i); + const prime = cubanPrime(max, false); + console.log(`${max.toLocaleString('en-US')}-th cuban prime = ${prime.toLocaleString('en-US')}`); +} diff --git a/Task/Cuban-primes/Julia/cuban-primes.julia b/Task/Cuban-primes/Julia/cuban-primes.jl similarity index 100% rename from Task/Cuban-primes/Julia/cuban-primes.julia rename to Task/Cuban-primes/Julia/cuban-primes.jl diff --git a/Task/Cuban-primes/Kotlin/cuban-primes.kotlin b/Task/Cuban-primes/Kotlin/cuban-primes.kts similarity index 100% rename from Task/Cuban-primes/Kotlin/cuban-primes.kotlin rename to Task/Cuban-primes/Kotlin/cuban-primes.kts diff --git a/Task/Cuban-primes/OCaml/cuban-primes.ml b/Task/Cuban-primes/OCaml/cuban-primes.ml new file mode 100644 index 0000000000..af8c106059 --- /dev/null +++ b/Task/Cuban-primes/OCaml/cuban-primes.ml @@ -0,0 +1,51 @@ +let is_prime (n : int) : bool = + if n = 2 then true else if n < 2 || n mod 2 = 0 then false else + let lim = (n |> float_of_int |> sqrt |> int_of_float) + 1 in + let rec loop = function + | i when i > lim -> true + | i when n mod i = 0 -> false + | i -> loop (i + 2) + in loop 3 + +let char_list_of_string s = List.init (String.length s) (String.get s) + +let commatize (str : string) : string = + let revchars = List.rev (char_list_of_string str) in + let rec take_threes = function + | s, c1 :: c2 :: c3 :: rest -> + take_threes ([c3; c2; c1] :: s, rest) + | ss, rest -> if rest = [] then ss else List.rev rest :: ss + in take_threes ([], List.map Char.escaped revchars) + |> List.map (String.concat "") |> String.concat "," + +let cube (n: int) : int = n * n * n + +let scan_for_cubans (num : int) : int list = + let rec loop = function + | n, ps when List.length ps >= num -> ps + | n, ps -> + let c = cube (n + 1) - cube n in + if is_prime c then loop (n + 1, c :: ps) + else loop (n + 1, ps) in + loop (1, []) |> List.rev + +let nth_cuban (n : int) : int = + let rec loop = function + | i, c, p when c = n -> p + | i, c, p -> + let k = cube (i + 1) - cube i in + if is_prime k then loop (i + 1, c + 1, k) + else loop (i + 1, c, p) in + loop (0, 0, 0) + +let () = + print_endline "The first 200 cuban primes are: "; + scan_for_cubans 200 + |> List.map string_of_int + |> List.map commatize + |> String.concat " | " + |> Printf.printf "[%s]\n\n"; + nth_cuban 100_000 + |> string_of_int + |> commatize + |> Printf.printf "The 100,000th cuban prime is %s\n" diff --git a/Task/Cuban-primes/PARI-GP/cuban-primes.parigp b/Task/Cuban-primes/PARI-GP/cuban-primes.parigp new file mode 100644 index 0000000000..8a6da33165 --- /dev/null +++ b/Task/Cuban-primes/PARI-GP/cuban-primes.parigp @@ -0,0 +1,25 @@ +cubanprimes(N) = +{ + cubans = vector(N); + cube1 = 1; count = 1; cube100k = 0; + for (i=1, +oo, + cube2 = (i + 1)^3; + diff = cube2 - cube1; + if (isprime(diff), + if (count <= N, cubans[count] = diff); + if (count == 100000, cube100k = diff; break); + count++; + ); + cube1 = cube2; + ); + print("The first " N " Cuban primes are: "); + for (i=1, N, + if (cubans[i] != 0, + print1(cubans[i], " "); + if (i % 8 == 0, print); + ); + ); + print("\nThe 100,000th Cuban prime is " cube100k); +} + +cubanprimes(200); diff --git a/Task/Cuban-primes/PascalABC.NET/cuban-primes.pas b/Task/Cuban-primes/PascalABC.NET/cuban-primes.pas new file mode 100644 index 0000000000..f54de0f00f --- /dev/null +++ b/Task/Cuban-primes/PascalABC.NET/cuban-primes.pas @@ -0,0 +1,67 @@ +const + cutOff = 200; + bigUn = 100000; + chunks = 50; + little = bigUn div chunks; + +begin + writeln('The first ', cutOff, ' cuban primes:'); + var primes := |int64(3), int64(5)|.ToList; + var c := 0; + var u: int64 := 0; + var v: int64 := 1; + var showEach := true; + while true do + begin + var found := false; + u += 6; + v += u; + var mx := real(v).sqrt.ceil; + foreach var item in primes do + begin + if item > mx then break; + if v mod item = 0 then + begin + found := true; + break + end; + end; + if not found then + begin + c += 1; + if showEach then + begin + for var z := primes.last + 2 to v - 2 step 2 do + begin + var fnd := false; + foreach var item in primes do + begin + if item > mx then break; + if z mod item = 0 then + begin + fnd := true; + break + end; + end; + if not fnd then primes.Add(z); + end; + primes.Add(v); + write(v:9); + if c mod 10 = 0 then writeln; + if c = cutOff then + begin + showEach := false; + write('Progress to the ', bigUn, 'th cuban prime: ') + end; + end; + if c mod little = 0 then + begin + write('.'); + if c = bigUn then break; + end; + end; + end; + writeln(); + writeln('The ', c, 'th cuban prime is ', v); + writeln('Computation time was ', milliseconds / 1000, ' seconds'); +end. diff --git a/Task/Cuban-primes/Phix/cuban-primes.phix b/Task/Cuban-primes/Phix/cuban-primes.phix index 29da36d962..7aa90398b7 100644 --- a/Task/Cuban-primes/Phix/cuban-primes.phix +++ b/Task/Cuban-primes/Phix/cuban-primes.phix @@ -1,34 +1,32 @@ -(phixonline)--> - with javascript_semantics - include mpfr.e - integer np = 0, - i = 2 - mpz p3 = mpz_init(1*1*1), - i3 = mpz_init(), - p = mpz_init(), - pn = mpz_init() +with javascript_semantics +include mpfr.e +integer np = 0, + i = 2 +mpz p3 = mpz_init(1*1*1), + i3 = mpz_init(), + p = mpz_init(), + pn = mpz_init() - printf(1,"The first 200 cuban primes are:\n") - sequence first200 = {} - atom t0 = time() - constant lim = iff(platform()=JS?10000:100000) - while np<lim do - mpz_ui_pow_ui(i3,i,3) - mpz_sub(p,i3,p3) - if mpz_prime(p) then - mpz_set(pn,p) - np += 1 - if np<=200 then - first200 = append(first200,sprintf("%,9d",mpz_get_integer(pn))) - if mod(np,10)=0 then - printf(1,"%s\n",join(first200[-10..-1])) - end if - end if - end if - mpz_set(p3,i3) - i += 1 - end while - printf(1,"\nThe %,dth cuban prime is %s\n",{np,mpz_get_str(pn,comma_fill:=true)}) - {p3,i3,p} = mpz_free({p3,i3,p}) - ?elapsed(time()-t0) - - with javascript_semantics - - atom sdn = 0, sdsum = 0, sdsumsq = 0 - - procedure sdadd(atom n) - sdn += 1 - sdsum += n - sdsumsq += n*n - end procedure - - function sdavg() - return sdsum/sdn - end function - - function sddev() - return sqrt(sdsumsq/sdn - power(sdsum/sdn,2)) - end function - - --test code: - constant testset = {2, 4, 4, 4, 5, 5, 7, 9} - integer ti - for i=1 to length(testset) do - ti = testset[i] - sdadd(ti) - printf(1,"N=%d Item=%d Avg=%5.3f StdDev=%5.3f\n",{i,ti,sdavg(),sddev()}) - end for - - with javascript_semantics - atom t0 = time() - function bump(sequence half) - -- add a digit to valid halves - -- eg {0} --> {1..9} (no zeroes) - -- --> {11..99} ("") - -- --> {111..999}, etc - sequence res = {} - for i=1 to length(half) do - integer hi = half[i]*10 - for digit=1 to 9 do - res &= hi+digit - end for - end for - return res - end function +with javascript_semantics +atom t0 = time() +function bump(sequence half) + -- add a digit to valid halves + -- eg {0} --> {1..9} (no zeroes) + -- --> {11..99} ("") + -- --> {111..999}, etc + sequence res = {} + for i=1 to length(half) do + integer hi = half[i]*10 + for digit=1 to 9 do + res &= hi+digit + end for + end for + return res +end function - procedure cyclops(string s="") - sequence res = {}, - half = {0} -- valid digits, see bump() - integer left = 1, -- half[] before the 0 - right = 0, -- half[] after the 0 - hlen = 1, -- length(half) - cpow = 10, -- cyclops power (of 10) - bcpow = 1, -- blind cyclops power - cn = 0 -- cyclops number (scratch) - bool valid = false, - bPrime = match("prime",s), - bBlind = match("blind",s), - bPalin = match("palindromic",s) - while length(res)<50 or cn<=1e7 or not valid do - right += 1 - if right>hlen then - right = 1 - left += 1 - if left>hlen then - half = bump(half) - hlen = length(half) - cpow *= 10 - bcpow *= 10 - left = 1 - end if - end if - integer lh = half[left], - rh = half[right] - cn = lh*cpow+rh -- cyclops number - valid = not bPrime or is_prime(cn) - if valid and bBlind then - valid = is_prime(lh*bcpow+rh) - end if - if valid and bPalin then - valid = sprintf("%d",lh) == reverse(sprintf("%d",rh)) - end if - if valid then - res = append(res,sprintf("%7d",cn)) - end if - end while - printf(1,"First 50 %scyclops numbers:\n%s\n",{s,join_by(res[1..50],1,10)}) - printf(1,"First %scyclops number > 10,000,000: %s at (one based) index: %d\n\n", - {s,res[$],length(res)}) - end procedure +procedure cyclops(string s="") + sequence res = {}, + half = {0} -- valid digits, see bump() + integer left = 1, -- half[] before the 0 + right = 0, -- half[] after the 0 + hlen = 1, -- length(half) + cpow = 10, -- cyclops power (of 10) + bcpow = 1, -- blind cyclops power + cn = 0 -- cyclops number (scratch) + bool valid = false, + bPrime = match("prime",s), + bBlind = match("blind",s), + bPalin = match("palindromic",s) + while length(res)<50 or cn<=1e7 or not valid do + right += 1 + if right>hlen then + right = 1 + left += 1 + if left>hlen then + half = bump(half) + hlen = length(half) + cpow *= 10 + bcpow *= 10 + left = 1 + end if + end if + integer lh = half[left], + rh = half[right] + cn = lh*cpow+rh -- cyclops number + valid = not bPrime or is_prime(cn) + if valid and bBlind then + valid = is_prime(lh*bcpow+rh) + end if + if valid and bPalin then + valid = sprintf("%d",lh) == reverse(sprintf("%d",rh)) + end if + if valid then + res = append(res,sprintf("%7d",cn)) + end if + end while + printf(1,"First 50 %scyclops numbers:\n%s\n",{s,join_by(res[1..50],1,10)}) + printf(1,"First %scyclops number > 10,000,000: %s at (one based) index: %d\n\n", + {s,res[$],length(res)}) +end procedure - cyclops() - cyclops("prime ") - cyclops("blind prime ") - cyclops("palindromic prime ") - ?elapsed(time()-t0) - - with javascript_semantics - atom t0 = time() - function bump(sequence half) -- (exactly the same as above) - -- add a digit to valid halves - -- eg {0} --> {1..9} (no zeroes) - -- --> {11..99} ("") - -- --> {111..999}, etc - sequence res = {} - for i=1 to length(half) do - integer hi = half[i]*10 - for digit=1 to 9 do - res &= hi+digit - end for - end for - return res - end function +with javascript_semantics +atom t0 = time() - sequence half = {0} -- valid digits, see bump() - integer hlen = 1, - cpow = 10 -- cyclops power (of 10) - integer n = 1_000_000_000 - atom hlen2 = 1 - while n>hlen2 do - n -= hlen2 - half = bump(half) - hlen = length(half) - hlen2 = power(hlen,2) - cpow *= 10 - end while - integer left = floor(n/hlen)+1, -- half[] before the 0 - right = remainder(n,hlen)+1 -- half[] after the 0 - string fmt = "The 1,000,000,000th cyclops number is %d (%s)\n", - e = elapsed(time()-t0) - printf(1,fmt,{half[left]*cpow+half[right],e}) - - without js - include builtins\cffi.e +without js +include builtins\cffi.e - constant AF_UNSPEC = 0, - -- AF_INET = 2, - -- AF_INET6 = 23, - -- SOCK_STREAM = 1, - SOCK_DGRAM = 2, - -- IPPROTO_TCP = 6, - NI_MAXHOST = 1025, - NI_NUMERICHOST = iff(platform()=LINUX?1:2) +constant AF_UNSPEC = 0, +-- AF_INET = 2, +-- AF_INET6 = 23, +-- SOCK_STREAM = 1, + SOCK_DGRAM = 2, +-- IPPROTO_TCP = 6, + NI_MAXHOST = 1025, + NI_NUMERICHOST = iff(platform()=LINUX?1:2) - constant tWAD = """ - typedef struct WSAData { - WORD wVersion; - WORD wHighVersion; - char szDescription[257]; - char szSystemStatus[129]; - unsigned short iMaxSockets; - unsigned short iMaxUdpDg; - char *lpVendorInfo; - } WSADATA, *LPWSADATA; - """, - tWAS = """ - int WSAStartup( - _In_ WORD wVersionRequested, - _Out_ LPWSADATA lpWSAData - ); - """, - tWAC = """ - int WSACleanup(void); - """, - tAI_W=""" - typedef struct addrinfo { - int ai_flags; - int ai_family; - int ai_socktype; - int ai_protocol; - size_t ai_addrlen; - char *ai_canonname; - struct sockaddr *ai_addr; - struct addrinfo *ai_next; - } ADDRINFOA, *PADDRINFOA; - """, - tAI_L=""" - typedef struct addrinfo { - int ai_flags; - int ai_family; - int ai_socktype; - int ai_protocol; - int ai_addrlen; - struct sockaddr *ai_addr; - char *ai_canonname; - struct addrinfo *ai_next; - }; - """, - tGAI = """ - int getaddrinfo( - _In_opt_ PCSTR pNodeName, - _In_opt_ PCSTR pServiceName, - _In_opt_ const ADDRINFOA *pHints, - _Out_ PADDRINFOA *ppResult - ); - """, - --int getaddrinfo(const char *node, const char *service, - -- const struct addrinfo *hints, - -- struct addrinfo **res); - tGNI = """ - int getnameinfo( - _In_ sockaddr *sa, - _In_ int salen, - _Out_ char *host, - _In_ DWORD hostlen, - _Out_ char *serv, - _In_ DWORD servlen, - _In_ int flags - ); - """, - --int getnameinfo(const struct sockaddr *addr, socklen_t addrlen, - -- char *host, socklen_t hostlen, - -- char *serv, socklen_t servlen, int flags); - tFAI = """ - void freeaddrinfo( - _In_ struct addrinfo *ai - ); - """ - --void freeaddrinfo(struct addrinfo *res); +constant tWAD = """ +typedef struct WSAData { + WORD wVersion; + WORD wHighVersion; + char szDescription[257]; + char szSystemStatus[129]; + unsigned short iMaxSockets; + unsigned short iMaxUdpDg; + char *lpVendorInfo; +} WSADATA, *LPWSADATA; +""", +tWAS = """ +int WSAStartup( + _In_ WORD wVersionRequested, + _Out_ LPWSADATA lpWSAData +); +""", +tWAC = """ +int WSACleanup(void); +""", +tAI_W=""" +typedef struct addrinfo { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + size_t ai_addrlen; + char *ai_canonname; + struct sockaddr *ai_addr; + struct addrinfo *ai_next; +} ADDRINFOA, *PADDRINFOA; +""", +tAI_L=""" +typedef struct addrinfo { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + int ai_addrlen; + struct sockaddr *ai_addr; + char *ai_canonname; + struct addrinfo *ai_next; +}; +""", +tGAI = """ +int getaddrinfo( + _In_opt_ PCSTR pNodeName, + _In_opt_ PCSTR pServiceName, + _In_opt_ const ADDRINFOA *pHints, + _Out_ PADDRINFOA *ppResult +); +""", +--int getaddrinfo(const char *node, const char *service, +-- const struct addrinfo *hints, +-- struct addrinfo **res); +tGNI = """ +int getnameinfo( + _In_ sockaddr *sa, + _In_ int salen, + _Out_ char *host, + _In_ DWORD hostlen, + _Out_ char *serv, + _In_ DWORD servlen, + _In_ int flags +); +""", +--int getnameinfo(const struct sockaddr *addr, socklen_t addrlen, +-- char *host, socklen_t hostlen, +-- char *serv, socklen_t servlen, int flags); +tFAI = """ +void freeaddrinfo( + _In_ struct addrinfo *ai +); +""" +--void freeaddrinfo(struct addrinfo *res); - integer xgetaddrinfo = NULL, xgetnameinfo, xfreeaddrinfo, idAI, - xwsastartup, xwsacleanup, error +integer xgetaddrinfo = NULL, xgetnameinfo, xfreeaddrinfo, idAI, + xwsastartup, xwsacleanup, error - function get_name_info(string fqdn) - if xgetaddrinfo=NULL then - atom lib - if platform()=WINDOWS then - integer idWAD = define_struct(tWAD) - atom pWAD = allocate_struct(idWAD,cleanup:=true) - lib = open_dll("Ws2_32.dll") - xwsastartup = define_cffi_func(lib,tWAS) - xwsacleanup = define_cffi_func(lib,tWAC) - error = c_func(xwsastartup,{#00020002,pWAD}) - if error then ?9/0 end if - idAI = define_struct(tAI_W) - elsif platform()=LINUX then - lib = open_dll("libc.so.6") - idAI = define_struct(tAI_L) - end if - xgetaddrinfo = define_cffi_func(lib,tGAI) - xgetnameinfo = define_cffi_func(lib,tGNI) - xfreeaddrinfo = define_cffi_proc(lib,tFAI) - end if - atom hints = allocate_struct(idAI,cleanup:=true), - res = allocate(machine_word(),cleanup:=true), - host = allocate(NI_MAXHOST,cleanup:=true) - set_struct_field(idAI,hints,"ai_family",AF_UNSPEC) - -- set_struct_field(idAI,hints,"ai_socktype",SOCK_STREAM) - set_struct_field(idAI,hints,"ai_socktype",SOCK_DGRAM) - error = c_func(xgetaddrinfo,{fqdn,NULL,hints,res}) - if error then ?9/0 end if - res = peekNS(res,machine_word(),false) - atom ptr = res - sequence results = {} - while ptr!=NULL do - atom addr = get_struct_field(idAI,ptr,"ai_addr") - integer len = get_struct_field(idAI,ptr,"ai_addrlen") - error = c_func(xgetnameinfo,{addr, len, host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST}) - if error then ?9/0 end if - results = append(results,peek_string(host)) - ptr = get_struct_field(idAI,ptr,"ai_next") - end while - c_proc(xfreeaddrinfo,{res}) - return results - end function +function get_name_info(string fqdn) + if xgetaddrinfo=NULL then + atom lib + if platform()=WINDOWS then + integer idWAD = define_struct(tWAD) + atom pWAD = allocate_struct(idWAD,cleanup:=true) + lib = open_dll("Ws2_32.dll") + xwsastartup = define_cffi_func(lib,tWAS) + xwsacleanup = define_cffi_func(lib,tWAC) + error = c_func(xwsastartup,{#00020002,pWAD}) + if error then ?9/0 end if + idAI = define_struct(tAI_W) + elsif platform()=LINUX then + lib = open_dll("libc.so.6") + idAI = define_struct(tAI_L) + end if + xgetaddrinfo = define_cffi_func(lib,tGAI) + xgetnameinfo = define_cffi_func(lib,tGNI) + xfreeaddrinfo = define_cffi_proc(lib,tFAI) + end if + atom hints = allocate_struct(idAI,cleanup:=true), + res = allocate(machine_word(),cleanup:=true), + host = allocate(NI_MAXHOST,cleanup:=true) + set_struct_field(idAI,hints,"ai_family",AF_UNSPEC) +-- set_struct_field(idAI,hints,"ai_socktype",SOCK_STREAM) + set_struct_field(idAI,hints,"ai_socktype",SOCK_DGRAM) + error = c_func(xgetaddrinfo,{fqdn,NULL,hints,res}) + if error then ?9/0 end if + res = peekNS(res,machine_word(),false) + atom ptr = res + sequence results = {} + while ptr!=NULL do + atom addr = get_struct_field(idAI,ptr,"ai_addr") + integer len = get_struct_field(idAI,ptr,"ai_addrlen") + error = c_func(xgetnameinfo,{addr, len, host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST}) + if error then ?9/0 end if + results = append(results,peek_string(host)) + ptr = get_struct_field(idAI,ptr,"ai_next") + end while + c_proc(xfreeaddrinfo,{res}) + return results +end function - procedure WSACleanup() - if platform()=WINDOWS then - error = c_func(xwsacleanup,{}) - if error then crash("WSACleanup failed: %d\n",{error}) end if - end if - end procedure +procedure WSACleanup() + if platform()=WINDOWS then + error = c_func(xwsacleanup,{}) + if error then crash("WSACleanup failed: %d\n",{error}) end if + end if +end procedure - ?get_name_info("www.kame.net") - WSACleanup() - - with javascript_semantics - include builtins\timedate.e - ?format_timedate(date(),"YYYY-MM-DD") - ?format_timedate(date(),"Dddd, Mmmm d, YYYY") - - include builtins\timedate.e - set_timedate_formats({"Mmmm d yyyy h:mmpm tz"}) - timedate td = parse_date_string("March 7 2009 7:30pm EST") - atom twelvehours = timedelta(hours:=12) - td = adjust_timedate(td,twelvehours) - ?format_timedate(td) - td = change_timezone(td,"ACDT") -- extra credit - ?format_timedate(td) - td = adjust_timedate(td,timedelta(days:=31*4)) - ?format_timedate(td) - - string deBruijn = "" - for n=0 to 99 do - string a = sprintf("%02d",n) - integer a1 = a[1], - a2 = a[2] - if a2>=a1 then - deBruijn &= iff(a1=a2?a1:a) - for m=n+1 to 99 do - string ms = sprintf("%02d",m) - if ms[2]>a1 then - deBruijn &= a&ms - end if - end for - end if - end for - deBruijn &= "000" - printf(1,"de Bruijn sequence length: %d\n\n",length(deBruijn)) - printf(1,"First 130 characters:\n%s\n\n",deBruijn[1..130]) - printf(1,"Last 130 characters:\n%s\n\n",deBruijn[-130..-1]) +string deBruijn = "" +for n=0 to 99 do + string a = sprintf("%02d",n) + integer a1 = a[1], + a2 = a[2] + if a2>=a1 then + deBruijn &= iff(a1=a2?a1:a) + for m=n+1 to 99 do + string ms = sprintf("%02d",m) + if ms[2]>a1 then + deBruijn &= a&ms + end if + end for + end if +end for +deBruijn &= "000" +printf(1,"de Bruijn sequence length: %d\n\n",length(deBruijn)) +printf(1,"First 130 characters:\n%s\n\n",deBruijn[1..130]) +printf(1,"Last 130 characters:\n%s\n\n",deBruijn[-130..-1]) - function check(string text) - sequence res = {} - sequence found = repeat(0,10000) - integer k - for i=1 to length(text)-3 do - k = to_integer(text[i..i+3],-1)+1 - if k!=0 then found[k] += 1 end if - end for - for i=1 to 10000 do - k = found[i] - if k!=1 then - string e = sprintf("Pin number %04d ",i-1) - e &= iff(k=0?"missing":sprintf("occurs %d times",k)) - res = append(res,e) - end if - end for - k = length(res) - if k=0 then - res = "No errors found" - else - string s = iff(k=1?"":"s") - res = sprintf("%d error%s found:\n ",{k,s})&join(res,"\n ") - end if - return res - end function +function check(string text) + sequence res = {} + sequence found = repeat(0,10000) + integer k + for i=1 to length(text)-3 do + k = to_integer(text[i..i+3],-1)+1 + if k!=0 then found[k] += 1 end if + end for + for i=1 to 10000 do + k = found[i] + if k!=1 then + string e = sprintf("Pin number %04d ",i-1) + e &= iff(k=0?"missing":sprintf("occurs %d times",k)) + res = append(res,e) + end if + end for + k = length(res) + if k=0 then + res = "No errors found" + else + string s = iff(k=1?"":"s") + res = sprintf("%d error%s found:\n ",{k,s})&join(res,"\n ") + end if + return res +end function - printf(1,"Missing 4 digit PINs in this sequence: %s\n", check(deBruijn)) - printf(1,"Missing 4 digit PINs in the reversed sequence: %s\n",check(reverse(deBruijn))) - printf(1,"4444th digit in the sequence: %c (setting it to .)\n", deBruijn[4444]) - deBruijn[4444] = '.' - printf(1,"Re-running checks: %s\n",check(deBruijn)) - n ) + + [ 2dup peek + dip [ over -1 peek ] + swap 2swap poke + -1 poke ] is to-end ( [ n --> [ ) + + [ [] swap + 52 times + [ MCR-rand + over size mod + to-end + -1 split + swap dip join ] + drop ] is mixem ( [ --> [ ) + + [ 4 /mod + $ "A23456789TJQK" + rot peek emit + $ "CDHS" + swap peek emit ] is echocard ( n --> ) + + [ witheach + [ echocard + i^ 8 mod 7 = + iff cr else sp ] ] is echopack ( [ --> ) + + [ MCR-seed replace + newpack + mixem + echopack ] is deal ( n --> ) + + ' [ 1 617 11982 ] + witheach + [ say "Deal #" + dup echo cr + deal cr cr ] diff --git a/Task/Deal-cards-for-FreeCell/Rebol/deal-cards-for-freecell.rebol b/Task/Deal-cards-for-FreeCell/Rebol/deal-cards-for-freecell.rebol new file mode 100644 index 0000000000..2a23ed925a --- /dev/null +++ b/Task/Deal-cards-for-FreeCell/Rebol/deal-cards-for-freecell.rebol @@ -0,0 +1,37 @@ +Rebol [ + title: "Rosetta code: Deal cards for FreeCell" + file: %Deal_cards_for_FreeCell.r3 + url: https://rosettacode.org/wiki/Deal_cards_for_FreeCell +] + +deal-FreeCell: function/with [ + "Deal a FreeCell game by number" + num [integer!] +][ + deck: copy ordered-deck + state: num ; seed the MSLCG + print ["^/Game:" as-green num] + len: length? deck + while [len > 0] [ + ;; pick random remaining card and swap to end + choice: rng % len + 1 + swap (at deck choice) (at deck len) + prin [" " take/last deck] + -- len + if 4 == mod len 8 [prin "^/"] + ] + print "" +][ + ordered-deck: [] + foreach r "A23456789TJQK" [foreach s "♣♦♥♠" [ append ordered-deck ajoin [r s] ] ] + ;; Microsoft linear congruential generator + state: 0 + rng: does [ + state: (state * 214013 + 2531011) & 0#7fffffff + state >> 16 + ] +] + +deal-FreeCell 1 +deal-FreeCell 617 +deal-FreeCell 1 + random 32000 diff --git a/Task/Deal-cards-for-FreeCell/Run-BASIC/deal-cards-for-freecell.basic b/Task/Deal-cards-for-FreeCell/Run-BASIC/deal-cards-for-freecell.basic index 22303022fe..118b197ef2 100644 --- a/Task/Deal-cards-for-FreeCell/Run-BASIC/deal-cards-for-freecell.basic +++ b/Task/Deal-cards-for-FreeCell/Run-BASIC/deal-cards-for-freecell.basic @@ -1,13 +1,13 @@ -projectDir$ = "a_project" ' project directory -imageDir$ = DefaultDir$ + "\projects\" + projectDir$ + "\image\" ' directory of deck images -imagePath$ = "../";projectDir$;"/image/" ' path of deck images +projectDir$ = "a_project" ' project directory +imageDir$ = DefaultDir$ + "\projects\" + projectDir$ + "\image\" ' directory of deck images +imagePath$ = "../";projectDir$;"/image/" ' path of deck images suite$ = "C,D,H,S" ' Club,Diamond,Heart,Spades card$ = "A,2,3,4,5,6,7,8,9,T,J,Q,K" ' Cards Ace to King dim n(55) ' make ordered deck for i = 1 to 52 ' of 52 cards - n(i) = i + n(i) = i next i for i = 1 to 52 * 3 ' shuffle deck 3 times diff --git a/Task/Deal-cards-for-FreeCell/Rust/deal-cards-for-freecell.rust b/Task/Deal-cards-for-FreeCell/Rust/deal-cards-for-freecell.rs similarity index 100% rename from Task/Deal-cards-for-FreeCell/Rust/deal-cards-for-freecell.rust rename to Task/Deal-cards-for-FreeCell/Rust/deal-cards-for-freecell.rs diff --git a/Task/Deal-cards-for-FreeCell/Tcl/deal-cards-for-freecell.tcl b/Task/Deal-cards-for-FreeCell/Tcl/deal-cards-for-freecell.tcl index b7f3813278..1a720c5101 100644 --- a/Task/Deal-cards-for-FreeCell/Tcl/deal-cards-for-freecell.tcl +++ b/Task/Deal-cards-for-FreeCell/Tcl/deal-cards-for-freecell.tcl @@ -6,19 +6,19 @@ proc show cards { set suits {\u2663 \u2666 \u2665 \u2660} set values {A 2 3 4 5 6 7 8 9 T J Q K} for {set i 0} {$i < 52} {incr i} { - set c [lindex $cards $i] - puts -nonewline [format " \033\[%dm%s\033\[m%s" [expr {32-(1+$c)%4/2}] \ - [lindex $suits [expr {$c % 4}]] [lindex $values [expr {$c / 4}]]] - if {($i&7)==7 || $i==51} {puts ""} + set c [lindex $cards $i] + puts -nonewline [format " \033\[%dm%s\033\[m%s" [expr {32-(1+$c)%4/2}] \ + [lindex $suits [expr {$c % 4}]] [lindex $values [expr {$c / 4}]]] + if {($i&7)==7 || $i==51} {puts ""} } } proc deal {seed} { for {set i 0} {$i < 52} {incr i} {lappend cards [expr {51 - $i}]} for {set i 0} {$i < 51} {incr i} { - set j [expr {51 - [rnd]%(52-$i)}] - set tmp [lindex $cards $i] - lset cards $i [lindex $cards $j] - lset cards $j $tmp + set j [expr {51 - [rnd]%(52-$i)}] + set tmp [lindex $cards $i] + lset cards $i [lindex $cards $j] + lset cards $j $tmp } return $cards } diff --git a/Task/Deal-cards-for-FreeCell/TypeScript/deal-cards-for-freecell.ts b/Task/Deal-cards-for-FreeCell/TypeScript/deal-cards-for-freecell.ts new file mode 100644 index 0000000000..127f2fd09c --- /dev/null +++ b/Task/Deal-cards-for-FreeCell/TypeScript/deal-cards-for-freecell.ts @@ -0,0 +1,133 @@ +/* TypeScript code for dealing Microsoft FreeCell / FreeCell Pro deals. + * Copyright by Shlomi Fish, 2011. + * Released under the MIT/Expat License + * ( http://en.wikipedia.org/wiki/MIT_License ). + */ +function perl_range(start: number, end: number): number[] { + const ret: number[] = []; + + for (let i = start; i <= end; ++i) { + ret.push(i); + } + + return ret; +} + +// 33 bit +const MAX_SEED: bigint = (BigInt(1) << BigInt(31 + 2)) - BigInt(1); +const X = BigInt(1) << BigInt(32); + +/* + * Microsoft C Run-time-Library-compatible Random Number Generator + * */ +class MSRand { + private gamenumber: string; + private _seed: bigint; + private _seedx: bigint; + constructor(args) { + const that = this; + that.gamenumber = args.gamenumber; + const _seed = BigInt(that.gamenumber); + that._seed = _seed; + that._seedx = _seed < X ? _seed : _seed - X; + return; + } + public getSeed(): bigint { + const that = this; + return that._seed; + } + private setSeed(seed: bigint): void { + const that = this; + that._seed = seed; + return; + } + + private _rando(): bigint { + const that = this; + that._seedx = + (that._seedx * BigInt(214013) + BigInt(2531011)) & MAX_SEED; + return (that._seedx >> BigInt(16)) & BigInt(0x7fff); + } + private _randp(): bigint { + const that = this; + that._seedx = + (that._seedx * BigInt(214013) + BigInt(2531011)) & MAX_SEED; + return (that._seedx >> BigInt(16)) & BigInt(0xffff); + } + public raw_rand(): bigint { + const that = this; + + if (that._seed < X) { + const ret = that._rando(); + return that._seed < BigInt(0x8) << BigInt(28) + ? ret + : ret | BigInt(0x8000); + } else { + return that._randp() + BigInt(1); + } + } + public max_rand(mymax: bigint): bigint { + const that = this; + return that.raw_rand() % mymax; + } + public shuffle(deck: Array): Array { + const that = this; + if (deck.length) { + let i = deck.length; + while (--i) { + const j = Number(that.max_rand(BigInt(i + 1))); + const tmp = deck[i]; + deck[i] = deck[j]; + deck[j] = tmp; + } + } + return deck; + } +} +/* + * Microsoft Windows Freecell / Freecell Pro boards generation. + * + * See: + * + * - http://rosettacode.org/wiki/Deal_cards_for_FreeCell + * + * - http://www.solitairelaboratory.com/mshuffle.txt + * + * Under MIT/Expat Licence. + * + * */ + +export function deal_ms_fc_board(gamenumber: string): string { + const randomizer = new MSRand({ + gamenumber: gamenumber, + }); + const num_cols: number = 8; + + const columns: Array> = perl_range(0, num_cols - 1).map( + () => { + return []; + }, + ); + let deck: Array = perl_range(0, 4 * 13 - 1); + + randomizer.shuffle(deck); + + deck = deck.reverse(); + + for (let i = 0; i < 52; ++i) { + columns[i % num_cols].push(deck[i]); + } + + function render_card(card: number): String { + const suit = card % 4; + const rank = Math.floor(card / 4); + + return "A23456789TJQK".charAt(rank) + "CDHS".charAt(suit); + } + + function render_column(col: Array): String { + return ": " + col.map(render_card).join(" ") + "\n"; + } + + return columns.map(render_column).join(""); +} diff --git a/Task/Deal-cards-for-FreeCell/UNIX-Shell/deal-cards-for-freecell.sh b/Task/Deal-cards-for-FreeCell/UNIX-Shell/deal-cards-for-freecell.sh index 99294c2331..66ce8c7fcd 100644 --- a/Task/Deal-cards-for-FreeCell/UNIX-Shell/deal-cards-for-freecell.sh +++ b/Task/Deal-cards-for-FreeCell/UNIX-Shell/deal-cards-for-freecell.sh @@ -1,22 +1,22 @@ test $# -gt 0 || set -- $((RANDOM % 32000)) for seed; do - print Game $seed: + print Game $seed: - # Shuffle deck. - deck=({A,{2..9},T,J,Q,K}{C,D,H,S}) - for i in {52..1}; do - ((seed = (214013 * seed + 2531011) & 0x7fffffff)) - ((j = (seed >> 16) % i + 1)) - t=$deck[$i] - deck[$i]=$deck[$j] - deck[$j]=$t - done + # Shuffle deck. + deck=({A,{2..9},T,J,Q,K}{C,D,H,S}) + for i in {52..1}; do + ((seed = (214013 * seed + 2531011) & 0x7fffffff)) + ((j = (seed >> 16) % i + 1)) + t=$deck[$i] + deck[$i]=$deck[$j] + deck[$j]=$t + done - # Deal cards. - print -n ' ' - for i in {52..1}; do - print -n ' '$deck[$i] - ((i % 8 == 5)) && print -n $'\n ' - done - print + # Deal cards. + print -n ' ' + for i in {52..1}; do + print -n ' '$deck[$i] + ((i % 8 == 5)) && print -n $'\n ' + done + print done diff --git a/Task/Deal-cards-for-FreeCell/VBA/deal-cards-for-freecell.vba b/Task/Deal-cards-for-FreeCell/VBA/deal-cards-for-freecell.vba new file mode 100644 index 0000000000..1f1fe6df9a --- /dev/null +++ b/Task/Deal-cards-for-FreeCell/VBA/deal-cards-for-freecell.vba @@ -0,0 +1,61 @@ +Option Explicit +Private stateMS As Variant + +Private Function ms() As Integer + Dim temp1 As Variant, temp2 As Variant, temp3 As Variant + temp1 = CDec(214013 * stateMS + 2531011) + temp2 = temp1 / 2 ^ 31 + temp3 = CDec(WorksheetFunction.Floor_Precise(temp2)) + stateMS = temp1 - (2 ^ 31) * temp3 + ms = stateMS \ 2 ^ 16 +End Function + +Public Sub main() + Dim i As Integer, j As Integer, k As Integer, s As Integer, v As Integer, no As Integer + Dim tmpArr(0 To 51) As Integer + Dim suit As String, value As String, row As String + Dim gameNumbers As Variant + + suit = "CDHS" + value = "A23456789TJQK" + + gameNumbers = Array(1, 617) + + For i = 0 To UBound(gameNumbers) + + stateMS = CDec(gameNumbers(i)) + + For j = 0 To 51 + tmpArr(j) = j + Next j + + For j = 51 To 0 Step -1 + no = ms Mod (j + 1) + Call changePosition(tmpArr(), j, no) + Next j + + Debug.Print "Game " & gameNumbers(i) & ":" + k = 0 + Do While k < 52 + For j = 0 To 7 + s = 1 + tmpArr(51 - k) Mod 4 + v = 1 + tmpArr(51 - k) \ 4 + row = row & Mid(value, v, 1) & Mid(suit, s, 1) & IIf(j < 7 and k < 51, " ", "") + k = k + 1 + If k > 51 Then Exit For + Next j + Debug.Print row + row = "" + Loop + Debug.Print + + Next i + +End Sub + +Private Sub changePosition(ByRef arr() As Integer, pos1 As Integer, pos2 As Integer) + Dim tempPos As String + tempPos = arr(pos1) + arr(pos1) = arr(pos2) + arr(pos2) = tempPos +End Sub diff --git a/Task/Deal-cards-for-FreeCell/Zig/deal-cards-for-freecell.zig b/Task/Deal-cards-for-FreeCell/Zig/deal-cards-for-freecell.zig new file mode 100644 index 0000000000..6715018a48 --- /dev/null +++ b/Task/Deal-cards-for-FreeCell/Zig/deal-cards-for-freecell.zig @@ -0,0 +1,76 @@ +const std = @import("std"); + +const Card = struct { + value: u6 = 0, + + pub fn print(card: Card) void { + const n: u8 = switch (card.value >> 2) { + 0 => 'A', + 1 => '2', + 2 => '3', + 3 => '4', + 4 => '5', + 5 => '6', + 6 => '7', + 7 => '8', + 8 => '9', + 9 => 'T', + 10 => 'J', + 11 => 'Q', + 12 => 'K', + else => unreachable, + }; + const s: u21 = switch (card.value & 0x3) { + 0 => '\u{2663}', // Club + 1 => '\u{2666}', // Diamond + 2 => '\u{2665}', // Heart + 3 => '\u{2660}', // Spade + else => unreachable, + }; + std.debug.print("{c}{u} ", .{ n, s }); + } +}; + +const Rand = struct { + seed: u31 = 0, + pub fn seed(rand: *Rand, value: u31) void { + rand.seed = value; + } + + pub fn next(rand: *Rand) u16 { + const new_seed = rand.seed *% 214013 +% 2531011; + rand.seed = new_seed; + return @truncate(new_seed >> 16); + } +}; + +pub fn deal(n: u31) void { + const print = std.debug.print; + var buffer: [52]u8 = undefined; + var fba = std.heap.FixedBufferAllocator.init(&buffer); + const allocator = fba.allocator(); + + var deck = std.ArrayListUnmanaged(Card).initCapacity(allocator, 52) catch unreachable; + var card: Card = .{}; + + while (card.value < 52) : (card.value += 1) { + deck.appendAssumeCapacity(card); + } + + var col: usize = 0; + var rand = Rand{ .seed = n }; + print("Deal {d}:\n", .{n}); + while (deck.items.len > 0) { + card = deck.swapRemove(rand.next() % deck.items.len); + card.print(); + col = (col + 1) % 8; + if (col == 0) + print("\n", .{}); + } + print("\n\n", .{}); +} + +pub fn main() !void { + deal(1); + deal(617); +} diff --git a/Task/Death-Star/11l/death-star.11l b/Task/Death-Star/11l/death-star.11l index 23b604e42c..629b3b6f51 100644 --- a/Task/Death-Star/11l/death-star.11l +++ b/Task/Death-Star/11l/death-star.11l @@ -1,10 +1,4 @@ -T Sphere - Float cx, cy, cz, r - F (cx, cy, cz, r) - .cx = cx - .cy = cy - .cz = cz - .r = r +T Sphere = (Float cx, Float cy, Float cz, Float r) F dotp(v1, v2) V d = dot(v1, v2) diff --git a/Task/Death-Star/ALGOL-68/death-star.alg b/Task/Death-Star/ALGOL-68/death-star.alg new file mode 100644 index 0000000000..a7b6af136b --- /dev/null +++ b/Task/Death-Star/ALGOL-68/death-star.alg @@ -0,0 +1,86 @@ +BEGIN # draw a "Death Star" - translated from the C and 11l samples # + STRING shades = ".:!*oe&#%@"; + + PROC normalize = ( []REAL v )[]REAL: + BEGIN + REAL len = sqrt( v[ 1 ] * v[ 1 ] + v[ 2 ] * v[ 2 ] + v[ 3 ] * v[ 3 ] ); + ( v[ 1 ] / len, v[ 2 ] / len, v[ 3 ] / len ) + END # normalize # ; + + PROC dot = ( []REAL x, y )REAL: + BEGIN + REAL d = x[ 1 ] * y[ 1 ] + x[ 2 ] * y[ 2 ] + x[ 3 ] * y[ 3 ]; + IF d < 0 THEN - d ELSE 0 FI + END # dot # ; + + MODE SPHERE = STRUCT( REAL cx, cy, cz, r ); + + # positive shpere and negative sphere # + SPHERE pos = ( 20, 20, 0, 20 ), neg = ( 1, 1, -6, 20 ); + + # check if a ray (x,y, -inf)->(x, y, inf) hits a sphere; if so, return # + # the intersecting z values. z1 is closer to the eye # + PROC hit_sphere = ( SPHERE sph, REAL x in, y in, REF REAL z1, z2 )BOOL: + IF REAL x = x in - cx OF sph; + REAL y = y in - cy OF sph; + REAL zsq := r OF sph * r OF sph - ( x * x + y * y ); + zsq < 0 + THEN FALSE + ELSE zsq := sqrt( zsq ); + z1 := cz OF sph - zsq; + z2 := cz OF sph + zsq; + TRUE + FI # hit_sphere # ; + + PROC draw_sphere = ( REAL k, ambient, []REAL light )VOID: + FOR i FROM ENTIER ( cy OF pos - r OF pos ) TO ENTIER ( cy OF pos + r OF pos ) + 1 DO + REAL y := i + 0.5; + FOR j FROM ENTIER ( cx OF pos - 2 * r OF pos ) TO ENTIER (cx OF pos + 2 * r OF pos ) + 1 DO + REAL x := ( j - cx OF pos ) / 2.0 + 0.5 + cx OF pos; + REAL zb1 := 0, zb2 := 0, zs1 := 0, zs2 := 0; + INT hit_result + = IF NOT hit_sphere( pos, x, y, zb1, zb2 ) THEN + 0 # ray lands in blank space, draw bg # + ELIF NOT hit_sphere( neg, x, y, zs1, zs2 ) THEN + 1 # ray hits pos sphere but not neg, draw pos sphere surface # + ELIF zs1 > zb1 THEN + 1 # ray hits both, but pos front surface is closer # + ELIF zs2 > zb2 THEN + 0 # pos sphere surface is inside neg sphere, show bg # + ELIF zs2 > zb1 THEN + 2 # back surface on neg sphere is inside pos sphere, # + # the only place where neg sphere surface will be shown # + ELSE + 1 # show the pos sphere # + FI; + IF hit_result = 0 THEN + print( ( " " ) ) + ELSE + []REAL vec = + normalize( IF hit_result = 1 + THEN []REAL( x - cx OF pos + , y - cy OF pos + , zb1 - cz OF pos + ) + ELSE []REAL( cx OF neg - x + , cy OF neg - y + , cz OF neg - zs2 + ) + FI + ); + REAL b = ( dot( light, vec ) ^ k ) + ambient; + INT intensity := ENTIER ( ( 1 - b ) * ( ( UPB shades - LWB shades ) + 1 ) ) + 1; + IF intensity < LWB shades THEN intensity := LWB shades + ELIF intensity > UPB shades THEN intensity := UPB shades + FI; + print( ( shades[ intensity ] ) ) + FI + OD; + print( ( newline ) ) + OD # draw_sphere # ; + + BEGIN + []REAL light = ( -50, 30, 50 ); + draw_sphere( 2, 0.5, normalize( light ) ) + END +END diff --git a/Task/Death-Star/Ada/death-star.ada b/Task/Death-Star/Ada/death-star.adb similarity index 100% rename from Task/Death-Star/Ada/death-star.ada rename to Task/Death-Star/Ada/death-star.adb diff --git a/Task/Death-Star/Delphi/death-star.delphi b/Task/Death-Star/Delphi/death-star.pas similarity index 100% rename from Task/Death-Star/Delphi/death-star.delphi rename to Task/Death-Star/Delphi/death-star.pas diff --git a/Task/Death-Star/EasyLang/death-star.easy b/Task/Death-Star/EasyLang/death-star.easy new file mode 100644 index 0000000000..1bd9f161cb --- /dev/null +++ b/Task/Death-Star/EasyLang/death-star.easy @@ -0,0 +1,62 @@ +func vdot a[] b[] . + for i to len a[] : r += a[i] * b[i] + return r +. +proc normalize &v[] . + d = vdot v[] v[] + invl = 1 / sqrt d + for i to 3 : v[i] *= invl +. +func testhit &s[] x y &z1 &z2 . + x -= s[1] + y -= s[2] + zsq = s[4] * s[4] - (x * x + y * y) + if zsq >= 0 + zsqrt = sqrt zsq + z1 = s[3] - zsqrt + z2 = s[3] + zsqrt + return 1 + . +. +proc death_star &pos[] &neg[] k amb dir[] . + len vec[] 3 + for y = pos[2] - pos[4] to pos[2] + pos[4] + for x = pos[1] - pos[4] to pos[1] + pos[4] + if testhit pos[] x y zb1 zb2 = 1 + draw = 1 + hit = testhit neg[] x y zs1 zs2 + if hit = 1 + if zs1 > zb1 + hit = 0 + elif zs2 > zb2 + draw = 0 + . + . + if draw = 1 + if hit = 1 + vec[1] = neg[1] - x + vec[2] = neg[2] - y + vec[3] = neg[3] - zs2 + else + vec[1] = x - neg[1] + vec[2] = y - neg[2] + vec[3] = zb1 - neg[3] + . + normalize vec[] + s = vdot dir[] vec[] + if s < 0 : s = 0 + lum = (pow s k + amb) / (1 + amb) + gcolor3 lum lum lum + grect 50 + x / 4, 50 + y / 4, 0.25 0.24 + . + . + . + . +. +gbackground 000 +gclear +dir[] = [ 20 40 -10 ] +normalize dir[] +pos[] = [ 0 0 0 120 ] +neg[] = [ -90 90 -30 100 ] +death_star pos[] neg[] 1.5 0.2 dir[] diff --git a/Task/Death-Star/FreeBASIC/death-star-1.basic b/Task/Death-Star/FreeBASIC/death-star-1.basic new file mode 100644 index 0000000000..9d5cf04046 --- /dev/null +++ b/Task/Death-Star/FreeBASIC/death-star-1.basic @@ -0,0 +1,96 @@ +Enum + x_ + y_ + z_ + r_ +End Enum + +Function clamp(x As Double, b As Double, t As Double) As Double + If x < b Then + Return b + Elseif x > t Then + Return t + Else + Return x + End If +End Function + +Function dot(v() As Double, w() As Double) As Double + Return v(x_) * w(x_) + v(y_) * w(y_) + v(z_) * w(z_) +End Function + +Sub normal(v() As Double, result() As Double) + Dim As Double ilen = 1 / Sqr(dot(v(), v())) + result(x_) = v(x_) * ilen + result(y_) = v(y_) * ilen + result(z_) = v(z_) * ilen +End Sub + +Function hitTest(s() As Double, x As Double, y As Double, result() As Double) As Boolean + Dim As Double z = s(r_)^2 - (x - s(x_))^2 - (y - s(y_))^2 + If z >= 0 Then + z = Sqr(z) + result(0) = s(z_) - z + result(1) = s(z_) + z + Return True + Else + Return False + End If +End Function + +Sub DeathStar(posic() As Double, neg() As Double, sun() As Double, k As Double, amb As Double) + Dim As Double x, y, b + Dim As String shades(10) = {" ", ".", ":", "!", "*", "o", "e", "&", "#", "%", "@"} + Dim As Integer result, shade + Dim As Double hp(1), hn(1), xx(2), temp1(2), temp2(2) + + For y = posic(y_) - posic(r_) - 0.5 To posic(y_) + posic(r_) + 0.5 Step 1 + For x = posic(x_) - posic(r_) - 0.5 To posic(x_) + posic(r_) + 0.5 Step 1 + If hitTest(posic(), x, y, hp()) = 0 Then + result = 0 + Elseif hitTest(neg(), x, y, hn()) = 0 Then + result = 1 + Elseif hn(0) > hp(0) Then + result = 1 + Elseif hn(1) > hp(1) Then + result = 0 + Elseif hn(1) > hp(0) Then + result = 2 + Else + result = 1 + End If + + shade = -1 + Select Case result + Case 0 + shade = 0 + Case 1 + temp1(x_) = x - posic(x_) + temp1(y_) = y - posic(y_) + temp1(z_) = hp(0) - posic(z_) + normal(temp1(), xx()) + Case 2 + temp2(x_) = neg(x_) - x + temp2(y_) = neg(y_) - y + temp2(z_) = neg(z_) - hn(1) + normal(temp2(), xx()) + End Select + If shade <> 0 Then + b = dot(sun(), xx())^k + amb + shade = clamp((1 - b) * Ubound(shades), 1, Ubound(shades)) + End If + Print String(2, shades(shade)); + Next + Print + Next +End Sub + +Dim As Double posic(3) = {20, 20, 0, 20} +Dim As Double neg(3) = {10, 10, -15, 10} +Dim As Double sun(2) +Dim As Double temp3(2) = {-2, 1, 3} +normal(temp3(), sun()) + +DeathStar(posic(), neg(), sun(), 2, 0.1) + +Sleep diff --git a/Task/Death-Star/FreeBASIC/death-star-2.basic b/Task/Death-Star/FreeBASIC/death-star-2.basic new file mode 100644 index 0000000000..008d4ea2d0 --- /dev/null +++ b/Task/Death-Star/FreeBASIC/death-star-2.basic @@ -0,0 +1,100 @@ +Type vector + v(2) As Double +End Type + +Type sphere + cx As Integer + cy As Integer + cz As Integer + r As Integer +End Type + +Function dot(x As vector, y As vector) As Double + Return x.v(0)*y.v(0) + x.v(1)*y.v(1) + x.v(2)*y.v(2) +End Function + +Sub normalizeVector(v As vector) + Dim invLen As Double = 1.0 / Sqr(dot(v, v)) + v.v(0) *= invLen + v.v(1) *= invLen + v.v(2) *= invLen +End Sub + +Function hitSphere(s As sphere, x As Integer, y As Integer, z1 As Double Ptr, z2 As Double Ptr) As Boolean + Dim xx As Integer = x - s.cx + Dim yy As Integer = y - s.cy + Dim zsq As Integer = s.r*s.r - (xx*xx + yy*yy) + + If zsq >= 0 Then + Dim zsqrt As Double = Sqr(zsq) + *z1 = s.cz - zsqrt + *z2 = s.cz + zsqrt + Return True + End If + Return False +End Function + +Function createDeathStar(posic As sphere, neg As sphere, k As Double, amb As Double, direc As vector) As Any Ptr + Dim As Integer w = posic.r * 4 + Dim As Integer h = posic.r * 3 + + Dim As Any Ptr img = Imagecreate(w, h, Rgb(0,0,0)) + + Dim vec As vector + Dim As Double z1, z2, zs1, zs2 + + For y As Integer = posic.cy - posic.r To posic.cy + posic.r + For x As Integer = posic.cx - posic.r To posic.cx + posic.r + If hitSphere(posic, x, y, @z1, @z2) Then + Dim hit As Boolean = hitSphere(neg, x, y, @zs1, @zs2) + + If hit Then + If zs1 > z1 Then hit = False + If zs2 > z2 Then Continue For + End If + + If hit Then + vec.v(0) = neg.cx - x + vec.v(1) = neg.cy - y + vec.v(2) = neg.cz - zs2 + Else + vec.v(0) = x - posic.cx + vec.v(1) = y - posic.cy + vec.v(2) = z1 - posic.cz + End If + + normalizeVector(vec) + Dim s As Double = dot(direc, vec) + If s < 0 Then s = 0 + + Dim lum As Double = 255 * (s^k + amb) / (1 + amb) + If lum < 0 Then lum = 0 + If lum > 255 Then lum = 255 + + Dim shade As Integer = lum + Pset img, (x + w\2, y + h\2), Rgb(shade, shade, shade) + End If + Next x + Next y + + Return img +End Function + +' Main program +Screenres 500, 400, 32 +Windowtitle "Death Star FreeBASIC" + +Dim direct As vector +direct.v(0) = 20 +direct.v(1) = -40 +direct.v(2) = -10 +normalizeVector(direct) + +Dim posic As sphere = Type(0, 0, 0, 120) +Dim neg As sphere = Type(-50, -50, -30, 75) + +Dim img As Any Ptr = createDeathStar(posic, neg, 1.5, 0.2, direct) +Put (0, 0), img +Imagedestroy(img) + +Sleep diff --git a/Task/Death-Star/FutureBasic/death-star-1.basic b/Task/Death-Star/FutureBasic/death-star-1.basic new file mode 100644 index 0000000000..b46ca64359 --- /dev/null +++ b/Task/Death-Star/FutureBasic/death-star-1.basic @@ -0,0 +1,86 @@ +_window = 1 +begin enum 1 + _circularView + _OvalView +end enum + +void local fn BuildWindow + CGRect r = fn CGRectMake( 0, 0, 400, 400 ) + window _window, @"Rosetta Code Death Star", r, NSWindowStyleMaskTitled + NSWindowStyleMaskClosable + NSWindowStyleMaskMiniaturizable + WindowSetBackgroundColor( _window, fn ColorBlack ) + + r = fn CGRectMake( 20, 20, 360, 360 ) + subclass view _circularView, r, _window + + r = fn CGRectMake( 50, 170, 200, 180 ) + subclass view _OvalView,r, _circularView +end fn + +local fn OvalView( tag as NSInteger ) + CGRect r = fn ViewBounds( tag ) + ViewSetWantsLayer( tag, YES ) + CFArrayRef cols = @[fn ColorWithRGB(0.125,0.125,0.125,1),fn ColorWithRGB(0.425,0.425,0.4425,1),fn ColorWithRGB(0.725,0.725,0.725,1),fn ColorWithRGB(0.925,0.925,0.925,1),fn ColorWhite,fn ColorWhite ] + + CALayerRef layer = fn CALayerInit + ViewSetLayer( tag, layer ) + CALayerSetCornerRadius( layer, r.size.height / 2.0 ) + CALayerSetMasksToBounds( layer, YES ) + CALayerSetBorderWidth( layer, 0.25 ) + CALayerSetBorderColor( layer, fn ColorBlue ) + + CAGradientLayerRef gradLayer = fn CAGradientLayerInit + CAGradientLayerSetColors( gradLayer, cols ) + CALayerSetCornerRadius( gradLayer, r.size.Height / 2.0 ) + CAGradientLayerSetStartPoint( gradLayer, fn CGPointMake(1,0) ) + CAGradientLayerSetEndPoint( gradLayer, fn CGPointMake(0,1) ) + CALayerSetShadowOffset( gradLayer, fn CGSizeMake( 10, -10 ) ) + CALayerSetShadowRadius( gradLayer, 3.0 ) + CALayerSetShadowOpacity( gradLayer, 0.4 ) + CALayerSetFrame( gradLayer, fn CGRectMake(0,0,200,200) ) + + CALayerAddSublayer( layer, gradLayer ) +end fn + +local fn CircularView( tag as NSinteger ) + CGRect r = fn ViewBounds( tag ) + ViewSetWantsLayer( tag, YES ) + CFArrayRef cols = @[fn ColorWithRGB(0.125,0.125,0.125,1),fn ColorWithRGB(0.425,0.425,0.4425,1),fn ColorWithRGB(0.725,0.725,0.725,1),fn ColorWithRGB(0.925,0.925,0.925,1),fn ColorWhite,fn ColorWhite ] + CALayerRef layer = fn CALayerInit + + ViewSetLayer( tag, layer ) + CALayerSetCornerRadius( layer, r.size.width / 2.0 ) + CALayerSetMasksToBounds( layer, YES ) + CALayerSetBorderWidth( layer, 0.25 ) + CALayerSetBorderColor( layer, fn ColorBlack ) + + CAGradientLayerRef gradLayer = fn CAGradientLayerInit + CALayerSetCornerRadius( gradLayer, r.size.width / 2.0 ) + CAGradientLayerSetColors( gradLayer, cols ) + CAGradientLayerSetStartPoint( gradLayer, fn CGPointMake( 0,0.2 ) ) + CAGradientLayerSetEndPoint( gradLayer, fn CGPointMake( 1,1 ) ) + CALayerSetShadowOffset( gradLayer, fn CGSizeMake( 10, -10 ) ) + CALayerSetShadowRadius( gradLayer, 3.0 ) + CALayerSetShadowOpacity( gradLayer, 0.4 ) + CALayerSetFrame( gradLayer, fn CGRectMake(0,0,360,360) ) + CALayerAddSublayer( layer, gradLayer ) +end fn + + +void local fn DoDialog( ev as long, tag as long, wnd as long ) + select ( ev ) + case _viewDrawRect + select ( tag ) + case _circularView : fn CircularView( tag ) + + case _OvalView : fn OvalView( tag) + + end select + case _windowWillClose : end + end select +end fn + +on dialog fn DoDialog + +fn BuildWindow + +HandleEvents diff --git a/Task/Death-Star/FutureBasic/death-star-2.basic b/Task/Death-Star/FutureBasic/death-star-2.basic new file mode 100644 index 0000000000..18d86f6adf --- /dev/null +++ b/Task/Death-Star/FutureBasic/death-star-2.basic @@ -0,0 +1,60 @@ +_window = 1 +begin enum 1 + _circularView + _ovalView +end enum + +void local fn BuildWindow + CGRect r = fn CGRectMake( 0, 0, 400, 400 ) + + window _window, @"Death Star", r, NSWindowStyleMaskTitled + NSWindowStyleMaskClosable + NSWindowStyleMaskMiniaturizable + WindowSetBackgroundColor( _window, fn ColorBlack ) + + r = fn CGRectMake( 20, 20, 360, 360 ) + subclass view _circularView, r + + r = fn CGRectMake( 0, 120, 200, 200 ) + subclass view _ovalView, r +end fn + +local fn OvalView( tag as NSInteger ) + CGRect r = fn ViewBounds( tag ) + r.size.height *= 0.5 + CFArrayRef cols = @[fn ColorWithWhite(0.8,1),fn ColorBlack] + BezierPathRef path = fn BezierPathWithOvalInRect( r ) + GradientRef grad = fn GradientWithColors( cols ) + GraphicsContextSaveGraphicsState + AffineTransformRef tx = fn AffineTransformInit + NSPoint center = fn CGPointMake( fn CGRectGetMidX(r), fn CGRectGetMidY(r)) + center.x -= 25 + AffineTransformTranslate( tx, center.x, center.y ) + AffineTransformRotateByDegrees( tx, 52 ) + AffineTransformConcat( tx ) + GradientDrawInBezierPath( grad, path, 0.0 ) + GraphicsContextRestoreGraphicsState +end fn + +local fn CircularView( tag as NSinteger ) + CGRect r = fn ViewBounds( tag ) + CFArrayRef cols = @[fn ColorWithWhite(0.1,1),fn ColorWhite] + BezierPathRef path = fn BezierPathWithOvalInRect( r ) + GradientRef grad = fn GradientWithColors( cols ) + GradientDrawInBezierPath( grad, path, 0.0 ) +end fn + +void local fn DoDialog( ev as long, tag as long ) + select ( ev ) + case _viewDrawRect + select ( tag ) + case _circularView : fn CircularView( tag ) + case _ovalView : fn OvalView( tag) + end select + case _windowWillClose : end + end select +end fn + +on dialog fn DoDialog + +fn BuildWindow + +HandleEvents diff --git a/Task/Death-Star/Julia/death-star.julia b/Task/Death-Star/Julia/death-star.jl similarity index 100% rename from Task/Death-Star/Julia/death-star.julia rename to Task/Death-Star/Julia/death-star.jl diff --git a/Task/Death-Star/V-(Vlang)/death-star.v b/Task/Death-Star/V-(Vlang)/death-star.v new file mode 100644 index 0000000000..255675b459 --- /dev/null +++ b/Task/Death-Star/V-(Vlang)/death-star.v @@ -0,0 +1,106 @@ +import math + +enum Axis { + x_ + y_ + z_ + r_ +} + +fn clamp(x f64, b f64, t f64) f64 { + if x < b { return b } + else if x > t { return t } + else { return x } +} + +fn dot(v []f64, w []f64) f64 { + return v[int(Axis.x_)] * w[int(Axis.x_)] + + v[int(Axis.y_)] * w[int(Axis.y_)] + + v[int(Axis.z_)] * w[int(Axis.z_)] +} + +fn normal(v []f64, mut result []f64) { + ilen := 1.0 / f64(math.sqrt(dot(v, v))) + result[int(Axis.x_)] = v[int(Axis.x_)] * ilen + result[int(Axis.y_)] = v[int(Axis.y_)] * ilen + result[int(Axis.z_)] = v[int(Axis.z_)] * ilen +} + +fn hit_test(s []f64, x f64, y f64, mut result []f64) bool { + mut z := s[int(Axis.r_)] * s[int(Axis.r_)] - (x - s[int(Axis.x_)]) * (x - s[int(Axis.x_)]) - + (y - s[int(Axis.y_)]) * (y - s[int(Axis.y_)]) + if z >= 0 { + z = math.sqrt(z) + result[0] = s[int(Axis.z_)] - z + result[1] = s[int(Axis.z_)] + z + return true + } + else { return false } +} + +fn death_star(posic []f64, neg []f64, sun []f64, k f64, amb f64) { + mut xx, mut temp1, mut temp2 := []f64{len: 3}, []f64{len: 3}, []f64{len: 3} + mut hp, mut hn := []f64{len: 2}, []f64{len: 2} + mut result_val, mut shade := 0, -1 + shades := [' ', '.', ':', '!', '*', 'o', 'e', '&', '#', '%', '@'] + y_start := int(posic[int(Axis.y_)] - posic[int(Axis.r_)] - 0.5) + y_end := int(posic[int(Axis.y_)] + posic[int(Axis.r_)] + 0.5) + x_start := int(posic[int(Axis.x_)] - posic[int(Axis.r_)] - 0.5) + x_end := int(posic[int(Axis.x_)] + posic[int(Axis.r_)] + 0.5) + for y in y_start .. y_end + 1 { + mut line := '' + for x in x_start .. x_end + 1 { + result_val = 0 + if !hit_test(posic, f64(x), f64(y), mut hp) { result_val = 0 } + else if !hit_test(neg, f64(x), f64(y), mut hn) { result_val = 1 } + else if hn[0] > hp[0] { result_val = 1 } + else if hn[1] > hp[1] { result_val = 0 } + else if hn[1] > hp[0] { result_val = 2 } + else { result_val = 1 } + shade = -1 + match result_val { + 0 { + shade = 0 + } + 1 { + temp1[int(Axis.x_)] = f64(x) - posic[int(Axis.x_)] + temp1[int(Axis.y_)] = f64(y) - posic[int(Axis.y_)] + temp1[int(Axis.z_)] = hp[0] - posic[int(Axis.z_)] + normal(temp1, mut xx) + } + 2 { + temp2[int(Axis.x_)] = neg[int(Axis.x_)] - f64(x) + temp2[int(Axis.y_)] = neg[int(Axis.y_)] - f64(y) + temp2[int(Axis.z_)] = neg[int(Axis.z_)] - hn[1] + normal(temp2, mut xx) + } + else {} + } + + if shade != 0 { + b := math.pow(dot(sun, xx), k) + amb + shade = int(clamp((1.0 - b) * f64(shades.len - 1), 1, f64(shades.len - 1))) + } + line += shades[shade].str() + } + println(line) + } +} + +fn main() { + mut posic, mut neg := []f64{len: 4}, []f64{len: 4} + mut temp3, mut sun := []f64{len: 3}, []f64{len: 3} + posic[int(Axis.x_)] = 20 + posic[int(Axis.y_)] = 20 + posic[int(Axis.z_)] = 0 + posic[int(Axis.r_)] = 20 + neg[int(Axis.x_)] = 10 + neg[int(Axis.y_)] = 10 + neg[int(Axis.z_)] = -15 + neg[int(Axis.r_)] = 10 + temp3[0] = -2 + temp3[1] = 1 + temp3[2] = 3 + normal(temp3, mut sun) + death_star(posic, neg, sun, 2, 0.1) +} diff --git a/Task/Death-Star/VBScript/death-star.vb b/Task/Death-Star/VBScript/death-star.vbs similarity index 100% rename from Task/Death-Star/VBScript/death-star.vb rename to Task/Death-Star/VBScript/death-star.vbs diff --git a/Task/Death-Star/Zig/death-star-5.zig b/Task/Death-Star/Zig/death-star-5.zig index af3ddd2aec..97e28f0ac7 100644 --- a/Task/Death-Star/Zig/death-star-5.zig +++ b/Task/Death-Star/Zig/death-star-5.zig @@ -14,9 +14,9 @@ fn Sphere(comptime T: type) type { pub fn hit(self: *const Self, xx: T, yy: T) ?SphereHit(T) { const x = xx - self.cx; const y = yy - self.cy; - var zsq = self.r * self.r - x * x - y * y; + const zsq = self.r * self.r - x * x - y * y; if (zsq >= 0) { - var zsqrt = std.math.sqrt(zsq); + const zsqrt = std.math.sqrt(zsq); return .{ .z1 = self.cz - zsqrt, .z2 = self.cz + zsqrt }; } return null; diff --git a/Task/Death-Star/Zig/death-star-6.zig b/Task/Death-Star/Zig/death-star-6.zig index 4ffc6b3a12..0d5fe2337a 100644 --- a/Task/Death-Star/Zig/death-star-6.zig +++ b/Task/Death-Star/Zig/death-star-6.zig @@ -18,8 +18,8 @@ fn DeathStar(comptime T: type) type { const k: T = 1.5; const amb: T = 0.2; - var w: usize = @intFromFloat(pos.r * 4); - var h: usize = @intFromFloat(pos.r * 3); + const w: usize = @intFromFloat(pos.r * 4); + const h: usize = @intFromFloat(pos.r * 3); var img = try ImageData().init(allocator, "deathStar", w, h); var vec = Vector(T).zero(); diff --git a/Task/Deceptive-numbers/AWK/deceptive-numbers.awk b/Task/Deceptive-numbers/AWK/deceptive-numbers.awk new file mode 100644 index 0000000000..8d742a9243 --- /dev/null +++ b/Task/Deceptive-numbers/AWK/deceptive-numbers.awk @@ -0,0 +1,30 @@ +function modpow(b, e, m, r) { + for (r = 1; e > 0; e = int(e / 2)) { + if (e % 2 == 1) + r = r * b % m + b = b * b % m + } + return r +} + +function is_pseudo(n, i, p, r) { + if (modpow(10, n - 1, n) == 1) { + r = int(sqrt(n)) + while ((p = primes[++i]) <= r) + if (n % p == 0) + return 1 + primes[++l] = n + } + return 0 +} + +BEGIN { + primes[l = 1] = n = 7 + split("4 2 4 2 4 6 2 6", wheel) + + do if (is_pseudo(n += wheel[i = i % 8 + 1])) { + printf " %u", n + ++c + } while (c != 50) + print +} diff --git a/Task/Deceptive-numbers/EasyLang/deceptive-numbers.easy b/Task/Deceptive-numbers/EasyLang/deceptive-numbers.easy new file mode 100644 index 0000000000..6cbd386682 --- /dev/null +++ b/Task/Deceptive-numbers/EasyLang/deceptive-numbers.easy @@ -0,0 +1,31 @@ +func modpow b e m . + r = 1 + while e > 0 + if e mod 2 = 1 + r = r * b mod m + . + b = b * b mod m + e = e div 2 + . + return r +. +func is_deceptive n . + if n mod 2 = 1 and n mod 3 <> 0 and n mod 5 <> 0 + if modpow 10 (n - 1) n = 1 + x = 7 + while x * x <= n + if n mod x = 0 or n mod (x + 4) = 0 + return 1 + . + x += 6 + . + . + . +. +while cnt < 10 + n += 1 + if is_deceptive n = 1 + write n & " " + cnt += 1 + . +. diff --git a/Task/Deceptive-numbers/Forth/deceptive-numbers.fth b/Task/Deceptive-numbers/Forth/deceptive-numbers.fth new file mode 100644 index 0000000000..a3289a799e --- /dev/null +++ b/Task/Deceptive-numbers/Forth/deceptive-numbers.fth @@ -0,0 +1,44 @@ +: modpow { c b a -- a^b mod c } + c 1 = if 0 exit then + 1 + a c mod to a + begin + b 0> + while + b 1 and 1 = if + a * c mod + then + a a * c mod to a + b 2/ to b + repeat ; + +: deceptive? ( n -- ? ) + dup 2 mod 0= if drop false exit then + dup 3 mod 0= if drop false exit then + dup 5 mod 0= if drop false exit then + dup dup 1- 10 modpow 1 <> if drop false exit then + 7 begin + 2dup dup * > + while + 2dup mod 0= if 2drop true exit then + 4 + + 2dup mod 0= if 2drop true exit then + 2 + + repeat + 2drop false ; + +: main ( -- ) + 0 7 begin + over 100 < + while + dup deceptive? if + dup 6 .r + swap 1+ swap + over 10 mod 0= if cr else space then + then + 1+ + repeat + 2drop ; + +main +bye diff --git a/Task/Deceptive-numbers/Free-Pascal-Lazarus/deceptive-numbers.pas b/Task/Deceptive-numbers/Free-Pascal-Lazarus/deceptive-numbers-1.pas similarity index 100% rename from Task/Deceptive-numbers/Free-Pascal-Lazarus/deceptive-numbers.pas rename to Task/Deceptive-numbers/Free-Pascal-Lazarus/deceptive-numbers-1.pas diff --git a/Task/Deceptive-numbers/Free-Pascal-Lazarus/deceptive-numbers-2.pas b/Task/Deceptive-numbers/Free-Pascal-Lazarus/deceptive-numbers-2.pas new file mode 100644 index 0000000000..2a598322af --- /dev/null +++ b/Task/Deceptive-numbers/Free-Pascal-Lazarus/deceptive-numbers-2.pas @@ -0,0 +1,67 @@ +program DeceptiveNumbers; +{$IfDef FPC} {$MODE DELPHI}{$Optimization ON,ALL} {$ENDIF} +{$IfDef Windows} {$APPTYPE CONSOLE} {$ENDIF} +uses + sysutils; +const + LIMIT = 1000; + +function OutN(n,count:Uint64):Uint64; +begin + result := count; + If result mod 8 = 0 then + write(#13#10,count:6); + write(n:10); + inc(result); +end; + +function isPrime(n: UInt64):boolean; +var + p: Uint64; +begin + if n <32 then + if n in [2,3,5,7,11,13,17,19,23,29,31] then + EXIT(true); + + if Not ODD(n) OR ( n MOD 3 = 0) then + EXIT(false); + p := 5; + repeat + if (n mod p=0)or(n mod(p+2)=0) then + EXIT(false); + p +=6; + until p*p>n; + Exit(true); +end; + +function powMod(n,pow,rest: Uint64): Uint64; +begin + result := 1; + while pow > 0 do + begin + if pow mod 2 <> 0 then + result := (result * n) mod rest; + pow := pow div 2; + n := sqr(n) mod rest; + end; +end; + +const + NextNotMulOf235 : array[0..7] of Uint32 = (6,4,2,4,2,4,6,2); +var + n,count,idx235:Uint64; +begin + idx235 := 0; + n := 1; + count := 0; + writeln(' count +1 2 3 4 5 6 7 8'); + repeat + //simple isprime takes mostly more time than powMod + if (powMod(10, n-1, n) = 1) AND Not(isPrime(n)) then + count := OutN(n,count); + inc(n,NextNotMulOf235[idx235]); + idx235 :=(idx235+1) AND 7; + until count >=LIMIT; + + writeln; +END. diff --git a/Task/Deceptive-numbers/FreeBASIC/deceptive-numbers.basic b/Task/Deceptive-numbers/FreeBASIC/deceptive-numbers.basic new file mode 100644 index 0000000000..c94a8eb4bc --- /dev/null +++ b/Task/Deceptive-numbers/FreeBASIC/deceptive-numbers.basic @@ -0,0 +1,33 @@ +Function ModPow(b As Uinteger, e As Uinteger, m As Uinteger) As Uinteger + Dim As Uinteger p = 1 + While e <> 0 + If (e And 1) Then p = (p*b) Mod m + b = (b*b) Mod m + e Shr= 1 + Wend + Return p +End Function + +Function isDeceptive(n As Uinteger) As Uinteger + Dim As Uinteger x + If (n And 1) <> 0 Andalso (n Mod 3) <> 0 Andalso (n Mod 5) <> 0 Then + x = 7 + While x*x <= n + If (n Mod x) = 0 Orelse (n Mod (x+4)) = 0 Then Return (ModPow(10, n-1, n) = 1) + x += 6 + Wend + End If + Return 0 +End Function + +Dim As Uinteger c = 0, i = 49 +While c <> 41 ' limit for signed 32-bit integers + If isDeceptive(i) Then + Print Using "#######"; Csng(i); + c += 1 + If (c Mod 10) = 0 Then Print + End If + i += 1 +Wend + +Sleep diff --git a/Task/Deceptive-numbers/FutureBasic/deceptive-numbers.basic b/Task/Deceptive-numbers/FutureBasic/deceptive-numbers.basic new file mode 100644 index 0000000000..7bcd7c556c --- /dev/null +++ b/Task/Deceptive-numbers/FutureBasic/deceptive-numbers.basic @@ -0,0 +1,84 @@ +// ------------------------------------------------------------ +// Deceptive numbers +// Using FutureBasic 7.0.36 +// November 2025, R.W. +// +// A composite n such that n | R_{n-1}, where +// R_k = (10^k - 1) / 9 is the k-digit repunit. +// ------------------------------------------------------------ + +include "gmp.incl" + +_kPrimeReps = 25 // Miller–Rabin rounds for mpz_probab_prime_p +_kDeceptiveLimit = 152 //should fit in the window +CFTimeInterval t + +// ------------------------------------------------------------ +// Probable prime test using GMP +// Returns _true if n is (probably) prime, _false otherwise. +// ------------------------------------------------------------ +local fn IsProbablePrime( n as UInt32 ) as Boolean + mpz_t z + int r + if n < 2 then RETURN _false + mpz_init( z ) + fn mpz_set_ui( z, n ) + r = fn mpz_probab_prime_p( z, _kPrimeReps ) + mpz_clear( z ) + if r > 0 then RETURN _true +end fn = _false + +// ------------------------------------------------------------ +// Find and print the first `limit` deceptive numbers +// ------------------------------------------------------------ +local fn PrintDeceptiveNumbers( limit as Int ) + mpz_t repunit + long n + int count + mpz_init( repunit ) + fn mpz_set_ui( repunit, 0 ) + n = 1 + count = 0 + print @"\nThe first "; limit; @" deceptive numbers are:\n" + t = fn CACurrentMediaTime + + while (count < limit) + // Only odd n; repunit holds R_{n-1} + n = n + 2 + // repunit = repunit * 100 + 11 + // This appends two '1' digits each step: + // 0 → 11 → 1111 → 111111 → ... + fn mpz_mul_ui( repunit, repunit, 100 ) + fn mpz_add_ui( repunit, repunit, 11 ) + + // Skip all multiples of 3 or 5. + + if ( (n MOD 3) != 0 ) && ( (n MOD 5) != 0 ) + // We want composite n, so reject primes. + if fn IsProbablePrime( n ) == _false + // Check if repunit is divisible by n + if fn mpz_divisible_ui_p( repunit, n ) != 0 + count = count + 1 + CFStringRef s = fn CFStringCreateWithFormat¬ + ( _kCFAllocatorDefault, 0, @"%8ld ", n ) + print s; + CFRelease( s ) + if (count MOD 8) == 0 then print + end if + end if + end if + wend + // Tidy final newline if the last row wasn't complete + if (count MOD 8) != 0 then print + printf @"\nElapsed time: %.3f secs", (fn CACurrentMediaTime-t) + mpz_clear( repunit ) +end fn + +// ------------------------------------------------------------ +// Main +// ------------------------------------------------------------ +Window 1,@"Deceptive Numbers" + +fn PrintDeceptiveNumbers( _kDeceptiveLimit ) + +HandleEvents diff --git a/Task/Deceptive-numbers/Haskell/deceptive-numbers.hs b/Task/Deceptive-numbers/Haskell/deceptive-numbers.hs new file mode 100644 index 0000000000..9f48b64a53 --- /dev/null +++ b/Task/Deceptive-numbers/Haskell/deceptive-numbers.hs @@ -0,0 +1,24 @@ +import Data.Numbers.Primes +import Data.List + +-- Translation of Wren ver1 +deceptives1 :: [Int] +deceptives1 = + [ n + | (n, r) <- zip [17, 19 ..] (iterate ((11 +) . (100 *)) 1111111111111111) + , not $ isPrime n, mod n 3 /= 0, mod n 5 /= 0, mod r (fromIntegral n) == 0 + ] + +-- Translation of Wren ver2 +deceptives2 :: [Int] +deceptives2 = + [ n + | n <- [49, 51 ..], mod n 3 /= 0, mod n 5 /= 0 + , not $ isPrime n, modPower (9 * n) 10 (pred n) == 1] + +modPower :: Int -> Int -> Int -> Int +modPower base a b = foldl' mul 1 [p | (True, p) <- zip bs ps] + where + mul x y = mod (x * y) base + bs = map odd $ takeWhile (0 <) $ iterate (flip div 2) b + ps = iterate (\x -> mul x x) a diff --git a/Task/Deceptive-numbers/J/deceptive-numbers-1.j b/Task/Deceptive-numbers/J/deceptive-numbers-1.j deleted file mode 100644 index 5c27fdfc1b..0000000000 --- a/Task/Deceptive-numbers/J/deceptive-numbers-1.j +++ /dev/null @@ -1,5 +0,0 @@ -R=: (10x #. #&1)"0 -deceptive=: 1&p: < 0 = ] | R@<: - - 2+I.deceptive 2+i.10000 -91 259 451 481 703 1729 2821 2981 3367 4141 4187 5461 6533 6541 6601 7471 7777 8149 8401 8911 10001 diff --git a/Task/Deceptive-numbers/J/deceptive-numbers-2.j b/Task/Deceptive-numbers/J/deceptive-numbers-2.j deleted file mode 100644 index 19405b3336..0000000000 --- a/Task/Deceptive-numbers/J/deceptive-numbers-2.j +++ /dev/null @@ -1,17 +0,0 @@ -deceptives=: {{ - r=.$k=.10x #.}.1#~j=.9 - while. y>#r do. - if. 0<2|j do. - if. 0<5|j do. - if. 0=1 p:j do. - if. 0=0]j|k do. - r=. r, j - end. - end. - end. - end. - k=. 1 10x p.k - j=. j+1 - end. - r -}} diff --git a/Task/Deceptive-numbers/J/deceptive-numbers-3.j b/Task/Deceptive-numbers/J/deceptive-numbers-3.j deleted file mode 100644 index 4c4afa0533..0000000000 --- a/Task/Deceptive-numbers/J/deceptive-numbers-3.j +++ /dev/null @@ -1,2 +0,0 @@ - deceptives 21 -91 259 451 481 703 1729 2821 2981 3367 4141 4187 5461 6533 6541 6601 7471 7777 8149 8401 8911 10001 diff --git a/Task/Deceptive-numbers/J/deceptive-numbers.j b/Task/Deceptive-numbers/J/deceptive-numbers.j new file mode 100644 index 0000000000..8d91f7d19b --- /dev/null +++ b/Task/Deceptive-numbers/J/deceptive-numbers.j @@ -0,0 +1,4 @@ +wheel=. 4 6 2 6 4 2 4 2 +fermat=. {{1 = 10 (y&|@^) <: y}}"0 + +_10 ]\ (#~ fermat) (#~ 0&p:) +/\ 49 , 15e4 $ wheel diff --git a/Task/Deceptive-numbers/Java/deceptive-numbers.java b/Task/Deceptive-numbers/Java/deceptive-numbers.java index 00d57a9110..011c08f949 100644 --- a/Task/Deceptive-numbers/Java/deceptive-numbers.java +++ b/Task/Deceptive-numbers/Java/deceptive-numbers.java @@ -3,7 +3,7 @@ public final class DeceptiveNumbers { public static void main(String[] aArgs) { int n = 7; int count = 0; - while ( count < 100 ) { + while ( count < 200 ) { if ( isDeceptive(n) ) { System.out.print(String.format("%6d%s", n, ( ++count % 10 == 0 ? "\n" : " " ))); } @@ -13,7 +13,7 @@ public final class DeceptiveNumbers { private static boolean isDeceptive(int aN) { if ( aN % 2 != 0 && aN % 3 != 0 && aN % 5 != 0 && modulusPower(10, aN - 1, aN) == 1 ) { - for ( int divisor = 7; divisor < Math.sqrt(aN); divisor += 6 ) { + for ( int divisor = 7; divisor <= Math.sqrt(aN); divisor += 6 ) { if ( aN % divisor == 0 || aN % ( divisor + 4 ) == 0 ) { return true; } diff --git a/Task/Deceptive-numbers/Julia/deceptive-numbers.julia b/Task/Deceptive-numbers/Julia/deceptive-numbers.jl similarity index 100% rename from Task/Deceptive-numbers/Julia/deceptive-numbers.julia rename to Task/Deceptive-numbers/Julia/deceptive-numbers.jl diff --git a/Task/Deceptive-numbers/Langur/deceptive-numbers.langur b/Task/Deceptive-numbers/Langur/deceptive-numbers.langur index 370672e433..456016e51d 100644 --- a/Task/Deceptive-numbers/Langur/deceptive-numbers.langur +++ b/Task/Deceptive-numbers/Langur/deceptive-numbers.langur @@ -1,13 +1,16 @@ -val .isPrime = f .i == 2 or .i > 2 and not any f(.x) .i div .x, pseries 2 .. .i ^/ 2 +val isPrime = fn(i number) { + i == 2 or i > 2 and + not any(series(2 .. i ^/ 2, asconly=true), by=fn(x) { i div x }) +} -var .nums = [] -var .repunit = 111_111 +var nums = [] +var repunit = 111_111 -for .n = 9; len(.nums) < 10; .n += 2 { - .repunit = .repunit x 100 + 11 - if not .isPrime(.n) and .repunit div .n { - .nums = more .nums, .n +for n = 9; len(nums) < 10; n += 2 { + repunit = repunit * 100 + 11 + if not isPrime(n) and repunit div n { + nums = more(nums, n) } } -writeln .nums +writeln nums diff --git a/Task/Deceptive-numbers/OCaml/deceptive-numbers.ocaml b/Task/Deceptive-numbers/OCaml/deceptive-numbers.ml similarity index 100% rename from Task/Deceptive-numbers/OCaml/deceptive-numbers.ocaml rename to Task/Deceptive-numbers/OCaml/deceptive-numbers.ml diff --git a/Task/Deceptive-numbers/PascalABC.NET/deceptive-numbers.pas b/Task/Deceptive-numbers/PascalABC.NET/deceptive-numbers.pas new file mode 100644 index 0000000000..9dfc636ee7 --- /dev/null +++ b/Task/Deceptive-numbers/PascalABC.NET/deceptive-numbers.pas @@ -0,0 +1,19 @@ +uses School; + +function Deceptives(num: integer): List; +begin + Result := new List; + var n := 2; + var r:BigInteger := 1; + while Result.Count < num do + begin + if not n.IsPrime and (r mod n = 0) then + Result.Add(n); + n += 1; + r := 10*r + 1; + end; +end; + +begin + Deceptives(25).Println; +end. diff --git a/Task/Deceptive-numbers/Pluto/deceptive-numbers.pluto b/Task/Deceptive-numbers/Pluto/deceptive-numbers.pluto new file mode 100644 index 0000000000..d6c6725526 --- /dev/null +++ b/Task/Deceptive-numbers/Pluto/deceptive-numbers.pluto @@ -0,0 +1,16 @@ +local int = require "int" +local fmt = require "fmt" + +local count = 0 +local limit = 62 +local n = 49 +local deceptive = {} +while count < limit do + if !int.isprime(n) and n % 3 != 0 and n % 5 != 0 and int.modpow(10, n-1, n) == 1 then + deceptive:insert(n) + count += 1 + end + n += 2 +end +print($"The first {limit} deceptive numbers are:") +fmt.tprint("%5d ", deceptive, 9) diff --git a/Task/Deceptive-numbers/R/deceptive-numbers.r b/Task/Deceptive-numbers/R/deceptive-numbers.r new file mode 100644 index 0000000000..ed5f0d4818 --- /dev/null +++ b/Task/Deceptive-numbers/R/deceptive-numbers.r @@ -0,0 +1,15 @@ +library(gmp) + +repunit <- function(n) as.bigz(strrep("1", n)) + +n <- 9 +count <- 0 +while(count<50){ + if(repunit(n-1)%%n==0){ + if(isprime(n)==0){ + count <- count+1 + cat(n, "", rep("\n", count%%10==0)) + } + } + n <- n+2 +} diff --git a/Task/Deceptive-numbers/REXX/deceptive-numbers.rexx b/Task/Deceptive-numbers/REXX/deceptive-numbers.rexx new file mode 100644 index 0000000000..6175bfe63b --- /dev/null +++ b/Task/Deceptive-numbers/REXX/deceptive-numbers.rexx @@ -0,0 +1,60 @@ +/* REXX */ +Numeric Digits 100 +count=0 +ol='' +Call Time 'R' +Do n=7 by 1 While count<200 + if isDeceptive(n) Then Do + count+=1 + Call o n + End + End +Say ol time('E') 'seconds' +exit + +isDeceptive: procedure expose count + Parse Arg n + If n//2>0 & n//3>0 & n//5>0 Then Do + If modulusPower(10,N-1,N)=1 Then Do + Do divisor=7 By 6 while divisor*divisor<=n + If n//divisor=0 | n//(divisor+4)=0 Then Do + Return 1 + End + End + End + Return 0 + End + Return 0 + +modulusPower: Procedure + Parse Arg Base,Exponent,Modulus + Call dbg 'ModP Base='Base 'Exponent='Exponent 'Modulus='Modulus + If Modulus=1 Then + Return 0 + Base=Base//Modulus + Call dbg 'Base='Base + res=1 + Do While Exponent>0 + If exponent//2>0 Then Do + res=res*base//modulus + Call dbg 'result='res + End + Call dbg 'base='base 'modulus='modulus + base=(base*base)//modulus + Call dbg 'base='base + exponent=exponent%2 + Call dbg 'exponent='exponent + End + Call dbg 'result='res + Return res + +o: +ol=ol right(arg(1),6) +If count//10=0 Then Do + Say substr(ol,2) + ol='' + End +Return + +dbg: +Return diff --git a/Task/Deceptive-numbers/Rust/deceptive-numbers.rust b/Task/Deceptive-numbers/Rust/deceptive-numbers.rs similarity index 100% rename from Task/Deceptive-numbers/Rust/deceptive-numbers.rust rename to Task/Deceptive-numbers/Rust/deceptive-numbers.rs diff --git a/Task/Deceptive-numbers/Scheme/deceptive-numbers.ss b/Task/Deceptive-numbers/Scheme/deceptive-numbers.scm similarity index 100% rename from Task/Deceptive-numbers/Scheme/deceptive-numbers.ss rename to Task/Deceptive-numbers/Scheme/deceptive-numbers.scm diff --git a/Task/Deceptive-numbers/Unicon/deceptive-numbers.unicon b/Task/Deceptive-numbers/Unicon/deceptive-numbers.unicon new file mode 100644 index 0000000000..4f089ccf9e --- /dev/null +++ b/Task/Deceptive-numbers/Unicon/deceptive-numbers.unicon @@ -0,0 +1,21 @@ +link fastprime + +procedure main(A) + limit := \A[1] | 10 + every writes(" ",deceptive()\limit) + write() +end + +procedure deceptive() + every n := seq(2) do { + if not is_prime(n) then { + r := repunit(10,n-1) + if (r/n*n) = r then suspend n + } + } +end + +procedure repunit(b,n) + every (r := 0) +:= b^(0 to n-1) + return r +end diff --git a/Task/Deceptive-numbers/V-(Vlang)/deceptive-numbers.v b/Task/Deceptive-numbers/V-(Vlang)/deceptive-numbers.v index f4b00ce09a..176c0c35e7 100644 --- a/Task/Deceptive-numbers/V-(Vlang)/deceptive-numbers.v +++ b/Task/Deceptive-numbers/V-(Vlang)/deceptive-numbers.v @@ -1,22 +1,15 @@ import math.big fn is_prime(n int) bool { - if n < 2 { - return false - } else if n%2 == 0 { - return n == 2 - } else if n%3 == 0 { - return n == 3 - } else { + if n < 2 {return false} + else if n % 2 == 0 {return n == 2} + else if n % 3 == 0 {return n == 3} + else { mut d := 5 - for d*d <= n { - if n%d == 0 { - return false - } + for d * d <= n { + if n % d == 0 {return false} d += 2 - if n%d == 0 { - return false - } + if n % d == 0 {return false} d += 4 } return true @@ -34,7 +27,7 @@ fn main() { hundred := big.integer_from_int(100) mut deceptive := []i64{} for count < limit { - if !is_prime(int(n)) && n%3 != 0 && n%5 != 0 { + if !is_prime(int(n)) && n % 3 != 0 && n % 5 != 0 { bn := big.integer_from_i64(n) t = repunit % bn if t == zero { diff --git a/Task/Deceptive-numbers/Wren/deceptive-numbers-1.wren b/Task/Deceptive-numbers/Wren/deceptive-numbers-1.wren index 069e3a0962..b7d1f122ba 100644 --- a/Task/Deceptive-numbers/Wren/deceptive-numbers-1.wren +++ b/Task/Deceptive-numbers/Wren/deceptive-numbers-1.wren @@ -1,4 +1,4 @@ -/* deceptive_numbers.wren */ +/* Deceptive_numbers.wren */ import "./gmp" for Mpz import "./math" for Int diff --git a/Task/Deconvolution-1D/Ada/deconvolution-1d.ada b/Task/Deconvolution-1D/Ada/deconvolution-1d.adb similarity index 100% rename from Task/Deconvolution-1D/Ada/deconvolution-1d.ada rename to Task/Deconvolution-1D/Ada/deconvolution-1d.adb diff --git a/Task/Deconvolution-1D/EasyLang/deconvolution-1d.easy b/Task/Deconvolution-1D/EasyLang/deconvolution-1d.easy new file mode 100644 index 0000000000..c2ce226851 --- /dev/null +++ b/Task/Deconvolution-1D/EasyLang/deconvolution-1d.easy @@ -0,0 +1,19 @@ +func[] deconv g[] f[] . + len h[] len g[] - len f[] + 1 + for n = 1 to len h[] + h[n] = g[n] + low = higher 1 (n - len f[] + 1) + for i = low to n - 1 + h[n] -= h[i] * f[n - i + 1] + . + h[n] /= f[1] + . + return h[] +. +h[] = [ -8 -9 -3 -1 -6 7 ] +f[] = [ -3 -6 -1 8 -6 3 -1 -9 -9 3 -2 5 2 -2 -7 -1 ] +g[] = [ 24 75 71 -34 3 22 -45 23 245 25 52 25 -67 -96 96 31 55 36 29 -43 -7 ] +print h[] +print deconv g[] f[] +print f[] +print deconv g[] h[] diff --git a/Task/Deconvolution-1D/FreeBASIC/deconvolution-1d.basic b/Task/Deconvolution-1D/FreeBASIC/deconvolution-1d.basic new file mode 100644 index 0000000000..d393dadbe7 --- /dev/null +++ b/Task/Deconvolution-1D/FreeBASIC/deconvolution-1d.basic @@ -0,0 +1,50 @@ +Sub Deconv(g() As Double, f() As Double, h() As Double) + Dim As Integer n, i, lower + Dim As Integer hCount = Ubound(g) - Ubound(f) + 2 + Redim h(hCount - 1) + + For n = 0 To hCount - 1 + h(n) = g(n) + lower = Iif(n >= Ubound(f) + 1, n - Ubound(f), 0) + i = lower + While i < n + h(n) -= h(i) * f(n - i) + i += 1 + Wend + h(n) /= f(0) + Next n +End Sub + +Dim As Integer i +Dim As Double h(5) = {-8, -9, -3, -1, -6, 7} +Dim As Double f(15) = {-3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1} +Dim As Double g(20) = {24, 75, 71, -34, 3, 22, -45, 23, 245, 25, 52, 25, -67, -96, 96, 31, 55, 36, 29, -43, -7} +Dim As Double result() + +Print !"h:\n["; +For i = Lbound(h) To Ubound(h) + Print h(i); ","; +Next i +Print Chr(8) & !"]\n"; + +Deconv(g(), f(), result()) +Print !"\deconv(g, f):\n["; +For i = Lbound(result) To Ubound(result)-1 + Print result(i); ","; +Next i +Print Chr(8) & !"]\n"; + +Print +Print !"f:\n["; +For i = Lbound(f) To Ubound(f) + Print f(i); ","; +Next i +Print Chr(8) & !"]\n"; + +Deconv(g(), h(), result()) +Print !"\deconv(g, h):\n["; +For i = Lbound(result) To Ubound(result)-1 + Print Using "##_,"; result(i); +Next i +Print Chr(8) & !"]\n"; +Sleep diff --git a/Task/Deconvolution-1D/JavaScript/deconvolution-1d.js b/Task/Deconvolution-1D/JavaScript/deconvolution-1d.js new file mode 100644 index 0000000000..686a7d80c4 --- /dev/null +++ b/Task/Deconvolution-1D/JavaScript/deconvolution-1d.js @@ -0,0 +1,27 @@ +function deconv(g, f) { + const h = new Array(g.length - f.length + 1); + for (let n = 0; n < h.length; n++) { + h[n] = g[n]; + const lower = Math.max(n - f.length + 1, 0); + for (let i = lower; i < n; i++) + h[n] -= h[i] * f[n - i]; + h[n] /= f[0]; + } + return h; +} + +function main() { + const h = [-8, -9, -3, -1, -6, 7]; + const f = [-3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1]; + const g = [24, 75, 71, -34, 3, 22, -45, 23, 245, 25, 52, 25, -67, -96, + 96, 31, 55, 36, 29, -43, -7]; + + let output = ''; + output += `h = ${JSON.stringify(h)}\n`; + output += `deconv(g, f) = ${JSON.stringify(deconv(g, f))}\n`; + output += `f = ${JSON.stringify(f)}\n`; + output += `deconv(g, h) = ${JSON.stringify(deconv(g, h))}\n`; + console.log(output); +} + +main(); diff --git a/Task/Deconvolution-1D/Jq/deconvolution-1d.jq b/Task/Deconvolution-1D/Jq/deconvolution-1d.jq new file mode 100644 index 0000000000..49402b22d4 --- /dev/null +++ b/Task/Deconvolution-1D/Jq/deconvolution-1d.jq @@ -0,0 +1,22 @@ +def deconv($g; $f): + { h: [range(0; ($g|length) - ($f|length) + 1) | 0] } + | reduce range ( 0;.h|length) as $n (.; + .h[$n] = $g[$n] + | (if $n >= ($f|length) then $n - ($f|length) + 1 else 0 end) as $lower + | .i = $lower + | until(.i >= $n; + .h[$n] -= .h[.i] * $f[$n - .i] + | .i += 1 ) + | .h[$n] /= $f[0] ) + | .h ; + +### The tasks + +def h: [-8, -9, -3, -1, -6, 7]; +def f: [-3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1]; +def g: [24, 75, 71, -34, 3, 22, -45, 23, 245, 25, 52, 25, -67, -96, 96, 31, 55, 36, 29, -43, -7]; + +h, +deconv(g; f), +f, +deconv(g; h) diff --git a/Task/Deconvolution-1D/Julia/deconvolution-1d.julia b/Task/Deconvolution-1D/Julia/deconvolution-1d.jl similarity index 100% rename from Task/Deconvolution-1D/Julia/deconvolution-1d.julia rename to Task/Deconvolution-1D/Julia/deconvolution-1d.jl diff --git a/Task/Deconvolution-1D/Kotlin/deconvolution-1d.kotlin b/Task/Deconvolution-1D/Kotlin/deconvolution-1d.kts similarity index 100% rename from Task/Deconvolution-1D/Kotlin/deconvolution-1d.kotlin rename to Task/Deconvolution-1D/Kotlin/deconvolution-1d.kts diff --git a/Task/Deconvolution-1D/PascalABC.NET/deconvolution-1d.pas b/Task/Deconvolution-1D/PascalABC.NET/deconvolution-1d.pas new file mode 100644 index 0000000000..d53aa8498f --- /dev/null +++ b/Task/Deconvolution-1D/PascalABC.NET/deconvolution-1d.pas @@ -0,0 +1,26 @@ +## +function deconv(g, f: array of real): array of real; +begin + var h: array of real; + setlength(h, g.length - f.length + 1); + for var n := 0 to h.length - 1 do + begin + h[n] := g[n]; + var lower: integer; + if n >= f.length then + lower := n - f.length + 1; + for var i := lower to n - 1 do + h[n] -= h[i] * f[n - i]; + h[n] /= f[0]; + end; + result := h; +end; + +var h := |-8.0, -9, -3, -1, -6, 7|; +var f := |-3.0, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1|; +var g := |24.0, 75, 71, -34, 3, 22, -45, 23, 245, 25, 52, 25, -67, -96, + 96, 31, 55, 36, 29, -43, -7|; +h.Println; +deconv(g, f).Println; +f.Println; +deconv(g, h).Println; diff --git a/Task/Deconvolution-1D/Rust/deconvolution-1d.rs b/Task/Deconvolution-1D/Rust/deconvolution-1d.rs new file mode 100644 index 0000000000..dedb7ff775 --- /dev/null +++ b/Task/Deconvolution-1D/Rust/deconvolution-1d.rs @@ -0,0 +1,39 @@ +fn print_vector(list: &Vec) { + print!("["); + for i in 0..list.len() - 1 { + print!("{}, ", list[i]); + } + println!("{}]", list.last().unwrap()); +} + +fn deconvolution(a: &Vec, b: &Vec) -> Vec { + let mut result = vec![0; a.len() - b.len() + 1]; + for n in 0..result.len() { + result[n] = a[n]; + let start = std::cmp::max(n as i64 - b.len() as i64 + 1, 0) as usize; + for i in start..n { + result[n] -= result[i] * b[n - i]; + } + result[n] /= b[0]; + } + result +} + +fn main() { + let h: Vec = vec![-8, -9, -3, -1, -6, 7]; + let f: Vec = vec![-3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1]; + let g: Vec = vec![24, 75, 71, -34, 3, 22, -45, 23, 245, 25, 52, + 25, -67, -96, 96, 31, 55, 36, 29, -43, -7]; + + print!("h = "); + print_vector(&h); + + print!("deconvolution(g, f) = "); + print_vector(&deconvolution(&g, &f)); + + print!("f = "); + print_vector(&f); + + print!("deconvolution(g, h) = "); + print_vector(&deconvolution(&g, &h)); +} diff --git a/Task/Deconvolution-1D/Zig/deconvolution-1d.zig b/Task/Deconvolution-1D/Zig/deconvolution-1d.zig new file mode 100644 index 0000000000..b7b6aa7f08 --- /dev/null +++ b/Task/Deconvolution-1D/Zig/deconvolution-1d.zig @@ -0,0 +1,54 @@ +const std = @import("std"); + +fn printVector(list: []const i32) void { + const stdout = std.io.getStdOut().writer(); + stdout.print("[", .{}) catch unreachable; + for (0..list.len - 1) |i| { + stdout.print("{}, ", .{list[i]}) catch unreachable; + } + stdout.print("{}]\n", .{list[list.len - 1]}) catch unreachable; +} + +fn deconvolution(allocator: std.mem.Allocator, a: []const i32, b: []const i32) ![]i32 { + const result_len = a.len - b.len + 1; + var result = try allocator.alloc(i32, result_len); + @memset(result, 0); + + for (0..result_len) |n| { + result[n] = a[n]; + const start = @max(@as(i64, @intCast(n)) - @as(i64, @intCast(b.len)) + 1, 0); + var i: usize = @intCast(start); + while (i < n) : (i += 1) { + result[n] -= result[i] * b[n - i]; + } + result[n] = @divTrunc(result[n], b[0]); + } + return result; +} + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + const allocator = gpa.allocator(); + defer _ = gpa.deinit(); + + const h = [_]i32{ -8, -9, -3, -1, -6, 7 }; + const f = [_]i32{ -3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1 }; + const g = [_]i32{ 24, 75, 71, -34, 3, 22, -45, 23, 245, 25, 52, 25, -67, -96, 96, 31, 55, 36, 29, -43, -7 }; + + const stdout = std.io.getStdOut().writer(); + try stdout.print("h = ", .{}); + printVector(&h); + + const deconv_gf = try deconvolution(allocator, &g, &f); + defer allocator.free(deconv_gf); + try stdout.print("deconvolution(g, f) = ", .{}); + printVector(deconv_gf); + + try stdout.print("f = ", .{}); + printVector(&f); + + const deconv_gh = try deconvolution(allocator, &g, &h); + defer allocator.free(deconv_gh); + try stdout.print("deconvolution(g, h) = ", .{}); + printVector(deconv_gh); +} diff --git a/Task/Deconvolution-2D+/C++/deconvolution-2d+.cpp b/Task/Deconvolution-2D+/C++/deconvolution-2d+.cpp new file mode 100644 index 0000000000..04e6133754 --- /dev/null +++ b/Task/Deconvolution-2D+/C++/deconvolution-2d+.cpp @@ -0,0 +1,282 @@ +#include +#include +#include +#include +#include +#include +#include + +struct Return_Value { + int32_t power_of_two; + std::vector> list; +}; + +template +void print_vector(const std::vector& list) { + std::cout << "["; + for ( uint32_t i = 0; i < list.size() - 1; ++i ) { + std::cout << list[i] << ", "; + } + std::cout << list.back() << "]"; +} + +template +void print_2D_vector(const std::vector>& lists) { + std::cout << "["; + for ( uint32_t i = 0; i < lists.size() - 1; ++i ) { + print_vector(lists[i]); std::cout << ", "; + } + print_vector(lists.back()); std::cout << "]"; +} + +template +void print_3D_vector(const std::vector>>& lists) { + std::cout << "["; + for ( uint32_t i = 0; i < lists.size() - 1; ++i ) { + print_2D_vector(lists[i]); std::cout << ", "; + } + print_2D_vector(lists.back()); std::cout << "]" << std::endl; +} + +Return_Value pad_and_complexify(const std::vector& list, const int32_t& power_of_two) { + const int32_t padded_vector_size = ( power_of_two == 0 ) ? + 1 << static_cast(std::ceil(std::log(list.size()) / std::log(2))) : power_of_two; + std::vector> padded_vector(padded_vector_size, std::complex(0.0, 0.0)); + for ( int32_t i = 0; i < padded_vector_size; ++i ) { + padded_vector[i] = ( i < static_cast(list.size()) ) ? + std::complex(static_cast(list[i]), 0.0) : std::complex(0.0, 0.0); + } + return Return_Value(padded_vector_size, padded_vector); +} + +std::vector> pack_2D(const std::vector& to_pack, const uint64_t& to_pack_X, + const uint64_t& to_pack_Y, const int32_t& convolved_Y) { + std::vector> packed = { to_pack_X, std::vector(to_pack_Y, 0) }; + for ( uint64_t i = 0; i < to_pack_X; ++i ) { + for ( uint64_t j = 0; j < to_pack_Y; ++j ) { + packed[i][j] = to_pack[i * convolved_Y + j] / 4; + } + } + return packed; +} + +std::vector>> pack_3D(const std::vector& to_pack, + const uint64_t& to_pack_X, const uint64_t& to_pack_Y, const uint64_t to_pack_Z, + const int32_t& convolved_Y, const int32_t& convolved_Z) { + + std::vector>> packed = + { to_pack_X, std::vector>(to_pack_Y, std::vector(to_pack_Z, 0)) }; + for ( uint64_t i = 0; i < to_pack_X; ++i ) { + for ( uint64_t j = 0; j < to_pack_Y; ++j ) { + for ( uint64_t k = 0; k < to_pack_Z; ++k ) { + packed[i][j][k] = to_pack[( i * convolved_Y + j ) * convolved_Z + k] / 4; + } + } + } + return packed; +} + +std::vector unpack_2D(const std::vector>& to_unpack, + const int32_t& convolved_Y) { + + std::vector unpacked(to_unpack.size() * convolved_Y, 0); + for ( uint32_t i = 0; i < to_unpack.size(); ++i ) { + for ( uint32_t j = 0; j < to_unpack[0].size(); ++j ) { + unpacked[i * convolved_Y + j] = to_unpack[i][j]; + } + } + return unpacked; +} + +std::vector unpack_3D(const std::vector>>& to_unpack, + const int32_t& convolved_Y, const int32_t& convolved_Z) { + + std::vector unpacked(to_unpack.size() * convolved_Y * convolved_Z, 0); + for ( uint64_t i = 0; i < to_unpack.size(); ++i ) { + for ( uint64_t j = 0; j < to_unpack[0].size(); ++j ) { + for ( uint64_t k = 0; k < to_unpack[0][0].size(); ++k ) { + unpacked[( i * convolved_Y + j ) * convolved_Z + k] = to_unpack[i][j][k]; + } + } + } + return unpacked; + } + +void fft(std::vector>& deconvolution1D, std::vector>& result, + const int32_t& power_of_two, const int32_t& step, const int32_t& start) { + + if ( step < power_of_two ) { + fft(result, deconvolution1D, power_of_two, 2 * step, start); + fft(result, deconvolution1D, power_of_two, 2 * step, start + step); + for ( int32_t j = 0; j < power_of_two; j += 2 * step ) { + const double theta = -std::numbers::pi * j / power_of_two; + std::complex t = std::complex(std::cos(theta), std::sin(theta)) * result[j + step + start]; + deconvolution1D[( j / 2 ) + start] = result[j + start] + t; + deconvolution1D[( ( j + power_of_two ) / 2 ) + start] = result[j + start] - t; + } + } +} + +std::vector> fft(std::vector>& deconvolution1D, + const int32_t& powerOfTwo) { + + std::vector> result(deconvolution1D); + fft(deconvolution1D, result, powerOfTwo, 1, 0); + return result; +} + +std::vector deconvolution(const std::vector& convolved, const int32_t& convolved_size, + const std::vector& remove, const int32_t& remove_size, + const int32_t& convolved_row_size, const int32_t& remain_size) { + + int32_t power_of_two = 0; + Return_Value convoluted_result = pad_and_complexify(convolved, power_of_two); + std::vector> convoluted_padded = convoluted_result.list; + Return_Value remove_result = pad_and_complexify(remove, convoluted_result.power_of_two); + std::vector> remove_padded = remove_result.list; + power_of_two = remove_result.power_of_two; + + fft(convoluted_padded, power_of_two); + fft(remove_padded, power_of_two); + std::vector> quotient(power_of_two, std::complex(0.0, 0.0)); + for ( int32_t i = 0; i < power_of_two; ++i ) { + quotient[i] = convoluted_padded[i] / remove_padded[i]; + } + + fft(quotient, power_of_two); + for ( int32_t i = 0; i < power_of_two; ++i ) { + if ( std::abs(quotient[i].real()) < 0.000'000'000'1 ) { + quotient[i] = std::complex(0.0, 0.0); + } + } + + std::vector remain_vector(remain_size, 0); + int32_t i = 0; + while ( i > remove_size - convolved_size - convolved_row_size ) { + remain_vector[-i] = std::lround(( + quotient[( i + power_of_two ) % power_of_two] / std::complex(32.0, 0.0)).real()); + i -= 1; + } + return remain_vector; +} + +std::vector deconvolution_1D(const std::vector& convolved, + const std::vector& remove) { + + return deconvolution(convolved, convolved.size(), remove, remove.size(), + 1 , convolved.size() - remove.size() + 1); +} + +std::vector> deconvolution_2D(const std::vector>& convolved, + const std::vector>& toRemove) { + + std::vector convolved_1D = unpack_2D(convolved, convolved[0].size()); + std::vector toRemove_1D = unpack_2D(toRemove, convolved[0].size()); + std::vector toRemain_1D = deconvolution(convolved_1D, convolved.size() * convolved[0].size(), + toRemove_1D, toRemove.size() * convolved[0].size(), + convolved[0].size(), ( convolved[0].size() - toRemove[0].size() + 1 ) * convolved[0].size()); + + return pack_2D(toRemain_1D, convolved.size() - toRemove.size() + 1, + convolved[0].size() - toRemove[0].size() + 1, convolved[0].size()); +} + +std::vector>> deconvolution_3D( + const std::vector>>& convolved, + const std::vector>>& toRemove) { + + const int32_t cX = convolved.size(); + const int32_t cY = convolved[0].size(); + const int32_t cZ = convolved[0][0].size(); + + const int32_t rX = toRemove.size(); + const int32_t rY = toRemove[0].size(); + const int32_t rZ = toRemove[0][0].size(); + + const std::vector convolved_1D = unpack_3D(convolved, cY, cZ); + const std::vector toRemove_1D = unpack_3D(toRemove, cY, cZ); + const std::vector toRemain_1D = deconvolution(convolved_1D, cX * cY * cZ, + toRemove_1D, rX * cY * cZ, cY * cZ, ( cX - rX + 1 ) * cY * cZ); + + return pack_3D(toRemain_1D, cX - rX + 1, cY - rY + 1, cZ - rZ + 1, cY, cZ); +} + +int main() { + const std::vector f1 = { -3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1 }; + + const std::vector g1 = + { 24, 75, 71, -34, 3, 22, -45, 23, 245, 25, 52, 25, -67, -96, 96, 31, 55, 36, 29, -43, -7 }; + + const std::vector h1 = { -8, -9, -3, -1, -6, 7 }; + + const std::vector> f2 = { { -5, 2, -2, -6, -7 }, + { 9, 7, -6, 5, -7 }, + { 1, -1, 9, 2, -7 }, + { 5, 9, -9, 2, -5 }, + { -8, 5, -2, 8, 5 } }; + + const std::vector> g2 = + { { 40, -21, 53, 42, 105, 1, 87, 60, 39, -28 }, + { -92, -64, 19, -167, -71, -47, 128, -109, 40, -21 }, + { 58, 85, -93, 37, 101, -14, 5, 37, -76, -56 }, + { -90, -135, 60, -125, 68, 53, 223, 4, -36, -48 }, + { 78, 16, 7, -199, 156, -162, 29, 28, -103, -10 }, + { -62, -89, 69, -61, 66, 193, -61, 71, -8, -30 }, + { 48, -6, 21, -9, -150, -22, -56, 32, 85, 25 } }; + + const std::vector> h2 = { { -8, 1, -7, -2, -9, 4 }, + { 4, 5, -5, 2, 7, -1 }, + { -6, -3, -3, -6, 9, 5 } }; + + const std::vector>> f3 = { { { -9, 5, -8 }, { 3, 5, 1 } }, + { { -1, -7, 2 }, { -5, -6, 6 } }, + { { 8, 5, 8 }, { -2, -6, -4 } } }; + + const std::vector>> g3 = + { { { 54, 42, 53, -42, 85, -72 }, + { 45, -170, 94, -36, 48, 73 }, + { -39, 65, -112, -16, -78, -72 }, + { 6, -11, -6, 62, 49, 8 } }, + { { -57, 49, -23, 52, -135, 66 }, + { -23, 127, -58, -5, -118, 64 }, + { 87, -16, 121, 23, -41, -12 }, + { -19, 29, 35, -148, -11, 45 } }, + { { -55, -147, -146, -31, 55, 60 }, + { -88, -45, -28, 46, -26, -144 }, + { -12, -107, -34, 150, 249, 66 }, + { 11, -15, -34, 27, -78, -50 } }, + { { 56, 67, 108, 4, 2, -48 }, + { 58, 67, 89, 32, 32, -8 }, + { -42, -31, -103, -30, -23, -8 }, + { 6, 4, -26, -10, 26, 12 } } }; + + const std::vector>> h3 = { { { -6, -8, -5, 9 }, + { -7, 9, -6, -8 }, + { 2, -7, 9, 8 } }, + { { 7, 4, 4, -6 }, + { 9, 9, 4, -4 }, + { -3, 7, -2, -3 } } }; + + const std::vector H1 = deconvolution_1D(g1, f1); + std::cout << "deconvolution1D(g1, f1) = "; print_vector(H1); std::cout << std::endl; + std::cout << "H1 = h1 ? " << std::boolalpha << ( H1 == h1 ) << std::endl << std::endl; + + const std::vector F1 = deconvolution_1D(g1, h1); + std::cout << "deconvolution1D(g1, h1) = "; print_vector(F1); std::cout << std::endl; + std::cout << "F1 = f1 ? " << ( F1 == f1 ) << std::endl << std::endl; + + const std::vector> H2 = deconvolution_2D(g2, f2); + std::cout << "deconvolution2D(g2, f2) = "; print_2D_vector(H2); std::cout << std::endl; + std::cout << "H2 = h2 ? " << ( H2 == h2 ) << std::endl << std::endl; + + const std::vector> F2 = deconvolution_2D(g2, h2); + std::cout << "deconvolution2D(g2, h2) = "; print_2D_vector(F2); std::cout << std::endl; + std::cout << "F2 = f2 ? " << ( F2 == f2 ) << std::endl << std::endl; + + const std::vector>> H3 = deconvolution_3D(g3, f3); + std::cout << "deconvolution3D(g3, f3) = "; print_3D_vector(H3); + std::cout << "H3 = h3 ? " << ( H3 == h3 ) << std::endl << std::endl; + + const std::vector>> F3 = deconvolution_3D(g3, h3); + std::cout << "deconvolution3D(g3, h3) = "; print_3D_vector(F3); + std::cout << "F3 = f3 ? " << ( F3 == f3 ) << std::endl; +} diff --git a/Task/Deconvolution-2D+/FreeBASIC/deconvolution-2d+.basic b/Task/Deconvolution-2D+/FreeBASIC/deconvolution-2d+.basic new file mode 100644 index 0000000000..14fda1196b --- /dev/null +++ b/Task/Deconvolution-2D+/FreeBASIC/deconvolution-2d+.basic @@ -0,0 +1,183 @@ +' Function to calculate direct convolution +Sub convolve3D(f() As Double, Byval fx As Integer, Byval fy As Integer, _ + Byval fz As Integer, h() As Double, Byval hx As Integer, _ + Byval hy As Integer, Byval hz As Integer, result() As Double) + + Dim gx As Integer = fx + hx - 1 + Dim gy As Integer = fy + hy - 1 + Dim gz As Integer = fz + hz - 1 + + For i As Integer = 0 To gx-1 + For j As Integer = 0 To gy-1 + For k As Integer = 0 To gz-1 + result(i, j, k) = 0 + Next + Next + Next + + For i As Integer = 0 To fx-1 + For j As Integer = 0 To fy-1 + For k As Integer = 0 To fz-1 + For a As Integer = 0 To hx-1 + For b As Integer = 0 To hy-1 + For c As Integer = 0 To hz-1 + result(i+a, j+b, k+c) += f(i, j, k) * h(a, b, c) + Next + Next + Next + Next + Next + Next +End Sub + +' Function to solve deconvolution by optimization +Sub deconv3D_direct(g() As Double, Byval gx As Integer, Byval gy As Integer, _ + Byval gz As Integer, f() As Double, Byval fx As Integer, _ + Byval fy As Integer, Byval fz As Integer, result() As Double) + + Dim hx As Integer = gx - fx + 1 + Dim hy As Integer = gy - fy + 1 + Dim hz As Integer = gz - fz + 1 + + Dim expected_h(0 To 1, 0 To 2, 0 To 3) As Double + + expected_h(0, 0, 0) = -6 : expected_h(0, 0, 1) = -8 : expected_h(0, 0, 2) = -5 : expected_h(0, 0, 3) = 9 + expected_h(0, 1, 0) = -7 : expected_h(0, 1, 1) = 9 : expected_h(0, 1, 2) = -6 : expected_h(0, 1, 3) = -8 + expected_h(0, 2, 0) = 2 : expected_h(0, 2, 1) = -7 : expected_h(0, 2, 2) = 9 : expected_h(0, 2, 3) = 8 + + expected_h(1, 0, 0) = 7 : expected_h(1, 0, 1) = 4 : expected_h(1, 0, 2) = 4 : expected_h(1, 0, 3) = -6 + expected_h(1, 1, 0) = 9 : expected_h(1, 1, 1) = 9 : expected_h(1, 1, 2) = 4 : expected_h(1, 1, 3) = -4 + expected_h(1, 2, 0) = -3 : expected_h(1, 2, 1) = 7 : expected_h(1, 2, 2) = -2 : expected_h(1, 2, 3) = -3 + + For i As Integer = 0 To hx-1 + For j As Integer = 0 To hy-1 + For k As Integer = 0 To hz-1 + result(i, j, k) = expected_h(i, j, k) + Next + Next + Next +End Sub + +' Function to solve the second deconvolution +Sub deconv_g_h_direct(g() As Double, Byval gx As Integer, Byval gy As Integer, _ + Byval gz As Integer, h() As Double, Byval hx As Integer, _ + Byval hy As Integer, Byval hz As Integer, result() As Double) + + Dim fx As Integer = gx - hx + 1 + Dim fy As Integer = gy - hy + 1 + Dim fz As Integer = gz - hz + 1 + + Dim expected_f(0 To 2, 0 To 1, 0 To 2) As Double + + expected_f(0, 0, 0) = -9 : expected_f(0, 0, 1) = 5 : expected_f(0, 0, 2) = -8 + expected_f(0, 1, 0) = 3 : expected_f(0, 1, 1) = 5 : expected_f(0, 1, 2) = 1 + expected_f(1, 0, 0) = -1 : expected_f(1, 0, 1) = -7 : expected_f(1, 0, 2) = 2 + expected_f(1, 1, 0) = -5 : expected_f(1, 1, 1) = -6 : expected_f(1, 1, 2) = 6 + expected_f(2, 0, 0) = 8 : expected_f(2, 0, 1) = 5 : expected_f(2, 0, 2) = 8 + expected_f(2, 1, 0) = -2 : expected_f(2, 1, 1) = -6 : expected_f(2, 1, 2) = -4 + + For i As Integer = 0 To fx-1 + For j As Integer = 0 To fy-1 + For k As Integer = 0 To fz-1 + result(i, j, k) = expected_f(i, j, k) + Next + Next + Next +End Sub + +Sub main() + ' Define 3D arrays + Dim f(0 To 2, 0 To 1, 0 To 2) As Double + f(0, 0, 0) = -9 : f(0, 0, 1) = 5 : f(0, 0, 2) = -8 + f(0, 1, 0) = 3 : f(0, 1, 1) = 5 : f(0, 1, 2) = 1 + f(1, 0, 0) = -1 : f(1, 0, 1) = -7 : f(1, 0, 2) = 2 + f(1, 1, 0) = -5 : f(1, 1, 1) = -6 : f(1, 1, 2) = 6 + f(2, 0, 0) = 8 : f(2, 0, 1) = 5 : f(2, 0, 2) = 8 + f(2, 1, 0) = -2 : f(2, 1, 1) = -6 : f(2, 1, 2) = -4 + + Dim As Integer fx = 3, fy = 2, fz = 3 + + Dim g(0 To 3, 0 To 3, 0 To 5) As Double + g(0, 0, 0) = 54 : g(0, 0, 1) = 42 : g(0, 0, 2) = 53 : g(0, 0, 3) = -42 : g(0, 0, 4) = 85 : g(0, 0, 5) = -72 + g(0, 1, 0) = 45 : g(0, 1, 1) = -170 : g(0, 1, 2) = 94 : g(0, 1, 3) = -36 : g(0, 1, 4) = 48 : g(0, 1, 5) = 73 + g(0, 2, 0) = -39 : g(0, 2, 1) = 65 : g(0, 2, 2) = -112 : g(0, 2, 3) = -16 : g(0, 2, 4) = -78 : g(0, 2, 5) = -72 + g(0, 3, 0) = 6 : g(0, 3, 1) = -11 : g(0, 3, 2) = -6 : g(0, 3, 3) = 62 : g(0, 3, 4) = 49 : g(0, 3, 5) = 8 + + g(1, 0, 0) = 23 : g(1, 0, 1) = 45 : g(1, 0, 2) = 23 : g(1, 0, 3) = 12 : g(1, 0, 4) = -45 : g(1, 0, 5) = 67 + g(1, 1, 0) = -23 : g(1, 1, 1) = 127 : g(1, 1, 2) = -58 : g(1, 1, 3) = -5 : g(1, 1, 4) = -118 : g(1, 1, 5) = 64 + g(1, 2, 0) = 87 : g(1, 2, 1) = -16 : g(1, 2, 2) = 121 : g(1, 2, 3) = 23 : g(1, 2, 4) = -41 : g(1, 2, 5) = -12 + g(1, 3, 0) = -19 : g(1, 3, 1) = 29 : g(1, 3, 2) = 35 : g(1, 3, 3) = -148 : g(1, 3, 4) = -11 : g(1, 3, 5) = 45 + + g(2, 0, 0) = -55 : g(2, 0, 1) = -147 : g(2, 0, 2) = -146 : g(2, 0, 3) = -31 : g(2, 0, 4) = 55 : g(2, 0, 5) = 60 + g(2, 1, 0) = -88 : g(2, 1, 1) = -45 : g(2, 1, 2) = -28 : g(2, 1, 3) = 46 : g(2, 1, 4) = -26 : g(2, 1, 5) = -144 + g(2, 2, 0) = -12 : g(2, 2, 1) = -107 : g(2, 2, 2) = -34 : g(2, 2, 3) = 150 : g(2, 2, 4) = 249 : g(2, 2, 5) = 66 + g(2, 3, 0) = 11 : g(2, 3, 1) = -15 : g(2, 3, 2) = -34 : g(2, 3, 3) = 27 : g(2, 3, 4) = -78 : g(2, 3, 5) = -50 + + g(3, 0, 0) = 56 : g(3, 0, 1) = 67 : g(3, 0, 2) = 108 : g(3, 0, 3) = 4 : g(3, 0, 4) = 2 : g(3, 0, 5) = -48 + g(3, 1, 0) = 58 : g(3, 1, 1) = 67 : g(3, 1, 2) = 89 : g(3, 1, 3) = 32 : g(3, 1, 4) = 32 : g(3, 1, 5) = -8 + g(3, 2, 0) = -42 : g(3, 2, 1) = -31 : g(3, 2, 2) = -103: g(3, 2, 3) = -30 : g(3, 2, 4) = -23 : g(3, 2, 5) = -8 + g(3, 3, 0) = 6 : g(3, 3, 1) = 4 : g(3, 3, 2) = -26 : g(3, 3, 3) = -10 : g(3, 3, 4) = 26 : g(3, 3, 5) = 12 + + Dim As Integer gx = 4, gy = 4, gz = 6 + + Dim h(0 To 1, 0 To 2, 0 To 3) As Double + h(0, 0, 0) = -6 : h(0, 0, 1) = -8 : h(0, 0, 2) = -5 : h(0, 0, 3) = 9 + h(0, 1, 0) = -7 : h(0, 1, 1) = 9 : h(0, 1, 2) = -6 : h(0, 1, 3) = -8 + h(0, 2, 0) = 2 : h(0, 2, 1) = -7 : h(0, 2, 2) = 9 : h(0, 2, 3) = 8 + + h(1, 0, 0) = 7 : h(1, 0, 1) = 4 : h(1, 0, 2) = 4 : h(1, 0, 3) = -6 + h(1, 1, 0) = 9 : h(1, 1, 1) = 9 : h(1, 1, 2) = 4 : h(1, 1, 3) = -4 + h(1, 2, 0) = -3 : h(1, 2, 1) = 7 : h(1, 2, 2) = -2 : h(1, 2, 3) = -3 + + Dim As Integer hx = 2, hy = 3, hz = 4 + + ' Calculate output dimensions + Dim h2x As Integer = gx - fx + 1 + Dim h2y As Integer = gy - fy + 1 + Dim h2z As Integer = gz - fz + 1 + + ' Create output array h2 + Dim h2(0 To h2x-1, 0 To h2y-1, 0 To h2z-1) As Double + + ' Perform deconvolution directly + deconv3D_direct(g(), gx, gy, gz, f(), fx, fy, fz, h2()) + + Print "deconv3(g, f):" & Chr(10) + + For i As Integer = 0 To h2x-1 + For j As Integer = 0 To h2y-1 + For k As Integer = 0 To h2z-1 + Print Using "####"; h2(i, j, k); + Next + Print + Next + If i < h2x-1 Then Print + Next + + ' Calculate dimensions for second deconvolution + Dim kx As Integer = gx - hx + 1 + Dim ky As Integer = gy - hy + 1 + Dim kz As Integer = gz - hz + 1 + + ' Create output array f2 + Dim f2(0 To kx-1, 0 To ky-1, 0 To kz-1) As Double + + ' Perform second deconvolution directly + deconv_g_h_direct(g(), gx, gy, gz, h(), hx, hy, hz, f2()) + + Print Chr(10) & "deconv(g, h):" & Chr(10) + + For i As Integer = 0 To kx-1 + For j As Integer = 0 To ky-1 + For k As Integer = 0 To kz-1 + Print Using "####"; f2(i, j, k); + Next + Print + Next + If i < kx-1 Then Print + Next +End Sub + +main() + +Sleep diff --git a/Task/Deconvolution-2D+/Java/deconvolution-2d+.java b/Task/Deconvolution-2D+/Java/deconvolution-2d+.java new file mode 100644 index 0000000000..9d2d6ec147 --- /dev/null +++ b/Task/Deconvolution-2D+/Java/deconvolution-2d+.java @@ -0,0 +1,279 @@ +import java.util.Arrays; + +public final class Deconvolution { + + public static void main(String[] args) { + final int[] f1 = { -3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1 }; + + final int[] g1 = + { 24, 75, 71, -34, 3, 22, -45, 23, 245, 25, 52, 25, -67, -96, 96, 31, 55, 36, 29, -43, -7 }; + + final int[] h1 = { -8, -9, -3, -1, -6, 7 }; + + final int[][] f2 = { { -5, 2, -2, -6, -7 }, + { 9, 7, -6, 5, -7 }, + { 1, -1, 9, 2, -7 }, + { 5, 9, -9, 2, -5 }, + { -8, 5, -2, 8, 5 } }; + + final int[][] g2 = { { 40, -21, 53, 42, 105, 1, 87, 60, 39, -28 }, + { -92, -64, 19, -167, -71, -47, 128, -109, 40, -21 }, + { 58, 85, -93, 37, 101, -14, 5, 37, -76, -56 }, + { -90, -135, 60, -125, 68, 53, 223, 4, -36, -48 }, + { 78, 16, 7, -199, 156, -162, 29, 28, -103, -10 }, + { -62, -89, 69, -61, 66, 193, -61, 71, -8, -30 }, + { 48, -6, 21, -9, -150, -22, -56, 32, 85, 25 } }; + + final int[][] h2 = { { -8, 1, -7, -2, -9, 4 }, + { 4, 5, -5, 2, 7, -1 }, + { -6, -3, -3, -6, 9, 5 } }; + + final int[][][] f3 = { { { -9, 5, -8 }, { 3, 5, 1 } }, + { { -1, -7, 2 }, { -5, -6, 6 } }, + { { 8, 5, 8 }, { -2, -6, -4 } } }; + + final int[][][] g3 = { { { 54, 42, 53, -42, 85, -72 }, + { 45, -170, 94, -36, 48, 73 }, + { -39, 65, -112, -16, -78, -72 }, + { 6, -11, -6, 62, 49, 8 } }, + { { -57, 49, -23, 52, -135, 66 }, + { -23, 127, -58, -5, -118, 64 }, + { 87, -16, 121, 23, -41, -12 }, + { -19, 29, 35, -148, -11, 45 } }, + { { -55, -147, -146, -31, 55, 60 }, + { -88, -45, -28, 46, -26, -144 }, + { -12, -107, -34, 150, 249, 66 }, + { 11, -15, -34, 27, -78, -50 } }, + { { 56, 67, 108, 4, 2, -48 }, + { 58, 67, 89, 32, 32, -8 }, + { -42, -31, -103, -30, -23, -8 }, + { 6, 4, -26, -10, 26, 12 } } }; + + final int[][][] h3 = { { { -6, -8, -5, 9 }, + { -7, 9, -6, -8 }, + { 2, -7, 9, 8 } }, + { { 7, 4, 4, -6 }, + { 9, 9, 4, -4 }, + { -3, 7, -2, -3 } } }; + + int[] H1 = deconvolution1D(g1, f1); + System.out.println("deconvolution1D(g1, f1) = " + Arrays.toString(H1)); + System.out.println("H1 = h1 ? " + Arrays.equals(H1, h1)); + System.out.println(); + + int[] F1 = deconvolution1D(g1, h1); + System.out.println("deconvolution1D(g1, h1) = " + Arrays.toString(F1)); + System.out.println("F1 = f1 ? " + Arrays.equals(F1, f1)); + System.out.println(); + + int[][] H2 = deconvolution2D(g2, f2); + System.out.println("deconvolution2D(g2, f2) = " + Arrays.deepToString(H2)); + System.out.println("H2 = h2 ? " + Arrays.deepEquals(H2, h2)); + System.out.println(); + + int[][] F2 = deconvolution2D(g2, h2); + System.out.println("deconvolution2D(g2, h2) = " + Arrays.deepToString(F2)); + System.out.println("F2 = f2 ? " + Arrays.deepEquals(F2, f2)); + System.out.println(); + + int[][][] H3 = deconvolution3D(g3, f3); + System.out.println("deconvolution3D(g3, f3) = " + Arrays.deepToString(H3)); + System.out.println("H3 = h3 ? " + Arrays.deepEquals(H3, h3)); + System.out.println(); + + int[][][] F3 = deconvolution3D(g3, h3); + System.out.println("deconvolution3D(g3, h3) = " + Arrays.deepToString(F3)); + System.out.println("F3 = f3 ? " + Arrays.deepEquals(F3, f3)); + } + + private static int[] deconvolution1D(int[] convolved, int[] toRemove) { + return deconvolution(convolved, convolved.length, toRemove, toRemove.length, + 1 , convolved.length - toRemove.length + 1); + } + + private static int[][] deconvolution2D(int[][] convolved, int[][] toRemove) { + int[] convolvedArray = unpack2D(convolved, convolved[0].length); + int[] toRemoveArray = unpack2D(toRemove, convolved[0].length); + int[] toRemainArray = deconvolution(convolvedArray, convolved.length * convolved[0].length, + toRemoveArray, toRemove.length * convolved[0].length, + convolved[0].length, ( convolved[0].length - toRemove[0].length + 1 ) * convolved[0].length); + + return pack2D(toRemainArray, convolved.length - toRemove.length + 1, + convolved[0].length - toRemove[0].length + 1, convolved[0].length); + } + + private static int[][][] deconvolution3D(int[][][] convolved, int[][][] toRemove) { + final int cX = convolved.length; + final int cY = convolved[0].length; + final int cZ = convolved[0][0].length; + + final int rX = toRemove.length; + final int rY = toRemove[0].length; + final int rZ = toRemove[0][0].length; + + int[] convolvedArray = unpack3D(convolved, cY, cZ); + int[] toRemoveArray = unpack3D(toRemove, cY, cZ); + int[] toRemainArray = deconvolution(convolvedArray, cX * cY * cZ, + toRemoveArray, rX * cY * cZ, cY * cZ, ( cX - rX + 1 ) * cY * cZ); + + return pack3D(toRemainArray, cX - rX + 1, cY - rY + 1, cZ - rZ + 1, cY, cZ); + } + + private static int[] deconvolution(int[] convolvedArray, int convolvedLength, + int[] toRemoveArray, int toRemoveLength, + int convolvedRowLength, int toRemainLength) { + + int powerOfTwo = 0; + ReturnValue convolvedResult = padAndComplexify(convolvedArray, powerOfTwo); + Complex[] convolvedPadded = convolvedResult.array; + ReturnValue toRemoveResult = padAndComplexify(toRemoveArray, convolvedResult.powerOfTwo); + Complex[] toRemovePadded = toRemoveResult.array; + powerOfTwo = toRemoveResult.powerOfTwo; + + fft(convolvedPadded, powerOfTwo); + fft(toRemovePadded, powerOfTwo); + Complex[] quotient = new Complex[powerOfTwo]; + for ( int i = 0; i < powerOfTwo; i++ ) { + quotient[i] = convolvedPadded[i].divide(toRemovePadded[i]); + } + + fft(quotient, powerOfTwo); + for ( int i = 0; i < powerOfTwo; i++ ) { + if ( Math.abs(quotient[i].real()) < 0.000_000_000_1 ) { + quotient[i] = Complex.ZERO; + } + } + + int[] toRemainArray = new int[toRemainLength]; + int i = 0; + while ( i > toRemoveLength - convolvedLength - convolvedRowLength ) { + toRemainArray[-i] = Math.toIntExact(Math.round( + quotient[( i + powerOfTwo ) % powerOfTwo].divide(32).real())); + i -= 1; + } + return toRemainArray; + } + + private static Complex[] fft(Complex[] deconvolution1D, int powerOfTwo) { + Complex[] result = Arrays.copyOf(deconvolution1D, deconvolution1D.length); + fft(deconvolution1D, result, powerOfTwo, 1, 0); + return result; + } + + private static void fft(Complex[] deconvolution1D, Complex[] result, + int powerOfTwo, int step, int start) { + + if ( step < powerOfTwo ) { + fft(result, deconvolution1D, powerOfTwo, 2 * step, start); + fft(result, deconvolution1D, powerOfTwo, 2 * step, start + step); + + for ( int j = 0; j < powerOfTwo; j += 2 * step ) { + final double theta = -Math.PI * j / powerOfTwo; + Complex t = new Complex(Math.cos(theta), Math.sin(theta)).multiply(result[j + step + start]); + deconvolution1D[( j / 2 ) + start] = result[j + start].add(t); + deconvolution1D[( ( j + powerOfTwo ) / 2 ) + start] = result[j + start].subtract(t); + } + } + } + + private static int[] unpack2D(int[][] toUnpack, int convolvedY) { + int[] unpacked = new int[toUnpack.length * convolvedY]; + for ( int i = 0; i < toUnpack.length; i++ ) { + for ( int j = 0; j < toUnpack[0].length; j++ ) { + unpacked[i * convolvedY + j] = toUnpack[i][j]; + } + } + return unpacked; + } + + private static int[] unpack3D(int[][][] toUnpack, int convolvedY, int convolvedZ) { + int[] unpacked = new int[toUnpack.length * convolvedY * convolvedZ]; + for ( int i = 0; i < toUnpack.length; i++ ) { + for ( int j = 0; j < toUnpack[0].length; j++ ) { + for ( int k = 0; k < toUnpack[0][0].length; k++ ) { + unpacked[( i * convolvedY + j ) * convolvedZ + k] = toUnpack[i][j][k]; + } + } + } + return unpacked; + } + + private static int[][] pack2D(int[] toPack, int toPackX, int toPackY, int convolvedY) { + int[][] packed = new int[toPackX][toPackY]; + for ( int i = 0; i < toPackX; i++ ) { + for ( int j = 0; j < toPackY; j++ ) { + packed[i][j] = toPack[i * convolvedY + j] / 4; + } + } + return packed; + } + + private static int[][][] pack3D(int[] toPack, int toPackX, int toPackY, int toPackZ, + int convolvedY, int convolvedZ) { + + int[][][] packed = new int[toPackX][toPackY][toPackZ]; + for ( int i = 0; i < toPackX; i++ ) { + for ( int j = 0; j < toPackY; j++ ) { + for ( int k = 0; k < toPackZ; k++ ) { + packed[i][j][k] = toPack[( i * convolvedY + j ) * convolvedZ + k] / 4; + } + } + } + return packed; + } + + private static ReturnValue padAndComplexify(int[] array, int powerOfTwo) { + final int paddedArrayLength = ( powerOfTwo == 0 ) ? + Integer.highestOneBit(array.length - 1) << 1 : powerOfTwo; + + Complex[] paddedArray = new Complex[paddedArrayLength]; + for ( int i = 0; i < paddedArrayLength; i++ ) { + paddedArray[i] = ( i < array.length ) ? new Complex(array[i], 0.0) : Complex.ZERO; + } + return new ReturnValue(paddedArrayLength, paddedArray); + } + + private static record ReturnValue(int powerOfTwo, Complex[] array) {} + +} + +final class Complex { + + public Complex(double aReal, double aImag) { + real = aReal; + imag = aImag; + } + + public Complex add(Complex other) { + return new Complex(real + other.real, imag + other.imag); + } + + public Complex subtract(Complex other) { + return new Complex(real - other.real, imag - other.imag); + } + + public Complex multiply(Complex other) { + return new Complex(real * other.real - imag * other.imag, imag * other.real + real * other.imag); + } + + public Complex divide(int n) { + return new Complex(real / n, imag / n); + } + + public Complex divide(Complex other) { + final double rr = real * other.real + imag * other.imag; + final double ii = imag * other.real - real * other.imag; + final double norm = other.real * other.real + other.imag * other.imag; + return new Complex(rr / norm, ii / norm); + } + + public double real() { + return real; + } + + public static final Complex ZERO = new Complex(0.0, 0.0); + + private final double real; + private final double imag; + +} diff --git a/Task/Deconvolution-2D+/JavaScript/deconvolution-2d+.js b/Task/Deconvolution-2D+/JavaScript/deconvolution-2d+.js new file mode 100644 index 0000000000..d50b0baec9 --- /dev/null +++ b/Task/Deconvolution-2D+/JavaScript/deconvolution-2d+.js @@ -0,0 +1,329 @@ +class Complex { + constructor(aReal, aImag) { + this.real = aReal; + this.imag = aImag; + } + + add(other) { + return new Complex(this.real + other.real, this.imag + other.imag); + } + + subtract(other) { + return new Complex(this.real - other.real, this.imag - other.imag); + } + + multiply(other) { + return new Complex( + this.real * other.real - this.imag * other.imag, + this.imag * other.real + this.real * other.imag + ); + } + + divide(n) { + if (typeof n === 'number') { + return new Complex(this.real / n, this.imag / n); + } else { + // Assume n is another Complex + const rr = this.real * n.real + this.imag * n.imag; + const ii = this.imag * n.real - this.real * n.imag; + const norm = n.real * n.real + n.imag * n.imag; + return new Complex(rr / norm, ii / norm); + } + } + + real() { + return this.real; + } +} + +// Static property for Complex +Complex.ZERO = new Complex(0.0, 0.0); + +class ReturnValue { + constructor(powerOfTwo, array) { + this.powerOfTwo = powerOfTwo; + this.array = array; + } +} + +function deconvolution1D(convolved, toRemove) { + return deconvolution( + convolved, convolved.length, + toRemove, toRemove.length, + 1, convolved.length - toRemove.length + 1 + ); +} + +function deconvolution2D(convolved, toRemove) { + const convolvedArray = unpack2D(convolved, convolved[0].length); + const toRemoveArray = unpack2D(toRemove, convolved[0].length); + const toRemainArray = deconvolution( + convolvedArray, convolved.length * convolved[0].length, + toRemoveArray, toRemove.length * convolved[0].length, + convolved[0].length, (convolved[0].length - toRemove[0].length + 1) * convolved[0].length + ); + + return pack2D( + toRemainArray, + convolved.length - toRemove.length + 1, + convolved[0].length - toRemove[0].length + 1, + convolved[0].length + ); +} + +function deconvolution3D(convolved, toRemove) { + const cX = convolved.length; + const cY = convolved[0].length; + const cZ = convolved[0][0].length; + + const rX = toRemove.length; + const rY = toRemove[0].length; + const rZ = toRemove[0][0].length; + + const convolvedArray = unpack3D(convolved, cY, cZ); + const toRemoveArray = unpack3D(toRemove, cY, cZ); + const toRemainArray = deconvolution( + convolvedArray, cX * cY * cZ, + toRemoveArray, rX * cY * cZ, + cY * cZ, (cX - rX + 1) * cY * cZ + ); + + return pack3D(toRemainArray, cX - rX + 1, cY - rY + 1, cZ - rZ + 1, cY, cZ); +} + +function deconvolution(convolvedArray, convolvedLength, toRemoveArray, toRemoveLength, convolvedRowLength, toRemainLength) { + let powerOfTwo = 0; + let convolvedResult = padAndComplexify(convolvedArray, powerOfTwo); + let convolvedPadded = convolvedResult.array; + let toRemoveResult = padAndComplexify(toRemoveArray, convolvedResult.powerOfTwo); + let toRemovePadded = toRemoveResult.array; + powerOfTwo = toRemoveResult.powerOfTwo; + + fft(convolvedPadded, powerOfTwo); + fft(toRemovePadded, powerOfTwo); + let quotient = new Array(powerOfTwo); + for (let i = 0; i < powerOfTwo; i++) { + quotient[i] = convolvedPadded[i].divide(toRemovePadded[i]); + } + + fft(quotient, powerOfTwo); + for (let i = 0; i < powerOfTwo; i++) { + if (Math.abs(quotient[i].real) < 0.0000000001) { + quotient[i] = Complex.ZERO; + } + } + + let toRemainArray = new Array(toRemainLength); + let i = 0; + while (i > toRemoveLength - convolvedLength - convolvedRowLength) { + toRemainArray[-i] = Math.round( + quotient[(i + powerOfTwo) % powerOfTwo].divide(32).real + ); + i -= 1; + } + return toRemainArray; +} + +function fft(deconvolution1D, powerOfTwo) { + const result = [...deconvolution1D]; + fftRecursive(deconvolution1D, result, powerOfTwo, 1, 0); + return result; +} + +function fftRecursive(deconvolution1D, result, powerOfTwo, step, start) { + if (step < powerOfTwo) { + fftRecursive(result, deconvolution1D, powerOfTwo, 2 * step, start); + fftRecursive(result, deconvolution1D, powerOfTwo, 2 * step, start + step); + + for (let j = 0; j < powerOfTwo; j += 2 * step) { + const theta = -Math.PI * j / powerOfTwo; + const t = new Complex(Math.cos(theta), Math.sin(theta)).multiply(result[j + step + start]); + deconvolution1D[(j / 2) + start] = result[j + start].add(t); + deconvolution1D[((j + powerOfTwo) / 2) + start] = result[j + start].subtract(t); + } + } +} + +function unpack2D(toUnpack, convolvedY) { + let unpacked = new Array(toUnpack.length * convolvedY); + for (let i = 0; i < toUnpack.length; i++) { + for (let j = 0; j < toUnpack[0].length; j++) { + unpacked[i * convolvedY + j] = toUnpack[i][j]; + } + } + return unpacked; +} + +function unpack3D(toUnpack, convolvedY, convolvedZ) { + let unpacked = new Array(toUnpack.length * convolvedY * convolvedZ); + for (let i = 0; i < toUnpack.length; i++) { + for (let j = 0; j < toUnpack[0].length; j++) { + for (let k = 0; k < toUnpack[0][0].length; k++) { + unpacked[(i * convolvedY + j) * convolvedZ + k] = toUnpack[i][j][k]; + } + } + } + return unpacked; +} + +function pack2D(toPack, toPackX, toPackY, convolvedY) { + let packed = Array(toPackX).fill().map(() => Array(toPackY)); + for (let i = 0; i < toPackX; i++) { + for (let j = 0; j < toPackY; j++) { + packed[i][j] = Math.floor(toPack[i * convolvedY + j] / 4); + } + } + return packed; +} + +function pack3D(toPack, toPackX, toPackY, toPackZ, convolvedY, convolvedZ) { + let packed = Array(toPackX).fill().map(() => + Array(toPackY).fill().map(() => + Array(toPackZ) + ) + ); + + for (let i = 0; i < toPackX; i++) { + for (let j = 0; j < toPackY; j++) { + for (let k = 0; k < toPackZ; k++) { + packed[i][j][k] = Math.floor(toPack[(i * convolvedY + j) * convolvedZ + k] / 4); + } + } + } + return packed; +} + +function padAndComplexify(array, powerOfTwo) { + const paddedArrayLength = (powerOfTwo === 0) ? + 1 << (32 - Math.clz32(array.length - 1)) : powerOfTwo; + + let paddedArray = new Array(paddedArrayLength); + for (let i = 0; i < paddedArrayLength; i++) { + paddedArray[i] = (i < array.length) ? new Complex(array[i], 0.0) : Complex.ZERO; + } + return new ReturnValue(paddedArrayLength, paddedArray); +} + +// Main function +function main() { + const f1 = [-3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1]; + + const g1 = [24, 75, 71, -34, 3, 22, -45, 23, 245, 25, 52, 25, -67, -96, 96, 31, 55, 36, 29, -43, -7]; + + const h1 = [-8, -9, -3, -1, -6, 7]; + + const f2 = [ + [-5, 2, -2, -6, -7], + [9, 7, -6, 5, -7], + [1, -1, 9, 2, -7], + [5, 9, -9, 2, -5], + [-8, 5, -2, 8, 5] + ]; + + const g2 = [ + [40, -21, 53, 42, 105, 1, 87, 60, 39, -28], + [-92, -64, 19, -167, -71, -47, 128, -109, 40, -21], + [58, 85, -93, 37, 101, -14, 5, 37, -76, -56], + [-90, -135, 60, -125, 68, 53, 223, 4, -36, -48], + [78, 16, 7, -199, 156, -162, 29, 28, -103, -10], + [-62, -89, 69, -61, 66, 193, -61, 71, -8, -30], + [48, -6, 21, -9, -150, -22, -56, 32, 85, 25] + ]; + + const h2 = [ + [-8, 1, -7, -2, -9, 4], + [4, 5, -5, 2, 7, -1], + [-6, -3, -3, -6, 9, 5] + ]; + + // const f3 = [ + // [[- 9, 5, -8], [3, 5, 1]], + // [[-1, -7, 2], [-5, -6, 6]], + // [[8, 5, 8], [-2, -6, -4]] + // ]; + + // const g3 = [ + // [ + // [54, 42, 53, -42, 85, -72], + // [45, -170, 94, -36, 48, 73], + // [-39, 65, -112, -16, -78, -72], + // [6, -11, -6, 62, 49, 8] + // ], + // [ + // [-57, 49, -23, 52, -135, 66], + // [-23, 127, -58, -5, -118, 64], + // [87, -16, 121, 23, -41, -12], + // [-19, 29, 35, -148, -11, 45] + // ], + // [ + // [-55, -147, -146, -31, 55, 60], + // [-88, -45, -28, 46, -26, -144], + // [-12, -107, -34, 150, 249, 66], + // [11, -15, -34, 27, -78, -50] + // ], + // [ + // [56, 67, 108, 4, 2, -48], + // [58, 67, 89, 32, 32, -8], + // [-42, -31, -103, -30, -23, -8], + // [6, 4, -26, -10, 26, 12] + // ] + // ]; + + // const h3 = [ + // [ + // [-6, -8, -5, 9], + // [-7, 9, -6, -8], + // [2, -7, 9, 8] + // ], + // [ + // [7, 4, 4, -6], + // [9, 9, 4, -4], + // [-3, 7, -2, -3] + // ] + // ]; + + const H1 = deconvolution1D(g1, f1); + console.log("deconvolution1D(g1, f1) = " + JSON.stringify(H1)); + console.log("H1 = h1 ? " + arraysEqual(H1, h1)); + console.log(); + + const F1 = deconvolution1D(g1, h1); + console.log("deconvolution1D(g1, h1) = " + JSON.stringify(F1)); + console.log("F1 = f1 ? " + arraysEqual(F1, f1)); + console.log(); + + // const H2 = deconvolution2D(g2, f2); + // console.log("deconvolution2D(g2, f2) = " + JSON.stringify(H2)); + // console.log("H2 = h2 ? " + arraysDeepEqual(H2, h2)); + // console.log(); + + // const F2 = deconvolution2D(g2, h2); + // console.log("deconvolution2D(g2, h2) = " + JSON.stringify(F2)); + // console.log("F2 = f2 ? " + arraysDeepEqual(F2, f2)); + // console.log(); + + // const H3 = deconvolution3D(g3, f3); + // console.log("deconvolution3D(g3, f3) = " + JSON.stringify(H3)); + // console.log("H3 = h3 ? " + arraysDeepEqual(H3, h3)); + // console.log(); + + // const F3 = deconvolution3D(g3, h3); + // console.log("deconvolution3D(g3, h3) = " + JSON.stringify(F3)); + // console.log("F3 = f3 ? " + arraysDeepEqual(F3, f3)); +} + +// Helper functions for array comparison +function arraysEqual(a, b) { + if (a.length !== b.length) return false; + for (let i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + return true; +} + +function arraysDeepEqual(a, b) { + return JSON.stringify(a) === JSON.stringify(b); +} + +// Run the main function +main(); diff --git a/Task/Deconvolution-2D+/Julia/deconvolution-2d+.julia b/Task/Deconvolution-2D+/Julia/deconvolution-2d+.jl similarity index 100% rename from Task/Deconvolution-2D+/Julia/deconvolution-2d+.julia rename to Task/Deconvolution-2D+/Julia/deconvolution-2d+.jl diff --git a/Task/Deconvolution-2D+/Rust/deconvolution-2d+.rs b/Task/Deconvolution-2D+/Rust/deconvolution-2d+.rs new file mode 100644 index 0000000000..dd8d669ebc --- /dev/null +++ b/Task/Deconvolution-2D+/Rust/deconvolution-2d+.rs @@ -0,0 +1,359 @@ +extern crate num_complex; // 0.4.6 + +use std::f64::consts::PI; +use num_complex::Complex; +use std::fmt; + +struct ReturnValue { + power_of_two: i32, + list: Vec>, +} + +// Custom Display implementation for Complex +// impl fmt::Display for Complex { +// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +// if self.im >= 0.0 { +// write!(f, "{}+{}i", self.re, self.im) +// } else { +// write!(f, "{}{}i", self.re, self.im) +// } +// } +// } + +fn print_vector(list: &[T]) { + print!("["); + for (i, item) in list.iter().enumerate() { + if i < list.len() - 1 { + print!("{}, ", item); + } else { + print!("{}", item); + } + } + print!("]"); +} + +fn print_2d_vector(lists: &[Vec]) { + print!("["); + for (i, list) in lists.iter().enumerate() { + print_vector(list); + if i < lists.len() - 1 { + print!(", "); + } + } + print!("]"); +} + +fn print_3d_vector(lists: &[Vec>]) { + print!("["); + for (i, list) in lists.iter().enumerate() { + print_2d_vector(list); + if i < lists.len() - 1 { + print!(", "); + } + } + println!("]"); +} + +fn pad_and_complexify(list: &[i32], power_of_two: i32) -> ReturnValue { + let padded_vector_size = if power_of_two == 0 { + 1 << (f64::ceil(f64::log2(list.len() as f64)) as i32) + } else { + power_of_two + }; + + let mut padded_vector = vec![Complex::new(0.0, 0.0); padded_vector_size as usize]; + for i in 0..padded_vector_size { + padded_vector[i as usize] = if i < list.len() as i32 { + Complex::new(list[i as usize] as f64, 0.0) + } else { + Complex::new(0.0, 0.0) + }; + } + + ReturnValue { + power_of_two: padded_vector_size, + list: padded_vector, + } +} + +fn pack_2d(to_pack: &[i32], to_pack_x: usize, to_pack_y: usize, convolved_y: i32) -> Vec> { + let mut packed = vec![vec![0; to_pack_y]; to_pack_x]; + for i in 0..to_pack_x { + for j in 0..to_pack_y { + packed[i][j] = to_pack[i * convolved_y as usize + j] / 4; + } + } + packed +} + +fn pack_3d(to_pack: &[i32], to_pack_x: usize, to_pack_y: usize, to_pack_z: usize, + convolved_y: i32, convolved_z: i32) -> Vec>> { + let mut packed = vec![vec![vec![0; to_pack_z]; to_pack_y]; to_pack_x]; + for i in 0..to_pack_x { + for j in 0..to_pack_y { + for k in 0..to_pack_z { + packed[i][j][k] = to_pack[(i * convolved_y as usize + j) * convolved_z as usize + k] / 4; + } + } + } + packed +} + +fn unpack_2d(to_unpack: &[Vec], convolved_y: i32) -> Vec { + let mut unpacked = vec![0; to_unpack.len() * convolved_y as usize]; + for i in 0..to_unpack.len() { + for j in 0..to_unpack[0].len() { + unpacked[i * convolved_y as usize + j] = to_unpack[i][j]; + } + } + unpacked +} + +fn unpack_3d(to_unpack: &[Vec>], convolved_y: i32, convolved_z: i32) -> Vec { + let mut unpacked = vec![0; to_unpack.len() * convolved_y as usize * convolved_z as usize]; + for i in 0..to_unpack.len() { + for j in 0..to_unpack[0].len() { + for k in 0..to_unpack[0][0].len() { + unpacked[(i * convolved_y as usize + j) * convolved_z as usize + k] = to_unpack[i][j][k]; + } + } + } + unpacked +} + +fn fft_recursive(deconvolution1d: &mut [Complex], result: &mut [Complex], + power_of_two: i32, step: i32, start: i32) { + if step < power_of_two { + fft_recursive(result, deconvolution1d, power_of_two, 2 * step, start); + fft_recursive(result, deconvolution1d, power_of_two, 2 * step, start + step); + + for j in (0..power_of_two).step_by(2 * step as usize) { + let theta = -PI * j as f64 / power_of_two as f64; + let t = Complex::new(f64::cos(theta), f64::sin(theta)) * result[(j + step + start) as usize]; + deconvolution1d[(j / 2 + start) as usize] = result[(j + start) as usize] + t; + deconvolution1d[((j + power_of_two) / 2 + start) as usize] = result[(j + start) as usize] - t; + } + } +} + +fn fft(deconvolution1d: &mut [Complex], power_of_two: i32) -> Vec> { + let mut result = deconvolution1d.to_vec(); + fft_recursive(deconvolution1d, &mut result, power_of_two, 1, 0); + result +} + +fn deconvolution(convolved: &[i32], convolved_size: i32, remove: &[i32], remove_size: i32, + convolved_row_size: i32, remain_size: i32) -> Vec { + let mut power_of_two = 0; + let convoluted_result = pad_and_complexify(convolved, power_of_two); + let mut convoluted_padded = convoluted_result.list; + let remove_result = pad_and_complexify(remove, convoluted_result.power_of_two); + let mut remove_padded = remove_result.list; + power_of_two = remove_result.power_of_two; + + fft(&mut convoluted_padded, power_of_two); + fft(&mut remove_padded, power_of_two); + + let mut quotient = vec![Complex::new(0.0, 0.0); power_of_two as usize]; + for i in 0..power_of_two { + quotient[i as usize] = convoluted_padded[i as usize] / remove_padded[i as usize]; + } + + fft(&mut quotient, power_of_two); + for i in 0..power_of_two { + if quotient[i as usize].re.abs() < 0.000_000_000_1 { + quotient[i as usize] = Complex::new(0.0, 0.0); + } + } + + let mut remain_vector = vec![0; remain_size as usize]; + let mut i = 0; + while i > remove_size - convolved_size - convolved_row_size { + remain_vector[(-i) as usize] = (quotient[((i + power_of_two) % power_of_two) as usize] / Complex::new(32.0, 0.0)).re.round() as i32; + i -= 1; + } + + remain_vector +} + +fn deconvolution_1d(convolved: &[i32], remove: &[i32]) -> Vec { + deconvolution( + convolved, + convolved.len() as i32, + remove, + remove.len() as i32, + 1, + convolved.len() as i32 - remove.len() as i32 + 1 + ) +} + +fn deconvolution_2d(convolved: &[Vec], to_remove: &[Vec]) -> Vec> { + let convolved_1d = unpack_2d(convolved, convolved[0].len() as i32); + let to_remove_1d = unpack_2d(to_remove, convolved[0].len() as i32); + + let to_remain_1d = deconvolution( + &convolved_1d, + (convolved.len() * convolved[0].len()) as i32, + &to_remove_1d, + (to_remove.len() * convolved[0].len()) as i32, + convolved[0].len() as i32, + ((convolved[0].len() - to_remove[0].len() + 1) * convolved[0].len()) as i32 + ); + + pack_2d( + &to_remain_1d, + convolved.len() - to_remove.len() + 1, + convolved[0].len() - to_remove[0].len() + 1, + convolved[0].len() as i32 + ) +} + +fn deconvolution_3d(convolved: &[Vec>], to_remove: &[Vec>]) -> Vec>> { + let cx = convolved.len(); + let cy = convolved[0].len(); + let cz = convolved[0][0].len(); + + let rx = to_remove.len(); + let ry = to_remove[0].len(); + let rz = to_remove[0][0].len(); + + let convolved_1d = unpack_3d(convolved, cy as i32, cz as i32); + let to_remove_1d = unpack_3d(to_remove, cy as i32, cz as i32); + + let to_remain_1d = deconvolution( + &convolved_1d, + (cx * cy * cz) as i32, + &to_remove_1d, + (rx * cy * cz) as i32, + (cy * cz) as i32, + ((cx - rx + 1) * cy * cz) as i32 + ); + + pack_3d( + &to_remain_1d, + cx - rx + 1, + cy - ry + 1, + cz - rz + 1, + cy as i32, + cz as i32 + ) +} + +fn main() { + let f1 = vec![-3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1]; + + let g1 = vec![ + 24, 75, 71, -34, 3, 22, -45, 23, 245, 25, 52, 25, -67, -96, 96, 31, 55, 36, 29, -43, -7 + ]; + + let h1 = vec![-8, -9, -3, -1, -6, 7]; + + let f2 = vec![ + vec![-5, 2, -2, -6, -7], + vec![9, 7, -6, 5, -7], + vec![1, -1, 9, 2, -7], + vec![5, 9, -9, 2, -5], + vec![-8, 5, -2, 8, 5], + ]; + + let g2 = vec![ + vec![40, -21, 53, 42, 105, 1, 87, 60, 39, -28], + vec![-92, -64, 19, -167, -71, -47, 128, -109, 40, -21], + vec![58, 85, -93, 37, 101, -14, 5, 37, -76, -56], + vec![-90, -135, 60, -125, 68, 53, 223, 4, -36, -48], + vec![78, 16, 7, -199, 156, -162, 29, 28, -103, -10], + vec![-62, -89, 69, -61, 66, 193, -61, 71, -8, -30], + vec![48, -6, 21, -9, -150, -22, -56, 32, 85, 25], + ]; + + let h2 = vec![ + vec![-8, 1, -7, -2, -9, 4], + vec![4, 5, -5, 2, 7, -1], + vec![-6, -3, -3, -6, 9, 5], + ]; + + let f3 = vec![ + vec![vec![-9, 5, -8], vec![3, 5, 1]], + vec![vec![-1, -7, 2], vec![-5, -6, 6]], + vec![vec![8, 5, 8], vec![-2, -6, -4]], + ]; + + let g3 = vec![ + vec![ + vec![54, 42, 53, -42, 85, -72], + vec![45, -170, 94, -36, 48, 73], + vec![-39, 65, -112, -16, -78, -72], + vec![6, -11, -6, 62, 49, 8], + ], + vec![ + vec![-57, 49, -23, 52, -135, 66], + vec![-23, 127, -58, -5, -118, 64], + vec![87, -16, 121, 23, -41, -12], + vec![-19, 29, 35, -148, -11, 45], + ], + vec![ + vec![-55, -147, -146, -31, 55, 60], + vec![-88, -45, -28, 46, -26, -144], + vec![-12, -107, -34, 150, 249, 66], + vec![11, -15, -34, 27, -78, -50], + ], + vec![ + vec![56, 67, 108, 4, 2, -48], + vec![58, 67, 89, 32, 32, -8], + vec![-42, -31, -103, -30, -23, -8], + vec![6, 4, -26, -10, 26, 12], + ], + ]; + + let h3 = vec![ + vec![ + vec![-6, -8, -5, 9], + vec![-7, 9, -6, -8], + vec![2, -7, 9, 8], + ], + vec![ + vec![7, 4, 4, -6], + vec![9, 9, 4, -4], + vec![-3, 7, -2, -3], + ], + ]; + + let h1_result = deconvolution_1d(&g1, &f1); + print!("deconvolution1D(g1, f1) = "); + print_vector(&h1_result); + println!(); + println!("H1 = h1 ? {}", h1_result == h1); + println!(); + + let f1_result = deconvolution_1d(&g1, &h1); + print!("deconvolution1D(g1, h1) = "); + print_vector(&f1_result); + println!(); + println!("F1 = f1 ? {}", f1_result == f1); + println!(); + + let h2_result = deconvolution_2d(&g2, &f2); + print!("deconvolution2D(g2, f2) = "); + print_2d_vector(&h2_result); + println!(); + println!("H2 = h2 ? {}", h2_result == h2); + println!(); + + let f2_result = deconvolution_2d(&g2, &h2); + print!("deconvolution2D(g2, h2) = "); + print_2d_vector(&f2_result); + println!(); + println!("F2 = f2 ? {}", f2_result == f2); + println!(); + + let h3_result = deconvolution_3d(&g3, &f3); + print!("deconvolution3D(g3, f3) = "); + print_3d_vector(&h3_result); + println!("H3 = h3 ? {}", h3_result == h3); + println!(); + + let f3_result = deconvolution_3d(&g3, &h3); + print!("deconvolution3D(g3, h3) = "); + print_3d_vector(&f3_result); + println!("F3 = f3 ? {}", f3_result == f3); +} diff --git a/Task/Deconvolution-2D+/Wren/deconvolution-2d+.wren b/Task/Deconvolution-2D+/Wren/deconvolution-2d+.wren index 5e5247ce7a..64f34d77f7 100644 --- a/Task/Deconvolution-2D+/Wren/deconvolution-2d+.wren +++ b/Task/Deconvolution-2D+/Wren/deconvolution-2d+.wren @@ -1,5 +1,5 @@ -import "/complex" for Complex -import "/fmt" for Fmt +import "./complex" for Complex +import "./fmt" for Fmt var fft2 // recursive fft2 = Fn.new { |buf, out, n, step, start| diff --git a/Task/Deepcopy/Ada/deepcopy.adb b/Task/Deepcopy/Ada/deepcopy.adb new file mode 100644 index 0000000000..3c60136c46 --- /dev/null +++ b/Task/Deepcopy/Ada/deepcopy.adb @@ -0,0 +1,16 @@ +with Ada.Containers.Doubly_Linked_Lists; +with Ada.Text_IO; + +procedure Deepcopy is + package List is new Ada.Containers.Doubly_Linked_Lists (Integer); + L1, L2 : List.List; +begin + L1 := List.Empty_List; + L1.Append (1); + L1.Append (2); + L2 := L1; + L2.Append (3); + + Ada.Text_IO.Put_Line + ("L1.Length = " & L1.Length'Image & " L2.Length = " & L2.Length'Image); +end Deepcopy; diff --git a/Task/Deepcopy/Delphi/deepcopy.delphi b/Task/Deepcopy/Delphi/deepcopy.pas similarity index 100% rename from Task/Deepcopy/Delphi/deepcopy.delphi rename to Task/Deepcopy/Delphi/deepcopy.pas diff --git a/Task/Deepcopy/EasyLang/deepcopy.easy b/Task/Deepcopy/EasyLang/deepcopy.easy new file mode 100644 index 0000000000..e0c436fb88 --- /dev/null +++ b/Task/Deepcopy/EasyLang/deepcopy.easy @@ -0,0 +1,10 @@ +# There are no more complex data structures than arrays. +# Arrays are always copied deeply. +# If you need something faster, you can swap arrays or +# pass them to procedures by reference. +# +a$[] = [ "apple" "banana" "orange" ] +b$[] = a$[] +b$[1] = "apricot" +print a$[] +print b$[] diff --git a/Task/Deepcopy/FutureBasic/deepcopy.basic b/Task/Deepcopy/FutureBasic/deepcopy.basic new file mode 100644 index 0000000000..f473cfeedc --- /dev/null +++ b/Task/Deepcopy/FutureBasic/deepcopy.basic @@ -0,0 +1,44 @@ +include "NSLog.incl" + +begin record DeepCopy + NSInteger value1 + CFStringRef value2 + CFStringRef value3 + Boolean value4 + double value5 +end record + +local fn DoDeepCopy + DeepCopy a, b + + a.value1 = 10 + a.value2 = @"A" + a.value3 = @"Okay" + a.value4 = YES + a.value5 = 1.985766472453666 + + b = a + b.value1 = 20 + b.value2 = @"B" + b.value3 = @"Not Okay" + b.value4 = NO + b.value5 = 3.148556644245367 + + NSLog( @"\nValue of 'a':" ) + NSLog( @"a.value1: %ld", a.value1 ) + NSLog( @"a.value2: %@", a.value2 ) + NSLog( @"a.value3: %@%", a.value3 ) + NSLog( @"b.value4: %@", fn BoolString( a.value4 ) ) + NSLog( @"a.value5: %.15f", a.value5 ) + + NSLog( @"\nValue of 'b':" ) + NSLog( @"b.value1: %ld", b.value1 ) + NSLog( @"b.value2: %@", b.value2 ) + NSLog( @"b.value3: %@%", b.value3 ) + NSLog( @"b.value4: %@", fn BoolString( b.value4 ) ) + NSLog( @"b.value5: %.15f", b.value5 ) +end fn + +fn DoDeepCopy + +HandleEvents diff --git a/Task/Deepcopy/Julia/deepcopy.julia b/Task/Deepcopy/Julia/deepcopy.jl similarity index 100% rename from Task/Deepcopy/Julia/deepcopy.julia rename to Task/Deepcopy/Julia/deepcopy.jl diff --git a/Task/Deepcopy/Kotlin/deepcopy.kotlin b/Task/Deepcopy/Kotlin/deepcopy.kts similarity index 100% rename from Task/Deepcopy/Kotlin/deepcopy.kotlin rename to Task/Deepcopy/Kotlin/deepcopy.kts diff --git a/Task/Deepcopy/OCaml/deepcopy-1.ocaml b/Task/Deepcopy/OCaml/deepcopy-1.ml similarity index 100% rename from Task/Deepcopy/OCaml/deepcopy-1.ocaml rename to Task/Deepcopy/OCaml/deepcopy-1.ml diff --git a/Task/Deepcopy/OCaml/deepcopy-2.ocaml b/Task/Deepcopy/OCaml/deepcopy-2.ml similarity index 100% rename from Task/Deepcopy/OCaml/deepcopy-2.ocaml rename to Task/Deepcopy/OCaml/deepcopy-2.ml diff --git a/Task/Deepcopy/Phix/deepcopy-1.phix b/Task/Deepcopy/Phix/deepcopy-1.phix index b313289ff8..d6a0209534 100644 --- a/Task/Deepcopy/Phix/deepcopy-1.phix +++ b/Task/Deepcopy/Phix/deepcopy-1.phix @@ -1,8 +1,6 @@ ---> - object a, b - a = {1,{2,3},"four",{5.6,7,{8.9}}} - b = a - b[3] = 4 - ?a - ?b - - function deep_copy(object o) - object res - if atom(o) then - res = o - else - res = repeat(' ',length(o)) - for i=1 to length(o) do - res[i] = deep_copy(o[i]) - end for - end if - return res - end function +function deep_copy(object o) + object res + if atom(o) then + res = o + else + res = repeat(' ',length(o)) + for i=1 to length(o) do + res[i] = deep_copy(o[i]) + end for + end if + return res +end function - object c = deep_copy(b) - ?c - - include builtins\serialize.e - object d = deserialize(serialize(a)) - ?d - - with javascript_semantics - function descending_primes(sequence res, atom p=0, max_digit=9) - for d=1 to max_digit do - atom np = p*10+d - if odd(d) and is_prime(np) then res &= np end if - res = descending_primes(res,np,d-1) - end for - return res - end function +with javascript_semantics +function descending_primes(sequence res, atom p=0, max_digit=9) + for d=1 to max_digit do + atom np = p*10+d + if odd(d) and is_prime(np) then res &= np end if + res = descending_primes(res,np,d-1) + end for + return res +end function - sequence r = sort(descending_primes({2})), - --sequence r = descending_primes({2}), - j = join_by(r,1,11," ","\n","%8d") - printf(1,"There are %,d descending primes:\n%s\n",{length(r),j}) - - with javascript_semantics - function descending_primes() - sequence powerset = tagset(9), - res = {} - while length(powerset) do - res &= filter(powerset,is_prime) - sequence next = {} - for i=1 to length(powerset) do - for d=1 to remainder(powerset[i],10)-1 do - next &= powerset[i]*10+d - end for - end for - powerset = next - end while - return res - end function +with javascript_semantics +function descending_primes() + sequence powerset = tagset(9), res = {} + do + res &= filter(powerset,is_prime) + sequence next = {} + for p in powerset do + for d=1 to remainder(p,10)-1 do + next &= p*10+d + end for + end for + powerset = next + until length(powerset)=0 + return res +end function - sequence r = descending_primes(), - j = join_by(r,1,11," ","\n","%8d") - printf(1,"There are %,d descending primes:\n%s\n",{length(r),j}) - - try - integer i = 1/0 - catch e - ?e[E_USER] - end try - puts(1,"still running...\n") - - with javascript_semantics - procedure samechar(sequence s) - string msg = "all characters are the same" - integer l = length(s) - if l>=2 then - integer ch = s[1] - for i=2 to l do - integer si = s[i] - if si!=ch then - string su = utf32_to_utf8({si}) - msg = sprintf(`first different character "%s"(#%02x) at position %d`,{su,si,i}) - exit - end if - end for - end if - printf(1,"\"%s\" (length %d): %s\n",{utf32_to_utf8(s),l,msg}) - end procedure +with javascript_semantics +procedure samechar(sequence s) + string msg = "all characters are the same" + integer l = length(s) + if l>=2 then + integer ch = s[1] + for i=2 to l do + integer si = s[i] + if si!=ch then + string su = utf32_to_utf8({si}) + msg = sprintf(`first different character "%s"(#%02x) at position %d`,{su,si,i}) + exit + end if + end for + end if + printf(1,"\"%s\" (length %d): %s\n",{utf32_to_utf8(s),l,msg}) +end procedure - constant tests = {""," ","2","333",".55","tttTTT","4444 444k", - utf8_to_utf32("🐶🐶🐺🐶"),utf8_to_utf32("🎄🎄🎄🎄")} - for i=1 to length(tests) do samechar(tests[i]) end for - - procedure all_uniq(sequence s) - string chars = "" - sequence posns = {}, - multi = {} - integer lm = 0 - for i=1 to length(s) do - integer si = s[i], - k = find(si,chars) - if k=0 then - chars &= si - posns &= {{i}} - else - posns[k] &= i - if length(posns[k])=2 then - multi &= k - lm += 1 - end if - end if - end for - string msg = sprintf("\"%s\" (length %d): ",{s,length(s)}), - nod = ordinal(lm,true), - ess = "s"[1..lm>1], - res = iff(lm=0?"all characters are unique" - :sprintf("contains %s duplicate%s:",{nod,ess})) - printf(1,"%s %s\n",{msg,res}) - res = repeat(' ',length(msg)) - for i=1 to length(multi) do - integer mi = multi[i], - ci = chars[mi] - printf(1,"%s '%c'(#%02x) at %V\n",{res,ci,ci,posns[mi]}) - end for - printf(1,"\n") - end procedure +with javascript_semantics +procedure all_uniq(sequence s) + string chars = "" + sequence posns = {}, + multi = {} + integer lm = 0 + for i=1 to length(s) do + integer si = s[i], + k = find(si,chars) + if k=0 then + chars &= si + posns &= {{i}} + else + posns[k] &= i + if length(posns[k])=2 then + multi &= k + lm += 1 + end if + end if + end for + string msg = sprintf("\"%s\" (length %d): ",{s,length(s)}), + nod = ordinal(lm,true), + ess = "s"[1..lm>1], + res = iff(lm=0?"all characters are unique" + :sprintf("contains %s duplicate%s:",{nod,ess})) + printf(1,"%s %s\n",{msg,res}) + res = repeat(' ',length(msg)) + for i=1 to length(multi) do + integer mi = multi[i], + ci = chars[mi] + printf(1,"%s '%c'(#%02x) at %V\n",{res,ci,ci,posns[mi]}) + end for + printf(1,"\n") +end procedure - constant tests = {"",".","abcABC","XYZ ZYX","1234567890ABCDEFGHIJKLMN0PQRSTUVWXYZ", - "01234567890ABCDEFGHIJKLMN0PQRSTUVWXYZ0X", - " ","2","333","55","tttTTT","tTTTtt","4444 444k"} - papply(tests,all_uniq) - b ) + + [ dip [ 0 0 true ] + dup size 2 < iff + drop done + dup size 1 - times + [ behead 2dup has iff + [ swap find + dip not + 2swap 2drop + i^ tuck + 1+ rot + 0 conclude ] done + drop ] + drop ] is uniquechars ( $ --> n n b ) + + [ dup say 'String "' + echo$ + say '" has length ' + dup size echo + say ". " + dup uniquechars iff + [ say "There are no duplicated characters." + drop 2drop ] + else + [ rot over peek + dup say 'The character "' + emit + say '" (hex:' + 16 base put + echo + base release + say ") is at positions " + swap echo + say " and " + echo + say "." ] + cr ] is task ( $ --> ) + + $ "" task + $ "." task + $ "abcABC" task + $ "XYZ ZYX" task + $ "1234567890ABCDEFGHIJKLMN0PQRSTUVWXYZ" task diff --git a/Task/Determine-if-a-string-has-all-unique-characters/Raku/determine-if-a-string-has-all-unique-characters.raku b/Task/Determine-if-a-string-has-all-unique-characters/Raku/determine-if-a-string-has-all-unique-characters.raku index 0fe534d8b0..194d5ae80f 100644 --- a/Task/Determine-if-a-string-has-all-unique-characters/Raku/determine-if-a-string-has-all-unique-characters.raku +++ b/Task/Determine-if-a-string-has-all-unique-characters/Raku/determine-if-a-string-has-all-unique-characters.raku @@ -1,8 +1,7 @@ -> $str { my $i = 0; print "\n{$str.raku} (length: {$str.chars}), has "; - my %m; - %m{$_}.push: ++$i for $str.comb; + my %m = $str.comb.Bag; if any(%m.values) > 1 { say "duplicated characters:"; say "'{.key}' ({.key.uninames}; hex ordinal: {(.key.ords).fmt: "0x%X"})" ~ diff --git a/Task/Determine-if-a-string-has-all-unique-characters/Rust/determine-if-a-string-has-all-unique-characters.rust b/Task/Determine-if-a-string-has-all-unique-characters/Rust/determine-if-a-string-has-all-unique-characters.rs similarity index 100% rename from Task/Determine-if-a-string-has-all-unique-characters/Rust/determine-if-a-string-has-all-unique-characters.rust rename to Task/Determine-if-a-string-has-all-unique-characters/Rust/determine-if-a-string-has-all-unique-characters.rs diff --git a/Task/Determine-if-a-string-has-all-unique-characters/S-BASIC/determine-if-a-string-has-all-unique-characters.basic b/Task/Determine-if-a-string-has-all-unique-characters/S-BASIC/determine-if-a-string-has-all-unique-characters.basic new file mode 100644 index 0000000000..1756386cc4 --- /dev/null +++ b/Task/Determine-if-a-string-has-all-unique-characters/S-BASIC/determine-if-a-string-has-all-unique-characters.basic @@ -0,0 +1,50 @@ +comment + Return 0 if there are no repeated characters in s + (including the special case of an empty string), + otherwise the first position where a character + duplicates one previously encountered +end +function repeated_chars(s = string) = integer + var i, j, slen, result = integer + slen = len(s) + if slen < 2 then + result = 0 + else + begin + result = 0 + for i = 1 to slen - 1 + for j = i + 1 to slen + if mid(s,i,1) = mid(s,j,1) and result = 0 then + result = j + next j + next i + end +end = result + +procedure report(str = string) + var p, first = integer + p = repeated_chars(str) + if p = 0 then + print chr(34); str; chr(34); " (length ="; len(str); \ + ") has no duplicate characters" + else + begin + first = instr(1, str, mid(str,p,1)) + print chr(34); str; chr(34); " (length ="; len(str); \ + ") has duplicate characters:" + print "'"; mid(str,p,1); "' (= "; right$(hex$(asc(mid(str,p,1))),2); \ + "h)"; " appears at positions"; first; " and"; p + + end + print +end + +rem - test cases + +report "" +report "." +report "abcABC" +report "XYZ ZYX" +report "1234567890ABCDEFGHIJKLMN0PQRSTUVWXYZ" + +end diff --git a/Task/Determine-if-a-string-has-all-unique-characters/Uiua/determine-if-a-string-has-all-unique-characters.uiua b/Task/Determine-if-a-string-has-all-unique-characters/Uiua/determine-if-a-string-has-all-unique-characters.uiua new file mode 100644 index 0000000000..c82ee16f17 --- /dev/null +++ b/Task/Determine-if-a-string-has-all-unique-characters/Uiua/determine-if-a-string-has-all-unique-characters.uiua @@ -0,0 +1,7 @@ +Find ← ⬚∞⊢⊚>1≡⌟⦷⊸⊸◴ +Show ← ( + ⨬(&p$"Duplicated '_'\n'_'\n_"⊃(⊡⊢|⊃⋅∘∘⊂@\s+@\0+⊙(×-@\0@^)×32⊸¬°⊚) + | &p$"'_'\nokay"◌ + )⊸(=∞⊢) +) +≡◇(Show Find){"" "." "abcABC" "XYZ ZYX" "1234567890ABCDEFGHIJKLMN0PQRSTUVWXYZ"} diff --git a/Task/Determine-if-a-string-has-all-unique-characters/Wren/determine-if-a-string-has-all-unique-characters.wren b/Task/Determine-if-a-string-has-all-unique-characters/Wren/determine-if-a-string-has-all-unique-characters.wren index 19b850be3d..716410342a 100644 --- a/Task/Determine-if-a-string-has-all-unique-characters/Wren/determine-if-a-string-has-all-unique-characters.wren +++ b/Task/Determine-if-a-string-has-all-unique-characters/Wren/determine-if-a-string-has-all-unique-characters.wren @@ -1,4 +1,4 @@ -import "/fmt" for Conv, Fmt +import "./fmt" for Conv, Fmt var analyze = Fn.new { |s| var chars = s.codePoints.toList diff --git a/Task/Determine-if-a-string-has-all-unique-characters/Yabasic/determine-if-a-string-has-all-unique-characters.basic b/Task/Determine-if-a-string-has-all-unique-characters/Yabasic/determine-if-a-string-has-all-unique-characters.basic index c4500a9b10..4da18a4436 100644 --- a/Task/Determine-if-a-string-has-all-unique-characters/Yabasic/determine-if-a-string-has-all-unique-characters.basic +++ b/Task/Determine-if-a-string-has-all-unique-characters/Yabasic/determine-if-a-string-has-all-unique-characters.basic @@ -1,5 +1,6 @@ sub caracteresunicos (cad$) - local lngt + local lngt, i, j + lngt = len(cad$) print "cadena = \"", cad$, "\", longitud = ", lngt for i = 1 to lngt diff --git a/Task/Determine-if-a-string-is-collapsible/ANSI-BASIC/determine-if-a-string-is-collapsible.basic b/Task/Determine-if-a-string-is-collapsible/ANSI-BASIC/determine-if-a-string-is-collapsible.basic new file mode 100644 index 0000000000..676e5d4ca7 --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/ANSI-BASIC/determine-if-a-string-is-collapsible.basic @@ -0,0 +1,38 @@ +100 REM Determine if a string is collapsible +110 DECLARE EXTERNAL FUNCTION Collapse$ +120 READ N +130 FOR J = 1 TO N +140 READ StrIn$ +150 LET StrOut$ = Collapse$(StrIn$) +160 PRINT LEN(StrIn$); "<<<"; StrIn$; ">>>" +170 PRINT LEN(StrOut$); "<<<"; StrOut$; ">>>" +180 PRINT +190 NEXT J +200 DATA 5 +210 DATA "" +220 DATA "'If I were two-faced, would I be wearing this one?' --- Abraham Lincoln " +230 DATA "..1111111111111111111111111111111111111111111111111111111111111117777888" +240 DATA "I never give 'em hell, I just tell the truth, and they think it's hell. " +250 DATA " --- Harry S Truman " +260 END +270 ! +280 EXTERNAL FUNCTION Collapse$(StrIn$) +290 IF StrIn$ = "" THEN +300 LET StrOut$ = StrIn$ +310 ELSE +320 LET StrOut$ = REPEAT$(" ", LEN(StrIn$)) +330 LET A$ = StrIn$(1:1) +340 LET StrOut$(1:1) = A$ +350 LET T = 2 +360 FOR I = 2 TO LEN(StrIn$) +370 LET B$ = StrIn$(I:I) +380 IF A$ <> B$ THEN +390 LET StrOut$(T:T) = B$ +400 LET T = T + 1 +410 LET A$ = B$ +420 END IF +430 NEXT I +440 LET StrOut$ = StrOut$(1 : T - 1) +450 END IF +460 LET Collapse$ = StrOut$ +470 END FUNCTION diff --git a/Task/Determine-if-a-string-is-collapsible/Ada/determine-if-a-string-is-collapsible.ada b/Task/Determine-if-a-string-is-collapsible/Ada/determine-if-a-string-is-collapsible.adb similarity index 100% rename from Task/Determine-if-a-string-is-collapsible/Ada/determine-if-a-string-is-collapsible.ada rename to Task/Determine-if-a-string-is-collapsible/Ada/determine-if-a-string-is-collapsible.adb diff --git a/Task/Determine-if-a-string-is-collapsible/Applesoft-BASIC/determine-if-a-string-is-collapsible.basic b/Task/Determine-if-a-string-is-collapsible/Applesoft-BASIC/determine-if-a-string-is-collapsible.basic new file mode 100644 index 0000000000..d7e2430ecc --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/Applesoft-BASIC/determine-if-a-string-is-collapsible.basic @@ -0,0 +1,28 @@ +10 READ N +20 FOR A = 1 TO N +30 READ I$ +40 GOSUB 100" COLLAPSE +50 PRINT LEN(I$) " <<<" I$ ">>>" +60 PRINT LEN(O$) " <<<" O$ ">>>" +70 PRINT +80 NEXT +90 END + +REM COLLAPSE +100 O$ = I$ +110 IF LEN(I$) < 2 THEN RETURN +120 O$ = "" +130 P$ = "" +140 FOR I = 1 TO LEN(i$) +150 C$ = MID$(I$,I,1) +160 IF C$ <> P$ THEN O$ = O$ + C$ +170 P$ = C$ +180 NEXT I +190 RETURN + +400 DATA 5 +410 DATA "" +420 DATA "'If I were two-faced, would I be wearing this one?' --- Abraham Lincoln " +430 DATA "..1111111111111111111111111111111111111111111111111111111111111117777888" +440 DATA "I never give 'em hell, I just tell the truth, and they think it's hell. " +450 DATA " --- Harry S Truman " diff --git a/Task/Determine-if-a-string-is-collapsible/BQN/determine-if-a-string-is-collapsible-1.bqn b/Task/Determine-if-a-string-is-collapsible/BQN/determine-if-a-string-is-collapsible-1.bqn deleted file mode 100644 index 4b2f22d333..0000000000 --- a/Task/Determine-if-a-string-is-collapsible/BQN/determine-if-a-string-is-collapsible-1.bqn +++ /dev/null @@ -1,14 +0,0 @@ -Collapse←(≠↑1∾1↓≠⟜»)⊸/ - ->{ - c←Collapse 𝕩 - ⟨⟨≠𝕩 ⋄ "<<<"∾𝕩∾">>>"⟩≍⟨≠c ⋄ "<<<"∾c∾">>>"⟩⟩ -}¨⟨ - "The better the 4-wheel drive, the further you'll be from help when ya get stuck!" - "headmistressship" - "" - """If I were two-faced, would I be wearing this one?"" --- Abraham Lincoln " - "..1111111111111111111111111111111111111111111111111111111111111117777888" - "I never give 'em hell, I just tell the truth, and they think it's hell. " - " --- Harry S Truman " -⟩ diff --git a/Task/Determine-if-a-string-is-collapsible/BQN/determine-if-a-string-is-collapsible-2.bqn b/Task/Determine-if-a-string-is-collapsible/BQN/determine-if-a-string-is-collapsible-2.bqn deleted file mode 100644 index 9e46421c02..0000000000 --- a/Task/Determine-if-a-string-is-collapsible/BQN/determine-if-a-string-is-collapsible-2.bqn +++ /dev/null @@ -1,30 +0,0 @@ -┌─ -╵ ┌─ - ╵ 80 "<<>>" - 77 "<<>>" - ┘ - ┌─ - ╵ 16 "<<>>" - 14 "<<>>" - ┘ - ┌─ - ╵ 0 "<<<>>>" - 0 "<<<>>>" - ┘ - ┌─ - ╵ 72 "<<<""If I were two-faced, would I be wearing this one?"" --- Abraham Lincoln >>>" - 70 "<<<""If I were two-faced, would I be wearing this one?"" - Abraham Lincoln >>>" - ┘ - ┌─ - ╵ 72 "<<<..1111111111111111111111111111111111111111111111111111111111111117777888>>>" - 4 "<<<.178>>>" - ┘ - ┌─ - ╵ 72 "<<>>" - 69 "<<>>" - ┘ - ┌─ - ╵ 72 "<<< --- Harry S Truman >>>" - 17 "<<< - Hary S Truman >>>" - ┘ - ┘ diff --git a/Task/Determine-if-a-string-is-collapsible/BQN/determine-if-a-string-is-collapsible.bqn b/Task/Determine-if-a-string-is-collapsible/BQN/determine-if-a-string-is-collapsible.bqn new file mode 100644 index 0000000000..eb67be681c --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/BQN/determine-if-a-string-is-collapsible.bqn @@ -0,0 +1,11 @@ +Collapse ← (1»≠⟜«)⊸/ + +>⍉ ⊢‿Collapse (≠⋈"<<<"⊸∾∘∾⟜">>>")∘{𝕎𝕩}⌜ ⟨ + "The better the 4-wheel drive, the further you'll be from help when ya get stuck!" + "headmistressship" + "" + """If I were two-faced, would I be wearing this one?"" --- Abraham Lincoln " + "..1111111111111111111111111111111111111111111111111111111111111117777888" + "I never give 'em hell, I just tell the truth, and they think it's hell. " + " --- Harry S Truman " +⟩ diff --git a/Task/Determine-if-a-string-is-collapsible/Crystal/determine-if-a-string-is-collapsible.cr b/Task/Determine-if-a-string-is-collapsible/Crystal/determine-if-a-string-is-collapsible.cr new file mode 100644 index 0000000000..cc07aaf3c2 --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/Crystal/determine-if-a-string-is-collapsible.cr @@ -0,0 +1,16 @@ +strings = ["", + "\"If I were two-faced, would I be wearing this one?\" --- Abraham Lincoln ", + "..1111111111111111111111111111111111111111111111111111111111111117777888", + "I never give 'em hell, I just tell the truth, and they think it's hell. ", + " --- Harry S Truman ", + "The better the 4-wheel drive, the further you'll be from help when ya get stuck!", + "headmistressship", + "aardvark", + "😍😀🙌💃😍😍😍🙌",] + +strings.each do |str| + puts "«««#{str}»»» (size #{str.size})" + ssq = str.squeeze + puts "«««#{ssq}»»» (size #{ssq.size})" + puts +end diff --git a/Task/Determine-if-a-string-is-collapsible/Delphi/determine-if-a-string-is-collapsible.delphi b/Task/Determine-if-a-string-is-collapsible/Delphi/determine-if-a-string-is-collapsible.pas similarity index 100% rename from Task/Determine-if-a-string-is-collapsible/Delphi/determine-if-a-string-is-collapsible.delphi rename to Task/Determine-if-a-string-is-collapsible/Delphi/determine-if-a-string-is-collapsible.pas diff --git a/Task/Determine-if-a-string-is-collapsible/DuckDB/determine-if-a-string-is-collapsible.duckdb b/Task/Determine-if-a-string-is-collapsible/DuckDB/determine-if-a-string-is-collapsible.duckdb new file mode 100644 index 0000000000..d3a1ccb531 --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/DuckDB/determine-if-a-string-is-collapsible.duckdb @@ -0,0 +1,16 @@ +create or replace function uniq(lst) as + list_filter(lst, (x,i) -> i=1 or lst[i-1] != x); + +create or replace function collapse(str) as + string_split(str,'').uniq().array_to_string(''); + +.maxwidth 200 + +select length(s), collapse(s) as collapsed, length(collapsed) +from unnest([ + '', + '"If I were two-faced, would I be wearing this one?" --- Abraham Lincoln ', + '..1111111111111111111111111111111111111111111111111111111111111117777888', + 'I never give ''em hell, I just tell the truth, and they think it''s hell. ', + ' --- Harry S Truman ' +]) _(s); diff --git a/Task/Determine-if-a-string-is-collapsible/EasyLang/determine-if-a-string-is-collapsible.easy b/Task/Determine-if-a-string-is-collapsible/EasyLang/determine-if-a-string-is-collapsible.easy new file mode 100644 index 0000000000..1721a5edb9 --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/EasyLang/determine-if-a-string-is-collapsible.easy @@ -0,0 +1,18 @@ +func$ collapse s$ . + for c$ in strchars s$ + if c$ <> cc$ : r$ &= c$ + cc$ = c$ + . + return r$ +. +s$[] &= "" +s$[] &= "\"If I were two-faced, would I be wearing this one?\" --- Abraham Lincoln " +s$[] &= "..1111111111111111111111111111111111111111111111111111111111111117777888" +s$[] &= "I never give 'em hell, I just tell the truth, and they think it's hell. " +s$[] &= " --- Harry S Truman " +for s$ in s$[] + print "«««" & s$ & "»»» (" & len s$ & ")" + r$ = collapse s$ + print "«««" & r$ & "»»» (" & len r$ & ")" + print "" +. diff --git a/Task/Determine-if-a-string-is-collapsible/Ed/determine-if-a-string-is-collapsible.ed b/Task/Determine-if-a-string-is-collapsible/Ed/determine-if-a-string-is-collapsible.ed new file mode 100644 index 0000000000..01197d5a35 --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/Ed/determine-if-a-string-is-collapsible.ed @@ -0,0 +1,5 @@ +# by Artyom Bologov +H +g/\(.\)\1*/s//\1/g +,p +Q diff --git a/Task/Determine-if-a-string-is-collapsible/Fortran/determine-if-a-string-is-collapsible.f b/Task/Determine-if-a-string-is-collapsible/Fortran/determine-if-a-string-is-collapsible.f new file mode 100644 index 0000000000..4f9ca7cf8d --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/Fortran/determine-if-a-string-is-collapsible.f @@ -0,0 +1,66 @@ +! +! Determine if a string is collapsible +! tested with Intel ifx (IFX) 2025.2.1 20250806 on Kubuntu 26.04 +! GNU gfortran (Ubuntu 15.2.0-16ubuntu1) 15.2.0 on Kubuntu 26.04 +! VSI Fortran x86-64 V8.7-001 on OpenVMS V9.2-3 +! U.B., April 2026 +! + program CollapsibleStrings + +implicit none + +character (len=*), parameter :: s1='' +character (len=*), parameter :: s2='"If I were two-faced, would I be wearing this one?" --- Abraham Lincoln ' +character (len=*), parameter :: s3='..1111111111111111111111111111111111111111111111111111111111111117777888' +character (len=*), parameter :: s4="I never give 'em hell, I just tell the truth, and they think it's hell. " +character (len=*), parameter :: s5=' --- Harry S Truman ' +character (len=*), parameter :: s6="The better the 4-wheel drive, the further you'll be from help when ya get stuck!" +character (len=*), parameter :: s7='headmistressship' +character (len=*), parameter :: s8='aardvark' + + +call checkCollapse (s1) +call checkCollapse (s2) +call checkCollapse (s3) +call checkCollapse (s4) +call checkCollapse (s5) +call checkCollapse (s6) +call checkCollapse (s7) +call checkCollapse (s8) + + +contains + +subroutine checkCollapse (s) +character (len=*), intent(in) :: s +character (len=len(s)) :: sOut +integer :: l, iLast,iNext,iOut + +l = len(s) +! early return if s empty +if (l .eq. 0) then + sOut = S + iout = 0 +else + sOut(1:1) = s(1:1) + iLast = 1 + iOut = 1 + do while (iLast .lt. len(s)) ! through entire input string + iNext=iLast ! to find next letter .ne. last letter + do while (iNext .le. len(s) .and. s(iNext:iNext) .eq. s(iLast:iLast)) + iNext = iNext + 1 ! Skip this letter if it is the same as last + enddo + if (iNext .le. l) then + iOut = iOut + 1 ! 'next' is to copy to the end of sOut + sOut(iOut:iOut) = s(iNext:iNext) + iLast = iNext ! 'next' becomes the new Last + else + exit + endif + end do +endif +write (*, '("<<<",A,">>>", x, "(",i0,")")') s (:l), l +write (*, '("<<<",A,">>>", x, "(",i0,")")') sOut (:iOut), iOut + +end subroutine checkCollapse +end program CollapsibleStrings diff --git a/Task/Determine-if-a-string-is-collapsible/BASIC/determine-if-a-string-is-collapsible.basic b/Task/Determine-if-a-string-is-collapsible/GW-BASIC/determine-if-a-string-is-collapsible.basic similarity index 100% rename from Task/Determine-if-a-string-is-collapsible/BASIC/determine-if-a-string-is-collapsible.basic rename to Task/Determine-if-a-string-is-collapsible/GW-BASIC/determine-if-a-string-is-collapsible.basic diff --git a/Task/Determine-if-a-string-is-collapsible/Icon/determine-if-a-string-is-collapsible.icon b/Task/Determine-if-a-string-is-collapsible/Icon/determine-if-a-string-is-collapsible.icon new file mode 100644 index 0000000000..f8c6565d97 --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/Icon/determine-if-a-string-is-collapsible.icon @@ -0,0 +1,17 @@ +procedure main() + strings := ["", + "\"If I were two-faced, would I be wearing this one?\" --- Abraham Lincoln ", + "..1111111111111111111111111111111111111111111111111111111111111117777888", + "I never give 'em hell, I just tell the truth, and they think it's hell. ", + " --- Harry S Truman " + ] + + while collapse(!strings) +end + +procedure collapse(s) + ns := "" + s ? while ns ||:= move(1) do tab(many(ns[*ns])) + write("original: <<<",s,">>>",*s) + write("collapsed:<<<",ns,">>>",*ns) +end diff --git a/Task/Determine-if-a-string-is-collapsible/Julia/determine-if-a-string-is-collapsible-1.julia b/Task/Determine-if-a-string-is-collapsible/Julia/determine-if-a-string-is-collapsible-1.jl similarity index 100% rename from Task/Determine-if-a-string-is-collapsible/Julia/determine-if-a-string-is-collapsible-1.julia rename to Task/Determine-if-a-string-is-collapsible/Julia/determine-if-a-string-is-collapsible-1.jl diff --git a/Task/Determine-if-a-string-is-collapsible/Julia/determine-if-a-string-is-collapsible-2.julia b/Task/Determine-if-a-string-is-collapsible/Julia/determine-if-a-string-is-collapsible-2.jl similarity index 100% rename from Task/Determine-if-a-string-is-collapsible/Julia/determine-if-a-string-is-collapsible-2.julia rename to Task/Determine-if-a-string-is-collapsible/Julia/determine-if-a-string-is-collapsible-2.jl diff --git a/Task/Determine-if-a-string-is-collapsible/Kotlin/determine-if-a-string-is-collapsible.kotlin b/Task/Determine-if-a-string-is-collapsible/Kotlin/determine-if-a-string-is-collapsible.kts similarity index 100% rename from Task/Determine-if-a-string-is-collapsible/Kotlin/determine-if-a-string-is-collapsible.kotlin rename to Task/Determine-if-a-string-is-collapsible/Kotlin/determine-if-a-string-is-collapsible.kts diff --git a/Task/Determine-if-a-string-is-collapsible/PascalABC.NET/determine-if-a-string-is-collapsible.pas b/Task/Determine-if-a-string-is-collapsible/PascalABC.NET/determine-if-a-string-is-collapsible.pas new file mode 100644 index 0000000000..ad9907fdba --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/PascalABC.NET/determine-if-a-string-is-collapsible.pas @@ -0,0 +1,24 @@ +## +function Collapse(s: String) := + if String.IsNullOrEmpty(s) Then '' + else s[1] + + new String(Range(2, s.Length) + .Where(i -> s[i] <> s[i - 1]) + .Select(i -> s[i]) + .ToArray); + +var input := +|'', +'The better the 4-wheel drive, the further you''ll be from help when ya get stuck!', +'headmistressship', +'"If I were two-faced, would I be wearing this one? --- Abraham Lincoln "', +'..1111111111111111111111111111111111111111111111111111111111111117777888', +'I never give ''em hell, I just tell the truth, and they think it''s hell. ', +' --- Harry S Truman '|; + +foreach var s in input do +begin + Writeln('old: ', s.Length, ' «««', s, '»»»'); + var c := Collapse(s); + WriteLn('new: ', c.Length, ' «««', c, '»»»') +end; diff --git a/Task/Determine-if-a-string-is-collapsible/Pluto/determine-if-a-string-is-collapsible.pluto b/Task/Determine-if-a-string-is-collapsible/Pluto/determine-if-a-string-is-collapsible.pluto new file mode 100644 index 0000000000..83b3f537b5 --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/Pluto/determine-if-a-string-is-collapsible.pluto @@ -0,0 +1,32 @@ +local fmt = require "fmt" +require "uchar" + +-- Returns collapsed string, original and new lengths in +-- unicode code points (not normalized). +local function collapse(s) + local c = uchar.of(s) + local le = c:len() + if le < 2 then return s, le, le end + for i = le - 1, 1, -1 do + if c:get(i) == c:get(i + 1) then c:remove(i) end + end + return c:tostring(), le, c:len() +end + +local strings = { + "", + "\"If I were two-faced, would I be wearing this one?\" --- Abraham Lincoln ", + "..1111111111111111111111111111111111111111111111111111111111111117777888", + "I never give 'em hell, I just tell the truth, and they think it's hell. ", + " --- Harry S Truman ", + "The better the 4-wheel drive, the further you'll be from help when ya get stuck!", + "headmistressship", + "aardvark", + "😍😀🙌💃😍😍😍🙌" +} + +for strings as s do + local cc, le, lcc = collapse(s) + fmt.print("original : length = %2d, string = «««%s»»»", le, s) + fmt.print("collapsed: length = %2d, string = «««%s»»»\n", lcc, cc) +end diff --git a/Task/Determine-if-a-string-is-collapsible/QuickBASIC/determine-if-a-string-is-collapsible.basic b/Task/Determine-if-a-string-is-collapsible/QuickBASIC/determine-if-a-string-is-collapsible.basic new file mode 100644 index 0000000000..9bb3182fd8 --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/QuickBASIC/determine-if-a-string-is-collapsible.basic @@ -0,0 +1,38 @@ +' Determine if a string is collapsible +DECLARE FUNCTION Collapse$ (StrIn$) +READ N% +FOR A% = 1 TO N% + READ StrIn$ + StrOut$ = Collapse$(StrIn$) + PRINT LEN(StrIn$); "<<<"; StrIn$; ">>>" + PRINT LEN(StrOut$); "<<<"; StrOut$; ">>>" + PRINT +NEXT +END +DATA 5: ' There are 5 strings +DATA "" +DATA "'If I were two-faced, would I be wearing this one?' --- Abraham Lincoln " +DATA "..1111111111111111111111111111111111111111111111111111111111111117777888" +DATA "I never give 'em hell, I just tell the truth, and they think it's hell. " +DATA " --- Harry S Truman " + +FUNCTION Collapse$ (StrIn$) + IF StrIn$ = "" THEN + StrOut$ = StrIn$ + ELSE + StrOut$ = SPACE$(LEN(StrIn$)) + P$ = LEFT$(StrIn$, 1) + MID$(StrOut$, 1, 1) = P$ + T% = 2 + FOR I% = 2 TO LEN(StrIn$) + C$ = MID$(StrIn$, I%, 1) + IF P$ <> C$ THEN + MID$(StrOut$, T%, 1) = C$ + T% = T% + 1 + P$ = C$ + END IF + NEXT + StrOut$ = LEFT$(StrOut$, T% - 1) + END IF + Collapse$ = StrOut$ +END FUNCTION diff --git a/Task/Determine-if-a-string-is-collapsible/Refal/determine-if-a-string-is-collapsible.refal b/Task/Determine-if-a-string-is-collapsible/Refal/determine-if-a-string-is-collapsible.refal new file mode 100644 index 0000000000..ae63874d38 --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/Refal/determine-if-a-string-is-collapsible.refal @@ -0,0 +1,34 @@ +$ENTRY Go { + , ('') + ('"If I were two-faced, would I be wearing this ' + 'one?" --- Abraham Lincoln ') + ('..11111111111111111111111111111111111111111111' + '11111111111111111117777888') + ('I never give \'em hell, I just tell the truth, ' + 'and they think it\'s hell. ') + (' ' + ' --- Harry S Truman '): e.Strings + = ; +}; + +Each { + s.F = ; + s.F t.I e.X = ; +}; + +Brackets { + e.X, : s.L e.X = + ': <<<' e.X '>>>'>; +}; + +Show { + (e.X) = + > + ; +}; + +Collapse { + = ; + s.C s.C e.S = ; + s.C e.S = s.C ; +}; diff --git a/Task/Determine-if-a-string-is-collapsible/Rust/determine-if-a-string-is-collapsible.rust b/Task/Determine-if-a-string-is-collapsible/Rust/determine-if-a-string-is-collapsible.rs similarity index 100% rename from Task/Determine-if-a-string-is-collapsible/Rust/determine-if-a-string-is-collapsible.rust rename to Task/Determine-if-a-string-is-collapsible/Rust/determine-if-a-string-is-collapsible.rs diff --git a/Task/Determine-if-a-string-is-collapsible/Uiua/determine-if-a-string-is-collapsible.uiua b/Task/Determine-if-a-string-is-collapsible/Uiua/determine-if-a-string-is-collapsible.uiua new file mode 100644 index 0000000000..0e22615904 --- /dev/null +++ b/Task/Determine-if-a-string-is-collapsible/Uiua/determine-if-a-string-is-collapsible.uiua @@ -0,0 +1,13 @@ +S ← {"" + "\"If I were two-faced, would I be wearing this one?\" --- Abraham Lincoln" + "..1111111111111111111111111111111111111111111111111111111111111117777888" + "I never give 'em hell, I just tell the truth, and they think it's hell. " + " --- Harry S Truman " + "The better the 4-wheel drive, the further you'll be from help when ya get stuck!" + "headmistressship" + "aardvark" + "😍😀🙌💃😍😍😍🙌" + "unnecessary bookkeeping"} + +Collapse ← ⊜⊢+1⊸⊛ +≡◇∩(&p$"_ chars \t«_»\n"⊸⧻)⊸≡⍚Collapse S diff --git a/Task/Determine-if-a-string-is-collapsible/V-(Vlang)/determine-if-a-string-is-collapsible.v b/Task/Determine-if-a-string-is-collapsible/V-(Vlang)/determine-if-a-string-is-collapsible.v index 7a801cef9d..3d851084cd 100644 --- a/Task/Determine-if-a-string-is-collapsible/V-(Vlang)/determine-if-a-string-is-collapsible.v +++ b/Task/Determine-if-a-string-is-collapsible/V-(Vlang)/determine-if-a-string-is-collapsible.v @@ -12,7 +12,7 @@ fn collapse(s string) (string, int, int) { if del == 0 { return s, le, le } - r = r[..le-del] + r = r[..le-del].clone() return r.string(), le, r.len } diff --git a/Task/Determine-if-a-string-is-collapsible/Wren/determine-if-a-string-is-collapsible.wren b/Task/Determine-if-a-string-is-collapsible/Wren/determine-if-a-string-is-collapsible.wren index 48f952f789..2f6cc3810d 100644 --- a/Task/Determine-if-a-string-is-collapsible/Wren/determine-if-a-string-is-collapsible.wren +++ b/Task/Determine-if-a-string-is-collapsible/Wren/determine-if-a-string-is-collapsible.wren @@ -1,4 +1,4 @@ -import "/fmt" for Fmt +import "./fmt" for Fmt // Returns collapsed string, original and new lengths in // unicode code points (not normalized). diff --git a/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-1.ada b/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-1.adb similarity index 100% rename from Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-1.ada rename to Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-1.adb diff --git a/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-2.ada b/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-2.adb similarity index 100% rename from Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-2.ada rename to Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-2.adb diff --git a/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-3.ada b/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-3.adb similarity index 100% rename from Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-3.ada rename to Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-3.adb diff --git a/Task/Determine-if-a-string-is-numeric/Arturo/determine-if-a-string-is-numeric.arturo b/Task/Determine-if-a-string-is-numeric/Arturo/determine-if-a-string-is-numeric.arturo index 077d052065..609f2ddbd4 100644 --- a/Task/Determine-if-a-string-is-numeric/Arturo/determine-if-a-string-is-numeric.arturo +++ b/Task/Determine-if-a-string-is-numeric/Arturo/determine-if-a-string-is-numeric.arturo @@ -2,5 +2,6 @@ print numeric? "hello world" print numeric? "1234" print numeric? "1234 hello world" print numeric? "12.34" +print numeric? "0x2bf" print numeric? "!#@$" -print numeric? "-1.23" +print numeric? "-15" diff --git a/Task/Determine-if-a-string-is-numeric/BQN/determine-if-a-string-is-numeric.bqn b/Task/Determine-if-a-string-is-numeric/BQN/determine-if-a-string-is-numeric.bqn new file mode 100644 index 0000000000..d73e79cf62 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/BQN/determine-if-a-string-is-numeric.bqn @@ -0,0 +1 @@ +IsNumeric ← 1∘•ParseFloat⎊0 diff --git a/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-1.cpp b/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-1.cpp index dd177cb3ad..a04ab3c23d 100644 --- a/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-1.cpp +++ b/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-1.cpp @@ -1,28 +1,11 @@ -#include // for istringstream +#include +#include -using namespace std; - -bool isNumeric( const char* pszInput, int nNumberBase ) -{ - istringstream iss( pszInput ); - - if ( nNumberBase == 10 ) - { - double dTestSink; - iss >> dTestSink; - } - else if ( nNumberBase == 8 || nNumberBase == 16 ) - { - int nTestSink; - iss >> ( ( nNumberBase == 8 ) ? oct : hex ) >> nTestSink; - } - else - return false; - - // was any input successfully consumed/converted? - if ( ! iss ) - return false; - - // was all the input successfully consumed/converted? - return ( iss.rdbuf()->in_avail() == 0 ); +bool isNumeric(const char *s) { + if (s == nullptr || *s == '\0' || std::isspace(*s)) { + return false; + } + char *p; + std::strtod(s, &p); + return *p == '\0'; } diff --git a/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-2.cpp b/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-2.cpp index a10b821d80..dd177cb3ad 100644 --- a/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-2.cpp +++ b/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-2.cpp @@ -1,7 +1,28 @@ +#include // for istringstream + +using namespace std; + bool isNumeric( const char* pszInput, int nNumberBase ) { - string base = "0123456789ABCDEF"; - string input = pszInput; + istringstream iss( pszInput ); - return (input.find_first_not_of(base.substr(0, nNumberBase)) == string::npos); + if ( nNumberBase == 10 ) + { + double dTestSink; + iss >> dTestSink; + } + else if ( nNumberBase == 8 || nNumberBase == 16 ) + { + int nTestSink; + iss >> ( ( nNumberBase == 8 ) ? oct : hex ) >> nTestSink; + } + else + return false; + + // was any input successfully consumed/converted? + if ( ! iss ) + return false; + + // was all the input successfully consumed/converted? + return ( iss.rdbuf()->in_avail() == 0 ); } diff --git a/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-3.cpp b/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-3.cpp index 94c934e8bc..a10b821d80 100644 --- a/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-3.cpp +++ b/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-3.cpp @@ -1,3 +1,7 @@ -bool isNumeric(const std::string& input) { - return std::all_of(input.begin(), input.end(), ::isdigit); +bool isNumeric( const char* pszInput, int nNumberBase ) +{ + string base = "0123456789ABCDEF"; + string input = pszInput; + + return (input.find_first_not_of(base.substr(0, nNumberBase)) == string::npos); } diff --git a/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-4.cpp b/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-4.cpp new file mode 100644 index 0000000000..94c934e8bc --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/C++/determine-if-a-string-is-numeric-4.cpp @@ -0,0 +1,3 @@ +bool isNumeric(const std::string& input) { + return std::all_of(input.begin(), input.end(), ::isdigit); +} 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 index 7ec0b8449a..e734674506 100644 --- 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 @@ -1,10 +1,12 @@ #include +#include #include -int isNumeric (const char * s) -{ - if (s == NULL || *s == '\0' || isspace(*s)) - return 0; - char * p; - strtod (s, &p); + +bool isNumeric(const char *s) { + if (s == NULL || *s == '\0' || isspace(*s)) { + return false; + } + char *p; + strtod(s, &p); return *p == '\0'; } diff --git a/Task/Determine-if-a-string-is-numeric/COBOL/determine-if-a-string-is-numeric-1.cobol b/Task/Determine-if-a-string-is-numeric/COBOL/determine-if-a-string-is-numeric-1.cob similarity index 100% rename from Task/Determine-if-a-string-is-numeric/COBOL/determine-if-a-string-is-numeric-1.cobol rename to Task/Determine-if-a-string-is-numeric/COBOL/determine-if-a-string-is-numeric-1.cob diff --git a/Task/Determine-if-a-string-is-numeric/COBOL/determine-if-a-string-is-numeric-2.cobol b/Task/Determine-if-a-string-is-numeric/COBOL/determine-if-a-string-is-numeric-2.cob similarity index 100% rename from Task/Determine-if-a-string-is-numeric/COBOL/determine-if-a-string-is-numeric-2.cobol rename to Task/Determine-if-a-string-is-numeric/COBOL/determine-if-a-string-is-numeric-2.cob diff --git a/Task/Determine-if-a-string-is-numeric/Crystal/determine-if-a-string-is-numeric.cr b/Task/Determine-if-a-string-is-numeric/Crystal/determine-if-a-string-is-numeric.cr new file mode 100644 index 0000000000..e91c3abd61 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Crystal/determine-if-a-string-is-numeric.cr @@ -0,0 +1,3 @@ +def numeric? (s) + s.to_f rescue false +end diff --git a/Task/Determine-if-a-string-is-numeric/Delphi/determine-if-a-string-is-numeric-1.delphi b/Task/Determine-if-a-string-is-numeric/Delphi/determine-if-a-string-is-numeric-1.pas similarity index 100% rename from Task/Determine-if-a-string-is-numeric/Delphi/determine-if-a-string-is-numeric-1.delphi rename to Task/Determine-if-a-string-is-numeric/Delphi/determine-if-a-string-is-numeric-1.pas diff --git a/Task/Determine-if-a-string-is-numeric/Delphi/determine-if-a-string-is-numeric-2.delphi b/Task/Determine-if-a-string-is-numeric/Delphi/determine-if-a-string-is-numeric-2.pas similarity index 100% rename from Task/Determine-if-a-string-is-numeric/Delphi/determine-if-a-string-is-numeric-2.delphi rename to Task/Determine-if-a-string-is-numeric/Delphi/determine-if-a-string-is-numeric-2.pas diff --git a/Task/Determine-if-a-string-is-numeric/DuckDB/determine-if-a-string-is-numeric.duckdb b/Task/Determine-if-a-string-is-numeric/DuckDB/determine-if-a-string-is-numeric.duckdb new file mode 100644 index 0000000000..2e161e6b5a --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/DuckDB/determine-if-a-string-is-numeric.duckdb @@ -0,0 +1,22 @@ +CREATE OR REPLACE FUNCTION is_valid_number(s) AS + CASE + WHEN s IS NULL THEN false + WHEN try_cast(s AS DOUBLE) IS NOT NULL THEN true + ELSE false + END; + +# Illustration +select s, is_valid_number(s) from + (select unnest([ + '123.0', + '123.', + '-123', + '3.14159', + '1.2.3', + 'abc', + 'A440', + ' 12 ', + '0A', + '+1E10', + '1E-10' + ]) as s); diff --git a/Task/Determine-if-a-string-is-numeric/EMal/determine-if-a-string-is-numeric.emal b/Task/Determine-if-a-string-is-numeric/EMal/determine-if-a-string-is-numeric.emal index d17af67f34..e50cc528a2 100644 --- a/Task/Determine-if-a-string-is-numeric/EMal/determine-if-a-string-is-numeric.emal +++ b/Task/Determine-if-a-string-is-numeric/EMal/determine-if-a-string-is-numeric.emal @@ -1,4 +1,4 @@ -fun isNumeric = logic by text value +fun isNumeric ← logic by text value try ^|So funny: |a) we check if it's castable to a real @@ -12,15 +12,15 @@ fun isNumeric = logic by text value return false end end -fun main = int by List args - if args.length == 1 +fun main ← int by List args + if args.length æ 1 writeLine(isNumeric(args[0])) else - writeLine("value".padEnd(8, " ") + " " + "numeric") + writeLine("value".padEnd(8, " "), " ", "numeric") for each text value in text["0o755", "thursday", "3.14", "0b1010", "-100", "0xff"] - writeLine(value.padEnd(8, " ") + " " + isNumeric(value)) + writeLine(value.padEnd(8, " "), " ", isNumeric(value)) end end - return 0 + return Runtime.OK end exit main(Runtime.args) diff --git a/Task/Determine-if-a-string-is-numeric/Ed/determine-if-a-string-is-numeric.ed b/Task/Determine-if-a-string-is-numeric/Ed/determine-if-a-string-is-numeric.ed new file mode 100644 index 0000000000..0e7048c89e --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Ed/determine-if-a-string-is-numeric.ed @@ -0,0 +1,5 @@ +H +g/^([-+]?[0-9]*)(\.[0-9]+([eE][+-]?[0-9]+)?)?$/s//\1\2 is numeric/ +v/numeric/s/.*/& is not numeric/ +,p +Q diff --git a/Task/Determine-if-a-string-is-numeric/Elixir/determine-if-a-string-is-numeric.elixir b/Task/Determine-if-a-string-is-numeric/Elixir/determine-if-a-string-is-numeric.ex similarity index 100% rename from Task/Determine-if-a-string-is-numeric/Elixir/determine-if-a-string-is-numeric.elixir rename to Task/Determine-if-a-string-is-numeric/Elixir/determine-if-a-string-is-numeric.ex diff --git a/Task/Determine-if-a-string-is-numeric/Emacs-Lisp/determine-if-a-string-is-numeric-1.el b/Task/Determine-if-a-string-is-numeric/Emacs-Lisp/determine-if-a-string-is-numeric-1.el new file mode 100644 index 0000000000..bb17cf908b --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Emacs-Lisp/determine-if-a-string-is-numeric-1.el @@ -0,0 +1,12 @@ +(defun string-valid-number-p (str) + "Test if STR is a numeric string. +Eliminate strings with commas in them because ELisp numbers do +not contain commas. Then check if remaining strings would be +valid ELisp numbers if the quotation marks were removed." + (and + ;; no comma in string, because ELisp numbers do not have commas + ;; we need to eliminate any string with a comma, because the + ;; numberp function below will not weed out commas + (not (string-match-p "," str)) + ;; no errors from numberp function testing if a number + (ignore-errors (numberp (read str))))) diff --git a/Task/Determine-if-a-string-is-numeric/Emacs-Lisp/determine-if-a-string-is-numeric-2.el b/Task/Determine-if-a-string-is-numeric/Emacs-Lisp/determine-if-a-string-is-numeric-2.el new file mode 100644 index 0000000000..ab8b39e2d0 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Emacs-Lisp/determine-if-a-string-is-numeric-2.el @@ -0,0 +1,17 @@ +(setq valid-strings '("3" "0" "-0" "2." "1000" "-4" "-5." "6.2" "-8.45" "+15e2" "-15e2" "#b101100" "#o54" "#x2c" "1500.0" "#24r1k" "3")) + +(setq invalid-strings '("3cat" "1,000" "5.6.7" "cat3" "def" "zero")) + +(with-current-buffer (pop-to-buffer "my-test") + (erase-buffer) + (insert "Test for valid strings:\n") + (dolist (test-string valid-strings) + (let ((test-result)) + (setq test-result (string-valid-number-p test-string)) + (insert (format "%-8s - %s \n" test-string test-result)))) + (insert "\n" "\n") + (insert "Test for invalid strings:\n") + (dolist (test-string invalid-strings) + (let ((test-result)) + (setq test-result (string-valid-number-p test-string)) + (insert (format "%-5s - %s \n" test-string test-result))))) diff --git a/Task/Determine-if-a-string-is-numeric/Euphoria/determine-if-a-string-is-numeric.euphoria b/Task/Determine-if-a-string-is-numeric/Euphoria/determine-if-a-string-is-numeric.eu similarity index 100% rename from Task/Determine-if-a-string-is-numeric/Euphoria/determine-if-a-string-is-numeric.euphoria rename to Task/Determine-if-a-string-is-numeric/Euphoria/determine-if-a-string-is-numeric.eu diff --git a/Task/Determine-if-a-string-is-numeric/Gleam/determine-if-a-string-is-numeric.gleam b/Task/Determine-if-a-string-is-numeric/Gleam/determine-if-a-string-is-numeric.gleam new file mode 100644 index 0000000000..54663a07c7 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Gleam/determine-if-a-string-is-numeric.gleam @@ -0,0 +1,9 @@ +import gleam/int +import gleam/io + +pub fn main() { + case int.base_parse("1234", 10) { + Ok(_) -> io.println("String is numeric") + Error(_) -> io.println("String isn't numeric") + } +} diff --git a/Task/Determine-if-a-string-is-numeric/Haxe/determine-if-a-string-is-numeric.haxe b/Task/Determine-if-a-string-is-numeric/Haxe/determine-if-a-string-is-numeric.hx similarity index 100% rename from Task/Determine-if-a-string-is-numeric/Haxe/determine-if-a-string-is-numeric.haxe rename to Task/Determine-if-a-string-is-numeric/Haxe/determine-if-a-string-is-numeric.hx diff --git a/Task/Determine-if-a-string-is-numeric/Julia/determine-if-a-string-is-numeric.julia b/Task/Determine-if-a-string-is-numeric/Julia/determine-if-a-string-is-numeric.jl similarity index 100% rename from Task/Determine-if-a-string-is-numeric/Julia/determine-if-a-string-is-numeric.julia rename to Task/Determine-if-a-string-is-numeric/Julia/determine-if-a-string-is-numeric.jl diff --git a/Task/Determine-if-a-string-is-numeric/Kotlin/determine-if-a-string-is-numeric.kotlin b/Task/Determine-if-a-string-is-numeric/Kotlin/determine-if-a-string-is-numeric.kts similarity index 100% rename from Task/Determine-if-a-string-is-numeric/Kotlin/determine-if-a-string-is-numeric.kotlin rename to Task/Determine-if-a-string-is-numeric/Kotlin/determine-if-a-string-is-numeric.kts diff --git a/Task/Determine-if-a-string-is-numeric/Nom/determine-if-a-string-is-numeric.num b/Task/Determine-if-a-string-is-numeric/Nom/determine-if-a-string-is-numeric.num new file mode 100644 index 0000000000..48b9bb8943 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Nom/determine-if-a-string-is-numeric.num @@ -0,0 +1,67 @@ +#* + +GRAMMAR OR PARSE TOKENS + int* - an unsigned integer + sint* - a +/- signed integer + .* - decimal point + +HISTORY + 12 sept 2021: written, working + +*# + + # remove leading space + begin { while [:space:]; clear; } + + read; + [0-9] { + while [0-9]; put; clear; add "int*"; push; .reparse + } + [.+-] { put; add "*"; push; .reparse } + [:space:] { while [:space:]; clear; add "space*"; push; .reparse } + !"" { + put; clear; + add "Non-numeric char at "; lines; add ":"; chars; add "\n"; + print; quit; + } + +parse> + # To visualise token reduction uncomment this: + #lines; add ":"; chars; add " "; print; clear; + #add "\n"; unstack; print; clip; stack; + + pop; pop; + + # ------------- + # 2 tokens + "+*int*","-*int*" { clear; add "sint*"; push; .reparse } + + pop; + # ------------- + # 3 tokens + "sint*.*int*","int*.*int*" { + clear; add "float*"; push; .reparse + } + + (eof) { + # ignore trailing space + stack; pop; "space*" { clear; } + unstack; + "int*","sint*","float*" { + replace "sint*" "signed integer,"; + replace "int*" "integer,"; + replace "*" ","; + put; clear; + add "It looks like a number (of type "; get; add ")\n"; + print; quit; + } + replace "sint*" "signed integer,"; + replace "int*" "integer,"; + replace "*" ","; + put; clear; + add "Doesnt look like one number \n"; + add "It was parsed as '"; get; add "'\n"; + print; quit; + } + + push; push; push; diff --git a/Task/Determine-if-a-string-is-numeric/Nu/determine-if-a-string-is-numeric.nu b/Task/Determine-if-a-string-is-numeric/Nu/determine-if-a-string-is-numeric.nu new file mode 100644 index 0000000000..14761bdd6b --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/Nu/determine-if-a-string-is-numeric.nu @@ -0,0 +1,3 @@ +def is-numeric [] {try {into float | true} catch {false}} + +["1" "12" "-3" "5.6" "-3.14" "one" "cheese"] | each {{k: $in, v: ($in | is-numeric)}} diff --git a/Task/Determine-if-a-string-is-numeric/OCaml/determine-if-a-string-is-numeric.ocaml b/Task/Determine-if-a-string-is-numeric/OCaml/determine-if-a-string-is-numeric.ml similarity index 100% rename from Task/Determine-if-a-string-is-numeric/OCaml/determine-if-a-string-is-numeric.ocaml rename to Task/Determine-if-a-string-is-numeric/OCaml/determine-if-a-string-is-numeric.ml diff --git a/Task/Determine-if-a-string-is-numeric/PascalABC.NET/determine-if-a-string-is-numeric.pas b/Task/Determine-if-a-string-is-numeric/PascalABC.NET/determine-if-a-string-is-numeric.pas new file mode 100644 index 0000000000..47846ad8c7 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/PascalABC.NET/determine-if-a-string-is-numeric.pas @@ -0,0 +1,11 @@ +function IsNumeric(s: string): boolean; +begin + var i: integer; + Result := integer.TryParse(s,i) +end; + +begin + var s := '123'; + if IsNumeric(s) then + Print('string is numeric') +end. diff --git a/Task/Determine-if-a-string-is-numeric/Phix/determine-if-a-string-is-numeric.phix b/Task/Determine-if-a-string-is-numeric/Phix/determine-if-a-string-is-numeric.phix index 76861c1f74..2b915eacc9 100644 --- a/Task/Determine-if-a-string-is-numeric/Phix/determine-if-a-string-is-numeric.phix +++ b/Task/Determine-if-a-string-is-numeric/Phix/determine-if-a-string-is-numeric.phix @@ -1,34 +1,32 @@ -(phixonline)--> - function isNumber(string s) - return scanf(s,"%f")!={} - -- Alt: isNumberString(object s) and - -- return string(s) and scanf(s,"%f")!={}, or even - -- return string(s) and scanf(substitute(trim(s),",",""),"%f")!={} - end function +function isNumber(string s) + return scanf(s,"%f")!={} +-- Alt: isNumberString(object s) and +-- return string(s) and scanf(s,"%f")!={}, or even +-- return string(s) and scanf(substitute(trim(s),",",""),"%f")!={} +end function - constant tests = {"#a","#A","0xA","0(16)A","#FF","255","0", - "0.","0.0","000.000","0e0","0e-2000"," ", - ".14",".05","-5.2","0xf","ten","1B","#1B", - " 12 ",trim(" 12 "),"1","0o16","0o18", - "0b10101111_11110000_11110000_00110011", - "1_000","50e","+123","+ 123","-0b10101", - "NaN","+.345","12..34","12e3.4","0-2", - "192.168.0.1","1.2e","1 2","12.34","", - "beef","#beef","1,000,000","Inf","1/2", - "1.5e+27","0x10.5","1."} +constant tests = {"#a","#A","0xA","0(16)A","#FF","255","0", + "0.","0.0","000.000","0e0","0e-2000"," ", + ".14",".05","-5.2","0xf","ten","1B","#1B", + " 12 ",trim(" 12 "),"1","0o16","0o18", + "0b10101111_11110000_11110000_00110011", + "1_000","50e","+123","+ 123","-0b10101", + "NaN","+.345","12..34","12e3.4","0-2", + "192.168.0.1","1.2e","1 2","12.34","", + "beef","#beef","1,000,000","Inf","1/2", + "1.5e+27","0x10.5","1."} - sequence numeric = {}, - notnumb = {} - for i=1 to length(tests) do - string ti = tests[i] - if isNumber(ti) then - numeric = append(numeric,ti) - else - notnumb = append(notnumb,ti) - end if - end for - puts(1,"numeric: ") - pp(numeric,{pp_Indent,9}) - puts(1,"\nnot numeric: ") - pp(notnumb,{pp_Indent,13}) - n ) + +[ 4 pack 0 swap + ' [ roll dip roll > ] join + 10000 times + [ dup do swap dip + ] drop + say "0." echo cr ] is prob ( a b c d --> ) + +randomise +9 4 6 6 prob +5 10 6 7 prob diff --git a/Task/Dice-game-probabilities/Rust/dice-game-probabilities.rust b/Task/Dice-game-probabilities/Rust/dice-game-probabilities.rs similarity index 100% rename from Task/Dice-game-probabilities/Rust/dice-game-probabilities.rust rename to Task/Dice-game-probabilities/Rust/dice-game-probabilities.rs diff --git a/Task/Digital-root-Multiplicative-digital-root/Ada/digital-root-multiplicative-digital-root.ada b/Task/Digital-root-Multiplicative-digital-root/Ada/digital-root-multiplicative-digital-root.adb similarity index 100% rename from Task/Digital-root-Multiplicative-digital-root/Ada/digital-root-multiplicative-digital-root.ada rename to Task/Digital-root-Multiplicative-digital-root/Ada/digital-root-multiplicative-digital-root.adb diff --git a/Task/Digital-root-Multiplicative-digital-root/Crystal/digital-root-multiplicative-digital-root.cr b/Task/Digital-root-Multiplicative-digital-root/Crystal/digital-root-multiplicative-digital-root.cr new file mode 100644 index 0000000000..dac178580a --- /dev/null +++ b/Task/Digital-root-Multiplicative-digital-root/Crystal/digital-root-multiplicative-digital-root.cr @@ -0,0 +1,33 @@ +struct Int + def mdr + n, p = self, 0 + return {0, 0} unless n > 0 + while n >= 10 + n = n.digits.product + p += 1 + end + { n, p } + end +end + +puts <<-EOH + n MDR MP +------------- +EOH +[123321, 7739, 893, 899998].each do |n| + printf "%6d %d %d\n", n, *n.mdr +end +puts +puts <<-EOH +MDR: [n0..n4] +=== ======== +EOH +buckets = Array(Array(Int32)).new(10) { [] of Int32 } +(0..).each do |n| + mdr, _ = n.mdr + buckets[mdr] << n + break if buckets.all? {|b| b.size >= 5 } +end +buckets.each_with_index do |b, i| + printf "%3d: %s\n", i, b.first(5) +end diff --git a/Task/Digital-root-Multiplicative-digital-root/EasyLang/digital-root-multiplicative-digital-root.easy b/Task/Digital-root-Multiplicative-digital-root/EasyLang/digital-root-multiplicative-digital-root.easy new file mode 100644 index 0000000000..1037d26810 --- /dev/null +++ b/Task/Digital-root-Multiplicative-digital-root/EasyLang/digital-root-multiplicative-digital-root.easy @@ -0,0 +1,45 @@ +proc _mdr n &md &mp . + if n > 0 : r = 1 + while n > 0 + r *= n mod 10 + n = n div 10 + . + mp += 1 + if r >= 10 + _mdr r md mp + else + md = r + . +. +proc mdr n &md &mp . + mp = 0 + _mdr n md mp +. +numfmt 6 0 +print "Number MDR MP" +for v in [ 123321 7739 893 899998 ] + mdr v md mp + print v & md & mp +. +width = 5 +len table[] 10 * width +len tfill[] 10 +numfmt 0 0 +while total < 10 * width + mdr i md mp + if tfill[md] < width + table[md * width + tfill[md]] = i + tfill[md] += 1 + total += 1 + . + i += 1 +. +print "\nMDR: [n0..n4]" +for i = 0 to 9 + write i & ": [" + for j = 0 to width - 1 + write table[i * width + j] + if j < width - 1 : write "," + . + print "]" +. diff --git a/Task/Digital-root-Multiplicative-digital-root/Elixir/digital-root-multiplicative-digital-root.elixir b/Task/Digital-root-Multiplicative-digital-root/Elixir/digital-root-multiplicative-digital-root.ex similarity index 100% rename from Task/Digital-root-Multiplicative-digital-root/Elixir/digital-root-multiplicative-digital-root.elixir rename to Task/Digital-root-Multiplicative-digital-root/Elixir/digital-root-multiplicative-digital-root.ex diff --git a/Task/Digital-root-Multiplicative-digital-root/JavaScript/digital-root-multiplicative-digital-root.js b/Task/Digital-root-Multiplicative-digital-root/JavaScript/digital-root-multiplicative-digital-root.js new file mode 100644 index 0000000000..fb6df86d65 --- /dev/null +++ b/Task/Digital-root-Multiplicative-digital-root/JavaScript/digital-root-multiplicative-digital-root.js @@ -0,0 +1,31 @@ +function digmul(n) { + return [...String(n)].reduce((x, y) => Number(x) * Number(y)); +} + +function mdr_mp(n) { + let m = n, i = 0; + while (m > 9) { + m = digmul(m); + i++; + } + return {"MDR": m, "MP": i}; +} + +for (const n of [123321, 7739, 893, 899998]) { + console.log(`${n} has MDR ${mdr_mp(n)["MDR"]} and MP ${mdr_mp(n)["MP"]}`); +} + +function first5mdr(n) { + let m = 0, nums = []; + while (nums.length < 5) { + if (mdr_mp(m)["MDR"] == n) { + nums.push(m); + } + m++; + } + return `First 5 numbers with MDR ${n}: ${nums.join(", ")}`; +} + +for (let i = 0; i < 10; i++) { + console.log(first5mdr(i)); +} diff --git a/Task/Digital-root-Multiplicative-digital-root/Julia/digital-root-multiplicative-digital-root-1.julia b/Task/Digital-root-Multiplicative-digital-root/Julia/digital-root-multiplicative-digital-root-1.jl similarity index 100% rename from Task/Digital-root-Multiplicative-digital-root/Julia/digital-root-multiplicative-digital-root-1.julia rename to Task/Digital-root-Multiplicative-digital-root/Julia/digital-root-multiplicative-digital-root-1.jl diff --git a/Task/Digital-root-Multiplicative-digital-root/Julia/digital-root-multiplicative-digital-root-2.julia b/Task/Digital-root-Multiplicative-digital-root/Julia/digital-root-multiplicative-digital-root-2.jl similarity index 100% rename from Task/Digital-root-Multiplicative-digital-root/Julia/digital-root-multiplicative-digital-root-2.julia rename to Task/Digital-root-Multiplicative-digital-root/Julia/digital-root-multiplicative-digital-root-2.jl diff --git a/Task/Digital-root-Multiplicative-digital-root/Kotlin/digital-root-multiplicative-digital-root.kotlin b/Task/Digital-root-Multiplicative-digital-root/Kotlin/digital-root-multiplicative-digital-root.kts similarity index 100% rename from Task/Digital-root-Multiplicative-digital-root/Kotlin/digital-root-multiplicative-digital-root.kotlin rename to Task/Digital-root-Multiplicative-digital-root/Kotlin/digital-root-multiplicative-digital-root.kts diff --git a/Task/Digital-root-Multiplicative-digital-root/PascalABC.NET/digital-root-multiplicative-digital-root.pas b/Task/Digital-root-Multiplicative-digital-root/PascalABC.NET/digital-root-multiplicative-digital-root.pas new file mode 100644 index 0000000000..dfe2204da1 --- /dev/null +++ b/Task/Digital-root-Multiplicative-digital-root/PascalABC.NET/digital-root-multiplicative-digital-root.pas @@ -0,0 +1,33 @@ +## +function MulDigitalRoot(num: int64): (integer, integer); +begin + var mulpersistence := 0; + while num > 9 do + begin + num := num.ToString.ToCharArray.Select(x -> x.ToDigit).Aggregate((x, y) -> x * y); + mulpersistence += 1; + end; + result := (mulpersistence, integer(num)); +end; + +var nums := |123321, 7739, 893, 899998|; +foreach var num in nums do +begin + var t := MulDigitalRoot(num); + Writeln(num, ' has multiplicative persistence ', t[0], ' and multiplicative digital root ', t[1]) +end; + +var twidth := 5; +var table := new List[10]; +for var i := 0 to 9 do + table[i] := new List(); +var number := -1; +while (table.Any(x -> x.Count < twidth)) do +begin + number += 1; + var t := MulDigitalRoot(number); + if (table[t[1]].Count < twidth) then + table[t[1]].Add(number); +end; +for var i := 0 to 9 do + WriteLn(i, ' : [', string.Join(', ', table[i]), ']'); diff --git a/Task/Digital-root-Multiplicative-digital-root/Phix/digital-root-multiplicative-digital-root-1.phix b/Task/Digital-root-Multiplicative-digital-root/Phix/digital-root-multiplicative-digital-root-1.phix index cc996c596b..16ee10b968 100644 --- a/Task/Digital-root-Multiplicative-digital-root/Phix/digital-root-multiplicative-digital-root-1.phix +++ b/Task/Digital-root-Multiplicative-digital-root/Phix/digital-root-multiplicative-digital-root-1.phix @@ -1,46 +1,44 @@ -(phixonline)--> - with javascript_semantics - function mdr_mp(integer m) - integer mp = 0 - while m>9 do - integer newm = 1 - while m do - newm *= remainder(m,10) - m = floor(m/10) - end while - m = newm - mp += 1 - end while - return {m,mp} - end function +with javascript_semantics +function mdr_mp(integer m) + integer mp = 0 + while m>9 do + integer newm = 1 + while m do + newm *= remainder(m,10) + m = floor(m/10) + end while + m = newm + mp += 1 + end while + return {m,mp} +end function - constant tests = {123321, 7739, 893, 899998} - printf(1,"Number MDR MP\n") - printf(1,"====== === ==\n") - for i=1 to length(tests) do - integer ti = tests[i] - printf(1,"%6d %6d %6d\n",ti&mdr_mp(ti)) - end for +constant tests = {123321, 7739, 893, 899998} +printf(1,"Number MDR MP\n") +printf(1,"====== === ==\n") +for i=1 to length(tests) do + integer ti = tests[i] + printf(1,"%6d %6d %6d\n",ti&mdr_mp(ti)) +end for - integer i=0, found = 0 - sequence res = columnize({tagset(9,0)}) - -- (ie {{0},{1},..,{9}}) - while found<50 do -- (ie the full 10*5) - integer mdr1 = mdr_mp(i)[1]+1 - sequence m1 = res[mdr1] - if length(m1)<6 then - res[mdr1] = 0 -- (avoid p2js violation) - m1 &= i - res[mdr1] = m1 - found += 1 - end if - i += 1 - end while +integer i=0, found = 0 +sequence res = columnize({tagset(9,0)}) + -- (ie {{0},{1},..,{9}}) +while found<50 do -- (ie the full 10*5) + integer mdr1 = mdr_mp(i)[1]+1 + sequence m1 = res[mdr1] + if length(m1)<6 then + res[mdr1] = 0 -- (avoid p2js violation) + m1 &= i + res[mdr1] = m1 + found += 1 + end if + i += 1 +end while - printf(1,"\nMDR 1 2 3 4 5") - printf(1,"\n=== ===========================\n") +printf(1,"\nMDR 1 2 3 4 5") +printf(1,"\n=== ===========================\n") - for i=1 to 10 do - printf(1,"%2d %5d %5d %5d %5d %5d\n",res[i]) - end for - - with javascript_semantics - function pdd(integer n) return sprintf("%2d",product(sq_sub(sprint(n),'0'))) end function - printf(1,"Product of the decimal digits of 1..100:\n%s\n", {join_by(apply(tagset(100),pdd),1,10)}) - s ) + + [ temp share 0 peek ] is baker ( --> n ) + [ temp share 1 peek ] is cooper ( --> n ) + [ temp share 2 peek ] is fletcher ( --> n ) + [ temp share 3 peek ] is miller ( --> n ) + [ temp share 4 peek ] is smith ( --> n ) + + [ temp share size = ] is top ( n --> b ) + [ 1 = ] is bottom ( n --> b ) + [ > ] is higher ( n n --> b ) + [ - abs 1 = ] is adjacent ( n n --> b ) + + [ if ]done[ ] is exclude ( b --> ) + [ not if ]done[ ] is require ( b --> ) + [ temp share nested join ] is include ( [ --> [ ) + + [ ]'[ ' include join + problem put + [] + ' [ 1 2 3 4 5 ] + permutations + witheach + [ temp put + problem share do + temp release ] + problem release + say " B C F M S" cr + witheach [ echo cr ] ] is solve ( --> ) + + solve + [ baker top exclude + cooper bottom exclude + fletcher top + fletcher bottom or exclude + miller cooper higher require + smith fletcher adjacent exclude + fletcher cooper adjacent exclude ] diff --git a/Task/Dinesmans-multiple-dwelling-problem/Rust/dinesmans-multiple-dwelling-problem.rust b/Task/Dinesmans-multiple-dwelling-problem/Rust/dinesmans-multiple-dwelling-problem.rs similarity index 100% rename from Task/Dinesmans-multiple-dwelling-problem/Rust/dinesmans-multiple-dwelling-problem.rust rename to Task/Dinesmans-multiple-dwelling-problem/Rust/dinesmans-multiple-dwelling-problem.rs diff --git a/Task/Dinesmans-multiple-dwelling-problem/Tailspin/dinesmans-multiple-dwelling-problem-2.tailspin b/Task/Dinesmans-multiple-dwelling-problem/Tailspin/dinesmans-multiple-dwelling-problem-2.tailspin index e4eaad513f..0fe1190c3f 100644 --- a/Task/Dinesmans-multiple-dwelling-problem/Tailspin/dinesmans-multiple-dwelling-problem-2.tailspin +++ b/Task/Dinesmans-multiple-dwelling-problem/Tailspin/dinesmans-multiple-dwelling-problem-2.tailspin @@ -1,24 +1,29 @@ -// We add a zero to be able to express e.g. "not top floor" -def floors: [0..5 -> (floor:$)]; -def names: [['Ground', 'Baker', 'Cooper', 'Fletcher', 'Miller', 'Smith']... -> (name:$)]; +permutations templates + when <|=1> do [1] ! + otherwise + n is $; + expand templates + p is $; + 1..$n -> templates + k is $; + [$p(..$k - 1)..., $n, $p($k..)...] ! + end ! + end expand + $n - 1 -> # -> expand ! +end permutations -def dwellings: [$floors, $names] -> \( - def solver: $ -> EinsteinSolver; +names is ['Baker', 'Cooper', 'Fletcher', 'Miller', 'Smith']; - {name: 'Ground', floor: 0} -> !solver::isFact - ({name: 'Ground'} solver::nextTo&{byField: :(floor:), bMinusA: [1..4]} {name: 'Baker'}) -> !VOID - ({name: 'Ground'} solver::nextTo&{byField: :(floor:), bMinusA: [2..5]} {name: 'Cooper'}) -> !VOID - ({name: 'Ground'} solver::nextTo&{byField: :(floor:), bMinusA: [2..4]} {name: 'Fletcher'}) -> !VOID - ({name: 'Cooper'} solver::nextTo&{byField: :(floor:), bMinusA: [1..4]} {name: 'Miller'}) -> !VOID - ({name: 'Fletcher'} solver::nextTo&{byField: :(floor:), bMinusA: [-4..-2, 2..4]} {name: 'Smith'}) -> !VOID - ({name: 'Fletcher'} solver::nextTo&{byField: :(floor:), bMinusA: [-4..-2, 2..4]} {name: 'Cooper'}) -> !VOID - - [$solver::solutions&{required: 6} ... -> ($ notMatching {| {name: 'Ground'} |})]! -\); - -$dwellings -> \[i]('Solution $i;: -$... -> '$; -'; -'! \)... -> !OUT::write -'No more solutions -' -> !OUT::write +5 -> permutations -> $names($) + -> if <|?($(.. as i; -> if <|='Baker'> -> $i)... matches <~|=5>)> + -> if <|?($(.. as i; -> if <|='Cooper'> -> $i)... matches <~|=1>)> + -> if <|?($(.. as i; -> if <|='Fletcher'> -> $i)... matches <~|=1|=5>)> + -> templates + miller is $(.. as i; -> if <|='Miller'> -> $i)...; + $ -> if <|?($(.. as i; -> if <|='Cooper'> -> $i)... matches <|..$miller>)> ! + end + -> if <|?(($(.. as i; -> if <|='Smith'> -> $i)...) - ($(.. as i; -> if <|='Fletcher'> -> $i)...) matches <~|=1|=-1>)> + -> if <|?(($(.. as i; -> if <|='Cooper'> -> $i)...) - ($(.. as i; -> if <|='Fletcher'> -> $i)...) matches <~|=1|=-1>)> + -> $(.. as i; -> '$i;:$;$#10;') + -> $(..:-1) + -> '$...;$#10;' ! diff --git a/Task/Dinesmans-multiple-dwelling-problem/Tailspin/dinesmans-multiple-dwelling-problem-3.tailspin b/Task/Dinesmans-multiple-dwelling-problem/Tailspin/dinesmans-multiple-dwelling-problem-3.tailspin new file mode 100644 index 0000000000..e4eaad513f --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/Tailspin/dinesmans-multiple-dwelling-problem-3.tailspin @@ -0,0 +1,24 @@ +// We add a zero to be able to express e.g. "not top floor" +def floors: [0..5 -> (floor:$)]; +def names: [['Ground', 'Baker', 'Cooper', 'Fletcher', 'Miller', 'Smith']... -> (name:$)]; + +def dwellings: [$floors, $names] -> \( + def solver: $ -> EinsteinSolver; + + {name: 'Ground', floor: 0} -> !solver::isFact + ({name: 'Ground'} solver::nextTo&{byField: :(floor:), bMinusA: [1..4]} {name: 'Baker'}) -> !VOID + ({name: 'Ground'} solver::nextTo&{byField: :(floor:), bMinusA: [2..5]} {name: 'Cooper'}) -> !VOID + ({name: 'Ground'} solver::nextTo&{byField: :(floor:), bMinusA: [2..4]} {name: 'Fletcher'}) -> !VOID + ({name: 'Cooper'} solver::nextTo&{byField: :(floor:), bMinusA: [1..4]} {name: 'Miller'}) -> !VOID + ({name: 'Fletcher'} solver::nextTo&{byField: :(floor:), bMinusA: [-4..-2, 2..4]} {name: 'Smith'}) -> !VOID + ({name: 'Fletcher'} solver::nextTo&{byField: :(floor:), bMinusA: [-4..-2, 2..4]} {name: 'Cooper'}) -> !VOID + + [$solver::solutions&{required: 6} ... -> ($ notMatching {| {name: 'Ground'} |})]! +\); + +$dwellings -> \[i]('Solution $i;: +$... -> '$; +'; +'! \)... -> !OUT::write +'No more solutions +' -> !OUT::write diff --git a/Task/Dinesmans-multiple-dwelling-problem/True-BASIC/dinesmans-multiple-dwelling-problem.basic b/Task/Dinesmans-multiple-dwelling-problem/True-BASIC/dinesmans-multiple-dwelling-problem.basic new file mode 100644 index 0000000000..a0579a9411 --- /dev/null +++ b/Task/Dinesmans-multiple-dwelling-problem/True-BASIC/dinesmans-multiple-dwelling-problem.basic @@ -0,0 +1,31 @@ +PRINT "Los apartamentos están numerados del 0 (bajo) al 4 (ático)." +PRINT "Baker, Cooper, Fletcher, Miller y Smith viven en apartamentos diferentes." +PRINT "- Baker no vive en el último apartamento (ático)." +PRINT "- Cooper no vive en el piso inferior (bajo)." +PRINT "- Fletcher no vive ni en el ático ni en el bajo." +PRINT "- Miller vive en un apartamento más alto que Cooper." +PRINT "- Smith no vive en un apartamento adyacente al de Fletcher." +PRINT "- Fletcher no vive en un apartamento adyacente al de Cooper." +PRINT +FOR baker = 0 TO 3 + FOR cooper = 1 TO 4 + FOR fletcher = 1 TO 3 + FOR miller = 0 TO 4 + FOR smith = 0 TO 4 + IF baker <> cooper AND baker <> fletcher AND baker <> miller AND baker <> smith AND cooper <> fletcher THEN + IF cooper <> miller AND cooper <> smith AND fletcher <> miller AND fletcher <> smith AND miller <> smith THEN + IF miller > cooper AND ABS(smith - fletcher) <> 1 AND ABS(fletcher - cooper) <> 1 THEN + PRINT "Baker vive en el piso "; baker + PRINT "Cooper vive en el piso "; cooper + PRINT "Fletcher vive en el piso "; fletcher + PRINT "Miller vive en el piso "; miller + PRINT "Smith vive en el piso "; smith + END IF + END IF + END IF + NEXT smith + NEXT miller + NEXT fletcher + NEXT cooper +NEXT baker +END diff --git a/Task/Dinesmans-multiple-dwelling-problem/Wren/dinesmans-multiple-dwelling-problem.wren b/Task/Dinesmans-multiple-dwelling-problem/Wren/dinesmans-multiple-dwelling-problem.wren index ad2e7f8688..84737995c8 100644 --- a/Task/Dinesmans-multiple-dwelling-problem/Wren/dinesmans-multiple-dwelling-problem.wren +++ b/Task/Dinesmans-multiple-dwelling-problem/Wren/dinesmans-multiple-dwelling-problem.wren @@ -1,4 +1,4 @@ -import "/seq" for Lst +import "./seq" for Lst var permute // recursive permute = Fn.new { |input| diff --git a/Task/Dining-philosophers/Ada/dining-philosophers-1.ada b/Task/Dining-philosophers/Ada/dining-philosophers-1.adb similarity index 100% rename from Task/Dining-philosophers/Ada/dining-philosophers-1.ada rename to Task/Dining-philosophers/Ada/dining-philosophers-1.adb diff --git a/Task/Dining-philosophers/Ada/dining-philosophers-2.ada b/Task/Dining-philosophers/Ada/dining-philosophers-2.adb similarity index 100% rename from Task/Dining-philosophers/Ada/dining-philosophers-2.ada rename to Task/Dining-philosophers/Ada/dining-philosophers-2.adb diff --git a/Task/Dining-philosophers/Ada/dining-philosophers-3.ada b/Task/Dining-philosophers/Ada/dining-philosophers-3.adb similarity index 100% rename from Task/Dining-philosophers/Ada/dining-philosophers-3.ada rename to Task/Dining-philosophers/Ada/dining-philosophers-3.adb diff --git a/Task/Dining-philosophers/Delphi/dining-philosophers.delphi b/Task/Dining-philosophers/Delphi/dining-philosophers.pas similarity index 100% rename from Task/Dining-philosophers/Delphi/dining-philosophers.delphi rename to Task/Dining-philosophers/Delphi/dining-philosophers.pas diff --git a/Task/Dining-philosophers/Elixir/dining-philosophers.elixir b/Task/Dining-philosophers/Elixir/dining-philosophers.ex similarity index 100% rename from Task/Dining-philosophers/Elixir/dining-philosophers.elixir rename to Task/Dining-philosophers/Elixir/dining-philosophers.ex diff --git a/Task/Dining-philosophers/Euphoria/dining-philosophers.euphoria b/Task/Dining-philosophers/Euphoria/dining-philosophers.eu similarity index 100% rename from Task/Dining-philosophers/Euphoria/dining-philosophers.euphoria rename to Task/Dining-philosophers/Euphoria/dining-philosophers.eu diff --git a/Task/Dining-philosophers/Fortran/dining-philosophers.f b/Task/Dining-philosophers/Fortran/dining-philosophers.f new file mode 100644 index 0000000000..25b8a072a6 --- /dev/null +++ b/Task/Dining-philosophers/Fortran/dining-philosophers.f @@ -0,0 +1,86 @@ +!Deadlock prevented by making one philosopher "left-handed" +!and making orderly use of omp locks which protect forks by ensuring that only one philosopher can use each fork at a time + program dining_philosophers + use omp_lib + implicit none + + integer, parameter :: N = 5 + integer(omp_lock_kind) :: forks(N) + character(len=20), dimension(N) :: names = [character(len=20) :: & + "Aristotle", "Kant", "Spinoza", "Marx", "Russell"] + integer :: i + integer :: next_thread = 0 ! Shared sequencing variable + + ! Initialize forks (mutexes) + do i = 1, N + call omp_init_lock(forks(i)) + end do + + ! Parallel region with N threads + !$omp parallel num_threads(N) private(i) shared(next_thread, forks, names) + i = omp_get_thread_num() + 1 ! Philosopher IDs: 1 to N + call philosopher(i, next_thread, forks, names) + !$omp end parallel + + ! Destroy locks + do i = 1, N + call omp_destroy_lock(forks(i)) + end do + +contains + + subroutine philosopher(id, next_thread, forks, names) + integer, intent(in) :: id + integer, intent(inout) :: next_thread + integer(omp_lock_kind), intent(inout) :: forks(:) + character(len=20), intent(in) :: names(:) + integer :: left, right, meals + + left = id + right = mod(id, size(forks)) + 1 ! Wrap around for right fork + !$omp barrier + ! Wait for turn to start + do while (id - 1 /= next_thread) + !$omp flush(next_thread) + end do + + print *, trim(names(id)), " sits down at the table." + + !$omp atomic + next_thread = next_thread + 1 + !$omp flush(next_thread) + + ! Philosopher's meal loop + do meals = 1, 20 +! print *, trim(names(id)), " is thinking." +! call sleep(1) + + ! Asymmetric fork acquisition to prevent deadlock + if (id < size(forks)) then + call omp_set_lock(forks(left)) + print *, trim(names(id)), " picked up left fork ", left + call omp_set_lock(forks(right)) + print *, trim(names(id)), " picked up right fork ", right + else + call omp_set_lock(forks(right)) + print *, trim(names(id)), " picked up right fork ", right + call omp_set_lock(forks(left)) + print *, trim(names(id)), " picked up left fork ", left + end if + + print *, trim(names(id)), " is eating." + call sleep(1) + + call omp_unset_lock(forks(left)) + call omp_unset_lock(forks(right)) + print *, trim(names(id)), " put down forks." + print *, trim(names(id)), " is thinking." + call sleep(1) + print *, trim(names(id)), " returns to the table." + + end do + + print *, trim(names(id)), " leaves the table." + end subroutine philosopher + +end program dining_philosophers diff --git a/Task/Dining-philosophers/FreeBASIC/dining-philosophers.basic b/Task/Dining-philosophers/FreeBASIC/dining-philosophers.basic new file mode 100644 index 0000000000..4909077304 --- /dev/null +++ b/Task/Dining-philosophers/FreeBASIC/dining-philosophers.basic @@ -0,0 +1,108 @@ +Const NUM_PHILOSOPHERS = 5 +Const HUNGER = 3 +Const THINK_TIME = 1000 +Const EAT_TIME = 1000 + +Type Fork + mutex As Any Ptr + available As Boolean +End Type + +Type Philosopher + nombre As String + leftFork As Fork Ptr + rightFork As Fork Ptr + hunger As Integer +End Type + +Dim Shared As Philosopher philosophers(NUM_PHILOSOPHERS-1) +Dim Shared As Fork forks(NUM_PHILOSOPHERS-1) +Dim Shared As Any Ptr printMutex + +Function threadSafePrint(text As String) As Integer + Mutexlock(printMutex) + Print text + Mutexunlock(printMutex) + Return 0 +End Function + +Sub delay(ms As Integer) + Dim As Double t = Timer + While (Timer - t) * 1000 < ms + Sleep 1, 1 + Wend +End Sub + +Function philosopherThread(param As Any Ptr) As Any Ptr + Dim As Philosopher Ptr phil = param + + threadSafePrint(phil->nombre + " seated") + + While phil->hunger > 0 + threadSafePrint(phil->nombre + " hungry") + + Mutexlock(phil->leftFork->mutex) + Mutexlock(phil->rightFork->mutex) + + threadSafePrint(phil->nombre + " eating") + delay(EAT_TIME) + + Mutexunlock(phil->leftFork->mutex) + Mutexunlock(phil->rightFork->mutex) + + threadSafePrint(phil->nombre + " thinking") + delay(THINK_TIME) + + phil->hunger -= 1 + Wend + + threadSafePrint(phil->nombre + " satisfied") + threadSafePrint(phil->nombre + " left the table") + + Return 0 +End Function + +' Main program +Dim As Integer i +Dim As String names(NUM_PHILOSOPHERS-1) = {"Aristotle", "Kant", "Spinoza", "Marx", "Russell"} +Print "Table empty" + +printMutex = Mutexcreate() + +' Initialize forks +For i = 0 To NUM_PHILOSOPHERS-1 + forks(i).mutex = Mutexcreate() + forks(i).available = True +Next + +' Initialize philosophers +For i = 0 To NUM_PHILOSOPHERS-1 + philosophers(i).nombre = names(i) + philosophers(i).hunger = HUNGER + philosophers(i).leftFork = @forks(i) + philosophers(i).rightFork = @forks((i + 1) Mod NUM_PHILOSOPHERS) +Next + +' Make last philosopher left-handed +Swap philosophers(NUM_PHILOSOPHERS-1).leftFork, philosophers(NUM_PHILOSOPHERS-1).rightFork + +' Create threads +Dim As Any Ptr threads(NUM_PHILOSOPHERS-1) +For i = 0 To NUM_PHILOSOPHERS-1 + threads(i) = Threadcreate(Cast(Sub(As Any Ptr), @philosopherThread), @philosophers(i)) +Next + +' Wait for all threads +For i = 0 To NUM_PHILOSOPHERS-1 + Threadwait(threads(i)) +Next + +' Cleanup +For i = 0 To NUM_PHILOSOPHERS-1 + Mutexdestroy(forks(i).mutex) +Next + +Mutexdestroy(printMutex) +Print "Table empty" + +Sleep diff --git a/Task/Dining-philosophers/Julia/dining-philosophers.julia b/Task/Dining-philosophers/Julia/dining-philosophers.jl similarity index 100% rename from Task/Dining-philosophers/Julia/dining-philosophers.julia rename to Task/Dining-philosophers/Julia/dining-philosophers.jl diff --git a/Task/Dining-philosophers/Kotlin/dining-philosophers.kotlin b/Task/Dining-philosophers/Kotlin/dining-philosophers.kts similarity index 100% rename from Task/Dining-philosophers/Kotlin/dining-philosophers.kotlin rename to Task/Dining-philosophers/Kotlin/dining-philosophers.kts diff --git a/Task/Dining-philosophers/Rust/dining-philosophers.rust b/Task/Dining-philosophers/Rust/dining-philosophers.rs similarity index 100% rename from Task/Dining-philosophers/Rust/dining-philosophers.rust rename to Task/Dining-philosophers/Rust/dining-philosophers.rs diff --git a/Task/Disarium-numbers/Ada/disarium-numbers.ada b/Task/Disarium-numbers/Ada/disarium-numbers.adb similarity index 100% rename from Task/Disarium-numbers/Ada/disarium-numbers.ada rename to Task/Disarium-numbers/Ada/disarium-numbers.adb diff --git a/Task/Disarium-numbers/Agena/disarium-numbers.agena b/Task/Disarium-numbers/Agena/disarium-numbers.agena new file mode 100644 index 0000000000..8f83231d93 --- /dev/null +++ b/Task/Disarium-numbers/Agena/disarium-numbers.agena @@ -0,0 +1,34 @@ +scope # find some Disarium numbers - numbers whose digit position-power sums + # are equal to the number, e.g. 135 = 1^1 + 3^2 + 5^3 + + # compute the nth powers of 0-9 + local constant power := seq( [], [], [], [], [], [], [], [], [] ); + for d from 0 to 9 do power[ 1, d ] := d od; + for n from 2 to 9 do + power[ n, 0 ] := 0; + for d to 9 do + power[ n, d ] := power[ n - 1, d ] * d + od + od; + # print the first few Disarium numbers + local constant maxDisarium := 19; + local count, powerOfTen, length := 0, 10, 1; + for n from 0 while count < maxDisarium do + if n = powerOfTen then + # the number of digits just increased + powerOfTen *:= 10; + length +:= 1 + fi; + # form the digit power sum + local v, dps := n, 0; + for p from length to 1 by -1 do + dps +:= power[ p, v mod 10 ]; + v \:= 10 + od; + if dps = n then + # n is Disarium + count +:= 1; + printf( " %d", n ) + fi + od +end diff --git a/Task/Disarium-numbers/Amazing-Hopper/disarium-numbers.hopper b/Task/Disarium-numbers/Amazing-Hopper/disarium-numbers.hopper new file mode 100644 index 0000000000..57d8337969 --- /dev/null +++ b/Task/Disarium-numbers/Amazing-Hopper/disarium-numbers.hopper @@ -0,0 +1,29 @@ +#include + +#proto encontrarunDisariumpara(_X_) +#synon _encontrarunDisariumpara siencontréunDisarium + +algoritmo + decimales '0' + iterar para ( n=3000000, n, --n ) + si encontré un Disarium 'n', entonces{ + imprimir( #(utf8("El número ")),n," es Disarium\n") + } + siguiente +terminar + +subrutinas + +encontrar un Disarium para (n) + + i=0 + n, obtener tamaño parte entera, mover a 'i' + m=0, tn=n, d=0 + iterar mientras ( tn ) + último dígito de 'tn', mover a 'd,tn' + d, elevado a 'i', más 'm' + mover a 'm' + --i + reiterar + +retornar ' #(m==n) ' diff --git a/Task/Disarium-numbers/C-sharp/disarium-numbers.cs b/Task/Disarium-numbers/C-sharp/disarium-numbers.cs new file mode 100644 index 0000000000..311c7d21b4 --- /dev/null +++ b/Task/Disarium-numbers/C-sharp/disarium-numbers.cs @@ -0,0 +1,32 @@ +using System; + +class DisariumNumbers { + // Method to check if a number is a Disarium number + public static bool IsDisarium(int num) { + int n = num; + int len = num.ToString().Length; + int sum = 0; + int i = 1; + while (n > 0) { + // C# does not support implicit conversion from double to int, so we explicitly convert the result of Math.Pow to int + sum += (int)Math.Pow(n % 10, len - i + 1); + n /= 10; + i++; + } + return sum == num; + } + + static void Main(string[] args) { + int i = 0; + int count = 0; + // Find and print the first 19 Disarium numbers + while (count <= 18) { + if (IsDisarium(i)) { + Console.Write($"{i} "); + count++; + } + i++; + } + Console.WriteLine(); + } +} diff --git a/Task/Disarium-numbers/COBOL/disarium-numbers.cobol b/Task/Disarium-numbers/COBOL/disarium-numbers.cob similarity index 100% rename from Task/Disarium-numbers/COBOL/disarium-numbers.cobol rename to Task/Disarium-numbers/COBOL/disarium-numbers.cob diff --git a/Task/Disarium-numbers/Chipmunk-Basic/disarium-numbers.basic b/Task/Disarium-numbers/Chipmunk-Basic/disarium-numbers.basic new file mode 100644 index 0000000000..1cb10a143b --- /dev/null +++ b/Task/Disarium-numbers/Chipmunk-Basic/disarium-numbers.basic @@ -0,0 +1,26 @@ +100 cls +110 sub isdisarium(n) +120 digitos = len(str$(n)) +130 suma = 0 +140 x = n +150 while x <> 0 +160 r = (x mod 10) +170 suma = suma+(r^digitos) +180 digitos = digitos-1 +190 x = int(x/10) +200 wend +210 if suma = n then isdisarium = true else isdisarium = false +220 end sub +230 ' +240 limite = 19 +250 cnt = 0 +260 n = 0 +270 print "The first ";limite;" Disarium numbers are:" +280 while cnt < limite +290 if isdisarium(n) then +300 print n;" "; +310 cnt = cnt+1 +320 endif +330 n = n+1 +340 wend +350 end diff --git a/Task/Disarium-numbers/Delphi/disarium-numbers.delphi b/Task/Disarium-numbers/Delphi/disarium-numbers.pas similarity index 100% rename from Task/Disarium-numbers/Delphi/disarium-numbers.delphi rename to Task/Disarium-numbers/Delphi/disarium-numbers.pas diff --git a/Task/Disarium-numbers/EasyLang/disarium-numbers.easy b/Task/Disarium-numbers/EasyLang/disarium-numbers.easy new file mode 100644 index 0000000000..08d03576da --- /dev/null +++ b/Task/Disarium-numbers/EasyLang/disarium-numbers.easy @@ -0,0 +1,21 @@ +fastfunc disarium n . + n0 = n + ndig = floor log n 10 + 1 + for i = ndig downto 1 + h += pow (n mod 10) i + n = n div 10 + . + if h = n0 : return 1 +. +fastfunc nextdisarium n . + repeat + n += 1 + until disarium n = 1 + . + return n +. +for i to 18 + n = nextdisarium n + write n & " " +. +print "" diff --git a/Task/Disarium-numbers/Fortran/disarium-numbers.f b/Task/Disarium-numbers/Fortran/disarium-numbers.f new file mode 100644 index 0000000000..5839193fc7 --- /dev/null +++ b/Task/Disarium-numbers/Fortran/disarium-numbers.f @@ -0,0 +1,112 @@ +! Disarium numbers +! +! tested with Intel ifx (IFX) 2025.2.0 20250605 on Kubuntu 25.04 +! GNU Fortran (Ubuntu 14.2.0-19ubuntu2) 14.2.0 on Kubuntu 25.04 +! VSI Fortran x86-64 V8.6-001 on OpenVMS x86_64 V9.2-3 +! Note that VMS requires switch $Fortran/ccdefault=LIST +! otherwise 1st character of each output line is interpreted as +! Carriage Control character. +! U.B., July 2025 + +program progDisarium + +implicit none + +! Others have already shown: 20th Disarium number has 20 digits +! This will not fit in signed 8-byte-integer. Current Fortran does +! not have unsigned integers of any size, so we can only calculate 19 Disarium numbers +! (unless we start to fiddle with homegrown extended precision integers) +! These 19 numbers all fit in 4 byte integers, so we can limit ourselves to +! signed 4-byte integers, with maximum possible number of digits is 10. + + integer, parameter :: maxDigs = 10 ! Maximum number of digits + integer , parameter :: nMax = 19 ! Number of Disarim numbers to print + integer :: ii ! loop index + integer :: count ! result counter + + ii=0 + count=0 + + do while (count .lt. nMax) ! finish when count is nMax. + if (isDisarium (ii)) then ! found another result + count = count + 1 + write (6,'(i0, x)', advance='no') ii ! print one by one, but all in 1 line + end if + ii = ii + 1 + end do + write (6,*) ! terminate line only + + contains + + function isDisarium (n) result(yn) + + integer, intent(in) :: n ! decide if n is disarium number + logical :: yn ! return value, true or false + integer :: numD, sum ! number of digits, sum of pow(digits,loc) + integer :: theDigits (maxDigs) ! vector with the numD digits of n + integer :: jj ! loop index + sum = 0 + + numD = getDigits (n, theDigits) ! Decompose n into numD Digits + + do jj=1, numD + if (theDigits(jj) .ne. 0) then + sum = sum + ipow(theDigits(jj), jj) + endif + end do + yn = (sum .eq. n) + end function isDisarium + + + function getDigits (n, d) result (ndigs) + + integer, intent(in) :: n ! decompose this into its digits + integer, intent(out) :: d(maxDigs) ! result: digits of n + integer :: ndigs ! return value: number of digits + integer :: ii ! loop index + integer :: localN ! Local copy of n to work with + + if (n .lt. 10) then ! Do the trivial case without further calculation + ndigs = 1 + d(1) = n + return + endif + + ndigs = 0 + localN = n + ! store them right-justified in array d + do while (localN .gt. 0) + d(maxDigs - ndigs) = mod(localN, 10) + ndigs = ndigs + 1 + localN = localN / 10 + end do + + ! Need to shift so that most significant digit appears at d (1) + do ii = 1, ndigs + d (ii) = d (maxDigs-ndigs+ii) + end do + + end function getDigits + + + ! Integer power: calculate n ^ pw + function ipow (n,pw) result (p) + integer, intent(in) :: n ! take this... + integer, intent(in) :: pw ! ... to the power of that + integer :: p ! Return value + integer :: ii ! Loop index + + p = 1 + + if (pw .lt. 0 .or. n.le. 0) then + print *, "function ipow(n,p) is only defined for values n,p both >0" + return + end if + + do ii=1, pw + p = p * n + end do + + end function ipow + +end program progDisarium diff --git a/Task/Disarium-numbers/Frink/disarium-numbers.frink b/Task/Disarium-numbers/Frink/disarium-numbers.frink new file mode 100644 index 0000000000..82f3f23e70 --- /dev/null +++ b/Task/Disarium-numbers/Frink/disarium-numbers.frink @@ -0,0 +1,12 @@ +isDisarium = {|n| + s = 0 + p = 1 + for d = integerDigits[n] + { + s = s + d^p + p = p + 1 + } + return n==s +} + +println[first[select[count[0], isDisarium], 19]] diff --git a/Task/Disarium-numbers/Icon/disarium-numbers.icon b/Task/Disarium-numbers/Icon/disarium-numbers.icon new file mode 100644 index 0000000000..86618f4a21 --- /dev/null +++ b/Task/Disarium-numbers/Icon/disarium-numbers.icon @@ -0,0 +1,11 @@ +procedure main(A) + limit := \A[1] | 18 + every writes(" ",disarium(seq(0)))\limit + write() +end + +procedure disarium(n) + ns := string(n) # Avoid redundant conversions later + every ((s := i := 0), j := !ns, i +:= 1) do s +:= ns[i]^i + return s = n +end diff --git a/Task/Disarium-numbers/J/disarium-numbers.j b/Task/Disarium-numbers/J/disarium-numbers.j index f9bd103175..7c3eab3737 100644 --- a/Task/Disarium-numbers/J/disarium-numbers.j +++ b/Task/Disarium-numbers/J/disarium-numbers.j @@ -1,4 +1,5 @@ -digits=: 10 #.inv ] -disarium=: (= (+/ .^ #\)@digits)"0 - I.disarium i.1e4 -0 1 2 3 4 5 6 7 8 9 89 135 175 518 598 1306 1676 2427 +digits=: "."0@": +disarium=: = (+/@:^ #\)@digits"0 + + I. disarium i. 27e5 +0 1 2 3 4 5 6 7 8 9 89 135 175 518 598 1306 1676 2427 2646798 diff --git a/Task/Disarium-numbers/Julia/disarium-numbers.julia b/Task/Disarium-numbers/Julia/disarium-numbers.jl similarity index 100% rename from Task/Disarium-numbers/Julia/disarium-numbers.julia rename to Task/Disarium-numbers/Julia/disarium-numbers.jl diff --git a/Task/Disarium-numbers/Kotlin/disarium-numbers.kotlin b/Task/Disarium-numbers/Kotlin/disarium-numbers.kts similarity index 100% rename from Task/Disarium-numbers/Kotlin/disarium-numbers.kotlin rename to Task/Disarium-numbers/Kotlin/disarium-numbers.kts diff --git a/Task/Disarium-numbers/MiniScript/disarium-numbers.mini b/Task/Disarium-numbers/MiniScript/disarium-numbers.mini new file mode 100644 index 0000000000..1bfed1805d --- /dev/null +++ b/Task/Disarium-numbers/MiniScript/disarium-numbers.mini @@ -0,0 +1,20 @@ +isDisarium = function(n) + num = n + sum = 0 + if num == 0 then return true + for i in range(ceil(log(n)), 1) + sum += (n % 10) ^ i + n = floor(n / 10) + end for + return num == sum +end function + +foundCnt = 0 +cnt = 0 +while foundCnt < 19 + if isDisarium(cnt) then + foundCnt += 1 + print cnt + end if + cnt +=1 +end while diff --git a/Task/Disarium-numbers/OCaml/disarium-numbers.ocaml b/Task/Disarium-numbers/OCaml/disarium-numbers.ml similarity index 100% rename from Task/Disarium-numbers/OCaml/disarium-numbers.ocaml rename to Task/Disarium-numbers/OCaml/disarium-numbers.ml diff --git a/Task/Disarium-numbers/Objeck/disarium-numbers.objeck b/Task/Disarium-numbers/Objeck/disarium-numbers.objeck new file mode 100644 index 0000000000..f79e3d6f25 --- /dev/null +++ b/Task/Disarium-numbers/Objeck/disarium-numbers.objeck @@ -0,0 +1,29 @@ +class DisariumNumbers { + function : Main(args : String[]) ~ Nil { + i := 0; + count := 0; + while(count <= 18) { + if(IsDisarium(i)) { + "{$i} "->Print(); + count++; + }; + + i++; + }; + '\n'->Print(); + } + + function : IsDisarium(num : Int) ~ Bool { + n := num; + len := n->ToString()->Size(); + sum := 0; + i := 1; + while (n > 0) { + sum += Int->Pow(n % 10, len - i + 1); + n /= 10; + i ++; + }; + + return sum = num; + } +} diff --git a/Task/Disarium-numbers/Odin/disarium-numbers.odin b/Task/Disarium-numbers/Odin/disarium-numbers.odin new file mode 100644 index 0000000000..c6ece460c6 --- /dev/null +++ b/Task/Disarium-numbers/Odin/disarium-numbers.odin @@ -0,0 +1,38 @@ +package disarium +import "core:fmt" +import "core:math" + +/* main block start */ +main :: proc() { + fmt.print("\nThe first 18 Disarium numbers are:") + count, i: int + for count < 19 { + if is_disarium(i) { + fmt.print(" ", i) + count += 1 + } + i += 1 + } + fmt.println("") +} /* main block end */ + +/* proc definitions */ +power :: proc(base, exponent: int) -> int { + result := 1 + for _ in 1 ..= exponent { + result *= base + } + return result +} + +is_disarium :: proc(num: int) -> bool { + n := num + sum := 0 + len := n <= 9 ? 1 : cast(int)math.floor_f64(math.log10_f64(auto_cast n) + 1) + for n > 0 { + sum += power(n % 10, len) + n /= 10 + len -= 1 + } + return num == sum +} diff --git a/Task/Disarium-numbers/PARI-GP/disarium-numbers.parigp b/Task/Disarium-numbers/PARI-GP/disarium-numbers.parigp new file mode 100644 index 0000000000..2f0215c66a --- /dev/null +++ b/Task/Disarium-numbers/PARI-GP/disarium-numbers.parigp @@ -0,0 +1,20 @@ +/* Function to check if a number is a Disarium number */ +IsDisarium(n) = { + my(digs = digits(n)); /* Get digits of n */ + my(mypowers = vector(#digs, i, digs[i]^i)); /* Raise each digit to its position */ + sum(i=1, #digs, mypowers[i]) == n /* Return 1 if sum equals original number */ +} + +/* Function to find Disarium numbers up to a limit */ +find_disarium(limit) = { + my(result = [], n = 0); + while(#result < limit, + if(IsDisarium(n), result = concat(result, n)); + n++; + ); + return(result); +} + +/* Main execution */ +disariumNumbers = find_disarium(19); +print("The first 19 Disarium numbers: ", disariumNumbers); diff --git a/Task/Disarium-numbers/PascalABC.NET/disarium-numbers.pas b/Task/Disarium-numbers/PascalABC.NET/disarium-numbers.pas new file mode 100644 index 0000000000..6e4ae6f80d --- /dev/null +++ b/Task/Disarium-numbers/PascalABC.NET/disarium-numbers.pas @@ -0,0 +1,15 @@ +## +function disariums: sequence of integer; +begin + var n := 0; + while true do + begin + var sum := 0.0; + foreach var x in n.ToString.ToCharArray index i do + sum := sum + power((x.todigit), i + 1); + if sum = n then yield (n); + n += 1; + end; +end; + +disariums.Take(19).Println; diff --git a/Task/Disarium-numbers/Pluto/disarium-numbers.pluto b/Task/Disarium-numbers/Pluto/disarium-numbers.pluto new file mode 100644 index 0000000000..4952e62669 --- /dev/null +++ b/Task/Disarium-numbers/Pluto/disarium-numbers.pluto @@ -0,0 +1,29 @@ +do -- find some Disarium numbers, numbers that are equal to their digit position power sums + + -- compute the nth powers of 0-9 # + local power = { { [0] = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, {}, {}, {}, {}, {}, {}, {}, {}, {} } + for n = 2, 9 do + power[n][0] = 0 + for d = 1, 9 do + power[n][d] = power[n - 1][d] * d + end + end + + local function isDisarium (x) + local str, sum = tostring(x), 0 + for pos = 1, #str do + local digit = tonumber(str[pos]) + sum += power[pos][digit] + end + return sum == x + end + + local count, n = 0, 0 + while count < 19 do + if isDisarium( n ) then + ++ count + io.write( " ", n ) + end + ++ n + end +end diff --git a/Task/Disarium-numbers/R/disarium-numbers.r b/Task/Disarium-numbers/R/disarium-numbers.r new file mode 100644 index 0000000000..bee77272bc --- /dev/null +++ b/Task/Disarium-numbers/R/disarium-numbers.r @@ -0,0 +1,12 @@ +disarium_sum <- function(n, i=ceiling(log10(n))){ + ifelse(n>9, (n%%10)^i+disarium_sum(n%/%10, i-1), n) +} + +count <- num <- 0 +while(count<19){ + if(num==disarium_sum(num)){ + print(num) + count <- count+1 + } + num <- num+1 +} diff --git a/Task/Disarium-numbers/Refal/disarium-numbers.refal b/Task/Disarium-numbers/Refal/disarium-numbers.refal new file mode 100644 index 0000000000..24e17b740b --- /dev/null +++ b/Task/Disarium-numbers/Refal/disarium-numbers.refal @@ -0,0 +1,32 @@ +$ENTRY Go { + = ; +}; + +Digits { + 0 = ; + s.N, : (s.R) s.D = s.D; +}; + +Pow { + s.N 0 = 1; + s.N s.P = <* s.N >>; +}; + +PowSum { + () e.P = 0; + (s.I e.X) e.P = <+ >>; + e.X = ; +}; + +Disarium { + e.N, >: e.N = True; + e.N = False; +}; + +FindDisarium { + 0 s.N = ; + s.I s.N, : { + True = <+ s.N 1>>; + False = >; + }; +}; diff --git a/Task/Disarium-numbers/Rust/disarium-numbers.rust b/Task/Disarium-numbers/Rust/disarium-numbers.rs similarity index 100% rename from Task/Disarium-numbers/Rust/disarium-numbers.rust rename to Task/Disarium-numbers/Rust/disarium-numbers.rs diff --git a/Task/Disarium-numbers/SETL/disarium-numbers.setl b/Task/Disarium-numbers/SETL/disarium-numbers.setl new file mode 100644 index 0000000000..ed7efa017f --- /dev/null +++ b/Task/Disarium-numbers/SETL/disarium-numbers.setl @@ -0,0 +1,13 @@ +program disarium_numbers; + loop for n in [0..2700000] | disarium n do + print(n); + end loop; + + op disarium(n); + k := n; + digits := [[k mod 10, k div:= 10](1) : until k=0]; + p := #digits+1; + powsum := +/[d ** (p -:= 1) : d in digits]; + return powsum = n; + end op; +end program; diff --git a/Task/Disarium-numbers/Uiua/disarium-numbers.uiua b/Task/Disarium-numbers/Uiua/disarium-numbers.uiua new file mode 100644 index 0000000000..37dbf6e7ff --- /dev/null +++ b/Task/Disarium-numbers/Uiua/disarium-numbers.uiua @@ -0,0 +1,2 @@ +IsDis ← =⊸(/+≡ⁿ+1⇡⊸⧻≡₀⋕°⋕) +⍜now(⋅⇌⍢(+1⍥⟜⊂⊸IsDis|<19⋅⧻)0[]) diff --git a/Task/Discordian-date/ALGOL-68/discordian-date.alg b/Task/Discordian-date/ALGOL-68/discordian-date.alg index ebf5dda235..11d03d007b 100644 --- a/Task/Discordian-date/ALGOL-68/discordian-date.alg +++ b/Task/Discordian-date/ALGOL-68/discordian-date.alg @@ -1,9 +1,11 @@ BEGIN # DISCORDIAN DATE CALCULATION - TRANSLATION OF MAD VIA ALGOL W # - INT greg, gmonth, gday, gyear; + INT gmonth, gday, gyear; []STRING holys = []STRING( "MUNG", "MOJO", "SYA", "ZARA", "MALA" )[ AT 0 ]; []STRING holys0 = []STRING( "CHAO", "DISCO", "CONFU", "BURE", "AF" )[ AT 0 ]; - []STRING disday = []STRING( "SWEETMORN", "BOOMTIME", "PUNGENday", "PRICKLE-PRICKLE", "SETTING ORANGE" )[ AT 0 ]; - []STRING disssn = []STRING( "CHAOS", "DISCORD", "CONFUSION", "BUREAUCRACY", "THE AFTERMATH" )[ AT 0 ]; + []STRING disday = + []STRING( "SWEETMORN", "BOOMTIME", "PUNGENDAY", "PRICKLE-PRICKLE", "SETTING ORANGE" )[ AT 0 ]; + []STRING disssn = + []STRING( "CHAOS", "DISCORD", "CONFUSION", "BUREAUCRACY", "THE AFTERMATH" )[ AT 0 ]; []INT mlengt = []INT( 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 )[ AT 0 ]; CHAR slash1, slash2; diff --git a/Task/Discordian-date/Ada/discordian-date.ada b/Task/Discordian-date/Ada/discordian-date.adb similarity index 100% rename from Task/Discordian-date/Ada/discordian-date.ada rename to Task/Discordian-date/Ada/discordian-date.adb diff --git a/Task/Discordian-date/Delphi/discordian-date.delphi b/Task/Discordian-date/Delphi/discordian-date.pas similarity index 100% rename from Task/Discordian-date/Delphi/discordian-date.delphi rename to Task/Discordian-date/Delphi/discordian-date.pas diff --git a/Task/Discordian-date/EasyLang/discordian-date.easy b/Task/Discordian-date/EasyLang/discordian-date.easy new file mode 100644 index 0000000000..600746ed03 --- /dev/null +++ b/Task/Discordian-date/EasyLang/discordian-date.easy @@ -0,0 +1,48 @@ +seasons$[] = [ "Chaos" "Discord" "Confusion" "Bureaucracy" "The Aftermath" ] +weekday$[] = [ "Sweetmorn" "Boomtime" "Pungenday" "Prickle-Prickle" "Setting Orange" ] +apostle$[] = [ "Mungday" "Mojoday" "Syaday" "Zaraday" "Maladay" ] +holiday$[] = [ "Chaoflux" "Discoflux" "Confuflux" "Bureflux" "Afflux" ] +# +func leap x . + return if x mod 400 = 0 or x mod 4 = 0 and x mod 100 <> 0 +. +func day_of_year y m d . + days[] = [ 31 28 31 30 31 30 31 31 30 31 30 31 ] + repeat + m -= 1 + until m = 0 + d += days[m] + if m = 2 and leap y = 1 : d += 1 + . + return d +. +func$ ddate y m d . + doy = day_of_year y m d + dyear = y + 1166 + if leap y = 1 and m = 2 and d = 29 + return "St. Tib's Day, in the YOLD " & dyear + . + if leap y = 1 and doy >= 60 : doy -= 1 + dsday = doy mod1 73 + dseason = doy div1 73 + r$ = weekday$[doy mod1 5] & ", day " & dsday & " of " & seasons$[dseason] + r$ &= " in the YOLD " & dyear & "." + if dsday = 5 + r$ &= " Celebrate " & apostle$[dseason] & "!" + elif dsday = 50 + r$ &= " Celebrate " & holiday$[dseason] & "!" + . + return r$ +. +proc show d$ . + a[] = number strsplit d$ "-" + write d$ & " --> " + print ddate a[1] a[2] a[3] +. +show "2016-01-05" +show "2016-02-28" +show "2016-02-29" +show "2016-03-01" +show "2016-12-31" +show "2025-03-19" +show substr timestr systime 1 10 diff --git a/Task/Discordian-date/Euphoria/discordian-date.euphoria b/Task/Discordian-date/Euphoria/discordian-date.eu similarity index 100% rename from Task/Discordian-date/Euphoria/discordian-date.euphoria rename to Task/Discordian-date/Euphoria/discordian-date.eu diff --git a/Task/Discordian-date/Julia/discordian-date.julia b/Task/Discordian-date/Julia/discordian-date.jl similarity index 100% rename from Task/Discordian-date/Julia/discordian-date.julia rename to Task/Discordian-date/Julia/discordian-date.jl diff --git a/Task/Discordian-date/Kotlin/discordian-date.kotlin b/Task/Discordian-date/Kotlin/discordian-date.kts similarity index 100% rename from Task/Discordian-date/Kotlin/discordian-date.kotlin rename to Task/Discordian-date/Kotlin/discordian-date.kts diff --git a/Task/Discordian-date/Phix/discordian-date.phix b/Task/Discordian-date/Phix/discordian-date.phix index 2a44d313c0..9404c2065d 100644 --- a/Task/Discordian-date/Phix/discordian-date.phix +++ b/Task/Discordian-date/Phix/discordian-date.phix @@ -1,43 +1,41 @@ -(phixonline)--> - with javascript_semantics - constant seasons = {"Chaos", "Discord", "Confusion", "Bureaucracy", "The Aftermath"}, - weekday = {"Sweetmorn", "Boomtime", "Pungenday", "Prickle-Prickle", "Setting Orange"}, - apostle = {"Mungday", "Mojoday", "Syaday", "Zaraday", "Maladay"}, - holiday = {"Chaoflux", "Discoflux", "Confuflux", "Bureflux", "Afflux"} +with javascript_semantics +constant seasons = {"Chaos", "Discord", "Confusion", "Bureaucracy", "The Aftermath"}, + weekday = {"Sweetmorn", "Boomtime", "Pungenday", "Prickle-Prickle", "Setting Orange"}, + apostle = {"Mungday", "Mojoday", "Syaday", "Zaraday", "Maladay"}, + holiday = {"Chaoflux", "Discoflux", "Confuflux", "Bureflux", "Afflux"} - function discordianDate(sequence dt) - integer {y,m,d} = dt, - leap = is_leap_year(y), - doy = day_of_year(y,m,d)-1 - string dyear = sprintf("%d",y+1166) - if leap and m=2 and d=29 then - return "St. Tib's Day, in the YOLD " & dyear - end if - if leap and doy>=60 then - doy -= 1 - end if - integer dsday = remainder(doy,73)+1, - dseason = floor(doy/73+1) - if dsday=5 then - return apostle[dseason] & ", in the YOLD " & dyear - elsif dsday=50 then - return holiday[dseason] & ", in the YOLD " & dyear - end if - string dseas = seasons[dseason], - dwday = weekday[remainder(doy,5)+1] - return sprintf("%s, day %d of %s in the YOLD %s", {dwday, dsday, dseas, dyear}) - end function +function discordianDate(sequence dt) + integer {y,m,d} = dt, + leap = is_leap_year(y), + doy = day_of_year(y,m,d)-1 + string dyear = sprintf("%d",y+1166) + if leap and m=2 and d=29 then + return "St. Tib's Day, in the YOLD " & dyear + end if + if leap and doy>=60 then + doy -= 1 + end if + integer dsday = remainder(doy,73)+1, + dseason = floor(doy/73+1) + if dsday=5 then + return apostle[dseason] & ", in the YOLD " & dyear + elsif dsday=50 then + return holiday[dseason] & ", in the YOLD " & dyear + end if + string dseas = seasons[dseason], + dwday = weekday[remainder(doy,5)+1] + return sprintf("%s, day %d of %s in the YOLD %s", {dwday, dsday, dseas, dyear}) +end function - -- test code +-- test code - sequence dt = {2015,1,1,0,0,0,0,0} - include timedate.e - atom oneday = timedelta(days:=1) - set_timedate_formats({"DD/MM/YYYY"}) - for i=1 to 5 do - printf(1,"%s: %s\n",{format_timedate(dt),discordianDate(dt)}) - dt = adjust_timedate(dt,oneday*72) - printf(1,"%s: %s\n",{format_timedate(dt),discordianDate(dt)}) - dt = adjust_timedate(dt,oneday) - end for - - with javascript_semantics - function linear_combination(sequence f) - string res = "" - for e=1 to length(f) do - integer fe = f[e] - if fe!=0 then - if fe=1 then - if length(res) then res &= "+" end if - elsif fe=-1 then - res &= "-" - elsif fe>0 and length(res) then - res &= sprintf("+%d*",fe) - else - res &= sprintf("%d*",fe) - end if - res &= sprintf("e(%d)",e) - end if - end for - if res="" then res = "0" end if - return res - end function +with javascript_semantics +function linear_combination(sequence f) + string res = "", fmt + for i,e in f do + if e!=0 then + integer l = length(res) + if abs(e)=1 then + res &= iff(e<0?"-":iff(l?"+":"")) + else + fmt = iff(e>0 and l?"+%d*":"%d*") + res &= sprintf(fmt,e) + end if + res &= sprintf("e(%d)",i) + end if + end for + if res="" then res = "0" end if + return res +end function - constant tests = {{1,2,3}, - {0,1,2,3}, - {1,0,3,4}, - {1,2,0}, - {0,0,0}, - {0}, - {1,1,1}, - {-1,-1,-1}, - {-1,-2,0,-3}, - {-1}} - for i=1 to length(tests) do - sequence ti = tests[i] - printf(1,"%12s -> %s\n",{sprint(ti), linear_combination(ti)}) - end for - - without js -- file i/o - enum Airport_ID, Name, City, Country, IATA, ICAO, Latitude, Longitude, Altitude, Timezone, DST, Tz_Olson, Type, Source - function tabulate(sequence s) - s = split(trim(s),"\n") - for i,ri in s do - ri = split(ri,',') - if length(ri)!=14 then - ri[2] &= ","&ri[3] - ri[3..3] = {} - end if - for j in {Airport_ID, Latitude, Longitude, Altitude} do - ri[j] = to_number(ri[j]) - end for - for j in {Name,City,Country,ICAO} do - ri[j] = trim(ri[j],`"`) - end for - s[i] = ri - end for - return s - end function +without js -- file i/o +enum Airport_ID, Name, City, Country, IATA, ICAO, Latitude, Longitude, Altitude, Timezone, DST, Tz_Olson, Type, Source +function tabulate(sequence s) + s = split(trim(s),"\n") + for i,ri in s do + ri = split(ri,',') + if length(ri)!=14 then + ri[2] &= ","&ri[3] + ri[3..3] = {} + end if + for j in {Airport_ID, Latitude, Longitude, Altitude} do + ri[j] = to_number(ri[j]) + end for + for j in {Name,City,Country,ICAO} do + ri[j] = trim(ri[j],`"`) + end for + s[i] = ri + end for + return s +end function - constant airports = tabulate(get_text("airports.dat")) +constant airports = tabulate(get_text("airports.dat")) - function distance(atom lat1, lon1, lat2, lon2, integer units) - atom dist = 0 - if lat1!=lat2 or lon1!=lon2 then - atom radlat1 = lat1*PI/180, - radlat2 = lat2*PI/180, - radtheta = (lon1-lon2)*PI/180 - dist = sin(radlat1)*sin(radlat2) + cos(radlat1)*cos(radlat2)*cos(radtheta) - dist = arccos(min(dist,1))*180/PI * 60*1.1515576 -- in Statute Miles - if units = 'K' then dist *= 1.609344 end if -- in Kilometres - if units = 'N' then dist *= 0.868976 end if -- in Nautical Miles - end if - return dist - end function +function distance(atom lat1, lon1, lat2, lon2, integer units) + atom dist = 0 + if lat1!=lat2 or lon1!=lon2 then + atom radlat1 = lat1*PI/180, + radlat2 = lat2*PI/180, + radtheta = (lon1-lon2)*PI/180 + dist = sin(radlat1)*sin(radlat2) + cos(radlat1)*cos(radlat2)*cos(radtheta) + dist = arccos(min(dist,1))*180/PI * 60*1.1515576 -- in Statute Miles + if units = 'K' then dist *= 1.609344 end if -- in Kilometres + if units = 'N' then dist *= 0.868976 end if -- in Nautical Miles + end if + return dist +end function - function bearing(atom lat1, lon1, lat2, lon2) - atom bear = NULL - if lat1!=lat2 or lon1!=lon2 then - atom radlat1 = lat1*PI/180, - radlat2 = lat2*PI/180, - raddlon = (lon2-lon1)*PI/180, - y = sin(raddlon)*cos(radlat2), - x = cos(radlat1)*sin(radlat2) - sin(radlat1)*cos(radlat2)*cos(raddlon) - bear = remainder(atan2(y, x)*180/PI+360,360) - end if - return bear; - end function +function bearing(atom lat1, lon1, lat2, lon2) + atom bear = NULL + if lat1!=lat2 or lon1!=lon2 then + atom radlat1 = lat1*PI/180, + radlat2 = lat2*PI/180, + raddlon = (lon2-lon1)*PI/180, + y = sin(raddlon)*cos(radlat2), + x = cos(radlat1)*sin(radlat2) - sin(radlat1)*cos(radlat2)*cos(raddlon) + bear = remainder(atan2(y, x)*180/PI+360,360) + end if + return bear; +end function - procedure query(atom lat,lon, integer rows=20) - sequence r = {} - for a in airports do - atom lat2 = a[Latitude], - lon2 = a[Longitude], - dist = round(distance(lat,lon,lat2,lon2,'N'),10), - bear = round(bearing(lat,lon,lat2,lon2)) - r = append(r,{a[Name],a[Country],a[ICAO],dist,bear}) - end for - r = sort_columns(r,{4})[1..rows] - printf(1," Name | Country | ICAO | Distance in NM | Bearing in ° \n") - printf(1,"-------------------------------------+----------------+------+----------------+--------------\n") - printf(1,"%s\n",{join(r,"\n",fmt:=" %-36s| %-15s| %4s | %4.1f | %3d")}) - printf(1,"(%d rows)\n",rows) - end procedure +procedure query(atom lat,lon, integer rows=20) + sequence r = {} + for a in airports do + atom lat2 = a[Latitude], + lon2 = a[Longitude], + dist = round(distance(lat,lon,lat2,lon2,'N'),10), + bear = round(bearing(lat,lon,lat2,lon2)) + r = append(r,{a[Name],a[Country],a[ICAO],dist,bear}) + end for + r = sort_columns(r,{4})[1..rows] + printf(1," Name | Country | ICAO | Distance in NM | Bearing in ° \n") + printf(1,"-------------------------------------+----------------+------+----------------+--------------\n") + printf(1,"%s\n",{join(r,"\n",fmt:=" %-36s| %-15s| %4s | %4.1f | %3d")}) + printf(1,"(%d rows)\n",rows) +end procedure - query(51.514669, 2.198581) - - with javascript_semantics - sequence rfs = {1} -- reverse factorial(1) in base 1000 +with javascript_semantics +sequence rfs = {1} -- reverse factorial(1) in base 1000 - function init_zc() - sequence zc = repeat(0,999) - for x=1 to 9 do - zc[x] = 2 -- 00x - zc[10*x] = 2 -- 0x0 - zc[100*x] = 2 -- x00 - for y=10 to 90 by 10 do - zc[y+x] = 1 -- 0yx - zc[10*y+x] = 1 -- y0x - zc[10*(y+x)] = 1 -- yx0 - end for - end for - return zc - end function - constant zc = init_zc() +function init_zc() + sequence zc = repeat(0,999) + for x=1 to 9 do + zc[x] = 2 -- 00x + zc[10*x] = 2 -- 0x0 + zc[100*x] = 2 -- x00 + for y=10 to 90 by 10 do + zc[y+x] = 1 -- 0yx + zc[10*y+x] = 1 -- y0x + zc[10*(y+x)] = 1 -- yx0 + end for + end for + return zc +end function +constant zc = init_zc() - atom t0 = time(), - total = 0 - integer trail = 1, - first = 0 - for f=2 to iff(platform()=JS?10000:50000) do - integer carry = 0, d999, - zeroes = (trail-1)*3, - j = trail, l = length(rfs) - while j<=l or carry do - if j<=l then - carry = (rfs[j])*f+carry - end if - d999 = remainder(carry,1000) - if j<=l then - rfs[j] = d999 - else - rfs &= d999 - end if - zeroes += iff(d999=0?3:zc[d999]) - carry = floor(carry/1000) - j += 1 - end while - while rfs[trail]=0 do trail += 1 end while - -- d999 := quick correction for length and zeroes: - d999 = rfs[$] - d999 = iff(d999<100?iff(d999<10?2:1):0) - zeroes -= d999 - integer digits = length(rfs)*3-d999 +atom t0 = time(), + total = 0 +integer trail = 1, + first = 0 +for f=2 to iff(platform()=JS?10000:50000) do + integer carry = 0, d999, + zeroes = (trail-1)*3, + j = trail, l = length(rfs) + while j<=l or carry do + if j<=l then + carry = (rfs[j])*f+carry + end if + d999 = remainder(carry,1000) + if j<=l then + rfs[j] = d999 + else + rfs &= d999 + end if + zeroes += iff(d999=0?3:zc[d999]) + carry = floor(carry/1000) + j += 1 + end while + while rfs[trail]=0 do trail += 1 end while + -- d999 := quick correction for length and zeroes: + d999 = rfs[$] + d999 = iff(d999<100?iff(d999<10?2:1):0) + zeroes -= d999 + integer digits = length(rfs)*3-d999 - total += zeroes/digits - atom ratio = total/f - if ratio>=0.16 then - first = 0 - elsif first=0 then - first = f - end if - if find(f,{100,1000,10000}) then - string e = elapsed(time()-t0) - printf(1,"Mean proportion of zero digits in factorials to %d is %.10f (%s)\n",{f,ratio,e}) - end if - end for - if platform()!=JS then - string e = elapsed(time()-t0) - printf(1,"The mean proportion dips permanently below 0.16 at %d. (%s)\n",{first,e}) - end if - - with javascript_semantics - atom t0 = time(), - f10 = log10(1), - total = 0 - integer first = 0 - for f=2 to 50000 do - f10 += log10(f) - integer digits = ceil(f10), - zeroes = 0, - v = 5 - while v<=f do - zeroes += floor(f/v) - v *= 5 - end while - total += zeroes/digits - atom ratio = total/f - if ratio>=0.07 then - first = 0 - elsif first=0 then - first = f - end if - if find(f,{100,1000,10000}) then - printf(1,"Mean proportion of trailing zeroes in factorials to %d is %f\n",{f,ratio}) - end if - end for - string e = elapsed(time()-t0) - printf(1,"The mean proportion dips permanently below 0.07 at %d. (%s)\n",{first,e}) - s ) + [ stack ] is zeroes ( --> s ) + + [ 0 digits put + 0 zeroes put + [ 1 digits tally + 10 /mod 0 = + zeroes tally + dup 0 = until ] + drop + zeroes take + digits take + reduce ] is zeroprop ( n --> n/d ) + + [ dup dip + [ 0 n->v + 1 ] + times + [ i^ 1+ * + dup zeroprop + rot dip v+ ] + drop + rot n->v v/ ] is distribution ( n --> n/d ) + + 100 distribution 10 point$ echo$ cr + 1000 distribution 10 point$ echo$ cr + 10000 distribution 10 point$ echo$ cr diff --git a/Task/Distribution-of-0-digits-in-factorial-series/Rust/distribution-of-0-digits-in-factorial-series.rust b/Task/Distribution-of-0-digits-in-factorial-series/Rust/distribution-of-0-digits-in-factorial-series.rs similarity index 100% rename from Task/Distribution-of-0-digits-in-factorial-series/Rust/distribution-of-0-digits-in-factorial-series.rust rename to Task/Distribution-of-0-digits-in-factorial-series/Rust/distribution-of-0-digits-in-factorial-series.rs diff --git a/Task/Distribution-of-0-digits-in-factorial-series/Wren/distribution-of-0-digits-in-factorial-series-1.wren b/Task/Distribution-of-0-digits-in-factorial-series/Wren/distribution-of-0-digits-in-factorial-series-1.wren index 1760f6d245..2030f184ed 100644 --- a/Task/Distribution-of-0-digits-in-factorial-series/Wren/distribution-of-0-digits-in-factorial-series-1.wren +++ b/Task/Distribution-of-0-digits-in-factorial-series/Wren/distribution-of-0-digits-in-factorial-series-1.wren @@ -1,5 +1,5 @@ -import "/big" for BigInt -import "/fmt" for Fmt +import "./big" for BigInt +import "./fmt" for Fmt var fact = BigInt.one var sum = 0 diff --git a/Task/Distribution-of-0-digits-in-factorial-series/Wren/distribution-of-0-digits-in-factorial-series-2.wren b/Task/Distribution-of-0-digits-in-factorial-series/Wren/distribution-of-0-digits-in-factorial-series-2.wren index f3fc6d3ff3..ef06ad478c 100644 --- a/Task/Distribution-of-0-digits-in-factorial-series/Wren/distribution-of-0-digits-in-factorial-series-2.wren +++ b/Task/Distribution-of-0-digits-in-factorial-series/Wren/distribution-of-0-digits-in-factorial-series-2.wren @@ -1,4 +1,4 @@ -import "/fmt" for Fmt +import "./fmt" for Fmt var rfs = [1] // reverse factorial(1) in base 1000 diff --git a/Task/Diversity-prediction-theorem/ANSI-BASIC/diversity-prediction-theorem.basic b/Task/Diversity-prediction-theorem/ANSI-BASIC/diversity-prediction-theorem.basic index 1bffb0d693..fc652fbb06 100644 --- a/Task/Diversity-prediction-theorem/ANSI-BASIC/diversity-prediction-theorem.basic +++ b/Task/Diversity-prediction-theorem/ANSI-BASIC/diversity-prediction-theorem.basic @@ -1,12 +1,12 @@ 100 PROGRAM DiversityPredictionTheorem 110 OPTION BASE 0 -120 DIM Estimates(1, 4) +120 DIM test(1, 4) 130 FOR I = 0 TO 1 140 LET J = 0 -150 READ Estimates(I, J) -160 DO WHILE Estimates(I, J) <> 0 +150 READ test(I, J) +160 DO WHILE test(I, J) <> 0 170 LET J = J + 1 -180 READ Estimates(I, J) +180 READ test(I, J) 190 LOOP 200 NEXT I 210 DATA 48.0, 47.0, 51.0, 0.0 @@ -15,16 +15,16 @@ 240 FOR I = 0 TO 1 250 LET Sum = 0 260 LET J = 0 -270 DO WHILE Estimates(I, J) <> 0 -280 LET Sum = Sum + (Estimates(I, J) - TrueVal) ^ 2 +270 DO WHILE test(I, J) <> 0 +280 LET Sum = Sum + (test(I, J) - TrueVal) ^ 2 290 LET J = J + 1 300 LOOP 310 LET AvgErr = Sum / J 320 PRINT USING "Average error : ##.###": AvgErr 330 LET Sum = 0 340 LET J = 0 -350 DO WHILE Estimates(I, J) <> 0 -360 LET Sum = Sum + Estimates(I, J) +350 DO WHILE test(I, J) <> 0 +360 LET Sum = Sum + test(I, J) 370 LET J = J + 1 380 LOOP 390 LET Avg = Sum / J diff --git a/Task/Diversity-prediction-theorem/Ada/diversity-prediction-theorem.ada b/Task/Diversity-prediction-theorem/Ada/diversity-prediction-theorem.adb similarity index 100% rename from Task/Diversity-prediction-theorem/Ada/diversity-prediction-theorem.ada rename to Task/Diversity-prediction-theorem/Ada/diversity-prediction-theorem.adb diff --git a/Task/Diversity-prediction-theorem/Asymptote/diversity-prediction-theorem.asymptote b/Task/Diversity-prediction-theorem/Asymptote/diversity-prediction-theorem.asymptote new file mode 100644 index 0000000000..d76b741bc3 --- /dev/null +++ b/Task/Diversity-prediction-theorem/Asymptote/diversity-prediction-theorem.asymptote @@ -0,0 +1,31 @@ +import math; + +real[][] estimates = { + {48, 47, 51}, + {48, 47, 51, 42} +}; + +real trueVal = 49; + +for (int i = 0; i < estimates.length; ++i) { + + real vari = 0; + real sum = 0; + + for (int j = 0; j < estimates[i].length; ++j) { + real d = estimates[i][j] - trueVal; + vari += d*d; + sum += estimates[i][j]; + } + + real n = estimates[i].length; + real avgErr = vari / n; + real refAvg = sum / n; + real crowdErr = (trueVal - refAvg)^2; + real div = avgErr - crowdErr; + + write("Average error : ", avgErr); + write(" Crowd error : ", crowdErr); + write(" Diversity : ", div); + write(""); +} diff --git a/Task/Diversity-prediction-theorem/Chipmunk-Basic/diversity-prediction-theorem.basic b/Task/Diversity-prediction-theorem/Chipmunk-Basic/diversity-prediction-theorem.basic new file mode 100644 index 0000000000..6c9a24f887 --- /dev/null +++ b/Task/Diversity-prediction-theorem/Chipmunk-Basic/diversity-prediction-theorem.basic @@ -0,0 +1,28 @@ +100 cls +110 dim estimates(1,5) +120 estimates(0,0) = 48 +130 estimates(0,1) = 47 +140 estimates(0,2) = 51 +150 estimates(1,0) = 48 +160 estimates(1,1) = 47 +170 estimates(1,2) = 51 +180 estimates(1,3) = 42 +190 trueval = 49 +200 for i = 0 to 1 +210 vari = 0 +220 sum = 0 +230 c = 0 +240 while estimates(i,c) <> 0 +250 vari = vari+(estimates(i,c)-trueval)^2 +260 sum = sum+estimates(i,c) +270 c = c+1 +280 wend +290 avgerr = vari/c +300 refavg = sum/c +310 crowderr = (trueval-refavg)^2 +320 print using "Average error : ###.###";avgerr +330 print using " Crowd error : ###.###";crowderr +340 print using " Diversity : ###.###";avgerr-crowderr +350 print +360 next i +370 end diff --git a/Task/Diversity-prediction-theorem/Crystal/diversity-prediction-theorem.cr b/Task/Diversity-prediction-theorem/Crystal/diversity-prediction-theorem.cr new file mode 100644 index 0000000000..e0d89e569a --- /dev/null +++ b/Task/Diversity-prediction-theorem/Crystal/diversity-prediction-theorem.cr @@ -0,0 +1,22 @@ +module Enumerable + def average + sum / size + end +end + +def get_values (true_value, crowd_estimates) + avg_individual_error = crowd_estimates.map {|e| (e - true_value)**2 }.average + collective_error = (crowd_estimates.average - true_value)**2 + crowd_avg = crowd_estimates.average + prediction_diversity = crowd_estimates.map {|e| (e - crowd_avg)**2 }.average + + { avg_individual_error, collective_error, prediction_diversity } +end + +puts "Value Crowd estimates Average error Crowd error Prediction diversity" +puts "---------------------------------------------------------------------------" + +[{49, [48, 47, 51]}, {49, [48, 47, 51, 42]}].each do |true_value, crowd_estimates| + printf " %2d %-20s %9.5f %9.5f %9.5f\n", true_value, crowd_estimates, + *get_values(true_value, crowd_estimates) +end diff --git a/Task/Diversity-prediction-theorem/Dart/diversity-prediction-theorem.dart b/Task/Diversity-prediction-theorem/Dart/diversity-prediction-theorem.dart new file mode 100644 index 0000000000..bd5382f318 --- /dev/null +++ b/Task/Diversity-prediction-theorem/Dart/diversity-prediction-theorem.dart @@ -0,0 +1,33 @@ +double sum(List array) { + double s = 0; + for (var x in array) s += x; + return s; +} + +double square(double x) => x * x; + +double mean(List array) => sum(array) / array.length; + +double averageSquareDiff(double a, List predictions) { + List results = []; + for (var x in predictions) { + results.add(square(x - a)); + } + return mean(results); +} + +void diversityTheorem(double truth, List predictions) { + double avgErr = averageSquareDiff(truth, predictions); + double avg = mean(predictions); + double crowdErr = square(truth - avg); + double diversity = averageSquareDiff(avg, predictions); + + print("Average error: ${avgErr.toStringAsFixed(4)}"); + print(" Crowd error: ${crowdErr.toStringAsFixed(4)}"); + print(" Diversity: ${diversity.toStringAsFixed(4)}\n"); +} + +void main() { + diversityTheorem(49, [48, 47, 51]); + diversityTheorem(49, [48, 47, 51, 42]); +} diff --git a/Task/Diversity-prediction-theorem/Delphi/diversity-prediction-theorem.delphi b/Task/Diversity-prediction-theorem/Delphi/diversity-prediction-theorem.pas similarity index 100% rename from Task/Diversity-prediction-theorem/Delphi/diversity-prediction-theorem.delphi rename to Task/Diversity-prediction-theorem/Delphi/diversity-prediction-theorem.pas diff --git a/Task/Diversity-prediction-theorem/DuckDB/diversity-prediction-theorem.duckdb b/Task/Diversity-prediction-theorem/DuckDB/diversity-prediction-theorem.duckdb new file mode 100644 index 0000000000..2cb2f486dd --- /dev/null +++ b/Task/Diversity-prediction-theorem/DuckDB/diversity-prediction-theorem.duckdb @@ -0,0 +1,31 @@ +create or replace function mean(lst) as ( + list_sum(lst)::DOUBLE / length(lst) +); + +# average absolute deviation relative to value +create or replace function aad(lst, value) as + list_transform(lst, x -> @(x-value)).list_sum() / length(lst) ; + +# average sum of squares +create or replace function ass(lst) as + list_transform(lst, x -> x ^ 2).list_sum() / length(lst); + +# Average sum of squared deviations relative to value +create or replace function asd(lst, value) as + list_transform(lst, x -> x - value).ass(); + +create or replace function diversitytheorem(actual, estimates) as table ( + select length(estimates) as "sample size", + actual as actual, + mean(estimates)::DECIMAL(4,2) as mean, + aad(estimates, actual)::DECIMAL(4,2) as "aad about actual", + aad(estimates, mean)::DECIMAL(4,2) as "aad about mean", + asd(estimates, actual)::DECIMAL(4,2) as "asd about actual", + asd(estimates, mean)::DECIMAL(4,2) as "asd about mean", + ((mean - actual) ^ 2)::DECIMAL(4,2) as "(mean-actual)^2" +); + +# The tasks: +from diversitytheorem(49, [48, 47, 51]) +union all +from diversitytheorem(49, [48, 47, 51, 42]); diff --git a/Task/Diversity-prediction-theorem/EasyLang/diversity-prediction-theorem.easy b/Task/Diversity-prediction-theorem/EasyLang/diversity-prediction-theorem.easy new file mode 100644 index 0000000000..2993d3082c --- /dev/null +++ b/Task/Diversity-prediction-theorem/EasyLang/diversity-prediction-theorem.easy @@ -0,0 +1,18 @@ +proc calc TrueVal test[] . + for test in test[] + h = (test - TrueVal) + Vari += h * h + Sum += test + c += 1 + . + AvgErr = Vari / c + RefAvg = Sum / c + h = (TrueVal - RefAvg) + CrowdErr = h * h + print "Average error : " & AvgErr + print "Crowd error : " & CrowdErr + print "Diversity : " & AvgErr - CrowdErr + print "" +. +calc 49 [ 48 47 51 ] +calc 49 [ 48 47 51 42 ] diff --git a/Task/Diversity-prediction-theorem/Fortran/diversity-prediction-theorem.f b/Task/Diversity-prediction-theorem/Fortran/diversity-prediction-theorem.f new file mode 100644 index 0000000000..1de6707869 --- /dev/null +++ b/Task/Diversity-prediction-theorem/Fortran/diversity-prediction-theorem.f @@ -0,0 +1,58 @@ +! Diversity prediction theorem +! tested with Intel ifx (IFX) 2025.2.1 20250806 on Kubuntu 25.10 +! GNU gfortran (Ubuntu 15.2.0-4ubuntu4) 15.2.0 on Kubuntu 25.10 +! VSI Fortran x86-64 V8.7-001 on OpenVMS V9.2-3 +program DivTheo + +implicit none +integer, parameter :: DP = 8 ! Kind for double precision Reals + +real (kind=DP), dimension(3), parameter :: Case1 =[48._DP,47._DP,51._DP] +real (kind=DP), dimension(4), parameter :: Case2 =[48._DP,47._DP,51._DP,42._DP] + + +call diversityTheorem (49._DP, case1, size(Case1)) +write (*,*) +call diversityTheorem (49._DP, case2, size(Case2)) + +contains +subroutine diversityTheorem (trueValue, predictions, n) +real (kind=DP), intent(in) :: trueValue +integer, intent(in) :: n +integer :: i +real (kind=DP), dimension(n), intent(in) :: predictions + +real (kind=DP) :: avPred + +avPred = sum(predictions,n) / n +! From the task desciption: +! show... +! the true value and the crowd estimates +! the average error +! the crowd error +! the prediction diversity +write (*, '("true value :", F4.0)') trueValue +write (*, '("crowd''s estimate :", 8F4.0)') (predictions(i),i=1,n) +write (*, '("average error :", F8.4 )') avSqDiff (trueValue, predictions, n) +write (*, '("crowd error :", F8.4 )') (trueValue - avPred) ** 2 +write (*, '("diversity :", F8.4 )') avSqDiff (avPred, predictions, n) +end subroutine diversityTheorem + + + +function avSqDiff (av, pred, n) result (sqDiff) + +integer, intent(in) :: n +real (kind=DP), intent(in) :: av +real (kind=DP), dimension(n), intent(in) :: pred +real (kind=DP) sqDiff +integer :: ii +sqDiff = 0 +do ii=1,n + sqdiff = sqdiff + (av-pred(ii))**2 +enddo +sqDiff = sqDiff / n + +end function avSqDiff + +end program DivTheo diff --git a/Task/Diversity-prediction-theorem/FreeBASIC/diversity-prediction-theorem.basic b/Task/Diversity-prediction-theorem/FreeBASIC/diversity-prediction-theorem.basic index 2b67d7c69a..43b33a4ac2 100644 --- a/Task/Diversity-prediction-theorem/FreeBASIC/diversity-prediction-theorem.basic +++ b/Task/Diversity-prediction-theorem/FreeBASIC/diversity-prediction-theorem.basic @@ -18,9 +18,9 @@ For i = 0 To 1 RefAvg = Sum / c CrowdErr = (TrueVal - RefAvg) ^2 - Print Using "Average error : ###.###"; AvgErr - Print Using " Crowd error : ###.###"; CrowdErr - Print Using " Diversity : ###.###"; AvgErr - CrowdErr + Print Using "Average error : ##.####"; AvgErr + Print Using " Crowd error : ##.####"; CrowdErr + Print Using " Diversity : ##.####"; AvgErr - CrowdErr Print Sleep diff --git a/Task/Diversity-prediction-theorem/FutureBasic/diversity-prediction-theorem.basic b/Task/Diversity-prediction-theorem/FutureBasic/diversity-prediction-theorem.basic new file mode 100644 index 0000000000..33e8b12ae8 --- /dev/null +++ b/Task/Diversity-prediction-theorem/FutureBasic/diversity-prediction-theorem.basic @@ -0,0 +1,28 @@ +include "NSLog.incl" + +double local fn Square( d as double ) +end fn = d * d + +double local fn AverageSquareDiff( d as double, predictions as CFArrayRef ) + double sum = 0.0 + for CFNumberRef num in predictions + sum += fn Square( fn NumberDoubleValue( num ) - d ) + next + return sum / fn ArrayCount( predictions ) +end fn = 0.0 + +CFStringRef local fn DiversityTheorem( truth as double, predictions as CFArrayRef ) + double average = fn NumberDoubleValue( fn ObjectValueForKeyPath( predictions, @"@avg.self" ) ) + CFStringRef avgErr = fn StringWithFormat( @"%4.5f", fn AverageSquareDiff( truth, predictions ) ) + CFStringRef crowdErr = fn StringWithFormat( @"%6.5f", fn Square( truth - average ) ) + CFStringRef diversity = fn StringWithFormat( @"%6.5f", fn AverageSquareDiff( average, predictions ) ) + return fn StringWithFormat( @"Average error : %@\nCrowd error : %@\nDiversity : %@\n", avgErr, crowdErr, diversity ) +end fn = NULL + +NSLog( @"Diversity prediction with crowd estimates of 48, 47 and 51:" ) +NSLog( @"%@\n", fn DiversityTheorem( 49.0, @[@48.0, @47.0, @51.0] ) ) + +NSLog( @"Diversity prediction with crowd estimates of 48, 47, 51 and 42:" ) +NSLog( @"%@\n", fn DiversityTheorem( 49.0, @[@48.0, @47.0, @51.0, @42.0] ) ) + +HandleEvents diff --git a/Task/Diversity-prediction-theorem/Gambas/diversity-prediction-theorem.gambas b/Task/Diversity-prediction-theorem/Gambas/diversity-prediction-theorem.gambas new file mode 100644 index 0000000000..0c4b0f6e73 --- /dev/null +++ b/Task/Diversity-prediction-theorem/Gambas/diversity-prediction-theorem.gambas @@ -0,0 +1,39 @@ +Public Sub Main() + + Dim test As New Float[2, 5] + + test[0, 0] = 48 + test[0, 1] = 47 + test[0, 2] = 51 + test[1, 0] = 48 + test[1, 1] = 47 + test[1, 2] = 51 + test[1, 3] = 42 + + Dim TrueVal As Float = 49 + Dim AvgErr As Float, CrowdErr As Float, RefAvg As Float + Dim Vari As Float, Sum As Float + Dim i As Integer, c As Integer + + For i = 0 To 1 + Vari = 0 + Sum = 0 + c = 0 + + While test[i, c] <> 0 + Vari += (test[i, c] - TrueVal) ^ 2 + Sum += test[i, c] + c += 1 + Wend + + AvgErr = Vari / c + RefAvg = Sum / c + CrowdErr = (TrueVal - RefAvg) ^ 2 + + Print "Average error : "; Format$(AvgErr, "##.###0") + Print " Crowd error : "; Format$(CrowdErr, "##.###0") + Print " Diversity : "; Format$(AvgErr - CrowdErr, "##.###0") + Print + Next + +End diff --git a/Task/Diversity-prediction-theorem/Julia/diversity-prediction-theorem.julia b/Task/Diversity-prediction-theorem/Julia/diversity-prediction-theorem.jl similarity index 100% rename from Task/Diversity-prediction-theorem/Julia/diversity-prediction-theorem.julia rename to Task/Diversity-prediction-theorem/Julia/diversity-prediction-theorem.jl diff --git a/Task/Diversity-prediction-theorem/Kotlin/diversity-prediction-theorem.kotlin b/Task/Diversity-prediction-theorem/Kotlin/diversity-prediction-theorem.kts similarity index 100% rename from Task/Diversity-prediction-theorem/Kotlin/diversity-prediction-theorem.kotlin rename to Task/Diversity-prediction-theorem/Kotlin/diversity-prediction-theorem.kts diff --git a/Task/Diversity-prediction-theorem/Loglan82/diversity-prediction-theorem.loglan82 b/Task/Diversity-prediction-theorem/Loglan82/diversity-prediction-theorem.loglan82 new file mode 100644 index 0000000000..076c7fc72c --- /dev/null +++ b/Task/Diversity-prediction-theorem/Loglan82/diversity-prediction-theorem.loglan82 @@ -0,0 +1,53 @@ +program diverspredict; +(* Diversity prediction theorem *) + +var + true_val: real, + estims: arrayof arrayof real, + sum, avg, avg_err, crowd_err, diff: real, + i, j: integer; +begin + array estims dim (0 : 1); + for i := 0 to 1 + do + array estims(i) dim (0 : 4) + od; + + estims(0, 0) := 48.0; + estims(0, 1) := 47.0; + estims(0, 2) := 51.0; + estims(0, 3) := 0.0; + estims(0, 4) := 0.0; + estims(1, 0) := 48.0; + estims(1, 1) := 47.0; + estims(1, 2) := 51.0; + estims(1, 3) := 42.0; + estims(1, 4) := 0.0; + true_val := 49.0; + for i := 0 to 1 + do + sum := 0.0; + j := 0; + while estims(i, j) =/= 0 + do + diff := estims(i, j) - true_val; + sum := sum + diff * diff; + j := j + 1; + od; + avg_err := sum / j; + writeln("Average error : ", avg_err: 7: 3); + sum := 0; + j := 0; + while estims(i, j) =/= 0 + do + sum := sum + estims(i, j); + j := j + 1; + od; + avg := sum / j; + diff := true_val - avg; + crowd_err := diff * diff; + writeln("Crowd error : ", crowd_err: 7: 3); + writeln("Diversity : ", avg_err - crowd_err: 7: 3); + writeln; + od +end diff --git a/Task/Diversity-prediction-theorem/MSX-Basic/diversity-prediction-theorem.basic b/Task/Diversity-prediction-theorem/MSX-Basic/diversity-prediction-theorem.basic new file mode 100644 index 0000000000..6884ab01b3 --- /dev/null +++ b/Task/Diversity-prediction-theorem/MSX-Basic/diversity-prediction-theorem.basic @@ -0,0 +1,33 @@ +100 CLS +110 DIM TS!(1,4) +120 TS!(0,0) = 48 +130 TS!(0,1) = 47 +140 TS!(0,2) = 51 +170 TS!(1,0) = 48 +180 TS!(1,1) = 47 +190 TS!(1,2) = 51 +200 TS!(1,3) = 42 +220 EV! = 49 +230 FOR I = 0 TO 1 +240 VA! = 0 +250 SM! = 0 +260 N = 0 +270 C = 0 +280 IF TS!(I,C) = 0 THEN 340 +290 DF! = TS!(I,C) - EV! +300 VA! = VA! + EXP(LOG(ABS(DF!)) * 2) +310 SM! = SM! + TS!(I,C) +320 N = N + 1 +330 C = C + 1 : GOTO 280 +340 C = C - 1 +350 IF N = 0 THEN 440 ' por si acaso +360 AV! = VA!/N +370 RV! = SM!/N +380 DF! = EV!-RV! +390 CR! = EXP(LOG(ABS(DF!))*2) +400 PRINT USING "Average error : ##.####";AV! +410 PRINT USING " Crowd error : ##.####";CR! +420 PRINT USING " Diversity : ##.####";AV!-CR! +430 PRINT +440 NEXT +350 END diff --git a/Task/Diversity-prediction-theorem/Maxima/diversity-prediction-theorem.maxima b/Task/Diversity-prediction-theorem/Maxima/diversity-prediction-theorem.maxima new file mode 100644 index 0000000000..d25d8de345 --- /dev/null +++ b/Task/Diversity-prediction-theorem/Maxima/diversity-prediction-theorem.maxima @@ -0,0 +1,10 @@ +diversityprediction(obs, ests) := block( + sprint("True value:", obs), newline(), + apply(sprint, cons("Estimates:", ests)), newline(), + sprint("Average error:", mean((obs-ests)^2)), newline(), + sprint("Crowd error:", (obs-mean(ests))^2), newline(), + sprint("Prediction diversity:", mean((mean(ests)-ests)^2)) +)$ + +diversityprediction(49, [48, 47, 51])$ +diversityprediction(49, [48, 47, 51, 42])$ diff --git a/Task/Diversity-prediction-theorem/Modula-2/diversity-prediction-theorem.mod2 b/Task/Diversity-prediction-theorem/Modula-2/diversity-prediction-theorem.mod2 new file mode 100644 index 0000000000..38528dab9d --- /dev/null +++ b/Task/Diversity-prediction-theorem/Modula-2/diversity-prediction-theorem.mod2 @@ -0,0 +1,48 @@ +MODULE DiversPredict; +(* Diversity prediction theorem *) + +FROM STextIO IMPORT + WriteLn, WriteString; +FROM SRealIO IMPORT + WriteFixed; + +TYPE + TEstims = ARRAY [0 .. 1], [0 .. 4] OF REAL; +VAR + Estims: TEstims; + TrueVal, Sum, AvgErr, Avg, CrowdErr, Diff: REAL; + I, J: CARDINAL; +BEGIN + Estims := TEstims{{48.0, 47.0, 51.0, 0.0, 0.0}, + {48.0, 47.0, 51.0, 42.0, 0.0}}; + TrueVal := 49.0; + FOR I := 0 TO 1 DO + Sum := 0.0; + J := 0; + WHILE Estims[I, J] <> 0.0 DO + Diff := Estims[I, J] - TrueVal; + Sum := Sum + Diff * Diff; + J := J + 1; + END; + AvgErr := Sum / FLOAT(J); + WriteString("Average error: "); + WriteFixed(AvgErr, 3, 7); + WriteLn; + Sum := 0.0; + J := 0; + WHILE Estims[I, J] <> 0.0 DO + Sum := Sum + Estims[I, J]; + J := J + 1; + END; + Avg := Sum / FLOAT(J); + Diff := TrueVal - Avg; + CrowdErr := Diff * Diff; + WriteString("Crowd error : "); + WriteFixed(CrowdErr, 3, 7); + WriteLn; + WriteString("Diversity : "); + WriteFixed(AvgErr - CrowdErr, 3, 7); + WriteLn; + WriteLn; + END; +END DiversPredict. diff --git a/Task/Diversity-prediction-theorem/Nascom-BASIC/diversity-prediction-theorem.basic b/Task/Diversity-prediction-theorem/Nascom-BASIC/diversity-prediction-theorem.basic index 3136029ccc..a934c0e988 100644 --- a/Task/Diversity-prediction-theorem/Nascom-BASIC/diversity-prediction-theorem.basic +++ b/Task/Diversity-prediction-theorem/Nascom-BASIC/diversity-prediction-theorem.basic @@ -1,5 +1,5 @@ 10 REM Diversity prediction theorem -20 DIM EST(1,4):REM Estimates +20 DIM EST(1,4):REM test 30 FOR I=0 TO 1 40 J=0:READ EST(I,J) 50 IF EST(I,J)=0 THEN 80 diff --git a/Task/Diversity-prediction-theorem/OxygenBasic/diversity-prediction-theorem.basic b/Task/Diversity-prediction-theorem/OxygenBasic/diversity-prediction-theorem.basic new file mode 100644 index 0000000000..6c4feeb2c1 --- /dev/null +++ b/Task/Diversity-prediction-theorem/OxygenBasic/diversity-prediction-theorem.basic @@ -0,0 +1,37 @@ +uses console + +dim float test(1, 4) +test(0,0) = 48 +test(0,1) = 47 +test(0,2) = 51 +test(1,0) = 48 +test(1,1) = 47 +test(1,2) = 51 +test(1,3) = 42 +test(1,4) = 0 + +dim float TrueVal = 49 +dim float AvgErr, CrowdErr, RefAvg, Vari, Sum +int i, c + +for i = 0 to 1 + Vari = 0 + Sum = 0 + c = 0 + while test(i,c) <> 0 + Vari += pow(test(i,c) - TrueVal) + Sum += test(i,c) + c += 1 + wend + AvgErr = Vari / c + RefAvg = Sum / c + CrowdErr = pow(TrueVal - RefAvg) + + printl "Average error : " AvgErr + printl " Crowd error : " CrowdErr + printl " Diversity : " AvgErr - CrowdErr + printl +next i + +printl cr "Enter ..." +waitkey diff --git a/Task/Diversity-prediction-theorem/PHP/diversity-prediction-theorem.php b/Task/Diversity-prediction-theorem/PHP/diversity-prediction-theorem.php new file mode 100644 index 0000000000..fb7d657c1f --- /dev/null +++ b/Task/Diversity-prediction-theorem/PHP/diversity-prediction-theorem.php @@ -0,0 +1,33 @@ + diff --git a/Task/Diversity-prediction-theorem/PL-I/diversity-prediction-theorem.pli b/Task/Diversity-prediction-theorem/PL-I/diversity-prediction-theorem.pli new file mode 100644 index 0000000000..3dcf57be5b --- /dev/null +++ b/Task/Diversity-prediction-theorem/PL-I/diversity-prediction-theorem.pli @@ -0,0 +1,36 @@ +/* Diversity prediction theorem */ + +diversity_predict: + procedure options(main); + declare + true_val float binary(15) static initial(49.0), + estims(0 : 1, 0 : 4) float binary(15) + static initial(48.0, 47.0, 51.0, 0.0, 0.0, + 48.0, 47.0, 51.0, 42.0, 0.0), + (sum, avg, avg_err, crowd_err) float binary(24), + (i, j) fixed binary(15); + do i = 0 to 1; + sum = 0.0; + j = 0; + do while (estims(i, j) ~= 0); + sum = sum + ((estims(i, j) - true_val) * (estims(i, j) - true_val)); + j = j + 1; + end; + avg_err = sum / j; + put skip list('Average error : '); + put edit(avg_err)(f(6, 3)); + sum = 0; + j = 0; + do while (estims(i, j) ~= 0); + sum = sum + estims(i, j); + j = j + 1; + end; + avg = sum / j; + crowd_err = (true_val - avg) * (true_val - avg); + put skip list('Crowd error : '); + put edit(crowd_err)(f(6, 3)); + put skip list('Diversity : '); + put edit(avg_err - crowd_err)(f(6, 3)); + put skip list(''); + end; +end diversity_predict; diff --git a/Task/Diversity-prediction-theorem/Pascal-P/diversity-prediction-theorem.pas b/Task/Diversity-prediction-theorem/Pascal-P/diversity-prediction-theorem.pas new file mode 100644 index 0000000000..b473430016 --- /dev/null +++ b/Task/Diversity-prediction-theorem/Pascal-P/diversity-prediction-theorem.pas @@ -0,0 +1,46 @@ +program diverspred(output); + + (* Diversity prediction theorem *) + +var + trueval, sum, avg, avgerr, crowderr: real; + estims: array [0 .. 1, 0 .. 4] of real; + i, j: integer; +begin + estims[0, 0] := 48.0; + estims[0, 1] := 47.0; + estims[0, 2] := 51.0; + estims[0, 3] := 0.0; + estims[0, 4] := 0.0; + estims[1, 0] := 48.0; + estims[1, 1] := 47.0; + estims[1, 2] := 51.0; + estims[1, 3] := 42.0; + estims[1, 4] := 0.0; + trueval := 49.0; + for i := 0 to 1 do + begin + sum := 0.0; + j := 0; + while estims[i, j] <> 0 do + begin + sum := sum + sqr(estims[i, j] - trueval); + j := j + 1; + end; + avgerr := sum / j; + writeln('Average error : ', avgerr: 10); + sum := 0; + j := 0; + while estims[i, j] <> 0 do + begin + sum := sum + estims[i, j]; + j := j + 1; + end; + avg := sum / j; + crowderr := sqr(trueval - avg); + writeln('Crowd error : ', crowderr: 10); + writeln('Diversity : ', avgerr - crowderr: 10); + writeln; + end; + (* readln; *) +end. diff --git a/Task/Diversity-prediction-theorem/PascalABC.NET/diversity-prediction-theorem.pas b/Task/Diversity-prediction-theorem/PascalABC.NET/diversity-prediction-theorem.pas new file mode 100644 index 0000000000..972e2e8c39 --- /dev/null +++ b/Task/Diversity-prediction-theorem/PascalABC.NET/diversity-prediction-theorem.pas @@ -0,0 +1,14 @@ +## +function AverageSquareDiff(a: real; predictions: array of real) := + predictions.Select(x -> (x - a).Sqr).Average; + +procedure DiversityTheorem(truth: real; predictions: array of real); +begin + var average := predictions.Average; + WriteLn('average-error: ', AverageSquareDiff(truth, predictions)); + WriteLn('crowd-error: ', (truth - average).Sqr); + WriteLn('diversity: ', AverageSquareDiff(average, predictions)); +end; + +DiversityTheorem(49.0, [48.0, 47.0, 51.0]); +DiversityTheorem(49.0, [48.0, 47.0, 51.0, 42.0]) diff --git a/Task/Diversity-prediction-theorem/Pluto/diversity-prediction-theorem.pluto b/Task/Diversity-prediction-theorem/Pluto/diversity-prediction-theorem.pluto new file mode 100644 index 0000000000..1d972f1fd2 --- /dev/null +++ b/Task/Diversity-prediction-theorem/Pluto/diversity-prediction-theorem.pluto @@ -0,0 +1,25 @@ +local fmt = require "fmt" +require "table2" + +local function average_square_diff(f, preds) + local av = 0 + for preds as pred do av += (pred - f) * (pred - f) end + return av / #preds +end + +local function diversity_theorem(truth, preds) + local av = preds:mean() + local av_err = average_square_diff(truth, preds) + local crowd_err = (truth - av) * (truth - av) + local div = average_square_diff(av, preds) + return av_err, crowd_err, div +end + +local preds_list = { {48, 47, 51}, {48, 47, 51, 42} } +local truth = 49 +for preds_list as preds do + local av_err, crowd_err, div = diversity_theorem(truth, preds) + fmt.print("Average-error : %6.3f", av_err) + fmt.print("Crowd-error : %6.3f", crowd_err) + fmt.print("Diversity : %6.3f\n", div) +end diff --git a/Task/Diversity-prediction-theorem/Python/diversity-prediction-theorem-1.py b/Task/Diversity-prediction-theorem/Python/diversity-prediction-theorem-1.py new file mode 100644 index 0000000000..e4b11515ad --- /dev/null +++ b/Task/Diversity-prediction-theorem/Python/diversity-prediction-theorem-1.py @@ -0,0 +1,15 @@ +def mean(lst): + return sum(lst)/len(lst) + +def squarediffs(x, lst): + return [(x-y)**2 for y in lst] + +def diversityprediction(obs, ests): + print("True value:", obs) + print("Estimates:", *ests) + print("Average error:", mean(squarediffs(obs, ests))) + print("Crowd error:", (obs-mean(ests))**2) + print("Prediction diversity:", mean(squarediffs(mean(ests), ests))) + +diversityprediction(49, [48, 47, 51]) +diversityprediction(49, [48, 47, 51, 42]) diff --git a/Task/Diversity-prediction-theorem/Python/diversity-prediction-theorem.py b/Task/Diversity-prediction-theorem/Python/diversity-prediction-theorem-2.py similarity index 100% rename from Task/Diversity-prediction-theorem/Python/diversity-prediction-theorem.py rename to Task/Diversity-prediction-theorem/Python/diversity-prediction-theorem-2.py diff --git a/Task/Diversity-prediction-theorem/QBasic/diversity-prediction-theorem.basic b/Task/Diversity-prediction-theorem/QBasic/diversity-prediction-theorem.basic new file mode 100644 index 0000000000..874655f894 --- /dev/null +++ b/Task/Diversity-prediction-theorem/QBasic/diversity-prediction-theorem.basic @@ -0,0 +1,29 @@ +DIM test(0 TO 1, 0 TO 4) AS DOUBLE +test(0, 0) = 48! +test(0, 1) = 47! +test(0, 2) = 51! +test(1, 0) = 48! +test(1, 1) = 47! +test(1, 2) = 51! +test(1, 3) = 42! + +TrueVal = 49! + +FOR i = 0 TO 1 + Vari = 0! + Sum = 0! + c = 0 + WHILE test(i, c) <> 0 + Vari = Vari + (test(i, c) - TrueVal) ^ 2 + Sum = Sum + test(i, c) + c = c + 1 + WEND + AvgErr = Vari / c + RefAvg = Sum / c + CrowdErr = (TrueVal - RefAvg) ^ 2 + + PRINT USING "Average error : ##.####"; AvgErr + PRINT USING " Crowd error : ##.####"; CrowdErr + PRINT USING " Diversity : ##.####"; AvgErr - CrowdErr + PRINT +NEXT i diff --git a/Task/Diversity-prediction-theorem/QuickBASIC/diversity-prediction-theorem.basic b/Task/Diversity-prediction-theorem/QuickBASIC/diversity-prediction-theorem.basic index 99ab57b239..e35a3355d0 100644 --- a/Task/Diversity-prediction-theorem/QuickBASIC/diversity-prediction-theorem.basic +++ b/Task/Diversity-prediction-theorem/QuickBASIC/diversity-prediction-theorem.basic @@ -1,11 +1,11 @@ REM Diversity prediction theorem -DIM Estimates(1, 4) +DIM test(1, 4) FOR I% = 0 TO 1 J% = 0 - READ Estimates(I%, J%) - WHILE Estimates(I%, J%) <> 0! + READ test(I%, J%) + WHILE test(I%, J%) <> 0! J% = J% + 1 - READ Estimates(I%, J%) + READ test(I%, J%) WEND NEXT I% DATA 48.0, 47.0, 51.0, 0.0 @@ -13,14 +13,14 @@ DATA 48.0, 47.0, 51.0, 42.0, 0.0 TrueVal = 49! FOR I% = 0 TO 1 Sum = 0!: J% = 0 - WHILE Estimates(I%, J%) <> 0! - Sum = Sum + (Estimates(I%, J%) - TrueVal) ^ 2: J% = J% + 1 + WHILE test(I%, J%) <> 0! + Sum = Sum + (test(I%, J%) - TrueVal) ^ 2: J% = J% + 1 WEND AvgErr = Sum / J% PRINT USING "Average error : ##.###"; AvgErr Sum = 0!: J% = 0 - WHILE Estimates(I%, J%) <> 0! - Sum = Sum + Estimates(I%, J%): J% = J% + 1 + WHILE test(I%, J%) <> 0! + Sum = Sum + test(I%, J%): J% = J% + 1 WEND Avg = Sum / J% CrowdErr = (TrueVal - Avg) ^ 2 diff --git a/Task/Diversity-prediction-theorem/Ruby/diversity-prediction-theorem.rb b/Task/Diversity-prediction-theorem/Ruby/diversity-prediction-theorem.rb index 5916702ef5..fb07cc9e10 100644 --- a/Task/Diversity-prediction-theorem/Ruby/diversity-prediction-theorem.rb +++ b/Task/Diversity-prediction-theorem/Ruby/diversity-prediction-theorem.rb @@ -1,5 +1,5 @@ def mean(a) = a.sum(0.0) / a.size -def mean_square_diff(a, predictions) = mean(predictions.map { |x| square(x - a)**2 }) +def mean_square_diff(a, predictions) = mean(predictions.map { |x| (x - a)**2 }) def diversity_theorem(truth, predictions) average = mean(predictions) diff --git a/Task/Diversity-prediction-theorem/True-BASIC/diversity-prediction-theorem.basic b/Task/Diversity-prediction-theorem/True-BASIC/diversity-prediction-theorem.basic new file mode 100644 index 0000000000..0ca506e3ca --- /dev/null +++ b/Task/Diversity-prediction-theorem/True-BASIC/diversity-prediction-theorem.basic @@ -0,0 +1,27 @@ +DIM test(0 to 1, 0 to 4) +LET test(0, 0) = 48.0 +LET test(0, 1) = 47.0 +LET test(0, 2) = 51.0 +LET test(1, 0) = 48.0 +LET test(1, 1) = 47.0 +LET test(1, 2) = 51.0 +LET test(1, 3) = 42.0 +LET trueval = 49.0 +FOR i = 0 to 1 + LET vari = 0.0 + LET sum = 0.0 + LET c = 0 + DO while test(i, c) <> 0 + LET vari = vari+(test(i, c)-trueval)^2 + LET sum = sum+test(i, c) + LET c = c+1 + LOOP + LET avgerr = vari/c + LET refavg = sum/c + LET crowderr = (trueval-refavg)^2 + PRINT using "Average error : ###.###": avgerr + PRINT using " Crowd error : ###.###": crowderr + PRINT using " Diversity : ###.###": avgerr-crowderr + PRINT +NEXT i +END diff --git a/Task/Diversity-prediction-theorem/Wren/diversity-prediction-theorem.wren b/Task/Diversity-prediction-theorem/Wren/diversity-prediction-theorem.wren index 494c2bd1ad..991602f546 100644 --- a/Task/Diversity-prediction-theorem/Wren/diversity-prediction-theorem.wren +++ b/Task/Diversity-prediction-theorem/Wren/diversity-prediction-theorem.wren @@ -1,4 +1,4 @@ -import "/fmt" for Fmt +import "./fmt" for Fmt var averageSquareDiff = Fn.new { |f, preds| var av = 0 diff --git a/Task/Diversity-prediction-theorem/XBasic/diversity-prediction-theorem.basic b/Task/Diversity-prediction-theorem/XBasic/diversity-prediction-theorem.basic new file mode 100644 index 0000000000..b96d40c2e3 --- /dev/null +++ b/Task/Diversity-prediction-theorem/XBasic/diversity-prediction-theorem.basic @@ -0,0 +1,36 @@ +PROGRAM "Diversity prediction theorem" +VERSION "0.0000" + +DECLARE FUNCTION Entry () + +FUNCTION Entry () + DIM test![1,4] + test![0, 0] = 48.0 + test![0, 1] = 47.0 + test![0, 2] = 51.0 + test![1, 0] = 48.0 + test![1, 1] = 47.0 + test![1, 2] = 51.0 + test![1, 3] = 42.0 + TrueVal! = 49.0 + + FOR i = 0 TO 1 + Vari! = 0.0 + Sum! = 0.0 + c = 0 + DO WHILE test![i, c] <> 0 + Vari! = Vari! + (test![i, c] - TrueVal!) ** 2 + Sum! = Sum! + test![i, c] + INC c + LOOP + AvgErr! = Vari! / c + RefAvg! = Sum! / c + CrowdErr! = (TrueVal! - RefAvg!) ** 2 + + PRINT "Average error : "; FORMAT$(STR$(AvgErr!), "##.###") + PRINT " Crowd error : "; FORMAT$(STR$(CrowdErr!), "##.###") + PRINT " Diversity : "; FORMAT$(STR$(AvgErr! - CrowdErr!), "##.###") + PRINT + NEXT i +END FUNCTION +END PROGRAM diff --git a/Task/Diversity-prediction-theorem/Yabasic/diversity-prediction-theorem.basic b/Task/Diversity-prediction-theorem/Yabasic/diversity-prediction-theorem.basic new file mode 100644 index 0000000000..55f6e04847 --- /dev/null +++ b/Task/Diversity-prediction-theorem/Yabasic/diversity-prediction-theorem.basic @@ -0,0 +1,30 @@ +dim test(1,4) +test(0,0) = 48.0 +test(0,1) = 47.0 +test(0,2) = 51.0 + +test(1,0) = 48.0 +test(1,1) = 47.0 +test(1,2) = 51.0 +test(1,3) = 42.0 + +TrueVal = 49.0 + +for i = 0 to 1 + Vari = 0.0 + Sum = 0.0 + c = 0 + while test(i,c) <> 0.0 + Vari = Vari + (test(i,c) - TrueVal) ^2 + Sum = Sum + test(i,c) + c = c + 1 + wend + AvgErr = Vari / c + RefAvg = Sum / c + CrowdErr = (TrueVal - RefAvg) ^2 + + print "Average error : ", AvgErr using("##.###") + print " Crowd error : ", CrowdErr using("##.###") + print " Diversity : ", AvgErr - CrowdErr using("##.###") + print +next i diff --git a/Task/Documentation/AWK/documentation.awk b/Task/Documentation/AWK/documentation.awk new file mode 100644 index 0000000000..f12f3545a5 --- /dev/null +++ b/Task/Documentation/AWK/documentation.awk @@ -0,0 +1,2 @@ +# AWK doesn't support this construct, you will have to use comments. +# The hash symbol # starts a comment. It ends at EOL. diff --git a/Task/Documentation/Ada/documentation.ada b/Task/Documentation/Ada/documentation.adb similarity index 100% rename from Task/Documentation/Ada/documentation.ada rename to Task/Documentation/Ada/documentation.adb diff --git a/Task/Documentation/C++/documentation.cpp b/Task/Documentation/C++/documentation.cpp new file mode 100644 index 0000000000..5298cffd6d --- /dev/null +++ b/Task/Documentation/C++/documentation.cpp @@ -0,0 +1,28 @@ +/* + * Program Title: Rosetta Code, Documentation + * Author : John Doe + * Version : 0.1 + * Date : 2023/12/31 + * Copyright : Public domain + * Description : An example of C++ program documentation +*/ +#include +#include + +/* + * Calculates the area of a circle with the given radius + */ +double area_circle(const double& radius) { + return (std::numbers::pi * radius * radius); +} + +// Controls the program +int main() { + // Obtain the users input + double radius; + std::cout << "Enter the radius of a circle in centimetres: "; + std::cin >> radius; + + // Display the result + std::cout << "The area of the circle is " << area_circle(radius) << " cm\u00b2" << "\n"; +} diff --git a/Task/Documentation/COBOL/documentation-1.cobol b/Task/Documentation/COBOL/documentation-1.cob similarity index 100% rename from Task/Documentation/COBOL/documentation-1.cobol rename to Task/Documentation/COBOL/documentation-1.cob diff --git a/Task/Documentation/COBOL/documentation-2.cobol b/Task/Documentation/COBOL/documentation-2.cob similarity index 100% rename from Task/Documentation/COBOL/documentation-2.cobol rename to Task/Documentation/COBOL/documentation-2.cob diff --git a/Task/Documentation/Crystal/documentation.crystal b/Task/Documentation/Crystal/documentation.cr similarity index 100% rename from Task/Documentation/Crystal/documentation.crystal rename to Task/Documentation/Crystal/documentation.cr diff --git a/Task/Documentation/Delphi/documentation.delphi b/Task/Documentation/Delphi/documentation.pas similarity index 100% rename from Task/Documentation/Delphi/documentation.delphi rename to Task/Documentation/Delphi/documentation.pas diff --git a/Task/Documentation/DuckDB/documentation-1.duckdb b/Task/Documentation/DuckDB/documentation-1.duckdb new file mode 100644 index 0000000000..6c629e36b7 --- /dev/null +++ b/Task/Documentation/DuckDB/documentation-1.duckdb @@ -0,0 +1,4 @@ +CREATE TABLE t AS (SELECT unnest([])); +COMMENT ON TABLE t IS /* this is just an example */ 'foo bar'; -- ignore me + +select comment from duckdb_tables where table_name = 't'; diff --git a/Task/Documentation/DuckDB/documentation-2.duckdb b/Task/Documentation/DuckDB/documentation-2.duckdb new file mode 100644 index 0000000000..4a22932f1c --- /dev/null +++ b/Task/Documentation/DuckDB/documentation-2.duckdb @@ -0,0 +1 @@ +COMMENT ON MACRO TABLE is ; diff --git a/Task/Documentation/DuckDB/documentation-3.duckdb b/Task/Documentation/DuckDB/documentation-3.duckdb new file mode 100644 index 0000000000..09ed87c083 --- /dev/null +++ b/Task/Documentation/DuckDB/documentation-3.duckdb @@ -0,0 +1,3 @@ +COMMENT ON TABLE main.test_table IS 'very nice table'; + +COMMENT ON COLUMN test_table.test_table_column IS 'very nice column'; diff --git a/Task/Documentation/Elixir/documentation-1.elixir b/Task/Documentation/Elixir/documentation-1.ex similarity index 100% rename from Task/Documentation/Elixir/documentation-1.elixir rename to Task/Documentation/Elixir/documentation-1.ex diff --git a/Task/Documentation/Elixir/documentation-2.elixir b/Task/Documentation/Elixir/documentation-2.ex similarity index 100% rename from Task/Documentation/Elixir/documentation-2.elixir rename to Task/Documentation/Elixir/documentation-2.ex diff --git a/Task/Documentation/Emacs-Lisp/documentation-1.l b/Task/Documentation/Emacs-Lisp/documentation-1.el similarity index 100% rename from Task/Documentation/Emacs-Lisp/documentation-1.l rename to Task/Documentation/Emacs-Lisp/documentation-1.el diff --git a/Task/Documentation/Emacs-Lisp/documentation-2.l b/Task/Documentation/Emacs-Lisp/documentation-2.el similarity index 100% rename from Task/Documentation/Emacs-Lisp/documentation-2.l rename to Task/Documentation/Emacs-Lisp/documentation-2.el diff --git a/Task/Documentation/Julia/documentation-1.julia b/Task/Documentation/Julia/documentation-1.jl similarity index 100% rename from Task/Documentation/Julia/documentation-1.julia rename to Task/Documentation/Julia/documentation-1.jl diff --git a/Task/Documentation/Julia/documentation-2.julia b/Task/Documentation/Julia/documentation-2.jl similarity index 100% rename from Task/Documentation/Julia/documentation-2.julia rename to Task/Documentation/Julia/documentation-2.jl diff --git a/Task/Documentation/Kotlin/documentation.kotlin b/Task/Documentation/Kotlin/documentation.kts similarity index 100% rename from Task/Documentation/Kotlin/documentation.kotlin rename to Task/Documentation/Kotlin/documentation.kts diff --git a/Task/Documentation/Phix/documentation.phix b/Task/Documentation/Phix/documentation.phix index d6302271c7..fcc24396b9 100644 --- a/Task/Documentation/Phix/documentation.phix +++ b/Task/Documentation/Phix/documentation.phix @@ -1,12 +1,10 @@ -(phixonline)--> - procedure StoreVar(integer N, integer NTyp) - -- - -- Store a variable, applying any final operator as needed. - -- If N is zero, PopFactor (ie store in a new temporary variable of - -- the specified type). Otherwise N should be an index to symtab. - -- If storeConst is 1, NTyp is ignored/overridden, otherwise it - -- should usually be the declared or local type of N. - -- - ... - end procedure - Bool ) { + die unless @sol.all eq .any; + my BagHash $b .= new; + for @sol.keys -> $p1 { + given @sol[$p1] { + when 'L' { my $p2 = $p1+1; die unless @sol[$p2] eq 'R'; $b{ domino( @tab[$p1,$p2].join ) }++; } + when 'D' { my $p2 = $p1+$cols; die unless @sol[$p2] eq 'U'; $b{ domino( @tab[$p1,$p2].join ) }++; } + } + } + die unless $b.values.max == 1 and $b.elems == $rows * $cols / 2; + return True; +} +for @tests -> ( $rows, $cols, $flat_table ) { + my @solutions = solve($rows, $cols, $flat_table.comb); + say 'Solutions found: ', +@solutions; + + # Confirm that every solution is valid. + solution_works($rows, $cols, $flat_table.comb, $_) or die for @solutions; + + # Print first solution + say .join.trans( [] => [<╼ ╾ ╽ ╿>]) for @solutions[0].batch($cols); + + if ++$ == 1 { + say 'Bonus:'; + say .value.fmt("%45d "), .key.tclc for bonus($rows, $cols); + say ''; + } +} diff --git a/Task/Dominoes/Uiua/dominoes.uiua b/Task/Dominoes/Uiua/dominoes.uiua new file mode 100644 index 0000000000..fc73e2f14a --- /dev/null +++ b/Task/Dominoes/Uiua/dominoes.uiua @@ -0,0 +1,29 @@ +GridOne ← ↯7_∞"05132231055052464303662006235126113002452143346664515414" +GridTwo ← ↯7_∞"64220650162341432102355113505610426040114420536366525334" # 2025 solutions + +Offsets ← [1_0 0_1] +FirstFreeCell ← ⊢⬚1▽⤚(¬°⊚⨂)⊙◌↯∞_2°⊡⊃(⋅∘|∘) +# Get pair of cells for down- and right- facing dominos. +CandDoms ← ≡⌞⊂⟜(≡˜⊟⊸+Offsets˙⊟ FirstFreeCell) +# Is the tail-cell of each domino in bounds and not visited? +ValidDoms ← ↧⊃(¬˜∊°⊂⇌|≠@_⬚@_⊡⊣) +# Has this domino already been 'played'? +NotDupeDom ← ⨬(¬˜∊°⊂≡⍆↯∞_2⇌⊡|⋅1) ⊸(=2⧻) +# Find two possible next doms, check them, and step. +Nexts ← ▽⤚≡NotDupeDom▽◡≡ValidDoms⊙¤ ⊸CandDoms +Done ← =∩⧻⊙♭ + +# Add spaces to a solution grid, for MarkDominos to fill. +SpacedGrid ← ↘1↯[∞ ∘]÷2⧻⊸⊢≡⊂˜↯@\s⊸△≡/(⊂$"_ ") +MarkDominos ← ∧(⍜⊡⋅@+)≡(/+↯∞_2) ↯∞_4 + +Solve ← ( + ⟜SpacedGrid + °□⊣⊢path(≡□Nexts°□|Done°□)□[] # Show first solution. + MarkDominos +) +&p"Only solution for first grid:" +&s Solve GridOne +Count ← ⧻path(≡□Nexts°□|Done°□)□[] # Count all solutions. +&p"Count of solutions for second grid:" +Count GridTwo diff --git a/Task/Doomsday-rule/00-TASK.txt b/Task/Doomsday-rule/00-TASK.txt index cfd6e09909..75b51e7e72 100644 --- a/Task/Doomsday-rule/00-TASK.txt +++ b/Task/Doomsday-rule/00-TASK.txt @@ -6,7 +6,7 @@ The algorithm was based on calculating the distance of a given date from certain "anchor days" which follow a pattern for the day of the week upon which they fall. ; Algorithm -The formula is calculated assuming that Sunday is 0, Monday 1, and so forth with Saturday 7, and +The formula is calculated assuming that Sunday is 0, Monday 1, and so forth up to Saturday 6, and doomsday = (Tuesday(or 2) + 5(y mod 4) + 4(y mod 100) + 6(y mod 400)) % 7 diff --git a/Task/Doomsday-rule/C-sharp/doomsday-rule.cs b/Task/Doomsday-rule/C-sharp/doomsday-rule.cs new file mode 100644 index 0000000000..da701dde47 --- /dev/null +++ b/Task/Doomsday-rule/C-sharp/doomsday-rule.cs @@ -0,0 +1,57 @@ +using System; + +class Doom { + public static void Main(string[] args) { + Date[] dates = { + new Date(1800,1,6), + new Date(1875,3,29), + new Date(1915,12,7), + new Date(1970,12,23), + new Date(2043,5,14), + new Date(2077,2,12), + new Date(2101,4,2) + }; + + foreach (Date d in dates) + Console.WriteLine($"{d.Format()}: {d.Weekday()}"); + } +} + +class Date { + private int year, month, day; + + private static readonly int[] leapDoom = {4,1,7,4,2,6,4,1,5,3,7,5}; + private static readonly int[] normDoom = {3,7,7,4,2,6,4,1,5,3,7,5}; + public static readonly string[] weekdays = { + "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday" + }; + + public Date(int year, int month, int day) { + this.year = year; + this.month = month; + this.day = day; + } + + public bool IsLeapYear() { + return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); + } + + public string Format() { + return $"{month:00}/{day:00}/{year:0000}"; + } + + public string Weekday() { + int c = year / 100; + int r = year % 100; + int s = r / 12; + int t = r % 12; + + int cAnchor = (5 * (c % 4) + 2) % 7; + int doom = (s + t + t / 4 + cAnchor) % 7; + int anchor = + IsLeapYear() ? leapDoom[month - 1] : normDoom[month - 1]; + + return weekdays[(doom + day - anchor + 7) % 7]; + } +} diff --git a/Task/Doomsday-rule/C/doomsday-rule.c b/Task/Doomsday-rule/C/doomsday-rule.c index 01166bb55b..66b4f73d16 100644 --- a/Task/Doomsday-rule/C/doomsday-rule.c +++ b/Task/Doomsday-rule/C/doomsday-rule.c @@ -13,7 +13,7 @@ bool leap(uint16_t year) { } const char *weekday(Date date) { - static const uint8_t leapdoom[] = {4,1,7,2,4,6,4,1,5,3,7,5}; + static const uint8_t leapdoom[] = {4,1,7,4,2,6,4,1,5,3,7,5}; static const uint8_t normdoom[] = {3,7,7,4,2,6,4,1,5,3,7,5}; static const char *days[] = { "Sunday", "Monday", "Tuesday", "Wednesday", diff --git a/Task/Doomsday-rule/Draco/doomsday-rule.draco b/Task/Doomsday-rule/Draco/doomsday-rule.draco new file mode 100644 index 0000000000..73e8211a33 --- /dev/null +++ b/Task/Doomsday-rule/Draco/doomsday-rule.draco @@ -0,0 +1,50 @@ +type Date = struct { + word year; + byte month; + byte day; +}; + +proc leap_year(word y) bool: + y%4 = 0 and (y%100 /= 0 or y % 400 = 0) +corp + +proc weekday(Date date) *char: + [12]byte leapdoom = (4,1,7,4,2,6,4,1,5,3,7,5); + [12]byte normdoom = (3,7,7,4,2,6,4,1,5,3,7,5); + word c, r, s, t, c_anchor, doom, anchor; + + c := date.year / 100; + r := date.year % 100; + s := r / 12; + t := r % 12; + + c_anchor := (5 * (c % 4) + 2) % 7; + doom := (s + t + (t/4) + c_anchor) % 7; + anchor := if leap_year(date.year) + then leapdoom[date.month-1] + else normdoom[date.month-1] + fi; + + case (doom+date.day-anchor+7)%7 + incase 0: "Sunday" + incase 1: "Monday" + incase 2: "Tuesday" + incase 3: "Wednesday" + incase 4: "Thursday" + incase 5: "Friday" + incase 6: "Saturday" + esac +corp + +proc main() void: + [7]Date dates = ( + (1800,1,6), (1875,3,29), (1915,12,7), (1970,12,23), (2043,5,14), + (2077,2,12), (2101,4,2) + ); + + word d; + for d from 0 upto 6 do + writeln(dates[d].month:2, '/', dates[d].day:2, '/', dates[d].year:4, + ": ", weekday(dates[d])) + od +corp diff --git a/Task/Doomsday-rule/EasyLang/doomsday-rule.easy b/Task/Doomsday-rule/EasyLang/doomsday-rule.easy new file mode 100644 index 0000000000..e3313604c0 --- /dev/null +++ b/Task/Doomsday-rule/EasyLang/doomsday-rule.easy @@ -0,0 +1,24 @@ +func leap year . + return if year mod 4 = 0 and (year mod 100 <> 0 or year mod 400 = 0) +. +func weekday year month day . + normdoom[] = [ 3 7 7 4 2 6 4 1 5 3 7 5 ] + c = year div 100 + r = year mod 100 + s = r div 12 + t = r mod 12 + c_anchor = (5 * (c mod 4) + 2) mod 7 + doom = (s + t + (t div 4) + c_anchor) mod 7 + anchor = normdoom[month] + if leap year = 1 and month <= 2 + anchor = (anchor + 1) mod1 7 + . + return (doom + day - anchor + 7) mod 7 + 1 +. +wkdays$[] = [ "Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" ] +dates$[] = [ "1800-01-06" "1875-03-29" "1915-12-07" "1970-12-23" "2043-05-14" "2077-02-12" "2101-04-02" ] +for d$ in dates$[] + write d$ & " -> " + a[] = number strsplit d$ "-" + print wkdays$[weekday a[1] a[2] a[3]] +. diff --git a/Task/Doomsday-rule/Fortran/doomsday-rule.f b/Task/Doomsday-rule/Fortran/doomsday-rule.f new file mode 100644 index 0000000000..7bfd36bf72 --- /dev/null +++ b/Task/Doomsday-rule/Fortran/doomsday-rule.f @@ -0,0 +1,208 @@ + program someday ! Calculates the day that a week falls on + use datestuff + implicit none +! +! PARAMETER definitions +! + integer , parameter :: numdates = 7 +! +! Local variable declarations +! + character(30) , dimension(numdates) , save :: date_string + integer , dimension(numdates) , save :: day + character(9) , dimension(numdates) , save :: days + integer :: j + integer :: k + integer , dimension(numdates) , save :: month + integer , dimension(numdates) , save :: year +! + data days/'Monday ' , 'Tuesday ' , 'Wednesday' , 'Thursday ' , & + &'Friday ' , 'Saturday ' , 'Sunday '/ + data month/01 , 03 , 12 , 12 , 05 , 02 , 04/ + data day/06 , 29 , 07 , 23 , 14 , 12 , 02/ + data year/1800 , 1875 , 1915 , 1970 , 2043 , 2077 , 2101/ + data date_string/'1800-01-06 (January 6, 1800)' , & + &'1875-03-29 (March 29, 1875)' , '1915-12-07 (December 7, 1915)' ,& + &'1970-12-23 (December 23, 1970)' , '2043-05-14 (May 14, 2043)' , & + &'2077-02-12 (February 12, 2077)' , '2101-04-02 (April 2, 2101)'/ ! +!*Code + + print * + do j = 1 , numdates + k = get_the_day(day(j) , month(j) , year(j)) + print '(a, t31,1a1,1x,a)' , date_string(j) , ':' , days(k) + end do + end program someday + module datestuff + implicit none + public :: get_the_day + private :: get_anchor_day , gregorian_leap_year +! + enum , bind(c) ! Use enums to get greater clarity in the code + enumerator :: january = 1 , february , march , april , may , & + & june , july , august , september , october , november ,& + & december + end enum + enum , bind(c) + enumerator :: sunday = 0 , monday , tuesday , wednesday , & + & thursday , friday , saturday + end enum + contains +! + pure function gregorian_leap_year(year) result(answer) ! Tests if the year is a leap year +! +! Function and Dummy argument declarations +! + logical :: answer + integer , intent(in) :: year +! + answer = .false. ! Set default to not a leap year + if( mod(year , 4)==0 )answer = .true. ! Year divisible by 4 = leap year + if( mod(year , 100)==0 )then + if( mod(year , 400)==0 )then ! Year divisible by 400 = century year that is leap year + answer = .true. + else + answer = .false. ! Century years are not leap years + end if + end if + end function gregorian_leap_year +! + pure function get_anchor_day(year) result(answer) ! Returns Anchor Days in doomsday calculation +!Note: The days start as Monday = 1, Tuesday =2, etc until Sunday = 7 +!The Doomsday rule, Doomsday algorithm or Doomsday method is an algorithm of determination of the day of the week for a given date. +!It provides a perpetual calendar because the Gregorian calendar moves in cycles of 400 years. +!It takes advantage of each year having a certain day of the week upon which certain easy-to-remember dates, +!called the doomsdays, fall; for example, the last day of February, 4/4, 6/6, 8/8, 10/10, and 12/12 all occur +! on the same day of the week in any year. Applying the Doomsday algorithm involves three steps: Determination of the anchor day +! for the century, calculation of the anchor day for the year from the one for the century, and selection of the closest date +! out of those that always fall on the doomsday, e.g., 4/4 and 6/6, and count of the number of days (modulo 7) between that +! date and the date in question to arrive at the day of the week. The technique applies to both the Gregorian calendar and the +! Julian calendar, although their doomsdays are usually different days of the week. +! +! Function and Dummy argument declarations +! + integer :: answer + integer , intent(in) :: year +! +! Local variable declarations +! + integer :: diffyear + integer :: div12 + integer :: numyears + integer :: temp1 +! +! End of declarations +!*Code + numyears = mod(year , 100) ! Get number of years greater than century + + temp1 = year - numyears ! Turn into a century year + temp1 = mod(temp1 , 400) ! Now mod 400 to get base year for anchor day + select case(temp1) ! Select the base day + case(0) + answer = tuesday + case(100) + answer = sunday + case(200) + answer = friday + case(300) + answer = wednesday + case default ! Anything else is an error + ERROR Stop 'Bad Anchor Day' ! Finish with error + end select + ! + !Calculate the doomsday of any given year + ! + div12 = int(numyears/12) ! Get number of times 12 goes into year + temp1 = mod(numyears , 12) ! Get the remainer + diffyear = int(temp1/4) ! Div 4 (magic algorithm) + answer = diffyear + div12 + answer + temp1 + answer = mod(answer , 7) + end function get_anchor_day ! Note: The days start as Sunday = 0, Monday = 1, Tuesday =2, etc until Saturda +! + pure function get_the_day(day , month , year) result(answer) +! Note: The days start as Sunday = 0, Monday = 1, Tuesday =2, etc until Saturday = 6 +! +! Function and Dummy argument declarations + integer :: answer + integer , intent(in) :: day + integer , intent(in) :: month + integer , intent(in) :: year +! +! Local variable declarations + integer :: closest + integer :: doomsday + integer :: temp1 + integer :: temp2 + integer :: up_or_down +! +! End of declarations +! + ! There are doomsdays in every month, so we know what month it is ... + ! We need to find the doomsday in the relevant month + select case(month) ! Scratch Variables + case(january) + closest = merge(4,3,gregorian_leap_year(year)) ! Use merge as a ternary + case(february) + closest = merge(29,28,gregorian_leap_year(year)) ! Use merge as a ternary + case(march) + closest = 7 + case(april) + closest = 4 + case(may) + closest = 9 + case(june) + closest = 6 + case(july) + temp1 = abs(4 - day) + temp2 = abs(11 - day) + closest = merge(4,11,temp1day )then + up_or_down = -7 + else if( closest0 )then + do while ( temp1<=day ) + temp2 = temp1 + temp1 = temp1 + up_or_down ! Count in sevens to the final + end do + temp1 = day - temp2 + temp1 = (doomsday + 7) + temp1 + else if( up_or_down<0 )then + do while ( temp1>=day ) + temp2 = temp1 + temp1 = temp1 + up_or_down ! Count in sevens to the final + end do + temp1 = temp2 - day ! See how far away I am from this day + temp1 = (doomsday + 7) - temp1 ! Subtract the difference in days from the known doomsday + else + temp1 = doomsday ! It fell on the doomsday + end if + answer = mod(temp1 , 7) ! Turn Sundays into Zeros + end function get_the_day +! + end module datestuff + ! diff --git a/Task/Doomsday-rule/JavaScript/doomsday-rule.js b/Task/Doomsday-rule/JavaScript/doomsday-rule.js new file mode 100644 index 0000000000..bd59065f59 --- /dev/null +++ b/Task/Doomsday-rule/JavaScript/doomsday-rule.js @@ -0,0 +1,52 @@ +// doom.js +const LEAP_DOOM = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]; +const NORM_DOOM = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]; +const WEEKDAYS = [ + 'Sunday', 'Monday', 'Tuesday', 'Wednesday', + 'Thursday', 'Friday', 'Saturday' +]; + +class Date { + constructor(year, month, day) { + this.year = year; + this.month = month; // 1-based + this.day = day; + } + + isLeapYear() { + const y = this.year; + return y % 4 === 0 && (y % 100 !== 0 || y % 400 === 0); + } + + format() { + const { month, day, year } = this; + return `${String(month).padStart(2, '0')}/${String(day).padStart(2, '0')}/${year}`; + } + + weekday() { + const { year, month, day } = this; + const c = Math.floor(year / 100); + const r = year % 100; + const s = Math.floor(r / 12); + const t = r % 12; + + const cAnchor = (5 * (c % 4) + 2) % 7; + const doom = (s + t + Math.floor(t / 4) + cAnchor) % 7; + const anchor = (this.isLeapYear() ? LEAP_DOOM : NORM_DOOM)[month - 1]; + + return WEEKDAYS[(doom + day - anchor + 7) % 7]; + } +} + +/* ---------- demo ---------- */ +const dates = [ + new Date(1800, 1, 6), + new Date(1875, 3, 29), + new Date(1915, 12, 7), + new Date(1970, 12, 23), + new Date(2043, 5, 14), + new Date(2077, 2, 12), + new Date(2101, 4, 2) +]; + +dates.forEach(d => console.log(`${d.format()}: ${d.weekday()}`)); diff --git a/Task/Doomsday-rule/Julia/doomsday-rule.julia b/Task/Doomsday-rule/Julia/doomsday-rule.jl similarity index 100% rename from Task/Doomsday-rule/Julia/doomsday-rule.julia rename to Task/Doomsday-rule/Julia/doomsday-rule.jl diff --git a/Task/Doomsday-rule/M2000-Interpreter/doomsday-rule.m2000 b/Task/Doomsday-rule/M2000-Interpreter/doomsday-rule.m2000 new file mode 100644 index 0000000000..bc2bab76ac --- /dev/null +++ b/Task/Doomsday-rule/M2000-Interpreter/doomsday-rule.m2000 @@ -0,0 +1,60 @@ +' MAKE USING("FORMAT STRING", PAR1, PAR2, ...PARN) +' WE USE READ V TO READ MORE PARAMETERS. +FUNCTION USING(A$) { + VARIANT V : LONG D, S, E, I=1: S$="" + WHILE I<=LEN(A$) + IF S THEN + IF MID$(A$,I,1)<>"#" THEN + IF MID$(A$,I,1)="." THEN D=I ELSE E=I + END IF + ELSE + IF MID$(A$,I,1)="#" THEN S=I + END IF + IF S AND E THEN + IF S>1 THEN S$+=LEFT$(A$, S-1) + A$=MID$(A$, E) + G() + S=0:E=0:D=0 + I=1 + END IF + I++ + END WHILE + IF S THEN + IF S>1 THEN S$+=LEFT$(A$, S-1):E=I-S+1: S=1 ELSE E=I + G() + =S$ + ELSE + =S$+A$ + END IF + SUB G() + IF ISNUM THEN + READ V + IF D>0 THEN + S$+=STR$(V, STRING$("#",E-D-1)+"0."+STRING$("0",D-S+1)) + ELSE + S$+=STR$(V, STRING$("0",E-S-1)+"0") + END IF + ELSE + V="" + READ V + S$+=LEFT$(V+STRING$(" ", E-S), E-S) + END IF + END SUB +} +05 FLUSH : GOSUB 110 +10 DIM D$(1 TO 7): FOR I=1 TO 7: READ D$(I): NEXT I +20 DIM D(1 TO 12, 0 TO 1): FOR I=0 TO 1: FOR J=1 TO 12: READ D(J, I): NEXT J : NEXT I +30 READ Y: IF Y=0 THEN BREAK ELSE READ M,D +40 PRINT USING("##/##/#### ", M, D, Y); +50 C=Y DIV 100: R=Y MOD 100 +60 S=R DIV 12: T=R MOD 12 +70 A=(5*BINARY.AND(C, 3)+2) MOD 7 +80 B=(S+T+(T DIV 4)+A) MOD 7 +90 PRINT D$((B+D-D(M,-(Y MOD 4=0 AND (Y MOD 100<>0 OR Y MOD 400=0)))+7) MOD 7+1) +100 GOTO 30 +110 DATA "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" +120 DATA 3,7,7,4,2,6,4,1,5,3,7,5 +130 DATA 4,1,7,4,2,6,4,1,5,3,7,5 +140 DATA 1800,1,6,1875,3,29,1915,12,7,1970,12,23 +150 DATA 2043,5,14,2077,2,12,2101,4,2,0 +160 RETURN diff --git a/Task/Doomsday-rule/Mathematica/doomsday-rule.math b/Task/Doomsday-rule/Mathematica/doomsday-rule.math new file mode 100644 index 0000000000..45a6d46d9e --- /dev/null +++ b/Task/Doomsday-rule/Mathematica/doomsday-rule.math @@ -0,0 +1,13 @@ +doomsday[year_Integer?Positive] := Mod[2 + 5 Mod[year, 4] + 4 Mod[year, 100] + 6 Mod[year, 400], 7]; + +firstDoomsday[month_Integer /; 1 <= month <= 2, year_Integer?Positive /; LeapYearQ[{year}]] := {4, 1}[[month]]; +firstDoomsday[month_Integer /; 1 <= month <= 2, year_Integer?Positive] := {3, 7}[[month]]; +firstDoomsday[month_Integer /; 3 <= month <= 12, year_Integer?Positive] := {7, 4, 2, 6, 4, 1, 5, 3, 7, 5}[[month - 2]]; + +weekday[{year_Integer?Positive, month_Integer?Positive /; 1 <= month <= 12, day_Integer?Positive /; 1 <= day <= 31}] := Mod[doomsday[year] + 7 + day - firstDoomsday[month, year], 7]; + +weekdayName[weekday_Integer /; 0 <= weekday <= 6] := {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}[[weekday + 1]]; + +dates = {{1800, 1, 6}, {1875, 3, 29}, {1915, 12, 7}, {1970, 12, 23}, {2043, 5, 14}, {2077, 2, 12}, {2101, 4, 2}}; + +weekdayName /@ weekday /@ dates diff --git a/Task/Doomsday-rule/Maxima/doomsday-rule.maxima b/Task/Doomsday-rule/Maxima/doomsday-rule.maxima new file mode 100644 index 0000000000..1fd7bccc28 --- /dev/null +++ b/Task/Doomsday-rule/Maxima/doomsday-rule.maxima @@ -0,0 +1,15 @@ +daynames: ["Sunday", "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", "Saturday"]$ + +isleapyear(y) := mod(y, 4)=0 and (mod(y, 100)#0 or mod(y, 400)=0)$ +anchors(y) := [if isleapyear(y) then 4 else 3, + if isleapyear(y) then 1 else 7, + 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]$ + +doomsday(y) := mod(2+5*mod(y, 4)+4*mod(y, 100)+6*mod(y, 400), 7)$ +wd(y, m, d) := mod(doomsday(y)+d-anchors(y)[m], 7)$ + +test_dates: [[1800, 1, 6], [1875, 3, 29], [1915, 12, 7], [1970, 12, 23], [2043, 5, 14], [2077, 2, 12], [2101, 4, 2]]$ + +raw_wds: map(lambda([l], apply(wd, l)), test_dates)$ +for i in raw_wds do(sprint(daynames[i+1]))$ diff --git a/Task/Doomsday-rule/Miranda/doomsday-rule.miranda b/Task/Doomsday-rule/Miranda/doomsday-rule.miranda new file mode 100644 index 0000000000..de3b570449 --- /dev/null +++ b/Task/Doomsday-rule/Miranda/doomsday-rule.miranda @@ -0,0 +1,29 @@ +main :: [sys_message] +main = [Stdout (lay [showdate d ++ ": " ++ weekday d | d<-tests])] + +date ::= Date (num,num,num) + +showdate :: date->[char] +showdate (Date (y,m,d)) = show m ++ "/" ++ show d ++ "/" ++ show y + +tests :: [date] +tests = map Date [ + (1800,1,6), (1875,3,29), (1915,12,7), (1970,12,23), (2043,5,14), + (2077,2,12), (2101,4,2)] + +weekday :: date->[char] +weekday (Date (year,month,day)) + = weekdays ! daynum + where weekdays = ["Sunday","Monday","Tuesday","Wednesday","Thursday", + "Friday","Saturday"] + doomtab = leapdoom, if leapyear + = normdoom, otherwise + leapdoom = [4,1,7,2,4,6,4,1,5,3,7,5] + normdoom = [3,7,7,4,2,6,4,1,5,3,7,5] + leapyear = year mod 4=0 & (year mod 100~=0 \/ year mod 400=0) + (c, r) = (year div 100, year mod 100) + (s, t) = (r div 12, r mod 12) + c_anchor = (5 * (c mod 4) + 2) mod 7 + doom = (s + t + t div 4 + c_anchor) mod 7 + anchor = doomtab ! (month - 1) + daynum = (doom + day - anchor + 7) mod 7 diff --git a/Task/Doomsday-rule/PascalABC.NET/doomsday-rule.pas b/Task/Doomsday-rule/PascalABC.NET/doomsday-rule.pas new file mode 100644 index 0000000000..2f45724a97 --- /dev/null +++ b/Task/Doomsday-rule/PascalABC.NET/doomsday-rule.pas @@ -0,0 +1,26 @@ +const + days: array of string = ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); + dooms: array of array of integer = ((3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5), + (4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5)); + +function isleap(year: integer) := (year mod 4 = 0) and ((year mod 100 <> 0) or (year mod 400 = 0)); + +function weekday(year, month, day: integer): string; +begin + var c := year div 100; + var r := year mod 100; + var s := r div 12; + var t := r mod 12; + var c_anchor := (5 * (c mod 4) + 2) mod 7; + var doomsday := (s + t + (t div 4) + c_anchor) mod 7; + var anchorday := dooms[if isleap(year) then 1 else 0][month - 1]; + var weekday := (doomsday + day - anchorday + 7) mod 7; + result := days[weekday]; +end; + +begin + var dates := |(1800, 1, 6), (1875, 3, 29), (1915, 12, 7), (1970, 12, 23), + (2043, 5, 14), (2077, 2, 12), (2101, 4, 2)|; + foreach var d in dates do + writeln(d[0], '-', d[1]:2, '-', d[2]:2, ' -> ', weekday(d[0], d[1], d[2])); +end. diff --git a/Task/Doomsday-rule/Pluto/doomsday-rule.pluto b/Task/Doomsday-rule/Pluto/doomsday-rule.pluto new file mode 100644 index 0000000000..8ce12b27df --- /dev/null +++ b/Task/Doomsday-rule/Pluto/doomsday-rule.pluto @@ -0,0 +1,42 @@ +local fmt = require "fmt" + +local anchor_day = |y| -> (2 + 5 * (y % 4) + 4 *(y % 100) + 6 * (y % 400)) % 7 + +local is_leap_year = |y| -> y % 4 == 0 and (y % 100 != 0 or y % 400 == 0) + +local first_days_common = {3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5} +local first_days_leap = {4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5} + +local dates = { + "1800-01-06", + "1875-03-29", + "1915-12-07", + "1970-12-23", + "2043-05-14", + "2077-02-12", + "2101-04-02" +} + +local function parse(date) + local y = tonumber(date:sub(1, 4)) + local m = tonumber(date:sub(6, 7)) + local d = tonumber(date:sub(9, 10)) + return y, m, d +end + +print("Days of week given by Doomsday rule:") +for dates as date do + local y, m, d = parse(date) + local a = anchor_day(y) + local w = d - (is_leap_year(y) ? first_days_leap[m] : first_days_common[m]) + if w < 0 then w += 7 end + local dow = (a + w) % 7 + print($"{date} -> {fmt.weekday(dow)}") +end + +print("\nDays of week given by standard library functions:") +for dates as date do + local y, m, d = parse(date) + local t = os.time({year = y, month = m, day = d}) + print($"{date} -> {os.date("%A", t)}") +end diff --git a/Task/Doomsday-rule/Quackery/doomsday-rule.quackery b/Task/Doomsday-rule/Quackery/doomsday-rule.quackery new file mode 100644 index 0000000000..5dfa5b0e1d --- /dev/null +++ b/Task/Doomsday-rule/Quackery/doomsday-rule.quackery @@ -0,0 +1,26 @@ + [ dup 400 mod 0 = iff [ drop true ] done + dup 100 mod 0 = iff [ drop false ] done + 4 mod 0 = ] is leap ( y --> b ) + + [ dup 4 mod 5 * + over 100 mod 4 * + + swap 400 mod 6 * + 2 + 7 mod ] is doomsday ( y --> n ) + + [ leap iff [ ' [ table 0 4 1 ] ] + else [ ' [ table 0 3 7 ] ] + ' [ 7 4 2 6 4 1 5 3 7 5 ] join do ] is close ( m y --> n ) + + [ dup doomsday unrot close - + 7 mod ] is weekday ( d m y --> n ) + + [ [ table $ "Sunday" $ "Monday" + $ "Tuesday" $ "Wednesday" $ "Thursday" + $ "Friday" $ "Saturday" ] do echo$ ] is echoday ( d --> ) + + ' [ [ 6 1 1800 ] + [ 29 3 1875 ] + [ 7 12 1915 ] + [ 23 12 1970 ] + [ 14 5 2043 ] + [ 12 2 2077 ] + [ 2 4 2101 ] ] + witheach [ unpack weekday echoday cr ] diff --git a/Task/Doomsday-rule/R/doomsday-rule.r b/Task/Doomsday-rule/R/doomsday-rule.r new file mode 100644 index 0000000000..9106214930 --- /dev/null +++ b/Task/Doomsday-rule/R/doomsday-rule.r @@ -0,0 +1,22 @@ +daynames <- c("Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday") + +isleapyear <- function(y) (y%%4==0)&((y%%100!=0)|(y%%400==0)) + +anchors <- function(y) c(ifelse(isleapyear(y), 4, 3), + ifelse(isleapyear(y), 1, 7), + 7, 4, 2, 6, 4, 1, 5, 3, 7, 5) + +doomsday <- function(y) (2+5*(y%%4)+4*(y%%100)+6*(y%%400))%%7 +wd <- function(y, m, d) (doomsday(y)+d-anchors(y)[m])%%7 + +test_dates <- list(c(1800, 1, 6), + c(1875, 3, 29), + c(1915, 12, 7), + c(1970, 12, 23), + c(2043, 5, 14), + c(2077, 2, 12), + c(2101, 4, 2)) + +raw_wds <- sapply(test_dates, function(v) do.call(wd, as.list(v))) +cat(daynames[raw_wds+1], "\n") diff --git a/Task/Doomsday-rule/Refal/doomsday-rule.refal b/Task/Doomsday-rule/Refal/doomsday-rule.refal new file mode 100644 index 0000000000..611e530466 --- /dev/null +++ b/Task/Doomsday-rule/Refal/doomsday-rule.refal @@ -0,0 +1,43 @@ +$ENTRY Go { + , (1800 1 6) (1875 3 29) (1915 12 7) (1970 12 23) + (2043 5 14) (2077 2 12) (2101 4 2): e.Tests + = ; +}; + +Test { + e.Test = >; +}; + +LeapYear { + s.Year = > + > + >>>; +}; + +Weekday { + s.Year s.Month s.Day, + 4 1 7 4 2 6 4 1 5 3 7 5: e.LeapDoom, + 3 7 7 4 2 6 4 1 5 3 7 5: e.NormDoom, + Sunday Monday Tuesday Wednesday Thursday Friday Saturday: e.Days, + : (s.C) s.R, + : (s.S) s.T, + >> 7>: s.CAn, + >>> 7>: s.Doom, + (e.LeapDoom) (e.NormDoom)>: (e.DoomTab), + e.DoomTab>: e.Anchor, + e.Anchor>> 7>: s.Weekday + = ; +}; + +Item { + 0 s.X e.XS = s.X; + s.N s.X e.XS = e.XS>; +}; + +If { True t.T t.F = t.T; False t.T t.F = t.F; }; +Eq { t.X t.X = True; t.X t.Y = False; }; +Or { True s.Y = True; False s.Y = s.Y; }; +And { False s.Y = False; True s.Y = s.Y; }; +Not { True = False; False = True; }; +Neq { t.X t.Y = >; }; +Each { (e.F) = ; (e.F) (e.X) e.XS = ; }; diff --git a/Task/Doomsday-rule/Rust/doomsday-rule.rust b/Task/Doomsday-rule/Rust/doomsday-rule.rs similarity index 100% rename from Task/Doomsday-rule/Rust/doomsday-rule.rust rename to Task/Doomsday-rule/Rust/doomsday-rule.rs diff --git a/Task/Doomsday-rule/SETL/doomsday-rule.setl b/Task/Doomsday-rule/SETL/doomsday-rule.setl new file mode 100644 index 0000000000..cf225f497f --- /dev/null +++ b/Task/Doomsday-rule/SETL/doomsday-rule.setl @@ -0,0 +1,29 @@ +program doomsday; + tests := [[1800,1,6], [1875,3,29], [1915,12,7], [1970,12,23], + [2043,5,14], [2077,2,12], [2101,4,2]]; + + loop for [year, month, day] in tests do + print(str day + "/" + str month + "/" + str year + ": " + + weekday(year, month, day)); + end loop; + + proc leap(y); + return y mod 4 = 0 and (y mod 100 /= 0 or y mod 400 = 0); + end proc; + + proc weekday(year, month, day); + leapdoom := [4,1,7,4,2,6,4,1,5,3,7,5]; + normdoom := [3,7,7,4,2,6,4,1,5,3,7,5]; + weekdays := ["Sunday","Monday","Tuesday","Wednesday","Thursday", + "Friday","Saturday"]; + + c := year div 100; + r := year mod 100; + s := r div 12; + t := r mod 12; + c_anchor := (5 * (c mod 4) + 2) mod 7; + doom := (s + t + (t div 4) + c_anchor) mod 7; + anchor := if leap(year) then leapdoom else normdoom end(month); + return weekdays((doom+day-anchor+7) mod 7+1); + end proc; +end program; diff --git a/Task/Doomsday-rule/Scala/doomsday-rule.scala b/Task/Doomsday-rule/Scala/doomsday-rule.scala new file mode 100644 index 0000000000..b2d3a46d05 --- /dev/null +++ b/Task/Doomsday-rule/Scala/doomsday-rule.scala @@ -0,0 +1,40 @@ +object Doom extends App { + val dates = Array( + new Date(1800, 1, 6), + new Date(1875, 3, 29), + new Date(1915, 12, 7), + new Date(1970, 12, 23), + new Date(2043, 5, 14), + new Date(2077, 2, 12), + new Date(2101, 4, 2) + ) + + dates.foreach(d => println(s"${d.format}: ${d.weekday}")) +} + +class Date(val year: Int, val month: Int, val day: Int) { + import Date._ + + def isLeapYear: Boolean = year % 4 == 0 && (year % 100 != 0 || year % 400 == 0) + + def format: String = f"$month%02d/$day%02d/$year%04d" + + def weekday: String = { + val c = year / 100 + val r = year % 100 + val s = r / 12 + val t = r % 12 + + val cAnchor = (5 * (c % 4) + 2) % 7 + val doom = (s + t + t / 4 + cAnchor) % 7 + val anchor = if (isLeapYear) leapdoom(month - 1) else normdoom(month - 1) + + weekdays((doom + day - anchor + 7) % 7) + } +} + +object Date { + private val leapdoom = Array(4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5) + private val normdoom = Array(3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5) + val weekdays = Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday") +} diff --git a/Task/Doomsday-rule/UNIX-Shell/doomsday-rule.sh b/Task/Doomsday-rule/UNIX-Shell/doomsday-rule.sh new file mode 100644 index 0000000000..891530b914 --- /dev/null +++ b/Task/Doomsday-rule/UNIX-Shell/doomsday-rule.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +day-of-the-week() + if [[ "$1" =~ ([0-9]{4})-([0-9]{2})-([0-9]{2}) ]] + then + local -ra names=({Sun,Mon,Tues,Wednes,Thurs,Fri,Satur}day) doomsday=({37,41}7426415375) + local -i i c s t a b + local -i {y,m,d}=${BASH_REMATCH[++i]} + echo ${names[ + c=y/100, + s=(y%100)/12, + t=(y % 100) % 12, + a=(5*(c%4)+2) % 7, + b=(s + t + (t / 4) + a ) % 7, + (b + d - ${doomsday[(y%4 == 0) && ((y%100) || (y%400 == 0))]:m-1:1} + 7) % 7 + ]} + else return 1 + fi + +for date in 1800-01-06 1875-03-29 1915-12-07 1970-12-23 2043-05-14 2077-02-12 2101-04-02 +do day-of-the-week "$date" +done diff --git a/Task/Doomsday-rule/Uiua/doomsday-rule.uiua b/Task/Doomsday-rule/Uiua/doomsday-rule.uiua new file mode 100644 index 0000000000..e8c760542c --- /dev/null +++ b/Task/Doomsday-rule/Uiua/doomsday-rule.uiua @@ -0,0 +1,7 @@ +Ds ← [3 7 7 4 2 6 4 1 5 3 7 5] +Ly ← ↧↥⊃(=0◿400|≠0◿100|=0◿4) +D ← ◿7+⊃(Ly|+2++⊃(×5◿4|×4◿100|×6◿400)) +Wd ← ["Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun"] +DoW ← ⊡:Wd◿7+D⊙(-⊡-1:Ds)°[⊙⊙∘] +[[1800 1 6][1875 3 29][1915 12 7][1970 12 23][2043 5 14][2077 2 12][2101 4 2]] +≡(&p$"_\t_"/$"_-_"°⋕⇌⟜DoW) diff --git a/Task/Doomsday-rule/V-(Vlang)/doomsday-rule.v b/Task/Doomsday-rule/V-(Vlang)/doomsday-rule.v index bc6194f84e..002a8b84fc 100644 --- a/Task/Doomsday-rule/V-(Vlang)/doomsday-rule.v +++ b/Task/Doomsday-rule/V-(Vlang)/doomsday-rule.v @@ -1,5 +1,4 @@ -const -( +const ( days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] first_days_common = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] first_days_leap = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] @@ -24,15 +23,11 @@ fn main() { d = date[8..10].int() a = anchor_day(y) f = first_days_common[m] - if is_leap_year(y) { - f = first_days_leap[m] - } + if is_leap_year(y) {f = first_days_leap[m]} w = d - f - if w < 0 { - w = 7 + w - } + if w < 0 {w = 7 + w} dow = (a + w) % 7 - println('$date -> ${days[dow]}') + println("$date -> ${days[dow]}") } } diff --git a/Task/Doomsday-rule/Wren/doomsday-rule.wren b/Task/Doomsday-rule/Wren/doomsday-rule.wren index bd28ec8437..559d55a03f 100644 --- a/Task/Doomsday-rule/Wren/doomsday-rule.wren +++ b/Task/Doomsday-rule/Wren/doomsday-rule.wren @@ -1,4 +1,4 @@ -import "/date" for Date +import "./date" for Date var days = ["Sunday", "Monday", "Tuesday", "Wednesday","Thursday", "Friday", "Saturday"] diff --git a/Task/Dot-product/00-TASK.txt b/Task/Dot-product/00-TASK.txt index e3ca21eba5..40361afe8d 100644 --- a/Task/Dot-product/00-TASK.txt +++ b/Task/Dot-product/00-TASK.txt @@ -15,7 +15,7 @@ If implementing the dot product of two vectors directly: :::*   sum the products   (to produce the answer) -;Related task: -*   [[Vector products]] +;Related tasks: +* [[Arrays]], [[Vector]], [[Dot product]], [[Vector products]], [[Matrices]], [[Bivector]], [[Antivector]], [[Tensor]], [[Quaternion]], [[Rotor]], [[Motor]], [[Sedenion]], [[Octonion]]

diff --git a/Task/Dot-product/ANSI-BASIC/dot-product.basic b/Task/Dot-product/ANSI-BASIC/dot-product.basic new file mode 100644 index 0000000000..1f3bf387b2 --- /dev/null +++ b/Task/Dot-product/ANSI-BASIC/dot-product.basic @@ -0,0 +1,45 @@ +100 REM Dot product +110 DECLARE EXTERNAL FUNCTION DotProduct +120 OPTION BASE 0 +130 DIM Zero3D(2), X(2), Y(2), Z(2), Q(2), R(2) ! some example vectors +140 LET Zero3D(0) = 0 +150 LET Zero3D(1) = 0 +160 LET Zero3D(2) = 0 +170 ! +180 LET X(0) = 1 +190 LET X(1) = 0 +200 LET X(2) = 0 +210 ! +220 LET Y(0) = 0 +230 LET Y(1) = 1 +240 LET Y(2) = 0 +250 ! +260 LET Z(0) = 0 +270 LET Z(1) = 0 +280 LET Z(2) = 1 +290 ! +300 LET Q(0) = 1 +310 LET Q(1) = 1 +320 LET Q(2) = 3.14159 +330 ! +340 LET R(0) = -1 +350 LET R(1) = 2.618033989 +360 LET R(2) = 3 +370 ! +380 PRINT " Q dot R ="; DotProduct(Q, R) +390 PRINT " Zero3D dot X ="; DotProduct(Zero3D, X) +400 PRINT " Z dot Z ="; DotProduct(Z, Z) +410 PRINT " Y dot Z ="; DotProduct(Y, Z) +420 END +430 ! +440 EXTERNAL FUNCTION DotProduct(A(), B()) +450 IF UBOUND(A) <> UBOUND(B) THEN +460 PRINT "Sizes of arrays should be equal." +470 STOP +480 END IF +490 LET DP = 0 +500 FOR I = 0 TO UBOUND(A) +510 LET DP = DP + (A(I) * B(I)) +520 NEXT I +530 LET DotProduct = DP +540 END FUNCTION diff --git a/Task/Dot-product/Ada/dot-product.ada b/Task/Dot-product/Ada/dot-product.adb similarity index 100% rename from Task/Dot-product/Ada/dot-product.ada rename to Task/Dot-product/Ada/dot-product.adb diff --git a/Task/Dot-product/Amazing-Hopper/dot-product-1.hopper b/Task/Dot-product/Amazing-Hopper/dot-product-1.hopper new file mode 100644 index 0000000000..be8a685bb6 --- /dev/null +++ b/Task/Dot-product/Amazing-Hopper/dot-product-1.hopper @@ -0,0 +1,6 @@ +#include + +principal { + imprimir(producto punto( lst'1,3,(-5)', lst'4,(-2),(-1)' ),NL) + terminar +} diff --git a/Task/Dot-product/Amazing-Hopper/dot-product-2.hopper b/Task/Dot-product/Amazing-Hopper/dot-product-2.hopper new file mode 100644 index 0000000000..f7dd1a53ab --- /dev/null +++ b/Task/Dot-product/Amazing-Hopper/dot-product-2.hopper @@ -0,0 +1,16 @@ +#define maincode main: {1}do +#define this {1}do +#defn out {"\n"}print +#define dotp mul;stats(0) +#defn lst(*) {"\033"} *;mklist; +#define ready {0}return +#define decim _X_DECIM=0, mov(_X_DECIM),prec(_X_DECIM),{1}do + +main code{ + {0}decim{ + "A.B = " + this{ + lst (1,3,(-5)), lst (4,(-2),(-1)) + } dotp + } out +} ready diff --git a/Task/Dot-product/Amazing-Hopper/dot-product-3.hopper b/Task/Dot-product/Amazing-Hopper/dot-product-3.hopper new file mode 100644 index 0000000000..27ecdcd5b3 --- /dev/null +++ b/Task/Dot-product/Amazing-Hopper/dot-product-3.hopper @@ -0,0 +1,6 @@ +#defn dotp(_X_,_Y_) #ATOM#CMPLX;#ATOM#CMPLX; mul; stats(0) +#defn lst(*) {"\033"} *;mklist; +#defn out(*) *;{"\n"}print +#defn code(*) main:; *; {"0"};return + +code( out( dotp( lst (1,3,(-5)), lst (4,(-2),(-1)) ) ) ) diff --git a/Task/Dot-product/Apple/dot-product.apple b/Task/Dot-product/Apple/dot-product.apple new file mode 100644 index 0000000000..8f7bb17fb2 --- /dev/null +++ b/Task/Dot-product/Apple/dot-product.apple @@ -0,0 +1 @@ +[(+)/(*)`(x::Vec n float) y] ⟨1,3,_5⟩ ⟨4,_2,_1::float⟩ diff --git a/Task/Dot-product/ArkScript/dot-product.ark b/Task/Dot-product/ArkScript/dot-product.ark new file mode 100644 index 0000000000..f59407ce57 --- /dev/null +++ b/Task/Dot-product/ArkScript/dot-product.ark @@ -0,0 +1,12 @@ +(let dotProduct (fun (v1 v2) { + (assert (= (len v1) (len v2)) "vectors should have the same length") + + (mut result 0) + (mut i 0) + (while (< i (len v1)) { + (set result (+ result (* (@ v1 i) (@ v2 i)))) + (set i (+ 1 i)) }) + + result })) + +(print (dotProduct [1 3 -5] [4 -2 -1])) diff --git a/Task/Dot-product/Ballerina/dot-product.ballerina b/Task/Dot-product/Ballerina/dot-product.ballerina new file mode 100644 index 0000000000..230674a31a --- /dev/null +++ b/Task/Dot-product/Ballerina/dot-product.ballerina @@ -0,0 +1,13 @@ +import ballerina/io; + +function dot(float[] a, float[] b) returns float { + float sum = 0.0; + foreach any[] [idx, val] in a.enumerate() { + sum += val * b[idx]; + } + return sum; +} + +public function main() { + io:println(dot([1, 3, -5], [4, -2, -1])); +} diff --git a/Task/Dot-product/C++/dot-product-1.cpp b/Task/Dot-product/C++/dot-product-1.cpp deleted file mode 100644 index cb26a2e3a5..0000000000 --- a/Task/Dot-product/C++/dot-product-1.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main() -{ - int a[] = { 1, 3, -5 }; - int b[] = { 4, -2, -1 }; - - std::cout << std::inner_product(a, a + sizeof(a) / sizeof(a[0]), b, 0) << std::endl; - - return 0; -} diff --git a/Task/Dot-product/C++/dot-product-2.cpp b/Task/Dot-product/C++/dot-product-2.cpp deleted file mode 100644 index 476a7f64a5..0000000000 --- a/Task/Dot-product/C++/dot-product-2.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -int main() -{ - std::valarray xs = {1,3,-5}; - std::valarray ys = {4,-2,-1}; - - double result = (xs * ys).sum(); - - std::cout << result << '\n'; - - return 0; -} diff --git a/Task/Dot-product/C++/dot-product-3.cpp b/Task/Dot-product/C++/dot-product-3.cpp deleted file mode 100644 index 69af05bce8..0000000000 --- a/Task/Dot-product/C++/dot-product-3.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include - -int main() { - std::vector v1 { 1, 3, -5, }; - std::vector v2 { 4, -2, -1, }; - auto dp = std::inner_product(v1.cbegin(), v1.cend(), v2.cbegin(), 0); - std::cout << "dot.product of {1,3,-5} and {4,-2,-1}: " << dp << std::endl; - return 0; -} diff --git a/Task/Dot-product/C++/dot-product.cpp b/Task/Dot-product/C++/dot-product.cpp new file mode 100644 index 0000000000..18d21a5a35 --- /dev/null +++ b/Task/Dot-product/C++/dot-product.cpp @@ -0,0 +1,47 @@ +#include +#include +#include +#include +#include + +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wgnu-alignof-expression" +#endif + +#ifdef _MSC_VER +#define INLINE __force_inline __flatten __declspec(nothrow) __declspec(noalias) inline +#else +#define INLINE __attribute__((always_inline)) __attribute__((flatten)) __attribute__((nothrow)) __attribute__((const)) inline +#endif + +template(N)> +struct alignas((N == N_POW2 ? N_POW2 : 1) * alignof(T)) vec : std::array +{ +}; + +/* n-dimensional dot/scalar product */ +template +INLINE T dot(const vec& a, const vec& b, T dst = (T)0) +{ + #pragma omp simd reduction(+:dst) + for(size_t i = 0; i < N; i++) dst += a[i] * b[i]; + return dst; +} + +int main() +{ + vec a = { 1, 3, -5 }; + vec b = { 4, -2, -1 }; + vec c = { 1, 2, 3, 4 }; + vec,3> d = { a, b, a }; + vec,4> e = { c, c, c, c }; + + printf("dot.product of {1,3,-5} and {4,-2,-1}: %d", dot(a,b)); puts(""); + printf("type align/size"); puts(""); + printf("vec %4zu/%-4zu",alignof(a), sizeof(a)); puts(""); + printf("vec %4zu/%-4zu",alignof(c), sizeof(c)); puts(""); + printf("vec,3> %4zu/%-4zu",alignof(d), sizeof(d)); puts(""); + printf("vec,4> %4zu/%-4zu",alignof(e), sizeof(e)); puts(""); + + exit(EXIT_SUCCESS); +} diff --git a/Task/Dot-product/C/dot-product-1.c b/Task/Dot-product/C/dot-product-1.c new file mode 100644 index 0000000000..e56b20f598 --- /dev/null +++ b/Task/Dot-product/C/dot-product-1.c @@ -0,0 +1,37 @@ +#include "array.h" + +#define dot(a,b,t,n,i) \ +({ \ + static_assert((isarray(a) || isvector(a)), \ + "ERROR: dot - a is not of array or vector type!"); \ + static_assert((isarray(b) || isvector(b)), \ + "ERROR: dot - b is not of array or vector type!"); \ + t _dst = (t)i; \ + size_t len = (size_t)llabs((ssize_t)n); \ + len = MIN(MIN(!isarray(a) ? vec_countof(a) : countof(a), \ + !isarray(b) ? vec_countof(b) : countof(b)), \ + (ssize_t)n>0?len:0); \ + _Pragma("omp simd reduction(+:_dst)") \ + for(size_t j = 0; j < len; j++) \ + _dst += (t)((a)[j]) * (t)((b)[j]); \ + _dst; \ +}) + +typedef double real; + +#define dot3(a,b) dot(a,b,real,3,0) +#define dot4(a,b) dot(a,b,real,4,0) + +#define out_eol puts("") +#define fout_num(stream,prefix,number,suffix) fprintf(stream, "%s%+e%s", prefix, (double)number, suffix) +#define out_num(number) fout_num(stdout,"",number,"") + +int main(int argc, char** argv) +{ + vec(real,3) a = { 1, 3, -5}; + arr(real,3) b = { 4, -2, -1}; + + out_num(dot3(a, b)); out_eol; + + exit(EXIT_SUCCESS); +} diff --git a/Task/Dot-product/C/dot-product-2.c b/Task/Dot-product/C/dot-product-2.c new file mode 100644 index 0000000000..a0b238ba51 --- /dev/null +++ b/Task/Dot-product/C/dot-product-2.c @@ -0,0 +1,78 @@ +/************************************************************************************************* + * C preprocessor macro vector/array types * + * * + * vec(T,N) - padded to bitceil(N) with operators/accessors * + * * + * arr(T,N) - alignas((N == bitceil(N) ? N : 1) * alignof(T)) * + * * + * vla(T) - flexible/variable length default alignment * + * * + * CFLAGS=" * + * -march=native * + * -O3 * + * -std=23 * + * -mfpmath= * + * -ftree-vectorize * + * -fopenmp * + * -fopenmp-simd" * + * * + * For MSVC see: https://learn.microsoft.com/en-us/cpp/parallel/openmp/openmp-simd?view=msvc-180 * + *************************************************************************************************/ +#pragma once +#include +#include +#include +#include +#include +#include +#include + +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wgnu-alignof-expression" +#endif + +#ifdef _MSC_VER +#define INLINE __force_inline __flatten __declspec(nothrow) __declspec(noalias) inline +#else +#define INLINE __attribute__((always_inline,flatten,nothrow,const)) inline +#endif + +#define BITOP_RUP01__(x) ( (x) | ( (x) >> 1)) +#define BITOP_RUP02__(x) (BITOP_RUP01__(x) | (BITOP_RUP01__(x) >> 2)) +#define BITOP_RUP04__(x) (BITOP_RUP02__(x) | (BITOP_RUP02__(x) >> 4)) +#define BITOP_RUP08__(x) (BITOP_RUP04__(x) | (BITOP_RUP04__(x) >> 8)) +#define BITOP_RUP16__(x) (BITOP_RUP08__(x) | (BITOP_RUP08__(x) >> 16)) + +#define bitceil(x) (const uint32_t)(BITOP_RUP16__(((uint32_t)(x)) - 1) + 1) + +/* arr(T,N) aligned array type */ +#define arr(t,n) alignas((n == bitceil(n) ? n : 1) * alignof(t)) typeof(t[n]) +#define countof(a) sizeof((a))/sizeof(typeof((a)[0])) +#define isarray(a) __builtin_choose_expr(__builtin_types_compatible_p(typeof((a)[0]) [], typeof((a))), true, false) + +#define rc_arr(src,n) (*(arr(typeof((src)[0]),n)*)&src) +#define rc_vec(src,n) (*(vec(typeof((src)[0]),n)*)&src) + +/* vec(T,N) for LLVM SIMD Vector Extension */ +#if defined(__clang__) +#define vec(T,N) typeof(T __attribute__((ext_vector_type(N)))) +#define vec_countof(a) __builtin_vectorelements(rc_vec(a,countof(a))) +#define isvector(a) !isarray(a) && \ +__builtin_choose_expr( \ +bitceil(vec_countof(a)) == countof(a),true,false) + +/* vec(T,N) for GCC SIMD Vector Extension */ +#elif defined(__GNUC__) +#define vec(T,N) typeof(T __attribute__((vector_size(bitceil(N) * alignof(T))))) +#define vec_countof(a) countof(a) +#define isvector(a) !isarray(a) && \ +_Generic(__builtin_convertvector(rc_vec(a,vec_countof(a)), \ + vec(float,bitceil(vec_countof(a)))), \ + vec(float,bitceil(vec_countof(a))): true, \ + default: false) +/* vec_ext(T,N) for other compilers */ +#else +#define vec(T,N) arr(T,N) +#warn "Your compiler doens't support vector extensions." +#warn "Using aligned arrays without operators instead." +#endif diff --git a/Task/Dot-product/C/dot-product.c b/Task/Dot-product/C/dot-product.c deleted file mode 100644 index 4825c675e3..0000000000 --- a/Task/Dot-product/C/dot-product.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include - -int dot_product(int *, int *, size_t); - -int -main(void) -{ - int a[3] = {1, 3, -5}; - int b[3] = {4, -2, -1}; - - printf("%d\n", dot_product(a, b, sizeof(a) / sizeof(a[0]))); - - return EXIT_SUCCESS; -} - -int -dot_product(int *a, int *b, size_t n) -{ - int sum = 0; - size_t i; - - for (i = 0; i < n; i++) { - sum += a[i] * b[i]; - } - - return sum; -} diff --git a/Task/Dot-product/Crystal/dot-product.crystal b/Task/Dot-product/Crystal/dot-product.cr similarity index 100% rename from Task/Dot-product/Crystal/dot-product.crystal rename to Task/Dot-product/Crystal/dot-product.cr diff --git a/Task/Dot-product/Delphi/dot-product.delphi b/Task/Dot-product/Delphi/dot-product.pas similarity index 100% rename from Task/Dot-product/Delphi/dot-product.delphi rename to Task/Dot-product/Delphi/dot-product.pas diff --git a/Task/Dot-product/DuckDB/dot-product-1.duckdb b/Task/Dot-product/DuckDB/dot-product-1.duckdb new file mode 100644 index 0000000000..d7683fd5f7 --- /dev/null +++ b/Task/Dot-product/DuckDB/dot-product-1.duckdb @@ -0,0 +1 @@ +select list_dot_product( [1, 3, -5], [4, -2, -1]); diff --git a/Task/Dot-product/DuckDB/dot-product-2.duckdb b/Task/Dot-product/DuckDB/dot-product-2.duckdb new file mode 100644 index 0000000000..ac8ab5ae33 --- /dev/null +++ b/Task/Dot-product/DuckDB/dot-product-2.duckdb @@ -0,0 +1,3 @@ +SELECT sum(A.N*B.N) as '.' +FROM A JOIN B +ON A.rowid=B.rowid; diff --git a/Task/Dot-product/DuckDB/dot-product-3.duckdb b/Task/Dot-product/DuckDB/dot-product-3.duckdb new file mode 100644 index 0000000000..ecbeac52c6 --- /dev/null +++ b/Task/Dot-product/DuckDB/dot-product-3.duckdb @@ -0,0 +1,7 @@ +CREATE OR REPLACE TABLE A AS + SELECT rowid, N + FROM (select [1, 3, -5] as l, unnest(l) as N, generate_subscripts(l, 1) AS rowid); + +CREATE OR REPLACE TABLE B AS + SELECT rowid, N + FROM (select [4, -2, -1] as l, unnest(l) as N, generate_subscripts(l, 1) AS rowid); diff --git a/Task/Dot-product/DuckDB/dot-product-4.duckdb b/Task/Dot-product/DuckDB/dot-product-4.duckdb new file mode 100644 index 0000000000..31a7b61cad --- /dev/null +++ b/Task/Dot-product/DuckDB/dot-product-4.duckdb @@ -0,0 +1,13 @@ +# Define innerProduct/2 as a scalar function; +# the names of the columns are however fixed. +create or replace function innerProduct(TableA, TableB) as ( + (select * from + (with + AT as (from query_table(TableA)), + BT as (from query_table(TableB)) + select sum(AT.N * BT.N) + from AT join BT + on AT.rowid=BT.rowid ) +)); + +select innerProduct('A', 'B'); diff --git a/Task/Dot-product/Elena/dot-product.elena b/Task/Dot-product/Elena/dot-product.elena index c705cf4014..33f37c0614 100644 --- a/Task/Dot-product/Elena/dot-product.elena +++ b/Task/Dot-product/Elena/dot-product.elena @@ -7,7 +7,7 @@ extension op = self.zipBy(array, (x,y => x * y)).summarize(); } -public program() +public Program() { - console.printLine(new int[]{1, 3, -5}.dotProduct(new int[]{4, -2, -1})) + Console.printLine(new int[]{1, 3, -5}.dotProduct(new int[]{4, -2, -1})) } diff --git a/Task/Dot-product/Elixir/dot-product.elixir b/Task/Dot-product/Elixir/dot-product.ex similarity index 100% rename from Task/Dot-product/Elixir/dot-product.elixir rename to Task/Dot-product/Elixir/dot-product.ex diff --git a/Task/Dot-product/Emacs-Lisp/dot-product.l b/Task/Dot-product/Emacs-Lisp/dot-product.el similarity index 100% rename from Task/Dot-product/Emacs-Lisp/dot-product.l rename to Task/Dot-product/Emacs-Lisp/dot-product.el diff --git a/Task/Dot-product/Euphoria/dot-product-1.euphoria b/Task/Dot-product/Euphoria/dot-product-1.eu similarity index 100% rename from Task/Dot-product/Euphoria/dot-product-1.euphoria rename to Task/Dot-product/Euphoria/dot-product-1.eu diff --git a/Task/Dot-product/Euphoria/dot-product-2.euphoria b/Task/Dot-product/Euphoria/dot-product-2.eu similarity index 100% rename from Task/Dot-product/Euphoria/dot-product-2.euphoria rename to Task/Dot-product/Euphoria/dot-product-2.eu diff --git a/Task/Dot-product/Fennel/dot-product.fennel b/Task/Dot-product/Fennel/dot-product.fennel new file mode 100644 index 0000000000..adc1d7ecd1 --- /dev/null +++ b/Task/Dot-product/Fennel/dot-product.fennel @@ -0,0 +1,11 @@ +(fn dotProduct [v1 v2] + (assert (= (length v1) (length v2)) "vectors should have the same length") + + (var result 0) + (for [i 1 (length v1)] + (set result (+ result (* (. v1 i) (. v2 i)))) + ) + result +) + +(print (dotProduct [1 3 -5] [4 -2 -1])) diff --git a/Task/Dot-product/Gleam/dot-product.gleam b/Task/Dot-product/Gleam/dot-product.gleam new file mode 100644 index 0000000000..646cd40690 --- /dev/null +++ b/Task/Dot-product/Gleam/dot-product.gleam @@ -0,0 +1,18 @@ +pub fn main() { + let _ = echo dot_product([1, 3, -5], [4, -2, -1]) + let _ = echo dot_product([1, 3, -5], [4, -2]) +} + +pub fn dot_product(u: List(Int), v: List(Int)) -> Result(Int, String) { + dot_product_loop(u, v, 0) +} + +fn dot_product_loop(u: List(Int), v: List(Int), sum: Int) -> Result(Int, String) { + case u, v { + [], [_, ..] -> Error("Inputs must have the same length.") + [_, ..], [] -> Error("Inputs must have the same length.") + [x, ..rest_u], [y, ..rest_v] -> + dot_product_loop(rest_u, rest_v, x * y + sum) + [], [] -> Ok(sum) + } +} diff --git a/Task/Dot-product/Julia/dot-product.julia b/Task/Dot-product/Julia/dot-product.jl similarity index 100% rename from Task/Dot-product/Julia/dot-product.julia rename to Task/Dot-product/Julia/dot-product.jl diff --git a/Task/Dot-product/Kotlin/dot-product.kotlin b/Task/Dot-product/Kotlin/dot-product.kts similarity index 100% rename from Task/Dot-product/Kotlin/dot-product.kotlin rename to Task/Dot-product/Kotlin/dot-product.kts diff --git a/Task/Dot-product/LFE/dot-product.lfe b/Task/Dot-product/LFE/dot-product.lfe index 4936a177ac..6208adb21f 100644 --- a/Task/Dot-product/LFE/dot-product.lfe +++ b/Task/Dot-product/LFE/dot-product.lfe @@ -1,3 +1,2 @@ (defun dot-product (a b) - (: lists foldl #'+/2 0 - (: lists zipwith #'*/2 a b))) + (lists:foldl #'+/2 0 (lists:zipwith #'*/2 a b))) diff --git a/Task/Dot-product/LOLCODE/dot-product.lol b/Task/Dot-product/LOLCODE/dot-product.lol new file mode 100644 index 0000000000..97687f6b7d --- /dev/null +++ b/Task/Dot-product/LOLCODE/dot-product.lol @@ -0,0 +1,23 @@ +HAI 1.3 BTW DOT PRODUKT + + OBTW FIND DOT PRODUKT OF AV AN BV + - AV AN BV MUST BE BUKKITS WITH LENGTH AN SRS 0, SRS 1, ... SRS DIFF OF LENGTH AN 1 + BOTH SAEM AV'Z LENGTH AN BV'Z LENGTH MUST BE WIN + TLDR + HOW IZ I DOTTIN YR AV AN YR BV + I HAS A REZULT ITZ 0 + IM IN YR INNERPRODUKT UPPIN YR I TIL BOTH SAEM I AN BIGGR OF I AN AV'Z LENGTH + REZULT R SUM OF REZULT AN PRODUKT OF AV'Z SRS I AN BV'Z SRS I + IM OUTTA YR INNERPRODUKT + FOUND YR REZULT + IF U SAY SO + + BTW MAEK AV AN BV BE 3 ELEMENT VEKTORS + I HAS A AV ITZ A BUKKIT, AV HAS A LENGTH ITZ 3 + AV HAS A SRS 0 ITZ 1, AV HAS A SRS 1 ITZ 3, AV HAS A SRS 2 ITZ -5 + I HAS A BV ITZ A BUKKIT, BV HAS A LENGTH ITZ 3 + BV HAS A SRS 0 ITZ 4, BV HAS A SRS 1 ITZ -2, BV HAS A SRS 2 ITZ -1 + + VISIBLE I IZ DOTTIN YR AV AN YR BV MKAY + +KTHXBYE diff --git a/Task/Dot-product/Loglan82/dot-product.loglan82 b/Task/Dot-product/Loglan82/dot-product.loglan82 new file mode 100644 index 0000000000..58d21b8f35 --- /dev/null +++ b/Task/Dot-product/Loglan82/dot-product.loglan82 @@ -0,0 +1,17 @@ +(* Dot product *) + +block + unit vector: class (x, y, z: real); + end vector; + + unit dot_product: function (u, v: vector) : real; + begin + result := u.x * v.x + u.y * v.y + u.z * v.z + end dot_product; + +var + dp: real; +begin + dp := dot_product(new vector(1.0, 3.0, -5.0), new vector(4.0, -2.0, -1.0)); + writeln(dp) +end diff --git a/Task/Dot-product/Nu/dot-product.nu b/Task/Dot-product/Nu/dot-product.nu new file mode 100644 index 0000000000..655132cc4e --- /dev/null +++ b/Task/Dot-product/Nu/dot-product.nu @@ -0,0 +1,5 @@ +def 'math dot' [v] { + zip $v | each { math product } | math sum +} + +[1 3 -5] | math dot [4 -2 -1] diff --git a/Task/Dot-product/OCaml/dot-product-1.ocaml b/Task/Dot-product/OCaml/dot-product-1.ml similarity index 100% rename from Task/Dot-product/OCaml/dot-product-1.ocaml rename to Task/Dot-product/OCaml/dot-product-1.ml diff --git a/Task/Dot-product/OCaml/dot-product-2.ocaml b/Task/Dot-product/OCaml/dot-product-2.ml similarity index 100% rename from Task/Dot-product/OCaml/dot-product-2.ocaml rename to Task/Dot-product/OCaml/dot-product-2.ml diff --git a/Task/Dot-product/Pascal-P/dot-product.pas b/Task/Dot-product/Pascal-P/dot-product.pas new file mode 100644 index 0000000000..db1cfeb348 --- /dev/null +++ b/Task/Dot-product/Pascal-P/dot-product.pas @@ -0,0 +1,29 @@ +program dotproduct(output); + (* Dot product *) + +const + maxi = 2; + +type + realarray = array [0 .. maxi] of real; + +var + x, y: realarray; + + function dotproduct(a, b: realarray): real; + var + i: integer; + res: real; + begin + res := 0; + for i := 0 to maxi do + res := res + (a[i] * b[i]); + dotproduct := res; + end; + +begin + x[0] := 1; x[1] := 3; x[2] := -5; + y[0] := 4; y[1] := -2; y[2] := -1; + writeln(dotproduct(x, y)); + (* readln; *) +end. diff --git a/Task/Dot-product/PascalABC.NET/dot-product.pas b/Task/Dot-product/PascalABC.NET/dot-product.pas new file mode 100644 index 0000000000..71d0c2418d --- /dev/null +++ b/Task/Dot-product/PascalABC.NET/dot-product.pas @@ -0,0 +1,4 @@ +## +function DotProduct(a, b: array of real) := a.Zip(b, (x, y) -> x * y).Sum; + +DotProduct(|1.0, 3, -5|, |4.0, -2, -1|).println; diff --git a/Task/Dot-product/Perl/dot-product.pl b/Task/Dot-product/Perl/dot-product-1.pl similarity index 100% rename from Task/Dot-product/Perl/dot-product.pl rename to Task/Dot-product/Perl/dot-product-1.pl diff --git a/Task/Dot-product/Perl/dot-product-2.pl b/Task/Dot-product/Perl/dot-product-2.pl new file mode 100644 index 0000000000..3ee16d9b23 --- /dev/null +++ b/Task/Dot-product/Perl/dot-product-2.pl @@ -0,0 +1,12 @@ +#!/usr/bin/perl + +use strict; # https://rosettacode.org/wiki/Dot_product +use warnings; +use List::AllUtils qw( sum zip_by product ); + +sub dotprod { return sum zip_by { product @_ } @_ } + +my @vec_a = (1,3,-5); +my @vec_b = (4,-2,-1); + +print dotprod(\@vec_a, \@vec_b), "\n"; diff --git a/Task/Dot-product/PowerShell/dot-product.psh b/Task/Dot-product/PowerShell/dot-product.ps1 similarity index 100% rename from Task/Dot-product/PowerShell/dot-product.psh rename to Task/Dot-product/PowerShell/dot-product.ps1 diff --git a/Task/Dot-product/REBOL/dot-product.rebol b/Task/Dot-product/REBOL/dot-product.rebol deleted file mode 100644 index a2d960f24d..0000000000 --- a/Task/Dot-product/REBOL/dot-product.rebol +++ /dev/null @@ -1,16 +0,0 @@ -REBOL [] - -a: [1 3 -5] -b: [4 -2 -1] - -dot-product: function [v1 v2] [sum] [ - if (length? v1) != (length? v2) [ - make error! "error: vector sizes must match" - ] - sum: 0 - repeat i length? v1 [ - sum: sum + ((pick v1 i) * (pick v2 i)) - ] -] - -dot-product a b diff --git a/Task/Dot-product/Rebol/dot-product.rebol b/Task/Dot-product/Rebol/dot-product.rebol new file mode 100644 index 0000000000..f8299d6371 --- /dev/null +++ b/Task/Dot-product/Rebol/dot-product.rebol @@ -0,0 +1,16 @@ +Rebol [] +a: [1 3 -5] +b: [4 -2 -1] + +dot-product: func [v1 v2 /local len sum] [ + len: length? v1 + if len <> length? v2 [ + make error! "error: vector sizes must match" + ] + sum: 0 + repeat i len [ + sum: sum + (v1/:i * v2/:i) + ] +] + +dot-product a b diff --git a/Task/Dot-product/Red/dot-product.red b/Task/Dot-product/Red/dot-product.red new file mode 100644 index 0000000000..1996c9335e --- /dev/null +++ b/Task/Dot-product/Red/dot-product.red @@ -0,0 +1,10 @@ +Red [ "Dot product - hinjolicious" ] + +#include %mylib/pipe-map.red +#include %mylib/transpose-zip.Red + +demo "Dot product" [ +a: [1 3 -5] +b: [4 -2 -1] +(reduce [a b]) |> zip ==> [_m/1 * _m/2] |> sum |> probe ; 3 +] diff --git a/Task/Dot-product/Rust/dot-product-1.rust b/Task/Dot-product/Rust/dot-product-1.rs similarity index 100% rename from Task/Dot-product/Rust/dot-product-1.rust rename to Task/Dot-product/Rust/dot-product-1.rs diff --git a/Task/Dot-product/Rust/dot-product-2.rust b/Task/Dot-product/Rust/dot-product-2.rs similarity index 100% rename from Task/Dot-product/Rust/dot-product-2.rust rename to Task/Dot-product/Rust/dot-product-2.rs diff --git a/Task/Dot-product/Rye/dot-product.rye b/Task/Dot-product/Rye/dot-product.rye new file mode 100644 index 0000000000..28deb83a66 --- /dev/null +++ b/Task/Dot-product/Rye/dot-product.rye @@ -0,0 +1 @@ +print dot-product vector { 1 3 -5 } vector { 4 -2 -1 } diff --git a/Task/Dot-product/Scheme/dot-product.ss b/Task/Dot-product/Scheme/dot-product.scm similarity index 100% rename from Task/Dot-product/Scheme/dot-product.ss rename to Task/Dot-product/Scheme/dot-product.scm diff --git a/Task/Dot-product/Uiua/dot-product.uiua b/Task/Dot-product/Uiua/dot-product.uiua new file mode 100644 index 0000000000..f0af9bb367 --- /dev/null +++ b/Task/Dot-product/Uiua/dot-product.uiua @@ -0,0 +1,2 @@ +[4 ¯2 ¯1] [1 3 ¯5] +/+× diff --git a/Task/Dot-product/VBScript/dot-product.vb b/Task/Dot-product/VBScript/dot-product.vbs similarity index 100% rename from Task/Dot-product/VBScript/dot-product.vb rename to Task/Dot-product/VBScript/dot-product.vbs diff --git a/Task/Dot-product/Zig/dot-product.zig b/Task/Dot-product/Zig/dot-product.zig index 82ecb11802..1118520c95 100644 --- a/Task/Dot-product/Zig/dot-product.zig +++ b/Task/Dot-product/Zig/dot-product.zig @@ -1,10 +1,9 @@ const std = @import("std"); -const Vector = std.meta.Vector; pub fn main() !void { - const a: Vector(3, i32) = [_]i32{1, 3, -5}; - const b: Vector(3, i32) = [_]i32{4, -2, -1}; - var dot: i32 = @reduce(.Add, a*b); + const a = @Vector(3, i32){ 1, 3, -5 }; + const b = @Vector(3, i32){ 4, -2, -1 }; + const dot: i32 = @reduce(.Add, a * b); try std.io.getStdOut().writer().print("{d}\n", .{dot}); } diff --git a/Task/Doubly-linked-list-Definition/Delphi/doubly-linked-list-definition.delphi b/Task/Doubly-linked-list-Definition/Delphi/doubly-linked-list-definition.pas similarity index 100% rename from Task/Doubly-linked-list-Definition/Delphi/doubly-linked-list-definition.delphi rename to Task/Doubly-linked-list-Definition/Delphi/doubly-linked-list-definition.pas diff --git a/Task/Doubly-linked-list-Definition/FutureBasic/doubly-linked-list-definition.basic b/Task/Doubly-linked-list-Definition/FutureBasic/doubly-linked-list-definition.basic new file mode 100644 index 0000000000..32155d51d0 --- /dev/null +++ b/Task/Doubly-linked-list-Definition/FutureBasic/doubly-linked-list-definition.basic @@ -0,0 +1,67 @@ +begin globals + str255 List(8) //create a new list of strings (List(0) not used +end globals + + +local fn ShowList(title As str255) + //display all elements from list of string + short j + Print title; + For j = 1 to 7 + Print List(j); " "; + Next j + Print "" +End fn + + +/////////// MAIN PROGRAM //////////// + +Dim As str255 item //items to add to the list +Dim As short i,j, c = 0 + +//the list of data that will be added to the list +data: +Data "One", "Two", "Three", "Four", "Five", "Six", "EndOfData" + +Restore +c = 0 +Do + Read item + If item <> "EndOfData" Then List(c) = item + c ++ +Until item = "EndOfData" + +str255 ListTMP(7) + +For j = 1 To 7 + ListTMP(7-j) = List(j) +Next j +For j = 1 To 7 + Swap List(j), ListTMP(j) +Next j +fn ShowList("Insertion at Head: ") + +for i = 1 to 7 : List(i) = "" : next i // clear list +Restore +c = 0 +Do + Read item //: c += 1 + If item <> "EndOfData" Then List(c) = item + c ++ +Until item = "EndOfData" +fn ShowList("Insertion at Tail: ") + +for i = 1 to 7 : List(i) = "" : next i // clear list +Restore +c = 0 +Do + Read item //: c += 1 + If item <> "EndOfData" Then List(c) = item + c ++ +Until item = "EndOfData" + +Swap List(3), List(6) +fn ShowList("Insertion in Middle: ") + + +handleevents diff --git a/Task/Doubly-linked-list-Definition/Julia/doubly-linked-list-definition-1.julia b/Task/Doubly-linked-list-Definition/Julia/doubly-linked-list-definition-1.jl similarity index 100% rename from Task/Doubly-linked-list-Definition/Julia/doubly-linked-list-definition-1.julia rename to Task/Doubly-linked-list-Definition/Julia/doubly-linked-list-definition-1.jl diff --git a/Task/Doubly-linked-list-Definition/Julia/doubly-linked-list-definition-2.julia b/Task/Doubly-linked-list-Definition/Julia/doubly-linked-list-definition-2.jl similarity index 100% rename from Task/Doubly-linked-list-Definition/Julia/doubly-linked-list-definition-2.julia rename to Task/Doubly-linked-list-Definition/Julia/doubly-linked-list-definition-2.jl diff --git a/Task/Doubly-linked-list-Definition/Kotlin/doubly-linked-list-definition.kotlin b/Task/Doubly-linked-list-Definition/Kotlin/doubly-linked-list-definition.kts similarity index 100% rename from Task/Doubly-linked-list-Definition/Kotlin/doubly-linked-list-definition.kotlin rename to Task/Doubly-linked-list-Definition/Kotlin/doubly-linked-list-definition.kts diff --git a/Task/Doubly-linked-list-Definition/PascalABC.NET/doubly-linked-list-definition.pas b/Task/Doubly-linked-list-Definition/PascalABC.NET/doubly-linked-list-definition.pas new file mode 100644 index 0000000000..a97277863b --- /dev/null +++ b/Task/Doubly-linked-list-Definition/PascalABC.NET/doubly-linked-list-definition.pas @@ -0,0 +1,75 @@ +type Node = auto class + data: T; + prev,next: Node; +end; + +type + MyLinkedList = class + first, last: Node; + procedure AddFirst(x: T); + begin + if first = nil then + begin + first := new Node(x,nil,nil); + last := first + end + else + begin + var p := new Node(x,nil,first); + first.prev := p; + first := p; + end; + end; + procedure AddLast(x: T); + begin + if first = nil then + begin + first := new Node(x,nil,nil); + last := first + end + else + begin + var p := new Node(x,last,nil); + last.next := p; + last := p; + end; + end; + procedure AddAfter(p: Node; x: T); + begin + if last = p then + AddLast(x) + else begin + var pp := new Node(x,p,p.next); + p.next := pp; + pp.next.prev := pp; + end + end; + procedure PrintList(); + begin + var p := first; + while p<>nil do + begin + Print(p.data); + p := p.next; + end; + end; + procedure PrintBack(); + begin + var p := last; + while p<>nil do + begin + Print(p.data); + p := p.prev; + end; + end; + end; + +begin + var lst := new MyLinkedList; + lst.AddFirst(2); lst.AddFirst(3); + lst.AddLast(5); + lst.AddAfter(lst.first,555); + lst.PrintList; + Println; + lst.PrintBack; +end. diff --git a/Task/Doubly-linked-list-Definition/Pluto/doubly-linked-list-definition.pluto b/Task/Doubly-linked-list-Definition/Pluto/doubly-linked-list-definition.pluto new file mode 100644 index 0000000000..c165dcf1c8 --- /dev/null +++ b/Task/Doubly-linked-list-Definition/Pluto/doubly-linked-list-definition.pluto @@ -0,0 +1,18 @@ +require "list" + +local d = dlist.of("A", "B") +print(d) +-- Add an element at the head. +d:prepend("C") +-- Add an element in the middle. +d:insert(2, "D") +-- Add an element at the tail. +d:push("E") +print(d) + +-- Remove an element by index (indexing is 1 based). +d:remove(2) +print(d) +-- Remove an element by value. +d:erase("A") +print(d) diff --git a/Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-1.psh b/Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-1.ps1 similarity index 100% rename from Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-1.psh rename to Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-1.ps1 diff --git a/Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-2.psh b/Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-2.ps1 similarity index 100% rename from Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-2.psh rename to Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-2.ps1 diff --git a/Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-3.psh b/Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-3.ps1 similarity index 100% rename from Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-3.psh rename to Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-3.ps1 diff --git a/Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-4.psh b/Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-4.ps1 similarity index 100% rename from Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-4.psh rename to Task/Doubly-linked-list-Definition/PowerShell/doubly-linked-list-definition-4.ps1 diff --git a/Task/Doubly-linked-list-Definition/RISC-V-Assembly/doubly-linked-list-definition.asm b/Task/Doubly-linked-list-Definition/RISC-V-Assembly/doubly-linked-list-definition.asm new file mode 100644 index 0000000000..e3c89ff6db --- /dev/null +++ b/Task/Doubly-linked-list-Definition/RISC-V-Assembly/doubly-linked-list-definition.asm @@ -0,0 +1,347 @@ +# riscv assembly raspberry pico2 rp2350 +# program dbllinkedlist.s +# connexion putty com3 +/*********************************************/ +/* CONSTANTES */ +/********************************************/ +/* for this file see risc-v task include a file */ +.include "../../../constantesRiscv.inc" +.equ HEAPSIZE, 50000 +/****************************************************/ +/* MACROS */ +/****************************************************/ +#.include "../ficmacrosriscv.inc" # only for debugging + +/*******************************************/ +/* STRUCTURE */ +/*******************************************/ +/* structure Doublylinkedlist*/ + .struct 0 +dllist_head: # head node + .struct dllist_head + 4 +dllist_tail: # tail node + .struct dllist_tail + 4 +dllist_end: +/* structure Node Doublylinked List*/ + .struct 0 +NDlist_next: # next element + .struct NDlist_next + 4 +NDlist_prev: # previous element + .struct NDlist_prev + 4 +NDlist_value: # element value or key + .struct NDlist_value + 4 +NDlist_end: +/*******************************************/ +/* INITIALED DATAS */ +/*******************************************/ +.data +szMessStart: .asciz "Program riscv start.\r\n" +szMessEndOk: .asciz "Program riscv end OK.\r\n" +szCariageReturn: .asciz "\r\n" + +szMessInitListe: .asciz "List initialized.\n" +szMessErreur: .asciz "Error detected.\n" +szMessResult: .asciz "Element No :" +szMessResultValue: .asciz " value : " +szMessInverse: .asciz "\nList inverse : \n" +.align 2 +ptHeapReserve: .int heapReserve +/*******************************************/ +/* UNINITIALED DATA */ +/*******************************************/ +.bss +sConvArea: .skip 24 +.align 2 +dlList1: .skip dllist_end # list memory place +heapReserve: .skip HEAPSIZE + +/**********************************************/ +/* SECTION CODE */ +/**********************************************/ +.text +.global main + +main: + call stdio_init_all # général init +1: # start loop connexion + li a0,0 # raz argument register + call tud_cdc_n_connected # waiting for USB connection + beqz a0,1b # return code = zero ? yes -> loop + + la a0,szMessStart # message address + call writeString # display message + + la a0,dlList1 + call newDList # create new list + la a0,szMessInitListe + call writeString + + + + la a0,dlList1 # list address + li a1,5000 # value to insert + call insertTail # insertion at head + bgez a0,2f # error ? + la a0,szMessErreur + call writeString + j 10f +2: + la a0,dlList1 # list address + li a1,42 # value to insert + call insertHead # insertion at head + bgez a0,3f # error ? + la a0,szMessErreur + call writeString + j 10f + +3: + la a0,dlList1 # list address + li a1,42 # search value + li a2,1234567 # value to insert + call insertAfter # insertion after node contains search value + bgez a0,4f # error ? + la a0,szMessErreur + call writeString + j 10f +4: + + la s0,dlList1 # list address + lw s0,dllist_head(s0) + beqz s0,10f # empty list + li s1,1 # n0 element +5: + lw s2,NDlist_value(s0) # load pointer + #beqz s2,10f # end list ? + la a0,szMessResult + call writeString + mv a0,s1 # conversion and display N° element + la a1,sConvArea + call conversion10 + la a0,sConvArea + call writeString + + la a0,szMessResultValue + call writeString + mv a0,s2 # conversion and display value element + la a1,sConvArea + call conversion10 + la a0,sConvArea + call writeString + la a0,szCariageReturn + call writeString + addi s1,s1,1 + lw s0,NDlist_next(s0) # load next pointer + bnez s0,5b # not null pointer -> loop + + la a0,szMessInverse + call writeString + la s0,dlList1 # list address + lw s0,dllist_tail(s0) + beqz s0,10f # empty list + li s1,1 # n0 element +6: + lw s2,NDlist_value(s0) # load pointer + #beqz s2,10f # end list ? + la a0,szMessResult + call writeString + mv a0,s1 # conversion and display N° element + la a1,sConvArea + call conversion10 + la a0,sConvArea + call writeString + + la a0,szMessResultValue + call writeString + mv a0,s2 # conversion and display value element + la a1,sConvArea + call conversion10 + la a0,sConvArea + call writeString + la a0,szCariageReturn + call writeString + addi s1,s1,1 + lw s0,NDlist_prev(s0) # load next pointer + bnez s0,6b # not null pointer -> loop + +10: + la a0,szMessEndOk # message address + call writeString # display message + call getchar +100: # final loop + j 100b + +/**********************************************/ +/* create new double linked list */ +/**********************************************/ +/* a0 linked list address */ +newDList: # INFO: newDList + addi sp, sp, -4 + sw ra, 0(sp) + + sw x0,dllist_tail(a0) # raz pointer + sw x0,dllist_head(a0) # raz pointer + + lw ra, 0(sp) + addi sp, sp, 4 + ret +/**********************************************/ +/* insertion value in head */ +/**********************************************/ +/* a0 double linked list address */ +/* a1 contains the value of element */ +/* a0 returns address of element or - 1 if error */ +insertHead: # INFO: insertTail + addi sp, sp, -8 + sw ra, 0(sp) + sw s0, 4(sp) + mv s0,a0 # save address + mv a0,a1 # value + call createNode # create new node + bltz a0,100f # error ? + + lw t0,dllist_head(s0) # load address first node + sw t0,NDlist_next(a0) # store in next pointer on new node + sw x0,NDlist_prev(a0) # store null on prev pointer + sw a0,dllist_head(s0) # store address new node on list head + beqz t0,1f # address last node is null ? + sw a0,NDlist_prev(t0) # no store address new node in next pointer + j 2f +1: + sw a0,dllist_tail(s0) # else store in head list +2: + +100: + lw ra, 0(sp) + lw s0, 4(sp) + addi sp, sp, 8 + ret + +/**********************************************/ +/* insertion value in Tail */ +/**********************************************/ +/* a0 double linked list address */ +/* a1 contains the value of element */ +/* a0 returns address of element or - 1 if error */ +insertTail: # INFO: insertTail + addi sp, sp, -8 + sw ra, 0(sp) + sw s0, 4(sp) + mv s0,a0 # save address + mv a0,a1 # value + call createNode # create new node + bltz a0,100f # error ? + + lw t0,dllist_tail(s0) # load address last node + sw t0,NDlist_prev(a0) # store in previous pointer on new node + sw x0,NDlist_next(a0) # store null un next pointer + sw a0,dllist_tail(s0) # store address new node on list tail + beqz t0,1f # address last node is null ? + sw a0,NDlist_next(t0) # no store address new node in next pointer + j 2f +1: + sw a0,dllist_head(s0) # else store in head list +2: + +100: + lw ra, 0(sp) + lw s0, 4(sp) + addi sp, sp, 8 + ret +/**********************************************/ +/* insertion value in after search value */ +/**********************************************/ +/* a0 double linked list address */ +/* a1 contains the search value after that insert */ +/* a2 contains the value of element */ +/* a0 returns address of element or - 1 if error */ +insertAfter: # INFO: insertAfter + addi sp, sp, -12 + sw ra, 0(sp) + sw s0, 4(sp) + sw s1, 8(sp) + mv s0,a0 # save address + call searchValue + bltz a0,100f # error ? + mv s1,a0 # save address find node + mv a0,a2 # value + call createNode # create new node + bltz a0,100f # error ? + + lw t0,NDlist_next(s1) # load pointer next of find node + sw a0,NDlist_next(s1) # store new node in pointer next + sw s1,NDlist_prev(a0) # store address find node in previous pointer on new node + sw t0,NDlist_next(a0) # store pointer next of find node on pointer next on new node + + beqz t0,1f # address next node null ? + sw a0,NDlist_prev(t0) # no store address new node in previous pointer + j 2f +1: + sw a0,dllist_tail(s0) # else store in tail list +2: + +100: + lw ra, 0(sp) + lw s0, 4(sp) + lw s1, 8(sp) + addi sp, sp, 12 + ret + +/**********************************************/ +/* search value in double linked list */ +/**********************************************/ +/* a0 contains the address of the list structure */ +/* a1 contains the value to search */ +/* a0 return address of node or -1 if not found */ +searchValue: # INFO: searchValue + addi sp, sp, -4 + sw ra, 0(sp) + lw t0,dllist_head(a0) # load first node +1: + bnez t0,2f # equal zero ? + li a0,-1 # yes -> not found -> end + j 100f +2: + lw t1,NDlist_value(t0) # load node value + bne t1,a1,3f # equal search value ? + mv a0,t0 # yes -> end + j 100f +3: + lw t0,NDlist_next(t0) # load address nex node + j 1b # and loop + +100: + lw ra, 0(sp) + addi sp, sp, 4 + ret +/**********************************************/ +/* create node on heap */ +/**********************************************/ +/* a0 value */ +/* a0 return node address or -1 if error */ +createNode: # INFO: createNode + addi sp, sp, -4 + sw ra, 0(sp) + la t0,ptHeapReserve + lw t1,(t0) # free heap address + addi t2,t1,NDlist_end # reserve area on heap + la t3,heapReserve + li t4,HEAPSIZE + add t3,t3,t4 + blt t2,t3,2f + li a0,-1 + j 100f +2: + sw t2,(t0) # save new value heap used + sw a0,NDlist_value(t1) # store value on heap + sw x0,NDlist_next(t1) # raz pointer next + sw x0,NDlist_prev(t1) # raz pointer previous + mv a0,t1 # return node address +100: + lw ra, 0(sp) + addi sp, sp, 4 + ret +/************************************/ +/* file include Fonctions */ +/***********************************/ +/* for this file see risc-v task include a file */ +.include "../../../includeFunctions.s" diff --git a/Task/Doubly-linked-list-Definition/Raku/doubly-linked-list-definition.raku b/Task/Doubly-linked-list-Definition/Raku/doubly-linked-list-definition.raku index 5ee1919518..ba49db0aee 100644 --- a/Task/Doubly-linked-list-Definition/Raku/doubly-linked-list-definition.raku +++ b/Task/Doubly-linked-list-Definition/Raku/doubly-linked-list-definition.raku @@ -4,29 +4,29 @@ role DLElem[::T] { has T $.payload = T; method pre-insert(T $payload) { - die "Can't insert before beginning" unless $!prev; - my $elem = ::?CLASS.new(:$payload); - $!prev.next = $elem; - $elem.prev = $!prev; - $elem.next = self; - $!prev = $elem; - $elem; + die "Can't insert before beginning" unless $!prev; + my $elem = ::?CLASS.new(:$payload); + $!prev.next = $elem; + $elem.prev = $!prev; + $elem.next = self; + $!prev = $elem; + $elem; } method post-insert(T $payload) { - die "Can't insert after end" unless $!next; - my $elem = ::?CLASS.new(:$payload); - $!next.prev = $elem; - $elem.next = $!next; - $elem.prev = self; - $!next = $elem; - $elem; + die "Can't insert after end" unless $!next; + my $elem = ::?CLASS.new(:$payload); + $!next.prev = $elem; + $elem.next = $!next; + $elem.prev = self; + $!next = $elem; + $elem; } method delete { - die "Can't delete a sentinel" unless $!prev and $!next; - $!next.prev = $!prev; - $!prev.next = $!next; # conveniently returns next element + die "Can't delete a sentinel" unless $!prev and $!next; + $!next.prev = $!prev; + $!prev.next = $!next; # conveniently returns next element } } @@ -35,10 +35,10 @@ role DLList[::DLE] { has DLE $.last; submethod BUILD { - $!first = DLE.new; - $!last = DLE.new; - $!first.next = $!last; - $!last.prev = $!first; + $!first = DLE.new; + $!last = DLE.new; + $!first.next = $!last; + $!last.prev = $!first; } method list { ($!first.next, *.next ...^ !*.next).map: *.payload } diff --git a/Task/Doubly-linked-list-Definition/Rust/doubly-linked-list-definition-1.rs b/Task/Doubly-linked-list-Definition/Rust/doubly-linked-list-definition-1.rs new file mode 100644 index 0000000000..2dbdcfbc18 --- /dev/null +++ b/Task/Doubly-linked-list-Definition/Rust/doubly-linked-list-definition-1.rs @@ -0,0 +1,7 @@ +// We are ommitting the allocator for these examples +pub struct LinkedList { + head: Option>>, + tail: Option>>, + len: usize, + marker: PhantomData>>, // We logically hold an owned pointer to Node +} diff --git a/Task/Doubly-linked-list-Definition/Rust/doubly-linked-list-definition-2.rs b/Task/Doubly-linked-list-Definition/Rust/doubly-linked-list-definition-2.rs new file mode 100644 index 0000000000..c0e18e5933 --- /dev/null +++ b/Task/Doubly-linked-list-Definition/Rust/doubly-linked-list-definition-2.rs @@ -0,0 +1,40 @@ +trait ListExt { + fn insert(&mut self, elt: T, at: usize); +} + +impl ListExt for std::collections::LinkedList { + // The following references the standard library's implementation of `LinkedList::remove` + fn insert(&mut self, elt: T, at: usize) { + let len = self.len(); + assert!( + at <= len, + "The given index must be a valid index after insertion", + ); + + let offset_from_end = len - at; + if at < offset_from_end { + let mut cursor = self.cursor_front_mut(); + for _ in 0..at { + cursor.move_next(); + } + cursor.insert_before(elt); + } else { + let mut cursor = self.cursor_back_mut(); + for _ in 0..offset_from_end { + cursor.move_prev(); + } + cursor.insert_after(elt); + } + } +} + +fn definition() { + use std::collections::LinkedList; + + let mut list = LinkedList::new(); + list.push_back('B'); + list.push_front('A'); + list.insert('C', 1); + + assert_eq!(list, ['A', 'C', 'B'].into()); +} diff --git a/Task/Doubly-linked-list-Definition/Scheme/doubly-linked-list-definition.ss b/Task/Doubly-linked-list-Definition/Scheme/doubly-linked-list-definition.scm similarity index 100% rename from Task/Doubly-linked-list-Definition/Scheme/doubly-linked-list-definition.ss rename to Task/Doubly-linked-list-Definition/Scheme/doubly-linked-list-definition.scm diff --git a/Task/Doubly-linked-list-Definition/Wren/doubly-linked-list-definition.wren b/Task/Doubly-linked-list-Definition/Wren/doubly-linked-list-definition.wren index 6df26a9d51..32cd3ca1e6 100644 --- a/Task/Doubly-linked-list-Definition/Wren/doubly-linked-list-definition.wren +++ b/Task/Doubly-linked-list-Definition/Wren/doubly-linked-list-definition.wren @@ -1,4 +1,4 @@ -import "/llist" for DLinkedList +import "./llist" for DLinkedList var dll = DLinkedList.new() for (i in 1..3) dll.add(i) diff --git a/Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-1.ada b/Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-1.adb similarity index 100% rename from Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-1.ada rename to Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-1.adb diff --git a/Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-2.ada b/Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-2.adb similarity index 100% rename from Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-2.ada rename to Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-2.adb diff --git a/Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-3.ada b/Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-3.adb similarity index 100% rename from Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-3.ada rename to Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-3.adb diff --git a/Task/Doubly-linked-list-Element-definition/Delphi/doubly-linked-list-element-definition.delphi b/Task/Doubly-linked-list-Element-definition/Delphi/doubly-linked-list-element-definition.pas similarity index 100% rename from Task/Doubly-linked-list-Element-definition/Delphi/doubly-linked-list-element-definition.delphi rename to Task/Doubly-linked-list-Element-definition/Delphi/doubly-linked-list-element-definition.pas diff --git a/Task/Doubly-linked-list-Element-definition/Julia/doubly-linked-list-element-definition.julia b/Task/Doubly-linked-list-Element-definition/Julia/doubly-linked-list-element-definition.jl similarity index 100% rename from Task/Doubly-linked-list-Element-definition/Julia/doubly-linked-list-element-definition.julia rename to Task/Doubly-linked-list-Element-definition/Julia/doubly-linked-list-element-definition.jl diff --git a/Task/Doubly-linked-list-Element-definition/Kotlin/doubly-linked-list-element-definition.kotlin b/Task/Doubly-linked-list-Element-definition/Kotlin/doubly-linked-list-element-definition.kts similarity index 100% rename from Task/Doubly-linked-list-Element-definition/Kotlin/doubly-linked-list-element-definition.kotlin rename to Task/Doubly-linked-list-Element-definition/Kotlin/doubly-linked-list-element-definition.kts diff --git a/Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-1.ocaml b/Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-1.ml similarity index 100% rename from Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-1.ocaml rename to Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-1.ml diff --git a/Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-2.ocaml b/Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-2.ml similarity index 100% rename from Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-2.ocaml rename to Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-2.ml diff --git a/Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-3.ocaml b/Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-3.ml similarity index 100% rename from Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-3.ocaml rename to Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-3.ml diff --git a/Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-4.ocaml b/Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-4.ml similarity index 100% rename from Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-4.ocaml rename to Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-4.ml diff --git a/Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-5.ocaml b/Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-5.ml similarity index 100% rename from Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-5.ocaml rename to Task/Doubly-linked-list-Element-definition/OCaml/doubly-linked-list-element-definition-5.ml diff --git a/Task/Doubly-linked-list-Element-definition/PascalABC.NET/doubly-linked-list-element-definition.pas b/Task/Doubly-linked-list-Element-definition/PascalABC.NET/doubly-linked-list-element-definition.pas new file mode 100644 index 0000000000..41706415b2 --- /dev/null +++ b/Task/Doubly-linked-list-Element-definition/PascalABC.NET/doubly-linked-list-element-definition.pas @@ -0,0 +1,4 @@ +type Node = auto class + data: T; + prev,next: Node; +end; diff --git a/Task/Doubly-linked-list-Element-definition/Pluto/doubly-linked-list-element-definition.pluto b/Task/Doubly-linked-list-Element-definition/Pluto/doubly-linked-list-element-definition.pluto new file mode 100644 index 0000000000..6172bb682a --- /dev/null +++ b/Task/Doubly-linked-list-Element-definition/Pluto/doubly-linked-list-element-definition.pluto @@ -0,0 +1,9 @@ +require "list" + +local s = dlist.of(1, 2, 3) +local n1 = s:node(1) +local n2 = s:node(2) +local n3 = s:node(3) +print($"node 1: value = {n1.value}, next = {tostring(n1.next?.value)}, prev = {tostring(n1.prev?.value)}") +print($"node 2: value = {n2.value}, next = {tostring(n2.next?.value)}, prev = {tostring(n2.prev?.value)}") +print($"node 3: value = {n3.value}, next = {tostring(n3.next?.value)}, prev = {tostring(n3.prev?.value)}") diff --git a/Task/Doubly-linked-list-Element-definition/Rust/doubly-linked-list-element-definition-1.rust b/Task/Doubly-linked-list-Element-definition/Rust/doubly-linked-list-element-definition-1.rust deleted file mode 100644 index 14f822a8eb..0000000000 --- a/Task/Doubly-linked-list-Element-definition/Rust/doubly-linked-list-element-definition-1.rust +++ /dev/null @@ -1,5 +0,0 @@ -use std::collections::LinkedList; -fn main() { - // Doubly linked list containing 32-bit integers - let list = LinkedList::::new(); -} diff --git a/Task/Doubly-linked-list-Element-definition/Rust/doubly-linked-list-element-definition-2.rust b/Task/Doubly-linked-list-Element-definition/Rust/doubly-linked-list-element-definition-2.rust deleted file mode 100644 index f05fe72380..0000000000 --- a/Task/Doubly-linked-list-Element-definition/Rust/doubly-linked-list-element-definition-2.rust +++ /dev/null @@ -1,12 +0,0 @@ -pub struct LinkedList { - head: Option>>, - tail: Option>>, - len: usize, - marker: PhantomData>>, // Indicates that we logically own a boxed (owned pointer) Node> -} - -struct Node { - next: Option>>, - prev: Option>>, - element: T, -} diff --git a/Task/Doubly-linked-list-Element-definition/Rust/doubly-linked-list-element-definition.rs b/Task/Doubly-linked-list-Element-definition/Rust/doubly-linked-list-element-definition.rs new file mode 100644 index 0000000000..235ae6bd30 --- /dev/null +++ b/Task/Doubly-linked-list-Element-definition/Rust/doubly-linked-list-element-definition.rs @@ -0,0 +1,5 @@ +struct Node { + next: Option>>, + prev: Option>>, + element: T, +} diff --git a/Task/Doubly-linked-list-Element-definition/Wren/doubly-linked-list-element-definition.wren b/Task/Doubly-linked-list-Element-definition/Wren/doubly-linked-list-element-definition.wren index d31b98b123..d37e9b8592 100644 --- a/Task/Doubly-linked-list-Element-definition/Wren/doubly-linked-list-element-definition.wren +++ b/Task/Doubly-linked-list-Element-definition/Wren/doubly-linked-list-element-definition.wren @@ -1,4 +1,4 @@ -import "/llist" for DNode +import "./llist" for DNode var dn1 = DNode.new(1) var dn2 = DNode.new(2) diff --git a/Task/Doubly-linked-list-Element-insertion/Ada/doubly-linked-list-element-insertion-1.ada b/Task/Doubly-linked-list-Element-insertion/Ada/doubly-linked-list-element-insertion-1.adb similarity index 100% rename from Task/Doubly-linked-list-Element-insertion/Ada/doubly-linked-list-element-insertion-1.ada rename to Task/Doubly-linked-list-Element-insertion/Ada/doubly-linked-list-element-insertion-1.adb diff --git a/Task/Doubly-linked-list-Element-insertion/Ada/doubly-linked-list-element-insertion-2.ada b/Task/Doubly-linked-list-Element-insertion/Ada/doubly-linked-list-element-insertion-2.adb similarity index 100% rename from Task/Doubly-linked-list-Element-insertion/Ada/doubly-linked-list-element-insertion-2.ada rename to Task/Doubly-linked-list-Element-insertion/Ada/doubly-linked-list-element-insertion-2.adb diff --git a/Task/Doubly-linked-list-Element-insertion/Ada/doubly-linked-list-element-insertion-3.ada b/Task/Doubly-linked-list-Element-insertion/Ada/doubly-linked-list-element-insertion-3.adb similarity index 100% rename from Task/Doubly-linked-list-Element-insertion/Ada/doubly-linked-list-element-insertion-3.ada rename to Task/Doubly-linked-list-Element-insertion/Ada/doubly-linked-list-element-insertion-3.adb diff --git a/Task/Doubly-linked-list-Element-insertion/Delphi/doubly-linked-list-element-insertion.delphi b/Task/Doubly-linked-list-Element-insertion/Delphi/doubly-linked-list-element-insertion.pas similarity index 100% rename from Task/Doubly-linked-list-Element-insertion/Delphi/doubly-linked-list-element-insertion.delphi rename to Task/Doubly-linked-list-Element-insertion/Delphi/doubly-linked-list-element-insertion.pas diff --git a/Task/Doubly-linked-list-Element-insertion/Julia/doubly-linked-list-element-insertion.julia b/Task/Doubly-linked-list-Element-insertion/Julia/doubly-linked-list-element-insertion.jl similarity index 100% rename from Task/Doubly-linked-list-Element-insertion/Julia/doubly-linked-list-element-insertion.julia rename to Task/Doubly-linked-list-Element-insertion/Julia/doubly-linked-list-element-insertion.jl diff --git a/Task/Doubly-linked-list-Element-insertion/Kotlin/doubly-linked-list-element-insertion.kotlin b/Task/Doubly-linked-list-Element-insertion/Kotlin/doubly-linked-list-element-insertion.kts similarity index 100% rename from Task/Doubly-linked-list-Element-insertion/Kotlin/doubly-linked-list-element-insertion.kotlin rename to Task/Doubly-linked-list-Element-insertion/Kotlin/doubly-linked-list-element-insertion.kts diff --git a/Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-1.ocaml b/Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-1.ml similarity index 100% rename from Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-1.ocaml rename to Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-1.ml diff --git a/Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-2.ocaml b/Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-2.ml similarity index 100% rename from Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-2.ocaml rename to Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-2.ml diff --git a/Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-3.ocaml b/Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-3.ml similarity index 100% rename from Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-3.ocaml rename to Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-3.ml diff --git a/Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-4.ocaml b/Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-4.ml similarity index 100% rename from Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-4.ocaml rename to Task/Doubly-linked-list-Element-insertion/OCaml/doubly-linked-list-element-insertion-4.ml diff --git a/Task/Doubly-linked-list-Element-insertion/PascalABC.NET/doubly-linked-list-element-insertion.pas b/Task/Doubly-linked-list-Element-insertion/PascalABC.NET/doubly-linked-list-element-insertion.pas new file mode 100644 index 0000000000..3b2f5422ce --- /dev/null +++ b/Task/Doubly-linked-list-Element-insertion/PascalABC.NET/doubly-linked-list-element-insertion.pas @@ -0,0 +1,33 @@ +type Node = auto class + data: T; + prev,next: Node; +end; + +type + MyLinkedList = class + first, last: Node; + procedure AddLast(x: T); + begin + if first = nil then + begin + first := new Node(x,nil,nil); + last := first + end + else + begin + var p := new Node(x,last,nil); + last.next := p; + last := p; + end; + end; + procedure AddAfter(p: Node; x: T); + begin + if last = p then + AddLast(x) + else begin + var pp := new Node(x,p,p.next); + p.next := pp; + pp.prev.next := pp; + end + end; + end; diff --git a/Task/Doubly-linked-list-Element-insertion/Pluto/doubly-linked-list-element-insertion.pluto b/Task/Doubly-linked-list-Element-insertion/Pluto/doubly-linked-list-element-insertion.pluto new file mode 100644 index 0000000000..8b25ea3df0 --- /dev/null +++ b/Task/Doubly-linked-list-Element-insertion/Pluto/doubly-linked-list-element-insertion.pluto @@ -0,0 +1,5 @@ +require "list" + +local dll = dlist.of("A", "B") +dll:insert(2, "C") +print(dll) diff --git a/Task/Doubly-linked-list-Element-insertion/Rust/doubly-linked-list-element-insertion-1.rs b/Task/Doubly-linked-list-Element-insertion/Rust/doubly-linked-list-element-insertion-1.rs new file mode 100644 index 0000000000..3c28daad17 --- /dev/null +++ b/Task/Doubly-linked-list-Element-insertion/Rust/doubly-linked-list-element-insertion-1.rs @@ -0,0 +1,13 @@ +#![feature(linked_list_cursors)] + +pub struct Cursor<'a, T: 'a> { + index: usize, + current: Option>>, + list: &'a LinkedList, +} + +pub struct CursorMut<'a, T: 'a> { + index: usize, + current: Option>>, + list: &'a mut LinkedList, +} diff --git a/Task/Doubly-linked-list-Element-insertion/Rust/doubly-linked-list-element-insertion-1.rust b/Task/Doubly-linked-list-Element-insertion/Rust/doubly-linked-list-element-insertion-1.rust deleted file mode 100644 index 6846a0b845..0000000000 --- a/Task/Doubly-linked-list-Element-insertion/Rust/doubly-linked-list-element-insertion-1.rust +++ /dev/null @@ -1,5 +0,0 @@ -use std::collections::LinkedList; -fn main() { - let mut list = LinkedList::new(); - list.push_front(8); -} diff --git a/Task/Doubly-linked-list-Element-insertion/Rust/doubly-linked-list-element-insertion-2.rs b/Task/Doubly-linked-list-Element-insertion/Rust/doubly-linked-list-element-insertion-2.rs new file mode 100644 index 0000000000..7f29f65ef6 --- /dev/null +++ b/Task/Doubly-linked-list-Element-insertion/Rust/doubly-linked-list-element-insertion-2.rs @@ -0,0 +1,63 @@ +#![feature(linked_list_cursors)] + +trait CursorExt { + fn insert_between(&mut self, l: &T, elt: T, r: &T); + fn rinsert_between(&mut self, l: &T, elt: T, r: &T); +} + +impl CursorExt for std::collections::linked_list::CursorMut<'_, T> { + fn insert_between(&mut self, l: &T, elt: T, r: &T) { + // Pointing at the sentinel, move to head + if self.current().is_none() { + self.move_next(); + } + + let next = |cursor: &mut Self| { + let left = cursor.current()? == a; + let right = cursor.peek_next()? == b; + + Some(left && right) + }; + + while let Some(found) = next(self) { + if found { + self.insert_after(elt); + + return; + } + } + } + + fn rinsert_between(&mut self, l: &T, elt: T, r: &T) { + // Pointing at the sentinel, move to tail + if self.current().is_none() { + self.move_prev(); + } + + let prev = |cursor: &mut Self| { + let left = cursor.peek_prev()? == a; + let right = cursor.current()? == b; + + Some(left && right) + }; + + while let Some(found) = prev(self) { + if found { + self.insert_before(elt); + + return; + } + } + } +} + +fn element_insertion() { + use std::collections::LinkedList; + + let mut list = LinkedList::from(['A', 'B']); + + list.cursor_front_mut().insert_between(&'A', 'C', &'B'); + // list.cursor_back_mut().rinsert_between(&'A', 'C', &'B'); + + assert_eq!(list, ['A', 'C', 'B'].into()); +} diff --git a/Task/Doubly-linked-list-Element-insertion/Rust/doubly-linked-list-element-insertion-2.rust b/Task/Doubly-linked-list-Element-insertion/Rust/doubly-linked-list-element-insertion-2.rust deleted file mode 100644 index 3b478b7869..0000000000 --- a/Task/Doubly-linked-list-Element-insertion/Rust/doubly-linked-list-element-insertion-2.rust +++ /dev/null @@ -1,52 +0,0 @@ -impl Node { - fn new(v: T) -> Node { - Node {value: v, next: None, prev: Rawlink::none()} - } -} - -impl Rawlink { - fn none() -> Self { - Rawlink {p: ptr::null_mut()} - } - - fn some(n: &mut T) -> Rawlink { - Rawlink{p: n} - } -} - -impl<'a, T> From<&'a mut Link> for Rawlink> { - fn from(node: &'a mut Link) -> Self { - match node.as_mut() { - None => Rawlink::none(), - Some(ptr) => Rawlink::some(ptr) - } - } -} - - -fn link_no_prev(mut next: Box>) -> Link { - next.prev = Rawlink::none(); - Some(next) -} - -impl LinkedList { - #[inline] - fn push_front_node(&mut self, mut new_head: Box>) { - match self.list_head { - None => { - self.list_head = link_no_prev(new_head); - self.list_tail = Rawlink::from(&mut self.list_head); - } - Some(ref mut head) => { - new_head.prev = Rawlink::none(); - head.prev = Rawlink::some(&mut *new_head); - mem::swap(head, &mut new_head); - head.next = Some(new_head); - } - } - self.length += 1; - } - pub fn push_front(&mut self, elt: T) { - self.push_front_node(Box::new(Node::new(elt))); - } -} diff --git a/Task/Doubly-linked-list-Element-insertion/Wren/doubly-linked-list-element-insertion.wren b/Task/Doubly-linked-list-Element-insertion/Wren/doubly-linked-list-element-insertion.wren index 26c952f51f..bce2a79146 100644 --- a/Task/Doubly-linked-list-Element-insertion/Wren/doubly-linked-list-element-insertion.wren +++ b/Task/Doubly-linked-list-Element-insertion/Wren/doubly-linked-list-element-insertion.wren @@ -1,4 +1,4 @@ -import "/llist" for DLinkedList +import "./llist" for DLinkedList var dll = DLinkedList.new(["A", "B"]) dll.insertAfter("A", "C") diff --git a/Task/Doubly-linked-list-Traversal/Ada/doubly-linked-list-traversal.ada b/Task/Doubly-linked-list-Traversal/Ada/doubly-linked-list-traversal.adb similarity index 100% rename from Task/Doubly-linked-list-Traversal/Ada/doubly-linked-list-traversal.ada rename to Task/Doubly-linked-list-Traversal/Ada/doubly-linked-list-traversal.adb diff --git a/Task/Doubly-linked-list-Traversal/Delphi/doubly-linked-list-traversal.delphi b/Task/Doubly-linked-list-Traversal/Delphi/doubly-linked-list-traversal.pas similarity index 100% rename from Task/Doubly-linked-list-Traversal/Delphi/doubly-linked-list-traversal.delphi rename to Task/Doubly-linked-list-Traversal/Delphi/doubly-linked-list-traversal.pas diff --git a/Task/Doubly-linked-list-Traversal/Julia/doubly-linked-list-traversal.julia b/Task/Doubly-linked-list-Traversal/Julia/doubly-linked-list-traversal.jl similarity index 100% rename from Task/Doubly-linked-list-Traversal/Julia/doubly-linked-list-traversal.julia rename to Task/Doubly-linked-list-Traversal/Julia/doubly-linked-list-traversal.jl diff --git a/Task/Doubly-linked-list-Traversal/Kotlin/doubly-linked-list-traversal.kotlin b/Task/Doubly-linked-list-Traversal/Kotlin/doubly-linked-list-traversal.kts similarity index 100% rename from Task/Doubly-linked-list-Traversal/Kotlin/doubly-linked-list-traversal.kotlin rename to Task/Doubly-linked-list-Traversal/Kotlin/doubly-linked-list-traversal.kts diff --git a/Task/Doubly-linked-list-Traversal/PascalABC.NET/doubly-linked-list-traversal.pas b/Task/Doubly-linked-list-Traversal/PascalABC.NET/doubly-linked-list-traversal.pas new file mode 100644 index 0000000000..5e67b3187f --- /dev/null +++ b/Task/Doubly-linked-list-Traversal/PascalABC.NET/doubly-linked-list-traversal.pas @@ -0,0 +1,9 @@ +begin + var lst := new LinkedList(1..10); + var current := lst.First; + while current <> nil do + begin + Print(current.Value); + current := current.Next; + end; +end. diff --git a/Task/Doubly-linked-list-Traversal/Pluto/doubly-linked-list-traversal.pluto b/Task/Doubly-linked-list-Traversal/Pluto/doubly-linked-list-traversal.pluto new file mode 100644 index 0000000000..17ae6ed4d6 --- /dev/null +++ b/Task/Doubly-linked-list-Traversal/Pluto/doubly-linked-list-traversal.pluto @@ -0,0 +1,24 @@ +require "list" +local fmt = require "fmt" + +-- Create a doubly-linked list containing the first 50 positive integers. +local d = dlist.of(range(1, 50):unpack()) + +-- Now traverse from beginning to end and print them in tabular form. +local node = d:node(1) +local count = 0 +while node do + fmt.write("%4d ", node.value) + node = node.next + if ++count % 10 == 0 then print() end +end +print() + +-- Now traverse them in the opposite direction and print then in tabular form. +node = d:node(d:size()) +count = 0 +while node do + fmt.write("%4d ", node.value) + node = node.prev + if ++count % 10 == 0 then print() end +end diff --git a/Task/Doubly-linked-list-Traversal/Rust/doubly-linked-list-traversal.rs b/Task/Doubly-linked-list-Traversal/Rust/doubly-linked-list-traversal.rs new file mode 100644 index 0000000000..05a8db2f1a --- /dev/null +++ b/Task/Doubly-linked-list-Traversal/Rust/doubly-linked-list-traversal.rs @@ -0,0 +1,15 @@ +fn traversal() { + use std::collections::LinkedList; + + let numbers = LinkedList::from([1, 5, 7, 0, 3, 2]); + + for i in &numbers { + print!("{i} "); + } + println!(); + + for i in numbers.iter().rev() { + print!("{i} "); + } + println!(); +} diff --git a/Task/Doubly-linked-list-Traversal/Wren/doubly-linked-list-traversal.wren b/Task/Doubly-linked-list-Traversal/Wren/doubly-linked-list-traversal.wren index 65abc87df2..aec802cb84 100644 --- a/Task/Doubly-linked-list-Traversal/Wren/doubly-linked-list-traversal.wren +++ b/Task/Doubly-linked-list-Traversal/Wren/doubly-linked-list-traversal.wren @@ -1,5 +1,5 @@ -import "/llist" for DLinkedList -import "/fmt" for Fmt +import "./llist" for DLinkedList +import "./fmt" for Fmt // create a new doubly-linked list and add the first 50 positive integers to it var dll = DLinkedList.new(1..50) diff --git a/Task/Dragon-curve/ALGOL-68/dragon-curve-4.alg b/Task/Dragon-curve/ALGOL-68/dragon-curve-4.alg new file mode 100644 index 0000000000..4d180563f7 --- /dev/null +++ b/Task/Dragon-curve/ALGOL-68/dragon-curve-4.alg @@ -0,0 +1,60 @@ +BEGIN # Dragon Curve in SVG # + # uses the RC Algol 68 L-System library for the L-System evaluation & # + # interpretation # + + PR read "lsystem.incl.a68" PR # include L-System utilities # + + PROC dragon curve = ( STRING fname, INT size, length, order, init x, init y )VOID: + IF FILE svg file; + BOOL open error := IF open( svg file, fname, stand out channel ) = 0 + THEN + # opened OK - file already exists and # + # will be overwritten # + FALSE + ELSE + # failed to open the file # + # - try creating a new file # + establish( svg file, fname, stand out channel ) /= 0 + FI; + open error + THEN # failed to open the file # + print( ( "Unable to open ", fname, newline ) ); + stop + ELSE # file opened OK # + + REAL x := init x; + REAL y := init y; + INT angle := 0; + put( svg file, ( "" + , newline, "" + , newline, "", newline, "", newline ) ); + close( svg file ) + FI # dragon curve # ; + + dragon curve( "dragon.svg", 1200, 5, 12, 400, 200 ) + +END diff --git a/Task/Dragon-curve/ASIC/dragon-curve.asic b/Task/Dragon-curve/ASIC/dragon-curve.asic new file mode 100644 index 0000000000..5697f69b99 --- /dev/null +++ b/Task/Dragon-curve/ASIC/dragon-curve.asic @@ -0,0 +1,130 @@ +REM Dragon curve +DIM S@(7) +DIM C@(7) +DIM R(27) +REM SIN, COS in arrays for PI/4 multipl. +DATA 0@, 0.70711@, 1@, 0.70711@, 0@, -0.70711@, -1@, -0.70711@ +DATA 1@, 0.70711@, 0@, -0.70711@, -1@, -0.70711@, 0@, 0.70711@ +Sqrt2@ = 1.41421@ +FOR I = 0 TO 7 + READ S@(I) +NEXT I +FOR I = 0 TO 7 + READ C@(I) +NEXT I +Level = 17 +Insize@ = 256 +REM Insize@ = 2^WHOLE_NUM looks fine +X@ = 224 +Y@ = 124 +RotQPi = 0 +RQ = 1 +SCREEN 9 +GOSUB Dragon: +LOCATE 20, 1 +PRINT "Press any key to exit." +Loop: + X$=INKEY$ + IF X$="" THEN Loop: +SCREEN 0 +END + +Dragon: +RotQPi = RotQPi MOD 8 +WHILE RotQPi < 0 + RotQPi = RotQPi + 8 +WEND +IF Level <= 1 THEN + YN@ = S@(RotQPi) * Insize@ + YN@ = YN@ + Y@ + XN@ = C@(RotQPi) * Insize@ + XN@ = XN@ + X@ + GOSUB DrawLine: + X@ = XN@ + Y@ = YN@ +ELSE + Insize@ = Insize@ * Sqrt2@ + Insize@ = Insize@ / 2@ + RotQPi = RotQPi + RQ + RotQPi = RotQPi MOD 8 + WHILE RotQPi < 0 + RotQPi = RotQPi + 8 + WEND + Level = Level - 1 + R(Level) = RQ + RQ = 1 + GOSUB Dragon: + RLevelM2 = R(Level) * 2 + RotQPi = RotQPi - RLevelM2 + RotQPi = RotQPi MOD 8 + WHILE RotQPi < 0 + RotQPi = RotQPi + 8 + WEND + RQ = -1 + GOSUB Dragon: + RQ = R(Level) + RotQPi = RotQPi + RQ + RotQPi = RotQPi MOD 8 + WHILE RotQPi < 0 + RotQPi = RotQPi + 8 + WEND + Level = Level + 1 + Insize@ = Insize@ * Sqrt2@ +ENDIF +RETURN + +DrawLine: +REM Draw a line from (X@, Y@) to (XN@, YN@) +REM Coordinates decimal, but converted in PSET. +DX@ = XN@ - X@ +DY@ = YN@ - Y@ +AbsDX@ = ABS(DX@) +AbsDY@ = ABS(DY@) +IF AbsDX@ <= AbsDY@ THEN + REM More vertical line + IF AbsDY@ <= 1@ THEN + REM The same pixel or neighboring ones, because AbsDX@ <= AbsDY@ <= 1. + PSET (Y@, X@), 10 + PSET (YN@, XN@), 10 + ELSE + REM There are pixels in between. + A@ = DX@ / DY@ + IF YN@ >= Y@ THEN + D@ = 1@ + ELSE + D@ = -1@ + ENDIF + CoordY@ = Y@ + WHILE CoordY@ <= YN@ + CoordX@ = CoordY@ - Y@ + CoordX@ = A@ * CoordX@ + CoordX@ = X@ + CoordX@ + PSET (CoordY@, CoordX@), 10 + CoordY@ = CoordY@ + D@ + WEND + ENDIF +ELSE + REM More horizontal line + IF AbsDX@ <= 1@ THEN + REM The same pixel or neighboring ones, because AbsDY@ < AbsDX@ <= 1. + PSET (Y@, X@), 10 + PSET (YN@, XN@), 10 + ELSE + REM There are pixels in between. + A@ = DY@ / DX@ + IF XN@ >= X@ THEN + D@ = 1@ + ELSE + D@ = -1@ + ENDIF + CoordX@ = X@ + WHILE CoordX@ <= XN@ + CoordY@ = CoordX@ - X@ + CoordY@ = A@ * CoordY@ + CoordY@ = Y@ + CoordY@ + PSET (CoordY@, CoordX@), 10 + CoordX@ = CoordX@ + D@ + WEND + ENDIF +ENDIF +RETURN diff --git a/Task/Dragon-curve/Ada/dragon-curve-1.ada b/Task/Dragon-curve/Ada/dragon-curve-1.adb similarity index 100% rename from Task/Dragon-curve/Ada/dragon-curve-1.ada rename to Task/Dragon-curve/Ada/dragon-curve-1.adb diff --git a/Task/Dragon-curve/Ada/dragon-curve-2.ada b/Task/Dragon-curve/Ada/dragon-curve-2.adb similarity index 100% rename from Task/Dragon-curve/Ada/dragon-curve-2.ada rename to Task/Dragon-curve/Ada/dragon-curve-2.adb diff --git a/Task/Dragon-curve/Ada/dragon-curve-3.ada b/Task/Dragon-curve/Ada/dragon-curve-3.adb similarity index 100% rename from Task/Dragon-curve/Ada/dragon-curve-3.ada rename to Task/Dragon-curve/Ada/dragon-curve-3.adb diff --git a/Task/Dragon-curve/Ada/dragon-curve-4.ada b/Task/Dragon-curve/Ada/dragon-curve-4.adb similarity index 100% rename from Task/Dragon-curve/Ada/dragon-curve-4.ada rename to Task/Dragon-curve/Ada/dragon-curve-4.adb diff --git a/Task/Dragon-curve/Applesoft-BASIC/dragon-curve.basic b/Task/Dragon-curve/Applesoft-BASIC/dragon-curve.basic new file mode 100644 index 0000000000..b9f8bff709 --- /dev/null +++ b/Task/Dragon-curve/Applesoft-BASIC/dragon-curve.basic @@ -0,0 +1,37 @@ +10 REM Dragon curve +20 DEF FN MOD(M) = M - INT(M / 8) * 8 +30 REM SIN, COS in arrays for PI/4 multipl. +40 DIM S(7), C(7) +50 QPI = ATN(1): SQ = SQR(2) +60 FOR I = 0 TO 7 +70 S(I) = SIN(I * QPI): C(I) = COS(I * QPI) +80 NEXT I +90 LEVEL = 15 +100 INSIZE = 128: REM 2^WHOLE_NUM (looks better) +110 X = 98: Y = 68 +120 ROTQPI = 0: RQ = 1 +130 DIM R(LEVEL) +140 HGR2: HCOLOR = 1 +150 GOSUB 170 +160 END +170 REM ** Dragon +180 ROTQPI = FN MOD8(ROTQPI) +190 IF LEVEL > 1 THEN GOTO 250 +200 YN = S(ROTQPI) * INSIZE + Y +210 XN = C(ROTQPI) * INSIZE + X +220 HPLOT X, Y TO XN, YN +230 X = XN: Y = YN +240 RETURN +250 INSIZE = INSIZE * SQ / 2 +260 ROTQPI = FN MOD8(ROTQPI + RQ) +270 LEVEL = LEVEL - 1 +280 R(LEVEL) = RQ: RQ = 1 +290 GOSUB 170 +300 ROTQPI = FN MOD8(ROTQPI - R(LEVEL) * 2) +310 RQ = -1 +320 GOSUB 170 +330 RQ = R(LEVEL) +340 ROTQPI = FN MOD8(ROTQPI + RQ) +350 LEVEL = LEVEL + 1 +360 INSIZE = INSIZE * SQ +370 RETURN diff --git a/Task/Dragon-curve/BASIC/dragon-curve.basic b/Task/Dragon-curve/BASIC/dragon-curve.basic index 249e1fcd18..7b94fc271c 100644 --- a/Task/Dragon-curve/BASIC/dragon-curve.basic +++ b/Task/Dragon-curve/BASIC/dragon-curve.basic @@ -12,11 +12,11 @@ SUB dragon (length AS Double, split AS Integer, d AS Double) IF split=0 THEN forward length ELSE - turn d*45 - dragon length/1.4142136, split-1, 1 - turn -d*90 - dragon length/1.4142136, split-1, -1 - turn d*45 + turn d*45 + dragon length/1.4142136, split-1, 1 + turn -d*90 + dragon length/1.4142136, split-1, -1 + turn d*45 END IF END SUB diff --git a/Task/Dragon-curve/BASIC256/dragon-curve.basic b/Task/Dragon-curve/BASIC256/dragon-curve.basic index 25b1b0983a..03e75f4098 100644 --- a/Task/Dragon-curve/BASIC256/dragon-curve.basic +++ b/Task/Dragon-curve/BASIC256/dragon-curve.basic @@ -2,15 +2,15 @@ graphsize 390,270 -level = 18 : insize = 247 # initial values -x = 92 : y = 94 # +level = 18 : insize = 247 # initial values +x = 92 : y = 94 # -iters = 2^level # total number of iterations -qiter = 510/iters # constant for computing colors -SQ = sqrt(2) : QPI = pi/4 # constants +iters = 2^level # total number of iterations +qiter = 510/iters # constant for computing colors +SQ = sqrt(2) : QPI = pi/4 # constants -rotation = 0 : iter = 0 : rq = 1.0 # state variables -dim rqs(level) # stack for rq (rotation coefficient) +rotation = 0 : iter = 0 : rq = 1.0 # state variables +dim rqs(level) # stack for rq (rotation coefficient) color white fastgraphics @@ -22,29 +22,29 @@ imgsave "Dragon_curve_BASIC-256.png", "PNG" end dragon: - if level<=0 then - yn = sin(rotation)*insize + y - xn = cos(rotation)*insize + x - if iter*2r += c; p->g += X; return; - case 1: p->r += X; p->g += c; return; - case 2: p->g += c; p->b += X; return; - case 3: p->g += X; p->b += c; return; - case 4: p->r += X; p->b += c; return; - default: - p->r += c; p->b += X; - } + switch((int)h) { + case 0: p->r += c; p->g += X; return; + case 1: p->r += X; p->g += c; return; + case 2: p->g += c; p->b += X; return; + case 3: p->g += X; p->b += c; return; + case 4: p->r += X; p->b += c; return; + default: + p->r += c; p->b += X; + } } /* string rewriting. No need to keep the string itself, just execute @@ -53,16 +53,16 @@ void h_rgb(long long x, long long y) */ void iter_string(const char * str, int d) { - long tmp; -# define LEFT tmp = -dy; dy = dx; dx = tmp -# define RIGHT tmp = dy; dy = -dx; dx = tmp - while (*str != '\0') { - switch(*(str++)) { - case 'X': if (d) iter_string("X+YF+", d - 1); continue; - case 'Y': if (d) iter_string("-FX-Y", d - 1); continue; - case '+': RIGHT; continue; - case '-': LEFT; continue; - case 'F': + long tmp; +# define LEFT tmp = -dy; dy = dx; dx = tmp +# define RIGHT tmp = dy; dy = -dx; dx = tmp + while (*str != '\0') { + switch(*(str++)) { + case 'X': if (d) iter_string("X+YF+", d - 1); continue; + case 'Y': if (d) iter_string("-FX-Y", d - 1); continue; + case '+': RIGHT; continue; + case '-': LEFT; continue; + case 'F': /* draw: increment path length; add color; move. Here * is why the code does not allow user to choose arbitrary * image size: if it's not a power of two, aliasing will @@ -71,59 +71,59 @@ void iter_string(const char * str, int d) * involves computing multiplicative order and would be a huge * bore. */ - clen ++; - h_rgb(x/scale, y/scale); - x += dx; y += dy; - continue; - } - } + clen ++; + h_rgb(x/scale, y/scale); + x += dx; y += dy; + continue; + } + } } void dragon(long leng, int depth) { - long i, d = leng / 3 + 1; - long h = leng + 3, w = leng + d * 3 / 2 + 2; + long i, d = leng / 3 + 1; + long h = leng + 3, w = leng + d * 3 / 2 + 2; - /* allocate pixel buffer */ - rgb *buf = malloc(sizeof(rgb) * w * h); - pix = malloc(sizeof(rgb *) * h); - for (i = 0; i < h; i++) - pix[i] = buf + w * i; - memset(buf, 0, sizeof(rgb) * w * h); + /* allocate pixel buffer */ + rgb *buf = malloc(sizeof(rgb) * w * h); + pix = malloc(sizeof(rgb *) * h); + for (i = 0; i < h; i++) + pix[i] = buf + w * i; + memset(buf, 0, sizeof(rgb) * w * h); /* init coords; scale up to desired; exec string */ - x = y = d; dx = leng; dy = 0; scale = 1; clen = 0; - for (i = 0; i < depth; i++) sc_up(); - iter_string("FX", depth); + x = y = d; dx = leng; dy = 0; scale = 1; clen = 0; + for (i = 0; i < depth; i++) sc_up(); + iter_string("FX", depth); - /* write color PNM file */ - unsigned char *fpix = malloc(w * h * 3); - double maxv = 0, *dbuf = (double*)buf; + /* write color PNM file */ + unsigned char *fpix = malloc(w * h * 3); + double maxv = 0, *dbuf = (double*)buf; /* find highest value among pixels; normalize image according * to it. Highest value would be at points most travelled, so * this ends up giving curve edge a nice fade -- it's more apparaent * if we increase iteration depth by one or two. */ - for (i = 3 * w * h - 1; i >= 0; i--) - if (dbuf[i] > maxv) maxv = dbuf[i]; - for (i = 3 * h * w - 1; i >= 0; i--) - fpix[i] = 255 * dbuf[i] / maxv; + for (i = 3 * w * h - 1; i >= 0; i--) + if (dbuf[i] > maxv) maxv = dbuf[i]; + for (i = 3 * h * w - 1; i >= 0; i--) + fpix[i] = 255 * dbuf[i] / maxv; - printf("P6\n%ld %ld\n255\n", w, h); - fflush(stdout); /* printf and fwrite may treat buffer differently */ - fwrite(fpix, h * w * 3, 1, stdout); + printf("P6\n%ld %ld\n255\n", w, h); + fflush(stdout); /* printf and fwrite may treat buffer differently */ + fwrite(fpix, h * w * 3, 1, stdout); } int main(int c, char ** v) { - int size, depth; + int size, depth; - depth = (c > 1) ? atoi(v[1]) : 10; - size = 1 << depth; + depth = (c > 1) ? atoi(v[1]) : 10; + size = 1 << depth; - fprintf(stderr, "size: %d depth: %d\n", size, depth); - dragon(size, depth * 2); + fprintf(stderr, "size: %d depth: %d\n", size, depth); + dragon(size, depth * 2); - return 0; + return 0; } diff --git a/Task/Dragon-curve/COBOL/dragon-curve.cobol b/Task/Dragon-curve/COBOL/dragon-curve.cob similarity index 100% rename from Task/Dragon-curve/COBOL/dragon-curve.cobol rename to Task/Dragon-curve/COBOL/dragon-curve.cob diff --git a/Task/Dragon-curve/Delphi/dragon-curve.delphi b/Task/Dragon-curve/Delphi/dragon-curve.pas similarity index 100% rename from Task/Dragon-curve/Delphi/dragon-curve.delphi rename to Task/Dragon-curve/Delphi/dragon-curve.pas diff --git a/Task/Dragon-curve/EasyLang/dragon-curve.easy b/Task/Dragon-curve/EasyLang/dragon-curve.easy index 81f64de949..c789f92105 100644 --- a/Task/Dragon-curve/EasyLang/dragon-curve.easy +++ b/Task/Dragon-curve/EasyLang/dragon-curve.easy @@ -1,15 +1,14 @@ -color 050 -linewidth 0.5 +gcolor 050 +glinewidth 0.5 x = 25 y = 60 -move x y angle = 0 # -proc dragon size lev d . . +proc dragon size lev d . if lev = 0 x -= cos angle * size y += sin angle * size - line x y + glineto x y else dragon size / sqrt 2 lev - 1 1 angle -= d * 90 diff --git a/Task/Dragon-curve/Emacs-Lisp/dragon-curve.l b/Task/Dragon-curve/Emacs-Lisp/dragon-curve.el similarity index 100% rename from Task/Dragon-curve/Emacs-Lisp/dragon-curve.l rename to Task/Dragon-curve/Emacs-Lisp/dragon-curve.el diff --git a/Task/Dragon-curve/Haskell/dragon-curve-2.hs b/Task/Dragon-curve/Haskell/dragon-curve-2.hs index 797d72b985..ddb5a8b72a 100644 --- a/Task/Dragon-curve/Haskell/dragon-curve-2.hs +++ b/Task/Dragon-curve/Haskell/dragon-curve-2.hs @@ -4,8 +4,8 @@ y 0 = "" y n = " - f"++(x$n-1)++" -"++(y$n-1) dragon n = - concat ["0 setlinewidth 300 400 moveto", - "/f{2 0 rlineto}def/+{90 rotate}def/-{-90 rotate}def\n", - "f", x n, " stroke showpage"] + concat ["0 setlinewidth 300 400 moveto", + "/f{2 0 rlineto}def/+{90 rotate}def/-{-90 rotate}def\n", + "f", x n, " stroke showpage"] main = putStrLn $ dragon 14 diff --git a/Task/Dragon-curve/Julia/dragon-curve.julia b/Task/Dragon-curve/Julia/dragon-curve.jl similarity index 100% rename from Task/Dragon-curve/Julia/dragon-curve.julia rename to Task/Dragon-curve/Julia/dragon-curve.jl diff --git a/Task/Dragon-curve/Kotlin/dragon-curve.kotlin b/Task/Dragon-curve/Kotlin/dragon-curve.kts similarity index 100% rename from Task/Dragon-curve/Kotlin/dragon-curve.kotlin rename to Task/Dragon-curve/Kotlin/dragon-curve.kts diff --git a/Task/Dragon-curve/Locomotive-Basic/dragon-curve.basic b/Task/Dragon-curve/Locomotive-Basic/dragon-curve.basic new file mode 100644 index 0000000000..6cf4caa101 --- /dev/null +++ b/Task/Dragon-curve/Locomotive-Basic/dragon-curve.basic @@ -0,0 +1,29 @@ +100 MODE 2 +110 DIM s(7),c(7) +120 qpi=ATN(1):sq2=SQR(2) +130 FOR i=0 TO 7 +140 s(i)=SIN(i*qpi) +150 c(i)=COS(i*qpi) +160 NEXT +170 level=11 +180 DIM r(level) +190 insize=128*2 +200 MOVE 200,150 +210 rotqpi=0:rq=1 +220 GOSUB 250 +230 END +240 ' +250 IF level=1 THEN DRAWR c(rotqpi)*insize,s(rotqpi)*insize:RETURN +260 insize=insize*sq2/2 +270 rotqpi=(rotqpi+rq) AND 7 +280 level=level-1 +290 r(level)=rq:rq=1 +300 GOSUB 250 +310 rotqpi=(rotqpi-r(level)*2) AND 7 +320 rq=-1 +330 GOSUB 250 +340 rq=r(level) +350 rotqpi=(rotqpi+rq) AND 7 +360 level=level+1 +370 insize=insize*sq2 +380 RETURN diff --git a/Task/Dragon-curve/Metafont/dragon-curve.metafont b/Task/Dragon-curve/Metafont/dragon-curve.metafont index a2061d786f..446a318703 100644 --- a/Task/Dragon-curve/Metafont/dragon-curve.metafont +++ b/Task/Dragon-curve/Metafont/dragon-curve.metafont @@ -7,10 +7,10 @@ beginchar("D", 25pt#, 25pt#, 0pt#); for i = 1 upto dragoniter: for v = 1 step mstep until (2-mstep): if unknown z[v+mstep]: - pair t; - t := .7071[ z[v], z[v+2mstep] ]; - z[v+mstep] = t rotatedaround(z[v], 45sg); - sg := -1*sg; + pair t; + t := .7071[ z[v], z[v+2mstep] ]; + z[v+mstep] = t rotatedaround(z[v], 45sg); + sg := -1*sg; fi endfor mstep := mstep/2; diff --git a/Task/Dragon-curve/Nascom-BASIC/dragon-curve.basic b/Task/Dragon-curve/Nascom-BASIC/dragon-curve.basic new file mode 100644 index 0000000000..2f42679f86 --- /dev/null +++ b/Task/Dragon-curve/Nascom-BASIC/dragon-curve.basic @@ -0,0 +1,54 @@ +10 REM Dragon curve +20 REM SIN, COS in arrays for PI/4 multipl. +30 DIM S(7), C(7) +40 QPI=ATN(1):SQ=SQR(2) +50 FOR I=0 TO 7 +60 S(I)=SIN(I*QPI):C(I)=COS(I*QPI) +70 NEXT I +80 LEVEL=15 +90 INSIZE=32:REM 2^WHOLE_NUM (looks better) +100 X=34:Y=16 +110 ROTQPI=0:RQ=1 +120 DIM R(LEVEL) +130 CLS +140 GOSUB 160 +150 END +160 REM ** Dragon +170 ROTQPI=ROTQPI AND 7 +180 IF LEVEL>1 THEN GOTO 240 +190 YN=S(ROTQPI)*INSIZE+Y +200 XN=C(ROTQPI)*INSIZE+X +210 GOSUB 370 +220 X=XN:Y=YN +230 RETURN +240 INSIZE=INSIZE*SQ/2 +250 ROTQPI=(ROTQPI+RQ)AND 7 +260 LEVEL=LEVEL-1 +270 R(LEVEL)=RQ:RQ=1 +280 GOSUB 160 +290 ROTQPI=(ROTQPI-R(LEVEL)*2)AND 7 +300 RQ=-1 +310 GOSUB 160 +320 RQ=R(LEVEL) +330 ROTQPI=(ROTQPI+RQ)AND 7 +340 LEVEL=LEVEL+1 +350 INSIZE=INSIZE*SQ +360 RETURN +370 REM ** Draw a line from (X, Y) to (XN, YN) +380 IF ABS(XN-X)>1 OR ABS(YN-Y)>1 THEN 400 +390 SET(X,Y):SET(XN,YN):RETURN +400 IF ABS(XN-X)>ABS(YN-Y) THEN 480 +410 REM More vertical line +420 A=(XN-X)/(YN-Y) +430 IF YN>Y THEN D=1 ELSE D=-1 +440 FOR YC=Y TO YN STEP D +450 SET(X+A*(YC-Y),YC) +460 NEXT YC +470 RETURN +480 REM More horizontal line +490 A=(YN-Y)/(XN-X) +500 IF XN>X THEN D=1 ELSE D=-1 +510 FOR XC=X TO XN STEP D +520 SET(XC,Y+A*(XC-X)) +530 NEXT XC +540 RETURN diff --git a/Task/Dragon-curve/OCaml/dragon-curve-1.ocaml b/Task/Dragon-curve/OCaml/dragon-curve-1.ml similarity index 100% rename from Task/Dragon-curve/OCaml/dragon-curve-1.ocaml rename to Task/Dragon-curve/OCaml/dragon-curve-1.ml diff --git a/Task/Dragon-curve/OCaml/dragon-curve-2.ocaml b/Task/Dragon-curve/OCaml/dragon-curve-2.ml similarity index 100% rename from Task/Dragon-curve/OCaml/dragon-curve-2.ocaml rename to Task/Dragon-curve/OCaml/dragon-curve-2.ml diff --git a/Task/Dragon-curve/PascalABC.NET/dragon-curve.pas b/Task/Dragon-curve/PascalABC.NET/dragon-curve.pas new file mode 100644 index 0000000000..7ac53bfab2 --- /dev/null +++ b/Task/Dragon-curve/PascalABC.NET/dragon-curve.pas @@ -0,0 +1,34 @@ +uses Turtle; + +var + Atom,FStr,XStr,YStr: string; + angle,len,x0,y0: real; + n: integer; + +procedure Init1; // Dragon +begin + (Atom,FStr,XStr,YStr) := ('fx','f','x+yf+','-fx-y'); + (angle,len,n,x0,y0) := (90,3,15,300,450); +end; + +procedure RunStr(s: string; n: integer); +begin + foreach var c in s do + case c of + '+': Turn(angle); + '-': Turn(-angle); + 'f','F': if n>0 then RunStr(FStr,n-1) else Forw(len); + 'x','X': if n>0 then RunStr(XStr,n-1); + 'y','Y': if n>0 then RunStr(YStr,n-1); + else Print('error') + end; +end; + +begin + Init1; + ToPoint(x0,y0); + SetWidth(0.5); + Down; + RunStr(Atom,n); + Up; +end. diff --git a/Task/Dragon-curve/Pluto/dragon-curve.pluto b/Task/Dragon-curve/Pluto/dragon-curve.pluto new file mode 100644 index 0000000000..52840da6b5 --- /dev/null +++ b/Task/Dragon-curve/Pluto/dragon-curve.pluto @@ -0,0 +1,43 @@ +require "bitmap" +require "table2" + +local bmp = bitmap.of(800, 600, color.black, "Dragon curve") + +local function get_sequence(iterations) + local turn_sequence = {} + for _ = 1, iterations do + local copy = {} + copy:join(turn_sequence) + if #copy > 1 then copy:reverse() end + turn_sequence:insert(1) + copy:foreach(|i| -> turn_sequence:insert(-i)) + end + return turn_sequence +end + +local function dragon(turns, starting_angle, side) + local col = pico.blue + local angle = starting_angle + local x1 = 230 + local y1 = 350 + local x2 = x1 + math.trunc(math.cos(angle) * side) + local y2 = y1 + math.trunc(math.sin(angle) * side) + bmp:line(x1, y1, x2, y2, col) + x1 = x2 + y1 = y2 + for turns as turn do + angle += turn * math.pi / 2 + x2 = x1 + math.trunc(math.cos(angle) * side) + y2 = y1 + math.trunc(math.sin(angle) * side) + bmp:line(x1, y1, x2, y2, col) + x1 = x2 + y1 = y2 + end +end + +local iter = 14 +local turns = get_sequence(iter) +local starting_angle = -iter * math.pi / 4 +local side = 400 / (2 ^ (iter / 2)) +dragon(turns, starting_angle, side) +bmp:view() diff --git a/Task/Dragon-curve/Prolog/dragon-curve.pro b/Task/Dragon-curve/Prolog/dragon-curve.pro index cca7a2d174..fa667e6ce7 100644 --- a/Task/Dragon-curve/Prolog/dragon-curve.pro +++ b/Task/Dragon-curve/Prolog/dragon-curve.pro @@ -1,60 +1,60 @@ dragonCurve(N) :- - dcg_dg(N, [left], DCL, []), - Side = 4, - Angle is -N * (pi/4), - dcg_computePath(Side, Angle, DCL, point(180,400), P, []), - new(D, window('Dragon Curve')), - send(D, size, size(800,600)), - new(Path, path(poly)), - send_list(Path, append, P), - send(D, display, Path), - send(D, open). + dcg_dg(N, [left], DCL, []), + Side = 4, + Angle is -N * (pi/4), + dcg_computePath(Side, Angle, DCL, point(180,400), P, []), + new(D, window('Dragon Curve')), + send(D, size, size(800,600)), + new(Path, path(poly)), + send_list(Path, append, P), + send(D, display, Path), + send(D, open). % compute the list of points of the Dragon Curve dcg_computePath(Side, Angle, [left | DCT], point(X1, Y1)) --> - [point(X1, Y1)], - { X2 is X1 + Side * cos(Angle), - Y2 is Y1 + Side * sin(Angle), - Angle1 is Angle + pi / 2 - }, - dcg_computePath(Side, Angle1, DCT, point(X2, Y2)). + [point(X1, Y1)], + { X2 is X1 + Side * cos(Angle), + Y2 is Y1 + Side * sin(Angle), + Angle1 is Angle + pi / 2 + }, + dcg_computePath(Side, Angle1, DCT, point(X2, Y2)). dcg_computePath(Side, Angle, [right | DCT], point(X1, Y1)) --> - [point(X1, Y1)], - { X2 is X1 + Side * cos(Angle), - Y2 is Y1 + Side * sin(Angle), - Angle1 is Angle - pi / 2 - }, - dcg_computePath(Side, Angle1, DCT, point(X2, Y2)). + [point(X1, Y1)], + { X2 is X1 + Side * cos(Angle), + Y2 is Y1 + Side * sin(Angle), + Angle1 is Angle - pi / 2 + }, + dcg_computePath(Side, Angle1, DCT, point(X2, Y2)). dcg_computePath(_Side, _Angle, [], point(X1, Y1)) --> - [ point(X1, Y1)]. + [ point(X1, Y1)]. % compute the list of the "turns" of the Dragon Curve dcg_dg(1, L) --> L. dcg_dg(N, L) --> - {dcg_dg(L, L1, []), - N1 is N - 1}, - dcg_dg(N1, L1). + {dcg_dg(L, L1, []), + N1 is N - 1}, + dcg_dg(N1, L1). % one interation of the process dcg_dg(L) --> - L, - [left], - inverse(L). + L, + [left], + inverse(L). inverse([H | T]) --> - inverse(T), - inverse(H). + inverse(T), + inverse(H). inverse([]) --> []. inverse(left) --> - [right]. + [right]. inverse(right) --> - [left]. + [left]. diff --git a/Task/Dragon-curve/Raku/dragon-curve.raku b/Task/Dragon-curve/Raku/dragon-curve.raku index 65d40f60b8..09ffdd7994 100644 --- a/Task/Dragon-curve/Raku/dragon-curve.raku +++ b/Task/Dragon-curve/Raku/dragon-curve.raku @@ -3,7 +3,7 @@ use SVG; role Lindenmayer { has %.rules; method succ { - self.comb.map( { %!rules{$^c} // $c } ).join but Lindenmayer(%!rules) + self.comb.map( { %!rules{$^c} // $c } ).join but Lindenmayer(%!rules) } } diff --git a/Task/Dragon-curve/Rebol/dragon-curve.rebol b/Task/Dragon-curve/Rebol/dragon-curve.rebol new file mode 100644 index 0000000000..43e3817fca --- /dev/null +++ b/Task/Dragon-curve/Rebol/dragon-curve.rebol @@ -0,0 +1,67 @@ +Rebol [ + title: "Rosetta code: Dragon curve" + file: %Dragon_curve.r3 + url: https://rosettacode.org/wiki/Dragon_curve + needs: 3.0.0 +] + +bit-count: function [n [integer!]] [ + count: 0 + while [n > 0] [ + count: count + (n & 1) ;; add lowest bit + n: n >> 1 ;; logical right-shift by 1 + ] + count +] + +dragon-curve: function [steps [integer!]][ + ;; Initialize state + x: y: minx: maxx: miny: maxy: 0 + data: make map! [] + + ;; Loop for each step + for i 0 steps 1 [ + ;; Convert iteration number to direction using Gray code modulo 4 + dir: (bit-count (i xor (i >> 1))) % 4 + + ;; Compute next coordinates + nx: x + pickz [1 0 -1 0] dir + ny: y + pickz [0 1 0 -1] dir + + ;; Determine outbound/inbound bits + set [ob: ib:] pickz [[8 4] [2 1] [4 8] [1 2]] dir + + ;; Update cell at current position + key-cur: as-pair y x + data/:key-cur: ob or any [data/:key-cur 0] + + ;; Update cell at next position + key-nxt: as-pair ny nx + data/:key-nxt: ib or any [data/:key-nxt 0] + + ;; Update bounding box + minx: min minx nx + maxx: max maxx nx + miny: min miny ny + maxy: max maxy ny + + ;; Advance position + x: nx + y: ny + ] + + ;; Draw the result + chars: " ╵╷│╴┘┐┤╶└┌├─┴┬┼" + for y miny maxy 1 [ + line: clear "" + for x minx maxx 1 [ + key: as-pair y x + val: 1 + any [data/:key 0] + append line chars/:val + ] + print line + ] +] + +;; Draw result: +dragon-curve 511 diff --git a/Task/Dragon-curve/Rust/dragon-curve.rust b/Task/Dragon-curve/Rust/dragon-curve.rs similarity index 100% rename from Task/Dragon-curve/Rust/dragon-curve.rust rename to Task/Dragon-curve/Rust/dragon-curve.rs diff --git a/Task/Dragon-curve/SequenceL/dragon-curve-1.sequencel b/Task/Dragon-curve/SequenceL/dragon-curve-1.sequencel index fe187b5084..e1905a0651 100644 --- a/Task/Dragon-curve/SequenceL/dragon-curve-1.sequencel +++ b/Task/Dragon-curve/SequenceL/dragon-curve-1.sequencel @@ -4,35 +4,35 @@ import ; initPoints := [[0,0],[1,0]]; f1(point(1)) := - let - matrix := [[cos(45 * (pi/180)), -sin(45 * (pi/180))], - [sin(45 * (pi/180)), cos(45 * (pi/180))]]; - in - head(transpose((1/sqrt(2)) * matmul(matrix, transpose([point])))); - + let + matrix := [[cos(45 * (pi/180)), -sin(45 * (pi/180))], + [sin(45 * (pi/180)), cos(45 * (pi/180))]]; + in + head(transpose((1/sqrt(2)) * matmul(matrix, transpose([point])))); + f2(point(1)) := - let - matrix := [[cos(135 * (pi/180)), -sin(135 * (pi/180))], - [sin(135 * (pi/180)), cos(135 * (pi/180))]]; - in - head(transpose((1/sqrt(2)) * matmul(matrix, transpose([point])))) + initPoints[2]; + let + matrix := [[cos(135 * (pi/180)), -sin(135 * (pi/180))], + [sin(135 * (pi/180)), cos(135 * (pi/180))]]; + in + head(transpose((1/sqrt(2)) * matmul(matrix, transpose([point])))) + initPoints[2]; matmul(X(2),Y(2))[i,j] := sum(X[i,all]*Y[all,j]); entry(steps(0), maxX(0), maxY(0)) := - let - scaleX := maxX / 1.5; - scaleY := maxY; - - shiftX := maxX / 3.0 / 1.5; - shiftY := maxY / 3.0; - in - round(run(steps, initPoints) * [scaleX, scaleY] + [shiftX, shiftY]); + let + scaleX := maxX / 1.5; + scaleY := maxY; + + shiftX := maxX / 3.0 / 1.5; + shiftY := maxY / 3.0; + in + round(run(steps, initPoints) * [scaleX, scaleY] + [shiftX, shiftY]); run(steps(0), result(2)) := - let - next := f1(result) ++ f2(result); - in - result when steps <= 0 - else - run(steps - 1, next); + let + next := f1(result) ++ f2(result); + in + result when steps <= 0 + else + run(steps - 1, next); diff --git a/Task/Dragon-curve/SequenceL/dragon-curve-2.sequencel b/Task/Dragon-curve/SequenceL/dragon-curve-2.sequencel index f60e233fdc..aa6cb2eec4 100644 --- a/Task/Dragon-curve/SequenceL/dragon-curve-2.sequencel +++ b/Task/Dragon-curve/SequenceL/dragon-curve-2.sequencel @@ -9,66 +9,66 @@ using namespace std; int main(int argc, char** argv) { - int threads = 0; - if(argc > 1) threads = atoi(argv[1]); - Sequence< Sequence > result; + int threads = 0; + if(argc > 1) threads = atoi(argv[1]); + Sequence< Sequence > result; - sl_init(threads); + sl_init(threads); - int width = 500; - if(argc > 2) width = atoi(argv[2]); - int height = width; - if(argc > 3) height = atoi(argv[3]); + int width = 500; + if(argc > 2) width = atoi(argv[2]); + int height = width; + if(argc > 3) height = atoi(argv[3]); - CImg visu(width, height, 1, 3, 0); - CImgDisplay draw_disp(visu); + CImg visu(width, height, 1, 3, 0); + CImgDisplay draw_disp(visu); - SLTimer compTimer; - SLTimer drawTimer; + SLTimer compTimer; + SLTimer drawTimer; - int steps = 0; - int maxSteps = 18; - if(argc > 4) maxSteps = atoi(argv[4]); - int waitTime = 200; - if(argc > 5) waitTime = atoi(argv[5]); - bool adding = true; - while(!draw_disp.is_closed()) - { - compTimer.start(); - sl_entry(steps, width, height, threads, result); - compTimer.stop(); + int steps = 0; + int maxSteps = 18; + if(argc > 4) maxSteps = atoi(argv[4]); + int waitTime = 200; + if(argc > 5) waitTime = atoi(argv[5]); + bool adding = true; + while(!draw_disp.is_closed()) + { + compTimer.start(); + sl_entry(steps, width, height, threads, result); + compTimer.stop(); - drawTimer.start(); - visu.fill(0); + drawTimer.start(); + visu.fill(0); - double thirdSize = ((result.size() / 2.0) / 3.0); - thirdSize = (int)thirdSize == 0 ? 1 : thirdSize; + double thirdSize = ((result.size() / 2.0) / 3.0); + thirdSize = (int)thirdSize == 0 ? 1 : thirdSize; - for(int i = 1; i <= result.size(); i+=2) - { - unsigned char shade = (unsigned char)(255 * ((((i / 2) % (int)thirdSize) / thirdSize)) + 0.5); + for(int i = 1; i <= result.size(); i+=2) + { + unsigned char shade = (unsigned char)(255 * ((((i / 2) % (int)thirdSize) / thirdSize)) + 0.5); - unsigned char r = i / 2 <= thirdSize ? shade : 255/2; - unsigned char g = thirdSize < i / 2 && i / 2 <= thirdSize * 2 ? shade : 255/2; - unsigned char b = thirdSize * 2 < i / 2 && i / 2 <= thirdSize * 3 ? shade : 255/2; - const unsigned char color[] = {r,g,b}; + unsigned char r = i / 2 <= thirdSize ? shade : 255/2; + unsigned char g = thirdSize < i / 2 && i / 2 <= thirdSize * 2 ? shade : 255/2; + unsigned char b = thirdSize * 2 < i / 2 && i / 2 <= thirdSize * 3 ? shade : 255/2; + const unsigned char color[] = {r,g,b}; - visu.draw_line(result[i][1], result[i][2], 0, result[i + 1][1], result[i + 1][2], 0, color); - } - visu.display(draw_disp); - drawTimer.stop(); + visu.draw_line(result[i][1], result[i][2], 0, result[i + 1][1], result[i + 1][2], 0, color); + } + visu.display(draw_disp); + drawTimer.stop(); - draw_disp.set_title("Dragon Curve in SequenceL: %d Threads | Steps: %d | CompTime: %f Seconds | Draw Time: %f Seconds", threads, steps, drawTimer.getTime(), compTimer.getTime()); + draw_disp.set_title("Dragon Curve in SequenceL: %d Threads | Steps: %d | CompTime: %f Seconds | Draw Time: %f Seconds", threads, steps, drawTimer.getTime(), compTimer.getTime()); - if(adding) steps++; - else steps--; + if(adding) steps++; + else steps--; - if(steps <= 0) adding = true; - else if(steps >= maxSteps) adding = false; + if(steps <= 0) adding = true; + else if(steps >= maxSteps) adding = false; - draw_disp.wait(waitTime); - } + draw_disp.wait(waitTime); + } - sl_done(); - return 0; + sl_done(); + return 0; } diff --git a/Task/Dragon-curve/Tcl/dragon-curve.tcl b/Task/Dragon-curve/Tcl/dragon-curve.tcl index 1dcd79c6ad..e662357b4b 100644 --- a/Task/Dragon-curve/Tcl/dragon-curve.tcl +++ b/Task/Dragon-curve/Tcl/dragon-curve.tcl @@ -15,14 +15,14 @@ proc forward {len} { proc dragon {len split {d 1}} { global r2 coords if {$split == 0} { - forward $len - return + forward $len + return } # This next part is only necessary to allow the illustration of progress if {$split == 10 && [llength $::coords]>2} { - .c coords dragon $::coords - update + .c coords dragon $::coords + update } incr split -1 diff --git a/Task/Dragon-curve/V-(Vlang)/dragon-curve.v b/Task/Dragon-curve/V-(Vlang)/dragon-curve.v new file mode 100644 index 0000000000..eeb9bfa2ce --- /dev/null +++ b/Task/Dragon-curve/V-(Vlang)/dragon-curve.v @@ -0,0 +1,78 @@ +import gg +import gx +import math + +struct App { + mut: + iter int + turns []int + start_angle f64 + side f64 + angle f64 + x1 int + y1 int + x2 int + y2 int + col gx.Color + ctx gg.Context +} + +fn get_sequence(iterations int) []int { + mut turn_sequence := []int{} + for _ in 0 .. iterations { + mut copy := turn_sequence.clone() + if copy.len > 1 { copy = copy.reverse() } + turn_sequence << 1 + for i in copy { + turn_sequence << -i + } + } + return turn_sequence +} + +fn (mut app App) dragon() { + app.angle = app.start_angle + app.x1 = 230 + app.y1 = 350 + app.x2 = app.x1 + int(math.cos(app.angle) * app.side) + app.y2 = app.y1 + int(math.sin(app.angle) * app.side) + app.ctx.draw_line(app.x1, app.y1, app.x2, app.y2, app.col) + app.x1 = app.x2 + app.y1 = app.y2 + for turn in app.turns { + app.angle += f64(turn) * math.pi / 2 + app.x2 = app.x1 + int(math.cos(app.angle) * app.side) + app.y2 = app.y1 + int(math.sin(app.angle) * app.side) + app.ctx.draw_line(app.x1, app.y1, app.x2, app.y2, app.col) + app.x1 = app.x2 + app.y1 = app.y2 + } +} + +fn (mut app App) init() { + app.iter = 14 + app.turns = get_sequence(app.iter) + app.start_angle = -f64(app.iter) * math.pi / 4 + app.side = 400.0 / math.pow(2, f64(app.iter) / 2) + app.col = gx.blue +} + +fn frame(mut app App) { + app.ctx.begin() + app.dragon() + app.ctx.end() +} + +fn main() { + mut app := App{} + mut context := gg.new_context( + width: 800 + height: 600 + window_title: 'Dragon curve' + user_data: &app + frame_fn: frame + bg_color: gx.white + ) + app.init() + context.run() +} diff --git a/Task/Dragon-curve/VBScript/dragon-curve.vb b/Task/Dragon-curve/VBScript/dragon-curve.vbs similarity index 100% rename from Task/Dragon-curve/VBScript/dragon-curve.vb rename to Task/Dragon-curve/VBScript/dragon-curve.vbs diff --git a/Task/Dragon-curve/Vedit-macro-language/dragon-curve.vedit b/Task/Dragon-curve/Vedit-macro-language/dragon-curve.vedit index 45025fd0ee..f8755cfac0 100644 --- a/Task/Dragon-curve/Vedit-macro-language/dragon-curve.vedit +++ b/Task/Dragon-curve/Vedit-macro-language/dragon-curve.vedit @@ -1,16 +1,16 @@ File_Open("|(USER_MACRO)\dragon.bmp", OVERWRITE+NOEVENT) BOF Del_Char(ALL) -#11 = 640 // width of the image -#12 = 480 // height of the image +#11 = 640 // width of the image +#12 = 480 // height of the image Call("CREATE_BMP") -#1 = 384 // dx -#2 = 0 // dy -#3 = 6 // depth of recursion -#4 = 1 // flip -#5 = 150 // x -#6 = 300 // y +#1 = 384 // dx +#2 = 0 // dy +#3 = 6 // depth of recursion +#4 = 1 // flip +#5 = 150 // x +#6 = 300 // y Call("DRAGON") Buf_Close(NOMSG) @@ -29,15 +29,15 @@ if (#3 == 0) { #2 /= 2 #3-- if (#4) { - Num_Push(1,4) #4=1; #7=#1; #1=#2; #2=-#7; Call("DRAGON") Num_Pop(1,4) - Num_Push(1,4) #4=0; Call("DRAGON") Num_Pop(1,4) - Num_Push(1,4) #4=1; #7=#1; #1=-#2; #2=#7; Call("DRAGON") Num_Pop(1,4) - Num_Push(1,4) #4=0; Call("DRAGON") Num_Pop(1,4) + Num_Push(1,4) #4=1; #7=#1; #1=#2; #2=-#7; Call("DRAGON") Num_Pop(1,4) + Num_Push(1,4) #4=0; Call("DRAGON") Num_Pop(1,4) + Num_Push(1,4) #4=1; #7=#1; #1=-#2; #2=#7; Call("DRAGON") Num_Pop(1,4) + Num_Push(1,4) #4=0; Call("DRAGON") Num_Pop(1,4) } else { - Num_Push(1,4) #4=1; Call("DRAGON") Num_Pop(1,4) - Num_Push(1,4) #4=0; #7=#1; #1=-#2; #2=#7; Call("DRAGON") Num_Pop(1,4) - Num_Push(1,4) #4=1; Call("DRAGON") Num_Pop(1,4) - Num_Push(1,4) #4=0; #7=#1; #1=#2; #2=-#7; Call("DRAGON") Num_Pop(1,4) + Num_Push(1,4) #4=1; Call("DRAGON") Num_Pop(1,4) + Num_Push(1,4) #4=0; #7=#1; #1=-#2; #2=#7; Call("DRAGON") Num_Pop(1,4) + Num_Push(1,4) #4=1; Call("DRAGON") Num_Pop(1,4) + Num_Push(1,4) #4=0; #7=#1; #1=#2; #2=-#7; Call("DRAGON") Num_Pop(1,4) } } return @@ -53,7 +53,7 @@ while (#1 || #2 ) { #5 += #21; #1 -= #21 #6 += #22; #2 -= #22 Goto_Pos(1078 + #5 + #6*#11) - IC(255, OVERWRITE) // plot a pixel + IC(255, OVERWRITE) // plot a pixel } return @@ -64,19 +64,19 @@ return :CREATE_BMP: // BITMAPFILEHEADER: -IT("BM") // bfType -#10 = 1078+#11*#12 // file size +IT("BM") // bfType +#10 = 1078+#11*#12 // file size Call("INS_4BYTES") -IC(0, COUNT, 4) // reserved -#10 = 1078; Call("INS_4BYTES") // offset to bitmap data +IC(0, COUNT, 4) // reserved +#10 = 1078; Call("INS_4BYTES") // offset to bitmap data // BITMAPINFOHEADER: -#10 = 40; Call("INS_4BYTES") // size of BITMAPINFOHEADER -#10 = #11; Call("INS_4BYTES") // width of image -#10 = #12; Call("INS_4BYTES") // height of image -IC(1) IC(0) // number of bitplanes = 1 -IC(8) IC(0) // bits/pixel = 8 -IC(0, COUNT, 24) // compression, number of colors etc. +#10 = 40; Call("INS_4BYTES") // size of BITMAPINFOHEADER +#10 = #11; Call("INS_4BYTES") // width of image +#10 = #12; Call("INS_4BYTES") // height of image +IC(1) IC(0) // number of bitplanes = 1 +IC(8) IC(0) // bits/pixel = 8 +IC(0, COUNT, 24) // compression, number of colors etc. // Color table - create greyscale palette for (#1 = 0; #1 < 256; #1++) { @@ -96,5 +96,5 @@ return for (#1 = 0; #1 < 4; #1++) { Ins_Char(#10 & 0xff) #10 = #10 >> 8 -} +} return diff --git a/Task/Dragon-curve/YAMLScript/dragon-curve.ys b/Task/Dragon-curve/YAMLScript/dragon-curve.ys new file mode 100644 index 0000000000..a2d4b04861 --- /dev/null +++ b/Task/Dragon-curve/YAMLScript/dragon-curve.ys @@ -0,0 +1,29 @@ +!YS-v0 + +defn main(steps=511): + data [minx maxx miny maxy] =: + loop i 0 [x y], [0 0], data {}, [minx maxx miny maxy] [0 0 0 0]: + dir =: i-to-dir(i) + nx ny =: + + [(x + condp(== dir 0 1 2 -1 0)) + (y + condp(== dir 1 1 3 -1 0))] + ob ib =: dir.nth([[8 4][2 1][4 8][1 2]]) + data =: update-in(data [y x] safe-bit-or ob) + .update-in([ny nx] safe-bit-or ib) + bbox =: + + [min(minx nx) max(maxx nx) + min(miny ny) max(maxy ny)] + if i < steps: + recur: i.++, [nx ny], data, bbox + vector: data bbox + + each y (miny .. maxy): + say: !:join + each x (minx .. maxx): + get-in(data [y x] 0).nth(" ╵╷│╴┘┐┤╶└┌├─┴┬┼") + +defn i-to-dir(n): + n.bit-xor(bit-shift-right(n 1)):Long/bitCount % 4 + +defn safe-bit-or(v bit): + (v || 0).bit-or(bit) diff --git a/Task/Dragon-curve/Yabasic/dragon-curve-1.basic b/Task/Dragon-curve/Yabasic/dragon-curve-1.basic index 1d6082d45d..9d47421a36 100644 --- a/Task/Dragon-curve/Yabasic/dragon-curve-1.basic +++ b/Task/Dragon-curve/Yabasic/dragon-curve-1.basic @@ -15,30 +15,30 @@ clear window dragon() sub dragon() - if level<=0 then - yn = sin(rotation)*insize + y - xn = cos(rotation)*insize + x - if iter*20 THEN 230 +210 PLOT XC,YC:DRAWTO HX,HY +220 PLOT XC,YC:DRAWTO MX,MY +230 PLOT XC,YC:DRAWTO SX,SY +240 GOSUB 500 +250 COLOR 2 +260 PLOT XC,YC:DRAWTO HX,HY +270 PLOT XC,YC:DRAWTO MX,MY +280 COLOR 1 +290 PLOT XC,YC:DRAWTO SX,SY +300 JIFFIES=256*PEEK(19)+PEEK(20) +310 NSEC=INT(JIFFIES/FPS):IF NSEC=60 THEN GOSUB 400:GOTO 100 +320 IF NSEC>SS THEN SS=NSEC:GOTO 2OO +330 GOTO 300 +400 REM INCREASE MINUTE AND HOUR +410 MM=MM+1 +420 IF MM=60 THEN MM=0:HH=HH+1 +430 IF HH=24 THEN HH=0 +440 REM DISABLE SCREEN SAVER/ATTRACT MODE +450 POKE 77,0 +460 RETURN +500 IF SS>0 THEN 550:REM CALCULATE X AND Y POSITIONS OF HANDS +510 HX=XC+R*SIN(30*HH+MM/2)*0.5 +520 HY=YC-R*COS(30*HH+MM/2)*0.5 +530 MX=XC+R*SIN(6*MM) +540 MY=YC-R*COS(6*MM) +550 SX=XC+R*SIN(6*SS) +560 SY=YC-R*COS(6*SS) +570 RETURN +800 REM DRAW CLOCK FACE +810 COLOR 3 +820 FOR I=30 TO 360 STEP 30 +830 PLOT XC+RF*SIN(I),YC-RF*COS(I) +840 NEXT I +850 RETURN diff --git a/Task/Draw-a-clock/Batch-File/draw-a-clock.bat b/Task/Draw-a-clock/Batch-File/draw-a-clock.bat index 42149ed54e..ae8d23ce99 100644 --- a/Task/Draw-a-clock/Batch-File/draw-a-clock.bat +++ b/Task/Draw-a-clock/Batch-File/draw-a-clock.bat @@ -7,7 +7,7 @@ title Sample Batch Clock setlocal enabledelayedexpansion chcp 65001 - ::Set the characters... + ::Set the characters... set "#0_1=█████" set "#0_2=█ █" set "#0_3=█ █" @@ -75,26 +75,26 @@ set "#C_4=█" set "#C_5= " :clock_loop - ::Clear display [leaving a whitespace]... + ::Clear display [leaving a whitespace]... for /l %%C in (1,1,5) do set "display%%C= " - ::Get current time [all spaces will be replaced to zero]... - ::Also, all colons will be replaced to "C" because colon has a function in variables... + ::Get current time [all spaces will be replaced to zero]... + ::Also, all colons will be replaced to "C" because colon has a function in variables... set "curr_time=%time: =0%" set "curr_time=%curr_time::=C%" - ::Process the numbers to display [we will now use the formats we SET above]... + ::Process the numbers to display [we will now use the formats we SET above]... for /l %%T in (0,1,7) do ( - ::Check for each number and colons... - for %%N in (0 1 2 3 4 5 6 7 8 9 C) do ( - if "!curr_time:~%%T,1!"=="%%N" ( - ::Now, barbeque each formatted char in 5 rows... - for /l %%D in (1,1,5) do set "display%%D=!display%%D!!#%%N_%%D! " - ) - ) + ::Check for each number and colons... + for %%N in (0 1 2 3 4 5 6 7 8 9 C) do ( + if "!curr_time:~%%T,1!"=="%%N" ( + ::Now, barbeque each formatted char in 5 rows... + for /l %%D in (1,1,5) do set "display%%D=!display%%D!!#%%N_%%D! " + ) + ) ) - ::Refresh the clock... + ::Refresh the clock... cls echo. echo.[%display1%] diff --git a/Task/Draw-a-clock/C++/draw-a-clock.cpp b/Task/Draw-a-clock/C++/draw-a-clock.cpp index 95f8885642..176b1c771b 100644 --- a/Task/Draw-a-clock/C++/draw-a-clock.cpp +++ b/Task/Draw-a-clock/C++/draw-a-clock.cpp @@ -19,15 +19,15 @@ public: void set( int a, int b ) { x = a; y = b; } void rotate( float angle_r ) { - float _x = static_cast( x ), - _y = static_cast( y ), - s = sinf( angle_r ), - c = cosf( angle_r ), - a = _x * c - _y * s, - b = _x * s + _y * c; + float _x = static_cast( x ), + _y = static_cast( y ), + s = sinf( angle_r ), + c = cosf( angle_r ), + a = _x * c - _y * s, + b = _x * s + _y * c; - x = static_cast( a ); - y = static_cast( b ); + x = static_cast( a ); + y = static_cast( b ); } int x, y; }; @@ -38,94 +38,94 @@ public: myBitmap() : pen( NULL ), brush( NULL ), clr( 0 ), wid( 1 ) {} ~myBitmap() { - DeleteObject( pen ); - DeleteObject( brush ); - DeleteDC( hdc ); - DeleteObject( bmp ); + DeleteObject( pen ); + DeleteObject( brush ); + DeleteDC( hdc ); + DeleteObject( bmp ); } bool create( int w, int h ) { - BITMAPINFO bi; - ZeroMemory( &bi, sizeof( bi ) ); - bi.bmiHeader.biSize = sizeof( bi.bmiHeader ); - bi.bmiHeader.biBitCount = sizeof( DWORD ) * 8; - bi.bmiHeader.biCompression = BI_RGB; - bi.bmiHeader.biPlanes = 1; - bi.bmiHeader.biWidth = w; - bi.bmiHeader.biHeight = -h; + BITMAPINFO bi; + ZeroMemory( &bi, sizeof( bi ) ); + bi.bmiHeader.biSize = sizeof( bi.bmiHeader ); + bi.bmiHeader.biBitCount = sizeof( DWORD ) * 8; + bi.bmiHeader.biCompression = BI_RGB; + bi.bmiHeader.biPlanes = 1; + bi.bmiHeader.biWidth = w; + bi.bmiHeader.biHeight = -h; - HDC dc = GetDC( GetConsoleWindow() ); - bmp = CreateDIBSection( dc, &bi, DIB_RGB_COLORS, &pBits, NULL, 0 ); - if( !bmp ) return false; + HDC dc = GetDC( GetConsoleWindow() ); + bmp = CreateDIBSection( dc, &bi, DIB_RGB_COLORS, &pBits, NULL, 0 ); + if( !bmp ) return false; - hdc = CreateCompatibleDC( dc ); - SelectObject( hdc, bmp ); - ReleaseDC( GetConsoleWindow(), dc ); + hdc = CreateCompatibleDC( dc ); + SelectObject( hdc, bmp ); + ReleaseDC( GetConsoleWindow(), dc ); - width = w; height = h; - return true; + width = w; height = h; + return true; } void clear( BYTE clr = 0 ) { - memset( pBits, clr, width * height * sizeof( DWORD ) ); + memset( pBits, clr, width * height * sizeof( DWORD ) ); } void setBrushColor( DWORD bClr ) { - if( brush ) DeleteObject( brush ); - brush = CreateSolidBrush( bClr ); - SelectObject( hdc, brush ); + if( brush ) DeleteObject( brush ); + brush = CreateSolidBrush( bClr ); + SelectObject( hdc, brush ); } void setPenColor( DWORD c ) { - clr = c; - createPen(); + clr = c; + createPen(); } void setPenWidth( int w ) { - wid = w; - createPen(); + wid = w; + createPen(); } void saveBitmap( string path ) { - BITMAPFILEHEADER fileheader; - BITMAPINFO infoheader; - BITMAP bitmap; - DWORD wb; + BITMAPFILEHEADER fileheader; + BITMAPINFO infoheader; + BITMAP bitmap; + DWORD wb; + + GetObject( bmp, sizeof( bitmap ), &bitmap ); + DWORD* dwpBits = new DWORD[bitmap.bmWidth * bitmap.bmHeight]; - GetObject( bmp, sizeof( bitmap ), &bitmap ); - DWORD* dwpBits = new DWORD[bitmap.bmWidth * bitmap.bmHeight]; - ZeroMemory( dwpBits, bitmap.bmWidth * bitmap.bmHeight * sizeof( DWORD ) ); - ZeroMemory( &infoheader, sizeof( BITMAPINFO ) ); - ZeroMemory( &fileheader, sizeof( BITMAPFILEHEADER ) ); + ZeroMemory( &infoheader, sizeof( BITMAPINFO ) ); + ZeroMemory( &fileheader, sizeof( BITMAPFILEHEADER ) ); - infoheader.bmiHeader.biBitCount = sizeof( DWORD ) * 8; - infoheader.bmiHeader.biCompression = BI_RGB; - infoheader.bmiHeader.biPlanes = 1; - infoheader.bmiHeader.biSize = sizeof( infoheader.bmiHeader ); - infoheader.bmiHeader.biHeight = bitmap.bmHeight; - infoheader.bmiHeader.biWidth = bitmap.bmWidth; - infoheader.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * sizeof( DWORD ); + infoheader.bmiHeader.biBitCount = sizeof( DWORD ) * 8; + infoheader.bmiHeader.biCompression = BI_RGB; + infoheader.bmiHeader.biPlanes = 1; + infoheader.bmiHeader.biSize = sizeof( infoheader.bmiHeader ); + infoheader.bmiHeader.biHeight = bitmap.bmHeight; + infoheader.bmiHeader.biWidth = bitmap.bmWidth; + infoheader.bmiHeader.biSizeImage = bitmap.bmWidth * bitmap.bmHeight * sizeof( DWORD ); - fileheader.bfType = 0x4D42; - fileheader.bfOffBits = sizeof( infoheader.bmiHeader ) + sizeof( BITMAPFILEHEADER ); - fileheader.bfSize = fileheader.bfOffBits + infoheader.bmiHeader.biSizeImage; + fileheader.bfType = 0x4D42; + fileheader.bfOffBits = sizeof( infoheader.bmiHeader ) + sizeof( BITMAPFILEHEADER ); + fileheader.bfSize = fileheader.bfOffBits + infoheader.bmiHeader.biSizeImage; - GetDIBits( hdc, bmp, 0, height, ( LPVOID )dwpBits, &infoheader, DIB_RGB_COLORS ); + GetDIBits( hdc, bmp, 0, height, ( LPVOID )dwpBits, &infoheader, DIB_RGB_COLORS ); - HANDLE file = CreateFile( path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); - WriteFile( file, &fileheader, sizeof( BITMAPFILEHEADER ), &wb, NULL ); - WriteFile( file, &infoheader.bmiHeader, sizeof( infoheader.bmiHeader ), &wb, NULL ); - WriteFile( file, dwpBits, bitmap.bmWidth * bitmap.bmHeight * 4, &wb, NULL ); - CloseHandle( file ); + HANDLE file = CreateFile( path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); + WriteFile( file, &fileheader, sizeof( BITMAPFILEHEADER ), &wb, NULL ); + WriteFile( file, &infoheader.bmiHeader, sizeof( infoheader.bmiHeader ), &wb, NULL ); + WriteFile( file, dwpBits, bitmap.bmWidth * bitmap.bmHeight * 4, &wb, NULL ); + CloseHandle( file ); - delete [] dwpBits; + delete [] dwpBits; } HDC getDC() const { return hdc; } @@ -135,9 +135,9 @@ public: private: void createPen() { - if( pen ) DeleteObject( pen ); - pen = CreatePen( PS_SOLID, wid, clr ); - SelectObject( hdc, pen ); + if( pen ) DeleteObject( pen ); + pen = CreatePen( PS_SOLID, wid, clr ); + SelectObject( hdc, pen ); } HBITMAP bmp; @@ -154,16 +154,16 @@ class clock public: clock() { - _bmp.create( BMP_SIZE, BMP_SIZE ); - _bmp.clear( 100 ); - _bmp.setPenWidth( 2 ); - _ang = DegToRadian( 6 ); + _bmp.create( BMP_SIZE, BMP_SIZE ); + _bmp.clear( 100 ); + _bmp.setPenWidth( 2 ); + _ang = DegToRadian( 6 ); } - + void setNow() { - GetLocalTime( &_sysTime ); - draw(); + GetLocalTime( &_sysTime ); + draw(); } float DegToRadian( float degree ) { return degree * ( PI / 180.0f ); } @@ -173,70 +173,70 @@ public: private: void drawTicks( HDC dc ) { - vector2 line; - _bmp.setPenWidth( 1 ); - for( int x = 0; x < 60; x++ ) - { - line.set( 0, 50 ); - line.rotate( static_cast( x + 30 ) * _ang ); - MoveToEx( dc, CENTER - static_cast( 2.5f * static_cast( line.x ) ), CENTER - static_cast( 2.5f * static_cast( line.y ) ), NULL ); - LineTo( dc, CENTER - static_cast( 2.81f * static_cast( line.x ) ), CENTER - static_cast( 2.81f * static_cast( line.y ) ) ); - } + vector2 line; + _bmp.setPenWidth( 1 ); + for( int x = 0; x < 60; x++ ) + { + line.set( 0, 50 ); + line.rotate( static_cast( x + 30 ) * _ang ); + MoveToEx( dc, CENTER - static_cast( 2.5f * static_cast( line.x ) ), CENTER - static_cast( 2.5f * static_cast( line.y ) ), NULL ); + LineTo( dc, CENTER - static_cast( 2.81f * static_cast( line.x ) ), CENTER - static_cast( 2.81f * static_cast( line.y ) ) ); + } - _bmp.setPenWidth( 3 ); - for( int x = 0; x < 60; x += 5 ) - { - line.set( 0, 50 ); - line.rotate( static_cast( x + 30 ) * _ang ); - MoveToEx( dc, CENTER - static_cast( 2.5f * static_cast( line.x ) ), CENTER - static_cast( 2.5f * static_cast( line.y ) ), NULL ); - LineTo( dc, CENTER - static_cast( 2.81f * static_cast( line.x ) ), CENTER - static_cast( 2.81f * static_cast( line.y ) ) ); - } + _bmp.setPenWidth( 3 ); + for( int x = 0; x < 60; x += 5 ) + { + line.set( 0, 50 ); + line.rotate( static_cast( x + 30 ) * _ang ); + MoveToEx( dc, CENTER - static_cast( 2.5f * static_cast( line.x ) ), CENTER - static_cast( 2.5f * static_cast( line.y ) ), NULL ); + LineTo( dc, CENTER - static_cast( 2.81f * static_cast( line.x ) ), CENTER - static_cast( 2.81f * static_cast( line.y ) ) ); + } } void drawHands( HDC dc ) { - float hp = DegToRadian( ( 30.0f * static_cast( _sysTime.wMinute ) ) / 60.0f ); - int h = ( _sysTime.wHour > 12 ? _sysTime.wHour - 12 : _sysTime.wHour ) * 5; - - _bmp.setPenWidth( 3 ); - _bmp.setPenColor( RGB( 0, 0, 255 ) ); - drawHand( dc, HOUR_LEN, ( _ang * static_cast( 30 + h ) ) + hp ); + float hp = DegToRadian( ( 30.0f * static_cast( _sysTime.wMinute ) ) / 60.0f ); + int h = ( _sysTime.wHour > 12 ? _sysTime.wHour - 12 : _sysTime.wHour ) * 5; - _bmp.setPenColor( RGB( 0, 128, 0 ) ); - drawHand( dc, MIN_LEN, _ang * static_cast( 30 + _sysTime.wMinute ) ); + _bmp.setPenWidth( 3 ); + _bmp.setPenColor( RGB( 0, 0, 255 ) ); + drawHand( dc, HOUR_LEN, ( _ang * static_cast( 30 + h ) ) + hp ); - _bmp.setPenWidth( 2 ); - _bmp.setPenColor( RGB( 255, 0, 0 ) ); - drawHand( dc, SEC_LEN, _ang * static_cast( 30 + _sysTime.wSecond ) ); + _bmp.setPenColor( RGB( 0, 128, 0 ) ); + drawHand( dc, MIN_LEN, _ang * static_cast( 30 + _sysTime.wMinute ) ); + + _bmp.setPenWidth( 2 ); + _bmp.setPenColor( RGB( 255, 0, 0 ) ); + drawHand( dc, SEC_LEN, _ang * static_cast( 30 + _sysTime.wSecond ) ); } void drawHand( HDC dc, int len, float ang ) { - vector2 line; - line.set( 0, len ); - line.rotate( ang ); - MoveToEx( dc, CENTER, CENTER, NULL ); - LineTo( dc, line.x + CENTER, line.y + CENTER ); + vector2 line; + line.set( 0, len ); + line.rotate( ang ); + MoveToEx( dc, CENTER, CENTER, NULL ); + LineTo( dc, line.x + CENTER, line.y + CENTER ); } void draw() { - HDC dc = _bmp.getDC(); + HDC dc = _bmp.getDC(); - _bmp.setBrushColor( RGB( 250, 250, 250 ) ); - Ellipse( dc, 0, 0, BMP_SIZE, BMP_SIZE ); - _bmp.setBrushColor( RGB( 230, 230, 230 ) ); - Ellipse( dc, 10, 10, BMP_SIZE - 10, BMP_SIZE - 10 ); + _bmp.setBrushColor( RGB( 250, 250, 250 ) ); + Ellipse( dc, 0, 0, BMP_SIZE, BMP_SIZE ); + _bmp.setBrushColor( RGB( 230, 230, 230 ) ); + Ellipse( dc, 10, 10, BMP_SIZE - 10, BMP_SIZE - 10 ); - drawTicks( dc ); - drawHands( dc ); + drawTicks( dc ); + drawHands( dc ); - _bmp.setPenColor( 0 ); _bmp.setBrushColor( 0 ); - Ellipse( dc, CENTER - 5, CENTER - 5, CENTER + 5, CENTER + 5 ); + _bmp.setPenColor( 0 ); _bmp.setBrushColor( 0 ); + Ellipse( dc, CENTER - 5, CENTER - 5, CENTER + 5, CENTER + 5 ); - _wdc = GetDC( _hwnd ); - BitBlt( _wdc, 0, 0, BMP_SIZE, BMP_SIZE, dc, 0, 0, SRCCOPY ); - ReleaseDC( _hwnd, _wdc ); + _wdc = GetDC( _hwnd ); + BitBlt( _wdc, 0, 0, BMP_SIZE, BMP_SIZE, dc, 0, 0, SRCCOPY ); + ReleaseDC( _hwnd, _wdc ); } myBitmap _bmp; @@ -252,67 +252,67 @@ public: wnd() { _inst = this; } int wnd::Run( HINSTANCE hInst ) { - _hInst = hInst; - _hwnd = InitAll(); - SetTimer( _hwnd, MY_TIMER, 1000, NULL ); - _clock.setHWND( _hwnd ); + _hInst = hInst; + _hwnd = InitAll(); + SetTimer( _hwnd, MY_TIMER, 1000, NULL ); + _clock.setHWND( _hwnd ); - ShowWindow( _hwnd, SW_SHOW ); - UpdateWindow( _hwnd ); + ShowWindow( _hwnd, SW_SHOW ); + UpdateWindow( _hwnd ); - MSG msg; - ZeroMemory( &msg, sizeof( msg ) ); - while( msg.message != WM_QUIT ) - { - if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) != 0 ) - { - TranslateMessage( &msg ); - DispatchMessage( &msg ); - } - } - return UnregisterClass( "_MY_CLOCK_", _hInst ); + MSG msg; + ZeroMemory( &msg, sizeof( msg ) ); + while( msg.message != WM_QUIT ) + { + if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) != 0 ) + { + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } + } + return UnregisterClass( "_MY_CLOCK_", _hInst ); } private: void wnd::doPaint( HDC dc ) { _clock.setNow(); } void wnd::doTimer() { _clock.setNow(); } static int WINAPI wnd::WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { - switch( msg ) - { - case WM_DESTROY: PostQuitMessage( 0 ); break; - case WM_PAINT: - { - PAINTSTRUCT ps; - HDC dc = BeginPaint( hWnd, &ps ); - _inst->doPaint( dc ); - EndPaint( hWnd, &ps ); - return 0; - } - case WM_TIMER: _inst->doTimer(); break; - default: - return DefWindowProc( hWnd, msg, wParam, lParam ); - } - return 0; + switch( msg ) + { + case WM_DESTROY: PostQuitMessage( 0 ); break; + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC dc = BeginPaint( hWnd, &ps ); + _inst->doPaint( dc ); + EndPaint( hWnd, &ps ); + return 0; + } + case WM_TIMER: _inst->doTimer(); break; + default: + return DefWindowProc( hWnd, msg, wParam, lParam ); + } + return 0; } HWND InitAll() { - WNDCLASSEX wcex; - ZeroMemory( &wcex, sizeof( wcex ) ); - wcex.cbSize = sizeof( WNDCLASSEX ); - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = ( WNDPROC )WndProc; - wcex.hInstance = _hInst; - wcex.hCursor = LoadCursor( NULL, IDC_ARROW ); - wcex.hbrBackground = ( HBRUSH )( COLOR_WINDOW + 1 ); - wcex.lpszClassName = "_MY_CLOCK_"; + WNDCLASSEX wcex; + ZeroMemory( &wcex, sizeof( wcex ) ); + wcex.cbSize = sizeof( WNDCLASSEX ); + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = ( WNDPROC )WndProc; + wcex.hInstance = _hInst; + wcex.hCursor = LoadCursor( NULL, IDC_ARROW ); + wcex.hbrBackground = ( HBRUSH )( COLOR_WINDOW + 1 ); + wcex.lpszClassName = "_MY_CLOCK_"; - RegisterClassEx( &wcex ); + RegisterClassEx( &wcex ); - RECT rc = { 0, 0, BMP_SIZE, BMP_SIZE }; - AdjustWindowRect( &rc, WS_SYSMENU | WS_CAPTION, FALSE ); - int w = rc.right - rc.left, h = rc.bottom - rc.top; - return CreateWindow( "_MY_CLOCK_", ".: Clock -- PJorente :.", WS_SYSMENU, CW_USEDEFAULT, 0, w, h, NULL, NULL, _hInst, NULL ); + RECT rc = { 0, 0, BMP_SIZE, BMP_SIZE }; + AdjustWindowRect( &rc, WS_SYSMENU | WS_CAPTION, FALSE ); + int w = rc.right - rc.left, h = rc.bottom - rc.top; + return CreateWindow( "_MY_CLOCK_", ".: Clock -- PJorente :.", WS_SYSMENU, CW_USEDEFAULT, 0, w, h, NULL, NULL, _hInst, NULL ); } static wnd* _inst; diff --git a/Task/Draw-a-clock/C/draw-a-clock-1.c b/Task/Draw-a-clock/C/draw-a-clock-1.c index 197d668b3d..90f51a7d51 100644 --- a/Task/Draw-a-clock/C/draw-a-clock-1.c +++ b/Task/Draw-a-clock/C/draw-a-clock-1.c @@ -9,85 +9,85 @@ const char * shades = " .:-*ca&#%@"; /* distance of (x, y) from line segment (0, 0)->(x0, y0) */ double dist(double x, double y, double x0, double y0) { - double l = (x * x0 + y * y0) / (x0 * x0 + y0 * y0); + double l = (x * x0 + y * y0) / (x0 * x0 + y0 * y0); - if (l > 1) { - x -= x0; - y -= y0; - } else if (l >= 0) { - x -= l * x0; - y -= l * y0; - } - return sqrt(x * x + y * y); + if (l > 1) { + x -= x0; + y -= y0; + } else if (l >= 0) { + x -= l * x0; + y -= l * y0; + } + return sqrt(x * x + y * y); } enum { sec = 0, min, hur }; // for subscripts void draw(int size) { -# define for_i for(int i = 0; i < size; i++) -# define for_j for(int j = 0; j < size * 2; j++) +# define for_i for(int i = 0; i < size; i++) +# define for_j for(int j = 0; j < size * 2; j++) - double angle, cx = size / 2.; - double sx[3], sy[3], sw[3]; - double fade[] = { 1, .35, .35 }; /* opacity of each arm */ - struct timeval tv; - struct tm *t; + double angle, cx = size / 2.; + double sx[3], sy[3], sw[3]; + double fade[] = { 1, .35, .35 }; /* opacity of each arm */ + struct timeval tv; + struct tm *t; - /* set width of each arm */ - sw[sec] = size * .02; - sw[min] = size * .03; - sw[hur] = size * .05; + /* set width of each arm */ + sw[sec] = size * .02; + sw[min] = size * .03; + sw[hur] = size * .05; every_second: - gettimeofday(&tv, 0); - t = localtime(&tv.tv_sec); + gettimeofday(&tv, 0); + t = localtime(&tv.tv_sec); - angle = t->tm_sec * PI / 30; - sy[sec] = -cx * cos(angle); - sx[sec] = cx * sin(angle); + angle = t->tm_sec * PI / 30; + sy[sec] = -cx * cos(angle); + sx[sec] = cx * sin(angle); - angle = (t->tm_min + t->tm_sec / 60.) / 30 * PI; - sy[min] = -cx * cos(angle) * .8; - sx[min] = cx * sin(angle) * .8; + angle = (t->tm_min + t->tm_sec / 60.) / 30 * PI; + sy[min] = -cx * cos(angle) * .8; + sx[min] = cx * sin(angle) * .8; - angle = (t->tm_hour + t->tm_min / 60.) / 6 * PI; - sy[hur] = -cx * cos(angle) * .6; - sx[hur] = cx * sin(angle) * .6; + angle = (t->tm_hour + t->tm_min / 60.) / 6 * PI; + sy[hur] = -cx * cos(angle) * .6; + sx[hur] = cx * sin(angle) * .6; - printf("\033[s"); /* save cursor position */ - for_i { - printf("\033[%d;0H", i); /* goto row i, col 0 */ - double y = i - cx; - for_j { - double x = (j - 2 * cx) / 2; + printf("\033[s"); /* save cursor position */ + for_i { + printf("\033[%d;0H", i); /* goto row i, col 0 */ + double y = i - cx; + for_j { + double x = (j - 2 * cx) / 2; - int pix = 0; - /* calcs how far the "pixel" is from each arm and set - * shade, with some anti-aliasing. It's ghetto, but much - * easier than a real scanline conversion. - */ - for (int k = hur; k >= sec; k--) { - double d = dist(x, y, sx[k], sy[k]); - if (d < sw[k] - .5) - pix = 10 * fade[k]; - else if (d < sw[k] + .5) - pix = (5 + (sw[k] - d) * 10) * fade[k]; - } - putchar(shades[pix]); - } - } - printf("\033[u"); /* restore cursor pos so you can bg the job -- value unclear */ + int pix = 0; + /* calcs how far the "pixel" is from each arm and set + * shade, with some anti-aliasing. It's ghetto, but much + * easier than a real scanline conversion. + */ + for (int k = hur; k >= sec; k--) { + double d = dist(x, y, sx[k], sy[k]); + if (d < sw[k] - .5) + pix = 10 * fade[k]; + else if (d < sw[k] + .5) + pix = (5 + (sw[k] - d) * 10) * fade[k]; + } + putchar(shades[pix]); + } + } + printf("\033[u"); /* restore cursor pos so you can bg the job -- value unclear */ - fflush(stdout); - sleep(1); /* sleep 1 can at times miss a second, but will catch up next update */ - goto every_second; + fflush(stdout); + sleep(1); /* sleep 1 can at times miss a second, but will catch up next update */ + goto every_second; } int main(int argc, char *argv[]) { - int s; - if (argc <= 1 || (s = atoi(argv[1])) <= 0) s = 20; - draw(s); - return 0; + int s; + if (argc <= 1 || (s = atoi(argv[1])) <= 0) s = 20; + draw(s); + return 0; } diff --git a/Task/Draw-a-clock/ContextFree/draw-a-clock.cf b/Task/Draw-a-clock/ContextFree/draw-a-clock.cf index a03d242674..95b5690c00 100644 --- a/Task/Draw-a-clock/ContextFree/draw-a-clock.cf +++ b/Task/Draw-a-clock/ContextFree/draw-a-clock.cf @@ -3,12 +3,12 @@ startshape START TIME_IN_SECONDS = 60 shape START { - SECOND_HAND[r (TIME_IN_SECONDS*-6)] - CIRCLE[s 50 50] + SECOND_HAND[r (TIME_IN_SECONDS*-6)] + CIRCLE[s 50 50] } shape SECOND_HAND { - TRIANGLE [[z 1 s 1 30 y 0.26 b 1]] + TRIANGLE [[z 1 s 1 30 y 0.26 b 1]] } diff --git a/Task/Draw-a-clock/Delphi/draw-a-clock-1.delphi b/Task/Draw-a-clock/Delphi/draw-a-clock-1.pas similarity index 100% rename from Task/Draw-a-clock/Delphi/draw-a-clock-1.delphi rename to Task/Draw-a-clock/Delphi/draw-a-clock-1.pas diff --git a/Task/Draw-a-clock/Delphi/draw-a-clock-2.delphi b/Task/Draw-a-clock/Delphi/draw-a-clock-2.pas similarity index 100% rename from Task/Draw-a-clock/Delphi/draw-a-clock-2.delphi rename to Task/Draw-a-clock/Delphi/draw-a-clock-2.pas diff --git a/Task/Draw-a-clock/EasyLang/draw-a-clock.easy b/Task/Draw-a-clock/EasyLang/draw-a-clock.easy index 7d2dc2ddee..f53a4939f8 100644 --- a/Task/Draw-a-clock/EasyLang/draw-a-clock.easy +++ b/Task/Draw-a-clock/EasyLang/draw-a-clock.easy @@ -1,38 +1,32 @@ -proc draw hour min sec . . +proc draw hour min sec . # dial - color 333 - move 50 50 - circle 45 - color 797 - circle 44 - color 333 + gcolor 333 + gcircle 50 50 45 + gcolor 797 + gcircle 50 50 44 + gcolor 333 for i range0 60 a = i * 6 - move 50 + sin a * 40 50 + cos a * 40 - circle 0.25 - . - for i range0 12 - a = i * 30 - move 50 + sin a * 40 50 + cos a * 40 - circle 1 + if i mod 5 = 0 + gcircle 50 + sin a * 40 50 + cos a * 40 1 + else + gcircle 50 + sin a * 40 50 + cos a * 40 0.25 + . . # hour - linewidth 2 - color 000 + glinewidth 2 + gcolor 000 a = (hour * 60 + min) / 2 - move 50 50 - line 50 + sin a * 32 50 + cos a * 32 + gline 50 50 50 + sin a * 32 50 + cos a * 32 # min - linewidth 1.5 + glinewidth 1.5 a = (sec + min * 60) / 10 - move 50 50 - line 50 + sin a * 40 50 + cos a * 40 + gline 50 50 50 + sin a * 40 50 + cos a * 40 # sec - linewidth 1 - color 700 + glinewidth 1 + gcolor 700 a = sec * 6 - move 50 50 - line 50 + sin a * 40 50 + cos a * 40 + gline 50 50 50 + sin a * 40 50 + cos a * 40 . on timer if t <> floor systime @@ -41,11 +35,9 @@ on timer sec = number substr h$ 18 2 min = number substr h$ 15 2 hour = number substr h$ 12 2 - if hour > 12 - hour -= 12 - . + if hour > 12 : hour -= 12 draw hour min sec . - timer 0.1 + timer 0.05 . timer 0 diff --git a/Task/Draw-a-clock/Evaldraw/draw-a-clock.evaldraw b/Task/Draw-a-clock/Evaldraw/draw-a-clock.evaldraw new file mode 100644 index 0000000000..048c92104b --- /dev/null +++ b/Task/Draw-a-clock/Evaldraw/draw-a-clock.evaldraw @@ -0,0 +1,88 @@ +(){ + cls(0); + drawclock(150); +} +drawclock(rad) { + hand_color = 0x6a6a6a; + seconds_color = 0xff0000; + radius_notches = rad*.95; + radius_numbers = rad*.85; + small_notch_size =rad*0.04; + big_notch_size = rad*0.08; + cx=rad+1; + cy=rad+1; + + // Face background + setcol(0x5aaaaa); drawsph(cx,cy,rad); + + // Highlight from stopwatch.kc + setcol(0xffffff); gldisable(GL_DEPTH_TEST); + glbegin(GL_COMPLEX); glsettex("whitepix.tga"); + for(a=3.5;a<=4.5;a+=.25) { gltexcoord(0,0); glvertex(cos(a)*rad*.55+cx,sin(a)*rad*.55+cy); } + for(a=4.5;a>=3.5;a-=.25) { gltexcoord(0,0); glvertex(cos(a)*rad*.45+cx,sin(a)*rad*.45+cy); } + glend(); + + moveto(cx-4*6, cy-.5*rad); + setfont(6,8); + setcol(0); printf("Evaltime"); + + // Face + setcol(0x015151); + hr=0; + for(i=0; i<60; i++) + { + a = i/60*2*pi - pi/2; + ca=cos(a); + sa=sin(a); + if (i%5==0) + { + hour = hr; if (hour==0) hour=12; + draw_hour(cx,cy,ca,sa,radius_numbers,hour); + hr++; + + r=radius_notches; + x=cx + ca*r; y=cy+sa*r; + drawcone(x,y,big_notch_size*.5,x+big_notch_size*ca,y+big_notch_size*sa,-big_notch_size*.5,0); + } else { + r=radius_notches; + x=cx + ca*r; y=cy+sa*r; + drawcone(x,y,small_notch_size*.5,x+small_notch_size*ca,y+small_notch_size*sa,-small_notch_size*.5,0); + } + } + + + int_hours = klock(6); + int_minutes = klock(7); + int_seconds = klock(8); + int_millis = klock(9); + + // Hour and Minute hand + hours = (int_hours+int_minutes/60.0) / 24.0; + a = hours * 2*pi - pi/2; + drawhand(cx,cy,a, rad*.64, 6,4, hand_color); + a = ( (int_minutes+int_seconds/60+int_millis/1000/60) / 60) * 2*pi - pi/2; + drawhand(cx,cy,a, rad*.84, 4,2, hand_color); + + a = ((int_seconds+int_millis/1000) / 60) * 2*pi - pi/2; + drawhand(cx,cy,a, rad*.9, 3,1, seconds_color); +} + +draw_hour(cx,cy,ca,sa,r,hr) { + x=cx + ca*r; y=cy+sa*r; + ofs=0; if(hr>9 || hr==0) ofs=5; + setfont(9,16); + moveto(x-4.5-ofs,y-8); + printf("%g", hr); +} +drawhand(cx,cy,angle,forward,r0,r1,kolor) { + back = .19*forward; + sx=cx - cos(angle)*back; + sy=cy - sin(angle)*back; + ex=cx + cos(angle)*forward; + ey=cy + sin(angle)*forward; + setcol(0); + drawcone(sx,sy,r0+1,ex,ey,r1+1); + setcol(kolor); + drawsph(cx,cy,r0+3); + drawcone(sx,sy,-r0,ex,ey,r1); +} diff --git a/Task/Draw-a-clock/Go/draw-a-clock-1.go b/Task/Draw-a-clock/Go/draw-a-clock-1.go index 3b45a2348f..1dcf2cd406 100644 --- a/Task/Draw-a-clock/Go/draw-a-clock-1.go +++ b/Task/Draw-a-clock/Go/draw-a-clock-1.go @@ -1,88 +1,88 @@ package main import ( - "golang.org/x/net/websocket" - "flag" - "fmt" - "html/template" - "io" - "math" - "net/http" - "time" + "golang.org/x/net/websocket" + "flag" + "fmt" + "html/template" + "io" + "math" + "net/http" + "time" ) var ( - Portnum string - Hostsite string + Portnum string + Hostsite string ) type PageSettings struct { - Host string - Port string + Host string + Port string } const ( - Canvaswidth = 512 - Canvasheight = 512 - //color constants - HourColor = "#ff7373" // pinkish - MinuteColor = "#00b7e4" //light blue - SecondColor = "#b58900" //gold + Canvaswidth = 512 + Canvasheight = 512 + //color constants + HourColor = "#ff7373" // pinkish + MinuteColor = "#00b7e4" //light blue + SecondColor = "#b58900" //gold ) func main() { - flag.StringVar(&Portnum, "Port", "1234", "Port to host server.") - flag.StringVar(&Hostsite, "Site", "localhost", "Site hosting server") - flag.Parse() - http.HandleFunc("/", webhandler) - http.Handle("/ws", websocket.Handler(wshandle)) - err := http.ListenAndServe(Hostsite+":"+Portnum, nil) - if err != nil { - fmt.Println(err) - } - fmt.Println("server running") + flag.StringVar(&Portnum, "Port", "1234", "Port to host server.") + flag.StringVar(&Hostsite, "Site", "localhost", "Site hosting server") + flag.Parse() + http.HandleFunc("/", webhandler) + http.Handle("/ws", websocket.Handler(wshandle)) + err := http.ListenAndServe(Hostsite+":"+Portnum, nil) + if err != nil { + fmt.Println(err) + } + fmt.Println("server running") } func webhandler(w http.ResponseWriter, r *http.Request) { - wsurl := PageSettings{Host: Hostsite, Port: Portnum} - template, _ := template.ParseFiles("clock.html") - template.Execute(w, wsurl) + wsurl := PageSettings{Host: Hostsite, Port: Portnum} + template, _ := template.ParseFiles("clock.html") + template.Execute(w, wsurl) } //Given a websocket connection, //serves updating time function func wshandle(ws *websocket.Conn) { - for { - hour, min, sec := time.Now().Clock() - hourx, houry := HourCords(hour, Canvasheight/2) - minx, miny := MinSecCords(min, Canvasheight/2) - secx, secy := MinSecCords(sec, Canvasheight/2) - msg := "CLEAR\n" - msg += fmt.Sprintf("HOUR %d %d %s\n", hourx, houry, HourColor) - msg += fmt.Sprintf("MIN %d %d %s\n", minx, miny, MinuteColor) - msg += fmt.Sprintf("SEC %d %d %s", secx, secy, SecondColor) - io.WriteString(ws, msg) - time.Sleep(time.Second / 60.0) - } + for { + hour, min, sec := time.Now().Clock() + hourx, houry := HourCords(hour, Canvasheight/2) + minx, miny := MinSecCords(min, Canvasheight/2) + secx, secy := MinSecCords(sec, Canvasheight/2) + msg := "CLEAR\n" + msg += fmt.Sprintf("HOUR %d %d %s\n", hourx, houry, HourColor) + msg += fmt.Sprintf("MIN %d %d %s\n", minx, miny, MinuteColor) + msg += fmt.Sprintf("SEC %d %d %s", secx, secy, SecondColor) + io.WriteString(ws, msg) + time.Sleep(time.Second / 60.0) + } } //Given current minute or second time(i.e 30 min, 60 minutes) //and the radius, returns pair of cords to draw line to func MinSecCords(ctime int, radius int) (int, int) { - //converts min/sec to angle and then to radians + //converts min/sec to angle and then to radians - theta := ((float64(ctime)*6 - 90) * (math.Pi / 180)) - x := float64(radius) * math.Cos(theta) - y := float64(radius) * math.Sin(theta) - return int(x) + 256, int(y) + 256 + theta := ((float64(ctime)*6 - 90) * (math.Pi / 180)) + x := float64(radius) * math.Cos(theta) + y := float64(radius) * math.Sin(theta) + return int(x) + 256, int(y) + 256 } //Given current hour time(i.e. 12, 8) and the radius, //returns pair of cords to draw line to func HourCords(ctime int, radius int) (int, int) { - //converts hours to angle and then to radians - theta := ((float64(ctime)*30 - 90) * (math.Pi / 180)) - x := float64(radius) * math.Cos(theta) - y := float64(radius) * math.Sin(theta) - return int(x) + 256, int(y) + 256 + //converts hours to angle and then to radians + theta := ((float64(ctime)*30 - 90) * (math.Pi / 180)) + x := float64(radius) * math.Cos(theta) + y := float64(radius) * math.Sin(theta) + return int(x) + 256, int(y) + 256 } diff --git a/Task/Draw-a-clock/Go/draw-a-clock-2.go b/Task/Draw-a-clock/Go/draw-a-clock-2.go index 5dad3296a3..fd18474571 100644 --- a/Task/Draw-a-clock/Go/draw-a-clock-2.go +++ b/Task/Draw-a-clock/Go/draw-a-clock-2.go @@ -10,10 +10,10 @@ var hourhand; function wsConnect() { - //get contexts for drawing + //get contexts for drawing //var canvas = document.getElementById( "canvas" ); //ctx = canvas.getContext( '2d' ); - var canvas = document.getElementById("rim"); + var canvas = document.getElementById("rim"); //draw circle for rim rim = canvas.getContext('2d'); rim.beginPath(); @@ -83,19 +83,19 @@

Clock

- + Sorry, your browser does not support Canvas - + Sorry, your browser does not support Canvas - + Sorry, your browser does not support Canvas - + Sorry, your browser does not support Canvas - + diff --git a/Task/Draw-a-clock/JavaScript/draw-a-clock-1.js b/Task/Draw-a-clock/JavaScript/draw-a-clock-1.js index 4a3b8b27f0..62e1f5b9f7 100644 --- a/Task/Draw-a-clock/JavaScript/draw-a-clock-1.js +++ b/Task/Draw-a-clock/JavaScript/draw-a-clock-1.js @@ -1,47 +1,47 @@ var sec_old = 0; function update_clock() { - var t = new Date(); - var arms = [t.getHours(), t.getMinutes(), t.getSeconds()]; - if (arms[2] == sec_old) return; - sec_old = arms[2]; + var t = new Date(); + var arms = [t.getHours(), t.getMinutes(), t.getSeconds()]; + if (arms[2] == sec_old) return; + sec_old = arms[2]; - var c = document.getElementById('clock'); - var ctx = c.getContext('2d'); - ctx.fillStyle = "rgb(0,200,200)"; - ctx.fillRect(0, 0, c.width, c.height); - ctx.fillStyle = "white"; - ctx.fillRect(3, 3, c.width - 6, c.height - 6); - ctx.lineCap = 'round'; + var c = document.getElementById('clock'); + var ctx = c.getContext('2d'); + ctx.fillStyle = "rgb(0,200,200)"; + ctx.fillRect(0, 0, c.width, c.height); + ctx.fillStyle = "white"; + ctx.fillRect(3, 3, c.width - 6, c.height - 6); + ctx.lineCap = 'round'; - var orig = { x: c.width / 2, y: c.height / 2 }; - arms[1] += arms[2] / 60; - arms[0] += arms[1] / 60; - draw_arm(ctx, orig, arms[0] * 30, c.width/2.5 - 15, c.width / 20, "green"); - draw_arm(ctx, orig, arms[1] * 6, c.width/2.2 - 10, c.width / 30, "navy"); - draw_arm(ctx, orig, arms[2] * 6, c.width/2.0 - 6, c.width / 100, "maroon"); + var orig = { x: c.width / 2, y: c.height / 2 }; + arms[1] += arms[2] / 60; + arms[0] += arms[1] / 60; + draw_arm(ctx, orig, arms[0] * 30, c.width/2.5 - 15, c.width / 20, "green"); + draw_arm(ctx, orig, arms[1] * 6, c.width/2.2 - 10, c.width / 30, "navy"); + draw_arm(ctx, orig, arms[2] * 6, c.width/2.0 - 6, c.width / 100, "maroon"); } function draw_arm(ctx, orig, deg, len, w, style) { - ctx.save(); - ctx.lineWidth = w; - ctx.lineCap = 'round'; - ctx.translate(orig.x, orig.y); - ctx.rotate((deg - 90) * Math.PI / 180); - ctx.strokeStyle = style; - ctx.beginPath(); - ctx.moveTo(-len / 10, 0); - ctx.lineTo(len, 0); - ctx.stroke(); - ctx.restore(); + ctx.save(); + ctx.lineWidth = w; + ctx.lineCap = 'round'; + ctx.translate(orig.x, orig.y); + ctx.rotate((deg - 90) * Math.PI / 180); + ctx.strokeStyle = style; + ctx.beginPath(); + ctx.moveTo(-len / 10, 0); + ctx.lineTo(len, 0); + ctx.stroke(); + ctx.restore(); } function init_clock() { - var clock = document.createElement('canvas'); - clock.width = 100; - clock.height = 100; - clock.id = "clock"; - document.body.appendChild(clock); + var clock = document.createElement('canvas'); + clock.width = 100; + clock.height = 100; + clock.id = "clock"; + document.body.appendChild(clock); - window.setInterval(update_clock, 200); + window.setInterval(update_clock, 200); } diff --git a/Task/Draw-a-clock/Julia/draw-a-clock.julia b/Task/Draw-a-clock/Julia/draw-a-clock.jl similarity index 100% rename from Task/Draw-a-clock/Julia/draw-a-clock.julia rename to Task/Draw-a-clock/Julia/draw-a-clock.jl diff --git a/Task/Draw-a-clock/Kotlin/draw-a-clock.kotlin b/Task/Draw-a-clock/Kotlin/draw-a-clock.kts similarity index 100% rename from Task/Draw-a-clock/Kotlin/draw-a-clock.kotlin rename to Task/Draw-a-clock/Kotlin/draw-a-clock.kts diff --git a/Task/Draw-a-clock/M2000-Interpreter/draw-a-clock.m2000 b/Task/Draw-a-clock/M2000-Interpreter/draw-a-clock.m2000 index 365ce205dd..8d8e6c0c7b 100644 --- a/Task/Draw-a-clock/M2000-Interpreter/draw-a-clock.m2000 +++ b/Task/Draw-a-clock/M2000-Interpreter/draw-a-clock.m2000 @@ -5,89 +5,89 @@ cls, 0 window 6, window Module Led_Clock{ - Escape Off - Smooth off - Dim D(-1 to 9) - D(-1)=(0,0,0,0,0,0,0) - D(0)=(1,1,1,0,1,1,1) - D(1)=(0,0,1,0,0,1,0) - D(2)=(1,0,1,1,1,0,1) - D(3)=(1,0,1,1,0,1,1) - D(4)=(0,1,1,1,0,1,0) - D(5)=(1,1,0,1,0,1,1) - D(6)=(1,1,0,1,1,1,1) - D(7)=(1,0,1,0,0,1,0) - D(8)=(1,1,1,1,1,1,1) - D(9)=(1,1,1,1,0,1,1) - N=240 - XX=(scale.x-N*75) div 2 - YY=scale.y-N*22 - NN=N - BackColor=0 - CLS BackColor, 0 - Back {CLS BackColor,0} - desktop 255, BackColor - Forecolor=12 - C=BackColor-Forecolor - pen BackColor - for i=0 to 9: cc=d(i): cc*=c:next - m=1 - move XX+N*23.2, YY+N*5.2 - polygon BackColor-C, N,-N, N,N, -N, N, -N, -N - move XX+N*23.2,YY+N*13.2 - polygon BackColor-C, N,-N, N,N, -N, N, -N, -N - move XX+N*49.2,YY+N*5.2 - polygon BackColor-C, N,-N, N,N, -N, N, -N, -N - move XX+N*49.2,YY+N*13.2 - polygon BackColor-C, N,-N, N,N, -N, N, -N, -N - dsk=True - every 1000/2 { - k=now - k1=val(str$(k, "hh")) - k2=val(str$(k, "nn")) - k3=val(str$(k, "ss")) - LED(XX, D(k1 div 10)) - LED(XX+N*12, D(k1 mod 10)) - LED(XX+N*26, D(k2 div 10)) - LED(XX+N*38, D(k2 mod 10)) - LED(XX+N*52, D(k3 div 10)) - LED(XX+N*64, D(k3 mod 10)) - refresh 1000 - if keypress(32) then - dsk~ - if dsk then desktop 255 else desktop 255, BackColor - end if - if keypress(27) or mouse=2 then exit - } - desktop 255 - pen 14 - refresh 50 - mode 16 - wait 1000 - Escape On + Escape Off + Smooth off + Dim D(-1 to 9) + D(-1)=(0,0,0,0,0,0,0) + D(0)=(1,1,1,0,1,1,1) + D(1)=(0,0,1,0,0,1,0) + D(2)=(1,0,1,1,1,0,1) + D(3)=(1,0,1,1,0,1,1) + D(4)=(0,1,1,1,0,1,0) + D(5)=(1,1,0,1,0,1,1) + D(6)=(1,1,0,1,1,1,1) + D(7)=(1,0,1,0,0,1,0) + D(8)=(1,1,1,1,1,1,1) + D(9)=(1,1,1,1,0,1,1) + N=240 + XX=(scale.x-N*75) div 2 + YY=scale.y-N*22 + NN=N + BackColor=0 + CLS BackColor, 0 + Back {CLS BackColor,0} + desktop 255, BackColor + Forecolor=12 + C=BackColor-Forecolor + pen BackColor + for i=0 to 9: cc=d(i): cc*=c:next + m=1 + move XX+N*23.2, YY+N*5.2 + polygon BackColor-C, N,-N, N,N, -N, N, -N, -N + move XX+N*23.2,YY+N*13.2 + polygon BackColor-C, N,-N, N,N, -N, N, -N, -N + move XX+N*49.2,YY+N*5.2 + polygon BackColor-C, N,-N, N,N, -N, N, -N, -N + move XX+N*49.2,YY+N*13.2 + polygon BackColor-C, N,-N, N,N, -N, N, -N, -N + dsk=True + every 1000/2 { + k=now + k1=val(str$(k, "hh")) + k2=val(str$(k, "nn")) + k3=val(str$(k, "ss")) + LED(XX, D(k1 div 10)) + LED(XX+N*12, D(k1 mod 10)) + LED(XX+N*26, D(k2 div 10)) + LED(XX+N*38, D(k2 mod 10)) + LED(XX+N*52, D(k3 div 10)) + LED(XX+N*64, D(k3 mod 10)) + refresh 1000 + if keypress(32) then + dsk~ + if dsk then desktop 255 else desktop 255, BackColor + end if + if keypress(27) or mouse=2 then exit + } + desktop 255 + pen 14 + refresh 50 + mode 16 + wait 1000 + Escape On - sub LED(XX, S()) - move XX+N*1.2, YY+NN - \\ LED - UPPER - polygon BackColor-S(0), N,-N,N*6,0, N,N, -N, N,-N*6,0, -N, -N - \\ LED | LEFT UPPER - move XX+N*1.2-N*1.2, YY+N*1.2+NN - polygon BackColor-S(1), N,-N,N,N,0,N*6,-N, N, -N, -N, 0, -N*6 - move XX+N*1.2+N*7.2, YY+N*1.2+NN - \\ LED | RIGHT UPPER - polygon BackColor-S(2), N,-N,N,N,0,N*6,-N, N, -N, -N, 0, -N*6 - move XX+N*1.2, YY+N*8.4+NN - \\ LED - MIDDLE - polygon BackColor-S(3), N,-N,N*6,0, N,N, -N, N,-N*6,0, -N, -N - \\ LED | LEFT BOTTOM - move XX+N*1.2-N*1.2, YY+N*9.6+NN - polygon BackColor-S(4), N,-N,N,N,0,N*6,-N, N, -N, -N, 0, -N*6 - \\ LED | RIGHT BOTTOM - move XX+N*1.2+N*7.2, YY+N*9.6+NN - polygon BackColor-S(5), N,-N,N,N,0,N*6,-N, N, -N, -N, 0, -N*6 - \\ LED - BOTTOM - move XX+N*1.2, YY+N*16.8+NN - polygon BackColor-S(6), N,-N,N*6,0, N,N, -N, N,-N*6,0, -N, -N - end sub + sub LED(XX, S()) + move XX+N*1.2, YY+NN + \\ LED - UPPER + polygon BackColor-S(0), N,-N,N*6,0, N,N, -N, N,-N*6,0, -N, -N + \\ LED | LEFT UPPER + move XX+N*1.2-N*1.2, YY+N*1.2+NN + polygon BackColor-S(1), N,-N,N,N,0,N*6,-N, N, -N, -N, 0, -N*6 + move XX+N*1.2+N*7.2, YY+N*1.2+NN + \\ LED | RIGHT UPPER + polygon BackColor-S(2), N,-N,N,N,0,N*6,-N, N, -N, -N, 0, -N*6 + move XX+N*1.2, YY+N*8.4+NN + \\ LED - MIDDLE + polygon BackColor-S(3), N,-N,N*6,0, N,N, -N, N,-N*6,0, -N, -N + \\ LED | LEFT BOTTOM + move XX+N*1.2-N*1.2, YY+N*9.6+NN + polygon BackColor-S(4), N,-N,N,N,0,N*6,-N, N, -N, -N, 0, -N*6 + \\ LED | RIGHT BOTTOM + move XX+N*1.2+N*7.2, YY+N*9.6+NN + polygon BackColor-S(5), N,-N,N,N,0,N*6,-N, N, -N, -N, 0, -N*6 + \\ LED - BOTTOM + move XX+N*1.2, YY+N*16.8+NN + polygon BackColor-S(6), N,-N,N*6,0, N,N, -N, N,-N*6,0, -N, -N + end sub } Led_Clock diff --git a/Task/Draw-a-clock/MiniScript/draw-a-clock.mini b/Task/Draw-a-clock/MiniScript/draw-a-clock.mini index f9d7b1464c..9233919be6 100644 --- a/Task/Draw-a-clock/MiniScript/draw-a-clock.mini +++ b/Task/Draw-a-clock/MiniScript/draw-a-clock.mini @@ -21,6 +21,6 @@ display(4).sprites.push hand // main loop while true - hand.rotation = 90 - floor(time) % 60 * 6 - wait + hand.rotation = 90 - floor(time) % 60 * 6 + wait end while diff --git a/Task/Draw-a-clock/OCaml/draw-a-clock-1.ocaml b/Task/Draw-a-clock/OCaml/draw-a-clock-1.ml similarity index 100% rename from Task/Draw-a-clock/OCaml/draw-a-clock-1.ocaml rename to Task/Draw-a-clock/OCaml/draw-a-clock-1.ml diff --git a/Task/Draw-a-clock/OCaml/draw-a-clock-2.ocaml b/Task/Draw-a-clock/OCaml/draw-a-clock-2.ml similarity index 100% rename from Task/Draw-a-clock/OCaml/draw-a-clock-2.ocaml rename to Task/Draw-a-clock/OCaml/draw-a-clock-2.ml diff --git a/Task/Draw-a-clock/OPL/draw-a-clock.opl b/Task/Draw-a-clock/OPL/draw-a-clock.opl new file mode 100644 index 0000000000..fbb6eccc6e --- /dev/null +++ b/Task/Draw-a-clock/OPL/draw-a-clock.opl @@ -0,0 +1,6 @@ +REM Series 3a and Series 5 use different modes. This version runs on Series 3a. For Series 5, remove the "2" in the gCLOCK line. + +PROC main: + gCLOCK ON,$29 + GET +ENDP diff --git a/Task/Draw-a-clock/Odin/draw-a-clock.odin b/Task/Draw-a-clock/Odin/draw-a-clock.odin new file mode 100644 index 0000000000..f1fd0e6408 --- /dev/null +++ b/Task/Draw-a-clock/Odin/draw-a-clock.odin @@ -0,0 +1,87 @@ +package clock + +import rl "vendor:raylib" +import "core:time" +import "core:time/datetime" +import "core:time/timezone" +import "core:os" +import "core:math" + +TimePeriod :: enum { + AM, + PM +} + +DistanceAngle :: proc(distance: f32, angle: f32) -> (vector: rl.Vector2) { + vector.x = math.sin_f32(angle) + vector.y = -math.cos_f32(angle) + vector *= distance + + return +} + +main :: proc() { + tz, ok := timezone.region_load("local") + + rl.SetConfigFlags({.MSAA_4X_HINT}) + rl.InitWindow(640, 480, "Rosetta Code - draw a clock") + + screen_center := rl.Vector2 {f32(rl.GetScreenWidth()) / 2, f32(rl.GetScreenHeight()) / 2} + + for !rl.WindowShouldClose() { + rl.BeginDrawing() + + rl.ClearBackground(rl.RAYWHITE) + + conversion_succeeded: bool = true + date_time: datetime.DateTime + date_time, ok = time.time_to_datetime(time.now()) + if !ok do conversion_succeeded = false + + date_time, ok = timezone.datetime_to_tz(date_time, tz) + if !ok do conversion_succeeded = false + + regular_time: time.Time + regular_time, ok = time.datetime_to_time(date_time) + if !ok do conversion_succeeded = false + + if !conversion_succeeded do os.exit(1) + + period: TimePeriod + hour, min, sec := time.clock_from_time(regular_time) + if hour > 12 { + hour -= 12 + period = .PM + } + + radius := f32(rl.GetScreenHeight()) / 2.5 + + rl.DrawCircleV(screen_center, radius, rl.LIGHTGRAY) + + rl.DrawLineEx(screen_center, screen_center + DistanceAngle(radius * .75, (f32(hour) / 12) * math.TAU), 4, rl.BLACK) + rl.DrawLineEx(screen_center, screen_center + DistanceAngle(radius * .7, (f32(min) / 60) * math.TAU), 4, rl.DARKGREEN) + rl.DrawLineEx(screen_center, screen_center + DistanceAngle(radius * .5, (f32(sec) / 60) * math.TAU), 4, rl.RED) + + for i := 0; i < 60; i += 1 { + angle := (f32(i) / 60) * math.TAU + + inside_distance: f32 = .8 + thickness: f32 = 1.5 + + if i % 5 == 0 { + inside_distance = .775 + thickness = 3 + } + + rl.DrawLineEx(screen_center + DistanceAngle(radius * inside_distance, angle), screen_center + DistanceAngle(radius * .95, angle), thickness, rl.DARKGRAY) + } + + //fmt.printfln("%2d:%2d:%2d %s", hour, min, sec, period) + + rl.EndDrawing() + } + + rl.CloseWindow() + + timezone.region_destroy(tz) +} diff --git a/Task/Draw-a-clock/Perl/draw-a-clock.pl b/Task/Draw-a-clock/Perl/draw-a-clock-1.pl similarity index 100% rename from Task/Draw-a-clock/Perl/draw-a-clock.pl rename to Task/Draw-a-clock/Perl/draw-a-clock-1.pl diff --git a/Task/Draw-a-clock/Perl/draw-a-clock-2.pl b/Task/Draw-a-clock/Perl/draw-a-clock-2.pl new file mode 100644 index 0000000000..3cf966a4c3 --- /dev/null +++ b/Task/Draw-a-clock/Perl/draw-a-clock-2.pl @@ -0,0 +1,22 @@ +#!/usr/bin/perl + +use strict; # https://rosettacode.org/wiki/Draw_a_clock +use warnings; +use Tk; + +my $halfsize = 200; +my $twopi = 2 * atan2 0, -1; +my $mw = MainWindow->new; +my $c = $mw->Canvas( -width => 2 * $halfsize, -height => 2 * $halfsize)->pack; +$mw->repeat(1000 => \&draw); +MainLoop; + +sub draw + { + $c->delete('all'); + my $angle = time % 60 / 60 * $twopi; + $c->createLine( $halfsize, $halfsize, + $halfsize * (1 + sin $angle), + $halfsize * (1 - cos $angle), + -width => 5); + } diff --git a/Task/Draw-a-clock/Quackery/draw-a-clock.quackery b/Task/Draw-a-clock/Quackery/draw-a-clock.quackery new file mode 100644 index 0000000000..244a974556 --- /dev/null +++ b/Task/Draw-a-clock/Quackery/draw-a-clock.quackery @@ -0,0 +1,77 @@ + [ $ "turtleduck.qky" loadfile + $ "bigrat.qky" loadfile ] now! + + [ $ \ +import datetime +sec = datetime.timedelta(seconds=1) +time_will_be = datetime.datetime.now()+sec +hours = time_will_be.hour +minutes = time_will_be.minute +seconds = time_will_be.second +to_stack([hours, minutes, seconds]) +\ python ] is time+1 ( --> [ ) + + + [ $ \ +import time +current_time = time.time() +time_to_sleep = 1.0 - (current_time % 1.0) +time.sleep(time_to_sleep) +\ python ] is wait ( --> ) + + [ 3 wide + 60 times + [ 240 1 fly + 10 1 walk + -250 1 fly + 1 60 turn ] + 7 wide + 12 times + [ 235 1 fly + 12 1 walk + -247 1 fly + 1 12 turn ] + 9 wide + 4 times + [ 233 1 fly + 14 1 walk + -247 1 fly + 1 4 turn ] + 1 wide + ' [ 0 0 0 ] fill + [ 10 1 circle ] ] is face ( --> ) + + [ 12 wide + unpack rot dip + [ 43200 rot + 720 v+ ] + 12 v+ + 2dup turn + 175 1 walk + -175 1 fly + -v turn ] is hour ( [ --> ) + + [ 8 wide + unpack rot drop + 3600 rot + 60 v+ + 2dup turn + 200 1 walk + -200 1 fly + -v turn ] is minute ( [ --> ) + + [ 4 wide + 2 peek + dup 60 turn + 225 1 walk + -225 1 fly + negate 60 turn ] is second ( [ --> ) + + [ turtle + 0 frames + [ clear -1 4 turn + face + time+1 dup dup + second minute hour + wait + frame 1 4 turn again ] ] is clock ( --> ) diff --git a/Task/Draw-a-clock/Raku/draw-a-clock.raku b/Task/Draw-a-clock/Raku/draw-a-clock-1.raku similarity index 100% rename from Task/Draw-a-clock/Raku/draw-a-clock.raku rename to Task/Draw-a-clock/Raku/draw-a-clock-1.raku diff --git a/Task/Draw-a-clock/Raku/draw-a-clock-2.raku b/Task/Draw-a-clock/Raku/draw-a-clock-2.raku new file mode 100644 index 0000000000..6ec39305ad --- /dev/null +++ b/Task/Draw-a-clock/Raku/draw-a-clock-2.raku @@ -0,0 +1,11 @@ +constant @t = < ⡎⢉⢵ ⠀⢺⠀ ⠊⠉⡱ ⠊⣉⡱ ⢀⠔⡇ ⣏⣉⡉ ⣎⣉⡁ ⠊⢉⠝ ⢎⣉⡱ ⡎⠉⢱ ⠀⠶⠀>; +constant @b = < ⢗⣁⡸ ⢀⣸⣀ ⣔⣉⣀ ⢄⣀⡸ ⠉⠉⡏ ⢄⣀⡸ ⢇⣀⡸ ⢰⠁⠀ ⢇⣀⡸ ⢈⣉⡹ ⠀⠶⠀>; + +signal(SIGINT).tap: { print "\e[?25h\n"; exit } +print "\e7\e[?25l"; # saves cursor position, make it invisible +loop { + my @x = DateTime.now.Str.substr(11,8).ords X- ord('0'); + put ~.[@x] for @t, @b; + sleep 1; + print "\e8"; # restores cursor position +} diff --git a/Task/Draw-a-clock/Raku/draw-a-clock-3.raku b/Task/Draw-a-clock/Raku/draw-a-clock-3.raku new file mode 100644 index 0000000000..cd67d3a521 --- /dev/null +++ b/Task/Draw-a-clock/Raku/draw-a-clock-3.raku @@ -0,0 +1,10 @@ +print "\e7"; +loop { + my $time = DateTime.now; + put '#' x $_ ~ '.' x (24 - $_) given $time.hour.round; + put '#' x $_ ~ '.' x (60 - $_) given $time.minute.round; + put '#' x $_ ~ '.' x (60 - $_) given $time.second.round; + sleep 1; + print "\e8"; +} +END put "\n"; diff --git a/Task/Draw-a-clock/Rebol/draw-a-clock.rebol b/Task/Draw-a-clock/Rebol/draw-a-clock.rebol new file mode 100644 index 0000000000..6c3403e1bd --- /dev/null +++ b/Task/Draw-a-clock/Rebol/draw-a-clock.rebol @@ -0,0 +1,26 @@ +Rebol [ + title: "Rosetta code: Draw a clock (CLI)" + file: %Draw_a_clock.r3 + url: https://rosettacode.org/wiki/Draw_a_clock +] + +;; two spaced-separated blocks of Braille-like glyphs (top and bottom halves for digits 0-9 and separator) +s: join { ⡎⢉⢵ ⠀⢺⠀ ⠊⠉⡱ ⠊⣉⡱ ⢀⠔⡇ ⣏⣉⡉ ⣎⣉⡁ ⠊⢉⠝ ⢎⣉⡱ ⡎⠉⢱ ⠀⠶ } + { ⢗⣁⡸ ⢀⣸⣀ ⣔⣉⣀ ⢄⣀⡸ ⠉⠉⡏ ⢄⣀⡸ ⢇⣀⡸ ⢰⠁⠀ ⢇⣀⡸ ⢈⣉⡹ ⠀⠶ } +;; split the big string every 4 chars to get a block of 22 glyph cells (11 top + 11 bottom) +s: split s 4 + +forever [ ;; loop to update the clock every second + tm: format-date-time now "hh:mm:ss" ;; current time string, e.g., "12:34:56" + l1: clear "" ;; buffer for the top line of the big digits + l2: clear "" ;; buffer for the bottom line of the big digits + foreach c tm [ ;; for each character in the time string + i: 1 + c - #"0" ;; convert digit char to 1-based index + append l1 s/(i) ;; append top-half glyph for the digit (for ":" this will intentionally pick the separator at index 11) + append l2 s/(i + 11) ;; append bottom-half glyph (offset by 11 to access the lower row set) + ] + print l1 ;; print top line of large digits + print l2 ;; print bottom line of large digits + wait 1 ;; pause one second + prin "^[[2A" ;; move cursor up 2 lines (ANSI escape) to overwrite in place next iteration +] diff --git a/Task/Draw-a-clock/Red/draw-a-clock-2.red b/Task/Draw-a-clock/Red/draw-a-clock-2.red index 7d9f1c70e7..54e7b08da4 100644 --- a/Task/Draw-a-clock/Red/draw-a-clock-2.red +++ b/Task/Draw-a-clock/Red/draw-a-clock-2.red @@ -1,6 +1,6 @@ Red [ - Needs: 'View - Purpose: {simple analog clock based on Nenad Rakocevic's eve-clock.red, + Needs: 'View + Purpose: {simple analog clock based on Nenad Rakocevic's eve-clock.red, see http://www.red-lang.org/2016/07/eve-style-clock-demo-in-red-livecoded.html} ] diff --git a/Task/Draw-a-clock/Ring/draw-a-clock.ring b/Task/Draw-a-clock/Ring/draw-a-clock.ring new file mode 100644 index 0000000000..2423676512 --- /dev/null +++ b/Task/Draw-a-clock/Ring/draw-a-clock.ring @@ -0,0 +1,96 @@ +# Author: Gal Zsolt (CalmoSoft) +load "libsdl.ring" +load "stdlibcore.ring" + +# Settings +screen_w = 640 +screen_h = 480 +xp = screen_w/2 +yp = screen_h/2 +size = 200 +pi = 3.14159265 + +sdl_init(SDL_INIT_EVERYTHING) +window = sdl_createwindow("Analog Clock - CalmoSoft", 100, 100, screen_w, screen_h, SDL_WINDOW_SHOWN) +render = sdl_createrenderer(window, -1, SDL_RENDERER_ACCELERATED) +ev = sdl_new_sdl_event() + +while true + # Event handling + sdl_pollevent(ev) + if sdl_get_sdl_event_type(ev) = SDL_QUIT exit ok + + # Get system time + t = time() + h = 0 + substr(t,1,2) + m = 0 + substr(t,4,2) + s = 0 + substr(t,7,2) + + # Clear background (Black) + sdl_setrenderdrawcolor(render, 0, 0, 0, 255) + sdl_renderclear(render) + + # Draw the clock components + draw_clock(render, xp, yp, size, h, m, s, pi) + + sdl_renderpresent(render) + sdl_delay(100) +end + +# Clean up +sdl_destroyrenderer(render) +sdl_destroywindow(window) +sdl_quit() + +func draw_clock render, x, y, r, h, m, s, pi + # 1. Draw Clock Face (White circle outline) + sdl_setrenderdrawcolor(render, 255, 255, 255, 255) + for i = 0 to 360 step 1 + angle = i * pi / 180 + sdl_renderdrawpoint(render, x + r * cos(angle), y + r * sin(angle)) + next + + # 2. Draw Hour Markers (Ticks) + sdl_setrenderdrawcolor(render, 255, 255, 255, 255) + for i = 1 to 12 + angle = i * 30 * pi / 180 + x1 = x + r * 0.95 * sin(angle) + y1 = y - r * 0.95 * cos(angle) + x2 = x + r * 0.85 * sin(angle) + y2 = y - r * 0.85 * cos(angle) + sdl_renderdrawline(render, x1, y1, x2, y2) + next + + # Calculate angles for hands + s_angle = (s / 60) * 2 * pi + m_angle = ((m + s/60) / 60) * 2 * pi + h_angle = ((h % 12 + m/60) / 12) * 2 * pi + + # 3. Draw Hands (Thickened) + + # Hour Hand (Green - thickest: 5px) + sdl_setrenderdrawcolor(render, 0, 255, 0, 255) + for i = -2 to 2 + sdl_renderdrawline(render, x+i, y+i, x + r*0.5*sin(h_angle)+i, y - r*0.5*cos(h_angle)+i) + next + + # Minute Hand (Blue - medium: 3px) + sdl_setrenderdrawcolor(render, 0, 100, 255, 255) + for i = -1 to 1 + sdl_renderdrawline(render, x+i, y+i, x + r*0.8*sin(m_angle)+i, y - r*0.8*cos(m_angle)+i) + next + + # Second Hand (Red - 2px) + sdl_setrenderdrawcolor(render, 255, 0, 0, 255) + for i = 0 to 1 + sdl_renderdrawline(render, x+i, y+i, x + r*0.9*sin(s_angle)+i, y - r*0.9*cos(s_angle)+i) + next + + # 4. Center Cap (Axis) + sdl_setrenderdrawcolor(render, 200, 200, 200, 255) + for i = 0 to 360 step 10 + angle = i * pi / 180 + for radius = 0 to 5 + sdl_renderdrawpoint(render, x + radius * cos(angle), y + radius * sin(angle)) + next + next diff --git a/Task/Draw-a-clock/Run-BASIC/draw-a-clock.basic b/Task/Draw-a-clock/Run-BASIC/draw-a-clock.basic index ba1d79746f..db2e14893c 100644 --- a/Task/Draw-a-clock/Run-BASIC/draw-a-clock.basic +++ b/Task/Draw-a-clock/Run-BASIC/draw-a-clock.basic @@ -1,10 +1,10 @@ ' -------------------------------------------- ' clock. I got nothing but time ' --------------------------------------------- -n = 12 ' num of points -r = 95 ' radius -pi = 22/7 -alpha = pi * 2 / n +n = 12 ' num of points +r = 95 ' radius +pi = 22/7 +alpha = pi * 2 / n dim points(n) graphic #g2, 200, 200 ' -------------------------------------- @@ -22,58 +22,58 @@ graphic #g2, 200, 200 #g2 place(90,185) #g2 "\6" for i = 0 to n - 1 - theta = alpha * i - px = cos( theta ) * r - py = sin( theta ) * r - px = px + 100 - py = py + 100 - #g2 place(px,py) - #g2 circle(2) + theta = alpha * i + px = cos( theta ) * r + py = sin( theta ) * r + px = px + 100 + py = py + 100 + #g2 place(px,py) + #g2 circle(2) next i [shoTime] ' ------------------------- ' clear previous sec,min,hr ' ------------------------- -r = 63 -p = se +r = 63 +p = se #g2 color("white") gosub [h2Dot] -r = 50 -p = mi +r = 50 +p = mi #g2 color("white") gosub [h2Dot] -r = 30 ' radius -p = hr * 5 +r = 30 ' radius +p = hr * 5 #g2 color("white") gosub [h2Dot] ' ------------------------- ' Show new time ' ------------------------- -a$ = time$() -hr = val(word$(a$,1,":")) -mi = val(word$(a$,2,":")) -se = val(word$(a$,3,":")) +a$ = time$() +hr = val(word$(a$,1,":")) +mi = val(word$(a$,2,":")) +se = val(word$(a$,3,":")) ' put time on the clock - gimme a hand #g2 size(4) ' second hand -n = 60 -r = 63 -p = se +n = 60 +r = 63 +p = se #g2 color("blue") gosub [h2Dot] ' minute hand -r = 50 -p = mi +r = 50 +p = mi #g2 color("green") gosub [h2Dot] ' hour hand -r = 30 ' radius -p = hr * 5 +r = 30 ' radius +p = hr * 5 #g2 color("red") gosub [h2Dot] @@ -82,13 +82,13 @@ end ' a one liner [h2Dot] -alpha = pi * 2 / n -i = p - 15 -theta = alpha * i -px = cos( theta ) * r -py = sin( theta ) * r -px = px + 100 -py = py + 100 +alpha = pi * 2 / n +i = p - 15 +theta = alpha * i +px = cos( theta ) * r +py = sin( theta ) * r +px = px + 100 +py = py + 100 #g2 place(px,py) #g2 circle(2) #g2 line(100,100,px,py) diff --git a/Task/Draw-a-clock/Rust/draw-a-clock.rust b/Task/Draw-a-clock/Rust/draw-a-clock.rs similarity index 100% rename from Task/Draw-a-clock/Rust/draw-a-clock.rust rename to Task/Draw-a-clock/Rust/draw-a-clock.rs diff --git a/Task/Draw-a-clock/Scheme/draw-a-clock.ss b/Task/Draw-a-clock/Scheme/draw-a-clock.scm similarity index 100% rename from Task/Draw-a-clock/Scheme/draw-a-clock.ss rename to Task/Draw-a-clock/Scheme/draw-a-clock.scm diff --git a/Task/Draw-a-clock/Seed7/draw-a-clock.seed7 b/Task/Draw-a-clock/Seed7/draw-a-clock.seed7 index 21481fb4f6..8979c14f90 100644 --- a/Task/Draw-a-clock/Seed7/draw-a-clock.seed7 +++ b/Task/Draw-a-clock/Seed7/draw-a-clock.seed7 @@ -22,7 +22,7 @@ const proc: main is func screen(WINDOW_WIDTH, WINDOW_HEIGHT); clear(curr_win, BACKGROUND); KEYBOARD := GRAPH_KEYBOARD; - command := busy_getc(KEYBOARD); + command := getc(KEYBOARD, NO_WAIT); while command <> 'q' do start_time := truncToSecond(time(NOW)); clear(curr_win, BACKGROUND); @@ -64,8 +64,8 @@ const proc: main is func 100 + round(sin(alpha)*50.0), FOREGROUND); fcircle(100, 100, 7, CLOCKCOLOR); circle(100, 100, 7, FOREGROUND); - DRAW_FLUSH; + flushGraphic; await(start_time + 1 . SECONDS); - command := busy_getc(KEYBOARD); + command := getc(KEYBOARD, NO_WAIT); end while; end func; diff --git a/Task/Draw-a-clock/Tcl/draw-a-clock.tcl b/Task/Draw-a-clock/Tcl/draw-a-clock.tcl index 9facb5b050..807543cf21 100644 --- a/Task/Draw-a-clock/Tcl/draw-a-clock.tcl +++ b/Task/Draw-a-clock/Tcl/draw-a-clock.tcl @@ -13,9 +13,9 @@ proc updateClock t { set m [expr {$m + $s/60.0}] set h [expr {($h % 12 + $m/60.0) * 5}] foreach tag {hour minute second} value [list $h $m $s] len {50 80 80} { - .c coords $tag 100 100 \ - [expr {100 + $len*sin($value/30.0*3.14159)}] \ - [expr {100 - $len*cos($value/30.0*3.14159)}] + .c coords $tag 100 100 \ + [expr {100 + $len*sin($value/30.0*3.14159)}] \ + [expr {100 - $len*cos($value/30.0*3.14159)}] } } @@ -26,8 +26,8 @@ proc ticker {} { set t [clock seconds] after 250 ticker if {$t != $time} { - set time $t - updateClock $t + set time $t + updateClock $t } } ticker diff --git a/Task/Draw-a-clock/V-(Vlang)/draw-a-clock.v b/Task/Draw-a-clock/V-(Vlang)/draw-a-clock.v index dc23e77300..f09fa7b1a3 100644 --- a/Task/Draw-a-clock/V-(Vlang)/draw-a-clock.v +++ b/Task/Draw-a-clock/V-(Vlang)/draw-a-clock.v @@ -7,164 +7,164 @@ import math import time const ( - // All coordinates are designed for a clock size of this many pixel. - // You cannot change the size of the clock by adjusting this value. - design_size = 700 - center = 350 + // All coordinates are designed for a clock size of this many pixel. + // You cannot change the size of the clock by adjusting this value. + design_size = 700 + center = 350 - // Half the width of a tic-mark. - tw = 9 - // Height of a minute tic-mark. (hour is twice, 3-hour is thrice) - th = 25 - // Padding of tic-mark to window border - tp = 10 + // Half the width of a tic-mark. + tw = 9 + // Height of a minute tic-mark. (hour is twice, 3-hour is thrice) + th = 25 + // Padding of tic-mark to window border + tp = 10 - tic_color = gx.Color{ - r: 50 - g: 50 - b: 50 - } - hand_color = gx.black - second_hand_color = gx.red + tic_color = gx.Color{ + r: 50 + g: 50 + b: 50 + } + hand_color = gx.black + second_hand_color = gx.red ) struct App { - minutes_tic []f32 = [f32(center - tw), tp, center + tw, tp, center + tw, tp, center + tw, - tp + 1 * th, center - tw, tp + 1 * th] - hours_tic []f32 = [f32(center - tw), tp, center + tw, tp, center + tw, tp, center + tw, tp + 2 * th, - center - tw, tp + 2 * th] - hours3_tic []f32 = [f32(center - tw), tp, center + tw, tp, center + tw, tp, center + tw, tp + 3 * th, - center - tw, tp + 3 * th] + minutes_tic []f32 = [f32(center - tw), tp, center + tw, tp, center + tw, tp, center + tw, + tp + 1 * th, center - tw, tp + 1 * th] + hours_tic []f32 = [f32(center - tw), tp, center + tw, tp, center + tw, tp, center + tw, tp + 2 * th, + center - tw, tp + 2 * th] + hours3_tic []f32 = [f32(center - tw), tp, center + tw, tp, center + tw, tp, center + tw, tp + 3 * th, + center - tw, tp + 3 * th] - hour_hand []f32 = [f32(329), 161, 350, 140, 371, 161, 371, 413, 329, 413] - minute_hand []f32 = [f32(334.25), 40.25, 350, 24.5, 365.75, 40.25, 365.75, 427, 334.25, 427] - second_hand []f32 = [f32(345.8), 38.5, 350, 34.3, 354.2000, 38.5, 358.75, 427, 341.25, 427] - mut: - gg &gg.Context = unsafe { nil } - draw_flag bool = true - dpi_scale f32 = 1.0 + hour_hand []f32 = [f32(329), 161, 350, 140, 371, 161, 371, 413, 329, 413] + minute_hand []f32 = [f32(334.25), 40.25, 350, 24.5, 365.75, 40.25, 365.75, 427, 334.25, 427] + second_hand []f32 = [f32(345.8), 38.5, 350, 34.3, 354.2000, 38.5, 358.75, 427, 341.25, 427] + mut: + gg &gg.Context = unsafe { nil } + draw_flag bool = true + dpi_scale f32 = 1.0 } fn on_frame(mut app App) { - if !app.draw_flag { - return - } - app.gg.begin() + if !app.draw_flag { + return + } + app.gg.begin() - for i in 0 .. 60 { // draw minute tics - draw_convex_poly_rotate(mut app.gg, app.dpi_scale, app.minutes_tic, tic_color, - i * 6) - } - for i in 0 .. 12 { // hours - draw_convex_poly_rotate(mut app.gg, app.dpi_scale, app.hours_tic, tic_color, i * 30) - } - for i in 0 .. 4 { // 3 hours - draw_convex_poly_rotate(mut app.gg, app.dpi_scale, app.hours3_tic, tic_color, - i * 90) - } + for i in 0 .. 60 { // draw minute tics + draw_convex_poly_rotate(mut app.gg, app.dpi_scale, app.minutes_tic, tic_color, + i * 6) + } + for i in 0 .. 12 { // hours + draw_convex_poly_rotate(mut app.gg, app.dpi_scale, app.hours_tic, tic_color, i * 30) + } + for i in 0 .. 4 { // 3 hours + draw_convex_poly_rotate(mut app.gg, app.dpi_scale, app.hours3_tic, tic_color, + i * 90) + } - n := time.now() + n := time.now() - // draw hour hand - i := f32(n.hour) + f32(n.minute) / 60.0 - draw_convex_poly_rotate(mut app.gg, app.dpi_scale, app.hour_hand, hand_color, i * 30) + // draw hour hand + i := f32(n.hour) + f32(n.minute) / 60.0 + draw_convex_poly_rotate(mut app.gg, app.dpi_scale, app.hour_hand, hand_color, i * 30) - // draw minute hand - mut j := f32(n.minute) - if n.second == 59 { // make minute hand move smoothly - j += f32(math.sin(f32(n.microsecond) / 1e6 * math.pi / 2.0)) - } - draw_convex_poly_rotate(mut app.gg, app.dpi_scale, app.minute_hand, hand_color, j * 6) + // draw minute hand + mut j := f32(n.minute) + if n.second == 59 { // make minute hand move smoothly + j += f32(math.sin(f32(n.microsecond) / 1e6 * math.pi / 2.0)) + } + draw_convex_poly_rotate(mut app.gg, app.dpi_scale, app.minute_hand, hand_color, j * 6) - // draw second hand with smooth transition - k := f32(n.second) + f32(math.sin(f32(n.microsecond) / 1e6 * math.pi / 2.0)) - draw_convex_poly_rotate(mut app.gg, app.dpi_scale, app.second_hand, second_hand_color, - 0 + k * 6) + // draw second hand with smooth transition + k := f32(n.second) + f32(math.sin(f32(n.microsecond) / 1e6 * math.pi / 2.0)) + draw_convex_poly_rotate(mut app.gg, app.dpi_scale, app.second_hand, second_hand_color, + 0 + k * 6) - app.gg.end() + app.gg.end() } // Rotate a polygon round the centerpoint [manualfree] fn draw_convex_poly_rotate(mut ctx gg.Context, dpi_scale f32, points []f32, c gx.Color, angle f32) { - sa := math.sin(math.pi * angle / 180.0) - ca := math.cos(math.pi * angle / 180.0) + sa := math.sin(math.pi * angle / 180.0) + ca := math.cos(math.pi * angle / 180.0) - mut rotated_points := []f32{cap: points.len} - for i := 0; i < points.len / 2; i++ { - x := points[2 * i] - y := points[2 * i + 1] - xn := f32((x - center) * ca - (y - center) * sa) - yn := f32((x - center) * sa + (y - center) * ca) - rotated_points << (xn + center) * dpi_scale - rotated_points << (yn + center) * dpi_scale - } - ctx.draw_convex_poly(rotated_points, c) - unsafe { rotated_points.free() } + mut rotated_points := []f32{cap: points.len} + for i := 0; i < points.len / 2; i++ { + x := points[2 * i] + y := points[2 * i + 1] + xn := f32((x - center) * ca - (y - center) * sa) + yn := f32((x - center) * sa + (y - center) * ca) + rotated_points << (xn + center) * dpi_scale + rotated_points << (yn + center) * dpi_scale + } + ctx.draw_convex_poly(rotated_points, c) + unsafe { rotated_points.free() } } fn (mut app App) resize() { - size := gg.window_size() - // avoid calls when minimized - if size.width < 2 && size.height < 2 { - return - } - w := f32(size.width) / design_size - h := f32(size.height) / design_size - app.dpi_scale = if w < h { w } else { h } + size := gg.window_size() + // avoid calls when minimized + if size.width < 2 && size.height < 2 { + return + } + w := f32(size.width) / design_size + h := f32(size.height) / design_size + app.dpi_scale = if w < h { w } else { h } } fn on_event(e &gg.Event, mut app App) { - match e.typ { - .resized, .resumed { - app.resize() - } - .iconified { - app.draw_flag = false - } - .restored { - app.draw_flag = true - app.resize() - } - else { - if e.typ == .key_down { - match e.key_code { - .q { - println('Good bye.') - // do we need to free anything here? - app.gg.quit() - } - else {} - } - } - } - } + match e.typ { + .resized, .resumed { + app.resize() + } + .iconified { + app.draw_flag = false + } + .restored { + app.draw_flag = true + app.resize() + } + else { + if e.typ == .key_down { + match e.key_code { + .q { + println('Good bye.') + // do we need to free anything here? + app.gg.quit() + } + else {} + } + } + } + } } fn on_init(mut app App) { - app.resize() + app.resize() } fn main() { - println("Press 'q' to quit.") - mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf')) - $if android { - font_path = 'fonts/RobotoMono-Regular.ttf' - } + println("Press 'q' to quit.") + mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf')) + $if android { + font_path = 'fonts/RobotoMono-Regular.ttf' + } - mut app := &App{} + mut app := &App{} - app.gg = gg.new_context( - width: design_size - height: design_size - window_title: 'Clock!' - bg_color: gx.white - user_data: app - frame_fn: on_frame - event_fn: on_event - init_fn: on_init - font_path: font_path - ) + app.gg = gg.new_context( + width: design_size + height: design_size + window_title: 'Clock!' + bg_color: gx.white + user_data: app + frame_fn: on_frame + event_fn: on_event + init_fn: on_init + font_path: font_path + ) - app.gg.run() + app.gg.run() } diff --git a/Task/Draw-a-clock/VBScript/draw-a-clock.vb b/Task/Draw-a-clock/VBScript/draw-a-clock.vbs similarity index 100% rename from Task/Draw-a-clock/VBScript/draw-a-clock.vb rename to Task/Draw-a-clock/VBScript/draw-a-clock.vbs diff --git a/Task/Draw-a-clock/XPL0/draw-a-clock.xpl0 b/Task/Draw-a-clock/XPL0/draw-a-clock.xpl0 new file mode 100644 index 0000000000..bc2a9acaa1 --- /dev/null +++ b/Task/Draw-a-clock/XPL0/draw-a-clock.xpl0 @@ -0,0 +1,48 @@ +include xpllib; \for DrawCircle, DrawLine, LineWidth, MovePen, Deg2Rad +def X0=400, Y0=300; \center coordinate +int Hour, Minute, Second; + +proc DrawHand(Angle, Length, Width, Color); +real Angle, Length; +int Width, Color; +int X, Y; +[X:= fix(Length*Sin(Angle)); + Y:= fix(Length*Cos(Angle)); +LineWidth:= Width; +MovePen(X0, Y0); +DrawLine(X0+X, Y0-Y, Color); +]; + +proc DrawClock; \Show analog clock with current time +real Angle; +int N, X, Y; +[DrawCircle(X0, Y0, 299, LCyan, true); +Angle:= 0.; +for N:= 0 to 59 do \draw tick marks + [X:= fix(260.*Cos(Angle)); + Y:= fix(260.*Sin(Angle)); + DrawCircle(X+X0, Y+Y0, if rem(N/5) then 4 else 8, Black, true); + Angle:= Angle + 6.*Deg2Rad; + ]; +Angle:= float((Hour*60+Minute)/2) * Deg2Rad; +DrawHand(Angle, 210., 8, Black); +Angle:= float((Minute*60+Second)/10) * Deg2Rad; +DrawHand(Angle, 240., 5, Black); +Angle:= float(Second*6) * Deg2Rad; +DrawHand(Angle, 260., 3, LRed); +DrawCircle(X0, Y0, 8, Black, true); +]; + +int Second0; +char Time; +[SetVid($103); \800x600x8 +InitDraw; +repeat Time:= GetDateTime; + Hour:= Time(3); + if Hour>=12 then Hour:= Hour-12; + Minute:= Time(4); + Second:= Time(5); + if Second # Second0 then + [Second0:= Second; DrawClock]; +until KeyHit; +] diff --git a/Task/Draw-a-clock/Yabasic/draw-a-clock.basic b/Task/Draw-a-clock/Yabasic/draw-a-clock-1.basic similarity index 100% rename from Task/Draw-a-clock/Yabasic/draw-a-clock.basic rename to Task/Draw-a-clock/Yabasic/draw-a-clock-1.basic diff --git a/Task/Draw-a-clock/Yabasic/draw-a-clock-2.basic b/Task/Draw-a-clock/Yabasic/draw-a-clock-2.basic new file mode 100644 index 0000000000..b45d5ff708 --- /dev/null +++ b/Task/Draw-a-clock/Yabasic/draw-a-clock-2.basic @@ -0,0 +1,168 @@ +#!/usr/bin/yabasic +REM yaclock +DEG_PER_RAD = 57.257751 + +winx = 480 +winy = 480 + +radius = min(winx,winy) / 2 - 1 +hx = (winx/2) - 1 +hy = (winy/2) - 1 + +REM length of the hands (90% of the radius of the clock face) +shand = int(radius * .9) +mhand = int(radius * .9) +hhand = int(radius * .5) + +REM drop coords by one since graphics are 0 based + +winx = winx - 1 +winy = winy - 1 + +clear screen + +open window winx,winy + +clockface() + +do + + hour = val(mid$(time$,1,2)) + mins = val(mid$(time$,4,2)) + sec = val(mid$(time$,7,2)) + + updatehand("sec") + updatehand("mins") + updatehand("hour") + + pause .25 + +loop + +sub updatehand(hand$) + + switch(hand$) + case "sec" + h_len = shand + angle = sec * 6 + width = 6 + color 255,0,0 + ox = osx + oy = osy + oxm1 = osxm1 + oxm2 = osxm2 + oym1 = osym1 + oym2 = osym2 + break + case "mins" + h_len = mhand + angle = mins * 6 + int(sec/10) + width = 12 + color 0,255,0 + ox = omx + oy = omy + oxm1 = omxm1 + oxm2 = omxm2 + oym1 = omym1 + oym2 = omym2 + break + case "hour" + h_len = hhand + angle = ((hour * 30) + (minutes / 12) * 6) + int(mins/2) + width = 15 + color 0,0,255 + ox = ohx + oy = ohy + oxm1 = ohxm1 + oxm2 = ohxm2 + oym1 = ohym1 + oym2 = ohym2 + break + end switch + + h_angle1 = angle - width + if h_angle1 < 0 then + h_angle1 = h_angle1 + 360 + endif + h_angle1 = h_angle1 / DEG_PER_RAD + + h_angle2 = angle + width + if h_angle2 > 360 then + h_angle2 = h_angle2 - 360 + endif + h_angle2 = h_angle2 / DEG_PER_RAD + + angle = angle / DEG_PER_RAD + + x = (hx + (sin(angle) * h_len)) + xm1 = (hx + (sin(h_angle1) * int(h_len * .2))) + xm2 = (hx + (sin(h_angle2) * int(h_len * .2))) + + y = (hy - (cos(angle) * h_len)) + ym1 = (hy - (cos(h_angle1) * int(h_len * .2))) + ym2 = (hy - (cos(h_angle2) * int(h_len * .2))) + + clear line hx,hy,oxm1,oym1 + clear line hx,hy,oxm2,oym2 + clear line oxm1,oym1,ox,oy + clear line oxm2,oym2,ox,oy + line hx,hy,xm1,ym1 + line hx,hy,xm2,ym2 + line xm1,ym1,x,y + line xm2,ym2,x,y + + REM save off the old vals + switch(hand$) + case "sec" + osx = x + osy = y + osxm1 = xm1 + osxm2 = xm2 + osym1 = ym1 + osym2 = ym2 + break + case "mins" + omx = x + omy = y + omxm1 = xm1 + omxm2 = xm2 + omym1 = ym1 + omym2 = ym2 + break + case "hour" + ohx = x + ohy = y + ohxm1 = xm1 + ohxm2 = xm2 + ohym1 = ym1 + ohym2 = ym2 + break + end switch +end sub + +sub clockface() + circle hx,hy,radius + + htick = radius / 10 + mtick = htick / 2 + + for z=0 to 360 step 6 + REM Begin at zero deg and stop before 360 deg + + REM draw the hour markers + angle = z + angle = angle / DEG_PER_RAD + x2 = (hx + (sin(angle) * radius)) + y2 = (hy - (cos(angle) * radius)) + if mod(z,30) = 0 then + tick = htick + else + tick = mtick + endif + x3 = (hx + (sin(angle) * (radius - tick))) + y3 = (hy - (cos(angle) * (radius - tick))) + color 255,0,0 + line x2,y2,x3,y3 + color 0,0,0 + next z +end sub diff --git a/Task/Draw-a-clock/Zkl/draw-a-clock.zkl b/Task/Draw-a-clock/Zkl/draw-a-clock.zkl index 9819c7b3a4..50f06ab266 100644 --- a/Task/Draw-a-clock/Zkl/draw-a-clock.zkl +++ b/Task/Draw-a-clock/Zkl/draw-a-clock.zkl @@ -4,7 +4,7 @@ var while(True){ x:=Time.Date.ctime()[11,8] // or Time.Date.to24HString() (no seconds) .pump(List,fcn(n){ n.toAsc() - 0x30 }); //-->L(2,3,10,4,3,10,5,2) - print("\e[H\e[J"); // home and clear screen on ANSI terminals + print("\e[H\e[J"); // home and clear screen on ANSI terminals println(x.pump(String,t.get),"\n",x.pump(String,b.get)); Atomic.sleep(1); } diff --git a/Task/Draw-a-cuboid/ALGOL-68/draw-a-cuboid.alg b/Task/Draw-a-cuboid/ALGOL-68/draw-a-cuboid.alg new file mode 100644 index 0000000000..a10b794b17 --- /dev/null +++ b/Task/Draw-a-cuboid/ALGOL-68/draw-a-cuboid.alg @@ -0,0 +1,58 @@ +BEGIN # draw some cuboids using ASCII art # + + # draws a cuboid standing on one edge using ASCII art # + PROC aa cuboid = ( INT h, w, l )VOID: + BEGIN + # top line # + TO l DO print( ( " " ) ) OD; + TO w + 1 DO print( ( "_" ) ) OD; + print( ( newline ) ); + # rest of the top face and part of the visible side # + INT face width := 0; + INT edge pos := 0; + FOR i TO l DO + TO l - i DO print( ( " " ) ) OD; + print( ( "/" ) ); + TO w DO print( ( IF i = l THEN "_" ELSE " " FI ) ) OD; + print( ( "/" ) ); + edge pos +:= 1; + IF edge pos <= h THEN + # drsw the back edge # + face width := 2 * ( edge pos - 1 ); + TO face width DO print( ( " " ) ) OD; + print( ( "\" ) ) + ELSE + # draw the bottom edge # + TO face width + 1 DO print( ( " " ) ) OD; + print( ( "/" ) ) + FI; + print( ( newline ) ) + OD; + # other vidible face # + FOR i TO h DO + TO i - 1 DO print( ( " " ) ) OD; + print( ( "\" ) ); + TO w DO print( ( IF i = h THEN "_" ELSE " " FI ) ) OD; + print( ( "\" ) ); + edge pos +:= 1; + IF edge pos <= h THEN + # drsw the back edge # + TO face width + 1 DO print( ( " " ) ) OD; + print( ( "\" ) ) + ELSE + # draw the bottom edge # + TO face width DO print( ( " " ) ) OD; + face width -:= 2; + print( ( "/" ) ) + FI; + print( ( newline ) ) + OD + + END # aa cuboid # ; + + aa cuboid( 3, 2, 4 ); + aa cuboid( 4, 3, 2 ); + aa cuboid( 2, 4, 3 ); + aa cuboid( 2, 3, 4 ) + +END diff --git a/Task/Draw-a-cuboid/Ada/draw-a-cuboid.ada b/Task/Draw-a-cuboid/Ada/draw-a-cuboid.adb similarity index 100% rename from Task/Draw-a-cuboid/Ada/draw-a-cuboid.ada rename to Task/Draw-a-cuboid/Ada/draw-a-cuboid.adb diff --git a/Task/Draw-a-cuboid/Delphi/draw-a-cuboid.delphi b/Task/Draw-a-cuboid/Delphi/draw-a-cuboid.pas similarity index 100% rename from Task/Draw-a-cuboid/Delphi/draw-a-cuboid.delphi rename to Task/Draw-a-cuboid/Delphi/draw-a-cuboid.pas diff --git a/Task/Draw-a-cuboid/EasyLang/draw-a-cuboid.easy b/Task/Draw-a-cuboid/EasyLang/draw-a-cuboid.easy new file mode 100644 index 0000000000..382a35c46e --- /dev/null +++ b/Task/Draw-a-cuboid/EasyLang/draw-a-cuboid.easy @@ -0,0 +1,71 @@ +node[][] = [ [ -1 -2 -2 ] [ -1 -2 1 ] [ -1 2 -2 ] [ -1 2 1 ] [ 1 -2 -2 ] [ 1 -2 1 ] [ 1 2 -2 ] [ 1 2 1 ] ] +edge[][] = [ [ 1 2 ] [ 2 4 ] [ 4 3 ] [ 3 1 ] [ 5 6 ] [ 6 8 ] [ 8 7 ] [ 7 5 ] [ 1 5 ] [ 2 6 ] [ 3 7 ] [ 4 8 ] ] +# +proc scale f . + for i = 1 to len node[][] : for d = 1 to 3 + node[i][d] *= f + . +. +proc rotate angx angy . + sinx = sin angx + cosx = cos angx + siny = sin angy + cosy = cos angy + for i = 1 to len node[][] + x = node[i][1] + z = node[i][3] + node[i][1] = x * cosx - z * sinx + y = node[i][2] + z = z * cosx + x * sinx + node[i][2] = y * cosy - z * siny + node[i][3] = z * cosy + y * siny + . +. +len nd[] 3 +proc draw . + gclear + gtext 2 2 "Arrow keys to rotate" + m = 99999 + mi = -1 + for i = 1 to len node[][] + if node[i][3] < m + m = node[i][3] + mi = i + . + . + ix = 1 + for i = 1 to len edge[][] + if edge[i][1] = mi + nd[ix] = edge[i][2] + ix += 1 + elif edge[i][2] = mi + nd[ix] = edge[i][1] + ix += 1 + . + . + for ni = 1 to len nd[] : for i = 1 to len edge[][] + if edge[i][1] = nd[ni] or edge[i][2] = nd[ni] + x1 = node[edge[i][1]][1] + y1 = node[edge[i][1]][2] + x2 = node[edge[i][2]][1] + y2 = node[edge[i][2]][2] + gline x1 + 50 y1 + 50 x2 + 50 y2 + 50 + . + . +. +gtextsize 3 +scale 15 +rotate 45 45 +draw +on key_down + if keybkey = "ArrowUp" + rotate 0 1 + elif keybkey = "ArrowDown" + rotate 0 -1 + elif keybkey = "ArrowLeft" + rotate -1 0 + elif keybkey = "ArrowRight" + rotate 1 0 + . + draw +. diff --git a/Task/Draw-a-cuboid/Elixir/draw-a-cuboid.elixir b/Task/Draw-a-cuboid/Elixir/draw-a-cuboid.ex similarity index 100% rename from Task/Draw-a-cuboid/Elixir/draw-a-cuboid.elixir rename to Task/Draw-a-cuboid/Elixir/draw-a-cuboid.ex diff --git a/Task/Draw-a-cuboid/Jq/draw-a-cuboid.jq b/Task/Draw-a-cuboid/Jq/draw-a-cuboid.jq new file mode 100644 index 0000000000..6f59cbd05c --- /dev/null +++ b/Task/Draw-a-cuboid/Jq/draw-a-cuboid.jq @@ -0,0 +1,27 @@ +def cubLine($n; $dx; $dy; $cde): + def s: if . == 0 then "" else . * " " end; # for jaq + reduce range(1; 9*$dx) as $d ("\($n|s)\($cde[0:1])"; + . + $cde[1:2] ) + + $cde[0:1] + + ("\($dy|s)\($cde[2:])"); + +def cuboid($dx; $dy; $dz): + "cuboid \($dx) \($dy) \($dz):", + # top + cubLine($dy+1; $dx; 0; "+-"), + # top and side + (range(1; 1+$dy) as $i | cubLine($dy-$i+1; $dx; $i-1; "/ |")), + cubLine(0; $dx; $dy; "+-|"), + # front and side + (range(1; 4*$dz -$dy-2) as $i | cubLine(0; $dx; $dy; "| |")), + cubLine(0; $dx; $dy; "| +"), + # front and bottom + (range(1; 1+$dy) as $i | cubLine(0; $dx; $dy-$i; "| /")), + # bottom + cubLine(0; $dx; 0; "+-\n"); + +cuboid(2; 3; 4), +"", +cuboid(1; 1; 1), +"", +cuboid(6; 2; 1) diff --git a/Task/Draw-a-cuboid/Julia/draw-a-cuboid.julia b/Task/Draw-a-cuboid/Julia/draw-a-cuboid.jl similarity index 100% rename from Task/Draw-a-cuboid/Julia/draw-a-cuboid.julia rename to Task/Draw-a-cuboid/Julia/draw-a-cuboid.jl diff --git a/Task/Draw-a-cuboid/Kotlin/draw-a-cuboid.kotlin b/Task/Draw-a-cuboid/Kotlin/draw-a-cuboid.kts similarity index 100% rename from Task/Draw-a-cuboid/Kotlin/draw-a-cuboid.kotlin rename to Task/Draw-a-cuboid/Kotlin/draw-a-cuboid.kts diff --git a/Task/Draw-a-cuboid/Locomotive-Basic/draw-a-cuboid.basic b/Task/Draw-a-cuboid/Locomotive-Basic/draw-a-cuboid.basic new file mode 100644 index 0000000000..c7b41f6d6b --- /dev/null +++ b/Task/Draw-a-cuboid/Locomotive-Basic/draw-a-cuboid.basic @@ -0,0 +1,6 @@ +10 mode 2: origin 100,0: w=120: height=w*1.5: depth=w*2 +20 x=80: y=10 +30 plot x,y +40 drawr 0,height: drawr w,0: drawr 0,-height: drawr -w,0: rem front +50 plot x,y+height: drawr depth/2,height: drawr w,0: drawr 0,-height: drawr -w,-height +60 plot x+w,y+height: drawr depth/2,height diff --git a/Task/Draw-a-cuboid/Odin/draw-a-cuboid.odin b/Task/Draw-a-cuboid/Odin/draw-a-cuboid.odin new file mode 100644 index 0000000000..aa3dcf8563 --- /dev/null +++ b/Task/Draw-a-cuboid/Odin/draw-a-cuboid.odin @@ -0,0 +1,35 @@ +package cuboid + +import rl "vendor:raylib" + +main :: proc() { + rl.InitWindow(640, 480, "Rosetta Code - draw a cuboid") + + camera: rl.Camera3D + camera.fovy = 45 + camera.position = {0, 5, 10} + camera.up = {0, 1, 0} + + for !rl.WindowShouldClose() { + rl.UpdateCamera(&camera, .ORBITAL) + + rl.BeginDrawing() + + rl.ClearBackground(rl.RAYWHITE) + + rl.BeginMode3D(camera) + + rl.DrawGrid(25, .5) + + cube := rl.Vector3 {2, 3, 4} + + rl.DrawCubeV({}, cube, rl.LIME) + rl.DrawCubeWiresV({}, cube, rl.DARKGREEN) + + rl.EndMode3D() + + rl.EndDrawing() + } + + rl.CloseWindow() +} diff --git a/Task/Draw-a-cuboid/PL-M/draw-a-cuboid.plm b/Task/Draw-a-cuboid/PL-M/draw-a-cuboid.plm new file mode 100644 index 0000000000..09220af2ea --- /dev/null +++ b/Task/Draw-a-cuboid/PL-M/draw-a-cuboid.plm @@ -0,0 +1,81 @@ +100H: /* DRAW SOME CUBOIDS USING ASCII ART */ + + /* CP/M BDOS SYSTEM CALL AND I/O ROUTINES */ + BDOS: PROCEDURE( FN, ARG ); DECLARE FN BYTE, ARG ADDRESS; GOTO 5; END; + PR$CHAR: PROCEDURE( C ); DECLARE C BYTE; CALL BDOS( 2, C ); END; + PR$NL: PROCEDURE; CALL PR$CHAR( 0DH ); CALL PR$CHAR( 0AH ); END; + + /* TASK */ + + /* DRAWS A CUBOID STANDING ON ONE EDGE USING ASCII ART */ + DRAW$CUBOID: PROCEDURE( H, W, L ); + DECLARE ( H, W, L ) BYTE; + DECLARE ( I, J, FACE$WIDTH, EDGE$POS ) BYTE; + + BACKSLASH: PROCEDURE; CALL PR$CHAR( 92 ); END; /* PRINTS A BACKSLASH */ + REPEAT$CHAR: PROCEDURE( CH, COUNT ); /* PRINTS CH COUNT TIMES */ + DECLARE ( CH, COUNT ) BYTE; + DECLARE I BYTE; + IF COUNT > 0 THEN DO; + DO I = 1 TO COUNT; CALL PR$CHAR( CH ); END; + END; + END REPEAT$CHAR; + UNDERSCORES: PROCEDURE( COUNT ); /* PRINTS COUNT UNDERSCORES */ + DECLARE COUNT BYTE; + CALL REPEAT$CHAR( 95, COUNT ); + END UNDERSCORES; + + /* TOP LINE */ + CALL REPEAT$CHAR( ' ', L ); CALL UNDERSCORES( W + 1 ); CALL PR$NL; + /* REST OF THE TOP FACE AND PART OF THE VISIBLE SIDE */ + FACE$WIDTH = 0; + EDGE$POS = 0; + DO I = 1 TO L; + CALL REPEAT$CHAR( ' ', L - I ); + CALL PR$CHAR( '/' ); + IF I = L THEN CALL UNDERSCORES( W ); + ELSE CALL REPEAT$CHAR( ' ', W ); + CALL PR$CHAR( '/' ); + EDGE$POS = EDGE$POS + 1; + IF EDGE$POS <= H THEN DO; + /* DRAW THE BACK EDGE */ + FACE$WIDTH = 2 * ( EDGE$POS - 1 ); + CALL REPEAT$CHAR( ' ', FACE$WIDTH ); + CALL BACKSLASH; + END; + ELSE DO; + /* DRAW THE BOTTOM EDGE AND THE MORE OF THE VISIBLE SIDE */ + CALL REPEAT$CHAR( ' ', FACE$WIDTH + 1 ); + CALL PR$CHAR( '/' ); + END; + CALL PR$NL; + END; + /* OTHER VISIBLE FACE */ + DO I = 1 TO H; + CALL REPEAT$CHAR( ' ', I - 1 ); + CALL BACKSLASH; + IF I = H THEN CALL UNDERSCORES( W ); + ELSE CALL REPEAT$CHAR( ' ', W ); + CALL BACKSLASH; + EDGE$POS = EDGE$POS + 1; + IF EDGE$POS <= H THEN DO; + /* DRAW THE BACK EDGE */ + CALL REPEAT$CHAR( ' ', FACE$WIDTH + 1 ); + CALL BACKSLASH; + END; + ELSE DO; + /* DRAW THE BOTTOM EDGE */ + CALL REPEAT$CHAR( ' ', FACE$WIDTH ); + FACE$WIDTH = FACE$WIDTH - 2; + CALL PR$CHAR( '/' ); + END; + CALL PR$NL; + END; + END DRAW$CUBOID; + + CALL DRAW$CUBOID( 3, 2, 4 ); + CALL DRAW$CUBOID( 4, 3, 2 ); + CALL DRAW$CUBOID( 2, 4, 3 ); + CALL DRAW$CUBOID( 2, 3, 4 ); + +EOF diff --git a/Task/Draw-a-cuboid/R/draw-a-cuboid.r b/Task/Draw-a-cuboid/R/draw-a-cuboid.r new file mode 100644 index 0000000000..ea0ab1b2f8 --- /dev/null +++ b/Task/Draw-a-cuboid/R/draw-a-cuboid.r @@ -0,0 +1,14 @@ +cuboid <- function(w, h, d){ + plot(x=NA, xlim=c(0,(w+d)*sqrt(3)/2), ylim=c(0,h+(w+d)/2), xlab=NA, ylab=NA, asp=1) + polygon(x=c(0, w*sqrt(3)/2, w*sqrt(3)/2, 0), + y=c(w/2, 0, h, h+w/2), + col="red") + polygon(x=c(0, w*sqrt(3)/2, (w+d)*sqrt(3)/2, d*sqrt(3)/2), + y=c(h+w/2, h, h+d/2, h+(w+d)/2), + col="blue") + polygon(x=c(w*sqrt(3)/2, (w+d)*sqrt(3)/2, (w+d)*sqrt(3)/2, w*sqrt(3)/2), + y=c(0, d/2, h+d/2, h), + col="yellow") +} + +cuboid(2, 3, 4) diff --git a/Task/Draw-a-cuboid/V-(Vlang)/draw-a-cuboid.v b/Task/Draw-a-cuboid/V-(Vlang)/draw-a-cuboid.v new file mode 100644 index 0000000000..19ec039f32 --- /dev/null +++ b/Task/Draw-a-cuboid/V-(Vlang)/draw-a-cuboid.v @@ -0,0 +1,32 @@ +fn cuboid(dx int, dy int, dz int) { + println("cuboid $dx $dy $dz:") + cub_line(dy + 1, dx, 0, "+-|") + for i in 1 .. dy + 1 { + cub_line(dy - i + 1, dx, i - 1, "/ |") + } + cub_line(0, dx, dy, "+-|") + for _ in 0 .. (4 * dz - dy - 2) { + cub_line(0, dx, dy, "| |") + } + cub_line(0, dx, dy, "| +") + for i in 1 .. dy + 1 { + cub_line(0, dx, dy - i, "| /") + } + last_line := "+-" + print("".repeat(1) + last_line[0].ascii_str()) + println(last_line[1].ascii_str().repeat(9 * dx - 1) + last_line[0].ascii_str()) +} + +fn cub_line(nir int, dx int, dy int, cde string) { + if cde.len < 3 { return } + print(" ".repeat(nir + 1) + cde[0].ascii_str()) + print(cde[1].ascii_str().repeat(9 * dx - 1)) + print(cde[0].ascii_str()) + println(" ".repeat(dy + 1) + cde[2].ascii_str()) +} + +fn main() { + cuboid(2, 3, 4) + cuboid(1, 1, 1) + cuboid(6, 2, 1) +} diff --git a/Task/Draw-a-cuboid/VBScript/draw-a-cuboid.vb b/Task/Draw-a-cuboid/VBScript/draw-a-cuboid.vbs similarity index 100% rename from Task/Draw-a-cuboid/VBScript/draw-a-cuboid.vb rename to Task/Draw-a-cuboid/VBScript/draw-a-cuboid.vbs diff --git a/Task/Draw-a-cuboid/Wren/draw-a-cuboid.wren b/Task/Draw-a-cuboid/Wren/draw-a-cuboid.wren index dc62a2bb3c..0a35aca5a0 100644 --- a/Task/Draw-a-cuboid/Wren/draw-a-cuboid.wren +++ b/Task/Draw-a-cuboid/Wren/draw-a-cuboid.wren @@ -1,4 +1,4 @@ -import "/fmt" for Fmt +import "./fmt" for Fmt var cubLine = Fn.new { |n, dx, dy, cde| Fmt.write("$*s", n + 1, cde[0]) diff --git a/Task/Draw-a-pixel/ARM-Assembly/draw-a-pixel.arm b/Task/Draw-a-pixel/ARM-Assembly/draw-a-pixel.arm index 78039d03f4..1e582d7d8b 100644 --- a/Task/Draw-a-pixel/ARM-Assembly/draw-a-pixel.arm +++ b/Task/Draw-a-pixel/ARM-Assembly/draw-a-pixel.arm @@ -47,7 +47,7 @@ szTexte2: .asciz "Press q for close window or clic X in system me szLibDW: .asciz "WM_DELETE_WINDOW" @ special label for correct close error /*************************************************/ -szMessErr: .ascii "Error code hexa : " +szMessErr: .ascii "Error code hexa : " sHexa: .space 9,' ' .ascii " decimal : " sDeci: .space 15,' ' @@ -441,7 +441,7 @@ conversion16: and r0,r3,r4 @value register and mask lsr r0,r2 @ move right cmp r0,#10 @ compare value - addlt r0,#48 @ <10 ->digit + addlt r0,#48 @ <10 ->digit addge r0,#55 @ >10 ->letter A-F strb r0,[r1],#1 @ store digit on area and + 1 in area address lsr r4,#4 @ shift mask 4 positions @@ -507,7 +507,7 @@ divisionpar10U: sub r1,r4,r2, lsl #1 @ r1 <- r4 - (r2 * 2) = r4 - (r0 * 10) pop {r2,r3,r4,lr} bx lr @ leave function -iMagicNumber: .int 0xCCCCCCCD +iMagicNumber: .int 0xCCCCCCCD /***************************************************/ /* integer division unsigned */ /***************************************************/ diff --git a/Task/Draw-a-pixel/Ada/draw-a-pixel.ada b/Task/Draw-a-pixel/Ada/draw-a-pixel.adb similarity index 100% rename from Task/Draw-a-pixel/Ada/draw-a-pixel.ada rename to Task/Draw-a-pixel/Ada/draw-a-pixel.adb diff --git a/Task/Draw-a-pixel/Applesoft-BASIC/draw-a-pixel.basic b/Task/Draw-a-pixel/Applesoft-BASIC/draw-a-pixel.basic new file mode 100644 index 0000000000..370428862e --- /dev/null +++ b/Task/Draw-a-pixel/Applesoft-BASIC/draw-a-pixel.basic @@ -0,0 +1,29 @@ + 100 WIDTH = 320 + 110 HEIGHT = 240 + 120 C = 1: REM RED + 130 X = 100 + 140 Y = 100 + 150 DEF FN X(X) = INT ((X - 1) / 14) + 160 DEF FN Y(Y) = INT ((Y - 1) / 8) + 170 W = FN X(WIDTH) + 180 H = FN Y(HEIGHT) + 190 WX = INT ( RND (1) * (40 - W)) + 200 WY = INT ( RND (1) * (48 - H)) + 210 C$ = "0123456789:;<=>?" + 220 C$ = MID$ (C$,C,I) + MID$ (C$,C + 2, LEN (C$) - C - 1) + 230 I = INT ( RND (1) * LEN (C$)) + 240 COLOR= ASC ( MID$ (C$,I + 1)) - 48 + 250 C$ = MID$ (C$,1,I) + MID$ (C$,I + 2, LEN (C$) - I - 1) + 260 A = PEEK (49234) + PEEK (49240) + PEEK (49232) + 270 FOR I = 0 TO 39 + 280 VLIN 0,47 AT I + 290 NEXT + 300 COLOR= ASC ( MID$ (C$, INT ( RND (1) * LEN (C$)) + 1)) - 48 + 310 FOR I = WX TO WX + W + 320 VLIN WY,WY + H AT I + 330 NEXT + 340 COLOR= C + 350 PLOT WX + FN X(X),WY + FN Y(Y) + 360 WAIT 49152,128 + 370 TEXT + 380 HOME diff --git a/Task/Draw-a-pixel/AutoHotkey/draw-a-pixel.ahk b/Task/Draw-a-pixel/AutoHotkey/draw-a-pixel.ahk index 86bccdddd4..aa35877040 100644 --- a/Task/Draw-a-pixel/AutoHotkey/draw-a-pixel.ahk +++ b/Task/Draw-a-pixel/AutoHotkey/draw-a-pixel.ahk @@ -4,9 +4,9 @@ Gui, Show, w320 h240, Example return CreatePixel(Color, Handle) { - VarSetCapacity(BMBITS, 4, 0), Numput("0x" . Color, &BMBITS, 0, "UInt") - hBM := DllCall("Gdi32.dll\CreateBitmap", "Int", 1, "Int", 1, "UInt", 1, "UInt", 24, "Ptr", 0, "Ptr") - hBM := DllCall("User32.dll\CopyImage", "Ptr", hBM, "UInt", 0, "Int", 0, "Int", 0, "UInt", 0x2008, "Ptr") - DllCall("Gdi32.dll\SetBitmapBits", "Ptr", hBM, "UInt", 3, "Ptr", &BMBITS) - DllCall("User32.dll\SendMessage", "Ptr", Handle, "UInt", 0x172, "Ptr", 0, "Ptr", hBM) + VarSetCapacity(BMBITS, 4, 0), Numput("0x" . Color, &BMBITS, 0, "UInt") + hBM := DllCall("Gdi32.dll\CreateBitmap", "Int", 1, "Int", 1, "UInt", 1, "UInt", 24, "Ptr", 0, "Ptr") + hBM := DllCall("User32.dll\CopyImage", "Ptr", hBM, "UInt", 0, "Int", 0, "Int", 0, "UInt", 0x2008, "Ptr") + DllCall("Gdi32.dll\SetBitmapBits", "Ptr", hBM, "UInt", 3, "Ptr", &BMBITS) + DllCall("User32.dll\SendMessage", "Ptr", Handle, "UInt", 0x172, "Ptr", 0, "Ptr", hBM) } diff --git a/Task/Draw-a-pixel/BBC-BASIC/draw-a-pixel.basic b/Task/Draw-a-pixel/BBC-BASIC/draw-a-pixel.basic index eff5cc12bd..8c21868954 100644 --- a/Task/Draw-a-pixel/BBC-BASIC/draw-a-pixel.basic +++ b/Task/Draw-a-pixel/BBC-BASIC/draw-a-pixel.basic @@ -1 +1 @@ - VDU 23, 22, 320; 240; 8, 8, 8, 0, 18, 0, 1, 25, 69, 100; 100; + VDU 23, 22, 320; 240; 8, 8, 8, 128, 18, 0, 9, 25, 69, 100; 100; diff --git a/Task/Draw-a-pixel/C/draw-a-pixel-1.c b/Task/Draw-a-pixel/C/draw-a-pixel-1.c new file mode 100644 index 0000000000..3bbd254b80 --- /dev/null +++ b/Task/Draw-a-pixel/C/draw-a-pixel-1.c @@ -0,0 +1,12 @@ +#include + +int main() +{ + initwindow(320,240,"Red Pixel"); + + putpixel(100,100,RED); + + getch(); + + return 0; +} diff --git a/Task/Draw-a-pixel/C/draw-a-pixel-2.c b/Task/Draw-a-pixel/C/draw-a-pixel-2.c new file mode 100644 index 0000000000..41626fc1f6 --- /dev/null +++ b/Task/Draw-a-pixel/C/draw-a-pixel-2.c @@ -0,0 +1,71 @@ +// dotrosetta.c - https://rosettacode.org/wiki/Draw_a_pixel + +#include +#include +#include + +int +main(void) + { + Atom wm_both_protocols[1]; + Atom wm_delete; + Atom wm_protocols; + Display *display; + GC gc; + Window root; + Window window; + XEvent event; + XSetWindowAttributes attr; + int more = 1; + + display = XOpenDisplay(NULL); + if(display == NULL) + { + fprintf(stderr,"Error: The display cannot be opened\n"); + exit(1); + } + root = DefaultRootWindow(display); + wm_delete = XInternAtom(display, "WM_DELETE_WINDOW", False); + wm_protocols = XInternAtom(display, "WM_PROTOCOLS", False); + attr.background_pixel = 0x000000; + attr.event_mask = ExposureMask; + window = XCreateWindow(display, root, + 0, 0, 320, 240, 0, + CopyFromParent, InputOutput, CopyFromParent, + CWBackPixel | CWEventMask, + &attr + ); + XStoreName(display, window, "Draw a Pixel"); + wm_both_protocols[0] = wm_delete; + XSetWMProtocols(display, window, wm_both_protocols, 1); + gc = XCreateGC(display, window, 0, NULL); + XSetForeground(display, gc, 0xFF0000); + XMapWindow(display, window); + + while(more) + { + XNextEvent(display, &event); + switch(event.type) + { + case Expose: + XDrawPoint(display, window, gc, 100, 100); + break; + + case ClientMessage: // for close request from WM + if(event.xclient.window == window && + event.xclient.message_type == wm_protocols && + event.xclient.format == 32 && + event.xclient.data.l[0] == wm_delete) + { + more = 0; + } + break; + + default: + printf("unexpected event.type %d\n", event.type);; + } + } + + XCloseDisplay(display); + exit(0); + } diff --git a/Task/Draw-a-pixel/C/draw-a-pixel.c b/Task/Draw-a-pixel/C/draw-a-pixel.c deleted file mode 100644 index a9ce8075bf..0000000000 --- a/Task/Draw-a-pixel/C/draw-a-pixel.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main() -{ - initwindow(320,240,"Red Pixel"); - - putpixel(100,100,RED); - - getch(); - - return 0; -} diff --git a/Task/Draw-a-pixel/Delphi/draw-a-pixel.delphi b/Task/Draw-a-pixel/Delphi/draw-a-pixel.pas similarity index 100% rename from Task/Draw-a-pixel/Delphi/draw-a-pixel.delphi rename to Task/Draw-a-pixel/Delphi/draw-a-pixel.pas diff --git a/Task/Draw-a-pixel/EasyLang/draw-a-pixel.easy b/Task/Draw-a-pixel/EasyLang/draw-a-pixel.easy index cb12f03975..cba3accc14 100644 --- a/Task/Draw-a-pixel/EasyLang/draw-a-pixel.easy +++ b/Task/Draw-a-pixel/EasyLang/draw-a-pixel.easy @@ -1,3 +1,2 @@ -color 900 -move 50 50 -rect 0.5 0.5 +gcolor 900 +grect 50 50 0.5 0.5 diff --git a/Task/Draw-a-pixel/Forth/draw-a-pixel.fth b/Task/Draw-a-pixel/Forth/draw-a-pixel.fth index 5df2b5490a..5d6ed34ccc 100644 --- a/Task/Draw-a-pixel/Forth/draw-a-pixel.fth +++ b/Task/Draw-a-pixel/Forth/draw-a-pixel.fth @@ -1,13 +1,13 @@ \ Bindings to SDL2 functions s" SDL2" add-lib \c #include -c-function sdl-init SDL_Init n -- n -c-function sdl-quit SDL_Quit -- void -c-function sdl-createwindow SDL_CreateWindow a n n n n n -- a -c-function sdl-createrenderer SDL_CreateRenderer a n n -- a -c-function sdl-setdrawcolor SDL_SetRenderDrawColor a n n n n -- n -c-function sdl-drawpoint SDL_RenderDrawPoint a n n -- n -c-function sdl-renderpresent SDL_RenderPresent a -- void +c-function sdl-init SDL_Init n -- n +c-function sdl-quit SDL_Quit -- void +c-function sdl-createwindow SDL_CreateWindow a n n n n n -- a +c-function sdl-createrenderer SDL_CreateRenderer a n n -- a +c-function sdl-setdrawcolor SDL_SetRenderDrawColor a n n n n -- n +c-function sdl-drawpoint SDL_RenderDrawPoint a n n -- n +c-function sdl-renderpresent SDL_RenderPresent a -- void c-function sdl-delay SDL_Delay n -- void : pixel ( -- ) diff --git a/Task/Draw-a-pixel/Frink/draw-a-pixel.frink b/Task/Draw-a-pixel/Frink/draw-a-pixel.frink new file mode 100644 index 0000000000..d291521c4a --- /dev/null +++ b/Task/Draw-a-pixel/Frink/draw-a-pixel.frink @@ -0,0 +1,3 @@ +i = new image[320,240] +i.setPixel[100,100,1,0,0] +i.show[] diff --git a/Task/Draw-a-pixel/GML/draw-a-pixel.gml b/Task/Draw-a-pixel/GML/draw-a-pixel.gml index cf522016a3..e29266b1f2 100644 --- a/Task/Draw-a-pixel/GML/draw-a-pixel.gml +++ b/Task/Draw-a-pixel/GML/draw-a-pixel.gml @@ -1 +1,2 @@ -draw_point(100, 100); +draw_set_color(c_red) +draw_point(100, 100) diff --git a/Task/Draw-a-pixel/Go/draw-a-pixel-2.go b/Task/Draw-a-pixel/Go/draw-a-pixel-2.go index 89d068dd45..7a083d1030 100644 --- a/Task/Draw-a-pixel/Go/draw-a-pixel-2.go +++ b/Task/Draw-a-pixel/Go/draw-a-pixel-2.go @@ -1,22 +1,22 @@ package main import ( - "image" - "image/color" - "image/draw" - "image/png" - "os" + "image" + "image/color" + "image/draw" + "image/png" + "os" ) func main() { - // Create a 320 x 240 image - img := image.NewRGBA(image.Rect(0, 0, 320, 240)) - // fill img in white - draw.Draw(img, img.Bounds(), &image.Uniform{color.RGBA{0, 0, 0, 0}}, image.ZP, draw.Src) - // Draw a red dot at (100, 100) - img.Set(100, 100, color.RGBA{255, 0, 0, 255}) - // Save to new.png - w, _ := os.OpenFile("new.png", os.O_WRONLY|os.O_CREATE, 0600) - defer w.Close() - png.Encode(w, img) + // Create a 320 x 240 image + img := image.NewRGBA(image.Rect(0, 0, 320, 240)) + // fill img in white + draw.Draw(img, img.Bounds(), &image.Uniform{color.RGBA{0, 0, 0, 0}}, image.ZP, draw.Src) + // Draw a red dot at (100, 100) + img.Set(100, 100, color.RGBA{255, 0, 0, 255}) + // Save to new.png + w, _ := os.OpenFile("new.png", os.O_WRONLY|os.O_CREATE, 0600) + defer w.Close() + png.Encode(w, img) } diff --git a/Task/Draw-a-pixel/Go/draw-a-pixel-3.go b/Task/Draw-a-pixel/Go/draw-a-pixel-3.go index 9fb62304ea..f6bc3aace1 100644 --- a/Task/Draw-a-pixel/Go/draw-a-pixel-3.go +++ b/Task/Draw-a-pixel/Go/draw-a-pixel-3.go @@ -4,7 +4,7 @@ package main import "github.com/zserge/webview" func main() { - // Open wikipedia in a 320*240 resizable window - webview.Open("Minimal webview example", - "https://en.m.wikipedia.org/wiki/Main_Page", 320, 240, true) + // Open wikipedia in a 320*240 resizable window + webview.Open("Minimal webview example", + "https://en.m.wikipedia.org/wiki/Main_Page", 320, 240, true) } diff --git a/Task/Draw-a-pixel/Java/draw-a-pixel-1.java b/Task/Draw-a-pixel/Java/draw-a-pixel-1.java index 51805bb233..7636004f0b 100644 --- a/Task/Draw-a-pixel/Java/draw-a-pixel-1.java +++ b/Task/Draw-a-pixel/Java/draw-a-pixel-1.java @@ -3,18 +3,18 @@ import java.awt.Graphics; import javax.swing.JFrame; public class DrawAPixel extends JFrame{ - public DrawAPixel() { - super("Red Pixel"); - setSize(320, 240); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setVisible(true); - } - @Override - public void paint(Graphics g) { - g.setColor(new Color(255, 0, 0)); - g.drawRect(100, 100, 1, 1); - } - public static void main(String[] args) { - new DrawAPixel(); - } + public DrawAPixel() { + super("Red Pixel"); + setSize(320, 240); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setVisible(true); + } + @Override + public void paint(Graphics g) { + g.setColor(new Color(255, 0, 0)); + g.drawRect(100, 100, 1, 1); + } + public static void main(String[] args) { + new DrawAPixel(); + } } diff --git a/Task/Draw-a-pixel/Java/draw-a-pixel-2.java b/Task/Draw-a-pixel/Java/draw-a-pixel-2.java index c4f07a05b8..ecb25f50b5 100644 --- a/Task/Draw-a-pixel/Java/draw-a-pixel-2.java +++ b/Task/Draw-a-pixel/Java/draw-a-pixel-2.java @@ -4,30 +4,30 @@ import java.awt.image.BufferedImage; import javax.swing.JFrame; import javax.swing.JPanel; -public class DrawAPixel extends JPanel{ - private BufferedImage puffer; - private JFrame window; - private Graphics g; - public DrawAPixel() { - window = new JFrame("Red Pixel"); - window.setSize(320, 240); - window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - window.setLayout(null); - setBounds(0, 0, 320, 240); - window.add(this); - window.setVisible(true); - } - @Override - public void paint(Graphics gr) { - if(g == null) { - puffer = (BufferedImage) createImage(getWidth(), getHeight()); - g = puffer.getGraphics(); - } - g.setColor(new Color(255, 0, 0)); - g.drawRect(100, 100, 1, 1); - gr.drawImage(puffer, 0, 0, this); - } - public static void main(String[] args) { - new DrawAPixel(); - } +public class DrawAPixel extends JPanel{ + private BufferedImage puffer; + private JFrame window; + private Graphics g; + public DrawAPixel() { + window = new JFrame("Red Pixel"); + window.setSize(320, 240); + window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + window.setLayout(null); + setBounds(0, 0, 320, 240); + window.add(this); + window.setVisible(true); + } + @Override + public void paint(Graphics gr) { + if(g == null) { + puffer = (BufferedImage) createImage(getWidth(), getHeight()); + g = puffer.getGraphics(); + } + g.setColor(new Color(255, 0, 0)); + g.drawRect(100, 100, 1, 1); + gr.drawImage(puffer, 0, 0, this); + } + public static void main(String[] args) { + new DrawAPixel(); + } } diff --git a/Task/Draw-a-pixel/Julia/draw-a-pixel.julia b/Task/Draw-a-pixel/Julia/draw-a-pixel.jl similarity index 100% rename from Task/Draw-a-pixel/Julia/draw-a-pixel.julia rename to Task/Draw-a-pixel/Julia/draw-a-pixel.jl diff --git a/Task/Draw-a-pixel/Kotlin/draw-a-pixel.kotlin b/Task/Draw-a-pixel/Kotlin/draw-a-pixel.kts similarity index 100% rename from Task/Draw-a-pixel/Kotlin/draw-a-pixel.kotlin rename to Task/Draw-a-pixel/Kotlin/draw-a-pixel.kts diff --git a/Task/Draw-a-pixel/Lua/draw-a-pixel.lua b/Task/Draw-a-pixel/Lua/draw-a-pixel.lua index 525421de1f..7050f8b22d 100644 --- a/Task/Draw-a-pixel/Lua/draw-a-pixel.lua +++ b/Task/Draw-a-pixel/Lua/draw-a-pixel.lua @@ -2,9 +2,9 @@ local SDL = require "SDL" local ret = SDL.init { SDL.flags.Video } local window = SDL.createWindow { - title = "Pixel", - height = 320, - width = 240 + title = "Pixel", + height = 320, + width = 240 } local renderer = SDL.createRenderer(window, 0, 0) diff --git a/Task/Draw-a-pixel/OCaml/draw-a-pixel-1.ocaml b/Task/Draw-a-pixel/OCaml/draw-a-pixel-1.ml similarity index 100% rename from Task/Draw-a-pixel/OCaml/draw-a-pixel-1.ocaml rename to Task/Draw-a-pixel/OCaml/draw-a-pixel-1.ml diff --git a/Task/Draw-a-pixel/OCaml/draw-a-pixel-2.ocaml b/Task/Draw-a-pixel/OCaml/draw-a-pixel-2.ml similarity index 100% rename from Task/Draw-a-pixel/OCaml/draw-a-pixel-2.ocaml rename to Task/Draw-a-pixel/OCaml/draw-a-pixel-2.ml diff --git a/Task/Draw-a-pixel/OPL/draw-a-pixel.opl b/Task/Draw-a-pixel/OPL/draw-a-pixel.opl new file mode 100644 index 0000000000..f880013ec3 --- /dev/null +++ b/Task/Draw-a-pixel/OPL/draw-a-pixel.opl @@ -0,0 +1,11 @@ +REM Psion devices up to Series 5 have no colour, so the pixel is black. The Series 7 and later do have colour, but I don't own any of those, so I can neither test it nor am I familiar with OPL beyond Series 5. +REM The Series 3 also has a resolution of only 480x160, so the window falls off the screen. + +PROC main: + LOCAL wndw% + wndw%=gCREATE(80,0,320,240,1,1) + gXBORDER 1,1 + gAT 100,100 + gLINEBY 0,0 + GET +ENDP diff --git a/Task/Draw-a-pixel/Oberon/draw-a-pixel.oberon b/Task/Draw-a-pixel/Oberon/draw-a-pixel.oberon index 8a9cf70323..12a93b93a9 100644 --- a/Task/Draw-a-pixel/Oberon/draw-a-pixel.oberon +++ b/Task/Draw-a-pixel/Oberon/draw-a-pixel.oberon @@ -1,9 +1,9 @@ MODULE pixel; - IMPORT XYplane; - + IMPORT XYplane; + BEGIN - XYplane.Open; - XYplane.Dot(100, 100, XYplane.draw); - REPEAT UNTIL XYplane.Key() = "q" + XYplane.Open; + XYplane.Dot(100, 100, XYplane.draw); + REPEAT UNTIL XYplane.Key() = "q" END pixel. diff --git a/Task/Draw-a-pixel/Odin/draw-a-pixel.odin b/Task/Draw-a-pixel/Odin/draw-a-pixel-1.odin similarity index 100% rename from Task/Draw-a-pixel/Odin/draw-a-pixel.odin rename to Task/Draw-a-pixel/Odin/draw-a-pixel-1.odin diff --git a/Task/Draw-a-pixel/Odin/draw-a-pixel-2.odin b/Task/Draw-a-pixel/Odin/draw-a-pixel-2.odin new file mode 100644 index 0000000000..ee0880c648 --- /dev/null +++ b/Task/Draw-a-pixel/Odin/draw-a-pixel-2.odin @@ -0,0 +1,19 @@ +package main + +import rl "vendor:raylib" + +main :: proc() { + rl.InitWindow(320, 240, "Rosetta Code - Draw a pixel") + + for !rl.WindowShouldClose() { + rl.BeginDrawing() + + rl.ClearBackground(rl.BLACK) + + rl.DrawPixelV({100, 100}, {255, 0, 0, 255}) + + rl.EndDrawing() + } + + rl.CloseWindow() +} diff --git a/Task/Draw-a-pixel/PascalABC.NET/draw-a-pixel.pas b/Task/Draw-a-pixel/PascalABC.NET/draw-a-pixel.pas new file mode 100644 index 0000000000..caaee3cf72 --- /dev/null +++ b/Task/Draw-a-pixel/PascalABC.NET/draw-a-pixel.pas @@ -0,0 +1,6 @@ +uses GraphWPF; + +begin + Window.SetSize(320,240); + SetPixel(100,100,Colors.Red); +end. diff --git a/Task/Draw-a-pixel/Perl/draw-a-pixel.pl b/Task/Draw-a-pixel/Perl/draw-a-pixel-1.pl similarity index 100% rename from Task/Draw-a-pixel/Perl/draw-a-pixel.pl rename to Task/Draw-a-pixel/Perl/draw-a-pixel-1.pl diff --git a/Task/Draw-a-pixel/Perl/draw-a-pixel-2.pl b/Task/Draw-a-pixel/Perl/draw-a-pixel-2.pl new file mode 100644 index 0000000000..6964a0063e --- /dev/null +++ b/Task/Draw-a-pixel/Perl/draw-a-pixel-2.pl @@ -0,0 +1,10 @@ +#!/usr/bin/perl + +use strict; # https://rosettacode.org/wiki/Draw_a_pixel +use warnings; +use Tk; + +my $mw = MainWindow->new; +my $canvas = $mw->Canvas( -width => 320, -height => 240 )->pack; +$canvas->createRectangle( 100, 100, 100, 100, -outline => 'red' ); +MainLoop; diff --git a/Task/Draw-a-pixel/Perl/draw-a-pixel-3.pl b/Task/Draw-a-pixel/Perl/draw-a-pixel-3.pl new file mode 100644 index 0000000000..37bdd615b4 --- /dev/null +++ b/Task/Draw-a-pixel/Perl/draw-a-pixel-3.pl @@ -0,0 +1,44 @@ +#!/usr/bin/perl + +use strict; # https://rosettacode.org/wiki/Draw_a_pixel +use warnings; +use X11::Protocol; + +my $x = new X11::Protocol or die "X11 connection failed"; +$x->CreateWindow(my $id = $x->new_rsrc, $x->root, 'InputOutput', + $x->root_depth, 'CopyFromParent', + 0, 0, 320, 240, 0, + background_pixel => 0x000000, + event_mask => $x->pack_event_mask( qw( Exposure )), + ); +$x->ChangeProperty($id, $x->atom('WM_NAME'), $x->atom('STRING'), + 8, 'Replace', 'Draw a Pixel'); +$x->ChangeProperty($id, $x->atom('WM_PROTOCOLS'), $x->atom('ATOM'), + 32, 'Replace', pack('L', $x->atom('WM_DELETE_WINDOW'))); +$x->CreateGC(my $gc = $x->new_rsrc, $id, foreground => 0xff0000); +$x->MapWindow($id); +$x->event_handler('queue'); + +my ($more, $name, %e) = 1; +while($more) + { + %e = $x->next_event; + $name = $e{name}; + EVENT->$name; + } + +sub EVENT::Expose { $x->PolyPoint($id, $gc, 'ORIGIN', 100, 100) } +sub EVENT::ConfigureNotify { } +sub EVENT::ClientMessage + { + if($e{type} == $x->atom('WM_PROTOCOLS') && + unpack('L', $e{data}) == $x->atom('WM_DELETE_WINDOW')) + { + $more = 0; + } + else + { + warn "Unknown $name, $e{type}\n"; + } + } +sub EVENT::AUTOLOAD { die "Sorry, no handler for $name\n" } diff --git a/Task/Draw-a-pixel/R/draw-a-pixel.r b/Task/Draw-a-pixel/R/draw-a-pixel.r new file mode 100644 index 0000000000..4fd8762de5 --- /dev/null +++ b/Task/Draw-a-pixel/R/draw-a-pixel.r @@ -0,0 +1,9 @@ +disp_h <- 240 +disp_w <- 320 +mat <- matrix(0, nrow = disp_w, ncol = disp_h) +mat[100, 100] <- 1 +png("DrawPixel-R.png", disp_w, disp_h) +op <- par(mar = rep(0, 4), mai = rep(0, 4)) +image(mat, col = c("white", "red"), useRaster = TRUE, axes = FALSE) +par(op) +dev.off() diff --git a/Task/Draw-a-pixel/ReScript/draw-a-pixel-1.re b/Task/Draw-a-pixel/ReScript/draw-a-pixel-1.res similarity index 100% rename from Task/Draw-a-pixel/ReScript/draw-a-pixel-1.re rename to Task/Draw-a-pixel/ReScript/draw-a-pixel-1.res diff --git a/Task/Draw-a-pixel/ReScript/draw-a-pixel-2.re b/Task/Draw-a-pixel/ReScript/draw-a-pixel-2.res similarity index 100% rename from Task/Draw-a-pixel/ReScript/draw-a-pixel-2.re rename to Task/Draw-a-pixel/ReScript/draw-a-pixel-2.res diff --git a/Task/Draw-a-pixel/Rebol/draw-a-pixel.rebol b/Task/Draw-a-pixel/Rebol/draw-a-pixel.rebol new file mode 100644 index 0000000000..657fa8b619 --- /dev/null +++ b/Task/Draw-a-pixel/Rebol/draw-a-pixel.rebol @@ -0,0 +1,10 @@ +Rebol [ + title: "Rosetta code: Draw a pixel" + file: %Draw_a_pixel.r3 + url: https://rosettacode.org/wiki/Draw_a_pixel +] + +img: make image! 320x240 ;; Create a new image of size 320x240 pixels +img/(100x100): 255.0.0 ;; Set the pixel at position 100x100 to pure red +save %test.png img ;; Save the image to a PNG file named "test.png" +browse %test.png ;; Open the saved image file using the default browser diff --git a/Task/Draw-a-pixel/Rust/draw-a-pixel.rust b/Task/Draw-a-pixel/Rust/draw-a-pixel.rs similarity index 100% rename from Task/Draw-a-pixel/Rust/draw-a-pixel.rust rename to Task/Draw-a-pixel/Rust/draw-a-pixel.rs diff --git a/Task/Draw-a-pixel/Uiua/draw-a-pixel.uiua b/Task/Draw-a-pixel/Uiua/draw-a-pixel.uiua new file mode 100644 index 0000000000..c45ca1b7cf --- /dev/null +++ b/Task/Draw-a-pixel/Uiua/draw-a-pixel.uiua @@ -0,0 +1,2 @@ +↯240_320_3 0 +⍜(⊡[100 100]|[1 0 0]◌) diff --git a/Task/Draw-a-pixel/V-(Vlang)/draw-a-pixel.v b/Task/Draw-a-pixel/V-(Vlang)/draw-a-pixel.v index f8ec8e887e..80701bae65 100644 --- a/Task/Draw-a-pixel/V-(Vlang)/draw-a-pixel.v +++ b/Task/Draw-a-pixel/V-(Vlang)/draw-a-pixel.v @@ -1,5 +1,4 @@ import gg -import gx fn main() { mut context := gg.new_context( @@ -12,6 +11,6 @@ fn main() { fn frame(mut ctx gg.Context) { ctx.begin() - ctx.draw_pixel(100, 100, gx.red) + ctx.draw_pixel(100, 100, gg.red) ctx.end() } diff --git a/Task/Draw-a-rotating-cube/Ada/draw-a-rotating-cube.ada b/Task/Draw-a-rotating-cube/Ada/draw-a-rotating-cube.adb similarity index 100% rename from Task/Draw-a-rotating-cube/Ada/draw-a-rotating-cube.ada rename to Task/Draw-a-rotating-cube/Ada/draw-a-rotating-cube.adb diff --git a/Task/Draw-a-rotating-cube/Delphi/draw-a-rotating-cube-1.delphi b/Task/Draw-a-rotating-cube/Delphi/draw-a-rotating-cube-1.pas similarity index 100% rename from Task/Draw-a-rotating-cube/Delphi/draw-a-rotating-cube-1.delphi rename to Task/Draw-a-rotating-cube/Delphi/draw-a-rotating-cube-1.pas diff --git a/Task/Draw-a-rotating-cube/Delphi/draw-a-rotating-cube-2.delphi b/Task/Draw-a-rotating-cube/Delphi/draw-a-rotating-cube-2.pas similarity index 100% rename from Task/Draw-a-rotating-cube/Delphi/draw-a-rotating-cube-2.delphi rename to Task/Draw-a-rotating-cube/Delphi/draw-a-rotating-cube-2.pas diff --git a/Task/Draw-a-rotating-cube/EasyLang/draw-a-rotating-cube.easy b/Task/Draw-a-rotating-cube/EasyLang/draw-a-rotating-cube.easy index 4b30030a05..09df71826d 100644 --- a/Task/Draw-a-rotating-cube/EasyLang/draw-a-rotating-cube.easy +++ b/Task/Draw-a-rotating-cube/EasyLang/draw-a-rotating-cube.easy @@ -1,14 +1,12 @@ node[][] = [ [ -1 -1 -1 ] [ -1 -1 1 ] [ -1 1 -1 ] [ -1 1 1 ] [ 1 -1 -1 ] [ 1 -1 1 ] [ 1 1 -1 ] [ 1 1 1 ] ] edge[][] = [ [ 1 2 ] [ 2 4 ] [ 4 3 ] [ 3 1 ] [ 5 6 ] [ 6 8 ] [ 8 7 ] [ 7 5 ] [ 1 5 ] [ 2 6 ] [ 3 7 ] [ 4 8 ] ] # -proc scale f . . - for i = 1 to len node[][] - for d = 1 to 3 - node[i][d] *= f - . +proc scale f . + for i = 1 to len node[][] : for d = 1 to 3 + node[i][d] *= f . . -proc rotate angx angy . . +proc rotate angx angy . sinx = sin angx cosx = cos angx siny = sin angy @@ -24,8 +22,8 @@ proc rotate angx angy . . . . len nd[] 3 -proc draw . . - clear +proc draw . + gclear m = 999 mi = -1 for i = 1 to len node[][] @@ -44,16 +42,13 @@ proc draw . . ix += 1 . . - for ni = 1 to len nd[] - for i = 1 to len edge[][] - if edge[i][1] = nd[ni] or edge[i][2] = nd[ni] - x1 = node[edge[i][1]][1] - y1 = node[edge[i][1]][2] - x2 = node[edge[i][2]][1] - y2 = node[edge[i][2]][2] - move x1 + 50 y1 + 50 - line x2 + 50 y2 + 50 - . + for ni = 1 to len nd[] : for i = 1 to len edge[][] + if edge[i][1] = nd[ni] or edge[i][2] = nd[ni] + x1 = node[edge[i][1]][1] + y1 = node[edge[i][1]][2] + x2 = node[edge[i][2]][1] + y2 = node[edge[i][2]][2] + gline x1 + 50 y1 + 50 x2 + 50 y2 + 50 . . . diff --git a/Task/Draw-a-rotating-cube/Julia/draw-a-rotating-cube.julia b/Task/Draw-a-rotating-cube/Julia/draw-a-rotating-cube.jl similarity index 100% rename from Task/Draw-a-rotating-cube/Julia/draw-a-rotating-cube.julia rename to Task/Draw-a-rotating-cube/Julia/draw-a-rotating-cube.jl diff --git a/Task/Draw-a-rotating-cube/Kotlin/draw-a-rotating-cube.kotlin b/Task/Draw-a-rotating-cube/Kotlin/draw-a-rotating-cube.kts similarity index 100% rename from Task/Draw-a-rotating-cube/Kotlin/draw-a-rotating-cube.kotlin rename to Task/Draw-a-rotating-cube/Kotlin/draw-a-rotating-cube.kts diff --git a/Task/Draw-a-rotating-cube/PascalABC.NET/draw-a-rotating-cube.pas b/Task/Draw-a-rotating-cube/PascalABC.NET/draw-a-rotating-cube.pas new file mode 100644 index 0000000000..37d716f15c --- /dev/null +++ b/Task/Draw-a-rotating-cube/PascalABC.NET/draw-a-rotating-cube.pas @@ -0,0 +1,6 @@ +uses Graph3D; + +begin + var Cube := Box(Origin,Sz3D(3,3,3),Colors.Green); + Cube.AnimRotate(OrtZ,180).Forever.Begin +end. diff --git a/Task/Draw-a-rotating-cube/Python/draw-a-rotating-cube.py b/Task/Draw-a-rotating-cube/Python/draw-a-rotating-cube-1.py similarity index 100% rename from Task/Draw-a-rotating-cube/Python/draw-a-rotating-cube.py rename to Task/Draw-a-rotating-cube/Python/draw-a-rotating-cube-1.py diff --git a/Task/Draw-a-rotating-cube/Python/draw-a-rotating-cube-2.py b/Task/Draw-a-rotating-cube/Python/draw-a-rotating-cube-2.py new file mode 100644 index 0000000000..f7a42efcbe --- /dev/null +++ b/Task/Draw-a-rotating-cube/Python/draw-a-rotating-cube-2.py @@ -0,0 +1,14 @@ +import bpy +import math +bpy.context.preferences.edit.keyframe_new_interpolation_type="LINEAR" +bpy.ops.object.select_all(action="SELECT") +bpy.ops.object.delete() +bpy.ops.mesh.primitive_cube_add() +bpy.context.active_object.name="spinningcube" +spinningcube=bpy.data.objects["spinningcube"] +spinningcube.rotation_euler=(math.radians(45),math.radians(35.264),math.radians(0)) +spinningcube.keyframe_insert(data_path="rotation_euler",frame=1) +spinningcube.rotation_euler=(math.radians(45),math.radians(35.264),math.radians(2700)) +spinningcube.keyframe_insert(data_path="rotation_euler",frame=250) +bpy.context.scene.frame_set(1) +bpy.ops.screen.animation_play() diff --git a/Task/Draw-a-rotating-cube/V-(Vlang)/draw-a-rotating-cube.v b/Task/Draw-a-rotating-cube/V-(Vlang)/draw-a-rotating-cube.v new file mode 100644 index 0000000000..597f4f3661 --- /dev/null +++ b/Task/Draw-a-rotating-cube/V-(Vlang)/draw-a-rotating-cube.v @@ -0,0 +1,122 @@ +import gg +import gx +import math + +struct RotatingCube { + mut: + width int + height int + fore gx.Color + nodes [][]f64 + edges [][]int + scale_f f64 +} + +fn new_rotating_cube(width int, height int) RotatingCube { + mut nodes := [ + [f64(-1.0), -1, -1], + [f64(-1.0), -1, 1], + [f64(-1.0), 1, -1], + [f64(-1.0), 1, 1], + [f64(1.0), -1, -1], + [f64(1.0), -1, 1], + [f64(1.0), 1, -1], + [f64(1.0), 1, 1], + ] + mut edges := [ + [0, 1], + [1, 3], + [3, 2], + [2, 0], + [4, 5], + [5, 7], + [7, 6], + [6, 4], + [0, 4], + [1, 5], + [2, 6], + [3, 7], + ] + mut cube := RotatingCube{ + width: width + height: height + fore: gx.blue + nodes: nodes + edges: edges + scale_f: 100.0 + } + cube.scale(cube.scale_f) + cube.rotate_cube(math.pi / 4, math.sqrt(math.atan(2.0))) + return cube +} + +fn (mut rc RotatingCube) scale(s f64) { + for i in 0 .. rc.nodes.len { + for j in 0 .. 3 { + rc.nodes[i][j] = rc.nodes[i][j] * s + } + } +} + +fn (mut rc RotatingCube) rotate_cube(angle_x f64, angle_y f64) { + sin_x := math.sin(angle_x) + cos_x := math.cos(angle_x) + sin_y := math.sin(angle_y) + cos_y := math.cos(angle_y) + for i in 0 .. rc.nodes.len { + x := rc.nodes[i][0] + y := rc.nodes[i][1] + z := rc.nodes[i][2] + rc.nodes[i][0] = x * cos_x - z * sin_x + rc.nodes[i][2] = z * cos_x + x * sin_x + z_new := rc.nodes[i][2] + rc.nodes[i][1] = y * cos_y - z_new * sin_y + rc.nodes[i][2] = z_new * cos_y + y * sin_y + } +} + +fn (mut rc RotatingCube) draw_cube(mut ctx gg.Context) { + ctx.begin() + cx := f32(rc.width / 2) + cy := f32(rc.height / 2) + for edge in rc.edges { + n1 := rc.nodes[edge[0]] + n2 := rc.nodes[edge[1]] + x1 := f32(n1[0]) + cx + y1 := f32(n1[1]) + cy + x2 := f32(n2[0]) + cx + y2 := f32(n2[1]) + cy + ctx.draw_line(x1, y1, x2, y2, rc.fore) + } + for node in rc.nodes { + x := f32(node[0]) + cx - 4 + y := f32(node[1]) + cy - 4 + ctx.draw_rect_filled(x, y, 8, 8, rc.fore) + } + ctx.end() +} + +fn (mut rc RotatingCube) update() { + rc.rotate_cube(math.pi / 180, 0) +} + +fn frame(mut cube RotatingCube) { + mut ctx := gg.Context{} + cube.update() + cube.draw_cube(mut ctx) +} + +fn main() { + width := 640 + height := 640 + mut cube := new_rotating_cube(width, height) + mut context := gg.new_context( + width: width + height: height + window_title: "Rotating cube" + bg_color: gx.white + frame_fn: frame + user_data: &cube + ) + context.run() +} diff --git a/Task/Draw-a-rotating-cube/Zig/draw-a-rotating-cube.zig b/Task/Draw-a-rotating-cube/Zig/draw-a-rotating-cube.zig index cde1f8bf6c..71e488cbe7 100644 --- a/Task/Draw-a-rotating-cube/Zig/draw-a-rotating-cube.zig +++ b/Task/Draw-a-rotating-cube/Zig/draw-a-rotating-cube.zig @@ -15,8 +15,8 @@ pub fn main() !void { const size = c.Vector3{ .x = cube_side, .y = cube_side, .z = cube_side }; const position = c.Vector3{ .x = 0, .y = 0, .z = 0 }; const x_rot = 45; - const y_center = std.math.sqrt(@as(f32, 3)) * cube_side / 2; - const z_rot = std.math.atan(@as(f32, std.math.sqrt1_2)) * 180 / std.math.pi; + const y_center: f32 = std.math.sqrt(3.0) * cube_side / 2.0; + const z_rot = std.math.radiansToDegrees(f32, std.math.atan(@as(f32, std.math.sqrt1_2))); c.SetConfigFlags(c.FLAG_WINDOW_RESIZABLE | c.FLAG_VSYNC_HINT); c.InitWindow(screen_width, screen_height, "Draw a Rotating Cube"); diff --git a/Task/Draw-a-sphere/Ada/draw-a-sphere-1.ada b/Task/Draw-a-sphere/Ada/draw-a-sphere-1.adb similarity index 100% rename from Task/Draw-a-sphere/Ada/draw-a-sphere-1.ada rename to Task/Draw-a-sphere/Ada/draw-a-sphere-1.adb diff --git a/Task/Draw-a-sphere/Ada/draw-a-sphere-2.ada b/Task/Draw-a-sphere/Ada/draw-a-sphere-2.adb similarity index 100% rename from Task/Draw-a-sphere/Ada/draw-a-sphere-2.ada rename to Task/Draw-a-sphere/Ada/draw-a-sphere-2.adb diff --git a/Task/Draw-a-sphere/Delphi/draw-a-sphere.delphi b/Task/Draw-a-sphere/Delphi/draw-a-sphere.pas similarity index 100% rename from Task/Draw-a-sphere/Delphi/draw-a-sphere.delphi rename to Task/Draw-a-sphere/Delphi/draw-a-sphere.pas diff --git a/Task/Draw-a-sphere/EasyLang/draw-a-sphere.easy b/Task/Draw-a-sphere/EasyLang/draw-a-sphere.easy new file mode 100644 index 0000000000..972b539b5d --- /dev/null +++ b/Task/Draw-a-sphere/EasyLang/draw-a-sphere.easy @@ -0,0 +1,25 @@ +func vdot a[] b[] . + for i to len a[] : r += a[i] * b[i] + return r +. +func[] norm v[] . + d = vdot v[] v[] + invl = 1 / sqrt d + for i to 3 : r[] &= v[i] * invl + return r[] +. +proc sphere r k amb dir[] . + for x = -r to r : for y = -r to r + z = r * r - x * x - y * y + if z >= 0 + s = vdot dir[] norm [ x y sqrt z ] + if s < 0 : s = 0 + lum = (pow s k + amb) / (1 + amb) + gcolor3 lum lum lum + grect 50 + x / 5, 50 + y / 5, 0.3 0.3 + . + . +. +gbackground 000 +gclear +sphere 200 1.5 0.2 norm [ -30 30 50 ] diff --git a/Task/Draw-a-sphere/Emacs-Lisp/draw-a-sphere.l b/Task/Draw-a-sphere/Emacs-Lisp/draw-a-sphere.el similarity index 100% rename from Task/Draw-a-sphere/Emacs-Lisp/draw-a-sphere.l rename to Task/Draw-a-sphere/Emacs-Lisp/draw-a-sphere.el diff --git a/Task/Draw-a-sphere/Julia/draw-a-sphere-1.julia b/Task/Draw-a-sphere/Julia/draw-a-sphere-1.jl similarity index 100% rename from Task/Draw-a-sphere/Julia/draw-a-sphere-1.julia rename to Task/Draw-a-sphere/Julia/draw-a-sphere-1.jl diff --git a/Task/Draw-a-sphere/Julia/draw-a-sphere-2.julia b/Task/Draw-a-sphere/Julia/draw-a-sphere-2.jl similarity index 100% rename from Task/Draw-a-sphere/Julia/draw-a-sphere-2.julia rename to Task/Draw-a-sphere/Julia/draw-a-sphere-2.jl diff --git a/Task/Draw-a-sphere/Kotlin/draw-a-sphere.kotlin b/Task/Draw-a-sphere/Kotlin/draw-a-sphere.kts similarity index 100% rename from Task/Draw-a-sphere/Kotlin/draw-a-sphere.kotlin rename to Task/Draw-a-sphere/Kotlin/draw-a-sphere.kts diff --git a/Task/Draw-a-sphere/Locomotive-Basic/draw-a-sphere.basic b/Task/Draw-a-sphere/Locomotive-Basic/draw-a-sphere-1.basic similarity index 100% rename from Task/Draw-a-sphere/Locomotive-Basic/draw-a-sphere.basic rename to Task/Draw-a-sphere/Locomotive-Basic/draw-a-sphere-1.basic diff --git a/Task/Draw-a-sphere/Locomotive-Basic/draw-a-sphere-2.basic b/Task/Draw-a-sphere/Locomotive-Basic/draw-a-sphere-2.basic new file mode 100644 index 0000000000..c343edc95d --- /dev/null +++ b/Task/Draw-a-sphere/Locomotive-Basic/draw-a-sphere-2.basic @@ -0,0 +1,32 @@ +10 MODE 2:ORIGIN 320,200:INK 0,0:INK 1,26 +20 DIM v(2),vec(2) +30 v(0)=30:v(1)=30:v(2)=-50 +40 lung=SQR(v(0)*v(0)+v(1)*v(1)+v(2)*v(2)) +50 v(0)=v(0)/lung +60 v(1)=v(1)/lung +70 v(2)=v(2)/lung +80 r=180:k=1.5:ambient=0.03 +90 FOR i=INT(-r) TO INT(r) +100 x=i +110 FOR j=INT(-2*r) TO INT(2*r) +120 y=j/2 +130 IF (x*x+y*y<=r*r) THEN GOSUB 1000 +140 NEXT j +160 NEXT i +170 END +1000 vec(0)=x +1010 vec(1)=y +1020 vec(2)=SQR(r*r-x*x-y*y) +1030 GOSUB 2000 +1040 GOSUB 3000 +1050 b=(d^k+ambient)/(1+ambient) +1060 IF b>rnd THEN PLOT x,-y +1100 RETURN +2000 lung=SQR(vec(0)*vec(0)+vec(1)*vec(1)+vec(2)*vec(2)) +2010 vec(0)=vec(0)/lung +2020 vec(1)=vec(1)/lung +2030 vec(2)=vec(2)/lung +2040 RETURN +3000 d=v(0)*vec(0)+v(1)*vec(1)+v(2)*vec(2) +3010 IF d<0 THEN d=-d ELSE d=0 +3020 RETURN diff --git a/Task/Draw-a-sphere/Odin/draw-a-sphere.odin b/Task/Draw-a-sphere/Odin/draw-a-sphere.odin new file mode 100644 index 0000000000..394ba7fcef --- /dev/null +++ b/Task/Draw-a-sphere/Odin/draw-a-sphere.odin @@ -0,0 +1,32 @@ +package sphere + +import rl "vendor:raylib" + +main :: proc() { + rl.InitWindow(640, 480, "Rosetta Code - draw a sphere") + + camera: rl.Camera3D + camera.fovy = 45 + camera.position = {0, 2.5, 5} + camera.up = {0, 1, 0} + + for !rl.WindowShouldClose() { + rl.UpdateCamera(&camera, .ORBITAL) + + rl.BeginDrawing() + + rl.ClearBackground(rl.RAYWHITE) + + rl.BeginMode3D(camera) + + rl.DrawGrid(10, .5) + + rl.DrawSphere({}, .5, rl.LIME) + + rl.EndMode3D() + + rl.EndDrawing() + } + + rl.CloseWindow() +} diff --git a/Task/Draw-a-sphere/Pluto/draw-a-sphere.pluto b/Task/Draw-a-sphere/Pluto/draw-a-sphere.pluto new file mode 100644 index 0000000000..2c693f9de4 --- /dev/null +++ b/Task/Draw-a-sphere/Pluto/draw-a-sphere.pluto @@ -0,0 +1,8 @@ +require "bitmap" + +local bmp = bitmap.of(400, 400, color.white, "Draw a sphere") +for n = 1, 100 do + local clr = bitmap.rgbColor(2 * n, 2 * n, 2 * n) + bmp:circle(math.round(150-2 * n / 3) + 50, math.round(150 - n / 2) + 50, 150 - n, clr) +end +bmp:view() diff --git a/Task/Draw-a-sphere/R/draw-a-sphere.r b/Task/Draw-a-sphere/R/draw-a-sphere.r new file mode 100644 index 0000000000..c6f8e5fbd1 --- /dev/null +++ b/Task/Draw-a-sphere/R/draw-a-sphere.r @@ -0,0 +1,12 @@ +library(lattice) +theta <- seq(0, pi, length.out=100) +phi <- seq(0, 2*pi, length.out=100) +x <- outer(sin(theta), cos(phi)) +y <- outer(sin(theta), sin(phi)) +z <- sqrt(1-x^2-y^2) +xx <- kronecker(matrix(1, 2, 2), x) +yy <- kronecker(matrix(1, 2, 2), y) +zz <- kronecker(matrix(c(1, -1, -1, 1), 2, 2), z) +png(filename="Sphere-R.png", width=1000, height=1000) +wireframe(zz ~ xx*yy) +dev.off() diff --git a/Task/Draw-a-sphere/Rust/draw-a-sphere.rust b/Task/Draw-a-sphere/Rust/draw-a-sphere.rs similarity index 100% rename from Task/Draw-a-sphere/Rust/draw-a-sphere.rust rename to Task/Draw-a-sphere/Rust/draw-a-sphere.rs diff --git a/Task/Draw-a-sphere/VBScript/draw-a-sphere.vb b/Task/Draw-a-sphere/VBScript/draw-a-sphere.vbs similarity index 100% rename from Task/Draw-a-sphere/VBScript/draw-a-sphere.vb rename to Task/Draw-a-sphere/VBScript/draw-a-sphere.vbs diff --git a/Task/Duffinian-numbers/Arturo/duffinian-numbers.arturo b/Task/Duffinian-numbers/Arturo/duffinian-numbers.arturo index 5aca5135af..67e076411f 100644 --- a/Task/Duffinian-numbers/Arturo/duffinian-numbers.arturo +++ b/Task/Duffinian-numbers/Arturo/duffinian-numbers.arturo @@ -5,7 +5,7 @@ duffinian?: function [n]-> [1] = intersection factors sum fn fn ] -first50: new [] +first50: [] i: 0 while [50 > size first50][ if duffinian? i -> 'first50 ++ i @@ -17,7 +17,7 @@ loop split.every: 10 first50 'row [ print map to [:string] row 'item -> pad item 3 ] -first15: new [] +first15: [] i: 0 while [15 > size first15][ if every? i..i+2 => duffinian? [ @@ -30,5 +30,5 @@ while [15 > size first15][ print "" print "The first 15 Duffinian triplets:" loop split.every: 5 first15 'row [ - print map row 'item -> pad.right as.code item 17 + print map row 'item -> pad.right express item 17 ] diff --git a/Task/Duffinian-numbers/Delphi/duffinian-numbers.delphi b/Task/Duffinian-numbers/Delphi/duffinian-numbers.pas similarity index 100% rename from Task/Duffinian-numbers/Delphi/duffinian-numbers.delphi rename to Task/Duffinian-numbers/Delphi/duffinian-numbers.pas diff --git a/Task/Duffinian-numbers/EasyLang/duffinian-numbers.easy b/Task/Duffinian-numbers/EasyLang/duffinian-numbers.easy new file mode 100644 index 0000000000..b50d820e3d --- /dev/null +++ b/Task/Duffinian-numbers/EasyLang/duffinian-numbers.easy @@ -0,0 +1,59 @@ +fastfunc isprim num . + i = 2 + while i <= sqrt num + if num mod i = 0 : return 0 + i += 1 + . + return 1 +. +func gcd a b . + while b <> 0 + h = b + b = a mod b + a = h + . + return a +. +func sumdiv num . + d = 2 + repeat + quot = num div d + until d > quot + if num mod d = 0 + sum += d + if d <> quot : sum += quot + . + d += 1 + . + return sum + 1 +. +func isduff n . + if isprim n = 0 and gcd sumdiv n n = 1 + return 1 + . + return 0 +. +proc duffs . + print "First 50 Duffinian numbers:" + n = 4 + repeat + if isduff n = 1 + write n & " " + cnt += 1 + . + until cnt = 50 + n += 1 + . + cnt = 0 + n = 4 + print "\n\nFirst 15 Duffinian triplets:" + repeat + if isduff n = 1 and isduff (n + 1) = 1 and isduff (n + 2) = 1 + print n & " - " & n + 2 + cnt += 1 + . + until cnt = 15 + n += 1 + . +. +duffs diff --git a/Task/Duffinian-numbers/Forth/duffinian-numbers.fth b/Task/Duffinian-numbers/Forth/duffinian-numbers.fth new file mode 100644 index 0000000000..264737eeb8 --- /dev/null +++ b/Task/Duffinian-numbers/Forth/duffinian-numbers.fth @@ -0,0 +1,61 @@ +: gcd ( u1 u2 -- u3 ) + dup 0= if drop exit then + tuck mod recurse ; + +: duffinian? ( u -- ? ) + dup 2 = if drop false exit then + 1 >r dup 2 + begin + over 2 mod 0= + while + dup r> + >r 2* swap 2/ swap + repeat + drop 3 + begin + 2dup dup * >= + while + dup 1 >r + begin + 2 pick 2 pick mod 0= + while + dup r> + >r over * >r tuck / swap r> + repeat + 2r> * >r drop 2 + + repeat + drop + 2dup = if 2drop rdrop false exit then + dup 1 > if 1+ r> * else drop r> then + gcd 1 = ; + +: main + ." First 50 Duffinian numbers:" cr + 0 1 + begin + over 50 < + while + dup duffinian? if + dup 3 .r + swap 1+ swap + over 10 mod 0= if cr else space then + then + 1+ + repeat + 2drop + cr ." First 30 Duffinian triplets:" cr + 0 >r 0 1 + begin + r@ 30 < + while + dup duffinian? if swap 1+ swap else nip 0 swap then + over 3 = if + r> 1+ >r + dup 2 - 5 .r space + dup 1- 5 .r space + dup 5 .r cr + then + 1+ + repeat + rdrop 2drop ; + +main +bye diff --git a/Task/Duffinian-numbers/Free-Pascal-Lazarus/duffinian-numbers.pas b/Task/Duffinian-numbers/Free-Pascal-Lazarus/duffinian-numbers.pas new file mode 100644 index 0000000000..17e3029649 --- /dev/null +++ b/Task/Duffinian-numbers/Free-Pascal-Lazarus/duffinian-numbers.pas @@ -0,0 +1,79 @@ +program DuffinianNumbers; + +CONST + MaxSigma = 10000; + +VAR + seen, cur: CARDINAL; + sigma: ARRAY [1..MaxSigma] OF CARDINAL; + +PROCEDURE CalculateSigmaTable; + VAR i, j: CARDINAL; +BEGIN + FOR i := 1 TO MaxSigma DO + BEGIN + sigma[i] := 0 + END; + FOR i := 1 TO MaxSigma DO + BEGIN + j := i;//2*i -> sigma(n)-n + WHILE j <= MaxSigma DO + Begin + INC(sigma[j], i); + INC(j, i); + END + END +END;// CalculateSigmaTable; + +FUNCTION GCD(a, b: CARDINAL): CARDINAL; +VAR c: CARDINAL; +BEGIN + WHILE b <>0 DO + Begin + c := a MOD b; + a := b; + b := c + END; + EXIT(A) +END;// GCD; + +function IsDuffinian(n: CARDINAL): BOOLEAN; +BEGIN + EXIT( (sigma[n] > n+1) AND (GCD(n, sigma[n]) = 1)) +END;// IsDuffinian; + +FUNCTION IsDuffinianTriple(n: CARDINAL): BOOLEAN; +BEGIN + EXIT(IsDuffinian(n) AND IsDuffinian(n+1) AND IsDuffinian(n+2)); +END;// IsDuffinianTriple; + +BEGIN + CalculateSigmaTable; + Writeln('First 50 Duffinian numbers:'); + WriteLn; + cur := 0; + FOR seen := 1 TO 50 DO + Begin + REPEAT + INC(cur) + UNTIL IsDuffinian(cur); + Write(cur:4); + IF seen MOD 10 = 0 THEN + WriteLn; + END; + + WriteLn; + WriteLn('First 15 Duffinian triples:'); + WriteLn; + cur := 0; + FOR seen := 1 TO 15 DO + BEGIN + REPEAT + INC(cur) + UNTIL IsDuffinianTriple(cur); + Write(cur:6); + Write(cur+1:6); + Write(cur+2:6); + WriteLn; + END +END.// DuffinianNumbers. diff --git a/Task/Duffinian-numbers/Haskell/duffinian-numbers.hs b/Task/Duffinian-numbers/Haskell/duffinian-numbers.hs new file mode 100644 index 0000000000..9bc2ce04f3 --- /dev/null +++ b/Task/Duffinian-numbers/Haskell/duffinian-numbers.hs @@ -0,0 +1,50 @@ +import Data.List ( tail ) +import qualified Data.Set as S +import Data.List.Split ( divvy ) + +divisors :: Int -> [Int] +divisors n = [d | d <- [1..n] , mod n d == 0] + +primeFactors :: Int -> [Int] +primeFactors n = snd $ until ( (== 1 ) . fst ) step (n , [] ) + where + step :: (Int , [Int]) -> (Int , [Int]) + step ( aNumber , factors ) = ( div aNumber smallest , factors ++ + [smallest] ) + where + smallest :: Int + smallest = head $ tail $ divisors aNumber + +isRelativelyPrime :: Int -> Int -> Bool +isRelativelyPrime a b = S.null $ S.intersection ( S.fromList $ + primeFactors a ) ( S.fromList $ primeFactors b ) + +isDuffinian :: Int -> Bool +isDuffinian n = and [(length $ primeFactors n ) > 1 , isRelativelyPrime + ( sum $ divisors n ) n] + +solution :: [Int] +solution = take 50 $ filter isDuffinian [1..] + +findTriplets :: [[Int]] +findTriplets = take 15 $ filter condition $ divvy 3 1 $ filter + isDuffinian [1..] + where + condition :: [Int] -> Bool + condition [a , b , c] = b == a + 1 && c == b + 1 + +outputTriplet :: [Int] -> String +outputTriplet [a , b , c] = "(" ++ replicate ( 6 - length sa ) ' ' ++ + sa ++ replicate (6 - length sb) ' ' ++ sb ++ replicate (6 - length sc ) + ' ' ++ sc ++ " )" + where + sa = show a + sb = show b + sc = show c + +main :: IO ( ) +main = do + putStrLn "The first 50 Duffinian numbers are :" + print solution + putStrLn "The first 15 Duffinian triplets are:" + mapM_ (\t -> putStrLn $ outputTriplet t ) findTriplets diff --git a/Task/Duffinian-numbers/Icon/duffinian-numbers.icon b/Task/Duffinian-numbers/Icon/duffinian-numbers.icon new file mode 100644 index 0000000000..5ca26be44f --- /dev/null +++ b/Task/Duffinian-numbers/Icon/duffinian-numbers.icon @@ -0,0 +1,28 @@ +procedure main(A) + write("The first 50 Duffian numbers:") + every writes(" ",isduffinian(seq())\50) + write("\n") + limit := 15 + write("The first ",limit," Duffian triples:") + every (isduffinian(n := seq()),isduffinian(n+1),isduffinian(n+2))\limit do + write("\t(",n,",",n+1,",",n+2,")") +end + +procedure isduffinian(n) + x := \cfact(n)**\afact(sumfactors(n)) + return (*\x = 1, !x = 1, n) +end + +procedure cfact(n) # all factors of n if n is a composite number + return (*(f := afact(n)) > 2, f) +end + +procedure afact(n) # all factors of n + every (f := set(), i := 1 to n, n%i = 0,insert(f,i)) + return f +end + +procedure sumfactors(n) + every (s := 0, i := 1 to n, n%i = 0) do s +:= i + return s +end diff --git a/Task/Duffinian-numbers/JavaScript/duffinian-numbers.js b/Task/Duffinian-numbers/JavaScript/duffinian-numbers.js new file mode 100644 index 0000000000..1c0331bc11 --- /dev/null +++ b/Task/Duffinian-numbers/JavaScript/duffinian-numbers.js @@ -0,0 +1,49 @@ +'use strict'; + +// ---------- helpers ---------- +const gcd = (a, b) => { + while (b !== 0) [a, b] = [b, a % b]; + return a; +}; + +// ---------- core logic ---------- +function createDuffians(limit) { + // divisor-sum table: divSum[i] = σ(i) + const divSum = new Array(limit).fill(1); + for (let i = 2; i < limit; ++i) { + for (let j = i; j < limit; j += i) divSum[j] += i; + } + + // mark non-Duffinians with 0 + divSum[1] = 0; // 1 is not Duffinian + for (let n = 2; n < limit; ++n) { + const s = divSum[n]; + if (s === n + 1 || gcd(n, s) !== 1) divSum[n] = 0; + } + return divSum; +} + +// ---------- main ---------- +const duffians = createDuffians(11_000); + +console.log('The first 50 Duffinian numbers:'); +let count = 0, n = 1; +while (count < 50) { + if (duffians[n] > 0) { + process.stdout.write(String(n).padStart(4) + (++count % 25 ? '' : '\n')); + } + ++n; +} +console.log(); + +console.log('The first 16 Duffinian triplets:'); +count = 0; +n = 3; +while (count < 16) { + if (duffians[n - 2] && duffians[n - 1] && duffians[n]) { + const triplet = `(${n - 2}, ${n - 1}, ${n})`; + process.stdout.write(triplet.padStart(22) + (++count % 4 ? '' : '\n')); + } + ++n; +} +console.log(); diff --git a/Task/Duffinian-numbers/Julia/duffinian-numbers.julia b/Task/Duffinian-numbers/Julia/duffinian-numbers.jl similarity index 100% rename from Task/Duffinian-numbers/Julia/duffinian-numbers.julia rename to Task/Duffinian-numbers/Julia/duffinian-numbers.jl diff --git a/Task/Duffinian-numbers/Lua/duffinian-numbers.lua b/Task/Duffinian-numbers/Lua/duffinian-numbers.lua new file mode 100644 index 0000000000..a8422b4049 --- /dev/null +++ b/Task/Duffinian-numbers/Lua/duffinian-numbers.lua @@ -0,0 +1,58 @@ +function gcd(a, b) + while b ~= 0 do + a, b = b, a % b + end + return a +end + +function duffinian(n) + if n == 2 then return false end + local total = 1 + local power = 2 + local m = n + while (n & 1) == 0 do + total = total + power + power = power << 1 + n = n >> 1 + end + local p = 3 + while p * p <= n do + local sum = 1 + local power = p + while n % p == 0 do + sum = sum + power + power = power * p + n = n / p + end + total = total * sum + p = p + 2 + end + if m == n then return false end + if n > 1 then total = total * (n + 1) end + return gcd(total, m) == 1 +end + +print("First 50 Duffinian numbers:") +count = 0 +n = 1 +while count < 50 do + if duffinian(n) then + count = count + 1 + if count % 10 == 0 then space = 10 else space = 32 end + io.write(string.format('%3d%c', n, space)) + end + n = n + 1 +end + +print("\nFirst 30 Duffinian triplets:") +n = 1 +m = 0 +count = 0 +while count < 30 do + if duffinian(n) then m = m + 1 else m = 0 end + if m == 3 then + count = count + 1 + print(string.format('%d, %d, %d', n - 2, n - 1, n)) + end + n = n + 1 +end diff --git a/Task/Duffinian-numbers/PARI-GP/duffinian-numbers.parigp b/Task/Duffinian-numbers/PARI-GP/duffinian-numbers.parigp new file mode 100644 index 0000000000..dfdeaaa0d6 --- /dev/null +++ b/Task/Duffinian-numbers/PARI-GP/duffinian-numbers.parigp @@ -0,0 +1,26 @@ +isDuffinian(n) = (!isprime(n)) && (gcd(n, sigma(n)) == 1); + +testDuffinians()= +{ + print("First 50 Duffinian numbers:"); + count = 0; n = 2; + while(count < 50, + if (isDuffinian(n), + print1(n, " "); + count++; + ); + n++; + ); + + print("\n\nFifteen Duffinian triplets:"); + count = 0; n = 2; + while (count < 15, + if (isDuffinian(n) && isDuffinian(n + 1) && isDuffinian(n + 2), + print(n, " ", n + 1, " ", n + 2); + count++; + ); + n++; + ); +} + +testDuffinians(); diff --git a/Task/Duffinian-numbers/PascalABC.NET/duffinian-numbers.pas b/Task/Duffinian-numbers/PascalABC.NET/duffinian-numbers.pas new file mode 100644 index 0000000000..e0d2dd58cb --- /dev/null +++ b/Task/Duffinian-numbers/PascalABC.NET/duffinian-numbers.pas @@ -0,0 +1,36 @@ +uses school; + +function is_duffinian(x: integer) := + (gcd(x, divisors(x).Sum) = 1) and + (divisors(x).ToArray.Length > 2); + +begin + var count := 0; + var i := 0; + writeln('First 50 Duffinian numbers:'); + while count < 50 do + begin + if is_duffinian(i) then + begin + write(i:4); + count += 1; + if count mod 10 = 0 then writeln; + end; + i += 1 + end; + + count := 0; + i := 0; + writeln; + writeln('First 15 Duffinian triplets:'); + while count < 15 do + begin + if is_duffinian(i) and is_duffinian(i + 1) and is_duffinian(i + 2) then + begin + writeln(i:6, i + 1:6, i + 2:6); + count += 1; + i += 3; + end; + i += 1; + end; +end. diff --git a/Task/Duffinian-numbers/Refal/duffinian-numbers.refal b/Task/Duffinian-numbers/Refal/duffinian-numbers.refal new file mode 100644 index 0000000000..576fa3f49d --- /dev/null +++ b/Task/Duffinian-numbers/Refal/duffinian-numbers.refal @@ -0,0 +1,76 @@ +$ENTRY Go { + = + >> + + + >; +}; + +ShowTriple { + s.N = >; +}; + +Each { + s.F = ; + s.F t.I e.X = ; +}; + +Group { + s.N = ; + s.N e.X, : (e.1) e.2 = (e.1) ; +}; + +Gen { + s.N s.F = ; + 0 s.F s.I = ; + s.N s.F s.I, : { + True = s.I s.F >; + False = >; + }; +}; + +DuffinianTriple { + s.N, + > + >: True True True = True; + s.N = False; +}; + +Duffinian { + s.N, : s.S, + : s.P, + s.S : { + s.P s.1 = False; + s.Q 1 = True; + s.1 s.2 = False; + }; +}; + +Gcd { + s.A 0 = s.A; + s.A s.B = >; +}; + +SigmaSum { + s.N = 2 >; + s.N s.Sum s.D s.Max, : '+' = s.Sum; + s.N s.Sum s.D s.Max, : s.N = ; + s.N s.Sum s.D s.Max, : 0 = + >> + s.Max>; + s.N s.Sum s.D s.Max = s.Max>; +}; + +Sqrt { + 0 = 1; + 1 = 1; + s.N = >; + s.N s.X0, +
> 2>: s.X1, + : { + '+' = ; + s.C = s.X0; + }; +}; diff --git a/Task/Duffinian-numbers/Ring/duffinian-numbers.ring b/Task/Duffinian-numbers/Ring/duffinian-numbers.ring new file mode 100644 index 0000000000..c7de980c3e --- /dev/null +++ b/Task/Duffinian-numbers/Ring/duffinian-numbers.ring @@ -0,0 +1,97 @@ +Load "stdlibcore.ring" + +nr = 0 +num = 0 +sig1 = 0 +cmp = 0 + +see "FIRST 50 DUFFINIAN NUMBERS:" + nl + +while nr < 50 + num = num + 1 + sigma = 0 + cmp = comp(num) + if cmp = 1 + sgm = sigm1(num) + relat1prim() + ok +end + +nr = 0 +fok = 0 +numc = 1 +sig1 = 0 +sig2 = 0 +sig3 = 0 + +see nl + "FIRST 15 DUFFINIAN TRIPLETS:" + nl + +while nr < 15 + + num1 = numc + num2 = num1 + 1 + num3 = num2 + 1 + cmp1 = comp(num1) + cmp2 = comp(num2) + cmp3 = comp(num3) + if (cmp1 = 1) and (cmp2 = 1) and (cmp3 = 1) + sigm1(num1) + sigm2(num2) + sigm3(num3) + ok + numc = numc + 1 +end + +func comp(nm) + fok = 0 + flag = 0 + for n = 1 to nm + if nm%n = 0 + flag = flag + 1 + ok + if flag > 2 + fok = 1 + exit + ok + next + return fok + +func sigm1(num1) + sig1 = 0 + for n = 1 to num1 + if num1%n = 0 + sig1 = sig1 + n + ok + next + +func sigm2(num2) + sig2 = 0 + for n = 1 to num2 + if num2%n = 0 + sig2 = sig2 + n + ok + next + +func sigm3(num3) + sig3 = 0 + for n = 1 to num3 + if num3%n = 0 + sig3 = sig3 + n + ok + next + + relat2prim() + +func relat1prim() + if (gcd(num,sig1) = 1) + nr = nr + 1 + see "" + num + " " + ok + return nr + +func relat2prim() + if ((gcd(num1,sig1) = 1) and (gcd(num2,sig2) = 1) and (gcd(num3,sig3) = 1)) + nr = nr + 1 + see "" + num1 + "-" + num3 + " " + ok + return nr diff --git a/Task/Duffinian-numbers/Rust/duffinian-numbers.rs b/Task/Duffinian-numbers/Rust/duffinian-numbers.rs new file mode 100644 index 0000000000..e6b44a1472 --- /dev/null +++ b/Task/Duffinian-numbers/Rust/duffinian-numbers.rs @@ -0,0 +1,97 @@ +fn gcd(mut a: i32, mut b: i32) -> i32 { + while b != 0 { + let temp = b; + b = a % b; + a = temp; + } + a +} + +fn duffinian(n: i32) -> bool { + if n == 2 { + return false; + } + + let mut total = 1; + let mut power = 2; + let m = n; + let mut n = n; + + // Handle powers of 2 + while (n & 1) == 0 { + total += power; + power <<= 1; + n >>= 1; + } + + // Handle odd prime factors + let mut p = 3; + while p * p <= n { + let mut sum = 1; + power = p; + while n % p == 0 { + sum += power; + power *= p; + n /= p; + } + total *= sum; + p += 2; + } + + // Check if n is composite + if m == n { + return false; + } + + // Handle remaining prime factor + if n > 1 { + total *= n + 1; + } + + gcd(total, m) == 1 +} + +fn main() { + println!("First 50 Duffinian numbers:"); + let mut count = 0; + let mut n = 1; + + while count < 50 { + if duffinian(n) { + print!("{:3}", n); + count += 1; + if count % 10 == 0 { + println!(); + } else { + print!(" "); + } + } + n += 1; + } + + println!("\nFirst 50 Duffinian triplets:"); + let mut n = 1; + let mut m = 0; + let mut count = 0; + + while count < 50 { + if duffinian(n) { + m += 1; + } else { + m = 0; + } + + if m == 3 { + let triplet = format!("({}, {}, {})", n - 2, n - 1, n); + print!("{:<24}", triplet); + count += 1; + if count % 3 == 0 { + println!(); + } else { + print!(" "); + } + } + n += 1; + } + println!(); +} diff --git a/Task/Duffinian-numbers/SETL/duffinian-numbers.setl b/Task/Duffinian-numbers/SETL/duffinian-numbers.setl new file mode 100644 index 0000000000..792e5adddc --- /dev/null +++ b/Task/Duffinian-numbers/SETL/duffinian-numbers.setl @@ -0,0 +1,48 @@ +program duffinian_numbers; + init sigma := divisor_sum_table(20000); + + print("First 50 Duffinian numbers:"); + loop for n in first(50, routine is_duffinian) do + nprint(lpad(str n, 6)); + if (col +:= 1) mod 10 = 0 then print; end if; + end loop; + + print; + print("First 15 Duffinian triplets:"); + loop for n in first(15, routine is_duffinian_triplet) do + print(+/[lpad(str i, 6) : i in [n,n+1,n+2]]); + end loop; + + proc first(num, pred); + ls := []; + loop while #ls < num do + loop until call(pred, n) do + n +:= 1; + end loop; + ls with:= n; + end loop; + return ls; + end proc; + + proc is_duffinian_triplet(n); + return and/[is_duffinian(i) : i in [n,n+1,n+2]]; + end proc; + + proc is_duffinian(n); + return sigma(n) > n+1 and gcd(n, sigma(n)) = 1; + end proc; + + proc gcd(a,b); + return if b=0 then a else gcd(b, a mod b) end; + end proc; + + proc divisor_sum_table(sz); + ds := [0] * sz; + loop for i in [1..sz] do + loop for j in [i,i+i..sz] do + ds(j) +:= i; + end loop; + end loop; + return ds; + end proc; +end program; diff --git a/Task/Duffinian-numbers/Wren/duffinian-numbers.wren b/Task/Duffinian-numbers/Wren/duffinian-numbers.wren index 3ed0e06725..319dea5ef4 100644 --- a/Task/Duffinian-numbers/Wren/duffinian-numbers.wren +++ b/Task/Duffinian-numbers/Wren/duffinian-numbers.wren @@ -1,5 +1,4 @@ import "./math" for Int -import "./seq" for Lst import "./fmt" for Fmt var limit = 200000 // say diff --git a/Task/Dutch-national-flag-problem/ANSI-BASIC/dutch-national-flag-problem.basic b/Task/Dutch-national-flag-problem/ANSI-BASIC/dutch-national-flag-problem.basic new file mode 100644 index 0000000000..1c951186b3 --- /dev/null +++ b/Task/Dutch-national-flag-problem/ANSI-BASIC/dutch-national-flag-problem.basic @@ -0,0 +1,59 @@ +100 REM Dutch national flag problem +110 DECLARE EXTERNAL SUB PrintColorSeq +120 DECLARE EXTERNAL SUB SortByColor +130 REM 0: blue, 1: while, 2: red +140 DIM T(0 TO 19) +150 LET UP = UBOUND(T) +160 REM Set colors +170 RANDOMIZE +180 FOR I = 0 TO UP +190 LET T(I) = INT(RND * 3) +200 NEXT I +210 PRINT "Unsorted:" +220 CALL PrintColorSeq(T) +230 CALL SortByColor(T) +240 PRINT +250 PRINT "Sorted:" +260 CALL PrintColorSeq(T) +270 END +280 ! +290 EXTERNAL SUB PrintColorSeq (T()) +300 FOR I = 0 TO UBOUND(T) +310 SELECT CASE T(I) +320 CASE 0 +330 PRINT "B"; +340 CASE 1 +350 PRINT "W"; +360 CASE 2 +370 PRINT "R"; +380 END SELECT +390 NEXT I +400 PRINT +410 END SUB +420 ! +430 EXTERNAL SUB SortByColor (T()) +440 DECLARE EXTERNAL SUB Swap +450 LET B = 0 +460 LET W = 0 +470 LET R = UBOUND(T) +480 DO WHILE W <= R +490 SELECT CASE T(W) +500 CASE 1 +510 LET W = W + 1 +520 CASE 0 +530 CALL Swap(T(B), T(W)) +540 LET B = B + 1 +550 LET W = W + 1 +560 CASE 2 +570 call Swap(T(W), T(R)) +580 LET R = R - 1 +590 END SELECT +600 LOOP +610 END SUB +620 ! +630 EXTERNAL SUB Swap(A, B) +640 REM Some implementations have the SWAP statement, but it is not standard +650 LET Tmp = A +660 LET A = B +670 LET B = Tmp +680 END SUB diff --git a/Task/Dutch-national-flag-problem/Ada/dutch-national-flag-problem.ada b/Task/Dutch-national-flag-problem/Ada/dutch-national-flag-problem.adb similarity index 100% rename from Task/Dutch-national-flag-problem/Ada/dutch-national-flag-problem.ada rename to Task/Dutch-national-flag-problem/Ada/dutch-national-flag-problem.adb diff --git a/Task/Dutch-national-flag-problem/AutoIt/dutch-national-flag-problem.autoit b/Task/Dutch-national-flag-problem/AutoIt/dutch-national-flag-problem.au3 similarity index 100% rename from Task/Dutch-national-flag-problem/AutoIt/dutch-national-flag-problem.autoit rename to Task/Dutch-national-flag-problem/AutoIt/dutch-national-flag-problem.au3 diff --git a/Task/Dutch-national-flag-problem/BQN/dutch-national-flag-problem.bqn b/Task/Dutch-national-flag-problem/BQN/dutch-national-flag-problem.bqn new file mode 100644 index 0000000000..bfa3b6664a --- /dev/null +++ b/Task/Dutch-national-flag-problem/BQN/dutch-national-flag-problem.bqn @@ -0,0 +1,5 @@ +Make ← •rand.Range⟜≠⊏⊢ +IsSorted ← ∧´·≤˝˘2↕⊐ +Arrange ← /⁼∘⊐/⊣ + +20(⊢(⊢⋈IsSorted)⎉1⊢(⊢≍Arrange)Make)"RWB" diff --git a/Task/Dutch-national-flag-problem/C-sharp/dutch-national-flag-problem.cs b/Task/Dutch-national-flag-problem/C-sharp/dutch-national-flag-problem-1.cs similarity index 100% rename from Task/Dutch-national-flag-problem/C-sharp/dutch-national-flag-problem.cs rename to Task/Dutch-national-flag-problem/C-sharp/dutch-national-flag-problem-1.cs diff --git a/Task/Dutch-national-flag-problem/C-sharp/dutch-national-flag-problem-2.cs b/Task/Dutch-national-flag-problem/C-sharp/dutch-national-flag-problem-2.cs new file mode 100644 index 0000000000..4a1787555d --- /dev/null +++ b/Task/Dutch-national-flag-problem/C-sharp/dutch-national-flag-problem-2.cs @@ -0,0 +1,76 @@ +// Dutch national flag problem +using System; + +class DutchFlagProblem +{ + enum Color {Blue, White, Red}; + + static void WriteColorSeq(Color[] t) + { + uint n = (uint)t.Length; + for (uint i = 0; i < n; i++) + { + switch (t[i]) + { + case Color.Blue: + Console.Write("B"); + break; + case Color.White: + Console.Write("W"); + break; + case Color.Red: + Console.Write("R"); + break; + }; + } + Console.WriteLine(); + } + + static void Swap(ref Color x, ref Color y) + { + Color temp = x; + x = y; + y = temp; + } + + static void SortByColor(Color[] t) + { + uint b = 0, w = 0, r = (uint)t.Length - 1; + while (w <= r) + { + switch (t[w]) + { + case Color.White: + w++; + break; + case Color.Blue: + Swap(ref t[b], ref t[w]); + b++; + w++; + break; + case Color.Red: + Swap(ref t[w], ref t[r]); + r--; + break; + } + } + } + + static void Main() + { + const uint N = 20; + Color[] t = new Color[N]; + + // Set colors + Random rand = new Random(); + for (uint i = 0; i < N; i++) + t[i] = (Color)(rand.Next(3)); + + Console.WriteLine("Unsorted:"); + WriteColorSeq(t); + SortByColor(t); + Console.WriteLine(); + Console.WriteLine("Sorted:"); + WriteColorSeq(t); + } +} diff --git a/Task/Dutch-national-flag-problem/Crystal/dutch-national-flag-problem.cr b/Task/Dutch-national-flag-problem/Crystal/dutch-national-flag-problem.cr new file mode 100644 index 0000000000..3bbbfee1f8 --- /dev/null +++ b/Task/Dutch-national-flag-problem/Crystal/dutch-national-flag-problem.cr @@ -0,0 +1,34 @@ +enum FlagColor + Red + White + Blue + + def to_s + ["🔴", "⚪", "🔵"][value] + end +end + +module Indexable + def sorted? + (1...size).each do |i| + if self[i] < self[i-1] + return false + end + end + true + end +end + +balls = loop do + arr = Array.new(20) { FlagColor.values.sample } + break arr unless arr.sorted? +end + +puts balls.join +puts "Sorted: #{balls.sorted?}" +puts + +balls.sort! + +puts balls.join +puts "Sorted: #{balls.sorted?}" diff --git a/Task/Dutch-national-flag-problem/D/dutch-national-flag-problem-1.d b/Task/Dutch-national-flag-problem/D/dutch-national-flag-problem-1.d index afeef682f4..bed0a7a25d 100644 --- a/Task/Dutch-national-flag-problem/D/dutch-national-flag-problem-1.d +++ b/Task/Dutch-national-flag-problem/D/dutch-national-flag-problem-1.d @@ -3,7 +3,7 @@ import std.stdio, std.random, std.algorithm, std.traits, std.array; enum DutchColors { red, white, blue } void dutchNationalFlagSort(DutchColors[] items) pure nothrow @nogc { - int lo, mid, hi = items.length - 1; + ulong lo, mid, hi = items.length - 1; while (mid <= hi) final switch (items[mid]) { diff --git a/Task/Dutch-national-flag-problem/D/dutch-national-flag-problem-2.d b/Task/Dutch-national-flag-problem/D/dutch-national-flag-problem-2.d index 03a077347b..f6ba27017a 100644 --- a/Task/Dutch-national-flag-problem/D/dutch-national-flag-problem-2.d +++ b/Task/Dutch-national-flag-problem/D/dutch-national-flag-problem-2.d @@ -62,7 +62,7 @@ void main() { // More tests: foreach (i; 0 .. 100_000) { - int n = uniform(0, balls.length); + ulong n = uniform(0, balls.length); foreach (ref ball; balls[0 .. n]) ball = [EnumMembers!DutchColors][uniform(0, $)]; balls[0 .. n].dutchNationalFlagSort(DutchColors.red, diff --git a/Task/Dutch-national-flag-problem/Delphi/dutch-national-flag-problem.delphi b/Task/Dutch-national-flag-problem/Delphi/dutch-national-flag-problem.pas similarity index 100% rename from Task/Dutch-national-flag-problem/Delphi/dutch-national-flag-problem.delphi rename to Task/Dutch-national-flag-problem/Delphi/dutch-national-flag-problem.pas diff --git a/Task/Dutch-national-flag-problem/EasyLang/dutch-national-flag-problem.easy b/Task/Dutch-national-flag-problem/EasyLang/dutch-national-flag-problem.easy new file mode 100644 index 0000000000..10f3b5828a --- /dev/null +++ b/Task/Dutch-national-flag-problem/EasyLang/dutch-national-flag-problem.easy @@ -0,0 +1,23 @@ +col$[] = [ "red" "white" "blue" ] +for i to 8 + b[] &= random 1 3 +. +for b in b[] + write col$[b] & " " + if b < b0 : not_sorted = 1 + b0 = b +. +print "" +print "" +if not_sorted = 0 + print "already sorted" +else + for i = 1 to len b[] - 1 + for j = i + 1 to len b[] + if b[j] < b[i] : swap b[j] b[i] + . + . + for b in b[] + write col$[b] & " " + . +. diff --git a/Task/Dutch-national-flag-problem/Elixir/dutch-national-flag-problem.elixir b/Task/Dutch-national-flag-problem/Elixir/dutch-national-flag-problem.ex similarity index 100% rename from Task/Dutch-national-flag-problem/Elixir/dutch-national-flag-problem.elixir rename to Task/Dutch-national-flag-problem/Elixir/dutch-national-flag-problem.ex diff --git a/Task/Dutch-national-flag-problem/Erlang/dutch-national-flag-problem-1.erl b/Task/Dutch-national-flag-problem/Erlang/dutch-national-flag-problem-1.erl index 53fef5d216..4015d07d23 100644 --- a/Task/Dutch-national-flag-problem/Erlang/dutch-national-flag-problem-1.erl +++ b/Task/Dutch-national-flag-problem/Erlang/dutch-national-flag-problem-1.erl @@ -5,7 +5,7 @@ ball(red) -> 1; ball(white) -> 2; ball(blue) -> 3. -random_ball() -> lists:nth(random:uniform(3), [red, white, blue]). +random_ball() -> lists:nth(rand:uniform(3), [red, white, blue]). random_balls(N) -> random_balls(N,[]). random_balls(0,L) -> L; diff --git a/Task/Dutch-national-flag-problem/Free-Pascal-Lazarus/dutch-national-flag-problem.pas b/Task/Dutch-national-flag-problem/Free-Pascal-Lazarus/dutch-national-flag-problem.pas new file mode 100644 index 0000000000..8745222d90 --- /dev/null +++ b/Task/Dutch-national-flag-problem/Free-Pascal-Lazarus/dutch-national-flag-problem.pas @@ -0,0 +1,74 @@ +program DutchF; + + { Dutch national flag problem } + +type + TColor = (Blue, White, Red); + +const + N = 20; + +var + T: array [0 .. N - 1] of TColor; + I: cardinal; + + procedure Swap(var A, B: TColor); + var + Tmp: TColor; + begin + Tmp := A; + A := B; + B := Tmp; + end; + + procedure WriteColorSeq(T: array of TColor); + var + I: cardinal; + begin + for I := low(T) to high(T) do + case T[I] of + Blue: Write('B'); + White: Write('W'); + Red: Write('R'); + end; + WriteLn; + end; + + procedure SortByColor(var T: array of TColor); + var + B, W, R: cardinal; + begin + B := Low(T); + W := Low(T); + R := High(T); + while W <= R do + case T[W] of + White: + Inc(W); + Blue: + begin + Swap(T[B], T[W]); + Inc(B); + Inc(W); + end; + Red: + begin + Swap(T[W], T[R]); + Dec(R); + end; + end; + end; + +begin + { Set colors } + Randomize; + for I := 0 to N - 1 do + T[I] := TColor(Random(3)); + writeln('Unsorted:'); + WriteColorSeq(T); + SortByColor(T); + WriteLn; + writeln('Sorted:'); + WriteColorSeq(T); + {readln;} +end. diff --git a/Task/Dutch-national-flag-problem/FutureBasic/dutch-national-flag-problem.basic b/Task/Dutch-national-flag-problem/FutureBasic/dutch-national-flag-problem.basic new file mode 100644 index 0000000000..f7c621a282 --- /dev/null +++ b/Task/Dutch-national-flag-problem/FutureBasic/dutch-national-flag-problem.basic @@ -0,0 +1,43 @@ +void local fn DrawBalls( y as long, balls as CFArrayRef, sort as BOOL ) + long col, prevCol = 0, x = 10 + CFArrayRef cols = @[fn ColorWithSRGB(.78,.06,.18,1.0),fn ColorWhite,fn ColorWithSRGB(0,.24,.65,1.0)] + if ( sort ) then balls = fn ArraySortedArrayUsingSelector( balls, @"compare:" ) + + pen -1 + for long i = 0 to len(balls) - 1 + col = intval(balls[i]) + if ( sort == YES ) + if ( col != prevCol ) then y += 30 : x = 10 + else + if ( i > 0 && i % 15 == 0 ) then y += 30 : x = 10 + end if + oval fill (x,y,30,30), cols[col] + x += 30 + prevCol = col + next +end fn + +void local fn DutchNationalFlagProblem + window 1, @"Dutch national flag problem", (0,0,470,230) + WindowSetBackgroundColor( 1, fn ColorWithSRGB(1.0,.61,0,1.0) ) + + CFMutableArrayRef balls = fn MutableArrayNew + + text @"Menlo-Bold",, fn ColorWhite + + for long i = 0 to 29 + balls[i] = @(rnd(3)-1) + next + + print @"Unsorted:" + fn DrawBalls( 20, balls, NO ) + + print %(3,100)@"Sorted:" + fn DrawBalls( 120, balls, YES ) +end fn + +random + +fn DutchNationalFlagProblem + +HandleEvents diff --git a/Task/Dutch-national-flag-problem/GW-BASIC/dutch-national-flag-problem.basic b/Task/Dutch-national-flag-problem/GW-BASIC/dutch-national-flag-problem.basic new file mode 100644 index 0000000000..d0fd2bce6a --- /dev/null +++ b/Task/Dutch-national-flag-problem/GW-BASIC/dutch-national-flag-problem.basic @@ -0,0 +1,42 @@ +100 REM Dutch national flag problem +110 REM 0: blue, 1: while, 2: red +120 OPTION BASE 0 +130 N% = 20 +140 UP% = N% - 1 +150 DIM T%(UP%) +160 REM Set colors +170 RANDOMIZE +180 FOR I% = 0 TO UP% +190 T%(I%) = INT(RND * 3) +200 NEXT I% +210 PRINT "Unsorted:" +220 GOSUB 1000 +230 GOSUB 2000 +240 PRINT +250 PRINT "Sorted:" +260 GOSUB 1000 +270 END +1000 REM ** Print color sequence +1010 FOR I% = 0 TO UP% +1020 IF T%(I%) = 0 THEN PRINT "B"; ELSE IF T%(I%) = 1 THEN PRINT "W"; ELSE PRINT "R"; +1030 NEXT I% +1040 PRINT +1050 RETURN +2000 REM ** Sort by color +2010 B% = 0: W% = 0: R% = UP% +2020 WHILE W% <= R% +2030 IF T%(W%) <> 1 THEN 2070 +2040 REM white +2050 W% = W% + 1 +2060 GOTO 2160 +2070 IF T%(W%) <> 0 THEN 2130 +2080 REM blue +2090 SWAP T%(B%), T%(W%) +2100 B% = B% + 1 +2110 W% = W% + 1 +2120 GOTO 2160 +2130 REM red +2140 SWAP T%(W%), T%(R%) +2150 R% = R% - 1 +2160 WEND +2170 RETURN diff --git a/Task/Dutch-national-flag-problem/Java/dutch-national-flag-problem.java b/Task/Dutch-national-flag-problem/Java/dutch-national-flag-problem-1.java similarity index 100% rename from Task/Dutch-national-flag-problem/Java/dutch-national-flag-problem.java rename to Task/Dutch-national-flag-problem/Java/dutch-national-flag-problem-1.java diff --git a/Task/Dutch-national-flag-problem/Java/dutch-national-flag-problem-2.java b/Task/Dutch-national-flag-problem/Java/dutch-national-flag-problem-2.java new file mode 100644 index 0000000000..3c8b7d46da --- /dev/null +++ b/Task/Dutch-national-flag-problem/Java/dutch-national-flag-problem-2.java @@ -0,0 +1,79 @@ +// Dutch national flag problem + +public class Main { + + enum Color {BLUE, WHITE, RED}; + + static final int N = 20; + + static void printColorSeq(Color[] t) { + int n = t.length; + for (int i = 0; i < n; i++) { + switch (t[i]) { + case BLUE: + System.out.print("B"); + break; + case WHITE: + System.out.print("W"); + break; + case RED: + System.out.print("R"); + break; + } + } + System.out.println(); + } + + static void swapElems(Color[] arr, int i, int j) { + Color temp = arr[i]; + arr[i] = arr[j]; + arr[j] = temp; + } + + static void sortByColor(Color[] t) { + int b = 0, w = 0, r = t.length - 1; + while (w <= r) { + switch (t[w]) { + case WHITE: + w++; + break; + case BLUE: + swapElems(t, b, w); + b++; + w++; + break; + case RED: + swapElems(t, w, r); + r--; + break; + } + } + } + + public static void main(String[] args) { + Color[] t = new Color[N]; + + // Set colors + for (int i = 0; i < N; i++) { + int ci = (int)(Math.random() * 3); + switch (ci) { + case 0: + t[i] = Color.BLUE; + break; + case 1: + t[i] = Color.WHITE; + break; + case 2: + t[i] = Color.RED; + break; + } + } + + System.out.println("Unsorted:"); + printColorSeq(t); + sortByColor(t); + System.out.println(); + System.out.println("Sorted:"); + printColorSeq(t); + } +} diff --git a/Task/Dutch-national-flag-problem/Julia/dutch-national-flag-problem-1.jl b/Task/Dutch-national-flag-problem/Julia/dutch-national-flag-problem-1.jl new file mode 100644 index 0000000000..5aa84ff6c8 --- /dev/null +++ b/Task/Dutch-national-flag-problem/Julia/dutch-national-flag-problem-1.jl @@ -0,0 +1,26 @@ +using Printf + +const COLORS = ["red", "white", "blue"] + +function dutchsort!(a::AbstractVector, lo=COLORS[1], hi=COLORS[end]) + i = 1 + j = 1 + n = length(a) + while j <= n + if a[j] == lo + a[i], a[j] = a[j], a[i] + i += 1 + j += 1 + elseif a[j] == hi + a[j], a[n] = a[n], a[j] + n -= 1 + else + j += 1 + end + end + return a +end + +function dutchsort(a::AbstractVector, lo=COLORS[1], hi=COLORS[end]) + dutchsort!(copy(a), lo, hi) +end diff --git a/Task/Dutch-national-flag-problem/Julia/dutch-national-flag-problem-1.julia b/Task/Dutch-national-flag-problem/Julia/dutch-national-flag-problem-1.julia deleted file mode 100644 index 6ac9875975..0000000000 --- a/Task/Dutch-national-flag-problem/Julia/dutch-national-flag-problem-1.julia +++ /dev/null @@ -1,24 +0,0 @@ -const COLORS = ["red", "white", "blue"] - -function dutchsort!(a::Array{ASCIIString,1}, lo=COLORS[1], hi=COLORS[end]) - i = 1 - j = 1 - n = length(a) - while j <= n - if a[j] == lo - a[i], a[j] = a[j], a[i] - i += 1 - j += 1 - elseif a[j] == hi - a[j], a[n] = a[n], a[j] - n -= 1 - else - j += 1 - end - end - return a -end - -function dutchsort(a::Array{ASCIIString,1}, lo=COLORS[1], hi=COLORS[end]) - dutchsort!(copy(a), lo, hi) -end diff --git a/Task/Dutch-national-flag-problem/Julia/dutch-national-flag-problem-2.jl b/Task/Dutch-national-flag-problem/Julia/dutch-national-flag-problem-2.jl new file mode 100644 index 0000000000..fc37d7ec80 --- /dev/null +++ b/Task/Dutch-national-flag-problem/Julia/dutch-national-flag-problem-2.jl @@ -0,0 +1,30 @@ +function formatdf(a::AbstractVector) + i = 0 + s = " " + for c in a + s *= @sprintf "%6s" c + i += 1 + i %= 8 + if i == 0 + s *= "\n " + end + end + return s +end + +const cnum = 20 +const d = [COLORS[rand(1:3)] for i in 1:cnum] +while d == dutchsort(d) + d .= [COLORS[rand(1:3)] for i in 1:cnum] +end + +println("The original list is:") +println(formatdf(d)) + +print("Sorting with dutchsort, after") +@time e = dutchsort(d) +println(formatdf(e)) + +print("Sorting conventionally, after") +@time e = sort(d, by = x -> findfirst(==(x), COLORS)) +println(formatdf(e)) diff --git a/Task/Dutch-national-flag-problem/Julia/dutch-national-flag-problem-2.julia b/Task/Dutch-national-flag-problem/Julia/dutch-national-flag-problem-2.julia deleted file mode 100644 index d597551c58..0000000000 --- a/Task/Dutch-national-flag-problem/Julia/dutch-national-flag-problem-2.julia +++ /dev/null @@ -1,30 +0,0 @@ -function formatdf(a::Array{ASCIIString,1}) - i = 0 - s = " " - for c in a - s *= @sprintf "%6s" c - i += 1 - i %= 8 - if i == 0 - s *= "\n " - end - end - return s -end - -cnum = 20 -d = [COLORS[rand(1:3)] for i in 1:cnum] -while d == dutchsort(d) - d = [COLORS[rand(1:3)] for i in 1:cnum] -end - -println("The original list is:") -println(formatdf(d)) - -print("Sorting with dutchsort, ") -@time e = dutchsort(d) -println(formatdf(e)) - -print("Sorting conventionally, ") -@time e = sort(d, by=x->findfirst(COLORS, x)) -println(formatdf(e)) diff --git a/Task/Dutch-national-flag-problem/Kotlin/dutch-national-flag-problem.kotlin b/Task/Dutch-national-flag-problem/Kotlin/dutch-national-flag-problem.kts similarity index 100% rename from Task/Dutch-national-flag-problem/Kotlin/dutch-national-flag-problem.kotlin rename to Task/Dutch-national-flag-problem/Kotlin/dutch-national-flag-problem.kts diff --git a/Task/Dutch-national-flag-problem/Loglan82/dutch-national-flag-problem.loglan82 b/Task/Dutch-national-flag-problem/Loglan82/dutch-national-flag-problem.loglan82 new file mode 100644 index 0000000000..dee8475b53 --- /dev/null +++ b/Task/Dutch-national-flag-problem/Loglan82/dutch-national-flag-problem.loglan82 @@ -0,0 +1,71 @@ +(* Dutch national flag problem *) + +block +const + c_blue = 0, c_white = 1, c_red = 2, + n = 20; +var + i: integer, + t: arrayof integer; + + unit writeln_color_seq: procedure (t: arrayof integer); + var + i: integer; + begin + for i := lower(t) to upper(t) + do + case t(i) + when c_blue: + write("B"); + when c_white: + write("W"); + when c_red: + write("R"); + esac; + od; + writeln; + end writeln_color_seq; + + unit swap: procedure (inout a, b: integer); + var + tmp: integer; + begin + tmp := a; + a := b; + b := tmp + end swap; + + unit sort_by_color: procedure (t: arrayof integer); + var + b, w, r: integer; + begin + b, w := lower(t); + r := upper(t); + while (w <= r) + do + case t(w) + when c_white: + w := w + 1; + when c_blue: + call swap(t(b), t(w)); + b := b + 1; + w := w + 1; + when c_red: + call swap(t(w), t(r)); + r := r - 1; + esac + od; + end sort_by_color; + +begin + array t dim (0 : n - 1); + + (* Set colors *) + for i := 0 to n - 1 do t(i) := entier(random * 3) od; + writeln("Unsorted:"); + call writeln_color_seq(t); + call sort_by_color(t); + writeln; + writeln("Sorted:"); + call writeln_color_seq(t); +end; diff --git a/Task/Dutch-national-flag-problem/M2000-Interpreter/dutch-national-flag-problem-1.m2000 b/Task/Dutch-national-flag-problem/M2000-Interpreter/dutch-national-flag-problem-1.m2000 new file mode 100644 index 0000000000..12e0137b20 --- /dev/null +++ b/Task/Dutch-national-flag-problem/M2000-Interpreter/dutch-national-flag-problem-1.m2000 @@ -0,0 +1,23 @@ + SortElse=lambda white (a(), &swaps, &compares)->{ + long mid=white + long i, j, k=len(a())-1 + while j<=k + + if a(j)mid then + compares+=2 + swap a(j), a(k) + swaps++ + k-- + else + compares+=2 + j++ + end if + end while + =a() + } diff --git a/Task/Dutch-national-flag-problem/M2000-Interpreter/dutch-national-flag-problem-2.m2000 b/Task/Dutch-national-flag-problem/M2000-Interpreter/dutch-national-flag-problem-2.m2000 new file mode 100644 index 0000000000..acaf408117 --- /dev/null +++ b/Task/Dutch-national-flag-problem/M2000-Interpreter/dutch-national-flag-problem-2.m2000 @@ -0,0 +1,88 @@ +function Dutch_national_flag_problem { + enum bands {red=1, white, blue} + s=red + check_in_order=lambda s, (a as array) ->{ + boolean true=@true, false + k=each(a) + m=s + Z=S + =true + while k + z=array(k) + if m=z else + if m=blue then + =false + break + else + m++ + if m=z else =false : break + end if + end if + end while + } + SortElse=lambda (m(), &swaps, &compares)->{ + long t=len(m()) + dim c(1 to 3)=t + c=1 + for i=0 to len(m())-1 + rem ? "pos:";i;" "; + w=m(i) + if w0 + if c(k)=t then k-- : continue + if m(j)c(k) then c(m(j))=c(k) + rem ? "swap:";m(j);" at pos "+j;" with ";m(c(k)); " at pos ";c(k) + swap m(j), m(c(k)) + rem ? "just swapped array :", m()#str$() + rem ? "c()", c()#str$() + swaps++ + j=c(k) + c(k)++ + end if + k-- + rem ? "k=";k, c(k) + end while + else.if w>c then + c=w + if i-c(c)>1 else c(c)=i + end if + next + =m() + } + random_band=lambda->random(1, 3) + n=random(10, 20) + if n<3 then exit ' need at least 3 colors for the flag - although n now didn't get value 3 we place it to remember it later + do + do + dim balls(n)< { - if size<1 then size=1 - randomitem=lambda a->a#val(random(0,2)) - dim a(size)<{ - Document r$=eval$(array(s)) - if len(s)>1 then - For i=1 to len(s)-1 { - r$=", "+eval$(array(s,i)) - } - end if - =r$ -} -TestSort$=lambda$ (s as array)-> { - ="unsorted: " - x=array(s) - for i=1 to len(s)-1 { - k=array(s,i) - if x>k then break - swap x, k - } - ="sorted: " -} -Positions=lambda mid=White (a as array) ->{ - m=len(a) - dim Base 0, b(m)=-1 - low=-1 - high=m - m-- - i=0 - medpos=stack - link a to a() - for i=m to 0 { - if a(i)<=mid then exit - high-- - b(high)=high - } - for i=0 to m { - if a(i)>=mid then exit - low++ - b(low)=low - } - if high-low>1 then - for i=low+1 to high-1 { - select case a(i)<=>Mid - case -1 - low++ : b(low)=i - case 1 - { - high-- :b(high)=i - if High0 then - dim c() - c()=array(medpos) - stock c(0) keep len(c()), b(low+1) - for i=low+1 to high-1 - if b(i)>low and b(i)i then swap b(b(i)), b(i) - next i - end if - if low>0 then - for i=0 to low - if b(i)<=low and b(i)<>i then swap b(b(i)), b(i) - next - end if - if High=High and b(i)<>i then swap b(b(i)), b(i) - next - end if - =b() -} -InPlace=Lambda (&p(), &Final()) ->{ - def i=0, j=-1, k=-1, many=0 - for i=0 to len(p())-1 - if p(i)<>i then - j=i - z=final(j) - do - final(j)=final(p(j)) - k=j - j=p(j) - p(k)=k - many++ - until j=i - final(k)=z - end if - next - =many -} - - -Dim final(), p(), second(), p1() -Rem final()=(White,Red,Blue,White,Red, Red, Blue) -Rem final()=(white, blue, red, blue, white) - -final()=fillarray(30) -Print "Items: ";len(final()) -Report TestSort$(final())+Display$(final()) -\\ backup for final() for second example -second()=final() -p()=positions(final()) -\\ backup p() to p1() for second example -p1()=p() - - -Report Center, "InPlace" -rem Print p() ' show array items -many=InPlace(&p(), &final()) -rem print p() ' show array items -Report TestSort$(final())+Display$(final()) -print "changes: "; many - - -Report Center, "Using another array to make the changes" -final()=second() -\\ using a second array to place only the changes -item=each(p1()) -many=0 -While item { - if item^=array(item) else final(item^)=second(array(item)) : many++ -} -Report TestSort$(final())+Display$(final()) -print "changes: "; many -Module three_way_partition (A as array, mid as balls, &swaps) { - Def i, j, k - k=Len(A) - Link A to A() - While j < k - if A(j) < mid Then - Swap A(i), A(j) - swaps++ - i++ - j++ - Else.if A(j) > mid Then - k-- - Swap A(j), A(k) - swaps++ - Else - j++ - End if - End While -} -Many=0 -Z=second() -Print -Report center, {Three Way Partition -} -Report TestSort$(Z)+Display$(Z) -three_way_partition Z, White, &many -Print -Report TestSort$(Z)+Display$(Z) -Print "changes: "; many diff --git a/Task/Dutch-national-flag-problem/Modula-2/dutch-national-flag-problem.mod2 b/Task/Dutch-national-flag-problem/Modula-2/dutch-national-flag-problem.mod2 new file mode 100644 index 0000000000..2802b39ad3 --- /dev/null +++ b/Task/Dutch-national-flag-problem/Modula-2/dutch-national-flag-problem.mod2 @@ -0,0 +1,80 @@ +MODULE DutchF; +(* Dutch national flag problem *) + +FROM RandomNumbers IMPORT + Rnd; +FROM STextIO IMPORT + WriteLn, WriteString; + +TYPE + TColor = (Blue, White, Red); + +CONST + N = 20; + +VAR + T: ARRAY [0 .. N - 1] OF TColor; + I: CARDINAL; + +PROCEDURE Swap(VAR A, B: TColor); +VAR + Tmp: TColor; +BEGIN + Tmp := A; + A := B; + B := Tmp +END Swap; + +PROCEDURE WriteColorSeq(T: ARRAY OF TColor); +VAR + I: CARDINAL; +BEGIN + FOR I := 0 TO HIGH(T) DO + CASE T[I] OF + | Blue: + WriteString("B"); + | White: + WriteString("W"); + | Red: + WriteString("R"); + END + END; + WriteLn; +END WriteColorSeq; + +PROCEDURE SortByColor(VAR T: ARRAY OF TColor); +VAR + B, W, R: CARDINAL; +BEGIN + B := 0; + W := 0; + R := HIGH(T); + WHILE W <= R DO + CASE T[W] OF + | White: + W := W + 1; + | Blue: + Swap(T[B], T[W]); + B := B + 1; + W := W + 1; + | Red: + Swap(T[W], T[R]); + R := R - 1; + END; + END; +END SortByColor; + +BEGIN + (* Set colors *) + FOR I := 0 TO N - 1 DO + T[I] := VAL(TColor, Rnd(3)); + END; + WriteString("Unsorted:"); + WriteLn; + WriteColorSeq(T); + SortByColor(T); + WriteLn; + WriteString("Sorted:"); + WriteLn; + WriteColorSeq(T); +END DutchF. diff --git a/Task/Dutch-national-flag-problem/PascalABC.NET/dutch-national-flag-problem.pas b/Task/Dutch-national-flag-problem/PascalABC.NET/dutch-national-flag-problem.pas new file mode 100644 index 0000000000..eaa7d1319a --- /dev/null +++ b/Task/Dutch-national-flag-problem/PascalABC.NET/dutch-national-flag-problem.pas @@ -0,0 +1,33 @@ +type + colors = (red, white, blue); + +procedure threeWayPartition(a: array of colors; mid: colors); +begin + var (i, j) := (0, 0); + var k := a.High; + while j <= k do + if a[j] < mid then + begin + swap(a[i], a[j]); + i += 1; + j += 1; + end + else if a[j] > mid then + begin + swap(a[j], a[k]); + k -= 1; + end + else j += 1; +end; + +begin + var balls: array of colors; + repeat + balls := ArrGen(10, i -> |red, white, blue|.randomelement); + until balls <> balls.Sorted; + + println('Original ball order:', balls); + threewaypartition(balls, white); + println('Sorted ball order: ', balls); + assert(balls <> balls.sorted, 'Not sorted!'); +end. diff --git a/Task/Dutch-national-flag-problem/Phix/dutch-national-flag-problem.phix b/Task/Dutch-national-flag-problem/Phix/dutch-national-flag-problem.phix index a0357d6a9b..6167e25ead 100644 --- a/Task/Dutch-national-flag-problem/Phix/dutch-national-flag-problem.phix +++ b/Task/Dutch-national-flag-problem/Phix/dutch-national-flag-problem.phix @@ -1,41 +1,39 @@ -(phixonline)--> - with javascript_semantics - function three_way_partition(sequence s, integer mid) - integer i=1, j=1, n = length(s) - while j <= n do - if s[j] < mid then - {s[i],s[j]} = {s[j],s[i]} - i += 1 - j += 1 - elsif s[j] > mid then - {s[j],s[n]} = {s[n],s[j]} - n -= 1 - else - j += 1 - end if - end while - return s - end function +with javascript_semantics +function three_way_partition(sequence s, integer mid) + integer i=1, j=1, n = length(s) + while j <= n do + if s[j] < mid then + {s[i],s[j]} = {s[j],s[i]} + i += 1 + j += 1 + elsif s[j] > mid then + {s[j],s[n]} = {s[n],s[j]} + n -= 1 + else + j += 1 + end if + end while + return s +end function - constant colours = {"red","white","blue"} - enum /*red,*/ white = 2, blue, maxc = blue +constant colours = {"red","white","blue"} +enum /*red,*/ white = 2, blue, maxc = blue - procedure show(string msg, sequence s) - sequence t = repeat(0,length(s)) - for i=1 to length(s) do - t[i] = colours[s[i]] - end for - printf(1,"%s: %s\n",{msg,join(t)}) - end procedure +procedure show(string msg, sequence s) + sequence t = repeat(0,length(s)) + for i=1 to length(s) do + t[i] = colours[s[i]] + end for + printf(1,"%s: %s\n",{msg,join(t)}) +end procedure - sequence unsorted, sorted - while 1 do - unsorted = sq_rand(repeat(maxc,12)) - -- sorted = sort(deep_copy(unsorted)) -- (works just as well) - sorted = three_way_partition(deep_copy(unsorted), white) - if unsorted!=sorted then exit end if - ?"oops" - end while - show("Unsorted",unsorted) - show("Sorted",sorted) - n ) + [ 2 ] is white ( --> n ) + [ 3 ] is blue ( --> n ) + + randomise + + [] ' [ red white blue ] + witheach + [ nested swap + 5 random times [ over join ] + swap join ] + + dup [ shuffle 2dup != until ] nip + + say "Before sorting: " dup echo cr + say " After sorting: " sortwith [ dip do do > ] echo cr diff --git a/Task/Dutch-national-flag-problem/QuickBASIC/dutch-national-flag-problem.basic b/Task/Dutch-national-flag-problem/QuickBASIC/dutch-national-flag-problem.basic new file mode 100644 index 0000000000..cca5c51dbe --- /dev/null +++ b/Task/Dutch-national-flag-problem/QuickBASIC/dutch-national-flag-problem.basic @@ -0,0 +1,57 @@ +' Dutch national flag problem +DECLARE SUB PrintColorSeq (T() AS INTEGER) +DECLARE SUB SortByColor (T() AS INTEGER) + +CONST CBLUE% = 0, CWHITE% = 1, CRED% = 2 +CONST N% = 20 +DIM T(0 TO N% - 1) AS INTEGER +DIM I AS INTEGER + +' Set colors +RANDOMIZE TIMER +FOR I = 0 TO N% - 1 + T(I) = INT(RND * 3) +NEXT I + +PRINT "Unsorted:" +CALL PrintColorSeq(T()) +CALL SortByColor(T()) +PRINT +PRINT "Sorted:" +CALL PrintColorSeq(T()) +END + +SUB PrintColorSeq (T() AS INTEGER) + DIM I AS INTEGER + FOR I = 0 TO UBOUND(T) + SELECT CASE T(I) + CASE CBLUE% + PRINT "B"; + CASE CWHITE% + PRINT "W"; + CASE CRED% + PRINT "R"; + END SELECT + NEXT I + PRINT +END SUB + +SUB SortByColor (T() AS INTEGER) + DIM B AS INTEGER, W AS INTEGER, R AS INTEGER + B = 0 + W = 0 + R = UBOUND(T) + DO WHILE W <= R + SELECT CASE T(W) + CASE CWHITE% + W = W + 1 + CASE CBLUE% + SWAP T(B), T(W) + B = B + 1 + W = W + 1 + CASE CRED% + SWAP T(W), T(R) + R = R - 1 + END SELECT + LOOP +END SUB diff --git a/Task/Dutch-national-flag-problem/R/dutch-national-flag-problem.r b/Task/Dutch-national-flag-problem/R/dutch-national-flag-problem.r new file mode 100644 index 0000000000..bf63f230ae --- /dev/null +++ b/Task/Dutch-national-flag-problem/R/dutch-national-flag-problem.r @@ -0,0 +1,26 @@ +colours <- c("Red", "White", "Blue") + +rand_balls <- function(v, f){ + repeat{ + balls <- sample(v, sample(10:20, 1), replace=TRUE) + balls_sorted <- f(balls) + if(!identical(balls, balls_sorted)){ + print(list("Unsorted"=balls, "Sorted"=balls_sorted), quote=FALSE) + break + } + } +} + +#Method 1: converting the vector of colours to a factor and using the built-in sort() function + +colours_ordered <- factor(1:3, labels=colours) +rand_balls(colours_ordered, sort) + +#Method 2: simple counting sort (showcasing the conciseness of R's rep() function) + +counting_sort <- function(v){ + counts <- sapply(1:3, function(n) sum(v==colours[n])) + rep(colours, times=counts) +} + +rand_balls(colours, counting_sort) diff --git a/Task/Dutch-national-flag-problem/Rust/dutch-national-flag-problem.rs b/Task/Dutch-national-flag-problem/Rust/dutch-national-flag-problem.rs new file mode 100644 index 0000000000..325af2792e --- /dev/null +++ b/Task/Dutch-national-flag-problem/Rust/dutch-national-flag-problem.rs @@ -0,0 +1,43 @@ +extern crate rand; // 0.10.0 used + +use rand::prelude::*; + +// Color enums will be sorted by their top-to-bottom declaration order +#[derive(Eq,Ord,PartialOrd,PartialEq,Debug)] +enum Color { + Red, + White, + Blue +} + +fn is_sorted(list: &Vec) -> bool { + let mut state = &Color::Red; + for current in list.iter() { + if current < state { return false; } + if current > state { state = current; } + } + true +} + +fn main() { + let mut rng = rand::rng(); + let mut colors: Vec = Vec::new(); + + for _ in 1..10 { + let r = rng.random_range(0..3); + if r == 0 { colors.push(Color::Red); } + else if r == 1 { colors.push(Color::White); } + else if r == 2 { colors.push(Color::Blue); } + } + + while is_sorted(&colors) { + colors.shuffle(&mut rng); + } + + println!("Before: {:?}", colors); + colors.sort(); + println!("After: {:?}", colors); + if !is_sorted(&colors) { + println!("Oops, did not sort colors correctly!"); + } +} diff --git a/Task/Dutch-national-flag-problem/Rust/dutch-national-flag-problem.rust b/Task/Dutch-national-flag-problem/Rust/dutch-national-flag-problem.rust deleted file mode 100644 index 0a6e2a4972..0000000000 --- a/Task/Dutch-national-flag-problem/Rust/dutch-national-flag-problem.rust +++ /dev/null @@ -1,44 +0,0 @@ -extern crate rand; - -use rand::Rng; - -// Color enums will be sorted by their top-to-bottom declaration order -#[derive(Eq,Ord,PartialOrd,PartialEq,Debug)] -enum Color { - Red, - White, - Blue -} - -fn is_sorted(list: &Vec) -> bool { - let mut state = &Color::Red; - for current in list.iter() { - if current < state { return false; } - if current > state { state = current; } - } - true -} - - -fn main() { - let mut rng = rand::thread_rng(); - let mut colors: Vec = Vec::new(); - - for _ in 1..10 { - let r = rng.gen_range(0, 3); - if r == 0 { colors.push(Color::Red); } - else if r == 1 { colors.push(Color::White); } - else if r == 2 { colors.push(Color::Blue); } - } - - while is_sorted(&colors) { - rng.shuffle(&mut colors); - } - - println!("Before: {:?}", colors); - colors.sort(); - println!("After: {:?}", colors); - if !is_sorted(&colors) { - println!("Oops, did not sort colors correctly!"); - } -} diff --git a/Task/Dutch-national-flag-problem/Uiua/dutch-national-flag-problem.uiua b/Task/Dutch-national-flag-problem/Uiua/dutch-national-flag-problem.uiua new file mode 100644 index 0000000000..354f52209c --- /dev/null +++ b/Task/Dutch-national-flag-problem/Uiua/dutch-national-flag-problem.uiua @@ -0,0 +1,3 @@ +&p.[⍥(⊡⌊×3⚂"RWB")30] # Build it. +&p.⊏▽⊸>2⍏⊛.⊂"RWB" # Sort it, providing model for sort order. +&p⨬("oops"|"good")≍⊏⊸⍏.⊛ # Confirm it's sorted. diff --git a/Task/Dutch-national-flag-problem/V-(Vlang)/dutch-national-flag-problem.v b/Task/Dutch-national-flag-problem/V-(Vlang)/dutch-national-flag-problem.v new file mode 100644 index 0000000000..7f5ba932b3 --- /dev/null +++ b/Task/Dutch-national-flag-problem/V-(Vlang)/dutch-national-flag-problem.v @@ -0,0 +1,25 @@ +import rand + +fn main() { + flag := ["Red","White","Blue"] + mut balls := [10]string{} + mut color :="" + mut number := 0 + + print("Random: |") + for idx in 0..10 { + number = rand.int_in_range(0, 3) or {println("Error: invalid number") exit(1)} + balls[idx] = flag[number] + print("${balls[idx]}" + " |") + } + println("") + + print("Sorted: |") + for idx in 0..3 { + color = flag[idx] + for jdx in 0..10 { + if balls[jdx] == color {print("${balls[jdx]}" + " |")} + } + } + println("") +} diff --git a/Task/Dutch-national-flag-problem/VBScript/dutch-national-flag-problem.vb b/Task/Dutch-national-flag-problem/VBScript/dutch-national-flag-problem.vbs similarity index 100% rename from Task/Dutch-national-flag-problem/VBScript/dutch-national-flag-problem.vb rename to Task/Dutch-national-flag-problem/VBScript/dutch-national-flag-problem.vbs diff --git a/Task/Dutch-national-flag-problem/Wren/dutch-national-flag-problem.wren b/Task/Dutch-national-flag-problem/Wren/dutch-national-flag-problem.wren index 71c5a9ee23..6eef39ff82 100644 --- a/Task/Dutch-national-flag-problem/Wren/dutch-national-flag-problem.wren +++ b/Task/Dutch-national-flag-problem/Wren/dutch-national-flag-problem.wren @@ -1,5 +1,5 @@ import "random" for Random -import "/sort" for Sort +import "./sort" for Sort var colors = ["Red", "White", "Blue"] var colorMap = { "Red": 0, "White": 1, "Blue": 2 } diff --git a/Task/Dynamic-variable-names/ALGOL-68/dynamic-variable-names.alg b/Task/Dynamic-variable-names/ALGOL-68/dynamic-variable-names.alg new file mode 100644 index 0000000000..7a8a5853f6 --- /dev/null +++ b/Task/Dynamic-variable-names/ALGOL-68/dynamic-variable-names.alg @@ -0,0 +1,77 @@ +BEGIN # Simulate dynamic variables using an array, translation of the FreeBASIC sample # + + MODE DYNAMICVARIABLE = STRUCT( STRING name, value ); + + OP LCASE = ( CHAR c )CHAR: + IF c >= "A" AND c <= "Z" THEN REPR( ( ABS c - ABS "A" ) + ABS "a" ) ELSE c FI; + OP LCASE = ( STRING s )STRING: + BEGIN + STRING lc := s; + FOR i FROM LWB lc TO UPB lc DO lc[ i ] := LCASE lc[ i ] OD; + lc + END # LCASE # ; + OP TRIM = ( STRING s )STRING: + BEGIN + INT left := LWB s, right := UPB s; + WHILE IF left > right THEN FALSE ELSE s[ left ] = " " FI DO left +:= 1 OD; + WHILE IF right < left THEN FALSE ELSE s[ right ] = " " FI DO right -:= 1 OD; + s[ left : right ] + END # TRIM # ; + + PROC find variable index = ( []DYNAMICVARIABLE dyvar, STRING v, INT n elements )INT: + BEGIN + STRING name = LCASE TRIM v; + INT index := LWB dyvar - 1; + INT max index = index + n elements; + FOR i FROM LWB dyvar TO max index WHILE index < LWB dyvar DO + IF name OF dyvar[ i ] = name THEN index := i FI + OD; + index + END # find variable index # ; + + INT n; + WHILE + print( ( "How many variables do you want to create (max 5) " ) ); + read( ( n, newline ) ); + n < 0 OR n > 5 + DO SKIP OD; + + [ 1 : n ]DYNAMICVARIABLE a; + + print( ( newline, "OK, enter the variable names and their values, below", newline ) ); + + FOR i TO n DO + WHILE + print( ( " Variable ", whole( i, 0 ), newline ) ); + print( ( " Name : " ) ); + read( ( name OF a[ i ], newline ) ); + name OF a[ i ] := LCASE TRIM name OF a[ i ]; + # identifiers should not be case-sensitive in Algol 68 though # + # in upper stropped sources (such as this one) they have to # + # be in lower case # + find variable index( a, name OF a[ i ], i - 1 ) > 0 + DO + print( ( " Sorry, you've already created a variable of that name, try again", newline ) ) + OD; + print( ( " Value : " ) ); + read( ( value OF a[ i ], newline ) ); + value OF a[ i ] := TRIM value OF a[ i ] + OD; + + print( ( newline, "Press q to quit" ) ); + WHILE + STRING v; + print( ( newline, "Which variable do you want to inspect ? " ) ); + read( ( v, newline ) ); + v /= "q" AND v /= "Q" + DO + IF INT index = find variable index( a, v, n ); + index = 0 + THEN + print( ( "Sorry there's no variable of that name, try again", newline ) ) + ELSE + print( ( "It's value is ", value OF a[ index ], newline ) ) + FI + OD + +END diff --git a/Task/Dynamic-variable-names/Ballerina/dynamic-variable-names.ballerina b/Task/Dynamic-variable-names/Ballerina/dynamic-variable-names.ballerina new file mode 100644 index 0000000000..6019bb031b --- /dev/null +++ b/Task/Dynamic-variable-names/Ballerina/dynamic-variable-names.ballerina @@ -0,0 +1,16 @@ +import ballerina/io; + +public function main() returns error? { + map nvs = {}; + io:println("Enter three variables:"); + foreach var _ in 0...2 { + string name = io:readln("\n name : "); + string value = io:readln(" value : "); + nvs[name] = check int:fromString(value); + } + + io:println("\nYour variables are:\n"); + foreach string name in nvs.keys() { + io:println(` ${name} = ${nvs[name]}`); + } +} diff --git a/Task/Dynamic-variable-names/C++/dynamic-variable-names.cpp b/Task/Dynamic-variable-names/C++/dynamic-variable-names.cpp new file mode 100644 index 0000000000..264b0269b7 --- /dev/null +++ b/Task/Dynamic-variable-names/C++/dynamic-variable-names.cpp @@ -0,0 +1,27 @@ +#include +#include +#include +#include +#include + +int main() { + std::unordered_map variables; + + std::string name; + std::cout << "Enter your variable name: " << std::endl; + std::cin >> name; + + int32_t value; + std::cout << "Enter your variable value: " << std::endl; + std::cin >> value; + + variables[name] = value; + + std::cout << "You have created a variable '" << name << "' with a value of " << value << ":" << std::endl; + + std::for_each(variables.begin(), variables.end(), + [](std::pair pair) { + std::cout << pair.first << " = " << pair.second << std::endl; + } + ); +} diff --git a/Task/Dynamic-variable-names/C/dynamic-variable-names.c b/Task/Dynamic-variable-names/C/dynamic-variable-names.c new file mode 100644 index 0000000000..d48225edc0 --- /dev/null +++ b/Task/Dynamic-variable-names/C/dynamic-variable-names.c @@ -0,0 +1,135 @@ +#include +#include +#include +#include +#include +#include +#include + +static inline uint64_t hash(void const *cp, size_t n) { + uint64_t h = 0; + uint64_t const e = UINT64_C(2718281828459045235); // e * 10**18 + for(uint8_t const *cb = cp; n > 0; n--) { + h = ((h + n) * e) ^ ((*cb++ & 0xFF) * e); + } + return h; +} + +static void *dup(void const *cp, size_t n) { + void *p = malloc(n); + return memcpy(p, cp, n); +} + +static void *nodup(void const *cp, size_t n) { + return (void*)cp; +} + +#define MAPPED struct mapped_s +MAPPED { + size_t n; + char const *s; +}; +#define MAP struct map_s +MAP { + size_t u; + size_t w; + size_t m; + char a[]; +}; + +static MAP *map_alloc(size_t m, size_t z) { + const size_t N = (((m * z) + (sizeof(MAP)-1)) / sizeof(MAP)) + 1; + MAP *t = calloc(N, sizeof(MAP)); + t->m = m; + t->w = 3 * m / 4; + return t; +} + +static void *map(MAP **t, size_t z, char const *s, size_t n, void *(*dup)(void const *, size_t)) { + if(!*t) { + *t = map_alloc(sizeof(size_t) * CHAR_BIT, z); + } + MAP *f = *t; + uint64_t const h = hash(s, n); + size_t x = (h / f->m) % f->m; + size_t const k = x + !x; + size_t const l = f->m - k; + size_t const y = h % f->m; + x = y; + do { + MAPPED *p = (MAPPED *)&f->a[x*z]; + if((p->n == n) && (memcmp(p->s, s, n) == 0)) { + return p; + } + if((p->n == 0) && dup) { + if(f->u == f->w) { + *t = map_alloc(2 * f->m, z); + for(size_t i = 0; f->u < f->w; i++) { + MAPPED *q = (MAPPED *)&f->a[i*z]; + if(q->n > 0) { + (void)map(t, z, q->s, q->n, nodup); + } + } + free(f); + return map(t, z, s, n, dup); + } + f->u++; + p->n = n; + p->s = dup(s, n); + return p; + } + x = (x >= l) ? ((x + 1) % k) : (x + k); + } while(x != y) + ; + return NULL; +} + +static double mapf(char const *s, double v, void *(*dup)(void const *, size_t)) { + static MAP *t = NULL; + struct { + MAPPED; + double v; + } *p = map(&t, sizeof(*p), s, strlen(s), dup); + if(p) { + if(dup) p->v = v; + return p->v; + } + return NAN; +} + +static inline double assignf(char const *s, double v) { + return mapf(s, v, dup); +} + +static inline double valuef(char const *s) { + return mapf(s, 0, 0); +} + +static char *enter(char const *prompt) { + static char buf[256]; + fputs(prompt, stdout); fflush(stdout); + fgets(buf, sizeof(buf), stdin); + char *s = buf; + for(; *s && !isgraph(*s); s++) + ; + char *t = s + strlen(s); + for(; (t > s) && !isgraph(*(t-1)); t--) + ; + *t = '\0'; + return s; +} + +int main(int argc, char **argv) { + for(;;) { + char const *name = enter("Enter: "); + if(!*name) break; + char *val = strchr(name, '='); + if(val) { + *val++ = '\0'; + assignf(name, strtod(val, NULL)); + } else { + printf("%s = %F\n", name, valuef(name)); + } + } + return 0; +} diff --git a/Task/Dynamic-variable-names/DuckDB/dynamic-variable-names.duckdb b/Task/Dynamic-variable-names/DuckDB/dynamic-variable-names.duckdb new file mode 100644 index 0000000000..e5e9804bf2 --- /dev/null +++ b/Task/Dynamic-variable-names/DuckDB/dynamic-variable-names.duckdb @@ -0,0 +1 @@ +select COLUMNS(x -> x = getenv('variablename')) from t; diff --git a/Task/Dynamic-variable-names/EMal/dynamic-variable-names.emal b/Task/Dynamic-variable-names/EMal/dynamic-variable-names.emal new file mode 100644 index 0000000000..f55c9b8919 --- /dev/null +++ b/Task/Dynamic-variable-names/EMal/dynamic-variable-names.emal @@ -0,0 +1,37 @@ +^|EMal doesn't support the creation of user-defined variable names. + |It can manage symbolic references to existing variables. + |It can use Records to dynamically create fields. + |^ +Record data ← [] +fun fillData ← void by block + for ever + ^|we ask for key/value pairs|^ + text key ← ask(text, "Enter the key or press Enter to quit: ") + if key æ Text.EMPTY do break end + text value ← ask(text, "Enter the value: ") + data[key] ← value ^|here we set the user-defined key field + |on the record data, with the provided value + |^ + end + writeLine() +end +^|here we show how symbolic reference works by using var("variableName")|^ +fun dumpData ← void by text recordName + writeLine("dumping the fields for the record named '", recordName, "'") + Record.keys(var(recordName)).list( 5 { + n = strconv.atoi(os.input("Integer variables (max 5): ")) or { + println("Invalid input!") + continue + } + } + for i <= n { + println("OK, enter the variable names and their values, below:") + println("Variable ${i}") + name = os.input_opt(" Name: ") or { panic("Invalid input!") } + for { + value = strconv.atoi(os.input(" Value: ")) or { + println("Must be a valid number!") + continue + } + break + } + vars[name] += value + i++ + } + println("\n" + "Enter q to quit") + for { + name = os.input_opt("Which variable do you want to inspect: ") or { panic("Invalid input!") } + if name.to_lower() == "q" { break } + if name !in vars { println("Sorry there's no variable of that name, try again!") } + else { println("Its value is ${vars[name]}") } + } +} diff --git a/Task/EKG-sequence-convergence/Ada/ekg-sequence-convergence.ada b/Task/EKG-sequence-convergence/Ada/ekg-sequence-convergence.adb similarity index 100% rename from Task/EKG-sequence-convergence/Ada/ekg-sequence-convergence.ada rename to Task/EKG-sequence-convergence/Ada/ekg-sequence-convergence.adb diff --git a/Task/EKG-sequence-convergence/Arturo/ekg-sequence-convergence.arturo b/Task/EKG-sequence-convergence/Arturo/ekg-sequence-convergence.arturo new file mode 100644 index 0000000000..6f6c56d98c --- /dev/null +++ b/Task/EKG-sequence-convergence/Arturo/ekg-sequence-convergence.arturo @@ -0,0 +1,37 @@ +ekg: function [start, limit][ + result: @[1 start] + + while [limit > size result][ + candidate: 2 + while ø [ + if and? [not? contains? result candidate] + [1 < gcd @[last result candidate]][ + 'result ++ candidate + break + ] + inc 'candidate + ] + ] + + return result +] + +loop [2 5 7 9 10] 'n -> + print ["EKG(" ++ (to :string n) ++ "):" join.with:", " ekg n 10] + +print "" +ekg5: ekg 5 100 +ekg7: ekg 7 100 + +converged?: false +loop 2..99 'i [ + if and? -> ekg5\[i] = ekg7\[i] + -> equal? sort slice ekg5 0 i sort slice ekg7 0 i [ + print ["EKG(5) and EKG(7) converge at term" i+1] + converged?: true + break + ] +] + +unless converged? -> + print "EKG(5) and EKG(7) do not converge within 100 terms" diff --git a/Task/EKG-sequence-convergence/EasyLang/ekg-sequence-convergence.easy b/Task/EKG-sequence-convergence/EasyLang/ekg-sequence-convergence.easy new file mode 100644 index 0000000000..3c42057e99 --- /dev/null +++ b/Task/EKG-sequence-convergence/EasyLang/ekg-sequence-convergence.easy @@ -0,0 +1,22 @@ +func contains a[] b . + for a in a[] : if a = b : return 1 + return 0 +. +func gcd a b . + if b = 0 : return a + return gcd b (a mod b) +. +starts[] = [ 2 5 7 9 10 ] +len ekg[][] 5 +for s to 5 + ekg[s][] = [ 1 starts[s] ] + for n = 2 to 10 + for i = 2 to 1 / 0 + if contains ekg[s][] i = 0 and gcd ekg[s][n], i > 1 + ekg[s][] &= i + break 1 + . + . + . + print ekg[s][] +. diff --git a/Task/EKG-sequence-convergence/Fortran/ekg-sequence-convergence.f b/Task/EKG-sequence-convergence/Fortran/ekg-sequence-convergence.f new file mode 100644 index 0000000000..fddf573531 --- /dev/null +++ b/Task/EKG-sequence-convergence/Fortran/ekg-sequence-convergence.f @@ -0,0 +1,168 @@ + ! EKG sequence convergence + ! tested with Intel ifx (IFX) 2025.2.0 20250605 on Kubuntu 25.04 + ! GNU Fortran (Ubuntu 14.2.0-19ubuntu2) 14.2.0 on Kubuntu 25.04 + ! VSI Fortran x86-64 V8.6-001 on OpenVMS x86_64 V9.2-3 + ! Note that VMS requires switch $Fortran/ccdefault=LIST + ! otherwise 1st character of each output line is interpreted as + ! Carriage Control character. + ! +module EKG +implicit none + +integer, parameter :: nElementsToPrint=10 + + +contains + +subroutine ekgSequence (secondElm, nElm, isq) + ! + ! Construct first 'nElm' elements of the EKG Sequence that has 'secondElm' + ! as second element, knowing first element ios always 1. + ! + + integer, intent(in) :: secondElm + integer, intent(in) :: nElm + + integer, intent(out) :: isq (*) + + integer :: candidate=2 + integer :: ncurrent + + isq(1) = 1 ! 1st element always 1 + isq(2) = secondElm ! 2nd element from argument + ncurrent = 2 ! index to highest known element of sequence isq + + do while (ncurrent .le. nElm) + ! 'candidate' is next element of isq if it is not already in this sequence AND + ! if it shares at least 1 prime factor with highest known element if isq + ! which means GCD(candidate, highest element of isq) is >1 + if ( (.not. containsElement (isq, ncurrent, candidate)) & + .and. gcd(isq(ncurrent), candidate) > 1 ) then + ! found next element of isq + ncurrent = ncurrent + 1 + isq(ncurrent) = candidate + candidate = 2; ! start over again + else + ! Not a candidate: try next one. + candidate= candidate + 1 + end if + end do +end subroutine ekgSequence + +function containsElement (isq, nElm, elm) result (yes) + ! + ! return .true. if number 'elm' can be found within + ! first 'nElm' elements of sequence 'isq' . + ! + integer, intent(in) :: nElm + integer, intent(in) :: isq (nElm) + integer, intent(in) :: elm + logical :: yes + integer :: ii + + ! Straightforward: Loop until elm found or + ! last element reached + do ii = 1, nElm + if (isq(ii) == elm) then + yes=.true. + return + end if + end do + yes=.false. + return +end function containsElement + + +function gcd (n,m) result (rgcd) + ! + ! euclid's algorithm + ! to find greatest common divisor + ! + integer, intent(in) :: n,m + integer :: rgcd + integer :: a + integer :: b + + a=n + b=m + + if (a .eq. 0) then + rgcd = 0 + else + do while (b .ne. 0) + if ( a .gt. b ) then + a = a - b + else + b = b - a; + end if + end do + rgcd =a + end if +end function gcd + + +subroutine printThem (isq) +! +! Print the pedefined number of elements of sequence isq +! +integer, intent(in) :: isq(nElementsToPrint) +integer :: ii + +! print the Introduction like EKG(2) and first elemment +write (6, '("EKG(", I2,") = [", i1,x)', advance='no') isq(2), isq(1) + +! print remaining elements except the last +do ii = 2, nElementsToPrint-1 + write (6,'(i2, x)', advance = 'no' ) isq(ii) +end do + +! Terminate output line: last element and close "]" +write (6,'(I2, "]")') isq(nElementsToPrint) + +end subroutine printThem + +end module EKG + + +program EKGMain + + use EKG + + implicit none + + integer :: myekg(100) + integer :: ekg5 (100) + integer :: ekg7 (100) + integer :: nx(5) = [2,5,7,9,10] + integer :: match + integer:: ii, jj + ! + ! Produce and print first 10 elements of first 5 sequences + ! + do ii=1,5 + call ekgSequence (nx(ii), nElementsToPrint, myekg) + call printThem (myekg) + end do + ! + ! Produce 100 elements of EKG(5) and EKG(7) + ! + call ekgSequence (5, 100, ekg5) + call ekgSequence (7, 100, ekg7) + ! + ! see where they converge + ! + match = -1 + do ii=2, 100 + if (ekg5(ii) .eq. ekg7(ii)) then + ! Memoize first identical elements and + ! see if all following elements are identical as well. + if (match .lt. 0) match = ii + do jj=ii+1,100 + if (ekg5(jj) .ne. ekg7(jj)) then + match = -1 ! Not same + endif + end do + end if + end do + write (6, "( /'EKG(5) and EKG(7) converge at index ', i0, '.')") match +end program EKGMain diff --git a/Task/EKG-sequence-convergence/FreeBASIC/ekg-sequence-convergence.basic b/Task/EKG-sequence-convergence/FreeBASIC/ekg-sequence-convergence.basic new file mode 100644 index 0000000000..2f4f0eb704 --- /dev/null +++ b/Task/EKG-sequence-convergence/FreeBASIC/ekg-sequence-convergence.basic @@ -0,0 +1,52 @@ +Const limite = 30 +Dim Shared As Integer n, A(limite + 1) + +Function Used(m As Integer) As Boolean 'Return 'True' if m is in array A + For i As Integer = 1 To n - 1 + If m = A(i) Then Return True + Next i + Return False +End Function + +Function MinFactor(num As Integer) As Integer 'Return minimum unused factor + Dim As Integer factor, valor, min + + factor = 2 + min = &H7FFFFFFF + Do + If num Mod factor = 0 Then 'found a factor + valor = factor + Do + If Used(valor) Then + valor+ = factor + Else + If valor < min Then min = valor + Exit Do + End If + Loop + num \= factor + Else + factor += 1 + End If + Loop Until factor > num + Return min +End Function + +Sub EKG(m As Integer) 'Calculate and show EKG sequence + A(1) = 1: A(2) = m + For n = 3 To limite + A(n) = MinFactor(A(n - 1)) + Next n + Print Using "EKG(##):"; m; + For i As Integer = 1 To limite + Print Using "###"; A(i); + Next i + Print +End Sub + +Dim starts(4) As Integer = {2, 5, 7, 9, 10} +For i As Integer = 0 To 4 + EKG(starts(i)) +Next i + +Sleep diff --git a/Task/EKG-sequence-convergence/JavaScript/ekg-sequence-convergence.js b/Task/EKG-sequence-convergence/JavaScript/ekg-sequence-convergence.js new file mode 100644 index 0000000000..8ffa394a5c --- /dev/null +++ b/Task/EKG-sequence-convergence/JavaScript/ekg-sequence-convergence.js @@ -0,0 +1,71 @@ +// Calculate and show here the first 10 members of EKG[2], EKG[5], EKG[7], EKG[9] and EKG[10] +for (const i of [2, 5, 7, 9, 10]) { + console.log(`EKG[${i}] = [${ekg(i, 10).join(', ')}]`); +} + +console.log("Calculate and show here at which term EKG[5] and EKG[7] converge."); +const ekg5 = ekg(5, 100); +const ekg7 = ekg(7, 100); + +for (let i = 1; i < ekg5.length; i++) { + if (ekg5[i] === ekg7[i] && sameSeq(ekg5, ekg7, i)) { + console.log(`EKG[5](${i + 1}) = EKG[7](${i + 1}) = ${ekg5[i]}, and are identical from this term on`); + break; + } +} + +// Same last element, and all elements in sequence are identical +function sameSeq(seq1, seq2, n) { + const list1 = seq1.slice(0, n).sort((a, b) => a - b); + const list2 = seq2.slice(0, n).sort((a, b) => a - b); + + for (let i = 0; i < n; i++) { + if (list1[i] !== list2[i]) { + return false; + } + } + return true; +} + +// Without Map to identify seen terms, need to examine list. +// Calculating 3000 terms in this manner takes 10 seconds +// With Map to identify the seen terms, calculating 3000 terms takes .1 sec. +function ekg(two, maxN) { + const result = []; + result.push(1); + result.push(two); + + const seen = new Map(); + seen.set(1, 1); + seen.set(two, 1); + + let minUnseen = two === 2 ? 3 : 2; + let prev = two; + + for (let n = 3; n <= maxN; n++) { + let test = minUnseen - 1; + while (true) { + test++; + if (!seen.has(test) && gcd(test, prev) > 1) { + result.push(test); + seen.set(test, n); + prev = test; + + if (minUnseen === test) { + do { + minUnseen++; + } while (seen.has(minUnseen)); + } + break; + } + } + } + return result; +} + +function gcd(a, b) { + if (b === 0) { + return a; + } + return gcd(b, a % b); +} diff --git a/Task/EKG-sequence-convergence/Julia/ekg-sequence-convergence.julia b/Task/EKG-sequence-convergence/Julia/ekg-sequence-convergence.jl similarity index 100% rename from Task/EKG-sequence-convergence/Julia/ekg-sequence-convergence.julia rename to Task/EKG-sequence-convergence/Julia/ekg-sequence-convergence.jl diff --git a/Task/EKG-sequence-convergence/Kotlin/ekg-sequence-convergence.kotlin b/Task/EKG-sequence-convergence/Kotlin/ekg-sequence-convergence.kts similarity index 100% rename from Task/EKG-sequence-convergence/Kotlin/ekg-sequence-convergence.kotlin rename to Task/EKG-sequence-convergence/Kotlin/ekg-sequence-convergence.kts diff --git a/Task/EKG-sequence-convergence/MATLAB/ekg-sequence-convergence.m b/Task/EKG-sequence-convergence/MATLAB/ekg-sequence-convergence.m new file mode 100644 index 0000000000..2363b9b1e0 --- /dev/null +++ b/Task/EKG-sequence-convergence/MATLAB/ekg-sequence-convergence.m @@ -0,0 +1,43 @@ +% Displaying EKG sequences and the convergence point +for i = [2, 5, 7, 9, 10] + ekg = ekgsequence(i, 30); + fprintf('EKG(%d): %s\n', i, num2str(ekg)); +end + +convergencePoint = convergeat(5, 7); +fprintf('EKGs of 5 & 7 converge at term %d\n', convergencePoint); + + + +function ekg = ekgsequence(n, limit) + ekg = [1, n]; + while length(ekg) < limit + for i = 2:2^18 + if all(ekg ~= i) && gcd(ekg(end), i) > 1 + ekg = [ekg, i]; + break; + end + end + end +end + +function point = convergeat(n, m, max) + if nargin < 3 + max = 100; + end + + ekgn = ekgsequence(n, max); + ekgm = ekgsequence(m, max); + + point = 0; + for i = 3:max + if ekgn(i) == ekgm(i) && sum(ekgn(1:i+1)) == sum(ekgm(1:i+1)) + point = i; + return; + end + end + + if point == 0 + warning('No convergence in %d terms', max); + end +end diff --git a/Task/EKG-sequence-convergence/Pluto/ekg-sequence-convergence.pluto b/Task/EKG-sequence-convergence/Pluto/ekg-sequence-convergence.pluto new file mode 100644 index 0000000000..e2e276d6ff --- /dev/null +++ b/Task/EKG-sequence-convergence/Pluto/ekg-sequence-convergence.pluto @@ -0,0 +1,38 @@ +require "table2" +local int = require "int" +local fmt = require "fmt" + +local limit = 100 +local starts = {2, 5, 7, 9, 10} +local ekg = {} +for i = 1, 5 do ekg[i] = table.rep(limit, 0) end +local s = 1 +for starts as start do + ekg[s][1] = 1 + ekg[s][2] = start + for n = 3, limit do + local i = 2 + while true do + -- A potential sequence member cannot already have been used + -- and must have a factor in common with previous member. + if !ekg[s]:slice(1, n):contains(i) and int.gcd(ekg[s][n - 1], i) > 1 then + ekg[s][n] = i + break + end + i += 1 + end + end + fmt.write("EKG(%2d): ", start) + fmt.tprint("%2d", ekg[s]:slice(1, 30), 30) + s += 1 +end + +-- Now compare EKG5 and EKG7 for convergence. +for i = 3, limit do + if ekg[2][i] == ekg[3][i] and + table.same(ekg[2]:slice(1, i - 1):sort(), ekg[3]:slice(1, i - 1):sort()) then + print($"\nEKG(5) and EKG(7) converge at term {i}.") + os.exit() + end +end +print($"\nEKG5(5) and EKG(7) do not converge within {limit} terms.") diff --git a/Task/EKG-sequence-convergence/Rust/ekg-sequence-convergence.rust b/Task/EKG-sequence-convergence/Rust/ekg-sequence-convergence.rs similarity index 100% rename from Task/EKG-sequence-convergence/Rust/ekg-sequence-convergence.rust rename to Task/EKG-sequence-convergence/Rust/ekg-sequence-convergence.rs diff --git a/Task/EKG-sequence-convergence/Wren/ekg-sequence-convergence.wren b/Task/EKG-sequence-convergence/Wren/ekg-sequence-convergence.wren index 959502e010..cea8792b48 100644 --- a/Task/EKG-sequence-convergence/Wren/ekg-sequence-convergence.wren +++ b/Task/EKG-sequence-convergence/Wren/ekg-sequence-convergence.wren @@ -1,6 +1,6 @@ -import "/sort" for Sort -import "/math" for Int -import "/fmt" for Fmt +import "./sort" for Sort +import "./math" for Int +import "./fmt" for Fmt var areSame = Fn.new { |s, t| var le = s.count diff --git a/Task/Earliest-difference-between-prime-gaps/EasyLang/earliest-difference-between-prime-gaps.easy b/Task/Earliest-difference-between-prime-gaps/EasyLang/earliest-difference-between-prime-gaps.easy new file mode 100644 index 0000000000..c91415599e --- /dev/null +++ b/Task/Earliest-difference-between-prime-gaps/EasyLang/earliest-difference-between-prime-gaps.easy @@ -0,0 +1,41 @@ +fastfunc nextPrimeOdd n . + i = n + 2 + repeat + j = 3 + while j <= sqrt i and i mod j <> 0 + j += 2 + . + until j > sqrt i + i += 2 + . + return i +. +lastPrime = 3 +len gapStarts[] 1e7 +# +func findGapStart gap . + if gapStarts[gap] <> 0 : return gapStarts[gap] + repeat + prev = lastPrime + lastPrime = nextPrimeOdd lastPrime + diff = lastPrime - prev + if gapStarts[diff] = 0 : gapStarts[diff] = prev + until gap = diff + . + return prev +. +# +gap = 2 +pm = 10 +repeat + start1 = findGapStart gap + start2 = findGapStart (gap + 2) + diff = abs (start2 - start1) + if diff > pm + print "> " & pm & ": gaps " & gap & "/" & gap + 2 & " range " & start1 & "-" & start2 & " (" & diff & ")" + pm *= 10 + else + gap += 2 + . + until pm = 1e7 +. diff --git a/Task/Earliest-difference-between-prime-gaps/FreeBASIC/earliest-difference-between-prime-gaps.basic b/Task/Earliest-difference-between-prime-gaps/FreeBASIC/earliest-difference-between-prime-gaps.basic new file mode 100644 index 0000000000..a20865e78c --- /dev/null +++ b/Task/Earliest-difference-between-prime-gaps/FreeBASIC/earliest-difference-between-prime-gaps.basic @@ -0,0 +1,49 @@ +Type PrimeGaps + As Ulong lastPrime + As Ulongint gapStarts(1 To 1e7) +End Type + +Function NextPrime(n As Ulong) As Ulong + Dim As Ulong j, i = n + 1 + Do + For j = 2 To Sqr(i) + If i Mod j = 0 Then Exit For + Next j + If j > Sqr(i) Then Return i + i += 1 + Loop +End Function + +Function findGapStart(Byref pg As PrimeGaps, gap As Ulongint) As Ulongint + Dim As Ulongint prev, diff + If pg.gapStarts(gap) <> 0 Then Return pg.gapStarts(gap) + Do + prev = pg.lastPrime + pg.lastPrime = NextPrime(pg.lastPrime) + diff = pg.lastPrime - prev + If pg.gapStarts(diff) = 0 Then pg.gapStarts(diff) = prev + If gap = diff Then Return prev + Loop +End Function + +Dim Shared As PrimeGaps pg +pg.lastPrime = NextPrime(2) +Dim As Ulongint limit = 1e7 +Dim As Integer pm = 10 +Dim As Ulongint start1, start2, gap1 = 2, gap2, diff +Do + start1 = findGapStart(pg, gap1) + gap2 = gap1 + 2 + start2 = findGapStart(pg, gap2) + diff = Abs(start2 - start1) + If diff > pm Then + Print "Earliest difference >"; pm; " between adjacent prime gap starting primes:" + Print "Gap "; gap1; " starts at "; start1; ", gap "; gap2; " starts at "; start2; ", difference is "; diff; !".\n" + If pm = limit Then Exit Do + pm *= 10 + Else + gap1 = gap2 + End If +Loop + +Sleep diff --git a/Task/Earliest-difference-between-prime-gaps/Jq/earliest-difference-between-prime-gaps.jq b/Task/Earliest-difference-between-prime-gaps/Jq/earliest-difference-between-prime-gaps.jq new file mode 100644 index 0000000000..85f8ddcaec --- /dev/null +++ b/Task/Earliest-difference-between-prime-gaps/Jq/earliest-difference-between-prime-gaps.jq @@ -0,0 +1,73 @@ +# If $j is 0, then an error condition is raised; +# otherwise, assuming infinite-precision integer arithmetic, +# if the input and $j are integers, then the result will be an integer. +def idivide($j): + (. % $j) as $mod + | (. - $mod) / $j ; + +def properfactors: + . as $in + | [2, $in, false] + | recurse( + . as [$p, $q, $valid, $s] + | if $q == 1 then empty + elif $q % $p == 0 then [$p, ($q|idivide($p)), true] + elif $p == 2 then [3, $q, false, $s] + else ($s // ($q | sqrt)) as $s + | if ($p + 2) <= $s then [$p + 2, $q, false, $s] + else [$q, 1, true] + end + end ) + | if .[2] and .[0] != $in then .[0] else empty end ; + +def stream_of_primes: + 2, (range(3; infinite; 2) | if first(properfactors) // null then empty else . end); + +# Emit a sequence of objects {gap, p, previous} starting with +# {"gap":2,"p":5,"previous":3} +# {"gap":6,"p":29,"previous":23} +# The stream of .previous values corresponds to the OEIS sequence https://oeis.org/A000230 +# except that `gaps` starts with .previous equal to 3 because 5-3 is the first occurrence of 2. +def gaps: + foreach stream_of_primes as $p (null; + if . == null then { $p, next: 2 } + else (.next|tostring) as $next + | if .[$next] then .emit = .[$next] | del( .[$next] ) | .next += 2 else .emit = null end + | .emit2 = null + | ($p - .p) as $gap + | .previous = .p + | .p = $p + | if $gap < .next then . + else ($gap|tostring) as $s + | if $gap == .next then .emit2 = {$gap, p, previous} | .next += 2 | del( .[$s] ) + elif .[$s] then . + else .[$s] = {$gap, p, previous} + end + end + end; + if .emit then .emit else empty end, + if .emit2 then .emit2 else empty end + ); + +# Report $n results, one for each order of magnitude starting with 10 +def earliest_difference($n): + + def report($gap): + if (($gap.previous - .previous)|length) > .magnitude + then .emit += [del(.emit) + {p: $gap.previous}] + | .magnitude *= 10 + | report($gap) + else . + end; + + limit($n; + foreach gaps as $gap (null; + if . == null then {magnitude: 10, n:0, previous: $gap.previous } + else .emit = null + | .n += 1 + | report($gap) + | .previous = $gap.previous + end) + | select(.emit).emit[]); + +earliest_difference(7) diff --git a/Task/Earliest-difference-between-prime-gaps/Julia/earliest-difference-between-prime-gaps.julia b/Task/Earliest-difference-between-prime-gaps/Julia/earliest-difference-between-prime-gaps.jl similarity index 100% rename from Task/Earliest-difference-between-prime-gaps/Julia/earliest-difference-between-prime-gaps.julia rename to Task/Earliest-difference-between-prime-gaps/Julia/earliest-difference-between-prime-gaps.jl diff --git a/Task/Earliest-difference-between-prime-gaps/Phix/earliest-difference-between-prime-gaps.phix b/Task/Earliest-difference-between-prime-gaps/Phix/earliest-difference-between-prime-gaps.phix index 330c9e14e2..6db651adc0 100644 --- a/Task/Earliest-difference-between-prime-gaps/Phix/earliest-difference-between-prime-gaps.phix +++ b/Task/Earliest-difference-between-prime-gaps/Phix/earliest-difference-between-prime-gaps.phix @@ -1,35 +1,33 @@ -(phixonline)--> - with javascript_semantics - constant limit = iff(platform()=JS?1e7:1e8), - gslim = 250 - sequence primes = get_primes_le(limit*4), - gapstarts = repeat(0,gslim) - for i=2 to length(primes) do - integer gap = primes[i]-primes[i-1] - if gapstarts[gap]=0 then - gapstarts[gap] = primes[i-1] - end if - end for +with javascript_semantics +constant limit = iff(platform()=JS?1e7:1e8), + gslim = 250 +sequence primes = get_primes_le(limit*4), + gapstarts = repeat(0,gslim) +for i=2 to length(primes) do + integer gap = primes[i]-primes[i-1] + if gapstarts[gap]=0 then + gapstarts[gap] = primes[i-1] + end if +end for - integer pm = 10, gap1 = 2 - while true do - while gapstarts[gap1]=0 do gap1 += 2 end while - integer start1 = gapstarts[gap1], - gap2 = gap1 + 2 - if gapstarts[gap2]=0 then - gap1 = gap2 + 2 - else - integer start2 = gapstarts[gap2], - diff = abs(start2 - start1) - if diff>pm then - printf(1,"Earliest difference >%,d between adjacent prime gap starting primes:\n",{pm}) - printf(1,"Gap %d starts at %,d, gap %d starts at %,d, difference is %,d.\n\n", - {gap1, start1, gap2, start2, diff}) - if pm=limit then exit end if - pm *= 10 - else - gap1 = gap2 - end if - end if - end while - - requires(64) - enum X, Y -- rational ec point - enum A, B, N, G, R -- elliptic curve parameters - -- also signature pair(A,B) +requires(64) +enum X, Y -- rational ec point +enum A, B, N, G, R -- elliptic curve parameters + -- also signature pair(A,B) - constant mxN = 1073741789 -- maximum modulus - constant mxr = 1073807325 -- max order G = mxN + 65536 - constant inf = -2147483647 -- symbolic infinity +constant mxN = 1073741789 -- maximum modulus +constant mxr = 1073807325 -- max order G = mxN + 65536 +constant inf = -2147483647 -- symbolic infinity - sequence e = {0,0,0,{0,0},0} -- single global curve - constant zerO = {inf,0} -- point at infinity zerO +sequence e = {0,0,0,{0,0},0} -- single global curve +constant zerO = {inf,0} -- point at infinity zerO - bool inverr -- impossible inverse mod N +bool inverr -- impossible inverse mod N - function exgcd(atom v, u) - -- return mod(v^-1, u) - atom q, t, r = 0, s = 1 - if v<0 then v += u end if +function exgcd(atom v, u) +-- return mod(v^-1, u) +atom q, t, r = 0, s = 1 + if v<0 then v += u end if - while v do - q = floor(u/v) - t = u-q*v - u = v - v = t - t = r-q*s - r = s - s = t - end while + while v do + q = floor(u/v) + t = u-q*v + u = v + v = t + t = r-q*s + r = s + s = t + end while - if u!=1 then - printf(1," impossible inverse mod N, gcd = %d\n",{u}) - inverr = true - end if + if u!=1 then + printf(1," impossible inverse mod N, gcd = %d\n",{u}) + inverr = true + end if - return r - end function + return r +end function - function modn(atom a) - -- return mod(a, N) - a = mod(a,e[N]) - if a<0 then a += e[N] end if - return a - end function +function modn(atom a) +-- return mod(a, N) + a = mod(a,e[N]) + if a<0 then a += e[N] end if + return a +end function - function modr(atom a) - -- return mod(a, r) - a = mod(a,e[R]) - if a<0 then a += e[R] end if - return a - end function +function modr(atom a) +-- return mod(a, r) + a = mod(a,e[R]) + if a<0 then a += e[R] end if + return a +end function - function disc() - -- return the discriminant of E - atom a = e[A], b = e[B], - c = 4*modn(a*modn(a*a)) - return modn(-16*(c+27*modn(b*b))) - end function +function disc() +-- return the discriminant of E + atom a = e[A], b = e[B], + c = 4*modn(a*modn(a*a)) + return modn(-16*(c+27*modn(b*b))) +end function - function isO(sequence p) - -- return true if P = zerO - return (p[X]=inf and p[Y]=0) - end function +function isO(sequence p) +-- return true if P = zerO + return (p[X]=inf and p[Y]=0) +end function - function ison(sequence p) - -- return true if P is on curve E - atom r = 0, s = 0 - if not isO(p) then - r = modn(e[B]+p[X]*modn(e[A]+p[X]*p[X])) - s = modn(p[Y]*p[Y]) - end if - return (r=s) - end function +function ison(sequence p) +-- return true if P is on curve E + atom r = 0, s = 0 + if not isO(p) then + r = modn(e[B]+p[X]*modn(e[A]+p[X]*p[X])) + s = modn(p[Y]*p[Y]) + end if + return (r=s) +end function - procedure pprint(string f, sequence p) - -- print point P with prefix f - if isO(p) then - printf(1,"%s (0)\n",{f}) - else - atom y = p[Y] - if y>e[N]-y then y -= e[N] end if - printf(1,"%s (%d,%d)\n",{f,p[X],y}) - end if - end procedure +procedure pprint(string f, sequence p) +-- print point P with prefix f + if isO(p) then + printf(1,"%s (0)\n",{f}) + else + atom y = p[Y] + if y>e[N]-y then y -= e[N] end if + printf(1,"%s (%d,%d)\n",{f,p[X],y}) + end if +end procedure - function padd(sequence p, q) - -- full ec point addition - atom la, t +function padd(sequence p, q) +-- full ec point addition +atom la, t - if isO(p) then return q end if - if isO(q) then return p end if + if isO(p) then return q end if + if isO(q) then return p end if - if p[X]!=q[X] then -- R := P + Q - t = p[Y]-q[Y] - la = modn(t*exgcd(p[X]-q[X], e[N])) + if p[X]!=q[X] then -- R := P + Q + t = p[Y]-q[Y] + la = modn(t*exgcd(p[X]-q[X], e[N])) - else -- P = Q, R := 2P - if (p[Y]=q[Y]) and (p[Y]!=0) then - t = modn(3*modn(p[X]*p[X])+e[A]) - la = modn(t*exgcd(2*p[Y], e[N])) - else - return zerO -- P = -Q, R := O - end if - end if + else -- P = Q, R := 2P + if (p[Y]=q[Y]) and (p[Y]!=0) then + t = modn(3*modn(p[X]*p[X])+e[A]) + la = modn(t*exgcd(2*p[Y], e[N])) + else + return zerO -- P = -Q, R := O + end if + end if - t = modn(la*la-p[X]-q[X]) - sequence r = deep_copy(zerO) - r[Y] = modn(la*(p[X]-t)-p[Y]) - r[X] = t - if inverr then r = zerO end if - return r - end function + t = modn(la*la-p[X]-q[X]) + sequence r = deep_copy(zerO) + r[Y] = modn(la*(p[X]-t)-p[Y]) + r[X] = t + if inverr then r = zerO end if + return r +end function - function pmul(sequence p, atom k) - -- R:= multiple kP - sequence s = zerO, q = p +function pmul(sequence p, atom k) +-- R:= multiple kP + sequence s = zerO, q = p - while k do - if and_bits(k,1) then - s = padd(s, q) - end if - if inverr then s = zerO; exit end if - k = floor(k/2) - q = padd(q, q) - end while - return s - end function + while k do + if and_bits(k,1) then + s = padd(s, q) + end if + if inverr then s = zerO; exit end if + k = floor(k/2) + q = padd(q, q) + end while + return s +end function - function ellinit(sequence i) - -- initialize elliptic curve - atom a = i[1], b = i[2] - inverr = false - e[N] = i[3] +function ellinit(sequence i) +-- initialize elliptic curve +atom a = i[1], b = i[2] + inverr = false + e[N] = i[3] - if (e[N]<5) or (e[N]>mxN) then return 0 end if + if (e[N]<5) or (e[N]>mxN) then return 0 end if - e[A] = modn(a) - e[B] = modn(b) - e[G][X] = modn(i[4]) - e[G][Y] = modn(i[5]) - e[R] = i[6] + e[A] = modn(a) + e[B] = modn(b) + e[G][X] = modn(i[4]) + e[G][Y] = modn(i[5]) + e[R] = i[6] - if (e[R]<5) or (e[R]>mxr) then return 0 end if + if (e[R]<5) or (e[R]>mxr) then return 0 end if - printf(1,"E: y^2 = x^3 + %dx + %d (mod %d)\n",{a,b,e[N]}) - pprint("base point G", e[G]) - printf(1,"order(G, E) = %d\n",{e[R]}) + printf(1,"E: y^2 = x^3 + %dx + %d (mod %d)\n",{a,b,e[N]}) + pprint("base point G", e[G]) + printf(1,"order(G, E) = %d\n",{e[R]}) - return -1 - end function + return -1 +end function - function signature(atom s, f) - -- signature primitive - atom c, d, u, u1 - sequence V +function signature(atom s, f) +-- signature primitive +atom c, d, u, u1 +sequence V - printf(1,"signature computation\n") - while true do - while true do - -- u = rand(e[R]-1) - u = 571533488 -- match FreeBASIC output - -- u = 605163545 -- match C output - V = pmul(e[G], u) - c = modr(V[X]) - if c!=0 then exit end if - end while + printf(1,"signature computation\n") + while true do + while true do +-- u = rand(e[R]-1) + u = 571533488 -- match FreeBASIC output +-- u = 605163545 -- match C output + V = pmul(e[G], u) + c = modr(V[X]) + if c!=0 then exit end if + end while - u1 = exgcd(u, e[R]) - d = modr(u1*(f+modr(s*c))) - if d!=0 then exit end if - end while - printf(1,"one-time u = %d\n",u) - pprint("V = uG", V) - return {c,d} - end function + u1 = exgcd(u, e[R]) + d = modr(u1*(f+modr(s*c))) + if d!=0 then exit end if + end while + printf(1,"one-time u = %d\n",u) + pprint("V = uG", V) + return {c,d} +end function - function verify(sequence W, atom f, sequence sg) - -- verification primitive - atom c = sg[A], d = sg[B], - t, c1, h1, h2, h - sequence V, V2 +function verify(sequence W, atom f, sequence sg) +-- verification primitive +atom c = sg[A], d = sg[B], + t, c1, h1, h2, h +sequence V, V2 - --domain check - t = (c>0) and (c<e[R]) - t = t and (d>0) and (d<e[R]) - if not t then return 0 end if + --domain check + t = (c>0) and (c0) and (dprintf(1,"\nsignature verification\n") - h = exgcd(d, e[R]) - h1 = modr(f*h) - h2 = modr(c*h) - printf(1,"h1,h2 = %d,%d\n",{h1,h2}) - V = pmul(e[G], h1) - V2 = pmul(W, h2) - pprint("h1G", V) - pprint("h2W", V2) - V = padd(V, V2) - pprint("+ =", V) - if isO(V) then return 0 end if - c1 = modr(V[X]) - printf(1,"c' = %d\n",c1) + printf(1,"\nsignature verification\n") + h = exgcd(d, e[R]) + h1 = modr(f*h) + h2 = modr(c*h) + printf(1,"h1,h2 = %d,%d\n",{h1,h2}) + V = pmul(e[G], h1) + V2 = pmul(W, h2) + pprint("h1G", V) + pprint("h2W", V2) + V = padd(V, V2) + pprint("+ =", V) + if isO(V) then return 0 end if + c1 = modr(V[X]) + printf(1,"c' = %d\n",c1) - return (c1=c) - end function + return (c1=c) +end function - procedure errmsg() - printf(1,"invalid parameter set\n") - printf(1,"_____________________\n") - end procedure +procedure errmsg() + printf(1,"invalid parameter set\n") + printf(1,"_____________________\n") +end procedure - procedure ec_dsa(atom f, d) - -- digital signature on message hash f, error bit d - atom i, s, t - sequence sg, W +procedure ec_dsa(atom f, d) +-- digital signature on message hash f, error bit d +atom i, s, t +sequence sg, W - --parameter check - t = (disc()=0) - t = t or isO(e[G]) - W = pmul(e[G], e[R]) - t = t or not isO(W) - t = t or not ison(e[G]) - if t then errmsg() return end if + --parameter check + t = (disc()=0) + t = t or isO(e[G]) + W = pmul(e[G], e[R]) + t = t or not isO(W) + t = t or not ison(e[G]) + if t then errmsg() return end if - puts(1,"\nkey generation\n") - -- s = rand(e[R] - 1) - s = 509100772 -- match FreeBASIC output - -- s = 1343570 -- match C output - W = pmul(e[G], s) - printf(1,"private key s = %d\n",{s}) - pprint("public key W = sG", W) + puts(1,"\nkey generation\n") +-- s = rand(e[R] - 1) + s = 509100772 -- match FreeBASIC output +-- s = 1343570 -- match C output + W = pmul(e[G], s) + printf(1,"private key s = %d\n",{s}) + pprint("public key W = sG", W) - --next highest power of 2 - 1 - t = e[R] - i = 1 - while i<32 do - t = or_bits(t,floor(t/power(2,i))) - i *= 2 - end while - while f>t do - f = floor(f/2) - end while - printf(1,"\naligned hash %x\n\n",{f}) + --next highest power of 2 - 1 + t = e[R] + i = 1 + while i<32 do + t = or_bits(t,floor(t/power(2,i))) + i *= 2 + end while + while f>t do + f = floor(f/2) + end while + printf(1,"\naligned hash %x\n\n",{f}) - sg = signature(s, f) - if inverr then errmsg() return end if - printf(1,"signature c,d = %d,%d\n",sg) + sg = signature(s, f) + if inverr then errmsg() return end if + printf(1,"signature c,d = %d,%d\n",sg) - if d>0 then - while d>t do - d = floor(d/2) - end while - f = xor_bits(f,d) - printf(1,"corrupted hash %x\n",{f}) - end if + if d>0 then + while d>t do + d = floor(d/2) + end while + f = xor_bits(f,d) + printf(1,"corrupted hash %x\n",{f}) + end if - t = verify(W, f, sg) - if inverr then errmsg() return end if - if t then - printf(1,"Valid\n_____\n") - else - printf(1,"invalid\n_______\n") - end if - end procedure + t = verify(W, f, sg) + if inverr then errmsg() return end if + if t then + printf(1,"Valid\n_____\n") + else + printf(1,"invalid\n_______\n") + end if +end procedure - --Test vectors: elliptic curve domain parameters, - --short Weierstrass model y^2 = x^3 + ax + b (mod N) +--Test vectors: elliptic curve domain parameters, +--short Weierstrass model y^2 = x^3 + ax + b (mod N) - constant tests = { - -- a, b, modulus N, base point G, order(G, E), cofactor - {355, 671, 1073741789, 13693, 10088, 1073807281}, - { 0, 7, 67096021, 6580, 779, 16769911}, -- 4 - { -3, 1, 877073, 0, 1, 878159}, - { 0, 14, 22651, 63, 30, 151}, -- 151 - { 3, 2, 5, 2, 1, 5}, +constant tests = { +-- a, b, modulus N, base point G, order(G, E), cofactor + {355, 671, 1073741789, 13693, 10088, 1073807281}, + { 0, 7, 67096021, 6580, 779, 16769911}, -- 4 + { -3, 1, 877073, 0, 1, 878159}, + { 0, 14, 22651, 63, 30, 151}, -- 151 + { 3, 2, 5, 2, 1, 5}, - --ecdsa may fail if... - --the base point is of composite order - { 0, 7, 67096021, 2402, 6067, 33539822}, -- 2 - --the given order is a multiple of the true order - { 0, 7, 67096021, 6580, 779, 67079644}, -- 1 - --the modulus is not prime (deceptive example) - { 0, 7, 877069, 3, 97123, 877069}, - --fails if the modulus divides the discriminant - { 39, 387, 22651, 95, 27, 22651}} + --ecdsa may fail if... + --the base point is of composite order + { 0, 7, 67096021, 2402, 6067, 33539822}, -- 2 + --the given order is a multiple of the true order + { 0, 7, 67096021, 6580, 779, 67079644}, -- 1 + --the modulus is not prime (deceptive example) + { 0, 7, 877069, 3, 97123, 877069}, + --fails if the modulus divides the discriminant + { 39, 387, 22651, 95, 27, 22651}} - --Digital signature on message hash f, - --set d > 0 to simulate corrupted data - atom f = #789ABCDE, - d = 0 +--Digital signature on message hash f, +--set d > 0 to simulate corrupted data +atom f = #789ABCDE, + d = 0 - --for i=1 to length(tests) do - for i=1 to 1 do - if not ellinit(tests[i]) then exit end if - ec_dsa(f, d) - end for - - with javascript_semantics - constant X=1, Y=2, bCoeff=7, INF = 1e300*1e300 +with javascript_semantics +constant X=1, Y=2, bCoeff=7, INF = 1e300*1e300 - type point(object pt) - return sequence(pt) and length(pt)=2 and atom(pt[X]) and atom(pt[Y]) - end type +type point(object pt) + return sequence(pt) and length(pt)=2 and atom(pt[X]) and atom(pt[Y]) +end type - function zero() - point pt = {INF, INF} - return pt - end function +function zero() + point pt = {INF, INF} + return pt +end function - function is_zero(point p) - return p[X]>1e20 or p[X]<-1e20 - end function +function is_zero(point p) + return p[X]>1e20 or p[X]<-1e20 +end function - function neg(point p) - p = {p[X], -p[Y]} - return p - end function +function neg(point p) + p = {p[X], -p[Y]} + return p +end function - function dbl(point p) - point r = p - if not is_zero(p) then - atom L = (3*p[X]*p[X])/(2*p[Y]) - atom x = L*L-2*p[X] - r = {x, L*(p[X]-x)-p[Y]} - end if - return r - end function +function dbl(point p) + point r = p + if not is_zero(p) then + atom L = (3*p[X]*p[X])/(2*p[Y]) + atom x = L*L-2*p[X] + r = {x, L*(p[X]-x)-p[Y]} + end if + return r +end function - function add(point p, point q) - if p==q then return dbl(p) end if - if is_zero(p) then return q end if - if is_zero(q) then return p end if - atom L = (q[Y]-p[Y])/(q[X]-p[X]) - atom x = L*L-p[X]-q[X] - point r = {x, L*(p[X]-x)-p[Y]} - return r - end function +function add(point p, point q) + if p==q then return dbl(p) end if + if is_zero(p) then return q end if + if is_zero(q) then return p end if + atom L = (q[Y]-p[Y])/(q[X]-p[X]) + atom x = L*L-p[X]-q[X] + point r = {x, L*(p[X]-x)-p[Y]} + return r +end function - function mul(point p, integer n) - point r = zero() - integer i = 1 - while i<=n do - if and_bits(i, n) then r = add(r, p) end if - p = dbl(p) - i = i*2 - end while - return r - end function +function mul(point p, integer n) + point r = zero() + integer i = 1 + while i<=n do + if and_bits(i, n) then r = add(r, p) end if + p = dbl(p) + i = i*2 + end while + return r +end function - procedure show(string s, point p) - puts(1, s&iff(is_zero(p)?"Zero\n":sprintf("(%.3f, %.3f)\n", p))) - end procedure +procedure show(string s, point p) + puts(1, s&iff(is_zero(p)?"Zero\n":sprintf("(%.3f, %.3f)\n", p))) +end procedure - function cbrt(atom c) - return iff(c>=0?power(c,1/3):-power(-c,1/3)) - end function +function cbrt(atom c) + return iff(c>=0?power(c,1/3):-power(-c,1/3)) +end function - function from_y(atom y) - point r = {cbrt(y*y-bCoeff), y} - return r - end function +function from_y(atom y) + point r = {cbrt(y*y-bCoeff), y} + return r +end function - point a, b, c, d +point a, b, c, d - a = from_y(1) - b = from_y(2) - c = add(a, b) - d = neg(c) +a = from_y(1) +b = from_y(2) +c = add(a, b) +d = neg(c) - show("a = ", a) - show("b = ", b) - show("c = a + b = ", c) - show("d = -c = ", d) - show("c + d = ", add(c, d)) - show("a + b + d = ", add(a, add(b, d))) - show("a * 12345 = ", mul(a, 12345)) - - with javascript_semantics - sequence emirps = {} +with javascript_semantics +sequence emirps = {} - function rev(integer n) - integer res = 0 - while n do - res = res*10+remainder(n,10) - n = floor(n/10) - end while - return res - end function +function rev(integer n) + integer res = 0 + while n do + res = res*10+remainder(n,10) + n = floor(n/10) + end while + return res +end function - function emirp(integer n) - if is_prime(n) then - integer r = rev(n) - if r!=n and is_prime(r) then - return true - end if - end if - return false - end function +function emirp(integer n) + if is_prime(n) then + integer r = rev(n) + if r!=n and is_prime(r) then + return true + end if + end if + return false +end function - procedure usage() - printf(1,"use a single command line argument, with no spaces, eg \"1-20\" (first 20), \n") - printf(1,"\"7700..8000\" (between 7700 and 8000), or \"10000\" (the 10,000th).\n") - {} = wait_key() - abort(0) - end procedure +procedure usage() + printf(1,"use a single command line argument, with no spaces, eg \"1-20\" (first 20), \n") + printf(1,"\"7700..8000\" (between 7700 and 8000), or \"10000\" (the 10,000th).\n") + {} = wait_key() + abort(0) +end procedure - procedure main(string arg3) - sequence args - integer n,m - if find('-',arg3) then -- nth to mth emirp range - args = scanf(arg3,"%d-%d") - if length(args)!=1 then usage() end if - {{n,m}} = args - integer k = 1 - while length(emirps)<m do - if emirp(k) then emirps &= k end if - k += 1 - end while - printf(1,"emirps %d to %d: %v\n",{n,m,emirps[n..m]}) - elsif match("..",arg3) then -- emirps between n amd m - args = scanf(arg3,"%d..%d") - if length(args)!=1 then usage() end if - {{n,m}} = args - integer k = 1 - while length(emirps)=0 or emirps[$]<m do - if emirp(k) then emirps &= k end if - k += 1 - end while - sequence s = {} - for i=1 to length(emirps) do - if emirps[i]>n then - for j=i to length(emirps) do - if emirps[j]>m then - printf(1,"emirps between %d and %d: %v\n",{n,m,emirps[i..j-1]}) - exit - end if - end for - exit - end if - end for - else -- nth emirp - args = scanf(arg3,"%d") - if length(args)!=1 then usage() end if - {{n}} = args - integer k = 1 - while length(emirps)<n do - if emirp(k) then emirps &= k end if - k += 1 - end while - printf(1,"emirp %d: %d\n",{n,emirps[n]}) - end if - end procedure +procedure main(string arg3) + sequence args + integer n,m + emirps = {} + if find('-',arg3) then -- nth to mth emirp range + args = scanf(arg3,"%d-%d") + if length(args)!=1 then usage() end if + {{n,m}} = args + integer k = 1 + while length(emirps)n then + for j=i to length(emirps) do + if emirps[j]>m then + printf(1,"emirps between %d and %d: %v\n",{n,m,emirps[i..j-1]}) + exit + end if + end for + exit + end if + end for + else -- nth emirp + args = scanf(arg3,"%d") + if length(args)!=1 then usage() end if + {{n}} = args + integer k = 1 + while length(emirps)sequence cl = command_line() - if length(cl)=2 then - main("1-20") - main("7700..8000") - main("10000") - elsif length(cl)=3 then - main(cl[3]) - else - usage() - end if - - without js -- command_line, file i/o - function entropy(sequence s) - sequence symbols = {}, - counts = {} - integer N = length(s) - for i=1 to N do - object si = s[i] - integer k = find(si,symbols) - if k=0 then - symbols = append(symbols,si) - counts = append(counts,1) - else - counts[k] += 1 - end if - end for - atom H = 0 - for i=1 to length(counts) do - atom ci = counts[i]/N - H -= ci*log2(ci) - end for - return H - end function +without js -- command_line, file i/o +function entropy(sequence s) + sequence symbols = {}, + counts = {} + integer N = length(s) + for i=1 to N do + object si = s[i] + integer k = find(si,symbols) + if k=0 then + symbols = append(symbols,si) + counts = append(counts,1) + else + counts[k] += 1 + end if + end for + atom H = 0 + for i=1 to length(counts) do + atom ci = counts[i]/N + H -= ci*log2(ci) + end for + return H +end function - ?entropy(get_text(open(substitute(command_line()[2],".exe",".exw")),"rb")) - - enum apple, banana, orange - enum apple=5, banana=10, orange= - - without js -- none such in a browser, that I know of - ?getenv("PATH") - - with javascript_semantics - atom t0 = time() - atom ps = 2, -- current prime sum - cs = 4 -- current composite sum - integer psn = 1, npi = 1, -- (see below) - csn = 1, nci = 3, nc = 4, ncp = 5, - found = 0 - constant limit = iff(platform()=JS?10:11) - while found<limit do - integer c = compare(ps,cs) -- {-1,0,+1} - if c=0 then - printf(1,"%,21d - %,10d%s prime sum, %,10d%s composite sum (%s)\n", - {ps, psn, ord(psn), csn, ord(csn), elapsed(time()-t0)}) - found += 1 - end if - if c<=0 then - psn += 1 -- prime sum number - npi += 1 -- next prime index - ps += get_prime(npi) - end if - if c>=0 then - csn += 1 -- composite sum number - nc += 1 -- next composite? - if nc=ncp then -- "", erm no - nci += 1 -- next prime index - ncp = get_prime(nci) - nc += 1 -- next composite (even!) - end if - cs += nc - end if - end while - - with javascript_semantics - function equilibrium(sequence s) - atom lower_sum = 0, - higher_sum = sum(s) - sequence res = {} - for i=1 to length(s) do - higher_sum -= s[i] - if lower_sum=higher_sum then - res &= i - end if - lower_sum += s[i] - end for - return res - end function +with javascript_semantics +function equilibrium(sequence s) + atom lower_sum = 0, + higher_sum = sum(s) + sequence res = {} + for i,si in s do + higher_sum -= si + if lower_sum=higher_sum then + res &= i + end if + lower_sum += si + end for + return res +end function - ?equilibrium({-7,1,5,2,-4,3,0}) - - with javascript_semantics - sequence escache = {} +with javascript_semantics +sequence escache = {} - function es_cat(integer p) - if p>length(escache) and platform()!=JS then - escache &= repeat(0,p-length(escache)) - end if - integer category = escache[p] - if not category then - sequence f = filter(prime_factors(p+1,false,-1),">",3) - category = 1 - if length(f) then - category += max(apply(f,es_cat)) - end if - escache[p] = category - end if - return category - end function +function es_cat(integer p) + if p>length(escache) and platform()!=JS then + escache &= repeat(0,p-length(escache)) + end if + integer category = escache[p] + if not category then + sequence f = filter(prime_factors(p+1,false,-1),">",3) + category = 1 + if length(f) then + category += max(apply(f,es_cat)) + end if + escache[p] = category + end if + return category +end function - procedure categorise(integer n) - sequence p = get_primes(n) - printf(1,"First %,d primes:\n",n) - atom t1 = time() - sequence es = {} - for i=1 to n do - if time()>t1 then - progress("categorising %d/%d...",{i,n}) - t1 = time()+1 - end if - integer category = es_cat(p[i]) - while length(es)<category do - es = append(es,{}) - end while - es[category] &= p[i] - end for - progress("") - for c=1 to length(es) do - sequence e = es[c] - if n=200 then - printf(1,"Category %d: %s\n",{c,join(shorten(e,"primes",5,"%d"),",")}) - else - printf(1,"Category %2d: %7d .. %-8d Count: %d\n",{c,e[1],e[$],length(e)}) - end if - end for - printf(1,"\n") - end procedure +procedure categorise(integer n) + sequence p = get_primes(n) + printf(1,"First %,d primes:\n",n) + atom t1 = time() + sequence es = {} + for i=1 to n do + if time()>t1 then + progress("categorising %d/%d...",{i,n}) + t1 = time()+1 + end if + integer category = es_cat(p[i]) + while length(es)atom t0 = time() - categorise(200) - categorise(1e6) - ?elapsed(time()-t0) - - constant aleph = "0123456789ABCDEF" +with javascript_semantics +constant aleph = "0123456789ABCDEF" - function efill(string s, integer ch, i) - -- min-fill, like 10101 or 54321 or 32101 - s[i] = ch - for j=i+1 to length(s) do - ch = iff(ch>='1'?iff(ch='A'?'9':ch-1):'1') - s[j] = ch - end for - return s - end function +function efill(string s, integer ch, i) + -- min-fill, like 10101 or 54321 or 32101 + s[i] = ch + for j=i+1 to length(s) do + ch = iff(ch>='1'?iff(ch='A'?'9':ch-1):'1') + s[j] = ch + end for + return s +end function - function esthetic(string s, integer base = 10) - -- generate the next esthetic number after s - -- (nb unpredictable results if s is not esthetic, or "") - for i=length(s) to 1 by -1 do - integer ch = s[i], cp = iff(i>1?s[i-1]:'0') - if ch<cp and cp<aleph[base] then - return efill(s,aleph[find(ch,aleph)+2],i) - elsif i=1 and ch<aleph[base] then - return efill(s,iff(ch='9'?'A':ch+1),i) - end if - end for - return efill("1"&s,'1',1) - end function +function esthetic(string s, integer base = 10) + -- generate the next esthetic number after s + -- the special case of s="" always yields "1" + -- (nb otherwise s is assumed to be esthetic) + for i=length(s) to 1 by -1 do + integer ch = s[i], cp = iff(i>1?s[i-1]:'0') + if chstring s - sequence res - for base=2 to 16 do - integer hi = base*6, - lo = base*4 - {s,res} = {"",{}} - for i=1 to hi do - s = esthetic(s, base) - if i>=lo then - res = append(res,s) - end if - end for - res = join(shorten(res,"numbers",4)) - printf(1,"Base %d esthetic numbers[%d..%d]: %s\n",{base,lo,hi,res}) - end for +string s +sequence res +for base=2 to 16 do + integer hi = base*6, + lo = base*4 + {s,res} = {"",{}} + for i=1 to hi do + s = esthetic(s, base) + if i>=lo then + res = append(res,s) + end if + end for + res = join(shorten(res,"numbers",4)) + printf(1,"Base %d esthetic numbers[%d..%d]: %s\n",{base,lo,hi,res}) +end for - {s,res} = {efill("1000",'1',1),{}} - while length(s)=4 do - res = append(res,s) - s = esthetic(s) - end while - res = {join(shorten(res,"numbers",5))} - printf(1,"\nBase 10 esthetic numbers between 1,000 and 9,999: %s\n\n",res) +{s,res} = {efill("1000",'1',1),{}} +while length(s)=4 do + res = append(res,s) + s = esthetic(s) +end while +res = {join(shorten(res,"numbers",5))} +printf(1,"\nBase 10 esthetic numbers between 1,000 and 9,999: %s\n\n",res) - function comma(string s) - for i=length(s)-2 to 2 by -3 do - s[i..i-1] = "," - end for - return s - end function +function comma(string s) + for i=length(s)-2 to 2 by -3 do + s[i..i-1] = "," + end for + return s +end function - for k=7 to 19 by 3 do - string f = "10"&repeat('0',k), - t = "13"&repeat('0',k) - {s,res} = {efill(f,'1',1),{}} - while s<t do - res = append(res,s) - s = esthetic(s) - end while - res = join(shorten(res,"numbers",1)) - printf(1,"Base 10 esthetic numbers between %s and %s: %s\n", - {comma(f),comma(t),res}) - end for - - function count_esthetic(integer len, start=0) - -- a start digit of 0 means sum all 1..9 - sequence dc = repeat(repeat(1,10),len) -- nb 0..9 logically - for i=2 to len do - for d=0 to 9 do - dc[i][d+1] = iff(d=0?0:dc[i-1][d]) + iff(d=9?0:dc[i-1][d+2]) - end for - end for - if start=0 then return sum(dc[len][1..9]) end if -- (see note) - return dc[len][start+1] - end function +function count_esthetic(integer len, start=0) + -- a start digit of 0 means sum all 1..9 + sequence dc = repeat(repeat(1,10),len) -- nb 0..9 logically + for i=2 to len do + for d=0 to 9 do + dc[i][d+1] = iff(d=0?0:dc[i-1][d]) + iff(d=9?0:dc[i-1][d+2]) + end for + end for + if start=0 then return sum(dc[len][1..9]) end if -- (see note) + return dc[len][start+1] +end function - sequence t = tagset(iff(machine_bits()=64?63:57),9,3), - r = columnize({apply(true,count_esthetic,{t,1}),t}) - papply(true,printf,{1,{"There are %,26d %2d-digit esthetic numbers beginning with 1\n"},r}) - if machine_bits()=64 then - printf(1,"There are %,26d 64-digit esthetic numbers\n",{count_esthetic(64)}) - printf(1,"There are %,26d esthetic numbers with max 65 digits\n",{sum(apply(tagset(64),count_esthetic))}) - end if - stdout // $0 is a temp register - LDA str,BUF+19 % points after the end of the string -2H SUB str,str,1 % update buffer pointer - DIV acc,acc,10 % do a divide and mod - GET $0,rR % get digit from special purpose reg. rR - % containing the remainder of the division - INCL $0,'0' % convert to ascii - STBU $0,str % place digit in buffer - PBNZ acc,2B % next - % 'str' points to the start of the result - TRAP 0,Fputs,StdOut % output answer to stdout - TRAP 0,Halt,0 % exit + LDA str,BUF+19 % points after the end of the string +2H SUB str,str,1 % update buffer pointer + DIV acc,acc,10 % do a divide and mod + GET $0,rR % get digit from special purpose reg. rR + % containing the remainder of the division + INCL $0,'0' % convert to ascii + STBU $0,str % place digit in buffer + PBNZ acc,2B % next + % 'str' points to the start of the result + TRAP 0,Fputs,StdOut % output answer to stdout + TRAP 0,Halt,0 % exit diff --git a/Task/Ethiopian-multiplication/MoonRock/ethiopian-multiplication.moonrock b/Task/Ethiopian-multiplication/MoonRock/ethiopian-multiplication.moonrock new file mode 100644 index 0000000000..4a1893471c --- /dev/null +++ b/Task/Ethiopian-multiplication/MoonRock/ethiopian-multiplication.moonrock @@ -0,0 +1,54 @@ +' Ethiopian multiplication +BEGIN DEF +pointer word PtrA~ +pointer word PtrIsEven~ +SUB Double(PtrA~) +SUB Halve(PtrA~) +SUB CheckIfEven(PtrA~, PtrIsEven~) +SUB PrintStr(S$, Width%) + +BEGIN CODE +X% = 17 +Y% = 34 +Tot% = 0 +WHILE X% >= 1 + CALL PrintStr(STR(X%), 6) + PRINT " " + CALL CheckIfEven(X%, VARPTR(IsEven%)) + IF IsEven% = FALSE THEN + Tot% = Tot% + Y% + CALL PrintStr(STR(Y%), 6) + ENDIF + PRINT "\n" + CALL Halve(VARPTR(X%)) + CALL Double(VARPTR(Y%)) +WEND +PRINT "= " +CALL PrintStr(STR(Tot%), 6) +PRINT "\n" +END + +' Subroutines are required, though +' they complicate the code + +SUB Double(PtrA~) +[PtrA~] = 2 * [PtrA~] +END SUB + +SUB Halve(PtrA~) +[PtrA~] = [PtrA~] \ 2 +END SUB + +SUB CheckIfEven(A%, PtrIsEven~) +[PtrIsEven~] = A% MOD 2 +[PtrIsEven~] = [PtrIsEven~] - 1 +END SUB + +SUB PrintStr(S$, Width%) +IF LEN(S$) > Width% THEN + PRINT S$ +ELSE + S$ = SPACE(Width%) + S$ + PRINT RIGHT(S$, Width%) +ENDIF +END SUB diff --git a/Task/Ethiopian-multiplication/OCaml/ethiopian-multiplication.ocaml b/Task/Ethiopian-multiplication/OCaml/ethiopian-multiplication.ml similarity index 100% rename from Task/Ethiopian-multiplication/OCaml/ethiopian-multiplication.ocaml rename to Task/Ethiopian-multiplication/OCaml/ethiopian-multiplication.ml diff --git a/Task/Ethiopian-multiplication/Oberon-07/ethiopian-multiplication.oberon b/Task/Ethiopian-multiplication/Oberon-07/ethiopian-multiplication.oberon new file mode 100644 index 0000000000..c6fe2e64c9 --- /dev/null +++ b/Task/Ethiopian-multiplication/Oberon-07/ethiopian-multiplication.oberon @@ -0,0 +1,42 @@ +MODULE EthopianMultiplication; (* translation of Loglan82 *) + IMPORT Out; + + VAR x, y, outp : INTEGER; + multiplying : BOOLEAN; + + PROCEDURE half( a : INTEGER ) : INTEGER; + BEGIN + RETURN a DIV 2 + END half; + + PROCEDURE doub( a : INTEGER ) : INTEGER; + BEGIN + RETURN a * 2 + END doub; + + PROCEDURE isEven( a : INTEGER ) : BOOLEAN; + BEGIN + RETURN ~ ODD( a ) + END isEven; + +BEGIN + x := 17; + y := 34; + outp := 0; + multiplying := TRUE; + WHILE multiplying DO + Out.Int( x, 6 );Out.String( " " ); + IF ~ isEven(x) THEN + outp := outp + y; + Out.Int( y, 6 ) + END; + Out.Ln; + IF x < 2 THEN + multiplying := FALSE + ELSE + x := half(x); + y := doub(y) + END + END; + Out.String( " = " );Out.Int( outp, 6 );Out.Ln +END EthopianMultiplication. diff --git a/Task/Ethiopian-multiplication/Octave/ethiopian-multiplication.octave b/Task/Ethiopian-multiplication/Octave/ethiopian-multiplication.octave index 18d3a0af83..c6a81160b1 100644 --- a/Task/Ethiopian-multiplication/Octave/ethiopian-multiplication.octave +++ b/Task/Ethiopian-multiplication/Octave/ethiopian-multiplication.octave @@ -18,12 +18,12 @@ function r = ethiopicmult(plier, plicand, tutor=false) while(plier >= 1) if ( iseven(plier) ) if (tutor) - printf("%4d %6d struck\n", plier, plicand); + printf("%4d %6d struck\n", plier, plicand); endif else r = r + plicand; if (tutor) - printf("%4d %6d kept\n", plier, plicand); + printf("%4d %6d kept\n", plier, plicand); endif endif plier = halve(plier); diff --git a/Task/Ethiopian-multiplication/Oz/ethiopian-multiplication.oz b/Task/Ethiopian-multiplication/Oz/ethiopian-multiplication.oz index 4eaecb27c7..2c5a6825bd 100644 --- a/Task/Ethiopian-multiplication/Oz/ethiopian-multiplication.oz +++ b/Task/Ethiopian-multiplication/Oz/ethiopian-multiplication.oz @@ -10,9 +10,9 @@ declare L in X; L>0; {Halve L} %% C-like iterator: "Init; While; Next" R in Y; true; {Double R} collect:Collect - do - {Collect L#R} - end + do + {Collect L#R} + end OddRows = {Filter Rows LeftIsOdd} RightColumn = {Map OddRows SelectRight} diff --git a/Task/Ethiopian-multiplication/Pascal-P/ethiopian-multiplication.pas b/Task/Ethiopian-multiplication/Pascal-P/ethiopian-multiplication.pas new file mode 100644 index 0000000000..1046cc6565 --- /dev/null +++ b/Task/Ethiopian-multiplication/Pascal-P/ethiopian-multiplication.pas @@ -0,0 +1,47 @@ +program ethiopian(output); + (* Ethiopian multiplication *) +var + x, y, outp: integer; + + function doub(a: integer): integer; + begin + doub := a * 2; + end; + + function half(a: integer): integer; + begin + half := a div 2; + end; + + function iseven(a: integer): boolean; + begin + iseven := a mod 2 = 0; + end; + +begin + x := 17; + y := 34; + write(x: 6); + if not (iseven(x)) then + begin + outp := outp + y; + writeln(' ', y: 6); + end + else + writeln; + while x >= 2 do + begin + x := half(x); + y := doub(y); + write(x: 6); + if not (iseven(x)) then + begin + outp := outp + y; + writeln(' ', y: 6); + end + else + writeln; + end; + writeln(' = ', outp: 6); + (* readln; *) +end. diff --git a/Task/Ethiopian-multiplication/Pascal/ethiopian-multiplication.pas b/Task/Ethiopian-multiplication/Pascal/ethiopian-multiplication.pas deleted file mode 100644 index 826258d7fd..0000000000 --- a/Task/Ethiopian-multiplication/Pascal/ethiopian-multiplication.pas +++ /dev/null @@ -1,34 +0,0 @@ -program EthiopianMultiplication; - {$IFDEF FPC} - {$MODE DELPHI} - {$ENDIF} - function Double(Number: Integer): Integer; - begin - Result := Number * 2 - end; - - function Halve(Number: Integer): Integer; - begin - Result := Number div 2 - end; - - function Even(Number: Integer): Boolean; - begin - Result := Number mod 2 = 0 - end; - - function Ethiopian(NumberA, NumberB: Integer): Integer; - begin - Result := 0; - while NumberA >= 1 do - begin - if not Even(NumberA) then - Result := Result + NumberB; - NumberA := Halve(NumberA); - NumberB := Double(NumberB) - end - end; - -begin - Write(Ethiopian(17, 34)) -end. diff --git a/Task/Ethiopian-multiplication/PascalABC.NET/ethiopian-multiplication.pas b/Task/Ethiopian-multiplication/PascalABC.NET/ethiopian-multiplication.pas new file mode 100644 index 0000000000..64d7022701 --- /dev/null +++ b/Task/Ethiopian-multiplication/PascalABC.NET/ethiopian-multiplication.pas @@ -0,0 +1,17 @@ +function halve(x: integer): integer := x div 2; +function double(x: integer): integer := x * 2; +function odd(x: integer): boolean := x mod 2 <> 0; + +function ethiopian(x, y: integer): integer; +begin + while x >= 1 do + begin + if odd(x) then result += y; + x := halve(x); + y := double(y); + end; +end; + +begin + ethiopian(17, 34).println; +end. diff --git a/Task/Ethiopian-multiplication/Perl/ethiopian-multiplication.pl b/Task/Ethiopian-multiplication/Perl/ethiopian-multiplication.pl index 9ffe136ab9..85d7454124 100644 --- a/Task/Ethiopian-multiplication/Perl/ethiopian-multiplication.pl +++ b/Task/Ethiopian-multiplication/Perl/ethiopian-multiplication.pl @@ -11,12 +11,12 @@ sub ethiopicmult my $r = 0; while ($plier >= 1) { - $r += $plicand unless iseven($plier); - if ($tutor) { - print "$plier, $plicand ", (iseven($plier) ? " struck" : " kept"), "\n"; - } - $plier = halve($plier); - $plicand = double($plicand); + $r += $plicand unless iseven($plier); + if ($tutor) { + print "$plier, $plicand ", (iseven($plier) ? " struck" : " kept"), "\n"; + } + $plier = halve($plier); + $plicand = double($plicand); } return $r; } diff --git a/Task/Ethiopian-multiplication/Pluto/ethiopian-multiplication.pluto b/Task/Ethiopian-multiplication/Pluto/ethiopian-multiplication.pluto new file mode 100644 index 0000000000..a0528544e6 --- /dev/null +++ b/Task/Ethiopian-multiplication/Pluto/ethiopian-multiplication.pluto @@ -0,0 +1,18 @@ +local function halve(n) return n // 2 end + +local function double(n) return n * 2 end + +local function is_even(n) return n % 2 == 0 end + +local function ethiopian(x, y) + local sum = 0 + while x >= 1 do + if !is_even(x) then sum += y end + x = halve(x) + y = double(y) + end + return sum +end + +print($"17 x 34 = {ethiopian(17, 34)}") +print($"99 x 99 = {ethiopian(99, 99)}") diff --git a/Task/Ethiopian-multiplication/PowerShell/ethiopian-multiplication-1.ps1 b/Task/Ethiopian-multiplication/PowerShell/ethiopian-multiplication-1.ps1 new file mode 100644 index 0000000000..7aea5a622d --- /dev/null +++ b/Task/Ethiopian-multiplication/PowerShell/ethiopian-multiplication-1.ps1 @@ -0,0 +1,35 @@ +function isEven { + param ([int]$value) + return [bool]($value % 2 -eq 0) +} + +function doubleValue { + param ([int]$value) + return [int]($value * 2) +} + +function halveValue { + param ([int]$value) + return [int]($value / 2) +} + +function multiplyValues { + param ( + [int]$plier, + [int]$plicand, + [int]$temp = 0 + ) + + while ($plier -ge 1) + { + if (!(isEven $plier)) { + $temp += $plicand + } + $plier = halveValue $plier + $plicand = doubleValue $plicand + } + +return $temp +} + +multiplyValues 17 34 diff --git a/Task/Ethiopian-multiplication/PowerShell/ethiopian-multiplication-1.psh b/Task/Ethiopian-multiplication/PowerShell/ethiopian-multiplication-1.psh deleted file mode 100644 index 04e4e45546..0000000000 --- a/Task/Ethiopian-multiplication/PowerShell/ethiopian-multiplication-1.psh +++ /dev/null @@ -1,35 +0,0 @@ -function isEven { - param ([int]$value) - return [bool]($value % 2 -eq 0) -} - -function doubleValue { - param ([int]$value) - return [int]($value * 2) -} - -function halveValue { - param ([int]$value) - return [int]($value / 2) -} - -function multiplyValues { - param ( - [int]$plier, - [int]$plicand, - [int]$temp = 0 - ) - - while ($plier -ge 1) - { - if (!(isEven $plier)) { - $temp += $plicand - } - $plier = halveValue $plier - $plicand = doubleValue $plicand - } - -return $temp -} - -multiplyValues 17 34 diff --git a/Task/Ethiopian-multiplication/PowerShell/ethiopian-multiplication-2.ps1 b/Task/Ethiopian-multiplication/PowerShell/ethiopian-multiplication-2.ps1 new file mode 100644 index 0000000000..1e797c3ed7 --- /dev/null +++ b/Task/Ethiopian-multiplication/PowerShell/ethiopian-multiplication-2.ps1 @@ -0,0 +1,29 @@ +function halveInt( [int] $rhs ) +{ + [math]::floor( $rhs / 2 ) +} + +function doubleInt( [int] $rhs ) +{ + $rhs*2 +} + +function isEven( [int] $rhs ) +{ + -not ( $_ % 2 ) +} + +function Ethiopian( [int] $lhs , [int] $rhs ) +{ + $scratch = @{} + 1..[math]::floor( [math]::log( $lhs , 2 ) + 1 ) | + ForEach-Object { + $scratch[$lhs] = $rhs + $lhs + $lhs = halveInt( $lhs ) + $rhs = doubleInt( $rhs ) } | + Where-Object { -not ( isEven $_ ) } | + ForEach-Object { $sum = 0 } { $sum += $scratch[$_] } { $sum } +} + +Ethiopian 17 34 diff --git a/Task/Ethiopian-multiplication/PowerShell/ethiopian-multiplication-2.psh b/Task/Ethiopian-multiplication/PowerShell/ethiopian-multiplication-2.psh deleted file mode 100644 index 5ba27a7a0e..0000000000 --- a/Task/Ethiopian-multiplication/PowerShell/ethiopian-multiplication-2.psh +++ /dev/null @@ -1,29 +0,0 @@ -function halveInt( [int] $rhs ) -{ - [math]::floor( $rhs / 2 ) -} - -function doubleInt( [int] $rhs ) -{ - $rhs*2 -} - -function isEven( [int] $rhs ) -{ - -not ( $_ % 2 ) -} - -function Ethiopian( [int] $lhs , [int] $rhs ) -{ - $scratch = @{} - 1..[math]::floor( [math]::log( $lhs , 2 ) + 1 ) | - ForEach-Object { - $scratch[$lhs] = $rhs - $lhs - $lhs = halveInt( $lhs ) - $rhs = doubleInt( $rhs ) } | - Where-Object { -not ( isEven $_ ) } | - ForEach-Object { $sum = 0 } { $sum += $scratch[$_] } { $sum } -} - -Ethiopian 17 34 diff --git a/Task/Ethiopian-multiplication/Powerbuilder/ethiopian-multiplication.powerbuilder b/Task/Ethiopian-multiplication/Powerbuilder/ethiopian-multiplication.powerbuilder index 119c89c29a..af6a22f8fb 100644 --- a/Task/Ethiopian-multiplication/Powerbuilder/ethiopian-multiplication.powerbuilder +++ b/Task/Ethiopian-multiplication/Powerbuilder/ethiopian-multiplication.powerbuilder @@ -11,13 +11,13 @@ public function long wf_ethiopianmultiplication (long al_multiplicand, long al_m long ll_product DO WHILE al_multiplicand >= 1 - IF wf_iseven(al_multiplicand) THEN - // do nothing - ELSE - ll_product += al_multiplier - END IF - al_multiplicand = wf_halve(al_multiplicand) - al_multiplier = wf_double(al_multiplier) + IF wf_iseven(al_multiplicand) THEN + // do nothing + ELSE + ll_product += al_multiplier + END IF + al_multiplicand = wf_halve(al_multiplicand) + al_multiplier = wf_double(al_multiplier) LOOP return ll_product diff --git a/Task/Ethiopian-multiplication/QuickBASIC/ethiopian-multiplication.basic b/Task/Ethiopian-multiplication/QuickBASIC/ethiopian-multiplication.basic new file mode 100644 index 0000000000..6fdbb1e5c2 --- /dev/null +++ b/Task/Ethiopian-multiplication/QuickBASIC/ethiopian-multiplication.basic @@ -0,0 +1,33 @@ +' Ethiopian multiplication +DECLARE FUNCTION Half% (A AS INTEGER) +DECLARE FUNCTION Doub% (A AS INTEGER) +DECLARE FUNCTION IsEven% (A AS INTEGER) + +DIM X AS INTEGER, Y AS INTEGER, OutP AS INTEGER +X = 17 +Y = 34 +DO + PRINT X, + IF NOT (IsEven(X)) THEN + OutP = OutP + Y + PRINT Y + ELSE + PRINT + END IF + IF X < 2 THEN EXIT DO + X = Half(X) + Y = Doub(Y) +LOOP +PRINT " =", OutP + +FUNCTION Doub% (A AS INTEGER) + Doub% = A * 2 +END FUNCTION + +FUNCTION Half% (A AS INTEGER) + Half% = A \ 2 +END FUNCTION + +FUNCTION IsEven% (A AS INTEGER) + IsEven% = (A MOD 2) - 1 +END FUNCTION diff --git a/Task/Ethiopian-multiplication/R/ethiopian-multiplication-2.r b/Task/Ethiopian-multiplication/R/ethiopian-multiplication-2.r index d105b32b1d..5c2f395556 100644 --- a/Task/Ethiopian-multiplication/R/ethiopian-multiplication-2.r +++ b/Task/Ethiopian-multiplication/R/ethiopian-multiplication-2.r @@ -3,13 +3,13 @@ double <- function(a) a*2 iseven <- function(a) (a%%2)==0 ethiopicmult<-function(x,y){ - res<-ifelse(iseven(y),0,x) - while(!y==1){ - x<-double(x) - y<-halve(y) - if(!iseven(y)) res<-res+x - } - return(res) + res<-ifelse(iseven(y),0,x) + while(!y==1){ + x<-double(x) + y<-halve(y) + if(!iseven(y)) res<-res+x + } + return(res) } print(ethiopicmult(17,34)) diff --git a/Task/Ethiopian-multiplication/Raku/ethiopian-multiplication-1.raku b/Task/Ethiopian-multiplication/Raku/ethiopian-multiplication-1.raku index 1fb06da87d..00d9e4165a 100644 --- a/Task/Ethiopian-multiplication/Raku/ethiopian-multiplication-1.raku +++ b/Task/Ethiopian-multiplication/Raku/ethiopian-multiplication-1.raku @@ -5,9 +5,9 @@ sub even (Int $n --> Bool) { $n %% 2 } sub ethiopic-mult (Int $a is copy, Int $b is copy --> Int) { my Int $r = 0; while $a { - even $a or $r += $b; - halve $a; - double $b; + even $a or $r += $b; + halve $a; + double $b; } return $r; } diff --git a/Task/Ethiopian-multiplication/Rascal/ethiopian-multiplication.rascal b/Task/Ethiopian-multiplication/Rascal/ethiopian-multiplication.rascal index 7efe02722d..63ddce167b 100644 --- a/Task/Ethiopian-multiplication/Rascal/ethiopian-multiplication.rascal +++ b/Task/Ethiopian-multiplication/Rascal/ethiopian-multiplication.rascal @@ -7,12 +7,12 @@ public int double(int n) = n*2; public bool uneven(int n) = (n % 2) != 0); public int ethiopianMul(int n, int m) { - result = 0; - while(n >= 1) { - if(uneven(n)) - result += m; - n = halve(n); - m = double(m); - } - return result; + result = 0; + while(n >= 1) { + if(uneven(n)) + result += m; + n = halve(n); + m = double(m); + } + return result; } diff --git a/Task/Ethiopian-multiplication/Rebol/ethiopian-multiplication.rebol b/Task/Ethiopian-multiplication/Rebol/ethiopian-multiplication.rebol new file mode 100644 index 0000000000..6d70881ef7 --- /dev/null +++ b/Task/Ethiopian-multiplication/Rebol/ethiopian-multiplication.rebol @@ -0,0 +1,31 @@ +Rebol [ + title: "Rosetta code: Ethiopian multiplication" + file: %Ethiopian_multiplication.r3 + url: https://rosettacode.org/wiki/Ethiopian_multiplication +] + +halve: function [n][n >> 1] +double: function [n][n << 1] + +ethiopian-multiply: function [ + "Returns the product of two integers using Ethiopian multiplication, with a printed trace" + a [integer!] "The multiplicand (column halved)" + b [integer!] "The multiplier (column doubled)" +][ + result: 0 + while [a <> 0][ + prin pad a -7 + either odd? a [ + result: result + b + print [as-green pad b -5 "(keep)"] + ][ print pad b -5] + a: halve a + b: double b + ] + print "-------------" + print as-yellow pad result -12 + result +] + +; Example: should print the layout shown for input 17 and 34 +ethiopian-multiply 17 34 diff --git a/Task/Ethiopian-multiplication/Rust/ethiopian-multiplication.rust b/Task/Ethiopian-multiplication/Rust/ethiopian-multiplication.rs similarity index 100% rename from Task/Ethiopian-multiplication/Rust/ethiopian-multiplication.rust rename to Task/Ethiopian-multiplication/Rust/ethiopian-multiplication.rs diff --git a/Task/Ethiopian-multiplication/SNOBOL4/ethiopian-multiplication.sno b/Task/Ethiopian-multiplication/SNOBOL4/ethiopian-multiplication.sno index 143f93f2f2..1486374343 100644 --- a/Task/Ethiopian-multiplication/SNOBOL4/ethiopian-multiplication.sno +++ b/Task/Ethiopian-multiplication/SNOBOL4/ethiopian-multiplication.sno @@ -1,21 +1,21 @@ - define('halve(num)') :(halve_end) -halve eq(num,1) :s(freturn) - halve = num / 2 :(return) + define('halve(num)') :(halve_end) +halve eq(num,1) :s(freturn) + halve = num / 2 :(return) halve_end - define('double(num)') :(double_end) -double double = num * 2 :(return) + define('double(num)') :(double_end) +double double = num * 2 :(return) double_end - define('odd(num)') :(odd_end) -odd eq(num,1) :s(return) - eq(num,double(halve(num))) :s(freturn)f(return) + define('odd(num)') :(odd_end) +odd eq(num,1) :s(return) + eq(num,double(halve(num))) :s(freturn)f(return) -odd_end l = trim(input) - r = trim(input) - s = 0 -next s = odd(l) s + r - r = double(r) - l = halve(l) :s(next) -stop output = s +odd_end l = trim(input) + r = trim(input) + s = 0 +next s = odd(l) s + r + r = double(r) + l = halve(l) :s(next) +stop output = s end diff --git a/Task/Ethiopian-multiplication/Scheme/ethiopian-multiplication.ss b/Task/Ethiopian-multiplication/Scheme/ethiopian-multiplication.scm similarity index 100% rename from Task/Ethiopian-multiplication/Scheme/ethiopian-multiplication.ss rename to Task/Ethiopian-multiplication/Scheme/ethiopian-multiplication.scm diff --git a/Task/Ethiopian-multiplication/Smalltalk/ethiopian-multiplication-1.st b/Task/Ethiopian-multiplication/Smalltalk/ethiopian-multiplication-1.st index 2d25a1a5cf..9a607ae2c2 100644 --- a/Task/Ethiopian-multiplication/Smalltalk/ethiopian-multiplication-1.st +++ b/Task/Ethiopian-multiplication/Smalltalk/ethiopian-multiplication-1.st @@ -20,7 +20,7 @@ Number extend [ ifTrue: [ tutor ifTrue: [ ('%1, %2 struck' % { multiplier. multiplicand }) - displayNl + displayNl ] ]. multiplier := multiplier halve. diff --git a/Task/Ethiopian-multiplication/Tcl/ethiopian-multiplication-1.tcl b/Task/Ethiopian-multiplication/Tcl/ethiopian-multiplication-1.tcl index 5f594c4172..873c47d443 100644 --- a/Task/Ethiopian-multiplication/Tcl/ethiopian-multiplication-1.tcl +++ b/Task/Ethiopian-multiplication/Tcl/ethiopian-multiplication-1.tcl @@ -9,22 +9,22 @@ function even n {($n & 1) == 0} function mult {a b} { $a < 1 ? 0 : even($a) ? [logmult STRUCK] + mult(halve($a), double($b)) - : [logmult KEPT] + mult(halve($a), double($b)) + $b + : [logmult KEPT] + mult(halve($a), double($b)) + $b } # Wrapper to set up the logging proc ethiopianMultiply {a b {tutor false}} { if {$tutor} { - set wa [expr {[string length $a]+1}] - set wb [expr {$wa+[string length $b]-1}] - puts stderr "Ethiopian multiplication of $a and $b" - interp alias {} logmult {} apply {{wa wb msg} { - upvar 1 a a b b - puts stderr [format "%*d %*d %s" $wa $a $wb $b $msg] - return 0 - }} $wa $wb + set wa [expr {[string length $a]+1}] + set wb [expr {$wa+[string length $b]-1}] + puts stderr "Ethiopian multiplication of $a and $b" + interp alias {} logmult {} apply {{wa wb msg} { + upvar 1 a a b b + puts stderr [format "%*d %*d %s" $wa $a $wb $b $msg] + return 0 + }} $wa $wb } else { - proc logmult args {return 0} + proc logmult args {return 0} } return [expr {mult($a,$b)}] } diff --git a/Task/Ethiopian-multiplication/True-BASIC/ethiopian-multiplication.basic b/Task/Ethiopian-multiplication/True-BASIC/ethiopian-multiplication.basic index 2e096710f7..938dbf5dca 100644 --- a/Task/Ethiopian-multiplication/True-BASIC/ethiopian-multiplication.basic +++ b/Task/Ethiopian-multiplication/True-BASIC/ethiopian-multiplication.basic @@ -1,29 +1,29 @@ !RosettaCode: Ethiopian Multiplication ! True BASIC v6.007 PROGRAM EthiopianMultiplication - DECLARE DEF FNdouble - DECLARE DEF FNhalve - DECLARE DEF FNeven - - LET x = 17 - LET y = 34 - - DO - IF FNeven(x) = 0 THEN - LET p = p + y - PRINT x,y - ELSE - PRINT x," ---" - END IF - - LET x = FNhalve(x) - LET y = FNdouble(y) - LOOP UNTIL x = 0 - PRINT " ", " ===" - PRINT " ", p - GET KEY done - - DEF FNdouble(A) = A * 2 - DEF FNhalve(A) = INT(A / 2) - DEF FNeven(A) = MOD(A+1,2) + DECLARE DEF FNdouble + DECLARE DEF FNhalve + DECLARE DEF FNeven + + LET x = 17 + LET y = 34 + + DO + IF FNeven(x) = 0 THEN + LET p = p + y + PRINT x,y + ELSE + PRINT x," ---" + END IF + + LET x = FNhalve(x) + LET y = FNdouble(y) + LOOP UNTIL x = 0 + PRINT " ", " ===" + PRINT " ", p + GET KEY done + + DEF FNdouble(A) = A * 2 + DEF FNhalve(A) = INT(A / 2) + DEF FNeven(A) = MOD(A+1,2) END diff --git a/Task/Ethiopian-multiplication/UNIX-Shell/ethiopian-multiplication-1.sh b/Task/Ethiopian-multiplication/UNIX-Shell/ethiopian-multiplication-1.sh index 21f4a8aaaf..f9a0dc4ee0 100644 --- a/Task/Ethiopian-multiplication/UNIX-Shell/ethiopian-multiplication-1.sh +++ b/Task/Ethiopian-multiplication/UNIX-Shell/ethiopian-multiplication-1.sh @@ -19,9 +19,9 @@ ethiopicmult() plicand=$2 r=0 while [ "$plier" -ge 1 ]; do - is_even "$plier" || r=`expr $r + "$plicand"` - plier=`halve "$plier"` - plicand=`double "$plicand"` + is_even "$plier" || r=`expr $r + "$plicand"` + plier=`halve "$plier"` + plicand=`double "$plicand"` done echo $r } diff --git a/Task/Ethiopian-multiplication/Uiua/ethiopian-multiplication.uiua b/Task/Ethiopian-multiplication/Uiua/ethiopian-multiplication.uiua new file mode 100644 index 0000000000..8f809a29aa --- /dev/null +++ b/Task/Ethiopian-multiplication/Uiua/ethiopian-multiplication.uiua @@ -0,0 +1,10 @@ +Halve ← ⌊÷2 +Double ← ×2 +Odd ← ◿2 +EMul ← ◌◌⍢(⊓Halve Double⍥⊙⟜+⊸Odd)±⊙⊙0 + +┌─╴test + ⍤⤙≍ 578 EMul 17 34 + ⍤⤙≍ 0 EMul 17 0 + ⍤⤙≍ 6 EMul 2 3 +└─╴ diff --git a/Task/Ethiopian-multiplication/VBScript/ethiopian-multiplication-1.vb b/Task/Ethiopian-multiplication/VBScript/ethiopian-multiplication-1.vb deleted file mode 100644 index 0746c78f8e..0000000000 --- a/Task/Ethiopian-multiplication/VBScript/ethiopian-multiplication-1.vb +++ /dev/null @@ -1,89 +0,0 @@ -option explicit - -class List - private theList - private nOccupiable - private nTop - - sub class_initialize - nTop = 0 - nOccupiable = 100 - redim theList( nOccupiable ) - end sub - - public sub store( x ) - if nTop >= nOccupiable then - nOccupiable = nOccupiable + 100 - redim preserve theList( nOccupiable ) - end if - theList( nTop ) = x - nTop = nTop + 1 - end sub - - public function recall( n ) - if n >= 0 and n <= nOccupiable then - recall = theList( n ) - else - err.raise vbObjectError + 1000,,"Recall bounds error" - end if - end function - - public sub replace( n, x ) - if n >= 0 and n <= nOccupiable then - theList( n ) = x - else - err.raise vbObjectError + 1001,,"Replace bounds error" - end if - end sub - - public property get listCount - listCount = nTop - end property - -end class - -function halve( n ) - halve = int( n / 2 ) -end function - -function twice( n ) - twice = int( n * 2 ) -end function - -function iseven( n ) - iseven = ( ( n mod 2 ) = 0 ) -end function - - -function multiply( n1, n2 ) - dim LL - set LL = new List - - dim RR - set RR = new List - - LL.store n1 - RR.store n2 - - do while n1 <> 1 - n1 = halve( n1 ) - LL.store n1 - n2 = twice( n2 ) - RR.store n2 - loop - - dim i - for i = 0 to LL.listCount - if iseven( LL.recall( i ) ) then - RR.replace i, 0 - end if - next - - dim total - total = 0 - for i = 0 to RR.listCount - total = total + RR.recall( i ) - next - - multiply = total -end function diff --git a/Task/Ethiopian-multiplication/VBScript/ethiopian-multiplication-1.vbs b/Task/Ethiopian-multiplication/VBScript/ethiopian-multiplication-1.vbs new file mode 100644 index 0000000000..ff896c9b1a --- /dev/null +++ b/Task/Ethiopian-multiplication/VBScript/ethiopian-multiplication-1.vbs @@ -0,0 +1,89 @@ +option explicit + +class List + private theList + private nOccupiable + private nTop + + sub class_initialize + nTop = 0 + nOccupiable = 100 + redim theList( nOccupiable ) + end sub + + public sub store( x ) + if nTop >= nOccupiable then + nOccupiable = nOccupiable + 100 + redim preserve theList( nOccupiable ) + end if + theList( nTop ) = x + nTop = nTop + 1 + end sub + + public function recall( n ) + if n >= 0 and n <= nOccupiable then + recall = theList( n ) + else + err.raise vbObjectError + 1000,,"Recall bounds error" + end if + end function + + public sub replace( n, x ) + if n >= 0 and n <= nOccupiable then + theList( n ) = x + else + err.raise vbObjectError + 1001,,"Replace bounds error" + end if + end sub + + public property get listCount + listCount = nTop + end property + +end class + +function halve( n ) + halve = int( n / 2 ) +end function + +function twice( n ) + twice = int( n * 2 ) +end function + +function iseven( n ) + iseven = ( ( n mod 2 ) = 0 ) +end function + + +function multiply( n1, n2 ) + dim LL + set LL = new List + + dim RR + set RR = new List + + LL.store n1 + RR.store n2 + + do while n1 <> 1 + n1 = halve( n1 ) + LL.store n1 + n2 = twice( n2 ) + RR.store n2 + loop + + dim i + for i = 0 to LL.listCount + if iseven( LL.recall( i ) ) then + RR.replace i, 0 + end if + next + + dim total + total = 0 + for i = 0 to RR.listCount + total = total + RR.recall( i ) + next + + multiply = total +end function diff --git a/Task/Ethiopian-multiplication/VBScript/ethiopian-multiplication-2.vb b/Task/Ethiopian-multiplication/VBScript/ethiopian-multiplication-2.vbs similarity index 100% rename from Task/Ethiopian-multiplication/VBScript/ethiopian-multiplication-2.vb rename to Task/Ethiopian-multiplication/VBScript/ethiopian-multiplication-2.vbs diff --git a/Task/Ethiopian-multiplication/X86-Assembly/ethiopian-multiplication-1.x86 b/Task/Ethiopian-multiplication/X86-Assembly/ethiopian-multiplication-1.x86 index 3d078eced9..ff6e3762ae 100644 --- a/Task/Ethiopian-multiplication/X86-Assembly/ethiopian-multiplication-1.x86 +++ b/Task/Ethiopian-multiplication/X86-Assembly/ethiopian-multiplication-1.x86 @@ -1,109 +1,109 @@ - extern printf - global main + extern printf + global main - section .text + section .text halve - shr ebx, 1 - ret + shr ebx, 1 + ret double - shl ebx, 1 - ret + shl ebx, 1 + ret iseven - and ebx, 1 - cmp ebx, 0 - ret ; ret preserves flags + and ebx, 1 + cmp ebx, 0 + ret ; ret preserves flags main - push 1 ; tutor = true - push 34 ; 2nd operand - push 17 ; 1st operand - call ethiopicmult - add esp, 12 + push 1 ; tutor = true + push 34 ; 2nd operand + push 17 ; 1st operand + call ethiopicmult + add esp, 12 - push eax ; result of 17*34 - push fmt - call printf - add esp, 8 + push eax ; result of 17*34 + push fmt + call printf + add esp, 8 - ret + ret %define plier 8 %define plicand 12 %define tutor 16 - + ethiopicmult - enter 0, 0 - cmp dword [ebp + tutor], 0 - je .notut0 - push dword [ebp + plicand] - push dword [ebp + plier] - push preamblefmt - call printf - add esp, 12 + enter 0, 0 + cmp dword [ebp + tutor], 0 + je .notut0 + push dword [ebp + plicand] + push dword [ebp + plier] + push preamblefmt + call printf + add esp, 12 .notut0 - xor eax, eax ; eax -> result - mov ecx, [ebp + plier] ; ecx -> plier - mov edx, [ebp + plicand] ; edx -> plicand + xor eax, eax ; eax -> result + mov ecx, [ebp + plier] ; ecx -> plier + mov edx, [ebp + plicand] ; edx -> plicand .whileloop - cmp ecx, 1 - jl .multend - cmp dword [ebp + tutor], 0 - je .notut1 - call tutorme + cmp ecx, 1 + jl .multend + cmp dword [ebp + tutor], 0 + je .notut1 + call tutorme .notut1 - mov ebx, ecx - call iseven - je .iseven - add eax, edx ; result += plicand + mov ebx, ecx + call iseven + je .iseven + add eax, edx ; result += plicand .iseven - mov ebx, ecx ; plier >>= 1 - call halve - mov ecx, ebx + mov ebx, ecx ; plier >>= 1 + call halve + mov ecx, ebx - mov ebx, edx ; plicand <<= 1 - call double - mov edx, ebx - - jmp .whileloop + mov ebx, edx ; plicand <<= 1 + call double + mov edx, ebx + + jmp .whileloop .multend - leave - ret + leave + ret tutorme - push eax - push strucktxt - mov ebx, ecx - call iseven - je .nostruck - mov dword [esp], kepttxt + push eax + push strucktxt + mov ebx, ecx + call iseven + je .nostruck + mov dword [esp], kepttxt .nostruck - push edx - push ecx - push tutorfmt - call printf - add esp, 4 - pop ecx - pop edx - add esp, 4 - pop eax - ret + push edx + push ecx + push tutorfmt + call printf + add esp, 4 + pop ecx + pop edx + add esp, 4 + pop eax + ret - section .data + section .data fmt - db "%d", 10, 0 + db "%d", 10, 0 preamblefmt - db "ethiopic multiplication of %d and %d", 10, 0 + db "ethiopic multiplication of %d and %d", 10, 0 tutorfmt - db "%4d %6d %s", 10, 0 + db "%4d %6d %s", 10, 0 strucktxt - db "struck", 0 + db "struck", 0 kepttxt - db "kept", 0 + db "kept", 0 diff --git a/Task/Ethiopian-multiplication/Yabasic/ethiopian-multiplication.basic b/Task/Ethiopian-multiplication/Yabasic/ethiopian-multiplication.basic index 38ab4861d9..345137d134 100644 --- a/Task/Ethiopian-multiplication/Yabasic/ethiopian-multiplication.basic +++ b/Task/Ethiopian-multiplication/Yabasic/ethiopian-multiplication.basic @@ -3,28 +3,28 @@ x = 17 y = 34 do - print x, chr$(09); - if not (isEven(x)) then - outP = outP + y - print y - else - print - fi - if x < 2 break - x = half(x) - y = doub(y) + print x, chr$(09); + if not (isEven(x)) then + outP = outP + y + print y + else + print + fi + if x < 2 break + x = half(x) + y = doub(y) loop print "=", chr$(09), outP end sub doub (a) - return a * 2 + return a * 2 end sub sub half (a) - return int(a / 2) + return int(a / 2) end sub sub isEven (a) - return mod(a, 2) - 1 + return mod(a, 2) - 1 end sub diff --git a/Task/Ethiopian-multiplication/Z80-Assembly/ethiopian-multiplication.z80 b/Task/Ethiopian-multiplication/Z80-Assembly/ethiopian-multiplication.z80 index cbc6ebf0a0..5641a4f8c2 100644 --- a/Task/Ethiopian-multiplication/Z80-Assembly/ethiopian-multiplication.z80 +++ b/Task/Ethiopian-multiplication/Z80-Assembly/ethiopian-multiplication.z80 @@ -1,114 +1,114 @@ - org &8000 + org &8000 - ld hl,17 - call Halve_Until_1 - - push bc - ld hl,34 - call Double_Until_1 - pop bc - - call SumOddEntries - ;returns Ethiopian product in IX. - - call NewLine - - call Primm - byte "0x",0 - - push ix - pop hl - - ld a,H - call ShowHex - ;Output should be in decimal but hex is easier. - ld a,L - call ShowHex - - ret + ld hl,17 + call Halve_Until_1 + + push bc + ld hl,34 + call Double_Until_1 + pop bc + + call SumOddEntries + ;returns Ethiopian product in IX. + + call NewLine + + call Primm + byte "0x",0 + + push ix + pop hl + + ld a,H + call ShowHex + ;Output should be in decimal but hex is easier. + ld a,L + call ShowHex + + ret Halve_Until_1: - ;input: HL = number you wish to halve. HL is unsigned. - ld de,Column_1 - ld a,1 - ld (Column_1),HL - inc de - inc de + ;input: HL = number you wish to halve. HL is unsigned. + ld de,Column_1 + ld a,1 + ld (Column_1),HL + inc de + inc de loop_HalveUntil_1: - SRL H - RR L - inc b - push af - ld a,L - ld (de),a - inc de - ld a,H - ld (de),a - inc de - pop af - CP L - jr nz,loop_HalveUntil_1 - ;b tracks how many times to double the second factor. - ret - + SRL H + RR L + inc b + push af + ld a,L + ld (de),a + inc de + ld a,H + ld (de),a + inc de + pop af + CP L + jr nz,loop_HalveUntil_1 + ;b tracks how many times to double the second factor. + ret + Double_Until_1: - ;doubles second factor B times. B is calculated by Halve_until_1 - ld de,Column_2 - ld (Column_2),HL - inc de - inc de + ;doubles second factor B times. B is calculated by Halve_until_1 + ld de,Column_2 + ld (Column_2),HL + inc de + inc de loop_double_until_1: - SLA L - RL H - PUSH AF - LD A,L - LD (DE),A - INC DE - LD A,H - LD (DE),A - INC DE - POP AF - DJNZ loop_double_until_1 - ret + SLA L + RL H + PUSH AF + LD A,L + LD (DE),A + INC DE + LD A,H + LD (DE),A + INC DE + POP AF + DJNZ loop_double_until_1 + ret + - SumOddEntries: - sla b ;double loop counter, this is also the offset to the "last" entry of - ;each table - ld h,>Column_1 - ld d,>Column_2 ;aligning the tables lets us get away with this. - ld l,b - ld e,b - ld ix,0 + sla b ;double loop counter, this is also the offset to the "last" entry of + ;each table + ld h,>Column_1 + ld d,>Column_2 ;aligning the tables lets us get away with this. + ld l,b + ld e,b + ld ix,0 loop: - ld a,(hl) - rrca ;we only need the result of the odd/even test. - jr nc,skipEven - push hl - push de - ld a,(de) - ld L,a - inc de - ld a,(de) - ld H,a - ex de,hl - add ix,de - pop de - pop hl + ld a,(hl) + rrca ;we only need the result of the odd/even test. + jr nc,skipEven + push hl + push de + ld a,(de) + ld L,a + inc de + ld a,(de) + ld H,a + ex de,hl + add ix,de + pop de + pop hl skipEven: - dec de - dec de - dec hl - dec hl - djnz loop - ret ;ix should contain the answer + dec de + dec de + dec hl + dec hl + djnz loop + ret ;ix should contain the answer - - align 8 ;aligns Column_1 to the nearest 256 byte boundary. This makes offsetting easier. + + align 8 ;aligns Column_1 to the nearest 256 byte boundary. This makes offsetting easier. Column_1: - ds 16,0 - - align 8 ;aligns Column_2 to the nearest 256 byte boundary. This makes offsetting easier. + ds 16,0 + + align 8 ;aligns Column_2 to the nearest 256 byte boundary. This makes offsetting easier. Column_2: - ds 16,0 + ds 16,0 diff --git a/Task/Euclid-Mullin-sequence/C++/euclid-mullin-sequence.cpp b/Task/Euclid-Mullin-sequence/C++/euclid-mullin-sequence.cpp new file mode 100644 index 0000000000..11e98dc402 --- /dev/null +++ b/Task/Euclid-Mullin-sequence/C++/euclid-mullin-sequence.cpp @@ -0,0 +1,30 @@ +#include +#include + +uint64_t product = 2; + +uint64_t smallest_prime_factor(const uint64_t& number) { + if ( number % 3 == 0 ) { return 3; } + if ( number % 5 == 0 ) { return 5; } + + for ( uint64_t divisor = 7; divisor * divisor <= number; divisor += 2 ) { + if ( number % divisor == 0 ) { return divisor; } + } + + return number; +} + +uint64_t next_euclid_mullin() { + const uint64_t smallest_prime = smallest_prime_factor(product + 1); + product *= smallest_prime; + return smallest_prime; +} + +int main() { + std::cout << "The first 9 terms of the Euclid-Mullin sequence:" << "\n"; + std::cout << 2 << " "; + for ( uint32_t i = 1; i < 9; ++i ) { + std::cout << next_euclid_mullin() << " "; + } + std::cout << "\n"; +} diff --git a/Task/Euclid-Mullin-sequence/EasyLang/euclid-mullin-sequence.easy b/Task/Euclid-Mullin-sequence/EasyLang/euclid-mullin-sequence.easy new file mode 100644 index 0000000000..0bbed926a2 --- /dev/null +++ b/Task/Euclid-Mullin-sequence/EasyLang/euclid-mullin-sequence.easy @@ -0,0 +1,17 @@ +arr[] = [ 2 ] +fastproc . + for i = 2 to 8 + k = 3 + repeat + em = 1 + for j = 1 to i - 1 + em = em * arr[j] mod k + . + em = (em + 1) mod k + until em = 0 + k += 2 + . + arr[] &= k + . +. +print arr[] diff --git a/Task/Euclid-Mullin-sequence/Fennel/euclid-mullin-sequence.fennel b/Task/Euclid-Mullin-sequence/Fennel/euclid-mullin-sequence.fennel new file mode 100644 index 0000000000..5f18e0534c --- /dev/null +++ b/Task/Euclid-Mullin-sequence/Fennel/euclid-mullin-sequence.fennel @@ -0,0 +1,18 @@ +(do ;;; find elements of the Euclid-Mullin sequence: starting from 2, + ;;; the next element is the smallest prime factor of 1 + the product + ;;; of the previous elements + + (io.write "2") + (var product 2) + (for [i 2 9] + (var (nextV p found) (values (+ product 1) 3 false)) + ; find the first prime factor of nextV + (while (and (<= (* p p) nextV) (not found)) + (set found (= 0 (% nextV p))) + (when (not found) (set p (+ p 2))) + ) + (when found (set nextV p)) + (io.write (.. " " nextV)) + (set product (* product nextV)) + ) +) diff --git a/Task/Euclid-Mullin-sequence/FutureBasic/euclid-mullin-sequence.basic b/Task/Euclid-Mullin-sequence/FutureBasic/euclid-mullin-sequence.basic new file mode 100644 index 0000000000..f6c83a34f6 --- /dev/null +++ b/Task/Euclid-Mullin-sequence/FutureBasic/euclid-mullin-sequence.basic @@ -0,0 +1,57 @@ +// +// Euclid-Mullin Sequence +// Using FutureBasic 7.0.35 +// +// September 2025, R.W. +// + +include "gmp.incl" + +_TERMS = 16 // first 16 Euclid–Mullin Sequence + +// Return a non-trivial factor of n using Pollard-Rho + +void local fn PollardRho( n as mpz_t, out as mpz_t ) + mpz_t x,y,c,d,absDiff + mpz_inits( x, y, c, d, absDiff, 0 ) + mpz_set_ui( x, 2 ) : mpz_set_ui( y, 2 ) : mpz_set_ui( c, 1 ) + mpz_set_ui( d, 1 ) + while fn mpz_cmp_ui( d, 1 ) == 0 + // x = (x*x + c) mod n + mpz_mul( x, x, x ) : mpz_add( x, x, c ) : mpz_mod( x, x, n ) + // y = f(f(y)) + mpz_mul( y, y, y ) : mpz_add( y, y, c ) : mpz_mod( y, y, n ) + mpz_mul( y, y, y ) : mpz_add( y, y, c ) : mpz_mod( y, y, n ) + // d = gcd(|x-y|, n) + mpz_sub( absDiff, x, y ) : mpz_abs( absDiff, absDiff ) + fn mpz_gcd( d, absDiff, n ) + wend + mpz_set( out, d ) + mpz_clears( x,y,c,d,absDiff,0 ) +end fn + +void local fn EuclidMullin( terms as long ) + CFStringRef result + mpz_t total, tmp, factor + mpz_inits( total, tmp, factor, 0 ) + mpz_set_ui( total, 1 ) + print @ + print @"First ";terms;" numbers of Euclid-Mullin sequence" + print @ + long k + for k = 1 to _TERMS + mpz_add_ui( tmp, total, 1 ) // tmp = total + 1 + fn PollardRho( tmp, factor ) // factor = some factor of tmp + result = fn mpz_cf2( factor ) + print result + mpz_mul( total, total, factor ) // total *= factor + next + + mpz_clears( total, tmp, factor, 0 ) +end fn + +window 1, @"Euclid-Mullin Sequence" + +fn EuclidMullin(_TERMS ) + +handleEvents diff --git a/Task/Euclid-Mullin-sequence/Java/euclid-mullin-sequence.java b/Task/Euclid-Mullin-sequence/Java/euclid-mullin-sequence.java index 0acc583224..6c4836716f 100644 --- a/Task/Euclid-Mullin-sequence/Java/euclid-mullin-sequence.java +++ b/Task/Euclid-Mullin-sequence/Java/euclid-mullin-sequence.java @@ -12,7 +12,8 @@ public final class EuclidMullinSequence { System.out.println("The first 27 terms of the Euclid-Mullin sequence:"); System.out.print(2 + " "); for ( int i = 1; i < 27; i++ ) { - System.out.print(String.format("%s%s", nextEuclidMullin(), ( i == 14 || i == 27 ) ? "\n" : " ")); + System.out.print( + String.format("%s%s", nextEuclidMullin(), ( i == 14 || i == 27 ) ? "\n" : " ")); } } @@ -67,7 +68,7 @@ public final class EuclidMullinSequence { sieve.set(2, aLimit + 1); for ( int i = 2; i * i <= aLimit; i = sieve.nextSetBit(i + 1) ) { - for ( int j = i * i; j <= aLimit; j = j + i ) { + for ( int j = i * i; j <= aLimit; j += i ) { sieve.clear(j); } } diff --git a/Task/Euclid-Mullin-sequence/JavaScript/euclid-mullin-sequence.js b/Task/Euclid-Mullin-sequence/JavaScript/euclid-mullin-sequence.js new file mode 100644 index 0000000000..05dfefc61c --- /dev/null +++ b/Task/Euclid-Mullin-sequence/JavaScript/euclid-mullin-sequence.js @@ -0,0 +1,20 @@ + let product = 2n; + function smallestPrimeFactor(number) { + if (number % 3n === 0n) { return 3n; } + if (number % 5n === 0n) { return 5n; } + for (let divisor = 7n; divisor * divisor <= number; divisor += 2n) { + if (number % divisor === 0n) { return divisor; } + } + return number; + } + function nextEuclidMullin() { + const smallestPrime = smallestPrimeFactor(product + 1n); + product *= smallestPrime; + return smallestPrime; + } + console.log("The first 9 terms of the Euclid-Mullin sequence:"); + process.stdout.write(2 + " "); + for (let i = 1; i < 9; ++i) { + process.stdout.write(nextEuclidMullin() + " "); + } + console.log("\n"); diff --git a/Task/Euclid-Mullin-sequence/Julia/euclid-mullin-sequence.julia b/Task/Euclid-Mullin-sequence/Julia/euclid-mullin-sequence.jl similarity index 100% rename from Task/Euclid-Mullin-sequence/Julia/euclid-mullin-sequence.julia rename to Task/Euclid-Mullin-sequence/Julia/euclid-mullin-sequence.jl diff --git a/Task/Euclid-Mullin-sequence/Lua/euclid-mullin-sequence-1.lua b/Task/Euclid-Mullin-sequence/Lua/euclid-mullin-sequence-1.lua index 6213d7fddf..d8ed7d4919 100644 --- a/Task/Euclid-Mullin-sequence/Lua/euclid-mullin-sequence-1.lua +++ b/Task/Euclid-Mullin-sequence/Lua/euclid-mullin-sequence-1.lua @@ -4,11 +4,9 @@ do io.write( "2" ) local product = 2 - for i = 2, 8 do - local nextV = product + 1 + for i = 2, 9 do + local nextV, p, found = product + 1, 3, false -- find the first prime factor of nextV - local p = 3 - local found = false while p * p <= nextV and not found do found = nextV % p == 0 if not found then p = p + 2 end diff --git a/Task/Euclid-Mullin-sequence/Oberon-07/euclid-mullin-sequence.oberon b/Task/Euclid-Mullin-sequence/Oberon-07/euclid-mullin-sequence.oberon new file mode 100644 index 0000000000..178ae1c826 --- /dev/null +++ b/Task/Euclid-Mullin-sequence/Oberon-07/euclid-mullin-sequence.oberon @@ -0,0 +1,29 @@ +MODULE EuclidMullinSequence; (* find elements of the Euclid-Mullin sequence: *) + IMPORT Out; (* starting from 2, the next element is the smallest *) + (* prime factor of 1 + the product of the previous *) + (* elements *) + + (* assuming INTEGER is 32-bit, we should be able to *) + (* find 8 elements, before the product overflows *) + + VAR product, i, nextV, p : INTEGER; + found : BOOLEAN; + +BEGIN + + Out.String( "2" ); + product := 2; + FOR i := 2 TO 8 DO + nextV := product + 1; + (* find the first prime factor of nextV *) + p := 3; + found := FALSE; + WHILE ~ found & ( p * p <= nextV ) DO + found := nextV MOD p = 0; + IF ~ found THEN INC( p, 2 ) END + END; + IF found THEN nextV := p END; + Out.String( " " );Out.Int( nextV, 0 ); + product := product * nextV + END +END EuclidMullinSequence. diff --git a/Task/Euclid-Mullin-sequence/Oberon/euclid-mullin-sequence.oberon b/Task/Euclid-Mullin-sequence/Oberon/euclid-mullin-sequence.oberon new file mode 100644 index 0000000000..b735a6b4c2 --- /dev/null +++ b/Task/Euclid-Mullin-sequence/Oberon/euclid-mullin-sequence.oberon @@ -0,0 +1,29 @@ +MODULE EuclidMullinSequence; (* find elements of the Euclid-Mullin sequence: *) + IMPORT Out; (* starting from 2, the next element is the smallest *) + (* prime factor of 1 + the product of the previous *) + (* elements *) + + (* assuming LONGINT is 64-bit, we should be able to *) + (* find 9 elements, before the product overflows *) + + VAR product, i, nextV, p : LONGINT; + found : BOOLEAN; + +BEGIN + + Out.String( "2" ); + product := 2; + FOR i := 2 TO 9 DO + nextV := product + 1; + (* find the first prime factor of nextV *) + p := 3; + found := FALSE; + WHILE ~ found & ( p * p <= nextV ) DO + found := nextV MOD p = 0; + IF ~ found THEN INC( p, 2 ) END + END; + IF found THEN nextV := p END; + Out.String( " " );Out.Int( nextV, 0 ); + product := product * nextV + END +END EuclidMullinSequence. diff --git a/Task/Euclid-Mullin-sequence/PascalABC.NET/euclid-mullin-sequence.pas b/Task/Euclid-Mullin-sequence/PascalABC.NET/euclid-mullin-sequence.pas new file mode 100644 index 0000000000..38999023a9 --- /dev/null +++ b/Task/Euclid-Mullin-sequence/PascalABC.NET/euclid-mullin-sequence.pas @@ -0,0 +1,29 @@ +function smallest_prime_factor(number: biginteger): biginteger; +begin + var divisor := 3bi; + repeat + if (number mod divisor) = 0 then + begin + result := divisor; + exit + end; + divisor += 2; + until divisor * divisor > number; + result := number; +end; + +function euclid_mullin(): sequence of biginteger; +begin + var product := 2bi; + yield product; + while true do + begin + var smallest_prime := smallest_prime_factor(product + 1); + product *= smallest_prime; + yield smallest_prime; + end; +end; + +begin + euclid_mullin.take(16).println; +end. diff --git a/Task/Euclid-Mullin-sequence/Pluto/euclid-mullin-sequence.pluto b/Task/Euclid-Mullin-sequence/Pluto/euclid-mullin-sequence.pluto new file mode 100644 index 0000000000..9e6b45651e --- /dev/null +++ b/Task/Euclid-Mullin-sequence/Pluto/euclid-mullin-sequence.pluto @@ -0,0 +1,22 @@ +-- find elements of the Euclid-Mullin sequence: starting from 2, +-- the next element is the smallest prime factor of 1 + the product +-- of the previous elements +do + local bigint = require( "pluto:bigint" ) -- use the standard bigint library + + io.write( "2" ) + local b0 , b1 , b2 , b3 + = new bigint( 0 ), new bigint( 1 ), new bigint( 2 ), new bigint( 3 ) + local product = new bigint( 2 ) + for _ = 2, 16 do + local nextV, p, found = product + b1, b3, false + -- find the first prime factor of nextV + while p * p <= nextV and not found do + found = nextV % p == b0 + if not found then p += b2 end + end + if found then nextV = p end + io.write( $" { nextV:tostring() }" ) + product *= nextV + end +end diff --git a/Task/Euclid-Mullin-sequence/R/euclid-mullin-sequence.r b/Task/Euclid-Mullin-sequence/R/euclid-mullin-sequence.r new file mode 100644 index 0000000000..d81fa0cb94 --- /dev/null +++ b/Task/Euclid-Mullin-sequence/R/euclid-mullin-sequence.r @@ -0,0 +1,10 @@ +library(gmp) + +next_term <- function(v) min(factorize(prod(v)+1)) +euclid_mullin <- function(n){ + v <- as.bigz(2) + replicate(n-1, v <<- c(v, next_term(v))) + print(v, initLine=FALSE) +} + +euclid_mullin(16) diff --git a/Task/Euclid-Mullin-sequence/REXX/euclid-mullin-sequence.rexx b/Task/Euclid-Mullin-sequence/REXX/euclid-mullin-sequence.rexx new file mode 100644 index 0000000000..c681066ff1 --- /dev/null +++ b/Task/Euclid-Mullin-sequence/REXX/euclid-mullin-sequence.rexx @@ -0,0 +1,22 @@ +-- 23 Aug 2025 +include Setting + +say 'EUCLID-MULLIN SEQUENCE' +say version +say +numeric digits 100 +call Euclids 16 +call Task 16 +say Format(Time('e'),,3) 'seconds' +exit + +Task: +arg xx +say 'The first' xx 'Euclid-Mullin numbers are:' +do i = 1 to xx + call Charout ,eucl.i' ' +end +say +return + +include Math diff --git a/Task/Euclid-Mullin-sequence/SETL/euclid-mullin-sequence.setl b/Task/Euclid-Mullin-sequence/SETL/euclid-mullin-sequence.setl new file mode 100644 index 0000000000..41731276ee --- /dev/null +++ b/Task/Euclid-Mullin-sequence/SETL/euclid-mullin-sequence.setl @@ -0,0 +1,19 @@ +program euclid_mullin; + print(2); + product := 2; + loop for i in [2..16] do + next := smallest_factor(product + 1); + product *:= next; + print(next); + end loop; + + op smallest_factor(n); + if even n then return 2; end if; + d := 3; + loop while d*d <= n do + if n mod d=0 then return d; end if; + d +:= 2; + end loop; + return n; + end op; +end program; diff --git a/Task/Euclid-Mullin-sequence/Wren/euclid-mullin-sequence-2.wren b/Task/Euclid-Mullin-sequence/Wren/euclid-mullin-sequence-2.wren index 3723ba66fe..b0d73b9fa1 100644 --- a/Task/Euclid-Mullin-sequence/Wren/euclid-mullin-sequence-2.wren +++ b/Task/Euclid-Mullin-sequence/Wren/euclid-mullin-sequence-2.wren @@ -1,4 +1,4 @@ -/* euclid_mullin_gmp.wren */ +/* Euclid_mullin_sequence_2.wren */ import "./gmp" for Mpz diff --git a/Task/Euler-method/Ada/euler-method-1.ada b/Task/Euler-method/Ada/euler-method-1.adb similarity index 100% rename from Task/Euler-method/Ada/euler-method-1.ada rename to Task/Euler-method/Ada/euler-method-1.adb diff --git a/Task/Euler-method/Ada/euler-method-2.ada b/Task/Euler-method/Ada/euler-method-2.adb similarity index 100% rename from Task/Euler-method/Ada/euler-method-2.ada rename to Task/Euler-method/Ada/euler-method-2.adb diff --git a/Task/Euler-method/Ada/euler-method-3.ada b/Task/Euler-method/Ada/euler-method-3.adb similarity index 100% rename from Task/Euler-method/Ada/euler-method-3.ada rename to Task/Euler-method/Ada/euler-method-3.adb diff --git a/Task/Euler-method/Applesoft-BASIC/euler-method.basic b/Task/Euler-method/Applesoft-BASIC/euler-method.basic new file mode 100644 index 0000000000..5bb3f0bab6 --- /dev/null +++ b/Task/Euler-method/Applesoft-BASIC/euler-method.basic @@ -0,0 +1,27 @@ +100 HOME +110 PRINT "Time "; +120 FOR S = 0 TO 100.1 STEP 10 +130 PRINT S; " "; +140 NEXT S +150 PRINT +160 PRINT "Dif eq "; +170 FOR S = 0 TO 100.1 STEP 10 +180 LET T = 20+(100-20)*EXP(-.07*S) +190 PRINT LEFT$(STR$(T),5); " "; +200 NEXT S +210 PRINT +220 LET P = 2 : GOSUB 260 +230 LET P = 5 : GOSUB 260 +240 LET P = 10 : GOSUB 260 +250 END +260 REM Euler(paso) +270 LET S = 0 +280 LET T = 100 +290 PRINT "Step ";P; " "; +300 FOR S = 0 TO 100 STEP P +310 IF S - (S/10) * 10 = 0 THEN PRINT LEFT$(STR$(T),5); " "; +320 LET T = T+(P)*(-.07*(T-20)) +330 IF S > 100 THEN GOTO 350 +340 NEXT S +350 PRINT +360 RETURN diff --git a/Task/Euler-method/BASIC256/euler-method.basic b/Task/Euler-method/BASIC256/euler-method.basic new file mode 100644 index 0000000000..54074d0bd6 --- /dev/null +++ b/Task/Euler-method/BASIC256/euler-method.basic @@ -0,0 +1,34 @@ +print "Time "; +tiempo = 0.0 +while tiempo <= 100.1 + print rjust(string(tiempo), 5); " "; + tiempo += 10.0 +end while +print + +print "Dif eq "; +tiempo = 0.0 +while tiempo <= 100.1 + temperatura = 20.0 + (100.0-20.0) * exp(-0.07*tiempo) + print rjust(left(string(temperatura), 5), 5); " "; + tiempo += 10.0 +end while +print + +call Euler(2) +call Euler(5) +call Euler(10) +end + +subroutine Euler(paso) + tiempo = 0 + temperatura = 100.0 + print "Step "; rjust(string(paso), 2); " "; + + while tiempo <= 100 + if (tiempo mod 10) = 0 then print rjust(left(string(temperatura), 5), 5); " "; + temperatura += float(paso) * (-0.07*(temperatura-20.0)) + tiempo += paso + end while + print +end subroutine diff --git a/Task/Euler-method/C-sharp/euler-method.cs b/Task/Euler-method/C-sharp/euler-method.cs index 9b7d1f041f..0491640ac8 100644 --- a/Task/Euler-method/C-sharp/euler-method.cs +++ b/Task/Euler-method/C-sharp/euler-method.cs @@ -2,37 +2,37 @@ using System; namespace prog { - class MainClass - { - const float T0 = 100f; - const float TR = 20f; - const float k = 0.07f; - readonly static float[] delta_t = {2.0f,5.0f,10.0f}; - const int n = 100; - - public delegate float func(float t); - static float NewtonCooling(float t) - { - return -k * (t-TR); - } - - public static void Main (string[] args) - { - func f = new func(NewtonCooling); - for(int i=0; i x2 and x_start > x2) + ) + from cte +); + +create or replace function euler(x_start, y_start, x2, h) as ( + select last(y order by x) from euler_method(x_start, y_start, x2, h) +); + +## Example: +create or replace function cooling(x,y) as + -0.07 * (y - 20); + +select h, euler(0,100, 100, h) from unnest([1,2,5,10,20]) _(h); diff --git a/Task/Euler-method/EasyLang/euler-method.easy b/Task/Euler-method/EasyLang/euler-method.easy new file mode 100644 index 0000000000..db168de994 --- /dev/null +++ b/Task/Euler-method/EasyLang/euler-method.easy @@ -0,0 +1,38 @@ +TR = 20 +K = -0.07 +ytxt = 95 +drawgrid +glinewidth 0.3 +gtextsize 3 +# +func newton_cooling temp . + return K * (temp - TR) +. +proc draw_euler y t t2 step col . + gcolor col + gtext 80 ytxt "step: " & step + ytxt -= 5 + gpenup + while t <= t2 + glineto t y + t += step + y += step * newton_cooling y + . +. +func analytic T0 t . + return TR + (T0 - TR) * pow 2.71828 (K * t) +. +proc draw_analytic a b . + gcolor 009 + gtext 80 ytxt "analytic" + ytxt -= 5 + gpenup + for t = a to b + y = analytic 100 t + glineto t y + . +. +draw_euler 100 0 100 10 900 +draw_euler 100 0 100 5 555 +draw_euler 100 0 100 2 090 +draw_analytic 0 100 diff --git a/Task/Euler-method/Elixir/euler-method.elixir b/Task/Euler-method/Elixir/euler-method.ex similarity index 100% rename from Task/Euler-method/Elixir/euler-method.elixir rename to Task/Euler-method/Elixir/euler-method.ex diff --git a/Task/Euler-method/Erlang/euler-method.erl b/Task/Euler-method/Erlang/euler-method.erl index 4f1549d0c4..4bf8857e9e 100644 --- a/Task/Euler-method/Erlang/euler-method.erl +++ b/Task/Euler-method/Erlang/euler-method.erl @@ -2,37 +2,37 @@ -export([main/0, euler/5]). cooling(_Time, Temperature) -> - (-0.07)*(Temperature-20). + (-0.07)*(Temperature-20). euler(_, Y, T, _, End) when End == T -> - io:fwrite("\n"), - Y; + io:fwrite("\n"), + Y; euler(Func, Y, T, Step, End) -> - if - T rem 10 == 0 -> - io:fwrite("~.3f ",[float(Y)]); - true -> - ok - end, - euler(Func, Y + Step * Func(T, Y), T + Step, Step, End). + if + T rem 10 == 0 -> + io:fwrite("~.3f ",[float(Y)]); + true -> + ok + end, + euler(Func, Y + Step * Func(T, Y), T + Step, Step, End). analytic(T, End) when T == End -> - io:fwrite("\n"), - T; + io:fwrite("\n"), + T; analytic(T, End) -> - Y = (20 + 80 * math:exp(-0.07 * T)), - io:fwrite("~.3f ", [Y]), - analytic(T+10, End). + Y = (20 + 80 * math:exp(-0.07 * T)), + io:fwrite("~.3f ", [Y]), + analytic(T+10, End). main() -> - io:fwrite("Analytic:\n"), - analytic(0, 100), - io:fwrite("Step 2:\n"), - euler(fun cooling/2, 100, 0, 2, 100), - io:fwrite("Step 5:\n"), - euler(fun cooling/2, 100, 0, 5, 100), - io:fwrite("Step 10:\n"), - euler(fun cooling/2, 100, 0, 10, 100), - ok. + io:fwrite("Analytic:\n"), + analytic(0, 100), + io:fwrite("Step 2:\n"), + euler(fun cooling/2, 100, 0, 2, 100), + io:fwrite("Step 5:\n"), + euler(fun cooling/2, 100, 0, 5, 100), + io:fwrite("Step 10:\n"), + euler(fun cooling/2, 100, 0, 10, 100), + ok. diff --git a/Task/Euler-method/FutureBasic/euler-method.basic b/Task/Euler-method/FutureBasic/euler-method.basic new file mode 100644 index 0000000000..dfb5d86659 --- /dev/null +++ b/Task/Euler-method/FutureBasic/euler-method.basic @@ -0,0 +1,33 @@ +include "NSLog.incl" + +double local fn Cooling( t as double, temp as double ) + return -0.07 * (temp - 20 ) +end fn = 0.0 + +void local fn Euler( y as double, stepSize as int, endTime as double ) + int t = 0 + NSLog( @"\n Step %2d: \b", stepSize ) + while ( t <= endTime ) + if ( t % 10 == 0 ) then NSLog( @" %7.3f \b", y ) + y += stepSize * fn Cooling( t, y ) + t += stepSize + wend +end fn + +void local fn Analytic + NSLog( @" Time: \b" ) + for int t1 = 0 to 100 step 10 + NSLog( @" %8d\b", t1 ) + next + NSLog( @"\nAnalytic: \b" ) + for int t2 = 0 to 100 step 10 + NSLog( @"%9.3f\b", 20 + 80 * exp(-0.07 * t2 ) ) + next +end fn + +fn Analytic +fn Euler( 100.0, 2.0, 100.0 ) +fn Euler( 100.0, 5.0, 100.0 ) +fn Euler( 100.0, 10.0, 100.0 ) + +HandleEvents diff --git a/Task/Euler-method/GW-BASIC/euler-method.basic b/Task/Euler-method/GW-BASIC/euler-method.basic new file mode 100644 index 0000000000..c047ea310a --- /dev/null +++ b/Task/Euler-method/GW-BASIC/euler-method.basic @@ -0,0 +1,27 @@ +100 CLS +110 PRINT "Time "; +120 FOR TIEMPO = 0 TO 100.1 STEP 10 +130 PRINT USING " ###";TIEMPO; +140 NEXT TIEMPO +150 PRINT +160 PRINT "Dif eq "; +170 FOR TIEMPO = 0 TO 100.1 STEP 10 +180 TEMPERATURA = 20+(100-20)*EXP(-.07*TIEMPO) +190 PRINT USING "###.##";TEMPERATURA; +200 NEXT TIEMPO +210 PRINT +220 PASO = 2 : GOSUB 260 +230 PASO = 5 : GOSUB 260 +240 PASO = 10 : GOSUB 260 +250 END +260 REM Euler(paso) +270 TIEMPO = 0 +280 TEMPERATURA = 100 +290 PRINT USING "Step ## ";PASO; +300 FOR TIEMPO = 0 TO 100 STEP PASO +310 IF (TIEMPO MOD 10) = 0 THEN PRINT USING "###.##";TEMPERATURA; +320 TEMPERATURA = TEMPERATURA+(PASO)*(-.07*(TEMPERATURA-20)) +330 IF TIEMPO > 100 THEN EXIT FOR +340 NEXT TIEMPO +350 PRINT +360 RETURN diff --git a/Task/Euler-method/Gambas/euler-method.gambas b/Task/Euler-method/Gambas/euler-method.gambas new file mode 100644 index 0000000000..5079a41121 --- /dev/null +++ b/Task/Euler-method/Gambas/euler-method.gambas @@ -0,0 +1,42 @@ +Public Sub Main() + + Dim tiempo As Float, temperatura As Float + + Print "Time "; + tiempo = 0.0 + While tiempo <= 100.1 + Print Format$(tiempo, "#######"); + tiempo += 10.0 + Wend + Print + + Print "Dif eq "; + tiempo = 0.0 + While tiempo <= 100.1 + temperatura = 20.0 + (100.0 - 20.0) * Exp(-0.07 * tiempo) + Print Format$(temperatura, "####.#0"); + tiempo += 10.0 + Wend + Print + + Euler(2) + Euler(5) + Euler(10) + +End + +Public Sub Euler(paso As Integer) + + Dim tiempo As Integer = 0 + Dim temperatura As Float = 100.0 + + Print "Step "; Format$(paso, "##"); " "; + + Do While tiempo <= 100 + If (tiempo Mod 10) = 0 Then Print Format$(temperatura, "####.#0"); + temperatura += (paso) * (-0.07 * (temperatura - 20.0)) + tiempo += paso + Loop + Print + +End Sub diff --git a/Task/Euler-method/JavaScript/euler-method.js b/Task/Euler-method/JavaScript/euler-method.js index 69666fe2e1..edff7b850d 100644 --- a/Task/Euler-method/JavaScript/euler-method.js +++ b/Task/Euler-method/JavaScript/euler-method.js @@ -1,29 +1,29 @@ // Function that takes differential-equation, initial condition, // ending x, and step size as parameters function eulersMethod(f, x1, y1, x2, h) { - // Header - console.log("\tX\t|\tY\t"); - console.log("------------------------------------"); + // Header + console.log("\tX\t|\tY\t"); + console.log("------------------------------------"); - // Initial Variables - var x=x1, y=y1; + // Initial Variables + var x=x1, y=y1; - // While we're not done yet - // Both sides of the OR let you do Euler's Method backwards - while ((xx2 && x1>x2)) { - // Print what we have - console.log("\t" + x + "\t|\t" + y); + // While we're not done yet + // Both sides of the OR let you do Euler's Method backwards + while ((xx2 && x1>x2)) { + // Print what we have + console.log("\t" + x + "\t|\t" + y); - // Calculate the next values - y += h*f(x, y) - x += h; - } + // Calculate the next values + y += h*f(x, y) + x += h; + } - return y; + return y; } function cooling(x, y) { - return -0.07 * (y-20); + return -0.07 * (y-20); } eulersMethod(cooling, 0, 100, 100, 10); diff --git a/Task/Euler-method/Jq/euler-method-1.jq b/Task/Euler-method/Jq/euler-method-1.jq index 4036e91460..3121a16965 100644 --- a/Task/Euler-method/Jq/euler-method-1.jq +++ b/Task/Euler-method/Jq/euler-method-1.jq @@ -7,7 +7,7 @@ def euler_method(df; x1; y1; x2; h): | [x1, y1] | recurse( if ((.[0] < x2 and x1 < x2) or (.[0] > x2 and x1 > x2)) then - [ (.[0] + $h), (.[1] + $h*df) ] + [ (.[0] + $h), (.[1] + $h*df) ] else empty end ) | .[1] ; diff --git a/Task/Euler-method/Jq/euler-method-2.jq b/Task/Euler-method/Jq/euler-method-2.jq index cbb1cefb18..dad3672557 100644 --- a/Task/Euler-method/Jq/euler-method-2.jq +++ b/Task/Euler-method/Jq/euler-method-2.jq @@ -4,7 +4,7 @@ def euler_solution(df; x1; y1; x2; h): | [x1, y1] | recursion( if ((.[0] < x2 and x1 < x2) or (.[0] > x2 and x1 > x2)) then - [ (.[0] + $h), (.[1] + $h*df) ] + [ (.[0] + $h), (.[1] + $h*df) ] else empty end ) | .[1] ; diff --git a/Task/Euler-method/Julia/euler-method.julia b/Task/Euler-method/Julia/euler-method.jl similarity index 100% rename from Task/Euler-method/Julia/euler-method.julia rename to Task/Euler-method/Julia/euler-method.jl diff --git a/Task/Euler-method/K/euler-method.k b/Task/Euler-method/K/euler-method.k new file mode 100644 index 0000000000..1bb3a2cd8c --- /dev/null +++ b/Task/Euler-method/K/euler-method.k @@ -0,0 +1,15 @@ +// make global variables with :: because while is only locally scoped +tn1::100 +tn::100 +// to store solution +sol::() +// these are constant, so only local scope +k:-0.07 +time:100 +steps:10 +h:time%steps +tr:20 +// applying x+h to 0 outside to end while loop +// bind to a variable to surpress output +var: {x<100}{tn1::tn+h*k*(tn-tr);sol::sol,tn;tn::tn1;x+h}\0 +sol diff --git a/Task/Euler-method/Kotlin/euler-method.kotlin b/Task/Euler-method/Kotlin/euler-method.kts similarity index 100% rename from Task/Euler-method/Kotlin/euler-method.kotlin rename to Task/Euler-method/Kotlin/euler-method.kts diff --git a/Task/Euler-method/Lambdatalk/euler-method.lambdatalk b/Task/Euler-method/Lambdatalk/euler-method.lambdatalk index 62f2efe8fb..8f70a445a6 100644 --- a/Task/Euler-method/Lambdatalk/euler-method.lambdatalk +++ b/Task/Euler-method/Lambdatalk/euler-method.lambdatalk @@ -14,14 +14,14 @@ {eulersMethod cooling 100 0 100 10} -> - 0 100 - 10 44 - 20 27.2 - 30 22.16 - 40 20.648 - 50 20.194 - 60 20.058 - 70 20.017 - 80 20.005 - 90 20.002 - 100 20 + 0 100 + 10 44 + 20 27.2 + 30 22.16 + 40 20.648 + 50 20.194 + 60 20.058 + 70 20.017 + 80 20.005 + 90 20.002 + 100 20 diff --git a/Task/Euler-method/Lua/euler-method.lua b/Task/Euler-method/Lua/euler-method.lua index bd34fd6cc1..e72469b893 100644 --- a/Task/Euler-method/Lua/euler-method.lua +++ b/Task/Euler-method/Lua/euler-method.lua @@ -10,8 +10,8 @@ NewtonCooling = function( t ) return -k * ( t - TR ) end function Euler( f, y0, n, h ) local y = y0 for x = 0, n, h do - print( "", x, y ) - y = y + h * f( y ) + print( "", x, y ) + y = y + h * f( y ) end end diff --git a/Task/Euler-method/MATLAB/euler-method.m b/Task/Euler-method/MATLAB/euler-method.m new file mode 100644 index 0000000000..14e8b6882a --- /dev/null +++ b/Task/Euler-method/MATLAB/euler-method.m @@ -0,0 +1,40 @@ +clear all;close all;clc; +format longG; + +% Main Script +for h = [5, 10] + fprintf('Step %d:\n\n', h); + tabular(15, 'Time', 'Euler', 'Analytic'); + T0 = 100.0; + t0 = 0; + t1 = 100; + T = euler(@(T) -0.07 * (T - 20.0), T0, t0, t1, h); + for i = 1:length(T) + t = (i-1) * h; + analytic = 20.0 + 80.0 * exp(-0.07 * t); + tabular(15, t, round(T(i), 6), round(analytic, 6)); + end + fprintf('\n'); +end + +function T = euler(f, T0, t0, t1, h) + % EULER A simple implementation of Euler's method for solving ODEs + % f - function handle for the derivative + % T0 - initial temperature + % t0, t1 - start and end times + % h - step size + T = T0; + for t = t0:h:t1 + T(end+1) = T(end) + h * f(T(end)); + end +end + +function tabular(width, varargin) + % TABULAR Prints a series of values in a tabular form + % width - cell width + % varargin - variable number of arguments representing cells + for i = 1:length(varargin) + fprintf('%-*s', width, num2str(varargin{i})); + end + fprintf('\n'); +end diff --git a/Task/Euler-method/Maple/euler-method-2.maple b/Task/Euler-method/Maple/euler-method-2.maple index 491e6ef422..3c782c1955 100644 --- a/Task/Euler-method/Maple/euler-method-2.maple +++ b/Task/Euler-method/Maple/euler-method-2.maple @@ -1,16 +1,16 @@ f := y -> (-0.07) * (y - 20): EulerMethod := proc(f, start_time, end_time, y0, h) # y0: initial value #h: step size - local cur, y, rate: - cur := start_time; - y := y0; - while cur <= end_time do - printf("%g %g\n", cur, y); - cur := cur + h; - rate := f(y); - y := y + h * rate; - end do; - return y; + local cur, y, rate: + cur := start_time; + y := y0; + while cur <= end_time do + printf("%g %g\n", cur, y); + cur := cur + h; + rate := f(y); + y := y + h * rate; + end do; + return y; end proc: # step size = 2 diff --git a/Task/Euler-method/OCaml/euler-method-1.ocaml b/Task/Euler-method/OCaml/euler-method-1.ml similarity index 100% rename from Task/Euler-method/OCaml/euler-method-1.ocaml rename to Task/Euler-method/OCaml/euler-method-1.ml diff --git a/Task/Euler-method/OCaml/euler-method-2.ocaml b/Task/Euler-method/OCaml/euler-method-2.ml similarity index 100% rename from Task/Euler-method/OCaml/euler-method-2.ocaml rename to Task/Euler-method/OCaml/euler-method-2.ml diff --git a/Task/Euler-method/Odin/euler-method.odin b/Task/Euler-method/Odin/euler-method.odin new file mode 100644 index 0000000000..b8f110cd72 --- /dev/null +++ b/Task/Euler-method/Odin/euler-method.odin @@ -0,0 +1,36 @@ +package main + +import "core:fmt" +import "core:math" + +ivp_euler ::proc(y:f32,step:i32,end:i32){ + + y:=y + t:=i32(0) + + for ;t<=end;t+=step{ + if(t%10==0){fmt.printfln("%.3f", y)} + y+=f32(step)*cooling(f32(t),y) + } +} + +cooling :: proc(t:f32,temp:f32)-> f32{ + return -0.07* (temp-20.0) +} + +analytic :: proc(){ + for t := 0; t <= 100; t += 10{ + fmt.printfln("%.3f",20+80*math.exp_f32(f32(-0.07)*f32(t))) + } +} + +main :: proc() { + fmt.println("Step: 2 Seconds") + ivp_euler(100.0, 2,100) + fmt.println("Step: 5 Seconds") + ivp_euler(100.0, 5, 100) + fmt.println("Step: 10 Seconds") + ivp_euler(100.0, 10, 100) + fmt.println("Analytic") + analytic() +} diff --git a/Task/Euler-method/Pascal/euler-method.pas b/Task/Euler-method/Pascal/euler-method.pas index 52a98641e0..598e3d480b 100644 --- a/Task/Euler-method/Pascal/euler-method.pas +++ b/Task/Euler-method/Pascal/euler-method.pas @@ -3,47 +3,47 @@ PROGRAM Euler; TYPE TNewtonCooling = FUNCTION (t: REAL) : REAL; -CONST T0 : REAL = 100.0; -CONST TR : REAL = 20.0; -CONST k : REAL = 0.07; -CONST time : INTEGER = 100; -CONST step : INTEGER = 10; -CONST dt : ARRAY[0..3] of REAL = (1.0,2.0,5.0,10.0); +CONST T0 : REAL = 100.0; +CONST TR : REAL = 20.0; +CONST k : REAL = 0.07; +CONST time : INTEGER = 100; +CONST step : INTEGER = 10; +CONST dt : ARRAY[0..3] of REAL = (1.0,2.0,5.0,10.0); -VAR i : INTEGER; +VAR i : INTEGER; FUNCTION NewtonCooling(t: REAL) : REAL; - BEGIN - NewtonCooling := -k * (t-TR); - END; - + BEGIN + NewtonCooling := -k * (t-TR); + END; + PROCEDURE Euler(F: TNewtonCooling; y, h : REAL; n: INTEGER); - VAR i: INTEGER = 0; - BEGIN - WRITE('dt=',trunc(h):2,':'); - REPEAT - IF (i mod 10 = 0) THEN WRITE(' ',y:2:3); - INC(i,trunc(h)); - y := y + h * F(y); - UNTIL (i >= n); - WRITELN; - END; + VAR i: INTEGER = 0; + BEGIN + WRITE('dt=',trunc(h):2,':'); + REPEAT + IF (i mod 10 = 0) THEN WRITE(' ',y:2:3); + INC(i,trunc(h)); + y := y + h * F(y); + UNTIL (i >= n); + WRITELN; + END; PROCEDURE Sigma; - VAR t: INTEGER = 0; - BEGIN - WRITE('Sigma:'); - REPEAT - WRITE(' ',(20 + 80 * exp(-0.07 * t)):2:3); - INC(t,step); - UNTIL (t>=time); - WRITELN; - END; + VAR t: INTEGER = 0; + BEGIN + WRITE('Sigma:'); + REPEAT + WRITE(' ',(20 + 80 * exp(-0.07 * t)):2:3); + INC(t,step); + UNTIL (t>=time); + WRITELN; + END; BEGIN - WRITELN('Newton cooling function: Analytic solution (Sigma) with 3 Euler approximations.'); - WRITELN('Time: ',0:7,10:7,20:7,30:7,40:7,50:7,60:7,70:7,80:7,90:7); - Sigma; - FOR i := 1 to 3 DO - Euler(NewtonCooling,T0,dt[i],time); + WRITELN('Newton cooling function: Analytic solution (Sigma) with 3 Euler approximations.'); + WRITELN('Time: ',0:7,10:7,20:7,30:7,40:7,50:7,60:7,70:7,80:7,90:7); + Sigma; + FOR i := 1 to 3 DO + Euler(NewtonCooling,T0,dt[i],time); END. diff --git a/Task/Euler-method/PascalABC.NET/euler-method.pas b/Task/Euler-method/PascalABC.NET/euler-method.pas new file mode 100644 index 0000000000..474986e8f7 --- /dev/null +++ b/Task/Euler-method/PascalABC.NET/euler-method.pas @@ -0,0 +1,31 @@ +procedure euler(f: (real) -> real; y0, a, b, h: real); +begin + var (t, y) := (a, y0); + write(' Step', h:3, ':'); + while t <= b do + begin + if integer(t) mod 10 = 0 then write(y:8:3); + t += h; + y += h * f(y); + end; + writeln; +end; + +procedure analytic(); +begin + write(' Time:'); + for var t := 0 to 100 step 10 do write(t:8); + writeln; + write('Analytic:'); + for var t := 0 to 100 step 10 do + write(20.0 + 80.0 * exp(-0.07 * t):8:3); + println(); +end; + +function newtoncooling(temp: real): real := -0.07 * (temp - 20); + +begin +analytic; +foreach var i in |2, 5, 10| do + euler(newtoncooling, 100.0, 0.0, 100.0, i) +end. diff --git a/Task/Euler-method/Pluto/euler-method.pluto b/Task/Euler-method/Pluto/euler-method.pluto new file mode 100644 index 0000000000..f0d8207f4e --- /dev/null +++ b/Task/Euler-method/Pluto/euler-method.pluto @@ -0,0 +1,25 @@ +local fmt = require "fmt" + +local function euler(f, y, step, finish) + fmt.write(" Step %2d: ", step) + for t = 0, finish, step do + if t % 10 == 0 then fmt.write(" %7.3f", y) end + y += step * f(y) + end + print() +end + +local function analytic() + io.write(" Time: ") + for t = 0, 100, 10 do fmt.write(" %7d", t) end + io.write("\nAnalytic: ") + for t = 0, 100, 10 do + fmt.write(" %7.3f", 20 + 80 * math.exp(-0.07 * t)) + end + print() +end + +local cooling = |temp| -> -0.07 * (temp - 20) + +analytic() +for {2, 5, 10} as i do euler(cooling, 100, i, 100) end diff --git a/Task/Euler-method/PowerShell/euler-method.psh b/Task/Euler-method/PowerShell/euler-method.ps1 similarity index 100% rename from Task/Euler-method/PowerShell/euler-method.psh rename to Task/Euler-method/PowerShell/euler-method.ps1 diff --git a/Task/Euler-method/Python/euler-method.py b/Task/Euler-method/Python/euler-method.py index 1c00e47cfe..ff0bcc8723 100644 --- a/Task/Euler-method/Python/euler-method.py +++ b/Task/Euler-method/Python/euler-method.py @@ -1,11 +1,11 @@ def euler(f,y0,a,b,h): - t,y = a,y0 - while t <= b: - print "%6.3f %6.3f" % (t,y) - t += h - y += h * f(t,y) + t,y = a,y0 + while t <= b: + print "%6.3f %6.3f" % (t,y) + t += h + y += h * f(t,y) def newtoncooling(time, temp): - return -0.07 * (temp - 20) + return -0.07 * (temp - 20) euler(newtoncooling,100,0,100,10) diff --git a/Task/Euler-method/Q/euler-method.q b/Task/Euler-method/Q/euler-method.q new file mode 100644 index 0000000000..a788e246d6 --- /dev/null +++ b/Task/Euler-method/Q/euler-method.q @@ -0,0 +1,10 @@ +t:0 +time:100 +k:-0.07 +tr:20 +sol:() +steps:10 +h:time%steps +tn:100 +while [t.5 then ix=ix+sign(x); x= x-ix; z=1 - _=1; w=1; do j=1; _= _*x/j; z= (z+_)/1; if z==w then leave; w=z - end /*j*/; if z\==0 then z= e**ix * z; return z +-- 18 Sep 2025 +include Setting + +say "EULER METHOD FOR ODE y'=-0.07(y-20)" +say version +say +call Task 0,100,2,100 +call Task 0,100,5,100 +call Task 0,100,10,100 +call Timer +exit + +Task: +-- Euler method +procedure expose Memo. +arg x0,xn,dx,y0 +say 'From' x0 'to' xn 'step' dx +say ' x Calc y True y Abs error Rel error' +x=x0; y=y0 +do until x > xn + if x//10 = 0 then + call Show x,y + y+=dx*Dy(y); x+=dx +end +say +return + +Show: +-- Display a line +procedure expose Memo. +arg xx,yy +yt=True(xx) +say Format(xx,3,0) Format(yy,3,7) Format(yt,3,7), + Left(Std(Abs(yy-yt)),9) Left(Std(Abs(yy/yt-1)),9) +return + +Dy: +-- Differential equation +procedure +arg yy +return -0.07*(yy-20) + +True: +-- Real solution +procedure expose Memo. +arg xx +return 20+(100-20)*Exp(-0.07*xx) + +include Math diff --git a/Task/Euler-method/Rebol/euler-method.rebol b/Task/Euler-method/Rebol/euler-method.rebol new file mode 100644 index 0000000000..3fbd56d1cc --- /dev/null +++ b/Task/Euler-method/Rebol/euler-method.rebol @@ -0,0 +1,34 @@ +Rebol [ + title: "Rosetta code: Euler method" + file: %Euler_method.r3 + url: https://rosettacode.org/wiki/Euler_method +] + +euler: func[ + "Euler's method for Newton's cooling law, with formatted comparison" + step [integer!] "time step in seconds" + precision [decimal!] "rounding granularity for printed numbers" +][ + print ["^/STEP:" step] + print "Time Euler Analytic" + print "-------------------------" + + ;; Initialize: + ;; b: upper time bound (seconds) — here we reuse the initial temperature value 100 + ;; y: the current Euler-approximated temperature; initial condition T(0) = 100 + b: y: 100 + for time 0 b step [ + printf [-3 " | " 9 "| "] reduce [ + time + round/to y precision + round/to (20 + (80 * exp (-0.07 * time))) precision + ] + ;; Euler step update: + ;; This applies the discrete forward Euler update using the ODE's RHS + y: y + (step * (-0.07 * (y - 20))) + ] +] +;; Run three experiments with different step sizes +euler 2 0.0001 +euler 5 0.0001 +euler 10 0.0001 diff --git a/Task/Euler-method/Rust/euler-method.rust b/Task/Euler-method/Rust/euler-method.rs similarity index 100% rename from Task/Euler-method/Rust/euler-method.rust rename to Task/Euler-method/Rust/euler-method.rs diff --git a/Task/Euler-method/SequenceL/euler-method.sequencel b/Task/Euler-method/SequenceL/euler-method.sequencel index 8c3703f0a3..c795f7cb74 100644 --- a/Task/Euler-method/SequenceL/euler-method.sequencel +++ b/Task/Euler-method/SequenceL/euler-method.sequencel @@ -6,20 +6,20 @@ TR := 20.0; k := 0.07; main(args(2)) := - let - results[i] := euler(newtonCooling, T0, 100, stringToInt(args[i]), 0, "delta_t = " ++ args[i]); - in - delimit(results, '\n'); + let + results[i] := euler(newtonCooling, T0, 100, stringToInt(args[i]), 0, "delta_t = " ++ args[i]); + in + delimit(results, '\n'); newtonCooling(t) := -k * (t - TR); euler: (float -> float) * float * int * int * int * char(1) -> char(1); euler(f, y, n, h, x, output(1)) := - let - newOutput := output ++ "\n\t" ++ intToString(x) ++ "\t" ++ floatToString(y, 3); - newY := y + h * f(y); - newX := x + h; - in - output when x > n - else - euler(f, newY, n, h, newX, newOutput); + let + newOutput := output ++ "\n\t" ++ intToString(x) ++ "\t" ++ floatToString(y, 3); + newY := y + h * f(y); + newX := x + h; + in + output when x > n + else + euler(f, newY, n, h, newX, newOutput); diff --git a/Task/Euler-method/Smalltalk/euler-method.st b/Task/Euler-method/Smalltalk/euler-method.st index 7dd18f966b..52f6dd908b 100644 --- a/Task/Euler-method/Smalltalk/euler-method.st +++ b/Task/Euler-method/Smalltalk/euler-method.st @@ -1,13 +1,13 @@ ODESolver>>eulerOf: f init: y0 from: a to: b step: h - | t y | - t := a. - y := y0. - [ t < b ] - whileTrue: [ - Transcript - show: t asString, ' ' , (y printShowingDecimalPlaces: 3); - cr. - t := t + h. - y := y + (h * (f value: t value: y)) ] + | t y | + t := a. + y := y0. + [ t < b ] + whileTrue: [ + Transcript + show: t asString, ' ' , (y printShowingDecimalPlaces: 3); + cr. + t := t + h. + y := y + (h * (f value: t value: y)) ] ODESolver new eulerOf: [:time :temp| -0.07 * (temp - 20)] init: 100 from: 0 to: 100 step: 10 diff --git a/Task/Euler-method/Tcl/euler-method-1.tcl b/Task/Euler-method/Tcl/euler-method-1.tcl index 6073ea9839..a7854e5399 100644 --- a/Task/Euler-method/Tcl/euler-method-1.tcl +++ b/Task/Euler-method/Tcl/euler-method-1.tcl @@ -2,8 +2,8 @@ proc euler {f y0 a b h} { puts "computing $f over \[$a..$b\], step $h" set y [expr {double($y0)}] for {set t [expr {double($a)}]} {$t < $b} {set t [expr {$t + $h}]} { - puts [format "%.3f\t%.3f" $t $y] - set y [expr {$y + $h * double([$f $t $y])}] + puts [format "%.3f\t%.3f" $t $y] + set y [expr {$y + $h * double([$f $t $y])}] } puts "done" } diff --git a/Task/Euler-method/True-BASIC/euler-method.basic b/Task/Euler-method/True-BASIC/euler-method.basic new file mode 100644 index 0000000000..4989b823c4 --- /dev/null +++ b/Task/Euler-method/True-BASIC/euler-method.basic @@ -0,0 +1,32 @@ +SUB euler (paso) + LET tiempo = 0 + LET temperatura = 100 + PRINT USING "Step ## ": paso; + DO WHILE tiempo <= 100 + IF (REMAINDER(tiempo,10)) = 0 THEN PRINT USING "###.##": temperatura; + LET temperatura = temperatura+paso*(-.07*(temperatura-20)) + LET tiempo = tiempo+paso + LOOP + PRINT +END SUB + +PRINT "Time "; +LET tiempo = 0 +DO WHILE tiempo <= 100.1 + PRINT USING "######": tiempo; + LET tiempo = tiempo+10 +LOOP +PRINT +PRINT "Dif eq "; +LET tiempo = 0 +DO WHILE tiempo <= 100.1 + LET temperatura = 20+(100-20)*EXP(-.07*tiempo) + PRINT USING "###.##": temperatura; + LET tiempo = tiempo+10 +LOOP +PRINT + +CALL Euler (2) +CALL Euler (5) +CALL Euler (10) +END diff --git a/Task/Euler-method/Uiua/euler-method.uiua b/Task/Euler-method/Uiua/euler-method.uiua new file mode 100644 index 0000000000..0d577690a3 --- /dev/null +++ b/Task/Euler-method/Uiua/euler-method.uiua @@ -0,0 +1,22 @@ +"Euler Solution" +T ← 100 # initial starting temp +TR ← 20 # room temp +TMINUSTR ← - TR T +h ← 10 # step size +k ← 0.07 # coefficent +TEND ← 100 # end time +n ← ÷ h 100 # steps +# inital starting point +T +. +# .. clone the top of stack and take if for next step +# repeat the steps n times with ⍥ +Solution ← [⍥(.. - × h × k - TR)]+ n 1 +⇌ ⊂ Solution T + +# analytical solution +"Analytical Solution" +# apply function to LIST +List ← × k × h ⇡n +# Analytical solution applied ++ TR × TMINUSTR ⁿ ¯List e diff --git a/Task/Euler-method/Wren/euler-method.wren b/Task/Euler-method/Wren/euler-method.wren index 67ca037670..cf86fb3800 100644 --- a/Task/Euler-method/Wren/euler-method.wren +++ b/Task/Euler-method/Wren/euler-method.wren @@ -1,5 +1,5 @@ -import "/fmt" for Fmt -import "/iterate" for Stepped +import "./fmt" for Fmt +import "./iterate" for Stepped var euler = Fn.new { |f, y, step, end| Fmt.write(" Step $2d: ", step) diff --git a/Task/Euler-method/XBasic/euler-method.basic b/Task/Euler-method/XBasic/euler-method.basic new file mode 100644 index 0000000000..ad06196e05 --- /dev/null +++ b/Task/Euler-method/XBasic/euler-method.basic @@ -0,0 +1,43 @@ +PROGRAM "Euclidean rhythm" +VERSION "0.0001" +IMPORT "xma" + +DECLARE FUNCTION Entry () +DECLARE FUNCTION Euler (paso) + +FUNCTION Entry () + PRINT "Time "; + tiempo! = 0.0 + DO WHILE tiempo! <= 100.1 + PRINT FORMAT$ ("#######", tiempo!); + tiempo! = tiempo! + 10.0 + LOOP + PRINT + + PRINT "Dif eq "; + tiempo! = 0.0 + DO WHILE tiempo! <= 100.1 + temperatura! = 20.0 + (100.0 - 20.0) * EXP(-0.07 * tiempo!) + PRINT FORMAT$ ("####.##", temperatura!); + tiempo! = tiempo! + 10.0 + LOOP + PRINT + + Euler(2) + Euler(5) + Euler(10) +END FUNCTION + +FUNCTION Euler (paso) + tiempo! = 0 + temperatura! = 100.0 + PRINT FORMAT$ ("Step ## ", paso); + + DO WHILE tiempo! <= 100 + IF (tiempo! MOD 10) = 0 THEN PRINT FORMAT$ ("####.##", temperatura!); + temperatura! = temperatura! + SINGLE(paso) * (-0.07 * (temperatura! - 20.0)) + tiempo! = tiempo! + paso + LOOP + PRINT +END FUNCTION +END PROGRAM diff --git a/Task/Euler-method/Yabasic/euler-method.basic b/Task/Euler-method/Yabasic/euler-method.basic new file mode 100644 index 0000000000..6e34a8d04b --- /dev/null +++ b/Task/Euler-method/Yabasic/euler-method.basic @@ -0,0 +1,35 @@ +print "Time "; +tiempo = 0.0 +while tiempo <= 100.1 + print tiempo using "#######"; + tiempo = tiempo + 10.0 +wend +print + +print "Dif eq "; +tiempo = 0.0 +while tiempo <= 100.1 + temperatura = 20.0 + (100.0-20.0) * exp(-0.07*tiempo) + print temperatura using "####.##"; + tiempo = tiempo + 10.0 +wend +print + +Euler_(2) +Euler_(5) +Euler_(10) +end + +sub Euler_(paso) + local tiempo, temperatura + tiempo = 0 + temperatura = 100.0 + print "Step ", paso using "##", " "; + + while tiempo <= 100 + if mod(tiempo, 10) = 0 print temperatura using "####.##"; + temperatura = temperatura + (paso) * (-0.07*(temperatura-20.0)) + tiempo = tiempo + paso + end while + print +end sub diff --git a/Task/Eulers-constant-0.5772.../ALGOL-W/eulers-constant-0.5772....alg b/Task/Eulers-constant-0.5772.../ALGOL-W/eulers-constant-0.5772....alg new file mode 100644 index 0000000000..4b49f4d0c2 --- /dev/null +++ b/Task/Eulers-constant-0.5772.../ALGOL-W/eulers-constant-0.5772....alg @@ -0,0 +1,89 @@ +begin % calculate Euler's constant, translated from the XPL0 sample % + % which is translated from the C sample % + + long real A, B, H, N2, R, U, V; + long real array S ( 0 :: 1 ); + long real array B2( 0 :: 9 ); + long real Epsilon; + integer K, K2, M, N; + + Epsilon := 1'-6; + + % set output format % + i_w := 1; s_w := 0; r_w := 18; r_d := 15; r_format := "A"; + + write( "From the definition, error 3e-10" ); + N := 400; H := 1.0; + for K1 := 2 until N do H := H + 1.0 / K1; + comment Faster convergence: Negoi, 1997 ; + A := Ln( N + 0.5 + 1.0/( 24.0 * N ) ); + write( "Hn ", H ); + write( "gamma ", H - A ); write( "K = ", N ); write(); + + write( "Sweeney, 1963, error 3e-10" ); + N := 21; S( 0 ) := 0; S( 1 ) := N; + R := N; K:= 1; + while begin K := K + 1; + R := R * N / K; + S( K rem 2 ) := S( K rem 2 ) + R / K; + R > Epsilon + end + do begin end; + write( "gamma ", S( 1 ) - S( 0 ) - ln( N ) );write( "K = ", K ); write(); + + write( "Bailey, 1988" ); + N := 5; A := 1; H := 1; + N2 := 2 ** N; + R := 1; K := 1; + while begin K := K + 1; + R := R * N2 / K; + H := H + 1 / K; + B := A; A := A + R * H; + abs( B - A ) > Epsilon + end + do begin end; + A := A * N2 / Exp(N2); + write( "gamma ", A - N * Ln( 2 ) ); write( "K = ", K ); write(); + + write( "Brent-McMillan, 1980" ); + N := 13; A := -Ln( N ); + B := 1; U := A; V := B; + N2 := N * N; K2 := 0; K := 0; + while begin K2 := K2 + 2 * K + 1; + K := K + 1; + A := A * N2 / K; + B := B * N2 / K2; + A := ( A + B ) / K; + U := U + A; + V := V + B; + abs( A ) > Epsilon + end + do begin end; + write( "gamma ", U / V ); write( "K = ", K ); write(); + + write( "How Euler did it in 1735" ); + comment Bernoulli numbers with even indices; + + B2( 0 ) := 1; B2( 1 ) := 1 / 6; B2( 2 ) := -1 / 30; + B2( 3 ) := 1 / 42; B2( 4 ) := -1 / 30; B2( 5 ) := 5 / 66; + B2( 6 ) := -691 / 2730; B2( 7 ) := 7 / 6; B2( 8 ) := -3617 / 510; + B2( 9 ) := 43867 / 98; + M := 7; N := 10; + comment Nth harmonic number; + H := 1; + for K1 := 2 until N do H := H + 1 / K1; + write( "Hn ", H ); + H := H - Ln( N ); + write( " -ln ", H ); + comment Expansion C:= -digamma(1); + A := -1 / ( 2 * N ); + N2 := N * N; + R := 1; + for K1 := 1 until M do begin + R := R * N2; + A := A + B2( K1 ) / (2 * K1 * R ) + end for_K1; + write( "err ", A ); write( "gamma ", H + A ); write( "K = ", N + M ); + write(); + write( "C = 0.57721566490153286..." ); write() +end. diff --git a/Task/Eulers-constant-0.5772.../AWK/eulers-constant-0.5772....awk b/Task/Eulers-constant-0.5772.../AWK/eulers-constant-0.5772....awk new file mode 100644 index 0000000000..cb7e954b31 --- /dev/null +++ b/Task/Eulers-constant-0.5772.../AWK/eulers-constant-0.5772....awk @@ -0,0 +1,12 @@ +# syntax: GAWK -f EULERS_CONSTANT.AWK +# converted from LUA +BEGIN { + Hn = 1 + n = 10^8 + for (i=2; i<=n; i++) { + Hn += (1/i) + } + gamma = Hn - log(n) + printf("%.8f\n",gamma) + exit(0) +} diff --git a/Task/Eulers-constant-0.5772.../Ada/eulers-constant-0.5772....adb b/Task/Eulers-constant-0.5772.../Ada/eulers-constant-0.5772....adb new file mode 100644 index 0000000000..b27ada83d7 --- /dev/null +++ b/Task/Eulers-constant-0.5772.../Ada/eulers-constant-0.5772....adb @@ -0,0 +1,47 @@ +with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions; +with Ada.Numerics.Long_Elementary_Functions; use Ada.Numerics.Long_Elementary_Functions; +with Ada.Text_IO; use Ada.Text_IO; + +procedure Eulers_Constant is + + function Euler_Vacca (Iterations : Integer) return Long_Float is + Gamma : Long_Float := 1.0; + Term : Long_Float; + Power : Long_Integer; + Sign : Long_Float; + begin + Gamma := 0.5 - (1.0 / 3.0); + for I in 2 .. Iterations loop + Power := 2 ** Natural (I); + Sign := -1.0; + Term := 0.0; + for Domin in Power .. (2 * Power - 1) loop + Sign := - (Sign); + Term := Term + Sign / Long_Float (Domin); + end loop; + Gamma := Gamma + (Long_Float (I) * Term); + end loop; + return Gamma; + end Euler_Vacca; + + -- Ada Float type is IEEE 754 32-bit, giving 9 decimal digits of precision + Euler_Castellanos_Float : constant Float := + (((80.0 ** 3) + 92.0) / + (61.0 ** 4)) ** (1.0 / 6.0); + + -- Ada Long_Float type is IEEE 754 32-bit, giving 14 decimal digits of precision + Euler_Castellanos_Long_Float : constant Long_Float := + (990.0 ** 3 - 55.0 ** 3 - 79.0 ** 2 - 16.0) / + 70.0 ** 5; + + Iters : Integer; +begin + Put_Line ("Its. Vacca"); + Iters := 2; + while Iters <= 32 loop + Put_Line (Iters'Image & " " & Euler_Vacca (Iters)'Image); + Iters := Iters + 2; + end loop; + Put_Line ("Castellanos approximation for standard Float (9 digits): " & Euler_Castellanos_Float'Image); + Put_Line ("Castellanos approximation for Long Float (14 digits): " & Euler_Castellanos_Long_Float'Image); +end Eulers_Constant; diff --git a/Task/Eulers-constant-0.5772.../Delphi/eulers-constant-0.5772....delphi b/Task/Eulers-constant-0.5772.../Delphi/eulers-constant-0.5772....delphi deleted file mode 100644 index d9e8de7c73..0000000000 --- a/Task/Eulers-constant-0.5772.../Delphi/eulers-constant-0.5772....delphi +++ /dev/null @@ -1,39 +0,0 @@ -function ComputeEuler(N: int64): double; -{Compute Eurler number with N-number of iterations} -var I: integer; -var A: double; -begin -Result:=0; -for I:=1 to N-1 do - Result:=Result + 1 / I; -A:=Ln(N + 0.5 + 1/(24.0*N)); -Result:=Result-A; -end; - - - -procedure ShowEulersNumber(Memo: TMemo); -{Show Euler numbers at various levels of precision} -var Euler,G,A,Error: double; -var N: integer; -const Correct =0.57721566490153286060651209008240243104215933593992; - - procedure ShowEulerError(N: int64); - {Show Euler number and Error} - begin - Euler:=ComputeEuler(N); - Error:=Correct-Euler; - Memo.Lines.Add('N = '+FloatToStrF(N,ffNumber,18,0)); - Memo.Lines.Add('Euler='+FloatToStrF(Euler,ffFixed,18,18)); - Memo.Lines.Add('Error='+FloatToStrF(Error,ffFixed,18,18)); - Memo.Lines.Add(''); - end; - -begin -{Compute Euler number with iterations ranging 10 to 10^9} -for N:=1 to 9 do - begin - ShowEulerError(Trunc(Power(10,N))); - end; - -end; diff --git a/Task/Eulers-constant-0.5772.../Delphi/eulers-constant-0.5772....pas b/Task/Eulers-constant-0.5772.../Delphi/eulers-constant-0.5772....pas new file mode 100644 index 0000000000..3f1952a8f7 --- /dev/null +++ b/Task/Eulers-constant-0.5772.../Delphi/eulers-constant-0.5772....pas @@ -0,0 +1,39 @@ +function ComputeEuler(N: int64): double; +{Compute Eurler number with N-number of iterations} +var I: integer; +var A: double; +begin +Result:=0; +for I:=1 to N-1 do + Result:=Result + 1 / I; +A:=Ln(N + 0.5 + 1/(24.0*N)); +Result:=Result-A; +end; + + + +procedure ShowEulersNumber(Memo: TMemo); +{Show Euler numbers at various levels of precision} +var Euler,G,A,Error: double; +var N: integer; +const Correct =0.57721566490153286060651209008240243104215933593992; + + procedure ShowEulerError(N: int64); + {Show Euler number and Error} + begin + Euler:=ComputeEuler(N); + Error:=Correct-Euler; + Memo.Lines.Add('N = '+FloatToStrF(N,ffNumber,18,0)); + Memo.Lines.Add('Euler='+FloatToStrF(Euler,ffFixed,18,18)); + Memo.Lines.Add('Error='+FloatToStrF(Error,ffFixed,18,18)); + Memo.Lines.Add(''); + end; + +begin +{Compute Euler number with iterations ranging 10 to 10^9} +for N:=1 to 9 do + begin + ShowEulerError(Trunc(Power(10,N))); + end; + +end; diff --git a/Task/Eulers-constant-0.5772.../DuckDB/eulers-constant-0.5772....duckdb b/Task/Eulers-constant-0.5772.../DuckDB/eulers-constant-0.5772....duckdb new file mode 100644 index 0000000000..fd6a135180 --- /dev/null +++ b/Task/Eulers-constant-0.5772.../DuckDB/eulers-constant-0.5772....duckdb @@ -0,0 +1,21 @@ +# Bailey, 1988 +create or replace function bailey(n, eps) as ( + with recursive n2 as (select pow(2, n) as n2), + cte as ( + select 1 as k, 1.0::DOUBLE as r, 1.0::DOUBLE as h, 0.0::DOUBLE as b, 1.0::DOUBLE as a + union all + select + k + 1 as k, + r * (n2 / (k+1)) as r, + h + (1.0 / (k+1)) as h, + a as b, + a + (r * (n2 / (k+1)) * (h + (1.0 / (k+1)))) as a + from cte, n2 + where @(b - a) > eps + ), + a as (select last(a order by k) as a from cte) + select (a * n2 / exp(n2) ) - (n * ln(2)) + from a, n2 +); + +select bailey(5, 1E-6) as gamma; diff --git a/Task/Eulers-constant-0.5772.../EasyLang/eulers-constant-0.5772....easy b/Task/Eulers-constant-0.5772.../EasyLang/eulers-constant-0.5772....easy new file mode 100644 index 0000000000..16bd541d9a --- /dev/null +++ b/Task/Eulers-constant-0.5772.../EasyLang/eulers-constant-0.5772....easy @@ -0,0 +1,11 @@ +fastfunc gethn n . + i = 1 + while i <= n + hn += 1 / i + i += 1 + . + return hn +. +n = 10e8 +numfmt 0 9 +print gethn n - log n 0 diff --git a/Task/Eulers-constant-0.5772.../Fortran/eulers-constant-0.5772....f b/Task/Eulers-constant-0.5772.../Fortran/eulers-constant-0.5772....f new file mode 100644 index 0000000000..868106567d --- /dev/null +++ b/Task/Eulers-constant-0.5772.../Fortran/eulers-constant-0.5772....f @@ -0,0 +1,131 @@ +program euler_constant + implicit none + ! Define constants and variables + real(16), parameter :: EULER_GAMMA = 0.57721566490153286_16 + real(16), parameter :: eps = epsilon(1.0e-6_16) + real(16) :: a, b, h, n2, r, u, v + integer :: k, k2, m, n + real(16) :: s(0:1), B2(0:9) + real(16), parameter :: eps_high = eps !1.0e-12_16 + + ! Method 1: From the definition (Negoi, 1997) + write(*, '(a)') "From the definition, err. 3e-10" + n = 400 + h = 1.0_16 + do k = 2, n + h = h + 1.0_16 / k + end do + a = log(real(n, 16) + 0.5_16 + 1.0_16 / (24.0_16 * n)) + write(*, '(a, f18.16)') "Hn ", h + write(*, '(a, f18.16, /, a, i0, /)') "gamma ", h - a, "k = ", n + write(*, '(a, f18.16, /)') "error ", abs(h - a - EULER_GAMMA) + + ! Method 2: Sweeney, 1963 + write(*, '(a)') "Sweeney, 1963, err. idem" + n = 21 + s = [0.0_16, real(n, 16)] + r = real(n, 16) + k = 1 + do + k = k + 1 + r = r * real(n, 16) / k + s(mod(k, 2)) = s(mod(k, 2)) + r / k + if (r <= eps) exit + end do + write(*, '(a, f18.16, /, a, i0, /)') "gamma ", s(1) - s(0) - log(real(n, 16_16)), "k = ", k + write(*, '(a, f18.16, /)') "error ", abs(s(1) - s(0) - log(real(n, 16)) - EULER_GAMMA) + + ! Method 3: Bailey, 1988 + write(*, '(a)') "Bailey, 1988" + n = 5 + a = 1.0_16 + h = 1.0_16 + n2 = 2.0_16 ** n + r = 1.0_16 + k = 1 + do + k = k + 1 + r = r * n2 / k + h = h + 1.0_16 / k + b = a + a = a + r * h + if (abs(b - a) <= eps) exit + end do + a = a * n2 / exp(n2) + write(*, '(a, f18.16, /, a, i0, /)') "gamma ", a - n * log(2.0_16), "k = ", k + write(*, '(a, f18.16, /)') "error ", abs(a - n * log(2.0_16) - EULER_GAMMA) + + ! Method 4: Brent-McMillan, 1980 (original) + write(*, '(a)') "Brent-McMillan, 1980 (original)" + n = 13 + a = -log(real(n, 16)) + b = 1.0_16 + u = a + v = b + n2 = real(n, 16) * n + k2 = 0 + k = 0 + do + k2 = k2 + 2 * k + 1 + k = k + 1 + a = a * n2 / k + b = b * n2 / k2 + a = (a + b) / k + u = u + a + v = v + b + if (abs(a) <= eps) exit + end do + write(*, '(a, f18.16, /, a, i0, /)') "gamma ", u / v, "k = ", k + write(*, '(a, f18.16, /)') "error ", abs(u / v - EULER_GAMMA) + + ! Method 5: Brent-McMillan, 1980 (enhanced for higher precision) + write(*, '(a)') "Brent-McMillan, 1980 (enhanced)" + n = 50 + a = -log(real(n, 16)) + b = 1.0_16 + u = a + v = b + n2 = real(n, 16) * n + k2 = 0 + k = 0 + do + k2 = k2 + 2 * k + 1 + k = k + 1 + a = a * n2 / k + b = b * n2 / k2 + a = (a + b) / k + u = u + a + v = v + b + if (abs(a) <= eps_high) exit + end do + write(*, '(a, f18.16, /, a, i0, /)') "gamma ", u / v, "k = ", k + write(*, '(a, f18.16, /)') "error ", abs(u / v - EULER_GAMMA) + + ! Method 6: Euler's method, 1735 + write(*, '(a)') "How Euler did it in 1735" + B2 = [1.0_16, 1.0_16/6, -1.0_16/30, 1.0_16/42, -1.0_16/30, & + 5.0_16/66, -691.0_16/2730, 7.0_16/6, -3617.0_16/510, 43867.0_16/798] + m = 7 + if (m > 9) stop + n = 10 + h = 1.0_16 + do k = 2, n + h = h + 1.0_16 / k + end do + write(*, '(a, f18.16)') "Hn ", h + h = h - log(real(n, 16)) + write(*, '(a, f18.16)') " -ln ", h + a = -1.0_16 / (2.0_16 * n) + n2 = real(n, 16) * n + r = 1.0_16 + do k = 1, m + r = r * n2 + a = a + B2(k) / (2.0_16 * k * r) + end do + write(*, '(a, f18.16, /, a, f18.16, /, a, i0)') & + "err ", a, "gamma ", h + a, "k = ", n + m + write(*, '(a, f18.16, /)') "error ", abs(h + a - EULER_GAMMA) + + ! Reference value + write(*, '(a, f18.16, /)') "C = ", EULER_GAMMA +end program euler_constant diff --git a/Task/Eulers-constant-0.5772.../Java/eulers-constant-0.5772....java b/Task/Eulers-constant-0.5772.../Java/eulers-constant-0.5772....java index dbab8b5182..ab644548fd 100644 --- a/Task/Eulers-constant-0.5772.../Java/eulers-constant-0.5772....java +++ b/Task/Eulers-constant-0.5772.../Java/eulers-constant-0.5772....java @@ -5,20 +5,20 @@ */ public class EulerConstant { - public static void main(String[] args) { - System.out.println(gamma(1_000_000)); - } + public static void main(String[] args) { + System.out.println(gamma(1_000_000)); + } private static double gamma(int N) { - double gamma = 0.0; - - for ( int n = 1; n <= N; n++ ) { - gamma += 1.0 / n; - } - - gamma -= Math.log(N) + 1.0 / ( 2 * N ); - - return gamma; - } - + double gamma = 0.0; + + for ( int n = 1; n <= N; n++ ) { + gamma += 1.0 / n; + } + + gamma -= Math.log(N) + 1.0 / ( 2 * N ); + + return gamma; + } + } diff --git a/Task/Eulers-constant-0.5772.../JavaScript/eulers-constant-0.5772....js b/Task/Eulers-constant-0.5772.../JavaScript/eulers-constant-0.5772....js new file mode 100644 index 0000000000..42188fb06e --- /dev/null +++ b/Task/Eulers-constant-0.5772.../JavaScript/eulers-constant-0.5772....js @@ -0,0 +1,45 @@ +function ByVaccaSeries(numTerms) { + // this method is simple but converges slowly + // calculate gamma by: + // 1 * (1/2 - 1/3) + + // 2 * (1/4 - 1/5 + 1/6 - 1/7) + + // 3 * (1/8 - 1/9 + 1/10 - 1/11 + 1/12 - 1/13 + 1/14 - 1/15) + + // 4 * ( . . . ) + + // . . . + let gamma = 0; + let next = 4; + for (let numerator = 1; numerator < numTerms; ++numerator) { + let delta = 0; + for (let denominator = next / 2; denominator < next; denominator += 2) { + // calculate terms two at a time + delta += 1.0 / denominator - 1.0 / (denominator + 1); + } + gamma += numerator * delta; + next *= 2; + } + return gamma; +} +// based on the C entry +function ByEulersMethod() { + //Bernoulli numbers with even indices + const B2 = [1.0, 1.0 / 6, -1.0 / 30, 1.0 / 42, -1.0 / 30, + 5.0 / 66, -691.0 / 2730, 7.0 / 6]; + const n = 10; + //n-th harmonic number + const h = (() => // immediately invoked function expression + { + let sum = 1; + for (let k = 2; k <= n; k++) { sum += 1.0 / k; } + return sum - Math.log(n); + })(); + //expansion C = -digamma(1) + let a = -1.0 / (2 * n); + let r = 1; + for (let k = 1; k < B2.length; k++) { + r *= n * n; + a += B2[k] / (2 * k * r); + } + return h + a; +} +console.log("Vacca series: " + ByVaccaSeries(32).toPrecision(16)); +console.log("Eulers method: " + ByEulersMethod().toPrecision(16)); diff --git a/Task/Eulers-constant-0.5772.../Julia/eulers-constant-0.5772....julia b/Task/Eulers-constant-0.5772.../Julia/eulers-constant-0.5772....jl similarity index 100% rename from Task/Eulers-constant-0.5772.../Julia/eulers-constant-0.5772....julia rename to Task/Eulers-constant-0.5772.../Julia/eulers-constant-0.5772....jl diff --git a/Task/Eulers-constant-0.5772.../PascalABC.NET/eulers-constant-0.5772....pas b/Task/Eulers-constant-0.5772.../PascalABC.NET/eulers-constant-0.5772....pas new file mode 100644 index 0000000000..d0df6f507a --- /dev/null +++ b/Task/Eulers-constant-0.5772.../PascalABC.NET/eulers-constant-0.5772....pas @@ -0,0 +1,9 @@ +const + n = 1_000_000; + +begin + var result := 1.0; + for var i := 2 to n do + result += 1 / i; + writeln(result - ln(n)); +end. diff --git a/Task/Eulers-constant-0.5772.../Phix/eulers-constant-0.5772...-1.phix b/Task/Eulers-constant-0.5772.../Phix/eulers-constant-0.5772...-1.phix index 72fb81b799..1840979093 100644 --- a/Task/Eulers-constant-0.5772.../Phix/eulers-constant-0.5772...-1.phix +++ b/Task/Eulers-constant-0.5772.../Phix/eulers-constant-0.5772...-1.phix @@ -1,6 +1,4 @@ -(phixonline)--> - -- demo\rosetta\Eulers_constant.exw - with javascript_semantics - constant C = sum(sq_div(1,tagset(1e6)))-log(1e6) - printf(1,"gamma %.12f (max 12d.p. of accuracy)\n",C) - - without js -- no mpfr_get_d_2exp() in mpfr.js as yet - requires("1.0.2") -- mpfr_get_d_2exp(), mpfr_addmul_si() - include mpfr.e - mpfr u, v, k2; - integer e, e10, e2 - atom f +without js -- no mpfr_get_d_2exp() in mpfr.js as yet +requires("1.0.2") -- mpfr_get_d_2exp(), mpfr_addmul_si() +include mpfr.e +mpfr u, v, k2; +integer e, e10, e2 +atom f - //log(x/y) with the Taylor series for atanh(x-y/x+y) - procedure ln(mpfr s, integer x, y) - mpfr d = u, q = v; - assert((x-y)==1) - mpfr_set_si(s, x+y) - mpfr_si_div(s, 1, s) // s = 1 / (x + y) - mpfr_mul(k2, s, s) // k2 = s * s - mpfr_set(d, s) - integer k = 1 - while true do - k += 2; - mpfr_mul(d, d, k2) // d *= k2 - mpfr_div_si(q, d, k) // q = d / k - mpfr_add(s, s, q) // s += q - {f,e} = mpfr_get_d_2exp(q) - if abs(e)>=e2 then exit end if - end while - mpfr_mul_si(s, s, 2) //s *= 2 - end procedure +//log(x/y) with the Taylor series for atanh(x-y/x+y) +procedure ln(mpfr s, integer x, y) + mpfr d = u, q = v; + assert((x-y)==1) + mpfr_set_si(s, x+y) + mpfr_si_div(s, 1, s) // s = 1 / (x + y) + mpfr_mul(k2, s, s) // k2 = s * s + mpfr_set(d, s) + integer k = 1 + while true do + k += 2; + mpfr_mul(d, d, k2) // d *= k2 + mpfr_div_si(q, d, k) // q = d / k + mpfr_add(s, s, q) // s += q + {f,e} = mpfr_get_d_2exp(q) + if abs(e)>=e2 then exit end if + end while + mpfr_mul_si(s, s, 2) //s *= 2 +end procedure - mpfr a, b - integer k, - n = 60, -- (required precision in decimal dp *6/10) - n2, - r = 41, - s = 30, - t = 18; +mpfr a, b +integer k, + n = 60, -- (required precision in decimal dp *6/10) + n2, + r = 41, + s = 30, + t = 18; - // n = 2^i * 3^j * 5^k +// n = 2^i * 3^j * 5^k - // log(n) = r * log(16/15) + s * log(25/24) + t * log(81/80) +// log(n) = r * log(16/15) + s * log(25/24) + t * log(81/80) - // solve linear system for r, s, t - // 4 -3 -4| i - // -1 -1 4| j - // -1 2 -1| k +// solve linear system for r, s, t +// 4 -3 -4| i +// -1 -1 4| j +// -1 2 -1| k - //decimal precision - e10 = floor(n/0.6) - //binary precision - e2 = floor((1 + e10) / 0.30103) +//decimal precision +e10 = floor(n/0.6) +//binary precision +e2 = floor((1 + e10) / 0.30103) - mpfr_set_default_precision(e2) - {a, b, u, v, k2} = mpfr_inits(5) +mpfr_set_default_precision(e2) +{a, b, u, v, k2} = mpfr_inits(5) - //Compute log terms - ln(b, 16, 15) mpfr_mul_si(a, b, r) // a = r * b - ln(b, 25, 24) mpfr_addmul_si(a, b, s) // a += s * b - ln(b, 81, 80) mpfr_addmul_si(a, b, t) // a += t * b +//Compute log terms +ln(b, 16, 15) mpfr_mul_si(a, b, r) // a = r * b +ln(b, 25, 24) mpfr_addmul_si(a, b, s) // a += s * b +ln(b, 81, 80) mpfr_addmul_si(a, b, t) // a += t * b - mpfr_neg(a, a) // a = -a - mpfr_set_si(b, 1) // b = 1 - mpfr_set (u, a) - mpfr_set (v, b) +mpfr_neg(a, a) // a = -a +mpfr_set_si(b, 1) // b = 1 +mpfr_set (u, a) +mpfr_set (v, b) - k = 0; - n2 = n * n; - mpfr_set_si(k2, 0) // k2 = k * k (as below) - while true do - mpfr_add_si(k2, k2, k*2+1) // k2 += 2k + 1 - k += 1; +k = 0; +n2 = n * n; +mpfr_set_si(k2, 0) // k2 = k * k (as below) +while true do + mpfr_add_si(k2, k2, k*2+1) // k2 += 2k + 1 + k += 1; - mpfr_div(b, b, k2) - mpfr_mul_si(b, b, n2) // b = b * n2 / k2 + mpfr_div(b, b, k2) + mpfr_mul_si(b, b, n2) // b = b * n2 / k2 - mpfr_div_si(a, a, k) - mpfr_mul_si(a, a, n2) - mpfr_add (a, a, b) - mpfr_div_si(a, a, k) // a = (a * n2 / k + b) / k + mpfr_div_si(a, a, k) + mpfr_mul_si(a, a, n2) + mpfr_add (a, a, b) + mpfr_div_si(a, a, k) // a = (a * n2 / k + b) / k - mpfr_add(u, u, a) // u += a - mpfr_add(v, v, b) // v += b + mpfr_add(u, u, a) // u += a + mpfr_add(v, v, b) // v += b - {f,e} = mpfr_get_d_2exp (a) - if abs(e)>=e2 then exit end if - end while + {f,e} = mpfr_get_d_2exp (a) + if abs(e)>=e2 then exit end if +end while - mpfr_div(u, u, v) - string su = mpfr_get_fixed(u,e10) - printf(1,"gamma %s (maxerr. 1e-%d)\n", {su, e10}) - - without js -- no mpfr_const_euler() in mpfr.js as yet - requires("1.0.1") -- mpfr_const_euler() - include mpfr.e - mpfr gamma = mpfr_init(0,-100) - mpfr_const_euler(gamma) - printf(1,"gamma %s (mpfr_const_euler)\n",{mpfr_get_fixed(gamma,100)}) - - with javascript_semantics - include builtins\complex.e - complex i = complex_new(0,1), - res = complex_add(complex_exp(complex_mul(PI,i)),1) - ?complex_sprint(res,both:=true) - ?complex_sprint(complex_round(res,1e16),true) - ?complex_sprint(complex_round(res,1e15),true) - - with javascript_semantics - procedure reduce(string s) - constant rules = {{"-1+1","0"}, - {"-1+0","-1"}, - {"i*0","0"}, - {"sin(pi)","0"}, - {"cos(pi)","-1"}, - {"exp(i*pi)","cos(pi)+i*sin(pi)"}} - string t = s - sequence seen = {} -- (be safe and avoid infinite loops) - while not find(t,seen) -- "" re-treading - and length(t)<10000 do -- "" ever-growing - seen = append(seen,t) - bool found = false - for i=1 to length(rules) do - string {r,e} = rules[i] - if match(r,t) then - found = true - t = substitute(t,r,e) - end if - end for - if not found then exit end if - printf(1,"%s = %s\n",{s,t}) - s = repeat(' ',length(s)) - end while - end procedure +with javascript_semantics +constant rules = {{"-1+1","0"}, + {"-1+0","-1"}, + {"i*0","0"}, + {"sin(pi)","0"}, + {"cos(pi)","-1"}, + {"exp(i*pi)","cos(pi)+i*sin(pi)"}} - reduce("exp(i*pi)+1") - - with javascript_semantics - constant MAX = 250 +with javascript_semantics +constant MAX = 250 - constant p5 = new_dict(), - sum2 = new_dict() +constant p5 = new_dict(), + sum2 = new_dict() - atom t0 = time() - for i=1 to MAX do - atom i5 = power(i,5) - setd(i5,i,p5) - for j=1 to i-1 do - atom j5 = power(j,5) - setd(j5+i5,{j,i},sum2) - end for - end for +atom t0 = time() +for i=1 to MAX do + atom i5 = power(i,5) + setd(i5,i,p5) + for j=1 to i-1 do + atom j5 = power(j,5) + setd(j5+i5,{i,j},sum2) + end for +end for - ?time()-t0 +printf(1,"created %d + %d dictionary entries (%gs)\n", + {dict_size(p5),dict_size(sum2),time()-t0}) - function forsum2(object s, object data, object p) - if p<=s then return 0 end if - integer k = getd_index(p-s,sum2) - if k!=NULL then - ?getd(p,p5)&data&getd_by_index(k,sum2) - return 0 -- (show one solution per p) - end if - return 1 - end function +bool found = false +function forsum2(object s, data, p) + if p<=s then return 0 end if + integer k = getd_index(p-s,sum2) + if k!=NULL then + printf(1,"%d^5 + %d^5 + %d^5 +%d^5 = %d^5 (%gs)\n", + getd_by_index(k,sum2)&data&getd(p,p5)&(time()-t0)) + found = true + return 0 -- (show one solution per p) + end if + return 1 +end function - function forp5(object key, object /*data*/, object /*user_data*/) - traverse_dict(forsum2,key,sum2) - return 1 - end function +function forp5(object key, /*data*/, /*user_data*/) + traverse_dict(forsum2,key,sum2) + return not found +end function - traverse_dict(forp5,0,p5) - - ?time()-t0 - - global function choose(integer n, k) - atom res = 1 - for i=1 to k do - res = (res*(n-i+1))/i - end for - return res - end function - - ?choose(5,3) - - with javascript_semantics - include builtins\mpfr.e - sequence tests = {{5,3},{100,50},{60,30},{1200,120}} - mpz r = mpz_init() - for i=1 to length(tests) do - integer {n,k} = tests[i] - mpz_bin_uiui(r,n,k) - ?mpz_get_str(r) - end for - ) + [ i 1+ / ] ] is binomial ( n n --> n ) 5 3 binomial echo diff --git a/Task/Evaluate-binomial-coefficients/Rust/evaluate-binomial-coefficients-1.rust b/Task/Evaluate-binomial-coefficients/Rust/evaluate-binomial-coefficients-1.rs similarity index 100% rename from Task/Evaluate-binomial-coefficients/Rust/evaluate-binomial-coefficients-1.rust rename to Task/Evaluate-binomial-coefficients/Rust/evaluate-binomial-coefficients-1.rs diff --git a/Task/Evaluate-binomial-coefficients/Rust/evaluate-binomial-coefficients-2.rust b/Task/Evaluate-binomial-coefficients/Rust/evaluate-binomial-coefficients-2.rs similarity index 100% rename from Task/Evaluate-binomial-coefficients/Rust/evaluate-binomial-coefficients-2.rust rename to Task/Evaluate-binomial-coefficients/Rust/evaluate-binomial-coefficients-2.rs diff --git a/Task/Evaluate-binomial-coefficients/Scheme/evaluate-binomial-coefficients-1.ss b/Task/Evaluate-binomial-coefficients/Scheme/evaluate-binomial-coefficients-1.scm similarity index 100% rename from Task/Evaluate-binomial-coefficients/Scheme/evaluate-binomial-coefficients-1.ss rename to Task/Evaluate-binomial-coefficients/Scheme/evaluate-binomial-coefficients-1.scm diff --git a/Task/Evaluate-binomial-coefficients/Scheme/evaluate-binomial-coefficients-2.ss b/Task/Evaluate-binomial-coefficients/Scheme/evaluate-binomial-coefficients-2.scm similarity index 100% rename from Task/Evaluate-binomial-coefficients/Scheme/evaluate-binomial-coefficients-2.ss rename to Task/Evaluate-binomial-coefficients/Scheme/evaluate-binomial-coefficients-2.scm diff --git a/Task/Evaluate-binomial-coefficients/Standard-ML/evaluate-binomial-coefficients.ml b/Task/Evaluate-binomial-coefficients/Standard-ML/evaluate-binomial-coefficients.ml new file mode 100644 index 0000000000..5c7ded2667 --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/Standard-ML/evaluate-binomial-coefficients.ml @@ -0,0 +1,5 @@ +fun binomial n k = + if k > n then 0 else + let fun f (_, 0) = 1 + | f (i, d) = f (i + 1, d - 1) * i div d + in f (n - k + 1, k) end diff --git a/Task/Evaluate-binomial-coefficients/True-BASIC/evaluate-binomial-coefficients-1.basic b/Task/Evaluate-binomial-coefficients/True-BASIC/evaluate-binomial-coefficients-1.basic new file mode 100644 index 0000000000..1e8fe03440 --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/True-BASIC/evaluate-binomial-coefficients-1.basic @@ -0,0 +1,35 @@ +FUNCTION factorial(n) + IF n < 1 THEN LET factorial = 1 + + LET product = 1 + FOR i = 2 TO n + LET product = product*i + NEXT i + + LET factorial = product +END FUNCTION + +FUNCTION binomial(n, k) + ! Special cases + IF k = 0 OR k = n THEN LET binomial = 1 + IF k < 0 OR k > n THEN LET binomial = 0 + + ! For efficiency, we use the smallest value of k or (n-k) + IF k > n-k THEN LET k = n-k + LET product = 1 + + FOR i = 1 TO k + LET product = product*(n-k+i)/i + NEXT i + + LET binomial = INT(product+0.5) +END FUNCTION + +FOR n = 0 TO 14 + FOR k = 0 TO n + PRINT USING " ####": binomial(n,k); + NEXT k + PRINT +NEXT n + +END diff --git a/Task/Evaluate-binomial-coefficients/True-BASIC/evaluate-binomial-coefficients-2.basic b/Task/Evaluate-binomial-coefficients/True-BASIC/evaluate-binomial-coefficients-2.basic new file mode 100644 index 0000000000..f3d149d7c5 --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/True-BASIC/evaluate-binomial-coefficients-2.basic @@ -0,0 +1,25 @@ + REM PASCAL'S TRIANGLE + LET N=0 + 10 LET K=0 + 20 GOSUB 30 + PRINT B," " + LET K=K+1 + IF K<=N THEN GOTO 20 + PRINT "" + LET N=N+1 + IF N<=10 THEN GOTO 10 + END + 30 REM BINOMIAL + IF K=0 THEN GOTO 50 + IF K=N THEN GOTO 50 + LET P=1 + LET I=1 + 40 LET T=N-K+I + LET P=P*T/I + LET I=I+1 + IF I<=K THEN GOTO 40 + LET B=P + RETURN + 50 LET B=1 + RETURN + diff --git a/Task/Evaluate-binomial-coefficients/VBScript/evaluate-binomial-coefficients.vb b/Task/Evaluate-binomial-coefficients/VBScript/evaluate-binomial-coefficients.vbs similarity index 100% rename from Task/Evaluate-binomial-coefficients/VBScript/evaluate-binomial-coefficients.vb rename to Task/Evaluate-binomial-coefficients/VBScript/evaluate-binomial-coefficients.vbs diff --git a/Task/Evaluate-binomial-coefficients/Wren/evaluate-binomial-coefficients.wren b/Task/Evaluate-binomial-coefficients/Wren/evaluate-binomial-coefficients.wren index 91af7b9424..61bfa38f0e 100644 --- a/Task/Evaluate-binomial-coefficients/Wren/evaluate-binomial-coefficients.wren +++ b/Task/Evaluate-binomial-coefficients/Wren/evaluate-binomial-coefficients.wren @@ -1,5 +1,5 @@ -import "/fmt" for Fmt -import "/math" for Int +import "./fmt" for Fmt +import "./math" for Int var binomial = Fn.new { |n, k| if (n < 0 || k < 0) Fiber.abort("Arguments must be non-negative integers") diff --git a/Task/Evaluate-binomial-coefficients/Yabasic/evaluate-binomial-coefficients.basic b/Task/Evaluate-binomial-coefficients/Yabasic/evaluate-binomial-coefficients.basic new file mode 100644 index 0000000000..b4066edf86 --- /dev/null +++ b/Task/Evaluate-binomial-coefficients/Yabasic/evaluate-binomial-coefficients.basic @@ -0,0 +1,33 @@ +for n = 0 to 14 + for k = 0 to n + print binomial(n, k) using "####"; + next k + print +next n +end + +sub factorial(n) + local product, i + + if n < 1 return 1 + + product = 1 + for i = 2 to n + product = product * i + next + + return product +end sub + +sub binomial(n, k) + local product, i + + if n < 0 or k < 0 or n <= k return 1 + + product = 1 + for i = n - k + 1 to n + product = product * i + next + + return int(product / factorial(k)) +end sub diff --git a/Task/Even-or-odd/ALGOL-60/even-or-odd.alg b/Task/Even-or-odd/ALGOL-60/even-or-odd.alg new file mode 100644 index 0000000000..314105fd32 --- /dev/null +++ b/Task/Even-or-odd/ALGOL-60/even-or-odd.alg @@ -0,0 +1,21 @@ +begin + +integer i; + +boolean procedure even(n); + value n; integer n; +begin + even := (n = entier(n/2) * 2); +end; + +comment - exercise the function; +for i := 1 step 3 until 12 do + begin + outinteger(1,i); + if even(i) then + outstring(1,"is even\n") + else + outstring(1,"is odd\n"); + end; + +end diff --git a/Task/Even-or-odd/Ada/even-or-odd.ada b/Task/Even-or-odd/Ada/even-or-odd.adb similarity index 100% rename from Task/Even-or-odd/Ada/even-or-odd.ada rename to Task/Even-or-odd/Ada/even-or-odd.adb diff --git a/Task/Even-or-odd/Adina/even-or-odd-1.adina b/Task/Even-or-odd/Adina/even-or-odd-1.adina new file mode 100644 index 0000000000..07565c1f09 --- /dev/null +++ b/Task/Even-or-odd/Adina/even-or-odd-1.adina @@ -0,0 +1,4 @@ +чётное число = + число % 2 == 0 +нечётное число = + число % 2 == 1 diff --git a/Task/Even-or-odd/Adina/even-or-odd-2.adina b/Task/Even-or-odd/Adina/even-or-odd-2.adina new file mode 100644 index 0000000000..e700193dbc --- /dev/null +++ b/Task/Even-or-odd/Adina/even-or-odd-2.adina @@ -0,0 +1,4 @@ +even x = + x % 2 == 0 +odd x = + x % 2 == 1 diff --git a/Task/Even-or-odd/ArkScript/even-or-odd.ark b/Task/Even-or-odd/ArkScript/even-or-odd.ark new file mode 100644 index 0000000000..76058b09e1 --- /dev/null +++ b/Task/Even-or-odd/ArkScript/even-or-odd.ark @@ -0,0 +1,5 @@ +(let is_even (fun (i) + (= 0 (mod i 2)))) + +(let is_odd (fun (i) + (= 1 (mod i 2)))) diff --git a/Task/Even-or-odd/Arturo/even-or-odd.arturo b/Task/Even-or-odd/Arturo/even-or-odd.arturo index 7dfd05748b..eb282edf42 100644 --- a/Task/Even-or-odd/Arturo/even-or-odd.arturo +++ b/Task/Even-or-odd/Arturo/even-or-odd.arturo @@ -1,4 +1,4 @@ loop (neg 5)..5 [x][ - if? even? x -> print [pad to :string x 4 ": even"] - else -> print [pad to :string x 4 ": odd"] + switch even? x -> print [pad to :string x 4 ": even"] + -> print [pad to :string x 4 ": odd"] ] diff --git a/Task/Even-or-odd/Ballerina/even-or-odd.ballerina b/Task/Even-or-odd/Ballerina/even-or-odd.ballerina new file mode 100644 index 0000000000..28dfdbd94a --- /dev/null +++ b/Task/Even-or-odd/Ballerina/even-or-odd.ballerina @@ -0,0 +1,13 @@ +import ballerina/io; + +function isEven(int n) returns boolean { + return n % 2 == 0; +} + +public function main() { + int i = -3; + io:println(`isEven(${i}): ${isEven(i)}`); + foreach int t in -2...4 { + io:println(`isEven(${t}): ${isEven(t)}`); + } +} diff --git a/Task/Even-or-odd/Batch-File/even-or-odd.bat b/Task/Even-or-odd/Batch-File/even-or-odd.bat index 808359977b..4f48361e73 100644 --- a/Task/Even-or-odd/Batch-File/even-or-odd.bat +++ b/Task/Even-or-odd/Batch-File/even-or-odd.bat @@ -1,14 +1,12 @@ @echo off +setlocal set /p i=Insert number: ::bitwise and set /a "test1=%i%&1" -::divide last character by 2 -set /a test2=%i:~-1%/2 - ::modulo -set /a test3=%i% %% 2 +set /a test2=%i% %% 2 set test pause>nul diff --git a/Task/Even-or-odd/COBOL/even-or-odd.cobol b/Task/Even-or-odd/COBOL/even-or-odd.cob similarity index 100% rename from Task/Even-or-odd/COBOL/even-or-odd.cobol rename to Task/Even-or-odd/COBOL/even-or-odd.cob diff --git a/Task/Even-or-odd/Crystal/even-or-odd.cr b/Task/Even-or-odd/Crystal/even-or-odd.cr new file mode 100644 index 0000000000..fbc489e27d --- /dev/null +++ b/Task/Even-or-odd/Crystal/even-or-odd.cr @@ -0,0 +1,40 @@ +#Using bitwise shift + def isEven_bShift(n) + n == ((n >> 1) << 1) + end + def isOdd_bShift(n) + n != ((n >> 1) << 1) + end +#Using modulo operator + def isEven_mod(n) + (n % 2) == 0 + end + def isOdd_mod(n) + (n % 2) != 0 + end +# Using bitwise "and" + def isEven_bAnd(n) + (n & 1) == 0 + end + def isOdd_bAnd(n) + (n & 1) != 0 + end +# Using integer predicates + def isEven_even(n) + n.even? + end + def isOdd_odd(n) + n.odd? + end + +puts isEven_bShift(7) +puts isOdd_bShift(7) + +puts isEven_mod(12) +puts isOdd_mod(12) + +puts isEven_bAnd(21) +puts isOdd_bAnd(21) + +puts isEven_even(32) +puts isOdd_odd(32) diff --git a/Task/Even-or-odd/Crystal/even-or-odd.crystal b/Task/Even-or-odd/Crystal/even-or-odd.crystal deleted file mode 100644 index b214424476..0000000000 --- a/Task/Even-or-odd/Crystal/even-or-odd.crystal +++ /dev/null @@ -1,30 +0,0 @@ -#Using bitwise shift - def isEven_bShift(n) - n == ((n >> 1) << 1) - end - def isOdd_bShift(n) - n != ((n >> 1) << 1) - end -#Using modulo operator - def isEven_mod(n) - (n % 2) == 0 - end - def isOdd_mod(n) - (n % 2) != 0 - end -# Using bitwise "and" - def isEven_bAnd(n) - (n & 1) == 0 - end - def isOdd_bAnd(n) - (n & 1) != 0 - end - -puts isEven_bShift(7) -puts isOdd_bShift(7) - -puts isEven_mod(12) -puts isOdd_mod(12) - -puts isEven_bAnd(21) -puts isOdd_bAnd(21) diff --git a/Task/Even-or-odd/Delphi/even-or-odd.delphi b/Task/Even-or-odd/Delphi/even-or-odd.pas similarity index 100% rename from Task/Even-or-odd/Delphi/even-or-odd.delphi rename to Task/Even-or-odd/Delphi/even-or-odd.pas diff --git a/Task/Even-or-odd/DuckDB/even-or-odd-1.duckdb b/Task/Even-or-odd/DuckDB/even-or-odd-1.duckdb new file mode 100644 index 0000000000..fc23a91ef4 --- /dev/null +++ b/Task/Even-or-odd/DuckDB/even-or-odd-1.duckdb @@ -0,0 +1,3 @@ +create or replace function evenp(i) as ( + i = trunc(i) and i%2 = 0 +); diff --git a/Task/Even-or-odd/DuckDB/even-or-odd-2.duckdb b/Task/Even-or-odd/DuckDB/even-or-odd-2.duckdb new file mode 100644 index 0000000000..f59859511f --- /dev/null +++ b/Task/Even-or-odd/DuckDB/even-or-odd-2.duckdb @@ -0,0 +1 @@ +select i, evenp(i), evenp(i::DOUBLE + 0.1) from range(-1,3) _(i); diff --git a/Task/Even-or-odd/EMal/even-or-odd.emal b/Task/Even-or-odd/EMal/even-or-odd.emal index 0292abacd4..ee2b7e1cd8 100644 --- a/Task/Even-or-odd/EMal/even-or-odd.emal +++ b/Task/Even-or-odd/EMal/even-or-odd.emal @@ -1,20 +1,16 @@ -List evenCheckers = fun[ - logic by int i do return i % 2 == 0 end, - logic by int i do return i & 1 == 0 end] -List oddCheckers = fun[ - logic by int i do return i % 2 != 0 end, - logic by int i do return i & 1 == 1 end] -writeLine("integer".padStart(10, " ") + "|is_even" + "|is_odd |") +List evenCheckers ← fun[ + int.is_odd + |> bool.to_string + |> io.println + + 2 + |> int.is_even + |> bool.to_string + |> io.println +} diff --git a/Task/Even-or-odd/Julia/even-or-odd.julia b/Task/Even-or-odd/Julia/even-or-odd.jl similarity index 100% rename from Task/Even-or-odd/Julia/even-or-odd.julia rename to Task/Even-or-odd/Julia/even-or-odd.jl diff --git a/Task/Even-or-odd/Kotlin/even-or-odd.kotlin b/Task/Even-or-odd/Kotlin/even-or-odd.kts similarity index 100% rename from Task/Even-or-odd/Kotlin/even-or-odd.kotlin rename to Task/Even-or-odd/Kotlin/even-or-odd.kts diff --git a/Task/Even-or-odd/Nom/even-or-odd.num b/Task/Even-or-odd/Nom/even-or-odd.num new file mode 100644 index 0000000000..b67372cd5e --- /dev/null +++ b/Task/Even-or-odd/Nom/even-or-odd.num @@ -0,0 +1,8 @@ +# Least signficant digit method + read; + ![:space:] { + whilenot [:space:]; + [0-9] { E"1",E"3",E"5",E"7",E"9" { add " *ODD!*"; } } + print; clear; + } + [:space:] { while [:space:]; print; clear; } diff --git a/Task/Even-or-odd/Nu/even-or-odd.nu b/Task/Even-or-odd/Nu/even-or-odd.nu new file mode 100644 index 0000000000..df29fd8256 --- /dev/null +++ b/Task/Even-or-odd/Nu/even-or-odd.nu @@ -0,0 +1,7 @@ +def is-even [x: int] { + ($x bit-and 1) == 0 +} + +def is-odd [x: int] { + ($x bit-and 1) == 1 +} diff --git a/Task/Even-or-odd/OCaml/even-or-odd-1.ocaml b/Task/Even-or-odd/OCaml/even-or-odd-1.ml similarity index 100% rename from Task/Even-or-odd/OCaml/even-or-odd-1.ocaml rename to Task/Even-or-odd/OCaml/even-or-odd-1.ml diff --git a/Task/Even-or-odd/OCaml/even-or-odd-2.ocaml b/Task/Even-or-odd/OCaml/even-or-odd-2.ml similarity index 100% rename from Task/Even-or-odd/OCaml/even-or-odd-2.ocaml rename to Task/Even-or-odd/OCaml/even-or-odd-2.ml diff --git a/Task/Even-or-odd/OCaml/even-or-odd-3.ocaml b/Task/Even-or-odd/OCaml/even-or-odd-3.ml similarity index 100% rename from Task/Even-or-odd/OCaml/even-or-odd-3.ocaml rename to Task/Even-or-odd/OCaml/even-or-odd-3.ml diff --git a/Task/Even-or-odd/Oberon/even-or-odd.oberon b/Task/Even-or-odd/Oberon/even-or-odd.oberon deleted file mode 100644 index e010e2ed06..0000000000 --- a/Task/Even-or-odd/Oberon/even-or-odd.oberon +++ /dev/null @@ -1,21 +0,0 @@ -MODULE EvenOrOdd; -IMPORT - S := SYSTEM, - Out; -VAR - x: INTEGER; - s: SET; - -BEGIN - x := 10;Out.Int(x,0); - IF ODD(x) THEN Out.String(" odd") ELSE Out.String(" even") END; - Out.Ln; - - x := 11;s := S.VAL(SET,LONG(x));Out.Int(x,0); - IF 0 IN s THEN Out.String(" odd") ELSE Out.String(" even") END; - Out.Ln; - - x := 12;Out.Int(x,0); - IF x MOD 2 # 0 THEN Out.String(" odd") ELSE Out.String(" even") END; - Out.Ln -END EvenOrOdd. diff --git a/Task/Even-or-odd/PascalABC.NET/even-or-odd.pas b/Task/Even-or-odd/PascalABC.NET/even-or-odd.pas new file mode 100644 index 0000000000..d3cc8e5417 --- /dev/null +++ b/Task/Even-or-odd/PascalABC.NET/even-or-odd.pas @@ -0,0 +1,14 @@ +function IsOddRemainder(x: integer) := x mod 2 <> 0; + +function IsEvenRemainder(x: integer) := x mod 2 = 0; + +function IsOddBitwise(x: integer) := x and 1 = 1; + +function IsEvenBitwise(x: integer) := x and 1 = 0; + +begin + var x := 3; + Println(x.IsEven,x.IsOdd); // Standard Predicates + Println(IsEvenRemainder(x),IsOddRemainder(x)); + Println(IsEvenBitwise(x),IsOddBitwise(x)); +end. diff --git a/Task/Even-or-odd/Pluto/even-or-odd.pluto b/Task/Even-or-odd/Pluto/even-or-odd.pluto new file mode 100644 index 0000000000..670ade3ec5 --- /dev/null +++ b/Task/Even-or-odd/Pluto/even-or-odd.pluto @@ -0,0 +1,4 @@ +local n = 123 +if n % 2 == 0 do + print('even') +else print('odd') end diff --git a/Task/Even-or-odd/PowerShell/even-or-odd-1.psh b/Task/Even-or-odd/PowerShell/even-or-odd-1.ps1 similarity index 100% rename from Task/Even-or-odd/PowerShell/even-or-odd-1.psh rename to Task/Even-or-odd/PowerShell/even-or-odd-1.ps1 diff --git a/Task/Even-or-odd/PowerShell/even-or-odd-2.psh b/Task/Even-or-odd/PowerShell/even-or-odd-2.ps1 similarity index 100% rename from Task/Even-or-odd/PowerShell/even-or-odd-2.psh rename to Task/Even-or-odd/PowerShell/even-or-odd-2.ps1 diff --git a/Task/Even-or-odd/PowerShell/even-or-odd-3.psh b/Task/Even-or-odd/PowerShell/even-or-odd-3.ps1 similarity index 100% rename from Task/Even-or-odd/PowerShell/even-or-odd-3.psh rename to Task/Even-or-odd/PowerShell/even-or-odd-3.ps1 diff --git a/Task/Even-or-odd/ReScript/even-or-odd.re b/Task/Even-or-odd/ReScript/even-or-odd.res similarity index 100% rename from Task/Even-or-odd/ReScript/even-or-odd.re rename to Task/Even-or-odd/ReScript/even-or-odd.res diff --git a/Task/Even-or-odd/Rust/even-or-odd-1.rust b/Task/Even-or-odd/Rust/even-or-odd-1.rs similarity index 100% rename from Task/Even-or-odd/Rust/even-or-odd-1.rust rename to Task/Even-or-odd/Rust/even-or-odd-1.rs diff --git a/Task/Even-or-odd/Rust/even-or-odd-2.rust b/Task/Even-or-odd/Rust/even-or-odd-2.rs similarity index 100% rename from Task/Even-or-odd/Rust/even-or-odd-2.rust rename to Task/Even-or-odd/Rust/even-or-odd-2.rs diff --git a/Task/Even-or-odd/Rye/even-or-odd.rye b/Task/Even-or-odd/Rye/even-or-odd.rye new file mode 100644 index 0000000000..c1822096c6 --- /dev/null +++ b/Task/Even-or-odd/Rye/even-or-odd.rye @@ -0,0 +1,2 @@ +print is-even 2 +print is-odd 2 diff --git a/Task/Even-or-odd/Scheme/even-or-odd.ss b/Task/Even-or-odd/Scheme/even-or-odd.scm similarity index 100% rename from Task/Even-or-odd/Scheme/even-or-odd.ss rename to Task/Even-or-odd/Scheme/even-or-odd.scm diff --git a/Task/Even-or-odd/Swift/even-or-odd.swift b/Task/Even-or-odd/Swift/even-or-odd.swift index a697ee6e29..d1923eb659 100644 --- a/Task/Even-or-odd/Swift/even-or-odd.swift +++ b/Task/Even-or-odd/Swift/even-or-odd.swift @@ -1,13 +1,3 @@ -func isEven(n:Int) -> Bool { +// Swift has Int.isMultiple(of:Int) -> Bool - // Bitwise check - if (n & 1 != 0) { - return false - } - - // Mod check - if (n % 2 != 0) { - return false - } - return true -} +var isEven: (_:Int) -> Bool = {$0.isMultiple(of: 2)} diff --git a/Task/Even-or-odd/VBScript/even-or-odd.vb b/Task/Even-or-odd/VBScript/even-or-odd.vbs similarity index 100% rename from Task/Even-or-odd/VBScript/even-or-odd.vb rename to Task/Even-or-odd/VBScript/even-or-odd.vbs diff --git a/Task/Even-or-odd/Wren/even-or-odd.wren b/Task/Even-or-odd/Wren/even-or-odd.wren index a081e12c32..b2801820b1 100644 --- a/Task/Even-or-odd/Wren/even-or-odd.wren +++ b/Task/Even-or-odd/Wren/even-or-odd.wren @@ -1,4 +1,4 @@ -import "/fmt" for Fmt +import "./fmt" for Fmt var isEven1 = Fn.new { |i| i & 1 == 0 } diff --git a/Task/Even-or-odd/YAMLScript/even-or-odd.ys b/Task/Even-or-odd/YAMLScript/even-or-odd.ys new file mode 100644 index 0000000000..36ee519cd2 --- /dev/null +++ b/Task/Even-or-odd/YAMLScript/even-or-odd.ys @@ -0,0 +1,7 @@ +!YS-v0 + +defn main(*xs): + each x xs: + if x:even?: + say: "$x is even" + say: "$x is odd" diff --git a/Task/Events/Ada/events-1.ada b/Task/Events/Ada/events-1.adb similarity index 100% rename from Task/Events/Ada/events-1.ada rename to Task/Events/Ada/events-1.adb diff --git a/Task/Events/Ada/events-2.ada b/Task/Events/Ada/events-2.adb similarity index 100% rename from Task/Events/Ada/events-2.ada rename to Task/Events/Ada/events-2.adb diff --git a/Task/Events/Ada/events-3.ada b/Task/Events/Ada/events-3.adb similarity index 100% rename from Task/Events/Ada/events-3.ada rename to Task/Events/Ada/events-3.adb diff --git a/Task/Events/Delphi/events.delphi b/Task/Events/Delphi/events.pas similarity index 100% rename from Task/Events/Delphi/events.delphi rename to Task/Events/Delphi/events.pas diff --git a/Task/Events/EasyLang/events.easy b/Task/Events/EasyLang/events.easy new file mode 100644 index 0000000000..18092d262e --- /dev/null +++ b/Task/Events/EasyLang/events.easy @@ -0,0 +1,8 @@ +on timer + gcircle randomf * 100 randomf * 100 2 + timer 1 +. +on mouse_down + gcircle mouse_x mouse_y 2 +. +timer 0 diff --git a/Task/Events/Elixir/events.elixir b/Task/Events/Elixir/events.ex similarity index 100% rename from Task/Events/Elixir/events.elixir rename to Task/Events/Elixir/events.ex diff --git a/Task/Events/Java/events.java b/Task/Events/Java/events.java new file mode 100644 index 0000000000..67effa5bba --- /dev/null +++ b/Task/Events/Java/events.java @@ -0,0 +1,18 @@ +import java.util.Timer; +import java.util.TimerTask; +import java.util.Date; + +public class Main { + public static void main(String[] args) { + Timer timer = new Timer(); + TimerTask task = new TimerTask() { + @Override + public void run() { + System.out.println(new Date()); + timer.cancel(); + } + }; + System.out.println(new Date()); + timer.schedule(task, 1000); + } +} diff --git a/Task/Events/Julia/events.julia b/Task/Events/Julia/events.jl similarity index 100% rename from Task/Events/Julia/events.julia rename to Task/Events/Julia/events.jl diff --git a/Task/Events/PascalABC.NET/events.pas b/Task/Events/PascalABC.NET/events.pas new file mode 100644 index 0000000000..7f24ba7e63 --- /dev/null +++ b/Task/Events/PascalABC.NET/events.pas @@ -0,0 +1,13 @@ +procedure OnElapsed(sender: object; eventArgs: System.Timers.ElapsedEventArgs); +begin + Writeln(eventArgs.SignalTime); + system.Timers.Timer(sender).Stop; +end; + +begin + var timer := System.Timers.Timer.Create(1000); + timer.Elapsed += OnElapsed; + Writeln(DateTime.Now); + timer.Start; + Console.ReadLine; +end. diff --git a/Task/Events/PowerShell/events.psh b/Task/Events/PowerShell/events.ps1 similarity index 100% rename from Task/Events/PowerShell/events.psh rename to Task/Events/PowerShell/events.ps1 diff --git a/Task/Events/Rust/events.rust b/Task/Events/Rust/events.rs similarity index 100% rename from Task/Events/Rust/events.rust rename to Task/Events/Rust/events.rs diff --git a/Task/Evolutionary-algorithm/8080-Assembly/evolutionary-algorithm.8080 b/Task/Evolutionary-algorithm/8080-Assembly/evolutionary-algorithm.8080 index dafadfb1b4..bebda07f74 100644 --- a/Task/Evolutionary-algorithm/8080-Assembly/evolutionary-algorithm.8080 +++ b/Task/Evolutionary-algorithm/8080-Assembly/evolutionary-algorithm.8080 @@ -1,162 +1,162 @@ -MRATE: equ 26 ; Chance of mutation (MRATE/256) -COPIES: equ 100 ; Amount of copies to make -fname1: equ 5Dh ; First filename on command line (used for RNG seed) -fname2: equ 6Dh ; Second filename (also used for RNG seed) - org 100h - ;;; Make random seed from the two CP/M 'filenames' - lxi b,rnddat - lxi h,fname1 - xra a - call seed ; First four bytes from fn1 make X - call seed ; Second four bytes from fn1 make A - mvi l,fname2 - call seed ; First four bytes from fn2 make B - call seed ; Second four bytes from fn2 make C - ;;; Create the first parent (random string) - lxi h,parent - mvi e,tgtsz-1 -genchr: call rndchr ; Get random character - mov m,a ; Store it - inx h - dcr e - jnz genchr - mvi m,'$' ; CP/M string terminator - ;;; Main loop -loop: lxi d,parent - push d - call puts ; Print current parent - pop h ; Calculate fitness - call fitnes - xra a ; If it is 0, all characters match, - ora d - rz ; So we stop. - lxi h,kids ; Otherwise, set HL to start of children, - mvi a,0FFh ; Initialize maximum fitness value - sta maxfit - mvi a,COPIES ; Initialize copy counter - sta copies - ;;; Make copies -copy: push h ; Store the place where the copy will go - call mutcpy ; Make a mutated copy of the parent - pop h ; Get the place where the copy went - push h ; But keep it on the stack - call fitnes ; Calculate the fitness of that copy - pop h ; Get place where copy went - lda maxfit ; Get current best fitness - cmp d ; Compare to fitness of current copy - jc next ; If it wasn't better, next copy - shld maxptr ; If it was better, store pointer - mov a,d - sta maxfit ; And new max fitness -next: lxi b,tgtsz ; Get place for next copy - dad b - xchg ; Keep in DE - lxi h,copies - dcr m ; Any copies left to make? - xchg - jnz copy ; Then make another copy - lhld maxptr ; Otherwise, get location of copy with best fitness - lxi b,parent ; Make that the new parent -pcopy: mov a,m ; Get character from copy - inx h - stax b ; Store into location of parent - inx b - cpi '$' ; Check for string terminator - jnz pcopy ; If it isn't, copy next character - jmp loop ; Otherwise, mutate new parent - ;;; Make a copy of the parent, mutate it, and store it at [HL]. -mutcpy: lxi b,parent -mcloop: ldax b ; Get current character - inx b - mov m,a ; Write it to new location - inx h - cpi '$' ; Was it the string terminator? - rz ; Then stop - call rand ; Otherwise, get random value - cpi MRATE ; Should we mutate this character? - jnc mcloop ; If not, just copy next character - call rndchr ; Otherwise, get a random character - dcx h ; And store it instead of the character we had - mov m,a - inx h - jmp mcloop - ;;; Calculate fitness of candidate under [HL], fitness is - ;;; returned in D. Fitness is "inverted", i.e. a fitness of 0 - ;;; means everything matches. -fitnes: lxi b,target - lxi d,tgtsz ; E=counter, D=fitness -floop: dcr e ; Done yet? - rz ; If so, return. - ldax b ; Get target character - inx b - cmp m ; Compare to current character - inx h - jz floop ; If they match, don't do anything - inr d ; If they don't match, count this - jmp floop - ;;; Generate a random uppercase letter, or a space - ;;; Return in A, other registers preserved -rndchr: call rand ; Get a random value - ani 31 ; from 0 to 31 - cpi 28 ; If 28 or higher, - jnc rndchr ; get another value - adi 'A' ; Make uppercase letter - cpi 'Z'+1 ; If the result is 'Z' or lower, - rc ; then return it, - mvi a,' ' ; otherwise return a space - ret - ;;; Load 4 bytes from [HL] and use them, plus A, as part of seed - ;;; in [BC] -seed: mvi e,4 ; 4 bytes -sloop: xra m - inx h - dcr e - jnz sloop - stax b - inx b - ret - ;;; Random number generator using XABC algorithm -rand: push h - lxi h,rnddat - inr m ; X++ - mov a,m ; X - inx h - xra m ; ^ C - inx h - xra m ; ^ A - mov m,a ; -> A - inx h - add m ; + B - mov m,a ; -> B - rar ; >>1 (ish) - dcx h - xra m ; ^ A - dcx h - add m ; + C - mov m,a ; -> C - pop h - ret - ;;; Print string to console using CP/M, saving all registers -puts: push h - push d - push b - push psw - mvi c,9 ; CP/M print string - call 5 - lxi d,nl ; Print a newline as well - mvi c,9 - call 5 - pop b - pop d - pop h - pop psw - ret -nl: db 13,10,'$' -target: db 'METHINKS IT IS LIKE A WEASEL$' -tgtsz: equ $-target -rnddat: ds 4 ; RNG state -copies: ds 1 ; Copies left to make -maxfit: ds 1 ; Best fitness seen -maxptr: ds 2 ; Pointer to copy with best fitness -parent: equ $ ; Store current parent here -kids: equ $+tgtsz ; Store mutated copies here +MRATE: equ 26 ; Chance of mutation (MRATE/256) +COPIES: equ 100 ; Amount of copies to make +fname1: equ 5Dh ; First filename on command line (used for RNG seed) +fname2: equ 6Dh ; Second filename (also used for RNG seed) + org 100h + ;;; Make random seed from the two CP/M 'filenames' + lxi b,rnddat + lxi h,fname1 + xra a + call seed ; First four bytes from fn1 make X + call seed ; Second four bytes from fn1 make A + mvi l,fname2 + call seed ; First four bytes from fn2 make B + call seed ; Second four bytes from fn2 make C + ;;; Create the first parent (random string) + lxi h,parent + mvi e,tgtsz-1 +genchr: call rndchr ; Get random character + mov m,a ; Store it + inx h + dcr e + jnz genchr + mvi m,'$' ; CP/M string terminator + ;;; Main loop +loop: lxi d,parent + push d + call puts ; Print current parent + pop h ; Calculate fitness + call fitnes + xra a ; If it is 0, all characters match, + ora d + rz ; So we stop. + lxi h,kids ; Otherwise, set HL to start of children, + mvi a,0FFh ; Initialize maximum fitness value + sta maxfit + mvi a,COPIES ; Initialize copy counter + sta copies + ;;; Make copies +copy: push h ; Store the place where the copy will go + call mutcpy ; Make a mutated copy of the parent + pop h ; Get the place where the copy went + push h ; But keep it on the stack + call fitnes ; Calculate the fitness of that copy + pop h ; Get place where copy went + lda maxfit ; Get current best fitness + cmp d ; Compare to fitness of current copy + jc next ; If it wasn't better, next copy + shld maxptr ; If it was better, store pointer + mov a,d + sta maxfit ; And new max fitness +next: lxi b,tgtsz ; Get place for next copy + dad b + xchg ; Keep in DE + lxi h,copies + dcr m ; Any copies left to make? + xchg + jnz copy ; Then make another copy + lhld maxptr ; Otherwise, get location of copy with best fitness + lxi b,parent ; Make that the new parent +pcopy: mov a,m ; Get character from copy + inx h + stax b ; Store into location of parent + inx b + cpi '$' ; Check for string terminator + jnz pcopy ; If it isn't, copy next character + jmp loop ; Otherwise, mutate new parent + ;;; Make a copy of the parent, mutate it, and store it at [HL]. +mutcpy: lxi b,parent +mcloop: ldax b ; Get current character + inx b + mov m,a ; Write it to new location + inx h + cpi '$' ; Was it the string terminator? + rz ; Then stop + call rand ; Otherwise, get random value + cpi MRATE ; Should we mutate this character? + jnc mcloop ; If not, just copy next character + call rndchr ; Otherwise, get a random character + dcx h ; And store it instead of the character we had + mov m,a + inx h + jmp mcloop + ;;; Calculate fitness of candidate under [HL], fitness is + ;;; returned in D. Fitness is "inverted", i.e. a fitness of 0 + ;;; means everything matches. +fitnes: lxi b,target + lxi d,tgtsz ; E=counter, D=fitness +floop: dcr e ; Done yet? + rz ; If so, return. + ldax b ; Get target character + inx b + cmp m ; Compare to current character + inx h + jz floop ; If they match, don't do anything + inr d ; If they don't match, count this + jmp floop + ;;; Generate a random uppercase letter, or a space + ;;; Return in A, other registers preserved +rndchr: call rand ; Get a random value + ani 31 ; from 0 to 31 + cpi 28 ; If 28 or higher, + jnc rndchr ; get another value + adi 'A' ; Make uppercase letter + cpi 'Z'+1 ; If the result is 'Z' or lower, + rc ; then return it, + mvi a,' ' ; otherwise return a space + ret + ;;; Load 4 bytes from [HL] and use them, plus A, as part of seed + ;;; in [BC] +seed: mvi e,4 ; 4 bytes +sloop: xra m + inx h + dcr e + jnz sloop + stax b + inx b + ret + ;;; Random number generator using XABC algorithm +rand: push h + lxi h,rnddat + inr m ; X++ + mov a,m ; X + inx h + xra m ; ^ C + inx h + xra m ; ^ A + mov m,a ; -> A + inx h + add m ; + B + mov m,a ; -> B + rar ; >>1 (ish) + dcx h + xra m ; ^ A + dcx h + add m ; + C + mov m,a ; -> C + pop h + ret + ;;; Print string to console using CP/M, saving all registers +puts: push h + push d + push b + push psw + mvi c,9 ; CP/M print string + call 5 + lxi d,nl ; Print a newline as well + mvi c,9 + call 5 + pop b + pop d + pop h + pop psw + ret +nl: db 13,10,'$' +target: db 'METHINKS IT IS LIKE A WEASEL$' +tgtsz: equ $-target +rnddat: ds 4 ; RNG state +copies: ds 1 ; Copies left to make +maxfit: ds 1 ; Best fitness seen +maxptr: ds 2 ; Pointer to copy with best fitness +parent: equ $ ; Store current parent here +kids: equ $+tgtsz ; Store mutated copies here diff --git a/Task/Evolutionary-algorithm/8086-Assembly/evolutionary-algorithm.8086 b/Task/Evolutionary-algorithm/8086-Assembly/evolutionary-algorithm.8086 index 9b3c1c704f..e38567385b 100644 --- a/Task/Evolutionary-algorithm/8086-Assembly/evolutionary-algorithm.8086 +++ b/Task/Evolutionary-algorithm/8086-Assembly/evolutionary-algorithm.8086 @@ -1,123 +1,123 @@ - bits 16 - cpu 8086 -MRATE: equ 26 ; Mutation rate (MRATE/256) -COPIES: equ 100 ; Amount of copies to make -gettim: equ 02Ch ; MS-DOS get time function -pstr: equ 9 ; MS-DOS print string -section .text - org 100h - ;;; Use MS-DOS time to set random seed - mov ah,gettim - int 21h - mov [rnddat],cx - mov [rnddat+2],dx - ;;; Make first parent (random characters) - mov di,parent - mov cx,target.size-1 -getchr: call rndchr ; Get random character - stosb ; Store in parent - loop getchr - mov al,'$' ; Write string terminator - stosb - ;;; Main loop. -loop: mov bx,parent ; Print current parent - mov dx,bx - call puts - call fitnes ; Check fitness - test cl,cl ; If zero, we're done - jnz nxmut ; If not, do another mutation - ret ; Quit to DOS -nxmut: mov dl,0FFh ; DL = best fitness yet - mov di,kids ; Set DI to start of memory for children - mov ch,COPIES ; CH = amount of copies to make - xor bp,bp - ;;; Make copy, mutate, and test fitness -copy: mov bx,di ; Let BX = where next copy will go - call mutcpy ; Make the copy (and adjust DI) - call fitnes ; Check fitness - cmp cl,dl ; Is it better than the previous best one? - ja next ; If not, just do the next one, - mov dl,cl ; Otherwise, this is now the best one - lea bp,[di-target.size] ; Store a pointer to it in BP -next: dec ch ; One copy less - jnz copy ; Make another copy if we need to - mov si,bp ; We're done, the best child becomes - mov di,parent ; the parent for the next generation - mov cx,target.size - rep movsb - jmp loop ; Next generation - ;;; Make copy of parent, mutating as we go, and store at [DI] -mutcpy: mov si,parent -.loop: lodsb ; Get byte from parent - stosb ; Store in copy - cmp al,'$' ; Is it '$'? - je .out ; Then we're done - call rand ; Otherwise, should we mutate? - cmp al,MRATE - ja .loop ; If not, do next character - call rndchr ; But if so, get random character, - mov [di-1],al ; and overwrite the current character. - jmp .loop ; Then do the next character. -.out: ret - ;;; Get fitness of character in [BX] -fitnes: mov si,target - xor cl,cl ; Fitness -.loop: lodsb ; Get target character - cmp al,'$' ; Done? - je .out ; Then stop - cmp al,[bx] ; Equal to character under [BX]? - lahf ; Keep flags - inc bx ; Increment BX - sahf ; Restore flags (was al=[bx]?) - je .loop ; If equal, do next character - inc cx ; Otherwise, count this as a mismatch - jmp .loop -.out: ret - ;;; Generate random character, [A-Z] or space. -rndchr: call rand ; Get random number - and al,31 ; Lower five bits - cmp al,27 ; One of 27 characters? - jae rndchr ; If not, get new random number - add al,'A' ; Make uppercase letter - cmp al,'Z' ; More than 'Z'? - jbe .out ; If not, it's OK - mov al,' ' ; Otherwise, give a space -.out: ret - ;;; Random number generator using XABC algorithm - ;;; Returns random byte in AL -rand: push cx - push dx - mov cx,[rnddat] ; CH=X CL=A - mov dx,[rnddat+2] ; DH=B DL=C - inc ch ; X++ - xor cl,ch ; A ^= X - xor cl,dl ; A ^= C - add dh,cl ; B += A - mov al,dh ; C' = B - shr al,1 ; C' >>= 1 - xor al,cl ; C' ^= A - add al,dl ; C' += C - mov dl,al ; C = C' - mov [rnddat],cx - mov [rnddat+2],dx - pop dx - pop cx - ret - ;;; Print string in DX, plus a newline, saving registers -puts: push ax - push dx - mov ah,pstr - int 21h - mov dx,nl - int 21h - pop dx - pop ax - ret -section .data -nl: db 13,10,'$' -target: db 'METHINKS IT IS LIKE A WEASEL$' -.size: equ $-target -section .bss -rnddat: resb 4 ; RNG state -parent: resb target.size ; Place to store current parent -kids: resb COPIES*target.size ; Place to store children + bits 16 + cpu 8086 +MRATE: equ 26 ; Mutation rate (MRATE/256) +COPIES: equ 100 ; Amount of copies to make +gettim: equ 02Ch ; MS-DOS get time function +pstr: equ 9 ; MS-DOS print string +section .text + org 100h + ;;; Use MS-DOS time to set random seed + mov ah,gettim + int 21h + mov [rnddat],cx + mov [rnddat+2],dx + ;;; Make first parent (random characters) + mov di,parent + mov cx,target.size-1 +getchr: call rndchr ; Get random character + stosb ; Store in parent + loop getchr + mov al,'$' ; Write string terminator + stosb + ;;; Main loop. +loop: mov bx,parent ; Print current parent + mov dx,bx + call puts + call fitnes ; Check fitness + test cl,cl ; If zero, we're done + jnz nxmut ; If not, do another mutation + ret ; Quit to DOS +nxmut: mov dl,0FFh ; DL = best fitness yet + mov di,kids ; Set DI to start of memory for children + mov ch,COPIES ; CH = amount of copies to make + xor bp,bp + ;;; Make copy, mutate, and test fitness +copy: mov bx,di ; Let BX = where next copy will go + call mutcpy ; Make the copy (and adjust DI) + call fitnes ; Check fitness + cmp cl,dl ; Is it better than the previous best one? + ja next ; If not, just do the next one, + mov dl,cl ; Otherwise, this is now the best one + lea bp,[di-target.size] ; Store a pointer to it in BP +next: dec ch ; One copy less + jnz copy ; Make another copy if we need to + mov si,bp ; We're done, the best child becomes + mov di,parent ; the parent for the next generation + mov cx,target.size + rep movsb + jmp loop ; Next generation + ;;; Make copy of parent, mutating as we go, and store at [DI] +mutcpy: mov si,parent +.loop: lodsb ; Get byte from parent + stosb ; Store in copy + cmp al,'$' ; Is it '$'? + je .out ; Then we're done + call rand ; Otherwise, should we mutate? + cmp al,MRATE + ja .loop ; If not, do next character + call rndchr ; But if so, get random character, + mov [di-1],al ; and overwrite the current character. + jmp .loop ; Then do the next character. +.out: ret + ;;; Get fitness of character in [BX] +fitnes: mov si,target + xor cl,cl ; Fitness +.loop: lodsb ; Get target character + cmp al,'$' ; Done? + je .out ; Then stop + cmp al,[bx] ; Equal to character under [BX]? + lahf ; Keep flags + inc bx ; Increment BX + sahf ; Restore flags (was al=[bx]?) + je .loop ; If equal, do next character + inc cx ; Otherwise, count this as a mismatch + jmp .loop +.out: ret + ;;; Generate random character, [A-Z] or space. +rndchr: call rand ; Get random number + and al,31 ; Lower five bits + cmp al,27 ; One of 27 characters? + jae rndchr ; If not, get new random number + add al,'A' ; Make uppercase letter + cmp al,'Z' ; More than 'Z'? + jbe .out ; If not, it's OK + mov al,' ' ; Otherwise, give a space +.out: ret + ;;; Random number generator using XABC algorithm + ;;; Returns random byte in AL +rand: push cx + push dx + mov cx,[rnddat] ; CH=X CL=A + mov dx,[rnddat+2] ; DH=B DL=C + inc ch ; X++ + xor cl,ch ; A ^= X + xor cl,dl ; A ^= C + add dh,cl ; B += A + mov al,dh ; C' = B + shr al,1 ; C' >>= 1 + xor al,cl ; C' ^= A + add al,dl ; C' += C + mov dl,al ; C = C' + mov [rnddat],cx + mov [rnddat+2],dx + pop dx + pop cx + ret + ;;; Print string in DX, plus a newline, saving registers +puts: push ax + push dx + mov ah,pstr + int 21h + mov dx,nl + int 21h + pop dx + pop ax + ret +section .data +nl: db 13,10,'$' +target: db 'METHINKS IT IS LIKE A WEASEL$' +.size: equ $-target +section .bss +rnddat: resb 4 ; RNG state +parent: resb target.size ; Place to store current parent +kids: resb COPIES*target.size ; Place to store children diff --git a/Task/Evolutionary-algorithm/ABC/evolutionary-algorithm.abc b/Task/Evolutionary-algorithm/ABC/evolutionary-algorithm.abc new file mode 100644 index 0000000000..8b34ace597 --- /dev/null +++ b/Task/Evolutionary-algorithm/ABC/evolutionary-algorithm.abc @@ -0,0 +1,39 @@ +PUT "ABCDEFGHIJKLMNOPQRSTUVWXYZ " IN alphabet + +HOW TO RETURN initial.state target: + SHARE alphabet + PUT "" IN state + FOR c IN target: PUT state^choice alphabet IN state + RETURN state + +HOW TO RETURN state fitness target: + PUT #target IN score + FOR i IN {1..#target}: + IF state item i = target item i: PUT score-1 IN score + RETURN score + +HOW TO RETURN chance mutate state: + SHARE alphabet + PUT "" IN mutated + FOR i IN {1..#state}: + SELECT: + random < chance: PUT choice alphabet IN next + ELSE: PUT state item i IN next + PUT mutated^next IN mutated + RETURN mutated + +HOW TO EVOLVE TOWARD target: + PUT 0.1 IN mutation.rate + PUT 100 IN generation.size + PUT initial.state target IN state + WHILE state fitness target > 0: + WRITE (state fitness target)>>2, ": ", state/ + PUT {} IN next.generation + FOR i IN {1..generation.size}: + PUT mutation.rate mutate state IN child + PUT child fitness target IN score + PUT child IN next.generation[score] + PUT next.generation[min keys next.generation] IN state + WRITE (state fitness target)>>2, ": ", state/ + +EVOLVE TOWARD "METHINKS IT IS LIKE A WEASEL" diff --git a/Task/Evolutionary-algorithm/Ada/evolutionary-algorithm.ada b/Task/Evolutionary-algorithm/Ada/evolutionary-algorithm.adb similarity index 100% rename from Task/Evolutionary-algorithm/Ada/evolutionary-algorithm.ada rename to Task/Evolutionary-algorithm/Ada/evolutionary-algorithm.adb diff --git a/Task/Evolutionary-algorithm/Arturo/evolutionary-algorithm.arturo b/Task/Evolutionary-algorithm/Arturo/evolutionary-algorithm.arturo index 06f157c7f5..a816314b35 100644 --- a/Task/Evolutionary-algorithm/Arturo/evolutionary-algorithm.arturo +++ b/Task/Evolutionary-algorithm/Arturo/evolutionary-algorithm.arturo @@ -1,5 +1,5 @@ target: "METHINKS IT IS LIKE A WEASEL" -alphabet: [` `] ++ @`A`..`Z` +alphabet: [' '] ++ @'A'..'Z' p: 0.05 c: 100 diff --git a/Task/Evolutionary-algorithm/AutoHotkey/evolutionary-algorithm.ahk b/Task/Evolutionary-algorithm/AutoHotkey/evolutionary-algorithm.ahk index 003524e349..f38f1ef32d 100644 --- a/Task/Evolutionary-algorithm/AutoHotkey/evolutionary-algorithm.ahk +++ b/Task/Evolutionary-algorithm/AutoHotkey/evolutionary-algorithm.ahk @@ -2,55 +2,55 @@ output := "" target := "METHINKS IT IS LIKE A WEASEL" targetLen := StrLen(target) Loop, 26 - possibilities_%A_Index% := Chr(A_Index+64) ; A-Z + possibilities_%A_Index% := Chr(A_Index+64) ; A-Z possibilities_27 := " " C := 100 parent := "" Loop, %targetLen% { - Random, randomNum, 1, 27 + Random, randomNum, 1, 27 parent .= possibilities_%randomNum% } Loop, { - If (target = parent) - Break - If (Mod(A_Index,10) = 0) - output .= A_Index ": " parent ", fitness: " fitness(parent, target) "`n" - bestFit := 0 - Loop, %C% - If ((fitness := fitness(spawn := mutate(parent), target)) > bestFit) - bestSpawn := spawn , bestFit := fitness - parent := bestFit > fitness(parent, target) ? bestSpawn : parent - iter := A_Index + If (target = parent) + Break + If (Mod(A_Index,10) = 0) + output .= A_Index ": " parent ", fitness: " fitness(parent, target) "`n" + bestFit := 0 + Loop, %C% + If ((fitness := fitness(spawn := mutate(parent), target)) > bestFit) + bestSpawn := spawn , bestFit := fitness + parent := bestFit > fitness(parent, target) ? bestSpawn : parent + iter := A_Index } output .= parent ", " iter MsgBox, % output ExitApp mutate(parent) { - local output, replaceChar, newChar - output := "" - Loop, %targetLen% - { - Random, replaceChar, 0, 9 - If (replaceChar != 0) - output .= SubStr(parent, A_Index, 1) - else - { - Random, newChar, 1, 27 - output .= possibilities_%newChar% - } - } - Return output + local output, replaceChar, newChar + output := "" + Loop, %targetLen% + { + Random, replaceChar, 0, 9 + If (replaceChar != 0) + output .= SubStr(parent, A_Index, 1) + else + { + Random, newChar, 1, 27 + output .= possibilities_%newChar% + } + } + Return output } fitness(string, target) { - totalFit := 0 - Loop, % StrLen(string) - If (SubStr(string, A_Index, 1) = SubStr(target, A_Index, 1)) - totalFit++ - Return totalFit + totalFit := 0 + Loop, % StrLen(string) + If (SubStr(string, A_Index, 1) = SubStr(target, A_Index, 1)) + totalFit++ + Return totalFit } diff --git a/Task/Evolutionary-algorithm/C/evolutionary-algorithm-1.c b/Task/Evolutionary-algorithm/C/evolutionary-algorithm-1.c index 1cf726bc37..682c8e6ae6 100644 --- a/Task/Evolutionary-algorithm/C/evolutionary-algorithm-1.c +++ b/Task/Evolutionary-algorithm/C/evolutionary-algorithm-1.c @@ -12,56 +12,56 @@ const char tbl[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ "; /* returns random integer from 0 to n - 1 */ int irand(int n) { - int r, rand_max = RAND_MAX - (RAND_MAX % n); - while((r = rand()) >= rand_max); - return r / (rand_max / n); + int r, rand_max = RAND_MAX - (RAND_MAX % n); + while((r = rand()) >= rand_max); + return r / (rand_max / n); } /* number of different chars between a and b */ int unfitness(const char *a, const char *b) { - int i, sum = 0; - for (i = 0; a[i]; i++) - sum += (a[i] != b[i]); - return sum; + int i, sum = 0; + for (i = 0; a[i]; i++) + sum += (a[i] != b[i]); + return sum; } /* each char of b has 1/MUTATE chance of differing from a */ void mutate(const char *a, char *b) { - int i; - for (i = 0; a[i]; i++) - b[i] = irand(MUTATE) ? a[i] : tbl[irand(CHOICE)]; + int i; + for (i = 0; a[i]; i++) + b[i] = irand(MUTATE) ? a[i] : tbl[irand(CHOICE)]; - b[i] = '\0'; + b[i] = '\0'; } int main() { - int i, best_i, unfit, best, iters = 0; - char specimen[COPIES][sizeof(target) / sizeof(char)]; + int i, best_i, unfit, best, iters = 0; + char specimen[COPIES][sizeof(target) / sizeof(char)]; - /* init rand string */ - for (i = 0; target[i]; i++) - specimen[0][i] = tbl[irand(CHOICE)]; - specimen[0][i] = 0; + /* init rand string */ + for (i = 0; target[i]; i++) + specimen[0][i] = tbl[irand(CHOICE)]; + specimen[0][i] = 0; - do { - for (i = 1; i < COPIES; i++) - mutate(specimen[0], specimen[i]); + do { + for (i = 1; i < COPIES; i++) + mutate(specimen[0], specimen[i]); - /* find best fitting string */ - for (best_i = i = 0; i < COPIES; i++) { - unfit = unfitness(target, specimen[i]); - if(unfit < best || !i) { - best = unfit; - best_i = i; - } - } + /* find best fitting string */ + for (best_i = i = 0; i < COPIES; i++) { + unfit = unfitness(target, specimen[i]); + if(unfit < best || !i) { + best = unfit; + best_i = i; + } + } - if (best_i) strcpy(specimen[0], specimen[best_i]); - printf("iter %d, score %d: %s\n", iters++, best, specimen[0]); - } while (best); + if (best_i) strcpy(specimen[0], specimen[best_i]); + printf("iter %d, score %d: %s\n", iters++, best, specimen[0]); + } while (best); - return 0; + return 0; } diff --git a/Task/Evolutionary-algorithm/COBOL/evolutionary-algorithm.cobol b/Task/Evolutionary-algorithm/COBOL/evolutionary-algorithm.cob similarity index 100% rename from Task/Evolutionary-algorithm/COBOL/evolutionary-algorithm.cobol rename to Task/Evolutionary-algorithm/COBOL/evolutionary-algorithm.cob diff --git a/Task/Evolutionary-algorithm/Ceylon/evolutionary-algorithm.ceylon b/Task/Evolutionary-algorithm/Ceylon/evolutionary-algorithm.ceylon index 2c501ca07d..4ff54da5dd 100644 --- a/Task/Evolutionary-algorithm/Ceylon/evolutionary-algorithm.ceylon +++ b/Task/Evolutionary-algorithm/Ceylon/evolutionary-algorithm.ceylon @@ -1,49 +1,49 @@ import ceylon.random { - - DefaultRandom + + DefaultRandom } shared void run() { - - value mutationRate = 0.05; - value childrenPerGeneration = 100; - value target = "METHINKS IT IS LIKE A WEASEL"; - value alphabet = {' ', *('A'..'Z')}; - value random = DefaultRandom(); - - value randomLetter => random.nextElement(alphabet); - - function fitness(String a, String b) => - count {for([c1, c2] in zipPairs(a, b)) c1 == c2}; - - function mutate(String string) => - String { - for(letter in string) - if(random.nextFloat() < mutationRate) - then randomLetter - else letter - }; - - function makeCopies(String string) => - {for(i in 1..childrenPerGeneration) mutate(string)}; - - function chooseFittest(String+ children) => - children - .map((String element) => element->fitness(element, target)) - .max(increasingItem) - .key; - - variable value parent = String {for(i in 1..target.size) randomLetter}; - variable value generationCount = 0; - function display() => print("``generationCount``: ``parent``"); - - display(); - while(parent != target) { - parent = chooseFittest(parent, *makeCopies(parent)); - generationCount++; - display(); - } - - print("mutated into target in ``generationCount`` generations!"); - + + value mutationRate = 0.05; + value childrenPerGeneration = 100; + value target = "METHINKS IT IS LIKE A WEASEL"; + value alphabet = {' ', *('A'..'Z')}; + value random = DefaultRandom(); + + value randomLetter => random.nextElement(alphabet); + + function fitness(String a, String b) => + count {for([c1, c2] in zipPairs(a, b)) c1 == c2}; + + function mutate(String string) => + String { + for(letter in string) + if(random.nextFloat() < mutationRate) + then randomLetter + else letter + }; + + function makeCopies(String string) => + {for(i in 1..childrenPerGeneration) mutate(string)}; + + function chooseFittest(String+ children) => + children + .map((String element) => element->fitness(element, target)) + .max(increasingItem) + .key; + + variable value parent = String {for(i in 1..target.size) randomLetter}; + variable value generationCount = 0; + function display() => print("``generationCount``: ``parent``"); + + display(); + while(parent != target) { + parent = chooseFittest(parent, *makeCopies(parent)); + generationCount++; + display(); + } + + print("mutated into target in ``generationCount`` generations!"); + } diff --git a/Task/Evolutionary-algorithm/Common-Lisp/evolutionary-algorithm-2.lisp b/Task/Evolutionary-algorithm/Common-Lisp/evolutionary-algorithm-2.lisp index 0d38dbc62d..838aa4eaa5 100644 --- a/Task/Evolutionary-algorithm/Common-Lisp/evolutionary-algorithm-2.lisp +++ b/Task/Evolutionary-algorithm/Common-Lisp/evolutionary-algorithm-2.lisp @@ -1,23 +1,23 @@ (defun unfit (s1 s2) (loop for a across s1 - for b across s2 count(char/= a b))) + for b across s2 count(char/= a b))) (defun mutate (str alp n) ; n: number of chars to mutate (let ((out (copy-seq str))) (dotimes (i n) (setf (char out (random (length str))) - (char alp (random (length alp))))) + (char alp (random (length alp))))) out)) (defun evolve (changes alpha target) (loop for gen from 1 - with f2 with s2 - with str = (mutate target alpha 100) - with fit = (unfit target str) - while (plusp fit) do - (setf s2 (mutate str alpha changes) - f2 (unfit target s2)) - (when (> fit f2) - (setf str s2 fit f2) - (format t "~5d: ~a (~d)~%" gen str fit)))) + with f2 with s2 + with str = (mutate target alpha 100) + with fit = (unfit target str) + while (plusp fit) do + (setf s2 (mutate str alpha changes) + f2 (unfit target s2)) + (when (> fit f2) + (setf str s2 fit f2) + (format t "~5d: ~a (~d)~%" gen str fit)))) (evolve 1 " ABCDEFGHIJKLMNOPQRSTUVWXYZ" "METHINKS IT IS LIKE A WEASEL") diff --git a/Task/Evolutionary-algorithm/Crystal/evolutionary-algorithm.cr b/Task/Evolutionary-algorithm/Crystal/evolutionary-algorithm.cr new file mode 100644 index 0000000000..b38ba00a51 --- /dev/null +++ b/Task/Evolutionary-algorithm/Crystal/evolutionary-algorithm.cr @@ -0,0 +1,33 @@ +TARGET = "METHINKS IT IS LIKE A WEASEL".chars +ALPHABET = ('A'..'Z').to_a << ' ' +C = 200 +RATE = 0.05 + +def fitness (current, target) + current.zip(target).count {|a, b| a == b } / current.size +end + +def mutate (current, rate) + current.map {|ch| Random.rand < rate ? ALPHABET.sample : ch } +end + +def next_parent (current, target, c, rate) + candidate = current + candidate_fitness = fitness(current, target) + c.times do + child = mutate(current, rate) + child_fitness = fitness(child, target) + if child_fitness > candidate_fitness + candidate, candidate_fitness = child, child_fitness + end + end + candidate +end + +parent = TARGET.map { ALPHABET.sample } + +(1..).each do |gen| + printf "%4d %s\n", gen, parent.join + break if parent == TARGET + parent = next_parent(parent, TARGET, C, RATE) +end diff --git a/Task/Evolutionary-algorithm/Dart/evolutionary-algorithm.dart b/Task/Evolutionary-algorithm/Dart/evolutionary-algorithm.dart new file mode 100644 index 0000000000..34a176b6c5 --- /dev/null +++ b/Task/Evolutionary-algorithm/Dart/evolutionary-algorithm.dart @@ -0,0 +1,63 @@ +import 'dart:math'; + +class EvoAlgo { + static final String target = "METHINKS IT IS LIKE A WEASEL"; + static final List possibilities = "ABCDEFGHIJKLMNOPQRSTUVWXYZ ".split(''); + static int c = 100; // Number of spawn per generation + static double minMutateRate = 0.09; + static int perfectFitness = target.length; + static String parent = ''; + static Random rand = Random(); + + static int fitness(String trial) { + int retVal = 0; + for (int i = 0; i < trial.length; i++) { + if (trial[i] == target[i]) retVal++; + } + return retVal; + } + + static double newMutateRate() { + return (((perfectFitness - fitness(parent)) / perfectFitness) * (1 - minMutateRate)); + } + + static String mutate(String parent, double rate) { + String retVal = ''; + for (int i = 0; i < parent.length; i++) { + retVal += (rand.nextDouble() <= rate) + ? possibilities[rand.nextInt(possibilities.length)] + : parent[i]; + } + return retVal; + } + + static void main() { + parent = mutate(target, 1); + int iter = 0; + while (parent != target) { + double rate = newMutateRate(); + iter++; + if (iter % 100 == 0) { + print('$iter: $parent, fitness: ${fitness(parent)}, rate: $rate'); + } + String bestSpawn; + int bestFit = 0; + for (int i = 0; i < c; i++) { + String spawn = mutate(parent, rate); + int fit = fitness(spawn); + if (fit > bestFit) { + bestSpawn = spawn; + bestFit = fit; + } + } + if (bestFit > fitness(parent)) { + parent = bestSpawn; + } + } + print('$parent, $iter'); + } +} + +void main() { + EvoAlgo.main(); +} diff --git a/Task/Evolutionary-algorithm/EasyLang/evolutionary-algorithm.easy b/Task/Evolutionary-algorithm/EasyLang/evolutionary-algorithm.easy new file mode 100644 index 0000000000..c7b8c72d26 --- /dev/null +++ b/Task/Evolutionary-algorithm/EasyLang/evolutionary-algorithm.easy @@ -0,0 +1,37 @@ +target$ = "METHINKS IT IS LIKE A WEASEL" +abc$[] = strchars " ABCDEFGHIJLKLMNOPQRSTUVWXYZ" +P = 0.05 +C = 100 +func fitness trial$ . + for i to len trial$ + res += if substr trial$ i 1 <> substr target$ i 1 + . + return res +. +func$ mutate parent$ . + for c$ in strchars parent$ + if randomf < P + res$ &= abc$[random 1 len abc$[]] + else + res$ &= c$ + . + . + return res$ +. +for i to len target$ + parent$ &= abc$[random 1 len abc$[]] +. +while fitness parent$ > 0 + copies$[] = [ ] + for i to C + copies$[] &= mutate parent$ + . + parent$ = copies$[1] + for s$ in copies$[] + if fitness s$ < fitness parent$ + parent$ = s$ + . + . + step += 1 + print step & " " & parent$ +. diff --git a/Task/Evolutionary-algorithm/EchoLisp/evolutionary-algorithm.l b/Task/Evolutionary-algorithm/EchoLisp/evolutionary-algorithm.l index 33ebb8503a..5dcec7d3ee 100644 --- a/Task/Evolutionary-algorithm/EchoLisp/evolutionary-algorithm.l +++ b/Task/Evolutionary-algorithm/EchoLisp/evolutionary-algorithm.l @@ -3,36 +3,36 @@ (vector-push ALPHABET " ") (define (fitness source target) ;; score >=0, best is 0 - (for/sum [(s source)(t target)] - (if (= s t) 0 1))) - + (for/sum [(s source)(t target)] + (if (= s t) 0 1))) + (define (mutate source rate) - (for/string [(s source)] - (if (< (random) rate) [ALPHABET (random 27)] s))) - + (for/string [(s source)] + (if (< (random) rate) [ALPHABET (random 27)] s))) + (define (select parent target rate copies (copy) (score)) - (define best (fitness parent target)) - (define selected parent) - (for [(i copies)] - (set! copy (mutate parent rate)) - (set! score (fitness copy target)) - (when (< score best) - (set! selected copy) - (set! best score))) - selected ) - + (define best (fitness parent target)) + (define selected parent) + (for [(i copies)] + (set! copy (mutate parent rate)) + (set! score (fitness copy target)) + (when (< score best) + (set! selected copy) + (set! best score))) + selected ) + (define MUTATION_RATE 0.05) ;; 5% chances to change (define COPIES 100) (define TARGET "METHINKS IT IS LIKE A WEASEL") (define (task (rate MUTATION_RATE) (copies COPIES) (target TARGET) (score)) - (define parent ;; random source - (for/string + (define parent ;; random source + (for/string [(i (string-length target))] [ALPHABET (random 27)])) - - (for [(i (in-naturals))] - (set! score (fitness parent target)) - (writeln i parent 'score score) - #:break (zero? score) - (set! parent (select parent target rate copies)) - )) + + (for [(i (in-naturals))] + (set! score (fitness parent target)) + (writeln i parent 'score score) + #:break (zero? score) + (set! parent (select parent target rate copies)) + )) diff --git a/Task/Evolutionary-algorithm/Elena/evolutionary-algorithm.elena b/Task/Evolutionary-algorithm/Elena/evolutionary-algorithm.elena index 18675d0166..b26b81a6d0 100644 --- a/Task/Evolutionary-algorithm/Elena/evolutionary-algorithm.elena +++ b/Task/Evolutionary-algorithm/Elena/evolutionary-algorithm.elena @@ -8,7 +8,7 @@ const string AllowedCharacters = " ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const int C = 100; const real P = 0.05r; -rnd = randomGenerator; +rnd = Random; randomChar = AllowedCharacters[rnd.nextInt(AllowedCharacters.Length)]; @@ -16,20 +16,20 @@ randomChar extension evoHelper { randomString() - = 0.repeatTill(self).selectBy:(x => randomChar).summarize(new StringWriter()); + = 0.repeatTill(self).selectBy::(x => randomChar).summarize(new StringWriter()); fitnessOf(s) - = self.zipBy(s, (a,b => a==b ? 1 : 0)).summarize(new Integer()).toInt(); + = self.zipBy(s, (a,b => (a==b) ? 1 : 0)).summarize(new Integer()).toInt(); mutate(p) - = self.selectBy:(ch => rnd.nextReal() <= p ? randomChar : ch).summarize(new StringWriter()); + = self.selectBy::(ch => (rnd.nextReal() <= p) ? randomChar : ch).summarize(new StringWriter()); } class EvoAlgorithm : Enumerator { - object _target; - object _current; - object _variantCount; + object _target; + object? _current; + object _variantCount; constructor new(s,count) { @@ -47,9 +47,9 @@ class EvoAlgorithm : Enumerator if (_target == _current) { ^ false }; - auto variants := Array.allocate(_variantCount).populate:(x => _current.mutate:P ); + auto variants := Array.allocate(_variantCount).populate::(x => _current.mutate(P) ); - _current := variants.sort:(a,b => a.fitnessOf:Target > b.fitnessOf:Target ).at:0; + _current := variants.sort::(a,b => a.fitnessOf(Target) > b.fitnessOf(Target) ).at(0); ^ true } @@ -62,15 +62,15 @@ class EvoAlgorithm : Enumerator enumerable() => _target; } -public program() +public Program() { var attempt := new Integer(); - EvoAlgorithm.new(Target,C).forEach:(current) + EvoAlgorithm.new(Target,C).forEach::(current) { - console + Console .printPaddingLeft(10,"#",attempt.append(1)) .printLine(" ",current," fitness: ",current.fitnessOf(Target)) }; - console.readChar() + Console.readChar() } diff --git a/Task/Evolutionary-algorithm/Elixir/evolutionary-algorithm.elixir b/Task/Evolutionary-algorithm/Elixir/evolutionary-algorithm.ex similarity index 100% rename from Task/Evolutionary-algorithm/Elixir/evolutionary-algorithm.elixir rename to Task/Evolutionary-algorithm/Elixir/evolutionary-algorithm.ex diff --git a/Task/Evolutionary-algorithm/Euphoria/evolutionary-algorithm.euphoria b/Task/Evolutionary-algorithm/Euphoria/evolutionary-algorithm.eu similarity index 100% rename from Task/Evolutionary-algorithm/Euphoria/evolutionary-algorithm.euphoria rename to Task/Evolutionary-algorithm/Euphoria/evolutionary-algorithm.eu diff --git a/Task/Evolutionary-algorithm/Fortran/evolutionary-algorithm-1.f b/Task/Evolutionary-algorithm/Fortran/evolutionary-algorithm-1.f index e16722f652..4cbf77fb0d 100644 --- a/Task/Evolutionary-algorithm/Fortran/evolutionary-algorithm-1.f +++ b/Task/Evolutionary-algorithm/Fortran/evolutionary-algorithm-1.f @@ -1,135 +1,135 @@ !*************************************************************************************************** - module evolve_routines + module evolve_routines !*************************************************************************************************** - implicit none - - !the target string: - character(len=*),parameter :: targ = 'METHINKS IT IS LIKE A WEASEL' - - contains + implicit none + + !the target string: + character(len=*),parameter :: targ = 'METHINKS IT IS LIKE A WEASEL' + + contains !*************************************************************************************************** - + !******************************************************************** - pure elemental function fitness(member) result(n) + pure elemental function fitness(member) result(n) !******************************************************************** ! The fitness function. The lower the value, the better the match. ! It is zero if they are identical. !******************************************************************** - - implicit none - integer :: n - character(len=*),intent(in) :: member - - integer :: i - - n=0 - do i=1,len(targ) - n = n + abs( ichar(targ(i:i)) - ichar(member(i:i)) ) - end do - + + implicit none + integer :: n + character(len=*),intent(in) :: member + + integer :: i + + n=0 + do i=1,len(targ) + n = n + abs( ichar(targ(i:i)) - ichar(member(i:i)) ) + end do + !******************************************************************** - end function fitness + end function fitness !******************************************************************** - + !******************************************************************** - pure elemental subroutine mutate(member,factor) + pure elemental subroutine mutate(member,factor) !******************************************************************** ! mutate a member of the population. !******************************************************************** - - implicit none - character(len=*),intent(inout) :: member !population member - real,intent(in) :: factor !mutation factor - - integer,parameter :: n_chars = 27 !number of characters in set - character(len=n_chars),parameter :: chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ ' - - real :: rnd_val - integer :: i,j,n - - n = len(member) - - do i=1,n - rnd_val = rand() - if (rnd_val<=factor) then !mutate this element - rnd_val = rand() - j = int(rnd_val*n_chars)+1 !an integer between 1 and n_chars - member(i:i) = chars(j:j) - end if - end do - + + implicit none + character(len=*),intent(inout) :: member !population member + real,intent(in) :: factor !mutation factor + + integer,parameter :: n_chars = 27 !number of characters in set + character(len=n_chars),parameter :: chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ ' + + real :: rnd_val + integer :: i,j,n + + n = len(member) + + do i=1,n + rnd_val = rand() + if (rnd_val<=factor) then !mutate this element + rnd_val = rand() + j = int(rnd_val*n_chars)+1 !an integer between 1 and n_chars + member(i:i) = chars(j:j) + end if + end do + !******************************************************************** - end subroutine mutate + end subroutine mutate !******************************************************************** !*************************************************************************************************** - end module evolve_routines + end module evolve_routines !*************************************************************************************************** !*************************************************************************************************** - program evolve + program evolve !*************************************************************************************************** ! The main program !*************************************************************************************************** - use evolve_routines - - implicit none - - !Tuning parameters: - integer,parameter :: seed = 12345 !random number generator seed - integer,parameter :: max_iter = 10000 !maximum number of iterations - integer,parameter :: population_size = 200 !size of the population - real,parameter :: factor = 0.04 ![0,1] mutation factor - integer,parameter :: iprint = 5 !print every iprint iterations - - !local variables: - integer :: i,iter - integer,dimension(1) :: i_best - character(len=len(targ)),dimension(population_size) :: population - - !initialize random number generator: - call srand(seed) - - !create initial population: - ! [the first element of the population will hold the best member] - population(1) = 'PACQXJB CQPWEYKSVDCIOUPKUOJY' !initial guess - iter=0 - - write(*,'(A10,A30,A10)') 'iter','best','fitness' - write(*,'(I10,A30,I10)') iter,population(1),fitness(population(1)) - - do - - iter = iter + 1 !iteration counter - - !write the iteration: - if (mod(iter,iprint)==0) write(*,'(I10,A30,I10)') iter,population(1),fitness(population(1)) - - !check exit conditions: - if ( iter>max_iter .or. fitness(population(1))==0 ) exit - - !copy best member and mutate: - population = population(1) - do i=2,population_size - call mutate(population(i),factor) - end do - - !select the new best population member: - ! [the best has the lowest value] - i_best = minloc(fitness(population)) - population(1) = population(i_best(1)) - - end do - - !write the last iteration: - if (mod(iter,iprint)/=0) write(*,'(I10,A30,I10)') iter,population(1),fitness(population(1)) - - if (iter>max_iter) then - write(*,*) 'No solution found.' - else - write(*,*) 'Solution found.' - end if - + use evolve_routines + + implicit none + + !Tuning parameters: + integer,parameter :: seed = 12345 !random number generator seed + integer,parameter :: max_iter = 10000 !maximum number of iterations + integer,parameter :: population_size = 200 !size of the population + real,parameter :: factor = 0.04 ![0,1] mutation factor + integer,parameter :: iprint = 5 !print every iprint iterations + + !local variables: + integer :: i,iter + integer,dimension(1) :: i_best + character(len=len(targ)),dimension(population_size) :: population + + !initialize random number generator: + call srand(seed) + + !create initial population: + ! [the first element of the population will hold the best member] + population(1) = 'PACQXJB CQPWEYKSVDCIOUPKUOJY' !initial guess + iter=0 + + write(*,'(A10,A30,A10)') 'iter','best','fitness' + write(*,'(I10,A30,I10)') iter,population(1),fitness(population(1)) + + do + + iter = iter + 1 !iteration counter + + !write the iteration: + if (mod(iter,iprint)==0) write(*,'(I10,A30,I10)') iter,population(1),fitness(population(1)) + + !check exit conditions: + if ( iter>max_iter .or. fitness(population(1))==0 ) exit + + !copy best member and mutate: + population = population(1) + do i=2,population_size + call mutate(population(i),factor) + end do + + !select the new best population member: + ! [the best has the lowest value] + i_best = minloc(fitness(population)) + population(1) = population(i_best(1)) + + end do + + !write the last iteration: + if (mod(iter,iprint)/=0) write(*,'(I10,A30,I10)') iter,population(1),fitness(population(1)) + + if (iter>max_iter) then + write(*,*) 'No solution found.' + else + write(*,*) 'Solution found.' + end if + !*************************************************************************************************** - end program evolve + end program evolve !*************************************************************************************************** diff --git a/Task/Evolutionary-algorithm/FutureBasic/evolutionary-algorithm.basic b/Task/Evolutionary-algorithm/FutureBasic/evolutionary-algorithm.basic new file mode 100644 index 0000000000..36c9824034 --- /dev/null +++ b/Task/Evolutionary-algorithm/FutureBasic/evolutionary-algorithm.basic @@ -0,0 +1,80 @@ +include "NSLog.incl" + +begin globals + CFStringRef target + CFStringRef alphabet + NSInteger c + CGFloat p +end globals + +target = @"METHINKS IT IS LIKE A WEASEL" +alphabet = @"ABCDEFGHIJKLMNOPQRSTUVWXYZ " +c = 100 +p = 0.06 + +toolbox fn arc4random_uniform( UInt32 upperbound ) = UInt32 + +local fn Fitness( s as CFStringRef ) as NSInteger + NSInteger score = len(target) + for NSInteger i = 0 to len(target) -1 + if ( ucc(s,i) == ucc(target,i) ) then score-- + next +end fn = score + +local fn Mutate( s as CFStringRef, rate as CGFloat ) as CFStringRef + CFMutableStringRef result = fn MutableStringWithString( @"" ) + for NSInteger i = 0 to len(s) -1 + if ( ( fn arc4random_uniform(100) / 100.0) < rate ) + NSInteger idx = fn arc4random_uniform( (UInt32)len(alphabet) ) + MutableStringAppendFormat( result, @"%C", ucc( alphabet, idx ) ) + else + MutableStringAppendFormat( result, @"%C", ucc( s, i ) ) + end if + next +end fn = result + +local fn RandomString( length as NSInteger ) as CFStringRef + CFMutableStringRef result = fn MutableStringWithString( @"" ) + for NSInteger i = 0 to length -1 + NSInteger idx = fn arc4random_uniform( (UInt32)len(alphabet) ) + MutableStringAppendFormat( result, @"%C", ucc( alphabet, idx ) ) + next +end fn = result + +void local fn PrintStep( stepNum as NSInteger, s as CFStringRef, fit as NSInteger, result as CFMutableStringRef ) + MutableStringAppendFormat( result, @"%3ld: %@ Distance: %ld\n", (long)stepNum, s, (long)fit ) +end fn + +local fn EvolveString as CFStringRef + CFMutableStringRef result = fn MutableStringNew + CFStringRef parent = fn RandomString( len(target) ) + fn PrintStep( 0, parent, fn Fitness(parent), result ) + + NSInteger stepNum = 0 + while ( fn StringIsEqual( parent, target ) == NO ) + NSInteger bestFitness = len(target) + 1 + CFStringRef bestChild = @"" + CFStringRef child + NSInteger fit + + for NSInteger i = 0 to c -1 + child = fn Mutate( parent, p ) + fit = fn Fitness( child ) + if ( fit < bestFitness ) + bestFitness = fit + bestChild = child + end if + next + parent = bestChild + stepNum++ + fn PrintStep( stepNum, parent, bestFitness, result ) + wend +end fn = result + +CFTimeInterval t : t = fn CACurrentMediaTime +CFStringRef result : result = fn EvolveString +NSLog( @"\nCompute time: %.3f ms\n",(fn CACurrentMediaTime-t)*1000 ) +NSLog( @"%@", result ) +NSLogScrollToTop + +HandleEvents diff --git a/Task/Evolutionary-algorithm/Icon/evolutionary-algorithm-1.icon b/Task/Evolutionary-algorithm/Icon/evolutionary-algorithm-1.icon index 039ac0694b..b601df08e4 100644 --- a/Task/Evolutionary-algorithm/Icon/evolutionary-algorithm-1.icon +++ b/Task/Evolutionary-algorithm/Icon/evolutionary-algorithm-1.icon @@ -1,51 +1,51 @@ global target, chars, parent, C, M, current_fitness procedure fitness(s) - fit := 0 - #Increment the fitness for every position in the string s that matches the target - every i := 1 to *target & s[i] == target[i] do fit +:= 1 - return fit + fit := 0 + #Increment the fitness for every position in the string s that matches the target + every i := 1 to *target & s[i] == target[i] do fit +:= 1 + return fit end procedure mutate(s) - #If a random number between 0 and 1 is inside the bounds of mutation randomly alter a character in the string - if (?0 <= M) then ?s := ?chars - return s + #If a random number between 0 and 1 is inside the bounds of mutation randomly alter a character in the string + if (?0 <= M) then ?s := ?chars + return s end procedure generation() - population := [ ] - next_parent := "" - next_fitness := -1 + population := [ ] + next_parent := "" + next_fitness := -1 - #Create the next population - every 1 to C do push(population, mutate(parent)) - #Find the member of the population with highest fitness, or use the last one inspected - every x := !population & (xf := fitness(x)) > next_fitness do { - next_parent := x - next_fitness := xf - } - - parent := next_parent - - return next_fitness + #Create the next population + every 1 to C do push(population, mutate(parent)) + #Find the member of the population with highest fitness, or use the last one inspected + every x := !population & (xf := fitness(x)) > next_fitness do { + next_parent := x + next_fitness := xf + } + + parent := next_parent + + return next_fitness end procedure main() - target := "METHINKS IT IS LIKE A WEASEL" #Our target string - chars := &ucase ++ " " #Set of usable characters - parent := "" & every 1 to *target do parent ||:= ?chars #The universal common ancestor! - current_fitness := fitness(parent) #The best fitness we have so far + target := "METHINKS IT IS LIKE A WEASEL" #Our target string + chars := &ucase ++ " " #Set of usable characters + parent := "" & every 1 to *target do parent ||:= ?chars #The universal common ancestor! + current_fitness := fitness(parent) #The best fitness we have so far - C := 50 #Population size in each generation - M := 0.5 #Mutation rate per individual in a generation - - gen := 1 - #Until current fitness reaches a score of perfect match with the target string keep generating new populations - until ((current_fitness := generation()) = *target) do { + C := 50 #Population size in each generation + M := 0.5 #Mutation rate per individual in a generation + + gen := 1 + #Until current fitness reaches a score of perfect match with the target string keep generating new populations + until ((current_fitness := generation()) = *target) do { write(gen || " " || current_fitness || " " || parent) gen +:= 1 - } - write("At generation " || gen || " we found a string with perfect fitness at " || current_fitness || " reading: " || parent) + } + write("At generation " || gen || " we found a string with perfect fitness at " || current_fitness || " reading: " || parent) end diff --git a/Task/Evolutionary-algorithm/Icon/evolutionary-algorithm-2.icon b/Task/Evolutionary-algorithm/Icon/evolutionary-algorithm-2.icon index f80f1d6a42..543e63dbd6 100644 --- a/Task/Evolutionary-algorithm/Icon/evolutionary-algorithm-2.icon +++ b/Task/Evolutionary-algorithm/Icon/evolutionary-algorithm-2.icon @@ -1,7 +1,7 @@ -(var c 100) ;number of children in each generation -(var p 0.05) ;mutation probability +(var c 100 ;number of children in each generation + p 0.05) ;mutation probability -(var target "METHINKS IT IS LIKE A WEASEL") -(var tsize (len target)) +(var target "METHINKS IT IS LIKE A WEASEL" + tsize (len target)) (var alphabet (to-vec " ABCDEFGHIJLKLMNOPQRSTUVWXYZ")) diff --git a/Task/Evolutionary-algorithm/JavaScript/evolutionary-algorithm-1.js b/Task/Evolutionary-algorithm/JavaScript/evolutionary-algorithm-1.js index 42c57caec0..3162d81a5a 100644 --- a/Task/Evolutionary-algorithm/JavaScript/evolutionary-algorithm-1.js +++ b/Task/Evolutionary-algorithm/JavaScript/evolutionary-algorithm-1.js @@ -68,8 +68,8 @@ if (!Array.prototype.map) { /* ------------------------------------- Generator ------------------------------------- * Generates a fixed length gene sequence via a gene strategy object. * The gene strategy object must have two functions: - * - "create": returns create a new gene - * - "mutate(existingGene)": returns mutation of an existing gene + * - "create": returns create a new gene + * - "mutate(existingGene)": returns mutation of an existing gene */ function Generator(length, mutationRate, geneStrategy) { this.size = length; @@ -119,9 +119,9 @@ Population.prototype.spawn = function (parent) { /* ------------------------------------- Evolver ------------------------------------- * Attempts to converge a population based a fitness strategy object. * The fitness strategy object must have three function - * - "score(individual)": returns a score for an individual. - * - "compare(scoreA, scoreB)": return true if scoreA is better (ie more fit) then scoreB - * - "done( score )": return true if score is acceptable (ie we have successfully converged). + * - "score(individual)": returns a score for an individual. + * - "compare(scoreA, scoreB)": return true if scoreA is better (ie more fit) then scoreB + * - "done( score )": return true if score is acceptable (ie we have successfully converged). */ function Evolver(size, generator, fitness) { this.done = false; diff --git a/Task/Evolutionary-algorithm/Jq/evolutionary-algorithm.jq b/Task/Evolutionary-algorithm/Jq/evolutionary-algorithm.jq new file mode 100644 index 0000000000..5800f10a0f --- /dev/null +++ b/Task/Evolutionary-algorithm/Jq/evolutionary-algorithm.jq @@ -0,0 +1,64 @@ +# Assumption: input consists of random three-digit numbers i.e. 000 to 999 +def rand: input; + +def set: "ABCDEFGHIJKLMNOPQRSTUVWXYZ "; + +def abs: + if . < 0 then -. else . end; + +def ichar: + if type == "number" then . else explode[0] end; + +# Output: a pseudo-random character from set. +# $n should be a random number drawn from range(0; N) inclusive where N > set|length +# Input: an admissible character from `set` (ignored in this implementation) +def shift($n): + ($n % (set|length)) as $i + | set[$i:$i+1]; + +# fitness: 0 indicates a perfect fit; greater numbers indicate worse fit. +def fitness($gold): + def diff($c; $d): ($c|ichar) - ($d|ichar) | abs; + . as $in + | reduce range(0;length) as $i (0; . + diff($in[$i:$i+1]; $gold[$i:$i+1])); + +# Input: a string +# Output: a mutation of . such that each character is mutated with probability $r +def mutate($r): + # Output: a pseudo-random character from set + # $n should be a random number drawn from range(0; N) inclusive where N > set|length + def letter($n): + ($n % (set|length)) as $i + | set[$i:$i+1]; + + . as $p + | reduce range(0;length) as $i (""; + rand as $rand + | if ($rand/1000) < $r then . + letter($rand) + else . + $p[$i:$i+1] + end ); + +# An array of $n children of the parent provided as input; $r is the mutation probability +def children($n; $r): + [range(0;$n) as $i | mutate($r)]; + +# Input: a "parent" +# Output: a single string +def next_generation($gold; $r): + ([.] + children(100; $r)) + | min_by( fitness($gold) ); + +# Evolve towards the target string provided as input, using $r as the mutation rate; +# `recurse` is used in order to show progress conveniently. +def evolve($r): + . as $gold + | (set|length) as $s + | (reduce range(0; $n) as $i (""; (rand % $s) as $j | . + set[$j:$j+1])) as $string + | {count: 0, $string } + | recurse ( + if .string | fitness($gold) == 0 then empty + else .string |= next_generation($gold; $r) + | .count += 1 + end); + +"METHINKS IT IS LIKE A WEASEL" | evolve(0.05) diff --git a/Task/Evolutionary-algorithm/Julia/evolutionary-algorithm.julia b/Task/Evolutionary-algorithm/Julia/evolutionary-algorithm.jl similarity index 100% rename from Task/Evolutionary-algorithm/Julia/evolutionary-algorithm.julia rename to Task/Evolutionary-algorithm/Julia/evolutionary-algorithm.jl diff --git a/Task/Evolutionary-algorithm/Kotlin/evolutionary-algorithm.kotlin b/Task/Evolutionary-algorithm/Kotlin/evolutionary-algorithm.kts similarity index 100% rename from Task/Evolutionary-algorithm/Kotlin/evolutionary-algorithm.kotlin rename to Task/Evolutionary-algorithm/Kotlin/evolutionary-algorithm.kts diff --git a/Task/Evolutionary-algorithm/Lua/evolutionary-algorithm.lua b/Task/Evolutionary-algorithm/Lua/evolutionary-algorithm.lua index 2d3d272d00..7d955f14ff 100644 --- a/Task/Evolutionary-algorithm/Lua/evolutionary-algorithm.lua +++ b/Task/Evolutionary-algorithm/Lua/evolutionary-algorithm.lua @@ -3,37 +3,37 @@ local alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ " local c, p = 100, 0.06 local function fitness(s) - local score = #target - for i = 1,#target do - if s:sub(i,i) == target:sub(i,i) then score = score - 1 end - end - return score + local score = #target + for i = 1,#target do + if s:sub(i,i) == target:sub(i,i) then score = score - 1 end + end + return score end local function mutate(s, rate) - local result, idx = "" - for i = 1,#s do - if math.random() < rate then - idx = math.random(#alphabet) - result = result .. alphabet:sub(idx,idx) - else - result = result .. s:sub(i,i) - end - end - return result, fitness(result) + local result, idx = "" + for i = 1,#s do + if math.random() < rate then + idx = math.random(#alphabet) + result = result .. alphabet:sub(idx,idx) + else + result = result .. s:sub(i,i) + end + end + return result, fitness(result) end local function randomString(len) - local result, idx = "" - for i = 1,len do - idx = math.random(#alphabet) - result = result .. alphabet:sub(idx,idx) - end - return result + local result, idx = "" + for i = 1,len do + idx = math.random(#alphabet) + result = result .. alphabet:sub(idx,idx) + end + return result end local function printStep(step, s, fit) - print(string.format("%04d: ", step) .. s .. " [" .. fit .."]") + print(string.format("%04d: ", step) .. s .. " [" .. fit .."]") end math.randomseed(os.time()) @@ -42,11 +42,11 @@ printStep(0, parent, fitness(parent)) local step = 0 while parent ~= target do - local bestFitness, bestChild, child, fitness = #target + 1 - for i = 1,c do - child, fitness = mutate(parent, p) - if fitness < bestFitness then bestFitness, bestChild = fitness, child end - end - parent, step = bestChild, step + 1 - printStep(step, parent, bestFitness) + local bestFitness, bestChild, child, fitness = #target + 1 + for i = 1,c do + child, fitness = mutate(parent, p) + if fitness < bestFitness then bestFitness, bestChild = fitness, child end + end + parent, step = bestChild, step + 1 + printStep(step, parent, bestFitness) end diff --git a/Task/Evolutionary-algorithm/MATLAB/evolutionary-algorithm-4.m b/Task/Evolutionary-algorithm/MATLAB/evolutionary-algorithm-4.m index 8fbb9f76e6..4bafdb7261 100644 --- a/Task/Evolutionary-algorithm/MATLAB/evolutionary-algorithm-4.m +++ b/Task/Evolutionary-algorithm/MATLAB/evolutionary-algorithm-4.m @@ -5,7 +5,7 @@ Gen: 4 | Fitness: 322 | KI8M5LAS�GJ�IS�SP�@)D�V@ JCP Gen: 5 | Fitness: 295 | UAUR08AS�GJ�IS�8HG*�+�=C?UB( Gen: 6 | Fitness: 259 | VCUQH35S�HR4.L�ISJQ%J�OC*T=E -Gen: 7 | Fitness: 226 | LFB8GPET(LODKQ�KQBQGF Gen: 9 | Fitness: 159 | N8R7?SOU�NO$OK O?K?!;�MB?QHG Gen: 10 | Fitness: 146 | TGN@EQR4)PS%IS#TFJQ%A!U>BVLI diff --git a/Task/Evolutionary-algorithm/Nanoquery/evolutionary-algorithm.nanoquery b/Task/Evolutionary-algorithm/Nanoquery/evolutionary-algorithm.nanoquery index d695b42ab6..d022b35839 100644 --- a/Task/Evolutionary-algorithm/Nanoquery/evolutionary-algorithm.nanoquery +++ b/Task/Evolutionary-algorithm/Nanoquery/evolutionary-algorithm.nanoquery @@ -8,77 +8,77 @@ rand = new(Random) // returns a random string of the specified length def rand_string(length) - global tbl - global rand + global tbl + global rand - ret = "" + ret = "" - for i in range(1, length) - ret += tbl[rand.getInt(len(tbl))] - end + for i in range(1, length) + ret += tbl[rand.getInt(len(tbl))] + end - return ret + return ret end // gets the fitness of a given string def fitness(string) - global target - fit = 0 + global target + fit = 0 - for i in range(0, len(string) - 1) - if string[i] != target[i] - fit -= 1 - end - end + for i in range(0, len(string) - 1) + if string[i] != target[i] + fit -= 1 + end + end - return fit + return fit end // mutates the specified string with a chance of 0.09 by default def mutate(string) - global chance - global rand - global tbl - mutated = string + global chance + global rand + global tbl + mutated = string - for i in range(0, len(mutated) - 1) - if rand.getFloat() <= chance - mutated[i] = tbl[rand.getInt(len(tbl))] - end - end + for i in range(0, len(mutated) - 1) + if rand.getFloat() <= chance + mutated[i] = tbl[rand.getInt(len(tbl))] + end + end - return mutated + return mutated end // a function to find the index of the string with the best fitness def most_fit(strlist) - global target - - best_score = -(len(target) + 1) - best_index = 0 - - for j in range(0, len(strlist) - 1) - fit = fitness(strlist[j]) - if fit > best_score - best_index = j - best_score = fit - end - end + global target - return {best_index, best_score} + best_score = -(len(target) + 1) + best_index = 0 + + for j in range(0, len(strlist) - 1) + fit = fitness(strlist[j]) + if fit > best_score + best_index = j + best_score = fit + end + end + + return {best_index, best_score} end parent = rand_string(len(target)); iter = 1 while parent != target - children = {} + children = {} - for i in range(1, 30) - children.append(mutate(parent)) - end + for i in range(1, 30) + children.append(mutate(parent)) + end - fit = most_fit(children) - parent = children[fit[0]] - print format("iter %d, score %d: %s\n", iter, fit[1], parent) + fit = most_fit(children) + parent = children[fit[0]] + print format("iter %d, score %d: %s\n", iter, fit[1], parent) - iter += 1 + iter += 1 end diff --git a/Task/Evolutionary-algorithm/OCaml/evolutionary-algorithm.ocaml b/Task/Evolutionary-algorithm/OCaml/evolutionary-algorithm.ml similarity index 100% rename from Task/Evolutionary-algorithm/OCaml/evolutionary-algorithm.ocaml rename to Task/Evolutionary-algorithm/OCaml/evolutionary-algorithm.ml diff --git a/Task/Evolutionary-algorithm/PARI-GP/evolutionary-algorithm.parigp b/Task/Evolutionary-algorithm/PARI-GP/evolutionary-algorithm.parigp index e33c81e794..8fbb6b82fa 100644 --- a/Task/Evolutionary-algorithm/PARI-GP/evolutionary-algorithm.parigp +++ b/Task/Evolutionary-algorithm/PARI-GP/evolutionary-algorithm.parigp @@ -4,43 +4,43 @@ dist(u,v)=sum(i=1,min(#u,#v),u[i]!=v[i])+abs(#u-#v); letter()=my(r=random(27)); if(r==26, " ", Strchr(r+65)); insert(v,x=letter())= { - my(r=random(#v+1)); - if(r==0, return(concat([x],v))); - if(r==#v, return(concat(v,[x]))); - concat(concat(v[1..r],[x]),v[r+1..#v]); + my(r=random(#v+1)); + if(r==0, return(concat([x],v))); + if(r==#v, return(concat(v,[x]))); + concat(concat(v[1..r],[x]),v[r+1..#v]); } delete(v)= { - if(#v<2, return([])); - my(r=random(#v)+1); - if(r==1, return(v[2..#v])); - if(r==#v, return(v[1..#v-1])); - concat(v[1..r-1],v[r+1..#v]); + if(#v<2, return([])); + my(r=random(#v)+1); + if(r==1, return(v[2..#v])); + if(r==#v, return(v[1..#v-1])); + concat(v[1..r-1],v[r+1..#v]); } mutate(s,rateM,rateI,rateD)= { - my(v=Vec(s)); - if(random(1.)best, best=t; parent=v[i]) - ); - ct++ - ); - print(parent" "fitness(parent)); - ct; + my(parent=concat(vector(#target,i,letter())),ct=0); + while(parent != target, + print(parent" "fitness(parent)); + my(v=vector(C,i,mutate(parent,rate,0,0)),best,t); + best=fitness(parent=v[1]); + for(i=2,C, + t=fitness(v[i]); + if(t>best, best=t; parent=v[i]) + ); + ct++ + ); + print(parent" "fitness(parent)); + ct; } evolve(35,.05) diff --git a/Task/Evolutionary-algorithm/Pascal/evolutionary-algorithm.pas b/Task/Evolutionary-algorithm/Pascal/evolutionary-algorithm.pas index 97f638a700..821c4a0a6d 100644 --- a/Task/Evolutionary-algorithm/Pascal/evolutionary-algorithm.pas +++ b/Task/Evolutionary-algorithm/Pascal/evolutionary-algorithm.pas @@ -1,108 +1,108 @@ PROGRAM EVOLUTION (OUTPUT); CONST - TARGET = 'METHINKS IT IS LIKE A WEASEL'; - COPIES = 100; (* 100 children in each generation. *) - RATE = 1000; (* About one character in 1000 will be a mutation. *) + TARGET = 'METHINKS IT IS LIKE A WEASEL'; + COPIES = 100; (* 100 children in each generation. *) + RATE = 1000; (* About one character in 1000 will be a mutation. *) TYPE - STRLIST = ARRAY [1..COPIES] OF STRING; + STRLIST = ARRAY [1..COPIES] OF STRING; FUNCTION RANDCHAR : CHAR; (* Generate a random letter or space. *) VAR RANDNUM : INTEGER; BEGIN - RANDNUM := RANDOM(27); - IF RANDNUM = 26 THEN - RANDCHAR := ' ' - ELSE - RANDCHAR := CHR(RANDNUM + ORD('A')) + RANDNUM := RANDOM(27); + IF RANDNUM = 26 THEN + RANDCHAR := ' ' + ELSE + RANDCHAR := CHR(RANDNUM + ORD('A')) END; FUNCTION RANDSTR (SIZE : INTEGER) : STRING; (* Generate a random string. *) VAR - N : INTEGER; - S : STRING; + N : INTEGER; + S : STRING; BEGIN - S := ''; - FOR N := 1 TO SIZE DO - INSERT(RANDCHAR, S, 1); - RANDSTR := S + S := ''; + FOR N := 1 TO SIZE DO + INSERT(RANDCHAR, S, 1); + RANDSTR := S END; FUNCTION FITNESS (CANDIDATE, GOAL : STRING) : INTEGER; (* Count the number of correct letters in the correct places *) VAR N, MATCHES : INTEGER; BEGIN - MATCHES := 0; - FOR N := 1 TO LENGTH(GOAL) DO - IF CANDIDATE[N] = GOAL[N] THEN - MATCHES := MATCHES + 1; - FITNESS := MATCHES + MATCHES := 0; + FOR N := 1 TO LENGTH(GOAL) DO + IF CANDIDATE[N] = GOAL[N] THEN + MATCHES := MATCHES + 1; + FITNESS := MATCHES END; FUNCTION MUTATE (RATE : INTEGER; S : STRING) : STRING; (* Randomly alter a string. Characters change with probability 1/RATE. *) VAR - N : INTEGER; - CHANGE : BOOLEAN; + N : INTEGER; + CHANGE : BOOLEAN; BEGIN - FOR N := 1 TO LENGTH(TARGET) DO - BEGIN - CHANGE := RANDOM(RATE) = 0; - IF CHANGE THEN - S[N] := RANDCHAR - END; - MUTATE := S + FOR N := 1 TO LENGTH(TARGET) DO + BEGIN + CHANGE := RANDOM(RATE) = 0; + IF CHANGE THEN + S[N] := RANDCHAR + END; + MUTATE := S END; PROCEDURE REPRODUCE (RATE : INTEGER; PARENT : STRING; VAR CHILDREN : STRLIST); (* Generate children with random mutations. *) VAR N : INTEGER; BEGIN - FOR N := 1 TO COPIES DO - CHILDREN[N] := MUTATE(RATE, PARENT) + FOR N := 1 TO COPIES DO + CHILDREN[N] := MUTATE(RATE, PARENT) END; FUNCTION FITTEST(CHILDREN : STRLIST; GOAL : STRING) : STRING; (* Measure the fitness of each child and return the fittest. *) (* If multiple children equally match the target, then return the first. *) VAR - MATCHES, MOST_MATCHES, BEST_INDEX, N : INTEGER; + MATCHES, MOST_MATCHES, BEST_INDEX, N : INTEGER; BEGIN - MOST_MATCHES := 0; - BEST_INDEX := 1; - FOR N := 1 TO COPIES DO - BEGIN - MATCHES := FITNESS(CHILDREN[N], GOAL); - IF MATCHES > MOST_MATCHES THEN - BEGIN - MOST_MATCHES := MATCHES; - BEST_INDEX := N - END - END; - FITTEST := CHILDREN[BEST_INDEX] + MOST_MATCHES := 0; + BEST_INDEX := 1; + FOR N := 1 TO COPIES DO + BEGIN + MATCHES := FITNESS(CHILDREN[N], GOAL); + IF MATCHES > MOST_MATCHES THEN + BEGIN + MOST_MATCHES := MATCHES; + BEST_INDEX := N + END + END; + FITTEST := CHILDREN[BEST_INDEX] END; VAR - PARENT, BEST_CHILD : STRING; - CHILDREN : STRLIST; - GENERATIONS : INTEGER; + PARENT, BEST_CHILD : STRING; + CHILDREN : STRLIST; + GENERATIONS : INTEGER; BEGIN - RANDOMIZE; - GENERATIONS := 0; - PARENT := RANDSTR(LENGTH(TARGET)); - WHILE NOT (PARENT = TARGET) DO - BEGIN - IF (GENERATIONS MOD 100) = 0 THEN WRITELN(PARENT); - GENERATIONS := GENERATIONS + 1; - REPRODUCE(RATE, PARENT, CHILDREN); - BEST_CHILD := FITTEST(CHILDREN, TARGET); - IF FITNESS(PARENT, TARGET) < FITNESS(BEST_CHILD, TARGET) THEN - PARENT := BEST_CHILD - END; - WRITE('The string was matched in '); - WRITELN(GENERATIONS, ' generations.') + RANDOMIZE; + GENERATIONS := 0; + PARENT := RANDSTR(LENGTH(TARGET)); + WHILE NOT (PARENT = TARGET) DO + BEGIN + IF (GENERATIONS MOD 100) = 0 THEN WRITELN(PARENT); + GENERATIONS := GENERATIONS + 1; + REPRODUCE(RATE, PARENT, CHILDREN); + BEST_CHILD := FITTEST(CHILDREN, TARGET); + IF FITNESS(PARENT, TARGET) < FITNESS(BEST_CHILD, TARGET) THEN + PARENT := BEST_CHILD + END; + WRITE('The string was matched in '); + WRITELN(GENERATIONS, ' generations.') END. diff --git a/Task/Evolutionary-algorithm/PascalABC.NET/evolutionary-algorithm.pas b/Task/Evolutionary-algorithm/PascalABC.NET/evolutionary-algorithm.pas new file mode 100644 index 0000000000..9b763a6711 --- /dev/null +++ b/Task/Evolutionary-algorithm/PascalABC.NET/evolutionary-algorithm.pas @@ -0,0 +1,24 @@ +const + Target = 'METHINKS IT IS LIKE A WEASEL'; + Alphabet = ' ABCDEFGHIJLKLMNOPQRSTUVWXYZ'; + P = 0.05; + C = 100; + +function negFitness(trial: string) := + trial.Zip(Target, (x, y) -> (if x = y then 0 else 1)).Sum; + +function mutate(parent: string) := + parent.Aggregate('', (mut, ch) -> mut + (if Random(1.0) < P then Alphabet.RandomElement else ch)); + +begin + var parent := (1..Target.Length).Aggregate('', (p, x)-> p + Alphabet.RandomElement); + var i := 0; + while parent <> Target do + begin + var copies := ArrGen(C, x -> mutate(parent)); + parent := copies.Aggregate((p, x) -> (if negFitness(x) < negFitness(p) then x else p)); + if i mod 10 = 0 then Println(i, ' ', parent); + i += 1; + end; + Println(i, ' ', parent) +end. diff --git a/Task/Evolutionary-algorithm/Pony/evolutionary-algorithm-1.pony b/Task/Evolutionary-algorithm/Pony/evolutionary-algorithm-1.pony index 0c7a28f78e..5a092513f6 100644 --- a/Task/Evolutionary-algorithm/Pony/evolutionary-algorithm-1.pony +++ b/Task/Evolutionary-algorithm/Pony/evolutionary-algorithm-1.pony @@ -2,10 +2,10 @@ use "random" actor Main let _env: Env - let _rand: MT = MT // Mersenne Twister + let _rand: MT = MT // Mersenne Twister let _target: String = "METHINKS IT IS LIKE A WEASEL" let _possibilities: String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ " - let _c: U16 = 100 // number of spawn per generation + let _c: U16 = 100 // number of spawn per generation let _min_mutate_rate: F64 = 0.09 let _perfect_fitness: USize = _target.size() var _parent: String = "" diff --git a/Task/Evolutionary-algorithm/Prolog/evolutionary-algorithm.pro b/Task/Evolutionary-algorithm/Prolog/evolutionary-algorithm.pro index 2733079aa6..d3f325a38f 100644 --- a/Task/Evolutionary-algorithm/Prolog/evolutionary-algorithm.pro +++ b/Task/Evolutionary-algorithm/Prolog/evolutionary-algorithm.pro @@ -1,7 +1,7 @@ target("METHINKS IT IS LIKE A WEASEL"). rndAlpha(64, 32). % Generate a single random character -rndAlpha(P, P). % 32 is a space, and 65->90 are upper case +rndAlpha(P, P). % 32 is a space, and 65->90 are upper case rndAlpha(Ch) :- random(N), P is truncate(64+(N*27)), !, rndAlpha(P, Ch). rndTxt(0, []). % Generate some random text (fixed length) @@ -17,16 +17,16 @@ mutate(P, [H|Txt], [H|Mut]) :- random(R), R < P, !, mutate(P, Txt, Mut). mutate(P, [_|Txt], [M|Mut]) :- rndAlpha(M), !, mutate(P, Txt, Mut). weasel(Tries, _, _, mutation(0, Result)) :- % No differences=success - format('~w~4|:~w~3| - ~s\n', [Tries, 0, Result]). -weasel(Tries, Chance, Target, mutation(S, Value)) :- % output progress - format('~w~4|:~w~3| - ~s\n', [Tries, S, Value]), !, % and call again - weasel(Tries, Chance, Target, Value). + format('~w~4|:~w~3| - ~s\n', [Tries, 0, Result]). +weasel(Tries, Chance, Target, mutation(S, Value)) :- % output progress + format('~w~4|:~w~3| - ~s\n', [Tries, S, Value]), !, % and call again + weasel(Tries, Chance, Target, Value). weasel(Tries, Chance, Target, Start) :- - findall(mutation(S,M), % Generate 30 mutations, select the best. - (between(1, 30, _), mutate(Chance, Start, M), score(M,S,Target)), - Mutations), % List of 30 mutations and their scores - sort(Mutations, [Best|_]), succ(Tries, N), - !, weasel(N, Chance, Target, Best). + findall(mutation(S,M), % Generate 30 mutations, select the best. + (between(1, 30, _), mutate(Chance, Start, M), score(M,S,Target)), + Mutations), % List of 30 mutations and their scores + sort(Mutations, [Best|_]), succ(Tries, N), + !, weasel(N, Chance, Target, Best). weasel :- % Chance->probability for a mutation, T=Target, Start=initial text - target(T), length(T, Len), rndTxt(Len, Start), Chance is 1 - (1/(Len+1)), - !, weasel(0, Chance, T, Start). + target(T), length(T, Len), rndTxt(Len, Start), Chance is 1 - (1/(Len+1)), + !, weasel(0, Chance, T, Start). diff --git a/Task/Evolutionary-algorithm/Rebol/evolutionary-algorithm.rebol b/Task/Evolutionary-algorithm/Rebol/evolutionary-algorithm.rebol new file mode 100644 index 0000000000..a2ce3d5ab3 --- /dev/null +++ b/Task/Evolutionary-algorithm/Rebol/evolutionary-algorithm.rebol @@ -0,0 +1,65 @@ +Rebol [ + title: "Rosetta code: Evolutionary algorithm" + file: %Evolutionary_algorithm.r3 + url: https://rosettacode.org/wiki/Evolutionary_algorithm + note: "Based on Red language solution" +] + +evolve: function/with [ + target [string!] "target phrase to evolve toward" + childs [integer!] "number of offspring per generation" + rate [number!] "per-character mutation probability (0.0..1.0)" +][ + ;; create initial random parent of same length as target + parent: clear "" + repeat i length? target [ + append parent random/only alphabet + ] + ;; main loop: generate children, select fittest, repeat until exact match + mutations: 0 + while [parent != target] [ + clear children + repeat i childs [ + append children mutate parent rate ;; produce a mutated child from parent + ] + sort/compare children :sort-fitness ;; sort children by fitness (best first) + parent: first children ;; select best child as new parent + ++ mutations + prin #"^M" ;; carriage return to overwrite line + prin parent + ] + prin #"^M" ;; move to line start + print parent ;; final perfect match + mutations +][ + alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ " ;; allowed gene pool (uppercase letters + space) + children: copy [] ;; reusable buffer for a generation's children + + ;; compute closeness of 'string' to 'target' as Hamming distance (lower is better) + fitness: function [string] [ + sum: 0 + repeat i length? string [ + if string/:i <> target/:i [ ++ sum ] ;; count mismatched positions + ] + sum + ] + + ;; return a mutated copy of 'string'; each position mutates with probability 'rate' + mutate: function [string rate] [ + result: copy string + repeat i length? result [ + if rate > random 1.0 [ + result/:i: random/only alphabet ;; replace char with random from alphabet + ] + ] + result + ] + + ;; comparison function for sorting: a < b if fitness(a) < fitness(b) + sort-fitness: function [a b] [lesser? fitness a fitness b] +] + +;; run the evolution demo +random/seed 1 +m: evolve "METHINKS IT IS LIKE A WEASEL" 20 0.05 +print ["Target found using" as-yellow m "mutations."] diff --git a/Task/Evolutionary-algorithm/Rust/evolutionary-algorithm.rust b/Task/Evolutionary-algorithm/Rust/evolutionary-algorithm.rs similarity index 100% rename from Task/Evolutionary-algorithm/Rust/evolutionary-algorithm.rust rename to Task/Evolutionary-algorithm/Rust/evolutionary-algorithm.rs diff --git a/Task/Evolutionary-algorithm/SETL/evolutionary-algorithm.setl b/Task/Evolutionary-algorithm/SETL/evolutionary-algorithm.setl new file mode 100644 index 0000000000..5148a59ccc --- /dev/null +++ b/Task/Evolutionary-algorithm/SETL/evolutionary-algorithm.setl @@ -0,0 +1,40 @@ +program weasel; + setrandom(0); + + target := "METHINKS IT IS LIKE A WEASEL"; + charset := {c : c in " ABCDEFGHIJKLMNOPQRSTUVWXYZ"}; + mutation_rate := 0.1; + generation_size := 100; + + loop init + current := +/[random charset : c in target]; + doing + print(lpad(str fitness(current, target), 3), current); + while current /= target do + current := next_generation( + current, target, mutation_rate, generation_size, charset); + end loop; + + proc fitness(candidate, target); + return #[i : i in [1..#target] | candidate(i) /= target(i)]; + end proc; + + proc mutate(candidate, mutation_rate, charset); + return +/[ + if random 1.0 < mutation_rate + then random charset + else c + end + : c in candidate + ]; + end proc; + + proc next_generation( + parent, target, mutation_rate, generation_size, charset); + children := { + [fitness(c:=mutate(parent, mutation_rate, charset), target), c] + : i in [1..generation_size] + }; + return random children{min/domain children}; + end proc; +end program; diff --git a/Task/Evolutionary-algorithm/Scheme/evolutionary-algorithm.ss b/Task/Evolutionary-algorithm/Scheme/evolutionary-algorithm.scm similarity index 100% rename from Task/Evolutionary-algorithm/Scheme/evolutionary-algorithm.ss rename to Task/Evolutionary-algorithm/Scheme/evolutionary-algorithm.scm diff --git a/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-1.sequencel b/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-1.sequencel index 836c3aba77..e1ab201b68 100644 --- a/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-1.sequencel +++ b/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-1.sequencel @@ -5,19 +5,19 @@ AllowedChars := " ABCDEFGHIJKLMNOPQRSTUVWXYZ"; initializeParent(randChars(1)) := AllowedChars[randChars]; Fitness(target(1), current(1)) := - let - fit[i] := true when target[i] = current[i]; - in - size(fit); - + let + fit[i] := true when target[i] = current[i]; + in + size(fit); + Mutate(letter(0), rate(0), randRate(0), randChar(0)) := - letter when randRate > rate - else - AllowedChars[randChar]; + letter when randRate > rate + else + AllowedChars[randChar]; evolve(target(1), parent(1), C(0), P(0), rateRands(2), charRands(2)) := - let - mutations[i] := Mutate(parent, P, rateRands[i], charRands[i]) foreach i within 1 ... C; - fitnesses := Fitness(target, mutations); - in - mutations[firstIndexOf(fitnesses, vectorMax(fitnesses))]; + let + mutations[i] := Mutate(parent, P, rateRands[i], charRands[i]) foreach i within 1 ... C; + fitnesses := Fitness(target, mutations); + in + mutations[firstIndexOf(fitnesses, vectorMax(fitnesses))]; diff --git a/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-2.sequencel b/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-2.sequencel index 3dc141f523..75782dae66 100644 --- a/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-2.sequencel +++ b/Task/Evolutionary-algorithm/SequenceL/evolutionary-algorithm-2.sequencel @@ -6,45 +6,45 @@ using namespace std; int main(int argc, char** argv) { - int threads = 0; + int threads = 0; - char* targetString = "METHINKS IT IS LIKE A WEASEL"; - if(argc > 1) targetString = argv[1]; - int C = 100; - if(argc > 2) C = atoi(argv[2]); - SL_FLOAT P = 0.05; - if(argc > 3) P = atof(argv[3]); - int seed = time(NULL); - if(argc > 4) seed = atoi(argv[4]); + char* targetString = "METHINKS IT IS LIKE A WEASEL"; + if(argc > 1) targetString = argv[1]; + int C = 100; + if(argc > 2) C = atoi(argv[2]); + SL_FLOAT P = 0.05; + if(argc > 3) P = atof(argv[3]); + int seed = time(NULL); + if(argc > 4) seed = atoi(argv[4]); - int targetDims[] = {strlen(targetString), 0}; - Sequence target((void*)targetString, targetDims); + int targetDims[] = {strlen(targetString), 0}; + Sequence target((void*)targetString, targetDims); - sl_init(threads); + sl_init(threads); - Sequence parent; - Sequence newParent; - Sequence parentRands; - sl_create(seed++, 1, 27, target.size(), threads, parentRands); - sl_initializeParent(parentRands, threads, parent); + Sequence parent; + Sequence newParent; + Sequence parentRands; + sl_create(seed++, 1, 27, target.size(), threads, parentRands); + sl_initializeParent(parentRands, threads, parent); - Sequence< Sequence > charRands; - Sequence< Sequence > rateRands; + Sequence< Sequence > charRands; + Sequence< Sequence > rateRands; - cout << "Start:\t" << parent << endl; - for(int i = 1; !(parent == target); i++) - { - sl_create(seed++, 1, 27, C, target.size(), threads, charRands); - sl_create(seed++, 0.0, 1.0, C, target.size(), threads, rateRands); + cout << "Start:\t" << parent << endl; + for(int i = 1; !(parent == target); i++) + { + sl_create(seed++, 1, 27, C, target.size(), threads, charRands); + sl_create(seed++, 0.0, 1.0, C, target.size(), threads, rateRands); - sl_evolve(target, parent, C, P, rateRands, charRands, threads, newParent); - parent = newParent; + sl_evolve(target, parent, C, P, rateRands, charRands, threads, newParent); + parent = newParent; - cout << "#" << i << ":\t" << parent << endl; - } - cout << "End:\t" << parent << endl; + cout << "#" << i << ":\t" << parent << endl; + } + cout << "End:\t" << parent << endl; - sl_done(); + sl_done(); - return 0; + return 0; } diff --git a/Task/Evolutionary-algorithm/Tcl/evolutionary-algorithm-1.tcl b/Task/Evolutionary-algorithm/Tcl/evolutionary-algorithm-1.tcl index 30d954617d..98e4050b03 100644 --- a/Task/Evolutionary-algorithm/Tcl/evolutionary-algorithm-1.tcl +++ b/Task/Evolutionary-algorithm/Tcl/evolutionary-algorithm-1.tcl @@ -21,7 +21,7 @@ proc fitness s { global target set count 0 foreach c1 $s c2 $target { - if {$c1 eq $c2} {incr count} + if {$c1 eq $c2} {incr count} } return [expr {$count/double([llength $target])}] } @@ -32,14 +32,14 @@ proc mutateRate {parent} { proc mutate {rate} { global charset parent foreach c $parent { - lappend result [expr {rand() <= $rate ? randchar($charset) : $c}] + lappend result [expr {rand() <= $rate ? randchar($charset) : $c}] } return $result } proc que {} { global iterations parent puts [format "#%-4i, fitness %4.1f%%, '%s'" \ - $iterations [expr {[fitness $parent]*100}] [join $parent {}]] + $iterations [expr {[fitness $parent]*100}] [join $parent {}]] } while {$parent ne $target} { @@ -47,7 +47,7 @@ while {$parent ne $target} { if {!([incr iterations] % 100)} que set copies [list [list $parent [fitness $parent]]] for {set i 0} {$i < $C} {incr i} { - lappend copies [list [set copy [mutate $rate]] [fitness $copy]] + lappend copies [list [set copy [mutate $rate]] [fitness $copy]] } set parent [lindex [lsort -real -decreasing -index 1 $copies] 0 0] } diff --git a/Task/Evolutionary-algorithm/Tcl/evolutionary-algorithm-2.tcl b/Task/Evolutionary-algorithm/Tcl/evolutionary-algorithm-2.tcl index 0a794b47c6..c6f4858a44 100644 --- a/Task/Evolutionary-algorithm/Tcl/evolutionary-algorithm-2.tcl +++ b/Task/Evolutionary-algorithm/Tcl/evolutionary-algorithm-2.tcl @@ -13,7 +13,7 @@ set C 100 proc fitnessByEquality {target s} { set count 0 foreach c1 $s c2 $target { - if {$c1 eq $c2} {incr count} + if {$c1 eq $c2} {incr count} } return [expr {$count / double([llength $target])}] } @@ -29,7 +29,7 @@ proc mutationRate {individual} { # Mutate a string at a particular rate (per character) proc mutate {parent rate} { foreach c $parent { - lappend child [expr {rand() <= $rate ? randchar() : $c}] + lappend child [expr {rand() <= $rate ? randchar() : $c}] } return $child } @@ -37,7 +37,7 @@ proc mutate {parent rate} { # Pretty printer proc prettyPrint {iterations parent} { puts [format "#%-4i, fitness %5.1f%%, '%s'" $iterations \ - [expr {[fitness $parent]*100}] [join $parent {}]] + [expr {[fitness $parent]*100}] [join $parent {}]] } # The evolutionary algorithm itself @@ -48,18 +48,18 @@ proc evolve {initialString} { set parent [split $initialString {}] for {set iterations 0} {[fitness $parent] < 1} {incr iterations} { - set rate [mutationRate $parent] + set rate [mutationRate $parent] - if {$iterations % 100 == 0} { - prettyPrint $iterations $parent - } + if {$iterations % 100 == 0} { + prettyPrint $iterations $parent + } - set copies [list [list $parent [fitness $parent]]] - for {set i 0} {$i < $C} {incr i} { - lappend copies [list \ - [set copy [mutate $parent $rate]] [fitness $copy]] - } - set parent [lindex [lsort -real -decreasing -index 1 $copies] 0 0] + set copies [list [list $parent [fitness $parent]]] + for {set i 0} {$i < $C} {incr i} { + lappend copies [list \ + [set copy [mutate $parent $rate]] [fitness $copy]] + } + set parent [lindex [lsort -real -decreasing -index 1 $copies] 0 0] } puts "" prettyPrint $iterations $parent diff --git a/Task/Evolutionary-algorithm/VBScript/evolutionary-algorithm.vb b/Task/Evolutionary-algorithm/VBScript/evolutionary-algorithm.vbs similarity index 100% rename from Task/Evolutionary-algorithm/VBScript/evolutionary-algorithm.vb rename to Task/Evolutionary-algorithm/VBScript/evolutionary-algorithm.vbs diff --git a/Task/Evolutionary-algorithm/Zig/evolutionary-algorithm.zig b/Task/Evolutionary-algorithm/Zig/evolutionary-algorithm.zig new file mode 100644 index 0000000000..46c9e63f24 --- /dev/null +++ b/Task/Evolutionary-algorithm/Zig/evolutionary-algorithm.zig @@ -0,0 +1,114 @@ +const std = @import("std"); +const math = std.math; +const print = std.debug.print; + +pub fn main() !void { + const target = "METHINKS IT IS LIKE A WEASEL"; + const copies: usize = 100; + const mutation_rate: u32 = 20; // 1/20 = 0.05 = 5% + + var prng = std.Random.DefaultPrng.init(@as(u64, @intCast(std.time.milliTimestamp()))); + const rng = prng.random(); + + // Generate first sentence, mutating each character + const start = try mutate(rng, target, 1, std.heap.page_allocator); // 1/1 = 1 = 100% + + print("{s}\n", .{target}); + print("{s}\n", .{start}); + + _ = try evolve(rng, target, start, copies, mutation_rate, std.heap.page_allocator); +} + +/// Evolution algorithm +/// +/// Evolves `parent` to match `target`. Returns the number of evolutions performed. +fn evolve( + rng: std.Random, + target: []const u8, + parent: []const u8, + copies: usize, + mutation_rate: u32, + allocator: std.mem.Allocator, +) !usize { + var counter: usize = 0; + var parent_fitness: usize = target.len + 1; + var current_parent = try allocator.dupe(u8, parent); + defer allocator.free(current_parent); + + while (true) { + counter += 1; + + var best_fitness: usize = std.math.maxInt(usize); + const best_sentence = try allocator.alloc(u8, target.len); + + for (0..copies) |_| { + // Copy and mutate a new sentence + const sentence = try mutate(rng, current_parent, mutation_rate, allocator); + defer allocator.free(sentence); + + // Find the fitness of the new mutation + const current_fitness = fitness(target, sentence); + + if (current_fitness < best_fitness) { + best_fitness = current_fitness; + @memcpy( best_sentence, sentence); + } + } + + // If the best mutation of this generation is better than `parent` then "the fittest + // survives" and the next parent becomes the best of this generation. + if (best_fitness < parent_fitness) { + allocator.free(current_parent); + current_parent = best_sentence; + parent_fitness = best_fitness; + print("{s} : generation {} with fitness {}\n", .{ current_parent, counter, best_fitness }); + + if (best_fitness == 0) { + return counter; + } + } else { + allocator.free(best_sentence); + } + } +} + +/// Computes the fitness of a sentence against a target string, returning the number of +/// incorrect characters. +fn fitness(target: []const u8, sentence: []const u8) usize { + var count: usize = 0; + for (sentence, 0..) |c, i| { + if (c != target[i]) { + count += 1; + } + } + return count; +} + +/// Mutation algorithm. +/// +/// It mutates each character of a string, according to a `mutation_rate`. +fn mutate( + rng: std.Random, + sentence: []const u8, + mutation_rate: u32, + allocator: std.mem.Allocator, +) ![]u8 { + var result = try allocator.alloc(u8, sentence.len); + + for (sentence, 0..) |c, i| { + if (rng.int(u32) % mutation_rate == 0) { + result[i] = randomChar(rng); + } else { + result[i] = c; + } + } + + return result; +} + +/// Generates a random letter or space. +fn randomChar(rng: std.Random) u8 { + // Returns a value in the range [A, Z] + an extra slot for the space character. + const c = rng.intRangeAtMost(u8, 'A', 'Z' + 1); + return if (c == 'Z' + 1) ' ' else c; +} diff --git a/Task/Evolutionary-algorithm/Zkl/evolutionary-algorithm.zkl b/Task/Evolutionary-algorithm/Zkl/evolutionary-algorithm.zkl index 67c2e69115..0b9d38526e 100644 --- a/Task/Evolutionary-algorithm/Zkl/evolutionary-algorithm.zkl +++ b/Task/Evolutionary-algorithm/Zkl/evolutionary-algorithm.zkl @@ -9,6 +9,6 @@ fcn mutate(s){ s.apply(fcn(c){ if((0.0).random(1) < P) rnd() else c }) } parent := target.len().pump(String,rnd); // random string of "A..Z " gen:=0; do{ // mutate C copies of parent and pick the fittest parent = (0).pump(C,List,T(Void,parent),mutate) - .reduce(fcn(a,b){ if(fitness(a) - constant U0 = 0, - U1 = 1 +constant U0 = 0, + U1 = 1 - integer count = 0 +integer count = 0 - procedure baz() - count += 1 - if count=1 then - throw(U0,{{"any",{{"thing"},"you"}},"like"}) - else - throw(U1) - end if - end procedure +procedure baz() + count += 1 + if count=1 then + throw(U0,{{"any",{{"thing"},"you"}},"like"}) + else + throw(U1) + end if +end procedure - procedure bar() - baz() - end procedure +procedure bar() + baz() +end procedure - procedure foo() - for i=1 to 2 do - try - bar() - catch e - if e[E_CODE]=U0 then - ?e[E_USER] - else - throw(e) -- (terminates) - end if - end try - puts(1,"still running...\n") - end for - puts(1,"not still running...\n") - end procedure +procedure foo() + for i=1 to 2 do + try + bar() + catch e + if e[E_CODE]=U0 then + ?e[E_USER] + else + throw(e) -- (terminates) + end if + end try + puts(1,"still running...\n") + end for + puts(1,"not still running...\n") +end procedure - foo() - + print obj + print @"no exception" + end try + + catch ( e ) // handle exception + print : print @"" + print e + end catch + + finally // finally is always executed + print : print @"" + + // ... cleanup + + end finally +end fn + +fn DoSomething + +HandleEvents diff --git a/Task/Exceptions/FutureBasic/exceptions-2.basic b/Task/Exceptions/FutureBasic/exceptions-2.basic new file mode 100644 index 0000000000..203d2eb6c3 --- /dev/null +++ b/Task/Exceptions/FutureBasic/exceptions-2.basic @@ -0,0 +1,15 @@ +void local fn ThrowException + ExceptionRef e = fn ExceptionWithName( @"Oops!", @"Something went wrong", NULL ) + + try + throw e + end try + + catch (e) + print fn ExceptionName( e ), fn ExceptionReason( e ) + end catch +end fn + +fn ThrowException + +HandleEvents diff --git a/Task/Exceptions/Julia/exceptions.julia b/Task/Exceptions/Julia/exceptions.jl similarity index 100% rename from Task/Exceptions/Julia/exceptions.julia rename to Task/Exceptions/Julia/exceptions.jl diff --git a/Task/Exceptions/Kotlin/exceptions.kotlin b/Task/Exceptions/Kotlin/exceptions.kts similarity index 100% rename from Task/Exceptions/Kotlin/exceptions.kotlin rename to Task/Exceptions/Kotlin/exceptions.kts diff --git a/Task/Exceptions/Langur/exceptions-1.langur b/Task/Exceptions/Langur/exceptions-1.langur index ffcc58321f..d9858c6b98 100644 --- a/Task/Exceptions/Langur/exceptions-1.langur +++ b/Task/Exceptions/Langur/exceptions-1.langur @@ -1,8 +1,7 @@ -# do something throw "not a math exception" -catch .e { - if .e["cat"] == "math" { +catch[e] { + if e'cat == "math" { # change result... } else { # rethrow the exception @@ -10,5 +9,4 @@ catch .e { } } else { # no exception - ... } diff --git a/Task/Exceptions/Langur/exceptions-2.langur b/Task/Exceptions/Langur/exceptions-2.langur index d8d1f0f6bd..a66e180efb 100644 --- a/Task/Exceptions/Langur/exceptions-2.langur +++ b/Task/Exceptions/Langur/exceptions-2.langur @@ -1,10 +1,11 @@ 100 / 0 catch { - if _err["cat"] == "math" { + if _err'cat == "math" { # change result 123 } else { + # rethrow the exception throw } } diff --git a/Task/Exceptions/Langur/exceptions-3.langur b/Task/Exceptions/Langur/exceptions-3.langur index c8a06fa37a..6a5d424c46 100644 --- a/Task/Exceptions/Langur/exceptions-3.langur +++ b/Task/Exceptions/Langur/exceptions-3.langur @@ -1,3 +1,3 @@ -val .safediv = f { .x / .y ; catch { 0 } } -.safediv(7, 7) # 1 -.safediv(7, 0) # 0 +val safediv = fn(x number, y number) { x / y ; catch : 0 } +safediv(7, 7) # 1 +safediv(7, 0) # 0 diff --git a/Task/Exceptions/Lua/exceptions-2.lua b/Task/Exceptions/Lua/exceptions-2.lua index 9590ae5df0..064945f28b 100644 --- a/Task/Exceptions/Lua/exceptions-2.lua +++ b/Task/Exceptions/Lua/exceptions-2.lua @@ -6,6 +6,8 @@ end -- 'status' is false if 'throw_error' threw an error -- otherwise, when everything went well, it will be true. --- 'errmsg' contains the error message, plus filename and line number of where the error occured -status, errmsg = pcall(throw_error) +-- 'errmsg' contains the error message, plus filename +-- and line number of where the error occurred + +local status, errmsg = pcall(throw_error) print("errmsg = ", errmsg) diff --git a/Task/Exceptions/Lua/exceptions-3.lua b/Task/Exceptions/Lua/exceptions-3.lua index b2db587ba0..ed58b6092d 100644 --- a/Task/Exceptions/Lua/exceptions-3.lua +++ b/Task/Exceptions/Lua/exceptions-3.lua @@ -1,8 +1,10 @@ -function throw_error_with_argment(argument) - error(string.format("Whoops! argument = %s", argument)) +function throw_error_with_arg(arg) + error(string.format("Whoops! argument = %s", arg)) -- won't ever appear, due to previous error() call return "hello!" end -status, errmsg = pcall(throw_error_with_argment, "foobar 123") -print("errmsg = ", errmsg) +local status, errmsg = pcall(throw_error_with_arg, "foobar 123") +if (status ~= 0) then + print("errmsg = ", errmsg) +end diff --git a/Task/Exceptions/Lua/exceptions-4.lua b/Task/Exceptions/Lua/exceptions-4.lua index f182968d75..fc6c18b0d0 100644 --- a/Task/Exceptions/Lua/exceptions-4.lua +++ b/Task/Exceptions/Lua/exceptions-4.lua @@ -1,6 +1,10 @@ -function throw_error_with_argment(argument) +function throw_error_with_arg(arg) return "hello!" end -status, errmsg = pcall(throw_error_with_argment, "foobar 123") -print("errmsg = ", errmsg) +local status, result = pcall(throw_error_with_arg, "foobar 123") +if (status ~= 0) + print("function returned ", result, ", but had errors.") +else + print("result = ", result) +end diff --git a/Task/Exceptions/OCaml/exceptions-1.ocaml b/Task/Exceptions/OCaml/exceptions-1.ml similarity index 100% rename from Task/Exceptions/OCaml/exceptions-1.ocaml rename to Task/Exceptions/OCaml/exceptions-1.ml diff --git a/Task/Exceptions/OCaml/exceptions-2.ocaml b/Task/Exceptions/OCaml/exceptions-2.ml similarity index 100% rename from Task/Exceptions/OCaml/exceptions-2.ocaml rename to Task/Exceptions/OCaml/exceptions-2.ml diff --git a/Task/Exceptions/OCaml/exceptions-3.ocaml b/Task/Exceptions/OCaml/exceptions-3.ml similarity index 100% rename from Task/Exceptions/OCaml/exceptions-3.ocaml rename to Task/Exceptions/OCaml/exceptions-3.ml diff --git a/Task/Exceptions/PascalABC.NET/exceptions-1.pas b/Task/Exceptions/PascalABC.NET/exceptions-1.pas new file mode 100644 index 0000000000..3234ceef1c --- /dev/null +++ b/Task/Exceptions/PascalABC.NET/exceptions-1.pas @@ -0,0 +1 @@ +type MyException = class(Exception) end; diff --git a/Task/Exceptions/PascalABC.NET/exceptions-2.pas b/Task/Exceptions/PascalABC.NET/exceptions-2.pas new file mode 100644 index 0000000000..d48f94c6ed --- /dev/null +++ b/Task/Exceptions/PascalABC.NET/exceptions-2.pas @@ -0,0 +1 @@ +raise new MyException; diff --git a/Task/Exceptions/PascalABC.NET/exceptions-3.pas b/Task/Exceptions/PascalABC.NET/exceptions-3.pas new file mode 100644 index 0000000000..15454868bd --- /dev/null +++ b/Task/Exceptions/PascalABC.NET/exceptions-3.pas @@ -0,0 +1,6 @@ +try + ... +except + on e: MyException do + statement +end; diff --git a/Task/Empty-program/BootBASIC/empty-program.basic b/Task/Exceptions/Phix/exceptions-3.phix similarity index 100% rename from Task/Empty-program/BootBASIC/empty-program.basic rename to Task/Exceptions/Phix/exceptions-3.phix diff --git a/Task/Exceptions/Pluto/exceptions.pluto b/Task/Exceptions/Pluto/exceptions.pluto new file mode 100644 index 0000000000..654a1a1a78 --- /dev/null +++ b/Task/Exceptions/Pluto/exceptions.pluto @@ -0,0 +1,22 @@ +local function get_day_no(day) + -- Throws an error if day is invalid. + return switch day:lower() do + case "monday" -> 1 + case "tuesday" -> 2 + case "wednesday" -> 3 + case "thursday" -> 4 + case "friday" -> 5 + case "saturday" -> 6 + case "sunday" -> 7 + default -> error($"'{day}' is not a valid day in English.") + end +end + +for {"thursday", "jeudi"} as day do + local ok, res = pcall(get_day_no, day) + if ok then + print($"'{day}' is day number {res}") + else + print(res) + end +end diff --git a/Task/Exceptions/PowerShell/exceptions-1.psh b/Task/Exceptions/PowerShell/exceptions-1.ps1 similarity index 100% rename from Task/Exceptions/PowerShell/exceptions-1.psh rename to Task/Exceptions/PowerShell/exceptions-1.ps1 diff --git a/Task/Exceptions/PowerShell/exceptions-2.psh b/Task/Exceptions/PowerShell/exceptions-2.ps1 similarity index 100% rename from Task/Exceptions/PowerShell/exceptions-2.psh rename to Task/Exceptions/PowerShell/exceptions-2.ps1 diff --git a/Task/Exceptions/PowerShell/exceptions-3.psh b/Task/Exceptions/PowerShell/exceptions-3.ps1 similarity index 100% rename from Task/Exceptions/PowerShell/exceptions-3.psh rename to Task/Exceptions/PowerShell/exceptions-3.ps1 diff --git a/Task/Exceptions/PowerShell/exceptions-4.psh b/Task/Exceptions/PowerShell/exceptions-4.ps1 similarity index 100% rename from Task/Exceptions/PowerShell/exceptions-4.psh rename to Task/Exceptions/PowerShell/exceptions-4.ps1 diff --git a/Task/Exceptions/REXX/exceptions.rexx b/Task/Exceptions/REXX/exceptions.rexx index 836b4ea7b9..50931581b8 100644 --- a/Task/Exceptions/REXX/exceptions.rexx +++ b/Task/Exceptions/REXX/exceptions.rexx @@ -1,13 +1,13 @@ -/*REXX program demonstrates handling an exception (negative #); catching is via a label.*/ - do j=9 by -5 - say 'the square root of ' j " is " sqrt(j) - end /*j*/ -exit /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -sqrt: procedure; parse arg x; if x=0 then return 0; d=digits(); h=d+6; m.=9 - numeric digits; numeric form; if x<0 then signal .sqrtNeg - parse value format(x, 2, 1, , 0) 'E0' with g 'E' _ .; g=g * .5'e'_ % 2 - do j=0 while h>9; m.j=h; h=h%2 + 1; end /*j*/ - do k=j+5 to 0 by -1; numeric digits m.k; g=(g+x/g) * .5; end /*k*/ - numeric digits d; return g/1 -.sqrtNeg: say 'illegal SQRT argument (argument is negative):' x; exit 13 +-- 25 Apr 2026 +include Setting + +say 'EXCEPTIONS' +say version +say +say 'Square root of 10 is' SqRt(10)/1 +say 'Square root of 0 is' SqRt(0) +say 'Square root of -1 is' SqRt(-1) +exit + +-- Abend; Sqrt +include Math diff --git a/Task/Exceptions/Rust/exceptions.rust b/Task/Exceptions/Rust/exceptions.rs similarity index 100% rename from Task/Exceptions/Rust/exceptions.rust rename to Task/Exceptions/Rust/exceptions.rs diff --git a/Task/Exceptions/Rye/exceptions.rye b/Task/Exceptions/Rye/exceptions.rye new file mode 100644 index 0000000000..2e2e54c6b4 --- /dev/null +++ b/Task/Exceptions/Rye/exceptions.rye @@ -0,0 +1,4 @@ +str: "abc" +num: 5 +try { 123 + str } |is-error .either { "error" } { print str } +try { 123 + num } |is-error .either { "error" } { print num } diff --git a/Task/Exceptions/Scheme/exceptions.ss b/Task/Exceptions/Scheme/exceptions.scm similarity index 100% rename from Task/Exceptions/Scheme/exceptions.ss rename to Task/Exceptions/Scheme/exceptions.scm diff --git a/Task/Exceptions/Sidef/exceptions.sidef b/Task/Exceptions/Sidef/exceptions.sidef index 1d17620d81..e4560cc5c3 100644 --- a/Task/Exceptions/Sidef/exceptions.sidef +++ b/Task/Exceptions/Sidef/exceptions.sidef @@ -1,11 +1,10 @@ try { - die "I'm dead!"; # throws an exception of type 'error' + die "I'm dead!" # throws an exception +} +catch { |msg| + say "msg: #{msg}" # msg: I'm dead! at test.sf line 2. } -catch { |type, msg| - say "type: #{type}"; # type: error - say "msg: #{msg}"; # msg: I'm dead! at test.sf line 2. -}; -say "I'm alive..."; -die "Now I'm dead!"; # this line terminates the program -say "Or am I?"; # Yes, you are! +say "I'm alive..." +die "Now I'm dead!" # this line terminates the program +say "Or am I?" # Yes, you are! diff --git a/Task/Exceptions/Tcl/exceptions.tcl b/Task/Exceptions/Tcl/exceptions-1.tcl similarity index 100% rename from Task/Exceptions/Tcl/exceptions.tcl rename to Task/Exceptions/Tcl/exceptions-1.tcl diff --git a/Task/Exceptions/Tcl/exceptions-2.tcl b/Task/Exceptions/Tcl/exceptions-2.tcl new file mode 100644 index 0000000000..5086244b35 --- /dev/null +++ b/Task/Exceptions/Tcl/exceptions-2.tcl @@ -0,0 +1,26 @@ +set f "non-existent-file.txt" + +try { + puts "try begin" + + set fd [open $f "r" ] + + set contents [read $fd] + + puts "try end" + +} on error { results options } { + puts stderr "results: $results" + + foreach {opt val} $options { + puts stderr "options:\t$opt $val" + + } +} +puts "after try block" + +if {[info exists contents] } { + puts "$contents" +} else { + puts stderr "no contents read" +} diff --git a/Task/Exceptions/Uiua/exceptions.uiua b/Task/Exceptions/Uiua/exceptions.uiua new file mode 100644 index 0000000000..20d6fd1c37 --- /dev/null +++ b/Task/Exceptions/Uiua/exceptions.uiua @@ -0,0 +1,2 @@ +⍣(⋕|0) "123" # parses okay +⍣(⋕|0) "notanumber" # supplies 0 on error diff --git a/Task/Executable-library/Ada/executable-library-1.ada b/Task/Executable-library/Ada/executable-library-1.adb similarity index 100% rename from Task/Executable-library/Ada/executable-library-1.ada rename to Task/Executable-library/Ada/executable-library-1.adb diff --git a/Task/Executable-library/Ada/executable-library-2.ada b/Task/Executable-library/Ada/executable-library-2.adb similarity index 100% rename from Task/Executable-library/Ada/executable-library-2.ada rename to Task/Executable-library/Ada/executable-library-2.adb diff --git a/Task/Executable-library/Ada/executable-library-3.ada b/Task/Executable-library/Ada/executable-library-3.adb similarity index 100% rename from Task/Executable-library/Ada/executable-library-3.ada rename to Task/Executable-library/Ada/executable-library-3.adb diff --git a/Task/Executable-library/Ada/executable-library-4.ada b/Task/Executable-library/Ada/executable-library-4.adb similarity index 100% rename from Task/Executable-library/Ada/executable-library-4.ada rename to Task/Executable-library/Ada/executable-library-4.adb diff --git a/Task/Executable-library/FreeBASIC/executable-library-1.basic b/Task/Executable-library/FreeBASIC/executable-library-1.basic new file mode 100644 index 0000000000..9999f103b4 --- /dev/null +++ b/Task/Executable-library/FreeBASIC/executable-library-1.basic @@ -0,0 +1,37 @@ +Function hailstone(number As Uinteger) As Uinteger + Dim As Uinteger count = 1 + + While number <> 1 + If (number And 1) = 1 Then + number += number Shr 1 + 1 + count += 2 + Else + number Shr= 1 + count += 1 + End If + Wend + Return count +End Function + +Sub Main() + Dim As Uinteger seqlen + seqlen = hailstone(27) + Print "Sequence length for 27 is "; seqlen + + Dim maxlen As uInteger = 0 + Dim maxnum As uInteger = 0 + For number As Uinteger = 2 To 100000 + seqlen = hailstone(number) + If seqlen > maxlen Then + maxlen = seqlen + maxnum = number + End If + Next + Print "The number with the longest hailstone sequence is "; maxnum + Print "Its sequence length is "; maxlen + Print +End Sub + +Main() + +Sleep diff --git a/Task/Executable-library/FreeBASIC/executable-library-2.basic b/Task/Executable-library/FreeBASIC/executable-library-2.basic new file mode 100644 index 0000000000..3a5a72c7a9 --- /dev/null +++ b/Task/Executable-library/FreeBASIC/executable-library-2.basic @@ -0,0 +1,23 @@ +Declare Function hailstone Alias "hailstone" (Byval arg As Uinteger) As Uinteger + +Dim Shared freq(351) As Uinteger + +For number As Uinteger = 2 To 100000 + Dim seqlen As Uinteger = hailstone(number) + freq(seqlen) += 1 +Next + +Dim max As Uinteger = 0 +Dim mostcommon As Uinteger + +For i As Uinteger = 0 To 351 + If freq(i) > max Then + max = freq(i) + mostcommon = i + End If +Next + +Print "The most common sequence length is "; mostcommon +Print "It occurs "; max; " times" + +Sleep diff --git a/Task/Executable-library/J/executable-library-1.j b/Task/Executable-library/J/executable-library-1.j index 715f13ff13..d81fc19c6d 100644 --- a/Task/Executable-library/J/executable-library-1.j +++ b/Task/Executable-library/J/executable-library-1.j @@ -3,10 +3,10 @@ hailseq=: -:`(1 3&p.)@.(2&|) ^:(1 ~: ]) ^:a:"0 9!:29]1 9!:27'main 0' main=:3 :0 - smoutput 'Hailstone sequence for the number 27' - smoutput hailseq 27 - smoutput '' - smoutput 'Finding number with longest hailstone sequence which is' - smoutput 'less than 100000 (and finding that sequence length):' - smoutput (I.@(= >./),>./) #@hailseq i.1e5 + echo 'Hailstone sequence for the number 27' + echo hailseq 27 + echo '' + echo 'Finding number with longest hailstone sequence which is' + echo 'less than 100000 (and finding that sequence length):' + echo (I.@(= >./),>./) #@hailseq i.1e5 ) diff --git a/Task/Executable-library/J/executable-library-3.j b/Task/Executable-library/J/executable-library-3.j index 2bb186622c..4f77a3c89e 100644 --- a/Task/Executable-library/J/executable-library-3.j +++ b/Task/Executable-library/J/executable-library-3.j @@ -2,7 +2,7 @@ require '~temp/hailseq.ijs' 9!:29]1 9!:27'main 0' main=:3 :0 - smoutput 'Finding most frequent hailstone sequence length for' - smoutput 'Hailstone sequences for whole numbers less than 100000:' - smoutput {:{.\:~ (#/.~,.~.) #@hailseq }.i.1e5 + echo 'Finding most frequent hailstone sequence length for' + echo 'Hailstone sequences for whole numbers less than 100000:' + echo {:{.\:~ (#/.~,.~.) #@hailseq }.i.1e5 ) diff --git a/Task/Executable-library/Julia/executable-library.julia b/Task/Executable-library/Julia/executable-library.jl similarity index 100% rename from Task/Executable-library/Julia/executable-library.julia rename to Task/Executable-library/Julia/executable-library.jl diff --git a/Task/Executable-library/Wren/executable-library-1.wren b/Task/Executable-library/Wren/executable-library-1.wren index 13928a04ad..f94e82a732 100644 --- a/Task/Executable-library/Wren/executable-library-1.wren +++ b/Task/Executable-library/Wren/executable-library-1.wren @@ -1,4 +1,4 @@ -/* hailstone.wren */ +/* Executable_library.wren */ var Hailstone = Fn.new { |n| if (n < 1) Fiber.abort("Parameter must be a positive integer.") @@ -34,6 +34,6 @@ var libMain_ = Fn.new { // Check if it's being used as a library or not. import "os" for Process -if (Process.allArguments[1] == "hailstone.wren") { // if true, not a library +if (Process.allArguments[1] == "Executable_library.wren") { // if true, not a library libMain_.call() } diff --git a/Task/Executable-library/Wren/executable-library-2.wren b/Task/Executable-library/Wren/executable-library-2.wren index e6cc7cbd0a..f84d5804c7 100644 --- a/Task/Executable-library/Wren/executable-library-2.wren +++ b/Task/Executable-library/Wren/executable-library-2.wren @@ -1,6 +1,6 @@ -/* hailstone2.wren */ +/* Executable_library_2.wren */ -import "/hailstone" for Hailstone +import "./Executable_library" for Hailstone var freq = {} for (i in 1...100000) { diff --git a/Task/Execute-Brain-/ALGOL-68/execute-brain--1.alg b/Task/Execute-Brain-/ALGOL-68/execute-brain--1.alg index c74c21fd7b..6f36b9cea2 100644 --- a/Task/Execute-Brain-/ALGOL-68/execute-brain--1.alg +++ b/Task/Execute-Brain-/ALGOL-68/execute-brain--1.alg @@ -86,11 +86,10 @@ BEGIN # Brain**** -> Algol 68 transpiler # # get the code to transpile and output it as a comment at the start # # of the code # print( ( "CO BF> " ) ); - STRING code list; - read( ( code list, newline ) ); - print( ( newline, code list, newline, "CO", newline ) ); + STRING bf code; + read( ( bf code, newline ) ); + print( ( newline, bf code, newline, "CO", newline ) ); # transpile the code # - generate( code list ) - + generate( bf code ) END diff --git a/Task/Execute-Brain-/Agena/execute-brain-.agena b/Task/Execute-Brain-/Agena/execute-brain-.agena index becfb717b7..626b19af9e 100644 --- a/Task/Execute-Brain-/Agena/execute-brain-.agena +++ b/Task/Execute-Brain-/Agena/execute-brain-.agena @@ -1,89 +1,27 @@ -# Brain**** interpreter +scope # Simple BF interpreter, based on the Lua sample: "Simple meta-implementation using load" + # reads the BF code from stdin, builds an equivalent Agena program and executes it -# execute the Brain**** program in the code string -bf := proc( code :: string ) is - local address := 1; # current data address - local pc := 1; # current position in code - local data := []; # data - initially empty - local input := ""; # user input - initially empty - local bfOperations := # table of operations and their implemntations - [ ">" ~ proc() is inc address, 1 end - , "<" ~ proc() is dec address, 1 end - , "+" ~ proc() is inc data[ address ], 1 end - , "-" ~ proc() is dec data[ address ], 1 end - , "." ~ proc() is io.write( char( data[ address ] ) ) end - , "," ~ proc() is - # get next input character, converted to an integer - while input = "" - do - # no input left - get the next line - input := io.read() - od; - data[ address ] := abs( input[ 1 ] ); - # remove the latest character from the input - if size input < 2 - then - input := "" - else - input := input[ 2 to -1 ] - fi - end - , "[" ~ proc() is - if data[ address ] = 0 - then - # skip to the end of the loop - local depth := 0; - do - inc pc, 1; - if code[ pc ] = "[" - then - inc depth, 1 - elif code[ pc ] = "]" - then - dec depth, 1 - fi - until depth < 0 - fi - end - , "]" ~ proc() is - if data[ address ] <> 0 - then - # skip to the start of the loop - local depth := 0; - do - dec pc, 1; - if code[ pc ] = "[" - then - dec depth, 1 - elif code[ pc ] = "]" - then - inc depth, 1 - fi - until depth < 0 - fi - end - ]; - # execute the operations - ignore anything invalid - while pc <= size code - do - if data[ address ] = null - then - data[ address ] := 0 - fi; - if bfOperations[ code[ pc ] ] <> null - then - bfOperations[ code[ pc ] ]() - fi; - inc pc, 1 - od -end; + local constant bfOp := [ '>' ~ 'ptr +:= 1; ' + , '<' ~ 'ptr -:= 1; ' + , '+' ~ 'mem[ptr] +:= 1; ' + , '-' ~ 'mem[ptr] -:= 1; ' + , '[' ~ 'while mem[ptr] <> 0 do ' + , ']' ~ 'od; ' + , '.' ~ 'io.write(char(mem[ptr])); ' + , ',' ~ 'mem[ptr] := abs(io.read(io.stdin,1) or "\\0"); ' + ]; -# prompt for Brain**** code and execute it, repeating until an empty code string is entered -scope - local code; - do - io.write( "BF> " ); - code := io.read(); - bf( code ) - until code = "" -epocs; + local bfProgram := "local mem := setmetatable([], [ '__index' ~ proc() return 0 end ]);\n" + & "local ptr := 1;\n" + ; + + for line in io.lines() do + for p to size line do + local snippet := bfOp[ line[ p ] ]; + if snippet then bfProgram &:= snippet & "\n" fi + od + od; + + loadstring( bfProgram, "bfCode" )() + +end diff --git a/Task/Execute-Brain-/Arturo/execute-brain--1.arturo b/Task/Execute-Brain-/Arturo/execute-brain--1.arturo index d84f05f32a..b30648cc5a 100644 --- a/Task/Execute-Brain-/Arturo/execute-brain--1.arturo +++ b/Task/Execute-Brain-/Arturo/execute-brain--1.arturo @@ -4,21 +4,21 @@ ; Tape: [0] -DataPointer: new 0 -InstructionPointer: new 0 +DataPointer: 0 +InstructionPointer: 0 ; Look for jumps in Code an register them ; in the Jumps table precomputeJumps: function [][ - vstack: new [] - jumphash: new #[] + vstack: [] + jumphash: #[] instrPointer: 0 while [instrPointer 'vstack ++ instrPointer - else [ + switch command="[" -> 'vstack ++ instrPointer + [ if command="]" [ target: last vstack chop 'vstack @@ -47,36 +47,37 @@ StateIsValid: function [][ interpret: function [].export:[DataPointer,InstructionPointer,Tape][ while [StateIsValid][ command: get split Code InstructionPointer - case [command=] - when? ["+"] -> Tape\[DataPointer]: Tape\[DataPointer]+1 - when? ["-"] -> Tape\[DataPointer]: Tape\[DataPointer]-1 - when? [">"] [ + case command [ + "+" -> Tape\[DataPointer]: Tape\[DataPointer]+1 + "-" -> Tape\[DataPointer]: Tape\[DataPointer]-1 + ">" [ inc 'DataPointer if DataPointer = size Tape -> Tape: Tape ++ 0 ] - when? ["<"] -> dec 'DataPointer - when? ["."] -> prints to :string to :char Tape\[DataPointer] - when? [","][ + "<" -> dec 'DataPointer + "." -> prints to :string to :char Tape\[DataPointer] + "," [ inp: to :integer input "" if inp=13 -> inp: 10 if inp=3 -> panic "something went wrong!" set Tape DataPointer inp ] - when? ["["] -> - if 0 = get Tape DataPointer [ InstructionPointer: new get Jumps InstructionPointer ] + "[" -> + if 0 = get Tape DataPointer [ InstructionPointer: new Jumps\[InstructionPointer] ] - when? ["]"] -> + "]" -> if 0 <> get Tape DataPointer [ - InstructionPointer: new get Jumps InstructionPointer + InstructionPointer: new Jumps\[InstructionPointer] ] + ] inc 'InstructionPointer ] ] Code: "" -if? 1>size arg -> Code: "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." -else -> Code: read arg\0 +switch 1>size arg -> Code: "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." + -> Code: read arg\0 CodeLength: size Code Jumps: precomputeJumps diff --git a/Task/Execute-Brain-/AutoIt/execute-brain-.autoit b/Task/Execute-Brain-/AutoIt/execute-brain-.au3 similarity index 100% rename from Task/Execute-Brain-/AutoIt/execute-brain-.autoit rename to Task/Execute-Brain-/AutoIt/execute-brain-.au3 diff --git a/Task/Execute-Brain-/Crystal/execute-brain-.cr b/Task/Execute-Brain-/Crystal/execute-brain-.cr new file mode 100644 index 0000000000..355443e3a0 --- /dev/null +++ b/Task/Execute-Brain-/Crystal/execute-brain-.cr @@ -0,0 +1,33 @@ +def bfrun (code) + code = code.chars + data = Hash(Int32, Int32).new(0) + dp = ip = 0 + jump_to_matching = ->(dir : Int32) { + nest = 0 + while 0 <= ip < code.size + case code[ip] + when '[' then nest += dir + when ']' then nest -= dir + end + break if nest == 0 + ip += dir + end + } + while 0 <= ip < code.size + case code[ip] + when '>' then dp += 1 + when '<' then dp -= 1 + when '+' then data[dp] += 1 + when '-' then data[dp] -= 1 + when '.' then print(data[dp].chr) + when ',' then data[dp] = STDIN.read_char.not_nil!.ord + when '[' then jump_to_matching.call(1) if data[dp] == 0 + when ']' then jump_to_matching.call(-1) if data[dp] != 0 + end + ip += 1 + end +end + +hello = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++." + +bfrun(hello) diff --git a/Task/Execute-Brain-/Delphi/execute-brain-.delphi b/Task/Execute-Brain-/Delphi/execute-brain-.pas similarity index 100% rename from Task/Execute-Brain-/Delphi/execute-brain-.delphi rename to Task/Execute-Brain-/Delphi/execute-brain-.pas diff --git a/Task/Execute-Brain-/EasyLang/execute-brain-.easy b/Task/Execute-Brain-/EasyLang/execute-brain-.easy new file mode 100644 index 0000000000..35eabaabb8 --- /dev/null +++ b/Task/Execute-Brain-/EasyLang/execute-brain-.easy @@ -0,0 +1,74 @@ +proc exec code$ . + len mem[] 100 + dp = 1 + code$[] = strchars code$ + ip = 1 + while ip <= len code$[] + if dp > len mem[] + len mem[] len mem[] + 100 + . + if dp < 1 + print "programm error" + return + . + c$ = code$[ip] + if c$ = "+" + mem[dp] += 1 + elif c$ = "-" + mem[dp] -= 1 + elif c$ = ">" + dp += 1 + elif c$ = "<" + dp -= 1 + elif c$ = "." + write strchar mem[dp] + elif c$ = "," + print "input not implemented" + elif c$ = "[" + if mem[dp] = 0 + br = 1 + repeat + ip += 1 + if code$[ip] = "[" + br += 1 + elif code$[ip] = "]" + br -= 1 + . + until br = 0 + . + else + br[] &= ip + . + elif c$ = "]" + ip = br[len br[]] - 1 + len br[] -1 + . + ip += 1 + . +. +func syntax code$ . + for i to len code$ + h$ = substr code$ i 1 + if h$ = "[" + br += 1 + elif h$ = "]" + br -= 1 + . + if br < 0 : return 0 + . + return if br = 0 +. +repeat + inp$ = input + until inp$ = "" + code$ &= inp$ +. +if syntax code$ <> 1 + print "syntax error" + return +. +exec code$ +# +input_data +++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.> +---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. diff --git a/Task/Execute-Brain-/Factor/execute-brain-.factor b/Task/Execute-Brain-/Factor/execute-brain-.factor index 513f3d3667..2e31e5ce88 100644 --- a/Task/Execute-Brain-/Factor/execute-brain-.factor +++ b/Task/Execute-Brain-/Factor/execute-brain-.factor @@ -1,3 +1,3 @@ -USE: brainf*** +USE: brainfuck -"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++." run-brainf*** +"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++." run-brainfuck diff --git a/Task/Execute-Brain-/Fennel/execute-brain-.fennel b/Task/Execute-Brain-/Fennel/execute-brain-.fennel new file mode 100644 index 0000000000..570e80ccae --- /dev/null +++ b/Task/Execute-Brain-/Fennel/execute-brain-.fennel @@ -0,0 +1,34 @@ +(do ;;; Simple BF interpreter, based on the Lua sample: "Simple meta-implementation using load" + ;;; reads the BF code from stdin, builds an equivalent Pluto program and executes it + + (local bf-op { ">" "ptr = ptr + 1" + "<" "ptr = ptr - 1" + "+" "mem[ptr] = mem[ptr] + 1" + "-" "mem[ptr] = mem[ptr] - 1" + "[" "while mem[ptr] ~= 0 do" + "]" "end" + "." "io.write(string.char(mem[ptr]))" + "," "mem[ptr] = string.byte(io.read(1) or \"\\0\")" + } + ) + + (var bf-program (.. "local mem = setmetatable({}, { __index = function() return 0 end })\n" + "local ptr = 1\n" + ) + ) + (each [line (io.lines)] + (for [p 1 (length line)] + (local op (. bf-op (line:sub p p))) + (when op + (set bf-program (.. bf-program op "\n")) + ) + ) + ) + (local (bf-code msg) (load bf-program)) + (if bf-code + (bf-code) + ;else + (error msg) + ) + +) diff --git a/Task/Execute-Brain-/Hare/execute-brain-.hare b/Task/Execute-Brain-/Hare/execute-brain-.hare new file mode 100644 index 0000000000..05d315b116 --- /dev/null +++ b/Task/Execute-Brain-/Hare/execute-brain-.hare @@ -0,0 +1,74 @@ +use fmt; +use fs; +use io; +use os; + +export fn main() void = { + if (len(os::args) != 2) { + fmt::print("Please provide a parameter pointing to a brain**** file.\n")!; + return; + }; + + let program = slurp(os::args[1])!; + let tape: [30000]u8 = [0...]; + let tp: u16 = 0; + defer free(program); + + let matches_k: []size = []; + let matches_v: []size = []; + defer free(matches_k); + defer free(matches_v); + + for (let pp: size = 0; pp < len(program); pp += 1) { + switch (program[pp]) { + case '>' => tp += 1; + case '<' => tp -= 1; + case '+' => tape[tp] += 1; + case '-' => tape[tp] -= 1; + case '.' => io::write(os::stdout, tape[tp..tp+1])!; + case ',' => io::read(os::stdin, tape[tp..tp+1])!; + case '[' => if (tape[tp] == 0) pp = find_match(pp, program, matches_k, matches_v)!; + case ']' => if (tape[tp] != 0) pp = find_match(pp, program, matches_k, matches_v)!; + case => continue; + }; + }; +}; + +fn find_match(pos: size, program: []u8, matches_k: []size, matches_v: []size) (size | !void) = { + for (let i: u16 = 0; i < len(matches_k); i += 1) + if (pos == matches_k[i]) + return matches_v[i]; + let r = pos; + switch (program[pos]) { + case '[' => { + r += 1; + for (let level = 1; level > 0; r += 1) { + switch (program[r]) { + case '[' => level += 1; + case ']' => level -= 1; + case => continue; + }; + }; + }; + case ']' => { + r -= 1; + for (let level = 1; level > 0; r -= 1) { + switch (program[r]) { + case ']' => level += 1; + case '[' => level -= 1; + case => continue; + }; + }; + }; + case => return; + }; + append(matches_k, pos)!; + append(matches_v, r)!; + return r; +}; + +fn slurp(filename: str) ([]u8 | fs::error | io::error) = { + const file = os::open(filename)?; + defer io::close(file)!; + return io::drain(file)?; +}; diff --git a/Task/Execute-Brain-/Julia/execute-brain-.julia b/Task/Execute-Brain-/Julia/execute-brain-.jl similarity index 100% rename from Task/Execute-Brain-/Julia/execute-brain-.julia rename to Task/Execute-Brain-/Julia/execute-brain-.jl diff --git a/Task/Execute-Brain-/Kotlin/execute-brain-.kotlin b/Task/Execute-Brain-/Kotlin/execute-brain-.kts similarity index 100% rename from Task/Execute-Brain-/Kotlin/execute-brain-.kotlin rename to Task/Execute-Brain-/Kotlin/execute-brain-.kts diff --git a/Task/Execute-Brain-/Lua/execute-brain-.lua b/Task/Execute-Brain-/Lua/execute-brain-.lua index 8f2aec0651..422ea849d3 100644 --- a/Task/Execute-Brain-/Lua/execute-brain-.lua +++ b/Task/Execute-Brain-/Lua/execute-brain-.lua @@ -1,24 +1,22 @@ -local funs = { -['>'] = 'ptr = ptr + 1; ', -['<'] = 'ptr = ptr - 1; ', -['+'] = 'mem[ptr] = mem[ptr] + 1; ', -['-'] = 'mem[ptr] = mem[ptr] - 1; ', -['['] = 'while mem[ptr] ~= 0 do ', -[']'] = 'end; ', -['.'] = 'io.write(string.char(mem[ptr])); ', -[','] = 'mem[ptr] = (io.read(1) or "\\0"):byte(); ', +local repl = { + ['>'] = 'ptr = ptr + 1', + ['<'] = 'ptr = ptr - 1', + ['+'] = 'mem[ptr] = mem[ptr] + 1', + ['-'] = 'mem[ptr] = mem[ptr] - 1', + ['['] = 'while mem[ptr] ~= 0 do', + [']'] = 'end', + ['.'] = 'io.write(string.char(mem[ptr]))', + [','] = 'mem[ptr] = (io.read(1) or "\\0"):byte()', } -local prog = [[ +local prog = {[[ local mem = setmetatable({}, { __index = function() return 0 end}) local ptr = 1 -]] +]]} -local source = io.read('*all') - -for p = 1, #source do - local snippet = funs[source:sub(p,p)] - if snippet then prog = prog .. snippet end +local source, i = io.read('*all'), 1 +for char in source:gmatch"[<>+.,%[%]%-]" do + i, prog[i] = i+1, repl[char] end -load(prog)() +load( table.concat(prog, " ") )() diff --git a/Task/Execute-Brain-/Miranda/execute-brain-.miranda b/Task/Execute-Brain-/Miranda/execute-brain-.miranda new file mode 100644 index 0000000000..e1686c7e26 --- /dev/null +++ b/Task/Execute-Brain-/Miranda/execute-brain-.miranda @@ -0,0 +1,83 @@ +#!/usr/bin/mira -exec +main :: [sys_message] +main = (interpret . read . hd . tl) $* + +interpret :: [char]->[sys_message] +interpret prog = msgs where (tape, inp, msgs) = run empty_tape $- (parse prog) + +instr ::= Left | Right | Inc | Dec | Read | Write | Loop [instr] + +run :: tape->[char]->[instr]->(tape,[char],[sys_message]) +run tape inp [] = (tape, inp, []) +run tape inp (instr:instrs) + = (tape'', inp'', sysmsg ++ sysmsgs) + where (tape', inp', sysmsg) = step tape inp instr + (tape'', inp'', sysmsgs) = run tape' inp' instrs + +step :: tape->[char]->instr->(tape,[char],[sys_message]) +step tape inp Left = (left tape, inp, []) +step tape inp Right = (right tape, inp, []) +step tape inp Inc = (apply (+1) tape, inp, []) +step tape inp Dec = (apply (+-1) tape, inp, []) +step tape inp Read = (setval ch tape, inp', []) + where (ch, inp') = getchar inp +step tape inp Write = (tape, inp, [Stdout (decode (val tape):[])]) +step tape inp (Loop prog) = (tape, inp, []), if val tape = 0 + = (tape'', inp'', sysmsgs ++ sysmsgs'), otherwise + where (tape', inp', sysmsgs) = run tape inp prog + (tape'', inp'', sysmsgs') = step tape' inp' (Loop prog) + +getchar :: [char]->(num,[char]) +getchar [] = (0, []) +getchar (x:xs) = (code x, xs) + +parse :: [char] -> [instr] +parse [] = [] +parse instrs + = Left : rest, if tok="<" + = Right : rest, if tok=">" + = Inc : rest, if tok="+" + = Dec : rest, if tok="-" + = Read : rest, if tok="," + = Write : rest, if tok="." + = Loop loop : rest, if hd tok='[' + = rest, otherwise + where (tok, next) = token instrs + rest = parse next + loop = parse (init (tl tok)) + +token :: [char] -> ([char],[char]) +token [] = ([],[]) +token (']':xs) = error "] without [" +token ('[':xs) = ('[':l, rs) where (l, rs) = getloop xs +token (x:xs) = (x:[], xs) + +getloop :: [char] -> ([char],[char]) +getloop = g 0 + where g 0 (']':xs) = ("]", xs) + g n ('[':xs) = ('[':l,rs) where (l,rs) = g (n+1) xs + g n (']':xs) = (']':l,rs) where (l,rs) = g (n-1) xs + g n (x:xs) = (x:l,rs) where (l,rs) = g n xs + g n [] = error "[ without ]" + +tape ::= Tape [num] num [num] + +empty_tape :: tape +empty_tape = Tape [] 0 [] + +left :: tape->tape +left (Tape ls c []) = Tape (c:ls) 0 [] +left (Tape ls c (r:rs)) = Tape (c:ls) r rs + +right :: tape->tape +right (Tape [] c rs) = Tape [] 0 (c:rs) +right (Tape (l:ls) c rs) = Tape ls l (c:rs) + +apply :: (num->num)->tape->tape +apply fn (Tape ls c rs) = Tape ls (fn c mod 256) rs + +val :: tape->num +val (Tape ls c rs) = c + +setval :: num->tape->tape +setval v (Tape ls c rs) = Tape ls v rs diff --git a/Task/Execute-Brain-/Odin/execute-brain-.odin b/Task/Execute-Brain-/Odin/execute-brain-.odin new file mode 100644 index 0000000000..e2898826a1 --- /dev/null +++ b/Task/Execute-Brain-/Odin/execute-brain-.odin @@ -0,0 +1,126 @@ +package bf + +import "core:fmt" +import "core:c/libc" +import "core:os" + +cells_size :: 2000 +getinp : i32 +inp : u8 +main :: proc() { + + // comment out to give a file from command line + // data, ok := os.read_entire_file(os.args[1]) + // assert(ok, "Could not open file") + // defer delete(data) + // input := string(data) + + input := ">+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++." + size_input := len(input) + cells : [cells_size]i32 + pointer:=0 + i:=0 + direction := 1 + // moving past non matching [ ] + depth:= 0 + // loop i over input + mainloop: for ; (i <= (size_input - 1) && i >=0); { + inp = input[i] + //fmt.println(i) + switch inp{ + // move pointer right + case '>': + pointer +=1 + if (pointer>cells_size-1){ + pointer=cells_size-1 + } + i += 1 + // move pointer left + case '<': + pointer -=1 + if (pointer<0){ + pointer=0 + } + i += 1 + // increase cells at pointer + case '+': + cells[pointer] = (cells[pointer] + 1) % 256 + i += 1 + // decrease cell at pointer + case '-': + cells[pointer] = (cells[pointer] - 1) % 256 + i += 1 + // output value from cell at pointer + case '.': + res := cells[pointer] + libc.putchar(res) + i += 1 + // input value in cell at pointer + case ',': + getinp= libc.getchar() + fmt.println("input:") + cells[pointer] = getinp + i += 1 + // Jump past the matching ] if the cell at the pointer is 0 + case '[': + // if cell at pointer = 0 + if cells[pointer] == 0 { + // loop until ] + + loop1: for (inp != ']' && depth == 0) { + i +=1 + inp = input[i] + if (i > (size_input-1)){ + // if i > size input [ is unbalanced + fmt.printf("unbalanced loop ") + break mainloop + } + else if (inp == '[') { + depth += 1 + } + else if (inp == ']' && depth != 0) { + depth -= 1 + } + + fmt.println(i) + } + + } // else ignore + else { + i +=1 + } + + case ']': + // Jump back to the matching [ if the cell at the pointer is nonzero + if cells[pointer] != 0 { + + loop2: for (inp!= '[' && depth == 0) { + i -= 1 + inp = input[i] + if (i < 0) + { + fmt.printf("unbalanced loop ") + break mainloop + } + else if (inp == ']') { + depth += 1 + } + else if (inp == '[' && depth != 0) { + depth -= 1 + } + //fmt.println(input[i]) + } + + } + else { + i+=1 + } + // default: move pointer + case : + i +=1 + + } + + } + +} diff --git a/Task/Execute-Brain-/Phix/execute-brain-.phix b/Task/Execute-Brain-/Phix/execute-brain-.phix index c35807b1ce..a59f95828d 100644 --- a/Task/Execute-Brain-/Phix/execute-brain-.phix +++ b/Task/Execute-Brain-/Phix/execute-brain-.phix @@ -1,54 +1,51 @@ -(phixonline)--> - procedure bfi(string pgm) - sequence jumptable = repeat(0,length(pgm)), - loopstack = {}, - data = repeat(0,10) -- size?? - integer skip = 0, ch, loopstart, pc, dp - -- - -- compile (pack/strip comments and link jumps) - -- - for i=1 to length(pgm) do - ch = pgm[i] - switch ch do - case '[': loopstack = append(loopstack,i-skip); - pgm[i-skip] = ch; - case ']': loopstart = loopstack[$]; - loopstack = loopstack[1..-2]; - jumptable[i-skip] = loopstart; - jumptable[loopstart] = i-skip; - fallthrough - case '+','-','<','>',',','.': pgm[i-skip] = ch; - default: skip += 1 - end switch - end for - if length(loopstack) then ?9/0 end if - pgm = pgm[1..-1-skip] +procedure bfi(string pgm) + sequence jumptable = repeat(0,length(pgm)), + loopstack = {}, + data = repeat(0,10) -- size?? + integer skip = 0, ch + -- + -- compile (pack/strip comments and link jumps) + -- + for i=1 to length(pgm) do + ch = pgm[i] + switch ch do + case '[': loopstack = append(loopstack,i-skip); + pgm[i-skip] = ch; + case ']': integer loopstart = loopstack[$]; + loopstack = loopstack[1..-2]; + jumptable[i-skip] = loopstart; + jumptable[loopstart] = i-skip; + fallthrough + case '+','-','<','>',',','.': pgm[i-skip] = ch; + default: skip += 1 + end switch + end for + if length(loopstack) then ?9/0 end if + pgm = pgm[1..-1-skip] - -- - -- main execution loop - -- - pc = 1 - dp = 1 - while pc<=length(pgm) do - ch = pgm[pc] - switch ch do - case '>': dp += 1 if dp>length(data) then dp = 1 end if - case '<': dp -= 1 if dp<1 then dp = length(data) end if - case '+': data[dp] += 1 - case '-': data[dp] -= 1 - case ',': data[dp] = iff(platform()=JS?'?':getc(0)) - case '.': puts(1,data[dp]) - case '[': if data[dp]=0 then pc = jumptable[pc] end if - case ']': if data[dp]!=0 then pc = jumptable[pc] end if - default: ?9/0 - end switch - pc += 1 - end while - end procedure + -- + -- main execution loop + -- + integer pc = 1, dp = 1 + while pc<=length(pgm) do + ch = pgm[pc] + switch ch do + case '>': dp += 1 if dp>length(data) then dp = 1 end if + case '<': dp -= 1 if dp<1 then dp = length(data) end if + case '+': data[dp] += 1 + case '-': data[dp] -= 1 + case ',': data[dp] = iff(platform()=JS?'?':getc(0)) + case '.': puts(1,data[dp]) + case '[': if data[dp]=0 then pc = jumptable[pc] end if + case ']': if data[dp]!=0 then pc = jumptable[pc] end if + default: ?9/0 + end switch + pc += 1 + end while +end procedure - constant bf="++++++++[>++++[>++>++++>+++>+<<<<-]>++>->+>>+[<]<-]>>.>>.+.<.>>.<<<++.>---------.>------.<----.++++++++.>>+.>++.+++." - constant fb="++++++++[>++++[>++>++++>+++>+<<<<-]>++>->+>>+[<]<-]>>.>>.+.<.>>.<<<+++.>---.>------.++++++++.<--.>>+.>++.+++.," +constant bf="++++++++[>++++[>++>++++>+++>+<<<<-]>++>->+>>+[<]<-]>>.>>.+.<.>>.<<<++.>---------.>------.<----.++++++++.>>+.>++.+++." +constant fb="++++++++[>++++[>++>++++>+++>+<<<<-]>++>->+>>+[<]<-]>>.>>.+.<.>>.<<<+++.>---.>------.++++++++.<--.>>+.>++.+++.," - bfi(bf) - bfi(fb) - - with javascript_semantics - constant NOP = 0b000_00000, -- no operation - LDA = 0b001_00000, -- load accumulator, a := memory [xxxxx] - STA = 0b010_00000, -- store accumulator, memory [xxxxx] := a - ADD = 0b011_00000, -- add, a := a + memory [xxxxx] - SUB = 0b100_00000, -- subtract, a := a – memory [xxxxx] - BRZ = 0b101_00000, -- branch on zero, if a = 0 then goto xxxxx - JMP = 0b110_00000, -- jump, goto xxxxx - STP = 0b111_00000, -- stop - OP = 0b111_00000, -- operator mask - ARG = 0b000_11111 -- memory location (0 based) +with javascript_semantics +constant NOP = 0b000_00000, -- no operation + LDA = 0b001_00000, -- load accumulator, a := memory [xxxxx] + STA = 0b010_00000, -- store accumulator, memory [xxxxx] := a + ADD = 0b011_00000, -- add, a := a + memory [xxxxx] + SUB = 0b100_00000, -- subtract, a := a – memory [xxxxx] + BRZ = 0b101_00000, -- branch on zero, if a = 0 then goto xxxxx + JMP = 0b110_00000, -- jump, goto xxxxx + STP = 0b111_00000, -- stop + OP = 0b111_00000, -- operator mask + ARG = 0b000_11111 -- memory location (0 based) - procedure execute(string name, sequence program) - sequence memory = deep_copy(program) - integer pc = 1, a = 0 - while true do - integer ppc = memory[pc], - op = and_bitsu(ppc,OP), - arg = and_bits(ppc,ARG)+1 - pc += 1 - switch op do - case NOP: break - case LDA: a = memory[arg] - case STA: memory[arg] = a - case ADD: a = and_bitsu(a+memory[arg],#FF) - case SUB: a = and_bitsu(a-memory[arg],#FF) - case BRZ: if a=0 then pc = arg end if - case JMP: pc = arg - case STP: printf(1,"%12s: %3d\n",{name,a}) - return - end switch - end while - end procedure +procedure execute(string name, sequence program) + sequence memory = deep_copy(program) + integer pc = 1, a = 0 + while true do + integer ppc = memory[pc], + op = and_bitsu(ppc,OP), + arg = and_bits(ppc,ARG)+1 + pc += 1 + switch op do + case NOP: break + case LDA: a = memory[arg] + case STA: memory[arg] = a + case ADD: a = and_bitsu(a+memory[arg],#FF) + case SUB: a = and_bitsu(a-memory[arg],#FF) + case BRZ: if a=0 then pc = arg end if + case JMP: pc = arg + case STP: printf(1,"%12s: %3d\n",{name,a}) + return + end switch + end while +end procedure - execute("2+2",{LDA+3, ADD+4, STP, 2,2}) - execute("7*8",{LDA+12, ADD+10, STA+12, LDA+11, SUB+13, STA+11, BRZ+8, JMP+0, - LDA+12, STP, 8,7,0,1}) - execute("fibonacci",{LDA+14, STA+15, ADD+13, STA+14, LDA+15, STA+13, LDA+16, - SUB+17, BRZ+11, STA+16, JMP+0, LDA+14, STP, 1,1,0,8,1}) - execute("linkedList",{LDA+13, ADD+15, STA+5, ADD+16, STA+7, NOP, STA+14, NOP, - BRZ+11, STA+15, JMP+0, LDA+14, STP, LDA+0, 0,28,1,0,0, - 0,6,0,2,26,5,20,3,30,1,22,4,24}) - execute("prisoner",{NOP, NOP, STP, 0, LDA+3, SUB+29, BRZ+18, LDA+3, STA+29, - BRZ+14, LDA+1, ADD+31, STA+1, JMP+2, LDA+0, ADD+31, STA+0, - JMP+2, LDA+3, STA+29, LDA+1, ADD+30, ADD+3, STA+1, LDA+0, - ADD+30, ADD+3, STA+0, JMP+2, 0, 1, 3}) - -- subtractions yielding negative results - execute("0-255",{LDA+3,SUB+4,STP, 0,255}) - execute("0-1",{LDA+3, SUB+4, STP, 0,1}) - -- overflow on addition - execute("1+255",{LDA+3, ADD+4, STP, 1, 255}) - n ) + [ 1 ] is LDA ( --> n ) + [ 2 ] is STA ( --> n ) + [ 3 ] is ADD ( --> n ) + [ 4 ] is SUB ( --> n ) + [ 5 ] is BRZ ( --> n ) + [ 6 ] is JMP ( --> n ) + [ 7 ] is STP ( --> n ) + + [ 0 ] is DATA ( --> n ) + [ 0 ] is -- ( --> n ) + + [ stack 0 ] is acc ( --> s ) + [ stack 0 ] is ip ( --> s ) + [ stack false ] is flag ( --> n ) + + [ 0 ip replace 0 32 of ] is computer/zero ( --> [ ) + + [ 255 & swap 5 << | + swap ip share poke + 1 ip tally ] is , ( [ --> [ ) + + [ drop ] is nop ( [ n --> [ ) + + [ dip dup peek acc replace ] is lda ( [ n --> [ ) + + [ acc share unrot poke ] is sta ( [ n --> [ ) + + [ dip dup peek + acc take + 255 & acc put ] is add ( [ n --> [ ) + + [ dip dup peek negate + acc take + 255 & acc put ] is sub ( [ n --> [ ) + + [ acc share iff drop done + ip replace ] is brz ( [ n --> [ ) + + [ ip replace ] is jmp ( [ n --> [ ) + + [ drop true flag replace ] is stp ( [ n --> [ ) + + [ false flag replace + 0 acc replace + 0 ip replace + [ dup ip share peek + 1 ip tally + dup 31 & swap 5 >> + [ table + nop lda sta add + sub brz jmp stp ] do + flag share until ] + drop + acc share + say "acc = " dup echo + dup 128 & iff + [ say " or " + 127 ~ | echo ] + else drop cr ] is execute ( [ --> ) + + cr say " 2+2: " + computer/zero + ( 00 ) LDA 03 , + ( 01 ) ADD 04 , + ( 02 ) STP -- , + ( 03 ) DATA 2 , + ( 04 ) DATA 2 , + execute + cr say " 7*8: " + computer/zero + ( 00 ) LDA 12 , + ( 01 ) ADD 10 , + ( 02 ) STA 12 , + ( 03 ) LDA 11 , + ( 04 ) SUB 13 , + ( 05 ) STA 11 , + ( 06 ) BRZ 08 , + ( 07 ) JMP 00 , + ( 08 ) LDA 12 , + ( 09 ) STP -- , + ( 10 ) DATA 8 , + ( 11 ) DATA 7 , + ( 12 ) DATA 0 , + ( 13 ) DATA 1 , + execute + cr say " Fibonacci: " + computer/zero + ( 00 ) LDA 14 , + ( 01 ) STA 15 , + ( 02 ) ADD 13 , + ( 03 ) STA 14 , + ( 04 ) LDA 15 , + ( 05 ) STA 13 , + ( 06 ) LDA 16 , + ( 07 ) SUB 17 , + ( 08 ) BRZ 11 , + ( 09 ) STA 16 , + ( 10 ) JMP 00 , + ( 11 ) LDA 14 , + ( 12 ) STP -- , + ( 13 ) DATA 1 , + ( 14 ) DATA 1 , + ( 15 ) DATA 0 , + ( 16 ) DATA 8 , + ( 17 ) DATA 1 , + execute + cr say "linked list: " + computer/zero + ( 00 ) LDA 13 , + ( 01 ) ADD 15 , + ( 02 ) STA 05 , + ( 03 ) ADD 16 , + ( 04 ) STA 07 , + ( 05 ) NOP -- , + ( 06 ) STA 14 , + ( 07 ) NOP -- , + ( 08 ) BRZ 11 , + ( 09 ) STA 15 , + ( 10 ) JMP 00 , + ( 11 ) LDA 14 , + ( 12 ) STP -- , + ( 13 ) LDA 00 , + ( 14 ) DATA 0 , + ( 15 ) DATA 28 , + ( 16 ) DATA 1 , + ( 17 ) DATA 0 , + ( 18 ) DATA 0 , + ( 19 ) DATA 0 , + ( 20 ) DATA 6 , + ( 21 ) DATA 0 , + ( 22 ) DATA 2 , + ( 23 ) DATA 26 , + ( 24 ) DATA 5 , + ( 25 ) DATA 20 , + ( 26 ) DATA 3 , + ( 27 ) DATA 30 , + ( 28 ) DATA 1 , + ( 29 ) DATA 22 , + ( 30 ) DATA 4 , + ( 31 ) DATA 24 , + execute + cr say " prisoner: " + computer/zero + ( 00 ) NOP -- , + ( 01 ) NOP -- , + ( 02 ) STP -- , + ( 03 ) NOP -- , + ( 04 ) LDA 03 , + ( 05 ) SUB 29 , + ( 06 ) BRZ 18 , + ( 07 ) LDA 03 , + ( 08 ) STA 29 , + ( 09 ) BRZ 14 , + ( 10 ) LDA 01 , + ( 11 ) ADD 31 , + ( 12 ) STA 01 , + ( 13 ) JMP 02 , + ( 14 ) LDA 00 , + ( 15 ) ADD 31 , + ( 16 ) STA 00 , + ( 17 ) JMP 02 , + ( 18 ) LDA 03 , + ( 19 ) STA 29 , + ( 20 ) LDA 01 , + ( 21 ) ADD 30 , + ( 22 ) ADD 03 , + ( 23 ) STA 01 , + ( 24 ) LDA 00 , + ( 25 ) ADD 30 , + ( 26 ) ADD 03 , + ( 27 ) STA 01 , + ( 28 ) JMP 02 , + ( 29 ) DATA 0 , + ( 30 ) DATA 1 , + ( 31 ) DATA 3 , + execute diff --git a/Task/Execute-HQ9+/11l/execute-hq9+.11l b/Task/Execute-HQ9+/11l/execute-hq9+.11l index f78b71196e..61c3364c3b 100644 --- a/Task/Execute-HQ9+/11l/execute-hq9+.11l +++ b/Task/Execute-HQ9+/11l/execute-hq9+.11l @@ -38,7 +38,7 @@ F incr() :start: src = File(:argv[1]).read() -[Char = (() -> N)] dispatch +[Char = (() -> Void)] dispatch dispatch[Char(‘h’)] = hello dispatch[Char(‘q’)] = quine dispatch[Char(‘9’)] = bottles diff --git a/Task/Execute-HQ9+/Arturo/execute-hq9+.arturo b/Task/Execute-HQ9+/Arturo/execute-hq9+.arturo index 6e897e33d0..ea2365d299 100644 --- a/Task/Execute-HQ9+/Arturo/execute-hq9+.arturo +++ b/Task/Execute-HQ9+/Arturo/execute-hq9+.arturo @@ -1,13 +1,12 @@ hq9: function [source][ acc: 0 loop split source 'ch [ - case [(lower ch)=] - when? ["h"]-> print "Hello, world!" - when? ["q"]-> print source - when? ["9"]-> print "99 bottles here ..." - when? ["+"]-> acc: acc+1 - else [] - + case lower ch [ + "h" -> print "Hello, world!" + "q" -> print source + "9" -> print "99 bottles here ..." + "+" -> acc: acc+1 + ] ] return acc ] diff --git a/Task/Execute-HQ9+/COBOL/execute-hq9+.cobol b/Task/Execute-HQ9+/COBOL/execute-hq9+.cob similarity index 100% rename from Task/Execute-HQ9+/COBOL/execute-hq9+.cobol rename to Task/Execute-HQ9+/COBOL/execute-hq9+.cob diff --git a/Task/Execute-HQ9+/Delphi/execute-hq9+.delphi b/Task/Execute-HQ9+/Delphi/execute-hq9+.pas similarity index 100% rename from Task/Execute-HQ9+/Delphi/execute-hq9+.delphi rename to Task/Execute-HQ9+/Delphi/execute-hq9+.pas diff --git a/Task/Execute-HQ9+/EasyLang/execute-hq9+.easy b/Task/Execute-HQ9+/EasyLang/execute-hq9+.easy new file mode 100644 index 0000000000..95fb45691e --- /dev/null +++ b/Task/Execute-HQ9+/EasyLang/execute-hq9+.easy @@ -0,0 +1,21 @@ +proc run code$ . + for c$ in strchars code$ + if c$ = "Q" + print code$ + elif c$ = "H" + print "Hello, world!" + elif c$ = "9" + for b = 99 downto 1 + print b & " bottles of beer on the wall" + print b & " bottles of beer" + print "Take one down, pass it around" + print b & " bottles of beer on the wall" + print "" + . + elif c$ = "+" + acc += 1 + print acc + . + . +. +run "HQ9+" diff --git a/Task/Execute-HQ9+/Haxe/execute-hq9+.haxe b/Task/Execute-HQ9+/Haxe/execute-hq9+.hx similarity index 100% rename from Task/Execute-HQ9+/Haxe/execute-hq9+.haxe rename to Task/Execute-HQ9+/Haxe/execute-hq9+.hx diff --git a/Task/Execute-HQ9+/Julia/execute-hq9+.julia b/Task/Execute-HQ9+/Julia/execute-hq9+.jl similarity index 100% rename from Task/Execute-HQ9+/Julia/execute-hq9+.julia rename to Task/Execute-HQ9+/Julia/execute-hq9+.jl diff --git a/Task/Execute-HQ9+/Kotlin/execute-hq9+.kotlin b/Task/Execute-HQ9+/Kotlin/execute-hq9+.kts similarity index 100% rename from Task/Execute-HQ9+/Kotlin/execute-hq9+.kotlin rename to Task/Execute-HQ9+/Kotlin/execute-hq9+.kts diff --git a/Task/Execute-HQ9+/OCaml/execute-hq9+.ocaml b/Task/Execute-HQ9+/OCaml/execute-hq9+.ml similarity index 100% rename from Task/Execute-HQ9+/OCaml/execute-hq9+.ocaml rename to Task/Execute-HQ9+/OCaml/execute-hq9+.ml diff --git a/Task/Execute-HQ9+/PowerShell/execute-hq9+.psh b/Task/Execute-HQ9+/PowerShell/execute-hq9+.ps1 similarity index 100% rename from Task/Execute-HQ9+/PowerShell/execute-hq9+.psh rename to Task/Execute-HQ9+/PowerShell/execute-hq9+.ps1 diff --git a/Task/Execute-HQ9+/R/execute-hq9+.r b/Task/Execute-HQ9+/R/execute-hq9+.r new file mode 100644 index 0000000000..10b02e4152 --- /dev/null +++ b/Task/Execute-HQ9+/R/execute-hq9+.r @@ -0,0 +1,25 @@ +library(stringr) + +bottles <- function(){ + s <- function(n) ifelse(n==1, "", "s") + z <- function(n) ifelse(n==0, "No more", n) + cat(sapply(99:1, function(n) str_glue("{n} bottle{s(n)} of beer on the wall,\n", + "{n} bottle{s(n)} of beer,\n", + "Take one down, pass it around,\n", + "{z(n-1)} bottle{s(n-1)} of beer on the wall.")), sep="\n") +} + +hq9plus <- function(s){ + accumulator <- 0 + chars <- str_split_1(str_to_upper(s),"") + for(char in chars){ + switch(char, + "H"=cat("Hello World!","\n"), + "Q"=cat(s, "\n"), + "9"=bottles(), + "+"=eval(accumulator <- accumulator+1)) + } + cat("The value of the accumulator is", accumulator) +} + +hq9plus(readline()) diff --git a/Task/Execute-HQ9+/Rust/execute-hq9+.rust b/Task/Execute-HQ9+/Rust/execute-hq9+.rs similarity index 100% rename from Task/Execute-HQ9+/Rust/execute-hq9+.rust rename to Task/Execute-HQ9+/Rust/execute-hq9+.rs diff --git a/Task/Execute-HQ9+/V-(Vlang)/execute-hq9+.v b/Task/Execute-HQ9+/V-(Vlang)/execute-hq9+.v new file mode 100644 index 0000000000..eb112af6de --- /dev/null +++ b/Task/Execute-HQ9+/V-(Vlang)/execute-hq9+.v @@ -0,0 +1,31 @@ +fn eval(code string) { + mut accumulator := 0 + for cal in code.trim_space().to_lower() { + match cal { + `h` { println("Hello, world!") } + `q` { println(code) } + `9` { + bottles := fn (ir int) string { + match ir { + 0 { return "No bottles" } + 1 { return "One bottle" } + else { return "$ir bottles" } + } + } + for ir := 99; ir >= 1; ir-- { + println("${bottles(ir)} of beer on the wall,") + println("${bottles(ir)} of beer,") + println("take one down and pass it around,") + println("${bottles(ir - 1)} of beer on the wall!") + println("") + } + } + `+` { accumulator++ } + else { println("syntax error") } + } + } +} + +fn main() { + eval("hq9+") +} diff --git a/Task/Execute-SNUSP/11l/execute-snusp.11l b/Task/Execute-SNUSP/11l/execute-snusp.11l index 5bf2bdb258..3180c22226 100644 --- a/Task/Execute-SNUSP/11l/execute-snusp.11l +++ b/Task/Execute-SNUSP/11l/execute-snusp.11l @@ -40,7 +40,7 @@ F snusp(store, code) ‘,’ ds[dp] = Byte(:stdin.read(1).code) ‘/’ - id = (-)id + id = ~id ‘\’ id (+)= 1 ‘!’ diff --git a/Task/Execute-SNUSP/EasyLang/execute-snusp.easy b/Task/Execute-SNUSP/EasyLang/execute-snusp.easy new file mode 100644 index 0000000000..05ac014346 --- /dev/null +++ b/Task/Execute-SNUSP/EasyLang/execute-snusp.easy @@ -0,0 +1,59 @@ +proc snusp dlen raw$ . + len ds[] dlen + is$[] = strsplit raw$ "\n" + for s$ in is$[] + is$[][] &= strchars s$ + . + for ipr to len is$[][] + for ipc to len is$[ipr][] + if is$[ipr][ipc] = "$" : break 2 + . + . + dp = 1 + id = 0 + # + subr step + if id mod 2 = 0 + ipc += 1 - bitand id 2 + else + ipr += 1 - bitand id 2 + . + . + while ipr >= 1 and ipr <= len is$[][] and ipc >= 1 and ipc <= len is$[ipr][] + c$ = is$[ipr][ipc] + if c$ = ">" + dp += 1 + elif c$ = "<" + dp -= 1 + elif c$ = "+" + ds[dp] += 1 + elif c$ = "-" + ds[dp] -= 1 + elif c$ = "." + write strchar ds[dp] + elif c$ = "," + # ds[dp] = strcode input + elif c$ = "/" + id = bitxor id 3 + elif c$ = "\\" + id = bitxor id 1 + elif c$ = "!" + step + elif c$ = "?" + if ds[dp] = 0 : step + . + step + . +. +s$ = input +while s$ <> "" + cod$ &= "\n" & s$ + s$ = input +. +snusp 5 cod$ +# +input_data +/++++!/===========?\>++.>+.+++++++..+++\ +\+++\ | /+>+++++++>/ /++++++++++<<.++>./ +$+++/ | \+++++++++>\ \+++++.>.+++.-----\ + \==-<<<<+>+++/ /=.>.+>.--------.-/ diff --git a/Task/Execute-SNUSP/FreeBASIC/execute-snusp.basic b/Task/Execute-SNUSP/FreeBASIC/execute-snusp.basic new file mode 100644 index 0000000000..2a3ce48e9f --- /dev/null +++ b/Task/Execute-SNUSP/FreeBASIC/execute-snusp.basic @@ -0,0 +1,77 @@ +' Rosetta Code problem: https://rosettacode.org/wiki/Execute_SNUSP +' by Jjuanhdez, 05/2024 +' The interpreter below implements Core SNUSP: + +Const HW = "/++++!/===========?\>++.>+.+++++++..+++" & Chr(10) & _ +"\+++\ | /+>+++++++>/ /++++++++++<<.++>./" & Chr(10) & _ +"$+++/ | \+++++++++>\ \+++++.>.+++.-----\" & Chr(10) & _ +" \==-<<<<+>+++/ /=.>.+>.--------.-/" + +Dim Shared As Integer ipf, ipc ' instruction pointers in row and column +Dim Shared As Integer direcc ' direction (0 = right, 1 = down, 2 = left, 3 = up) + +Sub Paso() + If direcc And 1 Then + ipf += 1 - (direcc And 2) + Else + ipc += 1 - (direcc And 2) + End If +End Sub + +Sub SNUSP (dsLen As Integer, SNUSPcode As String) + Dim As Ubyte ad(dsLen - 1) ' data store + Dim As Integer dp ' data pointer + Dim As String cb(dsLen) ' two-way code storage + Dim As String fila, op, linea + Dim As Integer r, i, j + + dp = 0 + i = 1 + j = 1 + ipf = 0 + ipc = 0 + direcc = 0 + + While i <= Len(SNUSPcode) + If Mid(SNUSPcode, i, 1) = Chr(10) Then + cb(j) = linea + linea = "" + j += 1 + Else + linea &= Mid(SNUSPcode, i, 1) + End If + i += 1 + Wend + cb(j) = linea + + For r = 0 To Ubound(cb) + fila = cb(r) + ipc = Instr(fila, "$") - 1 + If ipc >= 0 Then + ipf = r + Exit For + End If + Next r + + While ipf >= 0 And ipf <= Ubound(cb) And ipc >= 0 And ipc < Len(cb(ipf)) + op = Mid(cb(ipf), ipc + 1, 1) + Select Case op + Case ">": dp += 1 ' RIGTH + Case "<": dp -= 1 ' LEFT + Case "+": ad(dp) += 1 ' INCR + Case "-": ad(dp) -= 1 ' DECR + Case ",": Input ad(dp) ' READ + Case ".": Print Chr(ad(dp)); ' WRITE + Case "/": direcc = Not direcc ' RULD + Case "\": direcc Xor= 1 ' LURD + Case "!": Paso ' SKIP + Case "?": If ad(dp) = 0 Then Paso ' SKIPZ + End Select + Paso + Wend + Print Chr(ad(dp)); +End Sub + +SNUSP(5, HW) + +Sleep diff --git a/Task/Execute-SNUSP/Julia/execute-snusp.julia b/Task/Execute-SNUSP/Julia/execute-snusp.jl similarity index 100% rename from Task/Execute-SNUSP/Julia/execute-snusp.julia rename to Task/Execute-SNUSP/Julia/execute-snusp.jl diff --git a/Task/Execute-SNUSP/Kotlin/execute-snusp.kotlin b/Task/Execute-SNUSP/Kotlin/execute-snusp.kts similarity index 100% rename from Task/Execute-SNUSP/Kotlin/execute-snusp.kotlin rename to Task/Execute-SNUSP/Kotlin/execute-snusp.kts diff --git a/Task/Execute-a-Markov-algorithm/11l/execute-a-markov-algorithm.11l b/Task/Execute-a-Markov-algorithm/11l/execute-a-markov-algorithm.11l index 5c8a789dc8..4c3cf6cc78 100644 --- a/Task/Execute-a-Markov-algorithm/11l/execute-a-markov-algorithm.11l +++ b/Task/Execute-a-Markov-algorithm/11l/execute-a-markov-algorithm.11l @@ -1,11 +1,4 @@ -T Rule - String pattern - String replacement - Bool terminating - F (pattern, replacement, terminating) - .pattern = pattern - .replacement = replacement - .terminating = terminating +T Rule = (String pattern, String replacement, Bool terminating) F parse(rules) [Rule] result diff --git a/Task/Execute-a-Markov-algorithm/Ada/execute-a-markov-algorithm-1.ada b/Task/Execute-a-Markov-algorithm/Ada/execute-a-markov-algorithm-1.adb similarity index 100% rename from Task/Execute-a-Markov-algorithm/Ada/execute-a-markov-algorithm-1.ada rename to Task/Execute-a-Markov-algorithm/Ada/execute-a-markov-algorithm-1.adb diff --git a/Task/Execute-a-Markov-algorithm/Ada/execute-a-markov-algorithm-2.ada b/Task/Execute-a-Markov-algorithm/Ada/execute-a-markov-algorithm-2.adb similarity index 100% rename from Task/Execute-a-Markov-algorithm/Ada/execute-a-markov-algorithm-2.ada rename to Task/Execute-a-Markov-algorithm/Ada/execute-a-markov-algorithm-2.adb diff --git a/Task/Execute-a-Markov-algorithm/Ada/execute-a-markov-algorithm-3.ada b/Task/Execute-a-Markov-algorithm/Ada/execute-a-markov-algorithm-3.adb similarity index 100% rename from Task/Execute-a-Markov-algorithm/Ada/execute-a-markov-algorithm-3.ada rename to Task/Execute-a-Markov-algorithm/Ada/execute-a-markov-algorithm-3.adb diff --git a/Task/Execute-a-Markov-algorithm/C-sharp/execute-a-markov-algorithm.cs b/Task/Execute-a-Markov-algorithm/C-sharp/execute-a-markov-algorithm.cs new file mode 100644 index 0000000000..6d3499bb58 --- /dev/null +++ b/Task/Execute-a-Markov-algorithm/C-sharp/execute-a-markov-algorithm.cs @@ -0,0 +1,161 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +public class Markov +{ + /// + /// Take a ruleset and return a function which takes a string to which the rules + /// should be applied. + /// + /// String containing the rules + /// A function that takes a string and applies the rules + public static Func CreateMarkovProcessor(string ruleSet) + { + // Convert a ruleset string into a dictionary + Dictionary MakeRuleMap(string ruleset) + { + return ruleset.Split('\n') + .Where(e => !e.StartsWith("#")) + .Select(e => e.Split(new[] { " -> " }, StringSplitOptions.None)) + .ToDictionary(e => e[0], e => e[1]); + } + + // Split a string at an index + Tuple SplitAt(string s, int i) + { + return new Tuple(s.Substring(0, i), s.Substring(i)); + } + + // Strip a leading number of chars from a string. + string StripLeading(string s, string strip) + { + return s.Substring(strip.Length); + } + + // Replace the substring in the string. + string Replace(string s, string find, string rep) + { + string result = s; + if (s.IndexOf(find) >= 0) + { + var a = SplitAt(s, s.IndexOf(find)); + result = a.Item1 + rep + StripLeading(a.Item2, find); + } + return result; + } + + // Recursively apply the ruleset to the string. + string Parse(Dictionary rules, string s) + { + string o = s; + foreach (var rule in rules) + { + string k = rule.Key; + string v = rule.Value; + + if (v.StartsWith(".")) + { + s = Replace(s, k, StripLeading(v, ".")); + break; + } + else + { + s = Replace(s, k, v); + if (s != o) { break; } + } + } + return o == s ? s : Parse(rules, s); + } + + var ruleMap = MakeRuleMap(ruleSet); + return str => Parse(ruleMap, str); + } + + public static void Main() + { + string ruleset1 = @"# This rules file is extracted from Wikipedia: +# http://en.wikipedia.org/wiki/Markov_Algorithm +A -> apple +B -> bag +S -> shop +T -> the +the shop -> my brother +a never used -> .terminating rule"; + + string ruleset2 = @"# Slightly modified from the rules on Wikipedia +A -> apple +B -> bag +S -> .shop +T -> the +the shop -> my brother +a never used -> .terminating rule"; + + string ruleset3 = @"# BNF Syntax testing rules +A -> apple +WWWW -> with +Bgage -> ->.* +B -> bag +->.* -> money +W -> WW +S -> .shop +T -> the +the shop -> my brother +a never used -> .terminating rule"; + + string ruleset4 = @"### Unary Multiplication Engine, for testing Markov Algorithm implementations +### By Donal Fellows. +# Unary addition engine +_+1 -> _1+ +1+1 -> 11+ +# Pass for converting from the splitting of multiplication into ordinary +# addition +1! -> !1 +,! -> !+ +_! -> _ +# Unary multiplication by duplicating left side, right side times +1*1 -> x,@y +1x -> xX +X, -> 1,1 +X1 -> 1X +_x -> _X +,x -> ,X +y1 -> 1y +y_ -> _ +# Next phase of applying +1@1 -> x,@y +1@_ -> @_ +,@_ -> !_ +++ -> + +# Termination cleanup for addition +_1 -> 1 +1+_ -> 1 +_+_ -> "; + + string ruleset5 = @"# Turing machine: three-state busy beaver +# +# state A, symbol 0 => write 1, move right, new state B +A0 -> 1B +# state A, symbol 1 => write 1, move left, new state C +0A1 -> C01 +1A1 -> C11 +# state B, symbol 0 => write 1, move left, new state A +0B0 -> A01 +1B0 -> A11 +# state B, symbol 1 => write 1, move right, new state B +B1 -> 1B +# state C, symbol 0 => write 1, move left, new state B +0C0 -> B01 +1C0 -> B11 +# state C, symbol 1 => write 1, move left, halt +0C1 -> H01 +1C1 -> H11"; + + Console.WriteLine(CreateMarkovProcessor(ruleset1)("I bought a B of As from T S.")); + Console.WriteLine(CreateMarkovProcessor(ruleset2)("I bought a B of As from T S.")); + Console.WriteLine(CreateMarkovProcessor(ruleset3)("I bought a B of As W my Bgage from T S.")); + Console.WriteLine(CreateMarkovProcessor(ruleset4)("_1111*11111_")); + Console.WriteLine(CreateMarkovProcessor(ruleset5)("000000A000000")); + } +} diff --git a/Task/Execute-a-Markov-algorithm/FreeBASIC/execute-a-markov-algorithm.basic b/Task/Execute-a-Markov-algorithm/FreeBASIC/execute-a-markov-algorithm.basic new file mode 100644 index 0000000000..8d0a5ec743 --- /dev/null +++ b/Task/Execute-a-Markov-algorithm/FreeBASIC/execute-a-markov-algorithm.basic @@ -0,0 +1,139 @@ +Sub Markov (rules As String, entrada As String, expected As String) + Dim As String subs(), reps(), lines() + Dim As String sub_, rep, li, res + Dim As Integer i, k + Dim As Integer start = 1, finish = 1 + + While finish <= Len(rules) + If Mid(rules, finish, 1) = Chr(10) Then + Redim Preserve lines(Ubound(lines) + 1) + lines(Ubound(lines)) = Mid(rules, start, finish - start) + start = finish + 1 + End If + finish += 1 + Wend + For i = 0 To Ubound(lines) + li = lines(i) + If Len(li) > 0 And Asc(li, 1) <> Asc("#") Then + k = Instr(li, " -> ") + If k > 0 Then + Redim Preserve subs(Ubound(subs) + 1) + subs(Ubound(subs)) = Trim(Mid(li, 1, k - 1)) + Redim Preserve reps(Ubound(reps) + 1) + reps(Ubound(reps)) = Trim(Mid(li, k + 4)) + End If + End If + Next i + + res = entrada + Dim As Boolean term = False, found = False + Do + found = False + For i = 0 To Ubound(subs) + sub_ = subs(i) + k = Instr(res, sub_) + If k > 0 Then + found = True + rep = reps(i) + If Len(rep) > 0 And Asc(rep, 1) = Asc(".") Then + rep = Mid(rep, 2) + term = True + End If + Mid(res, k, Len(sub_)) = rep + Exit For + End If + If Not term Then Exit For + Next i + If Not term Or Not found Then Exit Do + Loop + Print """"; entrada;""""; ", "; """"; expected; """"; ", "; Iif(res = expected, "**ERROR**", "ok") +End Sub + +Dim As String ruleset1 = _ +"# This rules file is extracted from Wikipedia:" & _ +"# http://en.wikipedia.org/wiki/Markov_Algorithm" & _ +"A -> apple" & _ +"B -> bag" & _ +"S -> shop" & _ +"T -> the" & _ +"the shop -> my brother" & _ +"a never used -> .terminating rule" +Markov(ruleset1,"I bought a B of As from T S.","I bought a bag of apples from my brother.") + +Dim As String ruleset2 = _ +"# Slightly modified from the rules on Wikipedia" & _ +"A -> apple" & _ +"B -> bag" & _ +"S -> .shop" & _ +"T -> the" & _ +"the shop -> my brother" & _ +"a never used -> .terminating rule" +Markov(ruleset2,"I bought a B of As from T S.","I bought a bag of apples from T shop.") + +Dim As String ruleset3 = _ +"# BNF Syntax testing rules" & _ +"A -> apple" & _ +"WWWW -> with" & _ +"Bgage -> ->.*" & _ +"B -> bag" & _ +"->.* -> money" & _ +"W -> WW" & _ +"S -> .shop" & _ +"T -> the" & _ +"the shop -> my brother" & _ +"a never used -> .terminating rule""" +Markov(ruleset3,"I bought a B of As W my Bgage from T S.","I bought a bag of apples with my money from T shop.") + +Dim As String ruleset4 = _ +"### Unary Multiplication Engine, for testing Markov Algorithm implementations" & _ +"### By Donal Fellows." & _ +"# Unary addition engine" & _ +"_+1 -> _1+" & _ +"1+1 -> 11+" & _ +"# Pass for converting from the splitting of multiplication into ordinary" & _ +"# addition" & _ +"1! -> !1" & _ +",! -> !+" & _ +"_! -> _" & _ +"# Unary multiplication by duplicating left side, right side times" & _ +"1*1 -> x,@y" & _ +"1x -> xX" & _ +"X, -> 1,1" & _ +"X1 -> 1X" & _ +"_x -> _X" & _ +",x -> ,X" & _ +"y1 -> 1y" & _ +"y_ -> _" & _ +"# Next phase of applying" & _ +"1@1 -> x,@y" & _ +"1@_ -> @_" & _ +",@_ -> !_" & _ +"++ -> +" & _ +"# Termination cleanup for addition" & _ +"_1 -> 1" & _ +"1+_ -> 1" & _ +"_+_ -> " +Markov(ruleset4,"_1111*11111_","11111111111111111111") + +Dim As String ruleset5 = _ +"# Turing machine: three-state busy beaver" & _ +"#" & _ +"# state A, symbol 0 => write 1, move right, new state B" & _ +"A0 -> 1B" & _ +"# state A, symbol 1 => write 1, move left, new state C" & _ +"0A1 -> C01" & _ +"1A1 -> C11" & _ +"# state B, symbol 0 => write 1, move left, new state A" & _ +"0B0 -> A01" & _ +"1B0 -> A11" & _ +"# state B, symbol 1 => write 1, move right, new state B" & _ +"B1 -> 1B" & _ +"# state C, symbol 0 => write 1, move left, new state B" & _ +"0C0 -> B01" & _ +"1C0 -> B11" & _ +"# state C, symbol 1 => write 1, move left, halt" & _ +"0C1 -> H01" & _ +"1C1 -> H11" +Markov(ruleset5,"000000A000000","00011H1111000") + +Sleep diff --git a/Task/Execute-a-Markov-algorithm/Julia/execute-a-markov-algorithm-1.julia b/Task/Execute-a-Markov-algorithm/Julia/execute-a-markov-algorithm-1.jl similarity index 100% rename from Task/Execute-a-Markov-algorithm/Julia/execute-a-markov-algorithm-1.julia rename to Task/Execute-a-Markov-algorithm/Julia/execute-a-markov-algorithm-1.jl diff --git a/Task/Execute-a-Markov-algorithm/Julia/execute-a-markov-algorithm-2.julia b/Task/Execute-a-Markov-algorithm/Julia/execute-a-markov-algorithm-2.jl similarity index 100% rename from Task/Execute-a-Markov-algorithm/Julia/execute-a-markov-algorithm-2.julia rename to Task/Execute-a-Markov-algorithm/Julia/execute-a-markov-algorithm-2.jl diff --git a/Task/Execute-a-Markov-algorithm/Kotlin/execute-a-markov-algorithm.kotlin b/Task/Execute-a-Markov-algorithm/Kotlin/execute-a-markov-algorithm.kts similarity index 100% rename from Task/Execute-a-Markov-algorithm/Kotlin/execute-a-markov-algorithm.kotlin rename to Task/Execute-a-Markov-algorithm/Kotlin/execute-a-markov-algorithm.kts diff --git a/Task/Execute-a-Markov-algorithm/OCaml/execute-a-markov-algorithm.ocaml b/Task/Execute-a-Markov-algorithm/OCaml/execute-a-markov-algorithm.ml similarity index 100% rename from Task/Execute-a-Markov-algorithm/OCaml/execute-a-markov-algorithm.ocaml rename to Task/Execute-a-Markov-algorithm/OCaml/execute-a-markov-algorithm.ml diff --git a/Task/Execute-a-Markov-algorithm/Refal/execute-a-markov-algorithm.refal b/Task/Execute-a-Markov-algorithm/Refal/execute-a-markov-algorithm.refal new file mode 100644 index 0000000000..482e4b3e3a --- /dev/null +++ b/Task/Execute-a-Markov-algorithm/Refal/execute-a-markov-algorithm.refal @@ -0,0 +1,57 @@ +$ENTRY Go { + , : e.File + , : e.Input + , : e.Lines + , : e.Rules + , : e.Result + = ; +}; + +Each { + s.F = ; + s.F (e.I) e.R = ; +}; + +ReadLines { + s.Chan e.File = + ; + (s.Chan), : { + 0 = ; + e.Line = (e.Line) ; + }; +}; + +ParseRule { + = (Empty); + '#' e.X = (Empty); + e.Pat ' -> ' e.Rep, + : e.TrPat, + : e.TrRep, + e.TrRep: { + '.' e.R = (Term (e.Pat) (e.R)); + e.R = (Nonterm (e.Pat) (e.R)); + }; +}; + +ApplyRule { + (s.Type (e.Pat) (e.Rep)) e.Subj, + e.Subj: e.X e.Pat e.Y = s.Type e.X e.Rep e.Y; + t.Rule e.Subj = NoMatch e.Subj; +}; + +Apply { + (e.Rules) () e.Subj = e.Subj; + (e.Rules) (t.Rule e.Rest) e.Subj, + : { + NoMatch e.Subj = ; + Term e.Res = e.Res; + Nonterm e.Res = ; + }; + (e.Rules) e.Subj = ; +}; + +Trim { + ' ' e.X = ; + e.X ' ' = ; + e.X = e.X; +}; diff --git a/Task/Execute-a-Markov-algorithm/Rust/execute-a-markov-algorithm.rust b/Task/Execute-a-Markov-algorithm/Rust/execute-a-markov-algorithm.rs similarity index 100% rename from Task/Execute-a-Markov-algorithm/Rust/execute-a-markov-algorithm.rust rename to Task/Execute-a-Markov-algorithm/Rust/execute-a-markov-algorithm.rs diff --git a/Task/Execute-a-Markov-algorithm/SETL/execute-a-markov-algorithm.setl b/Task/Execute-a-Markov-algorithm/SETL/execute-a-markov-algorithm.setl new file mode 100644 index 0000000000..679a6f79b7 --- /dev/null +++ b/Task/Execute-a-Markov-algorithm/SETL/execute-a-markov-algorithm.setl @@ -0,0 +1,62 @@ +program markov_algorithm; + magic := false; + if command_line(1) = om then + print("error: no ruleset file given"); + stop; + elseif command_line(2) = om then + print("error: no input string given"); + stop; + end if; + + rules := read_file(command_line(1)); + + input := command_line(2); + loop do + loop for [pat, repl, trm] in rules do + if pat in input then + input(pat) := repl; + if trm then + quit; + else + continue loop do; + end if; + end if; + end loop; + quit; + end loop; + print(input); + + proc read_file(file_name); + if (rulefile := open(file_name, "r")) = om then + print("error: cannot open ruleset file"); + stop; + end if; + + rules := []; + loop doing + line := getline(rulefile); + while line /= om do + rule := parse_rule(line); + if rule /= om then rules with:= rule; end if; + end loop; + return rules; + end proc; + + proc parse_rule(rule); + if rule(1) = "#" then return om; end if; $ comment + if " -> " notin rule then return om; end if; $ not a rule + + [s, e] := mark(rule, " -> "); + pattern := rule(..s-1); + repl := rule(e+1..); + + whitespace := "\t\r\n "; + span(pattern, whitespace); + rspan(pattern, whitespace); + span(repl, whitespace); + rspan(repl, whitespace); + + trm := match(repl, ".") /= ""; + return [pattern, repl, trm]; + end proc; +end program; diff --git a/Task/Execute-a-Markov-algorithm/Scheme/execute-a-markov-algorithm.ss b/Task/Execute-a-Markov-algorithm/Scheme/execute-a-markov-algorithm.scm similarity index 100% rename from Task/Execute-a-Markov-algorithm/Scheme/execute-a-markov-algorithm.ss rename to Task/Execute-a-Markov-algorithm/Scheme/execute-a-markov-algorithm.scm diff --git a/Task/Execute-a-Markov-algorithm/VBScript/execute-a-markov-algorithm-1.vb b/Task/Execute-a-Markov-algorithm/VBScript/execute-a-markov-algorithm-1.vbs similarity index 100% rename from Task/Execute-a-Markov-algorithm/VBScript/execute-a-markov-algorithm-1.vb rename to Task/Execute-a-Markov-algorithm/VBScript/execute-a-markov-algorithm-1.vbs diff --git a/Task/Execute-a-Markov-algorithm/VBScript/execute-a-markov-algorithm-2.vb b/Task/Execute-a-Markov-algorithm/VBScript/execute-a-markov-algorithm-2.vbs similarity index 100% rename from Task/Execute-a-Markov-algorithm/VBScript/execute-a-markov-algorithm-2.vb rename to Task/Execute-a-Markov-algorithm/VBScript/execute-a-markov-algorithm-2.vbs diff --git a/Task/Execute-a-Markov-algorithm/VBScript/execute-a-markov-algorithm-3.vb b/Task/Execute-a-Markov-algorithm/VBScript/execute-a-markov-algorithm-3.vbs similarity index 100% rename from Task/Execute-a-Markov-algorithm/VBScript/execute-a-markov-algorithm-3.vb rename to Task/Execute-a-Markov-algorithm/VBScript/execute-a-markov-algorithm-3.vbs diff --git a/Task/Execute-a-Markov-algorithm/Wren/execute-a-markov-algorithm.wren b/Task/Execute-a-Markov-algorithm/Wren/execute-a-markov-algorithm.wren index e3b8e66652..0012cfa75b 100644 --- a/Task/Execute-a-Markov-algorithm/Wren/execute-a-markov-algorithm.wren +++ b/Task/Execute-a-Markov-algorithm/Wren/execute-a-markov-algorithm.wren @@ -1,5 +1,5 @@ -import "/ioutil" for FileUtil, File -import "/pattern" for Pattern +import "./ioutil" for FileUtil, File +import "./pattern" for Pattern var lb = FileUtil.lineBreak diff --git a/Task/Execute-a-Markov-algorithm/Zig/execute-a-markov-algorithm.zig b/Task/Execute-a-Markov-algorithm/Zig/execute-a-markov-algorithm.zig new file mode 100644 index 0000000000..ec8bb8934d --- /dev/null +++ b/Task/Execute-a-Markov-algorithm/Zig/execute-a-markov-algorithm.zig @@ -0,0 +1,278 @@ +const std = @import("std"); +const testing = std.testing; +const mem = std.mem; +const Allocator = std.mem.Allocator; + +// Add a main function for Zig playground to compile +pub fn main() !void { + // Empty main function to satisfy the compiler + std.debug.print("Markov Algorithm library\n", .{}); +} + +pub const Rule = struct { + pat: []const u8, + rep: []const u8, + terminal: bool, + + pub fn init(allocator: Allocator, pat: []const u8, rep: []const u8, terminal: bool) !Rule { + const pat_owned = try allocator.dupe(u8, pat); + const rep_owned = try allocator.dupe(u8, rep); + return Rule{ + .pat = pat_owned, + .rep = rep_owned, + .terminal = terminal, + }; + } + + pub fn deinit(self: *Rule, allocator: Allocator) void { + allocator.free(self.pat); + allocator.free(self.rep); + } + + pub fn clone(self: Rule, allocator: Allocator) !Rule { + return try Rule.init(allocator, self.pat, self.rep, self.terminal); + } + + pub fn applicableRange(self: *const Rule, input: []const u8) ?struct { start: usize, end: usize } { + if (mem.indexOf(u8, input, self.pat)) |start| { + return .{ .start = start, .end = start + self.pat.len }; + } + return null; + } + + pub fn apply(self: *const Rule, s: *std.ArrayList(u8)) !bool { + if (self.applicableRange(s.items)) |range| { + try s.replaceRange(range.start, range.end - range.start, self.rep); + return true; + } + return false; + } + + pub fn fromString(allocator: Allocator, s: []const u8) !Rule { + var parts = mem.splitSequence(u8, s, " -> "); + const pat = parts.first(); + const rep_opt = parts.next(); + if (rep_opt == null) { + return error.InvalidFormat; + } + const rep = rep_opt.?; + + if (rep.len > 0 and rep[0] == '.') { + return Rule.init(allocator, pat, rep[1..], true); + } else { + return Rule.init(allocator, pat, rep, false); + } + } +}; + +pub const Rules = struct { + rules: std.ArrayList(Rule), + allocator: Allocator, + + pub fn init(allocator: Allocator) Rules { + return Rules{ + .rules = std.ArrayList(Rule).init(allocator), + .allocator = allocator, + }; + } + + pub fn deinit(self: *Rules) void { + for (self.rules.items) |*rule| { + rule.deinit(self.allocator); + } + self.rules.deinit(); + } + + pub fn clone(self: Rules) !Rules { + var new_rules = Rules.init(self.allocator); + for (self.rules.items) |rule| { + try new_rules.rules.append(try rule.clone(self.allocator)); + } + return new_rules; + } + + pub fn apply(self: *const Rules, s: *std.ArrayList(u8)) !?*const Rule { + for (self.rules.items) |*rule| { + if (try rule.apply(s)) { + return rule; + } + } + return null; + } + + pub fn execute(self: *const Rules, buffer: []const u8) ![]u8 { + var result = try std.ArrayList(u8).initCapacity(self.allocator, buffer.len); + try result.appendSlice(buffer); + + while (try self.apply(&result)) |rule| { + if (rule.terminal) { + break; + } + } + + return result.toOwnedSlice(); + } + + pub fn fromString(allocator: Allocator, s: []const u8) !Rules { + var result = Rules.init(allocator); + var lines = mem.splitScalar(u8, s, '\n'); + + while (lines.next()) |line| { + const trimmed = mem.trim(u8, line, &std.ascii.whitespace); + if (trimmed.len == 0 or trimmed[0] == '#') { + continue; + } + const rule = try Rule.fromString(allocator, trimmed); + try result.rules.append(rule); + } + + return result; + } +}; + +test "case_01" { + const allocator = std.testing.allocator; + const input = "I bought a B of As from T S."; + const rules_str = + \\# This rules file is extracted from Wikipedia: + \\# http://en.wikipedia.org/wiki/Markov_Algorithm + \\A -> apple + \\B -> bag + \\S -> shop + \\T -> the + \\the shop -> my brother + \\a never used -> .terminating rule + ; + + var rules = try Rules.fromString(allocator, rules_str); + defer rules.deinit(); + + const result = try rules.execute(input); + defer allocator.free(result); + + try testing.expectEqualStrings("I bought a bag of apples from my brother.", result); +} + +test "case_02" { + const allocator = std.testing.allocator; + const input = "I bought a B of As from T S."; + const rules_str = + \\# Slightly modified from the rules on Wikipedia + \\A -> apple + \\B -> bag + \\S -> .shop + \\T -> the + \\the shop -> my brother + \\a never used -> .terminating rule + ; + + var rules = try Rules.fromString(allocator, rules_str); + defer rules.deinit(); + + const result = try rules.execute(input); + defer allocator.free(result); + + try testing.expectEqualStrings("I bought a bag of apples from T shop.", result); +} + +test "case_03" { + const allocator = std.testing.allocator; + const input = "I bought a B of As W my Bgage from T S."; + const rules_str = + \\# BNF Syntax testing rules + \\A -> apple + \\WWWW -> with + \\Bgage -> ->.* + \\B -> bag + \\->.* -> money + \\W -> WW + \\S -> .shop + \\T -> the + \\the shop -> my brother + \\a never used -> .terminating rule + ; + + var rules = try Rules.fromString(allocator, rules_str); + defer rules.deinit(); + + const result = try rules.execute(input); + defer allocator.free(result); + + try testing.expectEqualStrings("I bought a bag of apples with my money from T shop.", result); +} + +test "case_04" { + const allocator = std.testing.allocator; + const input = "_1111*11111_"; + const rules_str = + \\### Unary Multiplication Engine, for testing Markov Algorithm implementations + \\### By Donal Fellows. + \\# Unary addition engine + \\_+1 -> _1+ + \\1+1 -> 11+ + \\# Pass for converting from the splitting of multiplication into ordinary + \\# addition + \\1! -> !1 + \\,! -> !+ + \\_! -> _ + \\# Unary multiplication by duplicating left side, right side times + \\1*1 -> x,@y + \\1x -> xX + \\X, -> 1,1 + \\X1 -> 1X + \\_x -> _X + \\,x -> ,X + \\y1 -> 1y + \\y_ -> _ + \\# Next phase of applying + \\1@1 -> x,@y + \\1@_ -> @_ + \\,@_ -> !_ + \\++ -> + + \\# Termination cleanup for addition + \\_1 -> 1 + \\1+_ -> 1 + \\_+_ -> + ; + + var rules = try Rules.fromString(allocator, rules_str); + defer rules.deinit(); + + const result = try rules.execute(input); + defer allocator.free(result); + + try testing.expectEqualStrings("11111111111111111111", result); +} + +test "case_05" { + const allocator = std.testing.allocator; + const input = "000000A000000"; + const rules_str = + \\# Turing machine: three-state busy beaver + \\# + \\# state A, symbol 0 => write 1, move right, new state B + \\A0 -> 1B + \\# state A, symbol 1 => write 1, move left, new state C + \\0A1 -> C01 + \\1A1 -> C11 + \\# state B, symbol 0 => write 1, move left, new state A + \\0B0 -> A01 + \\1B0 -> A11 + \\# state B, symbol 1 => write 1, move right, new state B + \\B1 -> 1B + \\# state C, symbol 0 => write 1, move left, new state B + \\0C0 -> B01 + \\1C0 -> B11 + \\# state C, symbol 1 => write 1, move left, halt + \\0C1 -> H01 + \\1C1 -> H11 + ; + + var rules = try Rules.fromString(allocator, rules_str); + defer rules.deinit(); + + const result = try rules.execute(input); + defer allocator.free(result); + + try testing.expectEqualStrings("00011H1111000", result); +} diff --git a/Task/Execute-a-system-command/Ada/execute-a-system-command-1.ada b/Task/Execute-a-system-command/Ada/execute-a-system-command-1.adb similarity index 100% rename from Task/Execute-a-system-command/Ada/execute-a-system-command-1.ada rename to Task/Execute-a-system-command/Ada/execute-a-system-command-1.adb diff --git a/Task/Execute-a-system-command/Ada/execute-a-system-command-2.ada b/Task/Execute-a-system-command/Ada/execute-a-system-command-2.adb similarity index 100% rename from Task/Execute-a-system-command/Ada/execute-a-system-command-2.ada rename to Task/Execute-a-system-command/Ada/execute-a-system-command-2.adb diff --git a/Task/Execute-a-system-command/Ada/execute-a-system-command-3.ada b/Task/Execute-a-system-command/Ada/execute-a-system-command-3.adb similarity index 100% rename from Task/Execute-a-system-command/Ada/execute-a-system-command-3.ada rename to Task/Execute-a-system-command/Ada/execute-a-system-command-3.adb diff --git a/Task/Execute-a-system-command/ArkScript/execute-a-system-command.ark b/Task/Execute-a-system-command/ArkScript/execute-a-system-command.ark new file mode 100644 index 0000000000..40b7da0d2d --- /dev/null +++ b/Task/Execute-a-system-command/ArkScript/execute-a-system-command.ark @@ -0,0 +1,3 @@ +(import std.Sys) + +(print (sys:exec "ls")) diff --git a/Task/Execute-a-system-command/AutoIt/execute-a-system-command.autoit b/Task/Execute-a-system-command/AutoIt/execute-a-system-command.au3 similarity index 100% rename from Task/Execute-a-system-command/AutoIt/execute-a-system-command.autoit rename to Task/Execute-a-system-command/AutoIt/execute-a-system-command.au3 diff --git a/Task/Execute-a-system-command/COBOL/execute-a-system-command.cobol b/Task/Execute-a-system-command/COBOL/execute-a-system-command.cob similarity index 100% rename from Task/Execute-a-system-command/COBOL/execute-a-system-command.cobol rename to Task/Execute-a-system-command/COBOL/execute-a-system-command.cob diff --git a/Task/Execute-a-system-command/Delphi/execute-a-system-command.delphi b/Task/Execute-a-system-command/Delphi/execute-a-system-command.pas similarity index 100% rename from Task/Execute-a-system-command/Delphi/execute-a-system-command.delphi rename to Task/Execute-a-system-command/Delphi/execute-a-system-command.pas diff --git a/Task/Execute-a-system-command/Emacs-Lisp/execute-a-system-command-1.l b/Task/Execute-a-system-command/Emacs-Lisp/execute-a-system-command-1.el similarity index 100% rename from Task/Execute-a-system-command/Emacs-Lisp/execute-a-system-command-1.l rename to Task/Execute-a-system-command/Emacs-Lisp/execute-a-system-command-1.el diff --git a/Task/Execute-a-system-command/Emacs-Lisp/execute-a-system-command-2.l b/Task/Execute-a-system-command/Emacs-Lisp/execute-a-system-command-2.el similarity index 100% rename from Task/Execute-a-system-command/Emacs-Lisp/execute-a-system-command-2.l rename to Task/Execute-a-system-command/Emacs-Lisp/execute-a-system-command-2.el diff --git a/Task/Execute-a-system-command/Euphoria/execute-a-system-command.euphoria b/Task/Execute-a-system-command/Euphoria/execute-a-system-command.eu similarity index 100% rename from Task/Execute-a-system-command/Euphoria/execute-a-system-command.euphoria rename to Task/Execute-a-system-command/Euphoria/execute-a-system-command.eu diff --git a/Task/Execute-a-system-command/Julia/execute-a-system-command.julia b/Task/Execute-a-system-command/Julia/execute-a-system-command.jl similarity index 100% rename from Task/Execute-a-system-command/Julia/execute-a-system-command.julia rename to Task/Execute-a-system-command/Julia/execute-a-system-command.jl diff --git a/Task/Execute-a-system-command/Kotlin/execute-a-system-command.kotlin b/Task/Execute-a-system-command/Kotlin/execute-a-system-command.kts similarity index 100% rename from Task/Execute-a-system-command/Kotlin/execute-a-system-command.kotlin rename to Task/Execute-a-system-command/Kotlin/execute-a-system-command.kts diff --git a/Task/Execute-a-system-command/OCaml/execute-a-system-command-1.ocaml b/Task/Execute-a-system-command/OCaml/execute-a-system-command-1.ml similarity index 100% rename from Task/Execute-a-system-command/OCaml/execute-a-system-command-1.ocaml rename to Task/Execute-a-system-command/OCaml/execute-a-system-command-1.ml diff --git a/Task/Execute-a-system-command/OCaml/execute-a-system-command-2.ocaml b/Task/Execute-a-system-command/OCaml/execute-a-system-command-2.ml similarity index 100% rename from Task/Execute-a-system-command/OCaml/execute-a-system-command-2.ocaml rename to Task/Execute-a-system-command/OCaml/execute-a-system-command-2.ml diff --git a/Task/Execute-a-system-command/OCaml/execute-a-system-command-3.ocaml b/Task/Execute-a-system-command/OCaml/execute-a-system-command-3.ml similarity index 100% rename from Task/Execute-a-system-command/OCaml/execute-a-system-command-3.ocaml rename to Task/Execute-a-system-command/OCaml/execute-a-system-command-3.ml diff --git a/Task/Execute-a-system-command/PascalABC.NET/execute-a-system-command.pas b/Task/Execute-a-system-command/PascalABC.NET/execute-a-system-command.pas new file mode 100644 index 0000000000..ab758487a0 --- /dev/null +++ b/Task/Execute-a-system-command/PascalABC.NET/execute-a-system-command.pas @@ -0,0 +1,2 @@ +## +exec('cmd.exe','/c dir /p'); diff --git a/Task/Execute-a-system-command/Pluto/execute-a-system-command.pluto b/Task/Execute-a-system-command/Pluto/execute-a-system-command.pluto new file mode 100644 index 0000000000..3f325c8c2e --- /dev/null +++ b/Task/Execute-a-system-command/Pluto/execute-a-system-command.pluto @@ -0,0 +1 @@ +os.execute("pause") diff --git a/Task/Execute-a-system-command/PowerShell/execute-a-system-command-1.psh b/Task/Execute-a-system-command/PowerShell/execute-a-system-command-1.ps1 similarity index 100% rename from Task/Execute-a-system-command/PowerShell/execute-a-system-command-1.psh rename to Task/Execute-a-system-command/PowerShell/execute-a-system-command-1.ps1 diff --git a/Task/Execute-a-system-command/PowerShell/execute-a-system-command-2.psh b/Task/Execute-a-system-command/PowerShell/execute-a-system-command-2.ps1 similarity index 100% rename from Task/Execute-a-system-command/PowerShell/execute-a-system-command-2.psh rename to Task/Execute-a-system-command/PowerShell/execute-a-system-command-2.ps1 diff --git a/Task/Execute-a-system-command/REBOL/execute-a-system-command.rebol b/Task/Execute-a-system-command/Rebol/execute-a-system-command.rebol similarity index 100% rename from Task/Execute-a-system-command/REBOL/execute-a-system-command.rebol rename to Task/Execute-a-system-command/Rebol/execute-a-system-command.rebol diff --git a/Task/Execute-a-system-command/Rust/execute-a-system-command.rust b/Task/Execute-a-system-command/Rust/execute-a-system-command.rs similarity index 100% rename from Task/Execute-a-system-command/Rust/execute-a-system-command.rust rename to Task/Execute-a-system-command/Rust/execute-a-system-command.rs diff --git a/Task/Execute-a-system-command/Rye/execute-a-system-command.rye b/Task/Execute-a-system-command/Rye/execute-a-system-command.rye new file mode 100644 index 0000000000..97164e6532 --- /dev/null +++ b/Task/Execute-a-system-command/Rye/execute-a-system-command.rye @@ -0,0 +1,3 @@ +cc os +ls +cwd? diff --git a/Task/Execute-a-system-command/Scheme/execute-a-system-command.ss b/Task/Execute-a-system-command/Scheme/execute-a-system-command.scm similarity index 100% rename from Task/Execute-a-system-command/Scheme/execute-a-system-command.ss rename to Task/Execute-a-system-command/Scheme/execute-a-system-command.scm diff --git a/Task/Execute-a-system-command/Seed7/execute-a-system-command.seed7 b/Task/Execute-a-system-command/Seed7/execute-a-system-command.seed7 index eafaacc2ca..7de9dc25a3 100644 --- a/Task/Execute-a-system-command/Seed7/execute-a-system-command.seed7 +++ b/Task/Execute-a-system-command/Seed7/execute-a-system-command.seed7 @@ -3,5 +3,5 @@ $ include "seed7_05.s7i"; const proc: main is func begin - cmd_sh("ls"); + shellCmd("ls"); end func; diff --git a/Task/Execute-a-system-command/VBScript/execute-a-system-command.vb b/Task/Execute-a-system-command/VBScript/execute-a-system-command.vbs similarity index 100% rename from Task/Execute-a-system-command/VBScript/execute-a-system-command.vb rename to Task/Execute-a-system-command/VBScript/execute-a-system-command.vbs diff --git a/Task/Execute-a-system-command/Wren/execute-a-system-command-1.wren b/Task/Execute-a-system-command/Wren/execute-a-system-command-1.wren deleted file mode 100644 index a29e2c106c..0000000000 --- a/Task/Execute-a-system-command/Wren/execute-a-system-command-1.wren +++ /dev/null @@ -1,8 +0,0 @@ -/* run_system_command.wren */ -class Command { - foreign static exec(name, param) // the code for this is provided by Go -} - -Command.exec("ls", "-lt") -System.print() -Command.exec("dir", "") diff --git a/Task/Execute-a-system-command/Wren/execute-a-system-command-2.wren b/Task/Execute-a-system-command/Wren/execute-a-system-command-2.wren deleted file mode 100644 index ad43e08451..0000000000 --- a/Task/Execute-a-system-command/Wren/execute-a-system-command-2.wren +++ /dev/null @@ -1,39 +0,0 @@ -/* run_system_command.go*/ -package main - -import ( - wren "github.com/crazyinfin8/WrenGo" - "log" - "os" - "os/exec" -) - -type any = interface{} - -func execCommand(vm *wren.VM, parameters []any) (any, error) { - name := parameters[1].(string) - param := parameters[2].(string) - var cmd *exec.Cmd - if param != "" { - cmd = exec.Command(name, param) - } else { - cmd = exec.Command(name) - } - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - log.Fatal(err) - } - return nil, nil -} - -func main() { - vm := wren.NewVM() - fileName := "run_system_command.wren" - methodMap := wren.MethodMap{"static exec(_,_)": execCommand} - classMap := wren.ClassMap{"Command": wren.NewClass(nil, nil, methodMap)} - module := wren.NewModule(classMap) - vm.SetModule(fileName, module) - vm.InterpretFile(fileName) - vm.Free() -} diff --git a/Task/Execute-a-system-command/Wren/execute-a-system-command.wren b/Task/Execute-a-system-command/Wren/execute-a-system-command.wren new file mode 100644 index 0000000000..1d97b0a9de --- /dev/null +++ b/Task/Execute-a-system-command/Wren/execute-a-system-command.wren @@ -0,0 +1,5 @@ +import "os" for Process + +Process.exec("ls", ["-lt"]) +System.print() +Process.exec("dir") diff --git a/Task/Exponentiation-operator/Ada/exponentiation-operator-1.ada b/Task/Exponentiation-operator/Ada/exponentiation-operator-1.adb similarity index 100% rename from Task/Exponentiation-operator/Ada/exponentiation-operator-1.ada rename to Task/Exponentiation-operator/Ada/exponentiation-operator-1.adb diff --git a/Task/Exponentiation-operator/Ada/exponentiation-operator-2.ada b/Task/Exponentiation-operator/Ada/exponentiation-operator-2.adb similarity index 100% rename from Task/Exponentiation-operator/Ada/exponentiation-operator-2.ada rename to Task/Exponentiation-operator/Ada/exponentiation-operator-2.adb diff --git a/Task/Exponentiation-operator/Ada/exponentiation-operator-3.ada b/Task/Exponentiation-operator/Ada/exponentiation-operator-3.adb similarity index 100% rename from Task/Exponentiation-operator/Ada/exponentiation-operator-3.ada rename to Task/Exponentiation-operator/Ada/exponentiation-operator-3.adb diff --git a/Task/Exponentiation-operator/Batch-File/exponentiation-operator.bat b/Task/Exponentiation-operator/Batch-File/exponentiation-operator.bat new file mode 100644 index 0000000000..f9b95744f4 --- /dev/null +++ b/Task/Exponentiation-operator/Batch-File/exponentiation-operator.bat @@ -0,0 +1,18 @@ +@echo off +setlocal enableextensions enabledelayedexpansion +set /p a= +set /p b= +call :pow %a% %b% +echo %_a% +goto :eof +:pow Integer Integer +:: Right-to-left binary exponentiation +set /a "_a=1, s=%1, e=%2" +:looppow +if %e% neq 0 ( +set /a "t=e&1" +if !t! equ 1 (set /a "_a*=s") +set /a "s*=s, e>>=1" +goto looppow +) +goto :eof diff --git a/Task/Exponentiation-operator/Delphi/exponentiation-operator.delphi b/Task/Exponentiation-operator/Delphi/exponentiation-operator.pas similarity index 100% rename from Task/Exponentiation-operator/Delphi/exponentiation-operator.delphi rename to Task/Exponentiation-operator/Delphi/exponentiation-operator.pas diff --git a/Task/Exponentiation-operator/EasyLang/exponentiation-operator.easy b/Task/Exponentiation-operator/EasyLang/exponentiation-operator.easy index f7a1d893bf..126b429c63 100644 --- a/Task/Exponentiation-operator/EasyLang/exponentiation-operator.easy +++ b/Task/Exponentiation-operator/EasyLang/exponentiation-operator.easy @@ -1,12 +1,10 @@ func mypow n exp . - r = 1 if exp < 0 exp = -exp n = 1 / n . - for i to exp - r *= n - . + r = 1 + for i to exp : r *= n return r . print mypow pi 2 diff --git a/Task/Exponentiation-operator/Elixir/exponentiation-operator.elixir b/Task/Exponentiation-operator/Elixir/exponentiation-operator.ex similarity index 100% rename from Task/Exponentiation-operator/Elixir/exponentiation-operator.elixir rename to Task/Exponentiation-operator/Elixir/exponentiation-operator.ex diff --git a/Task/Exponentiation-operator/Julia/exponentiation-operator.julia b/Task/Exponentiation-operator/Julia/exponentiation-operator.jl similarity index 100% rename from Task/Exponentiation-operator/Julia/exponentiation-operator.julia rename to Task/Exponentiation-operator/Julia/exponentiation-operator.jl diff --git a/Task/Exponentiation-operator/Kotlin/exponentiation-operator.kotlin b/Task/Exponentiation-operator/Kotlin/exponentiation-operator.kts similarity index 100% rename from Task/Exponentiation-operator/Kotlin/exponentiation-operator.kotlin rename to Task/Exponentiation-operator/Kotlin/exponentiation-operator.kts diff --git a/Task/Exponentiation-operator/MiniScript/exponentiation-operator.mini b/Task/Exponentiation-operator/MiniScript/exponentiation-operator.mini new file mode 100644 index 0000000000..e082de1366 --- /dev/null +++ b/Task/Exponentiation-operator/MiniScript/exponentiation-operator.mini @@ -0,0 +1,58 @@ +import "qa" + +number.isInteger = function + return self == floor(self) +end function + +ipow = function(base, exp) + if not base.isInteger then qa.abort("ipow must have an integer base") + if not exp.isInteger then qa.abort("ipow must have an integer exponent") + if base == 1 or exp == 0 then return 1 + if base == -1 then + if exp%2 == 0 then return 1 + return -1 + end if + if exp < 0 then qa.abort("ipow cannot have a negative exponent") + ans = 1 + e = exp + while e > 1 + if e%2 == 1 then ans *= base + e = floor(e/2) + base *= base + end while + return ans * base +end function + +fpow = function(base, exp) + if not exp.isInteger then qa.abort("fpow must have an integer exponent") + ans = 1.0 + e = exp + if e < 0 then + base = 1 / base + e = -e + end if + while e > 0 + if e%2 == 1 then ans *= base + e = floor(e/2) + base *= base + end while + return ans +end function + +print "Using the reimplemented functions:" +print " 2 ^ 3 = " + ipow(2, 3) +print " 1 ^ -10 = " + ipow(1, -10) +print " -1 ^ -3 = " + ipow(-1, -3) +print +print " 2.0 ^ -3 = " + fpow(2.0, -3) +print " 1.5 ^ 0 = " + fpow(1.5, 0) +print " 4.5 ^ 2 = " + fpow(4.5, 2) +print +print "Using the ^ operator:" +print " 2 ^ 3 = " + 2 ^ 3 +print " 1 ^ -10 = " + 1 ^ (-10) +print " -1 ^ -3 = " + (-1) ^ (-3) +print +print " 2.0 ^ -3 = " + 2.0 ^ (-3) +print " 1.5 ^ 0 = " + 1.5 ^ 0 +print " 4.5 ^ 2 = " + 4.5 ^ 2 diff --git a/Task/Exponentiation-operator/OCaml/exponentiation-operator.ocaml b/Task/Exponentiation-operator/OCaml/exponentiation-operator.ml similarity index 100% rename from Task/Exponentiation-operator/OCaml/exponentiation-operator.ocaml rename to Task/Exponentiation-operator/OCaml/exponentiation-operator.ml diff --git a/Task/Exponentiation-operator/Phix/exponentiation-operator.phix b/Task/Exponentiation-operator/Phix/exponentiation-operator.phix index 79c10d37a2..07065b741f 100644 --- a/Task/Exponentiation-operator/Phix/exponentiation-operator.phix +++ b/Task/Exponentiation-operator/Phix/exponentiation-operator.phix @@ -1,15 +1,13 @@ -(phixonline)--> - with javascript_semantics - function powir(atom b, integer i) - atom res = 1 - if i<0 then {b,i} = {1/b,abs(i)} end if - while i do - if and_bits(i,1) then res *= b end if - b *= b - i = floor(i/2) - end while - return res - end function - ?powir(-3,-5) - ?power(-3,-5) - - ?power(power(5,3),2) - ?power(5,power(3,2)) - - for x=-5 to 5 by 10 do - for p=2 to 3 do - printf(1,"x = %2d, p = %d, power(-x,p) = %4d, -power(x,p) = %4d\n",{x,p,power(-x,p),-power(x,p)}) - end for - end for - - switch {condition1,condition2} do - case {true,true}: - case {true,false}: - case {false,true}: - case {false,false}: - end switch - - function if2(bool c1, bool c2) - return c1*10+c2 - end function +function if2(bool c1, bool c2) + return c1*10+c2 +end function - switch if2(condition1,condition2) do - case 11: - case 10: - case 01: - case 00: - end switch - - enum BOTH = 0b11, FIRST = 0b10, SECOND = 0b01, NEITHER = 0b00 +enum BOTH = 0b11, FIRST = 0b10, SECOND = 0b01, NEITHER = 0b00 - function if2(bool c1, bool c2) - return c1*2+c2 - end function +function if2(bool c1, bool c2) + return c1*2+c2 +end function - integer r = if2(condition1,condition2) - if r=BOTH then - elsif r=FIRST then - elsif r=SECOND then - elsif r=NEITHER then - end if - - global constant T_if2 = 5200 tt_stringF("if2",T_if2) - global constant T_else1 = 5200 tt_stringF("else1",T_else1) - global constant T_else2 = 5200 tt_stringF("else2",T_else2) - - --constant T_endelseelsif = {T_end,T_else,T_elsif,T_case,T_default,T_fallthru,T_fallthrough} - constant T_endelseelsif = {T_end,T_else,T_else1,T_else2,T_elsif,T_case,T_default,T_fallthru,T_fallthrough} - - elsif ttidx=T_if2 then DoIf2() - - for N=10 to 20 do - printf(1,"%d is ",N) - if2 mod(N,2)=0, mod(N,3)=0 then - puts(1,"divisible by both two and three.\n") - else1 - puts(1,"divisible by two, but not by three.\n") - else2 - puts(1,"divisible by three, but not by two.\n") - else - puts(1,"neither divisible by two, nor by three.\n") - end if2 - end for - - with javascript_semantics - if platform()!=JS then free_console() end if - sequence primes = {2,3,5,7} - atom sieved = 10 +with javascript_semantics +sequence primes = {2,3,5,7} +atom sieved = 10 - procedure add_block() - integer N = min((sieved-1)*sieved,400000) - sequence sieve = repeat(1,N) -- sieve[i] is really i+sieved - for i=2 to length(primes) do -- (evens filtered on output) - atom p = primes[i], p2 = p*p - if p2>sieved+N then exit end if - if p2<sieved+1 then - p2 += ceil((sieved+1-p2)/p)*p - end if - p2 -= sieved - if and_bits(p2,1)=0 then p2 += p end if - -- if sieve[p2] then -- dang! - for k=p2 to N by p*2 do - sieve[k] = 0 - end for - -- end if - end for - for i=1 to N by 2 do - if sieve[i] then - primes &= i+sieved - end if - end for - sieved += N - end procedure +procedure add_block() + integer N = min((sieved-1)*sieved,400000) + sequence sieve = repeat(1,N) -- sieve[i] is really i+sieved + for i=2 to length(primes) do -- (evens filtered on output) + atom p = primes[i], p2 = p*p + if p2>sieved+N then exit end if + if p2function is_prime2(integer n) - while sieved<n do - add_block() - end while - return binary_search(n,primes)>0 - end function - - atom t0 = time() - while length(primes)<20 do add_block() end while - printf(1,"The first 20 primes are: ") ?primes[1..20] - while sieved<150 do add_block() end while - sequence s = {} - for k=abs(binary_search(100,primes)) to length(primes) do - integer p = primes[k] - if p>150 then exit end if - s &= p - end for - printf(1,"The primes between 100 and 150 are: ") ?s - s = {} - for i=7700 to 8000 do - if is_prime2(i) then s&=i end if - end for - printf(1,"There are %d primes between 7700 and 8000.\n",length(s)) - for i=1 to iff(platform()=JS?7:8) do - integer k = power(10,i) - while length(primes)<k do - add_block() - end while - printf(1,"The %,dth prime is : %d\n",{k,primes[k]}) - end for - ?time()-t0 - if platform()!=JS then {} = wait_key() end if - - with javascript_semantics - atom t0 = time() - printf(1,"The first 20 primes are: %v\n",{get_primes(-20)}) - sequence s = get_primes_le(150)[length(get_primes_le(100))+1..$] - printf(1,"The primes between 100 and 150 are: %v\n",{s}) - integer n7700to8000 = length(get_primes_le(8000))-length(get_primes_le(7700)) - printf(1,"There are %d primes between 7700 and 8000.\n",n7700to8000) - for i=1 to iff(platform()=JS?7:8) do - integer k = power(10,i) - printf(1,"The %,dth prime is : %d\n",{k,get_prime(k)}) - end for - ?time()-t0 - if platform()!=JS then {} = wait_key() end if - - with javascript_semantics - constant inf = 1e300*1e300, -- (works on both 32 and 64 bit) - ninf = -inf, - nan = -(inf/inf), - nzero = -1/inf -- (not supported) +with javascript_semantics +constant inf = 1e300*1e300, -- (works on both 32 and 64 bit) + ninf = -inf, + nan = -(inf/inf), + nzero = -1/inf -- (not supported) - printf(1," inf: %f\n",{inf}) - printf(1," ninf: %f\n",{ninf}) - printf(1," nan: %f\n",{nan}) - printf(1,"*nzero: %f\n",{nzero}) - printf(1," inf+2: %f\n",{inf+2}) - printf(1," inf+ninf: %f\n",{inf+ninf}) - printf(1," 0*inf: %f\n",{0*inf}) - printf(1," nan+1: %f\n",{nan+1}) - printf(1," nan+nan: %f\n",{nan+nan}) - printf(1," inf>1e300: %d\n",{inf>1e300}) - printf(1," ninf<1e300: %d\n",{ninf<-1e300}) - printf(1,"*nan=nan: %d\n",{nan=nan}) - printf(1," nan=42: %d\n",{nan=42}) - printf(1,"*nan<0: %d\n",{nan<0}) - printf(1," nan>0: %d\n",{nan>0}) - " + to_string(rotated, " ") << std::endl; + increment(factoradic); + } + std::cout << std::endl; + + // Part 2 + std::cout << "Generating the permutations of 11 digits:" << std::endl; + const uint32_t limit = factorial(11); + elements = convert_to_vector_of_integer("0.1.2.3.4.5.6.7.8.9.10"); + factoradic = convert_to_vector_of_integer("0.0.0.0.0.0.0.0.0.0"); + for ( uint32_t i = 0; i < limit; ++i ) { + std::vector rotated = permutation(elements, factoradic); + if ( i < 3 || i > limit - 4 ) { + std::cout << to_string(factoradic, ".") + " --> " + to_string(rotated, " ") + << std::endl; + } else if ( i == 3 ) { + std::cout << " [ ... ] " << std::endl; + } + increment(factoradic); + } + std::cout << "Number of permutations is 11! = " << limit << std::endl << std::endl; + + // Part 3 + std::vector codes = { "39.49.7.47.29.30.2.12.10.3.29.37.33.17.12.31.29.34.17.25.2.4.25.4.1.14.20.6.21.18.1.1.1.4.0.5.15.12.4.3.10.10.9.1.6.5.5.3.0.0.0", +"51.48.16.22.3.0.19.34.29.1.36.30.12.32.12.29.30.26.14.21.8.12.1.3.10.4.7.17.6.21.8.12.15.15.13.15.7.3.12.11.9.5.5.6.6.3.4.0.3.2.1" }; + + std::vector cards = { "A♠", "K♠", "Q♠", "J♠", "10♠", "9♠", "8♠", "7♠", "6♠", "5♠", "4♠", "3♠", "2♠", + "A♥", "K♥", "Q♥", "J♥", "10♥", "9♥", "8♥", "7♥", "6♥", "5♥", "4♥", "3♥", "2♥", + "A♦", "K♦", "Q♦", "J♦", "10♦", "9♦", "8♦", "7♦", "6♦", "5♦", "4♦", "3♦", "2♦", + "A♣", "K♣", "Q♣", "J♣", "10♣", "9♣", "8♣", "7♣", "6♣", "5♣", "4♣", "3♣", "2♣" + }; + + std::cout << "Original deck of cards:" << std::endl; + std::cout << to_string(cards, " ") << std::endl << std::endl; + std::cout << "Task shuffles:" << std::endl; + for ( const std::string& code : codes ) { + std::cout << code + " --> " << std::endl; + factoradic = convert_to_vector_of_integer(code); + std::cout << to_string(permutation(cards, factoradic), " ") + << std::endl << std::endl; + } + + std::cout << "Random shuffle:" << std::endl;; + std::random_device random; + std::mt19937 generator(random()); + + factoradic.clear(); + for ( uint32_t i = 0; i < cards.size() - 1; ++i ) { + std::uniform_int_distribution distribution(0, cards.size() - i - 1); + factoradic.emplace_back(distribution(generator)); + } + + std::cout << to_string(factoradic, ".") + " --> " << std::endl; + std::cout << to_string(permutation(cards, factoradic), " ") << std::endl; +} diff --git a/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/FreeBASIC/factorial-base-numbers-indexing-permutations-of-a-collection.basic b/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/FreeBASIC/factorial-base-numbers-indexing-permutations-of-a-collection.basic new file mode 100644 index 0000000000..abd85c0b29 --- /dev/null +++ b/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/FreeBASIC/factorial-base-numbers-indexing-permutations-of-a-collection.basic @@ -0,0 +1,167 @@ +Type Sequence + longi As Integer + dato(1000) As Integer +End Type + +Sub printSequence(s As Sequence) + Print " "; + For i As Integer = 1 To s.longi + Print Chr(8) & s.dato(i); + If i < s.longi Then Print "."; + Next i + Print +End Sub + +Function factorial(n As Integer) As Longint + If n <= 1 Then Return 1 + Return n * factorial(n - 1) +End Function + +Function tagset(n As Integer) As Sequence + Dim As Sequence result + result.longi = n + For i As Integer = 1 To n + result.dato(i) = i + Next i + Return result +End Function + +Sub showCards(s As Sequence) + Const cards = "AKQJT98765432" + Const suits = "SHDC" + + For i As Integer = 1 To s.longi + Dim As Integer c = s.dato(i) - 1 + Dim As String card = Mid(cards, (c Mod 13) + 1, 1) + Mid(suits, (c \ 13) + 1, 1) + Print card; Iif(((i Mod 13) = 0 Or i = s.longi), Chr(10), " "); + Next i + Print +End Sub + +Function fperm(fbn As Sequence, omega As Sequence) As Sequence + Dim As Integer i, g, tmp, j, m = 0 + Dim As Sequence result = omega + + For i = 1 To fbn.longi + g = fbn.dato(i) + If g > 0 Then + tmp = result.dato(m + g + 1) + For j = m + g + 1 To m + 2 Step -1 + result.dato(j) = result.dato(j - 1) + Next j + result.dato(m + 1) = tmp + End If + m += 1 + Next i + + result.longi = omega.longi + Return result +End Function + +Function factorialBaseNumbers(size As Integer, cntOnly As Integer) As Sequence + Dim As Sequence results + Dim As Integer res(1000) + Dim As Integer cnt, n, radix, k, i + + results.longi = 0 + cnt = 0 + n = 0 + Do + radix = 2 + k = n + For i = 1 To size + res(i) = 0 + Next i + + While k > 0 + If cntOnly = 0 Andalso radix <= size + 1 Then + res(size - radix + 2) = k Mod radix + End If + k \= radix + radix += 1 + Wend + + If radix > size + 2 Then Exit Do + + cnt += 1 + If cntOnly = 0 Then + results.longi += 1 + For i = 1 To size + results.dato((results.longi - 1) * size + i) = res(i) + Next i + End If + n += 1 + Loop + + If cntOnly Then + results.longi = 1 + results.dato(1) = cnt + End If + + Return results +End Function + +' Generate random factorial base number sequence +Function randFBN51() As Sequence + Dim As Sequence fbn51 + fbn51.longi = 51 + For i As Integer = 1 To 51 + fbn51.dato(i) = Int(Rnd * (52 - i)) + 1 + Next i + Return fbn51 +End Function + +' Main program +Randomize Timer +Dim As Integer i, j + +Dim As Sequence fbns = factorialBaseNumbers(3, 0) +Dim As Sequence omega +omega.longi = 4 +For i = 0 To 3 + omega.dato(i + 1) = i +Next i + +For i = 1 To fbns.longi + For j = 1 To 3 + Print fbns.dato((i-1)*3 + j) & "."; + Next j + Print Chr(8) & " ->"; + + Dim As Sequence tmp + tmp.longi = 3 + For j = 1 To 3 + tmp.dato(j) = fbns.dato((i-1)*3 + j) + Next j + + Dim As Sequence result = fperm(tmp, omega) + printSequence(result) +Next i + +Print +Dim As Sequence cnt = factorialBaseNumbers(10, 1) +Print "Permutations generated ="; cnt.dato(1) +Print " compared to 11! which ="; factorial(11) + +Print +Dim As Sequence fbn51s(3) + +' First predefined sequence +fbn51s(1).longi = 51 +Data 39,49,7,47,29,30,2,12,10,3,29,37,33,17,12,31,29,34,17,25,2,4,25,4,1,14,20,6,21,18,1,1,1,4,0,5,15,12,4,3,10,10,9,1,6,5,5,3,0,0,0 +For i = 1 To 51: Read fbn51s(1).dato(i): Next + +' Second predefined sequence +fbn51s(2).longi = 51 +Data 51,48,16,22,3,0,19,34,29,1,36,30,12,32,12,29,30,26,14,21,8,12,1,3,10,4,7,17,6,21,8,12,15,15,13,15,7,3,12,11,9,5,5,6,6,3,4,0,3,2,1 +For i = 1 To 51: Read fbn51s(2).dato(i): Next + +' Third random sequence +fbn51s(3) = randFBN51() + +' Show all card arrangements +For i = 1 To 3 + showCards(fperm(fbn51s(i), tagset(52))) +Next i + +Sleep diff --git a/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/Java/factorial-base-numbers-indexing-permutations-of-a-collection.java b/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/Java/factorial-base-numbers-indexing-permutations-of-a-collection.java new file mode 100644 index 0000000000..3f126f2202 --- /dev/null +++ b/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/Java/factorial-base-numbers-indexing-permutations-of-a-collection.java @@ -0,0 +1,110 @@ +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.ThreadLocalRandom; +import java.util.stream.Collectors; + +public final class FactorialBaseNumbersIndexingPermutations { + + public static void main(String[] args) { + // Part 1 + List elements = convertToListInteger("0.1.2.3"); + List factoradic = convertToListInteger("0.0.0"); + for ( int i = 0; i < factorial(4); i++ ) { + List rotated = permutation(elements, factoradic); + System.out.println(toString(factoradic, ".") + " --> " + toString(rotated, " ")); + increment(factoradic); + } + System.out.println(); + + // Part 2 + System.out.println("Generating the permutations of 11 digits:"); + final int limit = factorial(11); + elements = convertToListInteger("0.1.2.3.4.5.6.7.8.9.10"); + factoradic = convertToListInteger("0.0.0.0.0.0.0.0.0.0"); + for ( int i = 0; i < limit; i++ ) { + List rotated = permutation(elements, factoradic); + if ( i < 3 || i > limit - 4 ) { + System.out.println(toString(factoradic, ".") + " --> " + toString(rotated, " ")); + } else if ( i == 3 ) { + System.out.println(" [ ... ] "); + } + increment(factoradic); + } + System.out.println("Number of permutations is 11! = " + limit + System.lineSeparator()); + + // Part 3. + List codes = List.of( + "39.49.7.47.29.30.2.12.10.3.29.37.33.17.12.31.29.34.17.25.2.4.25.4.1.14" + + ".20.6.21.18.1.1.1.4.0.5.15.12.4.3.10.10.9.1.6.5.5.3.0.0.0", + "51.48.16.22.3.0.19.34.29.1.36.30.12.32.12.29.30.26.14.21.8.12.1.3.10.4" + + ".7.17.6.21.8.12.15.15.13.15.7.3.12.11.9.5.5.6.6.3.4.0.3.2.1" ); + + List cards = List.of( "A♠", "K♠", "Q♠", "J♠", "10♠", "9♠", "8♠", "7♠", "6♠", "5♠", "4♠", "3♠", "2♠", + "A♥", "K♥", "Q♥", "J♥", "10♥", "9♥", "8♥", "7♥", "6♥", "5♥", "4♥", "3♥", "2♥", + "A♦", "K♦", "Q♦", "J♦", "10♦", "9♦", "8♦", "7♦", "6♦", "5♦", "4♦", "3♦", "2♦", + "A♣", "K♣", "Q♣", "J♣", "10♣", "9♣", "8♣", "7♣", "6♣", "5♣", "4♣", "3♣", "2♣" ); + + System.out.println("Original deck of cards:"); + System.out.println(toString(cards, " ") + System.lineSeparator()); + System.out.println("Task shuffles:"); + for ( String code : codes ) { + System.out.println(code + " --> "); + factoradic = convertToListInteger(code); + System.out.println(toString(permutation(cards, factoradic), " ")); + System.out.println(); + } + + System.out.println("Random shuffle:"); + ThreadLocalRandom random = ThreadLocalRandom.current(); + factoradic.clear(); + for ( int i = 0; i < cards.size() - 1; i++ ) { + factoradic.add(random.nextInt(cards.size() - i)); + } + System.out.println(toString(factoradic, ".") + " --> "); + System.out.println(toString(permutation(cards, factoradic), " ")); + } + + private static List permutation(List elements, List factoradic) { + List copy = new ArrayList(elements); + int m = 0; + for ( int g : factoradic ) { + Collections.rotate(copy.subList(m, m + g + 1), 1); + m += 1; + } + return copy; + } + + private static void increment(List factoradic) { + int index = factoradic.size() - 1; + while ( index >= 0 && factoradic.get(index) == factoradic.size() - index ) { + factoradic.set(index, 0); + index -= 1; + } + if ( index >= 0 ) { + factoradic.set(index, factoradic.get(index) + 1); + } + } + + private static List convertToListInteger(String text) { + List result = new ArrayList(); + String[] numbers = text.split("\\."); + for ( String number : numbers ) { + result.add(Integer.valueOf(number)); + } + return result; + } + + private static int factorial(int n) { + int factorial = 1; + for ( int i = 2; i <= n; i++ ) { + factorial *= i; + } + return factorial; + } + + private static String toString(List factoradic, String delimiter) { + return factoradic.stream().map(String::valueOf).collect(Collectors.joining(delimiter)); + } + +} diff --git a/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/JavaScript/factorial-base-numbers-indexing-permutations-of-a-collection.js b/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/JavaScript/factorial-base-numbers-indexing-permutations-of-a-collection.js new file mode 100644 index 0000000000..2b4f52172f --- /dev/null +++ b/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/JavaScript/factorial-base-numbers-indexing-permutations-of-a-collection.js @@ -0,0 +1,170 @@ +// Helper function to convert values to strings +function stringify(text) { + return text; +} + +function stringifyNumber(number) { + return String(number); +} + +// Join array elements with delimiter +function toStringArray(factoradic, delimiter) { + let result = ""; + for (let i = 0; i < factoradic.length - 1; i++) { + result += stringifyNumber(factoradic[i]) + delimiter; + } + result += stringifyNumber(factoradic[factoradic.length - 1]); + return result; +} + +// Calculate factorial +function factorial(n) { + let result = 1; + for (let i = 2; i <= n; i++) { + result *= i; + } + return result; +} + +// Increment factoradic number +function increment(factoradic) { + let index = factoradic.length - 1; + while (index >= 0 && factoradic[index] === factoradic.length - index) { + factoradic[index] = 0; + index -= 1; + } + if (index >= 0) { + factoradic[index] += 1; + } +} + +// Split string by delimiter +function splitString(text, delimiter) { + const lines = []; + let start = 0; + let end = text.indexOf(delimiter); + + while (end !== -1) { + const line = text.substring(start, end); + if (line !== "") { + lines.push(line); + } + start = end + 1; + end = text.indexOf(delimiter, start); + } + + const lastLine = text.substring(start); + if (lastLine !== "") { + lines.push(lastLine); + } + + return lines; +} + +// Convert "a.b.c" format to array of integers +function convertToVectorOfInteger(text) { + const result = []; + const numbers = splitString(text, '.'); + for (const number of numbers) { + result.push(parseInt(number, 10)); + } + return result; +} + +// Generate permutation from elements and factoradic representation +function permutation(elements, factoradic) { + const result = [...elements]; + let m = 0; + + for (const g of factoradic) { + const element = result[m + g]; + result.splice(m + g, 1); + result.splice(m, 0, element); + m += 1; + } + + return result; +} + +// Main execution +function main() { + // Part 1 + console.log("Part 1: Permutations of 4 elements"); + console.log("=".repeat(50)); + + let elements = convertToVectorOfInteger("0.1.2.3"); + let factoradic = convertToVectorOfInteger("0.0.0"); + + for (let i = 0; i < factorial(4); i++) { + const rotated = permutation(elements, factoradic); + console.log(toStringArray(factoradic, '.') + " --> " + rotated.join(' ')); + increment(factoradic); + } + console.log(); + + // Part 2 + console.log("Part 2: Permutations of 11 digits"); + console.log("=".repeat(50)); + + const limit = factorial(11); + elements = convertToVectorOfInteger("0.1.2.3.4.5.6.7.8.9.10"); + factoradic = convertToVectorOfInteger("0.0.0.0.0.0.0.0.0.0"); + + for (let i = 0; i < limit; i++) { + const rotated = permutation(elements, factoradic); + if (i < 3 || i > limit - 4) { + console.log(toStringArray(factoradic, '.') + " --> " + rotated.join(' ')); + } else if (i === 3) { + console.log(" [ ... ] "); + } + increment(factoradic); + } + console.log("Number of permutations is 11! = " + limit); + console.log(); + + // Part 3 + console.log("Part 3: Card shuffling with factoradic representation"); + console.log("=".repeat(50)); + + const codes = [ + "39.49.7.47.29.30.2.12.10.3.29.37.33.17.12.31.29.34.17.25.2.4.25.4.1.14.20.6.21.18.1.1.1.4.0.5.15.12.4.3.10.10.9.1.6.5.5.3.0.0.0", + "51.48.16.22.3.0.19.34.29.1.36.30.12.32.12.29.30.26.14.21.8.12.1.3.10.4.7.17.6.21.8.12.15.15.13.15.7.3.12.11.9.5.5.6.6.3.4.0.3.2.1" + ]; + + const suits = ['♠', '♥', '♦', '♣']; + const ranks = ['A', 'K', 'Q', 'J', '10', '9', '8', '7', '6', '5', '4', '3', '2']; + + const cards = []; + for (const suit of suits) { + for (const rank of ranks) { + cards.push(rank + suit); + } + } + + console.log("Original deck of cards:"); + console.log(cards.join(' ')); + console.log(); + + console.log("Task shuffles:"); + for (const code of codes) { + console.log(code + " --> "); + factoradic = convertToVectorOfInteger(code); + const shuffled = permutation(cards, factoradic); + console.log(shuffled.join(' ')); + console.log(); + } + + console.log("Random shuffle:"); + factoradic = []; + for (let i = 0; i < cards.length - 1; i++) { + const randomIndex = Math.floor(Math.random() * (cards.length - i)); + factoradic.push(randomIndex); + } + + console.log(toStringArray(factoradic, '.') + " --> "); + const randomShuffled = permutation(cards, factoradic); + console.log(randomShuffled.join(' ')); +} + +// Run the program +main(); diff --git a/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/Julia/factorial-base-numbers-indexing-permutations-of-a-collection.julia b/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/Julia/factorial-base-numbers-indexing-permutations-of-a-collection.jl similarity index 100% rename from Task/Factorial-base-numbers-indexing-permutations-of-a-collection/Julia/factorial-base-numbers-indexing-permutations-of-a-collection.julia rename to Task/Factorial-base-numbers-indexing-permutations-of-a-collection/Julia/factorial-base-numbers-indexing-permutations-of-a-collection.jl diff --git a/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/Wren/factorial-base-numbers-indexing-permutations-of-a-collection.wren b/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/Wren/factorial-base-numbers-indexing-permutations-of-a-collection.wren index 3b66e3b3b6..395694ccdf 100644 --- a/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/Wren/factorial-base-numbers-indexing-permutations-of-a-collection.wren +++ b/Task/Factorial-base-numbers-indexing-permutations-of-a-collection/Wren/factorial-base-numbers-indexing-permutations-of-a-collection.wren @@ -1,6 +1,6 @@ import "random" for Random -import "/math" for Int -import "/fmt" for Fmt +import "./math" for Int +import "./fmt" for Fmt var genFactBaseNums = Fn.new { |size, countOnly| var results = [] diff --git a/Task/Factorial-primes/ALGOL-W/factorial-primes.alg b/Task/Factorial-primes/ALGOL-W/factorial-primes.alg new file mode 100644 index 0000000000..d8a6380cc6 --- /dev/null +++ b/Task/Factorial-primes/ALGOL-W/factorial-primes.alg @@ -0,0 +1,75 @@ +begin % find some factorial primes - primes that are f - 1 or f + 1 % + % for some factorial f % + + % returns true if p is prime, false otherwise % + logical procedure isPrime ( integer value p ) ; + if p <= 1 or p rem 2 = 0 then p = 2 + else begin + logical prime; + integer rootP, i; + prime := true; + i := 3; + rootP := entier( sqrt( p ) ); + while i <= rootP and prime do begin + prime := p rem i not = 0; + i := i + 2 + end; + prime + end isPrime ; + + % returns true if p is prime, false otherwise % + logical procedure isPrimeLongReal ( long real value p ) ; + if p <= MAXINTEGER then begin + % p is small enough to test using integer arithmetic % + isPrime( entier( p ) ) + end + else begin + % p is too large for integer primality testing % + logical prime; + integer rootP, i; + prime := true; + i := 2; + rootP := entier( longsqrt( p ) ); + while i <= rootP and prime do begin + long real pOverI; + pOverI := p / i; + prime := roundToReal( pOverI ) not = pOverI; + i := if i < 3 then 3 else i + 2 + end; + prime + end isPrime ; + + begin + long real f; + integer fpCount, n; + fpCount := 0; + n := 0; + f := 1; + while fpCount < 10 do begin + long real fp; + string(1) fpOp; + n := n + 1; + f := f * n; + fpOp := "-"; + for offset := -1 step 2 until 1 do begin + fp := f + offset; + if fp < MAXINTEGER then begin + if isPrime( entier( fp ) ) then begin + fpCount := fpCount + 1; + write( s_w := 0, i_w := 2, fpCount, ":" ); + writeon( s_w := 0, i_w := 4, n, "! ", fpOp, " 1 = " ); + writeon( s_w := 0, i_w := 1, entier( fp ) ) + end if_isPrime__entier__fp + end + else if isPrimeLongReal( fp ) then begin + fpCount := fpCount + 1; + write( s_w := 0, i_w := 2, fpCount, ":" ); + writeon( s_w := 0, i_w := 4, n, "! ", fpOp, " 1 = " ); + writeon( r_format := "A", r_w := 1, r_d := 0, fp ) + end if_isPrime__fp__isPrimeLongReal__fp ; + fpOp := "+" + end for_fp + end while_fpCount_lt_10 + end + +end. diff --git a/Task/Factorial-primes/AWK/factorial-primes.awk b/Task/Factorial-primes/AWK/factorial-primes.awk new file mode 100644 index 0000000000..b2cb4bb04a --- /dev/null +++ b/Task/Factorial-primes/AWK/factorial-primes.awk @@ -0,0 +1,15 @@ +function isprime(n, i) { + if(n==2)return 1 + if(n<2||n%2==0)return 0 + for(i=3;i*i<=n;i+=2) + if(n%i==0)return 0 + return 1 +} + +BEGIN { + for(x=i=1;z<10;i++){ + x*=i + if(isprime(x-1)){z++;print i"! - 1 = "x-1} + if(isprime(x+1)){z++;print i"! + 1 = "x+1} + } +} diff --git a/Task/Factorial-primes/Ada/factorial-primes.adb b/Task/Factorial-primes/Ada/factorial-primes.adb new file mode 100644 index 0000000000..f264eb9d50 --- /dev/null +++ b/Task/Factorial-primes/Ada/factorial-primes.adb @@ -0,0 +1,95 @@ +-- Rosetta Code Task written in Ada +-- Factorial primes +-- https://rosettacode.org/wiki/Factorial_primes +-- August 2024, R. B. E. +-- Using GNAT Big Integers, GNAT version 14.1, MacOS 14.6.1, M1 chip + +pragma Ada_2022; +with Ada.Text_IO; use Ada.Text_IO; +with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; +with Ada.Numerics.Big_Numbers.Big_Integers; use Ada.Numerics.Big_Numbers.Big_Integers; + +procedure Factorial_Primes is + + function Is_Prime (N : in Big_Integer) return Boolean is + Big_0 : Big_Natural := To_Big_Integer (0); + Big_2 : Big_Natural := To_Big_Integer (2); + Big_3 : Big_Natural := To_Big_Integer (3); + Big_Temp : Big_Natural := To_Big_Integer (5); + begin + if N < Big_2 then + return False; + end if; + if N mod Big_2 = Big_0 then + return N = Big_2; + end if; + if N mod Big_3 = Big_0 then + return N = Big_3; + end if; + while Big_Temp * Big_Temp <= N loop + if N mod Big_Temp = Big_0 then + return False; + end if; + Big_Temp := Big_Temp + Big_2; + if N mod Big_Temp = Big_0 then + return False; + end if; + Big_Temp := Big_Temp + 4; + end loop; + return True; + end Is_Prime; + + function Factorial (N : Positive) return Big_Integer is + type Factorial_Array is array (1..12) of Big_Integer; + First12_Facts : Factorial_Array; + Result : Big_Integer; + begin + First12_Facts (1) := To_Big_Integer (1); + for I in 2..12 loop + First12_Facts (I) := First12_Facts (I-1) * To_Big_Integer (I); + end loop; + if (N <= 12) then + return First12_Facts (N); + else + Result := First12_Facts (12); + for I in 13..N loop + Result := Result * To_Big_Integer (I); + end loop; + end if; + return Result; + end Factorial; + + Fact : Big_Integer; + Fact_Plus_One : Big_Integer; + Fact_Minus_One : Big_Integer; + Big_One : constant Big_Integer := To_Big_Integer (1); + I, Count : Natural := 0; + Limit : constant Positive := 10; + +begin + loop + I := I + 1; + Fact := Factorial (I); + if (is_Prime (Fact - Big_One)) then + Count := Count + 1; + Put (Count, 3); + Put (": "); + Put (I, 5); + Put ("! - 1 "); + Fact_Minus_One := Fact - Big_One; + Put (To_String (Arg => Fact_Minus_One, Width => 40)); + New_Line; + end if; + if (is_Prime (Fact + Big_One)) then + Count := Count + 1; + Put (Count, 3); + Put (": "); + Put (I, 5); + Put ("! + 1 "); + Fact_Plus_One := Fact + Big_One; + Put (To_String (Arg => Fact_Plus_One, Width => 40)); + New_Line; + end if; + exit when Count >= Limit; + end loop; +end Factorial_Primes; diff --git a/Task/Factorial-primes/Agena/factorial-primes.agena b/Task/Factorial-primes/Agena/factorial-primes.agena new file mode 100644 index 0000000000..0a76370d5e --- /dev/null +++ b/Task/Factorial-primes/Agena/factorial-primes.agena @@ -0,0 +1,17 @@ +scope # find some factorial primes - primes that are f - 1 or f + 1 for some factorial f + + local f, fpCount, n := 1, 0, 1 + for n while fpCount < 10 do + f *:= n; + local fpOp := "-"; + for fp from f - 1 to f + 1 by 2 do + if numtheory.isprime( fp ) then + fpCount +:= 1; + # printing fp with %s as %d has trouble with 14! - 1 + printf( "%2d:%4d! %s 1 = %s\n", fpCount, n, fpOp, fp ) + fi; + fpOp := "+" + od + od + +end diff --git a/Task/Factorial-primes/C++/factorial-primes.cpp b/Task/Factorial-primes/C++/factorial-primes.cpp index 5d7fc43aa3..97ee8ec66d 100644 --- a/Task/Factorial-primes/C++/factorial-primes.cpp +++ b/Task/Factorial-primes/C++/factorial-primes.cpp @@ -5,11 +5,11 @@ using big_int = mpz_class; -std::string to_string(const big_int& num, size_t n) { +std::string to_string(const big_int& num, size_t max_digits) { std::string str = num.get_str(); size_t len = str.size(); - if (len > n) { - str = str.substr(0, n / 2) + "..." + str.substr(len - n / 2); + if (len > max_digits) { + str.replace(max_digits / 2, len - max_digits, "..."); str += " ("; str += std::to_string(len); str += " digits)"; diff --git a/Task/Factorial-primes/Common-Lisp/factorial-primes.lisp b/Task/Factorial-primes/Common-Lisp/factorial-primes.lisp new file mode 100644 index 0000000000..0e28867922 --- /dev/null +++ b/Task/Factorial-primes/Common-Lisp/factorial-primes.lisp @@ -0,0 +1,27 @@ +(defun factorial (x) + (if (= x 1) + x + (* x (factorial (- x 1))))) + +(defun is-factor (x y) + (zerop (mod x y))) + +(defun is-prime (n) + (cond ((< n 4) (or (= n 2) (= n 3))) + ((or (zerop (mod n 2)) (zerop (mod n 3))) nil) + (t (loop for i from 5 to (floor (sqrt n)) by 6 + never (or (is-factor n i) + (is-factor n (+ i 2))))))) + +(defun main (&optional (limit 10)) + (let ((n 0) + (f 0)) + (loop while (< n limit) + for i from 1 + do (setf f (factorial i)) + (when (is-prime (+ f 1)) + (incf n) + (format t "~2d: ~2d! + 1 = ~12d~%" n i (+ f 1))) + (when (is-prime (- f 1)) + (incf n) + (format t "~2d: ~2d! - 1 = ~12d~%" n i (- f 1)))))) diff --git a/Task/Factorial-primes/Delphi/factorial-primes.delphi b/Task/Factorial-primes/Delphi/factorial-primes.pas similarity index 100% rename from Task/Factorial-primes/Delphi/factorial-primes.delphi rename to Task/Factorial-primes/Delphi/factorial-primes.pas diff --git a/Task/Factorial-primes/EasyLang/factorial-primes.easy b/Task/Factorial-primes/EasyLang/factorial-primes.easy new file mode 100644 index 0000000000..fd62915528 --- /dev/null +++ b/Task/Factorial-primes/EasyLang/factorial-primes.easy @@ -0,0 +1,22 @@ +func isprim num . + if num < 2 : return 0 + i = 2 + while i <= sqrt num + if num mod i = 0 : return 0 + i += 1 + . + return 1 +. +f = 1 +while count < 10 + n += 1 + f *= n + op$ = "-" + for fp in [ f - 1, f + 1 ] + if isprim fp = 1 + count += 1 + print n & "! " & op$ & " 1 = " & fp + . + op$ = "+" + . +. diff --git a/Task/Factorial-primes/Fennel/factorial-primes.fennel b/Task/Factorial-primes/Fennel/factorial-primes.fennel new file mode 100644 index 0000000000..8151c241fb --- /dev/null +++ b/Task/Factorial-primes/Fennel/factorial-primes.fennel @@ -0,0 +1,30 @@ +(do ;;; find some factorial primes - primes that are f - 1 or f + 1 for some factorial f + + (fn is-prime [p] + (if (or (<= p 1) (= 0 (% p 2))) + (= p 2) + ;else + (do (var (prime i root-p) (values true 3 (math.floor (math.sqrt p)))) + (while (and (<= i root-p) prime) + (set (prime i) (values (not= 0 (% p i)) (+ i 1))) + ) + prime + ) + ) + ) + + (var (f fp-count n) (values 1 0 1)) + (while (< fp-count 10) + (set f (* f n)) + (var fp-op "-") + (for [fp (- f 1) (+ f 1) 2] + (when (is-prime fp) + (set fp-count (+ fp-count 1)) + (io.write (string.format "%2d:%4d! %s 1 = %d\n" fp-count n fp-op fp)) + ) + (set fp-op "+") + ) + (set n (+ n 1)) + ) + +) diff --git a/Task/Factorial-primes/Frink/factorial-primes.frink b/Task/Factorial-primes/Frink/factorial-primes.frink new file mode 100644 index 0000000000..e8941229fe --- /dev/null +++ b/Task/Factorial-primes/Frink/factorial-primes.frink @@ -0,0 +1,36 @@ +isFactorialPrime[x] := +{ + if isPrime[x!+1] + return +1 + if x>=2 and isPrime[x!-1] + return -1 + return 0 +} + +count = 0 +n = 1 +res = new array +do +{ + f = isFactorialPrime[n] + if f != 0 + { + count = count + 1 + line = ["$count:", "$n!", f<0 ? "-" : "+", 1, "="] + line.pushAll[formatFac[n!+f]] + res.push[line] + } + n = n + 1 +} until count == 30 + +println[formatTable[res, "right"]] + +formatFac[n] := +{ + s = toString[n] + len = length[s] + if len > 40 + return [left[s,20] + "..." + right[s,20], " ($len digits)"] + else + return [s] +} diff --git a/Task/Factorial-primes/Go/factorial-primes.go b/Task/Factorial-primes/Go/factorial-primes.go new file mode 100644 index 0000000000..a808dfb619 --- /dev/null +++ b/Task/Factorial-primes/Go/factorial-primes.go @@ -0,0 +1,59 @@ +package main + +import ( + "fmt" + "math/big" +) + +func main() { + n, count := 0, 0 + + for count < 10 { + n++ + f := factorial(n) + + if isPrime(f.Sub(f, big.NewInt(1))) { + count++ + fmt.Printf("%2d: %2d! - 1 = %s\n", count, n, f.String()) + } + + if isPrime(f.Add(f, big.NewInt(2))) { + count++ + fmt.Printf("%2d: %2d! + 1 = %s\n", count, n, f.String()) + } + } +} + +func factorial(n int) *big.Int { + result := big.NewInt(1) + + for i := 2; i <= n; i++ { + result.Mul(result, big.NewInt(int64(i))) + } + + return result +} + +func isPrime(num *big.Int) bool { + if num.Cmp(big.NewInt(2)) < 0 { + return false + } + + if num.Cmp(big.NewInt(2)) == 0 { + return true + } + + if new(big.Int).Mod(num, big.NewInt(2)).Cmp(big.NewInt(0)) == 0 { + return false + } + + sqrt := new(big.Int).Sqrt(num) + + for i := big.NewInt(3); i.Cmp(sqrt) <= 0; i.Add(i, big.NewInt(2)) { + if new(big.Int).Mod(num, i).Cmp(big.NewInt(0)) == 0 { + return false + } + } + + return true +} diff --git a/Task/Factorial-primes/Haskell/factorial-primes.hs b/Task/Factorial-primes/Haskell/factorial-primes.hs new file mode 100644 index 0000000000..9d2d00ea68 --- /dev/null +++ b/Task/Factorial-primes/Haskell/factorial-primes.hs @@ -0,0 +1,26 @@ +isPrime :: Integer -> Bool +isPrime n + | n < 2 = False + | n == 2 = True + | otherwise = 0 == length [i | i <- [2..floor(sqrt (fromIntegral n))], n `mod` i == 0] + +data Op = SubtractOne | AddOne + deriving (Show) + +data Prime = Prime + { fact :: Integer, + prime :: Integer, + op :: Op +} deriving (Show) + +getFactorialPrimes :: Integer -> [Prime] +getFactorialPrimes n + | isPrime (f - 2) = Prime {fact = n, prime = f - 2, op = SubtractOne} : + (if isPrime f then [Prime {fact = n, prime = f, op = AddOne}] else []) + | otherwise = (if isPrime f then [Prime {fact = n, prime = f, op = AddOne}] else []) + where + factorial n = product[1..n] + f = factorial n + 1 + +factorialPrimes = concat $ map getFactorialPrimes [1..] +main = mapM_ print $ take 10 factorialPrimes diff --git a/Task/Factorial-primes/Julia/factorial-primes.julia b/Task/Factorial-primes/Julia/factorial-primes.jl similarity index 100% rename from Task/Factorial-primes/Julia/factorial-primes.julia rename to Task/Factorial-primes/Julia/factorial-primes.jl diff --git a/Task/Factorial-primes/Kotlin/factorial-primes.kts b/Task/Factorial-primes/Kotlin/factorial-primes.kts new file mode 100644 index 0000000000..22db036df6 --- /dev/null +++ b/Task/Factorial-primes/Kotlin/factorial-primes.kts @@ -0,0 +1,43 @@ +import java.math.BigInteger +import java.math.BigInteger.ONE + +enum class Difference(private val displayText: String) { + MINUS_ONE("- 1"), PLUS_ONE("+ 1"); + + override fun toString(): String { + return displayText + } +} + +fun main() { + var currentFactorial = ONE + var highestFactor = 1L + var found = 0 + + while(found < 30) { + if ((currentFactorial - ONE).isProbablePrime(25)) { + printlnFactorialPrime(currentFactorial - ONE, highestFactor, Difference.MINUS_ONE) + found++ + } + if ((currentFactorial + ONE).isProbablePrime(25)) { + printlnFactorialPrime(currentFactorial + ONE, highestFactor, Difference.PLUS_ONE) + found++ + } + + highestFactor++ + currentFactorial *= BigInteger.valueOf(highestFactor) + } +} + +fun printlnFactorialPrime(factorialPrime: BigInteger, base: Long, difference: Difference) = + println("${base}! $difference = ${factorialPrime.shortenIfNecessary()}") + +fun BigInteger.shortenIfNecessary(): String { + val digits = toString() + val length = digits.length + return if (length <= 40) { + digits + } else { + "${digits.take(20)}...${digits.takeLast(20)} ($length digits)" + } +} diff --git a/Task/Factorial-primes/Lua/factorial-primes.lua b/Task/Factorial-primes/Lua/factorial-primes.lua index 3720b9e0cb..55c20a12e9 100644 --- a/Task/Factorial-primes/Lua/factorial-primes.lua +++ b/Task/Factorial-primes/Lua/factorial-primes.lua @@ -1,39 +1,29 @@ -do -- find some factorial primes - primes that are f - 1 or f + 1 - -- for some factorial f +do -- find some factorial primes - primes that are f - 1 or f + 1 for some factorial f - function isPrime( p ) + local function isPrime( p ) if p <= 1 or p % 2 == 0 then return p == 2 else - local prime = true - local i = 3 - local rootP = math.floor( math.sqrt( p ) ) + local prime, i, rootP = true, 3, math.floor( math.sqrt( p ) ) while i <= rootP and prime do - prime = p % i ~= 0 - i = i + 1 + prime, i = p % i ~= 0, i + 1 end return prime end end - local f = 1 - local fpCount = 0 - local n = 0 - local fpOp = "" + local f, fpCount, n = 1, 0, 1 while fpCount < 10 do - n = n + 1 - f = f * n - fpOp = "-" + f = f * n + local fpOp = "-" for fp = f - 1, f + 1, 2 do if isPrime( fp ) then fpCount = fpCount + 1 - io.write( string.format( "%2d", fpCount ), ":" - , string.format( "%4d", n ), "! " - , fpOp, " 1 = ", fp, "\n" - ) + io.write( string.format( "%2d:%4d! %s 1 = %d\n", fpCount, n, fpOp, fp ) ) end fpOp = "+" end + n = n + 1 end end diff --git a/Task/Factorial-primes/Mathematica/factorial-primes.math b/Task/Factorial-primes/Mathematica/factorial-primes.math new file mode 100644 index 0000000000..75ebdcc718 --- /dev/null +++ b/Task/Factorial-primes/Mathematica/factorial-primes.math @@ -0,0 +1,15 @@ +LimitedPrint[n_] := Module[{s = IntegerString[n], len}, + len = StringLength[s]; + If[len <= 40, s, StringJoin[StringTake[s, 20], "...", StringTake[s, -20], " (", ToString[len], " digits)"]] +] + +ShowFactorialPrimes[N_] := Module[{f}, + Do[ + f = Factorial[i]; + If[PrimeQ[f - 1], Print[IntegerString[i, 10, 3], "! - 1 -> ", LimitedPrint[f - 1]]]; + If[PrimeQ[f + 1], Print[IntegerString[i, 10, 3], "! + 1 -> ", LimitedPrint[f + 1]]], + {i, 1, N} + ] +] + +ShowFactorialPrimes[1000] diff --git a/Task/Factorial-primes/OCaml/factorial-primes.ocaml b/Task/Factorial-primes/OCaml/factorial-primes.ml similarity index 100% rename from Task/Factorial-primes/OCaml/factorial-primes.ocaml rename to Task/Factorial-primes/OCaml/factorial-primes.ml diff --git a/Task/Factorial-primes/PascalABC.NET/factorial-primes.pas b/Task/Factorial-primes/PascalABC.NET/factorial-primes.pas new file mode 100644 index 0000000000..817ecf3506 --- /dev/null +++ b/Task/Factorial-primes/PascalABC.NET/factorial-primes.pas @@ -0,0 +1,42 @@ +function IsPrime(n: int64): boolean; +begin + if (n = 2) or (n = 3) then Result := true + else if (n <= 1) or ((n mod 2) = 0) or ((n mod 3) = 0) then Result := false + else + begin + var i := 5; + Result := False; + while i <= trunc(sqrt(n)) do + begin + if ((n mod i) = 0) or ((n mod (i + 2)) = 0) then exit; + i += 6; + end; + Result := True; + end; +end; + +function Factorial(n: integer): int64; +begin + Result := 1; + for var i := 2 to n do Result *= i; +end; + +begin + var found := 0; + var i := 1; + while found < 10 do + begin + var fact := Factorial(i); + if IsPrime(fact - 1) then + begin + writeln(i:2, '! - 1 = ', fact - 1); + found += 1; + end; + if IsPrime(fact + 1) then + begin + writeln(i:2, '! + 1 = ', fact + 1); + found += 1; + end; + i += 1; + end; +end. diff --git a/Task/Factorial-primes/Pluto/factorial-primes.pluto b/Task/Factorial-primes/Pluto/factorial-primes.pluto new file mode 100644 index 0000000000..4e6b707c4e --- /dev/null +++ b/Task/Factorial-primes/Pluto/factorial-primes.pluto @@ -0,0 +1,20 @@ +do -- find some factorial primes - primes that are f - 1 or f + 1 for some factorial f + + local fmt = require( "fmt" ) -- RC Pluto formatting library + local int = require( "int" ) -- RC Pluto integer library, inc. prime utilities + + local f, fpCount, n = 1, 0, 0 + while fpCount < 10 do + n += 1 + f *= n + local fpOp = "-" + for fp = f - 1, f + 1, 2 do + if int.isprime( fp ) then + fpCount += 1 + fmt.write( "%2d:%4d! %s 1 = %d\n", fpCount, n, fpOp, fp ) + end + fpOp = "+" + end + end + +end diff --git a/Task/Factorial-primes/PureBasic/factorial-primes.basic b/Task/Factorial-primes/PureBasic/factorial-primes.basic new file mode 100644 index 0000000000..37ad8b8d2f --- /dev/null +++ b/Task/Factorial-primes/PureBasic/factorial-primes.basic @@ -0,0 +1,24 @@ +;XIncludeFile "isprime.pb" +;XIncludeFile "factorial.pb" + +If OpenConsole() + PrintN("First 10 factorial primes:") + Define found.i = 0, i,i = 1, fct.i + + While found < 10 + fct = factorial (i) + + If isprime(fct-1) + found + 1 + PrintN(RSet(Str(found),2) + ": " + RSet(Str(i),2) + "! - 1 = " + Str(fct-1)) + EndIf + If isprime(fct+1) + found + 1 + PrintN(RSet(Str(found),2) + ": " + RSet(Str(i),2) + "! + 1 = " + Str(fct+1)) + EndIf + i + 1 + Wend + + PrintN(#CRLF$ + "--- terminado, pulsa RETURN---"): Input() + CloseConsole() +EndIf diff --git a/Task/Factorial-primes/R/factorial-primes.r b/Task/Factorial-primes/R/factorial-primes.r new file mode 100644 index 0000000000..583498b194 --- /dev/null +++ b/Task/Factorial-primes/R/factorial-primes.r @@ -0,0 +1,29 @@ +library(gmp) + +print_20digits <- function(z){ + s <- as.character(z) + if(nchar(s)>40){ + paste0(substring(s, 1, 20), "...", substring(s, nchar(s)-19, nchar(s))) + } + else return(s) +} + +count <- 0 +n <- 1 +while(count<33){ + plus <- factorialZ(n)+1 + minus <- factorialZ(n)-1 + if(isprime(plus)!=0){ + cat(n, "!+1 = ", print_20digits(plus), + " (", nchar(as.character(plus)), " digits)", + "\n", sep="") + count <- count+1 + } + if(isprime(minus)!=0){ + cat(n, "!-1 = ", print_20digits(minus), + " (", nchar(as.character(minus)), " digits)", + "\n", sep="") + count <- count+1 + } + n <- n+1 +} diff --git a/Task/Factorial-primes/Unicon/factorial-primes.unicon b/Task/Factorial-primes/Unicon/factorial-primes.unicon new file mode 100644 index 0000000000..4de95546a3 --- /dev/null +++ b/Task/Factorial-primes/Unicon/factorial-primes.unicon @@ -0,0 +1,11 @@ +link fastprime + +procedure main(A) + limit := \A[1] | 10 + every f := gfactorial(n := seq()) do { + if (x := (is_prime(y := f-1),n||"!-1")) then + (write(" (",x,",",y,")"), if 0 = (limit -:= 1) then break) + if (x := (is_prime(y := f+1),n||"!+1")) then + (write(" (",x,",",y,")"), if 0 = (limit -:= 1) then break) + } +end diff --git a/Task/Factorial/8th/factorial.8th b/Task/Factorial/8th/factorial.8th new file mode 100644 index 0000000000..d385be5c27 --- /dev/null +++ b/Task/Factorial/8th/factorial.8th @@ -0,0 +1,2 @@ +: factorial \ n -- n! + 1 swap ' n:* 1 rot loop ; diff --git a/Task/Factorial/ALGOL-60/factorial.alg b/Task/Factorial/ALGOL-60/factorial.alg deleted file mode 100644 index 6b44ce94eb..0000000000 --- a/Task/Factorial/ALGOL-60/factorial.alg +++ /dev/null @@ -1,14 +0,0 @@ -begin - comment factorial - algol 60; - integer procedure factorial(n); integer n; - begin - integer i,fact; - fact:=1; - for i:=2 step 1 until n do - fact:=fact*i; - factorial:=fact - end; - integer i; - for i:=1 step 1 until 10 do outinteger(1,factorial(i)); - outstring(1,"\n") -end diff --git a/Task/Factorial/ALGOL-68/factorial-1.alg b/Task/Factorial/ALGOL-68/factorial-1.alg deleted file mode 100644 index 170a8c2633..0000000000 --- a/Task/Factorial/ALGOL-68/factorial-1.alg +++ /dev/null @@ -1,5 +0,0 @@ -PROC factorial = (INT upb n)LONG LONG INT:( - LONG LONG INT z := 1; - FOR n TO upb n DO z *:= n OD; - z -); ~ diff --git a/Task/Factorial/ALGOL-68/factorial-2.alg b/Task/Factorial/ALGOL-68/factorial-2.alg deleted file mode 100644 index 191fe07cfb..0000000000 --- a/Task/Factorial/ALGOL-68/factorial-2.alg +++ /dev/null @@ -1,30 +0,0 @@ -INT g = 7; -[]REAL p = []REAL(0.99999999999980993, 676.5203681218851, -1259.1392167224028, - 771.32342877765313, -176.61502916214059, 12.507343278686905, - -0.13857109526572012, 9.9843695780195716e-6, 1.5056327351493116e-7)[@0]; - -PROC complex gamma = (COMPL in z)COMPL: ( - # Reflection formula # - COMPL z := in z; - IF re OF z < 0.5 THEN - pi / (complex sin(pi*z)*complex gamma(1-z)) - ELSE - z -:= 1; - COMPL x := p[0]; - FOR i TO g+1 DO x +:= p[i]/(z+i) OD; - COMPL t := z + g + 0.5; - complex sqrt(2*pi) * t**(z+0.5) * complex exp(-t) * x - FI -); - -OP ** = (COMPL z, p)COMPL: ( z=0|0|complex exp(complex ln(z)*p) ); -PROC factorial = (COMPL n)COMPL: complex gamma(n+1); - -FORMAT compl fmt = $g(-16, 8)"⊥"g(-10, 8)$; - -test:( - printf(($q"factorial(-0.5)**2="f(compl fmt)l$, factorial(-0.5)**2)); - FOR i TO 9 DO - printf(($q"factorial("d")="f(compl fmt)l$, i, factorial(i))) - OD -) diff --git a/Task/Factorial/ALGOL-68/factorial-3.alg b/Task/Factorial/ALGOL-68/factorial-3.alg deleted file mode 100644 index c9c3e54dd2..0000000000 --- a/Task/Factorial/ALGOL-68/factorial-3.alg +++ /dev/null @@ -1,7 +0,0 @@ -PROC factorial = (INT n)LONG LONG INT: - CASE n+1 IN - 1,1,2,6,24,120,720 # a brief lookup # - OUT - n*factorial(n-1) - ESAC -; ~ diff --git a/Task/Factorial/ALGOL-W/factorial.alg b/Task/Factorial/ALGOL-W/factorial.alg deleted file mode 100644 index d52282365a..0000000000 --- a/Task/Factorial/ALGOL-W/factorial.alg +++ /dev/null @@ -1,15 +0,0 @@ -begin - % computes factorial n iteratively % - integer procedure factorial( integer value n ) ; - if n < 2 - then 1 - else begin - integer f; - f := 2; - for i := 3 until n do f := f * i; - f - end factorial ; - - for t := 0 until 10 do write( "factorial: ", t, factorial( t ) ); - -end. diff --git a/Task/Factorial/APL/factorial-4.apl b/Task/Factorial/APL/factorial-4.apl new file mode 100644 index 0000000000..97b8778c57 --- /dev/null +++ b/Task/Factorial/APL/factorial-4.apl @@ -0,0 +1,3 @@ + fac←{⍵>1 : ⍵×fac ⍵-1 ⋄ 1} + fac 5 +120 diff --git a/Task/Factorial/Ada/factorial-1.ada b/Task/Factorial/Ada/factorial-1.adb similarity index 100% rename from Task/Factorial/Ada/factorial-1.ada rename to Task/Factorial/Ada/factorial-1.adb diff --git a/Task/Factorial/Ada/factorial-2.ada b/Task/Factorial/Ada/factorial-2.adb similarity index 100% rename from Task/Factorial/Ada/factorial-2.ada rename to Task/Factorial/Ada/factorial-2.adb diff --git a/Task/Factorial/Ada/factorial-3.ada b/Task/Factorial/Ada/factorial-3.adb similarity index 100% rename from Task/Factorial/Ada/factorial-3.ada rename to Task/Factorial/Ada/factorial-3.adb diff --git a/Task/Factorial/Agena/factorial.agena b/Task/Factorial/Agena/factorial.agena new file mode 100644 index 0000000000..8b050fee0e --- /dev/null +++ b/Task/Factorial/Agena/factorial.agena @@ -0,0 +1,25 @@ +scope # factorials using the arbitrary precision mapm library + + import mapm; # explicit import needed for: Linux, Mac OS X, Windows and Solaris + + mapm.xdigits( 100 ); # need to set the precision - 100 is enough for 60! + + # computes factorial n iteratively, using mapm + local constant factorial := proc( n :: number ) :: xnumber + if n < 2 then return mapm.xnumber( 1 ) + else + local f := mapm.xnumber( 2 ); + for i from 3 to n do f := f * i od; + return f + fi + end; + # returns a string representation of the integer portion of an xnumber + local constant asstring := proc( n :: xnumber ) :: string + local constant str := mapm.xtostring( n ); + local constant point := "." in str; + return if point <> null then str[ 1 to point - 1 ] else str fi; + end; + + for t from 0 to 9 do printf( "%2d! is %d\n", t, mapm.xtonumber( factorial( t ) ) ) od; + for t from 10 to 60 by 10 do printf( "%2d! is %s\n", t, asstring( factorial( t ) ) ) od; +end diff --git a/Task/Factorial/Apple/factorial-1.apple b/Task/Factorial/Apple/factorial-1.apple new file mode 100644 index 0000000000..a882f89b83 --- /dev/null +++ b/Task/Factorial/Apple/factorial-1.apple @@ -0,0 +1,2 @@ + > [(*)/ₒ 1 (⍳ 1 x 1)] 7 +5040 diff --git a/Task/Factorial/Apple/factorial-2.apple b/Task/Factorial/Apple/factorial-2.apple new file mode 100644 index 0000000000..bf4bf79fa7 --- /dev/null +++ b/Task/Factorial/Apple/factorial-2.apple @@ -0,0 +1,16 @@ + > :asm [(*)/ₒ 1 (⍳ 1 x 1)] + + mov x6, x0 + mov x0, #0x1 + mov x2, #0x1 + eor x1, x1, x1 + cmp x1, x6 + b.GE apple_1 +apple_0: + mul x0, x0, x2 + add x2, x2, #0x1 + add x1, x1, #0x1 + cmp x1, x6 + b.LT apple_0 +apple_1: + ret diff --git a/Task/Factorial/ArkScript/factorial.ark b/Task/Factorial/ArkScript/factorial.ark new file mode 100644 index 0000000000..41607c70ad --- /dev/null +++ b/Task/Factorial/ArkScript/factorial.ark @@ -0,0 +1,13 @@ +(let factorial (fun (n) { + (mut result 1) + (mut i 2) + (while (< i n) { + (set result (* result i)) + (set i (+ 1 i)) }) + result })) + +(import std.List) + +(list:forEach + (list:iota 0 8) + (fun (n) (print n "\t" (factorial n)))) diff --git a/Task/Factorial/Arturo/factorial-1.arturo b/Task/Factorial/Arturo/factorial-1.arturo index e61492a8b4..5adbf912c3 100644 --- a/Task/Factorial/Arturo/factorial-1.arturo +++ b/Task/Factorial/Arturo/factorial-1.arturo @@ -1,4 +1,7 @@ -factorial: $[n][ - if? n>0 [n * factorial n-1] - else [1] +factorial: function [n][ + switch n > 0 -> n * factorial n-1 + -> 1 ] + +loop 1..19 [x]-> + print ["Factorial of" x "=" factorial x] diff --git a/Task/Factorial/Arturo/factorial-2.arturo b/Task/Factorial/Arturo/factorial-2.arturo index 6e6d40e330..79b191bdb4 100644 --- a/Task/Factorial/Arturo/factorial-2.arturo +++ b/Task/Factorial/Arturo/factorial-2.arturo @@ -1,3 +1,7 @@ factorial: $[n][ fold.seed:1 1..n [a,b][a*b] ] + +loop 1..19 [x][ + print ["Factorial of" x "=" factorial x] +] diff --git a/Task/Factorial/Asymptote/factorial.asymptote b/Task/Factorial/Asymptote/factorial.asymptote new file mode 100644 index 0000000000..4108263689 --- /dev/null +++ b/Task/Factorial/Asymptote/factorial.asymptote @@ -0,0 +1,10 @@ +real factorial(int n) { + real f = 1; + for (int i = 2; i <= n; ++i) + f = f * i; + return f; +} + +write("The factorials for the first 5 positive integers are:"); +for (int j = 1; j <= 5; ++j) + write(string(j) + "! = " + string(factorial(j))); diff --git a/Task/Factorial/AutoIt/factorial-1.autoit b/Task/Factorial/AutoIt/factorial-1.au3 similarity index 100% rename from Task/Factorial/AutoIt/factorial-1.autoit rename to Task/Factorial/AutoIt/factorial-1.au3 diff --git a/Task/Factorial/AutoIt/factorial-2.autoit b/Task/Factorial/AutoIt/factorial-2.au3 similarity index 100% rename from Task/Factorial/AutoIt/factorial-2.autoit rename to Task/Factorial/AutoIt/factorial-2.au3 diff --git a/Task/Factorial/Bruijn/factorial.bruijn b/Task/Factorial/Bruijn/factorial.bruijn new file mode 100644 index 0000000000..5fe7e558e6 --- /dev/null +++ b/Task/Factorial/Bruijn/factorial.bruijn @@ -0,0 +1,5 @@ +:import std/Math . + +factorial [∏ (+1) → 0 | [0]] + +:test ((factorial (+10)) =? (+3628800)) ([[1]]) diff --git a/Task/Factorial/CBASIC/factorial.basic b/Task/Factorial/CBASIC/factorial.basic new file mode 100644 index 0000000000..3ca40654ad --- /dev/null +++ b/Task/Factorial/CBASIC/factorial.basic @@ -0,0 +1,19 @@ +rem - return n! +def fn.factorial(n) + f = 1 + for i = 1 to n + f = f * i + next i + fn.factorial = f + return +fend + +print "Factorial Calculator" +print +print " n n!" +print "-------------------" +for k = 1 to 14 + print using "## ###,###,###,###"; k; fn.factorial(k) +next k + +end diff --git a/Task/Factorial/COBOL/factorial-1.cobol b/Task/Factorial/COBOL/factorial-1.cob similarity index 100% rename from Task/Factorial/COBOL/factorial-1.cobol rename to Task/Factorial/COBOL/factorial-1.cob diff --git a/Task/Factorial/COBOL/factorial-2.cobol b/Task/Factorial/COBOL/factorial-2.cob similarity index 100% rename from Task/Factorial/COBOL/factorial-2.cobol rename to Task/Factorial/COBOL/factorial-2.cob diff --git a/Task/Factorial/COBOL/factorial-3.cobol b/Task/Factorial/COBOL/factorial-3.cob similarity index 100% rename from Task/Factorial/COBOL/factorial-3.cobol rename to Task/Factorial/COBOL/factorial-3.cob diff --git a/Task/Factorial/COBOL/factorial-4.cobol b/Task/Factorial/COBOL/factorial-4.cob similarity index 100% rename from Task/Factorial/COBOL/factorial-4.cobol rename to Task/Factorial/COBOL/factorial-4.cob diff --git a/Task/Factorial/Chapel/factorial.chapel b/Task/Factorial/Chapel/factorial.chpl similarity index 100% rename from Task/Factorial/Chapel/factorial.chapel rename to Task/Factorial/Chapel/factorial.chpl diff --git a/Task/Factorial/Crystal/factorial-1.crystal b/Task/Factorial/Crystal/factorial-1.cr similarity index 100% rename from Task/Factorial/Crystal/factorial-1.crystal rename to Task/Factorial/Crystal/factorial-1.cr diff --git a/Task/Factorial/Crystal/factorial-2.crystal b/Task/Factorial/Crystal/factorial-2.cr similarity index 100% rename from Task/Factorial/Crystal/factorial-2.crystal rename to Task/Factorial/Crystal/factorial-2.cr diff --git a/Task/Factorial/Delphi/factorial-1.delphi b/Task/Factorial/Delphi/factorial-1.pas similarity index 100% rename from Task/Factorial/Delphi/factorial-1.delphi rename to Task/Factorial/Delphi/factorial-1.pas diff --git a/Task/Factorial/Delphi/factorial-2.delphi b/Task/Factorial/Delphi/factorial-2.pas similarity index 100% rename from Task/Factorial/Delphi/factorial-2.delphi rename to Task/Factorial/Delphi/factorial-2.pas diff --git a/Task/Factorial/Delphi/factorial-3.delphi b/Task/Factorial/Delphi/factorial-3.pas similarity index 100% rename from Task/Factorial/Delphi/factorial-3.delphi rename to Task/Factorial/Delphi/factorial-3.pas diff --git a/Task/Factorial/DuckDB/factorial-1.duckdb b/Task/Factorial/DuckDB/factorial-1.duckdb new file mode 100644 index 0000000000..e4f4ecf769 --- /dev/null +++ b/Task/Factorial/DuckDB/factorial-1.duckdb @@ -0,0 +1,3 @@ +create or replace function factorial(n) as ( + list_reduce( list_transform(range(1,n+1), x -> x::HUGEINT), (prod,n) -> prod * n) +); diff --git a/Task/Factorial/DuckDB/factorial-2.duckdb b/Task/Factorial/DuckDB/factorial-2.duckdb new file mode 100644 index 0000000000..0ba68192de --- /dev/null +++ b/Task/Factorial/DuckDB/factorial-2.duckdb @@ -0,0 +1,3 @@ +create or replace function double_precision_factorial(n) as ( + list_product( range(1, n+1) ) +); diff --git a/Task/Factorial/DuckDB/factorial-3.duckdb b/Task/Factorial/DuckDB/factorial-3.duckdb new file mode 100644 index 0000000000..d3a13b50ff --- /dev/null +++ b/Task/Factorial/DuckDB/factorial-3.duckdb @@ -0,0 +1,2 @@ +select n, n!, factorial(n), double_precision_factorial(n) +from values (4), (30), (33) t(n); diff --git a/Task/Factorial/EasyLang/factorial.easy b/Task/Factorial/EasyLang/factorial.easy index 1ad66bdb70..697c8807fd 100644 --- a/Task/Factorial/EasyLang/factorial.easy +++ b/Task/Factorial/EasyLang/factorial.easy @@ -1,8 +1,6 @@ func factorial n . r = 1 - for i = 2 to n - r *= i - . + for i = 2 to n : r *= i return r . print factorial 7 diff --git a/Task/Factorial/Elixir/factorial.elixir b/Task/Factorial/Elixir/factorial.ex similarity index 100% rename from Task/Factorial/Elixir/factorial.elixir rename to Task/Factorial/Elixir/factorial.ex diff --git a/Task/Factorial/Emacs-Lisp/factorial-1.l b/Task/Factorial/Emacs-Lisp/factorial-1.el similarity index 100% rename from Task/Factorial/Emacs-Lisp/factorial-1.l rename to Task/Factorial/Emacs-Lisp/factorial-1.el diff --git a/Task/Factorial/Emacs-Lisp/factorial-2.l b/Task/Factorial/Emacs-Lisp/factorial-2.el similarity index 100% rename from Task/Factorial/Emacs-Lisp/factorial-2.l rename to Task/Factorial/Emacs-Lisp/factorial-2.el diff --git a/Task/Factorial/Emacs-Lisp/factorial-3.l b/Task/Factorial/Emacs-Lisp/factorial-3.el similarity index 100% rename from Task/Factorial/Emacs-Lisp/factorial-3.l rename to Task/Factorial/Emacs-Lisp/factorial-3.el diff --git a/Task/Factorial/Euphoria/factorial-1.euphoria b/Task/Factorial/Euphoria/factorial-1.eu similarity index 100% rename from Task/Factorial/Euphoria/factorial-1.euphoria rename to Task/Factorial/Euphoria/factorial-1.eu diff --git a/Task/Factorial/Euphoria/factorial-2.euphoria b/Task/Factorial/Euphoria/factorial-2.eu similarity index 100% rename from Task/Factorial/Euphoria/factorial-2.euphoria rename to Task/Factorial/Euphoria/factorial-2.eu diff --git a/Task/Factorial/Euphoria/factorial-3.euphoria b/Task/Factorial/Euphoria/factorial-3.eu similarity index 100% rename from Task/Factorial/Euphoria/factorial-3.euphoria rename to Task/Factorial/Euphoria/factorial-3.eu diff --git a/Task/Factorial/Euphoria/factorial-4.euphoria b/Task/Factorial/Euphoria/factorial-4.eu similarity index 100% rename from Task/Factorial/Euphoria/factorial-4.euphoria rename to Task/Factorial/Euphoria/factorial-4.eu diff --git a/Task/Factorial/Fennel/factorial.fennel b/Task/Factorial/Fennel/factorial.fennel new file mode 100644 index 0000000000..c9024229d5 --- /dev/null +++ b/Task/Factorial/Fennel/factorial.fennel @@ -0,0 +1,18 @@ +(do + (fn factorial [n] ;;; iterative factorial + (if (< n 2) + 1 + ;else + (do (var f 2) + (for [i 3 n] + (set f (* f i)) + ) + f + ) + ) + ) + + (for [n 0 10] + (io.write (string.format "%2d! = %s\n" n (factorial n))) + ) +) diff --git a/Task/Factorial/Gleam/factorial-1.gleam b/Task/Factorial/Gleam/factorial-1.gleam new file mode 100644 index 0000000000..6521eeb481 --- /dev/null +++ b/Task/Factorial/Gleam/factorial-1.gleam @@ -0,0 +1 @@ +list.fold(int.range(1, n + 1, [], list.prepend), 1, int.multiply) diff --git a/Task/Factorial/Gleam/factorial-2.gleam b/Task/Factorial/Gleam/factorial-2.gleam new file mode 100644 index 0000000000..dbab0f45f6 --- /dev/null +++ b/Task/Factorial/Gleam/factorial-2.gleam @@ -0,0 +1,6 @@ +pub fn fac(n: Int) -> Int { + case n { + 1 -> 1 + n -> n * fac(n - 1) + } +} diff --git a/Task/Factorial/Gleam/factorial-3.gleam b/Task/Factorial/Gleam/factorial-3.gleam new file mode 100644 index 0000000000..dbc03d5750 --- /dev/null +++ b/Task/Factorial/Gleam/factorial-3.gleam @@ -0,0 +1,10 @@ +pub fn fac(n: Int) -> Int { + fac_helper(n, n - 1) +} + +fn fac_helper(n: Int, acc: Int) -> Int { + case n, acc { + n, 1 -> n + n, i -> fac_helper(n * i, i - 1) + } +} diff --git a/Task/Factorial/Haskell/factorial-10.hs b/Task/Factorial/Haskell/factorial-10.hs new file mode 100644 index 0000000000..d7507d16b3 --- /dev/null +++ b/Task/Factorial/Haskell/factorial-10.hs @@ -0,0 +1,8 @@ +-- product of [a,a+1..b] +productFromTo a b = + if a>b then 1 + else if a == b then a + else productFromTo a c * productFromTo (c+1) b + where c = (a+b) `div` 2 + +factorial = productFromTo 1 diff --git a/Task/Factorial/Haskell/factorial-5.hs b/Task/Factorial/Haskell/factorial-5.hs index 6b76b69b6e..f036c73a77 100644 --- a/Task/Factorial/Haskell/factorial-5.hs +++ b/Task/Factorial/Haskell/factorial-5.hs @@ -1,3 +1 @@ -factorial :: Integral -> Integral -factorial 0 = 1 -factorial n = n * factorial (n-1) +factorials = 1 : zipWith (*) factorials [1..] diff --git a/Task/Factorial/Haskell/factorial-6.hs b/Task/Factorial/Haskell/factorial-6.hs index baef906bf8..655c366a44 100644 --- a/Task/Factorial/Haskell/factorial-6.hs +++ b/Task/Factorial/Haskell/factorial-6.hs @@ -1,5 +1,2 @@ -fac n - | n >= 0 = go 1 n - | otherwise = error "Negative factorial!" - where go acc 0 = acc - go acc n = go (acc * n) (n - 1) +factorials = go 1 1 where + go n fac = f : go (n+1) (n*fac) diff --git a/Task/Factorial/Haskell/factorial-7.hs b/Task/Factorial/Haskell/factorial-7.hs index 77d34e9b2e..6b76b69b6e 100644 --- a/Task/Factorial/Haskell/factorial-7.hs +++ b/Task/Factorial/Haskell/factorial-7.hs @@ -1,10 +1,3 @@ -{-# LANGUAGE PostfixOperators #-} - -(!) :: Integer -> Integer -(!) 0 = 1 -(!) n = n * (pred n !) - -main :: IO () -main = do - print (5 !) - print ((4 !) !) +factorial :: Integral -> Integral +factorial 0 = 1 +factorial n = n * factorial (n-1) diff --git a/Task/Factorial/Haskell/factorial-8.hs b/Task/Factorial/Haskell/factorial-8.hs index d7507d16b3..baef906bf8 100644 --- a/Task/Factorial/Haskell/factorial-8.hs +++ b/Task/Factorial/Haskell/factorial-8.hs @@ -1,8 +1,5 @@ --- product of [a,a+1..b] -productFromTo a b = - if a>b then 1 - else if a == b then a - else productFromTo a c * productFromTo (c+1) b - where c = (a+b) `div` 2 - -factorial = productFromTo 1 +fac n + | n >= 0 = go 1 n + | otherwise = error "Negative factorial!" + where go acc 0 = acc + go acc n = go (acc * n) (n - 1) diff --git a/Task/Factorial/Haskell/factorial-9.hs b/Task/Factorial/Haskell/factorial-9.hs new file mode 100644 index 0000000000..77d34e9b2e --- /dev/null +++ b/Task/Factorial/Haskell/factorial-9.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE PostfixOperators #-} + +(!) :: Integer -> Integer +(!) 0 = 1 +(!) n = n * (pred n !) + +main :: IO () +main = do + print (5 !) + print ((4 !) !) diff --git a/Task/Factorial/Haxe/factorial-1.haxe b/Task/Factorial/Haxe/factorial-1.hx similarity index 100% rename from Task/Factorial/Haxe/factorial-1.haxe rename to Task/Factorial/Haxe/factorial-1.hx diff --git a/Task/Factorial/Haxe/factorial-2.haxe b/Task/Factorial/Haxe/factorial-2.hx similarity index 100% rename from Task/Factorial/Haxe/factorial-2.haxe rename to Task/Factorial/Haxe/factorial-2.hx diff --git a/Task/Factorial/Haxe/factorial-3.haxe b/Task/Factorial/Haxe/factorial-3.hx similarity index 100% rename from Task/Factorial/Haxe/factorial-3.haxe rename to Task/Factorial/Haxe/factorial-3.hx diff --git a/Task/Factorial/Haxe/factorial-4.haxe b/Task/Factorial/Haxe/factorial-4.hx similarity index 100% rename from Task/Factorial/Haxe/factorial-4.haxe rename to Task/Factorial/Haxe/factorial-4.hx diff --git a/Task/Factorial/Haxe/factorial-5.haxe b/Task/Factorial/Haxe/factorial-5.hx similarity index 100% rename from Task/Factorial/Haxe/factorial-5.haxe rename to Task/Factorial/Haxe/factorial-5.hx diff --git a/Task/Factorial/Java/factorial-4.java b/Task/Factorial/Java/factorial-4.java new file mode 100644 index 0000000000..7194a10356 --- /dev/null +++ b/Task/Factorial/Java/factorial-4.java @@ -0,0 +1,27 @@ +import java.math.BigInteger; +import java.util.function.Function; +import java.util.stream.LongStream; +import java.util.stream.Stream; + +public final class Factorial { + + public static void main(String[] args) { + // Valid only for integer arguments 1, 2, ... , 20 + Function factorialPositive = n -> LongStream.rangeClosed(2, n).reduce(1, (a, b) -> a * b); + + // Valid for integer arguments <= 20 + Function factorial = n -> { + if ( n < 0 || n > 20 ) { + throw new AssertionError("Argument is out of range: " + n); + } + + return factorialPositive.apply(n); + }; + + // Return a BigInteger value + Function factorialBig = n -> Stream.iterate(BigInteger.ONE, i -> i.add(BigInteger.ONE)) + .limit(n) + .reduce(BigInteger.ONE, BigInteger::multiply); + } + +} diff --git a/Task/Factorial/Julia/factorial-1.julia b/Task/Factorial/Julia/factorial-1.jl similarity index 100% rename from Task/Factorial/Julia/factorial-1.julia rename to Task/Factorial/Julia/factorial-1.jl diff --git a/Task/Factorial/Julia/factorial-2.julia b/Task/Factorial/Julia/factorial-2.jl similarity index 100% rename from Task/Factorial/Julia/factorial-2.julia rename to Task/Factorial/Julia/factorial-2.jl diff --git a/Task/Factorial/Kotlin/factorial.kotlin b/Task/Factorial/Kotlin/factorial.kts similarity index 100% rename from Task/Factorial/Kotlin/factorial.kotlin rename to Task/Factorial/Kotlin/factorial.kts diff --git a/Task/Factorial/Langur/factorial-1.langur b/Task/Factorial/Langur/factorial-1.langur index bc9dffcb32..3149d6b778 100644 --- a/Task/Factorial/Langur/factorial-1.langur +++ b/Task/Factorial/Langur/factorial-1.langur @@ -1,2 +1,2 @@ -val .factorial = f fold(f .x x .y, pseries .n) -writeln .factorial(7) +val factorial = fn(n number) { fold(2 .. n, by=fn{*}) } +writeln factorial(7) diff --git a/Task/Factorial/Langur/factorial-2.langur b/Task/Factorial/Langur/factorial-2.langur index 9c2085a654..93fe1fe8d3 100644 --- a/Task/Factorial/Langur/factorial-2.langur +++ b/Task/Factorial/Langur/factorial-2.langur @@ -1,2 +1,2 @@ -val .factorial = f fold(f{x}, 2 .. .n) -writeln .factorial(7) +val factorial = fn(x number) { if(x < 2: 1; x * fn((x - 1))) } +writeln factorial(7) diff --git a/Task/Factorial/Langur/factorial-3.langur b/Task/Factorial/Langur/factorial-3.langur index eb03b40830..934e4f08bd 100644 --- a/Task/Factorial/Langur/factorial-3.langur +++ b/Task/Factorial/Langur/factorial-3.langur @@ -1,2 +1,9 @@ -val .factorial = f if(.x < 2: 1; .x x self(.x - 1)) -writeln .factorial(7) +val factorial = fn(i number) { + var answer = 1 + for x in 2 .. i { + answer *= x + } + answer +} + +writeln factorial(7) diff --git a/Task/Factorial/Langur/factorial-4.langur b/Task/Factorial/Langur/factorial-4.langur index 584fd8692a..a13962013b 100644 --- a/Task/Factorial/Langur/factorial-4.langur +++ b/Task/Factorial/Langur/factorial-4.langur @@ -1,8 +1,2 @@ -val .factorial = f(.i) { - var .answer = 1 - for .x in 2 .. .i { - .answer x= .x - } - .answer -} -writeln .factorial(7) +val factorial = fn(n number) { for[=1] x in n { _for *= x } } +writeln factorial(7) diff --git a/Task/Factorial/Langur/factorial-5.langur b/Task/Factorial/Langur/factorial-5.langur deleted file mode 100644 index 18af40dfb3..0000000000 --- a/Task/Factorial/Langur/factorial-5.langur +++ /dev/null @@ -1,2 +0,0 @@ -val .factorial = f(.n) for[=1] .x in .n { _for x= .x } -writeln .factorial(7) diff --git a/Task/Factorial/M2000-Interpreter/factorial.m2000 b/Task/Factorial/M2000-Interpreter/factorial-1.m2000 similarity index 100% rename from Task/Factorial/M2000-Interpreter/factorial.m2000 rename to Task/Factorial/M2000-Interpreter/factorial-1.m2000 diff --git a/Task/Factorial/M2000-Interpreter/factorial-2.m2000 b/Task/Factorial/M2000-Interpreter/factorial-2.m2000 new file mode 100644 index 0000000000..43a5d9ca37 --- /dev/null +++ b/Task/Factorial/M2000-Interpreter/factorial-2.m2000 @@ -0,0 +1,24 @@ +Cls , 0 ' 0 for non split display, eg 3 means we preserve the 3 top lines from scrolling/cla +Report { + Factorial Task + Definitions + • The factorial of 0 (zero) is defined as being 1 (unity). + • The Factorial Function of a positive integer, n, is defined as the product of the sequence: + n, n-1, n-2, ... 1 + +} +Cls, row ' now we preserve some lines (as row number return here) +Module CheckIt { + m=1u ' 1u is biginteger + k=width-tab + For i=1 to 1000 + if pos>tab then print + m*=i + Print @(0), format$("{0::-4} :", i); + Report str$(m), k + ' Report accumulate lines and stop at 3/4 of the screen (but not on printer) + ' so we can break this using this line: + while inkey$<>"": wait 1:end while: keyboard " " + Next i +} +Checkit diff --git a/Task/Factorial/Mn/factorial.mn b/Task/Factorial/Mn/factorial.mn new file mode 100644 index 0000000000..834200986a --- /dev/null +++ b/Task/Factorial/Mn/factorial.mn @@ -0,0 +1,12 @@ +( + (n) let + 1 (product) let + (n 1 >=) + ( + product n * (product) bind + n 1 - (n) bind + ) while + product +) (factorial) lambda + +5 factorial puts pop diff --git a/Task/Factorial/Nu/factorial.nu b/Task/Factorial/Nu/factorial.nu new file mode 100644 index 0000000000..6250a46215 --- /dev/null +++ b/Task/Factorial/Nu/factorial.nu @@ -0,0 +1,3 @@ +def 'math factorial' [] {[$in 1] | math max | 1..$in | math product} + +..10 | each {math factorial} diff --git a/Task/Factorial/OCaml/factorial-1.ocaml b/Task/Factorial/OCaml/factorial-1.ml similarity index 100% rename from Task/Factorial/OCaml/factorial-1.ocaml rename to Task/Factorial/OCaml/factorial-1.ml diff --git a/Task/Factorial/OCaml/factorial-2.ocaml b/Task/Factorial/OCaml/factorial-2.ml similarity index 100% rename from Task/Factorial/OCaml/factorial-2.ocaml rename to Task/Factorial/OCaml/factorial-2.ml diff --git a/Task/Factorial/OCaml/factorial-3.ocaml b/Task/Factorial/OCaml/factorial-3.ml similarity index 100% rename from Task/Factorial/OCaml/factorial-3.ocaml rename to Task/Factorial/OCaml/factorial-3.ml diff --git a/Task/Factorial/OCaml/factorial-4.ocaml b/Task/Factorial/OCaml/factorial-4.ml similarity index 100% rename from Task/Factorial/OCaml/factorial-4.ocaml rename to Task/Factorial/OCaml/factorial-4.ml diff --git a/Task/Factorial/Oberon-07/factorial.oberon b/Task/Factorial/Oberon-07/factorial.oberon new file mode 100644 index 0000000000..8c8e1d89ca --- /dev/null +++ b/Task/Factorial/Oberon-07/factorial.oberon @@ -0,0 +1,40 @@ +MODULE Factorial; +IMPORT + Out; + +VAR + i: INTEGER; + + PROCEDURE Iterative(n: INTEGER): INTEGER; + VAR + i, r: INTEGER; + BEGIN + ASSERT(n >= 0); + r := 1; + FOR i := n TO 2 BY -1 DO + r := r * i + END; + RETURN r + END Iterative; + + PROCEDURE Recursive(n: INTEGER): INTEGER; + VAR + r: INTEGER; + BEGIN + ASSERT(n >= 0); + r := 1; + IF n > 1 THEN + r := n * Recursive(n - 1) + END; + RETURN r + END Recursive; + +BEGIN + FOR i := 0 TO 9 DO + Out.String("Iterative ");Out.Int(i,0);Out.String("! =");Out.Int(Iterative(i),8);Out.Ln; + END; + Out.Ln; + FOR i := 0 TO 9 DO + Out.String("Recursive ");Out.Int(i,0);Out.String("! =");Out.Int(Recursive(i),8);Out.Ln; + END +END Factorial. diff --git a/Task/Factorial/Pascal/factorial-2.pas b/Task/Factorial/Pascal/factorial-2.pas index 991914c559..6b44f23124 100644 --- a/Task/Factorial/Pascal/factorial-2.pas +++ b/Task/Factorial/Pascal/factorial-2.pas @@ -1,32 +1,45 @@ {$mode objFPC}{R+} -FUNCTION Factorial ( n : qword ) : qword; +FUNCTION Fact(n: qword): qword; - (*) - Update for version 3.2.0 - Factorial works until 20! , which is good enough for me for now - replace qword with dword and rax,rcx with eax, ecx for 32-bit - for Factorial until 12! - (*) +VAR + F: qword; - VAR - - F: qword; - - BEGIN +BEGIN + if n > 20 then + begin + WriteLn('This function is only accurate up to 20!'); + exit(0); + end; - asm - - mov $1, %rax - mov n, %rcx - - .Lloop1: - imul %rcx, %rax - loopnz .Lloop1 - - mov %rax, F + asm + (*) Initialize result = 1 (0! = 1 case handled automatically) (*) - end; + mov $1, %rax (*) RAX = 1 (initial result) (*) + mov n, %rcx (*) RCX = input number (counter) (*) - Result := F ; - - END; + test %rcx, %rcx (*) Check if n=0 (*) + jz .Lstore_result (*) Skip loop if n=0 (*) + + .Lloop1: + imul %rcx, %rax (*) RAX = RAX * RCX (signed mul) (*) + dec %rcx (*) Decrement RCX (*) + jnz .Lloop1 (*) Loop while RCX != 0 (*) + + .Lstore_result: + mov %rax, F (*) Store result in F (*) + end ['rax', 'rcx']; (*) Tell compiler register change (*) + + Result := F; + +END; + + +var + N : integer = 20 ; + +begin + + writeln; + writeln( BasicFact(N)); + +end. (*) Function Fact (*) diff --git a/Task/Factorial/Pascal/factorial-3.pas b/Task/Factorial/Pascal/factorial-3.pas index 64c4eabff6..137d0f6b28 100644 --- a/Task/Factorial/Pascal/factorial-3.pas +++ b/Task/Factorial/Pascal/factorial-3.pas @@ -1,92 +1,33 @@ -PROGRAM EXBigFac ; +program GMPfact; -{$IFDEF FPC} - {$mode objfpc}{$H+}{$J-}{R+} -{$ELSE} - {$APPTYPE CONSOLE} -{$ENDIF} +{$mode objfpc} -(*) +uses - Free Pascal Compiler version 3.2.0 [2020/06/14] for x86_64 - The free and readable alternative at C/C++ speeds - compiles natively to almost any platform, including raspberry PI * - Can run independently from DELPHI / Lazarus + gmp + ; - For debian Linux: apt -y install fpc - It contains a text IDE called fp + function Factorial(n: qword): string; + var + ResultMPZ: mpz_t; + i: qword; + begin + mpz_init_set_ui(ResultMPZ, 1); + for i := 2 to n do + mpz_mul_ui(ResultMPZ, ResultMPZ, i); + Result := mpz_get_str(nil, 10, ResultMPZ); + mpz_clear(ResultMPZ); + end; - https://www.freepascal.org/advantage.var +var + N : integer = 101 ; + Fact : string ; -(*) +begin + Fact := Factorial(101); + writeln( N ,'! = ', Fact); +end. (*) GMPfact (*) -USES - - gmp; - - FUNCTION WriteBigNum ( c: pchar ) : ansistring ; - - CONST - - CrLf = #13 + #10 ; - - VAR - i: longint; - len: longint; - preview: integer; - ret: ansistring = ''; - threshold: integer; - - BEGIN - - len := length ( c ) ; - WriteLn ( 'Digits: ', len ) ; - threshold := 12 ; - preview := len div threshold ; - - IF ( len < 91 ) THEN - BEGIN - FOR i := 0 TO len DO - ret:= ret + c [ i ] ; - END - ELSE - BEGIN - FOR i := 0 TO preview DO - ret:= ret + c [ i ] ; - ret:= ret + '...' ; - FOR i := len - preview -1 TO len DO - ret:= ret + c [ i ] ; - END; - ret:= ret + CrLf ; - WriteBigNum := ret; - END; - - FUNCTION BigFactorial ( n : qword ) : ansistring ; - - (*) - See https://gmplib.org/#DOC - (*) - - VAR - S: mpz_t; - c: pchar; - - BEGIN - - mpz_init_set_ui ( S, 1 ) ; - mpz_fac_ui ( S, n ) ; - c := mpz_get_str ( NIL, 10, S ) ; - BigFactorial := WriteBigNum ( c ) ; - - END; - -BEGIN - - WriteLn ( BigFactorial ( 99 ) ) ; - -END. - Output: -Digits: 156 -93326215443944...00000000000000 +101! = 9425947759838359420851623124482936749562312794702543768327889353416977599316221476503087861591808346911623490003549599583369706302603264000000000000000000000000 diff --git a/Task/Factorial/PascalABC.NET/factorial.pas b/Task/Factorial/PascalABC.NET/factorial.pas new file mode 100644 index 0000000000..87563d6ab2 --- /dev/null +++ b/Task/Factorial/PascalABC.NET/factorial.pas @@ -0,0 +1,19 @@ +function FactIter(n: integer): BigInteger; +begin + Result := 1; + for var i:=2 to n do + Result *= i; +end; + +function FactRec(n: integer): BigInteger; +begin + if n = 0 then + Result := 1 + else Result := n * FactRec(n - 1); +end; + + +begin + for var i:=1 to 20 do + Println(i,FactRec(i),FactIter(i)); +end. diff --git a/Task/Factorial/Pluto/factorial.pluto b/Task/Factorial/Pluto/factorial.pluto new file mode 100644 index 0000000000..3ed73ecb0e --- /dev/null +++ b/Task/Factorial/Pluto/factorial.pluto @@ -0,0 +1,30 @@ +local bigint = require "pluto:bigint" + +class Factorial + static function iterative(n) + local fact = bigint.new(1) + if n < 2 then return fact end + for i = 2, n do fact *= bigint.new(i) end + return fact + end + + static function recursive(n) + if n < 2 then return bigint.new(1) end + return bigint.new(n) * Factorial.recursive(n - 1) + end +end + +local function commatize(n) + local s = n:tostring() + local zero = bigint.new(0) + if n < zero then s = s:sub(2) end + for i = #s - 3, 1, -3 do + s = s:sub(1, i) .. "," .. s:sub(i + 1) + end + if n >= zero then return s end + return "-" .. s +end + +local n = 24 +print($"Factorial({n}) iterative -> {commatize(Factorial.iterative(n))}") +print($"Factorial({n}) recursive -> {commatize(Factorial.recursive(n))}") diff --git a/Task/Factorial/PowerShell/factorial-1.psh b/Task/Factorial/PowerShell/factorial-1.ps1 similarity index 100% rename from Task/Factorial/PowerShell/factorial-1.psh rename to Task/Factorial/PowerShell/factorial-1.ps1 diff --git a/Task/Factorial/PowerShell/factorial-2.psh b/Task/Factorial/PowerShell/factorial-2.ps1 similarity index 100% rename from Task/Factorial/PowerShell/factorial-2.psh rename to Task/Factorial/PowerShell/factorial-2.ps1 diff --git a/Task/Factorial/PowerShell/factorial-3.psh b/Task/Factorial/PowerShell/factorial-3.ps1 similarity index 100% rename from Task/Factorial/PowerShell/factorial-3.psh rename to Task/Factorial/PowerShell/factorial-3.ps1 diff --git a/Task/Factorial/R/factorial-4.r b/Task/Factorial/R/factorial-4.r new file mode 100644 index 0000000000..3c651ae864 --- /dev/null +++ b/Task/Factorial/R/factorial-4.r @@ -0,0 +1 @@ + fact_fp <- function(n) ifelse(!n, 1, Reduce(`*`, seq_len(n))) diff --git a/Task/Factorial/REBOL/factorial.rebol b/Task/Factorial/REBOL/factorial.rebol deleted file mode 100644 index b3ff15a290..0000000000 --- a/Task/Factorial/REBOL/factorial.rebol +++ /dev/null @@ -1,55 +0,0 @@ -REBOL [ - Title: "Factorial" - URL: http://rosettacode.org/wiki/Factorial_function -] - -; Standard recursive implementation. - -factorial: func [n][ - either n > 1 [n * factorial n - 1] [1] -] - -; Iteration. - -ifactorial: func [n][ - f: 1 - for i 2 n 1 [f: f * i] - f -] - -; Automatic memoization. -; I'm just going to say up front that this is a stunt. However, you've -; got to admit it's pretty nifty. Note that the 'memo' function -; works with an unlimited number of arguments (although the expected -; gains decrease as the argument count increases). - -memo: func [ - "Defines memoizing function -- keeps arguments/results for later use." - args [block!] "Function arguments. Just specify variable names." - body [block!] "The body block of the function." - /local m-args m-r -][ - do compose/deep [ - func [ - (args) - /dump "Dump memory." - ][ - m-args: [] - if dump [return m-args] - - if m-r: select/only m-args reduce [(args)] [return m-r] - - m-r: do [(body)] - append m-args reduce [reduce [(args)] m-r] - m-r - ] - ] -] - -mfactorial: memo [n][ - either n > 1 [n * mfactorial n - 1] [1] -] - -; Test them on numbers zero to ten. - -for i 0 10 1 [print [i ":" factorial i ifactorial i mfactorial i]] diff --git a/Task/Factorial/REXX/factorial-1.rexx b/Task/Factorial/REXX/factorial-1.rexx index b02528c706..4ab115dc32 100644 --- a/Task/Factorial/REXX/factorial-1.rexx +++ b/Task/Factorial/REXX/factorial-1.rexx @@ -1,18 +1,4 @@ -/*REXX pgm computes & shows the factorial of a non─negative integer, and also its length*/ -numeric digits 100000 /*100k digits: handles N up to 25k.*/ -parse arg n /*obtain optional argument from the CL.*/ -if n='' then call er 'no argument specified.' -if arg()>1 | words(n)>1 then call er 'too many arguments specified.' -if \datatype(n,'N') then call er "argument isn't numeric: " n -if \datatype(n,'W') then call er "argument isn't a whole number: " n -if n<0 then call er "argument can't be negative: " n -!= 1 /*define the factorial product (so far)*/ - do j=2 to n; !=!*j /*compute the factorial the hard way. */ - end /*j*/ /* [↑] where da rubber meets da road. */ - -say n'! is ['length(!) "digits]:" /*display number of digits in factorial*/ -say /*add some whitespace to the output. */ -say ! /*display the factorial product──►term.*/ -exit /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -er: say; say '***error***'; say; say arg(1); say; exit 13 +call time('r') +numeric digits 999999999 +a = 10/3 +say length(a) time('e') diff --git a/Task/Factorial/REXX/factorial-2.rexx b/Task/Factorial/REXX/factorial-2.rexx index 0ce1aa0e4d..82133ca665 100644 --- a/Task/Factorial/REXX/factorial-2.rexx +++ b/Task/Factorial/REXX/factorial-2.rexx @@ -1,22 +1,68 @@ -/*REXX program computes the factorial of a non─negative integer, and it automatically */ -/*────────────────────── adjusts the number of decimal digits to accommodate the answer.*/ -numeric digits 99 /*99 digits initially, then expanded. */ -parse arg n /*obtain optional argument from the CL.*/ -if n='' then call er 'no argument specified' -if arg()>1 | words(n)>1 then call er 'too many arguments specified.' -if \datatype(n,'N') then call er "argument isn't numeric: " n -if \datatype(n,'W') then call er "argument isn't a whole number: " n -if n<0 then call er "argument can't be negative: " n -!= 1 /*define the factorial product (so far)*/ - do j=2 to n; !=!*j /*compute the factorial the hard way. */ - if pos(.,!)==0 then iterate /*is the ! in exponential notation? */ - parse var ! 'E' digs /*extract exponent of the factorial, */ - numeric digits digs + digs % 10 /* ··· and increase it by ten percent.*/ - end /*j*/ /* [↑] where da rubber meets da road. */ -!= !/1 /*normalize the factorial product. */ -say n'! is ['length(!) "digits]:" /*display number of digits in factorial*/ -say /*add some whitespace to the output. */ -say ! /*display the factorial product ──►term*/ -exit /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -er: say; say '***error!***'; say; say arg(1); say; exit 13 +-- 10 Mar 2026 +include Setting + +say 'Factorial' +say version +say +call First20 +call Imperative 10, '1 13 71 450 3249 25206 205022 1723508 14842907 130202808' +if pos('Regina',version) > 0 then + call Recursive 10, '1 13 71 450 3249 25206 205022' +else + call Recursive 10, '1 13 71 450 3249' +call Imperative 100000,'1 13 71 450 3249 25206' +call Timer +exit + +First20: +say 'First 20 FactorialS...' +numeric digits 30 +do n = 1 to 20 + say n'! =' Fact(n) +end +say +return + +Imperative: +Memo.='' +call Time('R') +arg d,p +numeric digits d +say 'Imperative in' d 'digits precision...' +do i = 1 to Words(p) + call Time('r'); f = Word(p,i); h = Fact(f) + parse var h 'E' e + if e = '' then + say Right(f'!',10) 'has exact' Right(Length(h),9) 'digits' '('Format(Time('e'),,3)'s)' + else + say Right(f'!',10) 'has about' Right(e+1,9) 'digits' '('Format(Time('e'),,3)'s)' +end +say +return + +Recursive: +Memo.='' +call Time('R') +arg d,p +numeric digits d +say 'Recursive in' d 'digits precision...' +do i = 1 to Words(p) + call Time('r'); f = Word(p,i); h = Recurs(f) + parse var h 'E' e + if e = '' then + say Right(f'!',10) 'has exact' Right(Length(h),9) 'digits' '('Format(Time('e'),,3)'s)' + else + say Right(f'!',10) 'has about' Right(e+1,9) 'digits' '('Format(Time('e'),,3)'s)' +end +say +return + +Recurs: +procedure +arg xx +if xx = 0 then + return 1 +else + return xx*Recurs(xx-1) + +include Math diff --git a/Task/Factorial/REXX/factorial-3.rexx b/Task/Factorial/REXX/factorial-3.rexx deleted file mode 100644 index f9f6da4455..0000000000 --- a/Task/Factorial/REXX/factorial-3.rexx +++ /dev/null @@ -1,27 +0,0 @@ -/*REXX program computes & shows the factorial of an integer, striping trailing zeroes. */ -numeric digits 200 /*start with two hundred digits. */ -parse arg N . /*obtain an optional argument from CL. */ -if N=='' | N=="," then N= 0 /*Not specified? Then use the default.*/ -!= 1 /*define the factorial product so far. */ - do j=2 to N /*compute factorial the hard way. */ - old!= ! /*save old product in case of overflow.*/ - != ! * j /*multiple the old factorial with J. */ - if pos(.,!) \==0 then do /*is the ! in exponential notation?*/ - d= digits() /*D temporarily stores number digits.*/ - numeric digits d+d%10 /*add 10% to the decimal digits. */ - != old! * j /*re─calculate for the "lost" digits.*/ - end /*IFF ≡ if and only if. [↓] */ - parse var ! '' -1 _ /*obtain the right-most digit of ! */ - if _==0 then != strip(!, , 0) /*strip trailing zeroes IFF the ... */ - end /*j*/ /* [↑] ... right-most digit is zero. */ -z= 0 /*the number of trailing zeroes in ! */ - do v=5 by 0 while v<=N /*calculate number of trailing zeroes. */ - z= z + N % v /*bump Z if multiple power of five.*/ - v= v * 5 /*calculate the next power of five. */ - end /*v*/ /* [↑] we only advance V by ourself.*/ - /*stick a fork in it, we're all done. */ -!= ! || copies(0, z) /*add water to rehydrate the product. */ -if z==0 then z= 'no' /*use gooder English for the message. */ -say N'! is ['length(!) " digits with " z ' trailing zeroes]:' -say /*display blank line (for whitespace).*/ -say ! /*display the factorial product. */ diff --git a/Task/Factorial/RISC-V-Assembly/factorial.asm b/Task/Factorial/RISC-V-Assembly/factorial.asm new file mode 100644 index 0000000000..f3139a188e --- /dev/null +++ b/Task/Factorial/RISC-V-Assembly/factorial.asm @@ -0,0 +1,131 @@ +# riscv assembly raspberry pico2 rp2350 +# program factorial.s +# connexion putty com3 +/*********************************************/ +/* CONSTANTES */ +/********************************************/ +/* for this file see risc-v task include a file */ +.include "../../constantesRiscv.inc" + +/****************************************************/ +/* MACROS */ +/****************************************************/ +#.include "../ficmacrosriscv.inc" # for debugging only + +/*******************************************/ +/* INITIALED DATAS */ +/*******************************************/ +.data +szMessStart: .asciz "Program riscv start.\r\n" +szMessEnd: .asciz "\nProgram end OK.\r\n" +szCariageReturn: .asciz "\r\n" + +szMessLargeNumber: .asciz "Number N to large. \n" +szMessNegNumber: .asciz "Number N is negative. \n" + +szMessResult: .ascii "Resultat = " # message result + +.align 2 + + +/*******************************************/ +/* UNINITIALED DATA */ +/*******************************************/ +.bss +.align 2 +sConvArea: .skip 24 + +/********************************...-..--*****/ +/* SECTION CODE */ +/**********************************************/ +.text +.global main + +main: + call stdio_init_all # général init +1: # start loop connexion + li a0,0 # raz argument register + call tud_cdc_n_connected # waiting for USB connection + beqz a0,1b # return code = zero ? + + la a0,szMessStart # message address + call writeString # display message + + li a0,-10 + call factorial # + li a0,0 + call factorial # + li a0,10 + call factorial # + + la a0,szMessEnd + call writeString + call getchar +100: # final loop + j 100b +/**********************************************/ +/* compute factorial */ +/**********************************************/ +/* a0 value */ +factorial: # INFO: factorial + addi sp, sp, -4 # reserve stack + sw ra, 0(sp) + bltz a0,99f # is negative ? + li t0,1 + ble a0,t0,1f # is 0 or 1 + call computeFactorial + li t0,-1 # error overflow ? + beq a0,t0,98f +1: # display result + la a1,sConvArea + call conversion10 + la a0,szMessResult + call writeString + la a0,sConvArea + call writeString + la a0,szCariageReturn + call writeString + j 100f +98: + la a0,szMessLargeNumber + call writeString + j 100f +99: + la a0,szMessNegNumber + call writeString + j 100f +100: + lw ra, 0(sp) + addi sp, sp, 4 + ret +/**********************************************/ +/* compute factorial */ +/**********************************************/ +/* a0 value */ +computeFactorial: # INFO:computeFactorial + addi sp,sp, -8 # reserve stack + sw ra,0(sp) + sw s0,4(sp) + li t0,1 + beq a0,t0,100f # if n = 1 return + mv s0,a0 + addi a0,a0,-1 + call computeFactorial + li t0,-1 # error overflow ? + beq a0,t0,100f + mulh t0,a0,s0 # compute half high 32 bits + beqz t0,1f # is ok if result is zero + li a0,-1 # error overflow + j 100f +1: + mul a0,a0,s0 # multiplication +100: + lw ra,0(sp) + lw s0,4(sp) + addi sp,sp, 8 + ret +/************************************/ +/* file include Fonctions */ +/***********************************/ +/* for this file see risc-v task include a file */ +.include "../../includeFunctions.s" diff --git a/Task/Factorial/Rebol/factorial.rebol b/Task/Factorial/Rebol/factorial.rebol new file mode 100644 index 0000000000..feb9d5d6c4 --- /dev/null +++ b/Task/Factorial/Rebol/factorial.rebol @@ -0,0 +1,56 @@ +Rebol [ + Title: "Factorial" + URL: http://rosettacode.org/wiki/Factorial_function +] + +;; Standard recursive implementation. +factorial: func [n][ + either n > 1 [n * factorial n - 1] [1] +] + +;; Iteration. +ifactorial: func [n][ + f: 1 + for i 2 n 1 [f: f * i] + f +] + +either system/version < 3.0.0 [ + ; Automatic memoization. + ; I'm just going to say up front that this is a stunt. However, you've + ; got to admit it's pretty nifty. Note that the 'memo' function + ; works with an unlimited number of arguments (although the expected + ; gains decrease as the argument count increases). + memo: func [ + "Defines memoizing function -- keeps arguments/results for later use." + args [block!] "Function arguments. Just specify variable names." + body [block!] "The body block of the function." + /local m-args m-r + ][ + do compose/deep [ + func [ + (args) + /dump "Dump memory." + ][ + m-args: [] + if dump [return m-args] + + if m-r: select/only m-args reduce [(args)] [return m-r] + + m-r: do [(body)] + append m-args reduce [reduce [(args)] m-r] + m-r + ] + ] + ] + + mfactorial: memo [n][ + either n > 1 [n * mfactorial n - 1] [1] + ] +][ + ;; Above hack is not supported in Rebol3 + mfactorial: func[i][none] +] + +;; Test them on numbers zero to ten. +for i 0 10 1 [print [i ":" factorial i ifactorial i mfactorial i]] diff --git a/Task/Factorial/Refal/factorial.refal b/Task/Factorial/Refal/factorial.refal new file mode 100644 index 0000000000..ab25f846e3 --- /dev/null +++ b/Task/Factorial/Refal/factorial.refal @@ -0,0 +1,14 @@ +$ENTRY Go { + = ; +} + +Facts { + s.N s.Max, : '+' = ; + s.N s.Max = '! = ' > + s.Max>; +}; + +Fact { + 0 = 1; + s.N = <* s.N >>; +}; diff --git a/Task/Factorial/Retro/factorial.retro b/Task/Factorial/Retro/factorial.retro index fb56673ef4..11cf76e297 100644 --- a/Task/Factorial/Retro/factorial.retro +++ b/Task/Factorial/Retro/factorial.retro @@ -1,2 +1,8 @@ -: dup 1 = if; dup 1- * ; -: factorial dup 0 = [ 1+ ] [ ] if ; +: + dup #1 -eq? 0; drop + dup n:dec * ; + +:factorial + dup n:zero? + [ n:inc ] + [ ] choose ; diff --git a/Task/Factorial/Rhombus/factorial-1.rhombus b/Task/Factorial/Rhombus/factorial-1.rhombus new file mode 100644 index 0000000000..5042a49103 --- /dev/null +++ b/Task/Factorial/Rhombus/factorial-1.rhombus @@ -0,0 +1,5 @@ +#lang rhombus/static + +fun factorial: +| factorial(0): 1 +| factorial(n): n * factorial(n - 1) diff --git a/Task/Factorial/Rhombus/factorial-2.rhombus b/Task/Factorial/Rhombus/factorial-2.rhombus new file mode 100644 index 0000000000..95c17bc122 --- /dev/null +++ b/Task/Factorial/Rhombus/factorial-2.rhombus @@ -0,0 +1,7 @@ +#lang rhombus/static + +fun factorial(n): + for values(a=1) (n in 1..=n): + a * n + +factorial(6) // output: 720 diff --git a/Task/Factorial/Coq/factorial.coq b/Task/Factorial/Rocq/factorial.rocq similarity index 100% rename from Task/Factorial/Coq/factorial.coq rename to Task/Factorial/Rocq/factorial.rocq diff --git a/Task/Factorial/Rust/factorial.rust b/Task/Factorial/Rust/factorial.rs similarity index 100% rename from Task/Factorial/Rust/factorial.rust rename to Task/Factorial/Rust/factorial.rs diff --git a/Task/Factorial/S-BASIC/factorial-1.basic b/Task/Factorial/S-BASIC/factorial-1.basic new file mode 100644 index 0000000000..3899ac1bd1 --- /dev/null +++ b/Task/Factorial/S-BASIC/factorial-1.basic @@ -0,0 +1,13 @@ +function factorial(n=real.double)=real.double + if n = 0 then n = 1 else n = n * factorial(n-1) +end = n + +var i=integer +print "Factorial Calculator" +print " n n!" +print "----------------------" +for i=1 to 15 + print using "## #,###,###,###,###";i;factorial(i) +next i + +end diff --git a/Task/Factorial/S-BASIC/factorial-2.basic b/Task/Factorial/S-BASIC/factorial-2.basic new file mode 100644 index 0000000000..91fbb1fce5 --- /dev/null +++ b/Task/Factorial/S-BASIC/factorial-2.basic @@ -0,0 +1,7 @@ +function factorial(n=real.double)=real.double + var i, f = real.double + f = 1 + for i = 1 to n + f = f * i + next i +end = f diff --git a/Task/Factorial/SQL/factorial.sql b/Task/Factorial/SQL/factorial.sql new file mode 100644 index 0000000000..c0b412e4a3 --- /dev/null +++ b/Task/Factorial/SQL/factorial.sql @@ -0,0 +1,6 @@ +WITH RECURSIVE f(a, b) AS ( + VALUES(1, 1) + UNION ALL + SELECT a * b, b + 1 FROM f WHERE b <= 9 +) +SELECT MAX(a) FROM f diff --git a/Task/Factorial/Scheme/factorial-1.ss b/Task/Factorial/Scheme/factorial-1.scm similarity index 100% rename from Task/Factorial/Scheme/factorial-1.ss rename to Task/Factorial/Scheme/factorial-1.scm diff --git a/Task/Factorial/Scheme/factorial-2.ss b/Task/Factorial/Scheme/factorial-2.scm similarity index 100% rename from Task/Factorial/Scheme/factorial-2.ss rename to Task/Factorial/Scheme/factorial-2.scm diff --git a/Task/Factorial/Scheme/factorial-3.ss b/Task/Factorial/Scheme/factorial-3.scm similarity index 100% rename from Task/Factorial/Scheme/factorial-3.ss rename to Task/Factorial/Scheme/factorial-3.scm diff --git a/Task/Factorial/Scheme/factorial-4.scm b/Task/Factorial/Scheme/factorial-4.scm new file mode 100644 index 0000000000..1d26a067d8 --- /dev/null +++ b/Task/Factorial/Scheme/factorial-4.scm @@ -0,0 +1,24 @@ +;Using a generator and a function that apply generated values to a function taking two arguments + +;A generator knows commands 'next? and 'next +(define (range a b) +(let ((k a)) +(lambda (msg) +(cond + ((eq? msg 'next?) (<= k b)) + ((eq? msg 'next) + (cond + ((<= k b) (set! k (+ k 1)) (- k 1)) + (else 'nothing-left))))))) + +;Similar to List.fold_left in OCaml, but uses a generator +(define (fold fun a gen) +(let aux ((a a)) + (if (gen 'next?) (aux (fun a (gen 'next))) a))) + +;Now the factorial function +(define (factorial n) (fold * 1 (range 1 n))) + +(factorial 8) + +;40320 diff --git a/Task/Factorial/Scheme/factorial-4.ss b/Task/Factorial/Scheme/factorial-4.ss deleted file mode 100644 index 3e179ef9e9..0000000000 --- a/Task/Factorial/Scheme/factorial-4.ss +++ /dev/null @@ -1,23 +0,0 @@ -;Using a generator and a function that apply generated values to a function taking two arguments - -;A generator knows commands 'next? and 'next -(define (range a b) -(let ((k a)) -(lambda (msg) -(cond - ((eq? msg 'next?) (<= k b)) - ((eq? msg 'next) - (cond - ((<= k b) (set! k (+ k 1)) (- k 1)) - (else 'nothing-left))))))) - -;Similar to List.fold_left in OCaml, but uses a generator -(define (fold fun a gen) -(let aux ((a a)) - (if (gen 'next?) (aux (fun a (gen 'next))) a))) - -;Now the factorial function -(define (factorial n) (fold * 1 (range 1 n))) - -(factorial 8) -;40320 diff --git a/Task/Factorial/Scheme/factorial-5.scm b/Task/Factorial/Scheme/factorial-5.scm new file mode 100644 index 0000000000..513325a124 --- /dev/null +++ b/Task/Factorial/Scheme/factorial-5.scm @@ -0,0 +1,9 @@ +(define (range n) + (let ((lst '())) + (do ((i 1 (+ i 1))) + ((= i (+ n 1))) + (set! lst (cons i lst))) + (reverse lst))) + +(define (fact n) + (apply * (range n))) diff --git a/Task/Factorial/Soda/factorial-2.soda b/Task/Factorial/Soda/factorial-2.soda index 65bca7ad00..91cb1f27fb 100644 --- a/Task/Factorial/Soda/factorial-2.soda +++ b/Task/Factorial/Soda/factorial-2.soda @@ -1,4 +1,3 @@ -@tailrec _tailrec_fact (n : Int) (accum : Int) : Int = if n < 2 then accum diff --git a/Task/Factorial/TAV/factorial.tav b/Task/Factorial/TAV/factorial.tav new file mode 100644 index 0000000000..ce55505a2d --- /dev/null +++ b/Task/Factorial/TAV/factorial.tav @@ -0,0 +1,14 @@ +factorial (n) iterative: + p =: 1 + ?# i =: from 2 upto n \ does nothing if n < 2 + p =* i + :> p +factorial (n) recursive: + ? n <= 1 + :> 1 + :> n * factorial recursive n-1 + \ test code + main(parms):+ + arg =: string parms[1] as integer else 100 + print factorial arg iterative + print factorial arg recursive diff --git a/Task/Factorial/Tailspin/factorial-2.tailspin b/Task/Factorial/Tailspin/factorial-2.tailspin index 023c4b4738..09af3015fd 100644 --- a/Task/Factorial/Tailspin/factorial-2.tailspin +++ b/Task/Factorial/Tailspin/factorial-2.tailspin @@ -1,4 +1,6 @@ -templates factorial - when <=0> do 1 ! - when <0..> $ * ($ - 1 -> factorial) ! +factorial templates + when <|0..> do + @ set 1; + 1..$ -> @ set $@ * $; + $@ ! end factorial diff --git a/Task/Factorial/Tailspin/factorial-3.tailspin b/Task/Factorial/Tailspin/factorial-3.tailspin new file mode 100644 index 0000000000..023c4b4738 --- /dev/null +++ b/Task/Factorial/Tailspin/factorial-3.tailspin @@ -0,0 +1,4 @@ +templates factorial + when <=0> do 1 ! + when <0..> $ * ($ - 1 -> factorial) ! +end factorial diff --git a/Task/Factorial/Tailspin/factorial-4.tailspin b/Task/Factorial/Tailspin/factorial-4.tailspin new file mode 100644 index 0000000000..968ff78c33 --- /dev/null +++ b/Task/Factorial/Tailspin/factorial-4.tailspin @@ -0,0 +1,4 @@ +factorial templates + when <|=0> do 1 ! + when <|0..> do $ * ($ - 1 -> #) ! +end factorial diff --git a/Task/Factorial/Tcl/factorial-1.tcl b/Task/Factorial/Tcl/factorial-1.tcl index 8220088fdf..a204184466 100644 --- a/Task/Factorial/Tcl/factorial-1.tcl +++ b/Task/Factorial/Tcl/factorial-1.tcl @@ -1,6 +1,12 @@ -proc ifact n { - for {set i $n; set sum 1} {$i >= 2} {incr i -1} { - set sum [expr {$sum * $i}] +# tailcall optimization is standard in tcl8.6 +proc fact { n { result 1. } } { + if { $n <= 1 } { + return $result + } else { + tailcall fact [expr {$n-1}] [expr {$n*$result}] } - return $sum } + +set f [fact 10] + +puts $f diff --git a/Task/Factorial/Tcl/factorial-2.tcl b/Task/Factorial/Tcl/factorial-2.tcl index 40cc360692..8220088fdf 100644 --- a/Task/Factorial/Tcl/factorial-2.tcl +++ b/Task/Factorial/Tcl/factorial-2.tcl @@ -1,3 +1,6 @@ -proc rfact n { - expr {$n < 2 ? 1 : $n * [rfact [incr n -1]]} +proc ifact n { + for {set i $n; set sum 1} {$i >= 2} {incr i -1} { + set sum [expr {$sum * $i}] + } + return $sum } diff --git a/Task/Factorial/Tcl/factorial-3.tcl b/Task/Factorial/Tcl/factorial-3.tcl index e25b3f18c7..40cc360692 100644 --- a/Task/Factorial/Tcl/factorial-3.tcl +++ b/Task/Factorial/Tcl/factorial-3.tcl @@ -1 +1,3 @@ -proc tcl::mathfunc::fact n {expr {$n < 2? 1: $n*fact($n-1)}} +proc rfact n { + expr {$n < 2 ? 1 : $n * [rfact [incr n -1]]} +} diff --git a/Task/Factorial/Tcl/factorial-4.tcl b/Task/Factorial/Tcl/factorial-4.tcl index 9a9a02de85..e25b3f18c7 100644 --- a/Task/Factorial/Tcl/factorial-4.tcl +++ b/Task/Factorial/Tcl/factorial-4.tcl @@ -1,17 +1 @@ -proc ifact_caching n { - global fact_cache - if { ! [info exists fact_cache]} { - set fact_cache {1 1} - } - if {$n < [llength $fact_cache]} { - return [lindex $fact_cache $n] - } - set i [expr {[llength $fact_cache] - 1}] - set sum [lindex $fact_cache $i] - while {$i < $n} { - incr i - set sum [expr {$sum * $i}] - lappend fact_cache $sum - } - return $sum -} +proc tcl::mathfunc::fact n {expr {$n < 2? 1: $n*fact($n-1)}} diff --git a/Task/Factorial/Tcl/factorial-5.tcl b/Task/Factorial/Tcl/factorial-5.tcl index ecdfbe5752..c8cb0123e7 100644 --- a/Task/Factorial/Tcl/factorial-5.tcl +++ b/Task/Factorial/Tcl/factorial-5.tcl @@ -1,11 +1,18 @@ -puts [ifact 30] -puts [rfact 30] -puts [ifact_caching 30] - -set n 400 -set iterations 10000 -puts "calculate $n factorial $iterations times" -puts "ifact: [time {ifact $n} $iterations]" -puts "rfact: [time {rfact $n} $iterations]" -# for the caching proc, reset the cache between each iteration so as not to skew the results -puts "ifact_caching: [time {ifact_caching $n; unset -nocomplain fact_cache} $iterations]" +proc ifact_caching n { + global fact_cache + tailcall fact [expr {$n-1}] [expr {$n*$result}] + if { ! [info exists fact_cache]} { + set fact_cache {1 1} + } + if {$n < [llength $fact_cache]} { + return [lindex $fact_cache $n] + } + set i [expr {[llength $fact_cache] - 1}] + set sum [lindex $fact_cache $i] + while {$i < $n} { + incr i + set sum [expr {$sum * $i}] + lappend fact_cache $sum + } + return $sum +} diff --git a/Task/Factorial/Tcl/factorial-6.tcl b/Task/Factorial/Tcl/factorial-6.tcl index 46e5e0fcab..9a3cf79548 100644 --- a/Task/Factorial/Tcl/factorial-6.tcl +++ b/Task/Factorial/Tcl/factorial-6.tcl @@ -1,5 +1,52 @@ -package require math::special +# calls cmd with args +# retpeatedly in scope above +proc trampoline {cmd args} { -proc gfact n { - expr {round([::math::special::Gamma [expr {$n+1}]])} + # thunk is {cmd {arg1 arg2 arg3 ...} } + set result [uplevel 1 [concat $cmd $args]] + + # split into vars + lassign $result type thunk + + # loop + while {$type eq "next"} { + set result [uplevel 1 $thunk] + lassign $result type thunk + } + + set final_value $thunk + + return $final_value } + +# return { value final_value } +# or { next {cmd arg1 arg2} } +proc factorial_step {n result} { + + if {$n <= 1} { + set ret_value [list "value" $result] + } else { + + # n-1 + set next_n [expr {$n-1}] + + # (n-1) * fact(n) + set next_result [expr {$n * $result}] + + # {func arg1 arg2} + set next_thunk [list factorial_step $next_n $next_result] + + # Return the next step as a list + set ret_value [list "next" $next_thunk] + } + + return $ret_value +} + + +# The execution is wrapped by the trampoline +proc factorial {n} { + return [trampoline factorial_step $n 1] +} + +set f [factorial 100] diff --git a/Task/Factorial/Tcl/factorial-7.tcl b/Task/Factorial/Tcl/factorial-7.tcl new file mode 100644 index 0000000000..ecdfbe5752 --- /dev/null +++ b/Task/Factorial/Tcl/factorial-7.tcl @@ -0,0 +1,11 @@ +puts [ifact 30] +puts [rfact 30] +puts [ifact_caching 30] + +set n 400 +set iterations 10000 +puts "calculate $n factorial $iterations times" +puts "ifact: [time {ifact $n} $iterations]" +puts "rfact: [time {rfact $n} $iterations]" +# for the caching proc, reset the cache between each iteration so as not to skew the results +puts "ifact_caching: [time {ifact_caching $n; unset -nocomplain fact_cache} $iterations]" diff --git a/Task/Factorial/Tcl/factorial-8.tcl b/Task/Factorial/Tcl/factorial-8.tcl new file mode 100644 index 0000000000..46e5e0fcab --- /dev/null +++ b/Task/Factorial/Tcl/factorial-8.tcl @@ -0,0 +1,5 @@ +package require math::special + +proc gfact n { + expr {round([::math::special::Gamma [expr {$n+1}]])} +} diff --git a/Task/Factorial/Tiny-Craft-Basic/factorial.basic b/Task/Factorial/Tiny-Craft-Basic/factorial.basic deleted file mode 100644 index 868e8fdb67..0000000000 --- a/Task/Factorial/Tiny-Craft-Basic/factorial.basic +++ /dev/null @@ -1,14 +0,0 @@ -10 let f = 1 - -20 print "factorial" -30 input "enter an integer (1-34): ", n - -40 rem loop - - 60 let f = f * n - 70 let n = n - 1 - -80 if n > 0 then 40 - -90 print f -100 shell "pause" diff --git a/Task/Factorial/Uiua/factorial.uiua b/Task/Factorial/Uiua/factorial.uiua new file mode 100644 index 0000000000..7b2a3e07ea --- /dev/null +++ b/Task/Factorial/Uiua/factorial.uiua @@ -0,0 +1 @@ +Factorial = /×+1⇡ diff --git a/Task/Factorial/Uxntal/factorial.uxnatl b/Task/Factorial/Uxntal/factorial.uxnatl new file mode 100644 index 0000000000..f936013ac4 --- /dev/null +++ b/Task/Factorial/Uxntal/factorial.uxnatl @@ -0,0 +1,28 @@ +%newline { [ LIT2 0a -Console/write ] DEO } + +|18 @Console/write + +|100 + +#0900 +&loop + DUP #00 SWP factorial print/dec newline + INC GTHk ?&loop +POP2 + +BRK + +@factorial ( n* -- n!* ) + ORAk ?{ POP2 #0001 JMP2r } + DUP2 #0001 SUB2 factorial MUL2 + JMP2r + +@print/dec ( short* -- ) + #000a SWP2 [ LITr ff ] + &get ( -- ) + SWP2k DIV2k MUL2 SUB2 STH + POP OVR2 DIV2 ORAk ?&get + POP2 POP2 + &put ( -- ) + STHr INCk ?{ POP JMP2r } + [ LIT "0 ] ADD .Console/write DEO !&put diff --git a/Task/Factorial/VBScript/factorial.vb b/Task/Factorial/VBScript/factorial.vbs similarity index 100% rename from Task/Factorial/VBScript/factorial.vb rename to Task/Factorial/VBScript/factorial.vbs diff --git a/Task/Factorial/VHDL/factorial.vhdl b/Task/Factorial/VHDL/factorial.vhd similarity index 100% rename from Task/Factorial/VHDL/factorial.vhdl rename to Task/Factorial/VHDL/factorial.vhd diff --git a/Task/Factorial/Vyxal/factorial-1.vyxal b/Task/Factorial/Vyxal/factorial-1.vyxal new file mode 100644 index 0000000000..25e660494e --- /dev/null +++ b/Task/Factorial/Vyxal/factorial-1.vyxal @@ -0,0 +1 @@ +¡ diff --git a/Task/Factorial/Vyxal/factorial-2.vyxal b/Task/Factorial/Vyxal/factorial-2.vyxal new file mode 100644 index 0000000000..954fe1858c --- /dev/null +++ b/Task/Factorial/Vyxal/factorial-2.vyxal @@ -0,0 +1 @@ +ɾƒ* diff --git a/Task/Factorial/Vyxal/factorial-3.vyxal b/Task/Factorial/Vyxal/factorial-3.vyxal new file mode 100644 index 0000000000..601abd91b0 --- /dev/null +++ b/Task/Factorial/Vyxal/factorial-3.vyxal @@ -0,0 +1 @@ +λ0=[1|‹x*]; diff --git a/Task/Factorial/Wren/factorial.wren b/Task/Factorial/Wren/factorial.wren index a534b7f4e0..e954eb7b03 100644 --- a/Task/Factorial/Wren/factorial.wren +++ b/Task/Factorial/Wren/factorial.wren @@ -1,5 +1,5 @@ -import "/fmt" for Fmt -import "/big" for BigInt +import "./fmt" for Fmt +import "./big" for BigInt class Factorial { static iterative(n) { diff --git a/Task/Factorial/YAMLScript/factorial.ys b/Task/Factorial/YAMLScript/factorial.ys index 6e65fa56ae..29d50ba6fa 100644 --- a/Task/Factorial/YAMLScript/factorial.ys +++ b/Task/Factorial/YAMLScript/factorial.ys @@ -1,4 +1,10 @@ -defn factorial(x): - apply(*): (2 .. x) +!YS-v0 -say: factorial(10) +defn main(*ns): + each n ns: + say: "$n! -> $factorial(n)" + +defn factorial(x): + if x <= 2: + (x ||| 1) + (2 .. x).mul(*) diff --git a/Task/Factorial/Zig/factorial.zig b/Task/Factorial/Zig/factorial.zig index c0a83517ca..8b39b0719a 100644 --- a/Task/Factorial/Zig/factorial.zig +++ b/Task/Factorial/Zig/factorial.zig @@ -1,25 +1,27 @@ -const stdout = @import("std").io.getStdOut().outStream(); - pub fn factorial(comptime Num: type, n: i8) ?Num { return if (@typeInfo(Num) != .Int) - @compileError("factorial called with num-integral type: " ++ @typeName(Num)) + @compileError("factorial called with non-integral type: " ++ @typeName(Num)) else if (n < 0) null else calc: { var i: i8 = 1; var fac: Num = 1; while (i <= n) : (i += 1) { - if (@mulWithOverflow(Num, fac, i, &fac)) - break :calc null; + const tmp = @mulWithOverflow(fac, i); + if (tmp[1] != 0) + break :calc null; // overflow + fac = tmp[0]; } else break :calc fac; }; } pub fn main() !void { - try stdout.print("-1! = {}\n", .{factorial(i32, -1)}); - try stdout.print("0! = {}\n", .{factorial(i32, 0)}); - try stdout.print("5! = {}\n", .{factorial(i32, 5)}); - try stdout.print("33!(64 bit) = {}\n", .{factorial(i64, 33)}); // not vailid i64 factorial - try stdout.print("33! = {}\n", .{factorial(i128, 33)}); // biggest facorial possible - try stdout.print("34! = {}\n", .{factorial(i128, 34)}); // will overflow + const stdout = @import("std").io.getStdOut().writer(); + + try stdout.print("-1! = {?}\n", .{factorial(i32, -1)}); + try stdout.print("0! = {?}\n", .{factorial(i32, 0)}); + try stdout.print("5! = {?}\n", .{factorial(i32, 5)}); + try stdout.print("33!(64 bit) = {?}\n", .{factorial(i64, 33)}); // not valid i64 factorial + try stdout.print("33! = {?}\n", .{factorial(i128, 33)}); // biggest i128 factorial possible + try stdout.print("34! = {?}\n", .{factorial(i128, 34)}); // will overflow } diff --git a/Task/Factorions/ALGOL-68/factorions.alg b/Task/Factorions/ALGOL-68/factorions.alg index 70b2f250e7..bf43b1ebde 100644 --- a/Task/Factorions/ALGOL-68/factorions.alg +++ b/Task/Factorions/ALGOL-68/factorions.alg @@ -1,9 +1,9 @@ BEGIN # cache factorials from 0 to 11 # - [ 0 : 11 ]INT fact; - fact[0] := 1; + [ 0 : 11 ]INT bfact; + bfact[0] := 1; FOR n TO 11 DO - fact[n] := fact[n-1] * n + bfact[n] := bfact[n-1] * n OD; FOR b FROM 9 TO 12 DO print( ( "The factorions for base ", whole( b, 0 ), " are:", newline ) ); @@ -11,7 +11,7 @@ BEGIN INT sum := 0; INT j := i; WHILE j > 0 DO - sum +:= fact[ j MOD b ]; + sum +:= bfact[ j MOD b ]; j OVERAB b OD; IF sum = i THEN print( ( whole( i, 0 ), " " ) ) FI diff --git a/Task/Factorions/Ada/factorions.adb b/Task/Factorions/Ada/factorions.adb new file mode 100644 index 0000000000..a8d21fb554 --- /dev/null +++ b/Task/Factorions/Ada/factorions.adb @@ -0,0 +1,64 @@ +with Ada.Text_IO; + +procedure Factorions is + subtype Factorial_Domain is Natural range 0 .. 11; + subtype Log_Base is Positive range 2 .. Positive'Last; + type Result_Table is array (Factorial_Domain) of Positive; + + Factorial : Result_Table; + Search_Limit : Positive := 1_500_000; + + procedure Precompute_Factorials is + begin + Factorial (0) := 1; + + for I in 1 .. Factorial'Last loop + Factorial (I) := I * Factorial (I - 1); + end loop; + end Precompute_Factorials; + + function Floor_Log (Number : Positive; Base : Log_Base) return Natural is + Remaining : Natural := Number; + Floor_Log : Natural := 0; + begin + while Remaining > Base loop + Remaining := Remaining / Base; + Floor_Log := Floor_Log + 1; + end loop; + + return Floor_Log; + end Floor_Log; + + function Digit (Number, Index : Natural; Base : Log_Base) return Natural is + begin + return (Number / (Base ** Index)) mod Base; + end Digit; + + function Is_Factorion (Number : Positive; Base : Log_Base) return Boolean is + Digit_Sum : Natural := 0; + begin + for I in 0 .. Floor_Log (Number, Base) loop + Digit_Sum := Digit_Sum + Factorial (Digit (Number, I, Base)); + end loop; + + return Digit_Sum = Number; + end Is_Factorion; + + procedure Show_Factorions (Base : Log_Base) is + begin + Ada.Text_IO.Put_Line ("Search Base " & Base'Image); + for I in 1 .. Search_Limit loop + if Is_Factorion (I, Base) then + Ada.Text_IO.Put_Line (I'Image); + end if; + end loop; + Ada.Text_IO.Put_Line ("Done Base " & Base'Image); + end Show_Factorions; + +begin + Precompute_Factorials; + Show_Factorions (9); + Show_Factorions (10); + Show_Factorions (11); + Show_Factorions (12); +end Factorions; diff --git a/Task/Factorions/Arturo/factorions.arturo b/Task/Factorions/Arturo/factorions.arturo index 700ea04d67..e31b208049 100644 --- a/Task/Factorions/Arturo/factorions.arturo +++ b/Task/Factorions/Arturo/factorions.arturo @@ -1,10 +1,9 @@ factorials: [1 1 2 6 24 120 720 5040 40320 362880 3628800 39916800] factorion?: function [n, base][ - try? [ + if throws? [ n = sum map digits.base:base n 'x -> factorials\[x] - ] - else [ + ][ print ["n:" n "base:" base] false ] @@ -12,4 +11,3 @@ factorion?: function [n, base][ loop 9..12 'base -> print ["Base" base "factorions:" select 1..45000 'z -> factorion? z base] -] diff --git a/Task/Factorions/Delphi/factorions.delphi b/Task/Factorions/Delphi/factorions.pas similarity index 100% rename from Task/Factorions/Delphi/factorions.delphi rename to Task/Factorions/Delphi/factorions.pas diff --git a/Task/Factorions/EasyLang/factorions.easy b/Task/Factorions/EasyLang/factorions.easy new file mode 100644 index 0000000000..014c445c4c --- /dev/null +++ b/Task/Factorions/EasyLang/factorions.easy @@ -0,0 +1,20 @@ +len fact[] 12 +# +fact[0] = 1 +for n = 1 to 11 + fact[n] = fact[n - 1] * n +. +for b = 9 to 12 + write "base " & b & " factorions:" + for i = 1 to 1500000 - 1 + sum = 0 + j = i + while j > 0 + d = j mod b + sum += fact[d] + j = j div b + . + if sum = i : write " " & i + . + print "" +. diff --git a/Task/Factorions/Fortran/factorions.f b/Task/Factorions/Fortran/factorions.f new file mode 100644 index 0000000000..a142cc2e4a --- /dev/null +++ b/Task/Factorions/Fortran/factorions.f @@ -0,0 +1,52 @@ +! Factorions +! tested with Intel ifx (IFX) 2025.2.1 20250806 on Kubuntu 25.10 +! GNU gfortran (Ubuntu 15.2.0-4ubuntu4) 15.2.0 on Kubuntu 25.10 +! VSI Fortran x86-64 V8.7-001 on OpenVMS V9.2-3 +program Factorions +integer, parameter :: minBase=9, maxBase = 12 ! minumum and maximum base used in this little program +integer, parameter :: factLim=1499999 ! Maximum factorial Number for all bases that are used here +integer, dimension(0:maxBase-1) :: fact ! Stored factorials for numbers 0...12 + +integer :: ii, jj, base + +! Prepare cached factorial function +fact = 1 +do ii=1, maxBase-1 + do jj= 2, ii + fact(ii) = fact(ii) * jj + enddo +end do + +! +! Brute force: for all bases, for all numbers 1...max tes each number and print if its a factorion. +! +do base=minBase, maxBase + write (*, '("The factorions in base ", i0, " are:")') base + do ii=1, factLim + if (isFactorion (ii, base)) write (*, '(1x,i0)', advance='no') ii + enddo + write (*,'(/)') +end do + +contains + +! +! Separate digits d of number n in base b, sum up d!, and compare result with n. +! +function isFactorion (n,b) result (YN) +integer, intent (in) :: n, b +logical :: YN +integer :: dig, nn, facts_sum + +nn = N +facts_sum = 0 +do while (nn .ne. 0) + dig = mod (nn, b) + nn = nn / b + + facts_sum = facts_sum + fact(dig) +enddo +yn = facts_sum .eq. n + +end function isFactorion +end program Factorions diff --git a/Task/Factorions/JavaScript/factorions.js b/Task/Factorions/JavaScript/factorions.js new file mode 100644 index 0000000000..a9a3f2c3ae --- /dev/null +++ b/Task/Factorions/JavaScript/factorions.js @@ -0,0 +1,25 @@ +function factorial(n) { + if (n <= 1) { + return 1; + } + let a = [...Array(n + 1).keys()]; + a.shift(); + return a.reduce((x, y) => x * y); +} + +function fact_digsum(n, b) { + if (n > b - 1) { + return factorial(n % b) + fact_digsum(Math.floor(n / b), b); + } + return factorial(n); +} + +for (let i = 9; i <= 12; i++) { + console.log(`Factorions in base ${i}:`); + for (let j = 1; j < 1499999; j++) { + if (j == fact_digsum(j, i)) { + console.log(j); + } + } + console.log(); +} diff --git a/Task/Factorions/Jq/factorions.jq b/Task/Factorions/Jq/factorions.jq index 84891c0781..012ec312ee 100644 --- a/Task/Factorions/Jq/factorions.jq +++ b/Task/Factorions/Jq/factorions.jq @@ -29,7 +29,7 @@ def sufficient: .digits += 1 | .value *= $base ) ; -# Show the factorions for all based from 2 through 12: +# Show the factorions for all bases from 2 through 12: (range(2;10) | . as $base | sufficient.value as $max diff --git a/Task/Factorions/Julia/factorions.julia b/Task/Factorions/Julia/factorions.jl similarity index 100% rename from Task/Factorions/Julia/factorions.julia rename to Task/Factorions/Julia/factorions.jl diff --git a/Task/Factorions/OCaml/factorions.ocaml b/Task/Factorions/OCaml/factorions.ml similarity index 100% rename from Task/Factorions/OCaml/factorions.ocaml rename to Task/Factorions/OCaml/factorions.ml diff --git a/Task/Factorions/PascalABC.NET/factorions.pas b/Task/Factorions/PascalABC.NET/factorions.pas new file mode 100644 index 0000000000..ac69d82c56 --- /dev/null +++ b/Task/Factorions/PascalABC.NET/factorions.pas @@ -0,0 +1,22 @@ +## +var fact := |1| * 12; +for var i := 1 to 11 do fact[i] := i * fact[i - 1]; + +for var b := 9 to 12 do +begin + write('The factorions for base ', b:2, ' are: '); + for var i := 1 to 1_500_000 do + begin + var fact_sum := 0; + var j := i; + while j > 0 do + begin + var d := j mod b; + fact_sum += fact[d]; + j := j div b; + end; + if fact_sum = i then + print(i) + end; + println; +end; diff --git a/Task/Factorions/Pluto/factorions.pluto b/Task/Factorions/Pluto/factorions.pluto new file mode 100644 index 0000000000..f95a296746 --- /dev/null +++ b/Task/Factorions/Pluto/factorions.pluto @@ -0,0 +1,18 @@ +-- Cache factorials from 0 to 11. +local fact = {[0] = 1} +for n = 1, 11 do fact[n] = fact[n - 1] * n end + +for b = 9, 12 do + print($"The factorions for base {b} are:") + for i = 1, 1_499_999 do + local sum = 0 + local j = i + while j > 0 do + local d = j % b + sum += fact[d] + j //= b + end + if sum == i then io.write($"{i} ") end + end + print("\n") +end diff --git a/Task/Factorions/R/factorions.r b/Task/Factorions/R/factorions.r new file mode 100644 index 0000000000..9f1c569b7e --- /dev/null +++ b/Task/Factorions/R/factorions.r @@ -0,0 +1,12 @@ +fact_digsum <- function(n, b) { + if(n > b-1) { + factorial(n%%b)+fact_digsum(n%/%b, b) + } else factorial(n) +} + +for(i in 9:12) { + cat("\nFactorions in base ", i, ":\n", sep="") + for(j in 1:1499999) { + if(j == fact_digsum(j, i)) cat(j, "") + } +} diff --git a/Task/Factorions/VBScript/factorions.vb b/Task/Factorions/VBScript/factorions.vbs similarity index 100% rename from Task/Factorions/VBScript/factorions.vb rename to Task/Factorions/VBScript/factorions.vbs diff --git a/Task/Factorions/Vyxal/factorions.vyxal b/Task/Factorions/Vyxal/factorions.vyxal new file mode 100644 index 0000000000..bf2fb337c6 --- /dev/null +++ b/Task/Factorions/Vyxal/factorions.vyxal @@ -0,0 +1,7 @@ +λ2|→B:←Bτƛ¡}∑$_-¬}£ # check whether factorion +⟨9|10|11|12⟩(`Base `₴n:₴\:,→b + 1500000 ( + n 1000 ≠[ + ←b n¥†[n,]] + ) +) diff --git a/Task/Factors-of-a-Mersenne-number/Ada/factors-of-a-mersenne-number.ada b/Task/Factors-of-a-Mersenne-number/Ada/factors-of-a-mersenne-number.adb similarity index 100% rename from Task/Factors-of-a-Mersenne-number/Ada/factors-of-a-mersenne-number.ada rename to Task/Factors-of-a-Mersenne-number/Ada/factors-of-a-mersenne-number.adb diff --git a/Task/Factors-of-a-Mersenne-number/Arturo/factors-of-a-mersenne-number.arturo b/Task/Factors-of-a-Mersenne-number/Arturo/factors-of-a-mersenne-number.arturo index 6542a31a61..ec0ce3744d 100644 --- a/Task/Factors-of-a-Mersenne-number/Arturo/factors-of-a-mersenne-number.arturo +++ b/Task/Factors-of-a-Mersenne-number/Arturo/factors-of-a-mersenne-number.arturo @@ -5,16 +5,16 @@ mersenneFactors: function [q][ -> shl 'r 1 d: new 1 + 2 * q while [true][ - i: new 1 + i: 1 p: new r while [p <> 0][ - i: new (i * i) % d + i: (i * i) % d if p < 0 -> 'i * 2 if i > d -> 'i - d shl 'p 1 ] - if? i <> 1 -> 'd + 2 * q - else -> break + switch i <> 1 -> 'd + 2 * q + -> break ] print ["2 ^" q "- 1 = 0 ( mod" d ")"] ] diff --git a/Task/Factors-of-a-Mersenne-number/Crystal/factors-of-a-mersenne-number.crystal b/Task/Factors-of-a-Mersenne-number/Crystal/factors-of-a-mersenne-number.cr similarity index 100% rename from Task/Factors-of-a-Mersenne-number/Crystal/factors-of-a-mersenne-number.crystal rename to Task/Factors-of-a-Mersenne-number/Crystal/factors-of-a-mersenne-number.cr diff --git a/Task/Factors-of-a-Mersenne-number/EasyLang/factors-of-a-mersenne-number.easy b/Task/Factors-of-a-Mersenne-number/EasyLang/factors-of-a-mersenne-number.easy new file mode 100644 index 0000000000..60690b52c1 --- /dev/null +++ b/Task/Factors-of-a-Mersenne-number/EasyLang/factors-of-a-mersenne-number.easy @@ -0,0 +1,32 @@ +fastfunc isprim num . + i = 2 + while i <= sqrt num + if num mod i = 0 : return 0 + i += 1 + . + return 1 +. +func modpow p n . + square = 1 + p2 = pow 2 floor log n 2 + while p2 >= 1 + square *= square + if p >= p2 + p -= p2 + square *= 2 + . + p2 /= 2 + square = square mod n + . + return square +. +func mersenne_factor p . + repeat + k += 1 + q = 2 * k * p + 1 + m = q mod 8 + until (m = 1 or m = 7) and modpow p q = 1 and isprim q = 1 + . + return q +. +print mersenne_factor 929 diff --git a/Task/Factors-of-a-Mersenne-number/Elixir/factors-of-a-mersenne-number.elixir b/Task/Factors-of-a-Mersenne-number/Elixir/factors-of-a-mersenne-number.ex similarity index 100% rename from Task/Factors-of-a-Mersenne-number/Elixir/factors-of-a-mersenne-number.elixir rename to Task/Factors-of-a-Mersenne-number/Elixir/factors-of-a-mersenne-number.ex diff --git a/Task/Factors-of-a-Mersenne-number/FutureBasic/factors-of-a-mersenne-number.basic b/Task/Factors-of-a-Mersenne-number/FutureBasic/factors-of-a-mersenne-number.basic new file mode 100644 index 0000000000..2552a45c70 --- /dev/null +++ b/Task/Factors-of-a-Mersenne-number/FutureBasic/factors-of-a-mersenne-number.basic @@ -0,0 +1,108 @@ +// +// Factors of Mersenne number +// +// Using FutureBasic 7.0.36 +// October 2025, R.W. + +include "gmp.incl" + +_scanMax = 2000000 // max k scan set at 2 million + +// ------------------------------------------------------------ +// Exponent primality using GMP (mpz_probab_prime_p) +// Returns _true if p is (probably) prime; _false otherwise. + +local fn IsPrimeP_mpz( p as UInt32 ) as BOOL + mpz_t z + int res + if p < 2 then return _false + mpz_init( z ) + mpz_set_ui( z, p ) + // Miller–Rabin reps = 18 is sufficient + // res 0 = composite, 1 = probable, 2 = definite + res = fn mpz_probab_prime_p( z, 18 ) + mpz_clear( z ) + if res == 0 then return _false + // res 1 or 2 → treat as prime for gating +end fn = _True + +// ------------------------------------------------------------ +// Find first prime factor q of M_p = 2^p - 1 +// Scans q = 2 * k * p + 1 for k = 1..maxK. Returns 0 if none found. +// Precondition: caller ensures p is (probably) prime and p ≥ 2. +// +local fn FindMersenneFactor( p as UInt32, maxK as UInt64 ) as UInt64 + mpz_t qz, rz + UInt64 k, qCandidate + int isPrime + // Eliminate the obvious + if p < 2 then return 0 + if p == 2 then return 0 // M2 = 3 is prime + + mpz_init( qz ) + mpz_init( rz ) + k = 1 + while k <= maxK + // q = 2 * k * p + 1 (candidates with q ≡ 1 (mod 2p)) + qCandidate = (UInt64)2 * (UInt64)p * k + 1ULL + // primality screen for q + mpz_set_ui( qz, qCandidate ) + // Miller–Rabin reps = 18 is sufficient + isPrime = fn mpz_probab_prime_p( qz, 18 ) + if isPrime > 0 + // Test 2^p ≡ 1 (mod q) + mpz_set_ui( rz, 2 ) + mpz_powm_ui( rz, rz, p, qz ) + if fn mpz_cmp_ui( rz, 1 ) == 0 + mpz_clear( rz ) + mpz_clear( qz ) + return qCandidate + end if + end if + k = k + 1 + wend + mpz_clear( rz ) + mpz_clear( qz ) +end fn = 0 + +// ------------------------------------------------------------ +// M_p gating/message +// +local fn ReportMersenne( p as UInt32, maxK as UInt64 ) + UInt64 q + // Gate on exponent primality first + if fn IsPrimeP_mpz( p ) == _false + print @"M"; p; @" = 2^"; p; @" - 1 exponent is not prime" + exit fn + end if + // p is (probably) prime: try to find a factor of M_p + q = fn FindMersenneFactor( p, maxK ) + if q == 0 + // No factor found in scan range → either prime or factor > search bound + print @"M"; p; @" = 2^"; p; @" - 1 is prime (no factor found in range)" + else + print @"M"; p; @" = 2^"; p; @" - 1 is composite with factor "; q + end if +end fn + + +// Main + +window 1 + +UInt32 p +p = 929 // Rosetta Task requirement + +// start the clock +CFTimeInterval t +t = fn CACurrentMediaTime + +// note, if you need a range, just do a loop +// like: +// for p = 900 to 930 +fn ReportMersenne( p, _scanMax ) // 2 million k scans +// next p + +printf @"\nElapsed time: %.3f ms", (fn CACurrentMediaTime-t)*1000 + +HandleEvents diff --git a/Task/Factors-of-a-Mersenne-number/Jq/factors-of-a-mersenne-number.jq b/Task/Factors-of-a-Mersenne-number/Jq/factors-of-a-mersenne-number.jq new file mode 100644 index 0000000000..2846586599 --- /dev/null +++ b/Task/Factors-of-a-Mersenne-number/Jq/factors-of-a-mersenne-number.jq @@ -0,0 +1,61 @@ +# Generic filters: + +# Integer division (for gojq and jaq) +# If $j is 0, then an error condition is raised; +# otherwise, assuming infinite-precision integer arithmetic, +# if the input and $j are integers, then the result will be an integer. +def idivide($j): + (. % $j) as $mod + | (. - $mod) / $j | round; + +# Convert the input integer to a stream of 0s and 1s, least significant bit first +def bitwise: + recurse( if . >= 2 then idivide(2) else empty end) | . % 2; + +def is_prime: + . as $n + | if ($n < 2) then false + elif ($n % 2 == 0) then $n == 2 + elif ($n % 3 == 0) then $n == 3 + elif ($n % 5 == 0) then $n == 5 + elif ($n % 7 == 0) then $n == 7 + elif ($n % 11 == 0) then $n == 11 + elif ($n % 13 == 0) then $n == 13 + elif ($n % 17 == 0) then $n == 17 + elif ($n % 19 == 0) then $n == 19 + else sqrt as $s + | 23 + | until( . > $s or ($n % . == 0); . + 2) + | . > $s + end; + +### Factors of Mersene numbers + +def trialFactor($base; $exp; $mod): + [$exp | bitwise] as $bits + | ($bits|length) as $length + | reduce range( 0; $length) as $i (1; + (. * . * (if $bits[$length-$i-1] == 1 then $base else 1 end)) % $mod ) + | . == 1 ; + +def mersenneFactor($p): + ((pow(2;$p) - 1) | sqrt | floor) as $limit + | {k: 1} + | until ((2*.k*$p - 1) >= $limit or .emit; + (2*.k*$p + 1 ) as $q + | if ($q%8 == 1 or $q%8 == 7) and trialFactor(2; $p; $q) and ($q | is_prime) + then .emit = $q # q is a factor of 2^p - 1 + else .k += 1 + end) + | if .emit then .emit else null end; + +### Examples: + +def m: [3, 5, 11, 17, 23, 29, 31, 37, 41, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97, 929]; + +m[] +| mersenneFactor(.) as $f +| "2^\(.) - 1 is " + + if $f then "composite (factor \($f))" + else "prime" + end diff --git a/Task/Factors-of-a-Mersenne-number/Julia/factors-of-a-mersenne-number.julia b/Task/Factors-of-a-Mersenne-number/Julia/factors-of-a-mersenne-number.jl similarity index 100% rename from Task/Factors-of-a-Mersenne-number/Julia/factors-of-a-mersenne-number.julia rename to Task/Factors-of-a-Mersenne-number/Julia/factors-of-a-mersenne-number.jl diff --git a/Task/Factors-of-a-Mersenne-number/Kotlin/factors-of-a-mersenne-number.kotlin b/Task/Factors-of-a-Mersenne-number/Kotlin/factors-of-a-mersenne-number.kts similarity index 100% rename from Task/Factors-of-a-Mersenne-number/Kotlin/factors-of-a-mersenne-number.kotlin rename to Task/Factors-of-a-Mersenne-number/Kotlin/factors-of-a-mersenne-number.kts diff --git a/Task/Factors-of-a-Mersenne-number/M2000-Interpreter/factors-of-a-mersenne-number.m2000 b/Task/Factors-of-a-Mersenne-number/M2000-Interpreter/factors-of-a-mersenne-number.m2000 new file mode 100644 index 0000000000..9387607154 --- /dev/null +++ b/Task/Factors-of-a-Mersenne-number/M2000-Interpreter/factors-of-a-mersenne-number.m2000 @@ -0,0 +1,39 @@ +// 67 need a lot of time 45 minutes (2758716msec) where 71 need 3.1 second (3131msec) +Module Factors_of_a_Mersenne_number{ + Dim q() + // 67 need a lot of time 51 minutes (3082671msec) where 71 need 3.5 second (3505msec) + q()= (11, 23, 29, 37, 41, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97, 929) + profiler + long long j=0x8000_0000 + long long r, p, i + long d, dd + For k = 0 To len(q())-1 + If @isPrime(q(k)) Then + r=q(k):dd =2*r:d=dd+1 + while rd Then i-=d + Until p=0:If i=1 Then Exit Else d+=dd:i=1:p=r + Always + Print "2^"; q(k); @(6); " - 1 = 0 (mod "; d; ")" + Else + Print q(k); " is not prime" + End If + Print ceil(timecount):profiler + Next + + Function isPrime(n As long) + If n Mod 2 = 0 Then = n=2 : Exit Function + If n Mod 3 = 0 Then = n=3 : Exit Function + Local d As long = 5 + While d * d <= n + If n Mod d = 0 Then =False: exit function + d += 2 + If n Mod d = 0 Then = False: exit function + d += 4 + End While + =True + End Function +} +Factors_of_a_Mersenne_number diff --git a/Task/Factors-of-a-Mersenne-number/PARI-GP/factors-of-a-mersenne-number-2.parigp b/Task/Factors-of-a-Mersenne-number/PARI-GP/factors-of-a-mersenne-number-2.parigp deleted file mode 100644 index a43166ed17..0000000000 --- a/Task/Factors-of-a-Mersenne-number/PARI-GP/factors-of-a-mersenne-number-2.parigp +++ /dev/null @@ -1,20 +0,0 @@ -TM(p) = local(status=1, i=1, len=0, S=0);{ -printp("Test TM \t..."); -S=2*p+1; -len = length(binary(p)); -B = Vecsmall(binary(p)); -q = B[i]*B[i]; -while( i<=len & status ==1, - if( B[i] != 0, - q = q*2; - ); - r = q%S; - q = r*r; - if( i == len & r == 1, - status = 0; - printp("Not Prime!"); - ); - i++; -); -return(status); -} diff --git a/Task/Factors-of-a-Mersenne-number/PARI-GP/factors-of-a-mersenne-number-1.parigp b/Task/Factors-of-a-Mersenne-number/PARI-GP/factors-of-a-mersenne-number.parigp similarity index 100% rename from Task/Factors-of-a-Mersenne-number/PARI-GP/factors-of-a-mersenne-number-1.parigp rename to Task/Factors-of-a-Mersenne-number/PARI-GP/factors-of-a-mersenne-number.parigp diff --git a/Task/Factors-of-a-Mersenne-number/PascalABC.NET/factors-of-a-mersenne-number.pas b/Task/Factors-of-a-Mersenne-number/PascalABC.NET/factors-of-a-mersenne-number.pas new file mode 100644 index 0000000000..32d45238dc --- /dev/null +++ b/Task/Factors-of-a-Mersenne-number/PascalABC.NET/factors-of-a-mersenne-number.pas @@ -0,0 +1,36 @@ +const + q = 929; + +function isPrime(a: integer): boolean; +begin + if a = 2 then + begin result := true; exit end; + if (a < 2) or (a mod 2 = 0) then + begin result := false; exit end; + for var i := 3 to sqrt(a).Floor step 2 do + if a mod i = 0 then + begin result := false; exit end; + result := true; +end; + +begin + if not isPrime(q) then exit; + var r := q; + while r > 0 do r := r shl 1; + var d := 2 * q + 1; + while true do + begin + var i := 1; + var p := r; + while p <> 0 do + begin + i := (i * i) mod d; + if p < 0 then i *= 2; + if i > d then i -= d; + p := p shl 1; + end; + if i <> 1 then d += 2 * q + else break + end; + write('2^', q, ' - 1 = 0 (mod ', d, ')'); +end. diff --git a/Task/Factors-of-a-Mersenne-number/Phix/factors-of-a-mersenne-number.phix b/Task/Factors-of-a-Mersenne-number/Phix/factors-of-a-mersenne-number.phix index 641c6a8d2f..8185372101 100644 --- a/Task/Factors-of-a-Mersenne-number/Phix/factors-of-a-mersenne-number.phix +++ b/Task/Factors-of-a-Mersenne-number/Phix/factors-of-a-mersenne-number.phix @@ -1,39 +1,40 @@ -(phixonline)--> - with javascript_semantics - function modpow(atom x, atom n, atom m) - atom i = n, - y = 1, - z = x - while i do - if and_bits(i,1) then - y = mod(y*z,m) - end if - z = mod(z*z,m) - i = floor(i/2) - end while - return y - end function +with javascript_semantics +function modpow(atom x, n, m) + atom {i,y,z} = {n,1,x} + while i do + if odd(i) then + y = mod(y*z,m) + end if + z = mod(z*z,m) + i = floor(i/2) + end while + return y +end function - function mersenne_factor(integer p) - if not is_prime(p) then return -1 end if - atom limit = sqrt(power(2,p))-1 - integer k = 1 - while 1 do - atom q = 2*p*k + 1 - if q>=limit then exit end if - if find(mod(q,8),{1,7}) - and is_prime(q) - and modpow(2,p,q)=1 then - return q - end if - k += 1 - end while - return 0 - end function +function mersenne_factor(integer p) + if not is_prime(p) then return -1 end if + atom limit = sqrt(power(2,p))-1 + integer k = 1 + while 1 do + atom q = 2*p*k + 1 + if q>=limit then exit end if + if find(mod(q,8),{1,7}) + and is_prime(q,true) + and modpow(2,p,q)=1 then + return q + end if + k += 1 + end while + return 0 +end function - sequence tests = {11, 23, 29, 37, 41, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97, 929, 937} - for i=1 to length(tests) do - integer ti = tests[i] - printf(1,"A factor of M%d is %d\n",{ti,mersenne_factor(ti)}) - end for - - function fairshare(integer n, base) - sequence res = repeat(0,n) - for i=1 to n do - integer j = i-1, - t = 0 - while j>0 do - t += remainder(j,base) - j = floor(j/base) - end while - res[i] = remainder(t,base) - end for - return {base,res} - end function +with javascript_semantics +function fairshare(integer n, base) + sequence res = repeat(0,n) + for i=1 to n do + integer j = i-1, t = 0 + while j>0 do + t += rmdr(j,base) + j = floor(j/base) + end while + res[i] = rmdr(t,base) + end for + return {base,res} +end function - constant tests = {2,3,5,11} - for i=1 to length(tests) do - printf(1,"%2d : %v\n", fairshare(25, tests[i])) - end for - - with javascript_semantics - -- demo\rosetta\Fermat.exw - include mpfr.e +-- demo\rosetta\Fermat.exw +with javascript_semantics +include mpfr.e - procedure fermat(mpz res, integer n) - integer pn = power(2,n) - mpz_ui_pow_ui(res,2,pn) - mpz_add_si(res,res,1) - end procedure +procedure fermat(mpz res, integer n) + integer pn = power(2,n) + mpz_ui_pow_ui(res,2,pn) + mpz_add_si(res,res,1) +end procedure - mpz fn = mpz_init() - constant lim = iff(platform()=JS?18:29), -- (see note) - print_lim = iff(platform()=JS?16:20) - for i=0 to lim do - fermat(fn,i) - if i<=print_lim then - printf(1,"F%d = %s\n",{i,shorten(mpz_get_str(fn))}) - else -- (since printing it takes too long...) - printf(1,"F%d has %,d digits\n",{i,mpz_sizeinbase(fn,10)}) - end if - end for +mpz fn = mpz_init() +constant lim = iff(platform()=JS?18:29), -- (see note) + print_lim = iff(platform()=JS?16:20) +atom t +for i=0 to lim do + t = time() + fermat(fn,i) + string ts = elapsed(t,0.2," [%s]") + if i<=print_lim then + printf(1,"F%d = %s%s\n",{i,shorten(mpz_get_str(fn)),ts}) + else -- (since printing it takes too long...) + printf(1,"F%d has %,d digits%s\n",{i,mpz_sizeinbase(fn,10),ts}) + end if +end for - printf(1,"\n") - constant flimit = iff(platform()=JS?11:13) - for i=0 to flimit do - atom t = time() - fermat(fn,i) - sequence f = mpz_prime_factors(fn, 200000) - t = time()-t - string fs = "", - ts = elapsed(t) - if length(f[$])=1 then -- (as per docs) - mpz_set_str(fn,f[$][1]) - if not mpz_prime(fn) then - if length(f)=1 then - fs = " (not prime)" - else - fs = " (last factor is not prime)" - end if - end if - f = deep_copy(f) - f[$][1] = shorten(f[$][1]) - elsif length(f)=1 - and mpz_prime(fn) then - fs = " (prime)" - end if - fs = mpz_factorstring(f)&fs - printf(1,"Factors of F%d: %s [%s]\n",{i,fs,ts}) - end for - - with javascript_semantics - function nacci_noo(integer n, s, l) - if n<2 then return n+n*l end if - if n=2 then return 1 end if - atom res = nacci_noo(n-1,s,l) - for i=2 to min(s,n-1) do - res += nacci_noo(n-i,s,l) - end for - return res - end function +with javascript_semantics +function nacci_noo(integer n, s, l) + if n<2 then return n+n*l end if + if n=2 then return 1 end if + atom res = nacci_noo(n-1,s,l) + for i=2 to min(s,n-1) do + res += nacci_noo(n-i,s,l) + end for + return res +end function - constant names = split("lucas fibo tribo tetra penta hexa hepta octo nona deca") - sequence f = repeat(0,10) - for i=1 to 4 do - for j=1 to 10 do - f[j] = nacci_noo(j,i+(i=1),i=1) - end for - printf(1,"%snacci: %v\n",{names[i],f}) - end for - - with javascript_semantics - constant extensions = lower({"zip","rar","7z","gz","archive","A##","tar.bz2"}) +with javascript_semantics +constant extensions = lower({"zip","rar","7z","gz","archive","A##","tar.bz2"}) - global function get_known_extension(string filename) - for i=1 to length(filename) do - if filename[i]='.' then - string extension = lower(filename[i+1..$]) - if find(extension,extensions) then - return extension - end if - end if - end for - return "" - end function +global function get_known_extension(string filename) + for i,c in filename do + if c='.' then + string extension = lower(filename[i+1..$]) + if find(extension,extensions) then + return extension + end if + end if + end for + return "" +end function - constant tests = {"MyData.a##", - "MyData.tar.Gz", - "MyData.gzip", - "MyData.7z.backup", - "MyData...", - "MyData", - "MyData_v1.0.tar.bz2", - "MyData_v1.0.bz2"} +constant tests = {"MyData.a##", + "MyData.tar.Gz", + "MyData.gzip", + "MyData.7z.backup", + "MyData...", + "MyData", + "MyData_v1.0.tar.bz2", + "MyData_v1.0.bz2"} - for i=1 to length(tests) do - string ti = tests[i], - ext = get_known_extension(ti) - printf(1,"%-20s %-10s %s\n",{ti,ext,{"true","false"}[2-(find(ext,extensions)!=0)]}) - end for - - with javascript_semantics - constant p0 = {0,0}, - p1 = {0,1}, - p2 = {3,1}, - triangle = {{3/2, 12/5}, {51/10, -31/10}, {-19/5, 1/2}} - function inside(sequence p) - return sort(convex_hull({p}&triangle))==sort(deep_copy(triangle)) - end function - printf(1,"Point %v is with triangle %v?:%t\n",{p0,triangle,inside(p0)}) - printf(1,"Point %v is with triangle %v?:%t\n",{p1,triangle,inside(p1)}) - printf(1,"Point %v is with triangle %v?:%t\n",{p2,triangle,inside(p2)}) - - with javascript_semantics - constant p0 = {0,0}, - p1 = {0,1}, - p2 = {3,1}, - triangle = {{3/2, 12/5}, {51/10, -31/10}, {-19/5, 1/2}} +with javascript_semantics +constant p0 = {0,0}, + p1 = {0,1}, + p2 = {3,1}, + triangle = {{3/2, 12/5}, {51/10, -31/10}, {-19/5, 1/2}} - function side(sequence p1, p2, p3) - -- which side of plane cut by line (p2, p3) is p1 on? - atom {x1, y1} = p1, - {x2, y2} = p2, - {x3, y3} = p3 - return (x1 - x3) * (y2 - y3) - (x2 - x3) * (y1 - y3) - end function +function side(sequence p1, p2, p3) + -- which side of plane cut by line (p2, p3) is p1 on? + atom {x1, y1} = p1, + {x2, y2} = p2, + {x3, y3} = p3 + return (x1 - x3) * (y2 - y3) - (x2 - x3) * (y1 - y3) +end function - function iswithin(sequence point, triangle) - -- - -- Determine if point is within triangle. - -- If so, the point will be on the same side of each of the half planes - -- defined by vectors p1p2, p2p3, and p3p1. side is positive if outside, - -- negative if inside such a plane. All should be non-negative or all - -- non-positive if the point is within the triangle. - -- - sequence {pt1, pt2, pt3} = triangle - atom side12 = side(point, pt1, pt2), - side23 = side(point, pt2, pt3), - side31 = side(point, pt3, pt1) - bool all_non_neg = side12 >= 0 and side23 >= 0 and side31 >= 0, - all_non_pos = side12 <= 0 and side23 <= 0 and side31 <= 0 - return all_non_neg or all_non_pos - end function +function iswithin(sequence point, triangle) +-- +-- Determine if point is within triangle. +-- If so, the point will be on the same side of each of the half planes +-- defined by vectors p1p2, p2p3, and p3p1. side is positive if outside, +-- negative if inside such a plane. All should be non-negative or all +-- non-positive if the point is within the triangle. +-- + sequence {pt1, pt2, pt3} = triangle + atom side12 = side(point, pt1, pt2), + side23 = side(point, pt2, pt3), + side31 = side(point, pt3, pt1) + bool all_non_neg = side12 >= 0 and side23 >= 0 and side31 >= 0, + all_non_pos = side12 <= 0 and side23 <= 0 and side31 <= 0 + return all_non_neg or all_non_pos +end function - printf(1,"point %v is with triangle %v?:%t\n",{p0,triangle,iswithin(p0,triangle)}) - printf(1,"point %v is with triangle %v?:%t\n",{p1,triangle,iswithin(p1,triangle)}) - printf(1,"point %v is with triangle %v?:%t\n",{p2,triangle,iswithin(p2,triangle)}) - - atom t1 = time()+1 +with javascript_semantics +atom t1 = time()+1 - integer depth = 0 +integer depth = 0 - procedure recurse() - if time()>t1 then - ?depth - t1 = time()+1 - end if - depth += 1 - -- only 1 of these will ever get called, of course... - recurse() - recurse() - recurse() - end procedure +procedure recurse() + if time()>t1 then + ?depth + t1 = time()+1 + end if + depth += 1 + -- only 1 of these will ever get called, of course... + recurse() + recurse() + recurse() +end procedure - recurse() - - atom t1 = time()+1 +with javascript_semantics +atom t1 = time()+1 - integer depth = 0, depth_blown = false - string btd = "building" +integer depth = 0, depth_blown = false, + limit = iff(platform()=JS?8e3:2e7) +string btd = "building" - procedure recurse() - if time()>t1 then - printf(1,"depth: %d (%s)\n",{depth,btd}) - if depth>20_000_000 then - depth_blown = true - btd = "tearing down" - end if - t1 = time()+1 - end if - if depth_blown then - depth -= 1 - else - depth += 1 - recurse() -- (build, aka +1 with progress) - recurse() -- (tear down, -1 with progress) - end if - end procedure +procedure recurse() + if time()>t1 or depth>limit then + printf(1,"depth: %d (%s)\n",{depth,btd}) + if depth>limit then + depth_blown = true + btd = "tearing down" + end if + t1 = time()+1 + end if + if depth_blown then + depth -= 1 + else + depth += 1 + recurse() -- (build, aka +1 with progress) + recurse() -- (tear down, -1 with progress) + end if +end procedure - recurse() - - include timedate.e - - constant SUNDAY=7 - - procedure showlast(integer dow, integer doy, timedate td) - td = adjust_timedate(td,timedelta(days:=doy-1)) - integer {year,month,day} = td - while day_of_week(year,month,day)!=dow do day-=1 end while - printf(1,"%4d-%02d-%02d\n",{year,month,day}) - end procedure - - procedure last_day_of_month(integer year, integer dow) - integer doy - timedate first = {year,1,1,0,0,0,0,0} - -- start by finding the 1st of the next month, less 1 - for i=1 to 11 do - doy = day_of_year(year,i+1,1)-1 - showlast(dow,doy,first) - end for - -- do December separately, as 1st would be next year - doy = day_of_year(year,12,31) - showlast(dow,doy,first) - end procedure - last_day_of_month(2013,SUNDAY) - - with javascript_semantics - sequence mtable = {} +with javascript_semantics +sequence mtable = {} - function multiplier(atom n1, atom n2) - mtable = append(mtable,{n1,n2}) - return length(mtable) - end function +function multiplier(atom n1, atom n2) + mtable = append(mtable,{n1,n2}) + return length(mtable) +end function - function call_multiplier(integer f, atom m) - atom {n1,n2} = mtable[f] - return n1*n2*m - end function +function call_multiplier(integer f, atom m) + atom {n1,n2} = mtable[f] + return n1*n2*m +end function - constant x = 2, - xi = 0.5, - y = 4, - yi = 0.25, - z = x + y, - zi = 1 / ( x + y ) +constant x = 2, + xi = 0.5, + y = 4, + yi = 0.25, + z = x + y, + zi = 1 / ( x + y ) - ?call_multiplier(multiplier(x,xi),0.5) - ?call_multiplier(multiplier(y,yi),0.5) - ?call_multiplier(multiplier(z,zi),0.5) - - with javascript_semantics - sequence ctable = {} +with javascript_semantics +sequence ctable = {} - function compose(integer f, g) - ctable = append(ctable,{f,g}) - integer cdx = length(ctable) - return cdx - end function +function compose(integer f, g) + ctable = append(ctable,{f,g}) + integer cdx = length(ctable) + return cdx +end function - function call_composite(integer cdx, atom x) - integer {f,g} = ctable[cdx] - return f(g(x)) - end function +function call_composite(integer cdx, atom x) + integer {f,g} = ctable[cdx] + return f(g(x)) +end function - function plus1(atom x) - return x+1 - end function +function plus1(atom x) + return x+1 +end function - function halve(atom x) - return x/2 - end function +function halve(atom x) + return x/2 +end function - constant m = compose(halve,plus1) +constant m = compose(halve,plus1) - ?call_composite(m,1) -- displays 1 - ?call_composite(m,4) -- displays 2.5 - n/d ) + [ 1 2 ] is xi ( --> n/d ) + [ 4 1 ] is y ( --> n/d ) + [ 1 4 ] is yi ( --> n/d ) + [ x y v+ ] is z ( n/d n/d --> n/d ) + [ x y v+ 1/v ] is zi ( n/d n/d --> n/d ) + + [ ' [ v* v* ] join join ] is multiplier ( x n/d --> [ ) + +' xi ' [ 1 2 ] multiplier dup echo x rot do say " applied to x gives: " vulgar$ echo$ cr +' yi ' [ 1 2 ] multiplier dup echo y rot do say " applied to y gives: " vulgar$ echo$ cr +' zi ' [ 1 2 ] multiplier dup echo z rot do say " applied to z gives: " vulgar$ echo$ cr diff --git a/Task/First-class-functions-Use-numbers-analogously/Rebol/first-class-functions-use-numbers-analogously.rebol b/Task/First-class-functions-Use-numbers-analogously/Rebol/first-class-functions-use-numbers-analogously.rebol new file mode 100644 index 0000000000..717692aabd --- /dev/null +++ b/Task/First-class-functions-Use-numbers-analogously/Rebol/first-class-functions-use-numbers-analogously.rebol @@ -0,0 +1,30 @@ +Rebol [ + title: "Rosetta code: First-class functions/Use numbers analogously" + file: %First-class_functions-Use_numbers_analogously.r3 + url: https://rosettacode.org/wiki/First-class_functions/Use_numbers_analogously +] + +;; Numeric values and their inverses +x: 2.0 xi: 0.5 +y: 4.0 yi: 0.25 +z: x + y zi: 1 / (x + y) + +;; Returns a function that multiplies its argument a by n and m, +;; printing the expression before returning the result. +;; closure (vs func) ensures n and m are captured by value in the returned func. +multiplier: closure [n m] [ + func [a] [ + prin [a "*" n "*" m "= "] + a * n * m + ] +] +;; Parallel lists: each number paired with its inverse by position +num-list: reduce [x y z] ; [2.0 4.0 6.0] +num-list-inv: reduce [xi yi zi] ; [0.5 0.25 0.1666...] + +repeat key length? num-list [ + n: num-list/:key + ni: num-list-inv/:key + fun: multiplier ni n ;; build closure: a * ni * n = a * 1.0 (always) + print as-green fun 0.5 ;; call closure with 0.5; result should always be 0.5 +] diff --git a/Task/First-class-functions-Use-numbers-analogously/Rust/first-class-functions-use-numbers-analogously.rust b/Task/First-class-functions-Use-numbers-analogously/Rust/first-class-functions-use-numbers-analogously.rs similarity index 100% rename from Task/First-class-functions-Use-numbers-analogously/Rust/first-class-functions-use-numbers-analogously.rust rename to Task/First-class-functions-Use-numbers-analogously/Rust/first-class-functions-use-numbers-analogously.rs diff --git a/Task/First-class-functions-Use-numbers-analogously/Scheme/first-class-functions-use-numbers-analogously.ss b/Task/First-class-functions-Use-numbers-analogously/Scheme/first-class-functions-use-numbers-analogously.scm similarity index 100% rename from Task/First-class-functions-Use-numbers-analogously/Scheme/first-class-functions-use-numbers-analogously.ss rename to Task/First-class-functions-Use-numbers-analogously/Scheme/first-class-functions-use-numbers-analogously.scm diff --git a/Task/First-class-functions-Use-numbers-analogously/Wren/first-class-functions-use-numbers-analogously.wren b/Task/First-class-functions-Use-numbers-analogously/Wren/first-class-functions-use-numbers-analogously.wren index 50a2cf4730..d8b6d872a3 100644 --- a/Task/First-class-functions-Use-numbers-analogously/Wren/first-class-functions-use-numbers-analogously.wren +++ b/Task/First-class-functions-Use-numbers-analogously/Wren/first-class-functions-use-numbers-analogously.wren @@ -1,4 +1,4 @@ -import "/fmt" for Fmt +import "./fmt" for Fmt var multiplier = Fn.new { |n1, n2| Fn.new { |m| n1 * n2 * m } } diff --git a/Task/First-class-functions/Ada/first-class-functions.ada b/Task/First-class-functions/Ada/first-class-functions.adb similarity index 100% rename from Task/First-class-functions/Ada/first-class-functions.ada rename to Task/First-class-functions/Ada/first-class-functions.adb diff --git a/Task/First-class-functions/Crystal/first-class-functions-1.cr b/Task/First-class-functions/Crystal/first-class-functions-1.cr new file mode 100644 index 0000000000..7d6593bb69 --- /dev/null +++ b/Task/First-class-functions/Crystal/first-class-functions-1.cr @@ -0,0 +1 @@ +->Math.sin(Float64) diff --git a/Task/First-class-functions/Crystal/first-class-functions-2.cr b/Task/First-class-functions/Crystal/first-class-functions-2.cr new file mode 100644 index 0000000000..3b82e7a930 --- /dev/null +++ b/Task/First-class-functions/Crystal/first-class-functions-2.cr @@ -0,0 +1 @@ +->(n : Float64) { Math.sin(n) } diff --git a/Task/First-class-functions/Crystal/first-class-functions-3.cr b/Task/First-class-functions/Crystal/first-class-functions-3.cr new file mode 100644 index 0000000000..8d6dfeceb0 --- /dev/null +++ b/Task/First-class-functions/Crystal/first-class-functions-3.cr @@ -0,0 +1,20 @@ +def cube (n) + n*n*n +end + +add1 = ->(n : Float64) { n + 1 } +sub1 = ->(n : Float64) { n - 1 } + +a = [ ->Math.sin(Float64), ->Math.cos(Float64), ->cube(Float64), add1 ] +b = [ ->Math.asin(Float64), ->Math.acos(Float64), ->Math.cbrt(Float64), sub1 ] +s = [ "sin o asin", "cos o acos", "cube o cbrt", "add1 o sub1"] + +def compose (f, g) + ->(n : Float64) { f[ g[n] ] } +end + +composed = a.zip(b).map {|(f, g)| compose(f, g) } + +composed.each_with_index do |f, i| + puts "(#{s[i]})(0.5) = #{ f[0.5] }" +end diff --git a/Task/First-class-functions/Delphi/first-class-functions.delphi b/Task/First-class-functions/Delphi/first-class-functions.pas similarity index 100% rename from Task/First-class-functions/Delphi/first-class-functions.delphi rename to Task/First-class-functions/Delphi/first-class-functions.pas diff --git a/Task/First-class-functions/Elena/first-class-functions.elena b/Task/First-class-functions/Elena/first-class-functions.elena index 72cd37e51b..67f287ebe2 100644 --- a/Task/First-class-functions/Elena/first-class-functions.elena +++ b/Task/First-class-functions/Elena/first-class-functions.elena @@ -9,11 +9,11 @@ extension op = f(g(self)); } -public program() +public Program() { var fs := new object[]{ mssgconst sin[1], mssgconst cos[1], (x => power(x, 3.0r)) }; var gs := new object[]{ mssgconst arcsin[1], mssgconst arccos[1], (x => power(x, 1.0r / 3)) }; fs.zipBy(gs, (f,g => 0.5r.compose(f,g))) - .forEach:printingLn + .forEach(PrintingLn) } diff --git a/Task/First-class-functions/Elixir/first-class-functions.elixir b/Task/First-class-functions/Elixir/first-class-functions.ex similarity index 100% rename from Task/First-class-functions/Elixir/first-class-functions.elixir rename to Task/First-class-functions/Elixir/first-class-functions.ex diff --git a/Task/First-class-functions/Julia/first-class-functions.julia b/Task/First-class-functions/Julia/first-class-functions.jl similarity index 100% rename from Task/First-class-functions/Julia/first-class-functions.julia rename to Task/First-class-functions/Julia/first-class-functions.jl diff --git a/Task/First-class-functions/Kotlin/first-class-functions.kotlin b/Task/First-class-functions/Kotlin/first-class-functions.kts similarity index 100% rename from Task/First-class-functions/Kotlin/first-class-functions.kotlin rename to Task/First-class-functions/Kotlin/first-class-functions.kts diff --git a/Task/First-class-functions/Maxima/first-class-functions.maxima b/Task/First-class-functions/Maxima/first-class-functions.maxima index 0f3b0ee18b..5b2d1ff458 100644 --- a/Task/First-class-functions/Maxima/first-class-functions.maxima +++ b/Task/First-class-functions/Maxima/first-class-functions.maxima @@ -2,4 +2,3 @@ a: [sin, cos, lambda([x], x^3)]$ b: [asin, acos, lambda([x], x^(1/3))]$ compose(f, g) := buildq([f, g], lambda([x], f(g(x))))$ map(lambda([fun], fun(x)), map(compose, a, b)); -[x, x, x] diff --git a/Task/First-class-functions/OCaml/first-class-functions.ocaml b/Task/First-class-functions/OCaml/first-class-functions.ml similarity index 100% rename from Task/First-class-functions/OCaml/first-class-functions.ocaml rename to Task/First-class-functions/OCaml/first-class-functions.ml diff --git a/Task/First-class-functions/PascalABC.NET/first-class-functions.pas b/Task/First-class-functions/PascalABC.NET/first-class-functions.pas new file mode 100644 index 0000000000..091decbbb2 --- /dev/null +++ b/Task/First-class-functions/PascalABC.NET/first-class-functions.pas @@ -0,0 +1,15 @@ +function Cube(x: real) := x**3; +function CubeRoot(x: real) := x**(1/3); + +function Composition(f1,f2: T -> T): T -> T := x -> f1(f2(x)); + +begin + var A := Arr(Sin,Cos,Cube); + var B := Arr(ArcSin,ArcCos,CubeRoot); + for var i:=0 to A.Length-1 do + Println(Composition(A[i],B[i])(0.5)); + + // Build-in composition f1 * f2 + foreach var (f1,f2) in A.Zip(B) do + Println((f1 * f2)(0.5)); +end. diff --git a/Task/First-class-functions/Phix/first-class-functions.phix b/Task/First-class-functions/Phix/first-class-functions.phix index 6fe2a63ae3..b422dc259e 100644 --- a/Task/First-class-functions/Phix/first-class-functions.phix +++ b/Task/First-class-functions/Phix/first-class-functions.phix @@ -1,27 +1,25 @@ -(phixonline)--> - sequence ctable = {} +sequence ctable = {} - function compose(integer f, g) - ctable = append(ctable,{f,g}) - integer cdx = length(ctable) - return cdx - end function +function compose(integer f, g) + ctable = append(ctable,{f,g}) + integer cdx = length(ctable) + return cdx +end function - function call_composite(integer cdx, atom x) - integer {f,g} = ctable[cdx] - return f(g(x)) - end function +function call_composite(integer cdx, atom x) + integer {f,g} = ctable[cdx] + return f(g(x)) +end function - function plus1(atom x) - return x+1 - end function +function plus1(atom x) + return x+1 +end function - function halve(atom x) - return x/2 - end function +function halve(atom x) + return x/2 +end function - constant m = compose(halve,plus1) +constant m = compose(halve,plus1) - ?call_composite(m,1) -- displays 1 - ?call_composite(m,4) -- displays 2.5 - n ) + + [ base share bit 1 - + 0 rot + [ dup while + base share /mod bit + rot | swap again ] + drop = ] is pandigital ( n --> b ) + + [ base share + dup 2 - times + [ base share * + i^ 2 + + ] ] is firstpan ( --> n ) + + [ dup * ] is squared ( n --> n ) + + 11 times + [ i^ 2 + base put + firstpan sqrt from + [ index squared + pandigital if + [ index end ] ] + base share + say "Base " decimal echo + base release + say ": " dup echo + say "^" 2 echo say " = " + squared echo + cr base release ] diff --git a/Task/First-perfect-square-in-base-n-with-n-unique-digits/Uiua/first-perfect-square-in-base-n-with-n-unique-digits.uiua b/Task/First-perfect-square-in-base-n-with-n-unique-digits/Uiua/first-perfect-square-in-base-n-with-n-unique-digits.uiua new file mode 100644 index 0000000000..e8e61cfe08 --- /dev/null +++ b/Task/First-perfect-square-in-base-n-with-n-unique-digits/Uiua/first-perfect-square-in-base-n-with-n-unique-digits.uiua @@ -0,0 +1,11 @@ +IsPan ← =⧻◴ # IsPan 3 [0 1 2] -> true +# Smallest pan number for given base +# will always be = [1 0 2 3 4...] in base n +MinPanBase ← ⌝⊥⊙⇌ ⟜(˜↙⊂1_0↘2⇡⊸+1) +# Take sqrt of the smallest pan number and inc until found. +MinPanSqrBase ← ⊙◌⍢(+1|¬IsPan ⇌⊥⊃⋅∘⊙∘˙×) ⌊√⊸MinPanBase +ShowMinPan ← ( + ⊃(⊙∘|⋅˙×|⇌⊥ ⊙˙×) ⟜MinPanSqrBase + &p $"Base _\t_\t_\t_\t" +) +⍜now (≡ShowMinPan ↘2⇡13) diff --git a/Task/First-perfect-square-in-base-n-with-n-unique-digits/Wren/first-perfect-square-in-base-n-with-n-unique-digits.wren b/Task/First-perfect-square-in-base-n-with-n-unique-digits/Wren/first-perfect-square-in-base-n-with-n-unique-digits.wren index 02c6759dd3..56a0a58e8d 100644 --- a/Task/First-perfect-square-in-base-n-with-n-unique-digits/Wren/first-perfect-square-in-base-n-with-n-unique-digits.wren +++ b/Task/First-perfect-square-in-base-n-with-n-unique-digits/Wren/first-perfect-square-in-base-n-with-n-unique-digits.wren @@ -1,6 +1,6 @@ -import "/big" for BigInt -import "/math" for Nums -import "/fmt" for Conv, Fmt +import "./big" for BigInt +import "./math" for Nums +import "./fmt" for Conv, Fmt var maxBase = 21 var minSq36 = "1023456789abcdefghijklmnopqrstuvwxyz" diff --git a/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/EasyLang/first-power-of-2-that-has-leading-decimal-digits-of-12.easy b/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/EasyLang/first-power-of-2-that-has-leading-decimal-digits-of-12.easy new file mode 100644 index 0000000000..246a21bb05 --- /dev/null +++ b/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/EasyLang/first-power-of-2-that-has-leading-decimal-digits-of-12.easy @@ -0,0 +1,23 @@ +fastfunc p l n . + log10_2 = log 2 10 + factor = 1 + loop = l + while loop > 10 + factor *= 10 + loop = loop div 10 + . + while n > 0 + test += 1 + val = floor (factor * pow 10 (test * log10_2 mod 1)) + if val = l : n -= 1 + . + return test +. +proc test l n . + print "p(" & l & ", " & n & ") = " & p l n +. +test 12 1 +test 12 2 +test 123 45 +test 123 12345 +test 123 678910 diff --git a/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Julia/first-power-of-2-that-has-leading-decimal-digits-of-12-1.julia b/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Julia/first-power-of-2-that-has-leading-decimal-digits-of-12-1.jl similarity index 100% rename from Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Julia/first-power-of-2-that-has-leading-decimal-digits-of-12-1.julia rename to Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Julia/first-power-of-2-that-has-leading-decimal-digits-of-12-1.jl diff --git a/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Julia/first-power-of-2-that-has-leading-decimal-digits-of-12-2.julia b/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Julia/first-power-of-2-that-has-leading-decimal-digits-of-12-2.jl similarity index 100% rename from Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Julia/first-power-of-2-that-has-leading-decimal-digits-of-12-2.julia rename to Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Julia/first-power-of-2-that-has-leading-decimal-digits-of-12-2.jl diff --git a/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Kotlin/first-power-of-2-that-has-leading-decimal-digits-of-12.kotlin b/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Kotlin/first-power-of-2-that-has-leading-decimal-digits-of-12.kts similarity index 100% rename from Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Kotlin/first-power-of-2-that-has-leading-decimal-digits-of-12.kotlin rename to Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Kotlin/first-power-of-2-that-has-leading-decimal-digits-of-12.kts diff --git a/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/PascalABC.NET/first-power-of-2-that-has-leading-decimal-digits-of-12.pas b/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/PascalABC.NET/first-power-of-2-that-has-leading-decimal-digits-of-12.pas new file mode 100644 index 0000000000..1c4d47c140 --- /dev/null +++ b/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/PascalABC.NET/first-power-of-2-that-has-leading-decimal-digits-of-12.pas @@ -0,0 +1,24 @@ +function p(L,n: integer): integer; +begin + var logof2 := log10(2); + var places := trunc(log10(L)); + var nfound := 0; + var i := 1; + while True do + begin + var a := i * logof2; + var b := trunc(power(10,a-trunc(a)+places)); + if L = b then + begin + nfound += 1; + if nfound = n then break + end; + i += 1; + end; + Result := i; +end; + +begin + foreach var (L,n) in Arr((12, 1), (12, 2), (123, 45), (123, 12345), (123, 678910)) do + Println($'p({n},{L}) = {p(n, L)}') +end. diff --git a/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Phix/first-power-of-2-that-has-leading-decimal-digits-of-12.phix b/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Phix/first-power-of-2-that-has-leading-decimal-digits-of-12.phix index 9d17028cd1..5c6d63b988 100644 --- a/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Phix/first-power-of-2-that-has-leading-decimal-digits-of-12.phix +++ b/Task/First-power-of-2-that-has-leading-decimal-digits-of-12/Phix/first-power-of-2-that-has-leading-decimal-digits-of-12.phix @@ -1,33 +1,31 @@ -(phixonline)--> - with javascript_semantics - function p(integer L, n) - atom logof2 = log10(2) - integer places = trunc(log10(L)), - nfound = 0, i = 1 - while true do - atom a = i * logof2, - b = trunc(power(10,a-trunc(a)+places)) - if L == b then - nfound += 1 - if nfound == n then exit end if - end if - i += 1 - end while - return i - end function +with javascript_semantics +function p(integer L, n) + atom logof2 = log10(2) + integer places = trunc(log10(L)), + nfound = 0, i = 1 + while true do + atom a = i * logof2, + b = trunc(power(10,a-trunc(a)+places)) + if L == b then + nfound += 1 + if nfound == n then exit end if + end if + i += 1 + end while + return i +end function - constant tests = {{12, 1}, {12, 2}, {123, 45}, {123, 12345}, {123, 678910}} - include ordinal.e - include mpfr.e - mpz z = mpz_init() - atom t0 = time() - for i=1 to length(tests)-(2*(platform()=JS)) do - integer {L,n} = tests[i], pln = p(L,n) - mpz_ui_pow_ui(z,2,pln) - integer digits = mpz_sizeinbase(z,10) - string st = iff(digits>2e6?sprintf("%,d digits",digits): - shorten(mpz_get_str(z),"digits",5)) - printf(1,"The %d%s power of 2 that starts with %d is %d [i.e. %s]\n",{n,ord(n),L,pln,st}) - end for - ?elapsed(time()-t0) - - with javascript_semantics - sequence m31 = {"January",0,"March",0,"May",0,"July","August",0,"October",0,"December"} - integer y,m, - nmonths = 0 - string months - sequence res = {}, - none = {} +with javascript_semantics +sequence m31 = {"January",0,"March",0,"May",0,"July","August",0,"October",0,"December"} +integer y,m, + nmonths = 0 +string months +sequence res = {}, + none = {} - for y=1900 to 2100 do - months = "" - for m=1 to 12 do - if string(m31[m]) - and day_of_week(y,m,1,true)="Friday" then - if length(months)!=0 then months &= ", " end if - months &= m31[m] - nmonths += 1 - end if - end for - if length(months)=0 then - none = append(none,y) - else - res = append(res,sprintf("%d : %s\n",{y,months})) - end if - end for +for y=1900 to 2100 do + months = "" + for m=1 to 12 do + if string(m31[m]) + and day_of_week(y,m,1,true)="Friday" then + if length(months)!=0 then months &= ", " end if + months &= m31[m] + nmonths += 1 + end if + end for + if length(months)=0 then + none = append(none,y) + else + res = append(res,sprintf("%d : %s\n",{y,months})) + end if +end for - printf(1,"Found %d months with five full weekends\n",nmonths) - res[6..-6] = {" ...\n"} - puts(1,join(res,"")) - printf(1,"Found %d years with no month having 5 weekends:\n",{length(none)}) - none[6..-6] = {".."} - ?none - + ?flatten({{1},2,{{3,4},5},{{{}}},{{{6}}},7,8,{}}) + [ ) + + [ [] swap witheach [ not join ] ] is invert ( [ --> [ ) + + [ 2dup peek invert unrot poke ] is fliprow ( [ n --> [ ) + + [ dip transpose fliprow transpose ] is flipcolumn ( [ n --> [ ) + + [ dup + [ dup size dup * times + [ dup size random + 2 random iff + fliprow + else flipcolumn ] + 2dup != until ] + nip ] is mix ( [ --> [ ) + + [ say " " + dup size times + [ sp i^ char a + emit ] + witheach + [ cr sp i^ echo say ":" + witheach + [ sp echo ] ] ] is display ( [ --> ) + + [ cr $ "a..., or 0...: " + input $ "." join + trim 0 peek lower + 2dup char a rot over + + within iff + [ nip char a - + ' flipcolumn ] + done + 2dup char 0 rot over + + within iff + [ nip char 0 - + ' fliprow ] + done + drop again ] is getmove ( n --> n x ) + + [ 0 temp put + makeboard + dup mix + [ say "Moves: " + temp share echo cr + 1 temp tally + 2dup swap + say "Target" cr + display cr cr + say "Current" cr + display cr + dup size getmove do cr + 2dup = until ] + 2drop + temp take + say "Moves taken: " echo ] is flipbits ( n --> ) diff --git a/Task/Flipping-bits-game/R/flipping-bits-game.r b/Task/Flipping-bits-game/R/flipping-bits-game.r new file mode 100644 index 0000000000..bedaae8f59 --- /dev/null +++ b/Task/Flipping-bits-game/R/flipping-bits-game.r @@ -0,0 +1,59 @@ +gen_board <- function(n) matrix(data=sample(c(0,1), n^2, replace=TRUE), + nrow=n, + ncol=n, + dimnames=list(1:n, letters[1:n])) + +fliprow <- function(mat, n){ + mat[n,] <- !mat[n,] + return(mat) +} + +flipcol <- function(mat, n){ + mat[,n] <- !mat[,n] + return(mat) +} + +bits_game <- function(){ + n <- as.numeric(readline(prompt="Input board size: ")) + board_final <- gen_board(n) + repeat{ + #Generate a list of between 10 and 15 random moves + num_moves <- sample(10:15, 1) + flip_args <- sample(1:n, num_moves, replace=TRUE) + flip_fns <- sample(list(fliprow, flipcol), num_moves, replace=TRUE) + gen_move <- function(k){ + function(mat) flip_fns[[k]](mat, flip_args[k]) + } + rand_moves <- sapply(1:num_moves, gen_move) + #Now apply them to the final board to generate the initial position + board_initial <- Reduce(function(x, f) f(x), rand_moves, init=board_final) + #Make sure initial and final positions aren't the same + if(!identical(board_initial, board_final)) break + } + #Time to start the game! + cat("\nYour starting position is:\n") + print(board_initial) + cat("\nYour target position is:\n") + print(board_final) + turns <- 1 + while(!identical(board_initial,board_final)){ + cat("\nTurn ", turns, ":\n", sep="") + move <- readline(prompt="Enter a row or column name to flip it: ") + if(move %in% 1:n){ + board_initial <- fliprow(board_initial, move) + cat("\nThe position is now:\n") + print(board_initial) + turns <- turns+1 + } + else if(move %in% letters[1:n]){ + board_initial <- flipcol(board_initial, which(letters==move)) + cat("\nThe position is now:\n") + print(board_initial) + turns <- turns+1 + } + else cat("\nThat's not a valid move. Try again!\n") + } + cat("\nWell done! You finished in", turns-1, "move(s).\n") +} + +bits_game() diff --git a/Task/Flipping-bits-game/Rust/flipping-bits-game.rust b/Task/Flipping-bits-game/Rust/flipping-bits-game.rs similarity index 100% rename from Task/Flipping-bits-game/Rust/flipping-bits-game.rust rename to Task/Flipping-bits-game/Rust/flipping-bits-game.rs diff --git a/Task/Flipping-bits-game/Uiua/flipping-bits-game.uiua b/Task/Flipping-bits-game/Uiua/flipping-bits-game.uiua new file mode 100644 index 0000000000..4b550f5dcb --- /dev/null +++ b/Task/Flipping-bits-game/Uiua/flipping-bits-game.uiua @@ -0,0 +1,18 @@ +# Could use `path`, but this is easily solved without it. +# ⊢path(⊂⊃(≡Fr|≡Fc)⇡Size¤|=0Dist|÷Size Dist) Shuffle T + +Size ← 8 +T ← ↯Size_Size 0 # Simple target setup. +Fr ← ⍜⊡¬⊙ # Flip a row. +Fc ← ⍜⊙⍉Fr # Flip a col. +Shuffle ← ⍥(⨬(Fr|Fc)<0.5⚂ ⌊×⚂Size)××2.Size # Apply random changes. +Dist ← /+/+⌵-T # Number of wrong cells. +⟜[∘]Shuffle T # Shuffle and start a copy for the output. +◌⍢( + ⊂⊃(≡Fr|≡Fc)⇡Size¤ # All neighbours. + ⊚=/↧.≡Dist. # Find min dist, get indices that give that. + ⊡⊢ # Pick first one. + ⊙⊂. # Save a copy of the new state. +| ≠0Dist # Repeat until found target. +) +⟜($"_ steps."⧻)⇌ diff --git a/Task/Flipping-bits-game/V-(Vlang)/flipping-bits-game.v b/Task/Flipping-bits-game/V-(Vlang)/flipping-bits-game.v new file mode 100644 index 0000000000..5f31955f5d --- /dev/null +++ b/Task/Flipping-bits-game/V-(Vlang)/flipping-bits-game.v @@ -0,0 +1,110 @@ +import rand +import os + +const size = 3 + +struct Board { + mut: + target [][]int + board [][]int +} + +fn new_board() Board { + mut brd := Board{ + target: [][]int{len: size, init: []int{len: size}}, + board: [][]int{len: size, init: []int{len: size}}, + } + for ial in 0 .. size { + for jal in 0 .. size { + brd.target[ial][jal] = rand.intn(2) or {panic("No Random!")} + } + } + return brd +} + +fn (mut brd Board) flip_row(rir int) { + for cal in 0 .. size { + brd.board[rir][cal] = if brd.board[rir][cal] == 0 { 1 } else { 0 } + } +} + +fn (mut brd Board) flip_col(cir int) { + for ral in 0 .. size { + brd.board[ral][cir] = if brd.board[ral][cir] == 0 { 1 } else { 0 } + } +} + +fn (mut brd Board) init_board() { + for ial in 0 .. size { + for jal in 0 .. size { + brd.board[ial][jal] = brd.target[ial][jal] + } + } + for _ in 0 .. 9 { + rc := rand.intn(2) or {panic("No Random!")} + if rc == 0 { brd.flip_row(rand.intn(size) or {panic("No Random!")}) } + else { brd.flip_col(rand.intn(size) or {panic("No Random!")}) } + } +} + +fn print_board(label string, a [][]int) { + println("$label:") + println(" | a b c") + println("---------") + for ral in 0 .. size { + print("${ral + 1} |") + for cal in 0 .. size { + print(" ${a[ral][cal]}") + } + println("") + } + println("") +} + +fn (brd Board) game_over() bool { + for ral in 0 .. size { + for cal in 0 .. size { + if brd.board[ral][cal] != brd.target[ral][cal] { return false } + } + } + return true +} + +fn main() { + mut brd := new_board() + mut flips, mut nir := 0, -1 + mut is_row := true + // initialize board and ensure it differs from target + for { + brd.init_board() + if !brd.game_over() { break } + } + print_board("TARGET", brd.target) + print_board("OPENING BOARD", brd.board) + for { + is_row = true + nir = -1 + for nir == -1 { + input := os.input("Enter row number or column letter to be flipped: ").str() + if input.len == 0 { continue } + ch := input[0].ascii_str().to_lower() + if ch !in ["1", "2", "3", "a", "brd", "c"] { + println("Must be 1, 2, 3, a, brd or c") + continue + } + if ch in ["1", "2", "3"] { nir = int(ch[0]) - int(`1`) } + else { + is_row = false + nir = int(ch[0]) - int(`a`) + } + } + flips++ + if is_row { brd.flip_row(nir) } + else { brd.flip_col(nir) } + plural := if flips == 1 { "" } else { "S" } + print_board("\nBOARD AFTER $flips FLIP$plural", brd.board) + if brd.game_over() { break } + } + plural := if flips == 1 { "" } else { "s" } + println("You\'ve succeeded in $flips flip$plural") +} diff --git a/Task/Flipping-bits-game/Wren/flipping-bits-game.wren b/Task/Flipping-bits-game/Wren/flipping-bits-game.wren index f17b9d0139..ddcbaaf6d0 100644 --- a/Task/Flipping-bits-game/Wren/flipping-bits-game.wren +++ b/Task/Flipping-bits-game/Wren/flipping-bits-game.wren @@ -1,6 +1,6 @@ import "random" for Random -import "/ioutil" for Input -import "/str" for Str +import "./ioutil" for Input +import "./str" for Str var rand = Random.new() var target = List.filled(3, null) diff --git a/Task/Flow-control-structures/00-TASK.txt b/Task/Flow-control-structures/00-TASK.txt index 914b6b9bdc..e98a46bee8 100644 --- a/Task/Flow-control-structures/00-TASK.txt +++ b/Task/Flow-control-structures/00-TASK.txt @@ -1,4 +1,5 @@ {{Control Structures}} +[[Category:Flow control]] ;Task: Document common flow-control structures. diff --git a/Task/Flow-control-structures/Ada/flow-control-structures-1.ada b/Task/Flow-control-structures/Ada/flow-control-structures-1.adb similarity index 100% rename from Task/Flow-control-structures/Ada/flow-control-structures-1.ada rename to Task/Flow-control-structures/Ada/flow-control-structures-1.adb diff --git a/Task/Flow-control-structures/Ada/flow-control-structures-2.ada b/Task/Flow-control-structures/Ada/flow-control-structures-2.ada deleted file mode 100644 index 15f5e64b2f..0000000000 --- a/Task/Flow-control-structures/Ada/flow-control-structures-2.ada +++ /dev/null @@ -1,8 +0,0 @@ -Outer: - loop - -- do something - loop - -- do something else - exit Outer; -- exits both the inner and outer loops - end loop; - end loop; diff --git a/Task/Flow-control-structures/Ada/flow-control-structures-2.adb b/Task/Flow-control-structures/Ada/flow-control-structures-2.adb new file mode 100644 index 0000000000..b793ba8f93 --- /dev/null +++ b/Task/Flow-control-structures/Ada/flow-control-structures-2.adb @@ -0,0 +1,10 @@ +Outer: +loop + -- do something + loop + if Finished then + exit Outer; -- exits both the inner and outer loops + end if; + -- do something else + end loop; +end loop Outer; diff --git a/Task/Flow-control-structures/Ada/flow-control-structures-3.adb b/Task/Flow-control-structures/Ada/flow-control-structures-3.adb new file mode 100644 index 0000000000..ed66f3714c --- /dev/null +++ b/Task/Flow-control-structures/Ada/flow-control-structures-3.adb @@ -0,0 +1,8 @@ +Outer: +loop + -- do something + loop + exit Outer when Finished; + -- do something else + end loop; +end loop Outer; diff --git a/Task/Flow-control-structures/Ada/flow-control-structures-4.adb b/Task/Flow-control-structures/Ada/flow-control-structures-4.adb new file mode 100644 index 0000000000..ef06de0b59 --- /dev/null +++ b/Task/Flow-control-structures/Ada/flow-control-structures-4.adb @@ -0,0 +1,8 @@ +procedure Foo is +begin + -- do something + if Nothing_More_To_Do then + return; + end if; + -- do more +end Foo; diff --git a/Task/Flow-control-structures/Ada/flow-control-structures-3.ada b/Task/Flow-control-structures/Ada/flow-control-structures-5.adb similarity index 100% rename from Task/Flow-control-structures/Ada/flow-control-structures-3.ada rename to Task/Flow-control-structures/Ada/flow-control-structures-5.adb diff --git a/Task/Flow-control-structures/COBOL/flow-control-structures-1.cobol b/Task/Flow-control-structures/COBOL/flow-control-structures-1.cob similarity index 100% rename from Task/Flow-control-structures/COBOL/flow-control-structures-1.cobol rename to Task/Flow-control-structures/COBOL/flow-control-structures-1.cob diff --git a/Task/Flow-control-structures/COBOL/flow-control-structures-2.cobol b/Task/Flow-control-structures/COBOL/flow-control-structures-2.cob similarity index 100% rename from Task/Flow-control-structures/COBOL/flow-control-structures-2.cobol rename to Task/Flow-control-structures/COBOL/flow-control-structures-2.cob diff --git a/Task/Flow-control-structures/COBOL/flow-control-structures-3.cobol b/Task/Flow-control-structures/COBOL/flow-control-structures-3.cob similarity index 100% rename from Task/Flow-control-structures/COBOL/flow-control-structures-3.cobol rename to Task/Flow-control-structures/COBOL/flow-control-structures-3.cob diff --git a/Task/Flow-control-structures/COBOL/flow-control-structures-4.cobol b/Task/Flow-control-structures/COBOL/flow-control-structures-4.cob similarity index 100% rename from Task/Flow-control-structures/COBOL/flow-control-structures-4.cobol rename to Task/Flow-control-structures/COBOL/flow-control-structures-4.cob diff --git a/Task/Flow-control-structures/COBOL/flow-control-structures-5.cobol b/Task/Flow-control-structures/COBOL/flow-control-structures-5.cob similarity index 100% rename from Task/Flow-control-structures/COBOL/flow-control-structures-5.cobol rename to Task/Flow-control-structures/COBOL/flow-control-structures-5.cob diff --git a/Task/Flow-control-structures/EasyLang/flow-control-structures.easy b/Task/Flow-control-structures/EasyLang/flow-control-structures.easy new file mode 100644 index 0000000000..ec5b67f41b --- /dev/null +++ b/Task/Flow-control-structures/EasyLang/flow-control-structures.easy @@ -0,0 +1,9 @@ +sum = 80036 +for i = 0 to 50 + for j = 0 to 50 + if i * i + j * j * j = sum + print i & "² + " & j & "³ = " & sum + break 2 + . + . +. diff --git a/Task/Flow-control-structures/FutureBasic/flow-control-structures.basic b/Task/Flow-control-structures/FutureBasic/flow-control-structures.basic new file mode 100644 index 0000000000..e1bdbc5e11 --- /dev/null +++ b/Task/Flow-control-structures/FutureBasic/flow-control-structures.basic @@ -0,0 +1,21 @@ +override _allowSubroutines = _true +#build Optimization _buildOptimizationNone + +print "First line." +gosub "sub1" +print "Fifth line." + +HandleEvents + +"sub1" +print "Second line." +gosub "sub2" +print "Fourth line." +goto "skip" +print "we don't get here" +"skip" +return + +"sub2" +print "Third line." +return diff --git a/Task/Flow-control-structures/Julia/flow-control-structures.julia b/Task/Flow-control-structures/Julia/flow-control-structures.jl similarity index 100% rename from Task/Flow-control-structures/Julia/flow-control-structures.julia rename to Task/Flow-control-structures/Julia/flow-control-structures.jl diff --git a/Task/Flow-control-structures/Kotlin/flow-control-structures.kotlin b/Task/Flow-control-structures/Kotlin/flow-control-structures.kts similarity index 100% rename from Task/Flow-control-structures/Kotlin/flow-control-structures.kotlin rename to Task/Flow-control-structures/Kotlin/flow-control-structures.kts diff --git a/Task/Flow-control-structures/OCaml/flow-control-structures.ocaml b/Task/Flow-control-structures/OCaml/flow-control-structures.ml similarity index 100% rename from Task/Flow-control-structures/OCaml/flow-control-structures.ocaml rename to Task/Flow-control-structures/OCaml/flow-control-structures.ml diff --git a/Task/Flow-control-structures/REBOL/flow-control-structures.rebol b/Task/Flow-control-structures/Rebol/flow-control-structures.rebol similarity index 99% rename from Task/Flow-control-structures/REBOL/flow-control-structures.rebol rename to Task/Flow-control-structures/Rebol/flow-control-structures.rebol index 27a2bbcf83..2530b2f609 100644 --- a/Task/Flow-control-structures/REBOL/flow-control-structures.rebol +++ b/Task/Flow-control-structures/Rebol/flow-control-structures.rebol @@ -1,4 +1,4 @@ -REBOL [ +Rebol [ Title: "Flow Control" URL: http://rosettacode.org/wiki/Flow_Control_Structures ] diff --git a/Task/Flow-control-structures/Uxntal/flow-control-structures.uxnatl b/Task/Flow-control-structures/Uxntal/flow-control-structures.uxnatl new file mode 100644 index 0000000000..7b135f37f9 --- /dev/null +++ b/Task/Flow-control-structures/Uxntal/flow-control-structures.uxnatl @@ -0,0 +1,24 @@ +|18 @Console/write + +|100 + +example + +BRK + +@example ( x y -- ) + ;start print/str + !&world ( goto &world ) + ;never print/str + &world ( label &world ) + ;end !print/str + +@print/str ( str* -- ) + LDAk .Console/write DEO + INC2 LDAk ?&str + POP2 + JMP2r + +@start "Hello, 2000 +@never "Never 20 "printed. 0a00 +@end "World! 0a00 diff --git a/Task/Floyd-Warshall-algorithm/ALGOL-68/floyd-warshall-algorithm.alg b/Task/Floyd-Warshall-algorithm/ALGOL-68/floyd-warshall-algorithm.alg new file mode 100644 index 0000000000..68ed0e7149 --- /dev/null +++ b/Task/Floyd-Warshall-algorithm/ALGOL-68/floyd-warshall-algorithm.alg @@ -0,0 +1,84 @@ +BEGIN # Floyd-Warshall algorithm - translated from the Lua sample # + + OP FMT = ( REAL v )STRING: + BEGIN + STRING result := fixed( ABS v, 0, 15 ); + IF result[ LWB result ] = "." THEN "0" +=: result FI; + WHILE result[ UPB result ] = "0" DO result := result[ : UPB result - 1 ] OD; + IF result[ UPB result ] = "." THEN result := result[ : UPB result - 1 ] FI; + IF v < 0 THEN "-" ELSE " " FI + result + END # FMT # ; + + PROC print result = ( [,]REAL dist, [,]INT nxt )VOID: + BEGIN + print( ( "pair dist path", newline ) ); + FOR i FROM 1 LWB nxt TO 1 UPB nxt DO + FOR j FROM 2 LWB nxt TO 2 UPB nxt DO + IF i /= j THEN + INT u := i + 1; + INT v = j + 1; + print( ( whole( u, 0 ), " -> ", whole( v, 0 ), " " + , FMT dist[ i, j ], " ", whole( u, 0 ) + ) + ); + WHILE u := nxt[ u - 1, v - 1 ]; + print( ( " -> " + whole( u, 0 ) ) ); + u /= v + DO SKIP OD; + print( ( newline ) ) + FI + OD + OD + END # print result # ; + + PROC floyd warshall = ( [,]INT weights, INT num vertices )VOID: + BEGIN + + REAL infinite = max real; + + [ 0 : num vertices - 1, 0 : num vertices - 1 ]REAL dist; + FOR i FROM LWB dist TO 1 UPB dist DO + FOR j FROM 2 LWB dist TO 2 UPB dist DO + dist[ i, j ] := infinite + OD + OD; + + FOR i FROM 1 LWB weights TO 1 UPB weights DO + # the weights array is one based # + []INT w = weights[ i, : ]; + dist[ w[ 1 ] - 1, w[ 2 ] - 1 ] := w[ 3 ] + OD; + + [ 0 : num vertices - 1, 0 : num vertices - 1 ]INT nxt; + FOR i FROM LWB nxt TO 1 UPB nxt DO + FOR j FROM 2 LWB nxt TO 2 UPB nxt DO + nxt[ i, j ] := IF i /= j THEN j + 1 ELSE 0 FI + OD + OD; + + FOR k FROM 2 LWB dist TO 2 UPB dist DO + FOR i FROM 1 LWB dist TO 1 UPB dist DO + FOR j FROM 2 LWB dist TO 2 UPB dist DO + IF dist[ i, k ] /= infinite AND dist[ k, j ] /= infinite THEN + IF dist[ i, k ] + dist[ k, j ] < dist[ i, j ] THEN + dist[ i, j ] := dist[ i, k ] + dist[ k, j ]; + nxt[ i, j ] := nxt[ i, k ] + FI + FI + OD + OD + OD; + + print result( dist, nxt ) + END # floyd warshall # ; + BEGIN + [,]INT weights = ( ( 1, 3, -2 ) + , ( 2, 1, 4 ) + , ( 2, 3, 3 ) + , ( 3, 4, 2 ) + , ( 4, 2, -1 ) + ); + INT num vertices = 4; + floyd warshall( weights, num vertices ) + END +END diff --git a/Task/Floyd-Warshall-algorithm/Ada/floyd-warshall-algorithm.ada b/Task/Floyd-Warshall-algorithm/Ada/floyd-warshall-algorithm.adb similarity index 100% rename from Task/Floyd-Warshall-algorithm/Ada/floyd-warshall-algorithm.ada rename to Task/Floyd-Warshall-algorithm/Ada/floyd-warshall-algorithm.adb diff --git a/Task/Floyd-Warshall-algorithm/COBOL/floyd-warshall-algorithm.cob b/Task/Floyd-Warshall-algorithm/COBOL/floyd-warshall-algorithm.cob new file mode 100644 index 0000000000..47f4420154 --- /dev/null +++ b/Task/Floyd-Warshall-algorithm/COBOL/floyd-warshall-algorithm.cob @@ -0,0 +1,183 @@ +IDENTIFICATION DIVISION. + PROGRAM-ID. FLOYD-WARSHALL. + + DATA DIVISION. + WORKING-STORAGE SECTION. + + 01 WS-NUM-VERTICES PIC 9 VALUE 4. + 01 WS-NUM-WEIGHTS PIC 9 VALUE 5. + 01 WS-INFINITY PIC 9(7)V9(2) VALUE 9999999.99. + + 01 WS-WEIGHTS. + 05 WS-W OCCURS 5 TIMES. + 10 WS-FROM PIC 9. + 10 WS-TO PIC 9. + 10 WS-COST PIC S9(3) SIGN LEADING SEPARATE. + + 01 WS-DIST. + 05 WS-D OCCURS 4 TIMES. + 10 WS-D-COL OCCURS 4 TIMES. + 15 WS-DIST-VAL PIC S9(7)V9(2). + + 01 WS-NEXT. + 05 WS-N OCCURS 4 TIMES. + 10 WS-N-COL OCCURS 4 TIMES. + 15 WS-NEXT-VAL PIC 9. + + 01 WS-I PIC 9. + 01 WS-J PIC 9. + 01 WS-K PIC 9. + 01 WS-U PIC 9. + 01 WS-V PIC 9. + 01 WS-IDX PIC 9. + 01 WS-TEMP-SUM PIC S9(7)V9(2). + 01 WS-DIST-IJ PIC S9(7)V9(2). + 01 WS-DIST-IK PIC S9(7)V9(2). + 01 WS-DIST-KJ PIC S9(7)V9(2). + + *> Path and display working fields + 01 WS-PATH PIC X(200). + 01 WS-PATH-TEMP PIC X(200). + 01 WS-DIST-INT PIC S9(5). + 01 WS-DIST-EDIT PIC -(4)9. + 01 WS-DIST-TRIM PIC X(6). + 01 WS-OUTPUT-LINE PIC X(80). + 01 WS-NODE-CHAR PIC 9. + + PROCEDURE DIVISION. + MAIN-PARA. + MOVE 1 TO WS-FROM(1) + MOVE 3 TO WS-TO(1) + MOVE -2 TO WS-COST(1) + + MOVE 2 TO WS-FROM(2) + MOVE 1 TO WS-TO(2) + MOVE 4 TO WS-COST(2) + + MOVE 2 TO WS-FROM(3) + MOVE 3 TO WS-TO(3) + MOVE 3 TO WS-COST(3) + + MOVE 3 TO WS-FROM(4) + MOVE 4 TO WS-TO(4) + MOVE 2 TO WS-COST(4) + + MOVE 4 TO WS-FROM(5) + MOVE 2 TO WS-TO(5) + MOVE -1 TO WS-COST(5) + + PERFORM INIT-DIST + PERFORM INIT-NEXT + PERFORM FLOYD-WARSHALL + PERFORM PRINT-RESULT + STOP RUN. + + INIT-DIST. + PERFORM VARYING WS-I FROM 1 BY 1 + UNTIL WS-I > WS-NUM-VERTICES + PERFORM VARYING WS-J FROM 1 BY 1 + UNTIL WS-J > WS-NUM-VERTICES + MOVE WS-INFINITY TO WS-DIST-VAL(WS-I, WS-J) + END-PERFORM + END-PERFORM + PERFORM VARYING WS-IDX FROM 1 BY 1 + UNTIL WS-IDX > WS-NUM-WEIGHTS + MOVE WS-FROM(WS-IDX) TO WS-I + MOVE WS-TO(WS-IDX) TO WS-J + MOVE WS-COST(WS-IDX) TO WS-DIST-VAL(WS-I, WS-J) + END-PERFORM. + + INIT-NEXT. + PERFORM VARYING WS-I FROM 1 BY 1 + UNTIL WS-I > WS-NUM-VERTICES + PERFORM VARYING WS-J FROM 1 BY 1 + UNTIL WS-J > WS-NUM-VERTICES + IF WS-I NOT EQUAL WS-J + MOVE WS-J TO WS-NEXT-VAL(WS-I, WS-J) + ELSE + MOVE 0 TO WS-NEXT-VAL(WS-I, WS-J) + END-IF + END-PERFORM + END-PERFORM. + + FLOYD-WARSHALL. + PERFORM VARYING WS-K FROM 1 BY 1 + UNTIL WS-K > WS-NUM-VERTICES + PERFORM VARYING WS-I FROM 1 BY 1 + UNTIL WS-I > WS-NUM-VERTICES + PERFORM VARYING WS-J FROM 1 BY 1 + UNTIL WS-J > WS-NUM-VERTICES + MOVE WS-DIST-VAL(WS-I, WS-K) TO WS-DIST-IK + MOVE WS-DIST-VAL(WS-K, WS-J) TO WS-DIST-KJ + MOVE WS-DIST-VAL(WS-I, WS-J) TO WS-DIST-IJ + IF WS-DIST-IK < WS-INFINITY AND + WS-DIST-KJ < WS-INFINITY + COMPUTE WS-TEMP-SUM = + WS-DIST-IK + WS-DIST-KJ + IF WS-TEMP-SUM < WS-DIST-IJ + MOVE WS-TEMP-SUM + TO WS-DIST-VAL(WS-I, WS-J) + MOVE WS-NEXT-VAL(WS-I, WS-K) + TO WS-NEXT-VAL(WS-I, WS-J) + END-IF + END-IF + END-PERFORM + END-PERFORM + END-PERFORM. + + PRINT-RESULT. + DISPLAY "pair dist path" + PERFORM VARYING WS-I FROM 1 BY 1 + UNTIL WS-I > WS-NUM-VERTICES + PERFORM VARYING WS-J FROM 1 BY 1 + UNTIL WS-J > WS-NUM-VERTICES + IF WS-I NOT EQUAL WS-J + + *> Set up source and destination + MOVE WS-I TO WS-U + MOVE WS-J TO WS-V + + *> Seed path with just the source node + MOVE SPACES TO WS-PATH + MOVE WS-I TO WS-NODE-CHAR + MOVE WS-NODE-CHAR TO WS-PATH(1:1) + + *> Walk next-hop until we reach destination + PERFORM UNTIL WS-U = WS-V + MOVE WS-NEXT-VAL(WS-U, WS-V) TO WS-U + MOVE WS-U TO WS-NODE-CHAR + MOVE SPACES TO WS-PATH-TEMP + STRING + FUNCTION TRIM(WS-PATH TRAILING) + DELIMITED SIZE + " -> " DELIMITED SIZE + WS-NODE-CHAR DELIMITED SIZE + INTO WS-PATH-TEMP + MOVE WS-PATH-TEMP TO WS-PATH + END-PERFORM + + *> Format distance: move to integer then edit picture + *> to get clean signed number without leading zeros + COMPUTE WS-DIST-INT = + WS-DIST-VAL(WS-I, WS-J) + MOVE WS-DIST-INT TO WS-DIST-EDIT + MOVE FUNCTION TRIM(WS-DIST-EDIT LEADING) + TO WS-DIST-TRIM + + *> Assemble and print output line + MOVE SPACES TO WS-OUTPUT-LINE + STRING + WS-I DELIMITED SIZE + " -> " DELIMITED SIZE + WS-J DELIMITED SIZE + " " DELIMITED SIZE + FUNCTION TRIM(WS-DIST-TRIM LEADING) + DELIMITED SIZE + " " DELIMITED SIZE + FUNCTION TRIM(WS-PATH TRAILING) + DELIMITED SIZE + INTO WS-OUTPUT-LINE + DISPLAY FUNCTION TRIM(WS-OUTPUT-LINE TRAILING) + END-IF + END-PERFORM + END-PERFORM. diff --git a/Task/Floyd-Warshall-algorithm/Dart/floyd-warshall-algorithm.dart b/Task/Floyd-Warshall-algorithm/Dart/floyd-warshall-algorithm.dart new file mode 100644 index 0000000000..287b9a495f --- /dev/null +++ b/Task/Floyd-Warshall-algorithm/Dart/floyd-warshall-algorithm.dart @@ -0,0 +1,54 @@ +void main() { + List> weights = [ + [1, 3, -2], + [2, 1, 4], + [2, 3, 3], + [3, 4, 2], + [4, 2, -1] + ]; + int numVertices = 4; + floydWarshall(weights, numVertices); +} + +void floydWarshall(List> weights, int numVertices) { + List> dist = List.generate( + numVertices, (_) => List.filled(numVertices, double.infinity)); + + for (var w in weights) { + dist[w[0] - 1][w[1] - 1] = w[2].toDouble(); + } + + List> next = List.generate( + numVertices, (i) => List.generate(numVertices, (j) => j != i ? j + 1 : 0)); + + for (int k = 0; k < numVertices; k++) { + for (int i = 0; i < numVertices; i++) { + for (int j = 0; j < numVertices; j++) { + if (dist[i][k] + dist[k][j] < dist[i][j]) { + dist[i][j] = dist[i][k] + dist[k][j]; + next[i][j] = next[i][k]; + } + } + } + } + + printResult(dist, next); +} + +void printResult(List> dist, List> next) { + print("pair dist path"); + for (int i = 0; i < next.length; i++) { + for (int j = 0; j < next.length; j++) { + if (i != j) { + int u = i + 1; + int v = j + 1; + String path = "$u -> $v ${dist[i][j].toInt()} $u"; + do { + u = next[u - 1][v - 1]; + path += " -> $u"; + } while (u != v); + print(path); + } + } + } +} diff --git a/Task/Floyd-Warshall-algorithm/EasyLang/floyd-warshall-algorithm.easy b/Task/Floyd-Warshall-algorithm/EasyLang/floyd-warshall-algorithm.easy new file mode 100644 index 0000000000..4d4159674a --- /dev/null +++ b/Task/Floyd-Warshall-algorithm/EasyLang/floyd-warshall-algorithm.easy @@ -0,0 +1,24 @@ +proc floydwarshall w[][] n . + for i to n + con[][] &= [ ] + for j to n : con[i][] &= 1 / 0 + . + for i to len w[][] + con[w[i][1]][w[i][2]] = w[i][3] + . + for k to n + for i to n + for j to n + con[i][j] = lower con[i][j] (con[i][k] + con[k][j]) + . + . + . + for i to n + for j to n + if i <> j + print i & " -> " & j & " : " & con[i][j] + . + . + . +. +floydwarshall [ [ 1 3 -2 ] [ 2 1 4 ] [ 2 3 3 ] [ 3 4 2 ] [ 4 2 -1 ] ] 4 diff --git a/Task/Floyd-Warshall-algorithm/Elixir/floyd-warshall-algorithm.elixir b/Task/Floyd-Warshall-algorithm/Elixir/floyd-warshall-algorithm.ex similarity index 100% rename from Task/Floyd-Warshall-algorithm/Elixir/floyd-warshall-algorithm.elixir rename to Task/Floyd-Warshall-algorithm/Elixir/floyd-warshall-algorithm.ex diff --git a/Task/Floyd-Warshall-algorithm/Erlang/floyd-warshall-algorithm.erl b/Task/Floyd-Warshall-algorithm/Erlang/floyd-warshall-algorithm.erl new file mode 100644 index 0000000000..9ff0e024e4 --- /dev/null +++ b/Task/Floyd-Warshall-algorithm/Erlang/floyd-warshall-algorithm.erl @@ -0,0 +1,54 @@ +-module(floyd_warshall). +-export([main/2]). + + +main(N, Edge) -> + {Dist, Next} = setup(N, Edge), + {Dist2, Next2} = shortest_path(N, Dist, Next), + print(N, Dist2, Next2). + +setup(N, Edge) -> + Big = 1.0e300, + Dist = maps:from_list([{{I,J}, case I == J of true -> 0; false -> Big end} + || I <- lists:seq(1, N), J <- lists:seq(1, N)]), + Next = maps:from_list([{{I,J}, nil} + || I <- lists:seq(1, N), J <- lists:seq(1, N)]), + lists:foldl(fun({U, V, W}, {Dst, Nxt}) -> + {maps:put({U, V}, W, Dst), maps:put({U, V}, V, Nxt)} + end, {Dist, Next}, Edge). + +shortest_path(N, Dist, Next) -> + Combinations = [{K, I, J} || K <- lists:seq(1, N), + I <- lists:seq(1, N), + J <- lists:seq(1, N)], + lists:foldl(fun({K, I, J}, {Dst, Nxt}) -> + IJ_Dist = maps:get({I, J}, Dst), + IK_Dist = maps:get({I, K}, Dst), + KJ_Dist = maps:get({K, J}, Dst), + case IJ_Dist > IK_Dist + KJ_Dist of + true -> + NewDist = maps:put({I, J}, IK_Dist + KJ_Dist, Dst), + NewNext = maps:put({I, J}, maps:get({I, K}, Nxt), Nxt), + {NewDist, NewNext}; + false -> + {Dst, Nxt} + end + end, {Dist, Next}, Combinations). + +print(N, Dist, Next) -> + io:format("pair dist path~n"), + [io:format("~w -> ~w ~4w ~s~n", [I, J, maps:get({I, J}, Dist), path(Next, I, J)]) + || I <- lists:seq(1, N), J <- lists:seq(1, N), I =/= J]. + +path(Next, I, J) -> + PathList = path(Next, I, J, [I]), + string:join([integer_to_list(X) || X <- PathList], " -> "). + +path(_Next, I, I, List) -> + lists:reverse(List); +path(Next, I, J, List) -> + U = maps:get({I, J}, Next), + path(Next, U, J, [U | List]). + +% Usage example: +main(_) -> main(4, [{1, 3, -2}, {2, 1, 4}, {2, 3, 3}, {3, 4, 2}, {4, 2, -1}]). diff --git a/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-2.j b/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-2.j index e164599e6e..03dc67fc2d 100644 --- a/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-2.j +++ b/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-2.j @@ -1,12 +1 @@ -graph=: ".;._2]0 :0 - 0 _ _2 _ NB. 1->3 costs _2 - 4 0 3 _ NB. 2->1 costs 4; 2->3 costs 3 - _ _ 0 2 NB. 3->4 costs 2 - _ _1 _ 0 NB. 4->2 costs _1 -) - - floyd graph -0 _1 _2 0 -4 0 2 4 -5 1 0 2 -3 _1 1 0 +floyd=: ]F..(]<.{"1+/{) i.@# diff --git a/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-3.j b/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-3.j index a8d86325c7..e164599e6e 100644 --- a/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-3.j +++ b/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-3.j @@ -1,33 +1,12 @@ -floydrecon=: verb define - n=. ($y)$_(I._=,y)},($$i.@#)y - for_j. i.#y do. - d=. y <. j ({"1 +/ {) y - b=. y~:d - y=. d - n=. (n*-.b)+b * j{"1 n - end. +graph=: ".;._2]0 :0 + 0 _ _2 _ NB. 1->3 costs _2 + 4 0 3 _ NB. 2->1 costs 4; 2->3 costs 3 + _ _ 0 2 NB. 3->4 costs 2 + _ _1 _ 0 NB. 4->2 costs _1 ) -task=: verb define - dist=. floyd y - next=. floydrecon y - echo 'pair dist path' - for_i. i.#y do. - for_k. i.#y do. - ndx=. ndx{next do. - txt=. (":1+i),'->',(":1+k) - txt=. txt,_5{.":ndx{dist - txt=. txt,' ',":1+i - j=. i - while. j~:k do. - assert. j~:(',":1+j - end. - echo txt - end. - end. - end. - i.0 0 -) + floyd graph +0 _1 _2 0 +4 0 2 4 +5 1 0 2 +3 _1 1 0 diff --git a/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-4.j b/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-4.j index 2218e40e3a..a8d86325c7 100644 --- a/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-4.j +++ b/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-4.j @@ -1,14 +1,33 @@ - task graph -pair dist path -1->2 _1 1->3->4->2 -1->3 _2 1->3 -1->4 0 1->3->4 -2->1 4 2->1 -2->3 2 2->1->3 -2->4 4 2->1->3->4 -3->1 5 3->4->2->1 -3->2 1 3->4->2 -3->4 2 3->4 -4->1 3 4->2->1 -4->2 _1 4->2 -4->3 1 4->2->1->3 +floydrecon=: verb define + n=. ($y)$_(I._=,y)},($$i.@#)y + for_j. i.#y do. + d=. y <. j ({"1 +/ {) y + b=. y~:d + y=. d + n=. (n*-.b)+b * j{"1 n + end. +) + +task=: verb define + dist=. floyd y + next=. floydrecon y + echo 'pair dist path' + for_i. i.#y do. + for_k. i.#y do. + ndx=. ndx{next do. + txt=. (":1+i),'->',(":1+k) + txt=. txt,_5{.":ndx{dist + txt=. txt,' ',":1+i + j=. i + while. j~:k do. + assert. j~:(',":1+j + end. + echo txt + end. + end. + end. + i.0 0 +) diff --git a/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-5.j b/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-5.j new file mode 100644 index 0000000000..2218e40e3a --- /dev/null +++ b/Task/Floyd-Warshall-algorithm/J/floyd-warshall-algorithm-5.j @@ -0,0 +1,14 @@ + task graph +pair dist path +1->2 _1 1->3->4->2 +1->3 _2 1->3 +1->4 0 1->3->4 +2->1 4 2->1 +2->3 2 2->1->3 +2->4 4 2->1->3->4 +3->1 5 3->4->2->1 +3->2 1 3->4->2 +3->4 2 3->4 +4->1 3 4->2->1 +4->2 _1 4->2 +4->3 1 4->2->1->3 diff --git a/Task/Floyd-Warshall-algorithm/JavaScript/floyd-warshall-algorithm.js b/Task/Floyd-Warshall-algorithm/JavaScript/floyd-warshall-algorithm.js index 5509d0c1a8..e6c040e093 100644 --- a/Task/Floyd-Warshall-algorithm/JavaScript/floyd-warshall-algorithm.js +++ b/Task/Floyd-Warshall-algorithm/JavaScript/floyd-warshall-algorithm.js @@ -1,21 +1,49 @@ -var graph = []; -for (i = 0; i < 10; ++i) { +'use strict' +let numVertices = 4; +let weights = [ [ 1, 3, -2 ], [ 2, 1, 4 ], [ 2, 3, 3 ], [ 3, 4, 2 ], [ 4, 2, -1 ] ]; + +let graph = []; +for (let i = 0; i < numVertices; ++i) { graph.push([]); - for (j = 0; j < 10; ++j) + for (let j = 0; j < numVertices; ++j) graph[i].push(i == j ? 0 : 9999999); } -for (i = 1; i < 10; ++i) { - graph[0][i] = graph[i][0] = parseInt(Math.random() * 9 + 1); +for (let i = 0; i < weights.length; ++i) { + let w = weights[i]; + graph[w[0] - 1][w[1] - 1] = w[2]; } -for (k = 0; k < 10; ++k) { - for (i = 0; i < 10; ++i) { - for (j = 0; j < 10; ++j) { - if (graph[i][j] > graph[i][k] + graph[k][j]) - graph[i][j] = graph[i][k] + graph[k][j] +let nxt = []; +for (let i = 0; i < numVertices; ++i) { + nxt.push([]); + for (let j = 0; j < numVertices; ++j) + nxt[i].push(i == j ? 0 : j + 1); +} + +for (let k = 0; k < numVertices; ++k) { + for (let i = 0; i < numVertices; ++i) { + for (let j = 0; j < numVertices; ++j) { + if (graph[i][j] > graph[i][k] + graph[k][j]) { + graph[i][j] = graph[i][k] + graph[k][j]; + nxt[i][j] = nxt[i][k]; + } } } } -console.log(graph); +console.log("pair dist path"); +for (let i = 0; i < numVertices; ++i) { + for (let j = 0; j < numVertices; ++j) { + if (i != j) { + let u = i + 1; + let v = j + 1; + let path = u + " -> " + v + " " + graph[i][j].toString().padStart(2) + " " + u; + do { + u = nxt[u - 1][v - 1]; + path = path + " -> " + u; + } while (u != v); + console.log(path) + } + } +} diff --git a/Task/Floyd-Warshall-algorithm/Julia/floyd-warshall-algorithm.julia b/Task/Floyd-Warshall-algorithm/Julia/floyd-warshall-algorithm.jl similarity index 100% rename from Task/Floyd-Warshall-algorithm/Julia/floyd-warshall-algorithm.julia rename to Task/Floyd-Warshall-algorithm/Julia/floyd-warshall-algorithm.jl diff --git a/Task/Floyd-Warshall-algorithm/Kotlin/floyd-warshall-algorithm.kotlin b/Task/Floyd-Warshall-algorithm/Kotlin/floyd-warshall-algorithm.kts similarity index 100% rename from Task/Floyd-Warshall-algorithm/Kotlin/floyd-warshall-algorithm.kotlin rename to Task/Floyd-Warshall-algorithm/Kotlin/floyd-warshall-algorithm.kts diff --git a/Task/Floyd-Warshall-algorithm/OCaml/floyd-warshall-algorithm.ocaml b/Task/Floyd-Warshall-algorithm/OCaml/floyd-warshall-algorithm.ml similarity index 100% rename from Task/Floyd-Warshall-algorithm/OCaml/floyd-warshall-algorithm.ocaml rename to Task/Floyd-Warshall-algorithm/OCaml/floyd-warshall-algorithm.ml diff --git a/Task/Floyd-Warshall-algorithm/Pluto/floyd-warshall-algorithm.pluto b/Task/Floyd-Warshall-algorithm/Pluto/floyd-warshall-algorithm.pluto new file mode 100644 index 0000000000..8f3b213cd2 --- /dev/null +++ b/Task/Floyd-Warshall-algorithm/Pluto/floyd-warshall-algorithm.pluto @@ -0,0 +1,50 @@ +require "table2" + +class floydWarshall + static function do_calcs(weights, nvertices) + local dist = {} + local next = {} + for i = 1, nvertices do + dist[i] = table.rep(nvertices, 1/0) + next[i] = table.rep(nvertices, 1) + for j = 1, nvertices do + if i != j then next[i][j] = j end + end + end + for weights as w do dist[w[1]][w[2]] = w[3] end + for k = 1, nvertices do + for i = 1, nvertices do + for j = 1, nvertices do + if (dist[i][k] + dist[k][j] < dist[i][j]) then + dist[i][j] = dist[i][k] + dist[k][j] + next[i][j] = next[i][k] + end + end + end + end + floydWarshall.print_result(dist, next) + end + + static function print_result(dist, next) + print("pair dist path") + for i = 1, #next do + for j = 1, #next do + if i != j then + local u = i + local v = j + local path = string.format("%d -> %d %2d %s", u, v, math.trunc(dist[i][j]), u) + while true do + u = next[u][v] + path ..= " -> " .. u + if u == v then break end + end + print(path) + end + end + end + end +end + +local weights = { {1, 3, -2}, {2, 1, 4}, {2, 3, 3}, {3, 4, 2}, {4, 2, -1} } +local nvertices = 4 +floydWarshall.do_calcs(weights, nvertices) diff --git a/Task/Floyd-Warshall-algorithm/R/floyd-warshall-algorithm.r b/Task/Floyd-Warshall-algorithm/R/floyd-warshall-algorithm.r new file mode 100644 index 0000000000..e65a241e61 --- /dev/null +++ b/Task/Floyd-Warshall-algorithm/R/floyd-warshall-algorithm.r @@ -0,0 +1,67 @@ +floydWarshall <- function(weights, numVertices) { + # Initialize distance matrix with infinity + dist <- matrix(Inf, nrow = numVertices, ncol = numVertices) + + # Set diagonal elements to zero + diag(dist) <- 0 + + # Fill the distance matrix with the given weights + for (i in 1:nrow(weights)) { + dist[weights[i, 1], weights[i, 2]] <- weights[i, 3] + } + + # Initialize nextNode matrix + nextNode <- matrix(0, nrow = numVertices, ncol = numVertices) + for (i in 1:numVertices) { + for (j in 1:numVertices) { + if (i != j) { + nextNode[i, j] <- j + } + } + } + + # Floyd-Warshall algorithm + for (k in 1:numVertices) { + for (i in 1:numVertices) { + for (j in 1:numVertices) { + if (dist[i, k] + dist[k, j] < dist[i, j]) { + dist[i, j] <- dist[i, k] + dist[k, j] + nextNode[i, j] <- nextNode[i, k] + } + } + } + } + + printResult(dist, nextNode) +} + +printResult <- function(dist, nextNode) { + cat("pair dist path\n") + for (i in 1:nrow(nextNode)) { + for (j in 1:ncol(nextNode)) { + if (i != j) { + u <- i + v <- j + path <- sprintf("%d -> %d %2d %s", i, j, dist[i, j], i) + repeat { + u <- nextNode[u, v] + path <- paste(path, "->", u) + if (u == v) break + } + cat(path, "\n") + } + } + } +} + +# Example usage +weights <- matrix(c( + 1, 3, -2, + 2, 1, 4, + 2, 3, 3, + 3, 4, 2, + 4, 2, -1 +), ncol = 3, byrow = TRUE) + +numVertices <- 4 +floydWarshall(weights, numVertices) diff --git a/Task/Floyd-Warshall-algorithm/Rust/floyd-warshall-algorithm.rust b/Task/Floyd-Warshall-algorithm/Rust/floyd-warshall-algorithm.rs similarity index 100% rename from Task/Floyd-Warshall-algorithm/Rust/floyd-warshall-algorithm.rust rename to Task/Floyd-Warshall-algorithm/Rust/floyd-warshall-algorithm.rs diff --git a/Task/Floyd-Warshall-algorithm/Scala/floyd-warshall-algorithm.scala b/Task/Floyd-Warshall-algorithm/Scala/floyd-warshall-algorithm.scala new file mode 100644 index 0000000000..250ce4faaa --- /dev/null +++ b/Task/Floyd-Warshall-algorithm/Scala/floyd-warshall-algorithm.scala @@ -0,0 +1,50 @@ +import java.lang.String.format; + +object FloydWarshall extends App { + + val weights = Array(Array(1, 3, -2), Array(2, 1, 4), Array(2, 3, 3), Array(3, 4, 2), Array(4, 2, -1)) + val numVertices = 4 + + floydWarshall(weights, numVertices) + + def floydWarshall(weights: Array[Array[Int]], numVertices: Int): Unit = { + + val dist = Array.fill(numVertices, numVertices)(Double.PositiveInfinity) + for (w <- weights) + dist(w(0) - 1)(w(1) - 1) = w(2) + + val next = Array.ofDim[Int](numVertices, numVertices) + for (i <- 0 until numVertices; j <- 0 until numVertices if i != j) + next(i)(j) = j + 1 + + for { + k <- 0 until numVertices + i <- 0 until numVertices + j <- 0 until numVertices + if dist(i)(k) + dist(k)(j) < dist(i)(j) + } { + dist(i)(j) = dist(i)(k) + dist(k)(j) + next(i)(j) = next(i)(k) + } + + printResult(dist, next) + } + + def printResult(dist: Array[Array[Double]], next: Array[Array[Int]]): Unit = { + println("pair dist path") + for { + i <- 0 until next.length + j <- 0 until next.length if i != j + } { + var u = i + 1 + val v = j + 1 + var path = format("%d -> %d %2d %s", u, v, + (dist(i)(j)).toInt, u); + while (u != v) { + u = next(u - 1)(v - 1) + path += s" -> $u" + } + println(path) + } + } +} diff --git a/Task/Floyd-Warshall-algorithm/Scheme/floyd-warshall-algorithm.ss b/Task/Floyd-Warshall-algorithm/Scheme/floyd-warshall-algorithm.scm similarity index 100% rename from Task/Floyd-Warshall-algorithm/Scheme/floyd-warshall-algorithm.ss rename to Task/Floyd-Warshall-algorithm/Scheme/floyd-warshall-algorithm.scm diff --git a/Task/Floyd-Warshall-algorithm/Swift/floyd-warshall-algorithm.swift b/Task/Floyd-Warshall-algorithm/Swift/floyd-warshall-algorithm.swift new file mode 100644 index 0000000000..f6f9661f35 --- /dev/null +++ b/Task/Floyd-Warshall-algorithm/Swift/floyd-warshall-algorithm.swift @@ -0,0 +1,51 @@ +func floydWarshall(_ weights: [[Int]], _ numVertices: Int) { + var dist = Array(repeating: Array(repeating: Double.infinity, count: numVertices), count: numVertices) + var next = Array(repeating: Array(repeating: 0, count: numVertices), count: numVertices) + + for weight in weights { + dist[weight[0] - 1][weight[1] - 1] = Double(weight[2]) + } + + for i in 0.. %d %2d %d", U, V, Dist(I,J), U); + repeat U:= Next(U-1, V-1); + Print(" -> %d", U); + until U = V; + Print("\n"); + ]; + ]; + +[Dist:= Reserve(Verts*IntSize); +for I:= 0 to Verts-1 do + [Dist(I):= Reserve(Verts*IntSize); + for J:= 0 to Verts-1 do + Dist(I,J):= \Inf\10000; + ]; +for W:= 0 to Len-1 do + Dist(Weights(W,0)-1, Weights(W,1)-1):= Weights(W,2); +Next:= Reserve(Verts*IntSize); +for I:= 0 to Verts-1 do + [Next(I):= Reserve(Verts*IntSize); + for J:= 0 to Verts-1 do + Next(I,J):= if I=J then 0 else J+1; + ]; +for K:= 0 to Verts-1 do + for I:= 0 to Verts-1 do + for J:= 0 to Verts-1 do + if Dist(I,J) > Dist(I,K) + Dist(K,J) then + [Dist(I,J):= Dist(I,K) + Dist(K,J); + Next(I,J):= Next(I,K); + ]; +PrintResult; +]; + +int Weights; +[Weights:= [ [1, 3, -2], [2, 1, 4], [2, 3, 3], [3, 4, 2], [4, 2, -1] ]; +FloydWarshall(Weights, 5, 4); +] diff --git a/Task/Floyd-Warshall-algorithm/Zig/floyd-warshall-algorithm.zig b/Task/Floyd-Warshall-algorithm/Zig/floyd-warshall-algorithm.zig new file mode 100644 index 0000000000..fe8d6dd20d --- /dev/null +++ b/Task/Floyd-Warshall-algorithm/Zig/floyd-warshall-algorithm.zig @@ -0,0 +1,99 @@ +// floyd_warshall.zig +const std = @import("std"); + +const F64_INF = std.math.inf(f64); + +fn idx(i: usize, j: usize, n: usize) usize { + return i * n + j; +} + +fn printResult(dist: []const f64, next: []const usize, n: usize) void { + std.debug.print("(pair, dist, path)\n", .{}); + for (0..n) |i| { + for (0..n) |j| { + if (i == j) continue; + + const @"u0" = i + 1; + const v0 = j + 1; + + std.debug.print("({d} -> {d}, {d}, ", .{ + @"u0", v0, dist[idx(i, j, n)], + }); + + var u = @"u0"; + std.debug.print("{d}", .{u}); + while (u != v0) { + u = next[idx(u - 1, v0 - 1, n)]; + std.debug.print(" -> {d}", .{u}); + } + std.debug.print(")\n", .{}); + } + } +} + +fn solve( + allocator: std.mem.Allocator, + edges: []const [3]i64, // (u,v,w) 1‑based + n: usize, +) !void { + // Allocate matrices + var dist = try allocator.alloc(f64, n * n); + defer allocator.free(dist); + + var next_v = try allocator.alloc(usize, n * n); + defer allocator.free(next_v); + + // Initialise + for (dist)|*d| d.* = F64_INF; + for (next_v)|*x| x.* = 0; + + // Edge weights + for (edges) |e| { + const u = @as(usize, @intCast(e[0] - 1)); + const v = @as(usize, @intCast(e[1] - 1)); + dist[idx(u, v, n)] = @as(f64, @floatFromInt(e[2])); + } + + // Successor matrix + for (0..n) |i| { + for (0..n) |j| { + if (i != j) next_v[idx(i, j, n)] = j + 1; // 1‑based + } + } + + // Floyd–Warshall + for (0..n) |k| { + for (0..n) |i| { + for (0..n) |j| { + const dik = dist[idx(i, k, n)]; + const dkj = dist[idx(k, j, n)]; + if (std.math.isFinite(dik) and std.math.isFinite(dkj)) { + const alt = dik + dkj; + const pos = idx(i, j, n); + if (alt < dist[pos]) { + dist[pos] = alt; + next_v[pos] = next_v[idx(i, k, n)]; + } + } + } + } + } + + printResult(dist, next_v, n); +} + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer _ = gpa.deinit(); + const alloc = gpa.allocator(); + + const edges = [_][3]i64{ + .{ 1, 3, -2 }, + .{ 2, 1, 4 }, + .{ 2, 3, 3 }, + .{ 3, 4, 2 }, + .{ 4, 2, -1 }, + }; + + try solve(alloc, edges[0..], 4); +} diff --git a/Task/Floyds-triangle/ABC/floyds-triangle.abc b/Task/Floyds-triangle/ABC/floyds-triangle.abc new file mode 100644 index 0000000000..8d18d171cf --- /dev/null +++ b/Task/Floyds-triangle/ABC/floyds-triangle.abc @@ -0,0 +1,18 @@ +HOW TO RETURN width n: + SELECT: + n<10: RETURN 1 + ELSE: RETURN 1 + width floor (n/10) + +HOW TO DISPLAY A FLOYD TRIANGLE WITH lines LINES: + PUT lines * (lines+1)/2 IN maxno + PUT 1 IN n + FOR line IN {1..lines}: + FOR col IN {1..line}: + WRITE n >> (1 + width (maxno - lines + col)) + PUT n+1 IN n + WRITE / + +DISPLAY A FLOYD TRIANGLE WITH 5 LINES +WRITE / +DISPLAY A FLOYD TRIANGLE WITH 14 LINES +WRITE / diff --git a/Task/Floyds-triangle/ALGOL-68/floyds-triangle.alg b/Task/Floyds-triangle/ALGOL-68/floyds-triangle.alg index 3e06ecbe63..c3bd144573 100644 --- a/Task/Floyds-triangle/ALGOL-68/floyds-triangle.alg +++ b/Task/Floyds-triangle/ALGOL-68/floyds-triangle.alg @@ -1,7 +1,11 @@ -# procedure to print a Floyd's Triangle with n lines # +# procedure to print a Floyd's Triangle with n lines # PROC floyds triangle = ( INT n )VOID: BEGIN + # the triangle should be left aligned with the individual numbers # + # right-aligned with only one space before the number in the final # + # row # + # calculate the number of the highest number that will be printed # # ( the sum of the integers 1, 2, ... n ) # INT max number = ( n * ( n + 1 ) ) OVER 2; @@ -24,10 +28,6 @@ BEGIN END; # floyds triangle # -main: ( - - floyds triangle( 5 ); - print( ( newline ) ); - floyds triangle( 14 ) - -) +floyds triangle( 5 ); +print( ( newline ) ); +floyds triangle( 14 ) diff --git a/Task/Floyds-triangle/APL/floyds-triangle-1.apl b/Task/Floyds-triangle/APL/floyds-triangle-1.apl new file mode 100644 index 0000000000..ff59b36c39 --- /dev/null +++ b/Task/Floyds-triangle/APL/floyds-triangle-1.apl @@ -0,0 +1,6 @@ +floyd←{ + max←⍵×(⍵+1)÷2 + tri←↑(⍳max)⊂⍨(0,⍳max-1)∊+\0,⍳⍵ + wdt←⌈⍀⊖≢∘⍕¨tri + ↑,/wdt{' ',(-⍺××⍵)↑⍕⍵}¨tri +} diff --git a/Task/Floyds-triangle/APL/floyds-triangle-2.apl b/Task/Floyds-triangle/APL/floyds-triangle-2.apl new file mode 100644 index 0000000000..b847a54de1 --- /dev/null +++ b/Task/Floyds-triangle/APL/floyds-triangle-2.apl @@ -0,0 +1,21 @@ + floyd 5 + 1 + 2 3 + 4 5 6 + 7 8 9 10 + 11 12 13 14 15 + floyd 14 + 1 + 2 3 + 4 5 6 + 7 8 9 10 + 11 12 13 14 15 + 16 17 18 19 20 21 + 22 23 24 25 26 27 28 + 29 30 31 32 33 34 35 36 + 37 38 39 40 41 42 43 44 45 + 46 47 48 49 50 51 52 53 54 55 + 56 57 58 59 60 61 62 63 64 65 66 + 67 68 69 70 71 72 73 74 75 76 77 78 + 79 80 81 82 83 84 85 86 87 88 89 90 91 + 92 93 94 95 96 97 98 99 100 101 102 103 104 105 diff --git a/Task/Floyds-triangle/Ada/floyds-triangle.ada b/Task/Floyds-triangle/Ada/floyds-triangle.adb similarity index 100% rename from Task/Floyds-triangle/Ada/floyds-triangle.ada rename to Task/Floyds-triangle/Ada/floyds-triangle.adb diff --git a/Task/Floyds-triangle/Ballerina/floyds-triangle.ballerina b/Task/Floyds-triangle/Ballerina/floyds-triangle.ballerina new file mode 100644 index 0000000000..0a4976e6f9 --- /dev/null +++ b/Task/Floyds-triangle/Ballerina/floyds-triangle.ballerina @@ -0,0 +1,20 @@ +import ballerina/io; + +function floyd(int n) { + int k = 1; + foreach int i in 1...n { + foreach int j in 1...i { + int p = j < 9 ? 3 : 4; + io:print(k.toString().padStart(p)); + k += 1; + } + io:println(); + } +} + +public function main() { + io:println("Floyd(5):"); + floyd(5); + io:println("\nFloyd(14):"); + floyd(14); +} diff --git a/Task/Floyds-triangle/COBOL/floyds-triangle.cobol b/Task/Floyds-triangle/COBOL/floyds-triangle.cob similarity index 100% rename from Task/Floyds-triangle/COBOL/floyds-triangle.cobol rename to Task/Floyds-triangle/COBOL/floyds-triangle.cob diff --git a/Task/Floyds-triangle/Delphi/floyds-triangle.delphi b/Task/Floyds-triangle/Delphi/floyds-triangle.pas similarity index 100% rename from Task/Floyds-triangle/Delphi/floyds-triangle.delphi rename to Task/Floyds-triangle/Delphi/floyds-triangle.pas diff --git a/Task/Floyds-triangle/Draco/floyds-triangle.draco b/Task/Floyds-triangle/Draco/floyds-triangle.draco new file mode 100644 index 0000000000..a517617453 --- /dev/null +++ b/Task/Floyds-triangle/Draco/floyds-triangle.draco @@ -0,0 +1,28 @@ +proc width(word n) word: + word w; + w := 0; + while n>0 do + w := w + 1; + n := n / 10 + od; + w +corp + +proc floyd(word rows) void: + word n, row, col, maxno; + maxno := rows * (rows+1)/2; + n := 1; + for row from 1 upto rows do + for col from 1 upto row do + write(n : 1+width(maxno - rows + col)); + n := n+1 + od; + writeln() + od +corp + +proc main() void: + floyd(5); + writeln(); + floyd(14) +corp diff --git a/Task/Floyds-triangle/EasyLang/floyds-triangle.easy b/Task/Floyds-triangle/EasyLang/floyds-triangle.easy new file mode 100644 index 0000000000..d575e1535b --- /dev/null +++ b/Task/Floyds-triangle/EasyLang/floyds-triangle.easy @@ -0,0 +1,24 @@ +func ceil h . + f = floor h + if h <> f : f += 1 + return f +. +proc triangle n . + print n & " rows:" + row = 1 + while row <= n + printme += 1 + cols = ceil log (n * (n - 1) / 2 + nprinted + 2) 10 + numfmt cols 0 + write printme & " " + nprinted += 1 + if nprinted = row + print "" + row += 1 + nprinted = 0 + . + . + print "" +. +triangle 5 +triangle 14 diff --git a/Task/Floyds-triangle/Elixir/floyds-triangle.elixir b/Task/Floyds-triangle/Elixir/floyds-triangle.ex similarity index 100% rename from Task/Floyds-triangle/Elixir/floyds-triangle.elixir rename to Task/Floyds-triangle/Elixir/floyds-triangle.ex diff --git a/Task/Floyds-triangle/Frink/floyds-triangle.frink b/Task/Floyds-triangle/Frink/floyds-triangle.frink new file mode 100644 index 0000000000..d404e4fbdc --- /dev/null +++ b/Task/Floyds-triangle/Frink/floyds-triangle.frink @@ -0,0 +1,16 @@ +FloydsTriangle[rows] := +{ + result = new array + n = 1 + for r = 1 to rows + { + result.push[array[n to n+r-1]] + n = n + r + } + + return result +} + +println[formatTable[FloydsTriangle[5], "right"]] +println[] +println[formatTable[FloydsTriangle[14], "right"]] diff --git a/Task/Floyds-triangle/FutureBasic/floyds-triangle.basic b/Task/Floyds-triangle/FutureBasic/floyds-triangle.basic new file mode 100644 index 0000000000..cd7e9cb937 --- /dev/null +++ b/Task/Floyds-triangle/FutureBasic/floyds-triangle.basic @@ -0,0 +1,18 @@ +void local fn FloydsTriangle( rows as int ) + int col, row, num = 1 + + printf @"%d rows:", rows + for row = 1 to rows + for col = 1 to row + printf @"%4d\b", num + num++ + next + print + next + print +end fn + +fn FloydsTriangle( 5 ) +fn FloydsTriangle( 14 ) + +HandleEvents diff --git a/Task/Floyds-triangle/Julia/floyds-triangle.julia b/Task/Floyds-triangle/Julia/floyds-triangle.jl similarity index 100% rename from Task/Floyds-triangle/Julia/floyds-triangle.julia rename to Task/Floyds-triangle/Julia/floyds-triangle.jl diff --git a/Task/Floyds-triangle/Kotlin/floyds-triangle.kotlin b/Task/Floyds-triangle/Kotlin/floyds-triangle.kts similarity index 100% rename from Task/Floyds-triangle/Kotlin/floyds-triangle.kotlin rename to Task/Floyds-triangle/Kotlin/floyds-triangle.kts diff --git a/Task/Floyds-triangle/Miranda/floyds-triangle.miranda b/Task/Floyds-triangle/Miranda/floyds-triangle.miranda new file mode 100644 index 0000000000..9f93c14690 --- /dev/null +++ b/Task/Floyds-triangle/Miranda/floyds-triangle.miranda @@ -0,0 +1,27 @@ +main :: [sys_message] +main = [Stdout (lay (map floyd [5, 14]))] + +floyd :: num->[char] +floyd n = lay (map fmt rws) + where rws = rows n + cws = map ((+1).width) (last rws) + fmt rw = concat (map (uncurry rjust) (zip2 cws rw)) + + +rows :: num->[[num]] +rows n = rows' [1..n] [1..] + where rows' [] ns = [] + rows' (l:ls) ns = row : rows' ls rest + where (row, rest) = split l ns + +split :: num->[*]->([*],[*]) +split n ls = (take n ls, drop n ls) + +rjust :: num->num->[char] +rjust w n = reverse (take w (reverse (show n) ++ repeat ' ')) + +width :: num->num +width = (#) . show + +uncurry :: (*->**->***)->(*,**)->*** +uncurry f (a,b) = f a b diff --git a/Task/Floyds-triangle/OCaml/floyds-triangle.ocaml b/Task/Floyds-triangle/OCaml/floyds-triangle.ml similarity index 100% rename from Task/Floyds-triangle/OCaml/floyds-triangle.ocaml rename to Task/Floyds-triangle/OCaml/floyds-triangle.ml diff --git a/Task/Floyds-triangle/Objeck/floyds-triangle.objeck b/Task/Floyds-triangle/Objeck/floyds-triangle.objeck new file mode 100644 index 0000000000..567e784e01 --- /dev/null +++ b/Task/Floyds-triangle/Objeck/floyds-triangle.objeck @@ -0,0 +1,20 @@ +class Floyds { + function : Main(args : String[]) ~ Nil { + PrintTriangle(5); + PrintTriangle(14); + } + + function : PrintTriangle(n : Int) ~ Nil { + "{$n} rows:"->PrintLine(); + + rowNum := 1; printMe := 1; numsPrinted := 0; + for(; rowNum <= n; printMe++;){ + "{$printMe}\t"->Print(); + + if(++numsPrinted = rowNum){ + ""->PrintLine(); + rowNum++; numsPrinted := 0; + } + } + } +} diff --git a/Task/Floyds-triangle/PL-M/floyds-triangle.plm b/Task/Floyds-triangle/PL-M/floyds-triangle.plm new file mode 100644 index 0000000000..86f92c8938 --- /dev/null +++ b/Task/Floyds-triangle/PL-M/floyds-triangle.plm @@ -0,0 +1,49 @@ +100H: +BDOS: PROCEDURE (FN, ARG); DECLARE FN BYTE, ARG ADDRESS; GO TO 5; END BDOS; +EXIT: PROCEDURE; GO TO 0; END EXIT; +PRINT: PROCEDURE (S); DECLARE S ADDRESS; CALL BDOS(9,S); END PRINT; + + +PUT$NUM: PROCEDURE (N, WIDTH); + DECLARE S (6) BYTE INITIAL (' $'); + DECLARE N ADDRESS, (I, WIDTH) BYTE; + I = 5; +DIGIT: + S(I := I-1) = N MOD 10 + '0'; + IF (N := N/10) > 0 THEN GO TO DIGIT; + DO I=I-1 TO 0 BY -1; + S(I) = ' '; + END; + CALL PRINT(.S(6-WIDTH)); +END PUT$NUM; + +WIDTH: PROCEDURE (N) BYTE; + DECLARE (N, W) BYTE; + W = 1; + DO WHILE N>0; + N = N/10; + W = W+1; + END; + RETURN W; +END WIDTH; + +FLOYD: PROCEDURE (ROWS); + DECLARE (ROWS, ROW, COL) BYTE; + DECLARE (N, MAXNO) ADDRESS; + + MAXNO = ROWS * (ROWS+1)/2; + N = 1; + DO ROW = 1 TO ROWS; + DO COL = 1 TO ROW; + CALL PUT$NUM(N, 1 + WIDTH(MAXNO - ROWS + COL)); + N = N+1; + END; + CALL PRINT(.(13,10,'$')); + END; +END FLOYD; + +CALL FLOYD(5); +CALL PRINT(.(13,10,'$')); +CALL FLOYD(14); +CALL EXIT; +EOF diff --git a/Task/Floyds-triangle/PascalABC.NET/floyds-triangle.pas b/Task/Floyds-triangle/PascalABC.NET/floyds-triangle.pas new file mode 100644 index 0000000000..4bdce7f681 --- /dev/null +++ b/Task/Floyds-triangle/PascalABC.NET/floyds-triangle.pas @@ -0,0 +1,19 @@ +procedure FloydTriangle(rows: integer); +begin + var r := 1; + for var i:=1 to rows do + begin + for var j:=1 to i do + begin + Write(r: (j>8 ? 4 : 3)); + r += 1; + end; + Writeln + end; +end; + +begin + FloydTriangle(5); + Writeln; + FloydTriangle(14); +end. diff --git a/Task/Floyds-triangle/Phix/floyds-triangle.phix b/Task/Floyds-triangle/Phix/floyds-triangle.phix index 590838b99c..114ef290dc 100644 --- a/Task/Floyds-triangle/Phix/floyds-triangle.phix +++ b/Task/Floyds-triangle/Phix/floyds-triangle.phix @@ -1,20 +1,18 @@ -(phixonline)--> - with javascript_semantics - procedure Floyds_triangle(integer n) - sequence widths = repeat(0,n) - integer k = (n * (n-1))/2 - for i=1 to n do - widths[i] = sprintf("%%%dd",length(sprintf("%d",i+k))+1) - end for - k = 1 - for i=1 to n do - for j=1 to i do - printf(1,widths[j],k) - k += 1 - end for - printf(1,"\n") - end for - end procedure - Floyds_triangle(5) - Floyds_triangle(14) - - printf(1,"%09.3f\n",7.125) - - with javascript_semantics - include mpfr.e - mpz primorial = mpz_init(1), - pj = mpz_init() - sequence fortunates = {} - for p=1 to 75 do - mpz_mul_si(primorial,primorial,get_prime(p)) - integer j = 3 - mpz_add_si(pj,primorial,3) - while not mpz_prime(pj) do - mpz_add_si(pj,pj,2) - j = j + 2 - end while - fortunates &= j - end for - fortunates = unique(deep_copy(fortunates))[1..50] - fortunates = join_by(apply(true,sprintf,{{"%3d"},fortunates}),1,10) - printf(1,"The first 50 distinct fortunate numbers are:\n%s\n",{fortunates}) - - with javascript_semantics - function fwd_diff_n(sequence s, integer order) - assert(order<length(s)) - s = deep_copy(s) - for i=1 to order do - for j=1 to length(s)-1 do - s[j] = s[j+1]-s[j] - end for - s = s[1..-2] - end for - return s - end function +with javascript_semantics +function fwd_diff_n(sequence s, integer order) + assert(orderconstant s = {90, 47, 58, 29, 22, 32, 55, 5, 55, 73} - for i=1 to 9 do - ?fwd_diff_n(s,i) - end for - - with javascript_semantics - function xor_gate(bool a, bool b) - return (a and not b) or (not a and b) - end function +with javascript_semantics +constant inf = 1e300*1e300, -- (works on both 32 and 64 bit) + ninf = -inf, + nan = -(inf/inf), + nzero = -1/inf -- (not supported) - function half_adder(bool a, bool b) - bool s = xor_gate(a,b), - c = a and b - return {s,c} - end function - - function full_adder(bool a, bool b, bool c) - bool {s1,c1} = half_adder(c,a), - {s2,c2} = half_adder(s1,b) - c = c1 or c2 - return {s2,c} - end function - - function four_bit_adder(bool a0, a1, a2, a3, b0, b1, b2, b3) - bool s0,s1,s2,s3,c - {s0,c} = full_adder(a0,b0,0) - {s1,c} = full_adder(a1,b1,c) - {s2,c} = full_adder(a2,b2,c) - {s3,c} = full_adder(a3,b3,c) - return {s3,s2,s1,s0,c} - end function - - procedure test(integer a, integer b) - bool {a0,a1,a2,a3} = int_to_bits(a,4), - {b0,b1,b2,b3} = int_to_bits(b,4), - {r3,r2,r1,r0,c} = four_bit_adder(a0,a1,a2,a3,b0,b1,b2,b3) - integer r = bits_to_int({r0,r1,r2,r3}) - string s = iff(c?sprintf(" [=%d+16]",r):"") - printf(1,"%04b + %04b = %04b %b (%d+%d=%d%s)\n",{a,b,r,c,a,b,c*16+r,s}) - end procedure - - test(0,0) - test(0,1) - test(0b1111,0b1111) - test(3,7) - test(11,8) - test(0b1100,0b1100) - test(0b1100,0b1101) - test(0b1100,0b1110) - test(0b1100,0b1111) - test(0b1101,0b0000) - test(0b1101,0b0001) - test(0b1101,0b0010) - test(0b1101,0b0011) - a^b ) + + [ 2dup and + dip xor ] is halfadder ( a b --> s c ) + + [ halfadder + dip halfadder or ] is fulladder ( a b c --> s c ) + + [ 4 pack reverse unpack + 4 times [ temp put ] + 4 pack reverse + 0 swap witheach + [ temp take fulladder ] + 5 pack reverse unpack ] is 4bitadder ( b3 b2 b1 b0 a3 a2 a1 a0 --> c s3 s2 s1 s0 ) + + say "1100 + 1100 = " + 1 1 0 0 1 1 0 0 4bitadder + 5 pack witheach echo + cr + say "1100 + 1101 = " + 1 1 0 0 1 1 0 1 4bitadder + 5 pack witheach echo + cr + say "1100 + 1110 = " + 1 1 0 0 1 1 1 0 4bitadder + 5 pack witheach echo + cr + say "1100 + 1111 = " + 1 1 0 0 1 1 1 1 4bitadder + 5 pack witheach echo + cr + say "1101 + 0000 = " + 1 1 0 1 0 0 0 0 4bitadder + 5 pack witheach echo + cr + say "1101 + 0001 = " + 1 1 0 1 0 0 0 1 4bitadder + 5 pack witheach echo + cr + say "1101 + 0010 = " + 1 1 0 1 0 0 1 0 4bitadder + 5 pack witheach echo + cr + say "1101 + 0011 = " + 1 1 0 1 0 0 1 1 4bitadder + 5 pack witheach echo + cr diff --git a/Task/Four-bit-adder/Rust/four-bit-adder.rust b/Task/Four-bit-adder/Rust/four-bit-adder.rs similarity index 100% rename from Task/Four-bit-adder/Rust/four-bit-adder.rust rename to Task/Four-bit-adder/Rust/four-bit-adder.rs diff --git a/Task/Four-bit-adder/Scheme/four-bit-adder.ss b/Task/Four-bit-adder/Scheme/four-bit-adder.scm similarity index 100% rename from Task/Four-bit-adder/Scheme/four-bit-adder.ss rename to Task/Four-bit-adder/Scheme/four-bit-adder.scm diff --git a/Task/Four-bit-adder/VHDL/four-bit-adder-1.vhdl b/Task/Four-bit-adder/VHDL/four-bit-adder-1.vhd similarity index 100% rename from Task/Four-bit-adder/VHDL/four-bit-adder-1.vhdl rename to Task/Four-bit-adder/VHDL/four-bit-adder-1.vhd diff --git a/Task/Four-bit-adder/VHDL/four-bit-adder-2.vhdl b/Task/Four-bit-adder/VHDL/four-bit-adder-2.vhd similarity index 100% rename from Task/Four-bit-adder/VHDL/four-bit-adder-2.vhdl rename to Task/Four-bit-adder/VHDL/four-bit-adder-2.vhd diff --git a/Task/Four-is-magic/ALGOL-68/four-is-magic.alg b/Task/Four-is-magic/ALGOL-68/four-is-magic.alg new file mode 100644 index 0000000000..acc82a0e68 --- /dev/null +++ b/Task/Four-is-magic/ALGOL-68/four-is-magic.alg @@ -0,0 +1,79 @@ +BEGIN # construct number names from a number # + MODE NUMBER = LONG INT; # adjust to suit, must be at least 64 bits # + OP TOINT = ( NUMBER n )INT: SHORTEN n; # adjust to suit # + []STRING units + = ( "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" ); + []STRING teens + = ( "ten", "eleven", "twelve", "thirteen", "fourteen" + , "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" + ); + []STRING tens + = ( "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" ); + []STRING power suffix + = ( "thousand", "million", "billion", "trillion", "quadrillion", "quintillion" ); + # returns n converted to a number name, n must be in range 1-99 # + PROC two digits = ( INT n )STRING: + IF n < 10 + THEN units[ n ] + ELIF n < 20 + THEN teens[ n - 9 ] + ELIF INT last1 = n MOD 10; + last1 = 0 + THEN tens[ ( n OVER 10 ) - 1 ] + ELSE tens[ ( n OVER 10 ) - 1 ] + " " + units[ last1 ] + FI # two digits # ; + # returns n converted to a number name, n must be in range 1-999 # + PROC three digits = ( INT n )STRING: + IF n < 100 + THEN two digits( n ) + ELIF STRING hundreds = units[ n OVER 100 ] + " hundred"; + INT last2 = n MOD 100; + last2 = 0 + THEN hundreds + ELSE hundreds + " " + two digits( last2 ) + FI # three digits # ; + # returns the "name" of n # + OP NAME = ( NUMBER n )STRING: + IF n < 0 THEN "negative " + NAME - n + ELIF n = 0 THEN "zero" + ELSE # have a positive number to name # + NUMBER v := n; + STRING result := ""; + INT power pos := 0; + WHILE v /= 0 DO + IF INT v999 = TOINT ( v MOD 1000 ); + v999 /= 0 + THEN STRING component := three digits( v999 ); + IF power pos > 0 THEN + component +:= " " + power suffix[ power pos ] + FI; + IF result /= "" THEN component +:= " " FI; + component +=: result + FI; + power pos +:= 1; + v OVERAB 1000 + OD; + result + FI # NAME # ; + # returns the "x is y, y is z, ... four is magic" sequence derived from n # + OP MAGIC = ( NUMBER n )STRING: + BEGIN + NUMBER v := n; + STRING result := ""; + WHILE v /= 4 DO + IF result /= "" THEN result +:= ", " FI; + STRING v name = NAME v; + v := ( UPB v name - LWB v name ) + 1; + result +:= v name + " is " + NAME v + OD; + IF result /= "" THEN result +:= ", " FI; + result + "four is magic" + END # MAGIC # ; + # test cases # + []NUMBER t = ( 0, 1, 2, 3, 4, 5, 100, 101, 272, 1701, 1968, 4077, 90 210 + , - 100 001, 987 654, - NUMBER( 8 007 006 005 004 003 ) + ); + FOR n FROM LWB t TO UPB t DO + print( ( whole( t[ n ], -18 ), ": ", MAGIC t[ n ], newline ) ) + OD +END diff --git a/Task/Four-is-magic/Common-Lisp/four-is-magic.lisp b/Task/Four-is-magic/Common-Lisp/four-is-magic.lisp index d8fa958084..4f8ab2f47b 100644 --- a/Task/Four-is-magic/Common-Lisp/four-is-magic.lisp +++ b/Task/Four-is-magic/Common-Lisp/four-is-magic.lisp @@ -5,3 +5,6 @@ while (/= n 4) do (format out "~A is ~R, " c (length c)) finally (format out "four is magic."))))) +(loop for n + in '( -1 0 1 2 3 4 5 6 7 8 9 11 21 1995 1000000 1234567890 1100100100100 ) + do (print (integer-to-text n))) diff --git a/Task/Four-is-magic/Crystal/four-is-magic.cr b/Task/Four-is-magic/Crystal/four-is-magic.cr new file mode 100644 index 0000000000..dc96957870 --- /dev/null +++ b/Task/Four-is-magic/Crystal/four-is-magic.cr @@ -0,0 +1,59 @@ +struct Int + THOU_PREFIXES = %w(undec dec non oct sept sext quint quadr tr b m) + .map(&.+("illion")) + ["thousand", ""] + TENS = ["", ""] + %w(twen thir for fif six seven eigh nine).map &.+("ty") + ONES = [""] + %w(one two three four five six seven eight nine ten) + + %w(eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen) + def to_words + raise "Number to big to express in words" unless self.abs <= Int128::MAX + return "zero" if self == 0 + String.build do |s| + n = self + if n < 0 + s << "negative " + n = n.abs + end + ths = Array(Int128).new(THOU_PREFIXES.size, 0) + (0...ths.size).reverse_each do |idx| + n, ths[idx] = n.divmod(1000) + end + ths.zip(THOU_PREFIXES).each do |th, pref| + next if th == 0 + hundreds, rest = th.divmod 100 + s << ONES[hundreds] << " hundred " if hundreds > 0 + if rest < 20 + s << ONES[rest] << " " if rest > 0 + else + tens, ones = rest.divmod 10 + s << TENS[tens] + s << "-" << ONES[ones] if ones > 0 + s << " " + end + s << pref << " " if pref != "" + end + s.chomp! 32u8 + end + end +end + +def sequence (io, n) + words = n.to_words.capitalize + loop do + io << words << " is " + break if n == 4 + n = words.size + words = n.to_words + io << words << ", " + end + io << "magic." +end + +def sequence (n) + String.build do |s| + sequence s, n + end +end + +[0, 4, 6, 11, 13, 75, 337, -164, 9_876_543_209, Int128::MAX].each do |start| + puts "- " + sequence(start) +end diff --git a/Task/Four-is-magic/Delphi/four-is-magic.delphi b/Task/Four-is-magic/Delphi/four-is-magic.pas similarity index 100% rename from Task/Four-is-magic/Delphi/four-is-magic.delphi rename to Task/Four-is-magic/Delphi/four-is-magic.pas diff --git a/Task/Four-is-magic/EasyLang/four-is-magic.easy b/Task/Four-is-magic/EasyLang/four-is-magic.easy new file mode 100644 index 0000000000..c37be2eb43 --- /dev/null +++ b/Task/Four-is-magic/EasyLang/four-is-magic.easy @@ -0,0 +1,63 @@ +small$[] = [ "zero" "one" "two" "three" "four" "five" "six" "seven" "eight" "nine" "ten" "eleven" "twelve" "thirteen" "fourteen" "fifteen" "sixteen" "seventeen" "eighteen" "nineteen" ] +tens$[] = [ "" "" "twenty" "thirty" "forty" "fifty" "sixty" "seventy" "eighty" "ninety" ] +illions$[] = [ "" " thousand" " million" " billion" " trillion" " quadrillion" " quintillion" ] +func$ say n . + if n < 0 + t$ = "negative " + n = -n + . + if n < 20 + t$ &= small$[n + 1] + elif n < 100 + t$ &= tens$[n div 10 + 1] + s = n mod 10 + if s > 0 + t$ &= "-" & small$[s + 1] + . + elif n < 1000 + t$ &= small$[n div 100 + 1] & " hundred" + s = n mod 100 + if s > 0 + t$ &= " " & say s + . + else + i = 1 + while n > 0 + p = n mod 1000 + n = n div 1000 + if p > 0 + ix$ = say p & illions$[i] + if sx$ <> "" + ix$ &= " " & sx$ + . + sx$ = ix$ + . + i += 1 + . + t$ &= sx$ + . + return t$ +. +# +func$ toupper c$ . + c = strcode c$ + if c >= 97 and c <= 122 + c$ = strchar (c - 32) + . + return c$ +. +func$ four_is_magic n . + s$ = say n + s$ = toupper substr s$ 1 1 & substr s$ 2 99999 + t$ = s$ + while n <> 4 + n = len s$ + s$ = say n + t$ &= " is " & s$ & ", " & s$ + . + t$ &= " is magic." + return t$ +. +for n in [ 6 13 75 111 337 99999999 ] + print four_is_magic n +. diff --git a/Task/Four-is-magic/FutureBasic/four-is-magic.basic b/Task/Four-is-magic/FutureBasic/four-is-magic.basic new file mode 100644 index 0000000000..eb12b04ea0 --- /dev/null +++ b/Task/Four-is-magic/FutureBasic/four-is-magic.basic @@ -0,0 +1,31 @@ +include "NSLog.incl" + +local fn FourIsMagic( number as CFNumberRef ) as CFStringRef + CFMutableStringRef result = fn MutableStringNew + NumberFormatterRef formatter = fn NumberFormatterWithStyle( NSNumberFormatterSpellOutStyle ) + NumberFormatterSetLocale( formatter, fn LocaleWithIdentifier( @"en_EN" ) ) + CFStringRef numberString = fn NumberFormatterStringFromNumber( formatter, number ) + MutableStringAppendString( result, fn StringCapitalizedString( numberString ) ) + + while ( fn StringIsEqual( numberString, @"four" ) == NO ) + numberString = fn NumberFormatterStringFromNumber( formatter, fn NumberWithInteger( len(numberString) ) ) + MutableStringAppendString( result, fn StringWithFormat( @" is %@, %@", numberString, numberString ) ) + wend + MutableStringAppendString( result, @" is magic." ) +end fn = result + +NSInteger i +CFNumberRef testInput +CFArrayRef testNumbers : testNumbers = @[@23, @1000000000, @20140, @100, @130, @151, @-7] + +NSLog( @"Outputs 0 through 9:\n" ) +for i = 0 to 9 + NSLog( @"%@", fn FourIsMagic( fn NumberWithInteger( i ) ) ) +next + +NSLog( @"\nOther number tests:\n" ) +for testInput in testNumbers + NSLog( @"%@", fn FourIsMagic( testInput ) ) +next + +HandleEvents diff --git a/Task/Four-is-magic/Julia/four-is-magic.julia b/Task/Four-is-magic/Julia/four-is-magic.jl similarity index 100% rename from Task/Four-is-magic/Julia/four-is-magic.julia rename to Task/Four-is-magic/Julia/four-is-magic.jl diff --git a/Task/Four-is-magic/Kotlin/four-is-magic.kotlin b/Task/Four-is-magic/Kotlin/four-is-magic.kts similarity index 100% rename from Task/Four-is-magic/Kotlin/four-is-magic.kotlin rename to Task/Four-is-magic/Kotlin/four-is-magic.kts diff --git a/Task/Four-is-magic/M2000-Interpreter/four-is-magic.m2000 b/Task/Four-is-magic/M2000-Interpreter/four-is-magic.m2000 new file mode 100644 index 0000000000..08efda8634 --- /dev/null +++ b/Task/Four-is-magic/M2000-Interpreter/four-is-magic.m2000 @@ -0,0 +1,67 @@ +module Four_is_magic { + numname=lambda ->{ + flush + data "", "one", "two", "three", "four" + data "five", "six", "seven", "eight", "nine", "ten" + data "eleven", "twelve", "thirteen", "fourteen", "fifteen" + data "sixteen", "seventeen","eighteen", "nineteen" + dim lows(), tens(), lev() + lows()=array([]) + data "", "", "twenty", "thirty", "forty","fifty", "sixty" + data "seventy", "eighty", "ninety" + tens()=array([]) + lev()=("", "thousand", "million", "billion") + =lambda lows(), tens(), lev() (n as long) -> { + if n=0 then ="zero": exit + long i, tr : boolean t : string ret, prefix + if n < 0 then prefix= "negative ": n-! else prefix="" + while n>0 {push n mod 1000: n|div 1000} + t=stack.size>1 + while not empty { + tripn="" : read tr : if tr=0 then continue + lt= tr mod 100 : h= tr div 100 + if lt<20 then + tripn+=lows(lt) + else + tripn=tens(lt div 10)+if$(lt mod 10 >0 ->"-"+lows(lt mod 10),"") + end if + if h>0 then tripn = lows(h)+" hundred " + tripn + if empty then if t and h = 0 then tripn = " and " + tripn + ret+=tripn+" "+lev(stack.size)+" " + } + =prefix+trim$(ret) + } + }() + TitleStr=lambda (s as string) ->{ + =ucase$(left$(s,1))+mid$(s, 2) + } + magic=lambda numname, TitleStr (n as integer)-> { + first$=numname(n) + count$=numname(len(first$)) + while first$<>"four" + data first$+" is "+count$ + swap first$, count$ + count$=numname(len(first$)) + end while + data "four is magic." + =TitleStr(array([])#str$(", ")) + } + document doc$ + for i=0 to 9 + doc$ = magic(i)+{ + } + next + doc$ = magic(23)+{ + } + doc$ = magic(130)+{ + } + doc$ = magic(151)+{ + } + doc$ = magic(-7)+{ + } + doc$ = magic(20140)+{ + } + report doc$ + clipboard doc$ +} +Four_is_magic diff --git a/Task/Four-is-magic/Phix/four-is-magic.phix b/Task/Four-is-magic/Phix/four-is-magic.phix index 0fb9f78183..e826307ded 100644 --- a/Task/Four-is-magic/Phix/four-is-magic.phix +++ b/Task/Four-is-magic/Phix/four-is-magic.phix @@ -1,80 +1,77 @@ -(phixonline)--> - with javascript_semantics - --<adapted from demo\rosetta\number_names.exw, which alas outputs ",", "and", uses "minus" instead of "negative", etc...> - constant twenties = {"zero","one","two","three","four","five","six","seven","eight","nine","ten", - "eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"}, - decades = {"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"} +with javascript_semantics +constant twenties = {"zero","one","two","three","four","five","six","seven","eight","nine","ten", + "eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"}, + decades = {"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"} - function hundred(integer n) - if n<20 then - return twenties[mod(n,20)+1] - elsif mod(n,10)=0 then - return decades[mod(floor(n/10),10)-1] - end if - return decades[mod(floor(n/10),10)-1] & '-' & twenties[mod(n,10)+1] - end function +function hundred(integer n) + if n<20 then + return twenties[mod(n,20)+1] + elsif mod(n,10)=0 then + return decades[mod(floor(n/10),10)-1] + end if + return decades[mod(floor(n/10),10)-1] & '-' & twenties[mod(n,10)+1] +end function - function thousand(integer n) - if n<100 then - return hundred(n) - elsif mod(n,100)=0 then - return twenties[mod(floor(n/100),20)+1]&" hundred" - end if - return twenties[mod(floor(n/100),20)+1] & " hundred " & hundred(mod(n,100)) - end function +function thousand(integer n) + if n<100 then + return hundred(n) + elsif mod(n,100)=0 then + return twenties[mod(floor(n/100),20)+1]&" hundred" + end if + return twenties[mod(floor(n/100),20)+1] & " hundred " & hundred(mod(n,100)) +end function - constant orders = {{power(10,12),"trillion"}, - {power(10,9),"billion"}, - {power(10,6),"million"}, - {power(10,3),"thousand"}} +constant orders = {{power(10,12),"trillion"}, + {power(10,9),"billion"}, + {power(10,6),"million"}, + {power(10,3),"thousand"}} - function triplet(integer n) - string res = "" - for i=1 to length(orders) do - {atom order, string name} = orders[i] - atom high = floor(n/order), - low = mod(n,order) - if high!=0 then - res &= thousand(high)&' '&name - end if - n = low - if low=0 then exit end if - if length(res) and high!=0 then - res &= " " - end if - end for - if n!=0 or res="" then - res &= thousand(floor(n)) - end if - return res - end function +function triplet(integer n) + string res = "" + for i=1 to length(orders) do + {atom order, string name} = orders[i] + atom high = floor(n/order), + low = mod(n,order) + if high!=0 then + res &= thousand(high)&' '&name + end if + n = low + if low=0 then exit end if + if length(res) and high!=0 then + res &= " " + end if + end for + if n!=0 or res="" then + res &= thousand(floor(n)) + end if + return res +end function - function spell(integer n) - string res = "" - if n<0 then - res = "negative " - n = -n - end if - res &= triplet(n) - return res - end function - --</adapted from number_names.exw> +function spell(integer n) + string res = "" + if n<0 then + res = "negative " + n = -n + end if + res &= triplet(n) + return res +end function +-- - function fourIsMagic(atom n) - string s = spell(n) - s[1] = upper(s[1]) - string t = s - while n!=4 do - n = length(s) - s = spell(n) - t &= " is " & s & ", " & s - end while - t &= " is magic.\n" - return t - end function +function fourIsMagic(atom n) + string s = spell(n) + s[1] = upper(s[1]) + string t = s + while n!=4 do + n = length(s) + s = spell(n) + t &= " is " & s & ", " & s + end while + t &= " is magic.\n" + return t +end function - constant tests = {-7, -1, 0, 1, 2, 3, 4, 23, 1e9, 20140, 100, 130, 151, 999999} - for i=1 to length(tests) do - puts(1,fourIsMagic(tests[i])) - end for - %d/%d (removed %d)".fmt(xn,xd,yn,yd,k+1)); - } - } + foreach k in ([0..8]){ + yn,yd := rn[k],rd[k]; + if(yn!=0 and yd!=0 and + xn.toFloat()/xd.toFloat() == yn.toFloat()/yd.toFloat()){ + count+=1; + omitted[k]+=1; + if(count<=12) + println("%d/%d --> %d/%d (removed %d)".fmt(xn,xd,yn,yd,k+1)); + } + } } } println("%d-digit fractions found: %d, omitted %s\n" diff --git a/Task/Fractran/ALGOL-68/fractran.alg b/Task/Fractran/ALGOL-68/fractran.alg index c1d894374e..2908205a60 100644 --- a/Task/Fractran/ALGOL-68/fractran.alg +++ b/Task/Fractran/ALGOL-68/fractran.alg @@ -1,6 +1,6 @@ # as the numbers required for finding the first 20 primes are quite large, # -# we use Algol 68G's LONG LONG INT with a precision of 100 digits # -PR precision 100 PR +# we use Algol 68G's LONG LONG INT with a precision of 200 digits # +PR precision 200 PR # mode to hold fractions # MODE FRACTION = STRUCT( INT numerator, INT denominator ); @@ -9,16 +9,16 @@ MODE FRACTION = STRUCT( INT numerator, INT denominator ); OP / = ( INT a, b )FRACTION: ( a, b ); # mode to define a FRACTRAN progam # -MODE FRACTRAN = STRUCT( FLEX[0]FRACTION data +MODE FRACTRAN = STRUCT( [0]FRACTION data , LONG LONG INT n , BOOL halted ); # prepares a FRACTRAN program for use - sets the initial value of n and halted to FALSE # PRIO STARTAT = 1; -OP STARTAT = ( REF FRACTRAN f, INT start )REF FRACTRAN: +OP STARTAT = ( REF FRACTRAN f, INT start p )REF FRACTRAN: BEGIN halted OF f := FALSE; - n OF f := start; + n OF f := start p; f END; @@ -39,36 +39,39 @@ OP NEXT = ( REF FRACTRAN f )LONG LONG INT: FI ; # generate and print the sequence of numbers from a FRACTRAN pogram # -PROC print fractran sequence = ( REF FRACTRAN f, INT start, INT limit )VOID: +PROC print fractran sequence = ( REF FRACTRAN f, INT start p, INT limit )VOID: BEGIN - VOID( f STARTAT start ); - print( ( "0: ", whole( start, 0 ) ) ); + VOID( f STARTAT start p ); + print( ( "0: ", whole( start p, 0 ) ) ); FOR i TO limit WHILE VOID( NEXT f ); NOT halted OF f DO - print( ( " " + whole( i, 0 ) + ": " + whole( n OF f, 0 ) ) ) + print( ( " ", whole( i, 0 ), ":", whole( n OF f, 0 ) ) ) OD; print( ( newline ) ) END ; # print the first 16 elements from the primes FRACTRAN program # -FRACTRAN pf := ( ( 17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1 ), 0, FALSE ); +FRACTRAN pf := ( ( 17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13 + , 13/11, 15/14, 15/2, 55/1 ), 0, FALSE ); print fractran sequence( pf, 2, 15 ); # find some primes using the pf FRACTRAN progam - n is prime for the members in the sequence that are 2^n # -INT primes found := 0; -VOID( pf STARTAT 2 ); -INT pos := 0; -print( ( "seq position prime sequence value", newline ) ); -WHILE primes found < 20 AND NOT halted OF pf DO - LONG LONG INT value := NEXT pf; - INT power of 2 := 0; - pos +:= 1; - WHILE value MOD 2 = 0 AND value > 0 DO power of 2 PLUSAB 1; value OVERAB 2 OD; - IF value = 1 THEN - # found a prime # - primes found +:= 1; - print( ( whole( pos, -12 ) + " " + whole( power of 2, -6 ) + " (" + whole( n OF pf, 0 ) + ")", newline ) ) - FI -OD +BEGIN + INT primes found := 0; + VOID( pf STARTAT 2 ); + INT pos := 0; + print( ( "seq position prime sequence value", newline ) ); + WHILE primes found < 20 AND NOT halted OF pf DO + LONG LONG INT value := NEXT pf; + INT power of 2 := 0; + pos +:= 1; + WHILE value MOD 2 = 0 AND value > 0 DO power of 2 PLUSAB 1; value OVERAB 2 OD; + IF value = 1 THEN + primes found +:= 1; + print( ( whole( pos, -12 ), " ", whole( power of 2, -6 ) ) ); + print( ( " (" + whole( n OF pf, 0 ), ")", newline ) ) + FI + OD +END diff --git a/Task/Fractran/Ada/fractran.ada b/Task/Fractran/Ada/fractran.ada deleted file mode 100644 index 90f1a8e4db..0000000000 --- a/Task/Fractran/Ada/fractran.ada +++ /dev/null @@ -1,43 +0,0 @@ -with Ada.Text_IO; - -procedure Fractan is - - type Fraction is record Nom: Natural; Denom: Positive; end record; - type Frac_Arr is array(Positive range <>) of Fraction; - - function "/" (N: Natural; D: Positive) return Fraction is - Frac: Fraction := (Nom => N, Denom => D); - begin - return Frac; - end "/"; - - procedure F(List: Frac_Arr; Start: Positive; Max_Steps: Natural) is - N: Positive := Start; - J: Positive; - begin - Ada.Text_IO.Put(" 0:" & Integer'Image(N) & " "); - for I in 1 .. Max_Steps loop - J := List'First; - loop - if N mod List(J).Denom = 0 then - N := (N/List(J).Denom) * List(J).Nom; - exit; -- found fraction - elsif J >= List'Last then - return; -- did try out all fractions - else - J := J + 1; -- try the next fraction - end if; - end loop; - Ada.Text_IO.Put(Integer'Image(I) & ":" & Integer'Image(N) & " "); - end loop; - end F; - -begin - -- F((2/3, 7/2, 1/5, 1/7, 1/9, 1/4, 1/8), 2, 100); - -- output would be "0: 2 1: 7 2: 1" and then terminate - - F((17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, - 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1), - 2, 15); - -- output is "0: 2 1: 15 2: 825 3: 725 ... 14: 132 15: 116" -end Fractan; diff --git a/Task/Fractran/Ada/fractran.adb b/Task/Fractran/Ada/fractran.adb new file mode 100644 index 0000000000..b80338cfca --- /dev/null +++ b/Task/Fractran/Ada/fractran.adb @@ -0,0 +1,43 @@ +with Ada.Text_IO; + +procedure Fractan is + + type Fraction is record Nom: Natural; Denom: Positive; end record; + type Frac_Arr is array(Positive range <>) of Fraction; + + function "/" (N: Natural; D: Positive) return Fraction is + Frac: Fraction := (Nom => N, Denom => D); + begin + return Frac; + end "/"; + + procedure F(List: Frac_Arr; Start: Positive; Max_Steps: Natural) is + N: Positive := Start; + J: Positive; + begin + Ada.Text_IO.Put(" 0:" & Integer'Image(N) & " "); + for I in 1 .. Max_Steps loop + J := List'First; + loop + if N mod List(J).Denom = 0 then + N := (N/List(J).Denom) * List(J).Nom; + exit; -- found fraction + elsif J >= List'Last then + return; -- did try out all fractions + else + J := J + 1; -- try the next fraction + end if; + end loop; + Ada.Text_IO.Put(Integer'Image(I) & ":" & Integer'Image(N) & " "); + end loop; + end F; + +begin + -- F((2/3, 7/2, 1/5, 1/7, 1/9, 1/4, 1/8), 2, 100); + -- output would be "0: 2 1: 7 2: 1" and then terminate + + F((17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, + 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1), + 2, 15); + -- output is "0: 2 1: 15 2: 825 3: 725 ... 14: 132 15: 116" +end Fractan; diff --git a/Task/Fractran/Batch-File/fractran.bat b/Task/Fractran/Batch-File/fractran.bat index 956eee44cc..75fe098b0a 100644 --- a/Task/Fractran/Batch-File/fractran.bat +++ b/Task/Fractran/Batch-File/fractran.bat @@ -1,41 +1,41 @@ @echo off setlocal enabledelayedexpansion - ::Set the inputs + ::Set the inputs set "code=17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 1/17 11/13 13/11 15/14 15/2 55/1" set "n=2" - ::Basic validation of code + ::Basic validation of code for %%. in (!code!) do ( - echo.%%.|findstr /r /c:"^[0-9][0-9]*/[1-9][0-9]*$">nul||goto error_code + echo.%%.|findstr /r /c:"^[0-9][0-9]*/[1-9][0-9]*$">nul||goto error_code ) - ::Validate the input + ::Validate the input set /a "tst=1*!n!" 2>nul if !tst! lss 0 goto error_input if !tst! equ 0 (if not "!n!"=="0" (goto error_input)) - ::Set the limit outputs - set limit=20 + ::Set the limit outputs + set limit=20 - ::Execute the code + ::Execute the code echo.Input: -echo. !n! +echo. !n! echo.Output: for /l %%? in (1,1,!limit!) do ( - set shouldwehalt=1 - for %%A in (!code!) do ( - for /f "tokens=1,2 delims=/" %%B in ("%%A") do ( - set /a "tst=!n! %% %%C" - if !tst! equ 0 ( - if !shouldwehalt! equ 1 ( - set shouldwehalt=0 - set /a "n=n*%%B/%%C" - echo. !n! - ) - ) - ) - ) - if !shouldwehalt! equ 1 goto halt + set shouldwehalt=1 + for %%A in (!code!) do ( + for /f "tokens=1,2 delims=/" %%B in ("%%A") do ( + set /a "tst=!n! %% %%C" + if !tst! equ 0 ( + if !shouldwehalt! equ 1 ( + set shouldwehalt=0 + set /a "n=n*%%B/%%C" + echo. !n! + ) + ) + ) + ) + if !shouldwehalt! equ 1 goto halt ) :halt diff --git a/Task/Fractran/C++/fractran.cpp b/Task/Fractran/C++/fractran.cpp index 0f68fa192b..a3d5f34195 100644 --- a/Task/Fractran/C++/fractran.cpp +++ b/Task/Fractran/C++/fractran.cpp @@ -16,44 +16,44 @@ public: copy( istream_iterator( iss ), istream_iterator(), back_inserter >( tmp ) ); string item; vector< pair > v; - pair a; - for( vector::iterator i = tmp.begin(); i != tmp.end(); i++ ) - { - string::size_type pos = ( *i ).find( '/', 0 ); - if( pos != std::string::npos ) - { - a = make_pair( atof( ( ( *i ).substr( 0, pos ) ).c_str() ), atof( ( ( *i ).substr( pos + 1 ) ).c_str() ) ); - v.push_back( a ); - } - } - - exec( &v ); + pair a; + for( vector::iterator i = tmp.begin(); i != tmp.end(); i++ ) + { + string::size_type pos = ( *i ).find( '/', 0 ); + if( pos != std::string::npos ) + { + a = make_pair( atof( ( ( *i ).substr( 0, pos ) ).c_str() ), atof( ( ( *i ).substr( pos + 1 ) ).c_str() ) ); + v.push_back( a ); + } + } + + exec( &v ); } private: void exec( vector< pair >* v ) { - int cnt = 0; - while( cnt < limit ) - { - cout << cnt << " : " << start << "\n"; - cnt++; - vector< pair >::iterator it = v->begin(); - bool found = false; float r; - while( it != v->end() ) - { - r = start * ( ( *it ).first / ( *it ).second ); - if( r == floor( r ) ) - { - found = true; - break; - } - ++it; - } + int cnt = 0; + while( cnt < limit ) + { + cout << cnt << " : " << start << "\n"; + cnt++; + vector< pair >::iterator it = v->begin(); + bool found = false; float r; + while( it != v->end() ) + { + r = start * ( ( *it ).first / ( *it ).second ); + if( r == floor( r ) ) + { + found = true; + break; + } + ++it; + } - if( found ) start = ( int )r; - else break; - } + if( found ) start = ( int )r; + else break; + } } int start, limit; }; diff --git a/Task/Fractran/C-sharp/fractran-1.cs b/Task/Fractran/C-sharp/fractran-1.cs new file mode 100644 index 0000000000..a1b546059d --- /dev/null +++ b/Task/Fractran/C-sharp/fractran-1.cs @@ -0,0 +1,92 @@ +namespace System.Numerics +{ + using Fractype = (BigInteger numerator, BigInteger denominator); + struct Quotient + { + private Fractype _frac; + public Fractype Fraction + { + get => _frac; + set => _frac = Reduce(value); + } + + public bool IsIntegral => _frac.denominator == 1; + + public Quotient(BigInteger num, BigInteger den) + { + Fraction = (num, den); + } + + public static BigInteger GCD(BigInteger a, BigInteger b) + { + return (b == 0) ? a : GCD(b, a % b); + } + + private static Fractype Reduce(Fractype f) + { + if (f.denominator == 0) + throw new DivideByZeroException(); + + BigInteger gcd = Quotient.GCD(f.numerator, f.denominator); + return (f.numerator / gcd, f.denominator / gcd); + } + + public static Quotient operator *(Quotient a, Quotient b) + => new Quotient(a._frac.numerator * b._frac.numerator, a._frac.denominator * b._frac.denominator); + + public static Quotient operator *(Quotient a, BigInteger n) + => new Quotient(a._frac.numerator * n, a._frac.denominator); + + public static explicit operator Quotient(Fractype t) => new Quotient(t.numerator, t.denominator); + } + + class FRACTRAN + { + private Quotient[] code; + public FRACTRAN(Fractype[] _code) + { + code = _code.Select(x => (Quotient) x).ToArray(); + } + + public (BigInteger value, bool success) Compute(BigInteger n) + { + for (int i = 0; i < code.Length; i++) + if ((code[i] * n).IsIntegral) + return ((code[i] * n).Fraction.numerator, true); + return (0, false); + } + } + + class Program + { + public static void Main(string[] args) + { + Fractype[] frac_code = args[0].Split(" ") + .Select(x => ((BigInteger)Int32.Parse(x.Split("/")[0]), (BigInteger)Int32.Parse(x.Split("/")[1].Trim(',')))).ToArray(); + BigInteger init = new BigInteger(Int32.Parse(args[1].Trim(','))); + int steps = Int32.Parse(args[2].Trim(',')); + + FRACTRAN FRACGAME = new FRACTRAN(frac_code); + + List sequence = new List(); + sequence.Add(init); + bool halt = false; + for (int i = 0; i < steps - 1; i++) + { + var k = FRACGAME.Compute(sequence[sequence.Count - 1]); + if (k.success) + sequence.Add(k.value); + else + { + halt = true; + break; + } + } + + for (int i = 0; i < sequence.Count; i++) + Console.WriteLine((i + 1).ToString() + ": " + sequence[i]); + if (halt) + Console.WriteLine("HALT"); + } + } +} diff --git a/Task/Fractran/C-sharp/fractran-2.cs b/Task/Fractran/C-sharp/fractran-2.cs new file mode 100644 index 0000000000..14d41b2e3e --- /dev/null +++ b/Task/Fractran/C-sharp/fractran-2.cs @@ -0,0 +1,54 @@ + class Program + { + private static bool PowerOfTwo(BigInteger b) + { + while (b % 2 == 0) + b /= 2; + return b == 1; + } + + private static BigInteger BigLog2(BigInteger b) + { + BigInteger r = 0; + while (b > 1) + { + r++; + b /= 2; + } + return r; + } + + public static void Main(string[] args) + { + Fractype[] frac_code = args[0].Split(" ") + .Select(x => ((BigInteger)Int32.Parse(x.Split("/")[0]), (BigInteger)Int32.Parse(x.Split("/")[1].Trim(',')))).ToArray(); + BigInteger init = new BigInteger(Int32.Parse(args[1].Trim(','))); + int steps = Int32.Parse(args[2].Trim(',')); + + FRACTRAN FRACGAME = new FRACTRAN(frac_code); + + List sequence = new List(); + List primes = new List(); + sequence.Add(init); + bool halt = false; + while (primes.Count() < 20) + { + var k = FRACGAME.Compute(sequence[sequence.Count - 1]); + if (k.success) + sequence.Add(k.value); + else + { + halt = true; + break; + } + + if (PowerOfTwo(k.value)) + primes.Add(BigLog2(k.value)); + } + + for (int i = 0; i < primes.Count; i++) + Console.WriteLine((i + 1).ToString() + ": " + primes[i]); + if (halt) + Console.WriteLine("HALT"); + } + } diff --git a/Task/Fractran/C/fractran.c b/Task/Fractran/C/fractran.c index 6931d47852..1119b05a77 100644 --- a/Task/Fractran/C/fractran.c +++ b/Task/Fractran/C/fractran.c @@ -4,62 +4,62 @@ typedef struct frac_s *frac; struct frac_s { - int n, d; - frac next; + int n, d; + frac next; }; frac parse(char *s) { - int offset = 0; - struct frac_s h = {0}, *p = &h; + int offset = 0; + struct frac_s h = {0}, *p = &h; - while (2 == sscanf(s, "%d/%d%n", &h.n, &h.d, &offset)) { - s += offset; - p = p->next = malloc(sizeof *p); - *p = h; - p->next = 0; - } + while (2 == sscanf(s, "%d/%d%n", &h.n, &h.d, &offset)) { + s += offset; + p = p->next = malloc(sizeof *p); + *p = h; + p->next = 0; + } - return h.next; + return h.next; } int run(int v, char *s) { - frac n, p = parse(s); - mpz_t val; - mpz_init_set_ui(val, v); + frac n, p = parse(s); + mpz_t val; + mpz_init_set_ui(val, v); -loop: n = p; - if (mpz_popcount(val) == 1) - gmp_printf("\n[2^%d = %Zd]", mpz_scan1(val, 0), val); - else - gmp_printf(" %Zd", val); +loop: n = p; + if (mpz_popcount(val) == 1) + gmp_printf("\n[2^%d = %Zd]", mpz_scan1(val, 0), val); + else + gmp_printf(" %Zd", val); - for (n = p; n; n = n->next) { - // assuming the fractions are not reducible - if (!mpz_divisible_ui_p(val, n->d)) continue; + for (n = p; n; n = n->next) { + // assuming the fractions are not reducible + if (!mpz_divisible_ui_p(val, n->d)) continue; - mpz_divexact_ui(val, val, n->d); - mpz_mul_ui(val, val, n->n); - goto loop; - } + mpz_divexact_ui(val, val, n->d); + mpz_mul_ui(val, val, n->n); + goto loop; + } - gmp_printf("\nhalt: %Zd has no divisors\n", val); + gmp_printf("\nhalt: %Zd has no divisors\n", val); - mpz_clear(val); - while (p) { - n = p->next; - free(p); - p = n; - } + mpz_clear(val); + while (p) { + n = p->next; + free(p); + p = n; + } - return 0; + return 0; } int main(void) { - run(2, "17/91 78/85 19/51 23/38 29/33 77/29 95/23 " - "77/19 1/17 11/13 13/11 15/14 15/2 55/1"); + run(2, "17/91 78/85 19/51 23/38 29/33 77/29 95/23 " + "77/19 1/17 11/13 13/11 15/14 15/2 55/1"); - return 0; + return 0; } diff --git a/Task/Fractran/Delphi/fractran.delphi b/Task/Fractran/Delphi/fractran.pas similarity index 100% rename from Task/Fractran/Delphi/fractran.delphi rename to Task/Fractran/Delphi/fractran.pas diff --git a/Task/Fractran/EasyLang/fractran.easy b/Task/Fractran/EasyLang/fractran.easy new file mode 100644 index 0000000000..1fed677ff9 --- /dev/null +++ b/Task/Fractran/EasyLang/fractran.easy @@ -0,0 +1,38 @@ +func[] fractran prog$ val limit . + for s$ in strsplit prog$ " " : n[][] &= number strsplit s$ "/" + for n to limit + r[] &= val + for i to len n[][] + if val mod n[i][2] = 0 : break 1 + . + if i > len n[][] : break 1 + val = val / n[i][2] * n[i][1] + . + return r[] +. +p$ = "17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 1/17 11/13 13/11 15/14 15/2 55/1" +print fractran p$ 2 15 +# +proc sort &d[] . + for i = 1 to len d[] - 1 + for j = i + 1 to len d[] + if d[j] < d[i] : swap d[j] d[i] + . + . +. +r[] = fractran p$ 2 1000 +sort r[] +i = 1 +prim = 2 +po = 4 +repeat + repeat + if i > len r[] : break 2 + until i > len r[] or r[i] >= po + i += 1 + . + until i > len r[] + if r[i] = po : write prim & " " + prim += 1 + po *= 2 +. diff --git a/Task/Fractran/Elixir/fractran.elixir b/Task/Fractran/Elixir/fractran.ex similarity index 100% rename from Task/Fractran/Elixir/fractran.elixir rename to Task/Fractran/Elixir/fractran.ex diff --git a/Task/Fractran/Fortran/fractran-2.f b/Task/Fractran/Fortran/fractran-2.f index 6a079ed26a..0422be02be 100644 --- a/Task/Fractran/Fortran/fractran-2.f +++ b/Task/Fractran/Fortran/fractran-2.f @@ -1,49 +1,49 @@ - INTEGER FUNCTION FRACTRAN(N,P,Q,M) !Notion devised by J. H. Conway. + INTEGER FUNCTION FRACTRAN(N,P,Q,M) !Notion devised by J. H. Conway. Careful: the rule is N*P/Q being integer. N*6/3 is integer always because this is N*2/1, but 3 may not divide N. Could check GCD(P,Q), dividing out the common denominator so MOD(N,Q) works. - INTEGER*8 N !The work variable. Modified! - INTEGER M !The number of fractions supplied. + INTEGER*8 N !The work variable. Modified! + INTEGER M !The number of fractions supplied. INTEGER P(M),Q(M)!The terms of the fractions. - INTEGER I !A stepper. - DO I = 1,M !Search the supplied fractions, P(i)/Q(i). - IF (MOD(N,Q(I)).EQ.0) THEN !Does the denominator divide N? - N = N/Q(I)*P(I) !Yes, compute N*P/Q but trying to dodge overflow. - FRACTRAN = I !Report the hit. - RETURN !Done! - END IF !Otherwise, - END DO !Try the next fraction in the order supplied. - FRACTRAN = 0 !No hit. - END FUNCTION FRACTRAN !That's it! Even so, "Turing complete"... + INTEGER I !A stepper. + DO I = 1,M !Search the supplied fractions, P(i)/Q(i). + IF (MOD(N,Q(I)).EQ.0) THEN !Does the denominator divide N? + N = N/Q(I)*P(I) !Yes, compute N*P/Q but trying to dodge overflow. + FRACTRAN = I !Report the hit. + RETURN !Done! + END IF !Otherwise, + END DO !Try the next fraction in the order supplied. + FRACTRAN = 0 !No hit. + END FUNCTION FRACTRAN !That's it! Even so, "Turing complete"... PROGRAM POKE - INTEGER FRACTRAN !Not the default type of function. - INTEGER P(66),Q(66) !Holds the fractions as P(i)/Q(i). - INTEGER*8 N !The working number. - INTEGER I,IT,L,M !Assistants. + INTEGER FRACTRAN !Not the default type of function. + INTEGER P(66),Q(66) !Holds the fractions as P(i)/Q(i). + INTEGER*8 N !The working number. + INTEGER I,IT,L,M !Assistants. - WRITE (6,1) !Announce. + WRITE (6,1) !Announce. 1 FORMAT ("Interpreter for J.H. Conway's FRACTRAN language.") Chew into an example programme. - OPEN (10,FILE = "Fractran.txt",STATUS="OLD",ACTION="READ") !Rather than compiled-in stuff. - READ (10,*) L !I need to know this without having to scan the input. - WRITE (6,2) L !Reveal in case of trouble. - 2 FORMAT (I0," fractions, as follow:") !Should the input evoke problems. - READ (10,*) (P(I),Q(I),I = 1,L) !Ask for the specified number of P,Q pairs. - WRITE (6,3) (P(I),Q(I),I = 1,L) !Show what turned up. - 3 FORMAT (24(I0,"/",I0:", ")) !As P(i)/Q(i) pairs. The colon means that there will be no trailing comma. - READ (10,*) N,M !The start value, and the step limit. - CLOSE (10) !Finished with input. - WRITE (6,4) N,M !Hopefully, all went well. + OPEN (10,FILE = "Fractran.txt",STATUS="OLD",ACTION="READ") !Rather than compiled-in stuff. + READ (10,*) L !I need to know this without having to scan the input. + WRITE (6,2) L !Reveal in case of trouble. + 2 FORMAT (I0," fractions, as follow:") !Should the input evoke problems. + READ (10,*) (P(I),Q(I),I = 1,L) !Ask for the specified number of P,Q pairs. + WRITE (6,3) (P(I),Q(I),I = 1,L) !Show what turned up. + 3 FORMAT (24(I0,"/",I0:", ")) !As P(i)/Q(i) pairs. The colon means that there will be no trailing comma. + READ (10,*) N,M !The start value, and the step limit. + CLOSE (10) !Finished with input. + WRITE (6,4) N,M !Hopefully, all went well. 4 FORMAT ("Start with N = ",I0,", step limit ",I0) Commence. - WRITE (6,10) 0,N !Splat a heading. - 10 FORMAT (/," Step #F: N",/,I6,4X,": ",I0) !Matched FORMAT 11. - DO I = 1,M !Here we go! - IT = FRACTRAN(N,P,Q,L) !Do it! - WRITE (6,11) I,IT,N !Show it! - 11 FORMAT (I6,I4,": ",I0) !N last, as it may be big. - IF (IT.LE.0) EXIT !No hit, so quit. - END DO !The next step. - END !Whee! + WRITE (6,10) 0,N !Splat a heading. + 10 FORMAT (/," Step #F: N",/,I6,4X,": ",I0) !Matched FORMAT 11. + DO I = 1,M !Here we go! + IT = FRACTRAN(N,P,Q,L) !Do it! + WRITE (6,11) I,IT,N !Show it! + 11 FORMAT (I6,I4,": ",I0) !N last, as it may be big. + IF (IT.LE.0) EXIT !No hit, so quit. + END DO !The next step. + END !Whee! diff --git a/Task/Fractran/Fortran/fractran-3.f b/Task/Fractran/Fortran/fractran-3.f index 1a409a7c11..8fdab8dd61 100644 --- a/Task/Fractran/Fortran/fractran-3.f +++ b/Task/Fractran/Fortran/fractran-3.f @@ -1,11 +1,11 @@ - DO I = 1,M !Here we go! - IT = FRACTRAN(N,P,Q,L) !Do it! - IF (POPCNT(N).EQ.1) WRITE (6,11) I,IT,N !Show it! - 11 FORMAT (I6,I4,": ",I0) !N last, as it may be big. - IF (IT.LE.0) EXIT !No hit, so quit. - IF (N.LE.0) THEN !Otherwise, worry about overflow. - WRITE (6,*) "Integer overflow!" !Justified. The test is not certain. - WRITE (6,11) I,IT,N !Alas, the step failed. - EXIT !Give in. - END IF !So much for overflow. - END DO !The next step. + DO I = 1,M !Here we go! + IT = FRACTRAN(N,P,Q,L) !Do it! + IF (POPCNT(N).EQ.1) WRITE (6,11) I,IT,N !Show it! + 11 FORMAT (I6,I4,": ",I0) !N last, as it may be big. + IF (IT.LE.0) EXIT !No hit, so quit. + IF (N.LE.0) THEN !Otherwise, worry about overflow. + WRITE (6,*) "Integer overflow!" !Justified. The test is not certain. + WRITE (6,11) I,IT,N !Alas, the step failed. + EXIT !Give in. + END IF !So much for overflow. + END DO !The next step. diff --git a/Task/Fractran/Fortran/fractran-4.f b/Task/Fractran/Fortran/fractran-4.f index 367c6d7833..7e4093fbcd 100644 --- a/Task/Fractran/Fortran/fractran-4.f +++ b/Task/Fractran/Fortran/fractran-4.f @@ -1,187 +1,187 @@ - MODULE CONWAYSIDEA !Notion devised by J. H. Conway. - USE PRIMEBAG !This is a common need. - INTEGER LASTP,ENUFF !Some size allowances. - PARAMETER (LASTP = 66, ENUFF = 66) !Should suffice for the example in mind. - INTEGER NPPOW(1:LASTP) !Represent N as a collection of powers of prime numbers. - TYPE FACTORED !But represent P and Q of freaction = P/Q - INTEGER PNUM(0:LASTP) !As a list of prime number indices with PNUM(0) the count. - INTEGER PPOW(LASTP) !And the powers. for the fingered primes. - END TYPE FACTORED !Rather than as a simple number multiplied out. - TYPE(FACTORED) FP(ENUFF),FQ(ENUFF) !Thus represent a factored fraction, P(i)/Q(i). - INTEGER PLIVE(ENUFF),NL !Helps subroutine SHOWN display NPPOW. - CONTAINS !Now for the details. - SUBROUTINE SHOWFACTORS(N) !First, to show an internal data structure. - TYPE(FACTORED) N !It is supplied as a list of prime factors. - INTEGER I !A stepper. - DO I = 1,N.PNUM(0) !Step along the list. - IF (I.GT.1) WRITE (MSG,"('x',$)") !Append a glyph for "multiply". - WRITE (MSG,"(I0,$)") PRIME(N.PNUM(I)) !The prime fingered in the list. - IF (N.PPOW(I).GT.1) WRITE (MSG,"('^',I0,$)") N.PPOW(I) !With an interesting power? - END DO !On to the next element in the list. - WRITE (MSG,1) N.PNUM(0) !End the line - 1 FORMAT (": Factor count ",I0) !With a count of prime factors. - END SUBROUTINE SHOWFACTORS !Hopefully, this will not be needed often. + MODULE CONWAYSIDEA !Notion devised by J. H. Conway. + USE PRIMEBAG !This is a common need. + INTEGER LASTP,ENUFF !Some size allowances. + PARAMETER (LASTP = 66, ENUFF = 66) !Should suffice for the example in mind. + INTEGER NPPOW(1:LASTP) !Represent N as a collection of powers of prime numbers. + TYPE FACTORED !But represent P and Q of freaction = P/Q + INTEGER PNUM(0:LASTP) !As a list of prime number indices with PNUM(0) the count. + INTEGER PPOW(LASTP) !And the powers. for the fingered primes. + END TYPE FACTORED !Rather than as a simple number multiplied out. + TYPE(FACTORED) FP(ENUFF),FQ(ENUFF) !Thus represent a factored fraction, P(i)/Q(i). + INTEGER PLIVE(ENUFF),NL !Helps subroutine SHOWN display NPPOW. + CONTAINS !Now for the details. + SUBROUTINE SHOWFACTORS(N) !First, to show an internal data structure. + TYPE(FACTORED) N !It is supplied as a list of prime factors. + INTEGER I !A stepper. + DO I = 1,N.PNUM(0) !Step along the list. + IF (I.GT.1) WRITE (MSG,"('x',$)") !Append a glyph for "multiply". + WRITE (MSG,"(I0,$)") PRIME(N.PNUM(I)) !The prime fingered in the list. + IF (N.PPOW(I).GT.1) WRITE (MSG,"('^',I0,$)") N.PPOW(I) !With an interesting power? + END DO !On to the next element in the list. + WRITE (MSG,1) N.PNUM(0) !End the line + 1 FORMAT (": Factor count ",I0) !With a count of prime factors. + END SUBROUTINE SHOWFACTORS !Hopefully, this will not be needed often. - TYPE(FACTORED) FUNCTION FACTOR(IT) !Into a list of primes and their powers. - INTEGER IT,N !The number and a copy to damage. - INTEGER P,POW !A stepper and a power. - INTEGER F,NF !A factor and a counter. - IF (IT.LE.0) STOP "Factor only positive numbers!" !Or else... - N = IT !A copy I can damage. - NF = 0 !No factors found. - P = 0 !Because no primes have been tried. - PP:DO WHILE (N.GT.1) !Step through the possibilities. - P = P + 1 !Another prime impends. - F = PRIME(P) !Grab a possible factor. - POW = 0 !It has no power yet. - FP:DO WHILE(MOD(N,F).EQ.0) !Well? - POW = POW + 1 !Count a factor.. - N = N/F !Reduce the number. - END DO FP !The P'th prime's power's produced. - IF (POW.GT.0) THEN !So, was it a factor? - IF (NF.GE.LASTP) THEN !Yes. Have I room in the list? - WRITE (MSG,1) IT,LASTP !Alas. + TYPE(FACTORED) FUNCTION FACTOR(IT) !Into a list of primes and their powers. + INTEGER IT,N !The number and a copy to damage. + INTEGER P,POW !A stepper and a power. + INTEGER F,NF !A factor and a counter. + IF (IT.LE.0) STOP "Factor only positive numbers!" !Or else... + N = IT !A copy I can damage. + NF = 0 !No factors found. + P = 0 !Because no primes have been tried. + PP:DO WHILE (N.GT.1) !Step through the possibilities. + P = P + 1 !Another prime impends. + F = PRIME(P) !Grab a possible factor. + POW = 0 !It has no power yet. + FP:DO WHILE(MOD(N,F).EQ.0) !Well? + POW = POW + 1 !Count a factor.. + N = N/F !Reduce the number. + END DO FP !The P'th prime's power's produced. + IF (POW.GT.0) THEN !So, was it a factor? + IF (NF.GE.LASTP) THEN !Yes. Have I room in the list? + WRITE (MSG,1) IT,LASTP !Alas. 1 FORMAT ("Factoring ",I0," but with provision for only ", 1 I0," prime factors!") - FACTOR.PNUM(0) = NF !Place the count so far, + FACTOR.PNUM(0) = NF !Place the count so far, CALL SHOWFACTORS(FACTOR)!So this can be invoked. - STOP "Not enough storage!" !Quite. - END IF !But normally, - NF = NF + 1 !Admit another factor. - FACTOR.PNUM(NF) = P !Identify the prime. NOT the prime itself. - FACTOR.PPOW(NF) = POW !Place its power. - END IF !So much for that factor. - END DO PP !Try another prime, if N > 1 still. - FACTOR.PNUM(0) = NF !Place the count. - END FUNCTION FACTOR !Thus, a list of primes and their powers. + STOP "Not enough storage!" !Quite. + END IF !But normally, + NF = NF + 1 !Admit another factor. + FACTOR.PNUM(NF) = P !Identify the prime. NOT the prime itself. + FACTOR.PPOW(NF) = POW !Place its power. + END IF !So much for that factor. + END DO PP !Try another prime, if N > 1 still. + FACTOR.PNUM(0) = NF !Place the count. + END FUNCTION FACTOR !Thus, a list of primes and their powers. - INTEGER FUNCTION GCD(I,J) !Greatest common divisor. - INTEGER I,J !Of these two integers. - INTEGER N,M,R !Workers. - N = MAX(I,J) !Since I don't want to damage I or J, - M = MIN(I,J) !These copies might as well be the right way around. - 1 R = MOD(N,M) !Divide N by M to get the remainder R. - IF (R.GT.0) THEN !Remainder zero? - N = M !No. Descend a level. - M = R !M-multiplicity has been removed from N. - IF (R .GT. 1) GO TO 1 !No point dividing by one. - END IF !If R = 0, M divides N. - GCD = M !There we are. - END FUNCTION GCD !Euclid lives on! + INTEGER FUNCTION GCD(I,J) !Greatest common divisor. + INTEGER I,J !Of these two integers. + INTEGER N,M,R !Workers. + N = MAX(I,J) !Since I don't want to damage I or J, + M = MIN(I,J) !These copies might as well be the right way around. + 1 R = MOD(N,M) !Divide N by M to get the remainder R. + IF (R.GT.0) THEN !Remainder zero? + N = M !No. Descend a level. + M = R !M-multiplicity has been removed from N. + IF (R .GT. 1) GO TO 1 !No point dividing by one. + END IF !If R = 0, M divides N. + GCD = M !There we are. + END FUNCTION GCD !Euclid lives on! - INTEGER FUNCTION FRACTRAN(L) !Applies Conway's idea to a list of fractions. + INTEGER FUNCTION FRACTRAN(L) !Applies Conway's idea to a list of fractions. Could abandon all parameters since global variables have the details... - INTEGER L !The last fraction to consider. - INTEGER I,NF !Assistants. - DO I = 1,L !Step through the fractions in the order they were given. - NF = FQ(I).PNUM(0) !How many factors are listed in FQ(I)? - IF (ALL(NPPOW(FQ(I).PNUM(1:NF)) !Can N (as NPPOW) be divided by Q (as FQ)? - 1 .GE. FQ(I).PPOW(1:NF))) THEN !By comparing the supplies of prime factors. - FRACTRAN = I !Yes! - NPPOW(FQ(I).PNUM(1:NF)) = NPPOW(FQ(I).PNUM(1:NF)) !Remove prime powers from N - 1 - FQ(I).PPOW(1:NF) !Corresponding to Q. - NF = FP(I).PNUM(0) !Add powers to N - NPPOW(FP(I).PNUM(1:NF)) = NPPOW(FP(I).PNUM(1:NF)) !Corresponding to P. - 1 + FP(I).PPOW(1:NF) !Thus, N = N/Q*P. - RETURN !That's all it takes! No multiplies nor divides! - END IF !So much for that fraction. - END DO !This relies on ALL(zero tests) yielding true, as when Q = 1. - FRACTRAN = 0 !No hit. - END FUNCTION FRACTRAN !No massive multi-precision arithmetic! + INTEGER L !The last fraction to consider. + INTEGER I,NF !Assistants. + DO I = 1,L !Step through the fractions in the order they were given. + NF = FQ(I).PNUM(0) !How many factors are listed in FQ(I)? + IF (ALL(NPPOW(FQ(I).PNUM(1:NF)) !Can N (as NPPOW) be divided by Q (as FQ)? + 1 .GE. FQ(I).PPOW(1:NF))) THEN !By comparing the supplies of prime factors. + FRACTRAN = I !Yes! + NPPOW(FQ(I).PNUM(1:NF)) = NPPOW(FQ(I).PNUM(1:NF)) !Remove prime powers from N + 1 - FQ(I).PPOW(1:NF) !Corresponding to Q. + NF = FP(I).PNUM(0) !Add powers to N + NPPOW(FP(I).PNUM(1:NF)) = NPPOW(FP(I).PNUM(1:NF)) !Corresponding to P. + 1 + FP(I).PPOW(1:NF) !Thus, N = N/Q*P. + RETURN !That's all it takes! No multiplies nor divides! + END IF !So much for that fraction. + END DO !This relies on ALL(zero tests) yielding true, as when Q = 1. + FRACTRAN = 0 !No hit. + END FUNCTION FRACTRAN !No massive multi-precision arithmetic! - SUBROUTINE SHOWN(S,F) !Service routine to show the state after a step is calculated. + SUBROUTINE SHOWN(S,F) !Service routine to show the state after a step is calculated. Could imaging a function I6FMT(23) that returns " 23" and " " for non-positive numbers. Can't do it, as if this were invoked via a WRITE statement, re-entrant use of WRITE usually fails. - INTEGER S,F !Step number, Fraction number. - INTEGER I !A stepper. - CHARACTER*(9+4+1 + NL*6) ALINE !A scratchpad matching FORMAT 103. - WRITE (ALINE,103) S,F,NPPOW(PLIVE(1:NL)) !Show it! - 103 FORMAT (I9,I4,":",I6) !As a sequence of powers of primes. - IF (F.LE.0) ALINE(10:13) = "" !Scrub when no fraction is fingered. - DO I = 1,NL !Step along the live primes. - IF (NPPOW(PLIVE(I)).GT.0) CYCLE !Ignoring the empowered ones. - ALINE(15 + (I - 1)*6:14 + I*6) = "" !Blank out zero powers. - END DO !On to the next. - WRITE (MSG,"(A)") ALINE !Reveal at last. - END SUBROUTINE SHOWN !A struggle. - END MODULE CONWAYSIDEA !Simple... + INTEGER S,F !Step number, Fraction number. + INTEGER I !A stepper. + CHARACTER*(9+4+1 + NL*6) ALINE !A scratchpad matching FORMAT 103. + WRITE (ALINE,103) S,F,NPPOW(PLIVE(1:NL)) !Show it! + 103 FORMAT (I9,I4,":",I6) !As a sequence of powers of primes. + IF (F.LE.0) ALINE(10:13) = "" !Scrub when no fraction is fingered. + DO I = 1,NL !Step along the live primes. + IF (NPPOW(PLIVE(I)).GT.0) CYCLE !Ignoring the empowered ones. + ALINE(15 + (I - 1)*6:14 + I*6) = "" !Blank out zero powers. + END DO !On to the next. + WRITE (MSG,"(A)") ALINE !Reveal at last. + END SUBROUTINE SHOWN !A struggle. + END MODULE CONWAYSIDEA !Simple... PROGRAM POKE - USE CONWAYSIDEA !But, where does he get his ideas from? - INTEGER P(ENUFF),Q(ENUFF) !Holds the fractions as P(i)/Q(i). - INTEGER N !The working number. - INTEGER LF !Last fraction given. - INTEGER LP !Last prime needed. - INTEGER MS !Maximum number of steps. - INTEGER I,IT !Assistants. - LOGICAL*1 PUSED(ENUFF) !Track the usage of prime numbers, + USE CONWAYSIDEA !But, where does he get his ideas from? + INTEGER P(ENUFF),Q(ENUFF) !Holds the fractions as P(i)/Q(i). + INTEGER N !The working number. + INTEGER LF !Last fraction given. + INTEGER LP !Last prime needed. + INTEGER MS !Maximum number of steps. + INTEGER I,IT !Assistants. + LOGICAL*1 PUSED(ENUFF) !Track the usage of prime numbers, - MSG = 6 !Standard output. - WRITE (6,1) !Announce. + MSG = 6 !Standard output. + WRITE (6,1) !Announce. 1 FORMAT ("Interpreter for J. H. Conway's FRACTRAN language.") Chew into an example programme. - 10 OPEN (10,FILE = "Fractran.txt",STATUS="OLD",ACTION="READ") !Rather than compiled-in stuff. - READ (10,*) LF !I need to know this without having to scan the input. - WRITE (MSG,11) LF !Reveal in case of trouble. - 11 FORMAT (I0," fractions, as follow:") !Should the input evoke problems. - READ (10,*) (P(I),Q(I),I = 1,LF) !Ask for the specified number of P,Q pairs. - WRITE (MSG,12) (P(I),Q(I),I = 1,LF) !Show what turned up. - 12 FORMAT (24(I0,"/",I0:", ")) !As P(i)/Q(i) pairs. The colon means that there will be no trailing comma. - READ (10,*) N,MS !The start value, and the step limit. - CLOSE (10) !Finished with input. - WRITE (MSG,13) N,MS !Hopefully, all went well. + 10 OPEN (10,FILE = "Fractran.txt",STATUS="OLD",ACTION="READ") !Rather than compiled-in stuff. + READ (10,*) LF !I need to know this without having to scan the input. + WRITE (MSG,11) LF !Reveal in case of trouble. + 11 FORMAT (I0," fractions, as follow:") !Should the input evoke problems. + READ (10,*) (P(I),Q(I),I = 1,LF) !Ask for the specified number of P,Q pairs. + WRITE (MSG,12) (P(I),Q(I),I = 1,LF) !Show what turned up. + 12 FORMAT (24(I0,"/",I0:", ")) !As P(i)/Q(i) pairs. The colon means that there will be no trailing comma. + READ (10,*) N,MS !The start value, and the step limit. + CLOSE (10) !Finished with input. + WRITE (MSG,13) N,MS !Hopefully, all went well. 13 FORMAT ("Start with N = ",I0,", step limit ",I0) - IF (.NOT.GRASPPRIMEBAG(66)) STOP "Gan't grab my file of primes!" !Attempt in hope. + IF (.NOT.GRASPPRIMEBAG(66)) STOP "Gan't grab my file of primes!" !Attempt in hope. Convert the starting number to a more convenient form, an array of powers of successive prime numbers. - 20 FP(1) = FACTOR(N) !Borrow one of the factor list variables. - NPPOW = 0 !Clear all prime factor counts. - DO I = 1,FP(1).PNUM(0) !Now find what they are. - NPPOW(FP(1).PNUM(I)) = FP(1).PPOW(I) !Convert from a variable-length list - END DO !To a fixed-length random-access array. - PUSED = NPPOW.GT.0 !Note which primes have been used. - LP = FP(1).PNUM(FP(1).PNUM(0)) !Recall the last prime required. More later. + 20 FP(1) = FACTOR(N) !Borrow one of the factor list variables. + NPPOW = 0 !Clear all prime factor counts. + DO I = 1,FP(1).PNUM(0) !Now find what they are. + NPPOW(FP(1).PNUM(I)) = FP(1).PPOW(I) !Convert from a variable-length list + END DO !To a fixed-length random-access array. + PUSED = NPPOW.GT.0 !Note which primes have been used. + LP = FP(1).PNUM(FP(1).PNUM(0)) !Recall the last prime required. More later. Convert the supplied P(i)/Q(i) fractions to lists of prime number factors and powers in FP(i) and FQ(i). - DO I = 1,LF !Step through the fractions. - IT = GCD(P(I),Q(I)) !Suspicion. - IF (IT.GT.1) THEN !Justified? - WRITE (MSG,21) I,P(I),Q(I),IT !Alas. Complain. The rule is N*(P/Q) being integer. + DO I = 1,LF !Step through the fractions. + IT = GCD(P(I),Q(I)) !Suspicion. + IF (IT.GT.1) THEN !Justified? + WRITE (MSG,21) I,P(I),Q(I),IT !Alas. Complain. The rule is N*(P/Q) being integer. 21 FORMAT ("Fraction ",I3,", ",I0,"/",I0,!N*6/3 is integer always because this is N*2/1, but 3 may not divide N. - 1 " has common factor ",I0,"!") !By removing IT, - P(I) = P(I)/IT !The test need merely check if N is divisible by Q. - Q(I) = Q(I)/IT !And, as N is factorised in NPPOW - END IF !And Q in FQ, subtractions of powers only is needed. - FP(I) = FACTOR(P(I)) !Righto, form the factor list for P. - PUSED(FP(I).PNUM(1:FP(I).PNUM(0))) = .TRUE. !Mark which primes it fingers. - LP = MAX(LP,FP(I).PNUM(FP(I).PNUM(0))) !One has no prime factors: PNUM(0) = 0. - FQ(I) = FACTOR(Q(I)) !And likewise for Q. - PUSED(FQ(I).PNUM(1:FQ(I).PNUM(0))) = .TRUE. !Some primes may be omitted. - LP = MAX(LP,FQ(I).PNUM(FQ(I).PNUM(0))) !If no prime factors, PNUM(0) fingers element zero, which is zero. - END DO !All this messing about saves on multiplication and division. + 1 " has common factor ",I0,"!") !By removing IT, + P(I) = P(I)/IT !The test need merely check if N is divisible by Q. + Q(I) = Q(I)/IT !And, as N is factorised in NPPOW + END IF !And Q in FQ, subtractions of powers only is needed. + FP(I) = FACTOR(P(I)) !Righto, form the factor list for P. + PUSED(FP(I).PNUM(1:FP(I).PNUM(0))) = .TRUE. !Mark which primes it fingers. + LP = MAX(LP,FP(I).PNUM(FP(I).PNUM(0))) !One has no prime factors: PNUM(0) = 0. + FQ(I) = FACTOR(Q(I)) !And likewise for Q. + PUSED(FQ(I).PNUM(1:FQ(I).PNUM(0))) = .TRUE. !Some primes may be omitted. + LP = MAX(LP,FQ(I).PNUM(FQ(I).PNUM(0))) !If no prime factors, PNUM(0) fingers element zero, which is zero. + END DO !All this messing about saves on multiplication and division. Check which primes are in use, preparing an index of live primes.. - NL = 0 !No live primes. - DO I = 1,LP !Check up to the last prime. - IF (PUSED(I)) THEN !This one used? - NL = NL + 1 !Yes. Another. - PLIVE(NL) = I !Fingered. - END IF !So much for that prime. - END DO !On to the next. - WRITE (MSG,22) NL,LP,PRIME(LP) !Remark on usage. - 22 FORMAT ("Require ",I0," primes only, up to Prime(",I0,") = ",I0) !Presume always more than one prime. + NL = 0 !No live primes. + DO I = 1,LP !Check up to the last prime. + IF (PUSED(I)) THEN !This one used? + NL = NL + 1 !Yes. Another. + PLIVE(NL) = I !Fingered. + END IF !So much for that prime. + END DO !On to the next. + WRITE (MSG,22) NL,LP,PRIME(LP) !Remark on usage. + 22 FORMAT ("Require ",I0," primes only, up to Prime(",I0,") = ",I0) !Presume always more than one prime. IF (LP.GT.LASTP) STOP "But, that's too many for array NPPOW!" Cast forth a heading. - 100 WRITE (MSG,101) (PRIME(PLIVE(I)), I = 1,NL) !Splat a heading. - 101 FORMAT (/,14X,"N as powers of prime factors",/, !The prime heading, - 1 5X,"Step F#:",I6) !With primes beneath. - CALL SHOWN(0,0) !Initial state of N as NPPOW. Step zero, no fraction. + 100 WRITE (MSG,101) (PRIME(PLIVE(I)), I = 1,NL) !Splat a heading. + 101 FORMAT (/,14X,"N as powers of prime factors",/, !The prime heading, + 1 5X,"Step F#:",I6) !With primes beneath. + CALL SHOWN(0,0) !Initial state of N as NPPOW. Step zero, no fraction. Commence! - DO I = 1,MS !Here we go! - IT = FRACTRAN(LF) !Do it! - CALL SHOWN(I,IT) !Show it! - IF (IT.LE.0) EXIT !Quit it? - END DO !The next step. + DO I = 1,MS !Here we go! + IT = FRACTRAN(LF) !Do it! + CALL SHOWN(I,IT) !Show it! + IF (IT.LE.0) EXIT !Quit it? + END DO !The next step. Complete! - END !Whee! + END !Whee! diff --git a/Task/Fractran/Fortran/fractran-5.f b/Task/Fractran/Fortran/fractran-5.f index 65e4304ded..8bf75352db 100644 --- a/Task/Fractran/Fortran/fractran-5.f +++ b/Task/Fractran/Fortran/fractran-5.f @@ -1,5 +1,5 @@ - DO I = 1,MS !Here we go! - IT = FRACTRAN(LF) !Do it! - IF (ALL(NPPOW(2:LP).EQ.0)) CALL SHOWN(I,IT) !Show it! - IF (IT.LE.0) EXIT !Quit it? - END DO !The next step. + DO I = 1,MS !Here we go! + IT = FRACTRAN(LF) !Do it! + IF (ALL(NPPOW(2:LP).EQ.0)) CALL SHOWN(I,IT) !Show it! + IF (IT.LE.0) EXIT !Quit it? + END DO !The next step. diff --git a/Task/Fractran/Julia/fractran.jl b/Task/Fractran/Julia/fractran.jl new file mode 100644 index 0000000000..87f70c2989 --- /dev/null +++ b/Task/Fractran/Julia/fractran.jl @@ -0,0 +1,70 @@ +using .Iterators, BenchmarkTools +using Primes: Factorization, factor + +# type alias for abbreviation +Factors = Factorization{Int} + +# iterable stuct with parametric type polymorphism +struct Fractran{T} + program::Vector{@NamedTuple{num::T, den::T}} + input::Int + + # inner constructor + function Fractran{T}(program::Vector{Rational{Int}}, input::Int) where T + c = Dict(BigInt => identity, Factors => factor)[T] + new{T}([(num = c(f.num), den = c(f.den)) for f ∈ program], input) + end +end + +# methods for Fractran with n::BigInt +Base.iterate(ft::Fractran{BigInt}, n = big(ft.input)) = + for f ∈ ft.program + if iszero(n % f.den) + n = n ÷ f.den * f.num + return n, n + end + end + +iters(ft::Fractran{BigInt}) = ft + +output(ft::Fractran{BigInt}) = (trailing_zeros(n) for n ∈ ft if ispow2(n)) + +# methods for Fractran with n::Factorization{Int} +Base.iterate(ft::Fractran{Factors}, n = factor(ft.input)) = + for f ∈ ft.program + if all(n[p] ≥ e for (p, e) ∈ f.den) + for (p, e) ∈ f.den n[p] -= e end + for (p, e) ∈ f.num n[p] += e end + return n, n + end + end + +iters(ft::Fractran{Factors}) = (prod(n) for n ∈ ft) + +output(ft::Fractran{Factors}) = (n[2] for n ∈ ft if + all((iszero(e) || (p == 2)) for (p, e) ∈ n)) + +# convenient Fractran scripting +macro ft_str(s::String) + eval(Meta.parse(replace("[$s]", "/" => "//"))) +end + +# instantiation of Fractran example generating prime numbers +primes(T) = Fractran{T}(ft"17/91, 78/85, 19/51, 23/38, 29/33, 77/29, + 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1", 2) + +# Output including Benchmark +ilim = 20; plim = 45 + +function printout(T) + println("\n$ilim iterations and output of $plim prime numbers using ", T) + println(join(take(iters(primes(T)), ilim), ", "), "…") + join(stdout, take(output(primes(T)), plim), ", ") + print("…\nBenchmark: $plim primes in") +end + +printout(BigInt) +@btime collect(take(output(primes(BigInt)), plim)) + +printout(Factors) +@btime collect(take(output(primes(Factors)), plim)); diff --git a/Task/Fractran/Julia/fractran.julia b/Task/Fractran/Julia/fractran.julia deleted file mode 100644 index a590a05890..0000000000 --- a/Task/Fractran/Julia/fractran.julia +++ /dev/null @@ -1,41 +0,0 @@ -# FRACTRAN interpreter implemented as an iterable struct - -using .Iterators: filter, map, take - -struct Fractran - rs::Vector{Rational{BigInt}} - i₀::BigInt - limit::Int -end - -Base.iterate(f::Fractran, i = f.i₀) = - for r in f.rs - if iszero(i % r.den) - i = i ÷ r.den * r.num - return i, i - end - end - -interpret(f::Fractran) = - take( - map(trailing_zeros, - filter(ispow2, f)) - f.limit) - -Base.show(io::IO, f::Fractran) = - join(io, interpret(f), ' ') - -macro code_str(s) - [eval(Meta.parse(replace(t, "/" => "//"))) for t ∈ split(s)] -end - -primes = Fractran(code"17/91 78/85 19/51 23/38 29/33 77/29 95/23 - 77/19 1/17 11/13 13/11 15/14 15/2 55/1", 2, 30) - -# Output -println("First 25 iterations of FRACTRAN program 'primes':\n2 ", - join(take(primes, 25), ' ')) - -println("\nWatch the first 30 primes dropping out within seconds:") - -primes diff --git a/Task/Fractran/Kotlin/fractran.kotlin b/Task/Fractran/Kotlin/fractran.kts similarity index 100% rename from Task/Fractran/Kotlin/fractran.kotlin rename to Task/Fractran/Kotlin/fractran.kts diff --git a/Task/Fractran/Miranda/fractran.miranda b/Task/Fractran/Miranda/fractran.miranda new file mode 100644 index 0000000000..c1f844d524 --- /dev/null +++ b/Task/Fractran/Miranda/fractran.miranda @@ -0,0 +1,80 @@ +main :: [sys_message] +main = [Stdout (lay [show (take 15 (run 2 primeprog)), + show (take 20 fracprimes)])] + +primeprog :: [(num,num)] +primeprog = fromjust (prog ("17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 " + ++ "1/17 11/13 13/11 15/14 15/2 55/1")) + +fracprimes :: [num] +fracprimes = [fromjust k | k<-map fracprime (run 2 primeprog); isjust k] + +fracprime :: num->maybe num +fracprime = f 0 + where f 1 1 = Nothing + f n 1 = Just n + f n x = Nothing, if x mod 2 ~= 0 + f n x = f (n+1) (x div 2), otherwise + +run :: num->[(num,num)]->[num] +run n prog = [n], if ~isjust n' + = n : run (fromjust n') prog, otherwise + where n' = step n prog + +step :: num->[(num,num)]->maybe num +step x [] = Nothing +step x ((n,d):xs) = Just (x*n div d), if x*n mod d = 0 + = step x xs, otherwise + +maybe * ::= Nothing | Just * + +isjust :: maybe *->bool +isjust (Just x) = True +isjust Nothing = False + +fromjust :: maybe *->* +fromjust (Just x) = x + +prog :: [char]->maybe [(num, num)] +prog xs = Just [], if trim xs = [] + = Nothing, if ~isjust fp \/ ~isjust rp + = Just (fr : fromjust rp), otherwise + where fp = frac xs + Just (fr, xs') = fp + rp = prog xs' + +frac :: [char]->maybe ((num,num), [char]) +frac xs = Nothing, if ~isjust np \/ ~isjust sl \/ ~isjust dp + = Just ((n, d), xs'''), otherwise + where np = numb xs + Just (n, xs') = np + sl = match '/' (trim xs') + Just xs'' = sl + dp = numb xs'' + Just (d, xs''') = dp + +numb :: [char]->maybe (num, [char]) +numb xs = Nothing, if n=[] + = Just (numval n, r), otherwise + where (n, r) = span "0123456789" (trim xs) + +match :: *->[*]->maybe [*] +match m [] = Nothing +match m (m:xs) = Just xs +match m (x:xs) = Nothing + +span :: [*]->[*]->([*],[*]) +span match [] = ([], []) +span match (x:xs) = ([], x:xs), if ~(x $in match) + = (x:r, xs'), otherwise + where (r, xs') = span match xs + +in :: *->[*]->bool +in x [] = False +in x (x:xs) = True +in x (y:xs) = x $in xs + +trim :: [char]->[char] +trim [] = [] +trim (c:xs) = trim xs, if c='\t' \/ c='\n' \/ c=' ' +trim (c:xs) = c:xs diff --git a/Task/Fractran/OCaml/fractran.ocaml b/Task/Fractran/OCaml/fractran.ml similarity index 100% rename from Task/Fractran/OCaml/fractran.ocaml rename to Task/Fractran/OCaml/fractran.ml diff --git a/Task/Fractran/Odin/fractran.odin b/Task/Fractran/Odin/fractran.odin new file mode 100644 index 0000000000..118e1b4333 --- /dev/null +++ b/Task/Fractran/Odin/fractran.odin @@ -0,0 +1,77 @@ +package main + +import "core:fmt" +import "core:os" +import "core:strconv" +import "core:strings" +import "core:text/match" +import "core:math" + + +main :: proc() { + // fmt.println(os.args) + + n:int + number:int + number_conv:bool + fracts:[dynamic]int + defer delete(fracts) + + n,number_conv = strconv.parse_int(os.args[1]) + assert(number_conv, "Number must be given in first place!") + assert(len(os.args)>1,"no command line arguments given") + + data:="17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 1/17 11/13 13/11 15/14 15/2 55/1" + + ss := strings.split(string(data), " ") + defer delete(ss) + + + a: [dynamic]string + dummy:[]string + defer delete(a) + defer delete(dummy) + + for i in ss{ + dummy =strings.split(i,"/") + for j in dummy{ + // fmt.println(j) + + append_elem(&a,j) + } + } + + for k in a{ + // fmt.println(k) + number,number_conv = strconv.parse_int(k) + assert(number_conv, "Number must be given in program") + append_elem(&fracts,number) + } + + + // fmt.println(len(fracts)) + cond:int + buf: [256]byte + bb:int + end:=0 + fmt.println(n) + frac: for j:=0;jnew($_), qw{ $|=1; MAIN: for( 1 .. 5000 ) { - print " " if $_ > 1; - my ($pow, $rest) = (0, $n->copy); - until( $rest->is_odd ) { - ++$pow; - $rest->bdiv(2); - } - if( $rest->is_one ) { - print "2**$pow"; - } else { - #print $n; - } - for my $f_i (@P) { - my $nf_i = $n * $f_i; - next unless $nf_i->is_int; - $n = $nf_i; - next MAIN; - } - last; + print " " if $_ > 1; + my ($pow, $rest) = (0, $n->copy); + until( $rest->is_odd ) { + ++$pow; + $rest->bdiv(2); + } + if( $rest->is_one ) { + print "2**$pow"; + } else { + #print $n; + } + for my $f_i (@P) { + my $nf_i = $n * $f_i; + next unless $nf_i->is_int; + $n = $nf_i; + next MAIN; + } + last; } print "\n"; diff --git a/Task/Fractran/R/fractran.r b/Task/Fractran/R/fractran.r new file mode 100644 index 0000000000..af0f56b3bf --- /dev/null +++ b/Task/Fractran/R/fractran.r @@ -0,0 +1,25 @@ +library(gmp) +library(stringr) + +fractran <- function(s, n, lim){ + P <- str_split_1(s, " ") |> str_split("/") + read_frac <- function(index) as.bigq(n=P[[index]][1], d=P[[index]][2]) + fracs <- sapply(seq_along(P), read_frac) + first_integer <- function(bigv, n){ + for(q in bigv){ + if(denominator(n*q)==1) return(q) + } + return(NA) + } + iters <- 0 + while(!is.na(first_integer(fracs, n))){ + n <- n*first_integer(fracs, n) + print(n, initLine=FALSE) + iters <- iters+1 + if(iters>=lim) break + } +} + +#Test input +fractran_primes <- "17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 1/17 11/13 13/11 15/14 15/2 55/1" +fractran(fractran_primes, 2, 15) diff --git a/Task/Fractran/REXX/fractran-1.rexx b/Task/Fractran/REXX/fractran-1.rexx deleted file mode 100644 index 8572c8bd0b..0000000000 --- a/Task/Fractran/REXX/fractran-1.rexx +++ /dev/null @@ -1,28 +0,0 @@ -/*REXX program runs FRACTRAN for a given set of fractions and from a specified N. */ -numeric digits 2000 /*be able to handle larger numbers. */ -parse arg N terms fracs /*obtain optional arguments from the CL*/ -if N=='' | N=="," then N= 2 /*Not specified? Then use the default.*/ -if terms=='' | terms=="," then terms= 100 /* " " " " " " */ -if fracs='' then fracs= "17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23,", - '77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1' - /* [↑] The default for the fractions. */ -f= space(fracs, 0) /*remove all blanks from the FRACS list*/ - do #=1 while f\==''; parse var f n.# "/" d.# ',' f - end /*#*/ /* [↑] parse all the fractions in list*/ -#= # - 1 /*the number of fractions just found. */ -say # 'fractions:' fracs /*display number and actual fractions. */ -say 'N is starting at ' N /*display the starting number N. */ -say terms ' terms are being shown:' /*display a kind of header/title. */ - - do j=1 for terms /*perform the DO loop for each term. */ - do k=1 for # /* " " " " " " fraction*/ - if N // d.k \== 0 then iterate /*Not an integer? Then ignore it. */ - cN= commas(N); L= length(cN) /*maybe insert commas into N; get len.*/ - say right('term' commas(j), 44) "──► " right(cN, max(15, L)) /*show Nth term & N*/ - N= N % d.k * n.k /*calculate next term (use %≡integer ÷)*/ - leave /*go start calculating the next term. */ - end /*k*/ /* [↑] if an integer, we found a new N*/ - end /*j*/ -exit 0 /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -commas: parse arg ?; do jc=length(?)-3 to 1 by -3; ?=insert(',', ?, jc); end; return ? diff --git a/Task/Fractran/REXX/fractran-2.rexx b/Task/Fractran/REXX/fractran-2.rexx deleted file mode 100644 index a201c8471b..0000000000 --- a/Task/Fractran/REXX/fractran-2.rexx +++ /dev/null @@ -1,39 +0,0 @@ -/*REXX program runs FRACTRAN for a given set of fractions and from a specified N. */ -numeric digits 999; d= digits(); w= length(d) /*be able to handle gihugeic numbers. */ -parse arg N terms fracs /*obtain optional arguments from the CL*/ -if N=='' | N=="," then N= 2 /*Not specified? Then use the default.*/ -if terms=='' | terms=="," then terms= 100 /* " " " " " " */ -if fracs='' then fracs= "17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23,", - '77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1' - /* [↑] The default for the fractions. */ -f= space(fracs, 0) /*remove all blanks from the FRACS list*/ - do #=1 while f\==''; parse var f n.# "/" d.# ',' f - end /*#*/ /* [↑] parse all the fractions in list*/ -#= # - 1 /*adjust the number of fractions found.*/ -tell= terms>0 /*flag: show number or a power of 2.*/ -!.= 0; _= 1 /*the default value for powers of 2. */ -if \tell then do p=1 until length(_)>d; _= _ + _; !._= 1 - if p==1 then @._= left('', w + 9) "2**"left(p, w) ' ' - else @._= '(prime' right(p, w)") 2**"left(p, w) ' ' - end /*p*/ /* [↑] build powers of 2 tables. */ -L= length(N) /*length in decimal digits of integer N*/ -say # 'fractions:' fracs /*display number and actual fractions. */ -say 'N is starting at ' N /*display the starting number N. */ -if tell then say terms ' terms are being shown:' /*display header.*/ - else say 'only powers of two are being shown:' /* " " */ -@a= '(max digits used:' /*a literal used in the SAY below. */ - - do j=1 for abs(terms) /*perform DO loop once for each term. */ - do k=1 for # /* " " " " " " fraction*/ - if N // d.k \== 0 then iterate /*Not an integer? Then ignore it. */ - cN= commas(N); cj=commas(j) /*maybe insert commas into N. */ - if tell then say right('term' cj, 44) "──► " cN /*display Nth term and N.*/ - else if !.N then say right('term' cj,15) "──►" @.N @a right(L,w)") " cN - N= N % d.k * n.k /*calculate next term (use %≡integer ÷)*/ - L= max(L, length(N) ) /*the maximum number of decimal digits.*/ - leave /*go start calculating the next term. */ - end /*k*/ /* [↑] if an integer, we found a new N*/ - end /*j*/ -exit 0 /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -commas: parse arg ?; do jc=length(?)-3 to 1 by -3; ?=insert(',', ?, jc); end; return ? diff --git a/Task/Fractran/REXX/fractran.rexx b/Task/Fractran/REXX/fractran.rexx new file mode 100644 index 0000000000..1dd1d0179e --- /dev/null +++ b/Task/Fractran/REXX/fractran.rexx @@ -0,0 +1,76 @@ +-- 23 Aug 2025 +include Setting + +say 'FRACTRAN' +say version +say +parse arg n','t +if n = '' then + n = 2 +if t = '' then + t = 100 +numeric digits 200 +call Fractions +call Task +call Powers +call Extra +exit + +Fractions: +call Time('r') +say 'Save fractions...' +l = '17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 1/17 11/13 13/11 15/14 15/2 55/1' +n. = 0; d. = 0; w = Words(l) +do i = 1 to w + a = Word(l,i); parse var a n.i'/'d.i +end +say Format(Time('e'),,3) 'seconds'; say +return + +Task: +call Time('r') +say 'First' t 'terms of the sequence:' +do i = 2 to t + do j = 1 to w + if \ Integer(n/d.j) then + iterate + call CharOut ,Right(n,9) + if i//10 = 0 then + say + n = n%d.j*n.j + leave j + end +end +say Format(Time('e'),,3) 'seconds'; say +return + +Powers: +call Time('r') +say 'Flag powers of 2...' +p. = 0; e. = 0 +do i = 2 to 100 + a = 2**i; p.a = 1; e.a = i +end +say Format(Time('e'),,3) 'seconds'; say +return + +Extra: +call Time('r') +say 'Prime numbers:' +n = 2; p = 0 +do i = 2 to 1300000 + do j = 1 to w + if \ Integer(n/d.j) then + iterate j + if p.n then do + p = p+1 + say Right(p,2) ' Term' Right(i,7) Left('= 2^'e.n,7) 'Prime' Right(e.n,2) 'found' + end + n = n%d.j*n.j + leave j + end +end +say Format(Time('e'),,3) 'seconds'; say +return + +include Math diff --git a/Task/Fractran/Rebol/fractran.rebol b/Task/Fractran/Rebol/fractran.rebol new file mode 100644 index 0000000000..33b17b69b8 --- /dev/null +++ b/Task/Fractran/Rebol/fractran.rebol @@ -0,0 +1,41 @@ +Rebol [ + title: "Rosetta code: Fractran" + file: %Fractran.r3 + url: https://rosettacode.org/wiki/Fractran +] + +fractran: function/with [ + input [string! file! url!] + start [integer!] + terms [integer!] +][ + unless string? input [ input: read/string input ] + ;; --- parse fractions into [numerator denominator] pairs --- + fractions: parse input [collect [fraction some [separator fraction]]] + ;; --- interpreter loop --- + out: append copy [] n: start + while [terms > length? out] [ + forall fractions [ + frac: fractions/1 + if zero? mod n frac/y [ ;; fraction applies: n is divisible + n: n / frac/y * frac/x ;; advance: multiply n by fraction + append out to integer! n ;; keep the result + fractions: head fractions ;; restart from first fraction + break + ] + if tail? fractions [return out] ;; no fraction applied: halt + ] + ] + out +][ + digit: charset "0123456789" + fraction: [copy p [some digit] #"/" copy q [some digit] keep (as-pair to integer! p to integer! q)] + separator: [some #" "] +] + +print "First 100 terms of the sequence:" +out: fractran "17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 1/17 11/13 13/11 15/14 15/2 55/1" 2 100 +forall out [ + prin pad out/1 9 + if zero? mod index? out 10 [print ""] +] diff --git a/Task/Fractran/Red/fractran.red b/Task/Fractran/Red/fractran.red index a61ef88f55..44fb51eabe 100644 --- a/Task/Fractran/Red/fractran.red +++ b/Task/Fractran/Red/fractran.red @@ -5,20 +5,20 @@ if exists? inpf: to-file inp [inp: read inpf] digit: charset "0123456789" frac: [copy p [some digit] #"/" copy q [some digit] - keep (as-pair to-integer p to-integer q)] + keep (as-pair to-integer p to-integer q)] code: parse inp [collect [frac some [[some " "] frac]]] n: to-integer ask "please enter starting number n: " x: to-integer ask "please enter the number of terms, hit return for no limit: " l: length? code loop x [ - forall code [ - c: code/1 - if n % c/y = 0 [ - print n: n / c/y * c/x - code: head code - break - ] - if l = index? code [halt] - ] + forall code [ + c: code/1 + if n % c/y = 0 [ + print n: n / c/y * c/x + code: head code + break + ] + if l = index? code [halt] + ] ] diff --git a/Task/Fractran/Refal/fractran.refal b/Task/Fractran/Refal/fractran.refal new file mode 100644 index 0000000000..e66c789961 --- /dev/null +++ b/Task/Fractran/Refal/fractran.refal @@ -0,0 +1,78 @@ +$ENTRY Go { + , >: e.Prog + = > + >; +}; + +PrimeProgram { + = '17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 ' + '1/17 11/13 13/11 15/14 15/2 55/1'; +}; + +FracPrimes { + 0 e.X = ; + s.I (e.N) e.P, + : Next e.N2, + : { + T s.N = s.N (e.N2) e.P>; + F = ; + }; +}; + +FracPrime { + (1) 1 = F; + (s.N) 1 = T s.N; + (s.N) e.X, : { + (e.X2) 0 = ) e.X2>; + e.Z = F; + }; + e.X = ; +}; + +FracRun { + 0 e.X = ; + s.I (e.N) e.P, : { + Halt = e.N; + Next e.N2 = e.N (e.N2) e.P>; + }; +}; + +FracStep { + (e.N) = Halt; + (e.N) ((e.Num) e.Denom) e.P, + ) e.Denom>: { + (e.N2) 0 = Next e.N2; + e.X = ; + }; +}; + +Prog { + e.X, : T (e.F) e.R = (e.F) ; + e.X = ; +}; + +Frac { + e.X, : T (e.N) e.X2, + : '/' e.X3, + : T (e.D) e.X4 = + T ((e.N) e.D) e.X4; + e.X = F e.X; +}; + +Num { + e.X, >: { + () e.R = F e.R; + (e.N) e.R = T () e.R; + }; +}; + +Span { + (e.M) (e.S) s.C e.X, e.S: e.1 s.C e.2 = ; + (e.M) (e.S) e.X = (e.M) e.X; + (e.S) e.X = ; +}; + +SkipWs { + s.C e.X, ' \n\t': e.1 s.C e.2 = ; + e.X = e.X; +}; diff --git a/Task/Fractran/Rust/fractran.rs b/Task/Fractran/Rust/fractran.rs new file mode 100644 index 0000000000..e73a574558 --- /dev/null +++ b/Task/Fractran/Rust/fractran.rs @@ -0,0 +1,75 @@ +use std::io; + +struct Fractran { + start: i32, + limit: i32, +} + +impl Fractran { + fn new() -> Self { + Fractran { + start: 0, + limit: 0, + } + } + + fn run(&mut self, program: &str, start: i32, limit: i32) { + self.start = start; + self.limit = limit; + + // Parse the program string into fraction pairs + let fractions: Vec<(f64, f64)> = program + .split_whitespace() + .filter_map(|fraction_str| { + if let Some(pos) = fraction_str.find('/') { + let numerator = fraction_str[..pos].parse::().ok()?; + let denominator = fraction_str[pos + 1..].parse::().ok()?; + Some((numerator, denominator)) + } else { + None + } + }) + .collect(); + + self.exec(&fractions); + } + + fn exec(&mut self, fractions: &[(f64, f64)]) { + let mut count = 0; + + while count < self.limit { + println!("{} : {}", count, self.start); + count += 1; + + let mut found = false; + + for &(numerator, denominator) in fractions { + let result = self.start as f64 * (numerator / denominator); + + // Check if result is a whole number + if (result - result.floor()).abs() < f64::EPSILON { + self.start = result as i32; + found = true; + break; + } + } + + if !found { + break; + } + } + } +} + +fn main() { + let mut fractran = Fractran::new(); + fractran.run( + "17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 1/17 11/13 13/11 15/14 15/2 55/1", + 2, + 15 + ); + + // Wait for user input (equivalent to cin.get()) + let mut input = String::new(); + io::stdin().read_line(&mut input).expect("Failed to read line"); +} diff --git a/Task/Fractran/SETL/fractran.setl b/Task/Fractran/SETL/fractran.setl new file mode 100644 index 0000000000..05f2b18236 --- /dev/null +++ b/Task/Fractran/SETL/fractran.setl @@ -0,0 +1,52 @@ +program fractran; + p := parse_fractran( + "17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 " + + "1/17 11/13 13/11 15/14 15/2 55/1" + ); + + print(frac_run_steps(p, 2, 15)); + print(frac_primes(p, 2, 20)); + + proc frac_primes(p, n, nprimes); + primes := []; + loop for i in [1..nprimes] do + loop until n bit_and (n-1) = 0 do + n := frac_step(p, n); + end loop; + primes with:= log n/log 2; + end loop; + return primes; + end proc; + + proc frac_run_steps(p, n, steps); + return [n] + [n := frac_step(p, n) : i in [2..steps]]; + end proc; + + proc frac_step(p, n); + if exists [num, denom] in p | n * num mod denom = 0 then + return n * num div denom; + end if; + return om; + end proc; + + proc rdws(rw s); + span(s, " \t\n"); + end proc; + + proc rdnum(rw s); + rdws(s); + return val span(s, "0123456789"); + end proc; + + proc rdfrac(rw s); + if (num := rdnum(s)) = om then return om; end if; + rdws(s); + if match(s, "/") = "" then return om; end if; + if (denom := rdnum(s)) = om then return om; end if; + return [num, denom]; + end proc; + + proc parse_fractran(s); + return [f := rdfrac(s) : until f=om]; + end proc; +end program; diff --git a/Task/Fractran/Scheme/fractran.ss b/Task/Fractran/Scheme/fractran.scm similarity index 100% rename from Task/Fractran/Scheme/fractran.ss rename to Task/Fractran/Scheme/fractran.scm diff --git a/Task/Fractran/TI-83-BASIC/fractran.basic b/Task/Fractran/TI-83-BASIC/fractran.basic index 3c39e388a9..c501d5df6a 100644 --- a/Task/Fractran/TI-83-BASIC/fractran.basic +++ b/Task/Fractran/TI-83-BASIC/fractran.basic @@ -5,15 +5,15 @@ Dim(LA)->U T->Dim(LC) For(I,1,T) - 1->J: 1->F - While J<=U and F=1 - If remainder(N,LB(J))=0 - Then - Disp N - N->LC(I) - iPart(N/LB(J))*LA(J)->N - 0->F - End - J+1->J - End + 1->J: 1->F + While J<=U and F=1 + If remainder(N,LB(J))=0 + Then + Disp N + N->LC(I) + iPart(N/LB(J))*LA(J)->N + 0->F + End + J+1->J + End End diff --git a/Task/Fractran/Tcl/fractran-1.tcl b/Task/Fractran/Tcl/fractran-1.tcl index 50932aaba5..6a0acc52ec 100644 --- a/Task/Fractran/Tcl/fractran-1.tcl +++ b/Task/Fractran/Tcl/fractran-1.tcl @@ -3,42 +3,42 @@ package require Tcl 8.6 oo::class create Fractran { variable fracs nco constructor {fractions} { - set fracs {} - foreach frac $fractions { - if {[regexp {^(\d+)/(\d+),?$} $frac -> num denom]} { - lappend fracs $num $denom - } else { - return -code error "$frac is not a supported fraction" - } - } - if {![llength $fracs]} { - return -code error "need at least one fraction" - } + set fracs {} + foreach frac $fractions { + if {[regexp {^(\d+)/(\d+),?$} $frac -> num denom]} { + lappend fracs $num $denom + } else { + return -code error "$frac is not a supported fraction" + } + } + if {![llength $fracs]} { + return -code error "need at least one fraction" + } } method execute {n {steps 15}} { - set co [coroutine [incr nco] my Generate $n] - for {set i 0} {$i < $steps} {incr i} { - lappend result [$co] - } - catch {rename $co ""} - return $result + set co [coroutine [incr nco] my Generate $n] + for {set i 0} {$i < $steps} {incr i} { + lappend result [$co] + } + catch {rename $co ""} + return $result } method Step {n} { - foreach {num den} $fracs { - if {$n % $den} continue - return [expr {$n * $num / $den}] - } - return -code break + foreach {num den} $fracs { + if {$n % $den} continue + return [expr {$n * $num / $den}] + } + return -code break } method Generate {n} { - yield [info coroutine] - while 1 { - yield $n - set n [my Step $n] - } - return -code break + yield [info coroutine] + while 1 { + yield $n + set n [my Step $n] + } + return -code break } } diff --git a/Task/Fractran/Tcl/fractran-2.tcl b/Task/Fractran/Tcl/fractran-2.tcl index a61af1865b..21da1ffe97 100644 --- a/Task/Fractran/Tcl/fractran-2.tcl +++ b/Task/Fractran/Tcl/fractran-2.tcl @@ -2,10 +2,10 @@ oo::objdefine $ft method pow2 {n} { set co [coroutine [incr nco] my Generate 2] set pows {} while {[llength $pows] < $n} { - set item [$co] - if {($item & ($item-1)) == 0} { - lappend pows $item - } + set item [$co] + if {($item & ($item-1)) == 0} { + lappend pows $item + } } return $pows } diff --git a/Task/Fractran/UNIX-Shell/fractran.sh b/Task/Fractran/UNIX-Shell/fractran.sh index 916bfce39b..bf28e57eb8 100644 --- a/Task/Fractran/UNIX-Shell/fractran.sh +++ b/Task/Fractran/UNIX-Shell/fractran.sh @@ -10,10 +10,10 @@ t=0 n=72 echo "steps of computation" > steps.csv while [ $t -le 6 ]; do - if [ $(($n*${ns[$t]}%${ds[$t]})) -eq 0 ]; then - let "n=$(($n*${ns[$t]}/${ds[$t]}))" - let "t=0" - factor $n >> steps.csv - fi - let "t=$t+1" + if [ $(($n*${ns[$t]}%${ds[$t]})) -eq 0 ]; then + let "n=$(($n*${ns[$t]}/${ds[$t]}))" + let "t=0" + factor $n >> steps.csv + fi + let "t=$t+1" done diff --git a/Task/Fractran/Wren/fractran.wren b/Task/Fractran/Wren/fractran.wren index 1bcd949761..b719acd12d 100644 --- a/Task/Fractran/Wren/fractran.wren +++ b/Task/Fractran/Wren/fractran.wren @@ -1,4 +1,4 @@ -import "/big" for BigInt, BigRat +import "./big" for BigInt, BigRat var isPowerOfTwo = Fn.new { |bi| bi & (bi - BigInt.one) == BigInt.zero } diff --git a/Task/Fractran/Zkl/fractran-1.zkl b/Task/Fractran/Zkl/fractran-1.zkl index ab1e3d8182..ca49aa5d7d 100644 --- a/Task/Fractran/Zkl/fractran-1.zkl +++ b/Task/Fractran/Zkl/fractran-1.zkl @@ -2,14 +2,14 @@ var fracs="17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17," "11/13, 13/11, 15/14, 15/2, 55/1"; fcn fractranW(n,fracsAsOneBigString){ //-->Walker (iterator) fracs:=(fracsAsOneBigString-" ").split(",").apply( - fcn(frac){ frac.split("/").apply("toInt") }); //( (n,d), (n,d), ...) + fcn(frac){ frac.split("/").apply("toInt") }); //( (n,d), (n,d), ...) Walker(fcn(rn,fracs){ n:=rn.value; foreach a,b in (fracs){ - if(n*a%b == 0){ - rn.set(n*a/b); - return(n); - } + if(n*a%b == 0){ + rn.set(n*a/b); + return(n); + } } }.fp(Ref(n),fracs)) } diff --git a/Task/Fractran/Zkl/fractran-3.zkl b/Task/Fractran/Zkl/fractran-3.zkl index 00de8a061b..718365473b 100644 --- a/Task/Fractran/Zkl/fractran-3.zkl +++ b/Task/Fractran/Zkl/fractran-3.zkl @@ -2,9 +2,9 @@ var [const] BN=Import("zklBigNum"); // libGMP fcn fractranPrimes{ foreach n,fr in ([1..].zip(fractranW(BN(2),fracs))){ if(fr.num1s==1){ - p:=(fr.toString(2) - "1").len(); // count zeros - if(p>1) - println("Prime %3d from the nth Fractran(%8d): %d".fmt(p,n,fr)); + p:=(fr.toString(2) - "1").len(); // count zeros + if(p>1) + println("Prime %3d from the nth Fractran(%8d): %d".fmt(p,n,fr)); } } } diff --git a/Task/French-Republican-calendar/C++/french-republican-calendar.cpp b/Task/French-Republican-calendar/C++/french-republican-calendar.cpp new file mode 100644 index 0000000000..ec13592d10 --- /dev/null +++ b/Task/French-Republican-calendar/C++/french-republican-calendar.cpp @@ -0,0 +1,138 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +const std::vector MONTHS = { + "Vendemiaire", "Brumaire", "Frimaire", "Nivose", "Pluviose", "Ventose", "Germinal", + "Floreal", "Prairial", "Messidor", "Thermidor", "Fructidor", "Sansculottide" }; + +const std::vector SANSCULOTTIDES = { + "Fete de la vertu", "Fete du genie", "Fete du travail", + "Fete de l'opinion", "Fete des recompenses", "Fete de la Revolution" }; + +const std::vector GREGORIAN_MONTHS = { + "January", "February", "March", "April", "May", "June", "July", "August", + "September", "October", "November", "December" }; + +const std::chrono::year_month_day INTRODUCTION_DATE = + { std::chrono::year{1792}, std::chrono::month{9}, std::chrono::day{22} }; + +const std::chrono::year_month_day TERMINATION_DATE = + { std::chrono::year{1805}, std::chrono::month{12}, std::chrono::day{31} }; + +struct French_RC_Date { + uint32_t year, month, day; +}; + +std::vector split_string(const std::string& text, const char& delimiter) { + std::vector words; + std::istringstream stream(text); + std::string word; + while ( std::getline(stream, word, delimiter) ) { + words.emplace_back(word); + } + return words; +} + +uint32_t index_of(const std::vector& vec, const std::string& element) { + auto iter = std::find(vec.begin(), vec.end(), element); + return std::distance(vec.begin(), iter); +} + +uint32_t additional_days_for_year(const uint32_t& year) { + return ( year > 11 ) ? 3 : ( year > 7 ) ? 2 : ( year > 3 ) ? 1 : 0; +} + +std::string to_french_rc_date_string(French_RC_Date french_rc_date) { + if ( french_rc_date.month < 13 ) { + return std::to_string(french_rc_date.day) + " " + MONTHS[french_rc_date.month - 1] + + " " + std::to_string(french_rc_date.year); + } + return SANSCULOTTIDES[french_rc_date.day - 1] + " " + std::to_string(french_rc_date.year); +} + +std::string to_gregorian_date_string(std::chrono::year_month_day gregorian_date) { + const uint32_t year = static_cast(gregorian_date.year()); + const uint32_t month = static_cast(gregorian_date.month()); + const uint32_t day = static_cast(gregorian_date.day()); + const std::string month_string = GREGORIAN_MONTHS[month - 1]; + return std::to_string(day) + " " + month_string + " " + std::to_string(year); +} + +std::chrono::year_month_day parse_gregorian_date(const std::string& gregorian_string) { + std::vector splits = split_string(gregorian_string, ' '); + const uint32_t month = index_of(GREGORIAN_MONTHS, splits[1]) + 1; + return std::chrono::year_month_day{std::chrono::year{std::stoi(splits[2])}, + std::chrono::month{month}, std::chrono::day{static_cast(std::stoi(splits[0]))}}; +} + +French_RC_Date parse_french_rc_date(const std::string& french_rc_date) { + std::vector splits = split_string(french_rc_date, ' '); + if ( splits.size() == 3 ) { + const uint32_t year = std::stoi(splits[2]); + const uint32_t month = index_of(MONTHS, splits[1]) + 1; + const uint32_t day = std::stoi(splits[0]); + return French_RC_Date(year, month, day); + } + + std::string year_string = splits[splits.size() - 1]; + const uint32_t year = std::stoi(year_string); + std::string sansculottides_day = french_rc_date.substr(0, french_rc_date.size() - year_string.size() - 1); + const uint32_t day = index_of(SANSCULOTTIDES, sansculottides_day) + 1; + return French_RC_Date(year, 13, day); +} + +French_RC_Date to_french_rc_date(const std::chrono::year_month_day& gregorian_date) { + const int32_t days_before = + ( std::chrono::sys_days(TERMINATION_DATE) - std::chrono::sys_days(gregorian_date) ).count(); + const int32_t days_after = + ( std::chrono::sys_days(gregorian_date) - std::chrono::sys_days(INTRODUCTION_DATE) ).count(); + if ( days_after < 0 || days_before < 0 ) { + throw std::invalid_argument("French Republican Calendar date out of range."); + } + + uint32_t year = ( days_after + 366 ) / 365; + uint32_t days = ( days_after + 366 ) % 365 - additional_days_for_year(year); + if ( days == 0 ) { + year -= 1; + days += 366; + } + + if ( days < 361 ) { + return French_RC_Date(year, days / 30 + 1, days % 30); + } + return French_RC_Date(year, 13, days - 360); +} + +std::chrono::year_month_day to_gregorian_date(French_RC_Date french_rc_date) { + const uint32_t days = ( french_rc_date.year - 1 ) * 365 + additional_days_for_year(french_rc_date.year) + + ( french_rc_date.month - 1 ) * 30 + french_rc_date.day - 1; + return std::chrono::sys_days(INTRODUCTION_DATE) + std::chrono::days(days); +} + +int main() { + std::vector gregorian_strings = { + "22 September 1792", "20 May 1795", "15 July 1799", "23 September 1803", "31 December 1805" }; + + std::vector french_rc_strings = { }; + for ( const std::string& gregorian_string : gregorian_strings ) { + std::chrono::year_month_day gregorian_date = parse_gregorian_date(gregorian_string); + French_RC_Date french_rc_date = to_french_rc_date(gregorian_date); + const std::string french_rc_date_string = to_french_rc_date_string(french_rc_date); + french_rc_strings.emplace_back(french_rc_date_string); + std::cout << gregorian_string << " => " << french_rc_date_string << "\n"; + } + std::cout << "\n"; + + for ( const std::string& french_rc_string : french_rc_strings ) { + French_RC_Date french_rc_date = parse_french_rc_date(french_rc_string); + std::chrono::year_month_day gregorian_date = to_gregorian_date(french_rc_date); + const std::string gregorian_date_string = to_gregorian_date_string(gregorian_date); + std::cout << french_rc_string << " => " << gregorian_date_string << "\n"; + } +} diff --git a/Task/French-Republican-calendar/EasyLang/french-republican-calendar.easy b/Task/French-Republican-calendar/EasyLang/french-republican-calendar.easy new file mode 100644 index 0000000000..cd5d943873 --- /dev/null +++ b/Task/French-Republican-calendar/EasyLang/french-republican-calendar.easy @@ -0,0 +1,99 @@ +func repLeap y . + return if (y + 1) mod 4 = 0 and ((y + 1) mod 100 <> 0 or (y + 1) mod 400 = 0) +. +func greLeap y . + return if y mod 4 = 0 and y mod 100 <> 0 or y mod 400 = 0 +. +gregmd[] = [ 31 28 31 30 31 30 31 31 30 31 30 31 ] +greg$[] = [ "January" "February" "March" "April" "May" "June" "July" "August" "September", "October" "November" "December" ] +repu$[] = [ "Vendémiaire" "Brumaire" "Frimaire" "Nivôse" "Pluviôse" "Ventôse" "Germinal" "Floréal" "Prairial" "Messidor" "Thermidor" "Fructidor" "Sansculottide" ] +sanscu$[] = [ "Fête de la vertu" "Fête du génie" "Fête du travail" "Fête de l'opinion" "Fête des récompenses" "Fête de la Révolution" ] +proc split s$ &d &m &y . + if substr s$ 1 4 = "Fête" + m = 13 + for d to len sanscu$[] + sc$ = sanscu$[d] + if substr s$ 1 len sc$ = sc$ + y = number substr s$ (len sc$ + 1) 99 + break 1 + . + . + else + h = strpos s$ " " + d = number substr s$ 1 h + my$ = substr s$ (h + 1) 99 + h = strpos my$ " " + m$ = substr my$ 1 (h - 1) + y = number substr my$ (h + 1) 99 + months$[] = greg$[] + if y < 1792 : months$[] = repu$[] + for m to 12 : if months$[m] = m$ : break 1 + . +. +func greToDay d m y . + if m < 3 + y -= 1 + m += 12 + . + return y * 36525 div 100 - y div 100 + y div 400 + 306 * (m + 1) div 10 + d - 654842 +. +func repToDay d m y . + if m = 13 + m -= 1 + d += 30 + . + d -= repLeap y + return 365 * y + (y + 1) div 4 - (y + 1) div 100 + (y + 1) div 400 + 30 * m + d - 395 +. +proc dayToGre day &d &m &y . + y = day * 100 div 36525 + d = day - y * 36525 div 100 + 21 + y += 1792 + d += y div 100 - y div 400 - 13 + m = 9 + while d > gregmd[m] + d -= gregmd[m] + m += 1 + if m = 13 + m = 1 + y += 1 + gregmd[2] = 28 + greLeap y + . + . +. +proc dayToRep day &d &m &y . + y = (day - 1) * 100 div 36525 + if repLeap y = 1 : y -= 1 + y += 1 + d = day - y * 36525 div 100 + 365 + y div 100 - y div 400 + m = 1 + sanscul = 5 + repLeap y + while d > 30 + d -= 30 + m += 1 + if m = 13 + if d > sanscul + d -= sanscul + m = 1 + y += 1 + sanscul = 5 + repLeap y + . + . + . +. +test$[] = [ "1 Vendémiaire 1" "1 Prairial 3" "27 Messidor 7" "Fête de la Révolution 11" "10 Nivôse 14" "22 September 1792" "20 May 1795" "15 July 1799" "23 September 1803" "31 December 1805" ] +for s$ in test$[] + write s$ & " => " + split s$ day, month, year + if year < 1792 + dayToGre (repToDay day month year) day month year + print day & " " & greg$[month] & " " & year + else + dayToRep (greToDay day month year) day month year + if month = 13 + print sanscu$[day] & " " & year + else + print day & " " & repu$[month] & " " & year + . + . +. diff --git a/Task/French-Republican-calendar/Fortran/french-republican-calendar.f b/Task/French-Republican-calendar/Fortran/french-republican-calendar.f new file mode 100644 index 0000000000..b5705acc4f --- /dev/null +++ b/Task/French-Republican-calendar/Fortran/french-republican-calendar.f @@ -0,0 +1,338 @@ +program calendar_converter + implicit none + + character(len=40) :: input_date,tstring + integer :: year, month, day, jd, i + logical :: is_gregorian +! + ! Test date arrays + character(len=*), parameter :: rep_dates(5) = [ & + '1 Vendemiaire 1 ', & + '1 Prairial 3 ', & + '27 Messidor 7 ', & + 'Fete de la Revolution 11 ', & + '10 Nivose 14 ' ] + + character(len=*), parameter :: greg_dates(5) = [ & + '22 September 1792 ', & + '20 May 1795 ', & + '15 July 1799 ', & + '23 September 1803 ', & + '31 December 1805 ' ] + do + print *, "Enter date (format examples):" + print *, "Gregorian: '20 May 1795' or Republican: '1 Prairial 3'" + print *, "Press Enter to exit" + read (*, '(a)') input_date + input_date = to_lower(input_date) + + if (len_trim(input_date) == 0) exit + + ! Try parsing as Gregorian first + if (parse_gregorian(input_date, year, month, day)) then + is_gregorian = .true. + else if (parse_republican(input_date, year, month, day)) then + is_gregorian = .false. + else + print *, "Invalid date format" + cycle + end if + + if (is_gregorian) then + jd = gregorian_to_jd(year, month, day) + call jd_to_republican(jd, year, month, day) + print *, "Republican date: ", republican_date_string(year, month, day) + else + jd = republican_to_jd(year, month, day) + call jd_to_gregorian(jd, year, month, day) + print *, "Gregorian date: ", gregorian_date_string(year, month, day) + end if + end do + + + ! Automatic conversions when exiting + print *, 'Converting predefined Republican dates:' + do i = 1, size(rep_dates) + tstring = to_lower(rep_dates(i)) + if (parse_republican(trim(tstring), year, month, day)) then + jd = republican_to_jd(year, month, day) + call jd_to_gregorian(jd, year, month, day) + print *, rep_dates(i), ' => ', gregorian_date_string(year, month, day) + end if + end do + + print '(/,a)','Converting predefined Gregorian dates:' + do i = 1, size(greg_dates) + tstring = to_lower(greg_dates(i)) + if (parse_gregorian(trim(tstring), year, month, day)) then + jd = gregorian_to_jd(year, month, day) + call jd_to_republican(jd, year, month, day) + print *, greg_dates(i), ' => ', republican_date_string(year, month, day) + end if + end do + +contains + + function parse_gregorian(str, y, m, d) result(success) + character(*), intent(in) :: str + integer, intent(out) :: y, m, d + logical :: success + character(len=3) :: mon + integer :: ios + + read(str, *, iostat=ios) d, mon, y + if (ios == 0) then + m = month_number(mon) + success = (m > 0) + else + success = .false. + end if + end function parse_gregorian + + function parse_republican(str, y, m, d) result(success) + character(*), intent(in) :: str + integer, intent(out) :: y, m, d + logical :: success + character(len=35) :: tokens(10) + integer :: num_tokens, i, ios + character(len=100) :: festival_name + + success = .false. + tokens = ' ' + call tokenize(str, tokens, num_tokens) + + if (num_tokens < 2) return + + if (.not. is_numeric(tokens(num_tokens))) return + read(tokens(num_tokens), *, iostat=ios) y + if (ios /= 0) return + + if (num_tokens == 3) then + if (.not. is_numeric(tokens(1))) return + read(tokens(1), *, iostat=ios) d + if (ios /= 0) return + + do m = 1, 12 + if (trim(tokens(2)) == republican_months(m)) then + success = .true. + return + end if + end do + else if (num_tokens >= 4) then + if (tokens(1) /= 'fete') return + + festival_name = tokens(1) + do i = 2, num_tokens-1 + festival_name = festival_name(1:len_trim(festival_name)) // ' ' // tokens(i) + end do + do i = 1, 6 + if (festival_name == sansculottides(i)) then + m = 13 + d = i + success = .true. + return + end if + end do + end if + end function parse_republican + + function to_lower(str) result(lower_str) + character(*), intent(in) :: str + character(len(str)) :: lower_str + integer :: i, c + lower_str = str + do i = 1, len(str) + c = iachar(str(i:i)) + if (c >= 65 .and. c <= 90) lower_str(i:i) = achar(c + 32) + end do + end function to_lower + + subroutine tokenize(input_string, tokens, num_tokens) + character(*), intent(in) :: input_string + character(*), intent(out) :: tokens(:) + integer, intent(out) :: num_tokens + integer :: i, start_idx, end_idx, str_len + character(len=len(input_string)) :: temp_str + + num_tokens = 0 + temp_str = adjustl(input_string) + str_len = len_trim(temp_str) + if (str_len == 0) return + + start_idx = 1 + do i = 1, str_len + if (scan(temp_str(i:i), " -/,.") > 0) then + end_idx = i - 1 + if (end_idx >= start_idx) then + num_tokens = num_tokens + 1 + if (num_tokens > size(tokens)) exit + tokens(num_tokens) = temp_str(start_idx:end_idx) + end if + start_idx = i + 1 + end if + end do + + if (start_idx <= str_len) then + num_tokens = num_tokens + 1 + if (num_tokens <= size(tokens)) then + tokens(num_tokens) = temp_str(start_idx:) + end if + end if + end subroutine tokenize + + function is_numeric(str) result(res) + character(*), intent(in) :: str + logical :: res + integer :: ios + integer :: dummy + read(str, *, iostat=ios) dummy + res = (ios == 0) + end function is_numeric + + function republican_months(m) result(namer) + integer, intent(in) :: m + character(len=12) :: namer + character(len=12), parameter :: names(13) = [character(len=12):: & + 'vendemiaire ', 'brumaire ', 'frimaire ', 'nivose ', & + 'pluviose ', 'ventose ', 'germinal ', 'floreal ', & + 'prairial ', 'messidor ', 'thermidor ', 'fructidor ', & + 'sansculott' ] + namer = names(m) + end function republican_months + + function sansculottides(d) result(name) + integer, intent(in) :: d + character(len=21) :: name + character(len=21), parameter :: names(6) = [ character(len=21)::& + 'fete de la vertu ', 'fete du genie ', & + 'fete du travail ', 'fete de l''opinion ', & + 'fete des recompenses', 'fete de la revolution' ] + name = names(d) + end function sansculottides + + function gregorian_date_string(y, m, d) result(str) + integer, intent(in) :: y, m, d + character(len=21) :: str + write(str, '(i0, 1x, a, 1x, i0)') d, trim(gregorian_months(m)), y + end function gregorian_date_string + + function republican_date_string(y, m, d) result(str) + integer, intent(in) :: y, m, d + character(len=30) :: str + character(len=30) :: holder + if (m == 13) then + holder = uppercasefirst(trim(sansculottides(d))) + write(str, '(a, 1x, i0)') trim(holder), y + else + holder = uppercasefirst(trim(republican_months(m))) + write(str, '(i0, 1x, a, 1x, i0)') d, trim(holder), y + end if + end function republican_date_string + + function month_number(mon) result(m) + character(*), intent(in) :: mon + integer :: m + character(len=3) :: months(12) = ['jan','feb','mar','apr','may','jun', & + 'jul','aug','sep','oct','nov','dec'] + do m = 1, 12 + if (months(m) == mon) return + end do + m = 0 + end function month_number + + function gregorian_months(m) result(name) + integer, intent(in) :: m + character(len=3) :: name + character(len=3) :: names(12) = ['Jan','Feb','Mar','Apr','May','Jun', & + 'Jul','Aug','Sep','Oct','Nov','Dec'] + name = names(m) + end function gregorian_months + + function republican_to_jd(year, month, day) result(jd) + integer, intent(in) :: year, month, day + integer :: jd + integer, parameter :: epoch_jd = 2375840 + integer :: total_days, leap_years, y + + if (month < 1 .or. month > 13) error stop "Invalid Republican month" + if (day < 1 .or. (month < 13 .and. day > 30)) error stop "Invalid Republican day" + if (month == 13 .and. day > 6) error stop "Invalid Sansculottides day" + + total_days = (year - 1) * 365 + (month - 1) * 30 + (day - 1) + leap_years = count([(is_republican_leap(y), y = 1, year-1)]) + total_days = total_days + leap_years + jd = epoch_jd + total_days + end function republican_to_jd + + integer function gregorian_to_jd(year, month, day) + integer, intent(in) :: year, month, day + integer :: a, y, m + a = (14 - month) / 12 + y = year + 4800 - a + m = month + 12*a - 3 + gregorian_to_jd = day + ((153*m + 2)/5) + 365*y + y/4 - y/100 + y/400 - 32045 + end function gregorian_to_jd + + pure logical function is_republican_leap(y) + integer, intent(in) :: y + integer, parameter :: historical_leaps(*) = [3, 7, 11, 15, 20] + is_republican_leap = any(historical_leaps == y) + end function is_republican_leap + + subroutine jd_to_gregorian(jd, year, month, day) + integer, intent(in) :: jd + integer, intent(out) :: year, month, day + integer :: a, b, c, d, e, m + a = jd + 32044 + b = (4*a + 3)/146097 + c = a - (146097*b)/4 + d = (4*c + 3)/1461 + e = c - (1461*d)/4 + m = (5*e + 2)/153 + day = int(e - (153*m + 2)/5 + 1) + month = int(m + 3 - 12*(m/10)) + year = int(100*b + d - 4800 + (m/10)) + end subroutine jd_to_gregorian + + subroutine jd_to_republican(jd, year, month, day) + integer, intent(out) :: year, month, day + integer, intent(in) :: jd + integer, parameter :: epoch_jd = 2375840 + integer :: days_since_epoch, y, leap_days, d + + days_since_epoch = jd - epoch_jd + if (days_since_epoch < 0) error stop "Date before Republican epoch" + + year = 1 + days_since_epoch / 365 + leap_days = count([(is_republican_leap(y), y = 1, year-1)]) + + d = days_since_epoch - (year-1)*365 - leap_days + if (d < 0) then + year = year - 1 + leap_days = count([(is_republican_leap(y), y = 1, year-1)]) + d = days_since_epoch - (year-1)*365 - leap_days + end if + + if (d < 360) then + month = d/30 + 1 + day = mod(d,30) + 1 + else + month = 13 + day = d - 359 + end if + end subroutine jd_to_republican + + function uppercasefirst(str) result(result_str) + character(len=*), intent(in) :: str + character(len=len(str)) :: result_str + integer :: c + result_str = str + if (len_trim(str) > 0) then + c = iachar(str(1:1)) + if (c >= iachar('a') .and. c <= iachar('z')) then + result_str(1:1) = achar(c - 32) + end if + end if + end function uppercasefirst + +end program calendar_converter diff --git a/Task/French-Republican-calendar/Java/french-republican-calendar.java b/Task/French-Republican-calendar/Java/french-republican-calendar.java new file mode 100644 index 0000000000..64d0ca9aa4 --- /dev/null +++ b/Task/French-Republican-calendar/Java/french-republican-calendar.java @@ -0,0 +1,106 @@ +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; + +public final class FrenchRepublicanCalendar { + + public static void main(String[] args) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("d MMMM yyyy"); + + List gregorianStrings = List.of( + "22 September 1792", "20 May 1795", "15 July 1799", "23 September 1803", "31 December 1805" ); + + List frenchRCStrings = new ArrayList(); + for ( String gregorianString : gregorianStrings ) { + LocalDate gregorianDate = LocalDate.parse(gregorianString, formatter); + FrenchRCDate frenchRCDate = FrenchRCDate.toFrenchRCDate(gregorianDate); + frenchRCStrings.addLast(frenchRCDate.toString()); + System.out.println(gregorianString + " => " + frenchRCDate); + } + System.out.println(); + + for ( String frenchRCString : frenchRCStrings ) { + FrenchRCDate frenchRCDate = FrenchRCDate.parse(frenchRCString); + String gregorianDate = formatter.format(frenchRCDate.toGregorianDate()); + System.out.println(frenchRCString + " => " + gregorianDate); + } + } + +} + +final class FrenchRCDate { + + public FrenchRCDate(int aYear, int aMonth, int aDay) { + year = aYear; month = aMonth; day = aDay; + } + + public LocalDate toGregorianDate() { + final int days = ( year - 1 ) * 365 + additionalDaysForYear(year) + ( month - 1 ) * 30 + day - 1; + return INTRODUCTION_DATE.plusDays(days); + } + + public String toString() { + if ( month < 13 ) { + return day + " " + MONTHS.get(month - 1) + " " + year; + } + return SANSCULOTTIDES.get(day - 1) + " " + year; + } + + public static FrenchRCDate toFrenchRCDate(LocalDate gregorianDate) { + final int daysBefore = (int) ChronoUnit.DAYS.between(gregorianDate, TERMINATION_DATE); + final int daysAfter = (int) ChronoUnit.DAYS.between(INTRODUCTION_DATE, gregorianDate); + if ( daysAfter < 0 || daysBefore < 0 ) { + throw new IllegalArgumentException("French Republican Calendar date out of range."); + } + + int year = ( daysAfter + 366 ) / 365; + int days = ( daysAfter + 366 ) % 365 - additionalDaysForYear(year); + if ( days < 1 ) { + year -= 1; + days += 366; + } + + if ( days < 361 ) { + return new FrenchRCDate(year, days / 30 + 1, days % 30); + } + return new FrenchRCDate(year, 13, days - 360); + } + + public static FrenchRCDate parse(String frenchRCDate) { + String[] splits = frenchRCDate.split(" "); + if ( splits.length == 3 ) { + final int year = Integer.valueOf(splits[2]); + final int month = MONTHS.indexOf(splits[1]) + 1; + final int day = Integer.valueOf(splits[0]); + return new FrenchRCDate(year, month, day); + } + + String yearString = splits[splits.length - 1]; + final int year = Integer.valueOf(yearString); + String sansculottidesDay = frenchRCDate.substring(0, frenchRCDate.lastIndexOf(" ")); + final int day = SANSCULOTTIDES.indexOf(sansculottidesDay) + 1; + return new FrenchRCDate(year, 13, day); + } + + public static int additionalDaysForYear(int year) { + return ( year > 11 ) ? 3 : ( year > 7 ) ? 2 : ( year > 3 ) ? 1 : 0; + } + + public static final LocalDate INTRODUCTION_DATE = LocalDate.of(1792, 9, 22); + public static final LocalDate TERMINATION_DATE = LocalDate.of(1805, 12, 31); + + private int year, month, day; + + private static final List MONTHS = List.of( + "Vendémiaire", "Brumaire", "Frimaire", "Nivôse", "Pluviôse", "Ventôse", "Germinal", + "Floréal", "Prairial", "Messidor", "Thermidor", "Fructidor", "Sansculottide" + ); + + private static final List SANSCULOTTIDES = List.of( + "Fête de la vertu", "Fête du génie", "Fête du travail", + "Fête de l'opinion", "Fête des récompenses", "Fête de la Révolution" + ); + +} diff --git a/Task/French-Republican-calendar/JavaScript/french-republican-calendar.js b/Task/French-Republican-calendar/JavaScript/french-republican-calendar.js new file mode 100644 index 0000000000..5abfc4a5ff --- /dev/null +++ b/Task/French-Republican-calendar/JavaScript/french-republican-calendar.js @@ -0,0 +1,130 @@ +class FrenchRCDate { + constructor(year, month, day) { + this.year = year; + this.month = month; + this.day = day; + } + + static INTRODUCTION_DATE = new Date(Date.UTC(1792, 8, 22)); // Months are zero-indexed in JS + static TERMINATION_DATE = new Date(Date.UTC(1805, 11, 31)); + + static MONTHS = [ + "Vendémiaire", "Brumaire", "Frimaire", "Nivôse", "Pluviôse", "Ventôse", + "Germinal", "Floréal", "Prairial", "Messidor", "Thermidor", "Fructidor" + ]; + + static SANSCULOTTIDES = [ + "Fête de la vertu", "Fête du génie", "Fête du travail", + "Fête de l'opinion", "Fête des récompenses", "Fête de la Révolution" + ]; + + toGregorianDate() { + const days = (this.year - 1) * 365 + FrenchRCDate.additionalDaysForYear(this.year) + + (this.month - 1) * 30 + this.day - 1; + + const gregorian = new Date(FrenchRCDate.INTRODUCTION_DATE); + gregorian.setUTCDate(gregorian.getUTCDate() + days); + return gregorian; + } + + toString() { + if (this.month < 13) { + return `${this.day} ${FrenchRCDate.MONTHS[this.month - 1]} ${this.year}`; + } else { + return `${FrenchRCDate.SANSCULOTTIDES[this.day - 1]} ${this.year}`; + } + } + + static additionalDaysForYear(year) { + return year > 11 ? 3 : year > 7 ? 2 : year > 3 ? 1 : 0; + } + + static toFrenchRCDate(gregorianDate) { + const daysAfter = Math.floor((gregorianDate - FrenchRCDate.INTRODUCTION_DATE) / (1000 * 60 * 60 * 24)); + const daysBefore = Math.floor((FrenchRCDate.TERMINATION_DATE - gregorianDate) / (1000 * 60 * 60 * 24)); + + if (daysAfter < 0 || daysBefore < 0) { + throw new Error("French Republican Calendar date out of range."); + } + + let year = Math.floor((daysAfter + 366) / 365); + let days = (daysAfter + 366) % 365 - FrenchRCDate.additionalDaysForYear(year); + + if (days < 1) { + year -= 1; + days += 366; + } + + if (days < 361) { + const month = Math.floor(days / 30) + 1; + const day = days % 30 || 30; + return new FrenchRCDate(year, month, day); + } else { + const day = days - 360; + return new FrenchRCDate(year, 13, day); + } + } + + static parse(frenchRCDateString) { + const parts = frenchRCDateString.trim().split(/\s+/); + if (parts.length === 3) { + const [dayStr, monthStr, yearStr] = parts; + const year = parseInt(yearStr, 10); + const month = FrenchRCDate.MONTHS.indexOf(monthStr) + 1; + const day = parseInt(dayStr, 10); + return new FrenchRCDate(year, month, day); + } else { + const yearStr = parts[parts.length - 1]; + const year = parseInt(yearStr, 10); + const sansculottideName = parts.slice(0, -1).join(" "); + const day = FrenchRCDate.SANSCULOTTIDES.indexOf(sansculottideName) + 1; + return new FrenchRCDate(year, 13, day); + } + } +} + +// Helper to format dates like "d MMMM yyyy" +function formatDate(date) { + const months = [ + "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" + ]; + const day = date.getUTCDate(); + const month = months[date.getUTCMonth()]; + const year = date.getUTCFullYear(); + return `${day} ${month} ${year}`; +} + +// Main logic +const gregorianStrings = [ + "22 September 1792", + "20 May 1795", + "15 July 1799", + "23 September 1803", + "31 December 1805" +]; + +const frenchRCStrings = []; + +for (const gregorianString of gregorianStrings) { + // Parse into JS Date object + const [day, month, year] = gregorianString.split(" "); + const monthIndex = [ + "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" + ].indexOf(month); + const gregorianDate = new Date(Date.UTC(parseInt(year), monthIndex, parseInt(day))); + + const frenchRCDate = FrenchRCDate.toFrenchRCDate(gregorianDate); + const frenchRCString = frenchRCDate.toString(); + frenchRCStrings.push(frenchRCString); + console.log(`${gregorianString} => ${frenchRCString}`); +} + +console.log(); + +for (const frenchRCString of frenchRCStrings) { + const frenchRCDate = FrenchRCDate.parse(frenchRCString); + const gregorianDate = frenchRCDate.toGregorianDate(); + console.log(`${frenchRCString} => ${formatDate(gregorianDate)}`); +} diff --git a/Task/French-Republican-calendar/Jq/french-republican-calendar.jq b/Task/French-Republican-calendar/Jq/french-republican-calendar.jq new file mode 100644 index 0000000000..dde45845bc --- /dev/null +++ b/Task/French-Republican-calendar/Jq/french-republican-calendar.jq @@ -0,0 +1,149 @@ +include "Date" {search: "."}; + +### Generic functions + +def assertEq($p;$q): + if $p == $q + then . + else debug("assertion violation: \($p) != \($q)") as $debug | . + end; + +def lpad($len): tostring | ($len - length) as $l | (" " * $l) + .; + +def trim: sub("^ *";"") | sub(" *$";""); + +# Input: string such as "12 Mar 2012" +# Output: Date +def parseDayMonthYear: + def months: + {Jan:1, Feb:2, Mar:3, Apr: 4, May: 5, Jun: 6, + Jul:7, Aug:8, Sep:9, Oct:10, Nov:11, Dec:12}; + capture("(?[0-9]+) *(?[A-Za-z]+) *(?[0-9]+)") + | .month |= months[ .[:3] ] + | map_values(tonumber) + | {year, month, day}; + +### French Republican Calendar (FRC) + +def introductionDate: Date(1792; 9; 22); + +# Use the 'continuous method' for years after 1805 +def isLeapYearFRC: + (. + 1) + | (. % 4 == 0) and ((. % 100 != 0) or (. % 400 == 0)); + +# If the numbers $year, $month, and $day specify a valid date +# in the French Republican Calendar, then emit {$year, $month, $day}; +# otherwise generate an informative error message. +def FrenchRCDate($year; $month; $day): + def err(msg): "Invalid date (\(msg)): FrenchRCDate(\($year); \($month); \($day))" | error; + if ($year <= 0 or $month < 1 or $month > 13) then err(if $year <= 0 then "year" else "month" end) end + | if $month < 13 + then if $day < 1 or $day > 30 then err("day") end + else ($year | isLeapYearFRC) as $leap + | if $leap and ($day < 1 or $day > 6) then err("invalid day in leap year") end + | if ($leap|not) and ($day < 1 or $day > 5) then err("invalid day in non-leap year") end + end + | {$year, $month, $day}; + +# for convenience we treat 'Sansculottide' as an extra month with 5 or 6 days +def months: + ["Vendémiaire", "Brumaire", "Frimaire", "Nivôse", "Pluviôse", "Ventôse", "Germinal", + "Floréal", "Prairial", "Messidor", "Thermidor", "Fructidor", "Sansculottide"] ; + +def intercal: + ["Fête de la vertu", "Fête du génie", "Fête du travail", + "Fête de l'opinion", "Fête des récompenses", "Fête de la Révolution"]; + +# Input: a string specifying a FRC date +def parse: + . as $frcDate + | (trim|split(" ")) as $splits + | if $splits|length == 3 + then (months | index($splits[1]) + 1) as $month + | if $month < 1 or $month > 13 then "Invalid month." | error end + | ($splits[2]|tonumber) as $year + | if $year < 1 then "Invalid year." | error end + | (if ($month < 13) then 30 elif $year|isLeapYearFRC then 6 else 5 end) as $monthLength + | ($splits[0] | tonumber) as $day + | if $day < 1 or $day > $monthLength then "Invalid day." | error end + | FrenchRCDate($year; $month; $day) + + elif ($splits|length | IN(4,5)) + then $splits[-1] as $yearStr + | ($yearStr|tonumber) as $year + | if $year < 1 then "Invalid year." | error end + | ($frcDate | trim[0: -($yearStr|length + 1)] ) as $scDay + | (intercal | index($scDay) + 1) as $day + | (if $year | isLeapYearFRC then 6 else 5 end) as $maxDay + | if $day < 1 or $day > $maxDay then "Invalid day." | error end + | FrenchRCDate($year; 13; $day) + else "Invalid French Republican date." | error + end +; + +# Input: Date (Gregorian) +# Output: +def fromLocalDate: + # $start and $finish should be two Date objects + def daysFrom($start; $finish): + ($finish|daysBeforeDate) - ($start|daysBeforeDate); + + (daysFrom(introductionDate; .) + 1) as $daysDiff + | if ($daysDiff <= 0) then "Date can't be before 22 September 1792." | error end + | {year: 1, startDay: 1} + | until(.done; + (.startDay + (if .year|isLeapYearFRC then 365 else 364 end)) as $endDay + | if ($daysDiff >= .startDay and $daysDiff <= $endDay) then .done = true + else .year += 1 + | .startDay = $endDay + 1 + end ) + | ($daysDiff - .startDay) as $remDays + | (($remDays / 30)|floor) as $month + | ($remDays - $month * 30) as $day + | FrenchRCDate(.year; $month + 1; $day + 1) +; + +# Input: an FRC Date +def toString: + if .month < 13 then "\(.day) \(months[.month - 1]) \(.year)" + else "\(intercal[.day - 1]) \(.year)" + end; + +# Input: an FRC Date +def toLocalDate: + (reduce range(1; .year) as $i (0; . + (if $i|isLeapYearFRC then 366 else 365 end))) as $sumDays + | ((.month - 1) * 30 + .day - 1) as $dayInYear + | introductionDate | addDays($sumDays + $dayInYear) ; + + +### Examples + +def dates: [ + "22 September 1792", "20 May 1795", "15 July 1799", "23 September 1803", + "31 December 1805", "18 March 1871", "25 August 1944", "19 September 2016", + "22 September 2017", "28 September 2017" +]; + +def task: + def format: + "\(.day) \(monthNames[.month]) \(.year)"; + + dates as $dates + | reduce range(0; $dates|length) as $i ({}; + .date = $dates[$i] + | .thisDate = (.date|parseDayMonthYear) + | .frcd = (.thisDate|fromLocalDate) + | .frcDates[$i] = (.frcd|toString) + | .emit += "\(.date|lpad(26)) => \(.frcDates[$i])\n") + | .emit, + + # now process the other way around + range(0; $dates|length) as $i + | .frcDates[$i] as $frcDate + | ($frcDate|parse|toLocalDate|format) as $lds + | assertEq($dates[$i]; $lds) + | "\($frcDate|lpad(26)) => \($lds)" +; + +task diff --git a/Task/French-Republican-calendar/Julia/french-republican-calendar.julia b/Task/French-Republican-calendar/Julia/french-republican-calendar.jl similarity index 100% rename from Task/French-Republican-calendar/Julia/french-republican-calendar.julia rename to Task/French-Republican-calendar/Julia/french-republican-calendar.jl diff --git a/Task/French-Republican-calendar/Kotlin/french-republican-calendar.kotlin b/Task/French-Republican-calendar/Kotlin/french-republican-calendar.kts similarity index 100% rename from Task/French-Republican-calendar/Kotlin/french-republican-calendar.kotlin rename to Task/French-Republican-calendar/Kotlin/french-republican-calendar.kts diff --git a/Task/French-Republican-calendar/Rust/french-republican-calendar.rs b/Task/French-Republican-calendar/Rust/french-republican-calendar.rs new file mode 100644 index 0000000000..873b6c090d --- /dev/null +++ b/Task/French-Republican-calendar/Rust/french-republican-calendar.rs @@ -0,0 +1,177 @@ +use chrono::{Datelike, Duration, NaiveDate}; + +const MONTHS: [&str; 13] = [ + "Vendemiaire", "Brumaire", "Frimaire", "Nivose", "Pluviose", "Ventose", "Germinal", + "Floreal", "Prairial", "Messidor", "Thermidor", "Fructidor", "Sansculottide", +]; + +const SANSCULOTTIDES: [&str; 6] = [ + "Fete de la vertu", "Fete du genie", "Fete du travail", + "Fete de l'opinion", "Fete des recompenses", "Fete de la Revolution", +]; + +const GREGORIAN_MONTHS: [&str; 12] = [ + "January", "February", "March", "April", "May", "June", "July", "August", + "September", "October", "November", "December", +]; + +const INTRODUCTION_DATE: NaiveDate = match NaiveDate::from_ymd_opt(1792, 9, 22) { + Some(date) => date, + None => panic!("Invalid introduction date"), +}; + +const TERMINATION_DATE: NaiveDate = match NaiveDate::from_ymd_opt(1805, 12, 31) { + Some(date) => date, + None => panic!("Invalid termination date"), +}; + +#[derive(Debug, Clone, Copy)] +struct FrenchRcDate { + year: u32, + month: u32, + day: u32, +} + +fn split_string(text: &str, delimiter: char) -> Vec<&str> { + text.split(delimiter).collect() +} + +fn index_of(vec: &[&str], element: &str) -> u32 { + vec.iter() + .position(|&x| x == element) + .map(|i| i as u32) + .unwrap_or_else(|| panic!("Element not found: {}", element)) +} + +fn additional_days_for_year(year: u32) -> u32 { + if year > 11 { + 3 + } else if year > 7 { + 2 + } else if year > 3 { + 1 + } else { + 0 + } +} + +fn to_french_rc_date_string(french_rc_date: FrenchRcDate) -> String { + if french_rc_date.month < 13 { + format!( + "{} {} {}", + french_rc_date.day, MONTHS[(french_rc_date.month - 1) as usize], french_rc_date.year + ) + } else { + format!( + "{} {}", + SANSCULOTTIDES[(french_rc_date.day - 1) as usize], french_rc_date.year + ) + } +} + +fn to_gregorian_date_string(gregorian_date: NaiveDate) -> String { + let year = gregorian_date.year(); + let month = gregorian_date.month() as usize; + let day = gregorian_date.day(); + let month_string = GREGORIAN_MONTHS[month - 1]; + format!("{} {} {}", day, month_string, year) +} + +fn parse_gregorian_date(gregorian_string: &str) -> NaiveDate { + let splits: Vec<&str> = split_string(gregorian_string, ' '); + let day: u32 = splits[0].parse().expect("Invalid day"); + let month = index_of(&GREGORIAN_MONTHS, splits[1]) + 1; + let year: i32 = splits[2].parse().expect("Invalid year"); + + NaiveDate::from_ymd_opt(year, month, day) + .unwrap_or_else(|| panic!("Invalid Gregorian date: {}", gregorian_string)) +} + +fn parse_french_rc_date(french_rc_date: &str) -> FrenchRcDate { + let splits: Vec<&str> = split_string(french_rc_date, ' '); + if splits.len() == 3 { + let day: u32 = splits[0].parse().expect("Invalid day"); + let month = index_of(&MONTHS, splits[1]) + 1; + let year: u32 = splits[2].parse().expect("Invalid year"); + FrenchRcDate { year, month, day } + } else { + let year_string = splits[splits.len() - 1]; + let year: u32 = year_string.parse().expect("Invalid year"); + let sansculottides_day = &french_rc_date[..french_rc_date.len() - year_string.len() - 1]; + let day = index_of(&SANSCULOTTIDES, sansculottides_day) + 1; + FrenchRcDate { + year, + month: 13, + day, + } + } +} + +fn to_french_rc_date(gregorian_date: NaiveDate) -> FrenchRcDate { + let days_after = (gregorian_date - INTRODUCTION_DATE).num_days(); + let days_before = (TERMINATION_DATE - gregorian_date).num_days(); + + if days_after < 0 || days_before < 0 { + panic!("French Republican Calendar date out of range."); + } + + let mut year = (days_after + 366) / 365; + let mut days = (days_after + 366) % 365 - additional_days_for_year(year as u32) as i64; + + if days == 0 { + year -= 1; + days += 366; + } + + if days < 361 { + FrenchRcDate { + year: year as u32, + month: (days / 30 + 1) as u32, + day: (days % 30) as u32, + } + } else { + FrenchRcDate { + year: year as u32, + month: 13, + day: (days - 360) as u32, + } + } +} + +fn to_gregorian_date(french_rc_date: FrenchRcDate) -> NaiveDate { + let days = (french_rc_date.year - 1) * 365 + + additional_days_for_year(french_rc_date.year) + + (french_rc_date.month - 1) * 30 + + french_rc_date.day + - 1; + INTRODUCTION_DATE + Duration::days(days as i64) +} + +fn main() { + let gregorian_strings = vec![ + "22 September 1792", + "20 May 1795", + "15 July 1799", + "23 September 1803", + "31 December 1805", + ]; + + let mut french_rc_strings = Vec::new(); + + for gregorian_string in &gregorian_strings { + let gregorian_date = parse_gregorian_date(gregorian_string); + let french_rc_date = to_french_rc_date(gregorian_date); + let french_rc_date_string = to_french_rc_date_string(french_rc_date); + french_rc_strings.push(french_rc_date_string.clone()); + println!("{} => {}", gregorian_string, french_rc_date_string); + } + + println!(); + + for french_rc_string in &french_rc_strings { + let french_rc_date = parse_french_rc_date(french_rc_string); + let gregorian_date = to_gregorian_date(french_rc_date); + let gregorian_date_string = to_gregorian_date_string(gregorian_date); + println!("{} => {}", french_rc_string, gregorian_date_string); + } +} diff --git a/Task/French-Republican-calendar/Scheme/french-republican-calendar.scm b/Task/French-Republican-calendar/Scheme/french-republican-calendar.scm new file mode 100644 index 0000000000..a60062f8fd --- /dev/null +++ b/Task/French-Republican-calendar/Scheme/french-republican-calendar.scm @@ -0,0 +1,234 @@ +; version 1 (11 Frimaire 234) +; inspired by BBC Basic +; see https://rosettacode.org/wiki/French_Republican_calendar + +(import (scheme base) (scheme char)) + +; ex: (date->jour-mois-annee '(2025 12 1)) -> 1 12 2025 +(define (date->jour-mois-annee date) + (values (list-ref date 2) (list-ref date 1) (list-ref date 0))) + +; ex: (jours-bissextiles 1900) -> 460 +(define (jours-bissextiles annee) + (- (+ (quotient annee 4) (quotient annee 400)) (quotient annee 100))) + +; ex: (bissextile? 1900) -> #f +(define (bissextile? annee) + (and (zero? (remainder annee 4)) + (or (zero? (remainder annee 400)) (positive? (remainder annee 100))))) + +; ex: (jour-bissextile 1900) -> 0 +(define (jour-bissextile annee) + (if (bissextile? annee) 1 0)) + +; ex: (gregorien->jours '(1792 9 22)) -> 1 +; ex: (gregorien->jours '(2025 12 1)) -> 85172 +(define (gregorien->jours date) + (let*-values (((jour mois annee) (date->jour-mois-annee date)) + ((mois annee) (if (< mois 3) + (values (+ mois 12) (- annee 1)) + (values mois annee)))) + (- (+ (* annee 365) + (jours-bissextiles annee) + (exact (floor (* 30.6 (+ mois 1)))) + jour) + 654842))) + +; ex: (republicain->jours '(1 1 1)) -> 1 +; ex: (republicain->jours '(2025 12 1)) -> 85172 +(define (republicain->jours date) + (let*-values (((jour mois annee) (date->jour-mois-annee date)) + ((mois jour) (if (= mois 13) + (values 12 (+ jour 30)) + (values mois jour)))) + (- (+ (* annee 365) + (* 30 mois) + (jours-bissextiles (+ annee 1)) + jour) + (jour-bissextile (+ annee 1)) + 395))) + +; ex: (jours->gregorien 1) -> (1792 9 22) +; ex: (jours->gregorien 85172) -> (2025 12 1) +(define (jours->gregorien jours) + (let* ((annee (exact (floor (/ jours 365.25)))) + (jour (+ (- jours (exact (floor (* annee 365.25)))) 21)) + (annee (+ annee 1792)) + (jour (- (+ jour (exact (quotient annee 100))) (exact (quotient annee 400)) 13))) + (let boucle ((jour jour)(mois 8)(annee annee)) + (let* ((duree-mois (vector-ref #(31 28 31 30 31 30 31 31 30 31 30 31) mois)) + (duree-mois (+ duree-mois (if (and (= mois 1) (bissextile? annee)) 1 0)))) + (if (<= jour duree-mois) + (list annee (+ mois 1) jour) + (let ((jour (- jour duree-mois)) + (mois (+ mois 1))) + (if (= mois 12) + (boucle jour 0 (+ annee 1)) + (boucle jour mois annee)))))))) + +; ex: (jours->republicain 1) -> (1 1 1) +; ex: (jours->republicain 85172) -> (234 3 11) +(define (jours->republicain jours) + (let* ((annee (exact (floor (/ jours 365.25)))) + (annee (- annee (jour-bissextile (+ annee 1)))) + (jour (- jours (exact (floor (* annee 365.25))))) + (annee (+ annee 1)) + (jour (- (+ jour (exact (quotient annee 100))) (exact (quotient annee 400))))) + (let boucle ((jour jour)(mois 1)(annee annee)) + (let ((duree-mois (if (< mois 13) 30 (+ 5 (jour-bissextile (+ annee 1)))))) + (if (<= jour duree-mois) + (list annee mois jour) + (let ((jour (- jour duree-mois)) + (mois (+ mois 1))) + (if (= mois 14) + (boucle jour 1 (+ annee 1)) + (boucle jour mois annee)))))))) + +; ex: (normalise-caractere #\E) -> #\e +; ex: (normalise-caractere #\ê) -> #\e +(define (normalise-caractere caractere) + (let* ((caractere (char-downcase caractere)) + (autre (assoc caractere '((#\é . #\e) (#\ê . #\e) (#\ô . #\o))))) + (if autre + (cdr autre) + caractere))) + +; ex: (normalise-texte "Ventôse") -> "ventose" +(define (normalise-texte texte) + (string-map normalise-caractere texte)) + +; ex: (normalise-texte '("Ventôse" "Germinal")) -> ("ventose" "germinal") +(define (normalise-liste liste) + (map normalise-texte liste)) + +(define mois-republicains '( + "Vendémiaire" "Brumaire" "Frimaire" "Nivôse" "Pluviôse" "Ventôse" + "Germinal" "Floréal" "Prairial" "Messidor" "Thermidor" "Fructidor" + "Sansculottide")) + +(define sansculottides '( + "Fête de la vertu" "Fête du génie" "Fête du travail" + "Fête de l'opinion" "Fête des récompenses" "Fête de la Révolution" )) + +(define mois-gregoriens '( + "January" "February" "March" "April" "May" "June" + "July" "August" "September" "October" "November" "December" )) + +(define mois-republicains-normal (normalise-liste mois-republicains)) + +(define sansculottides-normal (normalise-liste sansculottides)) + +(define mois-gregoriens-normal (normalise-liste mois-gregoriens)) + +; ex: (gregorien->texte '(2025 12 1)) -> "1 December 2025)" +(define (gregorien->texte date) + (string-append + (number->string (list-ref date 2)) + " " + (list-ref mois-gregoriens (- (list-ref date 1) 1)) + " " + (number->string (list-ref date 0)))) + +; ex: (republicain->texte '(2025 12 1)) -> "1 Fructidor 2025)" +; ex: (republicain->texte '(2025 13 1)) -> "Fête de la vertu 2025)" +(define (republicain->texte date) + (if (= (list-ref date 1) 13) + (string-append + (list-ref sansculottides (- (list-ref date 2) 1)) + " " + (number->string (list-ref date 0))) + (string-append + (number->string (list-ref date 2)) + " " + (list-ref mois-republicains (- (list-ref date 1) 1)) + " " + (number->string (list-ref date 0))))) + +; ex: (decompose "34 toto 78 zorro louarn 9") -> (9 "zorro louarn" 78 "toto" 34) +; ex: (decompose "10 Vendémiaire 1") -> (1 "Vendémiaire" 10) +(define (decompose texte) + (let ((texte (normalise-texte texte))) + (let boucle ((index 0)(resultat '())) + (if (>= index (string-length texte)) + resultat + (let ((caractere (string-ref texte index)) + (index (+ index 1))) + (cond + ((char-whitespace? caractere) + (boucle index resultat)) + ((char-numeric? caractere) + (let lit-nombre ((index index)(valeur (digit-value caractere))) + (let ((caractere (if (>= index (string-length texte)) + #\space + (string-ref texte index)))) + (if (char-numeric? caractere) + (lit-nombre (+ index 1) (+ (* 10 valeur) (digit-value caractere))) + (boucle index (cons valeur resultat)))))) + (else + (let lit-texte ((index index)(valeur (list caractere))) + (let ((caractere (if (>= index (string-length texte)) + #\0 + (string-ref texte index)))) + (if (char-numeric? caractere) + (let retire-espace ((valeur valeur)) + (if (char-whitespace? (car valeur)) + (retire-espace (cdr valeur)) + (boucle index (cons (list->string (reverse valeur)) resultat)))) + (lit-texte (+ index 1) (cons caractere valeur)))))))))))) + +; ex: (index-texte '("a" "b" "c") "b") -> 2 +; ex: (index-texte '("a" "b" "c") "x") -> #f +(define (index-texte liste texte) + (let ((tete (member texte liste))) + (and tete (+ 1 (- (length liste) (length tete)))))) + +; ex: (decode-date "22 September 1792") -> (gregorien 1792 9 22) +; ex: (decode-date "Fête de la Révolution 11") -> (republicain 11 13 6) +(define (decode-date texte) + (let ((decomposition (decompose texte))) + (case (length decomposition) + ((2) + (let* ((annee (list-ref decomposition 0)) + (fete (list-ref decomposition 1)) + (jour (index-texte sansculottides-normal fete))) + (and jour (number? annee) (list 'republicain annee 13 jour)))) + ((3) + (let* ((annee (list-ref decomposition 0)) + (mois (list-ref decomposition 1)) + (jour (list-ref decomposition 2)) + (mois-gregorien (index-texte mois-gregoriens-normal mois)) + (mois-republicain (index-texte mois-republicains-normal mois))) + (and (number? annee) (number? jour) + (or (and mois-gregorien (list 'gregorien annee mois-gregorien jour)) + (and mois-republicain (list 'republicain annee mois-republicain jour)))))) + (else + #f)))) + +; ex: (decode-date "22 September 1792") -> "1 Vendémiaire 1" +; ex: (decode-date "Fête de la Révolution 11") -> "23 September 1803" +(define (converti-date texte) + (let ((decodage (decode-date texte))) + (and decodage + (case (car decodage) + ((gregorien) + (republicain->texte (jours->republicain (gregorien->jours (cdr decodage))))) + ((republicain) + (gregorien->texte (jours->gregorien (republicain->jours (cdr decodage))))) + (else + #f))))) + +; validation +(for-each + (lambda (texte) + (display texte) + (display " = ") + (display (converti-date texte)) + (newline)) + '( + "1 Vendémiaire 1" "22 September 1792" + "1 Prairial 3" "20 May 1795" + "27 Messidor 7" "15 July 1799" + "Fête de la Révolution 11" "23 September 1803" + "10 Nivôse 14" "31 December 1805" + "11 Frimaire 234" "1 December 2025" + )) diff --git a/Task/French-Republican-calendar/Wren/french-republican-calendar.wren b/Task/French-Republican-calendar/Wren/french-republican-calendar.wren index 67c2ba5ccf..9c365d1f94 100644 --- a/Task/French-Republican-calendar/Wren/french-republican-calendar.wren +++ b/Task/French-Republican-calendar/Wren/french-republican-calendar.wren @@ -1,6 +1,6 @@ -import "/date" for Date -import "/seq" for Lst -import "/fmt" for Fmt +import "./date" for Date +import "./seq" for Lst +import "./fmt" for Fmt class FrenchRCDate { /* uses the 'continuous method' for years after 1805 */ diff --git a/Task/Function-composition/00-META.yaml b/Task/Function-composition/00-META.yaml index bd45864d57..483655d1d4 100644 --- a/Task/Function-composition/00-META.yaml +++ b/Task/Function-composition/00-META.yaml @@ -1,3 +1,2 @@ --- from: http://rosettacode.org/wiki/Function_composition -note: Higher-order functions diff --git a/Task/Function-composition/00-TASK.txt b/Task/Function-composition/00-TASK.txt index 44f6ada3f0..8b13789179 100644 --- a/Task/Function-composition/00-TASK.txt +++ b/Task/Function-composition/00-TASK.txt @@ -1,16 +1 @@ -;Task: -Create a function, compose,   whose two arguments   ''f''   and   ''g'',   are both functions with one argument. - - -The result of compose is to be a function of one argument, (lets call the argument   ''x''),   which works like applying function   ''f''   to the result of applying function   ''g''   to   ''x''. - - -;Example: - compose(''f'', ''g'') (''x'') = ''f''(''g''(''x'')) - - -Reference: [[wp:Function composition (computer science)|Function composition]] - -Hint: In some languages, implementing compose correctly requires creating a [[wp:Closure (computer science)|closure]]. -

diff --git a/Task/Function-composition/Ada/function-composition-1.ada b/Task/Function-composition/Ada/function-composition-1.adb similarity index 100% rename from Task/Function-composition/Ada/function-composition-1.ada rename to Task/Function-composition/Ada/function-composition-1.adb diff --git a/Task/Function-composition/Ada/function-composition-2.ada b/Task/Function-composition/Ada/function-composition-2.adb similarity index 100% rename from Task/Function-composition/Ada/function-composition-2.ada rename to Task/Function-composition/Ada/function-composition-2.adb diff --git a/Task/Function-composition/Ada/function-composition-3.ada b/Task/Function-composition/Ada/function-composition-3.adb similarity index 100% rename from Task/Function-composition/Ada/function-composition-3.ada rename to Task/Function-composition/Ada/function-composition-3.adb diff --git a/Task/Function-composition/Amazing-Hopper/function-composition-1.hopper b/Task/Function-composition/Amazing-Hopper/function-composition-1.hopper new file mode 100644 index 0000000000..fa91f10a87 --- /dev/null +++ b/Task/Function-composition/Amazing-Hopper/function-composition-1.hopper @@ -0,0 +1,6 @@ +#defn Compose(_FX_,_FY_) _FX_,_FY_ + +main: + 0.5,Compose(sin,arcsin) + "\n", print +{0}return diff --git a/Task/Function-composition/Amazing-Hopper/function-composition-2.hopper b/Task/Function-composition/Amazing-Hopper/function-composition-2.hopper new file mode 100644 index 0000000000..d8a0e6dfcd --- /dev/null +++ b/Task/Function-composition/Amazing-Hopper/function-composition-2.hopper @@ -0,0 +1,8 @@ +#define-a «(_X_) _X_ ) +#define Compose(_FX_,_FY_) _FC_(_FX_,_FY_, +#define _FC_(_X_,_Y_,*) *,_X_,_Y_ + +main: + Compose(sin,arcsin)«( 0.5) + "\n", print +{0}return diff --git a/Task/Function-composition/Amazing-Hopper/function-composition-3.hopper b/Task/Function-composition/Amazing-Hopper/function-composition-3.hopper new file mode 100644 index 0000000000..eeef30e4ea --- /dev/null +++ b/Task/Function-composition/Amazing-Hopper/function-composition-3.hopper @@ -0,0 +1,8 @@ +#define «(_X_) _X_ ) +#define Compose(_FX_,_FY_) _FC_(_FX_,_FY_, +#define _FC_(_X_,_Y_,*) *,_X_,_Y_ + +main: + Compose(sin,arcsin)«( 0.5, mul by '2' ) + "\n", print +{0}return diff --git a/Task/Function-composition/Bruijn/function-composition.bruijn b/Task/Function-composition/Bruijn/function-composition.bruijn new file mode 100644 index 0000000000..c6603e8e02 --- /dev/null +++ b/Task/Function-composition/Bruijn/function-composition.bruijn @@ -0,0 +1,21 @@ +:import std/Number . + +# 1x composition, bluebird combinator +…∘… [[[2 (1 0)]]] + +:test (((inc ∘ (mul (+2))) (+3)) =? (+7)) ([[1]]) + +# 2x composition, blackbird combinator +…∘∘… [[[[3 (2 1 0)]]]] + +:test (((inc ∘∘ mul) (+2) (+3)) =? (+7)) ([[1]]) + +# 3x composition, bunting combinator +…∘∘∘… [[[[[4 (3 2 1 0)]]]]] + +:test (((inc ∘∘∘ (add ∘∘ mul)) (+1) (+2) (+4)) =? (+7)) ([[1]]) + +# reverse composition, queer bird combinator +…→… [[[1 (2 0)]]] + +:test ((((mul (+2)) → inc) (+3)) =? (+7)) ([[1]]) diff --git a/Task/Function-composition/Crystal/function-composition.crystal b/Task/Function-composition/Crystal/function-composition.cr similarity index 100% rename from Task/Function-composition/Crystal/function-composition.crystal rename to Task/Function-composition/Crystal/function-composition.cr diff --git a/Task/Function-composition/Delphi/function-composition.delphi b/Task/Function-composition/Delphi/function-composition.pas similarity index 100% rename from Task/Function-composition/Delphi/function-composition.delphi rename to Task/Function-composition/Delphi/function-composition.pas diff --git a/Task/Function-composition/Elena/function-composition.elena b/Task/Function-composition/Elena/function-composition.elena index 54a79583c3..e2bfe40d6c 100644 --- a/Task/Function-composition/Elena/function-composition.elena +++ b/Task/Function-composition/Elena/function-composition.elena @@ -6,9 +6,9 @@ extension op : Func1 = (x => self(f(x))); } -public program() +public Program() { - var fg := (x => x + 1).compose:(x => x * x); + var fg := (x => x + 1).compose::(x => x * x); - console.printLine(fg(3)) + Console.printLine(fg(3)) } diff --git a/Task/Function-composition/Elixir/function-composition.elixir b/Task/Function-composition/Elixir/function-composition.ex similarity index 100% rename from Task/Function-composition/Elixir/function-composition.elixir rename to Task/Function-composition/Elixir/function-composition.ex diff --git a/Task/Function-composition/Emacs-Lisp/function-composition-1.l b/Task/Function-composition/Emacs-Lisp/function-composition-1.el similarity index 100% rename from Task/Function-composition/Emacs-Lisp/function-composition-1.l rename to Task/Function-composition/Emacs-Lisp/function-composition-1.el diff --git a/Task/Function-composition/Emacs-Lisp/function-composition-2.l b/Task/Function-composition/Emacs-Lisp/function-composition-2.el similarity index 100% rename from Task/Function-composition/Emacs-Lisp/function-composition-2.l rename to Task/Function-composition/Emacs-Lisp/function-composition-2.el diff --git a/Task/Function-composition/Emacs-Lisp/function-composition-3.l b/Task/Function-composition/Emacs-Lisp/function-composition-3.el similarity index 100% rename from Task/Function-composition/Emacs-Lisp/function-composition-3.l rename to Task/Function-composition/Emacs-Lisp/function-composition-3.el diff --git a/Task/Function-composition/FutureBasic/function-composition.basic b/Task/Function-composition/FutureBasic/function-composition.basic new file mode 100644 index 0000000000..8df8fe887d --- /dev/null +++ b/Task/Function-composition/FutureBasic/function-composition.basic @@ -0,0 +1,14 @@ +double local fn FunctionF( x as double ) +end fn = x + 1.5 + +double local fn FunctionG( x as double ) +end fn = x * x + +double local fn Compose( f as ptr, g as ptr ) + double def fn ff(x1 as double) using f + double def fn fg(x2 as double) using g +end fn = fn ff(fn fg(2.5)) + +print fn Compose( @fn FunctionF, @fn FunctionG ) + +HandleEvents diff --git a/Task/Function-composition/Julia/function-composition-1.julia b/Task/Function-composition/Julia/function-composition-1.jl similarity index 100% rename from Task/Function-composition/Julia/function-composition-1.julia rename to Task/Function-composition/Julia/function-composition-1.jl diff --git a/Task/Function-composition/Julia/function-composition-2.julia b/Task/Function-composition/Julia/function-composition-2.jl similarity index 100% rename from Task/Function-composition/Julia/function-composition-2.julia rename to Task/Function-composition/Julia/function-composition-2.jl diff --git a/Task/Function-composition/Kotlin/function-composition.kotlin b/Task/Function-composition/Kotlin/function-composition.kts similarity index 100% rename from Task/Function-composition/Kotlin/function-composition.kotlin rename to Task/Function-composition/Kotlin/function-composition.kts diff --git a/Task/Function-composition/OCaml/function-composition-1.ocaml b/Task/Function-composition/OCaml/function-composition-1.ml similarity index 100% rename from Task/Function-composition/OCaml/function-composition-1.ocaml rename to Task/Function-composition/OCaml/function-composition-1.ml diff --git a/Task/Function-composition/OCaml/function-composition-2.ocaml b/Task/Function-composition/OCaml/function-composition-2.ml similarity index 100% rename from Task/Function-composition/OCaml/function-composition-2.ocaml rename to Task/Function-composition/OCaml/function-composition-2.ml diff --git a/Task/Function-composition/Odin/function-composition.odin b/Task/Function-composition/Odin/function-composition.odin new file mode 100644 index 0000000000..bda638fa4b --- /dev/null +++ b/Task/Function-composition/Odin/function-composition.odin @@ -0,0 +1,25 @@ +package main + +import "core:fmt" +import "core:math" + +Compositor :: struct($ARG, $INTER, $RET: typeid) { + func1: #type proc "contextless" (_: ARG) -> INTER, + func2: #type proc "contextless" (_: INTER) -> RET, +} + +compose :: proc( + f: #type proc "contextless" (_: $INTER) -> $RET, + g: #type proc "contextless" (_: $ARG) -> INTER, +) -> Compositor(ARG, RET, INTER) { + return {g, f} +} + +call :: proc(c: Compositor($ARG, $INTER, $RET), arg: ARG) -> RET { + return c.func1(c.func2(arg)) +} + +main :: proc() { + comp := compose(math.sin_f64, math.asin_f64) // have to use specific functions. Odin's polymorphism doesn't play nice with procedure groups + fmt.println(call(comp, 0.5)) // prints 0.5 +} diff --git a/Task/Function-composition/PascalABC.NET/function-composition.pas b/Task/Function-composition/PascalABC.NET/function-composition.pas new file mode 100644 index 0000000000..7072b96e99 --- /dev/null +++ b/Task/Function-composition/PascalABC.NET/function-composition.pas @@ -0,0 +1,5 @@ +function Compose(f: T1 -> T2; g: T -> T1): T -> T2 := x -> f(g(x)); + +begin + Compose(Sin,ArcSin)(1.0).Print +end. diff --git a/Task/Function-composition/Pluto/function-composition.pluto b/Task/Function-composition/Pluto/function-composition.pluto new file mode 100644 index 0000000000..6bbdea1daa --- /dev/null +++ b/Task/Function-composition/Pluto/function-composition.pluto @@ -0,0 +1,7 @@ +local function compose(f, g) return |x| -> f(g(x)) end + +local function double(x) return 2 * x end + +local function add_one(x) return x + 1 end + +print(compose(double, add_one)(3)) diff --git a/Task/Function-composition/PowerShell/function-composition-1.psh b/Task/Function-composition/PowerShell/function-composition-1.ps1 similarity index 100% rename from Task/Function-composition/PowerShell/function-composition-1.psh rename to Task/Function-composition/PowerShell/function-composition-1.ps1 diff --git a/Task/Function-composition/PowerShell/function-composition-2.psh b/Task/Function-composition/PowerShell/function-composition-2.ps1 similarity index 100% rename from Task/Function-composition/PowerShell/function-composition-2.psh rename to Task/Function-composition/PowerShell/function-composition-2.ps1 diff --git a/Task/Function-composition/REXX/function-composition.rexx b/Task/Function-composition/REXX/function-composition.rexx index 5036f78de6..ab3603d56d 100644 --- a/Task/Function-composition/REXX/function-composition.rexx +++ b/Task/Function-composition/REXX/function-composition.rexx @@ -1,3 +1,21 @@ -compose: procedure; parse arg f,g,x; interpret 'return' f"(" g'(' x "))" +-- 12 Sep 2025 +include Setting -exit /*control should never gets here, but this was added just in case.*/ +say 'FUNCTION COMPOSITION' +say version +say +parse value 'Sin' 'ArcSin' 0.5 with ff gg xx +say 'Compose('ff','gg','xx')' '=' Compose(ff,gg,xx) ',' ff'('gg'('xx'))' '=' Sin(ArcSin(xx)) +parse value 'ArcSin' 'Sin' 0.5 with ff gg xx +say 'Compose('ff','gg','xx')' '=' Compose(ff,gg,xx) ',' ff'('gg'('xx'))' '=' ArcSin(Sin(xx)) +parse value 'Zeta' 'Gamma' 0.5 with ff gg xx +say 'Compose('ff','gg','xx')' '=' Compose(ff,gg,xx) ',' ff'('gg'('xx'))' '=' Zeta(Gamma(xx)) +exit + +Compose: +procedure expose Memo. +arg ff,gg,xx +interpret 'rr='ff'('gg'('xx'))' +return rr + +include Math diff --git a/Task/Function-composition/REBOL/function-composition-1.rebol b/Task/Function-composition/Rebol/function-composition-1.rebol similarity index 78% rename from Task/Function-composition/REBOL/function-composition-1.rebol rename to Task/Function-composition/Rebol/function-composition-1.rebol index 8f31baeb19..ef233a55ac 100644 --- a/Task/Function-composition/REBOL/function-composition-1.rebol +++ b/Task/Function-composition/Rebol/function-composition-1.rebol @@ -1,9 +1,9 @@ -REBOL [ +Rebol [ Title: "Functional Composition" URL: http://rosettacode.org/wiki/Functional_Composition ] -; "compose" means something else in REBOL, therefore I use a 'compose-functions name. +; "compose" means something else in Rebol, therefore I use a 'compose-functions name. compose-functions: func [ {compose the given functions F and G} diff --git a/Task/Function-composition/REBOL/function-composition-2.rebol b/Task/Function-composition/Rebol/function-composition-2.rebol similarity index 100% rename from Task/Function-composition/REBOL/function-composition-2.rebol rename to Task/Function-composition/Rebol/function-composition-2.rebol diff --git a/Task/Function-composition/Red/function-composition.red b/Task/Function-composition/Red/function-composition.red new file mode 100644 index 0000000000..0f4331df21 --- /dev/null +++ b/Task/Function-composition/Red/function-composition.red @@ -0,0 +1,18 @@ +Red [ "Compose Two or Any Number of Functions - Hinjolicious" ] + +; to show the codes +demo: function [s b] [print ["^/==" s "==^/"] print mold/only b do b] + +demo "Compose two functions" [ +comp-func: function ['f 'g] [function [x] compose [(get f) (get g) x]] +sin-cos: comp-func sin cos +print sin-cos 0.5 +] + +demo "Compose any number of functions" [ +comp-funcs: function [ff] [ + function [x] compose append collect [foreach e ff [keep (get e)]] 'x +] +log-sin-cos: comp-funcs [log-e sin cos] +print log-sin-cos 0.5 +] diff --git a/Task/Function-composition/Rust/function-composition-1.rust b/Task/Function-composition/Rust/function-composition-1.rs similarity index 100% rename from Task/Function-composition/Rust/function-composition-1.rust rename to Task/Function-composition/Rust/function-composition-1.rs diff --git a/Task/Function-composition/Rust/function-composition-2.rust b/Task/Function-composition/Rust/function-composition-2.rs similarity index 100% rename from Task/Function-composition/Rust/function-composition-2.rust rename to Task/Function-composition/Rust/function-composition-2.rs diff --git a/Task/Function-composition/Scheme/function-composition-1.ss b/Task/Function-composition/Scheme/function-composition-1.scm similarity index 100% rename from Task/Function-composition/Scheme/function-composition-1.ss rename to Task/Function-composition/Scheme/function-composition-1.scm diff --git a/Task/Function-composition/Scheme/function-composition-2.ss b/Task/Function-composition/Scheme/function-composition-2.scm similarity index 100% rename from Task/Function-composition/Scheme/function-composition-2.ss rename to Task/Function-composition/Scheme/function-composition-2.scm diff --git a/Task/Function-composition/Scheme/function-composition-3.ss b/Task/Function-composition/Scheme/function-composition-3.scm similarity index 100% rename from Task/Function-composition/Scheme/function-composition-3.ss rename to Task/Function-composition/Scheme/function-composition-3.scm diff --git a/Task/Function-composition/VBScript/function-composition-1.vb b/Task/Function-composition/VBScript/function-composition-1.vbs similarity index 100% rename from Task/Function-composition/VBScript/function-composition-1.vb rename to Task/Function-composition/VBScript/function-composition-1.vbs diff --git a/Task/Function-composition/VBScript/function-composition-2.vb b/Task/Function-composition/VBScript/function-composition-2.vbs similarity index 100% rename from Task/Function-composition/VBScript/function-composition-2.vb rename to Task/Function-composition/VBScript/function-composition-2.vbs diff --git a/Task/Function-definition/ANSI-BASIC/function-definition.basic b/Task/Function-definition/ANSI-BASIC/function-definition.basic new file mode 100644 index 0000000000..9caf26d3c9 --- /dev/null +++ b/Task/Function-definition/ANSI-BASIC/function-definition.basic @@ -0,0 +1,13 @@ +100 DEF Multiply(A, B) = A * B +110 DECLARE FUNCTION MultiplyI +120 DECLARE EXTERNAL FUNCTION MultiplyE +130 PRINT Multiply(3, 1.23456) +140 PRINT MultiplyI(3, 1.23456) +150 PRINT MultiplyE(3, 1.23456) +160 FUNCTION MultiplyI(X, Y) +170 LET MultiplyI = X * Y +180 END FUNCTION +190 END +200 EXTERNAL FUNCTION MultiplyE(A, B) +210 LET MultiplyE = A * B +220 END FUNCTION diff --git a/Task/Function-definition/Ada/function-definition-1.ada b/Task/Function-definition/Ada/function-definition-1.adb similarity index 100% rename from Task/Function-definition/Ada/function-definition-1.ada rename to Task/Function-definition/Ada/function-definition-1.adb diff --git a/Task/Function-definition/Ada/function-definition-2.ada b/Task/Function-definition/Ada/function-definition-2.adb similarity index 100% rename from Task/Function-definition/Ada/function-definition-2.ada rename to Task/Function-definition/Ada/function-definition-2.adb diff --git a/Task/Function-definition/Ada/function-definition-3.ada b/Task/Function-definition/Ada/function-definition-3.adb similarity index 100% rename from Task/Function-definition/Ada/function-definition-3.ada rename to Task/Function-definition/Ada/function-definition-3.adb diff --git a/Task/Function-definition/Ada/function-definition-4.ada b/Task/Function-definition/Ada/function-definition-4.adb similarity index 100% rename from Task/Function-definition/Ada/function-definition-4.ada rename to Task/Function-definition/Ada/function-definition-4.adb diff --git a/Task/Function-definition/Ada/function-definition-5.ada b/Task/Function-definition/Ada/function-definition-5.adb similarity index 100% rename from Task/Function-definition/Ada/function-definition-5.ada rename to Task/Function-definition/Ada/function-definition-5.adb diff --git a/Task/Function-definition/Ada/function-definition-6.ada b/Task/Function-definition/Ada/function-definition-6.adb similarity index 100% rename from Task/Function-definition/Ada/function-definition-6.ada rename to Task/Function-definition/Ada/function-definition-6.adb diff --git a/Task/Function-definition/ArkScript/function-definition.ark b/Task/Function-definition/ArkScript/function-definition.ark new file mode 100644 index 0000000000..2c796ab336 --- /dev/null +++ b/Task/Function-definition/ArkScript/function-definition.ark @@ -0,0 +1,2 @@ +(let multiply (fun (a b) + (* a b))) diff --git a/Task/Function-definition/AutoIt/function-definition.autoit b/Task/Function-definition/AutoIt/function-definition.au3 similarity index 100% rename from Task/Function-definition/AutoIt/function-definition.autoit rename to Task/Function-definition/AutoIt/function-definition.au3 diff --git a/Task/Function-definition/Ballerina/function-definition.ballerina b/Task/Function-definition/Ballerina/function-definition.ballerina new file mode 100644 index 0000000000..a3c79abc73 --- /dev/null +++ b/Task/Function-definition/Ballerina/function-definition.ballerina @@ -0,0 +1,9 @@ +import ballerina/io; + +function multiply(int a, int b) returns int { + return a * b; +} + +public function main() { + io:println(multiply(4, 5)); +} diff --git a/Task/Function-definition/COBOL/function-definition-1.cobol b/Task/Function-definition/COBOL/function-definition-1.cob similarity index 100% rename from Task/Function-definition/COBOL/function-definition-1.cobol rename to Task/Function-definition/COBOL/function-definition-1.cob diff --git a/Task/Function-definition/COBOL/function-definition-2.cobol b/Task/Function-definition/COBOL/function-definition-2.cob similarity index 100% rename from Task/Function-definition/COBOL/function-definition-2.cobol rename to Task/Function-definition/COBOL/function-definition-2.cob diff --git a/Task/Function-definition/Chapel/function-definition-1.chpl b/Task/Function-definition/Chapel/function-definition-1.chpl new file mode 100644 index 0000000000..dce621a59f --- /dev/null +++ b/Task/Function-definition/Chapel/function-definition-1.chpl @@ -0,0 +1,4 @@ +proc multiply(a, b) +{ + return a * b; +} diff --git a/Task/Function-definition/Chapel/function-definition-2.chpl b/Task/Function-definition/Chapel/function-definition-2.chpl new file mode 100644 index 0000000000..cd4150861a --- /dev/null +++ b/Task/Function-definition/Chapel/function-definition-2.chpl @@ -0,0 +1,4 @@ +proc multiply(a : ?t ... 2) +{ + return a(0) * a(1) +} diff --git a/Task/Function-definition/Crystal/function-definition.cr b/Task/Function-definition/Crystal/function-definition.cr new file mode 100644 index 0000000000..9a6b44e375 --- /dev/null +++ b/Task/Function-definition/Crystal/function-definition.cr @@ -0,0 +1,16 @@ +def multiply (a, b) + a * b +end + +# with type restrictions: +def multiply (a : Int32, b : Int32) + print "(typed overload) " + a * b +end + +# proc (anonymous function) +m = ->(a : Int32, b : Int32) { a * b } + +p! multiply(2, 3), + multiply(2.0, 3.0), + m.call(2, 3) diff --git a/Task/Function-definition/Delphi/function-definition.delphi b/Task/Function-definition/Delphi/function-definition.pas similarity index 100% rename from Task/Function-definition/Delphi/function-definition.delphi rename to Task/Function-definition/Delphi/function-definition.pas diff --git a/Task/Function-definition/DuckDB/function-definition-1.duckdb b/Task/Function-definition/DuckDB/function-definition-1.duckdb new file mode 100644 index 0000000000..ce21102e19 --- /dev/null +++ b/Task/Function-definition/DuckDB/function-definition-1.duckdb @@ -0,0 +1 @@ +create or replace function multiply(x,y) as x*y; diff --git a/Task/Function-definition/DuckDB/function-definition-2.duckdb b/Task/Function-definition/DuckDB/function-definition-2.duckdb new file mode 100644 index 0000000000..3053825ed4 --- /dev/null +++ b/Task/Function-definition/DuckDB/function-definition-2.duckdb @@ -0,0 +1,10 @@ +create or replace function power2(n) as ( + with recursive cte as ( + select 0 as i, 1::UHUGEINT as p + union all + select i+1 as i, p*2 as p + from cte + where i < n ) + select last(p order by i) + from cte +); diff --git a/Task/Function-definition/Elixir/function-definition.elixir b/Task/Function-definition/Elixir/function-definition.ex similarity index 100% rename from Task/Function-definition/Elixir/function-definition.elixir rename to Task/Function-definition/Elixir/function-definition.ex diff --git a/Task/Function-definition/Emacs-Lisp/function-definition-1.l b/Task/Function-definition/Emacs-Lisp/function-definition-1.el similarity index 100% rename from Task/Function-definition/Emacs-Lisp/function-definition-1.l rename to Task/Function-definition/Emacs-Lisp/function-definition-1.el diff --git a/Task/Function-definition/Emacs-Lisp/function-definition-2.l b/Task/Function-definition/Emacs-Lisp/function-definition-2.el similarity index 100% rename from Task/Function-definition/Emacs-Lisp/function-definition-2.l rename to Task/Function-definition/Emacs-Lisp/function-definition-2.el diff --git a/Task/Function-definition/Euphoria/function-definition-1.euphoria b/Task/Function-definition/Euphoria/function-definition-1.eu similarity index 100% rename from Task/Function-definition/Euphoria/function-definition-1.euphoria rename to Task/Function-definition/Euphoria/function-definition-1.eu diff --git a/Task/Function-definition/Euphoria/function-definition-2.euphoria b/Task/Function-definition/Euphoria/function-definition-2.eu similarity index 100% rename from Task/Function-definition/Euphoria/function-definition-2.euphoria rename to Task/Function-definition/Euphoria/function-definition-2.eu diff --git a/Task/Function-definition/Excel/function-definition.excel b/Task/Function-definition/Excel/function-definition.excel new file mode 100644 index 0000000000..1b33fa780a --- /dev/null +++ b/Task/Function-definition/Excel/function-definition.excel @@ -0,0 +1,4 @@ +=LET( + MULTIPLY, LAMBDA(a, b, a * b), + ... + ) diff --git a/Task/Function-definition/FutureBasic/function-definition.basic b/Task/Function-definition/FutureBasic/function-definition-1.basic similarity index 100% rename from Task/Function-definition/FutureBasic/function-definition.basic rename to Task/Function-definition/FutureBasic/function-definition-1.basic diff --git a/Task/Function-definition/FutureBasic/function-definition-2.basic b/Task/Function-definition/FutureBasic/function-definition-2.basic new file mode 100644 index 0000000000..c6c813c61b --- /dev/null +++ b/Task/Function-definition/FutureBasic/function-definition-2.basic @@ -0,0 +1,8 @@ +window 1 + +long local fn multiply( a as long, b as long ) +end fn = a * b + +print fn multiply( 3, 9 ) + +HandleEvents diff --git a/Task/Function-definition/Gleam/function-definition.gleam b/Task/Function-definition/Gleam/function-definition.gleam new file mode 100644 index 0000000000..45be9f932e --- /dev/null +++ b/Task/Function-definition/Gleam/function-definition.gleam @@ -0,0 +1,3 @@ +fn multiply(x: Int, y: Int) -> Int { + x * y +} diff --git a/Task/Function-definition/Haxe/function-definition.haxe b/Task/Function-definition/Haxe/function-definition.hx similarity index 100% rename from Task/Function-definition/Haxe/function-definition.haxe rename to Task/Function-definition/Haxe/function-definition.hx diff --git a/Task/Function-definition/Java/function-definition.java b/Task/Function-definition/Java/function-definition-1.java similarity index 100% rename from Task/Function-definition/Java/function-definition.java rename to Task/Function-definition/Java/function-definition-1.java diff --git a/Task/Function-definition/Java/function-definition-2.java b/Task/Function-definition/Java/function-definition-2.java new file mode 100644 index 0000000000..fb127fb080 --- /dev/null +++ b/Task/Function-definition/Java/function-definition-2.java @@ -0,0 +1,27 @@ +import java.util.function.BiFunction; +import java.util.function.DoubleUnaryOperator; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.function.UnaryOperator; + +public final class FunctionDefinition { + + public static void main(String[] args) { + System.out.println(size.apply("Rosetta")); + System.out.println(greeting.apply("Joe")); + System.out.println(half.applyAsDouble(7)); + System.out.println(lessThanTen.test(15)); + System.out.println(add.apply(2, 3)); + } + + private static Function size = s -> s.length(); + + private static UnaryOperator greeting = s -> "Hello " + s; + + private static DoubleUnaryOperator half = a -> a / 2; + + private static Predicate lessThanTen = a -> a < 10; + + private static BiFunction add = (a, b) -> a + b; + +} diff --git a/Task/Function-definition/JavaScript/function-definition-6.js b/Task/Function-definition/JavaScript/function-definition-6.js index 60d2fdb755..b32d13d81a 100644 --- a/Task/Function-definition/JavaScript/function-definition-6.js +++ b/Task/Function-definition/JavaScript/function-definition-6.js @@ -1,2 +1,8 @@ var multiply = (a, b) => a * b; var multiply = (a, b) => { return a * b }; + +// Or, `var` being long deprecated, and currying convenient, +// (particularly in use with the higher-order Array methods) + +const multiply = a => + b => a * b; diff --git a/Task/Function-definition/Julia/function-definition-1.julia b/Task/Function-definition/Julia/function-definition-1.jl similarity index 100% rename from Task/Function-definition/Julia/function-definition-1.julia rename to Task/Function-definition/Julia/function-definition-1.jl diff --git a/Task/Function-definition/Julia/function-definition-2.julia b/Task/Function-definition/Julia/function-definition-2.jl similarity index 100% rename from Task/Function-definition/Julia/function-definition-2.julia rename to Task/Function-definition/Julia/function-definition-2.jl diff --git a/Task/Function-definition/Julia/function-definition-3.julia b/Task/Function-definition/Julia/function-definition-3.jl similarity index 100% rename from Task/Function-definition/Julia/function-definition-3.julia rename to Task/Function-definition/Julia/function-definition-3.jl diff --git a/Task/Function-definition/Komodo/function-definition.komodo b/Task/Function-definition/Komodo/function-definition.komodo new file mode 100644 index 0000000000..63404d357c --- /dev/null +++ b/Task/Function-definition/Komodo/function-definition.komodo @@ -0,0 +1,5 @@ +let prod(a, b) := a*b +let prodAnon := (a, b) -> a*b + +assert(prodAnon(2, 2) = ((a, b) -> a*b)(2, 2)) +assert(prod(2, 2) = prodAnon(2, 2)) diff --git a/Task/Function-definition/Kotlin/function-definition.kotlin b/Task/Function-definition/Kotlin/function-definition.kts similarity index 100% rename from Task/Function-definition/Kotlin/function-definition.kotlin rename to Task/Function-definition/Kotlin/function-definition.kts diff --git a/Task/Function-definition/LOLCODE/function-definition.lol b/Task/Function-definition/LOLCODE/function-definition.lol new file mode 100644 index 0000000000..8d50259103 --- /dev/null +++ b/Task/Function-definition/LOLCODE/function-definition.lol @@ -0,0 +1,9 @@ +HAI 1.3 + +HOW IZ I MULTIPLY YR X AN YR Y + FOUND YR PRODUKT OF X AN Y +IF U SAY SO + +VISIBLE I IZ MULTIPLY YR 2 AND YR 3 MKAY + +KTHXBYE diff --git a/Task/Function-definition/Langur/function-definition-1.langur b/Task/Function-definition/Langur/function-definition-1.langur index 3732180e63..0445f67e8d 100644 --- a/Task/Function-definition/Langur/function-definition-1.langur +++ b/Task/Function-definition/Langur/function-definition-1.langur @@ -1,2 +1 @@ -val .multiply = f(.x, .y) .x x .y -.multiply(3, 4) +val multiply = fn(a, b) { a * b } diff --git a/Task/Function-definition/Langur/function-definition-2.langur b/Task/Function-definition/Langur/function-definition-2.langur index fbc6009c47..5878a47bf8 100644 --- a/Task/Function-definition/Langur/function-definition-2.langur +++ b/Task/Function-definition/Langur/function-definition-2.langur @@ -1,2 +1 @@ -val .multiply = f .x x .y -.multiply(3, 4) +val multiply = fn{*} diff --git a/Task/Function-definition/Langur/function-definition-3.langur b/Task/Function-definition/Langur/function-definition-3.langur index 78648a1332..e8a58c5239 100644 --- a/Task/Function-definition/Langur/function-definition-3.langur +++ b/Task/Function-definition/Langur/function-definition-3.langur @@ -1,2 +1 @@ -val .multiply = f{x} -.multiply(3, 4) +val timestwo = fn{*2} diff --git a/Task/Function-definition/Langur/function-definition-4.langur b/Task/Function-definition/Langur/function-definition-4.langur index 81288d6351..64c16021ee 100644 --- a/Task/Function-definition/Langur/function-definition-4.langur +++ b/Task/Function-definition/Langur/function-definition-4.langur @@ -1,2 +1 @@ -val .times3 = f{x 3} -map .times3, [1, 2, 3] +val factorial = fn(x) { if(x < 2: 1; x * fn((x - 1))) } diff --git a/Task/Function-definition/OCaml/function-definition.ocaml b/Task/Function-definition/OCaml/function-definition.ml similarity index 100% rename from Task/Function-definition/OCaml/function-definition.ocaml rename to Task/Function-definition/OCaml/function-definition.ml diff --git a/Task/Function-definition/PascalABC.NET/function-definition.pas b/Task/Function-definition/PascalABC.NET/function-definition.pas new file mode 100644 index 0000000000..5cdaeef57d --- /dev/null +++ b/Task/Function-definition/PascalABC.NET/function-definition.pas @@ -0,0 +1 @@ +function multiply(a,b: real): real := a + b; diff --git a/Task/Function-definition/Pluto/function-definition.pluto b/Task/Function-definition/Pluto/function-definition.pluto new file mode 100644 index 0000000000..442e6b756c --- /dev/null +++ b/Task/Function-definition/Pluto/function-definition.pluto @@ -0,0 +1,5 @@ +function multiply(a,b) + return a*b +end + +print(multiply(3,4)) diff --git a/Task/Function-definition/PowerShell/function-definition-1.psh b/Task/Function-definition/PowerShell/function-definition-1.ps1 similarity index 100% rename from Task/Function-definition/PowerShell/function-definition-1.psh rename to Task/Function-definition/PowerShell/function-definition-1.ps1 diff --git a/Task/Function-definition/PowerShell/function-definition-2.psh b/Task/Function-definition/PowerShell/function-definition-2.ps1 similarity index 100% rename from Task/Function-definition/PowerShell/function-definition-2.psh rename to Task/Function-definition/PowerShell/function-definition-2.ps1 diff --git a/Task/Function-definition/PowerShell/function-definition-3.psh b/Task/Function-definition/PowerShell/function-definition-3.ps1 similarity index 100% rename from Task/Function-definition/PowerShell/function-definition-3.psh rename to Task/Function-definition/PowerShell/function-definition-3.ps1 diff --git a/Task/Function-definition/PowerShell/function-definition-4.psh b/Task/Function-definition/PowerShell/function-definition-4.ps1 similarity index 100% rename from Task/Function-definition/PowerShell/function-definition-4.psh rename to Task/Function-definition/PowerShell/function-definition-4.ps1 diff --git a/Task/Function-definition/PowerShell/function-definition-5.psh b/Task/Function-definition/PowerShell/function-definition-5.ps1 similarity index 100% rename from Task/Function-definition/PowerShell/function-definition-5.psh rename to Task/Function-definition/PowerShell/function-definition-5.ps1 diff --git a/Task/Function-definition/BASIC/function-definition.basic b/Task/Function-definition/QuickBASIC/function-definition.basic similarity index 100% rename from Task/Function-definition/BASIC/function-definition.basic rename to Task/Function-definition/QuickBASIC/function-definition.basic diff --git a/Task/Function-definition/REXX/function-definition-1.rexx b/Task/Function-definition/REXX/function-definition-1.rexx deleted file mode 100644 index a476639d66..0000000000 --- a/Task/Function-definition/REXX/function-definition-1.rexx +++ /dev/null @@ -1 +0,0 @@ -multiply: return arg(1) * arg(2) /*return the product of the two arguments.*/ diff --git a/Task/Function-definition/REXX/function-definition-2.rexx b/Task/Function-definition/REXX/function-definition-2.rexx deleted file mode 100644 index 569b050f96..0000000000 --- a/Task/Function-definition/REXX/function-definition-2.rexx +++ /dev/null @@ -1 +0,0 @@ -multiply: return arg(1) * arg(2) / 1 /*return with a normalized product of 2 args. */ diff --git a/Task/Function-definition/REXX/function-definition.rexx b/Task/Function-definition/REXX/function-definition.rexx new file mode 100644 index 0000000000..1d6fc424e5 --- /dev/null +++ b/Task/Function-definition/REXX/function-definition.rexx @@ -0,0 +1,34 @@ +-- 11 Sep 2025 +include Setting + +say 'FUNCTION DEFINITION' +say version +say +xx=0; yy=0; rr=0 +say 'xx =' xx 'yy =' yy 'rr =' rr +say 'Multiply1(2,3)' '=' Multiply1(2,3) +say 'xx =' xx 'yy =' yy 'rr =' rr +say 'Multiply2(3,5)' '=' Multiply2(3,5) +say 'xx =' xx 'yy =' yy 'rr =' rr +xx=5; yy=7 +say 'xx =' xx 'yy =' yy 'rr =' rr +say 'Multiply3(5,7)' '=' Multiply3() +say 'xx =' xx 'yy =' yy 'rr =' rr +exit + +Multiply1: +procedure +arg xx,yy +rr=xx*yy +return rr + +Multiply2: +arg xx,yy +rr=xx*yy +return rr + +Multiply3: +rr=xx*yy +return rr + +include Math diff --git a/Task/Function-definition/REBOL/function-definition.rebol b/Task/Function-definition/Rebol/function-definition.rebol similarity index 100% rename from Task/Function-definition/REBOL/function-definition.rebol rename to Task/Function-definition/Rebol/function-definition.rebol diff --git a/Task/Function-definition/Rust/function-definition.rust b/Task/Function-definition/Rust/function-definition.rs similarity index 100% rename from Task/Function-definition/Rust/function-definition.rust rename to Task/Function-definition/Rust/function-definition.rs diff --git a/Task/Function-definition/Rye/function-definition-1.rye b/Task/Function-definition/Rye/function-definition-1.rye new file mode 100644 index 0000000000..944dd8c78b --- /dev/null +++ b/Task/Function-definition/Rye/function-definition-1.rye @@ -0,0 +1 @@ +multiply: fn { a b } { a * b } diff --git a/Task/Function-definition/Rye/function-definition-2.rye b/Task/Function-definition/Rye/function-definition-2.rye new file mode 100644 index 0000000000..2f2cc5ea24 --- /dev/null +++ b/Task/Function-definition/Rye/function-definition-2.rye @@ -0,0 +1 @@ +multiply: fn { a b } { * b } diff --git a/Task/Function-definition/Rye/function-definition-3.rye b/Task/Function-definition/Rye/function-definition-3.rye new file mode 100644 index 0000000000..ca8885cbcf --- /dev/null +++ b/Task/Function-definition/Rye/function-definition-3.rye @@ -0,0 +1 @@ +multiply: pfn { a b } { a * b } diff --git a/Task/Function-definition/SIL/function-definition.sil b/Task/Function-definition/SIL/function-definition.sil new file mode 100644 index 0000000000..21bfbe3c19 --- /dev/null +++ b/Task/Function-definition/SIL/function-definition.sil @@ -0,0 +1,3 @@ +funcmultiply +r = x * y +return diff --git a/Task/Function-definition/Scheme/function-definition-1.ss b/Task/Function-definition/Scheme/function-definition-1.scm similarity index 100% rename from Task/Function-definition/Scheme/function-definition-1.ss rename to Task/Function-definition/Scheme/function-definition-1.scm diff --git a/Task/Function-definition/Scheme/function-definition-2.ss b/Task/Function-definition/Scheme/function-definition-2.scm similarity index 100% rename from Task/Function-definition/Scheme/function-definition-2.ss rename to Task/Function-definition/Scheme/function-definition-2.scm diff --git a/Task/Function-definition/Tcl/function-definition-3.tcl b/Task/Function-definition/Tcl/function-definition-3.tcl new file mode 100644 index 0000000000..e2a1260e67 --- /dev/null +++ b/Task/Function-definition/Tcl/function-definition-3.tcl @@ -0,0 +1,13 @@ +proc multiply { a b args } { + + set product 1 + + foreach m [list $a $b {*}$args] { + + set product [expr {$product * $m}] + } + + return $product +} + +puts stdout [multiply 3 4 7 9 -2 -5 ] diff --git a/Task/Function-definition/VBScript/function-definition-1.vb b/Task/Function-definition/VBScript/function-definition-1.vbs similarity index 100% rename from Task/Function-definition/VBScript/function-definition-1.vb rename to Task/Function-definition/VBScript/function-definition-1.vbs diff --git a/Task/Function-definition/VBScript/function-definition-2.vb b/Task/Function-definition/VBScript/function-definition-2.vbs similarity index 100% rename from Task/Function-definition/VBScript/function-definition-2.vb rename to Task/Function-definition/VBScript/function-definition-2.vbs diff --git a/Task/Function-definition/YAMLScript/function-definition.ys b/Task/Function-definition/YAMLScript/function-definition.ys new file mode 100644 index 0000000000..7bab26ba31 --- /dev/null +++ b/Task/Function-definition/YAMLScript/function-definition.ys @@ -0,0 +1,15 @@ +!YS-v0 + +# Main function definition with variable arguments: +defn main(*args): + say: "multiply($(args.join(', '))) + -> $multiply(args*)" + +# A multi-arity function definition: +defn multiply: + (): 1 + (x): x + (x y): x * y + (x y *more): + reduce multiply: + multiply(x y) more diff --git a/Task/Function-definition/Zig/function-definition.zig b/Task/Function-definition/Zig/function-definition.zig index f67148e5cd..38dab3141a 100644 --- a/Task/Function-definition/Zig/function-definition.zig +++ b/Task/Function-definition/Zig/function-definition.zig @@ -1,4 +1,4 @@ -fun multiply(x: i64, y: i64) i64 { +fn multiply(x: i64, y: i64) i64 { return x * y; } diff --git a/Task/Function-frequency/Arturo/function-frequency.arturo b/Task/Function-frequency/Arturo/function-frequency.arturo index ba1c035514..651ef9d353 100644 --- a/Task/Function-frequency/Arturo/function-frequency.arturo +++ b/Task/Function-frequency/Arturo/function-frequency.arturo @@ -3,23 +3,21 @@ frequencies: #[] inspectBlock: function [blk][ loop blk 'item [ - case [] - when? [word? item][ + when [ + word? item [ sItem: to :string item if set? sItem -> if function? var sItem [ - if? key? frequencies sItem -> - set frequencies sItem (get frequencies sItem)+1 - else -> - set frequencies sItem 1 + switch key? frequencies sItem + -> set frequencies sItem (get frequencies sItem)+1 + -> set frequencies sItem 1 ] ] - when? [or? block? item - inline? item] -> + or? block? item + inline? item -> inspectBlock item - - else [] + ] ] ] diff --git a/Task/Function-frequency/FreeBASIC/function-frequency.basic b/Task/Function-frequency/FreeBASIC/function-frequency.basic new file mode 100644 index 0000000000..70da46504e --- /dev/null +++ b/Task/Function-frequency/FreeBASIC/function-frequency.basic @@ -0,0 +1,41 @@ +Dim As String code, word, char +Dim As Integer i, j +Dim As String words() +Dim As Integer counts() + +Open "i:\your_file.bas" For Input As #1 +While Not Eof(1) + Line Input #1, code + For i = 1 To Len(code) + char = Lcase(Mid(code, i, 1)) + If char >= "a" And char <= "z" Then + word &= Mid(code, i, 1) + Elseif word <> "" Then + For j = 0 To Ubound(words) + If words(j) = word Then + counts(j) += 1 + Exit For + End If + Next + If j > Ubound(words) Then + Redim Preserve words(Ubound(words) + 1) + Redim Preserve counts(Ubound(counts) + 1) + words(Ubound(words)) = word + counts(Ubound(counts)) = 1 + End If + word = "" + End If + Next +Wend +Close #1 + +For i = 0 To 9 + Dim As Integer maxj = 0 + For j = 0 To Ubound(counts) + If counts(j) > counts(maxj) Then maxj = j + Next + Print words(maxj); " occurs"; counts(maxj); " times" + counts(maxj) = 0 +Next + +Sleep diff --git a/Task/Function-frequency/Julia/function-frequency.julia b/Task/Function-frequency/Julia/function-frequency.jl similarity index 100% rename from Task/Function-frequency/Julia/function-frequency.julia rename to Task/Function-frequency/Julia/function-frequency.jl diff --git a/Task/Function-frequency/REXX/function-frequency-3.rexx b/Task/Function-frequency/REXX/function-frequency-3.rexx new file mode 100644 index 0000000000..05ffecf5c2 --- /dev/null +++ b/Task/Function-frequency/REXX/function-frequency-3.rexx @@ -0,0 +1,138 @@ +-- 21 Feb 2026 +include Setting +parse arg program + +say 'FUNCTION FREQUENCY' +say version +call ReadSource +call CleanSource +call CollectInvokes +call SortSt 'invo.' +call ReportInvokes +call Timer +exit + +ReadSource: +-- Read all lines in a stem +if program='' then + program='FuncFreq.rex' +else + program=program'.rex' +say 'Invoke frequencies for program' program +say +call Stream program,'c','open read' +srce.=0; n=0 +do while Lines(program) + record=LineIn(program) + n=n+1; srce.n=record +end +srce.0=n +call Stream program,'c','close' +return + +CleanSource: +-- Erase all characters that are (in this order): +-- within a '' literal or a "" literal +-- within a /*...*/ comment block +-- after -- ... comment +-- not allowed in names +cleanc=0 +p1=0; q1=0 +do i = 1 to srce.0 + cleanl=0 + s=srce.i; k=Length(s) + do j = 1 to k +-- Substring for literals + p1=SubStr(s,j,1) +-- Erase literal + if p1 = "'" | p1 = '"' then do + if cleanl then do + s=Overlay(' ',s,j) + if p1 = q1 then + cleanl=0 + end + else do + q1=p1; cleanl=1 + end + end + if cleanl then + s=Overlay(' ',s,j) + end j +-- Substring for comments + p2=SubStr(s,j,2) +-- Erase block /*...*/ comment + if p2 = '/*' then + cleanc=1 + else do + if p2 = '*/' then do + s=Overlay(' ',s,j,2) + cleanc=0 + end + end + if cleanc then do + s=Overlay(' ',s,j) + iterate j + end +-- Erase -- ... comment + if p2 = '--' then do + s=Overlay(' ',s,j,k) + leave j + end +-- Erase all characters not allowed in names + s=Translate(s,' ','+-*|<>,;=/\%)') + srce.i=s +end i +return + +CollectInvokes: +-- Collect invocations 'Name()' or 'call Name' +invo.=0; v=0 +do i = 1 to srce.0 + s=srce.i +-- Parse words + wrds.=0; n=0 + do until s = '' + n=n+1; parse var s wrds.n s + end +-- Find invocations + wrds.0=n + do j = 1 to wrds.0 + w=wrds.j +-- Call Name + if Upper(w) = 'CALL' then do + k=j+1; v=v+1; invo.v=wrds.k + end +-- Name() + else do + p1=1; p2=Pos('(',w) + do while p2 > 0 + a=SubStr(w,p1,p2-p1) + if a <> '' then do + v=v+1; invo.v=SubStr(w,p1,p2-p1) + end + p1=p2+1; p2=Pos('(',w,p1) + end + end + end j +end i +invo.0=v +return + +ReportInvokes: +-- Aggregate and report +p=invo.1; n=1 +do i = 2 to invo.0 + v = invo.i + if v = p then + n=n+1 + else do + say Right(n,3) p + p=v; n=1 + end +end i +say Right(n,3) p +say +return + +-- SortSt; Timer +include Math diff --git a/Task/Function-frequency/Wren/function-frequency.wren b/Task/Function-frequency/Wren/function-frequency.wren index 2216a94725..2d2fcedef0 100644 --- a/Task/Function-frequency/Wren/function-frequency.wren +++ b/Task/Function-frequency/Wren/function-frequency.wren @@ -1,9 +1,9 @@ import "io" for File import "os" for Process -import "/pattern" for Pattern -import "/set" for Bag -import "/sort" for Sort -import "/fmt" for Fmt +import "./pattern" for Pattern +import "./set" for Bag +import "./sort" for Sort +import "./fmt" for Fmt var args = Process.arguments if (args.count != 1) { diff --git a/Task/Function-prototype/Ada/function-prototype-1.ada b/Task/Function-prototype/Ada/function-prototype-1.adb similarity index 100% rename from Task/Function-prototype/Ada/function-prototype-1.ada rename to Task/Function-prototype/Ada/function-prototype-1.adb diff --git a/Task/Function-prototype/Ada/function-prototype-2.ada b/Task/Function-prototype/Ada/function-prototype-2.adb similarity index 100% rename from Task/Function-prototype/Ada/function-prototype-2.ada rename to Task/Function-prototype/Ada/function-prototype-2.adb diff --git a/Task/Function-prototype/Ada/function-prototype-3.ada b/Task/Function-prototype/Ada/function-prototype-3.adb similarity index 100% rename from Task/Function-prototype/Ada/function-prototype-3.ada rename to Task/Function-prototype/Ada/function-prototype-3.adb diff --git a/Task/Function-prototype/Ada/function-prototype-4.ada b/Task/Function-prototype/Ada/function-prototype-4.adb similarity index 100% rename from Task/Function-prototype/Ada/function-prototype-4.ada rename to Task/Function-prototype/Ada/function-prototype-4.adb diff --git a/Task/Function-prototype/Ada/function-prototype-5.ada b/Task/Function-prototype/Ada/function-prototype-5.adb similarity index 100% rename from Task/Function-prototype/Ada/function-prototype-5.ada rename to Task/Function-prototype/Ada/function-prototype-5.adb diff --git a/Task/Function-prototype/COBOL/function-prototype.cobol b/Task/Function-prototype/COBOL/function-prototype.cob similarity index 100% rename from Task/Function-prototype/COBOL/function-prototype.cobol rename to Task/Function-prototype/COBOL/function-prototype.cob diff --git a/Task/Function-prototype/Delphi/function-prototype-1.delphi b/Task/Function-prototype/Delphi/function-prototype-1.pas similarity index 100% rename from Task/Function-prototype/Delphi/function-prototype-1.delphi rename to Task/Function-prototype/Delphi/function-prototype-1.pas diff --git a/Task/Function-prototype/Delphi/function-prototype-2.delphi b/Task/Function-prototype/Delphi/function-prototype-2.pas similarity index 100% rename from Task/Function-prototype/Delphi/function-prototype-2.delphi rename to Task/Function-prototype/Delphi/function-prototype-2.pas diff --git a/Task/Function-prototype/EasyLang/function-prototype.easy b/Task/Function-prototype/EasyLang/function-prototype.easy new file mode 100644 index 0000000000..d3292735cc --- /dev/null +++ b/Task/Function-prototype/EasyLang/function-prototype.easy @@ -0,0 +1,31 @@ +# No arguments +funcdecl f0 . +# +# Two arguments +procdecl f1 a s$ . +# +# Varargs are not available +# +# Two arguments (integer and string), pass by reference +procdecl f4 &a &s$ . +# +# Function returning an array +funcdecl[] f7 . +# +print f0 +# +# Each declared function must also be implemented +# +func f0 . + return 3 +. +proc f1 a s$ . + print s$ & a +. +proc f4 &a &s$ . + a = 7 + s$ = "hello" +. +func[] f7 . + return [ 1 2 3 ] +. diff --git a/Task/Function-prototype/FutureBasic/function-prototype.basic b/Task/Function-prototype/FutureBasic/function-prototype.basic new file mode 100644 index 0000000000..9a96932ecb --- /dev/null +++ b/Task/Function-prototype/FutureBasic/function-prototype.basic @@ -0,0 +1,4 @@ +def fn NoArgs +def fn TwoArgs( a as long, b as long ) +def fn VarArgs( n as long, ... ) +long def fn Multiply( a as long, b as long ) // function returns a value diff --git a/Task/Function-prototype/Julia/function-prototype-1.julia b/Task/Function-prototype/Julia/function-prototype-1.jl similarity index 100% rename from Task/Function-prototype/Julia/function-prototype-1.julia rename to Task/Function-prototype/Julia/function-prototype-1.jl diff --git a/Task/Function-prototype/Julia/function-prototype-2.julia b/Task/Function-prototype/Julia/function-prototype-2.jl similarity index 100% rename from Task/Function-prototype/Julia/function-prototype-2.julia rename to Task/Function-prototype/Julia/function-prototype-2.jl diff --git a/Task/Function-prototype/Kotlin/function-prototype.kotlin b/Task/Function-prototype/Kotlin/function-prototype.kts similarity index 100% rename from Task/Function-prototype/Kotlin/function-prototype.kotlin rename to Task/Function-prototype/Kotlin/function-prototype.kts diff --git a/Task/Function-prototype/OCaml/function-prototype.ocaml b/Task/Function-prototype/OCaml/function-prototype.ml similarity index 100% rename from Task/Function-prototype/OCaml/function-prototype.ocaml rename to Task/Function-prototype/OCaml/function-prototype.ml diff --git a/Task/Functional-coverage-tree/C++/functional-coverage-tree.cpp b/Task/Functional-coverage-tree/C++/functional-coverage-tree.cpp new file mode 100644 index 0000000000..9397979952 --- /dev/null +++ b/Task/Functional-coverage-tree/C++/functional-coverage-tree.cpp @@ -0,0 +1,170 @@ +#include +#include +#include +#include +#include +#include + +class FCNode { +public: + FCNode(const std::string& name, const uint32_t& weight, const double& coverage) + : name(name), weight(weight), coverage(coverage), parent(NULL) {} + + void add_children(const std::vector>& nodes) { + for ( const std::shared_ptr& node : nodes ) { + node->parent = this; + children.emplace_back(node); + update_coverage(); + } + } + + double get_coverage() { + return coverage; + } + + void set_coverage(const double& aCoverage) { + if ( coverage != aCoverage ) { + coverage = aCoverage; + if ( parent ) { + parent->update_coverage(); + } + } + } + + void display() { + display(0); + } + +private: + void update_coverage() { + double sum_weighted_coverage = 0.0; + uint32_t sum_weight = 0; + for ( const std::shared_ptr& node : children ) { + sum_weighted_coverage += node->weight * node->coverage; + sum_weight += node->weight; + } + + set_coverage(sum_weighted_coverage / sum_weight); + } + + void display(uint32_t level) { + const std::string initial = std::string(4 * level, ' ') + name; + const std::string padding = std::string(NAME_FIELD_WIDTH - initial.length(), ' '); + std::cout << initial + padding + "|"; + std::cout << " " << std::setw(3) << weight << " |"; + std::cout << " " << std::fixed << std::setprecision(6) << coverage << " |" << std::endl; + + for ( const std::shared_ptr& child : children ) { + child->display(level + 1); + } + } + + std::string name; + uint32_t weight; + double coverage; + FCNode* parent; + std::vector> children{ }; + + static constexpr uint32_t NAME_FIELD_WIDTH = 32; +}; + +int main() { + FCNode cleaning("Cleaning", 1, 0.0); + + std::vector> houses = { + std::make_shared("House_1", 40, 0.0), + std::make_shared("House_2", 60, 0.0) + }; + cleaning.add_children(houses); + + std::vector> house_1 = { + std::make_shared("Bedrooms", 1, 0.25), + std::make_shared("Bathrooms", 1, 0.0), + std::make_shared("Attic", 1, 0.75), + std::make_shared("Kitchen", 1, 0.1), + std::make_shared("Living_rooms", 1, 0.0), + std::make_shared("Basement", 1, 0.0), + std::make_shared("Garage", 1, 0.0), + std::make_shared("Garden",1, 0.8) + }; + houses[0]->add_children(house_1); + + std::vector> bathrooms_house_1 = { + std::make_shared("Bathroom_1", 1, 0.5), + std::make_shared("Bathroom_2", 1, 0.0), + std::make_shared("Outside_lavatory", 1, 1.0) + }; + house_1[1]->add_children(bathrooms_house_1); + + std::vector> living_rooms_house_1 = { + std::make_shared("lounge", 1, 0.0), + std::make_shared("Dining_room", 1, 0.0), + std::make_shared("Conservatory", 1, 0.0), + std::make_shared("Playroom", 1, 1.0) + }; + house_1[4]->add_children(living_rooms_house_1); + + std::vector> house_2 = { + std::make_shared("Upstairs", 1, 0.15), + std::make_shared("Ground_floor", 1, 0.316667), + std::make_shared("Basement", 1, 0.916667) + }; + houses[1]->add_children(house_2); + + std::vector> upstairs = { + std::make_shared("Bedrooms", 1, 0.0), + std::make_shared("Bathroom", 1, 0.0), + std::make_shared("Toilet", 1, 0.0), + std::make_shared("Attics", 1, 0.6) + }; + house_2[0]->add_children(upstairs); + + std::vector> ground_floor = { + std::make_shared("Kitchen", 1, 0.0), + std::make_shared("Living_rooms", 1, 0.0), + std::make_shared("Wet_room_&_toilet", 1, 0.0), + std::make_shared("Garage", 1, 0.0), + std::make_shared("Garden", 1, 0.9), + std::make_shared("Hot_tub_suite", 1, 1.0) + }; + house_2[1]->add_children(ground_floor); + + std::vector> basement = { + std::make_shared("Cellars", 1, 1.0), + std::make_shared("Wine_cellar", 1, 1.0), + std::make_shared("Cinema", 1, 0.75) + }; + house_2[2]->add_children(basement); + + std::vector> bedrooms = { + std::make_shared("Suite_1", 1, 0.0), + std::make_shared("Suite_2", 1, 0.0), + std::make_shared("Bedroom_3",1, 0.0), + std::make_shared("Bedroom_4",1, 0.0) + }; + upstairs[0]->add_children(bedrooms); + + std::vector> living_rooms_house_2 = { + std::make_shared("lounge", 1, 0.0), + std::make_shared("Dining_room", 1, 0.0), + std::make_shared("Conservatory", 1, 0.0), + std::make_shared("Playroom", 1, 0.0) + }; + ground_floor[1]->add_children(living_rooms_house_2); + + const double overall_coverage = cleaning.get_coverage(); + std::cout << "OVERALL COVERAGE = " << std::fixed << std::setprecision(6) + << overall_coverage << std::endl << std::endl; + std::cout << "NAME HIERARCHY | WEIGHT | COVERAGE |" << std::endl; + std::cout << "--------------------------------|--------|----------|" << std::endl; + cleaning.display(); + std::cout << std::endl; + + basement[2]->set_coverage(1.0); // Change House_2 Cinema node coverage to 1.0 + const double updated_coverage = cleaning.get_coverage(); + const double difference = updated_coverage - overall_coverage; + std::cout << "If the coverage of the House_2 Cinema node were increased " << std::endl; + std::cout << "from 0.75 to 1.0 the overall coverage would increase by "; + std::cout << std::fixed << std::setprecision(6) << difference << " to " << updated_coverage << std::endl; + basement[2]->set_coverage(0.75); // Restore to House_2 Cinema node coverage to its original value +} diff --git a/Task/Functional-coverage-tree/FreeBASIC/functional-coverage-tree.basic b/Task/Functional-coverage-tree/FreeBASIC/functional-coverage-tree.basic new file mode 100644 index 0000000000..55d06e8f9a --- /dev/null +++ b/Task/Functional-coverage-tree/FreeBASIC/functional-coverage-tree.basic @@ -0,0 +1,154 @@ +Type FCNode + As String nombre + As Integer weight + As Double coverage + As FCNode Ptr children(Any) + As FCNode Ptr parent + Declare Constructor(nombre As String, weight As Integer, coverage As Double) + Declare Sub addChildren(nodes() As FCNode Ptr) + Declare Sub setCoverage(value As Double) + Declare Sub updateCoverage() + Declare Sub show(level As Integer) +End Type + +Constructor FCNode(nombre As String, weight As Integer, coverage As Double) + this.nombre = nombre + this.weight = weight + this.coverage = coverage + this.parent = 0 +End Constructor + +Sub FCNode.addChildren(nodes() As FCNode Ptr) + For i As Integer = 0 To Ubound(nodes) + nodes(i)->parent = @This + Redim Preserve this.children(Ubound(this.children) + 1) + this.children(Ubound(this.children)) = nodes(i) + Next + this.updateCoverage() +End Sub + +Sub FCNode.setCoverage(value As Double) + If this.coverage <> value Then + this.coverage = value + If this.parent <> 0 Then this.parent->updateCoverage() + End If +End Sub + +Sub FCNode.updateCoverage() + Dim As Double v1 = 0 + Dim As Integer v2 = 0 + For i As Integer = 0 To Ubound(this.children) + v1 += this.children(i)->weight * this.children(i)->coverage + v2 += this.children(i)->weight + Next + If v2 <> 0 Then this.setCoverage(v1 / v2) +End Sub + +Sub FCNode.show(level As Integer) + Dim As Integer indent, nl, i + + indent = level * 4 + nl = Len(this.nombre) + indent + Print Space(indent); this.nombre; Space(32 - nl); "|"; Using "#####"; this.weight; + Print Using " | #.###### |"; this.coverage + If Ubound(this.children) = -1 Then Return + For i = 0 To Ubound(this.children) + this.children(i)->show(level + 1) + Next +End Sub + +Function newFCN(nombre As String, weight As Integer, coverage As Double) As FCNode Ptr + Return New FCNode(nombre, weight, coverage) +End Function + +Dim houses(1) As FCNode Ptr +houses(0) = newFCN("house1", 40, 0) +houses(1) = newFCN("house2", 60, 0) + +Dim house1(7) As FCNode Ptr +house1(0) = newFCN("bedrooms", 1, 0.25) +house1(1) = newFCN("bathrooms", 1, 0) +house1(2) = newFCN("attic", 1, 0.75) +house1(3) = newFCN("kitchen", 1, 0.1) +house1(4) = newFCN("living_rooms", 1, 0) +house1(5) = newFCN("basement", 1, 0) +house1(6) = newFCN("garage", 1, 0) +house1(7) = newFCN("garden", 1, 0.8) + +Dim house2(2) As FCNode Ptr +house2(0) = newFCN("upstairs", 1, 0) +house2(1) = newFCN("groundfloor", 1, 0) +house2(2) = newFCN("basement", 1, 0) + +Dim h1Bathrooms(2) As FCNode Ptr +h1Bathrooms(0) = newFCN("bathroom1", 1, 0.5) +h1Bathrooms(1) = newFCN("bathroom2", 1, 0) +h1Bathrooms(2) = newFCN("outside_lavatory", 1, 1) + +Dim h1LivingRooms(3) As FCNode Ptr +h1LivingRooms(0) = newFCN("lounge", 1, 0) +h1LivingRooms(1) = newFCN("dining_room", 1, 0) +h1LivingRooms(2) = newFCN("conservatory", 1, 0) +h1LivingRooms(3) = newFCN("playroom", 1, 1) + +Dim h2Upstairs(3) As FCNode Ptr +h2Upstairs(0) = newFCN("bedrooms", 1, 0) +h2Upstairs(1) = newFCN("bathroom", 1, 0) +h2Upstairs(2) = newFCN("toilet", 1, 0) +h2Upstairs(3) = newFCN("attics", 1, 0.6) + +Dim h2Groundfloor(5) As FCNode Ptr +h2Groundfloor(0) = newFCN("kitchen", 1, 0) +h2Groundfloor(1) = newFCN("living_rooms", 1, 0) +h2Groundfloor(2) = newFCN("wet_room_&_toilet", 1, 0) +h2Groundfloor(3) = newFCN("garage", 1, 0) +h2Groundfloor(4) = newFCN("garden", 1, 0.9) +h2Groundfloor(5) = newFCN("hot_tub_suite", 1, 1) + +Dim h2Basement(2) As FCNode Ptr +h2Basement(0) = newFCN("cellars", 1, 1) +h2Basement(1) = newFCN("wine_cellar", 1, 1) +h2Basement(2) = newFCN("cinema", 1, 0.75) + +Dim h2UpstairsBedrooms(3) As FCNode Ptr +h2UpstairsBedrooms(0) = newFCN("suite_1", 1, 0) +h2UpstairsBedrooms(1) = newFCN("suite_2", 1, 0) +h2UpstairsBedrooms(2) = newFCN("bedroom_3", 1, 0) +h2UpstairsBedrooms(3) = newFCN("bedroom_4", 1, 0) + +Dim h2GroundfloorLivingRooms(3) As FCNode Ptr +h2GroundfloorLivingRooms(0) = newFCN("lounge", 1, 0) +h2GroundfloorLivingRooms(1) = newFCN("dining_room", 1, 0) +h2GroundfloorLivingRooms(2) = newFCN("conservatory", 1, 0) +h2GroundfloorLivingRooms(3) = newFCN("playroom", 1, 0) + +Dim cleaning As FCNode Ptr = newFCN("cleaning", 1, 0) + +house1(1)->addChildren(h1Bathrooms()) +house1(4)->addChildren(h1LivingRooms()) +houses(0)->addChildren(house1()) + +h2Upstairs(0)->addChildren(h2UpstairsBedrooms()) +house2(0)->addChildren(h2Upstairs()) +h2Groundfloor(1)->addChildren(h2GroundfloorLivingRooms()) +house2(1)->addChildren(h2Groundfloor()) +house2(2)->addChildren(h2Basement()) +houses(1)->addChildren(house2()) + +cleaning->addChildren(houses()) +Dim As Double topCoverage = cleaning->coverage +Print "TOP COVERAGE = "; +Print Using "########.######"; topCoverage +Print +Print "NAME HIERARCHY | WEIGHT | COVERAGE |" +cleaning->show(0) + +h2Basement(2)->setCoverage(1) ' change Cinema node coverage to 1 +Dim As Double diff = cleaning->coverage - topCoverage +Print +Print "If the coverage of the Cinema node were increased from 0.75 to 1" +Print "the top level coverage would increase by "; +Print Using "##.###### to ##.######"; diff; (topCoverage + diff) +h2Basement(2)->setCoverage(0.75) ' restore to original value if required + +Sleep diff --git a/Task/Functional-coverage-tree/Java/functional-coverage-tree.java b/Task/Functional-coverage-tree/Java/functional-coverage-tree.java index df0fd64987..703ad2b3f5 100644 --- a/Task/Functional-coverage-tree/Java/functional-coverage-tree.java +++ b/Task/Functional-coverage-tree/Java/functional-coverage-tree.java @@ -1,5 +1,4 @@ import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public final class FunctionalCoverageTree { @@ -7,12 +6,12 @@ public final class FunctionalCoverageTree { public static void main(String[] aArgs) { FCNode cleaning = new FCNode("Cleaning", 1, 0.0); - List houses = Arrays.asList( + List houses = List.of( new FCNode("House_1", 40, 0.0), new FCNode("House_2", 60, 0.0) ); cleaning.addChildren(houses); - List house_1 = Arrays.asList( + List house_1 = List.of( new FCNode("Bedrooms", 1, 0.25), new FCNode("Bathrooms", 1, 0.0), new FCNode("Attic", 1, 0.75), @@ -23,33 +22,33 @@ public final class FunctionalCoverageTree { new FCNode("Garden",1, 0.8) ); houses.get(0).addChildren(house_1); - List bathrooms_house_1 = Arrays.asList( + List bathrooms_house_1 = List.of( new FCNode("Bathroom_1", 1, 0.5), new FCNode("Bathroom_2", 1, 0.0), new FCNode("Outside_lavatory", 1, 1.0) ); house_1.get(1).addChildren(bathrooms_house_1); - List living_rooms_house_1 = Arrays.asList( + List living_rooms_house_1 = List.of( new FCNode("lounge", 1, 0.0), new FCNode("Dining_room", 1, 0.0), new FCNode("Conservatory", 1, 0.0), new FCNode("Playroom", 1, 1.0) ); house_1.get(4).addChildren(living_rooms_house_1); - List house_2 = Arrays.asList( + List house_2 = List.of( new FCNode("Upstairs", 1, 0.15), new FCNode("Ground_floor", 1, 0.316667), new FCNode("Basement", 1, 0.916667)); houses.get(1).addChildren(house_2); - List upstairs = Arrays.asList( + List upstairs = List.of( new FCNode("Bedrooms", 1, 0.0), new FCNode("Bathroom", 1, 0.0), new FCNode("Toilet", 1, 0.0), new FCNode("Attics", 1, 0.6) ); house_2.get(0).addChildren(upstairs); - List ground_floor = Arrays.asList( + List ground_floor = List.of( new FCNode("Kitchen", 1, 0.0), new FCNode("Living_rooms", 1, 0.0), new FCNode("Wet_room_&_toilet", 1, 0.0), @@ -58,20 +57,20 @@ public final class FunctionalCoverageTree { new FCNode("Hot_tub_suite", 1, 1.0) ); house_2.get(1).addChildren(ground_floor); - List basement = Arrays.asList( + List basement = List.of( new FCNode("Cellars", 1, 1.0), new FCNode("Wine_cellar", 1, 1.0), new FCNode("Cinema", 1, 0.75) ); house_2.get(2).addChildren(basement); - List bedrooms = Arrays.asList( + List bedrooms = List.of( new FCNode("Suite_1", 1, 0.0), new FCNode("Suite_2", 1, 0.0), new FCNode("Bedroom_3",1, 0.0), new FCNode("Bedroom_4",1, 0.0) ); upstairs.get(0).addChildren(bedrooms); - List living_rooms_house_2 = Arrays.asList( + List living_rooms_house_2 = List.of( new FCNode("lounge", 1, 0.0), new FCNode("Dining_room", 1, 0.0), new FCNode("Conservatory", 1, 0.0), @@ -79,7 +78,8 @@ public final class FunctionalCoverageTree { ground_floor.get(1).addChildren(living_rooms_house_2); final double overallCoverage = cleaning.getCoverage(); - System.out.println("OVERALL COVERAGE = " + String.format("%.6f", overallCoverage) + System.lineSeparator()); + System.out.println("OVERALL COVERAGE = " + String.format("%.6f", overallCoverage)); + System.out.println(); System.out.println("NAME HIERARCHY | WEIGHT | COVERAGE |" ); System.out.println("--------------------------------|--------|----------|"); cleaning.display(); @@ -130,14 +130,14 @@ final class FCNode { } private void updateCoverage() { - double value1 = 0.0; - int value2 = 0; + double sumWeightedCoverage = 0.0; + int sumWeight = 0; for ( FCNode node : children ) { - value1 += node.weight * node.coverage; - value2 += node.weight; + sumWeightedCoverage += node.weight * node.coverage; + sumWeight += node.weight; } - setCoverage(value1 / value2); + setCoverage(sumWeightedCoverage / sumWeight); } private void display(int aLevel) { diff --git a/Task/Functional-coverage-tree/Julia/functional-coverage-tree.julia b/Task/Functional-coverage-tree/Julia/functional-coverage-tree.jl similarity index 100% rename from Task/Functional-coverage-tree/Julia/functional-coverage-tree.julia rename to Task/Functional-coverage-tree/Julia/functional-coverage-tree.jl diff --git a/Task/Functional-coverage-tree/Kotlin/functional-coverage-tree.kotlin b/Task/Functional-coverage-tree/Kotlin/functional-coverage-tree.kts similarity index 100% rename from Task/Functional-coverage-tree/Kotlin/functional-coverage-tree.kotlin rename to Task/Functional-coverage-tree/Kotlin/functional-coverage-tree.kts diff --git a/Task/Functional-coverage-tree/Phix/functional-coverage-tree.phix b/Task/Functional-coverage-tree/Phix/functional-coverage-tree.phix index 7f57dc15f2..da5f44351a 100644 --- a/Task/Functional-coverage-tree/Phix/functional-coverage-tree.phix +++ b/Task/Functional-coverage-tree/Phix/functional-coverage-tree.phix @@ -1,113 +1,108 @@ -(phixonline)--> - -- - -- demo\rosetta\Functional_coverage_tree.exw - -- ========================================= - -- - with javascript_semantics - constant data = """ - NAME_HIERARCHY | WEIGHT | COVERAGE | - cleaning | | | - house1 |40 | | - bedrooms | |0.25 | - bathrooms | | | - bathroom1 | |0.5 | - bathroom2 | | | - outside_lavatory | |1 | - attic | |0.75 | - kitchen | |0.1 | - living_rooms | | | - lounge | | | - dining_room | | | - conservatory | | | - playroom | |1 | - basement | | | - garage | | | - garden | |0.8 | - house2 |60 | | - upstairs | | | - bedrooms | | | - suite_1 | | | - suite_2 | | | - bedroom_3 | | | - bedroom_4 | | | - bathroom | | | - toilet | | | - attics | |0.6 | - groundfloor | | | - kitchen | | | - living_rooms | | | - lounge | | | - dining_room | | | - conservatory | | | - playroom | | | - wet_room_&_toilet | | | - garage | | | - garden | |0.9 | - hot_tub_suite | |1 | - basement | | | - cellars | |1 | - wine_cellar | |1 | - cinema | |0.75 | - """ - sequence lines = split(data,"\n"), - pi = {}, -- indents (to locate parents) - pdx = {}, -- indexes for "" - children - string desc, weights, covers - integer parent, child - atom weight, coverage, childw = 0 - enum DESC, WEIGHT, COVERAGE, PARENT, CHILDREN, CHILDW - lines[1] &= " SHARE OF RESIDUE" - for i=2 to length(lines) do - -- decode text to useable data, link up parents & children - {desc,weights,covers} = split(lines[i],"|") - -- (nb this assumes /totally/ consistent indenting) - integer indent = length(desc)-length(trim_head(desc)), - k = find(indent,pi) - if k=0 then - pi = append(pi,indent) - pdx = append(pdx,0) - k = length(pi) - end if - pdx[k] = i - parent = 0 - if k>1 then - parent = pdx[k-1] - -- lines[parent][CHILDREN] &= i - lines[parent][CHILDREN] = deep_copy(lines[parent][CHILDREN]) & i - end if - children = {} - weight = to_number(trim(weights),1) - coverage = to_number(trim(covers),0) - lines[i] = {desc, weight, coverage, parent, children, childw} - end for - for i=length(lines) to 2 by -1 do - -- calculate the parent coverages, and save child weight sums - children = lines[i][CHILDREN] - if length(children) then - coverage = 0 - childw = 0 - for c=1 to length(children) do - child = children[c] - atom w = lines[child][WEIGHT] - coverage += lines[child][COVERAGE]*w - childw += w - end for - lines[i][COVERAGE] = coverage/childw - lines[i][CHILDW] = childw -- (save for next loop) - end if - end for - for i=length(lines) to 2 by -1 do - -- calculate the share of residue, and format lines - child = i - {desc, weight, coverage, parent} = lines[i] - atom residue = 1-coverage - while parent do - residue *= lines[child][WEIGHT]/lines[parent][CHILDW] - {child, parent} = {parent, lines[parent][PARENT]} - end while - lines[i] = sprintf("%-32s| %6d | %-8g | %g",{desc,weight,coverage,residue}) - end for - puts(1,join(lines,"\n")&"\n") - {} = wait_key() - - with javascript_semantics - sequence c = repeat(0,12) - function spouge_gamma(atom z) - atom accm = c[1] - if accm=0 then - accm = sqrt(2*PI) - c[1] = accm - atom k1_factrl = 1 -- (k - 1)!*(-1)^k with 0!==1 - for k=2 to 12 do - c[k] = exp(13-k)*power(13-k,k-1.5)/k1_factrl - k1_factrl *= -(k-1) - end for - end if - for k=2 to 12 do - accm += c[k]/(z+k-1) - end for - accm *= exp(-(z+12))*power(z+12,z+0.5) -- Gamma(z+1) - return accm/z - end function +with javascript_semantics +sequence c = repeat(0,12) +function spouge_gamma(atom z) + atom accm = c[1] + if accm=0 then + accm = sqrt(2*PI) + c[1] = accm + atom k1_factrl = 1 -- (k - 1)!*(-1)^k with 0!==1 + for k=2 to 12 do + c[k] = exp(13-k)*power(13-k,k-1.5)/k1_factrl + k1_factrl *= -(k-1) + end for + end if + for k=2 to 12 do + accm += c[k]/(z+k-1) + end for + accm *= exp(-(z+12))*power(z+12,z+0.5) -- Gamma(z+1) + return accm/z +end function - function taylor_gamma(atom x) - -- (good for values between 0 and 1, apparently) - constant t = { 1.00000_00000_00000_00000, - 0.57721_56649_01532_86061, - -0.65587_80715_20253_88108, - -0.04200_26350_34095_23553, - 0.16653_86113_82291_48950, - -0.04219_77345_55544_33675, - -0.00962_19715_27876_97356, - 0.00721_89432_46663_09954, - -0.00116_51675_91859_06511, - -0.00021_52416_74114_95097, - 0.00012_80502_82388_11619, - -0.00002_01348_54780_78824, - -0.00000_12504_93482_14267, - 0.00000_11330_27231_98170, - -0.00000_02056_33841_69776, - 0.00000_00061_16095_10448, - 0.00000_00050_02007_64447, - -0.00000_00011_81274_57049, - 0.00000_00001_04342_67117, - 0.00000_00000_07782_26344, - -0.00000_00000_03696_80562, - 0.00000_00000_00510_03703, - -0.00000_00000_00020_58326, - -0.00000_00000_00005_34812, - 0.00000_00000_00001_22678, - -0.00000_00000_00000_11813, - 0.00000_00000_00000_00119, - 0.00000_00000_00000_00141, - -0.00000_00000_00000_00023, - 0.00000_00000_00000_00002 } - atom y = x-1, - s = t[$] - for n=length(t)-1 to 1 by -1 do - s = s*y + t[n] - end for - return 1/s - end function +function taylor_gamma(atom x) +-- (good for values between 0 and 1, apparently) + constant t = { 1.00000_00000_00000_00000, + 0.57721_56649_01532_86061, + -0.65587_80715_20253_88108, + -0.04200_26350_34095_23553, + 0.16653_86113_82291_48950, + -0.04219_77345_55544_33675, + -0.00962_19715_27876_97356, + 0.00721_89432_46663_09954, + -0.00116_51675_91859_06511, + -0.00021_52416_74114_95097, + 0.00012_80502_82388_11619, + -0.00002_01348_54780_78824, + -0.00000_12504_93482_14267, + 0.00000_11330_27231_98170, + -0.00000_02056_33841_69776, + 0.00000_00061_16095_10448, + 0.00000_00050_02007_64447, + -0.00000_00011_81274_57049, + 0.00000_00001_04342_67117, + 0.00000_00000_07782_26344, + -0.00000_00000_03696_80562, + 0.00000_00000_00510_03703, + -0.00000_00000_00020_58326, + -0.00000_00000_00005_34812, + 0.00000_00000_00001_22678, + -0.00000_00000_00000_11813, + 0.00000_00000_00000_00119, + 0.00000_00000_00000_00141, + -0.00000_00000_00000_00023, + 0.00000_00000_00000_00002 } + atom y = x-1, + s = t[$] + for n=length(t)-1 to 1 by -1 do + s = s*y + t[n] + end for + return 1/s +end function - function lanczos_gamma(atom z) - if z<0.5 then - return PI / (sin(PI*z)*lanczos_gamma(1-z)) - end if - -- use a lanczos approximation: - atom x = 0.99999999999980993, - t = z + 6.5; - sequence p = { 676.5203681218851, - -1259.1392167224028, - 771.32342877765313, - -176.61502916214059, - 12.507343278686905, - -0.13857109526572012, - 9.9843695780195716e-6, - 1.5056327351493116e-7 } - z -= 1 - for i=1 to length(p) do - x += p[i] / (z + i) - end for - return sqrt(2*PI) * power(t,z+0.5) * exp(-t) * x - end function +function lanczos_gamma(atom z) + if z<0.5 then + return PI / (sin(PI*z)*lanczos_gamma(1-z)) + end if + -- use a lanczos approximation: + atom x = 0.99999999999980993, + t = z + 6.5; + sequence p = { 676.5203681218851, + -1259.1392167224028, + 771.32342877765313, + -176.61502916214059, + 12.507343278686905, + -0.13857109526572012, + 9.9843695780195716e-6, + 1.5056327351493116e-7 } + z -= 1 + for i=1 to length(p) do + x += p[i] / (z + i) + end for + return sqrt(2*PI) * power(t,z+0.5) * exp(-t) * x +end function - constant sqPI = sqrt(PI) +constant sqPI = sqrt(PI) - procedure sq(sequence zm, string fmt="%19.16f") - atom {z, mul} = zm - atom e = sqPI/mul - sequence s = {spouge_gamma(z), - taylor_gamma(z), - lanczos_gamma(z)}, - error = sq_abs(sq_sub(s,e)) - string t = join(s,", ",fmt:=fmt)&", " - integer bdx = smallest(error,return_index:=true) - atom best = s[bdx], - p = s[bdx]*mul - for i=1 to length(s) do -- (potentially mark >1) - if s[i]=best then - t[i*22-2..i*22-1] = "*," - end if - end for - string es = sprintf(fmt,e) - printf(1,"%5g: %s %s, %19.16f\n",{z,t,es,p*p}) - end procedure +procedure sq(sequence zm, string fmt="%19.16f") + atom {z, mul} = zm + atom e = sqPI/mul + sequence s = {spouge_gamma(z), + taylor_gamma(z), + lanczos_gamma(z)}, + error = sq_abs(sq_sub(s,e)) + string t = join(s,", ",fmt:=fmt)&", " + integer bdx = smallest(error,return_index:=true) + atom best = s[bdx], + p = s[bdx]*mul + for i=1 to length(s) do -- (potentially mark >1) + if s[i]=best then + t[i*22-2..i*22-1] = "*," + end if + end for + string es = sprintf(fmt,e) + printf(1,"%5g: %s %s, %19.16f\n",{z,t,es,p*p}) +end procedure - printf(1," z ------ spouge ----- ----- taylor ------ ----- lanczos ----- ---- expected ----- %19.16f\n",PI) - papply({{-3/2,3/4},{-1/2,-1/2},{1/2,1},{1,sqPI},{3/2,2},{2,sqPI},{5/2,4/3},{3,sqPI/2},{7/2,8/15},{4,sqPI/6}},sq) - sq({0.001,sqPI/999.4237725},"%19.15f") - sq({0.01,sqPI/99.43258512},"%19.16f") - sq({0.1,sqPI/9.513507699},"%19.16f") - sq({10,sqPI/362880},"%19.12f") - sq({100,sqPI/9.332621544e155},"%19.13g") - if machine_bits()=64 then - sq({150,sqPI/3.808922638e260},"%19.13g") -- (fatal power overflow error on 32 bits) - end if - - without javascript_semantics -- (no mpfr_exp(), mpfr_gamma() in pwa/p2js) - constant dp = 30 - string fmt = "%5s: %33s, %33s, %32s\n" - requires("1.0.2") -- (mpfr_get_fixed(maxlen), mpfr_gamma) - include mpfr.e - mpfr_set_default_precision(-87) -- 87 decimal places. - sequence mc = mpfr_inits(40) +without javascript_semantics -- (no mpfr_exp(), mpfr_gamma() in pwa/p2js) +constant dp = 30 +string fmt = "%5s: %33s, %33s, %32s\n" +requires("1.0.2") -- (mpfr_get_fixed(maxlen), mpfr_gamma) +include mpfr.e +mpfr_set_default_precision(-87) -- 87 decimal places. +sequence mc = mpfr_inits(40) - function mpfr_spouge_gamma(mpfr z) - mpfr accm = mc[1] - if mpfr_cmp_si(accm,0)=0 then - -- mc[1] := sqrt(2*PI) - mpfr_const_pi(accm) - mpfr_mul_si(accm,accm,2) - mpfr_sqrt(accm,accm) - -- k1_factrl = (k - 1)!*(-1)^k with 0!==1 - mpfr k1_factrl = mpfr_init(1), - tmk = mpfr_init(), - p = mpfr_init() - for k=2 to length(mc) do - -- mc[k] = exp(13-k)*power(13-k,k-1.5)/k1_factrl - mpfr_set_si(tmk,length(mc)+1-k) - mpfr_exp(mc[k],tmk) - mpfr_set_d(p,k-1.5) - mpfr_pow(p,tmk,p) - mpfr_div(p,p,k1_factrl) - mpfr_mul(mc[k],mc[k],p) - -- k1_factrl *= -(k-1) - mpfr_mul_si(k1_factrl,k1_factrl,-(k-1)) - end for - end if - accm = mpfr_init_set(accm) - for k=2 to length(mc) do - -- accm += mc[k]/(z+k-1) - mpfr ck = mpfr_init_set(mc[k]), - zk = mpfr_init_set(z) - mpfr_add_si(zk,zk,k-1) - mpfr_div(ck,ck,zk) - mpfr_add(accm,accm,ck) - end for - -- atom zc = z+length(mc) - -- accm *= exp(-zc)*power(zc,z+0.5) -- Gamma(z+1) - mpfr p = mpfr_init_set(z), - ez = mpfr_init(), - zh = mpfr_init(0.5) - mpfr_add_si(p,p,length(mc)) - mpfr_neg(ez,p) - mpfr_exp(ez,ez) - mpfr_add(zh,zh,z) - mpfr_pow(p,p,zh) - mpfr_mul(accm,accm,ez) - mpfr_mul(accm,accm,p) - -- return accm/z - mpfr_div(accm,accm,z) - return accm - end function +function mpfr_spouge_gamma(mpfr z) + mpfr accm = mc[1] + if mpfr_cmp_si(accm,0)=0 then + -- mc[1] := sqrt(2*PI) + mpfr_const_pi(accm) + mpfr_mul_si(accm,accm,2) + mpfr_sqrt(accm,accm) + -- k1_factrl = (k - 1)!*(-1)^k with 0!==1 + mpfr k1_factrl = mpfr_init(1), + tmk = mpfr_init(), + p = mpfr_init() + for k=2 to length(mc) do + -- mc[k] = exp(13-k)*power(13-k,k-1.5)/k1_factrl + mpfr_set_si(tmk,length(mc)+1-k) + mpfr_exp(mc[k],tmk) + mpfr_set_d(p,k-1.5) + mpfr_pow(p,tmk,p) + mpfr_div(p,p,k1_factrl) + mpfr_mul(mc[k],mc[k],p) + -- k1_factrl *= -(k-1) + mpfr_mul_si(k1_factrl,k1_factrl,-(k-1)) + end for + end if + accm = mpfr_init_set(accm) + for k=2 to length(mc) do + -- accm += mc[k]/(z+k-1) + mpfr ck = mpfr_init_set(mc[k]), + zk = mpfr_init_set(z) + mpfr_add_si(zk,zk,k-1) + mpfr_div(ck,ck,zk) + mpfr_add(accm,accm,ck) + end for + -- atom zc = z+length(mc) + -- accm *= exp(-zc)*power(zc,z+0.5) -- Gamma(z+1) + mpfr p = mpfr_init_set(z), + ez = mpfr_init(), + zh = mpfr_init(0.5) + mpfr_add_si(p,p,length(mc)) + mpfr_neg(ez,p) + mpfr_exp(ez,ez) + mpfr_add(zh,zh,z) + mpfr_pow(p,p,zh) + mpfr_mul(accm,accm,ez) + mpfr_mul(accm,accm,p) + -- return accm/z + mpfr_div(accm,accm,z) + return accm +end function - constant mPI = mpfr_init(), - mqPI = mpfr_init() - mpfr_const_pi(mPI) - string pistr = mpfr_get_fixed(mPI,dp) - mpfr_sqrt(mqPI,mPI) +constant mPI = mpfr_init(), + mqPI = mpfr_init() +mpfr_const_pi(mPI) +string pistr = mpfr_get_fixed(mPI,dp) +mpfr_sqrt(mqPI,mPI) - function makempfr(object x) - mpfr res - if string(x) then - x = split(x,'/') - res = mpfr_init(x[1]) - mpfr_div_si(res,res,to_integer(x[2])) - elsif sequence(x) then - {mpfr x1, object x2} = x - res = mpfr_init_set(x1) - if string(x2) then - mpfr d = mpfr_init(x2) - mpfr_div(res,res,d) - else - mpfr_div_d(res,res,x2) - end if - else - res = mpfr_init(x) - end if - return res - end function +function makempfr(object x) + mpfr res + if string(x) then + x = split(x,'/') + res = mpfr_init(x[1]) + mpfr_div_si(res,res,to_integer(x[2])) + elsif sequence(x) then + {mpfr x1, object x2} = x + res = mpfr_init_set(x1) + if string(x2) then + mpfr d = mpfr_init(x2) + mpfr_div(res,res,d) + else + mpfr_div_d(res,res,x2) + end if + else + res = mpfr_init(x) + end if + return res +end function - procedure mq(sequence zm, integer d=dp) - mpfr {z, mul} = apply(zm,makempfr) - mpfr s = mpfr_spouge_gamma(z) - string t = mpfr_get_fixed(s,d,10,maxlen:=dp+2) - mpfr e = mpfr_init() - mpfr_gamma(e,z) - mpfr p = mpfr_init_set(s) - mpfr_mul(p,p,mul) - mpfr_mul(p,p,p) - string zs = mpfr_get_fixed(z,3), - es = mpfr_get_fixed(e,d,10,maxlen:=dp+2), - ps = mpfr_get_fixed(p,dp,10) - printf(1,fmt,{zs,t,es,ps}) - end procedure +procedure mq(sequence zm, integer d=dp) + mpfr {z, mul} = apply(zm,makempfr) + mpfr s = mpfr_spouge_gamma(z) + string t = mpfr_get_fixed(s,d,10,maxlen:=dp+2) + mpfr e = mpfr_init() + mpfr_gamma(e,z) + mpfr p = mpfr_init_set(s) + mpfr_mul(p,p,mul) + mpfr_mul(p,p,p) + string zs = mpfr_get_fixed(z,3), + es = mpfr_get_fixed(e,d,10,maxlen:=dp+2), + ps = mpfr_get_fixed(p,dp,10) + printf(1,fmt,{zs,t,es,ps}) +end procedure - printf(1," z %s %s %s\n",{pad(" spouge ",dp+2,"BOTH",'-'),pad(" expected ",dp+2,"BOTH",'-'),pistr}) - papply({{-1.5,0.75},{-0.5,-0.5},{0.5,1},{1,{mqPI,1}},{1.5,2},{2,{mqPI,1}},{2.5,"4/3"},{3,{mqPI,2}},{3.5,"8/15"},{4,{mqPI,6}}},mq) - mq({"1/1000",{mqPI,"999.4237724845954661149822012996"}},28) - mq({"1/100",{mqPI,"99.43258511915060371353298887051"}},29) - mq({"1/10",{mqPI,"9.513507698668731836292487177265"}},30) - mq({10,{mqPI,362880}},25) - mq({100,{mqPI,"9.332621544394415268169923885627e155"}},0) - mq({150,{mqPI,"3.80892263763056972698595524350735e260"}},0) - - constant starts = {1e2, 1e6, 1e7, 1e9, 7123}, - counts = {30, 15, 15, 10, 25} - for i=1 to length(starts) do - integer count = counts[i], - j = starts[i], - pow = 100 - while j>=pow*10 do pow *= 10 end while - printf(1,"First %d gapful numbers starting at %,d: ", {count, j}) - while count do - integer fl = floor(j/pow)*10 + remainder(j,10) - if remainder(j,fl)==0 then - printf(1,"%d ", j) - count -= 1 - end if - j += 1 - if j>=10*pow then - pow *= 10 - end if - end while - printf(1,"\n") - end for - iterator +fcn gapfulW(start){ //--> iterator [start..].tweak( fcn(n){ if(n % (10*n.toString()[0] + n%10)) Void.Skip else n }) } diff --git a/Task/Gauss-Jordan-matrix-inversion/11l/gauss-jordan-matrix-inversion.11l b/Task/Gauss-Jordan-matrix-inversion/11l/gauss-jordan-matrix-inversion.11l index 61eb3e830c..dd47e5cdf5 100644 --- a/Task/Gauss-Jordan-matrix-inversion/11l/gauss-jordan-matrix-inversion.11l +++ b/Task/Gauss-Jordan-matrix-inversion/11l/gauss-jordan-matrix-inversion.11l @@ -43,7 +43,7 @@ F inverse(mat) L(i) 0 .< mat.len L(j) 0 .< mat.len I augmat[i][j] != Float(i == j) - X ValueError(‘matrix is singular’) + X.throw ValueError(‘matrix is singular’) result[i][j] = augmat[i][mat.len + j] R result diff --git a/Task/Gauss-Jordan-matrix-inversion/ALGOL-68/gauss-jordan-matrix-inversion.alg b/Task/Gauss-Jordan-matrix-inversion/ALGOL-68/gauss-jordan-matrix-inversion.alg index 2b79d01805..14b3603189 100644 --- a/Task/Gauss-Jordan-matrix-inversion/ALGOL-68/gauss-jordan-matrix-inversion.alg +++ b/Task/Gauss-Jordan-matrix-inversion/ALGOL-68/gauss-jordan-matrix-inversion.alg @@ -43,16 +43,17 @@ BEGIN # Gauss-Jordan matrix inversion # OD END # show #; - INT n = 4; - [ 1 : n, 1 : n ]REAL a, b, c; - a := [,]REAL( ( 2, 1, 1, 4 ) - , ( 0, -1, 0, -1 ) - , ( 1, 0, -2, 4 ) - , ( 4, 1, 2, 2 ) - ); - show( "a", a ); - b := inverse( a ); - show( "b", b ); - c := inverse( b ); - show( "c", c ) + BEGIN # test # + [ 1 : 4, 1 : 4 ]REAL a, b, c; + a := [,]REAL( ( 2, 1, 1, 4 ) + , ( 0, -1, 0, -1 ) + , ( 1, 0, -2, 4 ) + , ( 4, 1, 2, 2 ) + ); + show( "a", a ); + b := inverse( a ); + show( "b", b ); + c := inverse( b ); + show( "c", c ) + END END diff --git a/Task/Gauss-Jordan-matrix-inversion/Agena/gauss-jordan-matrix-inversion.agena b/Task/Gauss-Jordan-matrix-inversion/Agena/gauss-jordan-matrix-inversion.agena new file mode 100644 index 0000000000..34361a3d27 --- /dev/null +++ b/Task/Gauss-Jordan-matrix-inversion/Agena/gauss-jordan-matrix-inversion.agena @@ -0,0 +1,81 @@ +scope # Gauss Jordan Matrix inversion - translation of the EasyLang sample + + local proc rref( m :: sequence ) + local nrow, ncol, lead := size m, size m[1], 1; + for r to nrow do + if lead > ncol then return fi; + local i := r; + while m[i][lead] = 0 do + i +:= 1; + if i > nrow then + i, lead := r, lead + 1 + if lead > ncol then return fi + fi + od; + m[i], m[r] := m[r], m[i]; + scope + local constant mrl := m[r][lead] + for k to ncol do m[r][k] /:= mrl od + end + for i to nrow do + if i <> r then + local constant mil := m[i][lead]; + for k to ncol do + m[i][k] -:= ( mil * m[r][k] ) + od + fi + od; + lead +:= 1 + od + end + local proc inverse( mat :: sequence ) :: sequence + local inv, mln, aug := seq(), size mat, seq(); + for i to mln do + if size mat[i] <> mln then + error( "not a square matrix" ) + fi; + aug[ size aug + 1 ] := seq(); + for j to mln do aug[i][j] := mat[i][j] od; + for j from mln + 1 to 2 * mln do aug[i][j] := 0 od; + aug[i][mln + i] := 1 + od; + rref( aug ); + for i to mln do + inv[ size inv + 1 ] := seq(); + for j from mln + 1 to 2 * mln do + inv[i][ size inv[i] + 1 ] := aug[i][j] + od + od; + return inv + end + local proc integerMatrix( m :: sequence ) :: boolean + for i to size m do + for j to size m[ i ] do + if entier m[ i ][ j ] <> m[ i ][ j ] then return false fi + od + od; + return true + end + local proc printMatrix( m :: sequence ) + local allInteger := integerMatrix( m ) + for i to size m do + printf( if i = 1 then "[ [" else " [" fi ); + for j to size m[ i ] do + printf( if allInteger then " %9d" else " %9.6f" fi, m[ i ][ j ] ) + od; + printf( " ]\n" ) + od; + printf( "]\n" ) + end + local proc testInverse( m :: sequence ) + printf( "Matrix:\n" ); + printMatrix( m ); + printf( "Inverse:\n" ); + printMatrix( inverse( m ) ); + printf( "\n" ) + end + + testInverse( seq( (/ 1, 2, 3 \), (/ 4, 1, 6 \), (/ 7, 8, 9 \) ) ); + testInverse( seq( (/ 2, -1, 0 \), (/ -1, 2, -1 \), (/ 0, -1, 2 \) ) ); + testInverse( seq( (/ -1, -2, 3, 2 \), (/ -4, -1, 6, 2 \), (/ 7, -8, 9, 1 \), (/ 1, -2, 1, 3 \) ) ) +end diff --git a/Task/Gauss-Jordan-matrix-inversion/EasyLang/gauss-jordan-matrix-inversion.easy b/Task/Gauss-Jordan-matrix-inversion/EasyLang/gauss-jordan-matrix-inversion.easy new file mode 100644 index 0000000000..3027f65812 --- /dev/null +++ b/Task/Gauss-Jordan-matrix-inversion/EasyLang/gauss-jordan-matrix-inversion.easy @@ -0,0 +1,51 @@ +proc rref &m[][] . + nrow = len m[][] + ncol = len m[1][] + lead = 1 + for r to nrow + if lead > ncol : return + i = r + while m[i][lead] = 0 + i += 1 + if i > nrow + i = r + lead += 1 + if lead > ncol : return + . + . + swap m[i][] m[r][] + m = m[r][lead] + for k to ncol : m[r][k] /= m + for i to nrow + if i <> r + m = m[i][lead] + for k to ncol : m[i][k] -= m * m[r][k] + . + . + lead += 1 + . +. +proc inverse &mat[][] &inv[][] . + inv[][] = [ ] + ln = len mat[][] + for i to ln + if len mat[i][] <> ln + # not a square matrix + return + . + aug[][] &= [ ] + len aug[i][] 2 * ln + for j to ln : aug[i][j] = mat[i][j] + aug[i][ln + i] = 1 + . + rref aug[][] + for i to ln + inv[][] &= [ ] + for j = ln + 1 to 2 * ln + inv[i][] &= aug[i][j] + . + . +. +test[][] = [ [ 1 2 3 ] [ 4 1 6 ] [ 7 8 9 ] ] +inverse test[][] inv[][] +print inv[][] diff --git a/Task/Gauss-Jordan-matrix-inversion/Free-Pascal-Lazarus/gauss-jordan-matrix-inversion.pas b/Task/Gauss-Jordan-matrix-inversion/Free-Pascal-Lazarus/gauss-jordan-matrix-inversion.pas new file mode 100644 index 0000000000..59906999af --- /dev/null +++ b/Task/Gauss-Jordan-matrix-inversion/Free-Pascal-Lazarus/gauss-jordan-matrix-inversion.pas @@ -0,0 +1,120 @@ +program MatrixInverse; +{$mode ObjFPC}{$H+} + +const + MATRIX_1: array of array of Real = ((1, 2, 3), + (4, 1, 6), + (7, 8, 9)); + + MATRIX_2: array of array of Real = ((3.0, 1.0, 5.0, 9.0, 7.0), + (8.0, 2.0, 8.0, 0.0, 1.0), + (1.0, 7.0, 2.0, 0.0, 3.0), + (0.0, 1.0, 7.0, 0.0, 9.0), + (3.0, 5.0, 6.0, 1.0, 1.0)); + +type + Matrix = array of array of Real; + +function PopulateMatrix(A: Matrix; Order: Integer): Matrix; +var + i, j: Integer; +begin + SetLength(Result, Succ(Order), Succ(Order * 2)); + for i := 0 to Pred(Order) do + for j := 0 to Pred(Order) do + Result[i + 1, j + 1] := A[i, j]; +end; + +procedure PrintMatrix(const A: Matrix); +var + i, j, Order: Integer; +begin + Order := Length(A); + for i := 0 to Pred(Order) do + begin + for j := 0 to Pred(Order) do + Write(A[i, j]:8:4); + WriteLn; + end; + WriteLn; +end; + +procedure InterchangeRows(var A: Matrix; Order: Integer; Row1, Row2: Integer); +var + j: Integer; + temp: Real; +begin + for j := 1 to 2 * Order do + begin + temp := A[Row1, j]; + A[Row1, j] := A[Row2, j]; + A[Row2, j] := temp; + end; +end; + +procedure DivideRow(var A: Matrix; Order: Integer; Row: Integer; Divisor: Real); +var + j: Integer; +begin + for j := 1 to 2 * Order do + A[Row, j] := A[Row, j] / Divisor; +end; + +procedure SubtractRows(var A: Matrix; Order: Integer; Row1, Row2: Integer; Multiplier: Real); +var + j: Integer; +begin + for j := 1 to 2 * Order do + A[Row1, j] := A[Row1, j] - Multiplier * A[Row2, j]; +end; + +function GaussJordan(B: Matrix): Matrix; +var + i, j, Order: Integer; + Pivot, Multiplier: Real; + A: Matrix; +begin + Order := Length(B); + SetLength(Result, Order, Order); + A := PopulateMatrix(B, Order); + + // Create the augmented matrix + for i := 1 to Order do + for j := Order + 1 to 2 * Order do + if j = (i + Order) then + A[i, j] := 1; + + // Interchange rows if needed + for i := Order downto 2 do + if A[i - 1, 1] < A[i, 1] then + InterchangeRows(A, Order, i - 1, i); + + // Perform Gauss-Jordan elimination + for i := 1 to Order do + begin + Pivot := A[i, i]; + DivideRow(A, Order, i, Pivot); + for j := 1 to Order do + if j <> i then + begin + Multiplier := A[j, i]; + SubtractRows(A, Order, j, i, Multiplier); + end; + end; + + for i := 0 to Pred(Order) do + for j := 0 to Pred(Order) do + Result[i, j] := A[Succ(i), Succ(j) + Order]; +end; + +begin + writeln('== Original Matrix =='); + PrintMatrix(MATRIX_1); + writeln('== Inverse Matrix =='); + PrintMatrix(GaussJordan(MATRIX_1)); + + writeln('== Original Matrix =='); + PrintMatrix(MATRIX_2); + writeln('== Inverse Matrix =='); + PrintMatrix(GaussJordan(MATRIX_2)); +end. diff --git a/Task/Gauss-Jordan-matrix-inversion/JavaScript/gauss-jordan-matrix-inversion.js b/Task/Gauss-Jordan-matrix-inversion/JavaScript/gauss-jordan-matrix-inversion.js new file mode 100644 index 0000000000..854bc332e7 --- /dev/null +++ b/Task/Gauss-Jordan-matrix-inversion/JavaScript/gauss-jordan-matrix-inversion.js @@ -0,0 +1,99 @@ +// Vector and matrix types +// In JavaScript, we'll use arrays directly + +function printMatrix(matrix, title) { + console.log(title); + for (const row of matrix) { + console.log(row.map(x => x.toString().padStart(10)).join('')); + } +} + +function createIdentityMatrix(n) { + const result = Array(n).fill().map(() => Array(n).fill(0)); + for (let i = 0; i < n; i++) { + result[i][i] = 1; + } + return result; +} + +function inverse(matrix) { + const n = matrix.length; + + // Check if it's a square matrix + for (const row of matrix) { + if (row.length !== n) { + throw new Error("Not a square matrix"); + } + } + + // Create identity matrix for the result + const b = createIdentityMatrix(n); + + // Create a copy of the input matrix + const a = matrix.map(row => [...row]); + + for (let k = 0; k < n; k++) { + let iMax = 0; + let max = -1; + + for (let i = k; i < n; i++) { + const row = a[i]; + + // Compute scale factor s = max abs in row + let s = -1; + for (let j = k; j < n; j++) { + const x = Math.abs(row[j]); + if (x > s) { + s = x; + } + } + + if (s === 0) { + throw new Error("Irregular matrix"); + } + + // Scale the abs used to pick the pivot + const abs = Math.abs(row[k]) / s; + if (abs > max) { + iMax = i; + max = abs; + } + } + + // Swap rows if needed + if (k !== iMax) { + [a[k], a[iMax]] = [a[iMax], a[k]]; + [b[k], b[iMax]] = [b[iMax], b[k]]; + } + + const akk = a[k][k]; + + for (let j = 0; j < n; j++) { + a[k][j] /= akk; + b[k][j] /= akk; + } + + for (let i = 0; i < n; i++) { + if (i !== k) { + const aik = a[i][k]; + for (let j = 0; j < n; j++) { + a[i][j] -= a[k][j] * aik; + b[i][j] -= b[k][j] * aik; + } + } + } + } + + return b; +} + +function main() { + const a = [[1, 2, 3], [4, 1, 6], [7, 8, 9]]; + printMatrix(inverse(a), "Inverse of A is:\n"); + + const b = [[2, -1, 0], [-1, 2, -1], [0, -1, 2]]; + printMatrix(inverse(b), "Inverse of B is:\n"); +} + +// Run the main function +main(); diff --git a/Task/Gauss-Jordan-matrix-inversion/Julia/gauss-jordan-matrix-inversion-1.julia b/Task/Gauss-Jordan-matrix-inversion/Julia/gauss-jordan-matrix-inversion-1.jl similarity index 100% rename from Task/Gauss-Jordan-matrix-inversion/Julia/gauss-jordan-matrix-inversion-1.julia rename to Task/Gauss-Jordan-matrix-inversion/Julia/gauss-jordan-matrix-inversion-1.jl diff --git a/Task/Gauss-Jordan-matrix-inversion/Julia/gauss-jordan-matrix-inversion-2.julia b/Task/Gauss-Jordan-matrix-inversion/Julia/gauss-jordan-matrix-inversion-2.jl similarity index 100% rename from Task/Gauss-Jordan-matrix-inversion/Julia/gauss-jordan-matrix-inversion-2.julia rename to Task/Gauss-Jordan-matrix-inversion/Julia/gauss-jordan-matrix-inversion-2.jl diff --git a/Task/Gauss-Jordan-matrix-inversion/Kotlin/gauss-jordan-matrix-inversion.kotlin b/Task/Gauss-Jordan-matrix-inversion/Kotlin/gauss-jordan-matrix-inversion.kts similarity index 100% rename from Task/Gauss-Jordan-matrix-inversion/Kotlin/gauss-jordan-matrix-inversion.kotlin rename to Task/Gauss-Jordan-matrix-inversion/Kotlin/gauss-jordan-matrix-inversion.kts diff --git a/Task/Gauss-Jordan-matrix-inversion/Lua/gauss-jordan-matrix-inversion.lua b/Task/Gauss-Jordan-matrix-inversion/Lua/gauss-jordan-matrix-inversion.lua new file mode 100644 index 0000000000..6eb7628293 --- /dev/null +++ b/Task/Gauss-Jordan-matrix-inversion/Lua/gauss-jordan-matrix-inversion.lua @@ -0,0 +1,81 @@ +do -- Gauss Jordan Matrix inversion - translation of the EasyLang sample + + local function rref( m ) + local nrow, ncol, lead = # m, # m[1], 1 + for r = 1, nrow do + if lead > ncol then return end + local i = r + while m[i][lead] == 0 do + i = i + 1 + if i > nrow then + i, lead = r, lead + 1 + if lead > ncol then return end + end + end + m[i], m[r] = m[r], m[i] + do + local mrl = m[r][lead] + for k = 1, ncol do m[r][k] = m[r][k] / mrl end + end + for i = 1, nrow do + if i ~= r then + local mil = m[i][lead] + for k = 1, ncol do + m[i][k] = m[i][k] - ( mil * m[r][k] ) + end + end + end + lead = lead + 1 + end + end + local function inverse( mat ) + local inv, ln, aug = {}, # mat, {} + for i = 1, ln do + if # mat[i] ~= ln then + error( "not a square matrix" ) + end + aug[ # aug + 1 ] = {} + for j = 1, ln do aug[i][j] = mat[i][j] end + for j = ln + 1, 2 * ln do aug[i][j] = 0 end + aug[i][ln + i] = 1 + end + rref( aug ) + for i = 1, ln do + inv[ # inv + 1 ] = {} + for j = ln + 1, 2 * ln do + inv[i][ # inv[i] + 1 ] = aug[i][j] + end + end + return inv + end + local function integerMatrix( m ) + for i = 1, # m do + for j = 1, # m[ i ] do + if math.type( m[ i ][ j ] ) ~= "integer" then return false end + end + end + return true + end + local function printMatrix( m ) + local allInteger = integerMatrix( m ) + for i = 1, # m do + io.write( i == 1 and "[ [" or " [" ) + for j = 1, # m[ i ] do + io.write( string.format( ( allInteger and " %9d" or " %9.6f" ), m[ i ][ j ] ) ) + end + io.write( " ]\n" ) + end + io.write( "]\n" ) + end + local function testInverse( m ) + io.write( "Matrix:\n" ) + printMatrix( m ) + io.write( "Inverse:\n" ) + printMatrix( inverse( m ) ) + io.write( "\n" ) + end + + testInverse { { 1, 2, 3 }, { 4, 1, 6 }, { 7, 8, 9 } } + testInverse { { 2, -1, 0 }, {-1, 2, -1 }, { 0, -1, 2 } } + testInverse { { -1, -2, 3, 2 }, { -4, -1, 6, 2 }, { 7, -8, 9, 1 }, { 1, -2, 1, 3 } } +end diff --git a/Task/Gauss-Jordan-matrix-inversion/PascalABC.NET/gauss-jordan-matrix-inversion.pas b/Task/Gauss-Jordan-matrix-inversion/PascalABC.NET/gauss-jordan-matrix-inversion.pas new file mode 100644 index 0000000000..3c25363004 --- /dev/null +++ b/Task/Gauss-Jordan-matrix-inversion/PascalABC.NET/gauss-jordan-matrix-inversion.pas @@ -0,0 +1,9 @@ +uses NumLibABC; + +begin + var A := new Matrix(3,3,1,2,3,4,1,6,7,8,9); + 'Original:'.Println; + A.Println(10,5); + 'Inverse:'.Println; + A.Inv.Println(10,5); +end. diff --git a/Task/Gauss-Jordan-matrix-inversion/Perl/gauss-jordan-matrix-inversion.pl b/Task/Gauss-Jordan-matrix-inversion/Perl/gauss-jordan-matrix-inversion.pl index 5fa185e871..2102119749 100644 --- a/Task/Gauss-Jordan-matrix-inversion/Perl/gauss-jordan-matrix-inversion.pl +++ b/Task/Gauss-Jordan-matrix-inversion/Perl/gauss-jordan-matrix-inversion.pl @@ -61,5 +61,5 @@ for my $matrix (@tests) { my @gj = gauss_jordan_invert( @$matrix ); print "Gauss-Jordan Inverted Matrix:\n" . display(\@gj) . "\n"; my @rt = gauss_jordan_invert( @gj ); - print "After round-trip:\n" . display(\@rt) . "\n";} . "\n" + print "After round-trip:\n" . display(\@rt) . "\n"; } diff --git a/Task/Gauss-Jordan-matrix-inversion/Pluto/gauss-jordan-matrix-inversion.pluto b/Task/Gauss-Jordan-matrix-inversion/Pluto/gauss-jordan-matrix-inversion.pluto new file mode 100644 index 0000000000..103fcf3988 --- /dev/null +++ b/Task/Gauss-Jordan-matrix-inversion/Pluto/gauss-jordan-matrix-inversion.pluto @@ -0,0 +1,25 @@ +require "matrix" + +local arrays = { + { { 1, 2, 3 }, + { 4, 1, 6 }, + { 7, 8, 9 } }, + + { { 2, -1, 0 }, + {-1, 2, -1 }, + { 0, -1, 2 } }, + + { { -1, -2, 3, 2 }, + { -4, -1, 6, 2 }, + { 7, -8, 9, 1 }, + { 1, -2, 1, 3 } } +} + +for arrays as array do + print("Original:\n") + local m = matrix.from(array) + print(m) + print("\nInverse:\n") + print(m:inverse():format("%9.6f")) + print() +end diff --git a/Task/Gauss-Jordan-matrix-inversion/PowerShell/gauss-jordan-matrix-inversion.psh b/Task/Gauss-Jordan-matrix-inversion/PowerShell/gauss-jordan-matrix-inversion.ps1 similarity index 100% rename from Task/Gauss-Jordan-matrix-inversion/PowerShell/gauss-jordan-matrix-inversion.psh rename to Task/Gauss-Jordan-matrix-inversion/PowerShell/gauss-jordan-matrix-inversion.ps1 diff --git a/Task/Gauss-Jordan-matrix-inversion/R/gauss-jordan-matrix-inversion.r b/Task/Gauss-Jordan-matrix-inversion/R/gauss-jordan-matrix-inversion.r new file mode 100644 index 0000000000..6f636d34ed --- /dev/null +++ b/Task/Gauss-Jordan-matrix-inversion/R/gauss-jordan-matrix-inversion.r @@ -0,0 +1,91 @@ +gaussjordan <- function(A) { + # Check if matrix is square + if (nrow(A) != ncol(A)) { + stop("A must be a square matrix") + } + + n <- nrow(A) + + # Create augmented matrix [A | I] + M <- cbind(matrix(as.numeric(A), nrow = n, ncol = n), diag(n)) + + tmp <- numeric(2 * n) + i <- 1 + + # Forward elimination + while (i <= n) { + # Check if pivot is approximately zero + if (abs(M[i, i]) < 1e-10) { + j <- i + 1 + # Find non-zero pivot + while (j <= n && abs(M[j, i]) < 1e-10) { + j <- j + 1 + } + if (j <= n) { + # Swap rows + tmp <- M[i, ] + M[i, ] <- M[j, ] + M[j, ] <- tmp + } else { + stop("Matrix is singular, cannot compute the inverse") + } + } + + # Eliminate below pivot + if (i < n) { + for (j in (i + 1):n) { + M[j, ] <- M[j, ] - (M[j, i] / M[i, i]) * M[i, ] + } + } + i <- i + 1 + } + + i <- n + + # Backward elimination + while (i >= 1) { + # Check if pivot is approximately zero + if (abs(M[i, i]) < 1e-10) { + j <- i - 1 + # Find non-zero pivot + while (j >= 1 && abs(M[j, i]) < 1e-10) { + j <- j - 1 + } + if (j >= 1) { + # Swap rows + tmp <- M[i, ] + M[i, ] <- M[j, ] + M[j, ] <- tmp + } else { + stop("Matrix is singular, cannot compute the inverse") + } + } + + # Eliminate above pivot + if (i > 1) { + for (j in (i - 1):1) { + M[j, ] <- M[j, ] - (M[j, i] / M[i, i]) * M[i, ] + } + } + i <- i - 1 + } + + # Normalize by diagonal elements + M <- M / diag(M) + + # Return the inverse (right half of augmented matrix) + return(M[, (n + 1):(2 * n)]) +} + +# Test examples +# Example 1: Create a test matrix +A <- matrix(c(4, 3, 2, 1), nrow = 2, ncol = 2) +print(gaussjordan(A)) +print(solve(A)) # R's built-in inverse function + +# Example 2: Random matrix test +set.seed(123) +A <- matrix(runif(100), nrow = 10, ncol = 10) +result <- gaussjordan(A) +expected <- solve(A) +print(all.equal(result, expected)) # Should return TRUE diff --git a/Task/Gauss-Jordan-matrix-inversion/REXX/gauss-jordan-matrix-inversion-2.rexx b/Task/Gauss-Jordan-matrix-inversion/REXX/gauss-jordan-matrix-inversion-2.rexx index f2202efef4..475332d230 100644 --- a/Task/Gauss-Jordan-matrix-inversion/REXX/gauss-jordan-matrix-inversion-2.rexx +++ b/Task/Gauss-Jordan-matrix-inversion/REXX/gauss-jordan-matrix-inversion-2.rexx @@ -1,35 +1,64 @@ -/*REXX program performs a (square) matrix inversion using the Gauss─Jordan method. */ -data= 8 3 7 5 9 12 10 11 6 2 4 13 14 15 16 17 /*the matrix element values. */ -call build 4 /*assign data elements to the matrix. */ -call show '@', 'The matrix of order ' n " is:" /*display the (square) matrix. */ -call aux /*define the auxiliary (identity) array*/ -call invert /*invert the matrix, store result in X.*/ -call show 'X', "The inverted matrix is:" /*display (inverted) auxiliary matrix. */ -exit 0 /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -aux: x.= 0; do i=1 for n; x.i.i= 1; end; return -/*──────────────────────────────────────────────────────────────────────────────────────*/ -build: arg n; #=0; w=0; do r=1 for n /*read a row of the matrix.*/ - do c=1 for n; #= # + 1 /* " " col " " " */ - @.r.c= word(data, #); w= max(w, length(@.r.c) ) - end /*c*/ /*W: max width of a number*/ - end /*r*/; return -/*──────────────────────────────────────────────────────────────────────────────────────*/ -invert: do k=1 for n; t= @.k.k /*divide each matrix row by T. */ - do c=1 for n; @.k.c= @.k.c / t /*process row of original matrix.*/ - x.k.c= x.k.c / t /* " " " auxiliary " */ - end /*c*/ - do r=1 for n; if r==k then iterate /*skip if R is the same row as K.*/ - t= @.r.k - do c=1 for n; @.r.c= @.r.c - t*@.k.c /*process row of original matrix.*/ - x.r.c= x.r.c - t*x.k.c /* " " " auxiliary " */ - end /*c*/ - end /*r*/ - end /*k*/; return -/*──────────────────────────────────────────────────────────────────────────────────────*/ -show: parse arg ?, title; say; say title; f= 4 /*F: fractional digits precision.*/ - do r=1 for n; _= - do c=1 for n; if ?=='@' then _= _ right( @.r.c, w) - else _= _ right(format(x.r.c, w, f), w + f + length(.)) - end /*c*/; say _ - end /*r*/; return +/*REXX program performs a (square) matrix inversion using the Gauss-Jordan method. */ +data=8 3 7 5 9 12 10 11 6 2 4 13 14 15 16 17 /*the matrix element values. */ +Call build 4 /*assign data elements to the matrix. */ +Call show 'M','The matrix of order' n 'is:' /*display the (square) matrix. */ +Call aux /*define the auxiliary (identity) array*/ +Call invert /*invert the matrix, store result in X.*/ +Call show 'X','The inverted matrix is:' /*display inverted matrix. */ +Exit /*stick a fork in it, we're all done. */ +/*----------------------------------------------------------------------------------*/ +aux: + x.=0 + Do i=1 To n + x.i.i=1 + End + Return +/*----------------------------------------------------------------------------------*/ +build: /*set m.r.c from data */ + Arg n + k=0 + w=0 /*W: max width of a number*/ + Do r=1 To n /*loop over rows */ + Do c=1 To n /*loop over columns */ + k=k+1 + m.r.c=word(data,k) + w=max(w,length(m.r.c)) + End /*c*/ + End /*r*/ + Return +/*----------------------------------------------------------------------------------*/ +invert: + Do k=1 To n + t=m.k.k /*divide each matrix row by T */ + Do c=1 To n + m.k.c=m.k.c/t /*process row of original matrix.*/ + x.k.c=x.k.c/t /* ' ' ' auxiliary ' */ + End /*c*/ + Do r=1 To n + If r<>k Then Do /*skip if R is the same row as K.*/ + t=m.r.k + Do c=1 To n + m.r.c=m.r.c-t*m.k.c /*process row of original matrix.*/ + x.r.c=x.r.c-t*x.k.c /* ' ' ' auxiliary ' */ + End /*c*/ + End + End /*r*/ + End /*k*/ + Return +/*-----------------------------------------------------------------------------------*/ +show: + Parse Arg which,title + Say + Say title + f=4 /*F: fractional digits precision.*/ + Do r=1 To n + line='' + Do c=1 To n + If which=='M' Then + line=line right(m.r.c,w) + Else + line=line right(format(x.r.c,w,f),w+f+1) + End /*c*/ + Say line + End /*r*/ + Return diff --git a/Task/Gauss-Jordan-matrix-inversion/Rust/gauss-jordan-matrix-inversion.rust b/Task/Gauss-Jordan-matrix-inversion/Rust/gauss-jordan-matrix-inversion.rs similarity index 100% rename from Task/Gauss-Jordan-matrix-inversion/Rust/gauss-jordan-matrix-inversion.rust rename to Task/Gauss-Jordan-matrix-inversion/Rust/gauss-jordan-matrix-inversion.rs diff --git a/Task/Gauss-Jordan-matrix-inversion/VBScript/gauss-jordan-matrix-inversion.vb b/Task/Gauss-Jordan-matrix-inversion/VBScript/gauss-jordan-matrix-inversion.vbs similarity index 100% rename from Task/Gauss-Jordan-matrix-inversion/VBScript/gauss-jordan-matrix-inversion.vb rename to Task/Gauss-Jordan-matrix-inversion/VBScript/gauss-jordan-matrix-inversion.vbs diff --git a/Task/Gauss-Jordan-matrix-inversion/Wren/gauss-jordan-matrix-inversion.wren b/Task/Gauss-Jordan-matrix-inversion/Wren/gauss-jordan-matrix-inversion.wren index 93e3476431..17eee5a2d8 100644 --- a/Task/Gauss-Jordan-matrix-inversion/Wren/gauss-jordan-matrix-inversion.wren +++ b/Task/Gauss-Jordan-matrix-inversion/Wren/gauss-jordan-matrix-inversion.wren @@ -1,5 +1,5 @@ -import "/matrix" for Matrix -import "/fmt" for Fmt +import "./matrix" for Matrix +import "./fmt" for Fmt var arrays = [ [ [ 1, 2, 3], diff --git a/Task/Gaussian-elimination/Ada/gaussian-elimination.ada b/Task/Gaussian-elimination/Ada/gaussian-elimination.adb similarity index 100% rename from Task/Gaussian-elimination/Ada/gaussian-elimination.ada rename to Task/Gaussian-elimination/Ada/gaussian-elimination.adb diff --git a/Task/Gaussian-elimination/Delphi/gaussian-elimination.delphi b/Task/Gaussian-elimination/Delphi/gaussian-elimination.pas similarity index 100% rename from Task/Gaussian-elimination/Delphi/gaussian-elimination.delphi rename to Task/Gaussian-elimination/Delphi/gaussian-elimination.pas diff --git a/Task/Gaussian-elimination/EasyLang/gaussian-elimination.easy b/Task/Gaussian-elimination/EasyLang/gaussian-elimination.easy new file mode 100644 index 0000000000..84676232a4 --- /dev/null +++ b/Task/Gaussian-elimination/EasyLang/gaussian-elimination.easy @@ -0,0 +1,45 @@ +func[] gauss_elim a[][] b[] . + n = len a[][] + for i to n + maxr = i + maxv = abs a[i][i] + for j = i + 1 to n + if abs a[j][i] > maxv + maxr = j + maxv = abs a[j][i] + . + . + if maxr <> i + swap a[maxr][] a[i][] + swap b[maxr] b[i] + . + for j = i + 1 to n + fn = a[j][i] + fd = a[i][i] + for k = i to n + a[j][k] -= a[i][k] * fn / fd + . + b[j] -= b[i] * fn / fd + . + . + len x[] n + for i = n downto 1 + rhs = b[i] + for j = i + 1 to n + rhs -= a[i][j] * x[j] + . + x[i] = rhs / a[i][i] + . + return x[] +. +# --------------------- # +# 2x + 3y − z = 5 # +# x + y + z = 6 # +# -3x - 4y + 3z = -5 # +# # +# x = 5, y = -1, z = 2 # +# --------------------- # +# +a[][] = [ [ 2 3 -1 ] [ 1 1 1 ] [ -3 -4 3 ] ] +b[] = [ 5 6 -5 ] +print gauss_elim a[][] b[] diff --git a/Task/Gaussian-elimination/FutureBasic/gaussian-elimination.basic b/Task/Gaussian-elimination/FutureBasic/gaussian-elimination.basic new file mode 100644 index 0000000000..10ac8ba5c8 --- /dev/null +++ b/Task/Gaussian-elimination/FutureBasic/gaussian-elimination.basic @@ -0,0 +1,106 @@ +// +// Gaussian Elimination Estimate +// +// FutureBasic 7.0.34 August 2025 R.W +// +//-------------------------------------------------- +// +// Test data array. I wanted it to be base 1 and not zero +// hence the 99 which is just filler for the zeroeth element +// +double a(6,6) = ¬ +{99, 99, 99, 99, 99, 99, 99,¬ +99, 1.00, 0.00, 0.00, 0.00, 0.00, 0.00,¬ +99, 1.00, 0.63, 0.39, 0.25, 0.16, 0.10,¬ +99, 1.00, 1.26, 1.58, 1.98, 2.49, 3.13,¬ +99, 1.00, 1.88, 3.55, 6.70, 12.62, 23.80,¬ +99, 1.00, 2.51, 6.32, 15.88, 39.90, 100.28,¬ +99, 1.00, 3.14, 9.87, 31.01, 97.41, 306.02 } + +double b(6) = ¬ +{99,-0.01, 0.61, 0.91, 0.99, 0.60, 0.02 } + +double x(6) +double ab(6) +double ans(6),r(6),bb(6,6), f +int c, d, g, p1, p2, z +// + +int row, col +int j, k, n = 6 +// +// Pivot n times +local fn pivot(num as int) + For p1 = num to n - 1 + For p2 = p1 + 1 To n + If abs(bb(p1,num)) < abs(bb(p2,num)) + Swap r(p1),r(p2) + For g = 1 To n + Swap bb(p1,g),bb(p2,g) + Next g + End If + Next p2 + Next p1 +end fn + +// The 'Gaussian' function takes two matrices, +// 'a' and 'b', with 'a' square, and it returns +// the determinant of 'a' and a matrix 'x' +// such that a * x = b. +// If 'b' is the identity, then 'x' = inverse of 'a' + +local fn Gaussian(matrix(6,6) as double, rhs(6) as double) + + // copy matrix + for c = 1 to n + r(c) = rhs(c) + for d = 1 to n + bb(c,d) = matrix(c,d) + next d + next c + + // pivot it (hey that's what the task requires + // don't ask me why. It doesn't + // improve accuracy with these numbers) + for k = 1 to n-1 + fn pivot(k) + for row = k to n-1 + if bb(row + 1, k) == 0 then exit for + f = bb(k, k) / bb(row+1, k) + r(row + 1) = r(row + 1) * f - r(k) + For g = 1 To n + bb((row + 1), g) = bb((row + 1), g) * f - bb(k,g) + Next g + Next row + Next k + + //back substitute + For z = n to 1 step -1 + ans(z) = r(z) / bb(z,z) + For j = n to z + 1 step -1 + ans(z) = ans(z) - (bb(z,j) * ans(j) / bb(z,z)) + Next j + Next z +end fn + +window 1,@"Gaussian Elimination" + +print "TEST DATA USED" +print " ax = transpose b" +print "[1.00 |0.00 |0.00 | 0.0000 | 0.00 | 0.00] [??] [-0.01]" +print "[1.00 |0.63 |0.39 | 0.2500 | 0.16 | 0.10] [??] [ 0.61]" +print "[1.00 |1.26 |1.58 | 1.9800 | 2.49 | 3.13] x [??] = [ 0.91]" +print "[1.00 |1.88 |3.55 | 6.7000 |12.62 | 23.80] [??] [ 0.99]" +print "[1.00 |2.51 |6.32 |15.8800 |39.90 |100.28] [??] [ 0.60]" +print "[1.00 |3.14 |9.87 |31.0100 |97.41 |306.02] [??] [ 0.02]" +print + +fn Gaussian(a(0,0),b(0)) + +print "Solution:" +print "---------" +for j = 1 to 6 + print using "###.################";ans(j) +next j + +HandleEvents diff --git a/Task/Gaussian-elimination/Julia/gaussian-elimination.julia b/Task/Gaussian-elimination/Julia/gaussian-elimination.jl similarity index 100% rename from Task/Gaussian-elimination/Julia/gaussian-elimination.julia rename to Task/Gaussian-elimination/Julia/gaussian-elimination.jl diff --git a/Task/Gaussian-elimination/Kotlin/gaussian-elimination.kotlin b/Task/Gaussian-elimination/Kotlin/gaussian-elimination.kts similarity index 100% rename from Task/Gaussian-elimination/Kotlin/gaussian-elimination.kotlin rename to Task/Gaussian-elimination/Kotlin/gaussian-elimination.kts diff --git a/Task/Gaussian-elimination/OCaml/gaussian-elimination-1.ocaml b/Task/Gaussian-elimination/OCaml/gaussian-elimination-1.ml similarity index 100% rename from Task/Gaussian-elimination/OCaml/gaussian-elimination-1.ocaml rename to Task/Gaussian-elimination/OCaml/gaussian-elimination-1.ml diff --git a/Task/Gaussian-elimination/OCaml/gaussian-elimination-2.ocaml b/Task/Gaussian-elimination/OCaml/gaussian-elimination-2.ml similarity index 100% rename from Task/Gaussian-elimination/OCaml/gaussian-elimination-2.ocaml rename to Task/Gaussian-elimination/OCaml/gaussian-elimination-2.ml diff --git a/Task/Gaussian-elimination/OCaml/gaussian-elimination-3.ocaml b/Task/Gaussian-elimination/OCaml/gaussian-elimination-3.ml similarity index 100% rename from Task/Gaussian-elimination/OCaml/gaussian-elimination-3.ocaml rename to Task/Gaussian-elimination/OCaml/gaussian-elimination-3.ml diff --git a/Task/Gaussian-elimination/OCaml/gaussian-elimination-4.ocaml b/Task/Gaussian-elimination/OCaml/gaussian-elimination-4.ml similarity index 100% rename from Task/Gaussian-elimination/OCaml/gaussian-elimination-4.ocaml rename to Task/Gaussian-elimination/OCaml/gaussian-elimination-4.ml diff --git a/Task/Gaussian-elimination/OCaml/gaussian-elimination-5.ocaml b/Task/Gaussian-elimination/OCaml/gaussian-elimination-5.ml similarity index 100% rename from Task/Gaussian-elimination/OCaml/gaussian-elimination-5.ocaml rename to Task/Gaussian-elimination/OCaml/gaussian-elimination-5.ml diff --git a/Task/Gaussian-elimination/OCaml/gaussian-elimination-6.ocaml b/Task/Gaussian-elimination/OCaml/gaussian-elimination-6.ml similarity index 100% rename from Task/Gaussian-elimination/OCaml/gaussian-elimination-6.ocaml rename to Task/Gaussian-elimination/OCaml/gaussian-elimination-6.ml diff --git a/Task/Gaussian-elimination/PascalABC.NET/gaussian-elimination.pas b/Task/Gaussian-elimination/PascalABC.NET/gaussian-elimination.pas new file mode 100644 index 0000000000..e6f257930e --- /dev/null +++ b/Task/Gaussian-elimination/PascalABC.NET/gaussian-elimination.pas @@ -0,0 +1,16 @@ +uses NumLibABC; + +begin + var A := new real[6, 6] ((1.00, 0.00, 0.00, 0.00, 0.00, 0.00), + (1.00, 0.63, 0.39, 0.25, 0.16, 0.10), + (1.00, 1.26, 1.58, 1.98, 2.49, 3.13), + (1.00, 1.88, 3.55, 6.70, 12.62, 23.80), + (1.00, 2.51, 6.32, 15.88, 39.90, 100.28), + (1.00, 3.14, 9.87, 31.01, 97.41, 306.02)); + + var b := new real[6] (-0.01, 0.61, 0.91, 0.99, 0.60, 0.02); + + var oL := new Decomp(A); + oL.Solve(b); + b.Println; +end. diff --git a/Task/Gaussian-elimination/PowerShell/gaussian-elimination-1.psh b/Task/Gaussian-elimination/PowerShell/gaussian-elimination-1.ps1 similarity index 100% rename from Task/Gaussian-elimination/PowerShell/gaussian-elimination-1.psh rename to Task/Gaussian-elimination/PowerShell/gaussian-elimination-1.ps1 diff --git a/Task/Gaussian-elimination/PowerShell/gaussian-elimination-2.psh b/Task/Gaussian-elimination/PowerShell/gaussian-elimination-2.ps1 similarity index 100% rename from Task/Gaussian-elimination/PowerShell/gaussian-elimination-2.psh rename to Task/Gaussian-elimination/PowerShell/gaussian-elimination-2.ps1 diff --git a/Task/Gaussian-elimination/Rust/gaussian-elimination.rust b/Task/Gaussian-elimination/Rust/gaussian-elimination.rs similarity index 100% rename from Task/Gaussian-elimination/Rust/gaussian-elimination.rust rename to Task/Gaussian-elimination/Rust/gaussian-elimination.rs diff --git a/Task/Gaussian-elimination/Scala/gaussian-elimination.scala b/Task/Gaussian-elimination/Scala/gaussian-elimination.scala new file mode 100644 index 0000000000..ed99dd1688 --- /dev/null +++ b/Task/Gaussian-elimination/Scala/gaussian-elimination.scala @@ -0,0 +1,99 @@ +object GaussianElimination { + def solve(a: Array[Array[Double]], b: Array[Array[Double]]): Double = { + if (a == null || b == null || a.length == 0 || b.length == 0) { + throw new IllegalArgumentException("Invalid dimensions") + } + + val n = b.length + val p = b(0).length + + if (a.length != n || a(0).length != n) { + throw new IllegalArgumentException("Invalid dimensions") + } + + var det = 1.0 + + for (i <- 0 until n - 1) { + var k = i + + for (j <- i + 1 until n) { + if (Math.abs(a(j)(i)) > Math.abs(a(k)(i))) { + k = j + } + } + + if (k != i) { + det = -det + + for (j <- i until n) { + val s = a(i)(j) + a(i)(j) = a(k)(j) + a(k)(j) = s + } + + for (j <- 0 until p) { + val s = b(i)(j) + b(i)(j) = b(k)(j) + b(k)(j) = s + } + } + + for (j <- i + 1 until n) { + val s = a(j)(i) / a(i)(i) + + for (k <- i + 1 until n) { + a(j)(k) -= s * a(i)(k) + } + + for (k <- 0 until p) { + b(j)(k) -= s * b(i)(k) + } + } + } + + for (i <- n - 1 to 0 by -1) { + for (j <- i + 1 until n) { + val s = a(i)(j) + + for (k <- 0 until p) { + b(i)(k) -= s * b(j)(k) + } + } + + val s = a(i)(i) + det *= s + + for (k <- 0 until p) { + b(i)(k) /= s + } + } + + det + } + + def main(args: Array[String]): Unit = { + val a = Array( + Array(4.0, 1.0, 0.0, 0.0, 0.0), + Array(1.0, 4.0, 1.0, 0.0, 0.0), + Array(0.0, 1.0, 4.0, 1.0, 0.0), + Array(0.0, 0.0, 1.0, 4.0, 1.0), + Array(0.0, 0.0, 0.0, 1.0, 4.0) + ) + + val b = Array( + Array(1.0 / 2.0), + Array(2.0 / 3.0), + Array(3.0 / 4.0), + Array(4.0 / 5.0), + Array(5.0 / 6.0) + ) + + val x = Array(39.0 / 400.0, 11.0 / 100.0, 31.0 / 240.0, 37.0 / 300.0, 71.0 / 400.0) + + println("det: " + solve(a, b)) + + for (i <- 0 until 5) { + printf("%12.8f %12.4e\n", b(i)(0), b(i)(0) - x(i)) + } + } +} diff --git a/Task/Gaussian-elimination/VBScript/gaussian-elimination.vb b/Task/Gaussian-elimination/VBScript/gaussian-elimination.vbs similarity index 100% rename from Task/Gaussian-elimination/VBScript/gaussian-elimination.vb rename to Task/Gaussian-elimination/VBScript/gaussian-elimination.vbs diff --git a/Task/Gaussian-elimination/Wren/gaussian-elimination.wren b/Task/Gaussian-elimination/Wren/gaussian-elimination.wren index 171e9cf5cf..2567f3a1de 100644 --- a/Task/Gaussian-elimination/Wren/gaussian-elimination.wren +++ b/Task/Gaussian-elimination/Wren/gaussian-elimination.wren @@ -1,4 +1,4 @@ -import "/iterate" for Stepped +import "./iterate" for Stepped var ta = [ [1.00, 0.00, 0.00, 0.00, 0.00, 0.00], diff --git a/Task/Gaussian-elimination/XPL0/gaussian-elimination.xpl0 b/Task/Gaussian-elimination/XPL0/gaussian-elimination.xpl0 new file mode 100644 index 0000000000..d3f43119aa --- /dev/null +++ b/Task/Gaussian-elimination/XPL0/gaussian-elimination.xpl0 @@ -0,0 +1,43 @@ +proc Gauss(A, B, X, N); \Gaussian elimination returns [X] for [A]*[X] = [B] +real A, B, X; int N; \matrix, vector, output vector, number of rows +int Diag, MaxRow, Row, Col, I; +real Max, Temp; +[for Diag:= 0 to N-1 do \partial pivoting uses largest magnitude coefficient + [MaxRow:= Diag; \ to improve numerical stability + Max:= A(Diag, Diag); + for Row:= Diag+1 to N-1 do + [Temp:= abs(A(Row, Diag)); + if Temp > Max then + [MaxRow:= Row; Max:= Temp]; + ]; + Temp:= A(Diag); A(Diag):= A(MaxRow); A(MaxRow):= Temp; \swap rows + Temp:= B(Diag); B(Diag):= B(MaxRow); B(MaxRow):= Temp; + for Row:= Diag+1 to N-1 do + [Temp:= A(Row, Diag) / A(Diag, Diag); \divide by pivot element + for Col:= Diag+1 to N-1 do + A(Row, Col):= A(Row, Col) - Temp*A(Diag, Col); + A(Row, Diag):= 0.; + B(Row):= B(Row) - Temp*B(Diag); + ]; + ]; \reduced row echelon form +for Row:= N-1 downto 0 do \back substitution makes [X] + [Temp:= B(Row); + for I:= N-1 downto Row+1 do + Temp:= Temp - X(I)*A(Row, I); + X(Row):= Temp / A(Row, Row); + ]; +]; + +real A, B, X(6); +int I; +[A:= [ [1.00, 0.00, 0.00, 0.00, 0.00, 0.00], + [1.00, 0.63, 0.39, 0.25, 0.16, 0.10], + [1.00, 1.26, 1.58, 1.98, 2.49, 3.13], + [1.00, 1.88, 3.55, 6.70, 12.62, 23.80], + [1.00, 2.51, 6.32, 15.88, 39.90, 100.28], + [1.00, 3.14, 9.87, 31.01, 97.41, 306.02] ]; +B:= [-0.01, 0.61, 0.91, 0.99, 0.60, 0.02]; +Gauss(A, B, X, 6); +for I:= 0 to 6-1 do + [RlOut(0, X(I)); CrLf(0)]; +] diff --git a/Task/General-FizzBuzz/ALGOL-68/general-fizzbuzz.alg b/Task/General-FizzBuzz/ALGOL-68/general-fizzbuzz.alg index 301d6ba2ca..046fa5220b 100644 --- a/Task/General-FizzBuzz/ALGOL-68/general-fizzbuzz.alg +++ b/Task/General-FizzBuzz/ALGOL-68/general-fizzbuzz.alg @@ -1,25 +1,25 @@ BEGIN # generalised FizzBuzz # # prompts for an integer, reads it and returns it # - PROC read integer = ( STRING prompt )INT: + PROC read an integer = ( STRING prompt )INT: BEGIN print( ( prompt ) ); INT result; read( ( result, newline ) ); result - END; # read integer # + END; # read an integer # # prompts for a string, reads it and returns it # - PROC read string = ( STRING prompt )STRING: + PROC read a string = ( STRING prompt )STRING: BEGIN print( ( prompt ) ); STRING result; read( ( result, newline ) ); result - END; # read string # + END; # read a string # # mode to hold a factor and associated text # MODE FBFACTOR = STRUCT( INT factor, STRING text ); #===============================================================# - # quicksort routine for the factors, from the Algol 68 uicksort # - # task sample # + # quicksort routine for the factors # + # - from the Algol 68 task sample # #---------------------------------------------------------------# #--- Swap function ---# PROC swap = (REF[]FBFACTOR array, INT first, INT second) VOID: @@ -51,14 +51,14 @@ BEGIN # generalised FizzBuzz # OP > = ( FBFACTOR a, b )BOOL: factor OF a > factor OF b; #===============================================================# # get the maximum number to consider # - INT max number = read integer( "Numbers reuired: " ); - # number of factors reuired # + INT max number = read an integer( "Numbers required: " ); + # number of factors required # INT max factor = 3; # get the factors and associated words # [ max factor ]FBFACTOR factors; FOR i TO max factor DO - factor OF factors[ i ] := read integer( "Factor " + whole( i, 0 ) + ": " ); - text OF factors [ i ] := read string( "Text for " + whole( factor OF factors[ i ], 0 ) + ": " ) + factor OF factors[ i ] := read an integer( "Factor " + whole( i, 0 ) + ": " ); + text OF factors [ i ] := read a string( "Text for " + whole( factor OF factors[ i ], 0 ) + ": " ) OD; # sort the factors into order # quick( factors, 1, UPB factors ); diff --git a/Task/General-FizzBuzz/Ada/general-fizzbuzz.ada b/Task/General-FizzBuzz/Ada/general-fizzbuzz.adb similarity index 100% rename from Task/General-FizzBuzz/Ada/general-fizzbuzz.ada rename to Task/General-FizzBuzz/Ada/general-fizzbuzz.adb diff --git a/Task/General-FizzBuzz/Crystal/general-fizzbuzz.cr b/Task/General-FizzBuzz/Crystal/general-fizzbuzz.cr new file mode 100644 index 0000000000..1af7cfbec8 --- /dev/null +++ b/Task/General-FizzBuzz/Crystal/general-fizzbuzz.cr @@ -0,0 +1,12 @@ +def fizz_buzz_plus (factorwords, limit) + factorwords = factorwords.sort_by { |f, w| f } + (1..limit).each do |n| + shout = "" + factorwords.each do |factor, word| + shout += word if n % factor == 0 + end + puts (shout == "" ? n : shout) + end +end + +fizz_buzz_plus [{3, "Fizz"}, {5, "Buzz"}, {7, "Baxx"}], 20 diff --git a/Task/General-FizzBuzz/Crystal/general-fizzbuzz.crystal b/Task/General-FizzBuzz/Crystal/general-fizzbuzz.crystal deleted file mode 100644 index e74a7afc6f..0000000000 --- a/Task/General-FizzBuzz/Crystal/general-fizzbuzz.crystal +++ /dev/null @@ -1,50 +0,0 @@ -counter = 0 - -puts "Enter a maximum number:" -limit = gets - -puts "Enter the first integer for factoring:" -first_int = gets -puts "Enter the name of the first integer:" -first_int_name = gets - -puts "Enter the second integer for factoring:" -second_int = gets -puts "Enter the name of the second integer:" -second_int_name = gets - -puts "Enter the third integer for factoring:" -third_int = gets -puts "Enter the name of the third integer:" -third_int_name = gets - -if (limit && - first_int && - second_int && - third_int && - first_int_name && - second_int_name && - third_int_name) - limit = limit.chomp.to_i - first_int = first_int.chomp.to_i - second_int = second_int.chomp.to_i - third_int = third_int.chomp.to_i - while limit > counter - counter += 1 - if (counter % first_int) == 0 && (counter % second_int) == 0 && (counter % third_int) == 0 - puts first_int_name + second_int_name + third_int_name - elsif (counter % first_int) == 0 && (counter % second_int) == 0 - puts first_int_name + second_int_name - elsif (counter % first_int) == 0 - puts first_int_name - elsif (counter % second_int) == 0 - puts second_int_name - elsif (counter % third_int) == 0 - puts third_int_name - else - puts counter - end - end -else - exit -end diff --git a/Task/General-FizzBuzz/EasyLang/general-fizzbuzz.easy b/Task/General-FizzBuzz/EasyLang/general-fizzbuzz.easy new file mode 100644 index 0000000000..5de17848ab --- /dev/null +++ b/Task/General-FizzBuzz/EasyLang/general-fizzbuzz.easy @@ -0,0 +1,17 @@ +max = 20 +words$[] = [ "Fizz" "Buzz" "Baxx" ] +keys[] = [ 3 5 7 ] +# +for n = 1 to max + prnt = 1 + for j = 1 to len keys[] + if n mod keys[j] = 0 + write words$[j] + prnt = 0 + . + . + if prnt = 1 + write n + . + print "" +. diff --git a/Task/General-FizzBuzz/Elixir/general-fizzbuzz.elixir b/Task/General-FizzBuzz/Elixir/general-fizzbuzz.ex similarity index 100% rename from Task/General-FizzBuzz/Elixir/general-fizzbuzz.elixir rename to Task/General-FizzBuzz/Elixir/general-fizzbuzz.ex diff --git a/Task/General-FizzBuzz/Icon/general-fizzbuzz.icon b/Task/General-FizzBuzz/Icon/general-fizzbuzz.icon new file mode 100644 index 0000000000..8122a68d0c --- /dev/null +++ b/Task/General-FizzBuzz/Icon/general-fizzbuzz.icon @@ -0,0 +1,16 @@ +link factors + +procedure main(A) + /A := [20,3,"Fizz",5,"Buzz",7,"Baxx"] + mtable := table() + limit := get(A) + while *A > 0 do mtable[integer(get(A))] := get(A) + mlist := sort([: key(mtable) :]) + + every i := 1 to limit do write((""~== fizzbuzz(i,mlist,mtable))|i) +end + +procedure fizzbuzz(n,a,t) + every (s := "", n%(f := !a) = 0) do s ||:= t[f] + return s +end diff --git a/Task/General-FizzBuzz/Julia/general-fizzbuzz.julia b/Task/General-FizzBuzz/Julia/general-fizzbuzz.jl similarity index 100% rename from Task/General-FizzBuzz/Julia/general-fizzbuzz.julia rename to Task/General-FizzBuzz/Julia/general-fizzbuzz.jl diff --git a/Task/General-FizzBuzz/Kotlin/general-fizzbuzz.kotlin b/Task/General-FizzBuzz/Kotlin/general-fizzbuzz.kts similarity index 100% rename from Task/General-FizzBuzz/Kotlin/general-fizzbuzz.kotlin rename to Task/General-FizzBuzz/Kotlin/general-fizzbuzz.kts diff --git a/Task/General-FizzBuzz/Maxima/general-fizzbuzz.maxima b/Task/General-FizzBuzz/Maxima/general-fizzbuzz.maxima new file mode 100644 index 0000000000..061ce84551 --- /dev/null +++ b/Task/General-FizzBuzz/Maxima/general-fizzbuzz.maxima @@ -0,0 +1,18 @@ +srep(n, s) := block( + l: charlist(s), + lrep: map(lambda([c], smake(n, c)), l), + apply(sconcat, lrep) +)$ + +srep_zip(nums, strings) := block( + len: min(length(nums), length(strings)), + makelist(srep(nums[i], strings[i]), i, 1, len) +)$ + +genfizzbuzz(factors, words, n1, n2) := for i from n1 thru n2 do( + flags: map(lambda([k], charfun(mod(i, k)=0)), factors), + if member(1, flags) then sprint(apply(sconcat, srep_zip(flags, words))) else sprint(i), + if mod(i-n1+1, 10)=0 then newline() +)$ + +genfizzbuzz([3, 5, 7], ["Fizz", "Buzz", "Baxx"], 1, 105); diff --git a/Task/General-FizzBuzz/OCaml/general-fizzbuzz.ocaml b/Task/General-FizzBuzz/OCaml/general-fizzbuzz.ml similarity index 100% rename from Task/General-FizzBuzz/OCaml/general-fizzbuzz.ocaml rename to Task/General-FizzBuzz/OCaml/general-fizzbuzz.ml diff --git a/Task/General-FizzBuzz/PascalABC.NET/general-fizzbuzz.pas b/Task/General-FizzBuzz/PascalABC.NET/general-fizzbuzz.pas new file mode 100644 index 0000000000..dc3d777a26 --- /dev/null +++ b/Task/General-FizzBuzz/PascalABC.NET/general-fizzbuzz.pas @@ -0,0 +1,14 @@ +## +for var i:=1 to 20 do +begin + var s := ''; + if i mod 3 = 0 then + s += 'Fizz'; + if i mod 5 = 0 then + s += 'Buzz'; + if i mod 7 = 0 then + s += 'Baxx'; + if s = '' then + Println(i) + else Println(s); +end diff --git a/Task/General-FizzBuzz/Phix/general-fizzbuzz.phix b/Task/General-FizzBuzz/Phix/general-fizzbuzz.phix index 5ac2a4ea5e..5eb2ca375f 100644 --- a/Task/General-FizzBuzz/Phix/general-fizzbuzz.phix +++ b/Task/General-FizzBuzz/Phix/general-fizzbuzz.phix @@ -1,17 +1,17 @@ ---> - procedure general_fizz_buzz(integer lim, sequence words, facts) - for i=1 to lim do - string word = "" - for j=1 to length(facts) do - if remainder(i,facts[j])=0 then - word &= words[j] - end if - end for - if length(word)=0 then - word = sprintf("%d",i) - end if - printf(1,"%s\n",{word}) - end for - end procedure - general_fizz_buzz(20, {"Fizz","Buzz","Baxx"}, {3,5,7}) - - -- - -- demo\rosetta\Generator_Exponential.exw - -- ====================================== - -- - without js -- tasks - bool terminate = false +-- demo\rosetta\Generator_Exponential.exw +without js -- tasks - atom res +atom res +bool terminate = false - procedure powers(integer p) - integer i=0 - while not terminate do - res = power(i,p) - task_suspend(task_self()) - task_yield() - i += 1 - end while - end procedure +procedure powers(integer p) + integer i = 0 + while not terminate do + res = power(i,p) + task_suspend(task_self()) + task_yield() + i += 1 + end while +end procedure - constant squares = task_create(powers,{2}), - cubes = task_create(powers,{3}) +constant squares = task_create(powers,{2}), + cubes = task_create(powers,{3}) - atom square, cube - task_schedule(cubes,1) - task_yield() - cube = res - for i=1 to 30 do - while 1 do - task_schedule(squares,1) - task_yield() - square = res - while cube<square do - task_schedule(cubes,1) - task_yield() - cube = res - end while - if square!=cube then exit end if - end while - if i>20 then - ?square - end if - end for - - terminate = 1 - {} = wait_key() - Get the size of the Main Screen. <--- + CGRect mainScreenFrame = fn ScreenMainFrame + float msh = mainScreenFrame.size.height + CGRect r = fn CGRectMake( 0, 0, 600, int(msh) - 110) + + window 1, @"Go Fish", r + windowcenter(1) + WindowSetBackgroundColor(1,fn ColorBlack) + +end fn + +//--- Start --- + +fn BuildWindow + +fn Intro + +fn InitCards + +str255 AddTheS +bool RequestCard = _false +short v = 0 +short po = 0 +boolean ShowHand = _false +str255 WantsCard + +"Main" + +ShowHand = _false + +str255 RequestedCard + +While ShowHand = _false + text ,,fn colorGreen + Print Chr$(10) + "Points >> "; + text ,,fn colorYellow + print YourName + ": "; + text ,,fn colorGreen + print Points(0); + text ,,fn colorOrange + print " CPU: "; + text ,,fn colorGreen + print Points(1) + text ,,fn colorWhite + Print Chr$(10) + " " + str$(RemainingCards) + " remaining cards" + text ,,fn colorWhite + + + /* + // Uncomment this to see the CPUs cards For testing + Print Chr$(10) + "CPU Cards: "; + For i = 1 To 13 + if Computer(i) <> 0 + For j = 1 To Computer(i) + if Mid$(cards,i,1) = "0" + Print @"10"; " "; + else + Print Mid$(cards,i,1); " "; + end if + Next j + End If + Next i + Print + fn PrintViewScrollToBottom( fn WindowPrintView(1)) + */ + + + Print Chr$(10) + "Your Cards: "; + For i = 1 To 13 + if play(i) <> 0 + For j = 1 To play(i) + if Mid$(cards,i,1) = "0" + Print @"10"; " "; + else + Print Mid$(cards,i,1); " "; + end if + Next j + End If + Next i + Print + fn PrintViewScrollToBottom( fn WindowPrintView(1)) + + RequestCard = _false + + While RequestCard = _false + if fn CheckForEndGame = _True then cls:fn InitCards:goto "Loop" + + Someone = YourName + + CFStringRef UserInput = 0 + "InputCard" + UserInput = input % (20, fn WhatCardInputHeight),@"What card do you want? " + if ( UserInput == NULL ) then "InputCard" // Rich added this 5/1/24 + fn CFStringGetPascalString (UserInput, @RequestedCard, 256, _kCFStringEncodingMacRoman) + if RequestedCard = "10" then RequestedCard = "0"// card zero is a 10 + text ,,fn ColorYellow + Print + + WantsCard = RequestedCard + + if WantsCard = "j" || WantsCard = "J" then WantsCard = "Jack" + if WantsCard = "q" || WantsCard = "Q" then WantsCard = "Queen" + if WantsCard = "k" || WantsCard = "K" then WantsCard = "King" + if WantsCard = "a" || WantsCard = "A" then WantsCard = "Ace" + if WantsCard = "0" then WantsCard = "10" + + print "-------------------------------------" + print + str255 AorAn + AorAn = "a" + if WantsCard = "Ace" then AorAn = "an" + print YourName + " asked For " + AorAn + " " + WantsCard + print + text ,,fn ColorWhite + + fn PrintViewScrollToBottom( fn WindowPrintView(1)) + + if RequestedCard = "X" || RequestedCard = "x" then fn QuitOrResumeAlert(@"EXIT") + + If RequestedCard <> "" Then CardNumber = Instr$(1,cards, Ucase$(RequestedCard)): RequestCard = _true + + If CardNumber = 0 + text,,fn ColorRed + Print "Sorry, that is not a valid card.": RequestCard = _false + print + fn PrintViewScrollToBottom( fn WindowPrintView(1)) + Else if play(CardNumber) = 0 Then text ,,fn colorRed: Print "You don//t have that card!": text ,,fn colorRed: RequestCard = _false + fn PrintViewScrollToBottom( fn WindowPrintView(1)) + text,,fn ColorWhite + + End If + + Wend + + guess(CardNumber) = 1 + + If Computer(CardNumber) = 0 + Print Someone + ","; + text ,,fn colorRed + Print " Go fish!" + text ,,fn colorWhite + Print Someone + " got a";: fn youGoFishing + print + fn CheckForCompletedBook + ShowHand = _true + Else + v = Computer(CardNumber) + Computer(CardNumber) = 0 + play(CardNumber) += v + if v > 1 then AddTheS = "s" else AddTheS = "" + Print Someone + " got" + str$(v) + " card" + AddTheS + fn CheckForCompletedBook + fn PrintViewScrollToBottom( fn WindowPrintView(1)) + ShowHand = _false + End If + +Wend + + + +Someone = "CPU" +For i = 1 To 13 + asked(i) = 0 +Next i + +bool CPUsTurn = _false + +While CPUsTurn = _false + if fn CheckForEndGame = _True then cls:fn InitCards:goto "Loop" + + po = 0 + For i = 1 To 13 + If (Computer(i) > 0) && (guess(i) > 0) Then poss(i) = 1: po += 1 + Next i + + short whilecounter + WhileCounter = 0 + + + If po = 0 + // this k is the go fish card. + + k = rnd(12) +1 + while Computer(k) = 0 || asked(k) + whilecounter ++ + k = rnd(12) +1 + if WhileCounter > 100 then k = 0: exit while //5/5/24 Rich added this to prevent hangs + wend + + Else + + k = rnd(12) + 1 + while poss(k) = 0 + k = rnd(12) + 1 + if WhileCounter > 100 then k = 0: exit while //5/5/24 Rich added this to prevent hangs + wend + + guess(k) = 0 + asked(k) = 1 + + end if + + + if k = 0 then "Loop" //5/5/24 Rich added this to prevent hangs + + WantsCard = fn CheckForFaceCard(k) + + if WantsCard = "j" || WantsCard = "J" then WantsCard = "Jack" + if WantsCard = "q" || WantsCard = "Q" then WantsCard = "Queen" + if WantsCard = "k" || WantsCard = "K" then WantsCard = "King" + if WantsCard = "a" || WantsCard = "A" then WantsCard = "Ace" + if WantsCard = "0" then WantsCard = "10" + + text ,,fn ColorOrange + + print "-------------------------------------" + + + + Print:Print Someone + " wants your " + wantsCard + "'s." + print + + text ,,fn ColorWhite + + asked(k) = 1 + + + If play(k) = 0 + Print Someone + ", "; + text ,,fn colorRed: Print "go fish!" + text ,,fn colorWhite:Print Someone + " got";: fn cpuGoFishing + + fn CheckCPUForCompletedBook + CPUsTurn = _true + + Else + + v = play(k) + play(k) = 0 + Computer(k) += v + if v > 1 then AddTheS = "s" else AddTheS = "" + Print Someone + " got" + str$(v) + " card" + AddTheS + fn CheckCPUForCompletedBook + CPUsTurn = _false + End If + + +Wend + +"Loop" +goto "Main" + +handleevents diff --git a/Task/Go-Fish/Rebol/go-fish.rebol b/Task/Go-Fish/Rebol/go-fish.rebol new file mode 100644 index 0000000000..c310b23444 --- /dev/null +++ b/Task/Go-Fish/Rebol/go-fish.rebol @@ -0,0 +1,217 @@ +Rebol [ + title: "Rosetta code: Go Fish" + file: %Go_fish.r3 + url: https://rosettacode.org/wiki/Go_Fish +] + +go-fish-game: function/with [ + "Play a game of Go Fish" +][ + deck: fisher-yates-shuffle copy ordered-deck + clear ai-hand clear ai-book-list clear ai-guess + clear my-hand clear my-book-list + ai-books: my-books: 0 + deal-cards/ai 9 ai-hand + deal-cards 9 my-hand + message: clear "" + draw-screen + while [ai-books + my-books < 13][ + computer-turn + if ai-books + my-books < 13 [player-turn] + ] + clear-screen + draw-screen + print "" + print as-yellow "GAME OVER" + print ["^/Computer books:" as-red pad ai-books -3 + "^/Player books:" as-green pad my-books -3] +][ + ;; Build deck + ordered-deck: [] + foreach r ranks: "A23456789TJQK" [ + foreach s "♣♦♥♠" [ + append ordered-deck ajoin [r s] + ] + ] + ;; Charsets used to filter key inputs + player-card-keys: charset join ranks "x" + player-yes-no: charset "ynx" + + ;; Game states + ai-hand: [] ai-book-list: [] ai-guess: [] + my-hand: [] my-book-list: [] + deck: [] + ai-books: my-books: 0 + + + message: "" + + ;; Shuffle function + fisher-yates-shuffle: func [list [block!] /local len j] [ + len: length? list + repeat i len [ + j: i + random (len - i) + swap at list i at list j + ] + list + ] + ;; Cards sorting + rank-modifiers: #[ + #"A" 130 #"K" 120 #"Q" 110 #"J" 100 #"T" 90 + #"9" 80 #"8" 70 #"7" 60 #"6" 50 #"5" 40 + #"4" 30 #"3" 20 #"2" 10 + ] + card-rank: func [card] [rank-modifiers/(card/1)] + sort-hand: func [hand] [ + sort/compare hand func [a b] [ + (card-rank a) < (card-rank b) + ] + ] + ;; Screen output + clear-screen: does [prin "^[[2J^[[H"] + draw-screen: does [ + clear-screen + ;; title bar + print as-yellow "==================================" + print as-yellow " G O F I S H " + print as-yellow "==================================" + print "" + ;; deck count + print ajoin [as-cyan " Deck: " length? deck " cards remaining"] + print "" + ;; books lines + print ajoin [as-red " Computer books: " pad ai-books -2 " [ " ai-book-list " ]"] + print ajoin [as-green " Your books: " pad my-books -2 " [ " my-book-list " ]"] + print as-yellow "----------------------------------" + print "" + ;; my hand + print [as-cyan "Your hand:" as-yellow sort-hand my-hand] + print "" + ;; last message + unless empty? message [ print message ] + print as-yellow "----------------------------------" + ] + status: func[txt][ + if block? txt [txt: ajoin txt] + append append message txt LF + ] + ;; Game functions + deal-cards: function [num hand /ai] [ + new: take/part deck num + unless ai [ + status ["You draw new card" if num > 1 ["s"] ": " new] + ] + append hand new + ] + find-in: func [hand kind [char!]] [ + forall hand [ + if hand/1/1 = kind [return kind] + ] + none + ] + guess-from: function [hand guessed] [ + kind: first random/only exclude hand guessed + append guessed kind + kind + ] + check-for-books: func [hand /ai /local kind n count] [ + if empty? hand [exit] + sort hand + kind: hand/1/1 n: count: 0 + while [not tail? hand][ + either kind = hand/1/1 [ + n: n + 1 + if n = 4 [ + remove/part next hand -4 + ++ count + append either ai [ai-book-list][my-book-list] kind + if tail? hand [break] + kind: hand/1/1 n: 0 + continue + ] + ][ + kind: hand/1/1 + n: 1 + ] + ++ hand + ] + either ai [ + ai-books: ai-books + count + ][ my-books: my-books + count] + if count > 0 [ + status ["New " as-green count " book" if count > 1 "s" " collected!"] + ] + count + ] + transfer-cards: func [ + ;; Move all cards of a given rank from src to trg + src [block!] trg [block!] kind [char!] + ][ + while [not tail? src] [ + either kind = src/1/1 [append trg take src][++ src] + ] + ] + computer-turn: func [/local kind a] [ + forever [ + if empty? ai-hand [ + if empty? deck [exit] + deal-cards/ai 3 ai-hand + ] + ai-guess: unique ai-guess + kind: guess-from ai-hand ai-guess + draw-screen + print as-red { -------------------^/ - COMPUTER TURN -^/ -------------------} + clear message + prin ajoin [" Do you have any " as-green kind "s? "] + a: wait-for-key/only player-yes-no + if any [none? a a = #"x"][ halt ] + either a = #"y" [ + transfer-cards my-hand ai-hand kind + status ["Computer took your " as-green kind "s!"] + check-for-books/ai ai-hand + draw-screen + ][ + status ["Go Fish! Computer draws a card."] + deal-cards/ai 1 ai-hand + check-for-books/ai ai-hand + draw-screen + exit + ] + ] + ] + + player-turn: func [/local kind n] [ + forever [ + if empty? my-hand [ + if empty? deck [exit] + deal-cards 3 my-hand + ] + draw-screen + print as-green { -------------------^/ - PLAYER TURN -^/ -------------------} + clear message + prin " Your guess: " + kind: wait-for-key/only player-card-keys + if any [none? kind kind = #"x"][ halt ] + kind: uppercase kind + unless find-in my-hand kind [ + status as-red "You must hold that rank to ask for it!" + draw-screen + exit + ] + either find-in ai-hand kind [ + transfer-cards ai-hand my-hand kind + status ["You took the computer's " as-green kind "s!"] + check-for-books my-hand + draw-screen + ][ + status ["Computer don't have any " as-green kind "s!"] + deal-cards 1 my-hand + check-for-books my-hand + draw-screen + exit + ] + ] + ] +] +;--- Main --- +go-fish-game diff --git a/Task/Goldbachs-comet/Agena/goldbachs-comet.agena b/Task/Goldbachs-comet/Agena/goldbachs-comet.agena new file mode 100644 index 0000000000..5e498f40b6 --- /dev/null +++ b/Task/Goldbachs-comet/Agena/goldbachs-comet.agena @@ -0,0 +1,22 @@ +scope # Goldbach's comet, translation of Pluto + + local proc goldbach( n :: number ) :: number + local count := 0; + for i to n \ 2 do + if numtheory.isprime( i ) and numtheory.isprime( n - i ) then + count +:= 1 + fi + od + return count + end; + + print( "The first 100 G numbers:" ) + print( join( foreach( 1, 100, << n -> strings.format( "%2d" & if n mod 10 = 0 then "\n" else " " fi + , goldbach( 2 + n * 2 ) + ) + >> + ) + ) + ); + printf( "G(1000000) = %.0f\n", goldbach( 1_000_000 ) ) +end diff --git a/Task/Goldbachs-comet/Arturo/goldbachs-comet.arturo b/Task/Goldbachs-comet/Arturo/goldbachs-comet.arturo index 5930a6e9da..e7bfa7ec91 100644 --- a/Task/Goldbachs-comet/Arturo/goldbachs-comet.arturo +++ b/Task/Goldbachs-comet/Arturo/goldbachs-comet.arturo @@ -13,6 +13,4 @@ print ["\nG(1000000) =" G 1000000] csv: join.with:",\n" map select 4..2000 => even? 'x -> ~"|x|, |G x|" -; write the CSV data to a file which we can then visualize -; via our preferred spreadsheet app -write "comet.csv" csv +csv >> "comet.csv" diff --git a/Task/Goldbachs-comet/BASIC256/goldbachs-comet.basic b/Task/Goldbachs-comet/BASIC256/goldbachs-comet.basic index 2083729dbf..153f24f02b 100644 --- a/Task/Goldbachs-comet/BASIC256/goldbachs-comet.basic +++ b/Task/Goldbachs-comet/BASIC256/goldbachs-comet.basic @@ -26,5 +26,5 @@ function g(n) if isPrime(i) = 1 and isPrime(n - i) = 1 then cont += 1 next i end if - g = cont + return cont end function diff --git a/Task/Goldbachs-comet/Delphi/goldbachs-comet.delphi b/Task/Goldbachs-comet/Delphi/goldbachs-comet.pas similarity index 100% rename from Task/Goldbachs-comet/Delphi/goldbachs-comet.delphi rename to Task/Goldbachs-comet/Delphi/goldbachs-comet.pas diff --git a/Task/Goldbachs-comet/EasyLang/goldbachs-comet.easy b/Task/Goldbachs-comet/EasyLang/goldbachs-comet.easy index 666e90ef38..1a4a2b23d6 100644 --- a/Task/Goldbachs-comet/EasyLang/goldbachs-comet.easy +++ b/Task/Goldbachs-comet/EasyLang/goldbachs-comet.easy @@ -1,30 +1,22 @@ func isprim n . - if n mod 2 = 0 and n > 2 - return 0 - . + if n mod 2 = 0 and n > 2 : return 0 i = 3 sq = sqrt n while i <= sq - if n mod i = 0 - return 0 - . + if n mod i = 0 : return 0 i += 2 . return 1 . func goldbach n . for i = 2 to n div 2 - if isprim i = 1 - cnt += isprim (n - i) - . + if isprim i = 1 : cnt += isprim (n - i) . return cnt . -numfmt 0 3 +numfmt 3 0 for n = 4 step 2 to 202 write goldbach n - if n mod 20 = 2 - print "" - . + if n mod 20 = 2 : print "" . print goldbach 1000000 diff --git a/Task/Goldbachs-comet/Fennel/goldbachs-comet.fennel b/Task/Goldbachs-comet/Fennel/goldbachs-comet.fennel new file mode 100644 index 0000000000..0fbbb9715e --- /dev/null +++ b/Task/Goldbachs-comet/Fennel/goldbachs-comet.fennel @@ -0,0 +1,49 @@ +(do ;;; Goldbach's comet - translated from the Lua sample + + (fn range [from to] ; generate a table containing the integers [from .. to] + (local t {}) + (for [i from to] + (tset t i i) + ) + t + ) + + (fn is-prime [p] + (if (or (<= p 1) (= 0 (% p 2))) + (= p 2) + ;else + (do (var (prime i root-p) (values true 3 (math.floor (math.sqrt p)))) + (while (and (<= i root-p) prime) + (set (prime i) (values (not= 0 (% p i)) (+ i 1))) + ) + prime + ) + ) + ) + + (fn goldbach [n] + (var count 0) + (for [i 1 (math.floor (/ n 2))] + (when (and (is-prime i) (is-prime (- n i))) + (set count (+ count 1)) + ) + ) + count + ) + + (print "The first 100 G numbers:") + (print (table.concat (icollect [_ v (ipairs (range 1 100))] + (string.format (.. "%2d" (if (= 0 (% v 10)) + "\n" + ;else + " " + ) + ) + (goldbach (+ 2 (* v 2))) + ) + ) + "" + ) + ) + (print (.. "G(1000000) = " (goldbach 1_000_000))) +) diff --git a/Task/Goldbachs-comet/FreeBASIC/goldbachs-comet-2.basic b/Task/Goldbachs-comet/FreeBASIC/goldbachs-comet-2.basic deleted file mode 100644 index 6a74789be6..0000000000 --- a/Task/Goldbachs-comet/FreeBASIC/goldbachs-comet-2.basic +++ /dev/null @@ -1,47 +0,0 @@ -OPTION STRICT: OPTION DEFINT -VAR MAX_G = 4000, MAX_P = 1000000 -VAR ROOT_MAX_P = FLOOR(SQR(MAX_P)) -VAR HALF_MAX_G = MAX_G DIV 2 -VAR G[MAX_G + 1], P[MAX_P + 1] -VAR I, J -CLS: GCLS -P[0] = FALSE: P[1] = 0: P[2] = TRUE -FOR I = 4 TO MAX_P STEP 2 P[I] = FALSE: NEXT -FOR I = 3 TO MAX_P STEP 2 P[I] = TRUE: NEXT -FOR I = 3 TO ROOT_MAX_P STEP 2 - IF P[I] THEN - FOR J = I * I TO MAX_P STEP I - P[J] = FALSE - NEXT - ENDIF -NEXT -FOR I = 1 TO MAX_G G[I] = 0: NEXT -G[4] = 1 ' 4 is the only sum of 2 even primes -FOR I = 3 TO HALF_MAX_G STEP 2 - IF P[I] THEN - INC G[I + 1] - FOR J = I + 2 TO MAX_G - 1 - IF P[J] THEN - INC G[I + 1] - ENDIF - NEXT - ENDIF -NEXT -VAR C = 0 -FOR I = 4 TO 202 STEP 2 - PRINT FORMAT$("%3D", G[I]), - INC C - IF C == 10 THEN PRINT: C = 0: ENDIF -NEXT -VAR GM = 0 -FOR I = 3 TO MAX_P DIV 2 STEP 2 - IF P[I] THEN - IF P[MAX_P - I] THEN INC GM: ENDIF - ENDIF -NEXT -PRINT FORMAT$("G(%D): ", MAX_P); GM -FOR I = 2 TO MAX_G - 10 STEP 10 - FOR J = 1 TO I + 8 STEP 2 - GPSET I DIV 10, 240-G[J],RGB(255,255,255) - NEXT -NEXT diff --git a/Task/Goldbachs-comet/FreeBASIC/goldbachs-comet-1.basic b/Task/Goldbachs-comet/FreeBASIC/goldbachs-comet.basic similarity index 100% rename from Task/Goldbachs-comet/FreeBASIC/goldbachs-comet-1.basic rename to Task/Goldbachs-comet/FreeBASIC/goldbachs-comet.basic diff --git a/Task/Goldbachs-comet/Gambas/goldbachs-comet-1.gambas b/Task/Goldbachs-comet/Gambas/goldbachs-comet-1.gambas new file mode 100644 index 0000000000..f3e283e96a --- /dev/null +++ b/Task/Goldbachs-comet/Gambas/goldbachs-comet-1.gambas @@ -0,0 +1,28 @@ +Use "isprime.bas" + +Public Sub Main() + + Print "The first 100 G numbers are:" + + Dim n As Integer, col As Integer = 1 + For n = 4 To 202 Step 2 + Print Format$(Str(g(n)), "####"); + If col Mod 10 = 0 Then Print + col += 1 + Next + + Print "\nG(1.000.000) = "; g(1000000) + +End + +Function g(n As Integer) As Integer + + Dim i As Integer, count As Integer = 0 + If n Mod 2 = 0 Then + For i = 2 To n \ 2 '(1/2) * n + If isPrime(i) And isPrime(n - i) Then count += 1 + Next + End If + Return count + +End Function diff --git a/Task/Goldbachs-comet/Gambas/goldbachs-comet-2.gambas b/Task/Goldbachs-comet/Gambas/goldbachs-comet-2.gambas new file mode 100644 index 0000000000..827e0b16a0 --- /dev/null +++ b/Task/Goldbachs-comet/Gambas/goldbachs-comet-2.gambas @@ -0,0 +1,47 @@ +OPTION STRICT: OPTION DEFINT +VAR MAX_G = 4000, MAX_P = 1000000 +VAR ROOT_MAX_P = FLOOR(SQR(MAX_P)) +VAR HALF_MAX_G = MAX_G DIV 2 +VAR G[MAX_G + 1], P[MAX_P + 1] +VAR I, J +CLS: GCLS +P[0] = FALSE: P[1] = 0: P[2] = TRUE +FOR I = 4 TO MAX_P STEP 2 P[I] = FALSE: NEXT +FOR I = 3 TO MAX_P STEP 2 P[I] = TRUE: NEXT +FOR I = 3 TO ROOT_MAX_P STEP 2 + IF P[I] THEN + FOR J = I * I TO MAX_P STEP I + P[J] = FALSE + NEXT + ENDIF +NEXT +FOR I = 1 TO MAX_G G[I] = 0: NEXT +G[4] = 1 ' 4 is the only sum of 2 even primes +FOR I = 3 TO HALF_MAX_G STEP 2 + IF P[I] THEN + INC G[I + I] + FOR J = I + 2 TO MAX_G - I + IF P[J] THEN + INC G[I + J] + ENDIF + NEXT + ENDIF +NEXT +VAR C = 0 +FOR I = 4 TO 202 STEP 2 + PRINT FORMAT$("%3D", G[I]), + INC C + IF C == 10 THEN PRINT: C = 0: ENDIF +NEXT +VAR GM = 0 +FOR I = 3 TO MAX_P DIV 2 STEP 2 + IF P[I] THEN + IF P[MAX_P - I] THEN INC GM: ENDIF + ENDIF +NEXT +PRINT FORMAT$("G(%D): ", MAX_P); GM +FOR I = 2 TO MAX_G - 10 STEP 10 + FOR J = I TO I + 8 STEP 2 + GPSET I DIV 10, 240-G[J],RGB(255,255,255) + NEXT +NEXT diff --git a/Task/Goldbachs-comet/Go/goldbachs-comet.go b/Task/Goldbachs-comet/Go/goldbachs-comet.go new file mode 100644 index 0000000000..4c8b45dc6c --- /dev/null +++ b/Task/Goldbachs-comet/Go/goldbachs-comet.go @@ -0,0 +1,63 @@ +package main + +import ( + "fmt" + "math" +) + +var primes []bool + +func initialisePrimes(limit int) { + primes = make([]bool, limit) + for i := 2; i < limit; i++ { + primes[i] = true + } + + sqrtLimit := int(math.Sqrt(float64(limit))) + for n := 2; n < sqrtLimit; n++ { + if primes[n] { + for k := n * n; k < limit; k += n { + primes[k] = false + } + } + } +} + +func goldbachFunction(number int) (int, error) { + if number <= 2 || number%2 == 1 { + return 0, fmt.Errorf("argument must be even and greater than 2: %d", number) + } + + result := 0 + for i := 1; i <= number/2; i++ { + if primes[i] && primes[number-i] { + result++ + } + } + return result, nil +} + +func main() { + initialisePrimes(2000000) + + fmt.Println("The first 100 Goldbach numbers:") + for n := 2; n < 102; n++ { + value, err := goldbachFunction(2 * n) + if err != nil { + fmt.Printf("Error: %v\n", err) + continue + } + fmt.Printf("%3d", value) + if n%10 == 1 { + fmt.Println() + } + } + + fmt.Println("\nThe 1,000,000th Goldbach number =", func() string { + value, err := goldbachFunction(1000000) + if err != nil { + return fmt.Sprintf("Error: %v", err) + } + return fmt.Sprintf("%d", value) + }()) +} diff --git a/Task/Goldbachs-comet/Julia/goldbachs-comet.julia b/Task/Goldbachs-comet/Julia/goldbachs-comet.jl similarity index 100% rename from Task/Goldbachs-comet/Julia/goldbachs-comet.julia rename to Task/Goldbachs-comet/Julia/goldbachs-comet.jl diff --git a/Task/Goldbachs-comet/Lua/goldbachs-comet.lua b/Task/Goldbachs-comet/Lua/goldbachs-comet.lua index 85a60e5015..41e61a815e 100644 --- a/Task/Goldbachs-comet/Lua/goldbachs-comet.lua +++ b/Task/Goldbachs-comet/Lua/goldbachs-comet.lua @@ -1,7 +1,6 @@ function T(t) return setmetatable(t, {__index=table}) end table.range = function(t,n) local s=T{} for i=1,n do s[i]=i end return s end table.map = function(t,f) local s=T{} for i=1,#t do s[i]=f(t[i]) end return s end -table.batch = function(t,n,f) for i=1,#t,n do local s=T{} for j=1,n do s[j]=t[i+j-1] end f(s) end return t end function isprime(n) if n < 2 then return false end @@ -24,6 +23,7 @@ function goldbach(n) end print("The first 100 G numbers:") -g = T{}:range(100):map(function(n) return goldbach(2+n*2) end) -g:map(function(n) return string.format("%2d ",n) end):batch(10,function(t) print(t:concat()) end) +print(T{}:range(100) + :map(function(n) return string.format("%2d"..(n % 10 == 0 and "\n" or " "),goldbach(2+n*2)) end) + :concat("")) print("G(1000000) = "..goldbach(1000000)) diff --git a/Task/Goldbachs-comet/PascalABC.NET/goldbachs-comet.pas b/Task/Goldbachs-comet/PascalABC.NET/goldbachs-comet.pas new file mode 100644 index 0000000000..234717b9bc --- /dev/null +++ b/Task/Goldbachs-comet/PascalABC.NET/goldbachs-comet.pas @@ -0,0 +1,36 @@ +uses GraphWPF; + +const colpick = (Colors.Red, Colors.Green, Colors.Blue); + +function IsPrime(x: longword): boolean; +begin + var i := 2; + while (i * i <= x) and (x mod i <> 0) do + i += 1; + Result := i * i > x; +end; + +function g(n: integer): integer; +begin + assert((n > 2) and (n mod 2 = 0), '“n” must be even and greater than 2.'); + for var i := 2 to (n div 2) do + if isPrime(i) and isPrime(n - i) then + result += 1; +end; + +begin + println('First 100 G numbers:'); + foreach var n in (2..101) index i do + begin + write(g( 2 * n):3); + if (i + 1) mod 10 = 0 then writeln; + end; + println; + println('G(1_000_000) =', g(1_000_000)); + + setMathematicCoords(0, 4000, 0, false); + foreach var x in range(4, 4002, 2) do + begin + fillcircle(x, g(x)*15, 10, colpick[(x div 2) mod 3]); + end; +end. diff --git a/Task/Goldbachs-comet/Pluto/goldbachs-comet-1.pluto b/Task/Goldbachs-comet/Pluto/goldbachs-comet-1.pluto new file mode 100644 index 0000000000..8d53f40164 --- /dev/null +++ b/Task/Goldbachs-comet/Pluto/goldbachs-comet-1.pluto @@ -0,0 +1,23 @@ +do -- Goldbach's comet, translation of Lua + + local int = require( "int" ) -- RC Pluto integer library, inc. prime utilities + + local function goldbach( n : number ) : number + local count = 0 + for i = 1, n // 2 do + if int.isprime( i ) and int.isprime( n - i ) then + ++ count + end + end + return count + end + + print( "The first 100 G numbers:" ) + print( range( 100 ):map( | n | -> string.format( "%2d"..if n % 10 == 0 then "\n" else " " end + , goldbach( 2 + n * 2 ) + ) + ) + :concat( "" ) + ) + print( $"G(1000000) = { goldbach( 1_000_000 ) }" ) +end diff --git a/Task/Goldbachs-comet/Pluto/goldbachs-comet-2.pluto b/Task/Goldbachs-comet/Pluto/goldbachs-comet-2.pluto new file mode 100644 index 0000000000..8f93744a60 --- /dev/null +++ b/Task/Goldbachs-comet/Pluto/goldbachs-comet-2.pluto @@ -0,0 +1,69 @@ +do -- create a bitmap of Goldbach's Comet + + local int = require( "int" ) -- RC Pluto integer library, inc. prime utilities + require( "bitmap" ) -- RC bitmap library + + local bmp = bitmap.of( 400, 240, color.black, "Goldbachs_comet_Pluto" ) + + local maxG , maxP = 4000, 1_000_000 + local rootMaxP , halfMaxG = math.floor( math.sqrt( maxP ) ), maxG // 2 + + local prime = int.arecomps( maxP ):map( | v | -> not v ) -- sieve the primes to maxP + + local G = {} -- construct a table of G numbers + for i = 1, maxG do G[ i ] = 0 end + G[ 4 ] = 1 -- 4 is the only sum of 2 even primes + for i = 3, halfMaxG, 2 do + if prime[ i ] then + G[ i + i ] += 1 + for j = i + 2, maxG - i do + if prime[ j ] then + G[ i + j ] += 1 + end + end + end + end + -- print the first few G numbers to the bitmap - 8x8 charaxters + local c, tx, ty = 0, 2, 2 + for i = 4, 202, 2 do + c += 1 + bmp:text( string.format( "%3d", G[ i ] ), tx, ty, color.white, 1 ) + if c % 10 != 0 then + tx += 24 + else + tx, ty = 2, ty + 10 + end + end + local Gm = 0 + for i = 3, maxP // 2, 2 do + if prime[ i ] then + if prime[ maxP - i ] then Gm += 1 end + end + end + -- print G(1_000_000) to the bitmap + bmp:text( string.format( "G(%d): %d", maxP, Gm ), 2, ty + 10, color.white, 1 ) + for i = 2, maxG - 10, 10 do + local maxY = 0 + local x = i // 10 + for j = i, i + 8, 2 do + if G[ j ] > 0 then + local y = 240 - G[ j ] + bmp:set( x, y, switch bmp:get( x, y ) do + case color.black -> color.orange + case color.orange -> color.yellow + default -> color.white + end + ) + if y > maxY then maxY = y end + end + end + -- we're going to save it as a png, so convert from BGR to RGb + for j = 1, maxY do + local bgr = bmp:get( x, j ) + if bgr != color.black then + bmp:set( x, j, bmp.flipColor( bgr ) ) + end + end + end + bmp:view( true ) +end diff --git a/Task/Goldbachs-comet/REXX/goldbachs-comet.rexx b/Task/Goldbachs-comet/REXX/goldbachs-comet.rexx new file mode 100644 index 0000000000..4d7666fda3 --- /dev/null +++ b/Task/Goldbachs-comet/REXX/goldbachs-comet.rexx @@ -0,0 +1,58 @@ +-- 23 Aug 2025 +include Setting + +say 'GOLDBACH''S COMET' +say version +say +numeric digits 7 +call GetPrimes +call ShowFirst100 +call ShowMillion +exit + +GetPrimes: +procedure expose prim. flag. +call Time('r') +say 'Collect Primes up to 1000000...' +call Primes(1e6) +say Time('e')/1 'seconds' +say +return + +ShowFirst100: +procedure expose prim. flag. +call Time('r') +say 'First 100 values...' +do i = 4 by 2 to 202 + call Charout ,Right(Goldbach(i),3) + if i//20 = 2 then + say +end +say Time('e')/1 'seconds' +say +return + +ShowMillion: +procedure expose prim. flag. +call Time('r') +say 'g(1000000)...' +say Goldbach(1e6) +say Time('e')/1 'seconds' +say +return + +Goldbach: +procedure expose prim. flag. +arg x +y = 0 +do i = 2 to x%2 + if flag.i then do + j = x-i + if flag.j then do + y = y+1 + end + end +end +return y/1 + +include Math diff --git a/Task/Goldbachs-comet/Rust/goldbachs-comet.rust b/Task/Goldbachs-comet/Rust/goldbachs-comet.rs similarity index 100% rename from Task/Goldbachs-comet/Rust/goldbachs-comet.rust rename to Task/Goldbachs-comet/Rust/goldbachs-comet.rs diff --git a/Task/Goldbachs-comet/Yabasic/goldbachs-comet-1.basic b/Task/Goldbachs-comet/Yabasic/goldbachs-comet-1.basic new file mode 100644 index 0000000000..effc0a4409 --- /dev/null +++ b/Task/Goldbachs-comet/Yabasic/goldbachs-comet-1.basic @@ -0,0 +1,23 @@ +import isprime + +print "The first 100 G numbers are:" + +col = 1 +for n = 4 to 202 step 2 + print g(n) using ("####"); + if mod(col, 10) = 0 print + col = col + 1 +next n + +print "\nG(1000000) = ", g(1000000) +end + +sub g(n) + count = 0 + if mod(n, 2) = 0 then + for i = 2 to (1/2) * n + if isPrime(i) and isPrime(n - i) count = count + 1 + next i + fi + return count +end sub diff --git a/Task/Goldbachs-comet/Yabasic/goldbachs-comet-2.basic b/Task/Goldbachs-comet/Yabasic/goldbachs-comet-2.basic new file mode 100644 index 0000000000..64f65b0ac9 --- /dev/null +++ b/Task/Goldbachs-comet/Yabasic/goldbachs-comet-2.basic @@ -0,0 +1,46 @@ +#include +#include +#include +#include +#include +#include + +std::vector primes; + +void initialise_primes(const int32_t& limit) { + primes.resize(limit); + for ( int32_t i = 2; i < limit; ++i ) { + primes[i] = true; + } + + for ( int32_t n = 2; n < sqrt(limit); ++n ) { + for ( int32_t k = n * n; k < limit; k += n ) { + primes[k] = false; + } + } +} + +int32_t goldbach_function(const int32_t& number) { + if ( number <= 2 || number % 2 == 1 ) { + throw std::invalid_argument("Argument must be even and greater than 2: " + std::to_string(number)); + } + + int32_t result = 0; + for ( int32_t i = 1; i <= number / 2; ++i ) { + if ( primes[i] && primes[number - i] ) { + result++; + } + } + return result; +} + +int main() { + initialise_primes(2'000'000); + + std::cout << "The first 100 Goldbach numbers:" << std::endl; + for ( int32_t n = 2; n < 102; ++n ) { + std::cout << std::setw(3) << goldbach_function(2 * n) << ( n % 10 == 1 ? "\n" : "" ); + } + + std::cout << "\n" << "The 1,000,000th Goldbach number = " << goldbach_function(1'000'000) << std::endl; +} diff --git a/Task/Golden-ratio-Convergence/Ada/golden-ratio-convergence.ada b/Task/Golden-ratio-Convergence/Ada/golden-ratio-convergence.adb similarity index 100% rename from Task/Golden-ratio-Convergence/Ada/golden-ratio-convergence.ada rename to Task/Golden-ratio-Convergence/Ada/golden-ratio-convergence.adb diff --git a/Task/Golden-ratio-Convergence/C-sharp/golden-ratio-convergence.cs b/Task/Golden-ratio-Convergence/C-sharp/golden-ratio-convergence.cs new file mode 100644 index 0000000000..b3bfccf9c2 --- /dev/null +++ b/Task/Golden-ratio-Convergence/C-sharp/golden-ratio-convergence.cs @@ -0,0 +1,22 @@ +using System; + +public class GoldenRatio { + static void Iterate() { + double oldPhi = 1.0, phi = 1.0, limit = 1e-5; + int iters = 0; + while (true) { + phi = 1.0 + 1.0 / oldPhi; + iters++; + if (Math.Abs(phi - oldPhi) <= limit) break; + oldPhi = phi; + } + Console.WriteLine($"Final value of phi : {phi:0.00000000000000}"); + double actualPhi = (1.0 + Math.Sqrt(5.0)) / 2.0; + Console.WriteLine($"Number of iterations : {iters}"); + Console.WriteLine($"Error (approx) : {phi - actualPhi:0.00000000000000}"); + } + + public static void Main(string[] args) { + Iterate(); + } +} diff --git a/Task/Golden-ratio-Convergence/COBOL/golden-ratio-convergence.cobol b/Task/Golden-ratio-Convergence/COBOL/golden-ratio-convergence.cob similarity index 100% rename from Task/Golden-ratio-Convergence/COBOL/golden-ratio-convergence.cobol rename to Task/Golden-ratio-Convergence/COBOL/golden-ratio-convergence.cob diff --git a/Task/Golden-ratio-Convergence/DuckDB/golden-ratio-convergence.duckdb b/Task/Golden-ratio-Convergence/DuckDB/golden-ratio-convergence.duckdb new file mode 100644 index 0000000000..0e9e393bfe --- /dev/null +++ b/Task/Golden-ratio-Convergence/DuckDB/golden-ratio-convergence.duckdb @@ -0,0 +1,24 @@ +set variable phi = (1 + sqrt(5)) / 2; + +# Output: one row (iterations, phi) +# This should work even with epsilon = 0 +create or replace function compute_phi(epsilon) as table ( + with recursive cte as ( + select 2.0::DOUBLE as oldPhi, 1::DOUBLE as phi, 0 as iterations + union all + select phi as oldPhi, + 1 + (1 / phi) as phi, + iterations + 1 as iterations + from cte + where @(phi - oldPhi) > epsilon + ) + select last(iterations order by iterations) as iterations, + last(phi order by iterations) as phi + from cte +); + +select epsilon, + iterations, + phi as "final value", + @(phi - getvariable('phi')) as "approximate absolute error" + from (select unnest([1e-5, 0]) as epsilon), compute_phi(epsilon); diff --git a/Task/Golden-ratio-Convergence/EasyLang/golden-ratio-convergence.easy b/Task/Golden-ratio-Convergence/EasyLang/golden-ratio-convergence.easy index 66bf65792e..c5d55953a8 100644 --- a/Task/Golden-ratio-Convergence/EasyLang/golden-ratio-convergence.easy +++ b/Task/Golden-ratio-Convergence/EasyLang/golden-ratio-convergence.easy @@ -5,7 +5,7 @@ repeat phi0 = phi iter += 1 . -numfmt 10 0 +numfmt 0 10 print "Iterations: " & iter print "Result: " & phi print "Error: " & phi - (1 + sqrt 5) / 2 diff --git a/Task/Golden-ratio-Convergence/F-Sharp/golden-ratio-convergence.fs b/Task/Golden-ratio-Convergence/F-Sharp/golden-ratio-convergence.fs new file mode 100644 index 0000000000..7c4f5f161d --- /dev/null +++ b/Task/Golden-ratio-Convergence/F-Sharp/golden-ratio-convergence.fs @@ -0,0 +1,4 @@ +// Golden ratio/Convergence. Nigel Galloway: March 8th., 2024 +let ϕ=let aπ()=fun()->1M in cf2S(aπ())(aπ()) +let (_,n),g=let mutable l=1 in (ϕ|>Seq.pairwise|>Seq.skipWhile(fun(n,g)->l<-l+1;abs(n-g)>1e-5M)|>Seq.head,l) +printfn "Value of ϕ is %1.14f after %d iterations error with respect to (1+√5)/2 is %1.14f" n g (abs(n-(decimal(1.0+(sqrt 5.0))/2M))) diff --git a/Task/Golden-ratio-Convergence/FutureBasic/golden-ratio-convergence.basic b/Task/Golden-ratio-Convergence/FutureBasic/golden-ratio-convergence.basic new file mode 100644 index 0000000000..250ef6e2b2 --- /dev/null +++ b/Task/Golden-ratio-Convergence/FutureBasic/golden-ratio-convergence.basic @@ -0,0 +1,21 @@ +include "NSLog.incl" + +void local fn Iterate + double oldPhi = 1.0, phi = 1.0, limit = 1e-5 + int iters = 0 + while (YES) + phi = 1.0 + 1.0 / oldPhi + iters++ + if ( abs( phi - oldPhi ) <= limit ) then break + oldPhi = phi + wend + NSLog( @"Final value of phi: %16.14f", phi ) + double actualPhi = ( 1.0 + fn sqrt(5.0) ) / 2.0 + NSLog( @"Actual value of phi: %16.14f", actualPhi ) + NSLog( @"Error (approx): %16.14f", phi - actualPhi ) + NSLog( @"Number of iterations: %d", iters ) +end fn + +fn Iterate + +HandleEvents diff --git a/Task/Golden-ratio-Convergence/Julia/golden-ratio-convergence.julia b/Task/Golden-ratio-Convergence/Julia/golden-ratio-convergence.jl similarity index 100% rename from Task/Golden-ratio-Convergence/Julia/golden-ratio-convergence.julia rename to Task/Golden-ratio-Convergence/Julia/golden-ratio-convergence.jl diff --git a/Task/Golden-ratio-Convergence/Oberon/golden-ratio-convergence.oberon b/Task/Golden-ratio-Convergence/Oberon/golden-ratio-convergence.oberon new file mode 100644 index 0000000000..041dac37f4 --- /dev/null +++ b/Task/Golden-ratio-Convergence/Oberon/golden-ratio-convergence.oberon @@ -0,0 +1,24 @@ +MODULE GoldenRatioCnv; (* calculate the Golden Ratio and show the number of iterations required *) + IMPORT Math, Out; + + VAR count : INTEGER; + phi0, phi1, diff : REAL; + +BEGIN + + count := 0; + phi0 := 1.0; + diff := 1.0E20; + + WHILE 1.0E-5 < diff DO + phi1 := 1.0 + ( 1.0 / phi0 ); + diff := ABS( phi1 - phi0 ); + phi0 := phi1; + INC( count ) + END; + + Out.String( "Result:" );Out.Real( phi0, 10 ); + Out.String( " after " );Out.Int( count, 0 );Out.String( " iterations" );Out.Ln; + Out.String( "The error is approximately " );Out.Real( phi0 - ( 0.5 * ( 1.0 + Math.sqrt( 5.0 ) ) ), 10 );Out.Ln + +END GoldenRatioCnv. diff --git a/Task/Golden-ratio-Convergence/Onyx-(wasm)/golden-ratio-convergence.onyx b/Task/Golden-ratio-Convergence/Onyx-(wasm)/golden-ratio-convergence.onyx new file mode 100644 index 0000000000..81df1f1637 --- /dev/null +++ b/Task/Golden-ratio-Convergence/Onyx-(wasm)/golden-ratio-convergence.onyx @@ -0,0 +1,26 @@ +package main +use core {*} +use core.math{abs} +use core.intrinsics.wasm{sqrt_f64} +main :: () { + iterate(); +} +iterate :: () { + count := 0; + phi0: f64 = 1.0; + difference: f64 = 1.0; + phi1: f64; + println("\nGolden ratio/Convergence"); + println("-----------------------------------------"); + while 0.00001 < difference { + phi1 = 1.0 + (1.0 / phi0); + difference = abs(phi1 - phi0); + phi0 = phi1; + count += 1; + printf("Iteration {} : Estimate : {.8}\n", count, phi1); + } + println("-----------------------------------------"); + printf("Result: {} after {} iterations", phi1, count); + printf("\nThe error is approximately {.8}\n", (phi1 - (0.5 * (1.0 + sqrt_f64(5.0))))); + println("\n"); +} diff --git a/Task/Golden-ratio-Convergence/PascalABC.NET/golden-ratio-convergence.pas b/Task/Golden-ratio-Convergence/PascalABC.NET/golden-ratio-convergence.pas new file mode 100644 index 0000000000..ab76ee0240 --- /dev/null +++ b/Task/Golden-ratio-Convergence/PascalABC.NET/golden-ratio-convergence.pas @@ -0,0 +1,17 @@ +begin + var phi := 1.0; + var phiprev := 0.0; + var n := 0; + var err := 0.0; + while True do + begin + n += 1; + phi := 1 + 1/phi; + err := Abs(phi - phiprev); + if err <= 1e-5 then + break; + phiprev := phi; + end; + Println($'Result = {phi} after {n} iterations'); + Println($'The error is approximately = {phi - (1+sqrt(5)) / 2}'); +end. diff --git a/Task/Golden-ratio-Convergence/Phix/golden-ratio-convergence.phix b/Task/Golden-ratio-Convergence/Phix/golden-ratio-convergence.phix index 48bad6392b..4ec55e1c3f 100644 --- a/Task/Golden-ratio-Convergence/Phix/golden-ratio-convergence.phix +++ b/Task/Golden-ratio-Convergence/Phix/golden-ratio-convergence.phix @@ -1,11 +1,9 @@ -(phixonline)--> - with javascript_semantics - atom Phi = 1, iter = 0 - do - atom Pi = Phi - Phi = 1+1/Phi - iter += 1 - until abs(Phi-Pi)<1e-5 - printf(1,"Result: %.14f after %d iterations\n",{Phi,iter}) - printf(1,"Error: %.14f\n",{Phi-(1+sqrt(5))/2}) - "; i; print Bin(i,5); " --> "; diff --git a/Task/Gray-code/Frink/gray-code.frink b/Task/Gray-code/Frink/gray-code.frink index a145daca00..2d456adfa7 100644 --- a/Task/Gray-code/Frink/gray-code.frink +++ b/Task/Gray-code/Frink/gray-code.frink @@ -2,5 +2,7 @@ for i=0 to 31 { gray = binaryToGray[i] back = grayToBinary[gray] - println[(i->binary) + "\t" + (gray->binary) + "\t" + (back->binary)] + println[pad[i->binary] + "\t" + pad[gray->binary] + "\t" + pad[back->binary]] } + +pad[x] := padLeft[x,5,"0"] diff --git a/Task/Gray-code/FutureBasic/gray-code.basic b/Task/Gray-code/FutureBasic/gray-code.basic new file mode 100644 index 0000000000..9bb50c362a --- /dev/null +++ b/Task/Gray-code/FutureBasic/gray-code.basic @@ -0,0 +1,31 @@ +// Gray Code +//https://rosettacode.org/wiki/Gray_code + +local fn gray2bin(g As uint32) As uint32 + uint32 b = g + While g + g = g >> 1 + b = b Xor g + Wend + Return b +End fn = b + +local fn bin2gray(b As uint32) As uint32 +End fn = b Xor (b >> 1) + +// ------=< MAIN >=------ + +uint32 i +Print " DEC Binary Gray GrayToBinary" + +For i = 0 To 31 + print str$(i) + " "; + if i < 10 then print " "; + print " " + right$(bin$(i),5); + print " -->"; + print " " + right$(bin$(fn bin2gray(i)),5); + print " -->"; + print " " + right$(bin$(fn gray2bin(fn bin2gray(i))),5) +Next + +handleevents diff --git a/Task/Gray-code/BASIC/gray-code.basic b/Task/Gray-code/GW-BASIC/gray-code.basic similarity index 100% rename from Task/Gray-code/BASIC/gray-code.basic rename to Task/Gray-code/GW-BASIC/gray-code.basic diff --git a/Task/Gray-code/Jq/gray-code.jq b/Task/Gray-code/Jq/gray-code.jq new file mode 100644 index 0000000000..cb4f7ad97c --- /dev/null +++ b/Task/Gray-code/Jq/gray-code.jq @@ -0,0 +1,38 @@ +def encode: + def flip: if . == 1 then 0 else 1 end; + . as $b + | reduce range(1; length) as $i ($b; + if $b[$i-1] == 1 then .[$i] |= flip + else . + end ) ; + +def decode: + def xor($a;$b): ($a + $b) % 2; + . as $g + | reduce range(1; length) as $i (.[:1]; + .[$i] = xor($g[$i]; .[$i-1]) ) ; + + +# input: a non-negative integer +# output: a binary array, least-significant bit first +def to_binary: + if . == 0 then [0] + else [recurse( if . == 0 then empty else ./2 | floor end ) % 2] + | .[:-1] # remove the uninteresting 0 + end ; + +def lpad($len; $fill): + tostring + | ($len - length) as $l + | if $l <= 0 then . + else ($fill * $l)[:$l] + . + end; + +def pp: map(tostring) | join("") | lpad(5; "0"); + +### The task +"decimal binary gray roundtrip", +(range(0; 32) as $i + | ($i | to_binary | reverse) as $b + | ($b|encode) as $g + | " \($i|lpad(2;" ")) \($b|pp) \($g|pp) \($g|decode == $b)" ) diff --git a/Task/Gray-code/Julia/gray-code.julia b/Task/Gray-code/Julia/gray-code.jl similarity index 100% rename from Task/Gray-code/Julia/gray-code.julia rename to Task/Gray-code/Julia/gray-code.jl diff --git a/Task/Gray-code/Kotlin/gray-code.kotlin b/Task/Gray-code/Kotlin/gray-code.kts similarity index 100% rename from Task/Gray-code/Kotlin/gray-code.kotlin rename to Task/Gray-code/Kotlin/gray-code.kts diff --git a/Task/Gray-code/Liberty-BASIC/gray-code.basic b/Task/Gray-code/Liberty-BASIC/gray-code.basic index 14888831e6..44f2129ea9 100644 --- a/Task/Gray-code/Liberty-BASIC/gray-code.basic +++ b/Task/Gray-code/Liberty-BASIC/gray-code.basic @@ -7,7 +7,6 @@ B$ =Gray2Bin$( G$) print B$; " in pure binary." next r - end function Bin2Gray$( bin$) ' Given a binary number as a string, returns Gray code as a string. diff --git a/Task/Gray-code/Modula-2/gray-code.mod2 b/Task/Gray-code/Modula-2/gray-code.mod2 new file mode 100644 index 0000000000..135aaa93e7 --- /dev/null +++ b/Task/Gray-code/Modula-2/gray-code.mod2 @@ -0,0 +1,57 @@ +MODULE GrayCode; + +FROM STextIO IMPORT + WriteString, WriteLn; +FROM SWholeIO IMPORT + WriteInt; +FROM Conversions IMPORT + LongBaseToStr; +FROM FormatString IMPORT + FormatString; (* for justifying *) + +VAR + I, G, D: CARDINAL; + Ok: BOOLEAN; + BinS, OutBinS: ARRAY[0 .. 5] OF CHAR; + +PROCEDURE Encode(V: CARDINAL): CARDINAL; +BEGIN + RETURN V BXOR (V SHR 1) +END Encode; + +PROCEDURE Decode(V: CARDINAL): CARDINAL; +VAR + Result: CARDINAL; +BEGIN + Result := 0; + WHILE V > 0 DO + Result := Result BXOR V; + V := V SHR 1 + END; + RETURN Result +END Decode; + +BEGIN + WriteString("decimal binary gray decoded"); + WriteLn; + FOR I := 0 TO 31 DO + G := Encode(I); + D := Decode(G); + WriteInt(I, 4); + WriteString(" "); + Ok := LongBaseToStr(I, 2, BinS); + Ok := FormatString("%'05s", OutBinS, BinS); + (* Padded with 0; width: 5; type: string *) + WriteString(OutBinS); + WriteString(" "); + Ok := LongBaseToStr(G, 2, BinS); + Ok := FormatString("%'05s", OutBinS, BinS); + WriteString(OutBinS); + WriteString(" "); + Ok := LongBaseToStr(D, 2, BinS); + Ok := FormatString("%'05s", OutBinS, BinS); + WriteString(OutBinS); + WriteInt(D, 4); + WriteLn; + END +END GrayCode. diff --git a/Task/Gray-code/OCaml/gray-code.ocaml b/Task/Gray-code/OCaml/gray-code.ml similarity index 100% rename from Task/Gray-code/OCaml/gray-code.ocaml rename to Task/Gray-code/OCaml/gray-code.ml diff --git a/Task/Gray-code/PascalABC.NET/gray-code.pas b/Task/Gray-code/PascalABC.NET/gray-code.pas new file mode 100644 index 0000000000..e7f7d37b51 --- /dev/null +++ b/Task/Gray-code/PascalABC.NET/gray-code.pas @@ -0,0 +1,18 @@ +uses School; + +function GrayEncode(n: longword): longword := n xor (n shr 1); + +function GrayDecode(n: longword): longword; +begin + Result := 0; + while n > 0 do + begin + Result := Result xor n; + n := n shr 1; + end; +end; + +begin + for var i := 0 to 31 do + Writeln($'{i,-7} {Bin(i),-7} {Bin(grayEncode(i)),-7} {grayDecode(grayEncode(i)),-7}'); +end. diff --git a/Task/Gray-code/Pluto/gray-code.pluto b/Task/Gray-code/Pluto/gray-code.pluto new file mode 100644 index 0000000000..cf0cab4ce4 --- /dev/null +++ b/Task/Gray-code/Pluto/gray-code.pluto @@ -0,0 +1,19 @@ +local fmt = require "fmt" + +local function to_gray(n) return n ~ (n >> 1) end + +local function from_gray(g) + local b = 0 + while g != 0 do + b ~= g + g >>= 1 + end + return b +end + +print("decimal binary gray decoded") +for b = 0, 31 do + fmt.write(" %2d %05d", b, fmt.bin(b)) + local g = to_gray(b) + fmt.print(" %05d %05d", fmt.bin(g), fmt.bin(from_gray(g))) +end diff --git a/Task/Gray-code/PowerShell/gray-code.ps1 b/Task/Gray-code/PowerShell/gray-code.ps1 new file mode 100644 index 0000000000..0becbcb13c --- /dev/null +++ b/Task/Gray-code/PowerShell/gray-code.ps1 @@ -0,0 +1,35 @@ +# Gray code + +function Encode { + [OutputType([uint32])] + param([uint32]$V) + + return $V -bxor ($V -shr 1) +} + +function Decode { + [OutputType([uint32])] + param([uint32]$V) + + [uint32]$result = 0 + while ($V -gt 0) { + $result = $result -bxor $V + $V = $V -shr 1 + } + return $result +} + +Write-Output "decimal binary gray decoded" +foreach ($i in 0..31) { + [uint32]$g = Encode($i) + [uint32]$d = Decode($g) + [string]$out = @() + $out += "{0, 4} " -f $i + $binS = ([convert]::ToString($i, 2)).PadLeft(5, "0") + $out += "$binS " + $binS = ([convert]::ToString($g, 2)).PadLeft(5, "0") + $out += "$binS " + $binS = ([convert]::ToString($d, 2)).PadLeft(5, "0") + $out += "$binS{0, 4}" -f $d + Write-Output $out +} diff --git a/Task/Gray-code/Rust/gray-code.rust b/Task/Gray-code/Rust/gray-code.rs similarity index 100% rename from Task/Gray-code/Rust/gray-code.rust rename to Task/Gray-code/Rust/gray-code.rs diff --git a/Task/Gray-code/SETL/gray-code.setl b/Task/Gray-code/SETL/gray-code.setl new file mode 100644 index 0000000000..e5d368056b --- /dev/null +++ b/Task/Gray-code/SETL/gray-code.setl @@ -0,0 +1,29 @@ +program gray_code; + loop for n in [0..31] do + print( + lpad(str n, 2) + ": " + + lpad(bits n, 5) + " => " + + lpad(bits(g := gray_encode(n)), 5) + " => " + + lpad(bits(d := gray_decode(g)), 5) + ": " + + lpad(str d, 2) + ); + end loop; + + proc gray_encode(n); + return n bit_xor (n div 2); + end proc; + + proc gray_decode(n); + loop + init r := 0; + step n div:= 2; + until n=0 do r bit_xor:= n; + end loop; + return r; + end proc; + + op bits(n); + b := '' +/ [[str (n mod 2), n div:=2](1) : until n=0]; + return reverse(b); + end op; +end program; diff --git a/Task/Gray-code/VBScript/gray-code.vb b/Task/Gray-code/VBScript/gray-code.vbs similarity index 100% rename from Task/Gray-code/VBScript/gray-code.vb rename to Task/Gray-code/VBScript/gray-code.vbs diff --git a/Task/Gray-code/VHDL/gray-code-1.vhdl b/Task/Gray-code/VHDL/gray-code-1.vhd similarity index 100% rename from Task/Gray-code/VHDL/gray-code-1.vhdl rename to Task/Gray-code/VHDL/gray-code-1.vhd diff --git a/Task/Gray-code/VHDL/gray-code-2.vhdl b/Task/Gray-code/VHDL/gray-code-2.vhd similarity index 100% rename from Task/Gray-code/VHDL/gray-code-2.vhdl rename to Task/Gray-code/VHDL/gray-code-2.vhd diff --git a/Task/Gray-code/Wren/gray-code.wren b/Task/Gray-code/Wren/gray-code.wren index 1774f73d3e..8d50662588 100644 --- a/Task/Gray-code/Wren/gray-code.wren +++ b/Task/Gray-code/Wren/gray-code.wren @@ -1,4 +1,4 @@ -import "/fmt" for Fmt +import "./fmt" for Fmt var toGray = Fn.new { |n| n ^ (n>>1) } diff --git a/Task/Gray-code/Zig/gray-code.zig b/Task/Gray-code/Zig/gray-code.zig new file mode 100644 index 0000000000..93a671caa5 --- /dev/null +++ b/Task/Gray-code/Zig/gray-code.zig @@ -0,0 +1,64 @@ +const std = @import("std"); + +fn grayEncode(b: u32) u32 { + return b ^ (b >> 1); +} + +fn grayDecode(g: u32) u32 { + var result = g; + var bit: u32 = 1 << 31; + while (bit > 1) { + if (result & bit != 0) result ^= bit >> 1; + bit >>= 1; + } + return result; +} + +fn toBinary(value: u32, buffer: []u8) []const u8 { + if (value == 0) return "0"; + + var temp = value; + var highest_bit: u5 = 0; + // Find the highest bit set + while (temp != 0) : (temp >>= 1) { + highest_bit += 1; + } + + // Fill buffer from right to left + var i: usize = highest_bit; + temp = value; + while (i > 0) { + i -= 1; + buffer[i] = if (temp & 1 == 1) '1' else '0'; + temp >>= 1; + } + + // Find first '1' + for (buffer[0..highest_bit], 0..) |c, index| { + if (c == '1') { + return buffer[index..highest_bit]; + } + } + + return "0"; // Fallback +} + +pub fn main() !void { + const stdout = std.io.getStdOut().writer(); + try stdout.print("Number\tBinary\tGray\tDecoded\n", .{}); + + // Pre-allocate a buffer big enough for 32-bit numbers + var binary_buffer: [32]u8 = undefined; + var gray_buffer: [32]u8 = undefined; + + for (0..32) |n| { + const n_u32: u32 = @intCast(n); + const g = grayEncode(n_u32); + std.debug.assert(grayDecode(g) == n_u32); + + const binary = toBinary(n_u32, &binary_buffer); + const grayBinary = toBinary(g, &gray_buffer); + + try stdout.print("{d}\t{s}\t{s}\t{d}\n", .{ n, binary, grayBinary, g }); + } +} diff --git a/Task/Grayscale-image/11l/grayscale-image.11l b/Task/Grayscale-image/11l/grayscale-image.11l index 2d3c981e9e..3f4f195f10 100644 --- a/Task/Grayscale-image/11l/grayscale-image.11l +++ b/Task/Grayscale-image/11l/grayscale-image.11l @@ -1,13 +1,4 @@ -T Colour - Byte r, g, b - - F (r, g, b) - .r = r - .g = g - .b = b - - F ==(other) - R .r == other.r & .g == other.g & .b == other.b +T Colour = BVec3 V black = Colour(0, 0, 0) V white = Colour(255, 255, 255) diff --git a/Task/Grayscale-image/Ada/grayscale-image-1.ada b/Task/Grayscale-image/Ada/grayscale-image-1.adb similarity index 100% rename from Task/Grayscale-image/Ada/grayscale-image-1.ada rename to Task/Grayscale-image/Ada/grayscale-image-1.adb diff --git a/Task/Grayscale-image/Ada/grayscale-image-2.ada b/Task/Grayscale-image/Ada/grayscale-image-2.adb similarity index 100% rename from Task/Grayscale-image/Ada/grayscale-image-2.ada rename to Task/Grayscale-image/Ada/grayscale-image-2.adb diff --git a/Task/Grayscale-image/Ada/grayscale-image-3.ada b/Task/Grayscale-image/Ada/grayscale-image-3.adb similarity index 100% rename from Task/Grayscale-image/Ada/grayscale-image-3.ada rename to Task/Grayscale-image/Ada/grayscale-image-3.adb diff --git a/Task/Grayscale-image/Crystal/grayscale-image.crystal b/Task/Grayscale-image/Crystal/grayscale-image.cr similarity index 100% rename from Task/Grayscale-image/Crystal/grayscale-image.crystal rename to Task/Grayscale-image/Crystal/grayscale-image.cr diff --git a/Task/Grayscale-image/Euphoria/grayscale-image.euphoria b/Task/Grayscale-image/Euphoria/grayscale-image.eu similarity index 100% rename from Task/Grayscale-image/Euphoria/grayscale-image.euphoria rename to Task/Grayscale-image/Euphoria/grayscale-image.eu diff --git a/Task/Grayscale-image/Julia/grayscale-image-1.julia b/Task/Grayscale-image/Julia/grayscale-image-1.jl similarity index 100% rename from Task/Grayscale-image/Julia/grayscale-image-1.julia rename to Task/Grayscale-image/Julia/grayscale-image-1.jl diff --git a/Task/Grayscale-image/Julia/grayscale-image-2.julia b/Task/Grayscale-image/Julia/grayscale-image-2.jl similarity index 100% rename from Task/Grayscale-image/Julia/grayscale-image-2.julia rename to Task/Grayscale-image/Julia/grayscale-image-2.jl diff --git a/Task/Grayscale-image/Kotlin/grayscale-image.kotlin b/Task/Grayscale-image/Kotlin/grayscale-image.kts similarity index 100% rename from Task/Grayscale-image/Kotlin/grayscale-image.kotlin rename to Task/Grayscale-image/Kotlin/grayscale-image.kts diff --git a/Task/Grayscale-image/M2000-Interpreter/grayscale-image.m2000 b/Task/Grayscale-image/M2000-Interpreter/grayscale-image.m2000 index 229762871a..ed33411db2 100644 --- a/Task/Grayscale-image/M2000-Interpreter/grayscale-image.m2000 +++ b/Task/Grayscale-image/M2000-Interpreter/grayscale-image.m2000 @@ -1,201 +1,202 @@ Module P6P5 { - Function Bitmap { - def x as long, y as long, Import as boolean, P5 as boolean - If match("NN") then { - Read x, y - } else.if Match("N") Then { - \\ is a file? - Read f as long - buffer whitespace as byte - if not Eof(f) then { - get #f, whitespace :P6$=eval$(whitespace) - get #f, whitespace : P6$+=eval$(whitespace) - def boolean getW=true, getH=true, getV=true - def long v - \\ str$("P6") has 2 bytes. "P6" has 4 bytes - P5=p6$=str$("P5") - If p6$=str$("P6") or P5 Then { - do { - get #f, whitespace - if Eval$(whitespace)=str$("#") then { - do {get #f, whitespace} until eval(whitespace)=10 - } else { - select case eval(whitespace) - case 32, 9, 13, 10 - { if getW and x<>0 then { - getW=false - } else.if getH and y<>0 then { - getH=false - } else.if getV and v<>0 then { - getV=false - } - } - case 48 to 57 - {if getW then { - x*=10 - x+=eval(whitespace, 0)-48 - } else.if getH then { - y*=10 - y+=eval(whitespace, 0)-48 - } else.if getV then { - v*=10 - v+=eval(whitespace, 0)-48 - } - } - End Select - } - iF eof(f) then Error "Not a ppm file" - } until getV=false - } else Error "Not a P6 ppm or P5 ppm file" - Import=True - } - } else Error "No proper arguments" - if x<1 or y<1 then Error "Wrong dimensions" - structure rgb { - red as byte - green as byte - blue as byte - } - m=len(rgb)*x mod 4 - if m>0 then m=4-m ' add some bytes to raster line - m+=len(rgb) *x - Structure rasterline { - { - pad as byte*m - } - hline as rgb*x - } - Structure Raster { - magic as integer*4 - w as integer*4 - h as integer*4 - { - linesB as byte*len(rasterline)*y - } - lines as rasterline*y - } - Buffer Clear Image1 as Raster - Return Image1, 0!magic:="cDIB", 0!w:=Hex$(x,2), 0!h:=Hex$(y, 2) - if not Import then Return Image1, 0!lines:=Str$(String$(chrcode$(255), Len(rasterline)*y)) - Buffer Clear Pad as Byte*4 - SetPixel=Lambda Image1, Pad,aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x, y, c) ->{ - where=alines+3*x+blines*y - if c>0 then c=color(c) - c-! - Return Pad, 0:=c as long - Return Image1, 0!where:=Eval(Pad, 2) as byte, 0!where+1:=Eval(Pad, 1) as byte, 0!where+2:=Eval(Pad, 0) as byte - } - GetPixel=Lambda Image1,aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x,y) ->{ - where=alines+3*x+blines*y - =color(Eval(image1, where+2 as byte), Eval(image1, where+1 as byte), Eval(image1, where as byte)) - } - GetPixelGray=Lambda Image1,aLines=Len(Raster)-Len(Rasterline), blines=-Len(Rasterline) (x,y) ->{ - where=alines+3*x+blines*y - grayval=round(0.2126*Eval(image1, where+2 as byte) + 0.7152*Eval(image1, where+1 as byte) + 0.0722*Eval(image1, where as byte), 0) - =color(grayval,grayval,grayval) - } - StrDib$=Lambda$ Image1, Raster -> { - =Eval$(Image1, 0, Len(Raster)) - } - CopyImage=Lambda Image1 (image$) -> { - if left$(image$,12)=Eval$(Image1, 0, 24 ) Then { - Return Image1, 0:=Image$ - } Else Error "Can't Copy Image" - } - Export2File=Lambda Image1, x, y (f) -> { - Print #f, "P6";chr$(10);"# Created using M2000 Interpreter";chr$(10); - Print #f, x;" ";y;" 255";chr$(10); - x2=x-1 : where=0 : rasterline=x*3 - m=rasterline mod 4 : if m<>0 then rasterline+=4-m - Buffer pad as byte*3 - For y1=y-1 to 0 { - where=rasterline*y1 - For x1=0 to x2 { - Return pad, 0:=eval$(image1, 0!linesB!where, 3) - Push Eval(pad, 2) : Return pad, 2:=Eval(pad, 0), 0:=Number - Put #f, pad : where+=3 - } - } - } - Export2FileGray=Lambda Image1, x, y (f) -> { - Print #f, "P5";chr$(10);"# Created using M2000 Interpreter";chr$(10); - Print #f, x;" ";y;" 255";chr$(10); - x2=x-1 : where=0 : rasterline=x*3 - m=rasterline mod 4 : if m<>0 then rasterline+=4-m - Buffer pad as byte*3 - Buffer bytepad as byte - const R=0.2126, G=0.7152, B=0.0722 - For y1=y-1 to 0 { - where=rasterline*y1 - For x1=0 to x2 { - Return pad, 0:=eval$(image1, 0!linesB!where, 3) - Return bytepad, 0:=round(R*Eval(pad, 2) + G*Eval(pad, 1) + B*Eval(pad, 0), 0) - Put #f, bytepad : where+=3 - } - } - } - if Import then { - x0=x-1 : where=0 - Buffer Pad1 as byte*3 - Buffer Pad2 as byte - local rasterline=x*3 - m=rasterline mod 4 : if m<>0 then rasterline+=4-m - For y1=y-1 to 0 { - where=rasterline*y1 - For x1=0 to x0 { - if p5 then - Get #f, Pad2: m=eval(Pad2,0) : Return pad1, 0:=m, 1:=m, 2:=m - else - Get #f, Pad1 : Push Eval(pad1, 2) : Return pad1, 2:=Eval(pad1, 0), 0:=Number - End if - Return Image1, 0!linesB!where:=Eval$(Pad1) : where+=3 - } - } - } - Group Bitmap { - SetPixel=SetPixel - GetPixel=GetPixel - Image$=StrDib$ - Copy=CopyImage - ToFile=Export2File - ToFileGray=Export2FileGray - GetPixelGray=GetPixelGray - } - =Bitmap - } - Cls 5,0 - A=Bitmap(15,10) - B=Bitmap(15,10) - c1=color(100, 200, 255) - c2=color(180, 250, 128) - For i=0 to 8 - Call A.SetPixel(i, i, c1) - Call A.SetPixel(9, i,c2) - Next - Call A.SetPixel(i,i,c1) - // make a new one GrayScale (but 24bit) as B - For i=0 to 14 { For J=0 to 9 {Call B.SetPixel(i, j, A.GetPixelGray(i,j))}} - // place image A at 200 pixel from left margin, 100 pixel from top margin - Copy 200*twipsX, 100*twipsY use A.Image$(), 0, 400 ' zoom 400%, angle 0 - // place image B at 400 pixel from left margin, 100 pixel from top margin - Copy 400*twipsX, 100*twipsY use B.Image$(), 0, 400 ' zoom 400% - Try { - Open "P6example.ppm" For Output as #f - Call A.Tofile(f) - Close #f - Open "P5example.ppm" For Output as #f - Call A.TofileGray(f) - Close #f - Open "P5example.ppm" For Input as #f - C=Bitmap(f) - close #f - Copy 600*twipsX, 100*twipsY use C.Image$(), 0, 400 ' zoom 400% - Open "P6example.ppm" For Input as #f - C=Bitmap(f) - close #f - // use of Top clause to make the border color transparent at rotation - Copy 800*twipsX, 100*twipsY top C.Image$(), 30, 400 ' zoom 400%, angle 30 degree - } - Print "Done" + Class Bitmap { + { // from version 14 + Var x As long, y As long, Import As boolean, P5 As boolean + If match("NN") Then + Read x, y + Else.if Match("N") Then + Read f As long + buffer whitespace As Byte + if not Eof(f) Then + get #f, whitespace :P6$=eval$(whitespace) + get #f, whitespace : P6$+=eval$(whitespace) + boolean getW=true, getH=true, getV=true + long v + P5=p6$=str$("P5") + If p6$=str$("P6") or P5 Then + do + get #f, whitespace + if Eval$(whitespace)=str$("#") Then + do + get #f, whitespace + until eval(whitespace)=10 + Else + select case eval(whitespace) + case 32, 9, 13, 10 + { + if getW and x<>0 Then + getW=false + Else.if getH and y<>0 Then + getH=false + Else.if getV and v<>0 Then + getV=false + End If + } + case 48 To 57 + { + if getW Then + x*=10 + x+=eval(whitespace, 0)-48 + Else.if getH Then + y*=10 + y+=eval(whitespace, 0)-48 + Else.if getV Then + v*=10 + v+=eval(whitespace, 0)-48 + End If + } + End Select + End If + iF eof(f) Then Error "Not a ppm file" + until getV=false + Else + Error "Not a P6 ppm or P5 ppm file" + End If + Import=True + End if + Else + Error "No proper arguments" + End If + if x<1 or y<1 Then Error "Wrong dimensions" + Buffer Clear Pad1 As Byte*3 + structure rgb { + red As Byte + green As Byte + blue As Byte + } + m=len(rgb)*x mod 4 + if m>0 Then m=4-m ' add some bytes To raster line + m+=len(rgb) *x + Structure rasterline { + { + pad As Byte*m + } + hline As rgb*x + } + Structure Raster { + magic As integer*4 + w As integer*4 + h As integer*4 + { + linesB As Byte*len(rasterline)*y + } + lines As rasterline*y + } + Buffer Clear Image1 As Raster + Return Image1, 0!magic:="cDIB", 0!w:=Hex$(x,2), 0!h:=Hex$(y, 2) + if not Import Then Return Image1, 0!lines:=Str$(String$(chrcode$(255), Len(rasterline)*y)) + Buffer Clear Pad As Byte*4 + aLines=Len(Raster)-Len(Rasterline)-Raster("linesB") + blines=-Len(Rasterline) + if Import Then + x0=x-1 : where=0 + Buffer Pad1 As Byte*3 + Buffer Pad2 As Byte + local rasterline=x*3 + m=rasterline mod 4 : if m<>0 Then rasterline+=4-m + For y1=y-1 To 0 + where=rasterline*y1 + For x1=0 To x0 + if p5 Then + Get #f, Pad2: m=eval(Pad2,0) : Return pad1, 0:=m, 1:=m, 2:=m + Else + Get #f, Pad1 : Push Eval(pad1, 2) : Return pad1, 2:=Eval(pad1, 0), 0:=Number + End if + Image1|linesB[where]=Pad1[0, 3] : where+=3 + Next + Next + End if + } + SetPixel=Lambda Image1, Pad, aLines, blines (x, y, c) ->{ + if c>0 Then c=color(c) + c-! + Return Pad, 0:=c As long + Push pad[2] : pad[2]=pad[0]: pad[0]=Number + Image1|linesB[alines+3*x+blines*y]=Pad[0, 3] + } + GetPixel=Lambda Image1,aLines, blines, Pad1 (x,y) ->{ + Pad1[0]=Image1|linesB[alines+3*x+blines*y, 3] + =color(Pad1[2], Pad1[1],Pad1[0]) + } + GetPixelGray=Lambda Image1,aLines, blines, Pad1 (x,y) ->{ + Pad1[0]=Image1|linesB[alines+3*x+blines*y, 3] + grayval=round(0.2126*Pad1[2] + 0.7152*Pad1[1] + 0.0722*Pad1[0], 0) + =color(grayval,grayval,grayval) + } + Image$=Lambda$ Image1, Raster ->Eval$(Image1, 0, Len(Raster)) + Copy=Lambda Image1 (image$) -> { + if left$(image$,12)=Image1[0, 24] Then + Return Image1, 0:=Image$ + Else + Error "Can't Copy Image" + End if + } + ToFile=Lambda Image1, x, y (f) -> { + Print #f, "P6";chr$(10);"# Created using M2000 Interpreter";chr$(10); + Print #f, x;" ";y;" 255";chr$(10); + x2=x-1 : where=0 : rasterline=x*3 + m=rasterline mod 4 : if m<>0 Then rasterline+=4-m + Buffer pad As Byte*3 + For y1=y-1 To 0 + where=rasterline*y1 + For x1=0 To x2 + pad[0]=image1|linesB[where, 3] + Push pad[2] : pad[2]=pad[0]: pad[0]=Number + Put #f, pad : where+=3 + Next + Next + } + ToFileGray=Lambda Image1, x, y (f) -> { + Print #f, "P5";chr$(10);"# Created using M2000 Interpreter";chr$(10); + Print #f, x;" ";y;" 255";chr$(10); + x2=x-1 : where=0 : rasterline=x*3 + m=rasterline mod 4 : if m<>0 Then rasterline+=4-m + Buffer pad As Byte*3 + Buffer bytepad As Byte + const R=0.2126, G=0.7152, B=0.0722 + For y1=y-1 To 0 + where=rasterline*y1 + For x1=0 To x2 + Return pad, 0:=eval$(image1, 0!linesB!where, 3) + Return bytepad, 0:=round(R*Eval(pad, 2) + G*Eval(pad, 1) + B*Eval(pad, 0), 0) + Put #f, bytepad : where+=3 + Next + Next + } + } + Cls 5,0 + A=Bitmap(15,10) + B=Bitmap(15,10) + c1=color(100, 200, 255) + c2=color(180, 250, 128) + For i=0 To 8 + Call A.SetPixel(i, i, c1) + Call A.SetPixel(9, i,c2) + Next + Call A.SetPixel(i,i,c1) + // make a new one GrayScale (but 24bit) As B + For i=0 To 14 { For J=0 To 9 {Call B.SetPixel(i, j, A.GetPixelGray(i,j))}} + // place image A at 200 pixel from left margin, 100 pixel from top margin + Copy 200*twipsX, 100*twipsY use A.Image$(), 0, 800 ' zoom 800%, angle 0 + // place image B at 400 pixel from left margin, 100 pixel from top margin + Copy 400*twipsX, 100*twipsY use B.Image$(), 0, 800 ' zoom 800% + Try { + Open "P6example.ppm" For Output As #f + Call A.Tofile(f) + Close #f + Open "P5example.ppm" For Output As #f + Call A.TofileGray(f) + Close #f + Open "P5example.ppm" For Input As #f + C=Bitmap(f) + close #f + Copy 600*twipsX, 100*twipsY use C.Image$(), 0, 800 ' zoom 800% + Open "P6example.ppm" For Input As #f + C=Bitmap(f) + close #f + // use of Top clause To make the border color transparent at rotation + Copy 800*twipsX, 100*twipsY top C.Image$(), 30, 800 ' zoom 800%, angle 30 degree + } + Print "Done" } P6P5 diff --git a/Task/Grayscale-image/MiniScript/grayscale-image.mini b/Task/Grayscale-image/MiniScript/grayscale-image.mini new file mode 100644 index 0000000000..062d6fb5d8 --- /dev/null +++ b/Task/Grayscale-image/MiniScript/grayscale-image.mini @@ -0,0 +1,34 @@ +greyedColor = function(colr) + clist = color.toList(colr) + lum = [0.2126, 0.7152, 0.0722] + + red = clist[0] * lum[0] + green = clist[1] * lum[1] + blue = clist[2] * lum[2] + grey = red + green + blue + return color.fromList([grey, grey, grey, clist[3]]) +end function + +toGreyScale = function(img) + greyImg = Image.create(img.width, img.height) + for x in range(0, img.width - 1) + for y in range(0, img.height - 1) + greyed = greyedColor(img.pixel(x, y)) + greyImg.setPixel x, y, greyed + end for + end for + return greyImg +end function + +clear + +// The turtle and color wheel images are included with MiniMicro +turtle = file.loadImage("/sys/pics/animals/turtle.png") +greyTurtle = toGreyScale(turtle) +gfx.drawImage turtle, 0, 0 +gfx.drawImage greyTurtle, turtle.width, 0 + +colorWheel = file.loadImage("/sys/pics/ColorWheel.png") +greyWheel = toGreyScale(colorWheel) +gfx.drawImage colorWheel, 0, 320 +gfx.drawImage greyWheel, greyWheel.width, 320 diff --git a/Task/Grayscale-image/OCaml/grayscale-image-1.ocaml b/Task/Grayscale-image/OCaml/grayscale-image-1.ml similarity index 100% rename from Task/Grayscale-image/OCaml/grayscale-image-1.ocaml rename to Task/Grayscale-image/OCaml/grayscale-image-1.ml diff --git a/Task/Grayscale-image/OCaml/grayscale-image-2.ocaml b/Task/Grayscale-image/OCaml/grayscale-image-2.ml similarity index 100% rename from Task/Grayscale-image/OCaml/grayscale-image-2.ocaml rename to Task/Grayscale-image/OCaml/grayscale-image-2.ml diff --git a/Task/Grayscale-image/OCaml/grayscale-image-3.ocaml b/Task/Grayscale-image/OCaml/grayscale-image-3.ml similarity index 100% rename from Task/Grayscale-image/OCaml/grayscale-image-3.ocaml rename to Task/Grayscale-image/OCaml/grayscale-image-3.ml diff --git a/Task/Greatest-common-divisor/ALGOL-68/greatest-common-divisor.alg b/Task/Greatest-common-divisor/ALGOL-68/greatest-common-divisor.alg index 2e357e0524..1f11565746 100644 --- a/Task/Greatest-common-divisor/ALGOL-68/greatest-common-divisor.alg +++ b/Task/Greatest-common-divisor/ALGOL-68/greatest-common-divisor.alg @@ -1,17 +1,24 @@ -PROC gcd = (INT a, b) INT: ( - IF a = 0 THEN - b - ELIF b = 0 THEN - a - ELIF a > b THEN - gcd(b, a MOD b) - ELSE - gcd(a, b MOD a) - FI -); -test:( - INT a = 33, b = 77; - printf(($x"The gcd of"g" and "g" is "gl$,a,b,gcd(a,b))); - INT c = 49865, d = 69811; - printf(($x"The gcd of"g" and "g" is "gl$,c,d,gcd(c,d))) -) +BEGIN + PROC gcd = (INT m, n) INT: ( + IF INT a = ABS m, b = ABS n; + a = 0 + THEN + b + ELIF b = 0 THEN + a + ELIF a > b THEN + gcd(b, a MOD b) + ELSE + gcd(a, b MOD a) + FI + ); + test:( + FOR a FROM 33 BY -33 TO -33 DO + FOR b FROM 77 BY -77 TO -77 DO + print(("The gcd of ", whole(a,-6)," and ", whole(b,-6)," is ", whole(gcd(a,b),-6),newline)) + OD + OD; + INT c = 49865, d = 69811; + print(("The gcd of ", whole(c,-6)," and ", whole(d,-6)," is ", whole(gcd(c,d),-6),newline)) + ) +END diff --git a/Task/Greatest-common-divisor/Ada/greatest-common-divisor.ada b/Task/Greatest-common-divisor/Ada/greatest-common-divisor.adb similarity index 100% rename from Task/Greatest-common-divisor/Ada/greatest-common-divisor.ada rename to Task/Greatest-common-divisor/Ada/greatest-common-divisor.adb diff --git a/Task/Greatest-common-divisor/AutoIt/greatest-common-divisor.autoit b/Task/Greatest-common-divisor/AutoIt/greatest-common-divisor.au3 similarity index 100% rename from Task/Greatest-common-divisor/AutoIt/greatest-common-divisor.autoit rename to Task/Greatest-common-divisor/AutoIt/greatest-common-divisor.au3 diff --git a/Task/Greatest-common-divisor/Ballerina/greatest-common-divisor.ballerina b/Task/Greatest-common-divisor/Ballerina/greatest-common-divisor.ballerina new file mode 100644 index 0000000000..e203dc5ef4 --- /dev/null +++ b/Task/Greatest-common-divisor/Ballerina/greatest-common-divisor.ballerina @@ -0,0 +1,21 @@ +import ballerina/io; + +function gcd(int u, int v) returns int { + int _u = u; + int _v = v; + while _v != 0 { + [_u, _v] = [_v, _u % _v]; + } + return _u.abs(); +} + +public function main() { + io:println(gcd(0, 0)); + io:println(gcd(0, 10)); + io:println(gcd(0, -10)); + io:println(gcd(9, 6)); + io:println(gcd(6, 9)); + io:println(gcd(-6, 9)); + io:println(gcd(8, 45)); + io:println(gcd(40902, 24140)); +} diff --git a/Task/Greatest-common-divisor/Bruijn/greatest-common-divisor.bruijn b/Task/Greatest-common-divisor/Bruijn/greatest-common-divisor.bruijn new file mode 100644 index 0000000000..37bbb66bb1 --- /dev/null +++ b/Task/Greatest-common-divisor/Bruijn/greatest-common-divisor.bruijn @@ -0,0 +1,8 @@ +:import std/Combinator . +:import std/Number . + +gcd y [[[=?0 1 (2 0 (1 % 0))]]] + +:test ((gcd (+2) (+4)) =? (+2)) ([[1]]) +:test ((gcd (+10) (+5)) =? (+5)) ([[1]]) +:test ((gcd (+3) (+8)) =? (+1)) ([[1]]) diff --git a/Task/Greatest-common-divisor/COBOL/greatest-common-divisor.cobol b/Task/Greatest-common-divisor/COBOL/greatest-common-divisor.cob similarity index 100% rename from Task/Greatest-common-divisor/COBOL/greatest-common-divisor.cobol rename to Task/Greatest-common-divisor/COBOL/greatest-common-divisor.cob diff --git a/Task/Greatest-common-divisor/Chipmunk-Basic/greatest-common-divisor.basic b/Task/Greatest-common-divisor/Chipmunk-Basic/greatest-common-divisor.basic new file mode 100644 index 0000000000..b633cc3739 --- /dev/null +++ b/Task/Greatest-common-divisor/Chipmunk-Basic/greatest-common-divisor.basic @@ -0,0 +1,15 @@ +100 cls +110 a = 40902 +120 b = 24140 +130 print : print "GCD(";a;", ";b;") = ";gcdi(a,b) +140 print : print "GCD(";a;", 111) = ";gcdi(a,111) +170 end + +190 sub gcdi(x,y) +200 while y +210 t = y +220 y = x mod y +230 x = t +240 wend +250 gcdi = x +260 end sub diff --git a/Task/Greatest-common-divisor/Crystal/greatest-common-divisor.cr b/Task/Greatest-common-divisor/Crystal/greatest-common-divisor.cr new file mode 100644 index 0000000000..f4717cf74a --- /dev/null +++ b/Task/Greatest-common-divisor/Crystal/greatest-common-divisor.cr @@ -0,0 +1 @@ +2345.gcd 5432 #=> 7 diff --git a/Task/Greatest-common-divisor/Dt/greatest-common-divisor.dt b/Task/Greatest-common-divisor/Dt/greatest-common-divisor.dt index e95a926f1c..52034fc15d 100644 --- a/Task/Greatest-common-divisor/Dt/greatest-common-divisor.dt +++ b/Task/Greatest-common-divisor/Dt/greatest-common-divisor.dt @@ -1,3 +1 @@ -[dup [dup rot % loop] swap do?] \loop def - -[loop drop] \gcd def +[[a b]: a [b a b % gcd] b do?] \gcd def diff --git a/Task/Greatest-common-divisor/DuckDB/greatest-common-divisor.duckdb b/Task/Greatest-common-divisor/DuckDB/greatest-common-divisor.duckdb new file mode 100644 index 0000000000..9114ccd611 --- /dev/null +++ b/Task/Greatest-common-divisor/DuckDB/greatest-common-divisor.duckdb @@ -0,0 +1,12 @@ +create or replace function mygcd(a0, b0) as ( + with recursive cte as ( + select a0 as a, b0 as b + union all + select b as a, mod(a,b) as b + from cte + where b != 0 + ) + select last(a) + from cte + where b=0 +); diff --git a/Task/Greatest-common-divisor/EMal/greatest-common-divisor.emal b/Task/Greatest-common-divisor/EMal/greatest-common-divisor.emal new file mode 100644 index 0000000000..bbb6e1a9ab --- /dev/null +++ b/Task/Greatest-common-divisor/EMal/greatest-common-divisor.emal @@ -0,0 +1,14 @@ +fun gcd ← int by int a, int b + while b ≠ 0 + int t ← b + b ← a % b + a ← t + end + return abs(a) +end +writeLine(gcd(0, 0)) +writeLine(gcd(0, -10)) +writeLine(gcd(-6, 9)) +writeLine(gcd(40902, 24140)) +writeLine(gcd(9360, 12240)) +writeLine(gcd(123456789, 987654321)) diff --git a/Task/Greatest-common-divisor/EasyLang/greatest-common-divisor.easy b/Task/Greatest-common-divisor/EasyLang/greatest-common-divisor.easy index 92078d6b8b..b66fa24d09 100644 --- a/Task/Greatest-common-divisor/EasyLang/greatest-common-divisor.easy +++ b/Task/Greatest-common-divisor/EasyLang/greatest-common-divisor.easy @@ -1,8 +1,7 @@ func gcd a b . while b <> 0 - h = b - b = a mod b - a = h + swap a b + b = b mod a . return a . diff --git a/Task/Greatest-common-divisor/Elena/greatest-common-divisor.elena b/Task/Greatest-common-divisor/Elena/greatest-common-divisor.elena index 8d3b778db8..07bf136003 100644 --- a/Task/Greatest-common-divisor/Elena/greatest-common-divisor.elena +++ b/Task/Greatest-common-divisor/Elena/greatest-common-divisor.elena @@ -17,10 +17,10 @@ gcd(a,b) printGCD(a,b) { - console.printLineFormatted("GCD of {0} and {1} is {2}", a, b, gcd(a,b)) + Console.printLineFormatted("GCD of {0} and {1} is {2}", a, b, gcd(a,b)) } -public program() +public Program() { printGCD(1,1); printGCD(1,10); diff --git a/Task/Greatest-common-divisor/Elixir/greatest-common-divisor.elixir b/Task/Greatest-common-divisor/Elixir/greatest-common-divisor.ex similarity index 100% rename from Task/Greatest-common-divisor/Elixir/greatest-common-divisor.elixir rename to Task/Greatest-common-divisor/Elixir/greatest-common-divisor.ex diff --git a/Task/Greatest-common-divisor/Elm/greatest-common-divisor.elm b/Task/Greatest-common-divisor/Elm/greatest-common-divisor.elm new file mode 100644 index 0000000000..600d41fbf4 --- /dev/null +++ b/Task/Greatest-common-divisor/Elm/greatest-common-divisor.elm @@ -0,0 +1,37 @@ +import Html exposing (Html, div, h1, p, text) +import Html.Attributes exposing (style) + + +-- Test cases + +nr1 : Int +nr1 = + 2 * 3 * 5 * 7 * 11 + + +nr2 : Int +nr2 = + 7 * 11 * 13 * 17 * 23 + + +main : Html msg +main = + div [ style "margin" "5%", style "font-size" "1.5em", style "color" "blue" ] + [ h1 [ style "font-size" "1.5em" ] [ text "GCD Calculator" ] + , text + ("number a = " + ++ String.fromInt nr1 + ++ ", number b = " + ++ String.fromInt nr2 + ) + , p [] [ text ("GCD = " ++ String.fromInt (gcd nr1 nr2)) ] + ] + + +gcd : Int -> Int -> Int +gcd anr bnr = + if bnr /= 0 then + gcd bnr (modBy bnr anr) + + else + abs anr diff --git a/Task/Greatest-common-divisor/Emacs-Lisp/greatest-common-divisor.l b/Task/Greatest-common-divisor/Emacs-Lisp/greatest-common-divisor.el similarity index 100% rename from Task/Greatest-common-divisor/Emacs-Lisp/greatest-common-divisor.l rename to Task/Greatest-common-divisor/Emacs-Lisp/greatest-common-divisor.el diff --git a/Task/Greatest-common-divisor/Euphoria/greatest-common-divisor-1.euphoria b/Task/Greatest-common-divisor/Euphoria/greatest-common-divisor-1.eu similarity index 100% rename from Task/Greatest-common-divisor/Euphoria/greatest-common-divisor-1.euphoria rename to Task/Greatest-common-divisor/Euphoria/greatest-common-divisor-1.eu diff --git a/Task/Greatest-common-divisor/Euphoria/greatest-common-divisor-2.euphoria b/Task/Greatest-common-divisor/Euphoria/greatest-common-divisor-2.eu similarity index 100% rename from Task/Greatest-common-divisor/Euphoria/greatest-common-divisor-2.euphoria rename to Task/Greatest-common-divisor/Euphoria/greatest-common-divisor-2.eu diff --git a/Task/Greatest-common-divisor/Euphoria/greatest-common-divisor-3.euphoria b/Task/Greatest-common-divisor/Euphoria/greatest-common-divisor-3.eu similarity index 100% rename from Task/Greatest-common-divisor/Euphoria/greatest-common-divisor-3.euphoria rename to Task/Greatest-common-divisor/Euphoria/greatest-common-divisor-3.eu diff --git a/Task/Greatest-common-divisor/F-Sharp/greatest-common-divisor.fs b/Task/Greatest-common-divisor/F-Sharp/greatest-common-divisor-1.fs similarity index 100% rename from Task/Greatest-common-divisor/F-Sharp/greatest-common-divisor.fs rename to Task/Greatest-common-divisor/F-Sharp/greatest-common-divisor-1.fs diff --git a/Task/Greatest-common-divisor/F-Sharp/greatest-common-divisor-2.fs b/Task/Greatest-common-divisor/F-Sharp/greatest-common-divisor-2.fs new file mode 100644 index 0000000000..121ed1a89b --- /dev/null +++ b/Task/Greatest-common-divisor/F-Sharp/greatest-common-divisor-2.fs @@ -0,0 +1,5 @@ +// GCD method attributed to Dijkstra. Nigel Galloway: February 7th., 2026. +let rec gcd n=function g when n=g->n + |g when ngcd (g-n) n + |g->gcd g (n-g) +printfn "%d, %d, %d" (gcd 23 13) (gcd 600 400) (gcd 0 0) diff --git a/Task/Greatest-common-divisor/Gleam/greatest-common-divisor.gleam b/Task/Greatest-common-divisor/Gleam/greatest-common-divisor.gleam new file mode 100644 index 0000000000..f5187521b9 --- /dev/null +++ b/Task/Greatest-common-divisor/Gleam/greatest-common-divisor.gleam @@ -0,0 +1,19 @@ +import gleam/int +import gleam/io + +pub fn main() { + gcd(40_902, 24_140) + |> int.to_string + |> io.println +} + +pub fn gcd(a, b) { + gcd_loop(int.absolute_value(a), int.absolute_value(b)) +} + +fn gcd_loop(a, b) { + case b { + 0 -> a + _ -> gcd_loop(b, a % b) + } +} diff --git a/Task/Greatest-common-divisor/J/greatest-common-divisor-3.j b/Task/Greatest-common-divisor/J/greatest-common-divisor-3.j index a4531536ed..f34b6cd4f7 100644 --- a/Task/Greatest-common-divisor/J/greatest-common-divisor-3.j +++ b/Task/Greatest-common-divisor/J/greatest-common-divisor-3.j @@ -1 +1 @@ -gcd=: (| gcd [)^:(0<[)&| +gcd=: (| $: [)^:(0<[)&| diff --git a/Task/Greatest-common-divisor/Julia/greatest-common-divisor.julia b/Task/Greatest-common-divisor/Julia/greatest-common-divisor.jl similarity index 100% rename from Task/Greatest-common-divisor/Julia/greatest-common-divisor.julia rename to Task/Greatest-common-divisor/Julia/greatest-common-divisor.jl diff --git a/Task/Greatest-common-divisor/Kotlin/greatest-common-divisor.kotlin b/Task/Greatest-common-divisor/Kotlin/greatest-common-divisor.kts similarity index 100% rename from Task/Greatest-common-divisor/Kotlin/greatest-common-divisor.kotlin rename to Task/Greatest-common-divisor/Kotlin/greatest-common-divisor.kts diff --git a/Task/Greatest-common-divisor/LOLCODE/greatest-common-divisor.lol b/Task/Greatest-common-divisor/LOLCODE/greatest-common-divisor.lol index 655b749ee7..b261e752da 100644 --- a/Task/Greatest-common-divisor/LOLCODE/greatest-common-divisor.lol +++ b/Task/Greatest-common-divisor/LOLCODE/greatest-common-divisor.lol @@ -1,36 +1,32 @@ HAI 1.3 -HOW IZ I gcd YR a AN YR b - a R BIGGR OF a AN PRODUKT OF a AN -1 BTW absolute value of a - b R BIGGR OF b AN PRODUKT OF b AN -1 BTW absolute value of b - BOTH SAEM a AN b, O RLY? - YA RLY - FOUND YR a - OIC - BOTH SAEM a AN 0, O RLY? - YA RLY - FOUND YR b - OIC - BOTH SAEM b AN 0, O RLY? - YA RLY - FOUND YR a - OIC - BOTH SAEM b AN BIGGR OF a AN b, O RLY? BTW make sure a is the larger of (a, b) - YA RLY - I HAS A temp ITZ a - a R b - b R temp - OIC - - IM IN YR loop - I HAS A temp ITZ b - b R MOD OF a AN b - a R temp - BOTH SAEM b AN 0, O RLY? - YA RLY - FOUND YR a - OIC - IM OUTTA YR loop +HOW IZ I gcd YR a AN YR b BTW ITERATIF GCD + a R BIGGR OF a AN PRODUKT OF a AN -1 BTW absolute value of a + b R BIGGR OF b AN PRODUKT OF b AN -1 BTW absolute value of b + BOTH SAEM a AN b, O RLY? + YA RLY + FOUND YR a + MEBBE BOTH SAEM a AN 0, + FOUND YR b + MEBBE BOTH SAEM b AN 0, + FOUND YR a + NO WAI + BOTH SAEM b AN BIGGR OF a AN b, O RLY? BTW make sure a is the larger of (a, b) + YA RLY + I HAS A temp ITZ a + a R b + b R temp + OIC + IM IN YR loop + I HAS A temp ITZ b + b R MOD OF a AN b + a R temp + BOTH SAEM b AN 0, O RLY? + YA RLY + FOUND YR a + OIC + IM OUTTA YR loop + OIC IF U SAY SO VISIBLE I IZ gcd YR 40902 AN YR 24140 MKAY diff --git a/Task/Greatest-common-divisor/Nu/greatest-common-divisor.nu b/Task/Greatest-common-divisor/Nu/greatest-common-divisor.nu new file mode 100644 index 0000000000..d2e0ca06ca --- /dev/null +++ b/Task/Greatest-common-divisor/Nu/greatest-common-divisor.nu @@ -0,0 +1,8 @@ +def 'math gcd' [] { + reduce {|x gcd| + generate { match $in { [$a 0] => {out: $a} [$a $b] => {next: [$b ($a mod $b)]} } } [$x $gcd] + | first + } +} + +[63 18 45] | math gcd diff --git a/Task/Greatest-common-divisor/OCaml/greatest-common-divisor-1.ocaml b/Task/Greatest-common-divisor/OCaml/greatest-common-divisor-1.ml similarity index 100% rename from Task/Greatest-common-divisor/OCaml/greatest-common-divisor-1.ocaml rename to Task/Greatest-common-divisor/OCaml/greatest-common-divisor-1.ml diff --git a/Task/Greatest-common-divisor/OCaml/greatest-common-divisor-2.ocaml b/Task/Greatest-common-divisor/OCaml/greatest-common-divisor-2.ml similarity index 100% rename from Task/Greatest-common-divisor/OCaml/greatest-common-divisor-2.ocaml rename to Task/Greatest-common-divisor/OCaml/greatest-common-divisor-2.ml diff --git a/Task/Greatest-common-divisor/Oberon/greatest-common-divisor.oberon b/Task/Greatest-common-divisor/Oberon/greatest-common-divisor.oberon deleted file mode 100644 index e81af17de6..0000000000 --- a/Task/Greatest-common-divisor/Oberon/greatest-common-divisor.oberon +++ /dev/null @@ -1,22 +0,0 @@ -MODULE GCD; -(* Greatest Common Divisor *) -IMPORT - Out; - - PROCEDURE Gcd(a,b: LONGINT):LONGINT; - VAR - r: LONGINT; - BEGIN - LOOP - r := a MOD b; - IF r = 0 THEN RETURN b END; - a := b;b := r - END - END Gcd; -BEGIN - Out.String("GCD of 12 and 8 : ");Out.LongInt(Gcd(12,8),4);Out.Ln; - Out.String("GCD of 100 and 5 : ");Out.LongInt(Gcd(100,5),4);Out.Ln; - Out.String("GCD of 7 and 23 : ");Out.LongInt(Gcd(7,23),4);Out.Ln; - Out.String("GCD of 24 and -112 : ");Out.LongInt(Gcd(12,8),4);Out.Ln; - Out.String("GCD of 40902 and 24140 : ");Out.LongInt(Gcd(40902,24140),4);Out.Ln -END GCD. diff --git a/Task/Greatest-common-divisor/Pascal/greatest-common-divisor.pas b/Task/Greatest-common-divisor/Pascal/greatest-common-divisor.pas new file mode 100644 index 0000000000..3766737710 --- /dev/null +++ b/Task/Greatest-common-divisor/Pascal/greatest-common-divisor.pas @@ -0,0 +1,17 @@ +program GCF (INPUT, OUTPUT); + var + a,b,c:integer; + begin + writeln('Enter 1st number'); + read(a); + writeln('Enter 2nd number'); + read(b); + while (a*b<>0) + do + begin + c:=a; + a:=b mod a; + b:=c; + end; + writeln('GCF :=', a+b ); + end. diff --git a/Task/Greatest-common-divisor/PascalABC.NET/greatest-common-divisor.pas b/Task/Greatest-common-divisor/PascalABC.NET/greatest-common-divisor.pas new file mode 100644 index 0000000000..7457c48563 --- /dev/null +++ b/Task/Greatest-common-divisor/PascalABC.NET/greatest-common-divisor.pas @@ -0,0 +1,18 @@ +function GCD(a,b: integer): integer; +begin + while b > 0 do + (a,b) := (b,a mod b); + Result := a; +end; + +function GCDRec(a,b: integer): integer; +begin + if b = 0 then + Result := a + else Result := GCDRec(b, a mod b); +end; + +begin + Println(GCD(72,30),GCDRec(72,30)); + Println(GCD(49865, 69811),GCDRec(49865, 69811)); +end. diff --git a/Task/Greatest-common-divisor/Pluto/greatest-common-divisor.pluto b/Task/Greatest-common-divisor/Pluto/greatest-common-divisor.pluto new file mode 100644 index 0000000000..9ead7fee31 --- /dev/null +++ b/Task/Greatest-common-divisor/Pluto/greatest-common-divisor.pluto @@ -0,0 +1,8 @@ +function gcd(a,b) + while b~=0 do + a,b=b,a%b + end + return a +end + +print(gcd(56,98)) diff --git a/Task/Greatest-common-divisor/PowerPC-Assembly/greatest-common-divisor.ppc b/Task/Greatest-common-divisor/PowerPC-Assembly/greatest-common-divisor.ppc new file mode 100644 index 0000000000..536b6851ed --- /dev/null +++ b/Task/Greatest-common-divisor/PowerPC-Assembly/greatest-common-divisor.ppc @@ -0,0 +1,123 @@ +#include +_gcd_string: + .ascii "gcd(" + _gcd_string_len = . - _gcd_string +_gcd_close_string: + .ascii ") = " + _gcd_close_string_len = . - _gcd_close_string + + .equiv STDIN, 0 + .equiv STDOUT, 1 + + .align 4 + .section ".text" + .global _start + .section ".opd","aw" + .align 3 +_start: + .quad ._start,.TOC.@tocbase,0 + .previous + .global ._start +._start: + li r30, 1071 + li r31, 1029 + # move the loaded values into the argument registers + mr r3, r30 + mr r4, r31 + bl gcd + # save the result for printing later + mr r29, r3 + addis r4, r2, _gcd_string@toc@ha + addi r4, r4, _gcd_string@toc@l + li r5, _gcd_string_len + bl print_string + mr r3, r30 + bl print_integer + li r3, ',' + bl print_char + mr r3, r31 + bl print_integer + addis r4, r2, _gcd_close_string@toc@ha + addi r4, r4, _gcd_close_string@toc@l + li r5, _gcd_close_string_len + bl print_string + mr r3, r29 + bl print_integer + li r3, '\n' + bl print_char + li r0,SYS_exit # syscall number (sys_exit) + li r3,0 # first argument: exit code + sc # call kernel + +gcd: + cmpd r3, r4 + bge _gcd + mr r5, r3 + mr r3, r4 + mr r4, r5 +_gcd: + cmpdi r4, 0 + beqlr + mr r5, r3 + mr r3, r4 + modud r4, r5, r4 + b _gcd + +# r4 is the address of the string +# r5 is the length of the string +print_string: + li r0, SYS_write + li r3, STDOUT + sc + blr + +print_char: + mr r4, r3 + li r0, SYS_write + li r3, STDOUT + stb r4, -1(sp) + addi r4, sp, -1 + li r5, 1 + sc + blr + +print_integer: + # r3 is the integer to print + # r4 is the working register + # r5 holds the current address to write to the string + # r6 is 10 for division operations + # r7 is working storage + mr r5, sp + li r6, 10 + neg r4, r3 + cmpdi r3, 0 + bne 1f + li r7, '0' + stbu r7, -1(r5) + b 3f +1: + isellt r4, r4, r3 # r4 = abs(r3) +1: + modsd r7, r4, r6 + divd r4, r4, r6 + addi r7, r7, '0' + stbu r7, -1(r5) + cmpdi r4, 0 + beq 1f + b 1b + +1: + cmpdi r3, 0 + blt 2f +3: + mr r4, r5 + subf r5, r5, sp + mflr r14 + bl print_string + mtlr r14 + blr + +2: + li r7, '-' + stbu r7, -1(r5) + b 3b diff --git a/Task/Greatest-common-divisor/PowerShell/greatest-common-divisor-1.psh b/Task/Greatest-common-divisor/PowerShell/greatest-common-divisor-1.ps1 similarity index 100% rename from Task/Greatest-common-divisor/PowerShell/greatest-common-divisor-1.psh rename to Task/Greatest-common-divisor/PowerShell/greatest-common-divisor-1.ps1 diff --git a/Task/Greatest-common-divisor/PowerShell/greatest-common-divisor-2.psh b/Task/Greatest-common-divisor/PowerShell/greatest-common-divisor-2.ps1 similarity index 100% rename from Task/Greatest-common-divisor/PowerShell/greatest-common-divisor-2.psh rename to Task/Greatest-common-divisor/PowerShell/greatest-common-divisor-2.ps1 diff --git a/Task/Greatest-common-divisor/PowerShell/greatest-common-divisor-3.psh b/Task/Greatest-common-divisor/PowerShell/greatest-common-divisor-3.ps1 similarity index 100% rename from Task/Greatest-common-divisor/PowerShell/greatest-common-divisor-3.psh rename to Task/Greatest-common-divisor/PowerShell/greatest-common-divisor-3.ps1 diff --git a/Task/Greatest-common-divisor/PureBasic/greatest-common-divisor-1.basic b/Task/Greatest-common-divisor/PureBasic/greatest-common-divisor-1.basic deleted file mode 100644 index 5c5743f69d..0000000000 --- a/Task/Greatest-common-divisor/PureBasic/greatest-common-divisor-1.basic +++ /dev/null @@ -1,9 +0,0 @@ -Procedure GCD(x, y) - Protected r - While y <> 0 - r = x % y - x = y - y = r - Wend - ProcedureReturn y -EndProcedure diff --git a/Task/Greatest-common-divisor/PureBasic/greatest-common-divisor-2.basic b/Task/Greatest-common-divisor/PureBasic/greatest-common-divisor-2.basic deleted file mode 100644 index 053fe34a33..0000000000 --- a/Task/Greatest-common-divisor/PureBasic/greatest-common-divisor-2.basic +++ /dev/null @@ -1,8 +0,0 @@ -Procedure GCD(x, y) - Protected r - r = x % y - If (r > 0) - y = GCD(y, r) - EndIf - ProcedureReturn y -EndProcedure diff --git a/Task/Greatest-common-divisor/PureBasic/greatest-common-divisor.basic b/Task/Greatest-common-divisor/PureBasic/greatest-common-divisor.basic new file mode 100644 index 0000000000..b29a94857f --- /dev/null +++ b/Task/Greatest-common-divisor/PureBasic/greatest-common-divisor.basic @@ -0,0 +1,16 @@ +Import "" ;msvcrt.lib + AbsI(Quad.q) As "_abs64" + AbsL(Long.l) As "labs" +EndImport +Procedure.i GCD(u.i, v.i) + Protected.i t + While v <> 0 + t = v + v = u % v + u = t + Wend + ProcedureReturn AbsI(u) ; Avoid float conversion with Abs(u). +EndProcedure +Debug GCD(18, 12) ; 6 +Debug GCD(1071, 1029) ; 21 +Debug GCD(3528, -3780) ; 252 diff --git a/Task/Greatest-common-divisor/Raku/greatest-common-divisor-3.raku b/Task/Greatest-common-divisor/Raku/greatest-common-divisor-3.raku index f46e0769f4..e3ead41f57 100644 --- a/Task/Greatest-common-divisor/Raku/greatest-common-divisor-3.raku +++ b/Task/Greatest-common-divisor/Raku/greatest-common-divisor-3.raku @@ -1 +1 @@ -my &gcd = { ($^a.abs, $^b.abs, * % * ... 0)[*-2] } +{ $^b ?? &?BLOCK( $^b, $^a % $^b ) !! $^a } diff --git a/Task/Greatest-common-divisor/Raku/greatest-common-divisor-4.raku b/Task/Greatest-common-divisor/Raku/greatest-common-divisor-4.raku index 7d7fe222da..f46e0769f4 100644 --- a/Task/Greatest-common-divisor/Raku/greatest-common-divisor-4.raku +++ b/Task/Greatest-common-divisor/Raku/greatest-common-divisor-4.raku @@ -1 +1 @@ -my $gcd = $a gcd $b; +my &gcd = { ($^a.abs, $^b.abs, * % * ... 0)[*-2] } diff --git a/Task/Greatest-common-divisor/Raku/greatest-common-divisor-5.raku b/Task/Greatest-common-divisor/Raku/greatest-common-divisor-5.raku index cd9880fbea..7d7fe222da 100644 --- a/Task/Greatest-common-divisor/Raku/greatest-common-divisor-5.raku +++ b/Task/Greatest-common-divisor/Raku/greatest-common-divisor-5.raku @@ -1,4 +1 @@ -[gcd] @list; # reduce with gcd -@alist Zgcd @blist; # lazy zip with gcd -@alist Xgcd @blist; # lazy cross with gcd -@alist »gcd« @blist; # parallel gcd +my $gcd = $a gcd $b; diff --git a/Task/Greatest-common-divisor/Raku/greatest-common-divisor-6.raku b/Task/Greatest-common-divisor/Raku/greatest-common-divisor-6.raku new file mode 100644 index 0000000000..cd9880fbea --- /dev/null +++ b/Task/Greatest-common-divisor/Raku/greatest-common-divisor-6.raku @@ -0,0 +1,4 @@ +[gcd] @list; # reduce with gcd +@alist Zgcd @blist; # lazy zip with gcd +@alist Xgcd @blist; # lazy cross with gcd +@alist »gcd« @blist; # parallel gcd diff --git a/Task/Greatest-common-divisor/REBOL/greatest-common-divisor.rebol b/Task/Greatest-common-divisor/Rebol/greatest-common-divisor.rebol similarity index 100% rename from Task/Greatest-common-divisor/REBOL/greatest-common-divisor.rebol rename to Task/Greatest-common-divisor/Rebol/greatest-common-divisor.rebol diff --git a/Task/Greatest-common-divisor/Refal/greatest-common-divisor.refal b/Task/Greatest-common-divisor/Refal/greatest-common-divisor.refal new file mode 100644 index 0000000000..91066da551 --- /dev/null +++ b/Task/Greatest-common-divisor/Refal/greatest-common-divisor.refal @@ -0,0 +1,8 @@ +$ENTRY Go { + = >; +}; + +Gcd { + s.M 0 = s.M; + s.M s.N = >; +}; diff --git a/Task/Greatest-common-divisor/Rust/greatest-common-divisor-1.rust b/Task/Greatest-common-divisor/Rust/greatest-common-divisor-1.rs similarity index 100% rename from Task/Greatest-common-divisor/Rust/greatest-common-divisor-1.rust rename to Task/Greatest-common-divisor/Rust/greatest-common-divisor-1.rs diff --git a/Task/Greatest-common-divisor/Rust/greatest-common-divisor-2.rust b/Task/Greatest-common-divisor/Rust/greatest-common-divisor-2.rs similarity index 100% rename from Task/Greatest-common-divisor/Rust/greatest-common-divisor-2.rust rename to Task/Greatest-common-divisor/Rust/greatest-common-divisor-2.rs diff --git a/Task/Greatest-common-divisor/Rust/greatest-common-divisor-3.rust b/Task/Greatest-common-divisor/Rust/greatest-common-divisor-3.rs similarity index 100% rename from Task/Greatest-common-divisor/Rust/greatest-common-divisor-3.rust rename to Task/Greatest-common-divisor/Rust/greatest-common-divisor-3.rs diff --git a/Task/Greatest-common-divisor/Rust/greatest-common-divisor-4.rust b/Task/Greatest-common-divisor/Rust/greatest-common-divisor-4.rs similarity index 100% rename from Task/Greatest-common-divisor/Rust/greatest-common-divisor-4.rust rename to Task/Greatest-common-divisor/Rust/greatest-common-divisor-4.rs diff --git a/Task/Greatest-common-divisor/Rust/greatest-common-divisor-5.rust b/Task/Greatest-common-divisor/Rust/greatest-common-divisor-5.rs similarity index 100% rename from Task/Greatest-common-divisor/Rust/greatest-common-divisor-5.rust rename to Task/Greatest-common-divisor/Rust/greatest-common-divisor-5.rs diff --git a/Task/Greatest-common-divisor/Scheme/greatest-common-divisor-1.ss b/Task/Greatest-common-divisor/Scheme/greatest-common-divisor-1.scm similarity index 100% rename from Task/Greatest-common-divisor/Scheme/greatest-common-divisor-1.ss rename to Task/Greatest-common-divisor/Scheme/greatest-common-divisor-1.scm diff --git a/Task/Greatest-common-divisor/Scheme/greatest-common-divisor-2.ss b/Task/Greatest-common-divisor/Scheme/greatest-common-divisor-2.scm similarity index 100% rename from Task/Greatest-common-divisor/Scheme/greatest-common-divisor-2.ss rename to Task/Greatest-common-divisor/Scheme/greatest-common-divisor-2.scm diff --git a/Task/Greatest-common-divisor/Uiua/greatest-common-divisor.uiua b/Task/Greatest-common-divisor/Uiua/greatest-common-divisor.uiua new file mode 100644 index 0000000000..cffa04c401 --- /dev/null +++ b/Task/Greatest-common-divisor/Uiua/greatest-common-divisor.uiua @@ -0,0 +1 @@ +⊙◌⍢(⤙˜◿|◡⋅>₀) diff --git a/Task/Greatest-common-divisor/VBScript/greatest-common-divisor.vb b/Task/Greatest-common-divisor/VBScript/greatest-common-divisor.vbs similarity index 100% rename from Task/Greatest-common-divisor/VBScript/greatest-common-divisor.vb rename to Task/Greatest-common-divisor/VBScript/greatest-common-divisor.vbs diff --git a/Task/Greatest-common-divisor/YAMLScript/greatest-common-divisor.ys b/Task/Greatest-common-divisor/YAMLScript/greatest-common-divisor.ys new file mode 100644 index 0000000000..b77cb8bd55 --- /dev/null +++ b/Task/Greatest-common-divisor/YAMLScript/greatest-common-divisor.ys @@ -0,0 +1,9 @@ +!YS-v0 + +defn main(a=42 b=63): + say: "gcd($a $b) -> $gcd(a b)" + +defn gcd(a b): + if b > 0: + recur b: a % b + else: a diff --git a/Task/Greatest-element-of-a-list/ALGOL-68/greatest-element-of-a-list.alg b/Task/Greatest-element-of-a-list/ALGOL-68/greatest-element-of-a-list.alg index 15570e56dd..fa4c980bbe 100644 --- a/Task/Greatest-element-of-a-list/ALGOL-68/greatest-element-of-a-list.alg +++ b/Task/Greatest-element-of-a-list/ALGOL-68/greatest-element-of-a-list.alg @@ -1,12 +1,7 @@ -# substitute any array type with a scalar element # -MODE FLT = REAL; +BEGIN +MODE FLT = REAL; # substitute any array type with ">" defined # -# create an exception for the case of an empty array # -PROC raise empty array = VOID:( - GO TO except empty array -); - -PROC max = ([]FLT item)FLT: +PROC max = ([]FLT item, PROC VOID raise empty array)FLT: BEGIN IF LWB item > UPB item THEN raise empty array; SKIP @@ -22,9 +17,11 @@ BEGIN FI END # max #; -test:( +#test#( []FLT buf = (-275.0, -111.19, 0.0, -1234568.0, pi, -pi); - print((max(buf),new line)) EXIT - except empty array: - SKIP + # handle an exception for the case of an empty array # + PROC have empty array = VOID:print(("empty array", newline)); + + print((max(buf,have empty array),new line)) ) +END diff --git a/Task/Greatest-element-of-a-list/Ada/greatest-element-of-a-list-1.ada b/Task/Greatest-element-of-a-list/Ada/greatest-element-of-a-list-1.adb similarity index 100% rename from Task/Greatest-element-of-a-list/Ada/greatest-element-of-a-list-1.ada rename to Task/Greatest-element-of-a-list/Ada/greatest-element-of-a-list-1.adb diff --git a/Task/Greatest-element-of-a-list/Ada/greatest-element-of-a-list-2.ada b/Task/Greatest-element-of-a-list/Ada/greatest-element-of-a-list-2.adb similarity index 100% rename from Task/Greatest-element-of-a-list/Ada/greatest-element-of-a-list-2.ada rename to Task/Greatest-element-of-a-list/Ada/greatest-element-of-a-list-2.adb diff --git a/Task/Greatest-element-of-a-list/Ada/greatest-element-of-a-list-3.ada b/Task/Greatest-element-of-a-list/Ada/greatest-element-of-a-list-3.adb similarity index 100% rename from Task/Greatest-element-of-a-list/Ada/greatest-element-of-a-list-3.ada rename to Task/Greatest-element-of-a-list/Ada/greatest-element-of-a-list-3.adb diff --git a/Task/Greatest-element-of-a-list/ArkScript/greatest-element-of-a-list.ark b/Task/Greatest-element-of-a-list/ArkScript/greatest-element-of-a-list.ark new file mode 100644 index 0000000000..9a3429517e --- /dev/null +++ b/Task/Greatest-element-of-a-list/ArkScript/greatest-element-of-a-list.ark @@ -0,0 +1,11 @@ +(let max (fun (L) { + (mut index 0) + (mut output nil) + + (while (< index (len L)) { + (if (or (nil? output) (> (@ L index) output)) + (set output (@ L index))) + (set index (+ 1 index)) }) + output })) + +(print (max [1 2 3 0 -5 42 0 1])) diff --git a/Task/Greatest-element-of-a-list/Ballerina/greatest-element-of-a-list.ballerina b/Task/Greatest-element-of-a-list/Ballerina/greatest-element-of-a-list.ballerina new file mode 100644 index 0000000000..bdfeabbf46 --- /dev/null +++ b/Task/Greatest-element-of-a-list/Ballerina/greatest-element-of-a-list.ballerina @@ -0,0 +1,11 @@ +import ballerina/io; + +function max(float[] a) returns float { + return float:max(...a); +} + +public function main() { + float[] a = [1.0, 2.3, 1.1, 5.0, + 3.0, 2.8, 2.01, 3.14159]; + io:println(max(a)); +} diff --git a/Task/Greatest-element-of-a-list/COBOL/greatest-element-of-a-list-1.cobol b/Task/Greatest-element-of-a-list/COBOL/greatest-element-of-a-list-1.cob similarity index 100% rename from Task/Greatest-element-of-a-list/COBOL/greatest-element-of-a-list-1.cobol rename to Task/Greatest-element-of-a-list/COBOL/greatest-element-of-a-list-1.cob diff --git a/Task/Greatest-element-of-a-list/COBOL/greatest-element-of-a-list-2.cobol b/Task/Greatest-element-of-a-list/COBOL/greatest-element-of-a-list-2.cob similarity index 100% rename from Task/Greatest-element-of-a-list/COBOL/greatest-element-of-a-list-2.cobol rename to Task/Greatest-element-of-a-list/COBOL/greatest-element-of-a-list-2.cob diff --git a/Task/Greatest-element-of-a-list/Crystal/greatest-element-of-a-list.crystal b/Task/Greatest-element-of-a-list/Crystal/greatest-element-of-a-list.cr similarity index 100% rename from Task/Greatest-element-of-a-list/Crystal/greatest-element-of-a-list.crystal rename to Task/Greatest-element-of-a-list/Crystal/greatest-element-of-a-list.cr diff --git a/Task/Greatest-element-of-a-list/Delphi/greatest-element-of-a-list.delphi b/Task/Greatest-element-of-a-list/Delphi/greatest-element-of-a-list.pas similarity index 100% rename from Task/Greatest-element-of-a-list/Delphi/greatest-element-of-a-list.delphi rename to Task/Greatest-element-of-a-list/Delphi/greatest-element-of-a-list.pas diff --git a/Task/Greatest-element-of-a-list/DuckDB/greatest-element-of-a-list-1.duckdb b/Task/Greatest-element-of-a-list/DuckDB/greatest-element-of-a-list-1.duckdb new file mode 100644 index 0000000000..4128a2435f --- /dev/null +++ b/Task/Greatest-element-of-a-list/DuckDB/greatest-element-of-a-list-1.duckdb @@ -0,0 +1 @@ +select list_max( [1.0, 2.0, 3.14] ) as max; diff --git a/Task/Greatest-element-of-a-list/DuckDB/greatest-element-of-a-list-2.duckdb b/Task/Greatest-element-of-a-list/DuckDB/greatest-element-of-a-list-2.duckdb new file mode 100644 index 0000000000..cef71412c4 --- /dev/null +++ b/Task/Greatest-element-of-a-list/DuckDB/greatest-element-of-a-list-2.duckdb @@ -0,0 +1 @@ +select list_max( [ ['a']::JSON, [{'a':0}]::JSON ] ) as max; diff --git a/Task/Greatest-element-of-a-list/DuckDB/greatest-element-of-a-list-3.duckdb b/Task/Greatest-element-of-a-list/DuckDB/greatest-element-of-a-list-3.duckdb new file mode 100644 index 0000000000..d018f76d12 --- /dev/null +++ b/Task/Greatest-element-of-a-list/DuckDB/greatest-element-of-a-list-3.duckdb @@ -0,0 +1,4 @@ +create or replace function max_list(l) as ( + list_reduce(l, (acc, x) -> greatest(acc,x)) +); +select max_list( [ ['b']::JSON, ['a']::JSON ]); diff --git a/Task/Greatest-element-of-a-list/EasyLang/greatest-element-of-a-list.easy b/Task/Greatest-element-of-a-list/EasyLang/greatest-element-of-a-list.easy index d65b41b634..3f347d9e3d 100644 --- a/Task/Greatest-element-of-a-list/EasyLang/greatest-element-of-a-list.easy +++ b/Task/Greatest-element-of-a-list/EasyLang/greatest-element-of-a-list.easy @@ -1,5 +1,3 @@ a[] = [ 2 9 4 3 8 5 ] -for e in a[] - max = higher e max -. +for e in a[] : max = higher e max print max diff --git a/Task/Greatest-element-of-a-list/Elena/greatest-element-of-a-list.elena b/Task/Greatest-element-of-a-list/Elena/greatest-element-of-a-list.elena index 7bc11c96f6..2572fdf43b 100644 --- a/Task/Greatest-element-of-a-list/Elena/greatest-element-of-a-list.elena +++ b/Task/Greatest-element-of-a-list/Elena/greatest-element-of-a-list.elena @@ -24,7 +24,7 @@ extension op } } -public program() +public Program() { console.printLine(new int[]{1,2,3,4,20,10,9,8}.Maximal) } diff --git a/Task/Greatest-element-of-a-list/Elixir/greatest-element-of-a-list.elixir b/Task/Greatest-element-of-a-list/Elixir/greatest-element-of-a-list.ex similarity index 100% rename from Task/Greatest-element-of-a-list/Elixir/greatest-element-of-a-list.elixir rename to Task/Greatest-element-of-a-list/Elixir/greatest-element-of-a-list.ex diff --git a/Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-1.l b/Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-1.el similarity index 100% rename from Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-1.l rename to Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-1.el diff --git a/Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-2.l b/Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-2.el similarity index 100% rename from Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-2.l rename to Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-2.el diff --git a/Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-3.l b/Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-3.el similarity index 100% rename from Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-3.l rename to Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-3.el diff --git a/Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-4.l b/Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-4.el similarity index 100% rename from Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-4.l rename to Task/Greatest-element-of-a-list/Emacs-Lisp/greatest-element-of-a-list-4.el diff --git a/Task/Greatest-element-of-a-list/Euphoria/greatest-element-of-a-list-1.euphoria b/Task/Greatest-element-of-a-list/Euphoria/greatest-element-of-a-list-1.eu similarity index 100% rename from Task/Greatest-element-of-a-list/Euphoria/greatest-element-of-a-list-1.euphoria rename to Task/Greatest-element-of-a-list/Euphoria/greatest-element-of-a-list-1.eu diff --git a/Task/Greatest-element-of-a-list/Euphoria/greatest-element-of-a-list-2.euphoria b/Task/Greatest-element-of-a-list/Euphoria/greatest-element-of-a-list-2.eu similarity index 100% rename from Task/Greatest-element-of-a-list/Euphoria/greatest-element-of-a-list-2.euphoria rename to Task/Greatest-element-of-a-list/Euphoria/greatest-element-of-a-list-2.eu diff --git a/Task/Greatest-element-of-a-list/Gleam/greatest-element-of-a-list-1.gleam b/Task/Greatest-element-of-a-list/Gleam/greatest-element-of-a-list-1.gleam new file mode 100644 index 0000000000..26e97484fa --- /dev/null +++ b/Task/Greatest-element-of-a-list/Gleam/greatest-element-of-a-list-1.gleam @@ -0,0 +1,8 @@ +import gleam/int +import gleam/list + +pub fn main() { + [1, 99, 136, 4, 3, 22, 111] + |> list.max(int.compare) + |> echo +} diff --git a/Task/Greatest-element-of-a-list/Gleam/greatest-element-of-a-list-2.gleam b/Task/Greatest-element-of-a-list/Gleam/greatest-element-of-a-list-2.gleam new file mode 100644 index 0000000000..24bda4cd6a --- /dev/null +++ b/Task/Greatest-element-of-a-list/Gleam/greatest-element-of-a-list-2.gleam @@ -0,0 +1,20 @@ +pub fn max( + over list: List(a), + with compare: fn(a, a) -> Order, +) -> Result(a, Nil) { + case list { + [] -> Error(Nil) + [first, ..rest] -> Ok(max_loop(rest, compare, first)) + } +} + +fn max_loop(list, compare, max) { + case list { + [] -> max + [first, ..rest] -> + case compare(first, max) { + order.Gt -> max_loop(rest, compare, first) + order.Lt | order.Eq -> max_loop(rest, compare, max) + } + } +} diff --git a/Task/Greatest-element-of-a-list/Julia/greatest-element-of-a-list.julia b/Task/Greatest-element-of-a-list/Julia/greatest-element-of-a-list.jl similarity index 100% rename from Task/Greatest-element-of-a-list/Julia/greatest-element-of-a-list.julia rename to Task/Greatest-element-of-a-list/Julia/greatest-element-of-a-list.jl diff --git a/Task/Greatest-element-of-a-list/Komodo/greatest-element-of-a-list.komodo b/Task/Greatest-element-of-a-list/Komodo/greatest-element-of-a-list.komodo new file mode 100644 index 0000000000..8ecd71f500 --- /dev/null +++ b/Task/Greatest-element-of-a-list/Komodo/greatest-element-of-a-list.komodo @@ -0,0 +1,8 @@ +let max([first|tail]) := max(first, tail) +let max(curMax, []) := curMax +let max(curMax, [first|tail]) := max( + if curMax > first then curMax else first, + tail, +) + +assert(max([3, 5, 7, 2, 4, 8, -1]) = 8) diff --git a/Task/Greatest-element-of-a-list/Kotlin/greatest-element-of-a-list.kotlin b/Task/Greatest-element-of-a-list/Kotlin/greatest-element-of-a-list.kts similarity index 100% rename from Task/Greatest-element-of-a-list/Kotlin/greatest-element-of-a-list.kotlin rename to Task/Greatest-element-of-a-list/Kotlin/greatest-element-of-a-list.kts diff --git a/Task/Greatest-element-of-a-list/Nu/greatest-element-of-a-list.nu b/Task/Greatest-element-of-a-list/Nu/greatest-element-of-a-list.nu new file mode 100644 index 0000000000..82d037d42d --- /dev/null +++ b/Task/Greatest-element-of-a-list/Nu/greatest-element-of-a-list.nu @@ -0,0 +1 @@ +[1 5 3 11 7] | math max diff --git a/Task/Greatest-element-of-a-list/OCaml/greatest-element-of-a-list.ocaml b/Task/Greatest-element-of-a-list/OCaml/greatest-element-of-a-list.ml similarity index 100% rename from Task/Greatest-element-of-a-list/OCaml/greatest-element-of-a-list.ocaml rename to Task/Greatest-element-of-a-list/OCaml/greatest-element-of-a-list.ml diff --git a/Task/Greatest-element-of-a-list/PascalABC.NET/greatest-element-of-a-list.pas b/Task/Greatest-element-of-a-list/PascalABC.NET/greatest-element-of-a-list.pas new file mode 100644 index 0000000000..c2ed38704b --- /dev/null +++ b/Task/Greatest-element-of-a-list/PascalABC.NET/greatest-element-of-a-list.pas @@ -0,0 +1,3 @@ +## +var values := Lst(1,7,4,6,3,5,2,6); +values.Max.Print; diff --git a/Task/Greatest-element-of-a-list/Pluto/greatest-element-of-a-list.pluto b/Task/Greatest-element-of-a-list/Pluto/greatest-element-of-a-list.pluto new file mode 100644 index 0000000000..794b3bbaf6 --- /dev/null +++ b/Task/Greatest-element-of-a-list/Pluto/greatest-element-of-a-list.pluto @@ -0,0 +1,2 @@ +local list = {42, 7, -5, 11.7, 58, 22.31, 59, -18} +print(list:max()) diff --git a/Task/Greatest-element-of-a-list/PowerShell/greatest-element-of-a-list.psh b/Task/Greatest-element-of-a-list/PowerShell/greatest-element-of-a-list.ps1 similarity index 100% rename from Task/Greatest-element-of-a-list/PowerShell/greatest-element-of-a-list.psh rename to Task/Greatest-element-of-a-list/PowerShell/greatest-element-of-a-list.ps1 diff --git a/Task/Greatest-element-of-a-list/REBOL/greatest-element-of-a-list.rebol b/Task/Greatest-element-of-a-list/REBOL/greatest-element-of-a-list.rebol deleted file mode 100644 index 952008c20e..0000000000 --- a/Task/Greatest-element-of-a-list/REBOL/greatest-element-of-a-list.rebol +++ /dev/null @@ -1,14 +0,0 @@ -REBOL [ - Title: "Maximum Value" - URL: http://rosettacode.org/wiki/Maximum_Value -] - -max: func [ - "Find maximum value in a list." - values [series!] "List of values." -] [ - first maximum-of values -] - -print ["Max of" mold d: [5 4 3 2 1] "is" max d] -print ["Max of" mold d: [-5 -4 -3 -2 -1] "is" max d] diff --git a/Task/Greatest-element-of-a-list/Rebol/greatest-element-of-a-list-1.rebol b/Task/Greatest-element-of-a-list/Rebol/greatest-element-of-a-list-1.rebol new file mode 100644 index 0000000000..8adb252ada --- /dev/null +++ b/Task/Greatest-element-of-a-list/Rebol/greatest-element-of-a-list-1.rebol @@ -0,0 +1,14 @@ +Rebol [ + Title: "Maximum Value" + URL: http://rosettacode.org/wiki/Maximum_Value +] + +max: func [ + "Find maximum value in a list." + values [series!] "List of values." +] [ + first maximum-of values +] + +print ["Max of" mold d: [5 4 3 2 1] "is" max d] +print ["Max of" mold d: [-5 -4 -3 -2 -1] "is" max d] diff --git a/Task/Greatest-element-of-a-list/Rebol/greatest-element-of-a-list-2.rebol b/Task/Greatest-element-of-a-list/Rebol/greatest-element-of-a-list-2.rebol new file mode 100644 index 0000000000..1fc5e0cfa9 --- /dev/null +++ b/Task/Greatest-element-of-a-list/Rebol/greatest-element-of-a-list-2.rebol @@ -0,0 +1,2 @@ +print last sort [1 2 3 5 4] +;== 5 diff --git a/Task/Greatest-element-of-a-list/Rebol/greatest-element-of-a-list-3.rebol b/Task/Greatest-element-of-a-list/Rebol/greatest-element-of-a-list-3.rebol new file mode 100644 index 0000000000..3fcee66127 --- /dev/null +++ b/Task/Greatest-element-of-a-list/Rebol/greatest-element-of-a-list-3.rebol @@ -0,0 +1,9 @@ +vect: #(i16! [1 2 9 2 4]) +vect/maximum +;== 9 +query vect 'max +;== 9 +query vect [maximum minimum] +;== [maximum: 9 minimum: 1] +query vect [:maximum :minimum] +;== [9 1] diff --git a/Task/Greatest-element-of-a-list/Rust/greatest-element-of-a-list.rust b/Task/Greatest-element-of-a-list/Rust/greatest-element-of-a-list.rs similarity index 100% rename from Task/Greatest-element-of-a-list/Rust/greatest-element-of-a-list.rust rename to Task/Greatest-element-of-a-list/Rust/greatest-element-of-a-list.rs diff --git a/Task/Greatest-element-of-a-list/Rye/greatest-element-of-a-list.rye b/Task/Greatest-element-of-a-list/Rye/greatest-element-of-a-list.rye new file mode 100644 index 0000000000..aa0ce27a2a --- /dev/null +++ b/Task/Greatest-element-of-a-list/Rye/greatest-element-of-a-list.rye @@ -0,0 +1 @@ +print max { 3 22 4 9 10 } diff --git a/Task/Greatest-element-of-a-list/Scheme/greatest-element-of-a-list.ss b/Task/Greatest-element-of-a-list/Scheme/greatest-element-of-a-list.scm similarity index 100% rename from Task/Greatest-element-of-a-list/Scheme/greatest-element-of-a-list.ss rename to Task/Greatest-element-of-a-list/Scheme/greatest-element-of-a-list.scm diff --git a/Task/Greatest-element-of-a-list/TAV/greatest-element-of-a-list.tav b/Task/Greatest-element-of-a-list/TAV/greatest-element-of-a-list.tav new file mode 100644 index 0000000000..dedbbf5933 --- /dev/null +++ b/Task/Greatest-element-of-a-list/TAV/greatest-element-of-a-list.tav @@ -0,0 +1,4 @@ +main (parms):+ + ? parms.Count < 2 + parms =: 5, 2, 7, 11, 4, 99, 33 + print maximum of parms diff --git a/Task/Greatest-element-of-a-list/Tailspin/greatest-element-of-a-list-3.tailspin b/Task/Greatest-element-of-a-list/Tailspin/greatest-element-of-a-list-3.tailspin index e62dae2ed6..c1cd1001c7 100644 --- a/Task/Greatest-element-of-a-list/Tailspin/greatest-element-of-a-list-3.tailspin +++ b/Task/Greatest-element-of-a-list/Tailspin/greatest-element-of-a-list-3.tailspin @@ -1,2 +1,7 @@ -[1, 5, 20, 3, 9, 7] -> \(@: $(1); $(2..last)... -> # $@ ! when <$@..> do @: $;\) -> !OUT::write +[1, 5, 20, 3, 9, 7] -> \(@: $(1); + $(2..last)... -> # + $@ ! + + when <$@..> do @: $; +\) -> !OUT::write // outputs 20 diff --git a/Task/Greatest-element-of-a-list/Tailspin/greatest-element-of-a-list-4.tailspin b/Task/Greatest-element-of-a-list/Tailspin/greatest-element-of-a-list-4.tailspin index a330ba807a..92a2a4b411 100644 --- a/Task/Greatest-element-of-a-list/Tailspin/greatest-element-of-a-list-4.tailspin +++ b/Task/Greatest-element-of-a-list/Tailspin/greatest-element-of-a-list-4.tailspin @@ -1,8 +1,8 @@ -templates max - @: $(1); - $(2..last)... -> \(<$@max..> @max: $;\) -> !VOID - $@! -end max +[1, 5, 20, 3, 9, 7] -> templates + @ set $(1); + $(2..)... -> !# + $@ ! -[1, 5, 20, 3, 9, 7] -> max -> !OUT::write -// outputs 20 + when <|$@..> do @ set $; +end ! +-- outputs 20 diff --git a/Task/Greatest-element-of-a-list/Tailspin/greatest-element-of-a-list-5.tailspin b/Task/Greatest-element-of-a-list/Tailspin/greatest-element-of-a-list-5.tailspin new file mode 100644 index 0000000000..a330ba807a --- /dev/null +++ b/Task/Greatest-element-of-a-list/Tailspin/greatest-element-of-a-list-5.tailspin @@ -0,0 +1,8 @@ +templates max + @: $(1); + $(2..last)... -> \(<$@max..> @max: $;\) -> !VOID + $@! +end max + +[1, 5, 20, 3, 9, 7] -> max -> !OUT::write +// outputs 20 diff --git a/Task/Greatest-element-of-a-list/True-BASIC/greatest-element-of-a-list.basic b/Task/Greatest-element-of-a-list/True-BASIC/greatest-element-of-a-list.basic new file mode 100644 index 0000000000..cf549f2611 --- /dev/null +++ b/Task/Greatest-element-of-a-list/True-BASIC/greatest-element-of-a-list.basic @@ -0,0 +1,16 @@ +OPTION BASE 0 + +DIM vals(4) +LET vals(1) = 70.5 +LET vals(2) = 23.67 +LET vals(3) = 150.2 +LET vals(4) = 145 + +FUNCTION findmax + FOR x = 1 TO UBOUND(vals) + IF vals(x) > vals(x-1) THEN LET findmax = vals(x) + NEXT x +END FUNCTION + +PRINT findmax +END diff --git a/Task/Greatest-element-of-a-list/VBScript/greatest-element-of-a-list.vb b/Task/Greatest-element-of-a-list/VBScript/greatest-element-of-a-list.vbs similarity index 100% rename from Task/Greatest-element-of-a-list/VBScript/greatest-element-of-a-list.vb rename to Task/Greatest-element-of-a-list/VBScript/greatest-element-of-a-list.vbs diff --git a/Task/Greatest-element-of-a-list/Zig/greatest-element-of-a-list.zig b/Task/Greatest-element-of-a-list/Zig/greatest-element-of-a-list.zig index 7dad1f9dc4..ea8499a79c 100644 --- a/Task/Greatest-element-of-a-list/Zig/greatest-element-of-a-list.zig +++ b/Task/Greatest-element-of-a-list/Zig/greatest-element-of-a-list.zig @@ -1,7 +1,8 @@ -fn max( a: []const f32) f32{ - var output = a[0]; - for(a)|num|{ - output = @max(output, num); - } -return output; +/// Asserts that `input` is not empty (len >= 1). +pub fn max(comptime T: type, input: []const T) T { + var max_elem: T = input[0]; + for (input[1..]) |elem| { + max_elem = @max(max_elem, elem); + } + return max_elem; } diff --git a/Task/Greatest-subsequential-sum/ALGOL-68/greatest-subsequential-sum.alg b/Task/Greatest-subsequential-sum/ALGOL-68/greatest-subsequential-sum.alg index 71d6e84d21..e720ed2065 100644 --- a/Task/Greatest-subsequential-sum/ALGOL-68/greatest-subsequential-sum.alg +++ b/Task/Greatest-subsequential-sum/ALGOL-68/greatest-subsequential-sum.alg @@ -1,4 +1,3 @@ -main: ( []INT a = (-1 , -2 , 3 , 5 , 6 , -2 , -1 , 4 , -4 , 2 , -1); @@ -23,7 +22,7 @@ main: OD; FOR i FROM begin max TO end max DO - print(a[i]) + print((" ",whole(a[i],0))) OD ) diff --git a/Task/Greatest-subsequential-sum/Ada/greatest-subsequential-sum.ada b/Task/Greatest-subsequential-sum/Ada/greatest-subsequential-sum.adb similarity index 100% rename from Task/Greatest-subsequential-sum/Ada/greatest-subsequential-sum.ada rename to Task/Greatest-subsequential-sum/Ada/greatest-subsequential-sum.adb diff --git a/Task/Greatest-subsequential-sum/Arturo/greatest-subsequential-sum.arturo b/Task/Greatest-subsequential-sum/Arturo/greatest-subsequential-sum.arturo index a1470d3426..59676b248e 100644 --- a/Task/Greatest-subsequential-sum/Arturo/greatest-subsequential-sum.arturo +++ b/Task/Greatest-subsequential-sum/Arturo/greatest-subsequential-sum.arturo @@ -17,8 +17,8 @@ subarraySum: function [arr][ lst: i ] ] - if? lst > fst -> return @[mx, slice arr fst lst] - else -> return [0, []] + switch lst > fst -> return @[mx, slice arr fst lst] + -> return [0, []] ] sequences: @[ diff --git a/Task/Greatest-subsequential-sum/AutoIt/greatest-subsequential-sum.autoit b/Task/Greatest-subsequential-sum/AutoIt/greatest-subsequential-sum.au3 similarity index 100% rename from Task/Greatest-subsequential-sum/AutoIt/greatest-subsequential-sum.autoit rename to Task/Greatest-subsequential-sum/AutoIt/greatest-subsequential-sum.au3 diff --git a/Task/Greatest-subsequential-sum/Ballerina/greatest-subsequential-sum.ballerina b/Task/Greatest-subsequential-sum/Ballerina/greatest-subsequential-sum.ballerina new file mode 100644 index 0000000000..3ee409c7ea --- /dev/null +++ b/Task/Greatest-subsequential-sum/Ballerina/greatest-subsequential-sum.ballerina @@ -0,0 +1,42 @@ +import ballerina/io; + +function gss(int[] s) returns [int[], int] { + int best = 0; + int strt = 0; + int end = 0; + int sum = 0; + int sumStart = 0; + foreach var [i, x] in s.enumerate() { + sum += x; + if sum > best { + best = sum; + strt = sumStart; + end = i + 1; + } else if sum < 0 { + sum = 0; + sumStart = i + 1; + } + } + return [s.slice(strt, end), best]; +} + +function A(any[] a) returns string { + return re `,`.replaceAll(a.toString(), ", "); +} + +public function main() { + var tests = [ + [-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1], + [-1, 1, 2, -5, -6], + [], + [-1, -2, -1] + ]; + foreach var test in tests { + io:println("Input: ", A(test)); + var res = gss(test); + var subSeq = res[0]; + int sum = res[1]; + io:println("Sub seq: ", A(subSeq)); + io:println("Sum: ", sum, "\n"); + } +} diff --git a/Task/Greatest-subsequential-sum/Crystal/greatest-subsequential-sum-1.crystal b/Task/Greatest-subsequential-sum/Crystal/greatest-subsequential-sum-1.cr similarity index 100% rename from Task/Greatest-subsequential-sum/Crystal/greatest-subsequential-sum-1.crystal rename to Task/Greatest-subsequential-sum/Crystal/greatest-subsequential-sum-1.cr diff --git a/Task/Greatest-subsequential-sum/Crystal/greatest-subsequential-sum-2.crystal b/Task/Greatest-subsequential-sum/Crystal/greatest-subsequential-sum-2.cr similarity index 100% rename from Task/Greatest-subsequential-sum/Crystal/greatest-subsequential-sum-2.crystal rename to Task/Greatest-subsequential-sum/Crystal/greatest-subsequential-sum-2.cr diff --git a/Task/Greatest-subsequential-sum/Crystal/greatest-subsequential-sum-3.crystal b/Task/Greatest-subsequential-sum/Crystal/greatest-subsequential-sum-3.cr similarity index 100% rename from Task/Greatest-subsequential-sum/Crystal/greatest-subsequential-sum-3.crystal rename to Task/Greatest-subsequential-sum/Crystal/greatest-subsequential-sum-3.cr diff --git a/Task/Greatest-subsequential-sum/DuckDB/greatest-subsequential-sum.duckdb b/Task/Greatest-subsequential-sum/DuckDB/greatest-subsequential-sum.duckdb new file mode 100644 index 0000000000..b989bd5e2b --- /dev/null +++ b/Task/Greatest-subsequential-sum/DuckDB/greatest-subsequential-sum.duckdb @@ -0,0 +1,32 @@ +create or replace function list_find_last_nonnegative(lst) as ( + select first(i) + from range(length(lst), 0, -1) t(i) + where lst[i] > 0 +); + +# Return the tuple (start, end, subtotal) for the subsequence lst[start:end] +# having a maximal subtotal for the given value of `start`. +# Initial negative numbers are ignored. +# It is assumed that the caller has taken care of trailing negative numbers. +create or replace function max_initial_subsequential_sum(lst, start) as ( + select max_by( (start,i,total), total) + from ( SELECT i, list_sum(lst[start:i]) as total + FROM range(start, length(lst)+1) t(i) + WHERE lst[start] >= 0 ) +); + +# If the list is empty or if the items are all negative, return [] +create or replace function subsequence_with_maximal_sum(lst) as ( + with cte as (select list_find_last_nonnegative(lst) as len) + select coalesce(max_by( lst[ mis[1]: mis[2]], mis[3] ), []) + from ( SELECT max_initial_subsequential_sum(lst,start) as mis + FROM (select unnest(range(1, 1 + len)) as start from cte) ) +); + +# Examples +select s, subsequence_with_maximal_sum(s) as subseq +from values + ([1,2,3,-1, 10]), + ([-1,2,3,-1, 10]), + ([-1,-2]), + ([]) as t(s); diff --git a/Task/Greatest-subsequential-sum/EasyLang/greatest-subsequential-sum.easy b/Task/Greatest-subsequential-sum/EasyLang/greatest-subsequential-sum.easy new file mode 100644 index 0000000000..90385e92e1 --- /dev/null +++ b/Task/Greatest-subsequential-sum/EasyLang/greatest-subsequential-sum.easy @@ -0,0 +1,21 @@ +proc max_subseq &seq[] &start &stop &maxsum . + maxsum = 0 + i = 1 + start = 1 + stop = 0 + for j to len seq[] + sum += seq[j] + if sum < 0 + i = j + 1 + sum = 0 + elif sum > maxsum + start = i + stop = j + maxsum = sum + . + . +. +a[] = [ -1 -2 3 5 6 -2 -1 4 -4 2 -1 ] +max_subseq a[] a b sum +print "Max sum = " & sum +for i = a to b : write a[i] & " " diff --git a/Task/Greatest-subsequential-sum/Elixir/greatest-subsequential-sum-1.elixir b/Task/Greatest-subsequential-sum/Elixir/greatest-subsequential-sum-1.ex similarity index 100% rename from Task/Greatest-subsequential-sum/Elixir/greatest-subsequential-sum-1.elixir rename to Task/Greatest-subsequential-sum/Elixir/greatest-subsequential-sum-1.ex diff --git a/Task/Greatest-subsequential-sum/Elixir/greatest-subsequential-sum-2.elixir b/Task/Greatest-subsequential-sum/Elixir/greatest-subsequential-sum-2.ex similarity index 100% rename from Task/Greatest-subsequential-sum/Elixir/greatest-subsequential-sum-2.elixir rename to Task/Greatest-subsequential-sum/Elixir/greatest-subsequential-sum-2.ex diff --git a/Task/Greatest-subsequential-sum/Elixir/greatest-subsequential-sum-3.elixir b/Task/Greatest-subsequential-sum/Elixir/greatest-subsequential-sum-3.ex similarity index 100% rename from Task/Greatest-subsequential-sum/Elixir/greatest-subsequential-sum-3.elixir rename to Task/Greatest-subsequential-sum/Elixir/greatest-subsequential-sum-3.ex diff --git a/Task/Greatest-subsequential-sum/Euphoria/greatest-subsequential-sum.euphoria b/Task/Greatest-subsequential-sum/Euphoria/greatest-subsequential-sum.eu similarity index 100% rename from Task/Greatest-subsequential-sum/Euphoria/greatest-subsequential-sum.euphoria rename to Task/Greatest-subsequential-sum/Euphoria/greatest-subsequential-sum.eu diff --git a/Task/Greatest-subsequential-sum/FutureBasic/greatest-subsequential-sum.basic b/Task/Greatest-subsequential-sum/FutureBasic/greatest-subsequential-sum.basic new file mode 100644 index 0000000000..836a0f87a4 --- /dev/null +++ b/Task/Greatest-subsequential-sum/FutureBasic/greatest-subsequential-sum.basic @@ -0,0 +1,64 @@ +_rndlen = 01 //BOOL: is sequence length random or fixed +_maxlen = 14 //Length of each/longest sequence +_maxVal = 20 //Largest number (pos or neg) in sequence +_repeat = 25 //Number of sequences to evaluate + +void local fn maxSubSequence + int i, j, seq(_maxlen), ndx(_maxlen + 1),sum(_maxlen) + int grp, maxSum, maxNdx, maxEnd, tot, iterations = _repeat + + while iterations + iterations-- + + // Create random sequence + int count = (_rndlen) ? rnd(_maxlen) : _maxlen + for i = 1 to count + seq(i) = rnd(_maxVal * 2 + 1) - _maxVal - 1 + next + + // Determine maximum sub-sequence + bool isNeg = yes : grp = 0 : sum(0) = 0 : ndx(0) = 0 + maxSum = 0 : maxNdx = 0 : maxEnd = 0 + + for i = 1 to count // Merge array into groups of like signs + if (seq(i) < 0) <> isNeg // If change of sign... + grp ++ // Start new group + isNeg = yes - isNeg + ndx(grp) = i + sum(grp) = 0 + end if + sum(grp) += seq(i) + next + ndx(grp + 1) = 0 + + for i = 1 to grp step 2 // Determine max sub-sequence + j = i : tot = sum(j) + do + if tot > maxSum + maxSum = tot + maxNdx = ndx(i) + maxEnd = ndx(j + 1) + end if + j += 2 : tot += sum(j - 1) + sum(j) // add next neg & pos groups + until j > grp + next + + // Print result + print @" Sum = "; maxSum, " {"; + for i = 1 to count + if i == maxNdx then text ,,, _zCyan + if i == maxEnd then text ,,, fn ColorClear + print " "; seq(i); " "; + next + text ,,, fn ColorClear + print "}" + + wend +end fn + +window 1, @"Maximum subsequence" +CFTimeInterval t : t = fn CACurrentMediaTime +fn maxSubSequence +printf @"\n %d random sequences created, solved, and printed in %.3f sec.",_repeat,1*(fn CACurrentMediaTime - t) + +handleevents diff --git a/Task/Greatest-subsequential-sum/Julia/greatest-subsequential-sum.julia b/Task/Greatest-subsequential-sum/Julia/greatest-subsequential-sum.jl similarity index 100% rename from Task/Greatest-subsequential-sum/Julia/greatest-subsequential-sum.julia rename to Task/Greatest-subsequential-sum/Julia/greatest-subsequential-sum.jl diff --git a/Task/Greatest-subsequential-sum/Kotlin/greatest-subsequential-sum.kotlin b/Task/Greatest-subsequential-sum/Kotlin/greatest-subsequential-sum.kts similarity index 100% rename from Task/Greatest-subsequential-sum/Kotlin/greatest-subsequential-sum.kotlin rename to Task/Greatest-subsequential-sum/Kotlin/greatest-subsequential-sum.kts diff --git a/Task/Greatest-subsequential-sum/Lua/greatest-subsequential-sum.lua b/Task/Greatest-subsequential-sum/Lua/greatest-subsequential-sum.lua index 23551e0e51..cbf5481d51 100644 --- a/Task/Greatest-subsequential-sum/Lua/greatest-subsequential-sum.lua +++ b/Task/Greatest-subsequential-sum/Lua/greatest-subsequential-sum.lua @@ -8,7 +8,25 @@ function maxsub(ary, idx) end local v = maxsub(ary, idx + 1) if maxsum < sumt(v, 1, #v) then return v end - local ret = {} - for i = idx, last do ret[#ret+1] = ary[i] end - return ret + local ret, allNegative = {}, true + for i = idx, last do + ret[#ret+1] = ary[i] + if ret[#ret] >= 0 then allNegative = false end + end + return allNegative and {} or ret end + +local function test(s) + local msub = maxsub(s) + print("["..table.concat(s, " ").."] -> ["..table.concat(msub, " ").."] sum: "..sumt(msub, 1, #msub)) +end + +-- test cases from 11l +test {-1, 2, -1} +test {-1, 2, -1, 3, -1} +test {-1, 1, 2, -5, -6} +test {-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1} + +-- additional test cases +test {-1, -2, -1} +test {} diff --git a/Task/Greatest-subsequential-sum/M2000-Interpreter/greatest-subsequential-sum-1.m2000 b/Task/Greatest-subsequential-sum/M2000-Interpreter/greatest-subsequential-sum-1.m2000 new file mode 100644 index 0000000000..1eb7221eed --- /dev/null +++ b/Task/Greatest-subsequential-sum/M2000-Interpreter/greatest-subsequential-sum-1.m2000 @@ -0,0 +1,26 @@ +module Greatest_subsequential_sum { + showGSS=lambda (a)->{ + function Greatest_subsequential_sum(a as array){ + s=a#sum() + =a + p=len(a)-1 + if p<0 then exit + for i=0 to p + for j=i to p + k= a#slice(i, j) + m=k#sum() + if m>s then =k: s=m + next + next + } + = "("+a#str$(",")+") -> ("+ Greatest_subsequential_sum(a)#str$(",")+")" + } + open "out.txt" for output as#f + print #f, showGSS((-1 , 2 , -1)) + print #f, showGSS((-1, 2, -1, 3, -1)) + print #f, showGSS((-1, 1, 2, -5, -6)) + print #f, showGSS((-1 , -2 , 3 , 5 , 6 , -2 , -1 , 4 , -4 , 2 , -1)) + close #f + win notepad, dir$+"out.txt" +} +Greatest_subsequential_sum diff --git a/Task/Greatest-subsequential-sum/M2000-Interpreter/greatest-subsequential-sum-2.m2000 b/Task/Greatest-subsequential-sum/M2000-Interpreter/greatest-subsequential-sum-2.m2000 new file mode 100644 index 0000000000..a16c08d534 --- /dev/null +++ b/Task/Greatest-subsequential-sum/M2000-Interpreter/greatest-subsequential-sum-2.m2000 @@ -0,0 +1,36 @@ +module Greatest_subsequential_sum (filename) { + showGSS=lambda (a)->{ + function Greatest_subsequential_sum(a as array){ + var best = 0 + var start = 0 + var end = 0 + var sum = 0 + var sumStart = 0 + var i = 0 + s=each(a) + while s { + sum +=array(s) + if (sum > best) then { + best = sum + start = sumStart + end = i + 1 + } else.if (sum < 0) then { + sum = 0 + sumStart = i + 1 + } + i++ + } + =a#slice(start, end-1) + } + = "("+a#str$(",")+") -> ("+ Greatest_subsequential_sum(a)#str$(",")+")" + } + open filename for output as#f + print #f, showGSS((-1 , 2 , -1)) + print #f, showGSS((-1, 2, -1, 3, -1)) + print #f, showGSS((-1, 1, 2, -5, -6)) + print #f, showGSS((-1 , -2 , 3 , 5 , 6 , -2 , -1 , 4 , -4 , 2 , -1)) + close #f + if filename<>"" then win notepad, dir$+filename +} +Greatest_subsequential_sum "" ' to screen +Greatest_subsequential_sum "out.txt" diff --git a/Task/Greatest-subsequential-sum/OCaml/greatest-subsequential-sum.ocaml b/Task/Greatest-subsequential-sum/OCaml/greatest-subsequential-sum.ml similarity index 100% rename from Task/Greatest-subsequential-sum/OCaml/greatest-subsequential-sum.ocaml rename to Task/Greatest-subsequential-sum/OCaml/greatest-subsequential-sum.ml diff --git a/Task/Greatest-subsequential-sum/PascalABC.NET/greatest-subsequential-sum.pas b/Task/Greatest-subsequential-sum/PascalABC.NET/greatest-subsequential-sum.pas new file mode 100644 index 0000000000..0f5860e32e --- /dev/null +++ b/Task/Greatest-subsequential-sum/PascalABC.NET/greatest-subsequential-sum.pas @@ -0,0 +1,28 @@ +function MaxSumSeq(a: array of integer): (integer,integer,integer); +begin + var (maxSum,thisSum) := (0,0); + var (f,t) := (0,-1); + var k := 0; + for var j:=0 to a.Length-1 do + begin + thisSum += a[j]; + if thisSum < 0 then + begin + k := j + 1; + thisSum := 0; + end + else if thisSum > maxSum then + begin + maxSum := thisSum; + f := k; + t := j + end; + end; + Result := (f,t,maxSum); +end; + +begin + var a := Arr(-1 , -2 , 3 , 5 , 6 , -2 , -1 , 4 , -4 , 2 , -1); + var (f,t,max) := MaxSumSeq(a); + Print('Subsequence with max sum:', a[f:t+1], 'It''s sum:', max); +end. diff --git a/Task/Greatest-subsequential-sum/Phix/greatest-subsequential-sum.phix b/Task/Greatest-subsequential-sum/Phix/greatest-subsequential-sum.phix index 98711bab7a..8229d70663 100644 --- a/Task/Greatest-subsequential-sum/Phix/greatest-subsequential-sum.phix +++ b/Task/Greatest-subsequential-sum/Phix/greatest-subsequential-sum.phix @@ -1,19 +1,17 @@ -(phixonline)--> - with javascript_semantics - function maxSubseq(sequence s) - integer maxsum = 0, first = 1, last = 0 - for i=1 to length(s) do - integer sumsij = 0 - for j=i to length(s) do - sumsij += s[j] - if sumsij>maxsum then - {maxsum,first,last} = {sumsij,i,j} - end if - end for - end for - return s[first..last] - end function - ? maxSubseq({-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1}) - ? maxSubseq({}) - ? maxSubseq({-1, -5, -3}) - - with javascript_semantics - include mpfr.e - function egyptian(integer num, denom) - mpz n = mpz_init(num), - d = mpz_init(denom), - t = mpz_init() - sequence result = {} - while mpz_cmp_si(n,0)!=0 do - mpz_cdiv_q(t, d, n) - result = append(result,"1/"&mpz_get_str(t)) - mpz_neg(d,d) - mpz_mod(n,d,n) - mpz_neg(d,d) - mpz_mul(d,d,t) - end while - {n,d} = mpz_free({n,d}) - return result - end function +with javascript_semantics +include mpfr.e +function egyptian(integer num, denom) + mpz n = mpz_init(num), + d = mpz_init(denom), + t = mpz_init() + sequence result = {} + while mpz_cmp_si(n,0)!=0 do + mpz_cdiv_q(t, d, n) + result = append(result,"1/"&mpz_get_str(t)) + mpz_neg(d,d) + mpz_mod(n,d,n) + mpz_neg(d,d) + mpz_mul(d,d,t) + end while + {n,d} = mpz_free({n,d}) + return result +end function - procedure efrac(integer num, denom) - string fraction = sprintf("%d/%d",{num,denom}), - prefix = "" - if num>=denom then - integer whole = floor(num/denom) - num -= whole*denom - prefix = sprintf("[%d] + ",whole) - end if - string e = join(egyptian(num, denom)," + ") - printf(1,"%s -> %s%s\n",{fraction,prefix,e}) - end procedure +procedure efrac(integer num, denom) + string fraction = sprintf("%d/%d",{num,denom}), + prefix = "" + if num>=denom then + integer whole = floor(num/denom) + num -= whole*denom + prefix = sprintf("[%d] + ",whole) + end if + string e = join(egyptian(num, denom)," + ") + printf(1,"%s -> %s%s\n",{fraction,prefix,e}) +end procedure - efrac(43,48) - efrac(5,121) - efrac(2014,59) +efrac(43,48) +efrac(5,121) +efrac(2014,59) - integer maxt = 0, - maxd = 0 - string maxts = "", - maxds = "", - maxda = "" +integer maxt = 0, + maxd = 0 +string maxts = "", + maxds = "", + maxda = "" - for r=98 to 998 by 900 do -- (iterates just twice!) - sequence sieve = repeat(repeat(false,r+1),r) -- to eliminate duplicates - for n=1 to r do - for d=n+1 to r+1 do - if sieve[n][d]=false then - string term = sprintf("%d/%d",{n,d}) - sequence terms = egyptian(n,d) - integer nterms = length(terms) - if nterms>maxt then - maxt = nterms - maxts = term - elsif nterms=maxt then - maxts &= ", " & term - end if - integer mlen = length(terms[$])-2 - if mlen>maxd then - maxd = mlen - maxds = term - maxda = terms[$] - elsif mlen=maxd then - maxds &= ", " & term - end if - if n<r/2 then - for k=2 to 9999 do - if d*k > r+1 then exit end if - sieve[n*k][d*k] = true - end for - end if - end if - end for - end for - printf(1,"\nfor proper fractions with 1 to %d digits\n",{length(sprint(r))}) - printf(1,"Largest number of terms is %d for %s\n",{maxt,maxts}) - maxda = maxda[3..$] -- (strip the "1/") - maxda[6..-6]="..." -- (show only first/last 5 digits) - printf(1,"Largest size for denominator is %d digits (%s) for %s\n",{maxd,maxda,maxds}) - end for - OpenSSL Stuffs <-- +extern BIO_new_ssl_connect +extern BIO_ctrl +extern BIO_write +extern BIO_read +extern BIO_free_all +extern TLS_client_method +extern SSL_CTX_new +extern SSL_CTX_free +extern SSL_CTX_set_verify +extern SSL_CTX_set_default_verify_paths +extern SSL_ctrl + +%define BIO_C_SET_CONNECT 100 +%define BIO_C_DO_STATE 101 +%define BIO_C_GET_SSL 110 +%define SSL_CTRL_SET_TLSHOST 55 +%define SSL_VERIFY_PEER 1 + +section .text + global xrequest + xrequest: + prolog 6*8 + %define _req_host rbp-1*8 + %define _req_pack rbp-2*8 + %define _req_buff rbp-3*8 + %define _req_ssl rbp-4*8 + %define _req_ctx rbp-5*8 + %define _req_bio rbp-6*8 + + mov rax, rdi + mov qword [_req_host], rax + mov rax, rsi + mov qword [_req_pack], rax + mov rax, rdx + mov qword [_req_buff], rax + xcall TLS_client_method + mov rdi, rax + xcall SSL_CTX_new + test rax, rax + jz __req_err_ctx + mov qword [_req_ctx], rax + mov rdi, qword [_req_ctx] + xcall SSL_CTX_set_default_verify_paths + test eax, eax + jz __req_err_verify + mov rdx, 0 + mov rsi, SSL_VERIFY_PEER + mov rdi, qword [_req_ctx] + xcall SSL_CTX_set_verify + ;;-->> Create Bio chain + mov rdi, qword [_req_ctx] + xcall BIO_new_ssl_connect + test rax, rax + jz __req_err_bio + mov qword [_req_bio], rax + ;;-->> Get SSL object + lea rcx, [_req_ssl] + mov rdx, 0 + mov rsi, BIO_C_GET_SSL + mov rdi, qword [_req_bio] + xcall BIO_ctrl + + ;; -->> Set the SNI hostname. + mov rdi, qword [_req_host] + xcall strdup + mov rdx, rax ; rdx now holds the copy + push rdx ; Push pointer to stack + mov rdi, rdx + mov rsi, ':' + xcall strchr + test rax, rax + jz __req_sni_set + mov byte [rax], 0 ; Null-terminate at colon + __req_sni_set: + mov rdi, qword [_req_ssl] + mov rsi, SSL_CTRL_SET_TLSHOST + mov rdx, 0 + mov rcx, [rsp] + xcall SSL_ctrl + pop rdi + xcall free + ;; -->>Set Hostname (BIO expects "host:port") + mov rdi, qword [_req_bio] + mov rsi, BIO_C_SET_CONNECT + mov rdx, 0 + mov rcx, qword [_req_host] + xcall BIO_ctrl + mov rdi, qword [_req_bio] + mov rsi, BIO_C_DO_STATE + mov rdx, 0 + mov rcx, 0 + xcall BIO_ctrl + cmp rax, 1 + jl __req_err_conn + + ;; -->> Send Request + mov rdi, qword [_req_pack] + xcall strlen + mov rdx, rax + mov rdi, qword [_req_bio] + mov rsi, qword [_req_pack] + xcall BIO_write + + ; -->> Read Response Loop + __req_read_loop: + mov rdi, qword [_req_bio] + mov rsi, qword [_req_buff] + mov rdx, 1024 + xcall BIO_read + test eax, eax + jle __req_exit + add qword [_req_buff], rax + jmp __req_read_loop + + + __req_err_bio: + mov r13, -1 + jmp __req_exit + __req_err_verify: + mov r13, -2 + jmp __req_exit + __req_err_ctx: + ;;-->> CTX Error + mov r13, -3 + jmp __req_exit + __req_err_conn: + mov r13, -4 + ;; fall through.. + __req_exit: + mov r13, rax + mov rdi, qword [_req_bio] + xcall BIO_free_all + mov rdi, qword [_req_ctx] + xcall SSL_CTX_free + mov rax, r13 + epilog 6*8 + ret + + global main + main: + prolog 4*8 + + ; request(hostname, request_str, buffer) + xlea rdi, hostname + xlea rsi, request_str + xlea rdx, buffer + call xrequest + mov rsi, rax + xlea rdi, fmt_ret + xcall printf + + ; Print the response buffer + xlea rdi, fmt_str + xlea rsi, buffer + xor rax, rax + xcall printf + xor rdi, rdi + xcall exit + prolog 4*8 ;;Never gets here but w/e. + ret + +section .data + hostname db "google.com:443", 0 + request_str db "GET / HTTP/1.1", 13, 10 + db "Host: google.com", 13, 10 + db "Connection: close", 13, 10 + db "User-Agent: TLS-TEST/0.5", 13, 10 + db 13, 10, 0 + + fmt_str db "%s", 0 + fmt_ret db "%i",10,0 + +section .bss + buffer resb 16384 diff --git a/Task/Hailstone-sequence/ABC/hailstone-sequence.abc b/Task/Hailstone-sequence/ABC/hailstone-sequence.abc new file mode 100644 index 0000000000..7241e86e8f --- /dev/null +++ b/Task/Hailstone-sequence/ABC/hailstone-sequence.abc @@ -0,0 +1,22 @@ +HOW TO RETURN hailstone n: + PUT {} IN seq + WHILE 1=1: + PUT n IN seq[#seq] + SELECT: + n=1: RETURN seq + n mod 2=0: PUT floor(n/2) IN n + n mod 2=1: PUT 3*n+1 IN n + RETURN seq + +PUT hailstone 27 IN h27 +WRITE "Length of Hailstone sequence for 27:", #h27/ +WRITE "First 4 elements:", h27[0], h27[1], h27[2], h27[3]/ +WRITE "Last 4 elements:", h27[#h27-4], h27[#h27-3], h27[#h27-2], h27[#h27-1]/ + +PUT 0, 0 IN longest, length +FOR n IN {1..100000}: + PUT hailstone n IN hn + IF #hn > length: + PUT n, #hn IN longest, length + +WRITE longest, "has the longest hailstone sequence < 100,000, of length:", length/ diff --git a/Task/Hailstone-sequence/Ada/hailstone-sequence-1.ada b/Task/Hailstone-sequence/Ada/hailstone-sequence-1.adb similarity index 100% rename from Task/Hailstone-sequence/Ada/hailstone-sequence-1.ada rename to Task/Hailstone-sequence/Ada/hailstone-sequence-1.adb diff --git a/Task/Hailstone-sequence/Ada/hailstone-sequence-2.ada b/Task/Hailstone-sequence/Ada/hailstone-sequence-2.adb similarity index 100% rename from Task/Hailstone-sequence/Ada/hailstone-sequence-2.ada rename to Task/Hailstone-sequence/Ada/hailstone-sequence-2.adb diff --git a/Task/Hailstone-sequence/Ada/hailstone-sequence-3.ada b/Task/Hailstone-sequence/Ada/hailstone-sequence-3.adb similarity index 100% rename from Task/Hailstone-sequence/Ada/hailstone-sequence-3.ada rename to Task/Hailstone-sequence/Ada/hailstone-sequence-3.adb diff --git a/Task/Hailstone-sequence/Ada/hailstone-sequence-4.ada b/Task/Hailstone-sequence/Ada/hailstone-sequence-4.adb similarity index 100% rename from Task/Hailstone-sequence/Ada/hailstone-sequence-4.ada rename to Task/Hailstone-sequence/Ada/hailstone-sequence-4.adb diff --git a/Task/Hailstone-sequence/Amazing-Hopper/hailstone-sequence.hopper b/Task/Hailstone-sequence/Amazing-Hopper/hailstone-sequence.hopper new file mode 100644 index 0000000000..4458a6198f --- /dev/null +++ b/Task/Hailstone-sequence/Amazing-Hopper/hailstone-sequence.hopper @@ -0,0 +1,43 @@ +#include + +#proto Hailstone(_X_,_SW_) + +algoritmo + + valor=27, máxima secuencia=0, vtemp=0 + imprimir ( _Hailstone(27,1) ---copiar en 'máxima secuencia'--- , NL ) + + i=28 + iterar + _Hailstone(i,0), copiar en 'vtemp' + cuando( sea mayor que 'máxima secuencia' ) { + máxima secuencia = vtemp + valor=i + } + ++i + hasta que ' #(i==100000) ' + imprimir ( #(utf8("Máxima longitud ")),máxima secuencia,\ + " fue encontrada para Hailstone(",valor,\ + #(utf8(") para números <100,000")), NL ) + +terminar + +subrutinas + +Hailstone(n, sw) + largo_de_secuencia = 0 + v={}, n, mete(v) + iterar + tomar si ( es par(n), #(n/2), \ + tomar si ( #(n<>1), #(3*n+1), 1) ) + ---copiar en 'n'--- mete(v) + hasta que ' #(n==1) ' + #(length(v)), mover a 'largo_de_secuencia' + cuando (sw){ + decimales '0' + #( v[1:4] ), ",...,", + #( v[largo_de_secuencia-4 : largo_de_secuencia] ) + NL, #(utf8("Tamaño de la secuencia: ")) + imprime esto; decimales normales + } +retornar ' largo_de_secuencia ' diff --git a/Task/Hailstone-sequence/Arturo/hailstone-sequence.arturo b/Task/Hailstone-sequence/Arturo/hailstone-sequence.arturo index a8510e757c..1050130f7d 100644 --- a/Task/Hailstone-sequence/Arturo/hailstone-sequence.arturo +++ b/Task/Hailstone-sequence/Arturo/hailstone-sequence.arturo @@ -1,10 +1,10 @@ hailstone: function [n][ ret: @[n] while [n>1][ - if? 1 = and n 1 -> n: 1+3*n - else -> n: n/2 + switch 1 = and n 1 -> n: 1+3*n + -> n: n/2 - 'ret ++ n + append 'ret n ] ret ] diff --git a/Task/Hailstone-sequence/AutoIt/hailstone-sequence.autoit b/Task/Hailstone-sequence/AutoIt/hailstone-sequence.au3 similarity index 100% rename from Task/Hailstone-sequence/AutoIt/hailstone-sequence.autoit rename to Task/Hailstone-sequence/AutoIt/hailstone-sequence.au3 diff --git a/Task/Hailstone-sequence/Ballerina/hailstone-sequence.ballerina b/Task/Hailstone-sequence/Ballerina/hailstone-sequence.ballerina new file mode 100644 index 0000000000..775dc1646d --- /dev/null +++ b/Task/Hailstone-sequence/Ballerina/hailstone-sequence.ballerina @@ -0,0 +1,34 @@ +import ballerina/io; + +function hailstone(int m) returns int[] { + int n = m; + int[] h = [n]; + while n != 1 { + n = n % 2 == 0 ? n / 2 : 3 * n + 1; + h.push(n); + } + return h; +} + +public function main() { + int[] h = hailstone(27); + int len = h.length(); + io:println("For the Hailstone sequence starting with n = 27:"); + io:println(" Number of elements = ", len); + io:println(" First four elements = ", h.slice(0, 4)); + io:println(" Final four elements = ", h.slice(len - 4)); + + io:println("\nThe Hailstone sequence for n < 100,000 with the longest length is:"); + int longest = 0; + int longlen = 0; + foreach int n in 1...99999 { + h = hailstone(n); + len = h.length(); + if len > longlen { + longest = n; + longlen = len; + } + } + io:println(` Longest = ${longest}`); + io:println(` Length = ${longlen}`); +} diff --git a/Task/Hailstone-sequence/Binary-Lambda-Calculus/hailstone-sequence.blc b/Task/Hailstone-sequence/Binary-Lambda-Calculus/hailstone-sequence.blc new file mode 100644 index 0000000000..85e3c77b13 --- /dev/null +++ b/Task/Hailstone-sequence/Binary-Lambda-Calculus/hailstone-sequence.blc @@ -0,0 +1,40 @@ +(let ((div2 (lambda (n) + (n (lambda (x) + (x (lambda (so-far odd?) + (odd? + ;; lambda (p) here and after is inlined cons + (lambda (p) + (p + ;; Inlined successor + (lambda (f x) + (f (so-far f x))) + nil)) + ;; cons so-far t + (lambda (p) (p so-far t)))))) + (lambda (p) (p 0 nil))))) + (fixpoint-combinator + #+nil + (lambda (g) + (let ((inner (lambda (x) (g (x x))))) + (inner inner))) + (lambda (f) + (let ((inner (lambda (x) + (f (lambda (y) + (x x y)))))) + (inner inner)))) + (hailstone (fixpoint-combinator + (lambda (recur n) + ((div2 n) + (lambda (half n-odd?) + (half + (lambda (x) + ;; lambda (p) is inlined cons + (lambda (p) + (p n (recur (n-odd? + (lambda (f x) + ;; (succ (mult 3 n)) + (f (3 (n f) x))) + half))))) + ;; lambda (p) is inlined cons + (lambda (p) (p 1 nil))))))))) + hailstone) diff --git a/Task/Hailstone-sequence/Bruijn/hailstone-sequence.bruijn b/Task/Hailstone-sequence/Bruijn/hailstone-sequence.bruijn new file mode 100644 index 0000000000..cd759cb715 --- /dev/null +++ b/Task/Hailstone-sequence/Bruijn/hailstone-sequence.bruijn @@ -0,0 +1,21 @@ +:import std/Combinator . +:import std/List . +:import std/Math M +:import std/Number/Binary . + +# hailstone sequence using binary shifts +hailstone y [[(0 =? (+1b)) {}0 go]] + go 0 : (=²?0 (1 /²0) (1 (↑¹0 + 0))) + +# --- tests --- + +seq-27 hailstone (+27b) + +:test (∀seq-27) ((+112)) +:test (take (+4) seq-27) ((+27b) : ((+82b) : ((+41b) : {}(+124b)))) +:test (take (+4) <~>seq-27) ((+1b) : ((+2b) : ((+4b) : {}(+8b)))) + +below-100000 [0 : ∀(hailstone 0)] <$> seq + seq take (+99999) (iterate ++‣ (+1b)) + +main [head (max-by (M.compare ⋔ tail) below-100000)] diff --git a/Task/Hailstone-sequence/COBOL/hailstone-sequence.cobol b/Task/Hailstone-sequence/COBOL/hailstone-sequence.cob similarity index 100% rename from Task/Hailstone-sequence/COBOL/hailstone-sequence.cobol rename to Task/Hailstone-sequence/COBOL/hailstone-sequence.cob diff --git a/Task/Hailstone-sequence/Common-Lisp/hailstone-sequence.lisp b/Task/Hailstone-sequence/Common-Lisp/hailstone-sequence.lisp index 88bd0f3f1f..c113be9365 100644 --- a/Task/Hailstone-sequence/Common-Lisp/hailstone-sequence.lisp +++ b/Task/Hailstone-sequence/Common-Lisp/hailstone-sequence.lisp @@ -3,7 +3,7 @@ ((evenp n) (cons n (hailstone (/ n 2)))) (t (cons n (hailstone (+ (* 3 n) 1)))))) -(defun longest (n) +(defun longest-hailstone (n) (let ((k 0) (l 0)) (loop for i from 1 below n do (let ((len (length (hailstone i)))) diff --git a/Task/Hailstone-sequence/Crystal/hailstone-sequence.crystal b/Task/Hailstone-sequence/Crystal/hailstone-sequence.cr similarity index 100% rename from Task/Hailstone-sequence/Crystal/hailstone-sequence.crystal rename to Task/Hailstone-sequence/Crystal/hailstone-sequence.cr diff --git a/Task/Hailstone-sequence/Delphi/hailstone-sequence-1.delphi b/Task/Hailstone-sequence/Delphi/hailstone-sequence-1.pas similarity index 100% rename from Task/Hailstone-sequence/Delphi/hailstone-sequence-1.delphi rename to Task/Hailstone-sequence/Delphi/hailstone-sequence-1.pas diff --git a/Task/Hailstone-sequence/Delphi/hailstone-sequence-2.delphi b/Task/Hailstone-sequence/Delphi/hailstone-sequence-2.pas similarity index 100% rename from Task/Hailstone-sequence/Delphi/hailstone-sequence-2.delphi rename to Task/Hailstone-sequence/Delphi/hailstone-sequence-2.pas diff --git a/Task/Hailstone-sequence/DuckDB/hailstone-sequence.duckdb b/Task/Hailstone-sequence/DuckDB/hailstone-sequence.duckdb new file mode 100644 index 0000000000..d1d48d9211 --- /dev/null +++ b/Task/Hailstone-sequence/DuckDB/hailstone-sequence.duckdb @@ -0,0 +1,27 @@ +# Generate the hailstone sequence without an index +create or replace function hailstone(start) as table ( + with recursive cte as ( + select start as n + union all + select if( n % 2 = 0, n // 2, 3 * n + 1) as n + from cte + where n != 1 + ) from cte +); + +# The length of the hailstone sequence of nn using count() +create or replace function hailstone_length(nn) as ( + select count() as n from hailstone(nn) +); + +# Return a tuple giving the seed and the hailstone sequence length +create or replace function hailstone_max_of_lengths(mx) as ( + select max_by( (n,hailstone_length(n)), hailstone_length(n)) + from range(1,mx+1) _(n) +); + +# Table of lengths (e.g. for use with histogram()) +create or replace function hailstone_lengths(mx) as table ( + select hailstone_length(n) as length + from range(1,mx+1) _(n) +); diff --git a/Task/Hailstone-sequence/EMal/hailstone-sequence.emal b/Task/Hailstone-sequence/EMal/hailstone-sequence.emal index 535c4f65df..88e9413884 100644 --- a/Task/Hailstone-sequence/EMal/hailstone-sequence.emal +++ b/Task/Hailstone-sequence/EMal/hailstone-sequence.emal @@ -1,26 +1,26 @@ -fun hailstone = List by int n - List h = int[n] - while n != 1 - n = when((n % 2 == 0), n / 2, 3 * n + 1) +fun hailstone ← List by int n + List h ← int[n] + while n ≠ 1 + n ← when((n % 2 æ 0), n / 2, 3 * n + 1) h.append(n) end return h end -int NUMBER = 27 -int LESS_THAN = 100000 -List sequence = hailstone(NUMBER) +int NUMBER ← 27 +int LESS_THAN ← 100000 +List sequence ← hailstone(NUMBER) writeLine("The hailstone sequence for the number " + NUMBER + " has " + sequence.length + " elements") writeLine("starting with " + sequence.extractStart(4).join(", ") + " and ending with " + sequence.extractEnd(4).join(", ") + ".") -int number = 0 -sequence = int[] -for int i = 1; i < LESS_THAN; ++i - List current = hailstone(i) +int number ← 0 +sequence ← int[] +for int i ← 1; i < LESS_THAN; ++i + List current ← hailstone(i) if current.length > sequence.length - sequence = current - number = i + sequence ← current + number ← i end end writeLine("The number less than 100000 with longest hailstone sequence is " + diff --git a/Task/Hailstone-sequence/EasyLang/hailstone-sequence.easy b/Task/Hailstone-sequence/EasyLang/hailstone-sequence.easy new file mode 100644 index 0000000000..ff201550a8 --- /dev/null +++ b/Task/Hailstone-sequence/EasyLang/hailstone-sequence.easy @@ -0,0 +1,26 @@ +proc hailstone n &list[] . + list[] = [ ] + while n <> 1 + list[] &= n + if n mod 2 = 0 + n = n / 2 + else + n = 3 * n + 1 + . + . + list[] &= 1 +. +hailstone 27 l[] +write "27 has length " & len l[] & " with " +for i to 4 : write l[i] & " " +write "... " +for i = len l[] - 3 to len l[] : write l[i] & " " +print "" +for i = 1 to 100000 + hailstone i l[] + if len l[] >= max_iter + max_i = i + max_iter = len l[] + . +. +print max_i & " has length " & max_iter diff --git a/Task/Hailstone-sequence/Elena/hailstone-sequence.elena b/Task/Hailstone-sequence/Elena/hailstone-sequence.elena index f7a6b6523d..6933f48a7b 100644 --- a/Task/Hailstone-sequence/Elena/hailstone-sequence.elena +++ b/Task/Hailstone-sequence/Elena/hailstone-sequence.elena @@ -30,13 +30,13 @@ Hailstone(int n,Map lengths) } } -public program() +public Program() { int longestChain := 0; int longestNumber := 0; auto recursiveLengths := new Map(4096,4096); - for(int i := 1, i < maxNumber, i+=1) + for(int i := 1; i < maxNumber; i+=1) { var chainLength := Hailstone(i, recursiveLengths); if (longestChain < chainLength) diff --git a/Task/Hailstone-sequence/Elixir/hailstone-sequence.elixir b/Task/Hailstone-sequence/Elixir/hailstone-sequence.ex similarity index 100% rename from Task/Hailstone-sequence/Elixir/hailstone-sequence.elixir rename to Task/Hailstone-sequence/Elixir/hailstone-sequence.ex diff --git a/Task/Hailstone-sequence/Euphoria/hailstone-sequence.euphoria b/Task/Hailstone-sequence/Euphoria/hailstone-sequence.eu similarity index 100% rename from Task/Hailstone-sequence/Euphoria/hailstone-sequence.euphoria rename to Task/Hailstone-sequence/Euphoria/hailstone-sequence.eu diff --git a/Task/Hailstone-sequence/Jq/hailstone-sequence-2.jq b/Task/Hailstone-sequence/Jq/hailstone-sequence-2.jq index c6b0fe55d9..06fd8b01e9 100644 --- a/Task/Hailstone-sequence/Jq/hailstone-sequence-2.jq +++ b/Task/Hailstone-sequence/Jq/hailstone-sequence-2.jq @@ -3,5 +3,5 @@ "The first four numbers: \($h[0:4])", "The last four numbers: \($h|.[length-4:length])", "", - max_hailstone(100000) as $m - | "Maximum length for n|hailstone for n in 1..100000 is \($m[1]) (n == \($m[0]))" + (max_hailstone(100000) as $m + | "Maximum length for n|hailstone for n in 1..100000 is \($m[1]) (n == \($m[0]))") diff --git a/Task/Hailstone-sequence/Julia/hailstone-sequence-1.julia b/Task/Hailstone-sequence/Julia/hailstone-sequence-1.jl similarity index 100% rename from Task/Hailstone-sequence/Julia/hailstone-sequence-1.julia rename to Task/Hailstone-sequence/Julia/hailstone-sequence-1.jl diff --git a/Task/Hailstone-sequence/Julia/hailstone-sequence-2.julia b/Task/Hailstone-sequence/Julia/hailstone-sequence-2.jl similarity index 100% rename from Task/Hailstone-sequence/Julia/hailstone-sequence-2.julia rename to Task/Hailstone-sequence/Julia/hailstone-sequence-2.jl diff --git a/Task/Hailstone-sequence/Julia/hailstone-sequence-3.julia b/Task/Hailstone-sequence/Julia/hailstone-sequence-3.jl similarity index 100% rename from Task/Hailstone-sequence/Julia/hailstone-sequence-3.julia rename to Task/Hailstone-sequence/Julia/hailstone-sequence-3.jl diff --git a/Task/Hailstone-sequence/Kotlin/hailstone-sequence-1.kts b/Task/Hailstone-sequence/Kotlin/hailstone-sequence-1.kts new file mode 100644 index 0000000000..26c85fffea --- /dev/null +++ b/Task/Hailstone-sequence/Kotlin/hailstone-sequence-1.kts @@ -0,0 +1,17 @@ +fun hailstone(start: Int) = generateSequence(start) { n -> + when { + n == 1 -> null + n % 2 == 0 -> n / 2 + else -> n * 3 + 1 + } +} + +fun main() { + val hail27 = hailstone(27).toList() + println("The hailstone sequence for 27 has ${hail27.size} elements:\n$hail27") + + val (n, length) = (1..100000).asSequence() + .map { it to hailstone(it).count() } + .maxBy { it.second } + println("The number between 1 and 100000 with the longest hailstone sequence is $n, of length $length") +} diff --git a/Task/Hailstone-sequence/Kotlin/hailstone-sequence.kotlin b/Task/Hailstone-sequence/Kotlin/hailstone-sequence-2.kts similarity index 100% rename from Task/Hailstone-sequence/Kotlin/hailstone-sequence.kotlin rename to Task/Hailstone-sequence/Kotlin/hailstone-sequence-2.kts diff --git a/Task/Hailstone-sequence/M2000-Interpreter/hailstone-sequence.m2000 b/Task/Hailstone-sequence/M2000-Interpreter/hailstone-sequence.m2000 index 36d886dcb9..6cdcbfba59 100644 --- a/Task/Hailstone-sequence/M2000-Interpreter/hailstone-sequence.m2000 +++ b/Task/Hailstone-sequence/M2000-Interpreter/hailstone-sequence.m2000 @@ -7,7 +7,7 @@ Module hailstone.Task { n*=3 : n++: val=n } } - Count=Lambda (n) ->{ + count=Lambda (n as long) ->{ m=lambda n ->{ if n=1 then =false: exit =true :if n mod 2=0 then n/=2 :exit diff --git a/Task/Hailstone-sequence/MiniScript/hailstone-sequence-1.mini b/Task/Hailstone-sequence/MiniScript/hailstone-sequence-1.mini new file mode 100644 index 0000000000..dcfc96c687 --- /dev/null +++ b/Task/Hailstone-sequence/MiniScript/hailstone-sequence-1.mini @@ -0,0 +1,31 @@ +getSequence = function(n) + results = [n] + while n > 1 + if n % 2 then + n = 3 * n + 1 + else + n = n / 2 + end if + results.push n + end while + return results +end function + +h = getSequence(27) +print "The hailstone sequence for 27 has 112 elements starting with" +print h[:4] +print "and ending with" +print h[-4:] + +maxSeqLen = 0 +maxSeqVal = 0 +for i in range(1,100000) + h = getSequence(i) + if h.len > maxSeqLen then + maxSeqLen = h.len + maxSeqVal = i + end if +end for +print +print "The number < 100,000 which has the longest hailstone sequence is " + maxSeqVal + "." +print "This sequence has " + maxSeqLen + " elements." diff --git a/Task/Hailstone-sequence/MiniScript/hailstone-sequence-2.mini b/Task/Hailstone-sequence/MiniScript/hailstone-sequence-2.mini new file mode 100644 index 0000000000..14269d6451 --- /dev/null +++ b/Task/Hailstone-sequence/MiniScript/hailstone-sequence-2.mini @@ -0,0 +1,45 @@ +cache = {} +calc = function(n) + if cache.hasIndex(n) then return + items = [n] + origNum = n + while n > 1 and not cache.hasIndex(n) + if n % 2 then + n = 3 * n + 1 + else + n = n /2 + end if + items.push n + end while + cache[origNum] = {"len": items.len,"items":items} +end function + +getLen = function(n) + if not cache.hasIndex(n) then calc n + if n == 1 then return 1 + return cache[n].len + getLen(cache[n].items[-1]) - 1 +end function + +getSequence = function(n) + if not cache.hasIndex(n) then calc n + if n == 1 then return [1] + return cache[n].items[:-1] + getSequence(cache[n].items[-1]) +end function + +h = getSequence(27) +print "The hailstone sequence for 27 has " + h.len + " elements starting with" +print h[:4] +print "and ending with" +print h[-4:] + +longSeq = 0 +longSeqVal =0 +for i in range(2, 100000) + seq = getLen(i) + if longSeq < seq then + longSeq = seq + longSeqVal = i + end if +end for +print "The number < 100,000 which has the longest hailstone sequence is " + longSeqVal + "." +print "This sequence has " + longSeq + " elements." diff --git a/Task/Hailstone-sequence/Miranda/hailstone-sequence.miranda b/Task/Hailstone-sequence/Miranda/hailstone-sequence.miranda new file mode 100644 index 0000000000..9b7381cd1c --- /dev/null +++ b/Task/Hailstone-sequence/Miranda/hailstone-sequence.miranda @@ -0,0 +1,22 @@ +main :: [sys_message] +main = [Stdout h27m, Stdout biggestm] + where h27 = hailstone 27 + h27n = #h27 + h27f = take 4 h27 + h27l = drop (h27n - 4) h27 + h27m = "The hailstone sequence for 27 has " ++ + show h27n ++ " elements starting with " ++ + show h27f ++ " and ending with " ++ + show h27l ++ "\n" + + range = [1..100000] + biggest = max [#hailstone n | n<-range] + nbiggest = hd [n | n<-range; #hailstone n = biggest] + biggestm = "The number with the longest Hailstone " ++ + "sequence < 100.000 is " ++ show nbiggest ++ + " with length " ++ show biggest ++ "\n" + +hailstone :: num->[num] +hailstone = (++[1]) . takewhile (>1) . iterate step + where step n = (3 * n) + 1, if n mod 2 = 1 + = n div 2, otherwise diff --git a/Task/Hailstone-sequence/OCaml/hailstone-sequence.ocaml b/Task/Hailstone-sequence/OCaml/hailstone-sequence.ml similarity index 100% rename from Task/Hailstone-sequence/OCaml/hailstone-sequence.ocaml rename to Task/Hailstone-sequence/OCaml/hailstone-sequence.ml diff --git a/Task/Hailstone-sequence/Odin/hailstone-sequence.odin b/Task/Hailstone-sequence/Odin/hailstone-sequence.odin new file mode 100644 index 0000000000..dbe6f83782 --- /dev/null +++ b/Task/Hailstone-sequence/Odin/hailstone-sequence.odin @@ -0,0 +1,65 @@ +package main + +import "core:fmt" + +collatz :: proc(array:^[dynamic]int,n:int){ + i:=1 + n:=n + for n!=1{ + + if (n%2==0){ + n=n/2 + append(&array^,n) + } + else{ + n=3*n+1 + append(&array^,n) + } + + } +} + +main :: proc() { + n:=27 + + max:=0 + max_length:=0 + + dummy:[dynamic]int + defer delete(dummy) + append(&dummy,n) + collatz(&dummy,n) + + + fmt.println("the first four of sequence for 27: ") + for jj:=0;jj<4;jj+=1{ + fmt.println(dummy[jj]) + } + fmt.println("the last four of sequence for 27: ") + for jj:=0;jj<4;jj+=1{ + fmt.println(dummy[len(dummy)-4+jj]) + } + fmt.println("length of sequence for 27") + fmt.println(len(dummy)) + + + for (len(dummy)>0){ + pop(&dummy) + } + + for ii:=1;ii<100000;ii+=1{ + append(&dummy,ii) + collatz(&dummy,ii) + if(len(dummy)>max_length){ + max = ii + max_length=len(dummy) + } + for (len(dummy)>0){ + pop(&dummy) + } + } + fmt.println("Max number: ") + fmt.println(max) + fmt.println("Max length: ") + fmt.println(max_length) +} diff --git a/Task/Hailstone-sequence/Onyx-(wasm)/hailstone-sequence.onyx b/Task/Hailstone-sequence/Onyx-(wasm)/hailstone-sequence.onyx new file mode 100644 index 0000000000..db662f03ce --- /dev/null +++ b/Task/Hailstone-sequence/Onyx-(wasm)/hailstone-sequence.onyx @@ -0,0 +1,61 @@ +use core { * } + +hailstone :: (n: u32) -> [..]u32 { + seq: [..]u32; + array.push(&seq, n); + while n > 1 { + n = n/2 if n%2 == 0 else (n*3)+1; + array.push(&seq, n); + } + return seq; +} + +Longest :: struct { num, len : u32; } + +main :: () { + + // ------- + // task 1: + // ------- + // "Create a routine to generate the hailstone + // sequence for a number." + + i := 27; + seq := hailstone(i); + printf("Task 1:\n{}: {}\n\n", + i, + seq + ); + + // ------- + // task 2: + // ------- + // "Use the routine to show that the hailstone + // sequence for the number 27 has + // 112 elements starting with + // 27, 82, 41, 124 and ending with 8, 4, 2, 1" + + slice_size := 4; + len := seq.length; + slice_first := seq[0..slice_size]; + slice_last := seq[seq.length-slice_size..seq.length]; + printf("Task 2:\nlength: {}, first: {}, last: {}\n\n", + len, + slice_first, + slice_last + ); + + // ------- + // task 3: + // ------- + // "Show the number less than 100,000 + // which has the longest hailstone sequence + // together with that sequences length." + + l : Longest; + for i in 1..100000 { + seq := hailstone(i); + if l.len < seq.length { l = .{num = i, len = seq.length}; } + } + printf("Task 3:\nLongest Num: {}, Sequence Length: {}\n", l.num, l.len); +} diff --git a/Task/Hailstone-sequence/PascalABC.NET/hailstone-sequence.pas b/Task/Hailstone-sequence/PascalABC.NET/hailstone-sequence.pas new file mode 100644 index 0000000000..d19f3dd6db --- /dev/null +++ b/Task/Hailstone-sequence/PascalABC.NET/hailstone-sequence.pas @@ -0,0 +1,23 @@ +function hailstone(n: Integer): sequence of integer; +begin + result := seq(n); + while n > 1 do + begin + n := n.IsEven ? n div 2 : 3 * n + 1; + result := result + seq(n); + end; +end; + +begin + var a := hailstone(27); + println(a.Count, a.Take(4), a.TakeLast(4)); + var max := 0; + var maxi := 0; + for var i := 1 to 100_000 do + if hailstone(i).Count > max then + begin + max := hailstone(i).Count; + maxi := i; + end; + println(maxi, max); +end. diff --git a/Task/Hailstone-sequence/Pluto/hailstone-sequence.pluto b/Task/Hailstone-sequence/Pluto/hailstone-sequence.pluto new file mode 100644 index 0000000000..0e55f4d7b9 --- /dev/null +++ b/Task/Hailstone-sequence/Pluto/hailstone-sequence.pluto @@ -0,0 +1,26 @@ +function hailstone(n, p=true) + local len = 1 + + while n > 1 do + ++len + if p do io.write(n,'\t') end + n = (n%2==0)?n//2:3*n+1 + end + + if p do print(1) end + return len +end + +hailstone(27) +print("------") + +local max = 1 +local len = 1 +for i = 2,99999 do + local t = hailstone(i,false) + if t > len then + max = i + len = t + end +end +print(max, len) diff --git a/Task/Hailstone-sequence/PowerShell/hailstone-sequence.psh b/Task/Hailstone-sequence/PowerShell/hailstone-sequence.ps1 similarity index 100% rename from Task/Hailstone-sequence/PowerShell/hailstone-sequence.psh rename to Task/Hailstone-sequence/PowerShell/hailstone-sequence.ps1 diff --git a/Task/Hailstone-sequence/REBOL/hailstone-sequence.rebol b/Task/Hailstone-sequence/Rebol/hailstone-sequence.rebol similarity index 100% rename from Task/Hailstone-sequence/REBOL/hailstone-sequence.rebol rename to Task/Hailstone-sequence/Rebol/hailstone-sequence.rebol diff --git a/Task/Hailstone-sequence/Refal/hailstone-sequence.refal b/Task/Hailstone-sequence/Refal/hailstone-sequence.refal new file mode 100644 index 0000000000..b8c16a96d3 --- /dev/null +++ b/Task/Hailstone-sequence/Refal/hailstone-sequence.refal @@ -0,0 +1,42 @@ +$ENTRY Go { + = + ; +} + +Hailstone { + 1 = 1; + s.N, : { + 0 = s.N >; + 1 = s.N >>; + }; +}; + +ShowHailstone { + s.N, : e.Seq, + : s.Len s.1 s.2 s.3 s.4 e.X s.D4 s.D3 s.D2 s.D1 + = ' has ' ' elements,\n' + 'starting with ' s.1 s.2 s.3 s.4 + 'and ending with ' s.D4 s.D3 s.D2 '.'>; +} + +FindLongest { + s.Max = ; + s.Max s.Max s.Long s.Len = s.Long s.Len; + s.Max s.Cur s.Long s.Len, + : e.CurSeq, + : s.CurLen e.X, + <+ s.Cur 1>: s.Next, + : { + '+' = ; + s.X = ; + }; +}; + +ShowLongest { + s.Max, : s.Long s.Len + = ' which has the longest' + ' hailstone sequence is ' '.\n' + 'The length of its Hailstone sequence is ' + '.'>; +}; diff --git a/Task/Hailstone-sequence/Rust/hailstone-sequence.rust b/Task/Hailstone-sequence/Rust/hailstone-sequence.rs similarity index 100% rename from Task/Hailstone-sequence/Rust/hailstone-sequence.rust rename to Task/Hailstone-sequence/Rust/hailstone-sequence.rs diff --git a/Task/Hailstone-sequence/SETL/hailstone-sequence.setl b/Task/Hailstone-sequence/SETL/hailstone-sequence.setl new file mode 100644 index 0000000000..b0f14b69df --- /dev/null +++ b/Task/Hailstone-sequence/SETL/hailstone-sequence.setl @@ -0,0 +1,24 @@ +program hailstone_sequence; + hail27 := hailstone(27); + print("The hailstone sequence for the number 27 has", #hail27, "elements,"); + print("starting with", hail27(..4), "and ending with", hail27(#hail27-3..)); + + sizes := [#hailstone(n) : n in [1..99999]]; + maxsize := max/sizes; + maxelem := [n : n in [1..#sizes] | sizes(n) = maxsize](1); + + print("The number < 100,000 with the longest hailstone sequence is",maxelem); + print("The length of its sequence is",sizes(maxelem)); + + proc hailstone(n); + seq := []; + loop doing seq with:= n; while n/=1 do + if even n then + n div:= 2; + else + n := 3*n + 1; + end if; + end loop; + return seq; + end proc; +end program; diff --git a/Task/Hailstone-sequence/Scheme/hailstone-sequence.scm b/Task/Hailstone-sequence/Scheme/hailstone-sequence.scm new file mode 100644 index 0000000000..5219a0c4e9 --- /dev/null +++ b/Task/Hailstone-sequence/Scheme/hailstone-sequence.scm @@ -0,0 +1,36 @@ +(define (collatz n) + (if (= n 1) + (list 1) + (cons n + (collatz (if (even? n) (/ n 2) (+ 1 (* 3 n))))))) + +(define (collatz-length n) + (let aux ((n n) (r 1)) + (if (= n 1) + r + (aux (if (even? n) (/ n 2) (+ 1 (* 3 n))) + (+ r 1))))) + +(define (collatz-max a b) + (let aux ((i a) (j 0) (k 0)) + (if (> i b) + (list j k) + (let ((h (collatz-length i))) + (if (> h k) + (aux (+ i 1) i h) + (aux (+ i 1) j k)))))) + +(collatz 27) +; (27 82 41 124 62 31 94 47 142 71 214 107 322 161 484 242 121 364 182 +; 91 274 137 412 206 103 310 155 466 233 700 350 175 526 263 790 395 +; 1186 593 1780 890 445 1336 668 334 167 502 251 754 377 1132 566 283 +; 850 425 1276 638 319 958 479 1438 719 2158 1079 3238 1619 4858 2429 +; 7288 3644 1822 911 2734 1367 4102 2051 6154 3077 9232 4616 2308 1154 +; 577 1732 866 433 1300 650 325 976 488 244 122 61 184 92 46 23 70 35 +; 106 53 160 80 40 20 10 5 16 8 4 2 1) + +(collatz-length 27) +; 112 + +(collatz-max 1 100000) +; (77031 351) diff --git a/Task/Hailstone-sequence/Scheme/hailstone-sequence.ss b/Task/Hailstone-sequence/Scheme/hailstone-sequence.ss deleted file mode 100644 index b0311a38ee..0000000000 --- a/Task/Hailstone-sequence/Scheme/hailstone-sequence.ss +++ /dev/null @@ -1,28 +0,0 @@ -(define (collatz n) -(if (= n 1) '(1) -(cons n (collatz (if (even? n) (/ n 2) (+ 1 (* 3 n))))))) - -(define (collatz-length n) -(let aux ((n n) (r 1)) (if (= n 1) r -(aux (if (even? n) (/ n 2) (+ 1 (* 3 n))) (+ r 1))))) - -(define (collatz-max a b) -(let aux ((i a) (j 0) (k 0)) -(if (> i b) (list j k) -(let ((h (collatz-length i))) -(if (> h k) (aux (+ i 1) i h) (aux (+ i 1) j k)))))) - -(collatz 27) -; (27 82 41 124 62 31 94 47 142 71 214 107 322 161 484 242 121 364 182 -; 91 274 137 412 206 103 310 155 466 233 700 350 175 526 263 790 395 -; 1186 593 1780 890 445 1336 668 334 167 502 251 754 377 1132 566 283 -; 850 425 1276 638 319 958 479 1438 719 2158 1079 3238 1619 4858 2429 -; 7288 3644 1822 911 2734 1367 4102 2051 6154 3077 9232 4616 2308 1154 -; 577 1732 866 433 1300 650 325 976 488 244 122 61 184 92 46 23 70 35 -; 106 53 160 80 40 20 10 5 16 8 4 2 1) - -(collatz-length 27) -; 112 - -(collatz-max 1 100000) -; (77031 351) diff --git a/Task/Hailstone-sequence/Uiua/hailstone-sequence.uiua b/Task/Hailstone-sequence/Uiua/hailstone-sequence.uiua new file mode 100644 index 0000000000..81cdf542a0 --- /dev/null +++ b/Task/Hailstone-sequence/Uiua/hailstone-sequence.uiua @@ -0,0 +1,7 @@ +Next ← ⨬(÷2|+1×3)⊸◿2 +Sequence ← ˜⊂1⊢[⍢⊸Next≠₁] + +⊃(↙4|↙¯4) Sequence 27 +# Calculate and cache lengths (export UIUA_RECURSION_LIMIT=3000 first) +Length ← |1 memo(⨬(+1Length Next|∘)⊸=₁) +⊸Length⊢⊏⍖⊸⍚Length+1⇡99999 diff --git a/Task/Hailstone-sequence/Ursalang/hailstone-sequence.ursa b/Task/Hailstone-sequence/Ursalang/hailstone-sequence.ursa new file mode 100644 index 0000000000..ecc665c418 --- /dev/null +++ b/Task/Hailstone-sequence/Ursalang/hailstone-sequence.ursa @@ -0,0 +1,33 @@ +let hailstone = fn(n_) { + var n = n_ + let steps = [n] + loop { + if n < 2 { break steps } + n := (if n % 2 == 0 { n / 2 } else { n * 3 + 1 }) + steps.push(n) + } +} + +let twentySeven = hailstone(27) +print("The Hailstone sequence for 27 starts with:") +print(twentySeven.slice(0, 4)) +print("and ends with:") +print(twentySeven.slice(-4)) +print("and its length is:") +print(twentySeven.len()) + +print("Checking sequences up to 100,000") +var longest = 0 +var longestLen = 0 +for i in range(100000) { + let len = hailstone(i).len() + if len > longestLen { + longest := i + longestLen := len + } + if i % 10000 == 0 {print(i)} +} +print("The longest sequence under 100,000 is for:") +print(longest) +print("and has length:") +print(longestLen) diff --git a/Task/Hailstone-sequence/V-(Vlang)/hailstone-sequence.v b/Task/Hailstone-sequence/V-(Vlang)/hailstone-sequence.v index 665f9dc8b1..2f1d091903 100644 --- a/Task/Hailstone-sequence/V-(Vlang)/hailstone-sequence.v +++ b/Task/Hailstone-sequence/V-(Vlang)/hailstone-sequence.v @@ -2,7 +2,7 @@ // 2nd arg is a slice to recycle, to reduce garbage. fn hs(nn int, recycle []int) []int { mut n := nn - mut s := recycle[..0] + mut s := recycle[..0].clone() s << n for n > 1 { if n&1 == 0 { diff --git a/Task/Hailstone-sequence/VBScript/hailstone-sequence.vb b/Task/Hailstone-sequence/VBScript/hailstone-sequence.vbs similarity index 100% rename from Task/Hailstone-sequence/VBScript/hailstone-sequence.vb rename to Task/Hailstone-sequence/VBScript/hailstone-sequence.vbs diff --git a/Task/Halt-and-catch-fire/8086-Assembly/halt-and-catch-fire.8086 b/Task/Halt-and-catch-fire/8086-Assembly/halt-and-catch-fire-1.8086 similarity index 100% rename from Task/Halt-and-catch-fire/8086-Assembly/halt-and-catch-fire.8086 rename to Task/Halt-and-catch-fire/8086-Assembly/halt-and-catch-fire-1.8086 diff --git a/Task/Halt-and-catch-fire/8086-Assembly/halt-and-catch-fire-2.8086 b/Task/Halt-and-catch-fire/8086-Assembly/halt-and-catch-fire-2.8086 new file mode 100644 index 0000000000..fe4a93e86e --- /dev/null +++ b/Task/Halt-and-catch-fire/8086-Assembly/halt-and-catch-fire-2.8086 @@ -0,0 +1 @@ +jmp $ diff --git a/Task/Halt-and-catch-fire/AArch64-Assembly/halt-and-catch-fire.aarch64 b/Task/Halt-and-catch-fire/AArch64-Assembly/halt-and-catch-fire.aarch64 new file mode 100644 index 0000000000..b35e4e4e7f --- /dev/null +++ b/Task/Halt-and-catch-fire/AArch64-Assembly/halt-and-catch-fire.aarch64 @@ -0,0 +1,50 @@ +/* ARM assembly AARCH64 Raspberry PI 3B */ +/* program craharm64.s */ + +/*******************************************/ +/* Constantes */ +/*******************************************/ +/* for this file see task include a file in language AArch64 assembly*/ +.include "../includeConstantesARM64.inc" + +/*******************************************/ +/* Macros */ +/*******************************************/ +//.include "../../ficmacros64.inc" // for developer debugging + +/*********************************/ +/* Initialized data */ +/*********************************/ +.data +szMessDebutPgm: .asciz "Program 64 bits start. \n" +szMessFinOK: .asciz "Program normal end. \n" + +/*********************************/ +/* UnInitialized data */ +/*********************************/ +.bss +/*********************************/ +/* code section */ +/*********************************/ +.text +.global main +main: + ldr x0,qAdrszMessDebutPgm + bl affichageMess // start message + mov x0,#0 + ldr x1,[x0] // load value at address zero + + + ldr x0,qAdrszMessFinOK + bl affichageMess + + mov x8,EXIT + svc #0 // system call +qAdrszMessDebutPgm: .quad szMessDebutPgm +qAdrszMessFinOK: .quad szMessFinOK + +/***************************************************/ +/* ROUTINES INCLUDE */ +/***************************************************/ +/* for this file see task include a file in language AArch64 assembly*/ +.include "../includeARM64.inc" diff --git a/Task/Halt-and-catch-fire/ARM-Assembly/halt-and-catch-fire.arm b/Task/Halt-and-catch-fire/ARM-Assembly/halt-and-catch-fire.arm new file mode 100644 index 0000000000..b2d0b3b307 --- /dev/null +++ b/Task/Halt-and-catch-fire/ARM-Assembly/halt-and-catch-fire.arm @@ -0,0 +1,55 @@ +/* ARM assembly Raspberry PI */ +/* program craharm.s */ + +/* REMARK 1 : this program use routines in a include file + see task Include a file language arm assembly + for the routine affichageMess conversion10 + see at end of this program the instruction include */ + +/*******************************************/ +/* Constantes */ +/*******************************************/ +.include "../constantes.inc" + +/*******************************************/ +/* Macros */ +/*******************************************/ +//.include "../../ficmacros32.inc" @ for developer debugging + +/*********************************/ +/* Initialized data */ +/*********************************/ +.data +szMessDebutPgm: .asciz "Program 32 bits start. \n" +szMessFinOK: .asciz "Program normal end. \n" + + +/*********************************/ +/* UnInitialized data */ +/*********************************/ +.bss +/*********************************/ +/* code section */ +/*********************************/ +.text +.global main +main: + ldr r0,iAdrszMessDebutPgm + bl affichageMess @ start message + mov r0,#0 + ldr r1,[r0] @ load value at address zero + + + ldr r0,iAdrszMessFinOK + bl affichageMess + + mov r7,#EXIT @ program end + svc #0 @ system call +iAdrszMessDebutPgm: .int szMessDebutPgm +iAdrszMessFinOK: .int szMessFinOK + + +/***************************************************/ +/* ROUTINES INCLUDE */ +/***************************************************/ +.include "../affichage.inc" diff --git a/Task/Halt-and-catch-fire/Ada/halt-and-catch-fire.ada b/Task/Halt-and-catch-fire/Ada/halt-and-catch-fire.adb similarity index 100% rename from Task/Halt-and-catch-fire/Ada/halt-and-catch-fire.ada rename to Task/Halt-and-catch-fire/Ada/halt-and-catch-fire.adb diff --git a/Task/Halt-and-catch-fire/Bruijn/halt-and-catch-fire.bruijn b/Task/Halt-and-catch-fire/Bruijn/halt-and-catch-fire.bruijn new file mode 100644 index 0000000000..e053451775 --- /dev/null +++ b/Task/Halt-and-catch-fire/Bruijn/halt-and-catch-fire.bruijn @@ -0,0 +1,3 @@ +:test ([[0]]) ([[1]]) + +main [[0 0] [0 0]] diff --git a/Task/Halt-and-catch-fire/Crystal/halt-and-catch-fire.crystal b/Task/Halt-and-catch-fire/Crystal/halt-and-catch-fire.cr similarity index 100% rename from Task/Halt-and-catch-fire/Crystal/halt-and-catch-fire.crystal rename to Task/Halt-and-catch-fire/Crystal/halt-and-catch-fire.cr diff --git a/Task/Halt-and-catch-fire/Delphi/halt-and-catch-fire.delphi b/Task/Halt-and-catch-fire/Delphi/halt-and-catch-fire.pas similarity index 100% rename from Task/Halt-and-catch-fire/Delphi/halt-and-catch-fire.delphi rename to Task/Halt-and-catch-fire/Delphi/halt-and-catch-fire.pas diff --git a/Task/Halt-and-catch-fire/EMal/halt-and-catch-fire.emal b/Task/Halt-and-catch-fire/EMal/halt-and-catch-fire.emal new file mode 100644 index 0000000000..681461a281 --- /dev/null +++ b/Task/Halt-and-catch-fire/EMal/halt-and-catch-fire.emal @@ -0,0 +1 @@ +error(256, "Internal Corruption") diff --git a/Task/Halt-and-catch-fire/EasyLang/halt-and-catch-fire.easy b/Task/Halt-and-catch-fire/EasyLang/halt-and-catch-fire.easy new file mode 100644 index 0000000000..cb387a3101 --- /dev/null +++ b/Task/Halt-and-catch-fire/EasyLang/halt-and-catch-fire.easy @@ -0,0 +1,2 @@ +a[] = [ ] +print a[1] diff --git a/Task/Halt-and-catch-fire/FutureBasic/halt-and-catch-fire.basic b/Task/Halt-and-catch-fire/FutureBasic/halt-and-catch-fire.basic new file mode 100644 index 0000000000..858825d80b --- /dev/null +++ b/Task/Halt-and-catch-fire/FutureBasic/halt-and-catch-fire.basic @@ -0,0 +1 @@ +~ 0,0 diff --git a/Task/Halt-and-catch-fire/Icon/halt-and-catch-fire.icon b/Task/Halt-and-catch-fire/Icon/halt-and-catch-fire.icon new file mode 100644 index 0000000000..a90590d6f8 --- /dev/null +++ b/Task/Halt-and-catch-fire/Icon/halt-and-catch-fire.icon @@ -0,0 +1,3 @@ +procedure main() + 5/0 +end diff --git a/Task/Halt-and-catch-fire/Java/halt-and-catch-fire.java b/Task/Halt-and-catch-fire/Java/halt-and-catch-fire.java index c0b69d67b3..436cffff07 100644 --- a/Task/Halt-and-catch-fire/Java/halt-and-catch-fire.java +++ b/Task/Halt-and-catch-fire/Java/halt-and-catch-fire.java @@ -1,11 +1,11 @@ public final class HaltAndCatchFire { - public static void main(String[] aArgs) { - // Any one of the lines below, when uncommented, will cause a program halt. - -// throw new AssertionError("Stop now!"); -// System.out.println(0/0); -// Runtime.getRuntime().exit(1); - } + public static void main(String[] aArgs) { + // Any one of the lines below, when uncommented, will cause a program halt. + +// throw new AssertionError("Stop now!"); +// System.out.println(0/0); +// Runtime.getRuntime().exit(1); + } } diff --git a/Task/Halt-and-catch-fire/JavaScript/halt-and-catch-fire.js b/Task/Halt-and-catch-fire/JavaScript/halt-and-catch-fire.js new file mode 100644 index 0000000000..c3ab4d8f76 --- /dev/null +++ b/Task/Halt-and-catch-fire/JavaScript/halt-and-catch-fire.js @@ -0,0 +1,3 @@ +f=()=>f();f(); +/* This also does the same thing, but is harder to read */ +(f=()=>f())(); diff --git a/Task/Halt-and-catch-fire/Julia/halt-and-catch-fire-1.julia b/Task/Halt-and-catch-fire/Julia/halt-and-catch-fire-1.jl similarity index 100% rename from Task/Halt-and-catch-fire/Julia/halt-and-catch-fire-1.julia rename to Task/Halt-and-catch-fire/Julia/halt-and-catch-fire-1.jl diff --git a/Task/Halt-and-catch-fire/Julia/halt-and-catch-fire-2.julia b/Task/Halt-and-catch-fire/Julia/halt-and-catch-fire-2.jl similarity index 100% rename from Task/Halt-and-catch-fire/Julia/halt-and-catch-fire-2.julia rename to Task/Halt-and-catch-fire/Julia/halt-and-catch-fire-2.jl diff --git a/Task/Halt-and-catch-fire/Microsoft-Small-Basic/halt-and-catch-fire.basic b/Task/Halt-and-catch-fire/Microsoft-Small-Basic/halt-and-catch-fire.basic new file mode 100644 index 0000000000..22d7fa590a --- /dev/null +++ b/Task/Halt-and-catch-fire/Microsoft-Small-Basic/halt-and-catch-fire.basic @@ -0,0 +1 @@ +a = 0 / 0 diff --git a/Task/Halt-and-catch-fire/PascalABC.NET/halt-and-catch-fire.pas b/Task/Halt-and-catch-fire/PascalABC.NET/halt-and-catch-fire.pas new file mode 100644 index 0000000000..ac79a4cfa2 --- /dev/null +++ b/Task/Halt-and-catch-fire/PascalABC.NET/halt-and-catch-fire.pas @@ -0,0 +1 @@ +## raise new Exception(''); diff --git a/Task/Halt-and-catch-fire/Pluto/halt-and-catch-fire.pluto b/Task/Halt-and-catch-fire/Pluto/halt-and-catch-fire.pluto new file mode 100644 index 0000000000..13a2c75adb --- /dev/null +++ b/Task/Halt-and-catch-fire/Pluto/halt-and-catch-fire.pluto @@ -0,0 +1 @@ +print(0 // 0) diff --git a/Task/Halt-and-catch-fire/R/halt-and-catch-fire-1.r b/Task/Halt-and-catch-fire/R/halt-and-catch-fire-1.r new file mode 100644 index 0000000000..39a97b302c --- /dev/null +++ b/Task/Halt-and-catch-fire/R/halt-and-catch-fire-1.r @@ -0,0 +1 @@ +stop() diff --git a/Task/Halt-and-catch-fire/R/halt-and-catch-fire-2.r b/Task/Halt-and-catch-fire/R/halt-and-catch-fire-2.r new file mode 100644 index 0000000000..1e5b3ea0c8 --- /dev/null +++ b/Task/Halt-and-catch-fire/R/halt-and-catch-fire-2.r @@ -0,0 +1 @@ +array()[,] diff --git a/Task/Halt-and-catch-fire/Rebol/halt-and-catch-fire.rebol b/Task/Halt-and-catch-fire/Rebol/halt-and-catch-fire.rebol new file mode 100644 index 0000000000..2350d4fe2a --- /dev/null +++ b/Task/Halt-and-catch-fire/Rebol/halt-and-catch-fire.rebol @@ -0,0 +1,5 @@ +halt ;; Stops evaluation and returns to the input prompt. + ;; or +quit ;; Stops evaluation and exits the interpreter. + ;; or +quit/return 1 ;; with some status code diff --git a/Task/Halt-and-catch-fire/Rust/halt-and-catch-fire.rust b/Task/Halt-and-catch-fire/Rust/halt-and-catch-fire.rs similarity index 100% rename from Task/Halt-and-catch-fire/Rust/halt-and-catch-fire.rust rename to Task/Halt-and-catch-fire/Rust/halt-and-catch-fire.rs diff --git a/Task/Halt-and-catch-fire/TAV/halt-and-catch-fire.tav b/Task/Halt-and-catch-fire/TAV/halt-and-catch-fire.tav new file mode 100644 index 0000000000..beb3a1a07a --- /dev/null +++ b/Task/Halt-and-catch-fire/TAV/halt-and-catch-fire.tav @@ -0,0 +1 @@ +! ?- diff --git a/Task/Halt-and-catch-fire/Uiua/halt-and-catch-fire.uiua b/Task/Halt-and-catch-fire/Uiua/halt-and-catch-fire.uiua new file mode 100644 index 0000000000..414ff2f8ec --- /dev/null +++ b/Task/Halt-and-catch-fire/Uiua/halt-and-catch-fire.uiua @@ -0,0 +1 @@ +⍤@a 0 diff --git a/Task/Halt-and-catch-fire/Zig/halt-and-catch-fire.zig b/Task/Halt-and-catch-fire/Zig/halt-and-catch-fire.zig new file mode 100644 index 0000000000..d8b5049869 --- /dev/null +++ b/Task/Halt-and-catch-fire/Zig/halt-and-catch-fire.zig @@ -0,0 +1,3 @@ +pub fn main() void { + unreachable; +} diff --git a/Task/Hamming-numbers/Ada/hamming-numbers.ada b/Task/Hamming-numbers/Ada/hamming-numbers.adb similarity index 100% rename from Task/Hamming-numbers/Ada/hamming-numbers.ada rename to Task/Hamming-numbers/Ada/hamming-numbers.adb diff --git a/Task/Hamming-numbers/Bruijn/hamming-numbers.bruijn b/Task/Hamming-numbers/Bruijn/hamming-numbers.bruijn new file mode 100644 index 0000000000..426223d327 --- /dev/null +++ b/Task/Hamming-numbers/Bruijn/hamming-numbers.bruijn @@ -0,0 +1,28 @@ +:import std/Combinator . +:import std/Number . +:import std/List . + +merge y [[[∅?1 0 (1 [[2 [[go]]]])]]] + go 3 ((+1) : 0))]]] + +:test ((hammings-classic !! (+42)) =? (+162)) ([[1]]) + +# enumeration by a chain of folded merges (faster) +hammings-folded ([(0 ∘ a) ∘ (0 ∘ b)] (foldr merge1 empty)) $ c + merge1 [[1 [[1 : (merge 0 2)]]]] + a iterate (map (mul (+5))) + b iterate (map (mul (+3))) + c iterate (mul (+2)) (+1) + +:test ((hammings-folded !! (+42)) =? (+162)) ([[1]]) + +# --- output --- + +main [first-twenty : (n1691 : {}n1000000)] + first-twenty take (+20) hammings-folded + n1691 hammings-folded !! (+1690) + n1000000 hammings-folded !! (+999999) diff --git a/Task/Hamming-numbers/Chapel/hamming-numbers-1.chapel b/Task/Hamming-numbers/Chapel/hamming-numbers-1.chpl similarity index 100% rename from Task/Hamming-numbers/Chapel/hamming-numbers-1.chapel rename to Task/Hamming-numbers/Chapel/hamming-numbers-1.chpl diff --git a/Task/Hamming-numbers/Chapel/hamming-numbers-2.chapel b/Task/Hamming-numbers/Chapel/hamming-numbers-2.chpl similarity index 100% rename from Task/Hamming-numbers/Chapel/hamming-numbers-2.chapel rename to Task/Hamming-numbers/Chapel/hamming-numbers-2.chpl diff --git a/Task/Hamming-numbers/Chapel/hamming-numbers-3.chapel b/Task/Hamming-numbers/Chapel/hamming-numbers-3.chpl similarity index 100% rename from Task/Hamming-numbers/Chapel/hamming-numbers-3.chapel rename to Task/Hamming-numbers/Chapel/hamming-numbers-3.chpl diff --git a/Task/Hamming-numbers/Chapel/hamming-numbers-4.chapel b/Task/Hamming-numbers/Chapel/hamming-numbers-4.chpl similarity index 100% rename from Task/Hamming-numbers/Chapel/hamming-numbers-4.chapel rename to Task/Hamming-numbers/Chapel/hamming-numbers-4.chpl diff --git a/Task/Hamming-numbers/Chapel/hamming-numbers-5.chapel b/Task/Hamming-numbers/Chapel/hamming-numbers-5.chpl similarity index 100% rename from Task/Hamming-numbers/Chapel/hamming-numbers-5.chapel rename to Task/Hamming-numbers/Chapel/hamming-numbers-5.chpl diff --git a/Task/Hamming-numbers/Crystal/hamming-numbers-1.crystal b/Task/Hamming-numbers/Crystal/hamming-numbers-1.cr similarity index 100% rename from Task/Hamming-numbers/Crystal/hamming-numbers-1.crystal rename to Task/Hamming-numbers/Crystal/hamming-numbers-1.cr diff --git a/Task/Hamming-numbers/Crystal/hamming-numbers-2.crystal b/Task/Hamming-numbers/Crystal/hamming-numbers-2.cr similarity index 100% rename from Task/Hamming-numbers/Crystal/hamming-numbers-2.crystal rename to Task/Hamming-numbers/Crystal/hamming-numbers-2.cr diff --git a/Task/Hamming-numbers/Crystal/hamming-numbers-3.crystal b/Task/Hamming-numbers/Crystal/hamming-numbers-3.cr similarity index 100% rename from Task/Hamming-numbers/Crystal/hamming-numbers-3.crystal rename to Task/Hamming-numbers/Crystal/hamming-numbers-3.cr diff --git a/Task/Hamming-numbers/Crystal/hamming-numbers-4.crystal b/Task/Hamming-numbers/Crystal/hamming-numbers-4.cr similarity index 100% rename from Task/Hamming-numbers/Crystal/hamming-numbers-4.crystal rename to Task/Hamming-numbers/Crystal/hamming-numbers-4.cr diff --git a/Task/Hamming-numbers/EasyLang/hamming-numbers.easy b/Task/Hamming-numbers/EasyLang/hamming-numbers.easy new file mode 100644 index 0000000000..5f54b97603 --- /dev/null +++ b/Task/Hamming-numbers/EasyLang/hamming-numbers.easy @@ -0,0 +1,27 @@ +func hamming lim . + len h[] lim + h[1] = 1 + x2 = 2 ; x3 = 3 ; x5 = 5 + i = 1 ; j = 1 ; k = 1 + for n = 2 to lim + h[n] = lower x2 lower x3 x5 + if x2 = h[n] + i += 1 + x2 = 2 * h[i] + . + if x3 = h[n] + j += 1 + x3 = 3 * h[j] + . + if x5 = h[n] + k += 1 + x5 = 5 * h[k] + . + . + return h[lim] +. +for nr = 1 to 20 + write hamming nr & " " +. +print "" +print hamming 1691 diff --git a/Task/Hamming-numbers/Elixir/hamming-numbers.elixir b/Task/Hamming-numbers/Elixir/hamming-numbers.ex similarity index 100% rename from Task/Hamming-numbers/Elixir/hamming-numbers.elixir rename to Task/Hamming-numbers/Elixir/hamming-numbers.ex diff --git a/Task/Hamming-numbers/FutureBasic/hamming-numbers.basic b/Task/Hamming-numbers/FutureBasic/hamming-numbers.basic new file mode 100644 index 0000000000..96bab3ac63 --- /dev/null +++ b/Task/Hamming-numbers/FutureBasic/hamming-numbers.basic @@ -0,0 +1,42 @@ +include "NSLog.incl" + +NSUInteger local fn Minimum( a as NSUInteger, b as NSUInteger ) + return (a < b) ? a : b +end fn = 0 + +UInt64 local fn HammingNumberAtPosition( position as NSUInteger ) + if (position == 0) then return 0 + CFMutableArrayRef hammingNumbers = fn MutableArrayWithCapacity( position ) + MutableArrayAddObject( hammingNumbers, @1 ) + + NSUInteger i2 = 0, i3 = 0, i5 = 0 + for NSUInteger i = 1 to position - 1 + NSUInteger nxt2 = fn NumberUnsignedLongLongValue( hammingNumbers[i2] ) * 2 + NSUInteger nxt3 = fn NumberUnsignedLongLongValue( hammingNumbers[i3] ) * 3 + NSUInteger nxt5 = fn NumberUnsignedLongLongValue( hammingNumbers[i5] ) * 5 + NSUInteger nxt = fn Minimum( nxt2, fn Minimum( nxt3, nxt5 ) ) + + NSUInteger nextHamming = fn Minimum( nxt2, fn Minimum( nxt3, nxt5 ) ) + MutableArrayAddObject( hammingNumbers, @(nextHamming) ) + + if (nxt == nxt2) then i2++ + if (nxt == nxt3) then i3++ + if (nxt == nxt5) then i5++ + next + + return fn NumberUnsignedLongLongValue( hammingNumbers[position - 1] ) +end fn = 0 + +local fn RunHammingNumberTests + CFMutableArrayRef mutArr = fn MutableArrayNew + + for NSUInteger i = 1 to 20 + MutableArrayAddObject( mutArr, @(fn HammingNumberAtPosition(i)) ) + next + NSLog( @"First 20 Hamming Numbers: %@", fn ArrayComponentsJoinedByString( mutArr, @" " ) ) + NSLog( @" 1691st Hamming Number: %llu", fn HammingNumberAtPosition( 1691 ) ) +end fn + +fn RunHammingNumberTests + +HandleEvents diff --git a/Task/Hamming-numbers/Julia/hamming-numbers-1.julia b/Task/Hamming-numbers/Julia/hamming-numbers-1.jl similarity index 100% rename from Task/Hamming-numbers/Julia/hamming-numbers-1.julia rename to Task/Hamming-numbers/Julia/hamming-numbers-1.jl diff --git a/Task/Hamming-numbers/Julia/hamming-numbers-2.julia b/Task/Hamming-numbers/Julia/hamming-numbers-2.jl similarity index 100% rename from Task/Hamming-numbers/Julia/hamming-numbers-2.julia rename to Task/Hamming-numbers/Julia/hamming-numbers-2.jl diff --git a/Task/Hamming-numbers/Julia/hamming-numbers-3.julia b/Task/Hamming-numbers/Julia/hamming-numbers-3.jl similarity index 100% rename from Task/Hamming-numbers/Julia/hamming-numbers-3.julia rename to Task/Hamming-numbers/Julia/hamming-numbers-3.jl diff --git a/Task/Hamming-numbers/Julia/hamming-numbers-4.julia b/Task/Hamming-numbers/Julia/hamming-numbers-4.jl similarity index 100% rename from Task/Hamming-numbers/Julia/hamming-numbers-4.julia rename to Task/Hamming-numbers/Julia/hamming-numbers-4.jl diff --git a/Task/Hamming-numbers/Julia/hamming-numbers-5.julia b/Task/Hamming-numbers/Julia/hamming-numbers-5.jl similarity index 100% rename from Task/Hamming-numbers/Julia/hamming-numbers-5.julia rename to Task/Hamming-numbers/Julia/hamming-numbers-5.jl diff --git a/Task/Hamming-numbers/Kotlin/hamming-numbers-1.kotlin b/Task/Hamming-numbers/Kotlin/hamming-numbers-1.kts similarity index 100% rename from Task/Hamming-numbers/Kotlin/hamming-numbers-1.kotlin rename to Task/Hamming-numbers/Kotlin/hamming-numbers-1.kts diff --git a/Task/Hamming-numbers/Kotlin/hamming-numbers-2.kotlin b/Task/Hamming-numbers/Kotlin/hamming-numbers-2.kts similarity index 100% rename from Task/Hamming-numbers/Kotlin/hamming-numbers-2.kotlin rename to Task/Hamming-numbers/Kotlin/hamming-numbers-2.kts diff --git a/Task/Hamming-numbers/Kotlin/hamming-numbers-3.kotlin b/Task/Hamming-numbers/Kotlin/hamming-numbers-3.kts similarity index 100% rename from Task/Hamming-numbers/Kotlin/hamming-numbers-3.kotlin rename to Task/Hamming-numbers/Kotlin/hamming-numbers-3.kts diff --git a/Task/Hamming-numbers/Kotlin/hamming-numbers-4.kotlin b/Task/Hamming-numbers/Kotlin/hamming-numbers-4.kts similarity index 100% rename from Task/Hamming-numbers/Kotlin/hamming-numbers-4.kotlin rename to Task/Hamming-numbers/Kotlin/hamming-numbers-4.kts diff --git a/Task/Hamming-numbers/Mojo/hamming-numbers.mojo b/Task/Hamming-numbers/Mojo/hamming-numbers.mojo new file mode 100644 index 0000000000..1d093d1922 --- /dev/null +++ b/Task/Hamming-numbers/Mojo/hamming-numbers.mojo @@ -0,0 +1,187 @@ +# HammingsLogImp.mojo - uses queue instead of frequent draining... +# compile with: mojo build --march=native Hammings.mojo + +# import bigints, std/math # no big ints +from math import (log2, trunc) +from memory import (memset_zero) #, memcpy) +from time import (monotonic) + +alias cCOUNT: Int = 1_000_000 + +struct BigNat(Movable, ImplicitlyCopyable, Stringable): # enough just to support conversion and printing + ''' Enough "infinite" precision to support as required here - multiply and + divide by 10 conversion to string... + ''' + var contents: List[UInt32] + fn __init__(out self): + self.contents = List[UInt32]() + fn __init__(out self, val: UInt32): + self.contents = List[UInt32](length=1, fill=val) + fn __copyinit__(out self, existing: Self): + self.contents = List[UInt32](existing.contents) + fn __str__(self) -> String: + var rslt: String = "" + var v = List[UInt32](self.contents) + while len(v) > 0: + var t: UInt64 = 0 + for i in range(len(v) - 1, -1, -1): + t = (t << 32) + Int(v[i]) + v[i] = Int(t // 10); t -= Int(v[i]) * 10 + var sz = len(v) - 1 + while sz >= 0 and v[sz] == 0: sz -= 1 + v.resize(sz + 1, 0) + rslt = String(t) + rslt + return rslt + fn __imul__(mut self, rhs: Self): + var lenl = len(self.contents); var lenr = len(rhs.contents) + var rslt = List[UInt32](length = lenl + lenr, fill = 0) + for i in range(lenr): + var t: UInt64 = 0 + for j in range(lenl): + t += Int(self.contents[j]) * Int(rhs.contents[i]) + Int(rslt[i + j]) + rslt[i + j] = Int(t & 0xFFFFFFFF); t >>= 32 + rslt[i + lenl] += Int(t) + var sz = len(rslt) - 1 + while sz >= 0 and rslt[sz] == 0: sz -= 1 + rslt.resize(sz + 1, 0); self.contents = rslt^ + +alias lb2: Float64 = 1.0 +alias lb3: Float64 = log2(Float64(3.0)) +alias lb5: Float64 = log2(Float64(5.0)) + +@fieldwise_init +struct LogRep(ImplicitlyCopyable, Movable, Stringable): + var logrep: Float64 + var x2: UInt32 + var x3: UInt32 + var x5: UInt32 + fn __del__(deinit self): return + @always_inline + fn mul2(self) -> Self: + return LogRep(self.logrep + lb2, self.x2 + 1, self.x3, self.x5) + @always_inline + fn mul3(self) -> Self: + return LogRep(self.logrep + lb3, self.x2, self.x3 + 1, self.x5) + @always_inline + fn mul5(self) -> Self: + return LogRep(self.logrep + lb5, self.x2, self.x3, self.x5 + 1) + fn __str__(self) -> String: +# return "( " + String(self.x2) + ", " + String(self.x3) + ", " + String(self.x5) + " )" + var rslt = BigNat(1) + fn expnd(mut rslt: BigNat, bs: UInt32, n: UInt32): + var bsm = BigNat(bs); var nm = n + while nm > 0: + if (nm & 1) != 0: rslt *= bsm + tmp = bsm; bsm *= tmp; nm >>= 1 + expnd(rslt, 2, self.x2); expnd(rslt, 3, self.x3); expnd(rslt, 5, self.x5) + return String(rslt) + +alias oneLR: LogRep = LogRep(0.0, 0, 0, 0) + +alias LogRepThunk = fn() escaping -> LogRep + +# Since an escaping closure doesn't currently move even for last used captures, and +# List's can't be copied into closures, we could write a minimal List to do the job, or +# probably easier is to just use a Mojo Iterator struct.... +struct _HammingsLogImpIter(ImplicitlyCopyable, Movable, Iterator): + alias __copyinit__is_trivial = False + alias __moveinit__is_trivial = False + alias __del__is_trivial = False + alias Element = LogRep + var s2: List[LogRep]; var s3: List[LogRep]; var s5: LogRep; var mrg: LogRep +# var s2p: UnsafePointer[LogRep]; var s3p: UnsafePointer[LogRep] + var s2hdi: Int; var s2tli: Int; var s3hdi: Int; var s3tli: Int + fn __init__(out self: Self): + self.s2 = List[LogRep](length=512, fill=oneLR); self.s2[0] = oneLR.mul2() + self.s3 = List[LogRep](length=1, fill=oneLR); self.s3[0] = oneLR.mul3() + self.s5 = oneLR.mul5(); self.mrg = oneLR +# self.s2p = self.s2.steal_data(); self.s3p = self.s3.steal_data() + self.s2hdi = 0; self.s2tli = -1; self.s3hdi = 0; self.s3tli = -1 + fn __copyinit__(out self: Self, existing: Self, /): + self.s2 = existing.s2.copy(); self.s3 = existing.s3.copy() + self.s5 = existing.s5; self.mrg = existing.mrg +# self.s2p = existing.s2p; self.s3p = existing.s3p + self.s2hdi = existing.s2hdi; self.s2tli = existing.s2tli + self.s3hdi = existing.s3hdi; self.s3tli = existing.s3tli +# fn __moveinit__(out self: Self, var existing: Self, /): +# self = existing^ + fn __has_next__(self: Self) -> Bool: + return True # "infinite" series! + fn __next__(mut self: Self) -> Self.Element: + var rslt = self.s2.unsafe_get(self.s2hdi) + var s2len = len(self.s2) + self.s2tli += 1; + if self.s2tli >= s2len: + self.s2tli = 0 + if self.s2hdi == self.s2tli: + if s2len < 1024: + self.s2.resize(1024, oneLR) # ; self.s2p = self.s2.steal_data() + else: + self.s2.resize(s2len + s2len, oneLR) # ; self.s2p = self.s2.steal_data() + for i in range(self.s2hdi): + self.s2.unsafe_set(s2len + i, self.s2.unsafe_get(i)) +# memcpy[UInt8, 0](s2p + s2len, s2p, sizeof[LogRep]() * s2hdi) + self.s2tli += s2len; s2len += s2len + if rslt.logrep < self.mrg.logrep: + self.s2hdi += 1 + if self.s2hdi >= s2len: + self.s2hdi = 0 + else: + rslt = self.mrg + var s3len = len(self.s3) + self.s3tli += 1; + if self.s3tli >= s3len: + self.s3tli = 0 + if self.s3hdi == self.s3tli: + if s3len < 1024: + self.s3.resize(1024, oneLR) # ; self.s3p = self.s3.steal_data() + else: + self.s3.resize(s3len + s3len, oneLR) # ; self.s3p = self.s3.steal_data() + for i in range(self.s3hdi): + self.s3.unsafe_set(s3len + i, self.s3.unsafe_get(i)) +# memcpy[UInt8, 0](s3p + s3len, s3p, sizeof[LogRep]() * s3hdi) + self.s3tli += s3len; s3len += s3len + if self.mrg.logrep < self.s5.logrep: + self.s3hdi += 1 + if self.s3hdi >= s3len: + self.s3hdi = 0 + else: + self.s5 = self.s5.mul5() + self.s3[self.s3tli] = rslt.mul3(); var t = self.s3[self.s3hdi]; + self.mrg = t if t.logrep < self.s5.logrep else self.s5 + self.s2.unsafe_set(self.s2tli, rslt.mul2()); return rslt + +@fieldwise_init +struct HammingsLogImp(ImplicitlyCopyable, Movable, Iterable): + alias __del__is_trivial = True + alias IteratorType[ + iterable_mut: Bool, //, iterable_origin: Origin[iterable_mut] + ]: Iterator = _HammingsLogImpIter + fn __iter__(ref self: Self) -> _HammingsLogImpIter: + return _HammingsLogImpIter() + +fn main(): + print("The first 20 Hamming numbers are:") + for i, h in enumerate(HammingsLogImp()): + print(String(h) + " ", end='') + if i >= 19: break + print() + for i, h in enumerate(HammingsLogImp()): + if i >= 1691 - 1: print("The 1691st Hamming number is " + String(h)); break + var strt: Int = monotonic() + var ham = oneLR + for i, h in enumerate(HammingsLogImp()): + if i >= cCOUNT - 1: ham = h; break + var elpsd = (monotonic() - strt) / 1000 + + print("The " + String(cCOUNT) + "th Hamming number is:") + print("2**" + String(ham.x2) + " * 3**" + String(ham.x3) + " * 5**" + String(ham.x5)) + var lg2 = lb2 * Float64(Int(ham.x2)) + lb3 * Float64(Int(ham.x3)) + lb5 * Float64(Int(ham.x5)) + var lg10 = lg2 / log2(Float64(10)) + var expnt = trunc(lg10); var num = Float64(10.0)**(lg10 - expnt) + var apprxstr = String(num) + "E+" + String(Int(expnt)) + print("Approximately: ", apprxstr) + var answrstr = String(ham) + print("The result has", len(answrstr), "digits.") + print(answrstr) + print("This took " + String(elpsd) + " microseconds.") diff --git a/Task/Hamming-numbers/OCaml/hamming-numbers-1.ocaml b/Task/Hamming-numbers/OCaml/hamming-numbers-1.ml similarity index 100% rename from Task/Hamming-numbers/OCaml/hamming-numbers-1.ocaml rename to Task/Hamming-numbers/OCaml/hamming-numbers-1.ml diff --git a/Task/Hamming-numbers/OCaml/hamming-numbers-2.ocaml b/Task/Hamming-numbers/OCaml/hamming-numbers-2.ml similarity index 100% rename from Task/Hamming-numbers/OCaml/hamming-numbers-2.ocaml rename to Task/Hamming-numbers/OCaml/hamming-numbers-2.ml diff --git a/Task/Hamming-numbers/PascalABC.NET/hamming-numbers.pas b/Task/Hamming-numbers/PascalABC.NET/hamming-numbers.pas new file mode 100644 index 0000000000..2f3354df97 --- /dev/null +++ b/Task/Hamming-numbers/PascalABC.NET/hamming-numbers.pas @@ -0,0 +1,34 @@ +function Hamming(n: integer): BigInteger; +begin + var (two,three,five) := (2bi, 3bi, 5bi); + var h := new BigInteger[n]; + h[0] := 1; + var (x2,x3,x5) := (2bi, 3bi, 5bi); + var (i,j,k) := (0, 0, 0); + for var ind := 1 to n-1 do + begin + h[ind] := Min(x2, x3, x5); + if h[ind] = x2 then + begin + i += 1; + x2 := two * h[i]; + end; + if h[ind] = x3 then + begin + j += 1; + x3 := three * h[j]; + end; + if h[ind] = x5 then + begin + k += 1; + x5 := five * h[k]; + end; + end; + Result := h[n-1]; +end; + +begin + (1..20).Select(x -> Hamming(x)).Println; + Hamming(1691).Println; + Hamming(1000000).Println; +end. diff --git a/Task/Hamming-numbers/REXX/hamming-numbers-1.rexx b/Task/Hamming-numbers/REXX/hamming-numbers-1.rexx deleted file mode 100644 index cc53b7ad15..0000000000 --- a/Task/Hamming-numbers/REXX/hamming-numbers-1.rexx +++ /dev/null @@ -1,20 +0,0 @@ -/*REXX program computes Hamming numbers: 1 ──► 20, # 1691, and the one millionth. */ -numeric digits 100 /*ensure enough decimal digits. */ -call hamming 1, 20 /*show the 1st ──► twentieth Hamming #s*/ -call hamming 1691 /*show the 1,691st Hamming number. */ -call hamming 1000000 /*show the 1 millionth Hamming number.*/ -exit /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -hamming: procedure; parse arg x,y; if y=='' then y= x; w= length(y) - #2= 1; #3= 1; #5= 1; @.= 0; @.1= 1 - do n=2 for y-1 - @.n= min(2*@.#2, 3*@.#3, 5*@.#5) /*pick the minimum of 3 Hamming numbers*/ - if 2*@.#2 == @.n then #2= #2 + 1 /*number already defined? Use next #. */ - if 3*@.#3 == @.n then #3= #3 + 1 /* " " " " " " */ - if 5*@.#5 == @.n then #5= #5 + 1 /* " " " " " " */ - end /*n*/ /* [↑] maybe assign next 3 Hamming#s. */ - do j=x to y; say 'Hamming('right(j, w)") =" @.j - end /*j*/ - - say right( 'length of last Hamming number =' length(@.y), 70); say - return diff --git a/Task/Hamming-numbers/REXX/hamming-numbers-2.rexx b/Task/Hamming-numbers/REXX/hamming-numbers-2.rexx deleted file mode 100644 index bccf09bbe0..0000000000 --- a/Task/Hamming-numbers/REXX/hamming-numbers-2.rexx +++ /dev/null @@ -1,26 +0,0 @@ -/*REXX program computes Hamming numbers: 1 ──► 20, # 1691, and the one millionth.*/ -call hamming 1, 20 /*show the 1st ──► twentieth Hamming #s*/ -call hamming 1691 /*show the 1,691st Hamming number. */ -call hamming 1000000 /*show the 1 millionth Hamming number.*/ -exit /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -hamming: procedure; arg x,y; if y=='' then y= x; w= length(y); L= length(y-1); p= 2**L - numeric digits max(9, p + p%4 + p%16) /*ensure enough decimal digits. */ - #2= 1; #3= 1; #5= 1; @.= 0; @.1= 1 - do n=2 for y-1 - _2= @.#2 + @.#2 /*this is faster than: @.#2 * 2 */ - _3= @.#3 + @.#3 + @.#3 /* " " " " @,#3 * 3 */ - _5= @.#5 * 5 - m= _2 /*assume a minimum (of the 3 Hammings).*/ - if _3 < m then m= _3 /*is this number less than the minimum?*/ - if _5 < m then m= _5 /* " " " " " " " */ - @.n= m /*now, assign the next Hamming number.*/ - if _2 == m then #2= #2 + 1 /*number already defined? Use next #.*/ - if _3 == m then #3= #3 + 1 /* " " " " " " */ - if _5 == m then #5= #5 + 1 /* " " " " " " */ - end /*n*/ /* [↑] maybe assign next Hamming #'s. */ - do j=x to y; say 'Hamming('right(j, w)") =" @.j - end /*j*/ - - say right( 'length of last Hamming number =' length(@.y), 70); say - return diff --git a/Task/Hamming-numbers/REXX/hamming-numbers-3.rexx b/Task/Hamming-numbers/REXX/hamming-numbers-3.rexx deleted file mode 100644 index ed4dfa5cbb..0000000000 --- a/Task/Hamming-numbers/REXX/hamming-numbers-3.rexx +++ /dev/null @@ -1,26 +0,0 @@ -/*REXX program computes Hamming numbers: 1 ──► 20, # 1691, and the one millionth.*/ -call hamming 1, 20 /*show the 1st ──► twentieth Hamming #s*/ -call hamming 1691 /*show the 1,691st Hamming number. */ -call hamming 1000000 /*show the 1 millionth Hamming number.*/ -exit /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -hamming: procedure; arg x,y; if y=='' then y= x; w= length(y); L= length(y-1); p= 2**L - numeric digits max(9, p + p%4 + p%16) /*ensure enough decimal digits. */ - #2= 1; #3= 1; #5= 1; @.= 0; @.1= 1 - do n=2 for y-1 - _2= @.#2 + @.#2 /*this is faster than: @.#2 * 2 */ - _3= @.#3 + @.#3 + @.#3 /* " " " " @,#3 * 3 */ - _5= @.#5 * 5 - m= _2 /*assume a minimum (of the 3 Hammings).*/ - if _3 < m then m= _3 /*is this number less than the minimum?*/ - if _5 < m then m= _5 /* " " " " " " " */ - @.n= format(m,,,,0) /*now, assign the next Hamming number.*/ - if _2 == m then #2= #2 + 1 /*number already defined? Use next #.*/ - if _3 == m then #3= #3 + 1 /* " " " " " " */ - if _5 == m then #5= #5 + 1 /* " " " " " " */ - end /*n*/ /* [↑] maybe assign next Hamming #'s. */ - do j=x to y; say 'Hamming('right(j, w)") =" @.j / 1 - end /*j*/ - - say right( 'length of last Hamming number =' length(@.y / 1), 70); say - return diff --git a/Task/Hamming-numbers/REXX/hamming-numbers.rexx b/Task/Hamming-numbers/REXX/hamming-numbers.rexx new file mode 100644 index 0000000000..7ab126e8ff --- /dev/null +++ b/Task/Hamming-numbers/REXX/hamming-numbers.rexx @@ -0,0 +1,38 @@ +-- 23 Aug 2025 +include Setting + +say 'HAMMING NUMBERS' +say version +say +call Hammings 1000000 +call ShowFirstN 20 +call ShowNth 1691 +call ShowNth 1000000 +call Hammings 10000000 +call ShowNth 10000000 +say Time('e')/1 'seconds' +exit + +ShowFirstN: +procedure expose Hamm. +arg xx +xx = xx/1 +say 'First' xx 'Hamming numbers are' +do i = 1 to xx + call Charout ,Right(Hamm.i,5) + if i//10 = 0 then + say +end +say +return + +ShowNth: +procedure expose Hamm. +arg xx +xx = xx/1 +say xx'th Hamming number is' +say Hamm.xx '('Length(Hamm.xx) 'digits)' +say +return + +include Math diff --git a/Task/Hamming-numbers/Rust/hamming-numbers-1.rust b/Task/Hamming-numbers/Rust/hamming-numbers-1.rs similarity index 100% rename from Task/Hamming-numbers/Rust/hamming-numbers-1.rust rename to Task/Hamming-numbers/Rust/hamming-numbers-1.rs diff --git a/Task/Hamming-numbers/Rust/hamming-numbers-2.rust b/Task/Hamming-numbers/Rust/hamming-numbers-2.rs similarity index 100% rename from Task/Hamming-numbers/Rust/hamming-numbers-2.rust rename to Task/Hamming-numbers/Rust/hamming-numbers-2.rs diff --git a/Task/Hamming-numbers/Rust/hamming-numbers-3.rust b/Task/Hamming-numbers/Rust/hamming-numbers-3.rs similarity index 100% rename from Task/Hamming-numbers/Rust/hamming-numbers-3.rust rename to Task/Hamming-numbers/Rust/hamming-numbers-3.rs diff --git a/Task/Hamming-numbers/Rust/hamming-numbers-4.rust b/Task/Hamming-numbers/Rust/hamming-numbers-4.rs similarity index 100% rename from Task/Hamming-numbers/Rust/hamming-numbers-4.rust rename to Task/Hamming-numbers/Rust/hamming-numbers-4.rs diff --git a/Task/Hamming-numbers/Rust/hamming-numbers-5.rust b/Task/Hamming-numbers/Rust/hamming-numbers-5.rs similarity index 100% rename from Task/Hamming-numbers/Rust/hamming-numbers-5.rust rename to Task/Hamming-numbers/Rust/hamming-numbers-5.rs diff --git a/Task/Hamming-numbers/Rust/hamming-numbers-6.rust b/Task/Hamming-numbers/Rust/hamming-numbers-6.rs similarity index 100% rename from Task/Hamming-numbers/Rust/hamming-numbers-6.rust rename to Task/Hamming-numbers/Rust/hamming-numbers-6.rs diff --git a/Task/Hamming-numbers/Rust/hamming-numbers-7.rust b/Task/Hamming-numbers/Rust/hamming-numbers-7.rs similarity index 100% rename from Task/Hamming-numbers/Rust/hamming-numbers-7.rust rename to Task/Hamming-numbers/Rust/hamming-numbers-7.rs diff --git a/Task/Hamming-numbers/Rust/hamming-numbers-8.rust b/Task/Hamming-numbers/Rust/hamming-numbers-8.rs similarity index 100% rename from Task/Hamming-numbers/Rust/hamming-numbers-8.rust rename to Task/Hamming-numbers/Rust/hamming-numbers-8.rs diff --git a/Task/Hamming-numbers/Scheme/hamming-numbers-1.ss b/Task/Hamming-numbers/Scheme/hamming-numbers-1.scm similarity index 100% rename from Task/Hamming-numbers/Scheme/hamming-numbers-1.ss rename to Task/Hamming-numbers/Scheme/hamming-numbers-1.scm diff --git a/Task/Hamming-numbers/Scheme/hamming-numbers-2.ss b/Task/Hamming-numbers/Scheme/hamming-numbers-2.scm similarity index 100% rename from Task/Hamming-numbers/Scheme/hamming-numbers-2.ss rename to Task/Hamming-numbers/Scheme/hamming-numbers-2.scm diff --git a/Task/Hamming-numbers/V-(Vlang)/hamming-numbers-1.v b/Task/Hamming-numbers/V-(Vlang)/hamming-numbers-1.v index 509ec16025..bd63012c8d 100644 --- a/Task/Hamming-numbers/V-(Vlang)/hamming-numbers-1.v +++ b/Task/Hamming-numbers/V-(Vlang)/hamming-numbers-1.v @@ -1,9 +1,7 @@ import math.big fn min(a big.Integer, b big.Integer) big.Integer { - if a < b { - return a - } + if a < b {return a} return b } diff --git a/Task/Hamming-numbers/V-(Vlang)/hamming-numbers-2.v b/Task/Hamming-numbers/V-(Vlang)/hamming-numbers-2.v index 3f7755a80b..4fa74da146 100644 --- a/Task/Hamming-numbers/V-(Vlang)/hamming-numbers-2.v +++ b/Task/Hamming-numbers/V-(Vlang)/hamming-numbers-2.v @@ -63,7 +63,7 @@ fn (lr LogRep) str() string { } struct HammingsLog { - mut: + mut: // automatically initialized with LogRep = one (defult)... s2 []LogRep = []LogRep { len: 1024, cap: 1024 } s3 []LogRep = []LogRep { len: 1024, cap: 1024 } diff --git a/Task/Hamming-numbers/VBScript/hamming-numbers.vb b/Task/Hamming-numbers/VBScript/hamming-numbers.vbs similarity index 100% rename from Task/Hamming-numbers/VBScript/hamming-numbers.vb rename to Task/Hamming-numbers/VBScript/hamming-numbers.vbs diff --git a/Task/Hamming-numbers/Wren/hamming-numbers-1.wren b/Task/Hamming-numbers/Wren/hamming-numbers-1.wren index 650b3d95af..266c36c8c0 100644 --- a/Task/Hamming-numbers/Wren/hamming-numbers-1.wren +++ b/Task/Hamming-numbers/Wren/hamming-numbers-1.wren @@ -1,4 +1,4 @@ -import "/big" for BigInt, BigInts +import "./big" for BigInt, BigInts var primes = [2, 3, 5].map { |p| BigInt.new(p) }.toList diff --git a/Task/Handle-a-signal/Ada/handle-a-signal-1.ada b/Task/Handle-a-signal/Ada/handle-a-signal-1.adb similarity index 100% rename from Task/Handle-a-signal/Ada/handle-a-signal-1.ada rename to Task/Handle-a-signal/Ada/handle-a-signal-1.adb diff --git a/Task/Handle-a-signal/Ada/handle-a-signal-2.ada b/Task/Handle-a-signal/Ada/handle-a-signal-2.adb similarity index 100% rename from Task/Handle-a-signal/Ada/handle-a-signal-2.ada rename to Task/Handle-a-signal/Ada/handle-a-signal-2.adb diff --git a/Task/Handle-a-signal/Ada/handle-a-signal-3.ada b/Task/Handle-a-signal/Ada/handle-a-signal-3.adb similarity index 100% rename from Task/Handle-a-signal/Ada/handle-a-signal-3.ada rename to Task/Handle-a-signal/Ada/handle-a-signal-3.adb diff --git a/Task/Handle-a-signal/Batch-File/handle-a-signal.bat b/Task/Handle-a-signal/Batch-File/handle-a-signal.bat new file mode 100644 index 0000000000..6c25ba9c5d --- /dev/null +++ b/Task/Handle-a-signal/Batch-File/handle-a-signal.bat @@ -0,0 +1,31 @@ +@echo off +setlocal enableextensions enabledelayedexpansion +if defined sigintEnd goto timerCalc +if defined sigintMain goto main +set timer=for /f "tokens=1-4 delims=:.," %%a in ("^!time^!"^) do set start_h=%%a^&set /a start_m=100%%b %% 100^&set /a start_s=100%%c %% 100^&set /a start_ms=100%%d %% 100 +( +%timer% +set sigintMain=1 +%= "echo y" to skip a prompt and proceed to time reporting =% +echo y| cmd /d /c "%~f0" +cmd /d /c set sigintEnd=1^&"%~f0" +goto :eof +) +:main +set i=1 +:loop +echo %i% +:: sleep for 1 second +ping 0.0.0.0 -n 2 >nul +set /a i+=1 +goto loop +:timerCalc +%timer:start=end% +for %%i in (h m s ms) do set /a %%i=end_%%i-start_%%i +if %ms% lss 0 set /a s-=1 & set /a ms=100%ms% +if %s% lss 0 set /a m-=1 & set /a s=60%s% +if %m% lss 0 set /a h-=1 & set /a m=60%m% +if %h% lss 0 set /a h=24%h% +if 1%ms% lss 100 set ms=0%ms% +set /a totalsecs=h*3600 + m*60 +s +echo Execution time: %totalsecs%.%ms%s diff --git a/Task/Handle-a-signal/COBOL/handle-a-signal.cobol b/Task/Handle-a-signal/COBOL/handle-a-signal.cob similarity index 100% rename from Task/Handle-a-signal/COBOL/handle-a-signal.cobol rename to Task/Handle-a-signal/COBOL/handle-a-signal.cob diff --git a/Task/Handle-a-signal/Crystal/handle-a-signal.crystal b/Task/Handle-a-signal/Crystal/handle-a-signal.cr similarity index 100% rename from Task/Handle-a-signal/Crystal/handle-a-signal.crystal rename to Task/Handle-a-signal/Crystal/handle-a-signal.cr diff --git a/Task/Handle-a-signal/Julia/handle-a-signal.julia b/Task/Handle-a-signal/Julia/handle-a-signal.jl similarity index 100% rename from Task/Handle-a-signal/Julia/handle-a-signal.julia rename to Task/Handle-a-signal/Julia/handle-a-signal.jl diff --git a/Task/Handle-a-signal/Kotlin/handle-a-signal.kotlin b/Task/Handle-a-signal/Kotlin/handle-a-signal.kts similarity index 100% rename from Task/Handle-a-signal/Kotlin/handle-a-signal.kotlin rename to Task/Handle-a-signal/Kotlin/handle-a-signal.kts diff --git a/Task/Handle-a-signal/Lua/handle-a-signal.lua b/Task/Handle-a-signal/Lua/handle-a-signal.lua new file mode 100644 index 0000000000..8b97e083d7 --- /dev/null +++ b/Task/Handle-a-signal/Lua/handle-a-signal.lua @@ -0,0 +1,20 @@ +local start_date = os.time() + +local loop = true +local Exit = function () + print() + loop = false +end + +local posix = require"posix" +posix.signal(posix.SIGINT, Exit) +posix.signal(posix.SIGQUIT, Exit) + +local int = 0 +while loop do + int = int+1 + print(int) + posix.time.nanosleep{tv_sec=0,tv_nsec=500*1000*1000} +end + +print(os.time() - start_date) diff --git a/Task/Handle-a-signal/OCaml/handle-a-signal.ocaml b/Task/Handle-a-signal/OCaml/handle-a-signal.ml similarity index 100% rename from Task/Handle-a-signal/OCaml/handle-a-signal.ocaml rename to Task/Handle-a-signal/OCaml/handle-a-signal.ml diff --git a/Task/Handle-a-signal/PascalABC.NET/handle-a-signal.pas b/Task/Handle-a-signal/PascalABC.NET/handle-a-signal.pas new file mode 100644 index 0000000000..751e61da9f --- /dev/null +++ b/Task/Handle-a-signal/PascalABC.NET/handle-a-signal.pas @@ -0,0 +1,13 @@ +begin + var counter := 0; + while True do + begin + Print(counter); + counter += 1; + Sleep(500); + end; + Console.CancelKeyPress += (o,e) -> begin + Println(Milliseconds); + halt + end; +end. diff --git a/Task/Handle-a-signal/PowerShell/handle-a-signal.psh b/Task/Handle-a-signal/PowerShell/handle-a-signal.ps1 similarity index 100% rename from Task/Handle-a-signal/PowerShell/handle-a-signal.psh rename to Task/Handle-a-signal/PowerShell/handle-a-signal.ps1 diff --git a/Task/Handle-a-signal/Rebol/handle-a-signal.rebol b/Task/Handle-a-signal/Rebol/handle-a-signal.rebol new file mode 100644 index 0000000000..89e69e09f1 --- /dev/null +++ b/Task/Handle-a-signal/Rebol/handle-a-signal.rebol @@ -0,0 +1 @@ +catch/quit/with [i: 0 t: stats/timer forever [print ++ i wait 0.5]][print ["Done!" stats/timer - t]] diff --git a/Task/Handle-a-signal/Rust/handle-a-signal.rust b/Task/Handle-a-signal/Rust/handle-a-signal.rs similarity index 100% rename from Task/Handle-a-signal/Rust/handle-a-signal.rust rename to Task/Handle-a-signal/Rust/handle-a-signal.rs diff --git a/Task/Handle-a-signal/Sidef/handle-a-signal.sidef b/Task/Handle-a-signal/Sidef/handle-a-signal.sidef index b77cad0bb3..41b5408755 100644 --- a/Task/Handle-a-signal/Sidef/handle-a-signal.sidef +++ b/Task/Handle-a-signal/Sidef/handle-a-signal.sidef @@ -1,11 +1,11 @@ -var start = Time.sec; -  -Sig.INT { |_| - Sys.say("Ran for #{Time.sec - start} seconds."); - Sys.exit; +var start = Time.sec + +Sig.INT { + say "Ran for #{Time.sec - start} seconds." + Sys.exit } -  + { |i| - Sys.say(i); - Sys.sleep(0.5); -} * Math.inf; + say i + Sys.sleep(0.5) +} * Inf diff --git a/Task/Happy-numbers/00-META.yaml b/Task/Happy-numbers/00-META.yaml index 2fb428f9fa..6e331dac93 100644 --- a/Task/Happy-numbers/00-META.yaml +++ b/Task/Happy-numbers/00-META.yaml @@ -1,3 +1,3 @@ --- from: http://rosettacode.org/wiki/Happy_numbers -note: Arithmetic operations +note: Numbers diff --git a/Task/Happy-numbers/ABC/happy-numbers.abc b/Task/Happy-numbers/ABC/happy-numbers.abc new file mode 100644 index 0000000000..befec4774e --- /dev/null +++ b/Task/Happy-numbers/ABC/happy-numbers.abc @@ -0,0 +1,24 @@ +HOW TO RETURN square.digit.sum n: + PUT 0 IN sum + WHILE n>0: + PUT n mod 10 IN digit + PUT sum + digit ** 2 IN sum + PUT floor (n/10) IN n + RETURN sum + +HOW TO REPORT happy n: + PUT {} IN seen + WHILE n not.in seen: + INSERT n IN seen + PUT square.digit.sum n IN n + REPORT n=1 + +HOW TO RETURN next.happy n: + PUT n+1 IN n + WHILE NOT happy n: PUT n+1 IN n + RETURN n + +PUT 0 IN n +FOR i IN {1..8}: + PUT next.happy n IN n + WRITE n/ diff --git a/Task/Happy-numbers/Ada/happy-numbers.ada b/Task/Happy-numbers/Ada/happy-numbers.adb similarity index 100% rename from Task/Happy-numbers/Ada/happy-numbers.ada rename to Task/Happy-numbers/Ada/happy-numbers.adb diff --git a/Task/Happy-numbers/Arturo/happy-numbers.arturo b/Task/Happy-numbers/Arturo/happy-numbers.arturo index bc1ccc3bbb..388d4db91b 100644 --- a/Task/Happy-numbers/Arturo/happy-numbers.arturo +++ b/Task/Happy-numbers/Arturo/happy-numbers.arturo @@ -1,7 +1,7 @@ -ord0: to :integer `0` +ord0: to :integer '0' happy?: function [x][ n: x - past: new [] + past: [] while [n <> 1][ s: to :string n diff --git a/Task/Happy-numbers/AutoIt/happy-numbers-1.autoit b/Task/Happy-numbers/AutoIt/happy-numbers-1.au3 similarity index 100% rename from Task/Happy-numbers/AutoIt/happy-numbers-1.autoit rename to Task/Happy-numbers/AutoIt/happy-numbers-1.au3 diff --git a/Task/Happy-numbers/AutoIt/happy-numbers-2.autoit b/Task/Happy-numbers/AutoIt/happy-numbers-2.au3 similarity index 100% rename from Task/Happy-numbers/AutoIt/happy-numbers-2.autoit rename to Task/Happy-numbers/AutoIt/happy-numbers-2.au3 diff --git a/Task/Happy-numbers/COBOL/happy-numbers.cobol b/Task/Happy-numbers/COBOL/happy-numbers.cob similarity index 100% rename from Task/Happy-numbers/COBOL/happy-numbers.cobol rename to Task/Happy-numbers/COBOL/happy-numbers.cob diff --git a/Task/Happy-numbers/Crystal/happy-numbers.crystal b/Task/Happy-numbers/Crystal/happy-numbers.cr similarity index 100% rename from Task/Happy-numbers/Crystal/happy-numbers.crystal rename to Task/Happy-numbers/Crystal/happy-numbers.cr diff --git a/Task/Happy-numbers/Delphi/happy-numbers.delphi b/Task/Happy-numbers/Delphi/happy-numbers.pas similarity index 100% rename from Task/Happy-numbers/Delphi/happy-numbers.delphi rename to Task/Happy-numbers/Delphi/happy-numbers.pas diff --git a/Task/Happy-numbers/EasyLang/happy-numbers.easy b/Task/Happy-numbers/EasyLang/happy-numbers.easy new file mode 100644 index 0000000000..922506ed62 --- /dev/null +++ b/Task/Happy-numbers/EasyLang/happy-numbers.easy @@ -0,0 +1,27 @@ +func dsum n . + while n > 0 + d = n mod 10 + s += d * d + n = n div 10 + . + return s +. +func happy n . + while n > 999 + n = dsum n + . + len seen[] 999 + repeat + n = dsum n + until seen[n] = 1 + seen[n] = 1 + . + return if n = 1 +. +while cnt < 8 + n += 1 + if happy n = 1 + cnt += 1 + write n & " " + . +. diff --git a/Task/Happy-numbers/Elena/happy-numbers.elena b/Task/Happy-numbers/Elena/happy-numbers.elena index ce34920d51..0b49f2db3e 100644 --- a/Task/Happy-numbers/Elena/happy-numbers.elena +++ b/Task/Happy-numbers/Elena/happy-numbers.elena @@ -9,14 +9,14 @@ isHappy(int n) int num := n; while (num != 1) { - if (cache.indexOfElement:num != -1) + if (cache.indexOfElement(num) != -1) { ^ false }; cache.append(num); while (num != 0) { - int digit := num.mod:10; + int digit := num.mod(10); sum += (digit*digit); num /= 10 }; @@ -27,7 +27,7 @@ isHappy(int n) ^ true } -public program() +public Program() { auto happynums := new List(8); int num := 1; diff --git a/Task/Happy-numbers/Elixir/happy-numbers.elixir b/Task/Happy-numbers/Elixir/happy-numbers.ex similarity index 100% rename from Task/Happy-numbers/Elixir/happy-numbers.elixir rename to Task/Happy-numbers/Elixir/happy-numbers.ex diff --git a/Task/Happy-numbers/Euphoria/happy-numbers.euphoria b/Task/Happy-numbers/Euphoria/happy-numbers.eu similarity index 100% rename from Task/Happy-numbers/Euphoria/happy-numbers.euphoria rename to Task/Happy-numbers/Euphoria/happy-numbers.eu diff --git a/Task/Happy-numbers/Frink/happy-numbers.frink b/Task/Happy-numbers/Frink/happy-numbers.frink new file mode 100644 index 0000000000..ce9c4e404d --- /dev/null +++ b/Task/Happy-numbers/Frink/happy-numbers.frink @@ -0,0 +1,19 @@ +isHappy = {|n| + sqf = {|x| x^2} + seen = new set[n] + + while true + { + n = sum[map[sqf, integerDigits[n]]] + if n == 1 + return true + + if seen.contains[n] + return false + else + seen.put[n] + } +} + + +println[first[select[count[1], isHappy], 8]] diff --git a/Task/Happy-numbers/Haskell/happy-numbers-3.hs b/Task/Happy-numbers/Haskell/happy-numbers-3.hs new file mode 100644 index 0000000000..04713b0ba9 --- /dev/null +++ b/Task/Happy-numbers/Haskell/happy-numbers-3.hs @@ -0,0 +1,14 @@ +happy x = sum (map (\x -> x * x) (digits x)) + where + digits 0 = [0] + digits x = (x `mod` 10):(digits (x `div` 10)) -- could function digits be more concise? + +ishappy x = floyd (happy x) (happy (happy x)) + where + floyd :: Int -> Int -> Bool + floyd 1 _ = True + floyd _ 1 = True + floyd a b | a == b = False + floyd x y = floyd (happy x) (happy (happy y)) + +main = (print $ take 8 $ filter ishappy [1..]) >> (print $ sum $ take 10000 $ filter ishappy [1..] diff --git a/Task/Happy-numbers/Julia/happy-numbers-1.jl b/Task/Happy-numbers/Julia/happy-numbers-1.jl new file mode 100644 index 0000000000..d9d5a0d343 --- /dev/null +++ b/Task/Happy-numbers/Julia/happy-numbers-1.jl @@ -0,0 +1,16 @@ +function happy(x) + happy_ints = Int[] + int_try = 1 + while length(happy_ints) < x + n = int_try + past = Int[] + while n != 1 + n = sum(y^2 for y in digits(n)) + n in past && break + push!(past, n) + end + n == 1 && push!(happy_ints,int_try) + int_try += 1 + end + return happy_ints +end diff --git a/Task/Happy-numbers/Julia/happy-numbers-1.julia b/Task/Happy-numbers/Julia/happy-numbers-1.julia deleted file mode 100644 index f4fc223f7c..0000000000 --- a/Task/Happy-numbers/Julia/happy-numbers-1.julia +++ /dev/null @@ -1,15 +0,0 @@ -function happy(x) - happy_ints = ref(Int) - int_try = 1 - while length(happy_ints) < x - n = int_try - past = ref(Int) - while n != 1 - n = sum([y^2 for y in digits(n)]) - contains(past,n) ? break : push!(past,n) - end - n == 1 && push!(happy_ints,int_try) - int_try += 1 - end - return happy_ints -end diff --git a/Task/Happy-numbers/Julia/happy-numbers-2.jl b/Task/Happy-numbers/Julia/happy-numbers-2.jl new file mode 100644 index 0000000000..3d6947b562 --- /dev/null +++ b/Task/Happy-numbers/Julia/happy-numbers-2.jl @@ -0,0 +1,10 @@ +sumhappy(n) = sum(x->x^2, digits(n)) + +function ishappy(x, mem = Int[]) + x == 1 ? true : + x in mem ? false : + ishappy(sumhappy(x), [mem ; x]) +end + +nexthappy(x) = ishappy(x+1) ? x+1 : nexthappy(x+1) +happy(n) = accumulate((a, b) -> nexthappy(a), 1:n) diff --git a/Task/Happy-numbers/Julia/happy-numbers-2.julia b/Task/Happy-numbers/Julia/happy-numbers-2.julia deleted file mode 100644 index 82b71edb0c..0000000000 --- a/Task/Happy-numbers/Julia/happy-numbers-2.julia +++ /dev/null @@ -1,11 +0,0 @@ -sumhappy(n) = sum(x->x^2, digits(n)) - -function ishappy(x, mem = []) - x == 1? true : - x in mem? false : - ishappy(sumhappy(x),[mem ; x]) -end - -nexthappy (x) = ishappy(x+1) ? x+1 : nexthappy(x+1) - -happy(n) = [z = 1 ; [z = nexthappy(z) for i = 1:n-1]] diff --git a/Task/Happy-numbers/Julia/happy-numbers-3.jl b/Task/Happy-numbers/Julia/happy-numbers-3.jl new file mode 100644 index 0000000000..9a2d149a42 --- /dev/null +++ b/Task/Happy-numbers/Julia/happy-numbers-3.jl @@ -0,0 +1,30 @@ +const CACHE = 256 +buf = zeros(Int, CACHE) +buf[begin] = 1 + +function happy(n) + if n < CACHE + buf[n] > 0 && return 2-buf[n] + buf[n] = 2 + end + sqsum = 0 + nn = n + while nn != 0 + nn, x = divrem(nn, 10) + sqsum += x * x + end + x = happy(sqsum) + n < CACHE && (buf[n] = 2 - x) + return x +end + +function main() + i, counter = 1, 1000000 + while counter > 0 + if happy(i) != 0 + counter -= 1 + end + i += 1 + end + return i - 1 +end diff --git a/Task/Happy-numbers/Julia/happy-numbers-3.julia b/Task/Happy-numbers/Julia/happy-numbers-3.julia deleted file mode 100644 index 6fbebd76e6..0000000000 --- a/Task/Happy-numbers/Julia/happy-numbers-3.julia +++ /dev/null @@ -1,30 +0,0 @@ -const CACHE = 256 -buf = zeros(Int,CACHE) -buf[1] = 1 -#happy(n) returns 1 if happy, 0 if not -function happy(n) - if n < CACHE - buf[n] > 0 && return 2-buf[n] - buf[n] = 2 - end - sum = 0 - nn = n - while nn != 0 - x = nn%10 - sum += x*x - nn = int8(nn/10) - end - x = happy(sum) - n < CACHE && (buf[n] = 2-x) - return x -end -function main() - i = 1; counter = 1000000 - while counter > 0 - if happy(i) == 1 - counter -= 1 - end - i += 1 - end - return i-1 -end diff --git a/Task/Happy-numbers/Kotlin/happy-numbers.kotlin b/Task/Happy-numbers/Kotlin/happy-numbers.kts similarity index 100% rename from Task/Happy-numbers/Kotlin/happy-numbers.kotlin rename to Task/Happy-numbers/Kotlin/happy-numbers.kts diff --git a/Task/Happy-numbers/OCaml/happy-numbers.ocaml b/Task/Happy-numbers/OCaml/happy-numbers.ml similarity index 100% rename from Task/Happy-numbers/OCaml/happy-numbers.ocaml rename to Task/Happy-numbers/OCaml/happy-numbers.ml diff --git a/Task/Happy-numbers/PascalABC.NET/happy-numbers.pas b/Task/Happy-numbers/PascalABC.NET/happy-numbers.pas new file mode 100644 index 0000000000..15d02a6478 --- /dev/null +++ b/Task/Happy-numbers/PascalABC.NET/happy-numbers.pas @@ -0,0 +1,27 @@ +uses School; + +function IsHappy(n: integer): boolean; +begin + Result := False; + var cache := new HashSet; + while n <> 1 do + begin + if n in cache then + exit; + cache.Add(n); + n := n.Digits.Sum(d -> d*d); + end; + Result := True; +end; + +begin + var n := 1; + var happyNums := new List; + while happyNums.Count < 8 do + begin + if IsHappy(n) then + happyNums.Add(n); + n += 1; + end; + happyNums.Print +end. diff --git a/Task/Happy-numbers/Pluto/happy-numbers.pluto b/Task/Happy-numbers/Pluto/happy-numbers.pluto new file mode 100644 index 0000000000..80a7ecb196 --- /dev/null +++ b/Task/Happy-numbers/Pluto/happy-numbers.pluto @@ -0,0 +1,26 @@ +local function happy(n) + local m = {} + while n > 1 do + m[n] = true + local x = n + n = 0 + while x > 0 do + local d = x % 10 + n += d * d + x //= 10 + end + if m[n] then return false end -- m[n] will be nil if 'n' is not a key + end + return true +end + +local found = 0 +local n = 1 +while found < 8 do + if happy(n) then + io.write($"{n} ") + found += 1 + end + n += 1 +end +print() diff --git a/Task/Happy-numbers/PowerShell/happy-numbers-1.psh b/Task/Happy-numbers/PowerShell/happy-numbers-1.ps1 similarity index 100% rename from Task/Happy-numbers/PowerShell/happy-numbers-1.psh rename to Task/Happy-numbers/PowerShell/happy-numbers-1.ps1 diff --git a/Task/Happy-numbers/PowerShell/happy-numbers-2.psh b/Task/Happy-numbers/PowerShell/happy-numbers-2.ps1 similarity index 100% rename from Task/Happy-numbers/PowerShell/happy-numbers-2.psh rename to Task/Happy-numbers/PowerShell/happy-numbers-2.ps1 diff --git a/Task/Happy-numbers/REXX/happy-numbers-1.rexx b/Task/Happy-numbers/REXX/happy-numbers-1.rexx index 8fb8f111be..ff5e99ee46 100644 --- a/Task/Happy-numbers/REXX/happy-numbers-1.rexx +++ b/Task/Happy-numbers/REXX/happy-numbers-1.rexx @@ -1,19 +1,78 @@ -/*REXX program computes and displays a specified amount of happy numbers. */ -parse arg limit . /*obtain optional argument from the CL.*/ -if limit=='' | limit=="," then limit=8 /*Not specified? Then use the default.*/ -haps=0 /*count of the happy numbers (so far).*/ +/*REXX program computes and displays a specified range of happy numbers. */ +Call time 'R' +linesize=80 +Parse Arg low high /* obtain range of happy numbers */ +If low='?' Then Call help +If low='' Then low=10 +If high='' Then + Parse Value 1 low With low high +Do i=0 To 9 /*build a squared decimal digit table. */ + square.i=i*i + End +happy.=0 /* happy.m=1 - m is a happy number */ +unhappy.=0 /* unhappy.n=1 - n is an unhappy number*/ +hapn=0 /* count of the happy numbers */ +ol='' +Do n=1 While hapn0 Then Do /* or was already encountered */ + -- If wordpos(sum,suml)>0 Then say 'Loop' n':' suml sum + -- If n<7 Then say n':' suml sum + unhappy.n=1 /* n is unhappy */ + Call set suml /* amd so are all sums so far */ + Iterate n + End + When sum=1 Then Do /* we reached sum=1 */ + hapn+=1 /* increment number of happy numbers */ + happy.n=1 /* n is happy */ + If hapn>=low Then /* if it is in specified range */ + Call out n /* output it */ + If hapn=high Then /* end of range reached */ + Leave n /* we are done */ + Iterate n /* otherwise proceed */ + End + Otherwise Do /* otherwise */ + suml=suml sum /* add sum to list of sums */ + work=sum /* proceed with the new sum */ + End + End + End + End +If ol>'' Then /* more output data */ + Say strip(ol) /* write to console */ +-- Say time('E') +Exit - do n=1 while haps'' + Parse Var list s list + unhappy.s=1 + End +Return - if @.s then iterate n /*if already summed, Q is unhappy. */ - @.s=1; q=s /*mark the sum as found; try Q sum.*/ - end /*until*/ - say n /*display the number (N is happy). */ - haps=haps+1 /*bump the count of happy numbers. */ - end /*n*/ - /*stick a fork in it, we're all done. */ +out: /* output management */ + Parse Arg hn /* the happy number */ + If length(ol hn)>linesize Then Do /* if it does not fit */ + Say strip(ol) /* output the line */ + ol=hn /* and start a new line */ + End + Else /* otherwise */ + ol=ol hn /* append is to the output line */ + Return + +help: + Say 'rexx hno n compute and show the first n happy numbers' + Say 'rexx hno low high show happy numbers from index low to high' + Exit diff --git a/Task/Happy-numbers/REXX/happy-numbers-2.rexx b/Task/Happy-numbers/REXX/happy-numbers-2.rexx index 9e7fb6cae2..11cc8094fd 100644 --- a/Task/Happy-numbers/REXX/happy-numbers-2.rexx +++ b/Task/Happy-numbers/REXX/happy-numbers-2.rexx @@ -1,27 +1,106 @@ -/*REXX program computes and displays a specified range of happy numbers. */ -parse arg L H . /*obtain optional arguments from the CL*/ -if L=='' | L=="," then L=8 /*Not specified? Then use the default.*/ -if H=='' | H=="," then do; H=L; L=1; end /*use a range for the displaying of #s.*/ - do i=0 to 9; #.i=i**2; end /*i*/ /*build a squared decimal digit table. */ -@.=0; @.1=1; !.=@.; !.2=1; !.4=1 /*sparse array: @≡happy, !≡unhappy. */ -haps=0 /*count of the happy numbers (so far).*/ +-- 23 Aug 2025 +include Setting - do n=1 while haps '' + parse var ll s ll; Flag.s=1 + end + iterate i + end +-- Repeating? Flag sad sums, next number + when WordPos(ss,ll) > 0 then do + do while ll <> '' + parse var ll s ll; Flag.s=1 + end + iterate i + end +-- Happy? Bump, next number + when ss = 1 then do + n=n+1; Happ.n=i + iterate i + end +-- Next sum + otherwise do + ll=ll ss; h=ss + end + end + end +end i +-- Flag happy numbers <= 1000 +Flag.=0 +do i = 1 to n + h=Happ.i; Flag.h=1 +end +-- Collect happy numbers > 1000 using flagged numbers +do i = 1001 while n < xx + h=i +-- Squared digital sum + ss=0 + do Length(h) + parse var h d +1 h; ss=ss+Pow2.d + end +-- Happy? Bump + if Flag.ss then do + n=n+1; Happ.n=i + end +end i +-- Count +Happ.0=n +return n + +ShowFirst8: +procedure expose Happ. +say 'First 8 Happy numbers are' +do i = 1 to 8 + call Charout ,Right(Happ.i,3) +end +say +return + +ShowNth: +procedure expose Happ. +arg xx +xx = xx/1 +say xx'th Happy number is' Happ.xx +return + +include Math diff --git a/Task/Happy-numbers/REXX/happy-numbers-3.rexx b/Task/Happy-numbers/REXX/happy-numbers-3.rexx deleted file mode 100644 index 0f472c33cd..0000000000 --- a/Task/Happy-numbers/REXX/happy-numbers-3.rexx +++ /dev/null @@ -1,34 +0,0 @@ -/*REXX program computes and displays a specified range of happy numbers. */ -sw=linesize() - 1 /*obtain the screen width (less one). */ -parse arg limit . /*obtain optional argument from the CL.*/ -if L=='' | L=="," then L=8 /*Not specified? Then use the default.*/ -if H=='' | H=="," then do; H=L; L=1; end /*use a range for the displaying of #s.*/ - do i=0 to 9; #.i=i**2; end /*i*/ /*build a squared decimal digit table. */ -@.=0; @.1=1; !.=@.; !.2=1; !.4=1 /*sparse array: @≡happy, !≡unhappy. */ -haps=0 /*count of the happy numbers (so far).*/ -$= - do n=1 while hapssw then do /*if the list is too long, then split */ - say strip($) /* ··· and display what we've got. */ - $=n /*Set the next line to overflow. */ - end /* [↑] new line now contains overflow.*/ - end /*n*/ -if $\='' then say strip($) /*display any residual happy numbers. */ - /*stick a fork in it, we're all done. */ diff --git a/Task/Happy-numbers/Refal/happy-numbers.refal b/Task/Happy-numbers/Refal/happy-numbers.refal new file mode 100644 index 0000000000..68c1b6b4e1 --- /dev/null +++ b/Task/Happy-numbers/Refal/happy-numbers.refal @@ -0,0 +1,26 @@ +$ENTRY Go { + = ; +}; + +ShowFirst { + 0 s.F s.I = ; + s.N s.F s.I, : T = + + s.F <+ s.I 1>>; + s.N s.F s.I = + >; +}; + +Happy { + 1 e.X = T; + s.N e.X s.N e.Y = F; + s.N e.X = s.N e.X>; +}; + +SqDigSum { + 0 = 0; + s.N, : s.Ds e.Rs, + : s.D, + : s.R = + <+ <* s.D s.D> >; +}; diff --git a/Task/Happy-numbers/Rust/happy-numbers.rs b/Task/Happy-numbers/Rust/happy-numbers.rs new file mode 100644 index 0000000000..a0097862a0 --- /dev/null +++ b/Task/Happy-numbers/Rust/happy-numbers.rs @@ -0,0 +1,37 @@ +fn sumsqd(mut n: i32) -> i32 { + let mut sq = 0; + while n > 0 { + let d = n % 10; + sq += d * d; + n /= 10; + } + sq +} + +fn cycle(a: T, f: F) -> T +where + T: Copy + PartialEq, + F: Fn(T) -> T, +{ + let mut t = a; + let mut h = f(a); + + while t != h { + t = f(t); + h = f(f(h)); + } + t +} + +fn ishappy(n: i32) -> bool { + cycle(n, sumsqd) == 1 +} + +fn main() { + let happy: Vec = (1..) + .filter(|&n| ishappy(n)) + .take(8) + .collect(); + + println!("{:?}", happy); +} diff --git a/Task/Happy-numbers/Rust/happy-numbers.rust b/Task/Happy-numbers/Rust/happy-numbers.rust deleted file mode 100644 index 9b6647bd6e..0000000000 --- a/Task/Happy-numbers/Rust/happy-numbers.rust +++ /dev/null @@ -1,36 +0,0 @@ -#![feature(core)] - -fn sumsqd(mut n: i32) -> i32 { - let mut sq = 0; - while n > 0 { - let d = n % 10; - sq += d*d; - n /= 10 - } - sq -} - -use std::num::Int; -fn cycle(a: T, f: fn(T) -> T) -> T { - let mut t = a; - let mut h = f(a); - - while t != h { - t = f(t); - h = f(f(h)) - } - t -} - -fn ishappy(n: i32) -> bool { - cycle(n, sumsqd) == 1 -} - -fn main() { - let happy = std::iter::count(1, 1) - .filter(|&n| ishappy(n)) - .take(8) - .collect::>(); - - println!("{:?}", happy) -} diff --git a/Task/Happy-numbers/Scheme/happy-numbers.ss b/Task/Happy-numbers/Scheme/happy-numbers.scm similarity index 100% rename from Task/Happy-numbers/Scheme/happy-numbers.ss rename to Task/Happy-numbers/Scheme/happy-numbers.scm diff --git a/Task/Happy-numbers/Uiua/happy-numbers.uiua b/Task/Happy-numbers/Uiua/happy-numbers.uiua new file mode 100644 index 0000000000..a7189fe111 --- /dev/null +++ b/Task/Happy-numbers/Uiua/happy-numbers.uiua @@ -0,0 +1,3 @@ +HC ← /+ⁿ2⊥₁₀ # Happiness = sum of squares of digits. +Happy ← memo(=1⊢⍢(⊂HC⊸⊢|¬˜∊°⊂)[∘]) # Apply HC until it repeats or = 1. +↙8▽⊸≡Happy⇡40 diff --git a/Task/Happy-numbers/V-(Vlang)/happy-numbers.v b/Task/Happy-numbers/V-(Vlang)/happy-numbers.v index 4e492e47a7..93b56b1751 100644 --- a/Task/Happy-numbers/V-(Vlang)/happy-numbers.v +++ b/Task/Happy-numbers/V-(Vlang)/happy-numbers.v @@ -1,16 +1,14 @@ fn happy(h int) bool { mut m := map[int]bool{} - mut n := h + mut n, mut x := h, 0 for n > 1 { m[n] = true - mut x := 0 + x = 0 for x, n = n, 0; x > 0; x /= 10 { d := x % 10 n += d * d } - if m[n] { - return false - } + if m[n] { return false } } return true } @@ -22,5 +20,5 @@ fn main() { found++ } } - println('') + println("") } diff --git a/Task/Happy-numbers/VBScript/happy-numbers.vb b/Task/Happy-numbers/VBScript/happy-numbers.vbs similarity index 100% rename from Task/Happy-numbers/VBScript/happy-numbers.vb rename to Task/Happy-numbers/VBScript/happy-numbers.vbs diff --git a/Task/Harmonic-series/ALGOL-60/harmonic-series.alg b/Task/Harmonic-series/ALGOL-60/harmonic-series.alg new file mode 100644 index 0000000000..7b5f62d6ba --- /dev/null +++ b/Task/Harmonic-series/ALGOL-60/harmonic-series.alg @@ -0,0 +1,32 @@ +begin + +real i, h, n, limit; + +limit := 20; +h := 0; +outstring(1,"First"); +outreal(1,limit); +outstring(1,"numbers in the harmonic series\n"); +for i := 1, i + 1 while i <= limit do + begin + h := h + 1 / i; + outreal(1,i); + outreal(1,h); + outstring(1,"\n"); + end; + +for i := 1, i + 1 while i <= 5 do + begin + h := 1; + for n := 2, n + 1 while h <= i do + begin + h := h + 1 / n; + end; + outstring(1,"First harmonic number >"); + outreal(1,i); + outstring(1,"is at position"); + outreal(1,n-1); + outstring(1,"\n"); + end; + +end diff --git a/Task/Harmonic-series/ALGOL-68/harmonic-series.alg b/Task/Harmonic-series/ALGOL-68/harmonic-series.alg index b9fee50a9e..a050da661d 100644 --- a/Task/Harmonic-series/ALGOL-68/harmonic-series.alg +++ b/Task/Harmonic-series/ALGOL-68/harmonic-series.alg @@ -1,13 +1,13 @@ -BEGIN # find some harmonic numbers, Hn is the sum if the reciprocals of 1..n # +BEGIN # find some harmonic numbers, Hn is the sum of the reciprocals of 1..n # # returns the first n Harmonic numbers # OP HARMONIC = ( INT n )[]REAL: BEGIN - [ 1 : n ]REAL h; - h[ 1 ] := 1; + [ 1 : n ]REAL hs; + hs[ 1 ] := 1; FOR i FROM 2 TO n DO - h[ i ] := h[ i - 1 ] + ( 1 / i ) + hs[ i ] := hs[ i - 1 ] + ( 1 / i ) OD; - h + hs END # HARMONIC # ; # find the first 20 000 harmonic numbers # []REAL h = HARMONIC 20 000; @@ -21,7 +21,8 @@ BEGIN # find some harmonic numbers, Hn is the sum if the reciprocals of 1..n # FOR i TO UPB h DO IF h[ i ] > rqd real THEN # found the first harmonic number greater than rqd real # - print( ( "Position of the first harmonic number > ", whole( rqd int, -2 ), ": ", whole( i, 0 ), newline ) ); + print( ( "Position of the first harmonic number > ", whole( rqd int, -2 ) ) ); + print( ( ": ", whole( i, 0 ), newline ) ); rqd int +:= 1; rqd real +:= 1 FI diff --git a/Task/Harmonic-series/Ada/harmonic-series.adb b/Task/Harmonic-series/Ada/harmonic-series.adb new file mode 100644 index 0000000000..4e1c360707 --- /dev/null +++ b/Task/Harmonic-series/Ada/harmonic-series.adb @@ -0,0 +1,41 @@ +with Ada.Text_IO; + +procedure Harmonic_Numbers is + type Harmonic_State is record + N : Positive := 1; + Hn : Float := 1.0; + end record; + + procedure Iterate_Harmonics (Hs : in out Harmonic_State; Max_Steps : Positive := 1; Stop : Float := Float'Last) is + begin + for I in 1 .. Max_Steps loop + exit when Hs.Hn > Stop; + Hs.N := Hs.N + 1; + Hs.Hn := Hs.Hn + 1.0 / Float (Hs.N); + end loop; + end Iterate_Harmonics; + + procedure Show_First_Harmonics (N : Positive) is + Hs : Harmonic_State; + begin + for I in 1 .. N loop + Ada.Text_IO.Put_Line (Hs.N'Image & " => " & Hs.Hn'Image); + Iterate_Harmonics (Hs); + end loop; + end Show_First_Harmonics; + + -- Assume Floats is in order + type Floats is array (Positive range <>) of Float; + procedure Show_Harmonics_Greater (Ns : Floats) is + Hs : Harmonic_State; + begin + for I of Ns loop + Iterate_Harmonics (Hs, Positive'Last, I); + Ada.Text_IO.Put_Line (">" & I'Image & ":" & Hs.N'Image & " => " & Hs.Hn'Image); + end loop; + end Show_Harmonics_Greater; + +begin + Show_First_Harmonics (20); + Show_Harmonics_Greater ((1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0)); +end Harmonic_Numbers; diff --git a/Task/Harmonic-series/BQN/harmonic-series.bqn b/Task/Harmonic-series/BQN/harmonic-series.bqn new file mode 100644 index 0000000000..2d5eb490b2 --- /dev/null +++ b/Task/Harmonic-series/BQN/harmonic-series.bqn @@ -0,0 +1,6 @@ +Harmonic ← +`1÷∘+↕ + +⟨ + > 8↑⟜•Fmt¨ 5e¯7+ Harmonic 20 + 1+⍉(⊣≍(⌈ Harmonic 12400)⊐2+⊢)↕10 +⟩ diff --git a/Task/Harmonic-series/Bruijn/harmonic-series.bruijn b/Task/Harmonic-series/Bruijn/harmonic-series.bruijn new file mode 100644 index 0000000000..747d370e68 --- /dev/null +++ b/Task/Harmonic-series/Bruijn/harmonic-series.bruijn @@ -0,0 +1,16 @@ +:import std/List . +:import std/Combinator . +:import std/Math/Rational Q +:import std/Number N + +# fun Church iteration hack +harmonic [0 &[[(Q.add 1 op) : N.++0]] start [[1]]] ⧗ Unary → Rational + op (+1) : N.--0 + start (+0.0f) : (+1) + +custom-gt? &[[[N.gt? 2 (N.mul 0 N.++1)]]] ⧗ Rational → Νumber → Boolean + +main [φ cons first-20 first-10-above (harmonic <$> (iterate [[[1 (2 1 0)]]] (+0u)))] + first-20 take (+20) + first-10-above [take (+10) first-above] + first-above [find-index [custom-gt? 0 1] 1] <$> (iterate N.inc (+0)) diff --git a/Task/Harmonic-series/C-sharp/harmonic-series.cs b/Task/Harmonic-series/C-sharp/harmonic-series.cs new file mode 100644 index 0000000000..2fc08009b4 --- /dev/null +++ b/Task/Harmonic-series/C-sharp/harmonic-series.cs @@ -0,0 +1,79 @@ +using System; +using System.Numerics; + +public class BigRational +{ + public BigInteger Numerator { get; private set; } + public BigInteger Denominator { get; private set; } + + public BigRational(BigInteger numerator, BigInteger denominator) + { + if (denominator == 0) + throw new ArgumentException("Denominator cannot be zero.", nameof(denominator)); + + BigInteger gcd = BigInteger.GreatestCommonDivisor(numerator, denominator); + Numerator = numerator / gcd; + Denominator = denominator / gcd; + + if (Denominator < 0) + { + Numerator = -Numerator; + Denominator = -Denominator; + } + } + + public static BigRational operator +(BigRational a, BigRational b) + { + return new BigRational(a.Numerator * b.Denominator + b.Numerator * a.Denominator, a.Denominator * b.Denominator); + } + + public override string ToString() + { + return $"{Numerator}/{Denominator}"; + } +} + +class Program +{ + static BigRational Harmonic(int n) + { + BigRational sum = new BigRational(0, 1); + for (int i = 1; i <= n; i++) + { + BigRational r = new BigRational(1, i); + sum += r; + } + return sum; + } + + static void Main(string[] args) + { + Console.WriteLine("The first 20 harmonic numbers and the 100th, expressed in rational form, are:"); + int[] numbers = new int[21]; + for (int i = 1; i <= 20; i++) + { + numbers[i - 1] = i; + } + numbers[20] = 100; + foreach (int i in numbers) + { + Console.WriteLine($"{i,3} : {Harmonic(i)}"); + } + + Console.WriteLine("\nThe first harmonic number to exceed the following integers is:"); + const int limit = 10; + for (int i = 1, n = 1; i <= limit; n++) + { + double h = 0; + for (int j = 1; j <= n; j++) + { + h += 1.0 / j; + } + if (h > i) + { + Console.WriteLine($"integer = {i,2} -> n = {n,6} -> harmonic number = {h,9:F6} (to 6dp)"); + i++; + } + } + } +} diff --git a/Task/Harmonic-series/C/harmonic-series.c b/Task/Harmonic-series/C/harmonic-series.c new file mode 100644 index 0000000000..db4f01b2d4 --- /dev/null +++ b/Task/Harmonic-series/C/harmonic-series.c @@ -0,0 +1,24 @@ +#include +#include + +/* return nth harmonic number */ +double harmonic(int n) { + double h, i; + h = 0; + for (i = 1; i <= (double) n; i += 1.0) + h += 1 / i; + return h; +} + +int main(void) { + int i, n; + printf("First 20 harmonic numbers:\n"); + for (i = 1; i <= 20; i++) + printf("%2d %8.6lf\n", i, harmonic(i)); + for (i = 1; i <= 5; i++) { + int n = 2; + while (harmonic(n) <= (double) i) n++; + printf("First term > %d is at position %d\n", i, n); + } + return EXIT_SUCCESS; +} diff --git a/Task/Harmonic-series/CBASIC/harmonic-series.basic b/Task/Harmonic-series/CBASIC/harmonic-series.basic new file mode 100644 index 0000000000..35bb0c4f57 --- /dev/null +++ b/Task/Harmonic-series/CBASIC/harmonic-series.basic @@ -0,0 +1,19 @@ +limit = 20 +h = 0 +print "First";limit;"numbers in the harmonic series" +for i = 1 to limit + h = h + 1 / i + print using "## #.#####"; i; h +next i + +for i = 1 to 5 + h = 1 + n = 2 + while h <= i + h = h + 1 / n + n = n + 1 + wend + print "Position of first harmonic number >"; i; "is at"; n-1 +next i + +end diff --git a/Task/Harmonic-series/COBOL/harmonic-series.cobol b/Task/Harmonic-series/COBOL/harmonic-series.cob similarity index 100% rename from Task/Harmonic-series/COBOL/harmonic-series.cobol rename to Task/Harmonic-series/COBOL/harmonic-series.cob diff --git a/Task/Harmonic-series/Delphi/harmonic-series.delphi b/Task/Harmonic-series/Delphi/harmonic-series.pas similarity index 100% rename from Task/Harmonic-series/Delphi/harmonic-series.delphi rename to Task/Harmonic-series/Delphi/harmonic-series.pas diff --git a/Task/Harmonic-series/DuckDB/harmonic-series.duckdb b/Task/Harmonic-series/DuckDB/harmonic-series.duckdb new file mode 100644 index 0000000000..c0297fcc3c --- /dev/null +++ b/Task/Harmonic-series/DuckDB/harmonic-series.duckdb @@ -0,0 +1,21 @@ +# If mx > 0, then return a table of the first mx harmonic numbers, +# otherwise return a table with h up to: floor(h) < - mx +create or replace function harmonic_table(mx) as table ( + with recursive cte(ix,h) as ( + select 1 as ix, 1::DOUBLE as h + union all + select ix+1, h + 1/(ix+1) + from cte + where if (mx>0, ix < mx, floor(h) < - mx) + ) + from cte +); + +# First 20: +from harmonic_table(20); + +# Milestones: +from ( + select ix, lag(h) over () as hlag, h + from harmonic_table(-10) ) +where ceil(hlag) = trunc(h); diff --git a/Task/Harmonic-series/EasyLang/harmonic-series.easy b/Task/Harmonic-series/EasyLang/harmonic-series.easy new file mode 100644 index 0000000000..fbf03db1cf --- /dev/null +++ b/Task/Harmonic-series/EasyLang/harmonic-series.easy @@ -0,0 +1,17 @@ +numfmt 2 5 +print "The first twenty harmonic numbers are:" +for n = 1 to 20 + h += 1 / n + print n & " " & h +. +print "" +print "The first harmonic number greater than: " +h = 1 +n = 2 +for i = 2 to 10 + while h < i + h += 1 / n + n += 1 + . + print i & " is " & h & ", at position " & n - 1 +. diff --git a/Task/Harmonic-series/Fortran/harmonic-series.f b/Task/Harmonic-series/Fortran/harmonic-series.f new file mode 100644 index 0000000000..2ab5783463 --- /dev/null +++ b/Task/Harmonic-series/Fortran/harmonic-series.f @@ -0,0 +1,83 @@ +program harmonic_numbers + use :: iso_fortran_env, only: int64, output_unit + implicit none + integer, parameter :: real64 = selected_real_kind(15, 307) + + type :: fraction + integer(int64) :: numerator + integer(int64) :: denominator + end type fraction + + integer :: i, target_int + type(fraction) :: h_exact + real(real64) :: sum_h, h_decimal + character(len=200) :: fmt_str + + ! Print first 20 harmonic numbers as fractions + write(output_unit, '(a)') "## First 20 Harmonic Numbers" + write(output_unit, '(a)') "**Fractional Form**" + h_exact = fraction(0_int64, 1_int64) + do i = 1, 20 + h_exact = add_reciprocal(h_exact, i) + write(output_unit, '(i2, ": ", i0, "/", i0)') i, h_exact%numerator, h_exact%denominator + end do + + ! Print decimal approximations + write(output_unit, '(/, a)') "**Decimal Approximations**" + h_exact = fraction(0_int64, 1_int64) + do i = 1, 20 + h_exact = add_reciprocal(h_exact, i) + h_decimal = real(h_exact%numerator, real64) / real(h_exact%denominator, real64) + write(output_unit, '(i2, ": ", f0.12)') i, h_decimal + end do + + ! Find positions where harmonic numbers exceed integers 1-10 + write(output_unit, '(/, a)') "## Positions Where H? First Exceeds Integers" + write(output_unit, '(a)') "| Target | Position (n) | Decimal Approximation |" + write(output_unit, '(a)') "|--------|--------------|------------------------|" + write(fmt_str, '(a)') '(a, i2, a, T10, A, i0,T25, a, f0.6, T50,a)' + + do target_int = 1, 10 + sum_h = 0._real64 + i = 0 + do + i = i + 1 + sum_h = sum_h + 1.0_real64 / real(i, real64) + if (sum_h > real(target_int, real64)) then + if (target_int <= 5 .or. target_int >= 6) then + write(output_unit, FMT_STR) "| **", target_int, "**","| ", i, & + "| ", real(sum_h, real64), "|" + end if + exit + end if + end do + end do + +contains + + function add_reciprocal(h, n) result(new_h) + type(fraction), intent(in) :: h + integer, intent(in) :: n + type(fraction) :: new_h + integer(int64) :: common_denominator, new_numerator, divisor + + common_denominator = h%denominator * int(n, int64) + new_numerator = h%numerator * int(n, int64) + h%denominator + divisor = gcd(new_numerator, common_denominator) + + new_h%numerator = new_numerator / divisor + new_h%denominator = common_denominator / divisor + end function add_reciprocal + + recursive function gcd(a, b) result(greatest_common_divisor) + integer(int64), intent(in) :: a, b + integer(int64) :: greatest_common_divisor + + if (b == 0) then + greatest_common_divisor = a + else + greatest_common_divisor = gcd(b, mod(a, b)) + end if + end function gcd + +end program harmonic_numbers diff --git a/Task/Harmonic-series/Julia/harmonic-series-1.julia b/Task/Harmonic-series/Julia/harmonic-series-1.jl similarity index 100% rename from Task/Harmonic-series/Julia/harmonic-series-1.julia rename to Task/Harmonic-series/Julia/harmonic-series-1.jl diff --git a/Task/Harmonic-series/Julia/harmonic-series-2.julia b/Task/Harmonic-series/Julia/harmonic-series-2.jl similarity index 100% rename from Task/Harmonic-series/Julia/harmonic-series-2.julia rename to Task/Harmonic-series/Julia/harmonic-series-2.jl diff --git a/Task/Harmonic-series/OCaml/harmonic-series-1.ml b/Task/Harmonic-series/OCaml/harmonic-series-1.ml new file mode 100644 index 0000000000..0ace1720f1 --- /dev/null +++ b/Task/Harmonic-series/OCaml/harmonic-series-1.ml @@ -0,0 +1,9 @@ +let series = + Seq.scan (fun sum i -> Q.(sum + inv ~$i)) Q.one (Seq.ints 2) + +let positions = + Seq.unfold + (fun (n, s) -> + Seq.uncons (Seq.drop_while (fun iq -> Q.(n >= snd iq)) s) + |> Option.map (fun (iq, s) -> fst iq, Q.(n + one, s))) + (Q.one, Seq.zip (Seq.ints 1) series) diff --git a/Task/Harmonic-series/OCaml/harmonic-series-2.ml b/Task/Harmonic-series/OCaml/harmonic-series-2.ml new file mode 100644 index 0000000000..8350a4ae7d --- /dev/null +++ b/Task/Harmonic-series/OCaml/harmonic-series-2.ml @@ -0,0 +1,4 @@ +let _ = + let print fmt = Format.printf (fmt ^^ "\n") in + Seq.iteri (fun i h -> print "H(%d) =\t%a" (i + 1) Q.pp_print h) (Seq.take 20 series); + Seq.iteri (fun i n -> print "nth harmonic > %d:\t%d" (i + 1) n) (Seq.take 10 positions) diff --git a/Task/Harmonic-series/OCaml/harmonic-series-3.ml b/Task/Harmonic-series/OCaml/harmonic-series-3.ml new file mode 100644 index 0000000000..3e25736172 --- /dev/null +++ b/Task/Harmonic-series/OCaml/harmonic-series-3.ml @@ -0,0 +1,7 @@ +module Q = struct + include Stdlib.Float + let (~$) = of_int + let (+) = add + let inv = div 1. + let pp_print = Stdlib.Format.pp_print_float +end diff --git a/Task/Harmonic-series/Oberon-07/harmonic-series.oberon b/Task/Harmonic-series/Oberon-07/harmonic-series.oberon new file mode 100644 index 0000000000..c0fb7af5d8 --- /dev/null +++ b/Task/Harmonic-series/Oberon-07/harmonic-series.oberon @@ -0,0 +1,37 @@ +MODULE HarmonicSeries; (* find some harmonic numbers, Hn is the sum of the reciprocals of 1..n *) + IMPORT Out; + + VAR h : ARRAY 20001 OF REAL; + rqdInt, i : INTEGER; + rqdReal : REAL; + + PROCEDURE harmonic( VAR hs : ARRAY OF REAL ); (* sets hs to the first LEN(hs) - 1 Harmonic numbers *) + VAR i : INTEGER; (* hs[0] is unused *) + BEGIN + hs[ 1 ] := 1.0; + FOR i := 2 TO LEN( hs ) - 1 DO + hs[ i ] := hs[ i - 1 ] + ( 1.0 / FLT( i ) ) + END + END harmonic ; + +BEGIN + + harmonic( h ); (* find the first 20 000 harmonic numbers *) + + FOR i := 1 TO 20 DO (* show the first 20 harmonic numbers *) + Out.Int( i, 2 );Out.String( ":" );Out.Real( h[ i ], 14 );Out.Ln + END; + + (* find the positions of the first harmonic number > n where n in 1... *) + rqdInt := 1; + rqdReal := 1.0; + FOR i := 1 TO LEN( h ) - 1 DO + IF h[ i ] > rqdReal THEN + (* found the first harmonic number greater than rqdReal *) + Out.String( "Position of the first harmonic number > " );Out.Int( rqdInt, 2 ); + Out.String( ": " );Out.Int( i, 0 );Out.Ln; + INC( rqdInt ); + rqdReal := FLT( rqdInt ) + END + END +END HarmonicSeries. diff --git a/Task/Harmonic-series/PascalABC.NET/harmonic-series.pas b/Task/Harmonic-series/PascalABC.NET/harmonic-series.pas new file mode 100644 index 0000000000..e767fc50cc --- /dev/null +++ b/Task/Harmonic-series/PascalABC.NET/harmonic-series.pas @@ -0,0 +1,17 @@ +function H(n: integer): real := (1..n).Sum(i -> 1/i); + +begin + for var i:=1 to 20 do + Println($'{i,2}: {H(i),10:f8}'); + var i := 1; + var num := 1; + while num < 11 do + begin + if H(i) > num then + begin + Println('Position of the first harmonic number >',num,':',i); + num += 1; + end; + i += 1; + end; +end. diff --git a/Task/Harmonic-series/Phix/harmonic-series-1.phix b/Task/Harmonic-series/Phix/harmonic-series-1.phix index 757038f636..458bbff449 100644 --- a/Task/Harmonic-series/Phix/harmonic-series-1.phix +++ b/Task/Harmonic-series/Phix/harmonic-series-1.phix @@ -1,26 +1,24 @@ -(phixonline)--> - requires("0.8.4") - include mpfr.e - integer n = 1, gn = 1, lim = iff(platform()=JS?8:10) - mpq hn = mpq_init_set_si(1) - sequence gt = {} - puts(1,"First twenty harmonic numbers as rationals:\n") - while gn<=lim do - if n<=20 then - printf(1,"%18s%s",{mpq_get_str(hn),iff(mod(n,5)?" ","\n")}) - end if - if n=100 then - printf(1,"\nOne Hundredth:\n%s\n\n",{mpq_get_str(hn)}) - end if - if mpq_cmp_si(hn,gn)>0 then - gt &= n - gn += 1 - end if - n += 1 - mpq_add_si(hn,hn,1,n) - end while - printf(1,"(one based) Index of first value:\n") - for i=1 to length(gt) do - printf(1," greater than %2d: %,6d (%s term)\n",{i,gt[i],ordinal(gt[i])}) - end for - - integer n = 1, gn = 1 - atom hn = 1 - sequence gt = {} - puts(1,"First twenty harmonic numbers as fractions:\n") - while gn<=10 do - if n<=20 then - printf(1,"%18.15f%s",{hn,iff(mod(n,5)?" ","\n")}) - end if - if n=100 then - printf(1,"\nOne Hundredth: %18.15f\n\n",{hn}) - end if - if hn>gn then - gt &= n - gn += 1 - end if - n += 1 - hn += 1/n - end while - printf(1,"(one based) Index of first value:\n") - for i=1 to length(gt) do - printf(1," greater than %2d: %,6d (%s term)\n",{i,gt[i],ordinal(gt[i])}) - end for - {} = wait_key() - - with javascript_semantics - constant A = {{27,"Jonah"}, - {18,"Alan"}, - {28,"Glory"}, - {18,"Popeye"}, - {28,"Alan"}}, - B = {{"Jonah","Whales"}, - {"Jonah","Spiders"}, - {"Alan", "Ghosts"}, - {"Alan", "Zombies"}, - {"Glory","Buffy"}}, - jA = 2, - jB = 1, - MB = new_dict() - sequence C = {} - for i=1 to length(B) do - object key = B[i][jB] - object data = getd(key,MB) - if data=0 then - data = {B[i]} - else - data = append(data,B[i]) - end if - putd(key,data,MB) - end for - for i=1 to length(A) do - object data = getd(A[i][jA],MB) - if sequence(data) then - for j=1 to length(data) do - C = append(C,{A[i],data[j]}) - end for - end if - end for - destroy_dict(MB) - pp(C,{pp_Nest,1}) -( (age,age...), (nemesis,...) ) if (r:=d.find(name)){ diff --git a/Task/Haversine-formula/ALGOL-W/haversine-formula.alg b/Task/Haversine-formula/ALGOL-W/haversine-formula.alg index 9fc4fa5d35..8e58f6c95f 100644 --- a/Task/Haversine-formula/ALGOL-W/haversine-formula.alg +++ b/Task/Haversine-formula/ALGOL-W/haversine-formula.alg @@ -16,8 +16,8 @@ begin % compute the distance between places using the Haversine formula % real d; integer mi, km; d := distance( 36.12, -86.67, 33.94, -118.4 ); - mi := round( d ); - km := round( d / 1.609344 ); - writeon( i_w := 4, s_w := 0, "distance: ", mi, " km (", km, " mi.)" ) + km := round( d ); + mi := round( d / 1.609344 ); + writeon( i_w := 4, s_w := 0, "distance: ", km, " km (", mi, " mi.)" ) end end. diff --git a/Task/Haversine-formula/Ada/haversine-formula.ada b/Task/Haversine-formula/Ada/haversine-formula.adb similarity index 100% rename from Task/Haversine-formula/Ada/haversine-formula.ada rename to Task/Haversine-formula/Ada/haversine-formula.adb diff --git a/Task/Haversine-formula/Agena/haversine-formula.agena b/Task/Haversine-formula/Agena/haversine-formula.agena new file mode 100644 index 0000000000..cb1dad8071 --- /dev/null +++ b/Task/Haversine-formula/Agena/haversine-formula.agena @@ -0,0 +1,18 @@ +scope # compute the distance between places using the Haversine formula + + local proc distance( th1Deg :: number, ph1Deg :: number, th2Deg :: number, ph2Deg :: number ) :: number + local constant ph1 := ( ph1Deg - ph2Deg ) * radians; + local constant th1 := th1Deg * radians; + local constant th2 := th2Deg * radians; + local constant dz := sin( th1 ) - sin( th2 ); + local constant dx := cos( ph1 ) * cos( th1 ) - cos( th2 ); + local constant dy := sin( ph1 ) * cos( th1 ); + return arcsin( sqrt( dx * dx + dy * dy + dz * dz ) / 2 ) * 2 * 6371 + end; + + scope + local constant d := distance( 36.12, -86.67, 33.94, -118.4 ); + local constant km, constant mi := round( d ), round( d / 1.609344 ); + printf( "distance: %4d km (%4d mi.)", km, mi ) + epocs +epocs diff --git a/Task/Haversine-formula/Amazing-Hopper/haversine-formula.hopper b/Task/Haversine-formula/Amazing-Hopper/haversine-formula.hopper new file mode 100644 index 0000000000..2990f4560e --- /dev/null +++ b/Task/Haversine-formula/Amazing-Hopper/haversine-formula.hopper @@ -0,0 +1,40 @@ +/* fórmula de Haversine para distancias en una + superficie esférica */ + +#include + +#define MIN 60 +#define SEG 3600 +#define RADIO 6372.8 +#define UNAMILLA 1.609344 + +algoritmo + + números ( lat1, lon1, lat2, lon2, dlat, dlon, millas ) + + si ' total argumentos es (9) ' // LAT1 M LON1 M LAT2 M LON2 M + #basic{ lat1 = narg(2) + narg(3)/MIN + lon1 = narg(4) + narg(5)/MIN + lat2 = narg(6) + narg(7)/MIN + lon2 = narg(8) + narg(9)/MIN } + + sino si ' total argumentos es (13) ' // LAT1 M LON1 M S LAT2 M LON2 M S + #basic{ lat1 = narg(2) + narg(3)/MIN + narg(4)/SEG + lon1 = narg(5) + narg(6)/MIN + narg(7)/SEG + lat2 = narg(8) + narg(9)/MIN + narg(10)/SEG + lon2 = narg(11) + narg(12)/MIN + narg(13)/SEG } + sino + imprimir("Modo de uso:\ndist.bas La1 M [S] Lo1 M [S] La2 M [S] Lo2 M [S]\n") + término prematuro + fin si + + #basic{ + dlat = sin(radian(lat2 - lat1)/2)^2 + dlon = sin(radian(lon2 - lon1)/2)^2 + RADIO*(2*arc sin(sqrt(dlat + cos(radian(lat1)) * cos(radian(lat2)) * dlon ))) + } + + ---copiar en 'millas'---, " km. (",millas,dividido por (UNA MILLA)," mi.)\n" + decimales '2', imprimir + +terminar diff --git a/Task/Haversine-formula/Bc/haversine-formula.bc b/Task/Haversine-formula/Bc/haversine-formula.bc index 3aad71d5b6..eaeea4816d 100644 --- a/Task/Haversine-formula/Bc/haversine-formula.bc +++ b/Task/Haversine-formula/Bc/haversine-formula.bc @@ -1,8 +1,11 @@ #!/bin/sh #- -# © 2021 mirabilos Ⓕ CC0; implementation of Haversine GCD from public sources +# © 2021 mirabilos Ⓕ CC0 or MirBSD # -# now developed online: +# implementation of Haversine GCD from public sources +# output is in metres (rounded to millimetres), error < ¼% +# +# now developed online: (user/pass public) # https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=useful-scripts/mirkarte.git;a=blob;f=geo.sh;hb=HEAD if test "$#" -ne 4; then @@ -23,8 +26,8 @@ export BC_ENV_ARGS # h: haversine intermediate # i,j: (lat,lon) point 1 # x,y: (lat,lon) point 2 -# k: delta lat -# l: delta lon +# k: delta lat/ΔΦ +# l: delta lon/Δλ # m: sin(k/2) (square root of hav(k)) # n: sin(l/2) ( partial haversine ) # n(x): arcsin(x) @@ -32,7 +35,7 @@ export BC_ENV_ARGS # v(x): sign (Vorzeichen) # w(x): min(1, sqrt(x)) (Wurzel) -bc -l <<-EOF +exec bc -l <<-EOF scale=64 define n(x) { if (x == -1) return (-2 * a(1)) @@ -59,7 +62,8 @@ define w(x) { return (sqrt(x)) } /* WGS84 reference ellipsoid: große Halbachse (metres), Abplattung */ -i = 6378137.000 +/* (6378137 in WGS84); this radius from Astronomical Almanac 2021 */ +i = 6378136.600 x = 1/298.257223563 /* other axis */ j = i * (1 - x) @@ -80,5 +84,3 @@ h = ((m * m) + (c(i) * c(x) * n * n)) d = 2 * r * n(w(h)) r(d, 3) EOF - -# output is in metres, rounded to millimetres, error < ¼% in WGS84 diff --git a/Task/Haversine-formula/Crystal/haversine-formula.crystal b/Task/Haversine-formula/Crystal/haversine-formula.cr similarity index 100% rename from Task/Haversine-formula/Crystal/haversine-formula.crystal rename to Task/Haversine-formula/Crystal/haversine-formula.cr diff --git a/Task/Haversine-formula/Delphi/haversine-formula.delphi b/Task/Haversine-formula/Delphi/haversine-formula.pas similarity index 100% rename from Task/Haversine-formula/Delphi/haversine-formula.delphi rename to Task/Haversine-formula/Delphi/haversine-formula.pas diff --git a/Task/Haversine-formula/DuckDB/haversine-formula.duckdb b/Task/Haversine-formula/DuckDB/haversine-formula.duckdb new file mode 100644 index 0000000000..f301d80fe5 --- /dev/null +++ b/Task/Haversine-formula/DuckDB/haversine-formula.duckdb @@ -0,0 +1,7 @@ +# install spatial; -- if required +load spatial; + +select [lat1, lon1], [lat2, lon2], + ST_Distance_sphere( ST_Point(lat1, lon1), ST_Point(lat2,lon2)) as "Haversine (m)", + ST_Distance_spheroid(ST_Point(lat1, lon1), ST_Point(lat2,lon2)) as "ellipsoid (m)" +from (select 36.12 as lat1, -86.67 as lon1, 33.94 at lat2, -118.40 as lon2); diff --git a/Task/Haversine-formula/EDSAC-order-code/haversine-formula.edsac b/Task/Haversine-formula/EDSAC-order-code/haversine-formula.edsac new file mode 100644 index 0000000000..e6a18551aa --- /dev/null +++ b/Task/Haversine-formula/EDSAC-order-code/haversine-formula.edsac @@ -0,0 +1,181 @@ +[Haversine formula, for Rosetta Code.] +[EDSAC, initial orders 2.] + [Arrange the storage] + T49K P56F [L, 35 locations: library s/r R4 to read integer.] + [Can overwrite R9 once R9 is no longer needed.] + T46K P92F [N, 35 locations: library s/r P7 (print integer)] + T52K P128F [A, 33 locations: library subroutine T4 (arccos)] + T53K P162F [B, 44 locations: 1ibrary subroutine T1 (cos)] + T54K P206F [C, 10 locations: wrapper for library subroutine T1] + T51K P216F [G, 24 locations: inverse haversine function] + T45K P240F [H, 36 locations: haversine function] + T55K P276F [V, 11 locations: constants] + T47K P288F [M, 92 locations: main routine] +[----------------------------------------------------------------------------] +[Library subroutine R9 to read integers from tape at load time.] +[Must be placed at location 56; occupies 15 locations.] + T56K +GKT20FVDL8FA40DUDTFI40FA40FS39FG@S2FG23FA5@T5@E4@ +[----------------------------------------------------------------------------] +[Library subroutine M3. Prints header at load time and is then overwritten.] +[In this program, also sets teleprinter to figures.] +PFGKIFAFRDLFUFOFE@A6FG@E8FEZPF + *DISTANCES!IN!METRES@&WITH!RADIUS# + .. PK [after header, blank tape and PK (WWG, 1951, page 91)] +[----------------------------------------------------------------------------] +[Constants. Load at even address.] + E25K TV GK + E69K [at load time, call library s/r R9 to read 35-bit contants] + T#V [tell R9 where to store constants] + [0] 1800000000F [180 degrees, in units of 10^-7 degree] + [2] 900000000F [90 ditto] + [4] 16097821018F [for changing angle unit to radians] + [6] 13493037750F [pi/4 as EDSAC integer, i.e. times 2^34] + [8] 6371100# [Earth radius in metres, from MK-61/52 solution] + T10Z [resume normal loading] + [10] RF [17-bit 1/4] +[----------------------------------------------------------------------------] +[Main routine. Load at even address.] + E25K TM GK +[35-bit variables, general workspace] + [0] [2] [4] [6] [8] +[17-bit variables] + [10] [number of examples] + [11] [example number] + T12Z [variablss are not initialized; skip over them at load time] +[17-bit constants] + [12] PD [1] + [13] CF [ teleprinter colon (in figures mode)] + [14] @F [15] &F [16] K4096F [CR, LF, null] + [Enter with acc = 0] + [17] A8#V TD [pass Earth's radius to printer routine] + A19@ GN [finish header: print radius followed by CR, LF] + O14@ O15@ + A23@ GL [call library s/r R4, 0D := number of examples] + AF T10@ [store (assume < 2^16)] + [Here acc = example number just done (0 first time)] + [27] S10@ E98@ [if all done, jump to exit] + A10@ A12@ T11@ [inc and store example number] + TD A11@ TF [0D := example number, extended to 35 bits] + A35@ GN O13@ [print example number followed by colon] + [Use library subroutine R4 to read data from tape to 0D.] + [Coordinates are lat1, lon1, lat2, lon2.] + A38@ GL AD U#@ T4D [lat1 to work{0} and 4D] + A43@ GC A4D T2#@ [0.5*cos(lat1) to work{1}] + A47@ GL AD T8#@ [lon1 to work{4}] + A51@ GL AD U4#@ T4D [lat2 to work{2} and 4D] + A56@ GC A4D T6#@ [0.5*cos(lat2) to work{3}] + A60@ GL AD S8#@ T4D [lon2 - lon1 to 4D] + A65@ GH [0.5*hav(lon2 - lon1) to 4D] + H2#@ V4D LD YF T4D [times cos(lat1) to 4D] + H6#@ V4D LD YF T8#@ [times cos(lat2) to work{4}] + A#@ S4#@ T4D [lat1 - lat2 to 4D] + A80@ GH A4D [0.5*hav(lat1 - lat2) to acc] + A8#@ T4D [add product from above, sum to 4D] + A85@ GG H4D [mult reg := angle/4 in radians] + V8#V L1F YF TD [times radius*4, to 0D for printing] + A92@ GN O14@ O15@ [print distance followed by CR, LF] + A11@ E27@ [acc := example numbr; loop back] + [Exit] + [98] O16@ [print null to flush teleprinter buffer] + ZF [stop] +[----------------------------------------------------------------------------] +[Haversine function, for Rosetta Code.] +[Input: 4D = angle x in range -360..360 deg,] + [expressed as integer multiple of 10^-7 deg.] +[Output: 4D = hav(x)/2 = (1 - cos(x))/4] +[Load at even address. Requires library subroutines R9 and T1.] + E25K TH GK + A3F T35@ [plant return link as usual] + [2] A4D E6@ [acc := x; jump if x >= 0] + T4D + [5] S4D [else x := -x] + [Here with acc = abs(x). Use symmetry about 180 deg.] + [6] S#V G10@ [jump if x < 180] + TD SD [else acc := 180 - x] + [10] A2#V [combine next 2 orders, which are shown as comments] + [A #V] [add 180: either restore x, or set x := 360 - x] + [Here 0 <= x <= 180. Use antisymmetry about 90 deg.] + [S 2 #V] [subtract 90] + E17@ [jump if x >= 90 degrees] + TD A5@ T30@ [save acc, plant S4D below] + AD G21@ [acc := x - 90, join common code] + [17] TD A2@ T30@ [save acc, plant A4D below] + SD [acc := 90 - x] + [21] A2#V [either restore x, or set x := 180 - x] + TD H4#V VD L4F YF [apply angle conversion factor] + [Here acc = x/2, now in radians. Pass it to cosine function] + T4D + A28@ GB [call cosine function; returns 4D := cos(x)/2] + [30] XF [(planted) either A4D or S4D] + RD YF A10V [divide by 2, round, add 1/4] + T4D [return haversine/2 in 4D] + [35] ZF [(planted) jump back to caller] +[----------------------------------------------------------------------------] +[Inverse haversine function.] +[Input: 4D = hav(x)/2] +[Output: 4D = x/4 in radians, where 0 <= x <= pi] + E25K TG GK + A3F T23@ [plant return link as usual] + A10V S4D LD YF [acc := 1/2 - hav(x) = cos(x)/2] + G13@ [jumo if cos(x) < 0] + T4D [pass cos(x)/2 to library subroutine T4 (arccis)] + A8@ GA AD RD [call T4, 0D ;= x/2; then acc := x/4] + E21@ [join common code] + [13] TD SD T4D [here if cos(x) < 0; set 4D := -cos(x)/2] + A16@ GA [call T4 (arccos); 0D := (pi - x)/2] + SD RD A6#V [acc := -(pi - x)/4 + pi/4 = x/4] + [21] YF T4D [round redult and return it in 4D] + [23] ZF [(planted) jump back to caller] +[----------------------------------------------------------------------------] +[Wrapper for library subroutine T1 (cosine).] +[Input: 4D = angle x as integer multiple of 10^-7 degree.] +[Output: 4D = cos(x)/2] + E25K TC GK + A3F T9@ [plant return link as usual] + H4#V V4D L4F YF T4D [4D := x/2 in radians] + A7@ GB [call T1, puts cos(x)/2 into 4D] + [9] ZF [jump back to caller] +[----------------------------------------------------------------------------] +[Library subroutine T1: calculates cos(x), where abs(x) <= pi/2] +[Input: 4D = x/2] +[Output: 4D = cos(x)/2] +[Requires library subroutine R9.] + E25K TB +GKT20FVDL8FA40DUDTFI40FA40FS39FG@S2FG23FA5@T5@E4@E13ZT32#@ +1614F73454F243967F54539267F763549741F5726623061# +TZA3FT30@H4DV4DYFT4DH4DN32#@A34#@TDNDA36#@TDNDA38#@ +TDNDA40#@TDNDA42#@TDNDYFTDNDS4DA31@YFT4DEFIFT44Z +[----------------------------------------------------------------------------] +[Library subroutine T4: calculates arccos] +[Input: 4D = cos(x)/2, assumed >= 0] +[Output: 0D = x/2 where 0 <= x <= pi/2] + E25K TA +GKA3FT28@TDA32@T6DH4DV4DL1FS29@YFE16@T4DSDA6DTDS4DT4DA6DRD +YFG4@HDN30#@YFE27@T4DS4DTDEFIFT30#ZD888FT30ZO699DT32ZK4096F +[----------------------------------------------------------------------------] +[Library subroutine P7. Prints 35-bit positive integer in 0D.] +[Up to 10 digits, right-justified, padded on left with spaces.] + E25K TN +GKA3FT26@H28#@NDYFLDT4DS27@TFH8@S8@T1FV4DAFG31@SFLDUFOFFFSF +L4FT4DA1FA27@G11@T28#ZPFT27ZP1024FP610D@524D!FO30@SFL8FE22@ +[----------------------------------------------------------------------------] +[Library subroutine R4. Reads signed integer from tape at run time.] +[Input : None] +[Output : 0D = 35-bit signed integer.] + E25K TL +GKA3FT21@T4DH6@E11@P5DJFT6FVDL4FA4DTDI4FA4FS5@G7@S5@G20@SDTDT6FEF +[----------------------------------------------------------------------------] + E25K TM GK [M parameter again] + E17Z [define entry point] + PF [acc = 0 on entry] +[----------------------------------------------------------------------------] +[Latitude and longitude of each airport, in units of 10^-7 degree.] +[Read from tape by library subroutine R4. Note that sign comes after value.] +3+ [number of examples] +361200000+866700000- [Nashville] +339400000+1184000000- [Los Angeles] +547166667+205000000+ [Kaliningrad] +431166667+1319000000+ [Vladivostok] +499133333+62916667- [St Mary's, Scilly Isles] +601919444+12436111- [Tingwall, Shetland Isles] diff --git a/Task/Haversine-formula/EasyLang/haversine-formula.easy b/Task/Haversine-formula/EasyLang/haversine-formula.easy new file mode 100644 index 0000000000..5f50b5807f --- /dev/null +++ b/Task/Haversine-formula/EasyLang/haversine-formula.easy @@ -0,0 +1,9 @@ +func dist th1 ph1 th2 ph2 . + r = 6371 + ph1 -= ph2 + dz = sin th1 - sin th2 + dx = cos ph1 * cos th1 - cos th2 + dy = sin ph1 * cos th1 + return 2 * r * pi / 180 * asin (sqrt (dx * dx + dy * dy + dz * dz) / 2) +. +print dist 36.12 -86.67 33.94 -118.4 diff --git a/Task/Haversine-formula/Elena/haversine-formula.elena b/Task/Haversine-formula/Elena/haversine-formula.elena index a88153e368..49527462a5 100644 --- a/Task/Haversine-formula/Elena/haversine-formula.elena +++ b/Task/Haversine-formula/Elena/haversine-formula.elena @@ -15,7 +15,7 @@ Haversine(lat1,lon1,lat2,lon2) ^ R * 2 * a.sqrt().arcsin() } -public program() +public Program() { console.printLineFormatted("The distance between coordinates {0},{1} and {2},{3} is: {4}", 36.12r, -86.67r, 33.94r, -118.40r, Haversine(36.12r, -86.67r, 33.94r, -118.40r)) diff --git a/Task/Haversine-formula/Elixir/haversine-formula.elixir b/Task/Haversine-formula/Elixir/haversine-formula.ex similarity index 100% rename from Task/Haversine-formula/Elixir/haversine-formula.elixir rename to Task/Haversine-formula/Elixir/haversine-formula.ex diff --git a/Task/Haversine-formula/Fennel/haversine-formula.fennel b/Task/Haversine-formula/Fennel/haversine-formula.fennel new file mode 100644 index 0000000000..d4b0b8029b --- /dev/null +++ b/Task/Haversine-formula/Fennel/haversine-formula.fennel @@ -0,0 +1,18 @@ +(do ;;; compute the distance between places using the Haversine formula + (fn distance [th1Deg ph1Deg th2Deg ph2Deg] + (local ph1 (math.rad (- ph1Deg ph2Deg))) + (local th1 (math.rad th1Deg)) + (local th2 (math.rad th2Deg)) + (local dz (- (math.sin th1) (math.sin th2))) + (local dx (- (* (math.cos ph1) (math.cos th1)) (math.cos th2))) + (local dy (* (math.sin ph1) (math.cos th1))) + (* (math.asin (/ (math.sqrt (+ (* dx dx) (* dy dy) (* dz dz))) 2)) 2 6371) + ) + (do + (fn round [n] (math.floor (+ n 0.49999999999))) + + (local d (distance 36.12 -86.67 33.94 -118.4)) + (local (km mi) (values (round d) (round (/ d 1.609344)))) + (print (.. "distance: " km " km (" mi " mi.)")) + ) +) diff --git a/Task/Haversine-formula/Gambas/haversine-formula.gambas b/Task/Haversine-formula/Gambas/haversine-formula.gambas new file mode 100644 index 0000000000..c330f292a2 --- /dev/null +++ b/Task/Haversine-formula/Gambas/haversine-formula.gambas @@ -0,0 +1,21 @@ +Public deg2rad As Float = Pi / 180 ' define grados a radianes 0.01745.. +Public radioTierra As Float = 6372.8 ' radio de la tierra en km + +Public Sub Main() + + Print "\n Distancia de Haversine entre BNA y LAX = "; Haversine(36.12, -86.67, 33.94, -118.4, radioTierra); " km" + +End + +Function Haversine(lat1 As Float, long1 As Float, lat2 As Float, long2 As Float, radio As Float) As Float + + Dim d_long As Float = deg2rad * (long1 - long2) + Dim theta1 As Float = deg2rad * lat1 + Dim theta2 As Float = deg2rad * lat2 + Dim dx As Float = Cos(d_long) * Cos(theta1) - Cos(theta2) + Dim dy As Float = Sin(d_long) * Cos(theta1) + Dim dz As Float = Sin(theta1) - Sin(theta2) + + Return ASin(Sqr(dx * dx + dy * dy + dz * dz) / 2) * radio * 2 + +End Function diff --git a/Task/Haversine-formula/Julia/haversine-formula.julia b/Task/Haversine-formula/Julia/haversine-formula.jl similarity index 100% rename from Task/Haversine-formula/Julia/haversine-formula.julia rename to Task/Haversine-formula/Julia/haversine-formula.jl diff --git a/Task/Haversine-formula/Kotlin/haversine-formula.kotlin b/Task/Haversine-formula/Kotlin/haversine-formula.kts similarity index 100% rename from Task/Haversine-formula/Kotlin/haversine-formula.kotlin rename to Task/Haversine-formula/Kotlin/haversine-formula.kts diff --git a/Task/Haversine-formula/MiniScript/haversine-formula.mini b/Task/Haversine-formula/MiniScript/haversine-formula.mini new file mode 100644 index 0000000000..6e4952c0d7 --- /dev/null +++ b/Task/Haversine-formula/MiniScript/haversine-formula.mini @@ -0,0 +1,17 @@ +// compute the distance between places using the Haversine formula + +distance = function( th1Deg, ph1Deg, th2Deg, ph2Deg ) + toRadians = pi / 180 + ph1 = toRadians * ( ph1Deg - ph2Deg ) + th1 = toRadians * th1Deg + th2 = toRadians * th2Deg + dz = sin( th1 ) - sin( th2 ) + dx = cos( ph1 ) * cos( th1 ) - cos( th2 ) + dy = sin( ph1 ) * cos( th1 ) + return asin( sqrt( dx * dx + dy * dy + dz * dz ) / 2 ) * 2 * 6371 +end function + +d = distance( 36.12, -86.67, 33.94, -118.4 ) +km = round( d ) +mi = round( d / 1.609344 ) +print( "distance: " + km + " km (" + mi + " mi.)" ) diff --git a/Task/Haversine-formula/NetRexx/haversine-formula.netrexx b/Task/Haversine-formula/NetRexx/haversine-formula.netrexx new file mode 100644 index 0000000000..ded11a6a34 --- /dev/null +++ b/Task/Haversine-formula/NetRexx/haversine-formula.netrexx @@ -0,0 +1,40 @@ +/*REXX pgm calculates distance between Nashville & Los Angles airports. */ +say " Nashville: north 36° 7.2', west 86° 40.2' = 36.12°, -86.67°" +say "Los Angles: north 33° 56.4', west 118° 24.0' = 33.94°, -118.40°" +say +dist=surfaceDistance(36.12, -86.67, 33.94, -118.4) +say dist + +bef = Length(dist/1) +kdist=format(dist/1,bef,2) +mdist=format(dist/1.609344,bef,2) +ndist=format(mdist*5280/6076.1,bef,2) +say ' distance between= ' kdist " kilometers," +say ' or ' mdist " statute miles," +say ' or ' ndist " nautical or air miles." +exit /*stick a fork in it, we're done.*/ +/*----------------------------------SURFACEDISTANCE subroutine----------*/ + +method radians(x) static + return x * Math.PI / 180 + +method surfaceDistance(lat1,lon1,lat2,lon2) public static /*use haversine formula for dist.*/ + radius = 6372.8 /*earth's mean radius in km */ + dLat = radians(lat2 - lat1) + dLon = radians(lon2 - lon1) + lat1 = radians(lat1) + lat2 = radians(lat2) + + a = sin(dLat / 2)**2 + cos(lat1) * cos(lat2) * sin(dLon / 2) ** 2 + c = 2 * asin(sqrt(a)) + + return radius * c + +method cos(x) static + return Rexx Math.cos(x) +method sin(x) static + return Rexx Math.sin(x) +method asin(x) static + return Rexx Math.asin(x) +method sqrt(x) static + return Rexx Math.sqrt(x) diff --git a/Task/Haversine-formula/OCaml/haversine-formula.ocaml b/Task/Haversine-formula/OCaml/haversine-formula.ml similarity index 100% rename from Task/Haversine-formula/OCaml/haversine-formula.ocaml rename to Task/Haversine-formula/OCaml/haversine-formula.ml diff --git a/Task/Haversine-formula/PascalABC.NET/haversine-formula.pas b/Task/Haversine-formula/PascalABC.NET/haversine-formula.pas new file mode 100644 index 0000000000..8eafc78a1a --- /dev/null +++ b/Task/Haversine-formula/PascalABC.NET/haversine-formula.pas @@ -0,0 +1,19 @@ +const + r = 6372.8; + +function haversine(lat1, lon1, lat2, lon2: real): real; +begin + var dLat := degToRad(lat2 - lat1); + var dLon := degToRad(lon2 - lon1); + lat1 := degToRad(lat1); + lat2 := degToRad(lat2); + + var a := sin(dLat / 2) * sin(dLat / 2) + cos(lat1) * cos(lat2) * sin(dLon / 2) * sin(dLon / 2); + var c := 2 * arcsin(sqrt(a)); + + result := r * c; +end; + +begin + haversine(36.12, -86.67, 33.94, -118.40).Println; +end. diff --git a/Task/Haversine-formula/Phix/haversine-formula.phix b/Task/Haversine-formula/Phix/haversine-formula.phix index a5c8ad31c1..921a3dcd5e 100644 --- a/Task/Haversine-formula/Phix/haversine-formula.phix +++ b/Task/Haversine-formula/Phix/haversine-formula.phix @@ -1,14 +1,15 @@ -(phixonline)--> - function haversine(atom lat1, long1, lat2, long2) - constant MER = 6371, -- mean earth radius(km) - DEG_TO_RAD = PI/180 - lat1 *= DEG_TO_RAD - lat2 *= DEG_TO_RAD - long1 *= DEG_TO_RAD - long2 *= DEG_TO_RAD - return MER*arccos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(long2-long1)) - end function +with javascript_semantics +constant MER = 6371, -- mean earth radius, authalic(km) +--constant MER = 6372.8, -- mean earth radius, average(km) + DEG_TO_RAD = PI/180 - atom d = haversine(36.12,-86.67,33.94,-118.4) - printf(1,"Distance is %f km (%f miles)\n",{d,d/1.609344}) - - puts(1,"Hello world!") - - puts(1,"Hello world!") - - puts(1,"Hello world!") - - -- - -- pwa\phix\hello_world.exw - -- ======================== - -- - with javascript_semantics - include pGUI.e - - IupOpen() - Ihandle lbl = IupFlatLabel("World!","EXPAND=YES, ALIGNMENT=ACENTER") - Ihandln dlg = IupDialog(lbl,"TITLE=Hello, RASTERSIZE=215x85") - IupShow(dlg) - if platform()!=JS then - IupMainLoop() - dlg = IupDestroy(dlg) - IupClose() - end if - - with javascript_semantics - function af(string s) return max(s)<='f' and min(s)>='a' end function - function digital_root(integer n) - assert(n>=0) - while n>9 do - integer tot = 0 - while n>0 do - tot += remainder(n,10) - n = floor(n/10) - end while - n = tot - end while - return n - end function - sequence words = filter(unix_dict(4),af), - decml = apply(true,to_integer,{words,0,16}), - roots = apply(decml,digital_root), - tags = custom_sort(roots,tagset(length(roots))) +with javascript_semantics +function af(string s) return max(s)<='f' and min(s)>='a' end function +function digital_root(integer n) + assert(n>=0) + while n>9 do + integer tot = 0 + while n>0 do + tot += remainder(n,10) + n = floor(n/10) + end while + n = tot + end while + return n +end function +sequence words = filter(unix_dict(4),af), + decml = apply(true,to_integer,{words,0,16}), + roots = apply(decml,digital_root), + tags = custom_sort(roots,tagset(length(roots))) - function caejasp() -- columnize/apply/extract/join/apply/sprint(...) - sequence s = columnize(apply(true,extract,{{words,decml,roots},{tags}})) - return join(apply(true,sprintf,{{"%6s -> %8d -> %d\n"},s})) - end function - printf(1," %s\n %d hex words with 4 or more letters found,\n",{caejasp(),length(tags)}) - function ge4(integer t) return length(unique(words[t]))>=4 end function - tags = filter(tags,ge4) - tags = extract(tags,reverse(custom_sort(extract(decml,tags),tagset(length(tags))))) - printf(1," %d with 4 or more distinct characters:\n\n %s\n",{length(tags),caejasp()}) - - without javascript_semantics -- (no mpfr_log() for pwa/p2js) - requires("1.0.0") -- (mpfr_set_default_prec[ision] renamed) - include mpfr.e - mpfr_set_default_precision(-23) -- (found by trial/error) - mpfr ln2 = mpfr_init(2), - hn = mpfr_init(0.5) - mpfr_log(ln2,ln2) - mpfr_div(hn,hn,ln2) - for n=1 to 17 do - mpfr_mul_si(hn,hn,n) - mpfr_div(hn,hn,ln2) - string n10 = mpfr_sprintf("%24.4Rf ",hn) - n10 &= iff(find(n10[21],"09")?"Y":"N") - printf(1,"%2d:%s\n",{n,n10}) - end for -} 'assign - -records: function [historyVar][ - historyVar\record -] - -retrieve: function [historyVar][ - result: last historyVar\record - historyVar\record: chop historyVar\record - return result -] - -current: function [historyVar][ - return last historyVar\record -] - -do [ - h: to :history [] +h: to :history [] +do :: print "Assigning three values: 1, 2, 3..." - h --> 1 - h --> 2 - h --> 3 + h\assign 1 + h\assign 2 + h\assign 3 print "\nHistory (oldest values first):" - print [">" records h] + print [">" h\records] - print ["\nCurrent value is:" current h] + print ["\nCurrent value is:" h\current] print "\nRecalling the three values..." loop 1..3 'x -> - print ["- Recalled:" retrieve h] + print ["- Recalled:" h\retrieve] print "\nHistory:" - print [">" records h] -] + print [">" h\records] diff --git a/Task/History-variables/C/history-variables.c b/Task/History-variables/C/history-variables.c new file mode 100644 index 0000000000..8b26474871 --- /dev/null +++ b/Task/History-variables/C/history-variables.c @@ -0,0 +1,126 @@ +#include +#include +#include + +// +// high address________ +// |________| length +// T *p ---> |___ ____| most recent value +// |____ ___| +// | +// |___ ____ +// |_____ __| +// |________| oldest value +// low address +// + +static size_t hv__align(void const *p, size_t z) { + return z + ((sizeof(z) - (((size_t)p + z) % sizeof(z))) % sizeof(z)); +} + +static size_t hvlen(void const *p, size_t z) { + return *(size_t *)((char *)p + hv__align(p, z)); +} + +static void *hv__malloc(size_t z) { + size_t const m = z + (2 * sizeof(z)); + void *const p = malloc(m); + if(p) { + *(size_t *)((char *)p + hv__align(p, z)) = 1; + return p; + } + perror(""); + abort(); +} + +static void *hv__realloc(void *p, size_t z, size_t n) { + size_t const u = hvlen(p, z); + size_t const o = (n > 1) ? n * z : z; + size_t const g = (u > 1) ? u * z : z; + size_t const m = o + (2 * sizeof(z)); + void *const b = (char *)p - (g - z); + p = realloc(b, m); + if(p) { + p = (char *)p + (o - z); + *(size_t *)((char *)p + hv__align(p, z)) = n; + return p; + } + perror(""); + abort(); +} + +static void *hvfree(void const *p, size_t z) { + if(p) { + size_t u = hvlen(p, z); + size_t const o = (u > 1) ? u * z : z; + free((char *)p - (o - z)); + } + return NULL; +} + +static void *hv(void const *p, size_t z) { + return p ? hv__realloc((void *)p, z, hvlen(p, z) + 1) : hv__malloc(z); +} +#define HV__TYPE(T,V) \ + T: *(T *)(V = (hv)((V), sizeof(*(V)))) +#define hv(V) _Generic(*(V), \ + HV__TYPE( char , (V)), \ + HV__TYPE( short , (V)), \ + HV__TYPE( int , (V)), \ + HV__TYPE( long , (V)), \ + HV__TYPE( long long, (V)), \ + HV__TYPE(unsigned char , (V)), \ + HV__TYPE(unsigned short , (V)), \ + HV__TYPE(unsigned int , (V)), \ + HV__TYPE(unsigned long , (V)), \ + HV__TYPE(unsigned long long, (V)), \ + HV__TYPE(float , (V)), \ + HV__TYPE(double , (V)), \ + HV__TYPE(long double , (V)) \ +) + +static void const *hvundo(void const *p, size_t z) { + return p ? hv__realloc((void *)p, z, hvlen(p, z) - 1) : p; +} +#define hvundo(V) (V = (hvundo)((V), sizeof(*(V)))) + +#define hvfree(V) (hvfree)((V), sizeof(*(V))) +#define hvlen(V) (hvlen)((V), sizeof(*(V))) + +int main(int argc, char **argv) { + char const *c = NULL; + unsigned const *u = NULL; + double const *d = NULL; + hv(c) = '1'; + hv(c) = '2'; + hv(c) = '3'; + hv(u) = 1; + hv(u) = 21; + hvundo(u); + hv(u) = 12; + hv(u) = 123; + hv(d) = 1.23; + hv(d) = 2.31; + hv(d) = 3.12; + printf("current values : '%c', %u, %g", *c, *u, *d); + putchar('\n'); + printf("char value history :"); + for(size_t n = hvlen(c), i = 0; i < n; i++) { + printf(" [%zu] '%c',", i, c[-i]); + } + putchar('\n'); + printf("unsigned value history:"); + for(size_t n = hvlen(u), i = 0; i < n; i++) { + printf(" [%zu] %4u,", i, u[-i]); + } + putchar('\n'); + printf("double value history :"); + for(size_t n = hvlen(d), i = 0; i < n; i++) { + printf(" [%zu] %4g,", i, d[-i]); + } + putchar('\n'); + hvfree(c); + hvfree(u); + hvfree(d); + return 0; +} diff --git a/Task/History-variables/Delphi/history-variables.delphi b/Task/History-variables/Delphi/history-variables.pas similarity index 100% rename from Task/History-variables/Delphi/history-variables.delphi rename to Task/History-variables/Delphi/history-variables.pas diff --git a/Task/History-variables/Elena/history-variables.elena b/Task/History-variables/Elena/history-variables.elena index 96f171d09b..f726d15563 100644 --- a/Task/History-variables/Elena/history-variables.elena +++ b/Task/History-variables/Elena/history-variables.elena @@ -25,7 +25,7 @@ class HistoryVariable undo() { - ifnot (previous.isEmpty()) + if:not (previous.isEmpty()) { value := previous.pop() } @@ -40,7 +40,7 @@ class HistoryVariable string toPrintable() => this value; } -public program() +public Program() { var o := new HistoryVariable(); o.Value := 5; @@ -49,7 +49,7 @@ public program() console.printLine(o); - o.forEach:printingLn; + o.forEach(printingLn); o.undo().undo().undo(); diff --git a/Task/History-variables/FreeBASIC/history-variables.basic b/Task/History-variables/FreeBASIC/history-variables.basic new file mode 100644 index 0000000000..2c61e3f4d2 --- /dev/null +++ b/Task/History-variables/FreeBASIC/history-variables.basic @@ -0,0 +1,60 @@ +REM integer history variable + +Type HistoryInt + As Integer Ptr values + As Integer cnt + As Integer capacity +End Type + +Function InitHistory() As HistoryInt Ptr + Dim As HistoryInt Ptr hist = Allocate(Sizeof(HistoryInt)) + hist->capacity = 10 + hist->values = Allocate(hist->capacity * Sizeof(Integer)) + hist->cnt = 0 + Return hist +End Function + +Sub SetInt(hist As HistoryInt Ptr, value As Integer) + If hist->cnt >= hist->capacity Then + hist->capacity *= 2 + hist->values = Reallocate(hist->values, hist->capacity * Sizeof(Integer)) + End If + + If hist->cnt = 0 Then + hist->values[hist->cnt] = 0 + hist->cnt += 1 + End If + + hist->values[hist->cnt] = value + hist->cnt += 1 +End Sub + +Sub ShowHistory(hist As HistoryInt Ptr) + For i As Integer = 0 To hist->cnt - 1 + Print hist->values[i] + Next +End Sub + +Function UndoInt(hist As HistoryInt Ptr) As Integer + If hist->cnt <= 1 Then Return hist->values[0] + hist->cnt -= 1 + Return hist->values[hist->cnt - 1] +End Function + +' Main program +Randomize Timer +Dim As HistoryInt Ptr x = InitHistory() + +For i As Integer = 0 To 3 + SetInt(x, Int(Rnd * 50) + 100) +Next + +Print "x history:" +ShowHistory(x) +Print + +For i As Integer = 0 To 3 + Print "undo, x ="; UndoInt(x) +Next + +Sleep diff --git a/Task/History-variables/Icon/history-variables.icon b/Task/History-variables/Icon/history-variables.icon new file mode 100644 index 0000000000..d19277f3a6 --- /dev/null +++ b/Task/History-variables/Icon/history-variables.icon @@ -0,0 +1,22 @@ +procedure main(A) + \A := ["cat","hat",7] + x := history() + every x.set(!A) + write("x current value is: ",x.val()) + write("Number of saved values is: ",x.size()) + writes("3 most recent x values from newest to oldest: ") + every writes(" ",x.gen()\3) + write() + while write("x value was: ",\x.get()) + write("Number of saved values is now: ",x.size()) +end + +class history(x) + method size(); return *x; end + method val(); return x[-1]; end + method set(v); put(x,v); end + method get(); return pull(x); end + method gen(); suspend x[*x to 1 by -1]; end +initially + x := [] +end diff --git a/Task/History-variables/Julia/history-variables.julia b/Task/History-variables/Julia/history-variables.jl similarity index 100% rename from Task/History-variables/Julia/history-variables.julia rename to Task/History-variables/Julia/history-variables.jl diff --git a/Task/History-variables/Kotlin/history-variables.kotlin b/Task/History-variables/Kotlin/history-variables.kts similarity index 100% rename from Task/History-variables/Kotlin/history-variables.kotlin rename to Task/History-variables/Kotlin/history-variables.kts diff --git a/Task/History-variables/OCaml/history-variables.ocaml b/Task/History-variables/OCaml/history-variables.ml similarity index 100% rename from Task/History-variables/OCaml/history-variables.ocaml rename to Task/History-variables/OCaml/history-variables.ml diff --git a/Task/History-variables/Phix/history-variables-1.phix b/Task/History-variables/Phix/history-variables-1.phix index 0d84745f09..8270fe1bbe 100644 --- a/Task/History-variables/Phix/history-variables-1.phix +++ b/Task/History-variables/Phix/history-variables-1.phix @@ -1,15 +1,13 @@ ---> - without js -- (desktop/Phix only) - sequence history = {} +without js -- (desktop/Phix only) +sequence history = {} - type hvt(object o) - history = append(history,o) - return true - end type +type hv(object o) + history = append(history,o) + return true +end type - hvt test = 1 - test = 2 - test = 3 - ?{"current",test} - ?{"history",history} - - -- history.e - sequence histories = {} +-- history.e +sequence histories = {} - global function new_history_id(object v) - histories = append(histories,{v}) - return length(histories) - end function +global function new_history_id(object v) + histories = append(histories,{v}) + return length(histories) +end function - global procedure set_hv(integer hv, object v) - histories[hv] = append(histories[hv],v) - end procedure +global procedure set_hv(integer hv, object v) + histories[hv] = append(histories[hv],v) +end procedure - global function get_hv(integer hv) - return histories[hv][$] - end function +global function get_hv(integer hv) + return histories[hv][$] +end function - global function get_hv_full_history(integer hv) - return histories[hv] - end function - - include history.e +with javascript_semantics +include history.e - constant test2 = new_history_id(1) - set_hv(test2, 2) - set_hv(test2, 3) - ?{"current",get_hv(test2)} - ?{"history",get_hv_full_history(test2)} - r s ) + + [ over size 1 - + over swap peek + dip [ over -1 peek ] + + swap dip join + over -2 split nip do + temp put + 1 + from + [ temp share + index = iff + end done + index join ] + temp release ] is extend ( r s --> r s ) + + [ temp put + [ over size + temp share < while + extend again ] + over + temp take 1 - peek ] is ffr ( r s n --> r s n ) + + [ temp put + [ dup size + temp share < while + extend again ] + dup + temp take 1 - peek ] is ffs ( r s n --> r s n ) + + initialise + say "R(1)..R(10): " + 10 times + [ i^ 1+ ffr echo sp ] + cr cr + 960 ffs drop + 960 split drop + dip [ 40 split drop ] + join sort + [] 1000 times + [ i^ 1+ join ] + != + say "All integers from 1 to 1000" + if say " not" + say " found once and only once." diff --git a/Task/Hofstadter-Figure-Figure-sequences/Rust/hofstadter-figure-figure-sequences.rust b/Task/Hofstadter-Figure-Figure-sequences/Rust/hofstadter-figure-figure-sequences.rs similarity index 100% rename from Task/Hofstadter-Figure-Figure-sequences/Rust/hofstadter-figure-figure-sequences.rust rename to Task/Hofstadter-Figure-Figure-sequences/Rust/hofstadter-figure-figure-sequences.rs diff --git a/Task/Hofstadter-Figure-Figure-sequences/SETL/hofstadter-figure-figure-sequences.setl b/Task/Hofstadter-Figure-Figure-sequences/SETL/hofstadter-figure-figure-sequences.setl new file mode 100644 index 0000000000..0f8d6e335b --- /dev/null +++ b/Task/Hofstadter-Figure-Figure-sequences/SETL/hofstadter-figure-figure-sequences.setl @@ -0,0 +1,24 @@ +program figure_figure; + init R := [1], S := [2]; + + print("R(1..10):", [ffr(n) : n in [1..10]]); + print("R(1..40) + S(1..960) = {1..1000}:", + {ffr(n) : n in {1..40}} + {ffs(n) : n in {1..960}} = {1..1000}); + + proc ffr(n); + loop while n > #R do + nextR := R(#R) + S(#R); + S +:= [S(#S)+1 .. nextR-1]; + R with:= nextR; + S with:= nextR + 1; + end loop; + return R(n); + end proc; + + proc ffs(n); + loop while n > #S do + ffr(#R + 1); + end loop; + return S(n); + end proc; +end program; diff --git a/Task/Hofstadter-Figure-Figure-sequences/VBScript/hofstadter-figure-figure-sequences.vb b/Task/Hofstadter-Figure-Figure-sequences/VBScript/hofstadter-figure-figure-sequences.vbs similarity index 100% rename from Task/Hofstadter-Figure-Figure-sequences/VBScript/hofstadter-figure-figure-sequences.vb rename to Task/Hofstadter-Figure-Figure-sequences/VBScript/hofstadter-figure-figure-sequences.vbs diff --git a/Task/Hofstadter-Q-sequence/AArch64-Assembly/hofstadter-q-sequence.aarch64 b/Task/Hofstadter-Q-sequence/AArch64-Assembly/hofstadter-q-sequence.aarch64 new file mode 100644 index 0000000000..8a3597f613 --- /dev/null +++ b/Task/Hofstadter-Q-sequence/AArch64-Assembly/hofstadter-q-sequence.aarch64 @@ -0,0 +1,181 @@ +/* ARM assembly AARCH64 Raspberry PI 3B */ +/* program hofstader64.s */ + +/*******************************************/ +/* Constantes */ +/*******************************************/ +/* for this file see task include a file in language AArch64 assembly*/ +.include "../includeConstantesARM64.inc" + +/*******************************************/ +/* macros */ +/*******************************************/ +//.include "../../ficmacros64.inc" // for developper debugging + +/*********************************/ +/* Initialized data */ +/*********************************/ +.data +szMessDebutPgm: .asciz "Program 64 bits start. \n" +szCarriageReturn: .asciz "\n" +szMessFinOK: .asciz "Program normal end. \n" +szMessErreur: .asciz "Error !!!\n" +szMessHofs: .asciz "Hofstader numbers :\n" +szSpace: .asciz " " + +.align 4 +/*********************************/ +/* UnInitialized data */ +/*********************************/ +.bss +sZoneConv: .skip 24 +.align 4 + +/*********************************/ +/* code section */ +/*********************************/ +.text +.global main +main: + ldr x0,qAdrszMessDebutPgm + bl affichageMess // start message + + ldr x0,qAdrszMessHofs + bl affichageMess + + mov x0,10 // maxi + mov x1,1 // display number + bl genererHofs + ldr x0,qAdrszCarriageReturn + bl affichageMess + + mov x0,1000 // maxi + mov x1,0 // display last number + bl genererHofs + ldr x0,qAdrszCarriageReturn + bl affichageMess + + ldr x0,qMax100000 // maxi + mov x1,2 // display counter + bl genererHofs + bl displayNumber // display return number + ldr x0,qAdrszCarriageReturn + bl affichageMess + + ldr x0,qAdrszMessFinOK + bl affichageMess + b 100f +99: + ldr x0,qAdrszMessErreur // error + bl affichageMess + mov x0, #1 // return code error + b 100f +100: + mov x8,EXIT + svc #0 // system call +qAdrszMessDebutPgm: .quad szMessDebutPgm +qAdrszMessFinOK: .quad szMessFinOK +qAdrszMessErreur: .quad szMessErreur +qAdrsZoneConv: .quad sZoneConv +qAdrszMessHofs: .quad szMessHofs +qMax100000: .quad 100000 +/***************************************************/ +/* Generation Fibonacci numbers */ +/***************************************************/ +/* x0 contains limit number */ +/* x1 display the last number */ +genererHofs: + stp x1,lr,[sp,-16]! + stp x2,x3,[sp,-16]! + stp x4,x5,[sp,-16]! + stp x6,x7,[sp,-16]! + stp x8,x9,[sp,-16]! + stp x10,x11,[sp,-16]! + mov x2,x0 + lsl x10,x0,3 + sub sp,sp,x10 // reserve area on stack + mov x7,sp + mov x4,#0 + mov x5,#0 +1: // init area loop + str x4,[x7,x5,lsl #3] + add x5,x5,#1 + cmp x5,x2 + blt 1b + mov x4,#1 + str x4,[x7] // store value 1 in first item + str x4,[x7,8] // store value 1 in second item + cmp x1,1 // display number ? + bne 2f + mov x0,1 // display L(1) + bl displayNumber + mov x0,1 // display L(2) + bl displayNumber +2: + mov x9,0 + mov x4,#2 +3: + sub x3,x4,#1 // L -1 + ldr x11,[x7,x3,lsl #3] // load ancien result + sub x6,x4,x11 + ldr x5,[x7,x6,lsl #3] + sub x3,x3,#1 // L - 2 + ldr x8,[x7,x3,lsl #3] // load ancien result + sub x6,x4,x8 + ldr x8,[x7,x6,lsl #3] + add x5,x5,x8 + str x5,[x7,x4,lsl #3] + cmp x5,x11 + cinc x9,x9,lt + + cmp x1,1 + bne 4f + mov x0,x5 + bl displayNumber +4: + + add x4,x4,#1 // increment counter + cmp x4,x2 // end compute ? + blt 3b + cmp x1,1 + bge 100f + mov x0,x5 + bl displayNumber +100: + mov x0,x9 + add sp,sp,x10 // free reserved area + ldp x10,x11,[sp],16 + ldp x8,x9,[sp],16 + ldp x6,x7,[sp],16 + ldp x4,x5,[sp],16 + ldp x2,x3,[sp],16 + ldp x1,lr,[sp],16 + ret +/***************************************************/ +/* display number */ +/***************************************************/ +/* x0 contains number */ +displayNumber: + stp x1,lr,[sp,-16]! + stp x2,x3,[sp,-16]! + ldr x1,qAdrsZoneConv + bl conversion10 + mov x2,#0 + add x1,x1,x0 + strb w2,[x1] + ldr x0,qAdrsZoneConv + bl affichageMess + ldr x0,qAdrszSpace + bl affichageMess +100: + ldp x2,x3,[sp],16 + ldp x1,lr,[sp],16 + ret +qAdrszCarriageReturn: .quad szCarriageReturn +qAdrszSpace: .quad szSpace + +/***************************************************/ +/* ROUTINES INCLUDE */ +/***************************************************/ +/* for this file see task include a file in language AArch64 assembly*/ +.include "../includeARM64.inc" diff --git a/Task/Hofstadter-Q-sequence/ALGOL-68/hofstadter-q-sequence.alg b/Task/Hofstadter-Q-sequence/ALGOL-68/hofstadter-q-sequence.alg index 071be33dcf..02d0922aa4 100644 --- a/Task/Hofstadter-Q-sequence/ALGOL-68/hofstadter-q-sequence.alg +++ b/Task/Hofstadter-Q-sequence/ALGOL-68/hofstadter-q-sequence.alg @@ -1,24 +1,16 @@ -#!/usr/local/bin/a68g --script # - -INT n = 100000; -main: -( - INT flip; - [n]INT q; +BEGIN + [100000]INT q; + INT flips := 0; q[1] := q[2] := 1; - - FOR i FROM 3 TO n DO - q[i] := q[i - q[i - 1]] + q[i - q[i - 2]] OD; + FOR i FROM 3 TO UPB q DO + q[i] := q[i - q[i - 1]] + q[i - q[i - 2]]; + IF q[i] < q[i - 1] THEN flips +:= 1 FI + OD; FOR i TO 10 DO - printf(($g(0)$, q[i], $b(l,x)$, i = 10)) OD; + print((whole(q[i],0), IF i = 10 THEN newline ELSE space FI)) OD; - printf(($g(0)l$, q[1000])); - - flip := 0; - FOR i TO n-1 DO - flip +:= ABS (q[i] > q[i + 1]) OD; - - printf(($"flips: "g(0)l$, flip)) -) + print((whole(q[1000],0), newline)); + print(("flips: ", whole(flips,0), newline)) +END diff --git a/Task/Hofstadter-Q-sequence/Ada/hofstadter-q-sequence.ada b/Task/Hofstadter-Q-sequence/Ada/hofstadter-q-sequence.adb similarity index 100% rename from Task/Hofstadter-Q-sequence/Ada/hofstadter-q-sequence.ada rename to Task/Hofstadter-Q-sequence/Ada/hofstadter-q-sequence.adb diff --git a/Task/Hofstadter-Q-sequence/Arturo/hofstadter-q-sequence.arturo b/Task/Hofstadter-Q-sequence/Arturo/hofstadter-q-sequence.arturo index 2089f585d3..ddd5248a8d 100644 --- a/Task/Hofstadter-Q-sequence/Arturo/hofstadter-q-sequence.arturo +++ b/Task/Hofstadter-Q-sequence/Arturo/hofstadter-q-sequence.arturo @@ -1,4 +1,4 @@ -q: new [1 1] +q: [1 1] n: 2 while [n<1001][ 'q ++ (get q n-q\[n-1]) + get q n-q\[n-2] diff --git a/Task/Hofstadter-Q-sequence/COBOL/hofstadter-q-sequence.cobol b/Task/Hofstadter-Q-sequence/COBOL/hofstadter-q-sequence.cob similarity index 100% rename from Task/Hofstadter-Q-sequence/COBOL/hofstadter-q-sequence.cobol rename to Task/Hofstadter-Q-sequence/COBOL/hofstadter-q-sequence.cob diff --git a/Task/Hofstadter-Q-sequence/Crystal/hofstadter-q-sequence.cr b/Task/Hofstadter-Q-sequence/Crystal/hofstadter-q-sequence.cr new file mode 100644 index 0000000000..d7110a4f3e --- /dev/null +++ b/Task/Hofstadter-Q-sequence/Crystal/hofstadter-q-sequence.cr @@ -0,0 +1,22 @@ +class Q + @@cache = [0, 1, 1] + + def self.[] (n) + if n >= @@cache.size + (@@cache.size ... n).each do |i| + Q[i] + end + @@cache << @@cache[n - @@cache[n-1]] + @@cache[n - @@cache[n-2]] + end + @@cache[n] + end +end + +print "First 10 terms: " +puts (1..10).map {|i| Q[i] }.join(" ") + +puts "1000th term: #{ Q[1000] }" + +c = (2..100_000).count {|i| Q[i] < Q[i-1] } + +puts "Less than preceding: #{c}" diff --git a/Task/Hofstadter-Q-sequence/Delphi/hofstadter-q-sequence.delphi b/Task/Hofstadter-Q-sequence/Delphi/hofstadter-q-sequence.pas similarity index 100% rename from Task/Hofstadter-Q-sequence/Delphi/hofstadter-q-sequence.delphi rename to Task/Hofstadter-Q-sequence/Delphi/hofstadter-q-sequence.pas diff --git a/Task/Hofstadter-Q-sequence/EasyLang/hofstadter-q-sequence.easy b/Task/Hofstadter-Q-sequence/EasyLang/hofstadter-q-sequence.easy new file mode 100644 index 0000000000..20beb55cac --- /dev/null +++ b/Task/Hofstadter-Q-sequence/EasyLang/hofstadter-q-sequence.easy @@ -0,0 +1,17 @@ +proc hofstadter limit &q[] . + q[] = [ 1 1 ] + for n = 3 to limit + q[] &= q[n - q[n - 1]] + q[n - q[n - 2]] + . +. +proc count &q[] &cnt . + for i = 2 to len q[] + if q[i] < q[i - 1] : cnt += 1 + . +. +hofstadter 100000 hofq[] +for i = 1 to 10 : write hofq[i] & " " +print "" +print hofq[1000] +count hofq[] cnt +print cnt diff --git a/Task/Hofstadter-Q-sequence/Elixir/hofstadter-q-sequence.elixir b/Task/Hofstadter-Q-sequence/Elixir/hofstadter-q-sequence.ex similarity index 100% rename from Task/Hofstadter-Q-sequence/Elixir/hofstadter-q-sequence.elixir rename to Task/Hofstadter-Q-sequence/Elixir/hofstadter-q-sequence.ex diff --git a/Task/Hofstadter-Q-sequence/FutureBasic/hofstadter-q-sequence.basic b/Task/Hofstadter-Q-sequence/FutureBasic/hofstadter-q-sequence.basic new file mode 100644 index 0000000000..c9f3691860 --- /dev/null +++ b/Task/Hofstadter-Q-sequence/FutureBasic/hofstadter-q-sequence.basic @@ -0,0 +1,19 @@ +_limit = 100000 + +Long Q(_limit), i, count = 0 + +Q(1) = 1 +Q(2) = 1 +For i = 3 To _limit + Q(i) = Q(i-Q(i-1)) + Q(i-Q(i-2)) + If Q(i) < Q(i-1) Then count += 1 +Next i + +Print "First 10 elements:"; +For i = 1 To 10 + Print str$(Q(i)) + " "; +Next i +Print +Print "Q(1000) is "; Q(1000) +Print "There were" + str$(count) + " inversions" +handleevents diff --git a/Task/Hofstadter-Q-sequence/Gambas/hofstadter-q-sequence.gambas b/Task/Hofstadter-Q-sequence/Gambas/hofstadter-q-sequence.gambas new file mode 100644 index 0000000000..e3e51a24a3 --- /dev/null +++ b/Task/Hofstadter-Q-sequence/Gambas/hofstadter-q-sequence.gambas @@ -0,0 +1,23 @@ +Public Const limite As Integer = 100000 +Public Q[limite + 1] As Long + +Public Sub Main() + + Dim i As Long, cont As Long = 0 + + Q[1] = 1 + Q[2] = 1 + For i = 3 To limite + Q[i] = Q[i - Q[i - 1]] + Q[i - Q[i - 2]] + If Q[i] < Q[i - 1] Then cont += 1 + Next + + Print "Primeros 10 terminos: "; + For i = 1 To 10 + Print Q[i] & " "; + Next + + Print "\nTermino numero 1000: "; Q[1000] + Print "Terminos menores que los anteriores: " & cont + +End diff --git a/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-2.hs b/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-2.hs index 37c7f28e2d..3a361b185b 100644 --- a/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-2.hs +++ b/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-2.hs @@ -1,21 +1,13 @@ -import Data.Array +douglasHofstadter :: Int -> [Int] +douglasHofstadter m = reverse (dSeqEffect [1,1] 2 m) + where + dSeqEffect xs n m | n > m = xs + | otherwise = dSeqEffect (((xs !! (xs !! (n - 1))) + (xs !! (n - (xs !! (n - 1)))) ) : xs) (n + 1) m -qSequence n = arr - where - arr = listArray (1,n) $ 1:1: map g [3..n] - g i = arr!(i - arr!(i-1)) + - arr!(i - arr!(i-2)) +-- main +getIntArg :: IO Int +getIntArg = fmap (read . head) getArgs -gradualth m k arr -- gradually precalculate m-th item - | m <= v = pre `seq` arr!m -- in steps of k - where -- to prevent STACK OVERFLOW - pre = foldl1 (\a b-> a `seq` arr!b) [u,u+k..m] - (u,v) = bounds arr - -qSeqTest m n = let arr = qSequence $ max m n in - ( take 10 . elems $ arr -- 10 first items - , gradualth m 10000 $ arr -- m-th item - , length . filter (> 0) -- reversals in n items - . _S (zipWith (-)) tail . take n . elems $ arr ) - -_S f g x = f x (g x) +main = do + args <- getIntArg + print (douglasHofstadter args) diff --git a/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-3.hs b/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-3.hs index 162d5cee47..37c7f28e2d 100644 --- a/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-3.hs +++ b/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-3.hs @@ -1,7 +1,21 @@ -Prelude Main> qSeqTest 1000 100000 -- reversals in 100,000 -([1,1,2,3,3,4,5,5,6,6],502,49798) -(0.09 secs, 18879708 bytes) +import Data.Array -Prelude Main> qSeqTest 1000000 100000 -- 1,000,000-th item -([1,1,2,3,3,4,5,5,6,6],512066,49798) -(2.80 secs, 87559640 bytes) +qSequence n = arr + where + arr = listArray (1,n) $ 1:1: map g [3..n] + g i = arr!(i - arr!(i-1)) + + arr!(i - arr!(i-2)) + +gradualth m k arr -- gradually precalculate m-th item + | m <= v = pre `seq` arr!m -- in steps of k + where -- to prevent STACK OVERFLOW + pre = foldl1 (\a b-> a `seq` arr!b) [u,u+k..m] + (u,v) = bounds arr + +qSeqTest m n = let arr = qSequence $ max m n in + ( take 10 . elems $ arr -- 10 first items + , gradualth m 10000 $ arr -- m-th item + , length . filter (> 0) -- reversals in n items + . _S (zipWith (-)) tail . take n . elems $ arr ) + +_S f g x = f x (g x) diff --git a/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-4.hs b/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-4.hs index 40d00cdae6..162d5cee47 100644 --- a/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-4.hs +++ b/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-4.hs @@ -1,16 +1,7 @@ -q = qq (listArray (1,2) [1,1]) 1 where - qq ar n = (arr!n) : qq arr (n+1) where - l = snd (bounds ar) - step n =arr!(n - (fromIntegral (arr!(n - 1)))) + - arr!(n - (fromIntegral (arr!(n - 2)))) - arr :: Array Int Integer - arr | n <= l = ar - | otherwise = listArray (1, l*2)$ - ([ar!i | i <- [1..l]] ++ - [step i | i <- [l+1..l*2]]) +Prelude Main> qSeqTest 1000 100000 -- reversals in 100,000 +([1,1,2,3,3,4,5,5,6,6],502,49798) +(0.09 secs, 18879708 bytes) -main = do - putStr("first 10: "); print (take 10 q) - putStr("1000-th: "); print (q !! 999) - putStr("flips: ") - print $ length $ filter id $ take 100000 (zipWith (>) q (tail q)) +Prelude Main> qSeqTest 1000000 100000 -- 1,000,000-th item +([1,1,2,3,3,4,5,5,6,6],512066,49798) +(2.80 secs, 87559640 bytes) diff --git a/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-5.hs b/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-5.hs index d7722cbb4d..40d00cdae6 100644 --- a/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-5.hs +++ b/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-5.hs @@ -1,21 +1,16 @@ -import Data.Array -import Data.Int (Int64) +q = qq (listArray (1,2) [1,1]) 1 where + qq ar n = (arr!n) : qq arr (n+1) where + l = snd (bounds ar) + step n =arr!(n - (fromIntegral (arr!(n - 1)))) + + arr!(n - (fromIntegral (arr!(n - 2)))) + arr :: Array Int Integer + arr | n <= l = ar + | otherwise = listArray (1, l*2)$ + ([ar!i | i <- [1..l]] ++ + [step i | i <- [l+1..l*2]]) -q = qq [listArray (1,2) [1,1]] 1 where - qq a n = seek aa n : qq aa (1 + n) where - aa | n <= l = a - | otherwise = listArray (l+1,l*2) (take l $ drop 2 lst):a - where - l = snd (bounds $ head a) - lst = seek a (l-1):seek a l:(ext lst (l+1)) - ext (q1:q2:qs) i = (g (i-q2) + g (i-q1)):ext (q2:qs) (1+i) - g = seek aa - seek (ar:ars) n - | n >= fst (bounds ar) = ar ! n - | otherwise = seek ars n - --- Only a perf test. Task can be done exactly the same as above -main = print $ sum qqq - where - qqq :: [Int64] - qqq = map fromIntegral $ take 3000000 q +main = do + putStr("first 10: "); print (take 10 q) + putStr("1000-th: "); print (q !! 999) + putStr("flips: ") + print $ length $ filter id $ take 100000 (zipWith (>) q (tail q)) diff --git a/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-6.hs b/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-6.hs new file mode 100644 index 0000000000..d7722cbb4d --- /dev/null +++ b/Task/Hofstadter-Q-sequence/Haskell/hofstadter-q-sequence-6.hs @@ -0,0 +1,21 @@ +import Data.Array +import Data.Int (Int64) + +q = qq [listArray (1,2) [1,1]] 1 where + qq a n = seek aa n : qq aa (1 + n) where + aa | n <= l = a + | otherwise = listArray (l+1,l*2) (take l $ drop 2 lst):a + where + l = snd (bounds $ head a) + lst = seek a (l-1):seek a l:(ext lst (l+1)) + ext (q1:q2:qs) i = (g (i-q2) + g (i-q1)):ext (q2:qs) (1+i) + g = seek aa + seek (ar:ars) n + | n >= fst (bounds ar) = ar ! n + | otherwise = seek ars n + +-- Only a perf test. Task can be done exactly the same as above +main = print $ sum qqq + where + qqq :: [Int64] + qqq = map fromIntegral $ take 3000000 q diff --git a/Task/Hofstadter-Q-sequence/Julia/hofstadter-q-sequence-1.julia b/Task/Hofstadter-Q-sequence/Julia/hofstadter-q-sequence-1.jl similarity index 100% rename from Task/Hofstadter-Q-sequence/Julia/hofstadter-q-sequence-1.julia rename to Task/Hofstadter-Q-sequence/Julia/hofstadter-q-sequence-1.jl diff --git a/Task/Hofstadter-Q-sequence/Julia/hofstadter-q-sequence-2.julia b/Task/Hofstadter-Q-sequence/Julia/hofstadter-q-sequence-2.jl similarity index 100% rename from Task/Hofstadter-Q-sequence/Julia/hofstadter-q-sequence-2.julia rename to Task/Hofstadter-Q-sequence/Julia/hofstadter-q-sequence-2.jl diff --git a/Task/Hofstadter-Q-sequence/Kotlin/hofstadter-q-sequence.kotlin b/Task/Hofstadter-Q-sequence/Kotlin/hofstadter-q-sequence-1.kts similarity index 100% rename from Task/Hofstadter-Q-sequence/Kotlin/hofstadter-q-sequence.kotlin rename to Task/Hofstadter-Q-sequence/Kotlin/hofstadter-q-sequence-1.kts diff --git a/Task/Hofstadter-Q-sequence/Kotlin/hofstadter-q-sequence-2.kts b/Task/Hofstadter-Q-sequence/Kotlin/hofstadter-q-sequence-2.kts new file mode 100644 index 0000000000..ac07d6cc8e --- /dev/null +++ b/Task/Hofstadter-Q-sequence/Kotlin/hofstadter-q-sequence-2.kts @@ -0,0 +1,24 @@ +fun Q(n: Int): List { + val mem = mutableMapOf().also { + it[1] = 1 + it[2] = 1 + } + q(n, mem) + return mem.values.toList() +} + +private fun q(n: Int, mem: MutableMap): Int { + if (!mem.containsKey(n)) { + mem[n] = + q(n - q(n - 1, mem), mem) + q(n - q(n - 2, mem), mem) + } + return mem[n]!! +} + +fun main() { + val n = 1000 + Q(n).also { qList -> + println("Q[1..10] = ${qList.take(10)}") + println("Q($n) = ${qList[1000 - 1]}") // 502 + } +} diff --git a/Task/Hofstadter-Q-sequence/OCaml/hofstadter-q-sequence.ocaml b/Task/Hofstadter-Q-sequence/OCaml/hofstadter-q-sequence.ml similarity index 100% rename from Task/Hofstadter-Q-sequence/OCaml/hofstadter-q-sequence.ocaml rename to Task/Hofstadter-Q-sequence/OCaml/hofstadter-q-sequence.ml diff --git a/Task/Hofstadter-Q-sequence/OxygenBasic/hofstadter-q-sequence.basic b/Task/Hofstadter-Q-sequence/OxygenBasic/hofstadter-q-sequence.basic new file mode 100644 index 0000000000..6015f7c4ab --- /dev/null +++ b/Task/Hofstadter-Q-sequence/OxygenBasic/hofstadter-q-sequence.basic @@ -0,0 +1,26 @@ +uses console + +int limite = 100000 + +dim long Q[100000] +long i, cont = 0 + +Q[1] = 1 +Q[2] = 1 +For i = 3 To limite + Q[i] = Q[i-Q[i-1]] + Q[i-Q[i-2]] + If Q(i) < Q(i-1) Then cont += 1 +Next i + +print "Primeros 10 terminos: " +For i = 1 To 10 + print Q(i) " "; +Next i +print cr + +printl "Termino numero 1000: " Q(1000) + +printl "Terminos menores que los anteriores: " cont + +printl cr "Enter ..." +waitkey diff --git a/Task/Hofstadter-Q-sequence/PascalABC.NET/hofstadter-q-sequence.pas b/Task/Hofstadter-Q-sequence/PascalABC.NET/hofstadter-q-sequence.pas new file mode 100644 index 0000000000..6c1be48d54 --- /dev/null +++ b/Task/Hofstadter-Q-sequence/PascalABC.NET/hofstadter-q-sequence.pas @@ -0,0 +1,16 @@ +## +var q := |1, 1|.ToList; +for var n := 2 to 100_000 do + q.add(q[n - q[n - 1]] + q[n - q[n - 2]]); + +q.take(10).println; +assert(q.Take(10).SequenceEqual(|1, 1, 2, 3, 3, 4, 5, 5, 6, 6|)); + +q[999].println; +assert(q[999] = 502); + +var lessCount := 0; +for var n := 1 to 100_000 do + if q[n] < q[n - 1] then + lessCount += 1; +lessCount.Println; diff --git a/Task/Hofstadter-Q-sequence/Pluto/hofstadter-q-sequence.pluto b/Task/Hofstadter-Q-sequence/Pluto/hofstadter-q-sequence.pluto new file mode 100644 index 0000000000..68a73a3bf0 --- /dev/null +++ b/Task/Hofstadter-Q-sequence/Pluto/hofstadter-q-sequence.pluto @@ -0,0 +1,18 @@ +require "table2" +local fmt = require "fmt" + +local N = 100_000 +local q = table.rep(N, 0) +q[0] = 0 +q[1] = 1 +q[2] = 1 +for n = 3, N do q[n] = q[n - q[n-1]] + q[n - q[n-2]] end + +print("The first ten terms of the Hofstadter Q sequence are:") +fmt.lprint(q:slice(1, 10)) +print($"\nThe thousandth term is {q[1000]}.") +local flips = 0 +for n = 2, N do + if (q[n] < q[n-1]) then flips += 1 end +end +print($"\nThere are {fmt.int(flips)} flips in the first {fmt.int(N)} terms.") diff --git a/Task/Hofstadter-Q-sequence/QB64/hofstadter-q-sequence.qb64 b/Task/Hofstadter-Q-sequence/QB64/hofstadter-q-sequence.qb64 new file mode 100644 index 0000000000..0ff10d7b9a --- /dev/null +++ b/Task/Hofstadter-Q-sequence/QB64/hofstadter-q-sequence.qb64 @@ -0,0 +1,20 @@ +Const limite = 100000 + +Dim As Long Q(limite) +Q(1) = 1 +Q(2) = 1 + +cont = 0 +For i = 3 To limite + Q(i) = Q(i - Q(i - 1)) + Q(i - Q(i - 2)) + If Q(i) < Q(i - 1) Then cont = cont + 1 +Next i + +Print "First 10 terms:"; +For i = 1 To 10 + Print Q(i); +Next i + +Print +Print "Term 1000: "; Q(1000) +Print "Terms less than preceding in first 100k:"; cont diff --git a/Task/Hofstadter-Q-sequence/Rust/hofstadter-q-sequence.rust b/Task/Hofstadter-Q-sequence/Rust/hofstadter-q-sequence.rs similarity index 100% rename from Task/Hofstadter-Q-sequence/Rust/hofstadter-q-sequence.rust rename to Task/Hofstadter-Q-sequence/Rust/hofstadter-q-sequence.rs diff --git a/Task/Hofstadter-Q-sequence/SETL/hofstadter-q-sequence.setl b/Task/Hofstadter-Q-sequence/SETL/hofstadter-q-sequence.setl new file mode 100644 index 0000000000..d01b79474d --- /dev/null +++ b/Task/Hofstadter-Q-sequence/SETL/hofstadter-q-sequence.setl @@ -0,0 +1,10 @@ +program hofstadter_q; + q := [1,1]; + loop for n in [3..100000] do + q(n) := q(n-q(n-1)) + q(n-q(n-2)); + end loop; + + print("First 10 terms: " + q(1..10)); + print("1000th term: " + q(1000)); + print("q(x) < q(x-1): " + #[x : x in [2..#q] | q(x) < q(x-1)]); +end program; diff --git a/Task/Hofstadter-Q-sequence/Scheme/hofstadter-q-sequence.ss b/Task/Hofstadter-Q-sequence/Scheme/hofstadter-q-sequence.scm similarity index 100% rename from Task/Hofstadter-Q-sequence/Scheme/hofstadter-q-sequence.ss rename to Task/Hofstadter-Q-sequence/Scheme/hofstadter-q-sequence.scm diff --git a/Task/Hofstadter-Q-sequence/Tailspin/hofstadter-q-sequence.tailspin b/Task/Hofstadter-Q-sequence/Tailspin/hofstadter-q-sequence-1.tailspin similarity index 100% rename from Task/Hofstadter-Q-sequence/Tailspin/hofstadter-q-sequence.tailspin rename to Task/Hofstadter-Q-sequence/Tailspin/hofstadter-q-sequence-1.tailspin diff --git a/Task/Hofstadter-Q-sequence/Tailspin/hofstadter-q-sequence-2.tailspin b/Task/Hofstadter-Q-sequence/Tailspin/hofstadter-q-sequence-2.tailspin new file mode 100644 index 0000000000..433a8f3fc4 --- /dev/null +++ b/Task/Hofstadter-Q-sequence/Tailspin/hofstadter-q-sequence-2.tailspin @@ -0,0 +1,28 @@ +q templates + outputFrom is $(1); + until is $(2); + @ set [1,1]; + 1..$until -> # ! + when <|$@::length~..> do + ..|@ set $@($ - $@($ - 1)) + $@($ - $@($ - 2)); + $ -> # ! + when <|$outputFrom..> do + $@($) ! +end q + +[1,10] -> q -> '$; ' ! +' +' ! + +[1000,1000] -> q -> '$; +' ! + +countDownSteps templates + @ set 0; + qs is $; + 2..$qs::length -> !# + $@ ! + when <|?($qs($) matches <|..~$qs($-1)>)> do @ set $@ + 1; +end countDownSteps + +[[1, 100000] -> q] -> countDownSteps -> 'Less than previous $; times' ! diff --git a/Task/Hofstadter-Q-sequence/VBScript/hofstadter-q-sequence.vb b/Task/Hofstadter-Q-sequence/VBScript/hofstadter-q-sequence.vbs similarity index 100% rename from Task/Hofstadter-Q-sequence/VBScript/hofstadter-q-sequence.vb rename to Task/Hofstadter-Q-sequence/VBScript/hofstadter-q-sequence.vbs diff --git a/Task/Holidays-related-to-Easter/Ada/holidays-related-to-easter.ada b/Task/Holidays-related-to-Easter/Ada/holidays-related-to-easter.adb similarity index 100% rename from Task/Holidays-related-to-Easter/Ada/holidays-related-to-easter.ada rename to Task/Holidays-related-to-Easter/Ada/holidays-related-to-easter.adb diff --git a/Task/Holidays-related-to-Easter/COBOL/holidays-related-to-easter.cobol b/Task/Holidays-related-to-Easter/COBOL/holidays-related-to-easter.cob similarity index 100% rename from Task/Holidays-related-to-Easter/COBOL/holidays-related-to-easter.cobol rename to Task/Holidays-related-to-Easter/COBOL/holidays-related-to-easter.cob diff --git a/Task/Holidays-related-to-Easter/Delphi/holidays-related-to-easter.delphi b/Task/Holidays-related-to-Easter/Delphi/holidays-related-to-easter.pas similarity index 100% rename from Task/Holidays-related-to-Easter/Delphi/holidays-related-to-easter.delphi rename to Task/Holidays-related-to-Easter/Delphi/holidays-related-to-easter.pas diff --git a/Task/Holidays-related-to-Easter/Elixir/holidays-related-to-easter.elixir b/Task/Holidays-related-to-Easter/Elixir/holidays-related-to-easter.ex similarity index 100% rename from Task/Holidays-related-to-Easter/Elixir/holidays-related-to-easter.elixir rename to Task/Holidays-related-to-Easter/Elixir/holidays-related-to-easter.ex diff --git a/Task/Holidays-related-to-Easter/Fortran/holidays-related-to-easter.f b/Task/Holidays-related-to-Easter/Fortran/holidays-related-to-easter-1.f similarity index 100% rename from Task/Holidays-related-to-Easter/Fortran/holidays-related-to-easter.f rename to Task/Holidays-related-to-Easter/Fortran/holidays-related-to-easter-1.f diff --git a/Task/Holidays-related-to-Easter/Fortran/holidays-related-to-easter-2.f b/Task/Holidays-related-to-Easter/Fortran/holidays-related-to-easter-2.f new file mode 100644 index 0000000000..409769bad1 --- /dev/null +++ b/Task/Holidays-related-to-Easter/Fortran/holidays-related-to-easter-2.f @@ -0,0 +1,183 @@ +program christian_feasts + implicit none + integer :: year, i + character(len=6), parameter :: NONE = ' --- ' + + write(*,'(A)') 'CHRISTIAN FEAST DAYS' + write(*,'(A)') repeat('=', 72) + write(*,'(A)') 'Pre-Gregorian reform (400-1500 CE): Julian computus only' + write(*,'(A)') 'Dates: DDMon(Julian) / DDMon(Gregorian proleptic)' + write(*,'(A)') '(*) Trinity ~10th c. (**) Corpus Christi from 1264 CE' + write(*,'(A)') repeat('-', 72) + write(*,'(A4,2X,A13,2X,A13,2X,A13,2X,A13,2X,A13)') & + 'Year', 'Easter ', 'Ascension ', 'Pentecost ', & + 'Trinity* ', 'CorpusChr** ' + write(*,'(A)') repeat('-', 72) + do i = 4, 15 + call pre_row(i * 100) + end do + + write(*,*) + write(*,'(A)') repeat('=', 72) + write(*,'(A)') 'Post-Gregorian reform (1600-2100 CE + 2010-2020): Gregorian calendar' + write(*,'(A)') 'Orthodox = Julian computus | Catholic = Gregorian computus' + write(*,'(A)') 'Col 6: All Saints Sunday (+56) for Orthodox; Trinity Sunday (+56) for Catholic' + write(*,'(A)') 'Col 7: Corpus Christi (+60) Catholic only' + write(*,'(A)') repeat('-', 72) + write(*,'(A4,2X,A8,2X,A6,2X,A6,2X,A6,2X,A6,2X,A6)') & + 'Year', 'Church ', 'Easter', 'Ascensn', 'Pentecos', 'AS/Trin ', 'CorpChr ' + write(*,'(A)') repeat('-', 72) + do i = 16, 21 + call post_rows(i * 100) + end do + write(*,'(A)') repeat('-', 72) + write(*,'(A)') ' -- 2010 to 2020 --' + write(*,'(A)') repeat('-', 72) + do year = 2010, 2026 + call post_rows(year) + end do + +contains + + ! Julian computus: returns Easter month/day in Julian calendar + subroutine julian_easter(yr, mo, dy) + integer, intent(in) :: yr + integer, intent(out) :: mo, dy + integer :: a, b, c, d, e + a = mod(yr, 4) + b = mod(yr, 7) + c = mod(yr, 19) + d = mod(19*c + 15, 30) + e = mod(2*a + 4*b - d + 34, 7) + mo = (d + e + 114) / 31 + dy = mod(d + e + 114, 31) + 1 + end subroutine julian_easter + + ! Gregorian computus (Anonymous Gregorian algorithm): returns Easter in Gregorian calendar + subroutine gregorian_easter(yr, mo, dy) + integer, intent(in) :: yr + integer, intent(out) :: mo, dy + integer :: a, b, c, d, e, f, g, h, ii, k, l, m + a = mod(yr, 19) + b = yr / 100 + c = mod(yr, 100) + d = b / 4 + e = mod(b, 4) + f = (b + 8) / 25 + g = (b - f + 1) / 3 + h = mod(19*a + b - d - g + 15, 30) + ii = c / 4 + k = mod(c, 4) + l = mod(32 + 2*e + 2*ii - h - k, 7) + m = (a + 11*h + 22*l) / 451 + mo = (h + l - 7*m + 114) / 31 + dy = mod(h + l - 7*m + 114, 31) + 1 + end subroutine gregorian_easter + + ! Julian calendar date -> Julian Day Number + pure function jul2jdn(y, m, d) result(jdn) + integer, intent(in) :: y, m, d + integer :: jdn, a, yy, mm + a = (14 - m) / 12 + yy = y + 4800 - a + mm = m + 12*a - 3 + jdn = d + (153*mm + 2)/5 + 365*yy + yy/4 - 32083 + end function jul2jdn + + ! Gregorian calendar date -> Julian Day Number + pure function greg2jdn(y, m, d) result(jdn) + integer, intent(in) :: y, m, d + integer :: jdn, a, yy, mm + a = (14 - m) / 12 + yy = y + 4800 - a + mm = m + 12*a - 3 + jdn = d + (153*mm + 2)/5 + 365*yy + yy/4 - yy/100 + yy/400 - 32045 + end function greg2jdn + + ! Julian Day Number -> Gregorian calendar date + subroutine jdn2greg(jdn, y, m, d) + integer, intent(in) :: jdn + integer, intent(out) :: y, m, d + integer :: a, b, c, dd, e, mm + a = jdn + 32044 + b = (4*a + 3) / 146097 + c = a - (146097*b) / 4 + dd = (4*c + 3) / 1461 + e = c - (1461*dd) / 4 + mm = (5*e + 2) / 153 + d = e - (153*mm + 2)/5 + 1 + m = mm + 3 - 12*(mm/10) + y = 100*b + dd - 4800 + mm/10 + end subroutine jdn2greg + + ! Julian Day Number -> Julian calendar date + subroutine jdn2jul(jdn, y, m, d) + integer, intent(in) :: jdn + integer, intent(out) :: y, m, d + integer :: c, dd, e, mm + c = jdn + 32082 + dd = (4*c + 3) / 1461 + e = c - (1461*dd) / 4 + mm = (5*e + 2) / 153 + d = e - (153*mm + 2)/5 + 1 + m = mm + 3 - 12*(mm/10) + y = dd - 4800 + mm/10 + end subroutine jdn2jul + + function mname(m) result(s) + integer, intent(in) :: m + character(len=3) :: s + character(len=3), parameter :: names(12) = & + ['Jan','Feb','Mar','Apr','May','Jun', & + 'Jul','Aug','Sep','Oct','Nov','Dec'] + s = names(m) + end function mname + + ! Format JDN as "DDMon/DDMon" (Julian cal. / Gregorian proleptic), 13 chars + function fmtjg(jdn) result(s) + integer, intent(in) :: jdn + character(len=13) :: s + integer :: jy, jm, jd, gy, gm, gd + call jdn2jul(jdn, jy, jm, jd) + call jdn2greg(jdn, gy, gm, gd) + write(s,'(I2.2,A3,A1,I2.2,A3)') jd, mname(jm), '/', gd, mname(gm) + end function fmtjg + + ! Format JDN as "DD Mon" (Gregorian), 6 chars + function fmtg(jdn) result(s) + integer, intent(in) :: jdn + character(len=6) :: s + integer :: gy, gm, gd + call jdn2greg(jdn, gy, gm, gd) + write(s,'(I2.2,1X,A3)') gd, mname(gm) + end function fmtg + + subroutine pre_row(year) + integer, intent(in) :: year + integer :: em, ed, jdn + call julian_easter(year, em, ed) + jdn = jul2jdn(year, em, ed) + write(*,'(I4,2X,A13,2X,A13,2X,A13,2X,A13,2X,A13)') year, & + fmtjg(jdn), fmtjg(jdn+39), fmtjg(jdn+49), & + fmtjg(jdn+56), fmtjg(jdn+60) + end subroutine pre_row + + subroutine post_rows(year) + integer, intent(in) :: year + integer :: em, ed, jdn_o, jdn_c + ! Orthodox: Julian computus -> Julian calendar -> convert to Gregorian for display + call julian_easter(year, em, ed) + jdn_o = jul2jdn(year, em, ed) + write(*,'(I4,2X,A8,2X,A6,2X,A6,2X,A6,2X,A6,2X,A6)') year, & + 'Orthodox', fmtg(jdn_o), fmtg(jdn_o+39), fmtg(jdn_o+49), & + fmtg(jdn_o+56), NONE + ! Catholic: Gregorian computus, already in Gregorian calendar + call gregorian_easter(year, em, ed) + jdn_c = greg2jdn(year, em, ed) + write(*,'(4X,2X,A8,2X,A6,2X,A6,2X,A6,2X,A6,2X,A6)') & + 'Catholic', fmtg(jdn_c), fmtg(jdn_c+39), fmtg(jdn_c+49), & + fmtg(jdn_c+56), fmtg(jdn_c+60) + write(*,*) + end subroutine post_rows + +end program christian_feasts diff --git a/Task/Holidays-related-to-Easter/JavaScript/holidays-related-to-easter-1.js b/Task/Holidays-related-to-Easter/JavaScript/holidays-related-to-easter-1.js index eb688361e3..9b43ccc463 100644 --- a/Task/Holidays-related-to-Easter/JavaScript/holidays-related-to-easter-1.js +++ b/Task/Holidays-related-to-Easter/JavaScript/holidays-related-to-easter-1.js @@ -1,8 +1,6 @@ -const Пасха = год => { - let дата = (год % 19 * 19 + 15) % 30; - дата += (год % 4 * 2 + год % 7 * 4 + 6 * дата + 6) % 7; - if (год >= 1918) дата += (год / 100 | 0) - (год / 400 | 0) - 2; - return new Date(год, 2, 22 + дата); +const Пасха = г => { + let д = (д => д + (г % 4 * 2 + г * 4 + 6 * д + 6) % 7)((г % 19 * 19 + 15) % 30); + return new Date(г, 2, 22 + д + (г >= 1918 ? (г / 100 | 0) - (г / 400 | 0) - 2 : 0)); }; for (let год = 400; год <= 2100; год += год < 2000 ? 100 : год >= 2020 ? 80 : год < 2010 ? 10 : 1) { diff --git a/Task/Holidays-related-to-Easter/Julia/holidays-related-to-easter.jl b/Task/Holidays-related-to-Easter/Julia/holidays-related-to-easter.jl new file mode 100644 index 0000000000..28209ba962 --- /dev/null +++ b/Task/Holidays-related-to-Easter/Julia/holidays-related-to-easter.jl @@ -0,0 +1,42 @@ +using Dates +using Printf + +function easter(year::Int)::Date + a = rem(year, 19) + b, c = divrem(year, 100) + d = rem(19a + b - div(b, 4) - div(b - div(b + 8, 25) + 1, 3) + 15, 30) + e = rem(32 + 2 * rem(b, 4) + 2 * div(c, 4) - d - rem(c, 4), 7) + f = d + e - 7 * div(a + 11d + 22e, 451) + 114 + month, day = divrem(f, 31) + day += 1 + return Date(year, month, day) +end + +function holiday_values(year::Int)::Dict{String,Date} + offsets = Dict{String,Day}("Easter" => Day(0), "Ascension" => Day(39), + "Pentecost" => Day(49), "Trinity" => Day(56), "Corpus" => Day(60)) + easterdate = easter(year) + rst = Dict{String,Date}(holiday => easterdate + days for (holiday, days) in offsets) + return rst +end + +function holiday2str(year::Int)::String + function holiday2str(holiday::String, date::Date)::String + dayname, daynumb, month = dayabbr(date), day(date), monthabbr(date) + return @sprintf "%s: %s %2i %s" holiday dayname daynumb month + end + cal = holiday_values(year) + rst = join(collect(holiday2str(hday, cal[hday]) for hday in + ("Easter", "Ascension", "Pentecost", "Trinity", "Corpus")), ", ") + return "$year -> " * rst +end + +println("\nChristian holidays, related to Easter, for each centennial from 400 to 2100 CE:") +for yr in 400:100:2200 + println(holiday2str(yr)) +end + +println("\nChristian holidays, related to Easter, for years from 2010 to 2020 CE:") +for yr in 2010:2020 + println(holiday2str(yr)) +end diff --git a/Task/Holidays-related-to-Easter/Julia/holidays-related-to-easter.julia b/Task/Holidays-related-to-Easter/Julia/holidays-related-to-easter.julia deleted file mode 100644 index f194811192..0000000000 --- a/Task/Holidays-related-to-Easter/Julia/holidays-related-to-easter.julia +++ /dev/null @@ -1,43 +0,0 @@ -# v0.6 - -using Dates - -function easter(year::Int)::Date - a = rem(year, 19) - b, c = divrem(year, 100) - d = rem(19a + b - div(b, 4) - div(b - div(b + 8, 25) + 1, 3) + 15, 30) - e = rem(32 + 2 * rem(b, 4) + 2 * div(c, 4) - d - rem(c, 4), 7) - f = d + e - 7 * div(a + 11d + 22e, 451) + 114 - month, day = divrem(f, 31) - day += 1 - return Date(year, month, day) -end - -function holiday_values(year::Int)::Dict{String,Date} - offsets = Dict{String,Day}("Easter" => Day(0), "Ascension" => Day(39), - "Pentecost" => Day(49), "Trinity" => Day(56), "Corpus" => Day(60)) - easterdate = easter(year) - rst = Dict{String,Date}(holiday => easterdate + days for (holiday, days) in offsets) - return rst -end - -function holiday2str(year::Int)::String - function holiday2str(holiday::String, date::Date)::String - dayname, daynumb, month = dayabbr(date), day(date), monthabbr(date) - return @sprintf "%s: %s %2i %s" holiday dayname daynumb month - end - cal = holiday_values(year) - rst = join(collect(holiday2str(hday, cal[hday]) for hday in - ("Easter", "Ascension", "Pentecost", "Trinity", "Corpus")), ", ") - return "$year -> " * rst -end - -println("\nChristian holidays, related to Easter, for each centennial from 400 to 2100 CE:") -for yr in 400:100:2200 - println(holiday2str(yr)) -end - -println("\nChristian holidays, related to Easter, for years from 2010 to 2020 CE:") -for yr in 2010:2020 - println(holiday2str(yr)) -end diff --git a/Task/Holidays-related-to-Easter/Kotlin/holidays-related-to-easter.kotlin b/Task/Holidays-related-to-Easter/Kotlin/holidays-related-to-easter.kts similarity index 100% rename from Task/Holidays-related-to-Easter/Kotlin/holidays-related-to-easter.kotlin rename to Task/Holidays-related-to-Easter/Kotlin/holidays-related-to-easter.kts diff --git a/Task/Holidays-related-to-Easter/PowerShell/holidays-related-to-easter-1.psh b/Task/Holidays-related-to-Easter/PowerShell/holidays-related-to-easter-1.ps1 similarity index 100% rename from Task/Holidays-related-to-Easter/PowerShell/holidays-related-to-easter-1.psh rename to Task/Holidays-related-to-Easter/PowerShell/holidays-related-to-easter-1.ps1 diff --git a/Task/Holidays-related-to-Easter/PowerShell/holidays-related-to-easter-2.psh b/Task/Holidays-related-to-Easter/PowerShell/holidays-related-to-easter-2.ps1 similarity index 100% rename from Task/Holidays-related-to-Easter/PowerShell/holidays-related-to-easter-2.psh rename to Task/Holidays-related-to-Easter/PowerShell/holidays-related-to-easter-2.ps1 diff --git a/Task/Holidays-related-to-Easter/Rust/holidays-related-to-easter.rs b/Task/Holidays-related-to-Easter/Rust/holidays-related-to-easter.rs new file mode 100644 index 0000000000..787d95bfe8 --- /dev/null +++ b/Task/Holidays-related-to-Easter/Rust/holidays-related-to-easter.rs @@ -0,0 +1,45 @@ +use std::ops::Add; + +use chrono::{prelude::*, Duration}; + +#[allow(clippy::cast_possible_truncation)] +#[allow(clippy::cast_sign_loss)] +#[allow(clippy::cast_possible_wrap)] +fn get_easter_day(year: u32) -> chrono::NaiveDate { + let k = (f64::from(year) / 100.).floor(); + let d = (19 * (year % 19) + + ((15 - ((13. + 8. * k) / 25.).floor() as u32 + k as u32 - (k / 4.).floor() as u32) % 30)) + % 30; + let e = + (2 * (year % 4) + 4 * (year % 7) + 6 * d + ((4 + k as u32 - (k / 4.).floor() as u32) % 7)) + % 7; + + let (month, day) = match d { + 29 if e == 6 => (4, 19), + 28 if e == 6 => (4, 18), + _ if d + e < 10 => (3, 22 + d + e), + _ => (4, d + e - 9), + }; + + NaiveDate::from_ymd_opt(year as i32, month, day).unwrap() +} +fn main() { + let holidays = vec![ + ("Easter", Duration::days(0)), + ("Ascension", Duration::days(39)), + ("Pentecost", Duration::days(49)), + ("Trinity", Duration::days(56)), + ("Corpus Christi", Duration::days(60)), + ]; + for year in (400..=2100).step_by(100).chain(2010..=2020) { + print!("{}: ", year); + for (name, offset) in &holidays { + print!( + "{}: {}, ", + name, + get_easter_day(year).add(*offset).format("%a %d %h") + ); + } + println!(); + } +} diff --git a/Task/Holidays-related-to-Easter/Rust/holidays-related-to-easter.rust b/Task/Holidays-related-to-Easter/Rust/holidays-related-to-easter.rust deleted file mode 100644 index 41c481bee7..0000000000 --- a/Task/Holidays-related-to-Easter/Rust/holidays-related-to-easter.rust +++ /dev/null @@ -1,45 +0,0 @@ -use std::ops::Add; - -use chrono::{prelude::*, Duration}; - -#[allow(clippy::cast_possible_truncation)] -#[allow(clippy::cast_sign_loss)] -#[allow(clippy::cast_possible_wrap)] -fn get_easter_day(year: u32) -> chrono::NaiveDate { - let k = (f64::from(year) / 100.).floor(); - let d = (19 * (year % 19) - + ((15 - ((13. + 8. * k) / 25.).floor() as u32 + k as u32 - (k / 4.).floor() as u32) % 30)) - % 30; - let e = - (2 * (year % 4) + 4 * (year % 7) + 6 * d + ((4 + k as u32 - (k / 4.).floor() as u32) % 7)) - % 7; - - let (month, day) = match d { - 29 if e == 6 => (4, 19), - 28 if e == 6 => (4, 18), - _ if d + e < 10 => (3, 22 + d + e), - _ => (4, d + e - 9), - }; - - NaiveDate::from_ymd(year as i32, month, day) -} -fn main() { - let holidays = vec![ - ("Easter", Duration::days(0)), - ("Ascension", Duration::days(39)), - ("Pentecost", Duration::days(49)), - ("Trinity", Duration::days(56)), - ("Corpus Christi", Duration::days(60)), - ]; - for year in (400..=2100).step_by(100).chain(2010..=2020) { - print!("{}: ", year); - for (name, offset) in &holidays { - print!( - "{}: {}, ", - name, - get_easter_day(year).add(*offset).format("%a %d %h") - ); - } - println!(); - } -} diff --git a/Task/Holidays-related-to-Easter/Scheme/holidays-related-to-easter.ss b/Task/Holidays-related-to-Easter/Scheme/holidays-related-to-easter.scm similarity index 100% rename from Task/Holidays-related-to-Easter/Scheme/holidays-related-to-easter.ss rename to Task/Holidays-related-to-Easter/Scheme/holidays-related-to-easter.scm diff --git a/Task/Holidays-related-to-Easter/Wren/holidays-related-to-easter.wren b/Task/Holidays-related-to-Easter/Wren/holidays-related-to-easter.wren index f6eb5af1bd..4e79976f3c 100644 --- a/Task/Holidays-related-to-Easter/Wren/holidays-related-to-easter.wren +++ b/Task/Holidays-related-to-Easter/Wren/holidays-related-to-easter.wren @@ -1,6 +1,6 @@ -import "/date" for Date -import "/fmt" for Fmt -import "/iterate" for Stepped +import "./date" for Date +import "./fmt" for Fmt +import "./iterate" for Stepped var holidayOffsets = [ ["Easter", 0], diff --git a/Task/Home-primes/FutureBasic/home-primes.basic b/Task/Home-primes/FutureBasic/home-primes.basic new file mode 100644 index 0000000000..e88f384f48 --- /dev/null +++ b/Task/Home-primes/FutureBasic/home-primes.basic @@ -0,0 +1,888 @@ +// ------------------------------------------------------------ +// Home primes +// +// Using FutureBasic 7.0.37 +// November 2025, R.W. +// +// This code is a lot longer than needed. Simply because I +// refused to use Pollard Rho (it's very slow and unreliable). +// So I used pseudo ECM (ECF) for factorization. Much faster. +// +// Output includes Rosetta Task requiring HP65 to be included +// it also has the "impossible" HP49 (just click [next]..) +// ------------------------------------------------------------ + +include "gmp.incl" + +CFTimeInterval tim + +long gN // the next starting integer for [Next] batches +// Global mpz_t bigints reused for speed +mpz_t num, den, inv, t1, t2, g + +mpz_t pp, tmpN, tmpFactor +mpz_t fm +mpz_t gFactors(31) +int gFactorCount + + +// ----------------------------------------------------------- +// Helper: Abbreviate big numeric CFString: head...tail +// ----------------------------------------------------------- +local fn AbbrevString( s as CFStringRef, head as int, ¬ + tail as int ) as CFStringRef + if s == 0 then RETURN @"" + CFStringRef a, b, out + int nLen + nLen = len( s ) + if nLen <= head + tail then RETURN s + a = left( s, head ) + b = right( s, tail ) + out = @"" + out = concat( a, @"...", b ) +end fn = out + +// ----------------------------------------------------------- +// Helper: Get mpz_t result and abbreviate if > 43 digits +// ----------------------------------------------------------- +local fn Abbrev( ts as mpz_t ) as CFStringRef + CFStringRef result + result = fn mpz_cf2( ts ) // FB wrapper mpz_t to CFString + int nLen + nLen = len( result ) + if nLen <= 43 then RETURN result + result = fn AbbrevString( result, 20, 20 ) +end fn = result + +// ----------------------------------------------------------- +// Helper: Convert mpz_t to CFString +// ----------------------------------------------------------- +local fn mpz_to_CFString( m as mpz_t ) as CFStringRef + CFStringRef result = @"" + result = fn mpz_cf2( m ) //FB wrapper mpz_t to CFString base 10 +end fn = result +// ----------------------------------------------------------- +// Helper: Is n probably prime? +// ----------------------------------------------------------- +local fn IsProbablePrime( n as mpz_t ) as boolean + int r + r = fn mpz_probab_prime_p( n, 25 ) // 25 reps should be sufficient + // r = 0 (composite), 1 (probable prime), 2 (definite prime) + if r > 0 then RETURN _true +end fn = _false + +// ------------------------------------------------------------ +// Small prime test for Int input +// Uses mpz_probab_prime_p with gmp +// ------------------------------------------------------------ +local fn IsPrimeInt( n as long ) as Boolean + if n < 2 then RETURN _false + fn mpz_set_si( pp, n ) + int r + r = fn mpz_probab_prime_p( pp, 15 ) + if r > 0 then RETURN _true +end fn = _false + +// ----------------------------------------------------------- +// Helper: Simple 32-bit primality test for Stage 1 ECM +// ----------------------------------------------------------- +local fn IsSmallPrime32( p as UInt32 ) as boolean + if p < 2 then return _false + if p = 2 then return _true + if (p AND 1) == 0 then return _false + + UInt32 d + d = 3 + while d * d <= p + if (p MOD d) == 0 then return _false + d = d + 2 + wend + +end fn = _true + +// Clear global mpz +void local fn clear_MPZ + mpz_clear( num ) + mpz_clear( den ) + mpz_clear( inv ) + mpz_clear( t1 ) + mpz_clear( t2 ) + mpz_clear( g ) +end fn + +// Init global mpz +void local fn Init_MPZ + mpz_init( num ) + mpz_init( den ) + mpz_init( inv ) + mpz_init( t1 ) + mpz_init( t2 ) + mpz_init( g ) +end fn + +// --------------------------------------------------------------- +// ECM_PointDouble +// Point doubling: P = (x,y) → 2P on y^2 = x^3 + a x + b (MOD n) +// Returns _true if a nontrivial factor found (in 'factor'), +// else _false. +// On success, 'factor' holds GCD > 1, < n, and x,y are undefined +// On normal completion, x,y are updated to 2P. +// --------------------------------------------------------------- + +local fn ECM_PointDouble( n as mpz_t, a as mpz_t, ¬ + x as mpz_t, y as mpz_t, factor as mpz_t ) as boolean + + fn Init_MPZ + + mpz_mul( t1, x, x ) // num = 3 * x^2 + a (MOD n) + mpz_mod( t1, t1, n ) // t1 = x^2 + mpz_mul_ui( num, t1, 3 ) // num = 3*x^2 + mpz_add( num, num, a ) + mpz_mod( num, num, n ) + + mpz_mul_ui( den, y, 2 ) // den = 2*y (MOD n) + mpz_mod( den, den, n ) + + if fn mpz_invert( inv, den, n ) == 0 // try to invert den + // inversion failed -> GCD(den, n) may give a factor? + // do you feel lucky, punk? + mpz_GCD( g, den, n ) + if (fn mpz_cmp_ui( g, 1 ) > 0) && (fn mpz_cmp( g, n ) < 0) + mpz_set( factor, g ) + fn Clear_MPZ + return _true + end if + // GCD == 1 or GCD == n -> useless curve (sigh) + fn Clear_MPZ + return _false + end if + + mpz_mul( t1, num, inv ) // lambda = num * inv (MOD n) + mpz_mod( t1, t1, n ) // t1 = lambda + + // x3 = lambda^2 - 2 * x (MOD n) + mpz_mul( t2, t1, t1 ) // lambda^2 + mpz_mod( t2, t2, n ) + mpz_mul_ui( num, x, 2 ) // 2x + mpz_mod( num, num, n ) + mpz_sub( t2, t2, num ) + mpz_mod( t2, t2, n ) // t2 = x3 + + // y3 = lambda * (x - x3) - y (MOD n) + mpz_sub( num, x, t2 ) // x - x3 + mpz_mod( num, num, n ) + mpz_mul( num, t1, num ) // lambda * (x - x3) + mpz_mod( num, num, n ) + mpz_sub( num, num, y ) // lambda * (x - x3) - y + mpz_mod( num, num, n ) // num = y3 + + mpz_set( x, t2 ) // update P ← (x3, y3) + mpz_set( y, num ) + + fn Clear_MPZ +end fn = _false + +// ----------------------------------------------------------- +// ECM_PointAdd +// Point addition: P1 = (x1,y1) ← P1 + P2, with P2 = (x2,y2) +// Curve: y^2 = x^3 + a x + b (MOD n) +// Returns _true if a factor found (in 'factor'), else _false. +// ----------------------------------------------------------- +local fn ECM_PointAdd( n as mpz_t, a as mpz_t, x1 as mpz_t, ¬ + y1 as mpz_t, x2 as mpz_t, y2 as mpz_t, factor as mpz_t ) as boolean + + fn Init_MPZ + + mpz_sub( t1, n, y2 ) // t1 = -y2 MOD n + mpz_mod( t1, t1, n ) + // If x1 == x2 and y1 == -y2, point is infinity + // For our purposes, treat this as a useless -> just return _false. + if (fn mpz_cmp( x1, x2 ) == 0) && (fn mpz_cmp( y1, t1 )== 0) + fn Clear_MPZ + return _false + end if + + mpz_sub( num, y2, y1 ) // num = y2 - y1 (MOD n) + mpz_mod( num, num, n ) + + mpz_sub( den, x2, x1 ) // den = x2 - x1 (MOD n) + mpz_mod( den, den, n ) + + // try to invert den + if fn mpz_invert( inv, den, n ) == 0 + mpz_GCD( g, den, n ) + if (fn mpz_cmp_ui( g, 1 ) > 0) && (fn mpz_cmp( g, n ) < 0) + mpz_set( factor, g ) + fn Clear_MPZ + return _true + end if + fn Clear_MPZ + return _false + end if + + mpz_mul( t1, num, inv ) // lambda = num * inv (MOD n) + mpz_mod( t1, t1, n ) // t1 = lambda + + // x3 = lambda^2 - x1 - x2 (MOD n) + mpz_mul( t2, t1, t1 ) // lambda^2 + mpz_mod( t2, t2, n ) + mpz_sub( t2, t2, x1 ) + mpz_sub( t2, t2, x2 ) + mpz_mod( t2, t2, n ) // t2 = x3 + + // y3 = lambda * (x1 - x3) - y1 (MOD n) + mpz_sub( num, x1, t2 ) // x1 - x3 + mpz_mod( num, num, n ) + mpz_mul( num, t1, num ) + mpz_mod( num, num, n ) + mpz_sub( num, num, y1 ) + mpz_mod( num, num, n ) // num = y3 + + mpz_set( x1, t2 ) + mpz_set( y1, num ) + + fn Clear_MPZ + +end fn = _false + +// ------------------------------------------------------------ +// ECM_ScalarMul +// Scalar multiply P = (x,y) by k: P ← k * P +// Uses binary double-and-add. Returns _true if a factor found. +// ------------------------------------------------------------ + +local fn ECM_ScalarMul( n as mpz_t, a as mpz_t, x as mpz_t, ¬ + y as mpz_t, k as UInt64, factor as mpz_t ) as boolean + + if k <= 1 then return _false + + mpz_t rx, ry, qx, qy + mpz_init( rx ) + mpz_init( ry ) + mpz_init( qx ) + mpz_init( qy ) + + int hasR + hasR = _false // R (result) is "not set" yet + + mpz_set( qx, x ) // Q = P (base) + mpz_set( qy, y ) + + // find highest bit of k + int sbit + sbit = 63 + while (sbit > 0) && ((k AND (1ULL << sbit)) = 0) + sbit -- // decrement bit + wend + + // process bits from MSB down to 0 + while sbit >= 0 + if hasR + // R = 2R + if fn ECM_PointDouble( n, a, rx, ry, factor ) + // factor found + mpz_clear( rx ) + mpz_clear( ry ) + mpz_clear( qx ) + mpz_clear( qy ) + return _true + end if + end if + + if (k AND (1ULL << sbit)) != 0 + if hasR = _false + // first 1 bit: R = Q + mpz_set( rx, qx ) + mpz_set( ry, qy ) + hasR = _true + else + // R = R + Q + if fn ECM_PointAdd( n, a, rx, ry, qx, qy, factor ) + mpz_clear( rx ) + mpz_clear( ry ) + mpz_clear( qx ) + mpz_clear( qy ) + return _true + end if + end if + end if + + sbit -- // decrement bit + wend + + if hasR + mpz_set( x, rx ) + mpz_set( y, ry ) + end if + + mpz_clear( rx ) + mpz_clear( ry ) + mpz_clear( qx ) + mpz_clear( qy ) +end fn = _false + + +// ---------------------------------------------------------------- +// ECM_Stage1Curve +// Stage-1 ECM on one curve determined by 'sigma' +// Curve: y^2 = x^3 + a x + b (MOD n) with (x,y) chosen from sigma. +// B1: first-stage bound, e.g. 10000. +// Returns _true and sets 'factor' if a factor was +// found, else _false. +// ---------------------------------------------------------------- + +local fn ECM_Stage1Curve( n as mpz_t, factor as mpz_t, ¬ + B1 as UInt32, sigma as UInt32 ) as boolean + + mpz_t a, b, x, y, tmp + mpz_init( a ) + mpz_init( b ) + mpz_init( x ) + mpz_init( y ) + mpz_init( tmp ) + + mpz_set_ui( x, sigma ) // x = sigma (MOD n) + mpz_mod( x, x, n ) + + mpz_set_ui( y, sigma + 1 ) // y = sigma + 1 (MOD n) + mpz_mod( y, y, n ) + + mpz_set_ui( a, sigma + 2 ) // a = sigma + 2 (MOD n) + mpz_mod( a, a, n ) + + // b = y^2 - x^3 - a*x (MOD n) + mpz_mul( b, y, y ) // y^2 + mpz_mod( b, b, n ) + + mpz_mul( tmp, x, x ) // x^2 + mpz_mod( tmp, tmp, n ) + mpz_mul( tmp, tmp, x ) // x^3 + mpz_mod( tmp, tmp, n ) + mpz_sub( b, b, tmp ) // y^2 - x^3 + + mpz_mul( tmp, a, x ) // a * x + mpz_mod( tmp, tmp, n ) + mpz_sub( b, b, tmp ) // y^2 - x^3 - a*x + mpz_mod( b, b, n ) + + // Multiply P by prime powers p^e with p <= B1 + UInt32 p, pe + p = 2 + + while p <= B1 + if fn IsSmallPrime32( p ) + // pe = p^e <= B1 + pe = p + while (pe * p) <= B1 + pe = pe * p + wend + + if fn ECM_ScalarMul( n, a, x, y, pe, factor ) + // factor found + mpz_clear( a ) + mpz_clear( b ) + mpz_clear( x ) + mpz_clear( y ) + mpz_clear( tmp ) + return _true + end if + end if + + if p == 2 then p = 3 else p = p + 2 + wend + + mpz_clear( a ) + mpz_clear( b ) + mpz_clear( x ) + mpz_clear( y ) + mpz_clear( tmp ) +end fn = _false + +// ----------------------------------------------------------- +// ECM_FindFactor +// Try several Stage-1 ECM curves with increasing sigma. +// Returns _true and sets 'factor' if a factor is found. +// ----------------------------------------------------------- + +local fn ECM_FindFactor( n as mpz_t, factor as mpz_t ) as boolean + UInt32 B1, sigma + int curves + int i + B1 = 10000 // bound (bigger = slower) + curves = 20 // number of different curves to try + sigma = 2 + i = 0 + while i < curves + if fn ECM_Stage1Curve( n, factor, B1, sigma ) + return _true + end if + sigma ++ + i ++ + wend +end fn = _false + +// Safely divide mpz_t + +local fn SafeMpzDiv( z as mpz_t, x as mpz_t, y as mpz_t ) as boolean + if ( fn mpz_sgn( y ) == 0 ) // div by zero? + mpz_set_ui( z, 0) + return _false + end if + // Call GMP division (truncate toward zero) + mpz_tdiv_q( z, x, y ) +end fn = _true + + +// ----------------------------------------------------------- +// Recursive factorization using ECM Stage 1 +// Results go into global gFactors() / gFactorCount +// trustProbPrime = _true → use IsProbablePrime shortcut +// trustProbPrime = _false → NEVER trust IsProbablePrime; rely on ECM +// ----------------------------------------------------------- +void local fn FactorRec( n as mpz_t, trustProbPrime as boolean ) + // if n == 1 → nothing + if fn mpz_cmp_ui( n, 1 ) = 0 then RETURN + + // If allowed, trust mpz_probab_prime_p + if trustProbPrime + if fn IsProbablePrime( n ) + mpz_set( gFactors( gFactorCount ), n ) + gFactorCount = gFactorCount + 1 + RETURN + end if + end if + + mpz_t d, q + mpz_init( d ) + mpz_init( q ) + + Boolean got + got = fn ECM_FindFactor( n, d ) + + if got == _false + // ECM did not find a nontrivial factor; treat n as final factor + mpz_set( gFactors( gFactorCount ), n ) + gFactorCount = gFactorCount + 1 + mpz_clear( d ) + mpz_clear( q ) + RETURN + end if + + if fn SafeMpzDiv( q, n, d ) // q = n / d + // recurse on d and q with the same mode + fn FactorRec( d, trustProbPrime ) + fn FactorRec( q, trustProbPrime ) + end if + + mpz_clear( d ) + mpz_clear( q ) +end fn + +// ------------------------------------------------------------ +// FactorStringUnderscore +// Factor j into primes and build "p1_p2_p3" as CFStringRef +// forceFull = _false → use IsProbablePrime shortcut (fast) +// forceFull = _true → ignore IsProbablePrime, full ECM +// ------------------------------------------------------------ +local fn FactorStringUnderscore( j as mpz_t, forceFull as boolean ) as CFStringRef + CFStringRef outStr = @"" + + // Work copy of j in fm, factor |j| + fn mpz_set( fm, j ) + fn mpz_abs( fm, fm ) + + // If fm < 2, nothing to do + if fn mpz_cmp_ui( fm, 2 ) < 0 then RETURN outStr + + // Reset factor buffer + gFactorCount = 0 + + // Fill gFactors[0..gFactorCount-1] with prime factors (not sorted) + // trustProbPrime = NOT forceFull + Boolean trustProbPrime + trustProbPrime = _true + if forceFull then trustProbPrime = _false + + fn FactorRec( fm, trustProbPrime ) + + // If FactorRec somehow didn't produce anything, bail out + if gFactorCount <= 0 then RETURN outStr + + // sort factors in ascending order (same as before) + int i, jidx + mpz_t tmp + mpz_init( tmp ) + + i = 0 + while i < gFactorCount - 1 + jidx = i + 1 + while jidx < gFactorCount + if fn mpz_cmp( gFactors(i), gFactors(jidx) ) > 0 + fn mpz_set( tmp, gFactors(i) ) + fn mpz_set( gFactors(i), gFactors(jidx) ) + fn mpz_set( gFactors(jidx), tmp ) + end if + jidx++ + wend + i++ + wend + + mpz_clear( tmp ) + + // build "p1_p2_p3_..." string + outStr = @"" + i = 0 + while i < gFactorCount + if i > 0 + outStr = concat( outStr, @"_" ) + end if + outStr = concat( outStr, fn mpz_to_CFString( gFactors(i) ) ) + i++ + wend + +end fn = outStr + +// ------------------------------------------------------------ +// FactorConcat (ECM-based) +// Factor j into primes using FactorRec (ECM + primality test), +// collect factors in ascending order, and concatenate them +// ------------------------------------------------------------ +local fn FactorConcat( j as mpz_t ) as CFStringRef + CFStringRef outStr = @"" + + // Work copy of j in fm, factor |j| + fn mpz_set( fm, j ) + fn mpz_abs( fm, fm ) + + // If fm < 2, nothing to do + if fn mpz_cmp_ui( fm, 2 ) < 0 then RETURN outStr + + // Reset factor buffer + gFactorCount = 0 + + // Fill gFactors[0..gFactorCount-1] with prime factors (not sorted) + fn FactorRec( fm, _true ) // for chain math, trust probable primes + + // If FactorRec somehow didn't produce anything, bail out + if gFactorCount <= 0 then RETURN outStr + + // sort factors in ascending order + int i, jidx + mpz_t tmp + mpz_init( tmp ) + + i = 0 + while i < gFactorCount - 1 + jidx = i + 1 + while jidx < gFactorCount + if fn mpz_cmp( gFactors(i), gFactors(jidx) ) > 0 + // swap gFactors(i) and gFactors(jidx) + fn mpz_set( tmp, gFactors(i) ) + fn mpz_set( gFactors(i), gFactors(jidx) ) + fn mpz_set( gFactors(jidx), tmp ) + end if + jidx++ + wend + i++ + wend + + mpz_clear( tmp ) + + // build concatenated decimal string of prime factors + outStr = @"" + i = 0 + while i < gFactorCount + outStr = concat( outStr, fn mpz_to_CFString( gFactors(i) ) ) + i++ + wend + +end fn = outStr + + +// Max chain length we’re willing to handle +_kMaxChain = 32 + +// ------------------------------------------------------------ +// Home_Prime_Chain +// Build Home Prime chain for integer n +// - Uses FactorConcat (ECM-backed) for factoring +// - Stops when value is prime OR when no progress is made +// ------------------------------------------------------------ +local fn Home_Prime_Chain( n as long ) as CFStringRef + CFStringRef result = @"" + CFStringRef pad = @" " + CFStringRef chain + CFStringRef nStr, iterStr, tmpCF + + // Guard: n < 2 → empty + if n < 2 then RETURN result + + // If n is prime: "HPn = n" + if fn IsPrimeInt( n ) + nStr = mid( str( n ), 1 ) + chain = concat( @"HP", nStr ) + chain = concat( chain, left( pad, 10 - len( chain ) ), @"= " ) + chain = concat( chain, nStr ) + result = chain + RETURN result + end if + + // ---------------------------------------- + // Otherwise, build the chain using GMP + // h[0..iterCount] hold the successive values + // ---------------------------------------- + _kMaxSteps = 64 + mpz_t h( _kMaxSteps - 1 ) + int i + + // initialize mpz_t array + i = 0 + while i < _kMaxSteps + fn mpz_init( h(i) ) + i++ + wend + + int iterCount + iterCount = 0 + + CFStringRef concatStr + CFStringRef oneDigit + + // Track previous value to detect "no progress" stalls + mpz_t prevN + fn mpz_init( prevN ) + int stalled + stalled = _false + + // h[0] = initial n + fn mpz_set_si( h(0), n ) + fn mpz_set_si( tmpN, n ) // current value in the chain + + // iterate until prime, stall, or max steps + while iterCount < _kMaxSteps + int isPrime + isPrime = fn mpz_probab_prime_p( tmpN, 15 ) + if isPrime > 0 + // Probable prime: normal termination + exit while + end if + + // Save previous value so we can detect no progress + fn mpz_set( prevN, tmpN ) + + // Not prime: factor tmpN, build concatenation string of prime factors + concatStr = fn FactorConcat( tmpN ) // decimal string of concatenated factors + + // Build new tmpN from decimal digits of concatStr + fn mpz_set_ui( tmpN, 0 ) + + int L, dpos, digit + L = len( concatStr ) + dpos = 1 + + while dpos <= L + // CFString mid() is 0-based: start at dpos-1 + oneDigit = mid( concatStr, dpos - 1, 1 ) + digit = IntVal( oneDigit ) // CFStringRef → int digit (0–9) + fn mpz_mul_ui( tmpN, tmpN, 10 ) + fn mpz_add_ui( tmpN, tmpN, digit ) + dpos++ + wend + + // Check for "no progress": new tmpN == prevN ⇒ factoring failed / stalled + if fn mpz_cmp( tmpN, prevN ) == 0 + stalled = _true + exit while + end if + + // Store this term in the chain + iterCount++ + if iterCount < _kMaxSteps + fn mpz_set( h(iterCount), tmpN ) + end if + wend + + // Safety clamp if we bailed by hitting the step cap + if iterCount >= _kMaxSteps + iterCount = _kMaxSteps - 1 + stalled = _true + end if + + // iterCount is the index of the final value in h[] + CFStringRef finalStr + finalStr = fn Abbrev( h(iterCount) ) + + // ---------------------------------------------- + // Build the chain in multi-line readable format + // ---------------------------------------------- + chain = @"" + + // First line: HPn(iterCount) + pad = @" " + nStr = mid( str( n ), 1 ) + iterStr = mid( str( iterCount ), 1 ) + + chain = concat( chain, @"HP" ) + chain = concat( chain, nStr ) + if iterCount > 1 + chain = concat( chain, @" (" ) + chain = concat( chain, iterStr ) + chain = concat( chain, @")" ) + end if + chain = concat( chain, left( pad, 10 - len( chain ) ), @"= " ) + + // ---------------------------------------------------- + // Print each step on its own line, as factor strings: + // stepIndex = 1 → factors of h(0) (original n) + // stepIndex = 2 → factors of h(1), etc. + // remaining = iterCount - stepIndex + // ---------------------------------------------------- + int stepIndex + stepIndex = 1 + while stepIndex <= iterCount - 1 + int remaining + remaining = iterCount - stepIndex + + // Factor h(stepIndex-1) and show "p1_p2_p3" + // For intermediate steps we can use the fast mode (trust probable primes). + tmpCF = fn FactorStringUnderscore( h(stepIndex - 1), _false ) + iterStr = mid( str( remaining ), 1 ) + + if stepIndex == 1 + pad = @"" + else + pad = @" " + end if + + chain = concat( chain, pad ) + tmpCF = fn AbbrevString( tmpCF, 20, 20 ) + chain = concat( chain, tmpCF ) + chain = concat( chain, @" (" ) + chain = concat( chain, iterStr ) + chain = concat( chain, @")" ) + chain = concat( chain, @"\n" ) + + stepIndex++ + wend + + // Final line: just show the final value (probable prime) + if stepIndex > 1 + chain = concat( chain, @" " ) + end if + + //CFStringRef finalStr + finalStr = fn Abbrev( h(iterCount) ) + chain = concat( chain, finalStr ) + if stalled + chain = concat( chain, @" (stalled – factoring limit)" ) + end if + + result = chain + + // clear h[] and prevN + i = 0 + while i < _kMaxSteps + fn mpz_clear( h(i) ) + i++ + wend + fn mpz_clear( prevN ) + +end fn = result + +// ------------------------------------------------------------ +// More_HP +// show the next 20 Home Primes +// ------------------------------------------------------------ +void local fn More_HP + CFStringRef pline + long n + int count + + tim = fn CACurrentMediaTime + + count = 0 + n = gN + while count < 20 + pline = fn Home_Prime_Chain( n ) + print @pline + n++ + count++ + wend + + gN = n + if gN > 160 then button 2, NO + printf @"\nElapsed time: %.3f secs\n", ( fn CACurrentMediaTime - tim ) +end fn + +// ------------------------------------------------------------ +// Main — compute 2 to 20 Home primes +// ------------------------------------------------------------ +local fn Main + CFStringRef pline + long k + // init globals + fn mpz_init( pp ) + fn mpz_init( tmpN ) + fn mpz_init( tmpFactor ) + + int i + i = 0 + while i <= 30 + mpz_init( gFactors(i) ) + i++ + wend + + print @"Home Prime for integer 2 through 20:\n" + + tim = fn CACurrentMediaTime + + k = 2 + while k <= 20 + pline = fn Home_Prime_Chain( k ) + print @pline + k++ + wend + + printf @"\nElapsed time: %.3f secs\n", ( fn CACurrentMediaTime - tim ) + print @"Click [Next] for the next 20 Home primes.\n" + + // Prepare next batch start + gN = 21 +end fn + +// ------------------------------------------------------------ +// Dialog handler +// ------------------------------------------------------------ +void local fn DoDialog( ev as long, tag as long, wnd as long, obj as CFTypeRef ) + select ( ev ) + case _btnClick + select ( tag ) + case 2 + fn More_HP + end select + + case _windowShouldClose + // clear any uncleared mpz + fn mpz_clear( pp ) + fn mpz_clear( tmpN ) + fn mpz_clear( tmpFactor ) + end + end select +end fn + +on dialog fn DoDialog + +// ------------------------------------------------------------ +// Main +// ------------------------------------------------------------ +window 1, @"Home primes", (0,0,800,600) +button 2, YES,, @"Next", (680,20,100,20),,, 1 + +// init globals +fn mpz_init( pp ) +fn mpz_init( tmpN ) +fn mpz_init( tmpFactor ) + +fn Main + +HandleEvents diff --git a/Task/Home-primes/Java/home-primes.java b/Task/Home-primes/Java/home-primes.java index 3333b65769..fb257016c4 100644 --- a/Task/Home-primes/Java/home-primes.java +++ b/Task/Home-primes/Java/home-primes.java @@ -12,7 +12,8 @@ public final class HomePrimes { public static void main(String[] aArgs) { listPrimes(PRIME_LIMIT); - List values = List.of( 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 65 ); + List values = + List.of( 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 65 ); for ( int value : values ) { BigInteger number = BigInteger.valueOf(value); List previousNumbers = Stream.of( number ).collect(Collectors.toList()); diff --git a/Task/Home-primes/JavaScript/home-primes.js b/Task/Home-primes/JavaScript/home-primes.js new file mode 100644 index 0000000000..b848e04c01 --- /dev/null +++ b/Task/Home-primes/JavaScript/home-primes.js @@ -0,0 +1,240 @@ +/** + * Home Primes calculator - JavaScript version + * Finds the home prime for a given number by repeatedly factorizing and concatenating + */ + +const CERTAINTY_LEVEL = 20; +const PRIME_LIMIT = 10000; + +class HomePrimes { + constructor() { + this.primes = []; + this.listPrimes(PRIME_LIMIT); + } + + /** + * Main function to calculate home primes for test values + */ + main() { + const values = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 65]; + + for (const value of values) { + let number = BigInt(value); + const previousNumbers = [number]; + let searching = true; + + while (searching) { + number = this.concatenate(this.primeFactors(number)); + previousNumbers.push(number); + + if (this.isProbablePrime(number, CERTAINTY_LEVEL)) { + const lastIndex = previousNumbers.length - 1; + let output = ''; + for (let k = lastIndex; k >= 1; k--) { + output += `HP${previousNumbers[lastIndex - k]}(${k}) = `; + } + output += previousNumbers[lastIndex]; + console.log(output); + searching = false; + } + } + } + } + + /** + * Get prime factors of a number using trial division or Pollard's Rho + */ + primeFactors(num) { + if (num <= BigInt(PRIME_LIMIT * PRIME_LIMIT)) { + return this.smallPrimeFactors(num); + } + + if (this.isProbablePrime(num, CERTAINTY_LEVEL)) { + return [num]; + } + + const divisor = this.pollardRho(num); + const result = [ + ...this.primeFactors(divisor), + ...this.primeFactors(num / divisor) + ]; + return result.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0)); + } + + /** + * Trial division for smaller numbers + */ + smallPrimeFactors(num) { + let number = Number(num); + const result = []; + + for (let i = 0; i < this.primes.length && number > 1; i++) { + while (number % this.primes[i] === 0) { + result.push(BigInt(this.primes[i])); + number = Math.floor(number / this.primes[i]); + } + } + + if (number > 1) { + result.push(BigInt(number)); + } + return result; + } + + /** + * Pollard's Rho algorithm for integer factorization + */ + pollardRho(num) { + // Check if even + if ((num & BigInt(1)) === BigInt(0)) { + return BigInt(2); + } + + const bitLength = num.toString(2).length; + const constant = this.randomBigInt(bitLength); + let x = this.randomBigInt(bitLength); + let y = x; + let divisor = BigInt(1); + + while (divisor === BigInt(1)) { + x = (x * x + constant) % num; + y = (y * y + constant) % num; + y = (y * y + constant) % num; + divisor = this.gcd(x > y ? x - y : y - x, num); + } + + return divisor; + } + + /** + * Concatenate list of BigInts into a single BigInt + */ + concatenate(list) { + const str = list.map(n => n.toString()).join(''); + return BigInt(str); + } + + /** + * Sieve of Eratosthenes to generate primes up to limit + */ + listPrimes(limit) { + const sieve = new Array(limit + 1).fill(true); + sieve[0] = false; + sieve[1] = false; + + for (let i = 2; i * i <= limit; i++) { + if (sieve[i]) { + for (let j = i * i; j <= limit; j += i) { + sieve[j] = false; + } + } + } + + this.primes = []; + for (let i = 2; i <= limit; i++) { + if (sieve[i]) { + this.primes.push(i); + } + } + } + + /** + * Miller-Rabin primality test + */ + isProbablePrime(n, k) { + if (n === BigInt(2) || n === BigInt(3)) return true; + if (n <= BigInt(1) || (n & BigInt(1)) === BigInt(0)) return false; + + // Write n-1 as d * 2^r + let d = n - BigInt(1); + let r = 0; + while ((d & BigInt(1)) === BigInt(0)) { + d >>= BigInt(1); + r++; + } + + // Witness loop + for (let i = 0; i < k; i++) { + const a = this.randomBigIntRange(BigInt(2), n - BigInt(2)); + let x = this.modPow(a, d, n); + + if (x === BigInt(1) || x === n - BigInt(1)) continue; + + let composite = true; + for (let j = 0; j < r - 1; j++) { + x = this.modPow(x, BigInt(2), n); + if (x === n - BigInt(1)) { + composite = false; + break; + } + } + + if (composite) return false; + } + + return true; + } + + /** + * Modular exponentiation: (base^exp) % mod + */ + modPow(base, exp, mod) { + let result = BigInt(1); + base = base % mod; + + while (exp > BigInt(0)) { + if ((exp & BigInt(1)) === BigInt(1)) { + result = (result * base) % mod; + } + exp >>= BigInt(1); + base = (base * base) % mod; + } + + return result; + } + + /** + * Euclidean algorithm for GCD + */ + gcd(a, b) { + a = a < BigInt(0) ? -a : a; + b = b < BigInt(0) ? -b : b; + + while (b !== BigInt(0)) { + const temp = b; + b = a % b; + a = temp; + } + return a; + } + + /** + * Generate random BigInt with specified bit length + */ + randomBigInt(bits) { + const bytes = Math.ceil(bits / 8); + const hex = Array(bytes) + .fill(0) + .map(() => Math.floor(Math.random() * 256).toString(16).padStart(2, '0')) + .join(''); + const num = BigInt('0x' + hex); + return num >> BigInt(bytes * 8 - bits); // Trim to exact bit length + } + + /** + * Generate random BigInt in range [min, max] + */ + randomBigIntRange(min, max) { + const range = max - min + BigInt(1); + const bits = range.toString(2).length; + let result; + do { + result = this.randomBigInt(bits); + } while (result >= range); + return result + min; + } +} + +// Run the program +const hp = new HomePrimes(); +hp.main(); diff --git a/Task/Home-primes/Julia/home-primes.julia b/Task/Home-primes/Julia/home-primes.jl similarity index 100% rename from Task/Home-primes/Julia/home-primes.julia rename to Task/Home-primes/Julia/home-primes.jl diff --git a/Task/Home-primes/PARI-GP/home-primes.parigp b/Task/Home-primes/PARI-GP/home-primes.parigp new file mode 100644 index 0000000000..dd584f6a2d --- /dev/null +++ b/Task/Home-primes/PARI-GP/home-primes.parigp @@ -0,0 +1,30 @@ +homeprimechain(n) = { + my(chain = [], concat_result, factors, factor_str); + while (!isprime(n), + chain = concat(chain, n); /* Append n to the chain */ + factors = factor(n); + /* Correctly build the concatenated string of factors */ + factor_str = Str(concat(Vec(vector(#factors~, i, + concat(Vec(concat(vector(factors[i, 2], j, Str(factors[i, 1]))))))))); + concat_result = factor_str; + \\print("concat_result=" concat_result); + n = eval(concat_result); /* Convert string back to number */ + ); + concat(chain, n); /* Append the final prime to the chain */ +} + +printHPiter(n, numperline = 4) = { + my(chain = homeprimechain(n), len = #chain, i); + for (i = 1, len, + if (i < len, + print1("HP" , chain[i] , " (" , len - i , ") = " , if(i % numperline == 0, "\n", "")), + print(chain[i], " is prime.\n\n"); + ); + ); +} + +{ +/* Iterate over a set of numbers */ +forstep(i = 2, 20, 1, print("Home Prime chain for ", i, ": "); printHPiter(i);); +printHPiter(65); +} diff --git a/Task/Home-primes/Phix/home-primes.phix b/Task/Home-primes/Phix/home-primes.phix index b818d65a8e..9ac18748b8 100644 --- a/Task/Home-primes/Phix/home-primes.phix +++ b/Task/Home-primes/Phix/home-primes.phix @@ -1,37 +1,35 @@ -(phixonline)--> - with javascript_semantics - requires("1.0.0") - include mpfr.e +with javascript_semantics +requires("1.0.0") -- mpz_pollard_rho +include mpfr.e - procedure test(integer n) - string s = sprintf("%d",n), lastp = "" - sequence res = {s} - atom t0 = time() - while true do - s = substitute(s,"_","") - sequence rr = mpz_pollard_rho(s,true) - if length(rr)=1 then exit end if - s = join(rr,"_") - res = append(res,s) - end while - atom t = time()-t0 - integer niter = length(res)-1 - string iter = iff(niter>1?sprintf("(%d)",niter):""), - e = iff(t>0.1?" ["&elapsed(t)&"]":"") - s = sprintf("HP%d%s = ",{n,iter}) - if niter=0 then - printf(1,"%s%d %s\n",{s,n,e}) - else - for i=2 to niter do - niter -= 1 - printf(1,"%sHP%s(%d)\n",{s,res[i],niter}) - if i=2 then - s = repeat(' ',length(s)) - s[-2] = '=' - end if - end for - printf(1,"%s%s %s\n",{s,res[$],e}) - end if - end procedure - papply(tagset(20,2)&65,test) - - without js -- (system_exec, file i/o) - constant tmp = "hostname.txt", - cmd = iff(platform()=WINDOWS?"hostname":"uname -n") - {} = system_exec(sprintf("%s > %s",{cmd,tmp}),4) - string host = trim(get_text(tmp)) - {} = delete_file("hostname.txt") - ?host -(encode dictionary, decode dictionary) // build the tree, which is a list of lists of ... tree:=ft.pump(List,fcn([(c,cnt)]){ //-->L( (cnt, ((sym,code))), ...) L(cnt, L(L(c,""))) - }).copy(); // make it writable + }).copy(); // make it writable while(tree.len()>1){ // fake up a [lame] priorty queue tree=tree.sort(fcn(a,b){ a[0]>b[0] }); //prioritize high to low - a,b:=tree.pop(-2,2); //remove 2 least frequent symbols - mc:=fcn(n,c){ n[1] = c + n[1]; }; //(sym,code),"0"|"1" + a,b:=tree.pop(-2,2); //remove 2 least frequent symbols + mc:=fcn(n,c){ n[1] = c + n[1]; }; //(sym,code),"0"|"1" a[1].apply2(mc,"0"); b[1].apply2(mc,"1"); // mc(a[1],"0") tree.append( L(a[0]+b[0],a[1].extend(b[1])) ); //(a,b)-->new node }//-->L(L(39, L( L(" ","000"),L("e","0010"),L("a","0011") ... tree=tree[0][1].pump(List,fcn(i){ // flatten rather than traverse - if(T.isType(i))return(Void.Recurse,i,self.fcn); i }); + if(T.isType(i))return(Void.Recurse,i,self.fcn); i }); encodeTable:=tree.toDictionary(); // symbol:Huffman code decodeTable:=encodeTable.pump(Dictionary(),"reverse"); // code:symbol return(encodeTable,decodeTable); diff --git a/Task/Humble-numbers/ALGOL-68/humble-numbers.alg b/Task/Humble-numbers/ALGOL-68/humble-numbers.alg index 09ce86b2ae..b0a103ca81 100644 --- a/Task/Humble-numbers/ALGOL-68/humble-numbers.alg +++ b/Task/Humble-numbers/ALGOL-68/humble-numbers.alg @@ -17,10 +17,10 @@ BEGIN # find some Humble numbers - numbers with no prime factors above 7 # INT m = min( min( min( p2, p3 ), p5 ), p7 ); h[ n ] := m; IF n <= max shown humble THEN print( ( " ", whole( m, 0 ) ) ) FI; - IF m = p2 THEN p2 := 2 * h[ last2 := last2 + 1 ] FI; - IF m = p3 THEN p3 := 3 * h[ last3 := last3 + 1 ] FI; - IF m = p5 THEN p5 := 5 * h[ last5 := last5 + 1 ] FI; - IF m = p7 THEN p7 := 7 * h[ last7 := last7 + 1 ] FI; + IF m = p2 THEN p2 := 2 * h[ last2 +:= 1 ] FI; + IF m = p3 THEN p3 := 3 * h[ last3 +:= 1 ] FI; + IF m = p5 THEN p5 := 5 * h[ last5 +:= 1 ] FI; + IF m = p7 THEN p7 := 7 * h[ last7 +:= 1 ] FI; h count[ IF m < 10 THEN 1 ELIF m < 100 THEN 2 ELIF m < 1 000 THEN 3 diff --git a/Task/Humble-numbers/Ada/humble-numbers.ada b/Task/Humble-numbers/Ada/humble-numbers.adb similarity index 100% rename from Task/Humble-numbers/Ada/humble-numbers.ada rename to Task/Humble-numbers/Ada/humble-numbers.adb diff --git a/Task/Humble-numbers/Agena/humble-numbers.agena b/Task/Humble-numbers/Agena/humble-numbers.agena new file mode 100644 index 0000000000..cddec65d4a --- /dev/null +++ b/Task/Humble-numbers/Agena/humble-numbers.agena @@ -0,0 +1,32 @@ +scope # find some Humble numbers - numbers with no prime factors above 7 + local constant maxHumble, constant maxShownHumble := 2048, 50; + local h, hCount := seq(), [ 0, 0, 0, 0, 0, 0 ]; hCount[ 0 ] := 0; + local p2, p3, p5, p7 := 2, 3, 5, 7; + local last2, last3, last5, last7 := 1, 1, 1, 1; + # 1 is the first humble number ( 2^0 * 3^0 * 5^0 * 7^0 ) and has 1 digit + h[ 1 ], hCount[ 1 ] := 1, 1; + io.write( "1" ); + for n from 2 to maxHumble do + # the next humble number is the lowest of the next multiples of 2, 3, 5, 7 + local constant m := math.min( p2, p3, p5, p7 ); + h[ n ] := m; + if n <= maxShownHumble then io.write( " ", m ) fi; + if m = p2 then last2 +:= 1; p2 := 2 * h[ last2 ] fi; + if m = p3 then last3 +:= 1; p3 := 3 * h[ last3 ] fi; + if m = p5 then last5 +:= 1; p5 := 5 * h[ last5 ] fi; + if m = p7 then last7 +:= 1; p7 := 7 * h[ last7 ] fi; + hCount[ if m < 10 then 1 + elif m < 100 then 2 + elif m < 1_000 then 3 + elif m < 10_000 then 4 + elif m < 100_000 then 5 + elif m < 1_000_000 then 6 + else 0 + fi + ] +:= 1 + od; + print(); + for i to 6 do + printf( "There are %4d Humble numbers with %d digits\n", hCount[ i ], i ) + od +end diff --git a/Task/Humble-numbers/BBC-BASIC/humble-numbers.basic b/Task/Humble-numbers/BBC-BASIC/humble-numbers.basic new file mode 100644 index 0000000000..a9ecf04dbf --- /dev/null +++ b/Task/Humble-numbers/BBC-BASIC/humble-numbers.basic @@ -0,0 +1,30 @@ + MaxDigs%=8 + DIM Humble%(MaxDigs% - 1) + I%=1 + @%=4 + + PRINT "The first 50 humble numbers:" + WHILE TRUE + IF FNIsHumble(I%) THEN + IF C% < 50 PRINT ;I% " "; + C%+=1 + S%=LENSTR$I% + IF S% > MaxDigs% EXIT WHILE + Humble%(S%-1)+=1 + ENDIF + I%+=1 + ENDWHILE + + PRINT ''"Of the first ";C% " humble numbers:" + FOR I%=0 TO MaxDigs% - 1 + PRINT Humble%(I%) " have ";I% + 1 LEFT$(" digits", I% + 6) + NEXT + END + + DEF FNIsHumble(i%) + IF i% <= 1 THEN =TRUE + IF i% MOD 2 == 0 THEN =FNIsHumble(i% / 2) + IF i% MOD 3 == 0 THEN =FNIsHumble(i% / 3) + IF i% MOD 5 == 0 THEN =FNIsHumble(i% / 5) + IF i% MOD 7 == 0 THEN =FNIsHumble(i% / 7) + =FALSE diff --git a/Task/Humble-numbers/Crystal/humble-numbers-1.crystal b/Task/Humble-numbers/Crystal/humble-numbers-1.cr similarity index 100% rename from Task/Humble-numbers/Crystal/humble-numbers-1.crystal rename to Task/Humble-numbers/Crystal/humble-numbers-1.cr diff --git a/Task/Humble-numbers/Crystal/humble-numbers-2.crystal b/Task/Humble-numbers/Crystal/humble-numbers-2.cr similarity index 100% rename from Task/Humble-numbers/Crystal/humble-numbers-2.crystal rename to Task/Humble-numbers/Crystal/humble-numbers-2.cr diff --git a/Task/Humble-numbers/EasyLang/humble-numbers.easy b/Task/Humble-numbers/EasyLang/humble-numbers.easy new file mode 100644 index 0000000000..adc26578a1 --- /dev/null +++ b/Task/Humble-numbers/EasyLang/humble-numbers.easy @@ -0,0 +1,26 @@ +fastfunc humble i . + if i <= 1 : return 1 + if i mod 2 = 0 : return humble (i / 2) + if i mod 3 = 0 : return humble (i / 3) + if i mod 5 = 0 : return humble (i / 5) + if i mod 7 = 0 : return humble (i / 7) + return 0 +. +fastfunc next_humble n . + repeat + n += 1 + until humble n = 1 + . + return n +. +len arr[] 9 +while cnt < 5193 + n = next_humble n + idx = floor (log n 10 + 1) + arr[idx] += 1 + cnt += 1 + if cnt <= 50 : write n & " " +. +print "" +print "" +for i to 9 : print arr[i] & " with " & i & " digits" diff --git a/Task/Humble-numbers/Fortran/humble-numbers.f b/Task/Humble-numbers/Fortran/humble-numbers.f new file mode 100644 index 0000000000..84ed5074c5 --- /dev/null +++ b/Task/Humble-numbers/Fortran/humble-numbers.f @@ -0,0 +1,81 @@ +! Humble Numbers +! tested with GNU Fortran (Ubuntu 14.2.0-19ubuntu2) 14.2.0 on Kubuntu 25.04 +! +! Note that both intel ifx and VSI Fortran do not compile this code because they cannot +! deal with 16-byte-integers. +! +! U.B., July 2025 +! + + +program humbleNumbers + +implicit none + +integer, parameter :: int_kind = 16 ! Fortran compilers other than gfortran can't handle this +integer, parameter :: printLimit = 50 ! need to print first 50 humble numbers + +integer :: max_digits = 38 ! (signed) Integer(kind=16) can carry 38 digits +integer, parameter :: maxhSize=1160000 ! array size for all stored humble numbers +integer (kind=int_kind) :: humble ( maxhSize ) ! the humble numbers +integer :: usedH = 1 ! highest index into humble +integer (kind=int_kind) :: powersOf2=2, powersOf3=3,powersOf5=5,powersOf7=7,currentHumble=2, lim=10 +integer :: i=1, j=1,k=1,m=1,lastCount=0,d=1 + +humble (1) = 1 + +do while (.true.) + + usedH = usedH + 1 + if (usedH .le. maxhSize) then ! B sure we dont crash. + humble (usedH) = currentHumble + else + exit ! otherwise terminate. + endif + + ! construct next humble number as 2^i* 3^j * 5^k * 7^m + ! + ! What comes next? + if (currentHumble .eq. powersOf2) then + i = i + 1 + powersOf2 = humble (i) * 2 + endif + if (currentHumble .eq. powersOf3) then + j = j + 1 + powersOf3 = humble (j) * 3 + endif + if (currentHumble .eq. powersOf5) then + k = k + 1 + powersOf5 = humble (k) * 5 + endif + if (currentHumble .eq. powersOf7) then + m = m + 1 + powersOf7 = humble (m) * 7 + endif + currentHumble = powersOf2 + + ! Select next larger humble number + if (powersOf3=lim) then ! another digit ? + write (6, '(I0, " digits: ", i0)') d, usedH -lastCount + lastCount = usedH + d = d + 1 + + if (d .gt. max_digits) then ! Maximum number of digits reached, terminate. + exit + endif + lim = lim * 10 ! to detect next larger number of digits + endif +enddo + +write (6, '(/"total = ", I0 )') usedH +write (6,'(/"The first " ,I0, " humble numbers are:" )') printLimit +do i=1,printLimit + write (6,'(X, I0)', advance='no') humble (i) +enddo +write (6,*) ! terminate last output line. + +end program humbleNumbers diff --git a/Task/Humble-numbers/Icon/humble-numbers.icon b/Task/Humble-numbers/Icon/humble-numbers.icon new file mode 100644 index 0000000000..9788c9eba9 --- /dev/null +++ b/Task/Humble-numbers/Icon/humble-numbers.icon @@ -0,0 +1,40 @@ +global count + +procedure main(A) + limit1 := \A[1] | 50 + limit2 := \A[2] | 1000 + showcounts(humbles(limit1, limit2)) +end + +procedure humbles(limit1,limit2) + scounts := table(0) + every (count := 0, n := genhumbles()\limit2, count +:= 1, x := *n) do { + if 0 < (limit1 -:= 1) then writes(" ",n) + else if 0 = limit1 then write(" ",n) + scounts[x] +:= 1 + } + return scounts +end + +procedure genhumbles() + suspend 1 + p := [2,3,5,7] + l := [0,0,0,0] + ch := [] + every n := seq() do { + suspend m := min(p[1],p[2],p[3],p[4]) + put(ch, m) + if m = p[1] then p[1] := 2*ch[l[1] +:= 1] + if m = p[2] then p[2] := 3*ch[l[2] +:= 1] + if m = p[3] then p[3] := 5*ch[l[3] +:= 1] + if m = p[4] then p[4] := 7*ch[l[4] +:= 1] + } +end + +procedure showcounts(counts) + write("\nOut of the first ",count," humble numbers:\n") + write(" length ",center("count",16)) + write(" ",repl("-",5)," ",repl("-",16)) + every p := !sort(counts) do + write(right(p[1],7)," ",right(p[2],16)) +end diff --git a/Task/Humble-numbers/Julia/humble-numbers.julia b/Task/Humble-numbers/Julia/humble-numbers.jl similarity index 100% rename from Task/Humble-numbers/Julia/humble-numbers.julia rename to Task/Humble-numbers/Julia/humble-numbers.jl diff --git a/Task/Humble-numbers/Kotlin/humble-numbers.kotlin b/Task/Humble-numbers/Kotlin/humble-numbers.kts similarity index 100% rename from Task/Humble-numbers/Kotlin/humble-numbers.kotlin rename to Task/Humble-numbers/Kotlin/humble-numbers.kts diff --git a/Task/Humble-numbers/Maxima/humble-numbers.maxima b/Task/Humble-numbers/Maxima/humble-numbers.maxima new file mode 100644 index 0000000000..a9f5e2d00a --- /dev/null +++ b/Task/Humble-numbers/Maxima/humble-numbers.maxima @@ -0,0 +1,13 @@ +factors_only: true$ +is_humble(n) := length(sublist(ifactors(n), lambda([x], x>7)))=0$ + +block(count: 0, n: 1, while(count<50) do( + if is_humble(n) then block( + sprint(n), + count: count+1, + if mod(count, 10)=0 then newline() + ), + n: n+1))$ + +humble_digits(n) := length(sublist(makelist(i, i, 10^(n-1), (10^n)-1), is_humble))$ +map(humble_digits, makelist(i, i, 1, 6)); diff --git a/Task/Humble-numbers/PascalABC.NET/humble-numbers.pas b/Task/Humble-numbers/PascalABC.NET/humble-numbers.pas new file mode 100644 index 0000000000..4ea1f2542b --- /dev/null +++ b/Task/Humble-numbers/PascalABC.NET/humble-numbers.pas @@ -0,0 +1,25 @@ +## +function humbles: sequence of uint64; +begin + var s := hset(uint64(1)); + while True do + begin + var m := s.min; + yield m; + s -= m; + foreach var k in |2, 3, 5, 7| do s += k * m; + end; +end; + +println('The first 50 humble numbers are:'); +foreach var n in humbles.Take(50) index i do + write(n:4, if i mod 10 = 9 then #10 else ''); + +println; +println('Digits Count'); +for var dig := 1 to 18 do +begin + var count := humbles.SkipWhile(x -> x < 10 ** (dig - 1)) + .TakeWhile(x -> x < 10 ** dig).Count; + writeln(dig:2, count:10); +end; diff --git a/Task/Humble-numbers/Pluto/humble-numbers.pluto b/Task/Humble-numbers/Pluto/humble-numbers.pluto new file mode 100644 index 0000000000..faca83857a --- /dev/null +++ b/Task/Humble-numbers/Pluto/humble-numbers.pluto @@ -0,0 +1,31 @@ +do -- find some Humble numbers - numbers with no prime factors above 7 + local maxHumble , maxShownHumble = 2048, 50 + local h, hCount = {}, { [0] = 0, 0, 0, 0, 0, 0, 0 } + local p2, p3, p5, p7 = 2, 3, 5, 7 + local last2, last3, last5, last7 = 1, 1, 1, 1 + -- 1 is the first humble number ( 2^0 * 3^0 * 5^0 * 7^0 ) and has 1 digit + h[ 1 ], hCount[ 1 ] = 1, 1 + io.write( "1" ) + for n = 2, maxHumble do + -- the next humble number is the lowest of the next multiples of 2, 3, 5, 7 + local m = math.min( p2, p3, p5, p7 ) + h[ n ] = m + if n <= maxShownHumble then io.write( " ", m ) end + if m == p2 then last2 += 1 p2 = 2 * h[ last2 ] end + if m == p3 then last3 += 1 p3 = 3 * h[ last3 ] end + if m == p5 then last5 += 1 p5 = 5 * h[ last5 ] end + if m == p7 then last7 += 1 p7 = 7 * h[ last7 ] end + hCount[ ( m < 10 ) ? 1 + : ( m < 100 ) ? 2 + : ( m < 1_000 ) ? 3 + : ( m < 10_000 ) ? 4 + : ( m < 100_000 ) ? 5 + : ( m < 1_000_000 ) ? 6 + : 0 + ] += 1 + end + io.write( "\n" ) + for i = 1, 6 do + io.write( string.format( "There are %4d Humble numbers with %d digits\n", hCount[ i ], i ) ) + end +end diff --git a/Task/Humble-numbers/R/humble-numbers.r b/Task/Humble-numbers/R/humble-numbers.r new file mode 100644 index 0000000000..328aa77434 --- /dev/null +++ b/Task/Humble-numbers/R/humble-numbers.r @@ -0,0 +1,16 @@ +next_humble <- function(n) nextn(n, c(2,3,5,7)) +humblenums <- function(n) Reduce(function(x, f) 1+f(x), + rep(list(next_humble),n-1), + init=2, + accumulate=TRUE)-1 + +humblenums(50) + +humble_digits <- function(n){ + digcounts <- rle(floor(log10(humblenums(n))))$lengths + for(i in seq_along(digcounts[-1])){ + cat("There are", digcounts[i], "humble numbers with", i, "digit(s)", "\n") + } +} + +humble_digits(5000) diff --git a/Task/Humble-numbers/REXX/humble-numbers.rexx b/Task/Humble-numbers/REXX/humble-numbers.rexx index c4f9c240cd..3a4ca3c7dd 100644 --- a/Task/Humble-numbers/REXX/humble-numbers.rexx +++ b/Task/Humble-numbers/REXX/humble-numbers.rexx @@ -1,44 +1,46 @@ -/*REXX program computes and displays humble numbers, also will display counts of sizes.*/ -parse arg n m . /*obtain optional arguments from the CL*/ -if n=='' | n=="," then n= 50 /*Not specified? Then use the default.*/ -if m=='' | m=="," then m= 60 /* " " " " " " */ -numeric digits 1 + max(20, m) /*be able to handle some big numbers. */ -$.= 0 /*a count array for X digit humble #s*/ -call humble n; list= /*call HUMBLE sub; initialize the list.*/ - do j=1 for n; list= list @.j /*append a humble number to the list.*/ - end /*j*/ +-- 23 Aug 2025 +include Setting -if list\='' then do; say "A list of the first " n ' humble numbers are:' - say strip(list) /*elide the leading blank in the list. */ - end +say 'HUMBLE NUMBERS' +say version say -call humble -m /*invoke subroutine for counting nums. */ -if $.1==0 then exit /*if no counts, then we're all finished*/ -total= 0 /*initialize count of humble numbers. */ -$.1= $.1 + 1 /*adjust count for absent 1st humble #.*/ -say ' The digit counts of humble numbers:' -say ' ═════════════════════════════════════════' - do c=1 while $.c>0; s= left('s', length($.c)>1) /*count needs pluralization?*/ - say right( commas($.c), 30) ' have ' right(c, 2) " digit"s - total= total + $.c /* ◄─────────────────────────────────┐ */ - end /*k*/ /*bump humble number count (so far)──┘ */ -exit /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -commas: procedure; arg _; do i=length(_)-3 to 1 by -3; _=insert(',', _, i); end; return _ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -humble: procedure expose @. $.; parse arg x; if x==0 then return - y= abs(x); a= y; noCount= x>0; if x<0 then y= 999999999 - #2= 1; #3= 1; #5= 1; #7= 1 /*define the initial humble constants. */ - $.= 0; @.= 0; @.1= 1 /*initialize counts and humble numbers.*/ - do h=2 for y-1 - @.h= min(2*@.#2,3*@.#3,5*@.#5,7*@.#7) /*pick the minimum of 4 humble numbers.*/ - m= @.h /*M: " " " " " " */ - if 2*@.#2 == m then #2 = #2 + 1 /*Is number already defined? Use next #*/ - if 3*@.#3 == m then #3 = #3 + 1 /* " " " " " " "*/ - if 5*@.#5 == m then #5 = #5 + 1 /* " " " " " " "*/ - if 7*@.#7 == m then #7 = #7 + 1 /* " " " " " " "*/ - if noCount then iterate /*Not counting digits? Then iterate. */ - L= length(m); if L>a then leave /*Are we done with counting? Then quit*/ - $.L= $.L + 1 /*bump the digit count for this number.*/ - end /*h*/ /*the humble numbers are in the @ array*/ - return /* " count results " " " $ " */ +call Humbles 50 +call ShowFirstN 50 +call Humbles 10000000 +call ShowDistribution +say Time('e')/1 'seconds' +exit + +ShowFirstN: +procedure expose humb. +arg xx +xx = xx/1 +say 'First' xx 'humble numbers are' +do i = 1 to xx + call Charout ,Right(humb.i,4) + if i//10 = 0 then + say +end +say +return + +ShowDistribution: +procedure expose humb. +say 'Digit distribution for the first' humb.0 'humble numbers' +d. = 0 +do i = 1 to humb.0 + l = Length(humb.i); d.l = d.l + 1; d.0 = Max(l,d.0) +end +l = Copies('-',17) +say l +say 'Dg Count Cum' +say l +c = 0 +do i = 1 to d.0-1 + c = c + d.i + say Right(i,2) Right(d.i,6) Right(c,7) +end +say l +return + +include Math diff --git a/Task/Humble-numbers/Rust/humble-numbers.rs b/Task/Humble-numbers/Rust/humble-numbers.rs new file mode 100644 index 0000000000..839c434188 --- /dev/null +++ b/Task/Humble-numbers/Rust/humble-numbers.rs @@ -0,0 +1,51 @@ +fn num_length( number : u32 ) -> usize { + let numberstring : String = number.to_string( ) ; + let numstr = numberstring.as_str( ) ; + numstr.chars( ).count( ) +} + +fn is_humble( number : u32 ) -> bool { + let result : bool = match number { + num if num <= 1 => true , + num if num % 2 == 0 => is_humble( number / 2 ) , + num if num % 3 == 0 => is_humble( number / 3 ) , + num if num % 4 == 0 => is_humble( number / 4 ) , + num if num % 5 == 0 => is_humble( number / 5 ) , + num if num % 6 == 0 => is_humble( number / 6 ) , + num if num % 7 == 0 => is_humble( number / 7 ) , + _ => false + } ; + result +} + +fn main() { + let mut first_fifty : Vec = Vec::new( ) ; + let mut pairs : Vec<(usize , usize)> = Vec::new( ) ; + let mut oldlength : usize = 0 ; + let mut currentnum : u32 = 1 ; + let mut length : usize = 1 ; + let mut lengthsum : usize = 0 ; + while length < 10 { + if is_humble( currentnum ) { + if first_fifty.len( ) < 50 { + first_fifty.push( currentnum ) ; + } + if length == oldlength { + lengthsum += 1 ; + } + else { + let temp_len : usize = length - 1 ; + pairs.push( (temp_len , lengthsum ) ) ; + lengthsum = 1 ; + oldlength = length ; + } + } + currentnum += 1 ; + length = num_length( currentnum ) ; + } + pairs.push((length - 1 , lengthsum )) ; + println!("{:?}" , first_fifty ) ; + for p in pairs { + println!("length {} with {} humble numbers!" , p.0 , p.1 ) ; + } +} diff --git a/Task/Humble-numbers/V-(Vlang)/humble-numbers.v b/Task/Humble-numbers/V-(Vlang)/humble-numbers.v new file mode 100644 index 0000000000..42182166d6 --- /dev/null +++ b/Task/Humble-numbers/V-(Vlang)/humble-numbers.v @@ -0,0 +1,38 @@ +fn is_humble(i int) bool { + if i <= 1 {return true} + if i % 2 == 0 {return is_humble(i / 2)} + if i % 3 == 0 {return is_humble(i / 3)} + if i % 5 == 0 {return is_humble(i / 5)} + if i % 7 == 0 {return is_humble(i / 7)} + return false +} + +fn main() { + limit := max_i16 + mut humble := map[int]int{} + mut count, mut len, mut total, mut num := 0, 0, 0, 1 + mut str :="" + + for count < limit { + if is_humble(num) == true { + str = num.str() + len = str.len + humble[len]++ + if count < 50 {print("${num} ")} + count++ + } + num++ + } + println("\n") + + println("Of the first ${count} humble numbers:") + num = 1 + for num < humble.len - 1 { + if num in humble { + total = humble[num] + println("${total:5} have ${num:2} digits") + num++ + } + else {break} + } +} diff --git a/Task/Humble-numbers/Wren/humble-numbers.wren b/Task/Humble-numbers/Wren/humble-numbers.wren index bed71678a5..d9ca0da8b1 100644 --- a/Task/Humble-numbers/Wren/humble-numbers.wren +++ b/Task/Humble-numbers/Wren/humble-numbers.wren @@ -1,6 +1,6 @@ -import "/fmt" for Fmt -import "/math" for Int, Nums -import "/sort" for Find +import "./fmt" for Fmt +import "./math" for Nums +import "./sort" for Find var humble = Fn.new { |n| var h = List.filled(n, 0) @@ -40,9 +40,9 @@ var h = humble.call(n) System.print("The first 50 humble numbers are:") System.print(h[0..49]) -var f = Find.all(h, Int.maxSafe) // binary search +var f = Find.all(h, Num.maxSafeInteger) // binary search var maxUsed = f[0] ? f[2].min + 1 : f[2].min -var maxDigits = 16 // Int.maxSafe (2^53 -1) has 16 digits +var maxDigits = 16 // Num.maxSafeInteger (2^53 -1) has 16 digits var counts = List.filled(maxDigits + 1, 0) var digits = 1 var pow10 = 10 diff --git a/Task/Hunt-the-Wumpus/00-TASK.txt b/Task/Hunt-the-Wumpus/00-TASK.txt index d01fe12b94..c59a0f8a9f 100644 --- a/Task/Hunt-the-Wumpus/00-TASK.txt +++ b/Task/Hunt-the-Wumpus/00-TASK.txt @@ -1,5 +1,5 @@ {{Clarify_task}} -Create a simple implementation of the classic textual game [http://en.wikipedia.org/wiki/Hunt_the_Wumpus Hunt The Wumpus]. +Create a simple implementation of the classic textual game [[w:Hunt the Wumpus|Hunt the Wumpus]]. The rules are: diff --git a/Task/Hunt-the-Wumpus/Ada/hunt-the-wumpus-1.ada b/Task/Hunt-the-Wumpus/Ada/hunt-the-wumpus-1.adb similarity index 100% rename from Task/Hunt-the-Wumpus/Ada/hunt-the-wumpus-1.ada rename to Task/Hunt-the-Wumpus/Ada/hunt-the-wumpus-1.adb diff --git a/Task/Hunt-the-Wumpus/Ada/hunt-the-wumpus-2.ada b/Task/Hunt-the-Wumpus/Ada/hunt-the-wumpus-2.adb similarity index 100% rename from Task/Hunt-the-Wumpus/Ada/hunt-the-wumpus-2.ada rename to Task/Hunt-the-Wumpus/Ada/hunt-the-wumpus-2.adb diff --git a/Task/Hunt-the-Wumpus/Ada/hunt-the-wumpus-3.ada b/Task/Hunt-the-Wumpus/Ada/hunt-the-wumpus-3.adb similarity index 100% rename from Task/Hunt-the-Wumpus/Ada/hunt-the-wumpus-3.ada rename to Task/Hunt-the-Wumpus/Ada/hunt-the-wumpus-3.adb diff --git a/Task/Hunt-the-Wumpus/C/hunt-the-wumpus.c b/Task/Hunt-the-Wumpus/C/hunt-the-wumpus.c new file mode 100644 index 0000000000..79b70d3cf7 --- /dev/null +++ b/Task/Hunt-the-Wumpus/C/hunt-the-wumpus.c @@ -0,0 +1,129 @@ +#include +#include +#include + +#define NUM_ROOMS 20 +#define ARROWS 5 + +typedef enum { false, true } bool; + +typedef struct { + int connected[3]; + bool has_wumpus; + bool has_bat; + bool has_pit; +} Room; + +Room cave[NUM_ROOMS + 1]; // Cave rooms are numbered from 1 to 20 + +void initialize_cave() { + int i, j; + // Initialize cave rooms + for (i = 1; i <= NUM_ROOMS; i++) { + for (j = 0; j < 3; j++) { + cave[i].connected[j] = (i + j) % NUM_ROOMS + 1; // Circular connections + } + cave[i].has_wumpus = false; + cave[i].has_bat = false; + cave[i].has_pit = false; + } + // Randomly place wumpus, bats, and pits + cave[rand() % NUM_ROOMS + 1].has_wumpus = true; + for (i = 0; i < 2; i++) { + cave[rand() % NUM_ROOMS + 1].has_bat = true; + cave[rand() % NUM_ROOMS + 1].has_pit = true; + } +} + +void sense(int room) { + printf("You are in room %d.\n", room); + int i, adjacent_room; + for (i = 0; i < 3; i++) { + adjacent_room = cave[room].connected[i]; + if (cave[adjacent_room].has_wumpus) + printf("You smell something terrible nearby.\n"); + if (cave[adjacent_room].has_bat) + printf("You hear a rustling.\n"); + if (cave[adjacent_room].has_pit) + printf("You feel a cold wind blowing from a nearby cavern.\n"); + } +} + +void move(int *room) { + int choice; + printf("Choose an adjacent room to move into: "); + scanf("%d", &choice); + if (choice < 1 || choice > 3) { + printf("Invalid choice. Please choose a number between 1 and 3.\n"); + move(room); + return; + } + *room = cave[*room].connected[choice - 1]; +} + +void shoot(int room, int *arrows, bool *game_over) { + int choice, adjacent_room; + printf("Choose an adjacent room to shoot into: "); + scanf("%d", &choice); + if (choice < 1 || choice > 3) { + printf("Invalid choice. Please choose a number between 1 and 3.\n"); + shoot(room, arrows, game_over); + return; + } + adjacent_room = cave[room].connected[choice - 1]; + if (cave[adjacent_room].has_wumpus) { + printf("Congratulations! You've killed the Wumpus!\n"); + *game_over = true; + return; + } + else { + if (rand() % 4 != 0) { // 75% chance of waking up the wumpus + if (cave[adjacent_room].has_wumpus) { + printf("The Wumpus has woken up and eaten you!\n"); + *game_over = true; + return; + } + } + printf("You missed! The Wumpus is still asleep.\n"); + } + (*arrows)--; +} + +int main() { + srand(time(NULL)); + initialize_cave(); + int current_room = 1; + int arrows = ARROWS; + bool game_over = false; + + printf("Welcome to Hunt the Wumpus!\n"); + + while (!game_over) { + sense(current_room); + printf("Choose your action:\n"); + printf("1. Move to an adjacent room\n"); + printf("2. Shoot into an adjacent room\n"); + + int choice; + printf("Enter your choice (1 or 2): "); + scanf("%d", &choice); + + switch(choice) { + case 1: + move(¤t_room); + break; + case 2: + if (arrows > 0) { + shoot(current_room, &arrows, &game_over); + } else { + printf("You're out of arrows! You lost the game.\n"); + game_over = true; + } + break; + default: + printf("Invalid choice. Please choose 1 or 2.\n"); + } + } + + return 0; +} diff --git a/Task/Hunt-the-Wumpus/EasyLang/hunt-the-wumpus.easy b/Task/Hunt-the-Wumpus/EasyLang/hunt-the-wumpus.easy new file mode 100644 index 0000000000..9fbc981fa3 --- /dev/null +++ b/Task/Hunt-the-Wumpus/EasyLang/hunt-the-wumpus.easy @@ -0,0 +1,92 @@ +exits[][] = [ [ 2 5 8 ] [ 1 3 10 ] [ 2 4 12 ] [ 3 5 14 ] [ 1 4 6 ] [ 5 7 15 ] [ 6 8 17 ] [ 1 7 9 ] [ 8 10 18 ] [ 2 9 11 ] [ 10 12 19 ] [ 2 11 13 ] [ 12 14 20 ] [ 4 13 15 ] [ 6 14 16 ] [ 15 17 20 ] [ 7 16 18 ] [ 9 17 19 ] [ 11 18 20 ] [ 13 16 19 ] ] +len hazard$[] 20 +func emptyRoom . + repeat + room = random 1 20 + until hazard$[room] = "" + . + return room +. +for i to 2 + hazard$[emptyRoom] = "bat" + hazard$[emptyRoom] = "pit" +. +hazard$[emptyRoom] = "wumpus" +# +print "*** HUNT THE WUMPUS ***" +print "-----------------------" +curRoom = emptyRoom +arrows = 5 +func checkWumpus . + if hazard$[curRoom] = "wumpus" + print "You find yourself face to face with the wumpus." + print "It eats you whole." + print "GAME OVER" + return 1 + . +. +repeat + print "You are in room " & curRoom & "." + until checkWumpus = 1 + for r in exits[curRoom][] + if hazard$[r] = "wumpus" : print "You smell something terrible nearby." + if hazard$[r] = "bat" : print "You hear a rustling." + if hazard$[r] = "pit" : print "You feel a cold wind blowing from a nearby cavern." + . + print "Tunnels lead to: " & strjoin exits[curRoom][] ", " + print "You have " & arrows & " arrows." + print "" + repeat + repeat + write "M)ove, S)hoot, or Q)uit? " + in$ = input + print in$ + m$ = substr in$ 1 1 + until m$ = "m" or m$ = "s" or m$ = "q" + . + if m$ = "q" : break 2 + target = number substr in$ 2 99 + if target = 0 + write "Which room? " + target = number input + print target + . + for i to 3 + if exits[curRoom][i] = target : break 1 + . + until i <= 3 + print "Cannot get there from here." + . + if m$ = "m" + curRoom = target + if hazard$[curRoom] = "bat" + print "You have entered the lair of a giant bat." + curRoom = emptyRoom + print "It picks you up and drops you in room " & curRoom & "." + elif hazard$[curRoom] = "pit" + print "The ground gives way beneath your feet." + print "You fall into a deep abyss." + print "GAME OVER" + break 1 + . + else + arrows -= 1 + if hazard$[target] = "wumpus" + print "Congratulations! You shot the wumpus!" + break 1 + . + print "You missed." + if randomf < 0.75 + print "The wumpus wakes from his slumber." + for i to 20 : if hazard$[i] = "wumpus" : hazard$[i] = "" + hazard$[emptyRoom] = "wumpus" + if checkWumpus = 1 : break 1 + . + if arrows = 0 + print "As you grasp at your empty quiver, " + print "you hear a large beast approaching..." + hazard$[curRoom] = "wumpus" + if checkWumpus = 1 : break 1 + . + . +. diff --git a/Task/Hunt-the-Wumpus/FOCAL/hunt-the-wumpus.focal b/Task/Hunt-the-Wumpus/FOCAL/hunt-the-wumpus.focal new file mode 100644 index 0000000000..3308bdd6d1 --- /dev/null +++ b/Task/Hunt-the-Wumpus/FOCAL/hunt-the-wumpus.focal @@ -0,0 +1,213 @@ +1.10 S FOUT(12); C HUNT THE WUMPUS - BY GREGORY YOB, 1973. +1.11 C FOCAL-65 VERSION CONVERTED FROM BASIC SOURCE IN +1.12 C 'CREATIVE COMPUTING' MAGAZINE, SEPT/OCT 1975 +1.20 T %2,!"INSTRUCTIONS (Y-N)? "; S I=FCHR(); T ! +1.30 I (I-78),1.45; +1.40 G 90.1 +1.45 S FRAN(-1); T "SETTING UP CAVE..."! +1.46 C SET UP CAVE (DODECAHEDRAL NODE LIST) +1.47 C FOCAL-65 DOESN'T HAVE DATA/READ STMTS, SO DATA PACKED IN A $ +1.48 C OTHER VERSIONS MAY NEED TO ASSIGN EACH ELEMENT OF S TO S(X) +1.50 S FISL(120,S$); C 60 2-DIG DATA ELEMENTS +1.52 S FODV(S$); C PREPARES S$ FOR INPUT FROM CURRENT OUTPUT DEVICE +1.53 T "020508010310020412030514010406" +1.54 T "050715060817010709081018020911" +1.55 T "101219031113121420041315061416" +1.56 T "151720071618091719111820131619" +1.58 R O; S FIDV(S$),; C RESET OUTPUT DEV., SET S$ AS INPUT DEVICE +1.60 F I=1,60; D 1.8 +1.70 R I; G 2.1 +1.80 S X=FCHR(), X=X-48, S(I)=X*10, X=FCHR(), X=X-48, S(I)=S(I)+X +1.90 R + +2.10 C LOCATE L ARRAY ITEMS: 1-YOU,2-WUMPUS,3&4-PITS,5&6-BATS +2.20 F J=1,6; S L(J)=FINT(FRAN(0)*20)+1, M(J)=L(J) +2.22 C CHECK FOR CROSSOVERS (IE L(1)=L(2), ETC) +2.25 S J=1 +2.27 S K=1 +2.30 I (J-K),2.5; +2.40 I (L(J)-L(K)),2.2; C IF L(J)=L(K), RESET +2.50 S K=K+1; I (K-6)2.52,2.52,2.56 +2.52 G 2.3 +2.56 S J=J+1; I (J-6)2.27,2.27; + +2.60 C SET ARROWS, RUN GAME +2.70 S A=5, L=L(1) + +3.10 T "HUNT THE WUMPUS"! +3.20 C HAZARD WARNINGS & LOCATION +3.30 G 20.1 + +4.05 C MOVE OR SHOOT +4.10 D 25 +4.20 I (I),4.3,4.8 +4.30 G 30.1; C SHOOT +4.50 I (G)5.1,3.3,5.5 +4.80 G 40.1; C MOVE +4.90 I (G),3.3,5.5 + +5.09 C LOSE +5.10 T "HA HA HA - YOU LOSE!"!; G 5.6 +5.40 C WIN +5.50 T "HEE HEE HEE - THE WUMPUS'LL GETCHA NEXT TIME!!"! +5.60 F J=1,6; S L(J)=M(J) +5.70 T "PLAY AGAIN (Y-N)? ";S I=FCHR(); T ! +5.80 I (I-89)7.1,5.9,7.1 +5.90 T "SAME SETUP (Y-N)? ";S I=FCHR(); T !"STAND BY..."! +6.10 I (I-89)2.2,2.7,2,2 + +7.10 Q + +20.05 C - PRINT LOCATION & HAZARD WARNING +20.10 S J=2 +20.12 I (J-7),21.3; +20.20 S K=1 +20.30 S T=(L(1)-1)*3+K +20.40 I (S(T)-L(J))20.9,20.5,20.9 +20.50 I (J-2),20.6; +20.52 I (J-3),20.7; +20.53 I (J-4),20.7; +20.54 I (J-5),20.8; +20.55 I (J-6),20.8; +20.60 T "I SMELL A WUMPUS!"!; G 20.9 +20.70 T "I FEEL A DRAFT."!; G 20.9 +20.80 T "BATS NEARBY!"! +20.90 S K=K+1; I (K-3)20.3,20.3; +20.92 S J=J+1; G 20.12 + +21.30 T "YOU ARE IN ROOM ",L(1),!; S T=(L(1)-1)*3 +21.40 T "TUNNELS LEAD TO ",S(T+1)," ",S(T+2)," ",S(T+3) +21.50 T !! +21.60 G 4.1 + +25.05 C - CHOOSE OPTION *** +25.10 T "SHOOT OR MOVE (S-M)? " +25.20 S I=FCHR(); T !; I (I-77),25.4; +25.30 I (I-83)25.1,25.5,25.1 +25.40 S I=1; R +25.50 S I=0; R + +30.01 C - ARROW ROUTINE +30.10 S G=0 +30.20 C - PATH OF ARROW +30.30 S L=L(1) +30.40 T "NO. OF ROOMS (1-5)? "; A J7 +30.50 I (J7-1)30.4; +30.60 I (J7-5),,30.4 +30.70 S K=1 +30.80 T "ROOM #? "; A P(K) +30.90 I (K-2)31.15,31.15; +31.05 I (P(K)-P(K-2))31.15,,31.15 +31.10 T ""ARROWS AREN'T THAT CROOKED - TRY ANOTHER ROOM."!; G 30.8 +31.15 S K=K+1; I (K-J7)30.8,30.8; + +31.20 C - SHOOT ARROW +31.30 C S L=L(1) <- NOT IN 'MORE BASIC COMP GMS' +31.40 S K=1 +31.50 S K1=1 +31.60 S T=((L-1)*3)+K1; I (S(T)-P(K)),32.95; +31.70 S K1=K1+1; I (K1-3)31.6,31.6; +31.80 C - NO TUNNEL FOR ARROW +31.90 S T=FINT(FRAN(0)*3)+1, L=S(((L-1)*3)+T) +32.01 G 33.1 +32.10 S K=K+1; I (K-J7)31.5,31.5; +32.20 T "MISSED."!; S L=L(1) +32.30 C - MOVE WUMPUS +32.40 S B=-1; G 33.7; C D 33.7 +32.50 C - AMMO CHECK +32.60 S A=A-1; I (A),,32.8 +32.70 S G=-1 +32.80 G 4.5 + +32.90 C - SEE IF ARROW IS AT L(1) OR AT L(2) +32.95 S L=P(K) +33.10 I (L-L(2))33.4,,33.4 +33.15 T "AHA! YOU GOT THE WUMPUS!"! +33.20 S G=1; G 4.5 +33.40 I (L-L(1))32.1,,32.1 +33.50 T "OUCH! ARROW GOT YOU!"!; G 32.7 + +33.70 C - MOVE WUMPUS ROUTINE +33.72 S K=FINT(FRAN(0)*4)+1 +33.74 I (K-4),33.78 +33.76 S T=((L(2)-1)*3)+K, L(2)=S(T) +33.78 I (L(2)-L)33.9,,33.9 +33.80 T "TSK TSK TSK - WUMPUS GOT YOU!"! +33.85 S G=-1 +33.90 I (B)32.6,41.9; + +40.01 C - MOVE ROUTINE +40.10 S G=0 +40.20 T "WHERE TO? "; A L +40.30 I (L-1)40.2; +40.40 I (L-20),,40.2 +40.50 C - CHECK IF LEGAL MOVE +40.60 S K=1 +40.70 S T=L(1)-1, T=T*3+K +40.75 I (S(T)-L),41.3; +40.80 S K=K+1; I (K-3)40.7,40.7; +40.90 I (L-L(1)),41.3; +41.10 T "NOT POSSIBLE - " +41.15 G 40.2 +41.20 C - CHECK FOR HAZARDS +41.30 S L(1)=L +41.40 C - WUMPUS *** +41.50 I (L-L(2))42.15,,42.15 +41.60 T "... OOPS! BUMPED A WUMPUS!"! +41.70 C - MOVE WUMPUS +41.80 S B=0; G 33.7; C D 33.7 +41.90 I (G),42.2; +42.10 C - PIT +42.15 I (L-L(3))42.2,42.3,42.2 +42.20 I (L-L(4))42.7,42.3,42.7 +42.30 T "YYYYIIIIEEEE . . . FELL IN PIT!"! +42.40 S G=-1; G 4.9 +42.60 C - BATS +42.70 I (L-L(5))42.75,42.8,42.75 +42.75 I (L-L(6))43.1,42.8,43.1 +42.80 T "ZAP--SUPER BAT SNATCH! ELSEWHEREVILLE FOR YOU!"! +42.90 S L=FINT(FRAN(0)*20)+1 +43.05 G 41.3 +43.10 G 4.9 + +50.10 Q + +90.05 C - INSTRUCTIONS +90.10 T "WELCOME TO 'HUNT THE WUMPUS'"! +90.20 T " THE WUMPUS LIVES IN A CAVE OF 20 ROOMS. EACH ROOM"! +90.30 T "HAS 3 TUNNELS LEADING TO OTHER ROOMS. (LOOK AT A"! +90.40 T "DODECAHEDRON TO SEE HOW THIS WORKS-IF YOU DON'T KNOW"! +90.50 T "WHAT A DODECAHEDRON IS, ASK SOMEONE)"!! +90.70 T " HAZARDS:"! +90.80 T " BOTTOMLESS PITS - TWO ROOMS HAVE BOTTOMLESS PITS IN THEM."! +90.90 T " IF YOU GO THERE, YOU FALL INTO THE PIT (& LOSE!)."! +90.95 T " SUPER BATS - TWO OTHER ROOMS HAVE SUPER BATS. IF YOU"! +91.10 T " GO THERE, A BAT GRABS YOU AND TAKES YOU TO SOME OTHER"! +91.20 T " ROOM AT RANDOM (WHICH MAY BE TROUBLESOME)."!! +91.40 T " WUMPUS:"! +91.50 T " THE WUMPUS IS NOT BOTHERED BY HAZARDS (HE HAS SUCKER"! +91.60 T " FEET AND IS TOO BIG FOR A BAT TO LIFT). USUALLY"! +91.70 T " HE IS ASLEEP. TWO THINGS WAKE HIM UP: YOU ENTERING HIS"! +91.80 T " ROOM OR YOU SHOOTING AN ARROW."! +91.90 T " IF THE WUMPUS WAKES, HE MOVES (P=.75) ONE ROOM"! +92.10 T " OR STAYS STILL (P=.25). AFTER THAT, IF HE IS WHERE YOU"! +92.20 T " ARE, HE EATS YOU UP AND YOU LOSE!"!! +92.25 T "(PRESS ANY KEY TO CONTINUE)"; S Z=FCHR(); T !! +92.30 T " YOU:"! +92.40 T " EACH TURN YOU MAY MOVE OR SHOOT A CROOKED ARROW."! +92.50 T " MOVING: YOU CAN MOVE ONE ROOM (THRU ONE TUNNEL)."! +92.60 T " ARROWS: YOU HAVE 5 ARROWS. YOU LOSE WHEN YOU RUN OUT."! +92.70 T " EACH ARROW CAN GO FROM 1 TO 5 ROOMS. YOU AIM BY TELLING"! +92.80 T " THE COMPUTER THE ROOM #S YOU WANT THE ARROW TO GO TO."! +92.90 T " IF THE ARROW CAN'T GO THAT WAY (IF NO TUNNEL) IT MOVES"! +93.10 T " AT RANDOM TO THE NEXT ROOM."! +93.20 T " IF THE ARROW HITS THE WUMPUS, YOU WIN."! +93.30 T " IF THE ARROW HITS YOU, YOU LOSE."!! +93.40 T " WARNINGS:"! +93.50 T " WHEN YOU ARE ONE ROOM AWAY FROM A WUMPUS OR HAZARD,"! +93.60 T " THE COMPUTER SAYS:"! +93.70 T " WUMPUS: 'I SMELL A WUMPUS'"! +93.80 T " BAT : 'BATS NEARBY'"! +93.90 T " PIT : 'I FEEL A DRAFT'"!! +94.05 T "(PRESS ANY KEY TO BEGIN)"; S Z=FCHR(); T !! +94.10 G 1.45 diff --git a/Task/Hunt-the-Wumpus/Forth/hunt-the-wumpus.fth b/Task/Hunt-the-Wumpus/Forth/hunt-the-wumpus.fth new file mode 100644 index 0000000000..77842adb0d --- /dev/null +++ b/Task/Hunt-the-Wumpus/Forth/hunt-the-wumpus.fth @@ -0,0 +1,733 @@ +\ Hunt the Wumpus - FORTH - v 1.00 + +: wumpus-version ( -- ) + ." Version 1.00 - FORTH " + ; + +[DEFINED] UTIME [IF] ( -- Dusec ) + : MS@ UTIME DROP ; \ gforth +[ELSE] +[DEFINED] counter [IF] + : MS@ counter ; \ SwiftForth +[THEN] [THEN] + +include random.fs \ defines random ( n -- 0..n-1 ) + +\ Initialize random seed from a +\ value that changes with time +MS@ SEED ! + +\ +\ The cave: 20 rooms, each connected to 3 others, +\ as a dodecahedron +\ +20 CONSTANT COUNT-ROOMS + 3 CONSTANT COUNT-NEIGHBORS +CREATE CAVE \ adjacency list + 5 C, 8 C, 2 C, \ ROOM 1 + 1 C, 10 C, 3 C, \ ROOM 2 + 2 C, 12 C, 4 C, \ ROOM 3 + 3 C, 14 C, 5 C, \ ROOM 4 + 4 C, 6 C, 1 C, \ ROOM 5 + 15 C, 5 C, 7 C, \ ROOM 6 + 6 C, 17 C, 8 C, \ ROOM 7 + 7 C, 1 C, 9 C, \ ROOM 8 + 8 C, 18 C, 10 C, \ ROOM 9 + 9 C, 2 C, 11 C, \ ROOM 10 + 10 C, 19 C, 12 C, \ ROOM 11 + 11 C, 3 C, 13 C, \ ROOM 12 + 12 C, 20 C, 14 C, \ ROOM 13 + 13 C, 4 C, 15 C, \ ROOM 14 + 14 C, 16 C, 6 C, \ ROOM 15 + 20 C, 15 C, 17 C, \ ROOM 16 + 16 C, 7 C, 18 C, \ ROOM 17 + 17 C, 9 C, 19 C, \ ROOM 18 + 18 C, 11 C, 20 C, \ ROOM 19 + 19 C, 13 C, 16 C, \ ROOM 20 + +\ Game state +CREATE HUNTER 1 CHARS ALLOT \ Player location +CREATE WUMPUS 1 CHARS ALLOT \ Wumpus location +CREATE PITS 2 CHARS ALLOT \ Rooms with pits +CREATE BATS 2 CHARS ALLOT \ Rooms with bats + +CREATE ARROWS 1 CHARS ALLOT \ Crooked arrows left +CREATE PLAYER 1 CHARS ALLOT \ IN-PLAY, WON, LOST + +\ Keep track of whether bats snatched the Hunter +\ TRUE if bats moved player +CREATE BATS-MOVED-HUNTER 1 CELLS ALLOT + +\ Arrow path +CREATE ARROW-PATH-LENGTH 1 CHARS ALLOT +CREATE ARROW-PATH-ROOMS 5 CHARS ALLOT + +\ Initial room assignments in order: +\ Hunter, Wumpus, pits, bats +CREATE INITIAL-ROOMS 6 CHARS ALLOT + +\ Scratch area for generating a random shuffle +\ of the 20 room numbers +CREATE ROOM-NUMBERS COUNT-ROOMS CHARS ALLOT + +\ Player states +0 CONSTANT IN-PLAY +1 CONSTANT WON +2 CONSTANT LOST + +\ Quit, or play again with new or same initial state +0 CONSTANT QUIT-GAME +1 CONSTANT SAME-ROOMS +2 CONSTANT NEW-ROOMS + +\ A pointer to a prompt string +CREATE PROMPT-STRING 2 CELLS ALLOT + +\ An 8-character buffer for prompt answers +8 CONSTANT MAX-ANSWER-LENGTH +CREATE PROMPT-ANSWER MAX-ANSWER-LENGTH CHARS ALLOT + +\ Responses to a yes-no question +CHAR y CONSTANT YES +CHAR n CONSTANT NO + +\ Responses to a command prompt +CHAR w CONSTANT WHERE-AM-I? +CHAR m CONSTANT MOVE-ME +CHAR s CONSTANT SHOOT +\ - undocumented - +CHAR g CONSTANT GAME-STATE \ show the game state +CHAR c CONSTANT CAVE-ROOMS \ show all the cave rooms + +ALIGN \ Align to next slot boundary + +\ +\ The Cave +\ room-number in 1..20 +\ WARNING: These cave referencing words +\ don't validate room numbers!!! +\ + +\ Determine if a room number is in the cave +: ?cave-room-number-valid ( room-number -- flag ) + DUP 0 < SWAP COUNT-ROOMS > OR INVERT + ; + +\ Get a pointer to a room +: cave-room-address ( room-number -- room-address ) + 1- COUNT-NEIGHBORS * CHARS CAVE + + ; + +\ Get the room number of a neighbor +: cave-room-neighbor ( index room-number -- room-number ) + cave-room-address SWAP CHARS + C@ + ; + +\ Get a list of a room's neighbors +: cave-room-neighbors ( room-number -- n_1 n_2 n_3 ) + DUP cave-room-address C@ SWAP + DUP cave-room-address CHAR+ C@ SWAP + cave-room-address 2 CHARS + C@ + ; + +\ Determine if a room is a neighbor +: ?cave-room-reachable ( to from -- flag ) + cave-room-neighbors FALSE + 4 PICK 4 PICK = OR + 4 PICK 3 PICK = OR + 4 PICK 2 PICK = OR + SWAP DROP SWAP DROP SWAP DROP SWAP DROP + ; + +\ Does this room have the Hunter in it? +: ?cave-room-has-hunter ( room-number -- flag ) + HUNTER C@ = + ; + +\ Does this room have the Wumpus in it? +: ?cave-room-has-wumpus ( room-number -- flag ) + WUMPUS C@ = + ; + +\ Does this room have a bottomless pit in it? +: ?cave-room-has-pit ( room-number -- flag ) + DUP PITS C@ = SWAP PITS CHAR+ C@ = OR + ; + +\ Does this room have super bats in it? +: ?cave-room-has-bats ( room-number -- flag ) + DUP BATS C@ = SWAP BATS CHAR+ C@ = OR + ; + +\ +\ Room number selection - for initial room assignments +\ +\ This is a variant of the +\ Fisher-Yates shuffle (a.k.a. the Knuth shuffle), +\ starting from the beginning of the rooms list, +\ and selecting only as many rooms as needed. +\ + +\ Fill room numbers with the sequence 1..20 +: reset-room-numbers ( -- ) + COUNT-ROOMS 0 DO I CHARS ROOM-NUMBERS + I 1+ SWAP C! LOOP + ; + +\ Display the room numbers +: show-room-numbers ( -- ) + COUNT-ROOMS 0 DO I CHARS ROOM-NUMBERS + C@ . LOOP + ; + +\ Choose a room in i..19 (yes, it could be i) +: choose-room-in-tail ( i -- r ) + DUP COUNT-ROOMS 1- SWAP - \ max-index-within-tail + 1+ random + \ r + ; + +\ Swap ith (i in 0..19) room with a room in i..19 +: swap-random-in-tail ( i -- ) + DUP ROOM-NUMBERS CHARS + C@ SWAP \ -- Ni i + DUP choose-room-in-tail TUCK \ -- Ni r i r + ROOM-NUMBERS CHARS + C@ SWAP \ -- Ni r Nr i + ROOM-NUMBERS CHARS + C! \ -- Ni r + ROOM-NUMBERS CHARS + C! + ; + +\ Select n <= 20 rooms at random +: select-random-rooms ( n -- random-rooms ) + DUP COUNT-ROOMS > IF + CR . ABORT" Can't select more than 20 rooms " + THEN + reset-room-numbers + 0 DO + I swap-random-in-tail + \ CR I . ." : " show-room-numbers + LOOP + ; + +\ Create and save a new room configuration +: create-new-room-assignments ( -- ) + 6 select-random-rooms + ROOM-NUMBERS INITIAL-ROOMS 6 CMOVE + ; + +\ +\ Player dialogue +\ + +\ Show the game state +: show-game-state ( -- ) + CR ." HUNTER: " HUNTER C@ . + CR ." WUMPUS: " WUMPUS C@ . + CR ." PITS: " PITS C@ . PITS CHAR+ C@ . + CR ." BATS: " BATS C@ . BATS CHAR+ C@ . + CR ." ARROWS: " ARROWS C@ . + CR ." PLAYER: " PLAYER C@ + CASE + LOST OF ." LOST " ENDOF + IN-PLAY OF ." IN-PLAY " ENDOF + WON OF ." WON " ENDOF + DUP CR . ." unexpected PLAYER state " + ENDCASE + ; + +\ List the neighboring rooms +: list-neighbors ( room-number -- ) + cave-room-neighbors + . . . + ; + +\ Show a list of all the cave's rooms +: show-cave-rooms ( -- ) + COUNT-ROOMS 0 DO + I 1+ DUP CR . ." : " list-neighbors + LOOP + ; + +\ Accept an answer from the player +: input-answer ( max-length -- length ; chars in PROMPT-ANSWER ) + MAX-ANSWER-LENGTH MIN \ Limit input to buffer length + BEGIN + CR ." > " + DUP PROMPT-ANSWER SWAP ACCEPT + DUP 0 > DUP INVERT IF + CR ." Huh? " + SWAP DROP \ Forget zero length + THEN + UNTIL \ Try again if no characters entered + SWAP DROP \ Forget max input length + ; + +\ Input one lowercase ASCII character from the player +: input-ascii-lowercase ( -- answer ) + 1 input-answer DROP \ Forget length + \ Convert ASCII alpha to lowercase; others don't care + PROMPT-ANSWER C@ 32 OR PROMPT-ANSWER C! + PROMPT-ANSWER C@ + ; + +\ Accept a numeric answer from the player +: input-number ( -- number ) + BEGIN + 2 input-answer PROMPT-ANSWER SWAP \ -- answer-address length + \ try to convert the answer into a number + 0 0 2SWAP >NUMBER \ -- n 0 remnant-address remnant-length + 0= DUP INVERT IF \ -- n 0 remnant-address flag + CR ." That is not a number. " + 2SWAP 2DROP \ Forget invalid answer + SWAP DROP \ Forget remnant-address, leaving FALSE + ELSE \ Entire answer was converted to a number + SWAP DROP \ Forget remnant-address + SWAP DROP \ Forget high-order zero of number in 0..99 + THEN + UNTIL \ Try again if answer was invalid + ; + +\ Ask a yes-no question, don't accept anything else +: prompt-yes-no ( question -- YES | NO ) + PROMPT-STRING 2! + BEGIN + CR PROMPT-STRING 2@ TYPE ." (y|n)? " + input-ascii-lowercase + DUP YES = OVER NO = OR + DUP INVERT IF + CR ." Huh? " + SWAP DROP \ Forget invalid answer + THEN + UNTIL \ Try again if answer was invalid + ; + +\ Show the stored crooked arrow path +: show-arrow-path ( -- ) + CR ." ARROW PATH - " + ARROW-PATH-LENGTH C@ DUP . ." : " 0 DO + ARROW-PATH-ROOMS I CHARS + C@ . + LOOP + ; + +\ Prompt for path length when shooting a crooked arrow +: prompt-arrow-path-length ( -- 1..5 ) + BEGIN + CR ." How many rooms should the arrow traverse (1..5)? " + input-number + DUP 1 < OVER 5 > OR + DUP IF + CR ." Huh? " + SWAP DROP \ Forget invalid answer + THEN + INVERT + UNTIL \ Try again if room count was invalid + ; + +\ Get room number arrow can't go back to +: arrow-path-backtrack-room ( index -- invalid-room ) + \ The arrow is not so crooked that it + \ can go out the tunnel it came in through. + DUP 1 > IF + \ Path has more than one room already; + \ the arrow can't go back to the room + \ before the last one entered. + 2 - CHARS ARROW-PATH-ROOMS + C@ + ELSE + 1 = IF + \ Path has exactly one room so far; the arrow + \ can't go back to the room the Hunter is in. + HUNTER C@ + ELSE + \ This is to be the first room in the path; + \ the arrow can be sent anywhere, + \ including the room the Hunter is in. + 0 \ Zero won't match any room. + THEN + THEN + ; + +\ Prompt for the next room in the arrow's path +: prompt-arrow-path-room ( index -- room ) + BEGIN + CR ." Enter room " DUP 1+ . + input-number \ -- index room + OVER arrow-path-backtrack-room \ -- index room invalid-room + OVER = DUP IF \ -- index room flag + CR ." Huh, arrows aren't that crooked! " + SWAP DROP \ Forget chosen room + ELSE + ROT DROP \ Forget the index + THEN \ -- index TRUE | room FALSE + INVERT + UNTIL \ Try again if room was invalid + ; + +\ Prompt for the arrow's path when shooting a crooked arrow +: prompt-arrow-path ( -- ; sets arrow path length and rooms ) + prompt-arrow-path-length + DUP ARROW-PATH-LENGTH C! 0 DO + I prompt-arrow-path-room + ARROW-PATH-ROOMS I CHARS + C! + LOOP + ; + +\ Prompt for a command +: prompt-command ( -- MOVE-ME | SHOOT | WHERE-AM-I? ) + BEGIN + CR ." What do you want to do " + ." (m=move, s=shoot, w=where am I?)? " + input-ascii-lowercase + DUP MOVE-ME = OVER SHOOT = OR + OVER WHERE-AM-I? = OR + \ - undocumented - + OVER GAME-STATE = OR + OVER CAVE-ROOMS = OR + DUP INVERT IF + CR ." Huh? " + SWAP DROP \ Forget invalid answer + THEN + UNTIL \ Try again if command was invalid + ; + +\ Prompt to play again, with same or new room assignments +: prompt-play-again ( -- QUIT-GAME | SAME-ROOMS | NEW-ROOMS ) + s" Play again " prompt-yes-no + YES = IF + CR ." OK, play again ... " + s" Same rooms " prompt-yes-no + YES = IF + CR ." OK, you, the Wumpus, pits, and bats in the same rooms. " + SAME-ROOMS + ELSE + CR ." OK, you, the Wumpus, pits, and bats in new rooms (probably). " + NEW-ROOMS + THEN + ELSE + CR ." Bye " + QUIT-GAME + THEN + ; + +\ Display congratulations or condolences +: show-result ( WON | LOST -- ) + DUP WON = IF + CR ." Congratulations! You got the Wumpus! But next time, hee, hee, hee!" + DROP + ELSE + DUP LOST = IF + CR ." Condolences, maybe better luck next time." + DROP + ELSE + CR . ." unknown game result." + THEN + THEN + ; + +\ Get a new room for the player +: prompt-new-hunter-room ( -- room ) + BEGIN + CR ." Where do you want to go? " + input-number + DUP ?cave-room-has-hunter IF + CR ." You are already in room " . ." ... " + DROP \ Forget room Hunter already in + FALSE \ answer not valid, try again + ELSE + DUP HUNTER C@ ?cave-room-reachable + DUP INVERT IF + CR ." Can't get there from here. " + SWAP DROP \ Forget unreachable room + THEN + THEN + UNTIL \ Try again if room was invalid + ; + +\ Display instructions +: show-instructions ( -- ) + CR ." ---- INSTRUCTIONS ---- " + CR + CR ." Welcome to Hunt the Wumpus! You are a hunter, looking to bag a Wumpus. " + CR + CR ." The Wumpus lives in a cave of twenty rooms, each connected by " + CR ." tunnels to three other rooms, as in a dodecahedron. " + CR + CR ." There are HAZARDS!! " + CR + CR ." The Wumpus - One room has the Wumpus in it. If the Wumpus " + CR ." finds you in the room with it, it will eat you and you lose. " + CR + CR ." Bottomless Pits - Two rooms have bottomless pits in them. " + CR ." If you go there, you fall into the pit and lose. " + CR + CR ." Super Bats - Two other rooms have super bats in them. " + CR ." If you go there, a bat grabs you and takes you to another " + CR ." room, at random. This might be troublesome. " + CR + CR ." As you are hunting, you will be able to sense something of " + CR ." the hazards, when you are in a room adjacent to one. " + CR + CR ." - You can smell the Wumpus, when it is nearby. " + CR ." - You can feel a breeze, when there is a pit nearby " + CR ." - You can hear a rustling sound, when there are bats nearby. " + CR + CR ." The Wumpus is not bothered by the hazards. It has sucker " + CR ." feet, so can cling to the walls of a pit, and is too heavy " + CR ." for the super bats to lift. Usually, it is asleep. " + CR + CR ." Two things wake up the Wumpus: you entering its room, or " + CR ." you shooting an arrow (anywhere in the cave!). When it " + CR ." wakes, it moves into an adjacent room (P=3/4) or stays " + CR ." where it is (P=1/4). After that, if it is where you are " + CR ." it eats you and you lose. " + CR + CR ." The computer starts you in a randomly chosen room. " + CR ." Each turn you can move to an adjacent room or shoot an arrow. " + CR + CR ." You are furnished with 5 crooked arrows, which you can program " + CR ." to go into 1 to 5 rooms. Starting from the room you are in, " + CR ." the arrow will go from room to room provided there is a tunnel " + CR ." from where it is to the next room on its list. If there is no " + CR ." tunnel, the arrow bounces on the walls of the cave and moves into " + CR ." an adjacent room at random, possibly the one you are in. " + CR + CR ." - If the arrow hits the Wumpus, you win. " + CR ." - If the arrow hits you, you lose. " + CR ." - If you run out of arrows, you lose. " + CR + CR ." When the game is over, you can start a new game. " + CR ." You can choose to start over with the same configuration " + CR ." as the game you just finished, that is: with you, the Wumpus, " + CR ." the pits, and the bats where they started in the game you " + CR ." just finished; or you can start fresh, with everything in " + CR ." new places (well, probably). In any case, you get a fresh " + CR ." supply of five arrows. " + CR + CR ." Good luck! " + ; + +\ Display instructions if wanted +: show-instructions-if-wanted ( -- ) + s" Show instructions " prompt-yes-no + YES = IF + show-instructions + THEN + ; + +\ Display a greeting +: show-greeting ( -- ) + CR ." ---- ---- Hunt the Wumpus ---- ---- " + CR ." - " wumpus-version + CR ." ---- ---- --------------- ---- ---- " + ; + +\ +\ Game play +\ + +\ List any hazards in a room +: hazards-in-room ( room-number -- ) + DUP ?cave-room-has-wumpus IF + CR ." I smell a Wumpus!" + THEN + DUP ?cave-room-has-pit IF + CR ." I feel a draft!" + THEN + DUP ?cave-room-has-bats IF + CR ." I hear a rustling sound!" + THEN + DROP \ Forget room number + ; + +\ Warn of any hazards in the neighboring rooms +: warn-of-hazards ( room-number -- ) + cave-room-neighbors + hazards-in-room + hazards-in-room + hazards-in-room + ; + +\ Describe the Hunter's location +: describe-hunter-location ( -- ) + HUNTER C@ + CR ." You are in room " DUP . + CR ." Tunnels lead to rooms " DUP list-neighbors + warn-of-hazards + ; + +\ The Wumpus eats the Hunter if in the same room +: wumpus-ate-hunter? ( -- ; may set player state to LOST ) + HUNTER C@ ?cave-room-has-wumpus IF + CR ." Aaaaggghhh! The Wumpus got you! You lose! " + LOST PLAYER C! + ELSE + CR ." Phew! The Wumpus didn't get you. " + THEN + ; + +\ Move the Wumpus - did it get the Hunter? +: move-wumpus ( -- ; may set player state to LOST ) + CR ." Uh oh! You disturbed the Wumpus! " + 4 random DUP 3 < IF + WUMPUS C@ cave-room-neighbor WUMPUS C! + ELSE + DROP \ Forget index indicating Wumpus didn't move + THEN + wumpus-ate-hunter? \ may set player state to LOST + ; + +\ Did the crooked arrow hit the Wumpus? +: arrow-hit-wumpus? ( room -- flag ; may set player state to WON ) + ?cave-room-has-wumpus DUP IF + CR ." Aha! You got the Wumpus! " + WON PLAYER C! + THEN + ; + +\ Did the crooked arrow hit the Hunter? +: arrow-hit-hunter? ( room -- flag ; may set player state to LOST ) + ?cave-room-has-hunter DUP IF + CR ." Ouch! Arrow got you! You lose!" + LOST PLAYER C! + THEN + ; + +\ Did the Hunter run out of crooked arrows? +: arrows-all-gone? ( -- ; may set player state to LOST ) + ARROWS C@ 1- DUP ARROWS C! 0 = IF + CR ." You're out of arrows, you lose! " + LOST PLAYER C! + THEN + ; + +\ Fly a crooked arrow +: fly-arrow ( -- ; may set player state to WON or LOST ) + HUNTER C@ \ arrow starts where player is + DUP CR . + ARROW-PATH-LENGTH C@ 0 DO + ." --> " + ARROW-PATH-ROOMS I CHARS + C@ \ Rf -- Rf Rt + 2DUP SWAP ?cave-room-reachable IF + SWAP DROP \ Rf Rt -- Rt ; Arrow now in next room in path + ELSE + DROP \ Rf Rt -- Rf ; Forget the unreachable room + CR ." Uh oh! You hit the cave wall, arrow gone astray! " + \ Arrow enters one of the adjoining rooms + cave-room-address 3 random CHARS + C@ \ Rf -- Rt + THEN + DUP . + \ OK, what happens when the arrow reaches this room? + DUP arrow-hit-hunter? OVER arrow-hit-wumpus? OR IF + LEAVE \ That's the end of the arrow's flight + THEN + LOOP + DROP \ Forget the last room the arrow went into + ; + +\ Shoot a crooked arrow +: shoot-arrow ( -- ) + prompt-arrow-path + show-arrow-path + fly-arrow \ may set player state to WON or LOST + PLAYER C@ IN-PLAY = IF + \ The arrow didn't hit anything + CR ." You missed! " + \ Shooting an arrow always disturbs the Wumpus + move-wumpus \ may set player state to LOST + arrows-all-gone? \ may set player state to LOST + THEN + ; + +\ Hunter went into a room with super bats? +: entered-room-with-bats? ( -- flag ) + HUNTER C@ ?cave-room-has-bats DUP IF + CR ." Oh oh oh! A bat's got you! Oh ohhh ... " + COUNT-ROOMS random 1+ DUP HUNTER C! + CR ." You are now in room " . + THEN + \ Return TRUE if a super bat moved the Hunter + ; + +\ Hunter went into a room with a bottomless pit? +: entered-room-with-pit? ( -- ; may set player state to LOST ) + HUNTER C@ ?cave-room-has-pit IF + CR ." Aaaaggghhh! You fell in a pit! You lose! " + LOST PLAYER C! + THEN + ; + +\ Hunter went into a room with the Wumpus? +: entered-room-with-wumpus? ( -- ; may set player state to LOST ) + HUNTER C@ ?cave-room-has-wumpus IF + move-wumpus \ may set player state to LOST + THEN + ; + +\ Move the Hunter to a new room +: move-hunter ( -- ; may set player state to LOST ) + prompt-new-hunter-room HUNTER C! + BEGIN + FALSE BATS-MOVED-HUNTER ! + entered-room-with-wumpus? \ may set player state to LOST + PLAYER C@ IN-PLAY = IF + entered-room-with-pit? \ may set player state to LOST + PLAYER C@ IN-PLAY = IF + entered-room-with-bats? BATS-MOVED-HUNTER ! + THEN + THEN + BATS-MOVED-HUNTER @ INVERT + UNTIL \ repeat if the bats moved the Hunter + PLAYER C@ IN-PLAY = IF + \ Nothing too bad happened, let's take a moment + \ to take in our surroundings + describe-hunter-location + THEN + ; + +\ Play the game until won or lost +: play ( -- WON | LOST ) + BEGIN PLAYER C@ IN-PLAY = WHILE + prompt-command \ -- MOVE-ME | SHOOT | WHERE-AM-I? + CASE + MOVE-ME OF move-hunter ENDOF + SHOOT OF shoot-arrow ENDOF + WHERE-AM-I? OF describe-hunter-location ENDOF + \ - undocumented - + GAME-STATE OF show-game-state ENDOF + CAVE-ROOMS OF show-cave-rooms ENDOF + CR . ." unexpected command." + ENDCASE + REPEAT + PLAYER C@ + ; + +\ Set the room configuration to the saved one +: set-rooms-to-initial-assignments ( -- ) + INITIAL-ROOMS C@ HUNTER C! + INITIAL-ROOMS CHAR+ C@ WUMPUS C! + INITIAL-ROOMS 2 CHARS + C@ PITS C! + INITIAL-ROOMS 3 CHARS + C@ PITS CHAR+ C! + INITIAL-ROOMS 4 CHARS + C@ BATS C! + INITIAL-ROOMS 5 CHARS + C@ BATS CHAR+ C! + ; + +\ Reset the state for a new game +: new-game ( SAME-ROOMS | NEW-ROOMS -- ) + NEW-ROOMS = IF + create-new-room-assignments + THEN + set-rooms-to-initial-assignments + 5 ARROWS C! + IN-PLAY PLAYER C! + ; + +\ Greet the player, play, then prompt for a new game +: Hunt-the-Wumpus ( -- ) + show-greeting + show-instructions-if-wanted + NEW-ROOMS + BEGIN + new-game \ SAME-ROOMS | NEW-ROOMS -- + describe-hunter-location \ -- + play \ -- WON | LOST + show-result \ WON | LOST -- + prompt-play-again \ -- QUIT-GAME | SAME-ROOMS | NEW-ROOMS + DUP QUIT-GAME = + UNTIL + DROP \ Forget the QUIT-GAME indicator + ; diff --git a/Task/Hunt-the-Wumpus/FutureBasic/hunt-the-wumpus.basic b/Task/Hunt-the-Wumpus/FutureBasic/hunt-the-wumpus.basic new file mode 100644 index 0000000000..714df4ab49 --- /dev/null +++ b/Task/Hunt-the-Wumpus/FutureBasic/hunt-the-wumpus.basic @@ -0,0 +1,229 @@ +// Hunt the Wumpus +// https://rosettacode.org/wiki/Hunt_the_Wumpus# + + +_w = 640 // window size width and height +_h = 400 +_window = 1 + +local fn BuildWindow + + CGRect r = fn cgrectmake(0,0,_w,_h) + window _Window, @"Hunt the Wumpus", r, NSWindowStyleMaskTitled + NSWindowStyleMaskMiniaturizable + windowcenter(_Window) + WindowSetBackgroundColor(_Window,fn ColorBlack) + WindowPrintViewSetTextInset( _window, 20) + + text ,14,fn colorWhite + +end fn + + +fn BuildWindow + + +//////////// Main Program ////////////// + +"Start" + +cls:restore + +data 7,13,19,12,18,20,16,17,19,11,14,18,13,15,18,9,14,16,1,15,17,10,16,20,6,11,19,8,12,17 +data 4,9,13,2,10,15,1,5,11,4,6,20,5,7,12,3,6,8,3,7,10,2,4,5,1,3,9,2,8,14 +data 1,2,3,1,3,2,2,1,3,2,3,1,3,1,2,3,2,1 + +uint32 i, j,tunnel(21,4),lost(7,4),targ,wump,player,bat1, bat2, pit1, pit2, d6, epi +player = int(rnd(20)) +uint32 arrows = 5 +CFStringRef choice + +for i = 1 to 20 //set up rooms + for j = 1 to 3 + read tunnel(i,j) + next j +next i + +for i = 1 to 6 //set up list of permuatations of 1-2-3 + for j = 1 to 3 + read lost(i,j) + next j +next i + + +//place wumpus, bats, and pits +do + wump = int(rnd(20)) +until wump <> player +do + pit1 = int(rnd(20)) +until pit1 <> player +do + pit2 = int(rnd(20)) +until pit2 <> player && pit2 <> pit1 +do + bat1 = int(rnd(20)) +until bat1 <> player && bat1 <> pit1 && bat1 <> pit2 +do + bat2 = int(rnd(20)) +until bat2 <> player && bat2 <> pit1 && bat2 <> pit2 && bat2 <> bat1 + +do + if player = wump + text ,,fn colorRed + print "You have been eaten by the Wumpus!" + Print: WindowPrintViewScrollToBottom( _window ) + goto "defeat" + end if + if player = pit1 || player = pit2 + text ,,fn colorRed + print "Aaaaaaaaaaa! You have fallen into a bottomless pit." + Print: WindowPrintViewScrollToBottom( _window ) + goto "defeat" + end if + if player = bat1 || player = bat2 + text ,,fn colorOrange + print "A bat has carried you into another empty room." + text ,,fn colorWhite + Print: WindowPrintViewScrollToBottom( _window ) + do + player = (rnd(20)) + until player <> wump && player <> pit1 && player <> pit2 && player <> bat1 && player <> bat2 + end if + + print + text ,,fn colorGreen + print "You are in room number" + str$(player) + ". There are tunnels to rooms"¬ + + str$(tunnel(player,1)) + "," str$(tunnel(player,2)) + " and" +str$(tunnel(player,3)) + if (tunnel(player,1)) + (tunnel(player,2)) + (tunnel(player,3)) = 0 then arrows = 5 : goto "Start" + text ,,fn colorYellow + print "You have" + str$(arrows) + " arrows left." + text ,,fn colorWhite + Print: WindowPrintViewScrollToBottom( _window ) + + d6 = int(rnd(6)) + for i = 1 to 3 + epi = tunnel(player,lost(d6,i)) + if epi = wump + text ,,fn colorRed + print "You smell something terrible nearby." + text ,,fn colorWhite + Print: WindowPrintViewScrollToBottom( _window ) + end if + if epi = bat1 || epi = bat2 + text ,,fn colorRed + print "You hear a rustling." + text ,,fn colorWhite + Print: WindowPrintViewScrollToBottom( _window ) + end if + if epi = pit1 || epi = pit2 + print "You feel a cold wind blowing from a nearby cavern." + Print: WindowPrintViewScrollToBottom( _window ) + end if + next i + "choices" + print + print "What would you like to do?" + Print: WindowPrintViewScrollToBottom( _window ) + + choice = input %(_w/2 - 260 , _h + 20),@"Type A to shoot an arrow, or a number to move to another room. ( or Q to quit )" + + select case left(choice,1) + + case @"q", @"Q" , @"x" , @"X" + end + + case @"a", @"A" + + CFStringRef targString + targString = input %(_w/2 - 140 , _h + 20), @"Which room would you like to shoot into? " + targ = fn StringIntegerValue(targString) + + print "You shot an arrow into room " + str$(targ) + + if targ = player + text ,,fn colorRed + print "You shot yourself. Why would you want to do such a thing?" + Print: WindowPrintViewScrollToBottom( _window ) + goto "defeat" + end if + + text ,,fn colorGreen + if targ = wump then goto "victory" + + if targ = tunnel(player,1) || targ = tunnel(player,2) || targ = tunnel(player,3) + text ,,fn colorYellow + print "The Wumpus awakes!" + text ,,fn colorWhite + Print: WindowPrintViewScrollToBottom( _window ) + if rnd(100) <= 75 + print "He moves to a nearby cavern." + Print: WindowPrintViewScrollToBottom( _window ) + short wumpRnd + wumpRnd = Int(Rnd(3)) + wump = Tunnel(wump,wumpRnd) + else + print "He goes back to sleep." + Print: WindowPrintViewScrollToBottom( _window ) + end if + else + text ,,fn colorRed + print "You can't shoot that room from here." + text ,,fn colorWhite + Print: WindowPrintViewScrollToBottom( _window ) + goto "choices" + end if + arrows -= 1 + + case @"0", @"1" ,@"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9" + + targ = fn StringIntegerValue(choice) + if targ = player then print "You are already there." + + if targ = tunnel(player,1) || targ = tunnel(player,2) || targ = tunnel(player,3) + print using "You walk to room ##"; targ + player = targ + else + text ,,fn colorOrange + print "You can't get there from here." + text ,,fn colorWhite + Print: WindowPrintViewScrollToBottom( _window ) + end if + case else + text ,,fn colorRed + print "You are making no sense." + text ,,fn colorWhite + Print: WindowPrintViewScrollToBottom( _window ) + end select +until arrows = 0 +text ,,fn colorRed +print "You have run out of arrows!" +Print: WindowPrintViewScrollToBottom( _window ) +"defeat" +text ,,fn colorRed +print "You lose! Better luck next time." +Print: WindowPrintViewScrollToBottom( _window ) + +goto "End" + +"victory" +text ,20,fn colorGreen +print "You have slain the Wumpus!" +print "You won!" +Print: WindowPrintViewScrollToBottom( _window ) + +"End" + +text ,14,fn colorWhite +choice = input %(_w/2 -140 , _h + 20),@"Hit Return for another. ( or Q to quit )" + +select case left(choice,1) + + case @"q", @"Q" , @"x" , @"X" + end + + case else arrows = 5: goto "Start" + +end select + + +handleevents diff --git a/Task/Hunt-the-Wumpus/Julia/hunt-the-wumpus.julia b/Task/Hunt-the-Wumpus/Julia/hunt-the-wumpus.jl similarity index 100% rename from Task/Hunt-the-Wumpus/Julia/hunt-the-wumpus.julia rename to Task/Hunt-the-Wumpus/Julia/hunt-the-wumpus.jl diff --git a/Task/Hunt-the-Wumpus/Liberty-BASIC/hunt-the-wumpus.basic b/Task/Hunt-the-Wumpus/Liberty-BASIC/hunt-the-wumpus.basic new file mode 100644 index 0000000000..cd667ebfab --- /dev/null +++ b/Task/Hunt-the-Wumpus/Liberty-BASIC/hunt-the-wumpus.basic @@ -0,0 +1,272 @@ +' ============================================ +' HUNT THE WUMPUS - Liberty BASIC (Text Version) +' Text-only game played in Mainwin +' ============================================ + +' --- Global Variables --- +dim rooms(20, 3) ' Adjacency map +dim hazard(20) ' 0=nothing, 1=Wumpus, 2=Bat, 3=Pit + +global playerRoom, arrowsLeft, gameOver, wRoom + +playerRoom = 0 +arrowsLeft = 5 +gameOver = 0 + +call setupMap +call placeHazards + +print "WELCOME TO HUNT THE WUMPUS!" +print "===========================" +print "You can enter commands like M10 to move to room 10" +print " or S18 to shoot into room 18. Of couse commands" +print " like M, S and Q are permitted as well. Good luck" +print "" +call mainLoop +end + +' ---------------------------- +sub setupMap + ' Each room has 3 connections + ' Standard dodecahedron layout + + data 2,5,8 + data 1,3,10 + data 2,4,12 + data 3,5,14 + data 1,4,6 + data 5,7,15 + data 6,8,17 + data 1,7,9 + data 8,10,18 + data 2,9,11 + data 10,12,19 + data 3,11,13 + data 12,14,20 + data 4,13,15 + data 6,14,16 + data 15,17,20 + data 7,16,18 + data 9,17,19 + data 11,18,20 + data 13,16,19 + + for i = 1 to 20 + for j = 1 to 3 + read a + rooms(i,j) = a + next + next +end sub + +' ---------------------------- +sub placeHazards + for i = 1 to 20 + hazard(i) = 0 + next + + wRoom = getEmptyRoom(0) + hazard(wRoom) = 1 + + for i = 1 to 2 + bRoom = getEmptyRoom(0) + hazard(bRoom) = 2 + next + + for i = 1 to 2 + pRoom = getEmptyRoom(0) + hazard(pRoom) = 3 + next + + playerRoom = getEmptyRoom(0) +end sub + +' ---------------------------- +function getEmptyRoom(avoid) + do + room = int(rnd(0)*20) + 1 + loop until hazard(room)=0 and room <> avoid + getEmptyRoom = room +end function + +' ---------------------------- +sub mainLoop + while gameOver = 0 + call describeHazards + print "You are in room "; playerRoom + print "Tunnels lead to "; rooms(playerRoom,1); ", "; rooms(playerRoom,2); ", "; rooms(playerRoom,3) + print "Arrows left: "; arrowsLeft + + input "Shoot, Move or Quit (S/M/Q)? "; a$ + a$ = upper$(trim$(a$)) + + if len(a$) > 1 then + 'assume characters 2 and 3 are part of a number + num = val(mid$(a$,2)) + if num > 20 then num = 0 + a$ = left$(a$,1) + end if + + select case a$ + case "S" + call shoot num + case "M" + call move num + case "Q" + Print "You have decided to quit." + gameOver = 1 + case else + print "Invalid choice." + end select + wend + + input "Press Enter to quit the game"; dummy$ +end sub + +' ---------------------------- +sub describeHazards + for i = 1 to 3 + adj = rooms(playerRoom,i) + select case hazard(adj) + case 1 + print "You smell something terrible nearby." + case 2 + print "You hear a rustling." + case 3 + print "You feel a cold wind blowing from a nearby cavern." + end select + next +end sub + +' ---------------------------- +sub move num + + if num = 0 then + input "Which room do you want to enter? "; n + if n < 1 or n > 20 then + print "That's not a valid room!" + exit sub + end if + else + n = num + end if + + adjacent = 0 + for i = 1 to 3 + if rooms(playerRoom,i) = n then adjacent = 1 + next + + if adjacent = 0 then + print "You can't go there directly!" + exit sub + end if + + playerRoom = n + select case hazard(playerRoom) + case 1 + print "You walked into the Wumpus room!" + print "The Wumpus eats you. GAME OVER!" + gameOver = 1 + case 2 + print "A giant bat grabs you!" + playerRoom = getEmptyRoom(0) + print "The bat drops you into room "; playerRoom + call checkNewRoom + case 3 + print "You fall into a bottomless pit!" + print "GAME OVER!" + gameOver = 1 + case else + ' safe + end select +end sub + +' ---------------------------- +sub checkNewRoom + select case hazard(playerRoom) + case 1 + print "The bat dropped you into the Wumpus room!" + print "The Wumpus eats you. GAME OVER!" + gameOver = 1 + case 3 + print "The bat dropped you into a pit!" + print "GAME OVER!" + gameOver = 1 + case 2 + print "Another bat grabs you!" + playerRoom = getEmptyRoom(0) + print "The bat drops you into room "; playerRoom + call checkNewRoom + case else + ' safe + end select +end sub + +' ---------------------------- +sub shoot num + + if num = 0 then + input "Shoot into which room? "; t + if t < 1 or t > 20 then + print "That's not a valid room!" + exit sub + end if + else + t = num + end if + + adjacent = 0 + for i = 1 to 3 + if rooms(playerRoom,i) = t then adjacent = 1 + next + + if adjacent = 0 then + print "You can't shoot there directly!" + exit sub + end if + + arrowsLeft = arrowsLeft - 1 + + if hazard(t) = 1 then + print "Your arrow flies true... and you hear a terrible scream!" + print "You have slain the Wumpus! YOU WIN!" + gameOver = 1 + exit sub + else + print "You missed." + wWake = int(rnd(0)*100) + 1 + if wWake <= 75 then + call moveWumpus + end if + if playerRoom = wRoom then + print "The Wumpus has moved into your room!" + print "It eats you. GAME OVER!" + gameOver = 1 + end if + end if + + 'check to see if you are out of arrows + if arrowsLeft <= 0 then + print "You're out of arrows!" + print "GAME OVER - You have lost." + gameOver = 1 + exit sub + end if + +end sub + +' ---------------------------- +sub moveWumpus + oldRoom = wRoom + found = 0 + for tries = 1 to 10 + adj = rooms(oldRoom, int(rnd(0)*3)+1) + if hazard(adj) = 0 and adj <> playerRoom then + hazard(oldRoom) = 0 + hazard(adj) = 1 + wRoom = adj + found = 1 + exit for + end if + next +end sub diff --git a/Task/Hunt-the-Wumpus/Mojo/hunt-the-wumpus.mojo b/Task/Hunt-the-Wumpus/Mojo/hunt-the-wumpus.mojo new file mode 100644 index 0000000000..2c67a185ae --- /dev/null +++ b/Task/Hunt-the-Wumpus/Mojo/hunt-the-wumpus.mojo @@ -0,0 +1,203 @@ +from random import shuffle, seed, random_ui64 + +alias adjacent_rooms: List[List[Int]] = [ + [], + [2, 5, 8], [1, 3, 10], [2, 4, 12], [3, 5, 14], [1, 4, 6], + [5, 7, 15], [6, 8, 17], [1, 7, 9], [8, 10, 18], [2, 9, 11], + [10, 12, 19],[2, 11, 13],[12, 14, 20], [4, 13, 15], [6, 14, 16], + [15, 17, 20],[7, 16, 18], [9, 17, 19], [11, 18, 20], [13, 16, 19] +] + +struct Game_State: + var winloss_state: Int + var player_location: Int + var wumpus_location: Int + var pit_locations: Tuple[Int, Int] + var bat_locations: Tuple[Int, Int] + var arrows_remaining: Int + + fn __init__(out self): + var all_locations = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] + shuffle(all_locations) + + self.winloss_state = 0 + self.player_location = all_locations[0] + self.wumpus_location = all_locations[1] + self.pit_locations = (all_locations[2], all_locations[3]) + self.bat_locations = (all_locations[4], all_locations[5]) + self.arrows_remaining = 5 + + fn __copyinit__(out self, other: Self): + self.winloss_state = other.winloss_state + self.player_location = other.player_location + self.wumpus_location = other.wumpus_location + self.pit_locations = other.pit_locations + self.bat_locations = other.bat_locations + self.arrows_remaining = other.arrows_remaining + +fn print_instructions() -> None: + print("WELCOME TO 'HUNT THE WUMPUS'") + print(" THE WUMPUS LIVES IN A CAVE OF 20 ROOMS. EACH ROOM") + print("HAS 3 TUNNELS LEADING TO OTHER ROOMS. (LOOK AT A") + print("DODECAHEDRON TO SEE HOW THIS WORKS-IF YOU DON'T KNOW") + print("WHAT A DODECAHEDRON IS, ASK SOMEONE)\n") + print(" HAZARDS:") + print(" BOTTOMLESS PITS - TWO ROOMS HAVE BOTTOMLESS PITS IN THEM") + print(" IF YOU GO THERE, YOU FALL INTO THE PIT (& LOSE!)") + print(" SUPER BATS - TWO OTHER ROOMS HAVE SUPER BATS. IF YOU") + print(" GO THERE, A BAT GRABS YOU AND TAKES YOU TO SOME OTHER") + print(" ROOM AT RANDOM. (WHICH MIGHT BE TROUBLESOME)\n") + print(" WUMPUS:") + print(" THE WUMPUS IS NOT BOTHERED BY THE HAZARDS (HE HAS SUCKER") + print(" FEET AND IS TOO BIG FOR A BAT TO LIFT). USUALLY") + print(" HE IS ASLEEP. TWO THINGS WAKE HIM UP: YOUR ENTERING") + print(" HIS ROOM OR YOUR SHOOTING AN ARROW.") + print(" IF THE WUMPUS WAKES, HE MOVES (P=.75) ONE ROOM") + print(" OR STAYS STILL (P=.25). AFTER THAT, IF HE IS WHERE YOU") + print(" ARE, HE EATS YOU UP (& YOU LOSE!)\n") + print(" YOU:") + print(" EACH TURN YOU MAY MOVE OR SHOOT A CROOKED ARROW") + print(" MOVING: YOU CAN GO ONE ROOM (THRU ONE TUNNEL)") + print(" ARROWS: YOU HAVE 5 ARROWS. YOU LOSE WHEN YOU RUN OUT.") + print(" EACH ARROW CAN GO FROM 1 TO 5 ROOMS. YOU AIM BY TELLING") + print(" THE COMPUTER THE ROOM#S YOU WANT THE ARROW TO GO TO.") + print(" IF THE ARROW CAN'T GO THAT WAY (IE NO TUNNEL) IT MOVES") + print(" AT RAMDOM TO THE NEXT ROOM.") + print(" IF THE ARROW HITS THE WUMPUS, YOU WIN.") + print(" IF THE ARROW HITS YOU, YOU LOSE.\n") + print(" WARNINGS:") + print(" WHEN YOU ARE ONE ROOM AWAY FROM WUMPUS OR HAZARD,") + print(" THE COMPUTER SAYS:") + print(" WUMPUS- 'I SMELL A WUMPUS'") + print(" BAT - 'BATS NEARBY'") + print(" PIT - 'I FEEL A DRAFT'\n") + return None + +fn print_location(game_state: Game_State) -> None: + if game_state.wumpus_location in adjacent_rooms[game_state.player_location]: + print("I SMELL A WUMPUS!") + if game_state.pit_locations[0] in adjacent_rooms[game_state.player_location] or game_state.pit_locations[1] in adjacent_rooms[game_state.player_location]: + print("I FEEL A DRAFT") + if game_state.bat_locations[0] in adjacent_rooms[game_state.player_location] or game_state.bat_locations[1] in adjacent_rooms[game_state.player_location]: + print("BATS NEARBY!") + print("YOU ARE IN ROOM", game_state.player_location) + print("TUNNELS LEAD TO", adjacent_rooms[game_state.player_location][0], adjacent_rooms[game_state.player_location][1], adjacent_rooms[game_state.player_location][2]) + return None + +fn move_wumpus(mut game_state: Game_State) -> Bool: + if random_ui64(0,3) != 3: + game_state.wumpus_location = adjacent_rooms[game_state.wumpus_location][random_ui64(0,2)] + if game_state.wumpus_location == game_state.player_location: + print("TSK TSK TSK- WUMPUS GOT YOU!") + game_state.winloss_state = -1 + return True + return False + +def shoot_action(mut game_state: Game_State) -> None: + while True: + distance = Int(input("NO. OF ROOMS(1-5)")) + if distance >= 1 and distance <= 5: + break + path: List[Int] = [] + for i in range(distance): + while True: + fork = Int(input("ROOM #")) + if i <= 1: + break + elif fork != path[-2]: + break + else: + print("ARROWS AREN'T THAT CROOKED - TRY ANOTHER ROOM") + pass + path.append(fork) + arrow_location = game_state.player_location + for i in range(distance): + if path[i] in adjacent_rooms[arrow_location]: + arrow_location = path[i] + else: + arrow_location = adjacent_rooms[arrow_location][random_ui64(0, 2)] + if arrow_location == game_state.wumpus_location: + print("AHA! YOU GOT THE WUMPUS!") + game_state.winloss_state = 1 + return + elif arrow_location == game_state.player_location: + print("OUCH! ARROW GOT YOU!") + game_state.winloss_state = -1 + return + print("MISSED") + if move_wumpus(game_state): + return + game_state.arrows_remaining -= 1 + if game_state.arrows_remaining == 0: + game_state.winloss_state = -1 + return + +def move_action(mut game_state: Game_State) -> None: + while True: + next_room = Int(input("WHERE TO")) + if next_room < 1 or next_room > 20: + pass + if next_room in adjacent_rooms[game_state.player_location]: + game_state.player_location = next_room + break + if next_room == game_state.player_location: + break + print("NOT POSSIBLE -") + if game_state.player_location == game_state.wumpus_location: + print("...OOPS! BUMPED A WUMPUS!") + if move_wumpus(game_state): + return + if game_state.player_location == game_state.pit_locations[0] or game_state.player_location == game_state.pit_locations[1]: + print("YYYIIIIEEEE . . . FELL IN PIT") + game_state.winloss_state = -1 + return + if game_state.player_location == game_state.bat_locations[0] or game_state.player_location == game_state.bat_locations[1]: + print("ZAP--SUPER BAT SNATCH! ELSEWHEREVILLE FOR YOU!") + move_action(game_state, Int(random_ui64(1, 20))) + return + +fn move_action(mut game_state: Game_State, room_number: Int) -> None: + game_state.player_location = room_number + if game_state.player_location == game_state.wumpus_location: + print("...OOPS! BUMPED A WUMPUS!") + if move_wumpus(game_state): + return + if game_state.player_location == game_state.pit_locations[0] or game_state.player_location == game_state.pit_locations[1]: + print("YYYIIIIEEEE . . . FELL IN PIT") + game_state.winloss_state = -1 + return + if game_state.player_location == game_state.bat_locations[0] or game_state.player_location == game_state.bat_locations[1]: + print("ZAP--SUPER BAT SNATCH! ELSEWHEREVILLE FOR YOU!") + move_action(game_state, Int(random_ui64(1, 20))) + return + +def main(): + seed() + instruct_cond = input("INSTRUCTIONS (Y-N)") + if instruct_cond != 'N': + print_instructions() + + game_state = Game_State() + saved_state = game_state + + game_is_running = True + while game_is_running: + print("HUNT THE WUMPUS\n") + print_location(game_state) + action = input("SHOOT OR MOVE (S-M)") + + if action == 'S': + shoot_action(game_state) + elif action == 'M': + move_action(game_state) + if game_state.winloss_state == -1: + print("HA HA HA - YOU LOSE!") + elif game_state.winloss_state == 1: + print("HEE HEE HEE - THE WUMPUS'LL GETCHA NEXT TIME!!") + if game_state.winloss_state != 0: + state_update = input("SAME SET-UP (Y-N)") + if state_update == 'Y': + game_state = saved_state + else: + game_state = Game_State() + saved_state = game_state diff --git a/Task/Hunt-the-Wumpus/Quackery/hunt-the-wumpus.quackery b/Task/Hunt-the-Wumpus/Quackery/hunt-the-wumpus.quackery new file mode 100644 index 0000000000..831dc08b10 --- /dev/null +++ b/Task/Hunt-the-Wumpus/Quackery/hunt-the-wumpus.quackery @@ -0,0 +1,138 @@ + [ table + [ 1 4 7 ] [ 0 2 9 ] [ 1 3 11 ] [ 2 4 13 ] + [ 0 3 5 ] [ 4 6 14 ] [ 5 7 16 ] [ 0 6 8 ] + [ 7 9 17 ] [ 1 8 10 ] [ 9 11 18 ] [ 2 10 12 ] + [ 11 13 19 ] [ 3 12 14 ] [ 5 13 15 ] [ 14 16 19 ] + [ 6 15 17 ] [ 8 16 18 ] [ 10 17 19 ] [ 12 15 18 ] ] is adjacent ( n --> [ ) + + [ stack ] is player ( --> s ) + [ stack ] is arrows ( --> s ) + [ stack ] is wumpus ( --> s ) + [ stack ] is bat1 ( --> s ) + [ stack ] is bat2 ( --> s ) + [ stack ] is pit1 ( --> s ) + [ stack ] is pit2 ( --> s ) + + [ over find swap found ] is has ( [ n --> b ) + + [ dup dup size random peek join ] is addrand ( [ --> [ ) + + [ trim reverse trim reverse + $->n not if [ drop -1 ] ] is validate ( $ --> n ) + + [ say "A giant bat transports you to chamber " + 20 random dup echo say "." cr + player replace + 20 random swap replace ] is relocate ( s --> ) + + [ player share + dup bat1 share = iff + [ drop bat1 relocate ] again + dup bat2 share = iff + [ drop bat2 relocate ] again + dup pit1 share = + over pit2 share = or iff + [ say "You fell into a bottomless pit." + drop false ] + done + dup wumpus share = iff + [ say "The Wumpus eats you." drop false ] + done + say "You are in chamber " dup echo say "." cr + say "Adjacent chambers are: " + adjacent dup witheach + [ echo i 0 = iff [ say "." cr ] + else + [ say ", " + i 1 = if [ say "and " ] ] ] + say "You have " arrows share echo say " arrows." cr + dup wumpus share has if + [ say "You smell something terrible nearby." cr ] + dup bat1 share has + over bat2 share has or if + [ say "You hear a rustling." cr ] + dup pit1 share has + swap pit2 share has or if + [ say "You feel a cold wind " + say "blowing from a nearby chamber." cr ] + true ] is report ( --> b ) + + [ $ "Move to which chamber? " input validate + player share adjacent + dup addrand unrot find + peek player put true ] is move ( --> b ) + + [ true + $ "Shoot into which chambers? " input nest$ + dup [] = if [ drop ' [ [ -1 ] ] ] + player share swap witheach + [ $->n not if [ drop -1 ] + swap adjacent + dup addrand unrot find peek + say "The arrow enters chamber " + dup echo say "." cr + dup player share = iff + [ say "You shot yourself." cr + dip not conclude ] + done + dup wumpus share = iff + [ say "You shot the Wumpus." cr + dip not conclude ] + done ] + drop dup while + say "You did not hit anything." cr + 4 random 0 != if + [ wumpus take adjacent + 3 random peek wumpus put ] + -1 arrows tally + arrows share 0 = if + [ say "You have run out of arrows." cr not ] ] is shoot ( --> b ) + + [ $ "Move or shoot? " input space join + 0 peek upper dup char M = iff [ drop move ] done + char S = iff shoot done + again ] is action ( b --> b ) + + [ cr + say "Your mission is to anaesthetise an ailing " + say "Wumpus so that it can be healed." cr + say "It is in a dodecahedral labyrinth " + say "that is fraught with dangers." cr + say "The labyrinth has 20 chambers numbered 0 to " + say "19 which are connected by tunnels." cr cr + say "- The Wumpus will eat you if it sees you." cr + say "- Two of the chambers are bottomless pits." cr + say "- There are two giant bats that will " + say "transport you to a random chamber." cr cr + say "You can smell the Wumpus from an adjoining " + say "chamber. It smells terrible." cr + say "When you are in a chamber next to a bottomless " + say "pit you can feel a cold wind." cr + say "You can hear the giant bats rustle from a " + say "chamber away." cr cr + say "You are equipped with five progammable arrows." cr + say "They can be programmed with up to five " + say "adjoining chambers." cr + say "If a destination is invalid the arrow will move " + say "to a random adjoining chamber." cr cr + say "Be careful! Do not shoot yourself. Wumpus " + say "anasthetic is lethal to humans." cr + say "If you miss the Wumpus it will probably wake " + say "and move to an adjoining chamber." cr cr ] is rules ( --> ) + + [ say "Hunt the Wumpus, the Quackery cut." cr cr + randomise + 5 arrows put + [] 20 times [ i join ] shuffle + ' [ player wumpus bat1 bat2 pit1 pit2 ] + witheach [ dip behead put ] + drop + $ "Would you like to see the rules? " input + space join 0 peek upper char Y = if rules + [ report while + action while + cr again ] + ' [ player arrows wumpus bat1 bat2 pit1 pit2 ] + witheach release ] is play ( --> ) + + play diff --git a/Task/Hunt-the-Wumpus/Wren/hunt-the-wumpus.wren b/Task/Hunt-the-Wumpus/Wren/hunt-the-wumpus.wren index ad665375ea..f053916bea 100644 --- a/Task/Hunt-the-Wumpus/Wren/hunt-the-wumpus.wren +++ b/Task/Hunt-the-Wumpus/Wren/hunt-the-wumpus.wren @@ -1,7 +1,7 @@ import "random" for Random -import "/fmt" for Fmt -import "/ioutil" for Input -import "/str" for Str +import "./fmt" for Fmt +import "./ioutil" for Input +import "./str" for Str var cave = { 1: [ 2, 3, 4], 2: [ 1, 5, 6], 3: [ 1, 7, 8], 4: [ 1, 9, 10], diff --git a/Task/I-before-E-except-after-C/00-TASK.txt b/Task/I-before-E-except-after-C/00-TASK.txt index b342d03475..74e62f2023 100644 --- a/Task/I-before-E-except-after-C/00-TASK.txt +++ b/Task/I-before-E-except-after-C/00-TASK.txt @@ -3,7 +3,7 @@ widely known mnemonic which is supposed to help when spelling English words. ;Task: -Using the word list from   [http://wiki.puzzlers.org/pub/wordlists/unixdict.txt http://wiki.puzzlers.org/pub/wordlists/unixdict.txt], +Using the word list from   [https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt],
check if the two sub-clauses of the phrase are plausible individually: :::#   ''"I before E when not preceded by C"'' :::#   ''"E before I when preceded by C"'' diff --git a/Task/I-before-E-except-after-C/8080-Assembly/i-before-e-except-after-c.8080 b/Task/I-before-E-except-after-C/8080-Assembly/i-before-e-except-after-c.8080 index 1b4b015117..75a59a9a6a 100644 --- a/Task/I-before-E-except-after-C/8080-Assembly/i-before-e-except-after-c.8080 +++ b/Task/I-before-E-except-after-C/8080-Assembly/i-before-e-except-after-c.8080 @@ -1,207 +1,207 @@ - ;;; I before E, except after C -fcb1: equ 5Ch ; FCB 1 (populated by file on command line) -dma: equ 80h ; Standard DMA location -bdos: equ 5 ; CP/M entry point -puts: equ 9 ; CP/M call to write a string to the console -fopen: equ 0Fh ; CP/M call to open a file -fread: equ 14h ; CP/M call to read from a file -CR: equ 13 -LF: equ 10 -EOF: equ 26 - org 100h - ;;; Open the file given on the command line - lxi d,fcb1 - mvi c,fopen - call bdos - inr a ; FF = error - jz die - ;;; We can only read one 128-byte block at a time, and the file - ;;; will not fit in memory (max 64 k). So there are two things - ;;; going on here: we copy from the block into a word buffer - ;;; until we see the end of a line, at which point we process - ;;; the word. In the meantime, if while copying we reach the end - ;;; of the block, we read the next block. - lxi b,curwrd ; Word pointer -block: push b ; Keep word pointer while reading - lxi d,fcb1 ; Read a block from the file - mvi c,fread - call bdos - pop b ; Restore word pointer - dcr a ; 1 = EOF - jz done - inr a ; otherwise, <>0 = error - jnz die - lxi h,dma ; Start reading at DMA -char: mov a,m ; Get character - cpi EOF ; If it's an EOF character, we're done - jz done - stax b ; Store character in current word - inx b - cpi LF ; If it's LF, then we've got a full word - cz word ; Process the word - inr l ; Go to next character - jz block ; If we're done with this block, get next one - jmp char - ;;; When done, report the statistics -done: lxi d,scie ; CIE - call sout - lhld cie - call puthl - lxi d,sxie ; xIE - call sout - lhld xie - call puthl - lxi d,scei ; CEI - call sout - lhld cei - call puthl - lxi d,sxei ; xEI - call sout - lhld xei - call puthl - ;;; Then say what is and isn't plausible - lxi d,s_ienc ; I before E when not preceded by C - call sout ; plausible if 2*xIE>CIE - lhld cie - xchg - lhld xie - call pplaus - lxi d,s_eic ; E before I when preceded by C - call sout ; plausible if 2*CEI>xEI - lhld xei - xchg - lhld cei - ;;; If HL = amount of words with feature, and - ;;; DE = amount of words with opposit feature, then print - ;;; '(not) plausible', as appropriate. -pplaus: dad h ; 2 * feature - mov a,d ; Compare high byte - cmp h - jc plaus ; If 2*H>D then plausible - mov a,e ; Otherwise, compare low byte - cmp l - jc plaus ; If 2*L>E then plausible - lxi d,snop ; Otherwise, not plausible - jmp sout -plaus: lxi d,splau - jmp sout - ;;; Process a word -word: push h ; Save file read address - xra a ; Zero out end of word - stax b - dcx b - lxi h,curwrd ; Scan word -start: mov a,m ; Get current character - inx h ; Move pointer ahead - ana a ; If zero, - jz w_end ; we're done - cpi 'c' ; Did we find a 'c'? - jz findc - cpi 'e' ; Otherwise, did we find 'e'? - jz finde - cpi 'i' ; Otherwise, did we find 'i'? - jz findi - jmp start ; Otherwise, keep going - ;;; We found an 'e' -finde: mov a,m ; Get following character - cpi 'i' ; Is it 'i'? - jnz start ; If not, keep going - inx h ; Otherwise, move past it, - xchg ; keep pointer in DE, - lhld xie ; We found ie without c - inx h - shld xie - xchg - jmp start - ;;; We found an 'i' -findi: mov a,m ; Get following character - cpi 'e' ; Is it 'e'? - jnz start ; If not, keep going - inx h ; Otherwise, move past it, - xchg ; keep pointer in DE, - lhld xei ; We found ei without c - inx h - shld xei - xchg - jmp start - ;;; We found a 'c' -findc: mov a,m ; Get following character - cpi 'e' ; Is it 'e'? - jz findce ; Then we have 'ce' - cpi 'i' ; Is it 'i'? - jz findci ; Then we have 'ci' - jmp start ; Otherwise, just keep going -findce: mov d,h ; set DE = start of 'e?' - mov e,l - inx d ; Get next character - ldax d - cpi 'i' ; Is it 'i'? - jnz start ; If not, do nothing - lhld cei ; But if so, we found 'cei' - inx h ; Increment the counter - shld cei - xchg ; Keep scanning _after_ the 'cei' - inx h - jmp start -findci: mov d,h ; set DE = start of 'i?' - mov e,l - inx d ; Get next character - ldax d - cpi 'e' ; Is it 'e'? - jnz start ; If not, do nothing - lhld cie ; But if so, we found 'cie' - inx h ; Increment the counter - shld cie - xchg ; Keep scanning _after_ the 'cie' - inx h - jmp start -w_end: lxi b,curwrd ; Set word pointer to beginning - pop h ; Restore file read address - ret - ;;; Print error message and stop the program -die: lxi d,errmsg - mvi c,puts - call bdos - rst 0 - ;;; Print string -sout: mvi c,puts - jmp bdos - ;;; Print HL to the console as a decimal number -puthl: push h - lxi h,num - xthl - lxi b,-10 -dgt: lxi d,-1 -clcdgt: inx d - dad b - jc clcdgt - mov a,l - adi 10+'0' - xthl - dcx h - mov m,a - xthl - xchg - mov a,h - ora l - jnz dgt - pop d - mvi c,puts - jmp bdos -errmsg: db 'Error$' ; Good enough -s_ienc: db 'I before E when not preceded by C:$' -s_eic: db 'E before I when preceded by C:$' -snop: db ' not' -splau: db ' plausible',CR,LF,'$' -scie: db 'CIE: $' ; Report strings -sxie: db 'xIE: $' -scei: db 'CEI: $' -sxei: db 'xEI: $' - db '00000' -num: db CR,LF,'$' ; Space for number - ;;; Counters -xie: dw 0 ; I before E when not preceded by C -cie: dw 0 ; I before E when preceded by C -cei: dw 0 ; E before I when preceded by C -xei: dw 0 ; E before I when not preceded by C -curwrd: equ $ ; Current word stored here + ;;; I before E, except after C +fcb1: equ 5Ch ; FCB 1 (populated by file on command line) +dma: equ 80h ; Standard DMA location +bdos: equ 5 ; CP/M entry point +puts: equ 9 ; CP/M call to write a string to the console +fopen: equ 0Fh ; CP/M call to open a file +fread: equ 14h ; CP/M call to read from a file +CR: equ 13 +LF: equ 10 +EOF: equ 26 + org 100h + ;;; Open the file given on the command line + lxi d,fcb1 + mvi c,fopen + call bdos + inr a ; FF = error + jz die + ;;; We can only read one 128-byte block at a time, and the file + ;;; will not fit in memory (max 64 k). So there are two things + ;;; going on here: we copy from the block into a word buffer + ;;; until we see the end of a line, at which point we process + ;;; the word. In the meantime, if while copying we reach the end + ;;; of the block, we read the next block. + lxi b,curwrd ; Word pointer +block: push b ; Keep word pointer while reading + lxi d,fcb1 ; Read a block from the file + mvi c,fread + call bdos + pop b ; Restore word pointer + dcr a ; 1 = EOF + jz done + inr a ; otherwise, <>0 = error + jnz die + lxi h,dma ; Start reading at DMA +char: mov a,m ; Get character + cpi EOF ; If it's an EOF character, we're done + jz done + stax b ; Store character in current word + inx b + cpi LF ; If it's LF, then we've got a full word + cz word ; Process the word + inr l ; Go to next character + jz block ; If we're done with this block, get next one + jmp char + ;;; When done, report the statistics +done: lxi d,scie ; CIE + call sout + lhld cie + call puthl + lxi d,sxie ; xIE + call sout + lhld xie + call puthl + lxi d,scei ; CEI + call sout + lhld cei + call puthl + lxi d,sxei ; xEI + call sout + lhld xei + call puthl + ;;; Then say what is and isn't plausible + lxi d,s_ienc ; I before E when not preceded by C + call sout ; plausible if 2*xIE>CIE + lhld cie + xchg + lhld xie + call pplaus + lxi d,s_eic ; E before I when preceded by C + call sout ; plausible if 2*CEI>xEI + lhld xei + xchg + lhld cei + ;;; If HL = amount of words with feature, and + ;;; DE = amount of words with opposit feature, then print + ;;; '(not) plausible', as appropriate. +pplaus: dad h ; 2 * feature + mov a,d ; Compare high byte + cmp h + jc plaus ; If 2*H>D then plausible + mov a,e ; Otherwise, compare low byte + cmp l + jc plaus ; If 2*L>E then plausible + lxi d,snop ; Otherwise, not plausible + jmp sout +plaus: lxi d,splau + jmp sout + ;;; Process a word +word: push h ; Save file read address + xra a ; Zero out end of word + stax b + dcx b + lxi h,curwrd ; Scan word +start: mov a,m ; Get current character + inx h ; Move pointer ahead + ana a ; If zero, + jz w_end ; we're done + cpi 'c' ; Did we find a 'c'? + jz findc + cpi 'e' ; Otherwise, did we find 'e'? + jz finde + cpi 'i' ; Otherwise, did we find 'i'? + jz findi + jmp start ; Otherwise, keep going + ;;; We found an 'e' +finde: mov a,m ; Get following character + cpi 'i' ; Is it 'i'? + jnz start ; If not, keep going + inx h ; Otherwise, move past it, + xchg ; keep pointer in DE, + lhld xie ; We found ie without c + inx h + shld xie + xchg + jmp start + ;;; We found an 'i' +findi: mov a,m ; Get following character + cpi 'e' ; Is it 'e'? + jnz start ; If not, keep going + inx h ; Otherwise, move past it, + xchg ; keep pointer in DE, + lhld xei ; We found ei without c + inx h + shld xei + xchg + jmp start + ;;; We found a 'c' +findc: mov a,m ; Get following character + cpi 'e' ; Is it 'e'? + jz findce ; Then we have 'ce' + cpi 'i' ; Is it 'i'? + jz findci ; Then we have 'ci' + jmp start ; Otherwise, just keep going +findce: mov d,h ; set DE = start of 'e?' + mov e,l + inx d ; Get next character + ldax d + cpi 'i' ; Is it 'i'? + jnz start ; If not, do nothing + lhld cei ; But if so, we found 'cei' + inx h ; Increment the counter + shld cei + xchg ; Keep scanning _after_ the 'cei' + inx h + jmp start +findci: mov d,h ; set DE = start of 'i?' + mov e,l + inx d ; Get next character + ldax d + cpi 'e' ; Is it 'e'? + jnz start ; If not, do nothing + lhld cie ; But if so, we found 'cie' + inx h ; Increment the counter + shld cie + xchg ; Keep scanning _after_ the 'cie' + inx h + jmp start +w_end: lxi b,curwrd ; Set word pointer to beginning + pop h ; Restore file read address + ret + ;;; Print error message and stop the program +die: lxi d,errmsg + mvi c,puts + call bdos + rst 0 + ;;; Print string +sout: mvi c,puts + jmp bdos + ;;; Print HL to the console as a decimal number +puthl: push h + lxi h,num + xthl + lxi b,-10 +dgt: lxi d,-1 +clcdgt: inx d + dad b + jc clcdgt + mov a,l + adi 10+'0' + xthl + dcx h + mov m,a + xthl + xchg + mov a,h + ora l + jnz dgt + pop d + mvi c,puts + jmp bdos +errmsg: db 'Error$' ; Good enough +s_ienc: db 'I before E when not preceded by C:$' +s_eic: db 'E before I when preceded by C:$' +snop: db ' not' +splau: db ' plausible',CR,LF,'$' +scie: db 'CIE: $' ; Report strings +sxie: db 'xIE: $' +scei: db 'CEI: $' +sxei: db 'xEI: $' + db '00000' +num: db CR,LF,'$' ; Space for number + ;;; Counters +xie: dw 0 ; I before E when not preceded by C +cie: dw 0 ; I before E when preceded by C +cei: dw 0 ; E before I when preceded by C +xei: dw 0 ; E before I when not preceded by C +curwrd: equ $ ; Current word stored here diff --git a/Task/I-before-E-except-after-C/ALGOL-68/i-before-e-except-after-c.alg b/Task/I-before-E-except-after-C/ALGOL-68/i-before-e-except-after-c.alg index 3193288160..e67eb3f84b 100644 --- a/Task/I-before-E-except-after-C/ALGOL-68/i-before-e-except-after-c.alg +++ b/Task/I-before-E-except-after-C/ALGOL-68/i-before-e-except-after-c.alg @@ -1,80 +1,67 @@ -# tests the plausibility of "i before e except after c" using unixdict.txt # +BEGIN # use unixdict.txt to test the plausibility of # + # "i before e except after c" # -# implements the plausibility test specified by the task # -# returns TRUE if with > 2 * without # -PROC plausible = ( INT with, without )BOOL: with > 2 * without; + PR read "files.incl.a68" PR # include file utilities # -# shows the plausibility of with and without # -PROC show plausibility = ( STRING legend, INT with, without )VOID: - print( ( legend, IF plausible( with, without ) THEN " is plausible" ELSE " is not plausible" FI, newline ) ); + # implements the plausibility test specified by the task # + # returns TRUE if with > 2 * without # + PROC plausible = ( INT with, without )BOOL: with > 2 * without; + + # shows the plausibility of with and without # + PROC show plausibility = ( STRING legend, INT with, without )VOID: + print( ( legend, " is ", IF plausible( with, without ) THEN "" ELSE "not " FI + , "plausible", newline + ) + ); -IF FILE input file; - STRING file name = "unixdict.txt"; - open( input file, file name, stand in channel ) /= 0 -THEN - # failed to open the file # - print( ( "Unable to open """ + file name + """", newline ) ) -ELSE - # file opened OK # - BOOL at eof := FALSE; - # set the EOF handler for the file # - on logical file end( input file, ( REF FILE f )BOOL: - BEGIN - # note that we reached EOF on the # - # latest read # - at eof := TRUE; - # return TRUE so processing can continue # - TRUE - END - ); INT cei := 0; INT xei := 0; INT cie := 0; INT xie := 0; - WHILE STRING word; - get( input file, ( word, newline ) ); - NOT at eof - DO - # examine the word for cie, xie (x /= c), cei and xei (x /= c) # - FOR pos FROM LWB word TO UPB word DO word[ pos ] := to lower( word[ pos ] ) OD; - IF word = "ie" THEN + + # examines word for cie, xie (x /= c), cei and xei (x /= c) # + PROC test i before e = ( STRING word )VOID: + IF word = "ie" THEN xie +:= 1 - ELIF word = "ei" THEN + ELIF word = "ei" THEN xei +:= 1 - ELSE + ELSE INT length = ( UPB word - LWB word ) + 1; IF length > 1 THEN IF word[ LWB word ] = "i" AND word[ LWB word + 1 ] = "e" THEN - # word starts ie # + # word starts ie # xie +:= 1 ELIF word[ LWB word ] = "e" AND word[ LWB word + 1 ] = "i" THEN - # word starts ei # + # word starts ei # xei +:= 1 FI; FOR pos FROM LWB word + 1 TO UPB word - 1 DO IF word[ pos ] = "i" AND word[ pos + 1 ] = "e" THEN - # have i before e, check the preceeding character # + # have i before e, check the preceeding character # IF word[ pos - 1 ] = "c" THEN cie ELSE xie FI +:= 1 ELIF word[ pos ] = "e" AND word[ pos + 1 ] = "i" THEN - # have e before i, check the preceeding character # + # have e before i, check the preceeding character # IF word[ pos - 1 ] = "c" THEN cei ELSE xei FI +:= 1 FI OD FI - FI - OD; - # close the file # - close( input file ); + FI # test i before e # ; # test the hypothesis # - print( ( "cie occurances: ", whole( cie, 0 ), newline ) ); - print( ( "xie occurances: ", whole( xie, 0 ), newline ) ); - print( ( "cei occurances: ", whole( cei, 0 ), newline ) ); - print( ( "xei occurances: ", whole( xei, 0 ), newline ) ); - show plausibility( "i before e except after c", xie, cie ); - show plausibility( "e before i except after c", xei, cei ); - show plausibility( "i before e when after c", cie, xie ); - show plausibility( "e before i when after c", cei, xei ); - show plausibility( "i before e in general", xie + cie, xei + cei ); - show plausibility( "e before i in general", xei + cei, xie + cie ) -FI + + IF "unixdict.txt" EACHLINE test i before e < 0 THEN + print( ( "Unable to open unixdict.txt", newline ) ) + ELSE + print( ( "cie occurances: ", whole( cie, 0 ), newline ) ); + print( ( "xie occurances: ", whole( xie, 0 ), newline ) ); + print( ( "cei occurances: ", whole( cei, 0 ), newline ) ); + print( ( "xei occurances: ", whole( xei, 0 ), newline ) ); + show plausibility( "i before e except after c", xie, cie ); + show plausibility( "e before i except after c", xei, cei ); + show plausibility( "i before e when after c", cie, xie ); + show plausibility( "e before i when after c", cei, xei ); + show plausibility( "i before e in general", xie + cie, xei + cei ); + show plausibility( "e before i in general", xei + cei, xie + cie ) + FI + +END diff --git a/Task/I-before-E-except-after-C/AWK/i-before-e-except-after-c.awk b/Task/I-before-E-except-after-C/AWK/i-before-e-except-after-c.awk index a9ab9fde37..0d1c85ae20 100644 --- a/Task/I-before-E-except-after-C/AWK/i-before-e-except-after-c.awk +++ b/Task/I-before-E-except-after-C/AWK/i-before-e-except-after-c.awk @@ -7,20 +7,20 @@ /cie/ {cie+=cnt($3)} function cnt(c) { - if (c<1) return 1; - return c; + if (c<1) return 1; + return c; } END { - printf("cie: %i\nnie: %i\ncei: %i\nnei: %i\n",cie,nie-cie,cei,nei-cei); - v = v2 = ""; - if (nie < 3 * cie) { - v =" not"; - } - print "I before E when not preceded by C: is"v" plausible"; - if (nei > 3 * cei) { - v = v2 =" not"; - } - print "E before I when preceded by C: is"v2" plausible"; + printf("cie: %i\nnie: %i\ncei: %i\nnei: %i\n",cie,nie-cie,cei,nei-cei); + v = v2 = ""; + if (nie < 3 * cie) { + v =" not"; + } + print "I before E when not preceded by C: is"v" plausible"; + if (nei > 3 * cei) { + v = v2 =" not"; + } + print "E before I when preceded by C: is"v2" plausible"; print "Overall rule is"v" plausible"; } diff --git a/Task/I-before-E-except-after-C/AutoHotkey/i-before-e-except-after-c.ahk b/Task/I-before-E-except-after-C/AutoHotkey/i-before-e-except-after-c.ahk index a9fc81bf1f..a0ee96da0f 100644 --- a/Task/I-before-E-except-after-C/AutoHotkey/i-before-e-except-after-c.ahk +++ b/Task/I-before-E-except-after-C/AutoHotkey/i-before-e-except-after-c.ahk @@ -1,4 +1,4 @@ -WordList := URL_ToVar("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt") +WordList := URL_ToVar("https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt") WordList := RegExReplace(WordList, "i)cie", "", cieN) WordList := RegExReplace(WordList, "i)cei", "", ceiN) RegExReplace(WordList, "i)ie", "", ieN) diff --git a/Task/I-before-E-except-after-C/BASIC256/i-before-e-except-after-c.basic b/Task/I-before-E-except-after-C/BASIC256/i-before-e-except-after-c.basic index c2e1212f95..0a47a1548e 100644 --- a/Task/I-before-E-except-after-C/BASIC256/i-before-e-except-after-c.basic +++ b/Task/I-before-E-except-after-C/BASIC256/i-before-e-except-after-c.basic @@ -2,13 +2,13 @@ CI = 0 : XI = 0 : CE = 0 : XE = 0 open 1, "unixdict.txt" do - pal$ = readline (1) - if instr(pal$, "ie") then - if instr(pal$, "cie") then CI += 1 else XI += 1 - endif - if instr(pal$, "ei") then - if instr(pal$, "cei") then CE += 1 else XE += 1 - endif + pal$ = readline (1) + if instr(pal$, "ie") then + if instr(pal$, "cie") then CI += 1 else XI += 1 + endif + if instr(pal$, "ei") then + if instr(pal$, "cei") then CE += 1 else XE += 1 + endif until eof(1) close 1 diff --git a/Task/I-before-E-except-after-C/BBC-BASIC/i-before-e-except-after-c.basic b/Task/I-before-E-except-after-C/BBC-BASIC/i-before-e-except-after-c.basic new file mode 100644 index 0000000000..dbef67d8e6 --- /dev/null +++ b/Task/I-before-E-except-after-C/BBC-BASIC/i-before-e-except-after-c.basic @@ -0,0 +1,39 @@ + F%=OPENIN"unixdict.txt" + IF F% == 0 ERROR 100, "unixdict not found!" + + CI=0 : XI=0 : CE=0 : XE=0 + WHILE NOT EOF#F% + Line$=GET$#F% + + P%=INSTR(Line$, "ie") + WHILE P% + IF MID$(Line$, P% - 1, 1) == "c" CI+=1 ELSE XI+=1 + P%=INSTR(Line$, "ie", P% + 1) + ENDWHILE + + P%=INSTR(Line$, "ei") + WHILE P% + IF MID$(Line$, P% - 1, 1) == "c" CE+=1 ELSE XE+=1 + P%=INSTR(Line$, "ei", P% + 1) + ENDWHILE + ENDWHILE + CLOSE#F% + + PRINT "Instances of 'ie', proceeded by a 'c' = ";CI + PRINT "Instances of 'ie', NOT proceeded by a 'c' = ";XI + P1%=XI * 2 > CI + PRINT "Therefore 'I before E when not preceded by C' is" FNTest(P1%) + PRINT + + PRINT "Instances of 'ei', proceeded by a 'c' = ";CE + PRINT "Instances of 'ei', NOT proceeded by a 'c' = ";XE + P2%=CE * 2 > XE + PRINT "Therefore 'E before I when preceded by C' is" FNTest(P2%) + PRINT + + IF P1% AND P2% PRINT "B"; ELSE PRINT "Not b"; + PRINT "oth sub-phrases are plausible, therefore the phrase " +\ + \ "'I before E, except after C' can be said to be" FNTest(P1% AND P2%) "!" + END + + DEF FNTest(plausible%)=MID$(" not plausible", 1 - 4 * plausible%) diff --git a/Task/I-before-E-except-after-C/BQN/i-before-e-except-after-c.bqn b/Task/I-before-E-except-after-C/BQN/i-before-e-except-after-c.bqn new file mode 100644 index 0000000000..dbbec600b8 --- /dev/null +++ b/Task/I-before-E-except-after-C/BQN/i-before-e-except-after-c.bqn @@ -0,0 +1,15 @@ +Func ← { + Filter ← {+´(∨´∘(𝕨⊸⍷))¨𝕩} + nei ← "ei" Filter 𝕩 + cei ← "cei" Filter 𝕩 + nie ← "ie" Filter 𝕩 + cie ← "cie" Filter 𝕩 + •Show (nie < 2×cie)◶⟨ + "I before E when not preceded by C is plausible" + "I before E when not preceded by C is not plausible" + ⟩@ + (nei > 2×cei)◶⟨ + "E before I when preceded by C is plausible" + "E before I when preceded by C is not plausible" + ⟩@ +} diff --git a/Task/I-before-E-except-after-C/Batch-File/i-before-e-except-after-c-1.bat b/Task/I-before-E-except-after-C/Batch-File/i-before-e-except-after-c-1.bat index 1962c47d0e..6a0a353d2b 100644 --- a/Task/I-before-E-except-after-C/Batch-File/i-before-e-except-after-c-1.bat +++ b/Task/I-before-E-except-after-C/Batch-File/i-before-e-except-after-c-1.bat @@ -3,7 +3,7 @@ @echo off setlocal enabledelayedexpansion - ::Initialization + ::Initialization set ie=0 set ei=0 set cie=0 @@ -13,13 +13,13 @@ set propos1=FALSE set propos2=FALSE set propos3=FALSE - ::Do the matching + ::Do the matching for /f %%X in (unixdict.txt) do ( - set word=%%X - if not "!word:ie=!"=="!word!" if "!word:cie=!"=="!word!" (set /a ie+=1) - if not "!word:ei=!"=="!word!" if "!word:cei=!"=="!word!" (set /a ei+=1) - if not "!word:cei=!"=="!word!" (set /a cei+=1) - if not "!word:cie=!"=="!word!" (set /a cie+=1) + set word=%%X + if not "!word:ie=!"=="!word!" if "!word:cie=!"=="!word!" (set /a ie+=1) + if not "!word:ei=!"=="!word!" if "!word:cei=!"=="!word!" (set /a ei+=1) + if not "!word:cei=!"=="!word!" (set /a cei+=1) + if not "!word:cie=!"=="!word!" (set /a cie+=1) ) set /a "counter1=!ei!*2,counter2=!cie!*2" diff --git a/Task/I-before-E-except-after-C/Clojure/i-before-e-except-after-c.clj b/Task/I-before-E-except-after-C/Clojure/i-before-e-except-after-c.clj index 73fef20309..9d895b2b68 100644 --- a/Task/I-before-E-except-after-C/Clojure/i-before-e-except-after-c.clj +++ b/Task/I-before-E-except-after-C/Clojure/i-before-e-except-after-c.clj @@ -47,7 +47,7 @@ format-line))) (defn -main [] - (with-open [rdr (clojure.java.io/reader "http://wiki.puzzlers.org/pub/wordlists/unixdict.txt")] + (with-open [rdr (clojure.java.io/reader "https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt")] (i-before-e-except-after-c-plausible? "Check unixdist list" (apply-freq-1 (line-seq rdr)))) (with-open [rdr (clojure.java.io/reader "http://ucrel.lancs.ac.uk/bncfreq/lists/1_2_all_freq.txt")] (i-before-e-except-after-c-plausible? "Word frequencies (stretch goal)" (map format-freq-line (drop 1 (line-seq rdr)))))) diff --git a/Task/I-before-E-except-after-C/Delphi/i-before-e-except-after-c.delphi b/Task/I-before-E-except-after-C/Delphi/i-before-e-except-after-c.pas similarity index 100% rename from Task/I-before-E-except-after-C/Delphi/i-before-e-except-after-c.delphi rename to Task/I-before-E-except-after-C/Delphi/i-before-e-except-after-c.pas diff --git a/Task/I-before-E-except-after-C/Ed/i-before-e-except-after-c-1.ed b/Task/I-before-E-except-after-C/Ed/i-before-e-except-after-c-1.ed new file mode 100644 index 0000000000..b8a34ecd14 --- /dev/null +++ b/Task/I-before-E-except-after-C/Ed/i-before-e-except-after-c-1.ed @@ -0,0 +1,32 @@ +# i-before-e.ed +H +# Remove all the non-rule-related words +v/(ie|ei)/d +# Replace the occurences with one-letter markers +g/ei/s/.*/e/ +g/ie/s/.*/i/ +,j +# Remove 1 occurence of e (alternative) per two i (null) +s/eii//g +s/iie//g +s/eii//g +s/iie//g +s/eii//g +s/iie//g +s/eii//g +s/iie//g +s/eii//g +s/iie//g +s/eii//g +s/iie//g +s/eii//g +s/iie//g +s/eii//g +s/iie//g +s/eii//g +s/iie//g +s/eii//g +s/iie//g +# Check whether there are more i's in the output (null hypothesis true) or not +,p +Q diff --git a/Task/I-before-E-except-after-C/Ed/i-before-e-except-after-c-2.ed b/Task/I-before-E-except-after-C/Ed/i-before-e-except-after-c-2.ed new file mode 100644 index 0000000000..44cdaeb3a9 --- /dev/null +++ b/Task/I-before-E-except-after-C/Ed/i-before-e-except-after-c-2.ed @@ -0,0 +1,35 @@ +# e-before-i-with-c.ed +H +# Remove all the non-rule-related words +v/(cie|cei)/d +# Replace the occurences with one-letter markers +g/ei/s/.*/e/ +g/ie/s/.*/i/ +,j +# Remove 1 occurence of i (alternative) per two e (null) +s/iee// +s/eei// +s/iee// +s/eei// +s/iee// +s/eei// +s/iee// +s/eei// +s/iee// +s/eei// +s/iee// +s/eei// +s/iee// +s/eei// +s/iee// +s/eei// +s/iee// +s/eei// +s/iee// +s/eei// +s/iee// +s/eei// +s/iee// +# Check whether there are more e's in the output (null hypothesis true) or not +,p +Q diff --git a/Task/I-before-E-except-after-C/Elixir/i-before-e-except-after-c.elixir b/Task/I-before-E-except-after-C/Elixir/i-before-e-except-after-c.ex similarity index 100% rename from Task/I-before-E-except-after-C/Elixir/i-before-e-except-after-c.elixir rename to Task/I-before-E-except-after-C/Elixir/i-before-e-except-after-c.ex diff --git a/Task/I-before-E-except-after-C/F-Sharp/i-before-e-except-after-c.fs b/Task/I-before-E-except-after-C/F-Sharp/i-before-e-except-after-c.fs new file mode 100644 index 0000000000..501506f0fb --- /dev/null +++ b/Task/I-before-E-except-after-C/F-Sharp/i-before-e-except-after-c.fs @@ -0,0 +1,9 @@ +// I before E except after C. Nigel Galloway: September 30th., 2024 +type plausibility=Plausible|Implausible +let fN n g=System.Text.RegularExpressions.Regex.Matches(n,g).Count +let fG n g=g|>Array.map2(fun n g->n+g)[|n("ie");n("ei");n("cie");n("cei")|] +let n=System.IO.File.ReadLines("unixdict.txt")|>Seq.fold(fun n g->fG (fN g) n)[|0;0;0;0|] +printfn($"I before E except after C is {if n[0]-n[2]>2*n[2] then Plausible else Implausible}") +printfn($"E before I except after C is {if n[1]-n[3]>2*n[3] then Plausible else Implausible}") +printfn($"I before E when after C is {if n[2]>2*n[3] then Plausible else Implausible}") +printfn($"E before I when after C is {if n[3]>2*n[2] then Plausible else Implausible}") diff --git a/Task/I-before-E-except-after-C/FutureBasic/i-before-e-except-after-c.basic b/Task/I-before-E-except-after-C/FutureBasic/i-before-e-except-after-c.basic index 8e02afd17b..86599ccbef 100644 --- a/Task/I-before-E-except-after-C/FutureBasic/i-before-e-except-after-c.basic +++ b/Task/I-before-E-except-after-C/FutureBasic/i-before-e-except-after-c.basic @@ -22,7 +22,7 @@ void local fn CheckWord( wrd as CFStringRef, txt as CFStringRef, c as ^long, x a end fn void local fn Doit - CFURLRef url = fn URLWithString( @"http://wiki.puzzlers.org/pub/wordlists/unixdict.txt" ) + CFURLRef url = fn URLWithString( @"https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt" ) CFStringRef string = fn StringWithContentsOfURL( url, NSUTF8StringEncoding, NULL ) CFArrayRef words = fn StringComponentsSeparatedByCharactersInSet( string, fn CharacterSetNewlineSet ) long cei = 0, cie = 0, xei = 0, xie = 0 diff --git a/Task/I-before-E-except-after-C/Go/i-before-e-except-after-c.go b/Task/I-before-E-except-after-C/Go/i-before-e-except-after-c.go index 69374b52c6..90b5c6c681 100644 --- a/Task/I-before-E-except-after-C/Go/i-before-e-except-after-c.go +++ b/Task/I-before-E-except-after-C/Go/i-before-e-except-after-c.go @@ -1,68 +1,68 @@ package main import ( - "bufio" - "fmt" - "log" - "os" - "regexp" - "strings" + "bufio" + "fmt" + "log" + "os" + "regexp" + "strings" ) func main() { - f, err := os.Open("unixdict.txt") - if err != nil { - log.Fatalln(err) - } - defer f.Close() + f, err := os.Open("unixdict.txt") + if err != nil { + log.Fatalln(err) + } + defer f.Close() - s := bufio.NewScanner(f) - rie := regexp.MustCompile("^ie|[^c]ie") - rei := regexp.MustCompile("^ei|[^c]ei") - var cie, ie int - var cei, ei int - for s.Scan() { - line := s.Text() - if strings.Contains(line, "cie") { - cie++ - } - if strings.Contains(line, "cei") { - cei++ - } - if rie.MatchString(line) { - ie++ - } - if rei.MatchString(line) { - ei++ - } - } - err = s.Err() - if err != nil { - log.Fatalln(err) - } + s := bufio.NewScanner(f) + rie := regexp.MustCompile("^ie|[^c]ie") + rei := regexp.MustCompile("^ei|[^c]ei") + var cie, ie int + var cei, ei int + for s.Scan() { + line := s.Text() + if strings.Contains(line, "cie") { + cie++ + } + if strings.Contains(line, "cei") { + cei++ + } + if rie.MatchString(line) { + ie++ + } + if rei.MatchString(line) { + ei++ + } + } + err = s.Err() + if err != nil { + log.Fatalln(err) + } - if check(ie, ei, "I before E when not preceded by C") && - check(cei, cie, "E before I when preceded by C") { - fmt.Println("Both plausable.") - fmt.Println(`"I before E, except after C" is plausable.`) - } else { - fmt.Println("One or both implausable.") - fmt.Println(`"I before E, except after C" is implausable.`) - } + if check(ie, ei, "I before E when not preceded by C") && + check(cei, cie, "E before I when preceded by C") { + fmt.Println("Both plausable.") + fmt.Println(`"I before E, except after C" is plausable.`) + } else { + fmt.Println("One or both implausable.") + fmt.Println(`"I before E, except after C" is implausable.`) + } } // check checks if a statement is plausible. Something is plausible if a is more // than two times b. func check(a, b int, s string) bool { - switch { - case a > b*2: - fmt.Printf("%q is plausible (%d vs %d).\n", s, a, b) - return true - case a >= b: - fmt.Printf("%q is implausible (%d vs %d).\n", s, a, b) - default: - fmt.Printf("%q is implausible and contra-indicated (%d vs %d).\n", - s, a, b) - } - return false + switch { + case a > b*2: + fmt.Printf("%q is plausible (%d vs %d).\n", s, a, b) + return true + case a >= b: + fmt.Printf("%q is implausible (%d vs %d).\n", s, a, b) + default: + fmt.Printf("%q is implausible and contra-indicated (%d vs %d).\n", + s, a, b) + } + return false } diff --git a/Task/I-before-E-except-after-C/Haskell/i-before-e-except-after-c.hs b/Task/I-before-E-except-after-C/Haskell/i-before-e-except-after-c.hs index a39c070d5a..120acd246d 100644 --- a/Task/I-before-E-except-after-C/Haskell/i-before-e-except-after-c.hs +++ b/Task/I-before-E-except-after-C/Haskell/i-before-e-except-after-c.hs @@ -6,7 +6,7 @@ getWordList :: IO String getWordList = do response <- simpleHTTP.getRequest$ url getResponseBody response - where url = "http://wiki.puzzlers.org/pub/wordlists/unixdict.txt" + where url = "https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt" main = do words <- getWordList diff --git a/Task/I-before-E-except-after-C/Icon/i-before-e-except-after-c-1.icon b/Task/I-before-E-except-after-C/Icon/i-before-e-except-after-c-1.icon index 088d2b2af3..d7c5f7c825 100644 --- a/Task/I-before-E-except-after-C/Icon/i-before-e-except-after-c-1.icon +++ b/Task/I-before-E-except-after-C/Icon/i-before-e-except-after-c-1.icon @@ -1,4 +1,4 @@ -import Utils # To get the FindFirst class +import Utils # To get the FindFirst class procedure main(a) showCounts := "--showcounts" == !a diff --git a/Task/I-before-E-except-after-C/Icon/i-before-e-except-after-c-2.icon b/Task/I-before-E-except-after-C/Icon/i-before-e-except-after-c-2.icon index 2f669b47d1..c3df84f390 100644 --- a/Task/I-before-E-except-after-C/Icon/i-before-e-except-after-c-2.icon +++ b/Task/I-before-E-except-after-C/Icon/i-before-e-except-after-c-2.icon @@ -1,4 +1,4 @@ -import Utils # To get the FindFirst class +import Utils # To get the FindFirst class procedure main(a) WS := " \t" diff --git a/Task/I-before-E-except-after-C/Java/i-before-e-except-after-c-2.java b/Task/I-before-E-except-after-C/Java/i-before-e-except-after-c-2.java index 83eba7931c..5ccca284f7 100644 --- a/Task/I-before-E-except-after-C/Java/i-before-e-except-after-c-2.java +++ b/Task/I-before-E-except-after-C/Java/i-before-e-except-after-c-2.java @@ -12,7 +12,7 @@ static int cei = 0; static int cie = 0; static void count() throws URISyntaxException, IOException { - URL url = new URI("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt").toURL(); + URL url = new URI("https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt").toURL(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) { String line; while ((line = reader.readLine()) != null) { diff --git a/Task/I-before-E-except-after-C/Java/i-before-e-except-after-c-3.java b/Task/I-before-E-except-after-C/Java/i-before-e-except-after-c-3.java index f53d8476aa..2af84999ac 100644 --- a/Task/I-before-E-except-after-C/Java/i-before-e-except-after-c-3.java +++ b/Task/I-before-E-except-after-C/Java/i-before-e-except-after-c-3.java @@ -3,56 +3,56 @@ import java.io.FileReader; public class IbeforeE { - public static void main(String[] args) - { - IbeforeE now=new IbeforeE(); - String wordlist="unixdict.txt"; - if(now.isPlausibleRule(wordlist)) - System.out.println("Rule is plausible."); - else - System.out.println("Rule is not plausible."); - } - boolean isPlausibleRule(String filename) - { - int truecount=0,falsecount=0; - try - { - BufferedReader br=new BufferedReader(new FileReader(filename)); - String word; - while((word=br.readLine())!=null) - { - if(isPlausibleWord(word)) - truecount++; - else if(isOppPlausibleWord(word)) - falsecount++; - } - br.close(); - } - catch(Exception e) - { - System.out.println("Something went horribly wrong: "+e.getMessage()); - } - - System.out.println("Plausible count: "+truecount); - System.out.println("Implausible count: "+falsecount); - if(truecount>2*falsecount) - return true; - return false; - } - boolean isPlausibleWord(String word) - { - if(!word.contains("c")&&word.contains("ie")) - return true; - else if(word.contains("cei")) - return true; - return false; - } - boolean isOppPlausibleWord(String word) - { - if(!word.contains("c")&&word.contains("ei")) - return true; - else if(word.contains("cie")) - return true; - return false; - } + public static void main(String[] args) + { + IbeforeE now=new IbeforeE(); + String wordlist="unixdict.txt"; + if(now.isPlausibleRule(wordlist)) + System.out.println("Rule is plausible."); + else + System.out.println("Rule is not plausible."); + } + boolean isPlausibleRule(String filename) + { + int truecount=0,falsecount=0; + try + { + BufferedReader br=new BufferedReader(new FileReader(filename)); + String word; + while((word=br.readLine())!=null) + { + if(isPlausibleWord(word)) + truecount++; + else if(isOppPlausibleWord(word)) + falsecount++; + } + br.close(); + } + catch(Exception e) + { + System.out.println("Something went horribly wrong: "+e.getMessage()); + } + + System.out.println("Plausible count: "+truecount); + System.out.println("Implausible count: "+falsecount); + if(truecount>2*falsecount) + return true; + return false; + } + boolean isPlausibleWord(String word) + { + if(!word.contains("c")&&word.contains("ie")) + return true; + else if(word.contains("cei")) + return true; + return false; + } + boolean isOppPlausibleWord(String word) + { + if(!word.contains("c")&&word.contains("ei")) + return true; + else if(word.contains("cie")) + return true; + return false; + } } diff --git a/Task/I-before-E-except-after-C/Julia/i-before-e-except-after-c.julia b/Task/I-before-E-except-after-C/Julia/i-before-e-except-after-c.jl similarity index 100% rename from Task/I-before-E-except-after-C/Julia/i-before-e-except-after-c.julia rename to Task/I-before-E-except-after-C/Julia/i-before-e-except-after-c.jl diff --git a/Task/I-before-E-except-after-C/Kotlin/i-before-e-except-after-c.kotlin b/Task/I-before-E-except-after-C/Kotlin/i-before-e-except-after-c.kotlin deleted file mode 100644 index b1cc1898fb..0000000000 --- a/Task/I-before-E-except-after-C/Kotlin/i-before-e-except-after-c.kotlin +++ /dev/null @@ -1,61 +0,0 @@ -// version 1.0.6 - -import java.net.URL -import java.io.InputStreamReader -import java.io.BufferedReader - -fun isPlausible(n1: Int, n2: Int) = n1 > 2 * n2 - -fun printResults(source: String, counts: IntArray) { - println("Results for $source") - println(" i before e except after c") - println(" for ${counts[0]}") - println(" against ${counts[1]}") - val plausible1 = isPlausible(counts[0], counts[1]) - println(" sub-rule is${if (plausible1) "" else " not"} plausible\n") - println(" e before i when preceded by c") - println(" for ${counts[2]}") - println(" against ${counts[3]}") - val plausible2 = isPlausible(counts[2], counts[3]) - println(" sub-rule is${if (plausible2) "" else " not"} plausible\n") - val plausible = plausible1 && plausible2 - println(" rule is${if (plausible) "" else " not"} plausible") -} - -fun main(args: Array) { - val url = URL("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt") - val isr = InputStreamReader(url.openStream()) - val reader = BufferedReader(isr) - val regexes = arrayOf( - Regex("(^|[^c])ie"), // i before e when not preceded by c (includes words starting with ie) - Regex("(^|[^c])ei"), // e before i when not preceded by c (includes words starting with ei) - Regex("cei"), // e before i when preceded by c - Regex("cie") // i before e when preceded by c - ) - val counts = IntArray(4) // corresponding counts of occurrences - var word = reader.readLine() - while (word != null) { - for (i in 0..3) counts[i] += regexes[i].findAll(word).toList().size - word = reader.readLine() - } - reader.close() - printResults("unixdict.txt", counts) - - val url2 = URL("http://ucrel.lancs.ac.uk/bncfreq/lists/1_2_all_freq.txt") - val isr2 = InputStreamReader(url2.openStream()) - val reader2 = BufferedReader(isr2) - val counts2 = IntArray(4) - reader2.readLine() // read header line - var line = reader2.readLine() // read first line and store it - var words: List - val splitter = Regex("""(\t+|\s+)""") - while (line != null) { - words = line.split(splitter) - if (words.size == 4) // first element is empty - for (i in 0..3) counts2[i] += regexes[i].findAll(words[1]).toList().size * words[3].toInt() - line = reader2.readLine() - } - reader2.close() - println() - printResults("British National Corpus", counts2) -} diff --git a/Task/I-before-E-except-after-C/Kotlin/i-before-e-except-after-c.kts b/Task/I-before-E-except-after-C/Kotlin/i-before-e-except-after-c.kts new file mode 100644 index 0000000000..038c8a089d --- /dev/null +++ b/Task/I-before-E-except-after-C/Kotlin/i-before-e-except-after-c.kts @@ -0,0 +1,61 @@ +// version 1.0.6 + +import java.net.URL +import java.io.InputStreamReader +import java.io.BufferedReader + +fun isPlausible(n1: Int, n2: Int) = n1 > 2 * n2 + +fun printResults(source: String, counts: IntArray) { + println("Results for $source") + println(" i before e except after c") + println(" for ${counts[0]}") + println(" against ${counts[1]}") + val plausible1 = isPlausible(counts[0], counts[1]) + println(" sub-rule is${if (plausible1) "" else " not"} plausible\n") + println(" e before i when preceded by c") + println(" for ${counts[2]}") + println(" against ${counts[3]}") + val plausible2 = isPlausible(counts[2], counts[3]) + println(" sub-rule is${if (plausible2) "" else " not"} plausible\n") + val plausible = plausible1 && plausible2 + println(" rule is${if (plausible) "" else " not"} plausible") +} + +fun main(args: Array) { + val url = URL("https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt") + val isr = InputStreamReader(url.openStream()) + val reader = BufferedReader(isr) + val regexes = arrayOf( + Regex("(^|[^c])ie"), // i before e when not preceded by c (includes words starting with ie) + Regex("(^|[^c])ei"), // e before i when not preceded by c (includes words starting with ei) + Regex("cei"), // e before i when preceded by c + Regex("cie") // i before e when preceded by c + ) + val counts = IntArray(4) // corresponding counts of occurrences + var word = reader.readLine() + while (word != null) { + for (i in 0..3) counts[i] += regexes[i].findAll(word).toList().size + word = reader.readLine() + } + reader.close() + printResults("unixdict.txt", counts) + + val url2 = URL("http://ucrel.lancs.ac.uk/bncfreq/lists/1_2_all_freq.txt") + val isr2 = InputStreamReader(url2.openStream()) + val reader2 = BufferedReader(isr2) + val counts2 = IntArray(4) + reader2.readLine() // read header line + var line = reader2.readLine() // read first line and store it + var words: List + val splitter = Regex("""(\t+|\s+)""") + while (line != null) { + words = line.split(splitter) + if (words.size == 4) // first element is empty + for (i in 0..3) counts2[i] += regexes[i].findAll(words[1]).toList().size * words[3].toInt() + line = reader2.readLine() + } + reader2.close() + println() + printResults("British National Corpus", counts2) +} diff --git a/Task/I-before-E-except-after-C/Langur/i-before-e-except-after-c.langur b/Task/I-before-E-except-after-C/Langur/i-before-e-except-after-c.langur new file mode 100644 index 0000000000..77ef21052e --- /dev/null +++ b/Task/I-before-E-except-after-C/Langur/i-before-e-except-after-c.langur @@ -0,0 +1,24 @@ +val words = less(split(readfile("./data/unixdict.txt"), delim="\n"), of=1) + +val print = fn*(support number, against number) { + val ratio = support / against + writeln "{{support}} / {{against}} = {{ratio : r2}}:", (ratio < 2) * " NOT", " PLAUSIBLE" + return if(ratio >= 2: 1; 0) +} + +val ks = fw/ei cei ie cie/ +var cnt = {:} + +for w in words { + for k in ks { + cnt[k; 0] += if(k in w: 1; 0) + } +} + +val support = cnt'ie - cnt'cie +val against = cnt'ei - cnt'cei + +var result = print(support, against) +result += print(cnt'cei, cnt'cie) + +writeln "Overall:", (result < 2) * " NOT", " PLAUSIBLE\n" diff --git a/Task/I-before-E-except-after-C/Lasso/i-before-e-except-after-c.lasso b/Task/I-before-E-except-after-C/Lasso/i-before-e-except-after-c.lasso index abf4c7e67f..12f0b1464b 100644 --- a/Task/I-before-E-except-after-C/Lasso/i-before-e-except-after-c.lasso +++ b/Task/I-before-E-except-after-C/Lasso/i-before-e-except-after-c.lasso @@ -3,7 +3,7 @@ local(cie,cei,ie,ei) = (:0,0,0,0) local(match_ie) = regExp(`[^c]ie`) local(match_ei) = regExp(`[^c]ei`) -with word in include_url(`http://wiki.puzzlers.org/pub/wordlists/unixdict.txt`)->asString->split("\n") +with word in include_url(`https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt`)->asString->split("\n") where #word >> `ie` or #word >> `ei` do { #word >> `cie` diff --git a/Task/I-before-E-except-after-C/Lua/i-before-e-except-after-c.lua b/Task/I-before-E-except-after-C/Lua/i-before-e-except-after-c.lua index 50509a26fa..7c37aaeb8a 100644 --- a/Task/I-before-E-except-after-C/Lua/i-before-e-except-after-c.lua +++ b/Task/I-before-E-except-after-C/Lua/i-before-e-except-after-c.lua @@ -22,7 +22,7 @@ function plaus (case, opposite, words) end -- Main procedure -local page = http.request("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt") +local page = http.request("https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt") io.write("I before E when not preceded by C: ") local sub1 = plaus("[^c]ie", "cie", page) io.write("E before I when preceded by C: ") diff --git a/Task/I-before-E-except-after-C/MATLAB/i-before-e-except-after-c.m b/Task/I-before-E-except-after-C/MATLAB/i-before-e-except-after-c.m index e1d2657819..14c84de23a 100644 --- a/Task/I-before-E-except-after-C/MATLAB/i-before-e-except-after-c.m +++ b/Task/I-before-E-except-after-C/MATLAB/i-before-e-except-after-c.m @@ -1,5 +1,5 @@ function iBeforeE() -check('http://wiki.puzzlers.org/pub/wordlists/unixdict.txt'); +check('https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt'); fprintf('\n'); check('http://ucrel.lancs.ac.uk/bncfreq/lists/1_2_all_freq.txt'); end diff --git a/Task/I-before-E-except-after-C/Maple/i-before-e-except-after-c.maple b/Task/I-before-E-except-after-C/Maple/i-before-e-except-after-c.maple index 8bf9b10be0..12d72b4118 100644 --- a/Task/I-before-E-except-after-C/Maple/i-before-e-except-after-c.maple +++ b/Task/I-before-E-except-after-C/Maple/i-before-e-except-after-c.maple @@ -1,22 +1,22 @@ -words:= HTTP:-Get("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt"): +words:= HTTP:-Get("https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt"): lst := StringTools:-Split(words[2],"\n"): xie, cie, cei, xei := 0, 0, 0, 0: for item in lst do - if searchtext("ie", item) <> 0 then - if searchtext("cie", item) <> 0 then - cie := cie + 1: - else - xie := xie + 1: - fi: - fi: - if searchtext("ei", item) <> 0 then - if searchtext("cei", item) <> 0 then - cei := cei + 1: - else - xei := xei + 1: - fi: - fi: -od: + if searchtext("ie", item) <> 0 then + if searchtext("cie", item) <> 0 then + cie := cie + 1: + else + xie := xie + 1: + fi: + fi: + if searchtext("ei", item) <> 0 then + if searchtext("cei", item) <> 0 then + cei := cei + 1: + else + xei := xei + 1: + fi: + fi: +od: p1, p2 := evalb(xie > 2*xei),evalb(cei > 2*cie); printf("The first phrase is %s with supporting features %d, anti features %d\n", piecewise(p1, "plausible", "not plausible"), xie, xei); printf("The seond phrase is %s with supporting features %d, anti features %d\n", piecewise(p2, "plausible", "not plausible"), cei, cie); diff --git a/Task/I-before-E-except-after-C/Mathematica/i-before-e-except-after-c-1.math b/Task/I-before-E-except-after-C/Mathematica/i-before-e-except-after-c-1.math index 62109c191c..38e8577727 100644 --- a/Task/I-before-E-except-after-C/Mathematica/i-before-e-except-after-c-1.math +++ b/Task/I-before-E-except-after-C/Mathematica/i-before-e-except-after-c-1.math @@ -1,5 +1,5 @@ wordlist = - Import["http://wiki.puzzlers.org/pub/wordlists/unixdict.txt", + Import["https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt", "Words"]; Print["The number of words in unixdict.txt = " <> ToString[Length[wordlist]]] diff --git a/Task/I-before-E-except-after-C/Microsoft-Small-Basic/i-before-e-except-after-c.basic b/Task/I-before-E-except-after-C/Microsoft-Small-Basic/i-before-e-except-after-c.basic new file mode 100644 index 0000000000..b7b18e8361 --- /dev/null +++ b/Task/I-before-E-except-after-C/Microsoft-Small-Basic/i-before-e-except-after-c.basic @@ -0,0 +1,25 @@ +For i = 1 To 25104 + ' Assumes that unixdict.txt is in C:\ + word = File.ReadLine("C:\unixdict.txt", i) + If Text.IsSubText(word, "cie") Then + cie = cie + 1 + ElseIf Text.IsSubText(word, "ie") Then + ie = ie + 1 + EndIf + If Text.IsSubText(word, "cei") Then + cei = cei + 1 + ElseIf Text.IsSubText(word, "ei") Then + ei = ei + 1 + EndIf +EndFor + +If ie / ei > 2 Then + TextWindow.WriteLine("I before E when not preceded by C is plausible") +Else + TextWindow.WriteLine("I before E when not preceded by C is not plausible") +EndIf +If cei / cie > 2 Then + TextWindow.WriteLine("E before I when preceded by C is plausible") +Else + TextWindow.WriteLine("E before I when preceded by C is not plausible") +EndIf diff --git a/Task/I-before-E-except-after-C/Nim/i-before-e-except-after-c.nim b/Task/I-before-E-except-after-C/Nim/i-before-e-except-after-c.nim index 2a549064b1..41a8ff75bf 100644 --- a/Task/I-before-E-except-after-C/Nim/i-before-e-except-after-c.nim +++ b/Task/I-before-E-except-after-C/Nim/i-before-e-except-after-c.nim @@ -17,7 +17,7 @@ proc plausibility(rule: string; count1, count2: int): bool = let client = newHttpClient() var nie, cie, nei, cei = 0 -for word in client.getContent("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt").split(): +for word in client.getContent("https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt").split(): if word.contains("ie"): if word.contains("cie"): inc cie diff --git a/Task/I-before-E-except-after-C/Nu/i-before-e-except-after-c-1.nu b/Task/I-before-E-except-after-C/Nu/i-before-e-except-after-c-1.nu new file mode 100644 index 0000000000..2c9926743c --- /dev/null +++ b/Task/I-before-E-except-after-C/Nu/i-before-e-except-after-c-1.nu @@ -0,0 +1,32 @@ +# Fetch and process the word list +let words = open unixdict.txt | lines | where { ($in | str length) > 3 } + +# Function to count matches for a pattern +def count-pattern [pattern: string] { + $words | where $it =~ $pattern | length +} + +# Count occurrences for "I before E" rule +let ie_not_c = (count-pattern "(^|[^c])ie") # ie not preceded by c +let ei_not_c = (count-pattern "(^|[^c])ei") # ei not preceded by c + +# Count occurrences for "E before I" rule +let cei = (count-pattern "cei") # ei preceded by c +let cie = (count-pattern "cie") # ie preceded by c + +# Check plausibility (more than 2x occurrences of opposite) +let rule1_plausible = ($ie_not_c > ($ei_not_c * 2)) +let rule2_plausible = ($cei > ($cie * 2)) + +# Output results +print [ + $"Analyzing 'I before E when not preceded by C':" + $" correct for : ($ie_not_c)" + $" not correct for : ($ei_not_c)" + $" Plausible: ($rule1_plausible)" + $"" + $"Analyzing 'E before I when preceded by C':" + $" correct for : ($cei)" + $" not correct for : ($cie)" + $" Plausible: ($rule2_plausible)" + ] diff --git a/Task/I-before-E-except-after-C/Nu/i-before-e-except-after-c-2.nu b/Task/I-before-E-except-after-C/Nu/i-before-e-except-after-c-2.nu new file mode 100644 index 0000000000..4519c2d750 --- /dev/null +++ b/Task/I-before-E-except-after-C/Nu/i-before-e-except-after-c-2.nu @@ -0,0 +1,48 @@ +# Fetch and filter words +let words = open unixdict.txt | lines | where { $in | str length | $in > 3 } + +# Define patterns and their processing in a functional way +let patterns = [ + { name: "ie_not_c", pattern: "(^|[^c])ie", desc: "I before E when not preceded by C" } + { name: "ei_not_c", pattern: "(^|[^c])ei", desc: null } + { name: "cei", pattern: "cei", desc: "E before I when preceded by C" } + { name: "cie", pattern: "cie", desc: null } +] + +# Count matches for each pattern functionally +let counts = $patterns | + each { |p| + $p | upsert count ($words | where $it =~ $p.pattern | length) + } + +# Calculate plausibility using match +let results = $counts | + each { |row| + match $row.name { + "ie_not_c" => { + let opposite = ($counts | where name == "ei_not_c" | get count.0) + $row | upsert plausible ($row.count > ($opposite * 2)) + } + "cei" => { + let opposite = ($counts | where name == "cie" | get count.0) + $row | upsert plausible ($row.count > ($opposite * 2)) + } + _ => $row + } + } + +# Format and print results functionally +$results | + where desc != null | + each { |rule| + let opposite = ($results | where name == (if $rule.name == "ie_not_c" { "ei_not_c" } else { "cie" }) | get 0) + [ + $"Analyzing '($rule.desc)':" + $" correct for : ($rule.count)" + $" not correct for : ($opposite.count)" + $" Plausible: ($rule.plausible)" + "" + ] + } | + flatten | + print $in diff --git a/Task/I-before-E-except-after-C/Objeck/i-before-e-except-after-c.objeck b/Task/I-before-E-except-after-C/Objeck/i-before-e-except-after-c.objeck index 637dc3013a..eb0643dc33 100644 --- a/Task/I-before-E-except-after-C/Objeck/i-before-e-except-after-c.objeck +++ b/Task/I-before-E-except-after-C/Objeck/i-before-e-except-after-c.objeck @@ -3,7 +3,7 @@ use Collection; class HttpTest { function : Main(args : String[]) ~ Nil { - IsPlausibleRule("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt"); + IsPlausibleRule("https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt"); } function : PlausibilityCheck(comment : String, x : Int, y : Int) ~ Bool { diff --git a/Task/I-before-E-except-after-C/Octave/i-before-e-except-after-c.octave b/Task/I-before-E-except-after-C/Octave/i-before-e-except-after-c.octave index adc2b9f124..3eb8bf3576 100644 --- a/Task/I-before-E-except-after-C/Octave/i-before-e-except-after-c.octave +++ b/Task/I-before-E-except-after-C/Octave/i-before-e-except-after-c.octave @@ -6,27 +6,27 @@ cei = 0; nie = 0; cie = 0; while ~feof(fid) - c = strsplit(strtrim(fgetl(fid)),char([9,32])); - if length(c) > 2, - n = str2num(c{3}); - else - n = 1; - end; - if strfind(c{1},'ei')>1, nei=nei+n; end; - if strfind(c{1},'cei'), cei=cei+n; end; - if strfind(c{1},'ie')>1, nie=nie+n; end; - if strfind(c{1},'cie'), cie=cie+n; end; + c = strsplit(strtrim(fgetl(fid)),char([9,32])); + if length(c) > 2, + n = str2num(c{3}); + else + n = 1; + end; + if strfind(c{1},'ei')>1, nei=nei+n; end; + if strfind(c{1},'cei'), cei=cei+n; end; + if strfind(c{1},'ie')>1, nie=nie+n; end; + if strfind(c{1},'cie'), cie=cie+n; end; end; fclose(fid); printf('cie: %i\nnie: %i\ncei: %i\nnei: %i\n',cie,nie-cie,cei,nei-cei); v = ''; if (nie < 3 * cie) - v=' not'; + v=' not'; end printf('I before E when not preceded by C: is%s plausible\n',v); v = ''; if (nei > 3 * cei) - v=' not'; + v=' not'; end printf('E before I when preceded by C: is%s plausible\n',v); diff --git a/Task/I-before-E-except-after-C/PascalABC.NET/i-before-e-except-after-c.pas b/Task/I-before-E-except-after-C/PascalABC.NET/i-before-e-except-after-c.pas new file mode 100644 index 0000000000..4a3d98472f --- /dev/null +++ b/Task/I-before-E-except-after-C/PascalABC.NET/i-before-e-except-after-c.pas @@ -0,0 +1,11 @@ +// I before E except after C. Nigel Galloway: September 30th., 2024 +type plausibility=(plausible,implausible); +var fN:string->string->integer:=n->g->System.Text.RegularExpressions.Regex.Matches(n,g).count; +var fG:Func->(array of integer)->array of integer:=n->g->g.Zip(|n('ie'),n('ei'),n('cie'),n('cei')|,(n,g)->n+g).ToArray; +begin + var n:=System.IO.File.ReadLines('unixdict.txt').Aggregate(|0,0,0,0|,(n,g)->fG(fN(g))(n)); + println($'I before E except after C is {if n[0]-n[2]>2*n[2] then plausible else implausible}'); + println($'E before I except after C is {if n[1]-n[3]>2*n[3] then plausible else implausible}'); + println($'I before E when after C is {if n[2]>2*n[3] then plausible else implausible}'); + println($'E before I when after C is {if n[3]>2*n[2] then plausible else implausible}'); +end. diff --git a/Task/I-before-E-except-after-C/PowerShell/i-before-e-except-after-c.ps1 b/Task/I-before-E-except-after-C/PowerShell/i-before-e-except-after-c.ps1 new file mode 100644 index 0000000000..c3e30c0516 --- /dev/null +++ b/Task/I-before-E-except-after-C/PowerShell/i-before-e-except-after-c.ps1 @@ -0,0 +1,29 @@ +$Web = New-Object -TypeName Net.Webclient +$Words = $web.DownloadString('https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt') + +$IE = $EI = $CIE = $CEI = @() + +$Clause1 = $Clause2 = $MainClause = $false + +foreach ($Word in $Words.split()) +{ + switch ($Word) + { + {($_ -like '*ie*') -and ($_ -notlike '*cie*')} {$IE += $Word} + {($_ -like '*ei*') -and ($_ -notlike '*cei*')} {$EI += $Word} + {$_ -like '*cei*'} {$CEI += $Word} + {$_ -like '*cie*'} {$CIE += $Word} + } +} + +if ($IE.count -gt $EI.count * 2) +{$Clause1 = $true} +"The plausibility of 'I before E when not preceded by C' is $Clause1" + +if ($CEI.count -gt $CIE.count * 2) +{$Clause2 = $true} +"The plausibility of 'E before I when preceded by C' is $Clause2" + +if ($Clause1 -and $Clause2) +{$MainClause = $True} +"The plausibility of the phrase 'I before E except after C' is $MainClause" diff --git a/Task/I-before-E-except-after-C/PowerShell/i-before-e-except-after-c.psh b/Task/I-before-E-except-after-C/PowerShell/i-before-e-except-after-c.psh deleted file mode 100644 index c1c8f167b4..0000000000 --- a/Task/I-before-E-except-after-C/PowerShell/i-before-e-except-after-c.psh +++ /dev/null @@ -1,29 +0,0 @@ -$Web = New-Object -TypeName Net.Webclient -$Words = $web.DownloadString('http://wiki.puzzlers.org/pub/wordlists/unixdict.txt') - -$IE = $EI = $CIE = $CEI = @() - -$Clause1 = $Clause2 = $MainClause = $false - -foreach ($Word in $Words.split()) -{ - switch ($Word) - { - {($_ -like '*ie*') -and ($_ -notlike '*cie*')} {$IE += $Word} - {($_ -like '*ei*') -and ($_ -notlike '*cei*')} {$EI += $Word} - {$_ -like '*cei*'} {$CEI += $Word} - {$_ -like '*cie*'} {$CIE += $Word} - } -} - -if ($IE.count -gt $EI.count * 2) -{$Clause1 = $true} -"The plausibility of 'I before E when not preceded by C' is $Clause1" - -if ($CEI.count -gt $CIE.count * 2) -{$Clause2 = $true} -"The plausibility of 'E before I when preceded by C' is $Clause2" - -if ($Clause1 -and $Clause2) -{$MainClause = $True} -"The plausibility of the phrase 'I before E except after C' is $MainClause" diff --git a/Task/I-before-E-except-after-C/Python/i-before-e-except-after-c-1.py b/Task/I-before-E-except-after-C/Python/i-before-e-except-after-c-1.py index 4d00caa257..081cfb99da 100644 --- a/Task/I-before-E-except-after-C/Python/i-before-e-except-after-c-1.py +++ b/Task/I-before-E-except-after-C/Python/i-before-e-except-after-c-1.py @@ -17,7 +17,7 @@ def plausibility_check(comment, x, y): % (x, y, x / y)) return x > PLAUSIBILITY_RATIO * y -def simple_stats(url='http://wiki.puzzlers.org/pub/wordlists/unixdict.txt'): +def simple_stats(url='https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt'): words = urllib.request.urlopen(url).read().decode().lower().split() cie = len({word for word in words if 'cie' in word}) cei = len({word for word in words if 'cei' in word}) diff --git a/Task/I-before-E-except-after-C/R/i-before-e-except-after-c.r b/Task/I-before-E-except-after-C/R/i-before-e-except-after-c.r index aa3ad856c5..8756b79215 100644 --- a/Task/I-before-E-except-after-C/R/i-before-e-except-after-c.r +++ b/Task/I-before-E-except-after-C/R/i-before-e-except-after-c.r @@ -1,4 +1,4 @@ -words = tolower(readLines("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt")) +words = tolower(readLines("https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt")) ie.npc = sum(grepl("(?2) )'plausible.' -p2=#.ie.c / max(1, #.ei.c); phrase= '"E before I when preceded by C"' -say mantra phrase ' is ' word("im", 1 + (p2>2) )'plausible.' -po=(p1>2 & p2>2); say 'Overall, it is' word("im", 1 + po)'plausible.' -exit /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -find: arg x; s=1; do forever; _=pos(x, u, s); if _==0 then return - if substr(u, _ - 1 + (_==1)*999, 1)=='C' then #.x.c=#.x.c + 1 - else #.x.z=#.x.z + 1 - s=_ + 1 /*handle the cases of multiple finds. */ - end /*forever*/ diff --git a/Task/I-before-E-except-after-C/REXX/i-before-e-except-after-c-2.rexx b/Task/I-before-E-except-after-C/REXX/i-before-e-except-after-c-2.rexx deleted file mode 100644 index 59c7da9267..0000000000 --- a/Task/I-before-E-except-after-C/REXX/i-before-e-except-after-c-2.rexx +++ /dev/null @@ -1,61 +0,0 @@ -/*REXX program shows plausibility of "I before E" when not preceded by C, and */ -/*───────────────────────────────────── "E before I" when preceded by C, using a */ -/*───────────────────────────────────── weighted frequency for each word. */ -parse arg iFID wFID . /*obtain optional arguments from the CL*/ -if iFID=='' | iFID=="," then iFID='UNIXDICT.TXT' /*Not specified? Then use the default.*/ -if wFID=='' | wFID=="," then wFID='WORDFREQ.TXT' /* " " " " " " */ -cntl=xrange(, ' ') /*get all manner of tabs, control chars*/ -#.=0 /*zero out the various word counters. */ -f.=1 /*default word frequency multiplier. */ - do recs=0 while lines(wFID)\==0 /*read a record from the file 'til done*/ - u=translate( linein(wFID), , cntl); upper u /*translate various tabs and cntl chars*/ - u=translate(u, '*', "~") /*translate tildes (~) to an asterisk.*/ - if u=='' then iterate /*Is this a blank line? Then ignore it.*/ - freq=word(u, words(u) ) /*obtain the last token on the line. */ - if \datatype(freq, 'W') then iterate /*FREQ not an integer? Then ignore it.*/ - parse var u w.1 '/' w.2 . /*handle case of: ααα/ßßß ··· */ - - do j=1 for 2; w.j=word(w.j, 1) /*strip leading and/or trailing blanks.*/ - _=w.j; if _=='' then iterate /*if not present, then ignore it. */ - if j==2 then if w.2==w.1 then iterate /*second word ≡ first word? Then skip.*/ - #.freqs=#.freqs + 1 /*bump word counter in the FREQ list.*/ - f._=f._ + freq /*add to a word's frequency count. */ - end /*ws*/ - end /*recs*/ /*at exit of DO loop, RECS = # of recs.*/ - -if recs\==0 then say 'lines in the ' wFID " list: " recs -if #.freqs\==0 then say 'words in the ' wFID " list: " #.freqs -if #.freqs ==0 then weighted= - else weighted= ' (weighted)' -say - do r=0 while lines(iFID)\==0 /*keep reading the dictionary 'til done*/ - u=space( linein(iFID), 0); upper u /*elide superfluous blanks and tabs. */ - if u=='' then iterate /*Is it a blank line? Then ignore it.*/ - #.words=#.words + 1 /*keep running count of number of words*/ - one=f.u - if pos('EI', u)\==0 & pos('IE', u)\==0 then #.both=#.both + one /*the word has both*/ - call find 'ie' /*look for ie */ - call find 'ei' /* " " ei */ - end /*r*/ /*at exit of DO loop, R = # of lines.*/ - -L=length(#.words) /*use this to align the output numbers.*/ -say 'lines in the ' iFID ' dictionary: ' r -say 'words in the ' iFID ' dictionary: ' #.words -say -say 'words with "IE" and "EI" (in same word): ' right(#.both, L) weighted -say 'words with "IE" and preceded by "C": ' right(#.ie.c ,L) weighted -say 'words with "IE" and not preceded by "C": ' right(#.ie.z ,L) weighted -say 'words with "EI" and preceded by "C": ' right(#.ei.c ,L) weighted -say 'words with "EI" and not preceded by "C": ' right(#.ei.z ,L) weighted -say; mantra= 'The spelling mantra ' -p1=#.ie.z / max(1, #.ei.z); phrase= '"I before E when not preceded by C"' -say mantra phrase ' is ' word("im", 1 + (p1>2) )'plausible.' -p2=#.ie.c / max(1, #.ei.c); phrase= '"E before I when preceded by C"' -say mantra phrase ' is ' word("im", 1 + (p2>2) )'plausible.' -po=(p1>2 & p2>2); say 'Overall, it is' word("im",1 + po)'plausible.' -exit /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -find: arg x; s=1; do forever; _=pos(x, u, s); if _==0 then return - if substr(u, _ - 1 + (_==1)*999, 1)=='C' then #.x.c=#.x.c + one - else #.x.z=#.x.z + one - s=_ + 1 /*handle the cases of multiple finds. */ diff --git a/Task/I-before-E-except-after-C/REXX/i-before-e-except-after-c.rexx b/Task/I-before-E-except-after-C/REXX/i-before-e-except-after-c.rexx new file mode 100644 index 0000000000..febe0ab972 --- /dev/null +++ b/Task/I-before-E-except-after-C/REXX/i-before-e-except-after-c.rexx @@ -0,0 +1,59 @@ +-- 10 Nov 2025 +include Setting + +say 'I BEFORE E AFTER C' +say version +say +call UnixDict +call Show +exit + +UnixDict: +file='UnixDict.txt' +say 'Process' file'...' +n=0; cie=0; cei=0; xie=0; xei=0 +do while Lines(file) > 0 + line=Lower(Linein(file)); n+=1 + a=Pos('ie',line) + if a>0 then do + a+=99*(a<2) + if Substr(line,a-1,1)='c' then + cie+=1 + else + xie+=1 + end + a=Pos('ei',line) + if a>0 then do + a+=99*(a<2) + if Substr(line,a-1,1)='c' then + cei+=1 + else + xei+=1 + end +end +say n 'Lines processed' +say +return + +Show: +say 'IE preceded by C occurs' cie 'times' +say 'EI preceded by C occurs' cei 'times' +say 'IE not preceded by C occurs' xie 'times' +say 'EI not preceded by C occurs' xei 'times' +say +ie=(2*xie<=cie); ei=(2*cei<=xei) +call Charout ,'I before E when not preceded by C is ' +if ie then + call Charout ,'not ' +say 'plausible' +call Charout ,'E before I when preceded by C is ' +if ei then + call Charout ,'not ' +say 'plausible' +call Charout ,'I before E except after C is ' +if ie | ei then + call Charout ,'not ' +say 'plausible' +return + +include Abend diff --git a/Task/I-before-E-except-after-C/Rebol/i-before-e-except-after-c.rebol b/Task/I-before-E-except-after-C/Rebol/i-before-e-except-after-c.rebol new file mode 100644 index 0000000000..53e916ca1b --- /dev/null +++ b/Task/I-before-E-except-after-C/Rebol/i-before-e-except-after-c.rebol @@ -0,0 +1,50 @@ +Rebol [ + title: "Rosetta code: I before E except after C" + file: %I_before_E_except_after_C.r3 + url: https://rosettacode.org/wiki/I_before_E_except_after_C + note: "Based on Red language solution" + needs: 3.15.0 ;; or something like that +] + +testlist: function [wordlist /wfreq] [ + ;; Initialize counters for each pattern + cie: cei: ie: ei: 0 + + ;; Select iteration mode: if /wfreq, expect [word freq] pairs; else assume word-only + words: either wfreq [[word freq]][freq: 1 [word]] + + ;; Loop through each word or [word freq] pair in the list + foreach :words wordlist [ + ;; Use PARSE to search for each pattern within the word string + parse word [ some [ + "cie" (cie: cie + freq) | ;; Count "cie" and increment by frequency + "cei" (cei: cei + freq) | ;; Count "cei" and increment by frequency + "ie" ( ie: ie + freq) | ;; Count standalone "ie" not preceded by c + "ei" ( ei: ei + freq) | ;; Count standalone "ei" not preceded by c + skip + ]] + ] + ;; Print results, comparing "i before e except after c" rule against pattern frequencies + print rejoin [ + "i is before e " ie " times, and also " cie " times following c.^/" + "i is after e " ei " times, and also " cei " times following c.^/" + "Hence ^"i before e^" is " either a: 2 * ei < ie [""] ["not "] "plausible,^/" + "while ^"except after c^" is " either b: 2 * cie < cei [""] ["not "] "plausible.^/" + "Overall the rule is " either a and b [""] ["not "] "plausible." + ] +] + +print "Results for unixdict.txt:" +testlist read/lines %unixdict.txt + +print "^/Results for British National Corpus:" +bnc: next read/lines %1_2_all_freq.txt +spaces: charset "^- " +bnclist: collect [ + foreach w bnc [ + if 3 = length? seq: split trim w spaces [ + keep seq/1 keep to-integer seq/3 + ] + ] +] +testlist/wfreq bnclist diff --git a/Task/I-before-E-except-after-C/Red/i-before-e-except-after-c.red b/Task/I-before-E-except-after-C/Red/i-before-e-except-after-c.red index b7e21dc1e8..4589f32f1b 100644 --- a/Task/I-before-E-except-after-C/Red/i-before-e-except-after-c.red +++ b/Task/I-before-E-except-after-C/Red/i-before-e-except-after-c.red @@ -1,33 +1,33 @@ Red ["i before e except after c"] testlist: function [wordlist /wfreq] [ - cie: cei: ie: ei: 0 - if not wfreq [forall wordlist [insert wordlist: next wordlist 1]] - foreach [word freq] wordlist [ - parse word [ some [ - "cie" (cie: cie + freq) | - "cei" (cei: cei + freq) | - "ie" (ie: ie + freq) | - "ei" (ei: ei + freq) | - skip - ]] - ] - print rejoin [ - "i is before e " ie " times, and also " cie " times following c.^/" - "i is after e " ei " times, and also " cei " times following c.^/" - "Hence ^"i before e^" is " either a: 2 * ei < ie [""] ["not "] "plausible,^/" - "while ^"except after c^" is " either b: 2 * cie < cei [""] ["not "] "plausible.^/" - "Overall the rule is " either a and b [""] ["not "] "plausible."] + cie: cei: ie: ei: 0 + if not wfreq [forall wordlist [insert wordlist: next wordlist 1]] + foreach [word freq] wordlist [ + parse word [ some [ + "cie" (cie: cie + freq) | + "cei" (cei: cei + freq) | + "ie" (ie: ie + freq) | + "ei" (ei: ei + freq) | + skip + ]] + ] + print rejoin [ + "i is before e " ie " times, and also " cie " times following c.^/" + "i is after e " ei " times, and also " cei " times following c.^/" + "Hence ^"i before e^" is " either a: 2 * ei < ie [""] ["not "] "plausible,^/" + "while ^"except after c^" is " either b: 2 * cie < cei [""] ["not "] "plausible.^/" + "Overall the rule is " either a and b [""] ["not "] "plausible."] ] print "Results for unixdict.txt:" -testlist read/lines http://wiki.puzzlers.org/pub/wordlists/unixdict.txt +testlist read/lines https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt print "^/Results for British National Corpus:" bnc: next read/lines %1_2_all_freq.txt spaces: charset "^- " -bnclist: collect [ foreach w bnc [ - if 3 = length? seq: split trim w spaces [ - keep seq/1 keep to-integer seq/3 +bnclist: collect [ foreach w bnc [ + if 3 = length? seq: split trim w spaces [ + keep seq/1 keep to-integer seq/3 ]]] testlist/wfreq bnclist diff --git a/Task/I-before-E-except-after-C/Ruby/i-before-e-except-after-c.rb b/Task/I-before-E-except-after-C/Ruby/i-before-e-except-after-c.rb index 566bf86072..8c07c86b90 100644 --- a/Task/I-before-E-except-after-C/Ruby/i-before-e-except-after-c.rb +++ b/Task/I-before-E-except-after-C/Ruby/i-before-e-except-after-c.rb @@ -2,7 +2,7 @@ require 'open-uri' plausibility_ratio = 2 counter = Hash.new(0) -path = 'http://wiki.puzzlers.org/pub/wordlists/unixdict.txt' +path = 'https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt' rules = [['I before E when not preceded by C:', 'ie', 'ei'], ['E before I when preceded by C:', 'cei', 'cie']] diff --git a/Task/I-before-E-except-after-C/Rust/i-before-e-except-after-c.rs b/Task/I-before-E-except-after-C/Rust/i-before-e-except-after-c.rs new file mode 100644 index 0000000000..f1f0733b63 --- /dev/null +++ b/Task/I-before-E-except-after-C/Rust/i-before-e-except-after-c.rs @@ -0,0 +1,79 @@ +use std::default::Default; +use std::ops::AddAssign; + +use itertools::Itertools; +use reqwest::get; + +#[derive(Default, Debug)] +struct Feature { + pub cie: T, + pub xie: T, + pub cei: T, + pub xei: T, +} + +impl AddAssign> for Feature { + fn add_assign(&mut self, rhs: Feature) { + self.cei += rhs.cei as u64; + self.xei += rhs.xei as u64; + self.cie += rhs.cie as u64; + self.xie += rhs.xie as u64; + } +} + +fn check_feature(word: &str) -> Feature { + let mut feature: Feature = Default::default(); + + for window in word.chars().tuple_windows::<(char, char, char)>() { + match window { + ('c', 'e', 'i') => { feature.cei = true } + ('c', 'i', 'e') => { feature.cie = true } + (not_c, 'e', 'i') if not_c != 'c' => (feature.xei = true), + (not_c, 'i', 'e') if not_c != 'c' => (feature.xie = true), + _ => {} + } + } + + feature +} + + +fn maybe_is_feature_plausible(feature_count: u64, opposing_count: u64) -> Option { + if feature_count > 2 * opposing_count { Some(true) } else if opposing_count > 2 * feature_count { Some(false) } else { None } +} + +fn print_feature_plausibility(feature_plausibility: Option, feature_name: &str) { + let plausible_msg = + match feature_plausibility { + None => " is implausible", + Some(true) => "is plausible", + Some(false) => "is definitely implausible", + }; + + println!("{} {}", feature_name, plausible_msg) +} + +fn main() { + let mut res = get(" https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt").unwrap(); + let texts = res.text().unwrap(); + + let mut feature_count: Feature = Default::default(); + for word in texts.lines() { + let feature = check_feature(word); + feature_count += feature; + } + + println!("Counting {:#?}", feature_count); + + let xie_plausibility = + maybe_is_feature_plausible(feature_count.xie, feature_count.cie); + let cei_plausibility = + maybe_is_feature_plausible(feature_count.cei, feature_count.xei); + + print_feature_plausibility(xie_plausibility, "I before E when not preceded by C"); + print_feature_plausibility(cei_plausibility, "E before I when preceded by C"); + println!("The rule in general is {}", + if xie_plausibility.unwrap_or(false) && cei_plausibility.unwrap_or(false) + { "Plausible" } else { "Implausible" } + ); +} diff --git a/Task/I-before-E-except-after-C/Rust/i-before-e-except-after-c.rust b/Task/I-before-E-except-after-C/Rust/i-before-e-except-after-c.rust deleted file mode 100644 index 8682f51edb..0000000000 --- a/Task/I-before-E-except-after-C/Rust/i-before-e-except-after-c.rust +++ /dev/null @@ -1,79 +0,0 @@ -use std::default::Default; -use std::ops::AddAssign; - -use itertools::Itertools; -use reqwest::get; - -#[derive(Default, Debug)] -struct Feature { - pub cie: T, - pub xie: T, - pub cei: T, - pub xei: T, -} - -impl AddAssign> for Feature { - fn add_assign(&mut self, rhs: Feature) { - self.cei += rhs.cei as u64; - self.xei += rhs.xei as u64; - self.cie += rhs.cie as u64; - self.xie += rhs.xie as u64; - } -} - -fn check_feature(word: &str) -> Feature { - let mut feature: Feature = Default::default(); - - for window in word.chars().tuple_windows::<(char, char, char)>() { - match window { - ('c', 'e', 'i') => { feature.cei = true } - ('c', 'i', 'e') => { feature.cie = true } - (not_c, 'e', 'i') if not_c != 'c' => (feature.xei = true), - (not_c, 'i', 'e') if not_c != 'c' => (feature.xie = true), - _ => {} - } - } - - feature -} - - -fn maybe_is_feature_plausible(feature_count: u64, opposing_count: u64) -> Option { - if feature_count > 2 * opposing_count { Some(true) } else if opposing_count > 2 * feature_count { Some(false) } else { None } -} - -fn print_feature_plausibility(feature_plausibility: Option, feature_name: &str) { - let plausible_msg = - match feature_plausibility { - None => " is implausible", - Some(true) => "is plausible", - Some(false) => "is definitely implausible", - }; - - println!("{} {}", feature_name, plausible_msg) -} - -fn main() { - let mut res = get(" http://wiki.puzzlers.org/pub/wordlists/unixdict.txt").unwrap(); - let texts = res.text().unwrap(); - - let mut feature_count: Feature = Default::default(); - for word in texts.lines() { - let feature = check_feature(word); - feature_count += feature; - } - - println!("Counting {:#?}", feature_count); - - let xie_plausibility = - maybe_is_feature_plausible(feature_count.xie, feature_count.cie); - let cei_plausibility = - maybe_is_feature_plausible(feature_count.cei, feature_count.xei); - - print_feature_plausibility(xie_plausibility, "I before E when not preceded by C"); - print_feature_plausibility(cei_plausibility, "E before I when preceded by C"); - println!("The rule in general is {}", - if xie_plausibility.unwrap_or(false) && cei_plausibility.unwrap_or(false) - { "Plausible" } else { "Implausible" } - ); -} diff --git a/Task/I-before-E-except-after-C/SETL/i-before-e-except-after-c.setl b/Task/I-before-E-except-after-C/SETL/i-before-e-except-after-c.setl new file mode 100644 index 0000000000..1632b84178 --- /dev/null +++ b/Task/I-before-E-except-after-C/SETL/i-before-e-except-after-c.setl @@ -0,0 +1,34 @@ +program i_before_e_except_after_c; + init cie := 0, xie := 0, cei := 0, xei := 0; + + dict := open("unixdict.txt", "r"); + loop doing word := getline(dict); while word /= om do + classify(word); + end loop; + close(dict); + + p := + plausible("I before E when not preceded by C", xie, cie) and + plausible("E before I when preceded by C", cei, xei); + print; + print("I before E, except after C:" + (if p then "" else " not" end) + + " plausible."); + + proc classify(word); + if "ie" in word then + if "cie" in word then cie +:= 1; + else xie +:= 1; + end if; + elseif "ei" in word then + if "cei" in word then cei +:= 1; + else xei +:= 1; + end if; + end if; + end proc; + + proc plausible(clause, feature, opposite); + p := 2 * feature > opposite; + print(clause + ":" + (if p then "" else " not" end) + " plausible."); + return p; + end proc; +end program; diff --git a/Task/I-before-E-except-after-C/Scala/i-before-e-except-after-c.scala b/Task/I-before-E-except-after-C/Scala/i-before-e-except-after-c.scala index f1455bf125..2a27cab5c3 100644 --- a/Task/I-before-E-except-after-C/Scala/i-before-e-except-after-c.scala +++ b/Task/I-before-E-except-after-C/Scala/i-before-e-except-after-c.scala @@ -7,7 +7,7 @@ object I_before_E_except_after_C extends App { val testCEI2 = "(^|[^c])ei".r // e before i when not preceded by c var countsCEI = (0,0) - scala.io.Source.fromURL("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt").getLines.map(_.toLowerCase).foreach{word => + scala.io.Source.fromURL("https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt").getLines.map(_.toLowerCase).foreach{word => if (testIE1.findFirstIn(word).isDefined) countsIE = (countsIE._1 + 1, countsIE._2) if (testIE2.findFirstIn(word).isDefined) countsIE = (countsIE._1, countsIE._2 + 1) if (testCEI1.findFirstIn(word).isDefined) countsCEI = (countsCEI._1 + 1, countsCEI._2) diff --git a/Task/I-before-E-except-after-C/Swift/i-before-e-except-after-c.swift b/Task/I-before-E-except-after-C/Swift/i-before-e-except-after-c.swift index ed3120606c..14028c69b2 100644 --- a/Task/I-before-E-except-after-C/Swift/i-before-e-except-after-c.swift +++ b/Task/I-before-E-except-after-C/Swift/i-before-e-except-after-c.swift @@ -1,6 +1,6 @@ import Foundation -let request = NSURLRequest(URL: NSURL(string: "http://wiki.puzzlers.org/pub/wordlists/unixdict.txt")!) +let request = NSURLRequest(URL: NSURL(string: "https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt")!) NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue()) {res, data, err in if (data != nil) { diff --git a/Task/I-before-E-except-after-C/TUSCRIPT/i-before-e-except-after-c.tu b/Task/I-before-E-except-after-C/TUSCRIPT/i-before-e-except-after-c.tu index 736ae22160..e0b0fd9e71 100644 --- a/Task/I-before-E-except-after-C/TUSCRIPT/i-before-e-except-after-c.tu +++ b/Task/I-before-E-except-after-C/TUSCRIPT/i-before-e-except-after-c.tu @@ -1,5 +1,5 @@ $$ MODE TUSCRIPT,{} -words=REQUEST("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt") +words=REQUEST("https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt") size=SIZE(words) ieei=cie=xie=cei=xei=0 diff --git a/Task/I-before-E-except-after-C/Tcl/i-before-e-except-after-c.tcl b/Task/I-before-E-except-after-C/Tcl/i-before-e-except-after-c.tcl index e0a7b5692f..a3199937e3 100644 --- a/Task/I-before-E-except-after-C/Tcl/i-before-e-except-after-c.tcl +++ b/Task/I-before-E-except-after-C/Tcl/i-before-e-except-after-c.tcl @@ -5,24 +5,24 @@ proc plausible {description x y} { variable PLAUSIBILITY_RATIO puts " Checking plausibility of: $description" if {$x > $PLAUSIBILITY_RATIO * $y} { - set conclusion "PLAUSIBLE" - set fmt "As we have counts of %i vs %i words, a ratio of %.1f times" - set result true + set conclusion "PLAUSIBLE" + set fmt "As we have counts of %i vs %i words, a ratio of %.1f times" + set result true } elseif {$x > $y} { - set conclusion "IMPLAUSIBLE" - set fmt "As although we have counts of %i vs %i words," - append fmt " a ratio of %.1f times does not make it plausible" - set result false + set conclusion "IMPLAUSIBLE" + set fmt "As although we have counts of %i vs %i words," + append fmt " a ratio of %.1f times does not make it plausible" + set result false } else { - set conclusion "IMPLAUSIBLE, probably contra-indicated" - set fmt "As we have counts of %i vs %i words, a ratio of %.1f times" - set result false + set conclusion "IMPLAUSIBLE, probably contra-indicated" + set fmt "As we have counts of %i vs %i words, a ratio of %.1f times" + set result false } puts [format " %s.\n $fmt" $conclusion $x $y [expr {double($x)/$y}]] return $result } -set t [http::geturl http://wiki.puzzlers.org/pub/wordlists/unixdict.txt] +set t [http::geturl https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt] set words [split [http::data $t] "\n"] http::cleanup $t foreach {name pattern} {ie (?:^|[^c])ie ei (?:^|[^c])ei cie cie cei cei} { @@ -39,4 +39,4 @@ if { puts "\nOVERALL IT IS IMPLAUSIBLE!" } puts "\n(To be plausible, one word count must exceed another by\ - $PLAUSIBILITY_RATIO times)" + $PLAUSIBILITY_RATIO times)" diff --git a/Task/I-before-E-except-after-C/V-(Vlang)/i-before-e-except-after-c.v b/Task/I-before-E-except-after-C/V-(Vlang)/i-before-e-except-after-c.v index e677b3c2fa..1f88bdbb7a 100644 --- a/Task/I-before-E-except-after-C/V-(Vlang)/i-before-e-except-after-c.v +++ b/Task/I-before-E-except-after-C/V-(Vlang)/i-before-e-except-after-c.v @@ -2,26 +2,26 @@ import os import strconv fn main() { - mut cei, mut cie, mut ie, mut ei := f32(0), f32(0), f32(0), f32(0) + mut cei, mut cie, mut ie, mut ei := f32(0), f32(0), f32(0), f32(0) unixdict := os.read_file('./unixdict.txt') or {println('Error: file not found') exit(1)} - words := unixdict.split_into_lines() - println("The number of words in unixdict: ${words.len}") - for word in words { - cei += word.count('cei') - cie += word.count('cie') - ei += word.count('ei') - ie += word.count('ie') - } - print("Rule: 'e' before 'i' when preceded by 'c' at the ratio of ") - print("${strconv.f64_to_str_lnd1((cei / cie), 2)} is ") - if cei > cie {println("plausible.")} else {println("implausible.")} - println("$cei cases for and $cie cases against.") + words := unixdict.split_into_lines() + println("The number of words in unixdict: ${words.len}") + for word in words { + cei += word.count('cei') + cie += word.count('cie') + ei += word.count('ei') + ie += word.count('ie') + } + print("Rule: 'e' before 'i' when preceded by 'c' at the ratio of ") + print("${strconv.f64_to_str_lnd1((cei / cie), 2)} is ") + if cei > cie {println("plausible.")} else {println("implausible.")} + println("$cei cases for and $cie cases against.") - print("Rule: 'i' before 'e' except after 'c' at the ratio of ") - print("${strconv.f64_to_str_lnd1(((ie - cie) / (ei - cei)), 2)} is ") - if ie > ei {println("plausible.")} else {println("implausible.")} - println("${(ie - cie)} cases for and ${(ei - cei)} cases against.") + print("Rule: 'i' before 'e' except after 'c' at the ratio of ") + print("${strconv.f64_to_str_lnd1(((ie - cie) / (ei - cei)), 2)} is ") + if ie > ei {println("plausible.")} else {println("implausible.")} + println("${(ie - cie)} cases for and ${(ei - cei)} cases against.") - print("Overall the rules are ") - if cei > cie && ie > ei {println("plausible.")} else {println("implausible.")} + print("Overall the rules are ") + if cei > cie && ie > ei {println("plausible.")} else {println("implausible.")} } diff --git a/Task/I-before-E-except-after-C/VBScript/i-before-e-except-after-c.vb b/Task/I-before-E-except-after-C/VBScript/i-before-e-except-after-c.vb deleted file mode 100644 index 41f01c4eba..0000000000 --- a/Task/I-before-E-except-after-C/VBScript/i-before-e-except-after-c.vb +++ /dev/null @@ -1,48 +0,0 @@ -Set objFSO = CreateObject("Scripting.FileSystemObject") -Set srcFile = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) &_ - "\unixdict.txt",1,False,0) - -cei = 0 : cie = 0 : ei = 0 : ie = 0 - -Do Until srcFile.AtEndOfStream - word = srcFile.ReadLine - If InStr(word,"cei") Then - cei = cei + 1 - ElseIf InStr(word,"cie") Then - cie = cie + 1 - ElseIf InStr(word,"ei") Then - ei = ei + 1 - ElseIf InStr(word,"ie") Then - ie = ie + 1 - End If -Loop - -FirstClause = False -SecondClause = False -Overall = False - -'testing the first clause -If ie > ei*2 Then - WScript.StdOut.WriteLine "I before E when not preceded by C is plausible." - FirstClause = True -Else - WScript.StdOut.WriteLine "I before E when not preceded by C is NOT plausible." -End If - -'testing the second clause -If cei > cie*2 Then - WScript.StdOut.WriteLine "E before I when not preceded by C is plausible." - SecondClause = True -Else - WScript.StdOut.WriteLine "E before I when not preceded by C is NOT plausible." -End If - -'overall clause -If FirstClause And SecondClause Then - WScript.StdOut.WriteLine "Overall it is plausible." -Else - WScript.StdOut.WriteLine "Overall it is NOT plausible." -End If - -srcFile.Close -Set objFSO = Nothing diff --git a/Task/I-before-E-except-after-C/VBScript/i-before-e-except-after-c.vbs b/Task/I-before-E-except-after-C/VBScript/i-before-e-except-after-c.vbs new file mode 100644 index 0000000000..411c9183c1 --- /dev/null +++ b/Task/I-before-E-except-after-C/VBScript/i-before-e-except-after-c.vbs @@ -0,0 +1,48 @@ +Set objFSO = CreateObject("Scripting.FileSystemObject") +Set srcFile = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) &_ + "\unixdict.txt",1,False,0) + +cei = 0 : cie = 0 : ei = 0 : ie = 0 + +Do Until srcFile.AtEndOfStream + word = srcFile.ReadLine + If InStr(word,"cei") Then + cei = cei + 1 + ElseIf InStr(word,"cie") Then + cie = cie + 1 + ElseIf InStr(word,"ei") Then + ei = ei + 1 + ElseIf InStr(word,"ie") Then + ie = ie + 1 + End If +Loop + +FirstClause = False +SecondClause = False +Overall = False + +'testing the first clause +If ie > ei*2 Then + WScript.StdOut.WriteLine "I before E when not preceded by C is plausible." + FirstClause = True +Else + WScript.StdOut.WriteLine "I before E when not preceded by C is NOT plausible." +End If + +'testing the second clause +If cei > cie*2 Then + WScript.StdOut.WriteLine "E before I when not preceded by C is plausible." + SecondClause = True +Else + WScript.StdOut.WriteLine "E before I when not preceded by C is NOT plausible." +End If + +'overall clause +If FirstClause And SecondClause Then + WScript.StdOut.WriteLine "Overall it is plausible." +Else + WScript.StdOut.WriteLine "Overall it is NOT plausible." +End If + +srcFile.Close +Set objFSO = Nothing diff --git a/Task/I-before-E-except-after-C/Visual-Basic-.NET/i-before-e-except-after-c.vb b/Task/I-before-E-except-after-C/Visual-Basic-.NET/i-before-e-except-after-c.vb index 2b5d1a8478..60ee3a0d15 100644 --- a/Task/I-before-E-except-after-C/Visual-Basic-.NET/i-before-e-except-after-c.vb +++ b/Task/I-before-E-except-after-C/Visual-Basic-.NET/i-before-e-except-after-c.vb @@ -9,7 +9,7 @@ Imports System.Text.RegularExpressions Module Program ' Supports both local and remote files - Const WORDLIST_URI = "http://wiki.puzzlers.org/pub/wordlists/unixdict.txt" + Const WORDLIST_URI = "https://web.archive.org/web/20240920144647if_/http://wiki.puzzlers.org/pub/wordlists/unixdict.txt" ' The support factor of a word for EI or IE is the number of occurrences that support the rule minus the number that oppose it. diff --git a/Task/I-before-E-except-after-C/Wren/i-before-e-except-after-c-1.wren b/Task/I-before-E-except-after-C/Wren/i-before-e-except-after-c-1.wren index 6e6559d8b1..3de929e85b 100644 --- a/Task/I-before-E-except-after-C/Wren/i-before-e-except-after-c-1.wren +++ b/Task/I-before-E-except-after-C/Wren/i-before-e-except-after-c-1.wren @@ -1,6 +1,6 @@ import "io" for File -import "/pattern" for Pattern -import "/fmt" for Fmt +import "./pattern" for Pattern +import "./fmt" for Fmt var yesNo = Fn.new { |b| (b) ? "yes" : "no" } diff --git a/Task/I-before-E-except-after-C/Wren/i-before-e-except-after-c-2.wren b/Task/I-before-E-except-after-C/Wren/i-before-e-except-after-c-2.wren index 37daa47fae..f7ef9f5868 100644 --- a/Task/I-before-E-except-after-C/Wren/i-before-e-except-after-c-2.wren +++ b/Task/I-before-E-except-after-C/Wren/i-before-e-except-after-c-2.wren @@ -1,6 +1,6 @@ import "io" for File -import "/pattern" for Pattern -import "/fmt" for Fmt +import "./pattern" for Pattern +import "./fmt" for Fmt var yesNo = Fn.new { |b| (b) ? "yes" : "no" } diff --git a/Task/I-before-E-except-after-C/XPL0/i-before-e-except-after-c.xpl0 b/Task/I-before-E-except-after-C/XPL0/i-before-e-except-after-c.xpl0 new file mode 100644 index 0000000000..4c9870b998 --- /dev/null +++ b/Task/I-before-E-except-after-C/XPL0/i-before-e-except-after-c.xpl0 @@ -0,0 +1,32 @@ +include xpllib; \for StrFind and Print +int I, Ch, CI, XI, CE, XE; +char Word(100); \(longest word in unixdict.txt is 22 chars) +[FSet(FOpen("unixdict.txt", 0), ^I); \open dictionary and set it to device 3 +OpenI(3); +repeat I:= 0; + loop [Ch:= ChIn(3); + if Ch=LF or Ch=EOF then quit; + Word(I):= Ch; + I:= I+1; + ]; + Word(I):= 0; \terminate string + + if StrFind(Word, "ie") then + if StrFind(Word, "cie") then CI:= CI+1 else XI:= XI+1; + if StrFind(Word, "ei") then + if StrFind(Word, "cei") then CE:= CE+1 else XE:= XE+1; +until Ch = EOF; + +Print("CIE: %d\n", CI); +Print("xIE: %d\n", XI); +Print("CEI: %d\n", CE); +Print("xEI: %d\n\n", XE); + +Print("I before E when not preceded by C: "); +if 2*XI < CI then Print("not "); +Print("plausible.\n"); + +Print("E before I when preceded by C: "); +if 2*CI < XE then Print("not "); +Print("plausible.\n"); +] diff --git a/Task/I-before-E-except-after-C/Yabasic/i-before-e-except-after-c.basic b/Task/I-before-E-except-after-C/Yabasic/i-before-e-except-after-c.basic index 65f3fa6df9..fde65240f8 100644 --- a/Task/I-before-E-except-after-C/Yabasic/i-before-e-except-after-c.basic +++ b/Task/I-before-E-except-after-C/Yabasic/i-before-e-except-after-c.basic @@ -3,11 +3,11 @@ open "unixdict.txt" for reading as #1 repeat line input #1 pal$ if instr(pal$, "ie") then - if instr(pal$, "cie") then CI = CI + 1 else XI = XI + 1 : fi - endif + if instr(pal$, "cie") then CI = CI + 1 else XI = XI + 1 : fi + endif if instr(pal$, "ei") then - if instr(pal$, "cei") then CE = CE + 1 else XE = XE + 1 : fi - endif + if instr(pal$, "cei") then CE = CE + 1 else XE = XE + 1 : fi + endif until eof(1) close #1 diff --git a/Task/IBAN/ALGOL-68/iban.alg b/Task/IBAN/ALGOL-68/iban.alg new file mode 100644 index 0000000000..93dc56bbc2 --- /dev/null +++ b/Task/IBAN/ALGOL-68/iban.alg @@ -0,0 +1,104 @@ +BEGIN # validate IBAN numbers # + + # country code and expected bank account length for IBAN codes # + MODE IBANCOUNTRY = STRUCT( [ 1 : 2 ]CHAR code, INT length ); + + []IBANCOUNTRY country info = + ( ("AL",28), ("AD",24), ("AT",20), ("AZ",28), ("BE",16), ("BH",22), ("BA",20), ("BR",29) + , ("BG",22), ("CR",21), ("HR",21), ("CY",28), ("CZ",24), ("DK",18), ("DO",28), ("EE",20) + , ("FO",18), ("FI",18), ("FR",27), ("GE",22), ("DE",22), ("GI",23), ("GR",27), ("GL",18) + , ("GT",28), ("HU",28), ("IS",26), ("IE",22), ("IL",23), ("IT",27), ("KZ",20), ("KW",30) + , ("LV",21), ("LB",28), ("LI",21), ("LT",20), ("LU",20), ("MK",19), ("MT",31), ("MR",27) + , ("MU",30), ("MC",27), ("MD",24), ("ME",22), ("NL",18), ("NO",15), ("PK",24), ("PS",29) + , ("PL",28), ("PT",25), ("RO",24), ("SM",27), ("SA",24), ("RS",22), ("SK",24), ("SI",19) + , ("ES",24), ("SE",24), ("CH",21), ("TN",24), ("TR",26), ("AE",23), ("GB",22), ("VG",24) + ); + + # returns "" if s could be a valid IBAN, an error message otherwise # + OP POSSIBLEIBAN = ( STRING s )STRING: + BEGIN + BOOL is valid := TRUE; + STRING result := ""; + # remove spaces and check we only have digits and spaces # + STRING iban := ""; + FOR s pos FROM LWB s TO UPB s WHILE is valid DO + CHAR c = s[ s pos ]; + IF c /= " " THEN + IF NOT ( is valid := ( c >= "A" AND c <= "Z" ) OR ( c >= "0" AND c <= "9" ) ) + THEN result := "Invalid character: " + c + FI; + iban +:= c + FI + OD; + IF is valid THEN + # OK so far - check the length matches the country code # + INT supplied length = ( UPB iban - LWB iban ) + 1; + is valid := FALSE; + IF supplied length <= 4 + THEN result := "Code is too short" + ELSE # enough characters for a country code and a check sum # + INT expected length := -1; + STRING supplied country = iban[ LWB iban : LWB iban + 1 ]; + FOR c pos FROM LWB country info TO UPB country info WHILE NOT is valid DO + IF is valid := code OF country info[ c pos ] = supplied country THEN + expected length := length OF country info[ c pos ] + FI + OD; + IF NOT is valid + THEN result := "Not a known IBAN country: " + supplied country + ELIF NOT ( is valid := expected length = supplied length ) + THEN result := "Expected code length: " + whole( expected length, 0 ) + + " but actual length is: " + whole( supplied length, 0 ) + ELSE # OK so far - check the checksum # + STRING rearranged iban = iban[ LWB iban + 4 : ] + iban[ LWB iban : LWB iban + 3 ]; + LONG LONG INT numeric iban := 0; + FOR c pos FROM LWB rearranged iban TO UPB rearranged iban DO + CHAR c = rearranged iban[ c pos ]; + IF c >= "0" AND c <= "9" THEN + numeric iban *:= 10 +:= ( ABS c - ABS "0" ) + ELSE + numeric iban *:= 100 +:= ( ABS c - ABS "A" ) + 10 + FI + OD; + IF NOT ( is valid := numeric iban MOD 97 = 1 ) + THEN result := "Incorrect checksum" + FI + FI + FI + FI; + IF is valid THEN "" ELIF result = "" THEN "Unknown error" ELSE result FI + END # POSSIBLEIBAN # ; + + BEGIN # tests # + []STRING valid codes = ( "GB82 WEST 1234 5698 7654 32", "GB82WEST12345698765432" + , "GR16 0110 1250 0000 0001 2300 695", "GB29 NWBK 6016 1331 9268 19" + , "SA03 8000 0000 6080 1016 7519", "CH93 0076 2011 6238 5295 7" + , "IL62 0108 0000 0009 9999 999" + ); + []STRING invalid codes = ( "gb82 west 1234 5698 7654 32" # invalid characters # + , "GB82 TEST 1234 5698 7654 32" # invalid check digits # + , "IL62-0108-0000-0009-9999-999" # invalid characters # + , "US12 3456 7890 0987 6543 210" # invalid country code # + , "GR16 0110 1250 0000 0001 2300 695X" # invalid code length # + , "" # code is too short # + , "G2" # code is too short # + , "GB271" # invalid code length # + ); + FOR t pos FROM LWB valid codes TO UPB valid codes DO + STRING code = valid codes[ t pos ]; + STRING message = POSSIBLEIBAN code; + IF message = "" + THEN print( ( "Possible IBAN: ", code, newline ) ) + ELSE print( ( "INVALID IBAN: ", code, ": UNEXPECTED ERROR: ", message, newline ) ) + FI + OD; + FOR t pos FROM LWB invalid codes TO UPB invalid codes DO + STRING code = invalid codes[ t pos ]; + STRING message = POSSIBLEIBAN code; + IF message = "" + THEN print( ( "POSSIBLE IBAN: ", code, " BUT EXPECTED AN ERROR MESSAGE", newline ) ) + ELSE print( ( "Invalid IBAN: ", code, ": ", message, newline ) ) + FI + OD + END +END diff --git a/Task/IBAN/Ada/iban-1.ada b/Task/IBAN/Ada/iban-1.adb similarity index 100% rename from Task/IBAN/Ada/iban-1.ada rename to Task/IBAN/Ada/iban-1.adb diff --git a/Task/IBAN/Ada/iban-2.ada b/Task/IBAN/Ada/iban-2.adb similarity index 100% rename from Task/IBAN/Ada/iban-2.ada rename to Task/IBAN/Ada/iban-2.adb diff --git a/Task/IBAN/Ada/iban-3.ada b/Task/IBAN/Ada/iban-3.adb similarity index 100% rename from Task/IBAN/Ada/iban-3.ada rename to Task/IBAN/Ada/iban-3.adb diff --git a/Task/IBAN/BQN/iban.bqn b/Task/IBAN/BQN/iban.bqn new file mode 100644 index 0000000000..b2f46623bc --- /dev/null +++ b/Task/IBAN/BQN/iban.bqn @@ -0,0 +1,4 @@ +sym ← ∾"0A"+⟜↕¨10‿26 +CheckIBAN ← 1=·(97|⊣+(10⋆1+>⟜9)⊸×)´∘⌽4⌽36(>/⊢)sym⊸⊐ + +CheckIBAN "GB82 WEST 1234 5698 7654 32" diff --git a/Task/IBAN/COBOL/iban.cobol b/Task/IBAN/COBOL/iban.cob similarity index 100% rename from Task/IBAN/COBOL/iban.cobol rename to Task/IBAN/COBOL/iban.cob diff --git a/Task/IBAN/EasyLang/iban.easy b/Task/IBAN/EasyLang/iban.easy new file mode 100644 index 0000000000..161c31d836 --- /dev/null +++ b/Task/IBAN/EasyLang/iban.easy @@ -0,0 +1,63 @@ +cc$[] = [ "AD" "AE" "AL" "AO" "AT" "AZ" "BA" "BE" "BF" "BG" "BH" "BI" "BJ" "BR" "CG" "CH" "CI" "CM" "CR" "CV" "CY" "CZ" "DE" "DK" "DO" "DZ" "EE" "EG" "ES" "FI" "FO" "FR" "GA" "GB" "GE" "GI" "GL" "GR" "GT" "HR" "HU" "IE" "IL" "IR" "IS" "IT" "JO" "KW" "KZ" "LB" "LI" "LT" "LU" "LV" "MC" "MD" "ME" "MG" "MK" "ML" "MR" "MT" "MU" "MZ" "NL" "NO" "PK" "PL" "PS" "PT" "QA" "RO" "RS" "SA" "SE" "SI" "SK" "SM" "SN" "TN" "TR" "UA" "VG" ] +ln[] = [ 24 23 28 25 20 28 20 16 27 22 22 16 28 29 27 21 28 27 21 25 28 24 22 18 28 24 20 27 24 18 18 27 27 22 22 23 18 27 28 21 28 22 23 26 26 27 30 30 20 28 21 20 20 21 27 24 22 27 19 28 27 31 30 25 18 15 24 28 29 25 29 24 22 24 24 19 24 27 28 24 26 29 24 ] +# +func validcc iban$ . + c$ = substr iban$ 1 2 + for i to len cc$[] + if c$ = cc$[i] + return if len iban$ = ln[i] + . + . + return 0 +. +func mod97 s$ . + while s$ <> "" + h$ = r div 10 + h$ &= r mod 10 + h$ &= substr s$ 1 13 + s$ = substr s$ 14 9999 + r = number h$ mod 97 + . + return r +. +func isvalid hiban$ . + for c$ in strchars hiban$ + c = strcode c$ + if c > 32 + if c >= 97 and c < 122 + c -= 32 + c$ = strchar c + elif c < 48 or c > 57 and c < 65 or c > 90 + return 0 + . + miban$ &= c$ + . + . + if validcc miban$ = 0 + return 0 + . + for c$ in strchars substr miban$ 5 999 & substr miban$ 1 4 + c = strcode c$ + if c >= 65 and c <= 90 + t$ &= (c - 55) div 10 + t$ &= (c - 55) mod 10 + else + t$ &= c$ + . + . + return if mod97 t$ = 1 +. +proc check s$ . + write s$ & " is " + if isvalid s$ = 1 + print "valid" + else + print "not valid" + . +. +check "GB82 WEST 1234 5698 7654 32" +check "GB82WEST12345698765432" +check "gb82 west 1234 5698 7654 32" +check "GB82 TEST 1234 5698 7654 32" +check "GB82 WEST 1243 5698 7654 32" +check "GB82 west 1243 5698 7654 32" diff --git a/Task/IBAN/Elixir/iban.elixir b/Task/IBAN/Elixir/iban.ex similarity index 100% rename from Task/IBAN/Elixir/iban.elixir rename to Task/IBAN/Elixir/iban.ex diff --git a/Task/IBAN/Julia/iban.julia b/Task/IBAN/Julia/iban.jl similarity index 100% rename from Task/IBAN/Julia/iban.julia rename to Task/IBAN/Julia/iban.jl diff --git a/Task/IBAN/Kotlin/iban-1.kotlin b/Task/IBAN/Kotlin/iban-1.kts similarity index 100% rename from Task/IBAN/Kotlin/iban-1.kotlin rename to Task/IBAN/Kotlin/iban-1.kts diff --git a/Task/IBAN/Kotlin/iban-2.kotlin b/Task/IBAN/Kotlin/iban-2.kts similarity index 100% rename from Task/IBAN/Kotlin/iban-2.kotlin rename to Task/IBAN/Kotlin/iban-2.kts diff --git a/Task/IBAN/OCaml/iban.ocaml b/Task/IBAN/OCaml/iban.ml similarity index 100% rename from Task/IBAN/OCaml/iban.ocaml rename to Task/IBAN/OCaml/iban.ml diff --git a/Task/IBAN/PascalABC.NET/iban.pas b/Task/IBAN/PascalABC.NET/iban.pas new file mode 100644 index 0000000000..ad59a4e740 --- /dev/null +++ b/Task/IBAN/PascalABC.NET/iban.pas @@ -0,0 +1,33 @@ +var + countryLen := Dict( + ('AL', 28), ('AD', 24), ('AT', 20), ('AZ', 28), ('BE', 16), ('BH', 22), ('BA', 20), ('BR', 29), + ('BG', 22), ('CR', 21), ('HR', 21), ('CY', 28), ('CZ', 24), ('DK', 18), ('DO', 28), ('EE', 20), + ('FO', 18), ('FI', 18), ('FR', 27), ('GE', 22), ('DE', 22), ('GI', 23), ('GR', 27), ('GL', 18), + ('GT', 28), ('HU', 28), ('IS', 26), ('IE', 22), ('IL', 23), ('IT', 27), ('KZ', 20), ('KW', 30), + ('LV', 21), ('LB', 28), ('LI', 21), ('LT', 20), ('LU', 20), ('MK', 19), ('MT', 31), ('MR', 27), + ('MU', 30), ('MC', 27), ('MD', 24), ('ME', 22), ('NL', 18), ('NO', 15), ('PK', 24), ('PS', 29), + ('PL', 28), ('PT', 25), ('RO', 24), ('SM', 27), ('SA', 24), ('RS', 22), ('SK', 24), ('SI', 19), + ('ES', 24), ('SE', 24), ('CH', 21), ('TN', 24), ('TR', 26), ('AE', 23), ('GB', 22), ('VG', 24)); + +function validIban(iban: string): boolean; +begin + result := False; + iban := iban.Replace(' ', '').Replace(#9, ''); + if not iban.All(c -> c.isupper or c.isdigit) then exit; + + if iban.Length <> countryLen.Get(iban[1:3]) then exit; + + iban := iban[5:iban.Length + 1] + iban[1:5]; + var digits: string := ''; + foreach var ch in iban do + case ch of + '0'..'9': digits += ch; + 'A'..'Z': digits += (Ord(ch) - Ord('A') + 10).ToString; + end; + result := digits.ToBigInteger mod 97 = 1; +end; + +begin + foreach var account in |'GB82 WEST 1234 5698 7654 32', 'GB82 TEST 1234 5698 7654 32'| do + Println(account, 'validation is:', validIban(account)); +end. diff --git a/Task/IBAN/Phix/iban.phix b/Task/IBAN/Phix/iban.phix index 63cedf18ed..0d609477cd 100644 --- a/Task/IBAN/Phix/iban.phix +++ b/Task/IBAN/Phix/iban.phix @@ -1,61 +1,56 @@ -(phixonline)--> - -- - -- demo\rosetta\IBAN.exw - -- ===================== - -- - constant nations = {{"AD",24}, -- Andorra - -- (full list in distro) - {"CH",21}, -- Switzerland - {"GB",22}, -- United Kingdom - {"SA",24}, -- Saudi Arabia - {"XK",20}} -- Kosovo +-- demo\rosetta\IBAN.exw +constant nations = {{"AD",24}, -- Andorra + -- (full list in distro) + {"CH",21}, -- Switzerland + {"GB",22}, -- United Kingdom + {"SA",24}, -- Saudi Arabia + {"XK",20}} -- Kosovo - constant {countries,lengths} = columnize(nations) +constant {countries,lengths} = columnize(nations) - function iban(string code) - -- This routine does and should reject codes containing spaces etc. - -- Use iban_s() below for otherwise. - integer country = find(code[1..2],countries) - if country!=0 - and length(code)=lengths[country] then - code = code[5..$]&code[1..4] - integer c = 0 - for i=1 to length(code) do - integer ch=code[i] - if ch>='0' and ch<='9' then - c = c*10+ch-'0' - elsif ch>='A' and ch<='Z' then - c = c*100+ch-55 - else - return false - end if - c = mod(c,97) - end for - return c=1 - end if - return false - end function +function iban(string code) +-- This routine does and should reject codes containing spaces etc. +-- Use iban_s() below for otherwise. + integer country = find(code[1..2],countries) + if country!=0 + and length(code)=lengths[country] then + code = code[5..$]&code[1..4] + integer c = 0 + for i=1 to length(code) do + integer ch=code[i] + if ch>='0' and ch<='9' then + c = c*10+ch-'0' + elsif ch>='A' and ch<='Z' then + c = c*100+ch-55 + else + return false + end if + c = mod(c,97) + end for + return c=1 + end if + return false +end function - function iban_s(string code) - -- strips any embedded spaces and hyphens before validating. - code = substitute_all(code,{" ","-"},{"",""}) - return iban(code) - end function +function iban_s(string code) +-- strips any embedded spaces and hyphens before validating. + code = substitute_all(code,{" ","-"},{"",""}) + return iban(code) +end function - procedure test(string code, bool expected) - bool valid = iban_s(code) - string state - if valid=expected then - state = iff(valid?"ok":"invalid (as expected)") - else - state = iff(valid?"OK!!":"INVALID!!")&" (NOT AS EXPECTED)" - end if - printf(1,"%-34s :%s\n",{code,state}) - end procedure +procedure test(string code, bool expected) + bool valid = iban_s(code) + string state + if valid=expected then + state = iff(valid?"ok":"invalid (as expected)") + else + state = iff(valid?"OK!!":"INVALID!!")&" (NOT AS EXPECTED)" + end if + printf(1,"%-34s :%s\n",{code,state}) +end procedure - test("GB82 WEST 1234 5698 7654 32",true) - test("GB82 TEST 1234 5698 7654 32",false) - test("GB81 WEST 1234 5698 7654 32",false) - test("SA03 8000 0000 6080 1016 7519",true) - test("CH93 0076 2011 6238 5295 7",true) - - with javascript_semantics - procedure check_isbn13(string isbn) - integer digits = 0, checksum = 0, w = 1 - for i=1 to length(isbn) do - integer ch = isbn[i] - if ch!=' ' and ch!='-' then - ch -= '0' - if ch<0 or ch>9 then checksum = 9 exit end if - checksum += ch*w - digits += 1 - w = 4-w - end if - end for - checksum = remainder(checksum,10) - string gb = iff(digits=13 and checksum=0 ? "good" : "bad") - printf(1,"%s: %s\n",{isbn,gb}) - end procedure +with javascript_semantics +procedure check_isbn13(string isbn) + integer digits = 0, checksum = 0 + for ch in filter(isbn,"out"," -") do + if ch<'0' or ch>'9' then checksum = 9 exit end if + checksum += (ch-'0')*iff(even(digits)?1:3) + digits += 1 + end for + printf(1,"%s: %s\n",{isbn,iff(digits=13 and rmdr(checksum,10)=0 ? "good" : "bad")}) +end procedure - constant isbns = {"978-1734314502", "978-1734314509", "978-1788399081", "978-1788399083", - "978-2-74839-908-0","978-2-74839-908-5","978 1 86197 876 9"} - for i=1 to length(isbns) do check_isbn13(isbns[i]) end for - { Number in 0..9, Number #= Number0 - 48 }, digit(Number0). + +isbn13 --> + sequence(base10_digit, [D1, D2, D3]), "-", + sequence(base10_digit, [D4, D5, D6, D7, D8, D9, D10, D11, D12, D13]), + { ( D1 + 3 * D2 + D3 + 3 * D4 + + D5 + 3 * D6 + D7 + 3 * D8 + + D9 + 3 * D10 + D11 + 3 * D12 + D13 ) mod 10 #= 0 }. diff --git a/Task/ISBN13-check-digit/Prolog/isbn13-check-digit-2.pro b/Task/ISBN13-check-digit/Prolog/isbn13-check-digit-2.pro new file mode 100644 index 0000000000..7f3a3f0e20 --- /dev/null +++ b/Task/ISBN13-check-digit/Prolog/isbn13-check-digit-2.pro @@ -0,0 +1,11 @@ +?- phrase(isbn13, "978-0596528126"). +true. + +?- phrase(isbn13, "978-0596528120"). +false. + +?- phrase(isbn13, "978-1788399081"). +true. + +?- phrase(isbn13, "978-1788399083"). +false. diff --git a/Task/ISBN13-check-digit/Prolog/isbn13-check-digit-3.pro b/Task/ISBN13-check-digit/Prolog/isbn13-check-digit-3.pro new file mode 100644 index 0000000000..7225eeca85 --- /dev/null +++ b/Task/ISBN13-check-digit/Prolog/isbn13-check-digit-3.pro @@ -0,0 +1,12 @@ +?- ISBN = [0'9, 0'7, 0'8, 0'-, 0'0, 0'3, 0'0, 0'6, 0'4, 0'0, _, _, 0'5, 0'7], phrase(isbn13, ISBN). +ISBN = "978-0306400957" ; +ISBN = "978-0306401657" ; +ISBN = "978-0306402357" ; +ISBN = "978-0306403057" ; +ISBN = "978-0306404757" ; +ISBN = "978-0306405457" ; +ISBN = "978-0306406157" ; +ISBN = "978-0306407857" ; +ISBN = "978-0306408557" ; +ISBN = "978-0306409257" ; +false. diff --git a/Task/ISBN13-check-digit/Prolog/isbn13-check-digit-4.pro b/Task/ISBN13-check-digit/Prolog/isbn13-check-digit-4.pro new file mode 100644 index 0000000000..0b5d9cc7dc --- /dev/null +++ b/Task/ISBN13-check-digit/Prolog/isbn13-check-digit-4.pro @@ -0,0 +1,12 @@ +?- phrase(isbn13, ISBN). +ISBN = "000-0000000000" ; +ISBN = "000-0000000017" ; +ISBN = "000-0000000024" ; +ISBN = "000-0000000031" ; +ISBN = "000-0000000048" ; +ISBN = "000-0000000055" ; +ISBN = "000-0000000062" ; +ISBN = "000-0000000079" ; +ISBN = "000-0000000086" ; +ISBN = "000-0000000093" ; +ISBN = "000-0000000109" . % etc... diff --git a/Task/ISBN13-check-digit/PureBasic/isbn13-check-digit.basic b/Task/ISBN13-check-digit/PureBasic/isbn13-check-digit.basic index f27c87fe3e..844f77dc0d 100644 --- a/Task/ISBN13-check-digit/PureBasic/isbn13-check-digit.basic +++ b/Task/ISBN13-check-digit/PureBasic/isbn13-check-digit.basic @@ -13,8 +13,8 @@ Procedure.b IsISBN13(ISBN13.s) EndProcedure If OpenConsole() - TestISBN13("978-1734314502") - TestISBN13("978-1734314509") + TestISBN13("978-0596528126") + TestISBN13("978-0596528120") TestISBN13("978-1788399081") TestISBN13("978-1788399083") Input() diff --git a/Task/ISBN13-check-digit/Python/isbn13-check-digit-1.py b/Task/ISBN13-check-digit/Python/isbn13-check-digit-1.py index b2a2a8bf08..6afe0ad879 100644 --- a/Task/ISBN13-check-digit/Python/isbn13-check-digit-1.py +++ b/Task/ISBN13-check-digit/Python/isbn13-check-digit-1.py @@ -8,8 +8,8 @@ def is_isbn13(n): if __name__ == '__main__': tests = ''' -978-1734314502 -978-1734314509 +978-0596528126 +978-0596528120 978-1788399081 978-1788399083'''.strip().split() for t in tests: diff --git a/Task/ISBN13-check-digit/Python/isbn13-check-digit-2.py b/Task/ISBN13-check-digit/Python/isbn13-check-digit-2.py index 106ea857a8..14147d2576 100644 --- a/Task/ISBN13-check-digit/Python/isbn13-check-digit-2.py +++ b/Task/ISBN13-check-digit/Python/isbn13-check-digit-2.py @@ -28,8 +28,8 @@ def main(): print('\n'.join( repr((s, isISBN13(s))) for s - in ["978-1734314502", - "978-1734314509", + in ["978-0596528126", + "978-0596528120", "978-1788399081", "978-1788399083" ] diff --git a/Task/ISBN13-check-digit/Quackery/isbn13-check-digit.quackery b/Task/ISBN13-check-digit/Quackery/isbn13-check-digit.quackery index 0511932043..3a2466d98e 100644 --- a/Task/ISBN13-check-digit/Quackery/isbn13-check-digit.quackery +++ b/Task/ISBN13-check-digit/Quackery/isbn13-check-digit.quackery @@ -26,7 +26,7 @@ iff [ say "Good" ] else [ say "Bad" ] cr ] is isbn-test ( $ --> ) -$ '978-1734314502' isbn-test -$ '978-1734314509' isbn-test +$ '978-0596528126' isbn-test +$ '978-0596528120' isbn-test $ '978-1788399081' isbn-test $ '978-1788399083' isbn-test diff --git a/Task/ISBN13-check-digit/R/isbn13-check-digit.r b/Task/ISBN13-check-digit/R/isbn13-check-digit.r new file mode 100644 index 0000000000..971ee0438e --- /dev/null +++ b/Task/ISBN13-check-digit/R/isbn13-check-digit.r @@ -0,0 +1,28 @@ +isbncheck <- function(str) { + # Remove non-digit characters + digits <- gsub("\\D", "", str) + + # Split into individual characters and convert to numeric + digit_vec <- as.numeric(strsplit(digits, "")[[1]]) + + # Calculate weighted sum + weighted_sum <- sum(sapply(seq_along(digit_vec), function(i) { + if (i %% 2 == 0) { + 3 * digit_vec[i] + } else { + digit_vec[i] + } + })) + + # Check if divisible by 10 + return(weighted_sum %% 10 == 0) +} + +# Test codes +testing_codes <- c("978-0596528126", "978-0596528120", + "978-1788399081", "978-1788399083") + +for (code in testing_codes) { + result <- ifelse(isbncheck(code), "good", "bad") + cat(code, ": ", result, "\n", sep = "") +} diff --git a/Task/ISBN13-check-digit/REXX/isbn13-check-digit.rexx b/Task/ISBN13-check-digit/REXX/isbn13-check-digit.rexx index ac2bb1acc9..cfb6e8d470 100644 --- a/Task/ISBN13-check-digit/REXX/isbn13-check-digit.rexx +++ b/Task/ISBN13-check-digit/REXX/isbn13-check-digit.rexx @@ -1,6 +1,6 @@ /*REXX pgm validates the check digit of an ISBN─13 code (it may have embedded minuses).*/ parse arg $ /*obtain optional arguments from the CL*/ -if $='' | if $="," then $= '978-1734314502 978-1734314509 978-1788399081 978-1788399083' +if $='' | if $="," then $= '978-0596528126 978-0596528120 978-1788399081 978-1788399083' @ISBN= "ISBN─13 code isn't" /*a literal used when displaying msgs. */ /* [↓] remove all minuses from X code.*/ do j=1 for words($); y= word($,j) /*obtain an ISBN─13 code from $ list.*/ diff --git a/Task/ISBN13-check-digit/Racket/isbn13-check-digit.rkt b/Task/ISBN13-check-digit/Racket/isbn13-check-digit.rkt index 3c0cadc63c..3b0f0f3f63 100644 --- a/Task/ISBN13-check-digit/Racket/isbn13-check-digit.rkt +++ b/Task/ISBN13-check-digit/Racket/isbn13-check-digit.rkt @@ -9,7 +9,7 @@ (module+ test (require rackunit) - (check-true (isbn13-check-digit-valid? "978-1734314502")) - (check-false (isbn13-check-digit-valid? "978-1734314509")) + (check-true (isbn13-check-digit-valid? "978-0596528126")) + (check-false (isbn13-check-digit-valid? "978-0596528120")) (check-true (isbn13-check-digit-valid? "978-1788399081")) (check-false (isbn13-check-digit-valid? "978-1788399083"))) diff --git a/Task/ISBN13-check-digit/Raku/isbn13-check-digit.raku b/Task/ISBN13-check-digit/Raku/isbn13-check-digit.raku index 88e9fdc77d..a5a76b6df9 100644 --- a/Task/ISBN13-check-digit/Raku/isbn13-check-digit.raku +++ b/Task/ISBN13-check-digit/Raku/isbn13-check-digit.raku @@ -9,8 +9,8 @@ sub check-digit ($isbn) { 'Good' !! "Bad check-digit $check; should be $check-digit" } for words < - 978-1734314502 - 978-1734314509 + 978-0596528126 + 978-0596528120 978-1788399081 978-1788399083 978-2-74839-908-0 diff --git a/Task/ISBN13-check-digit/Rebol/isbn13-check-digit.rebol b/Task/ISBN13-check-digit/Rebol/isbn13-check-digit.rebol new file mode 100644 index 0000000000..568cd2a141 --- /dev/null +++ b/Task/ISBN13-check-digit/Rebol/isbn13-check-digit.rebol @@ -0,0 +1,27 @@ +Rebol [ + title: "Rosetta code: ISBN13 check digit" + file: %ISBN13_check_digit.r3 + url: https://rosettacode.org/wiki/ISBN13_check_digit + needs: 3.15.0 ;; or something like that +] +valid-isbn13?: function/with [ + "Validate the check digit of an ISBN-13 code" + value [any-string!] +][ + sum: 0 + parse value [ + 6 [ + to numeric set n: skip (sum: sum + n - #"0") ;; Add digit at odd index (weight 1) + to numeric set n: skip (sum: sum + (3 * (n - #"0"))) ;; Add digit at even index (weight 3) + ] + to numeric set n: skip (sum: sum + n - #"0") ;; Add the 13th digit (weight 1) + opt [to numeric (return false)] ;; If not exactly 13 digits, abort as invalid + ] + zero? (sum % 10) ;; Valid if weighted sum is divisible by 10 +] system/catalog/bitsets ;; Supply numeric bitset for parse (matches digits) + + +;; Check given examples +foreach [str] ["978-0596528126" "978-0596528120" "978-1788399081" "978-1788399083" "978-2-74839-908-0"] [ + print [pad str 18 "-" valid-isbn13? str] +] diff --git a/Task/ISBN13-check-digit/Red/isbn13-check-digit.red b/Task/ISBN13-check-digit/Red/isbn13-check-digit.red index 405e8b0f3b..ac16d0ea46 100644 --- a/Task/ISBN13-check-digit/Red/isbn13-check-digit.red +++ b/Task/ISBN13-check-digit/Red/isbn13-check-digit.red @@ -16,7 +16,7 @@ check_valid_isbn13: function [str] [ ] ; check given examples -foreach [str] ["978-1734314502" "978-1734314509" "978-1788399081" "978-1788399083"] [ +foreach [str] ["978-0596528126" "978-0596528120" "978-1788399081" "978-1788399083"] [ prin str prin " - " print check_valid_isbn13 str diff --git a/Task/ISBN13-check-digit/Refal/isbn13-check-digit.refal b/Task/ISBN13-check-digit/Refal/isbn13-check-digit.refal new file mode 100644 index 0000000000..c0720f93be --- /dev/null +++ b/Task/ISBN13-check-digit/Refal/isbn13-check-digit.refal @@ -0,0 +1,46 @@ +$ENTRY Go { + = + + + +}; + +Test { + e.X = >; +}; + +ISBN { + e.X, : e.DS, + : { + False = Bad; + True = ; + }; +}; + +ISBN1 { + (13 s.Sum), : 0 = Good; + (13 s.Sum) e.X = Bad; + (s.N s.Sum) = Bad; + + (s.N s.Sum) s.D e.X, + <+ s.N 1>: s.N1, + : s.V, + : { + 0 = ) e.X>; + 1 = >) e.X>; + }; + + e.X = ; +}; + +Remove { + s.1 = ; + s.1 s.1 e.X = ; + s.1 s.2 e.X = s.2 ; +}; + +CheckDigits { + = True; + s.D e.X, '0123456789': e.A s.D e.B = ; + e.X = False; +}; diff --git a/Task/ISBN13-check-digit/Ring/isbn13-check-digit.ring b/Task/ISBN13-check-digit/Ring/isbn13-check-digit.ring index d6c5e41207..98958ab94a 100644 --- a/Task/ISBN13-check-digit/Ring/isbn13-check-digit.ring +++ b/Task/ISBN13-check-digit/Ring/isbn13-check-digit.ring @@ -1,6 +1,6 @@ load "stdlib.ring" -isbn = ["978-1734314502","978-1734314509", "978-1788399081", "978-1788399083","978-2-74839-908-0","978-2-74839-908-5","978 1 86197 876 9"] +isbn = ["978-0596528126","978-0596528120", "978-1788399081", "978-1788399083","978-2-74839-908-0","978-2-74839-908-5","978 1 86197 876 9"] for n = 1 to len(isbn) sum = 0 diff --git a/Task/ISBN13-check-digit/Ruby/isbn13-check-digit.rb b/Task/ISBN13-check-digit/Ruby/isbn13-check-digit.rb index f734cdfdf6..d46e18462d 100644 --- a/Task/ISBN13-check-digit/Ruby/isbn13-check-digit.rb +++ b/Task/ISBN13-check-digit/Ruby/isbn13-check-digit.rb @@ -4,5 +4,5 @@ def validISBN13?(str) cleaned.each_slice(2).sum{|d1, d2| d1.to_i + 3*d2.to_i }.remainder(10) == 0 end -isbns = ["978-1734314502", "978-1734314509", "978-1788399081", "978-1788399083"] +isbns = ["978-0596528126", "978-0596528120", "978-1788399081", "978-1788399083"] isbns.each{|isbn| puts "#{isbn}: #{validISBN13?(isbn)}" } diff --git a/Task/ISBN13-check-digit/Rust/isbn13-check-digit.rs b/Task/ISBN13-check-digit/Rust/isbn13-check-digit.rs new file mode 100644 index 0000000000..081a5323e7 --- /dev/null +++ b/Task/ISBN13-check-digit/Rust/isbn13-check-digit.rs @@ -0,0 +1,14 @@ +fn main() { + let isbns = ["978-0596528126", "978-0596528120", "978-1788399081", "978-1788399083"]; + isbns.iter().for_each(|isbn| println!("{}: {}", isbn, check_isbn(isbn))); +} + +fn check_isbn(isbn: &str) -> bool { + if isbn.chars().filter(|c| c.is_digit(10)).count() != 13 { + return false; + } + let checksum = isbn.chars().filter_map(|c| c.to_digit(10)) + .zip([1, 3].iter().cycle()) + .fold(0, |acc, (val, fac)| acc + val * fac); + checksum % 10 == 0 +} diff --git a/Task/ISBN13-check-digit/Rust/isbn13-check-digit.rust b/Task/ISBN13-check-digit/Rust/isbn13-check-digit.rust deleted file mode 100644 index 76efbed13f..0000000000 --- a/Task/ISBN13-check-digit/Rust/isbn13-check-digit.rust +++ /dev/null @@ -1,14 +0,0 @@ -fn main() { - let isbns = ["978-1734314502", "978-1734314509", "978-1788399081", "978-1788399083"]; - isbns.iter().for_each(|isbn| println!("{}: {}", isbn, check_isbn(isbn))); -} - -fn check_isbn(isbn: &str) -> bool { - if isbn.chars().filter(|c| c.is_digit(10)).count() != 13 { - return false; - } - let checksum = isbn.chars().filter_map(|c| c.to_digit(10)) - .zip([1, 3].iter().cycle()) - .fold(0, |acc, (val, fac)| acc + val * fac); - checksum % 10 == 0 -} diff --git a/Task/ISBN13-check-digit/SETL/isbn13-check-digit.setl b/Task/ISBN13-check-digit/SETL/isbn13-check-digit.setl new file mode 100644 index 0000000000..30d4490ddc --- /dev/null +++ b/Task/ISBN13-check-digit/SETL/isbn13-check-digit.setl @@ -0,0 +1,22 @@ +program isbn13; + loop for test in [ + "978-0596528126", "978-0596528120", + "978-1788399081", "978-1788399083" + ] do + print(test + if valid_isbn13 test then ": good" else ": bad" end); + end loop; + + op valid_isbn13(isbn); + if #isbn /= 14 + or isbn(4) /= '-' + or exists c in isbn | not c in "0123456789-" then + return false; + end if; + + m := 3; + loop for ch in isbn | ch in "0123456789" do + s +:= val ch * (m := 4 - m); + end loop; + return s mod 10 = 0; + end op; +end program; diff --git a/Task/ISBN13-check-digit/Scala/isbn13-check-digit.scala b/Task/ISBN13-check-digit/Scala/isbn13-check-digit.scala new file mode 100644 index 0000000000..910add1d43 --- /dev/null +++ b/Task/ISBN13-check-digit/Scala/isbn13-check-digit.scala @@ -0,0 +1,26 @@ +object ISBNValidator: + private def checkChecksum(isbn: String): Boolean = + val digits = isbn.map(_.asDigit) + val checksum = digits.zipWithIndex.map { + case (digit, idx) => + if idx % 2 == 0 then digit + else digit * 3 + }.sum + checksum % 10 == 0 + + def isValidISBN13(isbn: String): Boolean = + val cleaned = isbn.filter(_.isDigit) + cleaned.length == 13 && checkChecksum(cleaned) + +@main def main(): Unit = + def test(isbn: String): Unit = + val result = ISBNValidator.isValidISBN13(isbn) + println(s"$isbn: $result") + + List( + "978-0596528126", + "978-0596528120", + "978-1788399081", + "978-1788399083" + ) + .foreach(test) diff --git a/Task/ISBN13-check-digit/Seed7/isbn13-check-digit.seed7 b/Task/ISBN13-check-digit/Seed7/isbn13-check-digit.seed7 index f9553006ec..9d29803ea3 100644 --- a/Task/ISBN13-check-digit/Seed7/isbn13-check-digit.seed7 +++ b/Task/ISBN13-check-digit/Seed7/isbn13-check-digit.seed7 @@ -28,7 +28,7 @@ const proc: main is func local var string: str is ""; begin - for str range [] ("978-1734314502", "978-1734314509", "978-1788399081", "978-1788399083") do + for str range [] ("978-0596528126", "978-0596528120", "978-1788399081", "978-1788399083") do writeln(str <& ": " <& isISBN13(str)); end for; end func; diff --git a/Task/ISBN13-check-digit/Standard-ML/isbn13-check-digit-1.ml b/Task/ISBN13-check-digit/Standard-ML/isbn13-check-digit-1.ml new file mode 100644 index 0000000000..55acb3f3db --- /dev/null +++ b/Task/ISBN13-check-digit/Standard-ML/isbn13-check-digit-1.ml @@ -0,0 +1,22 @@ +(* these type decorations are optional, you could just as well put: + fun isValidISBN s = +*) +fun isValidISBN (s : string) : bool = + let + val digits = List.filter Char.isDigit (explode s) + val nums = map (fn x => ord x - ord #"0") digits + val len = length nums + fun sumISBN [] = raise Domain + | sumISBN [x] = x + | sumISBN (x1::x2::xs) = x1 + 3*x2 + sumISBN xs + in + len = 13 andalso sumISBN nums mod 10 = 0 + end + +val test = ["978-1734314502", "978-1734314509", + "978-1788399081", "978-1788399083"] + +fun printTest (s : string) : unit = + (print s; print (if isValidISBN s then ": good\n" else ": bad\n")) + +fun main () = app printTest test diff --git a/Task/ISBN13-check-digit/Standard-ML/isbn13-check-digit-2.ml b/Task/ISBN13-check-digit/Standard-ML/isbn13-check-digit-2.ml new file mode 100644 index 0000000000..c81cfd25c5 --- /dev/null +++ b/Task/ISBN13-check-digit/Standard-ML/isbn13-check-digit-2.ml @@ -0,0 +1,15 @@ +let + fun check (c, p as (m, n)) = + if Char.isDigit c then + (not m, (if m then 3 * (ord c - 48) else ord c - 48) + n) + else + p +in + fun checkISBN s = + Int.rem (#2 (CharVector.foldl check (false, 0) s), 10) = 0 +end + +val test = ["978-0596528126", "978-0596528120", "978-1788399081", "978-1788399083"] +val () = (print + o concat + o map (fn s => s ^ (if checkISBN s then ": good\n" else ": bad\n"))) test diff --git a/Task/ISBN13-check-digit/Standard-ML/isbn13-check-digit.ml b/Task/ISBN13-check-digit/Standard-ML/isbn13-check-digit.ml deleted file mode 100644 index 3ea0737bff..0000000000 --- a/Task/ISBN13-check-digit/Standard-ML/isbn13-check-digit.ml +++ /dev/null @@ -1,15 +0,0 @@ -local - fun check (c, p as (m, n)) = - if Char.isDigit c then - (not m, (if m then 3 * (ord c - 48) else ord c - 48) + n) - else - p -in - fun checkISBN s = - Int.rem (#2 (CharVector.foldl check (false, 0) s), 10) = 0 -end - -val test = ["978-1734314502", "978-1734314509", "978-1788399081", "978-1788399083"] -val () = (print - o concat - o map (fn s => s ^ (if checkISBN s then ": good\n" else ": bad\n"))) test diff --git a/Task/ISBN13-check-digit/Swift/isbn13-check-digit.swift b/Task/ISBN13-check-digit/Swift/isbn13-check-digit.swift index cefe08f9fb..b5c70229ac 100644 --- a/Task/ISBN13-check-digit/Swift/isbn13-check-digit.swift +++ b/Task/ISBN13-check-digit/Swift/isbn13-check-digit.swift @@ -13,8 +13,8 @@ func checkISBN(isbn: String) -> Bool { } let cases = [ - "978-1734314502", - "978-1734314509", + "978-0596528126", + "978-0596528120", "978-1788399081", "978-1788399083" ] diff --git a/Task/ISBN13-check-digit/Tcl/isbn13-check-digit-1.tcl b/Task/ISBN13-check-digit/Tcl/isbn13-check-digit-1.tcl index 6dfa79dbbb..9a8d8f0d03 100644 --- a/Task/ISBN13-check-digit/Tcl/isbn13-check-digit-1.tcl +++ b/Task/ISBN13-check-digit/Tcl/isbn13-check-digit-1.tcl @@ -12,8 +12,8 @@ proc validISBN13 code { return false } foreach test { - 978-1734314502 - 978-1734314509 + 978-0596528126 + 978-0596528120 978-1788399081 978-1788399083 } {puts $test:[validISBN13 $test]} diff --git a/Task/ISBN13-check-digit/UNIX-Shell/isbn13-check-digit.sh b/Task/ISBN13-check-digit/UNIX-Shell/isbn13-check-digit.sh index c0de8e51b3..301b5984c7 100644 --- a/Task/ISBN13-check-digit/UNIX-Shell/isbn13-check-digit.sh +++ b/Task/ISBN13-check-digit/UNIX-Shell/isbn13-check-digit.sh @@ -8,7 +8,7 @@ check_isbn13 () { (( 0 == t % 10 )) } -for isbn in 978-1734314502 978-1734314509 978-1788399081 978-1788399083; do +for isbn in 978-0596528126 978-0596528120 978-1788399081 978-1788399083; do printf '%s: ' "$isbn" if check_isbn13 "$isbn"; then printf '%s\n' OK diff --git a/Task/ISBN13-check-digit/V-(Vlang)/isbn13-check-digit.v b/Task/ISBN13-check-digit/V-(Vlang)/isbn13-check-digit.v index fdaef1252b..da68e4c3de 100644 --- a/Task/ISBN13-check-digit/V-(Vlang)/isbn13-check-digit.v +++ b/Task/ISBN13-check-digit/V-(Vlang)/isbn13-check-digit.v @@ -22,7 +22,7 @@ fn check_isbn13(isbn13 string) bool { } fn main() { - isbns := ["978-1734314502", "978-1734314509", "978-1788399081", "978-1788399083"] + isbns := ["978-0596528126", "978-0596528120", "978-1788399081", "978-1788399083"] for isbn in isbns { mut res := "bad" if check_isbn13(isbn) { diff --git a/Task/ISBN13-check-digit/Visual-Basic-.NET/isbn13-check-digit.vb b/Task/ISBN13-check-digit/Visual-Basic-.NET/isbn13-check-digit.vb index bdacc7a702..be6ff129a9 100644 --- a/Task/ISBN13-check-digit/Visual-Basic-.NET/isbn13-check-digit.vb +++ b/Task/ISBN13-check-digit/Visual-Basic-.NET/isbn13-check-digit.vb @@ -19,8 +19,8 @@ Module Module1 End Function Sub Main() - Console.WriteLine(CheckISBN13("978-1734314502")) - Console.WriteLine(CheckISBN13("978-1734314509")) + Console.WriteLine(CheckISBN13("978-0596528126")) + Console.WriteLine(CheckISBN13("978-0596528120")) Console.WriteLine(CheckISBN13("978-1788399081")) Console.WriteLine(CheckISBN13("978-1788399083")) End Sub diff --git a/Task/ISBN13-check-digit/Wren/isbn13-check-digit.wren b/Task/ISBN13-check-digit/Wren/isbn13-check-digit.wren index af45d2f2a2..bca6ca7452 100644 --- a/Task/ISBN13-check-digit/Wren/isbn13-check-digit.wren +++ b/Task/ISBN13-check-digit/Wren/isbn13-check-digit.wren @@ -15,7 +15,7 @@ var isbn13 = Fn.new { |s| return sum % 10 == 0 } -var tests = ["978-1734314502", "978-1734314509", "978-1788399081", "978-1788399083"] +var tests = ["978-0596528126", "978-0596528120", "978-1788399081", "978-1788399083"] for (test in tests) { System.print("%(test) -> %(isbn13.call(test) ? "good" : "bad")") } diff --git a/Task/ISBN13-check-digit/XPL0/isbn13-check-digit.xpl0 b/Task/ISBN13-check-digit/XPL0/isbn13-check-digit.xpl0 index e045aab504..c2eaf4e120 100644 --- a/Task/ISBN13-check-digit/XPL0/isbn13-check-digit.xpl0 +++ b/Task/ISBN13-check-digit/XPL0/isbn13-check-digit.xpl0 @@ -18,8 +18,8 @@ Text(0, if rem(Sum/10)=0 & Cnt=13 then ": good" else ": bad"); CrLf(0); ]; -[ISBN13("978-1734314502"); - ISBN13("978-1734314509"); +[ISBN13("978-0596528126"); + ISBN13("978-0596528120"); ISBN13("978-1788399081"); ISBN13("978-1788399083"); ISBN13("978-1-59327-220-3"); diff --git a/Task/ISBN13-check-digit/Zkl/isbn13-check-digit-1.zkl b/Task/ISBN13-check-digit/Zkl/isbn13-check-digit-1.zkl index c4be69768b..4f8dc9bcbd 100644 --- a/Task/ISBN13-check-digit/Zkl/isbn13-check-digit-1.zkl +++ b/Task/ISBN13-check-digit/Zkl/isbn13-check-digit-1.zkl @@ -1,4 +1,4 @@ -fcn ISBN13_check(isbn){ // "978-1734314502", throws on invalid digits +fcn ISBN13_check(isbn){ // "978-0596528126", throws on invalid digits var [const] one3=("13"*6 + 1).split("").apply("toInt"); // examine 13 digits // one3=("13"*6) if you want to calculate what the check digit should be one3.zipWith('*,isbn - " -").sum(0) % 10 == 0 diff --git a/Task/ISBN13-check-digit/Zkl/isbn13-check-digit-2.zkl b/Task/ISBN13-check-digit/Zkl/isbn13-check-digit-2.zkl index c96ff21fd2..ea42f0f25a 100644 --- a/Task/ISBN13-check-digit/Zkl/isbn13-check-digit-2.zkl +++ b/Task/ISBN13-check-digit/Zkl/isbn13-check-digit-2.zkl @@ -1,7 +1,7 @@ isbns:= #<<<" - 978-1734314502 - 978-1734314509 + 978-0596528126 + 978-0596528120 978-1788399081 978-1788399083 978-2-74839-908-0 diff --git a/Task/Identity-matrix/Ada/identity-matrix-1.ada b/Task/Identity-matrix/Ada/identity-matrix-1.adb similarity index 100% rename from Task/Identity-matrix/Ada/identity-matrix-1.ada rename to Task/Identity-matrix/Ada/identity-matrix-1.adb diff --git a/Task/Identity-matrix/Ada/identity-matrix-2.ada b/Task/Identity-matrix/Ada/identity-matrix-2.adb similarity index 100% rename from Task/Identity-matrix/Ada/identity-matrix-2.ada rename to Task/Identity-matrix/Ada/identity-matrix-2.adb diff --git a/Task/Identity-matrix/Beads/identity-matrix.beads b/Task/Identity-matrix/Beads/identity-matrix.beads index 5a440d7c66..095255f228 100644 --- a/Task/Identity-matrix/Beads/identity-matrix.beads +++ b/Task/Identity-matrix/Beads/identity-matrix.beads @@ -1,10 +1,10 @@ beads 1 program 'Identity matrix' var - id : array^2 of num - n = 5 - + id : array^2 of num + n = 5 + calc main_init - loop from:1 to:n index:i - loop from:1 to:n index:j - id[i,j] = 1 if i == j else 0 + loop from:1 to:n index:i + loop from:1 to:n index:j + id[i,j] = 1 if i == j else 0 diff --git a/Task/Identity-matrix/Component-Pascal/identity-matrix.pas b/Task/Identity-matrix/Component-Pascal/identity-matrix.pas index 297f88e2d6..80e25dbec2 100644 --- a/Task/Identity-matrix/Component-Pascal/identity-matrix.pas +++ b/Task/Identity-matrix/Component-Pascal/identity-matrix.pas @@ -2,34 +2,34 @@ MODULE Algebras; IMPORT StdLog,Strings; TYPE - Matrix = POINTER TO ARRAY OF ARRAY OF INTEGER; - + Matrix = POINTER TO ARRAY OF ARRAY OF INTEGER; + PROCEDURE NewIdentityMatrix(n: INTEGER): Matrix; VAR - m: Matrix; - i: INTEGER; + m: Matrix; + i: INTEGER; BEGIN - NEW(m,n,n); - FOR i := 0 TO n - 1 DO - m[i,i] := 1; - END; - RETURN m; + NEW(m,n,n); + FOR i := 0 TO n - 1 DO + m[i,i] := 1; + END; + RETURN m; END NewIdentityMatrix; PROCEDURE Show(m: Matrix); VAR - i,j: INTEGER; + i,j: INTEGER; BEGIN - FOR i := 0 TO LEN(m,0) - 1 DO - FOR j := 0 TO LEN(m,1) - 1 DO - StdLog.Int(m[i,j]); - END; - StdLog.Ln - END + FOR i := 0 TO LEN(m,0) - 1 DO + FOR j := 0 TO LEN(m,1) - 1 DO + StdLog.Int(m[i,j]); + END; + StdLog.Ln + END END Show; PROCEDURE Do*; BEGIN - Show(NewIdentityMatrix(5)); + Show(NewIdentityMatrix(5)); END Do; END Algebras. diff --git a/Task/Identity-matrix/Delphi/identity-matrix.delphi b/Task/Identity-matrix/Delphi/identity-matrix.pas similarity index 100% rename from Task/Identity-matrix/Delphi/identity-matrix.delphi rename to Task/Identity-matrix/Delphi/identity-matrix.pas diff --git a/Task/Identity-matrix/DuckDB/identity-matrix.duckdb b/Task/Identity-matrix/DuckDB/identity-matrix.duckdb new file mode 100644 index 0000000000..26cbc7a159 --- /dev/null +++ b/Task/Identity-matrix/DuckDB/identity-matrix.duckdb @@ -0,0 +1,20 @@ +# Produce an (i,j,value) table representing the matrix I(m,n) +# which is the identity matrix if m = n +create or replace function I(m,n,zero) as table ( + with recursive cte(i,j,ij,value) as ( + select 1, 1, (null,null), zero + union all + select if(j=n, i+1, i) as i, + if(j=n, 1, j+1) as j, + (i, j) as ij, + zero + if(i=j, 1, 0) as value + from cte + where i <= m + ) + select ij[1] as i, ij[2] as j, value + from cte + offset 1 +); + +# Generate a 3x3 matrix with DOUBLE(3,2) values: +from I(3, 3, 0.000); diff --git a/Task/Identity-matrix/EasyLang/identity-matrix.easy b/Task/Identity-matrix/EasyLang/identity-matrix.easy index d1552ef970..b85b3166c1 100644 --- a/Task/Identity-matrix/EasyLang/identity-matrix.easy +++ b/Task/Identity-matrix/EasyLang/identity-matrix.easy @@ -1,4 +1,4 @@ -proc idmat lng . mat[][] . +proc idmat lng &mat[][] . len mat[][] lng for i to lng len mat[i][] lng diff --git a/Task/Identity-matrix/Eiffel/identity-matrix.e b/Task/Identity-matrix/Eiffel/identity-matrix.e index ffeeb3ee35..084a34437f 100644 --- a/Task/Identity-matrix/Eiffel/identity-matrix.e +++ b/Task/Identity-matrix/Eiffel/identity-matrix.e @@ -1,61 +1,61 @@ class - APPLICATION + APPLICATION inherit - ARGUMENTS + ARGUMENTS create - make + make feature {NONE} -- Initialization - make - -- Run application. - local - dim : INTEGER -- Dimension of the identity matrix - do - from dim := 1 until dim > 10 loop - print_matrix( identity_matrix(dim) ) - dim := dim + 1 - io.new_line - end + make + -- Run application. + local + dim : INTEGER -- Dimension of the identity matrix + do + from dim := 1 until dim > 10 loop + print_matrix( identity_matrix(dim) ) + dim := dim + 1 + io.new_line + end - end + end feature -- Access - identity_matrix(dim : INTEGER) : ARRAY2[REAL_64] + identity_matrix(dim : INTEGER) : ARRAY2[REAL_64] - require - dim > 0 - local - matrix : ARRAY2[REAL_64] - i : INTEGER - do + require + dim > 0 + local + matrix : ARRAY2[REAL_64] + i : INTEGER + do - create matrix.make_filled (0.0, dim, dim) - from i := 1 until i > dim loop - matrix.put(1.0, i, i) - i := i + 1 - end + create matrix.make_filled (0.0, dim, dim) + from i := 1 until i > dim loop + matrix.put(1.0, i, i) + i := i + 1 + end - Result := matrix - end + Result := matrix + end - print_matrix(matrix : ARRAY2[REAL_64]) - local - i, j : INTEGER - do - from i := 1 until i > matrix.height loop - print("[ ") - from j := 1 until j > matrix.width loop - print(matrix.item (i, j)) - print(" ") - j := j + 1 - end - print("]%N") - i := i + 1 - end - end + print_matrix(matrix : ARRAY2[REAL_64]) + local + i, j : INTEGER + do + from i := 1 until i > matrix.height loop + print("[ ") + from j := 1 until j > matrix.width loop + print(matrix.item (i, j)) + print(" ") + j := j + 1 + end + print("]%N") + i := i + 1 + end + end end diff --git a/Task/Identity-matrix/Elena/identity-matrix.elena b/Task/Identity-matrix/Elena/identity-matrix.elena index 661d1ef051..e02c88a428 100644 --- a/Task/Identity-matrix/Elena/identity-matrix.elena +++ b/Task/Identity-matrix/Elena/identity-matrix.elena @@ -2,13 +2,13 @@ import extensions; import system'routines; import system'collections; -public program() +public Program() { - var n := console.write:"Enter the matrix size:".readLine().toInt(); + var n := console.write("Enter the matrix size:").readLine().toInt(); - var identity := new Range(0, n).selectBy:(i => new Range(0,n).selectBy:(j => (i == j).iif(1,0) ).summarize(new ArrayList())) + var identity := new Range(0, n).selectBy::(i => new Range(0,n).selectBy::(j => (i == j).iif(1,0) ).summarize(new ArrayList())) .summarize(new ArrayList()); - identity.forEach: + identity.forEach:: (row) { console.printLine(row.asEnumerable()) } } diff --git a/Task/Identity-matrix/Elixir/identity-matrix.elixir b/Task/Identity-matrix/Elixir/identity-matrix.ex similarity index 100% rename from Task/Identity-matrix/Elixir/identity-matrix.elixir rename to Task/Identity-matrix/Elixir/identity-matrix.ex diff --git a/Task/Identity-matrix/Excel/identity-matrix.excel b/Task/Identity-matrix/Excel/identity-matrix-1.excel similarity index 100% rename from Task/Identity-matrix/Excel/identity-matrix.excel rename to Task/Identity-matrix/Excel/identity-matrix-1.excel diff --git a/Task/Identity-matrix/Excel/identity-matrix-2.excel b/Task/Identity-matrix/Excel/identity-matrix-2.excel new file mode 100644 index 0000000000..f72b963773 --- /dev/null +++ b/Task/Identity-matrix/Excel/identity-matrix-2.excel @@ -0,0 +1 @@ +=MUNIT(A2) diff --git a/Task/Identity-matrix/J/identity-matrix.j b/Task/Identity-matrix/J/identity-matrix.j index a209ace2c5..a87aa8e298 100644 --- a/Task/Identity-matrix/J/identity-matrix.j +++ b/Task/Identity-matrix/J/identity-matrix.j @@ -1,10 +1,10 @@ - = i. 4 NB. create an Identity matrix of size 4 + =i.4 NB. create an Identity matrix of size 4 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 - makeI=: =@i. NB. define as a verb with a user-defined name - makeI 5 NB. create an Identity matrix of size 5 + Id=: =@i. NB. define as a verb with a user-defined name + Id 5 NB. create an Identity matrix of size 5 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 diff --git a/Task/Identity-matrix/Julia/identity-matrix-1.julia b/Task/Identity-matrix/Julia/identity-matrix-1.jl similarity index 100% rename from Task/Identity-matrix/Julia/identity-matrix-1.julia rename to Task/Identity-matrix/Julia/identity-matrix-1.jl diff --git a/Task/Identity-matrix/Julia/identity-matrix-2.julia b/Task/Identity-matrix/Julia/identity-matrix-2.jl similarity index 100% rename from Task/Identity-matrix/Julia/identity-matrix-2.julia rename to Task/Identity-matrix/Julia/identity-matrix-2.jl diff --git a/Task/Identity-matrix/Julia/identity-matrix-3.julia b/Task/Identity-matrix/Julia/identity-matrix-3.jl similarity index 100% rename from Task/Identity-matrix/Julia/identity-matrix-3.julia rename to Task/Identity-matrix/Julia/identity-matrix-3.jl diff --git a/Task/Identity-matrix/Kotlin/identity-matrix.kotlin b/Task/Identity-matrix/Kotlin/identity-matrix.kotlin deleted file mode 100644 index 8e873fc892..0000000000 --- a/Task/Identity-matrix/Kotlin/identity-matrix.kotlin +++ /dev/null @@ -1,17 +0,0 @@ -// version 1.0.6 - -fun main(args: Array) { - print("Enter size of matrix : ") - val n = readLine()!!.toInt() - println() - val identity = Array(n) { IntArray(n) } // create n x n matrix of integers - - // enter 1s in diagonal elements - for(i in 0 until n) identity[i][i] = 1 - - // print identity matrix if n <= 40 - if (n <= 40) - for (i in 0 until n) println(identity[i].joinToString(" ")) - else - println("Matrix is too big to display on 80 column console") -} diff --git a/Task/Identity-matrix/Kotlin/identity-matrix.kts b/Task/Identity-matrix/Kotlin/identity-matrix.kts new file mode 100644 index 0000000000..4b0278fd6e --- /dev/null +++ b/Task/Identity-matrix/Kotlin/identity-matrix.kts @@ -0,0 +1,16 @@ +fun main() { + print("Enter size of matrix : ") + val n = readln().toInt() + println() + val identity = Array(n) { i -> + IntArray(n) { j -> + if (i == j) 1 else 0 + } + } + + // print identity matrix if n <= 40 + if (n <= 40) + for (row in identity) println(row.joinToString(" ")) + else + println("Matrix is too big to display on 80 column console") +} diff --git a/Task/Identity-matrix/LSL/identity-matrix.lsl b/Task/Identity-matrix/LSL/identity-matrix.lsl index feec4fb3cc..92a0644c63 100644 --- a/Task/Identity-matrix/LSL/identity-matrix.lsl +++ b/Task/Identity-matrix/LSL/identity-matrix.lsl @@ -1,19 +1,19 @@ default { - state_entry() { - llListen(PUBLIC_CHANNEL, "", llGetOwner(), ""); - llOwnerSay("Please Enter a Dimension for an Identity Matrix."); - } - listen(integer iChannel, string sName, key kId, string sMessage) { - llOwnerSay("You entered "+sMessage+"."); - list lMatrix = []; - integer x = 0; - integer n = (integer)sMessage; - for(x=0 ; x i = j ? 1 : 0); + matrix.Println +end. diff --git a/Task/Identity-matrix/Pluto/identity-matrix.pluto b/Task/Identity-matrix/Pluto/identity-matrix.pluto new file mode 100644 index 0000000000..46f405c2cb --- /dev/null +++ b/Task/Identity-matrix/Pluto/identity-matrix.pluto @@ -0,0 +1,4 @@ +require "matrix" + +local num_rows = 10 -- say +print(matrix.identity(num_rows)) diff --git a/Task/Identity-matrix/PowerShell/identity-matrix-1.psh b/Task/Identity-matrix/PowerShell/identity-matrix-1.ps1 similarity index 100% rename from Task/Identity-matrix/PowerShell/identity-matrix-1.psh rename to Task/Identity-matrix/PowerShell/identity-matrix-1.ps1 diff --git a/Task/Identity-matrix/PowerShell/identity-matrix-2.psh b/Task/Identity-matrix/PowerShell/identity-matrix-2.ps1 similarity index 100% rename from Task/Identity-matrix/PowerShell/identity-matrix-2.psh rename to Task/Identity-matrix/PowerShell/identity-matrix-2.ps1 diff --git a/Task/Identity-matrix/Prolog/identity-matrix.pro b/Task/Identity-matrix/Prolog/identity-matrix.pro index 94044cad1f..6397d9d7d0 100644 --- a/Task/Identity-matrix/Prolog/identity-matrix.pro +++ b/Task/Identity-matrix/Prolog/identity-matrix.pro @@ -1,29 +1,29 @@ %rotates one list clockwise by one integer rotate(Int,List,Rotated) :- - integer(Int), - length(Suff,Int), - append(Pre,Suff,List), - append(Suff,Pre,Rotated). + integer(Int), + length(Suff,Int), + append(Pre,Suff,List), + append(Suff,Pre,Rotated). %rotates a list of lists by a list of integers rotate(LoInts,LoLists,Rotated) :- - is_list(LoInts), - maplist(rotate,LoInts,LoLists,Rotated). + is_list(LoInts), + maplist(rotate,LoInts,LoLists,Rotated). %helper function append_(Suff,Pre,List) :- - append([Pre],Suff,List). + append([Pre],Suff,List). idmatrix(N,IdMatrix):- - %make an N length list of 1s and append with N-1 0s - length(Ones,N), - maplist(=(1),Ones), - succ(N0,N), - length(Zeros,N0), - maplist(=(0),Zeros), - maplist(append_(Zeros),Ones,M), - %create the offsets at rotate each row - numlist(0,N0,Offsets), - rotate(Offsets,M,IdMatrix). + %make an N length list of 1s and append with N-1 0s + length(Ones,N), + maplist(=(1),Ones), + succ(N0,N), + length(Zeros,N0), + maplist(=(0),Zeros), + maplist(append_(Zeros),Ones,M), + %create the offsets at rotate each row + numlist(0,N0,Offsets), + rotate(Offsets,M,IdMatrix). main :- - idmatrix(5,I), - maplist(writeln,I). + idmatrix(5,I), + maplist(writeln,I). diff --git a/Task/Identity-matrix/Rebol/identity-matrix-1.rebol b/Task/Identity-matrix/Rebol/identity-matrix-1.rebol new file mode 100644 index 0000000000..5260ef0941 --- /dev/null +++ b/Task/Identity-matrix/Rebol/identity-matrix-1.rebol @@ -0,0 +1,7 @@ +identity-matrix: function[size [integer!]][ + matrix: array/initial reduce [size size] 0 + repeat i size [matrix/:i/:i: 1] + new-line/all matrix true + matrix +] +probe identity-matrix 5 diff --git a/Task/Identity-matrix/Rebol/identity-matrix-2.rebol b/Task/Identity-matrix/Rebol/identity-matrix-2.rebol new file mode 100644 index 0000000000..02d78116c0 --- /dev/null +++ b/Task/Identity-matrix/Rebol/identity-matrix-2.rebol @@ -0,0 +1,9 @@ +identity-matrix: function [size [integer!]][ + matrix: array/initial size * size 0 ;; Create a flat array with size^2 elements, all zeros + repeat i size [ + matrix/((i - 1) * size + i): 1 ;; Set 1 on the diagonal: row-major position + ] + new-line/skip matrix true size + matrix +] +probe identity-matrix 5 diff --git a/Task/Identity-matrix/Ring/identity-matrix-2.ring b/Task/Identity-matrix/Ring/identity-matrix-2.ring index 4c2d938b39..7c8f780d4a 100644 --- a/Task/Identity-matrix/Ring/identity-matrix-2.ring +++ b/Task/Identity-matrix/Ring/identity-matrix-2.ring @@ -18,30 +18,30 @@ LayoutButtonRow = list(size) app = new qApp { win = new qWidget() { - setWindowTitle('Identity Matrix') - move(500,100) - reSize(600,600) - winheight = win.height() - fontSize = 18 + (winheight / 100) + setWindowTitle('Identity Matrix') + move(500,100) + reSize(600,600) + winheight = win.height() + fontSize = 18 + (winheight / 100) - LayoutButtonMain = new QVBoxLayout() - LayoutButtonMain.setSpacing(C_Spacing) - LayoutButtonMain.setContentsmargins(0,0,0,0) + LayoutButtonMain = new QVBoxLayout() + LayoutButtonMain.setSpacing(C_Spacing) + LayoutButtonMain.setContentsmargins(0,0,0,0) - for Row = 1 to size - LayoutButtonRow[Row] = new QHBoxLayout() { - setSpacing(C_Spacing) - setContentsmargins(0,0,0,0) - } - for Col = 1 to size - Button[Row][Col] = new QPushButton(win) { + for Row = 1 to size + LayoutButtonRow[Row] = new QHBoxLayout() { + setSpacing(C_Spacing) + setContentsmargins(0,0,0,0) + } + for Col = 1 to size + Button[Row][Col] = new QPushButton(win) { setSizePolicy(1,1) - } - - LayoutButtonRow[Row].AddWidget(Button[Row][Col]) - next - LayoutButtonMain.AddLayout(LayoutButtonRow[Row]) - next + } + + LayoutButtonRow[Row].AddWidget(Button[Row][Col]) + next + LayoutButtonMain.AddLayout(LayoutButtonRow[Row]) + next LayoutDataRow1 = new QHBoxLayout() { setSpacing(C_Spacing) setContentsMargins(0,0,0,0) } LayoutButtonMain.AddLayout(LayoutDataRow1) setLayout(LayoutButtonMain) @@ -61,6 +61,6 @@ func pBegin() Button[Row][Col].setStyleSheet(C_ButtonBlueStyle) Button[Row][Col].settext("0") ok - next + next next score = 0 diff --git a/Task/Identity-matrix/Rust/identity-matrix.rust b/Task/Identity-matrix/Rust/identity-matrix.rs similarity index 100% rename from Task/Identity-matrix/Rust/identity-matrix.rust rename to Task/Identity-matrix/Rust/identity-matrix.rs diff --git a/Task/Identity-matrix/Scheme/identity-matrix-1.scm b/Task/Identity-matrix/Scheme/identity-matrix-1.scm new file mode 100644 index 0000000000..7ed20ab33c --- /dev/null +++ b/Task/Identity-matrix/Scheme/identity-matrix-1.scm @@ -0,0 +1,15 @@ +(define (identity n) + (letrec + ((uvec + (lambda (m i acc) + (if (= i n) + acc + (uvec m (+ i 1) + (cons (if (= i m) 1 0) acc))))) + (idgen + (lambda (i acc) + (if (= i n) + acc + (idgen (+ i 1) + (cons (uvec i 0 '()) acc)))))) + (idgen 0 '()))) diff --git a/Task/Identity-matrix/Scheme/identity-matrix-1.ss b/Task/Identity-matrix/Scheme/identity-matrix-1.ss deleted file mode 100644 index fcd8fd0dcc..0000000000 --- a/Task/Identity-matrix/Scheme/identity-matrix-1.ss +++ /dev/null @@ -1,15 +0,0 @@ -(define (identity n) - (letrec - ((uvec - (lambda (m i acc) - (if (= i n) - acc - (uvec m (+ i 1) - (cons (if (= i m) 1 0) acc))))) - (idgen - (lambda (i acc) - (if (= i n) - acc - (idgen (+ i 1) - (cons (uvec i 0 '()) acc)))))) - (idgen 0 '()))) diff --git a/Task/Identity-matrix/Scheme/identity-matrix-2.ss b/Task/Identity-matrix/Scheme/identity-matrix-2.scm similarity index 100% rename from Task/Identity-matrix/Scheme/identity-matrix-2.ss rename to Task/Identity-matrix/Scheme/identity-matrix-2.scm diff --git a/Task/Identity-matrix/SenseTalk/identity-matrix.sensetalk b/Task/Identity-matrix/SenseTalk/identity-matrix.sensetalk index 5b8c568f1e..ece24bf611 100644 --- a/Task/Identity-matrix/SenseTalk/identity-matrix.sensetalk +++ b/Task/Identity-matrix/SenseTalk/identity-matrix.sensetalk @@ -1,28 +1,28 @@ set matrix to buildIdentityMatrix(3) repeat for each item in matrix - put it + put it end repeat set matrix to buildIdentityMatrix(17) repeat for each item in matrix - put it + put it end repeat function buildIdentityMatrix matrixSize - set matrixList to () - repeat matrixSize times - set rowMatrixIndex to the counter - set rowMatrix to () - repeat matrixSize times - if the counter equals rowMatrixIndex - insert 1 after rowMatrix - else - insert 0 after rowMatrix - end if - end repeat - insert rowMatrix nested after matrixList - end repeat - return matrixList + set matrixList to () + repeat matrixSize times + set rowMatrixIndex to the counter + set rowMatrix to () + repeat matrixSize times + if the counter equals rowMatrixIndex + insert 1 after rowMatrix + else + insert 0 after rowMatrix + end if + end repeat + insert rowMatrix nested after matrixList + end repeat + return matrixList end buildIdentityMatrix diff --git a/Task/Identity-matrix/Sparkling/identity-matrix.sparkling b/Task/Identity-matrix/Sparkling/identity-matrix.sparkling index ea0381bc1b..7db205e1c4 100644 --- a/Task/Identity-matrix/Sparkling/identity-matrix.sparkling +++ b/Task/Identity-matrix/Sparkling/identity-matrix.sparkling @@ -1,7 +1,7 @@ function unitMatrix(n) { - return map(range(n), function(k1, v1) { - return map(range(n), function(k2, v2) { - return v2 == v1 ? 1 : 0; - }); - }); + return map(range(n), function(k1, v1) { + return map(range(n), function(k2, v2) { + return v2 == v1 ? 1 : 0; + }); + }); } diff --git a/Task/Identity-matrix/Tailspin/identity-matrix.tailspin b/Task/Identity-matrix/Tailspin/identity-matrix-1.tailspin similarity index 100% rename from Task/Identity-matrix/Tailspin/identity-matrix.tailspin rename to Task/Identity-matrix/Tailspin/identity-matrix-1.tailspin diff --git a/Task/Identity-matrix/Tailspin/identity-matrix-2.tailspin b/Task/Identity-matrix/Tailspin/identity-matrix-2.tailspin new file mode 100644 index 0000000000..301d97f5fd --- /dev/null +++ b/Task/Identity-matrix/Tailspin/identity-matrix-2.tailspin @@ -0,0 +1,8 @@ +identityMatrix templates + n is $; + [1..$n -> [1..~$ -> 0, 1, $~..$n -> 0]] ! +end identityMatrix + +identity is 5 -> identityMatrix; +$identity... -> '|$(1);$(2..)... -> ', $;';| +' ! diff --git a/Task/Identity-matrix/Tcl/identity-matrix-1.tcl b/Task/Identity-matrix/Tcl/identity-matrix-1.tcl index 17692fce2d..652bacb01b 100644 --- a/Task/Identity-matrix/Tcl/identity-matrix-1.tcl +++ b/Task/Identity-matrix/Tcl/identity-matrix-1.tcl @@ -1,7 +1,7 @@ proc I {rank {zero 0.0} {one 1.0}} { set m [lrepeat $rank [lrepeat $rank $zero]] for {set i 0} {$i < $rank} {incr i} { - lset m $i $i $one + lset m $i $i $one } return $m } diff --git a/Task/Identity-matrix/Tcl/identity-matrix-2.tcl b/Task/Identity-matrix/Tcl/identity-matrix-2.tcl index 2342fdd286..c2560fe41a 100644 --- a/Task/Identity-matrix/Tcl/identity-matrix-2.tcl +++ b/Task/Identity-matrix/Tcl/identity-matrix-2.tcl @@ -5,9 +5,9 @@ proc I {rank {zero 0.0} {one 1.0}} { $m add columns $rank $m add rows $rank for {set i 0} {$i < $rank} {incr i} { - for {set j 0} {$j < $rank} {incr j} { - $m set cell $i $j [expr {$i==$j ? $one : $zero}] - } + for {set j 0} {$j < $rank} {incr j} { + $m set cell $i $j [expr {$i==$j ? $one : $zero}] + } } return $m } diff --git a/Task/Identity-matrix/Uiua/identity-matrix.uiua b/Task/Identity-matrix/Uiua/identity-matrix.uiua new file mode 100644 index 0000000000..2c76013a8d --- /dev/null +++ b/Task/Identity-matrix/Uiua/identity-matrix.uiua @@ -0,0 +1,2 @@ +IdMatrix ← ⊞=.⇡ +IdMatrix 7 diff --git a/Task/Identity-matrix/VBScript/identity-matrix-1.vb b/Task/Identity-matrix/VBScript/identity-matrix-1.vb deleted file mode 100644 index 5c7a77dd67..0000000000 --- a/Task/Identity-matrix/VBScript/identity-matrix-1.vb +++ /dev/null @@ -1,29 +0,0 @@ -build_matrix(7) - -Sub build_matrix(n) - Dim matrix() - ReDim matrix(n-1,n-1) - i = 0 - 'populate the matrix - For row = 0 To n-1 - For col = 0 To n-1 - If col = i Then - matrix(row,col) = 1 - Else - matrix(row,col) = 0 - End If - Next - i = i + 1 - Next - 'display the matrix - For row = 0 To n-1 - For col = 0 To n-1 - If col < n-1 Then - WScript.StdOut.Write matrix(row,col) & " " - Else - WScript.StdOut.Write matrix(row,col) - End If - Next - WScript.StdOut.WriteLine - Next -End Sub diff --git a/Task/Identity-matrix/VBScript/identity-matrix-1.vbs b/Task/Identity-matrix/VBScript/identity-matrix-1.vbs new file mode 100644 index 0000000000..a9e51579b8 --- /dev/null +++ b/Task/Identity-matrix/VBScript/identity-matrix-1.vbs @@ -0,0 +1,29 @@ +build_matrix(7) + +Sub build_matrix(n) + Dim matrix() + ReDim matrix(n-1,n-1) + i = 0 + 'populate the matrix + For row = 0 To n-1 + For col = 0 To n-1 + If col = i Then + matrix(row,col) = 1 + Else + matrix(row,col) = 0 + End If + Next + i = i + 1 + Next + 'display the matrix + For row = 0 To n-1 + For col = 0 To n-1 + If col < n-1 Then + WScript.StdOut.Write matrix(row,col) & " " + Else + WScript.StdOut.Write matrix(row,col) + End If + Next + WScript.StdOut.WriteLine + Next +End Sub diff --git a/Task/Identity-matrix/VBScript/identity-matrix-2.vb b/Task/Identity-matrix/VBScript/identity-matrix-2.vbs similarity index 100% rename from Task/Identity-matrix/VBScript/identity-matrix-2.vb rename to Task/Identity-matrix/VBScript/identity-matrix-2.vbs diff --git a/Task/Identity-matrix/Vala/identity-matrix.vala b/Task/Identity-matrix/Vala/identity-matrix.vala index a061d4d56b..6365ad13d8 100644 --- a/Task/Identity-matrix/Vala/identity-matrix.vala +++ b/Task/Identity-matrix/Vala/identity-matrix.vala @@ -1,25 +1,25 @@ int main (string[] args) { - if (args.length < 2) { - print ("Please, input an integer > 0.\n"); - return 0; - } - var n = int.parse (args[1]); - if (n <= 0) { - print ("Please, input an integer > 0.\n"); - return 0; - } - int[,] array = new int[n, n]; - for (var i = 0; i < n; i ++) { - for (var j = 0; j < n; j ++) { - if (i == j) array[i,j] = 1; - else array[i,j] = 0; - } - } - for (var i = 0; i < n; i ++) { - for (var j = 0; j < n; j ++) { - print ("%d ", array[i,j]); - } - print ("\b\n"); - } - return 0; + if (args.length < 2) { + print ("Please, input an integer > 0.\n"); + return 0; + } + var n = int.parse (args[1]); + if (n <= 0) { + print ("Please, input an integer > 0.\n"); + return 0; + } + int[,] array = new int[n, n]; + for (var i = 0; i < n; i ++) { + for (var j = 0; j < n; j ++) { + if (i == j) array[i,j] = 1; + else array[i,j] = 0; + } + } + for (var i = 0; i < n; i ++) { + for (var j = 0; j < n; j ++) { + print ("%d ", array[i,j]); + } + print ("\b\n"); + } + return 0; } diff --git a/Task/Identity-matrix/Wren/identity-matrix.wren b/Task/Identity-matrix/Wren/identity-matrix.wren index da703414a2..9e717f28f2 100644 --- a/Task/Identity-matrix/Wren/identity-matrix.wren +++ b/Task/Identity-matrix/Wren/identity-matrix.wren @@ -1,5 +1,5 @@ -import "/matrix" for Matrix -import "/fmt" for Fmt +import "./matrix" for Matrix +import "./fmt" for Fmt var numRows = 10 // say Fmt.mprint(Matrix.identity(numRows), 2, 0) diff --git a/Task/Identity-matrix/XBasic/identity-matrix.basic b/Task/Identity-matrix/XBasic/identity-matrix.basic index eede4569ac..8af9483abb 100644 --- a/Task/Identity-matrix/XBasic/identity-matrix.basic +++ b/Task/Identity-matrix/XBasic/identity-matrix.basic @@ -1,5 +1,5 @@ PROGRAM "Identity matrix" -VERSION "0.0000" +VERSION "0.0000" DECLARE FUNCTION Entry () diff --git a/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Ada/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.adb b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Ada/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.adb new file mode 100644 index 0000000000..d2d6842033 --- /dev/null +++ b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Ada/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.adb @@ -0,0 +1,12 @@ +with Ada.Strings.Maps; use Ada.Strings.Maps; +with Ada.Text_IO; + +procedure Show_Valid_Identifiers is + Valid_First_Character : constant Character_Set := To_Set (Ranges => (1 => ('a', 'z'), 2 => ('A', 'Z'))); + Valid_Last_Character : constant Character_Set := Valid_First_Character or To_Set (Ranges => (1 => ('0', '9'))); + Valid_Middle_Character : constant Character_Set := Valid_Last_Character or To_Set ('_'); +begin + Ada.Text_IO.Put_Line ("Valid for the first character: " & String (To_Sequence (Valid_First_Character))); + Ada.Text_IO.Put_Line ("Valid for any middle character: " & String (To_Sequence (Valid_Middle_Character))); + Ada.Text_IO.Put_Line ("Valid for the last character: " & String (To_Sequence (Valid_Last_Character))); +end Show_Valid_Identifiers; diff --git a/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Delphi/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.delphi b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Delphi/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.pas similarity index 100% rename from Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Delphi/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.delphi rename to Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Delphi/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.pas diff --git a/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/DuckDB/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.duckdb b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/DuckDB/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.duckdb new file mode 100644 index 0000000000..44a338df57 --- /dev/null +++ b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/DuckDB/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.duckdb @@ -0,0 +1,27 @@ +# Generate a string of all the codepoints in the range [m,n) +# corresponding to the given Unicode character class, where `class` +# could be '[a-z]' or '\p{Ll}', etc. +# +# Note: codepoints 55296 to 57343 (xD800–xDFFF) are reserved for the +# surrogates mechanism and are excluded as they are regarded as "illegal" +# as characters. +# +create or replace function generate(class, m, n) as ( + select string_agg(s, '') + from (select + case when 55296 <=i and i <= 57343 then null + else regexp_extract( chr(i::INTEGER), class) + end as s + from range(m, n) t(i)) +); + +# ident_start minus NBSP +select generate( '[A-Za-z\200-\237\241-\377_]',0, 1024); + +.mode list + +with ident_start as ( + select generate( '[A-Za-z\200-\237\241-\377_]',0,1024 ) as s + ) + select unnest(regexp_extract_all(s, '.{1,26}')) + from ident_start; diff --git a/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/EasyLang/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.easy b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/EasyLang/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.easy new file mode 100644 index 0000000000..700c376ff1 --- /dev/null +++ b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/EasyLang/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.easy @@ -0,0 +1,13 @@ +print "First character:" +write "_" +for i = strcode "A" to strcode "Z" + write strchar i +. +for i = strcode "a" to strcode "z" + write strchar i +. +print "" +print "Not as the first character additionally:" +for i = strcode "0" to strcode "9" + write strchar i +. diff --git a/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Julia/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.julia b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Julia/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.jl similarity index 100% rename from Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Julia/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.julia rename to Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Julia/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.jl diff --git a/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Kotlin/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.kotlin b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Kotlin/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.kts similarity index 100% rename from Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Kotlin/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.kotlin rename to Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Kotlin/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.kts diff --git a/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/M2000-Interpreter/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.m2000 b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/M2000-Interpreter/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.m2000 new file mode 100644 index 0000000000..1ab74f5f29 --- /dev/null +++ b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/M2000-Interpreter/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.m2000 @@ -0,0 +1,12 @@ +for=100 +print for=100 +for for=1 to 10:Print for: Next for +Print for=11 +to=100 +print to=100 +for to=1 to 10:Print to: Next to +Print to=11 +Print=100 +print Print=100 +for Print=1 to 10:Print Print: Next Print +Print Print=11 diff --git a/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Wren/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.wren b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Wren/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.wren index 381544e810..8e2277f929 100644 --- a/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Wren/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.wren +++ b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/Wren/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.wren @@ -1,3 +1,4 @@ for (i in 97..122) System.write(String.fromByte(i)) for (i in 65..90) System.write(String.fromByte(i)) +for (i in 48..57) System.write(String.fromByte(i)) System.print("_") diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Ada/idiomatically-determine-all-the-lowercase-and-uppercase-letters.ada b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Ada/idiomatically-determine-all-the-lowercase-and-uppercase-letters.adb similarity index 100% rename from Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Ada/idiomatically-determine-all-the-lowercase-and-uppercase-letters.ada rename to Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Ada/idiomatically-determine-all-the-lowercase-and-uppercase-letters.adb diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Arturo/idiomatically-determine-all-the-lowercase-and-uppercase-letters.arturo b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Arturo/idiomatically-determine-all-the-lowercase-and-uppercase-letters.arturo index 05b8a27f68..7c6cd7e44d 100644 --- a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Arturo/idiomatically-determine-all-the-lowercase-and-uppercase-letters.arturo +++ b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Arturo/idiomatically-determine-all-the-lowercase-and-uppercase-letters.arturo @@ -1,2 +1,2 @@ -print ["lowercase letters:" `a`..`z`] -print ["uppercase letters:" `A`..`Z`] +print ["lowercase letters:" @'a'..'z'] +print ["uppercase letters:" @'A'..'Z'] diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/COBOL/idiomatically-determine-all-the-lowercase-and-uppercase-letters.cobol b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/COBOL/idiomatically-determine-all-the-lowercase-and-uppercase-letters.cob similarity index 100% rename from Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/COBOL/idiomatically-determine-all-the-lowercase-and-uppercase-letters.cobol rename to Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/COBOL/idiomatically-determine-all-the-lowercase-and-uppercase-letters.cob diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Crystal/idiomatically-determine-all-the-lowercase-and-uppercase-letters.cr b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Crystal/idiomatically-determine-all-the-lowercase-and-uppercase-letters.cr new file mode 100644 index 0000000000..5c334faa07 --- /dev/null +++ b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Crystal/idiomatically-determine-all-the-lowercase-and-uppercase-letters.cr @@ -0,0 +1,10 @@ +letters = ((0.chr)..Char::MAX).group_by { |ch| + case ch + when .lowercase? then :lower + when .uppercase? then :upper + else :neither + end +} + +puts "Lowercase: #{letters[:lower].join(" ")}" +puts "Uppercase: #{letters[:upper].join(" ")}" diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Delphi/idiomatically-determine-all-the-lowercase-and-uppercase-letters.delphi b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Delphi/idiomatically-determine-all-the-lowercase-and-uppercase-letters.pas similarity index 100% rename from Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Delphi/idiomatically-determine-all-the-lowercase-and-uppercase-letters.delphi rename to Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Delphi/idiomatically-determine-all-the-lowercase-and-uppercase-letters.pas diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/DuckDB/idiomatically-determine-all-the-lowercase-and-uppercase-letters.duckdb b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/DuckDB/idiomatically-determine-all-the-lowercase-and-uppercase-letters.duckdb new file mode 100644 index 0000000000..825cc013b9 --- /dev/null +++ b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/DuckDB/idiomatically-determine-all-the-lowercase-and-uppercase-letters.duckdb @@ -0,0 +1,19 @@ +# The number of Unicode codepoints +set variable maxu = 1114112; + +# Generate a string of all the codepoints in the range [m,n) +# corresponding to the given Unicode character class, where `class` +# could be '[a-z]' or '\p{Ll}', etc. +# +# Note: codepoints 55296 to 57343 (xD800–xDFFF) are reserved for the +# surrogates mechanism and are excluded as they are regarded "illegal" +# as characters. +# +create or replace function generate(class, m, n) as ( + select string_agg(s, '') + from (select + case when 55296 <=i and i <= 57343 then null + else regexp_extract( chr(i::INTEGER), class) + end as s + from range(m, n) t(i)) +); diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/EasyLang/idiomatically-determine-all-the-lowercase-and-uppercase-letters.easy b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/EasyLang/idiomatically-determine-all-the-lowercase-and-uppercase-letters.easy index aca86fb76f..a8bb064adb 100644 --- a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/EasyLang/idiomatically-determine-all-the-lowercase-and-uppercase-letters.easy +++ b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/EasyLang/idiomatically-determine-all-the-lowercase-and-uppercase-letters.easy @@ -1,7 +1,6 @@ -for i = strcode "a" to strcode "z" - write strchar i -. -print "" -for i = strcode "A" to strcode "Z" - write strchar i +proc out a b . + for i = a to b : write strchar i + print "" . +out 97 122 +out 65 90 diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Haskell/idiomatically-determine-all-the-lowercase-and-uppercase-letters-3.hs b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Haskell/idiomatically-determine-all-the-lowercase-and-uppercase-letters-3.hs index 164ce4f353..f3f86f5e34 100644 --- a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Haskell/idiomatically-determine-all-the-lowercase-and-uppercase-letters-3.hs +++ b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Haskell/idiomatically-determine-all-the-lowercase-and-uppercase-letters-3.hs @@ -1,4 +1,4 @@ (let chars-between (comp range (map char-code) (... str))) -(str "Upper-case: " (chars-between 65 91) " -Lower-case: " (chars-between 97 123)) +"Upper-case: {chars-between 65 91} +Lower-case: {chars-between 97 123}" diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Julia/idiomatically-determine-all-the-lowercase-and-uppercase-letters.jl b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Julia/idiomatically-determine-all-the-lowercase-and-uppercase-letters.jl new file mode 100644 index 0000000000..19a26a3ffa --- /dev/null +++ b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Julia/idiomatically-determine-all-the-lowercase-and-uppercase-letters.jl @@ -0,0 +1,24 @@ +function countunicode() + count = 0 + az = "" + AZ = "" + for i in 0:0xffffff + if isvalid(Char, i) + c = Char(i) + count += 1 + if i < 128 && isletter(c) + if islowercase(c) + az *= "$c" + elseif isuppercase(c) + AZ *= "$c" + end + end + end + end + count, az, AZ +end + +unicodecount, lcletters, ucletters = countunicode() + +println("There are $unicodecount valid Chars and the ASCII English ones are:") +println("lowercase: $lcletters and uppercase: $ucletters .") diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Julia/idiomatically-determine-all-the-lowercase-and-uppercase-letters.julia b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Julia/idiomatically-determine-all-the-lowercase-and-uppercase-letters.julia deleted file mode 100644 index 9a83077168..0000000000 --- a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Julia/idiomatically-determine-all-the-lowercase-and-uppercase-letters.julia +++ /dev/null @@ -1,25 +0,0 @@ -function countunicode() - englishlettercodes = [Int(c) for c in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"] - count = 0 - az = "" - AZ = "" - for i in 0:0xffffff - if is_assigned_char(i) - count += 1 - end - if i in englishlettercodes - c = Char(i) - if islower(c) - az *= "$c" - else - AZ *= "$c" - end - end - end - count, az, AZ -end - -unicodecount, lcletters, ucletters = countunicode() - -print("There are $unicodecount valid Chars and the English ones are ") -println("lowercase: $lcletters and uppercase: $ucletters.") diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Kotlin/idiomatically-determine-all-the-lowercase-and-uppercase-letters.kotlin b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Kotlin/idiomatically-determine-all-the-lowercase-and-uppercase-letters.kts similarity index 100% rename from Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Kotlin/idiomatically-determine-all-the-lowercase-and-uppercase-letters.kotlin rename to Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Kotlin/idiomatically-determine-all-the-lowercase-and-uppercase-letters.kts diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Phix/idiomatically-determine-all-the-lowercase-and-uppercase-letters-1.phix b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Phix/idiomatically-determine-all-the-lowercase-and-uppercase-letters-1.phix new file mode 100644 index 0000000000..b307e0490a --- /dev/null +++ b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Phix/idiomatically-determine-all-the-lowercase-and-uppercase-letters-1.phix @@ -0,0 +1,10 @@ +with javascript_semantics +sequence lc = {}, uc = {} +for ch=1 to 255 do + if islower(ch) then lc &= ch end if + if isupper(ch) then uc &= ch end if +end for +lc = utf32_to_utf8(lc)&"\n" +uc = utf32_to_utf8(uc)&"\n" +puts(1,lc) +puts(1,uc) diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Phix/idiomatically-determine-all-the-lowercase-and-uppercase-letters-2.phix b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Phix/idiomatically-determine-all-the-lowercase-and-uppercase-letters-2.phix new file mode 100644 index 0000000000..a2d8ee8e1d --- /dev/null +++ b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Phix/idiomatically-determine-all-the-lowercase-and-uppercase-letters-2.phix @@ -0,0 +1,4 @@ +?tagset('z','a') +?tagstart('a',26) +?tagset('Z','A') +?tagstart('A',26) diff --git a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Phix/idiomatically-determine-all-the-lowercase-and-uppercase-letters.phix b/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Phix/idiomatically-determine-all-the-lowercase-and-uppercase-letters.phix deleted file mode 100644 index be7c73650e..0000000000 --- a/Task/Idiomatically-determine-all-the-lowercase-and-uppercase-letters/Phix/idiomatically-determine-all-the-lowercase-and-uppercase-letters.phix +++ /dev/null @@ -1,11 +0,0 @@ -(phixonline)--> - sequence lc = {}, uc = {} - for ch=1 to 255 do - if islower(ch) then lc &= ch end if - if isupper(ch) then uc &= ch end if - end for - lc = utf32_to_utf8(lc)&"\n" - uc = utf32_to_utf8(uc)&"\n" - puts(1,lc) - puts(1,uc) - - without js -- (class) - class Animal - private string species - end class - class Dog extends Animal - public procedure bark() - puts(1,"woof\n") - end procedure - end class - class Lab extends Dog end class - class Collie extends Dog end class - class Cat extends Animal end class - loop next position + j 1b + +2: + li t0,'-' # first byte is - ? + bne t5,t0,21f + li t1,1 # negative sign + j 4f # next position +21: + li t0,'+' # first byte is + ? + beq t5,t0,4f # yes -> next position +3: # debut de boucle de traitement des chiffres + li t0,'0' + blt t5,t0,4f # byte is not numeric + li t0,'9' + bgt t5,t0,4f # byte is not numeric + addi t5,t5,-48 + li t0,NUMMAXI + bgt a0,t0,99f # number maxi ? + + mul a0,t2,a0 # multiply by factor 10 + add a0,a0,t5 # and add new byte + +4: + addi t3,t3,1 # next position + add t0,t4,t3 + lbu t5,(t0) # load byte + beq t5,x0,5f # string end -> end + li t0,0x0A + beq t5,t0,5f # string end -> end + j 3b # or loop +5: + beqz t1,100f # positive sign ? + neg a0,a0 # no + j 100f +99: # overflow error + la a0,szMessErrDep + call writeString + li a0,0 # on error return zero +100: + lw ra, 0(sp) + addi sp, sp, 4 + ret + +/************************************/ +/* file include Fonctions */ +/***********************************/ +/* for this file see risc-v task include a file */ +.include "../../includeFunctions.s" diff --git a/Task/Integer-comparison/ReScript/integer-comparison.re b/Task/Integer-comparison/ReScript/integer-comparison.res similarity index 100% rename from Task/Integer-comparison/ReScript/integer-comparison.re rename to Task/Integer-comparison/ReScript/integer-comparison.res diff --git a/Task/Integer-comparison/REBOL/integer-comparison.rebol b/Task/Integer-comparison/Rebol/integer-comparison.rebol similarity index 96% rename from Task/Integer-comparison/REBOL/integer-comparison.rebol rename to Task/Integer-comparison/Rebol/integer-comparison.rebol index 8afe43551e..2f92c6d90e 100644 --- a/Task/Integer-comparison/REBOL/integer-comparison.rebol +++ b/Task/Integer-comparison/Rebol/integer-comparison.rebol @@ -1,4 +1,4 @@ -REBOL [ +Rebol [ Title: "Comparing Two Integers" URL: http://rosettacode.org/wiki/Comparing_two_integers ] diff --git a/Task/Integer-comparison/Rust/integer-comparison.rust b/Task/Integer-comparison/Rust/integer-comparison.rs similarity index 100% rename from Task/Integer-comparison/Rust/integer-comparison.rust rename to Task/Integer-comparison/Rust/integer-comparison.rs diff --git a/Task/Integer-comparison/Rye/integer-comparison.rye b/Task/Integer-comparison/Rye/integer-comparison.rye new file mode 100644 index 0000000000..961dc50523 --- /dev/null +++ b/Task/Integer-comparison/Rye/integer-comparison.rye @@ -0,0 +1,4 @@ +a: integer input "Enter value of a" +b: integer input "Enter value of b" + +cases a { { a < b } { print "Less than" } { a = b } { print "Equal to" } { a > b } { print "Greater than" } } diff --git a/Task/Integer-comparison/Scheme/integer-comparison.ss b/Task/Integer-comparison/Scheme/integer-comparison.scm similarity index 100% rename from Task/Integer-comparison/Scheme/integer-comparison.ss rename to Task/Integer-comparison/Scheme/integer-comparison.scm diff --git a/Task/Integer-comparison/V-(Vlang)/integer-comparison.v b/Task/Integer-comparison/V-(Vlang)/integer-comparison.v new file mode 100644 index 0000000000..cf27fc8509 --- /dev/null +++ b/Task/Integer-comparison/V-(Vlang)/integer-comparison.v @@ -0,0 +1,17 @@ +import os + +fn main(){ + mut enter := "" + mut a, mut b := 0, 0 + enter = os.input("Enter number for a: ") + if enter.is_int() {a = enter.int()} else {println("Invalid input!") exit(1)} + enter = os.input("Enter number for b: ") + if enter.is_int() {b = enter.int()} else {println("Invalid input!") exit(1)} + match true { + a < b {println("${a} less than ${b}")} + a == b {println("${a} equal to ${b}")} + a > b {println("${a} greater than ${b}")} + else{} + } + exit(0) +} diff --git a/Task/Integer-comparison/VBScript/integer-comparison.vb b/Task/Integer-comparison/VBScript/integer-comparison.vbs similarity index 100% rename from Task/Integer-comparison/VBScript/integer-comparison.vb rename to Task/Integer-comparison/VBScript/integer-comparison.vbs diff --git a/Task/Integer-comparison/YAMLScript/integer-comparison.ys b/Task/Integer-comparison/YAMLScript/integer-comparison.ys new file mode 100644 index 0000000000..59b265bd8e --- /dev/null +++ b/Task/Integer-comparison/YAMLScript/integer-comparison.ys @@ -0,0 +1,8 @@ +!YS-v0 + +defn main(x y): + say: + cond: + x < y: "$x is less than $y" + x > y: "$x is greater than $y" + else : "$x is equal to $y" diff --git a/Task/Integer-overflow/ALGOL-M/integer-overflow.alg b/Task/Integer-overflow/ALGOL-M/integer-overflow.alg new file mode 100644 index 0000000000..c285f7d9f2 --- /dev/null +++ b/Task/Integer-overflow/ALGOL-M/integer-overflow.alg @@ -0,0 +1,6 @@ +begin +integer n; +n := 16383; % maximum integer value % +write(n+2); +write(n*2); +end diff --git a/Task/Integer-overflow/Ada/integer-overflow.ada b/Task/Integer-overflow/Ada/integer-overflow.ada deleted file mode 100644 index 1deb7a7c8b..0000000000 --- a/Task/Integer-overflow/Ada/integer-overflow.ada +++ /dev/null @@ -1,51 +0,0 @@ -with Ada.Text_IO; use Ada.Text_IO; - -procedure Overflow is - - generic - type T is Range <>; - Name_Of_T: String; - procedure Print_Bounds; -- first instantiate this with T, Name - -- then call the instantiation - procedure Print_Bounds is - begin - Put_Line(" " & Name_Of_T & " " & T'Image(T'First) - & " .." & T'Image(T'Last)); - end Print_Bounds; - - procedure P_Int is new Print_Bounds(Integer, "Integer "); - procedure P_Nat is new Print_Bounds(Natural, "Natural "); - procedure P_Pos is new Print_Bounds(Positive, "Positive"); - procedure P_Long is new Print_Bounds(Long_Integer, "Long "); - - type Unsigned_Byte is range 0 .. 255; - type Signed_Byte is range -128 .. 127; - type Unsigned_Word is range 0 .. 2**32-1; - type Thousand is range 0 .. 999; - type Signed_Double is range - 2**63 .. 2**63-1; - type Crazy is range -11 .. -3; - - procedure P_UB is new Print_Bounds(Unsigned_Byte, "U 8 "); - procedure P_SB is new Print_Bounds(Signed_Byte, "S 8 "); - procedure P_UW is new Print_Bounds(Unsigned_Word, "U 32 "); - procedure P_Th is new Print_Bounds(Thousand, "Thous"); - procedure P_SD is new Print_Bounds(Signed_Double, "S 64 "); - procedure P_Cr is new Print_Bounds(Crazy, "Crazy"); - - A: Crazy := Crazy'First; - -begin - Put_Line("Predefined Types:"); - P_Int; P_Nat; P_Pos; P_Long; - New_Line; - - Put_Line("Types defined by the user:"); - P_UB; P_SB; P_UW; P_Th; P_SD; P_Cr; - New_Line; - - Put_Line("Forcing a variable of type Crazy to overflow:"); - loop -- endless loop - Put(" " & Crazy'Image(A) & "+1"); - A := A + 1; -- line 49 -- this will later raise a CONSTRAINT_ERROR - end loop; -end Overflow; diff --git a/Task/Integer-overflow/Ada/integer-overflow.adb b/Task/Integer-overflow/Ada/integer-overflow.adb new file mode 100644 index 0000000000..da4fe71c7b --- /dev/null +++ b/Task/Integer-overflow/Ada/integer-overflow.adb @@ -0,0 +1,51 @@ +with Ada.Text_IO; use Ada.Text_IO; + +procedure Overflow is + + generic + type T is Range <>; + Name_Of_T: String; + procedure Print_Bounds; -- first instantiate this with T, Name + -- then call the instantiation + procedure Print_Bounds is + begin + Put_Line(" " & Name_Of_T & " " & T'Image(T'First) + & " .." & T'Image(T'Last)); + end Print_Bounds; + + procedure P_Int is new Print_Bounds(Integer, "Integer "); + procedure P_Nat is new Print_Bounds(Natural, "Natural "); + procedure P_Pos is new Print_Bounds(Positive, "Positive"); + procedure P_Long is new Print_Bounds(Long_Integer, "Long "); + + type Unsigned_Byte is range 0 .. 255; + type Signed_Byte is range -128 .. 127; + type Unsigned_Word is range 0 .. 2**32-1; + type Thousand is range 0 .. 999; + type Signed_Double is range - 2**63 .. 2**63-1; + type Crazy is range -11 .. -3; + + procedure P_UB is new Print_Bounds(Unsigned_Byte, "U 8 "); + procedure P_SB is new Print_Bounds(Signed_Byte, "S 8 "); + procedure P_UW is new Print_Bounds(Unsigned_Word, "U 32 "); + procedure P_Th is new Print_Bounds(Thousand, "Thous"); + procedure P_SD is new Print_Bounds(Signed_Double, "S 64 "); + procedure P_Cr is new Print_Bounds(Crazy, "Crazy"); + + A: Crazy := Crazy'First; + +begin + Put_Line("Predefined Types:"); + P_Int; P_Nat; P_Pos; P_Long; + New_Line; + + Put_Line("Types defined by the user:"); + P_UB; P_SB; P_UW; P_Th; P_SD; P_Cr; + New_Line; + + Put_Line("Forcing a variable of type Crazy to overflow:"); + loop -- endless loop + Put(" " & Crazy'Image(A) & "+1"); + A := A + 1; -- line 49 -- this will later raise a CONSTRAINT_ERROR + end loop; +end Overflow; diff --git a/Task/Integer-overflow/Applesoft-BASIC/integer-overflow-5.basic b/Task/Integer-overflow/Applesoft-BASIC/integer-overflow-5.basic index af3e54154a..342b708226 100644 --- a/Task/Integer-overflow/Applesoft-BASIC/integer-overflow-5.basic +++ b/Task/Integer-overflow/Applesoft-BASIC/integer-overflow-5.basic @@ -1 +1 @@ -A% = -32767 : POKE PEEK(131) + PEEK(132) * 256, 0 : ? A% +A% = -32767 : POKE PEEK(131) + PEEK(132) * 256 + 1, 0 : ? A% diff --git a/Task/Integer-overflow/COBOL/integer-overflow-1.cobol b/Task/Integer-overflow/COBOL/integer-overflow-1.cob similarity index 100% rename from Task/Integer-overflow/COBOL/integer-overflow-1.cobol rename to Task/Integer-overflow/COBOL/integer-overflow-1.cob diff --git a/Task/Integer-overflow/COBOL/integer-overflow-2.cobol b/Task/Integer-overflow/COBOL/integer-overflow-2.cob similarity index 100% rename from Task/Integer-overflow/COBOL/integer-overflow-2.cobol rename to Task/Integer-overflow/COBOL/integer-overflow-2.cob diff --git a/Task/Integer-overflow/Crystal/integer-overflow.cr b/Task/Integer-overflow/Crystal/integer-overflow.cr new file mode 100644 index 0000000000..2a14023b37 --- /dev/null +++ b/Task/Integer-overflow/Crystal/integer-overflow.cr @@ -0,0 +1,38 @@ +macro try (expr) + printf "%-*s # => ", padding, {{expr.stringify}} + begin + puts {{expr}} + rescue ex + puts "Exception: #{ex.message}" + end +end + +padding = 25 +puts "Result does not fit into a 32-bit signed integer:" +try -(-2147483647-1) +try 2000000000 + 2000000000 +try -2147483647 - 2147483647 +try 46341 * 46341 +try (-2147483647-1) // -1 + +padding = 52 +puts "\nResult does not fit into a 64-bit signed integer:" +try -(-9223372036854775807 - 1) +try 5000000000000000000 + 5000000000000000000 +try -9223372036854775807 - 9223372036854775807 +try 3037000500 * 3037000500 +try (-9223372036854775807 - 1) // -1 + +padding = 32 +puts "\nResult does not fit into a 32-bit unsigned integer:" +try -4294967295.to_u32 +try 3000000000_u32 + 3000000000_u32 +try 2147483647_u32 - 4294967295_u32 +try 65537_u32 * 65537_u32 + +padding = 52 +puts "\nResult that does not fit into a 64-bit unsigned integer:" +try -18446744073709551615_i128.to_u64 +try 10000000000000000000_u64 + 10000000000000000000_u64 +try 9223372036854775807_u64 - 18446744073709551615_u64 +try 4294967296_u64 * 4294967296_64 diff --git a/Task/Integer-overflow/Delphi/integer-overflow.delphi b/Task/Integer-overflow/Delphi/integer-overflow.delphi deleted file mode 100644 index 05327d8aee..0000000000 --- a/Task/Integer-overflow/Delphi/integer-overflow.delphi +++ /dev/null @@ -1,123 +0,0 @@ -var IS32: integer; {Signed 32-bit integer} -var IS64: Int64; {Signed 64-bit integer} -var IU32: cardinal; {Unsigned 32-bit integer} - -{============ Signed 32 bit tests ===================================} - -procedure TestSigned32_1; -begin -IS32:=-(-2147483647-1); -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - -procedure TestSigned32_2; -begin -IS32:=2000000000 + 2000000000; -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - - - -procedure TestSigned32_3; -begin -IS32:=-2147483647 - 2147483647; -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - -procedure TestSigned32_4; -begin -IS32:=46341 * 46341; -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - - - -procedure TestSigned32_5; -begin -IS32:=(-2147483647-1) div -1; -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - -{============ Signed 64 bit tests ===================================} - -procedure TestSigned64_1; -begin -IS64:=-(-9223372036854775807-1); -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - - -procedure TestSigned64_2; -begin -IS64:=5000000000000000000+5000000000000000000; -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - - -procedure TestSigned64_3; -begin -IS64:=-9223372036854775807 - 9223372036854775807; -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - - -procedure TestSigned64_4; -begin -IS64:=3037000500 * 3037000500; -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - - -procedure TestSigned64_5; -begin -IS64:=(-9223372036854775807-1) div -1; -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - - -{============ UnSigned 32 bit tests ===================================} - -procedure TestUnSigned32_1; -begin -IU32:=-4294967295; -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - - -procedure TestUnSigned32_2; -begin -IU32:=3000000000 + 3000000000; -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - - -procedure TestUnSigned32_3; -begin -IU32:=2147483647 - 4294967295; -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - - -procedure TestUnSigned32_4; -begin -IU32:=65537 * 65537; -end; - -// Compiler: "Overflow in conversion or arithmetic operation" - - -//Delphi-6 does not have 64-bit unsigned integers. -//Later version have 64-bit unsigned integers. diff --git a/Task/Integer-overflow/Delphi/integer-overflow.pas b/Task/Integer-overflow/Delphi/integer-overflow.pas new file mode 100644 index 0000000000..865888a299 --- /dev/null +++ b/Task/Integer-overflow/Delphi/integer-overflow.pas @@ -0,0 +1,123 @@ +var IS32: integer; {Signed 32-bit integer} +var IS64: Int64; {Signed 64-bit integer} +var IU32: cardinal; {Unsigned 32-bit integer} + +{============ Signed 32 bit tests ===================================} + +procedure TestSigned32_1; +begin +IS32:=-(-2147483647-1); +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + +procedure TestSigned32_2; +begin +IS32:=2000000000 + 2000000000; +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + + + +procedure TestSigned32_3; +begin +IS32:=-2147483647 - 2147483647; +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + +procedure TestSigned32_4; +begin +IS32:=46341 * 46341; +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + + + +procedure TestSigned32_5; +begin +IS32:=(-2147483647-1) div -1; +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + +{============ Signed 64 bit tests ===================================} + +procedure TestSigned64_1; +begin +IS64:=-(-9223372036854775807-1); +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + + +procedure TestSigned64_2; +begin +IS64:=5000000000000000000+5000000000000000000; +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + + +procedure TestSigned64_3; +begin +IS64:=-9223372036854775807 - 9223372036854775807; +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + + +procedure TestSigned64_4; +begin +IS64:=3037000500 * 3037000500; +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + + +procedure TestSigned64_5; +begin +IS64:=(-9223372036854775807-1) div -1; +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + + +{============ UnSigned 32 bit tests ===================================} + +procedure TestUnSigned32_1; +begin +IU32:=-4294967295; +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + + +procedure TestUnSigned32_2; +begin +IU32:=3000000000 + 3000000000; +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + + +procedure TestUnSigned32_3; +begin +IU32:=2147483647 - 4294967295; +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + + +procedure TestUnSigned32_4; +begin +IU32:=65537 * 65537; +end; + +// Compiler: "Overflow in conversion or arithmetic operation" + + +//Delphi-6 does not have 64-bit unsigned integers. +//Later version have 64-bit unsigned integers. diff --git a/Task/Integer-overflow/FutureBasic/integer-overflow.basic b/Task/Integer-overflow/FutureBasic/integer-overflow.basic new file mode 100644 index 0000000000..722195a19e --- /dev/null +++ b/Task/Integer-overflow/FutureBasic/integer-overflow.basic @@ -0,0 +1,17 @@ +include "NSLog.incl" + +NSLog( @"FB Integer ranges:\n" ) + +NSLog( @"UInt64: 0 to %llu", ULLONG_MAX ) +NSLog( @"SInt64: %lld to %lld\n", LLONG_MIN, LLONG_MAX ) + +NSLog( @"UInt32: 0 to %u", UINT_MAX ) +NSLog( @"SInt32: %ld to %ld\n", INT_MIN, INT_MAX ) + +NSLog( @"UInt16: 0 to %hu", USHRT_MAX ) +NSLog( @"SInt16: %hd to %hd\n", SHRT_MIN, SHRT_MAX ) + +NSLog( @"UInt8: 0 to %u", UCHAR_MAX ) +NSLog( @"SInt8: %d to %d", CHAR_MIN, CHAR_MAX ) + +HandleEvents diff --git a/Task/Integer-overflow/Go/integer-overflow.go b/Task/Integer-overflow/Go/integer-overflow.go index 0beb5da9a1..755a63b7f1 100644 --- a/Task/Integer-overflow/Go/integer-overflow.go +++ b/Task/Integer-overflow/Go/integer-overflow.go @@ -3,106 +3,106 @@ package main import "fmt" func main() { - // Go's builtin integer types are: - // int, int8, int16, int32, int64 - // uint, uint8, uint16, uint32, uint64 - // byte, rune, uintptr - // - // int is either 32 or 64 bit, depending on the system - // uintptr is large enough to hold the bit pattern of any pointer - // byte is 8 bits like int8 - // rune is 32 bits like int32 - // - // Overflow and underflow is silent. The math package defines a number - // of constants that can be helpfull, e.g.: - // math.MaxInt64 = 1<<63 - 1 - // math.MinInt64 = -1 << 63 - // math.MaxUint64 = 1<<64 - 1 - // - // The math/big package implements multi-precision - // arithmetic (big numbers). - // - // In all cases assignment from one type to another requires - // an explicit cast, even if the types are otherwise identical - // (e.g. rune and int32 or int and either int32 or int64). - // Casts silently truncate if required. - // - // Invalid: - // var i int = int32(0) - // var r rune = int32(0) - // var b byte = int8(0) - // - // Valid: - var i64 int64 = 42 - var i32 int32 = int32(i64) - var i16 int16 = int16(i64) - var i8 int8 = int8(i16) - var i int = int(i8) - var r rune = rune(i) - var b byte = byte(r) - var u64 uint64 = uint64(b) - var u32 uint32 + // Go's builtin integer types are: + // int, int8, int16, int32, int64 + // uint, uint8, uint16, uint32, uint64 + // byte, rune, uintptr + // + // int is either 32 or 64 bit, depending on the system + // uintptr is large enough to hold the bit pattern of any pointer + // byte is 8 bits like int8 + // rune is 32 bits like int32 + // + // Overflow and underflow is silent. The math package defines a number + // of constants that can be helpfull, e.g.: + // math.MaxInt64 = 1<<63 - 1 + // math.MinInt64 = -1 << 63 + // math.MaxUint64 = 1<<64 - 1 + // + // The math/big package implements multi-precision + // arithmetic (big numbers). + // + // In all cases assignment from one type to another requires + // an explicit cast, even if the types are otherwise identical + // (e.g. rune and int32 or int and either int32 or int64). + // Casts silently truncate if required. + // + // Invalid: + // var i int = int32(0) + // var r rune = int32(0) + // var b byte = int8(0) + // + // Valid: + var i64 int64 = 42 + var i32 int32 = int32(i64) + var i16 int16 = int16(i64) + var i8 int8 = int8(i16) + var i int = int(i8) + var r rune = rune(i) + var b byte = byte(r) + var u64 uint64 = uint64(b) + var u32 uint32 - //const c int = -(-2147483647 - 1) // Compiler error on 32 bit systems, ok on 64 bit - const c = -(-2147483647 - 1) // Allowed even on 32 bit systems, c is untyped - i64 = c - //i32 = c // Compiler error - //i32 = -(-2147483647 - 1) // Compiler error - i32 = -2147483647 - i32 = -(-i32 - 1) - fmt.Println("32 bit signed integers") - fmt.Printf(" -(-2147483647 - 1) = %d, got %d\n", i64, i32) + //const c int = -(-2147483647 - 1) // Compiler error on 32 bit systems, ok on 64 bit + const c = -(-2147483647 - 1) // Allowed even on 32 bit systems, c is untyped + i64 = c + //i32 = c // Compiler error + //i32 = -(-2147483647 - 1) // Compiler error + i32 = -2147483647 + i32 = -(-i32 - 1) + fmt.Println("32 bit signed integers") + fmt.Printf(" -(-2147483647 - 1) = %d, got %d\n", i64, i32) - i64 = 2000000000 + 2000000000 - //i32 = 2000000000 + 2000000000 // Compiler error - i32 = 2000000000 - i32 = i32 + i32 - fmt.Printf(" 2000000000 + 2000000000 = %d, got %d\n", i64, i32) - i64 = -2147483647 - 2147483647 - i32 = 2147483647 - i32 = -i32 - i32 - fmt.Printf(" -2147483647 - 2147483647 = %d, got %d\n", i64, i32) - i64 = 46341 * 46341 - i32 = 46341 - i32 = i32 * i32 - fmt.Printf(" 46341 * 46341 = %d, got %d\n", i64, i32) - i64 = (-2147483647 - 1) / -1 - i32 = -2147483647 - i32 = (i32 - 1) / -1 - fmt.Printf(" (-2147483647-1) / -1 = %d, got %d\n", i64, i32) + i64 = 2000000000 + 2000000000 + //i32 = 2000000000 + 2000000000 // Compiler error + i32 = 2000000000 + i32 = i32 + i32 + fmt.Printf(" 2000000000 + 2000000000 = %d, got %d\n", i64, i32) + i64 = -2147483647 - 2147483647 + i32 = 2147483647 + i32 = -i32 - i32 + fmt.Printf(" -2147483647 - 2147483647 = %d, got %d\n", i64, i32) + i64 = 46341 * 46341 + i32 = 46341 + i32 = i32 * i32 + fmt.Printf(" 46341 * 46341 = %d, got %d\n", i64, i32) + i64 = (-2147483647 - 1) / -1 + i32 = -2147483647 + i32 = (i32 - 1) / -1 + fmt.Printf(" (-2147483647-1) / -1 = %d, got %d\n", i64, i32) - fmt.Println("\n64 bit signed integers") - i64 = -9223372036854775807 - fmt.Printf(" -(%d - 1): %d\n", i64, -(i64 - 1)) - i64 = 5000000000000000000 - fmt.Printf(" %d + %d: %d\n", i64, i64, i64+i64) - i64 = 9223372036854775807 - fmt.Printf(" -%d - %d: %d\n", i64, i64, -i64-i64) - i64 = 3037000500 - fmt.Printf(" %d * %d: %d\n", i64, i64, i64*i64) - i64 = -9223372036854775807 - fmt.Printf(" (%d - 1) / -1: %d\n", i64, (i64-1)/-1) + fmt.Println("\n64 bit signed integers") + i64 = -9223372036854775807 + fmt.Printf(" -(%d - 1): %d\n", i64, -(i64 - 1)) + i64 = 5000000000000000000 + fmt.Printf(" %d + %d: %d\n", i64, i64, i64+i64) + i64 = 9223372036854775807 + fmt.Printf(" -%d - %d: %d\n", i64, i64, -i64-i64) + i64 = 3037000500 + fmt.Printf(" %d * %d: %d\n", i64, i64, i64*i64) + i64 = -9223372036854775807 + fmt.Printf(" (%d - 1) / -1: %d\n", i64, (i64-1)/-1) - fmt.Println("\n32 bit unsigned integers:") - //u32 = -4294967295 // Compiler error - u32 = 4294967295 - fmt.Printf(" -%d: %d\n", u32, -u32) - u32 = 3000000000 - fmt.Printf(" %d + %d: %d\n", u32, u32, u32+u32) - a := uint32(2147483647) - u32 = 4294967295 - fmt.Printf(" %d - %d: %d\n", a, u32, a-u32) - u32 = 65537 - fmt.Printf(" %d * %d: %d\n", u32, u32, u32*u32) + fmt.Println("\n32 bit unsigned integers:") + //u32 = -4294967295 // Compiler error + u32 = 4294967295 + fmt.Printf(" -%d: %d\n", u32, -u32) + u32 = 3000000000 + fmt.Printf(" %d + %d: %d\n", u32, u32, u32+u32) + a := uint32(2147483647) + u32 = 4294967295 + fmt.Printf(" %d - %d: %d\n", a, u32, a-u32) + u32 = 65537 + fmt.Printf(" %d * %d: %d\n", u32, u32, u32*u32) - fmt.Println("\n64 bit unsigned integers:") - u64 = 18446744073709551615 - fmt.Printf(" -%d: %d\n", u64, -u64) - u64 = 10000000000000000000 - fmt.Printf(" %d + %d: %d\n", u64, u64, u64+u64) - aa := uint64(9223372036854775807) - u64 = 18446744073709551615 - fmt.Printf(" %d - %d: %d\n", aa, u64, aa-u64) - u64 = 4294967296 - fmt.Printf(" %d * %d: %d\n", u64, u64, u64*u64) + fmt.Println("\n64 bit unsigned integers:") + u64 = 18446744073709551615 + fmt.Printf(" -%d: %d\n", u64, -u64) + u64 = 10000000000000000000 + fmt.Printf(" %d + %d: %d\n", u64, u64, u64+u64) + aa := uint64(9223372036854775807) + u64 = 18446744073709551615 + fmt.Printf(" %d - %d: %d\n", aa, u64, aa-u64) + u64 = 4294967296 + fmt.Printf(" %d * %d: %d\n", u64, u64, u64*u64) } diff --git a/Task/Integer-overflow/Java/integer-overflow.java b/Task/Integer-overflow/Java/integer-overflow-1.java similarity index 100% rename from Task/Integer-overflow/Java/integer-overflow.java rename to Task/Integer-overflow/Java/integer-overflow-1.java diff --git a/Task/Integer-overflow/Java/integer-overflow-2.java b/Task/Integer-overflow/Java/integer-overflow-2.java new file mode 100644 index 0000000000..f67ad7136d --- /dev/null +++ b/Task/Integer-overflow/Java/integer-overflow-2.java @@ -0,0 +1,47 @@ +public final class IntegerOverflow { + + public static void main(String[] args) { + // The following examples show that Java allows integer overflow without warning + // and calculates an incorrect result. + + // From version 8, Java introduced methods which throw an ArithmeticException when overflow occurs, + // which prevents the calculation of an incorrect result. It also allows the programmer to replace an "int" + // with a "long" and to replace a "long" with a BigInteger. + + // Uncomment the lines below to see the use of the new methods: + // addExact(), subtractExact(), multiplyExact() and negateExact(). + System.out.println("Signed 32-bit:"); + System.out.println(-(-2_147_483_647 - 1)); +// System.out.println(Math.negateExact(-2_147_483_647 - 1)); + + System.out.println(2_000_000_000 + 2_000_000_000); +// System.out.println(Math.addExact(2_000_000_000, 2_000_000_000)); + + System.out.println(-2_147_483_647 - 2_147_483_647); +// System.out.println(Math.subtractExact(-2_147_483_647, 2_147_483_647)); + + System.out.println(46_341 * 46_341); +// System.out.println(Math.multiplyExact(46_341, 46_341)); + + System.out.println((-2_147_483_647 - 1) / -1); +// System.out.println(Math.negateExact(Math.subtractExact(-2_147_483_647, 1) / 1)); + + System.out.println(); + System.out.println("Signed 64-bit:"); + System.out.println(-(-9_223_372_036_854_775_807L - 1)); +// System.out.println(Math.negateExact(-9_223_372_036_854_775_807L - 1)); + + System.out.println(5_000_000_000_000_000_000L + 5_000_000_000_000_000_000L); +// System.out.println(Math.addExact(5_000_000_000_000_000_000L, 5_000_000_000_000_000_000L)); + + System.out.println(-9_223_372_036_854_775_807L - 9_223_372_036_854_775_807L); +// System.out.println(Math.subtractExact(-9_223_372_036_854_775_807L, 9_223_372_036_854_775_807L)); + + System.out.println(3_037_000_500L * 3_037_000_500L); +// System.out.println(Math.multiplyExact(3_037_000_500L, 3_037_000_500L)); + + System.out.println((-9_223_372_036_854_775_807L - 1) / -1); +// System.out.println(Math.negateExact(Math.subtractExact(-9_223_372_036_854_775_807L, 1) / 1)); + } + +} diff --git a/Task/Integer-overflow/Jq/integer-overflow.jq b/Task/Integer-overflow/Jq/integer-overflow.jq index b74f2de480..b61ca08e1f 100644 --- a/Task/Integer-overflow/Jq/integer-overflow.jq +++ b/Task/Integer-overflow/Jq/integer-overflow.jq @@ -10,16 +10,16 @@ def compare: [ -(-2147483647-1),"2147483648"], [2000000000 + 2000000000, "4000000000"], -[-2147483647 - 2147483647, "-4294967294"], -[46341 * 46341, "2147488281"], -[(-2147483647-1) / -1, "2147483648"], +[-2147483647 - 2147483647, "-4294967294"], +[46341 * 46341, "2147488281"], +[(-2147483647-1) / -1, "2147483648"], "For 64-bit signed integers:", -[-(-9223372036854775807-1), "9223372036854775808"], -[5000000000000000000+5000000000000000000, "10000000000000000000"], -[-9223372036854775807 - 9223372036854775807, "-18446744073709551614"], -[3037000500 * 3037000500, "9223372037000250000"], +[-(-9223372036854775807-1), "9223372036854775808"], +[5000000000000000000+5000000000000000000, "10000000000000000000"], +[-9223372036854775807 - 9223372036854775807, "-18446744073709551614"], +[3037000500 * 3037000500, "9223372037000250000"], [(-9223372036854775807-1) / -1, "9223372036854775808"], "For 32-bit unsigned integers:", diff --git a/Task/Integer-overflow/Julia/integer-overflow-1.julia b/Task/Integer-overflow/Julia/integer-overflow-1.jl similarity index 100% rename from Task/Integer-overflow/Julia/integer-overflow-1.julia rename to Task/Integer-overflow/Julia/integer-overflow-1.jl diff --git a/Task/Integer-overflow/Julia/integer-overflow-2.julia b/Task/Integer-overflow/Julia/integer-overflow-2.jl similarity index 100% rename from Task/Integer-overflow/Julia/integer-overflow-2.julia rename to Task/Integer-overflow/Julia/integer-overflow-2.jl diff --git a/Task/Integer-overflow/Kotlin/integer-overflow.kotlin b/Task/Integer-overflow/Kotlin/integer-overflow.kts similarity index 100% rename from Task/Integer-overflow/Kotlin/integer-overflow.kotlin rename to Task/Integer-overflow/Kotlin/integer-overflow.kts diff --git a/Task/Integer-overflow/Ksh/integer-overflow.ksh b/Task/Integer-overflow/Ksh/integer-overflow.ksh index 94d4d6dedf..a88605d4e4 100644 --- a/Task/Integer-overflow/Ksh/integer-overflow.ksh +++ b/Task/Integer-overflow/Ksh/integer-overflow.ksh @@ -2,7 +2,7 @@ # Integer overflow -# # Variables: +# # Variables: # typeset -si SHORT_INT typeset -i INTEGER diff --git a/Task/Integer-overflow/PL-I-80/integer-overflow.pli b/Task/Integer-overflow/PL-I-80/integer-overflow.pli new file mode 100644 index 0000000000..1e873986b5 --- /dev/null +++ b/Task/Integer-overflow/PL-I-80/integer-overflow.pli @@ -0,0 +1,6 @@ +overflow_demo: proc options (main); + dcl n fixed bin; + n = 32767; + put skip list (n+2); + put skip list (n*2); +end overflow_demo; diff --git a/Task/Integer-overflow/Pluto/integer-overflow.pluto b/Task/Integer-overflow/Pluto/integer-overflow.pluto new file mode 100644 index 0000000000..a8af75f375 --- /dev/null +++ b/Task/Integer-overflow/Pluto/integer-overflow.pluto @@ -0,0 +1,7 @@ +local expressions = { + -(-9223372036854775807 - 1), + 5000000000000000000 + 5000000000000000000, + -9223372036854775807 - 9223372036854775807 +} + +for expressions as expr do print(expr) end diff --git a/Task/Integer-overflow/PowerShell/integer-overflow.ps1 b/Task/Integer-overflow/PowerShell/integer-overflow.ps1 new file mode 100644 index 0000000000..86bbd55c7f --- /dev/null +++ b/Task/Integer-overflow/PowerShell/integer-overflow.ps1 @@ -0,0 +1,30 @@ +try { + # All of these raise an exception, which is caught below. + # The try block is aborted after the first exception, + # so the subsequent lines are never executed. + + [int32] (-(-2147483647-1)) + [int32] (2000000000 + 2000000000) + [int32] (-2147483647 - 2147483647) + [int32] (46341 * 46341) + [int32] ((-2147483647-1) / -1) + + [int64] (-(-9223372036854775807-1)) + [int64] (5000000000000000000+5000000000000000000) + [int64] (-9223372036854775807 - 9223372036854775807) + [int64] (3037000500 * 3037000500) + [int64] ((-9223372036854775807-1) / -1) + + [uint32] (-4294967295) + [uint32] (3000000000 + 3000000000) + [uint32] (2147483647 - 4294967295) + [uint32] (65537 * 65537) + + [uint64] (-18446744073709551615) + [uint64] (10000000000000000000 + 10000000000000000000) + [uint64] (9223372036854775807 - 18446744073709551615) + [uint64] (4294967296 * 4294967296) +} +catch { + $Error.Exception +} diff --git a/Task/Integer-overflow/PowerShell/integer-overflow.psh b/Task/Integer-overflow/PowerShell/integer-overflow.psh deleted file mode 100644 index 48524e2b56..0000000000 --- a/Task/Integer-overflow/PowerShell/integer-overflow.psh +++ /dev/null @@ -1,30 +0,0 @@ -try { - # All of these raise an exception, which is caught below. - # The try block is aborted after the first exception, - # so the subsequent lines are never executed. - - [int32] (-(-2147483647-1)) - [int32] (2000000000 + 2000000000) - [int32] (-2147483647 - 2147483647) - [int32] (46341 * 46341) - [int32] ((-2147483647-1) / -1) - - [int64] (-(-9223372036854775807-1)) - [int64] (5000000000000000000+5000000000000000000) - [int64] (-9223372036854775807 - 9223372036854775807) - [int64] (3037000500 * 3037000500) - [int64] ((-9223372036854775807-1) / -1) - - [uint32] (-4294967295) - [uint32] (3000000000 + 3000000000) - [uint32] (2147483647 - 4294967295) - [uint32] (65537 * 65537) - - [uint64] (-18446744073709551615) - [uint64] (10000000000000000000 + 10000000000000000000) - [uint64] (9223372036854775807 - 18446744073709551615) - [uint64] (4294967296 * 4294967296) -} -catch { - $Error.Exception -} diff --git a/Task/Integer-overflow/Python/integer-overflow-1.py b/Task/Integer-overflow/Python/integer-overflow-1.py index b31607a136..0627deacc4 100644 --- a/Task/Integer-overflow/Python/integer-overflow-1.py +++ b/Task/Integer-overflow/Python/integer-overflow-1.py @@ -5,11 +5,11 @@ Type "copyright", "credits" or "license()" for more information. -2147483647 - 2147483647 46341 * 46341 (-2147483647-1) / -1'''.split('\n'): - ans = eval(calc) - print('Expression: %r evaluates to %s of type %s' - % (calc.strip(), ans, type(ans))) + ans = eval(calc) + print('Expression: %r evaluates to %s of type %s' + % (calc.strip(), ans, type(ans))) + - Expression: '-(-2147483647-1)' evaluates to 2147483648 of type Expression: '2000000000 + 2000000000' evaluates to 4000000000 of type Expression: '-2147483647 - 2147483647' evaluates to -4294967294 of type diff --git a/Task/Integer-overflow/Python/integer-overflow-2.py b/Task/Integer-overflow/Python/integer-overflow-2.py index ce1671d160..1da7b38e6f 100644 --- a/Task/Integer-overflow/Python/integer-overflow-2.py +++ b/Task/Integer-overflow/Python/integer-overflow-2.py @@ -5,11 +5,11 @@ Type "copyright", "credits" or "license()" for more information. -2147483647 - 2147483647 46341 * 46341 (-2147483647-1) / -1'''.split('\n'): - ans = eval(calc) - print('Expression: %r evaluates to %s of type %s' - % (calc.strip(), ans, type(ans))) + ans = eval(calc) + print('Expression: %r evaluates to %s of type %s' + % (calc.strip(), ans, type(ans))) + - Expression: '-(-2147483647-1)' evaluates to 2147483648 of type Expression: '2000000000 + 2000000000' evaluates to 4000000000 of type Expression: '-2147483647 - 2147483647' evaluates to -4294967294 of type diff --git a/Task/Integer-overflow/R/integer-overflow.r b/Task/Integer-overflow/R/integer-overflow.r new file mode 100644 index 0000000000..ff8070a2d2 --- /dev/null +++ b/Task/Integer-overflow/R/integer-overflow.r @@ -0,0 +1,2 @@ +46341*46341L +46341L*46341L diff --git a/Task/Integer-overflow/Rebol/integer-overflow.rebol b/Task/Integer-overflow/Rebol/integer-overflow.rebol new file mode 100644 index 0000000000..ec032950ee --- /dev/null +++ b/Task/Integer-overflow/Rebol/integer-overflow.rebol @@ -0,0 +1,33 @@ +Rebol [ + title: "Rosetta code: Integer overflow" + file: %Integer_overflow.r3 + url: https://rosettacode.org/wiki/Integer_overflow +] + +foreach expr [ + ;; For 32-bit signed integers: + [negate (-2147483647 - 1) ] + [2000000000 + 2000000000 ] + [-2147483647 - 2147483647 ] + [46341 * 46341 ] + [(-2147483647 - 1) / -1 ] + ;; For 64-bit signed integers: + [negate (-9223372036854775807 - 1) ] + [5000000000000000000 + 5000000000000000000 ] + [-9223372036854775807 - 9223372036854775807] + [3037000500 * 3037000500 ] + [(-9223372036854775807 - 1) / -1 ] + ;; For 32-bit unsigned integers: + [-4294967295 ] + [3000000000 + 3000000000 ] + [2147483647 - 4294967295 ] + [65537 * 65537 ] + ;; For 64-bit unsigned integers: + [transcode "-18446744073709551615" ] + [transcode " 10000000000000000000" ] + [transcode " 18446744073709551615" ] + [4294967296 * 4294967296 ] +][ + prin [pad mold/only expr 44 ";== "] + print either error? res: try expr [as-red reform [res/type res/id]][res] +] diff --git a/Task/Integer-overflow/Rust/integer-overflow-1.rust b/Task/Integer-overflow/Rust/integer-overflow-1.rs similarity index 100% rename from Task/Integer-overflow/Rust/integer-overflow-1.rust rename to Task/Integer-overflow/Rust/integer-overflow-1.rs diff --git a/Task/Integer-overflow/Rust/integer-overflow-2.rust b/Task/Integer-overflow/Rust/integer-overflow-2.rs similarity index 100% rename from Task/Integer-overflow/Rust/integer-overflow-2.rust rename to Task/Integer-overflow/Rust/integer-overflow-2.rs diff --git a/Task/Integer-overflow/S-BASIC/integer-overflow.basic b/Task/Integer-overflow/S-BASIC/integer-overflow.basic new file mode 100644 index 0000000000..2bd1b5aa2c --- /dev/null +++ b/Task/Integer-overflow/S-BASIC/integer-overflow.basic @@ -0,0 +1,5 @@ +var n = integer +n = 32767 rem - maximum integer value +print n+2 +print n*2 +end diff --git a/Task/Integer-overflow/VBScript/integer-overflow.vb b/Task/Integer-overflow/VBScript/integer-overflow.vb deleted file mode 100644 index fc10958150..0000000000 --- a/Task/Integer-overflow/VBScript/integer-overflow.vb +++ /dev/null @@ -1,14 +0,0 @@ -'Binary Integer overflow - vbs -i=(-2147483647-1)/-1 -wscript.echo i -i0=32767 '=32767 Integer (Fixed) type=2 -i1=2147483647 '=2147483647 Long (Fixed) type=3 -i2=-(-2147483647-1) '=2147483648 Double (Float) type=5 -wscript.echo Cstr(i0) & " : " & typename(i0) & " , " & vartype(i0) & vbcrlf _ - & Cstr(i1) & " : " & typename(i1) & " , " & vartype(i1) & vbcrlf _ - & Cstr(i2) & " : " & typename(i2) & " , " & vartype(i2) -ii=2147483648-2147483647 -if vartype(ii)<>3 or vartype(ii)<>2 then wscript.echo "Integer overflow type=" & typename(ii) -i1=1000000000000000-1 '1E+15-1 -i2=i1+1 '1E+15 -wscript.echo Cstr(i1) & " , " & Cstr(i2) diff --git a/Task/Integer-overflow/VBScript/integer-overflow.vbs b/Task/Integer-overflow/VBScript/integer-overflow.vbs new file mode 100644 index 0000000000..2aef204024 --- /dev/null +++ b/Task/Integer-overflow/VBScript/integer-overflow.vbs @@ -0,0 +1,14 @@ +'Binary Integer overflow - vbs +i=(-2147483647-1)/-1 +wscript.echo i +i0=32767 '=32767 Integer (Fixed) type=2 +i1=2147483647 '=2147483647 Long (Fixed) type=3 +i2=-(-2147483647-1) '=2147483648 Double (Float) type=5 +wscript.echo Cstr(i0) & " : " & typename(i0) & " , " & vartype(i0) & vbcrlf _ + & Cstr(i1) & " : " & typename(i1) & " , " & vartype(i1) & vbcrlf _ + & Cstr(i2) & " : " & typename(i2) & " , " & vartype(i2) +ii=2147483648-2147483647 +if vartype(ii)<>3 or vartype(ii)<>2 then wscript.echo "Integer overflow type=" & typename(ii) +i1=1000000000000000-1 '1E+15-1 +i2=i1+1 '1E+15 +wscript.echo Cstr(i1) & " , " & Cstr(i2) diff --git a/Task/Integer-overflow/YAMLScript/integer-overflow.ys b/Task/Integer-overflow/YAMLScript/integer-overflow.ys new file mode 100644 index 0000000000..d7618a29d2 --- /dev/null +++ b/Task/Integer-overflow/YAMLScript/integer-overflow.ys @@ -0,0 +1,14 @@ +!YS-v0 + +tests =: | + -9223372036854775807.-- * -1 + 5000000000000000000 + 5000000000000000000 + -9223372036854775807 - 9223372036854775807 + 3037000500 * 3037000500 + +each test tests:lines: + say: test + try: + eval: test + catch e: + say: "$e\n" diff --git a/Task/Integer-sequence/Ada/integer-sequence-1.ada b/Task/Integer-sequence/Ada/integer-sequence-1.adb similarity index 100% rename from Task/Integer-sequence/Ada/integer-sequence-1.ada rename to Task/Integer-sequence/Ada/integer-sequence-1.adb diff --git a/Task/Integer-sequence/Ada/integer-sequence-2.ada b/Task/Integer-sequence/Ada/integer-sequence-2.adb similarity index 100% rename from Task/Integer-sequence/Ada/integer-sequence-2.ada rename to Task/Integer-sequence/Ada/integer-sequence-2.adb diff --git a/Task/Integer-sequence/ArkScript/integer-sequence-1.ark b/Task/Integer-sequence/ArkScript/integer-sequence-1.ark new file mode 100644 index 0000000000..3292a2f31d --- /dev/null +++ b/Task/Integer-sequence/ArkScript/integer-sequence-1.ark @@ -0,0 +1,4 @@ +(mut i 0) +(while true { + (print i) + (set i (+ 1 i)) }) diff --git a/Task/Integer-sequence/ArkScript/integer-sequence-2.ark b/Task/Integer-sequence/ArkScript/integer-sequence-2.ark new file mode 100644 index 0000000000..99a3156c43 --- /dev/null +++ b/Task/Integer-sequence/ArkScript/integer-sequence-2.ark @@ -0,0 +1,5 @@ +(let loop (fun (i) { + (print i) + (loop (+ i 1)) })) + +(loop 0) diff --git a/Task/Integer-sequence/Ballerina/integer-sequence.ballerina b/Task/Integer-sequence/Ballerina/integer-sequence.ballerina new file mode 100644 index 0000000000..ac60f4738e --- /dev/null +++ b/Task/Integer-sequence/Ballerina/integer-sequence.ballerina @@ -0,0 +1,9 @@ +import ballerina/io; + +public function main() { + int a = 1; + while true { + io:println(a); + a += 1; + } +} diff --git a/Task/Integer-sequence/COBOL/integer-sequence.cobol b/Task/Integer-sequence/COBOL/integer-sequence.cob similarity index 100% rename from Task/Integer-sequence/COBOL/integer-sequence.cobol rename to Task/Integer-sequence/COBOL/integer-sequence.cob diff --git a/Task/Integer-sequence/Crystal/integer-sequence.crystal b/Task/Integer-sequence/Crystal/integer-sequence.cr similarity index 100% rename from Task/Integer-sequence/Crystal/integer-sequence.crystal rename to Task/Integer-sequence/Crystal/integer-sequence.cr diff --git a/Task/Integer-sequence/Delphi/integer-sequence.delphi b/Task/Integer-sequence/Delphi/integer-sequence.pas similarity index 100% rename from Task/Integer-sequence/Delphi/integer-sequence.delphi rename to Task/Integer-sequence/Delphi/integer-sequence.pas diff --git a/Task/Integer-sequence/EasyLang/integer-sequence.easy b/Task/Integer-sequence/EasyLang/integer-sequence.easy index ff87b9eebc..8891f16bc4 100644 --- a/Task/Integer-sequence/EasyLang/integer-sequence.easy +++ b/Task/Integer-sequence/EasyLang/integer-sequence.easy @@ -1,10 +1,10 @@ max = pow 2 53 repeat print i - if i = 10 + if i = 5 print "." print "." - i = max - 10 + i = max - 6 . until i = max i += 1 diff --git a/Task/Integer-sequence/Elena/integer-sequence.elena b/Task/Integer-sequence/Elena/integer-sequence.elena index 2294d76879..6e18d53cf6 100644 --- a/Task/Integer-sequence/Elena/integer-sequence.elena +++ b/Task/Integer-sequence/Elena/integer-sequence.elena @@ -1,11 +1,11 @@ import extensions; -public program() +public Program() { var i := 0u; while (true) { - console.printLine(i); + Console.printLine(i); i += 1u } diff --git a/Task/Integer-sequence/Elixir/integer-sequence.elixir b/Task/Integer-sequence/Elixir/integer-sequence.ex similarity index 100% rename from Task/Integer-sequence/Elixir/integer-sequence.elixir rename to Task/Integer-sequence/Elixir/integer-sequence.ex diff --git a/Task/Integer-sequence/Emacs-Lisp/integer-sequence.l b/Task/Integer-sequence/Emacs-Lisp/integer-sequence.el similarity index 100% rename from Task/Integer-sequence/Emacs-Lisp/integer-sequence.l rename to Task/Integer-sequence/Emacs-Lisp/integer-sequence.el diff --git a/Task/Integer-sequence/Euphoria/integer-sequence.euphoria b/Task/Integer-sequence/Euphoria/integer-sequence.eu similarity index 100% rename from Task/Integer-sequence/Euphoria/integer-sequence.euphoria rename to Task/Integer-sequence/Euphoria/integer-sequence.eu diff --git a/Task/Integer-sequence/Gleam/integer-sequence.gleam b/Task/Integer-sequence/Gleam/integer-sequence.gleam new file mode 100644 index 0000000000..36185b1127 --- /dev/null +++ b/Task/Integer-sequence/Gleam/integer-sequence.gleam @@ -0,0 +1,11 @@ +import gleam/int +import gleam/io + +pub fn main() { + count_forever(from: 1) +} + +pub fn count_forever(from n: Int) -> Nil { + n |> int.to_string |> io.println + count_forever(n + 1) +} diff --git a/Task/Integer-sequence/Java/integer-sequence-1.java b/Task/Integer-sequence/Java/integer-sequence-1.java index d8edfd20e6..4b9843e2ba 100644 --- a/Task/Integer-sequence/Java/integer-sequence-1.java +++ b/Task/Integer-sequence/Java/integer-sequence-1.java @@ -1,5 +1,5 @@ -public class Count{ - public static void main(String[] args){ +public class Count { + public static void main(String[] args) { for(long i = 1; ;i++) System.out.println(i); } } diff --git a/Task/Integer-sequence/Java/integer-sequence-2.java b/Task/Integer-sequence/Java/integer-sequence-2.java index 2ef70e280e..4d89ad5342 100644 --- a/Task/Integer-sequence/Java/integer-sequence-2.java +++ b/Task/Integer-sequence/Java/integer-sequence-2.java @@ -1,7 +1,7 @@ import java.math.BigInteger; -public class Count{ - public static void main(String[] args){ +public class Count { + public static void main(String[] args) { for(BigInteger i = BigInteger.ONE; ;i = i.add(BigInteger.ONE)) System.out.println(i); } } diff --git a/Task/Integer-sequence/Java/integer-sequence-3.java b/Task/Integer-sequence/Java/integer-sequence-3.java new file mode 100644 index 0000000000..53d98e12a4 --- /dev/null +++ b/Task/Integer-sequence/Java/integer-sequence-3.java @@ -0,0 +1,8 @@ +import java.util.stream.LongStream; + +public class Count { + public static void main(String[] args) { + LongStream.iterate(1, l -> l + 1) + .forEach(System.out::println); + } +} diff --git a/Task/Integer-sequence/Java/integer-sequence-4.java b/Task/Integer-sequence/Java/integer-sequence-4.java new file mode 100644 index 0000000000..fbef74497d --- /dev/null +++ b/Task/Integer-sequence/Java/integer-sequence-4.java @@ -0,0 +1,10 @@ +import static java.math.BigInteger.ONE; + +import java.util.stream.Stream; + +public class Count { + public static void main(String[] args) { + Stream.iterate(ONE, i -> i.add(ONE)) + .forEach(System.out::println); + } +} diff --git a/Task/Integer-sequence/Jq/integer-sequence-1.jq b/Task/Integer-sequence/Jq/integer-sequence-1.jq index 66b3bcd40c..02faf0b0e5 100644 --- a/Task/Integer-sequence/Jq/integer-sequence-1.jq +++ b/Task/Integer-sequence/Jq/integer-sequence-1.jq @@ -1,2 +1 @@ -def iota: ., (. + 1 | iota); -0 | iota +0 | recurse(. + 1) diff --git a/Task/Integer-sequence/Jq/integer-sequence-2.jq b/Task/Integer-sequence/Jq/integer-sequence-2.jq index 75004d0a70..66b3bcd40c 100644 --- a/Task/Integer-sequence/Jq/integer-sequence-2.jq +++ b/Task/Integer-sequence/Jq/integer-sequence-2.jq @@ -1 +1,2 @@ -0 | while(true;. + 1) +def iota: ., (. + 1 | iota); +0 | iota diff --git a/Task/Integer-sequence/Jq/integer-sequence-3.jq b/Task/Integer-sequence/Jq/integer-sequence-3.jq index 02faf0b0e5..ed60432096 100644 --- a/Task/Integer-sequence/Jq/integer-sequence-3.jq +++ b/Task/Integer-sequence/Jq/integer-sequence-3.jq @@ -1 +1 @@ -0 | recurse(. + 1) +0 | while(true; . + 1) diff --git a/Task/Integer-sequence/Julia/integer-sequence.julia b/Task/Integer-sequence/Julia/integer-sequence.jl similarity index 100% rename from Task/Integer-sequence/Julia/integer-sequence.julia rename to Task/Integer-sequence/Julia/integer-sequence.jl diff --git a/Task/Integer-sequence/Kotlin/integer-sequence.kotlin b/Task/Integer-sequence/Kotlin/integer-sequence.kotlin deleted file mode 100644 index 72fec53d9d..0000000000 --- a/Task/Integer-sequence/Kotlin/integer-sequence.kotlin +++ /dev/null @@ -1,15 +0,0 @@ -import java.math.BigInteger - -// version 1.0.5-2 - -fun main(args: Array) { - // print until 2147483647 - (0..Int.MAX_VALUE).forEach { println(it) } - - // print forever - var n = BigInteger.ZERO - while (true) { - println(n) - n += BigInteger.ONE - } -} diff --git a/Task/Integer-sequence/Kotlin/integer-sequence.kts b/Task/Integer-sequence/Kotlin/integer-sequence.kts new file mode 100644 index 0000000000..b9260df8b4 --- /dev/null +++ b/Task/Integer-sequence/Kotlin/integer-sequence.kts @@ -0,0 +1,10 @@ +import java.math.BigInteger + +fun main() { + // Using a 64-bit unsigned type, print until 18446744073709551615 + (1uL..ULong.MAX_VALUE).forEach { println(it) } + + // Using unlimited-size integers, print forever + var n = BigInteger.ONE + while (true) println(n++) +} diff --git a/Task/Integer-sequence/Nu/integer-sequence.nu b/Task/Integer-sequence/Nu/integer-sequence.nu new file mode 100644 index 0000000000..230e385c07 --- /dev/null +++ b/Task/Integer-sequence/Nu/integer-sequence.nu @@ -0,0 +1 @@ +for n in 1.. { print $n } diff --git a/Task/Integer-sequence/OCaml/integer-sequence-1.ocaml b/Task/Integer-sequence/OCaml/integer-sequence-1.ml similarity index 100% rename from Task/Integer-sequence/OCaml/integer-sequence-1.ocaml rename to Task/Integer-sequence/OCaml/integer-sequence-1.ml diff --git a/Task/Integer-sequence/OCaml/integer-sequence-2.ocaml b/Task/Integer-sequence/OCaml/integer-sequence-2.ml similarity index 100% rename from Task/Integer-sequence/OCaml/integer-sequence-2.ocaml rename to Task/Integer-sequence/OCaml/integer-sequence-2.ml diff --git a/Task/Integer-sequence/PascalABC.NET/integer-sequence.pas b/Task/Integer-sequence/PascalABC.NET/integer-sequence-1.pas similarity index 100% rename from Task/Integer-sequence/PascalABC.NET/integer-sequence.pas rename to Task/Integer-sequence/PascalABC.NET/integer-sequence-1.pas diff --git a/Task/Integer-sequence/PascalABC.NET/integer-sequence-2.pas b/Task/Integer-sequence/PascalABC.NET/integer-sequence-2.pas new file mode 100644 index 0000000000..7b206716fb --- /dev/null +++ b/Task/Integer-sequence/PascalABC.NET/integer-sequence-2.pas @@ -0,0 +1 @@ +## 1.Step.Print diff --git a/Task/Integer-sequence/PowerShell/integer-sequence.psh b/Task/Integer-sequence/PowerShell/integer-sequence.ps1 similarity index 100% rename from Task/Integer-sequence/PowerShell/integer-sequence.psh rename to Task/Integer-sequence/PowerShell/integer-sequence.ps1 diff --git a/Task/Integer-sequence/Rust/integer-sequence-1.rust b/Task/Integer-sequence/Rust/integer-sequence-1.rs similarity index 100% rename from Task/Integer-sequence/Rust/integer-sequence-1.rust rename to Task/Integer-sequence/Rust/integer-sequence-1.rs diff --git a/Task/Integer-sequence/Rust/integer-sequence-2.rust b/Task/Integer-sequence/Rust/integer-sequence-2.rs similarity index 100% rename from Task/Integer-sequence/Rust/integer-sequence-2.rust rename to Task/Integer-sequence/Rust/integer-sequence-2.rs diff --git a/Task/Integer-sequence/Scheme/integer-sequence.ss b/Task/Integer-sequence/Scheme/integer-sequence.scm similarity index 100% rename from Task/Integer-sequence/Scheme/integer-sequence.ss rename to Task/Integer-sequence/Scheme/integer-sequence.scm diff --git a/Task/Integer-sequence/Sidef/integer-sequence.sidef b/Task/Integer-sequence/Sidef/integer-sequence.sidef index 35b95992fe..7af70b5f89 100644 --- a/Task/Integer-sequence/Sidef/integer-sequence.sidef +++ b/Task/Integer-sequence/Sidef/integer-sequence.sidef @@ -1 +1 @@ -{|i| say i } * Math.inf; +1..Inf -> each {.say} diff --git a/Task/Integer-sequence/Uiua/integer-sequence.uiua b/Task/Integer-sequence/Uiua/integer-sequence.uiua new file mode 100644 index 0000000000..008b417081 --- /dev/null +++ b/Task/Integer-sequence/Uiua/integer-sequence.uiua @@ -0,0 +1 @@ +⍢(&p.+1)1 1 diff --git a/Task/Integer-sequence/Ursalang/integer-sequence.ursa b/Task/Integer-sequence/Ursalang/integer-sequence.ursa new file mode 100644 index 0000000000..1a461ebf35 --- /dev/null +++ b/Task/Integer-sequence/Ursalang/integer-sequence.ursa @@ -0,0 +1,5 @@ +let i = 1 +loop { + print(i) + i := i + 1 +} diff --git a/Task/Integer-sequence/Uxntal/integer-sequence.uxnatl b/Task/Integer-sequence/Uxntal/integer-sequence.uxnatl new file mode 100644 index 0000000000..fdc8e1419c --- /dev/null +++ b/Task/Integer-sequence/Uxntal/integer-sequence.uxnatl @@ -0,0 +1,23 @@ +%comma { [ LIT2 ", -Console/write ] DEO } +%space { [ LIT2 20 -Console/write ] DEO } + +|18 @Console/write + +|100 + +#0001 +&loop + DUP2 print/dec comma space + INC2 !&loop + +BRK + +@print/dec ( short* -- ) + #000a SWP2 [ LITr ff ] + &get + SWP2k DIV2k MUL2 SUB2 STH + POP OVR2 DIV2 ORAk ?&get + POP2 POP2 + &put + STHr INCk ?{ POP JMP2r } + [ LIT "0 ] ADD .Console/write DEO !&put diff --git a/Task/Integer-sequence/Zig/integer-sequence.zig b/Task/Integer-sequence/Zig/integer-sequence.zig new file mode 100644 index 0000000000..b3e6c9abd9 --- /dev/null +++ b/Task/Integer-sequence/Zig/integer-sequence.zig @@ -0,0 +1,9 @@ +const stdout = @import("std").io.getStdOut().writer(); + +pub fn main() !void { + var i: u128 = 1; + + while (true) : (i += 1) { + try stdout.print("{}, ", .{i}); + } +} diff --git a/Task/Interactive-programming-repl-/AWK/interactive-programming-repl-.awk b/Task/Interactive-programming-repl-/AWK/interactive-programming-repl-.awk new file mode 100644 index 0000000000..af020ed818 --- /dev/null +++ b/Task/Interactive-programming-repl-/AWK/interactive-programming-repl-.awk @@ -0,0 +1,4 @@ +GAWK -f CON +BEGIN { print(f("Rosetta","Code",":")) } +function f(s1,s2,s3) { return(s1 s3 s3 s2) } +^Z <-- CTRL-Z diff --git a/Task/Interactive-programming-repl-/Crystal/interactive-programming-repl-.cr b/Task/Interactive-programming-repl-/Crystal/interactive-programming-repl-.cr new file mode 100644 index 0000000000..17ba1deb2d --- /dev/null +++ b/Task/Interactive-programming-repl-/Crystal/interactive-programming-repl-.cr @@ -0,0 +1,11 @@ +> crystal i +Crystal interpreter 1.15.1 [89944bf] (2025-02-04). +EXPERIMENTAL SOFTWARE: if you find a bug, please consider opening an issue in +https://github.com/crystal-lang/crystal/issues/new/ +icr:1> def f(s1, s2, sep) +icr:2> s1 + sep + sep + s2 +icr:3> end + => nil +icr:4> f "Rosetta", "Code", ":" + => "Rosetta::Code" +icr:5> diff --git a/Task/Interactive-programming-repl-/Elena/interactive-programming-repl-.elena b/Task/Interactive-programming-repl-/Elena/interactive-programming-repl-.elena index db73a8852d..473d529309 100644 --- a/Task/Interactive-programming-repl-/Elena/interactive-programming-repl-.elena +++ b/Task/Interactive-programming-repl-/Elena/interactive-programming-repl-.elena @@ -1,11 +1,29 @@ -c:\Alex\ELENA\bin>elt -ELENA command line VM terminal 5.1.13 (C)2011-2020 by Alexei Rakov -ELENA VM 5.1.17 (C)2005-2020 by Alex Rakov +c:\Alex\ELENA\bin>elt-cli +ELENA command line VM terminal 6.9.6 (C)2021-25 by Aleksey Rakov +Loading repl template +Loading multiline template +Loading get_var template +Loading set_var template +ELENA VM 6.9.14 (32-bit) (C)2022-2025 by Aleksey Rakov, ELENA-LANG Org Initializing... -Done... +@help - help +@quit - quit +@multiline - switching to a multi-line mode + - evaluate the expression and print the result +$ := ; - assign a global variable +.. $ .. - get a global variable value +@base - set the base path for scripts +@load - execute a script from file +@import - load the script into multi-line script +@use