10 ms·
Noulith: A new programming language by the current Advent of Code leader
- janvdberg 4y agoThe really interesting thing here is that the creator of this language (betaveros) is using this specific language in the Advent of Code contest where he is currently number one on the leaderboard: https://github.com/betaveros/advent-of-code-2022 https://github.com/betaveros/advent-of-code-2022 Which is an interesting take on the concept of domain specific language.
- sargstuff 4y agoor a way to get a k or g implimenation.
- wodenokoto 4y agoI thought the leaderboard was dominated by automated GPT-chat bots. Did they get banned or couldn’t they keep up with the puzzles?
- abra0 4y agoGPT only got a good placement on Day 3 Part 1. It seems to not have been very useful in any other days (except for people maybe using Copilot).
- mckirk 4y agoAfter about day two, ChatGPT didn't produce anything useful anymore iirc; at least when asked to write the solution in Haskell. Interestingly, it still produced internally consistent solutions with valid Haskell code, they just didn't have much to do with the given problem. And I feel like that sums up one of the main issues with ChatGPT quite well: if you scrolled through StackOverflow and saw a really polished solution for something, you'd assume it was mostly correct, because for people, 'visible effort' put into code usually correlates with correctness/ourselves. But ChatGPT always produces really polished solutions really confidently, even if they are complete nonsense.
- macintux 4y agoI’ve had that signaling discussion here a few times. With a person, usually they’ll give you some indication (explicitly or not) that they’re uncertain of the correct answer, or they’ll have a relevant track record to help you evaluate their honesty. No such luck with ChatGPT.
- dragonwriter 4y agoPeople are confidentally wrong all the time, and ChatGPT does have a relevant track record to help evaluate whether it’s apparent confidence is justified (at that track record, as is true for many people, is “highly mixed, so you shouldn’t implicitly trust it”.)
- montebicyclelo 4y agoPeople were asking chatgpt multiple times, and then taking the most common working answer. Guess that's kind of a method to estimate it's confidence.
- dragonwriter 4y ago> if you scrolled through StackOverflow and saw a really polished solution for something, you’d assume it was mostly correct IME, that should, at best, be a very tentative assumption for StackOverflow. Heck, for me it is also a very tentative assumption when I see a very polished solution in official documentation from lots of providers (AWS, I’m looking at you.) Though in that case I assume it was correct at some point in time, for some (possibly not publicly released) version of the software/service.
- tialaramex 4y agoYup, in other domains ChatGPT will confidently give answers that sound vaguely plausible but miss out key things a human would definitely highlight, or just get the specifics wrong. There's a video of Harstem I think, following build orders ChatGPT came up with for Starcraft II. ChatGPT doesn't say "I have no idea how to play this game" instead it confidently offers advice that is... not good. Harstem wins at least one game anyway, but you know, not from the great advice just from being a good player.
- AdeptusAquinas 4y agoI think it takes a lot more than a language, no matter how efficient to get top 10 in AoC - its more about being able to parse the problem exceptionally quickly, or rather recognise practically from memory the class of problem that the day is asking for and be halfway through coding it before you have even finalised the specifics. I managed to get 47th on one of the days once... and that was after solving it in under a minute.
- pedrosorio 4y ago> and that was after solving it in under a minute That depends a lot on the day. Towards the end it takes longer. Today's 47th place solved the problem in 11:54
- JoachimS 4y agoConsistently being able to grasp the problem very fast, and then write a solution is what impress me the most. If you check the results for the events the last couple of years, you see the same set of persons being up at the top 10-20. Basically solving hundreds of problems. Problems that span a quite a large set of CS, math problem domains.
- valenterry 4y agoDynamically typed and very flexible syntax with a lot of edge cases? The language doesn't look bad in comparison to a lot of others, but the combination above is a nogo for me when it comes to any kind of production code.
- whalesalad 4y agoAgreed. I don’t mind dynamic typing at all, particularly when facilities exist to establish contracts around what the data you’re passing around looks like. But I don’t think this is a brilliant solution to Python’s problems. Python has issues, don’t get me wrong, but it’s a very very mature language without a lot of WTF moments. On the flip side, a brand new language with this level of freedom means you really need to sit down and grok everything from the inventors perspective before you can be proficient. You need to absorb the entire language for it to work. Meanwhile, and I’m hesitant to beat this drum, a lisp like Clojure is not at all confusing or unclear. The syntax might be hard to grok initially, and the short function names or departure to literal functional programming might throw you off, but after that you realize the air is crisp. The language and stdlib are small and relatively old for a reason - the ecosystem fosters this. You can do and build anything without fuss. It’s wonderful.
- betaveros 4y agoThis language isn't an attempt to solve Python's problems. At best it's an attempt to get around some minor speed bumps I personally experience when writing short Python scripts. I did not create this language with the expectation or hope that even a single other person in the world would want to learn it, much less become proficient. Clojure is a great language! It's just that I, personally, need more mental effort to translate thoughts to code using prefix notation and other aspects of Lisp syntax, and decided that reducing that kind of mental effort for myself was a goal of this language.
- culi 4y agoI mean that's probably because it's specifically geared towards exercises like this. Languages built for advent of code will probably prioritize stuffing as much syntactic sugar as possible rather than writing maintainable code Your criticisms are valid, but only if you're approaching it from the perspective of using it for a full-fledged project. More likely use cases are quick scripts you wanna write or little thought experiments you wanna try out. For that, it's likely a great choice of language
- culi 4y agoI just checked the 2nd place[^0] person and they... also have their own programming language...[^1] What's going on here? Are they just extra motivated to show off their languages? Is making your own programming language more common than I realized? EDIT: same with the 4th place person[^2] EDIT2: same with the 7th place[^3]. Btw this is the 4th person that's clickable so actually 3/4 leaders with their GHs linked have their own programming languages EDIT3: jonahx pointed out I made a mistake and the 2nd place person didn't actually create Vyxal, just used (and contributed) to it [^0]: https://adventofcode.com/2022/leaderboard https://adventofcode.com/2022/leaderboard [^1]: https://github.com/Vyxal/Vyxal https://github.com/Vyxal/Vyxal [^2]: https://github.com/leijurv/Kitteh2 https://github.com/leijurv/Kitteh2 [^3]: https://github.com/nim-ka/nim https://github.com/nim-ka/nim
- matusp 4y agoI think it's quite common for competitive programmers and code golfers to have their own language, often inspired by APL. They often do not require any ecosystem as they are supposed to only solve puzzles, so it's really easy to develop them.
- 082349872349872 4y agoBack in the day, I would prototype in python and code in C. Maybe now I should try prototyping in an idiolectal golflang and coding in python?
- satvikpendem 4y agoSame thing as programmers making tools; if you know you have a defined set of inputs and outputs that you need to use over and over, it might make sense to write your own functions, methods, classes, macros and programs. Taking that one step further, it might then morph into a full blown custom programming language. Domain specific languages are after all fairly common in many domains.
- jonahx 4y agoSmall correction: hyper-neutrino is a code-golfer and user of Vyxal, but the creator of Vyxal is: https://github.com/Lyxal https://github.com/Lyxal
- whalesalad 4y agothis is very cool and I’m stoked to follow along but every time something comes along like this I find myself thinking “lisp is the answer” and I guess I’m just that old crusty neckbeard hacker I always feared I would become
- bdr 4y agoIt's worth noting that betaveros won several previous Advents of Code without using Noulith. You can't attribute too much of this year's success to the language. Still, it's pretty cool, and I've really enjoyed reading his solutions. Noulith feels like walking through a syntactic candy store and eating whatever you want.
- cjbprime 4y agoIncluding winning 2021 and 2020! I'd guess that exclusively using a new programming language that you recently invented is actually an impediment to speed, though apparently not a significant enough one.
- porphyra 4y agoHaving the syntactic sugar might make up a little bit for the overhead of using a recently invented language though.
- jackmott42 4y agothe language seems designed for advent of code speed, so it might be a win
- JoachimS 4y agoMore exactly winning 2019, 2020, 2021, and runner up 2018, which seems to be the first year participating. By the looks of it right now, Betaveros will win 2022 too. One could say that Betaveros dominates AoC.
- lynx23 4y agoHehe. I am a fan of powerful languages, and never saw the benefit of Java protecting you from yourself, or the angst from C++ power. But swapping operators and their precedence sounds like the coolest footgun I ever saw! IOW, you can also overdo it... :-)
- habibur 4y agoExcellent language design. I might implement it in C, as soon as I get some time.
- mavu 4y ago> No classes or members or whatever, it's just global functions all the way down. Or up. I can happily report that I now know the equivalent feeling to driving too fast over a speed bump, but for reading.
- _v7gu 4y agoCan the title be un-editorialized? It makes the dev look arrogant for no reason
- qwerty456127 4y ago> Immutable data structures (but not variables) Why not not immutable variables? About 90% of my variables I only assign once, even when writing ordinary imperative (not functional) code. Wehever a variable is re-assigned that usually is a mistake or or something unexpected going on. I find it maddening most of the languages don't have single-assign values like Scala's val (const doesn't count because you can't initialize it with a runtime-computed value).
- unsafecast 4y ago> const doesn't count because you can't initialize it with a runtime-computed value In what language? C's const is an unmodifiable runtime value for example, as is Zig's. Go is one language that I can think of where const is compile-time though.
- winrid 4y agoAlso Nim.
- auxym 4y agoIn Nim, let is an immutable runtime value, but const is an immutable compile time value, sort of like constexpr in recent c++.
- tialaramex 4y agoC and C++ "const" is weird because it's not constant, it's just a weird name for immutable - K&R C doesn't have const, it's an invention of C++ and thus modern C. Bjarne's book calls these immutable variables "constants" which is completely crazy, but I guess indicates that the name is on purpose. This leads to the usual C++ insanity shortly afterwards in the book... > An object that is a constant when accessed through one pointer may be variable when accessed in other ways. Yeah, no. If the object were actually constant you can't do that, your language has betrayed the poor programmer. You can't "access" constants, you can use them to initialize variables, parameters, and so on, but they can't be "accessed" and that's where you've gone wrong here. Rust's Quiz has a example showing what happens with actual constants, and it's not that
- sph 4y agolmao 12k lines of code in lib.rs. Good at coding doesn't mean good at structuring code. Waiting for someone to tell me there ain't anything wrong with 12k lines in a single source file, yet for some reason other utility functions get their own file.
- winrid 4y agoThey most likely don't care... :) Also FWIW most software you use has 5k+ line source files in it.
- duckydude20 4y agoi would really love when ai replaces cp...
- JoachimS 4y agoSeveral really cool things in the language. I'm trying to wrap my head around the concept of precedence order being dynamic. And to come up with a use case when it would be an advantage to change precedence order dynamically. I'm sure people here at HN can come up with some good examples.
- pentaphobe 4y agoDisclaimer: entirely off the cuff Although the creator demonstrates this with `*` and `+` I could imagine this being useful within a set of higher level operators (functions) eg. perhaps you want an argument of (infix) `map` to evaluate before `map` itself Or more generally, you might have a bunch of scalar operators which you'd like to have higher precedence than collection operators which should act on the results
- JoachimS 4y agoYes, but tht sounds like something you decide on once. Not, dynamically and more than once. More like "in this function call given these operands, I want '+' to be evaluated before '/'." Or I'm probably missing something.
- pentaphobe 4y agoImagine you're writing a lot of one off solutions (say, for AOC) you may end up building a small set of helpful functions you compose together Being able to customise how they compose (through precedence) lets you build a kind of DSL for your problem space No idea how often that would be used - but I can imagine hobby scenarios
- pxx 4y agohttps://adventofcode.com/2020/day/18 https://adventofcode.com/2020/day/18
- betaveros 4y agoHi, author here. I'll probably go into this in more detail in a blog post later, but the short reason for runtime precedences (briefly discussed much further down in the README) is that I wanted to be able to write chained comparisons like `x < y < z` without privileging comparison operators in the syntax, so `less_than := <; x less_than y less_than z` also has to work. This means that you can never resolve the structure of a chain of binary operators while parsing, so you have to wait until runtime. The fact that precedence is mutable at runtime is not at all important, but given the above decision, I thought I might as well go the full mile. (Also, it's funny :)
- kibwen 4y agoAmused at "everything is an expression", but also apparently there exist both if-statements and ternary-expressions for some reason. :P
- ZoomZoomZoom 4y agoWait, do you mean the top of the leaderboard is filled with actual persons and not with competitive programming teams trying to dominate the most visible event? If so, why?
- lytedev 4y agoI expect a single individual can move with more agility which is faster for the relatively small-scopes problems AoC prevents.
- pedrosorio 4y ago> competitive programming teams trying to dominate the most visible event What fantasy world is this? :D Competitive programming teams, afaik, exist in the context of universities and they want to win ACM-ICPC, that's pretty much it. Otherwise, competitive programming is largely a solo affair. In an event that yields no prize whatsoever, winning is just for bragging rights. There are no bragging rights in winning as a team against solo competitors. Also, you only have one problem per night and AoC problems are too easy for it to make sense to have a team collaborating. The only thing a team would do is take the minimum solution time of their participants.
- sudosysgen 4y agoAoC is too easy. There's no benefit to more than one person.
- deleted 4y ago[deleted]
- nemo1618 4y agoVery cool. I also made a language specifically for AoC, with some similarities: https://github.com/lukechampine/slouch https://github.com/lukechampine/slouch Example of solving a (non-AoC) problem: https://youtu.be/i_zDbInYOpQ https://youtu.be/i_zDbInYOpQ One of my big takeaways is that the "IDE" plays a big role in how fast you can solve. Recomputing the expression on every keystroke seems a little insane, but the instant feedback you get is priceless.
- ahaferburg 4y agoInsane in the best possible meaning of the word. Man, that is so cool. In my opinion AOC is a very good example for "if all you have is a hammer". For AOC you don't need to write a program that finds a solution for any possible input, you need a calculator to compute the solution for your input. This is such a calculator, and a very nice one. Suggestion: Flip the assignment operator. You keep writing an expression left to right, but then you have to scroll all the way back to the left to make a variable. This could be streamlined by making it e. g. "EXPR -> VAR_NAME" instead of "*VAR_NAME EXPR". Why don't you make a Show HN submission? I'd upvote you. :)
- specialist 4y agoNeat. Lots of good stuff. What's the interplay between infix notation and operator precedence? Expressions are not infix? Also, please explain the dictionary and set duality. FWIW, in my toy language, I use one syntax for sets, lists, and arrays, delimited with brackets '[' and ']'. Whereas maps, dicts, and (prototypical) objects use curlys '{' and '}'. A la JavaScript et al. Lastly, wrt using '++' for concatenating lists, there have been times I've wanted sugar for prepending to a list. So maybe support both 'atom ++ list' and 'list ++ atom'? For future updates, please us posted.
- betaveros 4y agoI'm the author but not the OP. Thanks! I'm not sure I follow the question about infix notation and precedence, but: Trains of identifiers like `a b c d e f g` are always parsed as `b`, `d`, `f` being infix binary operators; their precedences are looked up at runtime to decide how that expression evaluates. Explicit function calls and indexing always bind more tightly, and operands in those trains can contain either; an expression like `a(arg) b c(arg1, arg2) d e[i] f g[j:k]` has the same binary operators as before. But operators are only single identifiers and don't contain function calls, so `a b (c)` is still the binary operator `b` with arguments `a` and `(c)`. "Sets" are just dictionaries with set elements as the keys and null as every value. This makes sense because you want testing for set membership to be fast like locating a key in a dictionary and because, like in Python, iterating over a dictionary iterates over its keys. We also already have `.+` for prepending a list element to a list and `+.` for appending. (These are the analogues of Scala's `+:` and `:+`.)
- pklausler 4y agoI honestly can't imagine a better tool for AoC problems than stock Haskell. I'm at only 245 lines of code total after day 14 this year; 2021 required 594 altogether. List comprehensions, pattern matching, a rich standard library, and strong typing with inference make solving these little problems with GHC almost feel like cheating.