Better HN
topnewbestaskshowjobs
Log inSign up

architech

4 karma · joined Nov 10, 2010 (16y ago) · 5 submissions

Submissions

comment 4y ago · link · parent

https://innit.cz

Did this to try out Fable. If you mess up the letters and wait a bit it will put itself together :)

comment 5y ago · link · parent

> It could be even better if we can have function composition.

I think composition and piping are such basic programming tools that make a lot of code much cleaner. It's a shame they're not built-in in Python.

So, shameless plug, in the spirit of functools and itertools I made the pipetools library [0]. On top of forward-composition and piping it also enables more concise lambda expressions (e.g. X + 1) and more powerful partial application.

[0] https://0101.github.io/pipetools/doc/

comment 11y ago · link · parent

I started with something like that when I was missing function composition in Python. Eventually I ended up with a library [1] including a bunch of other stuff for getting rid of some of the duct tape code you usually need when you just want to compose some functions.

  from pipetools import pipe, X, foreach

  really_angry = pipe | upper | exclaim | exclaim
or...

  really_angry = X.upper() | "{0}!" | "{0}!"


  (1, 2, 3, 4) > foreach((X + 1) | (X * 3)) | max 

You can write some pretty neat looking concise code with this, but also may regret it later when it comes to debugging, especially when lazy evaluation is involved (which is usually the case). The stacktraces tend to be not so helpful...

[1] https://0101.github.io/pipetools/

comment 12y ago · link · parent

https://github.com/azac/sublime-howdoi-direct-paste

comment 15y ago · link · parent

Looks like Prezi http://prezi.com/