1. srfi-42
    1. Description
    2. Author
    3. Repository
    4. Documentation
    5. Cheatsheet
    6. History
    7. License

srfi-42

Description

An implementation of SRFI-42 (Eager comprehensions).

Author

Sebastian Egner, wrapped as a CHICKEN extension by Ivan Raikov.

Repository

This egg is hosted on the CHICKEN Subversion repository:

https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/srfi-42

If you want to check out the source code repository of this egg and you are not familiar with Subversion, see this page.

Documentation

See SRFI-42 document.

Cheatsheet

The following table shows Python list comprehensions and the corresponding SRFI-42 equivalent:

Python Scheme
[process(item) for item in items] (list-ec (:list item items) (process item))
[item for item in range(10)] (list-ec (:range item 10) item)
[item for item in range(10) if test(item)] (list-ec (:range item 10) (if (test item)) item)
[[i, item] for i, item in enumerate(items)] (list-ec (:list item (index i) items) (list i item))
[[k, v] for k in keys for v in values] (list-ec (:list key keys) (:list value values) (list key value))
[[key, value] for key, value in zip(keys, values)] (list-ec (:parallel (:list key keys) (:list value values)) (list key value))

History

1.74
ported to CHICKEN 5
1.73
replaced use of apply with append* and string-concatenate (thanks to acharlton)
1.71
ensure test script returns non-zero if any tests have failed (thanks to mario)
1.6
uses fixnum-specific operations for index counting
1.5
ported to CHICKEN 4

License

This is the X11-style license required of all SRFI reference implementations.

Copyright (C) Sebastian Egner (2003). All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.