what does slash(/) do in prolog?

operators, prolog

Solution

It doesn't do anything; it's used here to construct pairs, as you already figured.

Since the `/` doesn't occur on the right-hand side of `is` or in another place where arithmetic evaluation is performed, Prolog just produces two-argument terms with `/` as the functor. `/` is used because it can be written infix; `-` is also a popular choice for a generic pair constructor.

Problem

I have this code: ``` set_value(X,Value,[X/_|T],[X/Value|T]). set_value(X,Value,[Y/V|T],[Y/V|NewT):- X\=Y,set_value(X,Value,T,NewT). set_value(X,Value,[],[X/Value]). ``` But I cannot figure out what does / do. It looks like it pairs variables, but I'm not 100% sure. It definitely isn't division operator. Thanks.

Original source