Help with composition of functions

I’m playing around with

on the compose1 function.


I can “get” it to work with the pipe function.

I can’t figure out how to use the “math” composite function idea.


In python one can assign a variable c. to a lambda function and then use it like. c(x).
I can’t figure out how to “do” that in Snap!

Help please


OK. For simplicity let's suppose that F and G are functions of numbers, like sqrt.

What should composeOne report: a number or a function?

Your first version says to report a function of X which, when called, computes the PIPE call. Your second version says to call F right now, so it would report a number.

The way to encapsulate an expression (in this case the CALL F expression) in a function is the same way you encapsulated the PIPE call in a function: put a gray ring around it. You can use an explicit formal parameter, like the X in your first version, or just use an empty slot to show where to put the anonymous function's input, like this: