Functions that return functions

I came across some fascinating code that I decided to refactor as a learning exercise:
original: Convex hull | Desmos
rewrite: Convex hull simplified | Desmos

I chose this code cleanup exercise as a way to learn about Desmos coding and the coding style employed: functions that return functions, a powerful and compact approach. And, it finds convex hulls, which I’m curious about.

I eliminated a pile of seemingly dead code and greatly simplified what was left. I wonder if the discarded code had a function or if the simplified code has less functionality. These are academic questions as this is a learning exercise.

Does anyone know of other examples of using higher-order functions in Desmos code?


1 Like

I don’t have much to add, but I just wanted to say what a cool graph it is and that both the code and graph were a lot of fun to play with.

1 Like