Re: Strange Vector failure

2021-07-19 Thread Cora Sutton
Hello again, Jack. I'm not sure what your code looked like before or looks like now but I think maybe a different way of helping you out with this is in order. Here's some code that does what I think you're going for and runs: https://gist.github.com/corasaurus-hex/1c86b545644b734310a15d984f61ad99

Re: Strange Vector failure

2021-07-19 Thread Jack Park
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))) (println "A" x) (def y (evaluate_and (list true false))) (println "B" y) But, the moment I attempt to make a list with two functions in it, the code brea

Re: Strange Vector failure

2021-07-19 Thread Cora Sutton
Those are functions that call booleans as functions. Try this: (defn simple-true [] true) On Mon, Jul 19, 2021 at 5:41 PM Jack Park wrote: > Great points! > They are filled with functions which look like this > > (defn simple_true [] (true)) > > They are not booleans but functions which return

Re: Strange Vector failure

2021-07-19 Thread Jack Park
Great points! They are filled with functions which look like this (defn simple_true [] (true)) They are not booleans but functions which return a boolean. Here is a list of two of those as produced by the code: (#object[ie4clj.Tests$simple_false 0x3a4621bd ie4clj.Tests$simple_false@3a4621bd] #o

Re: Strange Vector failure

2021-07-19 Thread Cora Sutton
Your members list needs to be filled with things that can be called as functions, since that's what that code snippet does, and booleans definitely cannot be called as functions. That's what the error means, there's a boolean in your list and it's trying to cast it to an IFn (a Clojure function int

Re: Strange Vector failure

2021-07-19 Thread Jack Park
Cora (every? (fn [member] (member)) members) works fine on [constantly true & false but fails with java.lang.Boolean cannot be cast to clojure.lang.IFn on the lists I construct. In truth, I thought all the code was working, but that turned out ot be an artifact of the test I designed. When I chan

Re: Strange Vector failure

2021-07-19 Thread Jack Park
So, that did the trick. No more defs or atoms, a few tweeks, and it ran. naming conventions brought into line with clojure. Next step is to prove it can return a false, and then continue adding features. Many thanks to all, and particularly to Tanya for reviewing my code. On Mon, Jul 19, 2021 at

Re: clojure is supposed to be 'code is data' yet I can't add to the end of a list?

2021-07-19 Thread James Reeves
Don't get be wrong: Clojure can manipulate lists easily. You can append items to a list with (concat xs '(5)) or use syntax quoting `(~@xs 5). You just can't use conj specifically, as that function has a particular use case. The problem with manipulating code is that code is complex. The same f

Re: clojure is supposed to be 'code is data' yet I can't add to the end of a list?

2021-07-19 Thread SideStep
Thanks James, will for something like it I think. Still, would be nice if code was manipulatable with ease - clojure style. Code-is-data such a powerful idea. On Sunday, July 18, 2021 at 7:43:20 PM UTC+2 James Reeves wrote: > "Code is data" comes up in Clojure less than newcomers might expect.

Re: Strange Vector failure

2021-07-19 Thread Tanya Moldovan
I think you forgot to link it, but I think I found it :) You don't really need line 11. It will run without it. Don't use defs inside a function. Use let. Always. Don't use atoms inside a function. In fact, unless you need