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

2020-08-14 Thread Jack Park
AM Jesús Gómez wrote: > 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 *IInferrab

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

2020-08-14 Thread Jack Park
ndr [{:data 1} {:data 2} {:no-data 3} {:data 4}]) > noisy-get {:data 1} :data > noisy-get {:data 2} :data > noisy-get {:no-data 3} :data > nil > user> (transduce xf andr [{:data 1} {:data 2} {:data 3} {:data 4}]) > noisy-get {:data 1} :data > noisy-get {:data 2} :data >

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

2020-08-14 Thread Jack Park
On Fri, Aug 14, 2020 at 1:38 PM Oleksandr Shulgin < oleksandr.shul...@zalando.de> wrote: > 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: >

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-15 Thread Jack Park
Hi Erik, I think that teasing things apart helps along some dimensions, but the problem I face, still thinking like a Java hacker, is that I need to put things together: I need to construct a *type* (deftype) which honors two different interfaces, a list, and an evaluable object. I need the

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

2020-08-13 Thread Jack Park
The problem: In Java, I have an interface *IInferrable* which is basically boolean eval(); Any Java object which extends IInferrable, no matter what it is, will answer to eval() and return a boolean. The idea lies at the heart of an inference engine. But, I also define a class *AndList*

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

2020-08-15 Thread Jack Park
there a long time. Old patterns die hard? > > I could be wrong though. :) > > > My 2 cents, > Brandon > > On Sat, Aug 15, 2020 at 12:42 PM Jack Park > wrote: > >> Hi Erik, >> >> I think that teasing things apart helps along some dimensions, but the >> pro

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

2020-08-15 Thread Jack Park
ck On Sat, Aug 15, 2020 at 4:18 PM Jack Park wrote: > Brandon! > > That just might be the idea I needed. Thank you. > > Film at 11... > > On Sat, Aug 15, 2020 at 2:28 PM Brandon R wrote: > >> Hey Jack, >> >> Just been a fly on the wall for this convo, and

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

2020-08-16 Thread Jack Park
I could be wrong though. :) > > > My 2 cents, > Brandon > > On Sat, Aug 15, 2020 at 12:42 PM Jack Park > wrote: > >> Hi Erik, >> >> I think that teasing things apart helps along some dimensions, but the >> problem I face, still thinking like a Java

Re: Strange Vector failure

2021-07-20 Thread Jack Park
going for and runs: > > https://gist.github.com/corasaurus-hex/1c86b545644b734310a15d984f61ad99 > > Have a look, play with it a bit, change around value and see what breaks. > Hope that's helpful! > > On Mon, Jul 19, 2021 at 5:55 PM Jack Park > wrote: > >> Did. That

Re: ClassNotFoundException when importing a clojure interface

2021-07-17 Thread Jack Park
> (ns ie4clj.AndList) > > (when *compile-files* > (require 'ie4clj.api)) > > (def AndList > (reify >ie4clj.api.Inferrable >(eval [_] true) >(evalMembers [_ m] true))) > > Hope this helps, > > > > On Sat, 17 Jul 2021 at 21:06, Jack

Re: Strange Vector failure

2021-07-18 Thread Jack Park
you down the best path possible. So, can I ask what >>> problem you're solving? Can you share more code somewhere, maybe in a >>> GitHub gist? >>> >>> I just worry that maybe you're solving a problem the "Java way" when >>> there's an easier

Re: ClassNotFoundException when importing a clojure interface

2021-07-18 Thread Jack Park
>> (note that in your gist you had some errors when defining AndList, I've >>> fixed it) >>> (also take a look at the clojure style guide >>> <https://github.com/bbatsov/clojure-style-guide>, as AndList is not >>> really the way to name things in

Re: Strange Vector failure

2021-07-18 Thread Jack Park
gt; (reduced false))) > true > members) > > My point with sharing these is that in clojure usually the best way to > solve these problems is to pass new values to the next iteration while > accumulating a result instead of changing a variable on each iterat

Re: Strange Vector failure

2021-07-18 Thread Jack Park
18, 2021 at 5:00 PM Cora Sutton wrote: > Hello again Jack, > > On Sun, Jul 18, 2021 at 6:21 PM Jack Park > wrote: > >> (every? eval members) does not appear to work on a list of functions >> designed to evaluate to a boolean. >> > > If members is a list of

