#clojure log - Mar 04 2013

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

0:05 leku: raynes: after I get that data back, how can I start working with it?

0:05 say for example I just wanted to print the value of "name"

0:07 Raynes: What you get back is a map. You can call that map as a function to pull values out of it, or use the get function. Given my previous example: (-> (client/get "http://waterservices.usgs.gov/nwis/iv?sites=05331580&period=P7D&format=json" {:accept :json}) :body parse-string (get "name"))

0:09 leku: ah cool

0:09 how do you pull stuff that is nested out?

0:15 Raynes: leku: Yep.

0:16 Just replace the get with (get-in ["nested" "in" "here" "wow" "this" "is" "deep"])

0:16 leku: tried get "timeSeries/sourceInfo/siteName"

0:16 sweet

0:16 tomoj: I thought you had to do :as :json

0:16 does :accept imply :as?

0:16 leku: hm

0:17 tomoj: don't think so

0:17 clifton: Accept is a header on the request, but the server can respond with any format it wants

0:23 leku: can I limit how many values are returned?

0:23 by get-in

0:23 like "limit 10"

0:24 https://www.refheap.com/paste/12070

0:47 tomoj: leku: use {:accept :json :as :json} to allow removing "parse-string"

0:48 and get-in doesn't work that way

0:48 you can't traverse the timeSeries vector inside get-in

0:49 (get-in and friends are less powerful than lenses)

0:49 well

0:49 if you only want a single element of the vector, and you know its index, you can do that

0:49 leku: ok

0:49 tomoj: (get-in "value" "timeSeries" 0 "sourceInfo")

0:50 for the first one

0:50 leku: i see

0:50 tomoj: but get-in can't Traverse

0:51 er, and, uh, I meant (get-in ["value" "timeSeries" 0 "sourceInfo"])

0:51 leku: yeah

0:51 figurd that out

0:52 sweet finally got at siteName

0:52 what did you mean by the first statement you made, "allow removing parse-string"?

0:54 how come I can't just do a nested get-in?

