#clojure logs

2014-04-05

00:30LLKCKfanDoes anyone know about old Caloric Prestige Series Ranges(stove/oven)?
00:43Xavier89ho
00:43Xavier89ho
00:44Xavier89hi
00:45LLKCKfanHello
00:45TimMctechnomancy: You around?
00:46TimMctechnomancy: LLKCKfan needs kicking again
00:48TimMcPaula: ...
00:48Paulahla
00:50TimMcI didn't even know you could do CTCP with a *channel*.
00:59amalloyTimMc: sounds like a sentence i'd read in an IRC romance novel
02:19Raynesls
02:19lazybotbin boot dev etc lost+found root srv sys
02:43nightflypwd
02:43lazybot#clojure
02:44nightflywhoami
02:44lazybotnightfly
03:05amalloyexciting evening for lazybot
03:27AmandaCls dev
03:27lazybotdev lib lost+found media root sbin selinux src sys var
03:27AmandaClazybot IS FULL OF LIES!
03:36RaynesHe's full of truth, AmandaC. Pure truth.
03:36AmandaCRaynes: YOU’RE LYING!
03:45ddellacostaAmandaC, did you just type in IRC thinking it was a term? I do that kind of sh%t all the time
03:46AmandaCnah, though I have done that before
03:46AmandaCoh wait, that might be before your join
03:46ddellacostaAmandaC: wait, does lazybot accept some subset of unix commands!?
03:47AmandaCddellacosta: it appears no, it’s just a joke. :p
03:47ddellacostaAmandaC: oh. I'm torn on whether I like the joke or the supposed ability to perform ls on some filesystem in the cloud better...
03:49ddellacostaah, I see now, I should have checked history...
03:49amalloyddellacosta: it's actually a real filesystem, the actual / on the server lazybot runs on. but he randomly chooses like 10-15 directories to actually include in the output
03:50ddellacostaamalloy: ha! so it's both a joke *and* performing ls on some filesystem...
03:51amalloyddellacosta: i included a few commands and called it the unix-jokes plugin
03:51ddellacostaamalloy: nice...heh
03:51amalloymutt
03:51lazybotWoof!
03:51ddellacostahahaha
03:51amalloythis one has actually been triggered once, amazingly
04:06_gregkingsup
04:09ambrosebssarp
04:09Raynescarp
04:10ambrosebssarp?
04:11ambrosebsapparently clojurebot has nothing to say
04:48dokyhello does anybody know how to parse params from command line to map ? i have this code but problem is when some pamam has white space https://www.refheap.com/71995
04:51supersyyhttps://github.com/clojure/tools.cli
04:52supersyythat might be a more suitable tool for parsing cli options
04:52supersyysince it probably isn't too smart to start out with a string literal to begin with
04:53dokysupersyy: thanks i will use it
04:56dokysupersyy: but will it works when i use it in cycle, i need to have it in something like repl, to execute these commands in loop and every time evalute this statements
04:56clgvsupersyy: doky: I can recommend tools.cli - I used it in 3 projects already
04:57clgvdoky: huh? what exactly do you want to do? tools.cli is intended as "command line interface"
04:59dokyclgv: idea is: run program and there you write statemens to evaluate ... for example create,update,delete users
04:59dokywith options you wrote
04:59dokyhttps://www.refheap.com/71995
05:00clgvso you want to build a language that you have a repl for to manipulate your business data?
05:01dokyclgv: yes
05:01clgvdoky: well, there is a shortcut - you have clojure^^
05:01supersyyright
05:01supersyyi was thinking the same thing
05:01cYmen_good morning
05:01clgvseems that your operations are prefix notation anyway
05:02supersyyalso if you already have a few shell tools laying around, you might want to try something like 'conch'
05:02cYmen_or just use the shell of your db ;)
05:02clgvdoky: just take the verbs like "create" and build functions for them. if really needed for convenience you can build wrapper macros
05:03clgvcYmen_: right, but I assumed he wants to build more powerful abstractions
05:03supersyycYmen_ yeah but I assumed he wants something like a wrapper around that stuff :P
05:03supersyyhaha
05:03clgvsupersyy: :P
05:04dokyclgv: supersyy cYmen_ oh im a bit confused .. so what will be the best way to do it ?
05:04cYmen_^^
05:04clgvdoky: can you describe the big picture you envision?
05:06dokythe only statements i need to evaluate is [create|update|delete] [admin|moderator|user] [-u NAME| -p PASS] {-n REALNAME}
05:07dokyrealname is not needed
05:08clgvdoky: (create :admin <OTHER PARAMS>)
05:09clgvdoky: the message is, just write the statements as plain clojure function calls (or macro calls if needed)
05:09dokyclgv: ah ok
05:12cYmen_Also, this looks a bit like you have different tables for admins/users/mods. If so, I think that's weird. :)
05:13clgvdoky: the great benefit of lisp is that you can implement languages on top of it without having to write reader/parser ;)
05:14dokycYmen_: table is the same only param changes
05:14supersyyyeah... with LightTable its all I need :)
05:14supersyyone big toolkit
05:17supersyybut as clgv said without the bigger picture,... There are tons of ways of doing the same thing in Clj - just look at the project Euler solutions and how many different approaches people can find to a single problem
05:17clgvdoky: if all you want to do is programmatically manipulating a database - there are already clojure libraries which provide you with the basic functionality
05:18cYmen_Even if you want a dsl for it there is already Korma.
05:18dokyclgv: i uses korma
05:18supersyyaha
05:18cYmen_So basically, you want to restrict the possible actions?
05:19clgvdoky: so then just use it :D
05:21dokyclgv: ok i haven't though about that solution :) I thought that better way will be to be sure that all params are ok and then store to db
05:22supersyyI still don't get what you need the CLI options for then if you use korma
05:23supersyybut anyway, processing cli switches, options and such can be a tedious job without a tool and might quickly pop up corner cases
05:24dokysupersyy: i am not sure if i know what do you think ... can i pass string to korma ?
05:25supersyyyes
05:25dokysupersyy: like whole statement ?
05:25supersyySQL raw or entities
05:25supersyyboth are supported
05:25dokysupersyy: aha
05:26supersyyPersonally I did have some trouble figuring out the Korma particulars, took me a day or 3 before I finally got it
05:27supersyythe manual isnt too clear on the mechanics of mostly joins - relations stuff
05:29dokysupersyy: so the only i need is restricted other statements, becase if user will write pure sql which evaluates, he can do anythink with db
05:31clgvdoky: well dont let the user write sql at all.
05:32clgvdoky: this opens the door to SQL injection like problems
05:32dokyclgv: but when i will execute as raw ?
05:32clgvdoky: if you want your user to write queries write a query DSL
05:33dokyclgv: no my idea was to have that params as i wrote
05:37dokyclgv: sorry if maybe you thnink that i dont get it as you thought but i only learn clojure for not long time
05:37cYmen_clgv: I don't see how you can take anything the user inputs (like a name even) and use it without being in danger of sql injections.
05:38clgvcYmen_: well, then we are all doomed
05:38dokyclgv: :)
05:38clgvcYmen_: in practice you usually have escaping or checking of inputs to prevent that
05:39cYmen_Or we could just escape everything properly. ^^
05:41dokythe other solution i have is this but here param -n needs to be the last one https://www.refheap.com/71999 and it still produce the last one word as key with value nil
05:41dokywith this string "create user -u viktor -p secret -n \"myReal name\""
05:42clgvdoky: why are you so fixed on parsing strings? just write Clojure function calls instead of those strings.
05:43cYmen_Second!
05:44dokyclgv: im not sure if i understand ?
05:45clgvdoky: well you could just have a function "create" which is called like "(create :admin ...)"
05:46dokyand params must have fixed possion, right ?
05:46clgvdoky: if you need to support user queries you can do (clojure.edn/read user-query) to get Clojure data from a given string
05:46clgvdoky: depends on how you implement that function
05:47dokyclgv: sure :)
05:47clgvdoky: you have fixed position or arbitrary key value pairs as default options
06:25AeroNotixanything for paypal integration?
06:25AeroNotixSoon I'm gonna open source an auth.net library
06:28dokyclgv: no i haven't, as you wrote that string, params indicate options
06:37clgvdoky: you did not understand me. I was just stating the default options there are ;)
06:43wombawombaNewbie here. I've created a lazy sequence of primes (found at https://gist.github.com/aeriksson/d27ffc64899a0face006) using the algorithm in http://stackoverflow.com/a/10733621. However, my code has some performance issues, and I'm looking for ways to speed it up. Any ideas?
06:47cYmen_I doubt anybody will be able to help you unless you show people your code and tell them which "performance issues" it has.
06:47clgvwombawomba: maintaining the map is certainly one of the problems
06:48wombawombacYmen_: see the gist I linked; https://gist.github.com/aeriksson/d27ffc64899a0face006
06:48clgvwombawomba: I'd maintain a vector of found primes
06:49clgvwombawomba: for each new number you can do the divisibility check by e.g. reducing over the vector
06:49wombawombayeah I kindof figured the map might be problematic
06:50wombawombait's central to the algorithm though; using a vector as you propose lowers the space and time complexity
06:50wombawombaer, increases
06:51clgvwombawomba: are you sure? gotta check the original
06:51wombawombathe map only maps integers to integers though, so perhaps I could use some other data structure
06:51clgvwombawomba: ah you want to implemet the sieve of eratosthenes for the lazy-seq?
06:51wombawombaright
06:51clgvwombawomba: I think those two approaches do not fit together well
06:52clgvwombawomba: since you cant be really lazy with the sieve approach
06:52wombawombasure I can
06:53wombawombathe algorithm I pasted works fine, just slowly
06:53clgvbut you have performance issues :P
06:53cYmen_wombawomba: The core idea of the sieve is to remove all multiples of a number...if you have an infinite sequence that will take a while
06:53clgvthe vector approach I mentioned will be faster for that lazy-seq ;)
06:53cYmen_At least that's what I think clgv means. :)
06:54wombawombathe sieve status is stored in the map (and in p), so evaluating it lazily is not really a problem
06:54wombawombaalso, the map size grows as sqrt(n), which should make it plenty fast
06:55clgvfirst of all I'd store the sieve status in a java.util.BitSet since thats the most efficient way in terms of memory and operation runtime ;)
06:55wombawombathe python generator approach is analogous to a lazy-seq afaik, and it works well
06:56wombawombaI think my issues stem from the fact that recursing with a constantly changing map is slow
06:56wombawombacool, I'll check that out
06:56wombawombaalso, would making the map transient make sense?
06:58clgvwombawomba: in principle yes. but I'd use sieve of eratosthenes for fixed size ranges only.
07:02wombawombahm.. I can't really use a bitset to encode a mapping between integers though, right?
07:05clgvno. you can use a BitSet to mark the primes or maybe primes...
07:05clgvit is totally suitable if you build a non-lazy sieve
07:07cYmen_How do you profile this?
07:09wombawombacYmen_: I just used time to see how long it took to get the first 2000 primes, as seen at the bottom of the gist I linked
07:09iXenohi... I wanna fire up a clojure runtime from java (or actually from scala, but let's say java for simplicity) - and be able to discard it and reload it when needed... and also provide java objects (or scala objects, bit again lets say java) to it during init... how should I do that?
07:09cYmen_Oh, I mean like how do you figure out where the bottlenecks are.
07:09iXenoall docs seems to focus on running clojure from lein and have that run java
07:11wombawombaoh, well that's a good question then. I'd like to know the answer to that too :)
07:58ekhallHi everyone - was wondering if there were any Datomic users out there. Still getting db-id problems that I can't sort out. I made a gist at https://gist.github.com/ekhall/9991029
07:59ekhallI've gotten the same errors in demos when I simply change the entity name in the edn file - can't sort out why such a simple change causes these problems.
08:35pyrtsaekhall: I'm sorry, I can't comment in detail without seeing the definition of add-patient, but it seems to me you haven't created a partition named :db.part/patient (and you're not allowed to: the "db" namespace prefix is reserved for Datomic).
08:36pyrtsaEither create your own partition (its ident could be e.g. :part/patient) or keep using the :db.part/user partition in your tempids.
08:37ekhallpyrtsa: thank you Pyrtsa, I added the clojure file to the gist with the update-patient.
08:37pyrtsaThe partition needs to be installed with a transaction like [{:db/id (d/tempid :db.part/db), :db/ident :part/patient, :db.install/_partition :db.part/db}].
08:38pyrtsaekhall: ^ So update your schema with the above. (Of course, replacing (d/tempid ...) with #db/id[...].)
08:39wombawombaclgv: FWIW, the slowdown in my code seems to have mainly stemmed from my update-map function. I changed it to use a loop instead, and my code now seems to run faster than that from contrib/lazy-seq
08:39pyrtsaekhall: The error message said just that, btw: "Invalid db/id: #db/id[:db.part/patient -1000003]"
08:39ekhallprytsa: So in the other examples where there was a User entity that worked that partitiion was already set up? I guess the thing that confuses me is that (while learning) I've taken example schema that have occasionally worked (such as a "User" entity) and simply changed the entity name and suddenly it doesn.t
08:40ekhallI'll have to go look at that partitioning. Thank you.
08:40pyrtsaekhall: Datomic has three partitions installed by default: db.part/db (for attributes etc.), db.part/tx (for transaction entities only), and :db.part/user (for you to play with, but you should create your own partitions).
08:41ekhallAh, so user is already setup. I had a feeling it was something like that. Thank you pyrtsa
08:41clgvwombawomba: ah yes, using lazy operations for collections you want to compute eagerly is always not optimal...
08:41pyrtsaekhall: Partitions are essentially just dedicated subranges of the positive values of Long typed entity IDs.
08:43ekhallThank you pyrtsa - now I'm headed in the right direction.
08:43pyrtsaCool.
08:43pyrtsaekhall: There's also #datomic for Datomic specific discussion.
08:46wombawombaclgv: fixing that gave a 350x speedup for 2000 primes, and making the map transient gave a further 0.3x
08:47wombawombaI'm now 8x faster than the code in contrib.lazy-secs for 20000 primes
08:47clgvwombawomba: you are implementing this for learning purposes right?
08:48wombawombayup
08:48wombawombawhy?
08:48clojurebotwhy is Why
08:48clgvthat I do not need to ask how you use the primes ;)
08:49wombawombaheh, I'm using them to solve https://projecteuler.net/ problems
08:49wombawombawhich, again, is for learning :)
08:50clgvbtw: for benchmarking you should usually use "criterium" though in this case for large numbers you get a fair comparison with "time" as well I guess
08:50clgvwombawomba: well, for using primes in different algorithms a lazy sequence is in most cases not that optimal as far as I can tell from experiences with spoj.com
08:53wombawombayeah I guess that's probably true
08:53wombawombaalthough I think it makes for cleaner code :)
08:54clgva function returning a vector of primes can be implemented cleanly as well ;)
09:07petronwhy aren't regexes functions?
09:07petrone.g. (#"a*b" "aaaabbb") => true
09:08petronhm, maybe they are. *checks*
09:08gfredericksthey aren't
09:08petronand would it be possible to make them act as if they are?
09:08clgvpetron: since they are not on the JVM and Clojure function calls are based on the clojure.lang.IFn interface
09:09gfrederickspetron: not possible as a language user; clojure could be changed to let them be
09:09gfredericksyou'd have to decide if they should act like re-find or re-matches
09:09clgvyou'd either need to create a subclass of Pattern or you'd need a IFn protocol instead of the interface
09:09petronmeh, that raises ClassCastException java.util.regex.Pattern cannot be cast to clojure.lang.IFn
09:09gfredericks,(proxy [java.util.regex.Pattern clojure.lang.IFn] [])
09:09clojurebot#<VerifyError java.lang.VerifyError: Cannot inherit from final class>
09:09gfrederickssounds like subclassing Pattern isn't possible either
09:09clgvpetron: gfredericks is right, there'd be the problem what the function call to a pattern would do since there a multiple possibilities
09:10petronso that (#"a*b" "aaaabbb") is equal to (re-find #"a*b" "aaaabbb")
09:10clgvgfredericks: I'd have bet on that ^^
09:10gfrederickspetron: you *can* do this is CLJS because IFn is a protocol there
09:10gfrederickss/is/in/
09:10clgvgfredericks: comes to my mind: http://steve-yegge.blogspot.de/2010/07/wikileaks-to-leak-5000-open-source-java.html
09:11gfredericks:)
09:11gfredericksI love how easy it is to call private functions in clojure
09:13gfredericks"Today the Eclipse Foundation put out a private briefing calling me a 'non-thread-safe AbstractKeywordRemovalInitiatorFactory'"
09:13clgv:D
09:16ambrosebshaha!
09:18sisciaHi all, is clojars down ?
09:18TimMcclgv: That is fantastic.
09:19gfrederickshttp://www.downforeveryoneorjustme.com/clojars.org
09:19gfredericks^ says clojars is up
09:19clgvsiscia: no
09:19gfredericksand so do I
09:20sisciaclgv: Thanks :)
09:25gfredericksmy test.check failure has been shrinking for ~14 hours now
09:25jonheverything good takes time
09:25jonh:D
09:25gfredericksI'm thinking I might need to start a fork/helper-lib for integration-style testing w/ test.check
09:25gfredericksI guess helpers would be better so you can use it both ways
09:27clgvgfredericks: uff!
09:27clgvyou need a progress report for that one ;)
09:29ambrosebsgfredericks: what's testing?
09:30Bronsaso it looks like calling `symbol` is not as unexpensive as I thought
09:30BronsaI got a 10% perf improvements in tools.analyzer simply by avoiding a bunch of unnecessary calls to it
09:31ambrosebsserious
09:31clgvBronsa: commit?
09:31Bronsaambrosebs: looks like calling String.intern is quite expensive
09:31Bronsaclgv: https://github.com/clojure/tools.analyzer/commit/71c0484e99f53f8bb50fdf215625ace78183917f
09:32clgvinteresting
09:32ambrosebsBronsa: how did you figure that out?
09:32Bronsaambrosebs: yourkit
09:32ambrosebsnice
09:33ambrosebsand omg 10% nice work!
09:47yotsovis there ongoing work on clojurescript equivalents to tools.analyzer.jvm and tools.emitter.jvm ?
09:50ambrosebsyotsov: Bronsa has a GSoC proposal for that
09:51yotsovambrosebs: thanks
10:34gfredericksokay so let's say
10:34gfredericksa library wants to be able to serialize-deserialize things.
10:34gfrederickse.g., via pr and clojure.edn/read
10:34gfredericksbut it needs to customize some special cases
10:35gfrederickslike byte arrays or specific 3rd-party types
10:35gfredericksextending print-method seems like a bad choice for a library to be making
10:35gfredericksbut what else is there?
10:37xeqigfredericks: tagged elements? though it would have to include some data_readers iirc
10:37gfredericksedn tags are very asymmetric
10:37gfredericksyou can make your own inside your library and not bother anybody else and that's great
10:38gfredericksbut to make the corresponding types print with the tag requires a global change to print-method
10:38gfredericksI keep running into this whenever I make a library that needs to serialize/deserialize generic data
10:51john2xis there a library that provides Midje's checkers for clojure.test?
11:09wombawombaI'm getting some strange results when using a transient map in my algorithm. Specifically, I have two different versions of the same lazy sequence, one using a transient map and the other using a dynamic binding: https://gist.github.com/aeriksson/6f2a4c34481221f953a1. While the latter sequence produces correct results, the results of the former are subtly incorrect. What gives?
11:13ambrosebswombawomba: looks like you're bashing the transient in place.
11:13ambrosebsUse assoc! like assoc.
11:13ambrosebsdon't rely on side effects.
11:15ambrosebs,(doc assoc!)
11:15clojurebot"([coll key val] [coll key val & kvs]); When applied to a transient map, adds mapping of key(s) to val(s). When applied to a transient vector, sets the val at index. Note - index must be <= (count vector). Returns coll."
11:15mahakalaDoes anyone in here have experience with heroku, postgresql, and setting environment variables? My app won't deploy and I need help.
11:15ambrosebsThe doc for assoc! is awful, ignore it.
11:17wombawombaambrosebs: Sorry, I'm not sure I understand. How should I use assoc!, do you mean?
11:17ambrosebswombawomba: use the result of assoc!, and don't assoc! a transient more than once
11:17gfredericksambrosebs: yeah it misleads wrt usage and is incorrect since it occasionally doesn't return coll
11:18gfredericksI might create a jira ticket just to slightly bog down the process with docstring updates
11:18wombawombaah, I see
11:18ambrosebsgfredericks: please do
11:19gfrederickson it!
11:19gfredericksI'll have to decide on new wording myself though.
11:19ambrosebsassuming there's no current ticket.
11:20gfrederickshttp://dev.clojure.org/jira/browse/CLJ-1385
11:21gfredericksI think alex misunderstood the description
11:21gfredericksunless it was edited later
11:21wombawombaambrosebs: I actually started out using it that way, but it ran slowly because I had to use persistent! when building my lazy-seq (since I can't use recur) for that.
11:21wombawombaIs there any way to get around both these issues?
11:24mahakalaCan anyone here answer my question?
11:27gfredericksbjeanes: where are you when somebody has questions about heroku and env variables
11:28ambrosebswombawomba: I can't read your code. Might help to rewrite it with persistent data structures.
11:29wombawombaambrosebs: oh, I have that too. one second
11:29ambrosebsthanks
11:29mahakalais bjeanes the man for this topic?
11:31ambrosebswombawomba: maybe post your first transient attempt
11:39jonasenhttps://github.com/jonase/elements <- a fun app I've been working on (using CLJS, SVG, React&Reagent and ofcourse core.async)
11:40wombawombaambrosebs: all four versions are now at https://gist.github.com/aeriksson/6f2a4c34481221f953a1
11:47ambrosebswombawomba: can you add an extra loop argument for the c's in (cons c ...), then just pass the tranisent around with recur, and use persistent! at the end, and use the result to build a lazy-seq?
11:47ambrosebswombawomba: very likely I'm missing something
11:49ambrosebsah sieve is infinite?
11:50wombawombayes
11:54ambrosebswombawomba: haven't used it myself, but maybe try https://github.com/ztellman/bizarro-collections
11:55ambrosebsI don't think transients can help here
11:56ambrosebsI'm not particularly an expert, hopefully someone will double check.
12:00wombawombahm oka
12:00wombawombay. I'll have a look
12:02alpheusWhat transforms a vector into a vector of pairs? e.g. (f [1 2 3 4 5 6]) => [[1 2] [3 4] [5 6]]
12:03ambrosebs,(vec (map vector (partition 2 [1 2 3 4 5])))
12:03clojurebot[[(1 2)] [(3 4)]]
12:03ambrosebsclose enough
12:03alpheuspartition -- that's what I was looking for
12:09ambrosebswombawomba: might be worth checking if you're using the fasted arithmetic ops https://github.com/ztellman/primitive-math
12:10ambrosebs*fastest
12:43favetelinguistotal beginner trying to get things running in lighttable so i can use test.check in school project but not much is going my way, anyone got time to help?
13:56abakerso what's the preferred mechanism for asserting constraints on function inputs … pre/post? something in a do form? something else?
14:21kenrestivoi'm getting an access denied ("Reason: forbidden") when doing lein deploy clojars, using the same username and password that i can log in just fine using the web interface.
14:21kenrestivosorry "ReasonPhrase: Forbidden"
14:24xeqikenrestivo: that version already exists
14:24kenrestivoyep
14:24kenrestivoxeqi: thanks, bumped version and all is well
14:29dokyhello can anybody know how to correctly receive data ? https://www.refheap.com/72300
14:34xeqidoky: you're doing a read-string then a pr-str and then a read-string again on the response text?
14:34lemonodorkenrestivo: i run into that all the time. a friendlier error message might be nice.
14:35dokyxeqi: and how it should be ?
14:36xeqijust read the string once and get back the vector?
14:38dokyxeqi: ok i will try
14:44dokyi'm confused ... still get only one of maps https://www.refheap.com/72300
14:45dokyxeqi: isnt problem with emit-clojure-ds ?
14:47xeqidoky: possibly, you're not including the server code or your middleware stack that will transform :body into a string
14:49xeqiit looks like your read-string call is only returning the first map (since you wrap that result in vector). this leads to thinking its a server setup problem
14:50dokyxeqi: https://www.refheap.com/72300
14:52dokyxeqi: do i need something like to write it to stream or something like that ?
14:56xeqidoky: looks like ring servlet stuff treats a vector :body as a chunked response, and then sends the individual elements https://github.com/ring-clojure/ring/blob/1.2.2/ring-servlet/src/ring/util/servlet.clj#L89
14:57xeqiwhich would make coorespond with what your seeing
14:57xeqiI'd wrap :body in a pr-str
14:57xeqiso that :body is a string and it gets sent as a string representing the entire vector
14:57dokyok i will try
15:02dokyxeqi: thanks you very much :) thats work great :)
15:07munderwoHi all. Im using aleph and compojure to write a proxy. Im running into an exception 'localedata.jar (Too many open files)' . Anybody have an idea what localdata.jar does or who might be calling it too many times?
15:20yotsovmunderwo: I guess I would check if the problem persists if switching to another java implementation: if using 1.5 then trying 1.6, if using openjdk then trying oracle jdk...
15:21munderwothanks, I gave that a shot. Mysteriously it seems to have happened in connection with me doing something stupid with configuration and atoms… weird.. but have fixed it now.
15:23afgdfhello, do i need to learn cypher to fully use neo4j in clojure(neocons)?
15:31yotsovafgdf: it is probably very subjective, but I would think if you want to use any data store, it pays to know its "native" query language. I am trying to imagine using Postgres only via Hibernate never learning SQL... not a nice thought. When you have a data store, and you want to go prod with it, you always end up with times when you want to talk to it directly, with nothing standing between you and it
15:51Bronsa,(require 'clojure.reflect)
15:51clojurebotnil
15:52ivanhttps://github.com/monsanto/nreplds nREPL domain socket support; I had no idea this existed
15:52Bronsa,(->> (clojure.reflect/type-reflect clojure.lang.ISeq) :members (filter (comp '#{equals} :name))))
15:52clojurebot()
15:52Bronsa:/
15:53Bronsaerr
15:53Bronsa,(->> (clojure.reflect/type-reflect clojure.lang.ISeq :ancestors true) :members (filter (comp '#{equals} :name))))
15:53clojurebot()
15:54Bronsalooks like type-reflect doesn't return Object members when the class doesn't override them
15:56cddrAny idea how one might run a lein task from a test?
16:00gfrederickscddr: that's tricksy because of lein's dual-jvm architecture; why're you trying to do that?
16:13cddrTrying to practice "TDD" and so before adding doc generator to the project, I was thinking of writing some tests to ensure that the docs get generated correctly
16:14cddrMaybe overkill for most use-cases and if you really want to do this, you can write those unit tests in bash
16:15cddrCan you expand on the dual-jvm architecture? A google search doesn't come up with anything useful
16:22gfredericksleiningen's default behavior is to have one jvm for itself and another for everything that runs in your project
16:22gfredericksso in your case this means that the code for running a lein task isn't even around when your tests are running
16:25cddrThat makes sense
16:25Ihearyoumangfredericks: that also means it uses a clojure compiler for itself and another for every project right?
16:27gfredericksIhearyouman: I'm not sure exactly what you mean by that, but probably so?
16:31Ihearyoumangfredericks: like it uses its own clojure.jar for its stuff and a different clojure.jar for projects
16:32gfredericksthat's definitely true when the requested version of clojure is different from the one leiningen happens to be using
16:32gfredericksotherwise they'd be the same jar, coincidentally
16:41Ihearyoumangfredericks: ok, I asked cause 'lein run' downloaded a clojure.jar the first time for lein app project but I don't really know what clojure version is lein using internally
16:55gfredericksIhearyouman: ah right
17:05zakwilsonWhen I try to run a freshly-generated project from lein-droid (with lein droid doall, or subsequently with lein droid run), I get java.io.FileNotFoundException: Could not locate clojure/tools/nrepl/server__init.class or clojure/tools/nrepl/server.clj on classpath
17:25zakwilsonAnd this problem happens consistently with multiple newly-created projects and even different versions of lein-droid.
17:26cYmen_Could somebody tell me what "reify" means?
17:27cYmen_And how to pronounce it. :p
17:30andyf_cYmen_: The definition is roughly the phrase "thing making" or "to make a thing out of"
17:30cYmen_uh...so? :)
17:31andyf_I've heard it pronounced two different ways: REE-if-eye and RAY-if-eye
17:32zakwilsonGoogle gives the definition as "make (something abstract) more concrete or real"
17:32andyf_In Clojure it more specifically means to make a Java object (a thing) with a certain set of method behaviors implemented for it
17:32cYmen_So it creates a class and an instance of it?
17:34zakwilsonYes
17:37andyf_zakwilson: Have you tried 'lein deps :tree' to see if tools.nrepl is in your dependencies, perhaps somewhere indirectly you didn't intend it? I haven't used lein-droid, so can't help you more specifically there.
17:46zakwilsonandyf_: I had not, and I think that has me pointed in the right direction (it's not using the dev profile for dependency resolution, and that's where the nrepl dependency is specified, but something tries to use it at runtime)
17:49zakwilsonandyf_: and now I have it not crashing on launch by using 'with-profile dev'. That'll do.
17:50andyf_cool
17:50amalloycYmen_: well, reify creates a class once at compile-time, and creates instances of that class at runtime
17:50cYmen_hm okay
17:50amalloy(which, really, is what a lot of things in clojure do - fn does that as well, for example)
17:51amalloyin particular reify creates classes that satisfy a set of interfaces+protocols that you choose
17:51cYmen_So basically you're creating something like a java interface?
17:53amalloyno
17:53cYmen_Glad I asked.
17:53amalloyyou're creating an implementation of an existing interface
17:53cYmen_At runtime but the interface is defined at compile time?
17:53amalloy,(.close (reify java.io.Closeable (close [this] (println "closing!"))))
17:53clojurebotclosing!\n
17:53cYmen_O_o
17:54amalloyno. no interface is ever created by reify
17:54cYmen_Uh...okay but a class?
17:54amalloyyes
17:55amalloyhere i took an existing interface, java.io.Closeable, and created an object implementing it; then i called its .close method like i would any other object
17:55cYmen_So it's like a cast?
17:55amalloynot at all
17:56amalloycYmen_: what other languages are you familiar with, for analogy?
17:56cYmen_But if you're just creating an instance of a class what does the function definition do there?
17:56cYmen_C++, Python
17:57andyf_The function definition gives the behavior of that instance when that method is called on it.
17:57cYmen_At compile-time?
17:58andyf_Perhaps clearer to say "that class" rather than "that instance"
17:58amalloyyes, at compile time
17:59cYmen_Alright, so basically what the statement above does is define a new class which adheres to an interface and then instantiate it?
18:00amalloyyes, although those two things happen at different times. consider: (defn foo [message] (reify Closeable (close [this] (println message))))
18:00amalloythat creates a class once, at compile time, and creates an instance every time it is called
18:01cYmen_So, the best way to think about it is like this is Java's "new" with the class definition being sort-of in-place?
18:02amalloywell, that exists in java: (reify Closeable (close [this] (println message))) => new Closeable() {public void close() {System.out.println(message);}};
18:03amalloythat's exactly what reify does
18:03cYmen_okay
18:03cYmen_thanks
18:19AmandaC,true
18:19clojurebottrue
19:04AmandaCClojureScript question — how could I set a value on a window object, specifically __onGCastApiAvailable
19:12gtrakAmandaC: aset?
19:17amalloyor just set!, as long as you have the externs set up so that gclosure doesn't optimize that away
19:55AmandaCIf I want multiple statements in an if’s “true” block, what should I be using?
19:56gfredericksif the false part is empty, you want when
19:56gfredericksotherwise you just nest a do
19:57AmandaC,(doc do)
19:57clojurebotIt's greek to me.
19:57AmandaCo.o
19:57gfredericksdo just combines multiple statements into one
19:58AmandaCah
19:58gfredericks,(do (println 3) (println 4) "Five")
19:58clojurebot3\n4\n"Five"
19:58gfredericksthe docs are "missing" because it's a special form
19:58gfredericks,(clojure.repl/doc do)
19:58clojurebotexcusez-moi
19:58gfredericks&(clojure.repl/doc do)
19:58lazybot⇒ ------------------------- do (do exprs*) Special Form Evaluates the expressions in order and returns the value of the last. If no expressions are supplied, returns nil. Please see http://clojure.org/special_forms#do nil
19:58gfrederickshey there it is
20:23yediin om: having to manually manage / persist scroll state seems so inelegat
20:23yedis/inelagat/inelegant
20:53arrdem,(source when)
20:53clojurebotSource not found\n
20:54arrdem,(defmacro arrdems-shitty-when [c & forms] `(if ~c (do ~@forms)))
20:54clojurebot#'sandbox/arrdems-shitty-when
20:54arrdem,(source arrdems-shitty-when)
20:54clojurebotSource not found\n
20:54arrdem~botsmack
20:55amalloyarrdem: source works by looking up :line and :file metadata, and then going to read the file
20:55amalloyit's never going to work for something you def at the repl
20:55arrdemamalloy: lame... source should be metadata :P
20:56arrdemthat would actually be cool... if the expression tree was metadata...
20:56amalloysure, but people complain about clojure's slow startup time already
20:56arrdemI didn't mean for production...
20:57amalloyyou can always use technomancy's serializable-fn
20:57amalloywhich indeed stores the source, and lexical closure, as metadata
20:58arrdemshiny...
20:58arrdem(inc technomancy)
20:58lazybot⇒ 105
21:00arrdemRaynes: is there a better way for me to do IO on lazybot than just a /msg?
21:01RaynesI don't understand the question. Can I buy a vowel?
21:01arrdemI'm pondering digging my cloutjure project back up again, part of which was going to be tracking per user chan karma
21:02RaynesSo you want to talk to lazybot to do what?
21:02RaynesGet the amount of karma?
21:02arrdemyarp
21:03arrdemideally without spamming #clojure :P
21:03RaynesThat would be a lot of /msg
21:03amalloywell, it would be like zero /msg, because karma is channel-local
21:03RaynesIt'd be best if you could just talk to his database.
21:04arrdemyeah that's why this is hard... I mean I could design a query system designed to detect when #clojure is idle and spam then... but why.
21:04amalloypffft
21:04arrdemlol @ amalloy
21:04khushildepHello all - I wanted to ask, is it a breach of guidelines to post a link to a position we are looking to fill in our company for strong functional programmers?
21:04AmandaCI don’t suppose there’s any way I could get a hybrid clojure/clojurescript REPL in Emacs? Preferably with the -script one running in my webpage. I imagine not, but I figured I’d ask anyway. :p
21:05arrdemkhushildep: to this chan or to the mailing list... the mailing list seems to put up with it but I've never seen anyone try to recruit here in ~20 months of activity.
21:06khushildeparrdem: thanks for the advice so mailing list is the best place or is there somewhere else which would be more suited?
21:07arrdemkhushildep: probably... but don't come to me if your email gets moderated.
21:07khushildep:)
21:07amalloythere are occasional recruiting messages to the mailing list
21:07amalloyi think it's fine
21:07gfredericksreiddraper: woohoo I finally figured it out: https://github.com/fredericksgary/test.check/blob/1941fa1f78e59013fefb2bebed5b63549a15a7e8/src/main/clojure/clojure/test/check/generators.clj#L626
21:07amalloybut then, i don't read the mailing list :P
21:08gfredericksI thought for a couple days it was going to have to be terrible
21:08arrdemI skim the daily digest... takes ~30s and I get to feel more involved without contributing anything :P
21:08xeqikhushildep: I've seen several job posts on the mailing list, and I'd welcome them there
21:09arrdem$seen nsa
21:09lazybotI have never seen nsa.
21:09arrdemsneaky bastards
21:10arrdemdang someone else thought of that already :P
21:17gfredericks$seen the matrix
21:17lazybotI have never seen the.
21:17gfredericks$seen Community
21:17lazybotI have never seen Community.
21:17gfredericksthere we go
21:21gfrederickspro tip: you cannot (reasonably) recur in a macro because of the arg-mismatch caused by &env and &form
21:22gfredericksapparently this is the first time I've wanted to recur inside a macro
21:24gfrederickseh, it was a dumb idea anyways. emitting a call to the macro works just fine.
21:27amalloythat's interesting, gfredericks. i guess i've never tried it either
21:27amalloyyou can always (defmacro foo [x] (loop [x x] (... (recur (rest x))))), though, even if emitting a call to the macro were no good (eg, because you've lost some other context
21:27amalloy)
22:25mercwithamoutharrays in clojure are FIFO?
22:27technomancyarrays on the jvm are fixed-length
22:29mercwithamouthtechnomancy: hmm i was more so looking for an explanation to https://gist.github.com/anonymous/37688d104f0fd7420a42
22:29mercwithamouthi see what's going on. i was wondering if it starts from the bottom because thats how arrays work when iterating over them or if 'assoc' was behind it
22:31tmcivermercwithamouth: [1 2 3 4] is a vector. reduce takes one element at a time, left to right.
22:32mercwithamouthnew developer... if left to right would the result be {1 1, 2 4...} then?
22:32mercwithamouthwouldn't*
22:33tmcivermercwithamouth: ah, that's a map and its keys are not in the same order as the input collection (vector).
22:34mercwithamouthok so i shouldn't put much emphasis on the order since with maps order is inconsistent since lookup focuses on the key
22:34mercwithamouthalright
22:34tmcivermercwithamouth: yep
22:34mercwithamouthworks for me
22:59AmandaCCan someone point me at some simple code that uses core.async so I can get a feel for how I should be using it?
23:01AmandaCActually, which would be more idiomatic — I’m making something that pulls contacts out of a contacts database. I was thinking of using it where it’s a channel that gets retuned and then the API’s user can pull from that, but I’m thinking maybe a lazyseq would be more idiomatic?
23:03AmandaCArgh, I think I’m getting ahead of myself again in this mess.
23:05bob2I'm still learning c.a, too, but do you have code that does the above already, without c.a? I'm finding it easier to go from working code to core.async'd than to jump straight to it.
23:06AmandaCThe problem is what spits out the contact info is a callback, one contact at a time.
23:07bob2ah, it's an existing api?
23:07AmandaCYep
23:07mercwithamouthhmm why doesn't this work? https://gist.github.com/anonymous/a08eefaaf162fac167a3
23:07coventryAmandaC: That does sound like a good context for using a core.async channel.
23:08mercwithamouthreverse (str greet reply) in the gist, sorry
23:08bob2mercwithamouth, what did you want (greet "hey!") to do?
23:08bob2greet is presumably a string not a callable?
23:08mercwithamouthreturn the string "hey"
23:08mercwithamouththen join the two
23:10coventryAmandaC: There are some examples of serializing javascript callback outputs in the dotsters game, might give you some ideas about how to do it with the db callbacks. http://rigsomelight.com/2013/08/12/clojurescript-core-async-dots-game.html (It's cljs, but for this purpose the behavior should be the same for clj.)
23:10mercwithamouthbob2: oops =P
23:10mercwithamouthdur...thanks
23:17gtrakis there a way to link async channels to cascade on close?
23:17gtrakbesides incidentally in things like pipe and friends?
23:30yediin om: is there a way to update the cursor of the parent node?
23:31yedii'm using build all to build some subcomponents, but those subcomponents need to be able to update the parent components state
23:32ap-hello all! Clojure newcomer here (but long time common lisp user)
23:32yedihey there
23:32yediwelcome
23:32ap-I have question regarding tooling...
23:33arrdemwelcome to the land without setq :P
23:33ap-there must be a way of doing this.. but what the heck is equivalent of *break-on-signals* ?
23:33ap-i.e. have clojure stop and show me a stack trace when an exception is raised?
23:33eraserhdWhat simple html generation mechanism are people using these days?
23:33jph-eraserhd, templating? i'm using selmer atm, but many use hiccup
23:33arrdemap-: it should do that by default. the exception stack isn't terribly readable, but that's the default behavior.
23:34arrdemap-: as long as you allow the exception/signal to propagate to the top level at least
23:34ap-no - it only does it if the signal is uncaught
23:34ap-which is totally different
23:34eraserhdjph-: Hiccup seems good for working with html as data, but not good for templating. Unless I'm missing something.
23:34jph-eraserhd, checkout selmer
23:34jph-yogthos/selmer on github
23:35jph-for a quick example, create a demo project with "lein new luminus testapp"
23:35arrdemap-: we're sitting atop the JVM here. You can manually implement your catch cases to do a stack trace print, but there is no standard way to get such printing for free.
23:35jph-and then browse the src/testapp/views directory
23:36eraserhdjph-: This looks useful.
23:36arrdemap-: the core.stacktrace library provides the utilities you want to do this.
23:36ap-arrdem: thanks
23:36jph-eraserhd, yep, it has nice inheritance stuff for partial views, etc
23:36arrdemap-: no worries!
23:37ap-I sure do miss the slime debugger/inspector I tell you that.
23:37ap-but clojure really rocks.
23:37arrdemyeah.. the lack of out of the box form stepping is one of the things that several people are working on with varying degrees of success.
23:37ap-even if I've had to reprogram my brain to write code with immutable structures
23:38jph-ap-, "It Gets Better"
23:39jph-and once you realise the benefits you get from immutability
23:39arrdemjph-: we have awesome stuff like a real load path! :P
23:39jph-yep
23:39jph-clojure has spoilt me for almost all other languages
23:39jph-i took a brief look at the CL variants recently
23:39ap-arrdem: whatyda mean?
23:39jph-none really stood out for me
23:39ap-like, libraries?
23:40jph-ap-, for me, i want a CL that has a good third party library packaging/dependency system
23:40arrdemap-: to me Clojure's namespace and selective import structures are huge features. Only in the last six months did R7RS bring anything remotely like that to Scheme, and CL still doesn't have an equivalent that I consider usable.
23:40jph-arrdem, i fucking love how clojure does namespaces now i 'get it'
23:41arrdemjph-: I mean quicklisp is a thing... but it's not a thing I like
23:41arrdemanyway. we shouldn't be trash talking in front of the new guy :P
23:41ap-arrdem: weird... I thought how weird/clunky clojure namespaces were for the first 4 weeks. (compared to how nice the symbol based ones of CL were.)
23:41ap-arrdem: must be one of those things your head gets used to.
23:42jph-ap-, for a month or two namespaces were voodoo to me, i had to keep looking at examples to figure out how to use them
23:42jph-now it's second nature
23:44arrdemjph-: I mean from a language implementation sandpoint, namespaces are kina weird.
23:44arrdemjph-: not first class and all... which is actually nice about CL's namespaces.
23:44jph-arrdem, you mean they're hidden away elsewhere?
23:44ap-I'm thinking of writing something where there would be thousands (literally) of agents around. Is that "normal" or insane? The idea is that periodically, some subset of them would be "woken up" by some external event. Is such a design going to get me into troubles with some limitations I don't yet understand?
23:45jph-i remember a friend bitching about namespace overlapping in ruby... i only experienced it once, i never have that issue in clojure
23:45jph-i have so much control over my namespaces
23:45arrdemap-: depends on how your threadpool is controlled and how many agents you expect to have active at once
23:45jph-at first i thought it was too much control, and made code harder to read
23:46arrdemap-: that may actually be a better use of the core.async library
23:46jph-ie, you could either (:require [clojure.string :as s / str / string] or :refer :all or :refer [upper-case]
23:46jph-lots of power
23:46arrdemI still don't get why use lets you :exclude and require doesn't...
23:46arrdem,(doc require)
23:46ap-arrdem: are there guidelines? i.e. a grunty server, 8 cores, 64 Gb ram... 10,000 threads should be ok?
23:46clojurebot"([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents...
23:47arrdemap-: I mean the only way to find out is to try... right? :P
23:47arrdemap-: benchmark then optimize and all that..
23:47ap-arrdem: yeah, but that's the expensive way... others may have the relevant experience already
23:47ap-I noticed Rich Hickey's Ants demonstration just declared a big array of agents at startup, no?
23:47arrdemI've got 1k DOGE says I can spin up and hammer 10k threads in < 15 lines...
23:48ap-but it's just a toy...
23:48arrdem... and a high load toy is a reasonable approximation of a presumably lower load production system, no?
23:48ap-arrdem: oh, spinning them up is easy... keeping them from starving and keeping each other from working is another story
23:49arrdemtotally. all that depends on the parallelism semantics of your application and I can't comment.
23:49ap-but my impression is that clojure is encouraging me towards this sort of design. Just curious if others have done that.
23:49arrdemclojure.core.reducers may be something for you to look at
23:49ap-I guess I'm a bit scared because I have no idea how I would profile/debug such a design (at the moment).
23:50ap-(core.reducers? don't even know what that is. I'll go check it out).
23:50arrdem$google clojure core reducers
23:50lazybot[Clojure - reducers] http://clojure.org/reducers
23:51jph-ap-, the difference is you dont have state to really worry about
23:51jph-ap-, due to immutability
23:52arrdemjph-: unless he does evil things with mutables or atoms...
23:52jph-yeh
23:52jph-which reminds me, i always get a laugh about that "one library that rich hickey doesnt want you to know about!"
23:52jph-that lets you mutate stuff
23:52ap-well... yeah, each agent will at least have to keep some sort of state
23:53ap-but it's fairly well contained; an event occur; some subset of agents each "consider" the task, compute some internal state, and add some value to a priority queue somewhere, then go back to sleep.
23:53jph-you do have to learn a different way to think
23:54jph-but at the end, you have a much more dependable, performant system
23:54arrdemanyone know of a 2d topology library for Clojure or am I just gonna have to roll my own..
23:56jph-i'd assume there's something in the java world you can leverage
23:56arrdemyeah I'm looking at JTS now.
23:57arrdemwell this is garbage... no circles! only polylines...