4 ms·
Why do would you say python is like a lisp without parens? Common lisp is warty, battle tested and productive - but the similarities end there. I tried to use
by bjoli 6y ago
Why do would you say python is like a lisp without parens? Common lisp is warty, battle tested and productive - but the similarities end there.
I tried to use Hy, but even with the most glaring difference mitigated, python felt nothing like lisp. I was still writing very much python.
- a-dub 6y agomap, reduce, filter, lambda, etc sure, no car, cdr or cons, but you can do that with list notation and it's cleaner anyhow.
- smitty1e 6y ago> map, reduce, filter, lambda, etc Those are generally functional, not lisp-specific, concepts.
- a-dub 6y ago...aaand the first language to define them was...
- pjmlp 6y agoLambda calculus.
- bjoli 6y agoprobably APL, like all these things. It was probably used in some fashion before that, but my experience that is where it was named and standardised. Heck, it is even mapped to an ASCII character IIRC: \ or /. Can't remember which, and on GPRS so Google takes a good 2 minutes.
- mlochbaum 6y agoAPL introduced the name "reduce" and was the first to have it by ten years or so (published 1962, implemented 1966). Fairly sure Lisp had map first as the Each operator only appeared in nested APLs around 1981. APL may have had Compress before Lisp had filter, but they're not really the same: APL's isn't a higher order function; it takes one boolean filter list and another list to be filtered. Reduce and Compress are both denoted / which is sometimes a problem.
- bjoli 6y agoIn a language like APL map adds very little compared to reduce/fold. In scheme, fold is a lot more verbose than map. Map saves on typing and on householding. In APL? I would argue gain is a lot smaller. I have seen actually useful APL programs in less code than a fold-left filter in scheme.
- pjmlp 6y agoWithout image, break-edit-redo debugging REPL and AOT compilation.
- rightbyte 6y ago> map, reduce, filter, lambda, etc That could be Java or C++.
- bjoli 6y agoI disagree. I mean sure, you can write something akin to functional programs in python, but the language as a whole is "mutability first" to a very large degree. From almost every language I have used, I find python one of the furthest from my idea of functional programming (which means different things to different people). Which, in my mind, also makes it a pretty darn useless ML. It is a fine language on its own, but understanding it in terms of lisp (or even worse, scheme) or, say, standard ML is a not very useful. I think a good exercise regarding this is trying to write YOUR-FAVOURITE-LANGUAGE in ANOTHER-LANGUAGE. Writing idiomatic scheme in standard ML is surprisingly straightforward. Writing scheme in python is awful, regardless of functools.
- maweki 6y agoFunctional Python for me breaks down with the lazyness of generators. Sure, map returns a generator and that's fine. But you can't pass the result to multiple consumers as the generator has an internal state. It's like a weird version of linear types where every value is only allowed to be used once.
- a-dub 6y agoyeah, it became less fun in python 3.