Menu

#513 Really odd problem with concatenation operator

open
nobody
None
5
2017-10-23
2017-10-23
No

This one really perplexed me. I was trying to create a comma-separated-values file just by inserting ',' between field values in the record. With

do ws=maxws to 2 by -1; do ls=0 to ws-1; if scorecount.ws.ls = 0 then iterate; ofx += 1; oline.ofx = scorecount.ws.ls','ws','ls','ws-ls','ws+ls','(ws-ls)/(ws+ls)','; end; end;

I got:

'56' is not recognized as an internal or external command,
operable program or batch file'

I got the expected results when I changed it to:

do ws=maxws to 2 by -1; do ls=0 to ws-1; if scorecount.ws.ls = 0 then iterate; ofx += 1; oline.ofx = scorecount.ws.ls ',' ws ',' ls ',' ws-ls ',' ws+ls ',' (ws-ls)/(ws+ls) ','; end; end;

The 56 is what ws-ls evaluates to. But why would Regina interpret a string like ','ws-ls',' in the middle of an argument to the '=' assignment as a command?

Related

Bugs: #513

Discussion

  • Gerard Schildberger

     WAD.
    
     The literal    ','    immediate before a left parenthesis means 
     that REXX thinks that the   ,    (comma)  is an external
     function name, and it asks the host environment to execute the
     program    ','   with the argument of the value of   (ws-ls).  
     In this case, the argument is    56.
    
     Just change it to ',' || (ws-ls)/ ....
    
     In (under) the Microsoft Windows DOS enviornment, when you
     enter the command:
    
            ,     56
    
     --- that is to say:      (comma)  fifty-six
    
     my DOS window complains with:
    
     '56' is not recognized as an internal or external command,
     operable program or batch file.
    
     _________________________________________ Gerard Schildberger
    
     
    • Paul Kislanko

      Paul Kislanko - 2017-10-23

      Yeah, this has bitten me before and I fix it like that. It's
      counterintuitive, and the fix is ugly, but I guess there's no way to avoid
      it. Why should ',' be considered a function name?

      The prettier fix would be to calculate ws-ls outside of the statement, and
      just have ','wsminusls',' which would not present the ',(' syntax to the
      interpreter.

      From: Gerard Schildberger [mailto:gerardschi@users.sf.net]
      Sent: Monday, October 23, 2017 4:03 PM
      To: [regina-rexx:bugs] 513@bugs.regina-rexx.p.re.sf.net
      Subject: [regina-rexx:bugs] #513 Really odd problem with concatenation
      operator

      WAD.

      The literal ',' immediate before a left parenthesis means
      that REXX thinks that the , (comma) is an external
      function name, and it asks the host environment to execute the
      program ',' with the argument of the value of (ws-ls).
      In this case, the argument is 56.

      Just change it to ',' || (ws-ls)/ ....

      In (under) the Microsoft Windows DOS enviornment, when you
      enter the command:

          ,     56
      

      --- that is to say: (comma) fifty-six

      my DOS window complains with:

      '56' is not recognized as an internal or external command,
      operable program or batch file.

      ________ Gerard Schildberger
      __

      [bugs:#513] https://sourceforge.net/p/regina-rexx/bugs/513/ Really odd
      problem with concatenation operator

      Status: open
      Group:
      Created: Mon Oct 23, 2017 09:42 PM UTC by Paul Kislanko
      Last Updated: Mon Oct 23, 2017 09:42 PM UTC
      Owner: nobody

      This one really perplexed me. I was trying to create a
      comma-separated-values file just by inserting ',' between field values in
      the record. With

      do ws=maxws to 2 by -1; do ls=0 to ws-1; if scorecount.ws.ls = 0 then
      iterate; ofx += 1; oline.ofx =
      scorecount.ws.ls','ws','ls','ws-ls','ws+ls','(ws-ls)/(ws+ls)','; end; end;

      I got:

      '56' is not recognized as an internal or external command,
      operable program or batch file'

      I got the expected results when I changed it to:

      do ws=maxws to 2 by -1; do ls=0 to ws-1; if scorecount.ws.ls = 0 then
      iterate; ofx += 1; oline.ofx = scorecount.ws.ls ',' ws ',' ls ',' ws-ls ','
      ws+ls ',' (ws-ls)/(ws+ls) ','; end; end;


      The 56 is what ws-ls evaluates to. But why would Regina interpret a string
      like ','ws-ls',' in the middle of an argument to the '=' assignment as a
      command?


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/regina-rexx/bugs/513/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #513


Log in to post a comment.