Hi Urs,
the functions used are built-in so I'd probably also do it (almost) that
way. But I'd strongly recommend to test if obj is a string first:
#(define (integer-string? obj)
(and (string? obj)(integer? (string->number obj))))
Otherwise the predicate fails with an error (not false) if the argument
is something else ... for example an integer.
I doubt that checking all characters in the string are in the range
'0'-'9' is faster then string->number.
Jan-Peter
Am 30.05.2017 um 10:47 schrieb Urs Liska:
Hi all,
I've found this function in my code:
% Returns true if obj is a string representation of an integer
#(define (integer-string? obj)
(integer? (string->number obj)))
and I have the impression there should be a better way with more
built-in functionality to do it.
Any suggestions, or should I simply leave it at that?
Urs
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user