Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
trealira
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
16 ms
·
151.
▲
by
trealira
2y ago
> And to be very clear, I'm genuinely curious and looking to learn so if I'm asking too much from your personal time, or your own understanding, or the answer is "that's a task that FP just isn't well suited for&
152.
▲
by
trealira
2y ago
For debugging purposes, there's Debug.Trace, which does IO and subverts the type system to do so. But with Haskell, I tend to do less debugging anyway, and more time getting the types right to with; when there's a function that do
153.
▲
by
trealira
2y ago
Yes, it does imply that, except since Haskell is lazy, you'll be holding onto a thunk until the IO function is evaluated, so you won't have a list of 10 million messages in memory up until you're printing, and even then, list
154.
▲
by
trealira
2y ago
So, do you mean like you have some big array, and you want to do something like this? (Below is not a real programming language.) for i in 0 to arr.len() { new_val = f(arr[i]); log("Changing {arr[i]} to {new_val}.\n&quo
155.
▲
by
trealira
2y ago
No, it doesn't, because in a switch with a loop, at the end of each case (after the break), the instructions have an unconditional jump to the top of the switch again, where it performs the indirect jump. With the code using computed g
156.
▲
by
trealira
2y ago
It's used in VMs, emulators, and other interpreters for making a dispatch loop with less branching than a standard loop with a switch inside it. https://eli.thegreenplace.net/2012/07/12/computed-goto-for-
157.
▲
by
trealira
2y ago
Not a lawyer, but I don't think art styles are copyrightable, though maybe they could be in Japan.
158.
▲
by
trealira
2y ago
Promotes antisemites on Twitter, says Jews have been stoking anti-white racism and deserve no sympathy, did multiple Nazi salutes, and then went to Germany to support the AfD and say they need to stop feeling guilty for their Nazi past. Yea
159.
▲
by
trealira
2y ago
No, but they can't say that. You cannot trust them to choose rule of law over each other. They hate liberals that much.
160.
▲
by
trealira
2y ago
You literally cannot reason with such people. They will pretend to be mad about lies as their people lie more. They'll pretend to be mad about laws procedure as they break laws and procedure. They'll pretend to be mad about inflat
161.
▲
by
trealira
2y ago
And Kamala Harris was labeled far-left for campaigning on a Trump-lite platform on immigration and the economy that appealed to no one.
162.
▲
by
trealira
2y ago
Funny, because I remember he was a far-left muslim communist from Africa back then by Republican standards.
163.
▲
by
trealira
2y ago
Yep, you're right. When I was a kid during the Obama years, I was even proud of our country. Now I realize that it and the conservatives in it are basically no different to Putin and his followers in Russia, and the liberal opposition
164.
▲
by
trealira
2y ago
At my university, when they taught us C++ (and later C), they told everyone to log into this central server running Linux. They taught everyone to use Emacs and write Makefiles, and then we were supposed to be able to do all our assignments
165.
▲
by
trealira
2y ago
>> America was never a "high trust culture". > Absolutely not true. It was much much higher trust when I first moved here in 1986 I don't believe it, especially given that you're saying this is due to immigratio
166.
▲
by
trealira
2y ago
> Pointers are literally 64bit ints... And converting them to an index is extremely quick if you want to store an offset instead when serialising. I'm not them, but they're saying pointer based structures are just less trivial
167.
▲
by
trealira
2y ago
From the Haskell snippet, f is just "map read" specialized for lists of Integers, so inlining it would read like this : let list = map read (words contents) The equivalent Python is basically this: list = [int(word) for
168.
▲
by
trealira
2y ago
Why are seed oils unhealthy, though? I can't find anything that's bad about them in particular. I've only seen people commenting online saying to avoid them.
169.
▲
by
trealira
2y ago
I remember reading some rant about how Unix sucks because of the shell's filename expansion, because programs can't tell whether you wrote a star or actually just all the files in the directory. If programs could tell the differen
170.
▲
by
trealira
2y ago
It's not a C89 requirement. C89 requires variables to be declared at the top of a block, not a function. So, you could write things like this: while (...) { int a = 1, b = 2, c = 3; printf("%d\n", a + c - b);
171.
▲
by
trealira
2y ago
Reference counting very much incurs a runtime cost; it's not just a compile time abstraction, like borrow-checking in Rust.
172.
▲
by
trealira
2y ago
I graduated in 2021, and my experience corroborates yours. I took that same sequence of math courses, up to calculus 2. If I had been on the more advanced path for math, there was exactly one more class; I don't remember what it was, b
173.
▲
by
trealira
2y ago
That seems like a convenient way to not change anything. I guarantee most people would still complain heavily if the price of meat went up because something like a carbon tax were applied to it, even though the effect would be to reduce the
174.
▲
by
trealira
2y ago
> But I remember an example with some other tricky C expression/type declarator where the number of actual dereferences differed from the amount of asterisks in the code. Was it this code? void f(int *a) { void *p = &a
175.
▲
by
trealira
2y ago
Yeah, there should be more types of bananas. There are already many different kinds of apples, e.g., Granny Smith, Honeycrisp, Golden Delicious, Fuji, etc.; I don't see why only one type of banana has to be sold at a time.
176.
▲
by
trealira
2y ago
Same, except I mostly got cats and some stuff about video games and book quotes. There was another thread here the other day where someone was complaining that the first things they saw were furry drawings. It seems like there's a vari
177.
▲
by
trealira
2y ago
I hadn't realized that SICP covered using lazy streams for calculating pi. That reminds me of this article I read recently about using lazy lists in Haskell to calculate pi by means of a few different algorithms. https://www
178.
▲
by
trealira
2y ago
In this case, the C declaration doesn't match the other two. The variable x is a function that returns a pointer to an array of 5 pointers to functions returning char. Indeed, that's what cdecl.org says: declare x as function
179.
▲
by
trealira
2y ago
Rob Pike once talked about dealing with this: https://go.dev/blog/errors-are-values
180.
▲
by
trealira
2y ago
People who write C nowadays generally try to write it in the most "boring" and easy-to-read way possible, I think. But C can also be hard to understand if it uses a lot of side-effectful expressions and pointer arithmetic. Just lo
More ›