Live data from Hacker News

The seven programming ur-languages (2022)

madhadron.com

81–90 of 161 posts

Re: The seven programming ur-languages (2022)

#81
I would add another to the list, which is languages where every expression yields zero or more values, particularly `jq`. there are some antecedents in Icon and xquery, but these generally require explicitly opting into either production or consumption of value streams, where jq does this stream processing automatically from the ground up. (icon requires use of a suspend and needs an every clause to walk the generated values, xquery requires explicit 'for' statements over streams as many builtin operators fail on value streams)

in jq, the comma separates expressions, which independently yield values. a span of such expressions is called a 'filter', since they are always run by passing values from the prior filter into them (with the initial values sourcing from json objects on stdin, or an implicit null if you pass -n to the program).

    $ jq -nc ' def x: "a", "b", "c" ; def y: 1, 2, 3 ; x, y '
    "a"
    "b"
    "c"
    1
    2
    3

    $ jq -c '. + 10, . + 20' 
brackets collect values yielded inside of them.

    $ jq -nc ' def x: "a", "b", "c" ; def y: 1, 2, 3 ; [x,y] '
    ["a","b","c",1,2,3]
if you have a complex object that includes multiple expressions yielding multiple values, construction will permute over them.

    $ jq -nc ' def x: "a", "b", "c" ; def y: 1, 2, 3 ; {"foo": x, "bar": y} '
    {"foo":"a","bar":1}
    {"foo":"a","bar":2}
    {"foo":"a","bar":3}
    {"foo":"b","bar":1}
    {"foo":"b","bar":2}
    {"foo":"b","bar":3}
    {"foo":"c","bar":1}
    {"foo":"c","bar":2}
    {"foo":"c","bar":3}
the pipe operator `|` runs the next filter with each value yielded by the prior, that value represented by the current value operator `.`.

    $ jq -nc ' 1,2,3 | 10 + . '
    11
    12
    13
    $ jq -nc ' 1,2,3 | (10 + .) * . '
    11
    24
    39
binding variables in the language is similarly done for each value their source yields

    $ jq -nc ' (1,2,3) as $A | $A + $A '
    2
    4
    6
functions in the language are neat because you can choose to accept arguments as either early bound values, or as thunks, with the former prefixed with a $.

for example, this runs `. + 100` parameters context, with `.` as the 10,20,30 passed to it:

    $ jq -nc ' def f($t): 1,2,3|$t ; 10,20,30|f(. + 100) '
    110
    110
    110
    120
    120
    120
    130
    130
    130
where this runs `. + 100` in the context of its use inside the function, instead receiving 1,2,3:

    $ jq -nc ' def f(t): 1,2,3|t ; 10,20,30|f(. + 100) '
    101
    102
    103
    101
    102
    103
    101
    102
    103
so you could define map taking a current-value array and applying an expression to each entry like so:

    $ jq -nc ' def m(todo): [.[]|todo] ; [1,2,3]|m(. * 10) '
    [10,20,30]
it's a fun little language for some quick data munging, but the semantics themselves are a decent reason to learn it.

Re: The seven programming ur-languages (2022)

#82
post #74
post #56

Earlier quoted context omitted.

