Question

Say I had a fact such as:

bigger(cat,mouse).

If I wanted to describe this to someone, would I be correct in saying "cat is the first term within this fact and mouse is the second term" or would I refer to the cat and mouse as atoms and say "the cat is the first atom within the fact and the mouse is the second".

Was it helpful?

Solution

Your first description is fair, being 'term' a recursive data structure: i.e. a term is either an atom, a number, or a struct, where a struct is 'name(arg1,arg2,...)', and each argument is a term.

So your second description it's more accurate (restricted).

As other answers noted, 'argument' it's the usual naming of positionally identified attributes in structured terms.

OTHER TIPS

argument would be the perfect word I think. But usually to describe a predicate you'd use the following form :

predicate/arity : predicate(arguments...)
description of arguments

Here it'd go something like :

bigger/2 : bigger(Bigger, Lesser)
Holds if Bigger is bigger than Lesser.

Additionally you could precise the mode of the arguments : + for input, - for output, ? for both (and @ for a pure input), refer to @false's answer on this question to get more infos about modes if needed.

Here the complete version could be :

bigger/2 : bigger(?Bigger, ?Lesser)
Holds if Bigger is bigger than Lesser.

To mix things up a bit, I might say bigger is a binary relationship that holds between cat and mouse.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top