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,
     the result is the same as sort/2.  See also keysort/2.

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,
>     the result is the same as sort/2.  See also keysort/2.

>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,
>     the result is the same as sort/2.  See also keysort/2.

>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,
>      the result is the same as sort/2.  See also keysort/2.
> 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  
 
 [ 4 post ] 

 Relevant Pages 

1. Need SWI-Prolog.h for SWI 1.8.11

2. Updating VHDL-93 Parser in SWI-Prolog

3. VHDL-93 Parser in SWI-Prolog

4. PyLog, not require SWI-Prolog right?

5. Stack Overflow in SWI-Prolog

6. Ann: SWI-Prolog 5.2.0/XPCE 6.2.0

7. (SWI-Prolog) Problems with constructor of PlEngine

8. SWI-Prolog - VB

9. Beginner's question on SWI Prolog

10. SWI-Prolog.. Making scenarios longer than one input

11. SWI Prolog Chatterbot Embedded in HTML??

12. How to reset PlEngine? (SWI-Prolog)

 

 
Powered by phpBB® Forum Software