#clojure logs

2013-04-21

00:15murtaza52I am using emacs with nrepl. I evaluated an expression and it returned an error. How do I get the full stack trace ?
00:15ivan(pst)
00:17murtaza52ivan: It returned just one line - user> (pst)
00:17murtaza52NullPointerException
00:17murtaza52nil
00:18ivanmurtaza52: are you using lein 2.0.0? a newer version fixed https://github.com/technomancy/leiningen/issues/1025
00:22murtaza52ivan: yes I am, should I just do lein update
00:22ivanI think so
00:23ivanlein upgrade
00:54saint_cypherst50187
01:09david_pidcockjacfr04t
01:51howdynihaoso can i bring this up, http://benchmarksgame.alioth.debian.org/u32q/benchmark.php?test=all&lang=clojure&lang2=scala&data=u32q ?
01:51howdynihaowhy slower, more memory usage, and shockingly more loc
01:53bbloomhowdynihao: lines is not how the benchmarks game measures code
01:54howdynihaooh ok, well mostly i'm just curious if performance and memory optimizations is a big priority on the roadmap for clojure
01:55bbloomthe benchmarks game is not indicative of real world performance
01:56bbloommost of the problems are numerical in nature, which performs particularly poorly in the face of dynamism
01:56bbloomso you wind up with lots of type hints, which drives the code size up, where scala can infer those type hints
02:11callenokay, so deploying clojure with gantry is a pleasure.
02:11callenall hail the uberjars.
02:11callenyogthos: lein ring uberjar is my god.
02:11yogthoscallen: haha
02:12yogthosit's pretty slick :)
02:13bbloomi never really understood the appeal of capistrano or fabric... bash always seemed easier AND simpler
02:22ebaxt,(clojure.string/replace (pr-str ["foo", "bar"]) " " ", ")
02:22clojurebot"[\"foo\", \"bar\"]"
02:23ebaxtIs there a better way to print a vector with commas?
02:24bbloomnot really. what do you need them for?
02:26ebaxtI'm creating a script tag on the server side in order for require.js to load a common config object.
02:26bbloomuse a JSON serializer
02:27ebaxtthx, didn't think of that :)
02:30callenyogthos: but seriously man, deploying (uber) jars is way easier than deploying a python or ruby app.
02:30callenyogthos: I'm not really managing the static assets properly though.
02:30yogthosagreed
02:30callenyogthos: ended up doing nginx proxy pass to jetty process.
02:30callenyogthos: automated the deployment with gantry
02:30yogthosthat's one way :)
02:30callenyogthos: you one of those tomcat pukes?
02:31yogthoseh I use glassfish mostly :)
02:31yogthosbut same thing
02:31callenyogthos: wtf, enterprise weirdo.
02:31yogthoslol
02:31callenyogthos: you look at gantry yet? How do you deploy? Do you automate?
02:31yogthosI just don't see the advantage of doing all the stuff by hand that it already handles for you :)
02:31yogthosyeah you dump a war in its deploy folder and magic happens
02:32yogthosso I just do lein ring uberwar instead :)
02:32yogthosalso wars avoid the problem of not being writable
02:32callenthere's nothing "manual" about running a jetty process and proxying it with nginx.
02:32yogthosso you don't have to figure out how to handle resources separately
02:32callenohhhh THAT'S why people use wars.
02:32yogthossame with gf :)
02:32yogthosglassfish is very scriptable
02:33callenyogthos: I'm used to having to push static assets into a CDN, so WARs don't mean much to me.
02:33callenthat makes sense though./
02:34callenyogthos: but seriously, how do you automate?
02:34callenif I didn't use stuff like fabric or gantry I'd lose my mind.
02:34yogthoswell at work I've got jenkins going
02:34callenfor scripting the deploys.
02:34yogthosso I just commit and it does the rest
02:34callenI have too many projects to use CI for my stuff.
02:34callenalso I don't write tests for my clojure web apps.
02:34callenbecause I'm a nihilist.
02:34yogthosit's kinda neat cause with jenkins you can setup deps between projects
02:34callenI do for libraries though.
02:35yogthosso if I deploy one it can trigger builds for all the upstream stuff
02:35yogthosyeah I don't usually write a lot of tests for apps either
02:35callenyogthos: my problem is 0-60 friction. I need to be able to go from idea to "bang" as quickly as possible - not efficiently deploy a complicated SOA.
02:35yogthosI like functional tests for sanity mostly if I go refactoring
02:35callenalso clojure monger needs a korma'ish dialect wrapper.
02:36callenyogthos: I would really like a lightweight alternative to webdriver for that.
02:36yogthoswell with glassfish or even tomcat, you leave that thing running
02:36yogthosas soon as you build and dump a war in the deploy it watches that and reloads your app
02:36callensorta how apache wsgi works.
02:36callenlittle less tightly coupled, but similar.
02:37callenI prefer lightweight generic stuff like proxy backends.
02:37yogthosyeah I played a bit with monger recently
02:37callenthen I can swap things in and out no matter how they work.
02:37yogthosoverall it's not bad
02:37callenyogthos: well I'm too fucking lazy to use postgres for speculative projects - soooo....
02:37yogthoshehe
02:37callenyogthos: I'd rather use rethinkdb but they don't have 2i or a clojure driver yet.
02:37callenwhich I keep bugging them about. I may have to wrap their java one.
02:37callenwhich is also alpha quality :\
02:38yogthosI'd stick with monger till that matures :P
02:38callenyogthos: if you need to do any fabric-esque dev-ops automation/scripted deploys take a look at gantry.
02:38yogthosnoted
02:38callenmonger is good, it's clojurewerkz, it's just somewhat low-level.
02:38callenalso I *really* don't like the default update/insert semantics, they're fucking dangerous and I have to wrap them in my models.clj
02:38yogthosa friend of mine is big on vagrant
02:39yogthosI haven't really played with it though
02:39callenI don't like stateful VMs.
02:39callenwell, vagrant is stateful'ish
02:39callenvagrant solves a totally different problem from gantry though.
02:39callengantry is for provisioning, deployment, automation, scripting
02:39callenvagrant is for dev environments.
02:39yogthosgotcha
02:40callenyogthos: gantry is, "run this command on this host"
02:40callensame as fabric,.
02:40yogthosyeah so I guess glassfish sort of does that with its remore scripting
02:41callengantry is more general than that
02:41callenit can manage n-hosts doing anything at all.
02:41yogthosoh no doubt
02:41callengantry is a component of my "replace heroku" toolchain.
02:41callenoh speaking of, I replaced my heroku app. my clojure app had something like 60% uptime with heroku
02:41callenused mongohq and digitalocean to replace it.
02:42yogthoslet me know how you like those guys
02:42yogthosthey certainly looks fantastic on pricing
02:42callenyogthos: I've had some minor issues with DO, but I like them better than Linode for a few reasons
02:42callenone biggie is that they handle key propagation for you automatically *and* have an awesome API.
02:42callenDO has an *amazing* API, it's nicer than fucking EC2.
02:43callenyou can instantiate machines from images or blank templates *very* easily.
02:43yogthosnice
02:45callendemerits of DO are: their network is public, not virtual private like Lindoe
02:45callenalso, their CPU is somewhat less powerful than Linode. Disk is way faster though.
02:45yogthosyeah ssd
02:45callenthe SSDs tempt one to cheat persistence by having local state on the web workers :P
02:45yogthosand you get a nice amount of ram
02:45callenyeah that's the biggie really. helps with concurrency per worker.
02:46callenDO machines would be ideal for logging or API servers
02:46callenless great for CPU intensive workers.
02:46yogthosmakes sense
02:54murtaza52I have a hashmap of data with the key a string description and value an integer weight.
02:54murtaza52{:a 1 :b 3 :c 7 :d 2 :e 5}
02:54murtaza52I need to transform the hash into a vector of vectors. Each internal vector in turn is a coll of map entries. The constraint being that all the weights in each internal vector should equal to 9.
02:54murtaza52[[[:a 1][:c 9]]
02:54murtaza52 [[:b 3][:d 2] [:e 5]]]
02:54murtaza52How do I write a fn to do it ?
02:55callenmurtaza52: it's just a map, it's not a hashing implementation.
02:55callenactually, it is
02:55callenI think they're HAMTs
02:56callenanyway, they're just called maps (lol)
02:56bbloomcallen: there are multiple concrete implementations
02:56callenbbloom: what is there other than HAMT?
02:56bbloomcallen: 3 primary implementations: PeristentArrayMap, PersistentHashMap, and PersistentTreeMap
02:57bbloomcallen: the first is used for small maps, the second used in general, and the last is used for sorted maps
02:57callenbbloom: cool, thanks.
02:57yogthos,(into [] {:a 1 :b 3 :c 7 :d 2 :e 5})
02:57clojurebot[[:a 1] [:c 7] [:b 3] [:d 2] [:e 5]]
02:58yogthosmurtaza52: is that what you're looking for?
02:58yogthosmurtaza52: oh nm read the rest
03:19asalaaakhi mates
03:20asalaaakcan someone help me to make a do expression with this: (int (+ ( / (* 3 -774) 3 ) 774 465))
03:25asalaaakcan someone help me to make a do expression with this: (int (+ ( / (* 3 -774) 3 ) 774 465))
03:28arcatanasalaaak: what do you mean by do expression?
03:29asalaaakso it prints the numbers and
03:29asalaaakgives a println with the answer
04:07murtaza52I have a map of data with the key a string description and value an integer weight.
04:07murtaza52{:a 1 :b 3 :c 7 :d 2 :e 5}
04:07murtaza52I need to transform the hash into a vector of vectors. Each internal vector in turn is a coll of map entries. The constraint being that all the weights in each internal vector should equal to 9.
04:07murtaza52[[[:a 1][:c 9]]
04:07murtaza52 [[:b 3][:d 2] [:e 5]]]
04:07murtaza52How do I write a fn to do it ?
04:13jjidomurtaza52: transforming is easy, applying the constraint is not
04:14jjidoalso 1+9 = 10, not 9
04:48amalloymurtaza52: i think your weights problem is NP-hard
05:01callenamalloy: knapsack problem ain't it?
05:10supersymshoot
05:44tgoossensIf I understand it correctly. identities/refs pointing to other refs in clojure is just not-done?
05:45tgoossensLike in java i had Board object that has a list of player objects
05:46tgoossensBecause then your refs don't have a "value" anymore
06:11Ember-hmm, I wonder how I should bind a compojure route which contains *both* path parameters and request parameters
06:12Ember-it doesn't seem to pass the request parameters
06:12Ember-and yes, I have to appropriate middleware in place
06:12Ember-to = the
06:12Morgawrmm.. what's the difference between ->> and ->? Is it just that ->> adds the item as first in the function and -> adds it as second?
06:13Ember-Morgawr: ->> adds as the last parameter, -> as the first
06:13tgoossenscorrect
06:13Morgawralright, thanks :)
06:13tgoossens,(-> [1 2 3] (filter even?))
06:13clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$even_QMARK_>
06:13tgoossens,(->> [1 2 3] (filter even?))
06:13clojurebot(2)
06:14Morgawr,(-> even? (filter [1 2 3]))
06:14clojurebot(2)
06:14Morgawrgreat :) I think I got it
06:14tgoossens:)
06:16Ember-I thought the binding thing I asked above would work like this:
06:17Ember-(GET "/foo/:bar" {{bar :bar a :a} :params} (str "Hello" a"))
06:17Ember-but unfortunately it doesn't seem to work
06:18Ember-should match into /foo/something?a=foo for example
06:18Ember-and yes, I typoed that example :)
06:18Ember-but you get the picture
06:23Ember-oh crap, I think I hit this https://github.com/weavejester/compojure/wiki/Common-Problems
06:23Ember-"One example of this is if you had two sets of routes each with wrap-params wrapped around them in the same stack. Only the first routes would have the params."
06:24Ember-just tried, bindings work as expected in the first route mapping
06:50ziltiIs there an actively maintained clojurescript routing library?
07:10ziltiIs there an actively maintained clojurescript routing library?
07:52GlenjaminEmber-: you should be able to do (GET "/foo/:bar" [bar a] (stuff))
07:53Glenjaminsee https://github.com/weavejester/compojure/wiki/Destructuring-Syntax#compojure-specific-destructuring
07:56Ember-yes, I know
07:57Ember-was just trying to figure out what's going on
07:57Glenjaminah ok
07:57Ember-and thus used the more exact destructuring version for parameter binding
07:57Ember-and btw, managed to fix my problem
07:57Ember-thanks anyway :)
07:57Glenjamini tend to throw in [:as req] on the end, and then (prn req) for debugging :)
07:58Ember-not a bad idea
08:51murtaza52what are the scenarios where structs are advantageous over maps?
09:42amaevisHi everyone. I had a question about how ensuring that a service starting or stopping is synchronized so you don't get 2 starting calls processing at once.
09:42amaevishttp://stackoverflow.com/questions/16131420/canonical-way-to-ensure-only-one-instance-of-a-service-is-running-starting-s
09:42amaevisIs there a canonical way to do this in the community? Or better yet, an existing lib?
10:55MorgawrI have a question.. I have an atom which contains a hashmap (let's say {:x 0 :y 0}, like a set of coordinates), now I have a collection of symbol + value (like [[:y 4][:y 3][:x 5][:y 3]]) and I want to swap! with assoc on that atom for each key-value pair from that collection
10:55Morgawrwhat would be the best way to do so?
10:56Morgawrso far I have a simple function which is a wrapper around swap! (with better syntax imo) which works like this:
10:56Morgawr(defn remap-state [state sym value] (swap! state #(assoc % sym value)))
10:56MorgawrI want to call "remap-state" on the atom and the collection, I was thinking about using a map but it doesn't seem to be working properly
11:00IamDrowsywhat about making a map out of the collection (with into {}) and merge them (instead of assoc)?
11:00Morgawrcan you provide an example? I'm still a newbie with clojure so I'm not familiar with all the functions
11:02IamDrowsymh... wait.. do you need every state in between? in your example your atom would look like this {:x 5 :y 3} in the end..
11:02IamDrowsydo you need the state {:x 5 :y 4} for reactions?
11:03MorgawrI just need the last state
11:03Morgawrthe resulting one after all the swap!
11:04IamDrowsyso you can just produce the last state without swaping with:
11:04IamDrowsy,(into {} [[:y 4] [:y 3] [:x 5] [:y 3])
11:04clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
11:04IamDrowsy,(into {} [[:y 4] [:y 3] [:x 5] [:y 3]])
11:04clojurebot{:y 3, :x 5}
11:05IamDrowsyand merge the old state and the new values
11:05Morgawrwith assoc?
11:05IamDrowsyno with merge
11:05IamDrowsy,(doc merge)
11:05clojurebot"([& maps]); Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping from the latter (left-to-right) will be the mapping in the result."
11:06Morgawrah derp, great!
11:06Morgawrthat's exactly what I needed, thanks a lot IamDrowsy
11:06IamDrowsynp :)
11:37TimMcmurtaza52: Structs are deprecated -- use maps or records instead.
11:37TimMcmurtaza52: http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
11:53murtaza52TimMc: thanks for the link!
12:08myeI'm looking for a function that produces an #inst (rfc3339) timestamp that works in clojure and clojurescript.
12:09myeanyone had this problem before? Could I make a macro that expands differently in clojure and clojurescript?
12:13asalaaak (defn myfun [x y & others] (println (int (* x y))) (println "others: " others)))
12:14asalaaakhey mates i want to
12:14asalaaakget the sum of the others
12:14asalaaakbut cant get it work
12:14asalaaakcan someone help me please
12:14asalaaak(defn myfun [x y & others]
12:14asalaaak (println (int (* x y)))
12:14asalaaak (println "others: " others)))
12:14asalaaaki have this
12:15IamDrowsy,(reduce + [1 2 3 4 5 6])
12:15clojurebot21
12:16IamDrowsyoh
12:16IamDrowsyor
12:16IamDrowsy,(apply + [1 2 3 4 5 6 ])
12:16clojurebot21
12:17asalaaakyoure amazing mate
12:17asalaaakthank you very much
12:25klrrHAI!
12:55bttfdoes anyone have experience using sqlKorma in here
12:59bttfim having issues.. https://gist.github.com/bttf/a80a95289d5ed8dcd889
13:23mynomotobttf: It's saying that the db is encripted or not a db. Did you create the db with a password?
13:27bttfmynomoto: i saw that but unless sqlite encrypts by default its not encrypted or passworded or anything
13:28bttfi did a sqlite dal.db and did some creates and some inserts, thats it
13:39bttfif anyone could help that would make my day
14:00mynomotobttf: I tried to replicate what you did but got other errors. If I were you I would try h2 instead of sqlite.
14:01bttfoh .. okay ill check it out, thanks
14:28Okasubttf: Yeah, h2 works just fine with korma, one quirk you need to know though.
14:29OkasuYou need to upcase tablenames with h2 and korma otherwise you'll fail at select.
14:33Okasuhttps://github.com/mynomoto/sqlkorma/commit/f24f917901adea0e7992f51fcdc06eca4ba30b92 Heh, it's already included in docs.
14:40gfredericks,'$17.99
14:41clojurebot$17.99
14:41gfredericks^ a macro that takes advantage of that would be kind of sweet
14:42gfredericks(with-dollaric-literals ...)
14:42tgoossens,'€20
14:42clojurebot?20
14:42tgoossens;(
14:45mynomotoOkasu: Yeah, but maybe should be the default in the h2 helper. It's not clear in the docs that things will go wrong if you don't set :fields upper-case.
14:47noncom_hi i have two questions
14:48noncom_1) when running a project with 'lein', not all printlns print to the console, how to fix this?
14:48gfrederickslein trampoline might help
14:49gfredericksI think it normally works fine for me though :/
14:49gfredericksso it might well be something weirder
14:49noncom_specifically, only printlns on the highest levels printlns (probably during assembling) but anything that is in-app ,it does not print...
14:51noncom_i try trampoline now, wait
14:51gfredericksI'm doubting that will work based on your subsequent details
14:51gfredericksbut may as well try I guess
14:51gfredericksit might be that some library you're using is changing *out*?
14:51noncom_oh, i use lein ring server to run the app
14:52noncom_idk if it hanges *out* but it used to be ok some time before
14:52gfredericksyou could debug by replacing one of the printlns with (.println System/out ...)
14:52gfredericksif that works fine then you know the issue is *out* and can try to figure out how that gets changed
14:53gfredericksmaybe some piece of middleware you're using? though I'm not familiar with any such thing
14:53gfredericksI can hypothetically imagine middleware that diverts *out* to the logfile for some reason
14:55ucb_homeevening
14:56noncom_looks like no such middleware... ok i tried what you said, i wrote (.println System/out " SYS OUT!! ") and it says "java.lang.IllegalArgumentException: No matching method found: println for class java.io.PrintStream"
14:56ucb_homeI'm having trouble checking whether an item in a list is an instance of clojure.lang.Fn (inside a macro). https://gist.github.com/5430614
14:56ucb_homeif anybody could point out where I'm going wrong that'd be great.
14:58noncom_this is weird, no?
14:59ordnungswidrigucb_home: what about (fn? form)
14:59amalloyucb_home: the macro will never receive a Fn: it gets source-code forms, which you typed in
14:59ordnungswidrigamalloy: you're right
14:59ucb_homeamalloy: yeah, so I toyed with resolve but still didn't manage to get anywhere
15:00ordnungswidrigucb_home: what it your intended use case?
15:00ucb_homeamalloy: but then that gives me a var
15:00ordnungswidrigucb_home: you could inspect the var. But can you give an example how you would like to use the macro?
15:01noncom_but in eclipse it prints to the console (not to the repl)
15:01ucb_homeordnungswidrig: hrmph, I'd need a bit of context, but basically this is the intended output. for (p-source (inc 1)) I'd want (each inc (1)) and for (p-source '(1 2 3)) I'd want (map immediately '(1 2 3))
15:02ucb_homeordnungswidrig: I thought about inspecting the var; the point of this macro is to emit different code depending on whether the first item in the form is a function or a value.
15:02ucb_homeordnungswidrig: (each ...) is a function similar to pmap btw
15:02ordnungswidrigucb_home: why not (p-source #(inc 1)) vs. (p-source [1 2 3]))
15:03ordnungswidrigucb_home: i.e. pass a function as a function and pass a value as a value
15:03noncom_,(.println System/out)
15:03clojurebotnil
15:03ucb_homeordnungswidrig: good question. I probably need to rethink this through anyway :/
15:04ucb_homeI also now realise that checking for Fn is not ideal since most data structures also implement Fn; and keywords too
15:04ordnungswidrigucb_home: I think you have one level of abstract to much :)
15:04ordnungswidrigucb_home: you can also define a wrapper type that hold the fn and check for that.
15:04ucb_homeordnungswidrig: yeah, possibly :/
15:05ucb_homein more general terms, do you guys feel that a version of -> and ->> that did multi-threading behind the scenes would be useful?
15:05noncom_,(.println System/out "test")
15:05clojurebotnil
15:05ucb_homeis there such a thing already and I'm trying to re-invent the wheel?
15:05noncom_at least it gives no exception
15:09gfredericksnoncom_: that's really weird because the PrintStream class definitely has a println method
15:09ordnungswidrigucb_home: how should multithreading with -> work? Every step depends on the output of the prvious one?
15:09gfredericksnoncom_: you're not somehow passing zero or two or more arguments?
15:10gfredericksucb_home: have you seen the parallelized threading macros in the swiss-arrows library?
15:10ucb_homeordnungswidrig: that's precisely what I'm trying to define and work on. I have a tiny proof of concept here https://github.com/ulises/gok/ which is probably wrong, incomplete and useless. It uses futures and promises. The way it works is by imposing some sort of structure to the flow.
15:10ucb_homegfredericks: I have not!
15:10gfredericksucb_home: now you will have!
15:10ucb_homegfredericks: checking. Thanks!
15:13noncom_gfredericks: you're right, in the app i was passing 2 args. well, i tried that, and it's the same - it prints to eclipse console, but not the CMD when run with 'lein ring server'
15:14gfredericksnoncom_: if you're using eclipse then I have no idea what arbitrarily weird things might be going on
15:14ucb_homeoh, I see, the parallel versions are using futures too. That's encouraging at least.
15:14gfredericksrunning with `lein ring server` means not using eclipse at all?
15:14noncom_yes
15:14jjttjji have a vector of maps, and a seperate vector of values that correspond to those maps that i need to merge together, is there a better way to do that then (map #(conj %1 [:extra-value %2]) my-maps extra-values)
15:14jjttjj
15:15jjttjjbigger example here: https://www.refheap.com/paste/13814
15:15noncom_eclipse does nothing extra to the project
15:15gfredericksjjttjj: well assoc is a little cleaner than conj there
15:15noncom_lein sould just work as it worked but it doesn't (
15:15noncom_ehhh..
15:15gfredericksjjttjj: but I can't imagine a more succinct version besides that
15:16jjttjjgfredericks: cool, thanks!
15:19ucb_homethanks for the comments; cheers now.
15:28arrdemif I only partially extend a protocol onto a type does it not default to the java.lang.Object impl? what I'm seeing in the repl suggests it doesn't.
15:33gfredericksyeah I believe it crashes
15:33gfrederickson calling a missing function
15:33arrdemlooks like if you extend it to nil you can hack around it..
15:34gfredericksO_O
15:34arrdemlol
15:34gfredericksyou're saying if a type has only some of the functions in the protocol implemented, for the other ones it will call the implementation for nil?
15:35arrdemno no
15:35arrdemin my specific case the nil implementation matters
15:35arrdembecause I recur onto the meta map of an object if all else fails
15:35arrdemso my error was that I didn't handle a nil meta map
15:36arrdemClojure was "doing the right thing" and calling Object it looks like
15:40luisgabrielhi, can someone give me a clue about why I'm getting a really bad performance with this code https://gist.github.com/luisgabriel/5430769 ? The function process-content returns an occurrence list (word/positions pairs) of a given text
15:43octagonhello, where can i find up-to-date docs about the clojure reader? http://clojure.org/reader appears to be incorrect.
15:45ordnungswidrigluisgabriel: is-valid split the string into a sequence. I suppose this makes it slow. Using a regex to filter the string for valid characters should be slower.
15:45ordnungswidrigluisgabriel: ah, faster, I mean.
15:46arrdemoctagon: what's wrong with the official page on the reader?
15:46octagonarrdem: "Symbols: Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, and ? (other characters will be allowed eventually, but not all macro characters have been determined). ..."
15:47octagonarrdem: consider: (defn clj->js ...)
15:48luisgabrielordnungswidrig: hmm, I'll try to use a regex. thanks
15:48octagonarrdem: bizarrely, the javadoc for java.util.regex.Pattern states that \w is [a-zA-Z_0-9], but matches characters such as '/' or '>'
15:49arrdemoctagon: while the reader will take -> as a valid symbol (see clojure.core/->) my point is just that the official docs at clojure.org are the best you're gonna get short of reading the code on github.
15:50arrdemclojure-doc.org is intended to be a high level overview of the Clojure ecosystem (I believe)
15:50arrdemand clojuredocs.org is out of date
15:51amalloy&(re-find #"\w" "/")
15:51lazybot⇒ nil
15:51octagonarrdem: php.net lets users add comments, which is how they keep their docs up to date. just sayin
15:51amalloyoctagon: so no, of course \w matches exactly what the javadoc says it matches
15:51ordnungswidrigoctagon: that's a scaring feature :-)
15:52arrdemoctagon: php.net also has some of the most evil snippets I've ever seen in the comments. just sayin
15:53arrdemoctagon: all trolling asside you're right, the main page should list < and > as valid symbol characters
15:53arrdemalso & I think..
15:53arrdem,'&foo
15:53clojurebot&foo
15:53octagonarrdem: the reason is i'm working on writing an editor that needs to be able to parse at a lower level than the clojure reader
15:54octagonarrdem: because the clojure reader doesn't preserve all the information in the source file
15:54octagonarrdem: like #_(...) for example, or some things can't be reverse-engineered, like syntax-quoted things
15:55tgoossenshow would you model the following in clojure? In java for example i can have a class that has a field 'friend' which references to another Person object". ? because if i follow the idea of the "value" of an "identity". Then in clojure refs that refers to other refs make no sense
15:56noncom_all is fine. i fixed it
15:56xeqioctagon: have you seen sjacket?
15:56noncom_turned out that another account on the computer had an app running on the same port, and ring simply sat there silently without reporting anything and looking as if it runs the server, but it did not since the port was occupied already
15:57gfrederickstgoossens: you can use IDs if that makes sense for what you're doing
15:57gfredericksor nested objects?
15:57gfredericksI guess for friends IDs make more sense
15:57tgoossensbut (now i'm coming from an oo point of view)
15:57tgoossensisn't it a bit silly that i have to
15:57tgoossens1) define an ID
15:57tgoossens2) have an identity
15:58gfrederickswhat does 'have an identity' mean?
15:58tgoossensthat it can be uniquely identified even if the value would be the same
15:58gfredericksmaybe you should describe what you're doing at a higher level
15:58tgoossens,(= (ref 1) (ref 1))
15:58clojurebotfalse
15:59gfredericksdoesn't giving everything an :id accomplish "having an identity"?
15:59gfredericksif :id is part of the value then it can't be equal to anything else
15:59tgoossensYes. But then you want to have it shared between threads
16:00gfrederickshow are multiple threads using these objects?
16:00octagonxeqi: we looked at sjacket a while ago, but i don't remember why it didn't do what we needed
16:00tgoossens*it might be shared
16:01tgoossensi'm just wondering btw not making an actual application at the moment
16:01octagonxeqi: does sjacket preserve all the info in the source? like when you have a number literal, if it's in hex or whatever
16:03xeqioctagon: I'm not sure, I just know its used as part of reply for figuring out when to send a complete expression to the server. I'd been hearing decent things about it
16:06gfrederickstgoossens: yeah abstract questions make it harder to figure out where our disconnect is. I think people tend to treat the data as values, as if it came from a database. In a database, you have :id keys and foreign keys and it's not a big issue
16:07gfredericksI do multithreaded stuff all the time and I've never even needed refs, so it's probably the case that whatever you're worried about isn't likely to come up in practice
16:12tgoossenshmmm
16:12amalloyi mostly use refs for things where i *could* use atoms but it's more convenient with refs
16:13gfredericksclojure: you come for the refs, but you stay for the data structures
16:13arrdems/datastructures/map literal/g
16:14gfredericksor the macros
16:14gfredericksyou can stay for the macros too
16:17gfredericksconcurrency support is the bait in clojure's trap to turn people into functional programmers
16:19arrdemclojurebot: concurrency is concurrency support is the bait in clojure's trap to turn people into functional programmers
16:19clojurebotIk begrijp
16:19arrdem-_-
16:19arrdem~cons
16:19clojurebotlitany against cons is "I must not cons. Cons is the perf-killer. Cons is the little death that brings total obliteration. I will face my cons and permit it to pass over me and through me, and when it has gone past I will turn my GC to see its path. And where it has gone there will be nothing; only I will remain."
16:20arrdemclojurebot: foo is bar
16:20clojurebotAck. Ack.
16:21arrdem~foo
16:21clojurebotfoo is bar
16:23gfredericks~bar
16:23clojurebotbar is foo
16:24gfredericks~perf-killer
16:24clojurebotIt's greek to me.
16:25arrdem~concurrency
16:25clojurebotconcurrency is remeber concurrency
16:25arrdemgfredericks: I done f'd
16:25octagon
16:25clojurebotexcusez-moi
16:25gfredericks~concurrency
16:25clojurebotconcurrency is concurrency support is the bait in clojure's trap to turn people into functional programmers
16:26gfredericksarrdem: ^
16:26arrdem(inc gfredericks) ;; for fixing my mess
16:26lazybot⇒ 20
16:26gfredericksdidn't fix nothing, just showed you it wasn't broken
16:27arrdemwait did I misspell it?
16:27arrdemgfredericks: what'd I do wrong? I can't tell.
16:29Okasu~concurrency
16:29clojurebotconcurrency is concurrency support is the bait in clojure's trap to turn people into functional programmers
16:29Okasu~concurrency
16:29clojurebotconcurrency is "concurrency support is the bait in clojure's trap to turn people into functional programmers"
16:29Okasu~concurrency
16:29clojurebotconcurrency is concurrency support is the bait in clojure's trap to turn people into functional programmers
16:31gfredericksclojurebot: forget concurrency is concurrency support is the bait in clojure's trap to turn people into functional programmers
16:31clojurebotIk begrijp
16:31gfredericksclojurebot: concurrency is <reply> concurrency support is the bait in clojure's trap to turn people into functional programmers
16:31clojurebotAck. Ack.
16:31gfredericks~concurrency
16:31clojurebotconcurrency is forget concurrency
16:31gfredericks~concurrency
16:31clojurebotconcurrency support is the bait in clojure's trap to turn people into functional programmers
16:32hiredman~botsnack
16:32clojurebotbotsnack is scoobysnack
16:32gfredericksarrdem: is that what you wanted it to do?
16:32arrdemgfredericks: heh yeah that's what I was looking for
16:32arrdem~botsmack
16:32clojurebotclojurebot evades successfully!
16:35xeqi~botstack
16:35clojurebot/me puts lazybot on his head and gropes blindly for a third bot to complete the stack.
16:36arrdemone day I will write a third bot and the botstack will be complete
16:42Morgawrhello, I have a collection (a hashmap) of key-values, I need to iterate over each pair and apply a function with side-effects. What's the best way to do this? At the moment I am using a map and forcing it to evaluate.. is there an appropriate construct for this case? I do not care about the returned value
16:43xeqi&(doseq [[k v] {:x 1 :y 2}] (println k v))
16:43lazybot⇒ :y 2 :x 1 nil
16:43arrdemxeqi: STOP BEATING ME TO THE PUNCH
16:44Morgawrxeqi: great, thanks!
16:46tyler_is there a function that given a value and quantity, returns a vector with n elments of value v ?
16:46arrdemtyler_: (repeat)
16:46arrdem,(repeat 3 3)
16:46clojurebot(3 3 3)
16:46tyler_(inc arrdem)
16:46lazybot⇒ 3
16:47tyler_ta
16:47xeqinoooooo! I just looked away for a moment
16:47arrdem(inc xeqi) ;; the other guy missed you
16:47lazybot⇒ 8
16:48tyler_um one question though, why is inc side affecting? ;)
16:49octagon(inc tyler_)
16:49lazybot⇒ 1
16:50arrdemtyler_: we've had the inc! argument a few times and we've just never patched the bot XP
16:51tyler_why not (swap! tyler_ inc)
16:52octagon(dec octagon)
16:52lazybotYou can't adjust your own karma.
16:52rasmustotpope: ping
16:52arrdem(defmacro inc! [username] (update-in lazybot [:karma username] inc))
16:53tyler_woo i need to read docs on update-in i don't really grok that yet
16:59rasmustotyler_: you give it a vector of keys into a nested hash-map, and a function that you want to use on the element that the keys get you to, and it updates it
16:59ivanis there a min-range somewhere that I should use instead of (range n Double/POSITIVE_INFINITY)?
16:59amalloyivan: (iterate inc n)
16:59ivanah, thanks
17:00arrdemamalloy: ooh nice one
17:00tyler_(inc amalloy)
17:00lazybot⇒ 51
17:00gfredericksthough not chunked so maybe slower
17:00tyler_heh chunky is faster
17:02gfredericks,(let [a (atom 0)] (second (map (fn [_] (swap! a inc)) (range 50))) @a)
17:02clojurebot32
17:02jasonjck_hm I thought all clj seq related functions were chunked
17:02jasonjck_that's confusing
17:02gfredericks,(let [a (atom 0)] (second (map (fn [_] (swap! a inc)) (filter identity (range 50)))) @a)
17:02clojurebot32
17:17n_bFutures work off the unbounded thread pool, right?
17:17n_bs/the/an
17:24arrdemtechnomancy: if I use (slurp "VERSION") in my project.clj will lein deal?
17:33technomancyarrdem: one way to find out
17:34arrdemtechnomancy: doing so now :p
17:34arrdemtechnomancy: lein died in a fire
17:35technomancyoh no
17:35ivancan I disable buffering on a FileWriter without subclassing it? does this already exist somewhere?
17:35technomancyarrdem: inside or outside defproject?
17:36arrdemtechnomancy: my b
17:36arrdemthere was another syntax error, it wasn't my slurp
17:40arrdem(apply str (replace {\newline ""} (slurp "VERSION"))) seems to be working
18:11tyler_do many people move to north carolina from the bay area because of the clojure community?
18:11tyler_ive contemplated it
18:17ivangen-class or java source are the only things that will let me call the superclass, right?
19:41ivan&(max '(1 2 3))
19:41lazybot⇒ (1 2 3)
19:43gfredericks&(max 1 2 3)
19:43lazybot⇒ 3
19:43ivan&(max '(1 2 3) '(1 2 4))
19:43lazybotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to java.lang.Number
19:44gfredericks&(apply max (concat '(1 2 3) '(1 2 4)))
19:44lazybot⇒ 4
20:15hyPiRion,(reduce max (map (partial reduce max) ['(1 2 3) '(1 2 4)]))
20:15clojurebot4
20:59yedihow can i get lein beanstalk to ignore files or folders
21:32capcrunchanyone uses clj-native ?
22:39stian_Total newbie question: given two lists of file names and access times, and wanting to compare to see which files have changed, what is the best data structure to store it (set of sets? hash?) and what is the idiomatic Clojure way of finding the filenames of the files that have changed (i.e. where time1 is not like time2)? Thanks!
22:44xeqistian_: sounds like you have two maps (from filename to access time). Then for each file in the list compare the values
22:45bbloomunless the question is how to do that efficiently, and then it's a different question
22:52stian_xeqi: yes exactly… how do you compare the two? (as I said, I'm really a newbie). In Ruby I would use a.each {|x, y| if oldval[x] != y} etc, but I want to write idiomatic code. list comprehension with for, or map, or merge and distinct, or ?
22:58xeqi&(let [m1 {:x 1 :y 2} m2 {:x 2 :y 2}] (remove #(= (m1 %) (m2 %)) (keys m1)))
22:58lazybot⇒ (:x)
22:58xeqiassuming the keys are the same
23:41nicholaseix
23:43cnsnntsexit