#clojure logs

2013-03-30

00:05tjgilliestrying to ask ruby people if theres datalog/linq stuff in ruby and i can almost see them scratching their heads
00:05gtraktjgillies: you mean like a dsl?
00:05gtrakthey love those
00:06tjgilliesheh
00:06tjgillies[09:06:29pm] <lewis1711> tjgillies: "filter" is called "find_all" or "select" in ruby, mapping cons over two lists is the zip method. do you have a specific question?
00:07tjgilliesi pasted some clojure example code in and someone asked me if i knew what blocks where
00:07tjgillieswere*
00:10tjgilliesim trying to use friend but when i reload-all on my main namespace all of a sudden i start getting No implementation of method: :read-session of protocol: #'ring.middleware.session.store/SessionStore found for class: ring.middleware.session.memory.MemoryStore
00:10tjgilliesanyone ever run into that
00:17`arrdemis there a reason that lein 2.1.0 tests still use the (:use) semantics? I thought that #clojure had unofficially depricated use.
00:18nonubyhmm.. can you partial a defmulti?
00:18`arrdemyou shouldn't...
00:18`arrdemI wouldn't think at any rate.
00:19technomancy`arrdem: just an oversight
00:19hyPiRion`arrdem: Like in the template, you mean?
00:19`arrdemtechnomancy: dibs on the patch!
00:19`arrdemXP
00:19hyPiRionso I guess :require :refer :all then
00:19hyPiRion`arrdem: fire it up
00:20`arrdemhyPiRion: yup, idiotic but there.
00:20technomancyyou got it
00:23`arrdemdone.
00:25hyPiRion`arrdem: Could you fix it for the other templates too?
00:26`arrdemhyPiRion: sure.. gimme 30 to try and turn this project in before the deadline
00:26hyPiRionApp at least
00:26hyPiRionok, sweet
00:28gtrakI made a little runtime disassembler library and lein-plugin: https://github.com/gtrak/no.disassemble/
00:35`arrdemtechnomancy: I could hug you over lein packaging uberjar and the repl
00:39technomancyhttp://www.lakupo.com/qu/ghacks/userpics/philippe-hugs.jpg
00:40`arrdemlol
00:41technomancyhttp://www.lakupo.com/qu/ghacks/userpics/philippe-hugs.jpg
00:41technomancyoops
00:41technomancyhttp://www.lakupo.com/qu/ghacks/userpics/philippe-breakdance.gif
00:44technomancyone more and then I'm gone: http://p.hagelb.org/two-timing.gif
00:45technomancygood night everyone
01:09ambrosebsgtrak: cool!
01:11tomojgtrak: I was just wishing for that recently
01:13tomojunfortunately I don't understand bytecode
01:14tomojbut this would be the only way to tell whether you're getting boxing in a big composition that's supposed to transmit primitives, yes?
01:15cvk_hi all
01:17ambrosebstomoj: jvm.tools.analyzer could give some hints. I think the compiler inserts calls to RT/box, you could use emit-form to inspect the AST.
01:17ambrosebstomoj: but gtrak's library is probably easier to digest.
01:17tomoj!!
01:17tomojI was thinking exactly the opposite
01:18cvk_hi all
01:18cvk_i am just starting to learn clojure
01:18cvk_any book recommendations?
01:18ambrosebstomoj: well there's no disputing the bytecode :)
01:19tomojmaybe it's easier if you understand bytecode? :(
01:21ambrosebstomoj: It seems easy enough to get the general idea of what's going on, especially if you're looking for whether boxed or primitive methods are being called. It looks like all types are explicit
01:21ambrosebstomoj: just speculating of course.
01:58tjgilliesdoes trampoline slow down startup time?
02:03jasonjckntjgillies: yes
02:03jasonjckntjgillies: https://github.com/flatland/drip
02:04tjgilliesjasonjckn: thnx
02:04tjgilliesjasonjckn: does it work with leiningen?
02:06jasonjckntjgillies: i think so
02:07jasonjcknnot sure
02:09tjgilliesanyone know if theres a link to the different clojure datastructures and what they're good for?
02:09tjgilliesthe docs just have what methods work with them
02:09tjgilliesbut for example, im interested in what kinda of data hashsets are good at
02:10tjgilliescurious why datomic uses them for result set
02:10tjgilliess/kinda of/kind of/
02:11tomojyou mean java.util.HashSet in particular?
02:12tjgilliesclojure.lang.PersistentHashSet
02:12tjgillieswhich im assuming is very similar
02:12tjgilliesim not a ruby guy
02:12tjgilliesjava
02:12tjgilliesfreudian slip
02:13tjgilliesdoh
02:13tomojwell, a query result just is a set
02:13tjgilliesmy brain is shot, lonf week heh
02:14tomojso my answer is "sets are good for sets" :(
02:14tjgillieswhats the difference between hashset and set
02:14tjgilliesthats my entire question
02:14tjgilliesi realize sets are good for storing set data, i mean thats kinda obvious
02:14tjgillieswhy make an additional datastructure
02:16tjgilliesfrom javadoc: This class offers constant time performance for the basic operations (add, remove, contains and size), assuming the hash function disperses the elements properly among the buckets.
02:16tjgilliesmaybe to have constant time on set operation?
02:16tomoj'hash set' is just a class of implementations of sets
02:16tomoj&(class (set [1 2 3]))
02:16lazybot⇒ clojure.lang.PersistentHashSet
02:17tomojs/class/kind/
02:17tjgilliesah
02:17tomojit's sort of the default set, the other choice is a sorted one which has worse performance but the benefit of being sorted
02:17tjgilliesso set and hashset are synonymous then essentially?
02:18tjgilliesaaaah
02:18tjgilliesgotcha
02:18tomoj'set' _usually_ means a PersistentHashSet in clojure, yeah
02:18xeqitreeset?
02:18tjgilliesok so hashset is the default set which is unsorted
02:18`arrdemhyPiRion: other pull request in
02:18tomojbut anything that implements java.util.Set could be called a 'set' as well
02:18`arrdem'evening gents, I'm lisped out for the night.
02:18tjgilliesnight
02:18tjgilliesim lisped out as well, yet here i am ;)
02:19tjgillies(inc tomoj)
02:19lazybot⇒ 8
02:19tomoje.g. I believe datomic actually returns java.util.HashSet results
02:19tjgilliesyou're right
02:20tjgillieswith datomic we have persistent-persistent-datastructures ;)
02:23tomojPHS has "effectively constant" (i.e. O(log n)..) operations while HashSet is really constant
02:25tomojI sort of wish you could get a reducer of query results
02:25tomojthen let us choose whether we want to stick it in a HashSet or a PHS or don't stick it anywhere
02:26amalloytomoj: well, j.u.HashSet is amortized-constant, not actual-constant, right?
02:27tomojlazybot: karma amalloy
02:27lazybotamalloy has karma 47.
02:27amalloyit's weird because you can add in arbitrary objects which all hash-collide
02:28tomojI dunno, but I'm assuming you're right :)
02:36amalloyi'm probably wrong about amortized-constant, but there are definitely weird corner cases somewhere
02:45alex_baranoskydoes robert.hooke work with protocol functions?
03:00amalloyalex_baranosky: probably not
03:01amalloyextending a protocol function does funny stuff to the var
03:06amalloyand technomancy hates protocols, so maybe he never tested it
03:07tomojI can't imagine how it could possibly work
03:12tomojoh, actually, it should be able to work, huh?
03:15tomojlooks like it only works for, uh, 'dynamic' implementors?
03:15tomoji.e. not (deftype Type [] Protocol)
03:15tomojhttps://www.refheap.com/paste/e7d587fdefa68621367eb0ad9
03:16amalloytomoj: now try extending a new type to the protocol and see if the hooke is still in effect
03:16tomojnope
03:16amalloymy money is on it not working
03:17tomojI see, I thought you meant the protocol var
03:17tomojevery time you extend-type all the protocol fn vars change
03:19tomojguess that's so the caches are cleared
03:25tomojhah: <p class="bdfl"><a name="11:33">11:33</a> <b>rhickey: </b>,((fn [[a b]] [b a]) [1 2])</p>
04:07lnostdalhi guys, the TIME macro is nice, but is there something more advanced around? .. say, something that lets me do something like: (dotimes [i 10000] (time :section-a (operation-a)) (time :section-b (operation-b))) which will print out totals for search section after all iterations – and similar?
04:07lnostdaltotals for each*
04:07Raynes$google benchmarking clojure
04:07lazybot[How to benchmark functions in Clojure? - Stack Overflow] http://stackoverflow.com/questions/3041299/how-to-benchmark-functions-in-clojure
04:07RaynesBah!
04:08Raynes$google criterium clojure
04:08lazybot[hugoduncan/criterium · GitHub] https://github.com/hugoduncan/criterium
04:08Rayneslnostdal: ^ This is presumably the most popular tool for benchmarking Clojure.
04:08RaynesDunno if it does what you want in particular, but it might.
04:08lnostdalawesome; will check out, Raynes
04:32finishingmove$google real world haskell
04:32lazybot[Real World Haskell] http://book.realworldhaskell.org/
06:36Glenjaminxeqi: are you about? I've got a quick peridot question
06:37Glenjamincurrently the cookie jar only accepts one of the three date-time formats, noticable it doesn't support the one ring.cookies uses when you pass a clj-time object
06:57Glenjamini'm thinking i'll put together a patch to use clj-time like ring-core
08:00gtraktomoj: ambrosebs: yes, checking for primitives was a main reason I made it
08:07pyykkis_hi, I'm trying to set nrepl not to pop up stack trace and added '(setq nrepl-popup-stacktraces nil)' to init.el
08:08pyykkis_however, it doesn't to make any difference? Am I missing something? I also tried evaluating it with C-x-C-e, but stack traces are still popping up.
08:09borkdudeRaynes what is your favorite web framework/lib for Haskell to build something simple?
08:14papachanhello
08:18papachanI am just trying to generate a jar from the book example Clojure Programming. but i cant load my class
08:18papachanhttp://paste.ubuntu.com/5661100/
08:50gtraktomoj: you could always look at the bytecode with javap, but that requires AOT, this works fine at a REPL
08:54gtrakit's good for convincing people of how eval works :-)
09:12jemafellerhello!
09:12jemafelleri have great news!
09:12jemafellerafter I got really depressed over clojure vs scala vs java performance (each using its own typical Web framework)
09:13jemafellerI realized I was benchmarking Java and Scala each through running a jar, and clojure through 'lein run'
09:13Pupnikdid that make clojures performance look really bad?
09:13jemafellerwhen I was about to ship the Clojure version to a different server I had to make an uberjar. then I thought to benchmark it one last time
09:14jemafellerand this time I was getting results the fastest! (fastest was Scala)
09:14jemafellerPupnik, it made from 4700req/s to 6600req/s
09:15jemafellerScala, using Scalatra did a 6200req/s
09:15jemafellerJava with drop wizard 5500req/s, and Node.js a pity 3090 req/s
09:16jemafellerDropwizard is the heaviest of the lot, but I *am* trying to pick a standard for each platform (for clojure, I picked bare ring)
09:17jemafellerso its not really an apples to apples comparison - but I am picking what an average to intermediate developer would pick
09:17jemafellerNodejs forced me to drop to a bare 'http' implementation too.
09:18jemafelleranyway, this is a great feeling. made the decision very easy right now.
09:18weavejesterWith regard to performance, Ring current piggybacks off Java servlets a fair bit for most adapters, so there's a fair amount of potential improvements to be made.
09:19jemafellerweavejester, what do you mean?
09:19jemafellerisn't everyone using Servlets in the Java world this way?
09:19weavejesterWell, for instance, servlets parse cookies and parameters, and Ring parsing them with middleware, so there's some redundency going on there.
09:20jemafellerah, I see
09:21weavejesterSomething that hooks into Ring more directly would be faster, although Ring+Servlets seem to be faster than a lot of things even with the redundency
09:21weavejesterOut of interest, how did the "lein run" vs jar affect the Clojure results?
09:21jemafellerweavejester, if you mean how it works internally - I have no idea
09:21jemafellerI was sure there wasn't any difference
09:22jemafellerbut when I ran the benchmarks on a standalone jar, I went from 4700r/s to 6600r/s
09:22squidzIn clojure I want a function that takes other functions optionally as parameters. How can I evalutate those functions then. Example (defn myfun [& fns] (evaluate? fns))? Is there anything like this?
09:23squidzI dont want to use macro stuff is possible
09:23jemafellerI'm running on a Sun JDK 1.6 if that matters
09:26hyPiRionsquidz: huh? ##(let [f (fn [x] (x))] (f #(pr 'foo)))
09:26lazybot⇒ foonil
09:27squidzokay I see I just have to pass the function names without surrounding parens in the parameters. Then in the body of myfn call by surrounding with parens
09:27hyPiRionyeah
09:28squidz(defn myfun [& fns] (for [f fns] (f))) then => (myfun someotherfn)
09:28jemafelleris there any advantage of using future-like constructs over things like pmap and spinning a thread?
09:29borkdudewould this be worth looking into? http://http-kit.org/
09:30jemafellerborkdude, you mean in my case?
09:30borkdudejemafeller yes
09:30borkdudejemafeller never tried it myself though
09:30jemafellerborkdude, I did, but I filed it as 'low level' and more for concurrent connections. I love that i'm using Ring here and not a much lower level construct
09:30azkanesquidz: if you want those functions to perform side effects you could do (doseq [f fns] (fns)), you can pass any number of arguments to it
09:31jemafellerin the same way I could have just dealt with "raw" Servlets or "raw" Netty
09:31squidzazkane: yeah thats what im doing. Im wrapping the calls up in a do. I was overthinking the problem when actually clojure makes it very simple. God I love it
09:32jemafellerat first I thought it was a stunt to get a "1M connections with Clojure" on HackerNews
09:32borkdudeI'm wondering why most of the http-kit code is written in java
09:32jemafellerbut later I saw it was a real maintained project :)
09:32rebcabin_what is the difference between keywords :foo and ::foo? I'm in user namespace in repl; :foo prints as :foo and ::foo prints as :user/foo, and these seem "same only different"
09:33borkduderebcabin_ those are namespace qualified keywords: http://kotka.de/blog/2010/05/Did_you_know_III.html
09:35rebcabin_borkdude: ty
09:36jemafellerborkdude, as I noted, I think it was an attempt to maximize performance in a way that appear low-levelish
09:49borkdudecemerick congrats on one year of clojurebook ;-)
09:50rebcabin_(= ::foo :user/foo ::user/foo)
09:51jemafellerIf during a request, the server needs to download a file and run a C++ tool on it for analysis, every request, what would be the best way to do it?
09:52jemafelleron node.js it's clear since everything is async.. but on Clojure?
09:53borkduderebcabin_ that's only true when evaluated from user
09:53rebcabin_right! i see that
09:56rebcabin_(in-ns 'bar) (clojure.core/= :user/foo ::user/foo)
09:56rebcabin_::foo ~~> :bar/foo
10:06cemerickborkdude: heh, thanks
10:19rebcabin_I can write "identity" as "(fn [x] x)" but not as "#(%)" ... "#(%)" is something, but what is it? ((#(%) 42) fails with ~"can't cast to IFn"~
10:20rebcabin_oops one too many open paren: i meant "(#(%) 42)"
10:22hyPiRionrebcabin_: Try macroexpanding it
10:22hyPiRion,'(macroexpand-1 '#(%))
10:22clojurebot(macroexpand-1 (quote (fn* [p1__35#] (p1__35#))))
10:22hyPiRionbleh
10:22hyPiRion,(macroexpand-1 '#(%))
10:22clojurebot(fn* [p1__70#] (p1__70#))
10:25squidzwhen I try to pass a function as a parameter to another function in clojurescript and then try to call that function by surrounding it with parens, i get a error telling me that the function passed in as a paremeter isn't a function
10:26squidzis this a bug?
10:28randomendusercan I send code to be evaluated to an nrepl server (that's active in another terminal) via curl/netcat/telnet/whatever and see the output in that active terminal?
10:34squidzhere is what is giving me a problem https://www.refheap.com/paste/13115 I guess the javascript isnt recognizing the parameter(named withparameters) as a function
10:35squidzis there a way I can hint that a function argument is of the type function for clojurescript?
10:39rebcabin_hyPiRion: ty
10:51pyykkis_hi, I'm trying to set nrepl not to pop up stack trace and added '(setq nrepl-popup-stacktraces nil)' to init.el
10:51pyykkis_however, it doesn't to make any difference. Am I missing something? I also tried evaluating it with C-x-C-e, but stack traces are still popping up. Any help?
11:02`arrdemmornin
11:03`arrdemhyPiRion: thanks for the rebase help, that's the one git command I haven't mastered yet
11:04hyPiRion`arrdem: oh no problem, thanks for the fix :)
11:15klangpyykkis_: you need to M-x customize-variable and type in nrepl-popup-stacktraces to modify the value of the variable, I think.
11:18klangpyykkis_: Then, toggle the variable and save the state for future sessions (that will use the right notation in the file you have set custom-file to point at)
11:27borkduderedinger #(-> %)
11:28borkdudesorry I meant rebcabin_
11:29hyPiRionor #(do %) too
11:29hyPiRionI with there were more succinct and evident names for stuff, really
11:29rebcabin_borkdude & hyPiRion: nice!
11:30hyPiRionidentity and partial in particular
11:30borkdudehyPiRion just id
11:31borkdudehyPiRion partial application, special reader macro for it?
11:31hyPiRionborkdude: nope, not in Clojure
11:32borkdude#$(+ 2) for example?
11:32hyPiRionI think Haskell implicitly do partial application, but Raynes would know more about that than I do
11:32borkdudehyPiRion Haskell has currying
11:32hyPiRionhm
11:32borkdudehyPiRion one reason this is not possible in clojure is the possibilty of varargs, if I remember correctly
11:33rebcabin_in Haskell sometimes called sectioning: "+ 2" same as clojure (partial (+ 2))
11:33hyPiRionborkdude: yeah, I know
11:33borkdudeyes, what about having partial as: $(+ 2) would that work?
11:34rebcabin_would work for me if just reader syntax for partial
11:34rebcabin_$ i mean
11:35pyykkis_klang: thanks, I'll try that
11:35hyPiRionTheoretically you could just make such one right now with tagged literals
11:35borkdude(map $(+ 2) (range 10)) instead of (map (partial + 2) (range 10))
11:35hyPiRionWell, with #$ that is.
11:36`arrdemuergh custom readers...
11:37`arrdemhyPiRion: are #-prefixed readers less evil? I remeber looking at this a while ago and there are crobars involved for non-prefixed readers.
11:38hyPiRion`arrdem: I wouldn't say less evil. It just has the standard # before it.
11:38hyPiRionThey were designed to represent data though, not shorten production code
11:40`arrdemyeah.. I get why custom readers make code less maintainable and the reader less stable but I for one would appreciate being able to do such a thing on occasion.
11:41borkdudewell, we could always (def $ partial) and write ($ + 2) instead of $(+ 2)
11:42hyPiRionyeah, that's even better
11:42xeqibut I want my clojure to look like jquery
11:42`arrdemwat
11:43hyPiRionxeqi: and I want my Clojure to look like brainfuck
11:43xeqiaren't you succeeding?
11:43hyPiRionCan't satisfy everyone, eh
11:43jouiswalkerlol
11:43`arrdem(nc hyPiRion)
11:44hyPiRionHere, let me inc myself
11:44hyPiRion,'(inc hyPiRion)
11:44clojurebot(inc hyPiRion)
11:44hyPiRionoh dangit, he actually made lazybot ignore clojurebot.
11:44`arrdembots ignore each other and themselves...
11:45borkdudeare ibooks readable on anything other than an iOs device (which I don't own)?
11:45`arrdemif you want bf*ck in clojure it should be pretty doable..
11:45hyPiRionxeqi: well yeah, I'm getting surprisingly close. Now I only need to figure out how to replace ns-map, and I have a working hello world without a single alphanum
11:46hyPiRion`arrdem: https://github.com/hyPiRion/hello-swearjure
11:46hyPiRionEven the project.clj is like that.
11:47`arrdemhyPiRion: oh I was talking about a literal brainf*ck implementation
11:47`arrdemnot your arithmetic evil
11:47hyPiRionoh :(
11:47borkdudehyPiRion what is the rationale behind swearjure?
11:48jouiswalkerthat is so beautiful
11:48hyPiRionborkdude: Well, using many different characters is complecting your workflow. My goal is to reduce the amount of characters to decomplect work and make it simple.
11:48hyPiRiondifferent characters.
11:49`arrdemthat is the WORST rational I've heard in months
11:49`arrdemwell done
11:49hyPiRionthank you
11:49borkdudehyPiRion are there any plans for a special keyboard (layout) to support swearjure
11:49hyPiRionI made it up just now. Seriously though, it's just for fun, there's no value behind it.
11:50hyPiRionborkdude: Don't give me ideas, man.
11:50`arrdemoh please forget ideas I can deliver on that one.
11:51`arrdemhttp://www.ergodex.com/mainpage.htm
11:51`arrdemdo some statistics on the swearjure source and arrange keys appropriately
11:51`arrdemyou're probably gonna want arrow keys, ( ) + and *
11:52`arrdemmaybe [ ] ~ ` and @
11:52`arrdem% can't forget %
11:52hyPiRionand #
11:53`arrdemthat's like 80% less keyboard! think of all the time you'll save on hunting and pecking!
11:53xeqiohh, it might even make a cell phone a decent dev environment
11:53jouiswalkerwe need to start translating shakespeare into this more efficient language
11:54pyykkis_klang: d'oh, it turned out I was running an old version of nrepl.el. Thanks, your help led me eventually to the right direction.
11:54jouiswalkerrhymes can probably be handled by emacs indentation
11:57`arrdemjouiswalker: as long as we're doing terible things with emacs lisp, lets impliment clojure on top of it!
11:57`arrdemthen we get the best of the One True Editor and the better Lisp!
11:58jouiswalkerlol
12:12klangpyykkis_: you are welcome :-) (my stacktraces are now turned off too, nice)
12:35`arrdemI love when libraries get abandoned...
12:35jeremyheiler`arrdem: It's the best.
12:36jeremyheilerWhat library are you looking at right now?
12:36`arrdemhttps://github.com/jkk/loom
12:37`arrdemI need some sort of directed graph structure for my compiler and that seems to be the only toolkit to fit the bill.
12:37squidzdoes anybody know why I cant use an optional parameter with (defn fn [fst & rest] ...) when rest is a function? When it isnt an optional parameter it works fine. Im using clojurescript btw
12:38jeremyheilersquidz: Don't name the varargs rest then?
12:38jeremyheiler`arrdem: Is there anything wrong with the lib?
12:39`arrdemjeremyheiler: probably not just laughing that there's a feature add pull request sitting unattended for two months
12:39jeremyheiler`arrdem: heh yeah
12:39squidzjeremyheiler: thats not the actual name of the parameter. That was just an example. My func signature looks like this (defn switch-view [content & withlisteners] ...)
12:40jeremyheilersquidz: How are you using withlisteners? That points to a seq.
12:41squidzjeremyheiler: I was just tryint to pass one function to it, with the plan that I could tack on further function if needed. Do I need to wrap the function into some kind of collection?
12:42jeremyheiler`arrdem: GitHub shows jkk hasn't had any activity on GitHub in the past 2 months, who knows. I know him personally, so I hope he's doing ok.
12:43jeremyheilersquidz: No, the varargs come in a seq, so if the function is the first optional arg, then you can grab it by saying (first withlisteners).
12:43Raynesborkdude: I was never fond of any of the Haskell web frameworks, but Yesod seems to be the most popular.
12:44dnolen,((fn [x & r] [x r]) [1 (fn [])])
12:44clojurebot[[1 #<sandbox$eval35$fn__38 sandbox$eval35$fn__38@18e865b>] nil]
12:44dnolen,((fn [x & r] [x r]) 1 (fn []))
12:44clojurebot[1 (#<sandbox$eval73$fn__76 sandbox$eval73$fn__76@74a506>)]
12:44dnolensquidz: ^
12:44dnolensquidz: note that r is a seq containing the extra parameter
12:46squidzdnolen: jeremyheiler: this is what it looks like https://www.refheap.com/paste/13119
12:48dnolensquidz: the problem is the for, for is *lazy*, you probably want doseq
12:49squidzdnolen: thanks dnolen that was exactly the problem
12:49dnolensquidz: np
13:18borkdudeRaynes thanks
13:18supersymis there a good reference for clojure packages without all the personal forks?
13:19borkdudesupersym there is clojuresphere and clojure toolkit (just google)
13:19supersymthnx :)
13:21borkdudesupersym I meant http://www.clojure-toolbox.com/
13:31deanHey guys, just having a go at learning clojure. I'm trying to use core.logic to solve the irregularity of distributions problem (http://en.wikipedia.org/wiki/Irregularity_of_distributions). So far I have: http://pastebin.com/QJnNQ2Gr but when I try to run it I get:
13:31deanClassCastException clojure.lang.LazySeq cannot be cast to clojure.lang.IFn clojure.core.logic.Substitutions (logic.clj:410)
13:31deanAnd i'm not really sure what it's referring to.
13:34supersymits expecting a function but you pass it a sequence?
13:50jeremyheilerAnybody here familiar with Kern, or parser combinators in general? I haven't been able to figure out how to repeatedly parse input with a single parser until the end. https://www.refheap.com/paste/13120
14:31thalassios_xelonhelo :)) i used to use (pst) to print stack trace,i updated in clojure 1.5.1 i think it doesnt work..
14:31thalassios_xelongow to print stack trace in clojure 1.5.1?
14:32thalassios_xelonit says CompilerException java.lang.RuntimeException: Unable to resolve symbol: pst in this context, compiling:(NO_SOURCE_PATH:1:1)
14:33jeremyheilerthalassios_xelon: (pst) is part of the clojure.repl namespace. Are you sure that it is loaded?
14:34thalassios_xeloni use counterclockwise
14:35thalassios_xelon(clojure.repl/pst)
14:35thalassios_xelonClassNotFoundException clojure.repl java.net.URLClassLoader$1.run (:-1)
14:35dnolenthalassios_xelon: you need to require it first
14:36thalassios_xelonin the past it did it automatically
14:36thalassios_xelonthey changed that?
14:37thalassios_xelon(:require clojure.repl/pst)
14:37thalassios_xelonCompilerException java.lang.ClassNotFoundException: clojure.repl, compiling:(NO_SOURCE_PATH:1:1)
14:39dnolenthalassios_xelon: (require 'clojure.repl) doesn't work at the REPL?
14:40thalassios_xelonwhat to write in my repl to see the stack trace? i used to just print (pst)
14:40thalassios_xelon(require 'clojure.repl/pst)
14:40thalassios_xelonFileNotFoundException Could not locate pst__init.class or pst.clj on classpath: clojure.lang.RT.load (RT.java:443)
14:41thalassios_xeloni just updated the counterclockwise,i dont know what happened
14:43ivanthalassios_xelon: 1.5 fixed a bug that dumped `pst` into every namespace
14:44thalassios_xelonivan how to use it,in 1.5?
14:45thalassios_xelonwhat to write in my repl to see the stack trace?
14:45hyPiRion,(require '[clojure.repl :refer [pst]))
14:45clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
14:45hyPiRion,(require '[clojure.repl :refer [pst]])
14:45clojurebotnil
14:45hyPiRion,(pst)
14:45clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to java.lang.Throwable>
14:45hyPiRionlike that, I suppose
14:46thalassios_xelonthx thx :)
14:46hyPiRionnp
15:28edbondenlive question: how to select tag with text? [:title (html/text-pred #(re-matches #"2012" %))] returns ()
15:28edbondplease help
15:29edbond[:title] returns {:tag ... :content (".....2012....") }
15:29tomoj&(re-matches #"2012" "foo bar 2012")
15:29lazybot⇒ nil
15:31tomojperhaps use re-find instead?
15:32tomojre-matches checks for a match to the whole string
15:41edbondtomoj: Yes, thanks a lot
15:42edbonddocstring not helpful for non-java person
15:45tomojalways confuses me too
15:49tomojwhy does nth work on Matchers?
15:49tomojcan't seem to make it useful
15:50tomojoh
15:50clojurebotexcusez-moi
15:51tomojnope, still don't get it
15:53amalloytomoj: so that you can destructure them
15:53tomojbut how?
15:53amalloy(not that i recommend actually doing this)
15:53tomoj&(let [[x] (re-matcher #"(foo)" "foo")] x)
15:53lazybotjava.lang.IllegalStateException: No match found
15:54tomojI guess you have to call some java method first?
15:55tomoj&(let [[x] (doto (re-matcher #"(foo)" "foo") .matches)] x)
15:55lazybot⇒ "foo"
15:55tomojI see..
15:55amalloy&(let [[x y] (doto (re-matcher #"(foo)" "foo") .find))] [x y])
15:55lazybotjava.lang.RuntimeException: Unmatched delimiter: )
15:55amalloy&(let [[x y] (doto (re-matcher #"(foo)" "foo") .find)] [x y])
15:55lazybot⇒ ["foo" nil]
15:56tomojhuh, I swear I tried ##(let [[x] (doto (re-matcher #"(foo)" "foo") re-find)] x)
15:56lazybot⇒ "foo"
16:14tomojgotta be a better way than this: https://www.refheap.com/paste/63a23eacdb4094df6ca3a6ed2 ?
16:14tomojthat doesn't make sense actually..
16:15tomojhttps://www.refheap.com/paste/0f28e38bf36a36f22b8ad09f4
16:15tomojproblem is to try (bar), and then 1) if no error was thrown, call foo with the result, otherwise call bar with the error
16:16tomoj..baz
16:16tomoj(try* (foo (bar)) (catch err (baz err))) sort of works
16:16tomojexcept that foo might itself throw an exception
16:17tomojguess this works https://www.refheap.com/paste/30804cfdcb8bdb4d0cdc942fa
16:18tomojer, https://www.refheap.com/paste/91a4595205d72c37e133f3970
16:36tieTYT2is there something like case that doesn't work on constants? I'd like one that works on regexes
16:36tieTYT2ah, cond maybe
16:36bbloomtieTYT2: condp =
16:37bbloom,(condp = 10 "foo" :string (* 2 5) :ten)
16:37clojurebot:ten
16:39tieTYT2nice
16:40tieTYT2,(condp = "foo" "foo" :string (* 2 5) :ten)
16:40clojurebot:string
16:41bbloom,(condp = :x (do (prn 1) :x) "x" (do (prn 2) :y) "y")
16:41clojurebot1\n"x"
16:41hyPiRioner
16:41RayneshyPiRion: Jesus.
16:41tieTYT2is there a predicate that sees if a regex matches a string?
16:41RayneshyPiRion: That package was at my doorstep today when I moved in.
16:41RaynesDidn't you literally send it last night?
16:41hyPiRionRaynes: Hi, I know.
16:41hyPiRionI did
16:42RaynesLike, it got here in like 12 hours.
16:42tieTYT2i always have to do a (not? (nil ... and I don't like that nesting
16:42RaynesThat's completely insane.
16:42hyPiRionAmazon's fast
16:42bbloomhyPiRion: (find-doc "regex")
16:42bbloomer i mean tieTYT2
16:42bbloomtieTYT2: (find-doc "regex")
16:42RaynesOooh, you bought it on amazon? I thought you shipped it from Norway.
16:42RaynesOkay, that makes more sense since the Amazon warehouse is right here.
16:42hyPiRionI said I would surprise you
16:43tieTYT2CompilerException java.lang.RuntimeException: Unable to resolve symbol: regex in this context, compiling:(NO_SOURCE_PATH:1)
16:43tieTYT2oops
16:43bbloomtieTYT2: c'mon now, you can solve that one on your own
16:43bbloomthis is me trying to teach a man to fish :-P
16:43RaynesI haven't had a chance to really look at the stuff yet because I'm unpacking.
16:43RaynesBut I will.
16:43hyPiRionhah, no worries
16:44tieTYT2i don't see anything in this list that's a predicate
16:44bbloomtieTYT2: what makes something a predicate?
16:45tieTYT2it returns a boolean
16:45bbloomtieTYT2: what about if it returns a truthy value or nil ?
16:46tieTYT2then I've gotta nest more parens which isn't ideal
16:46bbloom,(if :not-a-boolean true false)
16:46clojurebottrue
16:46tieTYT2i'll just turn one of these into a predicate
16:47tjgilliesanyone familiar with shoreleave know how to get a request object inside the remote function, it looks the only args it has are the args passed explicitly from the client
16:48bbloom,(condp re-matches "xyz" #"a.*" :foo #"x.*" :bar)
16:48clojurebot:bar
16:48bbloomtieTYT2: is that not what what you want?
16:49tieTYT2oh yeah that'll work
16:49tieTYT2I was going to do this:
16:49tieTYT2re-pred #(not (nil? (re-find %1 %2)))
16:49hyPiRionoh dear what
16:49tieTYT2and then use re-pred in the condp as the pred
16:49tieTYT2thanks
16:49bbloomtieTYT2: hence my question about what makes a predicate.... just because it doesn't end in a question mark doesn't mean it's not a useful as a predicate :-)
16:50tieTYT2Yeah I thought those rules only applied to if, I didn't know they work everywhere that wants a predicate
16:51tomoj,(macroexpand-1 '(condp re-matches "foo" #"f.*" 42))
16:51clojurebot(clojure.core/let [pred__80 re-matches expr__81 "foo"] (if (pred__80 #"f.*" expr__81) 42 (throw (java.lang.IllegalArgumentException. (clojure.core/str "No matching clause: " expr__81)))))
16:52tieTYT2ah
16:52tomojif someone does (if (true? (pred x)) ...) or something in their macro, they failed
16:53borkdudeIn C# a Predicate is a function that expects 1 argument and returns a boolean. In Clojure I think any pure function of one argument can be a predicate
16:54tomoj(doc condp)
16:54clojurebot"([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, its result-fn, which m
16:54tomoj"binary predicate" hmm
16:55tomojI think "predicate" is more about connotation
16:55hyPiRion=, <, >, >=, <=, etc
16:55tomojif I call "f" a predicate it just means I'm going to do (if (f ...) ...)
16:56hyPiRionThere's no semantics within Clojure which defines a "predicate", though they use to end with ?
16:57hyPiRioncondp is probably the only one which has the suffix-p from CL
16:57borkdude,(doc some)
16:57clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
16:57tomojI never know whether to name my predicate-sets with question marks or not
16:58borkdudetomoj ? means: returns a boolean, I think
16:58tomoj(def special-form? (into #{} (keys clojure.lang.Compiler/specials)))
16:58tjgilliesanyone know where i can find docs on what options are available to function args e.g. (defn foo [:keys blah :as bar])
16:58borkdudethis is why it's some and not some?
16:59tomojbut who cares whether it actually returns a boolean?
17:00tomojI mean, is there a problem having a question-marked fn _not_ return booleans?
17:00tomojI guess if you're going to (frequencies (map special-form? syms)) or something you care..
17:01tjgilliestomoj: it not very idiomatic ;)
17:01tjgilliesit's*
17:02hyPiRiontomoj: Well, there's actually one place where it would fail pretty hard
17:02hyPiRion,(keep #{:foo :bar} [:foo :baz :bar])
17:02clojurebot(:foo :bar)
17:02hyPiRion,(keep (comp boolean #{:foo :bar}) [:foo :baz :bar])
17:02clojurebot(true false true)
17:03tomojyeah, OK, (def special-forms ...) :)
17:04hyPiRionIt's not insanely hard to punch in a `boolean` here or there though, that's all to it
17:07bbloomtomoj: you can think of a "binary predicate" as a normal predicate that takes a tuple of two values ;-) all functions can technically be thought of as having arity 1. hell, ignoring optimizaitons, clojurescript basically defines every function as (fn [& args]) and then switches on arguments.length
17:07borkdudeI changed some functions to (boolean (some .. )) instead of (some ..) just to satisfy unit tests (is (…) true)
17:08borkdudebut maybe I could have written (is (…)) or something?
17:08RayneshyPiRion: Nice, you even sent me Hyperion.
17:08bbloomborkdude: some is an interesting special case
17:09bbloom(doc some)
17:09clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
17:09bbloomin theory, some is not foldable
17:09bbloombut some? is
17:09borkdudeoh wait, I wrote (is (= … true)), but I could have written (is (true? ...))
17:09borkdudeor maybe even (is ...)
17:10borkdudeno
17:10bbloomi've done (boolean (some xyz)) myself in a few cases so that my public API doesn't mandate the linear algorithmic complexity
17:10tomojhow is it not foldable?
17:10mthvedtdo clojure closures capture var bindings?
17:10bbloomtomoj: it's LEFT foldable. it's not foldable in the reducers sense
17:11tomojhow not?
17:11bbloomb/c some returns the first value to return true from left to right on sequences
17:11tomojI guess I'll try to provide a counter-example :)
17:12bbloomi guess some works on maps & in theory that would be foldable
17:12bbloomand sets too
17:12borkdudeyes, I could have gotten rid of (boolean ..) by just writing (is …) in the tests
17:13tomojhttps://www.refheap.com/paste/92633b5cf1a178e1e47a7422f ?
17:13bbloomok i retract my statement :-P however, some still returns an element when you may want a public interface to return a boolean, so coercing isn't always a bad thing there
17:13tomojactually, it should be (if ret (reduced ret) ret') or something?
17:14tomojoh and I forgot the predicate, whatever..
17:14borkdudebbloom agree, especially when I write some-test? I expect a boolean
17:16tomojhmm, will vector folding stop on reduced?
17:17tomojno
17:17tomojcombinef can't return a Reduced
17:18tomojso you have to crank through the whole vector even if you find a truthy value in the first partition
17:19tomojof course..
17:19tomojwould need weird magic to do otherwise I guess
17:20borkdudeunless the threads in which the partitioned work is done could notify when one truthy value had been found ;)
17:21tomojI guess your reducef could check an atom that your combinef resets?
17:21tomojchecking for Reduced on every reducef is bad enough.. :(
17:30tomojI wonder how high the cost of instantiating a closure every time you hit a Reduced might go
17:54moominpapaHi, I was hoping someone could give me some advice. I'm getting a name conflict and I'm trying to figure out what's causing it.
17:54moominpapaThe funny thing is a) I know what libraries are the problem (hiccup and clostache)
17:55moominpapab) I don't seem to be able to replicate it outside of my project
17:55moominpapaAny advice on how to trace the issue?
17:57hyPiRionmoominpapa: do you use any `use` or `require ... :refer [...]` within the code?
17:58moominpapaI've been through trying to remove every last one, and I thought I'd managed it.
17:58hyPiRionhum
17:58moominpapaThe annoying thing is, it seems to be buried deep.
17:59moominpapaIt seems to be something to do with wrap-stacktrace
17:59hyPiRionwhat's the error msg?
18:02moominpapahttp://pastebin.com/8bqv8xmM
18:04moominpapaSemele is the name of my project.
18:05hyPiRionWell, clostache has a private escape-html (https://github.com/fhd/clostache/blob/master/src/clostache/parser.clj#L30), and hiccup has one
18:06hyPiRionI have no idea how they manage to clash though
18:08moominpapaYeah, it's driving me nuts.
18:08hyPiRionmoominpapa: https://github.com/noir-clojure/noir/issues/101 may lead you the right way
18:08hyPiRionOooh, ooh.
18:10hyPiRionhm, moominpapa, try out lein clean first
18:12tomojnice, hiccup is second google result for "hiccup" now?
18:12moominpapaTrying...
18:15jeremyheilertomoj: I wonder how much of that is influence by search history.
18:15bosie
18:16rebcabinlooking for idiomatic way to convert list of key-value vectors into map, e.g. not (reduce (fn [m [k v]] (merge m {k v})) {} '([:a 1] [:b 2]))
18:17rebcabin... which did actually roll off the tongue, but yucch
18:17tomojjeremyheiler: I have an alias that launches chrome with a brand new profile
18:17tomojso unless they're looking at my IP or something..
18:17tomoj#'hiccup.core/escape-html ?
18:17jeremyheiler,(into {} [:a 1 :b 2 :c 3])
18:17tomojwhat the hell is that?
18:17clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword>
18:17tomojthere shouldn't be a #'hiccup.core/escape-html
18:17jeremyheilertomoj: nice
18:18jeremyheilerhmm, that was a guess
18:18hyPiRionjeremyheiler: not a bad one
18:18rebcabinjeremyheiler: into doesn't look right because it takes a vector of an even number of elements, not a list of 2-element vectors
18:18jeremyheiler(apply hash-map [:a 1 :b 2 :c 3])
18:18jeremyheiler,(apply hash-map [:a 1 :b 2 :c 3])
18:18clojurebot{:a 1, :c 3, :b 2}
18:18jeremyheilerrebcabin: oops! i should probably read!
18:19rebcabinjeremyheiler: my input is a list of 2-element vectors, like '([:a 1] [:b 2])
18:19hyPiRion,(into {} '([:a 1] [:b 2]))
18:19clojurebot{:a 1, :b 2}
18:19hyPiRionso jeremyheiler is right, just read it incorrectly
18:19rebcabinok lemme try
18:20rebcabinlovely, ty jeremyheiler and hyPiRion
18:21tomoj"Unable to resolve var: hiccup.core/escape-html in this context" hmm
18:21jeremyheilernp. next time i'll try to be less confused
18:22hyPiRionjeremyheiler: oh, don't you worry. Once I read a read a question which was like this "Is there a more idiomatic way to do (foo (bar x))?"
18:22hyPiRionAnd I answered "Why not just do (foo (bar x))?"
18:22jeremyheilerhyPiRion: hah
18:22rebcabingood one
18:23rebcabinmy fancy-schmancy used destructuring and merge and reduce, boffo
18:23rebcabintriple overkill
18:24jeremyheilerrebcabin: Sometimes it takes overkill to realize there's a simpler solution.
18:24hyPiRionrebcabin: reduce-kv is a new one which is cool though, and would've been a "nice" fit for this case
18:24rebcabini will take a look
18:24hyPiRionWell, not "nice fit", but it is a reduce over a map
18:25rebcabinnod
18:27rebcabinjeremyheiler: "invent then simplify"
18:27jeremyheilerrebcabin: def
18:28moominpapaThankyou guys, lein clean was what I needed *doh*. Took a while to confirm it had fixed the problem. Now I can get back to the original problem :)
18:29hyPiRionmoominpapa: ok, glad to know it worked! Happy hacking
18:29moominpapaNow I need to go and learn what, exactly, lein clean does now that there isn't a deps folder...
18:30jeremyheilermoominpapa: It just removes target/ I think.
18:30hyPiRionmoominpapa: oh, what leiningen version do you use?
18:30hyPiRionWe place stuff within ~/.m2/ these days
18:30moominpapa2.0.0
18:35chessguyhi all. i'm kind of a newbie to clojure, playing around with pedestal. can someone help me understand how to make a change in the library code and build it for my application?
18:36gfredericksjust for testing, or would you want to push it up to clojars as well?
18:36chessguyjust for testing for now
18:40gfredericksI can't remember if the lein checkouts feature is supposed to still work or not
18:40moominpapaIt works
18:40gfredericksthat's the classic way to do it at least
18:40moominpapaUsed ittoday
18:41chessguyoh, i remember reading something about that. i'll go find that, thanks
18:42moominpapaIt's in the readme. (As someone else told me a few years back.)
18:42moominpapaActually, more embarrasingly, it was technomancy
18:42kmicuOr my env is evil or 'lein new pedestal-service helloworld' (v1.3.0-SNAPSHOT) gives me 'forbidden' instead of 'hello world'.
18:48chessguykmicu: interesting. i've been playing with 0.1.2 and it's ok
18:49chessguykmicu: how did you even get 1.3.0-snapshot?
18:52kmicuchessguy: examples from 'samples' like chat, helloworld-app which use pedestal 0.1.0 works good
18:53chessguykmicu: ok...
18:54kmicuCan sbd with lein 2.1.2 try 'lein new pedestal-service helloworld', lein repl, (use 'dev), (start) and checkout localhost:8080?
18:57chessguykmicu: that works for me
18:58kmicuchessguy: Do you have 0.1.3-SNAPSHOT in project.clj?
18:59chessguykmicu: you mean like this? [io.pedestal/pedestal.service "0.1.3-SNAPSHOT"]
18:59kmicuyes
19:00chessguykmicu: when i do that, 'lein deps' fails, saying it can't find the artifact
19:06johnmn3g'day
19:07johnmn3I figured this out once before, but I lost my code for it... how to get at the bytes of a file in clojurescript (javascript)
19:07johnmn3I have the file object but I can't do a seq on it
19:09kmicuchessguy: 0.1.2 works for me, in that case latest pedestal version/HEAD is not ready ;] Good to know. Thx for response.
19:15danneusup team
19:21chessguykmicu: how did you get 0.1.3 ?
19:23chessguyhi danneu
19:24kmicuchessguy: from pedestal's github repo, they started 0.1.3 dev yesterday
19:24kmicubut it's not ready ;]
19:24chessguyok
19:28callenbotjust got done looking at Riemann
19:28callenbotthis is some really cool stuff.
19:28callenbotis anybody using it for anything?
19:33muhoohyPiRion: (-> x bar foo), is how i'd instinctively write that
19:35muhooi got addicted to -> and ->> after watching ztellman over his shoulder as he worked on a problem.
19:37hyPiRionwell, it really depends on the foo and bar
19:43johnmn3Shouldn't this work? (.readAsText (js/FileReader.) my-file)
19:43johnmn3as per: http://www.w3.org/TR/file-upload/#dfn-readAsText
19:45johnmn3I'm trying to get to the byte level contents of the file
19:48tomojthat works
19:49tomojwell, except, doing it that way is useless :)
19:50tomojbut your problem isn't your cljs
19:51johnmn3where am I going wrong?
19:52tomojreadAsText is void
19:52tomojyou have to attach event listeners to the FileReader
19:53tomojsee step 6+ in your link
19:53johnmn3Then maybe I shouldn't be using a FileReader
19:53johnmn3because I already have the file
19:54johnmn3and I used a FileReader with the event listener to get to it before.
19:59tomojdunno.. https://www.refheap.com/paste/8c683acc173571df9cd604d54
20:01johnmn3that works
20:01johnmn3but just 3 weeks ago I had a way I could just get at the bytes of a file
20:03johnmn3(something (slice. (make-file "asdfgh") 0 5))
20:03johnmn3-> "asdfg"
20:03johnmn3something like that
20:08tomojBlob.prototype only contains 'slice', which returns another Blob, so I don't see how that could be possible
20:09johnmn3so there is no syncronous access to the contents of a blob?
20:10tomojafaik, no
20:10tomojdunno who you should ask, ##javascript?
20:13squidzwhat are clojures opinions on when it is best to use NoSQL instead of SQL Databases
20:14Glenjaminwhy is it that, this works:
20:14Glenjamin&(map #(Exception. %) ["a" "b" "c"])
20:14lazybot⇒ (#<Exception java.lang.Exception: a> #<Exception java.lang.Exception: b> #<Exception java.lang.Exception: c>)
20:14Glenjaminbut this doesnt:
20:14Glenjamin&(map Exception. ["a" "b" "c"])
20:14lazybotjava.lang.ClassNotFoundException: Exception.
20:15hyPiRionGlenjamin: Same reason as this:
20:15Glenjaminsquidz: do you have a problem that YesSQL isn't solving?
20:15hyPiRion,#(Exception. %)
20:15clojurebot#<sandbox$eval36$fn__37 sandbox$eval36$fn__37@14fa4de>
20:15hyPiRion,Exception.
20:15clojurebot#<CompilerException java.lang.ClassNotFoundException: Exception., compiling:(NO_SOURCE_PATH:0:0)>
20:15Glenjaminso Exception. isn't a function?
20:15hyPiRionExactly
20:15squidzGlenjamin: so just going YesSQL until you hit a rough patch is when you should start looking at NoSQL=?
20:16hyPiRionIt's a special form, therefore you have to wrap it
20:16Glenjaminif you have experience with SQL, and you don't have a pressing need - i'd say stick to what you know
20:17muhoo(Foo.) is sugar for (new Foo), right?
20:17squidzGlenjamin: alright, I guess I was hoping to be oohd and aahd , but what you say seems unsurprisingly reasonable
20:17Glenjaminbut where possible, dont tie your core application logic to your choice of data storage
20:18hyPiRionmuhoo: you can check
20:18Glenjaminredis is pretty cool for mixing alongside more traditional storage
20:18hyPiRion,(macroexpand-1 '(Exception. foo))
20:18clojurebot(new Exception foo)
20:18squidzGlenjamin: how would you suggest keeping the data storage from leaking into the application?
20:19Glenjaminmodel your domain entities as plain objects/records
20:19tomojapparently noone on the internet has yet suggested the connection between nosql and nonapples O_o
20:19Glenjaminand have a set of functions for sending them to and from the data store
20:19squidzfor sending maps to the datastore?
20:20Glenjaminthe logic for how the record translates to storage, and vice versa all lives in one module
20:20squidzokay but by plain objects and records, do you mean clojure maps?
20:21Glenjaminprobably defrecord
20:21Glenjaminwhich gives you a map-like thing with a type
20:22squidzso the additional type is worth abandoning the simplicity of plain maps?
20:22Glenjaminit's still a plain map
20:23Glenjaminhttp://clojure.org/datatypes
20:23Glenjaminit's basically a map, but slightly faster and you can extend protocols and things with it
20:24squidzokay. So I should shove all the converting/deconverting to either protocols/maps into one icky layer between the DB and the application?
20:26Glenjaminpretty much
20:26Glenjaminbut write it from the application's POV
20:27Glenjaminso data/latest-posts, rather than data/posts {:order :date}
20:27Glenjaminetc
20:28squidzokay thanks for the pointers
20:39muhoowhy use domina instead of jayq?
20:40muhooif i alreafy have to use jquery anyway (for bootstrap, jui, etc)
20:49augustlwhat's the easiest way to get a byte array from a File in Cloure? Any built-in stuff for that?
20:51tomoj(.getBytes (slurp f)) ?
20:51augustlI'd rather not stringify it first
20:52augustlsounds like encoding errors waiting to happen..
20:52tomoj(let [o (java.io.ByteArrayOutputStream.)] (io/copy f o) (.toByteArray o))
20:53tomojyou're right about encoding errors
21:09john2xhow do I add a local project as a dependency in project.clj?
21:11hughfdjacksonat what point do PersistentHashTries become more effecient (timewise) than full-copies of Java Hashmaps?
21:12hughfdjacksoni'm asking because i'm making a js equivalent (although i know mori is a thing ;) )
21:12hughfdjacksonand i want to know what state-of-the-art looks like in clojure-land
21:28chessguyso am i understanding correctly that clojure's ring is roughly equivalent to ruby's rack?
21:34hyPiRionWow, Clojure 1.0.0 is like super duper fast
21:40danneugee, Ring wiki on github is so good
22:17gfrederickshyPiRion: try using binding on random vars
22:17gfredericksjust because you can
22:18hyPiRionoh, why?
22:18gfrederickshyPiRion: also you could try ##(apply * (repeat 400 2))
22:18lazybotjava.lang.ArithmeticException: integer overflow
22:18gfrederickshyPiRion: because it's fun?
22:19gfrederickschessguy: yes.
22:19hyPiRionhuh, binding plus to minus works
22:19hyPiRionbut it's just plussing though
22:19hyPiRionsad.
22:19chessguygfredericks: thanks
22:20hyPiRionoh wait, not if I deref the var. gfredericks, have you worked with 1.0 before?
22:20gfrederickshyPiRion: + and - are probably inlined
22:20danlarkinah 1.0, those heady times
22:20gfredericksI can't even remember if I worked with 1.0 or not
22:22hyPiRiongfredericks: Well, there's this super neat feature with 1.0, the ^ literal means `meta` if you have a space after it
22:23hyPiRionSo with that abusement, I've shortened the Swearjure bootstrapping to this: https://www.refheap.com/paste/13135
22:31locksthat looks almost like brainfuck
22:31hyPiRionyeah, it is
22:36gfrederickshyPiRion: so I guess the change we need to sneak in is basically just a git-reset?
22:37gfredericksyo rhickey whaddayasay for old time's sake we make 1.6 == 1.0
22:37hyPiRionheheh
23:06Raynesgfredericks: NaNNaNNaNNaNNaNNaNNaNNaN
23:10hyPiRionoh, the js/ruby talk
23:11RaynesNot bad hyPiRion, only took you 4 minutes.
23:11uvtcHow can I get every element of a seq but the nth one? (I think I want a "`but-nth`" function...)
23:12uvtcI want to remove just the nth item, and have what's left.
23:12hyPiRionuvtc: use a combination of concat, take and drop
23:13uvtchyPiRion: tanks!
23:13hyPiRionlike, (concat (take Xs (dec n)) (drop Xs n)) should do, I think
23:13hyPiRionnp
23:22tieTYT2i'm writing a test and I'm with-redef'ing a function that uses an http client and returns a url. My test would be better if this function could return a different thing each time it's called. How can I do this?
23:26tieTYT2even tho there's no threading involved. I'm wondering if I should use an atom that I increment each time i call it