Strange Vector failure

2021-07-18 Thread Jack Park
I have a class which treats a sequence as a conjunctive list of objects which, when evaluated, return a boolean. It is an attempt to use doseq to walk along that list, evaluating each entry, and anding that result with boolean atom. It fails. A sketch of the code is this - taken from the

Re: Strange Vector failure

2021-07-18 Thread Jack Park
dovan > wrote: > >> Hey, >> >> Could you share the code you have now? >> >> On Mon, 19 Jul 2021, 02:18 Jack Park, wrote: >> >>> Cora! >>> >>> I made those changes. It is still working to the degree it was, with the >>&g

Re: Strange Vector failure

2021-07-18 Thread Jack Park
in clojure usually the best way to > solve these problems is to pass new values to the next iteration while > accumulating a result instead of changing a variable on each iteration. Or > to use one of these sweet built-in functions. > > Does that make sense? > > * I thiiink you

Re: Strange Vector failure

2021-07-18 Thread Jack Park
l 18, 2021 at 8:01 PM Tanya Moldovan wrote: > Hey, > > Could you share the code you have now? > > On Mon, 19 Jul 2021, 02:18 Jack Park, wrote: > >> Cora! >> >> I made those changes. It is still working to the degree it was, with the >> same error >&g

Re: Strange Vector failure

2021-07-19 Thread Jack Park
en I changed the test conditions, evaluate_and failed. On Sun, Jul 18, 2021 at 5:00 PM Cora Sutton wrote: > Hello again Jack, > > On Sun, Jul 18, 2021 at 6:21 PM Jack Park > wrote: > >> (every? eval members) does not appear to work on a list of functions >> de

Re: Strange Vector failure

2021-07-19 Thread Jack Park
th let instead of def. > > (defn evaluate-and > [members] > (println "EA" members) > (let [result (every? (fn [member] (member)) members)] > (println "EA+" result) > result)) ;<-- I added this line, as (println) one return nil, and I > th

Re: Strange Vector failure

2021-07-19 Thread Jack Park
ions in it, the code breaks and returns - without any errors - not a boolean, but the structure I passed it. On Mon, Jul 19, 2021 at 3:43 PM Cora Sutton wrote: > Those are functions that call booleans as functions. Try this: > > (defn simple-true [] true) > > On Mon, Jul 19,

Re: Strange Vector failure

2021-07-19 Thread Jack Park
f functions that take > no arguments? Do you want the lists to be able to contain booleans too? > > On Mon, Jul 19, 2021 at 2:57 PM Jack Park > wrote: > >> Cora >> >> (every? (fn [member] (member)) members) >> works fine on [constantly true & false >>

ClassNotFoundException when importing a clojure interface

2021-07-17 Thread Jack Park
I created a gist https://gist.github.com/KnowledgeGarden/39742ae9ae641f0d8facb31b288ece4c which explains a ClassNotFoundException when I am importing and reifying a particular interface in another clj file. It's really baffling because, in the load order, core calls a test in a test file -

Re: Strange Vector failure

2021-07-23 Thread Jack Park
Ok. I got back to this, now running Cora's gist. It gives me a different place to explore these issues. More soon. Jack On Tue, Jul 20, 2021 at 5:31 PM Jack Park wrote: > Hi Cora, > > I got dragged away but plan to study your contribution, which I deeply > appreciate. > >

Re: Strange Vector failure

2021-07-23 Thread Jack Park
d-fns > [simple-true-fn simple-true-fn])) >simple-true-fn])) > (fn [] > (evaluate-and-fns [simple-true-fn simple-false-fn]))]) > > On Fri, Jul 23, 2021 at 7:22 PM Jack Park >

Re: Strange Vector failure

2021-07-23 Thread Jack Park
nd value and see what breaks. > Hope that's helpful! > > On Mon, Jul 19, 2021 at 5:55 PM Jack Park > wrote: > >> Did. That suggestion was made earlier. Did not change anything. >> >> Here's a test which ran just fine >> (def x (evaluate_and (list true true))) >

Re: Strange Vector failure

2021-07-24 Thread Jack Park
(my-fn)). there is no limit to the recursion > here, you can have functions in functions in functions > > On Fri, Jul 23, 2021 at 9:54 PM Jack Park > wrote: > >> Cora, >> >> That's simply amazing. I added one more "or" test: all-false. >&