guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comparison operators for strings /and/ numbers?


From: David Kastrup
Subject: Re: Comparison operators for strings /and/ numbers?
Date: Thu, 24 Aug 2017 10:05:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Christopher Howard <address@hidden> writes:

> 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.

(use-modules (oop goops))

(define-method (< (a <string>) . rest)
  (apply string<? a rest))

(< "g" "b") ;; => #f

-- 
David Kastrup




reply via email to

[Prev in Thread] Current Thread [Next in Thread]