4 ms·
I feel your pain. For me the worse case of this is web dev, where there's a different language for every task: html, CSS, javascript, SQL, your back-end languag
by YeGoblynQueenne 7y ago
I feel your pain. For me the worse case of this is web dev, where there's a different language for every task: html, CSS, javascript, SQL, your back-end language, XML, JSON, and so on.
But, Swi has my back on that, too:
https://www.swi-prolog.org/FAQ/PrologLAMP.txt https://www.swi-prolog.org/FAQ/PrologLAMP.txt
Can I replace a LAMP stack with SWI-Prolog?
Yes, you can, and you'll be happier for it.
LAMP is short for the following open source components to realise a web
server:
Linux
Apache
MySQL
PHP
In this picture, Linux provides the OS, Apache the web server, MySQL the
database and PHP server-side scripting facilities. In fact, most of these
components can be replaced. One can replace Linux with almost any other OS,
Apache with Nginx, MySQL with PostgreSQL. PHP is similar to ASP.
There are also larger replacements of this stack, such as Tomcat, which
replaces both Apache and PHP. Similar architectures are available for Python
(django), Ruby (Ruby on Rails) etc. As we will see below, this is the picture
into which SWI-Prolog fits.
The SWI-Prolog web framework
The SWI-Prolog web framework (obviously) does not replace the OS. It does
replace Apache, PHP and to some extent MySQL. We could refer to the stack as
LP (Linux Prolog). Below, we point at the various libraries that make up the
stack and relate them to the LAMP components they replace.
You can't quite replace html/css/js of course, since the browsers depend on them- but they can be embedded in Prolog easily. I believe the http library in my other comment here has facilities to do this.
Also- if you ever need to write a parser for some topsy-turvy ad-hoc markup language some third-party is using that you are forced to process, Prolog is probably the best language to do this, thanks to its Definite Clause Grammars notation that's basically BNF, except that it's not restricted to context-free grammars:
https://en.wikipedia.org/wiki/Definite_clause_grammar https://en.wikipedia.org/wiki/Definite_clause_grammar
- martinlaz 7y ago> We could refer to the stack as LP (Linux Prolog). Nice pun (not sure if intended).
- choward 7y agoPlease don't format your comments like this. Nobody is going to read it on mobile.
- jlarocco 7y agoWhat's the problem, exactly? He's quoting a paragraph out of a document, and appropriately used a blockquote... Maybe it's a bug on your phone or the HN codebase?
- NextHendrix 7y agoOn mobile it doesn't wrap, and renders in a very narrow frame that must be scrolled sideways, which is a faff especially in portrait mode.
- YeGoblynQueenne 7y agoWho's he? :)
- deleted 7y ago[deleted]
- j88439h84 7y agoHn doesn't support block quotes
- derefr 7y agoI've always wondered why support wasn't added. It's a very simple change to add them; and everyone continuously tries-and-fails to use them. @dang et al, is there nobody on your side who can make little patches like this to "pave the well-trod path"?
- YeGoblynQueenne 7y agoSorry about that, but that's 78-character columns, plus two columns for indentation. It's not too wide. Also, I hope I'm not rude to point out that I expect people interested in an article on Prolog to have a non-phone computer that they can read this more comfortably on.
- tyre 7y agoI can confirm that it’s difficult to read on mobile. I do have a laptop, of course, but I’m not always near it. Mobile web is not a niche use case in 2020.
- hn_throwaway_99 7y agoWhile I generally agree with your comments, I am currently working on a project with a React front-end in Typescript and a Node back-end in Typescript, the first time I've ever had the same primary language everywhere. It is a HUGE productivity boost, and most importantly makes it much easier for anyone on the team to review and understand pretty much any area of the codebase. Folks should not underestimate the benefits of having a single primary common language everywhere.
- YeGoblynQueenne 7y agoThen we agree, no?
- smush 7y ago> Folks should not underestimate the benefits of having a single primary common language everywhere. Indeed, that's why I'm getting past my static HTML comfort zone and trying out the SAFE template for F# development on both client and server via .NET Core. Super new at it, but excited to learn. Apparently there is this thing out there called Fable that lets you use the same domain types on both client and server, now THAT sounds like fun to me.