cnuernber / dtype-next

A Clojure library designed to aid in the implementation of high performance algorithms and systems.
Other
332 stars 20 forks source link

Cannot use `diff1d` with `reverse` #120

Open dmg46664 opened 1 day ago

dmg46664 commented 1 day ago

The following

(->
   (dtype/make-reader :float32 10 (rand 10))
   (dfun/- 5)
   (dfun/signum)
   (dgrad/diff1d)
   (dtype/reverse)
   )

yields

Caused by java.lang.ClassCastException
   class tech.v3.datatype_api$reverse$fn$reify__55509 cannot be cast to class
   clojure.lang.IFn$LD (tech.v3.datatype_api$reverse$fn$reify__55509 is in
   unnamed module of loader clojure.lang.DynamicClassLoader @10a83d20;
   clojure.lang.IFn$LD is in unnamed module of loader 'app')

          datatype_api.clj:  175  tech.v3.datatype-api/make-reader-fn/reify
           Reductions.java:   95  ham_fisted.Reductions/serialReduction
             IMutList.java:  347  ham_fisted.IMutList/fillArray
             IMutList.java:  356  ham_fisted.IMutList/toArray
             IMutList.java:  624  ham_fisted.IMutList$13/invoke
       LazyChunkedSeq.java:   38  ham_fisted.LazyChunkedSeq/unlockedUnwrap
       LazyChunkedSeq.java:   54  ham_fisted.LazyChunkedSeq/lockedUnwrap
       LazyChunkedSeq.java:   62  ham_fisted.LazyChunkedSeq/first
                   RT.java:  692  clojure.lang.RT/first
                  core.clj:   55  clojure.core/first
            core_print.clj:   64  clojure.core/print-sequential
            core_print.clj:  295  clojure.core/fn
            core_print.clj:  294  clojure.core/fn
              MultiFn.java:  234  clojure.lang.MultiFn/invoke

Similar to the following except it's not IPersistentCollection but clojure.lang.IFn$LD https://clojurians.zulipchat.com/#narrow/stream/151924-data-science/topic/Simple.20Tablecloth.20beginnings/near/246087035 although I just thought that not working with reverse feels more fundamental than not working with conj.

If this is intended it might be worth documenting somewhere :-)

dmg46664 commented 1 day ago

PS. I'm using the latest version included with noj, so my bad if this has been resolved.