0:54 (get-in ["value" "timeSeries" (get-in ["sourceInfo" "siteName"])

0:54 )

0:55 tomoj: I mean, if you put :as :json, you won't have to parse-string because clj-http will do it for you

0:55 leku: oh

0:56 tomoj: you can do something like (-> ... (get-in ["value" "timeSeries"]) (->> (map #(get-in % ["sourceInfo" "siteName"]))))

0:56 dunno what you want exactly

0:56 Raynes: Ugh.

0:57 tomoj: it should be (get-in ["value" "timeSeries" map "sourceInfo" "siteName"]) :(

0:57 no, not that

0:57 leku: yeah

0:57 didntw ork

0:58 tomoj: that was hypothetical

0:59 leku: gotcha

0:59 thanks for the help

0:59 what do the -> and ->> mean?

0:59 tomoj: maybe *(into [] (reducer-in body ["value" "timeSeries" r/map "sourceInfo" "siteName"])) -- "*" means hypothetical

1:00 (macroexpand (-> foo (get-in ["foo" "bar"]) (get-in ["bar" "baz"])))

1:01 hmm

1:02 I thought there was a nice macroexpanding bot

1:03 terom: , (macroexpand (-> foo (get-in ["foo" "bar"]) (get-in ["bar" "baz"])))

1:04 &(macroexpand (-> foo (get-in ["foo" "bar"]) (get-in ["bar" "baz"])))

1:04 lazybot: java.lang.RuntimeException: Unable to resolve symbol: foo in this context

1:05 leku: seems to me that this stuff was easier when I was working with Perl and Data::Dumper

1:05 Iceland_jack: &(macroexpand '(-> foo (get-in ["foo" "bar"]) (get-in ["bar" "baz"])))

1:05 lazybot: ⇒ (get-in (clojure.core/-> foo (get-in ["foo" "bar"])) ["bar" "baz"])

1:05 clojurebot: eval service is offline

1:06 terom: anyway, -> and ->> are threading macros, they "thread" their argument through the function calls

1:06 leku: and whats the diff between the two?

1:06 can I do -> ->> ->>>?

1:06 terom: -> puts the argument at first position, ->> at the last position

1:07 amalloy: dream bigger, leku! write the ->>>>>> macro!

1:07 leku: ahah

1:07 tomoj: &(clojure.walk/macroexpand-all '(-> foo (get-in ["foo" "bar"]) (get-in ["bar" "baz"])))

1:07 lazybot: ⇒ (get-in (get-in foo ["foo" "bar"]) ["bar" "baz"])

1:07 tomoj: &(clojure.walk/macroexpand-all '(->> foo (get-in ["foo" "bar"]) (get-in ["bar" "baz"])))

1:07 lazybot: ⇒ (get-in ["bar" "baz"] (get-in ["foo" "bar"] foo))

1:07 leku: brb

1:31 ok have another question for you

1:32 https://www.refheap.com/paste/12071

1:33 how would I take that data and find the average from the value, etc "32.7"

1:33 and also show the min/max?

1:37 hmm

1:37 would be cool to plot this data with function-plot

1:38 and incanter

1:39 or just jfreechart I guess

1:43 alex_baranosky: does anyone have a nice example of when/why to use as-> … I'm still grokking its usefulness

1:49 amalloy: (-> blobs (get-in [a b c]) (as-> things (for [x things :when (even? x)] (inc x))))?

2:01 dhkl: alex_baranosky: Let's say f, g, h are functions, all other symbols are some locals, and you have a form like this (h (g (f x) y) z). the -> macro let's you write the form (-> x f (g y) (h z)). It is a nicer way to write composite functions.

2:03 alex_baranosky: amalloy: I see, so I can avoid writing: (-> blobs (get-in [a b c]) (#(for [x % :when (even? x)] (inc x))))

2:04 amalloy: indeed

2:04 alex_baranosky: dhkl: I think you're referring to the -> macro? I was referring to the as-> macro

2:04 dhkl: alex_baranosky: sorry, misread your question :-)

2:08 tomoj: as-> can also replace any repeated let

2:08 I was going to say like the source of defn, but not really

3:59 tekkk: why isn't my (def a 1) public?

3:59 can't access it from another namespace

4:03 clgv: tekkk: it is public. you probably do not access it right. post a code snipet on e.g. refheap.com

4:04 tekkk: clgv: I'm using light table perhaps its not requiring it correctly

4:05 (dir dev.util) gives me all functions only

4:05 clgv: tekkk: you have to require it correctly ;)

4:06 tekkk: (ns dev.main

4:06 (:require [clojure.repl :as repl]

4:06 [dev.util :as util]))

4:06 clgv: e.g. (ns my.other.ns (:require [my.first.ns :as fns])) fns/a

4:06 util/a then

4:07 tekkk: error: No such var

4:07 nvm … must be a light table error

4:07 no probs with the functions

4:19 clgv: tekkk: if you are in a repl I doubt that this is a lighttable error. but you can verify in a "lein repl" in the same project

4:44 apropos lighttable it maps "{" to "[" which is pretty weird in a clojure IDE ...

7:42 mpfundstein: i have a question about avoid state

7:42 lets say i write an app which has a queue of jobs. On this queue jobs can get pushed, popped or reordered

7:43 how would you do that without state? the queue must somehow be a global object of state

8:44 TimMc: mpfundstein: You could use a list in an atom.

8:44 It's still state, but it can be managed that way.

8:44 mpfundstein: TimMc: yes thats what i thought

8:45 and swap! to propagade add remove re-order

8:45 TimMc: I've also used a j.u.c.LinkedBlockingQueue in an app to coordinate data between threads. That's a regular mutable object, but it does its own concurrency management.

8:46 mpfundstein: i will check into that

8:46 thanks

8:47 TimMc: do you know if there is a way to save definitions from REPL to a file?

8:48 TimMc: Hmm, not sure.

8:48 Copy them out of your REPL history file? :-P

8:49 mpfundstein: yeah i thought maybe i can somehow print a functions source code

8:49 and save it to a file

8:50 Anderkent: find all symbols in ns, call (:source (meta (var sym)) on them, print to file?

8:51 then write a lein plugin to do that easily!

8:51 :P

8:51 mpfundstein: :0) lets try

8:52 TimMc: Anderkent: I don't recall :source being a metadata key.

8:52 Anderkent: It's there for me on function definitions, using reply and clojure 1.4

8:54 https://www.refheap.com/paste/12082 - seems to lose newline info (that's probably the repl merging lines)

8:55 mpfundstein: Anderkent: without the new line info and white spaces is a bit sad :(

9:00 octe_: i want to turn this ({:id 1 :name "foo" :title "bar"} {:id 2 :name "test" :title "bleh"}) into this {1 {:name "foo" :title "bar"} 2 {:name "test" :title "bleh"}}

9:00 what's a good way to that?

9:02 cmdrdats: octe_: you could just (into {} (map (juxt :id identity) list))

9:02 ?

9:03 octe_: thanks :)

9:03 clgv: zipmap^^

9:03 cmdrdats: foo, i always forget about zipmap

9:03 clgv: (zipmap (map :id coll) coll

9:04 octe_: or taht

9:04 clgv: &(let [coll [{:id 1 :name "foo" :title "bar"} {:id 2 :name "test" :title "bleh"}] (zipmap (map :id coll) coll))

9:04 lazybot: java.lang.RuntimeException: Unmatched delimiter: )

9:04 clgv: &(let [coll [{:id 1 :name "foo" :title "bar"} {:id 2 :name "test" :title "bleh"}]] (zipmap (map :id coll) coll))

9:04 lazybot: ⇒ {2 {:name "test", :title "bleh", :id 2}, 1 {:name "foo", :title "bar", :id 1}}

9:05 octe_: i like that one better

9:05 cmdrdats: octe_: ye, zipmap is much cleaner :)

9:48 ayia: Hi guys, fn special forms suppose optional "name?" first parameter... Am I understand correctly, that this name can be used only inside a fn definition? Because why then we use "defn" to use "named functions"...

9:49 clgv: ayia: yes. and it occurs in the classname

9:49 hashbang1: ayia: yes

9:49 ayia: clgv: hashbang1: thanks guys!

9:50 jweiss: CompilerException java.lang.IllegalArgumentException: No single method: update of interface: katello.rest.CRUD found for function: update of protocol: CRUD, compiling:(/home/jweiss/workspace/katello.auto/src/katello/changesets.clj:273) i can't make sense of this error message. seems like the method and the function it's talking about are the same thing.

9:55 seems like it is not matching the arity. it's declared as (update [x f & args]) and i'm calling it like (update cs update-in [:foo] conj bar) looks right to me...

9:56 Anderkent: I think you might be refering to wrong symbols, or the protocol is being compiled more than once and you have a stale reference

9:58 also I'm not sure if protocols support rest args.

9:58 Pupnik-: dang clojure programming is twice as long as programming clojure

9:58 jweiss: Anderkent: i'm pretty sure it does, because this protocol is working just fine elsewhere

9:58 i think what does support varargs is the extend-protocol and extend-type macros.

9:59 the underlying functions appear to support them just fine.

9:59 sorry i meant what *doesn't* support varargs

9:59 i tried restarting my repl and compiling from scratch, didn't help. i know changing protocols can be picky about that but that is apparently not the problem either.

10:00 and there's no clojure.core/update for my protocol to interfere with

10:00 Anderkent: jweiss: I tried it in repl and varargs don't work

10:00 the & is interpreted as argument name

10:01 can't find documentation for it though...

10:01 dnolen: jweiss: protocol fns don't support var args.

10:01 Anderkent: https://www.refheap.com/paste/12083

10:01 jweiss: Anderkent: it works if you use extend

10:01 Anderkent: I must say protocols in general are incredibly painful to work with, and unless you're doing java interop you're better off not using them

10:01 jweiss: so you can pass a map of keywords to functions as an impl.

10:02 znDuff: Anderkent: *shrug*. There are performance reasons to prefer them over multimethods when the semantics are workable.

10:02 jweiss: Anderkent: you'd recommend multimethods instead? those are kind of difficult too

10:02 anyway, i'm pretty sure the protocol can declare varargs

10:02 dnolen: jweiss: that ony works because extend w/ a map allows you to pass regular fns

10:03 jweiss: dnolen: ok so that's what i'm using

10:03 dnolen: but protocol fns absolute do not support var args

10:03 jweiss: hm so i am not sure why it worked for me

10:03 * jweiss goes to repl to prove/disprove

10:03 dnolen: if it's working you're getting lucky - there's no support for it.

10:04 Anderkent: znDuff: yes but at least multimethods work fairly reliabily, while trying to use a protocol invariably ends up with two days of debugging on why it acts differently in your repl, when AOT compiled, and when dynamically compiled

10:04 clgv: jweiss: "&" in a protocol argument list is just an argument name. I dont know why there is no compiler warning or error, yet...

10:05 jweiss: weird i am not sure how this worked for me before

10:05 clgv: maybe you passed a map along and used that map in the implementation

10:06 jweiss: oh... [x f & args] and I was calling it with (update x assoc :foo :bar)

10:06 arity matches

10:06 well that blows

10:08 i guess i will have to have all the callers roll args into a list first. i could declare multiple arities but then all implementers would have to implement each separately.

10:09 dnolen: jweiss: or provide an api of fns that users actually use

10:09 jweiss: and real fns dispatch to protocol fns

10:10 jweiss: dnolen: oh yeah that would be easier, wouldn't it :)

10:11 i'm not even sure it's necessary for my 'update' to delay applying f to x & args. it may be fine for the caller to do it.

10:15 mrb_bk: good morning #clojure

10:25 dcolish: clojure-doc is awesome, no sure why it took me so long to find it

10:25 *not

11:01 jweiss: is it possible to avoid automatic import of classes from java.lang? i want to do (defrecord Package ... ) but it interferes with java.lang.Package

11:04 (ns-unmap *ns* 'Package) seems to do it.. ugly though.

11:04 mybuddymichael: jweiss: Now I'm curious why you want to do that.

11:05 Ah, nevermind.

11:05 jweiss: mybuddymichael: because i want a domain specific record called Package.

11:05 Anderkent: yeah I don't think there's a way to do :exclude java.lang.Package like you can with clojure symbols, you might have to do the unmap

11:06 jweiss: i have no idea what java.lang.Package is... /me looks out of curiosity

11:07 Anderkent: it's runtime info about a package afaik

11:07 jweiss: huh, interesting didn't even realize there was a class for that. can't recall using it

11:08 i mean, i would have expected that class to exist, just didn't occur to me it'd be in java.lang

11:08 edoloughlin: Anyone know where the 1.4 docs have gone? The link from clojure.org (http://clojure.github.com/clojure/branch-clojure-1.4.0/index.html) returns a 404

11:10 clgv: jweiss: I'd consider that a bug. since the symbol representing the protocol name should not be resolved, should it?

11:10 jweiss: clgv: protocol?

11:10 clgv: oh record in your case

11:10 jweiss: you can create records without involving a protocol (which is all i have at this point)

11:10 clgv: but it should be the same

11:11 since the generated class is your.ns.Package and not java.lang.Package

11:11 jweiss: clgv: seems like if the symbol is in defrecord, it shouldn't be resolved. but i don't know all the details of what happens internally

11:12 clgv: jweiss: I would report it on jira or ask on the ML

11:12 jweiss: clgv: or at the very least (defrecord user/Package ...) should work. but it doesn't.

11:13 clgv: edoloughlin: seems those did not survive the 1.5.0 release

11:14 jweiss: 1.5 is released?

11:14 clgv: edoloughlin: ah they messed up the folder name

11:14 yes

11:14 jweiss: ah yes i see the ANN in the mailing list now

11:15 kind of sucks that no webpage gets updated for events like this

11:15 clojure.org is almost completely static

11:16 clgv: jweiss: http://clojure.org/downloads got updated though. but you dont see it on clojure.org landing page

11:17 jweiss: clgv: yeah, i see that now. i meant something like "March 1 2013: Clojure 1.5 is released [link: release notes]"

11:17 clgv: edoloughlin: they forgot the index.html in clojure 1.4.0 documentation

11:18 mpfundstein: can anyone help me on that? https://gist.github.com/anonymous/5083422

11:19 i dont understand why DateFormat throws

11:20 Anderkent: your format doesnt seem to match the input (four : separated sections in the input string, three in the format)

11:20 mpfundstein: but this works

11:20 (println (parse-date-str "03/01/2013 00:00:22:12" "MM/dd/yyyy HH:mm:ss"))

11:20 this works perfects

11:23 i dont get it println before parse-date-str returns a valid date but if i pass the variable than it throws, if i use the value directly in repl not

11:23 Anderkent: what does extract-time-jp-str look like?

11:23 it might be giving you an object that looks like a string when printed out, but is not a string

11:24 mpfundstein: Anderkent: https://gist.github.com/anonymous/5083467

11:27 Anderkent: hm. It seems to work for me with x = ["03/01/2013 00:00:22:12" "03/01/2013 00:00:22:12"]

11:28 i.e. I don't get that exception

11:29 mpfundstein: x

11:29 mom

11:29 ( "03/01/2013 23:51:20:04 00:02:46:07 03/01/2013 23:51:20:04 00:02:46:07 59621-Fedde_Le_Grand-So_Much_Lov Aired 323543DC-8769-4BB1-9ADA-54D5A6AF651E" "03/01/2013 23:54:06:11 00:06:29:22 03/01/2013 23:54:06:11 00:06:29:22 56883-deadmau5-Sofi_Needs_A_Ladd Aired 00849235-71EC-4A7B-9330-EC7E8AF6109C")

11:29 this is x :-)

11:30 hmm

11:31 onlye the first of the data source is the problem

11:31 Anderkent: that doesn't behave the way your output seems to suggest for me (it splits the string differently and the first date is "03/01/2013 23:51:20:04" not "03/01/2013 00:00:22:12"

11:32 Wild_Cat: what's with the 4-part times?

11:32 Anderkent: only way I can reproduce your exception is by removing the format argument to parse-date-str (as expected)

11:32 mpfundstein: Anderkent: ok mom, ill provide more accurate

11:34 https://gist.github.com/anonymous/09ebf3b69ecd608b5c6e

11:34 this is the datasource

11:34 i slurp it

11:34 (in repl)

11:34 than (def x (seq slurped))

11:35 than the code above

11:36 Anderkent: i.e. (def slurped (slurp "my-list-of-dates")) (def x (seq slurped)) ? That probably doesn't do what you want (x will be a list of characters instead of strings)

11:37 mpfundstein: yeah i told you wrong sry (i am a bit tired now after 8 hours :-) )

11:37 (def x (clojure.string/split (slurp "justoutinput.txt") #"\r\n")))

11:37 gives me a vector of strings

11:39 Anderkent: https://gist.github.com/anonymous/95d162ffe6b5798c4974

11:42 Anderkent: mpfundstein: right, that works for me. Did you try restarting the repl? Maybe you have a different version loaded than what you're editing. Otherwise I don't know

11:42 jcromartie: how do I design a web app that uses refs to coordinate state so that it is testable?

11:42 should I make those refs dynamic and just rebind them in a fixture?

11:43 mpfundstein: Anderkent: yeah i just loaded a new repl

11:43 Anderkent: (map #(parse-date-str (extract-time-jp-str %) "MM/dd/yyyy HH:mm:ss") x)

11:43 Anderkent: no luck?

11:43 mpfundstein: same problem

11:43 Anderkent: https://www.refheap.com/paste/12087

11:43 mpfundstein: i tried with map

11:43 same problem

11:44 f***

11:44 i dont get it

11:44 :-)

11:44 are you using lein repl ?

11:44 Anderkent: well I guess what you want to do is fire up the repl with a debug port open, and connect with eclipse/some other java debugger

11:44 yes

11:44 clojure 1.4 / java7

11:44 mpfundstein: i have java 8

11:44 leku: java 9000 here

11:45 mpfundstein: (dev edition leku)

11:45 leku: i'm using spartan edition :)

11:45 mpfundstein: java version "1.8.0-ea"

11:45 maybe thats the problem

11:45 hm

11:46 Anderkent: unlikely if you say it works when invoked directly :S

11:47 mpfundstein: Anderkent: lol

11:47 Anderkent: it worked

11:48 seangrove: Anyone know of a way to do declarative data transformation? I'm integrating with tons of different third party api's and normalizing them, and each one ends up being a horrible looking set of functions that are basically write-only

11:48 mpfundstein: Anderkent: i copied the input file in a new sublime document saved that and opened that as x

11:48 Anderkent: now it works

11:48 seangrove: They're pretty disconnected from the structure of the input data or (to a lesser extent) the output data

11:49 Wondering if there's some DSL or library (in any language) people are aware of

11:49 mpfundstein: Anderkent: had probably sometihng to do with the windows line endings

12:55 leku: how do I update lein2 so that it wants clojure 1.5.0 by default?

12:56 or that it uses 1.5.0 in the project.clj by default

12:56 technomancy: leku: it uses 1.5 for new projects on master; you can run from git or wait for the next release

12:56 leku: thanks

13:22 jcromartie: I want to use an agent to serialize (in the concurrency sense) file access

13:23 do I really need any particular value in the agent? any reason not to just use (agent nil)

13:23 it seems kind of, fishy...

13:25 Apage43: i'd expect you'd make the file the value of the agent

13:25 it should probably enclose whatever you're serializing access to

13:25 technomancy: jcromartie: agents imply an identity that changes over time; it communicates the wrong thing to a reader. look into executors.

13:26 jcromartie: executors, huh

13:28 Apage43: mayhaps it would be good for someone to wrap up more of the java.util.concurrent stuff to encourage its use

13:28 technomancy: typically you wrap things that are unpleasant to use for whatever reason. people don't bother with j.u.c because it's already good out of the box.

13:28 clojurebot: java.util.concurrent?

13:28 clojurebot: java.util.concurrent is "When I find myself in times of trouble / Prof. Doug Lea comes to me / Coding lines of wisdom / j.u.c."

13:29 Apage43: hm

13:29 makes sense

13:29 craigbro: hehe

13:29 technomancy: though you do miss out on stuff like docstrings and arglists metadata

13:29 Apage43: there's a couple java things I just always import and use bare

13:29 like JSoup

13:29 jcromartie: so, this is good stuff

13:29 had no idea

13:35 why don't I see (NREPL) output from threads created by Executors, but I see output from threads when using future or pmap

13:36 Apage43: future captures bindings

13:36 I suppose pmap does the same

13:36 jcromartie: hm

13:37 Apage43: you can use bound-fn to do similar

13:38 jcromartie: beautiful

13:38 thanks!

13:39 maybe that means I can fix up Compojure handlers to print stdout to the NREPL

13:42 hot diggity damn

14:20 mpenet: Apage43: there are a couple of lib that wraps Executors from clojure already: knit and pallet has one too (pallet-threads I think)

14:21 Apage43: I've used overtone's at-at for things it fits in. Knit looks nice though, I'll probably use that too.

14:23 hugod: https://github.com/pallet/pallet-thread

14:29 cemerick: Apage43: crap, and here I was going to put out a library called AT-AT! :-|

14:30 I s'pose AT-ST will do :-P

14:30 yogthos: cemerick: have a question if you got a minute :P

14:30 Apage43: ha :)

14:31 cemerick: yogthos: shoot

14:32 yogthos: cemerick: I've got this bug request on lib-noir, and I can't really think of anything better https://github.com/noir-clojure/lib-noir/issues/44

14:32 cemerick: I don't really, but we'll see how it goes :-)

14:32 yogthos: cemerick: is using the session the right thing to do in this scenario?

14:33 cemerick: and should redirection rules even care about this, feels to me like it's a separate problem

14:33 cemerick: but wanted to get a second opinion before I reply

14:33 cemerick: yogthos: yes, the session is the right place to put it, unless you need to support dumb clients that don't track cookies. In that case, people have been known to stuff encoded URLs into redirection URLs.

14:34 Friend does the former.

14:34 yogthos: cemerick: so maybe I should just tell him to use friend since his needs are non-trivial :P

14:34 cemerick: I know nothing about noir though, so use salt apprioriately.

14:34 yogthos: cemerick: my redirection rules are very basic, and intentionally so

14:35 cemerick: no point reimplementing friend in noir after all

14:36 cemerick: it sounds like he's aiming to implement more general authorization on top of restricted

14:36 yogthos: yup

14:36 cemerick: I can't tell atm if that's a good idea or not :-)

14:38 yogthos: cemerick: if I could find an intuitive way to do it would be nice, but nothing comes to mind

14:38 cemerick: yogthos: you may want to point him to friend. If all he's after is authn/authz, then that should set him up.

14:38 yogthos: cemerick: do you have an example kicking around of how friend does it, I could just link to that :)

14:38 cemerick: If he's trying to do something more sophisticated, then...I may return him to you ;-)

14:39 yogthos: cemerick: lol or he can just roll his own :P

14:39 cemerick: yogthos: the two fns starting here: https://github.com/cemerick/friend/blob/master/src/cemerick/friend.clj#L142

14:39 it's not hard

14:40 yogthos: cemerick: awesome

14:40 cemerick: and that's the beauty of clojure web apps, you need something done your way just plug in the lib to do it :P

15:10 jjjddd0: Hi all, what is the recommended lein template for web projects ?

15:10 I heard that Noir is no longer supported

15:10 Raynes: $google clojure luminus

15:10 lazybot: [Luminus: a web framework for Clojure] http://yogthos.net/blog/35

15:11 edtsech: http://www.luminusweb.net/

15:11 jjjddd0: thanks guys

15:11 helpful as always

15:11 Raynes: yogthos: Man, that website is really nice.

15:12 I think I told you this once before, but again, bravo.

15:15 * wink is not keen on migrating his 2-3x 50 LOC from noir :/

15:18 jjjddd0: just FYI, luminus project setup is acting weird with Lein, and counterclockwise

15:18 amalloy: jjjddd0: why say "FYI" and then not provide any information?

15:18 jjjddd0: I get a lot of Could not find artifact luminus:lein-template:pom:0.4.6 in central when running lein new luminus

15:18 mrb_bk: 100 people signed up for confo! wow!

15:19 jjjddd0: amalloy: what else would you want ?

15:25 edtsech: jjjddd0: I checked on lein 2.0 it worked for me.

15:26 cmajor7: question about "reducers": trying to grok the meaning behind "r/map" for example. it seems that the idea is NOT to use it as a "core map" at all, but rather only use it as a "reducible" in order to be foldable. is that accurate? thx

15:28 e.g. (partition 2 (map inc [1 2 3 4])) is ((2 3)(4 5)), whereas (partition 2 (r/map inc [1 2 3 4])) is "can't create ISeq from reducible"

15:36 hlprmnky: I am not yet super familiar with the reducers lib in clojure, but that would track with my understanding - reducers is supposed to be like unto a map/reduce framework, right?

15:37 rabbit_airstrike: I'm reading through some of the blog posts trying to understand how this might be answered

15:37 hlprmnky: So it would make sense that the products or r/map are "customized" for that framework instead of core/map maps

15:37 rabbit_airstrike: this line seems pretty key: "Thus, core.reducers/map is a function of fn * reducible -> reducible. (Whereas core/map is a fn of fn * seqable -> seqable)"

15:38 although I don't quite see how partition couldn't be applied to the output of the reducers map

15:39 cmajor7: well partition is expecting a seq, but gets a reducible instead (e.g. unrealized reciepe)

15:39 rabbit_airstrike: right

15:39 znDuff: Given as I'm already off into "things that shouldn't be done" territory by digging into someone else's private vars -- is there a better way to access them than this? (def pull-seq- @(clojure.lang.RT/var "clojure.data.xml" "pull-seq"))

15:40 rabbit_airstrike: could you apply seq to your reducible coll to make it seqable?

15:40 cmajor7: I don't think you can

15:40 you should use a "reducer" to "realize" it

15:40 amalloy: @#'clojure.data.xml/pull-seq

15:40 cmajor7: that reifies the core reducer protocol

15:41 rabbit_airstrike: hmm

15:41 cmajor7: to transform the "map" function with another "reduce" one

15:42 e.g. (f result (f input))

15:42 I do understand what it is.. I just don't seem to convince my brain "why" it is :)

15:43 these r/map, r/filter, r/mapcat all return recipes rather than seqs

15:43 hence it seems the only usage for them is in the context of those "cooks" that "do by the recipe" e.g. reducers

15:44 however how I read Rich's article (at least from the beginning) is "let's first create the 'same' map, filter, mapcat", but in a different way

15:45 (e.g. without temp allocations, sequentiality, etc..)

15:45 and that "the same" part I can't seem to understand

15:46 rabbit_airstrike: right

15:47 hiredman: http://dev.clojure.org/jira/browse/CLJ-991

15:50 cmajor7: @hiredman, interesting. but it just adds a specific "r/partition" to grok reducibles. which I guess supports my previous understanding that "r/map" does not have too much in common with "core map" besides applying a function to a "single element"

15:50 e.g. (f input)

16:03 jtoy: hi all, im back :)

16:12 mpfundstein: is some up for feedback ? http://ideone.com/3AmB2f

16:12 maybe theres a more elegant way

16:13 amalloy: (def x (frequencies temp-list))

16:13 marcellu`: map first group-by identity

16:14 hiredman: (apply merge-with + (map (fn [x] {x 1}) ...))

16:14 marcellu`: oh, yeah, frequencies does it

16:14 znDuff: mpfundstein: No need for an atom there -- my first instinct would be a reducer, but there are obviously other ways. :)

16:14 marcellu`: totially misunderstood what you were going for

16:14 * znDuff wanders to look at how frequencies is implemented

16:14 mpfundstein: znDuff: yeah i thought about a reducer too , maybe ill try it again

16:15 alandipert: mpfundstein: nice! check out http://blog.fogus.me/2011/03/09/recursion-is-a-low-level-operation/

16:15 mpfundstein: frequencies

16:15 znDuff: mpfundstein: Are you doing this for the exercise, or as part of a larger task?

16:15 mpfundstein: znDuff: exercise actually

16:15 znDuff: i am playing with clojure since saturday

16:15 znDuff: and i begin to love it

16:16 znDuff: frequencies is a reducer, as it happens.

16:16 mpfundstein: znDuff: didnt heard that

16:16 znDuff: ill check frequencies

16:16 lol

16:16 frequencies producies exactly the same outcome as my function :D

16:16 grrr

16:16 :D

16:17 amalloy: mpfundstein: if frequencies didn't exist, though, you'd want to rewrite that as a reduce instead of doseq with an atom

16:17 znDuff: ...and frequencies looks to be about as fast as possible while staying idiomatic Clojure, given its use of transients

16:17 mpfundstein: amalloy: ok, ill leave that as an exercise to me

16:18 znDuff: mpfundstein: expand the "source" listing at http://clojuredocs.org/clojure_core/clojure.core/frequencies, if you haven't dug into it elsewhere.

16:18 mpfundstein: znDuff: i already did (source frequencies)

16:18 znDuff: lots of stuff to google now

16:18 znDuff: *nod*.

16:34 milanj: Hi

16:34 is there a way to exclude some .jars from lein uberjar that I'm not directly depending in project.clj ?

16:35 llasram: milanj: profiles

16:35 milanj: What's the details of the dependencies in question?

16:36 milanj: how do you mean "details" ?

16:36 I dont have those projects in my project.clj

16:36 it's deeper in deps tree ...

16:36 znDuff: milanj: Do you know which direct dependency is including them?

16:36 llasram: milanj: I mean, what dependency do you want to exclude, and why do you want to exclude it, if it's a dependency of something you are using?

16:37 znDuff: milanj: You can add an exclude list to the direct dependency, but you have to know which one.

16:37 milanj: there is conflict with slf4j that hadoop is using

16:37 and some libs that I depend on

16:37 not sure though if just removing it from jar could solve this

16:38 *and some libs -> (slf4j that some of projects that I depend on)

16:38 llasram: milanj: Ah! Check out the leiningen `provided` profile

16:38 znDuff: milanj: search for :exclusions in https://github.com/technomancy/leiningen/blob/master/sample.project.clj

16:38 jcrossley3: milanj: something like this: [your-lib "1.0.0-SNAPSHOT" :exclusions [slf4j]]

16:39 llasram: I think milanj actually wants `provided` dependencies. They need slf4j -- just ultimately want the uberjar not to include it, because is provided by Hadoop

16:39 jcrossley3: oh :)

16:39 llasram: milanj: Any dependencies specified in the `provided` profile will be handled normally except that they won't be included in uberjars

16:40 milanj: llasram, yes, that is what I want

16:40 llasram: milanj: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#framework-uberjars

16:41 milanj: llasram, thanks

16:42 llasram: np!

16:53 yogthos: Raynes: yeah I'm really happy with how that turned out and with a decent theme it doesn't even make your eyes bleed :P

16:56 brehaut: huh, that theme is different to what i remember

16:57 milanj: llasram, looks like I can only exclude libs that I provide

16:57 I can't exclude some .jar from uberjar that some of libs that I depends on depends

16:57 SegFaultAX: Theme for what?

16:58 milanj: so, If I depend on jar A that depends on jar B -> I cant exclude jar B from my uberjar ?

16:58 SegFaultAX: milanj: Wouldn't that defeat the purpose of an uberjar?

16:58 milanj: well, I think that something like this you can do in maven

16:59 SegFaultAX: milanj: But the point is to make a completely self-contained jar. Failing to include some number of dependencies defeats that, no?

16:59 llasram: milanj: Listing the dependency in the `provided` profile should get it marked as provided

17:00 SegFaultAX: It's for frameworks like Hadoop which expect to provide a bunch of dependencies themselves at runtime

17:00 SegFaultAX: llasram: Oh I see.

17:00 milanj: exactly

17:00 SegFaultAX: I didn't understand the usecase. Thanks.

17:08 milanj: llasram, should I put this in my project.clj ?

17:08 I mean, I tried it and it's now working

17:08 s/now/not

17:26 jtoy: newb question,how do I test a seq out? this doesnt work (12312,1312)

17:26 java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IF

17:27 technomancy: jtoy: what would you expect it to do?

17:27 jtoy: technomancy: print out the same thing like if i just typed in 123

17:27 technomancy: so you want to prevent it from evaluating as a function call?

17:27 jtoy: then the next thing I woudl do is (type (123)), but that doent work either

17:28 rabbit_airstrike: '(12312, 1312)

17:29 jtoy: ok, im "relearning" clojure

17:29 rabbit_airstrike: sorry, didn't mean to throw a wrench in the socratic method there

17:29 technomancy: hehe

17:30 jtoy: technomancy: i dont remember a lot of the basics, so i cant even answer that question....

17:31 technomancy: jtoy: so... (type 123) calls the type function with the argument 123... so you can see from there what (123 456) means, right?

17:31 jtoy: technomancy: yeah

17:31 ah , so the first item is the function

17:32 (123)

17:32 rabbit_airstrike: (123) would try to evaluate the function 123 represents with no arguments

17:33 well

17:33 123 wouldn't be a valid name

17:47 Raynes: yogthos: We should maybe add some attribution stuff in the README.

17:47 yogthos: Raynes: yeah good point :)

17:47 Raynes: you up for doing it? :)

17:47 Raynes: Sure.

17:48 yogthos: awesome

17:48 Raynes: yogthos: I'm thinking "Maintainers: yogthos, Raynes\nContributors: peoples…"

17:48 Sound good?

17:48 yogthos: yeah that sounds good ;)

17:55 Raynes: yogthos: https://github.com/noir-clojure/lib-noir#credits

17:55 yogthos: glorious :)

17:56 arohner: there's a common design pattern that keeps coming up that I don't know how to solve. I have a predicate function(defn foo [] (and (bar x) (baz y) (blarg z)). I want to able to log which branch failed

17:56 i.e. (infof "foo failed, bar returned false")

17:56 is there a clean solution to that?

17:56 amalloy: Raynes: why not just link to https://github.com/noir-clojure/lib-noir/contributors ?

17:57 it won't get stale

17:57 Raynes: amalloy: Because I didn't know that that even existed.

17:57 yogthos: it does look pretty :)

17:57 Raynes: Shit all over my efforts, why don't you amalloy.

17:57 I shortlogged and everything.

17:57 yogthos: lol stuff you learn about github eh

17:58 amalloy: shortlogging sounds kinda like a quasi-euphemism for shitting all over your efforts

17:58 yogthos: rofl

17:58 Raynes: https://github.com/noir-clojure/lib-noir#contributors

17:59 yogthos, amalloy ^

17:59 yogthos: haha nice

17:59 Raynes: The maintainers part is still useful because it's helpful to know who to direct whining to.

17:59 Damn it. Typo.

17:59 Well, that's my commit quota for March.

18:03 ivan: near the end of http://vimeo.com/46290182 there's an explanation of what weirdness OSGi etc actually do

18:16 mrb_bk: anyone here have a copy of wadler's "replacing failiure" paper?

18:27 ivan: mrb_bk: http://libgen.info/view.php?id=580314 might be explaining the exact same thing, search it for "list of suc"

18:28 mrb_bk: ivan: thanks!

18:33 patbrown: has anyone had success with piggieback and nrepl.el?

18:45 If anybody has experience with piggieback for nrepl, I could really use a hand… I'm getting Uncaught Error: Undefined nameToPath for goog.async.Deferred with piggieback 0.0.4

18:50 ivan: patbrown: some closure-library jar is missing the required third_party directory and you have to find a working closure-library on clojars

18:50 Deferred is in that third_party

18:51 I bet seangrove knows which jar to use

18:56 patbrown: I'm not finding anything that looks cannonical for the third party on maven or clojars… is this it https://clojars.org/org.clojars.lypanov/google-closure-library-third-party-repackaged 0.0-1376

18:57 There is also [com.wagjo/closure-library-third-party "0.1.0-SNAPSHOT"] on clojars

19:03 frenchyp: do I have to use a macro if I want to define an anonymous function with a specific number of arguments?

19:03 jtoy: what is the equilvant clojure from this ruby: [1,2,3].select{|x| x == 2 } ?

19:03 to select certain values from a list

19:03 amalloy: (filter #{2} [1 2 3])?

19:03 frenchyp: I am trying with (defn make-fn [num-args] (fn (into [] (repeat num-args nil) (print "3 args 2"))), which doesn't work

19:03 amalloy: (filter #(= %2) [1 2 3]) if you want to stick with the lambda

19:04 jtoy: amalloy: what does % do there?

19:04 Raynes: It's the second argument.

19:04 Because he forgot a space.

19:04 amalloy: &'#(= % 2)

19:04 lazybot: ⇒ (fn* [p1__12554#] (= p1__12554# 2))

19:05 Raynes: In the real case it is the first argument. %, %2, %3 = first, second, third arg respectively, and so on.

19:05 patbrown: Frenchy, are you trying to count a seq of args?

19:05 rabbit_airstrike: I think %1 also works if you want to go the numerals route, it's just a little more consistent

19:06 jtoy: (filter #(= % 1 ) [1 2 3]) returns 1 ?

19:06 Raynes: Yes, %1 also works.

19:06 But I really hate telling people that.

19:06 rabbit_airstrike: why?

19:06 clojurebot: why is the ram gone

19:06 frenchyp: patbrown: no, I am trying to define stub functions that have a specific number of arguments and an arbitrary body

19:06 jtoy: why?

19:06 clojurebot: jtoy: because you can't handle the truth!

19:06 Raynes: Because two things that do the same thing confuse people.

19:07 &(filter #(= % 1 ) [1 2 3])

19:07 lazybot: ⇒ (1)

19:07 rabbit_airstrike: it seemed to make sense to me when I first read about anon. functions in clojure

19:07 frenchyp: patbrown: in other words, I am trying to define the argument vector of a function dynamically

19:07 rabbit_airstrike: it's just different styles for different contexts

19:08 jtoy: &(filter #(= % 2 ) [1 2 3])

19:08 lazybot: ⇒ (2)

19:08 frenchyp: actually, I was trying to show a friend that this is easy to do in clojure (he uses python), but I am stepping all over myself

19:08 jtoy: i dont understand why changing that goes to 1,2,3

19:08 Raynes: rabbit_airstrike: I concede.

19:08 rabbit_airstrike: changing what?

19:09 jtoy: it is an argument

19:09 I see I think

19:09 rabbit_airstrike: you're just filtering out those vals in the collection which pass the anonymous predicate function you're defining

19:10 where % is the argument to that function

19:10 Raynes: You're saying "Hi. I've got a sequence with the elements 1, 2, and 3 in it. I'd like you to go through each one of these elements in turn and ask them each if they are equal to this number. If they are equal to this number, keep them. Otherwise, ignore them."

19:10 rabbit_airstrike: Don't forget that %1 also works. ;)

19:10 rabbit_airstrike: poor form for only one argument ;)

19:11 you could always say (filter (fn [n] (= n 2)) my-coll) if you're feeling verbose

19:11 jtoy: can I do nested filters that use the non verbose syntax?

19:12 rabbit_airstrike: afaik you can't nest anonymous functions, which is one reason you would move toa more verbose expression

19:12 Raynes: You can't nest the shorthand version.

19:12 You can nest ##(fn [] (fn [] (fn []))) all you want of course.

19:12 lazybot: ⇒ #<sandbox8759$eval12599$fn__12600 sandbox8759$eval12599$fn__12600@14c491b>

19:12 rabbit_airstrike: if you were allowed to define those short-hand % arg functions within each other the arguments would be ambiguous

19:12 jtoy: Raynes: is it idiomatic to have one be shorthand and the other long form?

19:13 Raynes: It depends on which is clearer and whether or not you need to nest them. Shorthand versions lend themselves better to shorter anonymous functions.

19:13 illiux: I use the (fn []) form far more simply because I have my emacs set up to replace the fn with a lambda symbol >.>

19:14 Raynes: Evil.

19:18 amalloy: Raynes: #clojure's number-one source of unasked-for judgment

19:18 Raynes: lol

19:18 amalloy: maybe number two, after me

19:18 illiux: Raynes: what makes it evil?

19:19 Raynes: I guess nothing if it works for you. I just can't stand my text looking different in Emacs than it actually is.

19:19 In fact, I usually examine and edit raw bytes.

19:20 rabbit_airstrike: you mean you don't manually toggle the magnetic state on your hard drive platters?

19:20 amalloy: nobody is impressed by editing raw bytes in emacs, when http://www.gnu.org/fun/jokes/ed-msg.html is available

19:20 illiux: To me, the main reason to keep text in editor identical to text on disk is because not everyone is using the same editor. In this case though, other people will just see fn as normal

19:21 That lambda symbol is unbelievably pretty

19:21 Raynes: And also shorter than the 2 characters that make up 'fn'. What if you thought you had only 75 columns when in fact you had 76!

19:22 rabbit_airstrike: replace it with a symbol which gets kerned into the middle of two character places?

19:23 or something like that

19:23 Raynes: illiux: Give me your elisp for that.

19:23 illiux: I'll trade you some elisp for paredit in nrepl buffers.

19:24 illiux: I have paredit in nrepl buffers already :)

19:24 Raynes: I have a fancy function for toggling transparency that is about as useful as your changing fn to a lambda symbol is.

19:25 https://www.refheap.com/paste/a236cfff1b68f0cfe87f798e3 fair trade, I think.

19:26 illiux: I'll throw it up on pastebin. I'll note that I'm new to emacs (coming from vim, for nrepl in fact) and this is not my code. I haven't the faintest clue how it works

19:26 Raynes: If you give me a link to pastebin I'll come to your house and hurt you.

19:26 illiux: What's prefered?

19:27 Raynes: This really awesome guy wrote a pastebin in Clojure that people around here like to use. https://www.refheap.com

19:28 illiux: https://www.refheap.com/paste/12099

19:29 Hm, spacing got weird. Different tab width

19:29 amalloy: c'mon, Raynes, show some class: https://www.refheap.com/paste/ab28ab5c240fcad65efbcc43f

19:29 rabbit_airstrike: maybe we can feature request some tab processing for refheap

19:30 Raynes: Wow.

19:30 I wonder if codemirror caused that or pygments.

19:30 Has to be pygments.

19:30 illiux: its using a width of 4, I'm using a width of 2

19:31 rabbit_airstrike: it doesn't seem like it's just a width problem

19:31 it looks like a bunch of tabs were auto-inserted

19:31 Raynes: Can one of you open an issue about it? This is something I need to look into at some point because I totally care about people who use tabs instead of spaces.

19:32 rabbit_airstrike: huh, pasted into an emacs buffer it looks pretty normal again

19:32 amalloy: if you have tabs in your clojure source files you're a monster

19:32 illiux: I haven't gotten my emacs configuration where I wanted it. My vim config was tab expand for everything

19:33 amalloy: my clojure code is using spaces :P

19:33 amalloy: oh right, that's elisp

19:33 Raynes: Still a monster.

19:33 amalloy: (setq-default indent-tabs-mode nil) ;; maybe?

19:33 Raynes: I think so.

19:33 I have that too.

19:33 rabbit_airstrike: just tried it out. that's a sexy little lambda there

19:33 Raynes: In two places, even.

19:33 Just to make damn well sure.

19:33 amalloy: well, that's a quorum

19:34 illiux: You could probably extend it to change the # in #() to a lambda as well if you wanted

19:38 alright, no more tabs in my emacs

19:39 jtoy: can someone help me with this, I know im close, i dont know how to split the test data here: (filter (fn [pairs] (some fn [regex] ( re-find (re-pattern regex ) "random test" ))) '(("testdata",("hello" "random")) ("othertest" ("none")) ) )

19:39 im trying to get back "testdata"

19:40 rabbit_airstrike: looks like you're missing an open paren after some

19:41 jtoy: i think i need a let in there too?

19:41 frenchyp: patbrown: sorry, just saw your msg

19:41 responded

19:42 dog_cat11: hey, did they take featurec out of core.logic 0.7.5 ?

19:42 i keep getting a function not found err

19:42 hiredman: it never was in 0.7.5, I think you need to be on one of the betas

19:43 rabbit_airstrike: jtoy: I'm also not sure what you're doing with those nested forms with strings

19:43 SegFaultAX: jtoy: Try breaking the problem down into multiple steps instead of nesting it altogether. It'll be easier to debug that way.

19:43 rabbit_airstrike: they should probably be quoted if you want them to be seqs

19:43 dog_cat11: thanks

19:45 jtoy: yeah, im trying to break it down now, on another note, if i am using vim, is there a more sainer way to deal with parens hell?

19:49 technomancy: jtoy: I think paredit has been ported to vim

19:50 Raynes: It has.

19:50 SegFaultAX: It has. I also suggest installing delimitmate and rainbow parentheses.

19:50 jtoy: this is what I am trying to do: http://pastebin.com/n0abgZw0

19:51 dog_cat11: hiredman, you're right, it's in 0.8.0rc2

19:51 thank you

19:52 SegFaultAX: jtoy: What are you really trying to do?

19:52 jtoy: SegFaultAX: that is really what im trying to do

19:52 dog_cat11: i found it was easier to learn emacs then get everything working in vim

19:52 rabbit_airstrike: jtoy: how many function calls are you trying to make with (test_function ....)

19:53 SegFaultAX: jtoy: I mean explain what you're trying to accomplish.

19:53 rabbit_airstrike: it looks like you actually want to (test_function ("foo" '("regex1" "regex2"))) (test_function ...)

19:54 jtoy: rabbit_airstrike: I will be calling it approximately 200M times, so a lot

19:54 rabbit_airstrike: but maybe you want (map test_function coll1 coll2)

19:54 jtoy: SegFaultAX: I have a list of names and regexes, then for each string i want to see the name returned where it matches any of the regexes

19:55 noprompt: paredit is good stuff

19:55 takes a minute to get used to and has a few small bugs, but it's totally worth it.

19:56 jtoy: so a real name and regexs would be ('apple' ('ipod' 'iphone' 'ipad')) and that should return apple on the string "i love ipod" but not return anythign for "i love microsoft"

19:57 dog_cat11: noprompt, i just found paredit this weekend, very impressed

19:57 Raynes: noprompt: Bugs?

19:57 dog_cat11: it has handled all the corner cases that makes automatic parens hard

19:58 noprompt: Raynes: so one weird thing i noticed is with #_(…) forms

19:58 rabbit_airstrike: jtoy: maybe start from a map containing those associations

19:58 (def tech-map {"apple" '("ipod" "ipad" "iphone") "microsoft" '("surface" "windows")})

19:58 noprompt: Raynes: if it's a few lines and you decided to delete the whole block you'll end up with a dangling )

19:59 Raynes: i'm updating my repo of it now, to make sure it's still a bug. if not i should probably report it.

19:59 jtoy: rabbit_airstrike: yeah, i do have that list defined ,but i still need to go through lots of strings

20:00 amalloy: huh. i've never run into that, noprompt, but you're right. it definitely shouldn't do that

20:00 noprompt: amalloy: i just made sure i had the latest copy and it looks like the bug is still there. i'm going to open an issue.

20:02 tomoj: how better to write https://www.refheap.com/paste/85da877ec3b4d3b8cbcdc17ec ?

20:03 amalloy: oh dear. i started trying to track down the code responsible for the #_ issue and found https://www.refheap.com/paste/f1b0ac7499dfcd7bae5b0681f

20:03 noprompt: lol.

20:04 SegFaultAX: jtoy: https://www.refheap.com/paste/12102

20:05 amalloy: tomoj: i don't think there are any builtins that do this any better

20:05 rabbit_airstrike: you'll probably want to attach something to make that case-insensitive though, depending on your use case

20:06 amalloy: you could write a function like (update-vecs results [[:results] [:photos]] #(...)) that does a get-in and then mapv at each step, and that might be nicer

20:06 tomoj: :(

20:07 rabbit_airstrike: something like (?i)

20:07 noprompt: the README hasn't been updated in 43 years https://github.com/vim-scripts/paredit.vim

20:07 SegFaultAX: jtoy: Note that this actually memoizes the regex compilation so you don't have to do it over and over.

20:07 Raynes: There is a real repo for that, guys.

20:07 https://bitbucket.org/kovisoft/paredit

20:07 SegFaultAX: rabbit_airstrike: Is that to me?

20:08 rabbit_airstrike: mostly to jtoy. I assume you already knew that

20:08 SegFaultAX: rabbit_airstrike: Indeed. Cool! :)

20:08 rabbit_airstrike: he's the one who knows what strings he's got and whether case matters here

20:08 jtoy: SegFaultAX: cool, so should I create multiple test-X's or change it to pass in all the strings together? I will have about 50 different test-X's, but millions of lines to test on

20:08 SegFaultAX: jtoy: That depends. How many of these pattern groups do you have?

20:09 jtoy: If it's a small number, and you want to reuse them all over, then do that.

20:09 jtoy: SegFaultAX: I mean i have about 50 pattern groups, and then I will run this on ~50 million strings

20:09 rabbit_airstrike: I would build that map I talked about and then just map over the keys and vals

20:09 SegFaultAX: jtoy: Otherwise you can always do (let [matchers (map #(apply test-str %) pattern-groups)] ...)

20:09 jtoy: I would build the matchers in a top level var, then.

20:12 jtoy: SegFaultAX: thanks, im testing it now

20:12 SegFaultAX: jtoy: In any case, the point is you should definitely not recompile those regular expressions over and over.

20:13 noprompt: Raynes: thanks.

20:13 Hendekagon: wow, first time coding in Clojure I've wish for type checking: (partition 2.0 (range 16))

20:14 my code was like: (partition (partition-size n) things) - partition-size was returning a number, not a long - partition needs a long

20:14 amalloy: tomoj: something like https://www.refheap.com/paste/de2f8779657c74cf18efb4402 ?

20:15 tomoj: sure

20:22 noprompt: alright i let the maintainer know about the issue.

20:24 jtoy: silly question again, waht is wrong with this: (map re-pattern ['ipod' 'ipad'])

20:24 noprompt: jtoy: umm, you should be using double quotes

20:25 ivan: ,(type 'ipod')

20:25 jtoy: noprompt: oh, I didnt know that is required

20:25 clojurebot: clojure.lang.Symbol

20:25 noprompt: jtoy: yes, strings must always be in double quotes.

20:25 jtoy: ivan: that doesnt even work for me

20:26 (type 'ipod') ?

20:26 ivan: of course it works, you see clojurebot evaling it

20:27 I was just pointing out that it's a Symbol

20:27 jtoy: ivan: why cant i type that thouh?

20:27 noprompt: jtoy: because 'iPod' is a symbol followed by a quote

20:28 ,(list 'ipod')

20:28 clojurebot: (ipod')

20:28 noprompt: see how i get back a symbol and a quote?

20:28 ,(list "ipod")

20:28 clojurebot: ("ipod")

20:30 noprompt: jtoy: clojure isn't like ruby or python where strings can be wrapped in either double or single quotes. it's strictly double.

20:32 jtoy: does that help you?

20:32 jtoy: noprompt: yes

20:32 noprompt: cool :)

20:32 gfredericks: 'ipod' uses the single quote in two different ways

20:33 jtoy: noprompt: imstill nto sure why you can type (type 'ipod') though and I cant,

20:33 ivan: jtoy: what error do you get?

20:33 jtoy: but i see that it is a symbol with a single quote at the end

20:33 gfredericks: single quotes in symbols weren't allowed until 1.3 or so

20:33 so if you're on an old clojure...

20:34 noprompt: oh, wow. i wasn't aware you could do that. that clears up a little confusion.

20:34 ,(type 'don't)

20:34 clojurebot: clojure.lang.Symbol

20:35 noprompt: ,(name 'ipod')

20:35 clojurebot: "ipod'"

20:35 gfredericks: ,+'

20:35 clojurebot: #<core$_PLUS__SINGLEQUOTE_ clojure.core$_PLUS__SINGLEQUOTE_@167d998>

20:35 gfredericks: ,(doc +')

20:35 clojurebot: "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Supports arbitrary precision. See also: +"

20:36 noprompt: that's pretty sweet. i had no idea you could do the whole prime bit ala haskell.

20:37 gfredericks: ,'k'..''.''''.'.'

20:37 clojurebot: k'..''.''''.'.'

20:38 ivan: best Clojure features: - in symbols, optional commas

20:39 gfredericks: 3rd and 4th are being a lisp and immutable data structures

20:39 noprompt: ivan: +1 for commas as whitespace

20:39 craigbro: technomancy: so, ever here of lein uberjar or other build step just locking up on very large (12 core) systems?

20:39 s/here/hear

20:39 if we kill it, and then run it again, it works

20:39 noprompt: lynaghk: have you done anymore work with angularjs and cljs?

20:40 ivan: craigbro: do you have a high-memory system running centos?

20:40 craigbro: high mem running arch

20:40 jtoy: (type 'ipod')

20:40 java.lang.Exception: Unmatched delimiter: )

20:40 hiredman: lein deps would sometimes cause my vm to spin real hard, but that was with lein 1

20:41 craigbro: unfotunately, I'm about to eat my own leg I'm so hungry, and I can't get more info from our ops guy who discovered this

20:41 ivan: craigbro: http://bugs.centos.org/view.php?id=5716 if it locks up for 5 minutes and not forever, it might be the page defragger

20:41 craigbro: it consumed 1h+ of cpu time 8)

20:42 ivan: attach a jvisualvm

20:42 noprompt: jtoy: which version are you using? *clojure-version*

20:42 craigbro: ivan: later, I gotta eat first, thanks 8)

21:14 dog_cat11: has anyone used core.logic to select data out of large arrays?

21:14 like 25,500 lines w/ 20 entries per line of roughly 20 char text?

21:28 gfredericks: (doc binding)

21:28 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."

21:32 thm_prover: what editor (implemented in java) code base is a googd foundation for writing a scriptable editor in clojure?

22:19 Hendekagon: thm_prover: you mean code editor ? Maybe clooj or Catnip ? (both written in Clojure)

22:25 thm_prover: Hendekagon: never heard of Catnip. Investigating now.

22:28 Hendekagon: thm_prover: I'm not aware of any written in Java, apart from the big ones like Eclipse & Idea. Catnip is actually Clojurescript I think

22:29 thm_prover: and at some point I guess lighttable will support plugins, but it's early days with that and there's no source code

22:30 thm_prover: I would go with clooj for the desktop, or Catnip for browser-based. I'm writing something for catnip (maybe)

22:31 thm_prover: Hendekagon: I was previously considering wrapping JEdit in Clojure; but catnip looks intereting.

22:32 Hendekagon: thm_prover: oh yeh! forgot about JEdit. wrapping? why ? JEdit has a good plugin system

22:33 thm_prover: catnip, like all these browser-based editors, uses codemirror for the actual editor, which is javascript

22:34 thm_prover: ICK

22:34 I have codemirror.

22:34 s/have/hate/

22:34 played with Codemirror in clojurecript; was not pelasant experience

22:35 ibdknox: what's wrong with codemirror?

22:35 thm_prover: I lack the intelligent to script it.

22:35 Nothing wrong with codemirror; mainly my IQ is only 2 digits.

22:36 ibdknox: have you ever given thought to the fact that if Lighttable is used by 100,000 people; then every 5 minute you waste on IRC is equiv to killing half a million minutes of programmer productivity? :-)

22:36 ibdknox: haha

22:37 I only look when it pings me about certain terms :)

22:37 thm_prover: is lighttable still a single person operation?

22:38 ibdknox: I've always had a co-founder, but still just one many coding. Hoping to change that soon :)

22:38 man*

22:58 mercwithamouth: hi, could someone tell me the preferred framework for creating guis?

22:58 gfredericks: clojurescript? :)

23:00 mercwithamouth: gfredericks: continue... =) I'll admit i wanted to use scala since i'm more familiar than that but as far as i know swing is as good as it gets. i DO like light tables interface, not that i want to duplicate it. but they're definitely not using swing

23:01 gfredericks: I was just pointing out that most GUIs are browser-based these days. so clojurescript lets you do that.

23:01 I don't know much about the JVM stuff. I do think there's a wrapper for swing.

23:02 leku: light table using chromium

23:02 ibdknox: seesaw is the swing wrapper: https://github.com/daveray/seesaw

23:02 mercwithamouth: leku: chromium?

23:03 ibdknox: if you have experience with web stuff, then CLJS is a reasonable way to go :)

23:03 leku: the google chrome thing

23:03 ibdknox: mercwithamouth: yeah, we use a wrapped chromium via https://github.com/rogerwang/node-webkit

23:03 mercwithamouth: ibdknox: i do but i was looking to take a break from web development. ok that's just interesting

23:03 ibdknox: all of Light Table is HTML/CSS/CLJS

23:04 mercwithamouth: ibdknox: ...nice!

23:04 ibdknox: that's really interesting.

23:04 leku: hah

23:05 nice irc nets

23:05 knox is this the first application being built on chromium besides chrome?

23:05 or rockmelt

23:05 ibdknox: no, there are some others - CEF the Chromium Embedded Framework is how people used to do it

23:06 leku: k

23:06 ibdknox: it is.. difficult to work with

23:06 leku: ah damn

23:06 ibdknox: node-webkit is great though

23:06 it's a much nicer approach

23:07 leku: so is this going to have to be a client side app or can tyou move this into the web completely eventually?

23:07 thm_prover: ibdknox: wait, what? is lighttable written in CLJS or CLJ ?

23:07 ibdknox: cljs

23:08 leku: it's possible for us to move it to the web, though there are some serious disadvantages to doing so

23:08 thm_prover: I've played with CLJS and the Google Closure library. What does Chromium buy you?

23:08 ibdknox: a container?

23:08 thm_prover: can you manipulate dom trees in CLJ ? if not how is it useful?

23:08 how is Chromium different from CLJS running insdie of a web browser??

23:08 lazybot: thm_prover: Uh, no. Why would you even ask?

23:09 ibdknox: it doesn't have all the browsery stuff

23:09 think of it is an application frame

23:09 thm_prover: so it's basically a "raw DOM tree" frame ?

23:09 ibdknox: yep

23:09 plus v8

23:09 mercwithamouth: very cool...

23:09 thm_prover: if I had taht, but could manipulate it in CLJ rather than CLJS, I'd be happy

23:10 I still can't stand debugging CLJS

23:10 ibdknox: mm

23:10 thm_prover: I would rather write CLJ code with a pinky removed than write CLJs code

23:10 ibdknox: dnolen is working on it with sourcemaps :)

Logging service provided by n01se.net