Skip to content

Instantly share code, notes, and snippets.

View kazh98's full-sized avatar
๐Ÿ˜€
Set your status

Kazuhiro HISHINUMA kazh98

๐Ÿ˜€
Set your status
View GitHub Profile
(define (copy-instance obj)
(rlet1 new (make (class-of obj))
(dolist [slot (class-slots (class-of obj))]
(set! (~ new (slot-definition-name slot))
(~ obj (slot-definition-name slot))))))
@podhmo
podhmo / cps-like-functions-example.scm
Created July 25, 2012 15:00
toy code using a cps like function (as ansync process simulation)
;; CPSใ‚นใ‚ฟใ‚คใƒซ.ใ“ใ‚Œใฏใ€ๅฎŸใฏ้žๅŒๆœŸๅ‡ฆ็†ใชใฉ็ตๆžœใŒใ„ใค่จˆ็ฎ—ใ•ใ‚Œใ‚‹ใ‹ๅˆ†ใ‹ใ‚‰ใชใ„ๅ ดๅˆใฎใƒขใƒ‡ใƒซใ€‚
;; ้€šๅธธใฎๅŒๆœŸๅ‡ฆ็†ใจใฏ็•ฐใชใ‚Šใ€ๅผ•ๆ•ฐใฎcontใŒใ„ใค่จˆ็ฎ—ใ•ใ‚Œใ‚‹ใ‹ใฏๅˆ†ใ‹ใ‚‰ใชใ„ใŒใ€*ๆบ–ๅ‚™*ใŒใงใใŸใจใcontใซๆธกใ•ใ‚Œๆฌกใฎ่จˆ็ฎ—ใŒ่กŒใ‚ใ‚Œใ‚‹ใ€‚
(define (add1 x cont)
(cont (+ x 1)))
(define (mul2 x cont)
(cont (* x 2)))
;; ใคใชใ’ใฆใฟใ‚‹ใ€‚