isaacg1 / pyth

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

Remove useless functions. #108

Closed orlp closed 9 years ago

orlp commented 9 years ago

Making a separate issue for this. Right now we have a couple culprits:

I don't have a great idea of where to put the seeding of .x. I think we should rename .u to .* however.

isaacg1 commented 9 years ago

How about putting .x seeding into S - S has no function on ints, and it's mnemonic.

isaacg1 commented 9 years ago

Or O on negative inputs?

orlp commented 9 years ago

@isaacg1 I'm not certain about the negative input to O, but definitely not S. That instruction is way too valuable to waste on seeding.

isaacg1 commented 9 years ago

OK, I like O on negative inputs, because we're already breaking up O on ints between positive results, which are used as ranges, and 0, which is used to get a random float between 0 and 1.

orlp commented 9 years ago

Negative sound good, but I do suggest that O_1 becomes random.seed(1), not random.seed(-1).

I'll work on a commit, give me a few.

isaacg1 commented 9 years ago

Agreed.

isaacg1 commented 9 years ago

What should the return value be? The input? 0? The seed? I like the seed.

orlp commented 9 years ago

@isaacg1 Hrm, whatever it is, I don't want it autoprinted, I think.

isaacg1 commented 9 years ago

Unfortunately, if we go with O, autoprinting is unavoidable. Autoprinting doesn't seem the inputs to the function. To avoid autoprinting, we should select a different function.

orlp commented 9 years ago

@isaacg1 No, we could make O_1 return None, and disable printing of anything that returns None at the top level.

At least, I don't think Pyth uses None anywhere, but if it's a valid value we can also create a custom type, DoNotPrint or something.

isaacg1 commented 9 years ago

Hm. Yes, that seems like a good solution. I forgot that we could just change Pprint.

orlp commented 9 years ago

@isaacg1 None or a custom DoNotPrint type? I personally None.

isaacg1 commented 9 years ago

None. I can't think of a good reason to print None, even if it is currently possible, which I'm not sure of.

isaacg1 commented 9 years ago

Implemented.

orlp commented 9 years ago

@isaacg1

I'll work on a commit, give me a few.

:(

isaacg1 commented 9 years ago

Sorry about that - I'd mostly already done it all before I even started commenting.