On 12/14/2015 05:12 PM, Damien MATTEI wrote:
thanks
i finally wrote one code version doing it:
(define (read-counter-value fn)
(define cf &<{&[fn]})
(define toStringCF (gnu.lists.Blob:toString (->string cf)))
That is redundant, as you're probably guessing. Looks like you've
been experimenting - but now your code can be cleaned up. :-)
The reason ->string is a no-op on cf is because the Blob is
already a string, because Kawa considers any java.lang.CharSequence
to be a string. Thus java.lang.String, gnu.lists.FString, and
gnu.lists.Blob are all strings (in the Scheme sense) but only
gnu.lists.FString is a mutable (modifiable) string.
For example you can call string-ref and string-length (but not
string-set!) on a Blob.
If you want a java.lang.String, you can just do:
(gnu.lists.Blob:toString cf)
or just:
(cf:toString)
(define toFStringCF (gnu.lists.FString toStringCF))
So you only need to convert toStringCF (or for that matter cf)
you actually want an FString - i.e. you want to modify it, which
you usually don't.