#clojure logs

2014-01-13

00:05amalloyah yes, nicola's patch fixes the issue that i carefully checked for but still failed to notice
00:26logic_progis the semantics for "throwing an uncaught exception inside a go block" well defined ?
00:26logic_progif so, what is it defined as?
00:49cerealklrHey folks. Is there any way to have comments at the end of lines in multiline strings?
00:49cerealklrI've got a kind of gnarly regexp that I'd like to document
00:52amalloycerealklr: well, a regex isn't a string. i don't think there's an answer for strings, aside from just writing (str "foo" ;; blah <RET> "bar" ;; duh)
00:53cerealklrMy bad, I'd assumed the same rules would apply.
00:53amalloybut java's regular expressions support extended mode with the (?x) embedded flag (most regex engines do, even if they may have a more convenient syntax like /foo/x)
00:53amalloyso #"foo # comment RET bar # comment2 ..."
00:53amalloyought to work
00:53amalloyer
00:53amalloy#"(?x)foo # comment RET bar # comment2 ..."
00:55amalloyfor more details about how extended mode changes the way regular expressions are compiled...well, look up extended mode, i guess
00:55cerealklrDang. JS Regexps don't suppport extended mode, and I'm working in clojurescript. Didn't stop to consider the difference.
00:56cerealklrI suppose I can shim out to JS's Regexp ctor if there isn't a more elegant in language way.
01:00amalloywell, js does support extended mode, but it doesn't support inline flags
01:00amalloywhereas clojure has no way to specify flags other than inline (or interop)
01:04deadghosthmm ordinarily you'd use vectors instead of lists except when writing macros right?
01:05deadghostI have a few places where I'm using lists as tuples and vectors seem more appropriate
01:07seangrovecerealklr: Sounds like a good opp for a library
01:07cerealklrseangrove: I ended up using re-pattern with str
01:08cerealklra macro would probably bundle that nicely
01:08amalloycerealklr: well, not very nicely, really, right? because you have to double-escape things in a string but not in a regex
01:09amalloyeg, #"\d{4}" vs (re-pattern (str "\\d" "{4}"))
01:09cerealklrfair enough. Didn't consider that
01:09cerealklrit's a tradeoff either way
01:10amalloyyeah
01:10ruzu`(println "yay")
01:12amalloydeadghost: huh? you use vectors and lists pretty much the same in macros as you would otherwise
01:14deadghostprobably worded that poorly
01:14deadghostyou'd typically use vectors instead of lists right?
01:15deadghostexcept in macros where you need to build an s-exp
01:15deadghostwhich requires lists
01:16amalloyi mean, your output will include lists (seqs, really), but so does the output of many functions; and you'll probably type as many () and []s as you do when writing any other function
01:17amalloyand the output will include vectors too, eg for emitting let-blocks
01:53mischanixTrying to pprint a seq that's basically the result of filter and getting ClassCastException: clojure.lang.PersistentHashMap cannot be cast to java.util.Map$Entry
01:54mischanixHere's relevant code/stack trace: https://www.refheap.com/23162
02:07amalloythe formatting of that code is really weird, mischanix - it makes it very hard to read what is going on. but here it looks like the problem is that you're calling (vals (:heroes s)), and (:heroes s) is a list of maps, rather than a single map
02:07RaynesHoly shit.
02:08RaynesGotta say, I couldn't have come up with that layout myself.
02:10mischanixAh, nice find, thanks.
02:11amalloyif i were going to make a whitespace-only rewrite of your code, it would look like https://www.refheap.com/23176
02:13mischanixYeah. First project in clojure, never touched a lisp before either.
02:17mischanixGot 600 more lines of stuff that looks exactly like that if you're into the horror genre.
02:20amalloyhaha no thanks, i saw that a newcomer to the language was trying to write hearthstone and that one snippet was enough for me
02:21mischanixMight end up redoing it in C once I know my data structures, heh
02:23logic_progwith http://clojure.github.io/core.async/#clojure.core.async/&gt;! , is there any defined behavior for using >! / >!! on a closed channel?
02:23logic_progi.e. is the behavior undefined, throw, or nil ?
02:28proteneer_anyone play around with ClojureC to be able to comment on its maturity?
02:33amalloyi would be astonished if clojurec were mature, proteneer_. aside from the readme itself saying it's experimental and not-polished, one of the two commits made in december was "make things compile again" after a two-month period of no commits, in which presumably things did not compile
02:33proteneer_hm
02:33proteneer_ok
02:34proteneer_thanks. I've been itching to dive into a FP language, but I don't know any java
02:39TEttingerproteneer_, there's a few people in here who are users of haskell, it's a solid choice if you are averse to java stuff
02:41seangroveAnyone have good suggestions for parsing a string as html in clojurescript?
02:52bitemyappseangrove: jquery
02:52bitemyappwait, lemme think about that for a moment.
02:52seangrovebitemyapp: I suppose actually I should rephrase
02:52bitemyappseangrove: http://api.jquery.com/jquery.parsehtml/
02:52seangroveI would like to parse a string into an html representation, but not actual html (could be unsafe), and then pull out the text content of the nodes.
02:53bitemyappseangrove: then my link seems a good fit.
02:53seangroveSo they never need to become dom nodes
02:53seangrovebitemyapp: heh, "jQuery.parseHTML uses a native DOM element creation function to convert the string to a set of DOM elements, which can then be inserted into the document.
02:53Rayneslol
02:53bitemyappseangrove: but you skip the "inserted into the document" part
02:53bitemyappseangrove: and just iterate over the contents
02:54seangrovebitemyapp: Hrm, I need to look up when a resource is downloaded - at tag cration time, or dom insertion time
02:55seangroveGoogle is also epicly failing me at that query
02:55seangroveI'll ask in an html channel tomorrow
02:55bitemyappseangrove: what sort of resource?
02:56seangrovesrc tag, img tag, a bgaudio tag, etc.
02:56seangroveAnything that could trigger an external resource and be used to track a load
02:56bitemyappseangrove: it depends on where they're located and what sort of tag they are.
02:56bitemyappfor example, there's a reason you put src tags at the tail of the body, rather than at the top.
02:57mischanixfwiw just doing document.createElement().innerHTML= does trigger a load with an <img> tag
02:57bitemyappmischanix: without inserting it into the DOM?
02:59mischanixbitemyapp: no insertion: http://i.imgur.com/vB8B4uu.png ; I think the fragments API prevents this, though
03:01mischanixactually no, I think I'm thinking of something else but I don't remember
03:04bitemyappDOM Stuff.
03:13seangrovebitemyapp: Yeah, DOM + JS... it's enough to shake one's faith in the idea of progress and understanding what came before
03:13seangroveBut enough for tonight, off to dream of the doms, in whatever form they take
03:13seangroveXb
03:16ddellacostaseangrove: based on testing, seems pretty clear that for an image tag, at least, the resource is requested on creation of the element.
03:17seangroveIf that's the case, I'll have to find a nice library for parsing strings into clj data structures
03:17ddellacostaseangrove: seems like this may have something to do with being a "replaced element:" http://www.whatwg.org/specs/web-apps/current-work/#replaced-elements
03:17ddellacostaseangrove: yah, I was gonna say, may be better (and faster) to generate strings
03:18ddellacostaI'm curious if this behavior varies based on the browser, however. I wouldn't put it past IE to do something different.
03:18ddellacostaseangrove: Anyways, don't let me keep you from DOM dreams. ;-) 'night!
03:19seangroveddellacosta: Oh, I have html strings already. I want data structures, then some filtering on them, then turn them back into (possibly different) dom nodes
03:19seangroveBut yes, tomorrow!
03:19ddellacostagotcha.
03:38logic_proggiven that (>! ... ...) always returns nil, regardless of whether the channel is open or closed
03:38logic_progis htere anyway to quer whether a core.async channel is open or closed?
03:49alewwhat's the difference between drop and nthnext?
03:55rurumate1logic_prog: according to the doc string, (<!! ch) will only ever return nil when the channel is closed
03:55logic_progrurumatel, yeah, this doesn't work well since I don't want to be reading from channels
03:55rurumate1oh, and !< has the same behaviour
03:55logic_progto actually figure out if they're closed
03:55rurumate1I see because that would change them
03:56logic_progi'd prefer soething that didn't alter the state ot the channel, say
03:56logic_progclose?
03:58rurumate1maybe you can use core.async/filter or core.async/remove on the channel, to prevent it from returning anything non-nil?
03:59scapechannels should not pass nil
03:59rurumate1except when closed, no?
04:00rurumate1(!< (filter nil? ch)) can return nil
04:00rurumate1I'd wager
04:02rurumate1alew: maybe one is more lazy, like the difference between next and rest?
04:02logic_proglol
04:02logic_progwhat a hack
04:04rurumate1yeah, there should be a better way. maybe the core.async developers can give a better answer?
04:07amalloyalew: drop can return (), nthnext can return nil
04:08em-dashwhere can I put code (e.g., protocol extensions) that I want loaded everywhere? do I have to require it in to every namespace?
04:08amalloyuh, protocol extensions only have to be required once
04:13em-dashthen I'm likely doing something (else) stupid and not yet aware of it
04:15em-dashamalloy: hmm, does that hold for clojurescript (I would suppose so)?
04:15amalloyindeed
05:09mattywreal newbie question here - I've got a list of maps that I'm trying to flatten into one map - but it doesn't work as I expect:
05:09mattyw(into {} (map (fn [x] {:a x}) '(:b :c :d)))
05:09mattyw^^ Must be because I've got a lazy list from doing the map call?
05:10kzar,(into {} (map (fn [x] {:a x}) '(:b :c :d)))
05:10clojurebot{:a :d}
05:11kzar,(map (fn [x] {:a x}) '(:b :c :d))
05:11clojurebot({:a :b} {:a :c} {:a :d})
05:11mischanixmap keys must be unique
05:11kzar(apply into {} (map (fn [x] {:a x}) '(:b :c :d)))
05:11kzar,(apply into {} (map (fn [x] {:a x}) '(:b :c :d)))
05:11clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: core/into>
05:12andyf(apply merge sequence-of-maps) might be what you want
05:12kzar,(apply merge (map (fn [x] {:a x}) '(:b :c :d)))
05:12clojurebot{:a :d}
05:12kzar,(mapcat (fn [x] {:a x}) '(:b :c :d)))
05:12clojurebot([:a :b] [:a :c] [:a :d])
05:12andyfSee also merge-with
05:17alewamalloy: thanks, I also discovered nthnext returns a chunkedcons while drop returns a lazyseq
05:18amalloyi guess that's truee, but it's too specific
05:18amalloynthnext is eager, while drop is lazy; the particular classes returned are implementation details (and not always the same)
05:21mattywkzar, mischanix thanks very much for your help
05:21kzaryw
05:23alewamalloy: by eager you mean it realizes the entire sequence? because it doesn't
05:23amalloyno, why would i mean that? i mean it eagerly does work the moment you call it
05:24alewI misunderstood eager
05:24amalloy(nthnext n xs) immediately calls next n times on xs, whereas (drop n xs) returns a lazy sequence that will call next, or rest, as many times as needed
05:25alewAh ok
05:25amalloy&(time (do (drop 1e7 (range)) nil))
05:25lazybot⇒ "Elapsed time: 26.189066 msecs" nil
05:25amalloy&(time (do (nthnext 1e7 (range)) nil))
05:25lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Double
05:25amalloy&(time (do (nthnext (range) 1e7) nil))
05:25alewarg order is swapped
05:25lazybot⇒ "Elapsed time: 1887.946738 msecs" nil
05:25alewright
05:51honzaLooking for some ideas on how to move from the intermediate Clojure dev to something higher... anyone?
06:05fredyrhonza: build cool things? :)
06:06Southycontribute to an open source project that you think is cool?
06:08SouthyLook at ClojureScript if you are into Web stuff?
06:09mischanixIs there a function for this?
06:09mischanix,(let [l '(1 2 3 4 5)] (concat (take 2 l) (nthrest l 3)))
06:09clojurebot(1 2 4 5)
06:10mischanixOr a proper way to do it?
06:11Sfivmischanix, you mean remove an element?
06:12mischanixSo to speak, yeah. Get the list without the nth element
06:23amalloymischanix: generally if you want to remove an element by index, your algorithm isn't very functional; if it really is the way you need to do things, you should pick a data structure for which random removal is more efficient than a list or a vector
06:26amalloyfor example, a set of objects, or a sorted map of some kind, like a map from index to object
06:31mischanixamalloy: I'm choosing randomly between all possible user actions. Some of these actions can lead to an invalid state, and that ends up returning nil up to the function that's choosing; when this happens, I'm simply recurring the choose function with the nil-resulting function removed from the possible choices. If there are no choices, choose also returns nil
06:31amalloyso use a set
06:32mischanixmmkie
06:36mischanixThough, how do I pick randomly from a set? Do I end up making it a seq so I can use nth on it?
06:37mischanixIs that not wasteful?
06:39mischanixAlso, there theoretically can't be more than ~20 choices
06:44rurumate1I need a shingle-producing function; the input would be a vector like ["the" "big" "black" "box"], output would be all 2-shingles: ["the big" "big black" "black box"]
06:45rurumate1is there something to help it, or should just write a loop?
06:45ddimarurumate1: partition is your friend
06:45rurumate1ddima: thx
06:46DerGuteMoritzhow does partition help here?
06:46ddima,(partition 2 1 ["the" "big" "black" "box"])
06:46clojurebot(("the" "big") ("big" "black") ("black" "box"))
06:46DerGuteMoritzah!
06:47DerGuteMoritznice
06:47DerGuteMoritzforgot about those arguments
06:49AeroNotixIn a doto form, can I conditionally apply some of the functions?
06:50AeroNotixhmm, I could just put a fn there
07:00AeroNotixhm, doesn't seem to call it
07:00rurumate1AeroNotix: I've asked myself the same thing, also inside a -> form. Please paste your solution if you find it
07:02rurumate1AeroNotix: maybe -<> from swiss-arrows can help?
07:02AeroNotixwat
07:02rurumate1but the diamond can only appear once per form..
07:02AeroNotixoh I see
07:02AeroNotixit's a real thing
07:02rurumate1I've started a discussion there, wanna join? https://github.com/rplevy/swiss-arrows/issues/22
07:03clgvAeroNotix: but there is `as->` as well
07:03clgvand that one is in clojure core since 1.5
07:04clgv&(doc as->)
07:04lazybotjava.lang.RuntimeException: Unable to resolve var: as-> in this context
07:04clgv,(doc as->)
07:04clojurebot"([expr name & forms]); Binds name to expr, evaluates the first form in the lexical context of that binding, then binds name to that result, repeating for each successive form, returning the result of the last form."
07:04rurumate1I have no idea what that docstring means. Where are the examples?
07:07rurumate1,(as-> 1 x (inc x) (inc x))
07:07clojurebot3
07:08rurumate1brilliant
07:08rurumate1,(as-> 1 x (inc x) (inc (inc x)))
07:08clojurebot4
07:08rurumate1it's a dream come true
07:09locksrurumate1: if only any of the docstrings had examples
07:13rurumate1locks: I've heard the clojure maintainers are trying to keep them short. It's okay as long as you can find examles easily via google, but could not find easily for as->
07:14hcumberdale(into {} (map (fn [[a b]] (hash-map a b)) '(["1" "a"] ["2" "b"])))
07:14hcumberdaleis there a better way to do this?
07:15DerGuteMoritz,(into {} '(["1" "a"] ["2" "b"]))
07:15clojurebot{"1" "a", "2" "b"}
07:15DerGuteMoritzhcumberdale: ^
07:15hcumberdaleDerGuteMoritz: thx, but why does it work?
07:16hcumberdaleahh it uses conj and that is working with pairs?
07:16amalloy(into x [a b c]) is (conj x a b c)
07:16amalloyand conj on a map wants vector pairs
07:16DerGuteMoritzindeed
07:16rurumate1(conj {} ["a" "b"])
07:16rurumate1,(conj {} ["a" "b"])
07:16clojurebot{"a" "b"}
07:22hcumberdaleAlso a better way to do: (into {} (map #(hash-map (str (:fieldname1 %)) (:fieldname2 %)) (j/query db [selectstatement]))) ?
07:22jcromartiehow can I make use of Clojure STM while dealing with external transactions?
07:22hcumberdalewhere j is clojure.java.jdbc
07:23jcromartiei.e. outside APIs
07:23locksrurumate1: yeah, I guess clojuredocs could serve as an example repo, but it does seem a bit oudated?
07:24DerGuteMoritzhcumberdale: one way would be (into {} (map str (map (juxt :fieldname1 fieldname2) (j/query db [selectstatement])))) -- you might consider using ->> here
07:25DerGuteMoritzhcumberdale: sorry, that wasn't exactly the same actually
07:26DerGuteMoritzor was it :-)
07:26jcromartieI obviously can't do external calls inside a dosync
07:26jcromartie(HTTP etc)
07:26DerGuteMoritzhcumberdale: nah, it's buggy, sorry
07:27hcumberdalealso thought about using juxt
07:27hcumberdalebut can't create anything with it that works :(
07:28DerGuteMoritzhcumberdale: how about something like (apply hash-map (map str (map (j/query db [selectstatement]) [:fieldname1 :fieldname2])))
07:29rurumate1locks: searching for as-> on clojuredocs' search engine gives me only one less-relevant result
07:29rurumate1maybe the poor search performance is a factor why it's not being used so much?
07:30hcumberdaleDerGuteMoritz: changes everything to strings, doesn't it?
07:30rurumate1or maybe it really has no example for as->, which would be sad
07:31hcumberdale(map (j/query db [selectstatement]) [:fieldname1 :fieldname2])) << don't know that this is actually working
07:31amalloy(into {} (map (juxt (comp str :field1) :field2) (j/query ...))) looks equivalent to the originalm hcumberdale
07:31DerGuteMoritzhcumberdale: oh yeah sorry, I misread your original version
07:32hcumberdalethx amalloy!
07:32amalloyhashmap is a function you should almost never apply - into {} just works better so often
07:33DerGuteMoritzah, right, query returns a list of maps
07:33DerGuteMoritzzing
07:33DerGuteMoritzok I should not do this on the side :-)
07:34rurumate1,(as-> 1 x (inc x) (inc (inc x)) (or (odd? x) (as-> 1 y y)))
07:34clojurebot1
07:34rurumate1smashing
07:36sm0keguys how do i compare this?
07:36sm0ke,(= {:a 0.4} {:a 0.4})
07:36clojurebottrue
07:36sm0ke,(= {:a 0.4 :b 0.7} {:a 0.4 :b .7})
07:36clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .7 in this context, compiling:(NO_SOURCE_PATH:0:0)>
07:36sm0ke,(= {:a 0.4 :b 0.7} {:a 0.4 :b 0.7})
07:36clojurebottrue
07:36sm0keerr
07:37rurumate1you're comparing it well imho
07:38sm0kewell wtf
07:38sm0kelet me check again
07:40rurumate1recur will never consume the stack, even when used without loop, right?
07:42rurumate1(when the enclosing function is used as recursion point)
07:42rurumate1,((fn [x] (if (< x 10000) (recur (inc x)) x)) 1)
07:42clojurebot10000
07:43sm0keyes recur is optimized
07:43sm0keso i was asking this ##(= 0.7 (float 0.7))
07:43lazybot⇒ false
07:43sm0keso i was asking this ##(== 0.7 (float 0.7))
07:43lazybot⇒ false
07:43sm0keso i was asking this ##(=== 0.7 (float 0.7))
07:43lazybotjava.lang.RuntimeException: Unable to resolve symbol: === in this context
07:43sm0kehmm weird
07:44rurumate1floats are weird
07:44sm0kejeez this will make unit testing hard
07:44sm0kewhats the dfault thingy?
07:44sm0ke,(type 0.1)
07:44clojurebotjava.lang.Double
07:45rurumate1smoke, usually when unit testing with floats, you specify a margin of error, e.g. 0.000001
07:46rurumate1see http://junit.sourceforge.net/javadoc/org/junit/Assert.html#assertEquals%28double,%20double,%20double%29
07:46clgvsm0ke: comparing floating points numbers via equality is seldom right.
07:46clgvmaybe deterministic testing is the only exception.
07:47sm0keclgv: what do you mean?
07:47clgvotherwise you always want to know if two floating point numbers are approximately the same , i.e. have only a difference of at most epsiolon (being a small constant, e.g. 1E-10)
07:50sm0kewell i cannot have a epsilon based testing as i am comparing deeply nested maps
07:52gnzhhi guys, is there any way to stub function behaviour in midje using another function? I want function in my tests to behave like identity function.
07:52clgvgnzh: you can do that via (provided ...) for regular functions
07:52good1Hi there, what's the proper way to accomplish this CL code in clojure?
07:53good1(let ((foo '())
07:53good1 (bar '(1 2 3)))
07:53good1 (dolist (x bar)
07:53good1 (setf foo (cons x foo)))
07:53good1 foo)
07:53gnzhclgv, can you provide simple example? (provided (a s) => s) doesn't work
07:54clgvgnzh: but it should. is `a` defined via `defn` ?
07:55clgvgnzh: `provided` does not work for protocol methods on regular deftypes/defrecords afair
07:55gnzhclgv, it just function, nothing fancy
07:58gnzhclgv, I'm not sure that what I wan't is possible to implement
08:02clgvgnzh: this works (fact (f 1 2) => 3 (provided (a 1) => 1 :times 1 (a 2) => 2 :times 1)), but I am not sure if you can achieve a general identity function
08:03gnzhclgv, well i don't want to stub manually all possible inputs
08:03clgvyeah I guessed that
08:04clgvgnzh: there is clojure.core/with-redefs
08:08gnzhclgv, thanks, that works. I was hoping that midje can provide cleaner way.
08:08fredyrgood1: this is pretty similar perhaps
08:09fredyrgood1: making a gist instead of pasting
08:09fredyrgood1: https://gist.github.com/fredyr/8399958
08:10good1fredyr: You're right sorry!
08:10clgvgood1: what is the task in general? build a list from a list? concatenation of two lists?
08:11clgvgood1: ##(concat [1 2 3] [])
08:11lazybot⇒ (1 2 3)
08:12fredyrclgv: if i understand correctly, the CL code was reverse with an accumulator
08:12fredyrpop and cons
08:14good1I am trying to get a new list (foo in this case) so that i can us dstinct to remove duplicates!
08:14fredyrgood1: oh in that case
08:14fredyryou alway get new lists in clojure
08:15fredyrsince they're immutable
08:16fredyr,(distinct [1 2 3 3 4 6 4])
08:16clojurebot(1 2 3 4 6)
08:16good1fredyr: Thank you!
08:17fredyrgood1: np
08:29noneshi
08:29I_play_2_winhi
08:30nonesis there ways to get current imported namespaces?
08:30clgvgood1: you should read about Clojure's immutable/persistent datatypes. you never need to copy clojure datastructures to be able to use the unmodified and modified structure after that
08:34rurumate1immutability is a no-brainer unless you're used to doing it wrong
08:35clgvwell he obviously is not used to it and seems to not know about it, so no reason to insult him
08:37good1clgv: Exactly! That was my problem, i see clearly now.
08:37rurumate1sorry I didn't want to sound rude
08:37rurumate1it's just that people seem to think it's a hard concept simply because there is this funny word
08:38clgvgood1: as always, I'd recommend to read one of the clojure books to get you fast on track
08:38rurumate1where in reality there should be a complicated word for NOT using immutable structures
08:38clgvrurumate1: well, it's different from what most are used to from industry/mainstream (C/C++, Java)
08:38rurumate1like, "destructive programming"
08:39rurumate1clgv: I'm painfully aware of that
08:45ddimanones: maybe you can try something like (.getAliases (find-ns 'clojure.core)) (or .getMappings, depending on what you want to see)
08:48nonesddima: thanks, I'll search in that direction
08:48ddimanones: though in the case of current namespace you might use (the-ns *ns*)
08:49ddimaoh
08:49ddimayou dont even need the-ns then
08:49ddimak
08:49nones,*ns*
08:49clojurebot#<Namespace sandbox>
08:50nonesyes
08:52ddimanones: thought, forget the manual method-calling, there's ns-imports, ns-aliases, ns-refers etc
08:52ddima-t
08:52AeroNotixI want to use assert-args, is there a public replacement?
08:52AeroNotixsince assert-args is private.
08:53nonesddima: yes, I already found them
08:53ddimaahk. I was just poking around myself, just to see what exists, so
09:00tbaldridgeAeroNotix: it's open source, so you could always copy what's in core.clj
09:01clgvAeroNotix: you can create a public `def` to that private function, e.g. (def assert-args #'clojure.core/assert-args)
09:01clgvor macro...
09:09gtraket voila.
09:22AeroNotixhmm
09:33edwAnyone happen to know the currently least deprecated, least painful way of recursively deleting a directory?
09:37edbondedw, commons io has deleteDirectory - http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils.html#deleteDirectory%28java.io.File%29
09:38edwedbond: I was reading in the list archives that delete-file-recursively got the axe because Java 6 cannot tell between a symlink and a real file. I'm guessing the Commons code has the same problem.
09:39edwI'm going to non-recursively delete a single level of files, since what I'm working with (Cascading local textline files) have only a depth of one.
09:39edbondit seems commons.io skips symlinks, see source http://commons.apache.org/proper/commons-io/apidocs/src-html/org/apache/commons/io/FileUtils.html#line.1550
09:40edwedbond: Huh. Let me check that out then!
09:40edbondedw, did you look at file-seq? You can list files, filter and call #delete
09:41edwedbond: That's what I'm doing. Just reversing the sequence and deleting each file.
09:45edwedbond: https://www.refheap.com/23322
09:46edbondedw, looks good. It does remove recursively, right?
09:46edwedbond: Yeah, for better or worse.
09:46edbondedw, I don't understand how you want to improve that
09:47edwScary having a very easy-to-use "rm -rf...".
09:47edwedbond: Oh, I just wrote that since asking my original question.
09:48edbondyou can add a global filter to remove only in *working-directory*
09:49edbondor not remove at all, move somewhere to /tmp/<timestamp> :)
09:50edwedbond: I was looking at the code you referred me to, and, yeah, if you filtered based on the canonical name, removing only those files that are inside the canonical name of the directory you're deleting.
09:50edw...then you'd be a lot safe.
09:50edws/safe/safer/
09:55deadghostgood morning #clojure
09:55deadghosthow are you today
09:56hyPiRionsilent, mostly.
10:05mikerodI'm guessing that a .cljx source file cannot be compiled via clojure-maven-plugin ( from https://github.com/lynaghk/cljx ) .
10:14edbondom question: what is the difference bw set-state! and transact! ?
10:17fredyredbond: transact and update work on the the om state via cursors
10:17fredyredbond: set-state updates the react state
10:18fredyredbond: the latter is same as doing setState on a normal react component
10:18edbondcursor is like pointer in react state?
10:18fredyryes pretty much
10:18fredyredbond: denoting a particular sub state
10:19edbondhow can I (should I) convert map to cursor? I have a go block that set-state! and om says 'cannot build from non-cursor'
10:20edbondI call set-state in go block and got that 'non-cursor' error
10:20fredyredbond: not exactly sure
10:20fredyredbond: but do you create your om state in the om/root
10:21edbondyes, initial state is defined in om/root. Let me try refheap
10:21fredyredbond: sure
10:24edbondfredyr, here is a code - https://www.refheap.com/23335
10:24edbondI misuse build-all I think
10:25edbondadded w-row functions to refheap
10:26edbondI'm totally lost in components and state :)
10:28fredyredbond: im not really following where load-watchlist come into play here
10:28fredyredbond: and that's the only place i can see a set-state call?
10:28edbondah, it's called from will-mount
10:29fredyrah okay, in watchlist-table?
10:29edbondyes, I updated paste
10:30fredyrso in your code now, you only have the top level cursor
10:30fredyr`state` coming into watchlist-table
10:31edbondyes, how can I create cursors to some key in that state?
10:31fredyryou create new components using build
10:32fredyrwith `build` you can take the current state and specify a path to say which "substate" corresponds to that component
10:33fredyredbond: here's an example, https://github.com/swannodette/todomvc/blob/gh-pages/labs/architecture-examples/om/src/todomvc/app.cljs#L160
10:34fredyredbond: oh, i might be wrong here
10:34fredyredbond: the api has changed a bit since last i tried some code on it
10:38edbondfredyr, Thanks, I'll dig more into todomvc
10:38fredyredbond: sure, i would've digged more into it as well, but i have to get back to work unfortunately :)
10:39fredyrbefore you could use it like this: (om/build comment-list app {:path []})
10:40fredyrwhere the last part was a path that was used similar to get-in and update-in
10:40fredyrbut now im not sure
10:43fredyr:s
10:43mrhankyanybody used the servants library? does every function used in the worker need a defservantfn ?
11:00gfrederickswhat's the current situation for round-tripping clojure code?
11:01gfredericks(in the sense of parsing the code into a data structure and printing it back out)
11:05nDuffgfredericks: ...okay, now I'm curious too. I'm sure I've seen a library built for the purpose (retaining reader metadata &c), but I'm having trouble finding it.
11:08stuartsierraI think cgrand had some experimental stuff for that.
11:10hyPiRionAre you guys talking about rewrite-clj?
11:10hyPiRion(https://github.com/xsc/rewrite-clj)
11:10karlsa question about protocols: say i define a protocol in a namespace A and then want to use a method declared in that protocol in a different namespace B. i don't understand the mechanism that allows me to require the protocol namespace A and then do A/some-desired-method. can someone explain this quickly?
11:13`cbpkarls: you want an explanation on how it works or how you're supposed to use it?
11:13karlshow it works
11:14karlsdoes defprotocol somehow make that method available in the namespace the protocol was declared in?
11:14gfredericksstuartsierra: hyPiRion: thanks!
11:14`cbpkarls: you might wanna look at the source? :P
11:15matt444lein-cljsbuild documentation is a little week, how do you get it to bundle your external javascript dependencies?
11:15matt444I'm doing: :libs ["lib/base64.js"]
11:15stuartsierrakarls: Protocol methods are real Clojure functions. You can require/refer them just like any other function defined in that namespace.
11:15matt444and it doesn't work
11:19nDuffmatt444: :libs takes a list of directories, not files.
11:19karlsaha! that clears things up. thanks `cbp and stuartsierra
11:19nDuffmatt444: (at least, as I follow the example docs)
11:19nDuffmatt444: ...beyond that, (1) are you sure the 3rd-party library in question survives the Closure Compiler? (2) Is a reproducer available?
11:19matt444nDuff: are those javascript files or clojurescript?
11:20matt444nDuff: lein-cljsbuild doesn't complain
11:20nDuffmatt444: the former.
11:21nDuffmatt444: "doesn't complain" isn't the same as "leaves your code in a runnable state when it's done".
11:21matt444my code is in a runnable state
11:21nDuffmatt444: keep in mind that it's not cljsbuild that does the (potential) mangling here, it's Google Closure.
11:21nDuffmatt444: uhh. If your output included a runnable copy of the third-party library in question, you wouldn't be complaining (if I correctly understand the question).
11:22matt444ahh, misunderstood the question
11:22matt444No, my output doesn't contain the third-party library
11:22nDuffmatt444: Which level of optimization are you using?
11:22matt444none
11:22nDuffThen I'd need a reproducer to investigate with.
11:23matt444k
11:23nDuff(someone like dnolen might have an off-the-top-of-their-head answer, but I'm not...)
11:23matt444nDuff: do you happen to know the diff between :extern and :libs
11:23matt444:externs i mean
11:23nDuffmatt444: :externs takes a set of headers and uses them to avoid name-mangling.
11:23nDuffmatt444: it doesn't actually include those libraries into the output
11:24nDuffmatt444: it just makes sure your output will be able to successfully call things having those headers.
11:24nDuffmatt444: that's actually how I've always done interaction with third-party libraries -- I've never used :libs
11:24matt444so then how do you include them?
11:24nDuffmatt444: ...from the same place I'm including the javascript that cljsbuild emits?
11:25matt444ok, i don't understand what you mean
11:25matt444cljsbuild emits javascript that it compiles from clojurescript
11:26nDuffthe what and why of :externs is documented at https://developers.google.com/closure/compiler/docs/api-tutorial3#mixed
11:28matt444ok, I have a example project, where should I upload it?
11:29nDuffmatt444: github is always good. refheap, gist, &c.
11:31TimMchyPiRion: Do you think you can get ahold of eval in swearjurescript?
11:31hyPiRionTimMc: wish I could
11:31nDuffmatt444: ...to restate what I was trying to communicate above -- I *don't* directly include external libraries into cljsbuild's output, and don't try to. I pull them into the document or runtime being invoked the same way I'm pulling in cljsbuild's output.
11:31TimMchyPiRion: I feel like there should be a way to iterate over the properties of something.
11:32hyPiRionTimMc: Only way I've discovered yet is by iterating the metadata of a ns
11:32nDuffmatt444: AFAIK, the mechanisms for including raw javascript into cljsbuild's output all require that javascript to be written in such a way as to be compliant with the Closure Compiler's specifications.
11:32nDuffmatt444: ...and, well, rather a lot of 3rd-party code isn't.
11:32matt444nDuff: ok thanks, script tags it is
11:32UrukQuestion from a new user - what's the best idiomatic way to loop across/map across a java object array []? I'm looking at the amap docs and that looks right, but not sure what the ^arguments are about.
11:33nDuffmatt444: ...if you're going to turn on advanced-mode compilation eventually, you'll need to use :externs.
11:33llasramUruk: Just use `map` unless you have specific need (known performance issue)
11:33matt444ok, i will when i get there, thanks again
11:33llasramUruk: All JVM arrays are `seq`able, so the normal Clojure sequence functions work on them just fine
11:34sverihi, how would i add n-times the same element to a collection? (defn addXtoXsNTimes [xs x n]...
11:34llasramsveri: (into xs (repeat n x)) ?
11:35dnolenmatt444: if you have some random JS that won't play with Google Closure you can use :preamble now
11:36sverillasram: thx, i try thaqt
11:36nDuffOoh, nice.
11:37matt444dnolen: what does preamble do?
11:37dnolenmatt444: it just concatenates files to the beginning of the final output
11:37matt444perfect, thanks
11:38TimMchyPiRion: To clarify, this also applies to CLJS?
11:38hyPiRionTimMc: oh, that really depends I guess?
11:38hyPiRionYou need to be able to use ns-map on namespaces
11:39TimMcI think JS exposes some new things that CLJ doesn't provide, like being able to iterate over the properties of things.
11:39dnolenmatt444: CLJS React users share this problem - you might find the dev and prod build settings described here useful http://github.com/swannodette/om
11:40matt444i'm a cljs react user :)
11:40matt444thanks
11:41hyPiRionTimMc: hm, interesting
11:42hyPiRionanyway, the way I get eval in clj is by doing something like this
11:42hyPiRion,(-> #'+ meta (#((`[~@%](*))(*))) ns-map (#((`[~@%](*(+(*)(*))(+(*)(*))(+(*)(*))(+(*)(*))(+(*)(*))(+(*)(*))(-(*(+(*)(*))(+(*)(*))(+(*)(+(*)(*))))(*))))(*))))
11:42clojurebot#'clojure.core/eval
11:42hyPiRionit works better in clojure 1.0 because of the meta reader (^), so I only need ns-map by then
11:43TimMcNo vars in cljs, I think.
11:43hyPiRionTimMc: right, ns stuff is compile time? Not worked with cljs
11:43bbloomhyPiRion: right
11:43TimMcNeither have I. :-P
11:43bbloomprobably can do some hackery with aget and window
11:43matt444@dnolen using cloact right now but plan on trying om
11:43hyPiRionheh
11:44hyPiRionTimMc: Alright, we have a decent challenge then :p
11:44TimMcI think I can do it all with just "window".
11:45dnolenmatt444: nice Cloact looks pretty cool.
11:46TimMcHmm, maybe not. I can make "eval", but I can't just grab it off of window as easily as I could a map in CLJ.
11:49ro_stcemerick: thanks for all your awesome work on cljsbuild and cljx. can you tell me if it's possible to using both plugins' hooks in a project to get the auto build mode for each of them? or do i have to `lein cljx auto` and `lein cljsbuild auto` separately?
11:50ro_sti'm hoping i can somehow get a repl and both auto modes in a single jvm
11:53UrukWhat am I doing wrong here? I have a java array; (alength my-array) returns 28. I'm doing this: (map my-array (defn blah [x] (do-some-stuff-with x))) -- and the inner function blah is not getting called.
11:53klrrare there any intro to clojure for people new to java?
11:54ro_styou need to realise the result; map is lazy. wrap the (map) in (doall)
11:54ro_stalso
11:54chronnoUruk: also, defn is intended to be used as a top-level form
11:54ro_stinstead of defn, just fn
11:55ro_stdefn also places a var in the current ns
11:55Urukklrr: try this -- http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Clojure_for_Java_Programmers
11:55ro_stso (fn [x]) rather than (defn blah [x])
11:55Urukro_st: so fn is same form as defn, but without method name (anonymous fn)?
11:55ro_stcorrect
11:55Urukgotcha. Old hat to the concepts, completly new to clojure syntax
11:55ro_stdefn is actuall just sugar around (def blah (fn …))
11:56Urukso but the syntax is (map array function) and *NOT* (map function array) correct?
11:56ro_sthttp://www.braveclojure.com/ http://aphyr.com/tags/Clojure-from-the-ground-up
11:56Wild_Catjust checking, is there a difference between (defn- foo ...) and (defn -foo ...) ?
11:56ro_stthat's right Uruk
11:56ro_stWild_Cat: defn- marks the fn as ^:private metadata
11:56ro_st-foo is just a var name starting with -
11:57klrrso there are no resources for people who want to learn clojure and utiliaze java interop but with no previous java knowledge?
11:57ro_stconventionally used in 'internal' protocols and such
11:57Wild_Catro_st: OK, so what's the purpose of the latter? I've seen it a couple times, but can't grasp what it's used for?
11:57ro_stklrr: java interop is pretty minimal. clojure.org/java_interop
11:58klrrdo you need to know java in-depth to utiliaze it?
11:58ro_stno java knowledge: there must be loads of info out there :-) it's a fairly popular language
11:58ro_sti'm ok and i've never written any java. lots of other similar things, but not java itself
11:58klrrokey
11:59nDuffWild_Cat: the cases you've seen it probably have been situations where gen-class is used with its default settings
11:59ro_stpick one of the links above and go through it. you'll learn enough to get moving
11:59klrrdo you need to know OOP to utilize it is it just to call functions from java?
11:59Wild_CatnDuff: probably, yeah
11:59nDuffWild_Cat: ...where the prefix it's expecting for functions exposed to Java is -
11:59ro_stgotta run
12:00Wild_CatnDuff: ah, I see. Thanks.
12:00UrukClojure java interop -- good documentation: http://clojure.org/java_interop
12:12mikerodHmm, looks like the latest counter clockwise 0.22.0 stable doesn't upgrade in (my) Eclipse; with error concerning: Missing requirement: Counterclockwise Fragment for Eclipse 4 0.22.0 (ccw.core.e4 0.22.0) requires 'bundle org.eclipse.e4.core.contexts 1.3.1' but it could not be found Cannot satisfy dependency:
12:13mikerodanyone familiar with that one?
12:13clgvmikerod: upgrade worked just fine this morning
12:15mikerodclgv: What Eclipse version? I am dealing with version 4.2.1 here I believe
12:16mikerodI came across a similar error on 0.21.0 @ http://marketplace.eclipse.org/content/error/report/1414545
12:16clgvfrom 0.20
12:17clgvI upgraded on two computers so far with no problems from 0.20.0
12:20mikerodI'm coming form 0.12.3 stable
12:20mikerodI don't see where this version fits in the pattern
12:20clgvmikerod: oh. maybe thats the reason
12:21mikeroddoes this need to be deleted perhaps?
12:21clgvclean install, or try to install 0.20.0 before 0.22.0
12:21mikerodhmm ok
12:21mikerodthanks for advice, I'll try it out
12:21clgvI'd go for "clean eclipse install"
12:21clgvthere were changes on the update site which might be the reason for your problem
12:22mikerodok, that's what I am planning on trying
12:22mikerodI noticed the site seems to have changed
12:22clgvyes indeed
12:23clgvgood luck (should work) I gotta go
12:23mikerodcool, thanks
12:25zerokarmaleftwhat's with the inconsistency URL-parsing between java.sql.DriverManager/getConnection and clojure.java.jdbc/with-connection?
12:28zerokarmaleftseems like I have to dance b/w strings...e.g. "jdbc:postgresql:<subname>" vs "jdbc:postgres://<host>/<subname>"
12:32turbopapeHi guys,
12:33turbopapeI have a project that litterally makes heavy use of java interop,
12:33turbopapeany bad or good vibes you mind sharing in doing projects that basically are like writing java in clojure ?
12:34technomancyturbopape: if you can isolate all the interop to a handful of namespaces it makes things a lot more tidy
12:34technomancypossibly not always practical, but it's more pleasant
12:35turbopapeokay, but can we fairly say, that this is not where clojure shines technomancy ?
12:35turbopapeI mean, all of this importing and implicit casting,...
12:36turbopapeDo I pay a huge price for that ?
12:36technomancyit's still a hell of a lot nicer than doing it in Java if that's what you mean
12:37gfredericksturbopape: more opportunity for refactoring via macros compared to java
12:37turbopapetechnomancy I am sure, that's why I don't want to leave Clojure world :)
12:38gfredericksareduce is a good example of using macros to sane-ify low-level things
12:38technomancyI guess the question is whether it's practical to do the bulk of your work in terms of immutable values
12:39turbopapeYes technomancy cc gfredericks .
12:39turbopapeIt is basically a mahout project
12:39turbopapeit uses their arrays, etc...
12:40turbopapeAnd I'm afraid of the shift, so... besides, after googling, you don't see much people do mahout in clojure
12:40turbopapebut you find couple using mahout via scala, for instance,
12:40turbopapeso that's why I asked !
12:40llasramturbopape: I'm using it some. Mostly the vector and matrix impl
12:41turbopapellasram and are you okay with the shift code-wise and performance-wise ?
12:41llasramturbopape: I've got a 95% finished core.matrix implementation in terms of Mahout, but honestly mostly am using the Mahout API fairly directly, because startup time for core.matrix is a *beast*
12:42llasramturbopape: Yeah, it isn't too bad. I've got a small wrapper lib for doing a few of the most-common operations w/o hinting and letting you use IFns and Mahout Double/DoubleFunctions
12:43llasramI mostly do mutation w/in `reduce` loops, so I'm getting the benefits of mutable vectors, but the mutation is hidden across interface boundaries
12:43turbopapeHow heavy java projects compare, say, to scala , llasram ? cc technomancy ?
12:44llasramI'm afraid I don't understand your question :-)
12:44technomancyeh I've never actually written java; no idea
12:44rurumateturbopape: I don't know what mahout does exactly, but I've made friends with cascalog, which is pure clojure
12:45rurumatemaybe it's worth a look for you
12:45llasramrurumate: Er. It's built on Cascading, which shows through if you work with it a lot / deeply. For something much closer to "pure Clojure on Hadoop" check out https://github.com/damballa/parkour/
12:46rurumatehmm that's news
12:46turbopapellasram, technomancy rurumate : it's okay guys :) I need mahout for the machine learning algorithms, hadoop is just a backend there...
12:47llasramturbopape: For that it can vary quite a bit. Some things like the SSVD implementation are pretty flexible -- get your data in the right shape and you can essentially just invoke it
12:47rurumatellasram: methinks it's a "good thing" being based on cascading
12:48turbopapeI ask about scala as a fall back option : if it is a better java, and if I unfortunately need to write some raw java, just to benefit from "simpler interop", can something like scala save me ?
12:48llasramturbopape: For the classification and clustering algorithms, you end up needing to descend into a deep morass of partially-documented interfaces
12:48turbopapeand can I interop with Clojure ?
12:48turbopapellasram, ok. any pure Clojure options you heard about ?
12:48turbopapefor ML ?
12:49llasramrurumate: Depends on what you're doing. If you have a lot of joins, it helps. If not, in my experience it is a liability
12:49dnolenI don't suppose anyone's done a CSS grammar for Instaparse?
12:50llasramturbopape: It really depends on your needs. Weka has reasonable implementations of some algos if your data isn't too large. There's special-purpose libraries for doing SVMs like libsvm. Clojure-specific, I'm not aware of much
12:51rurumatellasram: I do some joins, yes. Have you tried a join in parkour?
12:51llasramBut ML algorithms are just algorithms -- rolling your own is always an option
12:52turbopapeyeah llasram ... that would also be an option...
12:52llasramrurumate: It depends on the join. Doing a "replicated" join is trivial just by directly loading your replicated data from the distributed cache. Doing a reduce-side join where you know one or both sides will fit in RAM is simple.
12:53llasramParkour has no direct support for Cascading-style reduce-side joins with arbitrary numbers of records on both sides, but IMHO those are a huge anti-pattern, and you should re-write any job depending on them
12:55rurumatellasram: well in the joins I do, usually both inputs are over 10 GB so would not try to fit any of them in memory / distributed cache
12:55rurumatebut access to distibuted cache is a plus for parkour, yes
12:55llasramrurumate: For the reduce-side "fit in RAM" I meant for an individual grouping key
12:56rurumateoh. well then, got any example code?
12:56llasramFor joins? Not yet, but I should add one to the Parkour examples
12:56riley526For somebody familiar with Backbone for typical JS applications, is it worth trying to shoehorn Backbone in to ClojureScript for the REST-y models? Better alternatives?
12:56rurumateyes please
12:57rurumatejoins are super useful
12:57rurumatethey are what drove me from clojure-hadoop to cascalog
13:03bbloomriley526: i'd definitely not use backbone w/ cljs, since what backbone does is so hilariously simple you can just recreate it yourself in a few dozen lines using our proper immutable data structures
13:03dnolenriley526: there's going to be significant impedance mismatch
13:04dnolenriley526: integration with React and Angular.js seems to involve less friction
13:05riley526dnolen: I've never used Angular though. You think the data model meshes with cljs?
13:05dnolenriley526: I can't say myself, but people seem to like using it with CLJS
13:05katoxI'd recommend to start with something like react ;)
13:06riley526dnolen: Ok I'll look into it
13:06riley526bbloom, dnolen: thanks guys
13:06riley526katox: The question is really about syncing models via REST, which Backbone does and React has nothing to do with.
13:07katoxriley526: angular is a mutation in a box, I can't image how to make that simple
13:07dnolenriley526: but routing isn't a particularly complex thing, there's an opportunity to construct something generic here for the ClojureScript community
13:08katoxriley526: you need to put everything into angular scope and broadcast + watch everything
13:09katoxriley526: the mismatch is right in the core
13:09riley526katox: yeah I hear you
13:09katoxriley526: that doesn't mean that angular isn't _very_ productive in js itself
13:09dnolenriley526: I personally prefer React myself, but I don't know Angular.js well enough to have an informed opinion - from the outside seems overly complex
13:11katoxit is complex once you dive into directives
13:12katoxI've never wrapped my head around when I'm inside and when I'm outside of angular processing
13:12riley526dnolen: how do you typically handle syncing data if all you're using is React? or do you even have that need?
13:13cespareIs visualvm the state of the art for clojure profiling?
13:13riley526I mean I could always right an ajax request for every endpoint
13:13riley526But that's been solved before for JS.
13:17nDuffcespare: YourKit is also pretty awesome.
13:18dnolenriley526: I would probably write a simple router
13:19nDuffcespare: ...unfortunately, they only occasionally offer personal licenses (at less than full price) -- they had that running for a bit this month, but it looks like the window closed.
13:19cesparenDuff: would it supplant or supplement visualvm?
13:20nDuff...waitaminute, today's the 13th, so that should still be open.
13:20nDuffcespare: full replacement.
13:20cesparenDuff: s'ok, i'm sure my company will buy it if it's useful
13:21Wild_Catdakrone: just submitted a clj-http pull request for the {:as :json-strict} we talked about the other day.
13:21dakroneWild_Cat: great!
13:22cesparenDuff: can it operate from the commandline? Or at least collect a profile that way? Right now I'm using visualvm over ssh -X and it's quite painful
13:22Wild_Catdakrone: this is my first non-basic-typo pull request to a Clojure project, so be sure to review it thoroughly before merging :p
13:22dakroneWild_Cat: will do
13:22nDuffcespare: yes, collection can happen via CLI only, or over a socket.
13:22nDuffcespare: ...I'm surprised you can't do that with VisualVM too.
13:24cesparenDuff: alright, thanks for the suggestion. I'll check it out.
13:24katoxdoes anyone know what's the current state of cider regarding cljs?
13:24dnolenkatox: seems like people are working on improving it
13:26cesparenDuff: are you aware of a way to generate a blocking profile?
13:26cesparethe profilers i've found generate cpu and memory profiles only
13:26katoxdnolen: good to hear, what'll be next? code completion or even evals?
13:27dnolenkatox: gtrak is working on code completion, evals would be really simple
13:27katoxdnolen: awesome!
13:28cemerickkatox: evals? Like, a REPL?
13:28dnolenkatox: the ClojureScript analyzer exposes a lot of information, cider support could be awesome
13:28katoxcemerick: I got REPL working, thank to your austin
13:29cemerickkatox: ok, good. What do you mean by 'evals', then?
13:29katoxcemerick: buffer-to-repl connection
13:30katoxcemerick: I can eval stuff from clj into the repl, not the same from cljs
13:30nDuffcespare: "blocking" meaning lock contention?
13:31cesparenDuff: yes
13:31nDuffcespare: intrinsic locks it handles. Not sure about higher-level primitives.
13:33katoxanother super cool thing would be inspectable repl results
13:34katoxlight table has this gratis because of chrome developer tools
13:34katoxbut I'm on debian so I'll have to wait for 0.6 a bit to try it out
13:36cemerickkatox: still not sure what you mean; you should be able to evaluate files, top-levels, and individual expressions directly into ClojureScript from cider
13:36cemerickworksforme, anywa
13:37katoxcemerick: ok, then I have my setup broken in some ways
13:37cemerickkatox: Either that, or something has changed in cider (I'm still using nrepl.el, and C-M-x and C-c C-k both work well)
13:39katoxcemerick: not sure, but cider is trying to send the eval to clj not cljs repl, so it bombs out
13:40katoxcemerick: the repl itself is fine though I can get new stuff into it via cljsbuild auto
13:45cemerickkatox: yeah, that's broken somehow
13:45cemerickI'll bet cider is wrapping the expressions to be evaluated with its own (Clojure-only) code. Filing a bug would be appropriate.
13:47katoxcemerick: yeah, it could be something like that... I need to update to latest cider before filing a bug report though ;)
13:47katoxcemerick: did you try with the latest cider or was that a guess?
13:48cemerickkatox: total guess; sorry, I (foolishly) assumed you were already running the latest
13:49katoxcemerick: I'm running some very recent, but not the very latest
13:57cemerickkatox: ok; well, I'll be rebuilding my environment later this month, so cider will be fully cljs / Austin / piggieback-capable one way or the other. :-)
14:06katoxcemerick: okay, I updated and it certainly did something
14:07katoxcemerick: I got one command through (defn eval) but now I'm looking at frozen emacs ;)
14:07katoxcemerick: but at least it can differentiate between clj and cljs buffer
14:10loliveiraCan I use http-kit without calling httpkit/run-server? I am using lein ring server-headless to start the server and I believe I can't change it.
14:10technomancyuuuuuuse lein-run with a -maaaaaaaaain
14:12shep-werktechnomancy: instructions not clear; stuck in ceiling
14:12loliveiratechnomancy: I *need* to create a war file. I can't run "lein-run" in our production. =(
14:13katoxcemerick: but it seems to be (sort of) working, good, certainly not worse than before
14:13technomancyloliveira: oh, bummer =(
14:14loliveira=(
14:15loliveiratechnomancy: so.. no http-kit inside a war file?
14:15technomancysorry, I've never used http-kit or war files
14:17winkWAR! Hoo! What is it good for? YAY! Absolutely.. nothing!
14:17katoxdnolen: what's the intent of saving state on every change in wrap-form-element in om?
14:17squidzhow can I apply a funciton with variable arguments to a number of vectors and that returns a vector of each corresponding result? Example: (+ args) with [[1 2 3] [1 2 3] [1 2 3]] ===>>> [3 6 9]
14:18loliveiratechnomancy: thank you.
14:18dnolenkatox: our requestAnimationFrame model doesn't play well with form elements, this is just a hack to fix it
14:18dnolenkatox: "doesn't play well with *React* form elements"
14:19squidznvm I found you just pass map to apply as a second argument
14:20katoxdnolen: I though that it's there just to force a refresh if there is no change on app-state atom
14:20dnolenkatox: no
14:21loliveirawink: We are java software house. They decided that all apps must be delivered as war file. Corp stuff. =/
14:22winkloliveira: https://www.youtube.com/watch?v=r-bA9FYB8HY#t=0m55s in case oyu missed the joke ;)
14:22loliveirawink: =)
14:22tbaldridge"You-all"
14:25loliveirawink: thank you. I believe the reason for such restriction is that war files are "web scale". =) http://www.youtube.com/watch?v=b2F-DItXtZs
14:25winklol
14:26eggheadlol war file deployments
14:37justin_smithloliveira seems to be gone, but you don't need a war file on production, an uberjar plus java -jar works just fine
14:37justin_smithand yes, lein on production should not be done
14:37TimMcI've got the build gremlins from hell over here.
14:38TimMcWhen I run against a dependency pulled from a jar repository, I get one behavior, but when I lein install the same git tag I get different behavior.
14:38TimMcI compared the JARs and everything is identical except for some minor stuff in pom.xml and manifest.mf.
14:39ipostelnikcan someone explain the difference between (nil?) function and #(= nil %)
14:40joegallothe difference is a few characters of typing
14:40Wild_Catipostelnik: they do the same thing
14:40Wild_Cat(nil?) is nicer because it tells whoever's reading your code your intent much more succintly.
14:41ipostelnik(nil?) calls (clojure.lang.Util/identical x nil)
14:41TimMcI've confirmed that I'm not running with lein checkouts, and I'm trying again with a fresh m2 and source checkout -- what else should I check?
14:41ipostelnikand it's 5-7x slower on my machine
14:41TimMcipostelnik: According to what test?
14:42rurumatenot sure if in clojurescript, (= nil (aget x "foo")) (nil? (aget x "foo")) would be the same if x does not have property x
14:42rurumateproperty foo I mean
14:42dobry-dennoHistory is used in datomic for any facts that have no semantic of accreting, right?
14:42technomancyTimMc: slurp the .clj file's resource and diff that
14:42ipostelnikTimMc, according to my unscientific test on my machine
14:42TimMcipostelnik: Try with criterium
14:42gfredericksI'm trying right now
14:43TimMctechnomancy: As in, find a file that *could* have changed and make sure the REPL sees the same thign in both cases?
14:43technomancyright
14:44technomancyif you can isolate it to one ns
14:45TimMctechnomancy: I can't, but I'll give it a shot.
14:45gfredericks3.8 ns for nil? and 5.2 ns for (= nil x)
14:46nDuffhrm.
14:49ipostelnikgfredericks, that makes sense reading the code
14:52dnolenrurumate: the same
14:53TimMctechnomancy: I cloned a new repo, I temporarily moved m2, could not reproduce it -- and then I switched everything back and *it is working now*.
14:53TimMcMaybe I should remove [lein-gremlins "0.0.1-SNAPSHOT"] from my profiles.clj.
14:54technomancyyeah that one has a dependency on [lein-hallucinations "LATEST"] which you really don't want
14:55TimMcNote that I didn't even run 'lein clean' at any point in this process.
14:56stuartsierradobry-den: Not exactly sure what you mean. noHistory is usually for things like counters where you only care about the latest value.
15:10ro_stcemerick: that was me about cljx + cljsbuild on twitter. thanks for the responses. if you don't use lein-cljsbuild, how do you use cljsbuild ? via some nrepl middleware?
15:10sw1nnhi, anyone have opinions about the oldest version of clojure a library could/should legitimately depend on? I'm looking to update clj-aws-s3 and it's currently referencing 1.2.1? One of the deps [clj-time "0.5.0"] depends on 1.5.1 tho.
15:11ro_staustin is great but you don't want to manually evaluate all your code into the browser with it when resuming work on a project
15:11ro_stjust curious what your workflow is, because i really don't want to use `lein blah auto` if i can automate things better than that
15:13technomancysw1nn: 1.2 is old enough that you could see subtle weirdness around dynamic vars that it's probably not worth bothering with; no one's on anything older than 1.3 these days
15:13mrhankyhow do i write this in clojurescript? if(self.document === undefined)
15:13technomancyor anyone still on 1.2 is already going to expect nothing to work with their code
15:13mrhankywhat's "===" and "undefined" in cljs?
15:14sw1nntechnomancy: that was my thoughts, 1.3 + profiles for 1.4 and 1.5. sound right?
15:15technomancysw1nn: sounds good to me
15:15rurumatemrhanky: I think there's no way to write or obtain undefined
15:15cemerickro_st: generally only for automated testing, and build prior to deployment; piggieback handles all REPL use cases.
15:15nooniani think nil is equal to undefined in cljs but not sure
15:15rurumateaget will never return undefined, it will convert it to nil for you
15:16gfredericksnil is null I think
15:16ro_stcemerick: just so i'm clear, you start your repl up, start austin up, and then evaluate your top-level cljs ns and that gets everything loaded into the browser
15:16bbloommrhanky: === is clojure.core/identical?
15:16gfrederickslast time I checked which was likea year ago
15:16rurumate(.-x y) is probably the same as (aget x
15:16logic_progis there a more efficient way of doing (into #{} (filter ... set)) ?
15:16mrhankyi'll try (nil? self/document)
15:16bbloomrurumate: mrhanky: you can get undefined with js/undefined
15:17logic_progi.e. I want to filter on the set, but right now, it's set -> list -> filter -> list -> set
15:17gfrederickslogic_prog: reduce
15:17logic_progwhereas, I'd prefer set -> filter -> set
15:17noonianyeah, but if you have a value returned from some js call that is undefined, i bet (= undefined-obj nil) would return true or (nil? undefined-obj)
15:17rurumatebbloom: oh
15:17gfrederickslogic_prog: or apply disj I guess
15:17logic_proghow does reduce help?
15:17gfredericks(apply disj set (remove ... set))
15:17gfredericksor
15:17logic_progis this known to be faster
15:17logic_progor we are premature optimizing ?
15:17mrhankyboth are working, (nil? self/document) and (identical? self/document js/undefined)
15:18mrhankythx
15:18gfrederickslogic_prog: it was your question :P I'm sure it's gota be assymptotically faster; dunno about small sets
15:18noonianwhat is self?
15:18bbloommrhanky: rurumate: undefined is kinda a leaky interop thing. it gets coerced to nil in many cases
15:18gfrederickslogic_prog: well asymptotically better on GC at least
15:18mrhankynoonian, self = this in this case
15:19dsrxdoes anyone know of any idiomatic-ish cljs bindings for webgl? or if not, is three.js relatively painless to use from cljs?
15:19gfrederickslogic_prog: if you want to get really premature, use a transient since disj doesn't do that for you
15:19logic_proglol
15:19logic_progscrew this
15:20logic_proglet's write jvm bite code
15:20logic_progand hack fht ejit to make sure this hotpath is optimized for
15:20mrhankyjust tried to find out if my code is really running as webworker noonian
15:20logic_proggfredericks: this was very useful
15:20logic_progI'm going to stop worrying about this micro optimization until it becomes a bottleneck
15:25dsrxI tell myself that all the time and it never works :)
15:25dobry-denI have a dynamic Compojure app running on Ubuntu/Nginx. What kind of solutions should I start looking at if I want to get a better picture of what's actually going on? For instance, if someone is brute-forcing my /login path, what's the sort of solution people use to visualize that kind of stuff
15:26dobry-denI guess it would start with nginx's access logs
15:26gfrederickslogic_prog: I usually spring for things that at least honor how data structures were intended to be used
15:43dnolendsrx: https://github.com/Asakeron/cljs-webgl ?
15:43dnolendsrx: Three.js could probably work too.
15:45dsrxoh, as it turns out I had accidentally blocked github.com with the google personal blocklist extension
15:46dsrxdnolen: thanks!
15:50piranhadnolen: I'm a bit confused concerning update!/transact! in om. What's the right way to update nested map? (transact! cursor [:my :path] assoc :q) or (update! cursor assoc-in [:my :path] :q)? I'm just unsure what transact! is.
15:51dnolenpiranha: transact! and update! are conceptually the same, just different signature
15:51piranhaok, I was somehow confused by transact's name
15:51piranhaso I guess transact is intended to be used here, in other case it just wouldn't exist? :)
15:51dnolenpiranha: transact! is conceptually the important one
15:52dnolenpiranha: update! is just a sugar for the case where you don't need to provide a path
15:52piranhaI see
15:52piranhadnolen: thanks for clarification!
15:52dnolenpiranha: transact! name was intended to give a clue, you're changing the global application state, not component local state
15:53dnolenpiranha: it's a bit important as the global application state may have changed by the time an event handler fires
15:53dnolenpiranha: so in some cases you need to recheck your assumptions
15:54piranhamakes sense...
15:56sverihi, i just had a look at the repeat function in clojure and i dont get how this works, does someone know a blog post or something that explains repeat? why does it call itself? why doesnt it use recur?
15:58hyPiRionsveri: It has to do with laziness. I'll see if I can find a blogpost with the topic
15:58nDuffsveri: look into what lazy-seq does.
15:58`cbpsveri: it doesn't use recur because recur must be in tail position
16:00sverihyPiRion: that would be nice
16:00noonianbasically, you can write recursive functions that return lazy seqs without blowing the stack if you wrap your fn in (lazy-seq ...); it's like magic on crack
16:00sverinoonian: ok, that explains it a little bit
16:06gfrederickssveri: a lot of lazy-seq-producing functions are structured like that
16:06hyPiRionsveri: Yeah, I have some issues finding a good explanation of it, but it's essentially like this: lazy-seq is actually a macro, which makes a LazySeq object containing an anonymous function with the the body. If you try to do recur inside that anonymous function, you won't call the function you intended to cal
16:06hyPiRion*call
16:07gfredericksthat's half; the other half is why it doesn't blow the stack when you _don't_ user recur
16:07hyPiRion,(macroexpand-1 '(lazy-seq (this is my body)))
16:07clojurebot(new clojure.lang.LazySeq (fn* [] (this is my body)))
16:10gfredericks,(format "foo" 42)
16:10clojurebot"foo"
16:10gfredericks,(format "foo %s")
16:10clojurebot#<MissingFormatArgumentException java.util.MissingFormatArgumentException: Format specifier 's'>
16:10sveriok, i think i get it, at least enough to use it
16:10sverithank you all very much :-)
16:24bmath,(+ 1 2)
16:24clojurebot3
16:25bmath,"clojurebut does what I probably think it does"
16:25clojurebot"clojurebut does what I probably think it does"
16:32matt444Does anyone have a minimal http script that just serves static files?
16:33matt444nm, there's one in the guides
16:33technomancy`python -m SimpleHTTPServer 3991`
16:34TimMcclojurebot: Are you just gonna take that?
16:34clojurebotNo entiendo
16:41gfredericks(inc clojurebut)
16:41lazybot⇒ 1
16:43justin_smith(inc clojurebutt)
16:43lazybot⇒ 1
16:43gfredericksbut...could we do it with 3 t's???
16:43lazybotgfredericks: Yes, 100% for sure.
16:43gfrederickslazybot: I'm sure you're enjoying this game
16:44justin_smith*lazybutt
17:04bitemyappakurilin: http://www.meetup.com/SF-Types-Theorems-and-Programming-Languages/events/155960462/
17:04bitemyappjustin_smith: excellent name.
17:05slpsyschina basin? too far
17:06bitemyappslpsys: that isn't China Basin.
17:06bitemyappslpsys: it's SOMA
17:07slpsysis china basin just across the channel? i've actually been unclear on that
17:07bitemyappslpsys: yes.
17:07bitemyappslpsys: 164 Townsend is solidly in SOMA.
17:08bitemyappslpsys: having checked the map, all but the NE tip of townsend is in SOMA.
17:08bitemyappslpsys: how long have you lived here?
17:09slpsyshaha. five years, but i've only worked in the city for about 7 months, and i didn't really think about what to call that neighborhood when i was living in the city
17:27Node_347Would someone with experience in Ragtime and Korma mind taking a look at this gist to see if I'm performing migrations correctly? https://gist.github.com/arlandism/8408370
17:28mrhankyanybody here used servant library?
17:30bitemyappNode_347: tried it with something that isn't h2?
17:33Node_347<bitemyapp> No, I haven't
17:34daydreamtDamn you encog.
17:35daydreamtIs anyone using neural networks in clojure?
17:35bitemyappNode_347: well.
17:36mrhanky(:require [foo.bar :as bar] [foo.baz :as baz] [foo.bat :as bat])
17:37mrhankyhow do i write this shorter? something like [foo [bar :as bar] [baz :as baz] [bat :as bat]] ?
17:38justin_smiththat is valid, but not many people use that syntax
17:38bitemyappNode_347: that's cool, I can tell you the same thing on the mailing list.
17:38bitemyappNode_347: if you check the mailing list, you'll see I've suggested you try using something other than H2 to see if there's still a repro.
17:38stuartsierramrhanky: That feature exists as "prefix lists" — see the docs for `require` — but I find it hard to read and grep for.
17:39mrhankygood point with grep stuartsierra
17:40Node_347bitemyapp: Thanks!
17:40rasmustowtb gsexpp
17:42AWizzArddaydreamt: yes, I do.
17:42technomancymrhanky: check out slamhound for stuff like that
17:43daydreamtWhat libraries do you use AWizzArd? Everything I looked at, I looked at pybrain, then I looked back, then I cried.
17:43AWizzArddaydreamt: same here, so I implemented it myself :-)
17:43AWizzArdI have implemented an MLP and an RBM in Clojure which runs on nvidia’s CUDA.
17:44ruzuwhat about NFL or NBA
17:44daydreamtAWizzArd how easy would it to extend it to create arbitrary structures?
17:44daydreamtI wanted to do RNNs.
17:45daydreamtAWizzArd is it opensource?
17:45AWizzArdWell, probably this year I will add an LSTM.
17:45AWizzArdNot yet open, but not much speak against opening it.
17:45rasmustoCUDA MLP, RBM w/ LSTM?
17:46rasmustowikipedia disambiguation isn't helping me much :<
17:46daydreamtrasmusto they are types of neural networks
17:46AWizzArdrasmusto: cuda means it runs my code on the gpu. An MLP is a Multilayer Perceptron network, and an RBM is a restricted Boltzmann machine.
17:46technomancyyou get more ROI with an NIH TLA tohugh
17:46rasmustogotcha, didn't realize this was part of the neural network convo still :D
17:47AWizzArddaydreamt: which rnn are you interested in?
17:47rasmustoI tried to do a game of life on cuda once, with limited success
17:47AWizzArdAnd how you train it? :-)
17:48bitemyappI don't think clj would be my first pick for CUDA stuff.
17:48daydreamtAWizzArd, probably backprop
17:49daydreamtAWizzArd, not sure about the structure. That's why I wanted the library to be extendable
17:49bmathPCMCIA
17:49AWizzArdWell, total flexibility doesn't mix with gpus.
17:49ruzuMLB
17:49AWizzArdFor example, all neurons use the same propagation function, which is just the weighted sum for example.
17:50AWizzArdThis way everything can be expressed in Matrix operations and run on the GPU with massive speed.
17:50daydreamtThe fewer types of operations the better?
17:50AWizzArdIt can be many operations, but in principle every neuron needs to be treated in the same way.
17:51AWizzArdIn our brains each neuron has its own propagation and activation function.
17:51AWizzArdBut that beast also has a hundred billion processors <3
17:51AWizzArdvs 2k on gpu ;-)
17:51TimMcbrb, mining bitcoin on brains
17:51AWizzArdhaha
17:52rasmustoyeah, lots of neurons are wasted thinking about lunch in a real human brain, its not apples to apples
17:52daydreamtTimMc: whose brains?
17:52daydreamtTimMC: You just opened the door to a very dystopian future
17:52jjidoTimMc: always the pragmatic :)
17:52AWizzArddaydreamt: do you think backprop would work on RNNs?
17:53ruzuwon't be long before the nsa will require access to all of humanity's brains "because terrorism"
17:53AWizzArdruzu: you are aware that your words were logged, yes?
17:53bitemyappTimMc: Da Matrix.
17:54daydreamtAWizzArd, I'm just getting into RNNs, but the paper I read, I could swear they used some form of backprop.
17:54ruzushould i be concerned?
17:55AWizzArdWell, it’s planned to have such. I have one candidate that seems it can be trained.
17:55AWizzArddaydreamt: read Kurzweil’s book “How to create a mind”.
17:56bitemyapppeople take Kurzweil seriously?
17:56AWizzArdThis book is actually pretty good.
17:56bitemyappthat's like asking a scientologist for advice on your psych medication.
17:56ruzui'm notifying the scientology administration of your slander.
17:57daydreamtAWizzArd: they do use backprop. "Backpropagation through time" or something like that
17:57bitemyappruzu: spookay.
17:57logic_progwhat is the clojure.core.async stance on ">!" can't be used across functions (i.e. has to be within a lexical async/go block) ? Is the stance: (1) this is the way we like it and it will always be this way , (2) this is due to sucikness of the JVM and we will fix it , or (3) none of the above ?
17:58AWizzArdbitemyapp: just have a look at what guys wrote reviews to his book. Some top brain researchers. And even more important: I say it’s good \o/
17:59bitemyappAWizzArd: well, if you cherry-pick the right subset, you can find climatologists that deny global warming too
17:59bitemyappAWizzArd: I used to work alongside and live with a neuroscientist, we're a long ways away but making steady progress. Kurzweil is not the person you want status updates from, he's an enthusiast, not an authority.
18:00AWizzArdThis however is his bestest book.
18:00AWizzArdNothing new for a neuroscientist though.
18:00bitemyappAWizzArd: I liked L Ron Hubbard's Battlefield Earth the most, out of them all.
18:00bitemyappyou all should definitely read that one, since it was his bestest book.
18:03bitemyappAlways nice to see my beautiful compact little handler code get destroyed and sullied by the arrival of reality.
18:03dnolenlogic_prog: shallow yield is a good solution that sits well with Clojure, any more requires far, far more compiler support
18:03dnolen"well with Clojure's compilation model"
18:04logic_progdnolen: https://www.google.com/#q=clojure+shallow+yield is not very useful
18:04logic_progdnolen: can you point me at api docs to read ?
18:04dnolenlogic_prog: http://www.cs.indiana.edu/~sabry/papers/yield.pdf
18:05turbofailif you want to get around that you'll need delimited continuation support
18:05logic_progdnolen: does this mean "use https://github.com/swannodette/delimc " or is there another library you have in mind?
18:05dnolenlogic_prog: no
18:06dnolenlogic_prog: core.async gives you a weaker form of delimited continuations that's good enough for most problems w/o complicating the compilation model
18:06logic_progdnolen: let me rephase my question. how do I use shallow yield in clojure? what are good examples of shallow yifled in clojure?
18:06dnolenlogic_prog: core.async gives you shallow yield
18:06logic_progerr, so the ansewr is "shallow yifled does NOT provide what was asked" but is the best clojure does ?
18:07logic_progit's infuriating :-) that I can't put >! in functions unless I wrap them in go blocks ....
18:07logic_proggo blocks encourage me to write giant functions, whereas for all these years, I've been trying to get better at writing smaller, composable functions
18:07dnolenlogic_prog: you break things about into smaller go blocks
18:08dnolens/about/apart
18:08noonian__logic_prog: can't you just call >! on a channel in the go block and return the value on a new channel then return the channel?
18:09logic_progyeah, but then I end up putting <! everywhere
18:09logic_progbasically I have to sprinkled <! all over the palces, becuase functions on longer return values, but instead, return go channels that I have to read from
18:10jjidologic_prog: sounds like continuations
18:10logic_progdnolen: what is the best continuations library for clojure right now?
18:10dnolenlogic_prog: core.async
18:10logic_proglol
18:11bitemyapplogic_prog: call/cc was a bad idea anyway.
18:11dnolenlogic_prog: it sounds like you need to think about your problem domain more, or organize things at level higher then the abstraction core.async gives you out of the box.
18:11jjidobitemyapp: agreed
18:11powrtocdnolen: does anyone know how core.logic LCons works? I know it implements cons from scheme, but how does it work?
18:11turbofailyou wouldn't need full call/cc to provide a better yield, in fact it'd be easier to implement it using delimited continuations
18:11dnolenpowrtoc: the implementation is not that long :)
18:12bitemyapplogic_prog: there are better, less opaque, more reliable abstractions that can be composed in programs. Functions.
18:12turbofailthat said, supporting even delimited continuations would be difficult
18:12ruzuanyone happen to have read Clojure Data Analysis Cookbook, and have an opinion on it?
18:12jjidoturbofail: the trampoline works fine.
18:12bitemyapparrdem: god fucking dammit I was typing it
18:12powrtocdnolen: yes I've looked at it :-) I guess the likes of cache are confusing me...
18:12turbofailjjido: sure but you'd have to recompile all of clojure's standard library in that style
18:12technomancyarrdem: you jinxed it
18:13bitemyappI was going to say, a better abstraction is continuations from monads. Like: http://hackage.haskell.org/package/mtl-1.1.0.2/docs/Control-Monad-Cont.html
18:13turbofailand you pay a performance cost for all code even if you only use delimitd continuations in a small portion
18:13bitemyappNot least bececause it doesn't need to be reified to the compiler.
18:13jjidoturbofail: it's slow yes
18:13bitemyappBut also because it's fairly simple to understand algebraically.
18:13dnolenpowrtoc: cache is just to cache hashCode
18:14dnolenturbofail: jjido: and eventually you realize that core.async is an acceptable performant tradeoff
18:14powrtocahh so that's why it's mutable
18:14bitemyapphaving dnolen ignore me is proving advantageous so far.
18:14dnolenErik Meijer said so, so it must be true :)
18:14bitemyappI can teach without being interrupted, except by arrdem.
18:14bitemyappErik Meijer is an apostate.
18:14turbofailanyway many other languages have decided that a shallow-yield is good enough, and i agree for the most part
18:15jjidobitemyapp: away with monads
18:15bitemyappjjido: no
18:15jjidowaah
18:15technomancythere we go
18:16bitemyappUsing monads to teach a concept doesn't fall under convincing others to use Haskell, they're the just the only ones with documentation for things like Cont.
18:16bitemyappnot my fault >:)
18:17technomancyjust saying; got my eye on you
18:18bitemyapptechnomancy: you use monads too. Async. :P
18:19technomancyI was kind of amazed that when they introduced it, they were like "(by the way, this is technically called a monad, but you don't have to care about that right now)"
18:19technomancyI have never heard anyone introduce monads in a way that wasn't shouting from the rooftops about how amazing they are; it was quite unexpected.
18:19technomancy(in the ocaml book)
18:20jjidotechnomancy: nice closure
18:20bitemyapptechnomancy: it's not as much about amazingness as that they're the natural next-step from the relatively trivial HOFs Clojure leverages.
18:21bitemyappyou could hold your nose and pretend protocols were typeclasses to accomplish the same in Clojure.
18:21bitemyappnot that you'd enjoy it.
18:21bitemyappie, Fluokitten.
18:23bitemyapptechnomancy: you can do monads in OCaml but I haven't seen anybody mix different kinds of monads in a single function.
18:23bitemyapptechnomancy: I'm actually headed to a type theory meetup tonight where at least one or two people that worked at Jane Street will be present, I'll ask them about it.
18:24technomancybitemyapp: mostly talking about people who blog about "I finally understand monads and now you can too"
18:24bitemyapptechnomancy: every single one of those blogs I've seen have been unconscionably horrible.
18:24technomancyfollowed by incomprehensible rambling, right
18:24jjidoJane Street?
18:24bitemyappMonads are too generic to be explained like that. It's better to move into practical implementation and the algebra directly.
18:24technomancyjjido: Jane Street Async, yeah
18:24bitemyappjjido: Minsky's crew.
18:25technomancy"We don't have concurrency, but through the Power of Monads we can fake it!"
18:25bitemyappthat's pretty much it right there.
18:25bitemyapptechnomancy: functional inversion of control goes a long way :)
18:26technomancyit's much nicer than any other callback system in single-threaded runtimes I've used
18:26mrhankyare there any additional steps when installing jayq? i get this: Uncaught ReferenceError: jQuery is not defined
18:26powrtocWow core.logic has a datomic dependency? What's that for?
18:27bitemyapptechnomancy: I'd tend to agree. I'd still rather have 1:1 and N:M threading though.
18:27bitemyapppowrtoc: datalog?
18:28powrtocbitemyapp: Why would core.logic need that?
18:28arrdemtechnomancy: the main reason that I lurk here isn't that I like clojure, it's that bitemyapp is an unending font of cheap shot targets
18:28arrdemtechnomancy: the clojure is an added benifit
18:28akurilinbitemyapp: cool. I'm afraid I can't go tonight, demo day tomorrow, gotta wake up at 5 :|
18:29akurilinbitemyapp: Btw I'd love to know more about the ACL library/pattern you mentioned on the mailing list.
18:29technomancyarrdem: yah, I haven't written clojure in months
18:29akurilinbitemyapp: Is there anywhere I could read up more about on it?
18:29technomancyI'm here for the lulz
18:30arrdemtechnomancy: can't blame you. this is a really sharp croud :D
18:32dnolenpowrtoc: it doesn't have a datomic dep
18:35powrtocdnolen: on master datomic-free is listed as a dependency in project.clj... just wondering why... am I right in thinking datomic.clj extends core.logic unification etc... to datomic types?
18:35dnolenpowrtoc: "provided"
18:35dnolenpowrtoc: there's no hard dependency on datomic at all
18:36dnolenpowrtoc: the datomic namespace won't even compile if datomic isn't on your classpath
18:36dnolenpowrtoc: yes, it just an experimental namespace, Datomic still doesn't provide the right hooks for it to work
18:36powrtocdnolen: ah cool... I think leiningen has moved on a bit since I last did Clojure in anger...
18:36powrtocdnolen: interesting...
18:41powrtocdnolen: is the nominal logic and finite domain stuff complete these days?
18:42dnolenpowrtoc: more or less, there's more work to do w/ finite domain w/ respect to perf
18:43powrtocdnolen: cool
18:44technomancypowrtoc: Central won't accept poms with dependencies on non-OSS code
18:44technomancyunfortunately clojars is not as careful about that =\
18:44powrtoctechnomancy: ahh
18:44bitemyapptechnomancy: proper way to interact with a jar from Clojure code is lib/ right?
18:44bitemyappconfirming for a coworker that apparently needs to fiddle with some NLP whatevers.
18:44technomancybitemyapp: proper way to interact with a jar is from a repository
18:45bitemyapptechnomancy: is lein-localrepo a good idea? We don't have our own maven repo.
18:45technomancyif it's just for local exploration you can use lein deploy to get a jar into ~/.m2 for your own machine
18:45technomancyotherwise all it takes is a directory served over HTTP
18:46bitemyapptechnomancy: it's a flat standalone jar provided by a third party.
18:47bitemyapptechnomancy: thanks!
18:48technomancyyou can tell your co-worker it is totally OK to yell at anyone who thinks it's reasonable to distribute a jar that's not in a repository in 2014
18:48technomancytell them technomancy sent you
18:48matt444I'm following the ClojureScript getting started guide and when I attempt to compile I get this: http://pastebin.com/guqrk4Ue
18:48technomancyI mean if you're getting this from a 3rd-party
18:48bitemyapptechnomancy: I did, actually. I said who you were in the email :)
18:48technomancynice
18:50powrtocIs alphaKanren described at all in reasoned schemer?
18:50powrtocor is it only in the alpha kanren paper?
18:51matt444following these steps: https://gist.github.com/ninjudd/1098120
18:51matt444java 1.6.0_65
18:52noonian__matt444: what version of cljs are you trying to compile?
18:53matt444version of cljs?
18:53matt444i'm not compiling cljs
18:53matt444i'm compiling a .cljs file
18:53matt444https://github.com/clojure/clojurescript
18:53matt444master
18:54noonian__matt444: ah, from your gist you are using the cljs compiler directly and i've never tried that
18:54matt444then how do you compile?
18:55noonian__matt444: most people use the leiningen plugin lein-cljsbuild to compile cljs in a leiningen project
18:55matt444yes, i use that
18:55matt444but i have client side and node
18:55matt444so I use lein-cljsbuild for client side
18:55noonian__you can use it for both
18:56matt444hm, example project.clj?
18:57matt444just have a second :build
18:57matt444?
18:58matt444so how do you arrange your folder?
18:58matt444my client stuff is in src/
18:58noonian__yeah, second build
18:58noonian__something like this: https://www.refheap.com/23531
18:58bitemyapp"actual: java.lang.ClassCastException: datomic.db.Datum cannot be cast to clojure.lang.Associative" dATOMIC rage.
18:58noonian__just arrange your src directories accordingly
18:59matt444so if I move my files in src/ it's still going to be able to find the references?
18:59matt444where does your package.json go?
18:59matt444src/cljs/node ?
19:00noonian__i'm not sure what that is, i haven't really used node
19:00noonian__if you want to share code then you should have 2 src-paths for each cljsbuild build where one is shared between the builds
19:00bitemyapp"java.lang.IllegalArgumentException: Don't know how to create ISeq from: datomic.db.Datum" I am going to kill something.
19:00matt444i don't want to share code
19:01arrdembitemyapp: core.typed talk in an hour.. let you know how it goes.
19:01noonian__i mean, share code between both your builds, like share a common set of cljs utilities for instance
19:02matt444yeah, i don't need that
19:02bitemyapparrdem: I am atomic-raging at some type error / stupid data-type stuff in Datomic, let you know how many bodies I have to dispose of later.
19:02bitemyapparrdem: type theory meetup in ~3 hours.
19:02matt444that example doesn't have a output-dir
19:02matt444how do i handle that?
19:03noonian__:output-to "some/path/for/node/node-cljs.js"
19:03noonian__will stick your compiled js wherever you specify
19:04matt444yes, but there is also a :output-dir
19:06noonian__just make it different for each build
19:06matt444I don't think that project.clj is right, it doesn't have :target :nodejs
19:06noonian__https://www.refheap.com/23532
19:07noonian__yeah, i don't know about any node specific settings
19:09bitemyapp(bean dat)
19:09bitemyappClassCastException java.util.Date cannot be cast to java.lang.Number datomic.db.Datum (db.clj:219)
19:09bitemyappbreathe. Breathe Chris. Find your center.
19:11mrhankywhy does jayq.core gives me this: Uncaught ReferenceError: jQuery is not defined
19:11mrhanky:/
19:11bitemyappthe answer for the Daily Double was: (let [{:keys [e a v tx]} dat] (into {} [[:e e] [:a a] [:v v] [:tx tx]]))
19:12noonian__mrhanky: you probably need to include jquery in your page first
19:12mrhankyi have, i tried 2.x and now 1.9.x
19:13ivanis jQuery defined in the console?
19:13mrhankyyes
19:14Bronsabitemyapp: wouldn't (select-keys dat [:e :a :v :tx]) do?
19:14matt444I've had so many problems with lein-cljsbuild
19:14ivanmrhanky: are you using some Google API loader that will asynchronously load jQuery after your other JS runs?
19:15matt444Does anyone know where, with lein-cljsbuild I should put :target :nodejs
19:15noonian__stick it inside the :compiler map of each build
19:15bitemyappBronsa: lets find out!
19:16bitemyappBronsa: berossus.api-test> (select-keys dat [:e :a :v :tx])
19:16bitemyappClassCastException datomic.db.Datum cannot be cast to java.util.Map clojure.lang.RT.find (RT.java:733)
19:16bitemyappBronsa: no dice grandma.
19:16matt444noonian__ thanks for your patient help, i'll pastebin my config
19:16technomancybitemyapp: man; things that aren't maps
19:16bitemyappBronsa: confer with my previous angry messages to see why that didn't work.
19:16matt444noonian__: https://www.refheap.com/23536
19:17bitemyapptechnomancy: I was spittin' mad but my tests are passing now so just this once: http://i.imgur.com/J9NLYcI.gif
19:17noonian__matt444: np, here a blog post for nodejs setup with an example config that shows the compiler option: http://dannysu.com/2013/01/14/clojurescript-for-nodejs/
19:17noonian__matt444: looks good to me hehe
19:17technomancynice
19:17matt444hm
19:17matt444Why do they do :optimizations :advanced for node?
19:18matt444there's no reason to do that
19:18noonian__it will make your code compile down much smaller
19:18matt444code size doesn't matter in node
19:18matt444it's not going over the wire
19:18mrhankyivan, seems like codemirror produces this ._.
19:18matt444is :builds a vector or a map? I've seen both
19:19matt444mine is currently a map
19:19matt444it seems that almost no one is using clojurescript with Node
19:19noonian__i've seen both also, mine's a map
19:20matt444The word node only appears twice in lein-cljsbuild's project, both issues
19:21noonian__i've seen a few posts on people doing it but mainly for fun
19:22`cbplol @ those tweets
19:22matt444thanks for your help, i'll log an issue
19:23bitemyapp`cbp: I'm glad you enjoy my tweets of sorrow.
19:25mrhankyivan, i hade cljs code using (set! (.-onload js/window) (fn [] ...)), switched to jqueries ready
19:25mrhankysolved it
19:26Bronsabitemyapp: ouch, that sucks. what's wrong with {:e e :a a :v v :tx tx} anyway?
19:27bitemyappBronsa: it's absurdly tedious. I shouldn't have to create maps by specifying each attr/value pair and destructuring accordingly.
19:27bitemyappBronsa: datoms are printed as if they're maps, they should behave like ACTUAL maps.
19:27bitemyappthere is no reason at all for them to do otherwise except for projected Hickeysian torment.
19:28bitemyappthe pedantry in pretending they're not maps is doubly pointless in an untyped language where there's no real safety to be had anyway.
19:28bitemyappif you're in the mud already, play fuckin' ball.
19:29technomancybitemyapp: but inheritance is bad always
19:31bitemyappI'm anticipating my next resolved ticket to involve some (= (class ...) blah.WhoCares)
19:31bitemyappkill for a pattern match.
19:33technomancyI don't understand why every clojure codebase out there isn't using core.match now that the AOT bugs are gone
19:33technomancyis it still in the middle of a rewrite?
19:34technomancynot having pattern matching is pretty terrible
19:34bitemyappI gave up on it after having it breaking my code multiple times at different points in time.
19:34bitemyappbreak*
19:34bitemyappsimilarly to how I stopped bothering with c.j.j after the massacre of 0.3.x
19:34`cbprip
19:35bitemyapp(inc `cbp)
19:35lazybot⇒ 2
19:35bitemyapp(inc cbp)
19:35lazybot⇒ 1
19:35bitemyappfor good measure.
19:35`cbp:p
19:42scapebitemyapp: cjj?
19:42rasmustojava jdbc I assume
19:42coventry`Is this really the cleanest way to prepare a jar for submission to a storm cluster? https://github.com/nathanmarz/storm-starter/issues/51
19:44bitemyappI write some really dense test code.
19:45Wild_Catquick question: What's the accepted way in a Clojure test to check that some returned value is a specific vector (and specifically *not* the equivalent list)?
19:45bitemyappWild_Cat: vector?
19:45bitemyappWild_Cat: =?
19:45Wild_Catbitemyapp: I want the test to pass when the returned value is ["foo" "bar"] but not when it's '("foo" "bar")
19:45bitemyapp,(= [0 1 2] '(0 1 2))
19:45clojurebottrue
19:45bitemyappwell that's fucking stupid.
19:45Wild_Catyup, that's the issue :p
19:46bitemyapp:|
19:46bitemyappWild_Cat: (and (= ...) (vector? ...))
19:46Wild_Catright now I'm checking (= (type ret) clojure.lang.PersistentVector) but that's horrible
19:46hyPiRion^
19:46bitemyappWild_Cat: dude no. use vector?
19:46Wild_Catoh, I didn't know that function existed. Thanks.
19:47scape:)
19:47noonian__Wild_Cat: (and (vector? ret) (= ret v))
19:47bitemyappscape: I'm still scowling at the badness of that equality.
19:47Cr8,(map vector? [1 [] '() {} #{}])
19:47clojurebot(false true false false false)
19:47bitemyappCr8: good paranoia.
19:47bitemyapplol.
19:47hyPiRionor eventually (identical? x coll) if you know that a specific vector will be returned
19:47bitemyappThat makes = untrustworthy because vector is associative and '() is not.
19:48Wild_CathyPiRion: oh! Even easier. Thanks.
19:48noonian__most of the ops you do on vectors return lazy seqs though so you want that equality
19:48bitemyappso we still haven't learned anything from the egal paper. Sweet.
19:48bitemyappnoonian__: it's not really about that.
19:48Cr8= "do these things have similar insides"
19:48bitemyappCr8: sounds like JavaScript's == to me.
19:49bitemyappCr8: are you coming to the type theory meetup
19:49bitemyappSegFaultAX: ^^
19:49Wild_Cat,(= '(0 1 2) [0 1 2])
19:49clojurebottrue
19:49Wild_Cat(phew, thankfully that's commutative :p )
19:50Cr8Cr8: prolly not, I didn't sleep much
19:50bitemyappcommutatively...wrong.
19:50bitemyappCr8: be a man. Do the right thing.
19:50technomancybitemyapp: it's a bit weird, but I can understand the stance that laziness would be unbearably tedious without that quirk
19:50TEttingerok uh... my clojure game is really fast when run with lein, which defaults to a server JVM (an example command that does the same thing: java -server -jar myGame.jar). it's also really fast if I have a JDK installed and used for the java command. but... the java that is installed by default for users is the client vm, which seems at least 3x slower
19:50technomancybut it's definitely not egal
19:50bitemyapptechnomancy: Right.
19:50Wild_Catbitemyapp: yeah, sure, that sucks, but it's still better than it not being commutative or transitive
19:50bitemyapptechnomancy: if the lazy semantics were universal instead of ghettoized in a coll it wouldn't be necessary to fuck up the equality.
19:51Wild_Cat(not that I'm implying that Clojure is influenced by PHP or anything :p )
19:51bitemyapptechnomancy: one wrong decision causes another...
19:51bitemyappWild_Cat: well they're both untyped.
19:51technomancybitemyapp: right; because that doesn't cause *any* weird problems
19:51TEttinger(it takes a half second to process a keypress on client, it is almost instantaneous on server)
19:51bitemyapptechnomancy: I'm sorry, I can't hear you from my shining ivory tower.
19:51bitemyappwhere things just work
19:51BronsaWild_Cat: what if I told you == isn't commutative in 1.5.1?
19:52Bronsa,*clojure-version*
19:52clojurebot{:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}
19:52Bronsa&*clojure-version*
19:52lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
19:52bitemyappthat's old.
19:52Bronsa&[(== 1 1N 1.0) (== 1 1N 1.0 1M) (== 1 1N 1.0 1.0M) (== 1 1.0 1N 1.0M)]
19:52lazybot⇒ [true true true false]
19:52TEttingerdoes anyone have any tips for speeding up JVM clojure without the trick lazybot uses to launch another java command?
19:52bitemyappBronsa: oh sweet.
19:52Wild_Cateew.
19:52bitemyappPHP-jure.
19:53technomancyTEttinger: are you sure your users don't have access to the server JVM?
19:53Bronsabitemyapp: it's fixed since 1.6.0-alphasomething though
19:53TEttingertechnomancy, kinda
19:53Wild_Catall right, thanks for helping me make my pull request prettier.
19:53bitemyappBronsa: not really comforting.
19:53TEttingerI tried it on a JRE only java 7 install, up to date
19:53TEttingerno -server option there
19:53technomancyTEttinger: who are these mysterious users running on 32-bit boxes?
19:53TEttingermy mom.
19:53hyPiRionbitemyapp: that's just because loljava bigdecimals
19:54hyPiRion,(== 1.0M 1.00M) ;; etc
19:54TEttingertechnomancy, is it really a 64-bit only thing?
19:54clojurebottrue
19:54hyPiRionoh, that's fixed on master
19:54hyPiRion&(== 1.0M 1.00M)
19:54lazybot⇒ false
19:54technomancyTEttinger: no, it's only that 64-bit machines are server-only
19:54bitemyapphyPiRion: Datomic already drained my ability to care today.
19:54hyPiRionbitemyapp: hurray.
19:55technomancymost users don't even have access to client hotspot
19:55TEttingeron JRE, not JDK???
19:55lazybotTEttinger: Oh, absolutely.
19:55Wild_CatTEttinger: yeah, even on JRE
19:55technomancyTEttinger: pretty sure it's the same on both
19:55technomancythey never bothered implementing -client
19:55Wild_CatAFAIK the JVM installed by the JRE and the JDK is the same.
19:55bitemyappTEttinger: betcha wish ya had native binaries right about now >:)
19:56Wild_Catthe main difference being that one comes with the Ask toolbar -.-
19:56TEttingerbitemyapp, yeah. except haskell doesn't have any game libs.
19:56technomancyTEttinger: never heard of -server being missing
19:56technomancyyou could try tiered compilation maybe
19:57bitemyappTEttinger: well that's not true at all.
19:57bitemyappTEttinger: there's Helm, HGame3d, there's a whole channel devoted to it at #haskell-game
19:57TEttingeroh neat
19:57bitemyappTEttinger: you can use any dyn-libs via the FFI you want.
19:57technomancyRainCat!
19:57bitemyappTEttinger: most people use SDL for 2d, OpenGL for 3d.
19:57technomancyis adorable
19:57Cr8java hates me today
19:57TEttingerouch bitemyapp
19:57bitemyapptechnomancy: yes it is.
19:58bitemyappTEttinger: ouch?
19:58bitemyappTEttinger: I mean, if you want something like Unity3d, you're not going to get it.
19:58TEttingerraw OpenGL is not something I have had a good time with
19:58TEttingerI usually have used wrappers
19:58bitemyappTEttinger: so use GLUT or GLEW
19:59bitemyappTEttinger: http://www.haskell.org/haskellwiki/OpenGL http://www.haskell.org/haskellwiki/OpenGLTutorial1 http://hackage.haskell.org/package/GLUT http://www.reddit.com/r/haskell/comments/1tay08/modern_opengl_in_haskell/
19:59bitemyappTEttinger: OpenGL and GLUT are included in the Haskell platform by default.
19:59bitemyappat most, you'd install some headers.
19:59technomancydammit bitemyapp
19:59bitemyapptechnomancy: I'm helping him!
19:59technomancyyou're like one hour early
19:59Wild_CatHaskell has no games. It has generalized abstract game engine transformer transformer combinator transformers.
19:59TEttingeryeah, total rewrite is not helping
19:59Wild_Cat:p
20:00bitemyapp:(
20:00bitemyappTEttinger: is it on Github?
20:00TEttingeryeah, not the latest yet, because my current local copy is kinda broken ATM
20:00bitemyappTEttinger: link please.
20:00technomancyTEttinger: does tiered compilation work?
20:00TEttingerhttps://github.com/tommyettinger/dungeon-kingpin
20:01TEttingertechnomancy, I don't know what it is yet
20:01TEttingerand it seems to be Java 7 only?
20:01technomancyno, it's been around a long time
20:01technomancyit's faster in 7 though
20:01Cr8COME ON
20:01bitemyappTEttinger: your dangling ))'s are unholy in the eyes of god
20:01Cr8i keep getting outofmemoryerror java heap space
20:01bitemyappCr8: jack dat Xmx yo.
20:02technomancyTEttinger: it's a way of telling -server to start out as fast-launching and shift to high-perf over time
20:02technomancyan attempt at getting best of both worlds of -client and -server
20:02Cr8bitemyapp: I jacked it up to 8G :[
20:02bitemyappCr8: hahahahaha ouch.
20:02Cr8and all i'm trying to do is start a repl
20:02TEttingertechnomancy, but it needs to be the other way around...?
20:03bitemyappCr8: wat.
20:03Cr8lein repl; empty project; empty profiles.clj; out of heap
20:03technomancyTEttinger: not sure; it might be a way to force it into high-perf mode even if you can't invoke -server
20:03Cr8not really ..
20:03Cr8okay now it works
20:03TEttingerhttp://docs.oracle.com/javase/7/docs/technotes/guides/vm/server-class.html
20:03Cr8wait i lied
20:03Cr8it started a repl
20:04Cr8then i typed a character and i got it again
20:04amalloyhttps://github.com/tommyettinger/dungeon-kingpin/blob/master/src/dk/herringbone.clj -- best source file ever, TEttinger?
20:04TEttingeramalloy,I know right
20:05TEttingercode is data!
20:05Cr8https://www.evernote.com/shard/s17/sh/95196df9-343c-4170-ae86-214aeb84fd53/04497dbef41ff7e8b1c904a35d0fb1f4/deep/0/1.-apage43@Tyrathect----proj-tiny-(zsh).png
20:05TEttingerCr8, heh
20:05bitemyappCr8: what in god's name did you do to your JVM?
20:05TEttingerit is probably trying to load a ns
20:05Cr8i think i'm going to reboot my computer
20:06bitemyappCr8: Tyrathect!
20:06bitemyappCr8: I just read that book!
20:06bitemyappCr8: fantastic.
20:06TEttingerand then dying because you have a massive def or something
20:06Cr8that's my computer's name
20:06noonian__Cr8: if you have a :main key in your project.clj try commenting it out
20:06clojurebotIt's greek to me.
20:06Cr8bitemyapp: cool :D
20:06Cr8noonian__: I don't. This is a fresh lein new
20:06bitemyappCr8: reboot and try again?
20:07Cr8doing so
20:07noonian__lol, that sucks then
20:08arrdemtechnomancy: I love the new topic
20:08bitemyapparrdem: I'm very proud of that.
20:09gtrakhahaha
20:09Cr8well
20:09Cr8everything's fine now
20:09llasramAnother hour to go!
20:09Cr8user=> 1
20:09Cr81
20:09Cr8success!
20:09arrdemllasram: that means I have an hour to give my talk and get bitemyapp on dota so he doesn't steal more souls...
20:09gtrakvote for cljs compiler dumps! http://dev.clojure.org/jira/browse/CLJS-748
20:10technomancybitemyapp has set his alarm
20:10technomancytwo hours after ALLBALLS
20:10llasramheh
20:11Cr8,(vector? (first {:a 1}))
20:11gtrakonce we have that, we'd be about an hour away from an autodoc.
20:11clojurebottrue
20:11bitemyappCr8: seq of vecs
20:12bitemyappCr8: I have to memorize the types because I use an untyped language.
20:12Cr8,(class (first {:a 1}))
20:12clojurebotclojure.lang.MapEntry
20:12bitemyapppseudo-vecs.
20:12bitemyappfine.
20:12bitemyappinheritance?
20:12Cr8&(-> {:a 1} first class supers)
20:12lazybot⇒ #{java.lang.Iterable clojure.lang.Sequential java.io.Serializable clojure.lang.IPersistentStack clojure.lang.IPersistentVector java.util.Collection java.lang.Comparable clojure.lang.AFn java.util.concurrent.Callable java.lang.Runnable clojure.lang.ILookup clojure.lan... https://www.refheap.com/23557
20:13bitemyappA and I anyway.
20:13Cr8has APersistentVector
20:13Cr8yeah
20:20bitemyappfor datomic.db.Datum: #{clojure.lang.ILookup java.lang.Object clojure.lang.Counted clojure.lang.Indexed clojure.lang.IType datomic.impl.db.IDatum datomic.Datom datomic.db.IDatumImpl}
20:20bitemyappwell that's not nice.
20:20Cr8that's..
20:20Cr8short
20:20bitemyappCr8: did you see my smashing my head into them earlier?
20:20Cr8I did
20:26Cr8speaking of books, Don't Sleep, There Are Snakes was good, I read it on a plane a bit back
20:28Cr8w.r.t. your rt there
20:29Cr8though it doesn't actually go into much detail on the piraha language, the story was interesting
20:35insamniacTEttinger: Is dungeon-kingpin supposed to work? I can't pull down all the deps
20:35TEttingerinsamniac, that's odd
20:35TEttingerwhich deps can't it get?
20:36bitemyappinsamniac: I really like your name.
20:37bitemyappinsamniac: please tell me your given name is Sam.
20:37seangroveDeploying Clojure to Heroku in what seem like off-hours? Grab a drink, sit back, relax. You got loads of time.
20:38arrdemseangrove: really? it's always been pretty fast for me..
20:38seangrovearrdem: And you uberjar?
20:39bitemyappuberjars start faster, but are fatter.
20:39arrdemseangrove: I don't think so. I just used their git target with an uberjar->slug for their end.
20:39arrdem*configuration
20:39bitemyappbut I don't use Heroku.
20:40bitemyappbecause I build my own lightsabers.
20:40seangrovebitemyapp: Yeah, but I can compile them quickly locally, but letting whatever scraps heroku uses to compile them is painful
20:40technomancybitemyapp: whatever; I saw your keyboard
20:40_ericI have some tests where I want to slurp in some files to use in the tests
20:40_ericis there a convention for where to put the files and how to read them?
20:41bitemyapptechnomancy: that's @work, I use a MX cherry thingamajig at home with Linux.
20:41technomancyseangrove: we just opened up the API to accept 3rd-party slugs though so you can do it from a CI server or something
20:41technomancyplease don't build on your laptop =(
20:41bitemyappwe build uberjars on our dev machines here, lol.
20:41arrdem_eric: $PROJECT_ROOT/resources/*
20:41seangrovetechnomancy: That sounds good, but I'm wondering if we get much benefit from heroku/clojure over just using ansible + uberjar
20:41arrdem_eric: leiningen will put that stuff on the classpath for you.
20:41bitemyappseangrove: very neutral source.
20:42arrdem_eric: (slurp <filename>) should work.
20:42seangrovegoing on ~6 minutes on this push...
20:42_ericcool
20:42technomancybitemyapp: http://p.hagelb.org/disappointed.gif
20:42_ericis it only $PROJECT_ROOT/resources/ or is there a $PROJECT_ROOT/test/resources?
20:42seangrovetechnomancy: The API sounds nice though, it's the next piece of the workflow I'd like to setup - jenkins + push-button deploys of passing uberjars
20:43bitemyapptechnomancy: I knew what the gif was going to be before I clicked.
20:43hyPiRionyou know what
20:43arrdem_eric: you can put files wherever you want on the classpath
20:43technomancybitemyapp: damn; too predictable
20:43hyPiRionclojurebot: mystery |is| http://p.hagelb.org/mystery.gif
20:43clojurebotRoger.
20:43bitemyapptechnomancy: it's the first time you haven't surprised me though.
20:43bitemyappother than the rather common mystery.gif, but that one is always a delight.
20:43technomancybitemyapp: http://p.hagelb.org/tastes-mature.png
20:45hyPiRionbitemyapp: hey, I bet you've not seen this one before: http://hypirion.com/imgs/lenanign.png
20:45seangroveGo home hyPiRion, you're drunk
20:45bitemyapphyPiRion: why?
20:45bitemyappseangrove: francophones.
20:46hyPiRionbitemyapp: people misspell leiningen in many ways
20:46gtrakhyPiRion: she's in every image processing textbook.
20:47seangrovetechnomancy: Admit it, Clojure is so despised at Heroku that the only build servers allotted to clojure projects are the old coffee-grinders thrown out running in the back of McGranaghan's station wagon.
20:47hyPiRiongtrak: What do you want me to do? Attach a mustache to every single one of those images?
20:48r00k_Anybody here make much use of :pre and :post conditions for your functions? Do you feel like it pays off?
20:48seangrover00k_: I use :pre in quite a few places, it's pretty handy for sanity checks
20:48gfrederickshiredman: oh man I did not realize sneakyThrow was actually sneaky
20:48technomancyseangrove: I could show you some horrifying graphs that involve scala
20:48hyPiRionMaybe I should make an image detection plugin for my browser which automatically adds a mustache to Lena
20:48gfredericksI suddenly feel like I don't understand the java type system
20:48technomancyseangrove: we get tickets for 15-minute scala builds timing out on a regular basis
20:50r00k_seangrove: And you find those asserts blowing up often enough to feel worth the cost (time writing them, visual weight)?
20:50bitemyappseangrove: hahahahaha
20:50bitemyappr00k_: well in the absence of a sensible type system...
20:50llasramgfredericks: http://james-iry.blogspot.com/2010/08/on-removing-java-checked-exceptions-by.html
20:50seangrovetechnomancy: Well, we'll port over to RoR ASAP ;)
20:50bitemyappwhew, just typed defun in Clojure code.
20:50amalloygfredericks: in fairness, neither does java
20:50seangrover00k_: They're generally tiny
20:51seangrovee.g. {:pre [(not (empty? api-key))]}, {:pre [(integer? org-id)]}
20:51gfredericksllasram: thanks!
20:51r00k_bitemyapp: Yeah, I was going to ask if maybe we're just adding a poor man's type system.
20:51seangrovePoor, poor-man's type-system
20:51hyPiRiongfredericks: yeah, sneakythrow is generic abuse to the max
20:52arrdembitemyapp: 10 minutes till you can start pushing haskell
20:52amalloyseangrove: "tiny...(not (empty? x))" :( (seq x)
20:52seangrove,(seq "")
20:52clojurebotnil
20:52seangroveffs
20:53r00k_seangrove: Do they tend to blow up just when you're first writing the code that calls your function, or later when your data gets screwy?
20:53seangrover00k_: I put them in in the beginning when I don't want to write a full test, and take them out when things start looking solid
20:53r00k_Hah. (seq x) makes it *really* look like you just want a type system.
20:53amalloyseangrove: (empty? x) is literally implemented as (not (seq x)). there's never a reason to write (not (empty? x))
20:53gfredericksI guess the suggested idiom of "throw sneakyThrow(...)" is just to make it syntactically obvious that you're throwing something?
20:53seangroveamalloy: What about (not (not (seq x?))) ?
20:54seangrove;)
20:54r00k_Hah.
20:54amalloymaybe if someone put a gun to your head and said "start your preconditions with (not...or DIE"
20:54gfredericks,'not...or
20:54clojurebotnot...or
20:54r00k_Thanks for the input, seangrove. I appreciate it!
20:55Wild_Cathey, that's pretty cool: http://blog.travisthieman.com/write-you-a-starcraft-ai-in-clojure/
20:55gfredericks,(let [not...or identity, DIE 42] (not...or DIE))
20:55clojurebot#<CompilerException java.lang.ClassFormatError: Illegal field name "not...or" in class sandbox$eval73, compiling:(NO_SOURCE_PATH:0:0)>
20:55hyPiRiongfredericks: close, but no cigar
20:56insamniacthis game should be called dancing with ogres
20:57gfredericks,(def not...or identity)
20:57clojurebot#'sandbox/not...or
20:57gfredericks,(let [DIE 42] (not...or DIE))
20:57clojurebot#<CompilerException java.lang.ClassNotFoundException: not///or, compiling:(NO_SOURCE_PATH:0:0)>
20:58gfrederickshuh.
20:58llasramI'm really amazed you can `def` that
20:58gtrak,(read-string "clojure//")
20:58gfredericks,(let [DIE 42] (sandbox/not...or DIE))
20:58clojurebotclojure//
20:58clojurebot42
20:58gtrak,(read-string "cljs//")
20:58clojurebotcljs//
20:58gfredericksllasram: ooh you can use it fully qualified too
20:58llasramniiiice
20:58gtrak,(read-string "cljs.core//")
20:58clojurebotcljs.core//
20:58TEttingerinsamniac, haha
20:58gtrakdamn... I forget which one was broken :-)
20:59gfredericks,(def .......... 7)
20:59clojurebot#'sandbox/..........
20:59llasramgtrak: It's been fixed
20:59gtrakoh really?
20:59gfredericks,(* sandbox/.......... 2 3)
20:59clojurebot42
20:59llasram,*clojure-version*
20:59clojurebot{:interim true, :major 1, :minor 6, :incremental 0, :qualifier "master"}
20:59gtrakaha
20:59gfredericksoh man we can make unary helpers
20:59gfredericks,(def .. 2)
20:59clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
20:59gfredericks,(def ... 3)
20:59clojurebot#'sandbox/...
20:59gfredericks,(def . 1)
21:00clojurebot#'sandbox/.
21:00gfrederickswaaat
21:00llasram,`.
21:00clojurebot.
21:00gfrederickswhat is going on with 2
21:00gfredericks,(def .... 4)
21:00clojurebot#'sandbox/....
21:00hyPiRiongfredericks: lol
21:00gfredericks,(* sandbox/... sandbox/. sandbox/....)
21:00clojurebot12
21:00bitemyappyum. more arity type errors.
21:00hyPiRion,(+ . .)
21:00clojurebot2
21:01darthdeusfor all the light table fans out there http://blog.jakubarnold.cz/light-table-plugin-tutorial :P
21:01bitemyapphyPiRion: dafuq.
21:01gfredericks,#'clojure.core/..
21:01clojurebot#'clojure.core/..
21:01gfredericksoh maybe that is why
21:01llasramOhhhhh
21:01llasramYes
21:01llasramThat makes "sense"
21:01gfredericks:)
21:01gfredericks,(+ ... ...)
21:01clojurebot6
21:01Cr8wat
21:01hyPiRionoh, I got this
21:01gfredericks,(def ...... 6)
21:01clojurebot#'sandbox/......
21:01hyPiRion,(* ... (+ . ...))
21:01clojurebot12
21:02gfredericksclojure is a DSL for fans of unary who are allergic to 2
21:02hyPiRion"And today, in Swearjure part 2, we'll have a look at periods."
21:02TEttinger,(. toString 4)
21:02clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: toString in this context, compiling:(NO_SOURCE_PATH:0:0)>
21:02TEttingerno!
21:02TEttinger,(.toString 4)
21:02clojurebot"4"
21:02amalloynot so much clojure as clojurebot, gfredericks
21:02TEttinger,(. 4 toString 4)
21:02clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: toString for class java.lang.Long>
21:02TEttingerhm
21:03TEttingerthere is one though
21:03amalloy,(. 4 toString)
21:03clojurebot"4"
21:03gfredericksamalloy: oh good point
21:03amalloyyou can define .. for real in a repl you own
21:03TEttinger,(Long/toString 4 4)
21:03clojurebot"10"
21:03gfredericksyou mean I can own my very own repl?
21:03TEttingerthere we go, it's static
21:07hyPiRionoh, that's an interesting identity
21:07hyPiRion,(map #(->> % (Long/toString %) read-string (Long/toString %) read-string) (range 1 20))
21:07clojurebot(1 2 3 4 5 ...)
21:09gfredericks...it is?
21:09akurilinIf I wanted to keep my site's static html/css/assets separate from the .jar, it doesn't really matter where I place them, right? As long as I have a path to them and file system permissions, I should be able to keep those outside of the jar resources?
21:10akurilinI just feel dumb for putting assets in the jar, I have to build the ring app and restart it every time I need to make the smallest change.
21:10abakersure, but you can also build a war, explode the war, put in tomcat, and then mess with stuff all day long
21:11Cr8^~
21:11akurilinIs that still pretty simple? Because right now my setup is jetty daemonized by runit, which is as bare-bones as it gets and works reallyw ell.
21:12Cr8jetty should be able to run exploded WARs as well
21:12hyPiRionakurilin: You can place it separate from the .jar. That's what I've done so far.
21:12rovarI'm working through http://www.learndatalogtoday.org/ I see that they solve a combinatorial problem rather elegantly, and I also see that there was a bit of discussion on the mailing list about core.logic and datalog..
21:13rovarI guess my question is has anyone tried to tackle more complex problems with datalog.. like the travelling salesman or other optimization problems?
21:13rovarI'm actually interested in vehicle routing with constraints..
21:13akurilinhyPiRion: good to know that people do it.
21:13rovaror some variant therein
21:14hyPiRionakurilin: For me, I just placed `(route/files "/" {:root "my-directory"})` at the bottom of my main compojure defroutes, where my-directory are the static files
21:14hyPiRioner, the directory containing the static files
21:16akurilinhyPiRion: ok so it's just a regular unix path, I imagine through an env var or something of that sorts?
21:16hyPiRionakurilin: yeah, it's an env var for me, (and it can be relative)
21:17abakerrovar: sure, with SPARQL, which can map 1-to-1 with datalog
21:17akurilinhyPiRion: ok perfect, I love to shove everything into environ through our CM.
21:18akurilinI guess for some reason I thought there's be special rules to accessing files outside of the jar due to some JVM permission rules, but I guess an app is an app.
21:19hyPiRionakurilin: nah, standard ACL rules apply
21:21akurilinhyPiRion: great, thanks a bunch for clarifying that :)
21:21hyPiRionno problem
21:21hyPiRion:)
21:22afhammadHi, what is the base footprint for latest clojurescript projects after advanced compilation?
21:24rovarabaker, so you're saying you've done it on a graph database?
21:26abakerrovar: yeah - I work on Stardog, where sparql + reasoning/rules and such can be used to build all sorts of fun stuff
21:28rovarabaker, neato. I do big data infrastructure for a day job, but have been poking around with scheduling and routing optimization for fun..
21:30abakerrovar: yeah fun stuff, upcoming release we're adding higher level services for graph analytics, shortest path computations, finding cliques, etc
21:37_ericis there an efficient way to say "if ... else if ... else if ... else ..."?
21:38riley526_eric: ,(doc cond)
21:38_ericsort of like (case) works
21:38riley526,(doc cond)
21:38clojurebot"([& clauses]); Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil."
21:38gregorstockshey bitemyapp should i use haskell
21:38_ericsweeeet
21:38_ericyay!
21:38_ericthanks
21:39riley526np!
21:39_ericI just spent 10 minutes trying to figure out what I was asking for
21:40riley526_eric: Yeah some things can be tough to find if you don't know what it's called
21:47akurilingregorstocks: lol.
22:36logic_progwhat's a good name for something that is a message + a return channel
22:38Rayneslogic_prog: A portable post office.
22:38logic_progi'm trying to come up with good names for deftype / defrecord
22:39RaynesPortablePostOffice
22:39Raynes:p
22:44Cr8SASE
22:45llasramI was just thinking that too, Cr8 :-)