<< Back to previous view

[ALGOG-5] Addition of generic modulus Created: 18/Apr/14  Updated: 18/Apr/14

Status: Open
Project: algo.generic
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Trivial
Reporter: Reid McKenzie Assignee: Konrad Hinsen
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File 0001-Implement-the-modulus-operator.patch    
Patch: Code

 Description   

I suggest that the modulus operator should be available as part of math-functions. The clojure.core/mod implementation is perfectly suited for use with algo.generic.arithmetic's multimethods. A proposed patch is attached.






[ALGOG-4] No method in multimethod 'fmap' for dispatch value: class clojure.lang.PersistentVector$ChunkedSeq Created: 02/Apr/14  Updated: 02/Apr/14

Status: Open
Project: algo.generic
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Neil Prosser Assignee: Konrad Hinsen
Resolution: Unresolved Votes: 0
Labels: None


 Description   

If you do the following with the latest algo.generic code:

=> (clojure.algo.generic.functor/fmap inc (lazy-seq [1 2]))
(2 3)

but...

=> (clojure.algo.generic.functor/fmap inc (seq [1 2]))
IllegalArgumentException No method in multimethod 'fmap' for dispatch value: class clojure.lang.PersistentVector$ChunkedSeq  clojure.lang.MultiFn.getFn (MultiFn.java:160)

Is that the intended functionality? This happens when using Clojure 1.5.1 and 1.6.0.



 Comments   
Comment by Neil Prosser [ 02/Apr/14 4:00 PM ]

Michael Cohen has kindly created a pull request for this:

https://github.com/clojure/algo.generic/pull/4





[ALGOG-3] Add several implementations of fmap (patch attached) Created: 06/Sep/13  Updated: 05/Feb/14  Resolved: 05/Feb/14

Status: Closed
Project: algo.generic
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Eric Normand Assignee: Konrad Hinsen
Resolution: Completed Votes: 0
Labels: enhancement

Attachments: Text File functors.patch    
Patch: Code and Test

 Description   

I have added four implementations of the fmap multimethod.

LazySeq is a common Clojure type that was not implemented.

nil was also not implemented. It now works as one would expect Nothing to work in Haskell.

I also added implementations for delay and future, which are trivial but very useful.



 Comments   
Comment by Konrad Hinsen [ 05/Feb/14 10:23 AM ]

Done: https://github.com/clojure/algo.generic/commit/aa028f7467d193a5cfad0626b324f4c682b91c15





[ALGOG-2] dispatch for fmap multimethod shouldn't be on type of second argument Created: 22/May/13  Updated: 05/Feb/14  Resolved: 05/Feb/14

Status: Closed
Project: algo.generic
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: ben wolfson Assignee: Konrad Hinsen
Resolution: Completed Votes: 0
Labels: None


 Description   

AFAICT having fmap dispatch on the type of the second argument makes it practically impossible to define fmap for arbitrary functions, since the type is different for each function:

user> (type type)
clojure.core$type
user> (type fn?)
clojure.core$fn_QMARK_
user> (type not=)
clojure.core$not_EQ_
user>

However, there's a perfectly reasonable definition of fmap for functions (fmap = comp).

To my mind the simplest/best thing to do is just have a Functor protocol and have fmap call a function in it, with the order of arguments reversed so that dispatch will happen correctly.



 Comments   
Comment by Konrad Hinsen [ 05/Feb/14 10:16 AM ]

I added an fmap implementation for the IFn interface, which covers all functions:
https://github.com/clojure/algo.generic/commit/4dd3e17e494b7b6f43cda045d3162b0f60df7599

Changing fmap to a protocol-based implementation would break all existing code that adds fmap implementations.





[ALGOG-1] Mention algo.generic.functor in README Created: 23/Nov/12  Updated: 05/Feb/14  Resolved: 05/Feb/14

Status: Closed
Project: algo.generic
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Trivial
Reporter: Christoffer Sawicki Assignee: Konrad Hinsen
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File Mention-algo.generic.functor-in-README.patch    

 Description   

All algo.generic submodules except for functor are mentioned in the README.

Attached is a patch that rectifies this.



 Comments   
Comment by Konrad Hinsen [ 05/Feb/14 9:56 AM ]

Done: https://github.com/clojure/algo.generic/commit/205fea6629382bd4f0f4dc2093af10275ae41b66





Generated at Mon Sep 22 15:20:24 CDT 2014 using JIRA 4.4#649-r158309.