119 karma · joined September 21, 2020
The relevance to TFA is the difficulty of recovering the arts of ship construction lost to offshoring, financial engineering, politics, whatever. And it's a great read.
[1] https://www.lrb.co.uk/the-paper/v44/n18/ian-jack/chasing-ste...
I always felt this stuff would make a better foundation for web layouts than CSS.
[1] https://dl.acm.org/doi/pdf/10.1145/800068.802148
[2] Logic programming, graphics and infinite terms P. R. Eggert, K. P. Chow Department of Computer Science University of California, Santa Barbara UCSB DoCS TR 83-02 June 1983.
https://isabelle.in.tum.de/website-Isabelle2020/dist/library...
https://lawrencecpaulson.github.io/2021/12/01/Undefined.html
https://www.hillelwayne.com/post/divide-by-zero/
https://xenaproject.wordpress.com/2020/07/05/division-by-zer...
You'll need to do some thinking/proof to find out if it works for you.
> The first step is to measure whatever can be easily measured. This is ok as far as it goes.
> The second step is to disregard that which can't be easily measured or to give it an arbitrary quantitative value. This is artificial and misleading.
> The third step is to presume that what can't be measured easily really isn't important. This is blindness.
> The fourth step is to say that what can't be measured really doesn't exist. This is suicide.
If this isn't a firm requirement, perhaps you can dig into the venerable state machine notations of yesteryear. For instance ARGOS [1] and StateCharts [2]. The latter got incorporated into UML somehow [3] IIRC. Esterel [4] is a bit mind blowing.
Other people prefer dataflow, in which case Lustre [5] might be worth a look.
These make a strong synchrony hypothesis which may or may not apply to your situation. But if it does you're in clover. And if you're not you can still try to use this stuff in a GALS [6] architecture.
[1] https://dl.acm.org/doi/10.1016/S0096-0551%2801%2900016-9 (and google some more) [2] https://statecharts.dev/ [3] https://en.wikipedia.org/wiki/UML_state_machine [4] https://en.wikipedia.org/wiki/Esterel [5] https://en.wikipedia.org/wiki/Lustre_(programming_language) [6] https://en.wikipedia.org/wiki/Globally_asynchronous_locally_...
Prolog has predicates, not functions. (It has uninterpreted function symbols -- aka functors in this context.) It's based on first-order logic, i.e., it has nothing higher order in it, if you want to take it (formally) seriously. But of course there is `call/1` and so forth, which are just hacks... err, "non declarative".
There are some interesting higher-order logic programming languages, e.g. Mercury. I like the approach taken by HiLog [1] as it struck me as (semantically) honest and simple. I don't know if it's usable.
[1] Tech report: https://cpsc.yale.edu/sites/default/files/files/tr237.pdf
[2] There have been attempts to build declarative debuggers for other languages but for one reason or another (complexity, space use, incomplete coverage of the language, ...) they don't appear to get used very widely. Shapiro's setup is beautifully simple for what it does.
Here "declarative" means that you have a model in mind ("model" in the sense of logic, i.e., you expect your predicates to hold of particular arguments) and the tool helps you explore the divergence between what you wrote and what you intended. Thinking this way means you can completely ignore the details of SLD-NF resolution (the details of the Prolog implementation)... I mean, it's unlikely to be perfect in practice for any number of reasons, but I find it very disappointing that we don't dream like this any more.
As for modes, well! 1. they were needed for at least one Uni of Melbourne person to receive their PhD degree, and less facetiously 2. they are needed for efficient code generation. They can be inferred for this purpose. One use case you may consider is enforcing the correct dataflow in a DCG. Otherwise they are handy for preventing calls to predicates that would not terminate.
I've never programmed in Mercury but it really looks like an ML to me. It was beautifully engineered in the late 1990s and it's a shame it hasn't received more attention. Its FFI influenced the development of Haskell's.
[1] https://www.sciencedirect.com/science/article/pii/0743106694...
You can try running with what wikipedia says [1] or stack overflow [2]. You could say it's PL marketing terminology from the 1980s and 1990s (FP + Prolog v the world). Roughly these languages aren't based on the idea of changing state, but of course that idea eventually ends up in there somewhere (e.g. monads and laziness in Haskell, DCGs in Prolog).
On the positive side, I'd be comfortable saying that SQL is declarative.
I'd be wary about bringing Turing completeness in here. It seems irrelevant.
[1] https://en.wikipedia.org/wiki/Declarative_programming
[2] https://stackoverflow.com/questions/129628/what-is-declarati...
This is true of most (all?) languages. Prolog's control flow is ultimately not too different from the usual stack-based semantics people are used to from imperative languages like C (if you're not too ambitious with the backtracking; if you are, best of luck!). The tricky part is perhaps understanding the dataflow that arises from unification. That can be arbitrarily complex but it seems people tend to go no further than difference structures, which are easy to comprehend in terms of pointers. (Yes yes I know, but logic variables are essentially just single-assignment pointers.)
The thing I find deeply weird about the logic programming literature is that if you want to reason about your program you're told to use things like Hoare logic [1] or intended interpretations [2] and not fundamental logical concepts like implementations implying specifications (ala Lamport and many others who grappled with refinement).
[1] see Krzysztof Apt's papers
[2] see e.g. https://people.eng.unimelb.edu.au/lee/papers/dd.html
IMHO it's worth learning about Prolog as a way of looking at the world -- for instance Isabelle and Lambda Prolog are essentially logic programming engines, albeit with more sophisticated terms and unification algorithms.
[2] https://www.hpl.hp.com/techreports/Compaq-DEC/PRL-RR-36.pdf
As for laziness, things don't work out too well for a variety of reasons. Bob Harper laid out several many years ago. See e.g. https://news.ycombinator.com/from?site=existentialtype.wordp...
For all that you're dead right about Python.
https://www.google.com/search?q=red+plenty
It's a fictionalised history of some Soviet economics. There's a chapter on Kantorovich (cf the sibling comment). It goes reasonably deep (not mathematically deep) and provides a lot of context. Great book from a great author. Don't be put off by the "Soviet" part -- it's very entertaining.
https://www.abc.net.au/news/science/2021-09-19/solar-panels-...
Also I think Delhi's air pollution is the worst of the major cities now.