pull down to refresh

python, like javascript, has absorbed a lot of the functional fun of Lisp.
imo neither python or js have not inherited much from lisp at all, curious what you mean... i went from a functional lang back to python for a project and struggled to rewire my brain to OOP.
disclaimer, I'm not proficient with Lisp. when I was learning about it, I remember thinking that a lot of the features I liked to use 'functionally' were similar to what I was reading about in the Lisp Programming book.
here's some garbage from the LLM:
Both JavaScript and Python have introduced elements of Lisp in various ways:
  • JavaScript:
    • Closures: JavaScript's closure mechanism is similar to Lisp's lexical scoping. Closures allow functions to access variables from their surrounding scope, even when called outside of that scope.
    • Higher-order functions: JavaScript functions can be passed as arguments to other functions, returned as values from functions, and stored in data structures, similar to Lisp's higher-order functions.
    • Macros: Although JavaScript does not have built-in macro support like Lisp, some libraries and frameworks, such as Sweet.js and Macros.js, provide macro-like functionality.
    • Array methods: JavaScript's array methods, such as map(), filter(), and reduce(), are similar to Lisp's sequence functions.
  • Python:
    • List comprehensions: Python's list comprehensions are similar to Lisp's mapcar function, allowing for concise creation of new lists by applying a transformation to each element of an existing list.
    • Generators: Python's generators are similar to Lisp's streams, allowing for lazy evaluation and efficient processing of large datasets.
    • Higher-order functions: Python functions can be passed as arguments to other functions, returned as values from functions, and stored in data structures, similar to Lisp's higher-order functions.
    • Macros: Although Python does not have built-in macro support like Lisp, some libraries, such as macro and pymacro, provide macro-like functionality.
    • Functional programming libraries: Libraries like toolz and cytoolz provide functional programming utilities, including functions like pipe and curry, which are inspired by Lisp.
These elements have been incorporated into JavaScript and Python to provide more expressive and flexible programming capabilities, while still maintaining their respective language syntax and semantics.
reply