#clojure logs

2013-12-09

00:01justin_smithyou should really be seeing the line numbers in your own namespace
00:01justin_smithare you explicitly loading the ns? is a tool doing it for you?
00:03cljrnothing out of the ordinary
00:03coventryMaybe it's one of those uninformative compiler errors. Can you post the repl interactio, cljr?
00:04cljrcoventry: im able to grok what is going on, was just confued initially by why it doesn't direct me straight to the spot in my file
00:04cljrwhat is the "right" place to post it?
00:05coventryrefheap.com is nice for clojure code.
00:05cljrnothing exotic, it is just basic lein new app or whatever, then cd into that directory and lein repl
00:06coventryYeah, I meant paste the transcript of the repl input and output, up to the stacktrace.
00:11bitemyappemaphis: meh.
00:11bitemyappcoventry: it's true (Common Lisp, monads), but that really just highlights how powerful a type system can be.
00:12bitemyappcoventry: also, I think there's a way to make what he wants work well in Common Lisp.
00:12mysamdogSo I'm having more trouble with clojurescript (suprise suprise)...
00:12bitemyappbut it would require whole-program transformation like a compiler.
00:14coventrybitemyapp: Sounds interesting. Going to bed now, but I'll ask you about it / check IRC later.
00:17mysamdogThe relevent part of my code is here: https://www.refheap.com/21613
00:19mysamdogIt compiles without warnings/errors, and there are no errors in the console. However, when I click any part of the page that has the class topitem, nothing happens. What did I do wrong?
00:25justin_smithcljr: if that is all you did, your namespace should not even be available
00:34justin_smithRaynes: refheap is your thing right? Did you also do emacs refheap mode?
00:37bitemyappjustin_smith: yes and yes
00:39justin_smithOK. I was going to suggest doc strings because good emacs citizens use doc strings, but I just forked it and am writing them myself.
00:39justin_smithand will make a PR
00:47andyfI've just seen pprint, with *print-meta* bound to true, print an expression like this: (^^^{:key1 val1} {:key2 val2} {:key3 val3} val4). Does that look like a bug?
00:48justin_smithRaynes: pr sent
00:49justin_smithandyf: to my ignorant eyes, definitely
00:50andyfI'll have to see if I can figure out why this is happening. Very odd.
00:52andyfWait, I think it might be metadata *on* other metadata.
00:52amalloyandyf: i mean, it's not technically a bug - that's a valid expression
00:52justin_smithamalloy: that would load all the metadata properly?
00:52amalloy&(meta '^^^{:key1 val1} {:key2 val2} {:key3 val3} val4)
00:52lazybot⇒ {:key3 val3}
00:53andyfEven stranger is that all the keys were the same in the example I actually saw.
00:53amalloy&(binding [*print-meta* true] (pr-str '^^^{:key1 val1} {:key2 val2} {:key3 val3} val4))
00:53lazybotjava.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!
00:53amalloy,(binding [*print-meta* true] (pr-str '^^^{:key1 val1} {:key2 val2} {:key3 val3} val4))
00:53clojurebot"^{:key3 val3} val4"
00:53amalloywait, really?
00:54andyfyes, but if metadata maps can have their own metadata, then I don't see why it would be illegal
00:54amalloyright
00:54amalloyand of course they can; they're maps
00:56hyPiRionThat's just like the expressions `#_#_#_ hello my friend`
00:56hyPiRion,#_#_#_ hello my friend
00:56clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
00:56amalloyandyf: i'm actually not sure that's a correct syntax for putting meta on the meta-maps, though; it doesn't seem to work
00:56amalloy&(meta (meta '^^^{:key1 val1} {:key2 val2} {:key3 val3} val4)))
00:56lazybot⇒ nil
00:56andyfWell it is printed out from pprint, and I'm not sure I have options set to make it print readably.
00:57justin_smith,(take 4 (iterate meta '^^^{:key1 val1} {:key2 val2} {:key3 val3} a))
00:57clojurebot(a {:key3 val3} nil nil)
00:57justin_smithone would expect a reverse stack of metadata
01:00andyfThat syntax does not make the reader complain, but it doesn't seem to set the metadata in a nested fashion. You can do it with nested with-meta calls, of course.
01:01hyPiRionyeah, doesn't seem like the reader literals stack, they just merge together. Which is to be expected, considering ^:foo expands to ^{:foo true} etc.
01:02hyPiRion,(meta ^:foo ^:bar {})
01:02clojurebot{:foo true, :bar true}
01:02andyfI don't think they are merging. I think only one is being kept and the rest are being lost.
01:03hyPiRionandyf: oh, I mean the ^expr ^expr syntax, the ^^^ one just discards
01:03TimMcFreakish.
01:03amalloyandyf: i agree that seems to be what's happening; i don't quite see what in the reader is making that happen
01:06hyPiRion,(binding [*print-meta* true] (pr-str (with-meta {1 2} (with-meta {3 4} {5 6}))))
01:06clojurebot"^^{5 6} {3 4} {1 2}"
01:08hyPiRionI wonder if this is a bug in the reader or printer
01:08andyfI would guess reader.
01:09andyfI mean, not that it allows reading this syntax, but that it doesn't set the nested metadata properly.
01:10amalloyhyPiRion: it has to be the reader, right? that expression must have some printed form, and it can't be "^{5 6} ^{3 4} {1 2}", because that's defined to be the same as "^{3 4, 5 6} {1 2}"
01:11mysamdogThe dommy selection macros do not appear to work for me.
01:14hyPiRionamalloy: must it? I was under the impression that it was only required when *print-dup* was set to true
01:14hyPiRion,(binding [*print-dup* true *print-meta* true] (pr-str (with-meta {1 2} (with-meta {3 4} {5 6}))))
01:14clojurebot"^^#=(clojure.lang.PersistentArrayMap/create {5 6}) #=(clojure.lang.PersistentArrayMap/create {3 4}) #=(clojure.lang.PersistentArrayMap/create {1 2})"
01:15hyPiRionhrm, yeah, that's not going to work
01:36tufflaxIf I have Java code in my lein project, can I recompile and reload that while lein repl is running?
01:48bitemyapptufflax: who's recompiling?
01:48tufflaxI am
01:49bitemyapptufflax: no, is lein repl recompiling or is somebody else?
01:49tufflaxI dunno, whatever works
01:49bitemyapptufflax: alright, so try that.
01:49tufflaxExcuse me, how?
01:52bitemyapptufflax: try the simplest thing that could possibly work.
02:22bitemyapparrdem: you're lucky I check twitter.
02:22bitemyapplazy arse.
02:23arrdembitemyapp: br0. I'm sleeplessly twittering.
02:23arrdemI don't lurk on IRC 24/7...
02:24arrdembitemyapp: also thank you for $googling for me
02:24bitemyapparrdem: np.
02:24bitemyappI was curious too.
02:25arrdemdear sleep, why do I need you
02:25bitemyapparrdem: http://www.haskell.org/haskellwiki/Typeclassopedia should put you right to sleep.
02:26arrdemI should patch irssinotifier... I get a push notification to my phone whenever you ping me. It's mildly entertaining to hear the latency change over the course of a day.
02:28bitemyapparrdem: memory leak?
02:29arrdembitemyapp: no I think it's something in google's push service. right now I'm seeing sub-second, but I've seen it go as high as four or ten minutes.
02:35bitemyapparrdem: the mistake is in relying on Google to do anything
02:36arrdembitemyapp: well there's that
02:39arrdemclojurebot: ping
02:39clojurebotPONG!
03:52tufflaxbitemyapp: I don't know what that is
03:55bitemyapptufflax: how do you load Java code in Clojure?
03:56bitemyapptufflax: however you accomplish that, do it.
03:56bitemyapptufflax: change the code, then do it again.
03:56bitemyappgg gl hf wp fo
03:56tufflaximport? i tried just that, did not seem to work
03:57bitemyapptried what?
03:58tufflaxusing import
03:58bitemyapptried what though?
03:59tufflaxImporting my class, using it. Then lein javac to recompile, importing again, tried new feature of class, did not work
04:00bitemyapplein javac has nothing to do with it
04:00tufflaxOk, can you elaborate please?
04:01bitemyapptufflax: https://groups.google.com/forum/#!topic/clojure/dt1PTIJsiRY
04:09tufflaxbitemyapp: I don't use those IDEs so that did not help me much
04:19ucbbitemyapp: http://www.youtube.com/watch?v=Ay7_5Qq5WCc
04:19rurumateI need to do some (left inner) joins in hadoop; it's too tedious with clojure-hadoop, so I will give cascalog a try. Is there an intro that goes beyond the in-memory hello world jobs and shows the configuration details to run jobs on a real hadoop cluster?
04:25nonubyhow does one ideally access arbitary config data in project.clj e.g. { :profiles { : dev { :my-name "nonuby" } } }
04:28clgvnonuby: the project code itself usually (without additional plugins or such) can only access project.clj via reading the file
04:28bitemyappucb: wat
04:29clgvnonuby: leiningen plugins are called with the project map as parameter
04:29ucbbitemyapp: heh
04:30nonubyso all the magic of compositing, merging https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md of profiles isn't available at runtime to me? maybe Im approaching this wrong, so if I want to get :redis-server-hostname (a different one for :dev and :production) I have a open the file, and parse it myself/
04:42bitemyappucb: http://i.imgur.com/1nIpODq.jpg
04:43bitemyapparrdem: http://i.imgur.com/1nIpODq.jpg
04:43ucbheh
04:43ucbmuch humour
04:43clgvnonuby: I am not sure whether there is a leiningen plugin that helps you with that.
04:44clgvnonuby: usually you'd have (Clojure) config files or environment variables to configure your application
04:45nonubyfalling back to environment variables
04:46clgvbut you could deploy with leiningen and let it inject the config from project.clj into your application (via a leiningen plugin).
05:33G0SUBmemes on #clojure. hmm.
05:37deadghostcan anyone point me to how file organization works?
06:10clgvdeadghost: sourcefiles?
06:12deadghostclgv, yes
06:12deadghostright now I just want to split a file into two
06:14deadghostnot sure if I need to tell project.clj what files depend on what
06:14deadghostor if and what I need to cram into files
06:15deadghostalso a little confused by default file structure
06:15deadghostproject-name/src/project-name/project-name
06:16clgvdeadghost: ah ok. no you do not need to tell project.clj about the single namespace files
06:18clgvdeadghost: say you want to use functions from src/bla/blubb.clj in another namespace then you just used (:require [bla.blubb :as bb]) in the other namespace and can acces all functions, e.g. (bb/my-fun 42)
06:19deadghostI take it :use is bad practice
06:20clgvdeadghost: in source files, yes. on repl it's just more convenient in some cases ;)
06:20clgvdeadghost: http://clojure-doc.org/articles/language/namespaces.html
06:22deadghostalright more straight-forward than expected
06:22deadghostthough default lein project structure leaves me confused
06:22clgvdeadghost: what's confusing?
06:23deadghostdefault is project-name/src/project-name
06:24deadghostwhat goes into src/project-name
06:24deadghostand what deserves its own folder
06:24deadghostor just free-floating files in src/
06:27deadghostoh I'm not sure, but is src/project-name just for namespace?
06:28deadghostso it's :require [project-name.core]
06:28deadghostinstead of :require [core]
06:30vijaykirandeadghost: if you have src/core.clj -> your namespace will be core and you can :require [core] in other projects/namespaces
06:31vijaykirandeadghost: but it is not recommended to use the "default" one - so the practice is src/project/core.clj => (ns project.core) => (require [project.core]
06:32clgvtop level namespaces are directly under "src/". hierarchic namespaces e.g. "my.project.core" is placed in "src/my/project/core.clj"
06:34deadghostdo most projects typically have everything under src/project-name?
06:34deadghostwhat are reasons to create a new folder in src/
06:36clgvdeadghost: hierarchic (I guess not too deep) namespaces are important to avoid collisions when using different libraries in the same project
06:37vijaykirandeadghost: if you create src/core.clj and another project uses same approach src/core.clj - then using them together will cause conflicts
06:38deadghostvijaykiran, I got that so for that reason is it typical for all project files to stay in src/project-name/?
06:38deadghostand not have src/something-else/?
06:39vijaykirandeadghost: well, src/project-name is more intutive. If your project is "amazing-lib" I'd assume that *most* of the stuff is under src/amazing-lib than src/zing-bang
06:40Apage43agh
06:40Apage43programming in C++
06:40Apage43all i want is a random number and I'm going on a yak shaving safari
06:40clgvdeadghost: yeah. the name of the lib is usually the prefix of all namespaces
06:41clgvApage43: lol. there are at least two choices for that
06:41clojurebotHuh?
06:41deadghosthmm ok I think that answered everything
06:42Apage43caveat: 64-bits long, and actually uniformly distributed in that space
06:43clgvApage43: C++11?
06:44Apage43nope :/
06:44Apage43trying to get there but I still think we support some platforms that make it problematic
06:47deadghostI take it once you go lisp you don't (want) to go back
06:47deadghostwell I screwed that sentence up
06:49deadghostI was looking over a friend's go code and pointed out a block of code that can be simplified with a map function
06:49deadghostand he told me he doesn't think go has a map function
06:49deadghostand I just got confused
06:49Apage43go doesn't have much abstraction power
06:50Apage43stuff I touch at work is C(++), Erlang, and Go
06:51Apage43each of which is fantastically frustrating in its own way
06:51amalloydeadghost: well, to be fair lisp is hardly the only language with map
06:51Apage43the C++ stuff would be less so if we could use C++11
06:51Apage43also yeah, map is most everywhere
06:52vijaykiranApage43: I've been looking into Erlang a bit - what's the main PITA in it ?
06:53Apage43similarly to go, very little capability to do abstraction
06:54deadghostpeople are using go for production stuff?
06:54vijaykirandeadghost: yup - at least google is :)
06:54Apage43and very little richness of data structures. The built-ins are tuples and lists, and the stdlib builds stuff out of them, but to manipulate any of those you have to use the functions that operate on them (or peek at their guts, since, they're all built out of tuples and lists)
06:55deadghostI've been wanting to learn erlang
06:55deadghostthen again I want to learn lots of stuff
06:56Apage43it's good at what we use it for, which is kind of managing tasks and state in a cluster
06:56deadghostmy friends say I have a thing for esoteric languages
06:56deadghostbut they like their python and javascript
06:56deadghostso lisp counts as esoteric
06:56Apage43but for actually mucking about with lots of data it's kind of awkward
06:57deadghostprolog and smalltalk are also on my todo list
06:57deadghostwill hit prolog when I get around to reading PAIP
06:58vijaykiranApage43: hmm - I was mostly interested in process modeling - but I'm sure that data-processing is much better done with clojure
06:58vijaykiranApage43: did you try Elixir ?
06:59deadghostalso that's why I was surprised
06:59deadghostmap is everywhere
06:59deadghostso I assumed a new language like go would have it
06:59Apage43vijaykiran: I have looked at it. It helps some of the awkwardness of the language (the prolog-ish syntax is a bit of a hangups for some folks, and the single-assignment thing probably throws off even *more* of them, though I actually prefer it)
07:00Apage43mostly though it's a much nicer shell around the same guts
07:00Apage43more of a coffeescript :: javascript rather than a clojure :: java
07:00vijaykiranApage43: indeed.
07:02Apage43actually last time I had to debug an erlang issue I wrote tooling to do it in Clojure with the erlang Java interface library >>
07:03vijaykiran:) sounds like a real multi-VM shop - with Go/Beam and JVM
07:03Apage43we don't ship any JVM code
07:04deadghostwhen do you get the chance to use clojure
07:04deadghostor do you just sneak it in sometimes
07:04Apage43but when *I* build something that doesn't actually go in the product (and therefore can be anything) it winds up being in Clojure
07:04deadghostI see
07:04Apage43usually that's stuff like internal tools
07:05vijaykirandeadghost: usually it starts as a small tool, library
07:05vijaykirandeadghost: but I worked on two pure clojure projects so far
07:05deadghostclojure has been the best programming experience so far
07:06Apage43yeah, for me it tends to be the quickest path from idea to working thing
07:06deadghostI gave CL a try and might marginally prefer it as a language
07:06deadghostbut experience was poor
07:07Apage43if I'm not using it its because of some external constraint (like the end program has to be run somewhere without a jvm or interface with some C library)
07:07Apage43or that it's a small command line tool and jvm startup time :/
07:08hyPiRionit's a pain, eh
07:10deadghostApage43, what do you use for command line tools then
07:11Apage43python
07:12Apage43which is itself really awkward because I always write it with argparse first and then have to fix it to use optparse because it needs to run on old python versions >>
07:15sveriHi, i am currently having fun with c2: http://pastebin.com/2pH7C6BM now i wonder how i would parameterize such a function, with data coming from the frontend via js for instance, so, i am having trouble understanding how to integrate this into a webapp
07:22sm0kein core.logic, why does forms after conde has to be double paranthesized? like (conde ((== q 1)))
07:24CookedGryphonsm0ke: because conde is an or type operation, and things inside that inner expression are an and type expression
07:25CookedGryphonsm0ke: for example (conde ((== q 1) (== x q)) ((== x 4)))
07:25sm0keah! is and implicit?
07:26CookedGryphonmeans unify q with one and then x with q to succeed, or alternatively just unify x with 4 to succeed, yeah and is implicit
07:26sm0keok thanks
07:31xificurCanyone using smartparens instead of paredit?
07:52sm0kei wonder why pypy didnt catch up like clr or jvm for clojure
07:53sm0keheck even the clojure-py project is dead
07:54sm0keisnt python an awesome platform too?
08:01clgvsm0ke: clojure-py is dead?
08:04clgvsm0ke: hm ok, from the github page and the last dev ML entry, one could say so.
08:14aesavAny recommendations for an opensource clojure webapp that I can learn from? Something with a nice REST api is a plus...
08:24sveriHi, i am currently having fun with c2: http://pastebin.com/2pH7C6BM now i wonder how i would parameterize such a function, with data coming from the frontend via js for instance, so, i am having trouble understanding how to integrate this into a webapp
08:45luxbockwhat is the benefit of having a :inline function definition in the function metadata?
08:45luxbockI tried to Google about what it is used for but I don't quite grasp the whole thing
08:46gfredericksluxbock: it basically treats it like a macro when possible
08:46gfredericks...for inlining
08:47luxbockare they used for speed optimization or what is the benefit?
08:47Cr8e.g. if you actually use it somewhere (myfun stuff) it'll get expanded at compile time, but you can *also* use it as a function (map myfun [list of stuff])
08:47Cr8luxbock: usually for speed yeah
08:48luxbockalright, thanks
08:49gfredericksspeed is the only reason I know of
08:49Cr8yeah, probably shouldn't have said usually there
08:49saolsenAnybody have some experience finding memory leaks in clojurescript code? I wrote this in what I feel is pretty idiomatic clojure but the memory useage just keeps going up and up the longer it runs. http://cljsfiddle.net/fiddle/saolsen.particles-simulate
08:49gfrederickstry (with-redefs [+ *] (+ 2 3)) versus (with-redefs [+ *] (apply + [2 3]))
08:49gfredericksshows how confusing inlining can make things
08:50luxbockheh
08:50Cr8and it doesn't show up in call stacks if it throws an exception from inside
08:50gfredericksah that too
08:51luxbocksounds like I should stay far away from them
08:51Cr8one of those things that isn't worth bothering with until you're really trying to squeeze performance out of something
08:52luxbockI ran into them while browsing core.matrix source code
08:53gfredericksyeah that sounds plausible
08:53Cr8in that case core.matrix is bothering with that so you don't have to :). But yeah, core.matrix is one of those places where it actually is quite useful
08:54Cr8internally
08:54Cr8for stuff like avoiding boxing
08:55gfredericksand you get to skip the var indirection
08:56gfredericksbasically it's macros + flexibility and the associated confusion
09:19danenaniaquestion for y'all: in general is it better style to use a closure or a partial? (defn f [arg1 arg2] ...) (map (partial f 10) c) --or-- (defn f [arg1] (fn [arg2] ..)) (map (f 10) c)
09:21philandstuffor (map #(f 10 %) c)
09:21philandstuffin general I'd prefer (defn f [arg1 arg2] ...) but it all depends on context
09:22clgvdanenania: not really answerable in general
09:22gfredericks$google github currj
09:22lazybot[fredericksgary/currj · GitHub] https://github.com/fredericksgary/currj
09:23gfredericks^ do both! :)
09:24clgvdanenania: if the partial statement gets too complicated use the closure
09:24danenaniaok, i've been using the partial method as a default as it seems possibly a bit more obvious
09:25danenaniathat makes sense
09:49logic_proganyone have a good tutorial on implementing append-only log file in clojure?
09:54luxbockstill browsing through core.matrix source... what is the difference between using `double` and `.doubleValue`?
09:55gfredericks,(double 3)
09:55clojurebot3.0
09:55gfredericks,(double 3N)
09:55clojurebot3.0
09:56gfrederickslooks like double does exactly that, via RT
09:57luxbockI'm just confused because of this: https://gist.github.com/7873465
09:57luxbockif they do pretty much the same thing, then why are we using one for m when it's a number, but then .doubleValue for exponent
10:04eLobatois it a good practice to do 'clojure.string :as str' since (str) is already a function defined in clojure?
10:04eLobatoi get Exception in thread "main" java.lang.IllegalArgumentException: Parameter declaration str should be a vector
10:05gfrederickseLobato: it shoudl work fine
10:05eLobatowhen running the tests of this project, likely because of that https://github.com/Raynes/tentacles/blob/master/src/tentacles/core.clj
10:05gfrederickseLobato: you're running `lein test` on a clone of that project?
10:05eLobatogfredericks: exactly
10:06clgveLobato: it should work fine since it is only an alias for a namespace and not var
10:06gfrederickseLobato: tests pass fine for me
10:06chouseranyone know of any reason that a core.logic pldb would have any problem being run through fressian? It seems to write out ok, but running queries on the db once it's been read back in always returns empty results.
10:06eLobatogfredericks: clojure 1.4.0?
10:07clgveLobato: namespaces are not resolve from symbols directly. for that you need (the-ns 'clojure.core)
10:07gfrederickseLobato: leiningen should bring in the correct version of clojure; 1.5.1 in this case
10:08eLobatogfredericks: how odd..
10:09amalloyeLobato: "Parameter declaration str should be a vector" is what the compiler says when you write a function like (defn foo (str x y))
10:10amalloyusually because you forgot the arglist
10:10gfredericks,(fn a b c)
10:10clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Parameter declaration b should be a vector>
10:28sveriHi, i am currently having fun with c2: http://pastebin.com/2pH7C6BM now i wonder how i would parameterize such a function, with data coming from the frontend via js for instance, so, i am having trouble understanding how to integrate this into a webapp
10:46jtoywhy do protocols not provide a default interface? what is bad about that?
10:46gfredericksdoes Object not do what you want?
10:47jtoyi dont havee Object, that is a java thing? I am writing pure clojure
10:47gfredericksyou can (extend-type Object MyProtocol ...) and it should act as a default impl
10:47justin_smithjtoy: the example I showed you yesterday had that in there, just commented out
10:48justin_smithgfredericks: the problem is if you define any method of the protocol on another type, you need to implement all of them
10:48jtoyjustin_smith: yeah, Im testing them now
10:48justin_smithso the defaults are all or nothing
10:48gfredericksjustin_smith: good point
10:49justin_smithjtoy: this is why I had that "default-impl" map to merge the new impls into
10:50justin_smithbasically a minimal hand-rolling of the one piece of inheritence logic I actually wanted
10:52gfredericksoh man java is awesome. if you have a map and you get its entrySet and remove something from that set it gets removed from the map too
10:52gfredericksby design
10:52gfredericksthat's in the Map interface, not some random implementation
10:53gfredericksI'm just spoiled
10:55jtoyjustin_smith: can protocols still be used if my code is currently stup like this: https://www.refheap.com/21621 I've read those links you sent and I'm not sure I can use them giventhe way I structured my code
10:56jtoybecause of the macro I have
10:59dabdI am going to work with matrices with 1 million entries. Anyone knows which is better vectorz-clj or clatrix?
10:59jtoythe layout is the piece I want to change, but I want my new layout I use to also change the layout used in the library
10:59justin_smithjtoy: separate the definition into a var from the elaboration of what it does
10:59justin_smiththe latter can be a protocol
11:00justin_smithdabd: have you considered hip-hip?
11:01justin_smithhttps://github.com/prismatic/hiphip
11:01dabdjustin_smith: i didn't. Is it faster than vectorz-clj?
11:02dabdhmm should be quite fast since the prismatic guys are using a lot of machine learning
11:02eagleflodabd: did you try core.matrix?
11:02justin_smithdon't know, it is just the one I have heard of. It is the one recommended in the "high performance clojure programming" book.
11:02clgvdabd: afaik it is just a set of tools for java arrays, probably you expect more from a "matrix library"
11:02dabdcore.matrix is the backbone of vectorz-clj
11:02eaglefloIt wraps vectorz among others afaik
11:02jtoyjustin_smith: I dont follow, is it possible to show me a very simple example?
11:02eaglefloAh, right.
11:03clgvdabd: hiphip I mean ;)
11:03eaglefloI thought it was the other way around.
11:03coventrydnolen: Your nyt project comes up blank for me with ghostery on.
11:06clgvdabd: core.matrix readme says that both vectorz-clj and Clatrix are implementation and thus you can easily switch between them. so you can just implement on top of core.matrix and then benchmark which one of the two gives you the best performance
11:10justin_smithand then hiphip if you need mutability I guess
11:10justin_smith(though that is not likely)
11:14jtoycan I store source code in a resource file?
11:15gfredericksI don't think the jvm/clojure knows the difference between src and resources, if they're both on the classpath
11:16coventryYou certainly can, but it's hard to find a good use for it.
11:16wedryou don't want it
11:16jtoyim not sure how to fix my crappy code
11:16wedrdo it uncrappy
11:16clojurebotNo entiendo
11:17coventryWhat problem are you trying to solve by using a resource file?
11:17jtoyi think i can do it with the resources folder and have my code look for a file there, ifthere, use that definition, and if its not there, then use the default definition for a function
11:18coventryWhat problem does that solve?
11:19jtoyi can have a library and then in my userland code i can overwrite a couple of functions
11:20jtoycan I have a library that expects code in the userland project? it seems like i cant
11:20jtoyso i want to try with resources
11:21CookedGryphonjtoy, 2 things - you can redefine functions within libraries without the need for resources folder, but secondly it sounds like what you actually want to do is pass a function into your library rather than redefine some pre-arranged function
11:22CookedGryphonor some sort of protocol/multimethod which you expect the userland code to extend for their usecase
11:22CookedGryphonbut we'd need to know the usecase to advise on that
11:23CookedGryphonoh, sorry, I wasn't paying attention, didn't see that you already told us the use case
11:24justin_smithsounds like a clear case for using a protocol and passing in something implementing the protocol to me
11:24jtoyCookedGryphon: how can i redefine? here is a clearer example: https://www.refheap.com/21621
11:25jtoyi want both the methods home-page and page-that-uses-non-default-layout to use the layout i have defined in userland code
11:25justin_smithjtoy: why not add a layout argument to defpage?
11:25justin_smiththat seems simplest actually
11:25justin_smithit's just one function
11:25justin_smith(defmacro defpage [name layout & body] ...)
11:25nkozowhy (chunked-seq? (range 16)) is false but if you do (take 2 (map println (range 16))) the sequence is treated in a chunked fashion?
11:25jtoyjustin_smith: I could do that, i just didnt want to pass layout a million times, and i dont think that would solve the problem of the functions in the library that already rely on layout
11:26justin_smithOK, in that case define a protocol with layout as one method
11:26justin_smithso you still call layout, and you pass in an object that implements layout
11:26justin_smithprobably a record made with defrecord
11:27justin_smithregardless, the defpage needs some argument that decides the behavior
11:27justin_smithalso separate the definition part of defpage from the part that does the functionality
11:28justin_smithpulling most of defpage out of defpage into a helper function will make everything much easier
11:28coventrynkozo: Have a look at the source code for chunked-seq? and range. range returns a lazy seq. chunked-seq just checks whether the object returned is an instance of IChunkedSeq.
11:28coventry$source chunked-seq?
11:28jtoyjustin_smith: i will always override the layout function though, and the other pages in the library already expect a layout,
11:28lazybotchunked-seq? is http://is.gd/Iytq3A
11:28coventrysource range
11:28coventry$source range
11:28jtoyand they must use that new layout
11:28lazybotrange is http://is.gd/DZSIhK
11:29justin_smithjtoy: then, like I said, pass in something implementing layout. And make that object part of the stored page object so they can call its method
11:29coventrynkozo: the <type>? predicates in clojure.core are generally pretty misleading.
11:29justin_smithyet another argument for separating the definition from the data ops
11:30jtoyjustin_smith: I am goig to do what you said, im just not sure how to do that
11:30nkozocoventry: I'm seeing the seq1 function for dechunking sequences (from Joy of Clojure), it seems to work by wrapping a sequence in another not implementing IChunkedSeq. I don't understand why it works, given that range doesnt return an IChunkedSeq but is used in a chunked fashion
11:30clgvcoventry: huh why? it is indeed a consistency error with range that chunked-seq? returns false
11:30justin_smithjtoy: one second, I will try to stub it out in your paste
11:31clgv,(chunked-seq? (rest (range)))
11:31clojurebottrue
11:32clgvit is just the first `lazy-seq` which prevents `chunked-seq?` to return true on the result of range
11:32sveriHi, i am currently having fun with c2: http://pastebin.com/2pH7C6BM now i wonder how i would parameterize such a function, with data coming from the frontend via js for instance, so, i am having trouble understanding how to integrate this into a webapp
11:33clgvsveri: I guess pasting the same message regularly wont help that much. maybe you should specify your problem more precisely ;)
11:33svericlgv: sorry, i dont want to spam, just trying to catch the guys that are new in the IRC channel
11:35clgvsveri: I guess some of the people present here maybe could answer your question if they knew what you want to do precisely...
11:36svericlgv: you are right, i am still trying to figure out myself what i want to do exactly, i come back with a better question later, hopefully when the dark clouds disappear
11:36justin_smithjtoy: in your code is body meant to be a macro body, or the body of the html?
11:36justin_smithsame word, very different meanings
11:37justin_smithis the body of the macro something that finally returns the body of the html?
11:51justin_smithjtoy: https://www.refheap.com/21624 did it as an exercise. Not perfect, may not even run as is, but it is a step forward and shows the overal design
11:53ucbwhat's the naming convention for constants? Uppercase like C? or?
11:53justin_smithjtoy: found a bug in how I was calling extend, updated
11:53justin_smithucb: constants are only possible for numbers, you know that right? I don't think there is any convention
11:54ucbjustin_smith: I need them for numbers :)
11:54ucbjustin_smith: I didn't know that though.
11:55amalloyjustin_smith: huh? immutable values are basically all constants? like...(def empty-list ()), (def directions #{:left :right})...
11:55CookedGryphonucb, almost everything is constant and immutable in clojure so there's no special notation ;)
11:55indigojustin_smith: A struct, not a record?
11:56ucbamalloy, justin_smith, CookedGryphon: my question was more aimed at assigning names to magic numbers :)
11:56bbloomhttp://www.youtube.com/watch?v=TS1lpKBMkgg <- former biggest contributor to scalac -- talk is basically just this guy freaking out. it's entertaining and cringeworthy at once
11:57tim_epic intro music!
11:57justin_smithindigo: that is probably an error
11:57justin_smithI think I meant a record
11:58justin_smithamalloy: constant as in fully embedded in the bytecode, not a lookup at runtime
11:59justin_smithamalloy as in what ^:const does
12:01justin_smithwhich it can only do for numbers
12:04justin_smithindigo: thanks for pointing that out, I fixed that paste
12:05indigojustin_smith: No prob... I think this is the first time I heard of defstruct :P
12:07justin_smithprobably some cross-talk between my clojure code and some other language I don't use anymore :)
12:09justin_smithjtoy: the problem that remains (even in the version using protocols that I pasted) is that the implementing structure is hidden in the defpage/do-page, and not something carried by the page definition. It could be you want a "render" method and have defpage just definite the record instance
12:10justin_smithit could be a render function that gets the record as an argument, or it could be a render method on the protocol, depending on how much flexibility you need on that side
12:13coventrybbloom: Wow, that is some sustained industrial-grade self deprecation.
12:13bbloomcoventry: seriously.
12:16justin_smithis this like a sibling-rivalry thing we have with scala?
12:18bbloomjustin_smith: *shrug* i don't wanna be all us vs them or anything, but it's just interesting to see how they've had some high profile burnouts, converts, etc
12:18bbloomi'm more interested in what's causing it & what to do about it if anything
12:19bbloomit's interesting to see him complain about sacraficing type-correctness to play nice with the JVM host in one breath, then in the next breath suggest we need more independent "machines" processing ASTs of data
12:19bbloomthose are like to antithetical ideas
12:20bblooms/to/two
12:21justin_smithwhen he talks about modifiability, I think he is talking about what I call brittleness
12:22justin_smith*unmodifiability
12:22indigoAh, Scala...
12:22indigoThe worst case of C++ syndrome ;P
12:22coventryI didn't follow the slide on universal equality at all. What is it, and why is it painful?
12:23bbloomcoventry: so universal equality is basically Object.equals
12:23bbloomcoventry: in haskell, you can't compare something of type A to something of type B and that's enforced statically at compile time
12:24bbloomif you want to compare two different types, you need to convert between one or the other
12:24danielszmulewiczClasspath problems when deploying. Why oh why is deploying such a pain (venting).
12:24bbloomexcept numbers, which have some magic coercion hackery in the spec that has since been turned in to slightly more real thing you can rely on
12:25bbloomuniversal equality works (relatively) great for us in clojure b/c we have so few data types
12:25deadghosthttp://pastebin.com/kUZ7UqKk
12:25tuddmananyone have experience with classpath finding files one time; not another ... not sure if a LightTable issue...
12:25deadghostI don't even know where to begin debugging this
12:25danielszmulewiczoh, seems I'm not alone with classpath woes
12:25bbloomcoventry: worth reading about EGAL: http://www.pipeline.com/~hbaker1/ObjectIdentity.html
12:25tuddmanjava.io.FileNotFoundException: Could not locate ...
12:26coventrybbloom: Thanks. Will take a look.
12:26indigodeadghost: You should probably start by deleting the paste and creating a new one with an anonymized address :P
12:26deadghostthat's just a random address
12:27tuddman@daniel: I can have a look..
12:27danielszmulewicztuddman: thanks, I'll explain, it's kinda simple.
12:27indigodeadghost: Also you have :postal_code and :postal-code
12:27danielszmulewiczI have resource-paths in my project.clj
12:27danielszmulewiczIn my code I do a slurp on a resource
12:28danielszmulewiczWorks locally, no problem
12:28tuddmanrepo link?
12:28deadghostindigo, that's deliberate
12:28danielszmulewiczBut when doing an uberjar, it won't work
12:28deadghostsql doesn't like hypens
12:28justin_smithdanielszmulewicz: are you using io/resource to access the resource to slurp?
12:28danielszmulewiczyes
12:28deadghostso the lib converts to underscore
12:28justin_smithif not you should
12:28danielszmulewiczI do
12:28coventrybbloom: Thanks, I get it now.
12:28danielszmulewiczit *should work* in a jar
12:29bbloomcoventry: you read that whole page that fast? :-P
12:29danielszmulewiczand yet it doesn't
12:29deadghostactually not even relevant, just I'm just getting the value
12:29coventrybbloom: No, I replayed his discussion of that slide. :-)
12:29justin_smithdanielis the resource not found, or is it shadowed?
12:29danielszmulewiczI don't know. I get No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil
12:29justin_smithio/resource returns nil when it doesn't find the resource asked for
12:30justin_smithlikely
12:30danielszmulewiczjustin_smith: exactly.
12:30dabdis anyone using unicode chars in their clj source? I was watching this presentation about core.matrix http://www.slideshare.net/mikeranderson/2013-1114-enter-thematrix
12:30r4vianyone know a good algorithm for serializing web application state in the url/querystring
12:30r4vii don't need security
12:30`cbpdamn it lambdatheultimate why are you down!
12:30dabdHe uses tau in the code on slide 33
12:30r4vii could urlencode json but I'd prefer something more compatct
12:30danielszmulewiczjustin_smith: the :resource-paths gets merged when I do a lein with-profile production, right?
12:31indigodeadghost: Weird...
12:31indigoAlso are you sure Korma works with (insert "tableinquotes"
12:31r4viso like if my app state was {:name "foo", :clicked-widget-times 30}
12:31indigoDon't you have to (defentity) first
12:31danielszmulewiczBecause that might be the problem...
12:31justin_smithdanielszmulewicz: yeah
12:31justin_smithmaybe try unzipping the uberjar, seeing what is where?
12:31r4vii want to put that in foo.com/{:name "foo" ...
12:32danielszmulewiczjustin_smith: yeah, I'll do that
12:32deadghostindigo, seems to work fine for my other insert
12:32justin_smithalso you can run it locally with java -jar (or run it in tomcat locally), start a repl inside the server process, and do some more invasive runtime investigation
12:32indigoHmm
12:35danielszmulewiczjustin_smith: Excellent idea. Thanks a bunch.
12:35jtoyjustin_smith: i was away, thanks for that reference implementation, i will study it and try to use it
12:37justin_smithjtoy: np, I am finally learning how to use these corners of the language, so it was a good exercise for me
12:38justin_smithI typically stick to let / fn / etc. and avoid the OO stuff, but this could be a place where the OO stuff simplifies things
12:39tuddmanhow does one investigate where / how dependencies are loaded? (classpath not found error..)
12:40tuddmanran 'lein clean' then 'lein deps' says they're loaded...
12:41tuddmanyet: java.io.FileNotFoundException: Could not locate clj_dde/core__init.class or clj_dde/core.clj on classpath:
12:41gfredericksbbloom: what is his complaint in the Int.maxValue slide?
12:42bbloomgfredericks: i forget, what's the timestamp?
12:42gfredericksabout 23:30
12:42gfredericksseems a generic classic floating point limitation
12:42justin_smithtuddman: try lein classpath
12:43tbaldridgegfredericks: it's the implicit conversion. It produces wrong code, but never complains. At least C++ says "implicit cast to float, possible loss of precision"
12:43justin_smithif clj-dde is in that, you can check in that jar to see if there is a clj-dde.core ns
12:44bbloomgfredericks: the complaint is this:
12:44bbloom,(= (float (- Long/MAX_VALUE Integer/MAX_VALUE)) (float Long/MAX_VALUE))
12:44clojurebottrue
12:44gfrederickstbaldridge: I guess that makes sense; it didn't seem so implicit since he had to write Float on each line, but I suppose so
12:44gfredericksbbloom: yeah, which is just how floating point precision works
12:45bbloomgfredericks: sure, but if you're a typed language guy, you want an error msg
12:45tbaldridgegfredericks: the issue is that (float)(large_num - large_num) == (float)(large_num - small_num)
12:45coventryIs there any language which gets this right by his standard?
12:45bbloomtbaldridge: at the end of the talk, he proceeds to say he's building a VM within the VM :-P
12:45gfrederickscoventry: any language that warns I guess
12:45justin_smithbasically we wants to not use floats?
12:46bbloomfloats are almost never what you want anyway :-P
12:46tbaldridgejustin_smith: even that doesn't matter, doubles have the same sort of issues.
12:46technomancycoventry: racket's "beginner" dialects read 0.1 as a precise decimal IIRC
12:46technomancytoo bad the main #lang racket doesn't do the same
12:46tbaldridgejustin_smith: http://stackoverflow.com/questions/316727/is-a-double-really-unsuitable-for-money
12:46technomancyno one wants to make the decision that's going to make the language get trounced when microbenchmarked by people who don't know what they're doing
12:46gfrederickstechnomancy: are you trying to explain floats to your kindergartner?
12:47technomancy(which is the vast majority of microbenchmarkers)
12:47justin_smithtbaldridge: I was using "float" in the generic sense
12:47bbloomtechnomancy: fuck the benchmarkers
12:47technomancygfredericks: that's why I'm choosing racket, dude!
12:47justin_smithas in floating point
12:47technomancybbloom: preaching to the choir =)
12:47tuddmanclj-dde is in classpath..
12:47justin_smithtbaldridge: just saying the problems are implicit in the definition of floating point
12:47justin_smith*standard ieee floating point as usually implemented
12:47bbloomtechnomancy: floats are good for pretty much one thing: errors relative to the observer
12:48tbaldridgejustin_smith: I agree there.
12:48bbloomie display code: percentages show in the UI, distances relative to a 3d avatar, etc
12:48bbloomyou stick your origin at 0.0f and do all your actual math with useful number types :-)
12:48bbloomthen you through a bunch of floats at a GPU
12:48tbaldridgebbloom: representing color as well
12:49goraciwho familiar with datomic here ?
12:49gfredericksfloats are great for implementing JS :P
12:49bbloomweee
12:49nDuffgoraci: there's a separate #datomic channel
12:49bbloomoh, 1 other use case for floats: probablistic systems
12:49goraciit's almost dead no answers
12:49tbaldridgegoraci: but many here (myself included) are familiar with datomic
12:49bbloom"eh, it's kinda wrong, but it's kinda wrong by design. so fuck it!"
12:50tbaldridgegoraci: I've been on #datomic all morning, and haven't seen any of your questions?
12:50justin_smithbbloom: or in domains where the measurements are lossy anyway, where implying more precision than you have can actually lead to errors, the data type truncation of a double is not much of a hinderance
12:50coventryIn the "generality is not OK" slide around 28 min, he seems to be saying that in-place mutation is conceptually incompatible with high-level typing semantics. I don't really understand that.
12:50goracitbaldridge: i asked yesterday .... maybe make something like schedule for talks there
12:51tbaldridgegoraci: yesterday was Sunday, most people probably weren't on the channel. There's normally quite a few people from Cognitect on that channel during working hours.
12:52goracitbaldridge: i asked this - is there something like update in datomic )? we store facts usually, so update is the new fact it appears
12:52tbaldridgegoraci: ask the question on #datomic, and I'll answer it there :-)
12:52goracitbaldridge: so i guess there is no such a thing like update in usual case
12:52bbloomjustin_smith: but there are better things there
12:52goracitbaldridge: ok
12:52bbloomjustin_smith: you can/should thread a pair of value & error along
12:53justin_smithsure, but just saying that is not incompatible with doubles
12:54alsodoes lein-cljsbuild do anything weird with dependencies?
12:54alsoi get the wrong version of tools.reader on my classpath, but it doesn't show up in `lein classpath`
12:55tuddmanjustin_smith: use tools.namespace to explore what's in jar ... or is there some other way
12:55justin_smithtuddman: unzip the jar, it is a zip file
12:55alsotuddman: jar tf <jar filename>
12:56justin_smithor that
12:56justin_smithand see if there is a file for that namespace in there
12:56justin_smithlein classpath will show you the jar location
13:02alsoare there any cases where a transitive dependency won't show up in `lein deps :tree`?
13:03technomancyalso: if a plugin merges dependencies in inside the plugin function itself, it's totally opaque and can lead to really nasty situations like this
13:05tuddmanjustin_smith & also: thanks. yep. core.clj is definitely there...
13:06alsotechnomancy: that's what i'm assuming. strangely, adding `:exclusions [[org.clojure/tools.reader]]` to `[ring/ring-core "1.2.1"]` seems to fix it, even though it isn't a dependency
13:07technomancyalso: aha; it's a lein-cljsbuild bug: https://github.com/emezeske/lein-cljsbuild/issues/268
13:09tuddmandamn thing was working earlier. not sure which -probably- asinine change broke it.
13:10justin_smithif there is an error in the code, the namespace won't be successfully defined I don't hink
13:10justin_smiththat's a long shot I guess
13:11alsotechnomancy: oh, thanks
13:13logic_progis there a way to tell edn/read-string to also record white space? i.e. I want (+ a\n b) to be (list (symbol +) (space 1) (symbol a) (space \n) (symbol b)) ?
13:13alsotechnomancy: changing the order of the dependencies could cause a version that isn't shown in `lein deps :tree` to show up?
13:13tuddmanjustin_smith: probably ;-( ' looks' fine, though.
13:14coventrylogic_prog: ztellman's sleight tries to bolt newline tracking on top of the regular reader. https://github.com/ztellman/sleight/blob/master/src/sleight/reader.clj#L92
13:15logic_progcoventry: whoa, someone else also ran into this problem? yay!
13:15Cr8logic_prog: oh
13:15Cr8you could also pull the trick that source-fn pulls
13:15Cr8.. actually that's not what you want, nvm
13:15coventrylogic_prog: It's a slightly different problem, but there may be some useful ideas there.
13:16tuddmanjustin_smith: its just a simple wrapper to get/push 'real-time' updates from/into excel (& various finance apps)
13:17Cr8logic_prog: https://github.com/xsc/rewrite-clj
13:17Cr8see that also
13:17tuddmanhttps://github.com/tuddman/clj-dde/blob/master/src/clojure/core.clj
13:17logic_progcoventry: actually, I don't understand how sleight works
13:17Bronsalogic_prog: no, but if you need to preserve the original source, tools.reader >= 0.8.0 has a source-logging reader
13:18tuddmanworks if you load the java files directly... not so much if you abstract it into a dependency
13:19logic_progCr8: rewrite-clj is exactly what I want, however, looking at it, this whole thing is more cmplicated than I had in mind
13:19coventrylogic_prog: It reads the original code in, transforms the resulting structure as specified by whatever is calling it, then tries to readably print out the transformed structure for re-reading.
13:21justin_smith tuddman: I think if it is in src/clojure/core the tool would expect you to look for it as core or maybe clojure.core
13:21justin_smithtry adding a clj-dde directory
13:22justin_smithso the filesystem matches the naming
13:22justin_smithwhen you require, it looks for the clj file based on the directory structure that should match the ns structure
13:29justin_smithtuddman: ok, since the source-path in your project.clj is "src/clojure" you should make a clj-dde directory and put core.clj in there
13:29justin_smithand then require will actually be able to find it
13:30justin_smithsadly (io/resource core.clj) is very likely to find something else that conflicts, given the ubiquity of that name
13:30dnolenCLJS enhancement regarding macros - it would be nice for libs to write inlining macros like CLJS does with needing to :require-macros :require
13:31dnolenany opinions about (:require [foo.bar :require-macros true]), or some such :require modifier?
13:34dnolenthis would load foo/bar.clj
13:34sritchieanyone here using clutch / couchdb in clojure?
13:34dnolenin addition to requiring foo/bar.cljs
13:34sritchieI was thinking of converting it to async, via core.async
13:34goracisritchie: start using datomic with couchdb )
13:35goracisritchie:started
13:35sritchieyeah? nice
13:35sritchieI didn't know that was a thing
13:36sritchiednolen: vague, library design question for you, sir
13:36dnolensritchie: what's up?
13:36goracisritchie: couchbase db is for a storage in this case
13:37sritchiednolen: I'm thinking of taking over cemerick's old clutch library for couchdb interaction, which is all synchronous, swapping in http-kit, and making it async via channels -
13:37sritchiednolen: since sync is a special case of async,
13:37sritchieone option is to just make async default, and have users deal with it (with blocking calls)
13:37sritchieor, add async as a new module and keep things separate
13:37sritchiein the scala world, user friendliness loses
13:38sritchiednolen: any opinions on whether the async overhead is meaningful / worth it for synchronous users, if the sync client is just async + blocking?
13:41hiredmanit doesn't seem like it would be worth the effort
13:42hiredmanthe jvm has fairly cheap threads, and good abstractions for threadpools, and core.async has the thread macro, so if you want to make your io async, you just drop it in a (thread ...)
13:43sritchiehiredman: vs actually using an async http client at the bottom?
13:43dnolensritchie: hrm, haven't used couch or clutch in a long time - not sure if I can formulate a strong opinion about how it should be done. but I think I kind of agree w/ hiredman.
13:43hiredmansritchie: to what end?
13:44sritchieto make it easier to fan out and sequence multiple db operations
13:44tuddmanjustin_smith: thanks a ton!! for your help... I blew out dir structure... added back in /src/clj_dde folder. removed :source line from project.clj (so now it defaults to looking for src/clj_dde/core.clj
13:44hiredmangenerally you use an "async" io based thing because you are already doing stuff async and you basically need to interoperate, have io that won't block the event loop
13:45sritchieyeah, exactly - I'm hitting S3 async,
13:45sritchieand then based on the response, updating couchdb, then returning other couchdb data
13:45sritchieso I do want to inject this into an async workflow
13:45hiredmansure, and for that use case, I think (thread ...) should serve you well
13:45tuddmancomes back to sssschtupid underscore vs. dash in ns names and directories it looks in.
13:47sritchiehiredman: so what's a case where the underlying library should be async?
13:47bitemyappsritchie: you know posco?
13:48sritchiehaha, yes
13:48sritchiewe built summingbird together
13:48bitemyappsritchie: cool guy, talked to him in #haskell.
13:48bitemyappReally nice people there.
13:48sritchieclojure and haskell have such a good vibe
13:50technomancytuddman: vote for http://dev.clojure.org/jira/browse/CLJ-1297
13:50hiredmansritchie: well sometimes you want to interleave two io operations together to minimize what you hold in memory (I am not sure if core.async is good for that), but in my mind it is typically about control
13:50technomancythere's no reason humans should ever waste time on that problem ever; it's borderline offensive
13:51hiredmansritchie: you have what is logically a single thread of control, but without core.async would end up being chopped up bits of logic
13:52bitemyappseangrove: are you looking for a shikibuton or something else?
13:52bitemyappseangrove: I sleep on one.
13:52bitemyappseangrove: if you're looking for something specifically korean, you want south bay.
13:53tuddmantechnomancy: done ;-)
13:53sritchiehiredman: so, if the underlying DB required a couple of concurrent lookups to satisfy some logical request;
13:53sritchieotherwise, no need to bake it in at the bottom
13:53seangrovebitemyapp: Yeah, a korean version of shikibuton. Willing to go to South Bay, but can't find a specific place. I still use mine from ~8 years ago, btu it's probably time to get a new set.
13:53tuddmanjustin_smith: thanks again!
13:54justin_smithnp
13:54seangrovebitemyapp: But maybe I should just go Japanese for the next decade...
13:54hiredmanwell, baking it in at the bottom is fine, it is sort of a cost/benefit analysis when looking at existing libraries, so maybe rewriting the couchdb thing would be cheap, in which case why not try it out
13:56sritchiehiredman: the place where it actually makes sense to start is the _changes feed
13:56sritchiethe feed of updates you get from couch
13:56sritchiehiredman: makes sense, though
13:59S3thc0nSorry, lost connection rigth after posting my message. :(
13:59S3thc0nIt currently returns all of the values; I#d be grateful for a little hint.
14:02dabdwhat is the @@ operator?
14:03hyPiRionjust (deref (deref ..))
14:04tbaldridgealso known as the "you probably shouldn't be doing this" operator.
14:05bbloomtbaldridge: c'mon now, double-indirections are fun!
14:05hyPiRionI think gfredericks actually had a valid use case for @@?
14:05gfredericksO_O
14:05tbaldridge,@@(atom (delay 42))
14:05clojurebot42
14:06hyPiRionmaybe it was TimMc
14:06gfredericks@_@
14:06S3thc0nAgain... Hope I have that fixed now. If anyone answered yet, I did not get the message, unfortunately.
14:07dabdI found it being used here https://github.com/ztellman/pushkin/blob/master/src/pushkin/tree.clj
14:07coventryS3thc0n: Don't think your original question came through at my end.
14:07dabdin the Node defrecord
14:08gfredericks,(-> 42 ((apply comp (repeat 10000 atom))) ((apply comp (repeat 10000 deref))))
14:08clojurebot42
14:09S3thc0ncoventry: I am stuck at the 4clojure problem #25 (filtering the odd numbers), and the code I tried is http://pastebin.com/GnGrR0b2 - for some reason it does return all numbers, not only the odd ones. I would be grateful for any hint on why that is so, as I could nto find the cause after 15+ minutes alone.
14:10gfredericksS3thc0n: you're testing o for truthiness
14:10gfrederickspresumably it is either 0 or 1
14:10justin_smith,(if 0 :true :false) ; S3thc0n:
14:10clojurebot:true
14:10gfredericksbut both of those are thruthy
14:10S3thc0nOh...
14:10S3thc0nI see.
14:10justin_smith,(if (zero? 0) :true :false) ; S3thc0n:
14:10clojurebot:true
14:10justin_smith,(if-not (zero? 0) :true :false) ; S3thc0n:
14:10clojurebot:false
14:11S3thc0nThank you for showing me the obvious.
14:11bbloomdnolen: another fan of space, i see :-)
14:11seangroveS3thc0n: Are you trying to do it without using the built-in functions?
14:11dnolenbbloom: heh
14:11gfrederickshah RT defines first, second, third, and fourth
14:11S3thc0nseangrove: exactly.
14:12S3thc0nI tested if 1 was true, and automatically assumed that 0 would be false. ^^
14:12jtoyjustin_smith: i am working with the code you wrote, I think i have the same problem as I originally had though, which is that I want home-page to use OtherLayout: https://www.refheap.com/21624 I want verything to end up using OtherLayout, the problem is that I cant edit the pages that are inside of the library as I dont have access to the source code
14:12jtoyam I just understanding this wrong?
14:13justin_smithjtoy: then you want the layout to be used to be something that is dereferenced/accessed at runtime
14:13justin_smithso you don't want a protocol, you want a global updatable state
14:13justin_smith(def layout (atom ...))
14:13jtoyjustin_smith: is a global updateable state bad or ok in this situation?
14:15justin_smithI think it is bad design, but it will work
14:15bbloomi much prefer global state to local state :-P
14:15jtoyjustin_smith: I agree, but I will use it until I learn a better way for now, thanks
14:16dnolenCLJS devs might find this useful - http://www.html5rocks.com/en/tutorials/developertools/devtools-terminal/
14:25bitemyappseangrove: what's the difference between the japanese and korean versions?
14:25bitemyappseangrove: well I know a good place for japanese stuff. I sleep on the buton with a makura.
14:25bitemyappand a comforter.
14:27seangrovebitemyapp: Usually firmness and materials, especially towards the north in Korea where it's very cold so you try to capture as much heat from the floor as possible
14:27seangrovebitemyapp: About to pair for a bit, but definitely want to hear about the Japanese place. Think I may make the switch.
14:31bitemyappseangrove: incidentally, I just started pairing too.
14:31bitemyappseangrove: http://www.yelp.com/biz/neat-asian-things-san-francisco delightful place.
14:32bitemyappthey carried the stuff out to my car while I double parked. Very friendly.
14:32indigobitemyapp: Oh, that's cool
14:32bitemyappseangrove: the futon I got from there has helped my back quite a bit.
14:32bitemyappthe makura has helped with my sleep and back problems too.
14:35luftso, what restrictions can you set upon nullability with core.typed?
14:36bitemyappluft: well you can elide Option and make nulls unallowed.
14:37nDuffluft: if something is (U nil SomeType), it can store nils. If strictly SomeType, it's non-nullable.
14:40dnolenhttp://dev.clojure.org/jira/browse/CLJS-721, ok thinking :include-macros :require modifier is alright - if you disagree let me know.
14:41luftnDuff: that's cool, I've been able to get something similar up and running in scala, but since the default is always (U nil SomeType) when you write SomeType it added a lot of boilerplate
14:42jtoywhy doesnt this work: (defn atom-test [x] (atom(+ x 5))); (swap! atom-test (fn[x] (println x))) ?
14:42luftnDuff: i was also curious if clojure can implement the y-combinator
14:43luftor if it can only use the z-combinator like scala.
14:43shokyjtoy: atom-test is a fn, not an atom
14:43technomancyjtoy: think for a minute about what that means
14:44nDuffluft: well, my off-the-cuff answer would be "yes, you can, but it's not something you'd need in practice", but I didn't quite grok your assertion that it couldn't be implemented in Scala, so I'm concerned that I might be missing some finer points.
14:44jtoyah, i am generating functions that have atoms
14:45technomancyjtoy: you need to use more precise terms. what does "having an atom" mean?
14:45nDuffluft: if the distinction is support for functions with multiple-arity argument lists (where you can have a reference that isn't specific to an arity), yes, you can do that in Clojure.
14:48stompyjis anyone here using clojure with dropbox? There's a number of clojure libs out there, but curious if anyone recommends one in particular
14:48jtoytechnomancy: I think I need this: (def atom-test (atom (fn[x] (+ 5 x)))) , it seems to work in the repl, i will tset it from actual code now
14:48luftnDuff: this http://stackoverflow.com/a/5886279 goes over why the y-combinator cannot be implemented in haskell (it would require an infinite type). The same reason makes scala unable to implement the y-combinator. Both haskell and scala can implement the z-combinator, which does the same thing,
14:50nDuffluft: Ahh. That's a definite yes.
14:51luftnDuff: ah ok, I was curious if the jvm hamstringed clojure's dynamic typing at all
14:53nDuffluft: Gotcha. The short form is that Clojure's functions all implement a very generic interface (IFn, which in turn extends Callable and Runnable). More specific signatures are mostly reserved for interop cases.
15:00gfrederickshaha y combinator in haskell: https://github.com/fredericksgary/ridge/blob/master/Ridge/Eval.hs#L93
15:00gfredericks(I had no idea what I was doing there I just eventually got it to work)
15:19TimMchyPiRion: Yes, I've used @@ from time to time. Usually it's in tests: @@#'foo/bar/baz
15:20TimMcerr, foo.bar/baz
15:21gfredericks,'~@@~~@@~~@@x
15:21clojurebot(clojure.core/unquote-splicing (clojure.core/deref (clojure.core/unquote (clojure.core/unquote-splicing (clojure.core/deref (clojure.core/unquote (clojure.core/unquote-splicing (clojure.core/deref x))))))))
15:22gfredericks'~#'@~@'x
15:22gfredericks,'~#'@~@'x
15:22clojurebot(clojure.core/unquote (var (clojure.core/deref (clojure.core/unquote-splicing (quote x)))))
15:22gfredericksare those all of the modifiers in the reader? besides backtick
15:24hiredmanyes
15:24coventryThey are in tools.reader, which is a pretty faithful clone of LispReader.
15:25hiredmanall the "reader macros" are in the reader :)
15:25gfredericksI wasn't asking whether they were in the reader or not, I was asking if I forgot any :)
15:26hiredmanthat sort of depends
15:27coventryThere's a list at the start of LispReader.java, in the "macros" array.
15:27hiredmanthe reader has a macro array, and that contains the readers for everything including lists, vectors, maps and strings
15:27gfredericks,[1 2 #!3 4]
15:27clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
15:28hiredmanif you means some kind of prefix that expands out to some kind of s-expression, I think that might be all of them
15:28hiredman#! is for shebangs at the top of files
15:28gfredericks,[1 2 3] #! a comment
15:28clojurebot[1 2 3]
15:28coventryWhat was the intended use of the "|" symbol (commented out in the macros list)?
15:29hiredmanso you can make executable clojure scripts
15:29gfrederickscoventry: obviously for reading arg vectors
15:29gfredericks#(|a b| (+ a b)) maybe?
15:30jtoycan anyone tell me what is wrong with this usage of atoms? I can get this syntax to work on the command line but this doesnt work: https://www.refheap.com/21630
15:30coventryIf that's the case, I can see why he left it out.
15:31jtoyI tested on the repl with: (def atom-test (atom (fn[x] (+ 5 x)))) (@atom-test 5)
15:32gfredericksjtoy: I can't reproduce that error message
15:34jtoygfredericks: weird, my code is almost exactly the same, I will try to narrow it down more
15:34gfrederickscoventry: looking at the ArgVectorReader it makes me think there used to be something called an ArgVector; a data structure or something; this is like digging up dinosaur bones
15:35gfredericksjtoy: when I replace html and app-config with trivial things, the code runs and landing is bound to a function
15:35coventrygfredericks: Yeah, probably the most direct approach is to look at the git history for those lines. Maybe I'll poke around in it this evening.
15:35gfrederickscoventry: oh good idea here I go
15:35hiredmanat some point pre public anouncement of clojure I think | was considered for vector syntax instead of []
15:37hiredmanbut I could be mistaken, and thinking about it, how would that even work with nesting?
15:37gfrederickshiredman: obviously clojure was going to be whitespace sensitive
15:39gfredericksoh I am totally going to compile this ancient clojure and see what it does
15:39gfrederickswhat the heck is a CPL.TXT file
15:39gfredericksis that an old version of leiningen
15:40coventryWhat's the date on the commit?
15:40gfredericksI'm looking at a sort of arbitrary commit from 2007-09-07
15:41gfredericksthere's a clojure.iml file
15:42hiredmanant
15:42gfredericksthere's no build.xml
15:42hiredmanOh
15:42hiredmanOH
15:43hiredmanyeah, good luck
15:43coventryhttp://books.google.com/books?id=GUUvxumMf6kC&amp;pg=PA225
15:43stuartsierrajavac
15:46jtoygfredericks: I'm at a loss for what the erro could be, do you see anything in the stack trace that looks suspicious? https://www.refheap.com/21631
15:47gfredericksjtoy: nope; staring at a stacktrace is a difficult way to debug; why are you sticking functions in atoms anyways?
15:47jtoygfredericks: its a temp hack until i find a better solution for my code
15:48tolitius1just wanted to share, in case anybody finds it helpful: https://github.com/tolitius/auqlue
15:48gfredericksjtoy: you use reset! to redefine the functions?
15:48jtoyi need my library to reference a function that is defined at runtime
15:48jtoygfredericks: I plan to, but i cant even get the basic atom to work yet
15:49gfredericksjtoy: the error message suggests you're not dereffing enough; you're trying to call an atom as if it were a function
15:50mdrogalistolitius1: Great stuff! Well done.
15:52tolitius1mdrogalis: thanks, just something I always lacked during meetings/conference talks.. it is still young though, relies on in memory db. but anyone can just "lein ring server" and use it..
15:52coventryjtoy: Macroexpand the (defpage landing) form and paste that in. You may get a more specific line number that way.
15:52jtoygfredericks: I've checked everywhere, the only place in that trace I can find where I call layout is with (@layout arg1 arg2)
15:52jtoyok, ill try that
15:52gfredericksI give up I cannot make this compile
15:52mdrogalistolitius1: Cool, grow it ^^
15:54jtoycoventry: the error is totally different in a different area of code, but that seems like a good thing
15:55S3thc0nHello people of #clojure, I would love to hear your opionions about my newbie code (ignoring that it uses tail calls and not recur), so I don't get used to any bad practices from the beginning (it's a simple fibonacci function): http://pastebin.com/RRaQPGyY
15:56coventryHuh, that stacktrace you posted suggests otherwise. Anyway, gotta go. Good luck!
15:56gfredericksS3thc0n: I would start with some destructuring
15:57tolitius1S3thc0n, take a look at iterate: (def fib (map first (iterate (fn [[a b]] [b (+ a b)]) [0 1])))
15:58tolitius1S3thc0n: http://clojuredocs.org/clojure_core/clojure.core/iterate
16:01varloghi all, quick question about the "early cuts" cl
16:01varlog...clojure book. are there more chapters than these 5?
16:02varlog(this was botched.) I am looking at the O'Reilly book, Clojure Cookbook. Does anyone know if this is it, or if there are more chapters coming?
16:04newblueS3thc0n: you can do sums with reduce
16:04newblue,(reduce + [1 2 3 4])
16:04clojurebot10
16:05newbluenot sure if that helps
16:05nDuffvarlog: That's not really one of the more widely-read texts.
16:05gfredericksnDuff: I don't think it's even finished so I wouldn't expect so
16:05S3thc0nThis is outrageous. I disconnected again. Last thing I got was the hint about destructuring :\
16:05varlognDuff: right, it's not even released yet :-)
16:05gfredericksS3thc0n: then there was a one-liner
16:06gfredericksS3thc0n: http://clojure-log.n01se.net/#15:56a
16:07nDuffvarlog: ...but https://github.com/clojure-cookbook/clojure-cookbook/graphs/contributors appears to show actively ongoing development.
16:07S3thc0ngfredericks: Oh, thanks! Nice feature.
16:07newblueS3thc0n: you can do sums with reduce (in case you don't know)
16:07newblue,(reduce + [1 2 3 4])
16:07clojurebot10
16:08S3thc0nYes, since I am at the very beginning I only did simple and direct sequence manipulation yet. It was more about general style.
16:08varlognDuff: thanks, this is very helpful
16:09S3thc0nBut still thanks, I love how easy everything gets with CLojure :)
16:10jtoygfredericks: I fixed the issue by reverting back to my bad macro, im not sure what the difference is though: https://www.refheap.com/21630
16:11S3thc0nBut I guess there aren't a lot of general style mistakes you can do in LISP^^
16:11jtoycoventry: fyi https://www.refheap.com/21630
16:13nDuffS3thc0n: depends on where you draw the line between style and design.
16:13nDuffS3thc0n: there's certainly a lot that matters around making the right judgment calls on how to decompose your problem.
16:14S3thc0nnDuff: True - but I would think you can also make less mistakes there in fucntional languages?
16:15nDuff*shrug*. They're different mistakes, anyhow. :)
16:24gunsDoes anyone know how long :pre and :post conditions have been supported in CLJS?
16:24gunsWas pleasantly surprised while porting a lib
16:25stuartsierraAnybody know if you can specify a target JDK version when AOT-compiling?
16:25bitemyappjtoy: you are consistently obstinate about writing bad code. Stop abusing atoms.
16:25seangrovestuartsierra: Walk2 is great, any ideas if it's feasible to port to cljs?
16:25bitemyappjtoy: you keep using Clojure as a cudgel for writing imperative, mutable code with parentheses and you are suffering on your own behalf and wasting other peoples' time in attempts to save you from your misguided approach.
16:25bitemyappjtoy: get a book and learn how to write Clojure idiomatically.
16:25bitemyappjtoy: I see you do this week in, week out,.
16:26jtoybitemyapp: all my code is idomatic except for that piece
16:26hiredmanI doubt it? I think the compile hard codes the calls to asm to use the 1.5 class file format
16:26bitemyappjtoy: don't lie to me, I've seen everything you post on here.
16:26stuartsierraseangrove: Thanks. I believe clojure.walk2 could be ported to CLJS.
16:26bitemyappseangrove: why would you? I thought the point was protocols performance.
16:26bitemyappthere's no distinction to be made there in CLJS so far as I'm aware.
16:26jtoybitemyapp: it was the same issue, anyway, you dont need to be hostile
16:26bitemyappunless there was an API improvement I missed.
16:26bitemyappjtoy: you come up with a new terrible idea every week.
16:26seangrovebitemyapp: Just a slightly nicer distinction when walking through clojure.lang.MapEntry
16:27bitemyappseangrove: seems reasonable.
16:27bitemyappseangrove: I think most people use postwalk on maps though.
16:27bitemyappI don't, because I'm awesome, but most do.
16:27seangroveI'm using it on hiccup-style structures, personally
16:27jtoybitemyapp: whatever, be bitter all you want,you have said the exact same hostile things, you are not being helpful
16:28stuartsierraFYI, I have submitted a patch to update clojure.walk in Clojure: http://dev.clojure.org/jira/browse/CLJ-1239
16:28bitemyappjtoy: I'm trying to save you pain and the channel members' time.
16:28stuartsierrahiredman: thanks, trying to find this in the compiler
16:28jtoyi implemented a solution that others on the channel recommended
16:28hiredmanstuartsierra: I think it is at 1126
16:28bitemyappafter you'd already gone off on some hare-brained quixotic crusade to make mutation of a function generated atom work
16:29seangrovestuartsierra: Thank you, watching it now.
16:29bitemyappjtoy: which is a symptom that you don't really understand what's going on
16:29hiredmanstuartsierra: V1_5 is the string to grep for
16:29bitemyappjtoy: that you're cargo-culting your way through yuor code
16:29bitemyappjtoy: and that you need to read a freakin' book
16:29dnolenguns: huh didn't realize they worked myself
16:29stuartsierrahiredman: thanks, found it
16:29gunsdnolen: :)
16:29jtoybitemyapp: you havent seen any of my code, you have no idea, its all functionaly excepy for that one piece, im going to ignore you now
16:29gunsMaybe they don't then? Seem to work for me
16:29dnolenguns: no they appear to work
16:29bitemyappjtoy: I've seen everything you post here.
16:30bitemyappjtoy: stop being defensive and just read a book.
16:30gunsdnolen: Well that's awesome.
16:30dnolenguns: but that fact was never updated on the wiki
16:30bitemyappjtoy: http://www.clojurebook.com
16:30dnolenguns: on github about the language differences
16:30hiredmanstuartsierra: I think for 1.7 you need a newer version of asm, and there are some bytecode related changes that I think mean you need to track some extra information (stack maps?)
16:30jtoyi have them all , stop bothering me
16:31bitemyappjtoy: yes but owning a book doesn't transfer knowledge
16:31bitemyappjtoy: otherwise yuppies would be less retarded. You need to read the book and do the exercises so that you understand the actual semantics.
16:31jtoybitemyapp: are we getting into name calling now?
16:31bitemyappnot unless you're a yuppie, no.
16:32bitemyappjtoy: you just need to go through the actual book, at least the first 3-4 chapters/units.
16:32jtoybitemyapp: if you want to talk about this in person, sure lets go, but i have no interest to hear you attack me with your bs here
16:33bitemyappjtoy: http://www.youtube.com/watch?v=GlKL_EpnSp8
16:37seangrovebbloom: How's the launch going, outside of hn?
16:38bbloomseangrove: killer. thanks for asking!
16:38bbloomwe're about to top 100M lines of code written :-)
16:38bbloomor i guess blocks dragged together :-P
16:38seangroveWow, that's awesome!
16:38seangroveI showed it to a few friends last night, had a good debate about it
16:39bbloomlast count was over 3M students
16:39bbloomwhat's there to debate?
16:39musicalchairwow, that's amazing. you must feel great =)
16:39seangroveUtility, place, etc.
16:39bbloomwhich side were you on? :-P
16:40bbloomb/c i don't see how we could possibly justify teaching any science, if we can't justify spending a few hours learning about what code is and what it can do
16:40seangroveHeh, I think it's a good tool for making programming accessible, makes it less arcane/foreign, limits the amount of mistakes possible (via blocks), and gives immediate feedback. All good things.
16:41bbloomi've been teaching scratch in harlem once a week & just 2 weeks ago we let the class beta this
16:41bbloomwas NIGHT AND DAY
16:41seangrovebbloom: Oh, the other side was whether those were the difficulties in learning to program. But there was widespared agreement that especially for children, this was a huge win.
16:41bbloomthe kids frickin loved the puzzles instead of the freeform nature
16:41bbloomand those who finished the first hour went back to scratch and were killing it
16:41bbloomand all the ppl on hacker news saying that this is a conspiracy or some political bullshit are insane
16:42seangrovebbloom: Hah, you're coming as pretty paranoid now
16:42nDuff...what's this?
16:42bbloomsorry, i'm just annoyed reading this HN thread b/c i know for a fact that we've got bipartisan support and havent' donated a dime :-P
16:42seangroveCareful about median vs average here - I think your view might be slightly distorted by hn now
16:43bbloomanyway, fuck HN. everything else is going super well :-)
16:43bbloomamazingly... *drum roll*
16:43seangroveThe questions were more about this vs codecademy vs books vs cousera vs lectures
16:43indigobbloom: What's your startup name?
16:43bbloom~60% of ppl who complete the hour of code are female!
16:43clojurebotGabh mo leithscéal?
16:43bbloomindigo: i work for code.org
16:43indigoOhhh
16:45bbloomhttps://twitter.com/search?q=%23HourOfCode&amp;src=hash&amp;mode=photos
16:46indigoCool :)
16:48bitemyapptrolling on twitter might be my favorite thing.
16:49technomancybbloom: congrats on the launch
16:49bbloomtechnomancy: thanks :-)
16:50jtoytrolling in general :)
16:51technomancybbloom: I'm amazed with the progress I've seen so far; had him debugging a tricky bug in a function last night where he was passing a hard-coded number into another function instead of passing the argument on through. it was a blast.
16:51bbloomtechnomancy: ah, the ol' do what i thought i wrote not what i actually wrote bug
16:51bitemyapptechnomancy: teaching the kiddle?
16:51bbloomreally glad you're enjoying it!
16:51bitemyappor one of them, anyway.
16:52technomancybitemyapp: always
16:52bitemyappI was hacking Haskell with a friend yesterday, t'was a ton of fun. He learned quickly.
16:52technomancy(almost literally)
16:52technomancybbloom: I'm having some difficulty reconciling my observations with what I've read in Mindstorms about curriculum vs ambient learning
16:52bbloomtechnomancy: i haven't read it, so you'll have to elaborate
16:52musicalchairbbloom: have you read any John Holt? "How Children Fail"?
16:52bbloommusicalchair: nope
16:53technomancymusicalchair: I just finished "Instead of Education" like two days ago; definitely related
16:53musicalchairbbloom: http://www.amazon.com/Children-Fail-Classics-Child-Development/dp/0201484021
16:53danneuCan anyone recommend a lib for url-slugifying strings?
16:53musicalchairtechnomancy: I'll have to check that out
16:53bbloom"John Holt states his belief that children love to learn, but hate to be taught"
16:53bbloomyeah, pretty much
16:53technomancymusicalchair: it's a bit dated since it was written before homeschooling was legal, but very good otherwise
16:53bbloomi'm like "but mark zuckerberg is gonna teach you loops! that video is awesome! you should watch it"
16:54bbloomNOPE. click. start dragging shit around. "hey, i got it!"
16:54bbloom:-P
16:54musicalchairtechnomancy: I see
16:54technomancybbloom: Papert was a pupil of Jean Piaget, who argues for ambient learning being the ideal model for education. children should learn other subjects the same way they learn to talk, walk, etc: by trying and doing, not by being told what to do
16:55bbloomtechnomancy: that makes sense to me, but w/o knowing if this is for or against that worldview, i'll point out:
16:55technomancyso the free-form model feels a bit closer to that ideal
16:55tim__okay, I just loaded up my irc client and saw technomancy's comment. What's the context behind the homeschooling discussion?
16:55bitemyapptechnomancy: I learned programming by being tossed a manual, told that I wasn't going to get anymore PC games so I had to find something else fun to do, and sitting there by myself and figuring it out.
16:55danneuRe: myself - https://github.com/pelle/slugger is cool
16:55bbloomtechnomancy: parents who talk to their babies more raise kids who are smarter :-P
16:56technomancybbloom: right, but kids learn words because they want to *do* something: participate in conversation
16:56bbloomyeah
16:56technomancykids learn reading best when they want to figure out the world, not from a phonics curriculum
16:57technomancybut empirically the guided approach seems to be more effective in my experience =)
16:57progodanneu: that *is* cool :o
16:57technomancymaybe gamification plays into that to a degree
16:57bbloombut you're doing the guided approach with speaking anyway
16:57bbloomyou baby talk to a baby
16:57bbloomand then the baby starts talking back
16:58rubber-duckHow can I do something like this more concise : (let [foo {} foo (if x (assoc :x x) foo) foo (if y (assoc :z z) foo)] ... use foo)
16:58bbloomand over time, you have to explain fewer and fewer vocabulary words & you discuss more and more complex topics
16:58technomancybbloom: right; you have to set the context and difficulty appropriately. but the goals are the child's.
16:58bbloomit's just that humans already know how to talk to other people of varying levels of knowledge, experience, intellect, language, etc
16:58bitemyappI'd heard baby talk retards linguistic development.
16:59technomancytim__: educational philosophy and http://learn.code.org
16:59ieurebbloom, I never baby-talked to my kids. Always talk to them like, uh, people.
16:59bitemyappieure: because they are!
16:59bitemyapp(people)
16:59ieurebitemyapp, Yeah, exactly.
16:59TimMcSort of.
16:59rubber-duckit just feels there should be a better way to do this because it would come up so often
16:59bbloomieure: yeah, i don't have any kids, but i talk to OTHER PEOPLE'S kids like adults, but we're pretty abnormal compared to most parents, i'd imagine :-P
16:59TimMcThey're like... becoming-people.
16:59hfaafbtiny drunk suicidal people
16:59bbloomanyway, that wasn't my point. it was that the sophistication of discussions with a baby vs a teenager evolve
17:00bbloom:-P
17:00tbaldridgetechnomancy: ah, cool. I'm a product of homeschooling so I find the subject interesting.
17:00ieureAnyway, talked to them the way I hoped they'd talk to me, seems to be working okay so far.
17:00bitemyappTimMc: all kids are sociopaths at first.
17:00bitemyapphfaafb: lol
17:00bbloomtechnomancy: there are some innate goals, like eating that i think educational games should capitalize on
17:00TimMcbitemyapp: I'd be skeptical of that claim. What I remember from linguistics class is that language acquisition pretty much proceeds apace as long as there are people talking around them.
17:00bbloomeverybody GETS pacman
17:00bbloomthat dude is hungry. he eats dots.
17:00technomancybbloom: actually I don't find the "limited toolbox" approach confilcts at all with papert
17:00bbloomgo eat the dots
17:00bbloommmm dots.
17:01bbloomyou don't need to tell anyone what the goal of pacman is
17:01bbloomeat, don't get eaten.
17:01ieurebbloom, Have you watched a young child play Pac-Man?
17:01ieureThey have no concept that it is a thing they interact with.
17:02bbloomdepends on what "young" means
17:02technomancyI like how code.org drops a few "now just do something cool" stages in here and there
17:02bbloom5 year olds are finishing the hour of code w/ little to no parental guidance, that's far away from "no concept"
17:02technomancytbaldridge: have you read Papert's Mindstorms?
17:03TimMcbitemyapp: I guess there might be a slight delay, but my recollection is that it's not substantial.
17:03tbaldridgebboom: Although my personal experience with pac-man as a child was less of "eat and survive" and more of "get power-up pill, and then kill, kill, KILL!!" :-P
17:03pbostromhttp://www.webmd.com/parenting/news/20050316/baby-talk-may-help-infants-learn-faster
17:03tbaldridgetechnomancy: no I haven't
17:03bbloomtbaldridge: as long as you're eating something, you're winning at pacman in my book
17:03tbaldridge:-)
17:04technomancytbaldridge: absolutely recommended
17:04ieure"Tutorials that teach JavaScript"
17:04ieureChild abuse.
17:04dnolentbaldridge: technomancy: seconded
17:04tbaldridgetechnomancy: from reading the description it sounds like a book I'd agree with. I'll put it on the list.
17:04bbloomieure: stick to the beginner section for children :-)
17:05bbloomthere were just so many javascript tutorials out there
17:05technomancytbaldridge: just started my second read through it last night and realizing it probably is going to take a third for all the goodness to really be extracted =)
17:05bbloom"hey, i wanna teach someone to program on the web... i just need an interpreter.... DONE."
17:05bbloomtbaldridge: "sounds like a book i'd agree with" lol filter bubble at work :-)
17:06tbaldridgebbloom: lol, I'm not saying that's the only kind of book I read
17:06bbloom:-D
17:06technomancyI found it helped me put to words a lot of ideas I'd held implicitly but didn't know why
17:06dnolentechnomancy: tbaldridge: related Alan Kay's reading list on Learning & Education is pretty killer - http://www.squeakland.org/resources/books/readingList.jsp, I've only read Jerome Bruner, Papert, but from what I can tell nearly everything there is golden or insightful.
17:07technomancydnolen: nice; thanks
17:07technomancy<3 Postman too
17:07technomancyI'd been wondering where a good place to start with Piaget was
17:08bitemyapptechnomancy: would you be willing to consult with me on a write-up comparison of grom and grenchman when the former is done? I'd just like ideas/feedback from you make certain I don't mischaracterize OCaml.
17:08technomancybitemyapp: sure thing
17:08justin_smithtechnomancy: the best teacher I ever had (math / systems science guy) was a huge Piaget fan
17:09technomancyjustin_smith: I only know him through Papert and Wikipedia so far =)
17:09bitemyapptechnomancy: much appreciated.
17:10justin_smithtechnomancy: I guess I was just supplying my anecdotal experience that knowledge of Piaget's ideas and ability to help people learn go together
17:10technomancyjustin_smith: haha nice
17:19mikerod_is there anyway to get `lein test` to skip an entire ns in the testing dir?
17:19technomancymikerod_: sure; that's what test selectors do
17:19technomancyyou can define a :test-selectors map of keywords to functions in project.clj
17:19mikerod_it is recompiling a ns under my test directory, that I have some defrecord's in that multiple test namespaces us. This is causing me to have multiple definitions of the same test helper records, messing things up for me.
17:20mikerod_I've read about :test-selectors. I didn't see how to get them to work in the at the namespace level.
17:20technomancyit's a relatively new feature
17:20mikerod_I don't even have any deftest in this namespace, I just want to reuse some common defrecord types.
17:20technomancyhm... actually I don't know if you can avoid loading the namespace
17:21mikerod_the :reload flag is hurting me
17:21technomancythe test selector works based on the ns's metadata, so it has to load
17:21mikerod_making it order dependent on the way the tests are ran.
17:21mikerod_hmm
17:21mikerod_that makes sense
17:21mikerod_sounds like I'm in a tricky situation then.
17:22technomancyyou could put the test in a different directory
17:22technomancyand only include that dir in :test-paths of a given profile
17:23mikerod_That would be available on the classpath during running the other test?
17:23mikerod_tests*
17:23technomancyit would be on the classpath when that profile was active
17:24technomancy`lein with-profile +extra-tests test`
17:25mikerod_Hmm, it seems like that would cause me to still get redefinition of my defrecords, when I ran under that profile
17:25mikerod_I thought it would just run all the tests in all the :test-paths
17:25technomancyoh right; I thought you just wanted to be able to run other tests without it
17:26mikerod_ah I see
17:26technomancycan you put the record in a defonce or something?
17:26mikerod_Yeah I have 2 shared namespaces A and B. B is just defrecord's and A uses B for those records. Then I have a *real* testing namespace C that uses A and B. What happens is, if the tests load in the wrong order, A and B have different definitions of those defrecords
17:27mikerod_I'm not sure of a defonce function for a defrecord :(
17:27technomancyI mean something like (defonce _ (defrecord ...))
17:27mikerod_I can run lein test B A C and I pass
17:27technomancydoes that even work?
17:27mikerod_ah, that would be interesting to try
17:28technomancy(when-not (contains? @@#'clojure.core/loaded-libs 'my.test.ns) (defrecord ...)) ; mwahahaha
17:29bitemyappdefonce makes me hella uncomfortable sometimes.
17:30technomancyso do records though
17:30technomancyso it even sout
17:30technomancyevens out
17:31cljrif anyone here has used gloss, can you verify if you can nest codecs within other codecs, specifically frames defined using maps within other maps?
17:32ztellmancljr: that is verified
17:32clojurebotYou don't have to tell me twice.
17:35cljrztellman:Okay, i found an example which nested vectors, but wasn't sure with maps, was trying to figure out if i was using it in a way it wasnt supposed to
17:36cljrztellman: does this error immeditately suggest anything to you? "java.lang.IllegalArgumentException: No implementation of method: :sizeof of protocol: #'gloss.core.protocols/Writer found for class: clojure.lang.Keyword"
17:37mikerodI keep getitng kicked out of freenode
17:37mikerodtechnomancy: I'll try out some approaches with this for fun, even though I think I'll have to come up with something a bit better to not recompile my defrecord's.
17:38mikeroddefonce did something mysterious and I started having even more failures. So that one was a bit confusing. :)
17:38mikerodI appreciate the feedback though.
17:38technomancysure
17:38technomancynote that it's a :reload and not a :reload-all
17:39technomancyso indirect requires shouldn't reload
17:39technomancyoh... ok.
17:39technomancyyou want something that's on the test classpath but has no deftest forms in it
17:40ztellmancljr: it seems like you're passing in a keyword when it expects a codec
17:40technomancy:profiles {:dev {:source-paths ["test-src"]}} ; is what you want
17:40ztellmanwithout knowing more about what you're doing, I can't say
17:44bitemyappmikerod: defonce isn't a terribly great idea.
17:44bitemyappmikerod: unless you really understand the implications.
17:45bitemyappmikerod: I mean, it's handy if you plan to reload vars and have non-trivial input data to the def, but then the question arises as to why you're init'ing a def in that manner.
17:45cljrztellman: ive gotten as far as having two codecs defined along the lines of (defcodec a (ordered-map :a 1 :b 2)), ..., then have another codec which nestes them (defcodec c (ordered-map :a a :b b :c :int32)), when i try to encode actual data i get that error and if i comment out the nested codecs in c and only have the simple :int32, it seems okay, to confirm, that kind of nesting should work, correct?
17:45bitemyappmikerod: I just got done using defonce and it makes me queasy.
17:46ztellmancljr: correct
17:46ztellmancljr: this doesn't mean anything: (ordered-map :a 1 :b 2)
17:46ztellmanI assume you're putting real types there?
17:47bitemyappmikerod: defonce only won't overwrite itself, anybody else can plus a refresh will nuke it.
17:47cljrztellman: you are right, i mixed up frames and actual data
17:48cljrztellman: just knowing it should work and im not poking around in the dark helps a lot, though, thanks
17:57mikerodtechnomancy: yes, it is a little confusing
17:57mikerodA requires B
17:57mikerodB has defrecords
17:57mikerodC requires A and B
17:57mikerodIf lein test goes A B C
17:57mikerodC ends up with 2 definitions of the defrecords
17:57mikerodsince A loaded first, it causes the B to load, since it hasn't before
17:58mikerodand then lein test does a require :reload on B
17:58mikerodif the order went B A C, the defrecords are not redefined, and everything is fine
17:58mikerodbut ideally I'd just like to never explicitly :reload B (the one wiht the defrecords), since it has no test anyways, it is just a shared namespace for testing types
17:59mikerodbitemyapp: yes defonce has not been something I have seen much use of before
18:01magnarsI just added thread and unwind refactorings to clj-refactor https://github.com/magnars/clj-refactor.el#thread--unwind-example - in case you're as tired of doing that manually as I am.
18:01justin_smithmikerod: maybe a separate source-path, for things auxilarry to tests that are not themselves test definitions, such that they will be found by the testing functions if required, but not auto-reloaded?
18:01magnarsAnd it feels good to finally have at least one useful feature in the package :P
18:03mikerodjustin_smith: yes indeed, I just saw that technomancy mentioned :source-pathes on the :dev :profiles, I have not realized that this is what that was for before
18:03mikerodit does fix my issue, and goo to know!
18:03mikerodgood*
18:09justin_smithmikerod: well, this is one use for it :)
18:09mikerodhah, yes I meant that
18:10justin_smithoh yeah, backscroll shows that technomancy did suggest exactly that (but more laconically)
18:20akurilin[
18:20akurilinops.
18:20akurilinRandom question for you guys, totally unrelated to clojure, but you people are really savvy. What frame
18:20akurilinwork to UTs do you use for testing js?
18:20akurilinqunit?
18:27magnarsakurilin: Browser automation is required for sanity preservation ... hammering f5 in a browser is all kinds of dull. So I would suggest something that runs on the command line. I prefer busterjs.org - but Karma+mocha or jasmine has wider adoption.
18:27technomancymagnars: supposedly you don't need a wrapper around minor modes for hooks anymore
18:28technomancyrun-hook will just DTRT if it is pointed at a minor mode
18:28magnarstechnomancy: oh, isn't that nice
18:28technomancyalso: M-x ucs-insert COPYRIGHT SIGN =)
18:29magnarsI'm gonna add it to C-x 8 (c)
18:29technomancynice
18:29akurilinmagnars: sounds good, I'll need to investigate buster then
18:29magnarsAlready have C-x 8 t m ^^
18:30bitemyapp~zergling
18:30clojurebotzergling is https://github.com/prismofeverything/schmetterling
18:42arrdem1zzzzzzzzzzzzzzzzzzz
18:42arrdemoops. forgot an s.
18:42arrdembitemyapp: okay. xorg wins this round.
18:51sorenmacbethanybody know if `alter-var-root is thread local or not?
18:52hiredmannot
18:52sorenmacbethhiredman: thanks
18:53hiredmangenerally you only use it in tests for mocking/stubbing
18:56sorenmacbeththis is the usage which prompted my question
18:56sorenmacbethhttps://github.com/clojurewerkz/elastisch/blob/master/src/clojurewerkz/elastisch/native.clj#L69
18:56sorenmacbethi've a compojure app making calls to an ES cluster and I wanted to make sure that I can just call connect! once when the handler is started
18:57hiredmanah, sorry, I was thinking of with-redefs, but alter-var-root is also not thread local
18:57sorenmacbethand the other threads will use the altered var root
18:57sorenmacbethah, right
18:57sorenmacbethcool, this should work fine then
18:58hiredmanugh
18:58hiredmanjust because you are using clojure doesn't mean global connection objects are suddenly a good idea
19:03hiredmansorenmacbeth: I don't know what you situation is, but I would recommend looking at talking to elasticsearch's rest api using clj-http instead of using this and the node api (or whatever it is called)
19:04justin_smithhiredman: is there a good paper / book / article / resource / blog post of some sort about replacing global resources with a more functional and reentrant binding?
19:04justin_smithbecause this stuff seems to come up a lot
19:04sorenmacbethhiredman: I'm actually using both the native and rest clients
19:10sorenmacbethhiredman: I have some very large queries where the native client performs markedly better
19:12sorenmacbethhiredman: but I'd echo justin_smith's comment. any pointers to a better approach would be interesting to me
19:22hiredmanjustin_smith: I dunnno
19:23hiredmansorenmacbeth: ah, well
19:24arkhIs there a canonical cljs->js function out there for converting cljs data structures to js? I've found a couple but haven't found any official ones
19:25john2xarkh: clj->js :)
19:25jtoyjustin_smith: is that question related to what I was asking about earlier?
19:25arkh: ( really? ...
19:26arkhsorry for the obvious question : ) Thanks for the help
19:27justin_smithjtoy: and questions I have had
19:27justin_smithand many others :)
19:27justin_smithalso applies to what sorenmacbeth was dealing with
19:29justin_smithit is a general and persistent problem where we have strong feelings about what is wrong but no good straightforward canonical resource describing what is right. As far as I know. I am looking for that resource now (and finding good things to read accidentally as I do so), and may consider writing the blog post if I don't find it.
19:29justin_smithbut I don't feel like I have the expertise to be the authoritative resource on this
19:29hiredmanit depends a lot on the resource and how you have it configured
19:30jtoyjustin_smith: I bet yor blog post will be very informative
19:31hiredmanfor example some (most?) message queue clients have an auto reconnect, so if that auto reconnect is ok for your particular use case (depending on what happens on auto reconnect, does it throw an error when someone tries to publish on a closed connection, then tries to reconnect, will you get a thundering herd of reconnections? etc etc) then fine, have a auto reconnecting global connection
19:34justin_smithhiredman: a recent instance of this I was dealing with - replacing the config info in the db config with a c3p0 connection pool (in order to reuse jdbc connections in a pool instead of repeatedly creating them). This makes it important that the same pool object is being used (as opposed to the connection info, which is jsut static data, only needs to be structuarally equal)
19:35justin_smithand then dealing with the fact that I want to be able to override that connection for certain operations relating to migration
19:35justin_smithand a codebase that was not written for everything using the db taking a db argument
19:35justin_smith(from the old (sql/with-connection db ...) macro days)
19:37hiredmanjustin_smith: it is also slightly different if you are writing an app or a library, if you are writing an app, sort of whatever, but if you are writing a library for reuse, you can't make those decisions for other projects
19:38justin_smithright
19:39justin_smithI am one of the authors of a set of libraries, so making the right decision has higher stakes
19:39justin_smithand having a good design has a high priority, not forcing shitty decisions on others
19:39dbaschI'm trying to translate some python code into clojure, and I can't figure out an efficient / elegant way to generate a map of maps on the fly, in a scalable way
19:39dbaschhere's the python code https://gist.github.com/dbasch/99451ac5646e9cf0e2a7
19:41dbaschhere's the atrocity I have https://www.refheap.com/21641
19:42justin_smith,(reduce (fn [occurances [a b]] (update-in occurances [a b] (fnil inc 0))) {} (partition 2 1 ["a" "b" "c" "d" "b" "a"])) ; dbasch
19:42clojurebot{"d" {"b" 1}, "c" {"d" 1}, "b" {"a" 1, "c" 1}, "a" {"b" 1}}
19:43dbaschjustin_smith: what if the array doesn't fit in memory?
19:43justin_smiththat code will work on a lazy input
19:43justin_smithit does not hold onto the head anywhere
19:43dbaschok, I'll try it. Thanks
19:43justin_smithas long as all keys fit in memory
19:44justin_smithreduce is eager, but can take a lazy seq as input
19:44gfredericksis laser the goodest thing for haxily extracting data from html?
19:44justin_smithdbasch: the trick will be ensuring that you do not bind the head of the incoming lazy seq
19:45justin_smithbecause if you do you will run out of memory
19:50justin_smithhttp://i.imgur.com/3sg75mW.png
19:50technomancyclojurebot: fault tolerance?
19:50clojurebotPardon?
19:51technomancyclojurebot: fault tolerance is http://i.imgur.com/3sg75mW.png
19:51clojurebotRoger.
19:53lgs32adbasch: also have a look at this http://stackoverflow.com/questions/20203883/clojure-simple-markov-data-transform
19:54dbaschlgs32a: thanks, that's basically the same as my question
19:54justin_smithlgs32a: woah, I just now rewrote the exact function in the SO answer
19:55lgs32ajustin_smit: it was mine, i just looked over the chat and thought i know that implementation from somewhere
19:55lgs32ajustin_smith: it was mine, i just looked over the chat and thought i know that implementation from somewhere
19:55justin_smitha coincidence I swear :)
19:56lgs32a;)
19:56lgs32anotice how the other answer gathers higher performance using merge-with
19:56justin_smithhell, I probably learned the idioms from examples you shared other places
19:59lgs32ajustin_smith: are you working on caribou?
19:59justin_smithindeed I am
19:59justin_smithlooking at generalizing the db integration for k/v stores, nosql, datomic, etc.
19:59akhudekis there any way to get clojurescript to give a hint as to where symbols come from in advanced mode?
19:59justin_smithmore pragmatically working on a plugin protocol for injected features
20:00lgs32ajustin_smith: are you also hiring?
20:01justin_smithI can get you in touch with the tech lead, and can vouch for your expertise
20:02lgs32ajustin_smith: that would be super awesome. what would I have to do?
20:17akhudekoh great, so I have a callback that works in advanced compilation mode if I put a console log statement in it, but does not work otherwise
20:18akhudekhas anyone experienced that before?
20:25justin_smithakhudek: do you use for or map in the callback?
20:25justin_smithcould be a laziness thing
20:26akhudekjustin_smith: https://www.refheap.com/051abfd88602427e3ac2017d0
20:26akhudekif I delete that log, it stops working
20:28justin_smithweird
20:28justin_smithyeah, I don't see any suspicious laziness there
20:29hiredmanakhudek: are you sure it is working with the log statement?
20:29hiredmancould r there always be falsey?
20:30hiredmancould the value of the "response" key be nil?
20:30hiredmanhow are you including cljs.reader/read-string? seeing it fully qualified like that makes me suspicious
20:31akhudekah, I think you are right, it's the reader not being required
20:36akhudekhiredman: yep, that was it, thanks!
21:18arrdemif I have N predicates and a single input, is there a nice way to count how many of them evaluate to true? I can't think of a non-macro one.
21:21Bronsa,(let [i 2] (reduce (fn [c p] (if (p i) (inc c) c)) 0 [odd? even? pos?]))
21:21clojurebot2
21:21dsrx,(count (filter true? (map #(apply % [5]) [(fn [n] (> n 0)) (fn [n] (< n 10)]))
21:21clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
21:22dsrx,(count (filter true? (map #(apply % [5]) [(fn [n] (> n 0)) (fn [n] (< n 10)])))
21:22clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
21:22dsrx,(count (filter true? (map #(apply % [5]) [(fn [n] (> n 0)) (fn [n] (< n 10))]))
21:22clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
21:22dsrxugh..
21:22dsrx,(count (filter true? (map #(apply % [5]) [(fn [n] (> n 0)) (fn [n] (< n 10))])))
21:22clojurebot2
21:23arrdemhum... I'll keep my macro. refheap.com/21644
21:24dsrxall the more reason i should start using ERC + paredit-mode
21:25coventry(->> [predicates] (filter #(% input)) count)
21:25Bronsaarrdem: there's no need for your macro to be a macro
21:25Bronsa, ((fn [vals & preds] (reduce + (for [p preds] (if (apply p vals) 1 0)))) [2] odd? even? pos?)
21:25clojurebot2
21:26arrdemBronsa: this is entirely true
21:26dsrxcoventry with the slam dunk
21:26arrdemdsrx: basically
21:28Raynesarrdem: (defn count-true [input & preds] (->> input ((apply juxt preds)) (filter true?) (count)))
21:29Bronsadsrx: I switched to ERC for paredit, turns out it's annoying to have paredit in ERC.
21:29Raynescoventry's is smaller, so he wins. <3
21:29BronsaRaynes: but yours uses juxt.
21:29RaynesMine also makes sure that the predicates are actually returning true.
21:29RaynesAnd not some other truthy value.
21:29RaynesIf that matters.
21:29dsrxBronsa: yeah but i could at least conditionally edit it
21:29arrdemI should write an M-x clojure-refactor that pastes to channel...
21:30dsrxi mean enable it
21:30arrdemthanks guys.
21:30justin_smitharrdem: am I missing something, or is thre nothing in that pred-count definition you pasted that requires it to be a macro
21:30Bronsadsrx: now I just write snippets in *scratch* and paste it here if I need to
21:30arrdemjustin_smith: no you aren't. I was just being silly.
21:40cljrdoes the client part of aleph's tcp require an aleph tcp server on the other side or can I ccommuinicate with any tcp server with it?
21:42justin_smithcljr: you should be able to connect to any server implementing the required protocol
21:43justin_smithie. if you need http web-sockets the other server should support http web-socket connections etc.
21:43justin_smiththe example on the aleph github page prints out tweets, and I am sure twitter is not running aleph
21:49cljrhttps://github.com/ztellman/aleph/wiki/TCP#tcp-clients
21:50cljrjustin_smith: so if i have a tcp server on the other side, sending it dat is as simple as using (enqueue ...)?
21:51bitemyapparrdem: you don't need a macro.
21:51justin_smithcljr: for enque you need a websocket to communicate with
21:52justin_smithcljr: it is not a standard http send/response cycle, but a websocket that stays open with a stream going each way
21:52cljrjustin_smith: in that link i gave, the tcp example uses enqueue, i dont think it is specific to websockets
21:53justin_smithwebsockets are implemented on top of tcp
21:54justin_smithhttp does the handshake, but you need a server that understands websockets to communicate in that way (and a handler on the server that actually interacts with you via a websocket of course)
21:55justin_smithor you could use some other protocol - aleph abstracts over that stuff, you may need to set it up on the lamina level, regardless each end needs to be expecting the same protocol
21:56cljrjustin_smith: i only need raw tcp, it had seemed as though alpeh could do that. i dont need http or websockets currenctly
21:57cljrwiki page made it seem like that anywqqay
21:58bitemyappjustin_smith: HTTP is implemented on TCP.
21:58cljri can tell that my server is accepting the connection
21:58justin_smithbitemyapp: yes it is
21:58justin_smithbitemyapp: but web sockets are not implemented in http, that was the distinction I was making
21:59bitemyappjustin_smith: just mentioning the symmetry.
21:59justin_smithahh, yeah
21:59bitemyappsome people think websockets are magical because they've never written a TCP socket server.
21:59justin_smithright
21:59bitemyappand those people are...*puts on his nice person hat*...silly.
22:00hyPiRionpeople who haven't written a TCP socket server?
22:00justin_smithbitemyapp: but websockets aren't just raw tcp
22:00bitemyapphyPiRion: people who think anything that isn't HTTP is incomprehensible.
22:00hyPiRionoh, yeah
22:01justin_smithand then you can bring up UDP or serial comms and really blow their minds
22:01bitemyappalthough I can't say I entirely enjoyed figuring out the nrepl protocol given how sparse and terrible the documentation was.
22:01cljrjustin_smith: just to confirm with you, you are saying the tcp client on the wiki is not actually for raw tcp communications but requires a server to support websockets?
22:01bitemyappcljr: websockets are upgraded to from an HTTP connection.
22:01justin_smithcljr: actually I don't know that, I just suspected it
22:01justin_smithcljr: it could be raw tcp
22:02justin_smithhttps://github.com/ztellman/aleph/blob/perf/src/aleph/tcp.clj I was wrong, it is actually raw tcp
22:02justin_smithmea culpa
22:07justin_smithcljr: a good way to test out the tcp functionality would be to use ncat -l 2000 -k -c 'xargs -n1 echo'
22:07justin_smithit will just print whatever it gets
22:07justin_smithof course adjust -l as needed
22:11arrdembitemyapp: das dotas?
22:13arrdemand yes I am now well aware that I did not need a macro there
22:14xpeI'd appreciate an eye on my core.async question http://stackoverflow.com/questions/20485188/gracefully-exit-a-clojure-core-async-go-loop-on-kill
22:36yedi_you can make two-way channels with core.async?
22:37xpeyedi_ what do you mean? when you define a channel you aren't saying who can put and who can take
22:37xpea channel is just a queue. many writers. many readers.
22:38xpebut it has one direction
22:38Raynesyedi_: Stargate SG1
22:38yedi_https://gist.github.com/eggsby/6102537#file-net-cljs-L14
22:39xpeyedi_: ok... and... ?
22:40justin_smithyedi_: that is not a two way channel, it is a channel with a put and take method, where would the data come from or go to if you did not have both?
22:40justin_smithfor true two-way comms you need two of those
22:40yedi_i was just confused about how chord works ps://github.com/james-henderson/chord
22:41yedi_and how you could send to a channel and then take from the same channel, but not just get what you just sent to that channel
22:41yedi_but yea, nvm me
22:42xpeyedi_: I think the clearest rephrasing to "are channels two-way?" is "are channels bi-directional?" and the answer is no.
22:43danielszmulewiczjustin_smith: Thanks for helping, pal. So it turned out to be a filename issue which doesn't make sense.
22:43justin_smithoh, what was it?
22:44justin_smithand underscore versus dash issue?
22:44danielszmulewiczSo here it goes: on my local development machine, I have two files.
22:44danielszmulewiczOne is named imagiLena.md, the other imagiLena-about.md
22:44danielszmulewiczio/resource can access them both
22:45danielszmulewiczOn my production machine, Debian system, it barfs on imagiLena-about.md
22:45xpei'll ask my core.async question in a simpler way: I want to make a Clojure daemon that has a go loop at the top level. currently, when I do that, it exits right away.
22:45danielszmulewiczWhy? No idea.
22:45danielszmulewiczI just changed the filename to about-imagiLena.md, and then it's OK.
22:46justin_smithwhat is the barf? just a nil return from the resource?
22:46danielszmulewiczyes
22:46justin_smithvery weird, yeah
22:46danielszmulewiczBeats me.
22:46xpeyedi_: did you get it figured out?
22:48coventryxpe: A go loop returns a channel. I think you have to do something with that channel for the go body to execute. http://clojure.github.io/core.async/#clojure.core.async/go
22:48danielszmulewiczjustin_smith: It's really nice to be able to fire a repl on a running production system, though.
22:49xpecoventry: in my understanding, the caller only get the go loop return value when the go loop finishes "Returns a channel which will receive the result of the body when completed"
22:50xpein the examples I'm looking at, just evaluating the go loop is enough to start it
22:50coventryYou're right.
22:50xpecoventry: in the REPL, my go loop definitely starts and pegs the CPU too
22:51xpecoventry: I think I just should start a normal thread for my top-level event loop, at least with Java as a host
22:51xpeI looked at a CLJS example that used a go loop at the top level, which makes sense in that context
22:52xpeand INSIDE that top-level loop, then I should use go blocks (maybe)
22:53coventryTry hanging on to to the return value and doing a blocking read on it.
22:54xpecoventry: ah, maybe to avoid GC?
22:54xpenice idea
22:54coventryThat's what I'm thinking. Don't know, though.
22:55xpein any case, i'm doing `lein run` so some thread will have to just spin its wheels to keep the whole JVM from shutting down
22:57justin_smith,(Thread/sleep Integer/MAX_VALUE)
22:57clojurebotExecution Timed Out
22:57xpejustin_smith: you read my mind
22:59hyPiRion(.start (Thread. #(deref (promise)))) ?
22:59xpe,(do (Thread/sleep 5000) (println "foo"))
22:59clojurebotfoo\n
23:00justin_smith,(pr-str (/ 1.0 0.0))
23:00clojurebot"Infinity"
23:00justin_smith,Infinity
23:00clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: Infinity in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:00justin_smiththat is weird
23:00xpe,(do (Thread/sleep 60000) (print "hello clojurebot"))
23:00justin_smithwhy can't it read the thing pr-str returns?
23:00clojurebotExecution Timed Out
23:00gfredericksjustin_smith: there are lots of cases like that
23:00gfredericks,(pr-str (Object.))
23:00clojurebot"#<Object java.lang.Object@1fb26b6>"
23:00justin_smithoh, ok
23:01justin_smithbut I know #< stands for "unreadable"
23:01coventryjustin_smith: No one's really committed to making print-dup readable.
23:01hyPiRionguys, guys
23:01hyPiRion,(binding [*print-dup* true] (pr-str (/ 1.0 0.0)))
23:01clojurebot"Infinity"
23:01hyPiRionprints Double/POSITIVE_INFINITY here
23:01hyPiRion&(binding [*print-dup* true] (pr-str (/ 1.0 0.0)))
23:01lazybotjava.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!
23:01coventryhttp://dev.clojure.org/jira/browse/CLJ-1275
23:01hyPiRionbleh
23:02xpe&(do (Thread/sleep 20000) (print "hello lazybot"))
23:02lazybotExecution Timed Out!
23:02xpe&(do (Thread/sleep 10000) (print "hello lazybot"))
23:02lazybotExecution Timed Out!
23:03gfredericksxpe: binary search?
23:03hyPiRion/msg lazybot &(your command here)
23:03xpegfredericks oooh! fun
23:03gfrederickshyPiRion: just be patient there's only O(log(20000)) tries left
23:04gfrederickslazybot: we will know your secrets
23:04coventryI can't find it, but there's another similar bug where Stuart Halloway says that fixing print-dup so that its output is fully readable is not a priority.
23:04xpe&(puts ",(puts \"haha\"")
23:04lazybotjava.lang.RuntimeException: Unable to resolve symbol: puts in this context
23:04echo-areaIsn't that dangerous? Will flood this channel with "hello lazybot"s
23:04xpe&(print ",(puts \"haha\"")
23:04lazybot⇒ ,(puts "haha"nil
23:05hyPiRionthose secrets are quite open, you know
23:05justin_smithsomeone made a botquine had the bots pingponging one another, I think they ignore one another now
23:05hyPiRion&(do (Thread/sleep 9500) (pr 'hello 'lazybot))
23:05gfredericks~botstack
23:06clojurebot/me puts lazybot on his head and gropes blindly for a third bot to complete the stack.
23:06lazybot⇒ hello lazybotnil
23:06hyPiRionjustin_smith: http://clojure-log.n01se.net/date/2012-12-17.html#22:30
23:06hyPiRionoh hey, soon anniversary
23:07justin_smithit happened around the time I first started hanging out here
23:08gfredericks(inc lazybotnil)
23:08lazybot⇒ 1
23:10xpe,(print ",(print \"1\")")
23:10clojurebot,(print "1")
23:10xpehyPiRion: hence the trick above I suppose :)
23:11hyPiRionyeah
23:11justin_smith&(pr 'linnauS Suan)
23:11lazybotjava.lang.RuntimeException: Unable to resolve symbol: Suan in this context
23:11justin_smith&(pr 'linnauS 'Suan)
23:11lazybot⇒ linnauS Suannil
23:12justin_smithspelled it wrong, and capitalized it wrong
23:15sritchiehow are you guys using timbre?
23:18gdevi'm not =(
23:21sritchiehaha
23:21sritchieI'm looking at the nice "appender" abstraction,
23:21sritchieand realizing that I just don't know how to write log statements well
23:22fakedrakehello
23:24fakedrakeIs there an easy way to do (apply -> x list-of-eval-lists)?
23:24gdevsritchie, me too, thats why I just punt on logging and store all application events into datomic
23:24sritchiegdev: so you have some data structure format for everything that happens, and just dump it for later/
23:25sritchiegdev: I'm trying to do better logging via Riemann
23:25coventryfakedrake: Can you give a more specific example?
23:25sritchiegdev: and just trying to figure out whether to fire to riemann directly via a stats-d like interface, or hit it via a timbre logging appender,
23:25sritchieor just send absolutely everything and index into datomic, for example
23:26sritchiegdev: but yeah, it suddenly became clear that even after years of "log processing" in the big data world, what-to-log-and-when-to-log best practices are really rusty for me
23:27fakedrakecoventry: i have a list of strings and I want them to be replaced by themselves surrounded by spaces
23:27fakedrakehttps://github.com/bitsai/lisp-in-clojure/blob/master/reader.clj
23:27fakedrakelike the tokenize fun here, only I want my list to be variable
23:28gdevsritchie, yeah and then you have to figure out what level to log everything
23:31sritchiegdev: so datomic
23:31sritchiegdev: can you get very far with their "pro starter"?
23:32gdevsritchie, dunno yet, ask me in a month
23:34coventryfakedrake: You should make them fns and use reduce.
23:34gdevsritchie, but yeah, probably so
23:36fakedrakecoventry: reduce! yes! thank you
23:40danielszmulewiczso lein trampoline won't work when cljsbuild is used in the project?