Skip to content

Instantly share code, notes, and snippets.

@mugyu
Created February 12, 2012 12:58
Show Gist options
  • Save mugyu/1808352 to your computer and use it in GitHub Desktop.
Save mugyu/1808352 to your computer and use it in GitHub Desktop.
Gauche でカリーとクロージャー
;;;; 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