Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #139291

Re: Range-aware modulo operator -%

Subject Re: Range-aware modulo operator -%
Newsgroups comp.lang.c, comp.lang.c++
References (2 earlier) <q057a5$1pr$1@dont-email.me> <rfrVD.120946$gU6.41087@fx33.iad> <q05lng$k1l$1@dont-email.me> <A9xVD.313699$_35.734@fx46.iad> <q0d7ja$tgl$1@dont-email.me>
From Bart <bc@freeuk.com>
Message-ID <bWsWD.95201$fy7.3260@fx35.am4> (permalink)
Organization virginmedia.com
Date 2018-12-31 18:07 +0000

Cross-posted to 2 groups.

Show all headers | View raw


On 31/12/2018 14:04, Rick C. Hodgin wrote:
> On 12/28/2018 5:08 PM, Richard Damon wrote:
>> On 12/28/18 12:16 PM, Rick C. Hodgin wrote:
>>> How many new symbols have I created, or implemented in CAlive?
>>
>> Looking over the past 6 months of messages, I see suggested:
>>
>> min/max: \/  /\  \/=  /\=
>> swap:    ><
>> shortcut indirect: ~> which later became ~~
>> modulus:  -%

> I have also introduced the underscore-bang operator:  _!
> 
>      https://groups.google.com/d/msg/comp.lang.c/TerqLu1Rvg4/bD4xkKizBgAJ

I must have missed that one. Looking at it now, I still don't understand 
what it does or how it might be useful.

Looking through your CAlive newgroup articles, I can see these new 
operators and symbols, in addition to those above:

   ((...))      as alternative to if (...)
   <<<, >>>     rotates
   /%           divide/mod, but used in very peculiar way
   ==#          ?
   f32#2        The #2 means 2 decimals??
   #            Concatenation of some sort
   !+ +!        ?
   [x]          Same as *x
   ~|...|~      different kinds of 'casks'
   <|...|>
   [|...|]
   (|...|)
   /|...|/
   \|...|/
   |            Alignment operator (to do away with {} and indents)
   <-           Note sure (can't read the note I made)
   _            Dereference? (as in _x and x_f...)
   ?            As in 'if (x?)'
   b<-a         Means same as a->b
   |-, -|       ? 'lbar' and 'rbar'
   <-           To do with pointers again (3rd overload?)
   @            'pass by pointer'
   #x           'before value of x'?
   ##x          reset something or other
   #=           ?
   i|++         I think still increment

Together with the dozens of other puzzling features, I really look 
forward to seeing what a program in this language will look like that 
when using all this lot.

And that's not meant to be complimentary. (Combining this with all of 
supercat's ideas would be even more intriguing.)


>      // As a predicate
>      ((units > 1)) qty /= units;

Why is that better than:

        if (units > 1) qty /= units;

> 
> I've added the /% divide-modulo operator, which operates to
> obtain the divide value and remainder in one op:
> 
>      // Old way:
>      divide_value = a / b;
>      remainder    = a % b;
> 
>      // Using divide-modulo
>      divide_value = a /% b : remainder;

People will want to write:

        divide_value, remainder = a /% b;

(Your use of ":" interferes with "?:" if you still have that.)

> I've introduced the @ character for use when passing a variable
> to indicate it's being passed by reference.

You seem to use & for that purpose, so what's the point of @?

, which include <<<= and >>>= as well as the
> ability to rotate a sub-portion using start#length syntax, as
> in <<7#4<<

<< or <<<?

  to begin rotating at the 7th bit and extend for 4
> bits to the 7th,8th,9th,10th bit.
> 
>      x <<<= 5;           // Rotate the bits in x 5 positions
>      y >>>= 5 : carry; 

And yet one more use of ":". And another example where two things are 
modified in the same expression. (What happens with 'y>>>=5:y;' ?)

> Many features in CAlive.

Clearly.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Range-aware modulo operator -% "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-27 21:09 -0500
  Re: Range-aware modulo operator -% Richard Damon <Richard@Damon-Family.org> - 2018-12-27 21:34 -0500
    Re: Range-aware modulo operator -% "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2018-12-28 05:37 +0100
    Re: Range-aware modulo operator -% James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-29 16:04 -0500
      Re: Range-aware modulo operator -% Richard Damon <Richard@Damon-Family.org> - 2018-12-29 19:13 -0500
  Re: Range-aware modulo operator -% Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-12-28 03:05 +0000
    Re: Range-aware modulo operator -% Robert Wessel <robertwessel2@yahoo.com> - 2018-12-27 21:31 -0600
      Re: Range-aware modulo operator -% Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-12-28 04:20 +0000
    Re: Range-aware modulo operator -% James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-27 19:32 -0800
      Re: Range-aware modulo operator -% Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-12-28 04:18 +0000
  Re: Range-aware modulo operator -% Bart <bc@freeuk.com> - 2018-12-28 12:29 +0000
    Re: Range-aware modulo operator -% "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-28 08:10 -0500
      Re: Range-aware modulo operator -% Richard Damon <Richard@Damon-Family.org> - 2018-12-28 10:25 -0500
        Re: Range-aware modulo operator -% Bart <bc@freeuk.com> - 2018-12-28 15:56 +0000
          Re: Range-aware modulo operator -% Richard Damon <Richard@Damon-Family.org> - 2018-12-28 17:26 -0500
            Re: Range-aware modulo operator -% Sjouke Burry <burrynulnulfour@ppllaanneett.nnll> - 2018-12-28 23:45 +0100
        Re: Range-aware modulo operator -% "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-28 11:44 -0500
        Re: Range-aware modulo operator -% "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-28 12:16 -0500
          Re: Range-aware modulo operator -% Richard Damon <Richard@Damon-Family.org> - 2018-12-28 17:08 -0500
            Re: Range-aware modulo operator -% Tim Rentsch <txr@alumni.caltech.edu> - 2018-12-28 15:01 -0800
            Re: Range-aware modulo operator -% "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-31 09:04 -0500
              Re: Range-aware modulo operator -% Bart <bc@freeuk.com> - 2018-12-31 18:07 +0000
                Re: Range-aware modulo operator -% "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-31 14:22 -0500
                Re: Range-aware modulo operator -% Bart <bc@freeuk.com> - 2018-12-31 21:05 +0000
                Re: Range-aware modulo operator -% "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-31 16:32 -0500
                Re: Range-aware modulo operator -% Bart <bc@freeuk.com> - 2018-12-31 23:43 +0000
                Re: Range-aware modulo operator -% Keith Thompson <kst-u@mib.org> - 2018-12-31 16:44 -0800
                Re: Range-aware modulo operator -% Bart <bc@freeuk.com> - 2019-01-01 01:06 +0000
                Re: Range-aware modulo operator -% Keith Thompson <kst-u@mib.org> - 2018-12-31 19:06 -0800
                Re: Range-aware modulo operator -% Bart <bc@freeuk.com> - 2019-01-01 11:32 +0000
                Re: Range-aware modulo operator -% Keith Thompson <kst-u@mib.org> - 2019-01-01 12:48 -0800
                Re: Range-aware modulo operator -% Bart <bc@freeuk.com> - 2019-01-01 23:54 +0000
                Re: Range-aware modulo operator -% Keith Thompson <kst-u@mib.org> - 2019-01-01 16:09 -0800
                Re: Range-aware modulo operator -% Bart <bc@freeuk.com> - 2019-01-02 00:49 +0000
                Re: Range-aware modulo operator -% Keith Thompson <kst-u@mib.org> - 2019-01-01 17:53 -0800
                Re: Range-aware modulo operator -% Bart <bc@freeuk.com> - 2019-01-02 02:36 +0000
                Leader Kiki is not going to like this... (Was: Range-aware modulo operator -%) gazelle@shell.xmission.com (Kenny McCormack) - 2019-01-02 08:36 +0000
                Re: Range-aware modulo operator -% Keith Thompson <kst-u@mib.org> - 2019-01-02 00:38 -0800
                Re: Range-aware modulo operator -% rbowman <bowman@montana.com> - 2019-01-01 22:40 -0700
                Re: Range-aware modulo operator -% Bart <bc@freeuk.com> - 2019-01-02 12:12 +0000
                Re: Range-aware modulo operator -% gazelle@shell.xmission.com (Kenny McCormack) - 2019-01-01 01:53 +0000
                Re: Range-aware modulo operator -% Richard Damon <Richard@Damon-Family.org> - 2018-12-31 16:57 -0500
                Re: Range-aware modulo operator -% Bart <bc@freeuk.com> - 2018-12-31 22:33 +0000
                Re: Range-aware modulo operator -% Keith Thompson <kst-u@mib.org> - 2018-12-31 13:34 -0800
                Re: Range-aware modulo operator -% Richard Damon <Richard@Damon-Family.org> - 2018-12-31 16:43 -0500
                Re: Range-aware modulo operator -% Keith Thompson <kst-u@mib.org> - 2018-12-31 15:20 -0800
  Re: Range-aware modulo operator -% Eduardo <abdulai60@gmail.com> - 2018-12-28 07:18 -0800
    Re: Range-aware modulo operator -% "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-28 11:45 -0500

csiph-web