Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
trealira
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
24 ms
·
331.
▲
by
trealira
2y ago
Looking back but can't edit. The first line should say ((a | b | c) -> T) -> T This is just a mistake I made paraphrasing link 1.
332.
▲
by
trealira
2y ago
That does seem handy for string manipulation.
333.
▲
by
trealira
2y ago
I also just learned about it. I found this explanation of what it is: https://drup.github.io/2016/08/02/difflists/ It's a slightly confusing name, though; it makes me think of a difference list, whi
334.
▲
by
trealira
2y ago
This paper talks about how rotation of pointers can result in simpler (and potentially less error-prone) programs than sequential assignment when implementing algorithms that mutate linked structures; they go on to talk about some propertie
335.
▲
Analysis of pointer "rotation" (1982) [pdf]
(dl.acm.org)
1 points
by
trealira
2y ago
|
4 comments
336.
▲
by
trealira
2y ago
This reminds me of this article: "The visitor pattern is essentially the same thing as Church Encoding" [0], although I think this comment [1] and this one [2] on HN explain it better. The article is written in Haskell, but it
337.
▲
by
trealira
2y ago
I wasn't trying to single them out; I was saying that lambda calculus has only lambda terms and applications, whereas Lisp always natively supported mutable linked lists from the beginning. Coming back to that argument after a day, tho
338.
▲
by
trealira
2y ago
Thanks for sharing; I hadn't known that there were studies that show that the microbiome affects weight gain in the body. > We all know that one person who can eat literally anything and is still fit and that one person who sees an
339.
▲
by
trealira
2y ago
It's not structured like C code would be, but some parts of the code itself read like older C++ with labeled break/continue, e.g. this function: https://github.com/jamespfennell/new-typesetting-system/blo
340.
▲
by
trealira
2y ago
I agree. Some people don't realize how many calories some of the things they regularly consume have, though, and I think that's why many have trouble losing weight, which is why it's important to track your calorie consumptio
341.
▲
by
trealira
2y ago
> Clauses within clauses are not "recursive", no more than "let x = 1 in (let y = 2 in (let z = 3 in x + y + z)" represents recursion in some hypothetical programming language. But that is an example of a recursive co
342.
▲
by
trealira
2y ago
I don't understand the chess/poker metaphor; could you elaborate on that, please?
343.
▲
by
trealira
2y ago
Who are you talking to? IBM?
344.
▲
by
trealira
2y ago
It's funny that you call that the standard algorithm, because, although it intuitively makes sense, this is the first time I've seen that word-counting algorithm. The first implementation of wc I ever saw was the one from The C P
345.
▲
by
trealira
2y ago
It's also being helped by the fact that the right wing has a history of attempting to restrict votes, from mass purging of voter rolls without telling people, to closing voting sites such that voting in-person requires traveling farthe
346.
▲
by
trealira
2y ago
Dupe: https://news.ycombinator.com/item?id=40737511
347.
▲
by
trealira
2y ago
To be honest, I can't understand most of this, but it makes me want to learn more math, as someone who's still an undergraduate in the US. Previously, I had only heard of terms like functors and free algebras in the context of pro
348.
▲
In Defense of "Beautiful Code" (2010)
(vanemden.wordpress.com)
2 points
by
trealira
2y ago
|
1 comments
349.
▲
by
trealira
2y ago
I mainly found this article interesting for the author's explanation of two different algorithms to rotate an array by n elements, and the walkthrough of their derivations.
350.
▲
by
trealira
2y ago
There's another version from Unix V10: http://tuhs.org/cgi-bin/utree.pl?file=V10/cmd/wc.c Also, from V8: https://www.tuhs.org/cgi-bin/utree.pl?file=V8/usr/src/cmd/
351.
▲
by
trealira
2y ago
Something funny is that GCC may compile your code that uses pointer arithmetic into one that uses an index register, and compile your code that uses an index into an array as pointer arithmetic. https://godbolt.org/z/9K
352.
▲
by
trealira
2y ago
A finite state machine has a set of input symbols, a set of states, and a transition function, which maps the current state and current input to the next state (and, when programming it, it doesn't have to be a literal function; for ex
353.
▲
by
trealira
2y ago
I see, thanks for contextualizing it for me; I hadn't known about the ecosystems NLnet is involved in.
354.
▲
by
trealira
2y ago
According to the article: thanks to a grant from the NLnet foundation under the NGI Zero Core program, Pre-Scheme can continue to be developed. It's supposed to be a C alternative. Currently, it compiles to C, has a Hindley Milner type
355.
▲
by
trealira
2y ago
I'm not who you replied to, however: - The original Lisp was based on mutable singly linked lists. Lambda calculus has no lists, except for Church-encoded ones (just like lambda calculus only has Church encoded booleans and numbers). I
356.
▲
by
trealira
2y ago
> If I replace ‘(a b c) in my example with (list ‘a ‘b ‘c) I got the same results. Yeah, your core point was right, just thought to let you know about that bit of undefined behavior.
357.
▲
by
trealira
2y ago
It's just a name shadowing. Copying the code they wrote: for i in xrange(3): def func(x, i=i): # the *value* of i is copied in func() environment return x * i flist.append(func) That could also be written &
358.
▲
by
trealira
2y ago
> Algol was designed based on observational data of how programmers, who had to somehow turn their ideas into the assembler to run on machines, would write out those ideas. Before it was code, it was pseudocode, and the origins predate e
359.
▲
by
trealira
2y ago
Just so you know, modifying quoted lists in Lisp is not dissimilar to setting string literals in C: it's undefined behavior, i.e., it's not guaranteed to work, or be portable if it does work, and it may or may not make your progra
360.
▲
by
trealira
2y ago
There are some examples taken from the Lisp 1.5 manual on Wikipedia: https://en.wikipedia.org/wiki/M-expression
More ›