Bluish Coder

Programming Languages, Martials Arts and Computers. The Weblog of Chris Double.


2006-03-29

Generators in Common Lisp

Matthew Swank posted an example of generators using Common Lisp in comp.lang.lisp.

His implementation contains a monadic implementation of continuations and call/cc which is quite nice, and the resulting thread has a dicussion on the some implementation variations. A simple example of using the call/cc implementation from later in the thread:

;; Scheme version
(call/cc (lambda (k) (k 42))) 

;; Common Lisp
(run (call/cc (lambda (k) (funcall k 42)))) 

Tags


This site is accessable over tor as hidden service 6vp5u25g4izec5c37wv52skvecikld6kysvsivnl6sdg6q7wy25lixad.onion, or Freenet using key:
USK@1ORdIvjL2H1bZblJcP8hu2LjjKtVB-rVzp8mLty~5N4,8hL85otZBbq0geDsSKkBK4sKESL2SrNVecFZz9NxGVQ,AQACAAE/bluishcoder/-61/


Tags

Archives
Links