#clojure logs

2014-04-08

00:00mercwithamouthyeah i want my UI 100% outside of the server code
00:00beamsouses a templating language instead of hiccup.
00:00oinksoftbob2, (defn a nil) (defn b (+ 2 2)) (first-non-nil a b) => 4
00:01amalloyoinksoft: wat. (defn a nil) won't compile
00:01mercwithamouthbeamso: i was trying to stay away from the larger frameworks...really i just want to write my api in clojure... and focus on clients as clients only
00:01mercwithamouthif that makes sense
00:01amalloyyou want def in those samples
00:01oinksoftamalloy, a [] nil, i mean
00:01beamsomercwithamouth: http://clojure-liberator.github.io/liberator/ ?
00:02amalloybut then you're using a and b wrong
00:02beamsoessentially a REST library for clojure.
00:02mercwithamouthbeamso: yeah, liberator i'm familiar with. it's in my web programming in clojure book
00:02oinksoftamalloy, OK, i'm not actually using functions like a or b
00:02oinksoftamalloy, they're not too useful. but maybe a function that returned a database query result set. maybe a few of these functions, so only the first query returning something is returned to me
00:03Jaoodmercwithamouth: so you want one that support cljs then right?
00:03mercwithamouthJaood: yeah i'm definitely interested in cljs and om
00:03amalloyoinksoft: my point is that when giving examples to someone asking how to do something, your code should compile, or at least have a good excuse for not doing so
00:03mercwithamouthat the moment that's what i'd LIKE to learn
00:03oinksoftamalloy, well there you have it, i don't even have code for this.
00:03amalloyoh, you're the one asking for help. i got lost
00:03oinksoftamalloy, i am trying to write code for this and it isn't working
00:04oinksoftamalloy, it isn't even nearly working or nearly correct, it's a waste of time.
00:04bob2you just want the first non-nil value from applying a list of functions to a particular value?
00:04oinksoftamalloy, i am used to functional programming in erlang which is very to-the-point
00:04oinksoftbob2, yep ... i am new to this language and i don't know every bit of the stdlib, so i was trying to write this myself, and failing
00:05Jaoodmercwithamouth: well using hiccup with cljs won't entangle your client side code with your server side code, the good thing about hiccup is that its supported by both clj and cljs but I migh me wrong
00:06mercwithamouthhmm...i just don't like the feel of it. I can't explain why =P
00:06Jaoods/migh/might/
00:08`szx,(some #(% "arg") [(fn [_] nil) (fn [_] "success!")])
00:08clojurebot"success!"
00:09`szx^ oinksoft?
00:10mercwithamouthhah...i think i recall seeing 'some' in clojure...also Box in liftweb
00:10oinksoft`szx, some returns the value?
00:10`szx,(doc some)
00:10clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
00:10mercwithamouthsome returns the first true
00:10oinksoft`szx, are you using this "common idiom"
00:11oinksoft`szx, no, that isn't a set ... hm .. oh i see
00:11`szxoinksoft: nope
00:11oinksoft`szx, so i don't need to write anything, some does this for me
00:11`szxoinksoft: looks like it
00:11oinksoft`szx, what is your predicate function doing? what is "arg" for?
00:12`szxoinksoft: that's just a placeholder for your argument
00:12xsynwhat's the best way to get the duration of two dates with clj-time
00:12oinksofti thought % was
00:12oinksoftor is % the function
00:12`szx% is the argument to the predicate, which in this case is the fn
00:13xsynI want something like (duration 24/10/1014 26/10/2014)) => 2 days
00:13`szx,(some (fn [f] (f "arg")) [(fn [_] nil) (fn [_] "success!")])
00:13clojurebot"success!"
00:13`szxoinksoft: maybe this is clearer?
00:14oinksoft`szx, yea, thanks
00:14`szx,(some (fn [f] (f "arg")) [(fn [x] nil) (fn [x] (str "success, got " x))])
00:14clojurebot"success, got arg"
00:14oinksoftyea, that makes it much clearer :)
00:15oinksoftthis is different from some() i am used to
00:15`szxyeah, the terminology is a little confusing
00:15`szx~some
00:15clojurebotCool story bro.
00:16xsynok, got it
00:17oinksofthehe
00:17oinksoftxsyn, have you looked at https://github.com/clj-time/clj-time/blob/master/test/clj_time/core_test.clj i am using this to learn to do some things w/ the library now
00:18xsynyeah, been looking at it now
00:19xsyngot to
00:19xsyn(c/in-days (c/interval (datemap "24/10/2014") (datemap "26/10/214")))
00:19xsynwhere datemap is a formatter I made
00:19oinksoftthat does it?
00:19xsyn*nod*
00:22trptcolinamalloy / technomancy: reading channel history, actually nrepl (w/ `lein repl` as client, anyway) does allow prompting during an evaluation, via :need-input messages (https://github.com/clojure/tools.nrepl/blob/1072b773e2715d55eb5a50ff496714bb45a3707f/src/main/clojure/clojure/tools/nrepl/middleware/session.clj#L56-L59)
00:23trptcolin[possible i misread and you meant emacs’ nrepl client specifically though]
00:25amalloytrptcolin: it looks like that's bound to specifically *in*, right? that's not bad, i guess, and would work pretty well for use at the repl
00:26trptcolinyep. so you don’t have things like System/console, but it works ok. there was some implementation pain :)
00:26amalloyread-from-minibuffer is more fun, and i did like that i could include a default-value in there and let the user edit it
00:27trptcolinsound cool
00:27amalloy(read-from-minibuffer "Do you want eggs or bacon?" "eggs")
00:27amalloybut it sounds like nrepl is ahead in terms of reading from *in*. with swank, you have to do extra work to get data from the user from stuff like read-line
00:31trptcolinyeah i have no idea how emacs works, just knew for sure that i’d gone through some fun stuff to get reply reading input “during” an evaluation
00:32trptcolinthat sounds like a cool design throwing all those different GUIs on top of your backend though :)
00:49amalloytrptcolin: well, i'm far from a UI designer. it's really just three different ways to display text prompts and request test input
00:49trptcolinsure, i just like that kind of separation of concerns
00:50amalloyyeah, it's good for you to write stuff that way
00:58johnmn3hello
00:58johnmn3anyone have any experience with lamina?
01:04amalloy~anyone
01:04clojurebotanyone is anybody
01:05johnmn3so I'm looking at the clojure aleph chat example: https://github.com/alexkehayias/clojure-aleph-chat/blob/master/project/src/clj/core/views.clj
01:06johnmn3and the meat and taters of it is:
01:06johnmn3(siphon chat ch)
01:06johnmn3(siphon ch chat)
01:07amalloy(siphon x y) => "everything read from x, write to y"
01:07johnmn3I'd like to read the data out of the channel first, though, manipulate the data, then send it along.
01:08johnmn3looking over the api, I didn't see what was applicable. Can't find many examples online either.
01:08johnmn3trying receive-all right now
01:08johnmn3hmm... that should do it
01:17marcopolo`Whats the standard way of debugging a logic program?
01:17marcopolo`anyone debug anything decently big in core.logic?
01:18nopromptmarcopolo`: you have to start by debugging yourself.
01:18nopromptlol j/k
01:18marcopolo`noprompt: so deep
01:18nopromptmarcopolo`: :)
01:23dissipatemarcopolo`, can't core.logic reason about its own code?
01:24marcopolo`It can't know if it'll get stuck
01:25ambrosebsmarcopolo`: check out http://minikanren.org/#screencasts
01:25dissipatemarcopolo`, so how would a human know if it will get stuck?
01:26marcopolo`ambrosebs: anything in particular?
01:26ambrosebssorry http://minikanren.org/#hangouts
01:26ambrosebslook at Hangout #1 I think
01:26marcopolo`dissipate: e.g. If you put a println and you see the println repeating too often you know something's fishy
01:26ambrosebsI remember a hangout had a demo of a core.logic specific debugger
01:26marcopolo`ambrosebs: thanks
01:26ambrosebsa later one
01:26marcopolo`ooo
01:27marcopolo`"Topic: Debugging miniKanren programs; " #4 sounds like exactly what I need
01:27marcopolo`thanks
01:27ambrosebsaha!
01:28dissipatemarcopolo`, is core.logic a precise implementation of minikanren?
01:28marcopolo`I think there are slight differences, but I don't really know a whole lot
01:28marcopolo`There is no condi like in TRS
01:29marcopolo`dissipate: https://github.com/clojure/core.logic/wiki/Differences-from-The-Reasoned-Schemer
01:30dissipatemarcopolo`, i see. thanks. seems like SQL. there is a spec but no one implements it exactly.
01:39oinksoftdoes anybody know how to perform meaningful datetime arithmetic with clj-time
01:39oinksoftlike finding the difference between two times
01:39oinksoftas a timedelta-ish object like in python
01:40oinksoftor to truncate datetimes, like remove minutes
01:40oinksoftbecause right now i am having a very hard time getting anything done with clj-time
01:40oinksoftbesides parsing/unparsing datetimes
01:42beamsoi use standard java date/time stuff. i was totally unaware of the library.
01:43oinksoftbeamso, how do i do that??
01:43lazybotoinksoft: Definitely not.
01:43oinksoftbeamso, apparently i am supposed to know the java ecosystem too to use clojure, wish i knew that before :(
01:43beamsoi thought that held for all jvm-hosted languages
01:44beamsojava.util.Calendar is the class you're probably looking for
01:44beamsoand java.text.DateFormat for parsing/unparsing
01:46oinksoftok, thanks
01:47beamsoi think you have to refer to the joda-time api to get the difference between two dates
01:47oinksofti think i made a big mistake by not studying jodatime sooner in this project and assuming clj-time was 1:1
01:48beamsoit looks like you have to instantiate a java class to get the difference
01:48oinksoftyea, i'll try that out
01:48oinksoftthanks
01:50beamsohttp://joda-time.sourceforge.net/faq.html#datediff
01:51miseria"cuando la causa nos enloquece, el efecto nos destruye y el fin continuara siendo un sueño" bienvenidos: http://castroruben.com *temo_a_un_ser_sin_rival*
01:51oinksoftbeamso, yea, the jodatime api is really good it looks like, for some reason i assumed clojure would have some library available for performing very simple datetime comparisons
01:51oinksoftbeamso, so i underestimated how long this part would take me is all :)
01:52oinksoftbeamso, *comparisons and calculations
01:52beamsothe api looks horrible to me :/
01:52oinksoftwell, i mean that it can do what i want
02:09ambrosebshow do I make use of instaparse's :optimize :memory
02:10ambrosebsI'm parsing TypeScript, so I assume it can be partitioned into smaller chunks automatically.
02:18ambrosebsprobably not the solution I want anyway.
02:18ambrosebsmy grammar is probably hopelessly inefficient
02:28nopromptambrosebs: thanks for posting that link ealier. this is great. :)
02:28ambrosebs:)
02:32sm0kecan i exclude a particular folder under my source directory in lein
02:32ambrosebsnoprompt: webyrd says "time to make some more"
02:34nopromptambrosebs: well it's going to take some time to watch all of these! but it's just what i was looking for.
02:35nopromptambrosebs: i've been trying to get my feet wet with logic programming for a while so this really nice to have someone explaining code in a more "human" dialog than a dense text book alone.
03:00noidism0ke, I doubt it. the source folder is added to Clojure's classpath.
03:07sm0kei guessed so
03:18ambrosebshow do I know if :optimize :memory worked in instaparse?
03:22ambrosebsit's clearly working since my grammars are parsing :)
03:23ambrosebsaha https://github.com/Engelberg/instaparse/blob/c2884b65ca853b6cbd10e05581e8cda831391da3/src/instaparse/repeat.clj#L213
03:28ambrosebsnice, the full 9000 line base typescript annotations parse with :optimize :memory.
03:47szymanowskihello, i there a function that return the current namespace name?
03:47szymanowskiis*
03:47ambrosebs,(ns-name *ns*)
03:47clojurebotsandbox
03:48szymanowskithank you very much
05:34szymanowskiI've got a function that takes a multimethod as argument, how can i get the var name of this multimethod from this function?
05:37ambrosebsszymanowski: there's a private field in MultiFn.
05:38ambrosebswhich hints that this isn't supported.
05:41szymanowskiso there is no way to get it? how am I (not)supposed to access this field?
05:47szymanowskiso there is no way to get it? how am I (not)supposed to access this field?
05:51ambrosebsszymanowski: use java reflection to make the field public
05:52szymanowskithank you, i will try that
05:52ambrosebshttps://github.com/clojure/jvm.tools.analyzer/blob/master/src/main/clojure/clojure/jvm/tools/analyzer.clj#L68
06:14FrozenlockIf I have multiple channels returned by a `for' loop, how may I transfer the results into a single collection that goes into another channel? (async/map identity chan-coll) ?
06:45wagjo,(+ 1 1)
06:45clojurebot2
06:56ucbI assume/hope the answer is no, but is _ special when used in keywords?
06:57Bronsayou assume right
06:57ucblong story short, I have a map with keywords like :_id or :_rev, and when I try either (:_id the-map) or (get the-map :_id) I always get nil
06:57ucbdespite (keys the-map) returning something like (:_id :_rev ...)
06:57Bronsa,(:_foo {:_foo 1})
06:57clojurebot1
06:58Bronsaucb: it might be the case that the value is nil then
06:58ucbyeah, I tried that too before asking but thought I'd ask anyway :)
06:58ucboh, the value isn't nil
06:58ucbBronsa: https://gist.github.com/10109498
06:58ucbsomething's up, but I don't know exactly what
06:59Bronsaucb: (class (mudb.db/get-doc db "0b290c7b-01a5-46f8-b642-8a19862eeca8"))
06:59ucbclojure.lang.PersistentArrayMap
07:00ucbI would hope that didn't make a difference though
07:00Bronsaucb: I thought maybe it returned a custom map type
07:00ucbah, right, no it doesn't :)
07:00Bronsaso you could blame a broken lookup implementation
07:01Bronsaucb: what does (filter #{:_id} the-db) return?
07:01Bronsaerr (keys the-db)
07:02ucb()
07:02Bronsathere you have it
07:02ucbwell, sure
07:02ucbbut this is extremely puzzling
07:02ucbperhaps there's some weird unicode non printable character in the keyword or something :/
07:04Bronsaucb: (map #(-> % .sym name .getBytes seq) (keys the-db))
07:05Bronsarather, (filter keyword? (keys the-db))
07:05Bronsaucb: it might be an encoding problem
07:06ucb(95 114 101 118) (95 105 100)
07:06ucbthat's for (:_rev and :_id)
07:07ucbugh, without ( )
07:08Bronsaucb: and if you do (seq (.getBytes (name (.sym :_db)))) do you still get (95 105 100)?
07:09ucbBronsa: yeah, same stuff
07:09Bronsano idea then
07:09ucb:)
07:09ucbme neither
07:29ucbsadly I sorted it out for now using strings as keys
07:29ucbbecause the maps that are failing to get :_id are fine returning "somestring"
07:33Bronsaucb: really weird
07:33ucbsomething's up because if I (:_foo (assoc the-map :_foo "some stuff")) then I get "some stuff"
07:33ucbone thing worth mentioning is that I'm persisting these maps to disk using MapDB
07:34ucbthough I have no problem writing them and retrieving them from disk
07:34Bronsaif you do (keys (assoc the-map :_id 1)) do you get two :_id or one?
07:34ucbonly when I create one via an HTTP handler and then retrieve it via low-level fns that I run into trouble
07:34ucbooh
07:34ucbgood thinking
07:35BronsaI still think it might be an enconding issue
07:36Bronsaanother long shot but
07:36Bronsa,(symbol ":foo")
07:36clojurebot:foo
07:36Bronsatry to make sure :_id is a keyword and not an invalid symbol
07:36clojurebotYou don't have to tell me twice.
07:36Bronsa.
07:39ucbBronsa: bingo: https://gist.github.com/10112462
07:40Bronsaucb: good, now check if the original :_id is a keyword or a symbol
07:40ucbBronsa: well, it's a keyword https://gist.github.com/10112576
07:40FrozenlockIf I have multiple channels returned by a `for' loop, how may I transfer the results into a single collection that goes into another channel? I tried async/map, but it seems to just push the values one a the time in a new channel :-/
07:40Frozenlock
07:41Bronsaucb: there might be something weird going on when you read it back, check on the in-memory strucutre (map class (keys the-db))
07:42Bronsaif it's a keyword, I don't know what to blame other than the encoding
07:43ucbmapping class gives me clojure.lang.Keyword everywhere
07:43ucbso it has to be encoding
07:44ucbBronsa: https://gist.githubusercontent.com/ulises/10112830/raw/7d1e506b5e62e6ef5620424b5acfbc939cbd4418/%2Acider-repl+mudb%2A.txt
07:45Bronsaok
07:45Viestihum, looking into om-sync, seems that I could build an app that sends state changes to the server, but what about listening to changes from the server
07:47Bronsaucb: well, you might do one last check, (map (fn [[k v]] [(.hashCode k) v]) (filter (fn [[k _]] (keyword? k)) (assoc the-db :_id "foo")))
07:47Bronsait should return two different hashcodes I think
07:48ucb([1020047062 :_id] [2942948 "_rev"] [1020047062 :_id] [3076010 "data"])
07:48Bronsa:/
07:50ucb:/ indeed
07:52wagjoucb: what's the maps clasS?
07:53ucbclojure.lang.PersistentArrayMap
07:55sveri1hi, i would like to alter the binding of a (html/deftemplate... def, but I just don't know if it even works at all, all that came to my mind did not work, here is some example code to illustrate the problem: http://pastebin.com/TvbbDG3i
07:55wagjousb: try (set (keys m))
07:55wagjoucb: try (set (keys m))
07:56ucbwagjo: https://gist.github.com/10113829
07:56wagjoheh
07:57ucbeven more amusing: https://gist.github.com/10113916
07:57wagjoucb: maybe it has something to do with classloaders, try is the keywords are identical
08:00wagjoucb: try (map #(.getClassLoader (class %)) (keys assoced-map))
08:04wagjoucb: if it is not the encoding than it may be issue in keywords interning.
08:13FrozenlockI must be missing something.... where `chans' is a bunch of channels: https://www.refheap.com/73258 doesn't return o_O
08:26tbaldridgeFrozenlock: never returns, or return-channel never gets a result?
08:27Frozenlocktbaldridge: Well the rest of my code still runs, so I suppose it just never gets a result.
08:28tbaldridgeinto will never return until it has consumed all data from the input channel and that input channel is closed
08:28tbaldridgelikewise merge will never close its output until all inputs are closed
08:29tbaldridgeso it could be the case where one of the items in `chans` is never closing and thus signaling that it is finished.
08:29FrozenlockI doubt it, it works fine with just async/merge.
08:30tbaldridgeFrozenlock: and it will, merge puts items into the output channel as it gets them. Into does not
08:30tbaldridgeInto waits until the end, merge (and most other core.async functions) don't
08:34Frozenlocktbaldridge: It's waiting for the channels to close?
08:35tbaldridgeYes, as I said above: "into will never return until it has consumed all data from the input channel and that input channel is closed"
08:35tbaldridge*never return data
08:35tbaldridgeis what I should have put
08:35tbaldridgeso it returns a channel, but that channel is never given any data until the input channel to into closes
08:35Guest79451Hi, I'm trying to deploy my luminus app on heroku, after pushing the code when I'm trying to use heroku open, I get this: An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details.
08:35FrozenlockHmm... maybe I'm doing it wrong and should close them then.
08:36Guest79451I've checked for logs and everything went fine without any error
08:36tbaldridgeFrozenlock: that's what I'm thinking (having not seen the rest of the app)
08:36Guest79451Procfile has: web: lein with-profile production trampoline ring server
08:36FrozenlockIn short, what I have is this ---> [c1 async-request1 c2 async-request2]. What I want to have is a channel with both results.
08:37Frozenlock(in a collection)
08:37Guest79451Hi, I'm trying to deploy my luminus app on heroku, after pushing the code when I'm trying to use heroku open, I get this: An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details. I've checked for logs and everything went fine without any error. Procfile has: web: lein with-profile production trampoline ring server.
08:37FrozenlockI want to consume them simultaneously.
08:38tbaldridgeFrozenlock: one item from each chan ?
08:38Frozenlockyup
08:39tbaldridgeFrozenlock: then you probably want to replace merge/into with (async/map vector chans)
08:39tbaldridge,(doc clojure.core.async/map)
08:39clojurebotNo entiendo
08:39tbaldridgeFrozenlock: http://clojure.github.io/core.async/#clojure.core.async/map
08:39FrozenlockInteresting... I tried (async/map identity chans) earlier. Let me try that...
08:40tbaldridgeFrozenlock: yeah, the function gets applied to the items, so you were in effect doing this:
08:40tbaldridge,(apply identity [1 2 3])
08:40clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/identity>
08:40FrozenlockOh!
08:40FrozenlockI guess I was just expecting map to return a collection, like clojure.core/map
08:41tbaldridgeFrozenlock: yeah, this will end up returning a channel since core.async operates in a land where everything has to be push based
08:42FrozenlockGuest79451: The port is specified in your with-profile?
08:42Frozenlocktbaldridge: Makes sense. Thank you very much!
08:43FrozenlockGuest79451: What I mean is... this doesn't look like the basic Heroku Procfile with $PORT and all.
08:43tbaldridgeFrozenlock: not a problme
08:43tbaldridge*problem
08:44Guest79451Nope, that was included by default in the luminus template
08:44Guest79451I haven't edited it
08:44Guest79451what should I change it to?
08:45FrozenlockEhhh I don't really know. I just made it once and just followed the instructions on Heroku. This is what I got:
08:45Frozenlockweb: java $JVM_OPTS -cp target/hvacio-standalone.jar clojure.main -m hvacio.server $PORT
08:47Guest79451okay, i'll try it and see if it works
08:48FrozenlockGuest79451 https://devcenter.heroku.com/articles/getting-started-with-clojure
08:48Guest79451Frozenlock_ should this: clojure.main -m hvacio.server, be same or I'll have to change it?
08:49Guest79451I mean, clojure.main?
08:49FrozenlockDepends on how you made your project.
08:49Guest79451I don't have anything like that in my project
08:49beamsoGuest79451: have you tried running your heroku app locally using foreman?
08:50Guest79451yup. it's running
08:50clojurebotCool story bro.
08:50beamsoforeman start from the command line worked?
08:50Guest79451I've been following the instruction on this link:https://devcenter.heroku.com/articles/getting-started-with-clojure
08:50Guest79451yes, it worked
08:51Guest79451and at this link: http://www.luminusweb.net/docs/deployment.md
08:51Guest79451On http://www.luminusweb.net/docs/deployment.md, they haven't made any changes in Procfile
08:52beamsohave you tried simply redeploying to heroku?
08:52beamsoi know that is a stupid question but status.heroku.com tells me that they are still doing maintenance for heartbleed.
08:52Guest79451beamso, yes, I tried it 4-5 times
08:52Guest79451with same result
09:04ucbwagjo: apologies for delay; class loader is the same for the sane :_id and the broken :_id
09:08Guest79451beamso, okay, so it won't deploy until they are done with maintinance
09:08Guest79451?
09:08beamsono idea.
09:09beamsoit was just a suggestion based on someone else's heroku issues
10:46si14(and again)
10:51si14ok, we have a lot of interfaces here already https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java , but will it hurt to expand this list 4-fold with long[] and double[] at least?
10:54stuartsierraAren't java arrays already Objects? What would be the benefit?
10:57si14stuartsierra: elimination of additional "checkcasts", I believe.
10:58stuartsierraJVM optimizations should eliminate most of those already.
11:00si14I see, thank you.
11:00tbaldridgeeven if it didn't you could always cast once and be done with it.
11:02si14I'm currently playing with some simplex stuff and thinking if writing math-heavy code in Clojure instead of Java with Clojure interface is a good idea.
11:04llasramsi14: It definitely possible, but can be tricky to avoid unintentional boxing. Check out https://github.com/ztellman/primitive-math and https://github.com/prismatic/hiphip for some helpers
11:05si14llasram: yeah, thank you.
11:07si14argh, I hate this ctrl+enter feature of IRCCloud.
11:07si14"feature"
11:25arrdem$lfmassoc arrdem
11:25arrdem$lfmuser Raynes
11:26arrdemlazybot is down again I see...
11:27ambrosebsarrdem: did Daniel Gomez reply to your decision with GSoC?
11:27ambrosebsarrdem: I assume he's cool with it
11:27arrdemambrosebs: I haven't heard anything from him, so I assume he's cool with the proposal as it stands.
11:28ambrosebsarrdem: ok
11:29arrdemambrosebs: after talking to TB it looks like there are some reverted patches that implement a reasonable amount of what I'm proposing to do atop t.a for the existing compiler. Stuff rich added circa 1.3 and promptly reverted. On my todo list to do some research and figure out how to get those back on the mainline, and if that's something I could do in the spare two weeks my GSoC proposal has.
11:30ambrosebsarrdem: sounds good
11:33arrdem,(type (Long/SIZE))
11:33clojurebotjava.lang.Integer
12:03dokyhello does anybody know how to detect scrollbar when reach the top ? maybe with jayq ?
12:04gtrakI just noticed.. aren't return type-hints supposed to go on the arglist vector? clojure.string has them on the var name.
12:05teslanickYou could do it with (.-scrollTop js/document.body), I think.
12:05teslanick(@doky)
12:05dokyteslanick: thanks i will try it
12:05amalloygtrak: hints on the arglist were added only in 1.3, to support functions returning primitives
12:06amalloyi don't think hinting the arglist with a non-primitive class actually does anything, but i could be wrong on that
12:06gtrakah, hmm.
12:06gtrakthere's examples of it in core.clj
12:07gtrakbut it's also got a String :tag on the metadata.. soo.. not sure what's happening there :-). looking at str.
12:08amalloyhinting the var name, which is equivalent to :tag String, does indeed hint the return type
12:12dnolen_doky: https://api.jquery.com/scrollTop/ with jQuery, or goog.style.getViewportPageOffset
12:13dnolen_as usual I recommend the later
12:13dokyteslanick: and when i want to detect scroll in div.box it would be (.-scrollTop js/document.body.div.box) ?
12:16teslanickYeah, use the google library if you can, if you're in clojurescript. I'm not super-familiar with the closure library yet.
12:17teslanickBut, in JS, if you want to detect a scroll in a box (modern browsers): https://gist.github.com/anonymous/e98a96eda16bf18abd69
12:20teslanick(working example) http://jsbin.com/gegojada/1/edit
12:29kenrestivonoprompt: were you having a problem with a weird \@ character in some json output?
12:31kenrestivoi was able to duplicate something similar by inadvertently doing (map first) on a list of things not all of which were sequences. one was a string, and i got that same odd output of a seemingly random char.
12:33justin_smithgiven that
12:34justin_smithif js were using C style null terminated strings for example
12:52dokyteslanick: thanks :)
13:16justin_smithhttp://cljsfiddle.net/fiddle/jonase.async is giving a 502 error, is there another "fiddle with clojurescript" site up?
13:20nopromptdnolen_: how do we get api documentation a la clojure, core.async, etc. for core.logic?
13:20nopromptdnolen_: my mistake. the README just needs the link.
13:24jonasenjustin_smith: it's back up now
13:25justin_smithcool, thanks
13:33lynaghkbbloom: ping
13:33bbloomlynaghk: pong
13:34rasmustodigitalocean ok for an irc vps?
13:34lynaghkbbloom: I'm building a tool for traversing graphs, and I'm not sure the best way to track the depth of a node
13:36lynaghkbbloom: in particular, I'm not sure if it should be a property of the nodes themselves (they get instantiated with a "level" attribute)
13:36bbloomlynaghk: depends on a lot of things
13:36lynaghkbbloom: or if things are easier when the level is tracked implicitly---especially w.r.t. changing the "root" of the graph
13:37bbloomlynaghk: root == start node of a traversal?
13:37bbloomdepth == shortest path from root?
13:37lynaghkbbloom: yes, exactly.
13:37lynaghkyep.
13:38lynaghkright now my concrete toy example is a structured editor for prose
13:38bbloompresumably the graphs are immutable, right?
13:38bbloomlynaghk: prose == a thing, or like english prose?
13:38lynaghkso you start with a single document node, then you can "zoom in" to seeing all of the sections, then to the paragraphs, sentences, words, letters
13:38justin_smithlynaghk: grammatical structure?
13:39bbloomlynaghk: and the non-tree/graph part of it is cross references?
13:39Bronsagtrak, amalloy: I'm reading the backlog -- hinting the arg vector does hint the return type and I'd argue it should be the preferred way to go
13:39lynaghkbbloom: in my toy example it's a tree but in the future there will be cross-references
13:40bbloomlynaghk: don't try to build general graph tools, it's fucking hard :-P just start w/ a tree & add cross references later as names
13:40lynaghkbbloom: okay to pm?
13:40bbloomlynaghk: for example, when you create a new paragraph node, you can just inc a counter and store an ID on that tree node and then implement cross references as just the id to there + a context object built up from a post-order traversal
13:41bbloomlynaghk: always
13:41gtrakBronsa: easy to forget the details. I remember working through the edge-cases like a year ago.
13:41gtrakhopefully one day we can make this behavior consistent :-).
13:42Bronsagtrak: the only gotcha is that metadata on vars is evaluated while on arglists is not
13:42gtrakonce we have an analyzer we can do something like python's 2to3 :-)
13:42gtrakand a new compiler.
13:42gtrakhrm..
13:43Bronsagtrak: well turns out I'm working on exactly that :P https://github.com/clojure/tools.analyzer.jvm https://github.com/clojure/tools.emitter.jvm
13:43gtrakright :-)
13:43gtrakjust speculating what the future might hold.
13:44maxthoursieHi, I'm using sqlkorma w a legacy db, and all fields have spaces in them. My code is cripled with (keyword "company id") et.al. How would you go about titying that?
13:44Bronsagtrak: I'd love to get clojure be consistent wrt :tag handling, I've had a discussion on the clojure-dev ml a while ago about that
13:45Bronsagot no response from Rich so I went my way and did what I thought was right in tools.analyzer: :tag always resolves to a class or it's a compile time error
13:45gtrakI managed to actually use my cljs tooling (auto-complete/jump-to-def) to build an app, aside from weird compiler crashes, it worked quite well. I'd love for this to work on the jvm analyzer impl whenever that comes around instead of the java namespace implementing classes.
13:45maxthoursiethere's a function in korma, field-identifier, which if I could hook into would solve my problems
13:45maxthoursiebut how do I do that? monkey-patch?
13:46gtrakBronsa: I want to implement a 'enumerate all protocol implementations' cider middleware, among other things.
13:46gtrakcan't do that on the JVM now, I think I could in cljs.
13:46maxthoursiecan I wrap it somehow to for instance replace :company-id with "company id"
13:46maxthoursie?
13:47gtrakBronsa: that sounds sensible to me, I guess the concern is, when is it time to make a clean break, and how hard will it be for existing code?
13:47gtrakbut we need a working toolchain first :-)
13:47whodidthisyesql is always on option if dsls are bad
13:49Bronsagtrak: well it's surprisingly close to be working
13:49maxthoursiewhodidthis: ah, havn't heard of it
13:50gtrakoh really, nice :-)
13:50gtrakcan it do a repl?
13:50Bronsagtrak: it compiles fine all of clojure.core, and my testing showed that it's mostly working except for a few known differences
13:51Bronsagtrak: the only place it chokes right now is compiling core_genclass, where the jdk validator complains about a missing stackmap frame, I still have no idea what's going on there but I'm investigating
13:52Bronsagtrak: next step is trying to improve performances, right now it's something like 15x slower at compiling than Compiler.java
13:53gtrakoh yea? that's not too bad.
13:53Bronsawhich, everything considered, is not that bad.
13:53gtrakgiven how little the current compiler does, and overhead of clojure data.
13:53arrdemBronsa: just at performing the translation or the output?
13:53tbaldridgeBronsa: that being said, what are the actual numbers there?
13:53tbaldridge15x slower than 1ms is something I could live with
13:53tbaldridgeClojure compilation isn't that slow to begin with
13:53gtrakI wonder how much of our compilation time is classloading.
13:54Bronsatbaldridge: 2s to compiler clojure.core with Compiler.java, 25s with t.e
13:54tbaldridgeesh, yeah, that's a bit worse...still that's what...10k lines of code?
13:54hiredmantbaldridge: loading enough code and it takes forever
13:54gtrakthat would differ app to app. we load up all of hadoop and hive and ...
13:54Bronsaarrdem: cumulative
13:55Bronsatbaldridge: my goal is to get that close to ~10s, less than that is going to be a bit difficult
13:56S3thc0nHello everyone, I spent the last few weeks pondering syntax basics of programming languages and wondered: How (except for forward reference) would a global let differ from using defs? Since (IMHO) everything should be an expression and not a statement I think this would be cleaner. But the problem of other libraries / namespaces with their own let arises, as well as accessing declared
13:56S3thc0nvalues/functions from outside (a REPL for example). What do you think? [Sorry for the wall of text]
13:56llasramBronsa: Why do you think so?
13:57arrdemS3thc0n: defs emit vars and metadata whereas lets don't.. but many research and toy PLs implement defs as something equivalent to top level lets.
13:58gtrakS3thc0n: yea.. no chance for forward declarations if you use lets, unless you use something mutable.
13:58Bronsatbaldridge: there's definitely room for improvement on the tools.emitter side, all the splicing happens in runtime there and it adds quite the overhead
13:58S3thc0narrdem: Thank you, is there a specific (search) term for this technique or a few languages of those?
13:58gtrakS3thc0n: so you'd essentially get your code as a tree. Vars enable a DAG if I'm thinking about it correctly.
13:58justin_smithS3thc0n: also consider that in clojure let is actually an imperative sequencing construct explicitly used to chain side effects, and defs in an ns should not be
13:59jcromartie1*cough*monad*cough*
13:59justin_smithgtrak: at least with clojure the A part is enforced by the compiler
13:59Bronsallasram: doing multiple passes using multimethods over ast represented as maps is never going to be as fast as a single pass on classes with direct fields like Compiler.java currently does
14:00S3thc0njustin_smith: I was not aware of that. Thought let was only for destructuring, but now that I think of it you do want to prevent reading the same input twice instead of reusing.
14:00justin_smithS3thc0n: let in clojure is explicitly ordered, and people use it to sequence side effects in idiomatic code
14:02S3thc0njustin_smith: So the clojure compiler does optimizations by shifting calculations which do not call to Java mutable state or why is the additional ordering necessary?
14:04justin_smithS3thc0n: not sure I understand your question. let is guaranteed to be evaluated in order (both the binding forms and the body), and the top level of an ns should not contain side effects, this is a difference between a let body and an ns binding vars currently
14:04SethconSorry, disconnected.
14:04SethconAnythign wrote something in the last minute, please repeat :/ S3thC0n is a ghost
14:05justin_smithSethcon: not sure I understand your question. let is guaranteed to be evaluated in order (both the binding forms and the body), and the top level of an ns should not contain side effects, this is a difference between a let body and an ns binding vars currently
14:05llasramBronsa: Could always switch to a faster dispatch mechanism?
14:05mikeyg6754What is the best way to access the resources folder from one of your applications dependencies? I'm creating a UI library that other applications will utilize, I'd like the store the site wide css and assets in the UI library and let the applications access them.
14:05justin_smithmikeyg6754: clojure.java.io/resource
14:06mikeyg6754I've looked a that, how would I go about using it?
14:06justin_smithgive it a path relative to the classpath
14:06seangrovebbloom: You around?
14:06bbloomseangrove: what's up?
14:06justin_smithso you will want to make sure each resource has a unique substructure to prevent shadowing
14:06tbaldridgellasram: it's kindof a well known problem, and one of the reasons golang doesn't use LLVM. LLVM has awesome modularity at the cost of longer compile times
14:07Sethconjustin_smith: SOrry, I think I misunderstood you then.
14:07justin_smithOK
14:07mikeyg6754justin_smith: Basically I just want to keep the css that will be used a lot in this library without requiring it to be copied to the applications that will use them. The applications themselves will end up serving them.
14:09justin_smithmikeyg6754: in the lib, put ["resources"] in the resources path, and put the css in resources/public/css/, then an end user can do (io/resource "public/css/screen.css") or whatever to find that resource
14:09RickInAtlantaI am playing with core.async in clojurescript. I am trying to read from a channel that contains 10 items. if I put <! within a dotimes [n 10],it works. If I have it within while true, I get caught in a loop and nothing prints. Ihttps://www.refheap.com/73522
14:09Bronsallasram: eh, we could move to defrecords+protocols which should give some performance benefits but I'd rather do that only if in the end using maps+multimethods turns out to be the bottleneck
14:10RickInAtlantaI thought while true inside of a go block would pull things off the channel, and then suspend when the channel closes
14:10mikeyg6754justin_smith: Oh, I think I was misunderstanding how clojure.java.io/resource worked, thanks!
14:10justin_smithrasmusto: according to my digital ocean using IRC using friend, yes, digital ocean is fine for using as an IRC vps
14:11seangrovebbloom: Curious to hear your thoughts on components and events/keyboard input in general. Say I have an textarea component that takes `esc` to blur, but that it's in a popup modal that takes `esc` to close. I'm wondering what the existing approaches (outside the browser) are for coordinating who gets what events, without the components themselves being concerned
14:11rasmustojustin_smith: k, thanks. Linode is a bit $ hungry
14:12dnolen_RickInAtlanta: not going to work, you will get caught in a loop reading nil. You need to check for nil and exit.
14:12dnolen_RickInAtlanta: channels just return nil on reads when closed
14:12RickInAtlantaok, thanks. Still surprised I don't get the 10 items to print out before I get hung, but I understand why I get stuck now
14:13RickInAtlantaI supose that could be a function of how light table talks to the browser
14:13coventryIs there a way for a go-loop in an om/did-mount method to know whether it's being executed during render phase? (Can it be running during render phase?)
14:14bbloomseangrove: that's a big can of worms too :-)
14:14bbloomseangrove: i don't have any good answers (yet) but have some places you can look. i'll ping you in a little while, busy now
14:14seangrovebbloom: I figured. I have a quote to prove it.
14:14bbloomseangrove: ?
14:14seangrovebbloom: Sure, thanks
14:15RickInAtlantaah, actually, I bet I do no. because nil is always an avilable value, the go never needs to yield
14:15RickInAtlantaknow
14:18RickInAtlantadnolen_: followup question, why doesn't this crash my browser https://www.refheap.com/73524
14:18RickInAtlantaBy closing the channel inside of my event listener, shouldn't it start firing constantly, once it fires the first time?
14:18dnolen_coventry: go loops can never run during render
14:19dnolen_coventry: except for when they are first established
14:19coventrydnolen_: Great, thanks.
14:20cYmenI am trying to draw stuff with clojurescript on an html5 canvas. Does anybody know how to create nice graphics?
14:21llasramFirst, develop a good sense of visual design
14:21cYmenwait....
14:21cYmenNot done. ;)
14:21cYmenI know, too vague.
14:21llasramBronsa: Well, you seemed to be implying you expected it to be the bottleneck, so... :-p
14:21cYmenI wrote a simple function that draws a grid but not all the lines are the same thickness.
14:22llasramBut obvs profiling will reveal
14:23cYmenIs there a better way to make things scale well and look nice with antialiasing?
14:23dnolen_RickInAtlanta: how can that crash you browser the alert will pause the execution of the JS
14:23cYmenI guess this isn't really the right place for asking but if you have any ideas where to look...
14:25llasramcYmen: I read this a while ago, may be relevant: http://diveintohtml5.info/canvas.html
14:25llasramcYmen: Part w/ "Q: Why did you start x and y at 0.5? Why not 0?"
14:25RickInAtlantadnolen_: I was thinking that once I dismiss the alert, and then close the channel, it will go back to the top of the loop, where my closed channel will now return nil
14:25dnolen_RickInAtlanta: and trigger another alert
14:25RickInAtlantaright, but it doesn't do that
14:25justin_smithcYmen: vector data scales best, but it really depends on whether the content you have in mind *can* effectively be vector
14:27RickInAtlantaI am able to continue executing everything else just fine.
14:41nbeloglazovIs there a way in lein to have separate resource folder for tests? Say I have text files that are needed only by tests and should be included via lein uberjar
14:42cYmenjustin_smith: vector data? I don't even know how to use the canvas with vector data. :)
14:42cYmenllasram: thanks, looking at it
14:42technomancynbeloglazov: you mean should *not* be included in the uberjar?
14:43nbeloglazovtechnomancy: are, yes, *not* be included
14:43technomancynbeloglazov: just use dev-resources for that
14:44nbeloglazovtechnomancy: thanks, will try it
14:47dnolen_RickInAtlanta: no idea then
14:48RickInAtlantadnolen_ thanks for the help. I think I will file that example under "seems to work, but is probably not a good idea"
14:48dnolen_RickInAtlanta: what I mean is that I don't know that isn't working for you
14:48dnolen_I've written code like that works just fine, and I don't have time to trouble shoot at the moment
14:49dnolen_RickInAtlanta: if somebody else can replicate then it seems like a bug you should file
14:55milindaI have a macro which returns an object, when I used that inside deftest I am getting "Can't embed object in code, maybe print-dup not defined". Please let me know if anyone has any idea about this?
14:57amalloymilinda: macros shouldn't return objects: they should return code which, if evaluated, would produce an object
14:58llasramWell, unless the objects are value objects which should be embedable in code :-)
15:13milindaI think what I said was wrong, macro returns a function which returns a object when called
15:13milindathat's why I am confused about from where this code see an object
15:15amalloymilinda: paste your macro definition to refheap or gist or something. you're probably returning a function object, rather than code that produces a function
15:16milindahere is my macro
15:16milindahttps://gist.github.com/milinda/10173848
15:18milindahere is how I tried to embed in a test
15:18milindahttps://gist.github.com/milinda/10174032
15:20amalloymilinda: well, at first glance that looks reasonable. try (macroexpand-1 '(streamit/filter ...))), and see where the #<...> is - that'll be the part you're making into an object
15:20milindathanks amalloy , I'll try it
15:21milindahave to go now, will let you know if I figure out whats going on
15:31gwzhey I have a tree defined in Cons ds, is there anyway I could iterate through it or convert it to zip and perform some functions on it
15:32tbaldridgethis is what I want in the JVM: http://blogs.msdn.com/b/dotnet/archive/2014/04/07/the-jit-finally-proposed-jit-and-simd-are-getting-married.aspx
15:34seangrovetbaldridge: MS is certainly impressive in many ways
15:34Platztail call optimization, thats all
15:35tbaldridgeseangrove: mono has had this for 4+ years, but it's cool to see it come to .NET as well.
15:36seangrovetbaldridge: Well, interesting that Mono had it first
15:36seangrovemono => .NET => JVM ?
15:36seangroveIt's understandable given Mono basically has unlimited resources :P
15:42nDuffGiven a vector, what's an idiomatic and efficient way to get all but the first and last element? I'm currently using (-> pieces (rest) (reverse) (rest) (reverse)), but, well, efficient it's not.
15:43amalloynDuff: you can't do that and get a vector back; if you want a seq it's easy
15:43nDuffa seq is fine.
15:44amalloy(rest (pop pieces))
15:44Bronsaamalloy: huh? ##(let [vec [1 2 3 4]] (subvec vec 1 (dec (count vec))))
15:44nDuffOooh.
15:44amalloyoh, of course, Bronsa
15:44amalloyit's not a vector he can efficiently modify still, but he can continue slicing it efficiently
15:50nopromptdnolen_: ping.
15:57dnolen_noprompt: pong
15:57aphyrRaynes: Think lazybot died; don't see her in #riemann
15:58Raynesaphyr: Aye, his server died and he's a tad too dumb to figure out what to do in that situation.
15:58RaynesHe's on his way back.
15:59aphyrcool :)
15:59aphyrThanks Raynes
16:10gtraklazybot is female?
16:12gtrakyea, I wonder why we didn't have SIMD for the last 16 years it's existed.
16:12gtrakthough I read somewhere the JIT uses it for some stuff.
16:22tbaldridgegtrak: it uses SIMD registers, but last I checked (a year or so ago) it still didn't use SIMD instructions
16:22gtrakah, man.
16:23yotsovthis is not about Clojure, and by now probably everybody here has heard about Heartbleed, but just in case: http://www.pcworld.com/article/2140920/heartbleed-bug-in-openssl-puts-encrypted-communications-at-risk.html
16:23tbaldridgegtrak: that's kindof the .NET vs JVM thing though. The JVM targets the lowest common feature set of all platforms. While .NET is a much more accepting of small things that may make some software non-portable
16:24tbaldridgefor example, this .NET SIMD stuff only works on x64
16:24gtrakhrm. seems like in my naivety that you could simulate it without much of a slowdown. I guess that's all complexity, though.
16:27cYmenhow do I use an event driven system like clojurescript mouse events functionally?
16:27cYmenIs there anything clever or do I just create vars to store states and make a huge mess?
16:27gtrakoddly enough, I was taught a course in concurrent game-programming by one of the folks who helped define SSE :-), in C#..
16:27gtraklike 6 years ago.
16:28gtrakthe course was in C#, the SSE was in intel.
16:28jcromartie1cYmen: you can use a single atom and update it when the event happens, i.e. on keypress just say (swap! app-state handle-event event)
16:28jcromartie1or something like that
16:30cYmenjcromartie1: thanks I'll check out atoms
16:31clojurenewbRaynes: hi, I’m getting ‘IllegalStateException: var: #'me.raynes.laser.zip/edit is not public, compiling:(me/raynes/laser.clj:352:7’ now I’ve upgraded to laser 2.0.0-SNAPSHOT, any ideas ?
16:33gwzhey, for sequence is it possible for me to get the next value in iteration
16:35bbloomdnolen_: i want specify on the jvm :-P
16:35rasmustogwz: ##(for [[a b] (partition 2 1 (range 10))] [a b]) ;?
16:35cYmen (swap! mousestate #(true))) <- true.call is not a function
16:35lazybot⇒ ([0 1] [1 2] [2 3] [3 4] [4 5] [5 6] [6 7] [7 8] [8 9])
16:35cYmenshouldn't wrapping it in #() help with that?
16:35dnolen_bbloom: yep
16:35hiredman,(macroexpand '#(true))
16:35clojurebot(fn* [] (true))
16:36bbloomdnolen_: also, i want all the damn clojure.lang interfaces to be protocols dammit
16:36hiredman,(doc constantly)
16:36clojurebot"([x]); Returns a function that takes any number of arguments and returns x."
16:36hiredman,(doc reset!)
16:36clojurebot"([atom newval]); Sets the value of atom to newval without regard for the current value. Returns newval."
16:36cYmenhiredman: okay, thanks
16:36gwzrasmusto: i am using deseq
16:36cYmenbut I would still like to know why it doesn't work
16:37rasmustogwz: same thing should apply for doseq
16:37hiredmancYmen: the macro expansion is very clear
16:37cYmenSorry, I don't get it.
16:38cYmenIt looks like what I want.
16:38cYmenAlthough I do not know what the * means.
16:38pjstadigbbloom: https://github.com/pjstadig/clojure/tree/clinc
16:39hiredman1. it is a no arg function, how is that going to work with swap! 2. it has (true) in the body, and true isn't a function, how is that going to work?
16:39pjstadigsome of the clojure.lang interfaces return primitives (like Counted specifically) which can't be done and/or could have performance consequences if done to return Object i guess
16:39bbloompjstadig: hmm interesting
16:40pjstadigbut it worked suprisingly well to kind of slipstream the AOT interface from a defprotocol into clojure (for the simple case that I tested with IMeta)
16:41pjstadigi generated an AOT interface as clojure.core.protocols.IMeta then made clojure.lang.Meta extend that inferface
16:42bbloompjstadig: interesting...
16:42bbloompjstadig: cool stuff
16:42bbloompjstadig: doesn't help me right now, but worth looking at. thanks!
16:42pjstadigthere are maybe still some issues with bootstrapping the whole thing when loading clojure, but it was interesting to work on
16:43bbloomi'd imagine. bootstrapping always has issues and is always interesting ;-)
16:46justin_smithcYmen: oh wait, I did not see the entirety of what you were saying. Basically I meant use something like dom+svg instead of canvas. But you could also use canvas and calculate the right pixel values with antialiasing, I am sure someone has written an antialiasing image resizing function in js
16:47pjstadigbbloom: i've been tempted to submit a conference talk called "Experiments in Extending Clojure: A Menagerie of Half Finished Projects"
16:47bbloompjstadig: haha, awesome. i'd watch that
16:47bbloompjstadig: what are the other highlights?
16:48pjstadigrewriting clojure.lang interfaces as protocols, making ISeq extend java.lang.CharSequenc, implementing invokedynamic support
16:48pjstadigand also my half-assed attempt to target the clojurescript compiler at elisp
16:48bbloompjstadig: and what have you learned? :-)
16:49gwzhow would I iterate a tree defined in cons?
16:49hiredman"all is suffering"
16:49gtrakgwz: tree-seq
16:50pjstadigbbloom: rewriting clojure.lang interfaces as protocols has some potential, making ISeq extend java.lang.CharSequence was a bad idea, invokedynamic could be interesting but i don't have the patience, and i want to script emacs with clojure
16:50cYmenjustin_smith: is there something for dom+svg you can recommend?
16:50pjstadigthere might be some other interesting lessions, but i'd have to think about it
16:50cYmenbasically I have no clue and just started looking around
16:51hiredmanpjstadig: your invokedynamic stuff was replacing clojure's reflector right?
16:51gwzso if I have something like (:Root [5] (:Left [5] [:Value 3])), I can just call tree-seq on it?
16:51justin_smithcYmen: well, svg vs. canvas is a big choice and has to do with what you are trying to display, but om can manipulate svg contents the same way it would any other dom element
16:51bbloompjstadig: i want interfaces as protocols b/c i want extend for mixins so i don't need to reimpl trivial methods for maps, etc. why is charseq a bad idea? (i have not thought about it), faster is always welcome, and *shrug* i can script vim with clojure now so nah nah poo poo
16:51pjstadigbbloom: also this was an interesting experiment in writing a new persistent data structure and trying to make it as fast as java https://github.com/pjstadig/deque-clojure
16:52pjstadighiredman: yeah it caches reflection results at callsites
16:52justin_smithcYmen: if your image is better represented by a raster of pixels, use canvas definitely. If your image is better represented by scalable vectors, consider using svg (but you still may end up being better off using canvas or 3.js, depending)
16:53gtrakI fixed the bencode impl in cider this morning.. it's a recursive algorithm over a temporary emacs buffer.. I miss data.
16:53justin_smithcYmen: I personally have always like svg because it is a higher level representation of a shape (more declarative), but browser support is only recently at a reasonable point with it I think
16:53pjstadigbbloom: there ended up being some incompatibilities in the interfaces where a char sequence should print as a string, but an ISeq should print as (\a \b \c) which has some weird results
16:54gtrakthat said, the elisp debugger is great.
16:54pjstadigbbloom: i think there was also an issue with how charAt and nth lined up or something
16:55bbloompjstadig: yeah, strings are not really collections....
16:55tbaldridgeunless you're writing code in erlang
16:55tbaldridge:-P
16:55bbloompjstadig: i think paul graham was like "if computers were faster, then strings would just be arrays or whatever"
16:55hiredmangotta link vars using invokedynamic
16:55bbloombut that turns out, that no... that makes no sense at all
16:55bbloomruns of glyphs are seqs, that makes sense
16:56bbloombut they are far away from random access....
16:56pjstadigbut with ISeq implementing CharSequence you could match regexes against sequences of characters, but yeah it turns out to be kind of weird
16:56justin_smithbbloom: if computers were slower, arrays would basically be strings (see C)
16:56pjstadigit would bring strings and seqs a little closer together
16:57gwzanyone?
16:57clojurebotanyone is anybody
16:58edwIn core.async, a `<!' must be lexically "inside" a `go` to avoid an assertion error. This seems...unnecessary. Is there a discussion of this somewhere?
16:58justin_smithgwz: have you tried that in the repl?
16:58amalloygwz: you can use tree-seq, but really trees are pretty easy to handle yourself by writing a recursive function
17:00blake__What would " (:refer-clojure :exclude [==]) " do?
17:01bbloomblake__: see (doc ns) in your repl
17:01blake__bbloom: I've read it. I still don't get it. Does it just suppress a warning message?
17:02bbloomblake__: it prevents == from being referable from the current ns... which means that if you define == again later, there will be no warning to suppress
17:02justin_smithblake__: when you exclude, then the clojure.core version of the function is not imported
17:02blake__Wait, those two explanations seem contradictory.
17:03justin_smithblake__: in what way? :exclude [==] means no error or warning if you define a function called == yourself
17:03justin_smithor import one from a different ns
17:03bob2edw, ? go is a macro, so <! must be lexically inside it
17:04pjstadigor actually go is a compiler that compiles its body, so <! must be in its body
17:04amalloyedw: <! doesn't exist as a real thing, it's just a "marker" to control how the go macro behaves
17:04blake__justin_smith: So, if I had that, then tried to use "==", it would fail, unless I'd already defined "==" in that ns?
17:04amalloyin the same way that you can't have a catch that's not inside a try
17:05justin_smithblake__: right, it means you don't want to use clojure.core/==
17:06blake__Interesting. The code I'm looking at neither uses nor defines "==". It does define and use "*==".
17:06justin_smithwell no need to exclude the function if you don't want to override it
17:06pjstadigblake__: the exclude may be vestigial; perhaps at one time '*==' was called '==' but the author changed opinion and then forgot to remove the exclude
17:07edwamalloy: But a `<!` does exist for use by thread. So these are two different `<!`s?
17:07amalloythat's <!!
17:07blake__pjstadig: Entirely possible. Interesting that only "==" is in the exclude when there are operators like "*<=" "*>" and so on. But perhaps those came later.
17:08amalloyright?
17:08bbloomamalloy: is that <! dammit! or <!! dammit. ?
17:08edwWell there's def a `<!!`...
17:08pjstadig<!!!!!!111
17:08edwGetting some line noise here...
17:08edw+++
17:09pjstadigedw: http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html this explains the difference between <! and <!!
17:09gwz (:Root [5] (:Left [5] [:Value 3])) how would I convert that to zipper if thats even possible?
17:10edwpjstadig: Thanks. (Though I thought I did know the difference, namely <! is async, <!! is synchronous. But I'll go read that.)
17:12justin_smithgwz: it is similar to tree-seq, but you also give it instructions on how to make a node
17:12justin_smithgwz: the function clojure.zip/zipper that is http://clojuredocs.org/clojure_core/clojure.zip/zipper
17:14gwzso you basically state what part of sequence/list is what part in tree?
17:14justin_smithyou tell it how to derive the children of each node, and how to add children to a node
17:14justin_smiththen you get a zipper back
17:15edwamalloy and pjstadig : I guess I had dreams of being free to use <! and >! inside a `go`, dynamically speaking.
17:16gwzin my case, I just need to iterate through tree so don't need any additions, the thing is though that I need to know the root value from children while iterating
17:16edw(And not just lexically.)
17:17justin_smithgwz: I think what you really need is as amalloy hinted above a recursize function that knows how to map over each node of the tree and then a function to call on each node on the way down
17:17justin_smithgwz: also, it may be you just want clojure.walk/postwalk or similar
17:17gwzthe thing with postwalk/walk is that you cant really know the root node when you are in child I think
17:18gwzso if I am at Left, I want to know that the Root value was 5
17:18justin_smithin that case you probably want your own custom recursive walking function
17:18amalloygwz: so just write a recursive function. really. then the value you want to save is a parameter, and that's it
17:18justin_smiththat carries state from parents as needed
17:19amalloy(or, possibly, a closed-over value - close enough)
17:24coventryAny clues as to why clojure might be complaining "PSQLException The server requested password-based authentication, but no password was provided." when psql <db name> as the same user works without any password challenge at the shell prompt?
17:26bob2env | grep PG ?
17:26justin_smithhttp://www.postgresql.org/docs/8.2/static/auth-pg-hba-conf.html coventry: maybe the method the jbdc driver is using is configured differently in pg-hba.conf?
17:27coventryThis had the answer: http://stackoverflow.com/a/4562599/1941213 Just needed to paste the actual error message into the browser, rather than "turn off postgres authentication" or the like. :-)
17:27justin_smithcoventry: aha! I was write, it was pg-hba.conf
17:27justin_smith*right
17:28bob2it's always pg_hba.conf :/
17:28coventryYep, thanks guys.
17:28technomancypg_hba.conf is the worst
17:40gwzis there a function to check if something is persistent vector equivalement of keyword?
17:41justin_smith,(vector? [])
17:41clojurebottrue
17:41justin_smithgwz: if you had tried the first intuitive thing, you would have had your answer :)
17:41justin_smithgwz: also http://clojure.org/cheatsheet
17:41gwzlol thanks
17:42gwzis something like this valid, (if (= vector? (last input))
17:43justin_smith(if (vector? (last input)) ...)
17:47gvickersI have alts! in a let statement, inside a loop, inside a go block but after either of the channels alts! is watching are updated, the action is only fired once. Is there a way to keep using alts! to continuously call functions when a channel is updated?
17:48dnolen_gvickers: paste please
17:49gvickershttps://www.refheap.com/73561
17:52hiredmangvickers: if you don't recur loop does nothing
17:54gvickershiredman: thanks
17:56miseria"en la vieja butaca, dos viejitos sentados, amigos por siempre, hoy no tienen de que hablar, todo esta consumado" bienvenidos: http://castroruben.com *temo_a_un_ser_sin_rival*
18:28ticking_http://congresoingegraf.es/PDF/25768.pdf
18:28ticking_uhrg, sorry, I'm writing a 3d printing tool in clojure, wrong channel though ^^
18:33danielszmulewiczHi, macro noob here, I want something very simple, please don't laugh. The first macro argument is a function and the rest are arguments to that function. All it has to do is call the fn with the arguments. So if the macro is called x, I should be able to write (x + 5 5) and it would return (+ 5 5). (x + 5 5 5) would return (+ 5 5 5).
18:34justin_smithdanielszmulewicz: I
18:34justin_smith'm not sure how to help you without just writing it
18:34justin_smithit is very simple
18:35danielszmulewiczjustin_smith: yes, please don't hesitate to just write it. I'll learn from reading it. :-)
18:35justin_smith(defmacro call-fn [f & args] `(~f ~@args))
18:36danielszmulewiczjustin_smith: thanks a bunch.
18:36justin_smith` is syntax quote, ~ is unquote, ~@ is unquote-splicing
18:36danielszmulewicz(inc justin_smith)
18:36lazybot⇒ 32
18:37justin_smithand the & in the args vector is the same as it would be in an fn
18:37danielszmulewiczjustin_smith: I've read some tutorials, but I'm rusty. I get it now. Thanks.
18:38justin_smithalso doable as a function actually: (defn call-f [f & args] (apply f args))
18:39hyPiRionwat
18:40hyPiRionI would just use apply and get over with it
18:41hyPiRionthen again, I don't read the log and notice that someone explicitly wanted to learn about macros
18:41justin_smithalso he asked us not to laugh, you meanie
18:41justin_smith:)
18:43hyPiRionI just read the last sentence, the call-f definition.
18:44justin_smithyeah, I was just joking anyway
18:46hyPiRionhumour is hard on the interwebs
18:46justin_smithyes it is
18:47akurilinUhm, random non-clj question: does anybody know of examples of nginx user-agent-based redirections that work?
18:51justin_smithakurilin: this looks right - http://stackoverflow.com/questions/10627596/nginx-proxy-or-rewrite-depending-on-user-agent
18:53akurilinjustin_smith: apparently there's a difference between rewrite ^ to another location and rewrite to a specific .html file
18:53akurilinbecause the former would continuously throw me into an infinite redirect loop
18:53akurilinwhere it'd check the UA string and redirect
18:54akurilinbut rewriting to a file seems to work because that seems to be the final action that requires no further processing
18:54akurilinI'd run this reasoning by the #nginx people but Russians don't talk to me apparently
18:57justin_smithwell if it rewrites to a different location, that location shouldn't also rewrite?
18:57justin_smithmaybe define the target as a separate site with its own rules
19:01akurilinYeah in my head I figured that it'd interpret a rewrite to /foo as a rewrite to /foo/index.html based on the server config, which it does, but it stil repeats the rewrite
19:01akurilinas opposed to stopping
19:01akurilinwhich makes sense I guess
19:07technomancyhttp://howistart.org/about
19:14arrdemin case anyone needs an absurdly sized wallpaper: https://pbs.twimg.com/profile_background_images/453670984650747904/NoRJ-shl.png
19:14akurilintechnomancy: what's that?
19:15technomancyakurilin: project from a co-worker of mine
19:15hyPiRiontechnomancy: seems interesting, really hope there will be more information up later
19:15Jaoodarrdem: did you made it?
19:16Bronsaarrdem: ugh that brightness
19:16arrdemBronsa: someone else who runs dark displays goood goooooood
19:16arrdemJaood: I photoshopped it to huge scale from someone else's post from years gone by
19:17arrdemJaood: I have a couple versions floating around, one of which is actually sized for my displays and that one which was sized for Twitter.
19:18Bronsaarrdem: my background is almost entirely solid Grey15
19:18arrdemBronsa: I run monokai and molokai for emacs.. which typically turns about 80% of my display that color :P
19:20amalloyarrdem: my emacs background is #000000. get on my level
19:20arrdemamalloy: one day I'll make your level... I think I've given up on reaching technomancy's :P
19:20hiredman(same as his foreground)
19:21Bronsaamalloy: I used to have #000000 too, but found out that dark grey is more relaxing to my eyes
19:21amalloyBronsa: oh, probably so. the high contrast helps me see, so i lose out on some comfort
19:21technomancyI think it depends on the lighting surrounding your screen
19:22technomancyyou always want to go with whatever results in the lowest eye strain afaik
19:22hyPiRionOh that explains everything
19:23hyPiRionI'm comfortable with #FFFFFF during winter, but not in the summer
19:23amalloytime for someone to plug f.lux now, right?
19:23arrdem(inc flux)
19:23lazybot⇒ 1
19:23technomancyf.lux is time-based
19:23technomancywhat you really want is a light sensor
19:24hyPiRionright
19:24arrdemnah man, just maximum redshift all the time
19:24arrdemwe don't really need color now do we..
19:24amalloyarrdem: that's probably not an unreasonable choice at home
19:24BronsaI've actually tried using redshift/f.lux and found the experience awful :/
19:25arrdemf.lux behaves like crap with multiple displays and no RandR
19:25arrdemmy leftmost screen will redshift and the others won't
19:25arrdemlooks absurd
19:29blake__Is there a cross-ref tool that will analyze a bunch of cljs and produce a list (or interactive tool) saying where the identifiers are defined and where they're used?
19:31arrdemblake__: you could probably build such a thing using namespace introspection or tools.analyzer, but out of the box I don't think so.
19:33blake__'k. Would "blind" play into this?
19:34arrdemblake__: blind is an empty repo...
19:34blake__sorry, tools.reader
19:35arrdemblake__: but yes tools.reader is probably involved here...
19:35arrdemif you don't want to go the "load and introspect" route.
19:36blake__Don't know what route I wanna go yet. I'm used to being able to just click and say "Hey, where is this used?" =P
19:37arrdemI mean.. you could probably knock something together using just regexes or emacs tag search...
19:37arrdemboth of the above would be full blown compiler introspection implementations of that
19:37blake__Heh, maybe YOU could...
19:37arrdemand cider/nrepl probably has a way to do symbol finding, I just don't know of it.
19:37arrdem$google emacs tags clojure
19:37lazybot[clojure-mode/clojure-mode.el at master · clojure-emacs ... - GitHub] https://github.com/clojure-emacs/clojure-mode/blob/master/clojure-mode.el
19:38justin_smitharrdem: there is always the caveman way I do it (m-x rgrep)
19:38amalloycider has "look up this symbol", but i'm pretty sure it doesn't have "where is this used"
19:38arrdemjustin_smith: I mean.. _I_ know that...
19:38arrdemM-x git-grep is worth mentioning too :P
19:38hiredmanclojure mode did have something like that I think, and it was a real hack
19:39technomancyswank clojure had it, but yeah, it was terrible
19:39technomancybasically just a wrapper around grep
19:39hiredmanah
19:39hiredmansomething something who calls
19:40arrdem"\(def.*\s*$1"
19:40blake__Yeah, I'm tentatively approach emacs. It seems enough to tackle Clojure without also trying to tackle that.
19:40justin_smithblake__: there is grep -R / ack / whathaveyou, which are OK but just don't have the "click here to go to the location" featuer m-x rgrep has
19:40technomancyI tried to convince danielglauser to port it to nrepl
19:41technomancynudge nudge
19:42blake__ack?
19:42arrdem$google grep ack code search
19:42lazybot[Beyond grep: ack 2.12, a source code search tool for programmers] http://beyondgrep.com/
19:42justin_smithan alternative / improvement to grep, especially good for finding variable references in a source tree
19:43blake__Gotcha. Hmmm.
19:46justin_smithhttps://github.com/technomancy/swank-clojure/blob/master/src/swank/commands/xref.clj#L42
19:46justin_smithtechnomancy: it actually used the reader to create a data structure to plumb
19:46justin_smithalso that ns looks fairly self-contained
19:46justin_smithat a glance at least
19:47arrdemclojure.walk and swank.util..
19:47justin_smithalso that code is very slow because of the amount of reading it does on each call
19:47technomancyjustin_smith: ah, well... the reader really still isn't good enough for that
19:47technomancyit can't tell the difference between locals and vars
19:47justin_smitharrdem: swank.util is pretty small actually
19:48hiredmanaphyr has some dependency thing
19:48justin_smithhttps://github.com/technomancy/swank-clojure/blob/master/src/swank/util.clj
19:48arrdemBronsa: I assume that t.r doesn't do var vs. local symbol qualification, and that's left to t.a or some other client?
19:49hiredmanhttps://github.com/aphyr/meitner
19:49arrdemoh damn
19:49Bronsaarrdem: yeah, the reader doesn't know anything about that
19:49hiredmanif you have all the var names you can examine var metadata for locations
19:49arrdemjustin_smith: check out hiredman's link
19:49justin_smitharrdem: yeah, checking it out now, looks cool
19:50arrdemBronsa: as it should be. thanks
19:50arrdem!
19:50justin_smitharrdem: that seems reverse of what we want though - callees rather than callers
19:50technomancyhiredman: looks like just the ticket
19:50justin_smiththough of course it could be used to make a better version of the swank thing
19:51arrdemjustin_smith: sure, but calers is a closure over the entire program anyway
19:51justin_smithyeah
19:51arrdemjustin_smith: so run this on the whole damn thing, then your answer is the subset which have the target for a dep.
19:51hiredmanor, you know, use codeq
19:52technomancyhiredman: actually it kind of boggles me why this isn't already turned into a who-calls impl
19:52justin_smithyeah, which is pretty much a replacement for what swank was doing
19:52technomancylike... why go to all this trouble and then not finish the last 30 minutes to do that? =)
19:53justin_smithhttps://github.com/aphyr/meitner/blob/master/src/meitner/core.clj#L48 ????
19:53hiredmanactually, I always forget, does codeq actually do a call graph?
19:53arrdemhas anyone actually used codeq as a primary version control system?
19:55arrdemjustin_smith: solid implementation of foo
19:56justin_smitharrdem: the busywait is a lost art
20:07gfrederickshiredman: it doesn't; I was poking around with adding that at clojure/west
20:07gfredericksusing tools.analyzer.jvm
20:08hiredmangfredericks: :/
20:09gfredericksall it does is haxily look for def-like things and grab their name
20:11blake__ack is pretty cool.
20:11Bronsagfredericks: so, Compiler.java evaluates differently expression whose first element is a symbol starting with def which I find really ugly
20:11gfredericksBronsa: ooh my
20:11Bronsait's a goal of mine to try and find a way to break the compiler using this, but I've been failing at it for the last couple of months
20:11Bronsai'll keep trying though.
20:12gfredericksBronsa: because that's the only way to justify patching it? :)
20:12Bronsagfredericks: exactly
20:12gfredericksfun strategy for code cleanup
20:12gfredericksBronsa: is the treatment difference easy to summarize?
20:12danielglausertechnomancy: That guy's a slacker
20:13arrdemdanielglauser: takes half an hour to respond to IRC... dang what a slacker
20:13danielglauserinc
20:14Bronsagfredericks: easier to show you the code
20:14amalloyBronsa: wow, do you have a link? i don't remember seeing that
20:14Bronsahttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6696-L6703
20:14nodenameanybody out there to answer an Om/HTML layout question? Swannodette etc?
20:14dnolen_nodename: what's up?
20:14nodenameahh
20:15Bronsaamalloy: gfredericks the tl;dr is that (def..) won't get wrapped in a ^:once fn*
20:15nodenameok I am using om-autocomplete and I need three of them but the default imll of a single one puts the input-view and results-view contiguously in a div.
20:16Bronsathis implies that (defn def* []) (def*) <- this invoke will get interpreted rather than JIT compiled
20:16dnolen_nodename: oh hmm, never actually used om-autocomplete - might want to ask if that can be made more flexible via an issue if it's really a problem
20:16nodenameI want three input fields and their respective results-views should be drop-downs (only one active at a time)
20:17gfredericksBronsa: oh interesting
20:17nodenameMore generally, can a div have non-contiguous elements?
20:18nodenamemaybe I can template the desired layout and when building an autocomplete pass in the existing components
20:18Bronsaamalloy: I did some git blaming and it looks like that change was introduced with deftype* IIRC
20:19hiredmanBronsa: right, but that is only for eval
20:19hiredmanso it only happens at the repl
20:19hiredmanoh, I guess load calls eval
20:20Bronsahiredman: uh?
20:20Bronsayeah
20:21hiredmanand compile also calls eval (but also calls emit)
20:21Bronsasure, but what you get in memory is the result of the call from eval
20:22hiredmanright
20:22Bronsahiredman: anyway, I really don't think there's any way where this might cause an issue
20:23hiredmanBronsa: sure, well, I mean, it is an optimization some compilers purposefully do, replacing ((fn [] x)) with x
20:23Bronsait just really hurt my eyes everytime I see that line (which luckly doesn't happen much often anymore)
20:23Bronsahiredman: welll in clojure it's not always that case that x == ((fn [] x))
20:23hiredmansure
20:24dnolen_nodename: it just sounds like the autocompleter needs to be more flexible
20:26nodenamemaybe so. the default implementation of container-view is in the example usage, not in the autocomplete component itself...
20:26nodenameHave a link to sgrove's claimed Om drop down component?
20:26dnolen_nodename: if container-view is the entire cell for a particular item, you be able to do what you want
20:27dnolen_nodename: I don't
20:27nodenamemy html-fu is not up to it… spacing?
20:28dnolen_nodename: i'm just clear what you're issue is "non-continguous"
20:29dnolen_or you want to have them be split
20:29dnolen_on 2 lines
20:29dnolen_display: block;
20:29dnolen_is the CSS for that
20:31nodename3 input-fields stacked vertically. With each one is to be associated a drop down that appears just below it when its contents change. Each input-dropdown pair constitutes a autocomplete. Only 1 drop down visible at a time.
20:32nodenameOf course selection from a drop down fills the corresponding entry field
20:32nodenamemaybe this can be done with a single drop down for all three, and it appears in the right position for each?
20:42bob2so, I have a compojure webapp, and I'd like to add a thing to it that asynchronously and periodically fetches some data from another app, and updates a map (safely, of course). what's a good way to have that task run?
20:46justin_smithbob2: if it's that simple how about a thread the repeatedly sleeps and then updates the map?
20:47justin_smithif you want to do things like checking the error state you could use an agent that invokes itself after sleeping
20:48brunovbob2: you can also use https://github.com/james-henderson/chime to create a channel that sends a message on a periodic basis
20:48brunovif you don't want to dedicate a whole thread to the task
20:49brunovbut justin_smith's approach is better I think
20:50justin_smithbrunov: well that's another vote for the agent version too, since agents use a pool and not a thread per agent
20:51brunovjustin_smith: right. But it's still a dedicated thread that will be sleeping most of the time. With channels you just use a "lightweight thread". Most of the time it doesn't matter though.
20:51justin_smithbrunov: the agent threads are there whether you use them or not
20:52justin_smithand core.async uses a pool just the same as agents do
20:52brunovYes, but sleeping on a threads blocks it, while the channel approach simply "parks" the lightweight thread. Again, sublte and won't matter, but it's a difference nonetheless.
20:53justin_smithahh, yeah, the sleep part
20:53brunovyeah it's only relevant if you want to have thousands of schedules and you can't afford to sleep on thousands of threads
20:53brunov*schedulers
20:59bbloom,(meta #'inc)
20:59clojurebot{:ns #<Namespace clojure.core>, :name inc, :file "clojure/core.clj", :column 1, :line 881, ...}
20:59bbloom,(meta (eval #'inc))
20:59clojurebot{:ns #<Namespace clojure.core>, :name inc, :file "clojure/core.clj", :column 1, :line 881, ...}
20:59bbloomok nevermind, i'm crazy
21:02bob2brunov, justin_smith ah thanks - it's just the one thing, and it's every ~10s for ~20ms, so a thread should be fine
21:03brunovbob2: cool
21:03tuftanyone familiar with clojure.test.check or property based testing in general?
21:04tufttrying to write a generator for some datomic triples
21:04tuft.. need ids to be unique, though, not random =\
21:05reiddrapertuft: can you just use incremental ids after the rest of the data is generated?
21:06reiddrapermaybe generate a vector of random triples, then use map-indexed to give them incremental ids
21:06akurilinDo you guys have a strong preference between bitbucket and github? I hear people swear that github is a vastly better experience
21:07tuftreiddraper: trouble is, some entities have one attribute, others two
21:08reiddrapertuft: I don't know your specific problem, but does the general idea of generating ids after not work then?
21:09tuftreiddraper: well, i could dig around more. from the outset it looks like test.check's property checking functions expect a generator vs any old lazy sequence
21:09tuftreiddraper: wonder if i could write my own generator using range
21:10tuftprobably would break some invariant to make a non-random generator...
21:10reiddrapertuft: you'll write your own generator uses the combinators in the gen namespace
21:10reiddraperHave you read the generator writing guide in the doc folder of the repo?
21:11beamsoakurilin: i use bitbucket for private repos and github for public repos
21:12tuftreiddraper: indeed no. thanks i'll check it out
21:12reiddrapertuft: np
21:14tuftreiddraper: oh if you mean this then yes =) https://github.com/clojure/test.check/blob/master/doc/intro.md
21:14reiddrapertuft: I do, yes
21:17reiddrapertuft: perhaps another way of thinking about it: generate vectors of vectors of your entities. The inner vectors will represent one entity. Then use fmap to apply the incremental ids and flatten the list of tuples
21:19reiddraperSome of the inner vectors can have one attribute, some two
21:20tuftreiddraper: ah perfect, that should work
21:20tuftthanks =)
21:20tufti'll report back
21:20reiddrapertuft: np
21:38bbloom,(locking :foo)
21:38clojurebotnil
21:38bbloom,(do (monitor-enter :foo) (monitor-exit :foo))
21:38clojurebot#<IllegalMonitorStateException java.lang.IllegalMonitorStateException>
21:38bbloom^^ what's up with that?
21:39akurilinbeamso: ok cool thank you
21:42bbloom,(let [x :foo] (monitor-enter x) (monitor-exit x))
21:42clojurebotnil
21:42bbloomhmm seems like they only work on names, heh, odd.
21:48bbloomoh hmm it's not locals
21:48bbloomit seems that it's actually the jvm ensuring that a lock/unlock appears in a try/finally pair
21:48bbloomcrazy
22:03shriphanihi does anyone here know how I can make hiccup spit out pretty-printed html ?
22:17akaSo twitter makes it clear I'm not the only one stoked for dnolen_ + Cognitect
22:18arrdemcognitect has a ridiculous team already
22:18arrdemadding dnolen_ is just overkill, but totally osum
22:18akanow they're just being ridiculous
22:18arrdemcount me stoked :P
22:25akaAnyone aware of a clojure lib that provides oauth based authentication for the major social sites like facebook/github/twitter/linkedin/etc... ?
22:27tuftreiddraper: fmap approach worked great
22:28arrdemaka: http://hydra-media.cursecdn.com/dota2.gamepedia.com/7/7f/Sven_item_05.mp3
22:28reiddrapertuft: happy to hear
22:36akaarrdem: we get it they can write the best f'ing apps ever :D
22:37akaWhat is the current state of ClojureCLR? Is it pretty much feature complete and/or usable?
22:39n00by_2I have a question: by transposing an array I can treat the columns like rows. Is there an analogous operation that allows me to treat the diagonals as rows?
22:39nDuffaka, ClojureCLR had feature parity with Clojure/JVM way back in the Clojure 1.0 days.
22:40nDuffaka, ...it might have fallen behind a little since then -- being under different maintainership -- but expecting it to be usable is very safe.
22:40akaI actually have no intention of using ClojureCLR.... was just curious.
22:41akathanks for the info
22:47ddellacostaaka: tooting my own horn here, but you can check out friend + friend-oauth2: https://github.com/ddellacosta/friend-oauth2 (examples: https://github.com/ddellacosta/friend-oauth2-examples)
23:09akaddellacosta: awesome thanks
23:12akaddellacosta: any reason you didn't do a twitter example? Without more than a quick skim this looks great
23:12ddellacostaaka: twitter doesn't use oauth2 I don't believe
23:12ddellacostaaka: could be wrong, haven't checked in a while
23:12akaoh I just assumed
23:13ddellacostaaka: other than that, just a lack of time. :-)
23:13akayeah well I'm working purely off assumption here
23:13akaso I'm likely wrong
23:13ddellacostaaka: oh, no, looks like they do
23:14ddellacostaaka: or...do they? confused...
23:15ddellacostaaka: maybe still not--I see some oauth2 endpoints, which is confusing, but this is all they have on their main page: https://dev.twitter.com/docs/auth/oauth
23:15akaI'm likely going to implement it (hopefully in the same fashion you are) and if that's the case I'll hit you with a pull request
23:15akayeah their docs seemed vague
23:16akaspecicially "based off of OAuth"
23:16ddellacostaaka: that'd be great--if you figure out if/how they support it, I'd love to add an example
23:16akathat makes me wonder
23:16akafiguring out if they really use oauth could be more difficult than actually authenticating through twitter
23:18ddellacostaaka: they definitely use oauth 1.1, but doesn't seem like they support oauth2
23:20bob2is there a neat idiom for taking a list of maps that have an 'id' key, and converting it to a map of maps, keyed off 'id'?
23:25arrdembob2: map?
23:25arrdembob2: well. reduce.
23:25xeqiI'd probably write ##(into {} (for [{:keys [id] :as x} [{:id 1} {:id 2} {:id 3}]] [id x]))
23:25lazybot⇒ {1 {:id 1}, 2 {:id 2}, 3 {:id 3}}
23:25xeqithough a reduce works too
23:26arrdem,(reduce (fn [a {:keys [id] :as v}] (assoc a id)) {} [{:id 1 :a :b} {:id 2 :b :a}])
23:26clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/assoc>
23:26arrdem,(reduce (fn [a {:keys [id] :as v}] (assoc a id v)) {} [{:id 1 :a :b} {:id 2 :b :a}])
23:26clojurebot{2 {:id 2, :b :a}, 1 {:id 1, :a :b}}
23:26bob2ah, I was unclear: {:id 1 :somekey "somevalue"} -> {1 {:somekey "somevalue}}
23:28xeqi&(doc dissoc)
23:28lazybot⇒ "([map] [map key] [map key & ks]); dissoc[iate]. Returns a new map of the same (hashed/sorted) type, that does not contain a mapping for key(s)."
23:29vermahmmm
23:29ddellacosta&(group-by [{:id 1} {:id 2}])
23:29lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: core$group-by
23:29verma,(dissoc {:a 1 :b 2})
23:29ddellacosta&(group-by :id [{:id 1} {:id 2}])
23:29clojurebot{:b 2, :a 1}
23:29lazybot⇒ {1 [{:id 1}], 2 [{:id 2}]}
23:29verma,(dissoc {:a 1 :b 2})
23:29clojurebot{:b 2, :a 1}
23:30verma,(dissoc {:a 1 :b 2} :a :b)
23:30clojurebot{}
23:30ddellacostabob2 ^ you can get most of the way there with group-by
23:30vermawonder why there's a dissoc which just takes a map and no keys
23:30seangroveWatching the Alan Kay Future video, wasn't expecting this at all
23:34bob2ah cool, group-by is nearly exactly what I wanted
23:34bob2(aside from putting the val in a vector, which is suboptimal in my case since :id is unique)
23:34hiredman,(apply dissoc {} ())
23:34clojurebot{}
23:41`szxseangrove: in what sense?
23:45seangrove`szx: Much higher-level than I expected. Very compelling.
23:45`szxi feel like his talks are usually like that
23:46seangroveGood point, I should probably start raising my expectations for his talks :)
23:46`szxi've seen a couple of his talks and i don't think any of them were technical
23:47`szxyeah, i don't know about that - i feel like i've heard this one before :)
23:49kenrestivois there some way to exclude from :aot a specific list of namespaces?
23:49kenrestivoin lein's :aot key?
23:51kenrestivoah, nevermind. :aot :all in clojure-android does the trick
23:51kenrestivoand :aot-exclude-ns