I agree with Nils.  I just started using forall and exists and found
it stupid to have to append [0] to get the boolean value.  And given
their existence I never looked further to find the python any()  and
all() functions.

On 30/01/2008, Nils Bruin <[EMAIL PROTECTED]> wrote:
>
> On Jan 30, 2:49 pm, "Mike Hansen" <[EMAIL PROTECTED]> wrote:
> [...]
> > name. Also, there are functions in Python which have similar
> > functionality.
> >
> > sage: l = [1,2,3]
> > sage: any([i == 2 for i in l])
> > True
> > sage: all([i == 2 for i in l])
> > False
>
> That's instructive. In that case, forall and exists should probably
> have their help extended by a pointer that if a witness is not
> required, the user should type:
>
> any(P(s) for s in S)
>
> or
>
> all(P(s) for s in S)
>
> That's actually a nicer syntax anyway and it would be a shame if
> people keep hobbling along with forall and exists when there is a much
> nicer option. (I got a tab completion hit on "forall" and "exists" and
> assumed those were the right functions to use. They are often not).
> That teaches me to *not* write patches :-)

On the contrary!  But change it to a patch for the docstrong for
exists() and forall().

John


>
> > On Jan 30, 2008 2:45 PM, Nils Bruin <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Presently, because forall and exists return tuples rather than
> > > booleans, their return value is always True, so they cannot be used as
> > > a predicate, which is very unintuitive given their names. Proposed
> > > solution: optional parameter witness (default: False) that determines
> > > return value type.
> >
> > > Ticket (has patch)
> >
> > >http://trac.sagemath.org/sage_trac/attachment/ticket/1987
> >
>


-- 
John Cremona

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to