Recent submissions

Comment · 5 years ago
You can generalize this with TS's fancy mapped types:

    type Sum<K> = <T> (cases: Pattern<K, T>) => T
    type Pattern<K, T> = {
      [V in keyof K]: K[V] extends any[] ? (...args: K[V]) => T : never
    }
which takes TS very close to ML:

    type Shape = Sum<{
      circle: [number, number, number],
      rectangle: [number, number, number, number]
    }>

    function Circle(x: number, y: number, r: number): Shape {
      return ({ circle }) => circle(x, y, r);
    }

    function Rectangle(x: number, y: number, w: number, h: number): Shape {
      return ({ rectangle }) => rectangle(x, y, w, h);
    }

    function area(shape: Shape): number {
      return shape({
        circle: (x, y, r) => Math.PI * r * r,
        rectangle: (x, y, w, h) => w * h
      });
    }
Comment · 9 years ago
Faster startup, mouse works as you'd expect in a regular desktop app. Switch panes, tabs, open new tab, scroll panes, resize panes, select ranges, all in the terminal. I know not using the mouse is one of the reasons why one would choose vim, but the mouse really is faster/more intuitive in some situations.
Comment · 11 years ago
For this reason, I think of objects as not equivalent to closures, but rather ML-style functors. I think implementing objects as records with closures as fields is really just a poor man's parameterized module.
Comment · 11 years ago
It's a view generation library, not a DOM-diffing library. That's like asking how to rotate a subtree in an RB tree library.
Comment · 14 years ago
Is this guy really a former Google employee? Those posts sound like they were written by an elementary school kid.
Comment · 14 years ago
This is so cool. I only wish the screen were a little bigger and could show all the colors.
Comment · 14 years ago
Looking forward to this. Registration doesn't seem to work yet.

Please add 'monospace' to the font-family declaration. The site looks terrible in Ubuntu.

Comment · 15 years ago
Here's how to make shift-pgup/pgdn work in screen:

    echo "termcapinfo xterm ti@:te@" >> ~/.screenrc

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton