Summary
Teach compiler that fold and map with clean procedure is itself clean
Metadata
- Id: 714e930f5bfdc04b1b856f00fe73e94fb73595ad
- Trac id: 1323
- Type: defect
- Reporter: sjamaan
- Owner:
- Cc:
- Status: new
- Component: compiler
- Estimated difficulty: hard
- Resolution:
- Priority: major
- Milestone: someday
- Version: 4.11.0
- Changetime: 2016-08-29 12:30:29 UTC
- Created: 2016-08-29 12:30:29 UTC
- Keywords: optimisations
Description
It looks like CHICKEN currently doesn't understand that `fold` and `map` are `#:clean` if the argument procedure is `#:clean`. This prevents it from recognising that something like `(fold + 0 (iota 10000))` is foldable.
We could hardcode these procedures, but I'd prefer not to, so this might require some kind of new annotation in `types.db`.
This idea was inspired by http://pramode.in/2016/08/25/rust-add-billion-numbers/ - if Rust can do it, so can we!