Hacker Newsnew | past | comments | ask | show | jobs | submit | ghewgill's commentslogin

I've done AoC on what I call "hard mode", where I do the solutions in a language I designed and implemented myself. It's not because the language is particularly suited to AoC in any particular way, but it gives me confidence that my language can be used to solve real problems.

Neon Language: https://neon-lang.dev/ Some previous AoC solutions: https://github.com/ghewgill/adventofcode


The walrus operator allows you to use `elif` there to avoid cascading indentation.

    if m := re.match(pattern1, line):
        do_stuff(m.group(1))
    elif m := re.match(pattern2, line):
        do_other_stuff(m.group(2))
    elif m := re.match(pattern3, line):
        do_things(m.groups())
    else:
        ...


...and for me, the benefit is that this is much more clear to me when reading the code. An increasing level of indentation directly maps to needing to keep more in my head. (Sure, in this case you can pattern match and see that there's nothing else, but in general you need to watch out for cases where the else may be doing more than just the next check on the same inputs. )

But the walrus is good even in the absence of a series of matches. It is quite common to need to know more than the boolean "did this match or not?", and so to my eye it is much cleaner to have one line doing the test and the next lines using the results. I don't care about saving characters or even lines. `m = ...match...` immediately followed by `if m:` feels like overhead for the sake of the programming language's limitations; it's extraneous to what I want to express.

Also, I assert that the pattern is better for correctness. It's like Rust's `if let Some(foo) = f() { ... }` pattern: guard on a certain condition, then use the results if that condition is true.

    v = f()
    if v:
        ...use v...
invites injecting code in between the assignment and the test. They're two different things to the reader. And it's not as clear that `v` should only be used in the consequent body.

    if v := f():
        ...use v...
says exactly what it means: `f()` may return a truthy value. If it does, do something with it.


Ah, I missed that. Thanks


Raymond Chen happens to have worked for Microsoft for a long time, but he is an institution unto himself.


If text files are your world, then http://todotxt.org/ might be for you. I'm currently using "pter".


The colons there don't represent C++. That's just a way of referring to a windows API function that exists in a specific DLL (in this case "user32"). Because the functions used here do not exist in older versions of Windows, the linked code dynamically loads user32.dll and tries to get the address of those functions so they can be called. That's why you need to know which Windows DLL they exist in.


I think the hard limit of 100 todos is the best feature of this. Why don't other todo apps have this feature?


I think 127 would make more sense.


Some of us have a lot to do!


SLMR and OLX were by the same author, but OLX was a complete rewrite and didn't look anything like SLMR.


OLX (and SLMR) author here. It gives me warm fuzzies to hear about your positive experiences with OLX, after all these years. To this day I maintain that Turbo Vision was peak computer UI, it's been downhill since. :)


Thank you for your work on OLX.

I miss Turbo Vision. It was way better than many of the TUIs of the day, not only on DOS but also UNIX.


You're thinking of the Thawte Web of Trust: https://en.wikipedia.org/wiki/Thawte which was run by Mark Shuttleworth (now of Canonical). The certificates were used for email, not for SSL. I lost track of what happened to it after CACert took over.


Yes, exactly! Thank you!


Increase the iterations on the sidebar. You will then see more detail until you zoom in even further.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: