isaacg1 / pyth

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

Feature request - f g f^-1 #202

Closed kckennylau closed 7 years ago

kckennylau commented 8 years ago

(todo: elaborate) If the new command is named .G:

.G <pfn><n-1:any><l:d><any> A^-1(C(A(D,...)))

For example, if I would like to add 100 to Q, multiply by 3, then subtract 100:

+.G100*3dQ

Reference: the &. operator in J

isaacg1 commented 8 years ago

This seems like it would be unfeasible, since pyth doesn't have a concept of an inverse of a functino, unlike J. Do you have any ideas for how to implement this?

kckennylau commented 8 years ago

Define the inverse of each function, and if a particular function has no inverse, then throw an error.

isaacg1 commented 8 years ago

I'm not planning on implementing this, though if someone else did, I'd welcome it.