I recently started using rust-analyzer with vscode. One common sight is this: thing .stuff() .other() .whatevs() Each of the calls returns a different type. Rust-analyzer displays the return type of each call to the right of it. I imagine something similar could reconcile the benefits of terseness with readability and discoverabilty. The blog post already has the prototype: + / ! 100 plus reduce range 100 Imagine the…
> Imagine the second line being added in by your ide in a light gray. So what would be the benefit compared to just writing `plus reduce range 100`?
Stages of Denial
61–70 of 119 posts
Re: Stages of Denial
#62Earlier quoted context omitted.
Lisp is polish notation for trees of variable arity. hence all the parens - you need some way to group them. So in some K flavoured LISP I think it would be ((/ +) (! 100))
Or in clojure with the threading macro (->> 100 range (reduce +)) which is equivalent to this, without the macro (reduce + (range 100))
Re: Stages of Denial
#63Earlier quoted context omitted.
As APL shows, you then need quite a large alphabet of symbols, though. But I'm not strongly in either camp. A few common branches of mathematics taken together have quite a large alphabet of symbols, too, and we work well with it. It feels like symbolic notations can seem obtuse at first and be hard to get into, but once you're used to it the alternative may appear worse.
> As APL shows, you then need quite a large alphabet of symbols, though. I count 71, which doesn't seem like a lot.
Re: Stages of Denial
#64> a more direct translation into another language might look like: range(100).reduce(plus, 0) That's...uhh...one way to do it. But it's a lot shittier to read than sum(range(100)).
Since the arity of all the primitives are known there's less parens than lisp. That seems like the clear sweet spot to me.
And I think this is born out with K the product. One of the things they added with Q is a more text oriented syntax.
The big a-ha in APL style languages is shifting from thinking about loops and iterating over single elements to transforming tensor like objects. It's a powerful approach no matter what language and syntax you use.
Re: Stages of Denial
#65One important thing to remember about esolangs like this is that theory != implementation. Just because Brainfuck "theoretically" exists as a language doesn't automatically solve issues like memory management or extensibility. Sure, maybe it is more ergonomic to write some functions in K. But, as with most code-golfing languages, the goal isn't to build a better language, it's to build a faster one. Maybe K can run t…
Re: Stages of Denial
#66Earlier quoted context omitted.
It is a typical language-comparison strawman. He is writing list.reduce((x,y)=>Math.max(x,y)) To get the max number in a list. And he is "winching" because he can't write: list.reduce(Math.max) Because the variable arity of max does not play well with reduce. But because of the variable arity he can write: Math.max(...list) Which is even simpler. So he deliberately writes overly complex JavaScript code to show how th…
IIRC the spread syntax only works with relatively small arrays, because it's function application at the end of the day. So worthwhile keeping in mind that the nice JS code falls apart.
And if you think lodash is still to verbose, you can define your own:
const å = list => list.reduce((x,y) => Math.max(x, y));
Now you can write å(list) to get the max value of an array!Re: Stages of Denial
#67Earlier quoted context omitted.
> Imagine the second line being added in by your ide in a light gray. So what would be the benefit compared to just writing `plus reduce range 100`?
less keystrokes
Re: Stages of Denial
#68Re: Stages of Denial
#69I recently started using rust-analyzer with vscode. One common sight is this: thing .stuff() .other() .whatevs() Each of the calls returns a different type. Rust-analyzer displays the return type of each call to the right of it. I imagine something similar could reconcile the benefits of terseness with readability and discoverabilty. The blog post already has the prototype: + / ! 100 plus reduce range 100 Imagine the…
(0 to 99).sum
That's not much longer, and quite readable even for the uninitiated. (It's a Scala expression, so not made up).