<< Back to previous view

[CTYP-73] Support reduced, reduced? and @ of reduced items. Created: 29/Sep/13  Updated: 09/Oct/13  Resolved: 09/Oct/13

Status: Closed
Project: core.typed
Component/s: None
Affects Version/s: 0.2.0
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Julian Birch Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None


 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))



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 09/Oct/13 8:08 PM ]

Fixed https://github.com/clojure/core.typed/commit/a75e1834be5c6cc6c329ec9f882a35b275f0f70a

Comment by Ambrose Bonnaire-Sergeant [ 09/Oct/13 8:09 PM ]

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

Generated at Thu Apr 17 16:51:30 CDT 2014 using JIRA 4.4#649-r158309.