Recent submissions

Comment · 1 day ago
Comment · 2 days ago
Comment · 1 year ago
What I missed most were let bindings (https://ocaml.org/manual/5.3/bindingops.html)

ReasonML has custom operators that allows for manipulating monads somewhat sanely (>>= operators and whatnot). rescript (reasonml’s “fork”) did not last time I checked. But it does have an async/await syntax which helps a lot with async code. reasonml did not last time I checked, so you had to use raw promises.

I believe Melange (which the article briefly talks about) supports let bindings with the reason syntax.

And this kinda changes everything if you React. Because you can now have sane JSX with let bindings. Which you could not until melange. Indeed, you can PPX your way out of it in ocaml syntax, but I’m not sure the syntax highlight works well in code editors. It did not on mine anyway last time I checked.

So for frontend coding, Melange’s reason ml is great as you have both, and let bindings can approximate quite well async syntax on top of writing readable monadic code.

For backend code, as a pythonista, I hate curlies. and I do like parenthesis-less function calls and definitions a lot. But I still have a lot of trouble, as a beginner ocamler, with non-variable function argument as I need to do “weird” parenthesis stuff.

Hope this “helps”!

Comment · 2 years ago
Looks very interesting, thanks for sharing! The pricing section is very informative btw, congrats to the author for sharing it
Comment · 3 years ago
No way! I didn't know that was part of the standard! Very useful "trick" indeed, unless of course, the USB port is placed vertically...
Comment · 3 years ago
AMD support would be amazing <3

I get the boot concern, and the maintenance concern (!!!), but as you say, these models are already quite huge anyway :)

Comment · 3 years ago
Comment · 3 years ago
Is that not what you’d do? That sounds like an unusually useful review tbh.
Comment · 3 years ago
If you liked war and peace, you should check out grossman’s life and fate, it’s WWII’s version, fantastic. And blacklisted by the soviet government because critical of it.
Comment · 3 years ago
That's true, and I was impressed first time someone showed me that. But the cost of this luxury might not be worth it. Indeed, you mostly (only ?) communicate through an API. And if it's properly documented, which is now essentially automatic, you can easily generate your types from the frontend. To me, the cost of bringing JS to the backend dominates this luxury to the point where it's just not worth it. I'll just generate my types from the frontend and be done with it.
Comment · 3 years ago
Yeah, there are some weird stuff in typescript, for instance, this typechecks

    class Animal {}

    class Dog extends Animal {
        woof() {}
    }

    class Cat extends Animal {
        meow() {}
    }

    let append_animals = (animals: Animal[], animal: Animal) => animals.push(animal)

    let dogs = [new Dog()]
    append_animals(dogs, new Cat())

    dogs.map(dog => dog.woof())

Which if you evaluate, you'll obviously get:

    Uncaught TypeError: dog.woof is not a function
Whereas Mypy won't typecheck the equivalent Python code:

    class Animal:
        pass

    class Dog(Animal):
        pass


    def append_animals(animals: List[Animal], animal: Animal) -> None:
        animals.append(animal)


    dogs = [Dog()]
    append_animals(dogs, Dog())

It'll throw with:

    $ mypy types.py 
    types.py:16: error: Argument 1 to "append_animals" has incompatible type "List[Dog]"; expected "List[Animal]"
    types.py:16: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
    types.py:16: note: Consider using "Sequence" instead, which is covariant
Comment · 3 years ago
It looks like the randomness is generated at shuffle time and then maintained. You can check by hitting « fan » and then « flip » multiple times. It always returns the same card order between shuffles which seems to imply that it’s maintained.
Comment · 3 years ago
A great tool is, believe it or not, Ocaml/Rescript!!

I was tired not remembering how to name intervals, construct chords, my arpeggios and scales and what not. So I coded it to help me figure all of that out. I also wanted a frontend to visualize all of this because notes on the guitar are all mixed up and it's hard to reason about when you have a terrible memory like I do:

- Theory.res: https://github.com/tbinetruy/solfeggio-calculator/blob/maste... - Frontend: https://tbinetruy.github.io/solfeggio-calculator/

I also have some notes on that repo that have helped me a lot where I can summarize my findings. But this exercise has been enlightening. Both from the coding and musical perspectives. Because Ocaml really forces you to model music and thus ensure that you understand the concepts which helps you remember them.

I can finally start soloing over chord progressions using arpeggios now! It's essentially comes down to playing a scale in thirds starting on the chord root note on chord changes! And I can finally understand my fretboard without having to look at my frontend's chord diagrams anymore. I still don't know the notes, but I understand their relations with each other.

I've also started learning jazz because it's a lot more theory based than pop/rock since you have a lot more exotic chords and solos are guided by the underlying progression. I really like Jens Larsen's YT channel. It's very hard to get into at first because he goes quite fast, but has some very accessible videos such as this one: https://www.youtube.com/watch?v=7q2LB45ts0M.

Hope this helps :)

Comment · 3 years ago

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton