While I was waiting for some compiles, I thought about two new language operators
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2005
    Location
    Montreal, Que, Canada
    Posts
    5,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    While I was waiting for some compiles, I thought about two new language operators

    I do programming. Quite often I see possibilities to extend the operators that a language offers.
    I noted for example that python has the dyadic // operator x = y // z

    So, while waiting for some C compiles to complete thought about language extensions.

    This is my idea..

    Proposal for new operator for C, C++, Java, Javascript


    Introduction.

    Some Operators can be monadic or diadic.
    A monadic operator has no intervening veriable.
    Example of three
    monadic operator minus and xor
    x =-x (negative
    ~x (not x
    A dyadic operator has a variable on both sides. examples of dyadic operators are: -,+,*,/ % | ^
    Dyadically
    x=5-4 minus sign used diadically
    x=2**8 power used diadically
    x=3<<x shift used diadically

    I looked at some code that we execute in programs where it could apply
    to replace

    if(x > y)
    result=x;
    else
    result=y;
    or
    result=x>y?x:y ;

    Propose new dyadic symbols using the ascii keyboard characters.

    <] >] are two

    result = a<]b result: the minimum of variable a and variable b
    result = a>]b for the maximum of variable a and variable b
    sum+=a>]b; shown as simplifying the code.


    The operatorís <] and >] would also work with complex numbers
    We could introduce the @ symbol
    signvalue=@x ;
    to replace
    if(x>0) sign=1;
    else
    if(x<0) sign=-1;
    else sign=0;

    Anyway, With respect to classes, I would prefer to have @ to replace ::
    class def(){
    }

    class abc::def {
    }

    is easier to read as
    class abc@def{
    }

    The above are just my 11pm ramblings.

    I used to program in APL. APL language includes some greek symbols in the language to provide operators. It takes a special keyboard to write APL code and a different ascii character set.

    For many many applications, apl is 5 - 20 times faster to write clean code than other interpreted languages. Its too bad that this great langauge became overlooked because of a character layout and keyboard design. I wish there was a way to bring APL back to widespread popularity.
    Leslie in Montreal

    Interesting web sites list
    http://forums.fedoraforum.org/showth...40#post1697840

  2. #2
    Join Date
    Oct 2010
    Location
    Canberra
    Posts
    3,090
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)

    Re: While I was waiting for some compiles, I thought about two new language operators

    Perhaps you might like Forth - you can define any character sequence (apart from white space) to be any function you want.

    User error. Please replace user and try again

  3. #3
    Join Date
    Jun 2005
    Location
    Montreal, Que, Canada
    Posts
    5,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: While I was waiting for some compiles, I thought about two new language operators

    I might try it, Thanks octatato. Sorry for your pending losss (Scientific Linux). That's the way I felt about some gnome extensions that worked with Fedora28 and now fssspphht -- nothing.
    Flat like the soda pop bottle beverage where the gas was allowed to excape.
    Leslie in Montreal

    Interesting web sites list
    http://forums.fedoraforum.org/showth...40#post1697840

Similar Threads

  1. Why not New operators for C?
    By lsatenstein in forum Programming & Packaging
    Replies: 7
    Last Post: 4th April 2017, 03:42 AM
  2. cpu temp doing compiles
    By juszczec in forum Using Fedora
    Replies: 17
    Last Post: 21st March 2011, 01:31 PM
  3. Compiles, but doesn't run.
    By Tux_in_Redhat in forum Programming & Packaging
    Replies: 1
    Last Post: 19th January 2007, 03:35 AM
  4. Bitwise Operators
    By Flounder in forum Programming & Packaging
    Replies: 0
    Last Post: 19th September 2006, 08:17 PM
  5. Some questions about operators
    By Stevenisme in forum Using Fedora
    Replies: 6
    Last Post: 26th August 2005, 03:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •