#clojure logs

2011-09-07

00:00technomancyuser317_: I think this is in the faq with lein help readme
00:02user317_technomancy: thanks for the help, i am totally new to java and related technologies
00:04user317_so far it sucks less then most things :)
00:04technomancyI'm quoting you on that
00:05brehautits sad that thats a glowing endorsement for a software ecosystem :P
00:06user317_hehe
00:22user317_does the pattern match module work on functions that take more then 1 argument?
00:25dnolenuser317_: are you talking about match?
00:26user317_yea
00:26dnolenuser317_: match doesn't yet provide any sugar for creating fns that pattern match.
00:27user317_dnolen: ok, thanks
01:15user317_is there anyway to reload the libraries from repl?
01:17brehaut(use :reload 'lib-name)
01:17brehautworks with require too
01:17brehautand :reload-all is also handy
01:57user317_how do i run the :test tests that are defined in the function metadata?
01:57user317_cake test doesn't seem to run them
04:04tsdhIs there no automatic promotion from numbers to bignums in clojure 1.3?
04:05tsdh(+ Long/MAX_VALUE 1) throws an ArithmeticException "integer overflow" in 1.3, while in 1.2 you got an BigInteger...
04:09raektsdh: you can use the +' function instead, which does promotion
04:09tsdhYes, thanks. I've just found the relevant git log entry. :-)
04:11tsdhStrange that I didn't encounter that earlier. The entry is from June 2010...
04:56kzarI was thinking of porting this little PHP script to Clojure, couldn't think how to structure it though. It provides a class that lets you step through a hex string in bits and bytes, taking care of shifting. Thing is you don't normally have a class with mutable state in Clojure right? So how do you keep track of the position and spare bits? https://github.com/kzar/bit-ratchet
04:58ilyakkzar: You should return a fn
04:58ilyakor maybe a lazy seq
04:58ilyakwhat does that class methods do?
04:58clgv+1 for lazy seq
04:59kzarilyak: It let's you do things like take 3 bits, take a couple of bytes, skip, jump to a certain position, take some of the actual ascii hex
04:59ilyakbut in case of your api it's complicated
04:59ilyakyeah, I see
05:00ilyakI think that it's okay to make an object with a mutable state if you clearly need e.g. jumps
05:00clgvhmm maybe a protocol + deftype combo with mutable state if you need it.
05:00ilyakAfter all, bit fiddling is pretty low level
05:03ilyakSo if I were you I'd implement it as a straight port with mutable state and then try and see if you can make it easier and better
05:03ilyakfor example, you might find yourself routinely chaining calls, and then you might it work like
05:04ilyak(br :read 4 :read-ascii 2 :jump 0) returning the last thing retrieved
05:04ilyakmaybe not
05:04clgvkzar: the problem is your current implementation's semantic is to return something and advance the internal state, that wont playout well with immutable datastructures. but you could change semantics to "peek( n-bits )" "pop( n-bits )"
05:05kzarclgv: Say I do that, and I peek 3 bits how do I keep track of the spare 5 bits for next time?
05:06clgvkzar: example? otherwise I'd say: same way as in php
05:08kzarclgv: OK, well example would be "F" string, if you read 3 bits of it you've got a spare 5 to worry about next time
05:09clgvkzar: my suggestion is to define (defprotocol IBitRatchet (peek [this, n]) (pop [this, n])) where pop will return a new IBitRatchet instance that only contains the spare bits
05:09clgvkzar: another option is to use a clojure over an atom
05:09clgvs/clojure/closure//
05:10kzarclgv: Ah right I see, so each time you read further it's really returning a whole new object instead of changing the state in the current one
05:10clgvright
05:10kzarclgv: Not slow?
05:16clgvkzar: the closure approach could look like ##(let [bit-racket (fn [data] (let [d (atom data)] (fn [n] (let [f (first data)] (swap! data rest) f)))
05:17clgvlazybot: what's up?
05:17clgv&(let [bit-racket (fn [data] (let [d (atom data)] (fn [n] (let [f (first data)] (swap! data rest) f)))
05:17lazybot⇒ nil ; Adjusted to (let [bit-racket (fn [data] (let [d (atom data)] (fn [n] (let [f (first data)] (swap! data rest) f))))])
05:17clgv&(let [bit-racket (fn [data] (let [d (atom data)] (fn [n] (let [r (take n @d)] (swap! d #(drop n %)) r)))), b (bit-racket "ABCDEFG")] (println (b 2)) (println (b 1)) (println (b 4)) (println (b 5)))
05:17lazybot⇒ (A B) (C) (D E F G) () nil
05:20clgvkzar: in the closure approach you have to compose your interpretation functions with reading one defined above, e.g. (signed (b 1)) or (unsigned (b 3))
06:43khaliGare the snapshot jars with the build date in the filename made by hand or is there is a way to do that using lein?
06:48clgvkhaliG: I only know that I do it via abuding the version-data in defproject
06:48clgv*abusing
06:48khaliGclgv, ah trickery
06:49clgvkhaliG: the good thing is that this part of defproject gets evaluated - not like the key-value-pairs where the values are taken literally
06:56khaliGclgv, if it's not too much trouble could i ask to see it?
06:57clgvkhaliG: just write (defproject AntColonyOptimization (my-version-string) ...) and define (defn my-version-string ...) in front of it
06:57clgvlol
06:57clgvreplace it with your projectname^^
06:57khaliGhaha okay
06:58clgvI also determine the git branch name in my version and add it^^
06:58khaliGnice
07:01clgvit's quite easy with clojure.contrib.shell-out
07:22raekkhaliG: the build date is added automatically by lein for SNAPSHOT versions
07:23raekbut you probably need to do something like what clgv said if you need something more sophisticated
07:24raekclgv: the key-value parts can be evaluated too if you put a ~ in front of it
07:24clgvraek: oh ok. didn't know that
07:25khaliGraek, good to know. i have snapshot in my project.clj file, so i'll take a closer look to see what's up since i'm not getting the dates
07:25raekor maybe it's clojars that adds them
07:25clgvthe parameter with the unquote is literally put into the inside syntaxquote?
07:26raekdunno. it is possible that it is handled manually by the defproject macro
07:27khaliGi can't even remember how i installed lein but i've got version 1.4.2 installed and i see the latest is 1.6.2
07:27raek,(read-string "~foo")
07:27clojurebot(clojure.core/unquote foo)
07:28raekkhaliG: the date is probably appended by clojars when you push a new snapshot version
07:28khaliGah
07:28raekI don't know if the local maven repo (lein install) does the same thing
07:29raekkhaliG: also, "lein upgrade"
07:29khaliGraek, cool i just ran it :)
07:37clgvlein even works good on windows but without "lein upgrade" ... I only noticed that the windows filesystem file naming rules limit clojure's naming conventions
07:38clgvdefinitions with the same name but in caps collide there^^
07:38clgvI had that in my DSL definition
07:39raekwhich things in clojure was affected?
07:39raeknamespace names?
07:42clgvmacro-/function-names
07:48ambrosebs,(fn a)
07:48clojurebot#<sandbox$eval4295$a__4296 sandbox$eval4295$a__4296@1414c92>
07:49ambrosebs,(fn)
07:49clojurebot#<sandbox$eval4323$fn__4324 sandbox$eval4323$fn__4324@18dbeeb>
07:49ambrosebswould it be wrong for those cases to throw an exception?
07:57clgv ambrosebs: same for defn - (defn f) with the neat result of: (meta #'f) => {:ns #<Namespace user>, :name f, :file "NO_SOURCE_PATH", :line 21, :arglists (nil)}
07:58clgvso actually you can never call that function^^
07:58clgvsince your arg list is always false
07:58ambrosebsim working on error msgs for defn + fn, i've already got a nice "Parameter declaration is missing" exception, but is it a breaking change?
07:59pyri see leiningen has a dev-resources-path option
07:59pyri just wonder what characterizes as "dev" in leiningen's opinion
07:59ambrosebsAFAICT (fn a) is undefined behavior
08:00pyri.e: is lein repl dev, is lein run ?
08:00clgvambrosebs: could be defined to a "nil constant", i.e. function without args returning nil always
08:00clgvbut an error would be better I guess
08:00manutterambrosebs: I'd say it's an undefined behavior, the correct syntax for fn without args is (fn [] ...)
08:00manutteran error makes perfect sense to me
08:01ambrosebsmy thinking also
08:01manuttergranted I'm way down at the beginner end of the clojure pool, so my opinion probably doesn't count for much ;)
08:02clgvI saw that clojure master now has a Counted interface to mark those collections that provide O(1) access to the number of their objects
08:02clgvgood move^^ I stumbled into the O(n) trap with vectors earlier
08:02ambrosebsmanutter: me too, don't worry :)
08:03clgvah well not count. meant last ^^
08:03clgvhumm ok have to change if that is changed as well
09:06solussdare :each test fixtures run sequentially on each test?
09:11joegalloyou only get one each fixture, and one once fixture
09:12joegalloi mean, you can stuff as much in those two individually as you'd like, and then, yes, those are run sequentially
09:12joegallobut yeah, multiple (use-fixtures :each ...) expressions would be a no-no.
09:34khaliGis there way to get the methods of an interface from the repl?
09:35manutter,(javadoc IRunnable)
09:35clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: javadoc in this context, compiling:(NO_SOURCE_PATH:0)>
09:36manutter*snap*
09:38joegallokhaliG: clojure.contrib.repl-utils/show
09:41mprenticejoegallo: neat
09:41khaliGjoegallo, thanks .. do you have that added to your project.clj so it's always handy?
09:42joegallothat's one way to do it
09:43joegallo(can't really think of any other way atm, though...)
09:43khaliGcool
09:49fliebel&java.util.concurrent.ForkJoinPool
09:49lazybotjava.lang.ClassNotFoundException: java.util.concurrent.ForkJoinPool
09:51clgvfliebel: no java 7 I guess;)
09:52fliebelclgv: Meh, works locally. I wonder what it would take to get that branch anywhere.
09:52clgvfliebel: you got java 7 or the forkjoin jar locally then ;)
09:53fliebel7 ;)
09:53clgvI didn't dare to install java 7 yet ;)
09:53manutterheh, that's what VirtualBox is for... :)
09:53khaliGdumb question feel free to ignore.. but i'd like to translate a snippet of clj code to java src code
09:54manutterkhaliG: you'll have to port it by hand, the clojure compiler writes directly to java byte code without any java intermediary code
09:54khaliGmanutter, ah ok, forget it then *grin*
09:55fliebelkhaliG: You coud try ClojureScript. It has braces at leats...
09:55khaliGi wrote some swing code for someone in clj, but he doesnt know clj - nothing important
09:56michaelr525you can dissasmble the byte code to java ;)
09:56clgvkhaliG: just compile a jar for him to use ;)
09:56clgvkhaliG: and wrap your code in a defprotocol ;)
09:57khaliGhaha it was to illustrate how to do some swing thing .. a jar wont show him how :)
09:58khaliGmichaelr525, lol i might try that just to see
09:58fliebelkhaliG: That's how you accomplish stuff in Java, download jars.
09:58khaliGtrue that ;)
09:59jweissis there a simple way to print fns and java objects with pr such that they can be read back in with "read"? (I don't mean that i get the same object back, just something readable)
09:59jweiss#<blah$blah> can't be read
10:02manutterjweiss: I'm going to guess "No" -- pretty sure Java objects can't and real sure functions can't.
10:03jweissmanutter: i know it can be done using the print-method multimethod, i am just trying to figure out something "readable" to print about these objects
10:03manutterjweiss: if it's a serializable Java object you might be able to use Java method calls to serialize it and then de-serialize it later
10:04jweissmanutter: i'm not interested in getting the same object back, it just has to be something that doesn't break the reader, and a human reader would recognize as a fn or a java object of some class
10:04manutterjweiss: wait, by "readable" you mean something a human can read (as opposed to something Clojure will understand)?
10:04manutteroh, ok, that's different
10:04jweissmanutter: sorry i mean something that the clojure reader won't throw an exception on AND is somewhat human readable
10:05manutterI don't have any simple techniques off the top of my head, but I wonder if you could do something useful with metadata, hmmm
10:05duck1123relevant:https://groups.google.com/d/topic/clojure/nyOJjcynl2Q/discussion
10:06jweissmanutter: for fn's, i use serializable-fn (a simple lib from technomancy that adds metadata just as you suggest). however if I forget or someone else's code is being run, i don't want my logging to fail
10:06jweiss(trace logging is what i'm working on here, logging with pr to convert to html later)
10:07khaliGmanutter, perhaps ~/.lein/init.clj is a good place to put a reference to show
10:08manutterkhaliG: I think you meant that for joegallo, but it is a good idea
10:08khaliGoops, yes
10:08duck1123jweiss: Would it help if you just printed out the vars? They should be readable and user friendly
10:08manutter(I actually had init.clj open after reading that, but I wasn't sure exactly how to do it)
10:09jweissduck1123: printed how?
10:09jweissi'm logging fn calls, some arguments to fns are fns :)
10:09jweissand of course some are java objects
10:09duck1123yeah, I guess it would only really work if you had the var to begin with
10:10jweissi'm sure print-method is the answer here, just not sure what exactly to have it print :)
10:10duck1123In Ciste, I pass around vars all the time for similar uses
10:10joegallohow do you get it there to be referenceable, if it's not on your classpath already?
10:10jweisssomething similar to what pr already does, but none of that #<> business
10:11jweissby the way is that behavior documented somewhere? seems like the only thing pr does that is not readable
10:13jweisshm this might help http://amalloy.hubpages.com/hub/Dont-use-XML-JSON-for-Clojure-only-persistence-messaging
10:13khaliGjoegallo, yeah i'm not sure
10:14jweissalthough so might just converting everything to strings before I write :)
10:17manutterkhaliG: joegallo: couldn't you put in some code to have lein automatically add repl-utils to :dev-dependencies somehow?
10:18manutterI've never tried mucking about in lein's innards, but I thought that was the sort of thing you could do.
10:18duck1123isn't there a param in project.clj for code to be run when the repl starts?
10:18khaliGmanutter, looking through trying to find a place to do just that - https://github.com/technomancy/leiningen/blob/stable/sample.project.clj
10:19joegallomanutter, yes, that's a very very clever thought
10:19joegallomake it an implicit dev-depedency, so to speak :)
10:39khaliGjoegallo, manutter well a little progress, kind of: added a :repl-init clojure.contrib.repl-utils to project.clj - and now lein repl drops me to a repl with the ns c.c.r-u
10:41manutternow if it would just work with lein swank
10:41manutterhmm, though I typically use clojure-jack-in, wonder how that would work...
11:06MenthyAnyone proficient with ClojureQL on ?
11:06bendlasMenthy: what do you need?
11:08Menthy(difference (table :one) (table :two)) should have an option to give in a keyword that will replace the default "EXCEPT"
11:08Menthy(SELECT one.* FROM one ) EXCEPT (SELECT two.* FROM two)
11:08MenthySo I was thinking that modifying the expression should work
11:09MenthyAnd (modify (difference (table :one) (table :two)) :minus) should give (SELECT one.* FROM one ) MINUS(SELECT two.* FROM two)
11:09Menthyinstead it gives (SELECT MINUS one.* FROM one ) EXCEPT (SELECT two.* FROM two)
11:11MenthyThat's the behavious I would expect from (difference (modify (table :one) :minus) (table :two))
11:14coopernurselet's say I have a compojure/noir app. I've got a views.clj that has a bunch of hiccup code
11:14coopernursethere's some data I need to render in the sidebar of every page that comes from a database
11:14coopernurseI'd like to avoid having to pass in a variable from routes to each view function that contains that data
11:15bendlasMenthy: yes, that's not implemented
11:15coopernursebut I also don't want to tightly couple the views to the database
11:15coopernursewhat's a smart way to design around that?
11:15bendlasis there a database, that needs "EXCEPT"?
11:15coopernurseI'm considering having an atom in the views module that points to a function that returns the sidebar data
11:16coopernurseand then the app at startup can inject a function into the views namespace that swaps the atom
11:16Menthybendlas: Most databases need EXCEPT, which seems the default, buf Oracle (of course) has MINUS
11:16coopernurseis that a reasonable approach?
11:16Menthybendlas: The strange thing is, it seems to suggest from the docs that it should be possible. Tried to dive into the source, but it's reasonably complicated
11:16bendlasMenthy: I see. Well, that can be implemented as a dialect in CQL
11:18bhenry2coopernurse, it doesn't have to be an atom. just have a sidebar function and put that in the views that need it.
11:18coopernursebhenry2: you mean have the view functions call a function to load the data explicitly?
11:19coopernursebhenry2: I wanted to add some indirection to avoid tightly binding the view to the database
11:20Menthybtw, is there a way to generate SQL from disj! conj! and update-in! instead of having them executed directly in ClojureQL ?
11:20bhenry2i don't get why you need to connect the view and the database. your view gets some data and you send a response back. if the sidebar depends on said data, have your sidebar function take args
11:23bhenry2coopernurse: ^^
11:23coopernurseright, so I could pass the sidebar data into every view function
11:23coopernursebut then every route would need to load the sidebar data (redundant)
11:24bendlasMenthy: You can always use clojureql.core/compile
11:24coopernurseor I could inject a function into the view module that knows how to load sidebar data
11:24coopernurseand the sidebar view could load it when called
11:24coopernurseeliminating the need to pass that var around
11:24coopernursefrom route -> top level view -> sidebar layout
11:25coopernurseI'm trying to be as DRY as possible
11:25bendlasMenthy: oh, sorry, you were talking about the DML statements
11:25bendlasI think there is no way to get the compiled sql there
11:27bhenry2coopernurse: where you want to put the sidebar you will have to either deref the atom or call the sidebar function. so i'm not sure how either way is dryer than the other.
11:27bhenry2i think i'm misunderstanding how you have your views set up
11:28coopernursebhenry2: well, if I localize loading the data to the sidebar function (calling the injected function to load data), then no one else needs to know that the sidebar depends on that data
11:28coopernurseif the data is passed to the sidebar, then everyone up the call stack has to know about this bit of data
11:28coopernurseI'll post a gist of what I have in mind
11:29Menthybendlas: Thanks, that's too bad. Probably means I'll have to roll my own query constructor then (if it's going to deserve that name). Always a shame when you're *this* close to something that works.
11:30coopernursebhenry2: https://gist.github.com/1200882
11:30bendlasMenthy: but you don't use an SQL difference in a DML, do you?
11:31coopernursenot sure if that code works, but hopefully illustrates the point
11:31bhenry2coopernurse: *looking*
11:34duck1123Has anyone experienced an issue where having clojure 1.3 in their dev dependencies causes every lein command to throw: NoSuchMethodError: clojure.lang.KeywordLookupSite.<init>
11:35duck1123I have the same dependency on my lib/ folder, but one of my dev dependencies is pulling it in
11:37Menthybendlas: It's two different problems for this project: I need to generate scripts instead of executing directly, because execution should be repeatable without the code itself. It would be nice to have the choice (bang form and without). The 'EXCEPT' clause is used in a delete statement with two subselects, and SQL generated should have a choice of Oracle and MS SQL.
11:39Menthybendlas: I was expecting the difference function to be able to take a modifier for the keyword used from the clojuredoc
11:41Menthybendlas: But I can understand if it's not done yet, it's a pretty complicated project. I hope I'll once get proficient enough in Clojure to contribute :)
11:49bhenry2coopernurse: i'm forgetting how this works, but what if two requests come in at the same time for different views. the set-sidebar-loader! gets called for each view before the sidebar defpartial gets loaded for either. wouldn't you be displaying the last sidebar loaded for both views, instead of their respective sidebards?
11:49bendlasMenthy: if you want to dive into the source and need help with it, feel free to send me a message on github
11:49coopernursebhenry2: in my case, the function would be injected when the app loads - not per request
11:50bendlasi'd love to talk more, but I'm heavily multitasking right now
11:50bendlasbut I can respon async
11:50arohnerduck1123: that's almost always caused by mixing AOT'd 1.2 code with 1.3
11:50bendlass/respon/respond
11:50lazybot<bendlas> but I can respond async
11:51bendlasalso, you can open a ticket to implement that MINUS syntax for oracle
11:51bhenry2coopernurse: so once you load your app your sidebar is static until reloading?
11:52coopernursebhenry2: no, the data changes constantly, but the function itself would only need to be set once
11:52coopernurseI'm calling the function in sidebar per request
11:52bhenry2oh i see
11:55bhenry2coopernurse: so basically mock-sidebar-loader would be the sidebar function that i'm talking about. i really don't think it needs to be an atom if you're only going to assign it when the app loads
11:56bhenry2if sidebar-loader was just a function alone and not in an atom, you can still call (let [stats (sidebar-loader)] . . .)
11:58coopernursebhenry2: yeah, I mean for this example the indirection isn't much of a win, but logically I'd like the view to be separated from the db. so the idea with the mock function is that it could be used during ui dev, but swapped out later without changing views.clj
11:58coopernursebhenry2: I'm just experimenting with how one might structure clojure code to achieve loose coupling between layers without reinventing spring
11:59coopernursesince we have first class functions, this seems like a reasonable compromise
12:04bhenry2coopernurse: i guess it will work. i'm just not sure i see any benefit of a function in an atom over a regular function
12:04duck1123arohner: That was it. There's a dependency on ordered-set that is compiled against 1.2. It's odd that it didn't do this on any of the other systems I tested against
12:04coopernursebhenry2: if I make it a regular function, how can I swap it out externally? I can't redefine it right?
12:05bhenry2coopernurse: i guess i don't know. when i deploy new code, my app is reloaded with no downtime. so i've never had to deal with that
12:06coopernursebhenry2: oh, I don't mean at deploy time, I simply mean that without an atom, the (set-sidebar-loader!) function isn't possible, and the views.clj file would be tightly coupled to a single implementation for loading data
12:07bhenry2with noir everytime you recompile your changes should take place without having to reload the whole thing.
12:07bhenry2so if you changed the sidebar function then recompiled it should just pick up the changess.
12:07coopernursebhenry2: right, that isn't my concern. it's a design issue, not a class reloading issue.
12:54fliebelWhat is the correct way for a view server *not* to respond to a command? Say, I get a show or list that I can't handle.
13:08coopernursefliebel: not sure what you mean. are you writing a web app?
13:09fliebelcoopernurse: Oh, I only now noticed that I posted to the wrong channel.
13:09fliebelThis was about CouchDB
13:09coopernursefliebel: ah, ok cool
13:09Raynesfliebel: As long as cemerick is here, #clojure *is* #couchdb
13:10fliebelRaynes: cemerick is everywhere... But I'd say it's the other way around.
13:30wunkiis there an easy way for `paredit-mode` to show me the corresponding parenthesis
13:30wunkiit stopped doing that when I enabled paredit
13:31amalloywunki: there's show-paren-mode, but that's a bit too loud for me
13:33wunkiamalloy: hey, I actually like it :) Thanks
13:33TimMcI've got highlight-parentheses-mode
13:34duck1123Would setting up a executor elsewhere in my code cause futures to fail?
13:34duck1123I'm getting a rejection everytime I try to use a future and I can't see why
13:34amalloyclojurebot: rejectedexecutionexception?
13:34clojurebotRejectedExecutionException in swank means you need to upgrade swank to 1.3.2 or higher.
13:35duck1123using 1.4.0-SNAPSHOT
13:35amalloytechnomancy: duck1123 wants some help with the agent threadpool
13:35amalloy(probably)
13:36technomancyduck1123: are you on a frozen snapshot?
13:36duck1123no
13:36technomancytry the 1.3.2 release if you don't need cdt
13:37duck1123also, I don't know if this matterd, but I'm starting swank from within my -main
13:37technomancyoh, I see. in that case make sure you block on whatever thread is keeping the JVM alive
13:37technomancyor just @(promise)
13:39technomancyit's a workaround for the shortcomings of the clojure agent thread pool, but I think it's proven to be more trouble than it's worth
13:39technomancywill probably turn it off by default until Clojure adds a restart-agents function
13:43duck1123adding @(promise) did the trick
13:56miltondsilvaHi, is there some where where I can read a good clojure zipper tutorial? I can't understand how to use them just with the examples in clojuredocs + the documentation
13:57aufrankhey all, just getting started with clojure
13:58aufrankcan anyone help me figure out why the last line of this code isn't working? https://gist.github.com/1201257
13:58aufrankit returns (nil nil nil nil)
13:58aufrankI expected (0.2 0.2 0.2 0.2)
13:59hiredmanhave you tried (:neighbors kaet)
14:00hiredmanhttp://en.wikipedia.org/wiki/Lisp_%28programming_language%29#Self-evaluating_forms_and_quoting
14:00aufrankreturns (k ae t cat)
14:01hiredmanaufrank: and?
14:01manutterhow about (:activation k)?
14:01hiredmanyou mean (:activation 'k)
14:01amalloymanutter: that's going to work fine, and doesn't get at the problem
14:01hiredmanon line k is quoted
14:02hiredmanline 7
14:02manuttersorry, typo
14:02manutteramalloy: I assume nothing :)
14:03aufrank(:activation k) returns 0.2
14:03bhenry2well (:activation 'n) where n is anything will be nil.
14:03aufrank(:activation 'k) returns nil
14:03aufrankso I'm asking for the activation of the symbol k, not what it evaluates as
14:03hiredman(:activation (first '(k ae t cat)))
14:04hiredmansymbols don't have :activations
14:04aufrankright
14:06aufrank(:activation (first '(k ae t cat))) works, and I think I understand why
14:06aufrankbut I don't understand how to replicate it in a map function
14:06manutterso a quoted list of symbols is a list of quoted symbols? I'm confused
14:06hiredmannot it doesn't
14:06hiredmanno
14:06hiredmanif it works you did it wrong
14:07aufranks/works/fails/
14:07aufrank=P
14:08hiredmandid you read the wikipedia page on quoting?
14:09mprenticemanutter: '(a b c d) is shorthand for (list 'a 'b 'c 'd)
14:09manuttermprentice: learn sumpin new every day, tks :)
14:10aufrankok, just reread it. unfortunately I still don't see the way forward
14:10aufrankconceptually, I think I want to de-quote k inside of (:activation k)
14:11aufrankwhen the map runs, it calls (:activation 'k), but I want it to call (:activation k)
14:11aufrankbut I don't know what the de-quote operator is
14:11bhenry2aufrank: instead of quoting your list, list them. '(k ae t cat) => (list k ae t cat)
14:11bhenry2or is it quoted for a reason?
14:11aufrankquoted because I thought it was a convenient short hand
14:12hiredmanI think your life would be a whole lot easier if you stopped and said "do circular structures make sense with immutable data structures" and then acted in a sane way based on the answer
14:13mprenticehiredman: s/structures/references
14:13mprenticehiredman: circular immutable graphs make perfect sense
14:14aufrankbhenry2: that does solve the problem I presented, thank you kindly
14:14hiredmanmprentice: shhh, stop confusing the newb
14:14hiredmanbhenry2: you just broke it for him
14:14aufrankhiredman: I'd like to understand more, but I don't know how to start thinking about that question
14:15manutterhiredman: what exactly did that break?
14:15hiredmanbhenry2: you gave him an example that only works because he already has stuff def at his repl, and the moment he restarts the repl it won't work due to the circular references
14:15manutterah, the problem of building the neighbors list
14:16hiredmanmanutter: if you have already run those defs in a repl, and do what bhenry2 suggests it will seem to work for some value of "work" but not really
14:16bhenry2hiredman: touche
14:16bhenry2i missed the cat being predetermined.
14:16hiredmanaufrank: so step back, look at your problem, and do it without circular data structures
14:19jamiltronMaybe I'm a bit dense but is there a simple way to map a function onto every-other element of a seq, sans recur?
14:19hiredman,(map inc (take-nth 2 (range 10)))
14:19clojurebot(1 3 5 7 9)
14:19aufrankhiredman: the point of my toy example is to spread information among nodes in a network where cycles are allowed
14:20mprenticeaufrank: in order to understand why it's not working, you should understand symbols. they are a separate data type and don't really have an equivalent in java
14:20bhenry2jamiltron: do you need all the original sequence with every other updated, or does hiredman's solution work for you?
14:20hiredmanaufrank: thats an unfornate thing to be doing in a language you don't really know
14:20aufrankhiredman: defining the network structure by allowing each node to know its neighbors was the most sensible starting point for me
14:21jamiltronI do need to "update" the original sequence.
14:21jamiltronWhich I assume is done in a similar manner to hiredman's solution above (thank you, by the way).
14:21hiredmanyou model it like a real network, in a real network a node the neighbors are not contained in a node, a node just has references to neighbors
14:21bhenry2,(doc map-indexed)
14:21clojurebot"([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."
14:22jamiltronAh, I didn't even know such a function existed, thank you!
14:23bhenry2,(map-indexed #(if (even? %1) (inc %2) %2) (range 10)
14:23clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
14:23bhenry2,(map-indexed #(if (even? %1) (inc %2) %2) (range 10))
14:23clojurebot(1 1 3 3 5 ...)
14:23mprenticebhenry2: i didn't know about that either. i made my own function to do it. i should have known better.
14:23jolya more common representation of a graph is of a map from node names to a list of their neighbors, like {:k [:kaet] :ae [:kaet] :t [:kaet] :kaet [:k :ae :t :cat]}
14:24jolyand a separate map for the activations: {:k 0.2 :ae 0.2 ...}
14:25aufrankjoly: thanks, I'll try to rethink things in that representation
14:25mprenticejoly: that's a much more sensible and practical explanation than what i was trying to form.
14:27mprenticejoly: which means, of course, that you must die! en garde!
14:27aufrankhiredman: I would like to know how to store references to neighbors instead of the nodes themselves. is this a sensible approach in clojure? if so, what are the key concepts I should read about?
14:27jolymprentice: d'oh!
14:29mprenticeaufrank: that is what the code joly showed you does
14:29mprenticeaufrank: instead of trying to store objects inside each other, you are just calling them by names. that is storing a reference.
14:30aufrankmprentice: thanks!
14:42chouserinequality tests are the last place where prefix notation still bugs me
14:44chouserI think "when <big long expr> is less than 5, <dosomething>"
14:45technomancychouser: doesn't it help to think of < as "increasing-args?" rather than "less-than?"?
14:45chouserI can either write (< ((big-long-expr)) 5) in which case the short but important constant gets lost in the parens
14:45chouseror I can write (>= 5 ((big-long-expr))), but I have to think carefully every time I read or write that and still get it wrong too often.
14:46technomancywhy not let then?
14:46chouserhm. yeah, that may be best.
14:46upwardindexAnyone has deployed clojure apps to Jelastic?
14:48chousertechnomancy: or maybe (-> ((big-long-expr)) (< 5))
14:48chouser"Is your Clojure code too hard to read? Try adding more parens!"
14:49technomancyI almost suggested that, but I don't think it has any advantage over let
14:49technomancyI don't know what big-long-expr is, but it probably deserves a name
14:50chouserin the case in front of me, (count (set kids))
14:51pjstadigyou can also put big-long-expr and 5 on different lines
14:51bhenry2haha. chouser is the doc string for < a joke?
14:51bhenry2,(doc <)
14:51clojurebot"([x] [x y] [x y & more]); Returns non-nil if nums are in monotonically increasing order, otherwise false."
14:52pjstadigbut maybe a name like num-kids would work
14:53chouserin this case a name works well
14:54chouserbhenry2: too much jargon to be serious?
14:55bhenry2it's just silly i think
14:56technomancybhenry2: calling < "less than" is really confusing with prefix notation
14:56bhenry2definitely.
14:57bhenry2technomancy: i liked your description
15:06TimMcMaybe "less than" should be worked into the doc.
15:06TimMc"Returns non-nil if each argument is strictly less than any following argument."
15:07TimMcMore greppable.
16:02ikr.
16:16belunhello. does this symbol hve special meaning ? =>
16:16belunis used in midje
16:17bhenry2belun: it's to compare the input and expected results inside of a fact
16:17belunya but in clojure
16:17belundoes it do anythg ?
16:18bhenry2no i think it's a midje macro or something
16:18belundamn good point i can search for it now
16:23bhenry2belun: it's really nothing at all. fact must take care of it's args some how because => is just def'ed as "=>"
16:26belunhow did you find out
16:26belunits description
16:26belun?
16:26bhenry2(clojure.repl/source midje.sweet/=>)
16:27bhenry2returns (def => "=>")
16:30belunis not here https://github.com/marick/Midje/blob/master/src/midje/sweet.clj
16:32bhenry2he must have changed it from 1.2.0 to 1.3-alpha1
16:35belun(:use midje.sweet)
16:35bhenry2belun: https://github.com/marick/Midje/blob/master/src/midje/ideas/arrow_symbols.clj
16:35belunis there a bot here anymore ?
16:35belunto run code for u ?
16:35bhenry2there is but that won't work anyway.
16:35bhenry2use a comma or ampersand to begin your expression
16:36arohnerbelun: yes, there are several, but 1) that code isn't correct 2) most of them prevent state changes
16:36belun,(:use midje.sweet)
16:36clojurebot#<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: midje.sweet, compiling:(NO_SOURCE_PATH:0)>
16:36mattmitchellhow can i get every other x item from an array? Example, I want only items at even positions: [1 2 3 4 5 6 7] => [2 4 6]
16:37belun(doc fact)
16:37clojurebotI don't understand.
16:37belun,(doc fact)
16:37clojurebotGabh mo leithscéal?
16:37chouser(doc take-nth)
16:37clojurebot"([n coll]); Returns a lazy seq of every nth item in coll."
16:37bhenry2,(take-nth 2 [1 2 3 4])
16:37clojurebot(1 3)
16:37mattmitchellbhenry2: thanks!
16:37belunso can i test anythg midje here ?
16:37bhenry2belun: nope
16:38bhenry2belun: he is handling his arrow stuff here https://github.com/marick/Midje/blob/master/src/midje/semi_sweet.clj#L15
16:38bhenry2clone the project and play around.
16:39seancorfieldcan anyone give me pros and cons for using david santiago's clojure-csv library vs clojure.data.csv (from jonas enlund, based on cljcsv)?
16:40mattmitchellyo
16:40mattmitchellwrong room
16:41ferdNewbie here.... Regarding the issue of Clojure being slow to start (making it unpractical for quick scripts): Why does everyone blame the JVM?
16:42ferdI mean, the JVM is slow to start, but most of the startup time seems to be clojure-specific
16:43theignoraticause it's easy
16:44hiredmanferd: you have measurements? can you share them?
16:44ferdsure... trivial non-scientific example:
16:44hiredmanI think there is a "the jvm is slow to startup" and "the jvm is slow to load code" and they just get lumped together
16:44ferd"time mvn" gives me: real 0m0.591s
16:45arohnerseancorfield: any idea why jdbc/do-prepared doesn't appear to throw exceptions on bad SQL, while jdbc/do-commands does not?
16:45hiredmanthat is really unscientific
16:45hiredmanand actually times startup and shutdown
16:45ferdwhile: "time lein" gives me: 0m3.419s
16:45hiredmanlein is loading clojure+lots of libs including parts of maven
16:46ferdok, right then
16:46ferdso the slowness is on loading clojure itself (whatever than means)
16:46seancorfieldarohner: hmm, sounds like a bug... could you create an issue in JIRA with repro examples so i can take a look?
16:46ferdor may be lein is the one that is particularly slow ?
16:46seancorfieldhttp://dev.clojure.org/jira/browse/JDBC
16:46arohnerseancorfield: sure
16:47hiredmanno you mistunderstand, 'lein' is just doing more than running 'mvn'
16:47mattmitchell,(take-nth 2 [1 2 3 4 5 6 7])
16:47clojurebot(1 3 5 7)
16:47seancorfieldno takers on the CSV question? i'm trying to consolidate the libraries we're using and would prefer "standard" libraries over (random) 3rd party libraries if possible
16:47seancorfield(and, yes, i know that contrib is _not_ a "standard" library!)
16:48bhenry2,(take-nth 2 (drop 1 (range 10)))
16:48clojurebot(1 3 5 7 9)
16:49bhenry2,(take-nth 2 (drop 1 [1 2 3 4 5 6]))
16:49clojurebot(2 4 6)
16:50dsantiagoWow, I'm shocked to learn about clojure.data.csv.
16:50dsantiagoI offered clojure-csv to clojure contrib years ago and got no reply.
16:51belunanyknow how to get midje as project in intellij ? i forked it on github and pulled it localy
16:52seancorfielddsantiago: it seems the word about contrib isn't getting out there as well as it could / should...
16:52dsantiagoI saw nothing on the lists about this.
16:53seancorfieldi think the focus has mostly been on whether to promote old contrib to new contrib
16:53seancorfielda few new contrib libraries have appeared as (recent) volunteers have sprung up
16:53technomancyferd: try timing "lein version" instead, and be sure you have access to a client JVM
16:53technomancyferd: it's around 0.8s on my machine
16:54technomancy"lein" on its own invokes "lein help" which must load every task
16:55arohnerseancorfield: just to make sure I'm doing things correctly before filing a bug, is (jdbc/do-prepared "invalid SQL") the correct way to call it? (jdbc/do-commands "invalid SQL") throws as expected
16:55seancorfieldhmm, let me check... just a sec
16:55choffsteinAnyone know a good clojure library for sending email that can handle attachments?
16:55dsantiagoReally wish I hadn't spent all this time maintaining the library, fixing bugs, adding features for people, as my own use for it has long since passed.
16:56seancorfieldarohner: yeah, they should work "identically"
16:56chouserdsantiago: Sorry -- that sucks.
16:56arohnerseancorfield: ok thanks, I'll file
16:57seancorfieldexcept insofar as do-prepared uses PreparedStatement and do-commands uses Statement :)
16:58seancorfielddsantiago: fwiw, clojure-csv is doing us proud in production
16:58seancorfieldi only noticed clojure.data.csv the other day
16:58dsantiagoseancorfield, glad to hear it, I guess.
16:58ferdtechnomancy: real 0m0.908s (default JVM, that is, Server)
16:59dsantiagoI get that sort of message relatively frequently from people.
16:59technomancyferd: keep in mind that loading clojure necessarily loads the entire compiler into memory, whereas mvn only loads that on demand.
17:00ferdunderstood
17:00dsantiagohttp://clojuresphere.herokuapp.com/cljcsv http://clojuresphere.herokuapp.com/clojure-csv
17:00ferdI'm not really comparing lein vs mvn
17:00dsantiagoFascinating.
17:00ferdI'm trying to figure out where's the bulk of the load a any CLI app
17:01ferdnow, a precompiled "HelloWorld.clj" clocks around ~0.7s for me.... while a "mvn --help" (just to give an example) is 0.1s
17:01hiredmanferd: run jvisualvm
17:02ferdHello World in java would be 0.05s or so
17:02hiredmanactually, try sticking the clojure on the bootclasspath
17:02seancorfielddsantiago: i don't see any discussion on cljcsv becoming c.d.csv on clojure-dev ... no discussion of c.d.csv at all as far as i can see :(
17:02hiredmanmy guess is loading class files
17:02dsantiagoNope, no discussion at all.
17:02seancorfieldcljcsv was mentioned on clojure back in may 2010
17:03hiredmanclojure generates more class files, the bytecode of which has to be walked and verified on load
17:03ferdso, my honest question is where the time is being spent (if anybody knows for sure) and if there's something which could be done to improve matters.
17:03ferdI'm no expert, but I'm whiling to help
17:04seancorfieldclojure-csv has been discussed a lot on the clojure list (or at least there are a lot of posts from people who use it)...
17:04ferdI'll do more useful tests... Like, I care to see how the statup time grows with the size of the code-base
17:05ferdmay be the initial ~1s is there for a HelloWorld, but grows only slowly from there
17:05dsantiagoseancorfield, Yeah, I don't know.
17:05seancorfieldwell, i'm drafting a (long) email about the state of contrib for clojure-dev since we don't seem to have any guidance or consistency and think we need some...
17:10seancorfieldi'm a bit surprised there's no http library in contrib... what do folks use for interacting with http servers? i'm currently using clj-http but interested in options...
17:11dsantiagoseancorfield, yeah, I suppose. Maybe this other thing is better. It doesn't look as configuable to me. I'd have liked the opportunity to make my case (and given how quickly I turn around requests and bug fixes, a chance to make any changes to fix perceived inadequacies).
17:11technomancyseancorfield: stick with clj-http
17:13technomancyseancorfield: istr the old contrib http.agents lib was half-baked and probably shouldn't have gone into contrib by admission of its author, so it's unlikely to get promoted
17:14technomancyoh! I forgot, there is also gnir if you like symmetry.
17:14technomancyhttp://clojars.org/gnir
17:15hiredmanclj-http while being the best there is, seems to be largly abandon ware :/
17:15hiredmanstupid get-woven
17:15hiredmanand clj-sys or whatever
17:16Raynesseancorfield: I use slurp. ;)
17:16seancorfieldRaynes: mostly i want to post xml and json to a search engine...
17:17RaynesStop wanting to do that and you'll be fine.
17:17RaynesBut in all seriousness, I use clj-http in all my projects.
17:17seancorfieldah, gee Raynes, i guess i'll just rewrite my application :)
17:17seancorfieldmaybe "we" should look at getting clj-http promoted to a new contrib so at least it would be maintained going forward?
17:18seancorfield(i know, getting everything under CA might be a problem)
17:18pjstadigthings don't have to be in contrib to be maintained
17:18pjstadigClojure/core is great, but they're not the be all end all of clojure
17:19hiredmanthe network graph for clj-http is large
17:19seancorfieldis mark actively maintaining it tho'?
17:20pjstadigif not perhaps someone could pick it up
17:20hiredmanand there are a lot of orphans because people forked from getwoven's copy and getwoven vanished
17:20pjstadigi'm not saying it shouldn't end up in clojure core
17:20pjstadiger...contrib
17:20hiredmanmark's copy moved to getwoven, then getwoven vanished, and mark forked from some other random dude
17:20seancorfieldheh, i was about to correct you on that :)
17:20michaelr525does google docs works for you right now?
17:20pjstadigclojure contrib may be sufficient for it to be maintained, but its not necessary
17:21seancorfieldhiredman: looks like mark's pretty much the only committer going back to dot...?
17:21hiredmanhttps://github.com/medSage/clj-http/network
17:21michaelr525hiredman: what do you mean by getwoven vanished?
17:21hiredmanhttps://github.com/mmcgrana/clj-http/network
17:24technomancygithub badly needs a "this fork considered canonical" marker
17:26pcavstechnomancy: agreed
17:26pcavsI usually follow the fork tree down to the root, or try to at least
17:27hiredmanit would be nice to get all those features merged back into the cannonical version
17:27hiredmanalthough, really whatever has the most commits should be cannonical
17:27seancorfieldhiredman: all mark mcgrana apart from bradford cross for the first few commits, yes? (barring three commits by mark from other authors recently)
17:28technomancyhiredman: yeah, because *that's* not ripe for gaming =)
17:28hiredmanseancorfield: are you just looking a the git log? I don't really care about that, I care about all the forks with new features that haven't been merged in
17:29hiredmanwhich are evidence of the original clj-http being dead
17:29seancorfieldah, ok... i was only looking at it from the point of view of getting it under CA and into contrib - which i think would be worthwhile, esp. given your assertion that mark stopped maintaining it in february
17:30hiredman*shrug* I think getting it under the CA makes it less likely that we'll get all the work people have been doing on improving it in
17:31arohnerCAs definitely affect code velocity. When in doubt, I think they should be avoided
17:32arohnerand I'm tired of fixing namespace changes because of promotions
17:32hiredmana real great thing would be a clj-http fork that just merges in the other forks
17:33pjstadighiredman: you have my blessing
17:34hiredmanhah
17:34hiredmanto do something actually useful? I bet.
17:34dakroneeh, does it have tests? I'll maintain it?
17:34pjstadigbetter yet tell mcgrana to stop blogging about clojurescript and fix his stuff
17:35pjstadigdakrone: you have my blessing
17:35dakronethat was supposed to be "I'll maintain it" instead of a question
17:35pjstadighiredman: you have my curse
17:36pjstadigclojurebot: clj-http is <reply>dakrone maintains clj-http
17:36clojurebotAck. Ack.
17:36michaelr525funny, I just finished writing a rather long document in google docs and when tried sharing it with someone google docs just went down
17:36pjstadig~clj-http
17:36clojurebotdakrone maintains clj-http
17:36pjstadigthere now it's official
17:36michaelr525go trust a cloud word processor
17:36dakronehah, okay, lemme fork Mark's and I can start
17:39dakronehttps://github.com/dakrone/clj-http send pull requests gogogo
17:42pjstadigdakrone: no...now you have to go onto the githubs and merge in every single change that has been made in every fork of clj-http
17:42dakronepjstadig: yea, I'll work on that too
17:42pjstadigand by Friday
17:42dakronein the meantime, upgrading the deps
17:43hiredmanI think one of the branches did
17:43pjstadighehe
17:54di-csuehsIs there a canonical list of available lein plugins?
17:54hiredmanhow can there be canonical list?
17:55di-csuehs"sigh" (def canonical (enough (canonical)))
17:55hiredmanwhat is enough?
17:55technomancydi-csuehs: plugin authors are encouraged to add links to the wiki page
17:55technomancyhttps://github.com/technomancy/leiningen/wiki/Plugins
17:56di-csuehsThanks, tm!
17:57technomancyno problem
18:03mccraigwhat's the currently accepted approach for unit testing private functions ?
18:05mccraigis it the case that it's better to move private functions to a different namespace and make them public ?
18:07technomancymccraig: IMO yes
18:07technomancythere are tricks to make it work with actual private defns, but I prefer the idea of entire private namespaces
19:02miltondsilvais there a "reduce" for coll f instead of f coll?
19:05brehaut#(reduce %1 coll) ?
19:13miltondsilvabrehaut: hmm not what I'm looking for...
19:13miltondsilva(#(%1 oc) [zip/down zip/right zip/right zip/right])
19:13brehaut(juxt zip/down zip/right …)
19:14brehaut?
19:14brehautno
19:14brehauti have no idea what you are doing
19:14technomancymybe the konami code?
19:14technomancy*maybe
19:14brehauthaha
19:15miltondsilvaI have a vector with functions and I want to traver a zipper like that
19:15miltondsilvanormally I would do
19:15miltondsilva(-> zipper fn1 fn2 fn3)
19:15miltondsilvabut if they are
19:16miltondsilvainside
19:16miltondsilvaa []
19:17brehaut((apply comp (reverse [zip/down zip/right zip/right zip/right])) zipper) ?
19:18brehautexcuse the Closuritis
19:19technomancyhttp://p.hagelb.org/konami.clj.html
19:21miltondsilvabrehaut: it works :) I was doing something with eval...
19:21miltondsilvastill it's a bit more complex than I would like
19:22brehaut(reduce (fn [acc f] (f acc)) zipper [zip/down zip/right zip/right zip/right]) ?
19:26miltondsilvaalso seems to work and I like it better :)
20:35sn197hi, a java interop question - how do you obtain an instance of java.awt.geom.Path2D.Float in clojure (unfortunately I am not a java expert)
20:39sn197Path2D.Float is a public static class, can an instance be obtained at all?
20:48sn197hi, a java interop question - how do you obtain an instance of java.awt.geom.Path2D.Float in clojure (unfortunately I am not a java expert)
20:59LuminousMonkeyWish I could help sn197, I've just tried to figure it out, and I'm failing.
21:00hiredmanthe answer is: the same way you do it in java
21:01sn197easier said than done, I did some homework before posting here
21:01hiredmanif you know the operations in java, then ask how you do those operations here, otherwise read the javadocs
21:02hiredmanwell, looking at the javadocs, you can see the class name is Path2D.Float, which tells you it is an inner class
21:03hiredmanso you say "how do you work with inner classes in clojure?"
21:03TimMcAnswer: You need to use a weird syntax.
21:03sn197thanks, is there a link to this on the net?
21:03hiredmanand someone says "same as normal classes, just use $ in place of '.' in the classname because that is what the jvm does internally"
21:03hiredman~google java.awt.geom.Path2D.Float
21:03clojurebotFirst, out of 240 results is:
21:03clojurebotPath2D.Float (Java Platform SE 6)
21:03clojurebothttp://download.oracle.com/javase/6/docs/api/java/awt/geom/Path2D.Float.html
21:03TimMcsn197: https://github.com/timmc/CS4300-HW3/blob/master/src/timmcHW3/drawing.clj
21:04sn197yup, I 've read the java docs, I will insert $ sign, thanks
21:05sn197it worked, thanks guys, I won't be asking stupid questions any time soon
21:06hiredmanwell, the big thing is when you ask "how do you obtain an instance of java.awt.geom.Path2D.Float" unless someone knows the particular class no one knows the answer, but if you know enough to ask "construct/import/etc inner classes" it is easy to answer
21:17TimMchiredman: It's hard to know to ask that one.
21:18TimMcJava disguises the difference between top-level and inner classes pretty well.
21:27mdeboardUgh about to write a small Clojure program after not touching clj for a month+
21:28mdeboardfeels intimidating man
21:32alandipertmdeboard: fear not, nothing has changed... we are immutable :-)
21:32mdeboardalandipert: My memory is not
21:32mdeboard:(
21:38mabes_lol
21:38jliI would kind of like to be able to use commas in numbers, but it doesn't work because they're whitespace. e.g., "1,000,000" is "1 000 000" instead of "1000000". I'm guessing rich would hate a patch that special cased commas when used inside numbers?
21:39hiredman,1e6
21:39clojurebot1000000.0
21:40cemerickjli: Yeah, that's not a high-probability change.
21:41jlicemerick: I figured :) oh well
21:41jlihiredman: that's useful, but doesn't work for numbers that aren't powers of 10
21:42jlihum, is there a way to change the base, besides "0" for octal and "0x" for hex?
21:42hiredman,10r13
21:42clojurebot13
21:43hiredman,2r13
21:43clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: For input string: "13">
21:43hiredman,2r10101
21:43clojurebot21
21:43hiredmanbah
21:45jliah, cool. thanks
21:59mdeboardAnyone have a link to some code that uses read-line to prompt for user input?
22:00mdeboardor actually any technique to prompt for user input? :)
22:03mdeboardOh yeah, read-line doesn't work right in slime-repl
22:58hippiehunterhow do i debug this? "#<CompilerException java.lang.StackOverflowError (NO_SOURCE_FILE:0)>"
23:00jeremyheilerhippiehunter: is that from the repl?
23:00hippiehunteryeah
23:02jlihippiehunter: the stack overflow probably means you're recursing too much. is there a tail recursive function that's not using recur? also, if you throw your code in a file, you'll get a better error message
23:04brehaut(use 'clojure.stacktrace)
23:05brehaut(e) is useful for getting the full exception
23:05brehauthttp://clojure.github.com/clojure/clojure.stacktrace-api.html
23:09hippiehunterbuilding it in file form helped
23:12alandipertsee also clojure.repl/pst; (pst) available by default in repl
23:17bhenry1alandipert: what version has that in the repl? it's not defined for me
23:17alandipertah, perhaps 1.3-forever, apologies
23:18bhenry1sweet
23:20jliI'm not sure I understand the difference between var and let
23:20jlier, var and resolve
23:25nickmbaileyanyone have a good way of getting the version number of the lein project when running from a jar/uberjar?
23:25nickmbaileyi guess you can parse the project.clj file since it's in the jar
23:25nickmbaileyseems like there should be an easier way
23:30alandipertjli: resolve is slightly lower-level (it can optionally take an ns arg, and resolves symbols that needn't necessarily have been referred)
23:31bhenry1nickmbailey: https://gist.github.com/cd2293d656553faccf84 if you aot compile that you can reference the version var anywhere in your code.
23:32iceywhat is the general quality level like in open source java libraries? and what is a good way to ascertain if a library sucks if you don't know java?
23:33bhenry1icey: google "library-name sucks" and see if you get hits
23:40iceybhenry1: hah, alright; thanks :)
23:43nickmbaileybhenry1: i don't think that will work when running from a jar/uberjar right?
23:43bhenry1it does in my project
23:43bhenry1but you have to aot compile it
23:43nickmbaileyjava -jar projectname-version-standalone.jar ?
23:43nickmbaileyyeah i do
23:44bhenry1java -cp projectname-version-standalone.jar clojure.main
23:44bhenry1i don't know if it works with the java -jar way
23:45jliis it idiomatic to prefer deftype/defrecord over struct-maps?
23:45bhenry1jli: yes
23:47nickmbaileybhenry1: yeah that should work, dumb mistake on my part
23:51nickmbaileybhenry1: many thanks btw, a creative use of macros i wouldn't have thought of :)
23:52bhenry1nickmbailey: that was my first macro i ever wrote. i got help from technomancy earlier this year.
23:53nickmbaileyyeah i donno how i would've realized it was getting passed as a property in the jvm lein spawns