Hacker News new | past | comments | ask | show | jobs | submit login

This will be a cool demo once the kinks get worked out. It lets you see first-hand that you can choose which redex to beta-expand first. Haskell is an excellent choice for this because -- unlike almost every other language -- it does not matter the order you evaluate subexpressions in. I feel like this could be useful to show someone when teaching them to program.

The language in the function editor on the right looks like Haskell. I'm confused as to what the language you run is supposed to be, though. It doesn't seem to have Haskell syntax or semantics. The lists aren't comma-separated, and the main expression seems to require parenthesis? And what is this program doing?

    (map (plus 1) [12])
    (( 1) : (map (plus 1) [2]))
    (( 1) : (( 2) : (map (plus 1) [])))
    (( 1) : (( 2) : []))
    (( 1) : [( 2)])
    [( 1)( 2)]
vs. in Haskell

    Prelude> map (+ 1) [1, 2]
    [2,3]



It is supposed to be Haskell-ish, but admittedly I haven't done much Haskell in a while. I just went roughly with what Steve suggested. But yeah, the missing commas in lists is a pretty big mistake!

In any case, the parser can be found here, https://github.com/stevekrouse/hs.js/blob/812945939e14e3370f..., the transformations on the AST here, https://github.com/stevekrouse/hs.js/blob/812945939e14e3370f..., and the specs here, https://github.com/stevekrouse/hs.js/blob/812945939e14e3370f....



Lists don't need to be comma-separated in haskell, you can use the colon infix operator to construct lists. http://stackoverflow.com/questions/1696751/what-does-the-inf...




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: