I suspect that like many others I have a fetish for terse code So, every time I type “member”, “aggregate_all”, “findall” and so on, there’s a part of me which protests.
Partly inspired by reading @meditans code, I’m thinking about writing a little private “terse” library I put into everything so that I can write X ∈ Xs rather than member(X, Xs) or ∀(A,B) rather than forall(A,B), and so on. I’m not really concerned about how readable the code is for other people in this instance: its just for me
I wondered if anyone has done this and what their experience was with it? Also I wondered if you’ve perhaps pursued a different route to the same goal?
No rhyme nor reason I guess – I just like maths notation, but anything much shorter than the current predicate names will do. prolog requires a lot of variable chaining so lines can get long pretty quickly.
I’m not finding any help or documentation on “pushback lists”, what are they?
DCGs make sense for some state related things (I think simplex package uses them well for example) . Are there any newb friendly examples of Yan’s approach?
Also user defined operators can be pretty effective at creating DSL’s within a Prolog framework. They would certainly be able to handle your small example. The practical question, at least for me, is how to easily enter these math symbols on a standard keyboard.
You seem to be mainly concerned with the choice of predicate names exported from libraries. Note that many of these names have been around for decades and the names mean something to most users. However, nothing prevents you from doing what you want either by wrapping the targeted predicates with a name of your choice or via goal expansion (at load time).