Last active
August 29, 2015 13:57
-
-
Save lovasoa/9717946 to your computer and use it in GitHub Desktop.
Plot a mathematical function in the terminal. In one line of coffeescript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Enter this line in the REPL coffeescript console | |
plot = (f,a,b) -> ((if 0<=n<75*f(i) or 75*f(i)<n<0 then '█' else ' ') for n in [-75..75]).join '' for i in (i for i in [a..b] by 0.05) | |
#Then, you can start plotting functions | |
plot Math.sin, 0, 2*Math.PI |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment