News for hackers. Stuff that matters.
Re:John Carmack: “I just dumped the C++ server I wrote for a... by UnquietTinkerer on Tuesday March 17, 2015 @09:33PM (#9223019)

    (-b + sqrt(b*b - 4*a*c)) / (2*a)
    (/ (+ (- b) (sqrt (- (* b b) (* 4 a c)))) (* 2 a))
It does depend on your use case.
Re:John Carmack: “I just dumped the C++ server I wrote for a... by yogthos on Tuesday March 17, 2015 @10:27PM (#9223226)
Re:John Carmack: “I just dumped the C++ server I wrote for a... by kazinator on Wednesday March 18, 2015 @07:48PM (#9229390)
Lisp only has infix macros so that we can say "we have that".

Nobody in their right mind uses this stuff in production code.

It just overcomes objections. "Oh, if I start using Lisp, there is be a way to use infix, should I really need it". Ten years and six Lisp project later, you still haven't used the infix stuff; the situation never comes.

Re:John Carmack: “I just dumped the C++ server I wrote for a... by jakub_h on Friday March 27, 2015 @06:43PM (#9279527)
> Nobody in their right mind uses this stuff in production code.

You sure about that? I thought the lispy approach was generally pragmatic - you use what you deem handy for your application. It this weren't the case, there would be little need for macros in the first place. I can very well imagine, say, a scientific or engineering application that would share a common infix parser for both user-provided expressions (in the UI, to be more friendly to non-lispers) and heavy math lifting in the source code.

Re:John Carmack: “I just dumped the C++ server I wrote for a... by yogthos on Friday March 20, 2015 @02:11PM (#9239510)
Clearly you didn't even look at the links provided. :)
Re:John Carmack: “I just dumped the C++ server I wrote for a... by kazinator on Wednesday March 18, 2015 @07:35PM (#9229339)
But! Perfect splitting across lines according to a formatting algorithm which is simple, consistent, and incrementally applicable:

1.

   (/ (+ (- b) (sqrt (- (* b b) (* 4 a c))))
      (* 2 a))
2.

   (/ (+ (- b)
         (sqrt (- (* b b) (* 4 a c))))
      (* 2 a))
3.

   (/ (+ (- b)
         (sqrt (- (* b b)
                  (* 4 a c))))
      (* 2 a))
4.

   (/ (+ (- b)
         (sqrt (- (* b
                     b)
                  (* 4 
                     a 
                     c))))
      (* 2
         a))
Now you have a sideways tree, revealing the structure of the expression, where it is immediately apparent what the operands are of the / and the + and so on.

Infix turns into a mess breakfast when it's too long for one line.

For this particular expression, I'd probably go with variant (3) in production code. Compared to the beauty of (3), the original one-liner is basically a strawman. In terms of clarity of structure, it trumps the infix also.

This is actually a very important point that is overlooked by Lisp noobs. In real Lisp code, expressions are not written all out in one line, whereby the human reader must mentally match the parentheses. Even numeric expressions that might be one-liners in Fortran or C, are split across several lines to make at least the major constituents clear in relation to the major operator.

Re:John Carmack: “I just dumped the C++ server I wrote for a... by ynniv on Tuesday March 17, 2015 @10:34PM (#9223256)
http://srfi.schemers.org/srfi-105/srfi-105.html

    {-(b) + {sqrt((b * b) - (4 * a * c)) / (2 * a)}}
Re:John Carmack: “I just dumped the C++ server I wrote for a... by thoth on Wednesday March 18, 2015 @10:20AM (#9225620)
>It does depend on your use case.

Yes, and the first line's use case depends on the language built-in operator precedence rules to reduce the number of parens.

If you are using math formulas as an example of minimal paren usage, go with APL and have even fewer since all operators are equal precedence and associate to the right.

If you really wanted to write the quadratic formula (or math formulas in general) you could use APL and use even fewer.

Re:John Carmack: “I just dumped the C++ server I wrote for a... by evincarofautumn on Wednesday March 18, 2015 @07:27PM (#9229310)

    b fnegate b b f* 4 a c f* f* f- fsqrt f+ 2 a f* f/
Re:John Carmack: “I just dumped the C++ server I wrote for a... by andrewstuart on Wednesday March 18, 2015 @12:52AM (#9223690)
Executable line noise.
Re:John Carmack: “I just dumped the C++ server I wrote for a... by ChristianBundy on Tuesday March 17, 2015 @09:43PM (#9223055)
Your second line hurts me inside.