This is racket's [rhombus], which might be an interesting second link here; it's a scheme, underneath, with the full power of Racket libs available. [`shrubbery`], the replacement for s-exprs, is pretty interesting, expanding s-expr simply with grouping, and then a separate infix-pass on top. I've been playing with using it as the basis for a separate language; it's in an interesting place in the AST space, especiall…
Rhombus Language
111–120 of 161 posts
Re: Rhombus Language
#112Earlier quoted context omitted.
Interesting. I learned Ruby a long time ago because a Perl expert told me Ruby was getting good. I like Typescript because it's really easy to read and maintain without breaking anything. But you can't do this: `next x.map { _1 + 3 }.sum if sth`. I guess I should give Kotlin a try then.
After 20 years of Ruby I didn't know (or didn't remember) that next can have an argument. I looked it up. Thanks. BTW, I never liked the _N arguments. Too cryptic. They make me stop and think on details instead of just read the code and concentrate on the important stuff. x.map {¦n¦ n + 3}.sum is immediately clear but I guess that it's very subjective.
x.map { it + 3 }.sum
which I'm still getting used toRe: Rhombus Language
#113Earlier quoted context omitted.
Thanks. It’s nice to see at least a few in the FP community recognize that Lisp dialects, with their parenthesis-ridden S-expressions, are hard to read and write.
This is nothing new, see - M-expressions ( https://en.wikipedia.org/wiki/M-expression ) - Lisp 2 ( https://en.wikipedia.org/wiki/LISP_2 ) - Dylan ( https://en.wikipedia.org/wiki/Dylan_(programming_language) - Wolfram ( https://en.wikipedia.org/wiki/Wolfram_Language ) - Julia ( https://en.wikipedia.org/wiki/Julia_(programming_language) ) However the large majority of Lisp folks end up using plain old Common Lisp and S…
- Liso (http://breuleux.net/blog/liso.html)
Re: Rhombus Language
#114Earlier quoted context omitted.
1. I helped maintain a payroll system written in GW-BASIC for a year or two. It was designed cleanly and well, with each module of code a separate file chain-loaded in from disk as a de facto overlay system. The variables that each module inherited were thoroughly documented in code comments at the top of each module, so it was clear what it would inherit in RAM and which you needed not to touch. Just as one can writ…
The overlay system is an even worse paradigm than global variables within a program. And one I too am very familiar with. What happened here was that this payroll system of yours was written by people who saw clearly the danger of BASIC's many footguns and mitigated it the best way they could, by supplementing their code with vast quantities of english prose. This is not an argument in favor of BASIC. > Just as one c…
As it happens, my boss, who wrote the app, quit, started his own company, and did rewrite it, from memory. He did it in QuickBASIC 4: it became a compiled binary app, in structured code. That made it more readable, sure: the point here being, it wasn't necessary to rewrite it in another unrelated language to get that win.
But QB was a cut-down version of the MS BASIC Professional Development System. It was intended as a pro tool, not as a thing for learners.
In other words:
• Don't mix up simple BASICs intended for beginners with pro-level ones.
• Don't assume that a more "serious" language means more readable code, because it doesn't.
• The flipside: don't assume that more readable code needs a more serious language. It doesn't.
None of your criticisms address what I'm trying to say, which is that BASIC was in its time a good tool for beginners, and the evangelists of, say, Python have failed to understand _why_ it was good at what it did. Python is _not_ a globally better thing.
Tools that are good for pros may be bad for beginners, just as tools for beginners can be bad for pros. This is surely not a stretch or a controversial statement.
Re: Rhombus Language
#115Looking through the examples, macros and pattern-matching, for me that would be impressive like 10 years ago. If you want to see really innovative, readable and powerful language check out Red. While the language development seems to be ceased, the ideas (coming from old proprietary Rebol language) of working with code and data go much deeper than just macros: it has built-in DSL (called parse) for making DSLs on the…
Moreover, compile-time macros fill a different role than run-time extensibility: macros can do some ahead-of-time static analysis and the compiler can emit much faster code with no runtime cost.
All I’m trying to say is, if you think Red is more impressive than Rhombus, then you are missing something. :) Rhombus is strictly more expressive than Red. Red might have some nice affordances, but there’s no reason why Rhombus couldn’t have them too.
(And I remember speaking with Matthew Flatt about an eDSL someone was building with the macro system—it was embedded regexes that could communicate with the host language about some of their internal structure; eg report number of capture groups for binding information or something like that. Again, this is all done in user-land, rather than part of the “core” of the language.)
Re: Rhombus Language
#116Earlier quoted context omitted.
Interesting. I learned Ruby a long time ago because a Perl expert told me Ruby was getting good. I like Typescript because it's really easy to read and maintain without breaking anything. But you can't do this: `next x.map { _1 + 3 }.sum if sth`. I guess I should give Kotlin a try then.
After 20 years of Ruby I didn't know (or didn't remember) that next can have an argument. I looked it up. Thanks. BTW, I never liked the _N arguments. Too cryptic. They make me stop and think on details instead of just read the code and concentrate on the important stuff. x.map {¦n¦ n + 3}.sum is immediately clear but I guess that it's very subjective.
The `next` keyword is interesting in Ruby. It can be used as an explicit return for blocks. In javascript, for comparison, there is a `continue` for standard loops, but non-standard blocks don't exist so they are functions and require the use of the return keyword (except for single-instruction arrow functions). And implicit returns or nexts simply don't exist in js.
Re: Rhombus Language
#117Earlier quoted context omitted.
When the pattern `[Posn(x, y), ...]` matches a list of positions, since `Posn(x, y)` is followed by `...` the `x` is bound to a sequence of first coordinates and `y` is bound to a sequence of second coordinates. In the template the `Posn(y, x)` is followed by `...` so the same number of positions is produced as the common length of x and y.
Typical pattern matching like in Haskell or Prolog wouldn't do this.
Re: Rhombus Language
#118Earlier quoted context omitted.
Curious to read that because I’ve always had the opposite opinion of the above: Typescript looks nice to work with but the tool chain is horrible (this isn’t really Typescripts fault though, more a synonym of it having to compile to JS). Go looks horrible to work with (too simplified syntax) but is actually really nice because the tooling is (mostly) spot on and it’s simplified syntax weirdly helps with maintainabili…
I’m not sure about Go being full of footguns, but for one, a panic in any goroutine forcibly terminates the entire application.
Re: Rhombus Language
#119Re: Rhombus Language
#120Earlier quoted context omitted.
That syntax suggests the first pair will be flipped, and the rest will just be as they were, i.e. more like flip_first
When the pattern `[Posn(x, y), ...]` matches a list of positions, since `Posn(x, y)` is followed by `...` the `x` is bound to a sequence of first coordinates and `y` is bound to a sequence of second coordinates. In the template the `Posn(y, x)` is followed by `...` so the same number of positions is produced as the common length of x and y.
If I had to guess:
fun flip_all([Posn(x, y), rest]):
[Posn(y, x), rest]
If I am correct then the only difference between flipping all and flipping just the first is `...` vs `rest`