HackerTrans
TopNewTrendsCommentsPastAskShowJobs

justinpombrio

4,643 karmajoined 15 yıl önce
"zall" + "ambo" + "@gmail.com"

comments

justinpombrio
·evvelsi gün·discuss
There's no such thing as an undecidable statement. A single statement can't be undecidable. Undecidability is a property of a class of statements.

For example, you can ask whether a Java program, run with infinite memory, will eventually halt. For any particular Java program, there's obviously an algorithm that says whether it halts or not. The algorithm is a single statement, which says either "yes" or "no". Might be hard to figure out which is the correct algorithm, but the Java program is fixed so the algorithm is definitely one of the two.

However, there is no algorithm which can take an arbitrary Java program as input and determine whether it will halt. It's about the class of all possible programs.
justinpombrio
·4 gün önce·discuss
> That's average or mean. Median is the middle value.

The median of an even number of values is typically defined to be the mean of the two middle-most values.
justinpombrio
·2 ay önce·discuss
> it might be a week before i get back to it, and the name of the branch is a clue as to what the heck I was doing.

Ah, this is what the description (what git would call the commit message) is for. You can set the description even before you've made any changes.
justinpombrio
·2 ay önce·discuss
Parsing is usually implemented in two steps: first there's lexing where the input is turned into a sequence of tokens, then there's proper parsing where the sequence of tokens is turned into an abstract syntax tree. This shunting yard algorithm is part of parsing. Lexing happens before that.

For example, this input:

    13- 2  *5 + 4
would be lexed into this sequence of tokens:

    "13" "-" "2" "*" "5" "+" "4"
You could use the shunting yard algorithm to put these in a convenient postfix order:

    "13" "2" "5" "*" "-" "4" "+"
It's really easy to then turn it into an abstract syntax tree (AST). Go through each token in order: if it's a number you make it into a node and push it onto a stack; if it's a binary operator you pop two nodes off the stack and make a node out of those and the binary operator. If you write down this AST as an s-expression you get:

    (+ (- 13 (* 2 5)) 4)
justinpombrio
·2 ay önce·discuss
Yeah, it's a parsing algorithm for parsing infix (etc.) expressions. If you've seen a parsing library refer to "precedence climbing" or "operator precedence parsing", it's doing this (or something very similar).

If you want to enter the number `13`, that should be one token, but there's no way to make a `13` token in this UI. You need to stick to single digits for this site to work correctly.
justinpombrio
·2 ay önce·discuss
It treated that as

    1 0 0 + 8 8 / 4
which is nonsensical, but it has no error detection so it rolled with it. Really `100` should be its own token, but there's no way to input that.
justinpombrio
·3 ay önce·discuss
Honestly I've had more technical problems installing Windows than Linux Mint recently, not to mention the multiple hours spent hunting down and disabling all of the telemetry and ads in Windows. Still can't believe they put ads in File Explorer.
justinpombrio
·4 ay önce·discuss
This is a terrible source of information: it's talking about a survey about vision problems, by an eye care company, and you can't see the survey.

I'm completely sure that the way they worded the question the headline is about was very generously worded and that the phrasing in the headline misrepresents what it asked, because that's how these things work. Not that anyone is at fault, of course, the headline isn't a lie, and of course there are other reasons that the survey is hidden behind a subscription wall. It just so happens that the percent of people with screen-related visual discomfort according to the eye-care company survey is, I dunno, 2x higher than it would be if you asked the question directly. That's just how these things work.

(I suspect that someone is going to confuse this comment as me saying that eye-strain from screens isn't a problem for a lot of people. Pre-empting that by agreeing that, yes, of course eye-strain from screen is a problem for a lot of people.)
justinpombrio
·9 ay önce·discuss
Could you name one that seems likely to fail?
justinpombrio
·10 ay önce·discuss
I was going to say that that's not a CRDT because it requires a centralized server (the conflict resolution is "order in which the server received the messages", and clients aren't allowed to share updates with each other, they can only get updates from the server). But now I'm looking at definitions of CRDTs and it's not clear to me whether this is supposed to count or not.

Still, every algorithm that's actually labeled a CRDT shares a magical property: if my replica has some changes, and your replica has some changes, our replicas can share their changes with each other and each converge closer to the final state of the document, even if other people have been editing at the same time, and different subsets of their changes have been shared with you or I. That is, you can apply peoples' changes in any order and still get the same result. I don't think it's useful to call anything without that property a CRDT.
justinpombrio
·10 ay önce·discuss
Rust's traits _do_ solve the expression problem.

Each data type is a `struct`. Each operation is a trait. You `impl` each trait on each struct.

This works even if you're using a library that has declared `struct A` and `struct B` and `trait F` and `trait G`, and you want to add both a `struct C` and a `trait H`, and fill out the whole 3x3 grid without modifying the library.

The library says:

    struct A { ... }
    struct B { ... }

    trait F { ... }
    impl F for A { ... }
    impl F for B { ... }

    trait G { ... }
    impl G for A { ... }
    impl G for B { ... }

    fn some_function<T: F + G>(data: T) { ... }
Your code says:

    use library::{A, B, F, G};

    struct C { ... }
    impl F for C { ... }
    impl G for C { ... }

    trait H { ... }
    impl H for A { ... }
    impl H for B { ... }
    impl H for C { ... }

    fn another_function<T: F + G + H>(data: T);
Now `library::some_function()` can be called with an A, B, or C, even though C was defined by the user of the library. And `another_function()` can be called with A, B, or C, even though A was defined by the library.
justinpombrio
·2 yıl önce·discuss
You can do that in a couple different ways in Typst. First, if the user passes content into the template, then it's the user's content that ultimately gets to choose its styling. That is, there are three places that a style can be set:

1. In the content passed that the user passes to the template

2. In the template itself

3. By the user, outside the template

They take priority in that order.

OTOH, if the template really wants control, it can take optional styling arguments with defaults, and do as it likes with them. And if it wants content from the user that the user doesn't get to style, it can take that content as a string.

It's a fantastic system, so far as I've seen.
justinpombrio
·2 yıl önce·discuss
I imagine you're projecting how LaTeX works onto Typst, though despite years of use and a PhD in PL I never really figured out how LaTeX works so I'm not certain.

I don't think Typst has a lot of global state to get corrupted. Like, if one package defines a variable `foo` and another package defines a variable `foo`, and you use both of them (and don't try to import `foo` from both), it's not like those `foo`s are going to conflict with each other. Is that the sort of issue that LaTeX packages run into?

Likewise, you don't modify typesetting in Typst by modifying global state like you do in Latex. You use `set` and `show`, which are locally scoped. You never need to, like, set the font size, then write some stuff, then remember to set it back. You just put `set font(size)` around precisely the stuff you want to be bigger.
justinpombrio
·9 yıl önce·discuss
> Ironically, our conservative friends and family have never said a word about whether she works or tends home; they're very laissez-faire about the matter.

The fair comparison would be to see how they reacted if your roles were reversed: if she worked and you made her lunch.
justinpombrio
·10 yıl önce·discuss
That sounds like a feature. HN doesn't have features, only necessities.