views:

528

answers:

2

I know there is a list-comprehension library for common lisp (incf-cl), I know they're supported natively in various other functional (and some non-functional) languages (F#, Erlang, Haskell and C#) - is there a list comprehension library for Scheme?

incf-cl is implemented in CL as a library using macros - shouldn't it be possible to use the same techniques to create one for Scheme?

+5  A: 
  • Swindle is primarily a CLOS emulator library, but it has list comprehensions too. I've used them, they're convenient, but the version I used was buggy and incomplete. (I just needed generic functions.)
  • However, you probably want SRFI-42. I haven't used it, but it HAS to have fewer bugs than the Swindle list comprehensions.

I don't know which Scheme you use. PLT Scheme bundles Swindle and SRFI-42. Both are supposed to be cross-Scheme compatible, though.

If you use PLT Scheme, here is SRFI-42's man page. You say (require srfi/42) to get it.

Nathan Sanders
A: 

You can use LINQ for R6RS Scheme (although it could be made to run under 'older' implementations).

leppie