#clojure logs

2015-06-13

00:19yedianyone have experience with https://github.com/kibu-australia/pushy
03:33anti-freezeMorning everyone. Does anyone know how to set up a separate mongodb environment for a compojure app during testing? The tests are littering my database.
03:37anti-freezeIts cool, I found something on SO
03:38anti-freezehttp://stackoverflow.com/questions/16297871/clojure-database-settings-per-environment if anyone was wondering
03:49wagjohmm https://github.com/google/clojure-turtle
03:54TEttingergoogle has a github?
03:55TEttingerquick somebody submit a PR to the empty repo!
03:59p_lI don't think they have empty repos on github ;D
04:00TEttingerp_l: https://github.com/google/clojure-turtle
04:00TEttingeroh!
04:00p_land it's not empty
04:01TEttingerit was when I last looked at it!
04:01TEttingernow I see it is not
05:28paulswilliamsesqd
05:49ConfusionWondering how to achieve the following: starting from a macro (defmacro solve [queries] `(l/run* (~'a) ~@queries)), where l is core.logic and and example of queries is [(l/== a 3)], I want to create a macro where the queries can use more logic variables than just 'a'. I have code that determines which free variables are used in the queries and replaces them by gensym symbols. Now I need to expand the macro to take a list of vars and replac
05:49Confusione the [~'a] by a list of literal symbols. This should be possible, right?
06:16TEttingerConfusion: would the literal list of symbols be an argument, or derived from queries?
06:18ConfusionI have the symbols available separately
06:19ConfusionSo I can just pass them as an additional argument
06:22ConfusionSomething like (defmacro solve [vars queries] (let [quoted_vars (map #(quote %) vars)] `(l/run* ~quoted_vars ~@queries))), doesn't work, because the vars are then sanitized (e.g. p1__17226#)
06:24TEttingerhm. wouldn't (map #(quote %) vars) be... unnecessary? I dunno, but it's quoted by the fact that it's an argument to a macro, right?
06:24TEttingeralso, (map quote vars)
06:24TEttingersame thing
06:25justin_smithalso, a nitpick, those aren't vars
06:25justin_smiththey are bindings
06:25TEttingerjustin_smith! the hero of the story
06:25justin_smithhaha
06:26Confusionwell, I mean 'logic variables' by that, I do not mean clojure Vars :)
06:28ConfusionTEttinger, yeah, that expression evolved from something else while trying to replicate the effect of [~'a]
06:28Confusionso indeed (map quote vars) would be the same
06:33ConfusionOh jeez, it's as simple as (defmacro foo [vars queries] `(l/run* ~vars ~@queries))
06:34justin_smithoh I am sure you could make it more complicated if you wanted to
06:36ConfusionWell, I just tried that for a while and it didn't work :P
06:38TEttinger`g core.logic aoi
06:38TEttinger$google core.logic api
06:38lazybot[CoreLogic | Data] http://www.corelogic.com/about-us/data.aspx
06:38TEttingerhm
06:38TEttinger$google core.logic clojure api
06:38lazybot[clojure.core.logic - Clojure Library Overview] http://clojure.github.io/core.logic/
06:39TEttingerlook at the implementation of run* , Confusion: https://github.com/clojure/core.logic/blob/f3f2b4c6c4a906c1fa512720aa09cb1abe312cd1/src/main/clojure/clojure/core/logic.clj#L1245
06:40TEttingerit's very similar!
06:45ConfusionTEttinger, yeah, indeed, what we ended up with here is just a pointless wrapper around run*.
07:00ionthas_Is there any way to write down a more idiomatic way of this function? (mapv + (mapv * gt1 (mapv #(- 1 %) mask)) (mapv * gt2 mask)).
07:01ionthas_I have a lot of mapv in there and I wonder if I can shorten the function.
07:03TEttingerhm
07:04ionthas_(def gt1 [1 2 3 4])
07:04ionthas_(def gt2 [4 3 2 1])
07:04ionthas_(def mask [1 1 0 0])
07:05ionthas_the result is [4 3 3 4]. What I'm doing is merging the two vectors (gt1, gt2) according to the mask.
07:07TEttinger,(mapv (fn [a b mask] (if (zero? mask) a b)) [1 2 3 4] [4 3 2 1] [1 1 0 0]) ; (mapv + (mapv * gt1 (mapv #(- 1 %) mask)) (mapv * gt2 mask))
07:07clojurebot[4 3 3 4]
07:07justin_smith,(select-keys [1 2 3] [0 1])
07:07clojurebot{0 1, 1 2}
07:07TEttinger,(mapv (fn [a b mask] (if (zero? mask) a b)) [1 2 3 4] [4 3 2 1] [1 1 0 0])
07:07clojurebot[4 3 3 4]
07:08TEttingerwhat's that, justin_smith?
07:08justin_smithTEttinger: selecting indexes of a vector
07:08justin_smith,(select-keys [:a :b :c :d] [1 3])
07:08clojurebot{1 :b, 3 :d}
07:10justin_smithnext trick is to go from that form back to a vector, of course
07:10TEttinger,(mapv (fn [mask & choices] (nth choices mask)) [1 1 0 0 2 2] [1 2 3 4 5 6] [6 5 4 3 2 1] [9 9 9 9 9 9])
07:10clojurebot[6 5 3 4 9 ...]
07:11TEttingerso this handles choice from multiple collections
07:12TEttingerionthas_, this look good?
07:13TEttingerthat many mapv-using code looked like you'd been staring at the problem for a while
07:14ionthas_Yes TEttinger thanks I will try this implementations
07:14ionthas_Yes, I've been trying to optimize that part of code (it's for a genetic algorithm)
07:15TEttingerah, nth is going to not perform super well in the last case
07:15TEttingereasy fix
07:15TEttinger,(mapv (fn [mask choices] (nth choices mask)) [1 1 0 0 2 2] [[1 2 3 4 5 6] [6 5 4 3 2 1] [9 9 9 9 9 9]])
07:15clojurebot[2 5 9]
07:15TEttingerhm
07:16TEttingerohhhh
07:16justin_smithyeah, you need a matrix flip for that one to work
07:16ionthas_mmm.... not quite what was planned.
07:18justin_smith,(mapv (fn [mask choices] (get choices mask)) [1 1 0 0 2 2] (map vector [1 2 3 4 5 6] [6 5 4 3 2 1] [9 9 9 9 9 9]))
07:18clojurebot[6 5 3 4 9 ...]
07:18TEttingerI'm thinking of how to optimize this
07:18justin_smithTEttinger: though nth where n is 2 at greatest may be cheaper than building that many vectors
07:20ionthas_There will be always 2 vectors to merge. (The two parents, the vector produced is the "child")
07:21ionthas_so the mask can be [1 1 0 0] no need for more indexes.
07:21tahmidure
07:22tahmidThat was a mistake
07:22justin_smithin that case yeah, just use nth
07:23TEttinger,(mapv (fn [mask & choices] (nth choices mask)) [1 1 0 0] [3 4 5 6] [6 5 4 3])
07:23clojurebot[6 5 5 6]
07:27ionthas_Thanks TEttinger. I will do benchmarks with criterium.
07:27ionthas_right now my function looks like this. http://pastebin.com/U41ye9Ur
07:28ionthas_The version I posted here was the abreviated one. I the lets improve readability. Maybe is because I'm new. It's a bad practice?
07:29ionthas_*I think*
07:29TEttinger,(mapv [1 1 0 0] (mapv vector [3 4 5 6] [6 5 4 3]))
07:29clojurebot#error {\n :cause "Key must be integer"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Key must be integer"\n :at [clojure.lang.APersistentVector invoke "APersistentVector.java" 284]}]\n :trace\n [[clojure.lang.APersistentVector invoke "APersistentVector.java" 284]\n [clojure.core$mapv$fn__6723 invoke "core.clj" 6612]\n [clojure.lang.PersistentVector reduce "PersistentVector...
07:29TEttingergah
07:29justin_smithionthas_: let is fine, but multiplication followed by addition is a less than straightforward way to do selection
07:30justin_smithso the version with nth is at least easier to read
07:30justin_smithprobably performs better too
07:30ionthas_ok :)
07:32ionthas_thanks justin_smit and TEttinger for the help
07:32TEttingerno prob!
07:32TEttingerit's fun
07:32ionthas_hahahah it is.
07:32TEttingeryou explained the problem nice and clearly
08:06TimMc&(format "lib-%04d" (rand-int 1e4))
08:06lazybot⇒ "lib-1666"
09:23hyPiRionTimMc: I saw this before I came on IRC: http://hypirion.com/imgs/lib-1666.png
09:23TimMchah
09:38fragukAny purpose FREE storagewith PHP5 + MySQL, Script Testing, Personal, and more! at https://www.criosphinx.net/free/
09:38fragukAny purpose FREE storagewith PHP5 + MySQL, Script Testing, Personal, and more! at https://www.criosphinx.net/free/
09:38fragukAny purpose FREE storagewith PHP5 + MySQL, Script Testing, Personal, and more! at https://www.criosphinx.net/free/
09:39wasamasa#ops
09:42gfredericks(inc TimMc)
09:42lazybot⇒ 99
10:35vamsii am using sublimerepl with windows,the repl evaluates (nil? nil) to false.
10:36vamsibut the repl on cmd evaluatesthis to true,which one is correct??
10:36lazybotvamsi: Uh, no. Why would you even ask?
10:37vamsireading this now and trying the samples out http://www.braveclojure.com/do-things/
10:53justin_smith,(nil? nil)
10:53clojurebottrue
10:53justin_smithsounds like sublimerepl is broken
10:57fragukAny purpose FREE! Create your own clan website & more wih free storage with PHP5 + MySQL, Script Testing, Personal, and more! at https://www.criosphinx.net/free/
10:57fragukAny purpose FREE! Create your own clan website & more wih free storage with PHP5 + MySQL, Script Testing, Personal, and more! at https://www.criosphinx.net/free/
11:00justin_smithamalloy_: you around?
11:58donbonifacioI want to put some data on a vector, and the periodically (every sec?) do something on the data and clear the vector. Is there something I can use specific for this?
12:02justin_smithdonbonifacio: probably an agent, atom, or ref
12:03justin_smiththough doing something with the data and then clearing it sounds a lot like a queue rather than vector
12:04donbonifaciowhat about clearing? how/when could I do that? any suggestions?
12:04justin_smithdonbonifacio: that's why I mentioned an agent, atom, or ref. These are mutable containers (though technically you cannot ever clear a vector, they are immutable, but you can replace it with an empty one)
12:05justin_smithso the agent can go from holding a vector with contents to holding an empty vector, even though the vectors cannot change
12:06justin_smith,(def a (agent []))
12:06clojurebot#'sandbox/a
12:07justin_smith,(send a conj 1)
12:07clojurebot#object[clojure.lang.Agent 0x736f370f {:status :ready, :val []}]
12:07justin_smith,@a
12:07clojurebot[]
12:07donbonifaciowhy didn0t it had [1] ?
12:08justin_smiththat's what I am wondering
12:08donbonifaciohehe :)
12:08justin_smithanswer: clojurebot is weird
12:08justin_smithI think it's because agents use threads, and clojurebot restricts threads
12:08justin_smiththe send / conj works in a real repl
12:08donbonifaciohow about then getting the data from the agent?
12:08justin_smith@a
12:08justin_smithjust as above
12:09donbonifaciono, I mean, periodically
12:09justin_smithperiodically @a
12:09justin_smithprobably something like (fn [state] (do-something state) [])
12:09justin_smithwhich is clearing it
12:09justin_smithand also using the contents
12:10justin_smithwe've got a few options for periodic execution - the easiest thing is a while or loop in a future
12:11donbonifaciook, that loop could deref the agent, operate on the data and clear the agent. Is that it?
12:11justin_smithsounds about right, yeah
12:11justin_smithdonbonifacio: better to use a function as above - it will get the state of the agent and operate on it in one guaranteed uninterrupted action
12:12justin_smithseparately using @ and clearing is a race condition
12:12donbonifacioyes, I'm seing that the update can return the new state
12:12justin_smithit could be modified in between the read and right (though you can use eg. transactions)
12:12justin_smithright
12:12donbonifaciothanks for making things clear for me justin_smith .)
12:12justin_smithnp, best of luck
12:13sojacquesHi everyone, I'm running into an issue with Java interoperability. I have some code working in the repl, but failing and returning me "No matching method" errors when I test-run my project using "lein ring server-headless"
12:13justin_smithdonbonifacio: also, people often use atoms for this stuff, but I assumed you were talking about a side effecting operation where retries would be bad (which is why I suggested an agent, they do not retry)
12:13sojacquesTried googling, couldn't really find much helping me to see what goes differently in the repl
12:14justin_smithsojacques: no matching method for what method on what object with what args?
12:14sojacquesjustin_smith: here is a gist: https://gist.github.com/klodio/2e07252a9a9d4a1d683f
12:15creeseCan you use core.typed to determine behavior at run time?
12:15justin_smithsojacques: which of those method calls is getting the error?
12:15sojacquesjustin_smith: No matching method found: push for class com.notnoop.apns.internal.ApnsServiceImpl
12:16justin_smithcreese: we have multiple tools for dispatching on type, but core.typed is for proving correctness at compile time
12:16sojacquesjustin_smith: my project.clj refers to https://github.com/notnoop/java-apns using : [com.notnoop.apns/apns "0.2.3"]
12:17justin_smithsojacques: looks like the wrong argument count https://github.com/notnoop/java-apns/blob/master/src/main/java/com/notnoop/apns/internal/ApnsServiceImpl.java#L45
12:17justin_smithlooks like it takes exactly one arg
12:18sojacquescreese: not sure if it's exactly what you're looking for, but I'm using schema for runtime things
12:18sojacquesjustin_smith: I found this after checking the code, but then what I fail to understand is why it works in the repl (and does what's intended)
12:19justin_smithoh, of course, the method has overloads
12:19justin_smithhttp://www.atetric.com/atetric/javadoc/org.apache.servicemix.bundles/org.apache.servicemix.bundles.java-apns/0.1.6_3/com/notnoop/apns/internal/AbstractApnsService.html#push(byte[],%20byte[])
12:20justin_smithwhat are the types of dtoken and payload?
12:21creeseI have a macro that returns a handler. I want to associate a "type" with the handler so I can pass it as argument to another function to determine run time behavior.
12:21justin_smithcreese: sounds like you want a multimethod or a protocol
12:22justin_smithwith a protocol you would want to use something like deftype or defrecord and implement the protocol for each of these
12:22justin_smithwith a multimethod, you can define any dispatch function you like for method selection
12:23justin_smithand then implement variations depending on the dispatch value
12:23sojacquesdtoken is a string, and payload, well, I define it in the gist using the build method of APNS/newPayload (so it should be PayloadBuilder?)
12:23justin_smithsojacques: looking at the defined methods, it seems like the payload should usually be a string or byte[]
12:24sojacquesright
12:24creeseHere is a snippet: https://gist.github.com/creese/82e095a0c9ea8a553c44
12:25justin_smithsojacques: you could use the type function to verify the type of payload at runtime
12:25justin_smith,(type {})
12:25clojurebotclojure.lang.PersistentArrayMap
12:25sojacquesI'm going to check this now
12:25justin_smithcreese: as I mentioned last night, start and stop must always return a component
12:25sojacquesit might help me to figure out why -> (send-push-notification "somedevicetoken" "somemessage") works in the repl
12:26sojacquesjustin_smith: thanks for the help
12:26creesejustin_smith: stop) is stubbed out
12:27creeseRight now, I using a schema like [:tag value]
12:27justin_smithcreese: start needs to return a component
12:27justin_smithhttp://www.atetric.com/atetric/javadoc/org.apache.servicemix.bundles/org.apache.servicemix.bundles.java-apns/0.1.6_3/com/notnoop/apns/internal/AbstractApnsService.html#push(byte[],%20byte[])
12:27justin_smitherr
12:27justin_smithcreese: also, the component code shows exactly how protocols work - the component system calls start / stop on every component and you define what start and stop do
12:27justin_smithI mean your code using component, that is
12:28justin_smithcreese: what you are doing with type* and handler is very close to how multimethods work
12:28creesejustin_smith: not a map?
12:28justin_smithcreese: it should almost always return "this", but idiomatically you would name it "component" instead of this
12:29justin_smithcreese: because if you use other components, they will be passed in as keys on your this arg
12:30creesejustin_smith: Here, type* is used to get the name of the exchange.
12:30justin_smithand it makes more sense to access (:resource component) rather than (:resource this)
12:30clojurebotIt's greek to me.
12:31creese(assoc this :key value) everywhere?
12:32justin_smithcreese: if you want to keep track of whether your component is started, or provide any resource to other components, yes
12:32justin_smithcreese: and similarly, you should dissoc in the stop method
12:32creeseyeah, I've seen that
12:32justin_smithwhich can prevent stale resources from being used
12:33sojacquesjustin_smith: the payload is a String
12:33creesewhat about the run time question?
12:33justin_smithsojacques: OK, then something's weird, because there is definitely a matching method there...
12:33sojacquestherefore: https://github.com/notnoop/java-apns/blob/master/src/main/java/com/notnoop/apns/ApnsService.java#L66 -> I'm calling it with a String token, and a String payload
12:33sojacquesyeah :(
12:33justin_smithcreese: like I said, use a multimethod or a protocol
12:33sojacquesthat also explains why it works in the repl
12:33creesein order to use a multimethod, I would need to have the type as a value in a map
12:33justin_smithcreese: it can be a key
12:34justin_smitha multimethod can dispatch on any function
12:34creeseit affects overall syntax though
12:34sojacqueshm, I'll try to see if it's also a String when I run the app using "lein ring server-headless"
12:34justin_smith,(defmulti foo even?)
12:34clojurebot#'sandbox/foo
12:34justin_smith,(defmethod foo true [_] :OK)
12:34clojurebot#object[clojure.lang.MultiFn 0x103f140 "clojure.lang.MultiFn@103f140"]
12:35justin_smith,(foo 2)
12:35clojurebot:OK
12:35creeseif I define handler as {:tag foo :val func}
12:35justin_smithcreese: or you can do (defmulti dispatch first)
12:35creesethen to call func I have to write ((:val f) 1 2 3)
12:36justin_smith(defmulti dispatch first) matches your existing representation
12:36justin_smithnot to say your representation is right, I have no idea
12:38creeseWhat about metadata for the type?
12:38justin_smithcreese: metadata is unreliable from what I have seen
12:38justin_smithyou could make an actual type with defrecord, you have code in the gist you shared showing how it's done
12:40creeseCan dispatch from a vector or does it have to be a map?
12:40justin_smithcreese: like I said above, (defmulti wahtever first)
12:40justin_smiththat will dispatch based on the first item in a vector
12:40justin_smithor list even
12:40justin_smith,(defmulti what-to-do first)
12:40clojurebot#'sandbox/what-to-do
12:41gdutraHello, I have defined a matrix: (def matrix (map (fn [x] (into [] (concat (subvec alphabet (.indexOf alphabet x)) (subvec alphabet 0 (.indexOf alphabet x))))) alphabet))
12:41gdutraIt should return a vector
12:41justin_smith,(defmethod what-to-do :cat [says] (clojure.string/join " MEOW " says))
12:41clojurebot#object[clojure.lang.MultiFn 0x1b891974 "clojure.lang.MultiFn@1b891974"]
12:42justin_smith,(what-to-do [:cat ["hello" "world"]])
12:42clojurebot":cat MEOW [\"hello\" \"world\"]"
12:42justin_smithhaha, oops!
12:42gdutrabut when I will use it it says could not cast lazySeq to Ifn
12:42creeseok, will try it
12:42justin_smith,(defmethod what-to-do :cat [[_ says]] (clojure.string/join " MEOW " says))
12:42clojurebot#object[clojure.lang.MultiFn 0x1b891974 "clojure.lang.MultiFn@1b891974"]
12:42justin_smith,(what-to-do [:cat ["hello" "world"]])
12:42clojurebot"hello MEOW world"
12:43justin_smithgdutra: map returns a lazyseq
12:43justin_smithgdutra: perhaps you want mapv
12:43justin_smithgdutra: the "cannot cast lazyseq to ifn" message means you have too many parens somewhere
12:44justin_smith,((range))
12:44clojurebot#error {\n :cause "clojure.lang.Iterate cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.Iterate cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval153 invoke "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval153 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang.Compiler eval "Compiler.java" 6792]\n [clojure.lang.Compiler eval "Compiler.jav...
12:44justin_smithlike that
12:44gdutrahmmm
12:44gdutraI'll try the mapv
12:44creeseCan defmacro return a vector?
12:45justin_smithcreese: defmacro will return a var
12:45sojacquesjustin_smith: I'm sorry I finally understood why it failed in the running server, I was feeding wrong arguments there
12:45justin_smith,(type (defmacro blah [] []))
12:45clojurebotclojure.lang.Var
12:45sojacquesthe only time where I don't use core.typed I bite myself
12:45justin_smithsojacques: I figured it was something like that, glad you sorted it out
12:45justin_smithhaha
12:46sojacques:) thanks for helping out!
12:46justin_smith,(blah) ; but of course any macro can return a vector
12:46clojurebot[]
13:45tmtwdls
13:45lazybotbin boot dev etc home lib lost+found media opt sys tmp usr
13:48tmtwdI running a clojure library - it says to run ' lein repl', is there a way to run a plain lein repl in emacs or do I just use cider-jack-in?
13:48justin_smithtmtwd: C-u M-x inferior-lisp<return>lein repl<return>
13:49justin_smithbut cider-jack-in shouldn't prevent most projects from working, if you already have cider set up
13:52tmtwdhow do I change the working directory of emacs?
13:52tmtwdwith cider?
13:52justin_smithtmtwd: if your cursor is in a file, cider-jack-in should open a repl in that file's directory
13:53justin_smitheg. you could open project.clj then jack in
13:53tmtwdokay
15:32gdutraHow can I extract this map function to a external function?
15:32gdutra(map (fn [k m] (nth (nth matrix (.indexOf (nth matrix 0) m)) (.indexOf (nth matrix 0) k))) cipher message))))
15:37amalloygdutra: (defn whatever [matrix] (fn [k m] ...))
15:37amalloy(map (whatever matrix) cipher message)
15:39gdutraohh thanks
15:39gdutraI was trying something with partial
15:40amalloygdutra: that is a general formula you can follow to convert any closure to a top-level function, if you want
15:40gdutraand do (map whatever list1 list2)
15:40amalloydefine a function that takes the things you want to close over, and returns the closure you were extracting
16:03justin_smithamalloy: the reason I was asking if you were around earlier is we got a repeat spammer
16:03amalloyi didn't get it. my bouncer only saves like 100 lines of scrollback when i'm amalloy_
16:03justin_smithahh
16:04amalloyyou can $mail me if i'm not around, of course
16:04justin_smithamalloy: it was fraguk, sadly I did not get his host or ip info
16:04justin_smithamalloy: yeah, hindsight
16:04amalloyc'est la vie
16:26noncom|2if i have to create objects to be used with java object methods that are operating on class objects, how do i better do that?
16:26noncom|2like: something.setParameter(ParameterOne.class p1)
16:27justin_smithParameterOne.class in java is ParameterOne in clojure
16:27justin_smith,(= String (class "hello"))
16:27clojurebottrue
16:29noncom|2but how do i create a ParameterOne class in clojure?
16:29noncom|2(proxe [ISomeInterface] []) will be okay?
16:30justin_smithproxy creates an instance of an interface
16:30noncom|2uh
16:30justin_smithso yeah, if ParamterOne is an interface that will work
16:31noncom|2how can i create such interfaces in clojure, not java?
16:31justin_smithwait, create a thing implementing an interface, or the interface itself? for the latter there is defprotocol and definterface
16:33noncom|2create an interface and then objects implementing it. because i need that a function accepting a Class object as a parameter to distinguish my clojure-created objects correctly, as if they were creted in java
16:33noncom|2so
16:33noncom|2(definterface ISomeInterface) and then proxy of it would work?
16:33justin_smithyeah
16:34noncom|2cool!
16:34justin_smithanother option you could consider is a defrecord, and you can provide the class of the defrecord as the class that method needs to register
16:35justin_smithbut you would need to implement protocol or interface for the methods it should have...
16:37arohnerusing optimus (https://github.com/magnars/optimus), is it possible to include a URL in a bundle?
16:39noncom|2justin_smith: can i specify constructor params for a proxy implementing a definterface ?
16:40justin_smithnoncom|2: you'll need a defrecord I think, proxies are anonymous singleton classes iirc
16:40justin_smithwhile a defrecord or deftyle has a proper constructor etc.
16:41noncom|2eh, but defrecors is immutable...
16:41noncom|2in that library there is a fast change of massive state present
16:41justin_smithso is proxy iirc
16:41justin_smithproxy doesn't even have fields
16:41noncom|2then there is no other way than using atoms or refs..
16:42justin_smithor deftype
16:42justin_smithor gen-class
16:42noncom|2in a proxy or defrecord
16:42noncom|2:)
16:42justin_smithwith deftyle you can declare actual mutable fields, with gen-class you can fake them with an atom
16:43justin_smiths/deftyle/deftype
16:44noncom|2here they do not advice using deftypes mutability: https://clojuredocs.org/clojure.core/deftype
16:44noncom|2saying its very unreliable
16:45noncom|2well, looks like i have to create that part with java..
16:45justin_smith"mutable fields are extremely difficult to use
16:45justin_smithcorrectly, and are present only to facilitate the building of higher
16:45justin_smithlevel constructs"
16:45justin_smithnoncom|2: the author of that would say the same thing about a mutable java field
16:46justin_smithit's not deftype they are calling unreliable, it is mutability
16:46noncom|2ok, so also, i have to explicitly qualify a field to be mutable by adding a long keyword to its metadata?
16:46justin_smithyes
16:47noncom|2better than nothing :)
17:56noogahi, anyone using aleph/gloss? I'm looking for tips on how to construct frames with payload length that's not directly before the payload
20:04justin_smith~gnaborretni |is| ⸘
20:04clojurebotRoger.
20:04justin_smith~gnaborretni
20:04clojurebotgnaborretni is ⸘
22:18WickedShellHas anyone here used clj-serial?
22:18TimMcProbably!
22:19WickedShellI'm having a specific problem where it's throwing exceptions when I close it, as its not managing closing the listener succesfully at a lower level, which then locks out the COM port till the entire REPL/build is restarted
22:26TimMcMaybe you can patch it and send a PR. Does it have an open issue for that?
22:27WickedShellNope, and I have no clue how to patch it yet... I think it's an error with the lower level java library but I really can't tell
22:31TimMcAh, I see.
22:54creeseWhy does "lein run" start in the user namespace? Is there a way to specify this from the project.clj?
22:55justin_smithcreese: clojure runs from the user namespace. You can specify a :main-ns for the repl to switch to, but I don't see the benefit to running from some other ns
22:55justin_smithfor the run task specifically, that is
22:57laggybithaving the REPL start in the user namespace is convenient if you keep debugging stuff in a repl.clj too
22:57laggybit*user.clj rather
22:58creeseI'm trying to do what leiningen does with "defproject" in a file, but when I eval the macro, it can't find it unless I switch to the namespace the macro is in