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)
|
Like with string-split (see separate reply) the specification for string-unfold-right was copied (without much thought) from SRFI-135's text-unfold-right: https://srfi.schemers.org/srfi-135/srfi-135.html#text-unfold-right I don't think reversing the characters in a string is a useful operation, so I don't think we should reverse the sub-string returned by the mapper. I.e. the Kawa implementation is correct. However, I could be convinced if reversing makes the procedure more useful. On 3/2/20 3:12 PM, Arthur A. Gleckler wrote: > Per, when you have a chance, would you please reply to Chris's comments below? > > Thanks. > > On Sun, Nov 17, 2019 at 6:34 PM Chris Hanson <xxxxxx@chris-hanson.org <mailto:xxxxxx@chris-hanson.org>> wrote: > > 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. > -- --Per Bothner xxxxxx@bothner.com http://per.bothner.com/