#clojure logs

2013-02-28

00:27pochoHow do I use map on a seq with access to the index in that seq?
00:28Raynes&(doc keep-indexed)
00:28lazybot⇒ "([f coll]); Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be included. f must be free of side-effects."
00:28amalloyITYM map-indexed, Raynes
00:28Raynes&(doc map-indexed)
00:28lazybot⇒ "([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."
00:28Raynesamalloy: Dude, I'm not on my das. Give me a second to type.
00:29amalloyalthough, pocho, you might consider writing such a function yourself - it's really not hard as a recursive function
00:29amalloyjust for education
00:30RaynesYou could do it with reduce.
00:30pochoI feel like I could write it, but it be really bad clojure. I would basically be writing C in clojure.
00:30amalloyyeah, but not lazily
00:30RaynesWell, stop writing C in Clojure.
00:30Raynes:p
00:32jeremyheilerLojure?
00:32clojurebotclojure is the best way to learn java
00:48muhooclojurebot: lol, you so silly
00:48clojurebotI don't understand.
01:02l1xhi
01:03l1xi havent been programming in clojure for 3 months and i forgot everything
01:03nopromptl1x: cool
01:04l1xhow can redirect to dev/null the nils when a function is returning (nil nil nil) ?
01:17SegFaultAXl1x: Don't use a function meant for its side-effects in a map?
01:26FrozenlockI notice that some clojure libraries aren't required by default in clojure 1.5. Is this only for the RC time, or is really for the release?
01:26jeremyheilerWhich ones?
01:26Frozenlockclojure.walk
01:26FrozenlockI had another one too yesterday
01:27Frozenlock..but my memory is failing me :(
01:27jeremyheilerWhat do you mean by "required by default"?
01:28FrozenlockWell in 1.4 I can do clojure.walk/postwalk. However in 1.5 I need to do (require 'clojure.walk) beforehand.
01:32jeremyheilerFrozenlock, It seems to work fine for me :-/
01:33jeremyheilerI pulled down 1.5.0-RC17 just now.
01:34FrozenlockWeird... I have RC16, but I'm too lazy to check now that I've required it in my namespace -_-
01:47l1xguys could you recommend a good yaml library for clojure?
01:51nopromptl1x: i don't know of one but if your application doesn't *need* yaml, maps can do the job
01:52nopromptl1x: you could even use edn
01:52pochoIs there a built in list data structure where I can easily pop off both ends?
01:54l1xhttps://github.com/lancepantz/clj-yaml
01:54l1xseems good
01:54l1xwhat is edn?
01:55akhudekpocho: https://github.com/clojure/data.finger-tree
01:56nopromptl1x: https://github.com/edn-format/edn
02:37michaelr525hello
03:11WokenFuryhey everyone. I'm looking for a way to decorate a datomic EntityMap. the behaviour I need is that when I do a (find) on the new object, it will look for the key in a bundled map, and if it doesn't find it, then it will hit the lazy EntityMap
03:12WokenFurye.g. I want to bundle :db/txInstant from the result into the entity, but since I can't assoc on the entity I can't use (:db/txInstant entity)
03:12WokenFuryand without that the code gets very ugly
03:27yunfancan clojurescript compiled on brownser?
04:19MrHusIs it possible to define a protocol (defprotocol) that works on defrecord classes not instances
04:19MrHusSo instead of responding to (Person. "Bert" 12) it responds to Person.
04:19MrHusOr is this only possible in multimethods
04:34clgvMrHus: can make a more detailed example. I am still wondering what you mean exactly
04:35clgv*can you make a more detailed example?
04:35MrHusI'm making a 2d game and for that game I'm making a map editor in clojure
04:36MrHusthe 2d game has a grid of squares when clicking on the squares things need to get added to the "level"
04:36MrHusfor instance when you click the grid and "Wall" is the active GameObject a wall should appear on that square in the grid
04:37clgvok. so how do you model that so far?
04:37MrHusSo I have a protocol called GameObject
04:37clgvok
04:37MrHusWhich Wall, Enemy and other stuff extend
04:37MrHusNo I want to set an atom
04:37MrHuswhich contains the current selected game object type
04:37MrHusand based on that type
04:38MrHusI want a clicked / dragged mouse event to add that particular type
04:38MrHusI could always write a gigantic cond statement ofcourse
04:38clgvMrHus: ah so you could set a factory function in the atom instead of the object type
04:39MrHusbut i already have the protocol so i was wondering if I could dispatch purely on type
04:39MrHusnot an instance
04:39clgvno not like that
04:39clgvMrHus: but you could encode the game object types as keywords and use a multimethod to construct the instances
04:39MrHusYeah I'm doing that now as we speak
04:40MrHusbut i was wondering if it were possible with defrecords
04:40clgvafaik you cannot add static methods to defrecords
04:43clgveven if you could you could not define a java interface that enforces a static method.
04:45MrHusI knew it was a long shot, but it was worth asking thanks clgv
05:00ljosIs -?> and -?>> still in some library somewhere?
05:04ljosFound them in incubator.
05:06ljosOr I could just upgrade to 1.5 and use some->
05:19mpenetot
05:19mpeneterr.. wront channel
05:19mpenetwrong*
05:20mpenetljos: this is in core.incubator
05:51ljosIs there an oposite threader? That returns the result of the first function that does not return nil? (or nil if all functions return nil).
05:59bruceadamsljos: clojure 1.5 introduces some-> which sounds like what you are asking for https://github.com/clojure/clojure/blob/master/changes.md#24-new-threading-macros
06:00bruceadams(opps, just saw that you mentioned that earlier... nevermind)
06:00ljosbruceadams: no. It does not do the same. some-> short-circuits the evaluation when one of the functions return nil.
06:01ljosbruceadams: I want to return the first result of the function application that returns non-nil.
06:01bruceadamsljos: ah, i mid read what you were asking for. i must not be awake yet.
06:02cemerickljos: there's probably something like that in swiss-arrows, but that way lies madness :-)
06:07ljoscemerick: oh god. What have they done? This is beyond awesome though. What is it that they say? "There is a fine line between genius and insanity."
06:07cemerickyup
06:08cemerickljos: the lonocloud folks have put out their own threading library that might be less...outlandish? :-)
06:11ljoscemerick: lonocloud/synthread doesn't seem to do what I want, though.
06:13cemerickthem's the breaks
06:15ljosswiss-arrows doesn't look like it either...
06:32ljosOh god. What have I done? Another threading macro is born.
07:10kittylystAnyone have a good example of using Monger operators with JodaTime dates?
07:11antares_kittylyst: http://clojuremongodb.info/articles/integration.html#cljtime_joda_time
07:12antares_kittylyst: because MongoDB Java driver is unaware of JodaTime types, Monger converts them to j.u.Date at the end of the day
07:13antares_kittylyst: so, just use DateTime and friends as if they were j.u.Date instances. If you have more specific questions, I'd be happy to find or add a test in the Monger test suite that demonstrates how to do what you want.
07:14kittylystantares_: Thanks. I'll also make a note to remind Trish to backlog an issue for JSR 310 dates for the Java driver for later in the year…
07:15kittylystantares_: I can't wait for j.u.Date to start disappearing
07:16antares_kittylyst: I'm afraid that's a few years away :)
07:16antares_kittylyst: anyway, let me know if you need specific examples, I am the author of Monger and clojurewerkz.org
07:17kittylystantares_: Thank you, I will. I also have another question :) - How do I get Monger to connect to a remote repset which requires a username & password?
07:18kittylystantares_: Tried both connect! & connect using URI. Neither seemed to work
07:19antares_kittylyst: this example is from the API reference: https://gist.github.com/michaelklishin/507d91cd33eacd2de107
07:19antares_kittylyst: it was contributed by someone a while ago so I think authentication was added later. Let me take a look.
07:21antares_kittylyst: ok, so you have to combine the example above that uses seeds and https://github.com/michaelklishin/monger/blob/master/test/monger/test/authentication_test.clj#L41, which takes a database and credentials
07:22antares_kittylyst: unfortunately, that's how mongodb java driver works: you first connect, then authenticate on a DB instance before performing any other operations
07:22antares_kittylyst: I will update the docs and think about how to make it suck less
07:26kittylystantares_: Thanks. I'll get it going as-is, and if you want feedback on a new API, buzz me here or on Twitter or Github
07:27antares_kittylyst: a new Monger API or the Java driver?
07:28kittylystantares_: Just a better way of handling auth for rep sets.
07:28kittylystantares_: I know the new author of the Java driver, so will have a word with her too :)
07:29antares_kittylyst: feel free to tweet @ClojureWerkz if you have anything to say about Monger :)
07:29antares_kittylyst: thanks. 10gen previously got in touch with us about the Java driver changes. It was before Trisha joined them, though
07:57madsyAny suggestions how I can implement the partition formula without recursion? http://upload.wikimedia.org/math/8/5/d/85d2425090db971709020599b2e5ff0e.png
07:57madsyThen I mean without recursion, not tail-recursion/recur
08:02clgvmadsy: consider implementing it as "dynamic programming" algorithm
08:50tsdhWhen running a test function defined with clojure.test/deftest, is there a way to know if the test succeeded? (programatically, of course)
08:54tsdhAh, (successful? (run-tests)) does the job.
09:04tsdhHm, in clojure.test, is the something like JUnit's Assert.fail()? E.g., I want to state that if the program low reaches that form, something has gone wrong.
09:05tsdhI can write (is false "Something's wrong!"), but that will tell "expected: false, actual: false" which is somewhat weird...
09:14kaoD,(boolean 123)
09:14clojurebottrue
09:14kaoDtsdh:
09:14kaoDthat will do the trick
09:15kaoD?
09:15kaoD*will that
09:15tsdhkaoD: No, I don't even get how that fits my question. ;-)
09:16antares_tsdh: (is false) or throw an IllegalStateException
09:16kaoDtsdh: oh sorry, I just woke up got your message mixed up badly
09:16kaoD*and got
09:16kaoDI can't even write lol
09:17tsdhantares_: (is false) prints that false was expected where's false was actual. That doesn't look like a failure: you got what you expected.
09:22tsdhantares_, kaoD: Ok, this gives halfway sane output:
09:22tsdh(let [aHyperEdge 'aHyperEdge]
09:22tsdh (is (= aHyperEdge nil)
09:22tsdh (format "ERROR: There's no HyperEdge with name \"%s\"." hen)))
09:22tsdh;; Produces:
09:22tsdh;FAIL in (validate-model) (core.clj:215)
09:22tsdh;Testing the rnext/next references of HyperEdges
09:22tsdh;ERROR: There's no HyperEdge with name "E17".
09:22tsdh;expected: (= aHyperEdge nil)
09:22tsdh; actual: (not (= aHyperEdge nil))
09:22tsdhQuite some dance to fail with a sane message in case something's missing, though.
09:36whilocemerick: ping
09:36cemerickhi
09:36whilocemerick: i stumbled upon your piggieback nrepl-middleware yesterday
09:37whiloworks fine with lein-cljsbuild so far, but in emacs i hit an endless loop with nrepl.el
09:37whilohttp://pastebin.com/CAiMTmCw
09:38whiloin nrepl.el repl i have evaluated: (require 'cljs.repl.browser)
09:39whilo(cemerick.piggieback/cljs-repl :repl-env (doto (cljs.repl.browser/repl-env :port 9000) cljs.repl/-setup))
09:39whilo(load-namespace 'example.hello) ; from lein-cljsbuild advanced example
09:40whiloand then just entering (and probably hitting auto-completion) "(sa)" is enough to trigger the endless loop
09:41whiloin a plain shell repl i can control the browser and don't hit that problem
09:41cemerickwhilo: try repeating the workflow from `lein repl`. It will likely work. I've never seen that particular error, so I'd suspect nrepl.el.
09:42whilocemerick: have done so, work from lein repl in plain shell
09:42cemerickah
09:42cemerickwhilo: can you do e.g. (js/alert "hi") once the browser-repl is set up, and see the dialog pop up in your browser?
09:42whilowith plain lein repl, yes
09:43cemerickok; well, code completion sent by nrepl.el will always fail on in a cljs repl
09:43cemerickthe question is just how loudly it ends up complaining
09:43cemerickand where, I guess
09:47whiloM-x ac-stop before evaluating, allowed me to execute (js/alert "hello") in emacs repl
09:47cemericksounds good, then
09:48cemericknrepl.el should try to shunt autocomplete errors to some other buffer or something
09:48whilocemerick: ok, so i guess i need to configure emacs to disable auto-completion for cljs files (?)
09:48whilook
09:48cemerickyeah, that'd be a sane thing to do
09:48cemerickat least until autocomplete uses a middleware instead of just pushing code around
09:49whiloyou mean emacs autocomplete modes or clojure side code?
09:49cemerickthe latter
09:49whilook
09:49cemerickwhilo: if you want to write up the result of this into a topic in the piggieback README, that'd be cool
09:49whilothx for your work btw. clojurescript still seems to be a lot like a moving target...
09:50whilocemerick: ok, will have a look, not sure if i can give proper info, but will try. will ping you with a pull request then...
09:52tsdhHm, is there something like clojure.walk/postwalk that I can use to remove elements from a deeply nested vector?
09:57cemericktsdh: ##(clojure.walk/postwalk #(if (and (vector? %) (< 2 (count %))) (subvec % 2) %) {:a {:b #{[1 2 3 4]}}})
09:57lazybot⇒ {:a {:b #{[3 4]}}}
09:58cemerickYou'll have to watch out to avoid modifying map entries though.
09:59whilocemerick: wow, evaluating from an emacs buffer in the browser feels even more vivid than in a clojure repl... bling bling :-P
09:59tsdhcemerick: No, my structure is more like [[:A 1] [:B [[:C 1] [:D 1] [:C 2]]]] and I want to throw out the [:C ...] vectors, no matter where they are contained.
10:00cemericktsdh: so just filter out vectors from other vectors that start with :C
10:00tsdhBut I think I got the idea.
10:00tsdhYes, yes, that's what I've thought right now. :-)
10:04tsdhThat does the trick:
10:04tsdh(clojure.walk/postwalk (fn [x]
10:04tsdh (if (and (vector? x) (vector? (first x)))
10:04tsdh (vec (remove #(= :HyperEdge (first %)) x))
10:04tsdh x))
10:04tsdh form)
10:14thalassios_xelonhello room :)) i want to represent a graph,i thought to use maps,what data structure do you normally use for graphs?
10:15pepijndevosthalassios_xelon: maps seem fine to me
10:16thalassios_xelonok thx
10:18pepijndevosThis is not strictly a clojure question, but here it is: I have messages coming in from multiple places, some of which might be the same message. I'm trying to store them in a database without duplicates.
10:19pepijndevosSince people might say the same things mutliple times, I can;t just make the message unique.
10:20pepijndevosI made timestamp+message unique now, but due to latency, this doesn't really work either.
10:39drorbemetHi, I want to partition a list A of strings by a list B of strings which accure in A. How do I do that in Clojure?
10:39drorbemetI have to keep the order in list A.
10:40bendlasdrorbemet: can you give an example with expected result?
10:41drorbemetyes
10:44drorbemetapplication: (partition ("a" "b" "c" "d" "e" "f" "g" "h") ("a" "d" "g"))
10:45drorbemetresult: (("a" "b" "c")("d" "e" "f")("g" "h"))
10:46drorbemetMaybe I nee another datatype but that whould be no problem.
10:50mpenetpepijndevos: what about uuids?
10:51mpenetnevermind, I didn't read the part about avoiding duplicates
10:51pepijndevosmpenet: the thing is, the messages are not unique. I just sorotf vaguely not the same at a point in time.
10:51pepijndevosright
10:52pepijndevosWhat I need to do is somehow, if I get three times "hi" from 3 clients, insert one, but if an hour later, I get"hi" again, it's probably fine.
10:52drorbemetbendlas: I think I have to write a map with a predicate function which I feed the key list.
10:53mpenetpepijndevos: hash of the content + some timestamp (with some precision that allows you to avoid duplicate per interval you choose)
10:54znDuffpepijndevos: Heh. This actually sounds like something I might use Esper for.
10:54znDuff(at least, if you had a lot of similar questions/problems in terms of doing temporal stream processing).
10:55pepijndevosmpenet: yea, something like that, but at the transition from one timestamp to the other you are again in trouble.
10:55pepijndevosznDuff: esper?
10:56znDuffpepijndevos: Stream-processing tool for Java. Has a rather extensive language for writing temporal pattern-matching rules.
10:56bendlasdrorbemet: partition-by with a set almost does it, hold on
10:57pepijndevosznDuff: sound like the thing. except maybe overkill, don't know
10:57drorbemetbendlas: ok
10:59bendlasdrorbemet: got a quick and really dirty solution
10:59bendlas,(map (partial apply concat) (partition 2 (partition-by '#{a e h} '[a b c d e f g h i j])))
10:59clojurebot((a b c d) (e f g) (h i j))
11:01bendlasdrorbemet: wait, it's buggy
11:01drorbemetbendlas: thanks :-) I try it und take it as a starting point
11:01bendlassorry, fails for
11:01bendlas(map (partial apply concat) (partition 2 (partition-by '#{a b e h} '[a b c d e f g h i j])))
11:01clgvdrorbemet: write your own `partition-at`. you can steal from partition-by ;)
11:02bendlasfails if two consecutive elements are in the set
11:02drorbemetclgv: ah that's an idea thanks
11:04drorbemetbendlas: thanks, I will spend some time on that one
11:06drorbemetbendlas: I think I will have to use state or recursion with a value
11:07drorbemetbendlas: no I dont't need to I just have to eat the key list
11:08pepijndevosznDuff: I think I might try cooking something up with queues and set or something like that
11:11dobladezhey, anybody here using github.com/8thlight/hyperion by any chance?
11:12dobladezin my current application I put together something similar (though much less sophisticated)... and was wondering if switching to it would be a good idea
11:12piranhaalandipert: are you by any chance here? :)
11:13alandipertpiranha: yo
11:13piranhaalandipert: oh wow, that's cool. :) I'm sorry for nagging, but I've got another issue yesterday and still not sure how to deal with it
11:13alandipertpiranha: np whats up
11:14piranhaalandipert: so the thing is that I want to render a list of items somehow, and each of those items has it's own template. So basically like parent template and a list of children templates. My thought was to get a cell of count of items (so I could re-create list when amount of items changes) and a cell for each item (so that it can track its own changes).
11:15piranhabut then... I couldn't invent how should I do that. I can show code which I used for flapjax for that
11:15piranhait probably should be a bit different, since you can't create cells in cell it seems %)
11:15piranhamaybe I'm missing some simpler way to do that?
11:18pepijndevosDoes every fn implement comparator? https://github.com/clojure/clojure/blob/d0c380d9809fd242bec688c7134e900f0bbedcac/src/clj/clojure/core.clj#L2681
11:19bbloompepijndevos: yes
11:20pepijndevosWhat would be the nicest way to make an object that compares by one property but equals based on another property? Metadata, or a new type?
11:21pepijndevosToo bad I can;t add metadata to a string :(
11:21alandipertpiranha: ah, micha does something similar to that in his todofrp w/ hlisp thing
11:21bbloompepijndevos: is your object immutable?
11:22pepijndevosbbloom: it's a string
11:22pepijndevosand a timestamp
11:22piranhaalandipert: I'm sorry, if you've answered, I haven't seen it - connection problems :\
11:22bbloompepijndevos: use a map: {:string "abc" :timestamp 123} with metadata
11:22alandipertpiranha: np, the thing to look at is micha's todofrp/hlisp thing
11:22alandipertpiranha: he makes a cell per UL
11:22piranhaah rihgt
11:23piranhaaha
11:23pepijndevosbbloom: the timestamp is the metadata, so it would just be a map with one string which seems weird.
11:23alandipertalandipert: he actually makes only a fixed # of cells, (50), and those w/ no value are hidden
11:23piranhaeh, I'll blame this on long flight, I should've checked it first :)
11:23alandipertalandipert: so he never dynamically adds stuff
11:23alandiperterr, piranha ^
11:24bbloompepijndevos: ah, yes, that's sucks because strings are a java primitive which are often interned by the runtime, so there is no way to guarentee that they are unique instances with unique metadata
11:24piranhaalandipert: hm, well, I'll check, but dynamically adding stuff is interesting, predicting amount of cells is a tough process :)
11:24bbloompepijndevos: are your strings known to be unique?
11:24pepijndevosright, so I'll have to wrap them in something
11:24pepijndevosno, they are know not to be unique even
11:24bbloompepijndevos: ok, then yeah, you need to wrap them
11:25bbloompepijndevos: you may or may not need the wrapper to be equatable
11:25pepijndevosalright…. (with-meta ["foo"] {:timestamp 123})
11:26bbloompepijndevos: yeah, that's a pretty simple way to do it
11:26bbloomnow ["foo"] will equal any other ["foo"] regardless of timestamp
11:26pepijndevosbut, yuk….
11:26bbloomalternatively, you can just make a blah= binary predicate and test with that
11:26pepijndevoshmhm
11:26bbloomunless you need to use these things as keys or something
11:26pepijndevosbbloom: qriority queue
11:27bbloom*shrug* it's not THAT yucky :-P
11:28pepijndevosyea, i'll survive the uglyness if it works
11:28bbloomwhere do these strings come from? what are in them?
11:28bbloomsymbols can have metadata
11:28pbuckleyis there a known issue with nrepl.el and C-c-C-d not bringing up the docs for Clojure 1.5? I've tried RC16 and RC17.
11:29pepijndevosbbloom: chat messages. I'm trying to sort out the duplicates that roughly have the same timestamp.
11:29bbloompepijndevos: ah, i see hm
11:29bbloomis there some known algorithm you're using?
11:30pepijndevosbbloom: so the plan is to put them in a priority queue sorted by timestamp and then I don't know yet. I can use contains on the queue or something….
11:31bbloompepijndevos: hm, might be a simpler way, but i ggotta run & can't think about it ATM
11:31bbloomgood luck!
11:31pepijndevosthanks
11:32casionis there any sort of 'intro to web dev' in clojure anywhere?
11:32TimMc_kittylyst: Did you figure out the JDK 8 crash yet?
11:32casionas in something for someone who's never done any web development at all other than basic html/css
11:32znDuffcasion: Hmm. Depends, to some extent, on what approach you want to take.
11:33znDuffcasion: ...for instance, there are some tutorials/presentations focusing on end-to-end ClojureScript (using node.js or such on the server)...
11:33casionznDuff: you're already above my head
11:33znDuffcasion: ...whereas the more popular Clojure-for-Java servers are based on Ring and Compojure.
11:34pbuckleycasion: there isn't much for someone who hasn't done any web dev at all
11:34znDuffcasion: Hmm. Maybe you might start at http://clojurescriptone.com/
11:34DaReaper5Hi, what is the best way to build a vector of results within a loop?
11:34DaReaper5I know map and for can do it but i need to use a loop
11:34casionI've been trying to read stuff for other languages, but translating concepts across is quite difficult when I'm not _at all_ knowledgable of ruby (or whatever language I find info with)
11:35pbuckleycasion: much like rails, there is a lot of assumed knowledge - and clojure gives you some really big, powerful tools that assume you have that knowledge
11:35casionpbuckley: and where would I find this assumed knowledge? everyone keeps pointing me to ruby stuff, and that is not working
11:35casionthank you znDuff
11:35DaReaper5would the best approach be to use "into"
11:35pbuckleycasion: this is a recent somewhat end-to-end post, http://clojure-lab.tumblr.com/
11:36hashbang1DaReaper5: that was my first thought, but I'm new to learning clojure, so there may be a better way
11:36pbuckleycasion: but not necessarily where you would find the assumed knowledge - by assumed knowledge I mean stuff like HTTP requests, routing, MVC architecture, talking to a database, session stores and cookies, javascript, etc
11:36casionI'm certainly not new to programming, or clojure... but lots of terminology in the web world that seems to be ethereal in definition
11:37pbuckleycasion: these are vast areas in their own respect - you end up bumping into them because they are great ways to not reinvent the wheel, but they have their own learning curves
11:38alandipertDaReaper5: conj?
11:38hashbang1casion: what languages are you most comfortable with outside of clojure?
11:38casionhashbang1: c, asm mostly
11:38casionobjc and c++ when needed
11:39DaReaper5alandipert lol i googled that and got the conference
11:40DaReaper5alandipert i think that is better than into because i am not trying to add an array to an array
11:40DaReaper5vector*
11:40alandipertDaReaper5: haha. but yes, clojure.core/conj - it adds things to collections
11:40DaReaper5yupp
11:40DaReaper5ill try it out. Seems to be what i need
11:41DaReaper5on a side note, loop was so confusing until i realized recur is initating recursion starting from the start of the loop and just replacing the args
11:42DaReaper5hated the docs for it :P
11:43gfredericksI'm seeing a memory leak in code (that does no DB interaction) only if I wrap it in clojure.java.jdbc/transaction
11:44brianwongsomeone point out what im doing wrong?
11:44brianwong#(take-while #(and (even? %) (< % 1000)) [1 2 3 4 5 1001])
11:44brianwong,(take-while #(and (even? %) (< % 1000)) [1 2 3 4 5 1001])
11:44clojurebot()
11:44brianwongim expecting (2 4)
11:44llasram&(even? 1)
11:44lazybot⇒ false
11:44alandipertbrianwong: 1 isn't even
11:44gfredericksbrianwong: you probably want filter instead of take-while?
11:45brianwongwell this is just a test
11:45DaReaper5gfredricks, i am not familiar with transaction but could it be tryng to open a transaction and then not closing it later?
11:45brianwongbecause im actually passing it an infinite lazy sequence instead of that test list
11:45alandipert,(filter #(and (even? %) (< % 1000)) [1 2 3 4 5 1001])
11:45clojurebot(2 4)
11:45gfredericksDaReaper5: it should be closing it; I believe the memory leak is the head of a seq being held on to. I have no idea how the transaction code would be able to do that
11:46DaReaper5hmm weird
11:46DaReaper5i use korma
11:46gfredericksDaReaper5: yeah I'm digging further; been on this for a day now
11:46DaReaper5dam
11:46gfredericksI wasn't debugging very effectively at first
11:47frenchypbrianwong: filter is lazy
11:48brianwongim not using filter
11:48brianwonglet me rephrase
11:48brianwongwhy does this return ()
11:48brianwong,(take-while #(and (even? %) (< % 1000)) (iterate inc 1))
11:48clojurebot()
11:50frenchypbecause the very first time it gets evaluated (on 1), the predicate returns false
11:50piskettiyup, it's never even
11:50pbuckleybrianwong: take-while will return results until the pred returns false
11:50frenchyp(take-while #(and (even? %) (< % 1000)) [2 4 6 1001])
11:50frenchyp,(take-while #(and (even? %) (< % 1000)) [2 4 6 1001])
11:50clojurebot(2 4 6)
11:51pbuckleysince it initially returns false, there's no "while" period for it to take during
11:52frenchypdo you need this behavior where the evaluation stops as soon as the predicate returns false?
11:53frenchypif not, you can use filter, which is lazy and will work with infinite collection
12:00brianwongok thank you for the explanation of take-while. I should have read the doc string more closely
12:00dnolenibdknox: hmm, d/l'ed LT 0.3, when trying to open a file I get a maximum call stack size exceeded error
12:01dnolenibdknox: actually not a file, a folder
12:02znDuffIs Light Table able to work with non-lein-based projects now?
12:02Ember-new lighttable really looks good, can't wait to test it
12:07Frozenlock,(partition 4 (range 3))
12:07clojurebot()
12:07FrozenlockAh... partition-all
12:14gfredericksdo jdbc transactions do something weird involving the JVM and GC?
12:17seangroveheh, "Everytime I update LT the syntax highlighting is reducing by the number of colors used. I expect the color theme in the final to be grayscale."
12:17seangroveWorth a chuckle
12:18pepijndevoshuh… When doing reify on java.util.Queue I get CompilerException java.lang.IllegalArgumentException: Can't define method not in interfaces: offer
12:18pepijndevosseangrove: *chuckles*
12:19seangroveGood ol' hn trolls
12:20arrdemoh LT made it to the front page again.
12:22gfredericksI'm starting to think that inside a JDBC transaction nothing created outside of it can be GC'd
12:22pepijndevosnm, I forgot this.
12:26hiredmangfredericks: if you look at the impl of the transaction macro, it creates a function from your code (which causes thing sto be closed over) and then executes it in a non-tail position
12:26hiredmanalthough I am not sure if tail position still matters for locals clearing
12:26gfrederickshiredman: oh that's an interesting point
12:27gfrederickshiredman: my current perspective is that if the lazy seq is created inside the transaction then it gets GC'd but not if created outside
12:28hiredmangfredericks: thunk it
12:29hiredman(fn [] (make-lazy-seq))
12:29gfredericksI'll try that in a minute
12:31gfrederickshiredman: delay should work just as well, right?
12:31hiredmanno
12:31hiredmandelays are effectively memoized thunks
12:31gfredericksoh poop of course
12:31gfredericksthat's why that didn't help yesterday :D
12:32gfrederickslast step is to try to reproduce this without JDBC
12:36gfredericksthis is harder than I thought o_O
12:36gfredericksthe thunk does fix it though
13:00ohpauleezThere are a few clojure configuration systems - environ is one - what's the other popular one?
13:00ohpauleezconfiguration?
13:00ohpauleezdoes clojurebot know configuration?
13:01joegallocarica is a thing https://github.com/sonian/carica
13:01ohpauleezTHANK YOU!
13:01ohpauleezthat's what I was looking for
13:01joegallogood choice ;)
13:02danlarkinaw yeah
13:16pepijndevosIs there a nicer way to do (future (Thread/sleep 5000) blah)?
13:17llasrampepijndevos: What are you trying to do? Schedule something for the future?
13:17joegalloperhaps https://github.com/overtone/at-at
13:18pepijndevosllasram: yea
13:18pepijndevosjoegallo: that sounds like the thing.
13:19pepijndevosor maybe I should just use ScheduledThreadPoolExecutor directly...
13:23gfredericksdoes a try with no catch or finally have significance to the jvm?
13:28dnolenhmm
13:29dnolenit would be kind of convenient if CLJS tracked protocols like ISequential so if you extend it, it extends to all implementers so you don't have enumerate them all, or put them all into default ...
13:30dnolenbut I guess that also doesn't really jive w/ the way protocols were meant to be used ... since protocols doesn't support extending to protocols ...
13:30dnolentype unions?
13:32gfredericksI've wanted to extend one protocol to another before. But I assumed I was supposed to feel dirty about that.
13:33llasramgfredericks: You should cut out a scarlet "OO" and pin it to yourself!
13:37pepijndevosI have constructed a fifo-set :D
13:39Licenserman I should never have named my project fifo and put a highlight on it
13:39pepijndevosLicenser: ?
13:39seangroveAny naming suggestions for a clojure firebase wrapper?
13:40Licenserpepijndevos I always get exited when my IRC client tell me someone said 'fifo' bercause I think they are talking about my project ^^
13:40frenchypanti-suggestion: firebaje
13:40dnolenhrm, re: optimizing invoke in CLJS
13:41dnolen... we could actually just modify Function prototype w/ namespaced property ...
13:41dnolenkind of dirty, but from the looks of it, zero overhead?
13:41pepijndevosLicenser: this one? http://project-fifo.net/display/PF/Project+FiFo+Home
13:41seangrovednolen: I've been thinking a bit about the naming convention cljs uses, adding .call and .apply to the String prototype - couldn't they be namespaced to avoid collisions, e.g. String.$cljs.call/apply?
13:42seangroveThis would at least avoid some collisions with other libraries where cljs has to play nice
13:42Licenserpepijndevos yup
13:43Raynesibdknox: Oooh, light table updatez.
13:43dnolenseangrove: probably, there's a ticket would take a patch. or somebody could do compiler constant literal optimization w/ keywords
13:43seangroveI assume it'd cause problems with the way actual functions are invoked (relying on Function.call/apply, but those could be aliased under the same namespace)
13:43seangroveSounds good, I was wondering if there was an inherent problem with the approach. Will try to take a look at it
13:44pepijndevosseangrove: bajure? :P
13:44seangroveI think I'll just use our normal random-japanese-word naming convention
13:45pepijndevosseangrove: why japanese? Okay, they have nice words, but french sounds more clojure-u IMO.
13:45seangroveMost of our stuff is already Japanese, just because
13:50dnolenhum
13:51dnolenit also means we can stop testing JS fns
13:52dnolenthey can also go through invoke
13:54Raynesibdknox: How is the paredit contracting coming along?
13:55scottjdnolen: does your twitter client format with newlines and indentation your latest tweet? (bc I was surprised that bitlbee did)
13:55dnolenscottj: I just use the OS X Twitter client, and it does format w/ newlines & indentation
13:56Raynesdnolen, scottj: I'm fond of tweetdeck in Chrome.
13:57scottjdnolen: ahh, my only other exposure is with the website which doesn't.
13:57dnolenhigher order RestFn case still tricky tho ...
13:57scottjRaynes: yeah that client is pretty cool looking.
14:15gfredericksminimal examples is (let [xs (range)] (#(dorun xs)))
14:16gfredericksI guess the moral is don't close over lazy seqs
14:16gfredericksexplicitely (with a function) or implicitely (with a macro that creates a function)
14:20gfredericks&(let [xs (range)] (#(nth xs 10000000)))
14:20lazybotExecution Timed Out!
14:22jcromartieso I have a few kinks to work out, but I think this text-to-speech doc reader in nrepl.el is going to be handy :)
14:23jcromartieneed a function to "explain" clojure code in English text
14:23jcromartielike translate [x, y, z] to "a vector of x, y, and z"
14:23gfredericksas long as you don't mind ambiguities
14:23jcromartieyeah
14:24jcromartieso far it's understandable
14:24jcromartiedepends on the quality of the docs
14:29amalloyjcromartie: i can't find a link to it now, but there's an algorithm that does a good job of translating C function signatures to english (and back, if you're careful)
14:30jcromartieyeah, I've seen that
14:30jcromartiecdecl
14:30nickmbaileyany tips for finding the offending 'try' when getting 'cannot recur across try'?
14:30gfredericksuhm
14:31gfrederickshow many tries do you have?
14:31amalloyah yes, that's the one. also relevant seems to be that you'll never really do a very good job of "explaining" the type of a function, since functions don't have type signatures like in (eg) haskell
14:31nickmbaileywell i had a few but i've re organized things so that it seems there aren't any 'try's wrapping this particular recur
14:32nickmbaileybut not according to the compiler
14:32gfredericksnickmbailey: maybe you have a macro that you're recur'ing from inside of?
14:32nickmbaileyi have a try in the let
14:32nickmbaileyperhaps thats causing it
14:32gfredericks,(fn [] (binding [*out* *out*] (recur)))
14:33clojurebot#<CompilerException java.lang.UnsupportedOperationException: Can only recur from tail position, compiling:(NO_SOURCE_PATH:0:0)>
14:33gfrederickshaha that's an even more confusing message
14:33nickmbaileyyeah i tried finding a macro with a try in it but didn't see anything
14:33mechazoidalanyone have any experience with clj-native?
14:33nickmbaileythis well teach me to wait so long to upgrade from 1.2
14:33nickmbailey*will
14:36tyler_what do variables that look like *this* mean in clojure?
14:36jcromartietyler_: they are intended to be dynamically rebound with (binding ...)
14:37nickmbaileyoh so 'binding' uses a try block?
14:37tyler_jcromartie: im not familiar with binding function yet so that doesn't really make sense to me ;)
14:38jcromartietyler_: OK, well it's not too terribly complicated
14:38amalloynickmbailey: yes, so that it can put the "pop" or "unbind" into a finally
14:38nickmbaileyso doing a recur inside a macro is generally not going to work?
14:38nickmbaileygot it
14:38amalloythat's sorta an implementation detail, but if you think about what binding and recur *do* you'll see that it's not possible to recur across a binding
14:39amalloyno, that's a poor conclusion to draw. you're more or less always inside some macro or other
14:39nickmbaileyfair enough, i'm thinking about the macros we've written which tend to use binding
14:39nickmbaileythat makes sense though
14:40jcromartietyler_: for example, to send all stderr to stdout, you'd do (binding [*err* *out*] …) so that any function call inside the body that uses *err* will get the value of *out* instead
14:41jcromartietyler_: it's like let (sort of), but for vars in calls deeper than the immediate scope
14:41nickmbaileythanks amalloy, gfredericks
14:41tyler_jcromartie: just looked it up on clojuredoc. thnx :)
14:42tyler_ironically th example doesn't use *var* convention
14:42nickmbaileyi wonder if we could special case the compiler to say "can't recur across binding" in that case
14:42jcromartietyler_: and any var that you do rebind must be marked with :dynamic
14:43tyler_jcromartie: i saw that :)
14:44jcromartiecool
14:52woppleI'm trying to make use of vim-foreplay and when I cpp to send code to the repl I get this error: https://www.refheap.com/paste/11938
14:52woppleeverything was working fine yesterday so I'm not sure why it's not working today
14:53woppleI started the repl with "lein repl" in the project's root directory in another terminal
14:57hashbang1wopple: did you connect to the nrepl inside vim?
14:58woppleI've tried using :Connect nrepl://localhost:[port] to connect and it looks like it works, but then still gives the same error
14:59woppleit used to work w/o having to enter the connect command
15:05pepijndevosIs it possible to do an INSERT … SELECT in korma?
15:06gfredericksprobably not
15:14amalloyi think i'll set my irc client to s/korma/korean, just to keep things interesting
15:16clizzini'm having an issue with leiningen where my java files import a class written using clojure (the namespace uses :gen-class) but when i try to build using lein, the java file complains about not finding the clojure class. it seems like the java is being compiled before the clojure gets compiled. any tips on how to fix this?
15:17clizzini do have the clojure class in question listed in :aot in the project.clj
15:17technomancyclizzin: leiningen assumes the java code is legacy and the clojure code depends on it rather than the other way around
15:17technomancyyou can change the order with :prep-tasks, which I think is covered here: https://github.com/technomancy/leiningen/issues/847#issuecomment-14072652
15:17technomancyhm; guess not
15:17technomancy:prep-tasks ^:replace ["compile" "javac"] ; should do it
15:18technomancyflipping the order is easier than arbitrary interdependencies
15:19clizzintechnomancy: let me give that a shot
15:19technomancyit's pretty rare to have java code that depends on clojure code, much less to keep the two in the same project
15:19technomancybut it should be possible
15:19clizzintechnomancy: my use case is that there's a bunch of java code that runs a servlet, and the servlet is written in clojure. so the java code needs to import the servlet class.
15:20clizzinokay, great, it worked for `lein run`. `lein compile` still fails though — i guess compile is still trying to run javac first
15:21SegFaultAXclizzin: Would it be hard to replace the Java part of your application with Clojure?
15:21clizzinSegFaultAX: yes
15:21clizzinit uses guice quite extensively
15:21SegFaultAXclizzin: Bummer.
15:21clizzinand i have no idea how to make clojure and guide cooperate nicely
15:21clizzinguice*
15:26SegFaultAXclizzin: Yea, no idea. Do people even use DI in Clojure?
15:27clizzinSegFaultAX: this looks like the best discussion: http://stackoverflow.com/questions/13085370/what-is-the-clojure-equivalent-to-google-guice
15:27hiredmaneverytime you def something you create a di point
15:28SegFaultAXhiredman: Exactly. It seems to me that HOF+vars alleviates much of the need for DI.
15:29SegFaultAX... which is basically what the linked article from clizzin says.
15:33tomojso why might javascript need DI?
15:33tomojno vars?
15:34tomojor maybe it doesn't?
15:38SegFaultAXtomoj: Isn't DI in js pretty much a big hack?
15:38SegFaultAXtomoj: Eg coercing the function to a string and inspecting the arg list?
15:39tomojor angular does like ['$foo', '$bar', function(f, b) { ...}]
15:40SegFaultAXtomoj: Well that's perferable I guess, because at least then the programmer can control exactly which types of dependencies are injected.
15:41wopplenow vim-foreplay is working again... not sure why
15:41tomojangular actually does both and cheats by showing the hack version in demos, then there's a side-note like "oh, yeah, by the way, you really shouldn't do that, you have to have this nasty array.
15:41SegFaultAXtomoj: But I thought Angular just used wonky names for parameters, eg `function foo($foo, $bar) {...}` (which can be easily yanked out if you toString the function, for example)
15:41tomojyeah
15:41Apage43angular actually even has a third way, which is to stick the list on the function object
15:41pepijndevosI seem to remember someone wrote a lisp in core.logic. any ideas?
15:43Apage43SegFaultAX: sort of, it actually tries DI on -all- the params, $ in front just signifies the service is built in to angular. if you see function foo($foo, $bar, baz, Blah) {} baz and Blah are also DI'd
15:43Apage43but are probably services provided by the user or a library
15:43SegFaultAXApage43: TIL. Thanks.
15:43SegFaultAXStill, it's a hack.
15:43Apage43quite
15:44Apage43*shrug*
15:44hashbang1wopple: haha, that describes my experience with it so far. real nice when it works, though.
15:44SegFaultAXAt least in Clojure you could use metadata. But DI probably just isn't necessary in Clojure, anyway.
15:44Apage43I feel the same way about method_missing
15:44SegFaultAXApage43: Ahhh, method_missing, feels good man.
15:44Apage43SegFaultAX: in Angular it's mostly used for swapping out those guys with different stuff when you run tests
15:46SegFaultAXApage43: That goes without saying. Testing is a big motivating factor behind DI to begin with.
15:46Apage43and to some extent a less ugly way to share stuff between components
15:47tomojI read an explanation that it was to avoid demeter violations
15:47scottjRich Hickey's Clojure/conj presentation just posted http://www.youtube.com/watch?v=ROor6_NGIWU
15:47tomojwhich struck me as odd, the DI system there seems to make demeter violations easier, not harder? but I don't understand DI or demeter anyway
15:48SegFaultAXtomoj: Testing is a *big* motivating factor, not the *only* motivating factor. :)
15:48dnolen_pepijndevos: you're probably thinking of symbol, it's not written in core.logic, just the type checker
15:48dnolen_pepijndevos: it compiles to C++, http://github.com/timowest/symbol
15:49pepijndevosdnolen_: ohwait, maybe I meant the thing at the conj unconference. They had a lisp right?
15:49dnolen_pepijndevos: hrm, I can't think of anything like that
15:50pepijndevoshmmmm, I'll have to rewatch the video. I'm pretty sure
15:50SegFaultAXpepijndevos: There was a demonstration of using miniKanren to generate lisp programs [that evaluate to 6], was that it?
15:50ravsterhey all
15:51pepijndevosSegFaultAX: exactly!
15:53enquoraneed a library that runs on server, in web browser and in iOS app - has anyone compiled to C via Scheme (Gambit or Chicken?) with production code?
15:53SegFaultAXpepijndevos: That's a great talk. I've seen two versions of it though, one at a Clojure conference and one elsewhere. The latter was better, IMHO.
15:53hashbang1has anyone given the latest lighttable release a try? Looks like another big UI overhaul.
15:54SegFaultAXenquora: You might have more luck in #lisp if you're looking for general lisp help. I think gambit and chicken have their own rooms, too.
15:54dnolen_pepijndevos: oh yeah Will & Dan's talk
15:55SegFaultAXdnolen_: They certainly have an interesting presentation style, don't they?
15:55dnolen_pepijndevos: relational interpreter stuff
15:55pepijndevosdnolen_: yea. I was thinking it could maybe generate quines
15:55dnolen_SegFaultAX: they
15:55enquoraSegFaultAX: referring to clojure/clojurescript in this instance
15:55dnolen_pepijndevos: yeah they wrote a whole paper about it
15:55znDuffenquora: The Clojure way to be portable to server, browser and iOS would be to compile to JavaScript, not to C.
15:55dnolen_pepijndevos: and Nada Amin has a alphaKanren based version now in core.logic
15:56znDuffEh? There's a Scheme backend for ClojureScript?
15:56pepijndevosdnolen_: they have a paper on the interpreter? what do i google for?
15:56enquoraznDuff: have considered running Javascript in the iOS app - would prefer a C lib, though
15:56SegFaultAXpepijndevos: They use Chez scheme in their talks.
15:56enquorahttps://github.com/takeoutweight/clojure-scheme
15:56SegFaultAXpepijndevos: And you can find the reference implementation of miniKanren on their site.
15:57ravsterenquora: woaaaahhh! Thats cool.
15:57SegFaultAXChez: http://www.scheme.com/ miniKanren: http://kanren.sourceforge.net/
15:57dnolen_pepijndevos: code, http://github.com/webyrd/2012-scheme-workshop-quines-paper-code
15:57enquoraznDuff: it's one of the attractions of Clojure - would like to hear from someone who's gone this route with production code, though
15:57dnolen_pepijndevos: latest version of the paper online I could find http://users-cs.au.dk/danvy/sfp12/papers/byrd-holk-friedman-paper-sfp12.pdf
15:57pepijndevosdnolen_: thanks :)
15:58dnolen_pepijndevos: core.logic translation http://github.com/namin/TAPL-in-miniKanren-cKanren-core.logic
15:59dnolen_requires core.logic master
16:00dnolen_enquora: ClojureScript is nearly there, server, web, iOS - maybe later this year
16:00enquoradnolen_: not certain what you mean wrt iOS?
16:00dnolen_enquora: JavaScriptCore
16:01enquoraah, k. run a Javascript library using JavascriptCore in its own context. but that can be done now, afaik
16:01SegFaultAXThey always have the strangest names for JS engines. "SquirrelFish"
16:02enquoraSegFaultAX: perhaps started at Moz with their dumb-ass references to Ghostbusters
16:03dnolen_enquora: yep Kevin Lynagh has already done something like this and has an on the App Store
16:03dnolen_has an app on
16:03SegFaultAXdnolen_: A clojurescript iOS app?
16:03dnolen_SegFaultAX: yes
16:04enquoradnolen_: haven't looked at performance implications, but I suspect JavascriptCore doesn't do jit - still prefer a C lib
16:04nightflyDoes clojurescript still depend upon Clojure for macroexpansion?
16:05dnolen_enquora: it may not JIT in a WebView, but I think it might if you use it directly. I have a friend doing OpenGL stuff w/ it and he's been surprised with the perf.
16:05SegFaultAXdnolen_: How does that work, exactly? Can you build native iOS in JS?
16:05enquoraSegFaultAX: yes
16:05dnolen_SegFaultAX: JavaScriptCore bridge to Cocoa
16:05enquorano need to tie it to html, can run in its own context
16:05mrb_bkdnolen_: have you seen https://github.com/phoboslab/Ejecta ?
16:05mrb_bkwe're playing with that at work
16:06SegFaultAXThat's pretty cool. Is it stable?
16:06dnolen_mrb_bk: yeah that's what Amit Pitaru my studio mate has been using.
16:06mrb_bkdnolen_: oh no way
16:07mrb_bkdnolen_: you can see commits from PP people in here :) https://github.com/phoboslab/Ejecta/commits/master
16:07mrb_bki'll have to tell tyler and sal that amit is working with it too
16:07dnolen_mrb_bk: haha cool
16:07mrb_bkthey've done some amazing stuff with it so far
16:07dnolen_mrb_bk: yeah Amit's been psyched about the framerates
16:08mrb_bkit's pretty impressive
16:08mrb_bkdnolen_: what's he working on?
16:10ttimvisheris there a way to rename keys in a destructuring bind of a map?
16:10dnolen_mrb_bk: hmm, I don't remember ... a game maybe?
16:10mrb_bkdnolen_: sounds about right
16:11ttimvishersomething like (let [{:keys [body :as x]} {:body "stahou"}] ...)
16:12ttimvisheri guess you can just mix the keys and regular destructuring. that works
16:12noprompt(let [{:keys [a b] :or {a "a" b "b"}} m])
16:13SegFaultAXttimvisher: This always seems easier to me for those cases: ##(let [{foo :name} {:name "SegFaultAX"}] foo)
16:13lazybot⇒ "SegFaultAX"
16:13noprompt,(let [{:keys [a] :or {a "bar"}} {}] a)
16:13clojurebot"bar"
16:14nopromptforgot you could do it that way
16:15SegFaultAXnoprompt: :keys is just a shorthand for that syntax.
16:15nopromptSegFaultAX: yeah, i just remembered after your example
16:16ttimvisherSegFaultAX: yep. it's nice that the :keys bind mixes with the verbose form well
16:16nopromptis there a difference between lazybot and clojurebot?
16:18SegFaultAXnoprompt: Yes.
16:18nopromptwhat's the difference?
16:19SegFaultAXnoprompt: They are different.
16:19llasramnoprompt: They have entirely different codebases
16:20SegFaultAXllasram: I wished you would have said "They have entirely different codebases, altogether". Then everyone in the room echos "They have entirely different codebases" /airplane reference
16:21llasramWell, next time
16:21ivanclojurebot can be used to flood the channel with thousands of lines, lazybot cannot
16:21noprompthaha.
16:27SegFaultAXllasram: Sorry, I'm really tired. :)
16:35RaynesYou can probably do it with lazybot if you try hard enough.
16:35nopromptha!
16:36noprompt(do it)
16:36noprompthaha
16:37noprompt(with lazybot…) oh dear
16:37ivanthat would be a reasonable idea if #clojure had any ops
16:38noprompti think i misinterpreted that.
16:39nopromptbeing ill has a funny way of tampering with your mind.
16:44enquoradnolen_: Just ran across infoq-hosted talk by yourself - at least I presume it's you. Have been wondering for some time how stuff ends up on InfoQ - it's the most unfriendly page design I've come across, especially for my primary personal computer. Do individuals choose to publish things there?
16:45dnolen_enquora: no, certain conferences publish there
16:45enquorahmmm. do they know that 1994 called and wants its html back?
16:46ivanI would have no problems with infoq if they let me watch at 1.3-1.5x or download a video that includes the slides
16:46nopromptenquora: yeah it's pretty bad. it's sites like that which make me wish there were vigilante ux developers.
16:46ivanmaybe I should ask for my money back
16:47ivanhttps://github.com/cykl/infoqscraper still doesn't quite work
16:47enquorawhat's this 'flash' thing they talk about, for instance. can't seem to find anything like that for my iPad
16:47rhg135Hello, I have this code http://pastebin.com/BpRFc7CL but strangely it seem that add-modules is not called, but calling it manually works just fine? any ideas?
16:47ivanenquora: iOS gets a <video> with no slides
16:48TimMcivan: clojurebot does not flood (as readily?) now that it concatenates output lines.
16:48TimMc,(repeatedly #(println "foo"))
16:48clojurebot(foo\nfoo\nnil foo\nnil foo\nnil foo\nnil foo\nnil foo\n...)
16:49ivanah
16:53amalloylaziness, rhg135. for is not a loop, as they say
16:53znDuffrhg135: would you consider pasting your code somewhere without the flashy, animated ads? A local favorite happens to be Refheap (written in Clojure)
16:53rhg135yep, I will,
16:54rhg135so map?
16:55nopromptrhg135: i think you may want doseq.
16:55rhg135ok, thank you
16:58gfredericksthe lein base profile wants lein-pprint?
16:58ravsterAm I correct in saying that putting an '@' before a regular function call is going to force the execution of that function (As opposed to it being lazy)?
16:58llasramravster: Alas, no
16:59znDuffravster: I think you want doall
16:59nopromptrhg135: also you could substitute -> with .. (.. pbx getListManager (addListener m))
16:59llasramravster: If we ask lazybot what @ means ##(quote @example)
16:59lazybot⇒ (clojure.core/deref example)
17:00znDuffravster: _functions_, though, aren't lazy as such (and aren't forced by doall); _sequences_ can be.
17:00ravsteroh, so its just an alias to deref.
17:00znDuffA reader macro for deref, yes.
17:00solussdCould someone tell me why what is passed as "func" isn't namespace qualified in the macro's macro expansion? : https://www.refheap.com/paste/56084cf40ec9fbabb8e9e6544
17:01ravsterweird. I'm trying to figure out why its in the datomic-simple codebase.
17:01ravsterfor their transaction functions.
17:03ravsteror datomico now, after the rename
17:03rhg135ok, it works, thank you.
17:04llasramravster: Well, you can make something `deref`able just by `reify`ing `clojure.lang.IDeref`. If they aren't using one of the standard reference types, probably have a custom IDeref to wrap up transaction results
17:08akhudekI'm trying to debug a ring performance problem (I think). A request is waiting on average 1.5 -2s (it returns an image from a database). The database query and forming of the response takes under 30msec. Connection is https to localhost. Where is the extra time coming from here?
17:08hcumberdaleHi there :)
17:08ravsterllasram: okay, will look into that. Thanks.
17:08hcumberdaleakhudek: tested with image as a slurped file?
17:09hcumberdaledatabases are a horrible place for images
17:09noprompti thought the first rule of database club was don't store images in the database.
17:09hcumberdaleespecially big images :D
17:09rhg135ok, another question, i used .. in add-modules and got a method not found, but with -> it worked, what is the difference?
17:10hcumberdalerhg135: -> is just a macro
17:10hcumberdale(,doc ->)
17:10hcumberdalehmpf
17:10noprompt,(doc ->)
17:10clojurebot"([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
17:10bendlasnoprompt: not so sure about that, isn't that what BLOB types are for?
17:10mechazoidalAnyone dealt with clj-native? Trying to figure out how to correctly pass strings for a char* parameter: https://www.refheap.com/paste/11948
17:11nopromptbendlas: me neither, i just blindly do what i'm told with regard to databases.
17:11noprompt:)
17:11rhg135yeah I understand, but why does it work with -> and not ..
17:11nopromptbendlas: a few books i've read mention that it's a bad idea.
17:12akhudekhm, wait time is only 9ms as a static resource, the extra time must be coming from the middleware
17:12hcumberdalenoprompt: blobs are the 'yes we can also store ... if we must' feature
17:12hcumberdaleakhudek: do you mean ring middleware?
17:13akhudekyes, the static file test was via a ring standard ring resource request
17:13noprompti guess i'd be curious to know what you gain by storing an image in the db vs somewhere else.
17:13bendlasnoprompt: OK, I'll have to agree, but not because of storage space, but because DB read capacity is a very scarce resource
17:13bendlaswith those legacy dbs that are not datomic ;-)
17:14hcumberdaleDatabase & Images. What kind of data is an image? Binary not kind of reference-integrity dataset
17:14akhudeknoprompt: it's for user uploaded content, so security basically
17:14bendlass/not/only/
17:14hcumberdaleFile systems are there for a reason :)
17:15hcumberdaleArgument for images in a database: Single point of backup
17:15bendlashcumberdale: +1
17:15noprompthcumberdale: now that i will agree with. +1
17:15hcumberdaleBut the tradeoff is performance. Seen databases with thousands of big images. Unload takes 6 hours.
17:16hcumberdale->leads to bad user experience -> lower turnover
17:16akhudekin this case, backup + having all the data in a single place is very important
17:17akhudekI'm not too concerned about the database latency at this point
17:17znDuffbendlas: ...Eh. Lots of ways to get read capacity if you don't need consistency guarantees.
17:17hcumberdaleakhudek: Big problem is that databases are not made for such things
17:17pimeyswell, at that point when you have 60 GB of data (text and numbers only) per day, you kind of appreciate that you're not storing images there
17:17hcumberdalebig blob data may have a big influence on the overall performance
17:18hcumberdaleznDuff: with DB2/ORACLE? no way
17:18bendlasbut I like my cosntinescy
17:18bendlas<-- ;-)
17:18hcumberdalebig argument :)
17:18OE,(* 1 1)
17:18clojurebot1
17:18akhudekhcumberdale: they typically have binary storage, though the serialization can be bad in large volume cases
17:19OE&(* 1 1)
17:19lazybot⇒ 1
17:19OEwhat's the difference between clojurebot and lazybot?
17:19bendlasOE: creator
17:19hcumberdaleakhudek: you're filling up the IO
17:19bendlasand , vs &
17:19bendlasprobably security
17:19OEi see
17:19hcumberdaleso IO issues are a major prolbem
17:19llasramThey're different codebases, altogether
17:20nopromptrhg135: can you repaste?
17:20rhg135yeah
17:20kovashmm
17:20hiredmanhttps://gist.github.com/hiredman/53f548674f05f007ee04 missing a port
17:20znDuffhcumberdale: Sure, there are asynchronous replication tools available for Oracle.
17:20hiredmanwhoops
17:21rhg135https://www.refheap.com/paste/11949
17:21hcumberdaleIf you have a pooled java connection and everything is read via, lets say "hibernate",... you'll live the dream of "IO-Big-Pain-In-The-Ass"
17:21znDuffhcumberdale: ...and read-heavy loads are actually a pretty good fit for RAC, if you've got that kind of budget.
17:21nopromptrhg135: i meant with the usage of ..
17:21hcumberdaleznDuff: RAC :)
17:21hcumberdaleGridControl. RAC is buggy, too complex and so on
17:22bendlasSee http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay
17:22rhg135just substitute the -> /w .. on line12
17:22bendlasfor me sendfile() to offload to nic is the best argument for FS
17:22kovashiredman: whachu working on?
17:22znDuffhcumberdale: I know RAC well -- once ran a RAC cluster on Gentoo, so had to deal with figuring out how to make everything work on an "unsupported" platform.
17:22znDuffhcumberdale: ...but _did_ make it work in the end.
17:22hcumberdale+1 storing file paths in the database to be best
17:22akhudekhcumberdale: yes, there are scaling concerns, though in our case the security takes priority. All the data is in one place with clear backup/retention policies, and when a user deletes things the database will make sure that all owned data will be deleted.
17:23hcumberdalewow gentoo & RAC. never seen this before
17:23akhudekmanaging a multitude of files isn't without it's problems either
17:23hcumberdalemanagers won't sleep without their gold/silver support agreements
17:23bendlaswell, I did a webservice that needs to store a couple of 100K jpgs now and then
17:23bendlasI'm glad I stuck to DB for that
17:23hiredmankovas: I am working on work?
17:24akhudekyou need to worry about the filesystem at some point, and tracking the files, and making sure that your database permission model is mapped over to the files correctly
17:24hcumberdaleI do not like the requirement of using databases.
17:24hcumberdaleN1 for every JEE project: let's setup JPA and hammer against a database
17:25hcumberdaleakhudek: like the FS permission model thx to POSIX
17:25hcumberdaleThink about every linux tool needs a DB connection to run ;(
17:25akhudekhcumberdale: so you will create an actual unix user for every user record you have? And matain those across machines? And have the web processes using the right unix user?
17:26akhudeksounds complicated :D
17:26kovasah
17:26bendlas... or create a PAM module for your app
17:26akhudekor that
17:26hcumberdaleakhudek: depends on the needs and what your application/auth/authoriz concepts look like
17:26hcumberdalePAM module :) nice try
17:27akhudekin any event, the database is fine for our needs at the moment
17:27akhudekthe 26ms is partly because it's going over a network to another machine in the test setup
17:27akhudekI'm not too concerned with that, more the extra 1s coming from somewhere
17:27hcumberdaleJDBC latency should be around 10 to 20ms
17:27znDuffhcumberdale: *nod*. I'm not a fan of using SQL databases where they aren't called for; just object to claim that async replication and load balancing based on same aren't available.
17:28nopromptanyone ever played with the shen language?
17:28hcumberdaleznDuff: +1 ya
17:28hcumberdalenever heard of shen!
17:29noprompthttp://shenlanguage.org/
17:29hcumberdaleintegrated prolog? runds 'under' clojure
17:29FrozenlockIf I put a .png in the resources/public/img of a library, will it be available to compojure as a normal resource file?
17:30hcumberdaleFrozenlock: depends
17:30SegFaultAXhcumberdale: Is your name a reference to Salad Fingers?
17:30nopromptsomeone mentioned it on twitter in response to a "i wish there was a clojure + haskell language"
17:30hcumberdaleyes SegFaultAX
17:30SegFaultAXhcumberdale: Well done. Carry on. :)
17:30Frozenlockhcumberdale: ... on what?
17:31hcumberdaleresources should be available in the classpath of your application
17:31weavejesterFrozenlock: Yes, if they have the default resources route, although usually you want to "namespace" your library's resources.
17:31hcumberdalethat shouldn't be a problem
17:31hcumberdaleso what do you mean by 'available'
17:31weavejesterLike… resources/your/app/public/img
17:31weavejesterAnd then you could have a route or middleware to add them in
17:31solussdhow do I pass a function to a macro and splice in its namespace-qualified symbol? e.g. (mymacro str) => (mymacroexpansion (clojure.core/str …))
17:31hcumberdaleavaiable from the "public web" ? ;)
17:31weavejesterSee hiccup-bootstrap
17:32bloopI have little web development experience, but am trying to make a game on the web using Noir. I'm looking at html5 canvases. It seems like I would write the Jscript in a string in hiccup, like [:script "some javascript code"]. Is there a nicer way than this? Has clojurescript already been integrated in some way into Noir and I just haven't stumbled upon it?
17:32FrozenlockI'll take a look immediately.
17:32Frozenlockthanks hcumberdale and weavejester :)
17:35Frozenlockbloop: Don't use noir, it's deprecated. However you can use compojure with lib-noir.
17:36hcumberdaleFrozenlock: +1
17:37hcumberdalebloop: a better way: render JSON and write a js-client
17:37hcumberdalemaybe in clojurescript
17:37Frozenlockbloop: And the `javascript' part could be written in clojurescript, but be warned that getting used to the cljs environment can take a while.
17:38kaoDand the cljs workflow is not too clean
17:39FrozenlockLet's be honest here. Goddamn awful.
17:39bloopFrozenlock: will you explain in more detail why it's preferable to use compojure + lib-noir than to use noir?
17:39FrozenlockBut I prefer it to writing js :p
17:40Frozenlockbloop: Noir is no longer maintained, so no more bug/security fixes, nor new features.
17:40nopromptbloop: because noir is deprecated.
17:40kaoDFrozenlock: hahaha
17:40kaoDyeah, it's awful
17:40bloopFrozenlock: ok, thanks
17:40FrozenlockAnd unless I'm mistaken, the lastest version of Noir still have a security problem regarding *read-eval*.
17:40arrdembloop: blog.raynes.me/blog/2012/12/13/moving-away-from-noir/
17:40kaoDI moved to CoffeeScript as a JS alternative and... oh wow!
17:41hcumberdaleFrozenlock: JQuery, JQueryUI are nice for 'business applications'
17:41hcumberdaleothers for games :
17:41kaoDI think Google Closure is the culprit of Cljs' awkwardness
17:41hcumberdalekaoD: share your exp
17:42hcumberdalebloop: and if you use compojure you'll see that you just don't need noir
17:42kaoDhcumberdale: Coffee is fast enough to be compiled on the fly
17:42kaoDso changes to .coffee files reflect immediately in JS
17:42hcumberdalesyntax -> clean ?
17:42hcumberdaleworks-on-every-browser-orama ?
17:43bloophcumberdale: I see. that blog post is quite enlightening. I hadn't realized that Noir was just some glue and extra stuff that sometimes got in the way.
17:43kaoDCoffee's syntax ?
17:43supersymoh me 3 .. i am very fresh but comming from a coffee/node.js workflow, I find lisp so much more beautiful
17:43kaoDyeah, works in every browser, it's just a preprocessor
17:43supersymbut some stuff seems a bit "awkward" indeed
17:43hcumberdalehow's node.js?
17:43kaoDand syntax is like Python had a son with JS' and Ruby's semen
17:44hcumberdalenever written stuff in it feels like having only one leg
17:44kaoDhcumberdale: well, I LOVE Node
17:44kaoDthe async paradigm is cool
17:44supersymNode is great.. its the JS verbosity I detest
17:44kaoDand the whole single-threaded thing is cool too
17:45kaoDI mean, why care about threading ?
17:45kaoDsupersym: I totally agree, try CoffeeScript
17:45supersymbut the significant whitespace gets boring too and always been fascinated by beauty of lisp..
17:45kaoDahh
17:45kaoDhehe
17:45kaoDyeah
17:45hcumberdaleis node.js only ss? or also available for cs?
17:45kaoDthat's spot on
17:45supersymyesterday I did some ClojureScript with Node.js libs tho
17:45kaoDhcumberdale: ss cs ?
17:45supersymhttp://mmcgrana.github.com/2011/09/clojurescript-nodejs.html
17:45hcumberdaleserver side client side
17:45kaoDah
17:46kaoDnode is just server-side
17:46kaoDbut JS is inherently client-side
17:46kaoDit's JS, you know
17:46supersymits just a functional language
17:46hcumberdaleremembering RINO,... what happened to RINO? ;)
17:46kaoDRhino ?
17:46hcumberdaleyap
17:46supersymbrowserify can also be used to port stuff from server -> client :)
17:46kaoDRhino runs on JVM
17:46kaoDTHAT killed Rhino :)
17:47hcumberdaleI <3
17:47kaoDsupersym: I don't care about significant whitespace myself (in fact I like it to some extent) but I don't really like CS syntax
17:47kaoDit's not very composable
17:47hcumberdaleoOo clojure runs on JVM
17:47kaoDI might give CS forks a try, Coco looks GREAT
17:47kaoDand LiveScript looks good to
17:48hcumberdaleI'm a bit confused about all the JS stuff
17:48brehautRoy is taking an interesting direction 
17:48nopromptkaoD: i've tried all three of those seriously. i liked live script the most.
17:49nopromptroy is cool too.
17:49kaoDRoy ?
17:49kaoD(googling...)
17:49brehauthttp://roy.brianmckenna.org
17:49hcumberdaleYeah since .net isn't the favourite tool of M$ after all and javascript is the juice in windows 8 new js libs are growing everywhere
17:49supersymhcumberdale: they are all dialects that transcompile to JS
17:49brehautstaticly typed ML style language that compiles to js
17:49supersymbut slightly different
17:49kaoDsupersym: anyways, I think the main problem is the JS ecosystem itself, applying functions is awkward and it's very OOP-y
17:49supersymcoffeescript is conservative compared to coco i guess
17:50kaoDyeah, coffee is VERY conservative
17:50hcumberdalekaoD: people said the same 'ecosystem' problem about java
17:50supersymI personally love that coffee has default .litcoffee support tho
17:50kaoDhcumberdale: yeah, and it still mixes bad
17:51supersymi like writing literate programs but it still has some caveats
17:51hcumberdalefrom coco github repo: "aims to be more radical"
17:51supersymKaoD: agrees
17:51hcumberdalelike it from the first line on
17:51brehautre:transpilers: https://twitter.com/PLT_Hulk/status/303858111939231744 https://twitter.com/PLT_Hulk/status/303859795306373120 https://twitter.com/PLT_Hulk/status/305331471768498177
17:51kaoDclojure works around that fact implementing its own functions
17:52hcumberdalekaoD: I wish I can get rid of the jvm :(
17:52kaoDhcumberdale: me too
17:52kaoDI like it in some ways
17:52kaoDbut Lisp-like JS alternatives are not very good
17:52hcumberdalenot only the startup time, also the uncontrollable gc
17:52kaoDcljs is awkward
17:52supersymthey say its fast but i always tried to stay away from PHP and Java
17:52hcumberdalemaybe cljs needs more time
17:52supersymyeah
17:53kaoDnah hcumberdale it's a basic problem... Google Closure sucks
17:53hcumberdalePHP is super awesome
17:53supersymso whats up with noir then? and lighttable
17:53noprompthcumberdale: +1
17:53nopromptPHP4ever
17:53supersymthat raised like 300k at kickstarter
17:53kaoDif Cljs was more like a preprocessor...
17:53kaoDand less like a compiler
17:53brehautwhat the hell channel have i logged into by mistake
17:53mrb_bkbrehaut: seconded
17:54hcumberdalePHP introduced the bad stateless web pattern
17:54hcumberdalewith the bad inconsistence loving mysql (myisam)
17:54hcumberdalenow everybody is declaring this as the best practices
17:54dnolen_kaoD: I don't think you understand the challenges a ClojureScript has compared to other compile to JS langs
17:54supersymyou got it
17:54hcumberdaleeventual consistent fast storage for web applications
17:54dnolen_comparing CLJS to CoffeeScript barely makes any sense
17:54hcumberdalestateless apps
17:55nopromptdnolen_: +1
17:55supersymhttp://www.paulgraham.com/icad.html
17:55kaoDdnolen_: no, don't get me wrong, I'm aware
17:55mrb_bkdnolen_: I would say it literally makes no sense
17:55hcumberdalePHP finishes after each execution (expt fastcgi modules)
17:55kaoDbut understanding a problem
17:55kaoDdoens't make it less of a problem
17:55kaoDright ?
17:55brehautdnolen_: barely is charitable
17:55dnolen_kaoD: w/o Closure CLJS is a funny joke
17:55noprompthcumberdale: "PHP is the Winchester Mystery House of programming languages."
17:55hcumberdale:) :)
17:55kaoDdnolen_: why ?
17:56hcumberdaleI started with C and PHP for web applications
17:56dnolen_kaoD: 7000 lines of standard library plus a culture of macros
17:56hcumberdaleIt feels like nothing happened in years of software architecture
17:56kaoDah, yeah, that's what I mean with "a base problem"
17:56hcumberdaleThings that work are fast and easy to understand
17:57hcumberdaleEJB2, JPA, JSF and so on are a big pain-in-the-ass
17:57dnolen_kaoD: but there's no such things a preprocessor version of CLJS, the data structures alone represent 50% of the codebase
17:57hcumberdaleThey introduce unneeded overall complexity
17:58kaoDdnolen_: that's if I wanted Clojure-to-JS
17:58kaoDI DON'T want it
17:58kaoDbecause it brings that kind of problems
17:58dnolen_kaoD: yes a problem for *you* :) which is OK
17:58FrozenlockkaoD: let's hope for a clojure in clojure :p
17:58kaoDokay
17:58kaoDyou got all butthurt
17:58hcumberdalewhy is google closure used in cljs?
17:58brehautkaoD: just use CPP then :P
17:58dnolen_kaoD: no feelings damaged here
17:59kaoDI hope so :P
17:59noprompti'm sorry but coffeescript has lots of wacky grammar.
17:59hcumberdaleIs there a public statement about why cljs is build the way it is?
17:59kaoDnoprompt: yes it does
17:59brehauthcumberdale: it does sophisticated code walking to determine what is or is not actually used and eliminates dead code from libraries
17:59enquorahcumberdale: it provides an existing optimization function that pre-exists clojure on the jvm.
18:00mrb_bki think the guiding principles behind CLJS is confounding people, you know, to promote conversation
18:00hcumberdalebrehaut: but it can be used optionally
18:00brehauthcumberdale: it lets you use a massive standard library withut encessarily having a massive download
18:00hcumberdaleahh!
18:00enquorahcumberdale: because no-one wanted to rewrite it in clojure ;-)
18:00FrozenlockThat could be useful for Clojure too...
18:00mrb_bkfinally watched fogus's datalog talk, that was awesome
18:01dnolen_good stuff
18:01hcumberdalecoco looks nice
18:01mrb_bka good perspective on unify --> prolog --> datalog
18:02rabbit_airstrikemrb_bk: video link?
18:02mrb_bkcemerick: trying to get a buddy who lives in hadley to go to your meetup
18:02mrb_bkrabbit_airstrike: http://www.infoq.com/presentations/Datalog
18:02cemerickmrb_bk: who?
18:02cemerickhi, BTW :-)
18:02mrb_bkcemerick: hi! @akahn on twitter
18:02mrb_bkoh no, he's in holyoke, same difference
18:02nopromptperhaps i'm becoming a smug lisp weenie, but syntax has slowly begun to annoy me.
18:02cemerickmrb_bk: there's good beer, cheese, decent salami, etc
18:03mrb_bkcemerick: yeah i'll try to push him to the next one
18:03hcumberdalebut coco syntax looks like perll
18:04hcumberdalelast = -> it[*-1] function equals @@0 == @@1
18:04hcumberdale:)
18:04nopromptlike a lot of these new languages don't do anything but add cute short hand syntax without actually solving any real problems.
18:04rabbit_airstrikemrb_bk: thanks :)
18:04nopromptin fact, i'd be willing to argue they're just making more of a mess.
18:04kaoDnoprompt: it's not that you're a Lisp weenie (you're, probably :P), Coffee took some really bad decisions (how it treats newlines, the only-nested-comprehensions, no object comprehensions, etc.)
18:04kaoDand they're not willing to change at all
18:05mrb_bksure thing rabbit_airstrike
18:05FrozenlockHmmm.. not wanting to change a language?
18:05nopromptkaoD: yep. which is why i ended up using live script.
18:05cemerickmrb_bk: how much clojuring do you do, anyway?
18:05supersymnoprompt: depends... a lot of progress is made with node.js/js client/server side
18:05Frozenlock*cough* #= *cough*
18:05nopromptkaoD: the guy working on the new cs compiler, in fact, told me to use livescrip.
18:05kaoDthe CoffeeScriptRedux guy ?
18:05mrb_bkcemerick: i'm just a hobbyist. i've contributed to a couple OSS libs but haven't built much from scratch.
18:06nopromptkaoD: yeah. i got a chance to talk with him last year.
18:06hcumberdalelivescript mhh!
18:06brehautFrozenlock: readeval is bad
18:06supersymso many problems already solved: a lot of it is just require 'something' :P
18:06nopromptkaoD: he may have a different viewpoint now though.
18:06hcumberdalewow livescript syntax looks nice from the first view
18:07mrb_bkcemerick: i like it a lot though, it's the lisp i've used more than any other and it's helped me understand quite a bit of other stuff - mostly in it for the people though
18:07nopromptsupersym: i was referring more to the compile-to-js langs.
18:08kaoDI want to try LiveScript but the Haskell-y syntax is taking me back from trying... and it inherits many CS flaws
18:08nopromptkaoD: just use cljs.
18:08supersymwell.. my point would be that readability trumps here
18:08nopromptha!
18:08hcumberdaleI'll go to bed
18:08hcumberdalegood n9
18:08nopromptsupersym: readability is a matter of opinion.
18:08cemerickmrb_bk: e.g. all the right reasons :-)
18:08supersymi guess so, if you put it like that :)
18:09nopromptsupersym: i find lisp to be *very* readable. other just see line noise.
18:09mrb_bkcemerick: no doubt!
18:09supersymlog = (args...) -> require('winston').Log 'info', args...
18:09mrb_bkcemerick: my turn! what's your main gig?
18:09kaoDnoprompt: what about http://sibilantjs.info/ ? did you try it ?
18:10supersymyeah well im a newb to lisp/clojure/jvm but got about half-way koans now and have some nice stuff running already + piping vim clojure -> tmux
18:10cemerickmrb_bk: gotta run, meetup setup time :-)
18:10mrb_bkokay next time cemerick!
18:10nopromptkaoD: i've never seen that. i'll check it out.
18:11enquorawhat is advantage of LiveScript over Elm, if that isn't stretching the channel too far?
18:11noprompti mean the cljs/clj combo has made me *extremely* happy.
18:12nopromptand i've tried out so many of these damn things i just wanna settle on something.
18:13enquoranoprompt: am flailing in the callback pit of hell which is raw/standard javascript at the moment and am hoping the cljs/clj will provide a ladder out ;-)
18:13supersymyeah...for me lisp is the crown jewel to master so this does feel like my path to take
18:13nopromptenquora: i've heard of something called a monad for that. but i, like so many, am eluded by monads.
18:13auserhey all
18:14kaoDenquora: why don't you try async-flow libraries ?
18:14kaoD(though, TBH, I like the callback pattern)
18:15nopromptat the end of the day i want to be able to write code in a sane language that doesn't piss me off and make me want to give up on life.
18:15enquorakaoD: am moving to a reactive programming model asap, might as well do it all in cljs. Will need a wrapper for indexedDB, which is my current bugbear.
18:15nopromptclj pretty much gives me that hands down.
18:16noprompt:)
18:16enquorakaoD: callback === goto. my cpu likes it, but I don't
18:16kaoDcallback != goto
18:16enquoraclose enough
18:16auserI have a string I'm using split-lines on… I only want the first n lines, any ideas? (clojure noob)
18:16kaoDauser: (take n ...) ?
18:17auseryeah
18:17auserthat's what I'm looking for I think
18:17noprompt*steps off the soapbox*
18:17kaoDenquora: what's the difference between events + callbacks and reactive programming ?
18:18enquoraunder the hood, probably not much. On the surface, composability
18:18brehautkaoD: roughly the same as iteration and comprehensions
18:18brehautsame as the difference between
18:18nopromptit looks like i should be able to make it to clojure west.
18:19nopromptcould someone help learn me some monads.
18:19seangroveHow does one use clojure.contrib map-utils?
18:19seangroveWant to recursively merge maps
18:19seangroveSeems like it's from 1.2 before things were split up, having a hard time tracking down contrib libraries
18:20brehautnoprompt: jimduey has a lot of stuff on clojure.net
18:20brehautnoprompt: but the short version is that its roughly function application parameterised by a context / container type
18:20Frozenlockseangrove: https://www.refheap.com/paste/11953 If it can help...
18:21kaoDenquora: and what's helping you on reactive programming ?
18:21brehautnoprompt: but noone can tell you what monad is, you have to experience it for yourself
18:21nopromptbrehaut: are they as important in clojure as they are haskell?
18:21nopromptbrehaut: sounds like lisp.
18:21brehautnoprompt: not remotely (directly anyway)
18:22brehautnoprompt: for (list comprehensions) is implicitly a monad, as is core.logic
18:22seangroveFrozenlock: Yeah, that works, I'll just paste that in, thanks!
18:22brehautnoprompt: typically you want want anything like the state monad because you can just use a ref type (and some of the more recursive stuff doesnt work as well without pervasive tail call removal)
18:23enquorakaoD: am fussing right now with managing the callback stack for refreshing a dashboard page when contents that it displays exist in multiple other tabs that are changing. chained function calls would be rather nice.
18:24brehautenquora: have you been using a Promise/A library?
18:24kaoDhmmm and did you choose tools already? I'm interested in the paradigm
18:24nopromptbrehaut: i've read lots about them but i never see examples of doing something with and without them side by side.
18:24enquorakaoD: paper here explains the problem I'm wrestling with rather well, although in a different context: http://www.cs.umd.edu/projects/PL/arrowlets/
18:25brehautnoprompt: best not to start your monads journey with state, its a bit of a brain twister
18:25nopromptbrehaut: i am ok with that.
18:25brehautnoprompt: the traditional place to start is the Maybe monad and List monad
18:26nopromptbrehaut: should i dive back in to Haskell for that, or are the explanations in clojure?
18:26brehautnoprompt: haskell's type system make things quite crisp
18:26brehautnoprompt: but i'd pick which ever you are more comfortable with
18:26brehautnoprompt: i found writing the reductions by hand helped me a lot
18:27nopromptbrehaut: well. i suppose i could start working with haskell again. it's been a bit though.
18:28nopromptbrehaut: haskell was pretty intimidating when i was doing OO, but i think i might be willing to give it another shot.
18:28brehautnoprompt: it will make you very concious of the function types which is valuable
18:29brehautnoprompt: avoid the do notation though!
18:29nopromptbrehaut: after working with clojure and a little scheme these past months, it's been in the back of my mind.
18:29nopromptbrehaut: noted.
18:29brehautnoprompt: do hides the big bag of functions involved
18:33nopromptbrehaut: a big win i see with haskell is being able to understand academic papers a bit better.
18:35enquorabrehaut: speaking of type systems, since Clojure is apparently one of its targets, have you used Shen?
18:35nopromptenquora: funny you should bring that up. i was just asking about it.
18:36supersymnoprompt: lovely isnt it when pieces fall into plac3
18:36noprompt:)
18:37enquoranoprompt: I have a need to generate robust PDFs using raw primitives and have been dreading it. a good type system might help ease the pain.
18:47devinusdoes clojure have a built-in exponentiation operator?
18:49TimMcMath/pow
18:50TimMcIt's a little verbose. :-P
18:50FrozenlockAnd not very clojury :(
18:51amalloyfor integral powers the problem is too easy to deserve being in the standard library :P
18:51rabbit_airstrikesomeone else has already asked: http://stackoverflow.com/questions/5057047/how-to-do-exponentiation-in-clojure
18:51amalloy(defn pow [b n] (apply * (repeat n b)))
18:51rabbit_airstrikeI'm kind of fond of the (reduce * (repeat n x)) solution, but I've used Math/pow when I've had to do it
18:55dnolen_a bit of a subtle victory but I'm excited about this change: http://github.com/clojure/core.logic/compare/374a8f4edf...042df72659
18:55dnolen_decoupling nominal stuff from CLP(FD) and any other constraint domains like it
18:56rabbit_airstrikeI'm looking forward to the confo on core.logic next month :)
18:58dnolen_rabbit_airstrike: so am I!
18:58nopromptMath/pow
19:04hiredmancemerick: interactive-form in friend seems to only work for post requests, which seems kind of broken? if I make a post request to authenticate, and then using the cookies I got back make a get request it fails
19:05supersymahh... now I get >>= and =<< in Haskell :)
19:10bbloomibdknox: the commands window produces zero results when i type "client"
19:10bbloomi didn't know how to connect, didn't think to try cmd+enter, wasn't sure what to do
19:11bbloomonly remembered to use cmd+enter after i saw your comment on HN
19:13bbloomibdknox: also, there is no pointer feedback in the command window, so i wasn't sure if i was clicking in the right spot & not all the commands have an obvious effect. like "Toggle Vim Mode". I wasn't sure if I should click, double click, press enter. or what
19:13bbloomneeds some visual feedback & maybe even show the state of the flag when toggling
19:13bbloomibdknox: also what? no visual block mode. boooo :-P
19:13bbloomibdknox: otherwise, looking sexy
19:14bbloomibdknox: appealing to the sublime text 2 crowd soon, i'm sure!
19:15bbloomcongrats on the release!
19:19nopromptwait. is there a new version of lightbox?
19:19bbloomlighttable
19:20nopromptwhoops, i meant that.
19:20bbloomyeah:
19:20bbloomhttp://www.chris-granger.com/2013/02/27/light-table-030-experience/
19:20nopromptsweet.
19:21noprompti hope one day i can replace vim with it.
19:22supersymi was hoping the same
19:22supersymoh.. a new post
19:23nopromptwait, vim keybindings? yes!
19:24SegFaultAXnoprompt: Why would you ever want to replace vim?
19:24Foxboronbblom, seems too me they copied some sublime features :P
19:25nopromptSegFaultAX: honestly, i wouldn't. but if the light table team can pull of some of there ideas it'd but tough not to wanna use it.
19:25noprompts/there/their
19:26nopromptibdknox: will light table ever support something like :! ?
19:30auserhas anyone here used clojure to talk to a google drive document?
19:30noprompti think this is an interesting way to express exponents (reduce * (take m (repeat n)))
19:32noprompt,(time (Math/pow 2 10))
19:32clojurebot"Elapsed time: 10.415219 msecs"\n1024.0
19:32noprompt,(time (reduce * (take 10 (repeat 2))))
19:32clojurebot"Elapsed time: 0.152463 msecs"\n1024
19:32noprompthuh. that's neat.
19:32brehautnoprompt: thats testing approximately nothing
19:33nopromptbrehaut: could you explain?
19:33brehautnoprompt: JVM benchmarking is difficult because of hotspot's complex JIT compiler
19:33brehautnoprompt: it recompiles a piece of code potentially many times based on runtime statistics to find the fastest possible version.
19:33nopromptbrehaut: how do you test stuff like that?
19:34brehautnoprompt: you run it a bunch of times, a bunch of times
19:34nopromptinteresting.
19:34brehautsomeone wrote a lib
19:34brehautim blanking on who and what
19:34mechazoidalcriterium
19:34brehautmechazoidal: thanks
19:35Raynesbrehaut: crit...
19:35SegFaultAXnoprompt: Protip - you can tell repeat how many times ##(reduce * (repeat 10 2))
19:35lazybot⇒ 1024
19:35brehauthttps://github.com/hugoduncan/criterium
19:35Raynesmechazoidal: How dare you speak before I have spoken.
19:35mechazoidalrevenge for having to beat my head against clj-native/jna all day
19:35nopromptSegFaultAX: thanks! that's a new one by me.
19:38auseror
19:38nopromptthis lib is good to know about.
20:38konrIs there a better option than Heroku for hosting clojure webapps?
20:38SegFaultAXkonr: Linode!
20:38hiredmanaws
20:39SegFaultAXRackspace.
20:39hiredmangoogle app engine
20:39hiredmanetc
20:39hiredmanany place wars are accepted
20:39hiredmanopenshift? that's a thing right?
20:40konrI think so! From Red Hat
20:42SegFaultAXIt's probably pretty easy to get going with ElasticBeanstalk, no?
20:45SegFaultAXPff, just upload a war file and press go from the looks of it.
20:49FrozenlockWhile we are on the subject of hosting, would any of those would recommended to host a webapp/mongodb ?
20:49FrozenlockClojure app, of course.
20:49SegFaultAXFrozenlock: All of them are applicable.
20:49SegFaultAXExcept GAE probably.
20:50supersymis it me or does GAE seem to have some issues with moving certain things forward
20:50konrI think these drop-the-war hosting services would require additional an hosting service for the mongodb server
20:51SegFaultAXkonr: Well for Elastic Beanstalk in particular, it's all just EC2+S3
20:52SegFaultAXkonr: So you can always just spin up instances for your db, which is pretty easy.
20:54FrozenlockRackspace: cloud database pricing: 512mb, 1 month, 43.80$. Wow... I was way of in my estimates...
20:54Frozenlock*off
20:54FrozenlockOh wait, that's the RAM -_-
20:55brehaut~ram
20:55clojurebotlogic programming is the new monads
20:56brehautO_o
20:56SegFaultAXDoes that mean everyone is going to start writing about how core.logic and prolog are like burritos?
20:56brehautbound to
20:57Frozenlockhttps://en.wikipedia.org/wiki/Random-access_memory
20:57Frozenlock(if that's what you were looking for)
20:57SegFaultAXdnolen should make it happen.
20:57brehautno.
20:57SegFaultAXAnd he should change his conj talk to burrito.logic.
20:59brehautFrozenlock: http://i.qkme.me/35juyw.jpg
20:59brehauttechnomancy's gag
21:00brehauti was sure he had taught clojurebot about it
21:02catgenthe light table ide project has an IRC channel?
21:15ravsterI've got weird datomic output in my program. Could someone let me know what I'm doing wrong with my own query? tia --> https://www.refheap.com/paste/11956
21:23bprravster: i would recommend using ' rather than `
21:25ravsterthanks bpr, had it that way since I was going to put an argument in the where clause , but then decided I'll take anything I can get.
21:25ravsterChanged it. No difference to output.
21:28bprravster: what's your schema?
21:29ravsterbpr: https://www.refheap.com/paste/11958 <-- :tag/category and :tag/sub_category, both strings
21:30bprwell, that's not the schema, but based on what you just said: the attributes are :tag/category and :tag/sub_category?
21:31ravsteryup
21:32bprok, lines 16 and 17 of the first paste suggest that your :category and :sub_category are your attributes
21:32bprnot :tag/*
21:33bpri can't help more than that b/c you're doing everything in functions that you haven't shown code for
21:33ravsterhttps://www.refheap.com/paste/11959 <-- the tx that creates that schema.
21:34bprok
21:35bprif dm/find-all is returning a seq of entities, then the way that you are making entities is not adding values for :tag/* to them
21:36ravsterbpr: okay.
21:37ravsterI just tried a query for all entities with a :db/ident attribute, and that returned a bunch of stuff, so I know the query is a working on.
21:37ravster*one
21:37ravsterthanks, bpr
21:48bprravster: np, good luck!
21:50ed_gis there a way to estimate how much memory a data structure is using? I'm running out of memory and no idea why.
21:54tomojany ideas of examples of what rich was getting at when he said we could do so much better than predicate dispatch?
21:59gfredericksI never know what anybody means when they make sweeping value judgments :(
22:03ivaned_g: the JVM lets you use 64MB by default
22:06ed_givan: thanks -- I know how to increase the amount allocated. what I want to do is measure (or "profile") how much I'm using so I can improve the program. I'm looking for a space analogue of the "time" function.
22:07ivanif two persistent data structures share data, which one is using the space?
22:07ivanperhaps jvisualvm will point to something useful?
22:08brehautivan: i dont really know what you mean, but the new version points to the shared pieces of the old one, but its just pointers so thats really logical rather than physical
22:09jemmonsIdiom question: In Other Languages, I often use a constant to represent keys to maps because I'm a horrible speller and this gives me compile time errors if I fat finger it. I never see this in clojure code. Keys are almost always just a bare keywords. How do you prevent yourselves from a typo in an assoc or get that leads to a tricky bug later on?
22:09ivanyeah, I'm trying to convince ed_g he wants the very-difficult-or-impossible
22:09FrozenlockIs there a way to get the version of a project, but from within? I was using a macro to get (System/getProperty "my-project.version"), but it doesn't work if the project is used as a library in another one :(
22:10Frozenlockjemmons: REPL powaaaaa
22:10brehautjemmons: you use :keywords and dont pretend you are writing code in a static language
22:11brehautjemmons: if you really wanted to be AR you could def vars to keywords, and the compiler would check it (because unquoted symbols must resolve at compile time) but thats not idiomatic
22:11ed_gI don't care if its not accurate in the presence of sharing. I just want to have some idea how much memory a list of hashmaps is using. my program is crashing from consing too much and I want it to stop crashing. should I install a java debugger?
22:12brehautjemmons: a more idiomatic approach would be to use asserts or pre and post conditions to ensure that your code is doing what it claims to be doing
22:13jemmonsbrehaut: Very helpful. Thanks all!
22:15brehauted_g: my experience with OOMs in clojrue generally come from misunderstanding laziness semantics rather than anything else. holding the head of a lazy sequence can cause all the interim structures to be held too
22:15brehauted_g: no idea if thats relevant to your program
22:22ed_gwhat if I need the data from the lazy sequence? does (lazy-seq '(1 2 3)) use more memory than '(1 2 3) once its "realized"?
22:23brehautabout the same, though i dont think lazy-seq does what you think
22:24ed_gin this case I'm using it to delay reading a file until the data from the file needs to be used.
22:24brehautalthough by coincidence it does work there
22:27brehauted_g: that sounds potentially squirrelly
22:27ed_gbrehaut: can you explain why?
22:29brehautdepending how you pass the seq around, and what you do with the file, you could consume quite a bit of memory, and also lose a file handle that wont be collected
22:30brehaut(typically you want to use with-open with files so that they are closed when they fall otu of scope, or alternatively you need to be clear and careful you close the file yourself. im pretty sure the IO lib does close files if the are GC'd but the lazy seq can prevent the final reference from dropping away)
22:30ed_gthe file is read in one go inside (with-open ...) in the body of lazy-seq. (lazy-seq (with-open [file (open code)] (doall (readfile file))))
22:34supersymLightTable is so awesome... something like http://drbunsen.github.com/formd/ would be very cool for it as well, since Markdown will prolly remain a factor for a while :)
22:34ed_gbut this goes back to knowing how much memory has been allocated -- if I can't measure, how can I possibly know the sequence has been used in the "wrong" way until the program crashes?
22:36Frozenlocksupersym: death to markdown, long live org-mode!
22:36tomojwhat is the difference between lamina's siphon and join?
22:38tomojaha! https://groups.google.com/d/msg/aleph-lib/y_M3CVpDyZE/zElylQYcSFoJ
22:39supersymSorry I come from a vim world :p
22:39supersymI guess I could learn some emacs
22:41FrozenlockAnd you are already using clojure, so won't be horrified by all the parens :)
22:41Frozenlock*you
22:42cemerickmrb_bk: now, you were saying? :-P
22:42supersymbut with lighttable... its getting along nicely and prolly one day fully replace my vim and sublime...although the packages etc. that come with it..same goes for node.js as well: some libraries are just too juicy
22:42tomojnow to figure out what "bridge" means
22:42supersymye
23:05clizzinwhen you lein uberjar, does the jar somehow know to run with the JVM opts specified by :jvm-opts in the project.clj?
23:06clizzinor do the :jvm-opts only apply to when you use leiningen tasks like `lein run`?
23:09auserhas anyone here used clojure to talk to a google drive documents/google api?
23:10seangroveIf I add a dependency to my project.clj, is there a way to get it into a currently-running nrepl without killing the server?
23:10seangroveRight now killing nrepl-emacs server buffer hangs emacs for a few seconds, which has been pretty annoying
23:10Frozenlockseangrove: you could try pomegranate
23:11tomojah, I just got the name 'pomegranate'
23:11seangroveFrozenlock: That looks pretty close to it, yeah
23:11seangroveI'll give it a try next time, thanks
23:11ed_gby the way, I found what I needed with jconsole.
23:26pppaulOOMS?
23:32FrozenlockIf I make a map {:a (some-fn) :b (some-other-fn)}, is it guaranteed that some-other-fn will be evaluated before the other one?
23:35cemerickFrozenlock: I wouldn't assume that at all.
23:37FrozenlockYeah that's what I figured... However I suppose that (let [result-a (some-fn)] {:a result-a :b (some-other-fn)}) would do the job?
23:37alandipertFrozenlock: order is guaranteed for (hash-map :a (some-fn) :b (some-other-fn))
23:38alandipertFrozenlock: (to the extent anything written on http://clojure.org/evaluation constitutes a guarantee, and it's probly not good if you depend on that behavior)
23:40FrozenlockAgreed..
23:40tomojI think you should be able to depend on that behavior
23:41FrozenlockBut the `let' would work, wouldn't it?
23:41alandipertfor sure