#clojure logs

2012-03-10

00:40alex_baranoskyI just used fnil for the first time in production :)
00:41TimMco/
00:41mdeboardThat's tight
00:41alex_baranoskyhehe
00:41mdeboardalex_baranosky: You're not at pycon right? I Could've sworn I saw someone with that name on a nametag today
00:42alex_baranoskyno, today I was at the North East Scala Symposium in Boston though
00:42mdeboardahh
00:42alex_baranosky(assoc foo :bar ((fnil inc 0) some-value))
00:43alex_baranosky... used inside a swap! function
00:43TimMcalex_baranosky: (inc (or some-value 0))
00:45alex_baranoskyTimMc, nice. Now I wonder which is 'simpler'
00:45alex_baranoskyI like the way fnil isolates the variation in the function
00:45alex_baranoskybut the or is probably less esoteric
00:52alex_baranoskykibit!!!!
00:54devnkibit!!!!!!!
00:54devnkibbles and bits.
00:54mdeboardslarty blartfast
00:54devnpaul blart...mall cop
00:55alex_baranoskynice the new version of kibit found a few more kibbles and bits in Midje
00:55devnnice
00:55devnalex_baranosky: do you know of a lib that /isn't/ enlive that people use for scraping?
00:56devnim going to probably be strung up for saying this, but i really don't like enlive
00:57alex_baranoskydevn I don't either
00:57alex_baranoskysorry I dont really
00:58TimMcI want to like enlive.
01:02Cozeyis :dev-dependencies deprecated by :profiles
01:02Cozey?
01:03alex_baranoskythink so!
01:05Cozeyhmm. so howto use swank now? before it should be placed in :dev-dependencies, and now? in :profiles { :dev { :dependencies ... }} or installed by 'lein plugin' ?
01:07rlbIs it possible to define a record that supports .close (so you can use it with with-open)?
01:09arohnerrlb: yes. with-open calls .close on whatever it's passed
01:11rlbright, but I didn't think you could define a protocol with a ".foo" method
01:13rlbI actually don't need a protocol or record specifically; I just was trying to figure out if I could define something that would work with with-open, without resorting to a java class.
01:19arohneroh right. Forgot with-open calls methods, but defrecord generates protocol fns. defrecord can inherit from java interfaces
01:19arohneryou could also use reify or proxy
01:23amalloyreify. proxy here sounds terrible
01:25amalloy&(with-open [x (reify java.io.Closeable (close [this] (println "closing")))] (println "currently open"))
01:25lazybot⇒ currently open closing nil
01:25amalloyrlb: ^
01:26CozeyGuys, what emacs package is this guy using for code completion and displaying candidates [and i believe doc strings too!] https://vimeo.com/22798433
01:26Cozey?
01:28rlbThanks -- I'd looked for Closable, but just realized I was looking in the wrong place.
01:28rlbs/Closable/Closeable/
01:30rlb(In this case defrecord is what I want.)
01:57alex_baranoskyanyone played with datomic at all?
02:21Raynesalex_baranosky: I'm waiting for the email back.
03:08JorgeBhmm, any idea why my (defroutes ..) would work for a simple GET but throw a 500 on a POST?
03:09JorgeB handler returned nil (no response map)
03:09JorgeBeven tho it's a simple:
03:09JorgeB (POST "/search" _
03:09JorgeB {:status 200})
03:49kennethhey all
03:49kennethhey JorgeB
03:51kennethif anybody wants to review my style / code, this is my first clojure script. works as expected, yay! https://gist.github.com/3b9ca8728fae1ee9b5dd
04:47ejacksongtuckerkellogg: what are you trying to do ?
04:48gtuckerkelloggthere's a largeish data structure that i'm implemeting as a ref to a hashmap
04:48gtuckerkelloggbecause *that* part I'm clear on: I need to add members to the hashmap frmo time to time and all threads must know
04:48ejacksondoes that hashmap need to coordinate with another piece of data ?
04:49gtuckerkelloggpossibly
04:49gtuckerkelloggenough that for *that* part I'm willing to use a ref
04:49gtuckerkelloggbut what's happening inside the hashmap, to the invidual values that the thing
04:50ejacksonif you're using assoc / dissoc etc then its the usual structural sharing update stuff
04:50gtuckerkelloggthis is a non-deterministic algorithm, where individual members of the hashmap are being randomly checked, examined, and occasionally altered
04:50gtuckerkelloggand I wonder if in practice it would be useful to have the invidual members as atoms
04:50gtuckerkelloggas well as having the whole thing as a ref
04:51ejacksonso a ref of atoms ?
04:51gtuckerkelloggyes
04:51ejacksoni think you're probably over thinking
04:51gtuckerkelloggmaybe so :)
04:52gtuckerkelloggmy (over) thought was that if the data size is relatively large, I don't want to lock up the whole hash when altering a single value
04:52gtuckerkelloggbut perhaps that's not actually a correct understanding of the use of refs
04:52gtuckerkellogg(i'm new to clojure)
04:52ejacksonit depends on the number of threads banging on it
04:53gtuckerkelloggyes
04:53gtuckerkelloggi'd eventually imagine the number of threads could grow fairly large
04:53ejacksoni'd try with just a ref to start, and if it doesn't work, get more complex
04:54gtuckerkelloggjust ref + alter + assoc / dissoc?
04:56ejacksonyup
07:24darqhello. yesterday i thought that i understand them... macros :) Why can't I use a LSeq as a argument for the macro... i have even written the macro without using other macros to see if i have missed something .. https://refheap.com/paste/1011
07:26darqI want to evaluate the value of mlist in vector so i can generate something...
07:29darq*the vaule of mlist in the macro
07:30raekdarq: a macro works much like a function, but unlike a function it does not get its arguments evaluated
07:30raeka macro receives the code for the subexpressions
07:31raekif you call a macro foo like (foo a b c), it receives the three *symbols* 'a 'b and 'c
07:31raekit is what the macro returns that is later evaluated
07:31darqraek: and how else can i do what i intendet (loop true a vector and generate code)?
07:32raekdarq: first you need to know what the "replacement code" should look like.
07:32raekfrom the code I think you wanted something like this:
07:33raek(testm abc) should be the same as writing
07:33raek(do (println "start") (doseq [el abc] (println el)) (println "stop"))
07:34raekthis is a little different from your code
07:34raekone imporant thing is that the macro cannot know what "abc" will end up evaluating to
07:34raekso you need to generate code that iterates, rather than doing the iteration in the macro
07:35raekmacro expansion only happens once - when the code is compiled
07:37darqhmmm... I createad this as an example .. my actual code has "doto" and creates a object from a java lib and then executes the methods on it... now i have 2 static methods on it but the rest i want to generate (i pass a value to the method)..
07:38darqand the values are in the vector
07:38raekdarq: https://refheap.com/paste/1012
07:40raekdarq: and here's a version that uses syntax-quote: https://refheap.com/paste/1013
07:41raekdarq: can you show us an example of how a call to the macro and how the generated code should look like?
07:42darqraek: thx... but i think that the doseq wont be executed on the object
07:43darqraek: https://refheap.com/paste/1014
07:45raekdarq: what does a call to mknet look like?
07:45darqSo basically i want to generate code which creates an object and repeadtly executes methods on it ... in this case a neural network with hidden layers
07:45raekcan the value of 'coll' be known at compile time?
07:45darq(mknet 2 2 [2 3])
07:46raekdo you want to be able to call the macro like (let [a 2, b 2, c [2 3]] (mknet a b c))?
07:46darq;;(mknet inputlayer outputlayer [hiddenlayers])
07:47darqyes
07:47raekthen you can't perform the iteration inside the macro
07:47raekit has to be done in the generated code
07:47raekdo you see the difference?
07:48darqyes.. kinda :)
07:48darqCan you provide an example?
07:48raekthink of what happens when you call (mknet a b c)
07:48raek(.addLayer (BasicLayer. nil true ~fst)) will become (.addLayer (BasicLayer. nil true a))
07:49raekso in that case everything's fine
07:49raekbut the problem is ~@(for [tcn coll] ...)
07:49raeknow, the for is executed in the macro at compile time
07:49raekwhat is "coll" bound to here?
07:50raekthe symbol c!
07:50darqto a symbol :)
07:50raekso you are trying to do stuff too early
07:50darqyep i get it.. How would you do it?
07:51raekI would generate a for instead
07:51raekbut that doesn't fit very well in the doto form, so you need to split it up
07:51darqyep thats the problem :)
07:52raekalso: don't use for here. use doseq
07:53raekfor does evaluated the body expression unless you iterate through the lazy sequence it generates
07:53raek*does not
07:53raek*does not evaluate
07:57raekdarq: https://refheap.com/paste/1015
07:57raekthen you can take a look at the output of (macroexpand-1 '(mknet a b c))
07:58raeksorry, forgot net# as the last expression in the let... https://refheap.com/paste/1016
07:59raekdoto is a syntactic sugar you can use if your code has a certain shape
08:00raekin your case the generated code does not have that shape, so you can't use doto :-)
08:01raeknow in this case, I don't know if there is any reason to have this as a macro, even
08:02raekdarq: there: https://refheap.com/paste/1017
08:02darqnice :) thx. I was looking at 1015 and figured the last statement missing .. but thx for 1016:)
08:03darq:) cool .. But that's not a macro :D
08:03raekimplementing mknet as a macro (at least in the 1016 form) does not provide any advantages over making it a function
08:03darqThx. again
08:06Blktgood day everyone
08:07Blktcould anyone explain me how to programmatically generate functions in Clojure?
08:07BlktI mean consing
08:08gtrakwhat?
08:08clojurebotWhat is meta
08:08Blktsomething like Common Lisp's (let ((sexp (* 2 x))) (list 'lambda '(x) sexp))
08:08gtraksounds like a macro
08:09gtrakread about macros, syntax quoting and such
08:09gtrakor you can work on the data at runtime and eval the result
08:10Blkta good resource for Clojure's macros?
08:10Blktdo you know one?
08:10Iceland_jackBlkt: On Lisp, it's for Common Lips but it still applies
08:10gtrakblog posts, let me find one for you
08:11BlktIceland_jack: same exact syntax? I know On Lisp, but I needed help with syntax
08:11gtrakslightly different behavior in syntax-quote
08:12BlktI see
08:12Blktthank you
08:12gtrakhttp://techbehindtech.com/2010/09/28/clojure-macros-simplified/
08:13gtrakbut if you don't want to use quoting you can just build lists and such
08:14gtraki haven't gotten far enough myself to know why someone would want to do that though :-)
08:16BlktI'd rather use quoting, I used list previously just to be clear :D
08:16raekif you build lists manually, you have to remember to namespace-qualify the symbols
08:19gtrakanyone know where I can find explanations of reasoned schemer items? or care to help me with one?
08:22gtrakspecificially, chapter 2, item 55, (run* (q) (pairo ()) (eqo #t q)) returns ()? why wouldn't it return #t
08:25gtrakah, maybe the pairo goal fails since no pair of freshed vars can result in an empty list
08:32gtrakand why is the elephant in the middle sitting in the reflection but actually standing?
08:44gtuckerkelloggI'd like to do something like (sorted-map (interleave keys vals)), but it fails.
08:48jeremyheilergtuckerkellog: use apply, (apply sorted-map (interleave keys vals))
08:48jeremyheilerinterleave returns a sequence, which you want to use the values as params, not the sequence.
08:50jeremyheilergtuckerkellogg ^
08:51gtuckerkelloggyes?
08:51clojurebotyes is is
08:51gtuckerkellogghaha
08:51gtuckerkelloggahh, thanks jeremyheiler
08:51jeremyheileri originally misspelled your name :-P
08:51gtuckerkelloggno wonder i got no beep
08:51gtuckerkelloggi get a lot of that
08:52gtuckerkelloggmy last name used to be spelled out in an advertising jingle in america, and *still* people misspelled it
08:53jeremyheilerhaha
09:33gtuckerkellogg,(replace {2 :a 4 :b} (vec '(1 2 3 4)) )
09:33clojurebot[1 :a 3 :b]
09:33gtuckerkellogg,(replace { 2 "!"} (vec (clojure.string/split "foo" #"") ))
09:33clojurebot["" "f" "o" "o"]
09:33gtuckerkelloggwhy is that?
09:37Bronsa,(doc replace
09:37clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
09:37Bronsaops.
09:37Bronsa,(doc replace)
09:37clojurebot"([smap coll]); Given a map of replacement pairs and a vector/collection, returns a vector/seq with any elements = a key in smap replaced with the corresponding val in smap"
09:38Bronsathere is no key equal to "2" in that vector
09:39gtuckerkelloggoh i thought it worked on positions in vectors
09:39gtuckerkelloggmy bad
09:39gtuckerkelloggi had assoc and replace confused
11:17buduhi, i'm wondering if there's already a function for the simple pattern for composing predicates
11:17budufor example: #(or (pred1? %) (pred2? %))
11:18budusometimes i use an helper i call `orp` like that (orp pred1? pred2?)
11:18budumuch less annoying to type! ;-)
11:23devnive used it probably a dozen
11:23devnwhoops
11:33Frozenlo`I'm used to do '(1 2 3) when I want a list. However, many clojure examples I saw used instead [1 2 3]. Is is better to use a vector? Faster?
11:33qbgNo need for the '
11:33qbgAnd the contents are evaluated
11:34TimMc&[1 2 3 (+ 4 5)] ;; Frozenlock
11:34lazybot⇒ [1 2 3 9]
11:34TimMc&'(1 2 3 (+ 4 5)) ;; Frozenlock
11:34lazybot⇒ (1 2 3 (+ 4 5))
11:34TimMc&'[1 2 3 (+ 4 5)]
11:34lazybot⇒ [1 2 3 (+ 4 5)]
11:34FrozenlockOh, so it would be the equivalent of (list args) but faster to write?
11:35qbgBasically
11:35qbgBy being a vector you also get better random access time
11:36FrozenlockSo win-win :D
11:37qbgYep
11:39ScriptorFrozenlock: You do need the ' to create an actual list
11:39Frozenlock&(reverse [1 2 4])
11:39lazybot⇒ (4 2 1)
11:40ScriptorFrozenlock: Also, first and conj happen in constant time for lists
11:40FrozenlockInput vector --> output list?
11:40ScriptorYes, reverse always returns a list
11:41ScriptorBecause reversing is the sort of operation lists excel at
11:41qbg&(rseq [1 2 4])
11:41lazybot⇒ (4 2 1)
11:42qbgNo need to do any computation
11:42ScriptorUse vectors when you need a random access to an ordered collection
11:45TimMcScriptor: "You do need the ' to create an actual list" <-- only when trying to use the literal syntax
11:46FrozenlockIf I don't need constant time, should I still use vector, or can I stick with lists?
11:46ScriptorIf all you're doing with a list is first and conj and so on, use a list
11:47ScriptorIs you find yourself accessing the 5th or 100th element a lot, use a vector
11:48phil_quit
11:49TimMcFrozenlock: There are several performance axes to evaluate collections on: Appending, random access (and capability), insertion, prepending, sequential walking, membership testing/lookup
11:49TimMcFrozenlock: But first, make sure you're in the right part of the Venn diagram: http://www.brainonfire.net/files/seqs-and-colls/main.html
11:50FrozenlockWill do immediately
11:58FrozenlockA little typo here "Nota Bene: Sequences are not implemented as lists, they just act a lot like them and are may be backed by similar data structures." are/may. (If someone here has edit access)
12:00TimMcFrozenlock: Pull requests accepted. :-P
12:00TimMc(Thanks.)
12:01ScriptorTimMc: Git repo link? ;)
12:12TimMcbottom of the page
12:12TimMcI've got the file open in Emacs, though.
12:13TimMcBut if you've never done a pull request and want an excuse to experiment with it, be my guest!
12:14ScriptorFrozenlock: If you haven't, definitely try it. Github even let's you do everything from the website
12:14ScriptorIncluding editing
12:15FrozenlockOh wait, you were serious?
12:15TimMcyup
12:15TimMcFork, edit, pull request.
12:16FrozenlockAwww god. Used it about 5 times, hated each single one of them :P
12:16TimMcPull requests?
12:16FrozenlockMight be a good time to learn magit though
12:17TimMcor git?
12:17Frozenlockgit
12:17TimMcThere's a learning curve for sure.
12:17FrozenlockNo, Emacs and org mode have learning curves. Git is goddam cliff :P
12:18TimMcNah, you just need the right explanation.
12:18TimMc(And how did "steep learning curve" get the wrong pop psych interpretation, anyhow?)
12:19TimMc(Technically, an *easy* task has a steep learning curve... just not in colloquial usage.)
12:20FrozenlockAn easy task could be single point, in which case, yes the curve could infinitely steep.
12:20Frozenlock(But learning curve implies more than a single button)
12:20FrozenlockCould you point me to the repo in question? I'll do my best not to break everything.
12:21Frozenlockgit reset --hard
12:27FrozenlockDoes `filter' uses the same time when applied to a list / vector? (Given that each item needs to be checked)
12:27mdeboardWhat
12:28mdeboardDoes it use the same time?
12:28FrozenlockYes
12:28mdeboardWhat do you mean?
12:29FrozenlockIs it faster for a list, a vector, or are they equivalent in this case?
12:29mdeboardOh
12:30mdeboardI don't know that one, but if item needs to be checked it's surely going to be O(n) for any data structure no
12:31FrozenlockSure, but some may have bigger overhead.
12:31TimMcFrozenlock: https://github.com/timmc/seqs-and-colls -- now that I look, I notice that the link back to the repo at the bottom of the page is actually quite non-obvious...
12:32FrozenlockTimMc: Oh... generated from "this"... I see :p
12:32mdeboardSo the short answer is... ?
12:32qbgdnolen: Created LOGIC-30 for you on JIRA
12:33mdeboardThere's no preprocessing done on vector/list data structures
12:38FrozenlockTimMc: Did you wrote everything in html?
12:38TimMcFrozenlock: The tables are generated by Clojure (with help from Enlive), but the main text is in src/.../html/main.html
12:39TimMcFrozenlock: By the way, this really helped me understand git (not right away, but it gave me tools for future understanding): http://eagain.net/articles/git-for-computer-scientists/
12:40TimMcAlso, you won't understand "pull" until you understand that it is an amalgam of fetch, merge, and rebase. :-)
12:43alex_baranoskyI think pull is actually either fetch and merge, or fetch and rebase, depending on how you have your pulls configured
12:44alex_baranoskyby default fetch and merge
12:44alex_baranoskybut you can also say `git pull --rebase` to have it rebase instead
12:48TimMcWell, it will rebase automatically on fast-forward merges.
12:49alex_baranoskyah yes, good point
12:50alex_baranoskybut if you use git pull --rebase it will also rebase instead of merging at all
12:53ssideris_hello... is anyone maintaining a library that is compatible both with clojure 1.2 and 1.3?
12:53ssideris_if yes, how?
12:53TimMcssideris_: Depending on the lib, that can be quite easy.
12:54ssideris_TimMc: my question is mainly about how to set up project.clj
12:54TimMcBe careful about Integer vs. Long hashing in maps/sets, use :dynamic when necessary on vars, use #^{} metadata syntax...
12:54TimMcssideris_: https://github.com/timmc/handy/blob/master/project.clj
12:55TimMcThat's the lein 1.x approach, using the multi-deps plugin for testing against multiple versions.
12:55TimMc*versions of clojure
12:56ssideris_ok that's for testing, and I have something similar in mine
12:57ssideris_https://github.com/stathissideris/clarity/blob/master/project.clj
12:58TimMcYeah, I don't know if there's anything else to mess with.
12:58ssideris_I think that if I compile my library with 1.3, the jar produced is incompatible with 1.2
12:58TimMcYou might want to put a :url in your config, by the way (linking back to the repo)
12:58TimMcAh, why AOT compile, though?
12:59ssideris_no reason, just not sure how I can control it
13:00TimMcIf you change :main to (I think) :repl-init, that might prevent any AOT compilation.
13:00TimMc:main is an AOT trigger
13:00raekyou can add :skip-aot metadata to the :main symbol, I think
13:00raekit's in the leiningen docs
13:00raekin the sample project file
13:00ssideris_nice, thanks
13:01ssideris_I do have an obsolete main somewhere from when I was first starting the library
13:01ssideris_I'll get rid of it completely, it's full of crap anyway :-)
13:01ssideris_thanks for your help, I'll try and fix it now
13:02alex_baranoskyssideris, Midje is compatible with 1.2, 1.2.1, 1.3.0 and the new 1.4 betas
13:02TimMcIf you do have a true :main ns, you can also use my lein-otf plugin to create a non-AOT uberjar. :-)
13:02ssideris_and otf stands for?
13:03TimMcOn The Fly
13:03ssideris_should have guessed...
13:03TimMcopposite of "AOT", but not ambiguous like "JIT" is :-P
13:03ssideris_thanks, I'll check it out
13:03TimMcIt doesn't do jars yet, only uberjars.
13:04tmciverTimMc: </end-of-shameless-plug> ;)
13:04ssideris_haha
13:04TimMcyup
13:04TimMcI don't think there are too many executable libs.
13:04ssideris_by the way, what's the feeling about EuroClojure, are many people from the US attending?
13:05TimMcNot me. :-(
13:05ssideris_I'm in London so I have no excuse to not attend
13:05TimMcHaha, nice.
13:06ssideris_but I haven't bought my ticket yet
13:06TimMcI procrastinated on getting a ticket to the 2012 Connj and missed out as a result.
13:06TimMcThe scheduling was inconvenient, but I kind of regret not going.
13:07TimMc(scheduling + location)
13:08ssideris_As a true procrastinator myself, I'm only now motivated to submit a talk proposal for EuroClojure (deadline is on Monday)
13:10TimMceep
13:12Frozenlo`TimMc: I will look in the link you submitted later today. However I probably won't fix the typo in a timely manner, you should do it. Thanks for your eagerness to help! ;)
13:12TimMcHaha, OK.
13:29ssideris_TimMc: more questions! with https://github.com/stathissideris/clarity/blob/master/project.clj
13:29ssideris_...if I setup a new porject that uses clojure 1.2.1
13:29ssideris_and clarity
13:30ssideris_leiningen will still retrieve the dependencies of clarity (the default ones)
13:30ssideris_but I need a way to tell it to get the dependencies for the "1.2.1" group
13:31TimMcHmmm... I don't know how to manage transitive deps in leiningen.
13:32ssideris_ok
13:32TimMctechnomancy! Halp.
13:32ssideris_maybe I could just put it in the readme
13:32ssideris_that 1.2 users should make sure to include contrib
13:33TimMcWhat I'd really like to know is this: Should there be separate releases for different dependency-version-variants of a lib?
13:34TimMcLike, clarity-0.5.6+clj-1.2 vs. clarity-0.5.6+clj-1.3
13:34ssideris_well maybe, also there should probably be a different branch in my repo, but there isn't
13:35ssideris_we don't want to spoil those luddites too much, otherwise they'll stay with 1.2 forever :-D
13:37TimMcIt's true.
13:40rlbDoes line-seq buffer content, i.e. if you do a (first (line-seq some-reader)) (first (line-seq some-reader)), can lines ever be dropped?
13:40rlb(between the two line-seqs)
13:41TimMcSeems like dropping is pretty likely there.
13:41TimMcOh...
13:42TimMcI see what you're asking. line-seq docs say "rdr must implement java.io.BufferedReader", so I'm wondering if there's a reset happening.
13:43TimMcIn general, I have the impression that it's not safe to share readers.
13:43rlbThey're not shared.
13:43TimMcsome-reader is shared, right?
13:44rlbWhat I mean is -- think of that as sequential code.
13:44rlb(or is that not addressing your concern?)
13:44rlbThose two line-seqs will never exist at the same time.
13:45TimMc&(import '[java.io StringReader BufferedReader])
13:45lazybot⇒ java.io.BufferedReader
13:45rlbLooking at the line-seq source, it might be fine -- it's lazy, and only cals .readLine.
13:45rlbMy problem is likely elsewhere...
13:46TimMc,(let [r (BufferedReader. (StringReader. "a\nb\nc\nd\ne"))] [(first (line-seq r)) (first (line-seq r))])
13:46clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: BufferedReader, compiling:(NO_SOURCE_PATH:0)>
13:46TimMcbah
13:46TimMc&(let [r (BufferedReader. (StringReader. "a\nb\nc\nd\ne"))] [(first (line-seq r)) (first (line-seq r))])
13:46lazybot⇒ ["a" "b"]
13:51ssideris_TimMc: Clarity 0.5.6 now has support for Clojure 1.2, thanks for your help!
14:05devnzamaterian: there's a second edition coming soon FWIW
14:11rlbIn noir, what's the best way to present several clickable "actions" on a page that will work in the absence of any javascript? I can use multiple forms like this: (form-to [:post foo] (submit-button "bar")), but wondered if that was reasonable.
14:15ibdknoxrlb: why wouldn't they just be links?
14:16rlbibdknox: could be -- I'm relatively new to this sort of thing, though I'd heard people complaing about not using post for destructive actions.
14:16ibdknoxrlb: ah, that's a rest purity thing
14:17rlbI'd fail the purity rest? ;>
14:17ibdknoxhaha
14:17ibdknoxyes ;)
14:19rlbI'm assuming that links would be a lot easier to work with (adjust the appearance of, etc.).
14:19ibdknoxthey would be
14:22Vinzentrlb, you can wrap (form-to ...) in a function and use it similary to link-to
14:22rlbibdknox: any resources you'd recommend wrt this sort of thing, especially clojure oriented? I think I understand a lot of the basics, but the s/n ratio for some of this stuff seems a little low sometimes.
14:23rlb(i.e. lots of opinions, hard to tell what really matters)
14:23ibdknoxhonestly, very little actually matters in this regard. My suggestion would be to do it the way you think you should and then ask for feedback on it
14:24ibdknoxyou'll learn a lot more that way then trying to figure out what's "right" off the bat
14:24rlbVinzent: right, thanks.
14:29zamateriandevn, do you know when ?
14:31rlbibdknox: sounds good -- the "post issue" just got me wondering about any obvious things I should know (do/don't/etc.) wrt web interfaces. Though I'm sure there's no simple answer to that.
14:31ibdknoxrlb: yeah, unfortunately it largely depends on what you're doing and how you intend for others to understand it.
14:33rlbWrt links, I'll have to see if you can adjust the "size" of the link sensitivity area -- this is for a "fat finger" interface.
14:34ibdknoxrlb: if you add padding to the a element
14:34ibdknoxyou can make it just like a button
14:34rlbI'm just playing around with something I'd like to be able to use from a phone to control mpd (and yes I know about the mpd clients).
14:34ibdknoxrlb: take a look at my overtone ipad controller thing and the noir-blog
14:34ibdknoxboth have solid examples of some of this stuff
14:35rlbWll look at that ;>
14:35rlbs/Wll/Well,/
14:35ibdknox:)
14:36rlbUmm, yeah, that might be relevant.
14:37rlbAnd many thanks to those responsible for noir (and its deps) -- though mine's no expert opinion, it's been a pleasure to work with.
14:37ibdknoxrlb: you're welcome :)
14:37Vinzentibdknox, hey, can you share some experience on developing cljs apps? I'm trying to write a little game now and, uh, it feels terrible - when something goes wrong, it just silently shows me the blank page, thus making debugging very uncomfortable
14:38ibdknoxVinzent: how are you doing it? monet makes errors on the canvas level suck a little less
14:38TimMcrlb: Definitely use post.
14:39rlbAlso, I don't know if there'd be any interest, but if I come up with something reasonable (right now it's a mess), perhaps I'll publish my clojure mpd lib.
14:39Vinzentibdknox, mostly lein cljsbuild auto
14:39TimMcrlb: Especially if there's any chance someone might want to mess with your users.
14:39ibdknoxTimMc: ?
14:39ibdknoxI can guard a normal route just as easily as any post route
14:39ibdknoxI can even csrf protect it
14:39ibdknoxif that's what you're hinting at
14:40ibdknoxVinzent: you're not using any cljs libs?
14:40rlbBTW, just curious, with noir, can you distinguish multiple different submit buttons in one form-to? I tried that (briefly), but didn't get it to work.
14:40TimMcibdknox: Right, but there are additional protections if you use POST -- even though you should be guarding against CSRF anyway.
14:41ibdknoxTimMc: what additional protections?
14:41ibdknoxVinzent: I'd take a look at my game editor as an example of building a game in CLJS.
14:41ibdknoxrlb: not without JS
14:41TimMcibdknox: E.g. Noscript blocking cross-domain POST
14:41Vinzentibdknox, no, I'm following an example from http://nakkaya.com/, where he builds an breakout with canvas
14:41TimMcIt's just a good habit to have.
14:43rlbI wondered how much it would be possible to adjust the look of the submit buttons without javascript (though not the end of the world, and not really a clojure question...).
14:43rlb(as compared to links)
14:43ibdknoxrlb: that's not JS that's all css
14:44TimMcReddit uses a JS approach: <a onclick="$(this).parent().submit()" href="javascript:void(0)">logout</a>
14:44TimMcbut CSS to style a button as a link would be preferable on many sites
14:46rlbibdknox: OK -- didn't know how much (if any) of that kind of adjustment was handled in javascript. So I suppose it's just a matter of how much you can adjust links vs buttons; I'll poke around -- what you have in overtone would be just fine.
14:47Vinzentibdknox, thank, but I've looked at the code and found that it uses many wrapper libs, some of them (e.g. monet) aren't documented (yet), so I'd spend more time looking at its source than actually writing stuff :) Actually, my question was mostly about the workflow and dev environment
14:47rlb(the overtone interface)
14:47Vinzente.g. in clojure I could press C-c d and it'll show me doc on the symbol
14:47ibdknoxVinzent: monet is like 100 lines of code lol
14:47ibdknoxbut sure
14:47ibdknoxVinzent: I use vim, and noir-cljs
14:48Raynesibdknox: It's the only way to roll, son.
14:48ibdknoxRaynes: srsly
14:49zamaterianibdknox, do you use paraedit in vim ?
14:49Vinzentibdknox, so you basically making change, waiting why it'd get recompiled, refresh the browser, too?
14:49ibdknoxzamaterian: yes
14:49ibdknoxVinzent: not anymore, that's why I built the live game editor :p haha noir-cljs also provides an instantaneous compilation mode
14:50sjlibdknox: hey, the docs at http://www.webnoir.org/tutorials/sessions say to use (session/flash-get) to get flashed messages, but there doesn't seem to be any 0-arity version of flash-get
14:50ibdknoxsjl: using which version of noir?
14:50ibdknoxI assume the as of yet unreleased 1.3? ;)
14:50zamaterianibdknox, how well does it work compared with emacs ? (i'm using vim, the other guys at work uses emacs )
14:50ibdknoxsjl: flashes changed in 1.3 to be more map-like :)
14:50sjlibdknox: the one you told me was stable and would fix my json problem the other day :)
14:51sjlarg
14:51ibdknoxit's basically the only change
14:51sjlibdknox: so I basically just use a dummy key to get the old behavior?
14:51ibdknoxzamaterian: I don't know? I don't use emacs.
14:52ibdknoxsjl: that would work. Flashes now work the way they do in every other framework - they last exactly the length of one request
14:52Vinzentibdknox, yeah, but I thought it forces you to use in-browser editor? Do you use some browser extension which allows you to edit input boxes with vim? or what do you mean by instantaneous
14:52zamaterianibdknox, doh I should have expected that answer ;-) thx
14:53sjlibdknox: they don't last "until get'ed"?
14:53sjlibdknox: what if a request for a CSS file in another tab or something happens to be the next request?
14:54ibdknoxsjl: resources don't invoke flashes
14:54sjlibdknox: ok, then a json response from long-polling JS in another tab
14:55ibdknoxsjl: if you're using JS, I'm not sure why you'd use flashes anyways? The primary reason to use a flash is that you post something, and redirect someone to another page that says "you added blah"
14:56sjlibdknox: sure, and maybe one view works that way (a user's profile edit page) while on another page there's some JS that updates some counter or timeline
14:56ibdknoxsjl: in any case, while I'm not one to say that it's best to just follow the pack, I think being consistent with the way the rest of the web works is valuable
14:56NoICEwhen you guys are into this... is it possible to add one-time flash when no redirect is involved (e.g. to preserve form values)?
14:57ibdknoxsjl: to get the exact same behavior it would take a two-line function just using the session :)
14:57sjlibdknox: example: twitter.com
14:59sjlibdknox: and Django's message flashing, at least, works like the old version (cleared when read): https://docs.djangoproject.com/en/dev/ref/contrib/messages/
15:00NoICERails flash messages lasts one request too, so they have flash.now[:notice] method to store flash for this one precious request.. and I thought for a long time they had it like Django
15:00ibdknoxsjl: and there's django-flash
15:02RaynesDear world: we've merged the noir 1.3 (where development of the next major version has been ongoing) into master and tagged the old master (which was the 1.2.x versions) as '1.2'. Future development will be in the master branch.
15:02ibdknoxVinzent: the instant mode of noir-cljs watches for changes and immediately beams the changed code to the browser
15:02ibdknoxVinzent: it's like having the in-browser editor, but it works based on file modifications instead
15:03sjlibdknox: also, Flask appears to also handle it the old-noir/Django way
15:03Vinzentibdknox, isn't it exactly what cljbuild do?
15:03ibdknoxno
15:04ibdknoxit's not
15:04ibdknoxVinzent: no page refresh
15:04sjlibdknox: It just seems like making them only last for a single request regardless of reading makes it possible to drop messages without any added benefits
15:04ibdknoxsjl: other than being consistent with 80% of all modern websites?
15:05ibdknoxsjl: this is now possible
15:05ibdknoxit was impossible before
15:05ibdknoxthe old way is simple a special case of using a session
15:05ibdknoxit really is a two-line function
15:05Vinzentibdknox, ah, got it! Then I should check it out immediately, thanks :)
15:05RaynesWait, what are we talking about?
15:05ibdknoxsjl: why is this an issue?
15:05ibdknoxis it really so bad to write that two line function?
15:06sjlibdknox: I'd be surprised if you found lots of websites where making an API request between a POST/redirect killed a flashed message
15:06ibdknoxsjl: http://guides.rubyonrails.org/action_controller_overview.html
15:06RaynesAre we arguing because I wanted flash sessions to be one-request instead of one-read?
15:06ibdknoxplease take a look at The Flash section
15:06RaynesBecause not wanting it is pretty silly.
15:07RaynesMaking them last for one request makes pretty much everything you want to do with a flash session difficult for no reason that I can discern.
15:07sjlRaynes: yes, because now something like an API request made at the same time in another tab can silently wipe out a flash
15:07RaynesEr, one read.
15:07ibdknoxsjl: that's the contract of a flash
15:07ibdknoxseriously dude
15:07ibdknoxdo you want me to write the function for you?
15:08RaynesWouldn't that happen anyway? :\
15:08sjlibdknox: No, I'll write it
15:08ibdknoxsjl: there's nothing wrong with wanting it the other way. I completely buy that
15:08sjlRaynes: no, not if the API request doesn't read the flash
15:09RaynesOkay then. Either way, this new flash session is a thousand times more useful than the old one and the old one was simplistic enough that I don't see a reason that both can't exist.
15:10sjlRaynes: What makes the new one more useful?
15:10RaynesWell, 'more useful' may be going out of my way there, but it is certainly easier to use and more consistent with the regular sessions.
15:11ibdknoxmy logic for this: doing flashes per-request was essentially impossible before
15:11ibdknoxit's not possible
15:11ibdknoxusing the other behavior is a special case of a session value
15:12ibdknoxand is completely trivial to implement
15:12sjlibdknox: But what would you actually use it for?
15:12ibdknoxsjl: you can look in any one of 20 rails books to discover that
15:12ibdknoxI don't honestly never use flashes
15:12ibdknoxever*
15:12sjlibdknox: that wouldn't be safer and just as effective with a Django/Flask -style "store til read"
15:13Raynesibdknox: I tend to use them to communicate error messages in forms/
15:13ibdknoxI always just re-render the form to do such things
15:13RaynesYeah, I don't use Javascript for every little thing all the time.
15:13sjlYeah, I tend to use them for stuff like "Your changes have been saved"
15:13ibdknoxI mostly believe flashes are hold-over from times before there were better ways of doing things.
15:14ibdknoxthey still have a place certainly
15:14ibdknoxbut *shrug*
15:14sjlor "you have been logged out"
15:14ibdknoxthis new system is more flexible
15:14ibdknoxin that either the rails or django style can be used
15:14ibdknoxso do whichever you want
15:15Vinzentwhy not introduce some "flash-style" setting which can be either :one-request or :one-read
15:15Vinzentit'd be also backward-compatible
15:16ibdknoxsure someone could do that if they cared to
15:18ibdknoxseems reasonable, and a much better overall conversation to have than the one that just was.
15:18rlbAhh, didn't realize that things like submit-button also accept an attribute map.
15:23Vinzentrlb, btw, i think it should be reported as a bug
15:24VinzentI mean, the fact that it's not reflected in submit-button's arglist
15:24rlbVinzent: nor in the docs (which might be generated from that).
15:24ibdknoxrlb: Vinzent: it's one of those semi-hidden features of hiccup. All the hiccup functions can take an arg maps
15:25ibdknoxargs map*
15:25ibdknoxwhich is wonderful :)
15:25rlbMight make sense to have a bit in the README.md mentioning that as a global feature.
15:25ibdknoxweavejester: ^
15:25rlbThough I inferred it from the discussion of primitive forms like [:p ...].
15:25ibdknoxI don't remember how I figured that out
15:26ibdknoxI think I just tried it lol
15:26rlbI just tried it.
15:26ibdknoxat some point I read all the source
15:27rlbI figured there had to be some way to style form items, though I suppose you could have been required to drop the submit-form-ish helpers, and drop down to [...].
15:28daakuis there a good library for parsing/building urls? a basic wrapper around java.net.URL seems to be fine, but seems like something more clojure like would be nice.. also it seems like java.net.URL needs the protocol/host part too
15:38Vinzentdaaku, I definitely saw one on github, but can't remember the name
15:38weavejesteribdknox: I should really mention defelem in the hiccup README
15:39ibdknoxweavejester: yeah, it's a good thing to know about
15:39weavejesteribdknox: Or somewhere at least.
15:40weavejestertechnomancy: A very basic "lein ring server" is now working for Lein2
15:40ibdknoxsjl: btw, I'd be happy take a patch that did something like what vinzent suggested. That'd enable everyone to do what they want.
15:40ibdknoxbest of both worlds :)
15:41sjlibdknox: Maybe I'll write that later... though I wouldn't be able to use it anyway because I realized that new puts overwrite old ones
15:41sjlso I'll need my own custom version no matter what
15:41ibdknoxsjl: can you explain a bit more?
15:42sjlibdknox: say I flash a message saying "Your new project has been saved"
15:42ibdknoxk
15:42sjlibdknox: then I run a check to see if they're at the max number of projects for their account
15:42sjlibdknox: if so, flash a message saying "Hey, you've just reached your limit, you might want to upgrade."
15:43sjlibdknox: then return the redirect
15:43ibdknoxsjl: here you could use the keying to your advantage :)
15:43sjlibdknox: message 1 is lost
15:43sjlibdknox: well yeah, but they my templates need to know about every possible message key
15:44gf3sjl: ohai
15:44sjlgf3: hey
15:45gf3sjl: btw, unrelated, launched cljbin with some positive results, thanks for your feedback
15:46sjlgf3: ah, nice
15:46ibdknoxsjl: true, seems like you'd want to add it as a collection, which you could certainly do. You'd have to be somewhat less imperative about it than just putting twice
15:46ibdknoxyou might build up the vector of messages at the end of your add
15:46ibdknoxfor example
15:47sjl ibdknox: this seems to do pretty much what I want: http://cljbin.herokuapp.com/paste/4f5bbde3e4b0edcdd5b0c969
15:48dabdI would like to do the following: (map (comp URLEncoder/encode first) data)
15:48dabdbut URLEncoder/encode is not a function
15:48dabdis there anyway to wrap an external method in a function so I don't have to write: (map (comp (fn [x] (URLEncoder/encode x)) first) data)
15:48ibdknoxsjl: yep, that'd work well enough for this case
15:49gf3sjl: (also, http://cljbin.com/ :)
15:49qbg&(doc mem-fn)
15:49lazybotjava.lang.RuntimeException: Unable to resolve var: mem-fn in this context
15:49Vinzent&(doc #'mem-fn)
15:49lazybotjava.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.Symbol
15:50qbg&(doc memfn)
15:50lazybot⇒ "Macro ([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn."
15:50qbgThat isn't for static methods though
15:50Vinzentah, of course
15:51sjlgf3: ah, heh, the heroku address was in my browser history so it tab completed
15:52Vinzentweavejester, I've sent you a little pull request. Btw, why you decided to move defhtml away from core?
15:52Raynesy u no keep defhtml in core
15:53weavejesterVinzent: It seemed more appropriate to put all the def* macros in their own namespace, as they're not used as nearly as often as "html"
15:55Vinzenthm I used to use it pretty often, looks like it's just me
15:55weavejesterVinzent: Am I reading this wrong, or does it add a "attrs" symbol to *every* argument list?
15:55arohnercan you add watchers to an agent?
15:56Raynesgf3: You should totally redirect cljbin.com to refheap.com
15:56arohnerand if so, when does it get called?
15:56RaynesNobody would notice.
15:57Vinzentweavejester, yes, shouldn't it?
15:57weavejesterVinzent: Well, no because the attribute map is optional, not required.
15:57weavejesterVinzent: A more correct mapping would be something like...
15:57weavejesterVinzent: ([x]) => ([x] [attrs x])
15:58Vinzenthm, I should just named it "attrs?"
15:58weavejesterVinzent: That more implies it's a boolean, rather than optional.
15:58weavejesterProbably something more like...
15:58Vinzentweavejester, yes, but clojure.core function use this convention
15:59weavejesterVinzent: Which ones in particular?
15:59Vinzentweavejester, defn and others. It always confused me.
16:00weavejesterVinzent: Hm, you're right...
16:00weavejesterVinzent: Maybe something needs to be added to the arglists and the docstring?
16:00RaynesIf it always confused you, you probably don't want to use it in your own code.
16:01Raynes"I always hated they way they did this, so we should probably do it that way too."
16:01daakuVinzent: i found https://github.com/michaelklishin/urly .. looking at it now
16:01weavejesterRaynes: True...
16:01weavejesterI think ([x] [attrs x]) probably conveys an optional attrs argument better than ([attrs? x])
16:01Vinzentweavejester, you mean some convention for optional params?
16:01weavejesterMaybe...
16:02VinzentRaynes, 3 arglists confuse me much more
16:02RaynesI don't know why.
16:03weavejesterI'm torn between adding ([attrs? x]) and then a docstring addition like "This function can take an optional map of attributes as its first argument"
16:03weavejesterOr adding in an additional arglist, e.g. ([x] [attrs x])
16:03seancorfieldfwiw, in congomongo, it has optional arguments that actually have ? as part of their name because they are booleans
16:04Vinzentweavejester, yes, but when you have someting like ([name] [name value] [attrs name] [attrs name value]) - it's not that clear and even incorrect
16:04seancorfieldi see ([attrs? x]) and think "that takes a boolean and a something"
16:04weavejesterVinzent: Is it incorrect? What if attrs was attr-map instead? Wouldn't that make it clear?
16:04weavejesterIn the API docs, it would look like
16:04Vinzentseancorfield, there defintely should be some convention for such thing... Does Scheme has one?
16:05weavejester(foo name)
16:05weavejester(foo attrs name)
16:05weavejester(foo name value)
16:05weavejester(foo attrs name value)
16:05weavejesterWhich seems like the best way to convey usage.
16:05seancorfieldVinzent: no idea, but the clojure convention seems to be foo? means boolean
16:05weavejesterThe alternative is:
16:05weavejester(foo attrs? name)
16:05Vinzentweavejester, I've just never seen ([foo bar] [qux baz])-style arglists...
16:05weavejester(foo attrs? name value)
16:06seancorfieldif there are some arglists with ? meaning optional in core, i'd open a JIRA ticket to get them changed (since it's just metadata)
16:06Vinzentseancorfield, and it has came from Scheme :)
16:07weavejesterI think I prefer the first style. The arglists are just metadata after all.
16:09Vinzentweavejester, they are, but imagine novice who trying to figure out what he can pass to the function. ([attrs? name] [attrs? name value?]) reads as "you can pass either just name or both name and value to it, and also you can pass attrs as a first arg.", and in the case of 4 arglists I don't know how I'd read it. Also, since all elem functions would have that attrs? in arglist, it's more clear what each funtion actually take.
16:11weavejesterVinzent: But how would they know what attrs? means? Isn't it better to have one arglist for each set of arguments you can have?
16:11TimMcDunno, ? is a valid char in symbols.
16:11TimMcand is used idiomatically in predicate names.
16:13Vinzentweavejester, it's widespread convention. I think the better is what makes it cleaner and more understandable, since it's a documentation
16:14VinzentTimMc, look, I know! I'm not saying that such overlaping of meanings is good, but core guys use it and there is no other convention for optional args (yet), so it seems reasonable to take advantage of it
16:15weavejesterVinzent: But if someone sees (foo attr-map name) and (foo name value), wouldn't it be obvious that foo can take an attribute map and a name, or a name and a value?
16:15weavejesterVinzent: I'm not sure I see why two arglists with the same cardinality would confuse a human.
16:16weavejesterVinzent: So long as the arglists have different named symbols
16:16qbg? args makes sense for constructs such as defn
16:17weavejesterMaybe I should write a post to the Clojure group and get a consensus of what people prefer.
16:19Vinzentweavejester, it's not just about same cardinalities, what I'm trying to say is that ([attrs? name] [attrs? name value]) looks nearly the same as ([name] [name value]) - that is, optional arg doesn't pollute the arglists and it's immedietly clear what args this function takes.
16:19ibdknoxif I see & attrs
16:19ibdknoxI know it's optional
16:19ibdknoxthat seems the clearest solution to me
16:19ibdknox& [attrs value]
16:19lazybotjava.lang.RuntimeException: Unable to resolve symbol: attrs in this context
16:19ibdknoxfor example
16:20sjlWhat's the closest Clojure equivalent to Python/Django's South migration library?
16:20ibdknoxlobos
16:20weavejesteribdknox: But the attrs are at the beginning
16:20ibdknoxweavejester: hm, good point :/
16:21Vinzentweavejester, sounds reasonable. Also, you could start discussion about convention for optional attrs, so it'd changed in core too
16:22Vinzent[optional] is another widely used convention, but it doesn't fit for obvious reasons
16:22weavejesterVinzent: Yeah, I can see your point, but I'd like to get some consensus, since we're talking about a subjective documentation style, rather than some techincal problem that has an obviously better solution.
16:23Vinzentweavejester, sure
16:23weavejesterVinzent: I'll start up the discussion :)
16:33weavejesterhttps://groups.google.com/forum/?fromgroups#!topic/clojure/kNY1hoXKohE
16:41sjlOK, I give up: does anyone using Lobos know what this error means? "A schema definition needs at least a name."
16:42sjlI get it when I try to (migrate) this: http://cljbin.com/paste/4f5bca98e4b0edcdd5b0c96c
16:44worrelsikI'm trying to get started with ClojureScript One; third step is 'lein bootstrap'. But lein (2preview2) tells me that's not a task.
16:44worrelsikIs there an alternative to use?
16:45seancorfieldi doubt clojurescript works with lein2 - use lein 1
16:46worrelsikcan lein1 and lein2 exist next to each other?
16:47weavejestersjl: I might be wrong, but do up and down take an argument list?
16:47weavejestersjl: I seem to recall it would be (up (create …)) and (down (drop …))
16:47Vinzentthey do
16:48kennethif anybody wants to review my style / code, this is my first clojure script. works as expected, yay! https://gist.github.com/3b9ca8728fae1ee9b5dd
16:48sjlweavejester: I'm working from http://www.vijaykiran.com/2012/01/17/web-application-development-with-clojure-part-2/ because Lobos doesn't have any real docs for migrations
16:49sjlor if there are I can't find them
16:49gf3hey guys, why would clojure.lang.Var be bad in a sandbox?
16:50sjloh, fun, that lobos error doesn't happen when I use h2 instead of SQLite
16:51sjlso some of those magic values in the sqlite db connection info must be wrong
16:51worrelsikseancorfield, thanks; step 3 is running now :-)
16:51TimMcgf3: Look at all the methods it has that a user shouldn't call in a shared sandbox.
16:54Vinzentwhat should I write instead (update-in ... (if foo? f identity)), so it'd not evaluate update-in at all (like in (when foo? (update-in ...))), but can be used with ->?
16:55gf3TimMc: crap
17:03rlbI have a Socket for communication with mpd, and from that a reader and writer. After a bit of idle time, mpd will close the connection, which is fine -- I just need to detect that and reestablish.
17:03amalloyVinzent: https://github.com/flatland/useful/blob/develop/src/useful/fn.clj#L66 - (-> x (given foo? (update-in ...)))
17:03rlbI'm wondering what might be a reasonably idomatic way to handle the mpd connection in clojure.
17:04gf3hmm, I'm having an issue writing a macro, if someone has as sec → http://cljbin.com/paste/4f5bcbf5e4b0edcdd5b0c96d
17:04gf3I need to quote some things, but I essentially want the unquoted version of `(fn…
17:04rlb(Up to now I just hacked up a MPD record with the socket/reader/writer, but I may need mutability to handle reestabilshing the connection.)
17:05rlbs/reestabilshing/reestablishing/
17:05Vinzentamalloy, thanks! I should learn this lib and start use it on a regular basis (why even is it not in clojure.utils or something?)
17:05rlb(And this is in the context of creating a (trivial) mpd lib.)
17:07kennethwhat does map do if i map a hash?
17:09gf3kenneth: you get a pair, IIRC
17:09RaynesBecause utility libraries are the devil.
17:11rlb...in C, I might just "lock; send-request; receive-result; unlock;" (and reestablish the connection if it's dead).
17:11RaynesAnd if useful was a Clojure library, we wouldn't be able to add stuff to it and change+release every half hour.
17:13TimMckenneth: What does that mean?
17:14actsasgeekis anybody familiar with the HTML notebook feature in ipython? Is there anything similar for Clojure?
17:14VinzentRaynes, well clojure.core is essentialy an utility library :)
17:14RaynesA big mess of one, yes.
17:15RaynesUseful is at least organized. :P
17:16sjlHas anyone used Lobos with SQLite? I just need to know the format of this magic DB connection map...
17:17y3diits so wierd and interesting that maps and keywords are also functions
17:18qbgmaps make sense because of what a function is mathematically
17:19TimMcIt's all just convenience wrappers over clojure.core/get, in an abstraction sense
17:19gf3but srsly, if anyone has a moment to lend a hand with a simple macro → https://refheap.com/paste/1021/fullscreen
17:21qbgI think you want the syntax-quote around the (swap! ...) form
17:22TimMcgf3: What is *routes* supposed to contain?
17:23gf3qbg: how do I "call" it then?
17:23qbgThe macro expands into the code
17:23qbgSo when the defroute form is evaluated at runtime, the route fn will be added to *routes*
17:23VinzentRaynes, hah don't judge them too severely :)
17:24TimMcgf3: Right now, *routes* is being loaded up with syntax, not fns.
17:24gf3qbg: hmm, it's not evaluated for me
17:24gf3TimMc: yes, that's what I need help with :(
17:24qbgLike I said, syntax quote the (swap! ...) form
17:24qbgSo you get fns in *routes*
17:25qbgRight now you are adding updating *routes* at compile time
17:25Vinzentand remove ` from the (fn ...)
17:25qbgYou want to do it at runtime
17:25gf3qbg: right right, thank you, I understand now
17:27gf3qbg, TimMc: fixed → http://cljbin.com/paste/4f5bd51fe4b0edcdd5b0c96f
17:27gf3qbg, TimMc: thank you
17:29Raynesibdknox: ^ You said nobody used the maximize button
17:29RaynesWHAT NOW?
17:31Frozenlo`Variables and functions share the same namespace in clojure, correct?
17:31qbgYes, Clojure is a Lisp 1
17:31RaynesYes. It is a lisp-1.
17:36gfrederickswhat might I be doing wrong if I have (add-hook 'clojure-mode 'paredit-mode) in my .emacs, yet I still have to M-x paredit-mode manually whenever I open a clojure buffer?
17:36pipelinethat' not the hook i used
17:36pipelinealso i find paredit mode insufferable
17:36gfrederickspipeline: that fixed it, thanks!
17:36pipeline;(add-hook 'clojure-mode-hook (lambda () (paredit-mode +1)))
17:37pipelinewell i did bring you the commented out snippet also
17:37gfredericks:)
17:38TimMcMy .emacs more closely resembles pipeline's snippet.
17:38gfrederickstrying it out now...
17:38TimMcexcept I have t, not +1
17:38gfredericksthere it goes working
17:38gfrederickspipeline: thank you sir!
17:38gfredericksand/or madam
17:42pipelineand, definitely and
17:42rlbAm I correct to assume that ref/agent/atom may not be ideal for handling something like IO, since it inherently involves side-effects?
17:43TimMcrlb: Agents are great for I/O, since they can help you serialize uncoordinated actions.
17:44TimMcRefs... right, you don't want to do I/O in a dosync block.
17:44rlbI probably misunderstand, but how to you make sure that request and response pair up?
17:44TimMcHmm. Well, agents are good for O, at least. :-P
17:45rlbright
17:45rlbI feel like I must be "doing it wrong", but I've begun to wonder if I might need to use deftype, set!, and locking.
17:46TimMcheh
17:46TimMcWhat are you trying to do?
17:46rlbTimMc: and another problem with an agent is that it can retry, right?
17:46qbgIf you have a handler function with request/response args, you could throw a fn that closes over the response into an agent
17:46TimMcrlb: I don't think agents retry.
17:46qbgagents don't retry
17:47rlbTimMc: wait -- thinking about refs
17:47rlbTimMc: writing a (trivial) lib to talk to mpd.
17:47TimMcmpd?
17:48rlbhttp://mpd.wikia.com
17:48rlbIt obviously has to send/receive the request/response atomically.
17:48TimMcrlb: futures?
17:48rlbAnd I'd like to be able to transparently reestablish the connection if/when the server closes it.
17:49rlb(which requires some form of mutation to create the new socket/reader/writer)
17:50rlbWith a mutuable approach, I'd just "lock; close-old-connection; setup-new-connection; unlock;".
17:51rlbAnd it looks like I can do all that with deftype/set!, but as I said -- felt like I was "doing it wrong".
17:53rlbOne question about set! -- if all use of a field is going to be inside a (locking this ...) block, is :unsynchronized-mutable OK?
17:55qbgIf all uses of that field occurs within (locking <the object the field is a member of> ...), yes
17:55qbgThe Java Memory Model isn't that hard to understand, thankfully
17:56qbgYou just need to make sure that you have the appropriate happens-before relationship between your reads and writes
17:59rlbqbg: yeah, thanks. I think I understand it a bit, but I don't know it nearly as well as posix threads, etc.
17:59qbgThis is useful: http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html
18:00rlbI suppose I could just use an atom and swap, and not worry about the (unlikely) chance that we'd throw away an extra connection to the server on a retry.
18:01rlb(at least wrt reestablishing the connection)
18:02TimMcYeah, I'd advice staying far, far away from locking.
18:03TimMcYou'll sometimes encounter a Java lib that requires that you hold a lock, but that's the only time I've heard of it being required.
18:04qbgSerializing through a ConcurrentLinkedQueue might be an option
18:05rlbI still need to keep the request and response paired for each caller, i.e. several threads all calling (mpd-status x) at the same time.
18:06qbgPerhaps an async api would be better?
18:06rlbI suppose the simple solution would be for every caller to have their own socket -- maybe that's good enough.
18:06rlb(in this case)
18:07rlbBut that would mean that mpd objects aren't "thread safe".
18:07rlbs/objects/"objects"/
18:07TimMcrlb: What if you wrapped each mpd object with an agent and sent it actions?
18:09rlbTimMc: once you send it an action, how do you make sure you get *your* response?
18:10TimMcrlb: Callbacks? Shared atom? Promise/deliver?
18:10rlbi.e. if I tell it to send a "status" request. Also I don't want it to retry the network send.
18:10Vinzentrlb, just in case, have you looked at lamina?
18:11rlbVinzent: I'll take a look.
18:12rlbTimMc: wait, confusing ref and agent again, sorry.
18:12technomancyweavejester: I'm a huge fan of de-emphasizing def* macros FWIW
18:12technomancyI hope noir will take a hint from you =)
18:13TimMctechnomancy: Thoughts on how to version and release libs that have different dependency sets? e.g. foolib-for-clojure-1.2 and foolib-for-clojure-1.3
18:13rlbTimMc: I imagine that might work, but in this particular case, everything seems more complicated than the "old school", explicit locking approach. But I may well be missing something obvious.
18:14technomancyTimMc: with maven that's something you would use classifiers for. I haven't looked into it much further beyond that, but I'd recommend reading up on classifiers.
18:14TimMcAh, interesting.
18:14TimMcrlb: As long as you're just locking one thing, it might be easier. As soon as you need to coordinate multiple objects, it is hell.
18:15rlbTimMc: right
18:15rlbOK, I'll play around; thanks all - for the help.
18:21weavejestertechnomancy: My view is that a "defblah" macro is okay if you have a "blah" function.
18:21daakuis there a new home for -?> somewhere?
18:22weavejestercore.incubator, I believe
18:22ibdknoxdaaku: core.incubator
18:22daakuibdknox: thank you
18:24daakuadd-dependencies is awesome
18:58sjlanyone know why I would be getting "repl is not defined" when trying to connect to a cljs repl from a browser?
18:59sjlI have (:require [clojure.browser.repl :as repl]) in the ns...
19:02ideally_worlddoes lein test only run core.clj?
19:02ideally_world ah, nevermind
19:12rlbWhat does print do if *out* is closed (i.e. if an underlying socket is closed)?
19:15ideally_worldrlb: at a total guess I'd say there'd be an exception thrown?
19:21rlbLooks likely -- underlying method should be OutputStream .write. I don't know where I thought I'd read something else.
19:21rlbJust need to detect a closed socket so I can retry.
19:22rlbHmm, ClosedChannelException looks promising...
19:31bsteuberis there a function x with (x 'foo) => `foo ?
19:32bsteuberok I could recolve and then read the full qualified name from the var
19:32bsteuberanything simpler possible?
19:39ideally_worldAnyone know of a way to run lein midje in emacs?
19:40RaynesM-!
19:44ideally_worldRaynes, bah, that's not much better :(
19:45ideally_worldlooking for something a *little* more intergrated...
19:46nappingwhy would lein deps do nothing for a [gloss "0.2.1-alpha2-SNAPSHOT"] line, as suggested at clojars.org/gloss
19:47ibdknoxbsteuber: ##(symbol (str *ns*) (name 'foo))
19:47lazybot⇒ sandbox6997/foo
19:47tacomanI'm going through 4clojure and have a function that has different responses for an arity of 1 versus an arity of 2. recur doesn't work if I try to get the 1 argument form to call the 2 argument form; would just calling the function again without recur work?
19:48bsteuber##(symbol (str *ns*) (name 'let))
19:48lazybot⇒ sandbox6997/let
19:48tacoman(yes, I know that with enough recursion I'll hit a stack overflow, but that's not a worry in the exercise)
19:48tacomanactually, wait. dumb question, that was.
19:48RaynesHoly shit.
19:48RaynesHe is using alpha's *and* snapshots?
19:48tacomanproblem is I can't use def, so the function has no name to call with.
19:48Raynesalphas*
19:49bsteuberibdknox: I want the semantics of resolve, but a symbol as return value
19:49RaynesThat is utterly insane.
19:50qbg&`monitor-enter
19:50lazybot⇒ monitor-enter
19:50ibdknoxbsteuber: I don't understand
19:50ibdknoxbsteuber: that gives you the symbol, then just resolve it if you need the value?
19:51ibdknoxbsteuber: ##(resolve (symbol (str *ns*) (name 'foo)))
19:51lazybotjava.lang.SecurityException: You tripped the alarm! resolve is bad!
19:51bsteuberI want 'let to be mapped to 'clojure.core/let in any namespace that uses core
19:51bsteuberlike resolve would do
19:52qbgYou have to watch out that the (real) special forms don't live in a namespace
19:52bsteuberbut resolve gives me a var
19:52bsteuberqbg: I know, but let* is the special form here
19:52Raynes(symbol (clojure.string/join "/" ((juxt :ns :name) (-> 'println resolve meta))))
19:53qbgJust pointing out a nasty edge case
19:53nappingRaynes: I thought that was a bit odd when ztellman's github suggests 0.2.0 is the current verison, but I'm more confused that lein neither fetched a jar nor complained about an unresolved dependency
19:53tacomanis there a way to get recur or the equivalent to call the function with a different arity, then?
19:53RaynesI don't know why he insists on insane versioning.
19:53bsteuberRaynes: nice one ^^
19:54Raynesbsteuber: I used juxt and -> in the same piece of code. God has smiled on me today.
19:54bsteuberI got (-> sym resolve str (.substring 2) symbol)
19:54qbgtacoman: No. A different arity is effectively a different fn
19:54bsteuberbut I thought there might be sth more direct
19:54ztellmannapping: can you clarify exactly what happened?
19:54bsteuberwell not like you usually need that kind of function
19:55Raynesbsteuber: If vars were Named this would be easier.
19:55bsteubermm
19:55ztellmanyou put 0.2.1-alpha2-SNAPSHOT in your project.clj, and it didn't get pulled down?
19:55ztellmanor was it a transitive dependency?
19:56nappingOops, I just misspelled the dependency line
19:56Raynesztellman: You should tell me to piss off or something. I called you insane like 20 seconds ago.
19:56nappingit's less surprising that [org.clojure/clojure "1.3.0" gloss "0.2.1-alpha2-SNAPSHOT"] doesn't fetch gloss
19:57RaynesHaha
19:57ztellmanRaynes, you can make it up to me by reading https://github.com/ztellman/potemkin/blob/master/README.textile and telling me what's so insane about that
19:57TimMchaha
19:57Raynesztellman: Oh, I was talking about snapshotting an alpha.
19:58ztellmanyeah, fair enough
19:58ztellmaneven so, you've called me insane before
19:58ztellmanI need to address these one at a time
19:58RaynesI thought I was less brutal about potemkin.
19:59RaynesI throw around the word 'insane' a lot though, so I probably did.
20:00RaynesI'll read that in a bit. Currently on the road. Too bumpy to comfortably read.
20:01nappingztellman: do you know much about gloss-b?
20:01ztellmannapping: I don't know what the "-b" signifies
20:01ztellmanso… maybe?
20:03nappinga fork said to add some half support for files where bits refer to others by offsets https://github.com/jasonjckn/gloss
20:03ztellmanI had no idea that existed
20:03ztellmanwild
20:04nappingis 0.2.1-alpha2-SNAPHSOT the only version of gloss you have on clojars?
20:04ztellmanall previous versions should be there
20:05nappingthen I don't know how to look - that's all the search turned up
20:05ibdknoxztellman: why are you snapshotting alphas? lol
20:05nappingNow I see more at http://clojars.org/repo/gloss/gloss/ from "browse"ing
20:05ztellmanibdknox: raynes already called me on it, it doesn't make much sense
20:06ibdknox:)
20:07nappingAm I just missing something on clojars.org? I don't see older versions mentioned anywhere expect by browing all repos
20:07daakunapping: i think all versions that ever existed will always exist (barring snapshots i think)
20:09nappingsure, but I search for "gloss" and it only turns up the doubly bleeding-edge SNAPSHOT alpha, and no link or anything to list older versions
20:09ibdknoxnapping: http://clojars.org/repo/gloss/gloss/
20:09ibdknoxclojars only shows the latest by deafult
20:09nappingquite. I guess I shoudl just skip the friendly search box?
20:11nappingor start hacking on https://github.com/ato/clojars-web
20:12TimMcztellman: Versioning still doesn't make any sense to me, and I don't think it's my fault.
20:12ztellmanTimMc: my versioning, or the entire concept?
20:13TimMcztellman: The current practice.
20:13ibdknoxTimMc: we spent months figuring out how to version the editor at MSFT, I was amazed at how contentious of an issue it was
20:13nappingI'm actually a bit cross because I'm trying to get going with CCW, and Maven and especially it's eclipse plugin seem to lack any reference manual
20:14nappingI just want get dependencies for a project without much more trouble then lein, if there's some better way to do that
20:18tacomannevermind! I got it. I didn't realize that you could still name something with fn, even without def.
20:19tacoman(no, I wasn't spending my entire time working on this, for those wondering just how stupid I could be.)
20:25tacomanso... any interesting news in the community lately? for that matter, what's a good way to keep on top of what's new?
20:26TimMctacoman: Well, there's datomic.
20:26TimMc1.4 is coming along
20:27TimMcI just keep this channel open 24/7 and eventually I hear about many interesting things. :-)
20:27ibdknoxtacoman: we've discovered that TimMc is a robot controlled by clojurebot, it was quite an ordeal
20:27TimMc*bleep*
20:27ibdknoxtacoman: http://disclojure.org/ is a good resource
20:27TimMcibdknox: SANBOX DENIED
20:28ibdknoxhaha
20:28TimMcAccess to java.net.* is forbidden.
20:29hhutchtacoman: google plus (make a "saved search for clojure") and twitter:#clojure
20:30TimMcThere's the mailing list, but that's kind of traffic-y.
20:31TimMcPlanet Clojure, if you want a bit of a firehose.
20:31hhutchthe mailing list is pretty good, lots of internals-type stuff you wouldn't pick up otherwise
20:34hhutchibdknox: what's your preferred stack for deploying a noir app in production?
20:35ibdknoxhhutch: I just run it off of jetty :)
20:35ibdknoxtypically with nginx in front of it as a reverse proxy
20:35hhutchibdknox: that's what i thought
20:35hhutchthat's how i'm doing it
20:35ibdknoxI've had no issues with it
20:36hhutchyou use ring uberwar ?
20:37ibdknoxhm?
20:37ibdknoxwars are for deploying to tomcat
20:38ibdknoxI guess you could run the war too somehow
20:38ibdknoxI just do lein trampoline run prod
20:40hhutchibdknox: cool, thanks
20:41ibdknoxnp :)
20:41RaynesI thought wars were typically for territory disputes and moral or religious values.
20:42ibdknoxRaynes: nope. just tomcat. ;)
20:42hhutchhttp://sadtrombone.com/
20:42ibdknox~rimshot
20:42clojurebotBadum, *tish*
20:42duncanmanyone running JDK 7 here on a Mac?
20:42romanandreghas anyone had tried to use cljsbuild or the cljs repl with lein2 ?
20:45hhutchromanandreg: just 1.7/cljsbuild here
20:45romanandreghhutch: does the repl-listen works properly? doesn't hang or anything?
20:45hhutchworks fine for me
20:47romanandreguhmm lein2 still a bit buggy, I guess I'll use lein1 for now, had spent at least 3 days trying to make this thing work the way it should work
20:47romanandregand my foo on leiningen internals and cljs repl impl is not that good to know what the hell is going on
20:47hhutchdoes lein2 have something specific you need?
20:48romanandreghhutch: not really… I'm moving to lein1 now
20:49romanandreghhutch: yeah the cljsbuild repl-listen needs some work in lein2… I'm trying with lein1 now and everything works great
20:49hhutchthe only thing that i know of i'd want in lein2 is built in lein-newnew
20:50hhutchbut lein-newnew works fine with 1.7 as is
20:50kwertiiI downloaded lein2 last night to try it, and found that the "plugin" command referenced in its installation instructions is totally missing.. O_o
20:56nappingwasn't that saying to run lein1's plugin to install some lein1 plugin for upgrading project files?
21:01kwertiinapping: Oh. Really? I totally missed that
21:02kwertiinapping: I thought you were supposed to do that with lein2
21:22gf3ibdknox: do you use a specific lein plugin to generate your clojurescript project skeletons?
21:22ibdknoxgf3: I'm making one tomorrow
21:22gf3CONVENIENT
21:23gtuckerkelloggtiming!
21:23gtuckerkelloggwhat happens when an alter statement is enclosed inside a conditional?
21:25gtuckerkelloggSomething like http://pastebin.com/XtA80WF7
21:25TimMc&(if false (alter 5 6) "fine")
21:25lazybot⇒ "fine"
21:26TimMcgtuckerkellogg: Now you know.
21:26gtuckerkelloggthat part i knew, :-)
21:27gtuckerkelloggwhat I mean, is, if a dosync wraps a conditional which wraps an alter, does the data conditionally being altered get "locked" bu the STM if alter never happens?
21:30ztellmangtuckerkellogg: dosync doesn't analyze its body to figure out what gets changed
21:31ztellmaninvoking 'alter' or 'ref-set' will do all the consistency checking
21:31ztellmannothing happens until those functions are invoked
21:31gtuckerkellogggreat
21:31gtuckerkelloggthat helps
21:32TimMcgtuckerkellogg: Look at my example again -- that alter statement is invalid, but no error occurs. :-)
21:32gtuckerkellogg:O
21:32gtuckerkellogggood point
21:32gtuckerkelloggD'oh!
21:32TimMcgtuckerkellogg: More importantly, analysis is impossible, since I could do (fn [f] (dosync (f)))
21:33gtuckerkelloggah
21:40TimMcgtuckerkellogg: A good way to think about these things is, "What is the worst code I could throw at the compiler/runtime?"
21:40romanandreghow do I do to include a clojurescript library to a project
21:40romanandregwould be the same as a normal library?
21:40romanandregadd them to :dependencies on the project.clj file?
21:40gtuckerkelloggTimMc, that's my kind of code!
22:10_rccBasic question: I'm using leiningen and clojure 1.3. How do I include clojure.contrib.server-socket in my project? I'm not even clear if server-socket is still part of contrib?
22:12_rccI see technomancy has a version. How should I use that one? How would I use it? e.g. what is the depencency name/version to put in project.clj
22:14xeqi_rcc: searching clojars brings up http://clojars.org/server-socket
22:15xeqiwhich looks to be technomancy's version
22:17_rcchttps://github.com/technomancy/server-socket
22:17_rccleiningen uses maven (or at least, maven's repos). Correct?
22:18xeqithe repos, yes
22:21TimMc~contrib
22:21clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
22:22TimMc_rcc: ^
22:22_rccTimMc: Thanks
22:23TimMcThe contrib breakup was the biggest disruption in the 1.2 -> 1.3 transition.
22:26_rccI'm trying to do a lein search (cool!) but the index is taking a while to download...
22:32juhu_chapaclojurebot: i don't find server-socket in the actually-maintained libs, i hava to keep using old contrib?
22:32clojurebotCool story bro.
22:33TimMcjuhu_chapa: That's a bot, and look a few lines above the original message.
22:34cgagwhen using swank-clojure, how do I bring up the repl in a split window? When I played with it before it did this when i ran clojure-jack-in, I guess it doesn't anymore?
22:37kwertiicgag: mine brings it up in a split window automatically. C-c C-z will split it and switch you to the REPL
22:38cgagC-c C-z just switched me to a new buffer and started a repl in that. I guess I could just split it manually first, though I wonder why it's not doing it on its own.
22:38kwertiicgag: It should be. maybe something configured your Emacs to disallow splitting?
22:38_rccI found it, I think: http://clojars.org/server-socket
22:51uvtcMy understanding is that the customary way to use a Java lib in your Clojure project is to find the lib at Maven Central. What's the customary way to use one that's *not* at Maven Central? That is, if you just have a jar file?
22:52uvtcIf I just drop it into my project's lib dir, how do I tell lein "hey, this is a dependency, but don't worry -- I'll just provide it myself"?
22:53TimMc~repeatability
22:53clojurebotrepeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability
22:53TimMcuvtc: ^ there's some good info in there
22:53TimMc"Free-Floating Jars"
22:54technomancyTimMc: botsnack
22:54TimMcOm nom nom; that was delicious
22:54technomancy=D
22:56uvtcWhoops. Sorry. Yes, I did read that, but I followed the link to the lein-localrepo README and did not know what they meant by "leiningen (maven) coordinates of a file" and that most likely got pulled away.
22:58_rccI'd like to add a "console" that I can telnet into so I can run arbitrary commands inside of my JVM. I'd like to execute inside of some environment (e.g. maybe have some macros defined and/or some variables). I'm thinking of using clojure.contrib.server-socket for this. Is this a good approach?
22:59amalloythat sounds like swank/slime, or nrepl or something
23:00_rccThe app running in the JVM is not a clojure app
23:00_rccI'm not sure if that matters
23:00_rccIt's a Java app
23:01juhu_chapaTimMc: Thank you! :D
23:01TimMcuvtc: "Coordinates" is a weird bit of jargon for group ID, artifact ID, and version.
23:02TimMcuvtc: like [org.clojure/clojure "1.3.0"]
23:02technomancy_rcc: see mire for a (somewhat dated) example of code that does that
23:02technomancyit uses server-socket
23:03_rcctechnomancy: thanks! I'll have a look.
23:03technomancyalso check out the peepcode screencast if you want a more detailed walkthrough</shill>
23:04nappingztellman: is gloss broken on 1.3.0?
23:04ztellmannapping: 0.2.1 should work
23:04ztellmanwith both 1.2 and 1.3
23:04uvtcTimMc, Thanks! Regardless though, the top line of the lein-localrepo readme says that it's for working with a local Maven repository. I was looking for a way to skip that and just tell lein, "don't worry, just use this jar I'm putting here" (even though that might not be the best for repeatability).
23:04nappingI'll try that
23:06TimMcuvtc: You *can* explicitly add stuff to the classpath, but that will only work on your machine.
23:06uvtcTimMc, Just out of curiosity though, is lein-localrepo talking about my ~/m2/repository when it says "local maven repository", or is it talking about some other one that I might create myself for other local users to have access to?
23:06TimMcYep, that's the one.
23:07TimMcWell, I assumed so.
23:08uvtcTimMc, Ok. Thanks.
23:08nappingztellman: thanks, that helsp
23:08ztellmannapping: np
23:08nappingI guess I did need the scary alpha2-SNAPSHOT :)
23:09nappinghow is a repeated with :delimiters supposed to behave?
23:10uvtcWhen would I want to use the `lein compile` command (given that `lein run` implicitly compiles for me)?
23:10nappingI was about to test it, but you probably meant the docs to make it clear
23:10cgagls
23:10cgagoops
23:10TimMcuvtc: I would hazard a guess that that allows mroe complicated builds where Java links against the Clojure classes.
23:11uvtcTimMc, Ah! Makes sense, since Java would need those class files. Thanks again!
23:11TimMcI think I played around with that at work.
23:14napping(let [fr (repeated :int16 :delimiters [0])] (decode fr (encode fr [1])))
23:27uvtcWill MS Windows run a jar file Clojure gui app if double-clicked on?
23:28ztellmannapping: sorry, I usually keep IRC in the background, didn't notice your questions
23:29nappingztellman: it looks like repeated just stops whenever it sees the byte
23:29nappinglike this failing: (let [fr (repeated :int16 :delimiters [0])] (decode fr (encode fr [1])))
23:30nappingis there anything like (repeate-until frame is-terminator?)
23:30ztellmanif you want a multi-byte delimiter, that will work too
23:30ztellmanunless I'm misunderstanding your question
23:30nappingit's a one byte delimiter, but it can occur in the sequence also
23:31ztellmanah, you want :suffix, then
23:31ztellmanbut then you need some other indicator of the length
23:32nappingfor a simple example, think of length-prefixed strings repeated until one has length 0
23:32ztellmanbecause the trailing byte isn't an unambiguous indicator of when the repeated structure ends
23:33ztellmannapping: yeah, there's not really a construct for that
23:33technomancyuvtc: you should never have to run deps, compile, or javac explicitly
23:34ztellmangloss needs a redesign so it's easier to construct those sorts of operators yourself
23:34uvtctechnomancy, Thanks!
23:35nappingit's not documented, but is implementing Reader/Writer that bad?
23:35ztellmannapping: no, not really
23:35ztellmanit's just harder than it should be
23:36ztellmanit's pretty easy to infer from the code, but feel free to ask any questions you have
23:39amalloycan't you use a header to implement this construct?
23:39ztellmanamalloy: yes, except that you're increasing the nesting level each time
23:40amalloythe header's format is a length-prefixed string, and the body format is either: the same header format again, if the string was non-empty; or a zero-byre format
23:40dougwhen i do a "lein run" on osx, java fires up a window and i lose focus on my terminal.
23:40amalloythe nesting level of what?
23:40douganyone know a good way to keep that from happening?
23:40nappingamalloy: with the header cons'd onto the body
23:40nappingmaybe that works?
23:41ztellmanamalloy: each element is the body of the previous element
23:41ztellmanI'm pretty sure that if you had several thousand elements, that gets ugly
23:41ztellmanthat was why I didn't suggest it, but maybe I'm wrong
23:41amalloyi don't think it does, but it's not something i've thought hard about
23:42ztellmannapping: that might work, and it's easier than rolling your own
23:42nappingI'd like to be sure it's not recompiling a frame at each step
23:42cgaganyone know how to setup noir with the new leiningen?
23:42amalloyit won't, napping
23:42ztellmannapping: just return a compiled frame
23:42ztellmanor one of two compiled frames
23:43nappingso put compiled-frame outside the fn
23:44ztellmanyes, just have a (def …) somewhere
23:44nappinghow do I close over the element then?
23:45ztellmanI'm not sure I understand your question
23:45ztellmanoh, right
23:45ztellmanI see what you're saying
23:45amalloyyou need it to be self-referential, right?
23:47ztellmanI'm back to being pretty sure this won't work
23:47nappingit's not so much that, as sticking the element parsed by header onto the front
23:47ztellmanyou're right, that will require a recompilation each time
23:48nappingisn't (compile-frame frame (partial cons x) -) going to be cheap if frame is already compiled?
23:48ztellmanyes, it will
23:48ztellmanbut not free
23:50nappingI should be able to afford that
23:50nappingthe big data will go with finite-block
23:50Lajlanapping, this fucking adapter is a piece of shit
23:50LajlaI gotta wave it in the air to get a signal to it.
23:51ztellmanhmm, looking at the code...
23:51LajlaIt figures when your army production stops my wireless signal drops.
23:51LajlaCall my ISP before I shit a brick, tell the internet tech I'll drill holes in his dick
23:51Lajlahe says "Sorry sir, we don't work on routers', so I hang up and rage.
23:51ztellmannapping: okay, I was overestimating the cost of that
23:52ztellmansorry to be so flip-floppy, it's been a while since I've touched gloss
23:52nappingamalloy: how to sort out the self-reference? I'd like a letrec
23:52kwertiiI have a program that works fine via clojure-jack-in/SLIME but fails with "lein uberjar," "lein run," and "lein compile" with a mysterious Exception in thread "main" java.lang.RuntimeException: java.lang.ExceptionInInitializerError -- anyone know what this is about?
23:53amalloyyeah, you kinda have to fake letrec with mutation
23:53amalloy(let [self (promise), impl (fn (...use @self...)) (deliver self impl) impl)
23:54nappingHave you heard the good word of the Church of the Least Fixed Point?