Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
between when +High is infinite
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
metaperl  
View profile  
 More options Nov 4, 11:34 am
Newsgroups: comp.lang.prolog
From: metaperl <scheme...@gmail.com>
Date: Wed, 4 Nov 2009 08:34:17 -0800 (PST)
Local: Wed, Nov 4 2009 11:34 am
Subject: between when +High is infinite
re: http://www.swi-prolog.org/pldoc/man?predicate=between%2f3

I wrote a simple program to play with the mundane use of this
predicate:
someio :- between(2,5,X), write(X), nl, fail.

But I dont understand the practical use of making the second argument
infinite:
between(X,infinite,Y)

And I also dont understand what the docs are saying exactly:
"""If High is inf or infinite, between/3 is true iff Value >=Low, a
feature that is particularly interesting for generating integers from
a certain value."""


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ulrich Neumerkel  
View profile  
 More options Nov 4, 1:56 pm
Newsgroups: comp.lang.prolog
From: ulr...@mips.complang.tuwien.ac.at (Ulrich Neumerkel)
Date: Wed, 04 Nov 2009 18:56:30 GMT
Local: Wed, Nov 4 2009 1:56 pm
Subject: Re: between when +High is infinite

Many implementations of between/3 do not have this feature.
For this reason I write length(_, N).  This is very useful in
situations where you are searching for counterexamples.

Concerning between/3, it is not clear whether or not the name
infinite or inf is ideal,  since in clpfd implementations inf
refers to the infimum.  I.e.,

?- X #< 2.
X in inf..1.

Whereas the other side is called sup:

?- X#> 1.
X in 2..sup.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jan Wielemaker  
View profile  
 More options Nov 5, 10:19 am
Newsgroups: comp.lang.prolog
From: Jan Wielemaker <j...@hppc323.few.vu.nl>
Date: 5 Nov 2009 15:19:40 GMT
Local: Thurs, Nov 5 2009 10:19 am
Subject: Re: between when +High is infinite
On 2009-11-04, metaperl <scheme...@gmail.com> wrote:

> re: http://www.swi-prolog.org/pldoc/man?predicate=between%2f3

> I wrote a simple program to play with the mundane use of this
> predicate:
> someio :- between(2,5,X), write(X), nl, fail.

> But I dont understand the practical use of making the second argument
> infinite:
> between(X,infinite,Y)

> And I also dont understand what the docs are saying exactly:
> """If High is inf or infinite, between/3 is true iff Value >=Low, a
> feature that is particularly interesting for generating integers from
> a certain value."""

Typically, you need this if you want to generate increasing integers
until some condition is met and you have no clue when that will be.
So, you write

        ...
        between(0, infinite, N),
        is_this_want_i_want(N), !,
        ...

Using infinite is a bit more informative than writing this, even if you
know that 1 million is plenty. Of course, the downside is that the above
is a nearly infinite loop if is_this_want_i_want/1 never succeeds
(nearly, because memory is finite and the increasing N will keep using
more :-)

        between(0, 1000000, N),

        --- Jan


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google