Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Oleksandr Shulgin
On Fri, Aug 14, 2020 at 7:51 AM Alexandre Almosni < alexandre.almo...@gmail.com> wrote: > Maybe your objects could be defined by a map containing functions and > objects. > > So exampleAndList = {:fn and, :coll [a b c]} > > > And then eval goes through your objects recursively, using > > (def eval

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Oleksandr Shulgin
On Fri, Aug 14, 2020 at 9:05 AM Oleksandr Shulgin < oleksandr.shul...@zalando.de> wrote: > On Fri, Aug 14, 2020 at 7:51 AM Alexandre Almosni < > alexandre.almo...@gmail.com> wrote: > >> Maybe your objects could be defined by a map containing functions and >> objects. >> >> So exampleAndList = {:fn

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Jesús Gómez
Why not to Java-Interop with that Interface and those Classes directly, the same way you use them in Java? El jue., 13 ago. 2020 a las 22:54, Jack Park () escribió: > The problem: > > In Java, I have an interface *IInferrable* which is basically boolean > eval(); > > Any Java object which extend

Re: Clojure tools-deps Docker image versions & stable releases

2020-08-14 Thread Wes Morgan
OK, thanks Alex! The reversion to 1.10.1.561 for un-versioned tools-deps images (and the publishing of that tag at all) is now live on Docker Hub. Stable releases only moving forward. On Thursday, August 13, 2020 at 7:30:44 PM UTC-6 Alex Miller wrote: > On Thursday, August 13, 2020 at 10:32:45

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Jack Park
Mapping and transducers seems appropriate, though I'm still wrapping my head around how to make this work. >From the "class with functions" mindset, I need an ArrayList into which I can: a) add members to the list from time to time b) run eval() on it; a conjunctive list will exit false on first fa

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Jack Park
This idea shows up early in Clojure text books. This concept comes to mind rather quickly: (def and_list (ArrayList.) ... ) But, in the end it is an ArrayList which has an interface-defined behavior, e.g. boolean eval(); (from Java) Thus far, in a tiny VSCode project, I defined (definterface

RE: First post: how to mimic a Java List with types?

2020-08-14 Thread Sam Hahn
Jack - I'll call you :)  Cheers - Sam Original Message Subject: Re: First post: how to mimic a Java List with types? From: Jack Park Date: Fri, August 14, 2020 11:34 am To: clojure@googlegroups.com Mapping and transducers seems appropriate, though I'm

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Oleksandr Shulgin
On Fri, Aug 14, 2020 at 8:44 PM Jack Park wrote: > This idea shows up early in Clojure text books. This concept comes to mind > rather quickly: > > (def and_list (ArrayList.) >... > ) > > But, in the end it is an ArrayList which has an interface-defined > behavior, e.g. boolean eval(); (from

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Jack Park
Wow! I say that because that might be getting closer to what I have in mind but still not there yet. I'm really trying to develop a type which honors two interfaces, one for the list object, and one for the IEvaluable object. As a type, I invoke it, then add objects to it, then place it, as an IE

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Jack Park
Alex, I plan to explore this idea. Many thanks! Jack On Fri, Aug 14, 2020 at 1:38 PM Oleksandr Shulgin < oleksandr.shul...@zalando.de> wrote: > > > > Nevermind transducers: I've just realized that reduced can be used with > the normal reduce. E.g. here's short-circuiting AND-reduction fn: > >

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread matthew...@gmail.com
Another option would be to do what Alex is suggesting and define and as a function. Just because it’s a macro in clojure.core doesn’t mean you can’t write your own :) (defn eval' [x] (if (map? x) (apply (:fn x) (:coll x)) x)) (defn and-list [& items] (let [if? (fn [x] (if x true f