They call me Inspector Morse












10












$begingroup$


Your mission, should you choose to accept it, is to decide whether a given input string is Dot-, or Dash-heavy.



A string is dot-heavy when its morse representation contains more dots than dashes. For example, the letter E is a single dot, which means it is Dot-heavy.



Input




  • The input string will only contain characters in the range of [a-z] or [A-Z]. You can decide if they should all be upper case, or all lower case. AAA is fine, aaa is fine, aAa is not.

  • The input string will always be at least 1 character in length.

  • You may assume that input strings will never have an equal amount of dots and dashes.


Output



You should return Truthy for inputs that contain more dot characters.

You should return Falsy for inputs that contain more dash characters.



Test cases



| input | morse representation | result          |
|------------------------------------------------|
| S | ... | Truthy |
| k | -.- | Falsy |
| HELLO | .... . .-.. .-.. --- | Truthy |
| code | -.-. --- -.. . | Falsy |


Reference



International Morse Code



This is code-golf. Shortest code in bytes wins.










share|improve this question









$endgroup$












  • $begingroup$
    Related
    $endgroup$
    – Bassdrop Cumberwubwubwub
    4 hours ago










  • $begingroup$
    Can we return a value above 0 for dotheavy and a negative value for dash-heavy?
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago
















10












$begingroup$


Your mission, should you choose to accept it, is to decide whether a given input string is Dot-, or Dash-heavy.



A string is dot-heavy when its morse representation contains more dots than dashes. For example, the letter E is a single dot, which means it is Dot-heavy.



Input




  • The input string will only contain characters in the range of [a-z] or [A-Z]. You can decide if they should all be upper case, or all lower case. AAA is fine, aaa is fine, aAa is not.

  • The input string will always be at least 1 character in length.

  • You may assume that input strings will never have an equal amount of dots and dashes.


Output



You should return Truthy for inputs that contain more dot characters.

You should return Falsy for inputs that contain more dash characters.



Test cases



| input | morse representation | result          |
|------------------------------------------------|
| S | ... | Truthy |
| k | -.- | Falsy |
| HELLO | .... . .-.. .-.. --- | Truthy |
| code | -.-. --- -.. . | Falsy |


Reference



International Morse Code



This is code-golf. Shortest code in bytes wins.










share|improve this question









$endgroup$












  • $begingroup$
    Related
    $endgroup$
    – Bassdrop Cumberwubwubwub
    4 hours ago










  • $begingroup$
    Can we return a value above 0 for dotheavy and a negative value for dash-heavy?
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago














10












10








10


2



$begingroup$


Your mission, should you choose to accept it, is to decide whether a given input string is Dot-, or Dash-heavy.



A string is dot-heavy when its morse representation contains more dots than dashes. For example, the letter E is a single dot, which means it is Dot-heavy.



Input




  • The input string will only contain characters in the range of [a-z] or [A-Z]. You can decide if they should all be upper case, or all lower case. AAA is fine, aaa is fine, aAa is not.

  • The input string will always be at least 1 character in length.

  • You may assume that input strings will never have an equal amount of dots and dashes.


Output



You should return Truthy for inputs that contain more dot characters.

You should return Falsy for inputs that contain more dash characters.



Test cases



| input | morse representation | result          |
|------------------------------------------------|
| S | ... | Truthy |
| k | -.- | Falsy |
| HELLO | .... . .-.. .-.. --- | Truthy |
| code | -.-. --- -.. . | Falsy |


Reference



International Morse Code



This is code-golf. Shortest code in bytes wins.










share|improve this question









$endgroup$




Your mission, should you choose to accept it, is to decide whether a given input string is Dot-, or Dash-heavy.



A string is dot-heavy when its morse representation contains more dots than dashes. For example, the letter E is a single dot, which means it is Dot-heavy.



Input




  • The input string will only contain characters in the range of [a-z] or [A-Z]. You can decide if they should all be upper case, or all lower case. AAA is fine, aaa is fine, aAa is not.

  • The input string will always be at least 1 character in length.

  • You may assume that input strings will never have an equal amount of dots and dashes.


Output



You should return Truthy for inputs that contain more dot characters.

You should return Falsy for inputs that contain more dash characters.



Test cases



| input | morse representation | result          |
|------------------------------------------------|
| S | ... | Truthy |
| k | -.- | Falsy |
| HELLO | .... . .-.. .-.. --- | Truthy |
| code | -.-. --- -.. . | Falsy |


Reference



International Morse Code



This is code-golf. Shortest code in bytes wins.







code-golf morse






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 5 hours ago









Bassdrop CumberwubwubwubBassdrop Cumberwubwubwub

4,06811446




4,06811446












  • $begingroup$
    Related
    $endgroup$
    – Bassdrop Cumberwubwubwub
    4 hours ago










  • $begingroup$
    Can we return a value above 0 for dotheavy and a negative value for dash-heavy?
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago


















  • $begingroup$
    Related
    $endgroup$
    – Bassdrop Cumberwubwubwub
    4 hours ago










  • $begingroup$
    Can we return a value above 0 for dotheavy and a negative value for dash-heavy?
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago
















$begingroup$
Related
$endgroup$
– Bassdrop Cumberwubwubwub
4 hours ago




$begingroup$
Related
$endgroup$
– Bassdrop Cumberwubwubwub
4 hours ago












$begingroup$
Can we return a value above 0 for dotheavy and a negative value for dash-heavy?
$endgroup$
– Embodiment of Ignorance
1 hour ago




$begingroup$
Can we return a value above 0 for dotheavy and a negative value for dash-heavy?
$endgroup$
– Embodiment of Ignorance
1 hour ago










12 Answers
12






active

oldest

votes


















3












$begingroup$


Jelly, 23 bytes



9“¡ȷṡẓh)ėḂYF@’ḃ_4ị@OS0<


Try it online!






share|improve this answer









$endgroup$





















    2












    $begingroup$


    C (gcc), 84 82 81 79 75 bytes



    Assumes all caps.





    r;f(char*s){for(r=0;*s;r+="+-+,,-*/--*-)+(+),.*,-*+)+"[*s++%65]-43);s=r>0;}


    Try it online!






    share|improve this answer











    $endgroup$





















      2












      $begingroup$


      Java (JDK), 131 124 bytes



      Interestingly, "dot" is dash-heavy and "dash" is dot-heavy.



      Assumes all caps. Thanks to Expired Data for golfing 7 bytes!





      c->{int i=0,s=0;for(;i<c.length;)s+=new int{3,5,3,4,4,5,2,7,5,1,2,5,1,3,0,3,1,4,6,2,4,5,2,3,1,3}[c[i++]-65]-3;return s>0;}


      Try it online!






      share|improve this answer











      $endgroup$









      • 1




        $begingroup$
        124 bytes
        $endgroup$
        – Expired Data
        3 hours ago



















      1












      $begingroup$


      Retina 0.8.2, 51 bytes



      T`L`35344527412513031462452313
      .
      $*<>>>
      +`<>|><

      ^<


      Try it online! Link includes test cases. Only accepts upper case (+6 bytes for mixed case). Shamelessly stealing @Arnauld's string but I was going to use the same algorithm anyway. Explanation:



      T`L`35344527412513031462452313
      .


      Change each letter into the difference in numbers of dots and dashes, plus three, so O=0 and H=7.



      $*<>>>


      Represent the difference as that number of <s and three >s. (Sadly I can't use dots because they're special in regex.)



      +`<>|><


      Remove matched pairs of <s and >s.



      ^<


      Check whether there are still any dots left.






      share|improve this answer









      $endgroup$





















        1












        $begingroup$


        Bash+coreutils,  64 60 bytes





        tr a-z 35344526512513031462452313|sed s/./&z-+/g|dc -eIK?^p


        Try it online!



        Takes a string in lowercase, outputs zero for falsy, nonzero for truthy



        Explanation



        Uses tr and sed to create a dc program that looks like (for the example input 'hello'):



        IK6z-+4z-+5z-+5z-+0z-+^p

        IK Push 10, then 0 to the stack
        6z-+ Push 6 (three more than the dots minus dashes in 'h'), subtract 3, and accumulate
        ... Do the same for all other letters, so the stack now has the total dots minus dashes
        ^ Raise 10 to this power - precision is zero so this turns negative/positive to falsy/truthy
        p Print result





        share|improve this answer











        $endgroup$













        • $begingroup$
          Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
          $endgroup$
          – Sophia Lechner
          2 hours ago





















        1












        $begingroup$


        APL (Dyalog Extended), 24 bytesSBCS





        Anonymous tacit prefix function taking uppercase as argument.



        ⎕CY'dfns'
        >/'.-'⍧∊∘morse


        Try it online!



        ⎕CY'dfns' copy in the dfns library



        morse convert to list of Morse strings
         then
        ϵnlist (flatten)
        '.-'⍧ count the number of dots and dashes in that
        >/ more dots than dashes? (lit. greater-than reduction)






        share|improve this answer









        $endgroup$





















          1












          $begingroup$

          IBM PC DOS, 8088 assembly, 56 bytes



          bb28 0133 d2ac 24df 2c41 d78a e080 e40f 02f4 51b1 04d2 e859 02d0 e2e9
          3ad6 1113 2212 0113 2104 0231 2113 2011 3022 3112 0310 1213 2122 3122


          Unassembled:



          ; compare dashes and dots in a Morse code string
          ; input:
          ; I: pointer to input string (default SI)
          ; IL: length of input string (default CX)
          ; TBL: pointer to data table
          ; output:
          ; Carry Flag: CF=1 (CY) if dot-heavy, CF=0 (NC) if dash-heavy
          MORSE_DD MACRO I, IL, TBL
          LOCAL LOOP_LETTER
          IFDIFI <I>,<SI> ; skip if S is already SI
          MOV SI, I ; load string into SI
          ENDIF
          IFDIFI <IL>,<CX> ; skip if IL is already CX
          MOV CX, IL ; set up loop counter
          ENDIF
          MOV BX, OFFSET TBL ; load score table into BX
          XOR DX, DX ; clear DX to hold total score
          LOOP_LETTER:
          LODSB ; load next char from DS:SI into AL, advance SI
          AND AL, 0DFH ; uppercase the input letter
          SUB AL, 'A' ; convert letter to zero-based index
          XLAT ; lookup letter in table
          MOV AH, AL ; examine dot nibble
          AND AH, 0FH ; mask off dash nibble
          ADD DH, AH ; add letter dot count to total
          PUSH CX ; save loop counter (since SHR can only take CL)
          MOV CL, 4 ; set up right shift for 4 bits
          SHR AL, CL ; shift right
          POP CX ; restore loop counter
          ADD DL, AL ; add letter dash count to total
          LOOP LOOP_LETTER
          CMP DL, DH ; if dot-heavy CF=1, if dash-heavy CF=0
          ENDM

          ; data table A-Z: MSN = count of dash, LSN = count of dot
          TBL DB 011H, 013H, 022H, 012H, 001H, 013H, 021H, 004H, 002H
          DB 031H, 021H, 013H, 020H, 011H, 030H, 022H, 031H, 012H
          DB 003H, 010H, 012H, 013H, 021H, 022H, 031H, 022H


          Explanation



          Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as string, output Truthy/Falsy result in Carry Flag. Score table contains the number of dashes and dots per letter.



          Input can be upper/lower/mixed case (would save 2 bytes to take only upper or only lower).



          Example Test Program (as IBM PC DOS standalone COM executable)



              SHR  SI, 1              ; point SI to DOS PSP
          LODSW ; load arg length into AL, advance SI to 82H
          MOV CL, AL ; set up loop counter in CH
          DEC CX ; remove leading space from letter count

          MORSE_DD SI, CX, TBL ; execute above function, result is in CF

          MOV DX, OFFSET F ; default output to "Falsy" string
          JA DISP_OUT ; if CF=0, result is falsy, skip to output
          MOV DX, OFFSET T ; otherwise CF=1, set output to "Truthy" string
          DISP_OUT:
          MOV AH, 09H ; DOS API display string function
          INT 21H
          RET

          T DB "Truthy$"
          F DB "Falsy$"


          Example Output:



          enter image description here



          Download test program DD.COM



          Or Try it Online!
          I'm not aware of an online TIO to direct link to a DOS executable, however you can use this with just a few steps:




          1. Download DD.COM as a ZIP file

          2. Go to https://virtualconsoles.com/online-emulators/DOS/

          3. Upload the ZIP file you just downloaded, click Start

          4. Type DD Hello or DD code to your heart's content






          share|improve this answer











          $endgroup$





















            0












            $begingroup$


            JavaScript (Node.js),  69  68 bytes



            Expects the input string in uppercase. Returns $0$ or $1$.





            s=>Buffer(s).map(n=>s+='30314624523133534452741251'[n%26]-3,s=0)|s>0


            Try it online!






            share|improve this answer











            $endgroup$





















              0












              $begingroup$


              Python 2, 73 bytes





              lambda s:sum(int('035344527512513031462452313'[ord(c)%32])-3for c in s)>0


              Try it online!






              share|improve this answer











              $endgroup$













              • $begingroup$
                Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                $endgroup$
                – Erik the Outgolfer
                2 hours ago





















              0












              $begingroup$


              Perl 5 -pF, 53 bytes





              $p+=y/a-z/35344526512513031462452313/r-3for@F;$_=$p>0


              Try it online!






              share|improve this answer









              $endgroup$





















                0












                $begingroup$


                C# (Visual C# Interactive Compiler), 49 bytes





                n=>n.Sum(c=>""[c-65]-4)


                Contains a lot of unprintables.



                Try it online!






                share|improve this answer









                $endgroup$





















                  0












                  $begingroup$


                  05AB1E, 23 bytes



                  εA•U(Õþć6Δ
                  »›I•S3-‡}O.±


                  Try it online!





                  share









                  $endgroup$













                    Your Answer





                    StackExchange.ifUsing("editor", function () {
                    return StackExchange.using("mathjaxEditing", function () {
                    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
                    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                    });
                    });
                    }, "mathjax-editing");

                    StackExchange.ifUsing("editor", function () {
                    StackExchange.using("externalEditor", function () {
                    StackExchange.using("snippets", function () {
                    StackExchange.snippets.init();
                    });
                    });
                    }, "code-snippets");

                    StackExchange.ready(function() {
                    var channelOptions = {
                    tags: "".split(" "),
                    id: "200"
                    };
                    initTagRenderer("".split(" "), "".split(" "), channelOptions);

                    StackExchange.using("externalEditor", function() {
                    // Have to fire editor after snippets, if snippets enabled
                    if (StackExchange.settings.snippets.snippetsEnabled) {
                    StackExchange.using("snippets", function() {
                    createEditor();
                    });
                    }
                    else {
                    createEditor();
                    }
                    });

                    function createEditor() {
                    StackExchange.prepareEditor({
                    heartbeatType: 'answer',
                    autoActivateHeartbeat: false,
                    convertImagesToLinks: false,
                    noModals: true,
                    showLowRepImageUploadWarning: true,
                    reputationToPostImages: null,
                    bindNavPrevention: true,
                    postfix: "",
                    imageUploader: {
                    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                    allowUrls: true
                    },
                    onDemand: true,
                    discardSelector: ".discard-answer"
                    ,immediatelyShowMarkdownHelp:true
                    });


                    }
                    });














                    draft saved

                    draft discarded


















                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f181318%2fthey-call-me-inspector-morse%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown

























                    12 Answers
                    12






                    active

                    oldest

                    votes








                    12 Answers
                    12






                    active

                    oldest

                    votes









                    active

                    oldest

                    votes






                    active

                    oldest

                    votes









                    3












                    $begingroup$


                    Jelly, 23 bytes



                    9“¡ȷṡẓh)ėḂYF@’ḃ_4ị@OS0<


                    Try it online!






                    share|improve this answer









                    $endgroup$


















                      3












                      $begingroup$


                      Jelly, 23 bytes



                      9“¡ȷṡẓh)ėḂYF@’ḃ_4ị@OS0<


                      Try it online!






                      share|improve this answer









                      $endgroup$
















                        3












                        3








                        3





                        $begingroup$


                        Jelly, 23 bytes



                        9“¡ȷṡẓh)ėḂYF@’ḃ_4ị@OS0<


                        Try it online!






                        share|improve this answer









                        $endgroup$




                        Jelly, 23 bytes



                        9“¡ȷṡẓh)ėḂYF@’ḃ_4ị@OS0<


                        Try it online!







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered 4 hours ago









                        Erik the OutgolferErik the Outgolfer

                        32.3k429104




                        32.3k429104























                            2












                            $begingroup$


                            C (gcc), 84 82 81 79 75 bytes



                            Assumes all caps.





                            r;f(char*s){for(r=0;*s;r+="+-+,,-*/--*-)+(+),.*,-*+)+"[*s++%65]-43);s=r>0;}


                            Try it online!






                            share|improve this answer











                            $endgroup$


















                              2












                              $begingroup$


                              C (gcc), 84 82 81 79 75 bytes



                              Assumes all caps.





                              r;f(char*s){for(r=0;*s;r+="+-+,,-*/--*-)+(+),.*,-*+)+"[*s++%65]-43);s=r>0;}


                              Try it online!






                              share|improve this answer











                              $endgroup$
















                                2












                                2








                                2





                                $begingroup$


                                C (gcc), 84 82 81 79 75 bytes



                                Assumes all caps.





                                r;f(char*s){for(r=0;*s;r+="+-+,,-*/--*-)+(+),.*,-*+)+"[*s++%65]-43);s=r>0;}


                                Try it online!






                                share|improve this answer











                                $endgroup$




                                C (gcc), 84 82 81 79 75 bytes



                                Assumes all caps.





                                r;f(char*s){for(r=0;*s;r+="+-+,,-*/--*-)+(+),.*,-*+)+"[*s++%65]-43);s=r>0;}


                                Try it online!







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited 2 hours ago

























                                answered 4 hours ago









                                gastropnergastropner

                                2,1501511




                                2,1501511























                                    2












                                    $begingroup$


                                    Java (JDK), 131 124 bytes



                                    Interestingly, "dot" is dash-heavy and "dash" is dot-heavy.



                                    Assumes all caps. Thanks to Expired Data for golfing 7 bytes!





                                    c->{int i=0,s=0;for(;i<c.length;)s+=new int{3,5,3,4,4,5,2,7,5,1,2,5,1,3,0,3,1,4,6,2,4,5,2,3,1,3}[c[i++]-65]-3;return s>0;}


                                    Try it online!






                                    share|improve this answer











                                    $endgroup$









                                    • 1




                                      $begingroup$
                                      124 bytes
                                      $endgroup$
                                      – Expired Data
                                      3 hours ago
















                                    2












                                    $begingroup$


                                    Java (JDK), 131 124 bytes



                                    Interestingly, "dot" is dash-heavy and "dash" is dot-heavy.



                                    Assumes all caps. Thanks to Expired Data for golfing 7 bytes!





                                    c->{int i=0,s=0;for(;i<c.length;)s+=new int{3,5,3,4,4,5,2,7,5,1,2,5,1,3,0,3,1,4,6,2,4,5,2,3,1,3}[c[i++]-65]-3;return s>0;}


                                    Try it online!






                                    share|improve this answer











                                    $endgroup$









                                    • 1




                                      $begingroup$
                                      124 bytes
                                      $endgroup$
                                      – Expired Data
                                      3 hours ago














                                    2












                                    2








                                    2





                                    $begingroup$


                                    Java (JDK), 131 124 bytes



                                    Interestingly, "dot" is dash-heavy and "dash" is dot-heavy.



                                    Assumes all caps. Thanks to Expired Data for golfing 7 bytes!





                                    c->{int i=0,s=0;for(;i<c.length;)s+=new int{3,5,3,4,4,5,2,7,5,1,2,5,1,3,0,3,1,4,6,2,4,5,2,3,1,3}[c[i++]-65]-3;return s>0;}


                                    Try it online!






                                    share|improve this answer











                                    $endgroup$




                                    Java (JDK), 131 124 bytes



                                    Interestingly, "dot" is dash-heavy and "dash" is dot-heavy.



                                    Assumes all caps. Thanks to Expired Data for golfing 7 bytes!





                                    c->{int i=0,s=0;for(;i<c.length;)s+=new int{3,5,3,4,4,5,2,7,5,1,2,5,1,3,0,3,1,4,6,2,4,5,2,3,1,3}[c[i++]-65]-3;return s>0;}


                                    Try it online!







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited 20 mins ago

























                                    answered 4 hours ago









                                    O.O.BalanceO.O.Balance

                                    1,2601318




                                    1,2601318








                                    • 1




                                      $begingroup$
                                      124 bytes
                                      $endgroup$
                                      – Expired Data
                                      3 hours ago














                                    • 1




                                      $begingroup$
                                      124 bytes
                                      $endgroup$
                                      – Expired Data
                                      3 hours ago








                                    1




                                    1




                                    $begingroup$
                                    124 bytes
                                    $endgroup$
                                    – Expired Data
                                    3 hours ago




                                    $begingroup$
                                    124 bytes
                                    $endgroup$
                                    – Expired Data
                                    3 hours ago











                                    1












                                    $begingroup$


                                    Retina 0.8.2, 51 bytes



                                    T`L`35344527412513031462452313
                                    .
                                    $*<>>>
                                    +`<>|><

                                    ^<


                                    Try it online! Link includes test cases. Only accepts upper case (+6 bytes for mixed case). Shamelessly stealing @Arnauld's string but I was going to use the same algorithm anyway. Explanation:



                                    T`L`35344527412513031462452313
                                    .


                                    Change each letter into the difference in numbers of dots and dashes, plus three, so O=0 and H=7.



                                    $*<>>>


                                    Represent the difference as that number of <s and three >s. (Sadly I can't use dots because they're special in regex.)



                                    +`<>|><


                                    Remove matched pairs of <s and >s.



                                    ^<


                                    Check whether there are still any dots left.






                                    share|improve this answer









                                    $endgroup$


















                                      1












                                      $begingroup$


                                      Retina 0.8.2, 51 bytes



                                      T`L`35344527412513031462452313
                                      .
                                      $*<>>>
                                      +`<>|><

                                      ^<


                                      Try it online! Link includes test cases. Only accepts upper case (+6 bytes for mixed case). Shamelessly stealing @Arnauld's string but I was going to use the same algorithm anyway. Explanation:



                                      T`L`35344527412513031462452313
                                      .


                                      Change each letter into the difference in numbers of dots and dashes, plus three, so O=0 and H=7.



                                      $*<>>>


                                      Represent the difference as that number of <s and three >s. (Sadly I can't use dots because they're special in regex.)



                                      +`<>|><


                                      Remove matched pairs of <s and >s.



                                      ^<


                                      Check whether there are still any dots left.






                                      share|improve this answer









                                      $endgroup$
















                                        1












                                        1








                                        1





                                        $begingroup$


                                        Retina 0.8.2, 51 bytes



                                        T`L`35344527412513031462452313
                                        .
                                        $*<>>>
                                        +`<>|><

                                        ^<


                                        Try it online! Link includes test cases. Only accepts upper case (+6 bytes for mixed case). Shamelessly stealing @Arnauld's string but I was going to use the same algorithm anyway. Explanation:



                                        T`L`35344527412513031462452313
                                        .


                                        Change each letter into the difference in numbers of dots and dashes, plus three, so O=0 and H=7.



                                        $*<>>>


                                        Represent the difference as that number of <s and three >s. (Sadly I can't use dots because they're special in regex.)



                                        +`<>|><


                                        Remove matched pairs of <s and >s.



                                        ^<


                                        Check whether there are still any dots left.






                                        share|improve this answer









                                        $endgroup$




                                        Retina 0.8.2, 51 bytes



                                        T`L`35344527412513031462452313
                                        .
                                        $*<>>>
                                        +`<>|><

                                        ^<


                                        Try it online! Link includes test cases. Only accepts upper case (+6 bytes for mixed case). Shamelessly stealing @Arnauld's string but I was going to use the same algorithm anyway. Explanation:



                                        T`L`35344527412513031462452313
                                        .


                                        Change each letter into the difference in numbers of dots and dashes, plus three, so O=0 and H=7.



                                        $*<>>>


                                        Represent the difference as that number of <s and three >s. (Sadly I can't use dots because they're special in regex.)



                                        +`<>|><


                                        Remove matched pairs of <s and >s.



                                        ^<


                                        Check whether there are still any dots left.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered 4 hours ago









                                        NeilNeil

                                        81.5k745178




                                        81.5k745178























                                            1












                                            $begingroup$


                                            Bash+coreutils,  64 60 bytes





                                            tr a-z 35344526512513031462452313|sed s/./&z-+/g|dc -eIK?^p


                                            Try it online!



                                            Takes a string in lowercase, outputs zero for falsy, nonzero for truthy



                                            Explanation



                                            Uses tr and sed to create a dc program that looks like (for the example input 'hello'):



                                            IK6z-+4z-+5z-+5z-+0z-+^p

                                            IK Push 10, then 0 to the stack
                                            6z-+ Push 6 (three more than the dots minus dashes in 'h'), subtract 3, and accumulate
                                            ... Do the same for all other letters, so the stack now has the total dots minus dashes
                                            ^ Raise 10 to this power - precision is zero so this turns negative/positive to falsy/truthy
                                            p Print result





                                            share|improve this answer











                                            $endgroup$













                                            • $begingroup$
                                              Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
                                              $endgroup$
                                              – Sophia Lechner
                                              2 hours ago


















                                            1












                                            $begingroup$


                                            Bash+coreutils,  64 60 bytes





                                            tr a-z 35344526512513031462452313|sed s/./&z-+/g|dc -eIK?^p


                                            Try it online!



                                            Takes a string in lowercase, outputs zero for falsy, nonzero for truthy



                                            Explanation



                                            Uses tr and sed to create a dc program that looks like (for the example input 'hello'):



                                            IK6z-+4z-+5z-+5z-+0z-+^p

                                            IK Push 10, then 0 to the stack
                                            6z-+ Push 6 (three more than the dots minus dashes in 'h'), subtract 3, and accumulate
                                            ... Do the same for all other letters, so the stack now has the total dots minus dashes
                                            ^ Raise 10 to this power - precision is zero so this turns negative/positive to falsy/truthy
                                            p Print result





                                            share|improve this answer











                                            $endgroup$













                                            • $begingroup$
                                              Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
                                              $endgroup$
                                              – Sophia Lechner
                                              2 hours ago
















                                            1












                                            1








                                            1





                                            $begingroup$


                                            Bash+coreutils,  64 60 bytes





                                            tr a-z 35344526512513031462452313|sed s/./&z-+/g|dc -eIK?^p


                                            Try it online!



                                            Takes a string in lowercase, outputs zero for falsy, nonzero for truthy



                                            Explanation



                                            Uses tr and sed to create a dc program that looks like (for the example input 'hello'):



                                            IK6z-+4z-+5z-+5z-+0z-+^p

                                            IK Push 10, then 0 to the stack
                                            6z-+ Push 6 (three more than the dots minus dashes in 'h'), subtract 3, and accumulate
                                            ... Do the same for all other letters, so the stack now has the total dots minus dashes
                                            ^ Raise 10 to this power - precision is zero so this turns negative/positive to falsy/truthy
                                            p Print result





                                            share|improve this answer











                                            $endgroup$




                                            Bash+coreutils,  64 60 bytes





                                            tr a-z 35344526512513031462452313|sed s/./&z-+/g|dc -eIK?^p


                                            Try it online!



                                            Takes a string in lowercase, outputs zero for falsy, nonzero for truthy



                                            Explanation



                                            Uses tr and sed to create a dc program that looks like (for the example input 'hello'):



                                            IK6z-+4z-+5z-+5z-+0z-+^p

                                            IK Push 10, then 0 to the stack
                                            6z-+ Push 6 (three more than the dots minus dashes in 'h'), subtract 3, and accumulate
                                            ... Do the same for all other letters, so the stack now has the total dots minus dashes
                                            ^ Raise 10 to this power - precision is zero so this turns negative/positive to falsy/truthy
                                            p Print result






                                            share|improve this answer














                                            share|improve this answer



                                            share|improve this answer








                                            edited 2 hours ago

























                                            answered 3 hours ago









                                            Sophia LechnerSophia Lechner

                                            8107




                                            8107












                                            • $begingroup$
                                              Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
                                              $endgroup$
                                              – Sophia Lechner
                                              2 hours ago




















                                            • $begingroup$
                                              Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
                                              $endgroup$
                                              – Sophia Lechner
                                              2 hours ago


















                                            $begingroup$
                                            Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
                                            $endgroup$
                                            – Sophia Lechner
                                            2 hours ago






                                            $begingroup$
                                            Golfed two bytes by just putting the dc in the pipeline rather than use command substitution, then another byte by replacing <space>3 with z (conveniently, I have 3 items on the stack at that point!) and another byte by replacing the quotes around my sed program with a single backslash to escape the &
                                            $endgroup$
                                            – Sophia Lechner
                                            2 hours ago













                                            1












                                            $begingroup$


                                            APL (Dyalog Extended), 24 bytesSBCS





                                            Anonymous tacit prefix function taking uppercase as argument.



                                            ⎕CY'dfns'
                                            >/'.-'⍧∊∘morse


                                            Try it online!



                                            ⎕CY'dfns' copy in the dfns library



                                            morse convert to list of Morse strings
                                             then
                                            ϵnlist (flatten)
                                            '.-'⍧ count the number of dots and dashes in that
                                            >/ more dots than dashes? (lit. greater-than reduction)






                                            share|improve this answer









                                            $endgroup$


















                                              1












                                              $begingroup$


                                              APL (Dyalog Extended), 24 bytesSBCS





                                              Anonymous tacit prefix function taking uppercase as argument.



                                              ⎕CY'dfns'
                                              >/'.-'⍧∊∘morse


                                              Try it online!



                                              ⎕CY'dfns' copy in the dfns library



                                              morse convert to list of Morse strings
                                               then
                                              ϵnlist (flatten)
                                              '.-'⍧ count the number of dots and dashes in that
                                              >/ more dots than dashes? (lit. greater-than reduction)






                                              share|improve this answer









                                              $endgroup$
















                                                1












                                                1








                                                1





                                                $begingroup$


                                                APL (Dyalog Extended), 24 bytesSBCS





                                                Anonymous tacit prefix function taking uppercase as argument.



                                                ⎕CY'dfns'
                                                >/'.-'⍧∊∘morse


                                                Try it online!



                                                ⎕CY'dfns' copy in the dfns library



                                                morse convert to list of Morse strings
                                                 then
                                                ϵnlist (flatten)
                                                '.-'⍧ count the number of dots and dashes in that
                                                >/ more dots than dashes? (lit. greater-than reduction)






                                                share|improve this answer









                                                $endgroup$




                                                APL (Dyalog Extended), 24 bytesSBCS





                                                Anonymous tacit prefix function taking uppercase as argument.



                                                ⎕CY'dfns'
                                                >/'.-'⍧∊∘morse


                                                Try it online!



                                                ⎕CY'dfns' copy in the dfns library



                                                morse convert to list of Morse strings
                                                 then
                                                ϵnlist (flatten)
                                                '.-'⍧ count the number of dots and dashes in that
                                                >/ more dots than dashes? (lit. greater-than reduction)







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered 1 hour ago









                                                AdámAdám

                                                28.6k276204




                                                28.6k276204























                                                    1












                                                    $begingroup$

                                                    IBM PC DOS, 8088 assembly, 56 bytes



                                                    bb28 0133 d2ac 24df 2c41 d78a e080 e40f 02f4 51b1 04d2 e859 02d0 e2e9
                                                    3ad6 1113 2212 0113 2104 0231 2113 2011 3022 3112 0310 1213 2122 3122


                                                    Unassembled:



                                                    ; compare dashes and dots in a Morse code string
                                                    ; input:
                                                    ; I: pointer to input string (default SI)
                                                    ; IL: length of input string (default CX)
                                                    ; TBL: pointer to data table
                                                    ; output:
                                                    ; Carry Flag: CF=1 (CY) if dot-heavy, CF=0 (NC) if dash-heavy
                                                    MORSE_DD MACRO I, IL, TBL
                                                    LOCAL LOOP_LETTER
                                                    IFDIFI <I>,<SI> ; skip if S is already SI
                                                    MOV SI, I ; load string into SI
                                                    ENDIF
                                                    IFDIFI <IL>,<CX> ; skip if IL is already CX
                                                    MOV CX, IL ; set up loop counter
                                                    ENDIF
                                                    MOV BX, OFFSET TBL ; load score table into BX
                                                    XOR DX, DX ; clear DX to hold total score
                                                    LOOP_LETTER:
                                                    LODSB ; load next char from DS:SI into AL, advance SI
                                                    AND AL, 0DFH ; uppercase the input letter
                                                    SUB AL, 'A' ; convert letter to zero-based index
                                                    XLAT ; lookup letter in table
                                                    MOV AH, AL ; examine dot nibble
                                                    AND AH, 0FH ; mask off dash nibble
                                                    ADD DH, AH ; add letter dot count to total
                                                    PUSH CX ; save loop counter (since SHR can only take CL)
                                                    MOV CL, 4 ; set up right shift for 4 bits
                                                    SHR AL, CL ; shift right
                                                    POP CX ; restore loop counter
                                                    ADD DL, AL ; add letter dash count to total
                                                    LOOP LOOP_LETTER
                                                    CMP DL, DH ; if dot-heavy CF=1, if dash-heavy CF=0
                                                    ENDM

                                                    ; data table A-Z: MSN = count of dash, LSN = count of dot
                                                    TBL DB 011H, 013H, 022H, 012H, 001H, 013H, 021H, 004H, 002H
                                                    DB 031H, 021H, 013H, 020H, 011H, 030H, 022H, 031H, 012H
                                                    DB 003H, 010H, 012H, 013H, 021H, 022H, 031H, 022H


                                                    Explanation



                                                    Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as string, output Truthy/Falsy result in Carry Flag. Score table contains the number of dashes and dots per letter.



                                                    Input can be upper/lower/mixed case (would save 2 bytes to take only upper or only lower).



                                                    Example Test Program (as IBM PC DOS standalone COM executable)



                                                        SHR  SI, 1              ; point SI to DOS PSP
                                                    LODSW ; load arg length into AL, advance SI to 82H
                                                    MOV CL, AL ; set up loop counter in CH
                                                    DEC CX ; remove leading space from letter count

                                                    MORSE_DD SI, CX, TBL ; execute above function, result is in CF

                                                    MOV DX, OFFSET F ; default output to "Falsy" string
                                                    JA DISP_OUT ; if CF=0, result is falsy, skip to output
                                                    MOV DX, OFFSET T ; otherwise CF=1, set output to "Truthy" string
                                                    DISP_OUT:
                                                    MOV AH, 09H ; DOS API display string function
                                                    INT 21H
                                                    RET

                                                    T DB "Truthy$"
                                                    F DB "Falsy$"


                                                    Example Output:



                                                    enter image description here



                                                    Download test program DD.COM



                                                    Or Try it Online!
                                                    I'm not aware of an online TIO to direct link to a DOS executable, however you can use this with just a few steps:




                                                    1. Download DD.COM as a ZIP file

                                                    2. Go to https://virtualconsoles.com/online-emulators/DOS/

                                                    3. Upload the ZIP file you just downloaded, click Start

                                                    4. Type DD Hello or DD code to your heart's content






                                                    share|improve this answer











                                                    $endgroup$


















                                                      1












                                                      $begingroup$

                                                      IBM PC DOS, 8088 assembly, 56 bytes



                                                      bb28 0133 d2ac 24df 2c41 d78a e080 e40f 02f4 51b1 04d2 e859 02d0 e2e9
                                                      3ad6 1113 2212 0113 2104 0231 2113 2011 3022 3112 0310 1213 2122 3122


                                                      Unassembled:



                                                      ; compare dashes and dots in a Morse code string
                                                      ; input:
                                                      ; I: pointer to input string (default SI)
                                                      ; IL: length of input string (default CX)
                                                      ; TBL: pointer to data table
                                                      ; output:
                                                      ; Carry Flag: CF=1 (CY) if dot-heavy, CF=0 (NC) if dash-heavy
                                                      MORSE_DD MACRO I, IL, TBL
                                                      LOCAL LOOP_LETTER
                                                      IFDIFI <I>,<SI> ; skip if S is already SI
                                                      MOV SI, I ; load string into SI
                                                      ENDIF
                                                      IFDIFI <IL>,<CX> ; skip if IL is already CX
                                                      MOV CX, IL ; set up loop counter
                                                      ENDIF
                                                      MOV BX, OFFSET TBL ; load score table into BX
                                                      XOR DX, DX ; clear DX to hold total score
                                                      LOOP_LETTER:
                                                      LODSB ; load next char from DS:SI into AL, advance SI
                                                      AND AL, 0DFH ; uppercase the input letter
                                                      SUB AL, 'A' ; convert letter to zero-based index
                                                      XLAT ; lookup letter in table
                                                      MOV AH, AL ; examine dot nibble
                                                      AND AH, 0FH ; mask off dash nibble
                                                      ADD DH, AH ; add letter dot count to total
                                                      PUSH CX ; save loop counter (since SHR can only take CL)
                                                      MOV CL, 4 ; set up right shift for 4 bits
                                                      SHR AL, CL ; shift right
                                                      POP CX ; restore loop counter
                                                      ADD DL, AL ; add letter dash count to total
                                                      LOOP LOOP_LETTER
                                                      CMP DL, DH ; if dot-heavy CF=1, if dash-heavy CF=0
                                                      ENDM

                                                      ; data table A-Z: MSN = count of dash, LSN = count of dot
                                                      TBL DB 011H, 013H, 022H, 012H, 001H, 013H, 021H, 004H, 002H
                                                      DB 031H, 021H, 013H, 020H, 011H, 030H, 022H, 031H, 012H
                                                      DB 003H, 010H, 012H, 013H, 021H, 022H, 031H, 022H


                                                      Explanation



                                                      Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as string, output Truthy/Falsy result in Carry Flag. Score table contains the number of dashes and dots per letter.



                                                      Input can be upper/lower/mixed case (would save 2 bytes to take only upper or only lower).



                                                      Example Test Program (as IBM PC DOS standalone COM executable)



                                                          SHR  SI, 1              ; point SI to DOS PSP
                                                      LODSW ; load arg length into AL, advance SI to 82H
                                                      MOV CL, AL ; set up loop counter in CH
                                                      DEC CX ; remove leading space from letter count

                                                      MORSE_DD SI, CX, TBL ; execute above function, result is in CF

                                                      MOV DX, OFFSET F ; default output to "Falsy" string
                                                      JA DISP_OUT ; if CF=0, result is falsy, skip to output
                                                      MOV DX, OFFSET T ; otherwise CF=1, set output to "Truthy" string
                                                      DISP_OUT:
                                                      MOV AH, 09H ; DOS API display string function
                                                      INT 21H
                                                      RET

                                                      T DB "Truthy$"
                                                      F DB "Falsy$"


                                                      Example Output:



                                                      enter image description here



                                                      Download test program DD.COM



                                                      Or Try it Online!
                                                      I'm not aware of an online TIO to direct link to a DOS executable, however you can use this with just a few steps:




                                                      1. Download DD.COM as a ZIP file

                                                      2. Go to https://virtualconsoles.com/online-emulators/DOS/

                                                      3. Upload the ZIP file you just downloaded, click Start

                                                      4. Type DD Hello or DD code to your heart's content






                                                      share|improve this answer











                                                      $endgroup$
















                                                        1












                                                        1








                                                        1





                                                        $begingroup$

                                                        IBM PC DOS, 8088 assembly, 56 bytes



                                                        bb28 0133 d2ac 24df 2c41 d78a e080 e40f 02f4 51b1 04d2 e859 02d0 e2e9
                                                        3ad6 1113 2212 0113 2104 0231 2113 2011 3022 3112 0310 1213 2122 3122


                                                        Unassembled:



                                                        ; compare dashes and dots in a Morse code string
                                                        ; input:
                                                        ; I: pointer to input string (default SI)
                                                        ; IL: length of input string (default CX)
                                                        ; TBL: pointer to data table
                                                        ; output:
                                                        ; Carry Flag: CF=1 (CY) if dot-heavy, CF=0 (NC) if dash-heavy
                                                        MORSE_DD MACRO I, IL, TBL
                                                        LOCAL LOOP_LETTER
                                                        IFDIFI <I>,<SI> ; skip if S is already SI
                                                        MOV SI, I ; load string into SI
                                                        ENDIF
                                                        IFDIFI <IL>,<CX> ; skip if IL is already CX
                                                        MOV CX, IL ; set up loop counter
                                                        ENDIF
                                                        MOV BX, OFFSET TBL ; load score table into BX
                                                        XOR DX, DX ; clear DX to hold total score
                                                        LOOP_LETTER:
                                                        LODSB ; load next char from DS:SI into AL, advance SI
                                                        AND AL, 0DFH ; uppercase the input letter
                                                        SUB AL, 'A' ; convert letter to zero-based index
                                                        XLAT ; lookup letter in table
                                                        MOV AH, AL ; examine dot nibble
                                                        AND AH, 0FH ; mask off dash nibble
                                                        ADD DH, AH ; add letter dot count to total
                                                        PUSH CX ; save loop counter (since SHR can only take CL)
                                                        MOV CL, 4 ; set up right shift for 4 bits
                                                        SHR AL, CL ; shift right
                                                        POP CX ; restore loop counter
                                                        ADD DL, AL ; add letter dash count to total
                                                        LOOP LOOP_LETTER
                                                        CMP DL, DH ; if dot-heavy CF=1, if dash-heavy CF=0
                                                        ENDM

                                                        ; data table A-Z: MSN = count of dash, LSN = count of dot
                                                        TBL DB 011H, 013H, 022H, 012H, 001H, 013H, 021H, 004H, 002H
                                                        DB 031H, 021H, 013H, 020H, 011H, 030H, 022H, 031H, 012H
                                                        DB 003H, 010H, 012H, 013H, 021H, 022H, 031H, 022H


                                                        Explanation



                                                        Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as string, output Truthy/Falsy result in Carry Flag. Score table contains the number of dashes and dots per letter.



                                                        Input can be upper/lower/mixed case (would save 2 bytes to take only upper or only lower).



                                                        Example Test Program (as IBM PC DOS standalone COM executable)



                                                            SHR  SI, 1              ; point SI to DOS PSP
                                                        LODSW ; load arg length into AL, advance SI to 82H
                                                        MOV CL, AL ; set up loop counter in CH
                                                        DEC CX ; remove leading space from letter count

                                                        MORSE_DD SI, CX, TBL ; execute above function, result is in CF

                                                        MOV DX, OFFSET F ; default output to "Falsy" string
                                                        JA DISP_OUT ; if CF=0, result is falsy, skip to output
                                                        MOV DX, OFFSET T ; otherwise CF=1, set output to "Truthy" string
                                                        DISP_OUT:
                                                        MOV AH, 09H ; DOS API display string function
                                                        INT 21H
                                                        RET

                                                        T DB "Truthy$"
                                                        F DB "Falsy$"


                                                        Example Output:



                                                        enter image description here



                                                        Download test program DD.COM



                                                        Or Try it Online!
                                                        I'm not aware of an online TIO to direct link to a DOS executable, however you can use this with just a few steps:




                                                        1. Download DD.COM as a ZIP file

                                                        2. Go to https://virtualconsoles.com/online-emulators/DOS/

                                                        3. Upload the ZIP file you just downloaded, click Start

                                                        4. Type DD Hello or DD code to your heart's content






                                                        share|improve this answer











                                                        $endgroup$



                                                        IBM PC DOS, 8088 assembly, 56 bytes



                                                        bb28 0133 d2ac 24df 2c41 d78a e080 e40f 02f4 51b1 04d2 e859 02d0 e2e9
                                                        3ad6 1113 2212 0113 2104 0231 2113 2011 3022 3112 0310 1213 2122 3122


                                                        Unassembled:



                                                        ; compare dashes and dots in a Morse code string
                                                        ; input:
                                                        ; I: pointer to input string (default SI)
                                                        ; IL: length of input string (default CX)
                                                        ; TBL: pointer to data table
                                                        ; output:
                                                        ; Carry Flag: CF=1 (CY) if dot-heavy, CF=0 (NC) if dash-heavy
                                                        MORSE_DD MACRO I, IL, TBL
                                                        LOCAL LOOP_LETTER
                                                        IFDIFI <I>,<SI> ; skip if S is already SI
                                                        MOV SI, I ; load string into SI
                                                        ENDIF
                                                        IFDIFI <IL>,<CX> ; skip if IL is already CX
                                                        MOV CX, IL ; set up loop counter
                                                        ENDIF
                                                        MOV BX, OFFSET TBL ; load score table into BX
                                                        XOR DX, DX ; clear DX to hold total score
                                                        LOOP_LETTER:
                                                        LODSB ; load next char from DS:SI into AL, advance SI
                                                        AND AL, 0DFH ; uppercase the input letter
                                                        SUB AL, 'A' ; convert letter to zero-based index
                                                        XLAT ; lookup letter in table
                                                        MOV AH, AL ; examine dot nibble
                                                        AND AH, 0FH ; mask off dash nibble
                                                        ADD DH, AH ; add letter dot count to total
                                                        PUSH CX ; save loop counter (since SHR can only take CL)
                                                        MOV CL, 4 ; set up right shift for 4 bits
                                                        SHR AL, CL ; shift right
                                                        POP CX ; restore loop counter
                                                        ADD DL, AL ; add letter dash count to total
                                                        LOOP LOOP_LETTER
                                                        CMP DL, DH ; if dot-heavy CF=1, if dash-heavy CF=0
                                                        ENDM

                                                        ; data table A-Z: MSN = count of dash, LSN = count of dot
                                                        TBL DB 011H, 013H, 022H, 012H, 001H, 013H, 021H, 004H, 002H
                                                        DB 031H, 021H, 013H, 020H, 011H, 030H, 022H, 031H, 012H
                                                        DB 003H, 010H, 012H, 013H, 021H, 022H, 031H, 022H


                                                        Explanation



                                                        Implemented in Intel/MASM syntax as a MACRO (basically a function), using only 8088 compatible instructions. Input as string, output Truthy/Falsy result in Carry Flag. Score table contains the number of dashes and dots per letter.



                                                        Input can be upper/lower/mixed case (would save 2 bytes to take only upper or only lower).



                                                        Example Test Program (as IBM PC DOS standalone COM executable)



                                                            SHR  SI, 1              ; point SI to DOS PSP
                                                        LODSW ; load arg length into AL, advance SI to 82H
                                                        MOV CL, AL ; set up loop counter in CH
                                                        DEC CX ; remove leading space from letter count

                                                        MORSE_DD SI, CX, TBL ; execute above function, result is in CF

                                                        MOV DX, OFFSET F ; default output to "Falsy" string
                                                        JA DISP_OUT ; if CF=0, result is falsy, skip to output
                                                        MOV DX, OFFSET T ; otherwise CF=1, set output to "Truthy" string
                                                        DISP_OUT:
                                                        MOV AH, 09H ; DOS API display string function
                                                        INT 21H
                                                        RET

                                                        T DB "Truthy$"
                                                        F DB "Falsy$"


                                                        Example Output:



                                                        enter image description here



                                                        Download test program DD.COM



                                                        Or Try it Online!
                                                        I'm not aware of an online TIO to direct link to a DOS executable, however you can use this with just a few steps:




                                                        1. Download DD.COM as a ZIP file

                                                        2. Go to https://virtualconsoles.com/online-emulators/DOS/

                                                        3. Upload the ZIP file you just downloaded, click Start

                                                        4. Type DD Hello or DD code to your heart's content







                                                        share|improve this answer














                                                        share|improve this answer



                                                        share|improve this answer








                                                        edited 20 mins ago

























                                                        answered 33 mins ago









                                                        gwaughgwaugh

                                                        1,515515




                                                        1,515515























                                                            0












                                                            $begingroup$


                                                            JavaScript (Node.js),  69  68 bytes



                                                            Expects the input string in uppercase. Returns $0$ or $1$.





                                                            s=>Buffer(s).map(n=>s+='30314624523133534452741251'[n%26]-3,s=0)|s>0


                                                            Try it online!






                                                            share|improve this answer











                                                            $endgroup$


















                                                              0












                                                              $begingroup$


                                                              JavaScript (Node.js),  69  68 bytes



                                                              Expects the input string in uppercase. Returns $0$ or $1$.





                                                              s=>Buffer(s).map(n=>s+='30314624523133534452741251'[n%26]-3,s=0)|s>0


                                                              Try it online!






                                                              share|improve this answer











                                                              $endgroup$
















                                                                0












                                                                0








                                                                0





                                                                $begingroup$


                                                                JavaScript (Node.js),  69  68 bytes



                                                                Expects the input string in uppercase. Returns $0$ or $1$.





                                                                s=>Buffer(s).map(n=>s+='30314624523133534452741251'[n%26]-3,s=0)|s>0


                                                                Try it online!






                                                                share|improve this answer











                                                                $endgroup$




                                                                JavaScript (Node.js),  69  68 bytes



                                                                Expects the input string in uppercase. Returns $0$ or $1$.





                                                                s=>Buffer(s).map(n=>s+='30314624523133534452741251'[n%26]-3,s=0)|s>0


                                                                Try it online!







                                                                share|improve this answer














                                                                share|improve this answer



                                                                share|improve this answer








                                                                edited 3 hours ago

























                                                                answered 4 hours ago









                                                                ArnauldArnauld

                                                                78.4k795327




                                                                78.4k795327























                                                                    0












                                                                    $begingroup$


                                                                    Python 2, 73 bytes





                                                                    lambda s:sum(int('035344527512513031462452313'[ord(c)%32])-3for c in s)>0


                                                                    Try it online!






                                                                    share|improve this answer











                                                                    $endgroup$













                                                                    • $begingroup$
                                                                      Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                                                                      $endgroup$
                                                                      – Erik the Outgolfer
                                                                      2 hours ago


















                                                                    0












                                                                    $begingroup$


                                                                    Python 2, 73 bytes





                                                                    lambda s:sum(int('035344527512513031462452313'[ord(c)%32])-3for c in s)>0


                                                                    Try it online!






                                                                    share|improve this answer











                                                                    $endgroup$













                                                                    • $begingroup$
                                                                      Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                                                                      $endgroup$
                                                                      – Erik the Outgolfer
                                                                      2 hours ago
















                                                                    0












                                                                    0








                                                                    0





                                                                    $begingroup$


                                                                    Python 2, 73 bytes





                                                                    lambda s:sum(int('035344527512513031462452313'[ord(c)%32])-3for c in s)>0


                                                                    Try it online!






                                                                    share|improve this answer











                                                                    $endgroup$




                                                                    Python 2, 73 bytes





                                                                    lambda s:sum(int('035344527512513031462452313'[ord(c)%32])-3for c in s)>0


                                                                    Try it online!







                                                                    share|improve this answer














                                                                    share|improve this answer



                                                                    share|improve this answer








                                                                    edited 2 hours ago

























                                                                    answered 2 hours ago









                                                                    TFeldTFeld

                                                                    15.7k21248




                                                                    15.7k21248












                                                                    • $begingroup$
                                                                      Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                                                                      $endgroup$
                                                                      – Erik the Outgolfer
                                                                      2 hours ago




















                                                                    • $begingroup$
                                                                      Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                                                                      $endgroup$
                                                                      – Erik the Outgolfer
                                                                      2 hours ago


















                                                                    $begingroup$
                                                                    Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                                                                    $endgroup$
                                                                    – Erik the Outgolfer
                                                                    2 hours ago






                                                                    $begingroup$
                                                                    Change '035344527512513031462452313'[ord(c)%32] to `0x1d3c7eacfc7218bfeffc59`[ord(c)-65] for 70 bytes.
                                                                    $endgroup$
                                                                    – Erik the Outgolfer
                                                                    2 hours ago













                                                                    0












                                                                    $begingroup$


                                                                    Perl 5 -pF, 53 bytes





                                                                    $p+=y/a-z/35344526512513031462452313/r-3for@F;$_=$p>0


                                                                    Try it online!






                                                                    share|improve this answer









                                                                    $endgroup$


















                                                                      0












                                                                      $begingroup$


                                                                      Perl 5 -pF, 53 bytes





                                                                      $p+=y/a-z/35344526512513031462452313/r-3for@F;$_=$p>0


                                                                      Try it online!






                                                                      share|improve this answer









                                                                      $endgroup$
















                                                                        0












                                                                        0








                                                                        0





                                                                        $begingroup$


                                                                        Perl 5 -pF, 53 bytes





                                                                        $p+=y/a-z/35344526512513031462452313/r-3for@F;$_=$p>0


                                                                        Try it online!






                                                                        share|improve this answer









                                                                        $endgroup$




                                                                        Perl 5 -pF, 53 bytes





                                                                        $p+=y/a-z/35344526512513031462452313/r-3for@F;$_=$p>0


                                                                        Try it online!







                                                                        share|improve this answer












                                                                        share|improve this answer



                                                                        share|improve this answer










                                                                        answered 1 hour ago









                                                                        XcaliXcali

                                                                        5,435520




                                                                        5,435520























                                                                            0












                                                                            $begingroup$


                                                                            C# (Visual C# Interactive Compiler), 49 bytes





                                                                            n=>n.Sum(c=>""[c-65]-4)


                                                                            Contains a lot of unprintables.



                                                                            Try it online!






                                                                            share|improve this answer









                                                                            $endgroup$


















                                                                              0












                                                                              $begingroup$


                                                                              C# (Visual C# Interactive Compiler), 49 bytes





                                                                              n=>n.Sum(c=>""[c-65]-4)


                                                                              Contains a lot of unprintables.



                                                                              Try it online!






                                                                              share|improve this answer









                                                                              $endgroup$
















                                                                                0












                                                                                0








                                                                                0





                                                                                $begingroup$


                                                                                C# (Visual C# Interactive Compiler), 49 bytes





                                                                                n=>n.Sum(c=>""[c-65]-4)


                                                                                Contains a lot of unprintables.



                                                                                Try it online!






                                                                                share|improve this answer









                                                                                $endgroup$




                                                                                C# (Visual C# Interactive Compiler), 49 bytes





                                                                                n=>n.Sum(c=>""[c-65]-4)


                                                                                Contains a lot of unprintables.



                                                                                Try it online!







                                                                                share|improve this answer












                                                                                share|improve this answer



                                                                                share|improve this answer










                                                                                answered 57 mins ago









                                                                                Embodiment of IgnoranceEmbodiment of Ignorance

                                                                                1,578124




                                                                                1,578124























                                                                                    0












                                                                                    $begingroup$


                                                                                    05AB1E, 23 bytes



                                                                                    εA•U(Õþć6Δ
                                                                                    »›I•S3-‡}O.±


                                                                                    Try it online!





                                                                                    share









                                                                                    $endgroup$


















                                                                                      0












                                                                                      $begingroup$


                                                                                      05AB1E, 23 bytes



                                                                                      εA•U(Õþć6Δ
                                                                                      »›I•S3-‡}O.±


                                                                                      Try it online!





                                                                                      share









                                                                                      $endgroup$
















                                                                                        0












                                                                                        0








                                                                                        0





                                                                                        $begingroup$


                                                                                        05AB1E, 23 bytes



                                                                                        εA•U(Õþć6Δ
                                                                                        »›I•S3-‡}O.±


                                                                                        Try it online!





                                                                                        share









                                                                                        $endgroup$




                                                                                        05AB1E, 23 bytes



                                                                                        εA•U(Õþć6Δ
                                                                                        »›I•S3-‡}O.±


                                                                                        Try it online!






                                                                                        share











                                                                                        share


                                                                                        share










                                                                                        answered 5 mins ago









                                                                                        EmignaEmigna

                                                                                        46.9k433142




                                                                                        46.9k433142






























                                                                                            draft saved

                                                                                            draft discarded




















































                                                                                            If this is an answer to a challenge…




                                                                                            • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                                                            • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                                              Explanations of your answer make it more interesting to read and are very much encouraged.


                                                                                            • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                                                                            More generally…




                                                                                            • …Please make sure to answer the question and provide sufficient detail.


                                                                                            • …Avoid asking for help, clarification or responding to other answers (use comments instead).





                                                                                            draft saved


                                                                                            draft discarded














                                                                                            StackExchange.ready(
                                                                                            function () {
                                                                                            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f181318%2fthey-call-me-inspector-morse%23new-answer', 'question_page');
                                                                                            }
                                                                                            );

                                                                                            Post as a guest















                                                                                            Required, but never shown





















































                                                                                            Required, but never shown














                                                                                            Required, but never shown












                                                                                            Required, but never shown







                                                                                            Required, but never shown

































                                                                                            Required, but never shown














                                                                                            Required, but never shown












                                                                                            Required, but never shown







                                                                                            Required, but never shown







                                                                                            Popular posts from this blog

                                                                                            Loup dans la culture

                                                                                            How to solve the problem of ntp “Unable to contact time server” from KDE?

                                                                                            ASUS Zenbook UX433/UX333 — Configure Touchpad-embedded numpad on Linux