Live data from Hacker News

Show HN: Writing an HTTP server in Prolog

jamesbvaughan.com

41–50 of 74 posts

Re: Show HN: Writing an HTTP server in Prolog

#42
post #31

Earlier quoted context omitted.

A very interesting aspect of Prolog is how its primary primitive is backtracking search. This is orders of magnitude more complex than C-language style primary primitives which closely match single machine instructions. Or even slightly more complex models in lazy languages like Haskell. It's strange that you can build a language almost purely off of graph search yet have it be generally useful. Makes you wonder what…

There's at least one language (Refal: there may be more!) based on Markov algorithms. Another language (XL: as far as I know this is the only one of its breed thus far) works at its core on parse tree substitution. Yet another (CHR) does a weird generalization of term re-writing to provide a toolkit for making constraint languages. (Yes, a language to make languages.) There's a reason I've become a programming langua…

>(Yes, a language to make languages.)

Are there any other languages that are mainly designed with the goal of making it easier to make other general-purpose languages (as opposed to languages for DSLs or parser generation etc.)?

I know that generally many languages are written in C or compile to C, and that Lisp can also be used to make other languages or sub-languages.

But asking about languages (mostly) dedicated for that purpose - creation of new general-purpose programming languages.

Re: Show HN: Writing an HTTP server in Prolog

#43

.pl is perl, use .pg for prolog

Amusingly perl's documentation says .pl is for a perl library and perl scripts should be .plx (for perl executable).

So nobody pays attention to that rule anyway.

I do get slightly confused switching between #perl and ##prolog on freenode sometimes, but the other regulars just laugh at me and we move on ;)

Re: Show HN: Writing an HTTP server in Prolog

#44
post #42

Earlier quoted context omitted.

There's at least one language (Refal: there may be more!) based on Markov algorithms. Another language (XL: as far as I know this is the only one of its breed thus far) works at its core on parse tree substitution. Yet another (CHR) does a weird generalization of term re-writing to provide a toolkit for making constraint languages. (Yes, a language to make languages.) There's a reason I've become a programming langua…

>(Yes, a language to make languages.) Are there any other languages that are mainly designed with the goal of making it easier to make other general-purpose languages (as opposed to languages for DSLs or parser generation etc.)? I know that generally many languages are written in C or compile to C, and that Lisp can also be used to make other languages or sub-languages. But asking about languages (mostly) dedicated f…

People sometimes say ML is aimed at compiler writing.

Re: Show HN: Writing an HTTP server in Prolog

#46
post #42

Earlier quoted context omitted.

There's at least one language (Refal: there may be more!) based on Markov algorithms. Another language (XL: as far as I know this is the only one of its breed thus far) works at its core on parse tree substitution. Yet another (CHR) does a weird generalization of term re-writing to provide a toolkit for making constraint languages. (Yes, a language to make languages.) There's a reason I've become a programming langua…

>(Yes, a language to make languages.) Are there any other languages that are mainly designed with the goal of making it easier to make other general-purpose languages (as opposed to languages for DSLs or parser generation etc.)? I know that generally many languages are written in C or compile to C, and that Lisp can also be used to make other languages or sub-languages. But asking about languages (mostly) dedicated f…

Lisp. Clojure for instance has a built in logic language called miniKanren

Re: Show HN: Writing an HTTP server in Prolog

#47

James, check out Mercury next as it's a faster, better Prolog with some industrial use. https://mercurylang.org

Last time I looked (admittedly years ago), it wasn't an unambiguously "better Prolog", because Mercury's static mode system couldn't capture all of what Prolog can do with unification.

I'm repeating what most users told me. This is a new one on me. Care to elaborate?

Re: Show HN: Writing an HTTP server in Prolog

#48

Earlier quoted context omitted.

Last time I looked (admittedly years ago), it wasn't an unambiguously "better Prolog", because Mercury's static mode system couldn't capture all of what Prolog can do with unification.

I'm repeating what most users told me. This is a new one on me. Care to elaborate?

A common Prolog programming pattern involves creating a partially instantiated term (a "structure" with "holes") and filling in the details later. This can improve expressivity, composability, and performance.

For example, this code:

    L = [_,_,_], maplist(p, L)
enumerates all three-element lists whose members satisfy the predicate p. This technique is impossible in Mercury because it does not allow terms with holes.

Of course you can still compute the same result in Mercury, but you will have to do more work: I think you would have to write a specialized predicate instead of using a higher-order predicate from the library.

Re: Show HN: Writing an HTTP server in Prolog

#49
post #42

Earlier quoted context omitted.

There's at least one language (Refal: there may be more!) based on Markov algorithms. Another language (XL: as far as I know this is the only one of its breed thus far) works at its core on parse tree substitution. Yet another (CHR) does a weird generalization of term re-writing to provide a toolkit for making constraint languages. (Yes, a language to make languages.) There's a reason I've become a programming langua…

>(Yes, a language to make languages.) Are there any other languages that are mainly designed with the goal of making it easier to make other general-purpose languages (as opposed to languages for DSLs or parser generation etc.)? I know that generally many languages are written in C or compile to C, and that Lisp can also be used to make other languages or sub-languages. But asking about languages (mostly) dedicated f…

The K framework: http://www.kframework.org/index.php/Main_Page It's a system for formally expressing the semantics of programming languages and getting an interpreter.

That said, the parent's claim about CHR is rather broad, and you may have read too much into it. It's a library for writing new constraint programming libraries for Prolog. Combined with operator overloading, you get embedded DSLs for constraint systems. That's great, and it is "language development" in some sense. But CHR is not a tool for implementing interpreters or compilers for new programming languages (though it may be useful for some subtasks).

Re: Show HN: Writing an HTTP server in Prolog

#50
post #42

Earlier quoted context omitted.

>(Yes, a language to make languages.) Are there any other languages that are mainly designed with the goal of making it easier to make other general-purpose languages (as opposed to languages for DSLs or parser generation etc.)? I know that generally many languages are written in C or compile to C, and that Lisp can also be used to make other languages or sub-languages. But asking about languages (mostly) dedicated f…

The K framework: http://www.kframework.org/index.php/Main_Page It's a system for formally expressing the semantics of programming languages and getting an interpreter. That said, the parent's claim about CHR is rather broad, and you may have read too much into it. It's a library for writing new constraint programming libraries for Prolog. Combined with operator overloading, you get embedded DSLs for constraint system…

Yes, I did get that from what he said about CHR - it is constrained (heh) to that area of constraint systems.

Interesting about the K framework, thanks. Will take a look. That's the sort of thing I was asking about - if such existed.

Post reply on HN