#clojure logs

2011-04-08

00:00livingstoneh, I got enough of what I need, more or less
00:02Rayneslivingston: Opening it up in a text editor usually works for me.
00:03livingstonRaynes: yeah I did I saw enough, I mostly wanted to verify what method signatures were there. then I confirmed it by importing the class into my repl and calling show on it.
00:08mecanyone know how to disable the automatic stack trace on exception in emacs?
00:09livingstonmec: why? (in slime?)
00:09mecbecause 99% of the time just printing the exception to the repl would be fine
00:10livingstonoh you mean you want it to just automatically hit '0' for you?
00:12livingstoni'm sure if there isn't a setting for that, you could probably write some elisp to catch that buffer and just send it a '0' as input.
00:13HavvyMy output is a lazy-seq and (doall) isn't removing the lazyness. :(
00:14HavvyHmm, might be the placement of the (doall)
00:15mecIm sure I saw a setting somewhere that enabled the stack trace, I just cant find it again
00:32Havvy(str (interpose " " ["nick:"
00:32Havvy nick-lower "cmd:" cmd-lower "params:" parameters-lower]
00:32Havvy,(str (interpose " " ["nick:"
00:32clojurebotEOF while reading
00:32Havvy nick-lower "cmd:" cmd-lower "params:" parameters-lower]))
00:33Havvy,(str (interpose " " ["nick:" "cmd:"]))
00:33clojurebot"clojure.lang.LazySeq@73ee01f6"
00:33mec,(apply str (interpose " " ["nick:" "cmd:"]))
00:33clojurebot"nick: cmd:"
00:34HavvyWhy do you apply?
00:35mec,[(str [1 2 3]) (apply str [1 2 3])]
00:35clojurebot["[1 2 3]" "123"]
00:35HavvyOh.
00:35livingstonso if I'm calling some clj from java with something like this: ((IFn)RT.var("clojure.core", "println").deref()).invoke("Hello World");
00:36livingstonbut I want to call my own function in another ns that hasn't been loaded yet, how do I load it... I'm assuming there a function on RT?
00:40HavvySo, (or (= var 1) (= var 2)) and (#{1 2} var) are equivalent?
00:42mecyes
00:43HavvySweet.
00:46mecok so it looks like i need to disable sldb any idea where that setting might be?
00:48livingstonHavvy: if that's all you were doing and those are constants the first is greatly preferred
00:49livingstonfirst you're not created a set, and second, your intensions as a coder are clearer. unless you actually have a set of numbers you're testing against.
00:55dnolenHavvy: livingston: the second version is three times faster.
00:56livingstonhow can that be?
00:58dnolenlivingston: sorry it depends. if the data doesn't match often 2nd version quicker. depending on the number of tests (each a fn call), 2nd version faster.
00:59mecchecking against a set is just a hash table lookup
00:59dnolenin anycase, 2nd version is plenty idiomatic.
01:00livingstonthe second version is hashing too... there's no way. that hash table would have many items I would think. if you're talking find in a linked-list verus a hash-table, usually you have to get up 10's of things before the hashtable wins. I don't know if there is something sneaky under the hood of clj for small sets
01:01mecI cant for the life of me figure out where swank-clojure actually hooks exception handling into sldb
01:02dnolenlivingston: in an or test you have multiple fn calls. a hash look up 1 call.
01:02meci believe small sets may use lists, at least clojure specifically says it changes underlying types sometimes for speed
01:06dnolen,(type #{1 2})
01:06clojurebotclojure.lang.PersistentHashSet
01:06dnolen,(type {1 2})
01:06clojurebotclojure.lang.PersistentArrayMap
01:07dnolen,(type (into {} (map vec (partition 2 (range 32)))))
01:07clojurebotclojure.lang.PersistentHashMap
01:27amalloyi guess livingston is gone by now, but if someone else wanted to look into a compiled java .class file, javap is a good builtin
01:41hiredmanI've been thinking of writing some to take clojure class file and print it out as pseudo clojure code
01:42hiredmanbut javap works well
01:50tomojhostname
01:50tomojoops
01:55bartjI see that the title-case function of c.c.str-utils2 is not implemented
01:55bartjhow do I go about submitting an implementation ?
01:56brehautbartj: well, old contrib is no longer being maintained
01:56bartjoh
01:56brehautbartj: otherwise you need to have signed the contributer agreement and then should post to the dev mailing list
01:57brehautthe maintainer of the package (or someone equally authoritive) will tell you the next step
01:57bartjI think it is Sierra
01:59amalloyisn't str-utils2 basically EOLed anyway?
01:59brehautit seems likely
02:00bartjEOLed ?
02:00brehautend of life
02:00bartjend of life ?
02:00bartjdeprecated ?
02:00amalloyi think book authors should say "use this library, which at some point in the future will surely be deprecated"
02:00bartjok, there are some useful functions in str-utils/str-utils2
02:01bartjwhich seem to be missing in clojure.string
02:01amalloybartj: a lot of those got promoted to clojure.core
02:01amalloyer
02:01amalloyclojure.string
02:02amalloyi like c.c.string, personally, but it's deprecated and that's just tough luck. there are good reasons, like not working well for non-english languages, i'm sure
02:02bartjhmm, ok; so I gather it is not worth the effort in this case
02:02bartjthanks
02:39seancorfield_i rely on c.c.sql so i want to see that promoted to core :)
02:40amalloyseancorfield_: tried clojureql?
02:41seancorfield_yeah, but i haven't really settled into it yet
02:42seancorfield_i think i prefer the c.c.sql approach to be honest
02:42markomananyone recall the site that had a good list of things you should know before running Clojure?
02:43markomanit talked about installing, lein, ides and so forth
02:43markomanshort article / blog post
02:44seancorfield_http://dev.clojure.org/display/doc/Getting+Started ?
02:47markomanit wasnt that. it was more oriented for people who know almost nothing about clojure and what they would expect to face when learning it
02:47seancorfield_amalloy: my concern with clojureql is that it builds a representation of that then needs to be translated to sql (each time)... and i'm actually trying to get away from sql abstractions at the moment :)
02:48seancorfield_markoman: hmm, then i've no idea... but i'd like to read it if someone figures out which page it is :)
02:49seancorfield_i could do with more such references to feed to friends that i want to convert to clojure!
03:05markomanright, i bookmarked too much sites last week and some i didnt, so im messed with all information at the moment myself :)
03:08markomandont you think lein is very easy? just load the script on bin directory, run it and lein repl and there you go?
03:16amalloymarkoman: it sure is!
03:39seancorfield_markoman: oh, i love leiningen... that's my build tool of choice... i wish CCW respected it better :)
03:40markomani have added some custon tasks/targets on lein, but im not sure, if I can get them on IntelliJ Lein panel like the default targets are there visible and usable as single clicks
03:40markomanor double clicks maybe
04:08ejacksonSalwe.
04:12amalloyhey ejackson, fliebel was looking for you, in search of an airplane quote
04:13ejacksonlol. Not surprisingly netjets figured I was a joker. I'm going to try again.
04:13amalloyhahaha
04:13ejacksonthey can smell time rich, money poor over the phone
04:14amalloy$mail fliebel netjets thinks ejackson is a wacko. he's trying again. next time you're looking for him, utilize sexpbot to $mail him instead of wandering away :)
04:14sexpbotMessage saved.
04:15ejackson,(conj long-list-of-people-who-thingk-ejackson-is-a-wacko netjets)
04:15clojurebotjava.lang.Exception: Unable to resolve symbol: long-list-of-people-who-thingk-ejackson-is-a-wacko in this context
04:46cuvavuHi
04:47cuvavuIs anyone using appengine-magic successfully with eclipse and ccw?
04:52markomani have tried but couldnt
04:53markomanthen i tried netbeans, didnt work too good and finally IntelliJ which has been working best in my case
05:00markomanthey have a google group for support
05:07markomanwhat should I know when using lein pom to publish my jar to clojars?
05:09markomanand can i use lein to upload something to clojars?
05:13cuvavuwhat is their google group?
05:14cuvavuI've found a general web-apps one - is there one for appengine-magic itself?
05:20ejacksonanybody else lost doc in swank with 1.3.0 ?
05:24amalloymarkoman: lein push
05:24markomancuvavu: https://groups.google.com/group/clojuredev-users
05:25markomani havent found any group for magic thou...
05:25amalloycuvavu: i just saw constantine today, he said he follows the webdev list
05:25cuvavuthanks, both of you :)
05:26markomanamalloy: i used the command from clojars scp, but when i try to get project on other machine i get a lot of errors about missing artifacts, maven and such...
05:27amalloymarkoman: the information content in that statement, with regard to how someone could help you debug it, is zero
05:29markomani think its a very common... oh my mistake, typo going on. it worked fine
05:35markomanwhen I create and use project.clj with lein, can I specify :main to point to my jar lib instead of src dir?
06:13markomanamalloy: for some reason i dont have push task on lein...
06:21clgvmarkoman: then I'd guess it's a plugin/extension ;)
06:32markomanclgv: very much so ;)
06:43Borkdudewhat is the appropriate way to end a "lein repl" or "lein swank"?
06:44Borkdudewith (System/exit 0) I get some exceptions
06:44clgvctrl+d`
06:44Borkdudein Windows?
06:45clgvin linux.
06:45Borkdudeah yes
06:45clojurebotNo entiendo
06:45Borkdudein Windows it also works
06:45clgvit means end of file if I remember correctly
06:45fliebelBorkdude: By any chance IndexOutOfBounds?
06:46Borkdudewith "lein swank" it doesn't work though
06:46Borkdudebut then I can do "ctrl-C" to end the batch-file
06:47Borkdudefliebel: Exception in thread "Thread-3" java.lang.RuntimeException: java.net.SocketExcept ion: Connection reset
06:56fliebelDoes anyone know the state of this thing? https://github.com/hoeck/clojurebox2d It seems at least pre-lein and tied to clj-processing, which are not desirable for me. I do like to have wrapper for JBox2D.
06:58hoeckfliebel: maybe write your own jbox2d wrapper, its not that hard anyway
07:00fliebelhoeck: Yea, I'll see what happens. I was just surfing around. Would you say it's harder to beat this into shape than write my own wrapper?
07:12hoeckfliebel: depends on your goals, https://github.com/hoeck/clojurebox2d/blob/master/hoeck/clojurebox2d/jbox2d.clj and utils are the main namespaces for jbox2d wrapping action, and they do not depend on clj-processing
07:13hoeckfliebel: unfortunately, I had to write my own iteration macro, because jbox2ds c++ heritage, many things are done by mapping/filtering java arrays, and I don't want to use lazy-seqs for that in the main loop
07:14hoeckif you're okay with the tradeoffs taken and the look of the interface, then its easier to beat this into shape
07:15fliebelhoeck: I see. Well, the goal is to have some more interesting stuff for my game engine. Right now I have collisions based on java.awt.Rectangle. This is all fine, but I was looking around if there was a simple way to get some more advanced stuff.
07:15hoeckusing another backend for drawing is not a big deal
07:16fliebelOkay, so this is really 3 layers of duck tape. Running C++ code in Clojure via Java does not sound very ideomatic :)
07:16hoecknot c++, but c++ translated to java
07:17fliebelSame thing.
07:18hoeckleads to lots of set!s https://github.com/hoeck/clojurebox2d/blob/master/hoeck/clojurebox2d/jbox2d.clj
07:19hoeckbut is fast and humble on resources, more things for clojure to spend, like using multimethods for object collision :)
07:20hoeckfliebel: if you already have a game engine, I ca extract all the jbox related stuff from clojurebox2d and make it a separate lib (if you're interested)
07:23fliebelhoeck: Well, I don't know. I don't need the physics right now, but I guess I'll need them later anyway. Game engine is a big word btw, I have a game loop and some drawing, animation and collision stuff.
07:26fliebelSo, no, not right now.
07:28fliebelThis is also an option(DIY): http://www.wildbunny.co.uk/blog/2011/04/06/physics-engines-for-dummies/
07:29hoeckfliebel: right, and given all the new clojure capabilities (native ints, mutable deftypes), it may even perform well
07:30fliebelhoeck: I think you have to go pretty far in 2D for anything not to perform well.
07:33fliebelActually, the only thing I had to do for smooth animations is changing the GC. Besides that it renders more frames than is useful for anything else than stress-testing.
07:35fliebelhoeck: I don't think we're supposed to use mutable deftypes for anything other than implementing Clojure in Clojure.
07:38choffsteinI have a question. Is there a rule of thumb in clojure for knowing what goes first ... the 'subject' or the 'object'. e.g. (assoc hash key value) vs (cons element list). In the first, the object that the function is acting on comes first. In the latter, the object comes last. I find this sort of confusing and was wondering if there was a good way to remember it.
07:41fliebel&(println (subs (:doc (meta #'deftype)) 1043 1241))
07:41sexpbot⟹ Note well that mutable fields are extremely difficult to use correctly, and are present only to facilitate the building of higher level constructs, such as Clojure's reference types, in Clojure nil
07:43fliebelchoffstein: I think the object comes first in most cases. The way I think about it is "what would make the most sense grammatically, or using partial"
07:44fliebel&(map (partial nth 3) [[1 2 3] [4 5 6]])
07:44sexpbotjava.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number
07:44fliebel*facepalm*
07:45choffsteinfliebel: hmm, okay.
07:45fliebelSo, there are weird cases, but most of the time, it makes sense when you use partial and ->
07:46choffsteinAlright. I'll try to keep that in mind. Time to jump on a plane. Have a wonderful day :)
07:48fliebelDoes anyone have a more consistent view on these things?
08:06hoeckfliebel: re physics engines and deftypes: I would consider this as an excuse to use (thread confined) mutation of primitives and arrays :)
08:06fliebelhoeck: Maybe, but I see that as an optimization rout when, and only when I run into performance troubles.
08:08fliebelI'm not even using transients right now, while that would probably make the inner game loop a lot faster, it rules out any multithreading, and everyone I spoke to agreed it was bad style to expose transients to the outer world.
08:13clgvfliebel: you can't even expose transients to the outer world since in fact you cant read them only add to or change them
08:13clgvso the "exposing scenario" is extremely limited
08:14fliebelclgv: What do you mean by "can't read"?
08:14clgvhmm well, I might have to correct, what I experienced is that they are not seq-able.
08:15clgvI didnt try to use nth or something
08:15fliebeltrue, but you can get stuff from them, and update-in! (not in core)
08:16clgvok nth works
08:16clgvso it's "only" the seq-able property but which is a huge show-stopper for elegant code on exposed transients ;)
08:17clgvI avoided doing that as result of that experiments ;)
08:18fliebelvery true.
08:18clgvbut knowing that nth works I might do a performance experiment some time later ;)
08:19fliebelSo how fast is it to become a transient? Is it just a flag? Because I read it's constant-time.
08:20clgvwell usually I started with empty transient collections
08:20clgvguess thats pretty much constant time ;)
08:20fliebelBecause idk, the implementor might decide to use a transient during his modifications.
08:20fliebel&(doc transient)
08:20sexpbot⟹ "([coll]); Alpha - subject to change. Returns a new, transient version of the collection, in constant time."
08:21fliebelI'll have to track that call down into clojure.lang sometime.
08:21clgv:)
08:22fliebelwow
08:28fliebelclgv: My game engine accidentally almost does not care if you use a vector or a map for the game state. I'm not sure how useful that is, but I'm considering going the full 100% now and make it work.
08:29clgvyou have to point out the coolness aspect and its implications for the coffee-drained clgv ;)
08:31fliebelclgv: Well, imagine all sorts of things happening to the game state, like iterating over it and drawing it to the screen, or checking if 2 things collide. And it's written in such a way that it almost does not matter if I get just a val or a MapEntry.
08:33fliebelWhat I did is that I extended MapEntry to the protocol of my game objects, to save me from some destructuring. This means I can do (function MapEntry args) and it will transparently invoke that on its val.
08:37clgvah kk. I did that for my improved clojure inspector ;)
08:37fliebelclojure inspector?
08:38clgvoriginal: http://richhickey.github.com/clojure/clojure.inspector-api.html
08:38clgvI build upon the inspect-table function
08:38clgvto support map entries better and atoms and refs at all
08:39clgvand realized parts of infinite lazy collections ;)
08:42clgvoh I was wrong: I used inspect-tree as startpoint
08:48fliebelHey, you Swing! Why are you beating my ref to death? RetryEx clojure.lang.LockingTransaction
08:52AWizzArdfliebel: what do you mean? Do you code something with Swing?
08:53fliebelAWizzArd: Yea, I have an event listener update a ref, but it gives me exceptions.
08:55fliebelThe strange thing is that it is the only place that writes to it. Or… wait, maybe I just need to restart my repl.
08:55fliebelno...
08:56fliebelIt used to work, but not anymore. A deref can never ever retry a transaction, can it?
08:57AWizzArdA deref outside of a dosync?
08:57fliebelyea
08:57fliebelno..
08:57fliebelwait… this is all really weird stuff happening here :P
08:57AWizzArdA read outside should not force a transaction to retry.
08:58fliebelyes, outside, but it does not matter.
09:00fliebelw-wait… D'oh! I :reload-all'd the thing, which must have caused the thing to have registered 2 listeners or something.
09:01stuartsierrayeah, that kind of thing can happen
09:02clgvfliebel: but eventhandler should be sequential in the swing gui thread, shouldnt they?
09:03fliebelclgv: I'd say so, but still, not loading the event thing twice solved it.
09:04clgvfliebel: maybe they introduced a swing threadpool sometime...
09:05fliebelbtw, in a dosync with but a single statement, is it useful to use commute? Because the change is communicative, but using commute will execute it twice.
09:09clgvare there any java-only implementations for console guis?
09:32raekCharva looks nice... I should use it some time (http://www.pitman.co.za/projects/charva/Screenshots.html)
09:32raekit's not pure java, though...
09:32fliebelYou know what would be cool? A generic JSR 323(whatever; scripting bridge) REPL. So you could do any JVM lang on the REPL.
09:34AWizzArdfliebel: you can provide this from within Clojure.
09:34fliebelAWizzArd: How?
09:34AWizzArd(change-to-repl :jython)
09:36fliebelAWizzArd: Okay, and now back?
09:44fliebeloh! http://download.oracle.com/javase/6/docs/technotes/tools/share/jrunscript.html
09:46fliebeland https://github.com/pmf/clojure-jsr223 and http://java.net/projects/scripting/sources/svn/show/trunk/engines?rev=236
09:48AWizzArdfliebel: this python-repl would be programmed in Clojure. You just sit in a loop/recur, and it runs the code via jython.
09:48AWizzArdIn that repl however you won't have the clojure reader macros etc.
10:03angermandoes anyone speak sapnish?
10:03clgvnever done sap ;)
10:03fliebeldoes anyone know aleph?
10:03fliebelhow many roads must a man walk down?
10:03angermanfliebel: that's the async server, no?
10:04fliebelangerman: What I meant is, ask your question :)
10:04angermanfliebel: I'm in need of a tiny translation (en->es) "Lock to Point" or "Lock to Here"
10:05ejacksonangerman: now you're pushing the linguistic boundary...
10:05angermanhttps://img.skitch.com/20110406-qds7h4efuy6682y5eadrmwkd2y.png
10:05angermanejackson: of course! :D
10:05fliebelejackson: Hey, how is the jet stuff going?
10:06ejacksonfliebel: netjets are studiously ignoring me
10:06angermanejackson: weird thing is, even though I am German and live in Europe, I have more easy access to asian languages then to european… :/
10:06ejacksonis there context for your query ?
10:06ejacksonI'm tracking down a spaniard for you
10:07angermanejackson: see the iamge
10:07angermanhttps://img.skitch.com/20110406-qds7h4efuy6682y5eadrmwkd2y.png
10:07ejacksonummm.... what ?
10:07angermanif enabled, the first few digits to the blue bar are greyed out and will stay even when the field is cleared
10:08ejacksonok
10:08angermanidea is that if you have a bunch of euro notes in succession (e.g. with near continuous serial numbers), you might want to "lock" the first few, because they will always be the same.
10:09ejacksongotcha
10:09angermanAnd only the last two, three or what ever change :)
10:11fliebelejackson: Ignore? They think you are mocking theme because you don't talk with a big cigar on the phone?
10:11ejacksonyeah, they can tell i sound poor
10:12clgvhow can I used destructuring in a function signature to refer to the parameters by name and as a vector as well?
10:12angerman?! lol emendio got mentioned in a russion document about clojure use.
10:13angermanclgv: doesn't :keys … :as work_
10:14clgvI guess :as could work. but I dont know whether it works outside that map with :keys
10:14fliebelejackson: So the trick is to sound rich. don't ask "How much?" but say "I want a plane, sent me a quote please" O even "my boss wants…" :P
10:14ejacksonoh no, I went even more hardcore
10:14fliebeltell me :)
10:15ejacksonwe're holding our company retreat, and I was thinking as a bonus for their hard work I'd fly the employees out
10:16ejacksonangerman: my best guess is "fijar de aqui"
10:16ejacksonwhere fijar is 'to fix'
10:16ejackson(or at least my hive mind tells me that is a good guess)
10:17pdkarreglar
10:17pdkfijarse de X = to notice X
10:17angermanejackson: thanks.
10:17fliebelejackson: Google Translate agrees more or less.
10:18ejacksonbetter find you a real spaniard though :)
10:18ejacksonpdk: cool
10:18angermanejackson: if it's wrong I hope at least one spaniard will complain with a better translatioN :D
10:18ejacksoni like it.
10:18pdkwhat are we translating, i didnt catch it
10:18ejackson'lock to here' or 'fix to here'
10:18fliebelhttps://img.skitch.com/20110406-qds7h4efuy6682y5eadrmwkd2y.png
10:19angermanwow guys you are great… (and faster then I am… :D)
10:19pdklike
10:19pdkto affix something to a spot?
10:19pdkor to lock something into a socket etc
10:19angermanpdk: pressing that button will grey out the first digits up to the blue vertical line.
10:20fliebelMaybe someone needs to launch #lazyI18n on Twitter.
10:20angermanif the field is cleared, only the part that is not "fixed" (grey) is cleard.
10:21pdkhm
10:21pdkin that case fijar would prob work
10:21pdkfijar desde aquí
10:22angermanpdk, google translate sais desde would be "from"… and it's intention is "to"
10:23angermane.g. the first digits are locked, not the last.
10:23pdkhasta then
10:23ejacksonhasta la vista, BABY !
10:23pdkde/desde would convey from
10:23pdka = to, at
10:23pdkhasta would convey "up to"
10:24angermanpdk: fijar hasta aqui then, I assume.
10:24pdkyeah i'd go with that
10:24pdknote aquí though
10:25angermanaqu? google keeps on correcting me it's aqui… confused.
10:25pdkacute accent over the I
10:26pdkirc kicks ass so it probably dropped the accented I
10:26_fogus_nick fogus`
10:27angermanpdk, ahh thanks
10:27ejacksonfogus`: why with all the decorators ?
10:27ejacksonwhat do they denote ?
10:28ejacksonis _fogus_ dynamically scoped ?
10:28pdkthey denote STYLE BABY
10:28ejacksonlol
10:28ejacksonno wonder i don't get it
10:29fliebelI know my client gets me fliebel1 when I log off an on real quick, and I've also seen people use a _ when they are away, such as amalloy_.
10:30fogus`ejackson: Someone else took fogus on freenode.
10:31cemerickthere's more than one?
10:31fliebelejackson's gone
10:31fogus`cemerick: Apparently. Weird huh?
10:31fliebelfogus`: Did you try talking to him?
10:33cemerickwhat *is* a fliebel, anyway?
10:33fogus`fliebel: I did, but he never responds. He's also squatting my Last.fm name
10:35fliebelcemerick: Dunno, but wait… Nope, my dictionary does not know either. I think me and my friends made that up a long time ago to mean 'something'
10:36fliebelbut more specifically something dangling loose like a shoe tie or whatever.
10:51Dantashi everyone !! using the map function over a map data structure (map f {:a 0, :b 1} ) . what is suppose to be the arguments passed through the function (f ) inside the map ?
10:51pdk,(seq {1 2 3 4})
10:51clojurebot([1 2] [3 4])
10:52devnhello all
10:52pdkeach pair in the map is going to be passed to f in a vector [key value]
10:52ejacksondantas: kv pairs
10:52Dantaspdk: ejackson : Thanks a lot !
10:53jweiss_anyone have problem with swank-clojure to list callers using C-c C-w c, gets "Error in process filter: wrong type argument: char-or-string-p, nil"?
10:53ejackson,(map (fn [[k v]] v) {:a 0, :b 1} )
10:53ejacksonhmm.
10:53clojurebot(0 1)
10:53ejackson$(map (fn [[k v]] v) {:a 0, :b 1} )
10:54ejacksonhmmm... the bots scorn me today
10:54Dantasexacly, I thought it was a sub map ! thanks a lot
10:54ejackson,(map (fn [[k v]] k) {:a 0 :b 1 :c 2})
10:54clojurebot(:a :b :c)
10:55pdk,(type (seq {1 2 3 4}))
10:55clojurebotclojure.lang.PersistentArrayMap$Seq
10:59raek'for' and destructuring can be very useful too: ##(for [[k v] {:a 0 :b 1 :c 2}] (inc v))
10:59sexpbot⟹ (1 2 3)
11:01Dantasejackson: watching the pdk expression (type (seq {1 2 3 4})) i did the same to a list . is list a sequence ?
11:02Dantas,type(seq '(1 2 3))
11:02clojurebot#<core$type clojure.core$type@11c1cdf>
11:02Dantas,(type(seq '(1 2 3) ) )
11:02clojurebotclojure.lang.PersistentList
11:02pdksequences are an abstraction over all four basic collection types
11:02pdklists/vectors/sets/maps
11:02pdkand strings
11:04Dantaspdk, yeah . a interface , right ?
11:04ejacksonsequences can be thought of a bit as like iterators... they're not, but its a nice crutch.
11:04stuartsierraA list is the only Clojure data structure that is its own sequence.
11:04ejacksonlists, vectors, maps are concrete data structures
11:04raeklists are their own seqs
11:04ejacksona sequence is not
11:04ejackson(as far as i understand these things)
11:05Dantaspdf, but for a map the type is a nested class form the map - clojure.lang.PersistentArrayMap$Seq
11:06raek,(isa? clojure.lang.PersistentArrayMap$Seq clojure.lang.ISeq)
11:06clojurebottrue
11:07raekDantas: yes, it's an interface
11:07Dantasthanks all !!
11:17mefestoHey everyone. I have a leiningen project that has both clojure and java sources. When generating a pom file (lein pom) the result does not include the java source path. Is this a known problem or am I doing something wrong?
11:18fliebelmefesto: I think you need lein-javac
11:18fliebelOr cake
11:18mefestofliebel: lein-javac will generate a different pom file?
11:19fliebelmefesto: I don't know. I've only heard you need that to compile java files.
11:19mefestofliebel: leiningen is building the project correctly it's just the pom file that doesn't include the java src path
11:20fliebeloh, okay, don't know then.
11:20mefestothe only reason I care about the pom file is so I can seemlessly use netbeans for the gui form building portion and use emacs for general coding
11:21mefestoi could just give in and use netbeans clojure support but i just figured if lein pom included the java source path then it wouldn't matter
11:22fogus`How might one defer a test with clojure.test?
11:23raekmefesto: are you using the latest version of leiningen?
11:23mefestoraek: Leiningen 1.5.0 on Java 1.6.0_22 Java HotSpot(TM) 64-Bit Server VM
11:25raekmefesto: does the pom.xml need to contain the source paths? I have one which lacks those...
11:26mefestoraek: yeah for this project to work in netbeans. perhaps my setup is hoakey but I only use netbeans for the gui forms which are stored as java sources (plus some form type type)
11:27trptcolinfogus`: if you're running w/ leiningen you can tag them w/ metadata & use test-selectors to only run the ones you're interested in
11:28fogus`trptcolin: Anyway w/o Lein?
11:29mefestomy project layout is like this: http://pastie.org/1772379
11:29trptcolinnot that i know of aside from commenting them out :)
11:29mefestoI'd like to consolidate the myapp-client and myapp-client-ui into a single leiningen project
11:29fogus`trptcolin: Seems like a useful feature. :-(
11:30mefestomyapp-client-ui only contains the netbeans swing forms which myapp-client depends on. I'm open to other approaches :)
11:33raekmefesto: I would recommend asking on the lein mail list. the java source path missing sounds like an easy to fix bug to me, and I know that technomancy makes new releases quite often
11:34mefestoraek: Will do. Thanks
12:06technomancymefesto: it's an unintended omission; go ahead and open an issue on github for it
12:06technomancymefesto: if you can get a patch in for it, that would help it happen more quickly; otherwise I'll try to be sure it makes it into 1.5.1
12:09thickeyp.s. food
12:09thickeyp.p.s BEER
12:09thickeylol, sry
12:26jweiss_having a little trouble with destructuring - can :keys maps be nested?
12:27jweiss_i am not quite sure what (defn g [{:keys [a b c {:keys [d e]} z]}] [a b c d e z]) will be interpreted as
12:27jweiss_i can't seem to call it so that the d e or z are non-nil
12:28raekjweiss_: you can't use :keys like that. :keys is the shortcut for the case when you want to bind the symbol foo to the value associated with :foo.
12:29jweiss_raek: ok. is it me or does the doc here http://clojure.org/special_forms#toc4 not consistent about whether you need the :as keyword?
12:30jweiss_is it that if no other keywords are specified, :as is assumed?
12:30raekjweiss_: {a :a, b :b, c :c, {d :d, e :e} :z}
12:30raekor {:keys [a b c], {:keys [d e]} :z}
12:30raek:as is used when you want to call the whole map something
12:31jweiss_raek: ok so what is z there?
12:31jweiss_sorry :z
12:32raekwhen destructuring a map, a pair can either have a symbol or a keyword as its key
12:32mefestotechnomancy: thanks, i'll try to put a patch together later today
12:33raekwhen it's a symbol, like in {a :b}, that symbol will be bound to the value you get when you look up :b in the map
12:33raekbut instead of a symbol there, you can have another destructuring form
12:33jweiss_raek: ok i think i see why i'm confused, the doc is showing let bindings, which is not what i'm doing :)
12:34jweiss_i'm doing defn
12:34meclet and defn destructure identically
12:35jweiss_mec, yeah, but in a let there's a 2nd item (the value being destructured)
12:35raekwith let, you have [destructuring-form value, destructuring-form value, ...] but with function parameters, you only have [destructuring-form, destructuring-form, ...]
12:35jweiss_so i was looking at "(let [{fred :fred ethel :ethel lucy :lucy} m] ..."
12:36jweiss_and wondering what m was
12:36jweiss_not realizing i'm looking at a le
12:36jweiss_let
12:36raekas mec pointed out, "destructuring-form" works the same for let and fn
12:37raekjweiss_: ah, I see. :) was my example of nested map destructuring clear?
12:37jweiss_raek: still having a bit of trouble interpreting {:keys [a b c], {:keys [d e]} :z}
12:38jweiss_the :z seems to be dangling there
12:39raekif you "expand" the first :keys, it looks like this: {a :a, b :b, {:keys [d e]} :z}
12:39jweiss_ah ok
12:39jweiss_that helps thanks :)
12:58amalloyejackson: for sexpbot it's &(expr) at start of line, or ##(dec 1) anywhere in the line; $ is for commands
12:58sexpbot⟹ 0
12:59mecsexybot gets it done
13:09dabdstruggling with http-agent here: how do you make a POST? url encode the parameters? what is the separator? thx
13:10amalloymec: i read that like four times before i even noticed you'd changed the P to a Y
13:10mecamalloy: lol thats how i read sexpbot all the time
13:11ejacksonamalloy: gracias.
13:12ejacksonamalloy: and If I could stop reading pom.xml as porn.xml...
13:12amalloyejackson: sexiest data-exchange format around
13:16Raynesamalloy: Did he ask a question somewhere? I missed it.
13:16amalloyRaynes: no, he just discovered that, when he used the wrong syntax, sexpbot ignored him
13:16robinkraftnewbie question: How do I use 3rd party Java libraries? I'd like to do something like (import import org.apache.thrift.TBase), or include thrift as a dependency in project.clj. Even if you don't know anything about thrift, general info on how to use 3rd party libraries would be really helpful.
13:17robinkraftThrift is already compiled and works in my Mac Python environment. I can even get thrift to work using demo Java classes that come with the thrift source code. But that's as far as I've gotten. FWIW there's a a jar file at /usr/local/lib/libthrift.jar.
13:17robinkraftp.s. pardon the typos - just saw the "import import"
13:19mecif the jar is on your classpath then the (import ..) should work
13:19amalloyrobinkraft: you can depend on backtype/thriftjava 1.0.0
13:19amalloysurely the wrong way to do it, but i happen to know he's published thrift there
13:19robinkraftI'm not sure, probably
13:19dnolenrobinkraft: you can also just copy that jar into your project lib folder.
13:19robinkraftbut I'd like to know for other libraries that aren't so convenient
13:20robinkraftok. what about using it from the repl
13:20robinkraft?
13:20dnolenrobinkraft: lein repl, user=> (import '[org.apache.thrift TBase])
13:22robinkraftdnolen: seems it's not in my classpath. So, that's the next question I guess: how do I add something to my classpath?
13:22dnolenrobinkraft: copy the jar into your project lib folder.
13:23robinkraftdnolen: so I can't just load it interactively in the repl? I need a project first?
13:23dnolenrobinkraft: you can do it without a project but then you need manage the classpath yourself.
13:24dnolenrobinkraft: ^
13:24dnolenjava -cp path/to/clojure.jar:path/to/thrift.jar clojure.main
13:25robinkraftahhh that looks promising
13:31fliebelIs there something that lets me update multiple keys in a nested structure?
13:32mecare they all at the same level?
13:32fliebelyes
13:32mec,(update-in [[[1 2 3]]] [0 0] assoc 0 2 1 3 2 4)
13:32clojurebot[[[2 3 4]]]
13:33fliebelw-what?
13:33amalloyfliebel: you want to do something like [:a :b [:c :d :e]]?
13:33chrissbxHow do you install swank with leiningen? Someone showed it to me once, but it installed an old version of swank and there are issues with it.
13:33meca map might be more clear:
13:33fliebelThis is what my data looks like: {:a {:x 2 :y 2}}
13:34mec,(update-in {:a {:x 2 :y 2}} [:a] assoc :x 3 :y 3)
13:34clojurebot{:a {:x 3, :y 3}}
13:34robinkraftdnolen: I think you gave me enough to go with, I just need to figure out where the right jar file is ... Thanks much for your help
13:36amalloymec: i've never managed to find a version of that that lets you use something more like update-in at the bottom level instead of assoc
13:36fliebelmec: Very nice. Now say I want to *update* and not assoc. If it's more than one line, I wrote something that does this already using reduce.
13:36fliebelamalloy: Ah, right
13:36amalloymaybe this is finally an argument for a plain update (rather than update-in)
13:36meci dont follow
13:37amalloyeg (update-in {:a {:x 2 :y 2}} [:a] update [:x :y] inc)
13:37fliebelamalloy, mec: This is what I have now: https://gist.github.com/910326
13:37chrissbxWhere should I start if I want to work with clojure from emacs?
13:37amalloybut update doesn't exist
13:37mecyou can give update-in any function you want
13:37fliebelmec: But not multiple
13:37amalloymec: you can't easily give it multiple keys
13:38amalloyobviously it's possible by asking update-in to use a function that does all the work, but the "prettiest" version of that would be a version of update that works like assoc
13:38fliebelYea, I;ve always wondered why it does not exist. Is it in amalloy utils?
13:39amalloyfliebel: it's not; i haven't wanted it for several months
13:39amalloyafter this discussion i'm thinking of adding it :P
13:39fliebelI still need a better acronym.
13:40amalloy?
13:40chousertechnomancy: no where useful. Mainly I wish there were no object model built in, no inheritance, and no requirement to declare an exception type ahead of time.
13:41fliebelamalloy: You made me an acronym to convince me that amalloy had nothing to do with your name. I need to make myself a better one, because it wasn't very convincing.
13:41mec$findfn {:a 1 :b 2} [:a :b] inc {:a 2 :b 3}
13:41sexpbot[]
13:41amalloyheh
13:41fliebelmec: It should at least be inc inc
13:42fliebelor.. maybe not.
13:42fliebel$findfn {:a 1 :b 2} [:a :b] inc inc {:a 2 :b 3}
13:42sexpbot[]
13:42amalloyfliebel: k it's written. not very complicated
13:42mec(update-in {:a {:x 2 :y 2}} [:a :x] inc)
13:43fliebelcool
13:43mec,(update-in {:a {:x 2 :y 2}} [:a :x] inc)
13:43clojurebot{:a {:x 3, :y 2}}
13:43dnolenchrissbx: http://clojure02.managed.contegix.com/display/doc/Getting+Started+with+Emacs
13:43amalloyhttps://gist.github.com/910333, and i'll get it into amalloy-utils later
13:43amalloyi don't think you want inc inc
13:43fliebelamalloy: Why is it using update-in? I would have based it on get and assoc personally.
13:44mecyou can do (apply update-in m [k] f args) instead of (update-in m [k] #(apply f % args))
13:45amalloymec: thanks, i knew it was silly to need a closure
13:45fliebelamalloy: Now you are updating the whole datastructure every time, while you could only update the outer one once and the inner one as much as you need.
13:45amalloyfliebel: what? (update-in {:a {:x 2 :y 2}} [:a] update [:x :y] inc)
13:45mecyou would still use update-in for that
13:45fliebelokay… oh right...
13:46amalloyi used update-in because it's crazy to use get+assoc to change a value in a map when you have update-in available
13:46fliebelI wasn't reading and thinking in a coherent manner.
13:47livingstonif I use extend to add a protocol to a defrecord, and then pass that record instance out to Java, there is no way for java to see or use that object as that interface, is there? I would have to put that interface/protocol on at defrecord definition time right?
13:47fliebelyes
13:48fliebelextend stores the extension on the protocol, not on the record.
13:48fliebel(I only recently found out protocols are actually just maps)
13:48livingstonwhammy ok, guess I need to reorganize this code
13:50livingstonfliebel: huh, that's interesting, especially since they allow objects to be created that don't need any dispatch or anything to get to their methods.
13:51fliebel{:impls {java.lang.String {:stuff #<user$eval359$fn__360 user$eval359$fn__360@5c1a1ff9>}}, :on-interface user.stuffer, :on user.stuffer, :sigs {:stuff {:doc nil, :arglists ([x y]), :name stuff}}, :var #'user/stuffer, :method-map {:stuff :stuff}, :method-builders {#'user/stuff #<user$eval340$fn__341 user$eval340$fn__341@13899213>}}
13:51livingstonone more question on exposing clj data to java, if I pass out a record, and (since it's also a map) the java side wanted one of the fields, they could get it with get and passing a keyword as a parameter, right?
13:52mecyou can also just do record.field
13:53livingstonooh - that's hugely handy
13:54livingstoneven if I use assoc to add on fields? that won't work then right, it wouldn't be available to the compiler?
13:54mecno just the default fields
13:55livingstonmakes sense, how would I get a non-default then, with get, right?
13:55fliebelYea, using the ILookup protocol.
13:55fliebelI think it's actually entryAt
13:56cemericklivingston: Just using get all the time is generally a lot easier than worrying about the impl details.
13:56cemerick(and having to document concrete types on the java side)
13:56fliebelcemerick: But is there get at the Java side? I thought it was called entryAt.
13:57cemerickfliebel: records implement j.u.Map
13:57fliebelAs well as ILookup, so both work?
13:57cemerickyeah, it implements a bunch of interfaces
13:58cemerick,(supers (defrecord A []))
13:58clojurebotDENIED
13:58cemerickanyway
13:58livingstonthat's really convienent for the java side, I would assume they would just use the java.util.Map interface that they are used to
13:58amalloyfliebel: everything is a map if you stand far enough back
13:59livingstonalthough the Java users hav
13:59livingstone a casting nightmare on their hands
14:00amalloylivingston: you can typehint record fields
14:00amalloyer, maybe no
14:00amalloyi guess you can typehint them as primitives but that's about it
14:00stuartsierrayeah, primitive or Object
14:01livingstonObject is not very useful as an interface to the java guys, but I guess that's what they get.
14:02livingstonif I have a map that could have symbols strings or numbers, there's no way to give their compiler a better type anyway
14:09stuartsierraGeneric types in Java, like Map<String, String> are not much more than syntactic sugar for type casts anyway.
14:10livingstonin the end yes, but it save you from either flagging off the type checking, or putting casts everywhere. (i'm trying to be as accommodating as I can)
14:11livingstonis there an example out there of how to defrecord using 2 protocols at the same time. the docs make it look kinda like you can only use one.
14:12dnolenlivingston: something like this, https://github.com/swannodette/logos/blob/master/src/logos/minikanren.clj#L71
14:13livingstonperfect (assuming that works for records too) thanks. the ordering of everything wasn't clear.
14:14dnolenlivingston: works just the same for records, defrecord is just a deftype w/ extra stuff.
14:15livingstoncool, thanks
14:15livingstonwhat happens if two different protocols have the same function name? is that legal and can your point them to two different implementations or to the same implementation?
14:16dnolenlivingston: two protocols can't use the same name with/in the same namespace as far as I understand.
14:16mecamalloy: in your update why do [& keys] instead of just keys
14:16amalloy&(doc update-in)
14:16sexpbot⟹ "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."
14:17amalloymec: i know it's not necessary. it makes it more clear, for me, that it should be a seq
14:17amalloyand i'm sure i've seen it somewhere in clojure.core. maybe ##(doc clojure.string/join)?
14:17sexpbot⟹ "([coll] [separator [x & more]]); Returns a string of all elements in coll, separated by an optional separator. Like Perl's join."
14:23stuartsierraClojure 1.2.1 is released and on its way to Maven Central.
14:29technomancystuartsierra: still no tag?
14:30stuartsierratag?
14:30stuartsierraoh, in git
14:31stuartsierraThere's a branch I think. Bug stuarthalloway to make a tag.
14:35Rayneshttps://github.com/clojure/clojure/pull/6
14:36stuartsierrarhickey doesn't accept pull requests.
14:36Raynesstuartsierra: He certainly wouldn't accept that one.
14:36stuartsierrawell no
14:38cemerickthat's sooo bizarre
14:39redingerWow, he actually went through all the work to do that
14:40cemerickI presume it was just s/clojure/lava, but…
14:40amalloyredinger: what work? find . | xargs perl -pi -e 's/clojure/lava'
14:40stuartsierraI wonder if it builds?
14:40cemerickThe fact that he submitted a pull request is great.
14:40opqdonut_haha, what's the story behind lava
14:40znutarI think the story is that it's cool
14:41amalloyi like how he renamed the repo too. style
14:41RaynesSo cool.
14:41fliebel#findfn [1 2 3 2 1] [1 2 3]
14:41fliebel$irc://irc.freenode.net:6667/#findfn [1 2 3 2 1] [1 2 3]
14:41fliebel$findfn [1 2 3 2 1] [1 2 3]
14:41sexpbot[clojure.core/distinct]
14:41fliebelah
14:41Raynesfliebel: Type slower. :>
14:41redingerWell it's rename all the files & replace text in files. Not a lot of work still - but why
14:42cemerickReminds me of the guy who cloned the google code repo, swapped out the copyright notices for his own name, and pushed to github.
14:42amalloybut he left the homepage the same. clojure.org
14:42fliebelRaynes: Good idea.
14:42znutarLava's got a sophisticated French feel if you pronounce it right too. As a newbie clojure user I look for this in my languages.
14:44RaynesLooks like the guy is a big Go fan.
14:44RaynesThe language; not the game.
14:46raekstuartsierra: will there be an official announcement for 1.2.1?
14:46stuartsierraraek: There just was. ;)
14:47raek:)
14:47stuartsierraOnce it's sync'd to Central I'll notify the mailing list.
14:47raekI was thinking about a URL to point people to
14:47raekok
14:49stuartsierraDon't tempt me.
14:49stuartsierraI just spent the past 3 weeks implementing a 6-machine deployment strategy in Bash.
14:49cemerickHoly jeebus.
14:50stuartsierraIt wasn't that bad actually.
14:50cemerickThat's a bad time / node ratio, dude.
14:50cemerickI've been spoiled in the department in the past year.
14:51cemericks/in the/in that
14:51sexpbot<cemerick> I've been spoiled in that department in that past year.
14:51stuartsierraWell, it wasn't 3 weeks full-time.
14:52cemerickoh well
14:52cemerickit's makes for good lore, anyway
14:52livingstonmvn has it crufty bits (especially for dynamic language debugging in repl etc.) but it makes a lot of things really easy too
14:52cemerickNext time someone asks me "how long will it take to implement a 6-machine deployment strategy?"…
14:53stuartsierraRuby + Rails + Clojure + C + Bash + Cron + TCL + a bunch of other stuff I forgot.
14:53cemericklivingston: Of course, your environment really should pull config from your pom.xml once, and work from there without ever running mvn for REPL stuff.
14:53kephale00Can anyone imagine complications with making the size of the fixed thread pool for agents tweakable?
14:54stuartsierracemerick: On that note, I've been trying to think about what an interactive dev environment for Clojure would look like outside of an IDE.
14:54stuartsierraMaven alone isn't great for interactive development.
14:54technomancywe just had that discussion last night at seajure
14:55stuartsierraOh, good, so you've solved it then? ;)
14:55technomancyapparently Steve Yegge is using Clojure for a cloud-y code indexing and support tool internally for Google
14:55technomancywell, not so much "outside an IDE" as a backend that's easy to support across environments
14:55stuartsierraReally???
14:55cemerickstuartsierra: It's an interesting question, but a non sequitur for me. I don't know that I'd have much to add or usefully suggest.
14:56stuartsierratechnomancy: yeah, that's what I mean
14:56technomancystuartsierra: yeah, I was surprised he got away with it. apparently when you've been at Google for six years you get some leverage.
14:56stuartsierraClassloader wrangling, thread management, reloading, introspection, …
14:57cemerickoh, I thought you were talking about UX stuff.
14:57livingstonthe really nice thing about mvn is if you are working in a mixed clojure and java environment you can, for the most part, make things work. I get my repl, they don't have to figure out my goofy dependencies etc.
14:58stuartsierracemerick: No, like technomancy said, I'm thinking of a backend that's accessible to anything, including a command-line UI.
14:58stuartsierraI played with Nailgun last year: https://github.com/stuartsierra/classpath-manager
14:58livingstonwhat do you mean outside of an ide? oh you mean just the back end?
14:58stuartsierra yeah
14:59stuartsierraSo I can interact with it from the command line, Emacs, a web browser, etc.
14:59livingstonI'm pretty happy with swank and slime...
14:59stuartsierrame too, but I dream of more… :)
14:59technomancydoesn't seem to be any public data on Google Grok, but if you could be a fly on that wall...
14:59livingstonweb browser etc. - why would you want that pain?
15:00stuartsierrawell, I'm not volunteering to write the web front-end, but app servers sometimes have admin interfaces, like Glassfish.
15:01livingstonthe only thing I miss about swank+slime and clojure is some of the debugging isn't quite at the same level as I had it with lisps (also I was able to use swank/slime with AllegroCL and still use their dialog for trace output - it was a comfortable setup)
15:01stuartsierraI'd love if I could get the same kind of Java class/method lookup in Emacs that Java IDEs have.
15:02technomancythat's like the one thing I still have to go to javadoc for
15:02livingstonre glassfish: that seems like something with different goals than development. but maybe there are commonalities.
15:02stuartsierraYeah, this is all just random thoughts, not a coherent plan.
15:03livingstonI would be surprised if there isn't an emacs hook to get you to the javadocs?
15:03stuartsierrayes, there is. In Clojure, in fact.
15:03cemericksurely there's something like http://eclim.org/ for emacs?
15:03livingstonthe other bummer about slime and clj and maven is when you look up a function or something it will always whisk you away into the jar, instead of your local files - that sucks.
15:04stuartsierraYeah, Maven's lifecycle model wasn't designed for interactive development in a dynamic language.
15:05livingstonif there was a way to get it to load local some in dev mode that would be good. (I think there may be a way to do that with a system dependency and a profile, but I haven't hacked that yet)
15:05cemerickstuartsierra: maven shell / aether to the rescue?
15:06livingstonwell then if you can hook the java doc you can get the data you need for autocomplete (there are java modes for emacs too right?) or is the javadoc rendered as a webpage and not parsed.
15:06stuartsierraMaven shell. Interesting. Don't know that.
15:06livingstonI don't know those projects either?
15:10livingstonmaybe those would help. really all I want it to be able to have maven be willing to provide a local (system?) location for a select set of libraries that I'm developing and not have to jar them and put them in the repository first and then get them from there.
15:10cemerickstuartsierra: it's just a persistent jvm that you can load/reload poms into and invoke goals / lifecycles with.
15:10cemerickIts presence gives me the same vibe as polyglot maven though (i.e. going nowhere), so I'm not betting anything on it.
15:11stuartsierraintriguing. Does it reload dependent JARs each time.
15:11stuartsierra?
15:11technomancysounds like sbt
15:11cemericktechnomancy: yeah, same shtick.
15:15markomanwould someone like to review and comment my first clojure study project on git?
15:16midsjust share the url
15:16markomancode, principles, best practices, anything, id appreciate that before continuing on other project
15:16markomanhttps://github.com/mmstud/websesstudy
15:18amalloymarkoman: holy cow, sudo lein deps? i'm not sure i can imagine a reason to recommend that ever
15:19kephale00lol
15:19_fogus_cemerick: Are you still thinking of putting together an authors' panel at Conj '11?
15:19markomanhavent done harm on my machine yet ;) but good point, i constantly get problems to use lein because of directory or file permissions
15:20livingston_anyone want to check my code, just sudo ... , yeah you almost got me there internet ... just kidding ;)
15:20markomanadds some frustration to the high pile already
15:20redinger_fogus_, cemerick: I've already got it listed as a proposal with my initial list of names. :) I'll flesh it out if Chas sends more info
15:21amalloymarkoman: i've never had a problem with permissions using lein. do you have both lein and your project inside of ~?
15:22markomanproject is inside home dir on my mac, lein is on /bin
15:22cemerick_fogus_, redinger: It was an idle idea. I'm not really sure what a proposal would look like though.
15:22amalloymarkoman: i use a copy of lein in ~/bin/lein
15:22cemerickI suppose we could collect questions ahead of time, or have someone run around Donahue-style to take questions from the audience.
15:23amalloyif you put it in /bin it seems like eg lein self-install would fail because you don't have write perms
15:23markomani dont haven even ~/bin dir here
15:23amalloymarkoman: it's a good idea to create one and add it to your PATH
15:24midsmarkoman: in your defrouters I'd suggest a more REST behaviour, like using POST for routes with side effects
15:24markomanyeah, thats true. i should add bin to my home and put it on path probably working then better?
15:24amalloy*blink* didn't follow that sentence as a whole, but all the bits in it sound good
15:25markomansorry, clumsy finglish
15:25amalloytechnomancy: do you recommend for/against installing lein in /(user/)bin?
15:26midsmarkoman: also, how does your session/flash stuff different from what sandbar offers?
15:26midshttps://github.com/brentonashworth/sandbar
15:27markomanmids, I looked sandbar but I couldnt follow its code by every part, it looked complicated to me, lol
15:27midsmarkoman: fair enough, it probably is :)
15:27markomanbut yes, it overlaps with my other project too, forms, but its not same anyway
15:32technomancyamalloy: it's fine. keeping self-installs somewhere other than ~/.lein is something that might need some thought, but so far I've left that to the packagers.
15:32markomanmids: do you mean I should use POST for setting session value and adding a task? or maybe PUT or what do you mean with "more REST" ?
15:33ataggartAnyone here have the power to alter fields on Jira tickets?
15:34stuartsierrasuch as?
15:34amalloymarkoman: GET requests shouldn't have side effects
15:34steven(it was pretty much just a s/clojure/lava/g, yeah)
15:35ataggartstuartsierra: For some reason the only thing I can do on tickets is manage comments and attachments. There are a few tickets that need to be marked ready for test, but alas I don't seem to be able to do that.
15:35cemericksteven: why, but why is the only real question…
15:36stuartsierraataggart: Ask on the dev list for your account to be upgraded.
15:36stevencuz its a cooler name
15:36markomanamalloy: they still need to output something, but I think I got you. but to keep example simple, is there other way to do it than POST forms? it makes thing unnecessary complicated on this case, but real app, yes I agree
15:36stevenclosure is something your girlfriend wants after you break up
15:36cemerickWell, I'm convinced.
15:36devnWill the reader puke on ##(symbol "$foo.bar")? I know it's ill-advised, but *how* ill-advised is it?
15:36sexpbot⟹ $foo.bar
15:36stevenlava levels cities and gets immediate results
15:36stuartsierraIf only it weren't for the darned Los Angeles Venture Association home page...
15:37ataggartstuartsierra: I wrote to Aaron, he said I should be able to modify tickets.
15:38ataggartoh well
15:38stuartsierrasorry, I don't know much about JIRA
15:38ataggartyeah, I was hoping someone here was able to do what I can't, and would be kind enough to modify them for me.
15:39amalloysession-bind is going out of its way to make its use of this atom not threadsafe
15:40amalloyyou could write it as "(swap! *STORE* assoc sid session) session", or "(:session (swap! *STORE* assoc sid session))"
15:41amalloybut (swap! foo...) @foo is rarely right
15:44markomanhmh.. im not sure if I understand
15:44amalloymarkoman: do you intend for session-bind to always return the session the user passes in?
15:46markomanyes, sid is mandatory there so it will be empty map or map having session data for user. thats what its meant for
15:47amalloyi think you answered a question different from what i asked. you have session-bind doing a swap, and then returning (get m the-key-you-just-set). do you want that to always return the value the user supplied?
15:50technomancy,(reduce (partial merge-with concat) (for [i (range 1878) ] {:a []}))
15:50clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.StackOverflowError>
15:52amalloytechnomancy: (concat (concat (concat (concat....)))) all gets realized at once
15:53markomanhmh... I just want *STORE* to keep all users session data. session-bind is used by session-set and get primarily.
15:54amalloyyou're missing the point. imagine two threads both want to change the session data at once, to two different values: it's possible they both swap before either returns, and then they both return the newest value; the guy who set it first gets silently overwritten
15:54markomani think i choose doing swap every time to simplify process so that i dont need to have set, get, save, update, delete functionaility for the session-bind
15:55markomanouh
15:55technomancyyeah, something is lazy even coming out of reduce. interesting.
15:56raek,(reduce (partial merge-with (comp doall concat)) (for [i (range 1878) ] {:a []}))
15:56clojurebot{:a ()}
15:57raekthis avoids a cascade of forcings
15:58markomanamalloy: i think I got some of what you meant. Im about to use code on google app engine at the end, I guess there is no thread problem or am I wrong?
15:58amalloymarkoman: in practice there's unlikely to be
15:59amalloybut it's crazy to introduce this sort of race condition when the code would be *simpler* if you didn't introduce it
15:59markomanbut you suggested some change, could it work on threaded environment better then?
16:00amalloy&(let [a (atom {}] (:name (swap! a assoc :name "test")))
16:00sexpbotjava.lang.IllegalArgumentException: let requires an even number of forms in binding vector
16:00markomanyeah, Im not used to think threads from PHP side
16:00amalloy&(let [a (atom {})] (:name (swap! a assoc :name "test")))
16:00sexpbot⟹ "test"
16:00amalloyhere, instead of deref-ing the atom again once you're done swapping, you take advantage of the fact that swap! returns the new value
16:01amalloyor since you *know* what the key will be, you could just ##(let [name "test" a (atom {})] (swap! a assoc :name name) name)
16:01sexpbot⟹ "test"
16:04markomanamalloy: sounds interesting and certainly I need to test these things more. can you advice how could I test session behaviour if its working with threads at the end?
16:05amalloynot really. i don't do any webdev in clojure, really
16:07markomanso could we say, my session-bind is not thread safe at the moment? :)
16:13amalloyit's hard to say for sure because you refuse to clarify what you expect it to return :P
16:16markomanuser session data
16:17ssiderishello
16:17ssideris,(str (drop 1 [5 6 7]))
16:17clojurebot"clojure.lang.LazySeq@482"
16:18ssiderishow could I get "[6 7]" instead?
16:18raekssideris: use pr-str
16:18ssiderisah, thanks
16:18raek,(pr-str (drop 1 [5 6 7]))
16:18clojurebot"(6 7)"
16:18amalloyapply str
16:18amalloyoh nm
16:19markomani cant say it simpler way. it should return only the user related session data. not all sessions or not only some particular data on user session, but all for user
16:22markomanand it should return it on form of map, not atom. and of course, it should work on all possible situation without deleting or missing data, when several users are getting their session data from same store
16:22clojurebothttp://groups.google.com/group/clojure/msg/fd0371eb7238e933
16:23markomanI think I recall now my problem on this case, I didnt really know, how to update certain part of the atom
16:24amalloylol thanks for the years-old discussion about atoms, clojurebot
16:25markomanif atom has a map {sid1 {} sid2 {}} how can i update only sid2 {} maybe link tells it :)
16:26amalloy&(let [a (atom {:a {} :b {}})] (swap! a update-in [:b] assoc :data 10))
16:26sexpbot⟹ {:a {}, :b {:data 10}}
16:26trptcolinthe fn that atom! takes as an arg can look at the current atom and do whatever it wants with it
16:27raekmarkoman: (swap! a update-in [sid2] <your update function here>)
16:27trptcolins/current atom/current value of the atom/
16:27sexpbot<trptcolin> the fn that atom! takes as an arg can look at the current value of the atom and do whatever it wants with it
16:28markomanamalloy, so I think that would be much better way on session-bind and it should cut out the race condition
16:40markoman:b should be updated with any kind of data, not just one key value pair but :b {:data 10 :tasks [1 2 3]}
16:41markomanwhat kind of update function can do that?
16:41markomani guess not assoc?
16:43raekmarkoman: you want to update something for a certain session and something common to all sessions?
16:43markomansomething for certain session
16:44raekcan you give an example of how the map should look like before and after?
16:47ataggartmarkoman: you probably want update-in
16:47markomansure: before {:sid "35bcf8b4"} after {:sid "35bcf8b4" :flash "message" :count 2 :tasks ["task 1" "task 2"]}
16:48ataggart,(assoc {:sid "35bcf8b4"} :flash "message" :count 2 :tasks ["task 1" "task 2"])
16:48clojurebot{:tasks ["task 1" "task 2"], :count 2, :flash "message", :sid "35bcf8b4"}
16:48markomaneven flash count and tasks are updated one by one, on each request they are retrieved all by one
16:50markomanah ok , you can just put them all in row
16:52ataggart,(doc assoc)
16:52clojurebot"([map key val] [map key val & kvs]); assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector)."
17:01markomani see, now i realize what & kvs means
17:05currentBis there a somewhat clean way to produce an original, quoted form which defines a function from that function object itself?
17:06currentBin otherwords, I have a function object defined with (fn [x] (+ x 1)), is there a way I can get access to that form in a program?
17:07amalloyno
17:07currentBk, thanks
17:07amalloyyou could ask technomancy about his print-dup-able fn, though, if it excites you
17:09technomancyclojurebot: google serializable-fn
17:09clojurebotFirst, out of 6370 results is:
17:09clojurebottechnomancy/serializable-fn - GitHub
17:09clojurebothttps://github.com/technomancy/serializable-fn
17:09technomancy~botsnack
17:09clojurebotthanks; that was delicious. (nom nom nom)
17:11amalloytechnomancy: i can never remember what the dang thing is called, so it's hard to google for. last time i searched for technomancy (or maybe hagelberg?) on the mailing list and filtered manually :P
17:11technomancyit's on Seajure's github too
17:15fliebeltechnomancy: What is that save-env doing?
17:17amalloyfliebel: capturing closed-around values
17:19devnHey all -- I'm trying to add metadata on a def generated by a defmacro
17:19devnhere's a code sample...
17:20devn(defmacro deftemplate [name & forms] `(def (with-meta ~name {:soy true} ) ~(deftemplate-helper forms)))
17:20amalloydevn: move the ~ outside of with-meta
17:21fliebelamalloy: Are these &env and &form some special values?
17:21amalloyfliebel: macros all get them
17:21markomanhillarious bots you have here
17:21amalloyas of, what, 1.2 i think?
17:22RaynesWe have the most awesome bots ever.
17:23amalloyclojurebot: show markoman how well you speak languages nobody else does
17:23clojurebotplease show us that ugt is not broken
17:23amalloyaw
17:23amalloy~maybe like this?
17:23clojurebotGabh mo leithscéal?
17:24markoman:D
17:25markomanmaybe one day she can interpret my english to you
17:26fliebelamalloy: Where is v defined? I see val, but not v.
17:27amalloyfliebel: what? plz context, what code are you talking about
17:27fliebelthe printable function
17:28amalloyit looks like it's .v, a member function. i haven't looked into how &env actually works
17:29markomani was planning new app with lein yesterday, formjure but jury told *jure ends are not available anymore. so i figured it went really bad at some point, lol
17:31livingstondue to an oddity of the rdf spec strings can have a language tag associated with them, for example @en for English. I would really like to just stash that in meta data but no meta data on strings...
17:31RaynesDidn't leiningen remove that restriction a while back?
17:32livingstonany good suggestions? a structure that has a string and a tag seems annoying because I'd like it to generally behave like a String
17:35raekwhat does the spec say about strings with different languages and equality?
17:36livingstonthey are explicitly non-equal (although there is an operator to just get their string guts, which you could compare)
17:37markomanRaynes, version 5 i have still have it
17:37livingstonalso the absence of a tag is not wild card so "foo" != "foo"@en
17:37raekmetadata does not affect equality, so that could be an argument against coding it as metadata of some sort
17:38raekone obvious way could be to represent them as ["foo" :en] or [:en "foo"] (with nil as no language)
17:39raeksince the language tag is really a part of the string data, I'm inclined to be explicit about it
17:40raekanother way could be to skip the vector if there is no language tag. that would force the functions that use them to have cases for both, though
17:40livingstonraek: that's not awful, but I'd kinda like them to behave like strings out of the box as much as possible. I guess I could accommodate "foo" and ["foo" :en]
17:42raekthis does not inhibit you from "massaging" input to the program, e.g. by normalizing "foo" to ["foo" nil]
17:42livingstonright
17:42raekbut I feel that allowing both as the internal representation only complicates matters
17:43raek...and vice versa for prettyprinting output
17:44livingstonmy use case (and what I assume is the most average use case) is that people have data in their language and data with no language tag and that's all they use, so for the most part it's a flag that sometimes caused inequality for no good reason (because there's no way to say just treat the default and mine (e.g., @en) as the same)
17:46raekheh, this reminds me of the name of the country Monaco and Munich, a German city
17:46raekin italian, the name of Munich is "Monaco"
17:46markomanhow do you overline word(s) on .markdown language?
17:48jweiss_i'm figuring out destructuring. but i also want to do some structuring :) as in, i have 5 keyword arguments, i want to return a nested map structure with only the keys that were passed in, in place in the structure. using literals doesn't work because i end up with all the keys, not just the ones passed in.
17:48raek...so, "Monaco"@en and "Monaco"@it are quite different
17:49jweiss_as in, given keys [a b c d e] return {:a a :b :b :c {:d d :e e:} } but leave out keys not provided
17:50livingstonraek: yeah. that's I think what they are getting at. but really I think they should have probably just used different properties so instead of lable and the predicate it could be label-en or label-it that are subs of label etc.
17:51raekjweiss_: the thing you are describing sounds a bit like select-keys
17:51ataggart,(select-keys {:a a :b :b {:d d :e e:} } [:a :b])
17:51clojurebotInvalid token: e:
17:51ataggartbah, whatever
17:51jweiss_yeah i gotcha, that is simple for a flat map, but gets ugly when it's nested
17:52ataggartback to trying to learn scala
17:54raekdestructuring only helps you with extracting the pieces
17:54jweiss_raek: yeah, i said i want to do structuring :)
17:54jweiss_taking pieces and putting them into a structure
17:54raekoh, misread that...
17:55martin_mcgovern\msg nickserv help
17:55livingstonjweiss_: so just use backquote and ~
17:55raekis there a fixed number of nestings?
17:55jweiss_raek, yes
17:56jweiss_the structure is known, the real issue is how to leave out items not provided
17:56raekI would start with the inner one
17:56raekthat should be a simple select-keys
17:56jweiss_actually livingston 's idea makes sense
17:57jweiss_sorta... can't figure out how i'd do it without a bunch of ifs everywhere
17:57jweiss_but that's a start
17:57livingstonI mean assuming it's a fixed transformation or is this for any old list?
17:57raekwhat would syntax-quote add?
17:57raekyou can just have a map literal in your code
17:57jweiss_raek but how to remove keys that weren't provided to my fn?
17:58livingstonactually I think I got confused about the problem.
17:58livingstonhow does it know to make that nested hash?
17:58raekjweiss_: what key does the {:d d :e e:} value belong to?
17:58jweiss_raek: c
17:59raekoh, right. it's right there...
17:59jweiss_so if i call (myfn :a 1 :b 2 :d 3), i want {a: 1 :b 2 :c {:d 3}}
18:00livingstonso you have a hash of hashes ... and a list of keys and you only want the stuff that matches the keys wherever they are?
18:00jweiss_yeah
18:00raek(fn [{:keys [a b c], :as outer-map}] (-> outer-map (select-keys [:a :b]) (assoc :c (select-keys c [:d :e]))))
18:00livingstonin your example how does it get the :c ? and know to nest the :d ??
18:01jweiss_livingston that is what i'm trying to solve
18:02raekjweiss_: ^ that should work, assuming that the involved keys are fixed
18:03jweiss_raek: ok thanks. do ou think there's a way to specify the literal, and transform it in a generic way to get what i want?
18:03jweiss_i mean i know there is
18:03jweiss_ simple way :)
18:04livingstoni still don't follow. if the input is just what's given, then I have to assume you want the first tow out and the rest in a nested hash... then yeah go with something like raek said or just cons it together yourself if you know what the structure is. I either missed something or this is too abstract
18:05jweiss_livingston: i have multiple functions that do similar things, different structures
18:05jweiss_so i'm looking for something more generic
18:05jweiss_sorry one of you asked me that earlier and i gave a misleading answer
18:06raekit is possible with a macro
18:07jweiss_ah well, i was hoping i was missing a straightforward solution. i'll take your suggestions and see what i can do - thanks!
18:07raekso you want something that takes something like {:a _, :b _, :c {:d _, :e _}} and turns it into the code above?
18:08jweiss_raek: yeah, something like that
18:08raekhrm, wait. you only need a macro if you need it to expand into a destructuring form
18:08jweiss_i mean, destructuring already does what i want in that sense
18:08jweiss_except it exposes that structure to my callers, which i don't want to do
18:08raekbut you should still be able to solve the problem with a function
18:08livingstonif it's only 2 or 3 specific keys going to something: `(:a ~(get input :a) ... or create your list with the things your wanted substitued a template and recursively substitue in use your input hash keys/vals as the things to replace
18:09raek(although, in that case, you'd use a bunch of gets instead of destructuring)
18:09jweiss_ok
18:09livingstonok what raek said is now something else... you need to make up your mind ;)
18:10jweiss_sorry i am not sure what raek meant by "the code above"
18:10raekoh, the (fn ...) I wrote...
18:11jweiss_i want a fn that takes the template {:a _, :b _, :c {:d _,
18:11jweiss_ :e _}} and a flat map with possible keys :a :b :d :e and builds the map
18:11jweiss_by replacing _ with the value and leaving out what was not provided
18:12jweiss_oh sorry raek then that isn't what i wanted
18:12raekin addition, destructuring is syntactic sugar for humans. if you need to automate stuff at runtime, it might not be that useful
18:13jweiss_it seems like what i want is pretty common
18:13jweiss_maybe not
18:13jweiss_just a list of optional fn args, and i want to stick them in a datastructure
18:13jweiss_the only thing is i don't want nils where keys were left out
18:14jweiss_i could traverse and remove nils, but that makes nil the "magic" value
18:14jweiss_and won't distinguish if a real nil was passed in.
18:15livingstonmake a macro (key-and-val input :a) then have that macro look up :a in the input if it's there return (:a (get input :a)) if it's not return nil
18:16livingstonthen syntax quote your structure and call that macro where you need it with the stitch in command ~@
18:17markomanamalloy: so i changed session-bind to return session argument without using get. tests didnt fail so it should be ok. thanks for your input
18:17livingstonjweiss_: that's the simplest thing that could possibly work that's quick to code
18:18jweiss_livingston: not seeing how my syntax quoted structure won't have nils in it.
18:19livingstonjweiss_: that's why you splice it in with ~@
18:19livingstonactually if it's not there you need to return '() from the macro probably (not nil, sorry, I still think in lisp)
18:25amalloylivingston: there's nothing wrong with quoting it for clarity, but i'd like to make sure you know that you don't need to quote the empty list: ##()
18:25sexpbot⟹ ()
18:25clizzinare there any clojure libs for bundling AMIs on EC2?
18:26livingstonjweiss_: so you would do `{~@(kv i :a) ~@(kv i :b) :c {~@(kv i :d) ...} where kv takes a hash and a key either returns '() or (list key (get input key))
18:26livingstonamalloy: ah thanks. (like I said, *still thinks in lisp*)
18:26amalloyindeed
18:26livingstonCL that is
18:27amalloylivingston: i showed up last night after you were asking about inspecting clojure .class files. have you used javap?
18:27livingstonno
18:27jweiss_cool, thanks
18:28TimMcamalloy: I should try running a Java disassembler on a clojure class file. :-)
18:28livingstonlast time I seriously programmed java my second edition java in a nutshell was current (enough)
18:28amalloyhttps://gist.github.com/295631
18:28livingstondoes it ship with the jdk
18:28amalloyyes
18:29livingstonsuper cool that would have been useful and exactly what I needed
18:29amalloyheh
18:29amalloybut too late?
18:30livingstonI wanted to look at exactly what clj was compiling as an interface definition
18:31livingstonI was able to see enough with less, then I just called import on the .class file in my repl then show, that did the trick too
18:31amalloylivingston: yeah, show is handy
18:31livingstonI call it constantly
18:31amalloyjavap has options to show you the debugger symbols, like locals and line numbers
18:32amalloywell. maybe not line numbers. but assembly code, anyway
18:32TimMcDoes the JVM have an assembler?
18:33TimMcIs that how JVM compilers work?
18:33TimMcI think I'll write my next program in bytecode. :-P
18:33amalloyTimMc: there's not an assembler that's easy to get access to
18:33amalloybut the clojure.asm package outputs jvm bytecode and then runs it through some library to generate classes from it
18:34livingstonTimMc: byte code. the jvm takes it from there. (as far as I understand)
18:34raekclojure uses the ASM (yes, that's its name) library http://asm.ow2.org/
18:35raekthere's some assemblers out there. I have tried Jasmin a little
18:35raekthough, there doesn't seem be any standardized assembly syntax for the jvm
18:36TimMcCurious.
18:36raekso in clojure's case, the code goes directly from AST to .class-file
18:39raekI really recommend to try to write a class with a JVM assembler and call the code from clojure...
18:39raekit's an interesting experience
18:47TimMcYou recommend this?
18:51livingstonthat's like when someone says, "this tastes awful. see, you try."
19:06livingstonso deftype/record examples show the function definitions being "in-lined" right into the deftype macro, is there any advantage / disadvantage to pointing at some other function?
19:07livingstonif it's a big protocol it seems like this could be a bit messy?
19:08amalloylivingston: reuse existing functions that are useful for multiple protocols. define protocol functions as (comp inc +) instead of explicit (fn) forms
19:09livingstonI'm not quite following the (comp int +) bit?
19:16amalloylivingston: you could implement a protocol function by composing together existing functions
19:17amalloy(extend String Splittable {:split (juxt first rest)})
19:19livingstonI was just wondering about (defrecord Foo [bar] Splittable (split [x] (my-split x))) seems a little redundant.
19:49hiredman~search for reduce
19:49clojurebot<#clojure:raek> ,(reduce (partial merge-with (comp doall concat)) (for [i (range 1878) ] {:a []}))
19:49clojurebot<#clojure:technomancy> yeah, something is lazy even coming out of reduce. interesting.
19:49clojurebot<#clojure:technomancy> ,(reduce (partial merge-with concat) (for [i (range 1878) ] {:a []}))
19:49clojurebot<#clojure:fliebel> mec: Very nice. Now say I want to *update* and not assoc. If it's more than one line, I wrote something that does this already using reduce.
21:34livingstonso I have a root set of functionality and an extension (or two), I have them as two separate protocols, but if I pass objects of these types out to java users they are going to have to constantly cast between the types if they want to use functions in the core with functions in the extension, right?
21:38danbellDoes anyone know of a clojure/tomcat tutorial?
21:46ignacio@danbell: http://stackoverflow.com/questions/1464071/clojure-web-application-where-do-i-start?
21:54danbellignacio---thanks
21:55danbelleventually found a link chain
22:12dnolenlivingston: hmm I'm beginning to think exposing deftype and defrecord to Java users might not be such a hot idea. They aren't meant to be higher-level then what Java can provide.
22:12dnolens/aren't/are
22:12sexpbot<dnolen> livingston: hmm I'm beginning to think exposing deftype and defrecord to Java users might not be such a hot idea. They are meant to be higher-level then what Java can provide.
22:13livingstondnolen: ? higher level
22:13livingstonoh
22:13dnolenlivingston: defrecord specifically has a bunch of magic so that Clojure code doesn't need type hints. Java user don't have any such luck.
22:13dnolener, I mean protocols.
22:13livingstonit can't be that unintended defprotocol automatically generated a java interface to go with it.
22:14dnolenlivingston: I think that's a hosty implementation detail.
22:14livingstonwhat else should I do, create POJOs instead
22:15dnolenlivingston: pre deftype/record/protocols, to expose Clojure goodness to Java people used genclass.
22:19livingstonfrom clojure.org/datatypes "While datatypes and protocols have well-defined relationships with host constructs, and make for a great way to expose Clojure functionality to Java programs, they are not primarily interop constructs"
22:20livingstonalso: "If you use datatypes and protocols you will have a clean, interface-based API to offer your Java consumers. If you are dealing with a clean, interface-based Java API, datatypes and protocols can be used to interoperate with and extend it. If you have a 'bad' Java API, you will have to use gen-class. "
22:21livingstonnone of the documentation says how java users are supposed to deal with typecasting though
22:21dnolenlivingston: hmm, I guess I fail to see how that's true. Since protocols have untyped arguments (except for the first arg).
22:22livingstonthe args aren't the problem. java users can shove anything in and it'll just pass as Object. it's really the return values that are going to be the most trouble
22:25livingstonat least I would think ... I'm not the biggest java programmer.
22:25dnolenlivingston: well if you're record implements two protocols I don't think users will need to do any casting. Not sure about return values.
22:27livingstondnolen: they will if they code to the interface(s) and not the concrete type right?
22:28livingstonconsider iA iB sets of functions, and implementations X and Y that do iA and iB differently. if they just care about A/B functionality and want to abstract themselves from X and Y
22:30dnolenlivingston: yeah but that's true of Java too right?
22:31livingstonpresumably, I supposed. I just wanted to make sure I wasn't missing something to make it easier or whatever.
22:50livingstonif I have a standard let type vector [a 3 b 4] what's the best way to pull the variables out?
22:52pdkwhat do you mean by pull them out
22:53pdkpass them to code outside the let block?
22:53livingstonjust get them in a list or something I just want'ed '(a b)
22:53pdk[a b] then?
22:53pdkremember let returns the value of the last thing in its body
22:53livingstonany sequence is fine
22:54livingstonno sorry that was misleading to say let, I just ment a vector like that (pairs of things) and I want the "keys"
22:56pdkcan you clarify on keys here
22:56sattvik,(keys (apply assoc {} [:a 1 :b 2]))
22:56clojurebot(:b :a)
22:56pdkyou want to grab items 0 2 4 etc out of a list?
22:56amalloylivingston: ##(take-nth 2 '[a 1 b 2])
22:56sexpbot⟹ (a b)
22:56livingstonthat's what I was looking for, thanks amalloy
22:57livingstonsorry for the confusion everyone.
22:57livingstonthere's always an easy way to do that but I can never remember
22:57clojurebotPardon?
23:04livingstonis this the best way to combine two vectors and get one out? (vec (concat '[a b] '[3 4]))
23:06amalloylivingston: ##(into '[a b] [3 4]) is better if you're sure that (at least) the first one is a vector, but these are all linear-time; concatenating vectors is difficult to do at the source level because it's not performant
23:06sexpbot⟹ [a b 3 4]
23:07livingstoncool. they are short and they are in macros ... so they can be slow (er)
23:29livingstoncan anyone tell me why this isn't working: https://gist.github.com/911074
23:33amalloylivingston: i can't really look in detail, but (~args ~@special-args) looks suspicious
23:34amalloyas does (~(vec ...))
23:35livingstonargh I'm an idiot... there's an extra paren in (concat (special-vars args)) .. should be (concat special-var args) and I'm good
23:36livingstonbasically I want to make a function that if you call with out the special args it just gives you defaults, but if you call with new values for the special args, it needs to bind them too, so that downstream calls will get them too
23:38amalloylivingston: would it do any harm to bind the specials when you use the default?
23:38livingstonno
23:39amalloyyou might be able to use ##(doc fnil) then
23:39sexpbot⟹ "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take... http://gist.github.com/911078
23:39livingstonbut if they are getting called with any frequency or depth it seems like a lot of bindings to stack up.
23:42livingstonoh that's a little weird, no I want something more like partial I think
23:43amalloymkay
23:43livingstonit's the first arg that I'm binding with a special (global) var. so if the user doesn't care (or know the first arg) they get the default (and they call it with one less arg)
23:48joshua__Hmm. I'm doing a commit in my local git repository and it isn't making it origin/master etc. When I try to push the changes it says everything is up to date. I don't get it.
23:52amalloyjoshua__: you probably haven't done a git add. what's git status show?
23:52joshua__amalloy, It says nothing to commit.
23:53amalloyjoshua__: and git log shows the commit you want to push? in that case git push origin master should work
23:56joshua__amalloy, Says "Everything is up to date." Doesn't push my commit.
23:56joshua__amalloy, Thus, the confusion.
23:57amalloyjoshua__: you can ask in #git. if the branch you're on locally is master, and your log shows the commits you want to push, then i don't know the right questions to ask :P