Data-scientist who loves to use #datascienceforgood, especially in ecology, energy and the environment. Bonsai, gardening, bikes and music when I'm not at a keyboard.
Really good article. I come from an R background, where map, apply, reduce is very common in a number of forms.
Something I want to pick out to ensure I've understood the python variant:
In functional programming, functions are the first-class objects, also called higher-order functions — the data types treated the same way as other types.
I think this sentence might be able to be refined, or my understanding might be wrong.
First class functions are a feature of the language where functions can be passed as arguments/data structures.
Higher order functions are a subset of functions (like map as you identify later), but not all first class functions are higher order functions, as a higher order function modifies the behaviour of a function that is it's argument.
So while 'print' is a first class finction, e.g. it can be given as an argument, 'map' is a higher order function, as you can map a print over a list. Conversely you can't 'print' a 'map' over a list.
Am I understanding this correctly or is this not true in python?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Really good article. I come from an R background, where map, apply, reduce is very common in a number of forms.
Something I want to pick out to ensure I've understood the python variant:
I think this sentence might be able to be refined, or my understanding might be wrong.
First class functions are a feature of the language where functions can be passed as arguments/data structures.
Higher order functions are a subset of functions (like map as you identify later), but not all first class functions are higher order functions, as a higher order function modifies the behaviour of a function that is it's argument.
So while 'print' is a first class finction, e.g. it can be given as an argument, 'map' is a higher order function, as you can map a print over a list. Conversely you can't 'print' a 'map' over a list.
Am I understanding this correctly or is this not true in python?