Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roman-numerals: No test cases for Nothing? #460

Closed
abo64 opened this issue Dec 19, 2016 · 14 comments
Closed

roman-numerals: No test cases for Nothing? #460

abo64 opened this issue Dec 19, 2016 · 14 comments
Labels

Comments

@abo64
Copy link
Contributor

abo64 commented Dec 19, 2016

The return type of Roman (numerals) has been changed to a Maybe, but there are no test cases for Nothing? Shouldn't we add some for this to make more sense?

Another question that came to my mind: This exercise (or a new one) could also include the inverse conversion from Roman numeral to an Int? Would be cheap to add as one could just reuse the existing test cases.

@abo64 abo64 added the question label Dec 19, 2016
@rbasso
Copy link
Contributor

rbasso commented Dec 19, 2016

The return type of Roman (numerals) has been changed to a Maybe, but there are no test cases for Nothing?

This was the result of the discussion in #304, implemented in #328.

This way the type shows that the conversion is not always possible, but leave students the ability to extend the solution, dealing with numbers bigger than 3000.

Shouldn't we add some for this to make more sense?

I would avoid testing against anything bigger than 3000.

About zero and negative numbers, @petertseng's comment summarizes the options.

Another question that came to my mind: This exercise (or a new one) could also include the inverse conversion from Roman numeral to an Int? Would be cheap to add as one could just reuse the existing test cases.

Seems a nice idea!

toRoman and fromRoman?

@rbasso
Copy link
Contributor

rbasso commented Dec 19, 2016

It would be nice if Haskell had a type for strictly positive numbers...

For non-negatives I found Natural, that now is part of base, but that still leaves zero. I guess what I really want are dependent types. :)

@abo64
Copy link
Contributor Author

abo64 commented Dec 19, 2016

@rbasso Yes, that would be nice. Or have a Bounded instance for now? :)

toRoman and fromRoman sounds good.
What about changing x-common, too?

@rbasso
Copy link
Contributor

rbasso commented Dec 19, 2016

What about changing x-common, too?

Not sure if we should do that. Dealing with exceptional values is very language-dependent, and some languages are probably using unsigned numbers and cannot test for negatives.

@abo64
Copy link
Contributor Author

abo64 commented Dec 19, 2016

@rbasso No, I meant about adding fromRoman?

@rbasso
Copy link
Contributor

rbasso commented Dec 19, 2016

Did you find anything there that makes reference to the direction of the conversions?

Edit: If you want to make it clearer there that the conversion can be made in both direction, of course it can be changed. 👍

@abo64
Copy link
Contributor Author

abo64 commented Dec 19, 2016

Is that something that could be discussed on gitter/exercism/dev?

@rbasso
Copy link
Contributor

rbasso commented Dec 19, 2016

Sure!

@abo64
Copy link
Contributor Author

abo64 commented Dec 28, 2016

What shall we do about this one?
The gitter/exercism/dev discussion didn't really pan out (yet?).

@rbasso
Copy link
Contributor

rbasso commented Dec 28, 2016

It seems that fromRoman was not so popular there, so I don't think that the idea of changing it in x-common will go forward.

The conversion from roman numerals seems to be a very different problem from the reverse one, and is also a little harder, right? So I see the point that it may not be part of the same exercise.

What I think that makes it interesting is that it parses in a very unusual way, e.g.:

CIIX = C + (IIX) = C + (X - (II)) = C + (X - (I + I))

But I don't know if that, by itself, will make an interesting exercises.

In fact, I have no idea of what makes a problem interesting and sometimes I get really surprised about some exercises. For example, all-your-base is less interesting than I expected, but leap and raindrops are much better than I imagined.

@abo64
Copy link
Contributor Author

abo64 commented Dec 28, 2016

Don't know if I understand you here correctly: Isn't CIIX just invalid and should result in a Nothing?

But I agree that fromRoman is actually a different exercise, too far away from toRoman.

I guess what is interesting is a matter of individual taste and knowledge (and what effort you are willing to invest) more than anything else. A beginner will probably come to a very different judgement from yours. :)

@rbasso
Copy link
Contributor

rbasso commented Dec 28, 2016

Sorry...bad example. Invalid. :)

@abo64
Copy link
Contributor Author

abo64 commented Dec 28, 2016

In fact I do have a local x-common/exercises/roman-decode ready.
I am only a bit afraid about the possible PR discussions and changes. To contribute to x-common seems somewhat difficult at times with all the different people and their opinions. :)

@rbasso rbasso closed this as completed Jan 19, 2017
@petertseng
Copy link
Member

If the thought is that fromRoman would not be accepted to x-common, then as of exercism/DEPRECATED.trackler#24 it is possible to this track to define it as a track-specific exercise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants