predsort and swi?
Author Message
predsort and swi?

Hi,
how do I set up a predicate for predsort/3 in swi?

manual says:
predsort(+Pred, +List, -Sorted)
Sorts  similar to sort/2, but determines  the order of two terms  by
calling  Pred(-Delta, +E1, +E2).   This call  must unify Delta  with
one  of <, const>  or =.  If  built-in predicate compare/3 is  used,

But what is "one of <, const>  or =."?
I get errors when I do  "Delta is <" or (<) or anything
else.
Any example of use for this?

this is not a bug in swi-3.3.8, is it?

thanks
martin

Wed, 07 May 2003 11:31:15 GMT
predsort and swi?

Quote:

>how do I set up a predicate for predsort/3 in swi?

>manual says:
> predsort(+Pred, +List, -Sorted)
>     Sorts  similar to sort/2, but determines  the order of two terms  by
>     calling  Pred(-Delta, +E1, +E2).   This call  must unify Delta  with
>     one  of <, const>  or =.  If  built-in predicate compare/3 is  used,

>But what is "one of <, const>  or =."?

The `const' bit looks like a formatting error or a typo.
It should say "one of '<', '>', or '='."

Quote:
>I get errors when I do  "Delta is <" or (<) or anything
>else.

'is'/2 requires that its right-hand argument be a valid expression.
You should just use '='/2 rather than 'is'/2.

--

|  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

Wed, 07 May 2003 13:44:08 GMT
predsort and swi?
"On 18 Nov 2000 04:31:15 +0100, Martin Dieringer

Quote:

>Hi,
>how do I set up a predicate for predsort/3 in swi?

>manual says:
> predsort(+Pred, +List, -Sorted)
>     Sorts  similar to sort/2, but determines  the order of two terms  by
>     calling  Pred(-Delta, +E1, +E2).   This call  must unify Delta  with
>     one  of <, const>  or =.  If  built-in predicate compare/3 is  used,

>But what is "one of <, const>  or =."?
>I get errors when I do  "Delta is <" or (<) or anything
>else.
>Any example of use for this?

>this is not a bug in swi-3.3.8, is it?

>thanks
>martin

I'm just a newbie but what about ..
"Delta = < "  ??

Wed, 07 May 2003 03:00:00 GMT
predsort and swi?

Quote:

> Hi,
> how do I set up a predicate for predsort/3 in swi?
> manual says:
>  predsort(+Pred, +List, -Sorted)
>      Sorts  similar to sort/2, but determines  the order of two terms  by
>      calling  Pred(-Delta, +E1, +E2).   This call  must unify Delta  with
>      one  of <, const>  or =.  If  built-in predicate compare/3 is  used,
> But what is "one of <, const>  or =."?
> I get errors when I do  "Delta is <" or (<) or anything
> else.
> Any example of use for this?

use one of:

'<'
'>'
'='

GJ

--
Gertjan van Noord Alfa-informatica, RUG,  Postbus 716, 9700 AS Groningen
vannoord at let dot rug dot nl            http://www.let.rug.nl/~vannoord

Wed, 07 May 2003 03:00:00 GMT

 Page 1 of 1 [ 4 post ]

Relevant Pages