Since Python introduced new style classes, it also became a pure OOP language, even though it might not look like it at "Hello World" level, all primitive types have become objects as well. I love to point this out to OOP haters, >>> type(42) >>> dir(42) ['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floo…

> I love to point this out to OOP haters That seems like a pretty lame gotcha--saying "Aha! The language you write in uses your hated paradigm under the hood" seems to invite the immediate response of "So? I don't use it."

It is more about those that proudly use Python because it isn't an OOP language, yep those do exist.

Re: The seven programming ur-languages (2022)

#83

I’ve very slowly been trying to do the “99 problems” list in each of these languages groups. It’s been a fun experience seeing the differences. Though I think I would need a larger, less algorithmic, project to really see each group’s strengths. Especially for the OOP group. One thing the article didn’t touch on was SmallTalk’s live visual environment. It’s not a normal source code / text language.

That sounds fun! What are the 99 problems? I found language specific lists like https://wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems Or is there a language agnostic list?

Re: The seven programming ur-languages (2022)

#84
post #17

My favorite subject when studying CompSci (TU Delft) was called "Concepts of programming languages". We learned C, Scala (for functional) and Javascript (prototypes). It made learning Elixir years later much easier. We also had a course that basically summed up to programming agents to play Unreal Tournament in a language called GOAL which was based on Prolog. For years I've wanted to use Prolog but could not figure…

I took a similar class in college, and I'm also glad I did, even though the professor was kinda rubbish.

Even having the thinnest surface level understanding of the other ur-languages is so useful (and even more-so with assembly). I can't do anything useful with them, but it helps keep you from the "when all you have is a hammer, every problem looks like a nail" trap if you're at least aware of the existence of screwdrivers.

Re: The seven programming ur-languages (2022)

#86

I’ve very slowly been trying to do the “99 problems” list in each of these languages groups. It’s been a fun experience seeing the differences. Though I think I would need a larger, less algorithmic, project to really see each group’s strengths. Especially for the OOP group. One thing the article didn’t touch on was SmallTalk’s live visual environment. It’s not a normal source code / text language.

That sounds fun! What are the 99 problems? I found language specific lists like https://wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems Or is there a language agnostic list?

P-99: Ninety-Nine Prolog Problems by Werner Hett is the original. The site is apparenty no longer accessible, but here's a copy: https://www.ic.unicamp.br/~meidanis/courses/mc336/2009s2/pro...

Re: The seven programming ur-languages (2022)

#87

Earlier quoted context omitted.

also Sussman's propagators are nice to check out [0] [0] The Art of the Propagator (mit url down for the moment)

Great list of languages that don't fit the conventional families. I've been curious about some of them, like Petri nets and term rewriting, and will enjoy exploring the others. Found a working link to the paper about propagators. The Art of the Propagator, Alexey Radul and Gerald Jay Sussman. https://groups.csail.mit.edu/mac/users/gjs/6.945/readings/ar... (PDF)

pure [https://agraef.github.io/pure-lang/] is probably the most "practical" term rewriting language, though mathematica is the most used one by far.

Re: The seven programming ur-languages (2022)

#88
post #72

We got to build mini versions of the first 4 languages (imperative, lisp, ML, Smalltalk) in the PL course at tufts which is now published as a textbook [1]. There used to be a prolog part that sadly got cut. [1]: https://www.cambridge.org/ir/universitypress/subjects/comput...

Maybe a version with the Prolog part could show up on the Internet Archive?

Here’s the accompanying code on github but we never got to that part in class: https://github.com/nrnrnr/build-prove-compare-student-code

Re: The seven programming ur-languages (2022)

#89
post #13

I might add another class of languages: those intended to express proofs, via the Curry-Howard correspondence. Lean is a primary example here. This could be considered a subclass of functional languages but it might be different enough to warrant a separate class. In particular, the purpose of these programs is to be checked; execution is only secondary.

These are not true programming languages because by definition they are not Turing complete. If they were Turing complete it would be possible to write a false proof that just compiled down to a non-terminating program.

Re: The seven programming ur-languages (2022)

#90

One correction I'd make to the article's taxonomy: Ruby is an object oriented language not an Algol. Its inspiration is Smalltalk, and much of the standard library naming comes from that route (eg collect rather than map). Ruby is object oriented from the ground up. Everything (and I do mean everything) is an object, and method call is conceived as passing messages to objects. While Ruby is most often compared to Pyt…

I think the choice to identify a specific ur-language as "Object oriented" throws people off since OO is just a style of programming in the same way that procedural is. I don't think it's useful to say that Python and C++ are both the same kind of language because they both have multiple inheritance, rather that's just an observable commonality, like noticing that both Delhi and Vegas are too hot. Yeah, but I don't t…

Yeah, but the thing about Vegas is that it's really more of a dry heat
Post reply on HN