Created
July 30, 2011 00:43
-
-
Save pbalduino/1115038 to your computer and use it in GitHub Desktop.
Passing a function as parameter to another in Lucio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; first function receives another function and two values | |
; second function returns the average of two values | |
(define calculate | |
(fun | |
([op v1 v2] | |
(op v1 v2)))) | |
(define average | |
(fun | |
([a b] | |
(/ (+ a b) 2)))) | |
(calculate average 3 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment