#clojure log - Sep 02 2012

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:07 Frozenlock: Where does lein store the libraries?

0:07 bbloom: you mean dependencies?

0:08 Frozenlock: er, yes

0:08 I've found my .lein with profile and all, but no dependencies.

0:09 xeqi: ~/.m2

0:09 clojurebot: I don't understand.

0:10 bbloom: yup, what xeqi said. it shares/reuses your local maven cache

0:10 Raynes: Frozenlock: lein doesn't store them or reuse anything. It uses maven for dependency resolution.

0:10 And maven stores them in ~/.m2.

0:11 Frozenlock: Thanks guys, found it! (I would have never guessed it..)

0:11 Raynes: Don't make me get all pedantic on you, bbloom.

0:11 bbloom: Raynes: sorry :-) didn't it used to use ivy or something?

0:11 xeqi: well.. to be pedantic is uses aether for dependency resolution

0:11 Raynes: bbloom: Nosir.

0:12 xeqi: it used to use maven, through ant.. I think

0:12 bbloom: ah

0:12 xeqi: much prettier just to use pomegranate now

0:12 bbloom: i've had to interact with maven a tad at the office lately

0:12 what a nightmare.

0:13 Raynes: xeqi: aether *is* maven.

0:13 As of 3.0, right?

0:13 xeqi: maven uses aether

0:13 Raynes: Right.

0:13 xeqi: they're owned by seperate groups

0:13 Raynes: Is there really any point in making a distinction?

0:13 xeqi: apache -> maven ; eclipse -> aether

0:13 Raynes: I'd like to arrange a bout with you, sir.

0:13 xeqi: no, I usually just say maven cause people know what I mean

0:15 http://www.thefreedictionary.com/bout .. "a period of time doing something, such as drinking"

0:15 bbloom: seems 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 :-)

0:16 if i have a bunch of java projects, each with it's own git repository, but i want dependencies between them

0:16 is there a decent build system that lets me have source dependencies between them in a sane way?

0:16 Raynes: Isn't that lein checkouts?

0:16 xeqi: git submodules ?

0:17 bbloom: git submodules are sure to be involved ;-)

0:17 * bbloom looks at leon checkouts

0:17 bbloom: lein*

0:17 Raynes: lein works for java too, fwiw.

0:17 xeqi: you *can* use checkouts in that way...

0:18 bbloom: holy non-idiomatic close parens batman! https://github.com/guv/lein-checkouts/blob/master/src/leiningen/checkouts.clj

0:18 xeqi: yeah.. thats not what we're refering to

0:18 bbloom: link?

0:18 clojurebot: your link is dead

0:19 * bbloom mourns his link

0:19 xeqi: https://github.com/technomancy/leiningen/blob/master/doc/FAQ.md - question 5

0:19 michaelr`: google chrome changed their menu icon.. wow

0:19 shoky: hotdogs

0:19 they call it

0:19 michaelr`: grill?

0:20 shoky: 3 bland hotdogs.

0:20 bbloom: xeqi: ah thanks

0:20 michaelr`: three hotdogs sounds too much while on the other hand 3 cucumbers would be just fine..

0:20 bbloom: not exactly what i want

0:20 somebody suggested gradle & the multiple-project-builds support

0:21 which i looked at the docs for, and it seemed much closer to what i imagined

0:21 casion: what's the proper way to round or truncate decimals in clojure?

0:21 bbloom: (find-doc "round")

0:21 there are several options

0:22 ,(int 1.7)

0:22 xeqi: $findfn 2.33 2.0

0:22 clojurebot: 1

0:22 lazybot: []

0:22 xeqi: $findfn 2.33 2

0:22 lazybot: [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]

0:22 xeqi: $findfn 2.33 3

0:22 lazybot: [clojure.core/unchecked-inc-int]

0:22 Frozenlock: bbloom: What's up with those parens?!

0:22 bbloom: Frozenlock: *shrug* i didn't write them!

0:22 xeqi: hmm, not sure I like those options

0:23 casion: yeah, I haven't found anything other than going it java-y

0:23 which is not very fun

0:23 bbloom: *shrug* yeah, it seems like round should be in core....

0:24 xeqi: $findfn 2.55 3

0:24 lazybot: [clojure.core/unchecked-inc-int]

0:24 bbloom: haha yeah, not what you want at all

0:25 ,((fn [x] (int (+ x 0.5)) 2.55)

0:25 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

0:25 bbloom: ,((fn [x] (int (+ x 0.5))) 2.55)

0:25 clojurebot: 3

0:25 mpan: ,(doc unchecked-inc-int)

0:25 clojurebot: "([x]); Returns a number one greater than x, an int. Note - uses a primitive operator subject to overflow."

0:25 mpan: is there a difference between the various bots who evaluate?

0:26 bbloom: https://github.com/flatland/lazybot & https://github.com/hiredman/clojurebot

0:26 mpan: thanks

0:27 clojure/jruby interop?

0:28 casion: ,(bigdec (/ (int (* 0.000234234 100000)) 100000.0))

0:28 clojurebot: 0.00023M

0:28 casion: meh.

0:29 mpan: oh, that sounds like a cool plugin

0:29 in general, is there a common way to do interop with other dynamic jvm languages?

0:30 bbloom: mpan: unlikely for any generic mechanism, as most other dynamic jvm languages have their own wrapper objects and calling conventions

0:30 xeqi: call it the java way?

0:30 casion: I shouldnt be so annoyed that I have to write this myself, but it seems odd that neither java nor clojure has this function

0:30 unless I'm missing something still, which is quite likely

0:31 bbloom: casion: java doesn't have round?

0:31 i'm sure it does...

0:31 mpan: and just pass data around as java objects?

0:31 bbloom: what do you need?

0:33 casion: bbloom: round or truncate a decimal to x significant digits

0:34 there is java.lang.Math/round, but that rounds to int/long

0:35 so you still have to mult/div to round decimals

0:35 obviously a very short function to write, but strange that it's not already there

0:35 mpan: is there something for making desktop guis that isn't swing?

0:36 casion: mpan: my brother and I both use swt (http://www.eclipse.org/swt/)

0:37 mpan: thanks

0:39 mindbender1: How much do I have to pay to look at the datomic source code!

0:39 michaelr`: mindbender1: one atomic transaction ;)

0:39 mindbender1: michaelr`: How much quantity is that?

0:40 michaelr`: mindbender1: 4

0:40 xeqi: (let [df (java.text.format.DecimalFormat. "#.##")] (->> 2.33 (.format df) (.parse df)))

0:41 &(let [df (java.text.format.DecimalFormat. "#.##")] (->> 2.33 (.format df) (.parse df)))

0:41 lazybot: java.lang.ClassNotFoundException: java.text.format.DecimalFormat

0:41 mindbender1: michaelr`: you mean a decimal 4?

0:41 xeqi: &(let [df (java.text.DecimalFormat. "#.##")] (->> 2.33 (.format df) (.parse df)))

0:41 lazybot: ⇒ 2.33

0:41 xeqi: blah

0:41 michaelr`: mindbender1: i mean 4 ever ;)

0:42 mindbender1: michaelr`: wow that looks like infinity!

0:42 michaelr`: mindbender1: no it's much more but also could be a bit less

0:43 mindbender1: michaelr`: then it should look more like a duality

0:44 casion: xeqi: i lookend into DecimalFormat, and not only does it return a string… it's slow at even that :(

0:45 just plain round with mult/div is almost 100x faster than DecimalFormat, not including casting back to decimal

0:45 xeqi: yeah, I was surprised I found it mentioned so many places

0:47 casion: I 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

0:47 it was somewhat ironic

0:47 xeqi: heh, its even used in the javadoc for DecimalFormat

0:48 in the example

0:51 michaelr`: flatten

0:51 xeqi: ~flatten

0:51 clojurebot: flatten 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.

0:52 michaelr`: i keep forgetting it all the time

0:53 it would be wise imho to make flatten do what is suggested above

0:56 what was the solution for this using (into)?

0:56 I remember i liked it the best

0:57 xeqi: michaelr`: what are you trying to do?

0:57 tolstoy: Are folks using nrepl much these days? Anyone know how to disconnect from emacs?

0:58 xeqi: tolstoy: I think theres a ticket to add one; in the meantime you can kill *nrepl-connection*

0:58 michaelr`: xeqi: hmm.. well i need to flatten a seq

0:59 tolstoy: xeqi: Ah, thanks. Kinda missing C-c C-c, too. ;)

0:59 Frozenlock: Eh.. can't I just require in a cljs repl? --> (require [siren.core :as s])

1:00 tolstoy: xeqi: 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.

1:01 bbloom: Frozenlock: unfortunately not

1:01 Frozenlock: Is there something vaguely near?

1:01 bbloom: i don't know of anyone working on it

1:02 Frozenlock: So I have to require directly in my namespace declaration?

1:02 bbloom: it's generally problematic because it couldn't work after advanced compilation or in the browser or whatnot

1:02 yeah, you have to do it in the ns form

1:04 Frozenlock: if you look in the cljs source at (defmethod parse 'ns ...

1:05 look for analyze-deps

1:05 in theory, you could add require, use, etc to clojurescript for interactive development

1:05 but it would take some work: both design & implementation

1:06 Frozenlock: I would like to, however at the moment I lack the necessary knowledge :(

1:06 ... but coming along, a week ago I was strugling getting my cljs repl up and running :)

1:06 * Frozenlock should use less smileys

1:08 tomoj: how would you do require?

1:10 just compile all the cljs files on the classpath beforehand?

1:13 bbloom: tomoj: depends

1:14 if you're just in a cljs repl on rhino or something, you can just run the file through the analyzer

1:14 but if you're in the browser, it's much trickier

1:14 the real issue is advanced compilation

1:14 in which case, i think it's impossible

2:17 samrat: is it safe to store passwords in Noir's session? a session is stored on the server-side right?

2:23 tolstoy: samrat: Yes, it's in memory on the server.

2:24 samrat: tolstoy: 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

2:25 tolstoy: If you're confident no one can hack into your JVM and take a look at things, I guess its relatively safe.

2:25 I'm no exper.

2:26 What I've done is encrypt the user/pass, the b64 encode it and use that as a cookie.

2:26 Then store the key on the server side somewhere, so it's about as secure as where/how I store that key.

2:27 samrat: thank, will keep that in mind

2:40 tolstoy: I'm no security expert, but, generally, if you use HTTPS for client/server interaction, you're much better off.

2:41 If you're working internal server to another internal server, https is STILL a good idea. ;)

2:41 samrat: i'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

2:42 ..which means I can't access the actual response, is that a bug?

2:42 tolstoy: ok, I am using https

2:42 tolstoy: Nope. 401 is the actual response.

2:42 amalloy: $google http 401 not authorized

2:42 samrat: what I get is this: ExceptionInfo clj-http: status 401 clj-http.client/wrap-exceptions/fn--1189 (client.clj:95)

2:42 lazybot: [HTTP Error 401 Unauthorized Explained] http://www.checkupdown.com/status/E401.html

2:43 samrat: thats quite different from what I get if i get a 200 code

2:43 tolstoy: 401 means unauth… yeah, what lazybot said.

2:43 tomoj: if you want to get the actual response, pass :throw-exceptions false

2:44 amalloy: oh, yeah. clj-http's default behavior of throwing slingshot exceptions is kinda a pain

2:45 an http client getting a 4xx response is not exceptional - it's part of the expected behavior of an http client

2:45 * amalloy grumbles at nothing in particular

2:46 samrat: tomoj: thanks, that was what I was looking for

2:48 tomoj: you can build your own request fn that doesn't use wrap-exceptions :/

2:54 michaelr`: why GET params get keywordized, but POST aren't?

2:54 compojure

3:13 tomoj: lol I wrote (apply merge-with merge maps)

3:13 actually, that's what I wanted

3:13 :)

3:54 bbloom: scala ANF transform? < 500 lines…. my clojure ANF transform? < 50 lines

3:54 if i meet rich hickey, i think i'm going to give him a hug

3:54 :-)

3:55 Raynes: Congratulations, you've written code in a language without classes and curly brackets.

3:55 :p

3:56 bbloom: it's much more than that. the scala transform uses a mutable AST with a big transform visitor pattern thing

3:56 https://github.com/scala/scala/blob/master/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala

3:56 but the cljs AST is so much more pleasant to work with:

3:56 https://github.com/brandonbloom/cljs-cps/blob/master/cps.cljs

3:57 oops

3:57 i mean:

3:57 https://github.com/brandonbloom/cljs-cps/blob/master/cps.clj

4:20 samrat: how do I turn {:a 5} to "{:a 5}"?

4:21 Sgeo: ,(str {:a 5})

4:21 clojurebot: "{:a 5}"

4:21 Sgeo: There 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

4:22 ,(doc str)

4:22 clojurebot: "([] [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."

4:22 Sgeo: Not especially helpful

4:22 ,(str "\n")

4:22 clojurebot: "\n"

4:22 Sgeo: ,(str {:a "\n"})

4:22 clojurebot: "{:a \"\\n\"}"

4:22 bbloom: use pr-str

4:22 ,(pr-str {:a 5})

4:22 clojurebot: "{:a 5}"

4:22 bbloom: ,(doc pr)

4:22 clojurebot: "([] [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"

4:23 bbloom: ,(doc str)

4:23 clojurebot: "([] [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."

4:23 bbloom: ,(doc print)

4:23 clojurebot: "([& more]); Prints the object(s) to the output stream that is the current value of *out*. print and println produce output for human consumption."

4:23 Sgeo: Admittedly, samrat didn't specifically ask about readable in particular

4:23 >.>

4:25 raek: pr-str is the right one if you want something you can read back

4:25 (its inverse is read-string)

4:26 ,(str {:x "abc"})

4:26 clojurebot: "{:x \"abc\"}"

4:26 bbloom: raek: it's PARTIAL inverse...

4:26 raek: hrm

4:26 samrat: thanks guys

4:26 raek: bbloom: partial?

4:27 Sgeo: Can't read in an object that can only be printed in an unreadable manner

4:27 raek: because it only holds for readable/printable types?

4:27 bbloom: right

4:27 Sgeo: ,(pr-str java.lang.Object)

4:27 clojurebot: "java.lang.Object"

4:27 Sgeo: Hmm

4:28 bbloom: ,(pr-str (java.lang.Object.))

4:28 clojurebot: "#<Object java.lang.Object@55f16c1e>"

4:28 bbloom: ,(read-string (pr-str (java.lang.Object.)))

4:28 clojurebot: #<RuntimeException java.lang.RuntimeException: Unreadable form>

4:28 Sgeo: Darn, I was about to try that

4:28 bbloom: :-)

4:29 Sgeo: ,(pr-str (java.lang.Class.))

4:29 clojurebot: #<CompilerException java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Class, compiling:(NO_SOURCE_PATH:0)>

4:29 Sgeo: Can Classes be constructed manually?

4:29 * Sgeo doesn't really know Java that well

4:30 bbloom: Sgeo: well i'd assume so, considering Clojure does it at the repl!

4:30 Sgeo: Good point.

4:30 Is it as easy as new Class(...)?

4:30 bbloom: I believe Clojure uses a library that emits JVM byte codes

4:30 but you may also be able to do it with the reflection namespace

4:31 clojurescript emits javascript strings and the repl evals them

4:31 Sgeo: In Smalltalk it's as simple as sending the appropriate message to the class you want to subclass

4:32 The IDE typically shows you the code it will execute

4:32 bbloom: in clojure, it's as simple as evaluating deftype…. java… not so much….

4:32 but still doable!

4:33 Chousuke: Sgeo: the Class class has a newInstance method for creating new instances.

4:34 Sgeo: Neat

4:35 Wait, 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

4:35 amalloy: Class/newInstance is generally pretty useless. you usually need to reflect to find its constructors

4:37 Sgeo: constructing classes at runtime is absurdly heavy-weight. don't go down that road

4:38 Sgeo: Isn'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?

4:39 (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?

4:39 amalloy: yes, 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

4:44 Sgeo: Wait, by heavy-weight, do you mean slow performance-wise, or difficult/annoying to write correct code to do, or both?

4:49 amalloy: all of the above

4:49 (but mostly the latter, i expect)

4:50 Sgeo: mostly both? </kidding>

5:05 michaelr`: is there a core function like group-by where the value is item and not a collection of items

5:05 ?

5:06 something like:

5:06 (into {} (map (fn [field] {(field :name) field}) col))

5:15 noidi: michaelr`, you could use zipmap

5:15 ,(zipmap (map :name c) [{:name "foo"} {:name "bar"}])

5:15 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: c in this context, compiling:(NO_SOURCE_PATH:0)>

5:16 noidi: oops

5:16 ,(let [c [{:name "foo"} {:name "bar"}]] (zipmap (map :name c) c))

5:16 clojurebot: {"bar" {:name "bar"}, "foo" {:name "foo"}}

5:28 michaelr`: noidi: ah cool

5:28 thanks

7:12 hughfdjackson: this 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)"

7:13 ?

7:17 i'm running clojure 1.2.1, btw

7:18 * hughfdjackson checks that that isn't the problem

7:21 nbeloglazov: hughfdjackson: it seems core.logic is not in classpath. Do you use lein to manage dependencies?

7:22 hughfdjackson: i'm attempting to ;)

7:22 i'd imagined that anything in core didn't require installation before usage in the repl

7:22 i'm assuming i was wrong in this

7:22 nbeloglazov: Yes. core.logic is standalone lib

7:23 hughfdjackson: :D okay

7:23 thanks

9:24 tomoj: hmm

9:24 since clojure is AOT compiled, do you have to compile your own clojure for 1.7?

9:24 java 1.7 I mean

9:25 e.g. reducers appears to be compiled against jsr166y

9:36 wmealing_: is it just me, or does paradit mode / emac suck for inserting square brackets

9:39 it doesn't treat hightlighted areas like it would for ( or {

9:42 tomoj: highlighted areas?

9:44 wmealing_: for example

9:44 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 (

9:44 and it would put it at the start and end of the highlight

9:44 but if i do the same with [ , it doesn't work.

9:45 tomoj: hmm, super shift (?

9:45 skoodge: is there any API overview for core.logic similar to http://clojure.org/api ?

9:46 wmealing_: super, the windows key..

9:46 s-( in the emacs speak iirc

9:47 tomoj: do `C-h k` that

9:47 I don't think I have such a binding

9:47 for me, just typing ( or [ wraps the region appropriately

9:47 M-( and M-[ also work

9:50 wmealing_: it tells me M-[ is undefined

9:50 so.. i need to figure out why my paredit is being dumb

9:51 M-( works.. and brings up the help

9:51 but M-[ does not

10:02 tomoj: looks like i dont need M-[ just highlight and [

10:03 thanks though, you got me on the right path

10:07 tomoj: hmm

10:07 C-h v paredit-version ?

10:08 if it's not 23, maybe upgrade

10:08 http://mumble.net/~campbell/emacs/paredit-beta.el

10:09 oh

10:09 I have this in my init.el

10:09 (define-key paredit-mode-map (kbd "M-[") 'paredit-wrap-square)

10:09 (define-key paredit-mode-map (kbd "M-{") 'paredit-wrap-curly)

10:13 wmealing_: ah, yep, the warp did it

10:13 thanks

10:13 tomoj: the wrap did it

10:13 clojurebot: I don't understand.

10:16 tomoj: wtf ? https://raw.github.com/gist/3bab917287a7fd635a84/f38bfe3e270556e467f3fc02062af7ea10781390/gistfile1.txt

10:21 wmealing_: tomoj: that'll teach you

10:22 tomoj: hmm

10:23 https://gist.github.com/3c8677f8cdb5e95683f9 the line in the try is in my stacktrace

10:23 //aargh ??

10:23 lazybot: tomoj: What are you, crazy? Of course not!

10:24 tomoj: oh

10:54 wmealing_: 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:54 any suggestions, or better ways to do it ?

10:55 or should i write it as anoir app, and thread off the daemon.

10:55 * wmealing_ thinks

10:56 xeqi: wmealing_: can your daemon call run-jetty?

10:58 wmealing_: i guess it could.

10:58 casion: why would you want the daemon to run the gui? that seems backwards to me

10:59 wmealing_: so you think the gui should run the daemon ?

11:00 or rather, the noir application, should fire it up

11:00 casion: I'd think that would make more sense

11:01 xeqi: how is your web frontend going to interact with the daemon?

11:01 wmealing_: essentially just write the configuration files for it

11:01 the daemon watches for config changes

11:01 and re-reads it when they do

11:02 casion: they can just be separate then can't they?

11:02 why any relation at all

11:02 wmealing_: users.

11:02 casion: you can just have a parent that launches both

11:02 wmealing_: if they have to start two things

11:02 its complicated

11:02 so, make these into jars.

11:03 and call webapp/start and daemon/start

11:03 hmm, thats not a bad idea

11:03 keeps the code base separate

11:04 i like that best

11:04 that way i can pull out the webui if its not required

11:04 easily

11:04 xeqi: yeah, that would be my recommendation

11:04 wmealing_: thankyou both for talking it through with me.

11:05 casion: thank you for having an updated version of clj-audio ;)

11:05 wmealing_: which reminds me, i added recording support.. the guy hasn't responded to my pull / mail about that

11:06 casion: I'm writing a clj-audiofile atm

11:06 wmealing_: on github ?

11:06 casion: so better handle format and file handling beyond what javax.sound.sampled does

11:06 it will be there soon

11:06 wmealing_: please let me know when

11:06 yeah, sampled is preetty limited.

11:06 casion: I just figured out all the specifics last night, implementing stuff today

11:07 wmealing_: i'd like to be able to hook that up to clj-audio to read and write directly into different formats.

11:07 casion: I had that working in repl last night quite thoroughly

11:07 along with getting lazy-seqs of various formats, and a few basic dsp ops

11:07 wmealing_: nice.

11:08 casion: I should have at least a basic file->seq setup online today

11:08 maybe with some dsp, not sure… stuff is slow and that makes me queesy

11:26 tomoj: "select is not broken"

11:27 wmealing_: except when it is

11:27 tomoj: well, the fact that PHM fold can silently skip over exceptions in the reduce function and descend into a stack overflow is sorta broken

11:27 but the reason it did that is cus my code is broken

11:28 I assumed it was a bug in clojure from the stacktrace..

11:28 wonder why they catch those exceptions

11:29 wmealing_: https://bugzilla.redhat.com/show_bug.cgi?id=812148 <-- select being broken.

11:29 hopefully that is public enough

11:39 tomoj: huh "You are not authorized to access bug #812148"

11:39 secret bug?

11:40 gfredericks: does lein-cljsbuild support turning assertions off?

11:40 zenoli: Does core.logic work on collections other than vectors? Specifically, I've got a bunch of sets that I'm working with.

11:41 gfredericks: zenoli: it only works naturally with seqs; depending on what you're doing exactly you might be able to make it work

11:41 but if you want to do set-logic then you probably can't

11:43 wmealing_: tomoj: ah sorry dude.. yeah i think it has specific customer details in it

11:43 and they opted not to share.

11:44 zenoli: gfredericks: 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:45 gfredericks: zenoli: 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:46 I guess you could do sets in a decent way if you had an ordering...

11:46 a multiset is just a sorted seq :)

11:49 casion: I guess today is better than never to learn how to use git(hub)

11:49 * casion sighs

11:49 wmealing_: good luck

11:49 casion: you people and your fancy idea sharing :P

11:49 wmealing_: :)

11:56 zenoli: gfredericks: 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:04 gfredericks: zenoli: I just meant that multisets biject naturally with sorted seqs; not that the multiset would naturally emit sorted elements

12:05 e.g., if you represented your multisets within core.logic as sorted seqs, then you could do relatively efficient set operations

12:10 * gfredericks thinks that would be kind of fun to write

12:19 samrat: why is Noir giving me a "Key must be Integer" error even though I am passing an integer(using GET)?

12:20 ...any way to convert all keys to Integers?

12:21 gfredericks: &(get [1 2] :foo)

12:21 lazybot: ⇒ nil

12:21 gfredericks: huh

12:24 gensymv: hello, does clojure support pattern matching?

12:25 gfredericks: not natively, but there's a core.match library that is pretty good

12:25 duck1123: gensymv: not exactly, but there are plenty of ways you can get a similar effect

12:25 gfredericks: it does have destructuring though

12:26 AimHere: If you mean regex string patterns, then yes, otherwise, what those other guys said

12:26 gensymv: gfredericks: thanks

12:26 duck1123: multimethods are also pretty good for a lot of things

12:28 gensymv: duck1223: are multimethods overloaded functions?

12:29 i.e java styled polymorph methods?

12:30 AimHere: Well it's polymorphism, but you're dispatching on anything-you-like, instead of on the type of the argument

12:31 gensymv: i see, thanks.

12:31 AimHere: You 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:33 xeqi: ([1 2] :foo)

12:33 &([1 2] :foo)

12:33 lazybot: java.lang.IllegalArgumentException: Key must be integer

12:35 gfredericks: oh that's it; weird.

12:36 I guess get just uses the generic map interface, so vectors aren't special to it

12:37 well the Vector#get could still throw :/

12:37 &([1 2] 70)

12:37 lazybot: java.lang.IndexOutOfBoundsException

12:53 BreadMonster: How do I install Clojure on Windows, guys?

12:54 nbeloglazov: BreadMonster: do you have JDK installed?

12:55 BreadMonster: Yup.

12:55 Wait, how do I check?

12:55 javac, right?

12:55 nbeloglazov: yes

12:55 BreadMonster: Okay, I don't have JDK.

12:55 raek: then you install Leiningen

12:55 BreadMonster: Don't you get precompiled binaries?

12:55 I mean .jar files?

12:56 nbeloglazov: BreadMonster: check Program Files. You may have jdk but it's not in the PATH variable.

12:56 jkkramer: BreadMonster: http://dev.clojure.org/display/doc/Clojure+Tools and https://github.com/technomancy/leiningen#readme

12:57 BreadMonster: Nope, I lack JDK.

12:57 Very unfortunate.

12:57 And I'm on my family PC, so I can't install anything.

12:58 jkkramer: BreadMonster: http://tryclj.com/ and http://www.4clojure.com/ if you want to play with Clojure without installing

12:58 nbeloglazov: Does lighttable requires installed clojure and jdk?

13:03 BreadMonster: alright, thanks guys :0

13:03 Also, I'm working on a To Do application.

13:03 can I do that in Clojure?

13:05 nbeloglazov: You can do all kind of things in clojure. Except may be low level coding.

13:08 BreadMonster: Really?

13:08 Is there a tutorial of some sorts?

13:08 Frozenlo`: 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:08 gensymv: is 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:09 BreadMonster: Oh, I can do it in C, Python, Java, Mathematica, NASM, and half a different languages.

13:09 I had no idea how to do it in LISP.

13:09 Hence I watned to start with thtat.

13:13 Frozenlock: BreadMonster: Are you looking for clojure or clojurescript?

13:13 dansalmo: http://stackoverflow.com/questions/12238024/is-there-a-clojure-function-between-read-string-and-load-string

13:15 Frozenlock: dansalmo: I answered.

13:15 dansalmo: thank you

13:15 Frozenlock: Hope it's enough for you ^^

13:16 samrat: why is this doseq not working inside Noir's defpage? https://www.refheap.com/paste/4802

13:17 ivaraasen: samrat: doesn't doseq return nil?

13:18 Frozenlock: samrat: Also, why 'when-let'? Couldn't it be 'when'?

13:18 dansalmo: FrozenLock: Works perfectly, but I seems like magic. How does it make read-string read all of the objects?

13:20 Frozenlock: ,(doc *read-eval*)

13:20 clojurebot: "; 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:21 samrat: ivaraasen: thanks

13:21 Frozenlock: oh, yeah. something was missing there too

13:23 dansalmo: , (+ 1 1)

13:23 clojurebot: 2

13:26 Sgeo: ,(map (partial + 1) [1 2 3 4 5])

13:26 clojurebot: (2 3 4 5 6)

13:45 gfredericks: &(let [s " S I I ( S I I)"] (read-string s))

13:45 lazybot: ⇒ S

13:46 gfredericks: &(let [s " S I I ( S I I)"] (read-string (str "[" s "]")))

13:46 lazybot: ⇒ [S I I (S I I)]

13:46 Frozenlock: Is there a way to get a function metadata in cljs? The docstrings, the arguments list and all.

13:46 gfredericks: Frozenlock: I think that's normally only attached to the var

13:47 Frozenlock: So there's no '(doc some-fn)' in cljs?

13:48 gfredericks: oh you said cljs

13:48 is there metadata at all in cljs?

13:48 certainly there are no vars, so I think docstrings are ignored

13:48 casion: is there a bug in nrepl that makes it clear the current namespace and not be able to load another?

13:49 Frozenlock: gfredericks: This is very very sad.

13:49 gfredericks: there does seem to be metadata generally

13:50 looks like you can't put metadata on functions though

13:50 dansalmo: Frozenlock: 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:50 gfredericks: dansalmo: yeah that's what I was trying to point out above; I wasn't sure why you thought Frozenlock's code worked

13:51 dansalmo: , (read-string "( S I I( S II ))"

13:51 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

13:51 dansalmo: , (read-string "( S I I( S II ))")

13:51 clojurebot: (S I I (S II))

13:51 dansalmo: 0, (last (read-string "( S I I( S II ))"))

13:51 , (last (read-string "( S I I( S II ))"))

13:51 clojurebot: (S II)

13:51 dansalmo: , (last (read-string "( S I I( S I I ))"))

13:51 clojurebot: (S I I)

13:52 dansalmo: It was magic! The magic of the perfect mistake in my application of his advice

13:53 Frozenlock: Weird, I had to change the *read-eval* binding otherwise it would sometime choke on the string.

13:53 dansalmo: I did not think read-string did any eval

13:53 gfredericks: it only does if you have a #= form

13:53 dansalmo: I thought only load-string did.

13:53 Sgeo: ,(read-string "#=(+ 1 1)")

13:53 clojurebot: #<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>

13:54 Sgeo: ,(binding [*read-eval* true] (read-string "#=(+ 1 1)"))

13:54 clojurebot: 2

13:54 gfredericks: I think read-eval should be off by default now that there are data readers

13:56 Sgeo: ,(meta '*read-eval*)

13:56 clojurebot: nil

13:56 Sgeo: ?

13:56 ,(meta #'*read-eval*)

13:56 clojurebot: {: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:56 Frozenlock: dansalmo: My apologies, I was totally wrong :)

13:57 Sgeo: ,(:dynamic (meta #'*read-eval*))

13:57 clojurebot: nil

13:57 Sgeo: ??

13:57 lazybot: Sgeo: What are you, crazy? Of course not!

13:57 Sgeo: If it's nil, how come I'm able to binding it?

13:58 ,(doc binding)

13:58 clojurebot: "([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:01 bbloom: ,(.isDynamic #'*read-eval*)

14:01 clojurebot: true

14:01 bbloom: seems like the metadata and the Var object are out of sync

14:01 looks like a bug

14:03 ,((juxt (comp :dynamic meta) #(.isDynamic %)) #'*agent*)

14:03 clojurebot: [nil true]

14:04 bbloom: seems like a consistent bug for all of the dynamic vars in RT.java

14:04 Sgeo: *gasp* someone used comp instead of ->? I'm in shock

14:05 ,(doc juxt)

14:05 clojurebot: "([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:06 bbloom: ,((juxt #(-> % meta :dynamic) #(.isDynamic %)) #'*warn-on-reflection*)

14:06 clojurebot: [nil true]

14:06 bbloom: just for you :-)

14:06 anyway, yeah, setDynamic should set the :dynamic metadata too :-P

14:07 * Sgeo thinks -> should be replaced with a comp function that goes in the other direction and a function like ($ x f) -> (f x)

14:08 Sgeo: Possibly including a function that combines those

14:09 bbloom: that's an interesting idea...

14:10 hyPiRion: ,(doc comp)

14:10 clojurebot: "([] [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:11 bbloom: ,(let [$ (fn [& args] (apply comp (reverse args)))] (($ meta :doc) #'*read-eval*))

14:11 clojurebot: "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:11 bbloom: i like it....

14:13 Sgeo: Not 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:13 bbloom: ah, i overlooked the x

14:13 gfredericks: $google clojure thrush

14:13 lazybot: [fogus: Thrush in Clojure – Redux] http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/

14:14 gfredericks: Sgeo: ^

14:15 bbloom: gfredericks: welere there you go :-)

14:15 well there my keyboard failed me

14:16 yankov: is lazyseq good for both random access and appending/prepending elements?

14:16 gfredericks: nope

14:16 bbloom: seq implies linear operations starting from the head

14:16 Sgeo: gfredericks, awesome. Why wasn't that put in Clojure instead of -> and ->>?

14:16 yankov: dammit

14:17 gfredericks: Sgeo: heckiphino

14:17 bbloom: vectors are what you want if you need logorithmic access

14:17 Sgeo: I quite like -> and ->>

14:17 gfredericks: but vectors won't get you prepension

14:17 yankov: bbloom: yeah, but vectors are bad for appending/prepending stuff?

14:17 yep

14:17 bbloom: saves the need for the extra # and % symbols

14:17 gfredericks: vectors are good for appending

14:18 yankov: if you need something more general, look at finger trees

14:18 hyPiRion: -> and ->> are more general and more succinct. That's not to say they should be used everywhere.

14:18 bbloom: yankov: they are logorithmic for both prepends and appends. seqs have constant time prepends and linear appends

14:18 gfredericks: bbloom: not for prepends

14:18 Sgeo: hyPiRion, more succint in some cases I get, but more general?

14:19 bbloom: gfredericks: what not for prepends?

14:19 yankov: gotcha.. thanks. I'll look more

14:19 Sgeo: -> always stuffs into second argument, ->> into last argument

14:19 gfredericks: bbloom: vectors are linear time for prepends

14:19 bbloom: Sgeo: first argument. second element of forms

14:19 hyPiRion: Sgeo: True enough, not more general. I forgot you can use #() to simulate -> and ->>.

14:19 gfredericks: bbloom: at least if you want a vector as the result

14:20 bbloom: hm. yeah, clearly you can prepend constant time and get a seq

14:20 but i'm surprised it's linear…. i guess i'll need to check my internal assumption about their tree structure

14:20 i've read the map/set implementations

14:20 but not vec

14:20 * bbloom runs off to skim the code

14:20 gfredericks: bbloom: it's related to the array-mappedness

14:20 pyykkis: oh, $ form is interesting

14:20 gfredericks: particularly the fact that the underlying arrays are all the same length

14:22 bbloom: gfredericks: are you sure….?

14:22 this looks like how i expected the tree to work

14:22 gfredericks: bbloom: 99%

14:23 enough to bet $20 on it

14:23 bbloom: i'm looking at PersistentVector.java

14:23 public PersistentVector cons(Object val)

14:23 gfredericks: cons appands to the end

14:23 appends*

14:23 bbloom: no, that's conj

14:23 gfredericks: conj calls PersistentVector#cons

14:23 just to be confusing

14:24 Sgeo: conj appends to the most efficient place to append, I think

14:24 gfredericks: which is determined by CollectionClass#cons

14:25 bbloom: well that's very confusing

14:25 lol

14:25 but you're right:

14:25 ,(.cons [1 2 3] 4)

14:25 clojurebot: [1 2 3 4]

14:25 bbloom: the definitions of cons and conj seem like copy paste....

14:25 <look-of-disapproval/>

14:26 * gfredericks imagines rhickey thinking "haha, this'll fuck'em up"

14:26 gfredericks: I know, let's make clojure.core/empty call .full!

14:27 bbloom: gfredericks: it's somewhat funny to me how beautiful clojure is, but how ugly the java that goes into it is

14:28 gfredericks: yeah

14:29 bbloom: one 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:29 shines*

14:29 * gfredericks was thinking about sine waves

14:30 bbloom: dammit. i had things to do man. now you got me watching houser's talk about finger trees

14:30 gfredericks: haha

14:33 samrat: if I want to rename a lein project, is there an easier way than to rename each directory?

14:33 maybe a plugin or something?

14:44 xeqi: samrat: nothing I know of; and don't forget to change the namespaces in the files

14:45 yankov: bbloom: can you share a link to the houser's talk? :)

14:45 looks like finger trees is what i need. checking out the library

14:45 casion: anyone know of an easy way to cast a byte-array of arbitrary size to a long?

14:45 #java seems to not know atm

14:45 bbloom: yankov: heh, funny you should ask…. https://github.com/clojure/data.finger-tree/pull/2

14:45 i'm 12m ahead of you :-)

14:45 weavejester: casion: Which endian?

14:45 yankov: haha

14:46 casion: weavejester: both. I don't get to know until the function gets the array

14:46 I do have a map with the byte-array and endianness that's being passed around

14:47 I'm processing audio files, which can be 8/16/24/32(int or float)/64(int or float) bit, all signed or unsigned

14:47 and can be either big or little

14:48 weavejester: casion: Oh, okay. So just a bitwise and then a bitshift left, right?

14:48 casion: weavejester: yes

14:48 weavejester: casion: You might have to write the function yourself, I think...

14:49 casion: issue so far is that I have do reverse the array depending on endianess, and bit-and for signed, but not for signed

14:49 I thought maybe java had a better way :(

14:49 and a loop that shifts based on index

14:51 weavejester: casion: You don't have to reverse the array - just bitshift the value instead of the output

14:52 casion: Though since you'd have to maintain an index, reversing would probably be less code

14:53 Frozenlock: bbloom: stop posting interesting videos!

14:54 casion: weavejester: that was my thought too, but reversing every frame is quite slow when processing a 3gb file

14:54 bbloom: i know, videos are killer.

14:54 and papers/pdfs

14:54 easy way to lose a perfectly good side project day!

14:54 sorry :-/

14:54 casion: treading the line between speed and complexity I guess

14:55 Frozenlock: Meh, at my stade learning more won't hurt :P

14:55 I wonder why they film the slides instead of using the video output to the projector.

15:01 bbloom: Frozenlock: for the same reason that conference calls are always still awkward as hell

15:01 ie. a grand mystery

15:07 black_joe: I 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:08 technomancy: black_joe: I'm a fan of clojurebook.com

15:09 bbloom: black_joe: i also recommend following some of the top users on http://www.4clojure.com/

15:09 (and of course doing the puzzles)

15:09 black_joe: Clojurebook is what I was considering too. It looks like the standard book for Clojure.

15:09 Kind of like what "The C programming language" is to C.

15:12 * nDuff agrees with the O'Reilly book, and also suggests The Joy of Clojure.

15:13 nDuff: ...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:13 black_joe: I 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:13 Sgeo: Oh huh cemerick wrote Clojure Programming

15:13 nDuff: ...the O'Reilly book does some why, and a whole lot of very good how, but JoC completely nails the why.

15:14 cemerick: Sgeo: I had some help, of course. :-)

15:23 casion: there's always programming clojure as well

15:27 clojure-newcomer: hi guys… how do I convert a string to a number type in clojurescript ?

15:28 gfredericks: you can use cljs.reader/read-string at least

15:28 js/parseDouble or something like that also?

15:29 clojure-newcomer: gfredericks: thanks, I'll look it up

15:29 Sgeo: gfredericks, parseDouble might be a bad idea if clojure-newcomer wants to do money stuff

15:30 So would read-string I would assume

15:30 gfredericks: Sgeo: well doubles are all clojurescript has at the moment

15:30 so should be equilavent

15:30 clojure-newcomer: sgeo: I just need something like "1234567" -> 1234567

15:30 Sgeo: So why not js/parseInt

15:31 clojure-newcomer: it is getting passed into clojure later on the server side where it needs to be a Long

15:31 gfredericks: read-string for forwards compatibility; maybe someday we'll have proper integers :)

15:31 Sgeo: cljs.user> (cljs.reader/read-string "123")

15:31 123

15:31 That works

15:32 clojure-newcomer: I'm going to have to dig up read-string… unfamiliar but looks good, thx guys

15:32 Sgeo: I think there should be a reader-level way to distinguish platform

15:33 Something similar to Common Lisp's #+ and #-

15:33 gfredericks: I think there was a design page for that

15:37 S11001001: Sgeo: on the other hand, the lack of reader conditionals has led to creativity in platform detection, e.g. ##(first [+' nil])

15:37 lazybot: ⇒ #<core$_PLUS__SINGLEQUOTE_ clojure.core$_PLUS__SINGLEQUOTE_@115edb0>

15:37 Sgeo: ...o.O huh?

15:37 gfredericks: presumably +' exists in jvm-clj but not cljs

15:38 S11001001: Sgeo: that's how you write 1.2/1.3-compatible safe +

15:38 don't know about cljs; never looked at it

15:57 Frozenlock: Lighttable 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:51 technomancy: Frozenlock: it was originally distributed under the EPL, but I asked him about that and he said that was unintentional

16:53 Frozenlock: Oh that's a shame.

16:54 I 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:54 *on

16:55 technomancy: I'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:59 Frozenlock: (get jar :license "EPL") tada :)

17:00 xeqi: technomancy: register a dmca agent, and wait for takedowns?

17:01 rod: hi - 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:02 weavejester: rod: No… I'm using 1.4.0 right now and it works fine.

17:02 rod: What version of Ring/Compojure?

17:02 rod: compojure 1.1.1

17:03 weavejester: rod: Could you provide an example project where it goes wrong?

17:03 rod: params 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:04 weavejester: rod: I'm using the same version with 1.4.0 and params and sessions work okay for me.

17:04 Frozenlock: technomancy: what's the clojurers opinion on GPL?

17:05 rod: weavejester: here's my work in progress (don't judge me! :P) https://github.com/rodnaph/weare/tree/require-login

17:06 just clone and lein run if ur gonna try it.

17:08 weavejester: Okay, I'm trying it out

17:11 technomancy: Frozenlock: 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:12 weavejester: EPL 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:13 rod: I'm running it; no difference on 1.3.0 and 1.4.0, but neither seem to do a whole lot.

17:13 Clicking "create job" just prints to the console

17:13 technomancy: it's ironic that the EPL's further protection of your freedom prevents GPL compatibility

17:14 it 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:14 rod: weavejester: 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:14 weavejester: nm, it's probably my fault anyway, and it's working now so i'll just crack on.

17:15 weavejester: weavejester: Was friend above or below the handler/site middleware?

17:15 I should have really called that wrap-defaults instead of site

17:19 rod: if it happens again i'll look into it more closely. thanks for your help weavejester. :)

17:19 weavejester: rod: no problem

17:53 dansalmo: , (seq (str (first '(xyz))))

17:53 clojurebot: (\x \y \z)

17:54 dansalmo: is their a simpler way to get a seq from a symbol?

17:54 , (seq (str (first '(xyz))))

17:54 clojurebot: (\x \y \z)

17:56 gfredericks: ,(-> xyz quote str seq)

17:56 clojurebot: (\x \y \z)

17:56 gfredericks: if that's what you want, that's probably the easiest way to get it. but it's a weird thing to want

17:58 dansalmo: It seems I always want weird things. :)

17:58 gfredericks: if mine was hard to understand, equivalent is ##(seq (str 'xyz))

17:58 lazybot: ⇒ (\x \y \z)

17:59 dansalmo: but the thread is the same thing, isn't it?

17:59 gfredericks: basically the same thing you did but there's no reason to put the symbol in a list and pull it back out

17:59 dansalmo: ah, thats better

18:00 I am trying to find a way of determining if a certain character is in a symbol

18:00 gfredericks: why do you have symbols? wouldn't strings be more natural?

18:00 dansalmo: like y in symbol xyz

18:00 gfredericks: ,(.indexOf "xyz" "y")

18:00 clojurebot: 1

18:01 dansalmo: I have the symbol directly

18:02 oich: How 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:06 dansalmo: :gfredericks (.indexOf (-> xyx quote str) "y")

18:06 , (.indexOf (-> xyx quote str) "y")

18:06 clojurebot: 1

18:06 gfredericks: yep

18:06 ,(-> xyx quote str (.indexOf "y"))

18:06 clojurebot: 1

18:06 technomancy: oich: you can put it in your user profile, or you could use nrepl.el

18:06 dansalmo: is there no purely clojure way that would give true or false?

18:07 gfredericks: $findfn "xyx" "y" 1

18:07 lazybot: []

18:07 gfredericks: ,(-> xyx quote str (.indexOf "y") neg? not)

18:07 clojurebot: true

18:07 gfredericks: $findfn "xyx" "y" true

18:07 lazybot: [clojure.core/not= clojure.core/distinct?]

18:08 tomoj: &(.contains (name 'xyz) "y")

18:08 lazybot: ⇒ true

18:09 dansalmo: :tomoj I like that, thakns\

18:10 gfredericks: ,(map (juxt name str) 'foo 'bar/baz)

18:10 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol>

18:10 gfredericks: ,(map (juxt name str) '[foo bar/baz])

18:10 clojurebot: (["foo" "foo"] ["baz" "bar/baz"])

18:11 gfredericks: dansalmo: since we have no idea why you're using symbols you should note the difference between str and name

18:12 dansalmo: I am so new to clojure, just hacking around

18:13 gfredericks: that justifies just about anything

18:13 dansalmo: I need a boolean value for the presence of a character in a symbol

18:14 gfredericks: ,((fn [sym char] (.contains (str sym) (str char))) 'foobledooble \d)

18:14 clojurebot: true

18:16 hyPiRion: ,(some #{\d} (str 'foobledooble))

18:16 clojurebot: \d

18:17 S11001001: oich: https://groups.google.com/d/msg/clojure/xzvI_kCaeNI/zvCA1Nfaad4J

18:17 oich: oh I see technomancy already said something

18:19 dansalmo: :gfredericks I see what you mean re: name vs string.

18:19 , (name :xyz)

18:19 clojurebot: "xyz"

18:19 dansalmo: , (str :xyz)

18:19 clojurebot: ":xyz"

18:19 dansalmo: I need string

18:19 gfredericks: dansalmo: 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:20 dansalmo: I am using if for code

18:20 oich: technomancy thanks and thanks S11001001. So far things appear to be working.

18:23 * gfredericks didn't notice "oich" was a nick and interpreted as "ouch" and expected something controversial at the link

18:41 samaaron: hey - anyone in here mess around with jayq and clojurescript much?

18:46 gfredericks: samaaron: I'm doing it right now

18:47 though the use of jayq is rather minimal

18:47 samaaron: gfredericks: i'm trying to understand how all this stuff fits together

18:48 so, for example, if I include jayq in my project.clj, how does cljs interact with it?

18:48 gfredericks: well the jayq code gets put on the classpath

18:48 so you can require the cljs files therein

18:49 samaaron: gfredericks: yup, i'm with that part

18:49 so all the cljs fns are available

18:49 gfredericks: sure

18:49 samaaron: but what of the resources?

18:49 gfredericks: the resources in jayq?

18:49 samaaron: jayq seems to ship with jquery.js

18:50 gfredericks: oh I was supplying my own

18:50 samaaron: ok, that makes some sense

18:50 gfredericks: in fact it might be the case that my usage of jayq could be replaced with js/$

18:51 samaaron: hmmm, so this is where i start to lose the plot :-)

18:51 gfredericks: (js/$ foo bar) should emit $(foo bar)

18:51 samaaron: but jayq has ($ :foo)

18:51 gfredericks: but I don't know if that usage is recommended or guaranteed to be supported

18:51 what does that doo?

18:52 samaaron: to be honest, i don't know :-)

18:52 gfredericks: lets you use keywords instead of strings?

18:52 samaaron: i've just seen it being used

18:52 gfredericks: I oughta try it

18:52 samaaron: i'm still yet to get a working app set up to play about

18:53 gfredericks: any concrete blockers?

18:53 samaaron: well, i still don't know what to do about jquery.js

18:53 gfredericks: do you get browser errors about $ not being defined?

18:53 samaaron: is supplying your own idiomatic?

18:54 gfredericks: I don't know how much idiomacy there is in cljs so far

18:54 samaaron: hahaha

18:54 gfredericks: if 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:55 samaaron: i'm just wondering why there's a jquery.js in the jayq jar at all...

18:55 gfredericks: just in case?

18:55 could be an accident even

18:55 samaaron: the jayq docs don't say anything about jquery.js

18:56 gfredericks: I think you are looking too hard for the answer to the ultimate question of life, the universe, and everything

18:56 samaaron: haha

18:56 i just like to understand things

18:56 gfredericks: the clojurescript ecosystem is a giant vacuum of explanations

18:56 samaaron: oh hey, i just found this line: (include-js "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js")]

18:57 in the defpartial in the overtone clojurescript example

18:57 looks like he doesn't use the bundled jquery.js

18:58 Frozenlock: samaaron: do you have any particular function that you need in jquery? Otherwise you could try enfocus and domina

18:58 samaaron: Frozenlock: to be honest, I know no javascript

18:59 Frozenlock: samaaron: welcome to my world, a week ago!

18:59 samaaron: and thought that somethign jquery based would be good from a tutorial perspective

19:02 Frozenlock: You might have to do direct js call often, but yeah :P

19:02 samaaron: Frozenlock: what kind of thing(s) are you doing with cljs and which tools are you using?

19:04 Frozenlock: Mostly Domina and Enfocus to play with the DOM. Everything else is pretty much clojure.

19:05 https://github.com/Frozenlock/siren For notifications on a webpage

19:05 https://github.com/Frozenlock/zyzanie because I'm an emacs junkie :P

19:06 samaaron: Frozenlock: so are you using enfocus?

19:06 Frozenlock: Indeed

19:06 samaaron: and how are you finding it?

19:08 Frozenlock: I must say I prefer Domina most of the time. But Enfocus provide some higher function that are really neat. (Chaining animation, for example)

19:08 But I'm not using the Enlive-style templates, so I might be missing most of what Enfocus can give.

19:08 samaaron: ah ok

19:09 i'll play with domina for a bit :-)

19:17 Frozenlock: Anyone else working with cljs have suggestions?

19:18 samaaron: Frozenlock: 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:21 Frozenlock: Yes, there's a pull request for that. It should work anyway.

19:21 samaaron: Frozenlock: hmm, seems I had a bug, and errors were unrelated

19:22 Frozenlock: No there is some undeclared variable errors

19:22 samaaron: yey, i've successfully appended something to my dom via cljs

19:22 Frozenlock: \o/

19:22 ,hurray

19:22 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hurray in this context, compiling:(NO_SOURCE_PATH:0)>

19:23 Frozenlock: aw....

19:23 samaaron: haha

19:43 gfredericks: ~hurray

19:43 clojurebot: No entiendo

19:43 gfredericks: clojurebot: hurray is <reply> \o/

19:43 clojurebot: Ik begrijp

19:43 gfredericks: ~hurray

19:43 clojurebot: \o/

19:44 gfredericks: that bot just got 50% more useful

19:50 Frozenlo`: I'm a fan

19:50 ,hurray

19:50 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: hurray in this context, compiling:(NO_SOURCE_PATH:0)>

19:50 Frozenlo`: ~hurray

19:50 clojurebot: \o/

19:50 Frozenlo`: clojurebot doesn't like commas?

19:50 gfredericks: commas are for eval

19:51 (eval 'hurray) doesn't do anything meaningful

19:51 because hurray is not defined

19:51 Frozenlock: Oh I see, ',' for serious stuff, '~' for fun.

19:52 gfredericks: that is precisely the case

19:52 Raynes: &hurray

19:52 lazybot: java.lang.RuntimeException: Unable to resolve symbol: hurray in this context

19:52 gfredericks: Raynes: wat? lazybot hates ampersands?

19:52 Raynes: &(let [gfred 1] (+ gfred gfred))

19:52 lazybot: ⇒ 2

19:53 gfredericks: which keyboard character is the most uselessest for the average person? the tilde?

19:53 Raynes: ¿

19:53 gfredericks: that is not on my keyboard

19:53 Raynes: Isn't on mine either.

19:53 gfredericks: oh; perhaps you were saying something unrelated then

19:59 Frozenlock: right ctrl and escape

19:59 Oh no: the pause key

20:00 gfredericks: the F keys take up an awful lot of space

20:04 amalloy: gfredericks: scroll lock

20:04 gfredericks: I was interested in actual character things but these are good answers too

20:04 on my work computer I have scroll-lock set to change keyboard layouts

20:05 delete is used 70000% more than the other five keys in its group

20:06 amalloy: i think i use home/end more

20:06 gfredericks: bet we're talking about the hoi polloi

20:07 brehaut: i've just noticed that my keyboard as an eject key in that group. what kind of weirdo anachronism is that

20:08 * gfredericks can't come up with a kiwi joke

20:08 nDuff: Did Apple stop having eject keys standard?

20:08 amalloy: brehaut: i'd guess it's a newism, not an oldism

20:08 clojurebot: brehaut: I think struct embedding is monkey patching / mixins, and interface embedding is duck typing / typeclasses

20:09 brehaut: amalloy: its probably an inbetweenish

20:11 nDuff: yes

20:11 nDuff: it looks like what was the eject key on the older MBPs is now a power key

20:11 on the retina MBP anyway

20:17 casion: how do I get clojure to recognize a 2 byte value (say 0xd9) as a signed short (-39) rather than an int (217)

20:17 brehaut: (doc short)

20:17 clojurebot: "([x]); Coerce to short"

20:18 casion: ,(short 0xd9

20:18 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>

20:18 casion: ,(short 0xd9)

20:18 clojurebot: 217

20:18 casion: nope :|

20:18 gfredericks: ,(.toString (short 0xd9))

20:18 clojurebot: "217"

20:19 gfredericks: ,(.toString ^short (short 0xd9))

20:19 clojurebot: #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: short, compiling:(NO_SOURCE_PATH:0)>

20:19 gfredericks: ,(.toString ^Short (short 0xd9))

20:19 clojurebot: "217"

20:19 * gfredericks doesn't know anything

20:19 casion: short is 4 bytes I guess

20:19 seems I want to cast to byte

20:19 ,(byte 0xd9)

20:19 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for byte: 217>

20:20 casion: but that happens

20:20 gfredericks: short is two bytes I think

20:20 brehaut: well no

20:20 casion: I thought short was 2 bytes too, but I just looked it up and it's 4 16-bit)

20:20 brehaut: 0xd9 isnt a byte pattern, its a hex description of a number right?

20:20 gfredericks: 16-bit is 2 bytes

20:20 brehaut: right

20:20 casion: gfredericks: err.. yeah

20:20 this is all hurting my brain now

20:20 gfredericks: ,(Byte/valueOf "d9" 16)

20:20 clojurebot: #<NumberFormatException java.lang.NumberFormatException: Value out of range. Value:"d9" Radix:16>

20:21 brehaut: casion: and you want it to read as a particular byte format?

20:21 casion: I just want the byte-value of it reliably

20:21 gfredericks: why is 0xd9 insufficent for your purposes?

20:21 what are you doing with tthe "byte-value"?

20:22 casion: here, give me a sec, I'll get an example

20:23 amalloy: &(unchecked-byte 0xd9)

20:23 lazybot: ⇒ -39

20:24 casion: oooo, that does it

20:24 gfredericks: man 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:24 what a fool I was

20:25 casion: thanks again amalloy :)

20:34 Frozenlock: Can a function name mess with clojurescript?

20:35 gfredericks: O_O?

20:36 Frozenlock: Nvm, I must be doing something wrong...

20:38 weavejester: Has anyone tried lein-sub with lein2?

20:40 Ah, nevermind, I was using an outdated version

21:34 clj_newb_23894: has anyone here got a example of red5 + clojure working?

21:34 it seems like both clojure and red5 wants to "own the JVM"

21:34 and I haven't found a single tutorial on how to import red5 as a leiningen dependency

21:36 akhudek: clj_newb_23894: you need to find a maven repository to import with lein

21:36 clj_newb_23894: I don't think any of them has red5

21:36 akhudek: http://code.google.com/p/red5-maven-repository/ ?

21:37 clj_newb_23894: doh; thanks;

21:38 though I am suspicious of people who say "u" rather than "you"

21:38 akhudek: you'll also need to add the repository to your project.clj

21:38 SegFaultAX: Suppose 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:38 What's the best way to do that?

21:38 akhudek: clj_newb_23894: hah, the "u" thing also drives me crazy

21:39 SegFaultAX: if it's not very deep just use recursion

21:39 amalloy: yeah, recursion and mapcat

21:39 SegFaultAX: akhudek: Go on.

21:42 I'm having trouble working it out in Clojure.

21:42 akhudek: SegFaultAX: I guess something like https://www.refheap.com/paste/4816

21:43 amalloy: &((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:43 lazybot: ⇒ (9 3)

21:44 SegFaultAX: amalloy: Why do you track the depth?

21:45 amalloy: because otherwise i'll get the wrong answer

21:45 how's that for an unhelpful answer! poke around the code and see

21:45 SegFaultAX: amalloy: But the depth in this case is not fixed.

21:45 amalloy: And not known ahead of itme.

21:45 Time, even.

21:46 amalloy: oh. your question was not very clear

21:46 you said specifically children and subchildren

21:46 SegFaultAX: amalloy: All subchildren, recursively.

21:52 akhudek: SegFaultAX: You want this https://www.refheap.com/paste/4818

21:52 but need to have it exclude the first node

21:52 as that includes the argument

21:54 can just do (rest (children {27 [9], 9 [3], 8 [4], 4 [2]} 27))

21:54 Since the initial argument will always be the last thing added

21:54 SegFaultAX: akhudek: Thanks, I'll try it out.

21:54 Frozenlock: Any js savvy can tell me why this doesn't work? (.fromCharCode 65)

22:02 Oh, got it! (String.fromCharCode 97,108,101,114,116) works :D

22:03 jkkramer: what's the mime type for clojure data? "application/clojure"?

22:05 xeqi: jkkramer: thats what most people have been using

22:06 jkkramer: xeqi: k. doesn't quite seem correct but I'll go with the crowd

22:08 dnolen: Frozenlock: (.fromCharCode js/String ...) probably a bit more idiomatic.

22:14 Frozenlock: dnolen: Thanks!

22:36 jkkramer: clojuresphere updated -- http://www.clojuresphere.com/ - refreshed index, added some features

22:44 cemerick: jkkramer: awesome! :-)

22:44 dnolen: jkkramer: curious that ClojureScript doesn't show up as a Clojure project

22:45 jkkramer: dnolen: it's in there - http://www.clojuresphere.com/org.clojure/clojurescript

22:47 SegFaultAX: amalloy: Is there an API for 4clojure? It'd be cool if I could grab all my solutions.

22:48 amalloy: one or two things are exposed with an API, but not that

22:48 SegFaultAX: amalloy: Would it be possible to get a dump?

22:49 wmealing_: 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:49 amalloy: SegFaultAX: yeah, probably. step into #4clojure

22:51 cemerick: wmealing_: 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:52 wmealing_: damn it looked so promising too

22:52 hmm

22:52 cemerick: It offers no advantages over s3.

22:53 wmealing_: except that i'm likely to forget

22:53 and push my s3 details into github

22:54 ah no

22:54 its in a different file

22:56 cemerick: wmealing_: yes, credentials should never *ever* seriously ever go in project.clj.

22:57 dnolen: jkkramer: that's not the official clojurescript project

22:59 jkkramer: dnolen: ah you're right. clojuresphere has some issues with forked projects, since github doesn't include them in its API responses

23:00 wmealing_: s3 is so dirt cheap, i'll use it, thanks cemerick.

23:03 jkkramer: dnolen: looks like clojurescript also uses pom.template.xml, which doesn't get picked up. might have to write a special case for it

23:09 dnolen: jkkramer: awesome resource btw!

23:10 jkkramer: a great way to discover which projects are using which libraries.

23:10 jkkramer: dnolen: yeah, a nice resource for lib authors too

23:35 technomancy: jkkramer: nice work. did those github search results end up giving you what you needed?

23:35 nice to see the project count graph isn't dropping off anymore

23:36 I wonder if it'd be interesting to have a delta page per refresh

23:36 jkkramer: technomancy: thanks, and thanks for your help getting the ball rolling on the updates. Github api results are ok, not perfect

23:36 technomancy: "compojure jumped 3 positions while swank dropped 2..."

23:36 jkkramer: the biggest problem with the github api is that searches don't include forks

23:37 technomancy: oh, so you have to determine the fork root yourself? =\

23:37 jkkramer: also, because a search term is required, you don't necessarily get all results, just ones that mention "clojure" somewhere

23:37 technomancy: ah, shame

23:37 jkkramer: 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:38 jkkramer: technomancy: heh, nice.

23:38 technomancy: pull requests welcome

23:38 technomancy: I'll open an issue for it if you think it's a good idea

23:38 jkkramer: technomancy: sure

23:39 technomancy: maybe it could be done as a separate codebase that shares the same DB once we've got it running on neo4j

23:39 jkkramer: technomancy: 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:40 technomancy: sure

23:40 jkkramer: I think it lends itself to an alternate db format better now

23:40 amalloy: technomancy: 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:40 technomancy: good to hear =)

23:41 amalloy: can't do that for :url and :description; there's no heuristic to reliably determine it

23:42 jkkramer: well, there is the clojars & github url & description

23:42 amalloy: technomancy: don't you have the github page? that's a uri

23:42 technomancy: true. I wonder how common the github description is.

23:42 jkkramer: pretty common

23:43 technomancy: I guess a pull request would be better then

23:43 amalloy: seriously 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:43 technomancy: amalloy: there's precedent

23:44 I got a pull request from a gun.io bot removing a bunch of trailing whitespace

23:44 amalloy: right, that's a pull request

23:44 help is useful, issues are just nagging

23:44 technomancy: gotcha

23:48 tomoj: wow automated trailing whitespace pull requests..?

23:48 that seems more annoying than a real issue

23:49 amalloy: tomoj: git's default behavior is to warn you when introducing trailing whitespace, so it doesn't seem crazy to me

23:51 tomoj: I was trying to figure out how to get those warnings recently

23:51 seems they are default only when applying a patch?

23:53 but anyway, isn't the reason they warn you to help keep the history from getting mucked up with whitespace changes?

23:53 jkkramer: according to the clojuresphere data, there are only 23 projects with a github description and no clojars description

23:54 technomancy: huh; how about urls?

23:54 jkkramer: also, 4 projects with github homepage set, but no clojars homepage set

Logging service provided by n01se.net