#clojure logs

2012-04-22

00:00kovasbregarding the syntax, I was looking at examples in clojurescript core; deftype and extend-type treat the arity grouping differently
00:01mmarczykhm, true
00:01mmarczykpossibly worthwhile to unify syntax, or have both handle both options
00:02kovasbyeah, I just assumed the syntax was the same
00:02kovasbsince everything else looked the same on first glace
00:02kovasb(doesn't make a whole lotta sense for it to be different)
00:02mmarczyksure
00:02kovasblemme try it on my actual code now..
00:05kovasbno errors! thanks for the help
00:05lynaghkmmarczyk: thanks for all of your work on the cljs internals
00:06lynaghkI'm really stoked about all of these performance improvements = )
00:06mmarczyklynaghk: not at all, it's really a fantastic experience
00:06amalloyi think it's different for sorta implementation reasons. deftype prefers to inline method bodies implementing the backing interface, so each method body is separate; extend-type is shoving functions into a map, so it wants one function with N bodies
00:07mmarczykamalloy: ah, good point
00:07lynaghkmmarczyk: the crucial ingredient for excellent work.
00:07amalloyit's definitely possible to make them support the same syntax, of course, and still probably a good idea
00:07kovasbamalloy: thats interesting. The syntax is still inconsistent with defn tho
00:08kovasbi would prefer to be able to write defn in separate cases like that
00:08kovasbbut without that, better for deftype to support a superset
00:09kovasbthat includes the defn style
00:16lynaghkIs there a nice way I can redefine the print function for an atom? (Subclassing and overriding print, basically). The best I can think of is to either use deftype and copy the implementation of atom, or use reify to proxy to an internal atom and just forward the methods. Both feel gross.
00:20danlarkinwhy do you think you need to do that?
00:22lynaghkI'm using atoms to represent state machines, and it'd be nice if they printed to the console just showing the current state rather than a huge nested map structure filled with anonymous fns.
00:22danlarkinwrite a format-machine function :)
00:23lynaghkdanlarkin: yeah, but that won't make lookin' at them any nicer on the console
00:24lynaghkAnd I'm developing the library at the moment = )
00:24kovasblynaghk: is this cljs or clj?
00:24danlarkincan't you call format-machine from the console?
00:24danlarkinI don't see why that's any harder than derefing the atom
00:24lynaghkdanlarkin: yeah, but it's not automatic! =P
00:24kovasbdanlarkin: not if u want to see it embedded in other structures
00:25lynaghkkovasb: I'm writing it out in Clojure, but I'm using CLJX so the library will be for both platforms.
00:25kovasblynaghk: in cljs at least, printing is defined in terms of protocols
00:25lynaghkkovasb: the motivating use case is managing rich apps built in ClojureScript.
00:25kovasblynaghk: which i believe means you cannot override the implementation for existing types
00:26kovasblynaghk: but makes it easy to implement for your own type
00:26lynaghkkovasb: yeah, I was wondering if there was any clever way to do effectively that without defining a new type and all of the associated implementation
00:26kovasblynaghk: though, there seem to be a variety of print functions, not sure if there is a way to intercept one of them
00:26lynaghk(that = override print method implementation)
00:26danlarkinplease do not implement your own atom just to override .toString
00:27danlarkinthat is so 100% crazy
00:27lynaghkdanlarkin: I know, that's why I wanted to ping the IRC first = )
00:27mmarczyklynaghk: redefine print-method for atom to check the atom's metadata for a key indicating that it's a state machine?
00:27kovasbif you look at the atom definition in cljs, it is totally trivial
00:27lynaghkmmarczyk: yeah, I thought about that too. I think it might be the best option here
00:28lynaghkkovasb: yep, I was surprised when I first read it, but after some thought there's not really anything else to atoms.
00:29kovasbwhat kind of state are you keeping in the atoms?
00:31lynaghkkovasb: it's similar to ibdknox's Waltz library: the atom has a map of states, events, and a set describing the current states the machine is in
00:31lynaghk(it can be in more than one state at the same time)
00:31kovasblynaghk: cool. how does that relate to helping with webapps?
00:32lynaghkmmarczyk: yeah, the metadata approach works nicely, thanks.
00:32lynaghkkovasb: it's a good structure to have, rather than spreading the logic around in a handful of callbacks
00:32lynaghk(add-watcher functions)
00:32mmarczyklynaghk: great
00:33kovasblynaghk: you mean, what you do on callback depends on the state?
00:34lynaghkkovasb: if you're not careful about organization you'll end up with the logic splattered around different places
00:34lynaghke.g., in a callback that is executed when a DB call from the server returns, you check some UI widgets to make sure that the data is still needed
00:34kovasblynaghk: believe me, i know :) just curious what it would look like
00:35lynaghkkovasb: ah, right. Know and love =P
00:35kovasblynaghk: sounds interesting.
00:35kovasblynaghk: my js apps definitely suffer from that. the cljs ones slightly better, but still not great
00:36lynaghkkovasb: the reason I'm writing a new lib instead of just using Chris's Waltz is because I need more emphasis on actual mutable state---associating atoms with states in the state machine
00:36kovasbright
00:36lynaghkkovasb: the motivating use case for that is because I need to be able to serialize the entire application state (e.g., the current drop down selections and such)
00:37kovasblynaghk: i think we are working on the same problem
00:37lynaghkkovasb: I'm getting a little demo up and running in the next hour (hopefully). I'll add you to the github repo and you can check it out.
00:37kovasblynaghk: awesome, will definitely check it out.
00:37lynaghkI'd love to hear your thoughts on the design.
00:37kovasblynaghk: its a hard problem :)
00:38kovasblynaghk: right now I'm working on serializing document representing my cljs app, which is a webrepl
00:39lynaghkkovasb: no README on the github repo grr! =P
00:39kovasblynaghk: haha, leon reps && leon run baby
00:39kovasb*lein
00:39muhoois there anything special involved in building lein2 from source? isn't it just lein2 uberjar, then copy the uberjar to ~/.lein/self-installs, then change the lein2 shell script to use that SNAPSHOT version?
00:39kovasbnot ready for public consumption to say the least..
00:40kovasbjust refactored the whole thing today to use deftype
00:44kovasblynaghk: i think i understand what its doing
00:45kovasblynaghk: in terms of serialization, its that so the user can come back to the app and find it in the same state?
00:46lynaghkkovasb: yep. It has several views and toggles, so they need to be able to bookmark it and come back later
00:46lynaghk(using pushState to serialize into the URL)
00:47kovasblynaghk: how do you hook up the state with the content of the widgets?
00:48lynaghkkovasb: need to put together a serialization protocol that people can implement for different widgets.
00:49kovasblynaghk: cool. we should definitely coordinate
00:49kovasblynaghk: basically, i want to make the interactive repl where people can type in their widgets, and share / come back to them later
00:50lynaghkBasically, any of the state machine states can be associated with ref-like things that implement IWatcher (which I'm calling "wub" to differentiate from state machine states). If the user wants to be able to serialize the state machine, the wubs will also need to implement the serialization protocol.
00:51lynaghkkovasb: sure, I'd be happy to chat about that. This particular thing needs to get written tomorrow and delivered Monday, but the design definitely isn't set in stone. I'd be interested to see what other people think of it and end up doing with it
00:51kovasblynaghk: cool
00:52kovasblynaghk: one thing that kinda stretches the metaphor of "state machine" is for example the content of a dynamic visualization.. changes over time, but the changes don't put the logic into a different state
00:52kovasblynaghk: anyway will let you work for now :)
00:53lynaghkkovasb: yeah, that's a problem I've been thinking about w.r.t. C2 stuff
00:53kovasblynaghk: I've been hitting my head super hard against the wall. have some ideas but they need reality testing.. anyway lets connect soon
00:54lynaghkon one hand, I think the data should be logical, and the mappings should always be one-to-one from the data to the visulization elements. But if you're going to be strict about that, it's unclear how to do things like graph layout and stuff (since the data depend on each other). Personally, I've been using separate layout fns that run after the initial data->DOM mapping, but I'm not sure if that's the best solution.
00:55lynaghkkovasb: sure. I'll get in touch later this week and we can skype or something
00:55kovasblynaghk: sweet. will have my stuff in better shape by then too..
00:58yoklovHm. I think the level generator is officially "good enough"
00:58yoklovhttp://dl.dropbox.com/u/13069163/crash.png
01:00emezeskeyoklov: Neat!
01:01ibdknoxyoklov: lol I love you bookmark folders :p
01:02ibdknoxyour*
01:02yoklovhahaha, yeah, didn't think about those :p
01:04yoklovthey at least make me feel more organized, but… maybe I should move piracy inside of saved or something.
01:05ibdknoxhaha
01:11kovasbibdknox: are you gonna keep the publicity flowing by making more awesome demos? :)
01:13amalloyyoklov: just rename piracy to "liberation" or some other synonym
01:14yoklovamalloy: that is a good idea
01:26ivanI am curious as to *why* it is faster though
01:29amalloyi wouldn't be surprised to learn that code on the boot classpath doesn't get run through the verifier, or is verified less rigorously
01:32ivan"Several large caveats go with this, however. To begin with, any and all security policy set by the SecurityManager or the associated Policy implementation (see [8] for details) are completely ignored and entirely unenforced for code loaded from the bootstrap ClassLoader."
01:36amalloysure, or that. i was close!
01:39ivanheh heh -Xbootclasspath/a:C:\stuff\clojure.jar does not work while forward slashes do work
01:45jblomo,(meta ^{:test true} (sorted-set 1 2 3))
01:45clojurebotnil
01:45jblomo,(meta ^{:test true} [1 2 3])
01:45clojurebot{:test true}
01:45jblomodoes the reader meta macro work differently on function calls that return an object?
01:46amalloyit only works on object literals
01:46jblomoah ok. otherwise i have to use with-meta?
01:46amalloypersonally i recommend using with-meta always
01:46amalloyto avoid confusion with what's happening at runtime with what's going on at read time
02:02amalloyas an aside, putting reader metadata on lists is a problem for other reasons too: if you typehint a macro call, the typehint is silently discarded. see http://dev.clojure.org/jira/browse/CLJ-865 if you're interested
02:04jblomoamalloy: thanks, i was more trying to understand how metadata was stored for non-reader datatypes
02:04jblomolike sorted-set
02:04jblomoI am trying my hand at CLJ-248
02:04jblomotrying to understand if a subset should carry along the metadata of the superset
02:11amalloyi don't think so, but i haven't thought hard about it
02:12amalloysub-sortedsets would be interesting but i can't imagine how they'd work with good performance. do you have an algorithm in mind?
02:16jblomoamalloy: it looks like sorted sets are backed by PersistentTreeMap, which are kept in order
02:16jblomoso i was hoping to use subtrees which i have a vague hope would not require making a lot of new objects
02:29amalloyit seems like you couldn't keep the balance properties of PTM, though
02:30amalloyeg, if you have a perfectly balanced tree of 15 elements, and only keep some of the inner ones, you have a tree that is very poorly balanced
02:31amalloyand then conjing onto that structure would be a mess, right?
03:11bolicI'm getting confused by namespaces and -main, help anyone? See here: http://pastie.org/3832210
03:27muhoobolic: post your project.clj?
03:32amalloybolic: note it's #<Namespace user>, not #<Namespace ack.doodle>
03:33amalloy*ns* is bound at compile-time, not runtime, i believe. the whole namespace gets compiled with *ns* bound to ack.doodle, and then lein invokes the -main function after compilation is done, so *ns* is set to the default binding of user
04:01Hali_303hi! can someone confirm that C-M-x does not work on protocol stuff in Emacs?
04:05muhoois there a more current appengine/bigtable library for clojure than this one: github.com/smartrevolution/clj-gae-datastore ?
04:05muhooit's old, only works with clojure 1.2, doesn't have lein support yet, etc
04:09muhoonm, found it: https://github.com/gcv/appengine-magic
04:09muhooappengine-magic.services.datastore
04:19amalloyHali_303: works fine, though i suppose no answer can be definitive if you don't specify what you mean by "protocol stuff" and "does not work"
04:54bolicgot disconnected.. did anyone answer my previous question? *ns* appears to be 'user in -main, but functions defined in the same file, and from a different namespace, can be called. What's going on? see http://pastie.org/3832210, thanks
05:06BorkdudeStrange, I can't edit a clj in Eclipse anymore
05:06BorkdudeWhen I copy/paste smth: ccw.editors.clojure.handlers$apply_paredit_command cannot be cast to clojure.lang.IFn
05:07talios'lo Borkdude
05:07Borkdudehi talios
05:08taliosHow goes the evening?
05:08talios(well, evening my time anyway)
05:08Borkdudeit's morning here
05:14BorkdudeHas anyone got the leiningen plugin in Eclipse functioning (update dependencies)?
05:16cirwin(noob alert) is there a varargs version of every? (or if not how do I go about making one). I want to check a condition against every pair in two sequences.
05:31AimHerecirwin > Not hard to roll your own - something along the lines of: (defn everyv? [f & x] (cond (every? empty? x) true (apply f (map first x)) (recur f (map rest x)) :else false))
05:32cirwinAimHere: awesome
05:32cirwinI'm just struggling to find everything at the moment — I remember about the & now you say it :)
05:33kab3wmHaving some "IO" issues with binary files. I'm trying to build an image cache with Redis, but just testing with copying my byte-array to file, the files are missing around 3500 bytes. See: https://gist.github.com/2462911
05:33AimHerecirwin > Looks right to me, but I do make lots of mistakes when I write code, so check it before you use it!
05:34cirwinwill do, thanks again
05:37BorkdudeDoes someone know if I want to use a leiningen project in Eclipse, how I can get a REPL in Eclipse running?
05:37BorkdudeI did a "lein deps" and then added references to the jars manually
05:38Borkdude(because I can't get the leiningen plugin to work)
05:41hiredmankab3wm: you need to close the stream or call .flush
05:42kab3wmhiredman: I will give that a shot. thank you.
05:52BorkdudeTrying "lein ccw" now... NullPointerException
05:53BorkdudeI'm giving up almost...
06:58fliebel$mail samaaron Any luck with PureJavaComm? Does my patch work for you?
06:58lazybotMessage saved.
07:01georgeMonethello
07:06mercurianhello is anyone active
07:07mercurianI need some help in installing Clojure with AcquaMac
07:23bordatouehello
07:24bordatouewhat a shit
07:50angermanDammit clojure… gimme a fist!
07:50angerman(Spelling is hard)
07:52bordatouehello could anyone tell me how to install clojure with Acquamac
07:53angermanbordatoue: you mean how to configure Aquamacs?
07:53_KY_What is the test for lower-case characters?
07:53bordatoueyes,
07:53_KY_Thanks in advance! =)
07:53bordatoueI want to work with AcquaMac and Clojure i have been following the instruction specified in http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
07:54bordatoueit say in the web page to download clojure-mode.el , but there is no link
07:54bordatouehttps://github.com/technomancy/clojure-mode/blob/master/README.md
07:55angermanbordatoue: it's this one: https://github.com/jochu/clojure-mode
07:55angermanerr https://github.com/technomancy/clojure-mode
07:55angermanthat one
07:55bordatouethanks very much
07:56bordatouei will try with those file
07:56angermanfollow the instructions; (I'd recommend using Marmalade)
07:56bordatouehow do I install the package manager for AcquaMac ; Marmalade
07:57bordatouethat was the hinderence when I tried Marmalade approach
07:58angermanbordatoue: if aquamacs does not come with package.el; try without Marmalade
07:58bordatoueokay
07:58bordatoueis it possible to install Marmalade for acquamacs
08:00angermanI assume. You would need to install ELPA package.el
08:01bordatoueis there any instruction on how to install ELPA package.el
08:02angermanI guess you basically just need to install http://bit.ly/pkg-el23 (put in ~/.emacs.d/) and load it in ~/.emacs.d/init.el
08:03bordatoueokay thanks, I will try them
08:34_KY_How can I use set/union?
08:35_KY_The REPL can't resolve the symbol
08:36yangsxKY: (require '[clojure.set :as set])
08:36_KY_Thanks=)
08:37yangsxor (clojure.set/union #{1 2 3} #{2 3 4})
08:44michaelr525hey
08:50_KY_How to append 2 lists?
08:54_KY_Nevermind... what I need is concat
09:40jimi_hendrixwhat is the most "clojure" way of creating a Vec3 type structure? just pass around a vector with 3 elements?
09:43AimHerejimi_hendrix, Probably. If you can do it with a vector or a sequence, then do it that way
09:43AimHereFailing that, do something lispy with lambdas and macros
09:44AimHereIf all else fails, shoehorn it into object orientation with protocols and deftypes/defrecords
09:44AimHereI think that's roughly the idiomatic Clojure pecking order
09:45jimi_hendrixfirst situation should work
09:48jimi_hendrixalso, i am using slime and emacs. when i am defining functions and typing the argument list i get stuff like error in process filter: wrong argument type listp 1
09:49jimi_hendrixthis slows down typing. what gives?
10:07_KY_How can I add an element to the beginning of sequence?
10:08tmciver_KY_: use cons
10:08mk,(cons 1 [2 3])
10:08clojurebot(1 2 3)
10:09_KY_But that adds to the end of list
10:09AimHerecons doesn't
10:09patrikkarlinwhat?
10:09clojurebotwhat is exceptions
10:09_KY_Or, what I need is to add to the end
10:09mk_KY_: the list is the second argument
10:09AimHereIf you want to add to the end of a vector, you could use 'conj'
10:09_KY_Sorry I confused head with tail =)
10:10mk,(conj 1 [2 3])
10:10clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentCollection>
10:10_KY_,(conj [2 3 5] one)
10:10clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: one in this context, compiling:(NO_SOURCE_PATH:0)>
10:10_KY_,(conj [2 3 5] '1)
10:10clojurebot[2 3 5 1]
10:10_KY_Ah I see...
10:10fliebelconj ads to the start fro a list, tail for a vector.
10:10mk,(conj '(2 3) 1)
10:10clojurebot(1 2 3)
10:10tmciver_KY_: no need to quote the 1
10:10_KY_,(cons [2 3 5] '1)
10:10clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
10:10_KY_,(cons '1 [2 3 5])
10:10clojurebot(1 2 3 5)
10:11AimHere,(conj [1 2 3 4] 5 6 7 8)
10:11clojurebot[1 2 3 4 5 ...]
10:11mkthe arguments are reversed, which can cause mild annoyance
10:11fliebelAdding to the end of a list is inefficient. But you could use ##(concat '(1 2 3) '(4))
10:11lazybot⇒ (1 2 3 4)
10:11fliebelor a vector, of course.
10:12_KY_Yes I think conj is what I need
10:12mkconj should not be used for adding things to the start or end of anything, though
10:12_KY_Why not?
10:13mkbecause the specification specifies that depending on the "concrete type", adding can occur anywhere (the start, end, middle...)
10:13mdeboard&''x
10:13lazybot⇒ (quote x)
10:13mdeboard&'#"\\"
10:13lazybot⇒ #"\\"
10:13mdeboard&'#{1 2 3}
10:13lazybot⇒ #{1 2 3}
10:13mdeboard&''#{1 2 3}
10:13lazybot⇒ (quote #{1 2 3})
10:13mdeboardweird
10:14mk_KY_: in practice, this means that conj adds to the front of lists and to the tail of vectors
10:14AimHereWhat's weird about that?
10:17_KY_Well, I found out I could use cons afterall
10:17_KY_But conj won't add to the middle right?
10:18_KY_Are you kidding?
10:21mk_KY_: I'm not. It adds into the most efficient place in the list. If we implemented special new vectors where adding into the middle was fastest, conj would add into the middle
10:22mk(actually, it wouldn't, because everyone uses conj, incorrectly, to add to the start of lists and the end of vectors, but that's beside the point)
10:27_KY_Fine... I'm not using conj anyway
10:28mk_KY_: :)
10:29mkwhy did clojure implement bigints in addition to bigintegers?
10:29mmarczykmk: nothing incorrect about that
10:31mmarczykmk: as for bigints -- that's so that you can get convenient and efficient arbitrary precision arithmetic with the >= 1.3 numerics
10:32mmarczykmk: just using bigintegers would be unbearably slow with the current jvms, so the idea is to write a faster bigint class
10:32mkmmarczyk: it assumes that append for vectors is fastest at the end, but this need not be the case
10:32mmarczykmk: as far as I remember (<- about bigints)
10:33mkmmarczyk: our bigint has a BigInteger field (and a few other things) in it. Are you sure?
10:33mmarczykmk: strictly speaking, conj doesn't promise to insert into the "fastest" place, but rather some fixed place for each concrete collection type, which might be different for different collection types
10:34mmarczykmk: although even more strictly speaking, it doesn't necessarily make sense that the insertion place is different, because it doesn't necessarily make sense to compare
10:34mmarczykmk: say, vaguely sequential colls vs. associative colls
10:34mmarczykmk: it also has a long field
10:35mmarczykmk: the idea is to use that whenever possible and fall back to biginteger
10:35raxelohi all, please help to resolve this compilation problem http://pastebin.com/N7sdD2mp
10:35raxeloseems like it requires seq instead of reference to the predicate
10:35mmarczykmk: for now, anyway -- maybe biginteger will be completely replaced one day
10:35mkmmarczyk: I've heard something vague about the hash values of biginteger being off
10:37mmarczykmk: ah, right, I think I remember something like that too
10:37mmarczykmk: in addition to the precision issue.
10:37mmarczyk&(hash (BigInteger. "126463241243514"))
10:37lazybot⇒ -2069874442
10:37mmarczyk&(hash 126463241243514)
10:37lazybot⇒ -2070792066
10:38mmarczyk&(hash 126463241243514N)
10:38lazybot⇒ -2070792066
10:38mmarczykindeed.
10:40mmarczykreturning to the conj issue, the idea is that you need to pick the collection types which make sense for your algorithms and know their behaviour, and in particular their behaviour w.r.t. conj et al. -- but without guarantees as to that behaviour conj would be pretty useless
10:42raxeloguys, I have got message "IllegalArgumentException: Don't know how to create ISeq from: dp_toolkit.layout$discovery_script_QMARK_, compiling:(layout.clj:23)
10:42raxelobut function discovery_script has to be evaluated before call, right ?
10:42raxelohttp://pastebin.com/N7sdD2mp
10:43raxelobefore applied in map-function call
10:43mmarczykraxelo: (mapcat walk subdirs filter-fn)
10:44mmarczykraxelo: you probably want (mapcat #(walk % filter-fn) subdirs)
10:45mmarczykraxelo: oh, also note #((and (.isFile %) (filter-fn %))) -- you need to remove the outer layer of parens
10:46mmarczykraxelo: otherwise you're calling the return value of (and ...) as a function
10:47raxelommarczyk: thanks a lot for the help, I have stuck at 23 line where error points me (newbie)
10:47mmarczykraxelo: there's also line 20
10:47mmarczykraxelo: you probably want sth like (.endsWith the-interesting-string "py")
10:48mmarczykraxelo: "xml", rather, "py" is on line 15 -- same story
10:48mmarczykraxelo: also remove the outer (= "py" ...) from around the new .endsWith form
10:49mfexraxelo, you can turn a tree directory/file structure into a seq with (tree-seq #(.isDirectory %) #(.listFiles %) (File. root)) and then filter for dir/file and apply filter-fn
10:49raxeloaha
10:49raxelomfex: about
10:50raxelomfex: about "turn tree to seq" is very cool! thanks
11:01raxelothanks a lot, mfex and mmarczyk
11:28_KY_How come the set union of 2 lists is a joined list?
11:28_KY_Instead of a set containing 2 lists
11:32tmciver_KY_: because the doc says so: ##(doc union)
11:32lazybot⇒ nil
11:32tmciver&(use 'clojure.set)
11:32lazybot⇒ nil
11:32tmciver&(doc union)
11:32lazybot⇒ ------------------------- clojure.set/union ([] [s1] [s1 s2] [s1 s2 & sets]) Return a set that is the union of the input sets nil
11:33tmciver_KY_: and it takes and returns set, not lists.
11:33_KY_Yes but I expect to get a set of 2 lists
11:33_KY_Like { [1 2 3], [4 5 6] }
11:34tmciver_KY_: then you'd have to create sets containing lists as input to union
11:34tmciver&(union #{[1 2 3]} #{[4 5 6]})
11:34lazybot⇒ #{[1 2 3] [4 5 6]}
11:35tmciver_KY_: but I think sets don't typically contain lists like that.
11:35_KY_Well that's exactly what I need...=)
11:37tmciver_KY_: keep in mind union may not combine your lists as you'd expect: ##(union #{[1 2 3]} #{[2 3 4]})
11:37lazybot⇒ #{[1 2 3] [2 3 4]}
11:37tmciver_KY_: i.e. it does not 'combine' the 2 and 3.
11:38_KY_That's what I expect
11:38_KY_They are different lists
11:53_KY_I want something like this to work:
11:53_KY_(clojure.set/union {[1 2 3 4]} {[1 2] [3 4]} )
11:53_KY_,(clojure.set/union {[1 2 3 4]} {[1 2] [3 4]} )
11:53clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Map literal must contain an even number of forms>
11:53tmciver_KY_: sets are prefixed with #
11:55_KY_,(clojure.set/union #{[1 2 3 4]} #{[1 2] [3 4]} )
11:55clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.set>
11:55Bronsa,(require 'clojure.set)
11:55clojurebotnil
11:55Bronsa,(clojure.set/union #{[1 2 3 4]} #{[1 2] [3 4]})
11:55_KY_,(clojure.set/union #{[1 2 3 4]} #{[1 2] [3 4]} )
11:55clojurebot#{[3 4] [1 2] [1 2 3 4]}
11:55clojurebot#{[3 4] [1 2] [1 2 3 4]}
11:55_KY_Ahhh works...
11:55_KY_=)
11:58_KY_Another question: there is no built-in test for lowercase characters in clojure
11:58_KY_Maybe we can call java's library for that?
11:59tmciver&(Character/isLowerCase \a)
11:59lazybot⇒ true
12:00tmciver&(Character/isLowerCase \A)
12:00lazybot⇒ false
12:00_KY_Oh I see
12:00_KY_Thanks=)
12:00tmcivernp
12:10charles_rCan someone explain to me what's going on with 'recur'?
12:11tmcivercharles_r: maybe. got some code to refheap?
12:16jimi_hendrixso it seems my typing of stuff in emacs is really slow (it seems to pause to show prototypes or whatever). can i speed this up somehow?
12:23mfexha jimi_hendrix' dexterity too much for emacs, story check out :)
12:24jimi_hendrixi am not even typing that fast!
12:26umrenwhat is current state of clojure on android, can i make full native applications with clojure and have same load spead as java?
12:26mkumren: clojure compiles into bytecode, just like java
12:27jimi_hendrixumren, last i checked, the non-java jvm languages were slower on android because the dalvik jvm is optimized for java's style. this could have changed though
12:27umrenthis is what i fear
12:28mkumren: this is almost never a problem unless you make a prototype and find that it dies due to performance
12:28jimi_hendrixumren, it doesnt matter much though, unless you are making a game or a similarly resource intensive app
12:28umrenyep, i would like to make a game
12:29hcumberdaleHi ;)
12:29mkumren: most of clojure itself is written in java - it uses .java files and classes
12:29mkhcumberdale: hey and welcome :)
12:29umrenyes, this is what theory is about
12:30mkumren: the speed might be different in expected areas; for example, clojure uses fast immutable lists, which are slower than mutable lists, but much more bug-free
12:30jimi_hendrixbut has anyone experienced a similar issue with emacs and slime?
12:32umrenmk: http://goo.gl/BXVQ2
12:33umreni don't think he lie
12:33mkumren: you can just post the full url :)
12:33umrennah, it's too big
12:35mkhttp://www.deepbluelambda.org/programming/clojure/creating-android-applications-with-clojure
12:35sattvikumren: There is still a bit of a load time issue with Clojure, but appplying a few tricks can make things practical.
12:36sattvikFor example, Clojure 1.4's metadata elision can reduce load time slightly and make a big difference in heap use.
12:36sattvikOn a newer phone, the load time is down to 2-3 seconds.
12:37mkumren: load time is one of the things that you would give up in order to use a still-new higher-level language like clojure
12:37sattvikThe current best practice is to use a Java activity to throw up a splash screen while Clojure bootstraps itself.
12:38sattvikHowever, once you experience REPL-driven Android development, everything else just seems backwards.
12:39mkumren: I believe that sattvik is the author of that post you linked
12:39sattvikThings are generally getting better, though.
12:39sattvikYes, I am.
12:40umrenwell, i like android, but i don't like java, clojure seems good and easy
12:40zakwilson_I was just wondering about the current suitability of Clojure for Android.
12:42mkumren: which language are you coming from?
12:43umrenmk: php/javascript
12:43zakwilsonIt seems like a serious misfeature that you can't run code on Android that generates new classes.
12:44sattvikzakwilson: It's something that they have left open for future development. For now, there are workarounds.
12:44zakwilsonI figured it was security/verifiability related.
12:45mkumren: if you've used jquery, clojure leans in that direction
12:45sattvikNo, you can dynamically load new classes. It's supported by the platform, it's just a little on the slow side.
12:46zakwilsonIt seems like Android might work better if they had chosen something lighter than Java as the fundamental basis for their platform. On the other hand, it might not have gotten the popularity.
12:47umrenthey targeted java devs, which are really big community, and dalvik was designed with java in mind
12:54mkumren: this is similar to what clojure has done
13:29gozalaHi folks
13:29Mimisbrunnrhello
13:29gozalaI'm trying to find some examples how to write tests to cljs lib
13:29gozalaanyone has any good pointers ?
13:30RickInGAlein-cljsbuild has a sample project with tests built in, that might be a good place to look
13:30gozalaRickInGA: ahh stupid me, thanks!
13:31RickInGAgozala: it has 2 sample projects, simple and advanced. the tests are in the advanced. they use phantom.js to run the tests
13:33gozalaRickInGA: could you also give a link to your tests ?
13:33gozalaI'd like to take a look
13:34RickInGAI have not done any tests in cljs, just I am still new to cljs, but the samples I was talking about are at: https://github.com/emezeske/lein-cljsbuild/tree/master/example-projects/advanced
13:35gozalaRickInGA: yeah I was looking there
13:35gozalaI'm still not sure how to write async tests though
13:35gozalathat don't finish execution in the same turn of event loop
13:43_KY_What's the difference between {} and []?
13:43_KY_What's the difference between {} and [] and #{}?
13:43dnolenyoklov: was the mem issue resolved for you?
13:44yoklovdnolen: yes, it was!
13:44dnolen_KY_: hashmap, vector, and set - different data structures.
13:44dnolenyoklov: excellent!
13:44mk_KY_: http://clojure.org/cheatsheet
13:44_KY_I see....
13:44_KY_What memory issue?
13:44yoklovdnolen: yes, its been running smoothly all day and was doing great last night too
13:44jimi_hendrixwhat is the clojure way of doing a left fold?
13:44mk_KY_: a data structure is a way to represent a value
13:44RickInGAdnolen: did you see gozala's questions about testing in cljs?
13:44dnolenyoklov: that's great to hear. you were right all along :)
13:45dnolenRickInGA: I did, but I haven't done much testing outside the CLJS compiler.
13:45_KY_I have a memory problem running NetBeans with Enclojure =(
13:50gfredericksI'm curious about the reasoning behind CLJS-113
13:53dnolengfredericks: then Clojure data can be a JSON superset
13:53gfredericksI did not expect that as a goal
13:54gfredericksdnolen: numerics is still undealt with, right? I'm about to create a JIRA issue. Seems I finally have some free time.
13:56dnolengfredericks: a JIRA issue for what?
13:56gfredericksbuilding numeric types
13:56dnolengfredericks: do you mean Ratios, BigInts stuff like that?
13:57gfredericksI talked to Stu H. and I _think_ that's how he recommended to go about it but now my memory seems hazy
13:57gfredericksyes that sort
13:58dnolengfredericks: it's still not clear to me how that could work without slowing down arithmetic elsewhere.
13:58gfredericksdnolen: I fiddled around with the double dispatch after talking to you about it a month ago and ended up with a question, but will have to collect my thoughts before I remember what it was
13:58gfredericksdnolen: right, I imagine it would either be a separate ns with separate arithmetic protocols, or a compiler option
13:58gfredericksI didn't expect full integration
14:00dnolengfredericks: before a JIRA ticket, something like that probably needs a plan.
14:00jonasendnolen: Has anyone used the clojurescript analyzer for code walking? I'm finding several bugs in the :children vectors. Maybe I'm missing something.
14:01dnolenjonasen: I think ibdknox has, I saw your ticket but I haven't looked closely.
14:02jonasendnolen: there are more I think.
14:02_KY_How can I read a seq 3 elements at a time, like [x y z]?
14:02jonasen:children is missing for :fn
14:02jonasenand :dot puts the environment in there.
14:04josteinkIm reading a file (via java.io readers) and I want to itereate over each line, and for each line evaluate a specific condition
14:04josteinkif that condition is true, I want to do something in to "yield return" in C#
14:04josteinkbasically, build up a iterable collection of some sort to process later
14:04dnolenjonasen: :children for fn is inside :methods
14:04josteinkwhat would be the idiomatic/clean way of doing that?
14:07gfredericksdnolen: is there a more appropriate place for developing a plan?
14:07dnolengfredericks: Confluence
14:07samaaronis there a safe way of accessing a protected field on an arbitrary java object where no getFoo() method exists
14:08gfredericksI bet that's what stu said and I just revised history
14:08jonasendnolen: yes, but shouldn't it be exposed to :fn?
14:08dnolenjonasen: I'm wary to mess w/ the analyzer - it would probably best to see a detailed description of what exactly could be made more uniform.
14:09RickInGAsamaaron can you inherit from the class? protected is available to children, I believe
14:09jonasendnolen: np. I know how to work around it :)
14:10samaaronRickInGA: so I have a proxy object - I'm not sure how you can inherit in this case. Perhaps there's a way of writing a proxy fn which can poke directly in?
14:10jonasenbut I might open tickets as I find (what I think is) bugs.
14:10dnolenjonasen: I understand that uniformity is beneficial for a code walker - but if we're going to work on the analyzer it would be best to get *one* ticket.
14:11jonasendnolen: ok
14:12dnolenjonasen: so say keep your notes and create an improve analyzer confluence page so others can follow along.
14:12RickInGAI need to stop answering questions… followups are almost always over my head :)
14:13samaaronI'm totally out of my depth too
14:14RickInGAsamaaron: checking chapter 9 of Clojure Programming right now… got to proxys….
14:14gfredericksdoes confluence require special privileges to add a new page?
14:14RickInGAit says that proxy can extend an existign class...
14:15samaaronyep, so I'm overriding class fns with my proxy
14:15samaaronI can refer back to original class methods with proxy-super
14:15dnolengfredericks: it might if it does ask for privilges on clojure-dev
14:15samaaroni wonder how you can refer to a specific field
14:16gfredericksdnolen: okay; I simply can't figure out how to add one, so that seems a reasonable explanation
14:16dnolengfredericks: yes if you have permissions you should be able create pages.
14:17gfrederickswell I just created my account 10 minutes ago so there's no reason for me to have permissions if they aren't given by default
14:19gfredericksfirst to apply for clojure dev membership
14:19RickInGAsamaaron: found this on clojure.org/java_interop Method fns are closures and can capture the environment in which proxy is called. Each method fn takes an additional implicit first arg, which is bound to this. Note that while method fns can be provided to override protected methods, they have no other access to protected members, nor to super, as these capabilities cannot be proxied.
14:20samaaronRickInGA: yeah I just read this
14:21samaarondoesn't look hopeful i guess
14:21jimi_hendrixwhat is the clojure version of a left fold? i need to retain information from the previous item in the iteration when examining the next one
14:21jonasenhttps://refheap.com/paste/2290
14:22jonasendnolen: ^ my workaround. Which I think does the right thing
14:22TimMcjimi_hendrix: reduce
14:25jimi_hendrixTimMc, thanks
14:48jayunit100good mornin
14:52jayunit100 whats the best way to "extend" a namespace in a new file, while retaining access to private methods etc ...?
14:55RaynesNot trying to do that at all is usually the best option.
14:56gfredericksI don't know if there's any idiomatic way to do it, due to what raynes said, but you can use (in-ns ...) at the top level
14:56gfredericksbut please only do this if you're trying to upset Raynes
14:56RaynesIndeed.
14:57tmciverI just tried to use lein's checkouts feature and it looks like the external project's lib directory is not on the classpath by default. Seems like it should be. Any way around this?
14:58gfrederickstmciver: shouldn't you have all its deps in your lib directory?
14:58gfredericksor are you mucking with its deps as well...
14:59gfredericks(i.e., changing the project's project.clj)
14:59dnolenmmarczyk: you around?
15:00tmcivergfredericks: I shouldn't have to list an external project's deps in my own project.clj, right?
15:00jayunit100oh ok.
15:00jayunit100yup (in-ns) i guess.... is the way to (not) go :)
15:00gfrederickstmciver: no, the indirect dependencies normally end up in your lib directory. using checkouts shouldn't change that, at least if you don't change the external project's dependencies
15:00jayunit100thanks anyways tho :)
15:01gfredericksjayunit100: that might complicate getting those files loaded, which would be part of why people don't do that
15:02dnolenk CLJS compiler now warns on fn invokes w/ incorrect # of args
15:03angermanI have a bunch of image urls. how could I simply display? Should I go with seesaw or clarity?
15:03tmciverI expected the transitive dependencies to be made available to the main project either by including the external project's lib dir on the classpath or by lein obtaining the needed deps by reading the ext project's project file.
15:04tmciverIt doesn't look like either happens which I guess means I must list those deps in the main project's project file...yuk!
15:06tmciverWell, there's the :checkout-deps-shares that I could use. I still feel that the external project's lib dir should be put on the classpath by default.
15:11gfrederickstmciver: so...you are changing the dependencies then?
15:13mmarczykdnolen: hi
15:13tmcivergfredericks: not at all. I have a project that depends on another project that I've simlinked to from the checkouts dir.
15:14gfrederickstmciver: so it sounds like you're claiming that the checkouts feature doesn't work as advertised; I've never had to include transitive deps, just like I don't have to when not using checkouts
15:15tmcivergfredericks: but 'lein classpath' does not show the external project's lib dir. Shouldn't it?
15:15tmcivergfredericks: I shouldn't have to list transitive deps in the main project's project file.
15:16tmcivergfredericks: I'm probably missing something.
15:18gfrederickstmciver: no I don't believe it should have the other lib directory. `leid deps` should put all transitive deps into your lib directory just like it normally does. Is it not?
15:18gfrederickss/leid/lein/
15:19tmcivergfredericks: no, it doesn't seem to.
15:19tmciverand I can't get the :checkout-deps-shares to work. :'(
15:19gfrederickstmciver: the project in your checkouts directory is also listed in your project.clj, right?
15:19gfredericksas a direct dependency?
15:20tmcivergfredericks: well, no . . .
15:20gfredericksoh that's it then
15:20gfrederickssorry I should have mentioned that first
15:21tmcivergfredericks: I guess I assumed the checkouts magic would make that unnecessary. Now to figure out the right dependency vector... Thanks.
15:21gfredericksyessir
15:21gfredericks(I think I made that mistake at first too)
15:21gfredericks(or rather made that totally reasonable assumption)
15:22tmcivergfredericks: ha, thanks. That makes me feel a little better. :)
15:22gfredericksthe detail is in the last sentence of the Q/A that mentions checkouts in the README
15:23tmciverYup. Makes sense now.
15:23tmciverI did read that, I just don't listen.
15:50tmcivergfredericks: I still can't get this to work. I put [externalprojectname "1.0-SNAPSHOT"] under :dependencies in my project.clj, but lein is still trying to fetch it externally. What else am I missing?
15:52tmciverexternalprojectname and "1.0-SNAPSHOT" are what are found in the external project's project.clj.
15:52abedrahas anyone hooked friend up inside of a noir application yet?
15:52tmciverI'm probably screwing up that dep vector. I usually do screw it up if I'm unable to copy it from clojars.
15:54jayunit100seems like using qouted lists in "require" never works...
15:54jayunit100(require '(clj-json [core :as json])) failed
15:54jayunit100(require [clj-json [core :as json]] ) succeeds
15:55mdeboardYeah that's the syntax
15:55jayunit100why no qouted list ?
15:55mdeboardhell I dunno
15:57amalloylists are for prefixes
15:57amalloyoh, you're trying to use them that way. so your issue is that you're trying to quote at all, in the ns form?
15:58jayunit100well.. i only qouted one
15:58jayunit100Im trying to qoute the "require" package statement,,, but i always get weird errors
15:59jayunit100I guess Im wondering why one works and the other fails, just curious.
15:59laurusDoes anyone know how one would convert the Python statement b.sum(axis=0) to Clojure-py?
16:01ibdknoxBlog post on the realities of Light Table: http://www.chris-granger.com/2012/04/22/on-concepts-and-realities/
16:02ibdknoxif you believe it merits it, please vote it up from the HN new page: http://news.ycombinator.com/newest
16:02laurusHm, interesting. The correct conversion seems to be: (kwapply (.-sum b) {"axis" 0})
16:03mmarczykdnolen: those arity warnings are great! just prepared a patch for three missing arg cases in core (in PHM, PST and PV)
16:05dnolenmmarczyk: cool, that's what I was pinging you about :) thx
16:06mmarczykdnolen: http://dev.clojure.org/jira/browse/CLJS-196 :-)
16:11angermanwasn't there "indexed" ?
16:12hcumberdaleDoes anyone know how to format an url "pretty"
16:12mdeboardWhat does that mean
16:12mdeboard@ hcumberdale
16:12hcumberdale(defn urlfriend [unfriendly] (s/replace (s/trim (s/lower-case unfriendly)) #"[^A-Za-z0-9_]+" "-"))
16:12hcumberdalethat's what I am using now
16:12hcumberdale"I am a blogpost about ... $" >> "i-am-a-blogpost-about-"
16:13angermanibdknox: did that really need a blog response? That post on concepts vs realities was completely off to me; and as someone on HN already said: it was comparing apples to oranges)
16:13ibdknoxangerman: it was for that
16:13ibdknoxwasn't*
16:13hcumberdaleIt does not nice things like "replace $ with "usd", € with "eur" and so on
16:13ibdknoxand I was writing this before that post existed
16:14ibdknoxangerman: he brings up some valid points and he's not the only one who has been wondering about some of these things.
16:14angermanibdknox: alright. Sorry for commenting on the title already. Will go and read it.
16:14ibdknoxangerman: I actually didn't realize the title collided with his, whoops
16:17mdeboardhcumberdale: Why replace those characters? They're valid URL characters
16:17laurusIs there any way to make clojure-py "print" something automatically in the repl, like the standard Clojure repl does?
16:17mdeboardhcumberdale: That's called slugifying a URL btw
16:19mdeboardlaurus: What environment are you using it in?
16:20laurusmdeboard, just CPython.
16:20ibdknoxtechnomancy: I think to me that falls under tryings being encouraged (RE: your tweet)
16:20mdeboardlaurus: I'm not familiar with clojure-py at all so I'm confused by your question. Normal Python automatically prints things in the repl.
16:20ibdknoxs/tryings/trying
16:21angermanWasn't there an `indexed' function that returned the list with indices?
16:21laurusmdeboard, well, what I mean is, that if I run, say, (np/arange 3), it shows #<numpy.ndarray object at 0x1dea060>
16:21laurusBut if I run (println (np/arange 3)) I get [0 1 2] and then nil.
16:21laurusSo somehow it is not "printing" the first one.
16:22mdeboardlaurus: I'd suspect `(np/arange 3)` internally calls the `__repr__` method in Python
16:22laurusmdeboard, ah, that's interesting.
16:22laurusI wonder if there is any way to change the REPL behavior.
16:23mdeboardand forcing evaluation calls the __call__
16:23laurusBecause it's kind of annoying to have to run println on everything...
16:23mdeboardClojure-py is kind of an annoying concept imo
16:23laurusWhy?
16:23clojurebotWhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
16:25mdeboardBecause Python is already an abstraction, so is Clojure, then you combine these two abstractions and make something even leakier and you wind up with weird crap like having to run (println) to call a method
16:25mdeboardlike if you want to use Clojure, use Clojure
16:26FrozenlockHow does one use a function on a map? This was my naive approach: (map #(pr-str %1 %2) {:a 1 :b 2 :c 3})
16:26mdeboardI can understand like Jython or JRuby or whatever to target the JVM and all
16:26laurusmdeboard, but I want SciPy, matplotlib, etc. etc.
16:26hcumberdalemdeboard << slugifying... ahh
16:27amalloyangerman: indexed went out in 1.2, i think. you want something like ##(doc map-indexed)
16:27lazybot⇒ ------------------------- clojure.core/map-indexed ([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... https://refheap.com/paste/2292
16:27angermanamalloy: great, thanks
16:27amalloyFrozenlock: map only passes its function one argument. if you seq over a map, you get a seq of pairs - so to do something with the keys and values in a map, your function needs to accept one argument, a pair
16:28FrozenlockOh!
16:28FrozenlockI was over complicating things :)
16:28FrozenlockThanks!
16:29mdeboardlaurus: Does Clojure-py let you use those libraries in clojure programs?
16:30laurusmdeboard, yeah, that's what's so great about it ;)
16:30mdeboardAhh
16:30laurusFor scientists it seems like Python has become the main "glue" language.
16:30mdeboardWait, what
16:31Frozenlocklaurus: no org-babel?
16:31mdeboardHow would that work
16:31laurusmdeboard, I mean, they seem to use Python to link together a bunch of libraries written in Fortran, C++, etc.
16:32laurusSo Clojure-py may not be so misguided after all :)
16:32mdeboardNo, I mean, how would it work to have Python libraries compiled in a jar
16:32laurusmdeboard, oh, it doesn't let you do that, of course
16:32laurusBy "Clojure" programs I meant Clojure programs compiled to Python bytecode.
16:32laurusI need to go; thank you for the help!
16:32mdeboardOh, then why not just write in Python?
16:33Iceland_jackmdeboard: Personal preference?
16:33laurusmdeboard, because Clojure is a great language
16:35mdeboardI'm just averse to the notion of using only one language
16:35Iceland_jackSorry what does that matter to you?
16:36mdeboardBecause I enjoy having opinions
16:36Iceland_jackhah
16:36ibdknoxI have no opinions. They are icky things ;)
16:37Iceland_jackIndeed, rid yourself off them. They will not be missed
16:40jimi_hendrixquestion: in (defmulti foo class), what does the class bit refer to?
16:41mdeboardIceland_jack: You must be a hoot at parties
16:41Iceland_jackI am
16:42mdeboardPURGE IMPURITY FROM YOUR MIND
16:42Iceland_jackYes?
16:42clojurebotyes is is
16:48amalloymdeboard: have you tried applying your clojure-py objections to clojure-jvm? why would you write clojure to use java libraries? just writing in java works fine
16:49mdeboardamalloy: I was literally just thinking about that
16:49babilenWouldn't it be great if you could use Python and Java libraries at the same time?
16:50zakwilsonibdknox: your resume links to diderot.com, which is dead.
16:50Iceland_jackbabilen: If done correctly, it would be fantastic.
16:50ibdknoxzakwilson: aw
16:50ibdknoxzakwilson: that was a ridiculous project
16:50mdeboardI was reading the clojure py docs, I just don't feel like you gain anything close to what you do moving from Python to Clojure as you do from Java to Clojure
16:51ibdknoxzakwilson: it was an incredibly dumb idea lol, but they sank so much money into it
16:51ibdknoxzakwilson: basically it was like open table, but for wine reservations
16:51zakwilsonI wish somebody would sink money in to something I'm doing.
16:51ibdknoxzakwilson: the guy had the largest single database of wines in the world
16:51ibdknoxzakwilson: it's where I learned how much I hate SQL :)
16:51zakwilsonOr just hire me for a well-funded project.
16:52zakwilsonI hate SQL too!
16:52Iceland_jackImagine there's noSQL...
16:52zakwilsonI like the concept of relational databases, but how we interact with them is on a level comparable to assembly language, except SQL is a *horrible* assembly language.
16:55kastermaIs there a command to restart the slime-repl? Today twice I got bitten by old defs still being around; I'd like an easy way to start with a fresh slate.
16:55raekkasterma: well, you can use remove-ns
16:56raekbut if you have namespaces that depend on the namespace you removed, you have to remove the (manually) as well
16:56raekor you can re-run clojure-jack-in
16:58kastermaAhh, I thought I had tried the re-running of clojure-jack-in, but now it does give me a clean slime.
16:58mdeboardkasterma: I am sure there's a better way than this but what I do is switch to the swank buffer, kill that, then re-run clojure-jack-in
16:59kastermaI had tried re-running clojure-jack-in, but apparently I failed. Now it works. Not the cleanest, but much better than restarting my whole emacs. Thx!
16:59zakwilsonIn other news, who here gets too much email and uses android?
17:00amalloykasterma: technomancy tells me the latest (snapshot?) version of lein-swank clears old defs when you recompile
17:04kastermaamalloy: That would have saved me lots of time today. Added to my todo-list to update.
17:04amalloyor swank-clojure or whatever the relevant library is. you're probably better off looking around on the web than listening to me
17:05kastermaTodo item updated. :-)
17:05mindbender1please how do I prevent gen-class from overriding public final methods of the superclass
17:05umrenin java, they using swing for guis?
17:11mindbender1am I hopeless with the gen-class issue. Please guys I need some pointers
17:15dnolenhmm does the Clojure compiler optimize calls to variadic fns? Does it create the seq at compile time?
17:15muhoomindbender1: don't define them?
17:16amalloydnolen: i don't think it can create the seq at compile-time unless all the arguments are known, right?
17:16dnolenamalloy: yes I'm talking about the common optimizable case (not higher order)
17:17amalloyno, i mean like (defn f ([x] ...) ([x y] ...)) (f a b) - it can't create a seq of a and b at compile time because they only have runtime values
17:17amalloybut i think it doesn't even need to, unless you're using apply
17:17ideally_worldis 4clojure working properly? I submitted an answer for #28 and I'm getting a "You tripped the alarm! def is bad!" message. The only restriction is flatten? :(
17:17amalloyideally_world: you can't def things
17:18ideally_worldreally? been a while since I used it, thought I could defn ? :/
17:18muhooideally_world: use let
17:18amalloyno, just use letfn or whatever
17:18ideally_worldah, cool, thanks
17:18ideally_worldso, then, yes it is working correctly :)
17:18amalloydnolen: that is, (f a b) should compile into f.invoke(a, b), which is about as optimal as they come
17:19mindbender1muhoo: I don't understand clearly what you mean
17:19dnolenamalloy: sorry was not clear I only mean the rest arg case.
17:20amalloyso for something like (defn f [x & xs] ...) (f 1 2 3 4)?
17:20muhoomindbender1: i don't either, because i haven't seen your code. but if gen-class is overriding stuff, usually it's because you've overridden it in your code somewhere
17:20hcumberdalemhhh!
17:20hcumberdale(if number (q/limit number) nil)) << does not work
17:21hcumberdaleI want to add the code (q/limit number) if number is not nil
17:21mindbender1muhoo: the gen-class doc says that it overrides all public methods of the super class but I think it forgot to take public final methods into consideration
17:21muhooit overrides the ones you define, IIRC
17:23mindbender1muhoo: I didn't define any of the super class methods I only specified that it extends the super class then I compiled the ns and then tried instantiating the generated class and the jvm throws an error that a public final method has been overridden
17:24muhoodid it say which one?
17:24mindbender1when I looked at the generated class the jd-gui I noticed all methods of the super class has been overridden
17:24mindbender1*with jd-gui
17:25mindbender1yes it did
17:25muhoothe constructor, perhaps?
17:26mindbender1you mean I shouldn't specify a constructor signature?
17:27muhooi dunno. i haven't seen any problems like that, but i've been kind of cheating and using this instead of gen-class: https://github.com/llasram/shady
17:28mindbender1I'm sure if you can try extending a super class with a public final method you can reproduce the same errors
17:28muhoopost a simple breaking example on refheap.com maybe?
17:28true_droidhey guys! does clojure scan the entire source code for each function definition expanding all macros that it finds?
17:30mindbender1muhoo: I will try doing that in the mean time thanks for the link I want to definitely try that one out and see how it goes for the same situation
17:33mindbender1muhoo: do I use the same compile fn to generate the classes from shady as there no such instruction on the readme
17:34true_droidI'm trying to figure out this behavior https://refheap.com/paste/2294
17:38dgrnbrgI just synthesized my first simulatable module in piplin, a Clojure HDL, to Verilog: http://bit.ly/JZK1GO
17:38dgrnbrgSorry, full link: http://blog.dgrnbrg.com/post/21600152008/hooray-first-synthesized-code-result-with-piplin
17:38dgrnbrgI'm very excited :)
17:39amalloymacros don't have a value, true_droid
17:39amalloythough, bonus points for using a lambda as your shell prompt
17:41true_droidamalloy: yeah, I see that :) but why does the compiler generate the error and not runtime?
17:42true_droiddoes this mean that the compiler is eager enough to look into the `let` form and evaluate its args?
17:42amalloybecause...it's a compiled language, and you tried to refer to a symbol it can't find a value for?
17:43true_droidamalloy: hm, I see; so this behavior might be different in other Lisps, right?
17:43amalloyit absolutely does not evaluate the args of the let form, but it has to compile code for computing their values
17:43amalloy*shrug*
17:43amalloyanything might be different
17:48true_droidamalloy: thanks
17:48dnolenamalloy: yeah I'm thinking about (f 1 2 (array 3 4 ...))
17:49dnolenand direct invocation to the rest case, no going through JS arguments object of course.
17:50amalloyin jvm-clojure, at least, i think (f 1 2 3 4) compiles to something like f.invoke(1, 2, new ArraySeq(new Object[] {3, 4}))
17:50amalloybut now it sounds like you're talking about cljs
17:50dnolenamalloy: yes I was wondering how it was done in CLJ - that was the approach I'm thinking about for CLJS
17:57amalloydnolen: just had a quick peek at some .class files - it looks like (f 1 2 3 4) compiles to f.invoke(1,2,3,4). c.l.RestFn implements that by calling doInvoke (which is your function's impl) by wrapping the remaining args in an ArraySeq
18:04jimi_hendrixdoes clojure not have tuples, or am i insane?
18:04amalloyit doesn't have/need tuples. just use vectors or whatever
18:04amalloydnolen: i think that layer of indirection is necessary for dynamism in clojure (what if f is recompiled to take a different number of positional args), but you could do better in a precompiled language like cljs
18:04jimi_hendrixok
18:06dnolenamalloy: yeah this would be an optimization for advanced compilation or :static-fns true
18:11mmarczykanybody interested in running some jsPerf tests for CLJS? (trying to figure out just how fast small ObjMaps are for access) see links on the ticket: http://dev.clojure.org/jira/browse/CLJS-190
18:14mmarczykah, wait
18:14mmarczykshould have included aget on object, I guess
18:15mmarczykoh bother.
18:15mmarczykI'll edit.
18:16mmarczykoh no, I will not -- forgot to wrap aget in prep code -- in the next batch then
18:17dnolenmmarczyk: looks about right
18:18mmarczykdnolen: yeah
18:18mmarczykdnolen: I think the current reprecating patch doesn't use transients when doing the conversion though
18:19mmarczykdnolen: so I'll make a new one
18:20dnolenmmarczyk: I wonder what a good threshold is?
18:22mmarczykdnolen: yeah... not at all clear to me
18:22mmarczykdnolen: the 16 is totally random (slightly more than array map threshold in clj)
18:23dnolenmmarczyk: try 64?
18:23mmarczykdnolen: I'm thinking to do a jsPerf tests for conversions from various sizes, will try 8, 6, 32, 64, 128
18:24mmarczykdnolen: constructing an ObjMap by hand, then running the conversion function. we'll see what sort of difference this makes
18:25dnolenmmarczyk: we should pick the size where PHMs overtake, clearly at 500 keys PHMs win based on your earlier tests.
18:25mmarczyk^"I'm thinking about doing a jsPerf test"
18:28mmarczykdnolen: ok, I'll do some lookup tests for larger sizes too
18:30mmarczykhm, must take care of sth else though just now, will post the new tests when I get back w/ the new patch
18:31mmarczykdnolen: btw, I don't know what to make of the "hand-assoc'd" vs. literal thing
18:31mmarczykdnolen: if there were no difference -- fine, but hand-assoc'd >> literal is just weird
18:32mmarczykok, bbl
19:40huangjshmm...my slime repl will drop if I do completion for keywords (i.e. (get :k <--- then press tab to complete), in *swank* it says "unreadable message: (:emacs-rex (swank:completions-for-keyword ":k" ...
19:40huangjsanyone has the same trouble?
20:09hcumberdalehow can I get the context (url) of my web application in clojure?
20:09hcumberdalehttp://www.xyz.ch/tickets/123 << I mean http://www.xyz.ch
20:18lynaghkmmarczyk: your suggestion yesterday about using metadata to change how an atom prints works fine in Clojure, but in cljs printing is implemented as a protocol rather than multimethod so the same trick doesn't work
20:19lynaghkHave any other ideas?
20:33jimi_hendrixhas anyone had an issue with slime/swank where connecting to 'lein swank' via slime-connect does not spawn a repl
20:36ibdknoxAnyone know who has the power on HN to change the title of someone else's post?
20:40charles_rI've noticed that every so often, my repl just hangs. I'm using slime in emacs 22. Has anyone solved this?
21:03brehautcharles_r: are you driving a mac?
21:13mdeboardcemerick: Hey do I get a check for $1 if I spot an error in your book
21:14mdeboard(re: SICP)
21:14cemerickmdeboard: If I open myself up to that, I may be signing my AOT bankruptcy papers. :-)
21:14mdeboardPage 63 of my edition has an error right at the top when describing the reduce function
21:15mdeboard&(reduce max [0 -3 10 48])
21:15lazybot⇒ 48
21:15mdeboardbut the book says 10 :(
21:15mdeboardlol
21:15mdeboard@ bankruptcy
21:16cemerickwell, now I just hate myself :-|
21:16cemerickHopefully that's the only blatantly stupid error in the thing.
21:16cemerickmdeboard: thanks for pointing it out though :-)
21:16mdeboardFeh this is by far the best Clojure book
21:16mdeboardI've read Joy of and Practical Clojure
21:17cemerickmdeboard: you can open an issue on the github repo if you like
21:17cemerickThere's an errata tag.
21:17mdeboardThe "down the rabbit hole" and chapter 1 are both amazing intros that weren't matched in the other two
21:17cemerickThanks :-)
21:17cemerickmdeboard: be sure to leave your reviews when you're ready
21:17mdeboardWhere's the repo?
21:17cemerickhttps://github.com/clojurebook/ClojureProgramming
21:18mdeboardDo I need to tag it with errata somehow?
21:20cemerickmdeboard: you don't need to, I can do it. There should be an errata label on the 'new issue' screen for the repo.
21:20mdeboardOk then
21:21mdeboardhttps://github.com/clojurebook/ClojureProgramming/issues/9
21:22cemerickthanks :-)
21:22mdeboardnp, thanks for the awesome book.
21:24cemerickthanks for the feedback, keep it coming
21:24cemericks/feedback/bug reports ;-)
21:41clojure_newbI think the following is a perfectlyr easoanble request. If not, please explain to me why. I want a clojure IDE (with repl, documentation, browsing of the source tree, and listing of all the def's and defn's) -- written and scriptable in clojure. Why does this not exist?
21:42hiredmanI want a flying car
21:42hiredmanalso peace on earth, I guess
21:42hiredmanbut war on mars
21:43seancorfieldclojure_newb: clooj probably comes closest - that's written in clojure
21:43clojure_newbhiredman: I think my requests are slightly less ambitious
21:43seancorfieldhttps://github.com/arthuredelstein/clooj
21:44clojure_newbI've looked at clooj
21:44clojure_newbI would have to do work myself, i.e. hack in the scriptability part
21:44seancorfieldwhy not contribute to that open source project to make it better? i'm sure arthur would appreciate the help
21:44brehautthe simple answer is "because nobody has written one"
21:45brehautthe more complex answer is "it takes a lot of effort to write all that"
21:45clojure_newbbecause I would slow down the project
21:45clojure_newb<-- not professionaly trained, mainly a hobbyist
21:46seancorfieldfork it on github, add scriptability, send arthur a pull request
21:48seancorfieldmost clojurians are probably not writing clojure for their paid day job btw
21:53TimMcOK, how do I initialize a DB schema in Korma?
21:54TimMcI've tried (exec-raw db (slurp "schema.sql")) but the SQLite file remains empty.
21:57mdeboardhiredman: lol @ war on mars
21:58mdeboardTimMc: Isn't that what defdb does
21:58mdeboardoh, right.
22:03TimMcI've looked at Lobos, but the only example I've seen is insane: https://github.com/vijaykiran/clog/blob/master/src/lobos/migrations.clj
22:05kab3wmwith-open should negate the need to (flush) or (.close s) right?
22:06TimMcAnd Ragtime doesn't seem to provide a way to initialize.
22:06TimMckab3wm: Right.
22:09jayunit100guys i just saw this question on stackoverflow its a really good one
22:09jayunit100http://stackoverflow.com/questions/10271653/is-there-a-clean-way-to-add-functions-to-a-dynamically-created-namespace
22:09jayunit100he poses the question of how to dynamically add functions to a namespace - and has a macro solution which doesnt seem to work.
22:12xeqiTimMc: korma.incubator has some schema stuff in it
22:12TimMcxeqi: Thanks, I'll check that out.
22:12TimMcIt just feels like I must be missing something obvious.
22:14TimMcHmm, that doesn't allow loading of raw SQL, which is what I assumed.
22:15TimMcWell, anything that works...
22:15_KY_I find it rather strange that (nil? ()) is false, why is that?
22:16charles_ronly 'nil and 'false are false . . . just like Ruby if I recall
22:16metellus() is a list with no elements
22:16felideonshouldn't it be like lisp?
22:16kab3wmTimMc: I've used Korma, but didn't require initalizing a DB. Looking at the API, exec-raw seems like a good approach. Seems like if you could get a simple 'SELECT * from whatevs' with exec-raw working you could do anything.
22:17mdeboard&(nil? '())
22:17lazybot⇒ false
22:18mdeboardSomeone had a good table of truthy and falsey values that I cannot find atm
22:18mdeboardmight have been TimMc?
22:18ivanis repl-utils available anywhere but clojure.contrib?
22:18mdeboardivan: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
22:18mdeboardsays uhm
22:18felideon&(nil? ())
22:18lazybot⇒ false
22:18mdeboardmigrated to clojure.repl and clojure.java.javadoc
22:19mdeboard&(nil? 0)
22:19lazybot⇒ false
22:19xeqiTimMc: ah, you want to just send sql, it looks like exec-raw uses jdbc/do-query which doesn't handle that
22:19ivanmdeboard: thanks! I should've looked there
22:19xeqiI can try and paste something with jdbc in a moment
22:20TimMcxeqi: Oh, huh.
22:20TimMcWell, if I use JDBC, I'll use do-commands
22:20TimMcwith splitting on semicolons -.-
22:20xeqibasically what I would have written
22:21TimMcI've got something like that lying around.
22:21TimMcI'm just having trouble believing that's not already in JDBC.
22:22xeqitheres lots of things that aren't built yet
22:22xeqilike nested transaction rollback w/ savepoints
22:22ivanI'm making clj-swingrepl better, anyone have feature requests?
22:23_KY_The word nil means something empty, and () is empty...
22:23_KY_What is nil equal to? only false? then what is the difference between nil and false?
22:23felideon_KY_: I wonder if this it's why When you ask a sequence on its last element for the rest it returns another logical sequence. You can only tell if that sequence is empty by calling seq on it in turn. This enables sequences and the sequence protocol to be lazy.
22:24hiredman~google "define nil"
22:24clojurebotFirst, out of 1060 results is:
22:24clojurebotNil | Define Nil at Dictionary.com
22:24clojurebothttp://dictionary.reference.com/browse/nil
22:24xeqi&(= nil false)
22:24lazybot⇒ false
22:24jappinenso if I do a $lein swank, then a M-x slime-connect I can successfully connect to my swank server and execute code from buffers... in addition how do I open up a repl to that swank server... I don't see a repl buffer like I do if I M-x clojure-jack-in?
22:24felideonthis is*
22:24_KY_,(rest ())
22:24clojurebot()
22:25brehauttrying to pin down the exact meaning of nil seems like a difficult task
22:25_KY_Yes, nil means "nothing"
22:25brehautwhat kind of nothing
22:25brehautin clojure its a value, but it also doubles as null in java which is a reference nothing
22:25_KY_It seems to have no use if it's not equal to (), from what I see'
22:26_KY_You mean null pointer?
22:26lynaghkmmarczyk: for reference, I used (extend-protocol IPrintable...) to get the cljs serialization working.
22:26brehautwell, the null reference; its not a bare pointer in java
22:27felideon"Keywords are not Symbols" ... so what are keywords if I may ask?
22:27_KY_What would be an example that returns nil?
22:27brehaut,({:a 1} :b)
22:27clojurebotnil
22:27_KY_I see... thanks for explaining...
22:27brehauthuge amounts of the clojure library return nil for things
22:29seancorfield,((juxt next rest) ())
22:29clojurebot[nil ()]
22:30seancorfield,(map seq [nil ()])
22:30clojurebot(nil nil)
22:30seancorfield,(map empty? [nil ()])
22:30clojurebot(true true)
22:31seancorfield,(map type [:a-keyword 'a-symbol])
22:31clojurebot(clojure.lang.Keyword clojure.lang.Symbol)
22:32seancorfield,(identical? :a-keyword :a-keyword)
22:32clojurebottrue
22:33seancorfield,(identical? 'a-symbol 'a-symbol)
22:33clojurebotfalse
22:33seancorfieldfelideon: does that help?
22:33felideonhmm
22:34seancorfieldkeywords evaluate to themselves - a unique instance - symbols evaluate to whatever they are bound to
22:34seancorfield,(let [a-symbol "my-value"] a-symbol)
22:34clojurebot"my-value"
22:36felideon,'foo
22:36clojurebotfoo
22:37seancorfield,(quote foo)
22:37clojurebotfoo
22:37felideon,(let [foo 'bar] foo)
22:37clojurebotbar
22:37seancorfield,(macroexpand 'foo)
22:37clojurebotfoo
22:37seancorfieldhmm, that didn't do what i expected :)
22:38seancorfield,(let [a :one, b a, a :two, c a] (str "b is " b " and c is " c))
22:38clojurebot"b is :one and c is :two"
22:38seancorfieldin that expression the symbol a is bound to :one, then b is bound to a's value, then a is (re-)bound to :two, then c is bound to a's (new) value
22:48ivanhow do I do something like (binding (get-bindings) blah)?
22:48ivanthat causes Caused by: java.lang.IllegalArgumentException: binding requires a vector for its binding in ...
22:49felideon,(nil? [])
22:49clojurebotfalse
22:50metajackHow do other people do webapp configuration in clojure? Do you use the servlet JNDI stuff? How do you do the config when you are testing at the repl? So far what I'm doing feels a little clumsy.
22:53brehautmetajack: my clojure web stuff is pretty simple; im just running an embeded jetty and using couchdb via clutch. i do all my configuration via a binding based middleware around my ring handler
22:54metajackbrehaut: I don't suppose there is a sample on github I could look at?
22:55wkmanireGood evening.
22:55wkmanire:)
22:55brehautmetajack: sorry, windows VM is grinding my machine to a crawl. one moment
22:55metajackright now I am reading things out of JNDI for production and have that wrapped in an (if …) for when the JDNI lookup fails at the repl. I suppose one alternative is to somehow bundle a .config in the distributed jar or read from /etc
22:56brehautmetajack: http://brehaut.net/blog/2012/configuration_middleware is the closest i have to public examples
22:58beffbernardStyle question… do I do something like (for [option options] [:option option]) or (mapcat #(vector (option %)) options) given (defn option [value] [:option value])
22:58xeqimetajack: clojars reads a resource file, and using lein2 profiles can specify different resource-paths
22:59metajackxeqi, brehaut: thanks for these examples!
23:01wkmanirebrehaut: The ring link on your site is broken.
23:01wkmanire404
23:01brehauthuh, so it is
23:02brehautwkmanire: try http://brehaut.net/blog/2011/ring_introduction
23:02metajackxeqi: so it looks like clojars puts some production config.clj into ./resources. does it get added to the war or is clojars deployed some other way?
23:02wkmanirebrehaut: Thanks.
23:02wkmanireThat is one badass link transition by the way.
23:03brehaut?
23:03brehautoh, the mouse over?
23:03wkmanireWhen you mouse over hyperlinks they do a transformation.
23:03wkmanireVery cool
23:03xeqiit's deployed just using an uberjar that starts jetty
23:03brehautthanks :)
23:03xeqibut I don't see why it wouldn't work with the config in a war
23:04muhoois ther some way to grab ahold of the handler in noir from within the repl?
23:04muhooi see gen-handler to create a new one. i don't want that. i want somehow to grab ahold of the handler that was gen'ed and handed to jetty
23:04brehautwkmanire: fixed; it'll be live next time the nginx cache is refreshed
23:05metajackxeqi: i guess i was trying to keep the config outside of the war. i probably need to see what tomcat does for classpath stuff
23:06FrozenlockIs there a function to sort "smartly"? For example, I would like if "10" was coming after "2" when sorting strings.
23:06Frozenlock,(sort ["x1" "x10" "x2"])
23:06clojurebot("x1" "x10" "x2")
23:08rlanderI just create my first (very) small utility library in clojure. Could anybody take a look at the code, please? I'm not sure if it's idiomatic...=)
23:09rlanderhttp://hastebin.com/xexeqicufo.lisp
23:10tmciverrlander: the body of the trim-to function could simply be (take trim-value string-to-trim)
23:11salisburyis there an easy manner in which to change a byte from BE to LE?
23:11tmciveractually (apply str (take trim-value string-to-trim))
23:11technomancyis it crazy that I'm a lot more interested in Light Table as a browser than as an editor?
23:12rlandertmciver: Thanks for looking, I'll try that and run the tests!
23:12tmcivertechnomancy: lein question: if I use checkouts do I need to include that dep in the project file?
23:12xeqitechnomancy: yes
23:12technomancytmciver: yes, checkouts are supplemental
23:13technomancyxeqi: my first thought when clojurescript was announced was: I wonder if I can use this for extending my browser
23:13tmcivertechnomancy: what if the lib has no public pom, how does lein get it's deps? I see that the checked out project's lib directory is not put on the classpath by default.
23:14technomancytmciver: right; leiningen doesn't work with dependencies that don't have poms
23:15rlandertmciver: Other than that, is it ok? It's my first time touching Java since college =)
23:16tmcivertechnomancy: OK. I tried to use a function in :checkout-deps-shares as I saw in the sample project.clj but I get a NPE somewhere.
23:16technomancytmciver: ooh interesting; I hadn't thought of that
23:16tmcivertechnomancy: I was trying to just add that project's lib dir.
23:17tmciverrlander: well, I don't know anything about that Normalizer thing but it looks pretty good to me.
23:17technomancytmciver: the path of least resistance is definitely to create a project.clj file
23:17tmcivertechnomancy: for what? The checked out project? It has one.
23:18rlandertmciver: thanks!
23:18technomancytmciver: I must be misunderstanding you then; I thought you said the lib has to public pom
23:19technomancy"Philosophers and logicians--including Aristotle--have long discoursed on the properties and attributes of objects. Von Wright, according to [Hughes68,p.184], distinguishes between formal properties, "whose belonging to an object is always either necessary or impossible", and material properties "whose belonging to an object is always contingent"."
23:19technomancy<- from the Egal paper
23:19technomancy"Obviously, material properties--being contingent--cannot contribute to an object's identity, while formal properties--being necessary--are an inherent part of an object's identity."
23:19technomancymakes me think of values vs metadata
23:21technomancythough he talks about material properties being mutable, which isn't true of metadata
23:21technomancythough it is true of text-properties on emacs strings
23:21tmcivertechnomancy: when I say no public POM I mean this lib is not on clojars or maven central so lein's attempts to find its deps will fail. But it does have a project.clj, of course, so I could create a POM but I thought the point of checkouts was to avoid all of that.
23:21ivanhow do I apply a map like {:init set-defaults!} to call like (func :init set-defaults!)?
23:21tmciverI'm sure it's something I'm misunderstanding.
23:22technomancytmciver: the point of checkouts is to offer a more convenient workflow while developing on two projects
23:22technomancyit really doesn't have anything to do with declaring dependencies
23:22technomancyyou need to get things working solely in terms of project.clj first, then you can add the convenience of checkout deps
23:23ivanoh, got it, (flatten (seq
23:23technomancyflatten?
23:23clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
23:23xeqi&(apply (partial apply str) {:a :b})
23:23lazybot⇒ ":a:b"
23:23tmcivertechnomancy: but in order for the main project to access the transitive deps I need to either declare the checked out project in project.clj or have the checked out project's lib dir on the classpath. Am I thinking about this correctly?
23:24technomancytmciver: the lib dir is an implementation detail
23:24tmciver?
23:24technomancyif you're thinking in terms of the lib dir or the classpath directly then you're making an abstraction leak
23:25technomancyyou should be thinking in terms of declaring your dependencies and letting Leiningen worry about finding them
23:26technomancyif you have dependencies that aren't part of a repository, your first order of business should be to get them into a repository
23:26technomancy(this is assuming a proper project that you want to automate rather than just screwing around or experimenting)
23:27kovasbanyone here use c2?
23:27tmcivertechnomancy: as an example my main project does not depend on commons-lang but the checked out project does. Running 'lein deps' on the main project does not pull it down though; running on the checked out project does. But the main project does not seem to have access to commons-lang.
23:29technomancytmciver: is this because the main project doesn't have the other in its :dependencies?
23:29tmcivertechnomancy: yes, and if I put it there, lein complains that it can't find it.
23:30technomancytmciver: ok, then what you need to do is make sure that the checkout project is in a repository that the main project can reach
23:30technomancytmciver: if you only care about making it work on your machine, you can use `lein install`; otherwise you need to do `lein deploy` on a private repository
23:30technomancyeasiest way to do that is with s3-wagon-private
23:30technomancy~repeatability
23:30clojurebotrepeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability
23:30technomancy^ probably want to read that while you're at it
23:31tmcivertechnomancy: Ah! Looking... I think 'lein install' might be what I want.
23:32tmcivertechnomancy: I'd like the checkouts thing to work if I were using a private project (that wasn't in any public repo yet).
23:32technomancysure
23:34Lajjla$(apply str {:a :b})
23:34Lajjla&(apply str {:a :b})
23:34lazybot⇒ "[:a :b]"
23:35LajjlaIntruiging
23:35Lajjla&(apply + {:a :b})
23:35lazybotjava.lang.ClassCastException: Cannot cast clojure.lang.MapEntry to java.lang.Number
23:35yoklovapply probably coerces it to a seq or something
23:36Lajjla&(apply str (seq {:a :b}))
23:36lazybot⇒ "[:a :b]"
23:36Lajjla&(seq {:a :b})
23:36lazybot⇒ ([:a :b])
23:36LajjlaYou gotta explain that one to me
23:36LajjlaOhhhhhhh
23:36tmciver&(seq {:a 1 :b2})
23:36lazybotjava.lang.RuntimeException: Map literal must contain an even number of forms
23:37tmciver&(seq {:a 1 :b 2})
23:37lazybot⇒ ([:a 1] [:b 2])
23:37Lajjla&(str '[a b c d])
23:37lazybot⇒ "[a b c d]"
23:37LajjlaAm I the only one who finds that particularly weird?
23:37Lajjla&(str "I worship his shadow")
23:37lazybot⇒ "I worship his shadow"
23:37metelluswhat's weird about it?
23:37tmciverOh no!
23:38LajjlaClojure, you confuse me.
23:38Lajjlametellus, well, check that
23:38LajjlaWhy would a string called with a vector be that?
23:38Lajjla&(str [\a \b \c \d])
23:38lazybot⇒ "[\\a \\b \\c \\d]"
23:38metellusso you know it's a vector
23:38LajjlaBut surely it should signal an error since it's not a character
23:39Lajjla&(str [\a \b \c \d] [\e \f \g \h)
23:39lazybotjava.lang.RuntimeException: Unmatched delimiter: )
23:39mdeboardWhat
23:39Lajjla&(str [\a \b \c \d] [\e \f \g \h])
23:39lazybot⇒ "[\\a \\b \\c \\d][\\e \\f \\g \\h]"
23:39metellusthat's not what str does
23:39Lajjla&(str \a \b \c)
23:39lazybot⇒ "abc"
23:39mdeboard&(for [s "Hello world"] s)
23:39lazybot⇒ (\H \e \l \l \o \space \w \o \r \l \d)
23:39Lajjlametajack, then what does it?
23:39mdeboardWhat are you confused by, Lajjla?
23:40mdeboardI don't understand your question, "Why would a string called with a vector be that?"
23:40metellusWith one arg x, returns
23:40metellusx.toString()
23:40LajjlaAnd with two/
23:40metellusa concatenation of their .toString(0s
23:40metellus.toString()s
23:41LajjlaSo a character .toString in java returns just a single character string?
23:41metellusyes, what else would it return?
23:41LajjlaTHe external repraesentation of the character apparently if it does that with a vector?
23:41metellusa vector is not a character
23:41LajjlaWhy does it return the external repraesentation in one case but just the sequence of codepoints in another
23:41LajjlaYes
23:42Lajjlaso why does it do something fundamentally different on a character as it does on a vector
23:42metellushow is it fundamentally different?
23:42LajjlaBecause in one case it's the external repraesentation and in antoher is not.
23:42metellusI don't know what you mean by "the external representation"
23:42LajjlaBasically, if this was on an IQ test, as in [a b] is to "[a b]" as \a is to ...
23:43LajjlaYou would answer "\a" and not "a"
23:43Lajjlametellus, what you write down in code to denote that datum
23:43Lajjlathe external repraesentation of a character z is like "\z" in code
23:43mdeboardI think you mean literal representation, not external.
23:43xeqi&(str (Object.))
23:43lazybot⇒ "java.lang.Object@9a6cc8"
23:44Lajjlamdeboard, same thing, different terminology
23:44LajjlaWell
23:44mdeboardNo.
23:44mdeboardIt's not.
23:44Lajjlathat is the part where it's even more confusing, though I can see what it means
23:44tmciverLajjla: I think you're expecting (str [:a :b]) to behave like ##(apply str [:a :b])
23:44lazybot⇒ ":a:b"
23:44LajjlaNot at all
23:45LajjlaI'm saying that if (str \a) returns "a" then that thing should signal an error or return nil, because it doesn make sense.
23:45amalloyi think he just wants pr-str
23:45amalloy&(pr-str \a)
23:45lazybot⇒ "\\a"
23:45LajjlaTo call it on a non character in that sense
23:45LajjlaWell, that is the reverse case
23:45Raynesamalloy: WAZUP
23:45mdeboard&(class \a)
23:45lazybot⇒ java.lang.Character
23:45mdeboard&(class "a")
23:45lazybot⇒ java.lang.String
23:45LajjlaIf (str [1 2 3]) returns that then (str \a) should return "\a"
23:46amalloyhey, Raynes, you made it home! when i didn't see you at all yesterday i thought maybe you died on the way
23:46Raynesamalloy: Bahaha. Didn't I talk to you earlier today? I thought I did.
23:46tmcivertechnomancy: thanks for the help; 'lein install' was what I needed.
23:46mdeboardLajjla: Then how would you propose differentiating a Character instance from a symbol?
23:46yoklovugh, callbacks are awkward in cljs :/
23:46Lajjlatmciver, but surely you agree that [a b c] in code is to "[a b c]" as \a in code is to "\a" ?
23:46amalloyoh, i guess you did. i don't really pay attention
23:47Lajjlamdeboard, what do you mean, a character becomes "\a", a symbol becomes "a-symbol"
23:47muhooand stop calling him shirley.
23:47mdeboardWhat.
23:47metellusLajjla: it doesn't show up as "[a b c]" because that's how it's represented in code, it shows up that way because it's a logical way to display it as a string
23:47mdeboardAre you trolling?
23:47amalloytmciver, muhoo: Lajjla just likes to complain about existing functionality
23:47muhooi noticed that
23:47amalloyoh, and mdeboard
23:47metellussimilarly, the logical way to display a character as a string is to display that character
23:47Lajjlametellus, but surely to display a character as a string as "a" is not useful since (str \a) becomes the same as (str "a")
23:48LajjlaIf you're talking about differentiating
23:48metellusI'm not talking about differentiating
23:48LajjlaWell, define for me, what does str do then exactly?
23:48LajjlaBecause with vectors it seems to display the code you must enter to parse into that datum
23:49metelluscalls .toString() on its arguments
23:49Lajjlaand with strings and characters it does something unrelated
23:49LajjlaWhat is the definition of .toSTring() then?
23:49muhoothere's that shirley again :-)
23:50muhoohttp://www.youtube.com/watch?v=0A5t5_O8hdA
23:50metellusit takes the object and converts it to a string, generally for reading by humans
23:51Lajjlametellus, reading as in, inferring what that object is?
23:51LajjlaAs we already established that there is colission
23:51metellus[a b c] becomes "[a b c]" because that's a handy way to display a list, not because that's how you write the code (although the two are similar)
23:51metellusno, not reading as in inferring what that object is
23:51LajjlaReading for what purpose then?
23:51xeqimore collision ##(str "[a b c]")
23:51lazybot⇒ "[a b c]"
23:51metellusreading as in reading and seeing what it represents
23:52LajjlaQuite, was about to point that out.
23:52LajjlaThat is the same thing in different words.
23:52metellusfor example calling toString on a Date object gives a string of the form dow mon dd hh:mm:ss zzz yyyy
23:52LajjlaBut there is colission, does "[a b c]" repraesent a vector or a string as xeqi pointed out?
23:52metelluswhich does not and should not have anything to do with how the Date looks in code
23:52LajjlaWell, that's another case then I guess.
23:52Lajjlastr seems to do many things.
23:52LajjlaDepending ont he type of its argument
23:53metellusin Java, each class defines its own .toString
23:53metellusso yes
23:53metelluswell, either defines its own or inherits it
23:53LajjlaTrue
23:53xeqiI'm surprised I haven't heard serialization come up yet
23:58felideonwhat's the best way to just pop into a REPL without having a project.clj
23:59amalloylein repl, for whatever recent version of lein
23:59felideonhmm that works