isaacg1 / pyth

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

Moved factorial to *F #244

Closed Maltysen closed 6 years ago

Maltysen commented 6 years ago

There's already some special casing for * in F, so I went all the way and replaced .! with *F. For example: you can *FT, or *F12.345 which calls the existing factorial macro. Not only does this clear up a char for later use, but it also makes mapping factorial much easier like: *MT for a list of factorials [0,10).

Mr-Xcoder commented 6 years ago

Very nice! What are you planning to use .! for? Maybe a divisor built-in, which would currently save 3 bytes per usage compared to *M{yP.

isaacg1 commented 6 years ago

Given that we have no other use for .! currently, I'm going to leave .! intact, but the rest seems good.

Steven-Hewitt commented 6 years ago

.! could be "none" in the same vein as .A and .E?

Mr-Xcoder commented 6 years ago

I really think .! would be suited as a divisor built-in, because:

Steven-Hewitt commented 6 years ago

@Mr-Xcoder Why not move divisor to ( instead?

Mr-Xcoder commented 6 years ago

@Steven-Hewitt That's even better indeed. I didn't know ( was available.

Steven-Hewitt commented 6 years ago

There's no difference between tuples and lists anymore to Pyth, and nothing except ( returns tuples... it's moot and can be replaced. I haven't seen a solution use ( at all the entire time I've used the language ([ always works instead).