6 ms·
Actually looks quite interesting. syntax looks like: fun | is_sorted([] || [_]): #true | is_sorted([head, next, tail, ...]): head .<= next && is_sor
by OriPekelman 2y ago
Actually looks quite interesting. syntax looks like:
fun
| is_sorted([] || [_]): #true
| is_sorted([head, next, tail, ...]):
head .<= next && is_sorted([next, tail, ...])
is_sorted([1, 2, 3, 4, 5])
is_sorted([1, 2, 30, 4, 5])
a bunch of ways to express blocks, pattern matching and macros. The class facilities also look very nice. other than some indentation it doesn't feel pythony at all (which for me is a good thing!) more like an Elixir feel (cute syntax for some great concepts behind) see https://github.com/racket/rhombus/blob/master/demo.rhm https://github.com/racket/rhombus/blob/master/demo.rhm
- adastra22 2y agoLooks like Haskell.
- trealira 2y agoOr like Standard ML. But it's interesting, since I hadn't seen that part yet, only the loop part and some of the dynamic typing. for List: each i: [1, 2] each j: ["a", "b", "c"] [i, j] > [[1, "a"], [1, "b"], [1, "c"], [2, "a"], [2, "b"], [2, "c"]] for (i: 1..4): "number " +& i ~into List > ["number 1", "number 2", "number 3"] for: each: friend: ["Alice", "Bob", "Carol"] index: 1..4 println(index +& ". " +& friend) 1. Alice 2. Bob 3. Carol It gave me the impression of more of a cross between Scheme and Python.
- aeonik 2y agoYes, I also got Python vibes. That behind said, I'm digging infix less and less over time, and I'm actually starting to crave forth syntax, just got the complete lack of punctuation... but, I actually really like what they have going here. Seems nice and minimalist, while meeting consistent and clean.
- scotty79 2y agoFor a person that doesn't know racket, Haskell or any ML it looks unnecessarily convoluted. My most charitable take is that it solves some problems I never seen a computer language have.
- presentation 2y agoAs someone who has it doesn’t look convoluted and solves problems I’ve seen many computer languages have, especially non-functional-style ones.
- scotty79 2y agoWhat does | solve? They are also using : ; , and a new line. Also ' and << >> that I have no idea how to type. They are using both :~ and :: for type hints. In none of the languages I've seen that was necessary or useful. I think the problem they were solving was ... we really want to be able to cram everything into one line, so even if you split lines you might just as well still use the same characters despite them being unnecessary then.
- soegaard 2y agoThe syntax `expr :~ annot` is used to annotate the expression with static information. This is different from type annotations. It's a general mechanism to associate an expression with "extra information" that can be used elsewhere (at compile time). One can for example using static information to implement dot notation for an object system. Using static information, one can push name resolution from runtime to compile time. The important part is that users of Rhombus can use the mechanism for tracking static information specific for their programs. It will be exciting to see the creative uses of this mechanism in the future. https://docs.racket-lang.org/rhombus/static-info.html https://docs.racket-lang.org/rhombus/static-info.html
- scotty79 2y ago> The syntax `expr :~ annot` is used to annotate the expression with static information. Compiler can tell if a thing is static or dynamic and apply the correct behavior. Why would I ever want to check static thing only dynamically and why would I ever want to try statically check dynamic type if not by mistake? If programmer doesn't really have a real choice why make him choose which buttons to press?