4 ms·
Missing: Icon. I think Icon is a fascinating language in spite of being dynamically-typed. I've not used it in many years though. What makes Icon interesting
by cryptonector 7y ago
Missing: Icon. I think Icon is a fascinating language in spite of being dynamically-typed. I've not used it in many years though.
What makes Icon interesting is that its functions ("procedures" in Icon terminology) are essentially generators in that they can "fail" (prune, produce no [further] results), or "suspend" results as many times as desired. "Failure" drives backtracking. So it's Prolog-like, but with Algol-family syntax.
Not surprising then that I find jq interesting too: it has pervasive generators and backtracking, just like Icon, though with a fundamentally different syntax, and very limited type system.
- pasabagi 7y agoDo you like writing jq? I really tried to like it, appreciated the ideas, but found even simple programs extremely hard to write in it. (Obviously, this is possibly just an artifact of me being thrown into a functional deep-end with an extremely terse syntax).
- cryptonector 7y agoIt took some getting used to... I "like" it the same way that I "like" writing XSLs: I thank my lucky stars that jq and XSLT/XPath exist, but if I didn't have to deal with JSON/XML I wouldn't use jq/XSLT. That reasoning seems circular, but at least jq is significantly more general than XSLT. Though to be fair I like jq a lot better than I like XSLT. All functional languages tend to take some getting used to, at least for me. Now that I have a mental model of jq, I do actually enjoy using it. The terse syntax is a double-edged sword.
- minxomat 7y agoThink of jq more like bash instead of a generic functional language. Blocks work on data and you pipe data along blocks. You can name blocks. That 99% of what you need to get to do jq. Here's a small example of a smaller ETL script a wrote a while ago for stats collection over scm repos: https://gist.github.com/turbo/36e87947a56cfaacec9d0356b3e521ba https://gist.github.com/turbo/36e87947a56cfaacec9d0356b3e521... As you can see it loads data from vars, fed by other jq scripts. Don't try to put everything in one script. Each script should basically just reduce and normalize.
- deleted 7y ago[deleted]
- raja_mukherji 7y agoThe first time I tried using Icon (over 20 years ago), I couldn't get my head around generators and back-tracking. Then I tried it again a year or two later and it suddenly clicked. But then I missed the availability of libraries in C, and the module structure of Modula 3. So I rolled my own, (https://wrapl.github.io https://wrapl.github.io), combining Icon's goal directed evaluation with modules, classes, and lots of C library bindings. Unfortunately I wrote a lot of it in 32 bit x86 assembly, so it's due a proper rewrite but I still use it for prototyping and text / data processing today.