#clojure logs

2014-08-14

00:41johnwalkertechnomancy: here is the plugin i was talking about: https://github.com/johnwalker/lein-plz
00:41johnwalkerhaven't switched from rewrite to just lein yet
00:41johnwalkerand i have to add user support abbreviations, but it does the job
02:12arrdemjohnwalker: nice one!
02:13arrdemjohnwalker: would/could you add a clojars search? `lein pls add meajure` would be amaze
02:37johnwalkerarrdem: thanks :)
02:38arrdemlol @ :pls profile key
02:38johnwalkerarrdem: i think i like that idea
02:38johnwalkeryeah i was in a good mood when i made it
02:39arrdemjohnwalker: I just think it makes sense... ~80% of the time I know artifact ID but not always group ID. consequently being able to say `lein pls add ...` have search as a fallback would be amaze
02:39johnwalkeri still am. lein is pretty good
02:40johnwalkeri'll check search results. if they're unique enough, i'll do it ;p
02:40johnwalkerit might be easier to just specify the full dependency once and remember it by the abbreviation
02:41arrdemthat could work too.
02:41arrdemeven defaulting to the first result, and printing the dep vector prior to adding would be nice
02:41johnwalkeror a "did you mean ?" when an abbrev isn't found
02:41johnwalkerso much you can do with the idea
02:42arrdemeh that's real search tho
02:42arrdemjust default to the first clojars result, tell me what it was and make me deal with the failure cases
02:42johnwalkerahh, i like that
02:42arrdemthat'll cover the overwhelming majority of my use
02:42arrdemalso what's your typed-clojure work? were you the GSoC student this year?
02:42johnwalkeroh nah, i just made an emacs minor mode ;)
02:43arrdemo
02:43johnwalkeri've been following oxcart
02:43johnwalkervery exciting
02:43arrdemtoday's been the real fun...
02:44arrdemhttp://github.com/oxlang
02:44supreme__possible to write GUI os x applications in clojure?
02:44johnwalkeroh my
02:44arrdemyeah I went full retard today
02:44arrdemsupreme__: anything's possible with a turing complete langauge featuring FFI...
02:45johnwalkerthat will be interesting
02:45arrdemthat clojure build totally works
02:45arrdemthe next question is how do I need to structure the Oxcart compiler such that lib-clojure is a runtime dep of Oxcart compiled programs.
02:46arrdembecause that's the last thing to do.
02:46arrdemthat and really test the shit out of it.
02:47johnwalkerthis will be where the rubber meets the road
02:48johnwalkerdoes clojure settle for "good enough" ? (i'm looking at you python)
02:49arrdemeh... I think that Oxcart/Oxlang really isn't Clojure and tbaldridge has some I think pursuasive oppinions on that point
02:49arrdemthat said I think Clojure is a really nice lisp, and having a static lisp for the JVM would be nice
02:51johnwalkermaybe not, but it's the same crowd
02:52johnwalkerhe probably knows better though
02:53johnwalkeroh wow a tweet, thanks !
02:54arrdemlolz
03:10johnwalkerthis plugin just gave me flashbacks from runescape
03:12arrdemlol
03:42clgvcan I convince clojure.test.check to skip shrinking? I have a use case where I just want it to fail
03:44lvhWhat's the thing I should use these days for SQL interaction? still korma, or sqlvingo or whatever it's called
03:44lvhsqlingvo
03:44lvhapparently.
03:44lvhI like that the latter gives me DDL :)
03:44clgvlvh: depends on your needs. a student of mine just used clojure.java.jdbc
03:45clgvbut it was a small project with few business objects
03:45lvhclgv: Okay, fair enough.
03:45clgvlvh: what is sqlvingo?
03:46lvhclgv: Me horribly misspelling sqlingvo
03:46lvhhttps://github.com/r0man/sqlingvo
03:46lvhIt looks like an extremely close representation of SQL as sexps
03:46lvhwhich I like :)
03:46lvhclgv: None of my business, but "student"? Are you a teacher? :)
03:47lvhWhere do I go so that I get to write clj?
03:47clgvlvh: not really teacher, but phd student with teaching obligations ;)
03:48lvhclgv: my favorite teacher ever was a phd student
03:48lvh(eh, acutally a postdoc at that point I think)
03:48lvhunfortunately no longer with us :(
03:48clgvsqlingvo looks like a thin layer above clojure.javajdbs
03:48lvhhttps://en.wikipedia.org/wiki/Len_Sassaman
03:49lvhclgv: yes
03:49clgvoh
03:49lvhclgv: I consider that a virtue looking at the code examples
03:50lvhI don't actually dislike sql other than paredit not working with it ;)
03:51clgvyou could make it symbols and stuff via reader literals, but not sure whether it would be worth it ;)
03:53lvhclgv: I guess as a side effect, it is not good at producing polyglot sql
05:52qswzHow do you import a project created with Leiningen, in Eclipse, counterclockwise doesn't allow that
05:53qswzah ok, with new and other location
05:56noidiyes, create a new Eclipse project on top of the Leiningen project, right click the project in Package Explorer and select Configure -> Convert to Leiningen project
05:59qswzyep
06:08r4vithere is probably a lein plugin
06:08r4vii use lein-idea to create intellij projects
06:11r4viqswz: this might be useful https://clojars.org/lein-ccw
06:15qswzr4vi: ok
06:17sm0keany simple and fast way for maintaining a pool of connectino objects?
06:17sm0kecustom connection objects not necessarily rdb
06:20sm0kea simple assoc and dissoc from #{} ?
06:22dbushenkosm0ke, why not? just use atom over it
06:23sm0keyep
06:25clgvqswz: better use the builtin way since that lein plugin seems pretty old
06:26qswzyes, that's what I did
06:26clgvyou can have a look at the issues on google code to see whether their is an issues for "leiningen project import"
06:27qswzcreate from location is the same as importing I guess :)
06:37smokeweedquestion w.r.t ClojureScript: is it possible to extend native Javascript types like HTMLCollection?
06:42smokeweedI actually tried it and while extening "object" works for plain old JS objects, I cannot find any info how to extend other types, like HTMLCollection
06:54clgvsmokeweed: extend a la `reify`?
06:55TimMcclgv: Did you get an answer on shrinking?
06:55clgvTimMc: no
06:55smokeweedclgv: hm, could you be more specific? I'm actually learning ClojureScript at the very same moment and I'm not sure what do you mean,
06:56Bronsasmokeweed: extend js/HTMLCollection
06:57TimMcclgv: You don't want *any* shrinking, or just some part?
06:57TimMcI think clojure.test.check.generators/return might do what you want even in the latter case.
06:58TimMcOr wait! clojure.test.check.generators/no-shrink :-)
06:58clgvTimMc: ah great thanks!
06:59clgvthat should be in the docs ;)
06:59smokeweedBronsa: it seems to work, thanks
06:59TimMcindeed
07:12thesaskw_Hi, what will happen if I use the same namespace in two files? Will the functions defined there be able to see each other? What about loading order?
07:13thesaskw_Ok, found answer: http://stackoverflow.com/a/4692067/343699
07:14llasramthesaskw_: BTW, that approach is not recommended by most of the community
07:14llasramthesaskw_: Clojure itself handles it fine, but you'll find that much of your tooling will get annoyed, which transitively will annoy any collaborators :-)
07:15thesaskw_llasram: so what is the recommended practice?
07:15llasramthesaskw_: Just have one namespace per file
07:15llasramAnd one file per namespace
07:15thesaskw_llasram: thanks
07:17zotnewbie question: (first (filter …)) is there a better form, akin to "find" in some other contexts, that returns the first item matching a predicate? [some appears to return the result of the predicate check, not the initial item]
07:18TEttingersome, zot?
07:18TEttinger(doc some)
07:18clojurebot"([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)"
07:18llasramzot: Not in the standard library. An eager `ffilter`/`filter-first` function is a pretty common utility though
07:19llasramzot: e.g. https://gist.github.com/llasram/995be648aa22e0630ce8
07:19TEttinger~useful
07:19clojurebotGabh mo leithscéal?
07:19llasramYeah, there's probably one in flatland/useful
07:19TEttingerbut yeah that reduced solution seems best
07:19zotllasram/TEttinger: tnx
07:19zotand bummer :(
07:19TEttingerreduced was clojure 1.4 or 1.5?
07:19TEttinger(doc reduced)
07:19clojurebot"([x]); Wraps x in a way such that a reduce will terminate with the value x"
07:20llasramTEttinger: 1.5
07:20llasramAaaaages ago
07:20TEttingerbut yeah the set thing will work, zot
07:20TEttinger,(some #{:fred} [:bob :fred :sue])
07:20clojurebot:fred
07:21TEttinger,(some #{:fred} [:bob :sue])
07:21clojurebotnil
07:21llasramTEttinger: you seem to be answering a different question than they actually had, especially as they mention `some` in their initial q... :-)
07:21TEttingerI missed that
07:22TEttingerso it's really a sorting thing
07:23TEttinger,(some #(when (or (= % :bob) (= % :sue)) %) [:bob :fred :sue])
07:23clojurebot:bob
07:23TEttingerthat seems to return the value, not the result of the equality check...
07:24TEttinger,(some #(when (or (= % :bob) (= % :sue)) %) [:bobby :fred :susie])
07:24clojurebotnil
07:25TEttingerzot, could just using a different return value from the predicate work?
07:25llasramOr just use (comp first filter) -- it's really fine
07:25TEttingeryeah, that too
07:33zotfor me the big thing i don't yet understand is the lazy-factor of clojure, so running filter seems needless if it can be short-circuiting
07:33zot"big" is overstated :)
07:33zotthanks for all the help!
07:38kitallisdoes anyone else get these on Heroku when using comp or partial: "Caused by: java.lang.IllegalArgumentException: No matching ctor found for class clojure.core$comp$fn__4192"?
07:59lvhIs there an easier way to specify (:require [a.b.x :as x] [a.b.y :as y] [a.b.z :as z])?
08:09Bronsalvh: there's (:require [a.b [x :as x] [y :as y] [z :as z]])
08:10lvhBronsa: ooh, thanks :)
08:10lvhBronsa: nothing with "i want things called whatever their name is" semantics?
08:11Bronsalvh: you mean to avoid the `x :as x` pattern?
08:11lvhright
08:11Bronsano, unfortunately
08:16lvhBronsa: okiedokie, thanks though, that makes it look a bit less ugly already
08:16lvhI wonder if that was an intentional design decision
09:09dawkirsthi, busy leaning Clojure. as an experiment I'm trying to replicate https://gist.github.com/emilesilvis/1f171e838137a4ca7889 in Clojure. The function returns the indices of the pair of characters that is furthest apart with only unique strings between them.
09:09dawkirstany ideas?
10:21atyzIs there a way to look at what values you have memoized, and if so possibly remove an entry?
10:21atyzI know this isn't the *best* way to do this but I'm looking for a simple caching solution
10:23_alejand1oatyz: not in the default implementation
10:23_alejand1obut you could use https://github.com/clojure/core.cache
10:23_alejand1oor write your own memoize (it's pretty straightforward code)
10:25bobwilliamsany recommendations on a good library for md5?
10:25bobwilliamsthanks in advance!
10:27atyzbobwilliams: I used pandect
10:27bobwilliamsatyz: thanks!
10:27bobwilliamslooks like it has a decent amount of stars to github too
10:27_alejandrobobwilliams: https://github.com/tebeka/clj-digest ?
10:28bobwilliams_alejandro: thanks!
10:30atyz_alejandro: this library looks good, just debating writing my own
10:30_alejandroatyz: Yeah, I'd probably opt for writing my own if the needs are simple enough
10:31atyz_alejandro: its not *that* simple, I need a ttl on the values and want to only cache in certain cases
10:33_alejandroatyz: hmm, seems like core.cache is the way to go if that ttl implementation does what you need
10:38clgvatyz: you can easily implement a custom cache strategy for usage with core.cache
10:38atyzclgv: Thats what I'm leaning towards
11:27atyzI feel dumb, am I doing something wrong? https://www.refheap.com/2a4f20a48d177237e96f74060 _alejandro clgv ?
11:27rweirwhich bit?
11:28rweirremember that line 7 throws away the mutated map
11:28gdevatyz, classic mistake when playing with immutable data structures
11:28atyzgdev: i figured I should be using an atom/
11:29atyzBut followed what was in the docs
11:29gdevatyz, well the new value needs to be stored somewhere no matter what you use
11:29rweirwell, it's fine, it's just that you threw it away
11:29atyzrweir: ah I see
11:29atyzThat was dumb of me
11:29rweirI guess you wanted C to point at the result of asso
11:29rweirc
11:29atyzhttps://github.com/clojure/core.cache/wiki/Using
11:30atyzLet me try something
11:30myguidingstarhi all, how do I check type of a Clojurescript/om cursor during rendering phase?
11:30gdevatyz, it's a classic mistake that everyone has made. if it doesn't have a "!" on it, you're not going to be able to do PLOP
11:32atyzrweir: https://www.refheap.com/89184 it seems that its not mutable
11:32rweir?
11:32rweirpresumably cache/miss also returns a cache
11:32rweirie the exact same problem as in the previous case
11:33rweiras gdev says, if there's not a !, it's unlikely to be mutating anything in place
11:33myguidingstarI'm writing a recursive function that check for type to decide if it should recur https://gist.github.com/myguidingstar/9f9ef153d7f2274ac761
11:33atyzSo then I'm confused. How am I supposed ot update the cache?
11:33_alejandrorweir: I thought the `!` was to do with transaction unsafe vs safe?
11:34rweiratyz, bind C to the return value of the thing again
11:34rweir_alejandro, iunno
11:34myguidingstarthe list version works, but the vector one doesn't
11:36atyzrweir: using something like with-redefs?
11:36atyzThat seems dirty
11:36rweirthat sounds like a bad idea
11:36rweirdepends what you're doing
11:36atyzI assumed the library would be responsible for keeping its var up to date
11:37rweirmaybe the cache lives in some object you pass around
11:37rweirmaybe it's a global var
11:37atyz(class C)
11:37atyzclojure.core.cache.FIFOCache
11:37rweiratyz, you'll need to mentally adjust, then - in clojure, most things are immutable
11:37atyzSo its its own data structure
11:37rweir[and this is a feature]
11:38atyzrweir: No i get it, my issue is that this library gives me a store. And i'm calling a fn that would presumably update its store
11:38atyzThe store is supposed to be mutable
11:38atyz(in this case)
11:39_alejandroatyz: maybe worth looking at https://github.com/clojure/core.memoize/ ?
11:39atyz_alejandro: they are written by the same person, from what I can see, core.cache is what he is working on now
11:39_alejandroatyz: basically uses core.cache ans puts it in an atom
11:39_alejandro*and
11:40_alejandroatyz: I think memoize is built on top of cache
11:40rweiratyz, right, but you need to adjust to how things in clojure works
11:40rweiratyz, pretty much everything is going to return a new thing, not mutate things in place
11:40rweiratyz, you might want to just put the cache in a var for now
11:41atyzrweir: I understand that, I understand that and I'm not new to the concept of immutablity
11:41rweiratyz, ok, I just mean to reinforce that expecting the library to have an implicit global it mutates is not really reasonable in clojure
11:42atyz_alejandro: core.memoize was last updated a year ago this one, 9 days ago
11:43_alejandroatyz: yeah, I'm not really pushing that library, just saying that if you look at the implementation it uses a cache from core.cache and puts it in an atom, then swap!s it as needed
11:43atyzrweir: it would make sense to me in this case, as it is a mutable store. So you're probably right with the assoc. However from a usability standpoint (where tehy are building me a mutable datastructure) and giving me an interface to it. I would expect it to maintain its own state
11:43_alejandroatyz: so may be a pattern worth emulating
11:44rweiratyz, in other languages, ok, but in clojure this is how pretty much everything works
11:44rweiri guess this isn't progressing, though, so eot for me
11:45atyzEven the docs say it works like that https://github.com/clojure/core.cache/wiki/LRU
11:46rweirwhere?
11:46clojurebotwhere is forget where is forget where
11:46rweirthe -> examples are passing the cache around
11:47rweirit does say "Like all of the implementations in core.cache, LRUCache instances operate like regular maps and are immutable. All caveats apply regarding the proper usage patterns." though
11:47_alejandroC is not actually modified
11:49atyzrweir: actually you're right here
11:49atyzMy apologies
11:50rweiroh, no worries, i continue to find it confusing in clojure
11:52sdegutisAm I correct in understanding that a result clause from a (case) statement will not be executed at all unless its test expression matches?
11:54Bronsasdegutis: definitely
11:54sdegutisThank you Bronsa for your time and thoughtful answer.
11:55rweiratyz, well, the lame answer is just def again
11:56rweiratyz, (http://clojure.org/vars)
11:56rweiratyz, but http://clojure.org/atoms is probably a better idea
12:01BobSchackHay all I just wrote a in depth blog post on transducers http://bendyworks.com/transducers-clojures-next-big-idea/. What is good form for announcing this?
12:02scottjBobSchack: reddit.com/r/clojure has had several transducer blog posts posted there
12:03scottjBobSchack: twitter too, and you can try your chances on hacker news. personally I think the mailing list would not be a good place, since I wouldn't like to see every clojure blog post announced there.
12:04scottjBobSchack: you can also contact planet clojure maintainer to get your blog added there
12:05BobSchackOh thanks the email is on the site correct?
12:05scottjidk
12:08mkrlearnerI want to try out some sample website development in Clojure. I have Rails background. I know the community is against frameworks, but can someone point out some good place where I can get a quick website, like in 1 or 2 days? (I know the language quite well already)
12:10tanzoniteblackmkrlearner: you might check out http://www.luminusweb.net ; it's a (biased) collection of clojure libraries hooked together in a lein template for web development
12:11tanzoniteblackwell...by biased I really just mean it selected what tend to be the most accepted and common libraries for the given job, and it covers most things you'll want for web development
12:11tmciverAnyone here have experience using Clojure with OSGi?
12:12atyzrweir: atoms is definitely a better idea, the def would work badly if you have concurrent requests
12:12Jaoodtransducers are becoming the new monad tutorials ;)
12:13atyzand at that point, its probably just better for me to reimplement memoize
12:13tmciverI've tried most of the things that I could find online without success. There's a Clojure OSGi bundle for CCW which I tried but I think it relies on running in Equinox (Eclipse) which I'm not using.
12:13rweiratyz, yes
12:13rweiratyz, reimplement?
12:13atyzwrite my own
12:14sdegutisIs it possible, inside a catch-block, to call the default exception-handling mechanism, but continue on as if I handled it?
12:14tmciverI'm using Apache Felix embedded in an app and using it as a plugin system for plugins written in Clojure but AOT compiled.
12:14sdegutisI'm trying to use the default printing code without having to rewrite it myself, but still continue on as if the try-block was handled by me.
12:14rweiratyz, but how did that follow from the above?
12:15technomancytmciver: talios is the only one I know who's done that, but he's in an NZ TZ
12:16kovrik_sdegutis: are you the author of Hydra/Zephyros?
12:17sdegutiskovrik_: Yes.
12:18tmcivertechnomancy: talios is Mark Derricutt? I tried emailing him directly but no response. Is he here often do you know?
12:18technomancytmciver: I don't overlap with his TZ all that much but I see him every so often
12:18tmcivertechnomancy: I'll have to stay up late and corner him. :)
12:21llasramsdegutis: clojure.tools.logging lets you log an exception + backtrace, which sounds like what you actually want?
12:22llasram(as does pretty much any JVM logging library)
12:22sdegutisllasram: I want to print the exception as if I never caught it, but carry on after my (try) statement.
12:22llasramYes. That is what happens.
12:22llasramYou catch the exception, log it, then move on
12:23sdegutisThis is what I'm doing now: https://gist.github.com/sdegutis/52a1a9fccf0ea31a4c06
12:23sdegutisI can continue to do it this way, but I was hoping there was a more built-in way.
12:23sdegutiskovrik_: Why do you ask, kind person?
12:23llasramsdegutis: using tools.logging or whatnot turns it into one line in the catch
12:24llasramSo I'm not sure what more you want?
12:24sdegutisRight now it's just two lines; that would turn into one line and a dependency.
12:24llasram*shrug*
12:24sdegutisI was hoping there was a built-in way.
12:24sdegutisBut if not, I'll do this.
12:24sdegutisThanks.
12:24llasramIf you consider logging an optional dependency, then have fun :-)
12:25tanzoniteblacksdegutis: you can always write a function to do all that for you, given an Exception/Throwable ...but then you'll just be recreating tools.logging ad hoc
12:26kovrik_sdegutis: I just love and use your Hydra (and Zephyros) :) Keep doing!
12:27sdegutiskovrik_: Thank you, friendly human.
12:27tanzoniteblackalso, as a general warning, println statements for logging errors can get a little screwy if you start having things run in parallel (i.e. *out* isn't guaranteed to always be defined depending on how you run your code)
12:27sdegutistanzoniteblack: Which I've done: https://gist.github.com/sdegutis/1a3e4558515b94c1cda6
12:27sdegutiskovrik_: btw there is an IRC channel for Hydra: #mjolnir
12:28sdegutiskovrik_: You're welcome any time.
12:28tmciverTimMc: o/
12:28TimMctmciver: I think nDuff is the only other person I've heard talk about OSGi in here.
12:28kovrik_sdegutis: Cool, thanks! I'll join it!
12:28TimMcHey, you coming to the meetup tonight?
12:29tmciverTimMc: nDuff, I'll have to track him down too. Thanks. No, playing some video games with a friend. Gotta have priorities, ya know?
12:29AlwaysBCodinghow would I go from [[1 2 3] [4 5 6] [7 8 9]] => [1 2 3] [4 5 6] [7 8 9] ... i.e. go from one data structure to multiple data structures?
12:29TEttingerAlwaysBCoding, apply ?
12:30TEttinger(doc apply)
12:30clojurebot"([f args] [f x args] [f x y args] [f x y z args] [f a b c d ...]); Applies fn f to the argument list formed by prepending intervening arguments to args."
12:30AlwaysBCodingyeah but what do you apply to it?
12:30TEttingerwhat are you using multiple data structures in? you can also argument destructure in let or arg lists
12:30atyzAlwaysBCoding: depending on your need you could jus destructure
12:31tanzoniteblackAlwaysBCoding: if you're trying to call a function which expects multiple args, then apply is what you probably want; if you're trying to just get them in different variables in a let, then check on destructuring
12:31tanzoniteblacki.e. it depends on why you want them separated, and how you're planning on using them
12:31atyzso (let [[a b c]] [[1 2 3] ...])
12:32TEttinger,(let [[[a b c]] [[1 2 3] [4 5 6] [7 8 9]]] (reduce + a))
12:32clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
12:32TEttinger,(let [[a b c] [[1 2 3] [4 5 6] [7 8 9]]] (reduce + a))
12:32clojurebot6
12:33AlwaysBCodinghm. I'm rendering HTML from a data structure. and I want to generate multiple dom nodes. so if I have a data structure like [{:team-name "wizards", :player-name "john wall"}, {:team-name "wizards", :player-name "bradley "beal"}] and I want to map over it and generate [:p.team-name (-> item :team-name)] [:p.player-name (-> item :player-name)] for each item
12:33AlwaysBCodingit doesn't work since map only returns the last item
12:33AlwaysBCodingso I'm wondering if there's a way to go straight from like [[1 2 3] [4 5 6] [7 8 9]] => [1 2 3] [4 5 6] [7 8 9] because that's what the html renderer requires
12:34TEttingerall as args to a function?
12:34TEttingeryou can apply with the renderer and your nested collection
12:35kovrik_or use destructuring?
12:35hiredman"map only returns the last item" <-- someone don't leave that hanging please
12:36clgvhiredman: :P
12:37clgvAlwaysBCoding: I guess I know what you try to describe. you just need to `concat` the result of that `map` with the other lists to create the desired output
12:39sdegutisWhy cannot (def) take multiple pairs?
12:39sdegutis,(def a 1 b 2)
12:39clojurebot#<CompilerException java.lang.RuntimeException: Too many arguments to def, compiling:(NO_SOURCE_PATH:0:0)>
12:40tanzoniteblacksdegutis: it would make parsing things like metadata and docstrings signifcantly more complicated, if not impossible
12:40sdegutisOh. Thank you for your succinct, correct, and prompt answer.
12:42AlwaysBCodingclgv: cool, just realized that's what mapcat is for
12:44AlwaysBCodingyup, mapcat did the trick. so cool, thanks guys
12:46clgvsdegutis: and plainly wrong. there is no such thing as an extra metadata map you could specify. but there is the option to add a docstring which conflicts with multiple definitions
12:47clgvsdegutis: or at least makes it difficult to read
12:50martinklepschanyone experience using nth-child selectors with garden? I can't require garden.selectors that contains some nth-child related things
12:50martinklepschMaybe someone has a snippet laying around?
12:51TimMcsdegutis: For a simple use-case, it should be easy enough to whip up a macro that does what you want... but good luck getting various tools to recognize your new multi-def.
12:52sdegutis:)
13:01TimMctmciver: Yup. I missed the last few meetups, so I should show up again. Someone's gotta be on hand to be a good influence and teach people Swearjure!
13:02TEttinger,(#(`[~@%] (`[~@%&] (+))) (#(`[[~@%&]] (+)) :! :* :>) (+ (*) (*)))
13:02clojurebot:>
13:06tmciverTimMc: absolutely. Have fun. I've been doing enough swearing with OSGi lately.
13:13TimMctmciver: Do a talk on it! :-D
13:13TimMcI'd like to know more about it.
13:15TimMcBronsa: Speaking of syntax-quote and Swearjure, what are your thoughts on the correct behavior of `{~@[a b]} ?
13:15TimMcBronsa: Err,`{~@[:a :b]}
13:16tmciverTimMc: that's a good idea; I just have to figure it out first!
13:17cbp,`{~@[:a :b]}
13:17clojurebot#<RuntimeException java.lang.RuntimeException: Map literal must contain an even number of forms>
13:17TimMc,`{~@[:a :b] ~@[]}
13:17clojurebot{:a :b}
13:18TimMcI ask because you were (I think) recently in the guts of the reader.
13:21llasramHow Bronsa is like a good book.
13:26BronsaTimMc: it should be possible and not hard to make `{~@foo} work
13:31bbloomBronsa: what would it do? ...
13:32Bronsabbloom: compile to (apply hash-map foo)
13:32bbloomBronsa: no, that's wrong
13:32bbloom(class `{:x ~@[:y]})
13:32bbloom,(class `{:x ~@[:y]})
13:32clojurebotclojure.lang.PersistentHashMap
13:32bbloom,(class `(apply hash-map :x ~@[:y]))
13:32clojurebotclojure.lang.Cons
13:33Bronsa'`{~@[] []}
13:33Bronsa,'`{~@[] []}
13:33clojurebot(clojure.core/apply clojure.core/hash-map (clojure.core/seq (clojure.core/concat [] (clojure.core/list (clojure.core/apply clojure.core/vector (clojure.core/seq (clojure.core/concat)))))))
13:33Bronsa,(read-string "`{~@[] []}")
13:33clojurebot(clojure.core/apply clojure.core/hash-map (clojure.core/seq (clojure.core/concat [] (clojure.core/list (clojure.core/apply clojure.core/vector (clojure.core/seq (clojure.core/concat)))))))
13:33Bronsabbloom: ^
13:33bbloomooh duh, right
13:33bbloomsorry, ignore me
13:33bbloomi forget that syntax-quote assumes that you'll evaluate the result
13:34bbloomi mainly forget that b/c i've been experimenting with explicit evaluation :-P
13:34martinklepschhow can I compile cljx files of dependencies I'm using in another projecT?
13:34bbloommy design has an explicit partially-applied template type tag
13:34martinklepschis "lein cljx once" aware of dependencies?
13:34TimMcBronsa: So the notion of map literals having an even number of forms isn't baked in so deeply that this would be difficult?
13:35bbloomTimMc: i think it's only possible b/c sytnax quote is defined as part of the reader's behavior
13:37martinklepschIt doesn't seem that it is aware of cljx dependencie
13:37BronsaTimMc: I'll try to hack a patch for tools.reader later, if I succed I'll try to backport to LispReader & open a ticket
13:38TimMcBronsa: Ha, yeah? That would be neat. I was just idly curious; it's a weird enough use-case and there's an easy workaround, but of course I won't try to stop you... :-)
13:45martinklepschany advice on compiling cljx dependencies? shouldn't these be compiled by leiningen automatically? do I have to care whether libraries I depend on use cljx?
13:47tanzoniteblackmartinklepsch: my understanding of cljx is that it shouldn't have to be aware of whether dependencies were written using cljx, because when they were made into a jar to be put on clojars/maven/whatever, cljx worked on them as part of making the jar; so your code shouldn't actually be looking at the .cljx files, but the .clj file created by the cljx plugin
13:51tanzoniteblackI currently have code that looks like, `(try (f) (catch ErrorType1 e (fn-call e)) (catch ErrorType2 e (fn-call e)))` where I'm calling the same function when catching both ErrorType1 and ErrorType2, anyone know if there's a way I can collapse this code to catch *either* error type and then do the exact same body to the error (i.e. similar to `catch (ErrorType1 | ErrorType2 e)` in Java 1.7+)
13:53martinklepschtanzoniteblack: well, thats how I'd expect it to work as well but it seems as if this compilation process isn't happening for garden... I'll take a look at clojars
13:56tanzoniteblackmartinklepsch: I use prismatic's schema (which is made with cljx) regularly in projects which don't even have cljx as a plugin...so it might just be something wrong with garden's build?
13:57vermacausing side effects in the function passed to core/map is idiomatically alright?
13:57amalloytanzoniteblack: no, there is no way to do that except by writing a macro that expands to the code you have now
13:58amalloyverma: it's not strictly forbidden, but it should make you uneasy
13:58arohnertanzoniteblack: slingshot has macros that sound similar to what you want
13:58martinklepschverma: I think it'd more idiomatic to use doseq or doall or something like this
13:59tanzoniteblackarohner: I'll look into that, thanks
13:59arohnerslingshot lets you do all kinds of fun things, like (catch my-pred? e)
13:59arohnerwhere my-pred is a fn that takes an exception
14:00technomancyI wish we had proper pattern matching for it though
14:00martinklepschverma: map is lazy so if you want to apply f to all elements it might not do what you expect
14:00arohnertechnomancy: core.match matching?
14:00mdrogalistanzoniteblack: Dire supports predicate matching on exception handlers.
14:00vermamartinklepsch, yes, I am using it with doall
14:00technomancyarohner: sure
14:01tanzoniteblackseems like this functionality which would be nice in a future version of clojure, but I'll take a look at both dire and slingshot for now
14:01arrdembbloom: Mike and I were comparing notes on a static Clojure variant
14:02bbloomarrdem: ah ok
14:02bbloomi favor the exact opposite approach, but i'm a crazy person ;-)
14:02vermaamalloy, martinklepsch doseq and doall don't return the result of applying f though, do they? e.g. I want to map a set of commands, run them and capture the return value
14:02arrdembbloom: that's fine with me, I just want to see people exploring the design space.
14:02bbloomarrdem: absolutely
14:03bbloomarrdem: languages that have a better dynamic/static range are welcome by me
14:03martinklepschverma: doall returns the seq
14:03martinklepschverma: doseq doesn't
14:03tanzoniteblackverma: you can do something like `(doall (map ...))` which immediately forces the map not to be lazily evaluated to have the side effects occur now and then returns the value of the original call to map
14:03vermamartinklepsch, tanzoniteblack ooh sweet, thanks! :)
14:06BronsaTimMc: http://sprunge.us/WGIY?diff
14:07Bronsaporting that to LispReader should be trivial
14:10amalloyBronsa: where is gensym-env ever set? i only see it being bound to nil, and then being read numerous times
14:10starlordHi.
14:10starlordI am trying to reduce the number of java.lang.NullPointerException I find in my program. Please advice.
14:10Bronsaamalloy: https://github.com/clojure/tools.reader/blob/master/src/main/clojure/clojure/tools/reader.clj#L598
14:10bbloomBronsa: you're also changing set to avoid the duplicate check for splices?
14:10Bronsabbloom: yep
14:10bblooms/to/too
14:11bbloomBronsa: i never really liked those checks...
14:12bbloomBronsa: good stuff, that's bit me once with {~@[...]}
14:12acagle1exit
14:12acagle1exit
14:16emacsnwstarlord: I have a similar problem. it complains about Exception in thread "main" java.lang.NullPointerException, but does not give any useful stacktrace.
14:16technomancystarlord: port it to ocaml
14:16technomancyboom
14:17aperiodicstarlord: put (try ... (catch Throwable _)) around your program's entry point. bonus: you won't find any other errors, either!
14:21starlordtechnomancy, aperiodic: thank you I may try these both.
14:25TimMcBronsa: Oh man, ++ on fixiing the set uniqueness thing!
14:26amalloyit's weird, i don't think i've ever used #{~@(...)}
14:27TimMc,(let [a 5] #{a 5})
14:27clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: 5>
14:27bobwilliamshas anyone here created a clojure script to wrap cleverbot?
14:28TimMcBronsa: Oh, it actually doesn't fix the thing I've run into ^
14:28bobwilliamsanyone know of any documentation for cleverbot?
14:28arrdem$google cleaverbot http API
14:28lazybot[chatter-bot-api - A Mono/.NET, JAVA, Python and PHP chatter bot ...] http://code.google.com/p/chatter-bot-api/
14:29bobwilliamsarrdem: yea, looking for one in clojure already..I think i'm hitting a case where i need to enforce query param order and not seeing it really detailed anywhere
14:30BronsaTimMc: that's not a reader issue
14:31bobwilliamsarrdem: thanks
14:32TimMcBronsa: Ah, OK. :-(
14:33BronsaTimMc: #{1 1} won't work either
14:33TimMcWell, one step closer, then.
14:33Bronsanor will #{(gensym) (gensym)}
14:33Bronsathis only affects syntax-quoted literals
14:33TimMclolwut
14:34BronsaTimMc: to make #{(gensym) (gensym)} work, the compiler should use a different reader
14:35TimMcOh... I get it, now. Before it's evaluated, it would be invalid...
14:35BronsaTimMc: what should (read-string "#{(gensym) (gensym)}") return?
14:35BronsaTimMc: yeah
14:35TimMcThat's incredibly ugly.
14:35TimMcI'd never considered that aspect of set literals before!
14:35arrdemBronsa: couldn't you just add a let block and bind two gensym calls?
14:36Bronsaeven though the two gensym calls result in different values at runtime, they have the same value at read-time
14:36Bronsaarrdem: sure
14:36BronsaTimMc: that's the same for keys in map literals btw
14:36TimMcMmm, that I can deal with.
14:37BronsaI believe #{1 1} used to work and return #{1} some time in the past BTW
14:37Bronsamaybe amalloy remembers?
14:37zackzackzackIs there a good way to hash data structures into a string?
14:38amalloyzackzackzack: nothing easy. it's a harder problem than it sounds like
14:39bbloomBronsa: TimMc: it's not a unique problem to set literals, just generally an extremely minor flaw of the clojure/edn syntax design
14:39zackzackzackamalloy: Yeah I sort of figured as much. Does it help if the data structures are restricted to vectors, strings and keywords?
14:39arohnerBronsa: yes, #{1 1} used to work
14:39bbloomthere's no runtime representation of various unevaluated reader forms
14:39arohnerin 1.5 and earlier?
14:39bbloomtagged literals are the one that annoy me... i want a generic tagged-literal fallback type
14:39amalloyBronsa: i don't think #{1 1} ever made it past the reader. there was definitely some kerfuffle about the difference between (set [1 1]), (hash-set 1 1), and #{1 1} but i don't remember the details
14:40Bronsauhm ok
14:40amalloyjust tried on 1.4, #{1 1} doesn't read
14:40zackzackzackI'd like to be able to make an index in datomic that allows you to look up attributes via a datastructure.
14:41amalloysame on 1.2.1
14:41arohnerhttps://github.com/clojure/clojure/commit/c733148ba0fb3ff7bbab133f5375422972e62d08
14:43TimMcIt seems so unnecessary.
14:43wei_has anyone used both om and reagent and can describe the main differences between the two?
14:44arohnerwei_: I've used Om but not reagent. reading reagents docs, it looks higher level, with the good and bad that implies
14:47wei_arohner: thanks. I’ve primarily used reagent and like it so far. just wondering what I’m missing in om
14:47arohnerom is little more than protocols over react primtives
15:02amalloyi just realized the one-arity case of apply isn't defined: (apply f) doesn't mean anything. would it be totally crazy for (apply [f x y]) to mean (f x y)?
15:02amalloythen apply would kinda be like funcall, or maybe (partial apply funcall)
15:03TEttingeramalloy:
15:04hyPiRionamalloy: in what case would you have a need for (apply f)?
15:04hyPiRionIf you have the form, evaluate it already.
15:05llasramTo avoid special-handling the case when doing (apply apply f)
15:05hyPiRionAlthough there are problably some very special use cases for it.
15:05amalloyhyPiRion: i thought of it in regard to http://stackoverflow.com/q/25303068/625403
15:06TimMcamalloy: Obviously it can be used for transducers. :-)
15:06amalloythough it turns out i totally misunderstood what he was asking for
15:08amalloybasically i wrote #(apply % %&) and was like "wait a minute this is a stupid thing to have to write"
15:08TimMc(def apply [f] ((f)))
15:13bbloomamalloy: if your input is a seq, isn't that just eval? :-)
15:13amalloybbloom: er, actually not at all
15:13bbloom,((comp eval seq) [+ 5 10])
15:13clojurebot#<ExceptionInInitializerError java.lang.ExceptionInInitializerError>
15:13hyPiRion,(eval '(name 'a))
15:13clojurebot"a"
15:13amalloyeven if you pretend that functions evaluate to themselves
15:13bbloom&((comp eval seq) [+ 5 10])
15:13lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
15:13bbloomblah
15:13TimMcmodulo some environment stuff...
15:13bbloomthat clearly works in my repl
15:14amalloythere's still the problem of ((comp eval seq) [first '(x y z)])
15:14hyPiRionoh derp
15:15hyPiRion,(eval (list 'name 'a))
15:15clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:20BronsaTimMc: gah, metadata gets dorked with my patch
15:22bbloomdorked? is there a formal definition of that term in the literature?
15:23TimMcborked?
15:23Bronsayes. typo
15:24bbloomdon't admit the typo. just say that all the cool kids have moved from borked to dorked
15:27TimMcPoor metadata, everyone always forgets it.
15:31BronsaTimMc: I mean, it works fine in tools.reader, for LispReader I'm using a class rather than a record for SyntaxQuoted[Map,Set] and that breaks everything.
15:33bbloomBronsa: just gotta implement IMeta and IObj, right?
15:33bbloomthose are easy enough
15:34TEttingerBronsa: scala syntax? SyntaxQuoted[Map,Set]
15:34Bronsabbloom: no, it also needs to be an IPersistentMap
15:34bbloom... why?
15:35Bronsabbloom: `^{:foo 1} {:bar 1}, {:foo 1} will be read as a SyntaxQuotedMap aswell
15:36BronsaI can probably get away with just implementing IPM without actually providing any implementation though
15:36BronsaTEttinger no, was just a shortrand for SyntaxQuotedMap, SyntaxQuotedSet :P
15:36bbloomoooh, i see, the actually metadata itself must be an IPM
15:36Bronsayeah
15:37bbloomwell then
15:37bbloomstupid static typing :-P
15:37bbloomhehe
15:37bbloomi enjoy that clojure will just provide a bunch of bodies that throw NotImplemetnedException
15:37TEttingerscala's static typing with inference I don't mind, but java's static typing really is stupid
15:38bbloomTEttinger: in this case inference wouldn't help
15:38TEttingerI just mean while coding
15:38TEttingerin general
15:39TEttingerI asked a question in #scala about how to port a CLOS-style pattern match, never heard back
15:39jareddbaAnyone know how I would inspect what data this Java object contains using clojure? #<Object[] [Ljava.lang.Object;@54d36076>
15:40jareddbaI'm using fressian pulling that it is a Tagged Object
15:40jareddba(fress/tag (first (:data (fress/read (:val mmaps4))))) which returns "datum"
15:40jareddba(fress/tagged-value (first (:data (fress/read (:val mmaps4
15:40jareddba))))) which returns #<Object[] [Ljava.lang.Object;@54d36076>
15:40jumblemuddleCan someone explain this to me: http://sprunge.us/UafD particularly the doseq part. I'm not really sure how they got the player entity out of the entities using this.
15:40llasramjareddba: That's a JVM array of `Object`s. Calling `seq` on it will get you at least one layer in, printing-wise
15:41arrdemjareddba: try seqing it
15:42arrdemjumblemuddle: that shouldn't work. http://grimoire.arrdem.com/1.6.0/clojure.core/doseq/
15:42llasramarrdem: weird indentation and mutation
15:43llasram`entities` is actually after the `doseq`, not inside it
15:43arrdemllasram: good catch.
15:43Bronsabbloom: fuck I can't not provide an implementation for interface methods in java ;_;
15:43jareddballasram: and arrdem: worked perfect!!
15:44jareddbaThanks!
15:44jumblemuddlearrdem: interesting... It seems to be working, it's from the play-clj examples.
15:44jumblemuddlearrdem: thanks for the link, I'll look into that.
15:44arrdemjumblemuddle: llasram got it right. your indentation threw me off.
15:45jumblemuddleAh, ok.
15:45llasramjumblemuddle: Looks like each entry `entities` is a triple, where the third member indicates if the entity is a player. They just walk that linearly, and then do something mutating with `position!` if the entity is a player
15:45arrdemjumblemuddle: all that snippet does is update each player entity in the entities collection, and then return the entities collection again.
15:45llasramer, not a triple. A map
15:46llasramI'm not even sure if it does that. It just `position!`s at `x` and `y` on `screen`. So who knows.
15:46jumblemuddleOk, so the {:keys [x y z]} is just supposed to find the entities with those keys?
15:46llasramjumblemuddle: No. It extracts those keys from each entity, which must be a map
15:46arrdemjumblemuddle: https://gist.github.com/john2x/e1dca953548bfdfb9844
15:46llasramso `entities` is a sequential collection of map(like)s
15:47jumblemuddleOk, I think I understand now. I wasn't thinking of the 'entities' as maps.
15:47jumblemuddleStill trying to wrap my head around this functional programming things... Thanks guys!
15:48jumblemuddlearrdem: Thanks, I'll read that. I never quite got my head around the destructuring stuff.
15:49arrdemjumblemuddle: I just liked it because that {:keys []} is destructuring notation and john2x's writeup is pretty good.
15:50jumblemuddleIt looks very well written. Most of the other stuff I've found on destructuring was very confusing.
15:51llasramjumblemuddle: Well, that function is about as non-functional as you can get :-)
15:52jumblemuddleYa, with the 'position!' being inside a doseq. Play-clj is built on top of libgdx, so there I'd imagine it's pretty difficult to do it completely functionally.
15:54arrdemeh... state monad... anything's possible, the question is if it buys you anything since you're building atop a mutable java framework..
15:55jumblemuddleOn a side note: Is it even a good idea to try making games in clojure? Would it be better to go with a more established language (for game-dev), and try to adopt some of the functional design principals?
15:56TEttingerjumblemuddle: kinda.
15:56TEttingerI've written a small roguelike in an older version of clojure
15:56awwaiidjumblemuddle: I'm sure you will get a very unbiased answer here in #clojure. But yes -- it's a great idea to make a game in clojure!
15:56TEttingersome of clojure's features are mind-blowing for games
15:56llasramI don't think there's anything about Clojure to particularly recommend for or against it for writing games in particular
15:56TEttingerI had save/load done in half an hour, like 20 lines (needed to look up some stuff)
15:57arrdemllasram: well it's on the JVM which is typically an "against"..
15:57llasramIf you're planning on writing a "serious" game, I'm not sure I'd recommend it, but for a hobby project -- sure!
15:57jumblemuddleawwaiid: Well, to be honest I'm looking to be convinced. I would love to use clojure.
15:57TEttingerI needed multithreaded level gen, so futures helped a ton
15:57TEttingerplay-clj rocks
15:57awwaiidahh
15:57TEttingerbut clojure is not that fast
15:57llasramarrdem: People do do "serious" games on the JVM. I mean, minecraft, right?
15:57TEttingerit is getting better!
15:57TEttingerreducers came into the language after I had coded my game
15:58awwaiidI think there are quite a few "indie" jvm games
15:58jumblemuddleTEttinger: Ya, I was reading John Carmack's stuff on functional programming for game dev, and it sounds amazing.
15:58arrdemllasram: minecraft is famous for being a steaming pile of [REDACTED] in terms of its software architecture and engine performance.
15:58TEttingerjumblemuddle, I'm currently using scala because long story short, it's closer to C# and I was porting 5K lines of C# with functional style
15:58arrdemllasram: it can totally be done, it's just a question of what you consider a "serious" game.
15:58awwaiidso I wonder if performance is the only issue?
15:58jumblemuddleI'm definitely not at the point of 'serious' game dev, so I guess I'll go for it.
15:58awwaiidin which case it might depend on what sort of game it is
15:59TEttingerscala does work on android and seems to have decent performance when I'm not starting the game up
15:59willgorm-cwxvpn
15:59TEttingerbut my scala code is much longer than my clojure code
15:59jumblemuddleI haven't looked into scala much. Most of the other game-dev stuff I've done, was in c#/monogame.
16:00jumblemuddleGranted my c# code was very very ugly...
16:00TEttingerjumblemuddle, look into play-clj
16:00TEttingeroakes is amazing
16:00TEttinger(the author)
16:01jumblemuddleTEttinger: Ya, that's why I'm looking into atm. (That's where the destructuring question came from, I'm walking through the examples, and trying to understand them)
16:01TEttingerjumblemuddle, I have an old, messy, heavily-ugly-due-to-opts version of my clojure game on github
16:02TEttingermost important stuff is here https://github.com/tommyettinger/Ravager/tree/master/ravager/desktop/src-common/gaunt/ravager
16:02zenoliSo, I'm playing around with writing a BASIC interpreter, and am looking for some thoughts on program and execution representation.
16:02TEttingerit looks like https://dl.dropboxusercontent.com/u/11914692/Ravager-thin-walls.PNG btw
16:02zenoliBuilding an AST is no prob, nor is executing single statements, storing variables, and so on.
16:03TEttingerzenoli, BASIC with the clojure seq abstraction -- get the VB types on our team!
16:03justin_smithTEttinger: reminds me of that nethack frontend, falconseye
16:03zenoliBut I'm bogging down trying to come up with a good representation for an execution pointer.
16:03justin_smith(though they may have a common root unknown to me)
16:03TEttingerjustin_smith, yes, this uses nethack sprites from a japanese port
16:03jumblemuddleTEttinger: Thanks, that looks really cool! The more example I can find the better. That's one of the reasons I was thinking of going with a different langauge. (more examples)
16:04zenoliTEttinger: At the moment, the target is old-school David H. Ahl-period classic games. Later for world conquest.
16:04TEttingertechnically it uses Steve Aoki's SLASHEM tiles, which are mostly the same as his Nethack tiles
16:04TEttingerunfortunately they're NHPL licensed, which is an outdated GPL 1.0 fork
16:04BronsaTimMc: http://dev.clojure.org/jira/browse/CLJ-1503
16:05BronsaTimMc: no idea if it's going to make it, but I pushed the fix to tools.reader in the meantime.
16:06zenoliConsider typing in "10 A=1 : B=1 \n 30 IF A+B > 3 THEN GOTO 10 \n 20 A=A+1"
16:06TEttingerwhich clojure version are we on now?
16:06llasram,*clojure-version*
16:06clojurebot{:interim true, :major 1, :minor 7, :incremental 0, :qualifier "master"}
16:07zenoliLine 10 has two separate statements, one without a label. Line 20 goes before line 30 during execution.
16:07TEttingerI'm also in #libgdx and we're having some fun talk about upgrading to the very recent 1.3.0, so I was confused
16:09zenoliA sorted map {10 [statement1 statement2] 20 [statement3]} would order the code, and line labels can be looked up.
16:10zenoliBut GOSUB and FOR need to potentially be able to jump back to non-labelling execution points.
16:11zenoliAnd after a GOTO 20, I don't think there's a way to get the next label without stepping through all the integers.
16:11hiredmanzenoli: you need to do a pass over the ast that generates labels for those statements
16:12mdrogalisFrom http://bendyworks.com/transducers-clojures-next-big-idea/?utm_source=dlvr.it&amp;utm_medium=twitter, "As core.async becomes more and more popular with Clojure, reducers are left behind." Is that at all true?
16:12zenolihiredman: For the B=1, you mean, which doesn't have a label of its own?
16:12hiredmanzenoli: sure
16:12llasrammdrogalis: That is a weird statement.
16:13hiredmanzenoli: I would likely do a sort of desugaring pass that rewrites FOR in terms of GOTO
16:13llasrammdrogalis: "Additionally, reducers use macros to perform their magic instead of using function composition, which means we have to repeat our logic to handle different abstractions." Um, not true at all
16:13mdrogalisllasram: Yeah. I don't claim to -really- understand Reducers, but those 2 things seemed orthogonal
16:13llasramWhat an odd article
16:13hiredmanI actually have a start of a basic compiler targeting the beaglebone's prus in clojure https://github.com/hiredman/prubasic
16:13mdrogalisYeah but points for his picture
16:14mdrogalisI thought they were acorns at first
16:15zenoliI've been mulling whether a zipper might be usable as an instruction pointer.
16:15arrdemwhat would that buy you besides complexity?
16:15zenolihiredman: Ah, cool.
16:17zenolizipper would be able to step to the next statement in the AST from anywhere, without trying to enumerate labels.
16:17zenoliI'm not saying it's a good idea, just *an* idea.
16:18arrdembut you _have_ labels, and basic is _designed_ in terms of addressed program points.
16:18hiredmanzenoli: I think your best bet is a normalizing pass that gives every statement a label, and then using a map to represent ebbs {label code} like you mentioned
16:19hiredmanif you have a normalizing pass then everything is more regular and easier to interpret or compile
16:19arrdemif you really insist on not addressing each individual statement as hiredman is suggesting, you could do a basic block transform, and then sequentially evaluate all the terms in a basic block and only handle the jump conditions.
16:20hiredmanyou can build an abstract machine that executes that pretty easily
16:20zenoliNo, hiredman's suggestion makes sense. Just trying to figure out the design tradeoffs.
16:21zenoliThanks, that reduces the complexity that I was getting bogged down in.
16:35iris_Can I use extend-protocol in a separate namespace and count on the extended type / class implementing that protocol in another namespace inside the same lein project / jar?
16:36amalloyiris_: as long as you require the namespace doing the extending
16:37tanzoniteblackiris_: will work as long as you've required/run the code doing the extending before relying on it
16:37iris_thanks!
16:54cbp,1
16:54clojurebot1
16:55shriphanihi everyone, I am a bit of a java noob. I was wondering if I place a shell script in my resources dir, can I execute (via clojure.shell say) it after pulling this jar from clojars ?
16:57technomancyshriphani: yes, provided you've thought through the security implic--aw who am I kidding; that's totally optional.
16:59shriphanitechnomancy, so if I have foo.sh in my resources dir, I can do (sh "foo.sh") and I can expect it to work fine ?
16:59shriphaniwell with the io/resource thing i.e.
16:59technomancyshriphani: oh, no you'd have to do (io/copy (io/resource ...) temp-file) first
16:59technomancybash can't look inside jars like that
16:59shriphaniah. got it
17:00technomancyor you could feed it to bash via stdio
17:01shriphanitechnomancy, IIRC the first time we run lein, it wgets a whole bunch of stuff. That could be a possibility too (as opposed to bundling the binary as a resource). But I think it would be better to copy the binaries to a location in the user's homedir.
17:02zanesHmm.
17:11zanesIf I want to use clojure.core.async/map< with a function that returns a single value on a channel what’s the right way to do that? Do I want to comp the function with <!!?
17:11zanesHope that made sense.
17:12bbloomzanes: map< and related are being deprecated in favor of the transducers stuff just announced
17:12zanesbbloom: I know, but isn’t that only in the latest alpha?
17:13bbloomzanes: yeah, but part of that is b/c rich realized he had to re-implement map/filter/mapcat/etc for lazy seqs, reducers, channels, etc etc and the channel based ones were particularly awkward
17:13zanesYeah, I recognize this is all going to be easier with transducers. I’m just figuring out what to do if I’m stuck on 1.6.0 for now.
17:14bbloomzanes: just write your own goroutine for your particular
17:14bbloom...need
17:14zanesSo you’d advise against map< usage in general?
17:15amalloygfredericks: the answer to http://math.stackexchange.com/questions/87436/the-tuesday-birthday-problem-why-does-the-probability-change-when-the-father-s nicely sums up the objection i was trying to make about the tuesday birthday problem months ago
17:16bbloomzanes: only b/c i advise core.async usage like my kindergarden teacher advised paste usage: a little dab will do ya
17:17zanesbbloom: Hmm. Maybe you’re right and I’ve overdone it here. I’ve been trying to propagate core.async and channel usage throughout this program.
17:17bbloomzanes: yeah, not a great plan
17:17zanesThe program is basically all about making a lot of asynchronous HTTP requests, so it seemed unnatural to mix async paradigms.
17:20bbloomzanes: jvm only?
17:20zanesJVM only.
17:22gfredericksamalloy: aaaahm
17:22bbloomzanes: use <!! and real threads except in the few spots you genuinely need asynchronous operations
17:23gfredericksthe stuff I remember you saying seems to have been poked at in the question, but I don't see it in the answer
17:23bbloomyou can blend threaded and evented styles on a per-need basis
17:23zanesOkay, I’ll give that a shot. Thanks!
17:28amalloygfredericks: the objection i was trying to make is that it depends on how you found the guy who's saying he has a son born on a tuesday
17:29gfredericksooh yes right
17:30amalloy<amalloy> in contrast, suppose we sent out a survey to all parents in the US, and selected only those who have a son born on tuesday
17:32gfredericksI feel like there's a pretty obvious default meaning though
17:32gfredericksi.e., randomly selected from among all men who have two children with one a tuesday-boy
17:34carrumbais there a simple way to assign a Byte a value > 127?
17:35amalloygfredericks: i don't agree. maybe i walked through central park with a sign reading "If you have two children, I'll give you $5 to tell me the sex of one and the day of the week it was born"
17:35bbloom_carrumba: bytes are signed on the jvm
17:36amalloynow someone telling me tuesday doesn't mean anything interesting
17:38bbloom_,(unchecked-byte 255) ; carrumba
17:38clojurebot-1
17:38bbloom_,(unchecked-byte 128) ; carrumba
17:38clojurebot-128
17:40gfredericksamalloy: so if you do that, and the filter for the ones with a tuesday-boy, what proprotion would you expect to have two boys?
17:41amalloy13/27, or whatever the weird number is
17:42amalloybecause the filtering reduces it to exactly what you claim is the "default scenario"
17:42gfredericksdoesn't the problem statement entail exactly such a filtering?
17:42amalloyno
17:42gfredericks"A man has two sons one of which is a boy born on tuesday..."
17:43gfredericksI don't know how to argue this any further; I think we must be speaking a different dialect of english?
17:44amalloygfredericks: like the SO answer says, it depends on what pool of people he came from
17:44TimMcOh, are we doing this again?
17:44amalloydid he come from a pool of people with two children and at least one boy, and the tuesday is just a coincidence? or did they select only people who answered tuesday and throw out everyone else?
17:44aperiodicgfredericks: not the only problem statement; the one in the linked article states "you meet a man on the street..." which doesn't imply any filtering
17:46amalloyTimMc: yes, i happened upon an SO question/answer that i thought better explained the position i was trying to take last time, so i resurrected the topic
17:46carrumbabbloom_: thanks for the hint!
17:46amalloybut it doesn't seem to be any clearer to gfredericks what i mean
17:46amalloy(or at least he doesn't think i'm any more right)
17:47gfredericksaperiodic: so does my phrasing imply the filtering then?
17:47gfredericksI'm not really interested in defending more ambiguous wordings
17:48amalloygfredericks: i think yours is just as ambiguous. if it were worded instead as "you go on a journey to find a man who can tell you he has two children, one of whom is a boy born on tuesday", then it would be clear enough. just being told "there is such a man" is no good
17:49gfredericksbut wandering through the park with five dollar bills is just another way of finding such a man
17:49aperiodicgfredericks: I should have said "implies no filtering." your intended phrasing doesn't give any information about how the man was found, so doesn't imply filtering or imply no filtering
17:49gfredericksonce I've found him the probabilities are the same
17:49amalloygfredericks: but the sign didn't ask for only tuesday-boys, it asked for children
17:51gfredericksoh okay your point is that if I in the park first run into a thursday-girl, then that's what the problem ends up using
17:51gfredericksand therefore we have 1/3 or 1/2 or something
17:52amalloyright
17:52amalloywhereas if you doggedly wait for tuesday-boy, you get the weird 13/27
17:53gfredericksthis interpretation is so unnatural that it took you this long to explain it to me :P
17:54gfrederickstherefore the length of this discussion is evidence that I'm correct
17:54amalloyit seems pretty natural to me. if someone tells me "i have a boy born on a tuesday", i don't immediately assume "well he wouldn't have talked to me at all if his son were born on wednesday"
17:54amalloyi assume he would have said something similar but not identical
17:55aperiodic"i found it hard to understand your interpretation so it must be unnatural"
17:55amalloyaperiodic: works for lisp
17:55amalloyparens confuse me, thus they are confusing
17:56metellusconsidering we're talking about natural language
17:56metellusit's a valid claim to make
17:56metellusthe response "no, I'm pretty sure you're the one with the unnatural interpretation" is also valid
17:56gfredericksamalloy: that was interesting, thanks
17:56amalloyi'm glad we finally got it ironed out enough to both be wrong
17:56amalloyyou more than me, of course
17:57gfredericksnaturally
18:00aperiodicthat was easy; who wants to tackle the sleeping beauty problem? ;)
18:00zanesbbloom_: Is the guideline you’d use basically that if you are only going to need a well-known, fixed number of threads you should just use real threads?
18:01bbloom_zanes: if you can use real threads, you should use real threads
18:01zanesThat feels a bit strong.
18:03bbloom_zanes: events etc add substantial complexity for very limited gain
18:04gfredericksaperiodic: hey nice I haven't seen this
18:08amalloyyeah, me either. it's neat
18:09amalloyprobably the first time i've ever seen the words "Extreme Sleeping Beauty" all lined up, as well
18:18gfredericksthe phenominalist bit makes sense to me
18:18gfredericksi.e., it's objectively the most natural
18:18gfrederickshey look at my statements all lining up
18:18amalloyhaha
18:19gfrederickshow long can I keep this up? it's tough
18:20technomancyone of my co-workers wrote a script to add garbage to the end of his commit message till it hashed to a sha starting with "cafe" for like three months before anyone caught on
18:20amalloygfredericks: those of us with variable-width fonts are not impressed
18:21gfredericksamalloy: those of you with variable-width fonts don't matter
18:22amalloytechnomancy: i remember someone writing something like that where you could specify a prefix you wanted, so that your commits could go like 0000001adf4d, 0000002fa21c...
18:24arrdemtechnomancy: got a minute?
18:25amalloygfredericks: but i got you to break your streak. i'd say that counts as mattering
18:25technomancyarrdem: what's up?
18:26arrdemtechnomancy: I'd appreciate some help with having different compile time deps vs runtime deps.
18:27arrdemtechnomancy: basically I've gotten my summer compiler project to emit clojure/core, which means I don't want to have clojure.lang.RT bootstrapping it. So I built a version of RT that doesn't do so. Because the compiler is written in Clojure, I have to have clojure around when the compiler builds the source code, but for running the emitted classes I just want to use my lib-clojure rather than all of clojure 1.6
18:28arrdemthe only way I can think of doing this is having some `lein-oxcart` plugin that handles the compiler and compile time deps, then have user code depend on lib-clojure rather than clojure. I was wondering if there's something cleaner to be done.
18:29technomancyarrdem: this might be a good fit for the :provided profile
18:30technomancyfor stuff that needs to be around during development but not included in the downstream jar
18:30arrdemherm...
18:30technomancyarrdem: are you intending to use this just for applications, or also for libraries?
18:30arrdemright now this is targeted only at final applications.
18:31arrdemthis entire "lib-clojure" thing is me bored trying stuff, turning this into real infrastructure isn't in sight atm.
18:31technomancyyeah I'd go with making org.clojure/clojure :provided for starters
18:32technomancymaybe llasram could comment on whether that makes sense since he wrote it
18:34arrdemhum... so if I have [org.clojure/clojure "1.6.0"] :provided, then when I do "lein compile" or whatever it'll be on the classpath but for "lein run" it won't be.
18:35technomancyno, it's more like it'll be around during development but not deployment
18:35arrdemjust trying to understand what it does, I'm only seeing the lein 2.0.0-PREVIEW ann as documentation.
18:35technomancyso that's actually not great; easy to accidentally depend on it
18:36technomancymaybe if you aliased compile to ["with-profiles" "+clj" "compile"]?
18:36arrdemthat could work.
18:37arrdemor I could just build a plugin that deals with all this..
18:38technomancyI think all the primitives are there
18:38arrdemrather than trying to have a per-project configuration, just add some lein tasks.
18:38arrdemI'll dig some. thanks technomancy
18:48tsantosAnyone know if dommy can be used with node js?
19:36Anceps_Hi :)
19:42canweriotnowAny advice on starting points with dataviz/graphing in cljs? I’ve been looking at strokes for d3 interop, and c2 for pure cljs goodness, but having trouble making a call.
20:55sritchietechnomancy: looks like the :hooks I’ve set in my :dev profile are running when I call “lein uberjar"
20:55sritchieis there a way to stop this?
20:57llasramsritchie: lein with-profile -dev uberjar ?
20:57llasramor: lein with-profile production uberjar (I believe is the idiom)
20:58sritchiellasram: I had thought it used the uberjar profile by default if present
20:58sritchieand it is, it’ sjust merging it with dev
20:58llasramIt adds it, but doesn't use it exclusively
20:58llasramYou you probably also ^:replace the hooks
20:58llasram(in the uberjar profile)
20:58llasramSo many options!
20:59sritchiellasram: :hooks ^:replace [] doesn’t work
20:59llasram(Which is sarcasm directed at unintended complexity from combinations of useful features -- not intended as condescension)
20:59llasramAh
20:59sritchie:) don’t worry, I understand and relate
20:59sritchiellasram: trying an alias thing now
20:59llasramCool
21:05russ_hello, how do I access the nth element of a native javascript array in clojurescript?
21:06llasramruss_: I think just `(nth array n)`
21:07russ_llasram: I got an error doing that last time, maybe I messed something up... will try again, thanks
21:07llasramruss_: I honestly have only played around with cljs, so may be completely off base
21:11russ_just tried it again, it's a js function with array elements, nth gives: nth not supported on this type function HTMLCollection() { [native code] }
21:11sritchieI think you use aget
21:11sritchiehttps://himera.herokuapp.com/index.html
21:11sritchienth should work too
21:11llasramruss_: It's both a function and an array?
21:12sritchie(aget (array 1 2 3) 1) => 2
21:13jgdaveyYou'll need to coerce an HTMLCollection to something seq-able to be able to use nth
21:13russ_yes, a function with array elements.. returned by document.getElementsByTagName
21:14russ_is there any way I could read the property "0" or "1" of the object? I tried (.-0 obj) but that didn't work
21:14jgdavey(aget #<HTMLCollection> 0)
21:15jgdaveyThat is, to get the first "p" tag in a document, you would do: (aget (.getElementsByTagName js/document "p") 0)
21:16russ_yes, that works, thank you!
21:46sritchieanyone know how to get lein cljsbuild to ONLY do the test clojurescript build when I run “lein cljsbuild test"
21:46sritchieit always runs them all
21:56nicholasfHi, what's the convention for keeping data files (in this case a bunch of .txt files) in the structure of a lein program?
21:56nicholasfI suppose resources?
22:00llasramnicholasf: Yeah. If they actually should ship with your program (aren't deployment configuration), then the `resources` directory is the way to go
22:01llasramThat will cause them to end up in your final JAR file
22:01llasramAnd be accessible via `clojure.java.io/resource` function, or other mechanism which searches the classpath
22:05nicholasfllasram: thanks mate
23:02lukecosseyI have a question about defrecords. Is there a nicer way to pass in a map to a defrecord than the following?
23:02lukecossey(defrecord Person [name age height])
23:02lukecossey(def data {:height 5.11 :name "Steve" :age 27})
23:02lukecossey(Person. (:name data) (:age data) (:height data))
23:03kristofIsn't that a nice way?
23:05lukecosseyWell I was hoping there would be something like (Person. (said-function data))
23:07luxbocktry map->Person
23:08luxbock,(defrecord Person [name age height])
23:08clojurebotsandbox.Person
23:09luxbock,(map->Person {:name "Steve" :age 27 :height 5.11})
23:09clojurebot#sandbox.Person{:name "Steve", :age 27, :height 5.11}
23:11lukecosseyPerfect! Thank you very much, that's exactly what I wanted :)
23:19sritchieugh, here’s another Q -
23:19sritchietechnomancy: if you’re around, is there a way to specify dependencies that make it inot the uberjar,
23:19sritchiebut are NOT bundled with a jar on a deploy to clojars?
23:19sritchieI’ve got a library with an accompanying example project I’m deploying to heroku,
23:20sritchieand lein with-profile -dev,-uberjar jar doesn’t seem to get rid of them
23:20sritchiednolen_: boom, finally got this up: http://om-bootstrap.herokuapp.com/
23:21sritchiednolen_: getting close to having examples for all of the components I’ve written so far. All of these have little show/hide toggles for the code to build to UI elements that are showing
23:21dnolen_sritchie: wow this is cool, you going to do a post about this or anything?
23:22sritchiednolen_: yeah, definitely
23:22dnolen_sritchie: cool, let me know will def help get the word out
23:22sritchieawesome, thanks
23:22sritchiednolen_: once I get the the fade and dropdown mixins done I’ll be able to bang out the final important components;
23:22sritchiethe nav bars, modals, etc
23:23sritchiehere’s the backing lib: https://github.com/racehub/om-bootstrap