#clojure logs

2014-02-06

11:48silasdavisAnyone have any advice for database migration/schema libraries
11:48silasdavisI am interested in clojure ones
11:48silasdavisbut I am also considering using ActiveRecord from rails
11:48silasdavisor indeed anything else
11:48technomancy~clojars migrations
11:48clojurebotclojars migrations are just a namespace with functions: https://github.com/ato/clojars-web/blob/master/src/clojars/db/migrate.clj
11:49Anderkentsilasdavis: do you already use a sql abstraction library?
11:49technomancysilasdavis: I would recommend against something big like lobos or drift
11:49technomancymigratus or ragtime are fine, but IMO you're better off with something like the link above
11:49rkneufeldStickers! Get em while they're hot: https://twitter.com/rkneufeld/status/431468188715343872
11:50`cbpDoes north america include mexico
11:50`cbp:-)
11:50amroaw, only NA
11:51silasdavisAnderkent, thinking about it, I have a high throughput front end which is largely go, I'm also looking at which abstraction library to use there. I thought clojure or rails might provide more flexible migrations and administrative manipulation of the database
11:51joegallohttps://github.com/pjstadig/migratus
11:51locksdoes north america include portugal?
11:52silasdavistechnomancy, could you expand on your resasoning?
11:52lockswhat's an ocean, really.
11:52muhoo`cbp: last i heard, north america is canada, usa, and mexico.
11:53rkneufeld`cbp: Yeah totally
11:54`cbpUsually american sites count only canada alaska and us as north america
11:54rkneufeld`cbp: Yeah, it's not a big grand thing, so I'll totally send you some stickers.
11:55Anderkentsilasdavis: I can't remember exactly, and I've moved on from the project since so I can't change, but I think I've used drift before without any issues. The only thing I remember doing that was slightly uncommon was writing a defmigration macro that disabled down migrations
11:55`cbp=)
11:55AimHereWhat about Cuba, Jamaica, Bermuda, Barbados, Grenada and so forth? Don't they get to be North America too?
11:56`cbpcan you send anything to cuba from the usa
11:56technomancysilasdavis: I feel like the code mostly speaks for itself =) it's quite short
11:56Anderkentsilasdavis: the general approach of a migration being just a function is sound I thikn
11:56coventryHow do you say (.-value (.getElementById js/document id)) in dommy?
11:56technomancysilasdavis: also, IMO down migrations usually sound like a good idea but don't actually work well in practice because they never get tested
11:57technomancysame with DB-agnosticism; there are too many quirks in DDL across various SQL implementations to make a DB-agnostic lib really reliable unless it has thousands of users a la activerecord
11:57muhoomigrations are very clean in datomic, and seem to come from a similar approach as technomancy's.
11:57Anderkenttechnomancy: silasdavis: ah, actually, I think we moved on to a similar approach later on; except we'd also ensure that the list of already executed migrations are a prefix of the list that we want
11:58Anderkenttechnomancy: silasdavis: so I guess that's another vote against drift and for a simple approach like clojars-web
11:58rkneufeldAimHere: I don't know about those ones (esp. Cuba). If the postage is reasonable I'd do it.
12:01silasdavisso going to the other extreme, would you consider just writing a schema in a sql file?
12:02technomancysilasdavis: definitely
12:02technomancythat's a great place to start; the question is how you deal with changes
12:03silasdavispresumably through a in-language abstraction layer or dsl
12:04Anderkenttechnomancy: silasdavis: so we had a very simple schema (two or three tables) initally, so our first migration just adds that
12:04x^2hey, i am a little bit confused about what a piece of code is doing
12:04Anderkentif you have something more sophisticated you might just write it down in a sql file and run that
12:04x^2could someone help me understand?
12:04silasdavisIdeally i'd like a declarative schema and have some library mostly sort out creating me database and dealing with tables already existing etc
12:04Anderkentx^2: sure, upload it somewhere and we can take a look
12:04x^2it's really jut a line or 2
12:04x^2sec
12:05x^2(let [[_ from priv chan cmd] (re-find #":(.*)!~.* (PRIVMSG) (.*) :(.*)" msg)]
12:05x^2so you don't have to explain the regex
12:05x^2but
12:05x^2is that command just basically setting each thing returned from re-find, to one of the things in the binding vector?
12:05x^2and if so, what is the significance of the _
12:05Anderkentsilasdavis: the thing with declarative schemas is that you lose so much control of your database, and sooner or later you'll need a feature thats not in the dsl
12:05teslanickThe first thing that re-find returns is the whole string, I believe.
12:05Anderkentx^2: _ doesn't mean anything special, but it's often use as a variable name for something that won't be used
12:06x^2ohhh
12:06coventryx^2: http://clojure.org/special_forms#Special Forms--Binding Forms (Destructuring)
12:06x^2that would make sense
12:06silasdavisx^2 it indicates the first element isn't bound
12:06silasdaviswe don't care about it
12:06x^2is that just convention?
12:06Anderkentyes
12:06x^2okay
12:06silasdavisit's part of the destructuring language
12:06x^2that makes sense
12:06x^2and then in this part:
12:06teslanickYou can use it multiple times, if you want to signal that you're ignoring multiple things: let [[_ _ _ a] (re-find …)]
12:07x^2if (not (nil? cmd))
12:07x^2 31 (def parsed_cmd {:from from :cmd cmd :chan chan}))
12:07x^2ignore the 31, lol
12:07x^2so what that's doing
12:07x^2is basically just defining a hash map of the things returned previously by re-find
12:07Anderkentsomething really ugly; I hope that's not in a function or anything
12:07hiredmanbeing wrong
12:07x^2why is it wrong?
12:07x^2this isn't my code btw
12:07hiredmandefs don't go in ifs
12:07x^2i see
12:08x^2what's the better idea
12:08x^2to use a "let?
12:08silasdavisunless you want some thread-local thing conditionally but that doesn't look like this case
12:08Anderkentyou want something to be defined once and always the same; if your def is in an if, or in a function or whatever, you can't depend on it being there
12:08hiredmandepends on the intent
12:08Anderkentyeah, intent and context
12:08hiredmandef creates a global binding of a name to a value, always
12:09x^2ah
12:09x^2the full line
12:09Anderkentif this is in a function, just return the map instead of defing parsed_cmd
12:09Anderkentx^2: it'd be easier if you posted the entire file somewher
12:09x^2this person actually defined parsed_cmd as the map, and then returned parsed_cmd
12:09x^2im not sure why they didn't do it the way you just described
12:09x^21 second
12:10Anderkentthey might have been confused :)
12:10x^2ill pastebin it
12:10x^2very small program
12:11x^2http://pastebin.com/NVj5L1w6
12:11x^2it's just a simple irc bot
12:11x^2found it online, was going to use it to help me learn clojure as i do work on it
12:11x^2since im familiar with irc protocol from other stuff i've written
12:11hiredmanthis is not written by someone who knows clojure, obviously
12:11x^2i see
12:12x^2why do you say that?
12:12rasmusto)\n)\n for one :p
12:12hiredmandefs inside functions is really gross
12:12hiredmanit is also old
12:12silasdavisit's trying to write procedurally
12:13x^2hm
12:13hiredmandefstruct is pretty much abandoned
12:13x^2let me get this straight
12:13silasdavisthe let binding could be used for intermediates
12:13x^2you're saying they shouldn't be using defs because instead, you could just return whatever you're setting a def to
12:13x^2correct?
12:13silasdavisand in any case they're not needed
12:13muhoox^2: if you want to parse IRC logs, maybe try this http://p.hagelb.org/irc-logs.html
12:13x^2im actually working on making a bot
12:14x^2but anything parsing irc would be useful im sure
12:14technomancyhuh, apparently that's a thing I wrote
12:14teslanickx^2: The reason you don't def inside a function is that the function now has side effects.
12:14x^2i was looking at the code for clojurebot but it seemed pretty daunting
12:14Anderkenttechnomancy: lol
12:14x^2ah
12:14x^2i see teslanick
12:14x^2so instead of just performing a function, it is changing something outside of itself
12:14x^2which is not clojurey
12:14x^2i think
12:14hiredmantechnomancy: hah!
12:14teslanickAnd not like… ok side effects like logging.
12:14Anderkentx^2: more or less right, an in particular defining a global var as a side effect is fugly
12:14amroside effects are ugly, clojure or not
12:15teslanickIt has not-ok side effects like changing the name-state.
12:15hiredmandef has side effects at compile time, it interns a var
12:15dnolenx^2: nested defs are just really not supported but also a great source of crazy bugs.
12:15x^2hmm, ok
12:15x^2i was reading the O'Reilly book which did warn against using defs much
12:15dnolenx^2: Clojure isn't Scheme
12:15x^2oh i know
12:16x^2like i said, i didn't write that code
12:16dnolenx^2: in Scheme define is local, in Clojure def are always top-level
12:16x^2im just trying to work on something in clojure that's more complex than a basic number cruncher
12:16x^2right
12:16x^2for local we would want to use "let"
12:16x^2i think
12:17teslanickYes. If you want to define something local to a function, let is usually the way to go.
12:17muhoox^2: you might want to look at the code for lazybot or clojurebot for inspiration
12:18x^2alright, iwas looking at the code for clojure bot for a little
12:18x^2it seemed really daunting
12:18rasmusto~let
12:18clojurebotlet is creating a local binding in your lexical scope
12:18x^2because i am really new to this
12:18hiredman~clojurebot
12:18clojurebotclojurebot has a poetic soul
12:18x^2lol
12:18x^2.let
12:19muhoox^2: or if you really want to get going fast, https://github.com/flatland/irclj
12:19rasmusto,(let [{:keys [a b c]} {:a 1 :b 2 :c 3}] [a b c])
12:19clojurebot[1 2 3]
12:19x^2oh nice
12:19x^2might check out this library, how it's written and then see if i can use it
12:19teslanickdestructure the keys for god's sake!
12:20teslanickytmnd
12:20AnderkentI always forget the [] around keys in :keys
12:20Anderkentmakes me sad, every time
12:20hiredmanx^2: https://gist.github.com/hiredman/27733 is an older version of clojurebot as a single file
12:20locksAnderkent: time for an emacs plugin
12:21Anderkentlocks: >emacs D;
12:21x^2hiredman: thanks a lot, i think this is actually good
12:21x^2because im still a little confused by how people break up files in clojure applications
12:22x^2now this code uses a few "def"'s for constants like irc channel
12:22x^2i assume that is the case where it's actually ok
12:22x^2if you want it to be basically an immutable thing
12:22rasmustox^2: put similar functions in a namespace that makes sense, and everything else in a namespace called "misc", thought that's probably not the only way
12:22x^2hmm ok
12:22x^2i also haven't really seen the purpose of using multiple namespaces yet
12:23x^2but im sure that will come with time
12:23teslanickhiredman: I love your docstrings.
12:23teslanick "just do this, I don't care"
12:23AnderkentI never know how to format a docstring
12:24Anderkenti.e. manual linebreaks? indent?
12:24hiredmanasync would be future in more modern clojure
12:24rplacaAnderkent: manual linebreaks yes (none of the tools add them for you)
12:25Anderkentrplaca: but that leaves you with the indent problem :P
12:25AnderkentI usually end up putting a new line after the opening quote then writing with 0 base indent
12:25rplacaAnderkent: do all the normal formatting manually (i,.e., indent when you have examples or whatnot)
12:25Anderkentalso, damnit, I want triplequoted strings :(
12:26Anderkentrplaca: the thing is if your docstring is mutliline and indented itself, all but the first line will get indent that you don't want
12:26rplacaindent following lines to the original if you like it or leave it on the left margin
12:26rplacayeah, I know
12:26rasmusto,(str "" "foo" "")
12:26clojurebot"foo"
12:26rplacain autodoc I compensate for that by removong the constant indent on following lines
12:26rasmustothere's your triple quotes :p
12:26Anderkentrasmusto: try that for a docstring :)
12:27rplacaI keep meaning to submit a patch for the doc function to do the same
12:27Anderkent#=(str "" "foo" "") :D
12:27technomancy,«let's add "literal" strings»
12:27clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: �let's in this context, compiling:(NO_SOURCE_PATH:0:0)>
12:27rasmustotrue, I guess it wouldn't work in ^:doc either
12:27technomancyboooo
12:27rplacaAnderkent: I really wanted """ yesterday when I was putting a whole python program inline in my clojure program
12:27Anderkenttechnomancy: so each raw string takes a manually input unicode char?
12:27Anderkent:P
12:28hyPiRion,'[«let's add "literal" strings»] ; ?
12:28clojurebot[�let's add "literal" strings�]
12:28Anderkentrplaca: I really really want """ because I'm writing a doctest library but kinda can't get arsed to finish it because without """ it's pretty much useless
12:28technomancyAnderkent: C-x 8 <; not that much more than three "s
12:28hyPiRion,(apply str '[«let's add "literal" strings»])
12:28clojurebot"�let'saddliteralstrings�"
12:28technomancyplus it's easier to match open/closed with paredit =)
12:28hyPiRionwhoops.
12:28Anderkenttechnomancy: editor specific solutions are not solutions
12:28technomancyAnderkent: it's the 21st century; editors need to get with the times =)
12:29rplacaAnderkent: probably you need to come to terms with that yourself. It seems very unlikely that you're going to get """
12:29rplaca:)
12:29Anderkent: (
12:30Anderkentis that because people actively don't want """, or some other reason?
12:30rasmustowhen I need literal strings I just slam everything over to the left
12:30Anderkent(I guess it'd be backward incompatible, but meh)
12:30technomancyAnderkent: probably just because it's very difficult to convince rich of any change
12:30Anderkent:( fork it! :P
12:30rplacaAnderkent: +1 technomancy
12:30rasmusto"lojure
12:30hiredmante
12:31technomancylava is a pretty good name
12:31Anderkentor surely you could release it as a library? just hook into the reader and swap contents of """
12:31rasmustoreader macro? doesn't that require a fork too?
12:32rplacaClojure doesn't support hooking into the reader that way. At least not now
12:32hiredmantechnomancy: I think it is because most literal string proposals to date would make the reader not LL(1)
12:32Anderkentrasmusto: just redefine clojure.core/load-lib :P
12:32technomancyAnderkent: technically possible, but not in a way that wouldn't make your stomach churn
12:32x^2thank yall again for the help, this seems like a friendly community. going to hang around here a bit.
12:32rplacaRich has been concerned that having multiple reader syntaxes would harm code compatibility
12:32Anderkentor, can you replace methods by reflection in java?
12:32Anderkent:P
12:32rplacax^2: thanks for stopping by
12:32x^2:)
12:32rasmusto,(let [f (fn [x] (* x x))] (f 2))
12:32clojurebot4
12:33technomancyAnderkent: the reason clojure doesn't have reader macros is that they have composability issues in CL
12:33technomancywhat you're describing is a giant composability issue =)
12:33locksI've only been here a while, but every other day I see """ mentioned
12:33AnderkentI wasn't serious for a while now :P
12:33technomancyhiredman: huh; shows how much attention I've been paying
12:33Anderkentlocks: because it's so good :(
12:33rplaca:)
12:33technomancyAnderkent: neither was my «» fwiw
12:33locksAnderkent: what does it do?
12:34Anderkentlocks: let you type stuff in your string without having to escape "! :X
12:34locksso, literal strings?
12:34Anderkentnot quite, just an alternative terminator.
12:35rplacaactually the nice thing about my python program is that I could just convert all my " to ' and it went into a Clojure string just fine
12:35lockshm
12:35Anderkentrplaca: so you don't have any ' in your python " stirngs?
12:35rplaca(thoug I still needed to double up some \s in regexps)
12:35Anderkent:P
12:35rplacaAnderkent: not in that program, no
12:36aconbereI feel kind of dumb but I'm trying to find documentation on clojure (not sure what to call them) 'type annotations' like you see here `(defn read-chunks [^java.nio.ByteBuffer record]...)`
12:36rplacasomeone decided that the correct data encoding for some data I needed was actual executable python
12:36aconberewhat are those ^ things called?
12:36Anderkentaconbere: caret?
12:36Bronsaaconbere: type hints
12:36rplacaso I had to use python to exec it and spit out CSV that I could read in Clojure
12:36aconbereBronsa: thanks :)
12:37Anderkentah. not reading back strikes again
12:40rhg135rplaca: I'm so sorry
12:47rplacarhg135: :) one of the little travails of living in the real world
12:48rhg135Edn ftw
12:48rplacaat least I didn't have to write my whole solution in python
12:49rplacaactually here CSV or JSON would be excellent formats
12:49rhg135Hmm
12:49rplacaI don't need to sell the non-CLojure world on edn and the data itself is super simple
12:49rplacajust a buch of node and roles in test runs for a distributed DB
12:49rplaca*bunch
12:50rhg135Whomever gave you the python was a sadist
12:50rasmustoat least python has list slicing notation
12:50rplacano, just didn't understand the implications of what he was doing
12:50Anderkenttbh I end up using csv quite often - the fact that you can just append lines to file without having to worry about collection terminators etc is convenient
12:51rplacaAnderkent: agreed. when you're data is fundamentally tabular it's my favorite
12:51rasmustotell me that abc[-1:-3:-1][::-1] isn't easy to understand
12:51rplacacause you can read and write it everywhere
12:51rplacarasmusto: :)
12:51AimHereI quite like spitting out JSON from clojure with a multimethod. If I can find an excuse to do that, I will ;)
12:52rhg135rasmusto: it burns
12:52rplacaAimHere: hah. In this case my little python program is doing that on it's side so it can parse the python format but also some CSV I create to describe systems and the JSON that I hope they'll adopt
12:53rasmustoyeah, that was too confusing so I wrote this instead: abc[::-1][::-1][0:8][::-1]
12:53mdeboardedn -> graphviz pls
12:53rplacabut it uses multiple if statements :)
12:53rhg135Uh
12:53rasmustomdeboard: did you try out the code in that gist I posted?
12:53mdeboardrasmusto: Negative
12:53rplacamdeboard: shouldn't be too hard to write
12:54rasmustorandom graphs and clustering of the alphabet
12:54rasmustosometimes it takes quite a while to render
12:55rhg135rasmusto: any reason you're reversing a list twice?
12:55rasmustorplaca: see https://github.com/ztellman/rhizome
12:55rasmustorhg135: it's actually for clarity's sake
12:55rasmustoas backwards as it sounds
12:55rhg135Really?
12:55Anderkentrasmusto: well, that's not really very clear :)
12:55rasmustoit would if you knew the context
12:55rasmustowould be*
12:56rhg135It confused me
12:56rasmustowell, abc is lsb first, so I need to reverse it, then I want to index it without using negative numbers, so I reverse it, then index it, then reverse it again
12:56rasmustothere's the clarity
12:57rhg135Hmm
12:57riz_can someone explain what the big deal about Monads is?
12:57rhg135Working with bytes is so uncouth in 2014 lol
12:57riz_i come from an imperative/OOP background
12:58rplacarasmusto: ahh, cool. I hadn't seen that Zach had done that
12:58Anderkentriz_: they're a general way of threading state though your functional code
12:58rhg135riz_: more composition
12:58technomancy"No one can explain what a Monad is. you have to see it for yourself."
12:59rasmusto,(take 2 (reverse (reverse "010011")))
12:59clojurebot(\0 \1)
12:59riz_more composition?
12:59rasmustookay nvm, it's really unclear, especially in clojure
13:00rasmustorhg135: bits, bytes are too coarse-grained
13:00llasramriz_: Are you familiar with function composition, such as via the Clojure `comp` function?
13:00rplacatechnomancy: that's why there are so many tutorials on monads!
13:00rhg135Imagine two functions returning a pair
13:00riz_yes
13:00rhg135But taking one arg
13:01rhg135How do you compose them?
13:01llasramriz_: Monads are essentially a type-based way of describing patterns around function composition
13:01technomancyrplaca: no, that's because of a secret condition in GHC's license that says you have to blog about monads within 3 months of starting to use GHC
13:01rasmustorplaca: the random graphs I was talking about https://gist.github.com/rasmusto/8807304
13:01rhg135technomancy: I didn't
13:01Anderkenttechnomancy: ... that explains so much
13:01rhg135I broke the license
13:02technomancy~guards
13:02clojurebotSEIZE HIM!
13:02llasramhehe
13:02rasmusto~monad
13:02clojurebotmonad is #=(str "super" "awesome")
13:02rhg135Lol
13:04rhg135I use them for mostly state and error handling
13:04hyPiRionllasram: that was actually a good way of describing monads.
13:05rhg135Oh and that promise monad I wrote
13:13llasramhyPiRion: Well you don't need to act so surprised!
13:15riz_TIL, c# LINQ uses Monadic principles!
13:15riz_i'm still finding them hard to grasp, currently, but now I know that I've been using them all along!
13:16rplacarasmusto: ahh, there's something to play with today!
13:16rplacatechnomancy: man, I'm in violation of that clause by many years I'm afraid :)
13:20llasramI need to dig through the clojure-user archives... khissen has this awesome post that was basically "Well, Clojure now has separate partial implementation of three different monads. Maybe it should be a core abstraction?"
13:20llasramer, khinsen, and that's IIRC
13:24bbloomllasram: which 3 monads?
13:24technomancylist, future, and STM?
13:24llasrambbloom: sequence, ... Er. Man, now I really need to find it
13:24llasramOh, that sounds like a good guess
13:25technomancyuneducated guess
13:25Anderkentno guess is uneducated!
13:26bbloomfrankly, i'm not convinced that there is value to reifying monads in core, since each concrete monad has unique syntax considerations and extra non-monadic operators
13:26bbloomif you're going to reify an abstraction, you need to get something from it
13:26bbloomin haskell, you get two things: 1) do syntax and 2) monad-level abstract operations
13:26technomancyinc
13:27bbloomfrankly, we don't strictly need #1, since i'd rather per-monad syntax (we have for, some->, etc)... but this ties in to #2
13:27bbloom#2 is *annoying*
13:27technomancythe STM has way more in common with other IDerefs than seqs; that's an actually-practical abstraction
13:27bbloomoperating on abstract monads is kinda useless for pretty much everything but a compiler
13:28bbloomand even that relies on details of the concrete monad isntantiated for maximum benefit!
13:28bbloominstantiated*
13:30bbloommaybe it's b/c i'm not a haskell programmer, but i look at http://hackage.haskell.org/package/base-4.6.0.1/docs/Control-Monad.html and don't see anything i'd really ever want to use that we don't already have in clojure.core in one form or another
13:31bbloomstuff like filterM isn't necessary with dynamic typing: you can just filter a list of pairs
13:31bbloomlifting is a pain in the ass
13:31bbloomworst of all, all this stuff obscures the data. monadic chains are opaque
13:31bbloomi much rather a flattened lazy seq of operations and reduce over that eagerly. so much nicer b/c you can debug it interactively
13:31hiredman(see compojure routes)
13:31bbloom*shrug* monads :-P
13:32rkneufeldCan anyone offer any opinions on what the state of the art is for building quick CRUD services in Clojure is? Does Liberator serve this purpose?
13:33llasramOk, I can't seem to find the post I mentioned, and am giving up before I waste excessive time on it.
13:33llasramIt may be a memory implanted by the government, to discredit me
13:33bbloomrkneufeld: my impression from the talk on liberator was that it's the industrial strength http API design toolkit thinggie. i dunno if it has a more rails-like brain dead crud/rest/resource wrapper thinggie too
13:33rasmustollasram: a monad of the state, if you will
13:34hiredmana liebnizian monad of the state
13:35rhg135Dat paranoid
13:36llasramSee -- their plan is working
13:36rhg135Ic
13:37rhg135I don't trust you anymore :P
13:54mdrogalisdnolen & tbaldridge: What's the difference between a coroutine and what core.async provides? I'm not familiar with the former.
13:54dnolenmdrogalis: coroutine is something the language runtime itself must support
13:55mdrogalisdnolen: Hm.
13:56tbaldridgemdrogalis: coroutines are basically co-operative multitasking. Like threads, but other threads only run when you call (yield) or (yield other-thread)
13:58muhootechnomancy: in clojars migrate.clj, why are you passing the vars of the migration functions to the migrate function, instead of just passing the function? i.e. why (migrate #'foo) not (migrate foo) ?
13:58technomancymuhoo: the function doesn't know its own name
13:58technomancyso you can't record the fact that it ran in the migrations table
13:59muhooah, cool
13:59technomancywhich is kind of silly
13:59technomancybut that's the way it is
13:59muhoothere's no args[0] as in c
13:59muhooclever solution tho
13:59mdrogalistbaldridge: Ah, I see.
13:59technomancymore just that defn doesn't copy the var metadata onto the function object itself
14:00alandipertmdrogalis: check out ftp://www.cs.indiana.edu/pub/techreports/TR158.pdf section 3 - coroutine =~ continuation
14:00technomancyfor historical reasons
14:00mdrogalistbaldridge: Would it be correct to say you can use core.async in that manner?
14:00mdrogalisThanks alandipert. Reading.
14:00tbaldridgemdrogalis: maybe? I think it's possible, but I haven't tried yet.
14:01tbaldridgea bunch of gos all waiting on one channel might work. still it'd be a bit of a hack.
14:01mdrogalisYeah
14:02dakroneif anyone here has a project that heavily uses clj-http, please try out the 0.9.0-SNAPSHOT as it has some drastic changes in the way headers are represented internally
14:03muhoodakrone: i do. what broke? :-/
14:03dakronemuhoo: nothing should be broken, but you should be able to retrieve headers in a case-insensitive manner now
14:04dakronemuhoo: clojure 1.2.1 and 1.3 support was dropped also
14:04dakronebut that's why it's a snapshot, so if it actually breaks things, we can fix it before it's released :)
14:04technomancydakrone: curious, known breakage or just "no longer tested"?
14:04technomancywith 1.2/1.3
14:05dakronetechnomancy: known breakage (:use -> :require, docstrings for defs, type hinting syntax)
14:05technomancycool
14:06hfaafbis there a cool way to access items in a multidimensional array
14:06muhoodakrone: great, thanks.
14:06dakronemuhoo: please do let me know if anything breaks (nothing should) :)
14:06joegallohfaafb: one a skateboard while listening to "Go Ninja Go" from the TMNT soundtrack
14:06joegallos/one/on/
14:06joegalloi think if you'd do it that way, it would be pretty cool
14:06technomancy(inc joegallo)
14:06lazybot⇒ 3
14:08hfaafbi cant even skateboard
14:08hfaafbshould i just learn haskell
14:08technomancyonly if there's a skateboard monad
14:08muhoojoegallo: on irc while on a skateboard?
14:08`cbphfaafb: if it's a java array use aget
14:08muhoohow is that even possible
14:08hfaafbits a clojure vector
14:09`cbpget-in
14:10S11001001hfaafb: how about some https://github.com/mikera/core.matrix#corematrix
14:10teslanick,(get-in [[,,,]["hello" "world"][,,,][,,,]] [1 1])
14:10clojurebot"world"
14:10hfaafbthanks
14:10hfaafbyou guys are pretty cool
14:11teslanick(pretty chuffed about that use of commas as whitespace)
14:11`cbp~haskell
14:11clojurebot"you have to see features like that in the context of Haskell's community, which is something like Perl's community in the garden of Eden: detached from all shame or need to do any work." -- ayrnieu
14:12alandipert,((fn [v [x y]] (get v (+ (* x 2) y))) [1 2, 3 4] [0 1]) ; for a flat vector posing as a multidimensional one
14:12clojurebot2
14:41sritchie_cemerick: hey man, are you around?
14:41sritchie_I've got an austin setup that just… stopped working.
14:41sritchie_cemerick: I'm running the "connect" call in the browser (I've run it a couple of times in the console)
14:41sritchie_cemerick: but I have no visibility into whether the connection's failed, etc
14:41sritchie_no errors, nothing
14:42cemericksritchie_: umm
14:42cemerickNot sure what to say about that.
14:42cemerick*something* changed
14:42sritchie_like, my first command at the repl in emacs (* 2 2) just hangs, as if it's waiting for a connection
14:42sritchie_cemerick: okay, fair :)
14:42sritchie_cemerick: the Q stands… any way to diagnose whether or not the connect call on the browser actually went through?
14:43sritchie_the whole thing is fragile enough that I worry about whether I'm even using it correctly.
14:43sritchie_cemerick: stackoverflow happens sometimes if I disconnect with :cljs/quit and try to reset the browser repl atom,
14:43seangrovesritchie_: Same issue, constantly and constantly
14:43cemericksritchie_: look for a series of 3-4 requests right when the session starts in e.g. the network panel in chrome
14:43sritchie_cemerick: oh, jesus, there it goes
14:44sritchie_just connected after like a minute
14:44muhoo,(get '(1 2 3) 1)
14:44clojurebotnil
14:44muhoo,(get (vec '(1 2 3)) 1)
14:44clojurebot2
14:44muhooWHY?
14:44seangrove"cljs repl hangs", "hard refresh page", "still hung, C-b" "hard refresh", "try command again in cljs repl, hung", "hard refresh", "works!"
14:44sritchie_exactly
14:44llasrammuhoo: Because lists don't provide constant-time indexed access?
14:45sritchie_cemerick: do you have that experience that seangrove is mentioning?
14:45sritchie_or is there some better way to set up the tools than injecting that script inside of your html and having the app connect back to the repl
14:45cemerickI don't, no.
14:45muhoollasram: but, nil is surprising. throwing an exeption "you can't use get on a list" would be more helpful
14:45seangrovecemerick: Really? It's constantly happening to everyone I introduce cljs to
14:45sritchie_yeah, every single dev environment I've touched is extremely finicky
14:45cemericksritchie_: that's sort of the entire premise of the browser-REPL :-P
14:45llasrammuhoo: (get 'zoom 'what 'foo)
14:46seangrovecemerick: Although Austin is fantastic, please don't misinterpret my moaning ;)
14:46llasrammuhoo: Er, ##(get 'zoom 'what 'foo)
14:46lazybot⇒ foo
14:46sritchie_cemerick: yeah, I get that, which is why the experience is so confusing
14:46sritchie_like, the whole stackoverflow issue when you disconnect
14:46sritchie_yeah, it's great to have Austin, for sure
14:46cemerickseangrove: well, if I could get my hands on legitimately not-working environment, I'd do what I can. I've paved over all the rough spots I've ever hit. *shrug*
14:46sritchie_cemerick: we can Screenhero sometime if you like
14:46seangrovecemerick: I understand
14:47sritchie_hell, I can give you access to our PaddleGuru source if you want
14:47seangrovecemerick: I can repro it in a certain case though
14:47sritchie_cemerick: and you can try to run the browser repl
14:47seangrovecemerick: Hopefully I can find time for a minimum repro case
14:47muhoollasram: hum. well. that's a sharp edge i guess i'll just have to watch out for. if i pass a list into a function that's expecting a vector, or if i try to do get-in on a nested structure and some part of it will be a list, i'll get a silent nill failure
14:47sritchie_seangrove: that'd be awesome
14:47sritchie_cemerick: any insight into that issue of clojure.tools.reader compilation failing when Austin's on the classpath?
14:47seangrovesritchie_: Maybe. Specifically if I try/catch at a certain point the repl never *actually* connects
14:47cemericksritchie_: I have to draw the line at OSS contributions short of doing remote support skypes, etc. ;-P
14:48cemericksritchie_: sorry, link?
14:49sritchie_https://github.com/cemerick/austin/issues/37, https://github.com/cemerick/austin/issues/23
14:49sritchie_cemerick: sure, I write a bunch of open source too, I get it...
14:49technomancymuhoo: silent nil failures are the Clojure Way =\
14:49sritchie_I wasn't trying to ask for extra work, just offering a debugging environment for what seems like a fairly major issue in the library
14:50muhootechnomancy: not always, and i have many multiple-page-long stacktraces to prove it
14:50sritchie_cemerick: not so you can debug my stuff, you just mentioned getting your hands on a busted environment
14:51stuartsierramuhoo: I've filed issues on some of these; http://stuartsierra.com/2013/02/04/affordance-concision
14:51cemericksritchie_: right, that; I hadn't associated it specifically with tools.reader. No, I haven't looked into that yet in detail.
14:51cemerickvery happy for some help with it, tho
14:51technomancymuhoo: silently returning nil and failing in an unrelated part of the codebase, rather
14:52cemericksritchie_: Yeah, I appreciate the offer. Maybe I'll take you up on it at some point, but I'm extremely focused lately / now / hopefully as long as possible, etc.
14:53sritchie_yeah, for sure, the stuff you're putting out is awesome
15:07muhoostuartsierra: thanks, that's a nice exposition on the topic.
15:09stuartsierramuhoo: you're welcome
15:25Anderkentwere all bots dead on 3rd Feb? Trying to find the logs online :P
15:25hiredmanfreenode fell appart
15:25Anderkenthm, then that's probably not the day I'm looking for
15:25TimMcWe could do a merge on people's logs...
15:26Anderkentdamnit, i think it is the day I was looking for ;_;
15:26hiredmanactually, most of the freenode issues were the 2nd and the 3rd for me, but maybe utc that would have been the 3rd and the 4th
15:26Anderkentlogs for the 4th also seem very short for everyone?
15:26Anderkenteh.
15:28TimMcAnderkent: Whatcha looking for?
15:28Anderkentsomeone was helping me on tuesday, I think, with a No matching ctor found for class clojure.lang.AFunction$1 error
15:28gfredericksoh well use the matching constructor instead
15:28Anderkentand I just wanted to tell them they were half right, and damn I don't think I can fix it
15:29Anderkent;_;
15:30Anderkenteh no, goddamnit, I still don't get why it's breaking only in this particular case
15:31doody1what are some good references on clojurescript?
15:31AnderkentAnyone know where function pre/post conditions are built?
15:32Anderkentah, in fn
15:32clojurebotHuh?
15:33TimMcAnderkent: Well, I can give you my logs for the last week or whatever.
15:33Anderkentnah, it's cool
15:33Anderkentnot really important
15:34TimMc(Lines elapsed since start of Feb 3: 4000. Not actually that many.)
15:34stuartsierraclojurebot: classes?
15:34clojurebotGabh mo leithscéal?
15:35Anderkentoh shit, I get why it's broken
15:35clojurebotTitim gan éirí ort.
15:35Anderkentprecondition is literally included in the metadata of a fn
15:35Anderkentand my literal representation includes a function object
15:36stuartsierraI can never find that diagram of Clojure's classes/interfaces when I want it.
15:36Anderkentwhich it cant put in code. Gah.
15:39TimMcstuartsierra: Well, if you find it again, I'd be curious to see it.
15:41gfredericksdoes the leiningen dependency list get turned into a classpath in leiningen's code or maven code or somewhere else?
15:42rhg135stuartsierra, if you find it add it clojurebot
15:47arrdemclojurewiki too...
15:49stuartsierrahttp://n01se.net/paste/fZQ
15:49stuartsierraPNG here: http://n01se.net/paste/HTx
15:50stuartsierraSVG here: http://n01se.net/paste/fZQ?pretty=no
15:50Anderkentstuartsierra: how did you choose the colours?
15:51stuartsierraI didn't.
15:51Anderkent:D
15:51stuartsierraIt's from https://groups.google.com/d/msg/clojure/H42kG6_aKms/gYyJoD7UUe8J
15:51stuartsierraChouser made it.
15:51arrdem(inc chouser)
15:51lazybot⇒ 15
15:51bmath(+ 3 4)
15:51clojurebot*suffusion of yellow*
15:56gfredericksis there any succinct summary of what situations require `lein clean` to avoid having wrong dependencies?
15:57TolstoyIs there any way to get tools.logging to use a logger name other than the namespace?
15:58hiredmangfredericks: it should never be required for dependenxies in lein 2, but can be required to clear out stale aot'ed stuff
15:58gfrederickshiredman: which might include dependencies?
15:59stuartsierraclojurebot: class chart is https://groups.google.com/d/topic/clojure/H42kG6_aKms/discussion
15:59hiredmanyes, AOT is transitive'
15:59clojurebotIk begrijp
15:59stuartsierraclojurebot: class chart ?
15:59clojurebotTitim gan éirí ort.
15:59stuartsierraBah.
15:59hiredmanclojurebot: class chart?
15:59clojurebotclass chart is https://groups.google.com/d/topic/clojure/H42kG6_aKms/discussion
15:59hiredmanclojurebot: class chart
15:59clojurebotclass chart is https://groups.google.com/d/topic/clojure/H42kG6_aKms/discussion
16:01TolstoyLooks like there's no way to do it.
16:04AnderkentThat feeling when you can't remember why you're doing something, but it's breaking stuff, and removing it stops the breakage, so you remove it #bugfixed
16:05TolstoyIs there a way to create a namespace "on the flow" to bind to *ns* temporarily?
16:07hiredmanTolstoy: yes, but don't
16:07hiredmanthe cases where you would need that are vanishingly small
16:08TolstoyI just want to be able to log to subject matter with tools.logging rather than namespaces.
16:08hiredmanTolstoy: just don't uses tools.logging then
16:08TolstoySo it's not possible with that tool. Okay.
16:09hiredmanor use the lower level functions it exposes (which I dunno, they may let you do whatever)
16:09TolstoyYeah, I looked at those. They pay attention to *ns* so thought maybe I could override that for the one case I need it.
16:09stuartsierratools.logging just wraps Java logging APIs, all of which let you create a Logger object with an arbitrary name.
16:10shriphanihi. is it possible to do pass in extra arguments with lein ring server ? I can't see a way to do it and my google-fu is failing me.
16:10Tolstoystuartsierra: I'm not seeing that, though. The logger they seem to want is a logger factory. I'll check again, though.
16:10paulswilliamsesqHiya - can someone please advise what the benefits of using :require are without aliases, when you can use fully qualified references to functions outside of the current namespace? #not_trolling ;-)
16:10stuartsierraTolstoy: Just use the Java API for your logging library.
16:12stuartsierrapaulswilliamsesq: Just referring to a function in another namespace does not load that namespace.
16:12Tolstoystuartsierra: Heh. That'll work. ;)
16:12hiredmanpaulswilliamsesq: you can't, though, unless something else has already loaded the code
16:12hiredmanrequire loads the code, refering to a function with a full qualified name will not
16:14paulswilliamsesqstuartsierra: hiredman: does this rule include functions within clojure ns like clojure.set/intersection? I seem to be able to call it using fully qualified name without explicit requires. Could it be lein that autoloads clojure.* namespaces?
16:15hiredmanthe clojure runtime loads clojure.core and a few others
16:15hiredmanthe ns macro automatically requires clojure.core
16:16stuartsierraIn general you cannot rely on anything being loaded besides clojure.core.
16:16hiredmancorrect
16:16hiredmanthe set of namespaces that the runtime loads besides clojure.core has changed overtime
16:16paulswilliamsesqhiredman: gotcha, just going through joy of clojure, which uses invocations of clojure.set/intersection as an example of when to use require, and being devious, I tried without the require and was suprised to see it work!
16:17hiredmanclojure.set is a namespace where this changed, it used to be automatically loaded, then wasn't
16:18paulswilliamsesqhiredman: and now is again?
16:18technomancyit used to be loaded by clojure.main
16:18hiredmancould be
16:18technomancynow clojure.main got disj'd from the set of things that load clojure.set
16:19hiredmanpaulswilliamsesq: if you are at a repl, and ran a require, it loaded it, and it will stay loaded
16:19Anderkent#reassuring-commit-messages: https://github.com/JacekLach/cloverage/commit/69fa5556e4cfe9ac884d7c6f2dffb66c976a462b
16:20paulswilliamsesqhiredman: not running in a repl, running in a testing ns tested through lein-autoexpect
16:20hiredmanAnderkent: 90% of testing and code coverage frameworks for clojure are written by people who never seem to know what they are doing
16:20Anderkenthiredman: that's me :(
16:21hiredmanwhich I sort of imagine why code coverage and tests apeal
16:21hiredmanpaulswilliamsesq: autoexpect most likely isn't cleanly testing things, e.g. it is using the same jvm with whatever accumalted state for multiple test runs
16:22hiredmanAnderkent: would you say you know what you are doing with clojure then?
16:22Anderkenthiredman: Yeah, I'd think so. This is more of a case 'I don't have time to track it down right now' than a 'I don't understand the language I'm using'
16:23paulswilliamsesqhiredman: ok, I've been using it in a similar style to koans.
16:24paulswilliamsesqhiredman: I've previously found tdd a good way of learning and recording facts about languages / libraries etc.
16:24hiredmanAnderkent: as whoever was trying to tell you, you are emitting a function object from a macro instead of a data structure that when evaluated is a function object
16:24Anderkenthiredman: that's me. on both sides.
16:25hiredman,(let [a '(fn [x] x) b (fn [x] x)] [a b])
16:25clojurebot[(fn [x] x) #<sandbox$eval25$b__26 sandbox$eval25$b__26@183da96>]
16:25Anderkenthiredman: and tbh the function object is only emitted as an argument to the macro itself - it should never show up in macroexpanded code
16:25hiredmanthe reason you only see it once you try to tag the function object with metadata is a little esoteric, but basically it is because metadata on function objects is a bad hack
16:25Anderkent(which is the part I don't understand - apparently somewhere it does, and it has something to do with fn preconditions)
16:26Anderkenthiredman: oh?
16:26hiredmanyes
16:27Anderkentcare to elaborate? (or point me at a relevant resource)
16:28hiredmanAnderkent: well, given a function, what would you do to create a new version of that function with metadata attached?
16:28hiredmanif you were writing it?
16:28agocs_workHere's a dumb question: I'm running a SpeClj test. In the describe block, I have "(with-all env (.toString (UUID/randomUUID)))". When I go to use the env variable inside an (it) block, I need to use the @ decorator before env. Why is that? I feel like I don't fully understand what @ is doing.
16:29hiredmanyou can't have some mutable field, because fns are values, not references, so you need to be able to return a "new" value with the metadata without effecting the old value
16:29Anderkenthiredman: right, so it delegates?
16:30hiredmananyway, just think it through, come up with some designs and tradeoffs for those designs, I have to go back to work
16:31hiredmanand follow it all the way through, given an abitrary object, and clojure compiels to bytecode, so for compilation you have to embed that object in the jvm bytecode somehow
16:37Anderkenthiredman: but that's my point, the function object should never be embedded into actual code - it's only ever passed around as an arg to a macro, or called from that macro
16:37gfredericksis there a lein plugin for sticking all the project data on the classpath in some manner?
16:38hiredmanAnderkent: evidently that is not the case
16:38technomancygfredericks: check out configleaf
16:40Anderkentwell, duh. also, not very helpful. But yeah, I figure now it kinda works-by-accident since non-metadataed function objects are embeddable; I guess I really should track it down since this doesn't seem like a sane thing to rely on
16:45gfrederickstechnomancy: yo thx man u da bomb
16:46Rayneshe is da bomb
16:48scape_when using core.async go blocks, I noticed using a loop within them will hog the pool-- even if the loops are basic and non-blocking; is it not advised to spin up many go blocks with loops? I could do this in reverse and have one loop which constantly spins up go blocks-- but then why is go-loop even a macro?
16:48technomancy"No mom, things aren't the bomb any more. Only bombs are the bomb."
16:51stuartsierrascape_: go blocks run on a fixed-size thread pool right now. If most of them are "parked" most of the time it's not a problem. But if they are all doing work they fill up that thread pool.
16:53scape_stuartsierra: they're each checking if an inputstream has data available. what constitutes parked in a loop?
16:53stuartsierrascape_: parked means waiting on the result of a channel operation like <!, >!, or alt!.
16:54stuartsierrascape_: It sounds like you're creating "spin" loops that repeatedly check a flag. That will tie up a thread.
16:54gfredericksdoes (str some-lazy-seq) not print the seq for some intentional reason about infinite lazy seqs and such, or just because it was never implemented?
16:55scape_what's suggested then? spin off go blocks that check flag and <! their return on another go block?
16:55scape_apply str is needed gfredericks , I believe
16:55stuartsierrascape_: You probably don't want to be checking a flag in a loop.
16:55gfredericksscape_: I know that, I'm wondering why
16:55gfredericks,(str '(1 2 3))
16:56clojurebot"(1 2 3)"
16:56gfredericks,(str (seq "foo"))
16:56clojurebot"(\\f \\o \\o)"
16:56gfredericksoh nevermind
16:56gfredericksthat's actually the behavior I was reacting to and that's totally consistent
16:56stuartsierrascape_: Either use a blocking operation on a real thread or use a callback-based API to `put!` into a channel.
16:56gfredericks,[(str \x) (str [\x])]
16:56clojurebot["x" "[\\x]"]
16:57gfredericks^ that's a little bit weird though
16:57scape_okay, i was hoping to not write this in a call-back manner
16:58stuartsierraWith core.async you generally use `put!` and `take!` with callbacks at the "edges" of your code, to interop with other libraries. Then your application can be written with `go` blocks.
16:59scape_stuartsierra: okay thanks, i'll have to rethink this :D
17:02amalloygfredericks: i always assumed it was because of infinite seqs, yeah
17:02amalloyit's perfectly sensible to include vectors' contents, since those are known to be finite
17:17effyhow can i read a clojure stack-trace, there is not a single line of the trace that match my file, is there a tricks to make it more readable ?
17:18technomancya recent study found that clojure stack traces are "not that bad" and "often bearable"; maybe check again?
17:18amalloyeffy: usually it's noce the case that no single line comes from your file; the "trick" of reading them is to get more practice at it. you can also paste it to refheap.com and post a link here for more experienced analysis
17:18technomancysorry
17:18`cbpstart at the top! :p
17:19amalloy"noce"? "not", more like
17:21technomancyeffy: if you paste defns into the repl you won't get line numbers; make sure you're compiling the whole file as a unit
17:23effytechnomancy: mmmmh, it's probably because i call it with C-x C-e to the repl then, thanks
17:23rplacaeffy: another thing to watch for is lazy sequence evaluation, often caused by the print at the repl forcing evaluation
17:23technomancyeffy: there's no technical reason C-x C-e couldn't send line numbers
17:23technomancyit's just that no one's bothered yet
17:24effyrplaca: i got lazy-seq but i dont think it should be displayed, it's a wrong type somewhere which my newbie-ness not allow me to easily spot
17:26effythat's a good learning oportynity, is there an easy way to trace the code or dump a kind of stack-trace but with the parameters provided during the function calls ?
17:26technomancyeffy: check out tools.trace
17:34technomancybahaha https://mobile.twitter.com/seanlevin/status/431548196809363456#tweet_431548196809363456
17:35bbloomtechnomancy: apparently twitter.com and mobile.twitter.com don't share login cookies
17:35technomancybbloom: yeah, regular twitter is a real disaster when using a keyboard-driven browser
17:35technomancyor with noscript
17:36bbloomtechnomancy: which i consider a feature b/c it means that i'm less likely to screw around if my mouse is out of reach :-P
17:36technomancymy mouse is always out of reach
17:39rhg135mouse?
17:40rhg135it's over there
17:42technomancysites that don't set meta rel=next/prev: threat or menace?
17:43clj-noobhey guys.. I'm having trouble understanding macros... I'd like to wrap the enfocus defsnippet macro in a new macro so I can dynamically create one of its parameters... in this case the uri parameter... can anyone point me to an example of a macro that does something like this ?
17:44`cbpclj-noob: timbre has a defmacro inside a defmacro if you're into that sort of thing
17:44clj-noobthx I'll go take a look
17:45dsrxyo dawg
17:46`cbpclj-noob: https://github.com/ptaoussanis/timbre/blob/master/src/taoensso/timbre.clj#L478
17:47clj-noob`cpb: oh.. I think I'm looking to do something different...
17:47clj-noobspit out a macro with one of its params generated by my own macro... not nest macros
17:48`cbpclj-noob: like this? https://github.com/ztellman/clj-tuple/blob/master/src/clj_tuple.clj#L69
17:50clj-noob`cbp: yes I think so thanks, just trying to understand that :-)
18:03arrdemso why does the ns macro not support nesting of partial ns's?
18:03arrdemeg. :require [foo [bar [baz :refer :all] [bung :refer [bah]]] [other :refer :all]]
18:07technomancyarrdem: because namespaces aren't actually hierarchical
18:07technomancyit's an illusion
18:08arrdemtechnomancy: I know that
18:08arrdemtechnomancy: but it doesn't mean the macro couldn't present the illusion
18:08technomancyI think the whole prefix stuff is widely regarded as a mistake
18:08arrdemreally.
18:08arrdemthat's rather unfortunate...
18:09technomancyyou don't want to mess with grep
18:10arrdemsee... you can say that but I'd rather have smarter tooling (nrepl tools, LT support, compiler -> editor integration) that allows symbol resolution rather than saying "oh go grep for it".
18:10technomancyarrdem: ok, well write some then =)
18:10arrdemwe can build better tools. that the old ones work shouldn't be sufficient reason to keep them..
18:10technomancynothing exists now, so don't break the best thing we have till we have something better
18:11technomancyyou burn bridges *after* you cross them, not before =)
18:14arrdemI'll bomb that bridge when I come to it..
18:26bbloomtechnomancy: arrdem: i agree firmly with both of you :-) damn tradeoffs
18:26bbloomprogramming makes me feel like im skitzo more often than not
18:26arrdemwe're all mad here... some tea?
18:42gregorstocksis there a way in lein to do something like (def profile {...}) (defproject ... :profiles {:x profile :y (merge profile {...})})?
18:43gregorstocksi'm trying to combine a bunch of small lein projects into one big lein project with one profile per old project, because that should solve some git headaches
18:44gregorstocksbut everything I've tried has led to either "contains? not supported on type: clojure.lang.PersistentList" or it trying to evaluate my dependency symbols before they're loaded
18:45gregorstocksi guess #leiningen is a better place to ask.
18:54arrdemgregorstocks: so project.clj gets read and eval'd normally...
18:55arrdemgregorstocks: you should be able to add defs and soforth I thinl.
18:55gregorstocksarrdem: it turns out I want composite profiles
18:55gregorstocksI think
18:56arrdemgregorstocks: maybe. I'm not terribly familiar with leiningen's internals.
19:01ztellmanopen sourced a thing: https://github.com/Factual/durable-queue
19:02ztellmanclj-noob: let me know if you have questions about clj-tuple
19:02llasramztellman: That is sweet
19:02llasram(inc ztellman)
19:02lazybot⇒ 10
19:03ztellmanllasram: yeah, it was a surprising nothing like this already existed
19:03Raynesztellman: Open sourced things!
19:03Raynesztellman: It used to be the case that basically everything I did ever was open source. Even professional stuff, cuz flatland.
19:03Raynes:p
19:04ztellmanRaynes: how's the new gig treating you?
19:04RaynesVery well!
19:04ztellmanglad to hear it, give my best to Lance, haven't seen him in a while
19:04ztellmanis there going to be a scopely contingent at Clojure/West?
19:04RaynesHopefully I can start dragging him to meetups.
19:05bbloomztellman: i've made a bunch of file system queues... but with slab allocation?
19:05Raynesztellman: Sadly no -- this one caught me a bit off guard.
19:05Raynesztellman: The call for presentations opened like 5 minutes after I started this new job.
19:05ztellmanbbloom: not sure how else you'd do it, if you want to be able to clean up after yourself and do append-only writes
19:06RaynesI would have submitted a presentation had I felt I had the time to actually prepare one :P
19:06bbloomztellman: one file per task
19:06ztellmanhahaha
19:06bbloomztellman: performs better than (most people) think :-P
19:06ztellmanadmittedly, that didn't occur to me as a valid option
19:06bbloomztellman: don't laugh, i've processed an absurd amount of shit with bash and inotify-tools
19:06bbloom:-)
19:09bbloomztellman: i see you say 1.5k tasks/second, i've definitely done like nearly 1k with task per file :-)
19:10ztellmanbbloom: must have not been on an AWS box
19:10bbloomztellman: rackspace
19:10ztellmanthey give you fully tens of IOPS
19:10bbloomztellman: if you're lucky
19:11RaynesGuys.
19:11RaynesWhat happened to refheap? When it start getting so many pastes? Goodness.
19:12RaynesWe've now crossed 34k. I've had to outsource the database!
19:12ztellmanRaynes: do you need a queue
19:12Raynesztellman: 34k dude, I'm nearly in big data territory!
19:12RaynesIt's like two gigs man.
19:13arrdemRaynes: the all time IRC logs for #clojure were 1.9M records...
19:13arrdembigger data than my budget server can handle :P
19:13RaynesHah
19:24alewztellman: what was your use case for building durable queue?
19:24ztellmanalew: some of our customers have realtime systems that emit data they want us to use
19:24ztellmannotably, one has 50k+ datapoints/sec
19:25ztellmanwe need to journal it to S3, but sometimes S3 stops accepting writes for a bit
19:25ztellmanevery few days, we'd get a hiccup, and all the processes would fall over, hard
19:25ztellmanmeanwhile, the volume of data was increasing every week
19:25ztellmanthis was using the Hadoop S3 client, at the time
19:27ztellmanbut I've wanted something like this before, there's usually some sort of transaction log that shouldn't just be queued up in memory
19:27alewso durable-queue kicks in when S3 isn't accepting
19:28ztellmanwell, it's the intermediary even when S3 is working
19:28alewand the volume of data was high enough where memory would be prohibitively expensive?
19:28alewright
19:29ztellmanI suppose I could have gotten high-mem instances for a process whose healthy memory usage is ~100mb
19:30ztellmanbut like I said, I think it's a problem that just needed to be solved, and had a bunch of applications elsewhere
19:30alewmakes sense
19:30ztellmanand then the processes with a bunch of in-memory backlogs aren't these fragile little bubbles you have to pray stay around long enough for them to clear
19:51stirfoohow do I keep emacs cider from eating tracebacks?
19:52stirfooI use C-c M-j cider-jack-in and a lot of exceptions don't get printed. lien repl from the cl shows them all.
19:52arrdemstirfoo: they aren't eaten, they're just in *Messages*
19:52Raynes(setq cider-repl-popup-stacktraces t)
19:54TEttingerman Futures are great. as soon as you enter a new level, my game can preload the next level in another thread, even though the level generator is written in java.
19:54TEttingernever really used them before
19:54arrdemFutures are awesome until you start running more threads than you have hardware CPUs...
19:54arrdemthen things get weird fast.
19:55TEttingerI'm only using one at a time so far
19:55stirfooarrdem: haha, I like it so far, but I was never a slime guru
19:55TEttinger(thread beyond the executing one)
19:55stirfoothanks Raynes, I'll try that
19:55arrdemstirfoo: I appologize. cider is totally awesome, my brain read cider as nrepl, which is cider's old name.
19:55stirfooah
19:55alewFuture use an unbounded thread pool, right?
19:55rseniorztellman: looks awesome BTW
19:55arrdemalew: I believe so.
19:56ztellmanrsenior: thanks!
19:56arrdemalew: which is a real problem when database transactions are in futures...
19:56arrdemsee bitemyapp/revise
19:56rseniorztellman: is there a reason you didn't reach for a java message queue?
19:57ztellmanrsenior: the closest to what I wanted was Kafka, but I figured a smaller library that could be embedded in anyone's project without dragging half the world along would be a nice thing to have
19:57rseniorztellman: grim_radical and I were just talking about swapping it vs. ActiveMQ (which we're using in PuppetDB, but drags in a lot of deps)
19:57ztellmanexactly, if all you're doing is in-process queueing, most existing products are way overkill
19:57grim_radicalrsenior: yeah, looks like the only feature we'd be missing is scheduled retries
19:58rseniorztellman: yeah, that's the PuppetDB use case
19:58rseniorgrim_radical: right
19:58alewarrdem: what's the problem with db transactions in future?
19:59arrdemalew: when you have absurdly high write throughput
19:59arrdemalew: what I ran into was that I was spawning transaction futures faster than they could execute
20:00arrdemalew: which lead to all kinds of "interesting" failures.
20:00ztellmanunbounded thread poooooools
20:00stirfooRaynes: much better, thank you!
20:00arrdembounded thread pools with work queues!
20:01Raynesstirfoo: I got it directly from the README :P
20:01alewarrdem: besides an oom error, shouldn't unbounded thread pools work fine for something io bound?
20:01stirfooguilty!
20:02arrdemalew: no because you loose order gurantees on the writes, and I ran into really weird issues where the connections each worker was using could actually time out before the worker finished or even started.
20:05alewarrdem: ah, yeah, if you expect order than unbounded thread pools wouldn't work. that must have been fun to debug :P
20:05arrdemalew: you have noooooo idea :c
20:05doody1ritz doesnt work with cider right?
20:06doody1how do you debug clojure with emacs?
20:09rplacadoody1: println & tools.trace
20:10rplaca(I use cl-format instead of println, but I'm an outlier)
20:10rplacadecidedly not ideal, but it works
20:12doody1so set a breakpoint, inspect a ring handler params, is no go ?
20:13sritchie_dnolen: any advice on how to get Om (and react, I guess) to not render UI elements when they're far from the viewport?
20:13sritchie_dnolen: or maybe this already just works - thinking of a TODO list with 10k items, for example
20:14dnolensritchie_: you will need to do some windowing logic yourself.
20:14rplacadoody1: that's right
20:14dnolensritchie_: but you can make a generic component for horizontal lists w/o too much trouble
20:14dnolensritchie_: er vertical lists
20:15sritchie_dnolen: trying to find the protocol to deal with this - I remember reading about IShouldRender or something in your docs...
20:16dnolensritchie_: this logic should be in IRender(State), you select the list of things that are actually in view
20:17dnolensritchie_: it does mean you have to write some logic to know how big elements in your view are - this is way simpler if you have a fixed height of course. If you don't will be much more complicated.
20:17doody1rplaca: does that suck? or may be I am so lame
20:18sritchie_dnolen: yeah, for sure. so figure out the location of the top of the first one, then I guess I can somehow supply only the items that are supposed to be in scope given the current windowing...
20:18dnolensritchie_: exactly
20:19sritchie_dnolen: so probably just a calculated top: css value on the first one that's rendered?
20:19sritchie_cool
20:19sritchie_then the rest just work
20:19dnolensritchie_: if scroll y is 1000px, and elements are 100px tall, you know you can render starting at index 10
20:19sritchie_dnolen: and set the style of the first one to give it the right offset, correct?
20:19dnolensritchie_: that's right
20:20sritchie_dnolen: boom, what might have been a hard problem turns in to a "don't fuck up CSS syntax" problem
20:20sritchie_so good
20:20dnolensritchie_: the logic will be a little messy especially if you want to make it cross browser
20:20dnolensritchie_: but the point is that this component can be completely generic
20:20dnolensritchie_: you can just reuse it every time you need this functionality
20:21dnolensritchie_: if you write one for Om I'm sure everyone will just use yours :)
20:21sritchie_dnolen: sold
20:22sritchie_dnolen: gotta come up with a catchy name for the component, of course
20:22sritchie_dnolen: that's going to be the blocker
20:22sritchie_something about solipsism
20:26rplacadoody1: yeah, it somewhat sucks. But not quite as much as you would think, generally
20:29muhoodnolen: is there any particular reason why the second arg to om/build-all needs to be a vector not a list? is it because get-in is used inside om?
20:29dnolenmuhoo: the argument to build all can be any sequence
20:30dnolenmuhoo: but the requirement is that everything in app-state be associative for performance reasons
20:30muhoocool, thanks.
20:30dnolenmuhoo: you can of course make other things into cursors, but you do so at your own risk
20:30dnolenmuhoo: I only tests w/ things that satisfy map? or indexed?
20:31muhoopretty sure lists do neither, that'd explain it then.
20:32dnolenmuhoo: yeah leave lists and lazy-seqs out of your app-state
20:33dnolenmuhoo: you can of course *use* lazy-seq operations on things that you get out of the app state and that will work just fine.
20:33muhoomakes sense, thanks for om. i was working through the om-react-tutorial and there was a comment that the arg must be a vector for unknown reasons. i wanted to know what the unknown reasons were.
20:34muhoohttps://github.com/jalehman/react-tutorial-om, FYI
20:39sritchie_dnolen: one more Q - can you recommend a good way of passing an index in with build-all?
20:39sritchie_to get the index of the TODO item, for example
20:40sritchie_dnolen: actually, I can probably just zip an index on to each todo
20:40dnolensritchie_: yep
20:40sritchie_boom, works
20:50mlb-$DAYJOB is massively enterprise. I want to deploy a webapp. What are my options?
20:51muhoomlb-: build a uberjar and run it in a container?
20:52muhoosorry, war, not uberjar
20:52muhoomlb-: https://github.com/weavejester/lein-ring
20:52mlb-muhoo: I've been pondering that, but what's necessary to run a container environment on Windows?
20:53muhoopretty sure tomcat runs on windows, but i've never tried it. i'd be shocked if it didn't tho.
20:53arrdemyep it does
20:53arrdem$google apache tomcat war deploy windows
20:53lazybot[Apache Tomcat 6.0 (6.0.39) - Tomcat Web Application Deployment] http://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html
20:53mlb-ah, okay. Will do some research and probably pester people in #tomcat then :P
20:54mlb-thanks, muhoo and aaronj1335_
20:54mlb-err, arrdem
20:54mlb-this tabcomplete :P
20:54muhoonp
20:55arrdemnp
21:06muhoospeaking of lein-ring, is there a way to pass the nrepl start? args on the command line instead of mucking around in the source of (someone else's) project.clj?
21:07muhooi.e. i naively tried "lein ring server-headless :nrepl :start? true" and got a spectacular fail
21:08arrdemwouldn't you have to actually write your own main method? otherwise unless the args are stored there you're pretty much hosed since unlike in Python we don't have sys.argv
21:10sritchie_dnolen: my specific use, btw, is building a stopwatch -
21:10sritchie_so I'm hitting the state for a rerender every 10ms, to update the stopwatch
21:10sritchie_dnolen: qq - I KNOW nothing changes in the rest of the app until certain events take place
21:10muhooarrdem: naw, there's some magic here i remember learning about from technomancy, looking through my notes, i think i'll get it
21:11muhooupdate-in, IIRC
21:11sritchie_dnolen: is there some preferred way to isolate the updates to the stopwatch timestamp from the rest of the app? It does need to be in the state, since when you hit "mark" I need to be able to create an athlete row (a todo, basically) from that current time
21:12sritchie_dnolen: feels like local state, but other components need to read it, and "requesting" a local timer state via channels seems like the wrong approach
21:16muhooarrdem: fwiw, this was the magickal incantation that did what i wanted lein update-in :ring:nrepl merge "{:start? true :port 7777}" -- ring server-headless
21:17arrdemmuhoo: truly an incantation worthy of my black grimoire...
21:27sritchie_any advice on how to convert a record to a normal map in cljs?
21:27sritchie_or to print it as a map, without the reader literal for the record class?
21:30muhoosritchie_: (into {} ??
21:30lazybotmuhoo: What are you, crazy? Of course not!
21:30muhoolol lazybot
21:30sritchie_muhoo: ugh, duh
21:31sritchie_muhoo: I was surprised to see that records don't round trip through the reader i cljs
21:31muhooi'm not too surprised by much with cljs. it's very young. very cool tho. just starting to play around with it.
21:31sritchie_for sure
21:33muhooi'm hoping to backscroll later through the stuff you and david were talking about, looks fascinating.
21:34muhoo,into
21:34clojurebot#<core$into clojure.core$into@130b13c>
21:34muhoo$into
21:34arrdem(inc magnars) ;; clj-refactor looks awesome
21:34lazybot⇒ 3
21:34muhoo#into
21:34muhoo~into
21:34clojurebotTitim gan éirí ort.
21:35arrdem##into
21:35arrdem&&into
21:35lazybotjava.lang.RuntimeException: Unable to resolve symbol: &into in this context
21:35arrdem$google clojurewiki lazybot
21:36muhoo~into is like a magical transformer ring. (into {} something) works for a surprisingly wide variety of things.
21:36clojurebotOk.
21:37muhoo~into is like a magical transformer ring. i.e. (into {} something) converts a surprisingly wide variety of things into maps.
21:37clojurebotIn Ordnung
21:39dsrx,(into {} "what what")
21:39clojurebot#<ExceptionInfo clojure.lang.ExceptionInfo: Don't know how to create ISeq from: java.lang.Character {:instance \w}>
21:39dsrx,(into {} true)
21:39clojurebot#<ExceptionInfo clojure.lang.ExceptionInfo: Don't know how to create ISeq from: java.lang.Boolean {:instance true}>
21:39muhoohahaha
21:40muhoo,(into {} [["what" "what"]])
21:40clojurebot{"what" "what"}
21:40dsrxboring
21:41muhoook, my factoid is not very precise. feel free to correct it.
21:44dsrxcontrast with a Real Language that can get things done, like PHP http://ideone.com/GdLvdO
21:44`oetjenjhey, anyone can hint me to some good tutorials on bdd (preferably of course with clojure) with more complex examples than just calculators and/or very basic stuff?
21:44arrdem`oetjenj: bdd?
21:44hiredmancalculators are the bdd killer app
21:45akyteBehavior driven development. I think the name is usually overkill. It's closer to "more semantic tests"
21:45`oetjenjarrdem behavious driven development
21:45dsrxbondage and discipline development
21:45`oetjenj;)
21:49oetjenjbut seriously i love to learn more about bdd, but i haven't been able to find anything useful beyond those very simple examples
22:29sritchie_dnolen: undefined.onChange: No protocol method ICursor.-path defined for type : [object Object]
22:29sritchie_hmm
22:30sritchie_when I try to set some local state
22:30sritchie_one idea, back in a minute
22:31sritchie_dnolen: yeah, happens when I stick an onChange handler onto a text field
22:31sritchie_(om/set-state! owner :racer-text (.. e -target -value))
22:44technomancyoetjenj: there's nothing really language-specific about bdd
22:44technomancyoetjenj: the language-specific stuff is just "how do I write a test?"
22:46benkayi'd like to test that a byte-array that I've generated (via (.toByteArray (biginteger my-int))) matches a test-case hex string - where would you suggest I look for parsing the byte array into hex for comparison?
22:48seangrove$google clojure parse byte array to hex
22:48lazybot[character encoding - Clojure's equivalent to Python's encode('hex ...] http://stackoverflow.com/questions/10062967/clojures-equivalent-to-pythons-encodehex-and-decodehex
22:48benkayalternatively, I'd eagerly welcome reading material to improve my first-principles understanding of how to round-trip int -> bytes -> hex -> int
22:49benkayi've seen that one, yes. i'm ignorant on the subtleties of int -> byte and byte -> hex; hex -> int i think i have a handle on though.
22:50seangrovebenkay: Just a bit of teasing. If you've read that SO page, you're probably not too far away. Just play around with it.
22:51benkayoh hey! i just found ztellman's byte-streams library. am i going to cripple my understanding of clojure/jvm byte operations by using that?
22:55seangroveThe Salesforce world is a dark one
22:57seangroveHeh, the man of the hour joins us
22:59gtrakI think I can implement piggieback for jruby, does that sound like a terrible idea?
23:05seangrovegtrak: What does that mean...?
23:05seangroveClojure => compile to ruby => send to remote ruby env => execute => roundtrip result?
23:06gtraklike... sooo, nrepl middleware that evals to a ruby runtime, just to make it easy embed
23:06gtrakeasy to embed*
23:06gtrakI'd like to run a ruby repl and clojure repl in the same process.
23:06gtrakfor demo purposes
23:07sritchie_dnolen: if you're around, I think this may be a bug...
23:08arrdemhas anyone tried to use core.logic to do pruning for AI search problems?
23:09sritchie_dnolen:(u/log (implements? om/ICursor (aget (.-props owner) "__om_cursor")))
23:09sritchie_is printing "false"
23:10benkayokay so using byte-streams, evaluating (print-bytes (.getBytes "foo")) shows foo in the hex quite clearly but (print-bytes (.toByteArray (biginteger 1096))) just shows me .H
23:18nooniananyone know why i get this warning when trying to implement INamed in cljs (the code seems to work fine)? "WARNING: Symbol cljs.core.INamed is not a protocol"
23:41novochar[1 :two "three"] ; what is `:two` here?
23:42novocharis [1 :two "three"] equal to [1 {:two "three"}]?
23:44ddellacostanovochar: no
23:44ddellacostanovochar: what are you trying to do?
23:44novocharHow would you access the number 2 in a (def aList [1 2 3]) ; I'm reading that items in a vector can be accessed by index
23:44novocharddellacosta: I'm reading http://clojure-doc.org/articles/tutorials/introduction.html
23:44ddellacosta,(nth [1 2 3] 1)
23:44clojurebot2
23:44pbostromvector supports get also
23:45novocharThank you
23:45dissipatenovochar, no. the first thing is a vector containing three values, the second is a vector with 2 values
23:45novocharWhat is :two in [1 :two "three"]
23:45pbostrom:two is a keyword
23:45ddellacostanovochar: what do you mean, what index is it at? what thing is it?
23:45novochara keyword for?
23:45pbostromkeyword is a datatype
23:45novocharan atomic value of some sort, like in erlang maybe
23:45dissipatenovochar, a keyword is a value
23:46dissipatenovochar, it is an immutable value
23:46pbostromhttp://clojure.org/data_structures#Data Structures-Keywords
23:46dissipatenovochar, have you tried the clojure koans series?
23:46arrdemhttp://clojure.org/data_structures#Data%20Structures-Keywords
23:47dissipatepbostrom, i thought use of 'get' was optional
23:48dissipatearrdem, are you going to mutter about punycoding?
23:48pbostromdissipate: true, I guess I should say it implements IAssociative
23:49arrdemdissipate: sadly this also falls in the set of useful yet disgusting things which I'm willing to mutter about.
23:49arrdemthere was a double URL encoding bug that took me weeks to find in one of my previous projects :
23:49dissipatearrdem, punycoding: the bastardization of those 'other' languages. :P
23:50benkayi'm working on producing some byte arrays to be sent over tcp. i'm a total novice on this level of the jvm; what tools should I be using to serialize stuff onto the wire?
23:51arrdemwhatever the JVM uses for sockets, combined with Clojures EDN formatting, (str) and .toByteArray I assume...
23:51arrdemnot the most efficient thing in the world but it should work...
23:52benkaycomplicating this is some C++ on the other end of the connection expecting to see ints and chars and specific magic bytes
23:52dissipatebenkay, you might want to look into 'protocol buffers' or 'thrift'.
23:52arrdembenkay: do you have a specific byte frame protocol you are attempting to work with?
23:53dissipatebenkay, protocol buffers is great for that. it is language independent. you compile the API to the language you are using.
23:54benkaydissipate: thrift and protobufs look awesome and maybe precisely what i'm looking for!
23:54dissipatebenkay, https://code.google.com/p/protobuf/
23:55dissipatebenkay, sure sounds like it. :D
23:55benkayarrdem: it's the bitcoin protocol and about as poorly specified as one would expect. there isn't a 'byte frame protocol' so much as a shitty wikipedia page (https://en.bitcoin.it/wiki/Protocol_specification)
23:56benkaywell, mediawiki but same diff.
23:57arrdembenkay: I think someone already built a BTC client for Clojure...
23:57arrdembenkay: or are you looking to expose the "raw" network commands?
23:57arrdemif you do I'll add hacking out a doge port to my todo list...
23:58benkayI'm actually working on a watcher for arbitrary cryptocurrencies adhering to the baseline bitcoin protocol.