Support reduced, reduced? and @ of reduced items.

Description

Not sure if this is a defect or enhancement, but there doesn't seem to be any support for reduced.

Arguably, the type declaration of reduce is wrong at the moment, and should be something like

[[a c -> (U a (Reduced a))] (NonEmptySeqable c) -> (U a (Reduced a))]

And I'd like to be able to type check the following

(let [v (reduce f coll)]
(if (reduced? v) @v v))

Environment

None

Activity

Show:
Ambrose Bonnaire-Sergeant
October 10, 2013, 2:08 AM
Ambrose Bonnaire-Sergeant
October 10, 2013, 2:09 AM

As a side note, your last usage of reduced is probably not what you meant, as reduce unwraps one layer of reduced.

Completed

Assignee

Ambrose Bonnaire-Sergeant

Reporter

import

Labels

None

Approval

None

Patch

None

Affects versions

Priority

Major
Configure