On Thu, 24 Aug 2017 14:31:41 +0100
Chris Vine <vine35792...@gmail.com> wrote:
> On Wed, 23 Aug 2017 22:05:37 -0800
> Christopher Howard <christopher.how...@qlfiles.net> wrote:
> > Hi, in another lisp I have been working with, it has <, >, and ==
> > (structure equality) operators which can take string arguments,
> > number arguments, or a mixture of both. But it seems in guile that
> > there are separate comparison operators for strings and for
> > numbers. This makes sense but is not very convenient for my present
> > purpose. Is there some other guile operators or extension operators
> > that will handle both? I could make some I'm sure, but I don't want
> > to reinvent the wheel.  
> 
> The predicate equal? will compare numbers, strings and records.
> 
> https://www.gnu.org/software/guile/docs/master/guile.html/Equality.html#index-equal_003f

I meant to add, but failed to do so, that as far as I am aware there is
no built-in polymorphic < or > procedure that will take strings as well
as numbers.  As a simple work-around you could use type predicates in a
cond expression to dispatch the appropriate comparison procedure for
the type in question.

Chris

Reply via email to