Hacker Newsnew | past | comments | ask | show | jobs | submit | cbsw's commentslogin

I don't think "lazy" is a problem in real code. They just annoys when in interactive shell which you just want to print their result. In fact python3 has changed a lot of list like data type or function to "lazy", zip(),dict.items() etc. IMO this helps a lot to reduce memory usage. Thus more efficient with functional programming


+ - * / even doesn't support multi-data. (+ 1 2 3) would be 3,stupid


Cool, awesome, great point. I tried Googling for your implementation and couldn't find it. Could you drop a link?


Yes, the arithmetic primitives don't support variadic arguments. You can see how + works - and that it only deals with the first two arguments - here: https://github.com/alandipert/gherkin/blob/278354246aebf14b8.... A pull request fixing this would be welcome.

In the meantime, for variadic addition, one can do:

(load-file "core.gk") (reduce + 0 '(1 2 3)) ;=> 6


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: