Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
harpocrates
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
12 ms
·
61.
▲
by
harpocrates
10y ago
Given the number of comments about the inefficiency of finger trees: yes they usually have a high constant factor (for their otherwise reasonable asymptotic complexity) due to cache misses. However, they are immutable and persistent, which
62.
▲
by
harpocrates
10y ago
This is a fun data structure to implement in Haskell, and I've always been curious about how one would do it in C++, largely due to the fact that data FingerTree a = Empty | Single a |
63.
▲
by
harpocrates
10y ago
Although I recommend stack heartily, note that haskell-lang is hosted by FP complete, and IIRC they either fully developed or had a big part of developing stack. Just FYI.
64.
▲
by
harpocrates
10y ago
You bring up good points! As a beginner, you are uniquely poised to observe these things, so thanks for sharing! I think a big part of the install problem is that some of the options (stack, platform) are fairly recent. I recently got a new
65.
▲
by
harpocrates
10y ago
Actually, a lot has been done and a lot is coming in the near future. GHC 8.0 brought us `DuplicateRecordFields`, so that we can finally use the same field name for two records. There is active work done by Adam Gundry to extend this even f
66.
▲
by
harpocrates
10y ago
Note that to _use_ an already written Haskell module, I don't need to know what extensions it uses. I don't even need to use the same ones. Haskell's LANGUAGE pragma is analogous to Rust having a bunch of experimental feature
67.
▲
by
harpocrates
10y ago
I wrote a pretty concise version of it a while ago to convince myself it was possible [1]. It isn't as short as the naive (incorrect) quicksort using lists, but every line has a very clear purpose. Most implementations on Rosetta code
68.
▲
by
harpocrates
10y ago
This works in Haskell just fine, thank you very much! ghci> y f = f (y f) ghci> factorial = y (\f x -> if x == 0 then 1 else x * f (x-1)) ghci> factorial 5 120 However, the Y combinator as defined in a non-r
69.
▲
by
harpocrates
10y ago
For the interested: take `B` to be the matrix minimizing `(Y - XB)'(Y - XB)` (the least squares aka the "best fit"), then `B = (X'X)^-1 X'Y`. Proof: Since `B` is a minimum, the derivative of the expression minimized
70.
▲
by
harpocrates
10y ago
Your link is slightly misleading - it shows ways of approximating solutions to the equation. The equation itself is a partial differential equation [1]. dV/dt + 1/2*sigma²*S²*d²V/dS² + r*S*dV/dS - r*V = 0 [1] h
71.
▲
by
harpocrates
10y ago
A math professor of mine once said of this (paraphrased): yes it is cool, but really it is just a trivial consequence of how we defined our extension of the real exponential map to complex numbers. The really cool part, is that this extensi
72.
▲
by
harpocrates
10y ago
Useful way to see how different compilers interpret the C standard. Just code up a minimal example and see what assembly they produce.
73.
▲
by
harpocrates
10y ago
It would be an interesting project to take in some (small) source program, and try all sorts of algebraic rearrangements (maybe just associativity and commutativity of addition and multiplication) to see if there is any noticeable performan
74.
▲
by
harpocrates
10y ago
For anyone too lazy: https://godbolt.org/g/jvSKCD I would be much more impressed if I hadn't taken a compilers course. I reckon (god alone knows exactly what GCC does) this is just linear induction variable substi
75.
▲
by
harpocrates
10y ago
I think the point of PureScript was to have a Haskell that would compile to JS, but which (unlike GHCJS) would have breaking changes to integrate better with JS features. Trying to look like JavaScript might be a bit hard then... That said,
76.
▲
by
harpocrates
10y ago
While I think UBI would perhaps be a good solution to unemployment that increased automation is going to cause, I fear we will end up with a situation like in Kurt Vonnegut's Piano Player[0]: those who aren't working will have muc
77.
▲
by
harpocrates
10y ago
Point taken, but this is more a reflection of the fact _GHC_ is used as a playground for every new PL idea. Haskell itself has no extensions, and you certainly don't need any extension to get what I was talking about above.
78.
▲
by
harpocrates
10y ago
To be fair, the fact that JavaScript needs a custom syntax (requiring preprocessing) for a problem this specific is upsetting. By contrast, the Haskell solution has just uses the IO monad - effectful-computations returning something of type
79.
▲
by
harpocrates
10y ago
Another thing to keep in mind is that with everything being immutable you end up with a pure language. Once that happens, the compiler starts being able to perform some really nice rewrites of your code really easily. The problem is that th
80.
▲
by
harpocrates
10y ago
Alright. Point by point (although I'm considering both the beginner and "advanced" arguments for each point simultaneously): > You Should Be Able to Run 2 and 3 That makes no sense. The whole point of versions is that they
81.
▲
by
harpocrates
10y ago
Is this actually a joke? I'm still kind of reeling. The typos, the technical inaccuracies, the logical fallacies, all bundled together... Is it trying to satirize something? If not, what is the blog post trying to do?
82.
▲
by
harpocrates
10y ago
So much for "There's Only One Way To Do It". :)
83.
▲
by
harpocrates
10y ago
> so they would not allocate an intermediate list Not quite. Lazy sequences make it so that thinking about fusion/deforestation makes sense. This is an optimization the compiler can make. Naively, you still end up with as many alloc
84.
▲
by
harpocrates
10y ago
For me, I think the answer to this is really that Haskell is pure and immutable. Equational reasoning[1] is immensely useful when debugging. It isn't unusual to debug pieces of Java code that look like this. MyClass c = new MyCla
85.
▲
by
harpocrates
10y ago
Cannot agree more. I think the usual example of quicksort also falls under this category. [1]: http://stackoverflow.com/questions/7717691/why-is-the-minima...
86.
▲
by
harpocrates
10y ago
If you are using GHC, the newest version (8.0.1) actually supports duplicate record fields with the [DuplicateRecordFields]( https://downloads.haskell.org/~ghc/latest/docs/html/users_gu... ) extension. Che
87.
▲
by
harpocrates
10y ago
While I see how this at first appears to be a problem (when I started with Haskell I sure thought of it as one), it turns out that language-pragma filled code can be mixed with vanilla code too without problem. The pragmas usually just expo