5 ms·
λ Lessons
- nwhitehead 12y agoDoesn't appear to work on ipad.
- janpaul123 12y agoThanks. Hopefully this helps, tested it in the XCode simulator: https://github.com/stevekrouse/hs.js/commit/3558d2575a194d73c7bf2335398699f419cca995 https://github.com/stevekrouse/hs.js/commit/3558d2575a194d73...
- paf31 12y agoVery nice. It took me a while to realize that array literals aren't supported, but once I did that I was able to write concatMap and watch it being evaluated. A couple of points: - If there is a syntax error, the box just turns red. It would be nice to see what the issue is. - You could probably make it clearer that it's possible to execute arbitrary expressions, by editing the map term, for example.
- janpaul123 12y agoI've added error messages in https://github.com/stevekrouse/hs.js/commit/2ed274d4607a4c9d8ffff260cbd26d3275a8ede5 https://github.com/stevekrouse/hs.js/commit/2ed274d4607a4c9d... and https://github.com/stevekrouse/hs.js/commit/812945939e14e3370f0a84159f3a67558b4bcc38 https://github.com/stevekrouse/hs.js/commit/812945939e14e337.... The (edit) and (clear) links are now always visible to encourage editing, per https://github.com/stevekrouse/hs.js/commit/e301961c03d92c589d522c0b09da2548371c150a https://github.com/stevekrouse/hs.js/commit/e301961c03d92c58... Thanks!!
- TrainedMonkey 12y agoNeat, however it feel clunky. Few things that bugged me: 1. Clear does not work. Firefox 22.0, private mode. 2. Clicking to expand gets tedious fast. Adding shortcut like space would be nice. 3. No syntax highlighting on function editor, also lists could use some colors.
- justinpombrio 12y ago4. Hitting 'enter' after editing only sometimes gets you out of editing mode; seemingly only if your expression is well-formed? 5. 'Clear' clears some lines but not all. It usually seems to clear all but the top two lines for me. Chrome v.36 in Ubuntu
- janpaul123 12y agoThanks. Fixed 1. with https://github.com/stevekrouse/hs.js/commit/265c0a6632f793f45504c7f0f149281048a1ca12 https://github.com/stevekrouse/hs.js/commit/265c0a6632f793f4..., but not sure why that didn't work in FF.. :\ 2. But what should we expand then? Just the first one? Part what makes it interesting is that you can decide for yourself what to expand, and it doesn't matter in which order you do it (Church-Rosser). 3. Feel free to hack CodeMirror or Ace in there! :)
- gravity13 12y agoReally awesome stuff JP and Steve! I've been having similar ideas about the subject myself :)
- janpaul123 12y agoThanks Michael ;)
- NSCFType 12y agoI submitted this to /r/Haskell and chrisdoner left you some praise and feedback (he thought I wrote it). http://www.reddit.com/r/haskell/comments/2d1dpg/λ/cjlakwi http://www.reddit.com/r/haskell/comments/2d1dpg/λ/cjlakwi
- fyolnish 12y agoWould love to play with this, but clicking the expansions crashes Safari on my machine
- janpaul123 12y agoHm, cannot reproduce, sorry!
- mrcactu5 12y agothere is a typo This document implements a small, dyanmically-typed, subset of Haskell that includes integers, lists, functions, pattern matching and recursion. Also, Haskell is strictly typed... but most of us aren't ready for that anyway :-P
- janpaul123 12y agoThanks, fixed in https://github.com/stevekrouse/hs.js/commit/9882af6312f93a299af07f9616736eb00e27b48d https://github.com/stevekrouse/hs.js/commit/9882af6312f93a29...
- justinpombrio 12y agoThis 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]
- zodiac 12y agoLists 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-infix-operator-do-in-haskell http://stackoverflow.com/questions/1696751/what-does-the-inf...
- janpaul123 12y agoIt 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/812945939e14e3370f0a84159f3a67558b4bcc38/haskell.pegjs https://github.com/stevekrouse/hs.js/blob/812945939e14e3370f..., the transformations on the AST here, https://github.com/stevekrouse/hs.js/blob/812945939e14e3370f0a84159f3a67558b4bcc38/ast_transformations.js https://github.com/stevekrouse/hs.js/blob/812945939e14e3370f..., and the specs here, https://github.com/stevekrouse/hs.js/blob/812945939e14e3370f0a84159f3a67558b4bcc38/ast_transformations_spec.js https://github.com/stevekrouse/hs.js/blob/812945939e14e3370f....
- janpaul123 12y agoFixed the commas in https://github.com/stevekrouse/hs.js/commit/d087de3c6dee2827e08ee805d9720a965ee71bee https://github.com/stevekrouse/hs.js/commit/d087de3c6dee2827... :-)
- maerten 12y agoPretty cool, although it keeps crashing my Safari on OSX Yosemite beta somehow :)