isaacg1 / pyth

Pyth, an extremely concise language. Try it here:
https://pyth.herokuapp.com/
MIT License
263 stars 57 forks source link

Added Inclusive Ranges #119

Closed Maltysen closed 9 years ago

Maltysen commented 9 years ago

Ranges inclusive of the end value is useful in many golfs, but missing from pyth. We can overload <int> for s and <int, int> for } to accomplish this. I had to make } a c_to_f for this, however. s does [1, a+1] and } does [a, b+1].

isaacg1 commented 9 years ago

I like the } adition, there's no downside there. For s, I don't like that as much. There are cases where you want to call s on an int and have it return itself, such as when you don't know whether a number is an int or a float. I would use the (presently unused) S<int> instead.

Maltysen commented 9 years ago

Done.