Wow; that certainly is impressive.
Is it just me, or does that look similar to the Fast Fourier Transform (FFT) [1] speedup (against the regular Fourier Transform implementation)?
> I prefer the cleaner Haskell syntax.
"Haskell syntax" is a pretty bad design in my experience. Firstly, it isn't just one thing: there's Haskell 98 and Haskell 2010, but most "Haskell" code uses alternative syntax from GHC extensions (lambda case, GADTs, type applications, view patterns, tuple sections, etc.). (Frustratingly, those extensions are often applied implicitly, via a separate .cabal file, which makes parsing even harder; plus lots of "Haskell code" is actually written as input for a pre-processor, in which case all bets are off!)
GHC alone includes two separate representations of Haskell's syntax (one used by the compiler, one used by TemplateHaskell). Other projects tend to avoid both of them, in favour of packages like haskell-src-exts.
I've worked on projects which manipulate Haskell code, and getting it to parse was by far the hardest step; once I'd managed to dump it to an s-expression representation the rest was easy!
My God, this is written so matter-of-factly that it hurts.
To me, Lisp is awesome BECAUSE of its uniform syntax!
To me, Lisp is waaaaaay cleaner and always unambiguous!
I guess what I'm saying is that it's subjective.
I’m not sure what the reasoning was here. I hope the author or others can shed some light.
Idris2, I can't comment much. All I know is that I envy its unification algorithm and synthesis features. Its syntax is more haskellish, if you like that. It seems less mature in some aspects, though. Very promising language overall.
For me, these projects (such as HVM) are great research stuff showing us how to do (or not do) things.
From my point of view, the author almost made it into s-expressions, but decided not to go all the way, which (imo) would have been amazing and the "cleanest" (although I don't like using the term "clean" for code, it's so subjective). I'd like to have some light shed over the decision not to go all the way.
A `let` could assume un-even amount of forms in it and only evaluate the last one, using the other ones as bindings.
Example from your README:
(Main n) =
let size = (\* n 1000000)
let list = (Range size Nil)
(Fold list λaλb(+ a b) 0)
(define Main (n)
(let size (\* n 1000000)
list (Range size Nil)
(Fold list λaλb(+ a b) 0)))
Could even get rid of the parenthesis for arguments (`(n)` => `n`) and treating forms inside `define` the same as `let`.Good point.
> Could even get rid of the parenthesis for arguments (`(n)` => `n`) and treating forms inside `define` the same as `let`.
No, because non-curried functions are a feature. If we did that, every function would be curried. Which is nice, but non-curried functions are faster (lots of lambdas and wasteful copies are avoided using the equational rewrite notation), so they should be definitely accessible.
Many questions arise, for a small amount of benefit (imo), so not sure it's worth it.
> HVM files look like untyped Haskell.
Why not make it look exactly like Haskell? So that every valid Haskell program is automatically a valid Hvm program, while the reverse need not hold due to hvm being untyped.
Instead the syntax looks like a mix of Haskell and Lisp, with parentheses around application, and prefix operators. I prefer the cleaner Haskell syntax.
Some of the speedup examples look somewhat artificial:
The exponential speedup is on 2^n compositions of the identity function, which has no practical use. It would be nice to show such a speedup on a nontrivial function.
The arithmetical example uses a binary representation, but strangely uses unary implementation of operators, with addition implemented as repeated increment, and multiplication as repeated addition. Why not use binary implementation of operators? Does that not show a good speedup?