This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-16
Channels
- # beginners (21)
- # boot (6)
- # cider (47)
- # clojure (67)
- # clojure-brasil (2)
- # clojure-dusseldorf (3)
- # clojure-greece (2)
- # clojure-quebec (3)
- # clojure-russia (8)
- # clojure-spec (110)
- # clojurescript (19)
- # cursive (8)
- # datomic (5)
- # devcards (2)
- # dirac (9)
- # editors (1)
- # emacs (3)
- # funcool (1)
- # lein-figwheel (7)
- # om (1)
- # protorepl (2)
- # re-frame (1)
- # testing (1)
^ @bcbradley — does that help?
I'm thinking that since eduction takes a collection, and since eduction implements collection...
eduction
produces something "collection-like"
it is iterable
It’s like a repeatable capsule of a set of transducers and a collection to apply them to
my use case is using eduction as a way to represent game state as a collection of entities, as a function of the last game state, and I want to be able to build up the stack of transformations by passing around a composable bundle of transformations
i looked at eduction and thought that it looked like it self composes, captures the idea of applying a stack of transformations to a collection...
Transducers already compose tho'...
If you have a composition of transducers, you can apply it to any collection and run it. With eduction
, that starting collection is baked in.
Not really...
i should only use educe when i want someone to be able to transform a collection, but I don't want them to be able to choose which collection to transform and I don't want to pass them the collection, or necessarily tell them what the original collection even is
And you want them to be able to re-run the transformations each time they realize the result (reduce / iterate over it).
so essentially its not really a collection-like thing at all, its just a view, er... more like a view through a transforming/ distorting "lens" of another collection somewhere off in the distance, and every time you want to view that thing in the distance you have to recallibrate your telescope and pay the computation cost
well thanks for your help with understanding it sean... I know i can be a bit stubborn with trying to interpret things in my own terms.
i've got to query AD for users and spit out an xml file for populating users and just wondering if anyone had messed with AD through clojure before
I haven’t but I’d sniff around for a Java library you could import
. I’d be surprised if such a beast wasn’t lurking out there somewhere.
yeah figured java world had to have something. wondering if someone had made it in clojure as well
I think you can use ldap to query ad
At least that's where I'd start looking
Ah, good call, Mr. Miller. @dpsutton, I’d start here: https://clojars.org/search?q=ldap
@bcbradley an eduction is a 1-time, non-caching, suspended transformation
Best suited to doing a single traversal of an external input source
I am totally stumped. I’m doing some interop with a Java library. The library requires me to define a Java class that extends a certain base class and add some arbitrary methods to it (not defined in the base class). I can’t seem to use ‘proxy’ to do this.
(.hello (proxy [LibraryBaseClass] [] (hello [] (println "Hello"))))
An example I’m trying.
Requires gen-class I think
Or just do it in Java (often simpler if it's just a thin shim)
Hey all, has anyone had to work with java.util.Collections$UnmodifiableRandomAccessList before? I’m having a little trouble getting one into Clojure data structures.
paulspencerwilliams: you can't just pass it to seq
?
@gfredericks: you’d have thought but seq? evaluates to false.
er, saying that...
(println (seq (.asMaps fill-ups)))
outputs (#object[java.util.Collections$UnmodifiableMap 0x5a917723 {date=2016-06-13, quantity=37, cost=0, mileage=24}] #object[java.util.Collections$UnmodifiableMap 0x7e4579c7 {date=2016-06-17, quantity=33.61, cost=37.95, mileage=426}] #object[java.util.Collections$UnmodifiableMap 0x796f632b {date=2016-06-20, quantity=22.12, cost=24.97, mileage=683}] #object[java.util.Collections$UnmodifiableMap 0x5d94a2dc {date=2016-06-24, quantity=36.69, cost=41.42, mileage=1134}] #object[java.util.Collections$UnmodifiableMap 0xcedee22 {date=2016-06-30, quantity=36.95, cost=40.61, mileage=1577}] #object[java.util.Collections$UnmodifiableMap 0x59b32539 {date=2016-07-06, quantity=39.71, cost=44.83, mileage=2063}] #object[java.util.Collections$UnmodifiableMap 0x5b47731f {date=2016-07-09, quantity=25.58, cost=28.88, mileage=2386}] #object[java.util.Collections$UnmodifiableMap 0x233db8e9 {date=2016-07-16, quantity=32.72, cost=36.94, mileage=2783}])
paulspencerwilliams: seq?
is different from seq
as seq? is returned false, I assumed that meant that the collection wouldn’t comply with seq
ah no
seq
is for converting something to a seq
seqable?
is a new 1.9 function that expresses that idea
Ah, looks like it’s choking on converting each entry in the collection into individual maps. {date=2016-07-16…}
and so forth.
(into {} some-unmodifiable-map)
should work for that part
that’s the next challenge. okay. Will try now.
i.e., try (->> fill-ups .asMaps (map #(into {} %)))
Yes, that works a treat. Thank you both. I’d been trying to map straight over
(.asMaps fill-ups)
and had been getting a java.lang.ClassCastException: java.util.Collections$UnmodifiableMap cannot be cast to clojure.lang.Associative
which led me to believe a slightly more complicated interop issue.and previous attempts to (map into {}) had also failed, but this incantation works well!
am I crazy or does the regex feature of clojure.test/is not work at all?
that second assertion doesn't fail
oh nevermind you have to use thrown-with-message? for that