Created
February 12, 2012 12:58
-
-
Save mugyu/1808352 to your computer and use it in GitHub Desktop.
Gauche でカリーとクロージャー
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
;;;; Gauche Closure | |
(define make_person | |
(lambda (name) | |
(lambda (say) | |
(print name ": " say)))) | |
(define (make_person2 name) ; syntax sugar | |
(lambda (say) | |
(print name ": " say))) | |
(define catherine (make_person "Catherine")) | |
(define katherine (make_person "Katherine")) | |
(catherine "Hi!") | |
(katherine "Hi! how are you, catherine?") | |
(catherine "Great!! thank you! and you?") | |
(katherine "Good to hear and same here.") | |
; Catherine: Hi! | |
; Katherine: Hi! how are you, catherine? | |
; Catherine: Great!! thank you! and you? | |
; Katherine: Good to hear and same here. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment