string-unfold-right Chris Hanson (18 Nov 2019 02:34 UTC)
|
Re: string-unfold-right
Arthur A. Gleckler
(02 Mar 2020 23:12 UTC)
|
Re: string-unfold-right
Per Bothner
(02 Mar 2020 23:45 UTC)
|
Re: string-unfold-right
Shiro Kawai
(03 Mar 2020 05:12 UTC)
|
Re: string-unfold-right
Chris Hanson
(03 Mar 2020 08:29 UTC)
|
Re: string-unfold-right
Shiro Kawai
(03 Mar 2020 08:54 UTC)
|
Re: string-unfold-right
Arthur A. Gleckler
(03 Mar 2020 15:06 UTC)
|
Re: string-unfold-right
Per Bothner
(04 Mar 2020 07:04 UTC)
|
Re: string-unfold-right
Arthur A. Gleckler
(04 Mar 2020 20:39 UTC)
|
Re: string-unfold-right
Per Bothner
(04 Mar 2020 21:07 UTC)
|
Re: string-unfold-right
Arthur A. Gleckler
(04 Mar 2020 21:33 UTC)
|
Re: string-unfold-right
Per Bothner
(04 Mar 2020 22:40 UTC)
|
Re: string-unfold-right
John Cowan
(05 Mar 2020 00:34 UTC)
|
Re: string-unfold-right
Arthur A. Gleckler
(05 Mar 2020 05:59 UTC)
|
I'm implementing this SRFI and have noticed an ambiguity in the specification. string-unfold-right specifies that the results of the mapper procedure are accumulated from right to left in the result. When the mapper returns a character, that's not a problem, and the specification is clear. However, when the mapper returns a string, it's not specified how the characters of the string are accumulated. One might imagine the characters being prepended to the result one at a time in reverse order, as if it was returned by multiple calls to the mapper in the string order, or the string might be simply prepended to the output being built. I see that Kawa implements the latter. I don't care what the actual semantics are, as long as they are clearly specified. I suppose it's worth spelling out for string-unfold too, though in that case it seems like the obvious solution is to just append the string, since the two orders are congruent. Another concern would be whether someone expects that string-unfold and string-unfold-right have some kind of deep symmetry, in which the resulting strings are the reverse of one another, even when some mapper values are strings. In that case it might be more elegant to prepend the string's characters in reverse order rather forward order. I'm not making that argument, though I can understand the appeal. I just want a clear specification.