#clojure logs

2012-05-09

00:06mmarczykdnolen: ping
00:07dnolenmmarczyk: pong
00:09mmarczykdnolen: so what's the benchmarking story?
00:09dnolenmmarczyk: which part?
00:09mmarczykdnolen: the deoptimization-triggering part
00:10mmarczykdnolen: not sure if I understand what you were referring to, although it seems like maybe that would explain some of the results I was seeing in node (things which made :simple faster making :advanced slower etc.)
00:10dnolenmmarczyk: have you looked at this http://jsperf.com/direct-vs-chain/4
00:10dnolen?
00:11mmarczykdnolen: yes
00:13dnolenmmarczyk: just that putting too many non-function properties on the prototype seems to trigger deoptimization
00:13mmarczykdnolen: but only just, haven't properly digested it yet
00:14dnolenmmarczyk: I seemed to encounter this - I had briefly added yet another prototype.flag = true, and things seems to slow down strangely.
00:14dnolenmmarczyk: benchmark seems to confirm what I saw.
00:15mmarczykdnolen: I see
00:16mmarczykdnolen: so piling cljs$lang$foo props on prototypes is not sustainable; all the more reasons to try and squeeze things into masks?
00:16mmarczyk*reason
00:18dnolenmmarczyk: well it's only a problem in V8 seems like
00:19mmarczykdnolen: an unusual occurrence.
00:19dnolenmmarczyk: more a reason to use only masks for inline protocol implementations - perhaps fall back on prototype flag for dynamic cases.
00:21mmarczykdnolen: so, for inline definitions where we know the masks will include the appropriate bit there's no reason to put any extra flags on the prototype
00:21dnolenmmarczyk: yes
00:21dnolenmmarczyk: we can use flags for non-inline extension to support interactive development.
00:22mmarczykdnolen: worth investigating if instead of flags prototype-attached masks could be used?
00:22dnolenmmarczyk: I don't think so, I think non-inline extend-type should probably always use flags.
00:23dnolenmmarczyk: otherwise you'll get inconsistent instance construction behavior.
00:23dnolenmmarczyk: mask is static information that can only affect new instances.
00:23mmarczykdnolen: well if it gets placed on the prototype then it no longer is, right?
00:24dnolenmmarczyk: if it get placed on the prototype then all instances get the new behavior.
00:24dnolenmmarczyk: not true for protocol masks.
00:24mmarczykdnolen: yes, I think we've discussed it previously
00:24mmarczykdnolen: so I'm thinking about having the instance-attached masks for top speed of inline impls and a prototype-attached mask (family of masks) as a fallback
00:25dnolenmmarczyk: oh sorry, misunderstood what you were saying.
00:25dnolenmmarczyk: prototype-attached mask - good idea.
00:26mmarczyk:-)
00:26dnolenneotyk: ping
00:26mmarczykdnolen: ok, in that case, I'll put something together today
00:26dnolenmmarczyk: cool!
00:26dnolenmmarczyk: you should remove the flags if you do that.
00:27mmarczykdnolen: right
00:38dnolenat long last you bootstrapping ClosureScript will use a newer version of GClosure.
00:41mmarczyk! :-)
01:05emezeskeibdknox: ping
01:05ibdknoxemezeske: only got a minute or two, what's up?
01:06emezeskeibdknox: any plans for a jayq release in the near future?
01:06ibdknoxI'd be happy to
01:06ibdknoxI'll push one later tonight
01:06emezeskeYou the man!
01:14zakwilsonibdknox: you write *lots* of libraries. Don't stop.
01:17muhoowhat was that business where lazy seqs work in the repl but FAIL everywhere else?
01:18muhooi remember reading about it, but not how to work around it
01:19muhoohm, dorun maybe
01:19muhoonope, that's not it. dang
01:20emezeskeIt's not that they fail everywhere else, it's that they're lazy, and don't do work unless a result is actually used
01:20emezeskeYou can force things with doall I believe
01:21emezeskemuhoo: ^
01:21jlongsteranyone interested in helping me figuring out some issues with my CPS transformer?
01:22muhoodoall! thanks
01:25muhoohmm, not working still
01:25muhooworks great in repl, not elsewhere. i'll have to keep digging
01:28muhooit's returning empty seqs
01:29eggsbyhey, is there any 'replace nth' function in the core library?
01:29eggsbygiven the nth value of some seq, replace with some other value
01:31eggsby(replace-nth (list 1 4 3) 1 2) ;; => (1 2 3)
01:31xeqi&(assoc [1 4 3] 1 2)
01:31lazybot⇒ [1 2 3]
01:32muhoohah! fixed.
01:32xeqiwell, doesn't work on lists
01:34muhooit is also WAY past time for passing around {:key value} pairs, and time to start using defrecord instead :-/
01:36emezeskemuhoo: You working on something performance critical?
01:44eggsbythank you xeqi
01:50muhoono, just a website.
01:50muhooand, i found another interesting thing. if i have a bug that causes an ns to not compile, noir often will simply not tell me
01:50amalloyjlongster: i'm far from an expert in CPS, but i have a vague understanding of the style and can often be helpful on sort of "general" issues, i suppose. perhaps if you gisted a description of your problem/code, someone could figure out whether they're capable of helping
01:50muhooit will run the OLD version of the code
01:50muhooif i run "lein2 check", sure enough i see the compile error
01:51muhoobut page refreshes won't actually throw a stacktrace. it'll just happily run whatever version was previous, causing me to scratch my head in confusion
01:51muhoonew habit: run lein2 check OFTEN, or (require 'nsname :reload-all) in the repl
01:51jlongsteramalloy: great! I gisted it a while ago, and just put up a new version: https://gist.github.com/2642050
01:52jlongsteramalloy: I'm writing in a Lisp that compiles to javascript, and didn't know how to handle set! and define without passing around environments
01:52jlongsterbut I think I figured it out
01:53jlongsterI generate non-CPS `define` and `set!` so that the scoping works. not completely valid CPS, but serves my purposes
02:16ForSparePartsWould someone mind explaining transients to me? I get how you create them and that they have a parallel set of operations, but I don't understand what's actually *different* about them.
02:26raekForSpareParts: the transient operations may modify some parts of the data structures in-place
02:32echo-areaWould anyone like to comment this one: http://pastebin.com/rsbDev0d ?
02:34alexbaranoskyecho-area, what do you need from the paste in particular?
02:34echo-areaThat's my paste. I just want your opinion about this program.
02:34echo-areaSuggestions, critics etc
02:35echo-areas/critics/critiques/
02:35muhoohmm, what does this binding form do: (let [{foo :bar} something] ...) ?
02:36echo-areamuhoo: Taking :bar from something and bind it to foo
02:36echo-area*binding
02:37muhooah, cool, thanks
02:39alexbaranoskyecho-area, ok will do
02:40alexbaranoskyecho-area, I'm going to be nitty picky
02:41echo-areaSure
02:41alexbaranosky(defn dropping-transform [fn coll] ;; fn is non-standard here, f is more common
02:41echo-areaOkay
02:41alexbaranoskycus it is less confusing since fn has another meaning
02:42alexbaranosky(when-let [[first & rest] (seq coll)] ;; might not actually need 'seq' here
02:42alexbaranoskytry it out, and let me know if that's true
02:42echo-areaOkay
02:43alexbaranoskyI think dropping-transform is already in core.clj as `keep`
02:43alexbaranoskyjust like map, but any nil results won't be in the resulting seq, right?
02:44alexbaranoskyread-next-line is hard to read because it is so long, and has that big anonymous fn in it
02:44alexbaranoskyecho-area, I'd pull that fn out and name it
02:45amalloydropping-transform is a non-lazy version of keep, for whatever reason
02:45echo-areaalexbaranosky: (when-let [[first & rest] coll] <-- This works
02:46amalloyand he does need to call seq at least once
02:46amalloyeither in the when-let, as he is now, or in the initial binding of the loop
02:46alexbaranoskyamalloy, howdy
02:47amalloyecho-area: if you just take out that seq, your function breaks on empty sequences
02:47echo-areaamalloy: You mean `keep'?
02:48alexbaranoskyprobably better to do the seq in (loop [coll (seq coll)] ...), right?
02:48alexbaranoskyso it is only done once?
02:48echo-areaamalloy: Oh I see what you meant.
02:48amalloyalso, it doesn't look like you need dropping-transform at all? you could just (let [lines (filter interested-line? (line-seq reader))] ...)
02:48amalloyalexbaranosky: yes, if he wanted to rewrite keep, that would be best
02:48amalloybut since keep already exists, and he actually wants filter instead of keep, i'd just junk the whole thing
02:53echo-area`keep' and `filter' are better than my own solution. Thank you guys amalloy and alexbaranosky
02:54echo-areaThere seems to be always "corner functions" that I don't know about, I think I need to read core.clj
03:01brainproxyanybody in chan that devs with nodejs in addition to clojure? want to give something a shot?
03:54kralmorning
03:56PeregrinePDXmorning
03:59robertstuttafordi have an xml document, and i want to convert it to json, and move a couple nodes around, and rename a couple nodes. clojure.zip, right?
04:49echo-areaIs it idiomatic to write (= v (int \Q)) in Clojure? Will (int \Q) be compiled to 0x51?
04:51AWizzArdecho-area: int is a function call, and will be evaluated during runtime.
04:52AWizzArdThe good thing is: if Oracle changes the integer value of \Q the program will still work correctly.
04:52robertstuttafordwhat's the best way to pretty print json? i see clojure.contrib.json has pprint-json but i get the feeling it's old
04:52AWizzArdrobertstuttaford: do you really need to pprint the json? Would it be acceptable for you to convert the json to Clojure and pprint that? It looks nearly identical, only that Clojure is a bit better.
04:53echo-areaAWizzArd: So what's the idiomatic way to express that? Also, I notice there is :inline key in `int''s meta, when will it be used?
04:53robertstuttafordspecifically writing code that produces json
04:53robertstuttafordfor consumption by javascript app
04:53clj_guest2012is there a way to telnet to a clojure-swank session? (instead of using it from emacs)
04:53clj_guest2012basically,, I want to be able to send commands to my swank-clojure using vim via the "nc" commands
04:53clj_guest2012so I need to figure out what protocol swank uses
04:53clj_guest2012and send commands that way
04:54robertstuttafordthanks AWizzArd. i can get the structure right using clj forms and then convert right at the end.
04:56AWizzArdrobertstuttaford: some/most json libs will probably produce compressed output, i.e. not human-readable.
04:57AWizzArdecho-area: to express what? What you did looks pretty good to me.
04:57AWizzArdecho-area: or you want the 0x51 compiled into your code?
05:01echo-areaAWizzArd: Maybe I'm wrong, suppose `v' is a byte typed variable, is there any run-time cost besides comparing in Java in expression "v == 'Q'"?
05:02echo-areaIf not, I want to express in Clojure the same purpose, and have the same effect -- no any other run-time costs besides comparing
05:09MadsyIf I encapsulate a proxy in a function and call it several times, will it make N new classes, or reuse the "type" from the first invocation?
05:09MadsyI wonder which practice is the best to follow when I need several instances of a thing.
05:09AWizzArdecho-area: the run time costs are very small. The value of v needs to be looked up and int needs to be called on the char \Q. Then those can be compared.
05:10AWizzArdMadsy: it will create new instances.
05:10AWizzArdMadsy: are you sure that you need proxy? If the original Java API was designed well then reify is what you want.
05:11AWizzArdUnfortunately trillions of Java APIs are bad.
05:15MadsyAWizzArd: Thanks
05:15echo-areaAWizzArd: So there's no other way to eliminate that cost, except writing like (= v 0x51)?
05:15MadsyAWizzArd: Yeah, I only need to specify callbacks and similar in Java Swing
05:16AWizzArdecho-area: you can run (int \Q) before compilation. Two possible ways: (= v #=(int \Q)) or: write a macro.
05:17AWizzArdMadsy: in Swing both approaches are required: proxy and reify.
05:17AWizzArdMadsy: well, you can always use proxy, as reify is only a subset of proxy. But it is more efficient, and documents your code for other developers by using reify.
05:18echo-areaAWizzArd: Oh, thanks
05:19MadsyAWizzArd: Guess I'll just have to experiment a bit and see what works best.
05:23echo-areaAWizzArd: And another question: where could I find the list of reader macros? Currently I can only find it in core.clj, but after your hint
05:27robertstuttafordnewbie question about recursion: https://gist.github.com/2643276
05:33espeedI'm trying to run a regexp on a Groovy source file to parse out the individual functions. This is the pattern I'm using: (def pattern #"(?m)^def.*[^}]") however, it's only grabbing the first line, not the multiline func
05:36Chousukemy first thought was to not use regexps for parsing :p
05:37Chousukeit will probably be a lot easier and more maintainable if you use some parser combinator library. :)
05:44Chousukeespeed: are you sure it's not stopping the matches on newlines by default or something?
05:45espeedI thought the (?m) flag is supposed to enable multiline
05:51robertstuttafordi want to copy all key/value pairs in one map to another. how would i do that?
05:52robertstuttafordor, put another way, i have {:attrs {:one 1 :two 2} :content nil} and i want {:one 1 :two 2 :content nil}
05:57AWizzArdecho-area: on the Clojure website most reader macros are listed. Rich explicitly did not list the #= reader macro there, which forces the reader to evaluate an expression during read-time.
05:59echo-areaAWizzArd: Okay. So I have to read more Clojure implementation to know these..
06:32Borkdudetechnomancy: is lein2 repl :connect supposed to work in windows?
06:35Borkdudetechnomancy: getting this error https://gist.github.com/2643628
06:38jonaskoelkerwhy would you want to evaluate an expression at read-time?
06:38Borkdudetechnomancy: even with a normal "lein2 repl" I get it
06:39Borkdudejonaskoelker: when you want to pass something in a macro that you want to be evaluated before the macro sees it?
06:40clgvBorkdude: the macro can also decide to eval something (if that makes sense)
06:40jonaskoelkerwhen does that come up?
06:41clgvit sounds strange, since a macro is intended for the opposite purpose: not to evaluate the params ;)
06:41Borkdudejonaskoelker: it comes up.. can't think of any good examples right now ;)
06:44jonaskoelkerso... (println #=(+ 2 2)) would read the same way as (println 4)?
06:44Borkdudejonaskoelker: yes
06:44jonaskoelkerand if I evaluate defmacro at read-time I can use macros while reading too?
06:44Borkdudeexcept that println is already a function
06:44jonaskoelker?
06:45Borkdude,(source println)
06:45clojurebotSource not found
06:45Borkdude&(source println)
06:45lazybotjava.lang.RuntimeException: Unable to resolve symbol: source in this context
06:45Borkdudewell anyway, it's a function
06:45jonaskoelkerthe significance of that being? That it's not an example of read-time macros?
06:45Borkdudejonaskoelker: a function already evaluates all of its arguments before doing anything else
06:46Borkdudeor better said: they are evaluated before the function sees them
06:46jonaskoelkersure, but you get read-time constant folding :)
06:46jonaskoelkerteh speedz
06:47Borkdudeif you want speed, go program assembly ;)
06:47jonaskoelkeroh my god, lisp is slow!! XD
06:48Borkdudeyour brain is always slower
06:49jonaskoelkerhm?
06:49Borkdudenot your as in personally you, just mankind in general
06:49jonaskoelkerI agree, but don't see how that enters the picture?
06:50jonaskoelkerI just woke up, so hopefully I'm allowed to be slow :D
06:50Borkdudejonaskoelker: it doesn't really (development speed vs performance)
06:51jonaskoelkerah, 'k
06:56jonaskoelkerhello, Rich. Nice work on clojure! One of those little things I love (and have thought of independently): vectors having integer keys. Python has always bugged me with .keys() vs. range() and .items() vs enumerate()
06:58Borkdudejonaskoelker: do you want to repeat what you said earlier about lisp now? ;)
06:59jonaskoelkersure: "oh my god, lisp is slow!! XD"
06:59jonaskoelkerBorkdude was dissing the speed advantage of using read-time evaluation for constant folding :)
08:28N8DawgHello room, I often end up writing the following in my code: (if (p x) (f x) x) where p is a predicate and f a function to apply
08:28N8Dawgis there a standard way to express this, e.g. a macro i'm missing?
08:29gfredericksN8Dawg: I don't think anything in the standard lib, but flatland/useful has something in the flatland.fn namespace
08:29gfredericksspecifically fix
08:29N8Dawgfix is the name of the function?
08:29gfredericksyes
08:30N8Dawgthanks! would be nice to have this in core
08:31clgvN8Dawg: N8Dawg: 'alter-when or 'modify-when would be a good name. I vote for core inclusion ;)
08:32N8Dawgactually I just looked at the fix function in flatland
08:33N8Dawgits really good, solves what i want and is more generic
08:33clgvoops. wanted to address gfredericks as well
08:33echo-areaI define a proxy to java.io.InputStream, and only define `int read()', but call to `int read(byte[] b, int off, int len)' (which calls the former in InputStream's implementation) results in `Wrong number of args (4) passed to: xgp-test$make-hdfs-input-stream$fn'
08:33echo-areaWhat could be the reason?
08:35clgvecho-area: snippet?
08:35echo-areaStack backtrace is here:
08:35echo-areahttp://pastebin.com/AhBvnqFR
08:35echo-areaclgv: Code?
08:35clgvjep
08:35clgverr. yes ;)
08:36echo-areahttp://pastebin.com/pquJcHdm <-- This is the code
08:37echo-areaFWIW, http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html is where InputStream's doc resides
08:39echo-area(I haven't added type hints yet)
08:43jweissany CCW users here? is there a way to pop up documentation for the symbol at point in the editor (or in the repl?) i can tab complete, but what about symbols in source that i'm trying to read (not write)?
08:44clgvecho-area: line 30 seems odd. shouldnt it be (. inbuf read) or (.read inbuf)?
08:44jweissalso i note that if a symbol uses an alias namespace like (require 'clojure.zip :as zip) i can't complete names starting with zip/ ?
08:44clgvecho-area: you should decide for one of the two notations and stick to it
08:45echo-areaclgv: Oh yes, that one is wrong. But when the exception gets thrown, that hasn't be reached yet
08:46echo-areaclgv: Got that fixed, but the exception is still there :(
08:47clgvecho-area: try to narrow down where exactly it comes from - I cant spot it in the snippet
08:47echo-areaat java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
08:52robertstuttafordany one fancy deodorising this bad code smell? https://gist.github.com/2644284
08:54dnolenrobertstuttaford: just call flatten-attributes-and-remove-tag with the result of if.
08:54dnolen
08:54robertstuttafordgah. of course
08:56echo-areaclgv: at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
08:56robertstuttafordi'm really enjoying this. 15 years of imperative programming can go jump!
08:56echo-areaThis line of backtrace corresponds to line 273 of this file: http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/7634c063db13/src/share/classes/java/io/BufferedInputStream.java
08:56jonaskoelkeryay, a new convert! :)
08:56tmciverrobertstuttaford: also, I see no reason why you couldn't put the if inside the ->
08:57echo-areaclgv: It calls `in''s `int read(byte[] buf, int off, int len)' method
08:57clgvecho-area: is your read-implementation even called?
08:57echo-areaHere `in' is my proxied class instance.
08:57echo-areaclgv: Yes
08:58tmciverrobertstuttaford: hmm, nvm. It's more complicated than I thought . . .
08:58echo-areaclgv: Oh, maybe no
08:58robertstuttafordtmciver: the -> puts node in as if's first arg, causing if to have 4 args, one too many
08:59Chousuke_robertstuttaford: if (:content node) is never 'false' then it's more idiomatic to just do (if (:content node) ...) rather than comparing explicitly with nil
08:59echo-areaclgv: As you see from here line 161,170: http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/7634c063db13/src/share/classes/java/io/InputStream.java, `int read(byte[] buf, int off, int len)' should call `int read()'
08:59robertstuttafordit can either be nil or a vector. does what you say apply to that?
08:59Chousuke_yes
08:59echo-areaclgv: Which is defined in my proxy form
09:00Chousuke_all non-nil things that are not boolean false are considered truthy
09:00robertstuttafordwicked :)
09:00robertstuttafordthank you for that
09:00Chousuke_so a common idiom is just to use (if-not some-val ...) of (if some-val ...)
09:01robertstuttafordoh, right, if-not
09:01robertstuttafordi need to spend some time reading the apis
09:01echo-areaclgv: But it seems that somehow the three-argument method is not called, instead the invocation is forwarded directly to my no-argument method, hence the exception
09:01clgvecho-area: hmm proxy generates empty implementations returning nil for unspecified methods of an interface, right?
09:01echo-areaclgv: Is that a question? I'm not sure
09:01Chousuke_robertstuttaford: also #(convert-nodes %) is equivalent to convert-nodes :)
09:02echo-areaclgv: I indeed tried to catch up by defining also argumented read method
09:03jonaskoelkerChousuke_, robertstuttaford: that is not true for variadic java methods, I think. E.g. (every? Character/isBlank mystr) vs. (every? #(Character/isBlank %) mystr)
09:03echo-areaclgv: But got IllegalArgument exception saying "No matching method found" at all times
09:03Chousuke_jonaskoelker: java methods are not functions
09:03jonaskoelkerChousuke_: and that would be a good explanation :)
09:03robertstuttafordChousuke_: of course, thank you!
09:04clgvecho-area: ah well, InputStream is an AbstractClass and no interface - so forget the previous question
09:04echo-areaclgv: And the three-argument variation of read is not unspecified, it is default in InputStream.
09:04echo-areaclgv: Okay
09:04Chousuke_jonaskoelker: of course, there could be compiler magic that makes that work but it would kind of conflict the "as is" nature of java interop in Clojure :P
09:04jonaskoelkerrealising that I'm probably talking about contexts other than robertstuttaford's, in case of (map #(conv-nodes %) foo bar) this might not be same, right Chousuke_?
09:06jonaskoelkerChousuke_: would it? How so?
09:06Chousuke_jonaskoelker: in that case conv-nodes is clearly a function and you don't need the fn shortcut.
09:06jonaskoelkerChousuke_: right, but conv-nodes might be variadic, whereas #(... %-and-no-%2) isn't, right?
09:06clgv echo-area: a general advice: try to get that code a minimal as possible but still failing for the same reason. the error will be easier to spot
09:07clgv*as minimimal
09:07clgvargs. nvm
09:07Chousuke_jonaskoelker: that doesn't really matter, since it will only get called with as many parameters as you give seqs to map, just like the anonymous function you create
09:07jonaskoelkerclgv, echo-area: and (barging in uninformedly from left field) if at all possible sprinkle the code with printf
09:07jonaskoelker,(#(println %) 1 2)
09:07clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox$eval28$fn>
09:08Chousuke_though I suppose you would get a different effect if you were to write #(foo %2)
09:08jonaskoelker,(#(println %2) 1 2)
09:08clojurebot2
09:08jonaskoelker,(println ((fn ([x] x) ([x y] y)) 1 2))
09:08clojurebot2
09:08jonaskoelker,(println ((fn ([x] x) ([x y] x)) 1 2))
09:08clojurebot1
09:08clgvecho-area: you can also try tracing via clj-debug
09:08jonaskoelkerseems (subtly) different
09:09echo-areaclgv: Oh, let me see what clj-debug is
09:10clgvecho-area: hmm well maybe not. It has no support for proxies yet.
09:11echo-areaclgv: Ah, okay
09:11jonaskoelker(into @shower 'me)
09:12echo-areaclgv: Let me try a toy proxy then
09:12TimMcjonaskoelker: (swap! me update-in [:location] :shower)
09:14clgv(comp shower me) ;)
09:15dnolenCLJS analysis now follows dependencies - should now direct dispatch everywhere if you're using :static-fns true or :optimizations :advanced
09:17echo-areaclgv: http://pastebin.com/PLDUKVH5 <-- This is the one simple failing snippet. Let me look into it.
09:23clgvecho-area: If you have time, post it on the mailinglist
09:25echo-areaclgv: Okay, I'll do some experiments first to see if I (we) miss anything
09:26clgvecho-area: it could be an error in io/reader
09:28echo-areaclgv: No, with that second simple definition I get the exception by manually evaluating (.read f1 (byte-array 3) 0 3) (But there's an error in that one, i.e. the use of (int \a))
09:28echo-areaAlthough evaluating (.read f1) works fine
09:29clgvecho-area: My guess is that the InputStream works fine on its own. but not inside the reader
09:30echo-areaLet me see if I can do it here
09:30echo-area&(let [p (let [count (atom 0)]
09:30lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
09:30echo-area (proxy [java.io.InputStream] []
09:30echo-area (read []
09:30echo-area (if (< (swap! count inc) 10)
09:30echo-area 97
09:30echo-area -1))))]
09:30echo-area (.read p))
09:30echo-areaOh, what a pity
09:30echo-area&(let [p (let [count (atom 0)] (proxy [java.io.InputStream] [] (read [] (if (< (swap! count inc) 10) 97 -1))))] (.read p))
09:30lazybotjava.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.DynamicClassLoader
09:30jonaskoelkerTimMc, clgv: apropos, (conj twin nurse-south-park) ;-)
09:30jonaskoelkeroops, n-from-s-p
09:31echo-area&(let [p (let [count (atom 0)] (proxy [java.io.InputStream] [] (read [] (if (< (swap! count inc) 10) 97 -1))))] (.read p))
09:31lazybotjava.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.DynamicClassLoader
09:31echo-areaclgv: So I can't do it here
09:32clgv,(let [p (let [count (atom 0)] (proxy [java.io.InputStream] [] (read [] (if (< (swap! count inc) 10) 97 -1))))] (.read p))
09:32clojurebot97
09:32teromecho-area: your last example works in my REPL
09:32echo-areaCool
09:33echo-area,(let [p (let [count (atom 0)] (proxy [java.io.InputStream] [] (read [] (if (< (swap! count inc) 10) 97 -1))))] (.read p (byte-array 3) 0 3))
09:33clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: sandbox$eval56$fn>
09:33echo-areaBut this doesn't work
09:33echo-areaIt is supposed to work, isn't it?
09:34clgvhummm, extending abstract class in proxy - should be possible afair
09:37clgv,(let [p (let [count (atom 0)] (reify java.io.InputStream (read [this] (if (< (swap! count inc) 10) 97 -1))))] (.read p))
09:37clojurebot#<CompilerException java.lang.IllegalArgumentException: only interfaces are supported, had: java.io.InputStream, compiling:(NO_SOURCE_PATH:0)>
09:40robertstuttafordi know select () { case, case case } is bad form in clojure, and one should opt for using polymorphism, but how would i do a simple branch like this anyway?
09:40robertstuttaforderk, not select, but switch
09:41robertstuttaford(if cond1 (action) (if con2 (action)) etc?
09:42dakronerobertstuttaford: check out (cond ...) and (condp ...)
09:42clgvrobertstuttaford: 'case or 'cond
09:42robertstuttafordpoifect, thanks
09:43duck1123then there's always multi-methods, which would be another way to do this sort of thing. (but a little different)
09:44duck1123but cond is what you're probably looking for
09:44robertstuttafordyeah. i read the multimethod section of The Book two nights back. something i'm going to have to mess around with to fully grok
09:53echo-areaHmm, how to sign up a bug report?
09:54echo-areaI didn't find it on clojure's dashboard..
09:54TimMcMaybe you need to sign the CA.
09:56echo-areaHow?
09:56clojurebotwith style and grace
09:56echo-areaHow to sign a CA?
09:56TimMcIt's irritating. :-/
09:57TimMcPrint out the Contributer's Agreement, fill it in, mail it to some address in North Carolina, wait.
09:57echo-areaOh, sorry for that
09:57echo-areaCan I scan it and send an email?
09:57TimMcNope.
09:57TimMcNor fax, as far as I know.
09:57echo-areaOh.
09:57TimMcStupid lawyers.
09:58TimMcMaybe someone who has already signed one can file a Jira ticket for this issue.
09:58echo-areaCan you?
09:58TimMcI don't understand the issue. :-)
09:59echo-areaWould you like to take some time to understand it :)
09:59TimMcWhere's a failing example?
09:59TimMc09:31? (now=09:59)
10:01echo-areaWhat's that? I'm preparing one, please hold, thanks
10:05TimMcecho-area: https://www.refheap.com/paste/2665
10:05TimMcArityException Wrong number of args (4) passed to: core$eval181$fn clojure.lang.AFn.throwArity (AFn.java:437)
10:05TimMc^ Is that the issue?
10:06echo-areaTimMc: Yes, but I made a simpler one here: http://pastebin.com/PE23deX5
10:07TimMchttps://www.refheap.com/paste/2666 <-- showing failure to override.
10:07echo-areaYes
10:07echo-areaDo you think this is an issue?
10:10TimMcIt certainly seems to be a bug.
10:10TimMcThis might be related: http://www.mail-archive.com/clojure@googlegroups.com/msg13106.html
10:12jsabeaudryIs there a performant way to shell out? (time (clojure.java.shell/sh "ls")) is over 50 msecs on my system...
10:12jsabeaudrySeeing that "time ls" is only 7 msecs
10:12jsabeaudryThere has to be a better way
10:13echo-areaTimMc: Yes, exactly the same issue.
10:19clgvjsabeaudry: did you benchmark it with repeated calls?
10:20clgv(time (dotimes [_ 1000] (clojure.java.shell/sh "ls"))) => "Elapsed time: 2046.530856 msecs" - so 2ms per call on average
10:20echo-areaTimMc: It's 22:25PM here and I want to go home. Please help me sign up that issue, thank you very much.
10:21TimMcYeah, I can do that.
10:21echo-areaBye. Good night.
10:21clgvecho-area: an easy fix to your problem is writing that particular class in java ;)
10:21TimMcclgv: You must have more Pentiums than I do. I get 8ms. :-P
10:22echo-areaclgv: Yes, which I will do next. Bye :)
10:22TimMcOr gen-class.
10:23jsabeaudryclgv, yeah, ok, I get 11 msecs average with that kind of benchmark, but when a request hits my server and it does 5 of them I still have 350msecs spent (70 msecs if I remove the shell calls)
10:23TimMc(22:25PM, that's *super* late)
10:24clgvjsabeaudry: well if you have more of them it will improve
10:24TimMcThe more you spend, the more you save!
10:25TimMcjsabeaudry: Seems a bit pricy, yes.
10:26clgvjsabeaudry: can you combine those shell calls to one?
10:26jsabeaudryclgv, that's a good idea, I guess I can write a shell script that will combine them and call that shell script
10:42goodieboyanyone using slingshot? https://github.com/scgilardi/slingshot
10:43TimMcgoodieboy: Trivially here as well.
10:45jweissgoodieboy: i use it
10:47Null-A_goodieboy: i used it
10:47goodieboygood to know thanks
10:48Null-A_it worked beautifully
10:48Null-A_pallet uses it too
10:48goodieboyany problems? It solves a problem perfectly for me, and I don't want to re-invent the wheel
10:48goodieboygood!
10:48Null-A_never had any
10:49Null-A_if you look at the implementation it's tiny
10:49Null-A_it's very easy to fix if you run into bugs
10:49Null-A_that sort of my attitude about cutting edge clojure libraries
10:49Null-A_if i can easily fix it
10:51goodieboyNull-A_: yeah, just browsed the source. Couple of lightweght macros there. I'm going to give it a try.
10:58TimMcNeeds an RTE unwrapper, but that's all.
11:03pbuckleyI'm trying to do the equivalent of "find . -name pom.xml" using the fs library in clojure
11:04pbuckleyand I thought that glob was what I needed, but it doesn't seem to recurse down into folders
11:04pbuckleyanyone know if it's likely I'm just not globbing right or if I need to put it together with walk?
11:04S11001001glob typically doesn't, the ** thing is a nonstandard extension
11:05pbuckleyS11001001: ok, thanks, I'll try walking the dirs
11:09robertstuttafordi have a seq of maps, each with one key. i want to put each map's key + value into a separate map
11:10robertstuttafordand then return that separate map with all the key and values together
11:10robertstuttafordhow would i do this? here's a before and after: '({:a 1} {:b 2} {:c 3}) ; i want {:a 1 :b 2 :c 3} from this seq
11:10robertstuttafordack
11:11cfa=> (into {} '({:a 1} {:b 2}))
11:11cfa{:a 1, :b 2}
11:11robertstuttaford:o is it really that simple?!
11:12robertstuttafordswearwords
11:12robertstuttafordi've been trying to figure this out for 20 minutes!
11:13robertstuttaford-sigh- baby steps robert, baby steps!
11:14dakrone,(merge {:a 1} {:b 2})
11:14clojurebot{:b 2, :a 1}
11:16robertstuttafordthanks guys
11:19timvisherany way to annotate a function as deprecated?
11:21Null-A_timvisher: clojure does this: (defn replicate
11:21Null-A_ "DEPRECATED: Use 'repeat' instead.
11:21Null-A_ Returns a lazy seq of n xs."
11:21Null-A_ {:added "1.0"
11:21Null-A_ :deprecated "1.3"}
11:21Null-A_ [n x] (take n (repeat x)))
11:21Null-A_timvisher: not sure what the consequences are
11:21timvisherso you use the metadata, that'll work for me. :)
11:24clgvNull-A_: please use some paste website
11:38gfrederickshuh. I did not know about that metadata syntax.
11:42nDuffUgh.
11:43nDuffnoir including all of ring -> embedded Jetty (and javax.servlet.*) conflicting with the one I'm trying to load my servlet into
11:44clgvgfredericks: the defn macro is worth a read for this. ;)
11:45clgvnDuff: you can use :exclusions in the project.clj to exclude jetty
11:47bhenry1what hierarchy is above persistenthashmap and persistentarraymap so that i can move on if i see either one of those?
11:47bhenry1or do i just have to use an or?
11:49Null-A_bhenry: (map? ..) not sure
11:52bhenryhahahahaha thanks Null-A_. duh. i was using instance?
11:52Null-A_:)
12:01yonkeltronwho had mentioned rust a few weeks ago?
12:01yonkeltronrelevant link covering a few differing new native languages: http://www.drdobbs.com/slideshows/232901643
12:02TimMcMight have been me.
12:02yonkeltronTimMc: word.
12:03gfredericksIf I want to make an inputstream from a lazy byte seq, I'll have to do it myself with proxy?
12:03yonkeltronTimMc: and then this shit showed up: http://blog.lse.epita.fr/articles/12-c---system-oriented-programming.html
12:03yonkeltronTimMc: kind of interesting
12:04TimMcand mildly silly
12:04nDuffI notice that re-evaluating a defpage via slime/swank doesn't modify preexisting servlets created with same; is there a way to do this, short of hiding all content generation behind a var?
12:05yonkeltronTimMc: you see all that super-funky syntax and special gunk thrown in?
12:06TimMcYes, and I can't help but notice they are building on C...
12:06TimMc...which is not really the best starting point.
12:06yonkeltronTimMc: what, you don't like high-level assembler?
12:06yonkeltronand other such jokes favored by lispers
12:25dnolenmmarczyk: ping
12:31kzarI added a dep for [domina "1.0.0-beta4"] in my project but that seems to require org.clojure:clojurescript:jar:0.0-1069 which lein then fails to find. I missing something?
12:41TimMcMaybe that's in some alternate repository.
12:41kzarThere's a post in google groups about the problem but no solution
12:44kzarTimMc: Oh, I tried "1.0.0-SNAPSHOT" like domina has in it's project.clj and it seemed to fix it
12:44kzarits*
13:06ambrosebswould clojure.core/seq be a function of clojure.lang.Seqable -> clojure.lang.ASeq ?
13:06ambrosebsdo we always get an ASeq back?
13:06ambrosebs(or nil)
13:07Chousuke_I'm not sure if ASeq is right. ISeq probably?
13:07Chousuke_and seq takes input other than Seqables too
13:07Chousuke_like java Strings
13:07nDuffWith noir's defpage, which property of the request object is it actually matching against for routing? I have a defpage with a string that exactly matches (.getPathInfo request) for one of my requests, but it isn't being used.
13:08ambrosebsChousuke: good point, forgot about the String/Iterable etc. input
13:08twhumeI'm trying to track down clojure-contrib.stream-utils ...
13:09ambrosebsChousuke: with the output, I'm trying to gather as much info as I can
13:09twhumeanyone know where they live nowadays?
13:09ambrosebsASeq gives a ton more than ISeq
13:10ambrosebsbut is it correct? not sure
13:10dnolenambrosebs: Chousuke: thought that doesn't apply to ClojureScript.
13:10dnolenin ClojureScript Strings & Arrays *are* ISeqable
13:10Chousuke_right
13:10ambrosebsdnolen: true. And I'm still on the fence as to how to handle that in Clojure. ie. hardcode them as Seqable
13:11Chousuke_open prototypes :)
13:11dnolenambrosebs: I think (ISeq | nil) is right - the returned value might be ASeq maybe not.
13:11dnolenASeq is basically a marker protocol so that we know that we have something that's not empty.
13:12twhume(or an alternative way of doing streams - I think I'm going to be generated *massive* sequences and don't want early entries hanging around not being GCed)
13:13Chousuke_is there a problem with regular sequences for that? just don't hold on to the head and the elements get gc'd normally
13:13ambrosebsdnolen: If seq output is non-nil, is it always an ASeq?
13:14hyPiRionIsn't lazy-seqs gc'd? I initially thought they were.
13:15hyPiRionAs long you don't keep the head, of course.
13:15dnolenambrosebs: probably, though I'm not sure if that information can be perservd.
13:15AWizzArdHow can I access the current line during macro expansion time?
13:15AWizzArdI would like to enable one of my macros with diagnostic capibilities and report the line number and file where it is used.
13:16TimMc&(ancestors (class (seq [1 2 3])))
13:16lazybot⇒ #{clojure.lang.ASeq clojure.lang.IHashEq java.io.Serializable clojure.lang.IMeta java.util.List clojure.lang.IObj java.lang.Object clojure.lang.ISeq clojure.lang.Sequential clojure.lang.IPersistentCollection clojure.lang.Obj clojure.lang.Seqable java.lang.Iterab... https://www.refheap.com/paste/2667
13:17ambrosebsdnolen: preserved?
13:18raektwhume: you can use clojure sequence functions to do stream-like stuff. (as you said, you have to remember to let go of the head)
13:19twhumeraek: I'm a n00b. How can I explicitly dereference the head, once it's been bound to a variable?
13:19twhume(and out of curiosity… what happened to all that streams stuff anyway, any idea?)
13:19raektwhume: for I/O there are functions in clojure.core and clojure.java.io (some of them originates from clojure.contrib.duck-streams)
13:20nDuffWhat information about a request is the path given to defpage in noir matched against? request.getPathInfo()? request.getURI()?
13:20raektwhume: for I/O you will probably need to use tha java I/O classes too (they are in the java.io namespace)
13:20twhumeraek: is that the same kind of stream? I scanned and thought that was more IO related than, say, http://clojure.org/streams
13:20S11001001AWizzArd: &form or something like that contains the full macro call; grab meta from that, I guess
13:21raektwhume: I haven't heard about stream-utils before (besides seeing its name). it is unmaintained.
13:21AWizzArdS11001001: I will give it a try.
13:21S11001001AWizzArd: I don't remember the name, but it's definitely there; check defmacro's implementation. There is also &env, which contains info about the lexical environment
13:22S11001001AWizzArd: and furthermore keep in mind that your macro might be expanded from another expansion, which likely wouldn't have preserved the meta you're looking for
13:22raektwhume: interesting page you have found. that's probably years old since it mentions SVN (git has been used since 2009)
13:22S11001001oh, wait, I think things get re-metaed between macro expansions anyway, so that's not an issue
13:23AWizzArdI will try and report back in 10-20 mins.
13:23raektwhume: what do you mean by dereference?
13:23twhumeraek: aha… ok, so the streams in clojure.core would be the kinda streams I'm talking about (lazy-seqs that don't keep references to old content)?
13:24dnolenambrosebs: look at which types are ASeq in the ClojureScript source. It probably needs more thought.
13:24raektwhume: sequences do not keep references to old content, so you can think of all lazy-seqs as streams
13:24twhume… as long as I dereference the head?
13:25raektwhume: "dereference"? I don't follow.
13:25twhumewhat you meant by "letting go"?
13:25hyPiRionAs long you don't have any reference to the head, it will be gc'ed when needed.
13:25twhumefree it up so the JVM can garbage collect it.
13:25twhumeok, thanks.
13:26raekhere's an example of what to not do: (def rdr (io/reader "file.txt")) (def lines (line-seq rdr)) (pr lines) (.close rdr)
13:26hyPiRionrather - use defns.
13:26raektwhume: "dereference" usually means "to follow a reference"
13:27raekif you do that, the sequence of lines will always be bound to a global var. so no sequence cells can be gc'ed
13:27twhumeok, thanks.
13:28raekhere's what to do: (let [rdr (io/reader "file.txt)] (doseq [line (line-seq rdr)] (pr line)) (.close rdr))
13:28S11001001or with-open
13:28raekS11001001: was just going to mention that... :)
13:29ambrosebsdnolen: I've noticed the abstract classes make very handy type aliases https://github.com/frenchy64/typed-clojure/blob/72617384141668de8b145ba13961b405559892e0/src/typed/class.clj
13:29raekor even better: (with-open [rdr (io/reader "file.txt)] (doseq [line (line-seq rdr)] (pr line)))
13:30dnolenambrosebs: nice, I'm curious how ClojureScript simplifies this stuff.
13:42ambrosebsdnolen: well now that I'm treating the Java Interfaces as (basically) Protocols, I don't think there would be much difference in CLJS.
13:43solussdwhat's a good name for a macro that takes (and evaluates once) an expression, a predicate, and an 'else' expression and if the predicate returns true, returns the result of the first expression, otherwise the result of the else expression, e.g. (blah (some-func someval), #(= 4 %), (elseexp)). Or, does this already exist?
13:46joegalloisn't that (if predicate expression else-expression)?
13:46AimHeresolussd> You mean 'if'?
13:46AimHereIt might be a special form, not a macro, though
13:46raekan abbreviation for (let [x (some-func someval)] (if (#(= 4 %) x) x (elseexp)) ?
13:47joegalloor did you mean: (if (predicate expression) expression else-expression)
13:47solussdno, the same thing using if would look like this: (let [result (expression)] (if (predicate result) result (else expr)))
13:47joegalloah, but my version has double evaluation of expression unless you let it out like raek said
13:48solussdyup
13:48solussdand, of course, I don't want to evaluate else unless I have to-- which if will do for me
13:48solussdjust need a name for it. :)
13:49solussdand you're right, no need for a macro, I have if
13:49solussdwell, I guess I need a macro to wrap it
13:50raekyou still need to macro if you don't want the else expression to be evaluated unconditionally
13:50solussdyup ^
13:51dnolenambrosebs: so you just flatten the interface hierarchy?
13:53ambrosebsdnolen: yea
13:53ambrosebsdnolen: solved a few other weird diamond inheritance issues
13:54ambrosebsdnolen: and just seemed more clojurey
13:54ambrosebsdnolen: thoughts?
13:54dnolenambrosebs: seems right to me.
13:55ambrosebsdnolen: cool
13:55ambrosebsdnolen: it's basically CLJS's hierarchy now
13:57dnolenambrosebs: I suppose it true that seq in some sense return (nil | ASeq)
13:57solussdi'll have the predicate work the other way and call it "subif", "substitute if"
13:57dnolenambrosebs: this has to do with the special treatment of EmptyList
13:58dpritchettis there a simpler way to write this? https://gist.github.com/2647344
14:00ambrosebsdnolen: in CLJS it would probably be something like (U nil (I ISeq ISequential IHash ISeqable ..))
14:00ambrosebsI = intersection
14:06tutysrahave been following @cemerick 's starting clojure webcast, (require 'compojure.route) complains of ring/middleware/head.clj not found on classpath, ring - 1.0.1 and compojure 1.0.3 are used
14:06rhcambrosebs: hey i finally watched your "intro to logic programming" presentation, nice job, all that core.logic stuff is amazing to me
14:07ambrosebsrhc: thanks! too scared to watch that video, was terrified ;)
14:08ambrosebsrhc: did you watch dan and will's video on minikanren?
14:08ambrosebsrhc: will blow ur mind :)
14:08rhcambrosebs: yeah i started that one, realized i had no idea what was going on, so i went back to watch yours first
14:08rhcstill need to watch theirs
14:09ambrosebsrhc: they start where I left off, but accelerate at a rapid pace
14:10ambrosebsquite an honour to be their warm up act actually!
14:11LauJensenEvening gents
14:11rhcambrosebs: did you come to reasoned schemer from prolog? or from some strongly typed langauge background?
14:12ambrosebsrhc: from scratching my head at core.logic!
14:12ambrosebsrhc: I knew a bit of prolog
14:12rhcah, cool, i'm still definitely int he head scratching phase.. never touched prolog
14:13RickInGArhc have you seen the primer on core.logic?
14:13rhcRickInGA: just this https://github.com/frenchy64/Logic-Starter/wiki
14:13rhcyou're talking about this? https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer ?
14:13RickInGArhc: https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer
14:13RickInGAyeah :)
14:13rhcthanks, I'll check it out
14:14rhci feel like i understand it on some thin level, but not enough to say "hey, i could use that for something"
14:15ambrosebsrhc: the official primer is better thought out than mine
14:15ambrosebsrhc: but mine's still fun
14:15rhcambrosebs: yeah, i enjoyed yours
14:15ambrosebsthanks :)
14:16ambrosebsrhc: I haven't updated it in ages. Did you follow along with the latest core.logic?
14:16rhcambrosebs: no, i just read it while eating :)
14:19RickInGAambrosebs: I hope you don't think I was criticizing your page... It was the first one I looked at when I was curious about core.logic, and with no background it was over my head. I found the primer to be easier to a newb
14:21AWizzArdS11001001: it seems that didn’t work. Neither &form nor &env contain line number info.
14:21ambrosebsRickInGA: I'll be the first one to admit I really had no idea what I was doing when I wrote it xD
14:21S11001001AWizzArd: what did &form's meta have/
14:21S11001001?
14:22AWizzArdnil
14:22S11001001oh, oh well
14:22S11001001try checking your args for meta
14:22RickInGAambrosebs: in your tutorial, and your talk you showed a type checker. I hadn't heard of a type checker before. Is it category theory?
14:23ambrosebsRickInGA: I don't know what category theory is :)
14:23S11001001(this info does exist in the compiler code; I guess it runs macroexpand all the way before retagging)
14:23AWizzArdS11001001: although I tested in the repl: (defmacro foo [x] (prn &form (meta &form)) x) and then (foo 10)
14:23S11001001hmm, well repls are weird
14:23RickInGAambrosebs: good, then I don't have to find out either :) What is a type checker used for?
14:23AWizzArdSo, maybe my meta gets lost somewhere.
14:24AWizzArdAs you supposed earlier.
14:24S11001001still could happen, but also might be repl thing
14:24ambrosebsRickInGA: given an expression and an expected type, the type checker asserts that the expression is of that type
14:24ambrosebsbut it gets fascinating when you have a type checking *relation*
14:25ambrosebsusually it's a function
14:25xeqiRickInGA: I think type theory comes out of set theory/model theory
14:25AWizzArdS11001001: no, it really gets lost. I just confirmed it. I have three macros X, Y and Z which all expand into A. I placed the (prn (meta &form)) as first line in A and it has no meta info.
14:25S11001001a type is a set of values
14:26AWizzArdThen I placed it in my Z and tried it, and there it works now indeed.
14:26S11001001makes sense
14:26RickInGAambrosebs: xeqi: are there reseources I should look at to understand this better? I don't even understand the question that the checker means to answer
14:27flijtenAnyone who can tell me why accessing doc doesn't work in the following small codesnippet?
14:27flijtenhttp://pastebin.com/LppDES2w
14:27flijtenI thought use would be enough but I am missing out on something apparently
14:28AWizzArdflijten: unfortunately doc was moved out of core into clojure.repl
14:28flijtenah
14:28flijtenlol
14:28flijtenthat explains so much
14:28AWizzArdflijten: try (use 'clojure.repl)
14:28RickInGAS11001001: A type is a set of values... I like that. I am reading Learn you a Haskell right now, and just this morning I learned about defining types, and that was how they described it.
14:28AWizzArdOr put (:use [clojure.repl :only [doc]]) into your NS.
14:29S11001001it's also the first definition of type in the little mler; seems to be pretty standard at this point
14:29tmciverflijten: and you don't have to (use 'clojure.core); it's done for you.
14:29RickInGAI never heard it before today, and now have heard it twice :)
14:29flijtenAWizzArd: thank, I though I was crazy for not understanding. I never suspected I was simply using the wrong namespace :)
14:30ambrosebsRickInGA: does that clear up the role of a type checker?
14:30AWizzArdflijten: in Clojure 1.2 the doc macro was always available, which is useful I think.
14:31AWizzArdEspecially since clojure.repl is included in the clojure.jar anyway, so it does not really dramatically speed things up.
14:31flijtentmciver, thanks too. I kinda knew that but I started trying all kinds of stuff to simply get doc to work :)
14:32flijtenSo why did they take it out?
14:32AWizzArdNo idea.
14:32RickInGAambrosebs: no, I still don't know when I would find myself wishing I had one. Are there books that talk about them and what they are for? I suspect that getting me to understand is going to take quite a while.
14:33ambrosebsRickInGA: Hmm not sure of a good place to start
14:33ambrosebsRickInGA: are you familiar with statically typed languages?
14:34RickInGAambrosebs: sure, been doing c# for years
14:34RickInGAambrosebs: and the compiler does type checking...
14:35ambrosebsvery simple example: Integer i = 1;
14:35ambrosebs1 is type Integer
14:35ambrosebsexpected type is Integer
14:35ambrosebsso it "type checks"
14:35RickInGAso your type checker is something you can run against your code, to get the benefits of static typing, without the restrictuions when you don't want them?
14:36ambrosebsoh, in the tutorial?
14:36ambrosebsthat is a very simple checker
14:36ambrosebsjust a toy
14:36ambrosebsbut that's the idea
14:37rhci think dart (the language) has something like that
14:37RickInGAambrosebs: ok. I just noticed that you mentioned a checker in your talk and the tutorial, and the mini-karen guys said they would show a checker, but you already had, so I figured it must be something I should learn about
14:37rhcoptionally enabled types, at compile or runtime or something
14:37ambrosebsI'm working on Typed Clojure too
14:38ambrosebsoptional static typing
14:38ambrosebshttps://github.com/frenchy64/typed-clojure
14:38RickInGAambrosebs: so if I were to summarize why I might want a type checker, is because I might want a tool I could use to check my code, to make sure I haven't made any errors, like trying to 3 + "a"
14:38ambrosebsexactly
14:38RickInGAok, thanks!
14:39RickInGAto open another can of worms, you are doing typed clojure, and Michael Fogus is doing contract programming in Clojure. Are the two related?
14:40ambrosebsthey will be
14:41ambrosebsTyped Clojure is inspired by Typed Racket, which uses runtime contracts extensively
14:41ambrosebsbut this is not in the scope of typed clojure initially
14:41ambrosebsconceptually, contracts and static type checking are related
14:41ambrosebscontracts happen at runtime
14:42ambrosebstype checking happens at compile time
14:42RickInGAin core clojure, are pre and post conditions enforced at runtime or compile time?
14:42ambrosebsruntime
14:42ambrosebsthere are a few static type checks in Clojure currently
14:43ambrosebsforget where tho :)
14:43RaynesOh look, ugly new Github icons.
14:43ambrosebs,(fn [] (+ 1 "a"))
14:43RickInGAthanks so much for taking the time to clear this up for me. I will defintely have to look at typed Clojure.
14:43clojurebot#<sandbox$eval27$fn__28 sandbox$eval27$fn__28@c3a8c5>
14:43ambrosebsRickInGA: cool!
14:43S11001001reflection warnings sometimes indicate calls that will fail, though not always
14:43S11001001obviously
14:45apoc,(println ('hi))
14:45clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: Symbol>
14:45apoc,(println 'hi)
14:45clojurebothi
14:45apochihi;)
14:45ibdknoxRaynes: wow those are terrible
14:45ibdknoxwtf is github doing
14:46Raynesibdknox: The 'watch' button looks like a giant eyeball that wants to shoot lasers at me, and the icons beside files and directories now appear to be straight out of Windows 98.
14:47ibdknoxholy crap
14:47ibdknoxthat's truly awful
14:47ibdknoxI hadn't even seen those
14:47RaynesMoving your cursor over headers in the README and you get images of a weird link icon that looks like a tornado and scares me, when they could have used a literal image of an anchor and everybody would have known what it meant.
14:48ibdknoxway too much contrast
14:48ibdknoxthis is just poor design :(
14:48ibdknoxlike basic design
14:48RaynesWe should use repo.or.cz in protest.
14:49S11001001gitorious
14:50ibdknoxhuh, gitorious looks reasonable :)
14:51AWizzArdAlso have a look at BitBucket
14:51AWizzArdimo currently the best site for repos (git and Mercurial)
14:53ibdknoxThis stuff always makes thing I should've done a product consultancy
14:53ibdknoxof course, they might not listen
14:53ibdknoxthink*
15:04flijtenWhat I don't understand, things like the if expression, do they return the if or else expression result implicitly?
15:05RickInGAflijten: yes
15:06flijten(if (> (count '()) 0) "no" "yes")
15:06amalloyflijten: everything is an expression; nothing is a statement. so every expression implicitly "returns" something
15:06RickInGAflijten: when you have a block of code such as (do (expr 1) (expr 2)... (expr n)) the last value, in this case (expr n) is what gets returned
15:06raekflijten: the value of an (if <condition> <then> <else>) is either the value of <then> or <else>
15:06flijtenso thats why yes is returned in above code snippet?
15:06RaynesWhat would you expect to happen?
15:06RickInGAflijten yes
15:07amalloyin the same way that in java (for example), the expression (1 + 1) "implicitly returns" the result of the addition
15:07raekflijten: Clojure is built on expression rather than statements
15:07flijtenwell since the list is empty i half expected "no" to be returned
15:07raek(mostly)
15:07RickInGAflijten: but the test is whether the count was greater than 0, which for the empty list it is not
15:07raekflijten: zero is not greater than zero
15:08flijtenheh
15:08flijtenpolish notation
15:08flijtenit gets me
15:08flijtenI like this a lot, but it is a big paradigm shift, this clojure
15:08flijten:D
15:08bkolobaraWhen I compile a clojureScript file with optimisations set to advanced the result is a js file with 8k lines. Why is the result so big? Shouldn't the optimisation perform dead code elimination?
15:10dnolenbkolobara: 8k is not very big.
15:10ibdknoxbkolobara: it has to include the entire run time
15:10ibdknoxrather, most of it
15:12bkolobaraOK, I just thought if i'm not using anything that the compiler will eliminate it.
15:12dnolenbkolobara: it doesn't eliminate an incredible amount
15:12pandeiromy question would be why are there 8000 linebreaks in minified code
15:13S11001001tree shaking is hard
15:13dnolenbkolobara: er I mean it does, you file would be huge w/o it.
15:13dnolenbkolobara: like >15000 lines if not more.
15:18dnolenbkolobara: after zipping, your CLJS file will probably comparable to jQuery + your app
15:18dnolenbkolobara: if you don't use any Clojure data structures you can get relatively small sizes. Like 7-8k gripped.
15:20drewrdnolen: any thoughts as to how to get around lack of resolve in cljs?
15:20drewrwanna do dynamic namespace dispatch
15:20dnolendrewr: you tell me :)
15:20drewrhaha
15:21hiredmanresolve is name munging + eval?
15:22dnolendrewr: resolve could probably be a macro, patch welcome.
15:30pandeiroibdknox: did you have time to look at the noir.server/add-middleware issue on the ml? were you aware of that?
15:30clojurebotwhat time is it?
15:45pjstadigclojurebot: 3:44PM EST
15:45clojurebotcertainly ryland
15:45pjstadigclojurebot: pardon?
15:45clojurebotPardon?
15:45pjstadigclojurebot: i hate your guts...if you had guts
15:45clojurebotI don't understand.
15:45pjstadigmeh
15:46dnolenibdknox: speaking of which, you've probably written more ClojureScript than anyone, I'm curious how big your file sizes are after gzipping?
15:47dpritchettis there an idiomatic way to convert { "key1" 1 "key2" 2 } to { :key1 1 :key2 2 }? I tried zipmap: (fn [x] (zipmap (map keyword (keys x)) (vals x)))
15:50hyPiRiondpritchett: I don't think so.
15:50dpritchettthanks hyPiRion
15:51dpritchettMy overall goal was to figure out how to extract multiple values from (System/getenv) without repeating any code
15:51S11001001dpritchett: keywordize-keys in walk
15:52S11001001careful, it's recursive
15:52dnolendpritchett: you know about select-keys?
15:53dpritchetti didn't before, thanks dnolen
15:53dpritchettso my actual code is https://gist.github.com/2647344 and i was trying to figure out how to avoid calling getenv twice
15:53RickInGA(reduce into {} (map (fn [x] {(keyword (str x)) x} ) [1 2 3] ))
15:57dnolendpritchett: https://gist.github.com/2648355
15:59flijtendoh, I feel like I am missing something. Since everything is an expression how do you so something like iterating over a list and for each item decide if it smaller/greater than x and put it into new lists accordingly? Especially since everything is immutable. This is so trivial in an object oriented language, it must be trivial in clojure to.
15:59dpritchettthanks dnolen!
15:59dpritchetti was playing around trying to destructure it but hadnt gotten quite that far
16:00RickInGAflijten: you filter
16:00flijtenI mean I know of doseq and let so probably I could construct something :) But what would be the correct way?
16:00RickInGA,(filter even? (range 10))
16:00clojurebot(0 2 4 6 8)
16:00RickInGA,(remove even? (range 10))
16:00clojurebot(1 3 5 7 9)
16:00flijtenRinkInGa, but that means two operations instead of one iteration
16:02flijtenBut filtering is the way to go I understand
16:02flijtenI am trying to write a quicksort, hence the question by the way
16:02RickInGAflijten: do you have joy of clojure? they do a lazy quicksort there
16:03flijtenJoy of clojure?
16:03RickInGAyeah it is one of the clojure books... considered a little more advanced
16:04Raynes$google the joy of Clojure
16:04lazybot[The Joy of Clojure | Thinking the Clojure Way] http://joyofclojure.com/
16:04flijtenAah I see
16:04RickInGARoseatta code has a quicksort in clojure http://rosettacode.org/wiki/Category:Clojure
16:04RickInGAactually has 3 of them
16:04flijtenhehe, I am trying to write it to understand and learn. I specifically try not to peek until I am finished with a working algorithm
16:04RickInGAok
16:04flijtenwhen it is working I can compare and see the gazillion mistakes I made :D
16:04RickInGAyep
16:06ldopaflijten: take a look at group-by
16:09ldopa,(group-by #(> 5 %) (shuffle (range 10)))
16:09clojurebot{true [3 1 4 0 2], false [9 7 8 5 6]}
16:09flijtenooh that's even more brilliant in this case I guess
16:10ldopathere's definitely an easier way to write quicksort though ;)
16:12flijtenmost likely! In it for the learning curve though :)
16:13flijtenI imagine the easiest way of quicksorting in clojure is something like (sort '(1 9 12 45 3))
16:13flijten,(sort '(1 9 12 45 3))
16:13clojurebot(1 3 9 12 45)
16:13flijtenvoila
16:13flijten:D
16:15TimMc&(class (sort [1 2 3]))
16:15lazybot⇒ clojure.lang.ArraySeq
16:15TimMcProbably some kind of in-place sort?
16:16AimHereThose Rosetta Code quicksorts look like they all do two runs through the collection each time. Seems inefficient
16:16TimMcjava.util.Arrays#sort
16:18gfredericks(map #(-> % range sort type) [1 10 1000 1000000])
16:18gfredericks,(map #(-> % range sort type) [1 10 1000 1000000])
16:18clojurebotExecution Timed Out
16:18gfredericks&(map #(-> % range sort type) [1 10 1000 1000000])
16:18lazybot⇒ (clojure.lang.ArraySeq clojure.lang.ArraySeq clojure.lang.ArraySeq clojure.lang.ArraySeq)
16:18gfredericks(inc lazybot)
16:18lazybot⇒ 4
16:18gfredericksclojurebot: wuss
16:18clojurebotHuh?
16:20flijten:D
16:23flijtenwell at least I have a let that gets me greater and smaller than the pivot number: (let [pivot (first items) {less true more false} (group-by #(> pivot %) items)] ...
16:23S11001001clojure sort is sometimes in-place, sometimes pure
16:24solussdhmm, I want an anaphor, but I want to be able to pass in the name of the anaphor as an argument to my macro. ideas?
16:24solussd(I want an anaphor for fun- spare me the "I shouldn't do that". :))
16:24TimMc&(class (sort []))
16:24lazybot⇒ clojure.lang.PersistentList$EmptyList
16:25S11001001if you're explicitly naming the binding it's not anaphoric :)
16:25TimMcS11001001: ^ that's the only pure sort it does, as far as I can tell
16:25S11001001&(let [x [2 1]] [(sort x) x])
16:25lazybot⇒ [(1 2) [2 1]]
16:25S11001001looks pure to me
16:26TimMcOh, I misunderstood you.
16:26TimMcOr vice versa. I meant the internal sort strategy.
16:26S11001001ah
16:26TimMccf. merge sort
16:26S11001001&(let [x (to-array [2 1])] [(sort x) (seq x)])
16:26lazybot⇒ [(1 2) (1 2)]
16:27TimMcOuch.
16:27michaelr525hello
16:27TimMc&(let [x (seq (to-array [2 1]))] [(sort x) (seq x)])
16:27lazybot⇒ [(1 2) (2 1)]
16:39weavejesteribdknox: I've added a make-route function to Compojure 1.1.0-SNAPSHOT that should remove the need for the eval in Noir
16:47Raynesweavejester: You are a gentleman and a scholar.
16:48weavejesterRaynes: That's probably the first time I've been called that :)
16:48technomancyweavejester: is it usually gentleman xor scholar?
16:50weavejestertechnomancy: Something like that :)
16:53michaelr525so who has already adopted the new reducers thing?
16:54michaelr525i still struggle at the basic stuff, so this is like a new bomb dropped out of the blue :)
16:54technomancyif you're struggling with the basics you should probably ignore it =)
16:55RaynesWell, ignore it until it isn't actually a bomb.
16:55RaynesI've been using Clojure for 4 years and I still don't understand core.logic.
16:56michaelr525are you clones? ;)
16:56Rayness/clones/clowns/
16:57RaynesPeople have asked if technomancy and I had ever been seen together in person before.
16:57RaynesFortunately we have, or else that would be a reasonable question.
17:00michaelr525yeah.. my approach to these things is practical.. maybe if I'll see how this new things can be exploited and give me some advantage such as speed of development
17:03michaelr525heh :)
17:03michaelr525had to read it 5 times
17:03michaelr525better i shall go to sleep
17:20rhc_did someone paste a new core.logic link?
17:37dnolennice looks like CLJS release 1211 is going out
17:38Raynesdnolen: Is it carrying a sack on a stick with a few changes of clothes in it?
17:38dnolenRaynes: something like that :)
17:46Raynesibdknox: I wish someone would throw you another 10k and get on with it already.
17:47jodaroRaynes: don't you have 10k lying around?
17:47Raynesjodaro: Man, I had to raise $300 just to pay for SSL on Heroku a few days ago.
17:48jodarohow'd you raise it?
17:48jodaroor do i want to know
17:48TimMcWebcam show.
17:48Rayneslynaghk made me do things for him. I'd rather not talk about it.
17:48aperiodic"Lascivious Lizards Unleashed"
17:53jodarowow
17:53jodaroonly 9k away from the goal
17:53jodarothats rad, ibdknox
17:53RaynesGroovy and far out too.
17:53jodarototally awesome
17:53jodaroi dig it
17:57gfredericksif I use proxy to create an InputStream and just implement the 0-arg version of read, is it expected that calls to other-arity versions of read will be diverted to my impl?
17:57gfredericks(throwing a 'wrong number of args' exception of course)
17:58S11001001gfredericks: I think so, but it is documented there anyway
17:58gfredericksoh in the proxy docs?
17:58S11001001no, InputStream
17:58gfredericksoh I think I miscommunicated
17:58gfredericksyes I know that the InputStream impls will eventually call mine
17:59S11001001oh that, yeah it's fine, as long as you remember that proxy calls aren't reentrant
17:59gfredericksmy issue is I'm getting 'wrong number of args' errors, where 4 args are passed to something which I guess must be my function
17:59S11001001oh that
17:59S11001001yeah, it's based on method name
17:59gfredericksso do I need to give an impl for all the versions of read? :/
18:00hiredmanyes
18:00gfredericksis there any easier way to turn a byte-seq into an input stream?
18:01S11001001how about bytearrayinputstream
18:01gfrederickswell I want it lazy
18:03hiredmanhttps://gist.github.com/2649231
18:04hiredmanyou could also do something with SequenceInputStream and an enumeration of ByteArrayInputStreams
18:04hiredmanhttps://github.com/hiredman/vespa-crabro/blob/master/src/vespa/streams.clj#L44
18:09gfrederickshuh. So you use a ref there rather than an atom because then you can read and update as separate operations. I don't think I realized there was a use case for single refs.
18:09gfredericksI've done some crazy ugly things in those situations :(
18:10gfrederickshiredman: SequenceInputStream is definitely the cleanest way for me to go. Thanks!
18:16S11001001gfredericks: for extra fun, handle the chunking when mapping to BAISes
18:18TimMcS11001001: This is the proxy problem echo-area was having earlier, I think.
18:19TimMcproxy only supports dispatch on name?
18:19S11001001it's a map
18:19TimMcew, right
18:19S11001001a mutable per-proxy-object one
18:19TimMcI fought with proxy some time ago, and I have purged many of the details...
18:19S11001001and when you call proxy-super, it removes the entry from the map (causing the bytecode to actually do a super), calls that method, then adds the entry back
18:20TimMcSo broken.
18:20TimMcOK, still going to file a bug, but this time for a doc change.
18:21brainproxyanyone see me post in this chan a sec ago? I think my client was losing the connection just as I was hitting return
18:22ivanno messages from you
18:22brainproxythanks
18:23brainproxyso... what I wanted to say ... node-clojurescript is basically useable at this point; if you have nodejs v0.6.x installed you can do `npm install -g clojure-script`
18:23brainproxythen `ncljsc --help` to get a list of options
18:24brainproxyI'll be working on the README for it this evening, to provide instructions for getting setup (e.g. making sure JAVA_HOME is set, etc.) and basic usage
18:24brainproxyI'm hoping some folks who do both nodejs nad clojure/script can help me kick the tires
18:24brainproxy:)
18:26brainproxylots to do ... figuring out how to integrate it with lein; rewriting the coffee-script based tooling into cljs, so it's pseudo self-hosting, etc.
18:30Cr8huh
18:30Cr8what's this node-java bridge thing
18:30Cr8that's interesting
18:34brainproxyCr8: indeed
18:35Cr8heh, i'm trying to play with it, realizing i don't know cljs
18:36brainproxyeasy thing to do
18:36brainproxytouch hello.cljs
18:36brainproxyncljsc -w ./hello.cljs
18:36brainproxykeep that terminal open
18:36Cr8mm, that helps. I was recompiling it every time.
18:36brainproxythen use emacs or whatever to edit hello.cljs
18:36brainproxywill recompile on chang
18:36brainproxyyeah much faster!
18:37brainproxybecause the jvm stays runnning
18:37brainproxyif you want to create a namespace dependency and have it watched also, try:
18:38brainproxyncljsc -w -W ./foo.cljs ./hello.cljs
18:38brainproxythen when you change foo or hello, hello will get recompiled
18:38brainproxyalso if you (:require cljs.nodejs :as nodejs)
18:39brainproxythen nodejs/require is available to you
18:39brainproxyso you can pull in deps with either cljs namespaces
18:39brainproxyor node's require mechanism
18:39Cr8swell :)
18:40Cr8hm
18:40brainproxyyou can also pass options to the JVM or overwrite the default hash-map that's getting passed to the underlying cljs compiler
18:40Cr8-w just seems to silently fail and not tell me if I do something syntactically wrong though
18:41brainproxyCr8: will check into it, I probably need to wrap the main build method on the js side in try/catch
18:42brainproxyand return an error object
18:42brainproxyinstead of exception text message
18:42brainproxyanyway, it's definitely in development status, but will be looking to improve it, and rapidly!
18:44brainproxyhope soon to implement a nice REPL, so the compiled code can be interactively eval'd in node/v8
18:45Cr8can i turn a js object into a map
18:45Cr8somehow
18:46brainproxythink so... I'm a cljs noob myself, but got motivated to get in place the tooling I wanted (i.e. nodejs front-end and integration) so I can learn it myself
18:46technomancyCr8: probably (into {} js-obj)
18:46technomancythat's how it works on the JVM anyway
18:46Cr8it appears js objs are not ISeqable's
18:46brainproxyhttp://himera.herokuapp.com/synonym.html
18:46brainproxy^ helpful
18:47brainproxynot sure it has the answer Cr8 is looking for though
18:47brainproxywhat I want to figure out is how to get the algo monads stuff working
18:47brainproxynot sure if that's possible
18:48brainproxytime for some food and exercise... willl be back on later, Cr8 thanks a bunch for poking at it
18:48Cr8if you make a js-obj with clojurescript it is
18:48Cr8but ones that exist already aren't
18:49Cr8might just be some odd issue with me trying to access the node.js process object though
18:50brainproxyCr8: process should be available as nodejs/process
18:50brainproxyif you (:require [cljs.nodejs :as nodejs])
18:51brainproxyI've exposed all the built-in globals
18:51brainproxythorough the externs mechanism
18:51brainproxyalso made available nodejs/next-tick, as a convenience for getting at process.nextTick
18:52brainproxysetTimeout is nodej/timeout and there's clear-timeout; interval and clear-interval
18:52brainproxyalso nodejs/__dirnam and nodejs/__filename are available
18:53brainproxythough if you're inside a namespace, those will be with respect to the most top-level script that kicked-off pulling in namespaced deps
18:55Cr8well I get an object
18:55Cr8if I could print out what was in it somehow i'd know if it was the right one
18:56brainproxyhow about...
18:56brainproxy(def util (nodejs/require "util"))
18:57brainproxy(.inspect util jsobjthing)
18:57brainproxyerr
18:57brainproxy(println (.inspect util object))
18:57brainproxyshould be trying this mysel :p
19:01brainproxyCr8: my require util, println suggestion worked for me, got a nice printout of the nodejs/process object
19:01brainproxyCr8: https://gist.github.com/2649563
19:37Cr8brainproxy: thanks :)
19:51brainproxyCr8: worked for you too?
19:52Cr8yes
19:52brainproxycool
19:52Cr8now i have to get back to my less functional day job though, will play with it some more later
19:53brainproxyokay :D
19:54brainproxyif you run into some nasty bug or something, feel free to submit an issue
19:55Cr8sure :)
21:28muhoowhat's a good strategy for keeping global app settings (in a noir app)? pull it in from the db and stick it in an atom, and sync it with the db when it's written?
21:29muhoothe kind of settings the admin could change, but wants to have persistent, but i don't need to read from the db at every page load
21:33xeqiwhats wrong with leaving it in the db?
21:47devnmuhoo: like config?
21:47devnmuhoo: I just drop a {:key "value", ...} config.clj file in the root of the repo and read-string on it
21:50gfredericksdevn: he said it needs to be updateable
21:50gfredericksI assume his admin doesn't use git and redeploy
21:51gfredericksI also assume he's a male
21:55kovasbany emacs experts in the house? I'd like to know if something is possible
21:55brehaut~anyone
21:55clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
21:56kovasbthanks clojurebot
21:56brehaut~botsnack
21:56clojurebotThanks! Can I have chocolate next time
21:56kovasbis it possible to save a repl session, and then open it back up later, and still have the inputs and outputs distinguished
21:57brehautim guessing, but i think if you start the clojure swank session from lein rather than emacs and then just connect to it via emacs, then yes
21:57kovasblike, relaunch emacs, open the session, and start typing things in where u left off
21:58kovasb(i don't expect it to save the state of the jvm)
21:58kovasbok
21:58brehautperhaps i misunderstand something, but it sounds like exactly what you are are expecting
21:59kovasbok
21:59kovasbyou mean, because the session is kept open by the other end?
21:59kovasband emacs just reconnects?
22:00brehautwell because the jvm state is what is at the other end of the session.
22:00tmciverbrehaut: that's a great idea - do you know how to disconnect slime while keeping swank up?
22:00brehautnope
22:01brehautim about as far as you can get from an emacs expert while using it every day
22:01kovasbwhat if I want to save the repl session, send it to someone else, and have them reevaluate my inputs?
22:01tmciverbrehaut: yeah, that's me too.
22:01echo-areaIs this the only way to get an array type: (Class/forName "[Ljava.lang.Class;")
22:01echo-areaIs this the simplest form?
22:01brehautkovasb: just write your code in a file, and send it to the repl as you go.
22:01kovasbthe issue is, i don't want to lose the distinction between input and output
22:01brehautthen when you are done, save your file and email it
22:02kovasbbrehaut: but then you lose the output history
22:02kovasbbrehaut: so the other person has no idea if they are getting the expected result
22:02brehautyou'll have to find someone more knowledgable
22:03brehautsounds to me like what you want isnt possible though
22:03xeqitmciver: M-x slime-disconnect ?
22:03kovasbyeah, its a bit esoteric, gonna do some googling
22:04tmciverxeqi: oh sure, if I want to do it the *easy* way. ;) Thanks. I'll have to try that technique sometime.
22:05SurlyFrogIs it true to say that `let` creates a lexical binding and `binding` creates a dynamic one?
22:05brehautyes
22:06SurlyFrogbrehaut: thanks.
22:06SurlyFrogis it also sort of fair to compare clojure's `def` to common lisp's `defparameter` or `defvar`?
22:07SurlyFrogmeaning, to establish a special variable with dynamic scoping rules.
22:08meiji11I've linked a jar into my leinengen project from clojars. its namespaces don't seem to be showing up in (all-ns). is there something else I need to do to make them accessible?
22:10brehautSurlyFrog: no idea, i dont know anything about common lisp
22:10technomancymeiji11: you'll need to load the code before all-ns sees it using require
22:10SurlyFrogbreahaut: no worries :-)
22:10technomancySurlyFrog: sort of; the difference is that whether it's dynamic or constant is based on the *dynamic* metadata
22:11SurlyFrogtechnomancy: ohhh…so eliding the ^:dynamic in a `def` makes it a constant..
22:12technomancySurlyFrog: it can still be rebound by future def calls, but that should never happen at runtime
22:12meiji11technomancy: I don't know what to use in require. the vector under :dependencies is [org.clojars.sids/htmlcleaner "2.1"], I've tried (require
22:12SurlyFrogtechnomancy: ok, thanks!
22:12meiji11'[org.clojars.sids/html :as HtmlCleaner])
22:13meiji11oops.
22:13technomancymeiji11: you have to check the documentation
22:13meiji11but that is not working.
22:13meiji11ah, ok. not necessarily the same.
22:13meiji11thanks.
22:13technomancyright
22:13technomancyno problem
22:35zawzeyhi, just a question, if an external library is jar-ed and it's lein project.clj specifies dependency on clojure 1.3 and our main project uses clojure 1.4 what version of clojure would the external lib be using?
22:36zawzeyWould the third-party library then use clojure 1.3 and our main project use clojure 1.4?
22:36brehautzawzey: i think it depends on how the version ranges are specified. theres a bunch of maven magic there
22:36zawzeybrehaut: i'm assuming that they use lein project.clj
22:37brehautnevertheless, lein uses maven bits under the hood, and its dependancies version strings are maven version ranges
22:37brehautzawzey: http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution
22:38brehautmost libs use soft requirements i think
22:38brehautin which case the highest version will probably be used
22:41zawzeybrehaut: i see, thanks, i do see that clj-http seems to specifies multiple profiles https://github.com/dakrone/clj-http/blob/master/project.clj
22:41brehautbut all the dependancies are soft, so it'll be overriden by any higher dependancies
22:42dakronezawzey: that's just so I can test against different versions of clojure, by default it runs against whatever version is specified in your project's project.clj
22:42zawzeyzawzey: got it, thanks guys
22:45technomancyzawzey: if you're curious, with leiningen 2 you can do `lein deps :tree` to see all the versions of all the dependencies that get pulled in
22:45uvtcMy understanding is that symbols refer to vars; such that when Clojure sees "x" (the symbol), it goes to the var to which x refers, and then gets the value it finds there. Are locals (for example, the x in `(let [x 3] ...)`) also symbols that refer to vars?
22:46uvtcoh, hi #clojure. :)
22:47gfredericksuvtc: nope
22:48uvtcgfredericks, Thanks. Though, ... what are they then?
22:48zawzeytechnomancy: thanks! :)
22:48gfredericksand also even excluding locals things are a bit more complicated than you described. Mostly having to do with things being namespace-dependent, and the aliases and prefixes and java imports.
22:49gfredericksuvtc: they are locals, so they are bound directly to a value
22:49gfrederickslocals include function arguments
22:49uvtcgfredericks, right: function args, in let, and ... I think in `loop` as well. Hm.
22:50gfredericksuvtc: and lots of other places
22:50gfredericksfunction args and let and loop I think are the real primitive ones
22:50gfredericksmost everything else is just a macro that transforms into one of those
22:51uvtcgfredericks, Ok, bound directly to a value. Makes sense. Thanks!
22:51gfredericksyep
22:51gfredericksuvtc: oh also those bindings are immutable; they are lexically scoped and can only be shadowed
22:53uvtcgfredericks, Right. IIRC, as of 1.3 the vars you get with `def` are also locally scoped (unless you specify them as dynamic) --- though they can re-bound in a `binding` form`.
22:53uvtcgfredericks, (re-bound for just the current thread)
22:54gfredericksthe binding form is actually exactly what requires the dynamic declaration
22:54uvtcOhhhh. Right, right. :)
23:02muhooit's more of a caching qquestino relaly.
23:02muhooor a caching question really
23:04muhooi could do a functino to get/set config, it'll pull stuff from the db into an atom, if it's nil. at set, reset! the atom, then write the db
23:36emezeskeI just pushed lein-cljsbuild 0.1.9 to clojars. It's updated to use clojurescript 0.0-1211, which seems to have some nice improvements.
23:37mefestoawesome! that was quick :)
23:37emezeskeyeah, I got lucky and had some time today. :)