#clojure logs

2013-03-04

00:05lekuraynes: after I get that data back, how can I start working with it?
00:05lekusay for example I just wanted to print the value of "name"
00:07RaynesWhat 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"))
00:09lekuah cool
00:09lekuhow do you pull stuff that is nested out?
00:15Raynesleku: Yep.
00:16RaynesJust replace the get with (get-in ["nested" "in" "here" "wow" "this" "is" "deep"])
00:16lekutried get "timeSeries/sourceInfo/siteName"
00:16lekusweet
00:16tomojI thought you had to do :as :json
00:16tomojdoes :accept imply :as?
00:16lekuhm
00:17tomojdon't think so
00:17cliftonAccept is a header on the request, but the server can respond with any format it wants
00:23lekucan I limit how many values are returned?
00:23lekuby get-in
00:23lekulike "limit 10"
00:24lekuhttps://www.refheap.com/paste/12070
00:47tomojleku: use {:accept :json :as :json} to allow removing "parse-string"
00:48tomojand get-in doesn't work that way
00:48tomojyou can't traverse the timeSeries vector inside get-in
00:49tomoj(get-in and friends are less powerful than lenses)
00:49tomojwell
00:49tomojif you only want a single element of the vector, and you know its index, you can do that
00:49lekuok
00:49tomoj(get-in "value" "timeSeries" 0 "sourceInfo")
00:50tomojfor the first one
00:50lekui see
00:50tomojbut get-in can't Traverse
00:51tomojer, and, uh, I meant (get-in ["value" "timeSeries" 0 "sourceInfo"])
00:51lekuyeah
00:51lekufigurd that out
00:52lekusweet finally got at siteName
00:52lekuwhat did you mean by the first statement you made, "allow removing parse-string"?
00:54lekuhow come I can't just do a nested get-in?
00:54leku(get-in ["value" "timeSeries" (get-in ["sourceInfo" "siteName"])
00:54leku)
00:55tomojI mean, if you put :as :json, you won't have to parse-string because clj-http will do it for you
00:55lekuoh
00:56tomojyou can do something like (-> ... (get-in ["value" "timeSeries"]) (->> (map #(get-in % ["sourceInfo" "siteName"]))))
00:56tomojdunno what you want exactly
00:56RaynesUgh.
00:57tomojit should be (get-in ["value" "timeSeries" map "sourceInfo" "siteName"]) :(
00:57tomojno, not that
00:57lekuyeah
00:57lekudidntw ork
00:58tomojthat was hypothetical
00:59lekugotcha
00:59lekuthanks for the help
00:59lekuwhat do the -> and ->> mean?
00:59tomojmaybe *(into [] (reducer-in body ["value" "timeSeries" r/map "sourceInfo" "siteName"])) -- "*" means hypothetical
01:00tomoj(macroexpand (-> foo (get-in ["foo" "bar"]) (get-in ["bar" "baz"])))
01:01tomojhmm
01:02tomojI thought there was a nice macroexpanding bot
01:03terom, (macroexpand (-> foo (get-in ["foo" "bar"]) (get-in ["bar" "baz"])))
01:04terom&(macroexpand (-> foo (get-in ["foo" "bar"]) (get-in ["bar" "baz"])))
01:04lazybotjava.lang.RuntimeException: Unable to resolve symbol: foo in this context
01:05lekuseems to me that this stuff was easier when I was working with Perl and Data::Dumper
01:05Iceland_jack&(macroexpand '(-> foo (get-in ["foo" "bar"]) (get-in ["bar" "baz"])))
01:05lazybot⇒ (get-in (clojure.core/-> foo (get-in ["foo" "bar"])) ["bar" "baz"])
01:05clojureboteval service is offline
01:06teromanyway, -> and ->> are threading macros, they "thread" their argument through the function calls
01:06lekuand whats the diff between the two?
01:06lekucan I do -> ->> ->>>?
01:06terom-> puts the argument at first position, ->> at the last position
01:07amalloydream bigger, leku! write the ->>>>>> macro!
01:07lekuahah
01:07tomoj&(clojure.walk/macroexpand-all '(-> foo (get-in ["foo" "bar"]) (get-in ["bar" "baz"])))
01:07lazybot⇒ (get-in (get-in foo ["foo" "bar"]) ["bar" "baz"])
01:07tomoj&(clojure.walk/macroexpand-all '(->> foo (get-in ["foo" "bar"]) (get-in ["bar" "baz"])))
01:07lazybot⇒ (get-in ["bar" "baz"] (get-in ["foo" "bar"] foo))
01:07lekubrb
01:31lekuok have another question for you
01:32lekuhttps://www.refheap.com/paste/12071
01:33lekuhow would I take that data and find the average from the value, etc "32.7"
01:33lekuand also show the min/max?
01:37lekuhmm
01:37lekuwould be cool to plot this data with function-plot
01:38lekuand incanter
01:39lekuor just jfreechart I guess
01:43alex_baranoskydoes anyone have a nice example of when/why to use as-> … I'm still grokking its usefulness
01:49amalloy(-> blobs (get-in [a b c]) (as-> things (for [x things :when (even? x)] (inc x))))?
02:01dhklalex_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.
02:03alex_baranoskyamalloy: I see, so I can avoid writing: (-> blobs (get-in [a b c]) (#(for [x % :when (even? x)] (inc x))))
02:04amalloyindeed
02:04alex_baranoskydhkl: I think you're referring to the -> macro? I was referring to the as-> macro
02:04dhklalex_baranosky: sorry, misread your question :-)
02:08tomojas-> can also replace any repeated let
02:08tomojI was going to say like the source of defn, but not really
03:59tekkkwhy isn't my (def a 1) public?
03:59tekkkcan't access it from another namespace
04:03clgvtekkk: it is public. you probably do not access it right. post a code snipet on e.g. refheap.com
04:04tekkkclgv: I'm using light table perhaps its not requiring it correctly
04:05tekkk(dir dev.util) gives me all functions only
04:05clgvtekkk: you have to require it correctly ;)
04:06tekkk(ns dev.main
04:06tekkk (:require [clojure.repl :as repl]
04:06tekkk [dev.util :as util]))
04:06clgve.g. (ns my.other.ns (:require [my.first.ns :as fns])) fns/a
04:06clgvutil/a then
04:07tekkkerror: No such var
04:07tekkknvm … must be a light table error
04:07tekkkno probs with the functions
04:19clgvtekkk: 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
04:44clgvapropos lighttable it maps "{" to "[" which is pretty weird in a clojure IDE ...
07:42mpfundsteini have a question about avoid state
07:42mpfundsteinlets say i write an app which has a queue of jobs. On this queue jobs can get pushed, popped or reordered
07:43mpfundsteinhow would you do that without state? the queue must somehow be a global object of state
08:44TimMcmpfundstein: You could use a list in an atom.
08:44TimMcIt's still state, but it can be managed that way.
08:44mpfundsteinTimMc: yes thats what i thought
08:45mpfundsteinand swap! to propagade add remove re-order
08:45TimMcI'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.
08:46mpfundsteini will check into that
08:46mpfundsteinthanks
08:47mpfundsteinTimMc: do you know if there is a way to save definitions from REPL to a file?
08:48TimMcHmm, not sure.
08:48TimMcCopy them out of your REPL history file? :-P
08:49mpfundsteinyeah i thought maybe i can somehow print a functions source code
08:49mpfundsteinand save it to a file
08:50Anderkentfind all symbols in ns, call (:source (meta (var sym)) on them, print to file?
08:51Anderkentthen write a lein plugin to do that easily!
08:51Anderkent:P
08:51mpfundstein:0) lets try
08:52TimMcAnderkent: I don't recall :source being a metadata key.
08:52AnderkentIt's there for me on function definitions, using reply and clojure 1.4
08:54Anderkenthttps://www.refheap.com/paste/12082 - seems to lose newline info (that's probably the repl merging lines)
08:55mpfundsteinAnderkent: without the new line info and white spaces is a bit sad :(
09:00octe_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"}}
09:00octe_what's a good way to that?
09:02cmdrdatsocte_: you could just (into {} (map (juxt :id identity) list))
09:02cmdrdats?
09:03octe_thanks :)
09:03clgvzipmap^^
09:03cmdrdatsfoo, i always forget about zipmap
09:03clgv(zipmap (map :id coll) coll
09:04octe_or taht
09:04clgv&(let [coll [{:id 1 :name "foo" :title "bar"} {:id 2 :name "test" :title "bleh"}] (zipmap (map :id coll) coll))
09:04lazybotjava.lang.RuntimeException: Unmatched delimiter: )
09:04clgv&(let [coll [{:id 1 :name "foo" :title "bar"} {:id 2 :name "test" :title "bleh"}]] (zipmap (map :id coll) coll))
09:04lazybot⇒ {2 {:name "test", :title "bleh", :id 2}, 1 {:name "foo", :title "bar", :id 1}}
09:05octe_i like that one better
09:05cmdrdatsocte_: ye, zipmap is much cleaner :)
09:48ayiaHi 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"...
09:49clgvayia: yes. and it occurs in the classname
09:49hashbang1ayia: yes
09:49ayiaclgv: hashbang1: thanks guys!
09:50jweissCompilerException 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.
09:55jweissseems 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...
09:56AnderkentI think you might be refering to wrong symbols, or the protocol is being compiled more than once and you have a stale reference
09:58Anderkentalso I'm not sure if protocols support rest args.
09:58Pupnik-dang clojure programming is twice as long as programming clojure
09:58jweissAnderkent: i'm pretty sure it does, because this protocol is working just fine elsewhere
09:58jweissi think what does support varargs is the extend-protocol and extend-type macros.
09:59jweissthe underlying functions appear to support them just fine.
09:59jweisssorry i meant what *doesn't* support varargs
09:59jweissi 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:00jweissand there's no clojure.core/update for my protocol to interfere with
10:00Anderkentjweiss: I tried it in repl and varargs don't work
10:00Anderkentthe & is interpreted as argument name
10:01Anderkentcan't find documentation for it though...
10:01dnolenjweiss: protocol fns don't support var args.
10:01Anderkenthttps://www.refheap.com/paste/12083
10:01jweissAnderkent: it works if you use extend
10:01AnderkentI 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:01jweissso you can pass a map of keywords to functions as an impl.
10:02znDuffAnderkent: *shrug*. There are performance reasons to prefer them over multimethods when the semantics are workable.
10:02jweissAnderkent: you'd recommend multimethods instead? those are kind of difficult too
10:02jweissanyway, i'm pretty sure the protocol can declare varargs
10:02dnolenjweiss: that ony works because extend w/ a map allows you to pass regular fns
10:03jweissdnolen: ok so that's what i'm using
10:03dnolenbut protocol fns absolute do not support var args
10:03jweisshm so i am not sure why it worked for me
10:03dnolenif it's working you're getting lucky - there's no support for it.
10:04AnderkentznDuff: 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:04clgvjweiss: "&" in a protocol argument list is just an argument name. I dont know why there is no compiler warning or error, yet...
10:05jweissweird i am not sure how this worked for me before
10:05clgvmaybe you passed a map along and used that map in the implementation
10:06jweissoh... [x f & args] and I was calling it with (update x assoc :foo :bar)
10:06jweissarity matches
10:06jweisswell that blows
10:08jweissi 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:09dnolenjweiss: or provide an api of fns that users actually use
10:09dnolenjweiss: and real fns dispatch to protocol fns
10:10jweissdnolen: oh yeah that would be easier, wouldn't it :)
10:11jweissi'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:15mrb_bkgood morning #clojure
10:25dcolishclojure-doc is awesome, no sure why it took me so long to find it
10:25dcolish*not
11:01jweissis 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:04jweiss(ns-unmap *ns* 'Package) seems to do it.. ugly though.
11:04mybuddymichaeljweiss: Now I'm curious why you want to do that.
11:05mybuddymichaelAh, nevermind.
11:05jweissmybuddymichael: because i want a domain specific record called Package.
11:05Anderkentyeah 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:06jweissi have no idea what java.lang.Package is... /me looks out of curiosity
11:07Anderkentit's runtime info about a package afaik
11:07jweisshuh, interesting didn't even realize there was a class for that. can't recall using it
11:08jweissi mean, i would have expected that class to exist, just didn't occur to me it'd be in java.lang
11:08edoloughlinAnyone 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:10clgvjweiss: I'd consider that a bug. since the symbol representing the protocol name should not be resolved, should it?
11:10jweissclgv: protocol?
11:10clgvoh record in your case
11:10jweissyou can create records without involving a protocol (which is all i have at this point)
11:10clgvbut it should be the same
11:11clgvsince the generated class is your.ns.Package and not java.lang.Package
11:11jweissclgv: 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:12clgvjweiss: I would report it on jira or ask on the ML
11:12jweissclgv: or at the very least (defrecord user/Package ...) should work. but it doesn't.
11:13clgvedoloughlin: seems those did not survive the 1.5.0 release
11:14jweiss1.5 is released?
11:14clgvedoloughlin: ah they messed up the folder name
11:14clgvyes
11:14jweissah yes i see the ANN in the mailing list now
11:15jweisskind of sucks that no webpage gets updated for events like this
11:15jweissclojure.org is almost completely static
11:16clgvjweiss: http://clojure.org/downloads got updated though. but you dont see it on clojure.org landing page
11:17jweissclgv: yeah, i see that now. i meant something like "March 1 2013: Clojure 1.5 is released [link: release notes]"
11:17clgvedoloughlin: they forgot the index.html in clojure 1.4.0 documentation
11:18mpfundsteincan anyone help me on that? https://gist.github.com/anonymous/5083422
11:19mpfundsteini dont understand why DateFormat throws
11:20Anderkentyour format doesnt seem to match the input (four : separated sections in the input string, three in the format)
11:20mpfundsteinbut this works
11:20mpfundstein(println (parse-date-str "03/01/2013 00:00:22:12" "MM/dd/yyyy HH:mm:ss"))
11:20mpfundsteinthis works perfects
11:23mpfundsteini 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:23Anderkentwhat does extract-time-jp-str look like?
11:23Anderkentit might be giving you an object that looks like a string when printed out, but is not a string
11:24mpfundsteinAnderkent: https://gist.github.com/anonymous/5083467
11:27Anderkenthm. It seems to work for me with x = ["03/01/2013 00:00:22:12" "03/01/2013 00:00:22:12"]
11:28Anderkenti.e. I don't get that exception
11:29mpfundsteinx
11:29mpfundsteinmom
11:29mpfundstein( "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:29mpfundsteinthis is x :-)
11:30mpfundsteinhmm
11:31mpfundsteinonlye the first of the data source is the problem
11:31Anderkentthat 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:32Wild_Catwhat's with the 4-part times?
11:32Anderkentonly way I can reproduce your exception is by removing the format argument to parse-date-str (as expected)
11:32mpfundsteinAnderkent: ok mom, ill provide more accurate
11:34mpfundsteinhttps://gist.github.com/anonymous/09ebf3b69ecd608b5c6e
11:34mpfundsteinthis is the datasource
11:34mpfundsteini slurp it
11:34mpfundstein(in repl)
11:34mpfundsteinthan (def x (seq slurped))
11:35mpfundsteinthan the code above
11:36Anderkenti.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:37mpfundsteinyeah i told you wrong sry (i am a bit tired now after 8 hours :-) )
11:37mpfundstein(def x (clojure.string/split (slurp "justoutinput.txt") #"\r\n")))
11:37mpfundsteingives me a vector of strings
11:39mpfundsteinAnderkent: https://gist.github.com/anonymous/95d162ffe6b5798c4974
11:42Anderkentmpfundstein: 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:42jcromartiehow do I design a web app that uses refs to coordinate state so that it is testable?
11:42jcromartieshould I make those refs dynamic and just rebind them in a fixture?
11:43mpfundsteinAnderkent: yeah i just loaded a new repl
11:43mpfundsteinAnderkent: (map #(parse-date-str (extract-time-jp-str %) "MM/dd/yyyy HH:mm:ss") x)
11:43Anderkentno luck?
11:43mpfundsteinsame problem
11:43Anderkenthttps://www.refheap.com/paste/12087
11:43mpfundsteini tried with map
11:43mpfundsteinsame problem
11:44mpfundsteinf***
11:44mpfundsteini dont get it
11:44mpfundstein:-)
11:44mpfundsteinare you using lein repl ?
11:44Anderkentwell 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:44Anderkentyes
11:44Anderkentclojure 1.4 / java7
11:44mpfundsteini have java 8
11:44lekujava 9000 here
11:45mpfundstein(dev edition leku)
11:45lekui'm using spartan edition :)
11:45mpfundsteinjava version "1.8.0-ea"
11:45mpfundsteinmaybe thats the problem
11:45mpfundsteinhm
11:46Anderkentunlikely if you say it works when invoked directly :S
11:47mpfundsteinAnderkent: lol
11:47mpfundsteinAnderkent: it worked
11:48seangroveAnyone 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:48mpfundsteinAnderkent: i copied the input file in a new sublime document saved that and opened that as x
11:48mpfundsteinAnderkent: now it works
11:48seangroveThey're pretty disconnected from the structure of the input data or (to a lesser extent) the output data
11:49seangroveWondering if there's some DSL or library (in any language) people are aware of
11:49mpfundsteinAnderkent: had probably sometihng to do with the windows line endings
12:55lekuhow do I update lein2 so that it wants clojure 1.5.0 by default?
12:56lekuor that it uses 1.5.0 in the project.clj by default
12:56technomancyleku: it uses 1.5 for new projects on master; you can run from git or wait for the next release
12:56lekuthanks
13:22jcromartieI want to use an agent to serialize (in the concurrency sense) file access
13:23jcromartiedo I really need any particular value in the agent? any reason not to just use (agent nil)
13:23jcromartieit seems kind of, fishy...
13:25Apage43i'd expect you'd make the file the value of the agent
13:25Apage43it should probably enclose whatever you're serializing access to
13:25technomancyjcromartie: agents imply an identity that changes over time; it communicates the wrong thing to a reader. look into executors.
13:26jcromartieexecutors, huh
13:28Apage43mayhaps it would be good for someone to wrap up more of the java.util.concurrent stuff to encourage its use
13:28technomancytypically 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:28technomancyclojurebot: java.util.concurrent?
13:28clojurebotjava.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:29Apage43hm
13:29Apage43makes sense
13:29craigbrohehe
13:29technomancythough you do miss out on stuff like docstrings and arglists metadata
13:29Apage43there's a couple java things I just always import and use bare
13:29Apage43like JSoup
13:29jcromartieso, this is good stuff
13:29jcromartiehad no idea
13:35jcromartiewhy don't I see (NREPL) output from threads created by Executors, but I see output from threads when using future or pmap
13:36Apage43future captures bindings
13:36Apage43I suppose pmap does the same
13:36jcromartiehm
13:37Apage43you can use bound-fn to do similar
13:38jcromartiebeautiful
13:38jcromartiethanks!
13:39jcromartiemaybe that means I can fix up Compojure handlers to print stdout to the NREPL
13:42jcromartiehot diggity damn
14:20mpenetApage43: there are a couple of lib that wraps Executors from clojure already: knit and pallet has one too (pallet-threads I think)
14:21Apage43I've used overtone's at-at for things it fits in. Knit looks nice though, I'll probably use that too.
14:23hugodhttps://github.com/pallet/pallet-thread
14:29cemerickApage43: crap, and here I was going to put out a library called AT-AT! :-|
14:30cemerickI s'pose AT-ST will do :-P
14:30yogthoscemerick: have a question if you got a minute :P
14:30Apage43ha :)
14:31cemerickyogthos: shoot
14:32yogthoscemerick: 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:32cemerickI don't really, but we'll see how it goes :-)
14:32yogthoscemerick: is using the session the right thing to do in this scenario?
14:33yogthoscemerick: and should redirection rules even care about this, feels to me like it's a separate problem
14:33yogthoscemerick: but wanted to get a second opinion before I reply
14:33cemerickyogthos: 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:34cemerickFriend does the former.
14:34yogthoscemerick: so maybe I should just tell him to use friend since his needs are non-trivial :P
14:34cemerickI know nothing about noir though, so use salt apprioriately.
14:34yogthoscemerick: my redirection rules are very basic, and intentionally so
14:35yogthoscemerick: no point reimplementing friend in noir after all
14:36cemerickit sounds like he's aiming to implement more general authorization on top of restricted
14:36yogthosyup
14:36cemerickI can't tell atm if that's a good idea or not :-)
14:38yogthoscemerick: if I could find an intuitive way to do it would be nice, but nothing comes to mind
14:38cemerickyogthos: you may want to point him to friend. If all he's after is authn/authz, then that should set him up.
14:38yogthoscemerick: do you have an example kicking around of how friend does it, I could just link to that :)
14:38cemerickIf he's trying to do something more sophisticated, then...I may return him to you ;-)
14:39yogthoscemerick: lol or he can just roll his own :P
14:39cemerickyogthos: the two fns starting here: https://github.com/cemerick/friend/blob/master/src/cemerick/friend.clj#L142
14:39cemerickit's not hard
14:40yogthoscemerick: awesome
14:40yogthoscemerick: 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:10jjjddd0Hi all, what is the recommended lein template for web projects ?
15:10jjjddd0I heard that Noir is no longer supported
15:10Raynes$google clojure luminus
15:10lazybot[Luminus: a web framework for Clojure] http://yogthos.net/blog/35
15:11edtsechhttp://www.luminusweb.net/
15:11jjjddd0thanks guys
15:11jjjddd0helpful as always
15:11Raynesyogthos: Man, that website is really nice.
15:12RaynesI think I told you this once before, but again, bravo.
15:18jjjddd0just FYI, luminus project setup is acting weird with Lein, and counterclockwise
15:18amalloyjjjddd0: why say "FYI" and then not provide any information?
15:18jjjddd0I get a lot of Could not find artifact luminus:lein-template:pom:0.4.6 in central when running lein new luminus
15:18mrb_bk100 people signed up for confo! wow!
15:19jjjddd0amalloy: what else would you want ?
15:25edtsechjjjddd0: I checked on lein 2.0 it worked for me.
15:26cmajor7question 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:28cmajor7e.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:36hlprmnkyI 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:37rabbit_airstrikeI'm reading through some of the blog posts trying to understand how this might be answered
15:37hlprmnkySo it would make sense that the products or r/map are "customized" for that framework instead of core/map maps
15:37rabbit_airstrikethis 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:38rabbit_airstrikealthough I don't quite see how partition couldn't be applied to the output of the reducers map
15:39cmajor7well partition is expecting a seq, but gets a reducible instead (e.g. unrealized reciepe)
15:39rabbit_airstrikeright
15:39znDuffGiven 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:40rabbit_airstrikecould you apply seq to your reducible coll to make it seqable?
15:40cmajor7I don't think you can
15:40cmajor7you should use a "reducer" to "realize" it
15:40amalloy@#'clojure.data.xml/pull-seq
15:40cmajor7that reifies the core reducer protocol
15:41rabbit_airstrikehmm
15:41cmajor7to transform the "map" function with another "reduce" one
15:42cmajor7e.g. (f result (f input))
15:42cmajor7I do understand what it is.. I just don't seem to convince my brain "why" it is :)
15:43cmajor7these r/map, r/filter, r/mapcat all return recipes rather than seqs
15:43cmajor7hence it seems the only usage for them is in the context of those "cooks" that "do by the recipe" e.g. reducers
15:44cmajor7however 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:45cmajor7(e.g. without temp allocations, sequentiality, etc..)
15:45cmajor7and that "the same" part I can't seem to understand
15:46rabbit_airstrikeright
15:47hiredmanhttp://dev.clojure.org/jira/browse/CLJ-991
15:50cmajor7@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:50cmajor7e.g. (f input)
16:03jtoyhi all, im back :)
16:12mpfundsteinis some up for feedback ? http://ideone.com/3AmB2f
16:12mpfundsteinmaybe theres a more elegant way
16:13amalloy(def x (frequencies temp-list))
16:13marcellu`map first group-by identity
16:14hiredman(apply merge-with + (map (fn [x] {x 1}) ...))
16:14marcellu`oh, yeah, frequencies does it
16:14znDuffmpfundstein: No need for an atom there -- my first instinct would be a reducer, but there are obviously other ways. :)
16:14marcellu`totially misunderstood what you were going for
16:14mpfundsteinznDuff: yeah i thought about a reducer too , maybe ill try it again
16:15alandipertmpfundstein: nice! check out http://blog.fogus.me/2011/03/09/recursion-is-a-low-level-operation/
16:15mpfundsteinfrequencies
16:15znDuffmpfundstein: Are you doing this for the exercise, or as part of a larger task?
16:15mpfundsteinznDuff: exercise actually
16:15mpfundsteinznDuff: i am playing with clojure since saturday
16:15mpfundsteinznDuff: and i begin to love it
16:16znDufffrequencies is a reducer, as it happens.
16:16mpfundsteinznDuff: didnt heard that
16:16mpfundsteinznDuff: ill check frequencies
16:16mpfundsteinlol
16:16mpfundsteinfrequencies producies exactly the same outcome as my function :D
16:16mpfundsteingrrr
16:16mpfundstein:D
16:17amalloympfundstein: if frequencies didn't exist, though, you'd want to rewrite that as a reduce instead of doseq with an atom
16:17znDuff...and frequencies looks to be about as fast as possible while staying idiomatic Clojure, given its use of transients
16:17mpfundsteinamalloy: ok, ill leave that as an exercise to me
16:18znDuffmpfundstein: expand the "source" listing at http://clojuredocs.org/clojure_core/clojure.core/frequencies, if you haven't dug into it elsewhere.
16:18mpfundsteinznDuff: i already did (source frequencies)
16:18mpfundsteinznDuff: lots of stuff to google now
16:18znDuff*nod*.
16:34milanjHi
16:34milanjis there a way to exclude some .jars from lein uberjar that I'm not directly depending in project.clj ?
16:35llasrammilanj: profiles
16:35llasrammilanj: What's the details of the dependencies in question?
16:36milanjhow do you mean "details" ?
16:36milanjI dont have those projects in my project.clj
16:36milanjit's deeper in deps tree ...
16:36znDuffmilanj: Do you know which direct dependency is including them?
16:36llasrammilanj: 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:37znDuffmilanj: You can add an exclude list to the direct dependency, but you have to know which one.
16:37milanjthere is conflict with slf4j that hadoop is using
16:37milanjand some libs that I depend on
16:37milanjnot sure though if just removing it from jar could solve this
16:38milanj*and some libs -> (slf4j that some of projects that I depend on)
16:38llasrammilanj: Ah! Check out the leiningen `provided` profile
16:38znDuffmilanj: search for :exclusions in https://github.com/technomancy/leiningen/blob/master/sample.project.clj
16:38jcrossley3milanj: something like this: [your-lib "1.0.0-SNAPSHOT" :exclusions [slf4j]]
16:39llasramI think milanj actually wants `provided` dependencies. They need slf4j -- just ultimately want the uberjar not to include it, because is provided by Hadoop
16:39jcrossley3oh :)
16:39llasrammilanj: Any dependencies specified in the `provided` profile will be handled normally except that they won't be included in uberjars
16:40milanjllasram, yes, that is what I want
16:40llasrammilanj: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#framework-uberjars
16:41milanjllasram, thanks
16:42llasramnp!
16:53yogthosRaynes: 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:56brehauthuh, that theme is different to what i remember
16:57milanjllasram, looks like I can only exclude libs that I provide
16:57milanjI can't exclude some .jar from uberjar that some of libs that I depends on depends
16:57SegFaultAXTheme for what?
16:58milanjso, If I depend on jar A that depends on jar B -> I cant exclude jar B from my uberjar ?
16:58SegFaultAXmilanj: Wouldn't that defeat the purpose of an uberjar?
16:58milanjwell, I think that something like this you can do in maven
16:59SegFaultAXmilanj: But the point is to make a completely self-contained jar. Failing to include some number of dependencies defeats that, no?
16:59llasrammilanj: Listing the dependency in the `provided` profile should get it marked as provided
17:00llasramSegFaultAX: It's for frameworks like Hadoop which expect to provide a bunch of dependencies themselves at runtime
17:00SegFaultAXllasram: Oh I see.
17:00milanjexactly
17:00SegFaultAXI didn't understand the usecase. Thanks.
17:08milanjllasram, should I put this in my project.clj ?
17:08milanjI mean, I tried it and it's now working
17:08milanjs/now/not
17:26jtoynewb question,how do I test a seq out? this doesnt work (12312,1312)
17:26jtoyjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IF
17:27technomancyjtoy: what would you expect it to do?
17:27jtoytechnomancy: print out the same thing like if i just typed in 123
17:27technomancyso you want to prevent it from evaluating as a function call?
17:27jtoythen the next thing I woudl do is (type (123)), but that doent work either
17:28rabbit_airstrike'(12312, 1312)
17:29jtoyok, im "relearning" clojure
17:29rabbit_airstrikesorry, didn't mean to throw a wrench in the socratic method there
17:29technomancyhehe
17:30jtoytechnomancy: i dont remember a lot of the basics, so i cant even answer that question....
17:31technomancyjtoy: so... (type 123) calls the type function with the argument 123... so you can see from there what (123 456) means, right?
17:31jtoytechnomancy: yeah
17:31jtoyah , so the first item is the function
17:32jtoy(123)
17:32rabbit_airstrike(123) would try to evaluate the function 123 represents with no arguments
17:33rabbit_airstrikewell
17:33rabbit_airstrike123 wouldn't be a valid name
17:47Raynesyogthos: We should maybe add some attribution stuff in the README.
17:47yogthosRaynes: yeah good point :)
17:47yogthosRaynes: you up for doing it? :)
17:47RaynesSure.
17:48yogthosawesome
17:48Raynesyogthos: I'm thinking "Maintainers: yogthos, Raynes\nContributors: peoples…"
17:48RaynesSound good?
17:48yogthosyeah that sounds good ;)
17:55Raynesyogthos: https://github.com/noir-clojure/lib-noir#credits
17:55yogthosglorious :)
17:56arohnerthere'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:56arohneri.e. (infof "foo failed, bar returned false")
17:56arohneris there a clean solution to that?
17:56amalloyRaynes: why not just link to https://github.com/noir-clojure/lib-noir/contributors ?
17:57amalloyit won't get stale
17:57Raynesamalloy: Because I didn't know that that even existed.
17:57yogthosit does look pretty :)
17:57RaynesShit all over my efforts, why don't you amalloy.
17:57RaynesI shortlogged and everything.
17:57yogthoslol stuff you learn about github eh
17:58amalloyshortlogging sounds kinda like a quasi-euphemism for shitting all over your efforts
17:58yogthosrofl
17:58Rayneshttps://github.com/noir-clojure/lib-noir#contributors
17:59Raynesyogthos, amalloy ^
17:59yogthoshaha nice
17:59RaynesThe maintainers part is still useful because it's helpful to know who to direct whining to.
17:59RaynesDamn it. Typo.
17:59RaynesWell, that's my commit quota for March.
18:03ivannear the end of http://vimeo.com/46290182 there's an explanation of what weirdness OSGi etc actually do
18:16mrb_bkanyone here have a copy of wadler's "replacing failiure" paper?
18:27ivanmrb_bk: http://libgen.info/view.php?id=580314 might be explaining the exact same thing, search it for "list of suc"
18:28mrb_bkivan: thanks!
18:33patbrownhas anyone had success with piggieback and nrepl.el?
18:45patbrownIf 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:50ivanpatbrown: some closure-library jar is missing the required third_party directory and you have to find a working closure-library on clojars
18:50ivanDeferred is in that third_party
18:51ivanI bet seangrove knows which jar to use
18:56patbrownI'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:57patbrownThere is also [com.wagjo/closure-library-third-party "0.1.0-SNAPSHOT"] on clojars
19:03frenchypdo I have to use a macro if I want to define an anonymous function with a specific number of arguments?
19:03jtoywhat is the equilvant clojure from this ruby: [1,2,3].select{|x| x == 2 } ?
19:03jtoyto select certain values from a list
19:03amalloy(filter #{2} [1 2 3])?
19:03frenchypI am trying with (defn make-fn [num-args] (fn (into [] (repeat num-args nil) (print "3 args 2"))), which doesn't work
19:03amalloy(filter #(= %2) [1 2 3]) if you want to stick with the lambda
19:04jtoyamalloy: what does % do there?
19:04RaynesIt's the second argument.
19:04RaynesBecause he forgot a space.
19:04amalloy&'#(= % 2)
19:04lazybot⇒ (fn* [p1__12554#] (= p1__12554# 2))
19:05RaynesIn the real case it is the first argument. %, %2, %3 = first, second, third arg respectively, and so on.
19:05patbrownFrenchy, are you trying to count a seq of args?
19:05rabbit_airstrikeI think %1 also works if you want to go the numerals route, it's just a little more consistent
19:06jtoy(filter #(= % 1 ) [1 2 3]) returns 1 ?
19:06RaynesYes, %1 also works.
19:06RaynesBut I really hate telling people that.
19:06rabbit_airstrikewhy?
19:06clojurebotwhy is the ram gone
19:06frenchyppatbrown: no, I am trying to define stub functions that have a specific number of arguments and an arbitrary body
19:06jtoywhy?
19:06clojurebotjtoy: because you can't handle the truth!
19:06RaynesBecause two things that do the same thing confuse people.
19:07Raynes&(filter #(= % 1 ) [1 2 3])
19:07lazybot⇒ (1)
19:07rabbit_airstrikeit seemed to make sense to me when I first read about anon. functions in clojure
19:07frenchyppatbrown: in other words, I am trying to define the argument vector of a function dynamically
19:07rabbit_airstrikeit's just different styles for different contexts
19:08jtoy&(filter #(= % 2 ) [1 2 3])
19:08lazybot⇒ (2)
19:08frenchypactually, 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:08jtoyi dont understand why changing that goes to 1,2,3
19:08Raynesrabbit_airstrike: I concede.
19:08rabbit_airstrikechanging what?
19:09jtoyit is an argument
19:09jtoyI see I think
19:09rabbit_airstrikeyou're just filtering out those vals in the collection which pass the anonymous predicate function you're defining
19:10rabbit_airstrikewhere % is the argument to that function
19:10RaynesYou'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:10Raynesrabbit_airstrike: Don't forget that %1 also works. ;)
19:10rabbit_airstrikepoor form for only one argument ;)
19:11rabbit_airstrikeyou could always say (filter (fn [n] (= n 2)) my-coll) if you're feeling verbose
19:11jtoycan I do nested filters that use the non verbose syntax?
19:12rabbit_airstrikeafaik you can't nest anonymous functions, which is one reason you would move toa more verbose expression
19:12RaynesYou can't nest the shorthand version.
19:12RaynesYou can nest ##(fn [] (fn [] (fn []))) all you want of course.
19:12lazybot⇒ #<sandbox8759$eval12599$fn__12600 sandbox8759$eval12599$fn__12600@14c491b>
19:12rabbit_airstrikeif you were allowed to define those short-hand % arg functions within each other the arguments would be ambiguous
19:12jtoyRaynes: is it idiomatic to have one be shorthand and the other long form?
19:13RaynesIt depends on which is clearer and whether or not you need to nest them. Shorthand versions lend themselves better to shorter anonymous functions.
19:13illiuxI use the (fn []) form far more simply because I have my emacs set up to replace the fn with a lambda symbol >.>
19:14RaynesEvil.
19:18amalloyRaynes: #clojure's number-one source of unasked-for judgment
19:18Rayneslol
19:18amalloymaybe number two, after me
19:18illiuxRaynes: what makes it evil?
19:19RaynesI guess nothing if it works for you. I just can't stand my text looking different in Emacs than it actually is.
19:19RaynesIn fact, I usually examine and edit raw bytes.
19:20rabbit_airstrikeyou mean you don't manually toggle the magnetic state on your hard drive platters?
19:20amalloynobody is impressed by editing raw bytes in emacs, when http://www.gnu.org/fun/jokes/ed-msg.html is available
19:20illiuxTo 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:21illiuxThat lambda symbol is unbelievably pretty
19:21RaynesAnd 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:22rabbit_airstrikereplace it with a symbol which gets kerned into the middle of two character places?
19:23rabbit_airstrikeor something like that
19:23Raynesilliux: Give me your elisp for that.
19:23Raynesilliux: I'll trade you some elisp for paredit in nrepl buffers.
19:24illiuxI have paredit in nrepl buffers already :)
19:24RaynesI have a fancy function for toggling transparency that is about as useful as your changing fn to a lambda symbol is.
19:25Rayneshttps://www.refheap.com/paste/a236cfff1b68f0cfe87f798e3 fair trade, I think.
19:26illiuxI'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:26RaynesIf you give me a link to pastebin I'll come to your house and hurt you.
19:26illiuxWhat's prefered?
19:27RaynesThis really awesome guy wrote a pastebin in Clojure that people around here like to use. https://www.refheap.com
19:28illiuxhttps://www.refheap.com/paste/12099
19:29illiuxHm, spacing got weird. Different tab width
19:29amalloyc'mon, Raynes, show some class: https://www.refheap.com/paste/ab28ab5c240fcad65efbcc43f
19:29rabbit_airstrikemaybe we can feature request some tab processing for refheap
19:30RaynesWow.
19:30RaynesI wonder if codemirror caused that or pygments.
19:30RaynesHas to be pygments.
19:30illiuxits using a width of 4, I'm using a width of 2
19:31rabbit_airstrikeit doesn't seem like it's just a width problem
19:31rabbit_airstrikeit looks like a bunch of tabs were auto-inserted
19:31RaynesCan 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:32rabbit_airstrikehuh, pasted into an emacs buffer it looks pretty normal again
19:32amalloyif you have tabs in your clojure source files you're a monster
19:32illiuxI haven't gotten my emacs configuration where I wanted it. My vim config was tab expand for everything
19:33illiuxamalloy: my clojure code is using spaces :P
19:33amalloyoh right, that's elisp
19:33RaynesStill a monster.
19:33amalloy(setq-default indent-tabs-mode nil) ;; maybe?
19:33RaynesI think so.
19:33RaynesI have that too.
19:33rabbit_airstrikejust tried it out. that's a sexy little lambda there
19:33RaynesIn two places, even.
19:33RaynesJust to make damn well sure.
19:33amalloywell, that's a quorum
19:34illiuxYou could probably extend it to change the # in #() to a lambda as well if you wanted
19:38illiuxalright, no more tabs in my emacs
19:39jtoycan 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:39jtoyim trying to get back "testdata"
19:40rabbit_airstrikelooks like you're missing an open paren after some
19:41jtoyi think i need a let in there too?
19:41frenchyppatbrown: sorry, just saw your msg
19:41frenchypresponded
19:42dog_cat11hey, did they take featurec out of core.logic 0.7.5 ?
19:42dog_cat11i keep getting a function not found err
19:42hiredmanit never was in 0.7.5, I think you need to be on one of the betas
19:43rabbit_airstrikejtoy: I'm also not sure what you're doing with those nested forms with strings
19:43SegFaultAXjtoy: Try breaking the problem down into multiple steps instead of nesting it altogether. It'll be easier to debug that way.
19:43rabbit_airstrikethey should probably be quoted if you want them to be seqs
19:43dog_cat11thanks
19:45jtoyyeah, 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:49technomancyjtoy: I think paredit has been ported to vim
19:50RaynesIt has.
19:50SegFaultAXIt has. I also suggest installing delimitmate and rainbow parentheses.
19:50jtoythis is what I am trying to do: http://pastebin.com/n0abgZw0
19:51dog_cat11hiredman, you're right, it's in 0.8.0rc2
19:51dog_cat11thank you
19:52SegFaultAXjtoy: What are you really trying to do?
19:52jtoySegFaultAX: that is really what im trying to do
19:52dog_cat11i found it was easier to learn emacs then get everything working in vim
19:52rabbit_airstrikejtoy: how many function calls are you trying to make with (test_function ....)
19:53SegFaultAXjtoy: I mean explain what you're trying to accomplish.
19:53rabbit_airstrikeit looks like you actually want to (test_function ("foo" '("regex1" "regex2"))) (test_function ...)
19:54jtoyrabbit_airstrike: I will be calling it approximately 200M times, so a lot
19:54rabbit_airstrikebut maybe you want (map test_function coll1 coll2)
19:54jtoySegFaultAX: 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:55nopromptparedit is good stuff
19:55noprompttakes a minute to get used to and has a few small bugs, but it's totally worth it.
19:56jtoyso 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:57dog_cat11noprompt, i just found paredit this weekend, very impressed
19:57Raynesnoprompt: Bugs?
19:57dog_cat11it has handled all the corner cases that makes automatic parens hard
19:58nopromptRaynes: so one weird thing i noticed is with #_(…) forms
19:58rabbit_airstrikejtoy: maybe start from a map containing those associations
19:58rabbit_airstrike (def tech-map {"apple" '("ipod" "ipad" "iphone") "microsoft" '("surface" "windows")})
19:58nopromptRaynes: if it's a few lines and you decided to delete the whole block you'll end up with a dangling )
19:59nopromptRaynes: i'm updating my repo of it now, to make sure it's still a bug. if not i should probably report it.
19:59jtoyrabbit_airstrike: yeah, i do have that list defined ,but i still need to go through lots of strings
20:00amalloyhuh. i've never run into that, noprompt, but you're right. it definitely shouldn't do that
20:00nopromptamalloy: 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:02tomojhow better to write https://www.refheap.com/paste/85da877ec3b4d3b8cbcdc17ec ?
20:03amalloyoh dear. i started trying to track down the code responsible for the #_ issue and found https://www.refheap.com/paste/f1b0ac7499dfcd7bae5b0681f
20:03nopromptlol.
20:04SegFaultAXjtoy: https://www.refheap.com/paste/12102
20:05amalloytomoj: i don't think there are any builtins that do this any better
20:05rabbit_airstrikeyou'll probably want to attach something to make that case-insensitive though, depending on your use case
20:06amalloyyou 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:06tomoj:(
20:07rabbit_airstrikesomething like (?i)
20:07nopromptthe README hasn't been updated in 43 years https://github.com/vim-scripts/paredit.vim
20:07SegFaultAXjtoy: Note that this actually memoizes the regex compilation so you don't have to do it over and over.
20:07RaynesThere is a real repo for that, guys.
20:07Rayneshttps://bitbucket.org/kovisoft/paredit
20:07SegFaultAXrabbit_airstrike: Is that to me?
20:08rabbit_airstrikemostly to jtoy. I assume you already knew that
20:08SegFaultAXrabbit_airstrike: Indeed. Cool! :)
20:08rabbit_airstrikehe's the one who knows what strings he's got and whether case matters here
20:08jtoySegFaultAX: 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:08SegFaultAXjtoy: That depends. How many of these pattern groups do you have?
20:09SegFaultAXjtoy: If it's a small number, and you want to reuse them all over, then do that.
20:09jtoySegFaultAX: I mean i have about 50 pattern groups, and then I will run this on ~50 million strings
20:09rabbit_airstrikeI would build that map I talked about and then just map over the keys and vals
20:09SegFaultAXjtoy: Otherwise you can always do (let [matchers (map #(apply test-str %) pattern-groups)] ...)
20:09SegFaultAXjtoy: I would build the matchers in a top level var, then.
20:12jtoySegFaultAX: thanks, im testing it now
20:12SegFaultAXjtoy: In any case, the point is you should definitely not recompile those regular expressions over and over.
20:13nopromptRaynes: thanks.
20:13Hendekagonwow, first time coding in Clojure I've wish for type checking: (partition 2.0 (range 16))
20:14Hendekagonmy code was like: (partition (partition-size n) things) - partition-size was returning a number, not a long - partition needs a long
20:14amalloytomoj: something like https://www.refheap.com/paste/de2f8779657c74cf18efb4402 ?
20:15tomojsure
20:22nopromptalright i let the maintainer know about the issue.
20:24jtoysilly question again, waht is wrong with this: (map re-pattern ['ipod' 'ipad'])
20:24nopromptjtoy: umm, you should be using double quotes
20:25ivan,(type 'ipod')
20:25jtoynoprompt: oh, I didnt know that is required
20:25clojurebotclojure.lang.Symbol
20:25nopromptjtoy: yes, strings must always be in double quotes.
20:25jtoyivan: that doesnt even work for me
20:26jtoy (type 'ipod') ?
20:26ivanof course it works, you see clojurebot evaling it
20:27ivanI was just pointing out that it's a Symbol
20:27jtoyivan: why cant i type that thouh?
20:27nopromptjtoy: because 'iPod' is a symbol followed by a quote
20:28noprompt,(list 'ipod')
20:28clojurebot(ipod')
20:28nopromptsee how i get back a symbol and a quote?
20:28noprompt,(list "ipod")
20:28clojurebot("ipod")
20:30nopromptjtoy: clojure isn't like ruby or python where strings can be wrapped in either double or single quotes. it's strictly double.
20:32nopromptjtoy: does that help you?
20:32jtoynoprompt: yes
20:32nopromptcool :)
20:32gfredericks'ipod' uses the single quote in two different ways
20:33jtoynoprompt: imstill nto sure why you can type (type 'ipod') though and I cant,
20:33ivanjtoy: what error do you get?
20:33jtoybut i see that it is a symbol with a single quote at the end
20:33gfrederickssingle quotes in symbols weren't allowed until 1.3 or so
20:33gfredericksso if you're on an old clojure...
20:34nopromptoh, wow. i wasn't aware you could do that. that clears up a little confusion.
20:34noprompt,(type 'don't)
20:34clojurebotclojure.lang.Symbol
20:35noprompt,(name 'ipod')
20:35clojurebot"ipod'"
20:35gfredericks,+'
20:35clojurebot#<core$_PLUS__SINGLEQUOTE_ clojure.core$_PLUS__SINGLEQUOTE_@167d998>
20:35gfredericks,(doc +')
20:35clojurebot"([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Supports arbitrary precision. See also: +"
20:36nopromptthat's pretty sweet. i had no idea you could do the whole prime bit ala haskell.
20:37gfredericks,'k'..''.''''.'.'
20:37clojurebotk'..''.''''.'.'
20:38ivanbest Clojure features: - in symbols, optional commas
20:39gfredericks3rd and 4th are being a lisp and immutable data structures
20:39nopromptivan: +1 for commas as whitespace
20:39craigbrotechnomancy: so, ever here of lein uberjar or other build step just locking up on very large (12 core) systems?
20:39craigbros/here/hear
20:39craigbroif we kill it, and then run it again, it works
20:39nopromptlynaghk: have you done anymore work with angularjs and cljs?
20:40ivancraigbro: do you have a high-memory system running centos?
20:40craigbrohigh mem running arch
20:40jtoy (type 'ipod')
20:40jtoyjava.lang.Exception: Unmatched delimiter: )
20:40hiredmanlein deps would sometimes cause my vm to spin real hard, but that was with lein 1
20:41craigbrounfotunately, 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:41ivancraigbro: 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:41craigbroit consumed 1h+ of cpu time 8)
20:42ivanattach a jvisualvm
20:42nopromptjtoy: which version are you using? *clojure-version*
20:42craigbroivan: later, I gotta eat first, thanks 8)
21:14dog_cat11has anyone used core.logic to select data out of large arrays?
21:14dog_cat11like 25,500 lines w/ 20 entries per line of roughly 20 char text?
21:28gfredericks(doc binding)
21:28clojurebot"([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:32thm_proverwhat editor (implemented in java) code base is a googd foundation for writing a scriptable editor in clojure?
22:19Hendekagonthm_prover: you mean code editor ? Maybe clooj or Catnip ? (both written in Clojure)
22:25thm_proverHendekagon: never heard of Catnip. Investigating now.
22:28Hendekagonthm_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:29Hendekagonthm_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:30Hendekagonthm_prover: I would go with clooj for the desktop, or Catnip for browser-based. I'm writing something for catnip (maybe)
22:31thm_proverHendekagon: I was previously considering wrapping JEdit in Clojure; but catnip looks intereting.
22:32Hendekagonthm_prover: oh yeh! forgot about JEdit. wrapping? why ? JEdit has a good plugin system
22:33Hendekagonthm_prover: catnip, like all these browser-based editors, uses codemirror for the actual editor, which is javascript
22:34thm_proverICK
22:34thm_proverI have codemirror.
22:34thm_provers/have/hate/
22:34thm_proverplayed with Codemirror in clojurecript; was not pelasant experience
22:35ibdknoxwhat's wrong with codemirror?
22:35thm_proverI lack the intelligent to script it.
22:35thm_proverNothing wrong with codemirror; mainly my IQ is only 2 digits.
22:36thm_proveribdknox: 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:36ibdknoxhaha
22:37ibdknoxI only look when it pings me about certain terms :)
22:37thm_proveris lighttable still a single person operation?
22:38ibdknoxI've always had a co-founder, but still just one many coding. Hoping to change that soon :)
22:38ibdknoxman*
22:58mercwithamouthhi, could someone tell me the preferred framework for creating guis?
22:58gfredericksclojurescript? :)
23:00mercwithamouthgfredericks: 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:01gfredericksI was just pointing out that most GUIs are browser-based these days. so clojurescript lets you do that.
23:01gfredericksI don't know much about the JVM stuff. I do think there's a wrapper for swing.
23:02lekulight table using chromium
23:02ibdknoxseesaw is the swing wrapper: https://github.com/daveray/seesaw
23:02mercwithamouthleku: chromium?
23:03ibdknoxif you have experience with web stuff, then CLJS is a reasonable way to go :)
23:03lekuthe google chrome thing
23:03ibdknoxmercwithamouth: yeah, we use a wrapped chromium via https://github.com/rogerwang/node-webkit
23:03mercwithamouthibdknox: i do but i was looking to take a break from web development. ok that's just interesting
23:03ibdknoxall of Light Table is HTML/CSS/CLJS
23:04mercwithamouthibdknox: ...nice!
23:04mercwithamouthibdknox: that's really interesting.
23:04lekuhah
23:05lekunice irc nets
23:05lekuknox is this the first application being built on chromium besides chrome?
23:05lekuor rockmelt
23:05ibdknoxno, there are some others - CEF the Chromium Embedded Framework is how people used to do it
23:06lekuk
23:06ibdknoxit is.. difficult to work with
23:06lekuah damn
23:06ibdknoxnode-webkit is great though
23:06ibdknoxit's a much nicer approach
23:07lekuso is this going to have to be a client side app or can tyou move this into the web completely eventually?
23:07thm_proveribdknox: wait, what? is lighttable written in CLJS or CLJ ?
23:07ibdknoxcljs
23:08ibdknoxleku: it's possible for us to move it to the web, though there are some serious disadvantages to doing so
23:08thm_proverI've played with CLJS and the Google Closure library. What does Chromium buy you?
23:08ibdknoxa container?
23:08thm_provercan you manipulate dom trees in CLJ ? if not how is it useful?
23:08thm_proverhow is Chromium different from CLJS running insdie of a web browser??
23:08lazybotthm_prover: Uh, no. Why would you even ask?
23:09ibdknoxit doesn't have all the browsery stuff
23:09ibdknoxthink of it is an application frame
23:09thm_proverso it's basically a "raw DOM tree" frame ?
23:09ibdknoxyep
23:09ibdknoxplus v8
23:09mercwithamouthvery cool...
23:09thm_proverif I had taht, but could manipulate it in CLJ rather than CLJS, I'd be happy
23:10thm_proverI still can't stand debugging CLJS
23:10ibdknoxmm
23:10thm_proverI would rather write CLJ code with a pinky removed than write CLJs code
23:10ibdknoxdnolen is working on it with sourcemaps :)