10 ms·
The seven programming ur-languages (2022)
- tagfowufe 6mo agoI would refer to the world _cognate_[0]. 'Fundamental programming cognates' sounds cool as a uni course. [0] https://en.wiktionary.org/wiki/cognate https://en.wiktionary.org/wiki/cognate
- sph 6mo ago"Cognato/a" in Italian is brother/sister-in-law
- pfdietz 6mo agoAnother direction to explore logic languages is Datalog.
- jounker 6mo agoI think damalig falls cleanly into the prolog family.
- macintux 6mo agoReminds me a bit of Bruce Tate’s approach in 7 languages in 7 weeks, which is where I first encountered Erlang. I think from a historical perspective, describing COBOL and Fortran as part of the ALGOL family is a stretch, but I suppose it’s a good reminder that all history is reductive.
- gottheUIblues 6mo agoRather COBOL is a living fossil? And today's Fortran is the FORTRAN family with horizontal gene transfer from the Algol lineage of programming languages.
- shevy-java 6mo agoCan COBOL be called a living fossil? I mean, programming languages do not live; and they do not "die", per se, either. Just the usage may go down towards 0. COBOL would then be close to extinction. I think it only has a few niche places in the USA and perhaps a very few more areas, but I don't think it will survive for many more decades to come, whereas I think C or python will be around in, say, three decades still. > family with horizontal gene transfer Well, you refer here to biology; viruses are the most famous for horizontal gene transfer, transposons and plasmids too. But I don't think these terms apply to software that well. Code does not magically "transfer" and work, often you have to adjust to a particular architecture - that was one key reason why C became so dynamic. In biology you basically just have DNA, if we ignore RNA viruses (but they all need a cell for their own propagation) 4 states per slot in dsDNA (A, T, C, G; here I exclude RNA, but RNA is in many ways just like DNA, see reverse transcriptase, also found in viruses). So you don't have to translate much at all; some organisms use different codons (mitochondrial DNA has a few different codon tables) but by and large what works in organism A, works in organism B too, if you just look to, say, wish to create a protein. That's why "genetic engineering" is so simple, in principle: it just works if you put genes into different organisms (again, some details may be different but e. g. UUU would could for phenylalanine in most organisms; UUU is the mRNA variant of course, in dsDNA it would be TTT). Also, there is little to no "planning" when horizontal gene transfer happens, whereas porting requires thinking by a human. I don't feel that analogy works well at all.
- deleted 6mo ago[deleted]
- ErroneousBosh 6mo agoI don't know; COBOL pops up in banking all the time and Fortran lives on in a lot of specialised engineering applications. Is there anything to be gained from rewriting it in Rust? Five years ago would there have been anything to be gained from rewriting it in Haskell? Ten years ago would there have been anything to be gained from rewriting it in Ruby? Fifteen years ago would there have been anything to gain from rewriting it in Clojure? Twenty years ago would there have been anything to gain from rewriting it in Java? And so on, all the way back.
- jasperry 6mo agoDoes anybody know whether Fortran is older or younger than Algol? From Wikipedia, it looks like they were both developed around 1957. Was there any overlap in the design?
- kergonath 6mo agoAlgol was published in 1958, and FORTRAN in 1957. I think it's fair to say they were developed concurrently.
- ianburrell 6mo agoI also think going back farther is a stretch. The first assembly languages were imperative, but what made Algol, Fortran, and Cobol interesting were functions and other features that allowed complex programming. Algol has the most descendants but Fortran was the first imperative programming language.
- jhbadger 6mo agoThere's also (besides Tate's sequel of 7 more languages), Dimitry Zinoviev's 7 Obscure Languahes in Seven Weeks. I liked it a lot, even if it hurt my feelings a bit to have my beloved Forth be one of the obscure languages (the others were APL, SNOBOL, Occam, Simula, Starset, and M4) -- I'm old and nerdy, but hadn't even heard of Occam and Starset.
- fero14041 6mo agoPerhaps better IMHO is "Strange code" by Ronald Kneusel (NoStarch, 2022) [0], which I found more didactic and developed. Please note than I'm quite a fan of this author's other books [1]. [0] https://nostarch.com/strange-code https://nostarch.com/strange-code [1] https://nostarch.com/search/Kneusel https://nostarch.com/search/Kneusel
- anthk 6mo ago- Algol 68 docs: https://algol68-lang.org/resources https://algol68-lang.org/resources 'a68g' it's a free as in freedom compiler. - Forth: you can use PFE,Gforth for ANS Forth requeriments. Or EForth if you reached high skills levels where the missing stuff can be just reimplemented. EForth under Muxleq: https://github.com/howerj/muxleq https://github.com/howerj/muxleq I can provide a working config where a 90% of it would be valid across SF. Starting Forth, ANS version: https://www.forth.com/starting-forth/ https://www.forth.com/starting-forth/ Thinking Forth, do this after finishing SF: https://thinking-forth.sourceforge.net/ https://thinking-forth.sourceforge.net/ Also, Forth Scientific Library. You can make it working with both GForth and PFE, just read the docs. Full pack: https://www.taygeta.com/fsl/library/Library.tgz https://www.taygeta.com/fsl/library/Library.tgz Helping Forth code for GForth/PFE. If you put it under scilib/fs-util.fs, load it with: s" scilib/fsu-util.fs" included https://www.taygeta.com/fsl/library/fsl-util.fs https://www.taygeta.com/fsl/library/fsl-util.fs - Lisp. s9fes, it will compile under any nix/Mac/BSD out there, even with MinC. S9fes: http://www.t3x.org/s9fes/ http://www.t3x.org/s9fes/ Pick the bleeding edge version, it will compile just fine. For Windows users: MinC, install both EXE under Windows. First, mincexe, then buildtools*exe: https://minc.commandlinerevolution.nl/english/home.html https://minc.commandlinerevolution.nl/english/home.html Then get 7zip to decompress the s9fes TGZ file, cd to that directory, and run 'make'. Run ./s9 to get the prompt, or ./s9 file.scm where file.scm it's the source code. In order to learn Scheme, there's are two newbie recommended books before "SICP". Pick any, CACS, SS, it doesn't matter, both will guide you before SICP, the 'big' book on Scheme: Simply Scheme https://people.eecs.berkeley.edu/~bh/pdf/ https://people.eecs.berkeley.edu/~bh/pdf/ Simply.scm file, select from ';;; simply.scm version 3.13 (8/11/98)' to '(strings-are-numbers #t)' and save it as simply.scm https://people.eecs.berkeley.edu/~bh/ssch27/appendix-simply.html https://people.eecs.berkeley.edu/~bh/ssch27/appendix-simply.... Concrete Abstractions Book: https://www.d.umn.edu/~tcolburn/cs1581/ConcreteAbstractions.pdf https://www.d.umn.edu/~tcolburn/cs1581/ConcreteAbstractions.... The SCM files needed to be (load "foo.scm") ed in the code in order to do the exercises: https://github.com/freezoo/scheme-concabs https://github.com/freezoo/scheme-concabs If you are en Emacs user, just read the Elisp intro, it will work for a different Lisp family but with similar design. Spot the differences: Scheme (like s9): (define (square x) (* x x)) We try: >(square 20) 400 Elisp/Common Lisp (as the web site shows): (defun square (x) (* x x)) Same there: >(square 20) 400 - Ok, ML like languages: https://www.t3x.org/mlite/index.html https://www.t3x.org/mlite/index.html If you follow the instructions on compiling s9, mlite it's similar with MinC for Windows. If you are a Unix/Linux/Mac user, you already know how to do that. You got the whole docs in the TGZ file, and the web.
- mellosouls 6mo ago(2022) and unfortunately advice to spend significant amounts of time in learning multiple languages is becoming rapidly redundant in the LLM age.
- justincormack 6mo agoThese are tools for thinking with, so not obsolete.
- sph 6mo agoGP is just trying to convince you that thinking is "rapidly redundant in the LLM age".
- mellosouls 6mo ago(GP here) Its true that we need to be cautious about continuing to exercise our thinking muscles, undoubtedly. Ofc you can do that without using legacy techniques, but each to their own.
- deleted 6mo ago[deleted]
- mellosouls 6mo agoAgree (redundant, not obsolete), but there are better tools for the job in terms of the production value gained in terms time and mental energy spent in mastering them. You can certainly think less as tech becomes more powerful in a domain; I wouldn't advise that either.
- zoky 6mo agoNot at all. That’s like saying learning how different kinds of engines work is redundant in the age of taxis. You don’t have to know any of this stuff in order to get from A to B. But if you want to understand the processes involved in getting there, or you maybe want to be the one that builds a better self-driving vehicle, this is where you should start.
- pfdietz 6mo agoI 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.
- armchairhacker 6mo agoTheorem proving and complex types are like extensions on an otherwise ordinary language: - Agda, Idris, etc. are functional languages extended with complex types - Isabelle, Lean, etc. are functional languages extended with complex types and unreadable interactive proofs - Dafny etc. are imperative languages extended with theorems and hints - ACL2 is a LISP with theorems and hints Related, typeclasses are effectively logic programming on an otherwise functional/imperative language (like traits in Rust, mentioned in https://rustc-dev-guide.rust-lang.org/traits/chalk.html https://rustc-dev-guide.rust-lang.org/traits/chalk.html).
- nextaccountic 6mo ago> Agda, Idris, etc. are functional languages extended with complex types I think they are not. No amount of type level extensions can turn a regular functional language like Haskell into something suitable for theorem proving. Adding dependent types to Haskell, for example, doesn't suffice. To build a theorem prover you need to take away some capability (namely, the ability to do general recursion - the base language must be total and can't be Turing complete), not add new capabilities. In Haskell everything can be "undefined" which means that you can prove everything (even things that are supposed to be false). There's some ways you can recover Turing completeness in theorem provers. You can use effects like in F* (non-termination can be an effect). You can separate terms that can be used in proofs (those must be total) from terms that can only be used in computations (those can be Turing complete), like in Lean. But still, you need the base terms to be total, your logic is done in the fragment that isn't Turing complete, everything else depends on it.
- 6mo ago
- gobdovan 6mo agothere's a few more semantic families: verilog, petri nets and variants, Kahn process networks and dataflow machines, process calculi, reactive, term rewriting, constraint solvers/theorem provers (not the same with Prolog), probabilistic programming, plus up and coming (actual production-ready) languages that don't fit perfectly in the 7 categories: unison, darklang, temporal dataflow, DBSP It may feel like a little bit of cheating mentioning the above ones, as most are parallel to the regular von Neumann machine setup, but was meaning for a while to do an article with 'all ways we know how to compute (beyond von Neumann)'.
- gobdovan 6mo agoalso Sussman's propagators are nice to check out [0] [0] The Art of the Propagator (mit url down for the moment)
- lioeters 6mo agoGreat 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/art.pdf https://groups.csail.mit.edu/mac/users/gjs/6.945/readings/ar... (PDF)
- zem 6mo agopure [https://agraef.github.io/pure-lang/ https://agraef.github.io/pure-lang/] is probably the most "practical" term rewriting language, though mathematica is the most used one by far.
- jounker 6mo ago<snark>So they reinvented speadsheets?</snark>
- andai 6mo ago>term rewriting In uni we had to make a spreadsheet software. I volunteered to do the formula parser, thinking it sounded like a fun challenge. I was stumped for a week, until I realized I could rewrite the formulas into a form I knew how to parse. So it would rewrite 1+1 into ADD(1,1) and so on. I also refused to learn regex, so the parsing code was "interesting" ;) I recall a comment from a colleague. "Okay, Andy says it works. Don't touch it." XD Guy from another group used regex and his solution was 20x shorter than mine.
- Kaliboy 6mo agoMy 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 out how. I ended up making a spellcheck to allow LLM's to iterate over and fix the dismal Papiamentu they generate.
- andai 6mo agoI was there, too. o/ The Unreal Tournament was the coolest thing I've ever seen. I think they shut it down the year after mine. (Now they have boring old regular AI like everyone else!) I haven't found a good use for Prolog, though I haven't put much effort into it. I admit I was much more impressed by GOAL though, and I didn't realize until recently that you can replicate the whole thing in a more "ordinary" language (and that this gives many benefits). D'oh!
- Kaliboy 6mo agoHi there! Which year was that? I followed the course in 2012/2013. Bummer it's gone. We almost won the tournament, we lost cause we overestimated the enemy. We programmed our agents to assume that if they have our flag they're bringing it to their base, thus we sent all agents there to await their arrival. And so they waited while our opponents ran in circles with our flag at the center or the map. I tried many things in Prolog but ordinary languages often proved to be more suitable. I recently vibe coded spellcheck.boneiru.online which is fully based on Prolog. I realized a spellchecker is a perfect use case, since I basically need to check ortography which is a set of facts. In terms of GOAL the text input would be the perception, and I then resolved whether the goal (correct text) is achievable. The facts are all valid words in the language and the rules I got from an ortography book.
- beasthacker 6mo agoThis GOAL? https://en.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp https://en.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp
- burakemir 6mo agoThis article is full of gross mistakes. For example it claims that Caml is "Cambridge ML" which is ridiculously false. Fact check every sentence. Really sad.
- Svip 6mo agoFor those curious: Cambridge ML is a thing, but abbreviated CML[0]; and whilst Caml is part of the ML family, it appears to be unrelated to CML. [0] https://www.cl.cam.ac.uk/teaching/1011/FoundsCS/usingml.html https://www.cl.cam.ac.uk/teaching/1011/FoundsCS/usingml.html
- tromp 6mo agoCaml was originally an acronym for Categorical Abstract Machine Language [1]. [1] https://en.wikipedia.org/wiki/Caml https://en.wikipedia.org/wiki/Caml
- capitalsigma 6mo agoSupposedly it was named "caml" because the author was a smoker who enjoyed camel cigarettes, hence the joke that [later implementations](https://en.wikipedia.org/wiki/Caml#History https://en.wikipedia.org/wiki/Caml#History) were named "Caml Light" and "Caml Special Light"
- steve_gh 6mo agoOne 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 Python (an Algol), they come from very different evolutionary routes, and have converged towards the same point in the ecosystem. I think of Ruby as a cuddly Alpaca compared to Python's spitting camel.
- pjmlp 6mo agoSince 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) <class 'int'> >>> dir(42) ['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__getstate__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'as_integer_ratio', 'bit_count', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'is_integer', 'numerator', 'real', 'to_bytes']
- DonaldFisk 6mo agoI wrote something similar here: https://fmjlang.co.uk/blog/GroundBreakingLanguages.html https://fmjlang.co.uk/blog/GroundBreakingLanguages.html We agree on Algol, Lisp, Forth, APL, and Prolog. For ground-breaking functional language, I have SASL (St Andrews Static Language), which (just) predates ML, and for object oriented language, I have Smalltalk (which predates Self). I also include Fortran, COBOL, SNOBOL (string processing), and Prograph (visual dataflow), which were similarly ground-breaking in different ways.
- f1shy 6mo agoI don’t understand why self is placed in the list instead of smalltalk. Smalltalk came first, and Alan Key was the one who invented the “OOP” name. Also ML is seen as a child of Lisp.
- pjmlp 6mo agoThey should be placed alongside each other, because Self OOP model is quite different from Smalltalk, including how the graphical programming experience feels like. For those that never seen it, there are some old videos (taken from VHS) on the language site, https://selflanguage.org/ https://selflanguage.org/
- FabHK 6mo ago> I don’t understand why self is placed in the list instead of smalltalk. The article explains that: > Smalltalk inherited the notion of a value and its type from earlier languages, and implemented the idea of a class. All objects had a class that gave their type, and the class was used to construct objects of that type. Self disposed of the notion of class and worked solely with objects. As this is a purer form, I have chosen Self as the type specimen for this ur-language.
- f1shy 6mo agoYes, but I still don't understand that explanation. Clearly self is a descendant of Smalltalk, that purified a part; but still is a descendant. At least I understand the "ur-" as indicating linage, more about time as features. For me is still backwards.
- rramadass 6mo agoFolks might find the following useful for studying PLs; 1) Advanced Programming Language Design by Raphael Finkel - A classic (late 90s) book comparing a whole smorgasbord of languages. 2) Design Concepts in Programming Languages by Franklyn Turbak et al. - A comprehensive (and big) book on PL design. 3) Concepts, Techniques and Models of Computer Programming by Peter Van Roy et al. - Shows how to organically add different programming paradigms to a simple core language.
- kaycebasques 6mo agoPrevious discussion: https://news.ycombinator.com/item?id=35813496 https://news.ycombinator.com/item?id=35813496
- dredmorbius 6mo agoMay 4, 2023, to be clear. 323 comments. Also 30 Sept 2021, 29 comments, <https://news.ycombinator.com/item?id=28704495 https://news.ycombinator.com/item?id=28704495>.
- davidguetta 6mo agolaugh in vibe coding
- LeCompteSftware 6mo agoLots of us are having fun identifying our choice for missing family :) One I might suggest is scripting languages, defined loosely by programming tools which dispatch high-level commands to act on data pipelines: sed, AWK, the sh family, Perl, PowerShell, Python and R as honorary members. In practice I might say SQL belongs here instead of under Prolog, but in theory of course SQL is like Prolog. Bourne shell might be the best representative, even if it's not the oldest. AWK et al share characteristics from ALGOL and APL, but I feel they are very much their own thing. PowerShell is quite unique among modern languages.
- analog31 6mo agoI'd add dataflow "languages" such as Excel and LabVIEW.
- sennalen 6mo agoC++ has Algol roots, but I think the C++ template metaprogramming style is an ur-language of its own. You could draw some parallels with ML maybe, but they came at it from a different direction.
- otabdeveloper4 6mo agoThis. Misses the compile-time evaluation boat completely, even though the proverbial "sufficiently smart compiler" is based on the idea.
- remywang 6mo agoWe 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/computer-science/programming-languages-and-applied-logic/programming-languages-build-prove-and-compare#contents https://www.cambridge.org/ir/universitypress/subjects/comput...
- Chirael 6mo agoMaybe a version with the Prolog part could show up on the Internet Archive?
- remywang 6mo agoHere’s the accompanying code on github but we never got to that part in class: https://github.com/nrnrnr/build-prove-compare-student-code https://github.com/nrnrnr/build-prove-compare-student-code
- deleted 6mo ago[deleted]
- MichaelNolan 6mo agoI’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.
- antiframe 6mo agoThat sounds fun! What are the 99 problems? I found language specific lists like https://wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems https://wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems Or is there a language agnostic list?
- lioeters 6mo agoP-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/prolog/problemas/ https://www.ic.unicamp.br/~meidanis/courses/mc336/2009s2/pro...
- igouy 6mo ago> It’s not a normal source code / text language. Do you think source code cannot be compiled and run from the command-line? https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/nbody-pharo-1.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- MichaelNolan 6mo agoI’ve never worked with SmallTalk professionally, so I could be mistaken. I know you can write/compile SmallTalk source code. But my understanding is that this wasn’t the way it’s intended to be used. I am under the impression that the live images were how the language designers intended it to be used. And that the live images are a better representation of the OOP/message passing paradigm.
- pcblues 6mo agoI always enjoy these summaries. I took my bachelor of computer science in the early 1990s. It covered a language in most of these categories. We didn't learn APL (Who is teaching the use of those custom keyboards to 100s of young students for one semester?) The processing power of systems at the time made it clear which language classes were practically useful and usable for the time and which were not. Prolog ran like a dog for even simple sets of logic. We had the best internet access and pretty powerful desktop systems for the time. I'm still curious why we didn't learn smalltalk. Could have been the difficulty of submitting and marking a system in a particular state rather than a file of code :)
- eichin 6mo ago> who Yale :-) Alan Perlis' intro to CS at Yale back in the late 80s was an APL class (a relatively small one, though.)
- NetMageSCW 6mo agoVirginia Tech at least used to - the school of Architecture had a programming in APL class.
- pcblues 6mo agoThat's amazing. I used to live under an architecture student (our building). His command of design history was great. His command of maths? Well, not so much.
- igouy 6mo agoA Smalltalk implementation provides: Smalltalk VM Smalltalk image file sources file (plain-text original source code file) changes file (plain-text change log, initially empty) So there are plenty of ways to submit code to be marked. See "OU LearningWorks: a customized programming environment for Smalltalk modules" https://ieeexplore.ieee.org/document/841064 https://ieeexplore.ieee.org/document/841064
- amai 6mo agoIsn‘t FORTRAN also a ur-language? It was invented in 1957.
- paulddraper 6mo agoFORTRAN (1957), ALGOL (1958), and COBOL (1959) are similar. Technically, FORTRAN is the oldest. One could argue that ALGOL is the most influential for language design.
- kasitmp 6mo agoPlankalkül
- NelsonMinar 6mo agoMost old-timers here are familiar with a Prolog-variant: make. Anyone who's struggled over a complex Makefile wishes they had a more sane declarative language!
- recursiveranter 6mo ago[dead]
- knome 6mo agoI 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' <<< '1 2 3' 11 21 12 22 13 23 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.
- matheusmoreira 6mo agoReminds me of the six programming language memory models: https://canonical.org/~kragen/memory-models/ https://canonical.org/~kragen/memory-models/
- mud_dauber 6mo agoIt did my heart good to see Forth listed.
- andyclap2 6mo agoI wonder if Occam is worth a mention? It doesn't feel like anything else here, and is playing with its hardware synthesis descendants on a FPGA is another "mind expanding" paradigm.
- Syzygies 6mo agoI recently revisited a language comparison project, a specific benchmark tallying the cycle decompositions in parallel of the 3,715,891,200 signed permutations on 10 letters. I kept a dozen languages as finalists, different philosophies but all choices I could imagine making for my research programming. Rather than "ur" I was looking for best modern realizations of various paradigms. And while I measured performance I also considered ease of AI help, and my willingness to review and think in the code. I worked hard to optimize each language, a form of tourism made possible by AI. The results surprised me: F# 100 19.17s ±0.04s C++ 96 19.92s ±0.13s Rust 95 20.20s ±0.38s Kotlin 89 21.51s ±0.04s Scala 88 21.68s ±0.04s Kotlin-native 81 23.69s ±0.11s Scala-native 77 24.72s ±0.03s Nim 69 27.92s ±0.04s Julia 63 30.54s ±0.08s Swift 52 36.86s ±0.03s Ocaml 47 41.10s ±0.10s Haskell 40 47.94s ±0.06s Chez 39 49.46s ±0.04s Lean 10 198.63s ±1.02s https://github.com/Syzygies/Compare https://github.com/Syzygies/Compare
- LeCompteSftware 6mo agoNaively this is quite surprising, but the devil is in the details. With the exception of Lean I'd point out they're all fairly close: Chez being 2.5x slower than C++ is not ignorable but it's also quite good for a dynamically-typed JITted language[1]. And I'm not surprised that F# does so well at this particular task. Without looking into it more closely, this seems to be a story about F# on .NET Core having the most mature and painless out-of-the-box parallelism of these languages. I assume this is elapsed time, it would be interesting to see a breakdown of CPU time. I don't think these results are quite comparable because of slightly differing parallelism strategies; I'd expect the F# implementation of just spinning off threads to be more a little more performant than a Rayon parallel iterator, which presumably has some overhead. But that really just shows how hard it is to do a cross-language comparison; Rust and C++ can certainly be made faster than the F# code by carefully manipulating a ton of low-level OS concurrency primitives. This would arguably also be little misleading. Likewise Chez and Haskell have good C FFI; does that count? It's a tricky and highly qualitative analysis. [1] FYI, one possible performance improvement with the Chez code is keeping the permutations in fxvectors and replace math operations with the fixnum-specific equivalent - this tells the compiler/interpreter that the data are guaranteed to be machine integers rather than bigints, so they aren't boxed/unboxed. I am not sure without running it myself, but there seems to be avoidable allocations in the Chez implementation. https://cisco.github.io/ChezScheme/csug/objects.html#./objects:h6 https://cisco.github.io/ChezScheme/csug/objects.html#./objec...
- eesmith 6mo agoWhich category is TRAC? https://en.wikipedia.org/wiki/TRAC_(programming_language) https://en.wikipedia.org/wiki/TRAC_(programming_language)
- stared 6mo agoI agree with "learn different classes of languages". OCaml was a language in which finally a function was a (mathematical) function. Mathematica thought me to look at expressions themselves as inputs. PostScript (with its reverse Polish notation going beyond simple arithmetics) rewired by brain. At the same time, I don't agree with that it does not matter if one picks "Java, C#, C++, Python, or Ruby". If your goal is to do quick sort, then well, it does not. If you want to use language for something (not only for its sake), then it makes a day and night difference. A person who wants to do 3D games and being shown Ruby or a person wanting to do exploratory data science and deep learning and being given Java are likely to get discouraged.
- ekropotin 6mo agoEven tho I probably never will get paid for writing Rust, I have zero regrets about learning it - it tough me really think about data ownership in programs.
- fsckboy 6mo agoin the world there should only be one debate and one summary about programming languages, and everybody should read that as a starting point before they enter the fray. for example, I would say what i was taught, that lisp is lists made out of cons cells, which contain references to either other lists/cons cells or to atoms. lisp doesn't "have" parentheses any more than lisp has the rest of the ASCII table, but parentheses were chosen as a convenient way to write list structure down in ascii form because parentheses nest in exactly the way lists do and lists are the important thing. then there never needs to be another discussion of parentheses and how you feel about them except in a sub-discussion if anybody has any bright ideas about alternative ways to convert list structure to ascii on paper. you disliking parentheses does not mean you dislike lisp; it just means you don't understand lisp, like for instance you think lisp has something to do with ascii. similar ideas apply to C, wherein the braces and semicolons do not matter, what matters is datatypes that correspond to von neumann architectures including especially pointers, and where binary representation is easily exposed (with a syntax that does not matter but for the record is &, |, ~, ^, <<, or >>. if you hate those choices for operator syntax you could easily convert your own C to use parenthetical lists of CamelCase names of LeftAddRight or whatever floats your boat instead of a + sign), just keep in the front of your mind how data is represented internally and how it's mapped to the syntax you like, and whatever list structure you choose to order the lines of code) Ur-ness is not interesting, just as the city of Ur was no doubt a lot less interesting than the city of Rome. Study Algol only to learn about call-by-name, then forget it. I could go on, but, like the ripples from a gold coin thrown in the bay, the effect will soon dissipate as if I had never written anything at all.
- lioeters 6mo agoBehold, future children, this is the ur-comment that started the cognitive revolution in how we teach programming languages in the 32nd century. The text and its important idea were almost lost in the tides of history, but it reached us thanks to a few eccentric ur-linguists digging through the ruins of post-WWIV civilizational collapse.
- fsckboy 6mo agoyou have not discovered the ur-comment, you have discovered the ruins of the pedagogy that was Ur. "look on my works, ye mighty, and despair"
- bwhiting2356 6mo agoI used to think being an engineer meant learning many languages. Turns out most of them solve the same problems — the returns diminish quickly. Depth across the stack (UX, CI/CD, model internals) compounds in a way that a sixth language never will.
- NetMageSCW 6mo agoI think that depends on the other five languages. Learning e.g. APL or Smalltalk if you are FORTRAN - C programmer would be very mind expanding.
- wvlia5 6mo agoRebol should be another family
- loganmhb 6mo agoFor any other array language novices, I've experimented with K and J but had the best experience so far with BQN. It is a bit on the Lispy side like K but much better documented, and I thought the APL-esque symbolic alphabet was mnemonically helpful enough while reading code to justify learning an editor keyboard integration. (Plus it's fun.)
- igouy 6mo ago> "What do I mean when I say fundamentals? If you have an array or list of items and you’re going to loop over it, that is the same in any imperative language." Err "Fortran: The world’s first programming language standard opened the door to modern computing" https://www.ibm.com/history/fortran https://www.ibm.com/history/fortran