9 ms·
Exotic Programming Ideas
- adenozine 6y agoI love these! 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.
- deleted 6y ago[deleted]
- slaymaker1907 6y agoYeah, I think that minikanren is a more useful language for embedding than datalog since it is more expressive than datalog and has a more straight forward execution model. The functional style of minikanren makes it easier to create things like parsers easily.
- adenozine 6y agoInteresting! I suppose it depends on the context though, right? For answer-set programming like database queries and stuff, I've seen some impressive datalog work done in the past. I'm not well versed in the extensions, and I actually haven't been able to read this post yet, I've been at work since the wee hours, but I was thinking of the success of Datomic. I believe that's datalog under the hood. 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."
- erk__ 6y agoI hope he will cover some other exotic ideas like program inversion which I find really interesting, in the same area there is also specialization, though that is maybe a bit too similar to term rewriting.
- siliconmountain 6y agoI'm searching for an intro to miniKanren that's also an intro to logic programming. Ive never used datalog, clojure, or others. The main miniKanren website assumes preexisting Scheme / logic programming knowledge Any suggestion of where to start?
- philzook 6y agoI don't think you necessarily need much scheme knowledge to start learning minikanren. You might in order to read the implementation. There are versions out there in most languages I'd suggest just poking around in these first: http://io.livecode.ch/ http://io.livecode.ch/ online interactive minikanren examples http://tca.github.io/veneer/examples/editor.html http://tca.github.io/veneer/examples/editor.html more minikanren examples. You already mentioned http://minikanren.org/ 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-julia/ https://www.philipzucker.com/yet-another-microkanren-in-juli... Microkanren implementation tutorial https://www.youtube.com/watch?v=0FwIwewHC3o https://www.youtube.com/watch?v=0FwIwewHC3o . Also checkout the Kanren online meetup recordings https://www.youtube.com/user/WilliamEByrd/playlists https://www.youtube.com/user/WilliamEByrd/playlists
- Jtsummers 6y agoSeconding The Reasoned Schemer for learning miniKanren. It's a complete tutorial compared to most you'll find online that either quickly go from "here's how to start" to "now here's us generating lisp functions from specifications" or never move past the "here's how to start" portion. 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).
- mlang23 6y agoThe quine generator example is indeed very impressive... Ed Kmett did a live coding series on his attempt port kanren to Haskell. Hope guanxi makes some progress soon.
- fiddlerwoaroof 6y agoYeah, the articles title is: “Exotic Programming Ideas: Part 4 (Datalog)”. All the previous times this series has made the front page, it has had the part in the title.
- exdsq 6y agoI really liked Stephens writings until he went on a tirade against some people I worked with https://www.stephendiehl.com/posts/crypto.html https://www.stephendiehl.com/posts/crypto.html Will try look over it and get through this new series but still sour over that blog post...
- jodrellblank 6y agoBitcoin as cult, financial fraud, criminal scam, and religion. I like this guy. 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.”
- andrepd 6y agoI'm not even particularly keen on bitcoin, but that reads like a childish rant against a miscarachterisation of a group he doesn't like. I'd expect this kind of level of discourse in a 4chan thread.
- jodrellblank 6y agoIt reads like a concise summary of red flags around cryptocurrency, on many dimensions. It doesn't mention 'tendies' at all, call anyone names, it doesn't reek of someone bitter because they lost all their money or missed out on a get rich quick opportunity, or have that cynical nihilistic "I'm smarter than everyone" geek attitude. And it isn't framed at a rant against a /group/ as much as a warning about being a victim to the (most vocal) self-appointed leaders of the group. 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.
- jnwatson 6y agoYou can’t mention logic programming without talking about the one most folks have interacted with: make. 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.
- 1996 6y agoI think the term you're looking for is constraint propagation. That's a nice programming paradigm, unfortunately a bit obscure now.
- philzook 6y agoTwo fun blogs posts in this vein https://bentnib.org/posts/2015-04-17-propositions-as-filenames-essence-of-make.html https://bentnib.org/posts/2015-04-17-propositions-as-filenam... http://conal.net/blog/posts/the-c-language-is-purely-functional http://conal.net/blog/posts/the-c-language-is-purely-functio...
- vram22 6y agoThe classic Kernighan and Pike book, The Unix Programming Environment[1], has a good example of advanced make usage (cascading / recursive makes, multiple (and implied) rules, sources and targets, etc.), along the lines of your example, in the chapter at the end of the book on hoc[2], the higher order calculator. They build multiple, incrementally more powerful versions of hoc in that chapter, as a case study to tie together many key topics in the book. [1] https://en.m.wikipedia.org/wiki/The_Unix_Programming_Environment https://en.m.wikipedia.org/wiki/The_Unix_Programming_Environ... [2] https://en.m.wikipedia.org/wiki/Hoc_(programming_language) https://en.m.wikipedia.org/wiki/Hoc_(programming_language)
- ww520 6y ago
- lifthrasiir 6y agoIt might be just me, but having reached over a half of what the series promised, I don't find any of presented ideas "exotic". (I do find posts by their own are good and enjoyable, just that I don't agree to the series title.) They are of course less popular than, well, C, but---reusing the analogy made in the very first post---they are much more like Finnish or Korean more than Navajo or Klingon.
- lambda_obrien 6y agoDo you have an example of a truly exotic programming concept? I'm really interested in weird PL stuff.
- lifthrasiir 6y agoHmm, thinking about that I don't really have many. I thought esoteric programming languages are a good source of them, but truly exotic ones turn out to be surpringly rare. 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 https://esolangs.org/wiki/Befunge [2] https://esolangs.org/wiki/Gravity https://esolangs.org/wiki/Gravity [3] https://www.chiark.greenend.org.uk/~sgtatham/infinity.html https://www.chiark.greenend.org.uk/~sgtatham/infinity.html
- pierre 6y agoLogical english by Kowalski (author of iso prolog) go into interesting territory for me https://www.researchgate.net/publication/345770048_Logical_English https://www.researchgate.net/publication/345770048_Logical_E...
- AlexTrask 6y agoIt seems prolog. would be nice to see it working with a big database like wikidata
- prezjordan 6y agoSPARQL isn't too far off! and Wikidata provides a really fun query service for it. https://query.wikidata.org/ https://query.wikidata.org/
- dgb23 6y agoFor those interested in Datalog: 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.
- darksaints 6y agoThose clojure implementations are not datalog. They are an attempt to get datalog-like functionality in a lisp syntax. At best they translate a subset of datalog concepts into a language that is more general purpose in nature.
- lilactown 6y agoIs the definition of datalog tied to the syntax?
- triska 6y agoYes, Datalog is normally understood to be a syntactic subset of Prolog: https://en.wikipedia.org/wiki/Datalog 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.
- deleted 6y ago[deleted]
- dgb23 6y agoI might not be familiar enough to understand what you mean with „subset“. Care to elaborate?
- mlang23 6y agoThanks for sharing, this was an extremely interesting read. I am somewhat confused regarding casing. In particular, the equivalence example is all lowercase, while other examples seem to indicate that variables should be uppercase. Is souffle case-sensitive, or not?
- rajandatta 6y agoI'm not sure I would deem Datalog as 'exotic but to each his own. The real question I have his lessons from the use or attempted to use of Data log in Business, Technology or Academia. Does anyone know of any in-depth articles, papers, books or discussions.
- timgilbert 6y agoThe immutable database Datomic (from Rich Hickey, inventor of Clojure) is all based on datalog, and is fairly popular in the nichey world of Clojure development; there are several other similar datalog-based systems outside of Clojure as well. Various marketing case study blurbs are here if that's your thing: https://www.datomic.com/nubanks-story.html https://www.datomic.com/nubanks-story.html
- bloaf 6y agoI've always been mentally tickled by prologue type systems. I suspect but cannot prove that they would be very useful in conjunction with constrained optimization engines. 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."
- lambda_obrien 6y agoI'm really enjoying this series, mostly because it's by the same person responsible for the best Haskell reference ever, in my opinion: http://dev.stephendiehl.com/hask/index.html http://dev.stephendiehl.com/hask/index.html
- lambda_obrien 6y agoWow, I'm not sure why this was unpopular, does someone want to fill me in?
- carapace 6y agoThe inimitable and ever-present Markus Triska has a fantastic site [1] and he's making some really interesting videos [2] all about Prolog. I got nerd-sniped the other day by the Interval Tree Clocks post ( https://news.ycombinator.com/item?id=25243376 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 https://www.metalevel.at/prolog [2] https://www.youtube.com/channel/UCFFeNyzCEQDS4KCecugmotg/videos https://www.youtube.com/channel/UCFFeNyzCEQDS4KCecugmotg/vid... [3] https://git.sr.ht/~sforman/Prolog-Junkyard/tree/master/miscellaneous/itc.pl https://git.sr.ht/~sforman/Prolog-Junkyard/tree/master/misce... [4] https://news.ycombinator.com/item?id=15473199 https://news.ycombinator.com/item?id=15473199
- dejj 6y agoEnter Mercury-Prolog: https://mercurylang.org/about.html https://mercurylang.org/about.html - "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
- pstuart 6y agoDoes anybody here know of any open source projects that use datalog/prolog/etc and would be comprehensible to mere mortals?
- bawolff 6y agoGerrit used prolog to determine when to merge patches if i recall. I had to learn prolog in university once upon a time, but gerrit is the only time i have ever encountered prolog in the wild, and it only uses it i one small spot.
- pstuart 6y agoThanks. It seems like powerful tech but the fact that it isn't more widespread seems that it's as daunting to others as it is to me :-).
- bawolff 6y agoI think its more just an accident of history - lisp became popular, prolog faded. Sometimes some technologies just happen to fade out due to chance. 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.