176 points · by elorm · 5y ago · 83 comments
Facts are files and rules are rules. Make will explore deep chains of rules to find a path to building the targets.
I once (ab)used make so that the mere inclusion of a non-existent header would autogenerate it from a series of different templates combining human-readable structures, marshaling it into binary, then converting it into something a C compiler can read. Importantly, the process was recursive, as the source for a template might have to go through transformation itself.
The key is I never taught make about the whole process. Each individual step in the process is a rule that transforms from one file extension to another. Make automatically searches for a path through the rules, even 9 or 10 deep.
[1] https://en.m.wikipedia.org/wiki/The_Unix_Programming_Environ...
[2] https://en.m.wikipedia.org/wiki/Hoc_(programming_language)
https://bentnib.org/posts/2015-04-17-propositions-as-filenam...
http://conal.net/blog/posts/the-c-language-is-purely-functio...
But considering this seems to explain a lot. Like SQL, make is an integral part of the programming world ... that most people want as little as possible to do with and which some people violently hate and a few people enjoy playing with.
And I think this shows language that just tell the computer "what you want" and not how to get that something tend to not scale with the length of the command or the amount of data processed. SQL was originally created to be something like a human-friendly, natural language interface, if you can believe it. And it's sort of friendly if you only use one or two command-words but after that it gets extremely frustrating.
So the connection is interesting.
That's a nice programming paradigm, unfortunately a bit obscure now.
If you use GNU make, check out remake http://bashdb.sourceforge.net/remake/ which is GNU make patched with debugging support
My mental model of prolog is to imagine you are constructing a graph, where some of the nodes have side effects, and then tell the compiler to do a depth-first-search, executing any side effects it comes across.
I'd also look at Unison, for a more recent exotic programming language concept.
And what GraalVM is doing with the polyglot layer is quite interesting.
Finally my recent favourite is PPL, probabilistic programming languages.
And for more I'd recommend this podcast https://futureofcoding.org/episodes/
Cellular automaton is vastly popular as a concrete mechanism for rule-based programming (PuzzleScript being a good example), reversible computing is no longer interesting because of quantum computers and perhaps homomorphic encryption, probablistic programming is a large enough niche that it was never exotic, circuitry-based declarative programming is not even a niche (cf. HDLs), self-modification as a single control mechanism has been tried multiple times throughout the history (often combined with string rewriting paradigm, which itself has been even more popular than self-modification), ... The list goes on and on.
Probably the most exotic concept that I have ever seen is a multi-dimensional control flow (most famously Befunge [1], with some other lesser-known precedents), but there has been several programming games making use of that. Gravity-based programming [2] and the Infinity Machine [3] might be interesting if you allow hypothetical ideas.
[1] https://esolangs.org/wiki/Befunge
[2] https://esolangs.org/wiki/Gravity
[3] https://www.chiark.greenend.org.uk/~sgtatham/infinity.html
https://en.m.wikipedia.org/wiki/Icon_(programming_language)
Also maybe Self and Joy (IIRC).
I like John Tromp's Binary Lambda Calculus and Binary Combinatory Logic[2]
[1] https://esolangs.org/wiki/Language_list [2] https://tromp.github.io/cl/cl.html
https://esolangs.org/wiki/Piet
Programming as an abstract painting
I got nerd-sniped the other day by the Interval Tree Clocks post ( https://news.ycombinator.com/item?id=25243376 ) and wrote a crude implementation of ITCs in Prolog[3]. The code is gratifyingly short and closely follows the structure of the notation in the paper.
(As an aside, it's weird and a little absurd that that notation, which Guy Steele Jr. calls "Computer Science Metanotation"[4], has no official name nor standard. He mentions in that talk that he took a stab at mechanizing it by processing the LaTeX in Prolog! That seems like something worth pursuing.)
[1] "The Power of Prolog" https://www.metalevel.at/prolog
[2] https://www.youtube.com/channel/UCFFeNyzCEQDS4KCecugmotg/vid...
[3] https://git.sr.ht/~sforman/Prolog-Junkyard/tree/master/misce...
In practice it is used in the Clojure community as a query language for both databases and for in-memory data structures.
Datomic, datascript, datahike are examples.
Also it is used in research, including parsing (programming languages). Someone more knowledgeable might add to this.
https://en.wikipedia.org/wiki/Datalog
Therefore, you can use every ISO conforming Prolog system to read and reason about any Datalog database. If your Prolog system supports for example SLG resolution, you will also retain the termination and completeness properties of Datalog when you interpret queries over the database.
Datomic is definitely not Datalog syntax, otherwise it could – and likely would – have been called Datalog.
Various marketing case study blurbs are here if that's your thing: https://www.datomic.com/nubanks-story.html
I hope he's gonna cover miniKanren!
This title kinda stinks since all the posts in the series have made it to front page.
This is #4, and it's about datalog. Perhaps mods could adjust title.
I think of miniKanren as relentlessly general purpose, and not so much suited to a demanding niche like databases.
I'm very interested in both. I remember watching a talk called The Promise Of Relational Programming a while back and thinking "this HAS to be the future of programming."
Any suggestion of where to start?
I'd suggest just poking around in these first:
http://io.livecode.ch/ online interactive minikanren examples
http://tca.github.io/veneer/examples/editor.html more minikanren examples.
You already mentioned http://minikanren.org/ You may also want to check out the book The Reasoned Schemer.
I did a slightly faulty implementation ( I didn't get the search ordering right) in Julia here https://www.philipzucker.com/yet-another-microkanren-in-juli...
Microkanren implementation tutorial https://www.youtube.com/watch?v=0FwIwewHC3o . Also checkout the Kanren online meetup recordings https://www.youtube.com/user/WilliamEByrd/playlists
And like all the Schemer books, it's a pretty pleasant and easy read. You can go through a chapter sans computer and then revisit it with the computer (I read it while traveling so half the time I was reading, my computer wasn't readily available).
Ed Kmett did a live coding series on his attempt port kanren to Haskell. Hope guanxi makes some progress soon.
- "Modes" are dataflow directions (use them for polymorphic dispatch!)
- "Purity" is an effect system
- "Unique" is linear types
- has backends for C, C#, Java, Erlang
Specifically: many optimization engines give very arcane feedback about infeasibilities and singularities which cause optimizations to fail and users to be frustrated. I feel like plugging a datalog system into the optimization engine would give end users a really powerful way to ask questions about the sources of infeasibilities and singularities. If changes to the optimization problem were tracked I would expect these systems to be a very intuitive way to say things like "tell me all the rules which participate in an infeasibility that have been changed recently."
I have heard, that people who have never programmed before often have an easier time learning prolog than people who have, so I think there's an element of forgetting what you already know. When I had to learn it for school, there was this book of small puzzles (Sort of like the little lisper but for prolog) that was really helpful, but I can't remember the name of it.
Will try look over it and get through this new series but still sour over that blog post...
What I didn’t see was any tirade against people? - you don’t tirade against people being taken advantage of by scammers - unless those people are the cult leaders?
> “New religious movements like the cryptocult provide a psychological and philosophical framework that provides sense-making for a world that seems hostile and out of their control. The crypto movement fits all the textbook criteria, it provides a mechanism for determining an in-crowd and an out-crowd (no-coiners vs bitcoiners). It gives a framework for assessing the virtue of other followers based on their faith (HODLing) in the cause. It offers simple answers to complex issues in economics and monetary policy. It gives a linguistic framework of “thought-terminating clichés” and acronyms to quell dissent. It gives a mechanism of social control in which one can acquire influence and status in exchange proselytizing and onboarding more followers to buy tokens. It makes miraculous promises of wealth, not derived from effort but from faith. It presents an eschatological narrative of retributive justice about the end-times of the global financial system, in which the true believers will be reborn with a new life in an anarcho-capitalist utopia. And most importantly, it gives people a sense of a community, hope and belonging which is a powerful force that can be exploited by charismatic leaders.”
Yes, they're not citations to academic studies, but you don't see an in-group/out-group dynamic of "people who believe in the glorious future of Canadian dollars" vs "people who don't", or the desperation for the world to realise the truth of Mexican Pesos that only the faithful currently know, or etc.
So here you are on HN, where most people love complaining about crypto since 2009 -- but they still have a dayjob they sure love to bitch about (even in FANGs!), while those of us who worked on crypto without any specific feelings are early retirees.
> I like this guy.
Me too, but I try to leave aside opinions and focus on interesting content.
Proudly grouping yourself with Peter Popoff and his "debt cancelling miracle spring water", with the justification "I made money so it's not a scam". With your friends Uri Geller, Charles Ponzi, Elizabeth Holmes, Kenneth Copeland, and crew.
> Me too, but I try to leave aside opinions
Sorry, was your first paragraph not gloating about your superiority, and looking down on and mocking people who still have to work for a living for not having your dispassionate visionary insight? Because it sure felt like a big dollop of opinion.
I'm sure all the Enron investors said something similar before they went bust
[0] https://web.archive.org/web/20200730131647/https://www.steph...
I do technical work and unfortunately can't contain my Politics on social media (due to their psychology tricks). I know both Republicans and Democrats will dismiss my math because I don't belong to their side.
Even if one releases software with a license like the GPL that explicitly doesn’t constrain what the software is used for, I think one should still care about how it is used and the ethical implications of it.
But in science fields, authors names don't really matter. The same outcome will exist regardless who is studying it.