functional programming - List Comprehension Library for Scheme? - Stack Overflow

admin2022-05-20  63

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?

Answers:

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?

Answers:

  • 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.

Answers:

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

转载请注明原文地址:https://www.u19.cn/read-102269.html

New Post(0)