#clojure logs

2012-09-02

00:07FrozenlockWhere does lein store the libraries?
00:07bbloomyou mean dependencies?
00:08Frozenlocker, yes
00:08FrozenlockI've found my .lein with profile and all, but no dependencies.
00:09xeqi~/.m2
00:09clojurebotI don't understand.
00:10bbloomyup, what xeqi said. it shares/reuses your local maven cache
00:10RaynesFrozenlock: lein doesn't store them or reuse anything. It uses maven for dependency resolution.
00:10RaynesAnd maven stores them in ~/.m2.
00:11FrozenlockThanks guys, found it! (I would have never guessed it..)
00:11RaynesDon't make me get all pedantic on you, bbloom.
00:11bbloomRaynes: sorry :-) didn't it used to use ivy or something?
00:11xeqiwell.. to be pedantic is uses aether for dependency resolution
00:11Raynesbbloom: Nosir.
00:12xeqiit used to use maven, through ant.. I think
00:12bbloomah
00:12xeqimuch prettier just to use pomegranate now
00:12bbloomi've had to interact with maven a tad at the office lately
00:12bbloomwhat a nightmare.
00:13Raynesxeqi: aether *is* maven.
00:13RaynesAs of 3.0, right?
00:13xeqimaven uses aether
00:13RaynesRight.
00:13xeqithey're owned by seperate groups
00:13RaynesIs there really any point in making a distinction?
00:13xeqiapache -> maven ; eclipse -> aether
00:13RaynesI'd like to arrange a bout with you, sir.
00:13xeqino, I usually just say maven cause people know what I mean
00:15xeqihttp://www.thefreedictionary.com/bout .. "a period of time doing something, such as drinking"
00:15bbloomseems like you guys know this stuff… let me ask a java question of you folks, since i don't think i'd like the answer from java people :-)
00:16bbloomif i have a bunch of java projects, each with it's own git repository, but i want dependencies between them
00:16bbloomis there a decent build system that lets me have source dependencies between them in a sane way?
00:16RaynesIsn't that lein checkouts?
00:16xeqigit submodules ?
00:17bbloomgit submodules are sure to be involved ;-)
00:17bbloomlein*
00:17Rayneslein works for java too, fwiw.
00:17xeqiyou *can* use checkouts in that way...
00:18bbloomholy non-idiomatic close parens batman! https://github.com/guv/lein-checkouts/blob/master/src/leiningen/checkouts.clj
00:18xeqiyeah.. thats not what we're refering to
00:18bbloomlink?
00:18clojurebotyour link is dead
00:19xeqihttps://github.com/technomancy/leiningen/blob/master/doc/FAQ.md - question 5
00:19michaelr`google chrome changed their menu icon.. wow
00:19shokyhotdogs
00:19shokythey call it
00:19michaelr`grill?
00:20shoky3 bland hotdogs.
00:20bbloomxeqi: ah thanks
00:20michaelr`three hotdogs sounds too much while on the other hand 3 cucumbers would be just fine..
00:20bbloomnot exactly what i want
00:20bbloomsomebody suggested gradle & the multiple-project-builds support
00:21bbloomwhich i looked at the docs for, and it seemed much closer to what i imagined
00:21casionwhat's the proper way to round or truncate decimals in clojure?
00:21bbloom(find-doc "round")
00:21bbloomthere are several options
00:22bbloom,(int 1.7)
00:22xeqi$findfn 2.33 2.0
00:22clojurebot1
00:22lazybot[]
00:22xeqi$findfn 2.33 2
00:22lazybot[clojure.core/long clojure.core/short clojure.core/unchecked-long clojure.core/rand-int clojure.core/unchecked-short clojure.core/unchecked-int clojure.core/byte clojure.core/biginteger clojure.core/int clojure.core/bigint clojure.core/unchecked-byte]
00:22xeqi$findfn 2.33 3
00:22lazybot[clojure.core/unchecked-inc-int]
00:22Frozenlockbbloom: What's up with those parens?!
00:22bbloomFrozenlock: *shrug* i didn't write them!
00:22xeqihmm, not sure I like those options
00:23casionyeah, I haven't found anything other than going it java-y
00:23casionwhich is not very fun
00:23bbloom*shrug* yeah, it seems like round should be in core....
00:24xeqi$findfn 2.55 3
00:24lazybot[clojure.core/unchecked-inc-int]
00:24bbloomhaha yeah, not what you want at all
00:25bbloom,((fn [x] (int (+ x 0.5)) 2.55)
00:25clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
00:25bbloom,((fn [x] (int (+ x 0.5))) 2.55)
00:25clojurebot3
00:25mpan,(doc unchecked-inc-int)
00:25clojurebot"([x]); Returns a number one greater than x, an int. Note - uses a primitive operator subject to overflow."
00:25mpanis there a difference between the various bots who evaluate?
00:26bbloomhttps://github.com/flatland/lazybot & https://github.com/hiredman/clojurebot
00:26mpanthanks
00:27mpanclojure/jruby interop?
00:28casion,(bigdec (/ (int (* 0.000234234 100000)) 100000.0))
00:28clojurebot0.00023M
00:28casionmeh.
00:29mpanoh, that sounds like a cool plugin
00:29mpanin general, is there a common way to do interop with other dynamic jvm languages?
00:30bbloommpan: unlikely for any generic mechanism, as most other dynamic jvm languages have their own wrapper objects and calling conventions
00:30xeqicall it the java way?
00:30casionI shouldnt be so annoyed that I have to write this myself, but it seems odd that neither java nor clojure has this function
00:30casionunless I'm missing something still, which is quite likely
00:31bbloomcasion: java doesn't have round?
00:31bbloomi'm sure it does...
00:31mpanand just pass data around as java objects?
00:31bbloomwhat do you need?
00:33casionbbloom: round or truncate a decimal to x significant digits
00:34casionthere is java.lang.Math/round, but that rounds to int/long
00:35casionso you still have to mult/div to round decimals
00:35casionobviously a very short function to write, but strange that it's not already there
00:35mpanis there something for making desktop guis that isn't swing?
00:36casionmpan: my brother and I both use swt (http://www.eclipse.org/swt/)
00:37mpanthanks
00:39mindbender1How much do I have to pay to look at the datomic source code!
00:39michaelr`mindbender1: one atomic transaction ;)
00:39mindbender1michaelr`: How much quantity is that?
00:40michaelr`mindbender1: 4
00:40xeqi(let [df (java.text.format.DecimalFormat. "#.##")] (->> 2.33 (.format df) (.parse df)))
00:41xeqi&(let [df (java.text.format.DecimalFormat. "#.##")] (->> 2.33 (.format df) (.parse df)))
00:41lazybotjava.lang.ClassNotFoundException: java.text.format.DecimalFormat
00:41mindbender1michaelr`: you mean a decimal 4?
00:41xeqi&(let [df (java.text.DecimalFormat. "#.##")] (->> 2.33 (.format df) (.parse df)))
00:41lazybot⇒ 2.33
00:41xeqiblah
00:41michaelr`mindbender1: i mean 4 ever ;)
00:42mindbender1michaelr`: wow that looks like infinity!
00:42michaelr`mindbender1: no it's much more but also could be a bit less
00:43mindbender1michaelr`: then it should look more like a duality
00:44casionxeqi: i lookend into DecimalFormat, and not only does it return a string… it's slow at even that :(
00:45casionjust plain round with mult/div is almost 100x faster than DecimalFormat, not including casting back to decimal
00:45xeqiyeah, I was surprised I found it mentioned so many places
00:47casionI found it funny that I found a forum suggesting to use Decimalformat and converting back to double… with 20+ posts lecturing the OP on why not to use doubles for currency
00:47casionit was somewhat ironic
00:47xeqiheh, its even used in the javadoc for DecimalFormat
00:48xeqiin the example
00:51michaelr`flatten
00:51xeqi~flatten
00:51clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
00:52michaelr`i keep forgetting it all the time
00:53michaelr`it would be wise imho to make flatten do what is suggested above
00:56michaelr`what was the solution for this using (into)?
00:56michaelr`I remember i liked it the best
00:57xeqimichaelr`: what are you trying to do?
00:57tolstoyAre folks using nrepl much these days? Anyone know how to disconnect from emacs?
00:58xeqitolstoy: I think theres a ticket to add one; in the meantime you can kill *nrepl-connection*
00:58michaelr`xeqi: hmm.. well i need to flatten a seq
00:59tolstoyxeqi: Ah, thanks. Kinda missing C-c C-c, too. ;)
00:59FrozenlockEh.. can't I just require in a cljs repl? --> (require [siren.core :as s])
01:00tolstoyxeqi: And it seems that lein repl :headless was key to working in that way. I suppose it's still not as persnickety as swank/slime et, al.
01:01bbloomFrozenlock: unfortunately not
01:01FrozenlockIs there something vaguely near?
01:01bbloomi don't know of anyone working on it
01:02FrozenlockSo I have to require directly in my namespace declaration?
01:02bbloomit's generally problematic because it couldn't work after advanced compilation or in the browser or whatnot
01:02bbloomyeah, you have to do it in the ns form
01:04bbloomFrozenlock: if you look in the cljs source at (defmethod parse 'ns ...
01:05bbloomlook for analyze-deps
01:05bbloomin theory, you could add require, use, etc to clojurescript for interactive development
01:05bbloombut it would take some work: both design & implementation
01:06FrozenlockI would like to, however at the moment I lack the necessary knowledge :(
01:06Frozenlock... but coming along, a week ago I was strugling getting my cljs repl up and running :)
01:08tomojhow would you do require?
01:10tomojjust compile all the cljs files on the classpath beforehand?
01:13bbloomtomoj: depends
01:14bbloomif you're just in a cljs repl on rhino or something, you can just run the file through the analyzer
01:14bbloombut if you're in the browser, it's much trickier
01:14bbloomthe real issue is advanced compilation
01:14bbloomin which case, i think it's impossible
02:17samratis it safe to store passwords in Noir's session? a session is stored on the server-side right?
02:23tolstoysamrat: Yes, it's in memory on the server.
02:24samrattolstoy: so, is it safe to keep the username and password saved in a session? the user and pass are of another app, which wierdly do not support oauth
02:25tolstoyIf you're confident no one can hack into your JVM and take a look at things, I guess its relatively safe.
02:25tolstoyI'm no exper.
02:26tolstoyWhat I've done is encrypt the user/pass, the b64 encode it and use that as a cookie.
02:26tolstoyThen store the key on the server side somewhere, so it's about as secure as where/how I store that key.
02:27samratthank, will keep that in mind
02:40tolstoyI'm no security expert, but, generally, if you use HTTPS for client/server interaction, you're much better off.
02:41tolstoyIf you're working internal server to another internal server, https is STILL a good idea. ;)
02:41samrati'm using clj-http to login by sending user,pass and apikey as a POST request, but when the password is incorrect clj-http gives me a 401 exception
02:42samrat..which means I can't access the actual response, is that a bug?
02:42samrattolstoy: ok, I am using https
02:42tolstoyNope. 401 is the actual response.
02:42amalloy$google http 401 not authorized
02:42samratwhat I get is this: ExceptionInfo clj-http: status 401 clj-http.client/wrap-exceptions/fn--1189 (client.clj:95)
02:42lazybot[HTTP Error 401 Unauthorized Explained] http://www.checkupdown.com/status/E401.html
02:43samratthats quite different from what I get if i get a 200 code
02:43tolstoy401 means unauth… yeah, what lazybot said.
02:43tomojif you want to get the actual response, pass :throw-exceptions false
02:44amalloyoh, yeah. clj-http's default behavior of throwing slingshot exceptions is kinda a pain
02:45amalloyan http client getting a 4xx response is not exceptional - it's part of the expected behavior of an http client
02:46samrattomoj: thanks, that was what I was looking for
02:48tomojyou can build your own request fn that doesn't use wrap-exceptions :/
02:54michaelr`why GET params get keywordized, but POST aren't?
02:54michaelr`compojure
03:13tomojlol I wrote (apply merge-with merge maps)
03:13tomojactually, that's what I wanted
03:13tomoj:)
03:54bbloomscala ANF transform? < 500 lines…. my clojure ANF transform? < 50 lines
03:54bbloomif i meet rich hickey, i think i'm going to give him a hug
03:54bbloom:-)
03:55RaynesCongratulations, you've written code in a language without classes and curly brackets.
03:55Raynes:p
03:56bbloomit's much more than that. the scala transform uses a mutable AST with a big transform visitor pattern thing
03:56bbloomhttps://github.com/scala/scala/blob/master/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala
03:56bbloombut the cljs AST is so much more pleasant to work with:
03:56bbloomhttps://github.com/brandonbloom/cljs-cps/blob/master/cps.cljs
03:57bbloomoops
03:57bbloomi mean:
03:57bbloomhttps://github.com/brandonbloom/cljs-cps/blob/master/cps.clj
04:20samrathow do I turn {:a 5} to "{:a 5}"?
04:21Sgeo,(str {:a 5})
04:21clojurebot"{:a 5}"
04:21SgeoThere might be additional something or other needed in order to ensure that it can be read back in by the reader, I'm not sure
04:22Sgeo,(doc str)
04:22clojurebot"([] [x] [x & ys]); With no args, returns the empty string. With one arg x, returns x.toString(). (str nil) returns the empty string. With more than one arg, returns the concatenation of the str values of the args."
04:22SgeoNot especially helpful
04:22Sgeo,(str "\n")
04:22clojurebot"\n"
04:22Sgeo,(str {:a "\n"})
04:22clojurebot"{:a \"\\n\"}"
04:22bbloomuse pr-str
04:22bbloom,(pr-str {:a 5})
04:22clojurebot"{:a 5}"
04:22bbloom,(doc pr)
04:22clojurebot"([] [x] [x & more]); Prints the object(s) to the output stream that is the current value of *out*. Prints the object(s), separated by spaces if there is more than one. By default, pr and prn print in a way that objects can be read by the reader"
04:23bbloom,(doc str)
04:23clojurebot"([] [x] [x & ys]); With no args, returns the empty string. With one arg x, returns x.toString(). (str nil) returns the empty string. With more than one arg, returns the concatenation of the str values of the args."
04:23bbloom,(doc print)
04:23clojurebot"([& more]); Prints the object(s) to the output stream that is the current value of *out*. print and println produce output for human consumption."
04:23SgeoAdmittedly, samrat didn't specifically ask about readable in particular
04:23Sgeo>.>
04:25raekpr-str is the right one if you want something you can read back
04:25raek(its inverse is read-string)
04:26raek,(str {:x "abc"})
04:26clojurebot"{:x \"abc\"}"
04:26bbloomraek: it's PARTIAL inverse...
04:26raekhrm
04:26samratthanks guys
04:26raekbbloom: partial?
04:27SgeoCan't read in an object that can only be printed in an unreadable manner
04:27raekbecause it only holds for readable/printable types?
04:27bbloomright
04:27Sgeo,(pr-str java.lang.Object)
04:27clojurebot"java.lang.Object"
04:27SgeoHmm
04:28bbloom,(pr-str (java.lang.Object.))
04:28clojurebot"#<Object java.lang.Object@55f16c1e>"
04:28bbloom,(read-string (pr-str (java.lang.Object.)))
04:28clojurebot#<RuntimeException java.lang.RuntimeException: Unreadable form>
04:28SgeoDarn, I was about to try that
04:28bbloom:-)
04:29Sgeo,(pr-str (java.lang.Class.))
04:29clojurebot#<CompilerException java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Class, compiling:(NO_SOURCE_PATH:0)>
04:29SgeoCan Classes be constructed manually?
04:30bbloomSgeo: well i'd assume so, considering Clojure does it at the repl!
04:30SgeoGood point.
04:30SgeoIs it as easy as new Class(...)?
04:30bbloomI believe Clojure uses a library that emits JVM byte codes
04:30bbloombut you may also be able to do it with the reflection namespace
04:31bbloomclojurescript emits javascript strings and the repl evals them
04:31SgeoIn Smalltalk it's as simple as sending the appropriate message to the class you want to subclass
04:32SgeoThe IDE typically shows you the code it will execute
04:32bbloomin clojure, it's as simple as evaluating deftype…. java… not so much….
04:32bbloombut still doable!
04:33ChousukeSgeo: the Class class has a newInstance method for creating new instances.
04:34SgeoNeat
04:35SgeoWait, new instances? As in, new instances of classes where the class is known at runtime? I was expecting methods for making new classes at runtime
04:35amalloyClass/newInstance is generally pretty useless. you usually need to reflect to find its constructors
04:37amalloySgeo: constructing classes at runtime is absurdly heavy-weight. don't go down that road
04:38SgeoIsn't that what Clojure does? Or does REPL usage mean that all Clojure's usage of such is in circumstances where it doesn't really matter?
04:39Sgeo(As in, if the code is being compiled it can do it at compile-time, and most run-time creation of classes would be at the REPL where some latency is expected?
04:39amalloyyes, it is what clojure does. and if you feel like spending four years inventing a new language to do it, that's a good reason to go down such a heavyweight road
04:44SgeoWait, by heavy-weight, do you mean slow performance-wise, or difficult/annoying to write correct code to do, or both?
04:49amalloyall of the above
04:49amalloy(but mostly the latter, i expect)
04:50Sgeomostly both? </kidding>
05:05michaelr`is there a core function like group-by where the value is item and not a collection of items
05:05michaelr`?
05:06michaelr`something like:
05:06michaelr`(into {} (map (fn [field] {(field :name) field}) col))
05:15noidimichaelr`, you could use zipmap
05:15noidi,(zipmap (map :name c) [{:name "foo"} {:name "bar"}])
05:15clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: c in this context, compiling:(NO_SOURCE_PATH:0)>
05:16noidioops
05:16noidi,(let [c [{:name "foo"} {:name "bar"}]] (zipmap (map :name c) c))
05:16clojurebot{"bar" {:name "bar"}, "foo" {:name "foo"}}
05:28michaelr`noidi: ah cool
05:28michaelr`thanks
07:12hughfdjacksonthis is a daft question, but is there any obvious reason why in lein's repl, "(use '[clojure.core.logic :as l])" should result in "java.io.FileNotFoundException: Could not locate clojure/core/logic__init.class or clojure/core/logic.clj on classpath: (NO_SOURCE_FILE:0)"
07:13hughfdjackson?
07:17hughfdjacksoni'm running clojure 1.2.1, btw
07:21nbeloglazovhughfdjackson: it seems core.logic is not in classpath. Do you use lein to manage dependencies?
07:22hughfdjacksoni'm attempting to ;)
07:22hughfdjacksoni'd imagined that anything in core didn't require installation before usage in the repl
07:22hughfdjacksoni'm assuming i was wrong in this
07:22nbeloglazovYes. core.logic is standalone lib
07:23hughfdjackson:D okay
07:23hughfdjacksonthanks
09:24tomojhmm
09:24tomojsince clojure is AOT compiled, do you have to compile your own clojure for 1.7?
09:24tomojjava 1.7 I mean
09:25tomoje.g. reducers appears to be compiled against jsr166y
09:36wmealing_is it just me, or does paradit mode / emac suck for inserting square brackets
09:39wmealing_it doesn't treat hightlighted areas like it would for ( or {
09:42tomojhighlighted areas?
09:44wmealing_for example
09:44wmealing_say i selected "this is a dog" in this sentence.. i use the mouse to highlight it, make aregion i think the word is.. then if it was the ( style brackets, i wanted i,d hit super shift (
09:44wmealing_and it would put it at the start and end of the highlight
09:44wmealing_but if i do the same with [ , it doesn't work.
09:45tomojhmm, super shift (?
09:45skoodgeis there any API overview for core.logic similar to http://clojure.org/api ?
09:46wmealing_super, the windows key..
09:46wmealing_s-( in the emacs speak iirc
09:47tomojdo `C-h k` that
09:47tomojI don't think I have such a binding
09:47tomojfor me, just typing ( or [ wraps the region appropriately
09:47tomojM-( and M-[ also work
09:50wmealing_it tells me M-[ is undefined
09:50wmealing_so.. i need to figure out why my paredit is being dumb
09:51wmealing_M-( works.. and brings up the help
09:51wmealing_but M-[ does not
10:02wmealing_tomoj: looks like i dont need M-[ just highlight and [
10:03wmealing_thanks though, you got me on the right path
10:07tomojhmm
10:07tomojC-h v paredit-version ?
10:08tomojif it's not 23, maybe upgrade
10:08tomojhttp://mumble.net/~campbell/emacs/paredit-beta.el
10:09tomojoh
10:09tomojI have this in my init.el
10:09tomoj(define-key paredit-mode-map (kbd "M-[") 'paredit-wrap-square)
10:09tomoj(define-key paredit-mode-map (kbd "M-{") 'paredit-wrap-curly)
10:13wmealing_ah, yep, the warp did it
10:13wmealing_thanks
10:13wmealing_tomoj: the wrap did it
10:13clojurebotI don't understand.
10:16tomojwtf ? https://raw.github.com/gist/3bab917287a7fd635a84/f38bfe3e270556e467f3fc02062af7ea10781390/gistfile1.txt
10:21wmealing_tomoj: that'll teach you
10:22tomojhmm
10:23tomojhttps://gist.github.com/3c8677f8cdb5e95683f9 the line in the try is in my stacktrace
10:23tomoj//aargh ??
10:23lazybottomoj: What are you, crazy? Of course not!
10:24tomojoh
10:54wmealing_I'll ask before i invest into this, i'm interested in adding a web gui to configure a daemon i'm writing, noir looks easy enough.. is it easy to integrate that into an existing daemon (via threads.. or something else ?)
10:54wmealing_any suggestions, or better ways to do it ?
10:55wmealing_or should i write it as anoir app, and thread off the daemon.
10:56xeqiwmealing_: can your daemon call run-jetty?
10:58wmealing_i guess it could.
10:58casionwhy would you want the daemon to run the gui? that seems backwards to me
10:59wmealing_so you think the gui should run the daemon ?
11:00wmealing_or rather, the noir application, should fire it up
11:00casionI'd think that would make more sense
11:01xeqihow is your web frontend going to interact with the daemon?
11:01wmealing_essentially just write the configuration files for it
11:01wmealing_the daemon watches for config changes
11:01wmealing_and re-reads it when they do
11:02casionthey can just be separate then can't they?
11:02casionwhy any relation at all
11:02wmealing_users.
11:02casionyou can just have a parent that launches both
11:02wmealing_if they have to start two things
11:02wmealing_its complicated
11:02wmealing_so, make these into jars.
11:03wmealing_and call webapp/start and daemon/start
11:03wmealing_hmm, thats not a bad idea
11:03wmealing_keeps the code base separate
11:04wmealing_i like that best
11:04wmealing_that way i can pull out the webui if its not required
11:04wmealing_easily
11:04xeqiyeah, that would be my recommendation
11:04wmealing_thankyou both for talking it through with me.
11:05casionthank you for having an updated version of clj-audio ;)
11:05wmealing_which reminds me, i added recording support.. the guy hasn't responded to my pull / mail about that
11:06casionI'm writing a clj-audiofile atm
11:06wmealing_on github ?
11:06casionso better handle format and file handling beyond what javax.sound.sampled does
11:06casionit will be there soon
11:06wmealing_please let me know when
11:06wmealing_yeah, sampled is preetty limited.
11:06casionI just figured out all the specifics last night, implementing stuff today
11:07wmealing_i'd like to be able to hook that up to clj-audio to read and write directly into different formats.
11:07casionI had that working in repl last night quite thoroughly
11:07casionalong with getting lazy-seqs of various formats, and a few basic dsp ops
11:07wmealing_nice.
11:08casionI should have at least a basic file->seq setup online today
11:08casionmaybe with some dsp, not sure… stuff is slow and that makes me queesy
11:26tomoj"select is not broken"
11:27wmealing_except when it is
11:27tomojwell, the fact that PHM fold can silently skip over exceptions in the reduce function and descend into a stack overflow is sorta broken
11:27tomojbut the reason it did that is cus my code is broken
11:28tomojI assumed it was a bug in clojure from the stacktrace..
11:28tomojwonder why they catch those exceptions
11:29wmealing_https://bugzilla.redhat.com/show_bug.cgi?id=812148 <-- select being broken.
11:29wmealing_hopefully that is public enough
11:39tomojhuh "You are not authorized to access bug #812148"
11:39tomojsecret bug?
11:40gfredericksdoes lein-cljsbuild support turning assertions off?
11:40zenoliDoes core.logic work on collections other than vectors? Specifically, I've got a bunch of sets that I'm working with.
11:41gfrederickszenoli: it only works naturally with seqs; depending on what you're doing exactly you might be able to make it work
11:41gfredericksbut if you want to do set-logic then you probably can't
11:43wmealing_tomoj: ah sorry dude.. yeah i think it has specific customer details in it
11:43wmealing_and they opted not to share.
11:44zenoligfredericks: Thanks. It's actually worse than that, since I'm actually using a custom multiset collection. I might be able to do something with a seq of the key-multiplicity pairs, then, but I'll have to mull it over.
11:45gfrederickszenoli: I just mean if you can treat them like a seq you'll be okay, but if what you want to do involves logic statements like (intersectiono a b c), then it'll at best be fairly inefficient
11:46gfredericksI guess you could do sets in a decent way if you had an ordering...
11:46gfredericksa multiset is just a sorted seq :)
11:49casionI guess today is better than never to learn how to use git(hub)
11:49wmealing_good luck
11:49casionyou people and your fancy idea sharing :P
11:49wmealing_:)
11:56zenoligfredericks: Well, clustered if not exactly sorted, based on how seq emits it. If I can keep the set-specific stuff out of the rules and just unify on the tricky element-specific relations, it might be possible to use without paying too horrible of a performance penalty.
12:04gfrederickszenoli: I just meant that multisets biject naturally with sorted seqs; not that the multiset would naturally emit sorted elements
12:05gfrederickse.g., if you represented your multisets within core.logic as sorted seqs, then you could do relatively efficient set operations
12:19samratwhy is Noir giving me a "Key must be Integer" error even though I am passing an integer(using GET)?
12:20samrat...any way to convert all keys to Integers?
12:21gfredericks&(get [1 2] :foo)
12:21lazybot⇒ nil
12:21gfrederickshuh
12:24gensymvhello, does clojure support pattern matching?
12:25gfredericksnot natively, but there's a core.match library that is pretty good
12:25duck1123gensymv: not exactly, but there are plenty of ways you can get a similar effect
12:25gfredericksit does have destructuring though
12:26AimHereIf you mean regex string patterns, then yes, otherwise, what those other guys said
12:26gensymvgfredericks: thanks
12:26duck1123multimethods are also pretty good for a lot of things
12:28gensymvduck1223: are multimethods overloaded functions?
12:29gensymvi.e java styled polymorph methods?
12:30AimHereWell it's polymorphism, but you're dispatching on anything-you-like, instead of on the type of the argument
12:31gensymvi see, thanks.
12:31AimHereYou could take a date as an argument, and call one function when there's an 'r' in the month, and another otherwise, sort of thing
12:33xeqi([1 2] :foo)
12:33xeqi&([1 2] :foo)
12:33lazybotjava.lang.IllegalArgumentException: Key must be integer
12:35gfredericksoh that's it; weird.
12:36gfredericksI guess get just uses the generic map interface, so vectors aren't special to it
12:37gfrederickswell the Vector#get could still throw :/
12:37gfredericks&([1 2] 70)
12:37lazybotjava.lang.IndexOutOfBoundsException
12:53BreadMonsterHow do I install Clojure on Windows, guys?
12:54nbeloglazovBreadMonster: do you have JDK installed?
12:55BreadMonsterYup.
12:55BreadMonsterWait, how do I check?
12:55BreadMonsterjavac, right?
12:55nbeloglazovyes
12:55BreadMonsterOkay, I don't have JDK.
12:55raekthen you install Leiningen
12:55BreadMonsterDon't you get precompiled binaries?
12:55BreadMonsterI mean .jar files?
12:56nbeloglazovBreadMonster: check Program Files. You may have jdk but it's not in the PATH variable.
12:56jkkramerBreadMonster: http://dev.clojure.org/display/doc/Clojure+Tools and https://github.com/technomancy/leiningen#readme
12:57BreadMonsterNope, I lack JDK.
12:57BreadMonsterVery unfortunate.
12:57BreadMonsterAnd I'm on my family PC, so I can't install anything.
12:58jkkramerBreadMonster: http://tryclj.com/ and http://www.4clojure.com/ if you want to play with Clojure without installing
12:58nbeloglazovDoes lighttable requires installed clojure and jdk?
13:03BreadMonsteralright, thanks guys :0
13:03BreadMonsterAlso, I'm working on a To Do application.
13:03BreadMonstercan I do that in Clojure?
13:05nbeloglazovYou can do all kind of things in clojure. Except may be low level coding.
13:08BreadMonsterReally?
13:08BreadMonsterIs there a tutorial of some sorts?
13:08Frozenlo`BreadMonster: I might get flamed for saying this here, but if you just want a todo application (not to learn the language), you can just go with org-mode :P
13:08gensymvis there a way to make the clojure repl more verbose (i.e like sbcl or clisp)? the error messages can get a little hard to decipher sometimes.
13:09BreadMonsterOh, I can do it in C, Python, Java, Mathematica, NASM, and half a different languages.
13:09BreadMonsterI had no idea how to do it in LISP.
13:09BreadMonsterHence I watned to start with thtat.
13:13FrozenlockBreadMonster: Are you looking for clojure or clojurescript?
13:13dansalmohttp://stackoverflow.com/questions/12238024/is-there-a-clojure-function-between-read-string-and-load-string
13:15Frozenlockdansalmo: I answered.
13:15dansalmothank you
13:15FrozenlockHope it's enough for you ^^
13:16samratwhy is this doseq not working inside Noir's defpage? https://www.refheap.com/paste/4802
13:17ivaraasensamrat: doesn't doseq return nil?
13:18Frozenlocksamrat: Also, why 'when-let'? Couldn't it be 'when'?
13:18dansalmoFrozenLock: Works perfectly, but I seems like magic. How does it make read-string read all of the objects?
13:20Frozenlock,(doc *read-eval*)
13:20clojurebot"; When set to logical false, the EvalReader (#=(...)) is disabled in the read/load in the thread-local binding. Example: (binding [*read-eval* false] (read-string \"#=(eval (def x 3))\")) Defaults to true"
13:21samrativaraasen: thanks
13:21samratFrozenlock: oh, yeah. something was missing there too
13:23dansalmo, (+ 1 1)
13:23clojurebot2
13:26Sgeo,(map (partial + 1) [1 2 3 4 5])
13:26clojurebot(2 3 4 5 6)
13:45gfredericks&(let [s " S I I ( S I I)"] (read-string s))
13:45lazybot⇒ S
13:46gfredericks&(let [s " S I I ( S I I)"] (read-string (str "[" s "]")))
13:46lazybot⇒ [S I I (S I I)]
13:46FrozenlockIs there a way to get a function metadata in cljs? The docstrings, the arguments list and all.
13:46gfredericksFrozenlock: I think that's normally only attached to the var
13:47FrozenlockSo there's no '(doc some-fn)' in cljs?
13:48gfredericksoh you said cljs
13:48gfredericksis there metadata at all in cljs?
13:48gfrederickscertainly there are no vars, so I think docstrings are ignored
13:48casionis there a bug in nrepl that makes it clear the current namespace and not be able to load another?
13:49Frozenlockgfredericks: This is very very sad.
13:49gfredericksthere does seem to be metadata generally
13:50gfrederickslooks like you can't put metadata on functions though
13:50dansalmoFrozenlock: I am such a noob. I am glad to find out about the safe read, but it seems that my original issue was solved by adding ()'s around the form, which I did inadvertently when trying the safe-read.
13:50gfredericksdansalmo: yeah that's what I was trying to point out above; I wasn't sure why you thought Frozenlock's code worked
13:51dansalmo, (read-string "( S I I( S II ))"
13:51clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
13:51dansalmo, (read-string "( S I I( S II ))")
13:51clojurebot(S I I (S II))
13:51dansalmo0, (last (read-string "( S I I( S II ))"))
13:51dansalmo, (last (read-string "( S I I( S II ))"))
13:51clojurebot(S II)
13:51dansalmo, (last (read-string "( S I I( S I I ))"))
13:51clojurebot(S I I)
13:52dansalmoIt was magic! The magic of the perfect mistake in my application of his advice
13:53FrozenlockWeird, I had to change the *read-eval* binding otherwise it would sometime choke on the string.
13:53dansalmoI did not think read-string did any eval
13:53gfredericksit only does if you have a #= form
13:53dansalmoI thought only load-string did.
13:53Sgeo,(read-string "#=(+ 1 1)")
13:53clojurebot#<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>
13:54Sgeo,(binding [*read-eval* true] (read-string "#=(+ 1 1)"))
13:54clojurebot2
13:54gfredericksI think read-eval should be off by default now that there are data readers
13:56Sgeo,(meta '*read-eval*)
13:56clojurebotnil
13:56Sgeo?
13:56Sgeo,(meta #'*read-eval*)
13:56clojurebot{:ns #<Namespace clojure.core>, :name *read-eval*, :added "1.0", :doc "When set to logical false, the EvalReader (#=(...)) is disabled in the \n read/load in the thread-local binding.\n Example: (binding [*read-eval* false] (read-string \"#=(eval (def x 3))\"))\n\n Defaults to true"}
13:56Frozenlockdansalmo: My apologies, I was totally wrong :)
13:57Sgeo,(:dynamic (meta #'*read-eval*))
13:57clojurebotnil
13:57Sgeo??
13:57lazybotSgeo: What are you, crazy? Of course not!
13:57SgeoIf it's nil, how come I'm able to binding it?
13:58Sgeo,(doc binding)
13:58clojurebot"([bindings & body]); binding => var-symbol init-expr Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before. The new bindings are made in parallel (unlike let); all init-exprs are evaluated before the vars are bound to their new values."
14:01bbloom,(.isDynamic #'*read-eval*)
14:01clojurebottrue
14:01bbloomseems like the metadata and the Var object are out of sync
14:01bbloomlooks like a bug
14:03bbloom,((juxt (comp :dynamic meta) #(.isDynamic %)) #'*agent*)
14:03clojurebot[nil true]
14:04bbloomseems like a consistent bug for all of the dynamic vars in RT.java
14:04Sgeo*gasp* someone used comp instead of ->? I'm in shock
14:05Sgeo,(doc juxt)
14:05clojurebot"([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"
14:06bbloom,((juxt #(-> % meta :dynamic) #(.isDynamic %)) #'*warn-on-reflection*)
14:06clojurebot[nil true]
14:06bbloomjust for you :-)
14:06bbloomanyway, yeah, setDynamic should set the :dynamic metadata too :-P
14:08SgeoPossibly including a function that combines those
14:09bbloomthat's an interesting idea...
14:10hyPiRion,(doc comp)
14:10clojurebot"([] [f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc."
14:11bbloom,(let [$ (fn [& args] (apply comp (reverse args)))] (($ meta :doc) #'*read-eval*))
14:11clojurebot"When set to logical false, the EvalReader (#=(...)) is disabled in the \n read/load in the thread-local binding.\n Example: (binding [*read-eval* false] (read-string \"#=(eval (def x 3))\"))\n\n Defaults to true"
14:11bbloomi like it....
14:13SgeoNot quite my suggestion, but I think you can see I'm getting at a less macro-y, more functional and more general replacement for ->
14:13bbloomah, i overlooked the x
14:13gfredericks$google clojure thrush
14:13lazybot[fogus: Thrush in Clojure – Redux] http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/
14:14gfredericksSgeo: ^
14:15bbloomgfredericks: welere there you go :-)
14:15bbloomwell there my keyboard failed me
14:16yankovis lazyseq good for both random access and appending/prepending elements?
14:16gfredericksnope
14:16bbloomseq implies linear operations starting from the head
14:16Sgeogfredericks, awesome. Why wasn't that put in Clojure instead of -> and ->>?
14:16yankovdammit
14:17gfredericksSgeo: heckiphino
14:17bbloomvectors are what you want if you need logorithmic access
14:17bbloomSgeo: I quite like -> and ->>
14:17gfredericksbut vectors won't get you prepension
14:17yankovbbloom: yeah, but vectors are bad for appending/prepending stuff?
14:17yankovyep
14:17bbloomsaves the need for the extra # and % symbols
14:17gfredericksvectors are good for appending
14:18gfredericksyankov: if you need something more general, look at finger trees
14:18hyPiRion-> and ->> are more general and more succinct. That's not to say they should be used everywhere.
14:18bbloomyankov: they are logorithmic for both prepends and appends. seqs have constant time prepends and linear appends
14:18gfredericksbbloom: not for prepends
14:18SgeohyPiRion, more succint in some cases I get, but more general?
14:19bbloomgfredericks: what not for prepends?
14:19yankovgotcha.. thanks. I'll look more
14:19Sgeo-> always stuffs into second argument, ->> into last argument
14:19gfredericksbbloom: vectors are linear time for prepends
14:19bbloomSgeo: first argument. second element of forms
14:19hyPiRionSgeo: True enough, not more general. I forgot you can use #() to simulate -> and ->>.
14:19gfredericksbbloom: at least if you want a vector as the result
14:20bbloomhm. yeah, clearly you can prepend constant time and get a seq
14:20bbloombut i'm surprised it's linear…. i guess i'll need to check my internal assumption about their tree structure
14:20bbloomi've read the map/set implementations
14:20bbloombut not vec
14:20gfredericksbbloom: it's related to the array-mappedness
14:20pyykkisoh, $ form is interesting
14:20gfredericksparticularly the fact that the underlying arrays are all the same length
14:22bbloomgfredericks: are you sure….?
14:22bbloomthis looks like how i expected the tree to work
14:22gfredericksbbloom: 99%
14:23gfredericksenough to bet $20 on it
14:23bbloomi'm looking at PersistentVector.java
14:23bbloompublic PersistentVector cons(Object val)
14:23gfrederickscons appands to the end
14:23gfredericksappends*
14:23bbloomno, that's conj
14:23gfredericksconj calls PersistentVector#cons
14:23gfredericksjust to be confusing
14:24Sgeoconj appends to the most efficient place to append, I think
14:24gfrederickswhich is determined by CollectionClass#cons
14:25bbloomwell that's very confusing
14:25bbloomlol
14:25bbloombut you're right:
14:25bbloom,(.cons [1 2 3] 4)
14:25clojurebot[1 2 3 4]
14:25bbloomthe definitions of cons and conj seem like copy paste....
14:25bbloom<look-of-disapproval/>
14:26gfredericksI know, let's make clojure.core/empty call .full!
14:27bbloomgfredericks: it's somewhat funny to me how beautiful clojure is, but how ugly the java that goes into it is
14:28gfredericksyeah
14:29bbloomone of the things clojure (and it's source!) has taught me is to ignore superficial beauty. the awkward shape of the average lisp function is ugly, but the beauty of the underlying approach sines through once you look past the parens :-)
14:29bbloomshines*
14:30bbloomdammit. i had things to do man. now you got me watching houser's talk about finger trees
14:30gfrederickshaha
14:33samratif I want to rename a lein project, is there an easier way than to rename each directory?
14:33samratmaybe a plugin or something?
14:44xeqisamrat: nothing I know of; and don't forget to change the namespaces in the files
14:45yankovbbloom: can you share a link to the houser's talk? :)
14:45yankovlooks like finger trees is what i need. checking out the library
14:45casionanyone know of an easy way to cast a byte-array of arbitrary size to a long?
14:45casion#java seems to not know atm
14:45bbloomyankov: heh, funny you should ask…. https://github.com/clojure/data.finger-tree/pull/2
14:45bbloomi'm 12m ahead of you :-)
14:45weavejestercasion: Which endian?
14:45yankovhaha
14:46casionweavejester: both. I don't get to know until the function gets the array
14:46casionI do have a map with the byte-array and endianness that's being passed around
14:47casionI'm processing audio files, which can be 8/16/24/32(int or float)/64(int or float) bit, all signed or unsigned
14:47casionand can be either big or little
14:48weavejestercasion: Oh, okay. So just a bitwise and then a bitshift left, right?
14:48casionweavejester: yes
14:48weavejestercasion: You might have to write the function yourself, I think...
14:49casionissue so far is that I have do reverse the array depending on endianess, and bit-and for signed, but not for signed
14:49casionI thought maybe java had a better way :(
14:49casionand a loop that shifts based on index
14:51weavejestercasion: You don't have to reverse the array - just bitshift the value instead of the output
14:52weavejestercasion: Though since you'd have to maintain an index, reversing would probably be less code
14:53Frozenlockbbloom: stop posting interesting videos!
14:54casionweavejester: that was my thought too, but reversing every frame is quite slow when processing a 3gb file
14:54bbloomi know, videos are killer.
14:54bbloomand papers/pdfs
14:54bbloomeasy way to lose a perfectly good side project day!
14:54bbloomsorry :-/
14:54casiontreading the line between speed and complexity I guess
14:55FrozenlockMeh, at my stade learning more won't hurt :P
14:55FrozenlockI wonder why they film the slides instead of using the video output to the projector.
15:01bbloomFrozenlock: for the same reason that conference calls are always still awkward as hell
15:01bbloomie. a grand mystery
15:07black_joeI am new to Lisp in general and would like to start learning Clojure (since I already know Java). Is there a book that the community supports for a clojure newbie?
15:08technomancyblack_joe: I'm a fan of clojurebook.com
15:09bbloomblack_joe: i also recommend following some of the top users on http://www.4clojure.com/
15:09bbloom(and of course doing the puzzles)
15:09black_joeClojurebook is what I was considering too. It looks like the standard book for Clojure.
15:09black_joeKind of like what "The C programming language" is to C.
15:13nDuff...opinions are split on whether JoC is good for beginners or not -- personally, I think it is, because IMHO it's more important to understand the "why" than the "how", but that may depend on how you learn.
15:13black_joeI think I will just get the O' Reilly book for now. The only reason I didn't just buy that at first was because it is O' Reilly.
15:13SgeoOh huh cemerick wrote Clojure Programming
15:13nDuff...the O'Reilly book does some why, and a whole lot of very good how, but JoC completely nails the why.
15:14cemerickSgeo: I had some help, of course. :-)
15:23casionthere's always programming clojure as well
15:27clojure-newcomerhi guys… how do I convert a string to a number type in clojurescript ?
15:28gfredericksyou can use cljs.reader/read-string at least
15:28gfredericksjs/parseDouble or something like that also?
15:29clojure-newcomergfredericks: thanks, I'll look it up
15:29Sgeogfredericks, parseDouble might be a bad idea if clojure-newcomer wants to do money stuff
15:30SgeoSo would read-string I would assume
15:30gfredericksSgeo: well doubles are all clojurescript has at the moment
15:30gfredericksso should be equilavent
15:30clojure-newcomersgeo: I just need something like "1234567" -> 1234567
15:30SgeoSo why not js/parseInt
15:31clojure-newcomerit is getting passed into clojure later on the server side where it needs to be a Long
15:31gfredericksread-string for forwards compatibility; maybe someday we'll have proper integers :)
15:31Sgeocljs.user> (cljs.reader/read-string "123")
15:31Sgeo123
15:31SgeoThat works
15:32clojure-newcomerI'm going to have to dig up read-string… unfamiliar but looks good, thx guys
15:32SgeoI think there should be a reader-level way to distinguish platform
15:33SgeoSomething similar to Common Lisp's #+ and #-
15:33gfredericksI think there was a design page for that
15:37S11001001Sgeo: on the other hand, the lack of reader conditionals has led to creativity in platform detection, e.g. ##(first [+' nil])
15:37lazybot⇒ #<core$_PLUS__SINGLEQUOTE_ clojure.core$_PLUS__SINGLEQUOTE_@115edb0>
15:37Sgeo...o.O huh?
15:37gfrederickspresumably +' exists in jvm-clj but not cljs
15:38S11001001Sgeo: that's how you write 1.2/1.3-compatible safe +
15:38S11001001don't know about cljs; never looked at it
15:57FrozenlockLighttable is supposed to be licenced under the GPL, but I can't find any source (either on ibdknox or kodowa repo). Is it because it has not been released yet?
16:51technomancyFrozenlock: it was originally distributed under the EPL, but I asked him about that and he said that was unintentional
16:53FrozenlockOh that's a shame.
16:54FrozenlockI was basing my assumptions one "Nope! The plan is still for the platform to be open source, likely under a GPLish license." http://news.ycombinator.com/item?id=3992101
16:54Frozenlock*on
16:55technomancyI'm not sure what we should do about Clojars distributing jars that don't have a license declared; it's probably not completely legal
16:59Frozenlock(get jar :license "EPL") tada :)
17:00xeqitechnomancy: register a dmca agent, and wait for takedowns?
17:01rodhi - i've been trying to use ring + compojure with clojure 1.4.0, but the params and session middleware wasn't working, so i changed back to 1.3.0 and it's fine. are there known issues with this? thanls
17:02weavejesterrod: No… I'm using 1.4.0 right now and it works fine.
17:02weavejesterrod: What version of Ring/Compojure?
17:02rodcompojure 1.1.1
17:03weavejesterrod: Could you provide an example project where it goes wrong?
17:03rodparams and session just seemed to have no effect, so i toggled back to 1.3.0 in my project.clj and it's dandy again. odd...
17:04weavejesterrod: I'm using the same version with 1.4.0 and params and sessions work okay for me.
17:04Frozenlocktechnomancy: what's the clojurers opinion on GPL?
17:05rodweavejester: here's my work in progress (don't judge me! :P) https://github.com/rodnaph/weare/tree/require-login
17:06rodjust clone and lein run if ur gonna try it.
17:08weavejesterOkay, I'm trying it out
17:11technomancyFrozenlock: I love it, but I don't know if it's compatible with the EPL. I'm happy that the community has taken strongly to a copyleft license with the EPL in any case.
17:12weavejesterEPL isn't compatible with GPL, because GPL says "no more restrictions" and EPL says "you need to grant a license for any patents you have that cover the modifications you made"
17:13weavejesterrod: I'm running it; no difference on 1.3.0 and 1.4.0, but neither seem to do a whole lot.
17:13weavejesterClicking "create job" just prints to the console
17:13technomancyit's ironic that the EPL's further protection of your freedom prevents GPL compatibility
17:14technomancyit bugs me that people don't consider patent protection in ruby-land; most people just slap the MIT-X11 license on it and don't think twice about it
17:14rodweavejester: yeah it's not a functional example sorry... i was trying to integrate friend, but when dumping the request when i was POSTing a login, there were no :query-params, :params, etc... in the req.
17:14rodweavejester: nm, it's probably my fault anyway, and it's working now so i'll just crack on.
17:15weavejesterweavejester: Was friend above or below the handler/site middleware?
17:15weavejesterI should have really called that wrap-defaults instead of site
17:19rodif it happens again i'll look into it more closely. thanks for your help weavejester. :)
17:19weavejesterrod: no problem
17:53dansalmo, (seq (str (first '(xyz))))
17:53clojurebot(\x \y \z)
17:54dansalmois their a simpler way to get a seq from a symbol?
17:54dansalmo, (seq (str (first '(xyz))))
17:54clojurebot(\x \y \z)
17:56gfredericks,(-> xyz quote str seq)
17:56clojurebot(\x \y \z)
17:56gfredericksif that's what you want, that's probably the easiest way to get it. but it's a weird thing to want
17:58dansalmoIt seems I always want weird things. :)
17:58gfredericksif mine was hard to understand, equivalent is ##(seq (str 'xyz))
17:58lazybot⇒ (\x \y \z)
17:59dansalmobut the thread is the same thing, isn't it?
17:59gfredericksbasically the same thing you did but there's no reason to put the symbol in a list and pull it back out
17:59dansalmoah, thats better
18:00dansalmoI am trying to find a way of determining if a certain character is in a symbol
18:00gfrederickswhy do you have symbols? wouldn't strings be more natural?
18:00dansalmolike y in symbol xyz
18:00gfredericks,(.indexOf "xyz" "y")
18:00clojurebot1
18:01dansalmoI have the symbol directly
18:02oichHow can I run swank-clojure with leinigen 2? There is no "lein swank". I'm an emacs user new to clojure. I'm trying to setup clojure-mode.
18:06dansalmo:gfredericks (.indexOf (-> xyx quote str) "y")
18:06dansalmo, (.indexOf (-> xyx quote str) "y")
18:06clojurebot1
18:06gfredericksyep
18:06gfredericks,(-> xyx quote str (.indexOf "y"))
18:06clojurebot1
18:06technomancyoich: you can put it in your user profile, or you could use nrepl.el
18:06dansalmois there no purely clojure way that would give true or false?
18:07gfredericks$findfn "xyx" "y" 1
18:07lazybot[]
18:07gfredericks,(-> xyx quote str (.indexOf "y") neg? not)
18:07clojurebottrue
18:07gfredericks$findfn "xyx" "y" true
18:07lazybot[clojure.core/not= clojure.core/distinct?]
18:08tomoj&(.contains (name 'xyz) "y")
18:08lazybot⇒ true
18:09dansalmo:tomoj I like that, thakns\
18:10gfredericks,(map (juxt name str) 'foo 'bar/baz)
18:10clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>
18:10gfredericks,(map (juxt name str) '[foo bar/baz])
18:10clojurebot(["foo" "foo"] ["baz" "bar/baz"])
18:11gfredericksdansalmo: since we have no idea why you're using symbols you should note the difference between str and name
18:12dansalmoI am so new to clojure, just hacking around
18:13gfredericksthat justifies just about anything
18:13dansalmoI need a boolean value for the presence of a character in a symbol
18:14gfredericks,((fn [sym char] (.contains (str sym) (str char))) 'foobledooble \d)
18:14clojurebottrue
18:16hyPiRion,(some #{\d} (str 'foobledooble))
18:16clojurebot\d
18:17S11001001oich: https://groups.google.com/d/msg/clojure/xzvI_kCaeNI/zvCA1Nfaad4J
18:17S11001001oich: oh I see technomancy already said something
18:19dansalmo:gfredericks I see what you mean re: name vs string.
18:19dansalmo, (name :xyz)
18:19clojurebot"xyz"
18:19dansalmo, (str :xyz)
18:19clojurebot":xyz"
18:19dansalmoI need string
18:19gfredericksdansalmo: I was going on about your use of symbols because they're generally only used for actual code; for data, strings and keywords are more idiomatic
18:20dansalmoI am using if for code
18:20oichtechnomancy thanks and thanks S11001001. So far things appear to be working.
18:41samaaronhey - anyone in here mess around with jayq and clojurescript much?
18:46gfrederickssamaaron: I'm doing it right now
18:47gfredericksthough the use of jayq is rather minimal
18:47samaarongfredericks: i'm trying to understand how all this stuff fits together
18:48samaaronso, for example, if I include jayq in my project.clj, how does cljs interact with it?
18:48gfrederickswell the jayq code gets put on the classpath
18:48gfredericksso you can require the cljs files therein
18:49samaarongfredericks: yup, i'm with that part
18:49samaaronso all the cljs fns are available
18:49gfrederickssure
18:49samaaronbut what of the resources?
18:49gfredericksthe resources in jayq?
18:49samaaronjayq seems to ship with jquery.js
18:50gfredericksoh I was supplying my own
18:50samaaronok, that makes some sense
18:50gfredericksin fact it might be the case that my usage of jayq could be replaced with js/$
18:51samaaronhmmm, so this is where i start to lose the plot :-)
18:51gfredericks(js/$ foo bar) should emit $(foo bar)
18:51samaaronbut jayq has ($ :foo)
18:51gfredericksbut I don't know if that usage is recommended or guaranteed to be supported
18:51gfrederickswhat does that doo?
18:52samaaronto be honest, i don't know :-)
18:52gfrederickslets you use keywords instead of strings?
18:52samaaroni've just seen it being used
18:52gfredericksI oughta try it
18:52samaaroni'm still yet to get a working app set up to play about
18:53gfredericksany concrete blockers?
18:53samaaronwell, i still don't know what to do about jquery.js
18:53gfredericksdo you get browser errors about $ not being defined?
18:53samaaronis supplying your own idiomatic?
18:54gfredericksI don't know how much idiomacy there is in cljs so far
18:54samaaronhahaha
18:54gfredericksif you want to use the one in the jayq jar you'll probably just have to figure out the appropriate way to wire it down to your browser
18:55samaaroni'm just wondering why there's a jquery.js in the jayq jar at all...
18:55gfredericksjust in case?
18:55gfrederickscould be an accident even
18:55samaaronthe jayq docs don't say anything about jquery.js
18:56gfredericksI think you are looking too hard for the answer to the ultimate question of life, the universe, and everything
18:56samaaronhaha
18:56samaaroni just like to understand things
18:56gfredericksthe clojurescript ecosystem is a giant vacuum of explanations
18:56samaaronoh hey, i just found this line: (include-js "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&quot;)]
18:57samaaronin the defpartial in the overtone clojurescript example
18:57samaaronlooks like he doesn't use the bundled jquery.js
18:58Frozenlocksamaaron: do you have any particular function that you need in jquery? Otherwise you could try enfocus and domina
18:58samaaronFrozenlock: to be honest, I know no javascript
18:59Frozenlocksamaaron: welcome to my world, a week ago!
18:59samaaronand thought that somethign jquery based would be good from a tutorial perspective
19:02FrozenlockYou might have to do direct js call often, but yeah :P
19:02samaaronFrozenlock: what kind of thing(s) are you doing with cljs and which tools are you using?
19:04FrozenlockMostly Domina and Enfocus to play with the DOM. Everything else is pretty much clojure.
19:05Frozenlockhttps://github.com/Frozenlock/siren For notifications on a webpage
19:05Frozenlockhttps://github.com/Frozenlock/zyzanie because I'm an emacs junkie :P
19:06samaaronFrozenlock: so are you using enfocus?
19:06FrozenlockIndeed
19:06samaaronand how are you finding it?
19:08FrozenlockI must say I prefer Domina most of the time. But Enfocus provide some higher function that are really neat. (Chaining animation, for example)
19:08FrozenlockBut I'm not using the Enlive-style templates, so I might be missing most of what Enfocus can give.
19:08samaaronah ok
19:09samaaroni'll play with domina for a bit :-)
19:17FrozenlockAnyone else working with cljs have suggestions?
19:18samaaronFrozenlock: so i'm having issues with domina. I've referenced the jar in project.clj, :required the ns and then compiling throws up a whole heap of "Use of undeclared Var domina/*" erors.
19:21FrozenlockYes, there's a pull request for that. It should work anyway.
19:21samaaronFrozenlock: hmm, seems I had a bug, and errors were unrelated
19:22FrozenlockNo there is some undeclared variable errors
19:22samaaronyey, i've successfully appended something to my dom via cljs
19:22Frozenlock\o/
19:22Frozenlock,hurray
19:22clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hurray in this context, compiling:(NO_SOURCE_PATH:0)>
19:23Frozenlockaw....
19:23samaaronhaha
19:43gfredericks~hurray
19:43clojurebotNo entiendo
19:43gfredericksclojurebot: hurray is <reply> \o/
19:43clojurebotIk begrijp
19:43gfredericks~hurray
19:43clojurebot\o/
19:44gfredericksthat bot just got 50% more useful
19:50Frozenlo`I'm a fan
19:50Frozenlo`,hurray
19:50clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hurray in this context, compiling:(NO_SOURCE_PATH:0)>
19:50Frozenlo`~hurray
19:50clojurebot\o/
19:50Frozenlo`clojurebot doesn't like commas?
19:50gfrederickscommas are for eval
19:51gfredericks(eval 'hurray) doesn't do anything meaningful
19:51gfredericksbecause hurray is not defined
19:51FrozenlockOh I see, ',' for serious stuff, '~' for fun.
19:52gfredericksthat is precisely the case
19:52Raynes&hurray
19:52lazybotjava.lang.RuntimeException: Unable to resolve symbol: hurray in this context
19:52gfredericksRaynes: wat? lazybot hates ampersands?
19:52Raynes&(let [gfred 1] (+ gfred gfred))
19:52lazybot⇒ 2
19:53gfrederickswhich keyboard character is the most uselessest for the average person? the tilde?
19:53Raynes¿
19:53gfredericksthat is not on my keyboard
19:53RaynesIsn't on mine either.
19:53gfredericksoh; perhaps you were saying something unrelated then
19:59Frozenlockright ctrl and escape
19:59FrozenlockOh no: the pause key
20:00gfredericksthe F keys take up an awful lot of space
20:04amalloygfredericks: scroll lock
20:04gfredericksI was interested in actual character things but these are good answers too
20:04gfrederickson my work computer I have scroll-lock set to change keyboard layouts
20:05gfredericksdelete is used 70000% more than the other five keys in its group
20:06amalloyi think i use home/end more
20:06gfredericksbet we're talking about the hoi polloi
20:07brehauti've just noticed that my keyboard as an eject key in that group. what kind of weirdo anachronism is that
20:08nDuffDid Apple stop having eject keys standard?
20:08amalloybrehaut: i'd guess it's a newism, not an oldism
20:08clojurebotbrehaut: I think struct embedding is monkey patching / mixins, and interface embedding is duck typing / typeclasses
20:09brehautamalloy: its probably an inbetweenish
20:11brehautnDuff: yes
20:11brehautnDuff: it looks like what was the eject key on the older MBPs is now a power key
20:11brehauton the retina MBP anyway
20:17casionhow do I get clojure to recognize a 2 byte value (say 0xd9) as a signed short (-39) rather than an int (217)
20:17brehaut(doc short)
20:17clojurebot"([x]); Coerce to short"
20:18casion,(short 0xd9
20:18clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
20:18casion,(short 0xd9)
20:18clojurebot217
20:18casionnope :|
20:18gfredericks,(.toString (short 0xd9))
20:18clojurebot"217"
20:19gfredericks,(.toString ^short (short 0xd9))
20:19clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: short, compiling:(NO_SOURCE_PATH:0)>
20:19gfredericks,(.toString ^Short (short 0xd9))
20:19clojurebot"217"
20:19casionshort is 4 bytes I guess
20:19casionseems I want to cast to byte
20:19casion,(byte 0xd9)
20:19clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for byte: 217>
20:20casionbut that happens
20:20gfredericksshort is two bytes I think
20:20brehautwell no
20:20casionI thought short was 2 bytes too, but I just looked it up and it's 4 16-bit)
20:20brehaut0xd9 isnt a byte pattern, its a hex description of a number right?
20:20gfredericks16-bit is 2 bytes
20:20gfredericksbrehaut: right
20:20casiongfredericks: err.. yeah
20:20casionthis is all hurting my brain now
20:20gfredericks,(Byte/valueOf "d9" 16)
20:20clojurebot#<NumberFormatException java.lang.NumberFormatException: Value out of range. Value:"d9" Radix:16>
20:21brehautcasion: and you want it to read as a particular byte format?
20:21casionI just want the byte-value of it reliably
20:21gfrederickswhy is 0xd9 insufficent for your purposes?
20:21gfrederickswhat are you doing with tthe "byte-value"?
20:22casionhere, give me a sec, I'll get an example
20:23amalloy&(unchecked-byte 0xd9)
20:23lazybot⇒ -39
20:24casionoooo, that does it
20:24gfredericksman I was even going to make a joke 3 minutes ago about waiting for amalloy to come by and tell us the real answer
20:24gfrederickswhat a fool I was
20:25casionthanks again amalloy :)
20:34FrozenlockCan a function name mess with clojurescript?
20:35gfredericksO_O?
20:36FrozenlockNvm, I must be doing something wrong...
20:38weavejesterHas anyone tried lein-sub with lein2?
20:40weavejesterAh, nevermind, I was using an outdated version
21:34clj_newb_23894has anyone here got a example of red5 + clojure working?
21:34clj_newb_23894it seems like both clojure and red5 wants to "own the JVM"
21:34clj_newb_23894and I haven't found a single tutorial on how to import red5 as a leiningen dependency
21:36akhudekclj_newb_23894: you need to find a maven repository to import with lein
21:36clj_newb_23894I don't think any of them has red5
21:36akhudekhttp://code.google.com/p/red5-maven-repository/ ?
21:37clj_newb_23894doh; thanks;
21:38clj_newb_23894though I am suspicious of people who say "u" rather than "you"
21:38akhudekyou'll also need to add the repository to your project.clj
21:38SegFaultAXSuppose I have a tree like this: {27 [9], 9 [3], 8 [4], 4 [2]} where 27->9, 9->3 and so on. Now lets say I want to collect all of the children and subchildren of some node. Eg, (children 27) => (9 3) because 27->9 and 27->9->3
21:38SegFaultAXWhat's the best way to do that?
21:38akhudekclj_newb_23894: hah, the "u" thing also drives me crazy
21:39akhudekSegFaultAX: if it's not very deep just use recursion
21:39amalloyyeah, recursion and mapcat
21:39SegFaultAXakhudek: Go on.
21:42SegFaultAXI'm having trouble working it out in Clojure.
21:42akhudekSegFaultAX: I guess something like https://www.refheap.com/paste/4816
21:43amalloy&((fn children [m key depth] (when-not (zero? depth) (concat (m key) (mapcat #(children m % (dec depth)) (m key))))) {27 [9], 9 [3], 8 [4], 4 [2]} 27 2)
21:43lazybot⇒ (9 3)
21:44SegFaultAXamalloy: Why do you track the depth?
21:45amalloybecause otherwise i'll get the wrong answer
21:45amalloyhow's that for an unhelpful answer! poke around the code and see
21:45SegFaultAXamalloy: But the depth in this case is not fixed.
21:45SegFaultAXamalloy: And not known ahead of itme.
21:45SegFaultAXTime, even.
21:46amalloyoh. your question was not very clear
21:46amalloyyou said specifically children and subchildren
21:46SegFaultAXamalloy: All subchildren, recursively.
21:52akhudekSegFaultAX: You want this https://www.refheap.com/paste/4818
21:52akhudekbut need to have it exclude the first node
21:52akhudekas that includes the argument
21:54akhudekcan just do (rest (children {27 [9], 9 [3], 8 [4], 4 [2]} 27))
21:54akhudekSince the initial argument will always be the last thing added
21:54SegFaultAXakhudek: Thanks, I'll try it out.
21:54FrozenlockAny js savvy can tell me why this doesn't work? (.fromCharCode 65)
22:02FrozenlockOh, got it! (String.fromCharCode 97,108,101,114,116) works :D
22:03jkkramerwhat's the mime type for clojure data? "application/clojure"?
22:05xeqijkkramer: thats what most people have been using
22:06jkkramerxeqi: k. doesn't quite seem correct but I'll go with the crowd
22:08dnolenFrozenlock: (.fromCharCode js/String ...) probably a bit more idiomatic.
22:14Frozenlockdnolen: Thanks!
22:36jkkramerclojuresphere updated -- http://www.clojuresphere.com/ - refreshed index, added some features
22:44cemerickjkkramer: awesome! :-)
22:44dnolenjkkramer: curious that ClojureScript doesn't show up as a Clojure project
22:45jkkramerdnolen: it's in there - http://www.clojuresphere.com/org.clojure/clojurescript
22:47SegFaultAXamalloy: Is there an API for 4clojure? It'd be cool if I could grab all my solutions.
22:48amalloyone or two things are exposed with an API, but not that
22:48SegFaultAXamalloy: Would it be possible to get a dump?
22:49wmealing_cemerick: your post on maven repo on github ( http://cemerick.com/2010/08/24/hosting-maven-repos-on-github/ ) do you know if anyone has turned that into a lein task yet ?
22:49amalloySegFaultAX: yeah, probably. step into #4clojure
22:51cemerickwmealing_: Don't do that. Use s3 instead. I need to put a warning prefix on that post. https://github.com/technomancy/s3-wagon-private
22:52wmealing_damn it looked so promising too
22:52wmealing_hmm
22:52cemerickIt offers no advantages over s3.
22:53wmealing_except that i'm likely to forget
22:53wmealing_and push my s3 details into github
22:54wmealing_ah no
22:54wmealing_its in a different file
22:56cemerickwmealing_: yes, credentials should never *ever* seriously ever go in project.clj.
22:57dnolenjkkramer: that's not the official clojurescript project
22:59jkkramerdnolen: ah you're right. clojuresphere has some issues with forked projects, since github doesn't include them in its API responses
23:00wmealing_s3 is so dirt cheap, i'll use it, thanks cemerick.
23:03jkkramerdnolen: looks like clojurescript also uses pom.template.xml, which doesn't get picked up. might have to write a special case for it
23:09dnolenjkkramer: awesome resource btw!
23:10dnolenjkkramer: a great way to discover which projects are using which libraries.
23:10jkkramerdnolen: yeah, a nice resource for lib authors too
23:35technomancyjkkramer: nice work. did those github search results end up giving you what you needed?
23:35technomancynice to see the project count graph isn't dropping off anymore
23:36technomancyI wonder if it'd be interesting to have a delta page per refresh
23:36jkkramertechnomancy: thanks, and thanks for your help getting the ball rolling on the updates. Github api results are ok, not perfect
23:36technomancy"compojure jumped 3 positions while swank dropped 2..."
23:36jkkramerthe biggest problem with the github api is that searches don't include forks
23:37technomancyoh, so you have to determine the fork root yourself? =\
23:37jkkrameralso, because a search term is required, you don't necessarily get all results, just ones that mention "clojure" somewhere
23:37technomancyah, shame
23:37technomancyjkkramer: oh. dude. idea. have a clojuresphere bot that opens issues on projects that don't have a :url and :description in the resulting pom that gets published to clojars
23:38jkkramertechnomancy: heh, nice.
23:38jkkramertechnomancy: pull requests welcome
23:38technomancyI'll open an issue for it if you think it's a good idea
23:38jkkramertechnomancy: sure
23:39technomancymaybe it could be done as a separate codebase that shares the same DB once we've got it running on neo4j
23:39jkkramertechnomancy: yeah you'll notice I made no effort to move the db. I did however change the graph format. it no longer groups projects by artifact id. that was just a bad idea
23:40technomancysure
23:40jkkramerI think it lends itself to an alternate db format better now
23:40amalloytechnomancy: a bot that opens issues sounds pretty unpleasant; i'd block such a bot just for being rude. but if it sent a pull request instead...
23:40technomancygood to hear =)
23:41technomancyamalloy: can't do that for :url and :description; there's no heuristic to reliably determine it
23:42jkkramerwell, there is the clojars & github url & description
23:42amalloytechnomancy: don't you have the github page? that's a uri
23:42technomancytrue. I wonder how common the github description is.
23:42jkkramerpretty common
23:43technomancyI guess a pull request would be better then
23:43amalloyseriously though if you start a bot to nag me about putting metadata in my project.clj i'll ask if github can close his account
23:43technomancyamalloy: there's precedent
23:44technomancyI got a pull request from a gun.io bot removing a bunch of trailing whitespace
23:44amalloyright, that's a pull request
23:44amalloyhelp is useful, issues are just nagging
23:44technomancygotcha
23:48tomojwow automated trailing whitespace pull requests..?
23:48tomojthat seems more annoying than a real issue
23:49amalloytomoj: git's default behavior is to warn you when introducing trailing whitespace, so it doesn't seem crazy to me
23:51tomojI was trying to figure out how to get those warnings recently
23:51tomojseems they are default only when applying a patch?
23:53tomojbut anyway, isn't the reason they warn you to help keep the history from getting mucked up with whitespace changes?
23:53jkkrameraccording to the clojuresphere data, there are only 23 projects with a github description and no clojars description
23:54technomancyhuh; how about urls?
23:54jkkrameralso, 4 projects with github homepage set, but no clojars homepage set