13

In case you write Prolog programs regularly you probably have your own library of predicates you always rely on. Some Prolog systems come with a rich set of predefined predicates and some not. Some systems have libraries but they are mostly incompatible with other systems. Also, many existing libraries contain a lot of rarely needed predicates. But then, there are a couple predicates that "should" be always present. And then, there is some progress happening since November like this and Cor.2 (draft). Why not here too?

So what are your favorite predicates? That is predicates, that are not defined in the ISO core.

To start with: between/3, member/2, length/2, dif/2, maplist/2, ...

For DCGs: seq//1, iseq//1, ... //0.


Edit: The first draft of the Prolog prologue can be found here!
Edit: If you want that this question is reopened, please vote to reopen but also help to reformulate the question such that it will not get closed again.
false
  • 10,182
  • 12
  • 93
  • 182
  • 1
    Question or Poll, where is the difference? – Mostowski Collapse Jul 26 '11 at 12:27
  • 1
    The difference might depend on the number of votes to reopen this question. – false Feb 16 '12 at 01:06
  • 2
    jerry-coffin: no "prolog" among top tags. marc-s, gbn, emile-cormier: **no "prolog" among top tags**. liori: 15 upvotes in "prolog" tag. The OP: 261 upvotes in "prolog" tag. What's **WRONG** with that picture?? --- if it is difficult ***for you*** "to tell what is being asked here", maybe it's a good idea to not interfere, instead of clicking on *"CLOSE"* absent-mindedly, on the question which eventually gets upvoted upwards of 10 times and favorited 5 times. – Will Ness Jul 29 '12 at 13:39
  • @Will Ness: Thank you for your support! There is no doubt that Jerry Coffin and the others lack competence in the very subject. But they **do** have a formal point: As is, the question does not conform to SO criteria. SO abhors too chatty questions. What we need is twofold : A reformulation **plus** some SO-"lawyers" to support it. More popular tags have such supporters in abundance and thus can bend and reformulate the rules without breaking them. – false Jul 29 '12 at 22:10
  • I hate wikilawyering, and I'd hate SO-lawyering just as much. People should leave matters alone which they haven't enough expertise in; everyone knows about themselves where they have or have not enough expertise. And what's so horrible about chatty or even trolling questions. I'm for natural selection among questions, I'm against unnatural selection. A bad question will just get ignored all by its own self. – Will Ness Jul 29 '12 at 22:18
  • and I'm not particularly interested in the subject matter of your question here; I just don't like ... well, lawyering - or more precisely, I hate when someone decides for me what I ought or ought not to know. I think unrestricted access to knowledge is sacred, pardon the pathos. – Will Ness Jul 29 '12 at 22:20
  • @Will Ness: This lawyering seems to be the price to pay to avoid the eternal September. In any case, SO-lawyering is too much for me, but I always hope that someone else will do it for Prolog. – false Jul 29 '12 at 22:57

1 Answers1

5

Very good question. In addition to member/2, length/2, maplist/2 (which you already suggest), I recommend transpose/2, as in Haskell. Also memberchk/2, select/3 and append/3. To help users with the survey, could you supply a Prolog program that processes a given Prolog file term by term (clause by clause), records which predicates it defines, keeps track of which predicates it calls, and from that (maybe optionally) subtracts the predicates that are supplied by libraries it explicitly imports? Running such a program on several source files could give a good starting point for a useful "prolog" library for Prolog.

mat
  • 39,707
  • 3
  • 42
  • 68
  • The program you suggest would be a very complex task. After all it would have to treat all different kinds of modules currently in use... – false Jun 23 '11 at 13:24
  • Actually I meant: all different kinds of module systems... – false Jun 23 '11 at 13:30