On Sat, 5 Sep 2020 16:09:32 -0400, Bob Bridges wrote:
>
>  str=word('true false',(0-fx)+2)
>
>...where fx is Boolean.  
> 
My use of COPIES() was to save 2 lines of code while knowing that
the function call/return overhead is large and IF would perform better.

>  if fx then str='true'; else str=true
>
???  So if fx is 1 this sets str to "true"; if fx is 0 this sets str to "TRUE"?

But I'd rather do:
    parse value 0 1 with false true.
Or perhaps mischievously:
    parse value (2+2=5) (2+2=4) with false true .

... and have useful(?) constant identifiers.  But I can think of
few places other than function arguments where using Boolean
constant identifiers improves either performance or legibility.


On Sat, 5 Sep 2020 16:18:47 -0400, Bob Bridges wrote:
>
>When you care about efficiency, I'd think this would be better:
>
>  const=4/3*3.14159E0 /* in the initialization */
>  volume=const*radius**3 /* inside the loop */
>
I leave it to the compiler to perform that sort of constant
folding.  Most of them do.  Same for reordering operands.
A programmer computing volumes in several places might
declare a function (which the compiler should expand inline.)


On Sat, 5 Sep 2020 16:21:51 -0400, Bob Bridges wrote:
>
>Going back to the beginning, Gil:  SQRT(X**TWO+Y**TWO) looks like ~exactly~ 
>the sort of thing that oughta be made a constant rather than being coded more 
>than once.  That is, if X, Y and TWO all constants themselves; and if they are 
>not then this isn't an example of what you're talking about.  Did you 
>accidentally reverse your meaning?  Or what am I missing?
> 
No.  I was assuming that X and Y are variables, perhaps function
arguments and playing off the Lang. Ref's assertion (almost surely
wrong, but I can't test it) that any constant (such as 2) occurring
more than once *must* be declared and referenced as an identifier.

>---
>/* Anarchy might be great, if only it could be enforced.  -Joseph Sobran, 
>2001-03-27 */
>
A couple decades ago I saw signs spray-painted on pavements and
walls touting the Boulder Anarchist Party.  I thought that Anarchists
shouldn't have political parties.  But how could that be enforced?

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to