#clojure logs

2015-12-05

01:06moredhelhi all, trying to work on a patch for om, but don't know how to include local libraries in lein. could someone give me a hand? or should I be asking this in #clojurescript?
01:08SeanliuHai
01:10tolstoymoredhel: I think the answer is to run a maven command to "deploy" them to a repository that's in your source code.
01:11moredhelah, that sounds painful. tbh, my java-project management skills are zero.
01:11moredhelis that easy to grok?
01:11tolstoyhttps://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/
01:11moredhelah, perfect :)
01:11moredhelthanks!
01:12tolstoymoredhel Maybe also this? https://github.com/kumarshantanu/lein-localrepo
01:14moredhelthanks, gonna have a run through now
01:14tolstoyThe lein folks seem oppose to free floating jars, for good reasons, but sometimes you just need to do it to see if it's even worth the effort.
01:15tolstoyI think you can also add a ".lein-classpath
01:15tolstoy " file to augment the classpath as well.
01:15tolstoyI've used that for plugins I don't want to deploy separately.
01:16moredhelbut then how do I develop against a local copy of om for instance?
01:16tolstoyWhat I've done is check out the Om repo, make your changes, then run "lein install" and it'll put it in your local ~/.m2.
01:16moredhelah, didn't know about the lein install thing.
01:17moredhelso I can write it, then run that, and it overwrites the 'upstream' version
01:17tolstoyIf you're not sure it's working, add a change that prints something, or whatever.
01:17tolstoyYes, I think so.
01:17tolstoyYou could also just bump the number in project.clj to be super sure, if you wanted.
01:18moredhelah yeah, that's a good though.
01:19moredhelrerunning the REPL now, I'll be a sec
01:19moredhelarg
01:19moredhelhmm... gonna try bumping version no
01:20tolstoyYou can try running watch "ls -l /path/to/.m2/dir/om" and see if date/times change. ;)
01:22moredhelhehe, trying to find om under 3m2
01:22moredhel.m2*
01:23tolstoyfind ~/.m2 -iname "om"
01:23moredhelyou are a literal live-saver
01:23moredhellife*
01:23tolstoyThis might work better: find ~/.m2 -iname "om*"
01:24tolstoyAdding a wildcard. There's a lot of versions of stuff in my cache.
01:24tolstoyorg/om, then org/omcljs, etc.
01:26moredhelalright! something seems to be happening
01:26moredhelI assume I need to update my project dependency to point to the new version too
01:27tolstoyYep.
01:27moredhelhmm:
01:27moredhelCould not find artifact org.omcljs:om:jar:1.0.2-alpha22-SNAPSHOT in clojars (https://clojars.org/repo/)
01:28moredhelseems not to be picking it up
01:28tolstoyIt's been a while, but you might also just "rm -rf .m2/repositor/org/omcljs" before running "lein install" just to make sure.
01:31moredhelyep, just nuked it, and I am getting it to build now! which is always a good thing
01:31moredheldarn, doesn't seem to be doing printy things
01:32moredhelis there a way to inspect a function definition in clojure? I know it can be done for macros
01:33tolstoyFor clojurescript, if nothing else, you can look in your "out" directory to see what got compiled.
02:47favetelinguisis there a way to change how defrecord prints its type in the repl, it is cinda unreadable for me atm
02:54kenrestivosnapshots are weird
03:50Trioxin"When you see code snippets like this, lines that begin with ; => indicate the output of the code being run." ... are these basically comments?
03:50Trioxincomments with a specific purpose rather than just ;; ?
03:51opqdonutyes
03:51Trioxink
03:51opqdonutit's just a convention
03:56j-pbhey, I'm a bit confused, in clojure you can call protocol methods on deftyped objects with and without a interop dot. But in cljs you can't.
03:57j-pb(.foo x) (foo x) are both valid in clj but (.foo x) will fail in cljs
03:59j-pbwhat is the correct behaviour here? I'm asking because data.avl has this piece of code https://github.com/clojure/data.avl/blob/master/src/main/cljs/clojure/data/avl.cljs#L1170
03:59j-pbin it's cljs implementation, which was ported from the clj version, and I don't understand why it works
04:01Trioxinso in clojure, an if statement has preset logic flow of "evaluate -> execute if true -> execute else" but what about elseif?
04:03ARM9see cond
04:03Trioxink
04:12Trioxinin this (when true (println "Success!") "abra cadabra") is "abra cadabra" the same as doing ; => "abra cadabra" ?
04:14Trioxinor is that what gets returned for some reason?
04:15Trioxinit was printed in the repl as => "abra cadabra"
04:17TrioxinI see that the jar doesn't output that line.
04:42Trioxinwhy does this evaluate nil? I was just trying to get 2 println for if true: (if true (do (println "true1") (println "true2")) (do (println "false")))
04:43Trioxinor just put them all in the same do I guess
04:43sqlmananyone using yesql ?
04:44sqlmanis there a way to do simple string substitution in query
04:44sqlmane.g. select * from (:subquery)
04:47Trioxinoh nvm, the return value isn't specified
08:37beakyso...
08:37beakyhow well does clojure adhere to rich hickey's philosophy on simplicity
08:38beaky(in how its features 'complect')
08:38beakyor rathre decomplect :D
09:12OscarZi was thinking of testing core.async a bit and make a ring web app that would create a channel when the server starts.. the incoming web requests would then put some stuff in the channel, and it would process the stuff asynchronously
09:13OscarZis this a bad idea? i remember reading something that channels are supposed to be light weight etc. and shouldnt live long
09:15OscarZi would like to have 3 threads that will process the requests from channel concurrently
09:15OscarZis this a use-case for core.async or would something else work better?
09:35gfredericksOscarZ: I think ring might be incompatible with that actually
09:35gfredericksat least if you want to avoid having ring's thread pool blocking on the whole thing
09:35gfrederickspedestal had a non-ring approach to solving that, I don't know which other libraries do
09:36OscarZgfredericks, ok.. i thought if i have a go- block, then it wouldnt block it ?
09:38gfredericksOscarZ: but any ring adapter is going to block, because the core idea of ring is a function that takes a request and returns a response; no matter what you do inside that function, there'll be a thread sitting there waiting for the function to return
09:39OscarZive done a bit of testing with http-kit.. its ring- compliant though.. but do you mean that the ring programming model, having those "handler" functions is not going to work with this idea?
09:40OscarZok.. yes.. i just realized that
09:41OscarZthe whole idea of "thread parking" is a bit vague for me as im used to Java programming etc..
09:46ucbI'm having a bit of trouble with gen-class, namespaces, and symbols. Imagine I have a thread that will eval whatever you send to it (via messages, IPC, whatever) and that it uses (eval form-sent-by-other-thread)
09:46ucbI'm running into namespaces not bein available (same for symbols that were in the closure that spawned the thread)
09:46ucbbeing*
09:46ucbso I'm obviously not understanding in which context (eval ...) evals forms
09:48ucbany thoughts or pointers to rtfm?
09:49ucbI mentioned gen-class because I kick everything off via gen-class and -main
09:50ucbmostly because if I test the main fn in a repl, everything works
09:50OscarZgfredericks, do you think it would be possible to have a macro that would take a list of handlers forming the ring application and based on that inject all code that is required for core.async to work (sacrifice goats, etc..)
09:50ucbI assume because the fn is being evaluated in the ns where all things are required, and vars declared, and so on
09:50OscarZgfredericks, which would return a single handler with all the magic
10:02gfredericksOscarZ: nope, still wouldn't be able to use it with any vanilla ring adapter
10:02OscarZok.. good to know..
10:03kungiWhen someone in your company is sick and someone second does his job until the first one returns. How do you call the second one? I found proxy or deputy in the dictionary but this does not sound right to me.
10:04OscarZwhat if i dont care about the result for the ring app.. i just want to "submit" some work to be processed.. and i want 3 threads to process them, would core.async then be ok to use?
10:10OscarZkungi: maybe "substitute" or "replacement".. if its soccer, then its definitely substitute
10:10kungiOscarZ: Substitute sounds good
10:17kungiOscarZ: Thank you
11:36favetelinguisis there a way to change how the repel outputs my records, right now it prints very long names, i was hoping i could override som toString thing but cant find any examples on internet
11:37j-pboveeride Object (toString [this])
11:52schmeeanyone in here using react-select with Reagent?
11:53schmeeI'm trying to make it work but I'm running into some errors I can't figure out
12:57jonathanjhow does one use the :client-auth option for the jetty ring adapter?
12:58jonathanjso you specify :client-auth :need, but then how does one actually control client cert auth?
13:35jjttjjis there any sort of paid pair programming or code review service out there that can be used with clojure?
13:35ARM9http://vpaste.net/up6Ss do you really have to typehint types/records to avoid reflection or whatever is causing the slowdown?
13:36ARM9(also curious that keyword accessors are allowed for deftype'd types)
13:38ARM9nvm it's not allowed, it actually just returns nil
13:46justin_smith,(:anything 2)
13:46clojurebotnil
14:16swhalenHello #clojure
14:16swhalendoes anyone have any recommendations for clojure plotting libraries?
14:17swhalenI am aware that incanter has some plotting facilities, but it looks like a stalled project so I am wondering if there is a newer plotting library that people are using
14:24scottjswhalen: https://github.com/JonyEpsilon/gg4clj
14:27swhalenscottj: thanks, I'll take a look. ggplot2 is nice
14:28jjttjjswhalen: probably not ideal but i ran into this problem too and ended up settling on just using a javascript library like highcharts that just takes a big json map and renders a visualization from it, generating this map in clojure then converting it to json and, then shoving that json in a html file that's ready to go with highcharts using format, then useing clojure.java.browse-url to open a browser with said html file
14:31jjttjjsounds convoluted but i've been really pleased with the results
14:35swhalenjjttjj: cheers, it does sound convoluted but of course you only need to set it up once
15:55WickedShellIs there a limit to the number of messages I can stick in a chan if I don't provide a buffer or a fixed size? I'm under the impression there isn't (well outside of memory etc)
15:55justin_smithWickedShell: yes, there's a default buffer size
15:57WickedShelljustin_smith, darn! was really hoping there wasn't :P
15:58WickedShellWould I pay a large memory penalty if I just set the buffer size to be fairly large? (I'm assuming no, as it should be just the refs?)
16:14rhg135How large are references on the jvm?
16:22jonathanjwasn't there a flow chart about selecting which form of reify, defrecord, deftype, genclass you need?
16:22rhg135~types
16:22clojurebotTitim gan éirí ort.
16:23rhg135It's somewhere
16:23jonathanjhttp://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
16:23rhg135Ah yes that
16:23jonathanjcool, looks like I just need reify
17:54WickedShellif I pass a map to a function I can explicitly bind members of the map in the argument specifier (I forget the name for this, sorry). Is there an equivelent I can use in a let statement? IE I have a function that returns a map, can I bind the results directly without having to first bind the overall map?
17:56WickedShellohh looks like I can use the same keys structure.. duh
17:56WickedShell,(let [{:keys [a b]} {:a 1 :b 2}] (+ a b))
17:56clojurebot3
17:58crazydiamondHi. What tool is better to use to deploy Clojure Web projects?
17:58ianhedoesitcrazydiamond: what do you mean better?
17:59ianhedoesitdo you have your own server? are you using a vps service?
17:59crazydiamondI mean one that doesn't require much work to do it
17:59crazydiamondYes I do
18:01crazydiamondthing that I wonder about the most is what tool to control server process with
18:01crazydiamondShould I use Python's supervisor for that?
18:01crazydiamondalso, "better" means "what many ppl use"
18:02ianhedoesitcan't you just java -cp clojure.jar clojure.main -m project.web?
18:02ianhedoesitor something
18:02crazydiamondand leave terminal open?
18:04ianhedoesitI mean I suppose it depends on what you're using in your project
18:04crazydiamondhow's that?
18:05crazydiamondI think it would be Ring, in the end
18:05tolstoycrazydiamond: I've been playing with "monit". Seems to work well.
18:05tolstoycrazydiamond: Though I use /usr/bin/daemon to start/stop it so I get a clean PID, which monit requires.
18:06crazydiamondthanks, but absence of common answer make me think that people unlikely use Clojure in production at all (I'm actively using Clojure 1 year or so, but for data processing mostly), which is very frustrating
18:07tolstoycrazydiamond: Because clojure runs on the JVM, people use whatever JVM requirements or techniques they're used to at their respective companies.
18:08tolstoycrazydiamond: You can turn your app into a War file and deploy to any App Server, for instance.
18:08tolstoycrazydiamond: Or you can run it as a jar file and use any of the numerous techniques for running those in production.
18:08tolstoycrazydiamond: Make sense?
18:09crazydiamondyes, thanks ianhedoesit and tolstoy !
18:10tolstoycrazydiamond: That supervisord thing works just fine. Tell it to "java -jar <your-uberjar>.jar" and it Should Work (™).
18:14crazydiamondokay :-)
19:14MONODAI'm having trouble writing a protocol for my matrix implementation
19:14MONODAIt requires recursion but when the program enters the first recursive call, it calls the default matrix implementation's protocol
19:24alive876newbie: running some of the ring tutorials, curious why i can't seem to connect externally, although i can see the rendering on local host using curl. the simple code is here :http://pastebin.com/LS5kVUvN thanks!
19:24jonathanjhow do i spell byte[] as a type hint again?
19:26hyPiRionI would guess ^bytes
23:47TrioxinSo I'm finally getting the hang of Clojure (My first Lispy language) where I can do most basic things. The more I code the more I find myself saying "This is some weird shit" (In a good way).
23:48Trioxinstrangely intuitive comes to mind
23:50pontikiyour mind warps around lisp and then nothing ever seems right again
23:52TrioxinI'm mainly doing this to apply machine learning. I've seen many examples where implementing algorithms displayed far less code than I'm used to and that seems to be true of just about anything.
23:53Trioxinin Clojure that is
23:54Trioxincoming from D, C#, JS, PHP. Can't wait to start using clojurescript as well.
23:57Trioxinclojurescript with HTML5 in node-webkit's DOM for frontend + clojure jars and clojurescript in node for backend of apps sounds beautiful.
23:57Trioxinwell, node-webkit and cordova/phonegap
23:58Trioxinwill iOS be a pain still? We'll see when it comes time for heavy lifting.