|
Treatment of empty string
Shiro Kawai
(24 Feb 2020 20:20 UTC)
|
||
|
Re: Treatment of empty string
John Cowan
(24 Feb 2020 20:24 UTC)
|
||
|
Re: Treatment of empty string
Shiro Kawai
(24 Feb 2020 20:50 UTC)
|
||
|
Re: Treatment of empty string
Per Bothner
(24 Feb 2020 21:22 UTC)
|
||
|
Re: Treatment of empty string
John Cowan
(24 Feb 2020 21:38 UTC)
|
||
|
Re: Treatment of empty string
Shiro Kawai
(24 Feb 2020 22:00 UTC)
|
||
|
Re: Treatment of empty string
Arthur A. Gleckler
(05 Apr 2020 22:47 UTC)
|
||
|
Re: Treatment of empty string Per Bothner (05 Apr 2020 23:41 UTC)
|
||
|
Re: Treatment of empty string
Shiro Kawai
(05 Apr 2020 23:51 UTC)
|
||
|
Re: Treatment of empty string
John Cowan
(06 Apr 2020 19:54 UTC)
|
||
|
Re: Treatment of empty string
Shiro Kawai
(06 Apr 2020 20:11 UTC)
|
||
|
Re: Treatment of empty string
Per Bothner
(06 Apr 2020 21:01 UTC)
|
||
|
(missing)
|
||
|
Re: Treatment of empty string
Per Bothner
(06 Apr 2020 21:49 UTC)
|
||
|
Re: Treatment of empty string
John Cowan
(06 Apr 2020 23:47 UTC)
|
||
On 2/24/20 2:00 PM, Shiro Kawai wrote:
> Literal empty string is immutable, off course. What I meant by "empty string" is something that's returned from (string-copy "abc" 0 0) or even, (string-copy "").
I'm not sure what you're asking or who you're asking.
In srfi-140, (string-copy "") returns an fresh zero-length mutable string.
This is a valid argument to string-append! and string-replace!.
It is not an "empty string" in the R7RS "3.4 storage model" sense.
The following is valid:
(define w (string-copy ""))
(string-append! w "abc")
(string-append! w "xyz")
Also note (not explicitly specified by srfi-140, but I think implied):
(define s1 (string-copy "))
(define s2 (string-copy s1))
(eqv? s1 s2) => #f
(eqv? s1 "") => #f
I don't think the R7RS concept of a string as consisting of a location
per character is appropriate. Better to view a string as a single location.
Literal strings or other istrings that are equal? may be combined
into a single location, at the discretion of the implementation,
but every mstring must be a unique location.
(In fact, I don't see how the idea of a vector or a pair as consisting of
multiple locations gets you anything useful. The definition of eqv? in 6.1
talks about them having a single location.)
--
--Per Bothner
xxxxxx@bothner.com http://per.bothner.com/