allow for/fold #:results to reference sequence identifiers
Open
@pnwamk is already working on this.
Since Aug 21, 2018.
api design
feature request
- Dominant language
- Racket
- Stars
- 5.2k
- Forks
- 698
- Avg merge
- 18h 34m
- Merged PRs (30d)
- 5
Description
Someone in the Racket Slack channel requested being able to reference the sequencing identifiers in the #:results clause of a for/fold. I think this would be a straightforward addition; I plan on looking into it in the near future.
I think the below two examples illustrate how this feature should behave:
#lang racket
(require rackunit)
;; the #:result clause can reference identifiers
;; bound by the sequencing clauses
(check-equal? (for/fold ([sum 0]
#:result (list sum n))
([n (in-range 3)])
(+ sum n))
(list 3 2))
;; the accumulators bindings shadow the bindings
;; of identifiers bound by sequencing clauses
(check-equal? (for/fold ([n 0]
#:result n)
([n (in-range 3)])
(number->string n))
"2")
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.