We know the Great Lambda languages like
LISP and Scheme have lambdas that might
go on for pages, whereas Python has a "little
lambda": one expression only.

That expression may be another lambda
however, and perhaps worth doing, to get
the concept of composing functions across,
we might in math class go:

compose = lambda f, g: lambda x: f(g(x))

# Example functions

def addA(s): return s + "A"

def addB(s): return s + "B"

# Composing them
addAB = compose(addB, addA)

# Test
print(addAB("L"))

Getting LAB for output i.e addB(addA("L"))

Over on math-teach I've been branding
our traditional differential / integral calculus
the "Delta Calc" track to pave the way for
an additional "Lambda Calc" track through
much of the same territory.

Lambda Calc is our door into Gnu Math
more generally, a complementary CS-friendly
approach to many of the same high school
math concepts. but also new ones not
hitherto so commonly seen.

We'll do more with RSA and Fractals than
in the previously status quo standards,
and with spatial / spherical geometry per
Popko. [1]  Lets get those Tractors on the
ball (Spaceship Earth).

The "everything is an object" heuristic in
Python makes it natural to think of functions
as arguments as well as results of other
functions.

Kirby

[1]  http://www.dividedspheres.com/
_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
https://mail.python.org/mailman/listinfo/edu-sig

Reply via email to