exercism / vimscript

Exercism exercises in Vim script.
https://exercism.org/tracks/vimscript
MIT License
20 stars 24 forks source link

grains exercise: test against integer values as strings. #326

Closed glennj closed 2 weeks ago

glennj commented 2 weeks ago

To work around Vimscripts 2^63 limit for integers, the tests have been created to expect the integral values as strings.

Following #322

kotp commented 2 weeks ago

Thank you for this @glennj a lot of work when into this to not deviate too far from story, and I think it provides opportunity for learners to stretch their problem solving skills!

blakelewis commented 2 weeks ago

Very nice solution. Thanks!

kotp commented 2 weeks ago

Small typo in instructions.append.md: "beyond the integer size limitation ov Vimscript." As a nitpick, I think that "limit" fits better than "limitation".

There is a typo, but it is likely the change to "of" from "ov".

The "limitation" word is correct, since is a language limitation, not an arbitrary limit.

kotp commented 2 weeks ago

@blakelewis I would accept a patch for this, if you want to correct the "of" word that should be here.

blakelewis commented 2 weeks ago

Sorry, I had two comments. First, change "ov" to "of". Second, I think that the use of strings lets you go past the integer limit. I am not really sure what it means to go "beyond the limitation." One might interpret that as going to even greater limitations! But it is an arguable point and I won't press it.

I can make a patch to fix the typo later today

kotp commented 2 weeks ago

Sorry, I had two comments. First, change "ov" to "of".

This is the patch that I would accept for sure.

Second, I think that the use of strings lets you go past the integer limit. I am not really sure what it means to go "beyond the limitation." One might interpret that as going to even greater limitations! But it is an arguable point and I won't press it.

The limitation of Vimscript in terms of Integers is the reason for the example solution being what it is as a "prove we can solve the exercise as given."

You are, of course, right that we by pass the limitation by using strings, but we will hit another limitation in terms of strings, which we do not even hint here (and it is not important to address for this exercise).

I can make a patch to fix the typo later today

Sounds good. Usually we would discuss it in the forums first, but this patch is very small and discussed here instead, so it will be no problem.