Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Feels like clojure from afar


This is simpler to undrestand than clojure.


I'm not sure that's true since most of the top-level comments here are saying they don't understand it.


There's some kind of problem with the presentation which is causing people not to engage with it. It's no more complex a concept than, say, Lisp; everyone here has learned more complex programming topics than this. But people are not really processing the information presented, eg, there's confusion about whether or not a page with code examples is describing a programming language.

I think the presentation is effective but intimidating? There's something about it that causes people to tune out? But if you actually pay it some attention, it's pretty clear. I'm a bit baffled, the presentation looks good to me, and I know these commenters aren't dumb, so I just don't understand what went wrong here.


The presentation is confusing because of a mismatch between the headings/blurbs and what is being shown in the code examples.

The heading of the entire page is "the essence of computation" but I'm not shown why the code examples (which at a cursory glance look like a run-of-the-mill FP language) warrant that claim.

Then we read that there is "one operator", but that's clearly not visible from the examples. You have to read the comments in the playground to understand that things like definitions, lambdas, lists, etc. are syntactic sugar added on top of TC (which is fine, but it's just not transparent initially). In general, the distinction between TC (a formal calculus) and the programming language implemented here based on TC is not made clear enough.

The code examples themselves are fine (and there's some interesting things in there), but I stumbled over the "try to invert function" example. While the example itself is reasonably clear, it's not at all clear what that would mean in the general case - you clearly can't invert all functions (especially not non-injective ones). That should definitely be explained better.


This is a good analysis. Thanks.


The text on the website linked to is entirely vacant and content-free. It doesn’t actually describe what the language is or how it works.


You're expecting to see some forest of information which isn't there, because it's such a little language.

At the top of https://treecalcul.us/specification/ you have 5 rules. Your (valid) program will match one of the left-hand-sides. To execute your program, turn whichever LHS your program is into its corresponding RHS. Keep doing that until you can't, and you'll be left with your final answer.

It also provides 2 reference interpreters (OCaml and JS) on the same page. Each interpreter is just a single recursive function 'apply' (which does what I described in the above paragraph). Note the 'match a with' section in the OCaml version. That's essentially the 5 rules from the top translated to OCaml. (I'm not sure why they're slightly different but there's probably a good reason).

The JS interpreter is harder to read ("length"? "push"? "pop"? these aren't in the spec above). My guess is that a machine-friendly translation was needed so that JS wouldn't die from recursing too deeply.

I clicked on 'runjs.app' link, looked at the examples at the bottom, and added my own.

    apply(_not, apply(_not, _true));
and sure enough it yielded

    [ [] ]
which is what it calls '_true':

    const _true = [[]];


There's a lot of precise, technical language, including a specification - that seems very contentful and specific to me.

The code examples seem very straightforward and compelling to me.

    > # Setup: Simple function on strings     
    > f = λa λb concat ["Hello ",a," ",b,"!"] 
    > f "Jane" "Doe"                          
    Hello Jane Doe!                           
This requires some familiarity with languages like Lisp or Forth to follow, but otherwise it's very straightforward.

    > # What else can we do with a function?  
    > g = f "Admiral"                         
    > # Try to invert it:                     
    > invert g "Hello Admiral 
    Alice!"         
    Alice
That's a really concise and impressive demo to me! I've never seen a language that can invert functions!


> I've never seen a language that can invert functions!

prolog




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

Search: